text:
/**********************************************************\
|                                                          |
|                          hprose                          |
|                                                          |
| Official WebSite: http://www.hprose.com/                 |
|                   http://www.hprose.org/                 |
|                                                          |
\**********************************************************/
/**********************************************************\
 *                                                        *
 * ClassUtil.java                                         *
 *                                                        *
 * Class Util class for Java.                             *
 *                                                        *
 * LastModified: Apr 8, 2017                              *
 * Author: Ma Bingyao <andot@hprose.com>                  *
 *                                                        *
\**********************************************************/
package hprose.util;

import hprose.io.HproseClassManager;
import java.lang.reflect.Array;
import java.lang.reflect.GenericArrayType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.lang.reflect.WildcardType;

public final class ClassUtil {

    public final static String getClassAlias(Class<?> type) {
        String className = HproseClassManager.getClassAlias(type);
        if (className == null) {
            className = type.getName().replace('.', '_').replace('$', '_');
            HproseClassManager.register(type, className);
        }
        return className;
    }

    private static Class<?> toClass(Type[] bounds) {
        if (bounds.length == 1) {
            Type boundType = bounds[0];
            if (boundType instanceof Class<?>) {
                return (Class<?>) boundType;
            }
        }
        return Object.class;
    }

    public final static Class<?> toClass(Type type) {
        if (type == null) {
            return null;
        }
        else if (type instanceof Class<?>) {
            return (Class<?>) type;
        }
        else if (type instanceof WildcardType) {
            return toClass(((WildcardType) type).getUpperBounds());
        }
        else if (type instanceof TypeVariable) {
            return toClass(((TypeVariable) type).getBounds());
        }
        else if (type instanceof ParameterizedType) {
            return toClass(((ParameterizedType) type).getRawType());
        }
        else if (type instanceof GenericArrayType) {
            return Array.newInstance(toClass(((GenericArrayType) type).getGenericComponentType()), 0).getClass();
        }
        else {
            return Object.class;
        }
    }

    public final static Type getComponentType(Type type) {
        return (type instanceof GenericArrayType) ?
                ((GenericArrayType) type).getGenericComponentType() :
                (type instanceof ParameterizedType) ?
                ((ParameterizedType)type).getActualTypeArguments()[0] :
                ((Class<?>) type).isArray() ?
                ((Class<?>) type).getComponentType() : Object.class;
    }

    public final static Type getKeyType(Type type) {
        return (type instanceof ParameterizedType) ?
                ((ParameterizedType)type).getActualTypeArguments()[0] :
                Object.class;
    }

    public final static Type getValueType(Type type) {
        return (type instanceof ParameterizedType) ?
                ((ParameterizedType)type).getActualTypeArguments()[1] :
                Object.class;
    }

    public final static Type getActualType(Type type, Type paramType) {
        if ((type instanceof ParameterizedType) &&
            (paramType instanceof TypeVariable)) {
            Type[] actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
            TypeVariable[] typeParameters = ((TypeVariable) paramType).getGenericDeclaration().getTypeParameters();
            int n = typeParameters.length;
            for (int i = 0; i < n; i++) {
                if (typeParameters[i].equals(paramType)) {
                    return actualTypeArguments[i];
                }
            }
        }
        return paramType;
    }
}


text:
package main

import (
	"C4Service"
	"flag"
	"fmt"
	"git.apache.org/thrift.git/lib/go/thrift"
	"math"
	"net"
	"net/url"
	"os"
	"strconv"
	"strings"
)

func Usage() {
	fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:")
	flag.PrintDefaults()
	fmt.Fprintln(os.Stderr, "\nFunctions:")
	fmt.Fprintln(os.Stderr, "  void InsertOrUpdate(TRowKey rowId, TColumnKey columnId, TValue value, TTTL ttl)")
	fmt.Fprintln(os.Stderr, "  TValue Get(TRowKey rowId, TColumnKey columnId)")
	fmt.Fprintln(os.Stderr, "  void TombstoneColumn(TRowKey rowId, TColumnKey columnId)")
	fmt.Fprintln(os.Stderr, "  void TombstoneRow(TRowKey rowId)")
	fmt.Fprintln(os.Stderr)
	os.Exit(0)
}

func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = math.MinInt32 // will become unneeded eventually
	_ = strconv.Atoi
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := C4Service.NewC4ClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "InsertOrUpdate":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "InsertOrUpdate requires 4 args")
			flag.Usage()
		}
		argvalue0, err18 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err18 != nil {
			Usage()
			return
		}
		value0 := C4Service.TRowKey(argvalue0)
		tmp1, err19 := (strconv.Atoi(flag.Arg(2)))
		if err19 != nil {
			Usage()
			return
		}
		argvalue1 := byte(tmp1)
		value1 := C4Service.TColumnKey(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := C4Service.TValue(argvalue2)
		tmp3, err21 := (strconv.Atoi(flag.Arg(4)))
		if err21 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := C4Service.TTTL(argvalue3)
		fmt.Print(client.InsertOrUpdate(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "Get":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "Get requires 2 args")
			flag.Usage()
		}
		argvalue0, err22 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err22 != nil {
			Usage()
			return
		}
		value0 := C4Service.TRowKey(argvalue0)
		tmp1, err23 := (strconv.Atoi(flag.Arg(2)))
		if err23 != nil {
			Usage()
			return
		}
		argvalue1 := byte(tmp1)
		value1 := C4Service.TColumnKey(argvalue1)
		fmt.Print(client.Get(value0, value1))
		fmt.Print("\n")
		break
	case "TombstoneColumn":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "TombstoneColumn requires 2 args")
			flag.Usage()
		}
		argvalue0, err24 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err24 != nil {
			Usage()
			return
		}
		value0 := C4Service.TRowKey(argvalue0)
		tmp1, err25 := (strconv.Atoi(flag.Arg(2)))
		if err25 != nil {
			Usage()
			return
		}
		argvalue1 := byte(tmp1)
		value1 := C4Service.TColumnKey(argvalue1)
		fmt.Print(client.TombstoneColumn(value0, value1))
		fmt.Print("\n")
		break
	case "TombstoneRow":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TombstoneRow requires 1 args")
			flag.Usage()
		}
		argvalue0, err26 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err26 != nil {
			Usage()
			return
		}
		value0 := C4Service.TRowKey(argvalue0)
		fmt.Print(client.TombstoneRow(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}

redpajama_set_name: RedPajamaGithub


text:
ocl-demo1
=========

Simple demo of OpenCL


text:
package org.xtuml.bp.xtext.oal.xoal.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtuml.bp.xtext.oal.xoal.XoalPackage;
import org.xtuml.bp.xtext.oal.xoal.block;
import org.xtuml.bp.xtext.oal.xoal.for_statement;
import org.xtuml.bp.xtext.oal.xoal.inst_ref_set_var;

/**
 *
 * An implementation of the model object 'for statement'.
 *
 *

 * The following features are implemented:
 *

 *
{@link org.xtuml.bp.xtext.oal.xoal.impl.for_statementImpl#getA1 A1}

 *
{@link org.xtuml.bp.xtext.oal.xoal.impl.for_statementImpl#getA2 A2}

 *
{@link org.xtuml.bp.xtext.oal.xoal.impl.for_statementImpl#getA3 A3}

 *

 *

 *
 * @generated
 */
public class for_statementImpl extends statementImpl implements for_statement
{
  /**
   * The default value of the '{@link #getA1() A1}' attribute.
   *
   *
   * @see #getA1()
   * @generated
   * @ordered
   */
  protected static final String A1_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getA1() A1}' attribute.
   *
   *
   * @see #getA1()
   * @generated
   * @ordered
   */
  protected String a1 = A1_EDEFAULT;

  /**
   * The cached value of the '{@link #getA2() A2}' containment reference.
   *
   *
   * @see #getA2()
   * @generated
   * @ordered
   */
  protected inst_ref_set_var a2;

  /**
   * The cached value of the '{@link #getA3() A3}' containment reference.
   *
   *
   * @see #getA3()
   * @generated
   * @ordered
   */
  protected block a3;

  /**
   *
   *
   * @generated
   */
  protected for_statementImpl()
  {
    super();
  }

  /**
   *
   *
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return XoalPackage.Literals.FOR_STATEMENT;
  }

  /**
   *
   *
   * @generated
   */
  public String getA1()
  {
    return a1;
  }

  /**
   *
   *
   * @generated
   */
  public void setA1(String newA1)
  {
    String oldA1 = a1;
    a1 = newA1;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XoalPackage.FOR_STATEMENT__A1, oldA1, a1));
  }

  /**
   *
   *
   * @generated
   */
  public inst_ref_set_var getA2()
  {
    return a2;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetA2(inst_ref_set_var newA2, NotificationChain msgs)
  {
    inst_ref_set_var oldA2 = a2;
    a2 = newA2;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XoalPackage.FOR_STATEMENT__A2, oldA2, newA2);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setA2(inst_ref_set_var newA2)
  {
    if (newA2 != a2)
    {
      NotificationChain msgs = null;
      if (a2 != null)
        msgs = ((InternalEObject)a2).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XoalPackage.FOR_STATEMENT__A2, null, msgs);
      if (newA2 != null)
        msgs = ((InternalEObject)newA2).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XoalPackage.FOR_STATEMENT__A2, null, msgs);
      msgs = basicSetA2(newA2, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XoalPackage.FOR_STATEMENT__A2, newA2, newA2));
  }

  /**
   *
   *
   * @generated
   */
  public block getA3()
  {
    return a3;
  }

  /**
   *
   *
   * @generated
   */
  public NotificationChain basicSetA3(block newA3, NotificationChain msgs)
  {
    block oldA3 = a3;
    a3 = newA3;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, XoalPackage.FOR_STATEMENT__A3, oldA3, newA3);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   *
   *
   * @generated
   */
  public void setA3(block newA3)
  {
    if (newA3 != a3)
    {
      NotificationChain msgs = null;
      if (a3 != null)
        msgs = ((InternalEObject)a3).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - XoalPackage.FOR_STATEMENT__A3, null, msgs);
      if (newA3 != null)
        msgs = ((InternalEObject)newA3).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - XoalPackage.FOR_STATEMENT__A3, null, msgs);
      msgs = basicSetA3(newA3, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, XoalPackage.FOR_STATEMENT__A3, newA3, newA3));
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case XoalPackage.FOR_STATEMENT__A2:
        return basicSetA2(null, msgs);
      case XoalPackage.FOR_STATEMENT__A3:
        return basicSetA3(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case XoalPackage.FOR_STATEMENT__A1:
        return getA1();
      case XoalPackage.FOR_STATEMENT__A2:
        return getA2();
      case XoalPackage.FOR_STATEMENT__A3:
        return getA3();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case XoalPackage.FOR_STATEMENT__A1:
        setA1((String)newValue);
        return;
      case XoalPackage.FOR_STATEMENT__A2:
        setA2((inst_ref_set_var)newValue);
        return;
      case XoalPackage.FOR_STATEMENT__A3:
        setA3((block)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case XoalPackage.FOR_STATEMENT__A1:
        setA1(A1_EDEFAULT);
        return;
      case XoalPackage.FOR_STATEMENT__A2:
        setA2((inst_ref_set_var)null);
        return;
      case XoalPackage.FOR_STATEMENT__A3:
        setA3((block)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case XoalPackage.FOR_STATEMENT__A1:
        return A1_EDEFAULT == null ? a1 != null : !A1_EDEFAULT.equals(a1);
      case XoalPackage.FOR_STATEMENT__A2:
        return a2 != null;
      case XoalPackage.FOR_STATEMENT__A3:
        return a3 != null;
    }
    return super.eIsSet(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (a1: ");
    result.append(a1);
    result.append(')');
    return result.toString();
  }

} //for_statementImpl


text:
//
//  NSDate+CZFTools.m
//  CZFToolDemo
//
//  Created by 陈帆 on 2018/2/9.
//  Copyright © 2018年 陈帆. All rights reserved.
//

#import "NSDate+CZFTools.h"
#import "NSString+CZFTools.h"

@implementation NSDate (CZFTools)

/**
 *  根据一个过去的时间与现在时间做对比,获取间隔多少分钟
 *
 *  @param oldDate 过去时间
 *
 *  @return 差值多少秒
 */
+ (long)getMinuteByOldDateBetweenNowDate:(NSDate *)oldDate {
    long betweenMinutes = 0;

    // 获取本地时间
    NSDate *nowdate = [self dateFromString:[NSString getLocalTime] andFormatterString:@"yyyy-MM-dd HH:mm:ss"];
    betweenMinutes = [nowdate timeIntervalSinceDate:oldDate]/60;

    return betweenMinutes;
}

/**
 *  NSString转换成NSDate,根据 自定义格式  @"yyyy-MM-dd HH:mm:ss zzz"
 */
+ (NSDate *)dateFromString:(NSString *)dateString andFormatterString:(NSString *)strFormater {

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

    [dateFormatter setDateFormat:strFormater];

    NSDate *destDate= [dateFormatter dateFromString:dateString];
    NSTimeZone *zone = [NSTimeZone systemTimeZone];
    NSInteger interval = [zone secondsFromGMTForDate: destDate];
    NSDate *dateCurrent = [destDate  dateByAddingTimeInterval: interval];

    return dateCurrent;
}

/**
 *  NSDate转换成NSString,根据 自定义格式  @"yyyy-MM-dd HH:mm:ss zzz"  忽略时区的转换
 */
+ (NSString *)stringIgnoreZoneFromDate:(NSDate *)date andFormatterString:(NSString *)strFormater {

    NSTimeZone *zone = [NSTimeZone systemTimeZone];
    NSInteger interval = [zone secondsFromGMTForDate: date];
    NSDate *localeDate = [date  dateByAddingTimeInterval: -interval];

    return [self stringFromDate:localeDate andFormatterString:strFormater];
}

/**
 *  根据日期获取对应的星期几
 *
 *  @param strInputDate 输入日期字符串
 *
 *  @return 星期几
 */
+ (NSString*)weekdayStringFromDate:(NSString *)strInputDate {

    NSDate *inputDate = [self dateFromString:strInputDate andFormatterString:@"yy-MM-dd"];

    NSArray *weekdays = [NSArray arrayWithObjects: [NSNull null], @"周日", @"周一", @"周二", @"周三", @"周四", @"周五", @"周六", nil];

    NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];

    NSTimeZone *timeZone = [[NSTimeZone alloc] initWithName:@"Asia/Shanghai"];  // 设置时区

    [calendar setTimeZone: timeZone];

    NSCalendarUnit calendarUnit = NSCalendarUnitWeekday;

    NSDateComponents *theComponents = [calendar components:calendarUnit fromDate:inputDate];

    return [weekdays objectAtIndex:theComponents.weekday];

}

/**
 格式化为可读的时间显示字符串

 @param date 时间
 @return 可读时间字符串
 */
+ (NSString *)stringNormalReadWithDate:(NSDate *)date {
    NSArray *dateInfoArray = [self getDateYearMonthDayWithDate:date];
    NSArray *currentDateInfoArray = [self getDateYearMonthDayWithDate:[NSDate date]];

    if ([dateInfoArray[0] integerValue] == [currentDateInfoArray[0] integerValue]) {
        // 年相等
        if ([dateInfoArray[1] integerValue] == [currentDateInfoArray[1] integerValue]) {
            // 月相等
            if ([dateInfoArray[2] integerValue] == [currentDateInfoArray[2] integerValue]) {
                // 日相等
                return [self stringFromDate:date andFormatterString:@"今天 HH:mm"];
            } else {
                NSInteger gapValue = [currentDateInfoArray[2] integerValue] - [dateInfoArray[2] integerValue] ;
                if (gapValue == 1) {
                    return [self stringFromDate:date andFormatterString:@"昨天 HH:mm"];
                } else if (gapValue == -1) {
                    return [self stringFromDate:date andFormatterString:@"明天 HH:mm"];
                }
                return [self stringFromDate:date andFormatterString:@"M月d日 HH:mm"];
            }
        } else {
            return [self stringFromDate:date andFormatterString:@"M月d日 HH:mm"];
        }
    }

    return [self stringFromDate:date andFormatterString:@"yyyy年M月d日 HH:mm"];
}

/**
 获取日期的年月日时分秒毫秒周

 @param date 日期
 @return 年月日时分秒毫秒周数组
 */
+ (NSArray *)getDateYearMonthDayWithDate:(NSDate *)date {
    NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];

    NSDateComponents *comps = [[NSDateComponents alloc] init];

    NSInteger unitFlags = NSCalendarUnitYear |

    NSCalendarUnitMonth |

    NSCalendarUnitDay |

    NSCalendarUnitWeekday |

    NSCalendarUnitHour |

    NSCalendarUnitMinute |

    NSCalendarUnitSecond |

    NSCalendarUnitNanosecond;

    comps = [calendar components:unitFlags fromDate:date];

    return @[@([comps year]),
             @([comps month]),
             @([comps day]),
             @([comps hour]),
             @([comps minute]),
             @([comps second]),
             @([comps nanosecond]),
             @([comps weekday]-1)];
}

/**
 *  NSDate转换成NSString,根据 自定义格式  @"yyyy-MM-dd HH:mm:ss zzz"
 */
+ (NSString *)stringFromDate:(NSDate *)date andFormatterString:(NSString *)strFormater {

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];

    //zzz表示时区,zzz可以删除,这样返回的日期字符将不包含时区信息。

    [dateFormatter setDateFormat:strFormater];
    NSString *destDateString = [dateFormatter stringFromDate:date];

    return destDateString;
}

/**
 *  获取时间字符串,从当前时间开始算起,正数表示向后推算几天,负数表示向前推算几天
 *  自定义格式  @"yyyy-MM-dd HH:mm:ss zzz"
 */
+ (NSString *)DateToStringForOtherDateFromNowDays:(NSInteger)dayValue andFormatterString:(NSString *)strFormater {
    NSDate* date = [[NSDate alloc] init];
    date = [date dateByAddingTimeInterval:dayValue*3600*24];

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:strFormater];
    NSString *strDate = [dateFormatter stringFromDate:date];

    return strDate;
}

/**
 *  获取时间字符串,从某个日期算起,正数表示向后推算几小时,负数表示向前推算几小时
 *  自定义格式  @"yyyy-MM-dd HH:mm:ss zzz"
 */
+ (NSString *)DateToStringForOtherHourFromNowHours:(NSInteger)dayValue andFormatterString:(NSString *)strFormater andDate:(NSDate *)date {
    NSDate *dateTemp = [date dateByAddingTimeInterval:(dayValue-8)*3600];

    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:strFormater];
    NSString *strDate = [dateFormatter stringFromDate:dateTemp];

    return strDate;
}

/**
 格式化数据发布时间

 @param oldDate oldDate
 */
+ (NSString *)formattingTimeCanEasyRead:(NSDate *)oldDate {
    NSString *timeStr = nil;
    long betweenMinutes = [NSDate getMinuteByOldDateBetweenNowDate:oldDate];
    if (betweenMinutes < 60) {
        timeStr = [NSString stringWithFormat:@"%li分钟前发布", betweenMinutes];
    } if (betweenMinutes >= 60 && betweenMinutes < 3600) {
        timeStr = [NSString stringWithFormat:@"%li小时前发布", betweenMinutes/60];
    } if (betweenMinutes >=3600) {
        timeStr = [NSString stringWithFormat:@"%li天前发布", betweenMinutes/3600];
    }

    return timeStr;
}

@end


text:
namespace network {

NetLogProxySink::NetLogProxySink()
    : task_runner_(base::SequencedTaskRunner::GetCurrentDefault()) {
  // Initialize a WeakPtr instance that can be safely referred to from other
  // threads when binding tasks posted back to this thread.
  weak_this_ = weak_factory_.GetWeakPtr();
  net::NetLog::Get()->AddCaptureModeObserver(this);
}

NetLogProxySink::~NetLogProxySink() {
  net::NetLog::Get()->RemoveCaptureModeObserver(this);
}

void NetLogProxySink::AttachSource(
    mojo::PendingRemote<network::mojom::NetLogProxySource> proxy_source_remote,
    mojo::PendingReceiver<network::mojom::NetLogProxySink>
        proxy_sink_receiver) {
  DCHECK(task_runner_->RunsTasksInCurrentSequence());

  // Initialize remote with current capturing state. (Netlog capturing might
  // already be active when NetLogProxySource gets attached.)
  mojo::Remote<network::mojom::NetLogProxySource> bound_remote(
      std::move(proxy_source_remote));
  bound_remote->UpdateCaptureModes(GetObserverCaptureModes());

  proxy_source_remotes_.Add(std::move(bound_remote));
  proxy_sink_receivers_.Add(this, std::move(proxy_sink_receiver));
}

void NetLogProxySink::OnCaptureModeUpdated(net::NetLogCaptureModeSet modes) {
  if (!task_runner_->RunsTasksInCurrentSequence()) {
    task_runner_->PostTask(
        FROM_HERE, base::BindOnce(&NetLogProxySink::OnCaptureModeUpdated,
                                  weak_this_, modes));
    return;
  }

  for (const auto& source : proxy_source_remotes_) {
    source->UpdateCaptureModes(modes);
  }
}

void NetLogProxySink::AddEntry(uint32_t type,
                               uint32_t source_type,
                               uint32_t source_id,
                               base::TimeTicks source_start_time,
                               net::NetLogEventPhase phase,
                               base::TimeTicks time,
                               base::Value params) {
  // Note: There is a possible race condition, where the NetLog capture mode
  // changes, but the other process is still sending events for the old capture
  // mode, and thus might log events with a higher than expected capture mode.
  // (But if capturing is completely disabled and the other side still has some
  // events in the pipe, AddEntryWithMaterializedParams will do nothing, since
  // that implies no observers are registered.)
  // TODO(mattm): Remote side could send the capture mode along with the event,
  // and then check here before logging that the current capture mode still is
  // compatible.
  if (source_type >= static_cast<uint32_t>(net::NetLogSourceType::COUNT) ||
      source_id == net::NetLogSource::kInvalidId) {
    mojo::ReportBadMessage("invalid NetLogSource");
    return;
  }
  AddEntryAtTimeWithMaterializedParams(
      static_cast<net::NetLogEventType>(type),
      net::NetLogSource(static_cast<net::NetLogSourceType>(source_type),
                        source_id, source_start_time),
      phase, time, std::move(params));
}

}  // namespace network


text:
Localization demo
   Dynamically change localization settings for AngularJS

Pick a locale
         <select class="form-control" ng-model="model.selectedLocale" ng-options="key as value for (key, value) in availableLocales" ng-change="changeLocale(model.selectedLocale)"></select>

Selected locale id:

{{model.selectedLocale}}

Current locale id:

{{$locale.id}}

A big number:

{{1234567890 | number}}

The Epoch was on:

{{0 | date}}

One million:

{{1000000 | currency}}


text:
import unittest

import numpy as np
from parameterized import parameterized

from monai.transforms import RandAdjustContrast
from tests.utils import TEST_NDARRAYS, NumpyImageTestCase2D, assert_allclose

TEST_CASE_1 = [(0.5, 4.5)]

TEST_CASE_2 = [1.5]

class TestRandAdjustContrast(NumpyImageTestCase2D):
    @parameterized.expand([TEST_CASE_1, TEST_CASE_2])
    def test_correct_results(self, gamma):
        adjuster = RandAdjustContrast(prob=1.0, gamma=gamma)
        for p in TEST_NDARRAYS:
            im = p(self.imt)
            result = adjuster(im)
            epsilon = 1e-7
            img_min = self.imt.min()
            img_range = self.imt.max() - img_min
            expected = (
                np.power(((self.imt - img_min) / float(img_range + epsilon)), adjuster.gamma_value) * img_range
                + img_min
            )
            assert_allclose(result, expected, rtol=1e-05, type_test=False)

if __name__ == "__main__":
    unittest.main()


text:
package org.apache.sis.internal.jaxb.code;

import javax.xml.bind.annotation.XmlElement;
import org.opengis.metadata.spatial.PixelOrientation;
import org.apache.sis.internal.jaxb.gmd.EnumAdapter;

/**
 * JAXB adapter for {@link PixelOrientation}, in order to integrate the value in an element
 * complying with ISO-19139 standard. See package documentation for more information about
 * the handling of {@code CodeList} in ISO-19139.
 *
 * @author  Cédric Briançon (Geomatys)
 * @version 0.5
 * @since   0.3
 * @module
 */
public final class MD_PixelOrientationCode extends EnumAdapter<MD_PixelOrientationCode, PixelOrientation> {
    /**
     * The enumeration value.
     */
    @XmlElement(name = "MD_PixelOrientationCode")
    private String value;

    /**
     * Empty constructor for JAXB only.
     */
    public MD_PixelOrientationCode() {
    }

    /**
     * Returns the wrapped value.
     *
     * @param  wrapper  the wrapper.
     * @return the wrapped value.
     */
    @Override
    public final PixelOrientation unmarshal(final MD_PixelOrientationCode wrapper) {
        return PixelOrientation.valueOf(name(wrapper.value));
    }

    /**
     * Wraps the given value.
     *
     * @param  e  the value to wrap.
     * @return the wrapped value.
     */
    @Override
    public final MD_PixelOrientationCode marshal(final PixelOrientation e) {
        if (e == null) {
            return null;
        }
        final MD_PixelOrientationCode wrapper = new MD_PixelOrientationCode();
        wrapper.value = value(e);
        return wrapper;
    }
}


text:
using SQLite;
using System;

namespace ZangSiSee.Models
{
    public class Book
    {
        [PrimaryKey]
        public string Title { get; set; }
        public string ComicTitle { get; set; }
        public int Order { get; set; }
        public string Url { get; set; }

        [Ignore]
        public Uri[] ImageUris { get; set; }
    }
}


text:
from __future__ import unicode_literals

from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('lexicon', '0024_auto_20160407_1428'),
    ]

    operations = [
        migrations.AddField(
            model_name='language',
            name='beastName',
            field=models.CharField(max_length=128, blank=True),
        ),
    ]


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cosmos.System
{
    public class Power
    {
        public static void Reboot()
        {
            HAL.Power.CPUReboot();
        }
        public static void Shutdown()
        {
            HAL.Power.ACPIShutdown();
        }
    }
}


text:
package net.sf.jailer.ui.databrowser.whereconditioneditor;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.sf.jailer.datamodel.PrimaryKey;
import net.sf.jailer.datamodel.Table;
import net.sf.jailer.ui.databrowser.metadata.MDSchema;
import net.sf.jailer.ui.databrowser.metadata.MDTable;
import net.sf.jailer.ui.databrowser.metadata.MetaDataDetailsPanel;
import net.sf.jailer.ui.databrowser.metadata.MetaDataSource;
import net.sf.jailer.util.JSqlParserUtil;
import net.sf.jailer.util.LogUtil;
import net.sf.jailer.util.Pair;
import net.sf.jailer.util.Quoting;
import net.sf.jailer.util.SqlUtil;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.expression.AllValue;
import net.sf.jsqlparser.expression.AnalyticExpression;
import net.sf.jsqlparser.expression.AnyComparisonExpression;
import net.sf.jsqlparser.expression.ArrayConstructor;
import net.sf.jsqlparser.expression.ArrayExpression;
import net.sf.jsqlparser.expression.CaseExpression;
import net.sf.jsqlparser.expression.CastExpression;
import net.sf.jsqlparser.expression.CollateExpression;
import net.sf.jsqlparser.expression.ConnectByRootOperator;
import net.sf.jsqlparser.expression.DateTimeLiteralExpression;
import net.sf.jsqlparser.expression.DateValue;
import net.sf.jsqlparser.expression.DoubleValue;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.ExpressionVisitor;
import net.sf.jsqlparser.expression.ExtractExpression;
import net.sf.jsqlparser.expression.Function;
import net.sf.jsqlparser.expression.HexValue;
import net.sf.jsqlparser.expression.IntervalExpression;
import net.sf.jsqlparser.expression.JdbcNamedParameter;
import net.sf.jsqlparser.expression.JdbcParameter;
import net.sf.jsqlparser.expression.JsonAggregateFunction;
import net.sf.jsqlparser.expression.JsonExpression;
import net.sf.jsqlparser.expression.JsonFunction;
import net.sf.jsqlparser.expression.KeepExpression;
import net.sf.jsqlparser.expression.LongValue;
import net.sf.jsqlparser.expression.MySQLGroupConcat;
import net.sf.jsqlparser.expression.NextValExpression;
import net.sf.jsqlparser.expression.NotExpression;
import net.sf.jsqlparser.expression.NullValue;
import net.sf.jsqlparser.expression.NumericBind;
import net.sf.jsqlparser.expression.OracleHierarchicalExpression;
import net.sf.jsqlparser.expression.OracleHint;
import net.sf.jsqlparser.expression.OracleNamedFunctionParameter;
import net.sf.jsqlparser.expression.Parenthesis;
import net.sf.jsqlparser.expression.RowConstructor;
import net.sf.jsqlparser.expression.RowGetExpression;
import net.sf.jsqlparser.expression.SignedExpression;
import net.sf.jsqlparser.expression.StringValue;
import net.sf.jsqlparser.expression.TimeKeyExpression;
import net.sf.jsqlparser.expression.TimeValue;
import net.sf.jsqlparser.expression.TimestampValue;
import net.sf.jsqlparser.expression.TimezoneExpression;
import net.sf.jsqlparser.expression.TryCastExpression;
import net.sf.jsqlparser.expression.UserVariable;
import net.sf.jsqlparser.expression.ValueListExpression;
import net.sf.jsqlparser.expression.VariableAssignment;
import net.sf.jsqlparser.expression.WhenClause;
import net.sf.jsqlparser.expression.XMLSerializeExpr;
import net.sf.jsqlparser.expression.operators.arithmetic.Addition;
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseAnd;
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseLeftShift;
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseOr;
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseRightShift;
import net.sf.jsqlparser.expression.operators.arithmetic.BitwiseXor;
import net.sf.jsqlparser.expression.operators.arithmetic.Concat;
import net.sf.jsqlparser.expression.operators.arithmetic.Division;
import net.sf.jsqlparser.expression.operators.arithmetic.IntegerDivision;
import net.sf.jsqlparser.expression.operators.arithmetic.Modulo;
import net.sf.jsqlparser.expression.operators.arithmetic.Multiplication;
import net.sf.jsqlparser.expression.operators.arithmetic.Subtraction;
import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
import net.sf.jsqlparser.expression.operators.conditional.XorExpression;
import net.sf.jsqlparser.expression.operators.relational.Between;
import net.sf.jsqlparser.expression.operators.relational.ComparisonOperator;
import net.sf.jsqlparser.expression.operators.relational.EqualsTo;
import net.sf.jsqlparser.expression.operators.relational.ExistsExpression;
import net.sf.jsqlparser.expression.operators.relational.FullTextSearch;
import net.sf.jsqlparser.expression.operators.relational.GeometryDistance;
import net.sf.jsqlparser.expression.operators.relational.GreaterThan;
import net.sf.jsqlparser.expression.operators.relational.GreaterThanEquals;
import net.sf.jsqlparser.expression.operators.relational.InExpression;
import net.sf.jsqlparser.expression.operators.relational.IsBooleanExpression;
import net.sf.jsqlparser.expression.operators.relational.IsDistinctExpression;
import net.sf.jsqlparser.expression.operators.relational.IsNullExpression;
import net.sf.jsqlparser.expression.operators.relational.JsonOperator;
import net.sf.jsqlparser.expression.operators.relational.LikeExpression;
import net.sf.jsqlparser.expression.operators.relational.Matches;
import net.sf.jsqlparser.expression.operators.relational.MinorThan;
import net.sf.jsqlparser.expression.operators.relational.MinorThanEquals;
import net.sf.jsqlparser.expression.operators.relational.NotEqualsTo;
import net.sf.jsqlparser.expression.operators.relational.RegExpMatchOperator;
import net.sf.jsqlparser.expression.operators.relational.RegExpMySQLOperator;
import net.sf.jsqlparser.expression.operators.relational.SimilarToExpression;
import net.sf.jsqlparser.parser.ASTNodeAccess;
import net.sf.jsqlparser.parser.SimpleNode;
import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.StatementVisitorAdapter;
import net.sf.jsqlparser.statement.select.AllColumns;
import net.sf.jsqlparser.statement.select.AllTableColumns;
import net.sf.jsqlparser.statement.select.FromItemVisitor;
import net.sf.jsqlparser.statement.select.Join;
import net.sf.jsqlparser.statement.select.LateralSubSelect;
import net.sf.jsqlparser.statement.select.OrderByElement;
import net.sf.jsqlparser.statement.select.ParenthesisFromItem;
import net.sf.jsqlparser.statement.select.PlainSelect;
import net.sf.jsqlparser.statement.select.Select;
import net.sf.jsqlparser.statement.select.SelectExpressionItem;
import net.sf.jsqlparser.statement.select.SelectItem;
import net.sf.jsqlparser.statement.select.SelectItemVisitor;
import net.sf.jsqlparser.statement.select.SelectVisitor;
import net.sf.jsqlparser.statement.select.SelectVisitorAdapter;
import net.sf.jsqlparser.statement.select.SetOperationList;
import net.sf.jsqlparser.statement.select.SubJoin;
import net.sf.jsqlparser.statement.select.SubSelect;
import net.sf.jsqlparser.statement.select.TableFunction;
import net.sf.jsqlparser.statement.select.ValuesList;
import net.sf.jsqlparser.statement.select.WithItem;
import net.sf.jsqlparser.statement.values.ValuesStatement;

/**
 * Parses a SQL query and tries to find out the type.
 *
 * @author Ralf Wisser
 */
public class WCTypeAnalyser {

	/**
	 * The logger.
	 */
	private static final Logger logger = LoggerFactory.getLogger(MetaDataDetailsPanel.class);

	public static class Result {
		public Table table;
		public String cte;
		public boolean hasCondition;
		public boolean isHaving; // having/where
		public int conditionStart;
		public int conditionEnd;
		public String originalQuery;

		public Set<String> getAlternativeNames(String name) {
			Set<String> names = alternativeNames.get(name);
			if (names == null) {
				names = alternativeNames.get("(" + name + ")");
			}
			return names;
		}

		private Map<String, Set<String>> alternativeNames = new LinkedHashMap<String, Set<String>>();

		private void addAlternativeName(String name, String alternativeName, Quoting quoting) {
			Set<String> names = alternativeNames.get(name);
			if (names == null) {
				names = new HashSet<String>();
				alternativeNames.put(name, names);
			}
			names.add(alternativeName);

			Set<String> finalNames = names;
			Consumer<String> bracketing = bName -> {
				if (isValidBracketing(bName)) {
					finalNames.add(bName.substring(1, bName.length() - 1).trim());
				}
				String bracket = "(" + bName + ")";
				if (isValidBracketing(bracket)) {
					finalNames.add(bracket);
				}
			};
			bracketing.accept(alternativeName);

			if (isValidQuoting(alternativeName)) {
				String unquoted = quoting.unquote(alternativeName);
				names.add(unquoted);
				if (!alternativeName.equals(unquoted)) {
					bracketing.accept(unquoted);
				}
			}
			String quoted = quoting.requote(alternativeName, true);
			if (isValidQuoting(quoted)) {
				names.add(quoted);
				if (!alternativeName.equals(quoted)) {
					bracketing.accept(quoted);
				}
			}
		}

		private void addAlternativeName(String name, String altQuantifier, String alternativeName,
				Quoting quoting) {
			String uqAltQuantifier = null;
			String qAltQuantifier = null;
			if (quoting.isQuoted(altQuantifier) && isValidQuoting(altQuantifier)) {
				uqAltQuantifier = quoting.unquote(altQuantifier);
			}
			String quoted = quoting.requote(altQuantifier, true);
			if (isValidQuoting(quoted)) {
				qAltQuantifier = quoted;
			}
			uqAltQuantifier = uqAltQuantifier == null? altQuantifier : uqAltQuantifier;
			qAltQuantifier = qAltQuantifier == null? altQuantifier : qAltQuantifier;

			String uqAlternativeName = null;
			String qAlternativeName = null;
			if (quoting.isQuoted(alternativeName) && isValidQuoting(alternativeName)) {
				uqAlternativeName = quoting.unquote(alternativeName);
			}
			quoted = quoting.requote(alternativeName, true);
			if (isValidQuoting(quoted)) {
				qAlternativeName = quoted;
			}
			uqAlternativeName = uqAlternativeName == null? alternativeName : uqAlternativeName;
			qAlternativeName = qAlternativeName == null? alternativeName : qAlternativeName;

			addAlternativeName(name, qAltQuantifier + "." + qAlternativeName, quoting);
			addAlternativeName(name, uqAltQuantifier + "." + uqAlternativeName, quoting);
			addAlternativeName(name, uqAltQuantifier + "." + qAlternativeName, quoting);
			addAlternativeName(name, qAltQuantifier + "." + uqAlternativeName, quoting);
		}

		private boolean isValidQuoting(String name) {
			if (name.length() < 3) {
				return false;
			}
			if (name.charAt(0) != name.charAt(name.length() - 1)) {
				return false;
			}
			String mid = name.substring(1, name.length() - 1);
			return mid.indexOf(name.charAt(0)) < 0 && mid.indexOf('.') < 0;
		}

		private boolean isValidBracketing(String name) {
			if (!(name.startsWith("(") && name.endsWith(")"))) {
				return false;
			}
			int level = 0;
			for (int i = 0; i < name.length(); ++i) {
				char c = name.charAt(i);
				if (c == '(') {
					++level;
				} else if (c == ')') {
					--level;
					if (level < 0) {
						return false;
					}
				}
			}
			return level == 0;
		}

		public void addAlias(String name, String alias) {
			Set<String> names = alternativeNames.get(name);
			if (names == null) {
				names = new HashSet<String>();
				alternativeNames.put(name, names);
			}
			names.add(alias);
			names.add(name);
			alternativeNames.put(alias, names);
		}

		@Override
		public String toString() {
			return "Result [table=" + table + ", Columns=" + table.getColumns() + ", hasCondition=" + hasCondition + ", isHaving=" + isHaving
					+ ", conditionStart=" + conditionStart + ", conditionEnd=" + conditionEnd + ", Cond=" + table.getName().substring(conditionStart, conditionEnd) + ", Length=" + table.getName().length()
					+ ", Cte=" + cte + "]";
		}
	}

	/**
	 * Parses a SQL query and tries to find out the type.
	 *
	 * @param sqlSelect the query
	 * @return the type or null
	 */
	public static Result getType(String sqlSelect, MetaDataSource metaDataSource, Quoting quoting) {
		Result result = new Result();
		result.originalQuery = sqlSelect;
		net.sf.jsqlparser.statement.Statement st;
		try {
			StringBuilder woComments = new StringBuilder(SqlUtil.removeComments(sqlSelect));
			String woCommentsAndLiterals = SqlUtil.removeCommentsAndLiterals(sqlSelect);
			String topLevelSql = SqlUtil.removeSubQueries(sqlSelect);
			StringBuilder cte = new StringBuilder();

			st = JSqlParserUtil.parse(woComments.toString(), 2);

			int[] unknownTableCounter = new int[1];
			final LinkedHashMap<String, MDTable> fromClause = analyseFromClause(st, unknownTableCounter, metaDataSource);
			final List<net.sf.jailer.datamodel.Column> selectClause = new ArrayList<net.sf.jailer.datamodel.Column>();

			st.accept(new StatementVisitorAdapter() {

				private void clearInStatement(Object o) {
					if (o != null) {
						Pair<Integer, Integer> pos = null;

						if (!(o instanceof LikeExpression) && (o instanceof ASTNodeAccess && ((ASTNodeAccess) o).getASTNode() != null)) {
							SimpleNode node = ((ASTNodeAccess) o).getASTNode();
							pos = new Pair<Integer, Integer>(node.jjtGetFirstToken().absoluteBegin - 1, node.jjtGetLastToken().absoluteEnd - 1);
						} else {
							String sql = o.toString();
							pos = findFragment(sql, woComments.toString());
							if (pos == null) {
								pos = findFragment(sql, woCommentsAndLiterals);
							}
							if (pos == null) {
								pos = findFragment(sql, topLevelSql);
							}
						}
						if (pos != null) {
							for (int i = pos.a; i < pos.b; ++i) {
								woComments.setCharAt(i, ' ');
							}
						}
					}
				}

				@Override
				public void visit(Select select) {
					select.getSelectBody().accept(new SelectVisitor() {

						@Override
						public void visit(WithItem withItem) {
						}

						@Override
						public void visit(SetOperationList setOpList) {
							throw new QueryTooComplexException();
						}

						@Override
						public void visit(PlainSelect plainSelect) {
							clearInStatement(plainSelect.getLimit());
							clearInStatement(plainSelect.getDistinct());
							clearInStatement(plainSelect.getTop());
							clearInStatement(plainSelect.getFetch());
							clearInStatement(plainSelect.getFirst());
							clearInStatement(plainSelect.getForUpdateTable());
							clearInStatement(plainSelect.getForXmlPath());
							clearInStatement(plainSelect.getIntoTables());
							clearInStatement(plainSelect.getOffset());
							clearInStatement(plainSelect.getKsqlWindow());
							clearInStatement(plainSelect.getMySqlHintStraightJoin());
							clearInStatement(plainSelect.getMySqlSqlCalcFoundRows());
							clearInStatement(plainSelect.getOptimizeFor());
							clearInStatement(plainSelect.getOracleHierarchical());
							clearInStatement(plainSelect.getOracleHint());
							clearInStatement(plainSelect.getSkip());
							clearInStatement(plainSelect.getWait());
							List<OrderByElement> orderByElements = plainSelect.getOrderByElements();
							if (orderByElements != null) {
								clearInStatement("order by " + orderByElements.stream().map(e -> e.toString()).collect(Collectors.joining(", ")));
							}

							Expression cond = null;
							if (plainSelect.getGroupBy() != null) {
								result.isHaving = true;
								cond = plainSelect.getHaving();
							} else {
								result.isHaving = false;
								cond = plainSelect.getWhere();
							}
							if (cond != null) {
								result.hasCondition = true;
								Pair<Integer, Integer> pos = null;
								if (!(cond instanceof LikeExpression) && (cond instanceof ASTNodeAccess && ((ASTNodeAccess) cond).getASTNode() != null)) { // lgtm [java/useless-type-test]
									SimpleNode node = ((ASTNodeAccess) cond).getASTNode();
									pos = new Pair<Integer, Integer>(node.jjtGetFirstToken().absoluteBegin - 1, node.jjtGetLastToken().absoluteEnd - 1);
								} else {
									String sql = cond.toString();
									pos = findFragment(sql, woComments.toString());
									if (pos == null) {
										pos = findFragment(sql, woCommentsAndLiterals);
									}
									if (pos == null) {
										pos = findFragment(sql, topLevelSql);
									}
									if (pos == null) {
										pos = findFragment((result.isHaving? "having " : "where ") + sql, topLevelSql);
										if (pos == null) {
											pos = findFragment((result.isHaving? "having " : "where ") + sql, woComments.toString());
										}
										if (pos != null) {
											Pattern p = Pattern.compile("^(" + (result.isHaving? "having" : "where") + "\\s+)", Pattern.CASE_INSENSITIVE);
											Matcher matcher = p.matcher(topLevelSql.substring(pos.a, pos.b));
											if (matcher.find()) {
												pos = new Pair<Integer, Integer>(pos.a + matcher.end(), pos.b);
											} else {
												pos = null;
											}
										}
									}
								}
								if (pos != null) {
									result.conditionStart = pos.a;
									result.conditionEnd = pos.b;
								} else {
									if (!warned) {
										LogUtil.warn(new RuntimeException("Cond. not found: " + cond + ":" + (woComments.toString().replaceAll("\\s+", " "))));
										warned = true;
									}
									throw new QueryTooComplexException();
								}
							} else {
								result.hasCondition = false;
							}

							int selectEnd = plainSelect.getSelectItems().get(plainSelect.getSelectItems().size() - 1).getASTNode().jjtGetLastToken().absoluteEnd - 1;
							int plainSelectStart = plainSelect.getASTNode().jjtGetFirstToken().absoluteBegin - 1;

							cte.append(woComments.toString().substring(0, plainSelectStart));
							for (int i = 0; i < selectEnd; ++i) {
								woComments.setCharAt(i, ' ');
							}
							woComments.setCharAt(selectEnd - 1, '\f');
							Pair<Integer, Integer> pos = findFragment("\f from", woComments.toString());
							if (pos != null) {
								for (int i = pos.a; i < pos.b; ++i) {
									woComments.setCharAt(i, ' ');
								}
							} else {
								throw new QueryTooComplexException();
							}

							for (SelectItem si: plainSelect.getSelectItems()) {
								si.accept(new SelectItemVisitor() {
									@Override
									public void visit(SelectExpressionItem selectExpressionItem) {
										try {
											int a = selectExpressionItem.getASTNode().jjtGetFirstToken().absoluteBegin - 1;
											int b = selectExpressionItem.getASTNode().jjtGetLastToken().absoluteEnd - 1;
											String sql = sqlSelect.substring(a, b);
											if (selectExpressionItem.getAlias() != null) {
												sql = sql.replaceAll("\\s*" + (selectExpressionItem.getAlias().isUseAs()? "(?i:as)\\s+" : "") + Pattern.quote(selectExpressionItem.getAlias().getName()) + "\\s*$", "");
											}
											boolean[] noSubexpression = new boolean[] { true };
											final Column column[] = new Column[1];

											selectExpressionItem.getExpression().accept(createExpressionVisitor(noSubexpression, column));

											boolean isNullable = true;
											if (column[0] != null) {
												String alias = null;
												if (column[0].getTable() != null) {
													if (column[0].getTable().getAlias() != null) {
														alias = column[0].getTable().getAlias().getName();
													} else {
														alias = column[0].getTable().getName();
													}
												}
												if (noSubexpression[0]) {
													net.sf.jailer.datamodel.Column col;
													try {
														col = findColumn(alias, column[0].getColumnName(), fromClause, metaDataSource);
														if (col != null) {
															isNullable = col.isNullable;
														}
													} catch (SQLException e) {
														// ignore
													}
													if (unknownTableCounter[0] == 0) {
														String uniqueColumnAlias = findUniqueAliasOfTableColumn(column[0].getColumnName(), fromClause);
														if (uniqueColumnAlias != null) {
															if (column[0].getTable() != null) {
																if (idEquals(column[0].getTable().getFullyQualifiedName(), uniqueColumnAlias, false)) {
																	result.addAlternativeName(sql, column[0].getColumnName(), quoting);
																}
															} else {
																result.addAlternativeName(sql, uniqueColumnAlias, column[0].getColumnName(), quoting);
															}
														}
													}
												}
											}
											net.sf.jailer.datamodel.Column col = new net.sf.jailer.datamodel.Column(sql, null, -1, -1);
											col.isNullable = isNullable;
											selectClause.add(col);
										} catch (Exception e) {
											LogUtil.warn(e);
											throw new QueryTooComplexException();
										}
									}

									@Override
									public void visit(AllTableColumns allTableColumns) {
										String tableName = allTableColumns.getTable().getName();
										String tableAlias = null;
										if (tableName != null) {
											tableAlias = findTable(tableName, fromClause);
										}
										if (tableAlias == null) {
											throw new QueryTooComplexException();
										}
										MDTable mdTable = fromClause.get(tableAlias);
										try {
											List<String> columns = mdTable.getColumns(false);
											if (columns.isEmpty()) {
												LogUtil.warn(new RuntimeException("Table without columns: " + mdTable.getName() + "/" + ((mdTable.getSchema() == null? "null" : mdTable.getSchema().getName())) + " " + sqlSelect));
											}
											for (String c: columns) {
												net.sf.jailer.datamodel.Column col = findColumn(tableAlias, c, fromClause, metaDataSource);
												boolean isNullable = col == null || col.isNullable;
												col = new net.sf.jailer.datamodel.Column((unknownTableCounter[0] != 0 || fromClause.size() != 1? tableAlias + "." : "") + c, null, -1, -1);
												col.isNullable = isNullable;
												selectClause.add(col);

												if (unknownTableCounter[0] == 0) {
													String uniqueColumnAlias = findUniqueAliasOfTableColumn(c, fromClause);
													if (uniqueColumnAlias != null) {
														if (idEquals(allTableColumns.getTable().getFullyQualifiedName(), uniqueColumnAlias, false)) {
															if (fromClause.size() != 1) {
																result.addAlternativeName(col.name, c, quoting);
															} else {
																result.addAlternativeName(col.name, tableAlias, c, quoting);
															}
														}
													}
												}
											}
										} catch (SQLException e) {
											logger.info("error", e);
											throw new QueryTooComplexException();
										}
									}

									@Override
									public void visit(AllColumns allColumns) {
										for (Entry<String, MDTable> e: fromClause.entrySet()) {
											MDTable mdTable = e.getValue();
											if (mdTable == null) {
												throw new QueryTooComplexException();
											}
											try {
												List<String> columns = mdTable.getColumns(false);
												if (columns.isEmpty()) {
													LogUtil.warn(new RuntimeException("Table without columns: " + mdTable.getName() + "/" + ((mdTable.getSchema() == null? "null" : mdTable.getSchema().getName())) + " " + sqlSelect));
												}
												for (String c: columns) {
													net.sf.jailer.datamodel.Column col = findColumn(e.getKey(), c, fromClause, metaDataSource);
													boolean isNullable = col == null || col.isNullable;
													col = new net.sf.jailer.datamodel.Column((unknownTableCounter[0] != 0 || fromClause.size() != 1? e.getKey() + "." : "") + c, null, -1, -1);
													col.isNullable = isNullable;
													selectClause.add(col);

													if (unknownTableCounter[0] == 0) {
														String uniqueColumnAlias = findUniqueAliasOfTableColumn(c, fromClause);
														if (uniqueColumnAlias != null) {
															if (idEquals(e.getKey(), uniqueColumnAlias, false)) {
																if (fromClause.size() != 1) {
																	result.addAlternativeName(col.name, c, quoting);
																} else {
																	result.addAlternativeName(col.name, e.getKey(), c, quoting);
																}
															}
														}
													}
												}
											} catch (SQLException e2) {
												logger.info("error", e2);
												throw new QueryTooComplexException();
											}
										}
									}
								});
							}
						}

						@Override
						public void visit(ValuesStatement aThis) {
							throw new QueryTooComplexException();
						}
					});
				}
			});

			for (int i1 = 0; i1 < selectClause.size(); ++i1) {
				for (int i2 = 0; i2 < selectClause.size(); ++i2) {
					net.sf.jailer.datamodel.Column c1 = selectClause.get(i1);
					net.sf.jailer.datamodel.Column c2 = selectClause.get(i2);
					if (c1 != null && c2 != null && c1 != c2 && c1.name != null && c2.name != null) {
						String total = c1.name.replaceAll("\\s+", "").toLowerCase();
						String suffix = c2.name.replaceAll("\\s+", "").toLowerCase();
						if (total.endsWith(suffix) && !total.isEmpty() && !suffix.isEmpty() && total.length() > suffix.length() && !c1.name.equals(c2.name) &&
								!(total.substring(total.length() - suffix.length() - 1, total.length() - suffix.length() + 1).matches("\\w\\w"))
								) {
							String name = "(" + c1.name + ")";
							result.addAlias(c1.name, name);
							net.sf.jailer.datamodel.Column newColumn = new net.sf.jailer.datamodel.Column(name, c1.type, c1.length, c1.precision);
							newColumn.isNullable = c1.isNullable;
							selectClause.set(i1, newColumn);
						}
					}
				}
			}

			PrimaryKey pk = new PrimaryKey(new ArrayList<net.sf.jailer.datamodel.Column>(), false);
			Table table = new Table(woComments.toString(), pk, false, false);
			table.setColumns(selectClause);
			result.table = table;
			result.cte = cte.toString();

			if (result.table.getColumns().isEmpty()) {
				return null;
			}

			selectClause.forEach(c -> result.addAlternativeName(c.name, c.name, quoting));

			return result;
		} catch (QueryTooComplexException e) {
			// ignore
		} catch (JSQLParserException e) {
			if (!warned) {
				LogUtil.warn(new RuntimeException(sqlSelect + ": " + e.getMessage()));
				warned = true;
			}
		} catch (StackOverflowError e) {
			LogUtil.warn(new StackOverflowError(WCTypeAnalyser.class.getName() + ": " + sqlSelect.length()));
		} catch (Throwable t) {
			LogUtil.warn(t);
		}
		return null;
	}

	protected static Pair<Integer, Integer> findFragment(String fragment, String sql) {
		Pair<Integer, Integer> pos = null;

		Pattern pattern = Pattern.compile(SqlUtil.createSQLFragmentSearchPattern(fragment, false), Pattern.CASE_INSENSITIVE);
		Matcher matcher = pattern.matcher(sql);

		if (matcher.find()) {
			pos = new Pair<Integer, Integer>(matcher.start(), matcher.end());
			if (matcher.find()) { // not unique
				pos = null;
			}
		}

		return pos;
	}

	private static LinkedHashMap<String, MDTable> analyseFromClause(Statement st, int[] unknownTableCounter, final MetaDataSource metaDataSource) {
		final LinkedHashMap<String, MDTable> result = new LinkedHashMap<String, MDTable>();

		unknownTableCounter[0] = 0;
		st.accept(new StatementVisitorAdapter() {
			@Override
			public void visit(Select select) {
				select.getSelectBody().accept(new SelectVisitor() {

					@Override
					public void visit(WithItem withItem) {
					}

					@Override
					public void visit(SetOperationList setOpList) {
					}

					@Override
					public void visit(PlainSelect plainSelect) {
						if (plainSelect.getFromItem() != null) {
							final FromItemVisitor fromItemVisitor = new FromItemVisitor() {
								private void unknownTable() {
									result.put("-unknown-" + (unknownTableCounter[0]++), null);
								}
								@Override
								public void visit(TableFunction tableFunction) {
									unknownTable();
								}

								@Override
								public void visit(ValuesList valuesList) {
									unknownTable();
								}

								@Override
								public void visit(LateralSubSelect lateralSubSelect) {
									unknownTable();
								}

								@Override
								public void visit(SubJoin subjoin) {
									subjoin.getLeft().accept(this);
									if (subjoin.getJoinList() != null) {
										for (Join join: subjoin.getJoinList()) {
											join.getRightItem().accept(this);
										}
									}
								}

								@Override
								public void visit(SubSelect subSelect) {
									unknownTable();
								}

								@Override
								public void visit(net.sf.jsqlparser.schema.Table tableName) {
									String schema = tableName.getSchemaName();
									String name = tableName.getName();
									if (tableName.getPivot() != null) {
										unknownTable();
									} else {
										MDSchema mdSchema = null;
										if (metaDataSource.isInitialized()) {
											if (schema == null) {
												mdSchema = metaDataSource.getDefaultSchema();
											} else {
												mdSchema = metaDataSource.find(schema);
											}
										}
										if (mdSchema != null) {
											MDTable mdTable;
											if (!mdSchema.isLoaded()) {
												mdSchema.loadTables(true, null, null, null);
												mdTable = null;
									    	} else {
									    		mdTable = mdSchema.find(name);
									    	}
											if (mdTable != null) {
												result.put(tableName.getAlias() != null? tableName.getAlias().getName() : mdTable.getName(), mdTable);
											} else {
												unknownTable();
											}
										}
									}
								}
								@Override
								public void visit(ParenthesisFromItem parenthesisFromItem) {
									if (parenthesisFromItem.getFromItem() != null) {
										parenthesisFromItem.getFromItem().accept(this);
									}
								}
							};
							plainSelect.getFromItem().accept(fromItemVisitor);
							if (plainSelect.getJoins() != null) {
								for (Join join: plainSelect.getJoins()) {
									join.getRightItem().accept(fromItemVisitor);
								}
							}
						}
					}

					@Override
					public void visit(ValuesStatement aThis) {

					}
				});
			}
		});

		return result;
	}

	private static net.sf.jailer.datamodel.Column findColumn(String alias, String columnName, LinkedHashMap<String, MDTable> fromClause, MetaDataSource metaDataSource) throws SQLException {
		for (boolean strict: new boolean[] { false, true }) {
			for (Entry<String, MDTable> e: fromClause.entrySet()) {
				if (alias == null || idEquals(e.getKey(), alias, strict)) {
					if (e.getValue() != null) {
						Table table = metaDataSource.toTable(e.getValue());
						if (table != null) {
							for (net.sf.jailer.datamodel.Column column: table.getColumns()) {
								if (column.name != null && idEquals(column.name, columnName, strict)) {
									return column;
								}
							}
						}
					}
				}
			}
		}
		return null;
	}

	private static String findUniqueAliasOfTableColumn(String columnName, LinkedHashMap<String, MDTable> fromClause) throws SQLException {
		String alias = null;
		for (Entry<String, MDTable> e: fromClause.entrySet()) {
			if (e.getValue() != null) {
				try {
					for (String column: e.getValue().getColumns(false)) {
						if (idEquals(column, columnName, false)) {
							if (alias != null) {
								return null;
							}
							alias = e.getKey();
							break;
						}
					}
				} catch (SQLException ex) {
					logger.info("error", ex);
					throw new QueryTooComplexException();
				}
			} else {
				return null;
			}
		}
		return alias;
	}

	private static String findTable(String tableName, LinkedHashMap<String, MDTable> fromClause) {
		for (boolean strict: new boolean[] { false, true }) {
			for (Entry<String, MDTable> e: fromClause.entrySet()) {
				if (idEquals(e.getKey(), tableName, strict)) {
					return e.getKey();
				}
			}
		}
		return null;
	}

	private static boolean idEquals(String a, String b, boolean strict) {
		if (a == null || b == null) {
			return false;
		}
		if (strict) {
			return a.equals(b);
		}
		return Quoting.normalizeIdentifier(a).equals(Quoting.normalizeIdentifier(b));
	}

	private static ExpressionVisitor createExpressionVisitor(final boolean[] noSubexpression, final Column[] column) {
		return new ExpressionVisitor() {

			@Override
			public void visit(Column tableColumn) {
				column[0] = tableColumn;
			}

			@Override
			public void visit(NotExpression aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(DateTimeLiteralExpression literal) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(TimeKeyExpression timeKeyExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(OracleHint hint) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(RowConstructor rowConstructor) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(MySQLGroupConcat groupConcat) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(KeepExpression aexpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(NumericBind bind) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(UserVariable var) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(RegExpMySQLOperator regExpMySQLOperator) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(JsonOperator jsonExpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(JsonExpression jsonExpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(RegExpMatchOperator rexpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(OracleHierarchicalExpression oexpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(IntervalExpression iexpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(ExtractExpression eexpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(AnalyticExpression aexpr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Modulo modulo) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(CastExpression cast) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(BitwiseXor bitwiseXor) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(BitwiseOr bitwiseOr) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(BitwiseAnd bitwiseAnd) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Matches matches) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Concat concat) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(AnyComparisonExpression anyComparisonExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(ExistsExpression existsExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(WhenClause whenClause) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(CaseExpression caseExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(SubSelect subSelect) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(NotEqualsTo notEqualsTo) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(MinorThanEquals minorThanEquals) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(MinorThan minorThan) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(LikeExpression likeExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(IsNullExpression isNullExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(InExpression inExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(GreaterThanEquals greaterThanEquals) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(GreaterThan greaterThan) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(EqualsTo equalsTo) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Between between) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(OrExpression orExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(AndExpression andExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Subtraction subtraction) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Multiplication multiplication) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Division division) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Addition addition) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(StringValue stringValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Parenthesis parenthesis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(TimestampValue timestampValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(TimeValue timeValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(DateValue dateValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(HexValue hexValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(LongValue longValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(DoubleValue doubleValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(JdbcNamedParameter jdbcNamedParameter) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(JdbcParameter jdbcParameter) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(SignedExpression signedExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(Function function) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(NullValue nullValue) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(BitwiseRightShift aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(BitwiseLeftShift aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(ValueListExpression valueList) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(IntegerDivision division) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(FullTextSearch fullTextSearch) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(IsBooleanExpression isBooleanExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(NextValExpression aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(CollateExpression aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(SimilarToExpression aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(ArrayExpression aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(XorExpression orExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(RowGetExpression rowGetExpression) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(ArrayConstructor aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(VariableAssignment aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(XMLSerializeExpr aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(TimezoneExpression aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(JsonAggregateFunction aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(JsonFunction aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(ConnectByRootOperator aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(OracleNamedFunctionParameter aThis) {
				noSubexpression[0] = false;
			}

			@Override
			public void visit(TryCastExpression arg0) {
			}

			@Override
			public void visit(AllColumns arg0) {
			}

			@Override
			public void visit(AllTableColumns arg0) {
			}

			@Override
			public void visit(AllValue arg0) {
			}

			@Override
			public void visit(IsDistinctExpression arg0) {
			}

			@Override
			public void visit(GeometryDistance arg0) {
			}
		};
	}

	private static class QueryTooComplexException extends RuntimeException {
	}

	private static class PExpressionVisitorAdapter implements ExpressionVisitor {

		final Pattern exprPattern;
		final Pattern valuePattern;
		final String sql;
		Pair<Integer, Integer> result;
		final StringBuilder left = new StringBuilder();

		public PExpressionVisitorAdapter(Pattern exprPattern, String sql) {
			this.exprPattern = exprPattern;
			this.sql = sql;
			valuePattern = Pattern.compile(WhereConditionEditorPanel.VALUE_REGEX, Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
		}

		@Override
		public void visit(NotExpression aThis) {
			check(aThis);
			visitAny(aThis);
		}

		@Override
		public void visit(NotEqualsTo notEqualsTo) {
			check(notEqualsTo);
			visitAny(notEqualsTo);
		}

		@Override
		public void visit(MinorThanEquals minorThanEquals) {
			check(minorThanEquals);
			visitAny(minorThanEquals);
		}

		@Override
		public void visit(MinorThan minorThan) {
			check(minorThan);
			visitAny(minorThan);
		}

		@Override
		public void visit(LikeExpression likeExpression) {
			check(likeExpression);
			visitAny(likeExpression);
		}

		@Override
		public void visit(IsNullExpression isNullExpression) {
			check(isNullExpression);
			check(isNullExpression.getLeftExpression());
			visitAny(isNullExpression);
		}

		@Override
		public void visit(GreaterThanEquals greaterThanEquals) {
			check(greaterThanEquals);
			visitAny(greaterThanEquals);
		}

		@Override
		public void visit(GreaterThan greaterThan) {
			check(greaterThan);
			visitAny(greaterThan);
		}

		@Override
		public void visit(EqualsTo equalsTo) {
			check(equalsTo);
			visitAny(equalsTo);
		}

		@Override
		public void visit(XorExpression orExpression) {
			check(orExpression);
			visitAny(orExpression);
		}

		@Override
		public void visit(OrExpression orExpression) {
			check(orExpression);
			visitAny(orExpression);
		}

		@Override
		public void visit(AndExpression andExpression) {
			check(andExpression);
			andExpression.getLeftExpression().accept(this);
			andExpression.getRightExpression().accept(this);
		}

		@Override
		public void visit(Parenthesis parenthesis) {
			check(parenthesis);
			parenthesis.getExpression().accept(this);
		}

		private void check(Object node) {
			if (result == null) {
				Matcher matcher = exprPattern.matcher(node.toString());
				if (matcher.matches()) {
					int cnt = 1;
					matcher = exprPattern.matcher(left);
					while (matcher.find()) {
						++cnt;
					}
					result = new Pair<Integer, Integer>(cnt, left.length());
				}
				if (node instanceof ComparisonOperator) {
					Expression rightExpression = ((ComparisonOperator) node).getRightExpression();
					if (rightExpression != null && !valuePattern.matcher(rightExpression.toString()).matches()) {
						invalidComparisons.add(node);
						result = null;
					} else {
						check(((ComparisonOperator) node).getLeftExpression());
					}
				} else if (node instanceof LikeExpression) {
					Expression rightExpression = ((LikeExpression) node).getRightExpression();
					if (rightExpression != null && !valuePattern.matcher(rightExpression.toString()).matches()) {
						invalidComparisons.add(node);
						result = null;
					} else {
						check(((LikeExpression) node).getLeftExpression());
					}
				}
			}
		}

		private Set<Object> invalidComparisons = new HashSet<Object>();

		private void visitAny(Object o) {
			if (invalidComparisons.contains(o)) {
				left.append("1=1");
			} else if (!(o instanceof LikeExpression) && (o instanceof ASTNodeAccess && ((ASTNodeAccess) o).getASTNode() != null)) {
				SimpleNode node = ((ASTNodeAccess) o).getASTNode();
				try {
					left.append(sql.substring(node.jjtGetFirstToken().absoluteBegin - 1, node.jjtGetLastToken().absoluteEnd - 1));
				} catch (Exception e) {
					left.append(o.toString());
				}
			} else {
				left.append(o.toString());
			}
			left.append(" ");
		}

		@Override
		public void visit(BitwiseRightShift aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(BitwiseLeftShift aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(NullValue nullValue) {
			visitAny(nullValue);
		}

		@Override
		public void visit(Function function) {
			visitAny(function);
		}

		@Override
		public void visit(SignedExpression signedExpression) {
			visitAny(signedExpression);
		}

		@Override
		public void visit(JdbcParameter jdbcParameter) {
			visitAny(jdbcParameter);
		}

		@Override
		public void visit(JdbcNamedParameter jdbcNamedParameter) {
			visitAny(jdbcNamedParameter);
		}

		@Override
		public void visit(DoubleValue doubleValue) {
			visitAny(doubleValue);
		}

		@Override
		public void visit(LongValue longValue) {
			visitAny(longValue);
		}

		@Override
		public void visit(HexValue hexValue) {
			visitAny(hexValue);
		}

		@Override
		public void visit(DateValue dateValue) {
			visitAny(dateValue);
		}

		@Override
		public void visit(TimeValue timeValue) {
			visitAny(timeValue);
		}

		@Override
		public void visit(TimestampValue timestampValue) {
			visitAny(timestampValue);
		}

		@Override
		public void visit(StringValue stringValue) {
			visitAny(stringValue);
		}

		@Override
		public void visit(Addition addition) {
			visitAny(addition);
		}

		@Override
		public void visit(Division division) {
			visitAny(division);
		}

		@Override
		public void visit(IntegerDivision division) {
			visitAny(division);
		}

		@Override
		public void visit(Multiplication multiplication) {
			visitAny(multiplication);
		}

		@Override
		public void visit(Subtraction subtraction) {
			visitAny(subtraction);
		}

		@Override
		public void visit(Between between) {
			visitAny(between);
		}

		@Override
		public void visit(InExpression inExpression) {
			visitAny(inExpression);
		}

		@Override
		public void visit(FullTextSearch fullTextSearch) {
			visitAny(fullTextSearch);
		}

		@Override
		public void visit(IsBooleanExpression isBooleanExpression) {
			visitAny(isBooleanExpression);
		}

		@Override
		public void visit(Column tableColumn) {
			visitAny(tableColumn);
		}

		@Override
		public void visit(SubSelect subSelect) {
			visitAny(subSelect);
		}

		@Override
		public void visit(CaseExpression caseExpression) {
			visitAny(caseExpression);
		}

		@Override
		public void visit(WhenClause whenClause) {
			visitAny(whenClause);
		}

		@Override
		public void visit(ExistsExpression existsExpression) {
			visitAny(existsExpression);
		}

		@Override
		public void visit(AnyComparisonExpression anyComparisonExpression) {
			visitAny(anyComparisonExpression);
		}

		@Override
		public void visit(Concat concat) {
			visitAny(concat);
		}

		@Override
		public void visit(Matches matches) {
			visitAny(matches);
		}

		@Override
		public void visit(BitwiseAnd bitwiseAnd) {
			visitAny(bitwiseAnd);
		}

		@Override
		public void visit(BitwiseOr bitwiseOr) {
			visitAny(bitwiseOr);
		}

		@Override
		public void visit(BitwiseXor bitwiseXor) {
			visitAny(bitwiseXor);
		}

		@Override
		public void visit(CastExpression cast) {
			visitAny(cast);
		}

		@Override
		public void visit(Modulo modulo) {
			visitAny(modulo);
		}

		@Override
		public void visit(AnalyticExpression aexpr) {
			visitAny(aexpr);
		}

		@Override
		public void visit(ExtractExpression eexpr) {
			visitAny(eexpr);
		}

		@Override
		public void visit(IntervalExpression iexpr) {
			visitAny(iexpr);
		}

		@Override
		public void visit(OracleHierarchicalExpression oexpr) {
			visitAny(oexpr);
		}

		@Override
		public void visit(RegExpMatchOperator rexpr) {
			visitAny(rexpr);
		}

		@Override
		public void visit(JsonExpression jsonExpr) {
			visitAny(jsonExpr);
		}

		@Override
		public void visit(JsonOperator jsonExpr) {
			visitAny(jsonExpr);
		}

		@Override
		public void visit(RegExpMySQLOperator regExpMySQLOperator) {
			visitAny(regExpMySQLOperator);
		}

		@Override
		public void visit(UserVariable var) {
			visitAny(var);
		}

		@Override
		public void visit(NumericBind bind) {
			visitAny(bind);
		}

		@Override
		public void visit(KeepExpression aexpr) {
			visitAny(aexpr);
		}

		@Override
		public void visit(MySQLGroupConcat groupConcat) {
			visitAny(groupConcat);
		}

		@Override
		public void visit(ValueListExpression valueList) {
			visitAny(valueList);
		}

		@Override
		public void visit(RowConstructor rowConstructor) {
			visitAny(rowConstructor);
		}

		@Override
		public void visit(RowGetExpression rowGetExpression) {
			visitAny(rowGetExpression);
		}

		@Override
		public void visit(OracleHint hint) {
			visitAny(hint);
		}

		@Override
		public void visit(TimeKeyExpression timeKeyExpression) {
			visitAny(timeKeyExpression);
		}

		@Override
		public void visit(DateTimeLiteralExpression literal) {
			visitAny(literal);
		}

		@Override
		public void visit(NextValExpression aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(CollateExpression aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(SimilarToExpression aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(ArrayExpression aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(ArrayConstructor aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(VariableAssignment aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(XMLSerializeExpr aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(TimezoneExpression aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(JsonAggregateFunction aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(JsonFunction aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(ConnectByRootOperator aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(OracleNamedFunctionParameter aThis) {
			visitAny(aThis);
		}

		@Override
		public void visit(TryCastExpression arg0) {
		}

		@Override
		public void visit(AllColumns arg0) {
		}

		@Override
		public void visit(AllTableColumns arg0) {
		}

		@Override
		public void visit(AllValue arg0) {
		}

		@Override
		public void visit(IsDistinctExpression arg0) {
		}

		@Override
		public void visit(GeometryDistance arg0) {
		}
	};

	public static Pair<Integer, Integer> getPositivePosition(String expr, Set<String> alternativeNames, String condition) {
		if (expr == null) {
			return null;
		}
		String pattern;
		if (alternativeNames == null) {
			pattern = SqlUtil.createSQLFragmentSearchPattern(expr, false);
		} else {
			pattern = "(?:" + alternativeNames.stream().map(aName -> "(?:" + SqlUtil.createSQLFragmentSearchPattern(aName, false) + ")").collect(Collectors.joining("|")) + ")";
		}
		Pattern pat = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE|Pattern.DOTALL);
		return getPositivePosition(pat, condition);
	}

	public static Pair<Integer, Integer> getPositivePosition(Pattern exprPattern, String condition) {
		if (condition.isEmpty()) {
			return null;
		}
		net.sf.jsqlparser.statement.Statement st;
		try {
			String sql = "Select * From T Where " + condition;
			st = JSqlParserUtil.parse(sql, 2);
			PExpressionVisitorAdapter pe = new PExpressionVisitorAdapter(exprPattern, sql);
			st.accept(new StatementVisitorAdapter() {
				@Override
				public void visit(Select select) {
					select.getSelectBody().accept(new SelectVisitorAdapter() {
						@Override
						public void visit(PlainSelect plainSelect) {
							plainSelect.getWhere().accept(pe);
						}
					});
				}
			});
			if (pe.result == null) {
				Matcher matcher = exprPattern.matcher(condition);
				if (matcher.find()) {
					pe.result = new Pair<Integer, Integer>(0, 0);
				}
			}
			return pe.result;
		} catch (/*JSQLParser*/ Exception e) {
			return null;
		}
	}

	public static boolean isPositiveExpression(String condition) {
		if (condition.isEmpty()) {
			return true;
		}
		net.sf.jsqlparser.statement.Statement st;
		try {
			st = JSqlParserUtil.parse("Select * From T Where " + condition, 2);
			List<Boolean> result = new ArrayList<>();
			st.accept(new StatementVisitorAdapter() {
				@Override
				public void visit(Select select) {
					select.getSelectBody().accept(new SelectVisitorAdapter() {
						@Override
						public void visit(PlainSelect plainSelect) {
							Expression wc = plainSelect.getWhere();
							result.add(!(
									wc instanceof OrExpression
									||
									wc instanceof XorExpression));
						}
					});
				}
			});
			if (!result.isEmpty()) {
				return result.get(0);
			}
			return false;
		} catch (/*JSQLParser*/ Exception e) {
			return false;
		}
	}

	private static boolean warned = false;

	public static void main(String args[]) {

		System.out.println(getPositivePosition("A.rzMandant", null, "A.ObjectId = 'dcc9802:1211af96d82:-7d45'\r\n"
				+ "				and A . rzMandant = 'ABIT'"));
		System.out.println(getPositivePosition("rzMandant", null, "A.ObjectId = 'dcc9802:1211af96d82:-7d45'\r\n"
				+ "				and A.rzMandant = 'ABIT'"));

		System.out.println(getPositivePosition("comm", null, "comm=1 or Empno=7902 and deptno=7902 and (comm is not null and boss is null)"));
		System.out.println(getPositivePosition("(x + 1)", null, "x+1=0"));
		System.out.println(getPositivePosition("x", null, "not x is not null and x=0"));
		System.out.println(getPositivePosition("x", null, "x=0"));
		System.out.println(getPositivePosition("x", null, "not x=0"));
		System.out.println(getPositivePosition("x", null, "x is null"));
		System.out.println(getPositivePosition("(x + 1)", null, "x+1=0 or y=0"));
		System.out.println(getPositivePosition("x", null, "y=0"));
		System.out.println(getPositivePosition("x", null, "(x=0) and (not 2 * x = 0)"));
		System.out.println(getPositivePosition("x", null, "(x=0) or (not 2 * x = 0)"));
	}

}


text:
package microsoft.exchange.webservices.data.core.enumeration.property;

/**
 * Defines a user's Out of Office Assistant status.
 */
public enum OofState {

  // The assistant is diabled.
  /**
   * The Disabled.
   */
  Disabled,

  // The assistant is enabled.
  /**
   * The Enabled.
   */
  Enabled,

  // The assistant is scheduled.
  /**
   * The Scheduled.
   */
  Scheduled
}


text:
#ifndef MICROPY_INCLUDED_STM32L4XX_HAL_CONF_BASE_H
#define MICROPY_INCLUDED_STM32L4XX_HAL_CONF_BASE_H

// Include various HAL modules for convenience
#include "stm32l4xx_hal_dma.h"
#include "stm32l4xx_hal_adc.h"
#include "stm32l4xx_hal_can.h"
#include "stm32l4xx_hal_cortex.h"
#include "stm32l4xx_hal_crc.h"
#include "stm32l4xx_hal_dac.h"
#include "stm32l4xx_hal_dcmi.h"
#include "stm32l4xx_hal_flash.h"
#include "stm32l4xx_hal_gpio.h"
#include "stm32l4xx_hal_hash.h"
#include "stm32l4xx_hal_hcd.h"
#include "stm32l4xx_hal_i2c.h"
#include "stm32l4xx_hal_iwdg.h"
#include "stm32l4xx_hal_pcd.h"
#include "stm32l4xx_hal_pwr.h"
#include "stm32l4xx_hal_rcc.h"
#include "stm32l4xx_hal_rtc.h"
#include "stm32l4xx_hal_sd.h"
#include "stm32l4xx_hal_spi.h"
#include "stm32l4xx_hal_tim.h"
#include "stm32l4xx_hal_uart.h"
#include "stm32l4xx_hal_usart.h"
#include "stm32l4xx_hal_wwdg.h"

// Enable various HAL modules
#define HAL_MODULE_ENABLED
#define HAL_ADC_MODULE_ENABLED
#define HAL_CAN_MODULE_ENABLED
#define HAL_CORTEX_MODULE_ENABLED
#define HAL_CRC_MODULE_ENABLED
#define HAL_DAC_MODULE_ENABLED
#define HAL_DCMI_MODULE_ENABLED
#define HAL_DMA_MODULE_ENABLED
#define HAL_FLASH_MODULE_ENABLED
#define HAL_GPIO_MODULE_ENABLED
#define HAL_HASH_MODULE_ENABLED
#define HAL_HCD_MODULE_ENABLED
#define HAL_I2C_MODULE_ENABLED
#define HAL_IWDG_MODULE_ENABLED
#define HAL_PCD_MODULE_ENABLED
#define HAL_PWR_MODULE_ENABLED
#define HAL_RCC_MODULE_ENABLED
#define HAL_RTC_MODULE_ENABLED
#define HAL_SD_MODULE_ENABLED
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIM_MODULE_ENABLED
#define HAL_UART_MODULE_ENABLED
#define HAL_USART_MODULE_ENABLED
#define HAL_WWDG_MODULE_ENABLED

// Oscillator values in Hz
#define HSI_VALUE   (16000000)
#define HSI48_VALUE (48000000)
#define LSI_VALUE   (32000)
#define MSI_VALUE   (4000000)

// SysTick has the highest priority
#define TICK_INT_PRIORITY (0x00)

// Miscellaneous HAL settings
#define DATA_CACHE_ENABLE           1
#define INSTRUCTION_CACHE_ENABLE    1
#define PREFETCH_ENABLE             1
#define USE_SPI_CRC                 0
#define USE_RTOS                    0

// HAL parameter assertions are disabled
#define assert_param(expr) ((void)0)

#endif // MICROPY_INCLUDED_STM32L4XX_HAL_CONF_BASE_H


text:
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <parent>
    <artifactId>kie-wb-common-forms-editor</artifactId>
    <groupId>org.kie.workbench.forms</groupId>
    <version>7.58.0-SNAPSHOT</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>

  <artifactId>kie-wb-common-forms-editor-backend</artifactId>
  <name>Kie Workbench - Common - Forms - Editor - Backend</name>
  <description>Kie Workbench - Common - Forms - Editor - Backend</description>

  <properties>
    <java.module.name>org.kie.wb.common.forms.editor.backend</java.module.name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.spec.javax.servlet</groupId>
      <artifactId>jboss-servlet-api_3.1_spec</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-bus</artifactId>
    </dependency>

    <dependency>
      <groupId>org.jboss.errai</groupId>
      <artifactId>errai-security-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-commons-editor-backend</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-backend-server</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-io</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-nio2-model</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-metadata-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-layout-editor-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-project-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-commons-editor-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-services-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie</groupId>
      <artifactId>kie-ci</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.services</groupId>
      <artifactId>kie-wb-common-services-backend</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.services</groupId>
      <artifactId>kie-wb-common-services-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.services</groupId>
      <artifactId>kie-wb-common-refactoring-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.services</groupId>
      <artifactId>kie-wb-common-refactoring-backend</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-forms-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-forms-fields</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-dynamic-forms-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-forms-editor-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-forms-backend-services</artifactId>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-forms-data-modeller-integration-api</artifactId>
    </dependency>

    <!-- tests -->
    <dependency>
      <groupId>org.jboss.weld.se</groupId>
      <artifactId>weld-se-core</artifactId>
      <scope>test</scope>
      <exclusions>
        <!-- collides with javax.inject:javax.inject:jar:1:compile -->
        <exclusion>
          <groupId>jakarta.enterprise</groupId>
          <artifactId>jakarta.enterprise.cdi-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.jboss.spec.javax.enterprise.concurrent</groupId>
      <artifactId>jboss-concurrency-api_1.0_spec</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-forms-fields</artifactId>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.forms</groupId>
      <artifactId>kie-wb-common-forms-adf-engine-backend</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.kie.workbench.services</groupId>
      <artifactId>kie-wb-common-refactoring-backend</artifactId>
      <classifier>tests</classifier>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-metadata-commons-io</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.uberfire</groupId>
      <artifactId>uberfire-nio2-fs</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <scope>test</scope>
    </dependency>

  </dependencies>

</project>


text:
<?php

namespace G4\DataMapper\Adapter\Elasticsearch;

use Elasticsearch\ClientBuilder;
use Elasticsearch\Client as ElasticsearchClient;
use Elasticsearch\Namespaces\IndicesNamespace;
use Elasticsearch\Transport;
use G4\DataMapper\Selection\Elasticsearch\Factory as SelectionFactory;
use G4\DataMapper\Bulk\Elasticsearch as Bulk;

class Client
{

    /**
     * @var ElasticsearchClient
     */
    private $client;

    /**
     * @var IndicesNamespace
     */
    private $clientIndices;

    /**
     * @var string
     */
    private $index;

    /**
     * @var array
     */
    private $hosts;

//     private $profiler;

    /**
     * @var string
     */
    private $type;

    /**
     * @param array $params
     */
    public function __construct(array $params)
    {
        $this->filterParams($params);
        $this->client        = ClientBuilder::create()->setHosts($this->hosts)->build();
        $this->clientIndices = $this->client->indices();
    }

    public function bulk(Bulk $bulk)
    {
        $result = [];
        try {
            $result = $this->client->bulk($bulk->getData());
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage(), $e->getCode());
        }
        return $result;
    }

    public function putMapping(SelectionFactory $selectionFactory)
    {
        if (!$this->clientIndices->exists($selectionFactory->prepareIndex())) {
            $this->clientIndices->create($selectionFactory->prepareIndex());
        }
        return $this->clientIndices->putMapping($selectionFactory->prepareForMapping());
    }

    public function deleteMapping(SelectionFactory $selectionFactory)
    {
        return $this->clientIndices->exists($selectionFactory->prepareIndex())
            && $this->clientIndices->existsType($selectionFactory->prepareType())
            ? $this->clientIndices->deleteMapping($selectionFactory->prepareType())
            : true;
    }

    public function index(SelectionFactory $selectionFactory)
    {
        $result = [];
        try {
            $result = $this->client->index($selectionFactory->prepareForIndexing());
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage(), $e->getCode());
        }
        return $result;
    }

    public function update(SelectionFactory $selectionFactory)
    {
        $result = [];
        try {
            $result = $this->client->update($selectionFactory->prepareForUpdate());
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage(), $e->getCode());
        }
        return $result;
    }

    public function updateAppend(SelectionFactory $selectionFactory)
    {
        $result = [];
        try {
            $result = $this->client->update($selectionFactory->prepareForUpdateAppend());
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage(), $e->getCode());
        }
        return $result;
    }

//     public function get($params)
//     {
//         return $this->client->get($params);
//     }

    //TODO: Drasko: This needs refactoring!!!
    public function search(SelectionFactory $selectionFactory)
    {
        $result = [];
        try {
            $result = $this->client->search($selectionFactory->query());
        } catch (\Exception $e) {
            throw new \Exception($e->getMessage(), $e->getCode());
        }
        return $result;
    }

    public function getIndex()
    {
        return $this->index;
    }

    public function getType()
    {
        return $this->type;
    }

//     public function delete()
//     {
//         return $this->client->delete();
//     }

//     public function create($params)
//     {
//         return $this->client->create($params);
//     }

    /**
     * @param array $params
     */
    private function filterParams(array $params)
    {
        $this->index = $params['index'];
        $this->type  = $params['type'];
        $this->hosts = $params['hosts'];
    }
}


text:
layout: page
title: "CHEM 5776: Scientific Ethics and Responsible Conduct in Research Statistics"
comments: true
description: "blanks"
keywords: "CHEM,5776,CU,Boulder"
---

#### GRADE AND WORKLOAD STATISTICS

**Percent withdrawn**: 0.0%

**Percent incomplete**: 0.0%

**Average grade** (4.0 scale): 3.99

**Standard deviation in grades** (4.0 scale): 0.02

**Average workload** (raw): 1.3

**Standard deviation in workload** (raw): 0.41

#### COURSE AND INSTRUCTOR RATINGS/INFORMATION

**Average course rating** (6 point scale): 4.1

**Standard deviation in course rating** (6 point scale): 0.37

**Average instructor rating** (6 point scale): 4.92

**Standard deviation in instructor rating** (6 point scale): 0.29

**Instructors**: Robert Batey, Robert Kuchta, Xuedong Liu, Amy Palmer, Arthur Pardi, Sabrina Leigh Spencer, Dylan Taatjes

#### GENERAL CLASS INFORMATION

**Years provided**: Fall 2006, Fall 2007, Fall 2008, Fall 2009, Fall 2010, Fall 2011, Fall 2012, Fall 2013, Fall 2014, Fall 2016

**Credits**: 1

**RAP/Honors class?** Neither

**Number of Sections**: 10

**Department**: CHEM

**College**: College of Arts and Sciences

**A&S Division**: Natural Sciences

**Level**: Masters

**Activity**: LEC - Lecture