< prev index next >

src/java.base/share/classes/jdk/internal/icu/impl/UnicodeSetStringSpan.java

Print this page
rev 57619 : imported patch 8174270
   1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  ******************************************************************************
  28  *
  29  *   Copyright (C) 2009-2014, International Business Machines
  30  *   Corporation and others.  All Rights Reserved.
  31  *
  32  ******************************************************************************
  33  */
  34 
  35 package sun.text.normalizer;
  36 
  37 import java.util.ArrayList;
  38 
  39 import sun.text.normalizer.UnicodeSet.SpanCondition;



  40 
  41 /*
  42  * Implement span() etc. for a set with strings.
  43  * Avoid recursion because of its exponential complexity.
  44  * Instead, try multiple paths at once and track them with an IndexList.
  45  */
  46 class UnicodeSetStringSpan {
  47 
  48     /*
  49      * Which span() variant will be used? The object is either built for one variant and used once,
  50      * or built for all and may be used many times.
  51      */
  52     public static final int WITH_COUNT    = 0x40;  // spanAndCount() may be called
  53     public static final int FWD           = 0x20;
  54     public static final int BACK          = 0x10;
  55     // public static final int UTF16      = 8;
  56     public static final int CONTAINED     = 2;
  57     public static final int NOT_CONTAINED = 1;
  58 
  59     public static final int ALL = 0x7f;
  60 
  61     public static final int FWD_UTF16_CONTAINED      = FWD  | /* UTF16 | */    CONTAINED;
  62     public static final int FWD_UTF16_NOT_CONTAINED  = FWD  | /* UTF16 | */NOT_CONTAINED;
  63     public static final int BACK_UTF16_CONTAINED     = BACK | /* UTF16 | */    CONTAINED;
  64     public static final int BACK_UTF16_NOT_CONTAINED = BACK | /* UTF16 | */NOT_CONTAINED;
  65 
  66     /**


   1 /*
   2  * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /*
  27  ******************************************************************************
  28  *
  29  *   Copyright (C) 2009-2014, International Business Machines
  30  *   Corporation and others.  All Rights Reserved.
  31  *
  32  ******************************************************************************
  33  */
  34 
  35 package jdk.internal.icu.impl;
  36 
  37 import java.util.ArrayList;
  38 
  39 import jdk.internal.icu.text.UTF16;
  40 import jdk.internal.icu.text.UnicodeSet;
  41 import jdk.internal.icu.text.UnicodeSet.SpanCondition;
  42 import jdk.internal.icu.util.OutputInt;
  43 
  44 /*
  45  * Implement span() etc. for a set with strings.
  46  * Avoid recursion because of its exponential complexity.
  47  * Instead, try multiple paths at once and track them with an IndexList.
  48  */
  49 public class UnicodeSetStringSpan {
  50 
  51     /*
  52      * Which span() variant will be used? The object is either built for one variant and used once,
  53      * or built for all and may be used many times.
  54      */
  55     public static final int WITH_COUNT    = 0x40;  // spanAndCount() may be called
  56     public static final int FWD           = 0x20;
  57     public static final int BACK          = 0x10;
  58     // public static final int UTF16      = 8;
  59     public static final int CONTAINED     = 2;
  60     public static final int NOT_CONTAINED = 1;
  61 
  62     public static final int ALL = 0x7f;
  63 
  64     public static final int FWD_UTF16_CONTAINED      = FWD  | /* UTF16 | */    CONTAINED;
  65     public static final int FWD_UTF16_NOT_CONTAINED  = FWD  | /* UTF16 | */NOT_CONTAINED;
  66     public static final int BACK_UTF16_CONTAINED     = BACK | /* UTF16 | */    CONTAINED;
  67     public static final int BACK_UTF16_NOT_CONTAINED = BACK | /* UTF16 | */NOT_CONTAINED;
  68 
  69     /**


< prev index next >