diff --git a/.gitignore b/.gitignore index 7e7fdfe008a3ab2cd14584f45ca5dbbbb6ed1c6b..6947feff7090531647488aab4f4958baaf2a39d9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ /bin/ /out/ /.idea/ +/BDPost/ +/BDPosHttp/ # Ignore Gradle GUI config gradle-app.setting diff --git a/jar/PDFLibrary.jar b/jar/PDFLibrary.jar index babf3241c644f30ae5fff6c6667bd6fa95c517e9..01918a70adf76355a12dfde91901c880aaf54a9c 100644 Binary files a/jar/PDFLibrary.jar and b/jar/PDFLibrary.jar differ diff --git a/lib/BDPost.jar b/lib/BDPost.jar new file mode 100644 index 0000000000000000000000000000000000000000..c2b1dcadff3a6e7948cbcf547eb6c1b5bb532478 Binary files /dev/null and b/lib/BDPost.jar differ diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/CObject.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/CObject.java index 4d5a5c49752e96f40b165196851d8364059b99d5..ef7752e61cc6c316c29e39853a1105013895e5e2 100644 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/CObject.java +++ b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/CObject.java @@ -1,5 +1,5 @@ package fybug.nulll.pdfunctionlibrary.Processing; -import org.jetbrains.annotations.NotNull; +import com.sun.istack.internal.NotNull; /** *
暴露{@link Object} 的克隆方法
diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/FuckChar.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/FuckChar.java index 294b3cbfabdd009dd4f75e2312a02a32e3872734..af93dfec477268dc338d2cbed2c84b9adc4891f2 100644 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/FuckChar.java +++ b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/FuckChar.java @@ -1,6 +1,5 @@ package fybug.nulll.pdfunctionlibrary.Processing; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import com.sun.istack.internal.NotNull; import java.lang.ref.SoftReference; import java.util.HashMap; @@ -22,14 +21,14 @@ import static fybug.nulll.pdfunctionlibrary.Processing.sql.Sql.STR; *提供各种条件下的字符过滤
* * @author fybug - * @version 0.0.4 + * @version 0.0.6 * @since PDF 1.3 */ @SuppressWarnings( "all" ) public final class FuckChar { /**过滤表.
*/ - @NotNull private static SoftReference<@Nullable HashMap过滤 TabMap 关键字.
+ * + * @param s 要过滤的数据 + * + * @return 过滤后的数据 + * + * @since PDF 1.3 expander 2 + */ + @NotNull + public static + String fuckTabMap(@NotNull final CharSequence s) { + @NotNull String str = s.toString(); + @NotNull final HashMap恢复被过滤的 TabMap 关键字.
+ * + * @param s 要恢复的数据 + * + * @return 恢复后的数据 + * + * @since PDF 1.3 expander 2 + */ + @NotNull + public static + String refuckTabMap(@NotNull final CharSequence s) { + @NotNull String str = s.toString(); + @NotNull final HashMap用于对各种数据进行排序,排序方式为选择排序
* * @author fybug - * @version 0.0.5 + * @version 0.0.6 + * @see SortMode * @since PDF 1.2 */ @SuppressWarnings( "all" ) public final class SelectionSort { - /**文件排序模式:文件夹置顶.
*/ - public static final int MODE_DIR = 0; - /**文件排序模式:文件置顶.
*/ - public static final int MODE_FILE = 1; - /**文件排序模式:仅对比字符.
*/ - public static final int MODE_DEFAULT = 2; - /**排序模式:char较小的在上.
*/ - public static final int DOWN = 0; - /**排序模式:char较大的在上.
*/ - public static final int UP = 1; /** {@Hide} */ @Deprecated private SelectionSort() {} + /* + * Int + */ + /* + * Array + */ + + /** + *排序整数数组.
+ *+ * 会对数组中内容按指定的方式进行排序 + * 不会影响传入的数组 + *+ * + * @param is 要排序的整数数组 + * @param sort 排序方式 + * + * @return 必定不为空 + * + * @since PDF 1.3 expander 2 + */ + @NotNull + public static + int[] sortInt(@Nullable final int[] is, @NotNull final Mode sort) { + if (is == null || is.length == 0) + return new int[0]; + else if (is.length == 1) + return is.clone(); + + @NotNull int[] array = is.clone(); + int j, z, // 要交换的位置 + tmp; // 当前符合标准的变量 + + switch ( sort ) { + case DOWN: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] > tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + case UP: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] < tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + } + + return array; + } + + /* + * Long + */ + /* + * Array + */ + + /** + *
排序长整数数组.
+ *+ * 会对数组中内容按指定的方式进行排序 + * 不会影响传入的数组 + *+ * + * @param is 要排序的长整数数组 + * @param sort 排序方式 + * + * @return 必定不为空 + * + * @since PDF 1.3 expander 2 + */ + @NotNull + public static + long[] sortLong(@Nullable final long[] is, @NotNull final Mode sort) { + if (is == null || is.length == 0) + return new long[0]; + else if (is.length == 1) + return is.clone(); + + @NotNull long[] array = is.clone(); + int j, z; // 要交换的位置 + long tmp; // 当前符合标准的变量 + + switch ( sort ) { + case DOWN: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] > tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + case UP: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] < tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + } + + return array; + } + + /* + * Float + */ + /* + * Array + */ + + /** + *
排序单浮点数组.
+ *+ * 会对数组中内容按指定的方式进行排序 + * 不会影响传入的数组 + *+ * + * @param is 要排序的数组 + * @param sort 排序方式 + * + * @return 必定不为空 + * + * @since PDF 1.3 expander 2 + */ + @NotNull + public static + float[] sortFloat(@Nullable final float[] is, @NotNull final Mode sort) { + if (is == null || is.length == 0) + return new float[0]; + else if (is.length == 1) + return is.clone(); + + @NotNull float[] array = is.clone(); + int j, z; // 要交换的位置 + float tmp; // 当前符合标准的变量 + + switch ( sort ) { + case DOWN: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] > tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + case UP: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] < tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + } + + return array; + } + + /* + * Float + */ + /* + * Array + */ + + /** + *
排序双浮点数组.
+ *+ * 会对数组中内容按指定的方式进行排序 + * 不会影响传入的数组 + *+ * + * @param is 要排序的数组 + * @param sort 排序方式 + * + * @return 必定不为空 + * + * @since PDF 1.3 expander 2 + */ + @NotNull + public static + double[] sortDouble(@Nullable final double[] is, @NotNull final Mode sort) { + if (is == null || is.length == 0) + return new double[0]; + else if (is.length == 1) + return is.clone(); + + @NotNull double[] array = is.clone(); + int j, z; // 要交换的位置 + double tmp; // 当前符合标准的变量 + + switch ( sort ) { + case DOWN: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] > tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + case UP: + for ( int i = 0, length = array.length - 1; i < length; i++ ){ + tmp = array[i]; + z = i; + + for ( j = i + 1; j < array.length; j++ ){ + if (array[j] < tmp) { + z = j; + tmp = array[j]; + } + } + + // 交换 + tmp = array[i]; + array[i] = array[z]; + array[z] = tmp; + } + break; + } + + return array; + } + + /* + * String + */ + /* + * List + */ + /** *
对字符集合进行排序.
*排序不会影响传入的对象.
@@ -59,7 +355,7 @@ class SelectionSort { */ @NotNull public static -对文本数组进行排序.
*排序不会影响传入的对象.
@@ -173,7 +473,7 @@ class SelectionSort { */ @NotNull public static - String[] sortString(@Nullable final String[] a, @SortMode final int sort) { + String[] sortString(@Nullable final String[] a, @NotNull final Mode sort) { if (a == null || a.length == 0) return new String[0]; else if (a.length == 1) @@ -256,6 +556,79 @@ class SelectionSort { return arrayList; } + /* + * Help + */ + + /** + *解析排序规则.
+ * + * @param sort 排序规则 + * + * @return 错误规则返回 {@code null} + */ + @Nullable + private static + char[] getSortMode(@NotNull final Mode sort) { + @NotNull char[] cs = new char[]{0, 0}; + switch ( sort ) { + case DOWN: + cs[0] = 1; + break; + case UP: + cs[1] = 1; + break; + default: + /* 规则错误 */ + return null; + } + return cs; + } + + /** + *检查是否所有数据都相同.
+ *+ * 检查是否以检查到最大可检查的长度 + * 如果是,则根据排序方式 按照数据长度 进行额外排序 + *+ * + * @param sort 排序方式 + * @param index 当前标记位置 + * @param nowLeight 当前解析的长度 + * @param i1 第一个字符串的长度 + * @param i2 第二个字符串的长度 + * @param stringLenght 最大对比的长度 + * @param s 当前检查位置 + * + * @return 检查后应使用的位置 + */ + private static + int checkIndex(@NotNull final Mode sort, int index, final int nowLeight, final int i1, + final int i2, final int stringLenght, final int s) + { + // 检查是否已对比完成 + if (nowLeight == stringLenght) { + // 按照排序方式进行额外排序 + switch ( sort ) { + case UP: + if (i1 <= i2) + break; + case DOWN: + if (i2 <= i1) + break; + index = s; + } + } + return index; + } + + /* + * File + */ + /* + * Array + */ + /** *
对文件列表进行排序.
* @@ -273,14 +646,14 @@ class SelectionSort { * * @param f 即将进行排序的文件表 * @param mode 文件排序方式 - * @param sort 文本排序方式 + * @param sort 排序方式 * * @return 返回被排序好的文件列表 */ @NotNull public static - File[] sortFile(@Nullable final File[] f, @FileSortMode final int mode, - @SortMode final int sort) + File[] sortFile(@Nullable final File[] f, @NotNull final FileMode mode, + @NotNull final Mode sort) { if (f == null || f.length == 0) { return new File[0]; @@ -324,6 +697,10 @@ class SelectionSort { return file[0].toArray(new File[file[0].size()]); } + /* + * List + */ + /** *转化为数组后用{@link #sortFile(File[], int, int)}进行排序.
* @@ -338,8 +715,8 @@ class SelectionSort { */ @NotNull public static - List检查是否所有数据都相同.
- *- * 检查是否以检查到最大可检查的长度 - * 如果是,则根据排序方式 按照数据长度 进行额外排序 - *- * - * @param sort 排序方式 - * @param index 当前标记位置 - * @param nowLeight 当前解析的长度 - * @param i1 第一个字符串的长度 - * @param i2 第二个字符串的长度 - * @param stringLenght 最大对比的长度 - * @param s 当前检查位置 - * - * @return 检查后应使用的位置 - */ - private static - int checkIndex(@SortMode final int sort, int index, final int nowLeight, final int i1, - final int i2, final int stringLenght, final int s) - { - // 检查是否已对比完成 - if (nowLeight == stringLenght) { - // 按照排序方式进行额外排序 - switch ( sort ) { - case DOWN: - if (i1 <= i2) - break; - case UP: - if (i2 <= i1) - break; - index = s; - } - } - return index; - } - /** *
获取文件排序方式.
* @@ -458,7 +802,7 @@ class SelectionSort { */ @Nullable private static - LinkedList解析排序规则.
- * - * @param sort 排序规则 - * - * @return 错误规则返回 {@code null} - */ - @Nullable - private static - char[] getSortMode(@SortMode final int sort) { - @NotNull char[] cs = new char[]{0, 0}; - switch ( sort ) { - case UP: - cs[0] = 1; - break; - case DOWN: - cs[1] = 1; - break; - default: - /* 规则错误 */ - return null; - } - return cs; - } - - /**文件排序类型.
*/ - @Retention( SOURCE ) - @IntDef( value = {MODE_DIR, MODE_FILE, MODE_DEFAULT} ) - private - @interface FileSortMode {} - - /**排序类型.
*/ - @Retention( SOURCE ) - @IntDef( value = {DOWN, UP} ) - private - @interface SortMode {} -} +} \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Sort/SortMode.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Sort/SortMode.java new file mode 100644 index 0000000000000000000000000000000000000000..a97ca79460b40905add06e842af8a3c73889f46a --- /dev/null +++ b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Sort/SortMode.java @@ -0,0 +1,42 @@ +package fybug.nulll.pdfunctionlibrary.Processing.Sort; +/** + *文件排序模式:文件夹置顶.
*/ + MODE_DIR, + /**文件排序模式:文件置顶.
*/ + MODE_FILE, + /**文件排序模式:仅对比字符.
*/ + MODE_DEFAULT + } + + /** + *排序模式:较小的在上.
*/ + UP, + /**排序模式:较大的在上.
*/ + DOWN + } +} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Stop/Stop.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Stop/Stop.java index cfff1b420f44151a28892f097f11879edf7999c1..36f1a5b126a4f71fb924e0224e1fc0b8a7d3acbe 100644 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Stop/Stop.java +++ b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Stop/Stop.java @@ -1,5 +1,12 @@ package fybug.nulll.pdfunctionlibrary.Processing.Stop; + +import com.sun.istack.internal.NotNull; +import com.sun.istack.internal.Nullable; + import java.io.Serializable; + +import fybug.nulll.pdfunctionlibrary.Annotations.CanSynchronized; +import fybug.nulll.pdfunctionlibrary.Util.DataGrid; /** *中断.
*@@ -11,15 +18,43 @@ import java.io.Serializable; ** * @author fybug - * @version 0.0.5 + * @version 0.0.6 * @see MaybeStop * @see CallStop * @since PDF 1.1 */ +@SuppressWarnings( "all" ) +@CanSynchronized public class Stop extends Error implements Serializable { private static final long serialVersionUID = -5863099734169161181L; Stop() { super("The error should be caught, indicating that the result is the same regardless of whether it is running or not. The interrupt function runs."); } + + /** + *
运行可能会进行停止的操作.
+ *使用接口进行异常处理
+ * + * @param runnable 要运行的可能会中断的操作 + * @param fuck 中断处理 + * + * @return 如果没有发生异常将会返回 {@code null} ,如果发生了将会返回一个 {@link DataGrid} 里面 + * 放入处理接口返回的东西 + * + * @see StopFuck + * @since PDF 1.3 expander 2 + */ + @CanSynchronized + @Nullable + public static + DataGrid runMeberStop(@NotNull final Runnable runnable, @NotNull final StopFuck fuck) { + try { + runnable.run(); + } catch ( Stop e ) { + return DataGrid.getDataGrid(fuck.stop()); + } + + return null; + } } \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Stop/StopFuck.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Stop/StopFuck.java new file mode 100644 index 0000000000000000000000000000000000000000..8922ae56d0755da348a12b5affdebe87c2e039e0 --- /dev/null +++ b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/Stop/StopFuck.java @@ -0,0 +1,22 @@ +package fybug.nulll.pdfunctionlibrary.Processing.Stop; +import com.sun.istack.internal.NotNull; +/** + *返回处理后的消息
+ * + * @author fybug + * @version 0.0.1 + * @see Stop#runMeberStop(Runnable, StopFuck) + * @since PDF 1.3 expander 2 + */ +@SuppressWarnings( "all" ) +public +interface StopFuck { + /** + *处理中断异常.
+ * + * @return 处理后返回的对象 + */ + @NotNull + Object stop(); +} \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/Comparison.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/Comparison.java deleted file mode 100644 index 980e9ab86bb53f73bf4f05290a1c1303711fa866..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/Comparison.java +++ /dev/null @@ -1,68 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.Enum; -import com.sun.istack.internal.NotNull; - -import org.jetbrains.annotations.Nullable; -/** - *等于.
*/ - EQULE(" = "), - /**大于.
*/ - MORE(" > "), - /**小于.
*/ - LESS(" < "), - /**大于等于.
*/ - MORE_AND(" >= "), - /**小于等于.
*/ - LESS_AND(" <= "), - /**不等于.
*/ - NO(" <> "), - /**严格检查.
*/ - STRICT(" <=> "); - @NotNull final private String s; - - Comparison(@NotNull final CharSequence s) {this.s = s.toString();} - - @Override - public - String toString() { return s; } - - /** - *转化字符串为条件枚举.
- * - * @param ss 要转化的字符串 - * - * @return 转化成的枚举 - */ - @Nullable - public final static - Comparison getMde(@NotNull final CharSequence ss) { - @NotNull final String s = String.valueOf(ss).trim(); - switch ( s ) { - case "=": - return EQULE; - case ">": - return MORE; - case "<": - return LESS; - case ">=": - return MORE_AND; - case "<=": - return LESS_AND; - case "<>": - case "!=": - return NO; - case "<=>": - return STRICT; - default: - return null; - } - } -} \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/InserMode.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/InserMode.java deleted file mode 100644 index 01c4af536b0c295dbd4aee2ef9adf915441f8461..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/InserMode.java +++ /dev/null @@ -1,31 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.Enum; -/** - *指定了当前数据的插入方式和内容
- * 所有键都需要包装和过滤 - * - * @author fybug - * @version 0.0.1 - * @since PDF 1.3 - */ -@SuppressWarnings( "all" ) -public -enum InserMode { - /** - *插入 Null 值.
- * 后面不需要值 - */ - NULL, - /**插入一个值.
*/ - VAL, - /** - *插入一个值.
- * 不提供包装 - */ - OUT, - /** - *使用赋值 sql 语句.
- * 不过滤 - */ - SQL; -} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/Logical.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/Logical.java deleted file mode 100644 index 9b10893787b15360606fb55b36c325884cc16a42..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/Logical.java +++ /dev/null @@ -1,51 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.Enum; -import com.sun.istack.internal.NotNull; - -import org.jetbrains.annotations.Nullable; -/** - *并且.
*/ - AND(" AND "), - /**或者.
*/ - OR(" OR "), - /**异或.
*/ - XOR(" XOR "); - @NotNull final private String s; - - Logical(@NotNull final CharSequence s) { this.s = s.toString(); } - - @Override - @NotNull - public - String toString() { return s; } - - /** - *转化字符串为条件关系枚举.
- * - * @param ss 要转化的字符串 - * - * @return default:{@link #AND} - */ - @Nullable - public static - Logical get(@Nullable final CharSequence ss) { - switch ( String.valueOf(ss).trim().toUpperCase() ) { - case "AND": - return AND; - case "OR": - return OR; - case "XOR": - return XOR; - default: - return AND; - } - } -} \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/UpdataMode.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/UpdataMode.java deleted file mode 100644 index 4cb06c300f441dc424a494005f37a314a3a9b384..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/UpdataMode.java +++ /dev/null @@ -1,73 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.Enum; -import org.jetbrains.annotations.NotNull; -/** - *指定了当前数据的更新方式和内容
- * 所有键都需要包装和过滤 - * - * @author fybug - * @version 0.0.2 - * @since PDF 1.3 - */ -@SuppressWarnings( "all" ) -public -enum UpdataMode { - /** - *更新为 Null 值.
- * 后面不需要值 - */ - NULL, - /**更新为一个值.
*/ - VAL, - /** - *插入一个值.
- * 不提供包装 - */ - OUT, - /** - *使用赋值 sql 语句.
- * 不过滤 - */ - SQL, - /** - *更新为自增.
- * 参数为自增的值 - */ - UP("+"), - /** - *更新为自减.
- * 参数为自减的值 - */ - DOWN("-"), - /** - *更新为自乘.
- * 参数为自乘的值 - */ - MUL("*"), - /** - *更新为自除.
- * 参数为自除的值 - */ - EXCE("/"), - /** - *更新为自取商.
- */ - DIV(" DIV "), - /**更新为自取模.
*/ - MOD(" MOD "), - /**按位取或.
*/ - BITOR("|"), - /**按位取于.
*/ - BITAND("&"), - /**按位异或.
*/ - BITXOR("^"), - /**位左移.
*/ - BITLEFT("<<"), - /**位右移.
*/ - BITRIGHT(">>"); - @NotNull public final String s; - - UpdataMode() { this(""); } - - UpdataMode(@NotNull final String s) { this.s = s; } -} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/package-info.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/package-info.java deleted file mode 100644 index dc52388c75386ea5ef51910a4493397507e6546c..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Enum/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - *用来代表 SQL 的相关状态标识
- * - * @author fybug - * @version 0.0.2 - * @since PDF 1.2 - */ -package fybug.nulll.pdfunctionlibrary.Processing.sql.Enum; \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Mysql.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Mysql.java deleted file mode 100644 index 11b6420426be5a8dda721dff88d51a22f34e2eb7..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Mysql.java +++ /dev/null @@ -1,195 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql; -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; - -import java.sql.ResultSet; -import java.sql.SQLException; - -import fybug.nulll.bdpost.Instruct; -import fybug.nulll.pdfunctionlibrary.Annotations.CanSynchronized; -import fybug.nulll.pdfunctionlibrary.Processing.CObject; -import fybug.nulll.pdfunctionlibrary.Processing.sql.mysql.MysqlSql; -import fybug.nulll.pdfunctionlibrary.Processing.sql.mysql.Updata; -/** - *
- * 使用该工具类进行 Sql 操作
- * 该工具会进行字段过滤和包装出 sql
- * 需使用 {@link #getDatabase(String, int, String, String, String)} 构造
- *
- *
- * @author fybug
- * @version 0.0.4
- * @see Sql
- * @since PDF 1.3
- */
-@SuppressWarnings( "all" )
-@CanSynchronized
-public
-class Mysql extends Sql {
- // mysql 连接名
- @NotNull private static final String URL = "jdbc:mysql://";
- // JDBC 驱动名
- @NotNull private static final String JDBC_DRIVER = "com.mysql.cj.jdbc.Driver";
-
- public
- Mysql(@NotNull final Sql.database da) throws SQLException {
- super(da);
- }
-
- /**
- * 输入要连接的数据库信息.
- *- * 需设置数据库所在地址和端口及数据库名 - * 还有用户名和密码 - *- * - * @param ip 数据库所在地址 - * @param port 端口 - * @param database 数据库名称 - * @param user 用户名 - * @param pass 密码 - * - * @return 获取赋值数据后的数据库对象 - */ - public static - Mysql getDatabase(@NotNull final String ip, final int port, @NotNull final String database, - @NotNull final String user, @NotNull final String pass) throws SQLException - { - try { - //加载驱动程序 - Class.forName(JDBC_DRIVER); - } catch ( Exception e ) { - //数据库驱动类异常处理 - throw new SQLException("Sorry,can`t find the Driver!"); - } - return new Mysql( - new Sql.database(URL + ip + ":" + Integer.toString(port) + "/" + database, user, - pass)); - } - - /** - *
输入要连接的数据库信息.
- *- * 需设置数据库所在地址和端口及数据库名 - * 还有用户名和密码 - *- * - * @param instruct 数据库信息指令
# ip 数据库所在地址
- * # port 端口
- * # base 数据库名称
- * # user 用户名
- * # pass 密码
执行 Mysql 语句.
- *- * 通过语句对象对查询方式进行包装 - * 并保证安全和完整性 - *- * - * @param sql 要执行的语句对象 - * - * @return 是否发生异常 - * - * @see MysqlSql - */ - @Nullable - public - boolean exe(@NotNull final MysqlSql sql) { - @NotNull final CObject lock = new CObject(); - try { - // 获取插入语句 - exe(lock, sql.toString()); - return true; - } catch ( Exception e ) { - e.printStackTrace(); - return false; - } finally { - close(lock); - } - } - - /** - *
更新数据库内容.
- *- * 通过传入的字段映射和查询条件对数据库中的数据进行更新 - *- * - * @param updata 更新语句对象 - * - * @return 影响的行数 - * - * @see Updata - */ - public - int updata(@NotNull final Updata updata) - { - @NotNull final CObject lock = new CObject(); - try { - return updata(lock, updata.toString()); - } catch ( Exception e ) { - e.printStackTrace(); - throw new RuntimeException(e); - } finally { - close(lock); - } - } - - // 查 - - /** - *
查询数据库数据.
- *- * 查询功能使用直接 sql 进行 - *- * - * @param sql 查询的 sql - * - * @return 查询的结果, 如果为 {@code Null} 则查询失败 - */ - @Nullable - public - ResultSet qurey(@NotNull final String sql) - { - @Nullable ResultSet set; - @NotNull final CObject lock = new CObject(); - - try { - // 获取查询数据 - set = get(lock, sql); - } catch ( Exception r ) { - throw new RuntimeException(r); - } finally { - } - - return set; - } -} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Sql.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Sql.java deleted file mode 100644 index df9662fecc23d079753ffb691f08b9d2554fd120..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Sql.java +++ /dev/null @@ -1,245 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.Serializable; -import java.sql.Connection; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.HashMap; - -import fybug.nulll.pdfunctionlibrary.Annotations.CanSynchronized; -import fybug.nulll.pdfunctionlibrary.Processing.CObject; -/** - *
- * 用于执行查询语句 - * 不进行任何处理 - *- * - * @author fybug - * @version 0.0.3 - * @see database - * @since PDF 1.2 - */ -@SuppressWarnings( "All" ) -@CanSynchronized -public -class Sql implements AutoCloseable { - @NotNull protected Sql.database database; - @NotNull private HashMap
使用语句查询数据.
- * - * @param cObject 事务标识 - * @param sql 查询语句 - * - * @return 返回的查询集合,如果执行失败则会返回{@code null} - */ - @Nullable - public - ResultSet get(@Nullable final CObject cObject, @NotNull final CharSequence sql) - throws SQLException - { - @Nullable ResultSet rs = null; - @NotNull Connection c = null; - @NotNull Statement s; - - if (!con.containsKey(cObject)) { - // getConnection()方法,连接数据库 - con.put(cObject, - DriverManager.getConnection(database.DB_URL, database.USER, database.PASS)); - } - c = con.get(cObject); - - if (!statement.containsKey(cObject)) { - statement.put(cObject, c.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, - ResultSet.CONCUR_READ_ONLY, - ResultSet.HOLD_CURSORS_OVER_COMMIT)); - } - s = statement.get(cObject); - - //ResultSet类,用来存放获取的结果集!! - rs = s.executeQuery(sql.toString()); - return rs; - } - - /** - *执行更新语句.
- * - * @param cObject 事务标识 - * @param sql 要执行的更新语句 - * - * @return 受影响的行数 - */ - public - int updata(@Nullable final CObject cObject, @NotNull final CharSequence sql) throws SQLException - { - @Nullable ResultSet rs = null; - @NotNull Connection c = null; - @NotNull Statement s; - - if (!con.containsKey(cObject)) { - // getConnection()方法,连接数据库 - con.put(cObject, - DriverManager.getConnection(database.DB_URL, database.USER, database.PASS)); - } - c = con.get(cObject); - - if (!statement.containsKey(cObject)) { - statement.put(cObject, - c.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, - ResultSet.HOLD_CURSORS_OVER_COMMIT)); - } - s = statement.get(cObject); - - return s.executeUpdate(sql.toString()); - } - - /** - *执行语句.
- * - * @param cObject 事务标识 - * @param sql 查询语句 - * - * @return 执行是否成功 - */ - public - boolean exe(@Nullable final CObject cObject, @NotNull final CharSequence sql) - throws SQLException - { - @Nullable ResultSet rs = null; - @NotNull Connection c = null; - @NotNull Statement s; - - if (!con.containsKey(cObject)) { - // getConnection()方法,连接数据库 - con.put(cObject, - DriverManager.getConnection(database.DB_URL, database.USER, database.PASS)); - } - c = con.get(cObject); - - if (!statement.containsKey(cObject)) { - statement.put(cObject, - c.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, - ResultSet.HOLD_CURSORS_OVER_COMMIT)); - } - s = statement.get(cObject); - - try { - s.execute(sql.toString()); - } catch ( SQLException e ) { - e.printStackTrace(); - return false; - } - return true; - } - - /** - *关闭对应的连接.
- * - * @param cObject 连接标识 - * - * @since PDF 1.3 - */ - public - void close(@Nullable final CObject cObject) { - @Nullable final Connection c = con.remove(cObject); - if (c != null) - try { - c.commit(); - c.close(); - } catch ( Throwable e ) { - } - - @Nullable final Statement s = statement.remove(cObject); - if (s != null) - try { - s.close(); - } catch ( Throwable e ) { - } - } - - /** - *关闭所有连接.
- * 并释放事务映射表 - */ - @Override - public - void close() throws SQLException { - synchronized ( this ){ - for ( Connection c : con.values() ){ - try { - c.commit(); - c.close(); - } catch ( Throwable e ) { - } - } - con.clear(); - con = null; - - for ( Statement s : statement.values() ){ - try { - s.close(); - } catch ( Throwable e ) { - } - } - statement.clear(); - statement = null; - } - database = null; - } - - /** - *- * 用于存放数据库相关信息 - *- * - * @author fybug - * @version 0.0.1 - * @since PDF 1.2 - */ - public static - class database implements Serializable { - // 数据库 URL - @NotNull final String DB_URL, // 数据库的用户名与密码,需要根据自己的设置 - USER, PASS; - - public - database(String db, String user, String pass) { - DB_URL = db; - USER = user; - PASS = pass; - } - } - - /* 过滤字段 */ - public final static String ENDMARK = ";", ANDPR = "&", GREATER = "<", LESS = ">", STR = "'", - NAME = "`", ANNOTATION = "--", ROD = "/", PERCENTAGE = "%"; -} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Util/InsertVal.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Util/InsertVal.java deleted file mode 100644 index 33975c9cb2019531af63ea6ed11aeda229256939..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Util/InsertVal.java +++ /dev/null @@ -1,275 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.Util; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.lang.ref.SoftReference; - -import fybug.nulll.bdpost.PostField; -import fybug.nulll.pdfunctionlibrary.Annotations.NoSynchronized; -import fybug.nulll.pdfunctionlibrary.Processing.sql.Enum.InserMode; -import fybug.nulll.pdfunctionlibrary.Util.DataMap; -import fybug.nulll.pdfunctionlibrary.Util.Map.ArrayMap; - -import static fybug.nulll.pdfunctionlibrary.Processing.FuckChar.fuckSql; -/** - *
用于保存插入的参数和类型,并生成 {@code (??, ??) VALUE (??, ??)} 语句
- * - * @author fybug - * @version 0.0.2 - * @see InserMode - * @since PDF 1.3 - */ -@NoSynchronized -@SuppressWarnings( "All" ) -public -class InsertVal extends ArrayMap插入空类型的指向缓存.
*/ - @NotNull private static SoftReference获取空类型指向的缓存.
- * 使用软引用 - * - * @return {@link InserMode#NULL} - */ - @NotNull - protected - DataMap加入空插入.
- * - * @param name 要插入的属性名 - * - * @return this - * - * @see InserMode#NULL - */ - @NotNull - public - InsertVal addNull(@NotNull final String name) { - add(fuckSql(name).trim(), getNullCache()); - return this; - } - - /** - *加入值插入.
- * - * @param name 要插入的属性名 - * @param val 要插入的属性,为空则转化为空插入 - * - * @return this - * - * @see InserMode#VAL - */ - @NotNull - public - InsertVal addVal(@NotNull final String name, @Nullable final String val) { - add(fuckSql(name).trim(), - val == null ? getNullCache() : DataMap.getDataMap(InserMode.VAL, fuckSql(val).trim())); - return this; - } - - /** - *加入值插入.
- * 插入非字符串的值,不提供包装 - * - * @param name 要插入的属性名 - * @param val 要插入的属性,为空则转化为空插入 - * - * @return this - * - * @see InserMode#OUT - */ - @NotNull - public - InsertVal addOut(@NotNull final String name, @Nullable final Object val) { - add(fuckSql(name).trim(), - val == null ? getNullCache() : DataMap.getDataMap(InserMode.OUT, val)); - return this; - } - - /** - *加入 sql 插入.
- * - * @param name 要插入的属性名 - * @param sql 要插入的 sql 语句,为空则转化为空插入 - * - * @return this - * - * @see InserMode#SQL - */ - @NotNull - public - InsertVal addSql(@NotNull final String name, @Nullable final String sql) { - add(fuckSql(name).trim(), - sql == null ? getNullCache() : DataMap.getDataMap(InserMode.SQL, sql)); - return this; - } - - // 检查数据并加入 - private - void checkData(@NotNull final StringBuilder key, @NotNull final StringBuilder val, - @NotNull final DataMap转化为插入属性的语句.
- * - * @return {@code (??) VALUE (??)} - */ - @NotNull - @Override - public - String toString() { - @NotNull final StringBuilder inst = new StringBuilder("("), val = new StringBuilder( - ") VALUE ("); - - /* tmp */ - @Nullable DataMap解析 BDPos 格式的数据.
- * - * @param post {@link InserMode}&field转化为 BDPos 属性对象.
- * - * @return {@link PostField} - * - * @since PDF 1.3 expander 1 - */ - public - PostField toBDPos() { - PostField postField = new PostField(); - postField.name = "Inserval"; - StringBuilder stringBuilder = new StringBuilder(); - final int nowmark = mark; // 记录当前标记 - mark = 0; - DataMap用于保存更新的参数和类型,并生成 {@code ??=??, ??=??} 语句
- * - * @author fybug - * @version 0.0.2 - * @see UpdataMode - * @since PDF 1.3 - */ -@NoSynchronized -@SuppressWarnings( "All" ) -public -class UpDataVal extends ArrayMap插入空类型的指向缓存.
*/ - @NotNull private transient static SoftReference获取空类型指向的缓存.
- * 使用软引用 - * - * @return {@link UpdataMode#NULL} - */ - @NotNull - protected - DataMap检查字段类型,并进行过滤.
- * - * @param o 要检查的字段 - * - * @return 检查并进行相应处理的字段 - */ - @NotNull - private - String checkFidle(@Nullable final Object o) { - if (o instanceof String) - return '\'' + fuckSql(o.toString()).trim() + '\''; - - return fuckSql(String.valueOf(o)).trim(); - } - - /** - *更新为空值.
- * - * @param name 要更新的属性名 - * - * @return this - * - * @see UpdataMode#NULL - */ - @NotNull - public - UpDataVal addNull(@NotNull final String name) { - add(fuckSql(name).trim(), getNullCache()); - return this; - } - - /** - *加入值更新.
- * - * @param name 要更新的属性名 - * @param val 要更新的属性,为空则转化为空更新 - * - * @return this - * - * @see UpdataMode#VAL - */ - @NotNull - public - UpDataVal addVal(@NotNull final String name, @Nullable final String val) { - add(fuckSql(name).trim(), - val == null ? getNullCache() : DataMap.getDataMap(UpdataMode.VAL, fuckSql(val).trim())); - return this; - } - - /** - *加入值更新.
- * 插入非字符串的值,不提供包装 - * - * @param name 要更新的属性名 - * @param val 要更新的属性,为空则转化为空更新 - * - * @return this - * - * @see UpdataMode#OUT - */ - @NotNull - public - UpDataVal addOut(@NotNull final String name, @Nullable final Object val) { - add(fuckSql(name).trim(), - val == null ? getNullCache() : DataMap.getDataMap(UpdataMode.OUT, val)); - return this; - } - - /** - * /** - *加入 sql 更新.
- * - * @param name 要更新的属性名 - * @param sql 要更新的 sql 语句,为空则转化为空更新 - * - * @return this - * - * @see UpdataMode#SQL - */ - @NotNull - public - UpDataVal addSql(@NotNull final String name, @Nullable final String sql) { - add(fuckSql(name).trim(), - sql == null ? getNullCache() : DataMap.getDataMap(UpdataMode.SQL, sql)); - return this; - } - - /** - *加入自增.
- * - * @param name 要更新的属性名 - * @param val 自增的量 - * - * @return this - * - * @see UpdataMode#UP - */ - @NotNull - public - UpDataVal addUp(@NotNull final String name, final Object val) { - add(fuckSql(name).trim(), DataMap.getDataMap(UpdataMode.UP, val)); - return this; - } - - /** - *加入自减.
- * - * @param name 要更新的属性名 - * @param val 自减的量 - * - * @return this - * - * @see UpdataMode#DOWN - */ - @NotNull - public - UpDataVal addDown(@NotNull final String name, final Object val) { - add(fuckSql(name).trim(), DataMap.getDataMap(UpdataMode.DOWN, val)); - return this; - } - - /** - *加入自除.
- * - * @param name 要更新的属性名 - * @param val 自除的量 - * - * @return this - * - * @see UpdataMode#EXCE - */ - @NotNull - public - UpDataVal addExce(@NotNull final String name, final Object val) { - add(fuckSql(name).trim(), DataMap.getDataMap(UpdataMode.EXCE, val)); - return this; - } - - /** - *加入取值.
- * - * @param name 要更新的属性名 - * @param val 对应的属性 - * @param div 求商还是求模 - * - * @return this - * - * @see UpdataMode#DIV - * @see UpdataMode#MOD - */ - @NotNull - public - UpDataVal addExce(@NotNull final String name, final Object val, final boolean div) { - add(fuckSql(name).trim(), DataMap.getDataMap(div ? UpdataMode.DIV : UpdataMode.MOD, val)); - return this; - } - - /** - *加入自乘.
- * - * @param name 要更新的属性名 - * @param val 自乘的量 - * - * @return this - * - * @see UpdataMode#MUL - */ - @NotNull - public - UpDataVal addMul(@NotNull final String name, final Object val) { - add(fuckSql(name).trim(), DataMap.getDataMap(UpdataMode.MUL, val)); - return this; - } - - /** - *加入位运算.
- * - * @param name 要更新的属性名 - * @param bit 运算方式 - * @param val 量 - * - * @return this - * - * @see UpdataMode - */ - @NotNull - public - UpDataVal addBit(@NotNull final String name, @NotNull final UpdataMode bit, final Object val) { - add(fuckSql(name).trim(), DataMap.getDataMap(bit, val)); - return this; - } - - // 检查数据并加入 - private - void checkData(@NotNull final StringBuilder key, - @NotNull final DataMap转化为更新属性的语句.
- * - * @return {@code ??=??, ??=??} - */ - @NotNull - @Override - public - String toString() { - @NotNull final StringBuilder inst = new StringBuilder(); - - /* tmp */ - @Nullable DataMap解析 BDPos 格式的数据.
- * - * @param post {@link UpdataMode}&field转化为 BDPos 属性对象.
- * - * @return {@link PostField} - * - * @since PDF 1.3 expander 1 - */ - public - PostField toBDPos() { - PostField postField = new PostField(); - postField.name = "Updateval"; - StringBuilder stringBuilder = new StringBuilder(); - final int nowmark = mark; // 记录当前标记 - mark = 0; - DataMap- * 存放 sql 查询条件的对象,使用字符串进行缓存 - * 可使用内部指定参数进行添加,将会过滤输入的值 - * 或直接添加 sql 语句,会接在当前语句后面,但不过滤 - *- *
插入的语句展示符号说明: - * ( * ) 代表着使用一个枚举对象作为这里的参数,通常是固定的语句 - * [ * ] 代表着这个语句会根据你输入的参数决定是否出现,通常为取反语句 - * [ * | * ] 代表这这个语句会根据你输入的参数决定使用哪个参数 - * \(\) 代表这个不是上面的括号,和转义符一样 - * \[\] 同上 - * 大写代表 sql 语句 - * 小写代表 变量 - *- * - * @author fybug - * @version 0.0.5 - * @see Logical - * @see Comparison - * @since PDF 1.3 - */ -@NoSynchronized -@SuppressWarnings( "All" ) -public -class WhereSet extends ConsistentField implements Cleanable, Serializable, Cloneable { - @NotNull private LinkedList
检查字段类型,并进行过滤.
- * - * @param o 要检查的字段 - * - * @return 检查并进行相应处理的字段 - */ - @NotNull - static - String checkFidle(@Nullable final Object o) { - if (o instanceof String) - return '\'' + fuckSql(o.toString()).trim() + '\''; - - return fuckSql(String.valueOf(o)).trim(); - } - - // 加入关系 - @NotNull - private - StringBuilder addRelation(@NotNull final Logical logical, @NotNull final StringBuilder set) { - if (set.length() > 0) - set.append(logical); - return set; - } - - /* - * Add - */ - - /** - *添加等值条件.
- *
- * 添加条件如下 {@code "( Logical ) key [ ! ]= val"}
- * 即添加一个检查该键是否等于该值的条件
- *
- *
- * @param logical 与前面条件的关系
- * @param key 键
- * @param val 要等于的值,如不是字符串类型则不会包装
- * @param negation 是否取反,即使用 !=
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addEqual(@NotNull final Logical logical, @NotNull String key,
- @Nullable final Object val, final boolean negation)
- {
- @NotNull String ss[] = new String[4];
- @NotNull DataMap添加键值逻辑条件.
- *
- * 添加条件如下 {@code "( Logical ) key ( Comparison ) val"}
- * 与等值条件不同的是,你可以指定键和值的逻辑运算符
- *
- *
- * @param logical 与前面条件的关系
- * @param key 键
- * @param how 逻辑运算符
- * @param val 要判断的值,如不是字符串则不会进行包装
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addWhere(@NotNull final Logical logical, @NotNull String key,
- @NotNull final Comparison how, @NotNull final Object val)
- {
- @NotNull String ss[] = new String[4];
- @NotNull DataMap添加空检查.
- *
- * 添加条件如下 {@code "( Logical ) key IS [ NOT ] NULL"}
- *
- *
- * @param logical 与前面的条件的关系
- * @param key 要检查的键
- * @param negation 取反
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addNullCheck(@NotNull final Logical logical, @NotNull String key,
- final boolean negation)
- {
- @NotNull String ss[] = new String[3];
- @NotNull DataMap添加范围检查.
- *
- * 添加条件如下 {@code "( Logical ) key [ NOT ] BETWEEN val AND val"}
- *
- *
- * @param logical 与前面的条件的关系
- * @param key 要检查的键
- * @param num1 开始范围,如不是字符串则不会进行包装
- * @param num2 结束范围,如不是字符串则不会进行包装
- * @param negation 取反
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addBetween(@NotNull final Logical logical, @NotNull String key, @NotNull Object num1,
- @NotNull Object num2, final boolean negation)
- {
- @NotNull String ss[] = new String[5];
- @NotNull DataMap加入列举检查.
- *
- * 添加条件如下 {@code "( Logical ) key [ NOT ] IN (val, val)"}
- *
- *
- * @param logical 与前面的条件的关系
- * @param key 要检查的键
- * @param negation 是否取反
- * @param val 列举的值,如不是字符串则不会进行包装
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addIn(@NotNull final Logical logical, @NotNull String key, final boolean negation,
- @NotNull final Object... val)
- {
- @NotNull final LinkedList加入模糊查询.
- *
- * 添加条件如下 {@code "( Logical ) key [ NOT ] LIKE val"}
- *
- *
- * @param logical 与前面的条件的关系
- * @param key 要检查的键
- * @param val 条件,不支持除字符串以外的类型
- * @param negation 是否取反
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addLike(@NotNull final Logical logical, @NotNull String key, @NotNull final String val,
- final boolean negation)
- {
- @NotNull String ss[] = new String[4];
- @NotNull DataMap加入正则查询.
- *
- * 添加条件如下 {@code "( Logical ) [ NOT ( ] key REGEXP val [ ) ]"}
- *
- *
- * @param logical 与前面的条件的关系
- * @param key 要检查的键
- * @param val 正则,不支持除字符串以外的类型
- * @param negation 是否取反
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addRegexp(@NotNull final Logical logical, @NotNull String key,
- @NotNull final String val, final boolean negation)
- {
- @NotNull String ss[] = new String[4];
- @NotNull DataMap添加 Sql 语句.
- *- * 添加的语句在 Where 后,请不要添加条件语句以外的语句 - *- * - * @param logical 与前面语句的关系 - * @param sql 要添加的 Sql 语句,不支持除字符串以外的类型,并且不进行过滤和包装 - * - * @return this - */ - @NotNull - public - WhereSet addSql(@NotNull final Logical logical, @NotNull final String sql) { - @NotNull String ss[] = new String[2]; - @NotNull DataMap
添加整合条件语句.
- *
- * 即使用 () 将语句包起来,可提高该串语句的优先度
- * 添加条件如下 {@code "( Logical ) [ NOT ] \( ( WhereSet ) \)"}
- *
- *
- * @param logical 与前面语句的关系
- * @param whereSet 要插入的语句,不会进行过滤和包装
- * @param negation 是否取反
- *
- * @return this
- */
- @NotNull
- public
- WhereSet addMoreSql(@NotNull final Logical logical, @NotNull final WhereSet whereSet,
- final boolean negation)
- {
- @NotNull String ss[] = new String[3];
- @NotNull DataMap泛添加.
- *- * 根据传入的枚举选择对应的方法 - * 使用反射执行 - *- * - * @param whereEnum 要添加的条件类型枚举 - * @param os 该方法的参数 - * - * @since PDF 1.3 expander 1 - */ - @NotNull - public - WhereSet exe(@NotNull final WhereEnum whereEnum, @NotNull final Object... os) { - @NotNull String name = ""; - - switch ( whereEnum ) { - case EQUAL: - name = "addEqual"; - // 反射执行 - addEqual((Logical) os[0], (String) os[1], os[2], (boolean) os[3]); - break; - case WHERE: - name = "addWhere"; - addWhere((Logical) os[0], (String) os[1], (Comparison) os[2], os[3]); - break; - case NULLCHECK: - name = "addNullCheck"; - addNullCheck((Logical) os[0], (String) os[1], (boolean) os[2]); - break; - case BETWEEN: - name = "addBetween"; - addBetween((Logical) os[0], (String) os[1], os[2], os[3], (boolean) os[4]); - break; - case IN: - name = "addIn"; - addIn((Logical) os[0], (String) os[1], (boolean) os[2], os[3]); - break; - case LIKE: - name = "addLike"; - addLike((Logical) os[0], (String) os[1], (String) os[2], (boolean) os[3]); - break; - case REGEXP: - name = "addRegexp"; - addRegexp((Logical) os[0], (String) os[1], (String) os[2], (boolean) os[3]); - break; - case SQL: - name = "addSql"; - addSql((Logical) os[0], (String) os[1]); - break; - case MORESQL: - name = "addMoreSql"; - addMoreSql((Logical) os[0], (WhereSet) os[1], (boolean) os[2]); - break; - } - - return this; - } - - /* - * toString - */ - - /** - *
获取语句.
- * - * @return 没参数为 {@code Null} - */ - @Nullable - private - String get() { - if (dataMaps.size() == 0) - return null; - @NotNull final StringBuilder stringBuilder = new StringBuilder(); - - for ( DataMap获取查询条件.
- *- * 获取条件集里面的条件并添加到传入的字符缓存区 - *- * - * @param whele 要提取的条件集 - * @param sql 要添加的字符缓冲区 - */ - public static - void getWhere(@NotNull final WhereSet whele, @NotNull final StringBuilder sql) - { - // 条件语句 - @Nullable final String s = whele.get(); - if (s == null) - return; - - sql.ensureCapacity(7 + s.length() + sql.length()); - sql.append(" WHERE ").append(s); - } - - /* - * BDPos - */ - - /** - *
转化为 BDPos 属性对象.
- * - * @return {@link PostField} - * - * @since PDF 1.3 expander 1 - */ - public - PostField toBDPos() { - if (dataMaps.size() == 0) - return null; - @NotNull final PostField postField = new PostField(); - postField.name = "where"; - StringBuilder s = new StringBuilder(); - String[] ss; - - for ( DataMap解析 BDPos 格式的数据.
- * - * @param post {@link WhereEnum}&field&field解析内容.
- *- * 将运行解析好的 BDPos 的指令 - * 添加条件语句段 - *- * - * @see WhereEnum - */ - private static - void passing(String[] s, WhereSet set) { - if (s.length == 0) - return; - - WhereEnum whereEnum = WhereEnum.get(s[0]); - if (whereEnum == null) { - throw new RuntimeException("操作枚举不正确"); - } - - /* 根据类型进行转化 */ - @NotNull Object[] o; - switch ( whereEnum ) { - case EQUAL: { - // 获取属性名 - @NotNull final String key = fuckSql(s[2]); - // 获取内容 - @NotNull final String val = fuckSql(s[3]); - final boolean b = Boolean.parseBoolean(s[4].trim()); - - o = new Object[]{Logical.get(s[1]), key, val, b}; - } - break; - case WHERE: { - // 获取属性名 - @NotNull final String key = fuckSql(s[2]); - - /* 获取逻辑关系符 */ - @Nullable Comparison comparison = Comparison.getMde(s[3].trim()); - if (comparison == null) - comparison = Comparison.EQULE; - - // 获取内容 - @NotNull final String val = fuckSql(s[4]); - - o = new Object[]{Logical.get(s[1]), key, comparison, val}; - } - break; - case NULLCHECK: { - // 获取属性名 - @NotNull final String key = fuckSql(s[2]); - final Boolean b = Boolean.parseBoolean(s[3].trim()); - - o = new Object[]{Logical.get(s[1]), key, b}; - } - break; - case BETWEEN: { - // 获取属性名 - @NotNull final String key = fuckSql(s[2]); - - @NotNull final String ps1 = fuckSql(s[3]), ps2 = fuckSql(s[4]); - final Boolean b = Boolean.parseBoolean(s[5].trim()); - - o = new Object[]{Logical.get(s[1]), key, ps1, ps2, b}; - } - break; - case IN: { - @NotNull final String key = fuckSql(s[2]); // 属性名 - final Boolean b = Boolean.parseBoolean(s[3].trim()); // 是否取反 - - /* 取出变长参数 */ - @NotNull LinkedList
解析操作类型.
- * - * @param s 要解析的字符串 - * - * @return {@link WhereEnum} - */ - @Nullable - public static - WhereEnum get(@NotNull String s) { - s = s.trim().toLowerCase(); - - switch ( s ) { - case "equal": - return EQUAL; - case "where": - return WHERE; - case "nullcheck": - return NULLCHECK; - case "between": - return BETWEEN; - case "in": - return IN; - case "like": - return LIKE; - case "regexp": - return REGEXP; - case "sql": - return SQL; - case "moresql": - return MORESQL; - default: - return null; - } - } - - @Override - @NotNull - public - String toString() { return string; } - } -} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Util/package-info.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Util/package-info.java deleted file mode 100644 index 53680b915859f342b510b519007ffead63d26709..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/Util/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - *提供 Sql 执行辅助对象- * - * @author fybug - * @version 0.0.2 - * @since PDF 1.2 - */ -package fybug.nulll.pdfunctionlibrary.Processing.sql.Util; \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Delete.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Delete.java deleted file mode 100644 index 9dcb90fb8a8d0a2eba29c291d12299b393601903..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Delete.java +++ /dev/null @@ -1,249 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.mysql; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Collection; - -import fybug.nulll.bdpost.Instruct; -import fybug.nulll.bdpost.PostField; -import fybug.nulll.pdfunctionlibrary.Annotations.NoSynchronized; -import fybug.nulll.pdfunctionlibrary.Processing.sql.Util.WhereSet; -import fybug.nulll.pdfunctionlibrary.lang.ConsistentField; - -import static fybug.nulll.pdfunctionlibrary.Processing.FuckChar.fuckSql; -/** - *
- * 该对象包含一个完整的 {@code Mysql} 删除语句
- * 需传入所需要的 条件语句 对象
- *
- *
- * @author fybug
- * @version 0.0.2
- * @see MysqlSql
- * @since PDF 1.3
- */
-@NoSynchronized
-@SuppressWarnings( "All" )
-public final
-class Delete extends ConsistentField implements MysqlSql {
- @Nullable protected ArrayList构造一个空的删除语句对象.
*/ - public - Delete() {} - - /** - *构造一个删除语句并初始化.
- * - * @param tab 要删除的表 - * @param w 删除的条件 - */ - public - Delete(@NotNull final String tab, @NotNull final WhereSet w) { - setWhere(w); - addTabname(tab); - } - - /** - *添加要操作的表名.
- * - * @param s 要操作的表 - * - * @return this - */ - @Override - public @NotNull - Delete addTabname(@NotNull String s) { - s = fuckSql(s).trim(); - if (!s.equals("")) - this.tabname.add(s); - else - tabname = null; - return this; - } - - /** - *获取当前要操作的表的列表.
- * - * @return 要操作的表 - */ - @NotNull - public - Collection设置操作条件.
- * - * @param where 如果是{@code null} 则会清空条件 - * - * @return this - */ - @NotNull - public - Delete setWhere(@Nullable final WhereSet where) { - if (where == null) - this.where = null; - else - this.where = where; - return this; - } - - /** - *获取条件对象.
- * - * @return {@link WhereSet} - */ - @Nullable - public - WhereSet getWhere() { return where; } - - @Override - protected - boolean consistent(@NotNull final Object obj) - { return hashCode() == obj.hashCode(); } - - @Override - public - int hashCode() { - return ((super.hashCode() + (tabname == null ? -1 : tabname.hashCode())) << 5) + - ((where == null ? -1 : where.hashCode()) << 5); - } - - @Override - @NotNull - protected - Object clone() throws CloneNotSupportedException { - @NotNull final Delete d = (Delete) super.clone(); - d.tabname = tabname; - d.where = where == null ? null : (WhereSet) where.clone(); - return d; - } - - @NotNull - @Override - public - String toString() { - if (where == null || tabname == null) - throw new NullPointerException("No Field Sql!"); - - boolean f = true; - @NotNull final StringBuilder sql = new StringBuilder("DELETE FROM "); - tabname.trimToSize(); - - /* 获取插入表组 */ - for ( String key : tabname ){ - if (f) { - sql.ensureCapacity(sql.length() + 2 + key.length()); - f = false; - } else { - sql.ensureCapacity(sql.length() + key.length() + 4); - sql.append(", "); - } - sql.append('`').append(key).append('`'); - } - - WhereSet.getWhere(where, sql); - - sql.trimToSize(); - return sql.toString(); - } - - @Override - public - void clean() { - tabname.clear(); - where = null; - } - - @Override - public - void free() { clean(); } - - @Override - public - void close() { - where.close(); - free(); - tabname = null; - } - - /** - *解析 BDPos 为删除语句.
- * - * @param post {@code # where:}{@link WhereSet#passingBDPos(PostField)}生成 BDPos 对象.
- * - * @return {@link Instruct} - * - * @since PDF 1.3 expander 1 - */ - @NotNull - public - Instruct toBDPos() { - @NotNull final Instruct instruct = new Instruct(); - instruct.name = "delete"; - - // 放入条件 - if (where != null) - instruct.putPostField(where.toBDPos()); - - /* 放入表名 */ - @NotNull final StringBuilder stringBuilder = new StringBuilder(); - @NotNull String ta; // 减少寻址 - for ( int i = 0; i < tabname.size(); i++ ){ - ta = tabname.get(i); - stringBuilder.ensureCapacity(stringBuilder.length() + ta.length() + 1); - stringBuilder.append(ta).append('&'); - } - stringBuilder.deleteCharAt(stringBuilder.length() - 1); - instruct.putPostField(new PostField(stringBuilder.toString())); - - stringBuilder.setLength(0); - stringBuilder.trimToSize(); - - return instruct; - } -} \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Insert.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Insert.java deleted file mode 100644 index 7a09467591e677bb351501abd4b392532729aeb5..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Insert.java +++ /dev/null @@ -1,260 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.mysql; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import fybug.nulll.bdpost.Instruct; -import fybug.nulll.bdpost.PostField; -import fybug.nulll.pdfunctionlibrary.Annotations.NoSynchronized; -import fybug.nulll.pdfunctionlibrary.Processing.sql.Util.InsertVal; -import fybug.nulll.pdfunctionlibrary.Processing.sql.Util.UpDataVal; -import fybug.nulll.pdfunctionlibrary.lang.ConsistentField; - -import static fybug.nulll.pdfunctionlibrary.Processing.FuckChar.fuckSql; -/** - *
- * 该对象包含一个完整的 {@code Mysql} 插入语句
- * 需传入所需要的 操作段语句 对象
- * 如果传入了 更新操作段 对象则会在 已有插入 的情况下进行更新
- *
- *
- * @author fybug
- * @version 0.0.2
- * @see MysqlSql
- * @since PDF 1.3
- */
-@NoSynchronized
-@SuppressWarnings( "all" )
-public final
-class Insert extends ConsistentField implements MysqlSql {
- @Nullable protected String tabname = null;
- @Nullable protected InsertVal In = null;
- @Nullable protected UpDataVal up = null;
-
- /**
- * 构造一个插入语句并初始化.
- * - * @param tabname 要插入的表 - * @param insertVal 插入值的语句 - */ - public - Insert(@NotNull final String tabname, @NotNull final InsertVal insertVal) { - setInserVal(insertVal); - addTabname(tabname); - } - - /**构造一个空的插入语句对象.
*/ - public - Insert() {} - - /** - *设置要操作的表名.
- * - * @param s 要操作的表 - * - * @return this - */ - @Override - public @NotNull - Insert addTabname(@NotNull String s) { - tabname = fuckSql(s).trim(); - if (!s.equals("")) - this.tabname = s; - else - tabname = null; - return this; - } - - /** - *获取当前要操作的表名.
- * - * @return 要操作的表的名称 - */ - @Nullable - public - String getTabname() { return tabname; } - - /** - *设置插入值语句.
- * - * @param bv 如果是{@code Null} 则会清空语句对象 - * - * @return this - * - * @see InsertVal - */ - @NotNull - public - Insert setInserVal(@Nullable final InsertVal bv) { - In = bv; - return this; - } - - /** - *获取插入值语句.
- * - * @return {@link InsertVal} - */ - @Nullable - public - InsertVal getInserVal() { return In; } - - /** - *设置更新语句.
- * - * @param u 如果是{@code Null} 则会清空语句对象 - * - * @return this - * - * @see UpDataVal - */ - @NotNull - public - Insert setUpDataVal(@Nullable final UpDataVal u) { - up = u; - return this; - } - - /** - *获取更新语句.
- * - * @return {@link UpDataVal} - */ - @Nullable - public - UpDataVal getUpDataVal() { return up; } - - @NotNull - @Override - public - String toString() { - if (In == null || In.size() == 0 || tabname == null) - throw new NullPointerException("No Field Sql!"); - - @NotNull final StringBuilder sql = new StringBuilder("INSERT INTO "); - - /* 插入语句部分 */ - sql.ensureCapacity(sql.length() + 3 + tabname.length()); - sql.append('`').append(tabname).append("`").append(In); - - /* 更新语句部分 */ - if (up != null) { - sql.append(" ON DUPLICATE KEY UPDATE ").append(up); - } - - sql.append(';'); - sql.trimToSize(); - return sql.toString(); - } - - @Override - protected - boolean consistent(@NotNull final Object obj) - { return obj.hashCode() == this.hashCode(); } - - @Override - public - int hashCode() { - return ((super.hashCode() + (tabname == null ? -1 : tabname.hashCode())) << 5) + - ((In == null ? -1 : In.hashCode()) << 5) + ((up == null ? -1 : up.hashCode()) << 5); - } - - @Override - @NotNull - public - Object clone() throws CloneNotSupportedException { - @NotNull final Insert i = (Insert) super.clone(); - i.tabname = this.tabname; - i.In = In == null ? null : (InsertVal) this.In.clone(); - i.up = up == null ? null : (UpDataVal) up.clone(); - return i; - } - - /* - * 释放 - */ - - @Override - public - void clean() { - tabname = null; - In = null; - up = null; - } - - @Override - public - void free() { clean(); } - - @Override - public - void close() { - In.clean(); - up.clean(); - free(); - } - - /** - *解析 BDPos 为插入语句.
- * - * @param post {@code # table:}table&table生成 BDPos 对象.
- * - * @return {@link Instruct} - */ - @NotNull - public - Instruct toBDPos() { - @NotNull final Instruct instruct = new Instruct(); - instruct.name = "insert"; - @NotNull PostField field = new PostField(); - - if (tabname != null) - instruct.putPostField(field.loadField(tabname)); - - if (In != null) - instruct.putPostField(In.toBDPos()); - - if (up != null) - instruct.putPostField(up.toBDPos()); - - return instruct; - } -} \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/MysqlSql.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/MysqlSql.java deleted file mode 100644 index 14b414b2dcf5e07a646528b6e4022f6b9259240e..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/MysqlSql.java +++ /dev/null @@ -1,40 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.mysql; -import org.jetbrains.annotations.NotNull; - -import java.io.Serializable; - -import fybug.nulll.pdfunctionlibrary.Processing.sql.Mysql; -import fybug.nulll.pdfunctionlibrary.lang.Cleanable; -/** - *
- * 此接口表示当前对象代表一个完整的 Mysql 操作语句
- * 可通过 {@link #toString()} 打印该语句
- *
- *
- * @author fybug
- * @version 0.0.1
- * @see Mysql
- * @since PDF 1.3
- */
-@SuppressWarnings( "all" )
-public
-interface MysqlSql extends Serializable, Cloneable, Cleanable {
- /**
- * 打印当前操作的 sql 语句.
- * - * @return 当前操作的 SQL 语句 - */ - @NotNull - String toString(); - - /** - *添加要操作的表名.
- * - * @param s 要操作的表 - * - * @return this - */ - @NotNull - MysqlSql addTabname(@NotNull final String s); -} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Updata.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Updata.java deleted file mode 100644 index 71a1d6ca7b0cdca72f7c70d302e5f573bcbf4800..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/Updata.java +++ /dev/null @@ -1,242 +0,0 @@ -package fybug.nulll.pdfunctionlibrary.Processing.sql.mysql; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import fybug.nulll.bdpost.Instruct; -import fybug.nulll.bdpost.PostField; -import fybug.nulll.pdfunctionlibrary.Annotations.NoSynchronized; -import fybug.nulll.pdfunctionlibrary.Processing.sql.Util.UpDataVal; -import fybug.nulll.pdfunctionlibrary.Processing.sql.Util.WhereSet; -import fybug.nulll.pdfunctionlibrary.lang.ConsistentField; - -import static fybug.nulll.pdfunctionlibrary.Processing.FuckChar.fuckSql; -/** - *
- * 该对象包含一个完整的 {@code Mysql} 更新语句
- * 需传入所需要的 条件语句 对象
- * 以及需要的 更新语句段 对象
- *
- *
- * @author fybug
- * @version 0.0.2
- * @see MysqlSql
- * @since PDF 1.3
- */
-@SuppressWarnings( "all" )
-@NoSynchronized
-public final
-class Updata extends ConsistentField implements MysqlSql {
- @Nullable protected String tabname = null;
- @Nullable protected WhereSet where = null;
- @Nullable protected UpDataVal up = null;
-
- /**
- * 添加要操作的表名.
- * - * @param s 要操作的表 - * - * @return this - */ - @Override - public @NotNull - Updata addTabname(@NotNull final String s) { - tabname = fuckSql(s).trim(); - if (!s.equals("")) - this.tabname = s; - else - tabname = null; - return this; - } - - /** - *获取当前要操作的表名.
- * - * @return 要操作的表 - */ - @Nullable - public - String getTabname() { return tabname; } - - /** - *设置操作条件.
- * - * @param where 如果是{@code null} 则会清空条件 - * - * @return this - */ - @NotNull - public - Updata setWhere(@Nullable final WhereSet where) { - if (where == null) - this.where = null; - else - this.where = where; - return this; - } - - /** - *获取条件对象.
- * - * @return {@link WhereSet} - */ - @Nullable - public - WhereSet getWhere() { return where; } - - /** - *设置更新语句段.
- * - * @param updata 如果为{@code null} 则会清空对应的语句段 - * - * @return this - * - * @see UpDataVal - */ - @NotNull - public - Updata setUpdata(@Nullable final UpDataVal updata) { - if (updata == null) - up = null; - else - up = updata; - return this; - } - - /** - *获取更新语句段.
- * - * @return {@link UpDataVal} - */ - @Nullable - public - UpDataVal getUpData() { return up; } - - @Override - protected - boolean consistent(@NotNull final Object obj) - { return hashCode() == obj.hashCode(); } - - @Override - public - int hashCode() { - return ((super.hashCode() + (tabname == null ? -1 : tabname.hashCode())) << 5) + - ((where == null ? -1 : where.hashCode()) << 5) + - ((up == null ? -1 : up.hashCode()) << 5); - } - - @Override - @NotNull - protected - Object clone() throws CloneNotSupportedException { - @NotNull final Updata d = (Updata) super.clone(); - d.tabname = tabname; - d.where = where == null ? null : (WhereSet) where.clone(); - d.up = up == null ? null : (UpDataVal) up.clone(); - return d; - } - - @NotNull - @Override - public - String toString() { - if (up == null || up.size() == 0 || tabname == null) - throw new NullPointerException("No Field Sql!"); - - @NotNull final StringBuilder sql = new StringBuilder("UPDATE "); - @NotNull final String fs = up.toString(); - - // 过滤表名 - sql.ensureCapacity(sql.length() + tabname.length() + 6 + fs.length()); - sql.append('`').append(tabname).append('`').append(" SET ").append(fs); - - // 获取条件 - WhereSet.getWhere(where, sql); - - sql.trimToSize(); - return sql.toString(); - } - - @Override - public - void clean() { - up = null; - tabname = null; - where = null; - } - - @Override - public - void free() { clean(); } - - @Override - public - void close() { - up.close(); - where.close(); - free(); - } - - /** - *解析 BDPos 为更新语句.
- * - * @param post {@code # table:}table&table生成 BDPos 对象.
- * - * @return {@link Instruct} - */ - @NotNull - public - Instruct toBDPos() { - @NotNull final Instruct instruct = new Instruct(); - instruct.name = "updata"; - @NotNull PostField field = new PostField(); - - if (tabname != null) - instruct.putPostField(field.loadField(tabname)); - - if (where != null) - instruct.putPostField(where.toBDPos()); - - if (up != null) - instruct.putPostField(up.toBDPos()); - - return instruct; - } -} diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/package-info.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/package-info.java deleted file mode 100644 index 2b7bc9bdff628b40a85323d95c34b49337ec63bc..0000000000000000000000000000000000000000 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Processing/sql/mysql/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -/** - *提供基础 Sql 执行工具和其他数据库工具- * - * @author fybug - * @version 0.0.1 - * @since PDF 1.2 - */ -package fybug.nulll.pdfunctionlibrary.Processing.sql; \ No newline at end of file diff --git a/src/main/java/fybug/nulll/pdfunctionlibrary/Util/Map/ArrayMap.java b/src/main/java/fybug/nulll/pdfunctionlibrary/Util/Map/ArrayMap.java index 46752bbc54e3b8b022b74ec32a053d8bf5cd8a65..a4dc3477f864b7e9b4b19d5fa137e8579a10e67c 100644 --- a/src/main/java/fybug/nulll/pdfunctionlibrary/Util/Map/ArrayMap.java +++ b/src/main/java/fybug/nulll/pdfunctionlibrary/Util/Map/ArrayMap.java @@ -1,6 +1,6 @@ package fybug.nulll.pdfunctionlibrary.Util.Map; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import com.sun.istack.internal.NotNull; +import com.sun.istack.internal.Nullable; import java.util.ArrayList; @@ -10,7 +10,7 @@ import fybug.nulll.pdfunctionlibrary.Util.DataMap; *
使用了数组实现的映射集.
* * @author fybug - * @version 0.0.2 + * @version 0.0.3 * @see ArrayList * @see DataMap * @see MapFile @@ -74,6 +74,14 @@ class ArrayMap使用了链表实现的映射集.
* * @author fybug - * @version 0.0.2 + * @version 0.0.3 * @see LinkedList * @see DataMap * @see MapFile @@ -75,6 +75,14 @@ class LinkMap重置指针.
+ * + * @return this + * + * @since PDF 1.3 expander 2 + */ + @NotNull + MapFile创建一个使用数组的映射集.
*/ @NotNull static diff --git a/src/main/java/org/jetbrains/annotations/NotNull.java b/src/main/java/org/jetbrains/annotations/NotNull.java deleted file mode 100644 index 81d5f86cb64d8e31505735dc58a4695ad020e7fd..0000000000000000000000000000000000000000 --- a/src/main/java/org/jetbrains/annotations/NotNull.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.annotations; - -import java.lang.annotation.*; - -/** - * An element annotated with NotNull claims {@code null} value is forbidden - * to return (for methods), pass to (parameters) and hold (local variables and fields). - * Apart from documentation purposes this annotation is intended to be used by static analysis tools - * to validate against probable runtime errors and element contract violations. - * - * @author max - */ -@Documented -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE, ElementType.TYPE_USE}) -public @interface NotNull { - /** - * @return Custom exception message - */ - String value() default ""; - - /** - * @return Custom exception type that should be thrown when not-nullity contract is violated. - * The exception class should have a constructor with one String argument (message). - * - * By default, {@link IllegalArgumentException} is thrown on null method arguments and - * {@link IllegalStateException} — on null return value. - */ - Class extends Exception> exception() default Exception.class; -} diff --git a/src/main/java/org/jetbrains/annotations/Nullable.java b/src/main/java/org/jetbrains/annotations/Nullable.java deleted file mode 100644 index 39e3123061d247fc8085f7966f61f21007c87e37..0000000000000000000000000000000000000000 --- a/src/main/java/org/jetbrains/annotations/Nullable.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.annotations; - -import java.lang.annotation.*; - -/** - * An element annotated with {@link Nullable} claims {@code null} value is perfectly valid - * to return (for methods), pass to (parameters) or hold in (local variables and fields). - * Apart from documentation purposes this annotation is intended to be used by static analysis tools - * to validate against probable runtime errors or element contract violations. - *