Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2011 JBoss Inc
   *
   * Licensed 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.drools.workbench.screens.guided.dtable.client.widget.analysis.condition;
 
 
 import java.util.List;
 
 
     // TODO support operator "in" and optimize to allowedValueList if not continuous
     // private List<Integer> allowedValueList = null;
     private Integer from = null;
     private boolean fromInclusive;
     private Integer to = null;
     private boolean toInclusive;
     private List<IntegerdisallowedList = new ArrayList<Integer>( 1 );
 
     public NumericIntegerConditionDetectorPattern52 pattern,
                                             String factField,
                                             Integer value,
                                             String operator ) {
         superpattern,
                factField );
         if ( operator.equals"==" ) ) {
              = value;
              = true;
              = value;
              = true;
         } else if ( operator.equals"!=" ) ) {
             .addvalue );
         } else if ( operator.equals"<" ) ) {
              = value;
              = false;
         } else if ( operator.equals"<=" ) ) {
              = value;
              = true;
         } else if ( operator.equals">" ) ) {
              = value;
              = false;
         } else if ( operator.equals">=" ) ) {
              = value;
              = true;
         } else {
              = true;
         }
     }
 
                                             NumericIntegerConditionDetector b ) {
         supera,
                b );
         if ( b.from == null ) {
              = a.from;
              = a.fromInclusive;
         } else if ( a.from == null ) {
              = b.from;
              = b.fromInclusive;
         } else {
             int comparison = a.from.compareTob.from );
             if ( comparison < 0 ) {
                  = b.from;
                  = b.fromInclusive;
             } else if ( comparison == 0 ) {
                  = a.from;
                  = a.fromInclusive && b.fromInclusive;
             } else {
                  = a.from;
                  = a.fromInclusive;
             }
         }
         if ( b.to == null ) {
              = a.to;
              = a.toInclusive;
         } else if ( a.to == null ) {
              = b.to;
              = b.toInclusive;
         } else {
             int comparison = a.to.compareTob.to );
             if ( comparison < 0 ) {
                  = a.to;
                  = a.toInclusive;
             } else if ( comparison == 0 ) {
                 = a.to;
                 = a.toInclusive && b.toInclusive;
            } else {
                 = b.to;
                 = b.toInclusive;
            }
        }
        .addAlla.disallowedList );
        .addAllb.disallowedList );
        optimizeNotList();
        detectImpossibleMatch();
    }
    private void optimizeNotList() {
        for ( Iterator<IntegernotIt = .iterator(); notIt.hasNext(); ) {
            Integer notValue = notIt.next();
            if (  != null ) {
                int comparison = notValue.compareTo );
                if ( comparison <= 0 ) {
                    notIt.remove();
                }
                if ( comparison == 0 ) {
                     = false;
                }
            }
            if (  != null ) {
                int comparison = notValue.compareTo );
                if ( comparison >= 0 ) {
                    notIt.remove();
                }
                if ( comparison == 0 ) {
                     = false;
                }
            }
        }
    }
    private void detectImpossibleMatch() {
        if (  != null &&  != null ) {
            int comparison = .compareTo );
            if ( comparison > 0 || ( comparison == 0 && ( ! || ! ) ) ) {
                 = true;
            }
        }
    }
        return new NumericIntegerConditionDetectorthis,
                                                    other );
    }
New to GrepCode? Check out our FAQ X