hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
sequence
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
sequence
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
sequence
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e02b038d270705a1503f59f10862564c1410bdc
148
java
Java
general_classes/interfaces/ActionBar.java
CroaBeast/ActionBarTitleUtils
7b20c6ce765b8b22c749e01d64c249b957f95b1e
[ "MIT" ]
null
null
null
general_classes/interfaces/ActionBar.java
CroaBeast/ActionBarTitleUtils
7b20c6ce765b8b22c749e01d64c249b957f95b1e
[ "MIT" ]
null
null
null
general_classes/interfaces/ActionBar.java
CroaBeast/ActionBarTitleUtils
7b20c6ce765b8b22c749e01d64c249b957f95b1e
[ "MIT" ]
1
2022-03-25T11:11:32.000Z
2022-03-25T11:11:32.000Z
18.5
45
0.783784
1,107
package general_classes.interfaces; import org.bukkit.entity.Player; public interface ActionBar { void send(Player player, String message); }
3e02b076903c8c624968abb3e2f784e8ef3fb18b
1,484
java
Java
taotao-cloud-microservice/taotao-cloud-yshop/src/main/java/com/taotao/cloud/yshop/biz/dto/RoleDto.java
shuigedeng/taotao-cloud-paren
3d281b919490f7cbee4520211e2eee5da7387564
[ "Apache-2.0" ]
47
2021-04-13T10:32:13.000Z
2022-03-31T10:30:30.000Z
taotao-cloud-microservice/taotao-cloud-yshop/src/main/java/com/taotao/cloud/yshop/biz/dto/RoleDto.java
shuigedeng/taotao-cloud-paren
3d281b919490f7cbee4520211e2eee5da7387564
[ "Apache-2.0" ]
1
2021-11-01T07:41:04.000Z
2021-11-01T07:41:10.000Z
taotao-cloud-microservice/taotao-cloud-yshop/src/main/java/com/taotao/cloud/yshop/biz/dto/RoleDto.java
shuigedeng/taotao-cloud-paren
3d281b919490f7cbee4520211e2eee5da7387564
[ "Apache-2.0" ]
21
2021-04-13T10:32:17.000Z
2022-03-26T07:43:22.000Z
15.621053
50
0.662399
1,108
/** * Copyright (C) 2018-2020 * All rights reserved, Designed By www.yixiang.co * 注意: * 本软件为www.yixiang.co开发研制 */ package com.taotao.cloud.system.api.dto; import java.io.Serializable; import java.sql.Timestamp; import java.util.Set; public class RoleDto implements Serializable { /** ID */ private Long id; /** 名称 */ private String name; /** 备注 */ private String remark; /** 数据权限 */ private String dataScope; /** 角色级别 */ private Integer level; //private Set<Menu> menus; /** 创建日期 */ private Timestamp createTime; /** 功能权限 */ private String permission; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public String getDataScope() { return dataScope; } public void setDataScope(String dataScope) { this.dataScope = dataScope; } public Integer getLevel() { return level; } public void setLevel(Integer level) { this.level = level; } public Timestamp getCreateTime() { return createTime; } public void setCreateTime(Timestamp createTime) { this.createTime = createTime; } public String getPermission() { return permission; } public void setPermission(String permission) { this.permission = permission; } }
3e02b390c649b75e96589509371b5e8b194eedae
23,302
java
Java
deeplearning4j-core/src/test/java/org/deeplearning4j/nn/layers/convolution/TestConvolutionModes.java
Nicholas-Ustick/deeplearning4j
b45997af6d357db1e959fef1dd950037780e11d3
[ "Apache-2.0" ]
2
2020-10-07T18:23:06.000Z
2021-06-13T16:17:28.000Z
deeplearning4j-core/src/test/java/org/deeplearning4j/nn/layers/convolution/TestConvolutionModes.java
Nicholas-Ustick/deeplearning4j
b45997af6d357db1e959fef1dd950037780e11d3
[ "Apache-2.0" ]
null
null
null
deeplearning4j-core/src/test/java/org/deeplearning4j/nn/layers/convolution/TestConvolutionModes.java
Nicholas-Ustick/deeplearning4j
b45997af6d357db1e959fef1dd950037780e11d3
[ "Apache-2.0" ]
null
null
null
52.719457
144
0.489443
1,109
package org.deeplearning4j.nn.layers.convolution; import org.deeplearning4j.exception.DL4JException; import org.deeplearning4j.nn.conf.ComputationGraphConfiguration; import org.deeplearning4j.nn.conf.ConvolutionMode; import org.deeplearning4j.nn.conf.MultiLayerConfiguration; import org.deeplearning4j.nn.conf.NeuralNetConfiguration; import org.deeplearning4j.nn.conf.graph.LayerVertex; import org.deeplearning4j.nn.conf.inputs.InputType; import org.deeplearning4j.nn.conf.layers.ConvolutionLayer; import org.deeplearning4j.nn.conf.layers.*; import org.deeplearning4j.nn.graph.ComputationGraph; import org.deeplearning4j.nn.multilayer.MultiLayerNetwork; import org.deeplearning4j.nn.weights.WeightInit; import org.deeplearning4j.util.ConvolutionUtils; import org.junit.Test; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; import org.nd4j.linalg.indexing.NDArrayIndex; import org.nd4j.linalg.lossfunctions.LossFunctions; import java.util.Arrays; import java.util.List; import static org.junit.Assert.*; /** * Created by Alex on 15/11/2016. */ public class TestConvolutionModes { @Test public void testStrictTruncateConvolutionModeOutput() { //Idea: with convolution mode == Truncate, input size shouldn't matter (within the bounds of truncated edge), // and edge data shouldn't affect the output //Use: 9x9, kernel 3, stride 3, padding 0 // Should get same output for 10x10 and 11x11... Nd4j.getRandom().setSeed(12345); int[] minibatches = {1, 3}; int[] inDepths = {1, 3}; int[] inSizes = {9, 10, 11}; for (boolean isSubsampling : new boolean[] {false, true}) { for (int minibatch : minibatches) { for (int inDepth : inDepths) { INDArray origData = Nd4j.rand(new int[] {minibatch, inDepth, 9, 9}); for (int inSize : inSizes) { for (ConvolutionMode cm : new ConvolutionMode[] {ConvolutionMode.Strict, ConvolutionMode.Truncate}) { INDArray inputData = Nd4j.rand(new int[] {minibatch, inDepth, inSize, inSize}); inputData.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.interval(0, 9), NDArrayIndex.interval(0, 9)).assign(origData); Layer layer; if (isSubsampling) { layer = new SubsamplingLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .build(); } else { layer = new ConvolutionLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .nOut(3).build(); } MultiLayerNetwork net = null; try { MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().weightInit(WeightInit.XAVIER) .convolutionMode(cm).list() .layer(0, layer).layer(1, new OutputLayer.Builder() .lossFunction(LossFunctions.LossFunction.MCXENT) .nOut(3).build()) .setInputType(InputType.convolutional(inSize, inSize, inDepth)) .build(); net = new MultiLayerNetwork(conf); net.init(); if (inSize > 9 && cm == ConvolutionMode.Strict) { fail("Expected exception"); } } catch (DL4JException e) { if (inSize == 9 || cm != ConvolutionMode.Strict) { e.printStackTrace(); fail("Unexpected exception"); } continue; //Expected exception } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception"); } INDArray out = net.output(origData); INDArray out2 = net.output(inputData); assertEquals(out, out2); } } } } } } @Test public void testStrictTruncateConvolutionModeCompGraph() { //Idea: with convolution mode == Truncate, input size shouldn't matter (within the bounds of truncated edge), // and edge data shouldn't affect the output //Use: 9x9, kernel 3, stride 3, padding 0 // Should get same output for 10x10 and 11x11... Nd4j.getRandom().setSeed(12345); int[] minibatches = {1, 3}; int[] inDepths = {1, 3}; int[] inSizes = {9, 10, 11}; for (boolean isSubsampling : new boolean[] {false, true}) { for (int minibatch : minibatches) { for (int inDepth : inDepths) { INDArray origData = Nd4j.rand(new int[] {minibatch, inDepth, 9, 9}); for (int inSize : inSizes) { for (ConvolutionMode cm : new ConvolutionMode[] {ConvolutionMode.Strict, ConvolutionMode.Truncate}) { INDArray inputData = Nd4j.rand(new int[] {minibatch, inDepth, inSize, inSize}); inputData.get(NDArrayIndex.all(), NDArrayIndex.all(), NDArrayIndex.interval(0, 9), NDArrayIndex.interval(0, 9)).assign(origData); Layer layer; if (isSubsampling) { layer = new SubsamplingLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .build(); } else { layer = new ConvolutionLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .nOut(3).build(); } ComputationGraph net = null; try { ComputationGraphConfiguration conf = new NeuralNetConfiguration.Builder() .weightInit(WeightInit.XAVIER).convolutionMode(cm).graphBuilder() .addInputs("in").addLayer("0", layer, "in") .addLayer("1", new OutputLayer.Builder() .lossFunction(LossFunctions.LossFunction.MCXENT).nOut(3) .build(), "0") .setOutputs("1") .setInputTypes(InputType.convolutional(inSize, inSize, inDepth)) .build(); net = new ComputationGraph(conf); net.init(); if (inSize > 9 && cm == ConvolutionMode.Strict) { fail("Expected exception"); } } catch (DL4JException e) { if (inSize == 9 || cm != ConvolutionMode.Strict) { e.printStackTrace(); fail("Unexpected exception"); } continue; //Expected exception } catch (Exception e) { e.printStackTrace(); fail("Unexpected exception"); } INDArray out = net.outputSingle(origData); INDArray out2 = net.outputSingle(inputData); assertEquals(out, out2); } } } } } } @Test public void testGlobalLocalConfig() { for (ConvolutionMode cm : new ConvolutionMode[] {ConvolutionMode.Strict, ConvolutionMode.Truncate}) { MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().weightInit(WeightInit.XAVIER) .convolutionMode(cm).list() .layer(0, new ConvolutionLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .nIn(3).nOut( 3) .build()) .layer(1, new ConvolutionLayer.Builder().convolutionMode(ConvolutionMode.Strict) .kernelSize(3, 3).stride(3, 3).padding(0, 0) .nIn(3).nOut( 3) .build()) .layer(2, new ConvolutionLayer.Builder().convolutionMode(ConvolutionMode.Truncate) .kernelSize(3, 3).stride(3, 3).padding(0, 0) .nIn(3).nOut( 3) .build()) .layer(3, new ConvolutionLayer.Builder().convolutionMode(ConvolutionMode.Same) .kernelSize(3, 3).stride(3, 3).padding(0, 0).nIn(3).nOut(3).build()) .layer(4, new SubsamplingLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .build()) .layer(5, new SubsamplingLayer.Builder().convolutionMode(ConvolutionMode.Strict) .kernelSize(3, 3).stride(3, 3).padding(0, 0).build()) .layer(6, new SubsamplingLayer.Builder().convolutionMode(ConvolutionMode.Truncate) .kernelSize(3, 3).stride(3, 3).padding(0, 0).build()) .layer(7, new SubsamplingLayer.Builder().convolutionMode(ConvolutionMode.Same) .kernelSize(3, 3).stride(3, 3).padding(0, 0).build()) .layer(8, new OutputLayer.Builder().lossFunction(LossFunctions.LossFunction.MCXENT).nOut(3) .build()) .build(); assertEquals(cm, ((ConvolutionLayer) conf.getConf(0).getLayer()).getConvolutionMode()); assertEquals(ConvolutionMode.Strict, ((ConvolutionLayer) conf.getConf(1).getLayer()).getConvolutionMode()); assertEquals(ConvolutionMode.Truncate, ((ConvolutionLayer) conf.getConf(2).getLayer()).getConvolutionMode()); assertEquals(ConvolutionMode.Same, ((ConvolutionLayer) conf.getConf(3).getLayer()).getConvolutionMode()); assertEquals(cm, ((SubsamplingLayer) conf.getConf(4).getLayer()).getConvolutionMode()); assertEquals(ConvolutionMode.Strict, ((SubsamplingLayer) conf.getConf(5).getLayer()).getConvolutionMode()); assertEquals(ConvolutionMode.Truncate, ((SubsamplingLayer) conf.getConf(6).getLayer()).getConvolutionMode()); assertEquals(ConvolutionMode.Same, ((SubsamplingLayer) conf.getConf(7).getLayer()).getConvolutionMode()); } } @Test public void testGlobalLocalConfigCompGraph() { for (ConvolutionMode cm : new ConvolutionMode[] {ConvolutionMode.Strict, ConvolutionMode.Truncate, ConvolutionMode.Same}) { ComputationGraphConfiguration conf = new NeuralNetConfiguration.Builder().weightInit(WeightInit.XAVIER) .convolutionMode(cm).graphBuilder().addInputs("in") .addLayer("0", new ConvolutionLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .nIn(3).nOut( 3) .build(), "in") .addLayer("1", new ConvolutionLayer.Builder().convolutionMode(ConvolutionMode.Strict) .kernelSize(3, 3).stride(3, 3).padding(0, 0) .nIn(3).nOut( 3) .build(), "0") .addLayer("2", new ConvolutionLayer.Builder().convolutionMode(ConvolutionMode.Truncate) .kernelSize(3, 3).stride(3, 3).padding(0, 0) .nIn(3).nOut( 3) .build(), "1") .addLayer("3", new ConvolutionLayer.Builder().convolutionMode(ConvolutionMode.Same) .kernelSize(3, 3).stride(3, 3).padding(0, 0).nIn(3).nOut(3).build(), "2") .addLayer("4", new SubsamplingLayer.Builder().kernelSize(3, 3).stride(3, 3).padding(0, 0) .build(), "3") .addLayer("5", new SubsamplingLayer.Builder().convolutionMode(ConvolutionMode.Strict) .kernelSize(3, 3).stride(3, 3).padding(0, 0).build(), "4") .addLayer("6", new SubsamplingLayer.Builder().convolutionMode(ConvolutionMode.Truncate) .kernelSize(3, 3).stride(3, 3).padding(0, 0).build(), "5") .addLayer("7", new SubsamplingLayer.Builder().convolutionMode(ConvolutionMode.Same) .kernelSize(3, 3).stride(3, 3).padding(0, 0).build(), "6") .addLayer("8", new OutputLayer.Builder().lossFunction(LossFunctions.LossFunction.MCXENT) .nOut(3).build(), "7") .setOutputs("8").build(); assertEquals(cm, ((ConvolutionLayer) ((LayerVertex) conf.getVertices().get("0")).getLayerConf().getLayer()) .getConvolutionMode()); assertEquals(ConvolutionMode.Strict, ((ConvolutionLayer) ((LayerVertex) conf.getVertices().get("1")).getLayerConf().getLayer()) .getConvolutionMode()); assertEquals(ConvolutionMode.Truncate, ((ConvolutionLayer) ((LayerVertex) conf.getVertices().get("2")).getLayerConf().getLayer()) .getConvolutionMode()); assertEquals(ConvolutionMode.Same, ((ConvolutionLayer) ((LayerVertex) conf.getVertices().get("3")).getLayerConf().getLayer()) .getConvolutionMode()); assertEquals(cm, ((SubsamplingLayer) ((LayerVertex) conf.getVertices().get("4")).getLayerConf().getLayer()) .getConvolutionMode()); assertEquals(ConvolutionMode.Strict, ((SubsamplingLayer) ((LayerVertex) conf.getVertices().get("5")).getLayerConf().getLayer()) .getConvolutionMode()); assertEquals(ConvolutionMode.Truncate, ((SubsamplingLayer) ((LayerVertex) conf.getVertices().get("6")).getLayerConf().getLayer()) .getConvolutionMode()); assertEquals(ConvolutionMode.Same, ((SubsamplingLayer) ((LayerVertex) conf.getVertices().get("7")).getLayerConf().getLayer()) .getConvolutionMode()); } } @Test public void testConvolutionModeInputTypes() { //Test 1: input 3x3, stride 1, kernel 2 int inH = 3; int inW = 3; int kH = 2; int kW = 2; int sH = 1; int sW = 1; int pH = 0; int pW = 0; int minibatch = 3; int dIn = 5; int dOut = 7; int[] kernel = {kH, kW}; int[] stride = {sH, sW}; int[] padding = {pH, pW}; int[] dilation = {1,1}; INDArray inData = Nd4j.create(minibatch, dIn, inH, inW); InputType inputType = InputType.convolutional(inH, inW, dIn); //Strict mode: expect 2x2 out -> (inH - kernel + 2*padding)/stride + 1 = (3-2+0)/1+1 = 2 InputType.InputTypeConvolutional it = (InputType.InputTypeConvolutional) InputTypeUtil.getOutputTypeCnnLayers(inputType, kernel, stride, padding, dilation, ConvolutionMode.Strict, dOut, -1, "layerName", ConvolutionLayer.class); assertEquals(2, it.getHeight()); assertEquals(2, it.getWidth()); assertEquals(dOut, it.getDepth()); int[] outSize = ConvolutionUtils.getOutputSize(inData, kernel, stride, padding, ConvolutionMode.Strict); assertEquals(2, outSize[0]); assertEquals(2, outSize[1]); //Truncate: same as strict here it = (InputType.InputTypeConvolutional) InputTypeUtil.getOutputTypeCnnLayers(inputType, kernel, stride, padding, dilation, ConvolutionMode.Truncate, dOut, -1, "layerName", ConvolutionLayer.class); assertEquals(2, it.getHeight()); assertEquals(2, it.getWidth()); assertEquals(dOut, it.getDepth()); outSize = ConvolutionUtils.getOutputSize(inData, kernel, stride, padding, ConvolutionMode.Truncate); assertEquals(2, outSize[0]); assertEquals(2, outSize[1]); //Same mode: ceil(in / stride) = 3 it = (InputType.InputTypeConvolutional) InputTypeUtil.getOutputTypeCnnLayers(inputType, kernel, stride, null, dilation, ConvolutionMode.Same, dOut, -1, "layerName", ConvolutionLayer.class); assertEquals(3, it.getHeight()); assertEquals(3, it.getWidth()); assertEquals(dOut, it.getDepth()); outSize = ConvolutionUtils.getOutputSize(inData, kernel, stride, null, ConvolutionMode.Same); assertEquals(3, outSize[0]); assertEquals(3, outSize[1]); //Test 2: input 3x4, stride 2, kernel 3 inH = 3; inW = 4; kH = 3; kW = 3; sH = 2; sW = 2; kernel = new int[] {kH, kW}; stride = new int[] {sH, sW}; padding = new int[] {pH, pW}; inData = Nd4j.create(minibatch, dIn, inH, inW); inputType = InputType.convolutional(inH, inW, dIn); //Strict mode: (4-3+0)/2+1 is not an integer -> exception try { InputTypeUtil.getOutputTypeCnnLayers(inputType, kernel, stride, padding, dilation, ConvolutionMode.Strict, dOut, -1, "layerName", ConvolutionLayer.class); fail("Expected exception"); } catch (DL4JException e) { System.out.println(e.getMessage()); } try { outSize = ConvolutionUtils.getOutputSize(inData, kernel, stride, padding, ConvolutionMode.Strict); fail("Exception expected"); } catch (DL4JException e) { System.out.println(e.getMessage()); } //Truncate: (3-3+0)/2+1 = 1 in height dim; (4-3+0)/2+1 = 1 in width dim it = (InputType.InputTypeConvolutional) InputTypeUtil.getOutputTypeCnnLayers(inputType, kernel, stride, padding, dilation, ConvolutionMode.Truncate, dOut, -1, "layerName", ConvolutionLayer.class); assertEquals(1, it.getHeight()); assertEquals(1, it.getWidth()); assertEquals(dOut, it.getDepth()); outSize = ConvolutionUtils.getOutputSize(inData, kernel, stride, padding, ConvolutionMode.Truncate); assertEquals(1, outSize[0]); assertEquals(1, outSize[1]); //Same mode: ceil(3/2) = 2 in height dim; ceil(4/2) = 2 in width dimension it = (InputType.InputTypeConvolutional) InputTypeUtil.getOutputTypeCnnLayers(inputType, kernel, stride, null, dilation, ConvolutionMode.Same, dOut, -1, "layerName", ConvolutionLayer.class); assertEquals(2, it.getHeight()); assertEquals(2, it.getWidth()); assertEquals(dOut, it.getDepth()); outSize = ConvolutionUtils.getOutputSize(inData, kernel, stride, null, ConvolutionMode.Same); assertEquals(2, outSize[0]); assertEquals(2, outSize[1]); } @Test public void testSameModeActivationSizes() { int inH = 3; int inW = 4; int inDepth = 3; int minibatch = 5; int sH = 2; int sW = 2; int kH = 3; int kW = 3; Layer[] l = new Layer[2]; l[0] = new ConvolutionLayer.Builder().nOut(4).kernelSize(kH, kW).stride(sH, sW).build(); l[1] = new SubsamplingLayer.Builder().kernelSize(kH, kW).stride(sH, sW).build(); for (int i = 0; i < l.length; i++) { MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder().convolutionMode(ConvolutionMode.Same) .list().layer(0, l[i]).layer(1, new OutputLayer.Builder().nOut(3).build()) .setInputType(InputType.convolutional(inH, inW, inDepth)).build(); MultiLayerNetwork net = new MultiLayerNetwork(conf); net.init(); INDArray inData = Nd4j.create(minibatch, inDepth, inH, inW); List<INDArray> activations = net.feedForward(inData); INDArray actL0 = activations.get(1); int outH = (int) Math.ceil(inH / ((double) sH)); int outW = (int) Math.ceil(inW / ((double) sW)); System.out.println(Arrays.toString(actL0.shape())); assertArrayEquals(new int[] {minibatch, (i == 0 ? 4 : inDepth), outH, outW}, actL0.shape()); } } }
3e02b3eb23efe2e4d882066c5943afa6786cc77e
807
java
Java
src/cn/cococode/cc150/TwoStacks.java
sxxlearn2rock/cc150
9e1cfdd9ca4473550aa2d87086fbf990fc97e1e0
[ "Apache-2.0" ]
null
null
null
src/cn/cococode/cc150/TwoStacks.java
sxxlearn2rock/cc150
9e1cfdd9ca4473550aa2d87086fbf990fc97e1e0
[ "Apache-2.0" ]
null
null
null
src/cn/cococode/cc150/TwoStacks.java
sxxlearn2rock/cc150
9e1cfdd9ca4473550aa2d87086fbf990fc97e1e0
[ "Apache-2.0" ]
null
null
null
18.340909
57
0.562577
1,110
package cn.cococode.cc150; import java.util.ArrayList; import java.util.Stack; public class TwoStacks { public ArrayList<Integer> twoStacksSort(int[] numbers) { if (numbers == null) { return null; } Stack<Integer> s1 = new Stack<>(); Stack<Integer> s2 = new Stack<>(); for (int i = numbers.length - 1; i >= 0; --i) { s1.push(numbers[i]); } for (int i = 0; i < numbers.length; ++i) { int val = s1.pop(); int count = 0; if (s2.isEmpty()) { s2.push(val); continue; } while (!s2.isEmpty() && val > s2.peek()){ s1.push(s2.pop()); ++count; } s2.push(val); while (count > 0){ s2.push(s1.pop()); --count; } } ArrayList<Integer> retArr = new ArrayList<>(); while (! s2.isEmpty()){ retArr.add(s2.pop()); } return retArr; } }
3e02b43d11515fd73102e447e3492ca4fbd92143
3,913
java
Java
src/com/archos/environment/ArchosSettings.java
novaplayer2020/aos-FileCoreLibrary
2b3529c72e4a9ce680af0b93448e5a0161d08234
[ "Apache-2.0" ]
8
2017-07-30T15:07:20.000Z
2018-09-02T03:45:44.000Z
src/com/archos/environment/ArchosSettings.java
novaplayer2020/aos-FileCoreLibrary
2b3529c72e4a9ce680af0b93448e5a0161d08234
[ "Apache-2.0" ]
1
2017-10-02T14:14:35.000Z
2018-01-24T14:19:29.000Z
src/com/archos/environment/ArchosSettings.java
novaplayer2020/aos-FileCoreLibrary
2b3529c72e4a9ce680af0b93448e5a0161d08234
[ "Apache-2.0" ]
11
2017-07-27T17:25:14.000Z
2019-06-28T05:10:57.000Z
31.055556
107
0.603629
1,111
// Copyright 2017 Archos SA // // 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 com.archos.environment; import android.content.Context; import android.provider.Settings; /** * The Settings provider contains global system-level device preferences. */ public final class ArchosSettings { /** * TV Overscan percent : 0..100 */ public static final String OVERSCAN = "overscan"; /** * Whether the device is in demo mode. * * nonzero = device in demo mode * 0 = device not in demo mode */ public static final String DEMO_MODE_ACTIVE = "demo_mode_active"; /** * Whether 3G key is on. */ public static final String KEY_3G_ON = "key_3g_on"; /** * Whether 3g stick sleep policy. */ public static final String KEY_3G_SLEEP_POLICY = "key_3g_sleep_policy"; /** * Whether 3g stick sleep policy timeout. */ public static final String KEY_3G_SLEEP_POLICY_TIMEOUT_MS = "key_3g_sleep_policy_timeout_ms"; /** * Whether we add telephony gsm feature or not. */ public static final String ALLOW_MOCK_TELEPHONY_GSM = "mock_telephony_gsm"; /** * Whether we add rear camera feature or not. */ public static final String ALLOW_MOCK_CAMERA_REAR = "mock_camera_rear"; /** * Whether we add gps feature or not. */ public static final String ALLOW_MOCK_GPS = "mock_gps"; /** * Whether we add compass feature or not. */ public static final String ALLOW_MOCK_COMPASS = "mock_compass"; /** * Whether deep sleep power management must be activated or not. */ public static final String DEEP_SLEEP_PM = "deep_sleep_pm"; /** * Whether to use static IP and other static network attributes. * <p> * Set to 1 for true and 0 for false. */ public static final String ETHERNET_USE_STATIC_IP = "ethernet_use_static_ip"; /** * The static IP address. * <p> * Example: "192.168.1.51" */ public static final String ETHERNET_STATIC_IP = "ethernet_static_ip"; /** * If using static IP, the gateway's IP address. * <p> * Example: "192.168.1.1" */ public static final String ETHERNET_STATIC_GATEWAY = "ethernet_static_gateway"; /** * If using static IP, the net mask. * <p> * Example: "255.255.255.0" */ public static final String ETHERNET_STATIC_NETMASK = "ethernet_static_netmask"; /** * If using static IP, the primary DNS's IP address. * <p> * Example: "192.168.1.1" */ public static final String ETHERNET_STATIC_DNS1 = "ethernet_static_dns1"; /** * If using static IP, the secondary DNS's IP address. * <p> * Example: "192.168.1.2" */ public static final String ETHERNET_STATIC_DNS2 = "ethernet_static_dns2"; public static boolean isDemoModeActive(Context context) { int demoModeActive = Settings.System.getInt(context.getContentResolver(), DEMO_MODE_ACTIVE, 0); return (demoModeActive == 1); } }
3e02b4712ab0a635f4dcfe1c533590726a876fc9
1,580
java
Java
src/wickhamsPlugin/event/WPlayerLoginEvent.java
WickhamWei/WickhamsPlugin
de3fe92fff7733a67bb55a760e9238644445e0db
[ "Apache-2.0" ]
4
2019-11-16T02:21:47.000Z
2021-04-11T05:57:25.000Z
src/wickhamsPlugin/event/WPlayerLoginEvent.java
WickhamWei/WickhamsPlugin
de3fe92fff7733a67bb55a760e9238644445e0db
[ "Apache-2.0" ]
1
2019-11-16T02:23:53.000Z
2019-11-19T10:09:40.000Z
src/wickhamsPlugin/event/WPlayerLoginEvent.java
WickhamWei/WickhamsPlugin
de3fe92fff7733a67bb55a760e9238644445e0db
[ "Apache-2.0" ]
null
null
null
23.235294
80
0.763291
1,112
package wickhamsPlugin.event; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; public class WPlayerLoginEvent extends Event { private final Player player; private boolean isCancelled; private String joinMsgString; private String loginSuccessMsgString; public WPlayerLoginEvent(Player player) { this.player = player; this.isCancelled = false; this.joinMsgString = ChatColor.GREEN + player.getName() + " 加入了游戏"; this.loginSuccessMsgString = ChatColor.GREEN + "登陆成功"; } public Player getPlayer() { return player; } public boolean isCancelled() { return this.isCancelled; } public void setCancelled(boolean isCancelled) { this.isCancelled = isCancelled; } public String getJoinMsg() { return joinMsgString; } public void setJoinMsg(String joinMsgString) { this.joinMsgString=joinMsgString; } public String getLoginSuccessMsg() { return loginSuccessMsgString; } public void setLoginSuccessMsg(String loginSuccessMsgString) { this.loginSuccessMsgString=loginSuccessMsgString; } // This seems like all you need to do at a first glance, but after running your // program you'll get error messages from Spigot. This is because, although not // heavily documented, you need to incorporate the following methods into your // Event class private static final HandlerList HANDLERS = new HandlerList(); public HandlerList getHandlers() { return HANDLERS; } public static HandlerList getHandlerList() { return HANDLERS; } // 以上为默认必须操作 }
3e02b56b46d8c0238d1ac5cd1b900f6a7d377315
2,784
java
Java
dcraft.hub/src/main/java/dcraft/hub/op/OperationObserver.java
Gadreel/dcserver
089ecd4c46dfcbfc8dac9bbaf308703db1b653cd
[ "Apache-2.0" ]
2
2019-04-03T16:08:20.000Z
2022-01-04T16:48:36.000Z
dcraft.hub/src/main/java/dcraft/hub/op/OperationObserver.java
Gadreel/dcserver
089ecd4c46dfcbfc8dac9bbaf308703db1b653cd
[ "Apache-2.0" ]
1
2019-11-28T14:52:57.000Z
2019-11-28T14:52:57.000Z
dcraft.hub/src/main/java/dcraft/hub/op/OperationObserver.java
Gadreel/dcserver
089ecd4c46dfcbfc8dac9bbaf308703db1b653cd
[ "Apache-2.0" ]
null
null
null
29.305263
101
0.652299
1,113
/* ************************************************************************ # # designCraft.io # # http://designcraft.io/ # # Copyright: # Copyright 2014 eTimeline, LLC. All rights reserved. # # License: # See the license.txt file in the project's top-level directory for details. # # Authors: # * Andy White # ************************************************************************ */ package dcraft.hub.op; import dcraft.struct.RecordStruct; import dcraft.task.TaskContext; // just toss out the events, useful only for subclassing // this is durable for use with Queue but remember only fields are saved in database // and you should implement deepCopy abstract public class OperationObserver extends RecordStruct implements IOperationObserver { @Override public void init(OperationContext target) { this.with("OperationId", target.getOpId()); if (target instanceof TaskContext) this.with("TaskId", ((TaskContext) target).getTask().getId()); } // fire is in the context that OO originated in, not in @Override public ObserverState fireEvent(OperationContext target, OperationEvent event, Object detail) { // be sure we restore the context OperationContext ctx = OperationContext.getOrNull(); try { if (event == OperationConstants.LOG) this.log(target, (RecordStruct) detail); else if (event == OperationConstants.PROGRESS) { if (target instanceof TaskContext) { TaskContext ttarget = (TaskContext) target; if (detail == OperationConstants.PROGRESS_AMOUNT) this.amount(target, ttarget.getAmountCompleted()); else if (detail == OperationConstants.PROGRESS_STEP) this.step(target, ttarget.getCurrentStep(), ttarget.getSteps(), ttarget.getCurrentStepName()); else this.progress(target, ttarget.getProgressMessage()); } } else if (event == OperationConstants.COMPLETED) this.completed(target); else if (event == OperationConstants.PREP_TASK) this.prep(target); else if (event == OperationConstants.START_TASK) this.start(target); else if (event == OperationConstants.STOP_TASK) this.stop(target); } finally { OperationContext.set(ctx); } return ObserverState.Continue; } public void log(OperationContext ctx, RecordStruct entry) { } public void step(OperationContext ctx, int num, int of, String name){ } public void progress(OperationContext ctx, String msg){ } public void amount(OperationContext ctx, int v){ } public void completed(OperationContext ctx) { } public void prep(OperationContext ctx) { } public void start(OperationContext ctx) { } public void stop(OperationContext ctx) { } }
3e02b688aa5215df760f690e698da01bd7f898b8
635
java
Java
repository/shapes/Java/Mixed/Shape.java
nkaretnikov/OOHaskell
ddf42cfa62f8bd27643ff6db136dec6c14466232
[ "MIT" ]
8
2017-01-31T10:34:08.000Z
2020-01-19T13:09:47.000Z
repository/shapes/Java/Mixed/Shape.java
nkaretnikov/OOHaskell
ddf42cfa62f8bd27643ff6db136dec6c14466232
[ "MIT" ]
null
null
null
repository/shapes/Java/Mixed/Shape.java
nkaretnikov/OOHaskell
ddf42cfa62f8bd27643ff6db136dec6c14466232
[ "MIT" ]
null
null
null
20.483871
48
0.576378
1,114
abstract class Shape { private int x; private int y; // constructor Shape(int newx, int newy) { moveTo(newx, newy); } // accessors for x & y int getX() { return x; } int getY() { return y; } void setX(int newx) { x = newx; } void setY(int newy) { y = newy; } // move the x & y position public void moveTo(int newx, int newy) { setX(newx); setY(newy); } public void rMoveTo(int deltax, int deltay) { moveTo(getX() + deltax, getY() + deltay); } } interface IShape { void moveTo(int newx, int newy); void rMoveTo(int deltax, int deltay); void draw(); }
3e02b80cdebbaacd4e826be214ca5174180e81fc
4,124
java
Java
app/src/main/java/com/xyoye/dandanplay/utils/JsonUtil.java
HarryHeights/DanDanPlayForAndroid
a25c397877591d2fd4af925f131c9e364adffba7
[ "MIT" ]
1
2020-06-28T03:54:59.000Z
2020-06-28T03:54:59.000Z
app/src/main/java/com/xyoye/dandanplay/utils/JsonUtil.java
HarryHeights/DanDanPlayForAndroid
a25c397877591d2fd4af925f131c9e364adffba7
[ "MIT" ]
null
null
null
app/src/main/java/com/xyoye/dandanplay/utils/JsonUtil.java
HarryHeights/DanDanPlayForAndroid
a25c397877591d2fd4af925f131c9e364adffba7
[ "MIT" ]
null
null
null
25.937107
81
0.536372
1,115
package com.xyoye.dandanplay.utils; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonParser; import org.json.JSONArray; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; /** * <p> * Description:GSON单例类,提供对象到JSON数据格式转换 * </p> * <p> * Copyright:Copyright (c) 2013 * </p> * * @author gujc */ public class JsonUtil { private static Gson gson = null; private JsonUtil() { } private static Gson gson() { if (gson == null) { synchronized (JsonUtil.class) { if (gson == null) { gson = new Gson(); } } } return gson; } /** * 目标对象到JSON数据格式转换 * * @param src 目标对象 */ public static String toJson(Object src) { return gson().toJson(src); } /** * JSON格式数据到目标对象转换 * * @param js JSON格式数据 * @param clazz 目标对象類型 * @return 目标对象 * @throws "JsonConvertException" */ public static <T> T fromJson(String js, Class<T> clazz) { return gson().fromJson(js, clazz); } public static <T> List<T> getObjectList(String jsonString, Class<T> cls){ List<T> list = new ArrayList<T>(); try { Gson gson = new Gson(); JsonArray arry = new JsonParser().parse(jsonString).getAsJsonArray(); for (JsonElement jsonElement : arry) { list.add(gson.fromJson(jsonElement, cls)); } } catch (Exception e) { e.printStackTrace(); } return list; } /** * Json 转成 Map<> * @param jsonStr * @return */ public static Map<String, Object> getMapForJson(String jsonStr){ JSONObject jsonObject ; try { jsonObject = new JSONObject(jsonStr); Iterator<String> keyIter= jsonObject.keys(); String key; Object value ; Map<String, Object> valueMap = new HashMap<String, Object>(); while (keyIter.hasNext()) { key = keyIter.next(); value = jsonObject.get(key); valueMap.put(key, value); } return valueMap; } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return null; } /** * Json 转成 List<Map<>> * @param jsonStr * @return */ public static List<Map<String, Object>> getlistForJson(String jsonStr){ List<Map<String, Object>> list = null; try { JSONArray jsonArray = new JSONArray(jsonStr); JSONObject jsonObj ; list = new ArrayList<Map<String,Object>>(); for(int i = 0 ; i < jsonArray.length() ; i ++){ jsonObj = (JSONObject)jsonArray.get(i); list.add(getMapForJson(jsonObj.toString())); } } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } return list; } public static <T> boolean isEmpty(List<T> sourceList) { return (sourceList == null || sourceList.size() == 0); } /** * 输入流转字符串 * @param is * @return */ public static String convertStreamToString(InputStream is) { BufferedReader reader = new BufferedReader(new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } return sb.toString(); } }
3e02b83379fe812715783177ccf0cb290f112b8c
15,399
java
Java
stack/core/src/main/java/org/apache/usergrid/mq/QueryProcessor.java
bernhardriegler/usergrid
79e37c9df0ee7debfb080b080cf4f6a5a03ebc46
[ "Apache-2.0" ]
788
2015-08-21T16:46:57.000Z
2022-03-16T01:57:44.000Z
stack/core/src/main/java/org/apache/usergrid/mq/QueryProcessor.java
bernhardriegler/usergrid
79e37c9df0ee7debfb080b080cf4f6a5a03ebc46
[ "Apache-2.0" ]
101
2015-08-23T04:58:13.000Z
2019-11-13T07:02:57.000Z
stack/core/src/main/java/org/apache/usergrid/mq/QueryProcessor.java
bernhardriegler/usergrid
79e37c9df0ee7debfb080b080cf4f6a5a03ebc46
[ "Apache-2.0" ]
342
2015-08-22T06:14:20.000Z
2022-03-15T01:20:39.000Z
28.837079
118
0.483733
1,116
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.usergrid.mq; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.commons.collections.comparators.ComparatorChain; import org.apache.usergrid.mq.Query.FilterOperator; import org.apache.usergrid.mq.Query.FilterPredicate; import org.apache.usergrid.mq.Query.SortPredicate; import org.apache.usergrid.persistence.Entity; import org.apache.usergrid.utils.NumberUtils; import static org.apache.usergrid.mq.Query.SortDirection.DESCENDING; public class QueryProcessor { private static final Logger logger = LoggerFactory.getLogger( QueryProcessor.class ); Query query; String cursor; List<QuerySlice> slices; List<FilterPredicate> filters; List<SortPredicate> sorts; public QueryProcessor( Query query ) { this.query = query; cursor = query.getCursor(); filters = query.getFilterPredicates(); sorts = query.getSortPredicates(); process(); } public Query getQuery() { return query; } public String getCursor() { return cursor; } public List<QuerySlice> getSlices() { return slices; } public List<FilterPredicate> getFilters() { return filters; } public List<SortPredicate> getSorts() { return sorts; } private void process() { slices = new ArrayList<QuerySlice>(); throw new UnsupportedOperationException( "query not supported" ); // // consolidate all the filters into a set of ranges // Set<String> names = getFilterPropertyNames(); // for ( String name : names ) { // FilterOperator operator = null; // Object value = null; // RangeValue start = null; // RangeValue finish = null; // for ( FilterPredicate f : filters ) { // if ( f.getPropertyName().equals( name ) ) { // operator = f.getOperator(); // value = f.getValue(); // RangePair r = getRangeForFilter( f ); // if ( r.start != null ) { // if ( ( start == null ) || ( r.start.compareTo( start, false ) < 0 ) ) { // start = r.start; // } // } // if ( r.finish != null ) { // if ( ( finish == null ) || ( r.finish.compareTo( finish, true ) > 0 ) ) { // finish = r.finish; // } // } // } // } // slices.add( new QuerySlice( name, operator, value, start, finish, null, false ) ); // } // // // process sorts // if ( ( slices.size() == 0 ) && ( sorts.size() > 0 ) ) { // // if no filters, turn first filter into a sort // SortPredicate sort = ListUtils.dequeue( sorts ); // slices.add( new QuerySlice( sort.getPropertyName(), null, null, null, null, null, // sort.getDirection() == DESCENDING ) ); // } // else if ( sorts.size() > 0 ) { // // match up sorts with existing filters // for ( ListIterator<SortPredicate> iter = sorts.listIterator(); iter.hasNext(); ) { // SortPredicate sort = iter.next(); // QuerySlice slice = getSliceForProperty( sort.getPropertyName() ); // if ( slice != null ) { // slice.reversed = sort.getDirection() == DESCENDING; // iter.remove(); // } // } // } // // // attach cursors to slices // if ( ( cursor != null ) && ( cursor.indexOf( ':' ) >= 0 ) ) { // String[] cursors = split( cursor, '|' ); // for ( String c : cursors ) { // String[] parts = split( c, ':' ); // if ( parts.length == 2 ) { // int cursorHashCode = parseInt( parts[0] ); // for ( QuerySlice slice : slices ) { // int sliceHashCode = slice.hashCode(); // logger.info( "Comparing cursor hashcode " + cursorHashCode + " to " + sliceHashCode ); // if ( sliceHashCode == cursorHashCode ) { // if ( isNotBlank( parts[1] ) ) { // ByteBuffer cursorBytes = ByteBuffer.wrap( decodeBase64( parts[1] ) ); // slice.setCursor( cursorBytes ); // } // } // } // } // } // } } @SuppressWarnings("unchecked") public List<Entity> sort( List<Entity> entities ) { throw new UnsupportedOperationException( "Unsupported" ); // // if ( ( entities != null ) && ( sorts.size() > 0 ) ) { // // Performing in memory sort // logger.info( "Performing in-memory sort of {} entities", entities.size() ); // ComparatorChain chain = new ComparatorChain(); // for ( SortPredicate sort : sorts ) { // chain.addComparator( // new EntityPropertyComparator( sort.getPropertyName(), sort.getDirection() == DESCENDING ) ); // } // Collections.sort( entities, chain ); // } // return entities; } private Set<String> getFilterPropertyNames() { Set<String> names = new LinkedHashSet<String>(); for ( FilterPredicate f : filters ) { names.add( f.getPropertyName() ); } return names; } public QuerySlice getSliceForProperty( String name ) { for ( QuerySlice s : slices ) { if ( s.propertyName.equals( name ) ) { return s; } } return null; } public static class RangeValue { byte code; Object value; boolean inclusive; public RangeValue( byte code, Object value, boolean inclusive ) { this.code = code; this.value = value; this.inclusive = inclusive; } public byte getCode() { return code; } public void setCode( byte code ) { this.code = code; } public Object getValue() { return value; } public void setValue( Object value ) { this.value = value; } public boolean isInclusive() { return inclusive; } public void setInclusive( boolean inclusive ) { this.inclusive = inclusive; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + code; result = prime * result + ( inclusive ? 1231 : 1237 ); result = prime * result + ( ( value == null ) ? 0 : value.hashCode() ); return result; } @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } RangeValue other = ( RangeValue ) obj; if ( code != other.code ) { return false; } if ( inclusive != other.inclusive ) { return false; } if ( value == null ) { if ( other.value != null ) { return false; } } else if ( !value.equals( other.value ) ) { return false; } return true; } public int compareTo( RangeValue other, boolean finish ) { if ( other == null ) { return 1; } if ( code != other.code ) { return NumberUtils.sign( code - other.code ); } @SuppressWarnings({ "unchecked", "rawtypes" }) int c = ( ( Comparable ) value ).compareTo( other.value ); if ( c != 0 ) { return c; } if ( finish ) { // for finish values, inclusive means <= which is greater than < if ( inclusive != other.inclusive ) { return inclusive ? 1 : -1; } } else { // for start values, inclusive means >= which is lest than > if ( inclusive != other.inclusive ) { return inclusive ? -1 : 1; } } return 0; } public static int compare( RangeValue v1, RangeValue v2, boolean finish ) { if ( v1 == null ) { if ( v2 == null ) { return 0; } return -1; } return v1.compareTo( v2, finish ); } } public static class RangePair { RangeValue start; RangeValue finish; public RangePair( RangeValue start, RangeValue finish ) { this.start = start; this.finish = finish; } public RangeValue getStart() { return start; } public void setStart( RangeValue start ) { this.start = start; } public RangeValue getFinish() { return finish; } public void setFinish( RangeValue finish ) { this.finish = finish; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( ( finish == null ) ? 0 : finish.hashCode() ); result = prime * result + ( ( start == null ) ? 0 : start.hashCode() ); return result; } @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } RangePair other = ( RangePair ) obj; if ( finish == null ) { if ( other.finish != null ) { return false; } } else if ( !finish.equals( other.finish ) ) { return false; } if ( start == null ) { if ( other.start != null ) { return false; } } else if ( !start.equals( other.start ) ) { return false; } return true; } } public static class QuerySlice { String propertyName; FilterOperator operator; Object value; RangeValue start; RangeValue finish; ByteBuffer cursor; boolean reversed; QuerySlice( String propertyName, FilterOperator operator, Object value, RangeValue start, RangeValue finish, ByteBuffer cursor, boolean reversed ) { this.propertyName = propertyName; this.operator = operator; this.value = value; this.start = start; this.finish = finish; this.cursor = cursor; this.reversed = reversed; } public String getPropertyName() { return propertyName; } public void setPropertyName( String propertyName ) { this.propertyName = propertyName; } public RangeValue getStart() { return start; } public void setStart( RangeValue start ) { this.start = start; } public RangeValue getFinish() { return finish; } public void setFinish( RangeValue finish ) { this.finish = finish; } public Object getValue() { return value; } public void setValue( Object value ) { this.value = value; } public ByteBuffer getCursor() { return cursor; } public void setCursor( ByteBuffer cursor ) { this.cursor = cursor; } public boolean isReversed() { return reversed; } public void setReversed( boolean reversed ) { this.reversed = reversed; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ( ( finish == null ) ? 0 : finish.hashCode() ); result = prime * result + ( ( propertyName == null ) ? 0 : propertyName.hashCode() ); result = prime * result + ( ( start == null ) ? 0 : start.hashCode() ); //NOTE. We have explicitly left out direction. According to IndexTest:testCollectionOrdering, // a cursor can be used and change direction //of the ordering. return result; } @Override public boolean equals( Object obj ) { if ( this == obj ) { return true; } if ( obj == null ) { return false; } if ( getClass() != obj.getClass() ) { return false; } QuerySlice other = ( QuerySlice ) obj; if ( finish == null ) { if ( other.finish != null ) { return false; } } else if ( !finish.equals( other.finish ) ) { return false; } if ( propertyName == null ) { if ( other.propertyName != null ) { return false; } } else if ( !propertyName.equals( other.propertyName ) ) { return false; } if ( start == null ) { if ( other.start != null ) { return false; } } else if ( !start.equals( other.start ) ) { return false; } return true; } } }
3e02b88f1a32427c47dda1c4b72cb8c64d9df4a5
418
java
Java
agency/src/main/java/com/tengda/agency/Vendor.java
Aicibg/MyTestDemo
8d9e8d09c73d87726c322140e095313e0630157b
[ "Apache-2.0" ]
null
null
null
agency/src/main/java/com/tengda/agency/Vendor.java
Aicibg/MyTestDemo
8d9e8d09c73d87726c322140e095313e0630157b
[ "Apache-2.0" ]
null
null
null
agency/src/main/java/com/tengda/agency/Vendor.java
Aicibg/MyTestDemo
8d9e8d09c73d87726c322140e095313e0630157b
[ "Apache-2.0" ]
null
null
null
18.173913
45
0.590909
1,117
package com.tengda.agency; import android.util.Log; /** * Created by DongHao on 2016/12/14. * Description: */ public class Vendor implements Sell { @Override public void sell() { System.out.println("In sell method"); Log.e("test:","In sell method"); } @Override public void add() { System.out.println("In add method"); Log.e("test:","In add method"); } }
3e02b8ab0d2396487cc4f64e6d06826edd407507
17,609
java
Java
odcleanstore/engine/src/main/java/cz/cuni/mff/odcleanstore/engine/db/model/SQL.java
ODCleanStore/ODCleanStore
3a68c345c5b67349447add8d61d97ae59edd8d7d
[ "Apache-2.0" ]
4
2015-11-16T10:30:21.000Z
2021-04-16T16:16:36.000Z
odcleanstore/engine/src/main/java/cz/cuni/mff/odcleanstore/engine/db/model/SQL.java
ODCleanStore/ODCleanStore
3a68c345c5b67349447add8d61d97ae59edd8d7d
[ "Apache-2.0" ]
null
null
null
odcleanstore/engine/src/main/java/cz/cuni/mff/odcleanstore/engine/db/model/SQL.java
ODCleanStore/ODCleanStore
3a68c345c5b67349447add8d61d97ae59edd8d7d
[ "Apache-2.0" ]
null
null
null
41.727488
128
0.587029
1,118
package cz.cuni.mff.odcleanstore.engine.db.model; import cz.cuni.mff.odcleanstore.datanormalization.impl.DataNormalizerImpl; import cz.cuni.mff.odcleanstore.linker.impl.LinkerImpl; import cz.cuni.mff.odcleanstore.model.EnumGraphState; import cz.cuni.mff.odcleanstore.qualityassessment.impl.QualityAssessorImpl; import cz.cuni.mff.odcleanstore.vocabulary.ODCS; import java.util.Locale; /** * Class containing Engine queries to the relational database. * @see DbOdcsContextTransactional * @author Petr Jerman */ /*package*/final class SQL { private SQL() { throw new AssertionError(); } /** * Set odcs DB prefix. */ static final String USE_ODCS_SCHEMA = "USE DB"; // -----------------------------------------------------------------------------------------------// /** * Select attached engine id for uuid. * @param first engine uuid */ static final String SELECT_ATTACHED_ENGINE_ID = " SELECT TOP 1 ae.id" + " FROM ODCLEANSTORE.EN_ATTACHED_ENGINES ae" + " WHERE ae.uuid = ?"; static final String ERROR_SELECT_ATTACHED_ENGINE_ID = "Error during selecting engine id"; /** * Select all importing graph uuids for given engine uuid. * @param first Engine uuid */ static final String SELECT_ALL_IMPORTING_GRAPH = String.format(Locale.ROOT, " SELECT ig.uuid" + " FROM ODCLEANSTORE.EN_INPUT_GRAPHS ig" + " LEFT JOIN ODCLEANSTORE.EN_ATTACHED_ENGINES ae ON ig.engineId = ae.id" + " WHERE ae.uuid = ? AND ig.stateId = %s", EnumGraphState.IMPORTING.toId()); static final String ERROR_SELECT_ALL_IMPORTING_GRAPH = "Error during selecting all importing graph"; /** * Select graph id for uuid. * @param first graph uuid */ static final String SELECT_GRAPH_ID = " SELECT TOP 1 ig.id" + " FROM ODCLEANSTORE.EN_INPUT_GRAPHS ig" + " WHERE ig.uuid = ?"; static final String ERROR_SELECT_GRAPH_ID = "Error during selecting graph id"; /** * Insert importing graph. * @param first graph uuid * @param second graph prefix * @param third pipelineId * @param forth engineId */ static final String INSERT_IMPORTING_GRAPH = String.format(Locale.ROOT, " INSERT" + " INTO ODCLEANSTORE.EN_INPUT_GRAPHS(uuid, namedGraphsPrefix, stateId, pipelineId, engineId)" + " VALUES(?,?,%s,?,?)", EnumGraphState.IMPORTING.toId()); static final String ERROR_INSERT_IMPORTING_GRAPH = "Error during inserting importing graph"; /** * Delete importing graph from input graphs table. * @param first graph uuid */ static final String DELETE_IMPORTING_GRAPH = String.format(Locale.ROOT, " DELETE" + " FROM ODCLEANSTORE.EN_INPUT_GRAPHS" + " WHERE uuid = ? AND stateId = %s", EnumGraphState.IMPORTING.toId()); static final String ERROR_DELETE_GRAPH = "Error during deleting importing graph"; /** * Update importing graph state for given graph uuid to queued. * @param first graph uuid */ static final String UPDATE_IMPORTING_GRAPH_STATE_TO_QUEUED = String.format(Locale.ROOT, " UPDATE ODCLEANSTORE.EN_INPUT_GRAPHS" + " SET stateId = %s" + " WHERE uuid = ? AND stateId = %s", EnumGraphState.QUEUED.toId(), EnumGraphState.IMPORTING.toId()); static final String ERROR_UPDATE_IMPORTING_GRAPH_STATE_TO_QUEUED = "Error during update state of importing graph to queued"; // -----------------------------------------------------------------------------------------------// /** * Select oldest working graph for given engine uuid. * @param first Engine uuid */ static final String SELECT_WORKING_GRAPH = String.format(Locale.ROOT, " SELECT TOP 1 ig.id, ig.uuid, ig.stateId, ig.pipelineId, pi.label, ig.isInCleanDB," + " ae.uuid, ig.resetPipelineRequest, pi.authorId, ig.namedGraphsPrefix" + " FROM ODCLEANSTORE.EN_INPUT_GRAPHS ig" + " LEFT JOIN ODCLEANSTORE.EN_ATTACHED_ENGINES ae ON ig.engineId = ae.id" + " LEFT JOIN ODCLEANSTORE.PIPELINES pi ON ig.pipelineId = pi.id" + " WHERE (ae.uuid = ? OR ae.uuid IS NULL) AND ig.stateId IN (%s,%s,%s,%s,%s, %s, %s)" + " ORDER BY ig.stateId, ig.updated", EnumGraphState.DIRTY.toId(), EnumGraphState.PROPAGATED.toId(), EnumGraphState.DELETING.toId(), EnumGraphState.PROCESSING.toId(), EnumGraphState.PROCESSED.toId(), EnumGraphState.OLDGRAPHSPREFIXED.toId(), EnumGraphState.NEWGRAPHSPREPARED.toId()); static final String ERROR_SELECT_WORKING_GRAPH = "Error during selecting working graph"; /** * Select oldest queued graph for given engine uuid. * @param first Engine uuid */ static final String SELECT_QUEUD_GRAPH = String.format(Locale.ROOT, " SELECT TOP 1 ig.id, ig.uuid, ig.stateId, ig.pipelineId, pi.label, ig.isInCleanDB," + " ae.uuid, ig.resetPipelineRequest, pi.authorId, ig.namedGraphsPrefix" + " FROM ODCLEANSTORE.EN_INPUT_GRAPHS ig" + " LEFT JOIN ODCLEANSTORE.EN_ATTACHED_ENGINES ae ON ig.engineId = ae.id" + " LEFT JOIN ODCLEANSTORE.PIPELINES pi ON ig.pipelineId = pi.id" + " WHERE (ae.uuid = ? OR ae.uuid IS NULL) AND ig.stateId IN (%s,%s,%s)" + " AND (pi.isLocked = 0 OR pi.isLocked IS NULL)" + " ORDER BY ig.stateId, ig.updated", EnumGraphState.QUEUED_FOR_DELETE.toId(), EnumGraphState.QUEUED_URGENT.toId(), EnumGraphState.QUEUED.toId()); static final String ERROR_SELECT_QUEUD_GRAPH = "Error during selecting queued graph"; // -----------------------------------------------------------------------------------------------// /** * Update attached engine id for given graphId. * @param first Engine uuid * @param second graphId * @param third Engine uuid */ static final String UPDATE_ATTACHED_ENGINE = String.format(Locale.ROOT, " UPDATE ODCLEANSTORE.EN_INPUT_GRAPHS" + " SET engineId = (SELECT id FROM ODCLEANSTORE.EN_ATTACHED_ENGINES WHERE uuid = ?)" + " WHERE id = ?" + " AND EXISTS (SELECT * FROM ODCLEANSTORE.EN_ATTACHED_ENGINES WHERE uuid = ?)"); static final String ERROR_UPDATE_ATTACHED_ENGINE = "Error during updating attached engine"; /** * Update attached engine state. * @param first stateDescription * @param second Engine uuid */ static final String UPDATE_ENGINE_STATE = " UPDATE ODCLEANSTORE.EN_ATTACHED_ENGINES" + " SET stateDescription = ?" + " WHERE uuid = ?"; static final String ERROR_UPDATE_ENGINE_STATE = "Error during updating engine state"; /** * Update graph stateId for given graphId. * @param first stateId * @param second graphId */ static final String UPDATE_GRAPH_STATE = String.format(Locale.ROOT, " UPDATE ODCLEANSTORE.EN_INPUT_GRAPHS" + " SET stateId = ?" + " WHERE id = ?"); static final String ERROR_UPDATE_GRAPH_STATE = "Error during updating graph state"; /** * Update graph stateId and isCleanDb for given graphId. * @param first stateId * @param second isInCleanDb * @param third graphId */ static final String UPDATE_GRAPH_STATE_AND_ISINCLEANDB = String.format(Locale.ROOT, " UPDATE ODCLEANSTORE.EN_INPUT_GRAPHS" + " SET stateId = ?, isInCleanDb = ?" + " WHERE id = ?"); static final String ERROR_UPDATE_GRAPH_STATE_AND_ISINCLEANDB = "Error during updating graph state"; /** * Select graph resetPipelineRequest and lock flags for pipeline for given graphId. * @param first graphId */ static final String SELECT_GRAPH_RESETPIPELINEREQUEST = " SELECT TOP 1 ig.resetPipelineRequest, pi.isLocked" + " FROM ODCLEANSTORE.EN_INPUT_GRAPHS ig" + " LEFT JOIN ODCLEANSTORE.PIPELINES pi ON ig.pipelineId = pi.id" + " WHERE ig.id = ?"; static final String ERROR_GRAPH_RESETPIPELINEREQUEST = "Error during selecting graph resetPipelineRequest"; /** * Clear graph resetPipelineRequest. * @param first graphId */ static final String CLEAR_GRAPH_RESETPIPELINEREQUEST = " UPDATE ODCLEANSTORE.EN_INPUT_GRAPHS" + " SET resetPipelineRequest = 0" + " WHERE id = ?"; static final String ERROR_CLEAR_GRAPH_RESETPIPELINEREQUEST = "Error during clearing graph resetPipelineRequest"; // -----------------------------------------------------------------------------------------------// /** * Select all attached graph names for given graphId. * @param first graphId */ static final String SELECT_ATTACHED_GRAPHS = String.format(Locale.ROOT, " SELECT name" + " FROM ODCLEANSTORE.EN_WORKING_ADDED_GRAPHS" + " WHERE graphId = ?"); static final String ERROR_SELECT_ATTACHED_GRAPHS = "Error during selecting attached graphs"; /** * Insert name of attached graph to given graphId. * @param first graphId * @param second graph name */ static final String INSERT_ATTACHED_GRAPH = String.format(Locale.ROOT, " INSERT" + " INTO ODCLEANSTORE.EN_WORKING_ADDED_GRAPHS(graphId, name)" + " VALUES(?,?)"); static final String ERROR_INSERT_ATTACHED_GRAPH = "Error during inserting attached graph"; /** * Insert name of attached graph to given graphId. * @param first graphId * @param second graph name */ static final String INSERT_ATTACHED_GRAPH_LINK = "SPARQL INSERT INTO <%1$s> { <%2$s> <" + ODCS.ATTACHED_GRAPH + "> <%3$s>}"; static final String ERROR_INSERT_ATTACHED_GRAPH_LINK = "Error during inserting odcs:attachedGraph link"; /** * Delete all attached graphs for given graphId. * @param first graphId */ static final String DELETE_ATTACHED_GRAPHS = String.format(Locale.ROOT, " DELETE" + " FROM ODCLEANSTORE.EN_WORKING_ADDED_GRAPHS" + " WHERE graphId = ?"); static final String ERROR_DELETE_ATTACHED_GRAPHS = "Error during deleting attached graphs"; // -----------------------------------------------------------------------------------------------// /** * Select pipelineId for pipeline label. * @param first pipeline label */ static final String SELECT_PIPELINE_ID = " SELECT TOP 1 id" + " FROM ODCLEANSTORE.PIPELINES" + " WHERE label = ?"; static final String ERROR_SELECT_PIPELINE_ID = "Error during selecting pipeline id"; /** * Select default pipelineId. */ static final String SELECT_DEFAULT_PIPELINE = " SELECT TOP 1 id, label" + " FROM ODCLEANSTORE.PIPELINES" + " WHERE isDefault <> 0"; static final String ERROR_SELECT_DEFAULT_PIPELINE = "Error during selecting default pipeline"; /** * Select pipeline commands for given pipelineId. * @param first pipelineId */ static final String SELECT_PIPELINE_COMMANDS = " SELECT t.jarPath, t.fullClassName, t.workDirPath, ti.configuration, ti.runOnCleanDB, ti.id, t.label, t.id" + " FROM ODCLEANSTORE.TRANSFORMERS t" + " JOIN ODCLEANSTORE.TRANSFORMER_INSTANCES ti ON t.id = ti.transformerId" + " AND ti.pipelineId = ?" + " ORDER BY ti.priority"; static final String ERROR_SELECT_PIPELINE_COMMANDS = "Error during selecting pipeline commands"; // -----------------------------------------------------------------------------------------------// /** * Select qa groups for given pipelineId. * @param first pipelineId */ static final String SELECT_QA_GROUPS = String.format(Locale.ROOT, " SELECT qa.transformerInstanceId, qa.groupId" + " FROM ODCLEANSTORE.QA_RULES_ASSIGNMENT qa" + " JOIN DB.ODCLEANSTORE.TRANSFORMER_INSTANCES ti ON qa.transformerInstanceId = ti.id" + " JOIN DB.ODCLEANSTORE.TRANSFORMERS t ON ti.transformerId = t.id" + " WHERE ti.pipelineId= ? AND t.fullClassName = '%s'" + " ORDER BY qa.transformerInstanceId, qa.groupId", QualityAssessorImpl.class.getCanonicalName()); static final String ERROR_SELECT_QA_GROUPS = "Error during selecting qa groups"; /** * Select dn groups for given pipelineId. * @param first pipelineId */ static final String SELECT_DN_GROUPS = String.format(Locale.ROOT, " SELECT dn.transformerInstanceId, dn.groupId" + " FROM ODCLEANSTORE.DN_RULES_ASSIGNMENT dn" + " JOIN DB.ODCLEANSTORE.TRANSFORMER_INSTANCES ti ON dn.transformerInstanceId = ti.id" + " JOIN DB.ODCLEANSTORE.TRANSFORMERS t ON ti.transformerId = t.id" + " WHERE ti.pipelineId= ? AND t.fullClassName = '%s'" + " ORDER BY dn.transformerInstanceId, dn.groupId", DataNormalizerImpl.class.getCanonicalName()); static final String ERROR_SELECT_DN_GROUPS = "Error during selecting dn groups"; /** * Select oi groups for given pipelineId. * @param first pipelineId */ static final String SELECT_OI_GROUPS = String.format(Locale.ROOT, " SELECT oi.transformerInstanceId, oi.groupId" + " FROM ODCLEANSTORE.OI_RULES_ASSIGNMENT oi" + " JOIN DB.ODCLEANSTORE.TRANSFORMER_INSTANCES ti ON oi.transformerInstanceId = ti.id" + " JOIN DB.ODCLEANSTORE.TRANSFORMERS t ON ti.transformerId = t.id" + " WHERE ti.pipelineId= ? AND t.fullClassName = '%s'" + " ORDER BY oi.transformerInstanceId, oi.groupId", LinkerImpl.class.getCanonicalName()); static final String ERROR_SELECT_OI_GROUPS = "Error during selecting oi groups"; // -----------------------------------------------------------------------------------------------// /** * Select errorMesage from pipeline error table from given graphId. * @param first graphId */ static final String SELECT_GRAPH_IN_ERROR = " SELECT errorMessage" + " FROM ODCLEANSTORE.EN_GRAPHS_IN_ERROR" + " WHERE graphId = ?"; static final String ERROR_SELECT_GRAPH_IN_ERROR = "Error during selecting errorMessage from graphs in error"; /** * Insert graph into pipeline error table. * @param first graphId * @param second errorTypeId * @param third errorMessage */ static final String INSERT_GRAPH_IN_ERROR = " INSERT" + " INTO ODCLEANSTORE.EN_GRAPHS_IN_ERROR(graphId, errorTypeId, errorMessage)" + " VALUES(?,?,?)"; static final String ERROR_INSERT_GRAPH_IN_ERROR = "Error during inserting graph in graphs in error"; /** * Delete graph from pipeline error table. * @param first graphId */ static final String DELETE_GRAPH_IN_ERROR = " DELETE" + " FROM ODCLEANSTORE.EN_GRAPHS_IN_ERROR" + " WHERE graphId = ?"; static final String ERROR_DELETE_GRAPH_IN_ERROR = "Error during deleting graph in error"; /** * Insert pipeline result. * @param first graphId * @param second pipelineId * @param third pipelineAuthorId * @param forth isExistingGraph * @param fifth isSuccess * @param sixth errorMessage * @param seventh created */ static final String INSERT_EN_PIPELINE_RESULTS = " INSERT" + " INTO ODCLEANSTORE.EN_PIPELINE_RESULTS(graphId, pipelineId, pipelineAuthorId," + " isExistingGraph, isSuccess, errorMessage, created)" + " VALUES(?,?,?,?,?,?,?)"; static final String ERROR_INSERT_EN_PIPELINE_RESULTS = "Error during inserting pipeline result"; // -----------------------------------------------------------------------------------------------// /** * Select scraper credentials from users table for given userName. * @param first userName */ static final String SELECT_SCRAPER = " SELECT u.passwordHash, u.salt" + " FROM DB.ODCLEANSTORE.USERS u" + " JOIN DB.ODCLEANSTORE.ROLES_ASSIGNED_TO_USERS ratu ON ratu.userId = u.id" + " JOIN DB.ODCLEANSTORE.ROLES r ON r.id = ratu.roleId" + " WHERE u.userName = ? AND r.label = 'SCR'"; static final String ERROR_SELECT_SCRAPER = "Error during selecting scraper credentials from users table"; }
3e02b91b03d9ad461046da1e4ef6e2bd68743a36
19,542
java
Java
biojava/src/org/biojavax/bio/seq/RichLocation.java
rbouadjenek/DQBioinformatics
088c0e93754257592e3a0725897566af3823a92d
[ "Apache-2.0" ]
null
null
null
biojava/src/org/biojavax/bio/seq/RichLocation.java
rbouadjenek/DQBioinformatics
088c0e93754257592e3a0725897566af3823a92d
[ "Apache-2.0" ]
null
null
null
biojava/src/org/biojavax/bio/seq/RichLocation.java
rbouadjenek/DQBioinformatics
088c0e93754257592e3a0725897566af3823a92d
[ "Apache-2.0" ]
null
null
null
30.204019
79
0.658121
1,119
/* * BioJava development code * * This code may be freely distributed and modified under the * terms of the GNU Lesser General Public Licence. This should * be distributed with the code. If you do not have a copy, * see: * * http://www.gnu.org/copyleft/lesser.html * * Copyright for this code is held jointly by the individual * authors. These should be listed in @author doc comments. * * For more information on the BioJava project and its aims, * or to join the biojava-l mailing list, visit the home page * at: * * http://www.biojava.org/ * */ package org.biojavax.bio.seq; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import org.biojava.bio.symbol.FuzzyLocation; import org.biojava.bio.symbol.FuzzyPointLocation; import org.biojava.bio.symbol.Location; import org.biojava.bio.symbol.MergeLocation; import org.biojava.bio.symbol.PointLocation; import org.biojava.bio.symbol.RangeLocation; import org.biojava.utils.ChangeType; import org.biojava.utils.ChangeVetoException; import org.biojavax.CrossRef; import org.biojavax.CrossReferenceResolver; import org.biojavax.RichAnnotatable; import org.biojavax.ontology.ComparableTerm; /** * Describes locations, and adds the concepts of circularity, fuzziness, * annotations, and cross-references to other databases. Also includes strands. * * @author Richard Holland * @since 1.5 */ public interface RichLocation extends Location, RichAnnotatable, Comparable { public static final ChangeType NOTE = new ChangeType( "This location's notes have changed", "org.biojavax.bio.seq.RichLocation", "NOTE"); public static final ChangeType TERM = new ChangeType( "This location's term has changed", "org.biojavax.bio.seq.RichLocation", "TERM"); public static final ChangeType RANK = new ChangeType( "This location's rank has changed", "org.biojavax.bio.seq.RichLocation", "RANK"); public static final ChangeType CIRCULAR = new ChangeType( "This location's circularity has changed", "org.biojavax.bio.seq.RichLocation", "CIRCULAR"); public static final ChangeType FEATURE = new ChangeType( "This location's parent feature has changed", "org.biojavax.bio.seq.RichLocation", "FEATURE"); /** * The empty location matches nothing. */ public static final RichLocation EMPTY_LOCATION = new EmptyRichLocation(); /** * Sorts the member locations of a compound location. Does nothing for * non-compound locations. Sorting depends on the compareTo() method of the * member locations - usually they will be sorted by their start position. * This might be useful when used with the location returned by a union or * intersection, or when setting the term of a compound location to * ORDER_TERM. */ public void sort(); /** * Retrieves the feature this location is associated with. May be null. * * @return the feature. */ public RichFeature getFeature(); /** * Sets the feature this location is associated with. If null, that's fine, * but you won't be able to persist it to the database until you give it a * not-null value. * * @param feature * the feature. */ public void setFeature(RichFeature feature) throws ChangeVetoException; /** * Retrieves the crossref associated with this location. * * @return the crossref. */ public CrossRef getCrossRef(); /** * Retrieves the term associated with this location. * * @return the term. */ public ComparableTerm getTerm(); /** * Sets the term for this location. * * @param term * the term this location should adopt. * @throws ChangeVetoException * in case of error. */ public void setTerm(ComparableTerm term) throws ChangeVetoException; /** * Retrieves the strand associated with this location. * * @return the strand. */ public Strand getStrand(); /** * Retrieves the rank associated with this location. * * @return the rank. */ public int getRank(); /** * Sets the rank for this location. * * @param rank * the rank this location should adopt. * @throws ChangeVetoException * in case of error. */ public void setRank(int rank) throws ChangeVetoException; /** * Retrieves the start position of this location. * * @return the position. */ public Position getMinPosition(); /** * Retrieves the end position of this location. * * @return the position. */ public Position getMaxPosition(); /** * Sets the resolver to use when working out actual base coordinates from * fuzzy positions. * * @param p * the position resolver to use. */ public void setPositionResolver(PositionResolver p); /** * Retrieves the circular length of this location. If it is 0, the location * is not circular. If it is not zero, then the number refers to the * wrapping length of the location. eg. 100 would signify that a position of * 112 would actually be a position of 112-100 = 12. * * @return the position. */ public int getCircularLength(); /** * Sets the circular length of this location. If it is 0, the location is * not circular. If it is not zero, then the number refers to the wrapping * length of the location. eg. 100 would signify that a position of 112 * would actually be a position of 112-100 = 12. * * @param sourceSeqLength * the circular length of this location * @throws ChangeVetoException * if it doesn't want to change. */ public void setCircularLength(int sourceSeqLength) throws ChangeVetoException; /** * Sets the cross ref resolver to use when retrieving remote symbols. If * none is given, then the default from * RichObjectFactory.getDefaultCrossRefResolver() is used. * * @param r * the resolver to use. */ public void setCrossRefResolver(CrossReferenceResolver r); /** * This class represents a strand on which a location may lie. Three strands * are defined by default - UNKNOWN, NEGATIVE, and POSITIVE. */ public static class Strand implements Comparable { private String name; private int value; /** * The positive strand is represented by the symbol '+' and has the * number 1. */ public static final Strand POSITIVE_STRAND = new Strand("+", 1); /** * The negative strand is represented by the symbol '-' and has the * number -1. */ public static final Strand NEGATIVE_STRAND = new Strand("-", -1); /** * The unknown strand is represented by the symbol '?' and has the * number 0. */ public static final Strand UNKNOWN_STRAND = new Strand("?", 0); /** * Returns the strand object that matches the number given. Throws an * exception if it could not recognise the number. Number is usually * 1,-1,0. * * @param value * the number of the strand. * @return the strand matching that number. */ public static Strand forValue(int value) { switch (value) { case 1: return POSITIVE_STRAND; case 0: return UNKNOWN_STRAND; case -1: return NEGATIVE_STRAND; default: throw new IllegalArgumentException("Unknown strand type: " + value); } } /** * Returns the strand object that matches the symbol given. Throws an * exception if it could not recognise the symbol. Symbol is usually * +,-,?. * * @param name * the symbol of the strand. * @return the strand matching that symbol. */ public static Strand forName(String name) { if (name.equals("+")) return POSITIVE_STRAND; else if (name.equals("?")) return UNKNOWN_STRAND; else if (name.equals(".")) return UNKNOWN_STRAND; else if (name.equals("-")) return NEGATIVE_STRAND; else throw new IllegalArgumentException("Unknown strand type: " + name); } // creates a strand with the given number and value private Strand(String name, int value) { this.name = name; this.value = value; } /** * Returns the numeric value of this strand. * * @return the numeric value. */ public int intValue() { return this.value; } /** * Returns the string symbol of this strand. * * @return the string symbol. */ public String getName() { return this.name; } /** * {@inheritDoc} Form: "symbol" (eg. +,-,?) */ public String toString() { return this.name; } /** * {@inheritDoc} */ public int hashCode() { int code = 17; code = 31 * code + this.name.hashCode(); code = 31 * code + this.value; return code; } /** * {@inheritDoc} Strands are equal if their numbers and symbols match. */ public boolean equals(Object o) { if (!(o instanceof Strand)) return false; if (o == this) return true; Strand them = (Strand) o; if (!them.toString().equals(this.name)) return false; if (them.intValue() != this.value) return false; return true; } /** * {@inheritDoc} Strands are compared first by symbol, then by number. */ public int compareTo(Object o) { Strand fo = (Strand) o; if (!this.name.equals(fo.toString())) return this.name.compareTo(fo.toString()); return this.value - fo.intValue(); } } /** * Some useful tools for working with Locations. */ public static class Tools { // because we are static, we don't want to get instantiated private Tools() { } /** * Constructs a RichLocation object based on the given collection of * members. It the collection contains a single location, that is * returned. If it contains multiple locations it returns a * CompoundRichLocation covering them all, with the default term * associated. It returns the empty location if the collection was * empty. * * @param members * the members to construct a location from. * @return the corresponding RichLocation */ public static RichLocation construct(Collection<Location> members) { if (members.size() == 0) return RichLocation.EMPTY_LOCATION; else if (members.size() == 1) return members.toArray(new SimpleRichLocation[0])[0]; else if (isMultiSource(members)) return new MultiSourceCompoundRichLocation(members); else return new CompoundRichLocation(members); } /** * Returns false if all the locations in the set are from the same * strand of the same sequence. * * @param members * the set of locations to check. * @return true if they are from multiple sources. */ public static boolean isMultiSource(Collection<Location> members) { RichLocation previous = null; for (Iterator<Location> i = members.iterator(); i.hasNext();) { RichLocation rl = enrich(i.next()); if (previous == null) previous = rl; else { if (previous.getCircularLength() != rl.getCircularLength()) return true; if ((previous.getCrossRef() == null && rl.getCrossRef() != null) || (previous.getCrossRef() != null && rl .getCrossRef() == null) || (previous.getCrossRef() != rl.getCrossRef() && !previous .getCrossRef().equals(rl.getCrossRef()))) return true; if ((previous.getStrand() == null && rl.getStrand() != null) || (previous.getStrand() != null && rl.getStrand() == null) || (previous.getStrand() != rl.getStrand() && !previous .getStrand().equals(rl.getStrand()))) return true; } } return false; } /** * Takes a set of locations and tries to merge all pairs where the union * operation results in a simple rich location, not a compound one. * * @param members * the members to merge * @return the resulting merged set, which may have only one location in * it. */ public static Collection<Location> merge(Collection<Location> members) { // flatten them out first so we don't end up recursing List<Location> membersList = new ArrayList<Location>( flatten(members)); // all members are now singles so we can use single vs single union // operations if (membersList.size() > 1) { for (int p = 0; p < (membersList.size() - 1); p++) { RichLocation parent = (RichLocation) membersList.get(p); for (int c = p + 1; c < membersList.size(); c++) { RichLocation child = (RichLocation) membersList.get(c); RichLocation union = (RichLocation) parent.union(child); // if parent can merge with child if (union.isContiguous()) { // replace parent with union membersList.set(p, union); // remove child membersList.remove(c); // check all children again c = p + 1; } } } } return membersList; } /** * Takes a location and returns the set of all members. If any members * are compound, it flattens them too. * * @param location * the location to flatten * @return the flattened collection of members. */ public static Collection<Location> flatten(RichLocation location) { List<Location> members = new ArrayList<Location>(); for (Iterator<Location> i = location.blockIterator(); i.hasNext();) members.add(i.next()); return flatten(members); } /** * Takes a set of locations and returns the set of all members. If any * members are compound, it flattens them too. * * @param members * the locations to flatten * @return the flattened collection of members. */ public static Collection<Location> flatten(Collection<Location> members) { List<Location> flattened = new ArrayList<Location>(members); for (int i = 0; i < flattened.size(); i++) { RichLocation member = (RichLocation) flattened.get(i); if (!member.isContiguous()) { flattened.remove(i); int insertPos = i; for (Iterator<Location> j = member.blockIterator(); j .hasNext();) flattened.add(insertPos++, j.next()); i--; } } return flattened; } /** * Takes a start and end position on a circular location of given * length, and shifts them left along the sequence until they sit at the * earliest possible point where they still would represent the same * sequence. * * @param start * the start of the circular location * @param end * the end of the circular location * @param seqLength * the circular length of the sequence underlying the * location * @return an integer array where [0] is the translated start and [1] * the end. */ public static int[] modulateCircularLocation(int start, int end, int seqLength) { // Dummy case for non-circular sequences. if (seqLength == 0) return new int[] { start, end }; // Move the end to after the start. while (end < start) end += seqLength; // Calculate the length. int locationLength = end - start; // Move the start back till it can go no further while (start >= seqLength) start -= seqLength; // Move the end back. end = start + locationLength; // Return results. return new int[] { start, end }; } /** * Takes two circular locations of given length, and shifts them left * along the sequence until they sit at the earliest possible point * where they still would represent the same sequence. The end result * ensures that simple overlap calculations will always work on the * coordinates returned. * * @param a * the first location to shift * @param b * the second location to shift * @param seqLength * the circular length of the sequence underlying the * location * @return an integer array where [0] is the translated start and [1] * the end of location a, and [2] and [3] are the translated * start and end of location b. */ public static int[] modulateCircularLocationPair(Location a, Location b, int seqLength) { // Dummy case for non-circular locations. if (seqLength == 0) return new int[] { a.getMin(), a.getMax(), b.getMin(), b.getMax() }; // Modulate our start/end to shortest possible equivalent region int[] aParts = modulateCircularLocation(a.getMin(), a.getMax(), seqLength); int aStart = aParts[0]; int aEnd = aParts[1]; // Modulate their start/end to shortest possible equivalent region int[] bParts = modulateCircularLocation(b.getMin(), b.getMax(), seqLength); int bStart = bParts[0]; int bEnd = bParts[1]; // If we wrap and the point we are checking for is before our start, // increment it by circularLength length if (aEnd > seqLength && bStart < aStart) { bStart += seqLength; bEnd += seqLength; } return new int[] { aStart, aEnd, bStart, bEnd }; } /** * Takes a point on a circular location and moves it left until it falls * at the earliest possible point that represents the same base. * * @param index * the point on the location to shift * @param seqLength * the size of the circular location * @return the shifted point */ public static int modulateCircularIndex(int index, int seqLength) { // Dummy case if (seqLength == 0) return index; // Modulate while (index > seqLength) index -= seqLength; return index; } /** * Attempts to convert a plain Location into a RichLocation. * * @param l * the location to convert * @return the converted location */ public static RichLocation enrich(Location l) { // Dummy case where location is already enriched if (l instanceof RichLocation) { return (RichLocation) l; } // Compound case else if (l instanceof MergeLocation || !l.isContiguous()) { List<Location> members = new ArrayList<Location>(); for (Iterator<Location> i = l.blockIterator(); i.hasNext();) { Location member = i.next(); members.add(enrich(member)); } return RichLocation.Tools.construct(RichLocation.Tools .merge(members)); } // Fuzzy single points else if (l instanceof FuzzyPointLocation) { FuzzyPointLocation f = (FuzzyPointLocation) l; Position pos = new SimplePosition(f.hasBoundedMin(), f .hasBoundedMax(), f.getMin(), f.getMax(), Position.IN_RANGE); return new SimpleRichLocation(pos, 0); // 0 for no rank } // Fuzzy ranges else if (l instanceof FuzzyLocation) { FuzzyLocation f = (FuzzyLocation) l; Position start = new SimplePosition(f.hasBoundedMin(), false, f .getMin()); Position end = new SimplePosition(false, f.hasBoundedMax(), f .getMax()); return new SimpleRichLocation(start, end, 0); // 0 for no rank } // Normal ranges else if (l instanceof RangeLocation) { RangeLocation r = (RangeLocation) l; Position start = new SimplePosition(false, false, r.getMin()); Position end = new SimplePosition(false, false, r.getMax()); return new SimpleRichLocation(start, end, 0); // 0 for no rank } // Normal points else if (l instanceof PointLocation) { PointLocation p = (PointLocation) l; Position pos = new SimplePosition(false, false, p.getMin()); return new SimpleRichLocation(pos, 0); // 0 for no rank } // Empty locations else if (l.toString().equals("{}")) { return EMPTY_LOCATION; } // All other cases else { throw new IllegalArgumentException( "Unable to enrich locations of type " + l.getClass()); } } } }
3e02b966910f69c808b8d8d00d6a38049414e41c
473
java
Java
api/src/main/java/cn/jmicro/api/profile/KVJRso.java
mynewworldyyl/jmicro
ff20ccc70b9590fece3a731b880bde36298feb89
[ "Apache-2.0" ]
8
2018-11-24T12:16:34.000Z
2021-05-12T03:15:17.000Z
api/src/main/java/cn/jmicro/api/profile/KVJRso.java
mynewworldyyl/jmicro
ff20ccc70b9590fece3a731b880bde36298feb89
[ "Apache-2.0" ]
4
2021-06-11T16:17:40.000Z
2022-03-19T11:16:59.000Z
api/src/main/java/cn/jmicro/api/profile/KVJRso.java
mynewworldyyl/jmicro
ff20ccc70b9590fece3a731b880bde36298feb89
[ "Apache-2.0" ]
2
2020-07-29T06:42:06.000Z
2020-07-30T08:15:14.000Z
12.447368
35
0.663848
1,120
package cn.jmicro.api.profile; import cn.jmicro.api.annotation.SO; @SO public class KVJRso { private Object val; private String type; private String key; public Object getVal() { return val; } public void setVal(Object val) { this.val = val; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } }
3e02b9de0fb6207248a10d878644488c0e858eb7
3,874
java
Java
test/framework/src/main/java/org/elasticsearch/test/discovery/MockZenPing.java
allanim/elasticsearch
e04ee40f2c6a8a9d18bffbe03ead500d05ffbdbd
[ "Apache-2.0" ]
1
2016-12-06T04:45:50.000Z
2016-12-06T04:45:50.000Z
test/framework/src/main/java/org/elasticsearch/test/discovery/MockZenPing.java
allanim/elasticsearch
e04ee40f2c6a8a9d18bffbe03ead500d05ffbdbd
[ "Apache-2.0" ]
null
null
null
test/framework/src/main/java/org/elasticsearch/test/discovery/MockZenPing.java
allanim/elasticsearch
e04ee40f2c6a8a9d18bffbe03ead500d05ffbdbd
[ "Apache-2.0" ]
null
null
null
35.87037
121
0.742643
1,121
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch licenses this file to you under * the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.elasticsearch.test.discovery; import org.elasticsearch.cluster.ClusterName; import org.elasticsearch.cluster.ClusterState; import org.elasticsearch.common.component.AbstractLifecycleComponent; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.util.concurrent.ConcurrentCollections; import org.elasticsearch.discovery.DiscoveryModule; import org.elasticsearch.discovery.zen.PingContextProvider; import org.elasticsearch.discovery.zen.ZenPing; import org.elasticsearch.plugins.DiscoveryPlugin; import org.elasticsearch.plugins.Plugin; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; /** * A {@link ZenPing} implementation which returns results based on an static in-memory map. This allows pinging * to be immediate and can be used to speed up tests. */ public final class MockZenPing extends AbstractLifecycleComponent implements ZenPing { static final Map<ClusterName, Set<MockZenPing>> activeNodesPerCluster = ConcurrentCollections.newConcurrentMap(); private volatile PingContextProvider contextProvider; @Inject public MockZenPing(Settings settings) { super(settings); } @Override public void setPingContextProvider(PingContextProvider contextProvider) { this.contextProvider = contextProvider; } @Override public void ping(PingListener listener, TimeValue timeout) { logger.info("pinging using mock zen ping"); List<PingResponse> responseList = getActiveNodesForCurrentCluster().stream() .filter(p -> p != this) // remove this as pings are not expected to return the local node .map(MockZenPing::getPingResponse) .collect(Collectors.toList()); listener.onPing(responseList); } private ClusterName getClusterName() { return contextProvider.clusterState().getClusterName(); } private PingResponse getPingResponse() { final ClusterState clusterState = contextProvider.clusterState(); return new PingResponse(clusterState.nodes().getLocalNode(), clusterState.nodes().getMasterNode(), clusterState); } @Override protected void doStart() { assert contextProvider != null; boolean added = getActiveNodesForCurrentCluster().add(this); assert added; } private Set<MockZenPing> getActiveNodesForCurrentCluster() { return activeNodesPerCluster.computeIfAbsent(getClusterName(), clusterName -> ConcurrentCollections.newConcurrentSet()); } @Override protected void doStop() { boolean found = getActiveNodesForCurrentCluster().remove(this); assert found; } @Override protected void doClose() { } public static class TestPlugin extends Plugin implements DiscoveryPlugin { public void onModule(DiscoveryModule discoveryModule) { discoveryModule.addZenPing(MockZenPing.class); } } }
3e02ba8ef40f7990707574a8e027c2f2ccddd834
11,305
java
Java
plugin/src/main/java/com/denizenscript/denizen/utilities/command/ExCommandHandler.java
lasers-rgb/Denizen
aaf5729e93708bd5133e3e3b7cdbcaf5477ce735
[ "MIT" ]
68
2019-08-06T00:16:04.000Z
2022-03-25T04:58:06.000Z
plugin/src/main/java/com/denizenscript/denizen/utilities/command/ExCommandHandler.java
lasers-rgb/Denizen
aaf5729e93708bd5133e3e3b7cdbcaf5477ce735
[ "MIT" ]
324
2019-07-23T07:37:13.000Z
2022-03-28T22:35:01.000Z
plugin/src/main/java/com/denizenscript/denizen/utilities/command/ExCommandHandler.java
lasers-rgb/Denizen
aaf5729e93708bd5133e3e3b7cdbcaf5477ce735
[ "MIT" ]
37
2019-07-30T12:07:15.000Z
2022-02-05T09:08:53.000Z
46.908714
143
0.56674
1,122
package com.denizenscript.denizen.utilities.command; import com.denizenscript.denizen.objects.NPCTag; import com.denizenscript.denizen.objects.PlayerTag; import com.denizenscript.denizen.utilities.FormattedTextHelper; import com.denizenscript.denizen.utilities.Settings; import com.denizenscript.denizen.utilities.debugging.Debug; import com.denizenscript.denizen.utilities.depends.Depends; import com.denizenscript.denizen.utilities.implementation.BukkitScriptEntryData; import com.denizenscript.denizencore.DenizenCore; import com.denizenscript.denizencore.objects.ArgumentHelper; import com.denizenscript.denizencore.objects.ObjectFetcher; import com.denizenscript.denizencore.objects.ObjectTag; import com.denizenscript.denizencore.objects.properties.PropertyParser; import com.denizenscript.denizencore.scripts.ScriptBuilder; import com.denizenscript.denizencore.scripts.ScriptEntry; import com.denizenscript.denizencore.scripts.commands.AbstractCommand; import com.denizenscript.denizencore.scripts.commands.core.FlagCommand; import com.denizenscript.denizencore.scripts.queues.core.InstantQueue; import com.denizenscript.denizencore.tags.TagManager; import com.denizenscript.denizencore.utilities.CoreUtilities; import org.bukkit.ChatColor; import org.bukkit.command.*; import org.bukkit.entity.Player; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.function.Consumer; public class ExCommandHandler implements CommandExecutor, TabCompleter { public void enableFor(PluginCommand command) { command.setExecutor(this); command.setTabCompleter(this); } @Override public boolean onCommand(CommandSender sender, Command cmd, String alias, String[] args) { // <--[language] // @name /ex command // @group Console Commands // @description // The '/ex' command is an easy way to run a single denizen script command in-game. // 'Ex' is short for 'Execute'. // Its syntax, aside from '/ex' is exactly the same as any other Denizen script command. // When running a command, some context is also supplied, such as '<player>' if being run by a player (versus the console), // as well as '<npc>' if a NPC is selected by using the '/npc sel' command. // // By default, ex command debug output is sent to the player that ran the ex command (if the command was ran by a player). // To avoid this, use '-q' at the start of the ex command. // Like: /ex -q narrate "wow no output" // // The '/ex' command creates a new queue each time it's run, // meaning for example '/ex define' would do nothing, as the definition will be lost immediately. // // If you need to sustain a queue between multiple executions, use '/exs' ("Execute Sustained"). // A sustained queue will use the same queue on every execution until the queue stops (normally due to '/exs stop'). // Be warned that waits will block the sustained queue - eg '/exs wait 10m' will make '/exs' effectively unusable for 10 minutes. // // Examples: // /ex flag <player> test_flag:! // /ex run npc_walk_script // // Need to '/ex' a command as a different player or NPC? Use <@link language The Player and NPC Arguments>. // // Examples: // /ex narrate player:<[aplayer]> 'Your health is <player.health.formatted>.' // /ex walk npc:<[some_npc]> <player.cursor_on> // // --> if (cmd.getName().equalsIgnoreCase("ex")) { List<Object> entries = new ArrayList<>(); String entry = String.join(" ", args); boolean quiet = !Settings.showExDebug(); if (entry.length() > 3 && entry.startsWith("-q ")) { quiet = !quiet; entry = entry.substring("-q ".length()); } if (entry.length() < 2) { sender.sendMessage("/ex (-q) <denizen script command> (arguments)"); return true; } if (Settings.showExHelp()) { if (Debug.showDebug) { if (quiet) { sender.sendMessage(ChatColor.YELLOW + "Executing Denizen script command... check the console for full debug output!"); } else { sender.sendMessage(ChatColor.YELLOW + "Executing Denizen script command..."); } } else { sender.sendMessage(ChatColor.YELLOW + "Executing Denizen script command... to see debug, use /denizen debug"); } } entries.add(entry); InstantQueue queue = new InstantQueue("EXCOMMAND"); NPCTag npc = null; if (Depends.citizens != null && Depends.citizens.getNPCSelector().getSelected(sender) != null) { npc = new NPCTag(Depends.citizens.getNPCSelector().getSelected(sender)); } List<ScriptEntry> scriptEntries = ScriptBuilder.buildScriptEntries(entries, null, new BukkitScriptEntryData(sender instanceof Player ? new PlayerTag((Player) sender) : null, npc)); queue.addEntries(scriptEntries); if (!quiet && sender instanceof Player) { final Player player = (Player) sender; queue.debugOutput = (s) -> { player.spigot().sendMessage(FormattedTextHelper.parse(s, net.md_5.bungee.api.ChatColor.WHITE)); }; } queue.start(); return true; } return false; } public HashSet<String> allTagsEver = new HashSet<>(); public void processTagList() { allTagsEver.clear(); for (ObjectFetcher.ObjectType<? extends ObjectTag> type : ObjectFetcher.objectsByClass.values()) { if (type.tagProcessor == null) { continue; } allTagsEver.addAll(type.tagProcessor.registeredObjectTags.keySet()); } for (PropertyParser.ClassPropertiesInfo properties : PropertyParser.propertiesByClass.values()) { allTagsEver.addAll(properties.propertiesByTag.keySet()); } } @Override public List<String> onTabComplete(CommandSender sender, Command cmd, String cmdName, String[] rawArgs) { if ((!cmdName.equalsIgnoreCase("ex") && !cmdName.equalsIgnoreCase("exs")) || !sender.hasPermission("denizen.ex")) { return null; } String entry = String.join(" ", rawArgs); if (entry.length() > 3 && entry.startsWith("-q ")) { entry = entry.substring("-q ".length()); } String[] args = ArgumentHelper.buildArgs(entry); boolean isNewArg = rawArgs.length == 0 || rawArgs[rawArgs.length - 1].isEmpty(); boolean isCommandArg = args.length == 0 || (args.length == 1 && !isNewArg) || args[args.length - (isNewArg ? 1 : 2)].equals("-"); if (isCommandArg) { if (isNewArg || args.length == 0) { return new ArrayList<>(DenizenCore.getCommandRegistry().instances.keySet()); } ArrayList<String> output = new ArrayList<>(); String startOfName = CoreUtilities.toLowerCase(args[args.length - 1]); for (String command : DenizenCore.getCommandRegistry().instances.keySet()) { if (command.startsWith(startOfName)) { output.add(command); } } return output; } if (!isNewArg) { String lastArg = rawArgs[rawArgs.length - 1]; int tagStartIndex = lastArg.lastIndexOf('<'); if (tagStartIndex > lastArg.lastIndexOf('>')) { String actualTag = lastArg.substring(tagStartIndex + 1); String beforeTag = lastArg.substring(0, tagStartIndex + 1); if (!actualTag.contains("[") && !actualTag.contains(".")) { String tagText = CoreUtilities.toLowerCase(actualTag); ArrayList<String> output = new ArrayList<>(); for (String tagBase : TagManager.properTagBases) { if (tagBase.startsWith(tagText)) { output.add(beforeTag + tagBase); } } return output; } int lastDot = actualTag.lastIndexOf('.'); if (lastDot <= 0) { return new ArrayList<>(); } beforeTag += actualTag.substring(0, lastDot + 1); String lastPart = CoreUtilities.toLowerCase(actualTag.substring(lastDot + 1)); if (lastPart.contains("[") || lastPart.isEmpty()) { return new ArrayList<>(); } ArrayList<String> output = new ArrayList<>(); for (String singleTag : allTagsEver) { if (singleTag.startsWith(lastPart)) { output.add(beforeTag + singleTag); } } return output; } } AbstractCommand dcmd = DenizenCore.getCommandRegistry().get(args[0]); for (int i = args.length - 2; i >= 0; i--) { if (args[i].equals("-")) { dcmd = DenizenCore.getCommandRegistry().get(args[i + 1]); } } if (dcmd == null) { return null; } String lowArg = CoreUtilities.toLowerCase(rawArgs[rawArgs.length - 1]); ArrayList<String> output = new ArrayList<>(); for (String flat : dcmd.flatArgs) { if (flat.startsWith(lowArg)) { output.add(flat); } } for (String prefix : dcmd.prefixes) { if (prefix.startsWith(lowArg)) { output.add(prefix + ":"); } } Consumer<String> addOne = (s) -> { if (CoreUtilities.toLowerCase(s).startsWith(lowArg)) { output.add(s); } }; dcmd.addCustomTabCompletions(lowArg, addOne); if (dcmd instanceof FlagCommand) { if (sender instanceof Player) { for (String flagName : new PlayerTag((Player) sender).getFlagTracker().listAllFlags()) { if (!flagName.startsWith("__")) { addOne.accept(flagName); } } } if (Depends.citizens != null && Depends.citizens.getNPCSelector().getSelected(sender) != null) { for (String flagName : new NPCTag(Depends.citizens.getNPCSelector().getSelected(sender)).getFlagTracker().listAllFlags()) { if (!flagName.startsWith("__")) { addOne.accept(flagName); } } } } return output; } }
3e02bad66af6b9a6fbf462babe6173a6960df5f0
945
java
Java
galen-core/src/main/java/com/galenframework/api/UnregisteredTestSession.java
zfolwick/galen
8ac9882007704f09cc3fbcfa00df16e5bb8f11be
[ "Apache-2.0" ]
1
2021-08-02T05:28:09.000Z
2021-08-02T05:28:09.000Z
galen-core/src/main/java/com/galenframework/api/UnregisteredTestSession.java
trozobador/galen
a5c0215bbbf4b403656d1ed5fdbd245c42f08b24
[ "Apache-2.0" ]
null
null
null
galen-core/src/main/java/com/galenframework/api/UnregisteredTestSession.java
trozobador/galen
a5c0215bbbf4b403656d1ed5fdbd245c42f08b24
[ "Apache-2.0" ]
1
2022-01-18T11:35:35.000Z
2022-01-18T11:35:35.000Z
41.086957
80
0.632804
1,123
/******************************************************************************* * Copyright 2017 Ivan Shubin http://galenframework.com * * 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 com.galenframework.api; public class UnregisteredTestSession extends RuntimeException { public UnregisteredTestSession(String message) { super(message); } }
3e02bbeac6ac58a4d00ae73987330007c1ae53e0
1,370
java
Java
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/configuration/RocksDbDataRegionName.java
unisonteam/ignite-3
483af7884521fb8031448221d37b79a47d634401
[ "Apache-2.0" ]
null
null
null
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/configuration/RocksDbDataRegionName.java
unisonteam/ignite-3
483af7884521fb8031448221d37b79a47d634401
[ "Apache-2.0" ]
null
null
null
modules/storage-rocksdb/src/main/java/org/apache/ignite/internal/storage/rocksdb/configuration/RocksDbDataRegionName.java
unisonteam/ignite-3
483af7884521fb8031448221d37b79a47d634401
[ "Apache-2.0" ]
null
null
null
41.515152
111
0.789781
1,124
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ignite.internal.storage.rocksdb.configuration; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import org.apache.ignite.internal.storage.rocksdb.configuration.schema.RocksDbStorageEngineConfigurationSchema; /** * Annotation for checking the existence of a data region in {@link RocksDbStorageEngineConfigurationSchema}. */ @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface RocksDbDataRegionName { }
3e02bd201d03666ec5f763a308a3aa869b9bb880
2,705
java
Java
structural-type-generator/src/main/java/no/skatteetaten/fastsetting/formueinntekt/felles/structuraltype/generator/normalizer/EnumeratingNormalizer.java
raphw/skatteprosessen-structural-type
483fa9cc787bb5810f91fc9b3aa3f41f7ad8d796
[ "Apache-2.0" ]
4
2021-11-26T10:23:40.000Z
2022-01-20T07:00:11.000Z
structural-type-generator/src/main/java/no/skatteetaten/fastsetting/formueinntekt/felles/structuraltype/generator/normalizer/EnumeratingNormalizer.java
raphw/skatteprosessen-structural-type
483fa9cc787bb5810f91fc9b3aa3f41f7ad8d796
[ "Apache-2.0" ]
null
null
null
structural-type-generator/src/main/java/no/skatteetaten/fastsetting/formueinntekt/felles/structuraltype/generator/normalizer/EnumeratingNormalizer.java
raphw/skatteprosessen-structural-type
483fa9cc787bb5810f91fc9b3aa3f41f7ad8d796
[ "Apache-2.0" ]
3
2021-11-26T16:20:34.000Z
2022-01-26T09:39:52.000Z
41.615385
113
0.689834
1,125
package no.skatteetaten.fastsetting.formueinntekt.felles.structuraltype.generator.normalizer; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; import no.skatteetaten.fastsetting.formueinntekt.felles.structuraltype.generator.singular.SingularDescription; public class EnumeratingNormalizer implements Function<List<SingularDescription>, List<SingularDescription>> { private final Map<SingularDescription, List<SingularDescription>> references; private EnumeratingNormalizer(Map<SingularDescription, List<SingularDescription>> references) { this.references = references; } public static Function<List<SingularDescription>, List<SingularDescription>> of( List<SingularDescription> singulars ) { Set<SingularDescription> resolved = new HashSet<>(); Map<SingularDescription, Set<String>> enumerations = new HashMap<>(); singulars.forEach(singular -> harvest(singular, resolved, enumerations)); Map<SingularDescription, List<SingularDescription>> references = new HashMap<>(); enumerations.forEach((singular, constants) -> references.put(singular, enumerations.entrySet().stream() .filter(entry -> entry.getValue().containsAll(constants) || constants.containsAll(entry.getValue())) .map(Map.Entry::getKey) .collect(Collectors.toList()))); return new EnumeratingNormalizer(references); } private static void harvest( SingularDescription singular, Set<SingularDescription> resolved, Map<SingularDescription, Set<String>> enumerations ) { if (!resolved.add(singular)) { return; } else if (singular.isLeaf() && singular.getType().isEnum()) { @SuppressWarnings("unchecked") Class<? extends Enum<?>> type = (Class<? extends Enum<?>>) singular.getType(); enumerations.put( singular, Arrays.stream(type.getEnumConstants()).map(Enum::name).collect(Collectors.toSet()) ); } singular.getProperties().values().forEach(property -> harvest( property.getDescription(), resolved, enumerations )); } @Override public List<SingularDescription> apply(List<SingularDescription> singulars) { return singulars.stream() .flatMap(singular -> references.getOrDefault(singular, Collections.singletonList(singular)).stream()) .distinct() .collect(Collectors.toList()); } }
3e02bd71b51c37c855dc08fe03cfd8fad40b7199
360
java
Java
ibzocr-srv/src/main/java/net/ibizsys/ocr/ibizutil/chart/IChartModel.java
dev2team/ibzocr
461cb91cdb9037bb530586b90e7e849e77c526c7
[ "Apache-2.0" ]
4
2020-03-06T11:16:57.000Z
2020-05-12T06:01:40.000Z
ibzocr-srv/src/main/java/net/ibizsys/ocr/ibizutil/chart/IChartModel.java
dev2team/ibzocr
461cb91cdb9037bb530586b90e7e849e77c526c7
[ "Apache-2.0" ]
4
2020-05-11T20:45:09.000Z
2022-02-16T01:19:00.000Z
ibzocr-srv/src/main/java/net/ibizsys/ocr/ibizutil/chart/IChartModel.java
dev2team/ibzocr
461cb91cdb9037bb530586b90e7e849e77c526c7
[ "Apache-2.0" ]
null
null
null
14.4
65
0.594444
1,126
package net.ibizsys.ocr.ibizutil.chart; /** * 图表部件模型接口 * * @author lionlau * */ public interface IChartModel{ /** * 获取图表坐标轴集合 * * @return */ java.util.Iterator<IChartAxisModel> getChartAxisModels(); /** * 获取图表坐数据序列集合 * * @return */ java.util.Iterator<IChartSeriesModel> getChartSeriesModels(); }
3e02bd7244d2296bd0d0bf56337105d508a24721
1,433
java
Java
magpie-gcp/src/main/java/io/openraven/magpie/plugins/gcp/discovery/services/GCPDiscovery.java
openraven/magpie
cfd6fa2b87b07f1f649efdaf494c3e6ec32e6069
[ "Apache-2.0" ]
82
2021-03-19T19:15:04.000Z
2022-03-16T19:20:36.000Z
magpie-gcp/src/main/java/io/openraven/magpie/plugins/gcp/discovery/services/GCPDiscovery.java
openraven/magpie
cfd6fa2b87b07f1f649efdaf494c3e6ec32e6069
[ "Apache-2.0" ]
389
2021-03-19T19:49:33.000Z
2022-02-16T01:42:05.000Z
magpie-gcp/src/main/java/io/openraven/magpie/plugins/gcp/discovery/services/GCPDiscovery.java
openraven/magpie
cfd6fa2b87b07f1f649efdaf494c3e6ec32e6069
[ "Apache-2.0" ]
13
2021-03-22T14:44:10.000Z
2021-12-22T23:16:08.000Z
34.95122
120
0.752268
1,127
/* * Copyright 2021 Open Raven Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.openraven.magpie.plugins.gcp.discovery.services; import com.fasterxml.jackson.databind.ObjectMapper; import io.openraven.magpie.api.Emitter; import io.openraven.magpie.api.Session; import io.openraven.magpie.plugins.gcp.discovery.GCPDiscoveryPlugin; import org.slf4j.Logger; public interface GCPDiscovery { String service(); default void discoverWrapper(ObjectMapper mapper, String projectId, Session session, Emitter emitter, Logger logger) { logger.debug("Starting {} discovery ", service()); discover(mapper, projectId, session, emitter, logger); logger.debug("Completed {} discovery", service()); } void discover(ObjectMapper mapper, String projectId, Session session, Emitter emitter, Logger logger); default String fullService() { return GCPDiscoveryPlugin.ID + ":" + service(); } }
3e02be11134e6192f27b7efcebc67c82251a523d
3,705
java
Java
core/src/main/java/org/bouncycastle/pqc/crypto/picnic/Utils.java
86dh/bc-java
477afd96618d28fe0ca5eddadd5c3de307519db0
[ "MIT" ]
null
null
null
core/src/main/java/org/bouncycastle/pqc/crypto/picnic/Utils.java
86dh/bc-java
477afd96618d28fe0ca5eddadd5c3de307519db0
[ "MIT" ]
null
null
null
core/src/main/java/org/bouncycastle/pqc/crypto/picnic/Utils.java
86dh/bc-java
477afd96618d28fe0ca5eddadd5c3de307519db0
[ "MIT" ]
null
null
null
25.909091
97
0.452901
1,128
package org.bouncycastle.pqc.crypto.picnic; import org.bouncycastle.util.Pack; class Utils { protected static int numBytes(int numBits) { return (numBits == 0) ? 0 : ((numBits - 1) / 8 + 1); } protected static int ceil_log2(int x) { if (x == 0) { return 0; } return 32 - nlz(x - 1); } private static int nlz(int x) { int n; if (x == 0) { return (32); } n = 1; if((x >>> 16) == 0) { n = n + 16; x = x << 16; } if ((x >>> 24) == 0) { n = n + 8; x = x << 8; } if ((x >>> 28) == 0) { n = n + 4; x = x << 4; } if ((x >>> 30) == 0) { n = n + 2; x = x << 2; } n = n - (x >>> 31); return n; } protected static int parity(byte[] data, int len) { byte x = data[0]; for (int i = 1; i < len; i++) { x ^= data[i]; } /* Compute parity of x using code from Section 5-2 of * H.S. Warren, *Hacker's Delight*, Pearson Education, 2003. * https://www.hackersdelight.org/hdcodetxt/parity.c.txt */ int y = x ^ (x >>> 1); y ^= (y >>> 2); y ^= (y >>> 4); y ^= (y >>> 8); y ^= (y >>> 16); return y & 1; } protected static int parity16(int x) { int y = x ^ (x >>> 1); y ^= (y >>> 2); y ^= (y >>> 4); y ^= (y >>> 8); return y & 1; } protected static int parity32(int x) { /* Compute parity of x using code from Section 5-2 of * H.S. Warren, *Hacker's Delight*, Pearson Education, 2003. * https://www.hackersdelight.org/hdcodetxt/parity.c.txt */ int y = (x ^ (x >>> 1)); y ^= (y >>> 2); y ^= (y >>> 4); y ^= (y >>> 8); y ^= (y >>> 16); return (y & 1); } /* Set a specific bit in a byte array to a given value */ protected static void setBitInWordArray(int[] array, int bitNumber, int val) { setBit(array, bitNumber, val); } /* Get one bit from a 32-bit int array */ protected static int getBitFromWordArray(int[] array, int bitNumber) { return getBit(array, bitNumber); } /* Get one bit from a byte array */ protected static byte getBit(byte[] array, int bitNumber) { return (byte) ((array[bitNumber / 8] >> (7 - (bitNumber % 8))) & 0x01); } /* Get one bit from a byte array */ protected static int getBit(int[] array, int bitNumber) { int temp = Pack.littleEndianToInt(Pack.intToBigEndian(array[bitNumber / 32]), 0); return ((temp >> (31 - (bitNumber % 32))) & 0x01); } /* Set a specific bit in a int array to a given value */ protected static void setBit(int[] bytes, int bitNumber, int val) { int temp = Pack.littleEndianToInt(Pack.intToBigEndian(bytes[bitNumber/32]), 0); int x = ((temp & ~(1 << (31 - (bitNumber % 32)))) | (val << (31 - (bitNumber % 32)))); bytes[bitNumber / 32] = Pack.littleEndianToInt(Pack.intToBigEndian(x), 0); // bytes[bitNumber / 32] = ((bytes[bitNumber/4 >> 3] // & ~(1 << (31 - (bitNumber % 32)))) | (val << (31 - (bitNumber % 32)))); } protected static void setBit(byte[] bytes, int bitNumber, byte val) { bytes[bitNumber / 8] = (byte) ((bytes[bitNumber >> 3] & ~(1 << (7 - (bitNumber % 8)))) | (val << (7 - (bitNumber % 8)))); } }
3e02be25abbd52dd0fb2645964b8ffdc6ac501ae
498
java
Java
src/main/java/net/zcoo/seal/model/UserDTO.java
jims57/sealnoteByjava
0a3b9422e35f0185f27eab2953cad82270edd61e
[ "Apache-2.0" ]
null
null
null
src/main/java/net/zcoo/seal/model/UserDTO.java
jims57/sealnoteByjava
0a3b9422e35f0185f27eab2953cad82270edd61e
[ "Apache-2.0" ]
null
null
null
src/main/java/net/zcoo/seal/model/UserDTO.java
jims57/sealnoteByjava
0a3b9422e35f0185f27eab2953cad82270edd61e
[ "Apache-2.0" ]
null
null
null
14.228571
43
0.706827
1,129
package net.zcoo.seal.model; public class UserDTO { private String username; private String password; private String role; public String getRole() { return role; } public void setRole(String role) { this.role = role; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
3e02be340c72de63709c9dac83e736fe736a3e5d
1,013
java
Java
app/src/main/java/app/wemob/blodo/asyncprocess/RegistrationProcess.java
WeMobSolutions/Blodo
6c7c886650a344c52ce6ada99467df0fc3a5cba9
[ "MIT" ]
1
2016-11-18T07:02:15.000Z
2016-11-18T07:02:15.000Z
app/src/main/java/app/wemob/blodo/asyncprocess/RegistrationProcess.java
WeMobSolutions/Blodo
6c7c886650a344c52ce6ada99467df0fc3a5cba9
[ "MIT" ]
null
null
null
app/src/main/java/app/wemob/blodo/asyncprocess/RegistrationProcess.java
WeMobSolutions/Blodo
6c7c886650a344c52ce6ada99467df0fc3a5cba9
[ "MIT" ]
null
null
null
23.022727
82
0.722606
1,130
package app.wemob.blodo.asyncprocess; import android.os.AsyncTask; import com.loopj.android.http.AsyncHttpClient; import com.loopj.android.http.AsyncHttpResponseHandler; import com.loopj.android.http.RequestParams; import java.util.ArrayList; import app.wemob.blodo.ApiLinks; import app.wemob.blodo.BlodoApp; import app.wemob.blodo.BlodoRegister; import cz.msebera.android.httpclient.Header; /** * Created by admin on 11/3/2016. */ public class RegistrationProcess extends AsyncTask { BlodoRegister parentObject; ArrayList<String> dataToStore; public RegistrationProcess(BlodoRegister parentActivity, ArrayList<String> data) { parentObject=parentActivity; dataToStore=data; } @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(Object[] objects) { return null; } @Override protected void onPostExecute(Object o) { super.onPostExecute(o); } }
3e02be4e4699f08ddc62634111d7b24e7803a8e4
703
java
Java
src/LeetCodePerformancePractice/_189RotateArray.java
darshanhs90/Java-HackerRank
da76ccd7851f102712f7d8dfa4659901c5de7a76
[ "MIT" ]
3
2017-03-04T19:21:28.000Z
2019-08-09T07:31:34.000Z
src/LeetCodePerformancePractice/_189RotateArray.java
darshanhs90/Java-HackerRank
da76ccd7851f102712f7d8dfa4659901c5de7a76
[ "MIT" ]
null
null
null
src/LeetCodePerformancePractice/_189RotateArray.java
darshanhs90/Java-HackerRank
da76ccd7851f102712f7d8dfa4659901c5de7a76
[ "MIT" ]
3
2017-12-17T10:36:07.000Z
2022-01-19T19:08:35.000Z
21.96875
56
0.640114
1,131
package LeetCodePerformancePractice; import java.util.Arrays; public class _189RotateArray { public static void main(String[] args) { rotate(new int[]{1,2,3},4);//5,6,7,1,2,3,4 } public static void rotate(int[] nums, int k) { if(nums==null||nums.length<=1) return ; k=k>nums.length?k%nums.length:k; k=nums.length-k; nums=reverse(0,k-1,nums); nums=reverse(k,nums.length-1,nums); nums=reverse(0,nums.length-1,nums); System.out.println(Arrays.toString(nums)); } private static int[] reverse(int i, int k,int[] nums) { if(i>k) return nums; while(i<k && i>=0 && k<nums.length) { int temp=nums[i]; nums[i]=nums[k]; nums[k]=temp; i++;k--; } return nums; } }
3e02becde77ad9bface6bf28c3ca9b91c4bacfb8
101
java
Java
core/src/main/java/com/orientechnologies/orient/core/storage/fs/IOResult.java
bernhardriegler/orientdb
9d1e4ff1bb5ebb52092856baad40c35cf27295f8
[ "Apache-2.0" ]
3,651
2015-01-02T23:58:10.000Z
2022-03-31T21:12:12.000Z
core/src/main/java/com/orientechnologies/orient/core/storage/fs/IOResult.java
bernhardriegler/orientdb
9d1e4ff1bb5ebb52092856baad40c35cf27295f8
[ "Apache-2.0" ]
6,890
2015-01-01T09:41:48.000Z
2022-03-29T08:39:49.000Z
core/src/main/java/com/orientechnologies/orient/core/storage/fs/IOResult.java
bernhardriegler/orientdb
9d1e4ff1bb5ebb52092856baad40c35cf27295f8
[ "Apache-2.0" ]
923
2015-01-01T20:40:08.000Z
2022-03-21T07:26:56.000Z
16.833333
53
0.772277
1,132
package com.orientechnologies.orient.core.storage.fs; public interface IOResult { void await(); }
3e02bfffe77fbce5b0bbd151056234b1ee098429
9,100
java
Java
cuke4duke-maven-plugin/src/main/java/cuke4duke/mojo/AbstractJRubyMojo.java
torbjornvatn/cuke4duke
9bad370537e25d0362af11e5e12d5b151127685f
[ "MIT" ]
4
2015-12-21T13:26:45.000Z
2016-05-09T11:26:41.000Z
cuke4duke-maven-plugin/src/main/java/cuke4duke/mojo/AbstractJRubyMojo.java
torbjornvatn/cuke4duke
9bad370537e25d0362af11e5e12d5b151127685f
[ "MIT" ]
null
null
null
cuke4duke-maven-plugin/src/main/java/cuke4duke/mojo/AbstractJRubyMojo.java
torbjornvatn/cuke4duke
9bad370537e25d0362af11e5e12d5b151127685f
[ "MIT" ]
null
null
null
29.738562
81
0.583956
1,133
package cuke4duke.mojo; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.DependencyResolutionRequiredException; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.logging.Log; import org.apache.maven.project.MavenProject; import org.apache.tools.ant.BuildEvent; import org.apache.tools.ant.BuildListener; import org.apache.tools.ant.Project; import org.apache.tools.ant.taskdefs.Java; import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Environment; import org.apache.tools.ant.types.Path; import org.codehaus.plexus.util.StringUtils; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /** * Base for all JRuby mojos. * * @requiresDependencyResolution test */ public abstract class AbstractJRubyMojo extends AbstractMojo { protected boolean shouldFork = true; /** * @parameter expression="${project}" */ protected MavenProject mavenProject; /** * @parameter expression="${project.basedir}" * @required */ protected File launchDirectory; /** * The project compile classpath. * * @parameter default-value="${project.compileClasspathElements}" * @required * @readonly */ protected List<String> compileClasspathElements; /** * The plugin dependencies. * * @parameter expression="${plugin.artifacts}" * @required * @readonly */ protected List<Artifact> pluginArtifacts; /** * The project test classpath * * @parameter expression="${project.testClasspathElements}" * @required * @readonly */ protected List<String> testClasspathElements; /** * @parameter expression="${localRepository}" * @required * @readonly */ protected ArtifactRepository localRepository; protected Java jruby(List<String> args) throws MojoExecutionException { launchDirectory.mkdirs(); Project project; try { project = getProject(); } catch (DependencyResolutionRequiredException e) { throw new MojoExecutionException("error resolving dependencies", e); } Java java = new Java(); java.setProject(project); java.setClassname("org.jruby.Main"); java.setFailonerror(true); Commandline.Argument arg; if (shouldFork) { java.setFork(true); java.setDir(launchDirectory); for (String jvmArg : getJvmArgs()) { arg = java.createJvmarg(); arg.setValue(jvmArg); } Environment.Variable classpath = new Environment.Variable(); Path p = new Path(java.getProject()); p.add((Path) project.getReference("maven.plugin.classpath")); p.add((Path) project.getReference("maven.compile.classpath")); p.add((Path) project.getReference("maven.test.classpath")); classpath.setKey("JRUBY_PARENT_CLASSPATH"); classpath.setValue(p.toString()); java.addEnv(classpath); } Environment.Variable gemPathVar = new Environment.Variable(); gemPathVar.setKey("GEM_PATH"); gemPathVar.setValue(gemHome().getAbsolutePath()); java.addEnv(gemPathVar); Path p = java.createClasspath(); p.add((Path) project.getReference("maven.plugin.classpath")); p.add((Path) project.getReference("maven.compile.classpath")); p.add((Path) project.getReference("maven.test.classpath")); getLog().debug("java classpath: " + p.toString()); for (String s : args) { arg = java.createArg(); arg.setValue(s); } return java; } protected abstract List<String> getJvmArgs(); /** * Installs a gem. Sources used: * <ul> * <li>http://gems.rubyforge.org</li> * <li>http://gemcutter.org/</li> * <li>http://gems.github.com</li> * </ul> * * @param gemArgs * name and optional arguments. * Example: * <ul> * <li>awesome</li> * <li>awesome --version 9.8</li> * <li>awesome --version 9.8 --source http://some.gem.server</li> * </ul> * @throws org.apache.maven.plugin.MojoExecutionException * if gem installation fails. */ protected void installGem(String gemArgs) throws MojoExecutionException { List<String> args = new ArrayList<String>(); args.add("-S"); args.add("gem"); args.add("install"); args.add("--no-ri"); args.add("--no-rdoc"); args.add("--install-dir"); args.add(gemHome().getAbsolutePath()); args.addAll(Arrays.asList(gemArgs.split("\\s+"))); Java jruby = jruby(args); // We have to override HOME to make RubyGems install gems // where we want it. Setting GEM_HOME and using --install-dir // is not enough. Environment.Variable homeVar = new Environment.Variable(); homeVar.setKey("HOME"); homeVar.setValue(dotGemParent().getAbsolutePath()); jruby.addEnv(homeVar); dotGemParent().mkdirs(); jruby.execute(); } protected File dotGemParent() { return new File(localRepository.getBasedir()); } protected File gemHome() { return new File(dotGemParent(), ".gem"); } protected File binDir() { return new File(gemHome(), "bin"); } protected Project getProject() throws DependencyResolutionRequiredException { Project project = new Project(); project.setBaseDir(mavenProject.getBasedir()); project.addBuildListener(new LogAdapter()); addReference(project, "maven.compile.classpath", compileClasspathElements); addReference(project, "maven.plugin.classpath", pluginArtifacts); addReference(project, "maven.test.classpath", testClasspathElements); return project; } protected void addReference(Project project, String reference, List<?> artifacts) throws DependencyResolutionRequiredException { List<String> list = new ArrayList<String>(artifacts.size()); for (Object elem : artifacts) { String path; if (elem instanceof Artifact) { Artifact a = (Artifact) elem; File file = a.getFile(); if (file == null) { throw new DependencyResolutionRequiredException(a); } path = file.getPath(); } else { path = elem.toString(); } list.add(path); } Path p = new Path(project); p.setPath(StringUtils.join(list.iterator(), File.pathSeparator)); project.addReference(reference, p); } public static <T> List<T> listify(T... objects) { List<T> res = new ArrayList<T>(); res.addAll(Arrays.asList(objects)); return res; } protected String cmd(Java jruby) { return join(jruby.getCommandLine().getCommandline()); } protected String join(String[] strings) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < strings.length; i++) { if (i != 0) sb.append(' '); sb.append(strings[i]); } return sb.toString(); } public class LogAdapter implements BuildListener { public void buildStarted(BuildEvent event) { log(event); } public void buildFinished(BuildEvent event) { log(event); } public void targetStarted(BuildEvent event) { log(event); } public void targetFinished(BuildEvent event) { log(event); } public void taskStarted(BuildEvent event) { log(event); } public void taskFinished(BuildEvent event) { log(event); } public void messageLogged(BuildEvent event) { log(event); } private void log(BuildEvent event) { int priority = event.getPriority(); Log log = getLog(); String message = event.getMessage(); switch (priority) { case Project.MSG_ERR: log.error(message); break; case Project.MSG_WARN: log.warn(message); break; case Project.MSG_INFO: log.info(message); break; case Project.MSG_VERBOSE: log.debug(message); break; case Project.MSG_DEBUG: log.debug(message); break; default: log.info(message); break; } } } }
3e02c04fece6d906f31f7f9de93d5c831f499dcb
807
java
Java
app/src/main/java/com/yash/download/completer/broadcast_receiver/DownloadServiceActionReceiver.java
Yash-K-B/DownloadCompleter
92a466a28de91e264450e48f2a0410eb2e3bf61a
[ "MIT" ]
null
null
null
app/src/main/java/com/yash/download/completer/broadcast_receiver/DownloadServiceActionReceiver.java
Yash-K-B/DownloadCompleter
92a466a28de91e264450e48f2a0410eb2e3bf61a
[ "MIT" ]
null
null
null
app/src/main/java/com/yash/download/completer/broadcast_receiver/DownloadServiceActionReceiver.java
Yash-K-B/DownloadCompleter
92a466a28de91e264450e48f2a0410eb2e3bf61a
[ "MIT" ]
null
null
null
38.428571
124
0.76456
1,134
package com.yash.download.completer.broadcast_receiver; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import com.yash.download.completer.DownloadService; import com.yash.download.completer.keystore.Keys; public class DownloadServiceActionReceiver extends BroadcastReceiver { public static boolean pauseDownload = false; @Override public void onReceive(Context context, Intent intent) { if (intent.getStringExtra(Keys.EXTRA_ACTION) != null && intent.getStringExtra(Keys.EXTRA_ACTION).equals("pause")) pauseDownload = true; else if(intent.getStringExtra(Keys.EXTRA_ACTION) != null && intent.getStringExtra(Keys.EXTRA_ACTION).equals("play")) DownloadService.enqueueWork(context,intent); } }
3e02c124728ff271768887c68a10d893ec506868
2,745
java
Java
src/com/arquitetaweb/comanda/util/Utils.java
marcostomazini/AComanda
e62cfbf626169a2382a664a5514e906f5a7eee40
[ "Apache-2.0" ]
null
null
null
src/com/arquitetaweb/comanda/util/Utils.java
marcostomazini/AComanda
e62cfbf626169a2382a664a5514e906f5a7eee40
[ "Apache-2.0" ]
null
null
null
src/com/arquitetaweb/comanda/util/Utils.java
marcostomazini/AComanda
e62cfbf626169a2382a664a5514e906f5a7eee40
[ "Apache-2.0" ]
1
2018-08-07T23:49:26.000Z
2018-08-07T23:49:26.000Z
28.59375
114
0.703097
1,135
package com.arquitetaweb.comanda.util; import java.io.InputStream; import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; import java.util.regex.Pattern; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.text.TextUtils; import com.arquitetaweb.comanda.model.SettingsModel; import com.arquitetaweb.helper.sqllite.SettingsGenericHelper; public class Utils { public final static boolean isConnected(Context context) { final ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); final NetworkInfo networkInfo = connectivityManager .getActiveNetworkInfo(); boolean ativo = (networkInfo != null && networkInfo.isConnected()); if (ativo) return isServerActive(context); return false; } private final static boolean isServerActive(Context context) { try { URL myUrl = new URL(getUrlServico(context)); URLConnection connection = myUrl.openConnection(); connection.setConnectTimeout(3000); connection.connect(); return true; } catch (Exception e) { return false; } } public final static boolean isValidEmail(CharSequence target) { String EMAIL_REGEX = "^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$"; if (TextUtils.isEmpty(target)) { return false; } else { //return android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches(); return Pattern.matches(EMAIL_REGEX, target); } } public static void CopyStream(InputStream is, OutputStream os) { final int buffer_size = 1024; try { byte[] bytes = new byte[buffer_size]; for (;;) { int count = is.read(bytes, 0, buffer_size); if (count == -1) break; os.write(bytes, 0, count); } } catch (Exception ex) { } } public static String getUrlServico(Context context) { return MontarUrl(context); } // private static boolean isEmulator() { // String product = Build.PRODUCT; // boolean isEmulator = false; // if (product != null) { // isEmulator = product.equals("sdk") || product.contains("_sdk") // || product.contains("sdk_"); // } // return isEmulator; // } private static String MontarUrl(Context context) { SettingsGenericHelper dbSettings = new SettingsGenericHelper( context); SettingsModel configModel = new SettingsModel(); if (dbSettings.getCount() > 0) configModel = dbSettings.selectOne(); dbSettings.closeDB(); StringBuilder sb = new StringBuilder(); sb.append("http://"); sb.append(configModel.getUrlServico()); sb.append(":"); sb.append(configModel.getPortaServico().toString()); return sb.toString(); } }
3e02c160d92697a7f7fd6b1c1d2eb3416e002c4a
1,501
java
Java
src/main/java/theHexaghost/cards/ChargedBarrage.java
LyrenScalari/EvilWithin
89465277eff86d29162cd557fe80d6bd4b33b6c3
[ "MIT" ]
null
null
null
src/main/java/theHexaghost/cards/ChargedBarrage.java
LyrenScalari/EvilWithin
89465277eff86d29162cd557fe80d6bd4b33b6c3
[ "MIT" ]
null
null
null
src/main/java/theHexaghost/cards/ChargedBarrage.java
LyrenScalari/EvilWithin
89465277eff86d29162cd557fe80d6bd4b33b6c3
[ "MIT" ]
null
null
null
30.632653
91
0.643571
1,136
package theHexaghost.cards; import com.megacrit.cardcrawl.actions.AbstractGameAction; import com.megacrit.cardcrawl.actions.common.ApplyPowerAction; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.monsters.AbstractMonster; import sneckomod.SneckoMod; import theHexaghost.GhostflameHelper; import theHexaghost.ghostflames.AbstractGhostflame; import theHexaghost.powers.BurnPower; public class ChargedBarrage extends AbstractHexaCard { public final static String ID = makeID("ChargedBarrage"); //stupid intellij stuff ATTACK, ENEMY, UNCOMMON private static final int MAGIC = 5; private static final int UPG_MAGIC = 2; public ChargedBarrage() { super(ID, 1, CardType.SKILL, CardRarity.UNCOMMON, CardTarget.ENEMY); baseBurn = burn = MAGIC; this.tags.add(SneckoMod.BANNEDFORSNECKO); } public void use(AbstractPlayer p, AbstractMonster m) { burn(m, burn); atb(new AbstractGameAction() { @Override public void update() { isDone = true; for (AbstractGhostflame gf : GhostflameHelper.hexaGhostFlames) { if (gf.charged) { addToTop(new ApplyPowerAction(m, p, new BurnPower(m, burn), burn)); } } } }); } public void upgrade() { if (!upgraded) { upgradeName(); upgradeBurn(UPG_MAGIC); } } }
3e02c1d2406a0202758700b43fee5f22c80dd21f
929
java
Java
src/gov/nih/nci/cadsr/common/Result.java
NCIP/cadsr-cdecurate
854d8ef8f38ed5e7e1f5b0e0a4db2b37cc1790e0
[ "BSD-3-Clause" ]
1
2017-08-11T08:25:55.000Z
2017-08-11T08:25:55.000Z
src/gov/nih/nci/cadsr/common/Result.java
NCIP/cadsr-cdecurate
854d8ef8f38ed5e7e1f5b0e0a4db2b37cc1790e0
[ "BSD-3-Clause" ]
null
null
null
src/gov/nih/nci/cadsr/common/Result.java
NCIP/cadsr-cdecurate
854d8ef8f38ed5e7e1f5b0e0a4db2b37cc1790e0
[ "BSD-3-Clause" ]
null
null
null
21.604651
70
0.740581
1,137
/*L * Copyright ScenPro Inc, SAIC-F * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/cadsr-cdecurate/LICENSE.txt for details. */ package gov.nih.nci.cadsr.common; import java.io.Serializable; public class Result implements Serializable { private ResultCode resultCode; private String alternateMessage; // (null if no alternate message) public Result(ResultCode resultCode, String alternateMessage) { this.resultCode = resultCode; this.alternateMessage = alternateMessage; } public Result(ResultCode resultCode) { this.resultCode = resultCode; alternateMessage = null; } public Result() { this.resultCode = ResultCode.NONE; alternateMessage = null; } public ResultCode getResultCode() { return resultCode; } public String getMessage() { if (alternateMessage != null) return alternateMessage; else return resultCode.userMessage(); } }
3e02c28a99bee3a8afccb29e413abe72fb906882
400
java
Java
src/main/java/edu/fiuba/algo3/modelo/Cuchillo.java
SeleneMartinez/Algo3_AlgoThieft
10f79be7cc1c8adf6aa0dba5baf37e206aaed37d
[ "MIT" ]
null
null
null
src/main/java/edu/fiuba/algo3/modelo/Cuchillo.java
SeleneMartinez/Algo3_AlgoThieft
10f79be7cc1c8adf6aa0dba5baf37e206aaed37d
[ "MIT" ]
13
2021-12-02T02:09:35.000Z
2021-12-10T18:03:53.000Z
src/main/java/edu/fiuba/algo3/modelo/Cuchillo.java
SeleneMartinez/Algo3_AlgoThief
10f79be7cc1c8adf6aa0dba5baf37e206aaed37d
[ "MIT" ]
null
null
null
25
55
0.6975
1,138
package edu.fiuba.algo3.modelo; import java.util.ArrayList; import java.util.List; public class Cuchillo implements IArma { int demoraPorSegundoAtaque = 1; private int demoraPorAtaque = 2; public IRespuestaDelEvento herir(Policia policia){ policia.demorar(demoraPorAtaque); demoraPorAtaque = demoraPorSegundoAtaque; return new Amenaza(); } }
3e02c309274569b6ed14b7dffecc0c97202a0565
1,175
java
Java
JBox2D_2.0.1/src/org/jbox2d/dynamics/joints/JointType.java
andyfuturex/cocos2d-andorid
e101a3ba63c67a237a07cca793b753b1d57e5dc7
[ "Apache-2.0" ]
208
2015-01-01T11:02:42.000Z
2021-07-21T11:42:31.000Z
JBox2D_2.0.1/src/org/jbox2d/dynamics/joints/JointType.java
LloydFinch/cocos2d
e101a3ba63c67a237a07cca793b753b1d57e5dc7
[ "Apache-2.0" ]
7
2015-01-27T11:29:42.000Z
2016-10-15T15:19:29.000Z
JBox2D_2.0.1/src/org/jbox2d/dynamics/joints/JointType.java
LloydFinch/cocos2d
e101a3ba63c67a237a07cca793b753b1d57e5dc7
[ "Apache-2.0" ]
129
2015-01-05T02:27:01.000Z
2022-03-13T14:17:48.000Z
40.517241
105
0.755745
1,139
/* * JBox2D - A Java Port of Erin Catto's Box2D * * JBox2D homepage: http://jbox2d.sourceforge.net/ * Box2D homepage: http://www.box2d.org * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. */ package org.jbox2d.dynamics.joints; public enum JointType { UNKNOWN_JOINT, REVOLUTE_JOINT, PRISMATIC_JOINT, DISTANCE_JOINT, PULLEY_JOINT, MOUSE_JOINT, GEAR_JOINT }
3e02c325c26a5b1f5845bbce7df0f7f0f37cdd6b
2,316
java
Java
src/main/java/io/github/mtrevisan/hunlinter/parsers/thesaurus/DuplicationResult.java
mtrevisan/HunLinter
3b480ecb5408c24986841d01f129ef5f8c3b9d31
[ "MIT" ]
3
2020-05-20T09:52:37.000Z
2022-01-07T14:08:00.000Z
src/main/java/io/github/mtrevisan/hunlinter/parsers/thesaurus/DuplicationResult.java
mtrevisan/HunLinter
3b480ecb5408c24986841d01f129ef5f8c3b9d31
[ "MIT" ]
24
2020-01-31T08:45:18.000Z
2021-08-11T07:40:07.000Z
src/main/java/io/github/mtrevisan/hunlinter/parsers/thesaurus/DuplicationResult.java
mtrevisan/HunLinter
3b480ecb5408c24986841d01f129ef5f8c3b9d31
[ "MIT" ]
1
2019-03-22T01:45:22.000Z
2019-03-22T01:45:22.000Z
29.692308
82
0.750432
1,140
/** * Copyright (c) 2019-2021 Mauro Trevisan * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package io.github.mtrevisan.hunlinter.parsers.thesaurus; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import java.util.List; import java.util.Objects; public class DuplicationResult<T>{ private final List<T> duplicates; private final boolean forceInsertion; public DuplicationResult(final List<T> duplicates, final boolean forceInsertion){ Objects.requireNonNull(duplicates, "Duplicates cannot be null"); this.duplicates = duplicates; this.forceInsertion = forceInsertion; } public List<T> getDuplicates(){ return duplicates; } public boolean isForceInsertion(){ return forceInsertion; } @Override public boolean equals(final Object obj){ if(this == obj) return true; if(obj == null || getClass() != obj.getClass()) return false; final DuplicationResult<?> other = (DuplicationResult<?>)obj; return new EqualsBuilder() .append(duplicates, other.duplicates) .append(forceInsertion, other.forceInsertion) .isEquals(); } @Override public int hashCode(){ return new HashCodeBuilder() .append(duplicates) .append(forceInsertion) .toHashCode(); } }
3e02c3905865e38f6258a04d7674bb2f72574b32
593
java
Java
spark/metric-learning/src/utility/OrderByLengthAndAlpha.java
BenjaminLiuPenrose/Berkeley-CS-100
84fe1633ddaa808ccbf0b5c9f55762e6766c1d3e
[ "BSD-2-Clause" ]
null
null
null
spark/metric-learning/src/utility/OrderByLengthAndAlpha.java
BenjaminLiuPenrose/Berkeley-CS-100
84fe1633ddaa808ccbf0b5c9f55762e6766c1d3e
[ "BSD-2-Clause" ]
null
null
null
spark/metric-learning/src/utility/OrderByLengthAndAlpha.java
BenjaminLiuPenrose/Berkeley-CS-100
84fe1633ddaa808ccbf0b5c9f55762e6766c1d3e
[ "BSD-2-Clause" ]
null
null
null
19.129032
68
0.696459
1,141
package utility; import java.util.Comparator; import acids2.Resource; public class OrderByLengthAndAlpha implements Comparator<Resource> { private String propertyName = ""; public OrderByLengthAndAlpha(String propertyName) { this.propertyName = propertyName; } @Override public int compare(Resource r1, Resource r2) { String o1 = r1.getPropertyValue(propertyName); String o2 = r2.getPropertyValue(propertyName); if (o1.length() > o2.length()) { return 1; } else if (o1.length() < o2.length()) { return -1; } else { return o1.compareTo(o2); } } }
3e02c4e93f4b55208e5a580a22a3723b3c83b0ed
4,054
java
Java
shu4j-utils/src/main/java/org/shu4j/utils/privilege/PrivilegeGroupInfo.java
mhueb/shu4j
1abc8946596a8c55d5910bceb0e8f880cf5c6863
[ "Apache-2.0" ]
1
2018-12-11T18:39:01.000Z
2018-12-11T18:39:01.000Z
shu4j-utils/src/main/java/org/shu4j/utils/privilege/PrivilegeGroupInfo.java
mhueb/shu4j
1abc8946596a8c55d5910bceb0e8f880cf5c6863
[ "Apache-2.0" ]
null
null
null
shu4j-utils/src/main/java/org/shu4j/utils/privilege/PrivilegeGroupInfo.java
mhueb/shu4j
1abc8946596a8c55d5910bceb0e8f880cf5c6863
[ "Apache-2.0" ]
null
null
null
31.426357
102
0.690183
1,142
/* * Copyright 2012 SHU4J * * 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.shu4j.utils.privilege; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.shu4j.utils.util.Hasher; public final class PrivilegeGroupInfo extends AbstractPrivilegeInfo { private static final long serialVersionUID = 1L; private Map<String, AbstractPrivilegeInfo> children = new HashMap<String, AbstractPrivilegeInfo>(); public PrivilegeGroupInfo() { } public PrivilegeGroupInfo(String id, String name, String description, PrivilegeGroupInfo parent) { super(id, name, description); if (parent != null) parent.addGroup(this); } @Override public boolean equals(Object obj) { return obj instanceof PrivilegeGroupInfo && ((PrivilegeGroupInfo) obj).getId().equals(getId()); } @Override public int hashCode() { return Hasher.add(Hasher.HASHSEED, getId()); } @Override public String toString() { return "PrivilegeGroup " + getId(); } public Collection<AbstractPrivilegeInfo> getChildren() { return Collections.unmodifiableCollection(children.values()); } public Set<PrivilegeGroupInfo> getChildGroups() { Set<PrivilegeGroupInfo> groups = new HashSet<PrivilegeGroupInfo>(); for (AbstractPrivilegeInfo node : children.values()) if (node instanceof PrivilegeGroupInfo) groups.add((PrivilegeGroupInfo) node); return groups; } public Set<PrivilegeInfo> getPrivileges() { Set<PrivilegeInfo> infos = new HashSet<PrivilegeInfo>(); for (AbstractPrivilegeInfo node : children.values()) if (node instanceof PrivilegeInfo) infos.add((PrivilegeInfo) node); return infos; } public AbstractPrivilegeInfo findNode(String path) { AbstractPrivilegeInfo seek = this; String[] ids = path.split("\\."); for (String id : ids) { if (seek instanceof PrivilegeGroupInfo) seek = ((PrivilegeGroupInfo) seek).children.get(id); else return null; } return seek; } public PrivilegeGroupInfo getGroup(String path) { AbstractPrivilegeInfo node = findNode(path); if (node instanceof PrivilegeGroupInfo) return (PrivilegeGroupInfo) node; if (node != null) throw new IllegalArgumentException("Invalid group path " + path); else throw new IllegalArgumentException("Non existing path " + path); } private void addGroup(PrivilegeGroupInfo child) { if (children.containsKey(child.getId())) throw new IllegalArgumentException("Duplicate child group with id=" + child.getId()); children.put(child.getId(), child); } public void addPrivilege(PrivilegeInfo info) { if (children.containsKey(info.getId())) throw new IllegalArgumentException("Duplicate privilege " + info); children.put(info.getId(), info); } public void joinPrivileges(AbstractPrivilegeInfo node) { if (node instanceof PrivilegeGroupInfo) join((PrivilegeGroupInfo) node); else if (node instanceof PrivilegeInfo) join((PrivilegeInfo) node); else throw new IllegalArgumentException("Unknown type of node " + node); } private void join(PrivilegeGroupInfo group) { children.put(group.getId(), group); } private void join(PrivilegeInfo info) { children.put(info.getId(), info); } }
3e02c5a278c77ce288723c61507bfdc1fedf7ef1
904
java
Java
src/main/java/top/easyblog/entity/po/Power.java
hklang/easyBlog
0a9a15bef2b7a081761be2967581a0b54c0f8800
[ "Apache-2.0" ]
14
2019-11-18T14:13:09.000Z
2022-03-19T08:40:11.000Z
src/main/java/top/easyblog/entity/po/Power.java
liubiaomr/easyblog
c02c20674e0623064c4c6373abc41aa43c3432a7
[ "Apache-2.0" ]
3
2019-10-13T08:50:14.000Z
2022-02-09T01:43:19.000Z
src/main/java/top/easyblog/entity/po/Power.java
hklang/easyBlog
0a9a15bef2b7a081761be2967581a0b54c0f8800
[ "Apache-2.0" ]
4
2020-08-25T11:27:27.000Z
2022-02-22T02:30:01.000Z
18.44898
70
0.571903
1,143
package top.easyblog.entity.po; import org.springframework.data.annotation.Id; import java.io.Serializable; /** *@author huangxin */ public class Power implements Serializable { private static final long serialVersionUID = 6025381966973267562L; @Id private Integer powerId; private String name; public Power() { } public Power( String name) { this.name = name; } public Integer getPowerId() { return powerId; } public void setPowerId(Integer powerId) { this.powerId = powerId; } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } @Override public String toString() { return "Power{" + "powerId=" + powerId + ", name='" + name + '\'' + '}'; } }
3e02c6321a978e53eb11d286e072aa51cbf9de5f
3,399
java
Java
unitils-io/src/main/java/org/unitils/io/listener/TempDirFieldAnnotationListener.java
Silvermedia/unitils
ed11af302a968b7a9f5666911160139f8994c2d7
[ "Apache-2.0" ]
null
null
null
unitils-io/src/main/java/org/unitils/io/listener/TempDirFieldAnnotationListener.java
Silvermedia/unitils
ed11af302a968b7a9f5666911160139f8994c2d7
[ "Apache-2.0" ]
null
null
null
unitils-io/src/main/java/org/unitils/io/listener/TempDirFieldAnnotationListener.java
Silvermedia/unitils
ed11af302a968b7a9f5666911160139f8994c2d7
[ "Apache-2.0" ]
null
null
null
35.778947
141
0.693733
1,144
/* * Copyright 2013, Unitils.org * * 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.unitils.io.listener; import org.unitils.core.FieldAnnotationListener; import org.unitils.core.TestField; import org.unitils.core.TestInstance; import org.unitils.core.UnitilsException; import org.unitils.core.annotation.Property; import org.unitils.core.reflect.Annotations; import org.unitils.io.annotation.TempDir; import org.unitils.io.temp.TempService; import java.io.File; import static org.apache.commons.lang.StringUtils.isBlank; /** * Implements the behavior of the {@link TempDir} annotation.<br/> * See annotation javadoc for more info. * * @author Jeroen Horemans * @author Tim Ducheyne * @author Thomas De Rycke * @since 3.3 */ public class TempDirFieldAnnotationListener extends FieldAnnotationListener<TempDir> { public static final String CLEANUP_AFTER_TEST_PROPERTY = "io.temp.cleanupAfterTest"; /* True if the temp dirs should be deleted after the test */ protected Boolean cleanupAfterTest; /* The file service that will create and delete the temp dirs */ protected TempService tempService; public TempDirFieldAnnotationListener(TempService tempService, @Property(CLEANUP_AFTER_TEST_PROPERTY) Boolean cleanupAfterTest) { this.tempService = tempService; this.cleanupAfterTest = cleanupAfterTest; } @Override public void beforeTestSetUp(TestInstance testInstance, TestField testField, Annotations<TempDir> annotations) { String fileName = annotations.getAnnotationWithDefaults().value(); createTempDirForField(testInstance, testField, fileName); } @Override public void afterTestMethod(TestInstance testInstance, TestField testField, Annotations<TempDir> annotations, Throwable testThrowable) { if (!cleanupAfterTest) { return; } deleteTempDirForField(testField); } protected void createTempDirForField(TestInstance testInstance, TestField testField, String fileName) { if (isBlank(fileName)) { fileName = testInstance.getClassWrapper().getName() + "-" + testInstance.getTestMethod().getName(); } try { File f = tempService.createTempDir(fileName); testField.setValue(f); } catch (Exception e) { throw new UnitilsException("Error creating temp dir for field '" + testField.getName() + "'", e); } } protected void deleteTempDirForField(TestField testField) { try { File tempDir = testField.getValue(); tempService.deleteTempFileOrDir(tempDir); } catch (Exception e) { throw new UnitilsException("Error deleting temp dir for field '" + testField.getName() + "'", e); } } }
3e02c754d661a9efd75b8b1543188cfb25ff8eae
782
java
Java
src/dynamic_programming/SticklerThief.java
demonpratapdemon/CodingDSA
e54cd50f5280baaa3f42d87c71b6e6a89cae397b
[ "MIT" ]
null
null
null
src/dynamic_programming/SticklerThief.java
demonpratapdemon/CodingDSA
e54cd50f5280baaa3f42d87c71b6e6a89cae397b
[ "MIT" ]
null
null
null
src/dynamic_programming/SticklerThief.java
demonpratapdemon/CodingDSA
e54cd50f5280baaa3f42d87c71b6e6a89cae397b
[ "MIT" ]
null
null
null
17.772727
55
0.558824
1,145
/** * */ package dynamic_programming; /** * @author PRATAP * */ public class SticklerThief { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub int a[] = { 1, 2, 3 }; int ans = FindMaxSum(a, a.length); System.out.println(ans); } public static int FindMaxSum(int arr[], int n) { // Your code here int[] dp = new int[n]; for (int i = 0; i < n; i++) dp[i] = -1; int ans = solve(arr, n - 1, dp); return ans; } private static int solve(int[] arr, int i, int[] dp) { // TODO Auto-generated method stub if (i < 0) return 0; if (dp[i] != -1) return dp[i]; int opt1 = arr[i] + solve(arr, i - 2, dp); int opt2 = solve(arr, i - 1, dp); dp[i] = Math.max(opt1, opt2); return dp[i]; } }
3e02c78b7a20e0c349f5983e2c73aae9cf6dffbe
3,288
java
Java
app/src/main/java/com/coolweather/android/util/Utility.java
hdzhou6758/coolweather
c6edcb4bd25123d3d8de77f4ffdbbb557d6503db
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/coolweather/android/util/Utility.java
hdzhou6758/coolweather
c6edcb4bd25123d3d8de77f4ffdbbb557d6503db
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/coolweather/android/util/Utility.java
hdzhou6758/coolweather
c6edcb4bd25123d3d8de77f4ffdbbb557d6503db
[ "Apache-2.0" ]
null
null
null
32.554455
79
0.500912
1,146
package com.coolweather.android.util; import android.text.TextUtils; import android.util.Log; import com.coolweather.android.db.City; import com.coolweather.android.db.County; import com.coolweather.android.db.Province; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; /** * Created by zhd6758 on 2017/9/11. */ public class Utility { /** * 解析和处理服务器返回的省级数据 */ public static boolean handleProvinceResponse(String response){ if (!TextUtils.isEmpty(response)){ try{ JSONArray allProvinces = new JSONArray(response); for (int i = 0;i < allProvinces.length();i++){ JSONObject provinceObject = allProvinces.getJSONObject(i); Province province = new Province(); province.setProvinceName(provinceObject.getString("name")); province.setProvinceCode(provinceObject.getInt("id")); province.save(); } return true; }catch (JSONException e){ e.printStackTrace(); } } return false; } /** * 解析和处理服务器返回的市级数据 */ public static boolean handleCityResponse(String response,int provinceId){ if (!TextUtils.isEmpty(response)){ try{ Log.e("hdz",response); JSONArray allCities = new JSONArray(response); for (int i = 0;i < allCities.length();i++){ JSONObject cityObject = allCities.getJSONObject(i); City city = new City(); city.setCityName(cityObject.getString("name")); city.setCityCode(cityObject.getInt("id")); city.setProvinceId(provinceId); city.save(); } return true; }catch (JSONException e){ e.printStackTrace(); } } return false; } /** * 解析和处理服务器返回的县级数据 */ public static boolean handleCountyResponse(String response,int cityId){ if (!TextUtils.isEmpty(response)){ try{ Log.e("hdz","000"); Log.e("hdz",response); JSONArray allCounties = new JSONArray(response); Log.e("hdz","001"); for (int i = 0;i < allCounties.length();i++){ Log.e("hdz","002"); JSONObject countyObject = allCounties.getJSONObject(i); Log.e("hdz","003"); County county = new County(); Log.e("hdz","004"); county.setCountyName(countyObject.getString("name")); Log.e("hdz","005"); county.setWeatherId(countyObject.getString("weather_id")); Log.e("hdz","006"); county.setCityId(cityId); Log.e("hdz","007"); county.save(); Log.e("hdz","008"); } Log.e("hdz","009"); return true; }catch (JSONException e){ e.printStackTrace(); } } return false; } }
3e02c7b9b292b3180da0eb5528a7ff118db8f5f5
1,174
java
Java
src/main/java/cslicer/analyzer/CompilationFailureException.java
ntu-SRSLab/CSlicer
8d30b0d9feadd9f14c8dc4f4203526aaaae0615f
[ "Apache-2.0" ]
2
2021-05-15T17:16:28.000Z
2022-02-02T00:03:39.000Z
src/main/java/cslicer/analyzer/CompilationFailureException.java
ntu-SRSLab/CSlicer
8d30b0d9feadd9f14c8dc4f4203526aaaae0615f
[ "Apache-2.0" ]
1
2021-06-04T02:16:36.000Z
2021-06-04T02:16:36.000Z
src/main/java/cslicer/analyzer/CompilationFailureException.java
ntu-SRSLab/CSlicer
8d30b0d9feadd9f14c8dc4f4203526aaaae0615f
[ "Apache-2.0" ]
2
2020-05-07T15:38:54.000Z
2020-06-16T09:25:59.000Z
29.35
82
0.654174
1,147
package cslicer.analyzer; /* * #%L * CSlicer * ______ _____ __ _ * / ____// ___/ / /(_)_____ ___ _____ * / / \__ \ / // // ___// _ \ / ___/ * / /___ ___/ // // // /__ / __// / * \____/ /____//_//_/ \___/ \___//_/ * %% * Copyright (C) 2014 - 2019 Department of Computer Science, University of Toronto * %% * 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. * #L% */ public class CompilationFailureException extends Exception { public CompilationFailureException(String commitSummary) { super("Revision " + commitSummary + " does not compile!"); } /** * */ private static final long serialVersionUID = 1L; }
3e02c82ec2fff16c3841dd8bb2dfeaa349ac1814
205
java
Java
src/main/java/com/example/design/principle/singleresponsebility/ICourseManager.java
coder-fang/DesignPattern
447a91576f799ecf95e3971201a1629255b29c9c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/example/design/principle/singleresponsebility/ICourseManager.java
coder-fang/DesignPattern
447a91576f799ecf95e3971201a1629255b29c9c
[ "Apache-2.0" ]
null
null
null
src/main/java/com/example/design/principle/singleresponsebility/ICourseManager.java
coder-fang/DesignPattern
447a91576f799ecf95e3971201a1629255b29c9c
[ "Apache-2.0" ]
null
null
null
17.083333
58
0.697561
1,148
package com.example.design.principle.singleresponsebility; /** * @Author: FangJu * @Date: 2019/10/6 */ public interface ICourseManager { void studyCourse();//学习课程 void refundCourse();//退订课程 }
3e02c857385cfec8bb392fae96f2619b36a30c6a
1,296
java
Java
src/main/java/com/company/project/entity/sys/SysDictDetailEntity.java
lanxiuqiang/springboot-manager
2a5a10d567b0830a24216a64191363238fa87cbf
[ "MIT" ]
null
null
null
src/main/java/com/company/project/entity/sys/SysDictDetailEntity.java
lanxiuqiang/springboot-manager
2a5a10d567b0830a24216a64191363238fa87cbf
[ "MIT" ]
null
null
null
src/main/java/com/company/project/entity/sys/SysDictDetailEntity.java
lanxiuqiang/springboot-manager
2a5a10d567b0830a24216a64191363238fa87cbf
[ "MIT" ]
null
null
null
18.514286
77
0.653549
1,149
package com.company.project.entity.sys; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.company.project.entity.base.BaseEntity; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.Date; /** * 字典明细 * * @author wenbin * @version V1.0 * @date 2020年3月18日 */ @EqualsAndHashCode(callSuper = true) @Data @TableName("sys_dict_detail") public class SysDictDetailEntity extends BaseEntity implements Serializable { private static final long serialVersionUID = 1L; /** * 主键 */ @TableId("id") private String id; /** * 字典标签 */ @TableField("label") private String label; /** * 字典值 */ @TableField("value") private String value; /** * 排序 */ @TableField("sort") private Integer sort; /** * 字典id */ @TableField("dict_id") private String dictId; /** * 创建日期 */ @TableField(value = "create_time", fill = FieldFill.INSERT) private Date createTime; /** * 字典name */ @TableField(exist = false) private String dictName; }
3e02c872c34fdf0163afaefede2891dc238f5f5f
1,069
java
Java
src/main/java/com/vailsys/freeclimb/webhooks/percl/OutDialIfMachineCallback.java
Anedumgottil/java-sdk
f26a4171913647687b47ab9bb0cbb83bc8e2de2a
[ "MIT" ]
null
null
null
src/main/java/com/vailsys/freeclimb/webhooks/percl/OutDialIfMachineCallback.java
Anedumgottil/java-sdk
f26a4171913647687b47ab9bb0cbb83bc8e2de2a
[ "MIT" ]
5
2020-01-16T23:27:01.000Z
2021-12-01T20:32:52.000Z
src/main/java/com/vailsys/freeclimb/webhooks/percl/OutDialIfMachineCallback.java
Anedumgottil/java-sdk
f26a4171913647687b47ab9bb0cbb83bc8e2de2a
[ "MIT" ]
2
2020-01-16T22:43:41.000Z
2021-04-28T14:48:44.000Z
30.542857
104
0.755847
1,150
package com.vailsys.freeclimb.webhooks.percl; import com.google.gson.JsonIOException; import com.google.gson.JsonSyntaxException; import com.vailsys.freeclimb.api.FreeClimbException; import com.vailsys.freeclimb.api.FreeClimbJSONException; import com.vailsys.freeclimb.webhooks.FreeClimbRequest; import com.vailsys.freeclimb.webhooks.VoiceRequest; import static com.vailsys.freeclimb.json.FreeClimbGson.gson; public class OutDialIfMachineCallback extends VoiceRequest { private MachineType machineType; private String parentCallId; private OutDialIfMachineCallback() { } public static OutDialIfMachineCallback createFromJson(String jsonString) throws FreeClimbException { try { return gson.fromJson(jsonString, OutDialIfMachineCallback.class); } catch (JsonIOException | JsonSyntaxException je) { throw new FreeClimbJSONException(je); } } public MachineType getMachineType() { return machineType; } public String getParentCallId() { return parentCallId; } }
3e02cb81a20a39af044591aa1fd1898756abcd00
959
java
Java
src/main/java/com/drajer/ersd/model/ValueSetGrouperModel.java
arunkumarhk/eCRNow
3c9caf74170ddc59b38dad62fade0facf7278f9b
[ "Apache-2.0" ]
null
null
null
src/main/java/com/drajer/ersd/model/ValueSetGrouperModel.java
arunkumarhk/eCRNow
3c9caf74170ddc59b38dad62fade0facf7278f9b
[ "Apache-2.0" ]
null
null
null
src/main/java/com/drajer/ersd/model/ValueSetGrouperModel.java
arunkumarhk/eCRNow
3c9caf74170ddc59b38dad62fade0facf7278f9b
[ "Apache-2.0" ]
null
null
null
19.18
57
0.759124
1,151
package com.drajer.ersd.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "valuesetgrouper") public class ValueSetGrouperModel { @Id @Column(name = "id") @GeneratedValue(strategy = GenerationType.IDENTITY) private String id; @Column(name = "valuesetgrouper") private String valueSetGrouper; @Column(name = "valuesetid") private String valueSetId; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getValueSetGrouper() { return valueSetGrouper; } public void setValueSetGrouper(String valueSetGrouper) { this.valueSetGrouper = valueSetGrouper; } public String getValueSetId() { return valueSetId; } public void setValueSetId(String valueSetId) { this.valueSetId = valueSetId; } }
3e02cdfb5f599b402f5e14d28ed908f58b48287a
2,053
java
Java
jim-core/src/main/java/org/jim/core/cache/redis/RedisConfiguration.java
a5833488/jim
32bbcb49488900d523ee034a36bf5548ca2378cc
[ "Apache-2.0" ]
9
2020-05-31T12:10:28.000Z
2022-03-14T05:38:13.000Z
jim-core/src/main/java/org/jim/core/cache/redis/RedisConfiguration.java
a5833488/jim
32bbcb49488900d523ee034a36bf5548ca2378cc
[ "Apache-2.0" ]
2
2021-06-04T02:40:19.000Z
2021-08-02T17:22:06.000Z
jim-core/src/main/java/org/jim/core/cache/redis/RedisConfiguration.java
a5833488/jim
32bbcb49488900d523ee034a36bf5548ca2378cc
[ "Apache-2.0" ]
5
2020-06-20T08:10:14.000Z
2021-11-17T17:52:13.000Z
24.152941
82
0.700438
1,152
package org.jim.core.cache.redis; import java.util.Properties; import org.apache.commons.lang3.StringUtils; /** * @author WChao * @date 2018年3月9日 上午1:09:03 */ public class RedisConfiguration { private int retryNum =100; private int maxActive=100; private int maxIdle=20; private long maxWait=5000L; private int timeout=2000; private String auth; private String host = ""; private int port= 0; public RedisConfiguration(){} public RedisConfiguration(Properties prop){ this.retryNum = Integer.valueOf(prop.getProperty("jim.redis.retrynum", "100")); this.maxActive = Integer.valueOf(prop.getProperty("jim.redis.maxactive","100")); this.maxIdle = Integer.valueOf(prop.getProperty("jim.redis.maxidle", "20")); this.maxWait = Long.valueOf(prop.getProperty("jim.redis.maxwait","5000")); this.timeout = Integer.valueOf(prop.getProperty("jim.redis.timeout", "2000")); this.auth = prop.getProperty("jim.redis.auth",null); if(StringUtils.isEmpty(auth)) { this.auth = null; } this.host = prop.getProperty("jim.redis.host",""); this.port = Integer.valueOf(prop.getProperty("jim.redis.port","0")); } public int getRetryNum() { return retryNum; } public void setRetryNum(int retryNum) { this.retryNum = retryNum; } public int getMaxActive() { return maxActive; } public void setMaxActive(int maxActive) { this.maxActive = maxActive; } public int getMaxIdle() { return maxIdle; } public void setMaxIdle(int maxIdle) { this.maxIdle = maxIdle; } public long getMaxWait() { return maxWait; } public void setMaxWait(long maxWait) { this.maxWait = maxWait; } public int getTimeout() { return timeout; } public void setTimeout(int timeout) { this.timeout = timeout; } public int getPort() { return port; } public void setPort(int port) { this.port = port; } public String getAuth() { return auth; } public void setAuth(String auth) { this.auth = auth; } public String getHost() { return host; } public void setHost(String host) { this.host = host; } }
3e02d024259c035272a1b4be82df47d774e9d0b8
6,859
java
Java
src/main/java/net/whxxykj/maya/app/service/MobileIndexSalesmanService.java
zyxwubin/zyx-dingding-app
927f1561e876207982ab7b179357be910f606063
[ "Apache-2.0" ]
1
2021-12-03T06:04:38.000Z
2021-12-03T06:04:38.000Z
src/main/java/net/whxxykj/maya/app/service/MobileIndexSalesmanService.java
zyxwubin/zyx-dingding-app
927f1561e876207982ab7b179357be910f606063
[ "Apache-2.0" ]
null
null
null
src/main/java/net/whxxykj/maya/app/service/MobileIndexSalesmanService.java
zyxwubin/zyx-dingding-app
927f1561e876207982ab7b179357be910f606063
[ "Apache-2.0" ]
2
2021-08-31T06:26:12.000Z
2021-12-24T07:33:38.000Z
35.910995
197
0.701706
1,153
package net.whxxykj.maya.app.service; import java.util.Date; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import net.whxxykj.maya.app.repository.MobileIndexRepository; import net.whxxykj.maya.app.repository.MobileIndexSalesmanRepository; import net.whxxykj.maya.base.BaseConstant; import net.whxxykj.maya.base.common.uitls.DataPermissionNewUtil; import net.whxxykj.maya.common.repository.QueryBean; import net.whxxykj.maya.common.service.BaseService; import net.whxxykj.maya.common.util.DataValUtil; import net.whxxykj.maya.common.util.DateUtil; import net.whxxykj.maya.trade.entity.InterestBankroll; import net.whxxykj.maya.trade.entity.VIndexProfitReport; import net.whxxykj.maya.trade.entity.WarehouseSbill; import net.whxxykj.maya.trade.service.InterestBankrollService; import net.whxxykj.maya.trade.service.TradeIndexSalemanService; import net.whxxykj.maya.trade.service.TradeIndexService; @Service public class MobileIndexSalesmanService extends BaseService<MobileIndexRepository, WarehouseSbill> { @Autowired private MobileIndexSalesmanRepository mobileIndexSalesmanRepository; @Autowired private InterestBankrollService interestBankrollService; @Autowired private TradeIndexService tradeIndexService; @Autowired private TradeIndexSalemanService tradeIndexSalemanService; //获取当前操作员权限 private Iterable<String> getPermisssionEmployee() { QueryBean queryBean = new QueryBean(); DataPermissionNewUtil.getInstance().getReadPermission(this.getManagerUser(), BaseConstant.PermType.PERMTYPE_JSXG, queryBean); Map<String, Object> searchFileds = queryBean.getSearchFileds(); @SuppressWarnings("unchecked") List<String> employeeCodeList = (List<String>)searchFileds.getOrDefault("employeeCode_in", null); //List<String> employeeCodeList = Arrays.asList("----"); return employeeCodeList; } /** * * @Title: getSaleGoodsWeightToday * @Description: 今日销售重量 * @param: @return * @return: Double * @throws */ public Double getSaleGoodsWeightToday() { Double d = mobileIndexSalesmanRepository.getSaleGoodsWeightByDate(DateUtil.getDateString(new Date(), DateUtil.ORA_DATE_FORMAT),this.getPermisssionEmployee()); return DataValUtil.nullConvertZero(d); } /** * * @Title: getSaleGoodsWeightToday * @Description: 昨日销售重量 * @param: @return * @return: Double * @throws */ public Double getSaleGoodsWeightYesterday() { Double d = mobileIndexSalesmanRepository.getSaleGoodsWeightByDate(DateUtil.getDateString(DateUtil.getBeforeDate(new Date(), 1), DateUtil.ORA_DATE_FORMAT),this.getPermisssionEmployee()); return DataValUtil.nullConvertZero(d); } /** * * @Title: getSaleSumGoodsWeightTop5 * @Description: 销售重量排行Top5 * @param: @return * @return: List<Map<String,Object>> * @throws */ public List<Map<String,Object>> getSaleSumGoodsWeightTop5(){ return mobileIndexSalesmanRepository.getSaleSumGoodsWeightTop5(this.getPermisssionEmployee()); } /** * * @Title: getSumGoodsMoneyTop5 * @Description: 销售金额排名Top5 * @param: @return * @return: List<Map<String,Object>> * @throws */ public List<Map<String,Object>> getSaleSumGoodsMoneyTop5(){ return mobileIndexSalesmanRepository.getSaleSumGoodsMoneyTop5(this.getPermisssionEmployee()); } /** * * @Title: getPurchaseGoodsWeightToday * @Description: 今日采购重量 * @param: @return * @return: Double * @throws */ public Double getPurchaseGoodsWeightToday() { Double d = mobileIndexSalesmanRepository.getPurchaseGoodsWeightByDate(DateUtil.getDateString(new Date(), DateUtil.ORA_DATE_FORMAT),this.getPermisssionEmployee()); return DataValUtil.nullConvertZero(d); } /** * * @Title: getPurchaseGoodsWeightYesterday * @Description: 昨日采购重量 * @param: @return * @return: Double * @throws */ public Double getPurchaseGoodsWeightYesterday() { Double d = mobileIndexSalesmanRepository.getPurchaseGoodsWeightByDate(DateUtil.getDateString(DateUtil.getBeforeDate(new Date(), 1), DateUtil.ORA_DATE_FORMAT),this.getPermisssionEmployee()); return DataValUtil.nullConvertZero(d); } /** * * @Title: getPurchaseSumGoodsWeightTop5 * @Description: 采购重量top5 * @param: @return * @return: List<Map<String,Object>> * @throws */ public List<Map<String,Object>> getPurchaseSumGoodsWeightTop5(){ return mobileIndexSalesmanRepository.getPurchaseSumGoodsWeightTop5(this.getPermisssionEmployee()); } /** * * @Title: getPurchaseSumGoodsMoneyTop5 * @Description: 采购金额top5 * @param: @return * @return: List<Map<String,Object>> * @throws */ public List<Map<String,Object>> getPurchaseSumGoodsMoneyTop5(){ return mobileIndexSalesmanRepository.getPurchaseSumGoodsMoneyTop5(this.getPermisssionEmployee()); } //客户销售重量top5 public List<Map<String,Object>> getCustomerGoodsWeightTop5(){ return mobileIndexSalesmanRepository.getCustomerGoodsWeightTop5(this.getPermisssionEmployee()); } //客户销售金额top5 public List<Map<String,Object>> getCustomerGoodsMoneyTop5(){ return mobileIndexSalesmanRepository.getCustomerGoodsMoneyTop5(this.getPermisssionEmployee()); } //供应商采购金额top5 public List<Map<String,Object>> getSupplierGoodsMoneyTop5(){ return mobileIndexSalesmanRepository.getSupplierGoodsMoneyTop5(this.getPermisssionEmployee()); } //供应商采购重量top5 public List<Map<String,Object>> getSupplierGoodsWeightTop5(){ return mobileIndexSalesmanRepository.getSupplierGoodsWeightTop5(this.getPermisssionEmployee()); } //应收账款排名top6 public List<Map<String,Object>> getRecMoneyTop6(){ return tradeIndexService.getRecMoneyTop6(this.getPermisssionEmployee()); } //应收账款排名top6 public List<Map<String,Object>> getPayMoneyTop6(){ return tradeIndexService.getPayMoneyTop6(this.getPermisssionEmployee()); } //获取资金占用信息,根据收付款 public InterestBankroll getInterestBankroll(QueryBean queryBean) { InterestBankroll bankroll = interestBankrollService.findSumOne(queryBean); return bankroll; } //业务员 当天毛利 public VIndexProfitReport findIndexProfitMoneyOfEmp() { return tradeIndexSalemanService.findIndexProfitMoneyOfEmp(); } }
3e02d05db5404d7752e9fd7a07ed88a55da2d6de
2,668
java
Java
java/java-impl/src/com/intellij/refactoring/extractclass/usageInfo/MakeMethodDelegate.java
protector1990/intellij-community
b30024b236e84c803ee0b2df7c39eb18dbcaf827
[ "Apache-2.0" ]
5
2015-12-19T15:27:30.000Z
2019-08-17T10:07:23.000Z
java/java-impl/src/com/intellij/refactoring/extractclass/usageInfo/MakeMethodDelegate.java
protector1990/intellij-community
b30024b236e84c803ee0b2df7c39eb18dbcaf827
[ "Apache-2.0" ]
47
2015-02-28T12:45:13.000Z
2021-12-15T15:42:34.000Z
java/java-impl/src/com/intellij/refactoring/extractclass/usageInfo/MakeMethodDelegate.java
protector1990/intellij-community
b30024b236e84c803ee0b2df7c39eb18dbcaf827
[ "Apache-2.0" ]
2
2017-04-24T15:48:40.000Z
2022-03-09T05:48:05.000Z
38.666667
108
0.676912
1,154
/* * Copyright 2000-2009 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 com.intellij.refactoring.extractclass.usageInfo; import com.intellij.psi.*; import com.intellij.refactoring.util.FixableUsageInfo; import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NonNls; public class MakeMethodDelegate extends FixableUsageInfo { private final PsiMethod method; private final String delegate; public MakeMethodDelegate(PsiMethod method, String delegate) { super(method); this.method = method; this.delegate = delegate; } public void fixUsage() throws IncorrectOperationException { final PsiCodeBlock body = method.getBody(); assert body != null; final PsiStatement[] statements = body.getStatements(); for(PsiStatement statement : statements){ statement.delete(); } @NonNls final StringBuffer delegation = new StringBuffer(); final PsiType returnType = method.getReturnType(); if(!PsiType.VOID.equals(returnType)) { delegation.append("return "); } final String methodName = method.getName(); delegation.append(delegate + '.' + methodName + '('); final PsiParameterList parameterList = method.getParameterList(); final PsiParameter[] parameters = parameterList.getParameters(); boolean first = true; for (PsiParameter parameter : parameters) { if(!first) { delegation.append(','); } first = false; final String parameterName = parameter.getName(); delegation.append(parameterName); } delegation.append(");"); final PsiManager manager = method.getManager(); final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory(); final String delegationText = delegation.toString(); final PsiStatement delegationStatement = factory.createStatementFromText(delegationText, body); body.add(delegationStatement); } }
3e02d160c55c9bffb1425c3166211d247079bcba
2,627
java
Java
core/src/systemTest/java/com/palantir/giraffe/command/test/creator/ScriptExtractionCreator.java
bjlaub/giraffe
d1201499dfe8effda79dd5753aafb8465bd0254c
[ "Apache-2.0" ]
56
2015-07-13T21:09:45.000Z
2021-11-12T16:50:33.000Z
core/src/systemTest/java/com/palantir/giraffe/command/test/creator/ScriptExtractionCreator.java
bjlaub/giraffe
d1201499dfe8effda79dd5753aafb8465bd0254c
[ "Apache-2.0" ]
35
2015-08-04T16:46:18.000Z
2021-06-28T18:40:59.000Z
core/src/systemTest/java/com/palantir/giraffe/command/test/creator/ScriptExtractionCreator.java
bjlaub/giraffe
d1201499dfe8effda79dd5753aafb8465bd0254c
[ "Apache-2.0" ]
16
2015-08-29T04:51:47.000Z
2021-06-26T21:57:21.000Z
35.026667
97
0.683289
1,155
/** * Copyright 2015 Palantir Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.palantir.giraffe.command.test.creator; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import com.palantir.giraffe.test.ScriptWriter; import com.palantir.giraffe.test.TestFileCreatorCli.Creator; /** * Extracts scripts included with the creator jar for execution system tests. * * @author bkeyes */ public class ScriptExtractionCreator implements Creator { public static final String HELLO_OUTPUT = "hello_output.sh"; public static final String HELLO_ERROR = "hello_error.sh"; public static final String EXIT = "exit.sh"; public static final String STREAM = "stream.sh"; public static final String ECHO_LINE = "echo_line.sh"; public static final String ECHO_MULTILINE = "echo_multiline.sh"; public static final String PRINT_ARGS = "print_args.sh"; public static final String SLEEP_60 = "sleep60.sh"; @Override public void createScript(ScriptWriter script) throws IOException { String[] sourceScripts = new String[] { HELLO_OUTPUT, HELLO_ERROR, EXIT, STREAM, ECHO_LINE, ECHO_MULTILINE, PRINT_ARGS, SLEEP_60 }; for (String src : sourceScripts) { script.printf("cat <<'EOF' > %s%n", src); String line; BufferedReader reader = getResource(src); while ((line = reader.readLine()) != null) { script.println(line); } script.println("EOF"); script.setPermissions(src, 0755); script.println(); } } private BufferedReader getResource(String name) { InputStream is = getClass().getClassLoader().getResourceAsStream(name); if (is == null) { throw new IllegalStateException(String.format("no resource with name \"%s\"", name)); } return new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); } }
3e02d1ce83b4e035aea370bc2bffed3e26a26d76
983
java
Java
data/src/main/java/edu/harvard/hms/dbmi/avillach/cliniscope/transfer/PatientsForCandidateDTO.java
hms-dbmi/adept
8d4a3f6ca7baa2781c1d4a7d8bf868754b238169
[ "Apache-2.0" ]
null
null
null
data/src/main/java/edu/harvard/hms/dbmi/avillach/cliniscope/transfer/PatientsForCandidateDTO.java
hms-dbmi/adept
8d4a3f6ca7baa2781c1d4a7d8bf868754b238169
[ "Apache-2.0" ]
null
null
null
data/src/main/java/edu/harvard/hms/dbmi/avillach/cliniscope/transfer/PatientsForCandidateDTO.java
hms-dbmi/adept
8d4a3f6ca7baa2781c1d4a7d8bf868754b238169
[ "Apache-2.0" ]
null
null
null
20.061224
68
0.738555
1,156
package edu.harvard.hms.dbmi.avillach.cliniscope.transfer; public class PatientsForCandidateDTO { private String drug, event; private String drugCui, eventCui; private String[] patientIds; public String getDrug() { return drug; } public PatientsForCandidateDTO setDrug(String drug) { this.drug = drug; return this; } public String getEvent() { return event; } public PatientsForCandidateDTO setEvent(String event) { this.event = event; return this; } public String getDrugCui() { return drugCui; } public PatientsForCandidateDTO setDrugCui(String drugCui) { this.drugCui = drugCui; return this; } public String getEventCui() { return eventCui; } public PatientsForCandidateDTO setEventCui(String eventCui) { this.eventCui = eventCui; return this; } public String[] getPatientIds() { return patientIds; } public PatientsForCandidateDTO setPatientIds(String[] patientIds) { this.patientIds = patientIds; return this; } }
3e02d24b080c94d0c5cbe3e788343c7b50e10558
1,167
java
Java
test/e2e/pig/udfs/java/org/apache/pig/test/udf/evalfunc/GoodMonitored.java
anupam128/pig
d84817abaa292af1320e69615a8f02e25c72d876
[ "Apache-2.0" ]
8
2015-03-24T20:30:12.000Z
2022-03-13T09:03:39.000Z
pigstuff/pig-0.16.0/test/e2e/pig/udfs/java/org/apache/pig/test/udf/evalfunc/GoodMonitored.java
SeanNewman22/ISIT420
bccc21485a91ec95497121f4345edac049abba6d
[ "MIT" ]
2
2018-02-26T19:11:58.000Z
2018-05-24T16:43:13.000Z
pigstuff/pig-0.16.0/test/e2e/pig/udfs/java/org/apache/pig/test/udf/evalfunc/GoodMonitored.java
SeanNewman22/ISIT420
bccc21485a91ec95497121f4345edac049abba6d
[ "MIT" ]
5
2018-01-23T02:01:18.000Z
2019-03-29T16:47:18.000Z
32.416667
75
0.747215
1,157
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.pig.test.udf.evalfunc; import java.io.IOException; import org.apache.pig.EvalFunc; import org.apache.pig.data.Tuple; import org.apache.pig.builtin.MonitoredUDF; @MonitoredUDF public class GoodMonitored extends EvalFunc<String> { //@Override public String exec(Tuple input) throws IOException { return "fred"; } }
3e02d269b8a96f2a7066f177f13c9289252177a9
642
java
Java
Patterns/State Pattern/src/DeliveredState.java
izualkernanaus/COE312_Fall2020
21f23449202296f3db23c1538c543eebb7f56850
[ "MIT" ]
null
null
null
Patterns/State Pattern/src/DeliveredState.java
izualkernanaus/COE312_Fall2020
21f23449202296f3db23c1538c543eebb7f56850
[ "MIT" ]
null
null
null
Patterns/State Pattern/src/DeliveredState.java
izualkernanaus/COE312_Fall2020
21f23449202296f3db23c1538c543eebb7f56850
[ "MIT" ]
null
null
null
22.137931
96
0.73053
1,158
import java.util.Calendar; public class DeliveredState implements State { @Override public void prev(Context context) { System.out.println(" Cannot go back to the ordered state"); } @Override public void next(Context context) { // TODO Auto-generated method stub // make the package ready context.PackageProcessed = true; // change state on the boolean if(context.PackageProcessed && context.day!=Calendar.FRIDAY && context.day!=Calendar.SATURDAY) context.setState(new ReceivedState()); } @Override public void printStatus() { // TODO Auto-generated method stub System.out.println("in Delivered state"); } }
3e02d2e50dfd1e5a1db6aaa8760277b6d2c2508b
555
java
Java
01JavaBasics/src/_04VowelOrDigit.java
lapd87/SoftUniDatabasesFrameworksHibernateAndSpringData
2cfe33e8fc4ab8c8de7b6373f6164f97da76a10a
[ "MIT" ]
null
null
null
01JavaBasics/src/_04VowelOrDigit.java
lapd87/SoftUniDatabasesFrameworksHibernateAndSpringData
2cfe33e8fc4ab8c8de7b6373f6164f97da76a10a
[ "MIT" ]
null
null
null
01JavaBasics/src/_04VowelOrDigit.java
lapd87/SoftUniDatabasesFrameworksHibernateAndSpringData
2cfe33e8fc4ab8c8de7b6373f6164f97da76a10a
[ "MIT" ]
null
null
null
23.125
60
0.558559
1,159
/** * Created by IntelliJ IDEA. * User: LAPD * Date: 5.3.2018 г. * Time: 18:06 ч. */ import java.util.Scanner; public class _04VowelOrDigit { public static void main(String[] args) { Scanner console = new Scanner(System.in); char input = console.next().toLowerCase().charAt(0); if (Character.isDigit(input)) { System.out.println("digit"); } else if ("aeiou".indexOf(input) != -1) { System.out.println("vowel"); } else { System.out.println("other"); } } }
3e02d30e38d89188966cfe4d18cf0d1e11be0883
1,981
java
Java
src/com/pagosoft/action/ContextSensitiveAction.java
pago/PgsAction
d3b819e8deab014c67d7384e578cae3468da6976
[ "Apache-2.0" ]
null
null
null
src/com/pagosoft/action/ContextSensitiveAction.java
pago/PgsAction
d3b819e8deab014c67d7384e578cae3468da6976
[ "Apache-2.0" ]
null
null
null
src/com/pagosoft/action/ContextSensitiveAction.java
pago/PgsAction
d3b819e8deab014c67d7384e578cae3468da6976
[ "Apache-2.0" ]
null
null
null
29.132353
86
0.755679
1,160
/* * Copyright 2005 Patrick Gotthardt * * 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 com.pagosoft.action; import javax.swing.*; import java.beans.PropertyChangeListener; import java.awt.event.*; /** * <p>This class solves as a simple proxy that changes the source-value * of the ActionEvent to the context specified in the constructor.</p> * <p>There's no need to initialize this one yourself - in most cases. * The context sensitive component providers will take care of this * for you.</p> * * @author Patrick Gotthardt */ public class ContextSensitiveAction implements Action { private Action delegate; private Object context; public ContextSensitiveAction(Action delegate, Object context) { this.context = context; this.delegate = delegate; } public void addPropertyChangeListener(PropertyChangeListener listener) { delegate.addPropertyChangeListener(listener); } public Object getValue(String key) { return delegate.getValue(key); } public boolean isEnabled() { return delegate.isEnabled(); } public void putValue(String key, Object value) { delegate.putValue(key, value); } public void removePropertyChangeListener(PropertyChangeListener listener) { delegate.removePropertyChangeListener(listener); } public void setEnabled(boolean b) { delegate.setEnabled(b); } public void actionPerformed(ActionEvent e) { delegate.actionPerformed(new ActionEvent(context, e.getID(), e.getActionCommand())); } }
3e02d30e8f48a47683ca3fdb9bc2842bbadf6479
302
java
Java
java/design-pattern/src/main/java/com/github/freshchen/keeping/proxy/demo1/cgloib/Person.java
freshchen/dev-tools
f1e564dd61a2c17ce992c436c9db7bde0e00bacc
[ "Apache-2.0" ]
2
2021-01-16T15:33:55.000Z
2021-12-22T15:15:01.000Z
java/design-pattern/src/main/java/com/github/freshchen/keeping/proxy/demo1/cgloib/Person.java
freshchen/dev-tools
f1e564dd61a2c17ce992c436c9db7bde0e00bacc
[ "Apache-2.0" ]
1
2021-09-08T08:40:52.000Z
2021-09-08T08:40:52.000Z
java/design-pattern/src/main/java/com/github/freshchen/keeping/proxy/demo1/cgloib/Person.java
freshchen/dev-tools
f1e564dd61a2c17ce992c436c9db7bde0e00bacc
[ "Apache-2.0" ]
1
2021-09-23T09:12:35.000Z
2021-09-23T09:12:35.000Z
15.894737
56
0.599338
1,161
package com.github.freshchen.keeping.proxy.demo1.cgloib; /** * @program: fresh-java-practice * @Date: 2019/11/10 13:42 * @Author: Ling Chen * @Description: */ public class Person { public String sleep() { return "晚安晚安"; } public String wake() { return "早鸭"; } }
3e02d35318e5b7cae435a11447c655cf6168f1ac
13,249
java
Java
src/main/java/me/olliem5/past/impl/modules/misc/AutoBuilder.java
Doogie13/past
7d397a1ce3daab73aff5c0f66a11df479899989d
[ "MIT" ]
45
2020-12-24T13:06:51.000Z
2022-03-05T05:59:43.000Z
src/main/java/me/olliem5/past/impl/modules/misc/AutoBuilder.java
Doogie13/past
7d397a1ce3daab73aff5c0f66a11df479899989d
[ "MIT" ]
12
2020-12-26T02:34:06.000Z
2021-08-11T07:29:12.000Z
src/main/java/me/olliem5/past/impl/modules/misc/AutoBuilder.java
Doogie13/past
7d397a1ce3daab73aff5c0f66a11df479899989d
[ "MIT" ]
16
2020-12-24T13:06:51.000Z
2021-09-07T05:53:13.000Z
39.31454
130
0.485093
1,162
package me.olliem5.past.impl.modules.misc; import com.mojang.realmsclient.gui.ChatFormatting; import me.olliem5.past.Past; import me.olliem5.past.api.module.Category; import me.olliem5.past.api.module.Module; import me.olliem5.past.api.module.ModuleInfo; import me.olliem5.past.api.setting.Setting; import me.olliem5.past.api.util.client.MessageUtil; import me.olliem5.past.api.util.player.PlayerUtil; import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @ModuleInfo(name = "AutoBuilder", description = "Automatically builds set structures", category = Category.MISC) public class AutoBuilder extends Module { Setting buildmode; Setting blockspertick; Setting infomessages; private ArrayList<String> buildmodes; @Override public void setup() { buildmodes = new ArrayList<>(); buildmodes.add("PP"); buildmodes.add("Highway"); Past.settingsManager.registerSetting(buildmode = new Setting("Build", "AutoBuilderBuildMode", this, buildmodes, "PP")); Past.settingsManager.registerSetting(blockspertick = new Setting("BPT", "AutoBuilderBlocksPerTick", 1, 1, 10, this)); Past.settingsManager.registerSetting(infomessages = new Setting("Info Messages", "AutoBuilderInfoMessages", false, this)); } public void onUpdate() { if (nullCheck()) return; int blocksPlaced = 0; if (buildmode.getValueString() == "PP") { switch (PlayerUtil.getFacing()) { case NORTH: for (Vec3d placePositions : ppBuildNegativeZ) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; case EAST: for (Vec3d placePositions : ppBuildPositiveX) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; case SOUTH: for (Vec3d placePositions : ppBuildPositiveZ) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; case WEST: for (Vec3d placePositions : ppBuildNegativeX) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; } } else if (buildmode.getValueString() == "Highway") { switch (PlayerUtil.getFacing()) { case NORTH: for (Vec3d placePositions : highwayBuildNegativeZ) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; case EAST: for (Vec3d placePositions : highwayBuildPositiveX) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; case SOUTH: for (Vec3d placePositions : highwayBuildPositiveZ) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; case WEST: for (Vec3d placePositions : highwayBuildNegativeX) { BlockPos blockPos = new BlockPos(placePositions.add(mc.player.getPositionVector())); if (mc.world.getBlockState(blockPos).getBlock().equals(Blocks.AIR)) { int oldInventorySlot = mc.player.inventory.currentItem; mc.player.inventory.currentItem = PlayerUtil.getAnyBlockInHotbar(); if (infomessages.getValBoolean()) { MessageUtil.sendAutoBuilderMessage(ChatFormatting.WHITE + "Placing block"); } PlayerUtil.placeBlock(blockPos); mc.player.inventory.currentItem = oldInventorySlot; blocksPlaced++; if (blocksPlaced == blockspertick.getValueInt()) { return; } } } break; } } } private final List<Vec3d> ppBuildPositiveX = new ArrayList<>(Arrays.asList( new Vec3d(2, 0, 0), new Vec3d(2, 0, 1), new Vec3d(2, 0, -1), new Vec3d(2, 1, 0), new Vec3d(2, 2, 0) )); private final List<Vec3d> ppBuildPositiveZ = new ArrayList<>(Arrays.asList( new Vec3d(0, 0, 2), new Vec3d(-1, 0, 2), new Vec3d(1, 0, 2), new Vec3d(0, 1, 2), new Vec3d(0, 2, 2) )); private final List<Vec3d> ppBuildNegativeX = new ArrayList<>(Arrays.asList( new Vec3d(-2, 0, 0), new Vec3d(-2, 0, -1), new Vec3d(-2, 0, 1), new Vec3d(-2, 1, 0), new Vec3d(-2, 2, 0) )); private final List<Vec3d> ppBuildNegativeZ = new ArrayList<>(Arrays.asList( new Vec3d(0, 0, -2), new Vec3d(1, 0, -2), new Vec3d(-1, 0, -2), new Vec3d(0, 1, -2), new Vec3d(0, 2, -2) )); private final List<Vec3d> highwayBuildPositiveX = new ArrayList<>(Arrays.asList( new Vec3d(0, -1, 0), new Vec3d(0, -1, 1), new Vec3d(0, -1, -1), new Vec3d(0, -1, 2), new Vec3d(0, -1, -2), new Vec3d(0, -1, 3), new Vec3d(0, -1, -3), new Vec3d(0, 0, 3), new Vec3d(0, 0, -3) )); private final List<Vec3d> highwayBuildPositiveZ = new ArrayList<>(Arrays.asList( new Vec3d(0, -1, 0), new Vec3d(-1, -1, 0), new Vec3d(1, -1, 0), new Vec3d(-2, -1, 0), new Vec3d(2, -1, 0), new Vec3d(-3, -1, 0), new Vec3d(3, -1, 0), new Vec3d(-3, 0, 0), new Vec3d(3, 0, 0) )); private final List<Vec3d> highwayBuildNegativeX = new ArrayList<>(Arrays.asList( new Vec3d(0, -1, 0), new Vec3d(0, -1, -1), new Vec3d(0, -1, 1), new Vec3d(0, -1, -2), new Vec3d(0, -1, 2), new Vec3d(0, -1, -3), new Vec3d(0, -1, 3), new Vec3d(0, 0, -3), new Vec3d(0, 0, 3) )); private final List<Vec3d> highwayBuildNegativeZ = new ArrayList<>(Arrays.asList( new Vec3d(0, -1, 0), new Vec3d(1, -1, 0), new Vec3d(-1, -1, 0), new Vec3d(2, -1, 0), new Vec3d(-2, -1, 0), new Vec3d(3, -1, 0), new Vec3d(-3, -1, 0), new Vec3d(3, 0, 0), new Vec3d(-3, 0, 0) )); public String getArraylistInfo() { return ChatFormatting.GRAY + " " + buildmode.getValueString().toUpperCase(); } }
3e02d3aa97c7cb0c8d08251fc6a8fd1cfbf65cb1
922
java
Java
main/boofcv-ip/src/test/java/boofcv/alg/filter/derivative/impl/TestGradientPrewitt_Shared_MT.java
sergiuchuckmisha/BoofCV
da9a230c786a9e7993c4c6b1d50e9bbdf743e205
[ "Apache-2.0" ]
782
2015-01-06T03:09:49.000Z
2022-03-31T04:17:26.000Z
main/boofcv-ip/src/test/java/boofcv/alg/filter/derivative/impl/TestGradientPrewitt_Shared_MT.java
sergiuchuckmisha/BoofCV
da9a230c786a9e7993c4c6b1d50e9bbdf743e205
[ "Apache-2.0" ]
205
2015-03-19T15:36:02.000Z
2022-03-25T05:48:18.000Z
main/boofcv-ip/src/test/java/boofcv/alg/filter/derivative/impl/TestGradientPrewitt_Shared_MT.java
sergiuchuckmisha/BoofCV
da9a230c786a9e7993c4c6b1d50e9bbdf743e205
[ "Apache-2.0" ]
241
2015-01-12T13:23:36.000Z
2022-02-25T07:38:48.000Z
34.148148
79
0.758134
1,163
/* * Copyright (c) 2011-2019, Peter Abeles. All Rights Reserved. * * This file is part of BoofCV (http://boofcv.org). * * 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 boofcv.alg.filter.derivative.impl; class TestGradientPrewitt_Shared_MT extends CommonGradientMultiThreadToSingle { TestGradientPrewitt_Shared_MT() { super(GradientPrewitt_Shared_MT.class, GradientPrewitt_Shared.class, 3); } }
3e02d42c260821467cf4306f8fde22a17fb3a49d
7,727
java
Java
java/src/structures/ChainingHashMap.java
indy256/codelibrary-sandbox
fd49b2de1cf578084f222a087a472f0760a4fa4d
[ "Unlicense" ]
6
2018-04-20T22:58:22.000Z
2021-03-25T13:09:57.000Z
java/src/structures/ChainingHashMap.java
indy256/codelibrary-sandbox
fd49b2de1cf578084f222a087a472f0760a4fa4d
[ "Unlicense" ]
null
null
null
java/src/structures/ChainingHashMap.java
indy256/codelibrary-sandbox
fd49b2de1cf578084f222a087a472f0760a4fa4d
[ "Unlicense" ]
2
2018-06-05T18:30:17.000Z
2018-11-14T16:56:19.000Z
33.021368
147
0.48997
1,164
package structures; import java.lang.reflect.Method; import java.util.*; public class ChainingHashMap<K, V> extends AbstractMap<K, V> { private int size; private Entry<K, V>[] table; private final Set<Map.Entry<K, V>> entrySet; private static final int[] shifts = new int[10]; static { Random random = new Random(); for (int i = 0; i < shifts.length; i++) shifts[i] = 1 + 3 * i + random.nextInt(3); } public ChainingHashMap() { this(4); } @SuppressWarnings("unchecked") private void setCapacity(int size) { table = new Entry[Integer.highestOneBit(size) * 4]; } public ChainingHashMap(int initialCapacity) { setCapacity(initialCapacity); entrySet = new AbstractSet<Map.Entry<K, V>>() { @Override public Iterator<Map.Entry<K, V>> iterator() { return new Iterator<Map.Entry<K, V>>() { private Entry<K, V> lastReturned; private Entry<K, V> next; private int index; @Override public boolean hasNext() { while (next == null && index < table.length) next = table[index++]; return next != null; } @Override public Map.Entry<K, V> next() { if (!hasNext()) throw new NoSuchElementException(); lastReturned = next; next = next.next; return lastReturned; } @Override public void remove() { if (lastReturned == null) throw new IllegalStateException(); ChainingHashMap.this.remove(lastReturned.getKey()); lastReturned = null; } }; } @Override public int size() { return size; } }; } public ChainingHashMap(Map<K, V> map) { this(map.size()); putAll(map); } @Override public Set<Map.Entry<K, V>> entrySet() { return entrySet; } @Override public void clear() { Arrays.fill(table, null); size = 0; } private int index(Object o) { return getHash(o.hashCode()) & (table.length - 1); } private int getHash(int h) { int result = h; for (int i : shifts) result ^= h >>> i; return result; } @Override public V remove(Object key) { Objects.requireNonNull(key); int index = index(key); Entry<K, V> prev = null; for (Entry<K, V> current = table[index]; current != null; current = current.next) { if (current.getKey().equals(key)) { if (prev == null) table[index] = current.next; else prev.next = current.next; --size; return current.getValue(); } prev = current; } return null; } @Override public V put(K key, V value) { Objects.requireNonNull(key); int index = index(key); Entry<K, V> current = table[index]; for (; current != null; current = current.next) { if (current.getKey().equals(key)) { V oldValue = current.getValue(); current.setValue(value); return oldValue; } if (current.next == null) break; } if (current == null) table[index] = new Entry<>(key, value); else current.next = new Entry<>(key, value); ++size; if (2 * size > table.length) { Entry<K, V>[] oldTable = table; setCapacity(size); for (Entry<K, V> entry : oldTable) { for (; entry != null; ) { Entry<K, V> next = entry.next; index = index(entry.getKey()); entry.next = table[index]; table[index] = entry; entry = next; } } } return null; } @Override public V get(Object key) { Objects.requireNonNull(key); Entry<K, V> entry = getEntry(key); return entry != null ? entry.getValue() : null; } @Override public boolean containsKey(Object key) { Objects.requireNonNull(key); return getEntry(key) != null; } private Entry<K, V> getEntry(Object key) { for (Entry<K, V> entry = table[index(key)]; entry != null; entry = entry.next) if (entry.getKey().equals(key)) return entry; return null; } @Override public int size() { return size; } private static class Entry<E, V> extends SimpleEntry<E, V> { private Entry<E, V> next; private Entry(E key, V value) { super(key, value); } } // random tests public static void main(String[] args) { Random rnd = new Random(); int range = 50; String[] methods0 = {"size", "isEmpty", "toArray", "clear", "keySet"}; String[] methods1 = {"get", "containsKey", "containsValue", "remove"}; String[] iteratorMethods = {"hasNext", "next", "remove"}; for (int step = 0; step < 1000; step++) { Map<Integer, Integer> m1 = new HashMap<>(); Map<Integer, Integer> m2 = new ChainingHashMap<>(); for (int i = 0; i < 1000; i++) { if (!m1.equals(m2)) throw new RuntimeException(); int arg = rnd.nextInt(range) - range / 2; int arg2 = rnd.nextInt(range) - range / 2; if (rnd.nextInt(3) == 0 && !Objects.equals(m1.put(arg, arg2), m2.put(arg, arg2))) throw new RuntimeException(); int op = rnd.nextInt(methods0.length + methods1.length); check(m1, m2, op < methods0.length ? methods0[op] : methods1[op - methods0.length], op < methods0.length ? null : arg); if (rnd.nextInt(100) == 0) { Map<Integer, Integer> lm = new LinkedHashMap<>(m2); Iterator<Map.Entry<Integer, Integer>> it1 = lm.entrySet().iterator(); Iterator<Map.Entry<Integer, Integer>> it2 = m2.entrySet().iterator(); for (int j = 0; j < 10; j++) check(it1, it2, iteratorMethods[rnd.nextInt(iteratorMethods.length)], null); m1 = new HashMap<>(lm); } } } } static void check(Object obj1, Object obj2, String methodName, Integer arg) { Object result1 = invoke(obj1, methodName, arg); Object result2 = invoke(obj2, methodName, arg); if (!((result1 instanceof Exception && result2 instanceof Exception) || "next".equals(methodName) || Objects.deepEquals(result1, result2))) throw new RuntimeException(result1 + " " + result2); } static Object invoke(Object obj, String methodName, Integer arg) { try { Method method = arg != null ? obj.getClass().getMethod(methodName, Object.class) : obj.getClass().getMethod(methodName); method.setAccessible(true); return arg != null ? method.invoke(obj, arg) : method.invoke(obj); } catch (Exception e) { return e; } } }
3e02d47f4edf9f9cdda6462c6418b74eaf7c0e95
1,411
java
Java
src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java
abadurehman/android-awt
a6ac3b06c71eee94195c46aef75b1c4440d82ea8
[ "Apache-2.0" ]
13
2015-07-10T09:06:32.000Z
2022-03-03T00:28:17.000Z
src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java
abadurehman/android-awt
a6ac3b06c71eee94195c46aef75b1c4440d82ea8
[ "Apache-2.0" ]
1
2020-09-17T07:49:47.000Z
2020-09-17T08:12:54.000Z
src/main/java/org/apache/harmony/x/imageio/plugins/jpeg/JPEGImageReader.java
abadurehman/android-awt
a6ac3b06c71eee94195c46aef75b1c4440d82ea8
[ "Apache-2.0" ]
7
2018-03-21T13:10:30.000Z
2021-04-26T02:40:21.000Z
39.194444
77
0.742027
1,165
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.harmony.x.imageio.plugins.jpeg; import net.windward.android.imageio.ImageReadParam; import net.windward.android.imageio.plugins.jpeg.JPEGImageReadParam; import net.windward.android.imageio.spi.ImageReaderSpi; import org.apache.harmony.x.imageio.plugins.AwtImageReader; public class JPEGImageReader extends AwtImageReader { public JPEGImageReader(final ImageReaderSpi imageReaderSpi) { super(imageReaderSpi); } @Override public ImageReadParam getDefaultReadParam() { return new JPEGImageReadParam(); } }
3e02d4a56ee6212fa30170d107fb8115f112eefa
16,454
java
Java
corpus/class/eclipse.jdt.ui/9904.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
15
2018-07-10T09:38:31.000Z
2021-11-29T08:28:07.000Z
corpus/class/eclipse.jdt.ui/9904.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
3
2018-11-16T02:58:59.000Z
2021-01-20T16:03:51.000Z
corpus/class/eclipse.jdt.ui/9904.java
masud-technope/ACER-Replication-Package-ASE2017
cb7318a729eb1403004d451a164c851af2d81f7a
[ "MIT" ]
6
2018-06-27T20:19:00.000Z
2022-02-19T02:29:53.000Z
38.806604
237
0.623253
1,166
/******************************************************************************* * Copyright (c) 2000, 2015 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.jdt.internal.ui.search; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.ASTVisitor; import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.CastExpression; import org.eclipse.jdt.core.dom.CatchClause; import org.eclipse.jdt.core.dom.ClassInstanceCreation; import org.eclipse.jdt.core.dom.CompilationUnit; import org.eclipse.jdt.core.dom.ConstructorInvocation; import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.core.dom.Javadoc; import org.eclipse.jdt.core.dom.LambdaExpression; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.MethodInvocation; import org.eclipse.jdt.core.dom.Name; import org.eclipse.jdt.core.dom.NodeFinder; import org.eclipse.jdt.core.dom.SimpleName; import org.eclipse.jdt.core.dom.SingleVariableDeclaration; import org.eclipse.jdt.core.dom.SuperConstructorInvocation; import org.eclipse.jdt.core.dom.SuperMethodInvocation; import org.eclipse.jdt.core.dom.TagElement; import org.eclipse.jdt.core.dom.ThrowStatement; import org.eclipse.jdt.core.dom.TryStatement; import org.eclipse.jdt.core.dom.Type; import org.eclipse.jdt.core.dom.TypeDeclarationStatement; import org.eclipse.jdt.core.dom.UnionType; import org.eclipse.jdt.core.dom.VariableDeclarationExpression; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; import org.eclipse.jdt.internal.corext.dom.ASTNodes; import org.eclipse.jdt.internal.corext.dom.Bindings; import org.eclipse.jdt.internal.corext.util.Messages; import org.eclipse.jdt.internal.ui.text.correction.ASTResolving; import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; public class ExceptionOccurrencesFinder extends ASTVisitor implements IOccurrencesFinder { //$NON-NLS-1$ public static final String ID = "ExceptionOccurrencesFinder"; //$NON-NLS-1$ public static final String IS_EXCEPTION = "isException"; private CompilationUnit fASTRoot; private ASTNode fSelectedNode; private ITypeBinding fException; private ASTNode fStart; private TryStatement fTryStatement; private List<OccurrenceLocation> fResult; private String fDescription; private List<ITypeBinding> fCaughtExceptions; public ExceptionOccurrencesFinder() { fResult = new ArrayList(); } @Override public String initialize(CompilationUnit root, int offset, int length) { return initialize(root, NodeFinder.perform(root, offset, length)); } @Override public String initialize(CompilationUnit root, ASTNode node) { fASTRoot = root; if (node == null) return SearchMessages.ExceptionOccurrencesFinder_no_exception; if (node instanceof Name) { node = ASTNodes.getTopMostName((Name) node); } if (node.getLocationInParent() == TagElement.FRAGMENTS_PROPERTY) { MethodDeclaration method = ASTResolving.findParentMethodDeclaration(node); if (method == null) return SearchMessages.ExceptionOccurrencesFinder_no_exception; // in Javadoc tag: TagElement tagElement = (TagElement) node.getParent(); String tagName = tagElement.getTagName(); if (node instanceof Name && node == tagElement.fragments().get(0) && (TagElement.TAG_EXCEPTION.equals(tagName) || TagElement.TAG_THROWS.equals(tagName))) { fSelectedNode = node; fException = ((Name) node).resolveTypeBinding(); fStart = method; } } else { Type type = ASTNodes.getTopMostType(node); if (type == null) { return SearchMessages.ExceptionOccurrencesFinder_no_exception; } // in method's "throws" list: if (type.getLocationInParent() == MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY) { MethodDeclaration method = ASTResolving.findParentMethodDeclaration(node); if (method == null) return SearchMessages.ExceptionOccurrencesFinder_no_exception; fSelectedNode = type; fException = type.resolveBinding(); fStart = method; } // in catch clause: Type topType = type; if (type.getLocationInParent() == UnionType.TYPES_PROPERTY) { topType = (Type) type.getParent(); } if (topType.getLocationInParent() == SingleVariableDeclaration.TYPE_PROPERTY && topType.getParent().getLocationInParent() == CatchClause.EXCEPTION_PROPERTY) { fSelectedNode = type; fException = type.resolveBinding(); fTryStatement = (TryStatement) topType.getParent().getParent().getParent(); fStart = fTryStatement.getBody(); } } if (fException == null || fStart == null) return SearchMessages.ExceptionOccurrencesFinder_no_exception; fDescription = Messages.format(SearchMessages.ExceptionOccurrencesFinder_occurrence_description, BasicElementLabels.getJavaElementName(fException.getName())); return null; } private void performSearch() { fCaughtExceptions = new ArrayList(); fStart.accept(this); if (fTryStatement != null) { handleResourceDeclarations(fTryStatement); } if (fSelectedNode != null) { fResult.add(new OccurrenceLocation(fSelectedNode.getStartPosition(), fSelectedNode.getLength(), F_EXCEPTION_DECLARATION, fDescription)); } } private void handleResourceDeclarations(TryStatement tryStatement) { List<VariableDeclarationExpression> resources = tryStatement.resources(); for (Iterator<VariableDeclarationExpression> iterator = resources.iterator(); iterator.hasNext(); ) { iterator.next().accept(this); } //check if the exception is thrown as a result of resource#close() boolean exitMarked = false; for (VariableDeclarationExpression variable : resources) { Type type = variable.getType(); //$NON-NLS-1$ IMethodBinding methodBinding = Bindings.findMethodInHierarchy(type.resolveBinding(), "close", new ITypeBinding[0]); if (methodBinding != null) { ITypeBinding[] exceptionTypes = methodBinding.getExceptionTypes(); for (int j = 0; j < exceptionTypes.length; j++) { if (// a close() throws the caught exception matches(exceptionTypes[j])) { // mark name of resource for (VariableDeclarationFragment fragment : (List<VariableDeclarationFragment>) variable.fragments()) { SimpleName name = fragment.getName(); fResult.add(new OccurrenceLocation(name.getStartPosition(), name.getLength(), 0, fDescription)); } if (!exitMarked) { // mark exit position exitMarked = true; Block body = tryStatement.getBody(); // closing bracket of try block int offset = body.getStartPosition() + body.getLength() - 1; fResult.add(new OccurrenceLocation(offset, 1, 0, Messages.format(SearchMessages.ExceptionOccurrencesFinder_occurrence_implicit_close_description, BasicElementLabels.getJavaElementName(fException.getName())))); } } } } } } @Override public OccurrenceLocation[] getOccurrences() { performSearch(); if (fResult.isEmpty()) return null; return fResult.toArray(new OccurrenceLocation[fResult.size()]); } @Override public int getSearchKind() { return K_EXCEPTION_OCCURRENCE; } @Override public CompilationUnit getASTRoot() { return fASTRoot; } @Override public String getJobLabel() { return SearchMessages.ExceptionOccurrencesFinder_searchfor; } @Override public String getElementName() { if (fSelectedNode != null) { return ASTNodes.asString(fSelectedNode); } return null; } @Override public String getUnformattedPluralLabel() { return SearchMessages.ExceptionOccurrencesFinder_label_plural; } @Override public String getUnformattedSingularLabel() { return SearchMessages.ExceptionOccurrencesFinder_label_singular; } @Override public boolean visit(AnonymousClassDeclaration node) { return false; } @Override public boolean visit(CastExpression node) { if (//$NON-NLS-1$ "java.lang.ClassCastException".equals(fException.getQualifiedName())) { Type type = node.getType(); fResult.add(new OccurrenceLocation(type.getStartPosition(), type.getLength(), 0, fDescription)); } return super.visit(node); } @Override public boolean visit(ClassInstanceCreation node) { if (matches(node.resolveConstructorBinding())) { Type type = node.getType(); fResult.add(new OccurrenceLocation(type.getStartPosition(), type.getLength(), 0, fDescription)); } return super.visit(node); } @Override public boolean visit(ConstructorInvocation node) { if (matches(node.resolveConstructorBinding())) { // mark 'this' fResult.add(new OccurrenceLocation(node.getStartPosition(), 4, 0, fDescription)); } return super.visit(node); } @Override public boolean visit(LambdaExpression node) { return false; } @Override public boolean visit(MethodDeclaration node) { Javadoc javadoc = node.getJavadoc(); if (javadoc != null) { List<TagElement> tags = javadoc.tags(); for (TagElement tag : tags) { String tagName = tag.getTagName(); if (TagElement.TAG_EXCEPTION.equals(tagName) || TagElement.TAG_THROWS.equals(tagName)) { ASTNode name = (ASTNode) tag.fragments().get(0); if (name instanceof Name) { if (name != fSelectedNode && Bindings.equals(fException, ((Name) name).resolveBinding())) { fResult.add(new OccurrenceLocation(name.getStartPosition(), name.getLength(), 0, fDescription)); } } } } } List<Type> thrownExceptionTypes = node.thrownExceptionTypes(); for (Iterator<Type> iter = thrownExceptionTypes.iterator(); iter.hasNext(); ) { Type type = iter.next(); if (type != fSelectedNode && Bindings.equals(fException, type.resolveBinding())) { fResult.add(new OccurrenceLocation(type.getStartPosition(), type.getLength(), 0, fDescription)); } } Block body = node.getBody(); if (body != null) { node.getBody().accept(this); } return false; } @Override public boolean visit(MethodInvocation node) { if (matches(node.resolveMethodBinding())) { SimpleName name = node.getName(); fResult.add(new OccurrenceLocation(name.getStartPosition(), name.getLength(), 0, fDescription)); } return super.visit(node); } @Override public boolean visit(SuperConstructorInvocation node) { if (matches(node.resolveConstructorBinding())) { // mark 'super' fResult.add(new OccurrenceLocation(node.getStartPosition(), 5, 0, fDescription)); } return super.visit(node); } @Override public boolean visit(SuperMethodInvocation node) { if (matches(node.resolveMethodBinding())) { SimpleName name = node.getName(); fResult.add(new OccurrenceLocation(name.getStartPosition(), name.getLength(), 0, fDescription)); } return super.visit(node); } @Override public boolean visit(ThrowStatement node) { if (matches(node.getExpression().resolveTypeBinding())) { // mark 'throw' fResult.add(new OccurrenceLocation(node.getStartPosition(), 5, 0, fDescription)); } return super.visit(node); } @Override public boolean visit(TryStatement node) { int currentSize = fCaughtExceptions.size(); List<CatchClause> catchClauses = node.catchClauses(); for (Iterator<CatchClause> iter = catchClauses.iterator(); iter.hasNext(); ) { Type type = iter.next().getException().getType(); if (type instanceof UnionType) { List<Type> types = ((UnionType) type).types(); for (Iterator<Type> iterator = types.iterator(); iterator.hasNext(); ) { addCaughtException(iterator.next()); } } else { addCaughtException(type); } } node.getBody().accept(this); handleResourceDeclarations(node); int toRemove = fCaughtExceptions.size() - currentSize; for (int i = toRemove; i > 0; i--) { fCaughtExceptions.remove(currentSize); } // visit catch and finally for (Iterator<CatchClause> iter = catchClauses.iterator(); iter.hasNext(); ) { iter.next().accept(this); } if (node.getFinally() != null) node.getFinally().accept(this); // return false. We have visited the body by ourselves. return false; } private void addCaughtException(Type type) { ITypeBinding typeBinding = type.resolveBinding(); if (typeBinding != null) { fCaughtExceptions.add(typeBinding); } } @Override public boolean visit(TypeDeclarationStatement node) { // don't dive into local type declarations. return false; } private boolean matches(IMethodBinding binding) { if (binding == null) return false; ITypeBinding[] exceptions = binding.getExceptionTypes(); for (int i = 0; i < exceptions.length; i++) { ITypeBinding exception = exceptions[i]; if (matches(exception)) return true; } return false; } private boolean matches(ITypeBinding exception) { if (exception == null) return false; if (isCaught(exception)) return false; while (exception != null) { if (Bindings.equals(fException, exception)) return true; exception = exception.getSuperclass(); } return false; } private boolean isCaught(ITypeBinding binding) { for (Iterator<ITypeBinding> iter = fCaughtExceptions.iterator(); iter.hasNext(); ) { ITypeBinding catchException = iter.next(); if (catches(catchException, binding)) return true; } return false; } private boolean catches(ITypeBinding catchTypeBinding, ITypeBinding throwTypeBinding) { while (throwTypeBinding != null) { if (throwTypeBinding == catchTypeBinding) return true; throwTypeBinding = throwTypeBinding.getSuperclass(); } return false; } public IOccurrencesFinder getNewInstance() { return new ExceptionOccurrencesFinder(); } @Override public String getID() { return ID; } }
3e02d4ba642733720ff29d75499c315d6df5c4e4
4,160
java
Java
java/little-news/news-admin-api/src/main/java/cn/az/project/news/admin/controller/UserController.java
AzusaChino/HelloWorld
415c4c95f3c4222618fc25a0617634316420e877
[ "MIT" ]
2
2020-12-07T02:28:43.000Z
2021-11-09T06:04:36.000Z
java/little-news/news-admin-api/src/main/java/cn/az/project/news/admin/controller/UserController.java
AzusaChino/HelloWorld
415c4c95f3c4222618fc25a0617634316420e877
[ "MIT" ]
1
2021-04-12T04:04:21.000Z
2021-04-12T08:20:35.000Z
java/little-news/news-admin-api/src/main/java/cn/az/project/news/admin/controller/UserController.java
AzusaChino/little-project
415c4c95f3c4222618fc25a0617634316420e877
[ "MIT" ]
null
null
null
38.878505
115
0.688942
1,167
package cn.az.project.news.admin.controller; import cn.az.project.news.admin.manager.UserManager; import cn.az.project.news.admin.utils.AdminUtil; import cn.az.project.news.core.annotation.Limit; import cn.az.project.news.core.domain.RestResponse; import cn.az.project.news.core.exception.CommonException; import cn.az.project.news.core.jwt.JwtUtil; import cn.az.project.news.core.properties.CommonProperties; import cn.az.project.news.core.utils.CommonUtil; import cn.az.project.news.core.utils.DateUtil; import cn.az.project.news.core.utils.Md5Util; import cn.az.project.news.db.constant.Setting; import cn.az.project.news.db.entity.User; import cn.az.project.news.db.service.IRedisService; import cn.az.project.news.db.service.IUserService; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.time.LocalDateTime; import java.util.Set; /** * @author Liz */ @RestController @RequestMapping("/user") public class UserController { @Resource private UserManager userManager; @Resource private IUserService userService; @Resource private IRedisService redisService; @Resource private CommonProperties properties; @PostMapping("/login") @Limit(key = "login", period = 60, count = 3, name = "login", prefix = "limit") public RestResponse login(@RequestParam String username, @RequestParam String password) throws Exception { RestResponse response = RestResponse.init(); if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password)) { return response.code(HttpStatus.BAD_REQUEST).message("username and password cannot be empty"); } User user = userManager.getUser(username); if (user == null) { throw new CommonException("you are not my user"); } if (!StringUtils.equals(user.getPassword(), Md5Util.md5Encode(password))) { throw new CommonException("password wrong"); } if (!user.getStatus().getValue().equals(User.STATUS_VALID)) { throw new CommonException("you got locked"); } userService.updateLoginTime(username); String token = CommonUtil.encryptToken(JwtUtil.sign(username, password)); String expireTime = DateUtil.formatFullTime(LocalDateTime.now().plusSeconds(properties.getTimeOut())); redisService.zadd(Setting.USERS_ZSET_PREFIX, Double.valueOf(expireTime), String.valueOf(user.getUserId())); redisService.set(Setting.TOKEN_CACHE_PREFIX + user.getUserId(), token, properties.getTimeOut() * 1000); response.put("token", token); response.put("roles", userManager.getUserRoles(username)); response.put("permissions", userManager.getUserPermissions(username)); response.put("user", user.setPassword("******")); response.put("expireTime", expireTime); return response.ok().message("login success"); } @GetMapping("/logout") public void logout() { User u = AdminUtil.getCurrentUser(); String now = DateUtil.formatFullTime(LocalDateTime.now()); String userId = null; Set<String> onlineStringSet = redisService.zrangeByScore(Setting.USERS_ZSET_PREFIX, now, "+inf"); for (String onlineId : onlineStringSet) { if (u.getUserId().equals(onlineId)) { userId = onlineId; } } if (StringUtils.isNotEmpty(userId)) { // 删除 zset中的记录 redisService.zrem(Setting.USERS_ZSET_PREFIX, userId); // 删除对应的 token缓存 redisService.del(Setting.TOKEN_CACHE_PREFIX + userId); } } @PostMapping("/register") public RestResponse register(@RequestParam String username, @RequestParam String password) { User user = new User(username, password); if (userService.save(user)) { return RestResponse.init().ok().message("register success"); } else { return RestResponse.init().code(HttpStatus.INTERNAL_SERVER_ERROR).message("register failed"); } } }
3e02d50115c3d68f9b87a48c96f8fc4e636f7558
3,737
java
Java
src/main/java/com/walkertribe/ian/protocol/core/GameOverStatsPacket.java
JordanLongstaff/ian
1cf47701211a85116e5531d7d29fabfaf0f57840
[ "MIT" ]
11
2016-08-30T19:14:30.000Z
2022-01-25T23:34:57.000Z
src/main/java/com/walkertribe/ian/protocol/core/GameOverStatsPacket.java
JordanLongstaff/ian
1cf47701211a85116e5531d7d29fabfaf0f57840
[ "MIT" ]
19
2016-05-26T00:08:47.000Z
2020-05-06T19:07:04.000Z
src/main/java/com/walkertribe/ian/protocol/core/GameOverStatsPacket.java
JordanLongstaff/ian
1cf47701211a85116e5531d7d29fabfaf0f57840
[ "MIT" ]
2
2017-10-26T12:02:47.000Z
2018-02-13T20:36:14.000Z
21.601156
102
0.642762
1,168
package com.walkertribe.ian.protocol.core; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import com.walkertribe.ian.enums.Origin; import com.walkertribe.ian.iface.PacketReader; import com.walkertribe.ian.iface.PacketWriter; import com.walkertribe.ian.protocol.Packet; import com.walkertribe.ian.protocol.core.SimpleEventPacket.SubType; import com.walkertribe.ian.util.Util; /** * Provides a column of endgame statistics. * @author rjwut */ @Packet(origin = Origin.SERVER, type = CorePacketType.SIMPLE_EVENT, subtype = SubType.GAME_OVER_STATS) public class GameOverStatsPacket extends SimpleEventPacket implements Iterable<GameOverStatsPacket.Row> { private static final int HEADER_VALUE = -12345; private static final byte END_MARKER = (byte) 0xce; private byte columnIndex; private List<Row> rows = new LinkedList<Row>(); public GameOverStatsPacket(byte columnIndex) { this.columnIndex = columnIndex; } public GameOverStatsPacket(PacketReader reader) { super(reader); columnIndex = reader.readByte(); do { byte unknown = reader.readByte(); if (unknown == END_MARKER) { break; } int value = reader.readInt(); CharSequence label = reader.readString(); Row row; if (value == HEADER_VALUE) { row = new Row(unknown, label); } else { row = new Row(unknown, label, value); } rows.add(row); } while (true); } /** * The index of the column (0-based). */ public byte getColumnIndex() { return columnIndex; } public int getRowCount() { return rows.size(); } @Override public Iterator<Row> iterator() { return rows.iterator(); } /** * Adds a header to this column */ public void addHeader(String label) { rows.add(new Row((byte) 0, label)); } /** * Adds a row of data to this column. */ public void addRow(String label, int value) { rows.add(new Row((byte) 0, label, value)); } @Override protected void writePayload(PacketWriter writer) { super.writePayload(writer); writer.writeByte(columnIndex); for (Row row : rows) { writer .writeByte(row.getUnknown()) .writeInt(row.isHeader() ? HEADER_VALUE : row.getValue()) .writeString(row.getLabel()); } writer.writeByte(END_MARKER); } @Override protected void appendPacketDetail(StringBuilder b) { for (Row row : rows) { b.append("\n\t").append(row.getLabel()); if (!row.isHeader()) { b.append(": ").append(row.getValue()); } } } /** * Represents a single row of data to display in the column. * @author rjwut */ public static class Row { private byte unknown; private CharSequence label; private boolean header = true; private int value; /** * Creates a stat row */ private Row(byte unknown, CharSequence label, int value) { this(unknown, label); this.value = value; this.header = false; } /** * Creates a header */ public Row(byte unknown, CharSequence label) { if (Util.isBlank(label)) { throw new IllegalArgumentException("You must provide a label"); } this.unknown = unknown; this.label = label; } private byte getUnknown() { return unknown; } /** * The label for this header or stat row */ public CharSequence getLabel() { return label; } /** * Returns true if this object represents a header. */ public boolean isHeader() { return header; } /** * The value for this stat row */ public int getValue() { return value; } @Override public String toString() { return label + ": " + value; } } }
3e02d531edca92c301301e94a74fafaccff0f477
358
java
Java
backend/src/test/java/com/bonitasoft/reactiveworkshop/ReactiveWorkshopApplicationTests.java
educhastenier/reactive-workshop
9c50045929bbd2d40f1cdf8577eaf61bf138f59a
[ "MIT" ]
null
null
null
backend/src/test/java/com/bonitasoft/reactiveworkshop/ReactiveWorkshopApplicationTests.java
educhastenier/reactive-workshop
9c50045929bbd2d40f1cdf8577eaf61bf138f59a
[ "MIT" ]
null
null
null
backend/src/test/java/com/bonitasoft/reactiveworkshop/ReactiveWorkshopApplicationTests.java
educhastenier/reactive-workshop
9c50045929bbd2d40f1cdf8577eaf61bf138f59a
[ "MIT" ]
null
null
null
21.058824
60
0.821229
1,169
package com.bonitasoft.reactiveworkshop; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class ReactiveWorkshopApplicationTests { @Test public void contextLoads() { } }
3e02d53e356862f4e4168838535277ba00fb3a7f
3,089
java
Java
src/dp/FrogJump.java
gitmichaelz/LeetCodeByTags
0a1ce6deff430271909ecd3b7346cd1d54844b7a
[ "Apache-2.0" ]
null
null
null
src/dp/FrogJump.java
gitmichaelz/LeetCodeByTags
0a1ce6deff430271909ecd3b7346cd1d54844b7a
[ "Apache-2.0" ]
null
null
null
src/dp/FrogJump.java
gitmichaelz/LeetCodeByTags
0a1ce6deff430271909ecd3b7346cd1d54844b7a
[ "Apache-2.0" ]
null
null
null
37.216867
132
0.408223
1,170
package dp; public class FrogJump { //DP approach //dp[i][j] denotes if the frog can make j jumps at stones i public boolean canCross(int[] stones) { int n = stones.length; boolean[][] dp = new boolean[n][n + 1]; dp[0][1] = true; for(int i = 1; i < n; i++) { for(int j = 0; j < i; j++) { int diff = stones[i] - stones[j]; if(diff <= 0 || diff > n - 1) continue; if(dp[j][diff]) { dp[i][diff] = true; dp[i][diff + 1] = true; dp[i][diff - 1] = true; if(i == n - 1) return true; } } } return false; } //using stack, much faster than bellow approach // public boolean canCross(int[] stones){ // if(stones == null || stones.length == 0) return true; // for(int i = 1; i < stones.length; i++) { // if(stones[i] > stones[i - 1] + i) return false; // } // Stack<Integer> positions = new Stack<>(); // Stack<Integer> steps = new Stack<>(); // Set<Integer> set = new HashSet<>(); // for(int stone : stones){ // set.add(stone); // } // int lastStone = stones[stones.length - 1]; // positions.push(0); // steps.push(1); // while(!positions.isEmpty()){ // int pre = positions.pop(); // int step = steps.pop(); // for(int i = step - 1; i <= step + 1; i++) { // if(i > 0) { // int reach = pre + i; // if(reach == lastStone) return true; // if(set.contains(reach)){ // positions.push(reach); // steps.push(i); // } // } // } // } // return false; // } //map<Integer, Set<Integer>> store each stone and the steps can be made from that stone //<0, [1]> <1, [1, 2]> <3, [1, 2, 3]> <5, [1, 2, 3]> <6, [1, 2, 3, 4]> <8, [1, 2, 3, 4]> <12, [3, 4, 5]> <17> // public boolean canCross(int[] stones) { // if(stones == null || stones.length == 0) return true; // Map<Integer, Set<Integer>> map = new HashMap<>();//use set instead of list, because set can ensures the element is unique // for(int stone: stones) { // map.put(stone, new HashSet<>()); // } // map.get(stones[0]).add(1); // for(int i = 0; i < stones.length - 1; i++) { // for(int k : map.get(stones[i])) { // int reach = stones[i] + k; // if(reach == stones[stones.length - 1]) return true; // if(map.containsKey(reach)) { // map.get(reach).add(k); // map.get(reach).add(k + 1); // if(k > 1) { // map.get(reach).add(k - 1); // } // } // } // } // return false; // } }
3e02d5618bcd4abd019b8292292ee6d3078c1853
1,223
java
Java
spring-boot-system-tests/spring-boot-deployment-tests/src/systemTest/java/org/springframework/boot/deployment/TomcatDeploymentTests.java
Serendipity0928/spring-boot
e10b582a09821bf1d699905bbd202cadf579a96b
[ "Apache-2.0" ]
66,985
2015-01-01T14:37:10.000Z
2022-03-31T21:00:10.000Z
spring-boot-system-tests/spring-boot-deployment-tests/src/systemTest/java/org/springframework/boot/deployment/TomcatDeploymentTests.java
Serendipity0928/spring-boot
e10b582a09821bf1d699905bbd202cadf579a96b
[ "Apache-2.0" ]
27,513
2015-01-01T03:27:09.000Z
2022-03-31T19:03:12.000Z
spring-boot-system-tests/spring-boot-deployment-tests/src/systemTest/java/org/springframework/boot/deployment/TomcatDeploymentTests.java
Serendipity0928/spring-boot
e10b582a09821bf1d699905bbd202cadf579a96b
[ "Apache-2.0" ]
42,709
2015-01-02T01:08:50.000Z
2022-03-31T20:26:44.000Z
29.829268
101
0.764513
1,171
/* * Copyright 2012-2021 the original author or authors. * * 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 * * https://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.springframework.boot.deployment; import org.testcontainers.junit.jupiter.Container; import org.testcontainers.junit.jupiter.Testcontainers; /** * Deployment tests for Tomcat. * * @author Christoph Dreis * @author Scott Frederick */ @Testcontainers(disabledWithoutDocker = true) class TomcatDeploymentTests extends AbstractDeploymentTests { @Container static WarDeploymentContainer container = new WarDeploymentContainer("tomcat:10.0.13-jdk17-openjdk", "/usr/local/tomcat/webapps", DEFAULT_PORT); @Override WarDeploymentContainer getContainer() { return container; } }
3e02d57f23d80f1400ba36f2a5394e0f73657ccf
2,019
java
Java
sdk/core/azure-core/src/test/java/com/azure/core/implementation/jackson/ComposeTurtles.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
1,350
2015-01-17T05:22:05.000Z
2022-03-29T21:00:37.000Z
sdk/core/azure-core/src/test/java/com/azure/core/implementation/jackson/ComposeTurtles.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
16,834
2015-01-07T02:19:09.000Z
2022-03-31T23:29:10.000Z
sdk/core/azure-core/src/test/java/com/azure/core/implementation/jackson/ComposeTurtles.java
Manny27nyc/azure-sdk-for-java
d8d70f14cfd509bca10aaf042f45b2f23b62cdc9
[ "MIT" ]
1,586
2015-01-02T01:50:28.000Z
2022-03-31T11:25:34.000Z
28.43662
96
0.73056
1,172
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. package com.azure.core.implementation.jackson; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; public class ComposeTurtles { @JsonProperty(value = "description") private String description; @JsonProperty(value = "turtlesSet1Lead") private TurtleWithTypeIdContainingDot turtlesSet1Lead; @JsonProperty(value = "turtlesSet1") private List<TurtleWithTypeIdContainingDot> turtlesSet1; @JsonProperty(value = "turtlesSet2Lead") private NonEmptyAnimalWithTypeIdContainingDot turtlesSet2Lead; @JsonProperty(value = "turtlesSet2") private List<NonEmptyAnimalWithTypeIdContainingDot> turtlesSet2; public String description() { return this.description; } public ComposeTurtles withDescription(String description) { this.description = description; return this; } public List<TurtleWithTypeIdContainingDot> turtlesSet1() { return this.turtlesSet1; } public TurtleWithTypeIdContainingDot turtlesSet1Lead() { return this.turtlesSet1Lead; } public ComposeTurtles withTurtlesSet1Lead(TurtleWithTypeIdContainingDot lead) { this.turtlesSet1Lead = lead; return this; } public ComposeTurtles withTurtlesSet1(List<TurtleWithTypeIdContainingDot> turtles) { this.turtlesSet1 = turtles; return this; } public List<NonEmptyAnimalWithTypeIdContainingDot> turtlesSet2() { return this.turtlesSet2; } public NonEmptyAnimalWithTypeIdContainingDot turtlesSet2Lead() { return this.turtlesSet2Lead; } public ComposeTurtles withTurtlesSet2Lead(NonEmptyAnimalWithTypeIdContainingDot lead) { this.turtlesSet2Lead = lead; return this; } public ComposeTurtles withTurtlesSet2(List<NonEmptyAnimalWithTypeIdContainingDot> turtles) { this.turtlesSet2 = turtles; return this; } }
3e02d5d90facb310b6a79cfaa9f83a0224936642
3,519
java
Java
src/ResponseCollection/Actions/ActionType.java
vianhanif/Robot-offline-speech-recognition
35f42b24d29d022cb3d8c0ba92795e342a919b76
[ "MIT" ]
null
null
null
src/ResponseCollection/Actions/ActionType.java
vianhanif/Robot-offline-speech-recognition
35f42b24d29d022cb3d8c0ba92795e342a919b76
[ "MIT" ]
1
2017-08-01T07:45:05.000Z
2017-08-02T15:29:43.000Z
src/ResponseCollection/Actions/ActionType.java
vianhanif/Robot-offline-speech-recognition
35f42b24d29d022cb3d8c0ba92795e342a919b76
[ "MIT" ]
null
null
null
43.444444
114
0.696505
1,173
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package ResponseCollection.Actions; import library.SpeechRecognition; /** * * @author alvian */ public enum ActionType { DIRECTION_LEFT(1), DIRECTION_RIGHT(2), DIRECTION_BACKWARD(3), DIRECTION_FORWARD(4), DIRECTION_STOP(5), BROWSE_GOOGLE(6), BROWSE_YOUTUBE(7), BROWSE_FACEBOOK(8), BROWSE_TWITTER(9), BROWSE_ALLKPOP(10), COLLEGE_INFORMATION_WHAT(11), COLLEGE_INFORMATION_WHEN(12), COLLEGE_INFORMATION_WHERE(13), COLLEGE_INFORMATION_WHO(14), COLLEGE_INFORMATION_HOW(15), FIND_ALVIAN(16), FIND_ANNA(17), FIND_JEFRI(18), // FIND_LINTONG(19), FIND_MISS_MARGIANTI(20), FIND_MISTER_DENNIS(21), FIND_MISTER_ERY(22), FIND_MISTER_MAULANA(23), FIND_MISTER_MUSA(24); private final int type; ActionType(int type) { this.type = type; } public int id() { return type; } public static void runAction(SpeechRecognition speech, int type, String userWords){ if(type == ActionType.DIRECTION_LEFT.id()){new Direction("left");} if(type == ActionType.DIRECTION_RIGHT.id()){new Direction("right");} if(type == ActionType.DIRECTION_BACKWARD.id()){new Direction("backward");} if(type == ActionType.DIRECTION_FORWARD.id()){new Direction("forward");} if(type == ActionType.DIRECTION_STOP.id()){new Direction("null direction, stopping");} if(type == ActionType.BROWSE_GOOGLE.id()){new Browsing(Browsing.Browse.GOOGLE);} if(type == ActionType.BROWSE_FACEBOOK.id()){new Browsing(Browsing.Browse.FACEBOOK);} if(type == ActionType.BROWSE_YOUTUBE.id()){new Browsing(Browsing.Browse.YOUTUBE);} if(type == ActionType.BROWSE_ALLKPOP.id()){new Browsing(Browsing.Browse.ALLKPOP);} if(type == ActionType.BROWSE_TWITTER.id()){new Browsing(Browsing.Browse.TWITTER);} if(type == ActionType.COLLEGE_INFORMATION_WHAT.id()){new CollegeInformation(speech, "what", userWords);} if(type == ActionType.COLLEGE_INFORMATION_WHEN.id()){new CollegeInformation(speech, "when", userWords);} if(type == ActionType.COLLEGE_INFORMATION_WHERE.id()){new CollegeInformation(speech, "where", userWords);} if(type == ActionType.COLLEGE_INFORMATION_WHO.id()){new CollegeInformation(speech, "who", userWords);} if(type == ActionType.COLLEGE_INFORMATION_HOW.id()){new CollegeInformation(speech, "how", userWords);} if(type == ActionType.FIND_ALVIAN.id()){FindPeople.find(FindPeople.People.ALVIAN);} if(type == ActionType.FIND_ANNA.id()){FindPeople.find(FindPeople.People.ANNA);} if(type == ActionType.FIND_JEFRI.id()){FindPeople.find(FindPeople.People.JEFRI);} // if(type == ActionType.FIND_LINTONG.id()){FindPeople.find(FindPeople.People.LINTONG);} if(type == ActionType.FIND_MISS_MARGIANTI.id()){FindPeople.find(FindPeople.People.MISS_MARGIANTI);} if(type == ActionType.FIND_MISTER_DENNIS.id()){FindPeople.find(FindPeople.People.MISTER_DENNIS);} if(type == ActionType.FIND_MISTER_ERY.id()){FindPeople.find(FindPeople.People.MISTER_ERY);} if(type == ActionType.FIND_MISTER_MAULANA.id()){FindPeople.find(FindPeople.People.MISTER_MAULANA);} if(type == ActionType.FIND_MISTER_MUSA.id()){FindPeople.find(FindPeople.People.MISTER_MUSA);} } }
3e02d5da0f130ef39e609f6ee4f5a5e82a6e7d6d
9,702
java
Java
maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseSourceDir.java
NunoEdgarGFlowHub/maven-plugins
91f90b8075a363e4c592da285cf8324c63a66ffa
[ "Apache-2.0" ]
2
2018-11-23T14:43:28.000Z
2018-12-11T06:34:22.000Z
maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseSourceDir.java
NunoEdgarGFlowHub/maven-plugins
91f90b8075a363e4c592da285cf8324c63a66ffa
[ "Apache-2.0" ]
29
2019-03-04T13:21:49.000Z
2020-10-26T16:17:06.000Z
maven-eclipse-plugin/src/main/java/org/apache/maven/plugin/eclipse/EclipseSourceDir.java
NunoEdgarGFlowHub/maven-plugins
91f90b8075a363e4c592da285cf8324c63a66ffa
[ "Apache-2.0" ]
2
2019-03-01T15:13:39.000Z
2019-03-26T20:20:10.000Z
27.515581
120
0.594667
1,174
package org.apache.maven.plugin.eclipse; /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ import java.util.ArrayList; import java.util.LinkedHashSet; import java.util.List; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.ide.IdeUtils; import org.codehaus.plexus.util.StringUtils; /** * Represent an eclipse source dir. Eclipse has no "main", "test" or "resource" concepts, so two source dirs with the * same path are equal. * <p> * source directories should always have a null output value. * * @author <a href="mailto:[email protected]">Fabrizio Giustina</a> * @version $Id$ */ public class EclipseSourceDir implements Comparable { private static final String PATTERN_SEPARATOR = "|"; private String path; /** * source directories should always have a null output value. */ private String output; /** * List<String> */ private List include; /** * List<String> */ private List exclude; private boolean isResource; private boolean test; private boolean filtering; /** * @param path the eclipse source directory * @param output path output directory * @param isResource true if the directory only contains resources, false if a compilation directory * @param test true if is a test directory, false otherwise * @param include a string in the eclipse pattern format for the include filter * @param exclude a string in the eclipse pattern format for the exclude filter * @param filtering true if filtering should be applied, false otherwise. Note: Filtering will only be applied if * this become a "special directory" by being nested within the default output directory. */ public EclipseSourceDir( String path, String output, boolean isResource, boolean test, List include, List exclude, boolean filtering ) { setPath( path ); this.output = output; this.isResource = isResource; this.test = test; setInclude( include ); setExclude( exclude ); this.filtering = filtering; } /** * Getter for <code>exclude</code>. * * @return Returns the exclude. Never null. */ public List getExclude() { return this.exclude; } /** * Setter for <code>exclude</code>. * * @param exclude The exclude to set. */ public void setExclude( List exclude ) { this.exclude = new ArrayList(); if ( exclude != null ) { this.exclude.addAll( exclude ); } } /** * Getter for <code>include</code>. * * @return Returns the include. Never null. */ public List getInclude() { return this.include; } /** * Setter for <code>include</code>. * * @param include The include to set. */ public void setInclude( List include ) { this.include = new ArrayList(); if ( include != null ) { this.include.addAll( include ); } } /** * @return Returns the exclude as a string pattern suitable for eclipse */ public String getExcludeAsString() { return StringUtils.join( exclude.iterator(), PATTERN_SEPARATOR ); } /** * @return Returns the include as a string pattern suitable for eclipse */ public String getIncludeAsString() { return StringUtils.join( include.iterator(), PATTERN_SEPARATOR ); } /** * Getter for <code>output</code>. * <p> * source directories should always have a null output value. * * @return Returns the output. */ public String getOutput() { return this.output; } /** * Setter for <code>output</code>. * * @param output The output to set. */ public void setOutput( String output ) { this.output = output; } /** * Getter for <code>path</code>. * * @return Returns the path. */ public String getPath() { return this.path; } /** * Setter for <code>path</code>. Converts \\ to / in path. * * @param path The path to set. */ public void setPath( String path ) { this.path = IdeUtils.fixSeparator( path ); } /** * Getter for <code>test</code>. * * @return Returns the test. */ public boolean isTest() { return this.test; } /** * Setter for <code>test</code>. * * @param test The test to set. */ public void setTest( boolean test ) { this.test = test; } /** * Getter for <code>isResource</code>. * * @return Returns the isResource. */ public boolean isResource() { return this.isResource; } /** * Wheter this resource should be copied with filtering. */ public boolean isFiltering() { return filtering; } /** * Wheter this resource should be copied with filtering. * * @param filtering filter resources */ public void setFiltering( boolean filtering ) { this.filtering = filtering; } /** * @see java.lang.Object#equals(java.lang.Object) */ public boolean equals( Object obj ) { return ( obj != null ) && ( obj instanceof EclipseSourceDir ) && this.path.equals( ( (EclipseSourceDir) obj ).path ); } /** * @see java.lang.Object#hashCode() */ public int hashCode() { return this.path.hashCode(); } /** * @see java.lang.Comparable#compareTo(java.lang.Object) */ public int compareTo( Object obj ) { return this.path.compareTo( ( (EclipseSourceDir) obj ).path ); } /** * {@inheritDoc} */ public String toString() { return ( isResource ? "resource " : "source " ) + path + ": " + "output=" + output + ", " + "include=[" + getIncludeAsString() + "], " + "exclude=[" + getExcludeAsString() + "], " + "test=" + test + ", " + "filtering=" + filtering; } /** * Merge with the provided directory. * <p> * If one directory is a source and the other is a resource directory then the result will be a source directory and * any includes or excludes will be removed since Eclipse has no "main", "test" or "resource" concepts. The output * directory will be the source directories value. * <p> * If the two directories are the same resources type (i.e isResource is equal) then the result will be the same * resource type with the includes from each merged together (duplicates will be removed), similarly for the * excludes. No effort is made to ensure that the includes and excludes are disjointed sets. Please fix your pom * instead. * <p> * No support for cases where the test, or filtering values are not identical. * * @param mergeWith the directory to merge with * @throws MojoExecutionException test or filtering values are not identical, or isResource true and output are not * identical */ public boolean merge( EclipseSourceDir mergeWith ) throws MojoExecutionException { if ( isResource != mergeWith.isResource ) { if ( isResource ) { // the output directory is set to the source directory's value output = mergeWith.output; } isResource = false; setInclude( null ); setExclude( null ); } else { LinkedHashSet includesAsSet = new LinkedHashSet(); // if the orginal or merged dir have an empty "include" this means all is included, // so merge includes only if both are not empty if ( !include.isEmpty() && !mergeWith.include.isEmpty() ) { includesAsSet.addAll( include ); includesAsSet.addAll( mergeWith.include ); } include = new ArrayList( includesAsSet ); LinkedHashSet excludesAsSet = new LinkedHashSet(); excludesAsSet.addAll( exclude ); excludesAsSet.addAll( mergeWith.exclude ); exclude = new ArrayList( excludesAsSet ); } if ( !StringUtils.equals( output, mergeWith.output ) ) { // Request to merge when 'output' is not identical return false; } if ( test != mergeWith.test ) { // Request to merge when 'test' is not identical return false; } if ( filtering != mergeWith.filtering ) { // Request to merge when 'filtering' is not identical return false; } return true; } }
3e02d61e0cd32ee8b5988879c18496a17cd4b93f
226
java
Java
src/test/java/life/qbic/portal/portlet/MoosePortletIntegrationTest.java
wow-such-code/Spruce_Moose
ea84967d84f3efa4a2fc3a6d2a2ca2076722afd5
[ "MIT" ]
null
null
null
src/test/java/life/qbic/portal/portlet/MoosePortletIntegrationTest.java
wow-such-code/Spruce_Moose
ea84967d84f3efa4a2fc3a6d2a2ca2076722afd5
[ "MIT" ]
1
2020-05-25T08:05:49.000Z
2020-05-25T08:05:49.000Z
src/test/java/life/qbic/portal/portlet/MoosePortletIntegrationTest.java
wow-such-code/Spruce_Moose
ea84967d84f3efa4a2fc3a6d2a2ca2076722afd5
[ "MIT" ]
null
null
null
16.142857
53
0.685841
1,175
package life.qbic.portal.portlet; import org.junit.Test; /** * Tests for {@link MoosePortlet}. */ public class MoosePortletIntegrationTest { @Test public void testPortletConnectsToRemoteServer() { } }
3e02d6aef0a67a1ae785c105940391aaa064c39a
5,002
java
Java
modules/citrus-core/src/main/java/com/consol/citrus/container/Assert.java
dracoon/citrus
24a8c379976903c902ee70924401cbc37ffa85ce
[ "Apache-2.0" ]
2
2019-11-11T01:00:45.000Z
2020-03-01T15:08:16.000Z
modules/citrus-core/src/main/java/com/consol/citrus/container/Assert.java
dracoon/citrus
24a8c379976903c902ee70924401cbc37ffa85ce
[ "Apache-2.0" ]
1
2016-06-30T07:34:52.000Z
2016-06-30T07:34:52.000Z
modules/citrus-core/src/main/java/com/consol/citrus/container/Assert.java
dracoon/citrus
24a8c379976903c902ee70924401cbc37ffa85ce
[ "Apache-2.0" ]
1
2016-06-30T07:31:14.000Z
2016-06-30T07:31:14.000Z
29.77381
129
0.615754
1,176
/* * Copyright 2006-2010 the original author or authors. * * 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 com.consol.citrus.container; import com.consol.citrus.TestAction; import com.consol.citrus.context.TestContext; import com.consol.citrus.exceptions.CitrusRuntimeException; import com.consol.citrus.exceptions.ValidationException; import com.consol.citrus.validation.matcher.ValidationMatcherUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; /** * Assert exception to happen in nested test action. * * @author Christoph Deppisch * @since 2009 */ public class Assert extends AbstractActionContainer { /** Nested test action */ private TestAction action; /** Asserted exception */ private Class<? extends Throwable> exception = CitrusRuntimeException.class; /** Localized exception message for control */ private String message = null; /** Logger */ private static Logger log = LoggerFactory.getLogger(Assert.class); /** * Default constructor. */ public Assert() { setName("assert"); } @Override public void doExecute(TestContext context) { if (log.isDebugEnabled()) { log.debug("Assert container asserting exceptions of type " + exception); } try { setActiveAction(action); action.execute(context); } catch (Exception e) { log.debug("Validating caught exception ..."); if (!exception.isAssignableFrom(e.getClass())) { throw new ValidationException("Validation failed for asserted exception type - expected: '" + exception + "' but was: '" + e.getClass().getName() + "'", e); } if (message != null) { if (ValidationMatcherUtils.isValidationMatcherExpression(message)) { ValidationMatcherUtils.resolveValidationMatcher("message", e.getLocalizedMessage(), message, context); } else if (!context.replaceDynamicContentInString(message).equals(e.getLocalizedMessage())) { throw new ValidationException("Validation failed for asserted exception message - expected: '" + message + "' but was: '" + e.getLocalizedMessage() + "'", e); } } if (log.isDebugEnabled()) { log.debug("Asserted exception is as expected: " + e.getClass() + ": " + e.getLocalizedMessage()); } log.info("Assert exception validation successful: All values OK"); return; } throw new ValidationException("Missing asserted exception '" + exception + "'"); } /** * Set the nested test action. * @param action the action to set */ public void setAction(TestAction action) { addTestAction(action); } /** * Gets the action. * @return the action */ public TestAction getAction() { return action; } /** * Set the message to send. * @param message the message to set */ public void setMessage(String message) { this.message = message; } /** * Get the message to send. * @return the message */ public String getMessage() { return message; } /** * Gets the exception. * @return the exception */ public Class<? extends Throwable> getException() { return exception; } /** * Sets the exception. * @param exception the exception to set */ public void setException(Class<? extends Throwable> exception) { this.exception = exception; } @Override public Assert addTestAction(TestAction action) { this.action = action; super.addTestAction(action); return this; } @Override public TestAction getTestAction(int index) { if (index == 0) { return action; } else { throw new IndexOutOfBoundsException("Illegal index in action list:" + index); } } @Override public Assert setActions(List<TestAction> actions) { if (actions.size() > 1) { throw new CitrusRuntimeException("Invalid number of nested test actions - only one single nested action is allowed"); } action = actions.get(0); super.setActions(actions); return this; } }
3e02d820e9cb8f46996d9741c0c818ce1886aa6e
326
java
Java
RobotControl/RobotControlGUI/src/de/naoth/rc/manager/ImageManagerBottom.java
tarsoly/NaoTH
dcd2b67ef6bf9953c81d3e1b26e543b5922b7d52
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
RobotControl/RobotControlGUI/src/de/naoth/rc/manager/ImageManagerBottom.java
tarsoly/NaoTH
dcd2b67ef6bf9953c81d3e1b26e543b5922b7d52
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
RobotControl/RobotControlGUI/src/de/naoth/rc/manager/ImageManagerBottom.java
tarsoly/NaoTH
dcd2b67ef6bf9953c81d3e1b26e543b5922b7d52
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
17.157895
69
0.742331
1,177
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package de.naoth.rc.manager; import de.naoth.rc.core.manager.ManagerPlugin; import de.naoth.rc.dataformats.JanusImage; /** * * @author thomas */ public interface ImageManagerBottom extends ManagerPlugin<JanusImage> { }
3e02d83e6952d8bd287e1466bd2c85edfb122ac3
1,773
java
Java
inverno-web/src/main/java/io/inverno/mod/web/ResponseDataEncoder.java
inverno-io/inverno-mods
803919c6d94eccab8a2ec7c1be19e4829c5fc047
[ "Apache-2.0" ]
6
2021-06-10T20:09:38.000Z
2022-03-19T08:37:30.000Z
inverno-web/src/main/java/io/inverno/mod/web/ResponseDataEncoder.java
winterframework-io/winter-mods
039c523628651bc46cb60b12aa75c8ca7d963c34
[ "Apache-2.0" ]
2
2021-09-29T12:17:51.000Z
2021-12-10T20:56:04.000Z
inverno-web/src/main/java/io/inverno/mod/web/ResponseDataEncoder.java
inverno-io/inverno-mods
803919c6d94eccab8a2ec7c1be19e4829c5fc047
[ "Apache-2.0" ]
null
null
null
27.78125
80
0.695163
1,178
/* * Copyright 2021 Jeremy KUHN * * 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 io.inverno.mod.web; import io.netty.buffer.ByteBuf; import io.inverno.mod.base.converter.MediaTypeConverter; import io.inverno.mod.http.server.ResponseData; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; /** * <p> * A response payload producer used to encode the payload from a single object * or many objects. * </p> * * <p> * Implementors should rely on a {@link MediaTypeConverter} to encode a payload * as a publisher of objects to a raw payload as a publisher of {@link ByteBuf}. * </p> * * @author <a href="mailto:[email protected]">Jeremy Kuhn</a> * @since 1.0 * * @see MediaTypeConverter * * @param <A> the type of the object to encode */ public interface ResponseDataEncoder<A> extends ResponseData<A> { /** * <p> * Encodes many objects. * </p> * * @param <T> the type of the object to encode * @param value a flux emitting the objects to encode */ <T extends A> void many(Flux<T> value); /** * <p> * Encodes one object. * </p> * * @param <T> the type of the object to encode * @param value a mono emitting the object to encode */ <T extends A> void one(Mono<T> value); }
3e02d872502fbde95bc21c4d4d21c5ce58010369
3,344
java
Java
src/main/java/file/engine/utils/CachedThreadPoolUtil.java
XUANXUQAQ/File-Engine
ff5f319f8f24452cd9431f39a9e32fd65209def0
[ "MIT" ]
107
2020-02-22T05:10:28.000Z
2022-03-29T16:24:44.000Z
src/main/java/file/engine/utils/CachedThreadPoolUtil.java
tcsr200722/File-Engine
091c663df570d3a35fb4eb5e20e0561f2546fd6a
[ "MIT" ]
8
2021-01-19T09:23:15.000Z
2022-03-24T10:32:59.000Z
src/main/java/file/engine/utils/CachedThreadPoolUtil.java
tcsr200722/File-Engine
091c663df570d3a35fb4eb5e20e0561f2546fd6a
[ "MIT" ]
12
2020-07-23T06:18:13.000Z
2022-03-29T16:24:34.000Z
33.777778
111
0.59988
1,179
package file.engine.utils; import file.engine.configs.Constants; import file.engine.utils.system.properties.IsDebug; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; public enum CachedThreadPoolUtil { INSTANCE; private final ExecutorService cachedThreadPool = new ThreadPoolExecutor( 0, 200, 60L, TimeUnit.SECONDS, new SynchronousQueue<>(), new NamedThreadFactory()); private final AtomicBoolean isShutdown = new AtomicBoolean(false); public static CachedThreadPoolUtil getInstance() { return INSTANCE; } public <T> Future<T> executeTask(Callable<T> todo) { if (isShutdown.get()) { return null; } return cachedThreadPool.submit(todo); } public void executeTask(Runnable todo) { if (isShutdown.get()) { return; } cachedThreadPool.submit(todo); } public void shutdown() { isShutdown.set(true); cachedThreadPool.shutdown(); try { if (!cachedThreadPool.awaitTermination(Constants.THREAD_POOL_AWAIT_TIMEOUT, TimeUnit.SECONDS)) { System.err.println("线程池等待超时"); ThreadPoolExecutor tpe = (ThreadPoolExecutor) cachedThreadPool; int queueSize = tpe.getQueue().size(); System.err.println("当前排队线程数:" + queueSize); int activeCount = tpe.getActiveCount(); System.err.println("当前活动线程数:" + activeCount); long completedTaskCount = tpe.getCompletedTaskCount(); System.err.println("执行完成线程数:" + completedTaskCount); long taskCount = tpe.getTaskCount(); System.err.println("总线程数:" + taskCount); } } catch (InterruptedException e) { e.printStackTrace(); } } private static class NamedThreadFactory implements ThreadFactory { private final ThreadGroup group; private static final AtomicInteger poolNumber = new AtomicInteger(1); private final AtomicInteger threadNumber = new AtomicInteger(1); NamedThreadFactory() { SecurityManager s = System.getSecurityManager(); group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup(); } @Override public Thread newThread(Runnable r) { String name = "pool-" + poolNumber.incrementAndGet() + "-thread-" + threadNumber.getAndIncrement(); if (IsDebug.isDebug()) { name = getStackTraceElement().toString() + threadNumber.getAndIncrement(); } Thread t = new Thread(group, r, name, 0); if (t.isDaemon()) t.setDaemon(false); if (t.getPriority() != Thread.NORM_PRIORITY) t.setPriority(Thread.NORM_PRIORITY); return t; } /** * 用于在debug时查看在哪个位置发出的任务 * 由于执行任务的调用栈长度超过3,所以不会出现数组越界 * * @return stackTraceElement */ private StackTraceElement getStackTraceElement() { StackTraceElement[] stacktrace = Thread.currentThread().getStackTrace(); return stacktrace[8]; } } }
3e02d88ab5b72337d2f76359cfd3ee18f6f5fe85
467
java
Java
sechub-shared-kernel/src/main/java/com/daimler/sechub/sharedkernel/configuration/login/FormLoginConfiguration.java
jonico/sechub
f74f6a7e64f9ef011592733d034845ef7fe7f369
[ "MIT" ]
null
null
null
sechub-shared-kernel/src/main/java/com/daimler/sechub/sharedkernel/configuration/login/FormLoginConfiguration.java
jonico/sechub
f74f6a7e64f9ef011592733d034845ef7fe7f369
[ "MIT" ]
null
null
null
sechub-shared-kernel/src/main/java/com/daimler/sechub/sharedkernel/configuration/login/FormLoginConfiguration.java
jonico/sechub
f74f6a7e64f9ef011592733d034845ef7fe7f369
[ "MIT" ]
null
null
null
23.35
82
0.792291
1,180
package com.daimler.sechub.sharedkernel.configuration.login; import java.util.List; import java.util.Optional; public class FormLoginConfiguration { private Optional<AutoDetectUserLoginConfiguration> autodetect = Optional.empty(); private Optional<List<ScriptEntry>> script = Optional.empty(); public Optional<AutoDetectUserLoginConfiguration> getAutodetect() { return autodetect; } public Optional<List<ScriptEntry>> getScript() { return script; } }
3e02d89aa18ae59ffaa8c04cb10fb5f2c47bb42e
2,123
java
Java
gcsio/src/test/java/com/google/cloud/hadoop/gcsio/StorageRequestFactoryTest.java
Deependra-Patel/hadoop-connectors
485fef373cd0c915b4c1c600cf6eb2c143deedb3
[ "Apache-2.0" ]
174
2015-01-10T01:32:28.000Z
2019-12-24T12:31:19.000Z
gcsio/src/test/java/com/google/cloud/hadoop/gcsio/StorageRequestFactoryTest.java
Deependra-Patel/hadoop-connectors
485fef373cd0c915b4c1c600cf6eb2c143deedb3
[ "Apache-2.0" ]
237
2015-02-27T20:38:58.000Z
2020-01-14T12:20:24.000Z
gcsio/src/test/java/com/google/cloud/hadoop/gcsio/StorageRequestFactoryTest.java
Deependra-Patel/hadoop-connectors
485fef373cd0c915b4c1c600cf6eb2c143deedb3
[ "Apache-2.0" ]
147
2015-01-21T16:07:01.000Z
2019-12-09T14:06:46.000Z
34.803279
100
0.763071
1,181
/* * Copyright 2022 Google Inc. All Rights Reserved. * * 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 com.google.cloud.hadoop.gcsio; import static org.junit.Assert.assertThrows; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.gson.GsonFactory; import com.google.api.services.storage.Storage; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; /** Tests storage requests creation and runtime behavior. */ @RunWith(JUnit4.class) public class StorageRequestFactoryTest { public static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport(); public static final JsonFactory JSON_FACTORY = GsonFactory.getDefaultInstance(); private Storage storage; @Before public void setUp() { storage = new Storage(HTTP_TRANSPORT, JSON_FACTORY, /* httpRequestInitializer= */ null); } @Test public void throwExceptionWhenCallExecute() { String BUCKET = "TEST_BUCKET"; String OBJECT = "TEST_OBJECT"; assertThrows( StorageRequestFactory.WrongRequestTypeException.class, new StorageRequestFactory(storage).objectsGetData(BUCKET, OBJECT)::execute); } @Test public void throwExceptionWhenCallExecuteMedia() { String BUCKET = "TEST_BUCKET"; String OBJECT = "TEST_OBJECT"; assertThrows( StorageRequestFactory.WrongRequestTypeException.class, new StorageRequestFactory(storage).objectsGetMetadata(BUCKET, OBJECT)::executeMedia); } }
3e02d8bfc1f049a6a1715180f79934f9465e48b2
938
java
Java
src/main/java/com/google/security/zynamics/binnavi/standardplugins/utils/FilesizeSorter.java
mayl8822/binnavi
4cfdd91cdda2a6150f537df91a8c4221ae50bb6d
[ "Apache-2.0" ]
3,083
2015-08-19T13:31:12.000Z
2022-03-30T09:22:21.000Z
src/main/java/com/google/security/zynamics/binnavi/standardplugins/utils/FilesizeSorter.java
mayl8822/binnavi
4cfdd91cdda2a6150f537df91a8c4221ae50bb6d
[ "Apache-2.0" ]
99
2015-08-19T14:42:49.000Z
2021-04-13T10:58:32.000Z
src/main/java/com/google/security/zynamics/binnavi/standardplugins/utils/FilesizeSorter.java
mayl8822/binnavi
4cfdd91cdda2a6150f537df91a8c4221ae50bb6d
[ "Apache-2.0" ]
613
2015-08-19T14:15:44.000Z
2022-03-26T04:40:55.000Z
33.5
77
0.752665
1,182
// Copyright 2011-2016 Google LLC // // 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 com.google.security.zynamics.binnavi.standardplugins.utils; import java.io.File; import java.io.Serializable; import java.util.Comparator; public final class FilesizeSorter implements Comparator<File>, Serializable { @Override public int compare(final File lhs, final File rhs) { return (int) (lhs.length() - rhs.length()); } }
3e02d8c8f20464d08a25c0cfa2d39cb4bff7a7b7
2,660
java
Java
app/src/main/java/com/codepath/apps/mysimpletweets/models/User.java
jamiehoabnb/MySimpleTweets
e5b15aefec93e6eee42b55d5dea37996b12bd651
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/codepath/apps/mysimpletweets/models/User.java
jamiehoabnb/MySimpleTweets
e5b15aefec93e6eee42b55d5dea37996b12bd651
[ "Apache-2.0" ]
1
2016-06-06T02:44:02.000Z
2016-06-06T04:12:58.000Z
app/src/main/java/com/codepath/apps/mysimpletweets/models/User.java
jamiehoabnb/MySimpleTweets
e5b15aefec93e6eee42b55d5dea37996b12bd651
[ "Apache-2.0" ]
null
null
null
23.539823
71
0.596617
1,183
package com.codepath.apps.mysimpletweets.models; import com.activeandroid.Model; import com.activeandroid.annotation.Column; import com.activeandroid.annotation.Table; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.parceler.Parcel; import java.util.ArrayList; import java.util.List; @Table(name = "users") @Parcel(analyze={User.class}) public class User extends Model { @Column(name = "name") String name; @Column(name = "uid") long uid; @Column(name = "screen_name") String screenName; @Column(name = "profile_image_url") String profileImageUrl; @Column(name = "tagline") String tagline; @Column(name = "location") String location; @Column(name = "followers_count") int followersCount; @Column(name = "friends_count") int friendsCount; public static List<User> fromJSONArray(JSONArray response) { List<User> list = new ArrayList<>(); for (int i = 0; i < response.length(); i++) { try { User user = User.fromJSON(response.getJSONObject(i)); if (user != null) { list.add(user); } } catch (JSONException e) { e.printStackTrace(); } } return list; } public static User fromJSON(JSONObject json) { User user = new User(); try { user.name = json.getString("name"); user.uid = json.getLong("id"); user.screenName = json.getString("screen_name"); user.location = json.getString("location"); user.profileImageUrl = json.getString("profile_image_url"); user.tagline = json.getString("description"); user.followersCount = json.getInt("followers_count"); user.friendsCount = json.getInt("friends_count"); } catch (JSONException e) { e.printStackTrace(); } return user; } public String getName() { return name; } public long getUid() { return uid; } public String getScreenName() { return screenName; } public String getProfileImageUrl() { return profileImageUrl; } public String getBiggerProfileImageUrl() { return profileImageUrl.replace("normal", "bigger"); } public String getTagline() { return tagline; } public String getLocation() { return location; } public int getFollowersCount() { return followersCount; } public int getFriendsCount() { return friendsCount; } }
3e02d927706352548571056c5d4cf1c97b1361c9
847
java
Java
Examples/src/AsposeCellsExamples/HTML/PrintHeadings.java
aspose-cells/Aspose.Cells-for-Java
c3da6ad874ec7d5b2db1eeff39c5190f782ca137
[ "MIT" ]
90
2016-04-14T10:14:58.000Z
2022-03-29T07:40:21.000Z
Examples/src/AsposeCellsExamples/HTML/PrintHeadings.java
aspose-cells/Aspose.Cells-for-Java
c3da6ad874ec7d5b2db1eeff39c5190f782ca137
[ "MIT" ]
19
2018-03-23T09:50:42.000Z
2021-11-01T09:37:38.000Z
Examples/src/AsposeCellsExamples/HTML/PrintHeadings.java
aspose-cells/Aspose.Cells-for-Java
c3da6ad874ec7d5b2db1eeff39c5190f782ca137
[ "MIT" ]
72
2016-04-09T07:16:12.000Z
2022-03-23T20:28:09.000Z
29.206897
70
0.683589
1,184
package AsposeCellsExamples.HTML; import AsposeCellsExamples.Utils; import com.aspose.cells.HtmlSaveOptions; import com.aspose.cells.Workbook; public class PrintHeadings { static String sourceDir = Utils.Get_SourceDirectory(); static String outputDir = Utils.Get_OutputDirectory(); public static void main(String[] args) throws Exception { // ExStart:1 // Load the Excel file. Workbook workbook = new Workbook(sourceDir + "Book1.xlsx"); // Initialize HtmlSaveOptions HtmlSaveOptions options = new HtmlSaveOptions(); options.setExportHeadings(true); //Save to HTML format workbook.save(outputDir + "PrintHeadings_out.html", options); // ExEnd:1 // Print the message System.out.println("PrintHeadings executed successfully."); } }
3e02db8aac880118955ab8f050d90a29ef80e6e4
10,714
java
Java
spatial-walker/src/main/java/com/rayferric/spatialwalker/Main.java
rayferric/comet
30c1740cb13fc05aba58755e62a754226a892b5d
[ "MIT" ]
null
null
null
spatial-walker/src/main/java/com/rayferric/spatialwalker/Main.java
rayferric/comet
30c1740cb13fc05aba58755e62a754226a892b5d
[ "MIT" ]
null
null
null
spatial-walker/src/main/java/com/rayferric/spatialwalker/Main.java
rayferric/comet
30c1740cb13fc05aba58755e62a754226a892b5d
[ "MIT" ]
null
null
null
45.591489
125
0.574202
1,185
package com.rayferric.spatialwalker; import com.rayferric.comet.core.engine.Engine; import com.rayferric.comet.core.engine.EngineInfo; import com.rayferric.comet.core.engine.Layer; import com.rayferric.comet.core.input.InputKey; import com.rayferric.comet.core.math.*; import com.rayferric.comet.core.nodepack.profiler.ProfilerPack; import com.rayferric.comet.core.scenegraph.common.Collider; import com.rayferric.comet.core.scenegraph.common.Surface; import com.rayferric.comet.core.scenegraph.common.material.GLTFMaterial; import com.rayferric.comet.core.scenegraph.node.*; import com.rayferric.comet.core.scenegraph.node.physics.PhysicsBody; import com.rayferric.comet.core.scenegraph.node.camera.Camera; import com.rayferric.comet.core.scenegraph.node.camera.OrthographicCamera; import com.rayferric.comet.core.scenegraph.node.model.Model; import com.rayferric.comet.core.scenegraph.node.model.Sprite; import com.rayferric.comet.core.scenegraph.resource.audio.AudioStream; import com.rayferric.comet.core.scenegraph.resource.physics.shape.BoxCollisionShape; import com.rayferric.comet.core.scenegraph.resource.scene.GLTFScene; import com.rayferric.comet.core.scenegraph.resource.scene.Scene; import com.rayferric.comet.core.scenegraph.resource.video.mesh.BoxMesh; import com.rayferric.comet.core.scenegraph.resource.video.mesh.Mesh; import com.rayferric.comet.core.scenegraph.resource.video.texture.ImageTexture; import com.rayferric.comet.core.shape.ShapeLoader; import com.rayferric.comet.core.video.api.VideoAPI; import com.rayferric.comet.core.video.util.texture.TextureFilter; import com.rayferric.spatialwalker.pack.Rotor; import com.rayferric.spatialwalker.pack.player.PlayerPack; public class Main { public static void main(String[] args) { Engine engine = Engine.getInstance(); EngineInfo info = new EngineInfo(); info.setWindowTitle("Spatial Walker"); info.setWindowSize(new Vector2i(1280, 720)); info.setVideoApi(VideoAPI.OPENGL); info.setVSync(true); info.setTextureFilter(TextureFilter.TRILINEAR); info.setTextureAnisotropy(8); info.setLoaderThreads(4); info.setJobThreads(4); info.setLayerCount(2); try { engine.start(info); Layer mainLayer = engine.getLayerManager().getLayers()[0]; Layer overlayLayer = engine.getLayerManager().getLayers()[1]; mainLayer.getPhysicsWorld().setGravity(Vector3f.DOWN.mul(9.81F)); /*{ Camera camera = new SpectatorCamera(0.1F, 1000, 80); camera.getTransform().setTranslation(0, 0, 4); mainLayer.getRoot().addChild(camera); mainLayer.setCamera(camera); }*/ { Camera camera = new OrthographicCamera(-1, 1, 2); overlayLayer.setCamera(camera); } Rotor rotor = new Rotor(); { mainLayer.getRoot().addChild(rotor); } { PhysicsBody physicsBody = new PhysicsBody(); physicsBody.addCollider(new Collider(new BoxCollisionShape(new Vector3f(1000, 1, 1000)), Matrix4f.IDENTITY)); physicsBody.setMass(1000); physicsBody.setKinematic(true); Model model = new Model(); model.addSurface(new Surface(new BoxMesh(new Vector3f(32, 1, 32), false), new GLTFMaterial())); physicsBody.addChild(model); physicsBody.getTransform().setTranslation(0, -0.5F, 0); mainLayer.getRoot().addChild(physicsBody); } { PhysicsBody physicsBody = new PhysicsBody(); physicsBody.addCollider(new Collider(new BoxCollisionShape(new Vector3f(32, 1, 32)), Matrix4f.IDENTITY)); physicsBody.setMass(0); Model model = new Model(); model.addSurface(new Surface(new BoxMesh(new Vector3f(32, 1, 32), false), new GLTFMaterial())); physicsBody.addChild(model); physicsBody.getTransform().setTranslation(30, 3, 0); physicsBody.getTransform().setRotation(0, 0, 15); mainLayer.getRoot().addChild(physicsBody); } { PhysicsBody physicsBody = new PhysicsBody(); physicsBody.addCollider(new Collider(new BoxCollisionShape(new Vector3f(4, 1, 2)), Matrix4f.IDENTITY)); physicsBody.setMass(0); Model model = new Model(); model.addSurface(new Surface(new BoxMesh(new Vector3f(4, 1, 2), false), new GLTFMaterial())); physicsBody.addChild(model); physicsBody.getTransform().setTranslation(0, 0, 14); physicsBody.getTransform().setRotation(0, 0, -30); mainLayer.getRoot().addChild(physicsBody); } { PhysicsBody physicsBody = new PhysicsBody(); physicsBody.addCollider(new Collider(new BoxCollisionShape(new Vector3f(32, 2, 32)), Matrix4f.IDENTITY)); physicsBody.setMass(0); Model model = new Model(); model.addSurface(new Surface(new BoxMesh(new Vector3f(32, 2, 32), false), new GLTFMaterial())); physicsBody.addChild(model); physicsBody.getTransform().setTranslation(0, 14, -12); physicsBody.getTransform().setRotation(-90, 0, 0); mainLayer.getRoot().addChild(physicsBody); } { Collider collider = new Collider(new BoxCollisionShape(new Vector3f(1)), Matrix4f.IDENTITY); Mesh mesh = new BoxMesh(new Vector3f(1), false); GLTFMaterial mat = new GLTFMaterial(); mat.setColorMap(new ImageTexture(false, "data/textures/crate.jpg", true)); int numX = 4, numY = 3, numZ = 4; for(int i = -numX; i <= numX; i++) { for(int j = -numX; j <= numZ; j++) { for(int k = 0; k < numY; k++) { PhysicsBody physicsBody = new PhysicsBody(); physicsBody.addCollider(collider); physicsBody.setMass(50); physicsBody.setLinearDrag(0.5F); Model model = new Model(); model.addSurface(new Surface(mesh, mat)); physicsBody.addChild(model); physicsBody.getTransform().setTranslation(i * 1.05F, 0.5F + k * 1.05F, j * 1.05F); mainLayer.getRoot().addChild(physicsBody); } } } } { Sprite sprite = new Sprite(); sprite.setTexture(new ImageTexture(false, "data/textures/texture.png", true)); sprite.getMaterial().setColor(new Vector4f(1, 1, 1, 0.75F)); sprite.getMaterial().setTranslucent(true); sprite.getMaterial().setCulling(false); sprite.getTransform().setScale(2F); rotor.addChild(sprite); } mainLayer.getRoot().initAll(); { Node profiler = ProfilerPack.getInstance().instantiate(); overlayLayer.getRoot().addChild(profiler); } AudioStream audioStream = new AudioStream(false, "data/audio/engine.ogg"); AudioStream audioStream2 = new AudioStream(false, "data/audio/explosion.ogg"); AudioPlayer audioPlayer = new AudioPlayer(); { audioPlayer.setStream(audioStream); audioPlayer.setLooping(true); audioPlayer.setGain(1); audioPlayer.setAttenuationScale(1); audioPlayer.setMinDistance(0); mainLayer.getRoot().addChild(audioPlayer); } { Node player = PlayerPack.getInstance().instantiate(); player.getTransform().setTranslation(0, 0, 10); mainLayer.getRoot().addChild(player); } // Scene scene1 = new GLTFScene("data/local/goldmine.glb"); // Scene scene2 = new GLTFScene("data/local/flight-helmet/FlightHelmet.gltf"); // var ref = new Object() { // public boolean scene1Instantiated = false; //// public boolean scene2Instantiated = false; //// public float timeCounter = 0; // }; // ShapeLoader.load(false, "data/local/goldmine.col"); engine.run((delta) -> { if(engine.getVideoServer().getWindow().shouldClose()) engine.exit(); // if(scene1.isLoaded() && !ref.scene1Instantiated) { // ref.scene1Instantiated = true; // Node modelRoot = scene1.instantiate(); // if(modelRoot instanceof Model) // ((Model)modelRoot).getSurface(0).getMaterial().setCulling(false); // mainLayer.getRoot().addChild(modelRoot); // scene1.unload(); // } if(Engine.getInstance().getInputManager().getKeyJustReleased(InputKey.KEYBOARD_L)) { if(audioPlayer.getStream() == audioStream) audioPlayer.setStream(audioStream2); else audioPlayer.setStream(audioStream); } if(Engine.getInstance().getInputManager().getKeyJustReleased(InputKey.KEYBOARD_U)) { audioPlayer.setLooping(!audioPlayer.isLooping()); } if(Engine.getInstance().getInputManager().getKeyJustReleased(InputKey.KEYBOARD_P)) { audioPlayer.setPlaying(!audioPlayer.isPlaying()); } // if(scene2.isLoaded() && !ref.scene2Instantiated) { // ref.scene2Instantiated = true; // mainLayer.getRoot().addChild(scene2.instantiate()); // scene2.unload(); // } // TODO Debug only, not to waste electricity: try { Thread.sleep(1); } catch(InterruptedException e) { e.printStackTrace(); System.exit(1); } }); engine.stop(); } catch(RuntimeException e) { e.printStackTrace(); System.exit(1); } } }
3e02db9d02b0010522886d4328dfea9f7c9189c2
276
java
Java
jpa/deferred/src/main/java/example/repo/Customer81Repository.java
patel243/spring-data-examples
e5365aefa5a9df4d79ffc124a5bf337ff434838e
[ "Apache-2.0" ]
4,772
2015-01-06T12:36:15.000Z
2022-03-30T13:37:02.000Z
jpa/deferred/src/main/java/example/repo/Customer81Repository.java
patel243/spring-data-examples
e5365aefa5a9df4d79ffc124a5bf337ff434838e
[ "Apache-2.0" ]
519
2015-01-04T17:10:10.000Z
2022-03-30T06:20:17.000Z
jpa/deferred/src/main/java/example/repo/Customer81Repository.java
patel243/spring-data-examples
e5365aefa5a9df4d79ffc124a5bf337ff434838e
[ "Apache-2.0" ]
3,670
2015-01-06T03:47:23.000Z
2022-03-31T12:16:18.000Z
21.230769
80
0.826087
1,186
package example.repo; import example.model.Customer81; import java.util.List; import org.springframework.data.repository.CrudRepository; public interface Customer81Repository extends CrudRepository<Customer81, Long> { List<Customer81> findByLastName(String lastName); }
3e02dc7fcfabe53023348cd0b5948b11382149a5
1,356
java
Java
purchaseorderconsumer/src/main/java/net/kamradtfamily/usedvehicles/purchaseorderconsumer/Main.java
AlexRogalskiy/usedvehicles
eb83fd89beb9b3c9498759e82e28c412ebb70927
[ "MIT" ]
7
2021-01-27T23:08:41.000Z
2022-02-18T11:30:15.000Z
purchaseorderconsumer/src/main/java/net/kamradtfamily/usedvehicles/purchaseorderconsumer/Main.java
rkamradt/usedvehicles
eb83fd89beb9b3c9498759e82e28c412ebb70927
[ "MIT" ]
1
2022-02-18T11:30:22.000Z
2022-02-18T11:30:33.000Z
purchaseorderconsumer/src/main/java/net/kamradtfamily/usedvehicles/purchaseorderconsumer/Main.java
AlexRogalskiy/usedvehicles
eb83fd89beb9b3c9498759e82e28c412ebb70927
[ "MIT" ]
2
2021-08-05T17:46:34.000Z
2022-02-18T11:30:15.000Z
37.666667
80
0.74705
1,187
/* * The MIT License * * Copyright 2021 randalkamradt. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package net.kamradtfamily.usedvehicles.purchaseorderconsumer; /** * * @author randalkamradt */ public class Main { public static void main(String [] argv) { PurchaseOrderConsumer.consume(); } }
3e02ddb85bd628630b0e8c98ff16e8043d783d1c
2,135
java
Java
code/code-tools/src/main/java/br/com/objectos/code/testing/annotation/processing/ResourcesFiler.java
objectos/incubator
881fa1c0eb364be98a627d5072b473d334279027
[ "Apache-2.0" ]
null
null
null
code/code-tools/src/main/java/br/com/objectos/code/testing/annotation/processing/ResourcesFiler.java
objectos/incubator
881fa1c0eb364be98a627d5072b473d334279027
[ "Apache-2.0" ]
null
null
null
code/code-tools/src/main/java/br/com/objectos/code/testing/annotation/processing/ResourcesFiler.java
objectos/incubator
881fa1c0eb364be98a627d5072b473d334279027
[ "Apache-2.0" ]
null
null
null
31.397059
77
0.748946
1,188
/* * Copyright (C) 2014-2022 Objectos Software LTDA. * * 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 br.com.objectos.code.testing.annotation.processing; import br.com.objectos.core.io.Resource; import java.io.IOException; import javax.annotation.processing.Filer; import javax.lang.model.element.Element; import javax.tools.FileObject; import javax.tools.JavaFileManager.Location; import javax.tools.JavaFileObject; public final class ResourcesFiler implements Filer { private static final Filer INSTANCE = new ResourcesFiler(); private ResourcesFiler() {} public static Filer getInstance() { return INSTANCE; } @Override public JavaFileObject createClassFile( CharSequence name, Element... originatingElements) throws IOException { throw new UnsupportedOperationException(); } @Override public FileObject createResource( Location location, CharSequence pkg, CharSequence relativeName, Element... originatingElements) throws IOException { throw new UnsupportedOperationException(); } @Override public JavaFileObject createSourceFile( CharSequence name, Element... originatingElements) throws IOException { throw new UnsupportedOperationException(); } @Override public FileObject getResource( Location location, CharSequence pkg, CharSequence relativeName) throws IOException { String packageName = pkg.toString(); String resourceName = packageName.replace('.', '/') + "/" + relativeName; Resource resource = Resource.getResource(resourceName); return new ResourceFileObject(resource); } }
3e02deb9332b3746547d5a34038e1f8961e2144e
1,967
java
Java
coeey/com/ihealth/communication/control/Bp926Control.java
ankurshukla1993/IOT-test
174c2f0f1b5ff7ef0ffb5eb29b6d68048b0af2b6
[ "Apache-2.0" ]
1
2021-08-21T17:56:56.000Z
2021-08-21T17:56:56.000Z
coeey/com/ihealth/communication/control/Bp926Control.java
ankurshukla1993/IOT-test
174c2f0f1b5ff7ef0ffb5eb29b6d68048b0af2b6
[ "Apache-2.0" ]
null
null
null
coeey/com/ihealth/communication/control/Bp926Control.java
ankurshukla1993/IOT-test
174c2f0f1b5ff7ef0ffb5eb29b6d68048b0af2b6
[ "Apache-2.0" ]
1
2018-11-26T08:56:33.000Z
2018-11-26T08:56:33.000Z
28.926471
159
0.681749
1,189
package com.ihealth.communication.control; import android.content.Context; import com.ihealth.communication.base.comm.BaseComm; import com.ihealth.communication.base.comm.BaseCommCallback; import com.ihealth.communication.ins.A1InsSetforBp7s; import com.ihealth.communication.ins.InsCallback; import com.ihealth.communication.manager.iHealthDevicesManager; public class Bp926Control implements DeviceControl { private Context f1131a; private A1InsSetforBp7s f1132b; private BaseComm f1133c; private String f1134d; public Bp926Control(Context context, BaseComm com, String userName, String mac, String name, InsCallback insCallback, BaseCommCallback mBaseCommCallback) { this.f1133c = com; this.f1131a = context; this.f1134d = mac; this.f1132b = new A1InsSetforBp7s(context, com, userName, mac, name, insCallback, mBaseCommCallback); } public void destroy() { if (this.f1132b != null) { this.f1132b.destroy(); } this.f1132b = null; this.f1131a = null; this.f1133c = null; } public void disconnect() { this.f1133c.disconnect(this.f1134d); } public void getBattery() { this.f1132b.getBatteryLevel(); } public void getFunctionInfo() { this.f1132b.getFunctionInfo(); } public String getIdps() { return iHealthDevicesManager.getInstance().getDevicesIDPS(this.f1134d); } public void getOfflineData(int memSize) { this.f1132b.getOfflineData = true; this.f1132b.setMemory_Size(memSize); this.f1132b.getOffLineDataNum(); } public void getOfflineDataOver() { this.f1132b.offlineDataOver(); } public void getOfflineNum(int memSize) { this.f1132b.getOfflineData = false; this.f1132b.setMemory_Size(memSize); this.f1132b.getOffLineDataNum(); } public void init() { this.f1132b.identify(); } }
3e02deba79af7c4f40c0718a6c0c1e2ecc807649
1,725
java
Java
src/main/java/org/olat/core/util/vfs/VFSMediaMapper.java
JHDSonline/OpenOLAT
449e1f1753162aac458dda15a6baac146ecbdb16
[ "Apache-2.0" ]
191
2018-03-29T09:55:44.000Z
2022-03-23T06:42:12.000Z
src/main/java/org/olat/core/util/vfs/VFSMediaMapper.java
JHDSonline/OpenOLAT
449e1f1753162aac458dda15a6baac146ecbdb16
[ "Apache-2.0" ]
68
2018-05-11T06:19:00.000Z
2022-01-25T18:03:26.000Z
src/main/java/org/olat/core/util/vfs/VFSMediaMapper.java
JHDSonline/OpenOLAT
449e1f1753162aac458dda15a6baac146ecbdb16
[ "Apache-2.0" ]
139
2018-04-27T09:46:11.000Z
2022-03-27T08:52:50.000Z
25.835821
82
0.722126
1,190
/** * <a href="http://www.openolat.org"> * OpenOLAT - Online Learning and Training</a><br> * <p> * Licensed under the Apache License, Version 2.0 (the "License"); <br> * you may not use this file except in compliance with the License.<br> * You may obtain a copy of the License at the * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> * <p> * Unless required by applicable law or agreed to in writing,<br> * software distributed under the License is distributed on an "AS IS" BASIS, <br> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> * See the License for the specific language governing permissions and <br> * limitations under the License. * <p> * Initial code contributed and copyrighted by<br> * frentix GmbH, http://www.frentix.com * <p> */ package org.olat.core.util.vfs; import java.io.File; import javax.servlet.http.HttpServletRequest; import org.olat.core.dispatcher.mapper.Mapper; import org.olat.core.gui.media.MediaResource; /** * * Initial date: 06.02.2018<br> * @author uhensler, [email protected], http://www.frentix.com * */ public class VFSMediaMapper implements Mapper { private VFSLeaf vfsLeaf; public VFSMediaMapper() { } public VFSMediaMapper(VFSLeaf vfsLeaf) { this.vfsLeaf = vfsLeaf; } public VFSMediaMapper(File file) { this.vfsLeaf = new LocalFileImpl(file); } public void setMediaFile(VFSLeaf vfsLeaf) { this.vfsLeaf = vfsLeaf; } public VFSLeaf getVfsLeaf() { return vfsLeaf; } public void setVfsLeaf(VFSLeaf vfsLeaf) { this.vfsLeaf = vfsLeaf; } @Override public MediaResource handle(String relPath, HttpServletRequest request) { return new VFSMediaResource(vfsLeaf); } }
3e02df08b86c99096b106e6caca60027d94400dc
2,478
java
Java
src/main/java/io/github/dhobern/coldp/RankEnum.java
dhobern/CoLDPUtils
26c462bf6833387a739fdfc9e2c64f41502ac5f8
[ "CC0-1.0" ]
1
2020-09-24T08:29:34.000Z
2020-09-24T08:29:34.000Z
src/main/java/io/github/dhobern/coldp/RankEnum.java
dhobern/CoLDPUtils
26c462bf6833387a739fdfc9e2c64f41502ac5f8
[ "CC0-1.0" ]
null
null
null
src/main/java/io/github/dhobern/coldp/RankEnum.java
dhobern/CoLDPUtils
26c462bf6833387a739fdfc9e2c64f41502ac5f8
[ "CC0-1.0" ]
null
null
null
27.533333
84
0.645682
1,191
/* * Copyright 2020 [email protected]. * * 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 io.github.dhobern.coldp; /** * * @author [email protected] */ public enum RankEnum { none(true, false, null), unknown(true, false, null), kingdom(true, false, null), phylum(true, false, null), clazz(true, false, null), order(true, false, null), superfamily(true, false, null), family(true, false, null), subfamily(true, false, null), tribe(true, false, null), subtribe(true, false, null), supergenus(true, false, null), genus(true, false, null), subgenus(true, false, null), species(false, false, null), subspecies(false, true, null), variety(false, true, "var."), form(false, true, "f."), aberration(false, true, "ab."), race(false, true, "race"); private RankEnum() { } private boolean uninomial; private boolean infraspecific; private String infraspecificMarker; RankEnum(boolean uninomial, boolean infraspecific, String infraspecificMarker) { this.uninomial = uninomial; this.infraspecific = infraspecific; this.infraspecificMarker = infraspecificMarker; } public boolean isUninomial() { return uninomial; } public boolean isInfraspecific() { return infraspecific; } public String getInfraspecificMarker() { return infraspecificMarker; } public boolean inSpeciesGroup() { return this.ordinal() >= species.ordinal(); } public boolean infraspecific() { return this.ordinal() > species.ordinal(); } public String toString() { return (this == clazz ? "class" : name()); } public boolean isHigherThan(RankEnum other) { return (this.ordinal() < other.ordinal()); } public boolean isLowerThan(RankEnum other) { return (this.ordinal() > other.ordinal()); } }
3e02df7aec329adf1fe9ca6b689ddc9035c2dd1d
9,175
java
Java
src/main/java/com/vmware/vra/jenkinsplugin/model/iaas/NetworkInterfaceSpecification.java
theuntested/vrealize-automation-plugin-for-jenkins
0e16c9f7945913b5384354032dcc72a091707197
[ "MIT" ]
4
2020-10-02T12:18:13.000Z
2021-09-13T11:45:15.000Z
src/main/java/com/vmware/vra/jenkinsplugin/model/iaas/NetworkInterfaceSpecification.java
prydin/vmware-vra8-jenkins-plugin
d17f02839cf6e43de88c75f2df3cde60f2ca1d90
[ "MIT" ]
5
2020-11-02T21:48:42.000Z
2021-02-19T23:50:17.000Z
src/main/java/com/vmware/vra/jenkinsplugin/model/iaas/NetworkInterfaceSpecification.java
prydin/vmware-vra8-jenkins-plugin
d17f02839cf6e43de88c75f2df3cde60f2ca1d90
[ "MIT" ]
2
2020-10-02T08:59:04.000Z
2020-10-02T12:18:15.000Z
31.421233
100
0.711281
1,192
/* * Copyright (c) 2020 VMware, Inc * * SPDX-License-Identifier: MIT * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /* * VMware Cloud Assembly IaaS API * A multi-cloud IaaS API for Cloud Automation Services * * OpenAPI spec version: 2019-01-15 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ package com.vmware.vra.jenkinsplugin.model.iaas; import com.google.gson.annotations.SerializedName; import io.swagger.v3.oas.annotations.media.Schema; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; /** Specification for attaching nic to machine */ @Schema(description = "Specification for attaching nic to machine") @javax.annotation.Generated( value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2020-09-09T18:26:35.661905-04:00[America/New_York]") public class NetworkInterfaceSpecification { @SerializedName("addresses") private List<String> addresses = null; @SerializedName("customProperties") private Map<String, String> customProperties = null; @SerializedName("securityGroupIds") private List<String> securityGroupIds = null; @SerializedName("name") private String name = null; @SerializedName("description") private String description = null; @SerializedName("networkId") private String networkId = null; @SerializedName("deviceIndex") private Integer deviceIndex = null; public NetworkInterfaceSpecification addresses(List<String> addresses) { this.addresses = addresses; return this; } public NetworkInterfaceSpecification addAddressesItem(String addressesItem) { if (this.addresses == null) { this.addresses = new ArrayList<String>(); } this.addresses.add(addressesItem); return this; } /** * A list of IP addresses allocated or in use by this network interface. * * @return addresses */ @Schema( example = "[ \"10.1.2.190\" ]", description = "A list of IP addresses allocated or in use by this network interface.") public List<String> getAddresses() { return addresses; } public void setAddresses(List<String> addresses) { this.addresses = addresses; } public NetworkInterfaceSpecification customProperties(Map<String, String> customProperties) { this.customProperties = customProperties; return this; } public NetworkInterfaceSpecification putCustomPropertiesItem( String key, String customPropertiesItem) { if (this.customProperties == null) { this.customProperties = new HashMap<String, String>(); } this.customProperties.put(key, customPropertiesItem); return this; } /** * Additional properties that may be used to extend the base type. * * @return customProperties */ @Schema( example = "{ \"awaitIp\" : \"true\" }", description = "Additional properties that may be used to extend the base type.") public Map<String, String> getCustomProperties() { return customProperties; } public void setCustomProperties(Map<String, String> customProperties) { this.customProperties = customProperties; } public NetworkInterfaceSpecification securityGroupIds(List<String> securityGroupIds) { this.securityGroupIds = securityGroupIds; return this; } public NetworkInterfaceSpecification addSecurityGroupIdsItem(String securityGroupIdsItem) { if (this.securityGroupIds == null) { this.securityGroupIds = new ArrayList<String>(); } this.securityGroupIds.add(securityGroupIdsItem); return this; } /** * A list of security group ids which this network interface will be assigned to. * * @return securityGroupIds */ @Schema( description = "A list of security group ids which this network interface will be assigned to.") public List<String> getSecurityGroupIds() { return securityGroupIds; } public void setSecurityGroupIds(List<String> securityGroupIds) { this.securityGroupIds = securityGroupIds; } public NetworkInterfaceSpecification name(String name) { this.name = name; return this; } /** * A human-friendly name used as an identifier in APIs that support this option. * * @return name */ @Schema( description = "A human-friendly name used as an identifier in APIs that support this option.") public String getName() { return name; } public void setName(String name) { this.name = name; } public NetworkInterfaceSpecification description(String description) { this.description = description; return this; } /** * A human-friendly description. * * @return description */ @Schema(description = "A human-friendly description.") public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public NetworkInterfaceSpecification networkId(String networkId) { this.networkId = networkId; return this; } /** * Id of the network instance that this network interface plugs into. * * @return networkId */ @Schema( example = "dcd9", required = true, description = "Id of the network instance that this network interface plugs into.") public String getNetworkId() { return networkId; } public void setNetworkId(String networkId) { this.networkId = networkId; } public NetworkInterfaceSpecification deviceIndex(Integer deviceIndex) { this.deviceIndex = deviceIndex; return this; } /** * The device index of this network interface. * * @return deviceIndex */ @Schema(example = "1", description = "The device index of this network interface.") public Integer getDeviceIndex() { return deviceIndex; } public void setDeviceIndex(Integer deviceIndex) { this.deviceIndex = deviceIndex; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NetworkInterfaceSpecification networkInterfaceSpecification = (NetworkInterfaceSpecification) o; return Objects.equals(this.addresses, networkInterfaceSpecification.addresses) && Objects.equals(this.customProperties, networkInterfaceSpecification.customProperties) && Objects.equals(this.securityGroupIds, networkInterfaceSpecification.securityGroupIds) && Objects.equals(this.name, networkInterfaceSpecification.name) && Objects.equals(this.description, networkInterfaceSpecification.description) && Objects.equals(this.networkId, networkInterfaceSpecification.networkId) && Objects.equals(this.deviceIndex, networkInterfaceSpecification.deviceIndex); } @Override public int hashCode() { return Objects.hash( addresses, customProperties, securityGroupIds, name, description, networkId, deviceIndex); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class NetworkInterfaceSpecification {\n"); sb.append(" addresses: ").append(toIndentedString(addresses)).append("\n"); sb.append(" customProperties: ").append(toIndentedString(customProperties)).append("\n"); sb.append(" securityGroupIds: ").append(toIndentedString(securityGroupIds)).append("\n"); sb.append(" name: ").append(toIndentedString(name)).append("\n"); sb.append(" description: ").append(toIndentedString(description)).append("\n"); sb.append(" networkId: ").append(toIndentedString(networkId)).append("\n"); sb.append(" deviceIndex: ").append(toIndentedString(deviceIndex)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
3e02e21f4249b4895bfa7cedc1ee7d02be75c405
85,346
java
Java
tests/time/rmosa/tests/s1022/102_squirrel-sql/evosuite-tests/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
tests/time/rmosa/tests/s1022/102_squirrel-sql/evosuite-tests/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
3
2020-11-16T20:40:56.000Z
2021-03-23T00:18:04.000Z
tests/time/rmosa/tests/s1022/102_squirrel-sql/evosuite-tests/net/sourceforge/squirrel_sql/plugins/dbcopy/util/DBUtil_ESTest.java
sealuzh/termite-replication
1636b1973c8692ed6a818e323cd1dd826cabbad3
[ "MIT" ]
null
null
null
32.206038
543
0.633457
1,193
/* * This file was automatically generated by EvoSuite * Sun Nov 29 07:22:26 GMT 2020 */ package net.sourceforge.squirrel_sql.plugins.dbcopy.util; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import com.gargoylesoftware.base.resource.jdbc.ConnectionWrapper; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import net.sourceforge.squirrel_sql.client.IApplication; import net.sourceforge.squirrel_sql.client.gui.db.SQLAlias; import net.sourceforge.squirrel_sql.client.session.ISession; import net.sourceforge.squirrel_sql.client.session.schemainfo.SchemaInfo; import net.sourceforge.squirrel_sql.fw.id.IIdentifier; import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectInfo; import net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectType; import net.sourceforge.squirrel_sql.fw.sql.ForeignKeyInfo; import net.sourceforge.squirrel_sql.fw.sql.IDatabaseObjectInfo; import net.sourceforge.squirrel_sql.fw.sql.ISQLConnection; import net.sourceforge.squirrel_sql.fw.sql.ITableInfo; import net.sourceforge.squirrel_sql.fw.sql.SQLConnection; import net.sourceforge.squirrel_sql.fw.sql.SQLDriver; import net.sourceforge.squirrel_sql.fw.sql.SQLDriverPropertyCollection; import net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo; import net.sourceforge.squirrel_sql.plugins.dbcopy.DBCopyPlugin; import net.sourceforge.squirrel_sql.plugins.dbcopy.SessionInfoProvider; import net.sourceforge.squirrel_sql.plugins.dbcopy.prefs.DBCopyPreferenceBean; import net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true) public class DBUtil_ESTest extends DBUtil_ESTest_scaffolding { /** //Test case number: 0 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test000() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("> $5I8$S", "> $5I8$S", "> $5I8$S", "> $5I8$S", 2005, "> $5I8$S", 2005, 2005, 156, (-1204), "> $5I8$S", "> $5I8$S", 2005, 156, "$7z[Il"); boolean boolean0 = DBUtil.isBinaryType(tableColumnInfo0); assertFalse(boolean0); } /** //Test case number: 1 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test001() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("b", "aqx)on", "DBUtil.info.executeupdate", "DBUtil.info.executeupdate", (-5), "DBUtil.info.executeupdate", 4052, (-8), 4052, 4052, (String) null, "aqx)on", (-5), (-8), "DBUtil.info.executeupdate"); int int0 = DBUtil.replaceDistinctDataType(4052, tableColumnInfo0, (ISession) null); assertEquals(4052, int0); } /** //Test case number: 2 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test002() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo(";f_=?\"]", "net.sourceforge.squirrel_sql.client.mainframe.MainFrameWindowState", ";f_=?\"]", "net.sourceforge.squirrel_sql.client.mainframe.MainFrameWindowState", 3303, ";f_=?\"]", 3303, 2001, 2001, 2001, "Skipping FK (", "Skipping FK (", 2001, 3303, "Skipping FK ("); int int0 = DBUtil.replaceOtherDataType(tableColumnInfo0, (ISession) null); assertEquals(3303, int0); } /** //Test case number: 3 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test003() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent((-7), 2458); assertFalse(boolean0); } /** //Test case number: 4 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test004() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent((-4308), (-4308)); assertTrue(boolean0); } /** //Test case number: 5 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test005() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(16, (-3782)); assertFalse(boolean0); } /** //Test case number: 6 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test006() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(10000, 10000); assertTrue(boolean0); } /** //Test case number: 7 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test007() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(3, (-1289)); assertFalse(boolean0); } /** //Test case number: 8 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test008() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); TableColumnInfo tableColumnInfo0 = new TableColumnInfo(" = NULL", "p$.HwcOef{", "cast(?1 as char varying)", "(", 0, "DBUtil.error.maptype", (-1113), (-6), (-1113), (-6), "i(2?!}Fh/Q$lq]]a4Ee", "sha", 1, 0, "("); dBCopyPlugin0.setDestDatabaseObject(tableColumnInfo0); // Undeclared exception! try { DBUtil.getInsertSQL(dBCopyPlugin0, "oracle.jdbc.driver.OracleTypes", (ITableInfo) null, (-1)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 9 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test009() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(2, 9); assertFalse(boolean0); } /** //Test case number: 10 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test010() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("'L{UjD2d", "'L{UjD2d", "'L{UjD2d", "uGzwh0xaRzgW", 0, "Clobs are not cacheable", 0, 0, 0, 0, (String) null, (String) null, 0, 712, (String) null); int int0 = DBUtil.replaceOtherDataType(tableColumnInfo0, (ISession) null); assertEquals(0, int0); } /** //Test case number: 11 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test011() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("1!", "1!", "1!", "1!", (-7), "1!", (-7), 1767, (-2105376123), 1767, "1!", "1!", (-1968526704), (-1968526704), "1!"); int int0 = DBUtil.replaceOtherDataType(tableColumnInfo0, (ISession) null); assertEquals((-7), int0); } /** //Test case number: 12 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test012() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo(",y?Fl~c?a)", (String) null, "^5&4Gi3", " shem=", 16, ",y?Fl~c?a)", 268, 16, 16, 25, " shem=", "", 268, 16, "/ r]y[fc"); String string0 = DBUtil.getSchemaNameFromDbObject(tableColumnInfo0); assertNull(string0); } /** //Test case number: 13 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test013() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(0, 0); assertTrue(boolean0); } /** //Test case number: 14 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test014() throws Throwable { // Undeclared exception! try { DBUtil.tableHasPrimaryKey((ISQLConnection) null, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 15 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test015() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.tableHasForeignKey("net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "`$hODdy1e.ol]", "", (ForeignKeyInfo) null, dBCopyPlugin0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 16 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test016() throws Throwable { ForeignKeyInfo foreignKeyInfo0 = mock(ForeignKeyInfo.class, new ViolatedAssumptionAnswer()); DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.tableHasForeignKey((String) null, (String) null, (String) null, foreignKeyInfo0, dBCopyPlugin0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 17 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test017() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); ForeignKeyInfo foreignKeyInfo0 = mock(ForeignKeyInfo.class, new ViolatedAssumptionAnswer()); // Undeclared exception! try { DBUtil.tableHasForeignKey("net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "", (String) null, foreignKeyInfo0, dBCopyPlugin0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 18 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test018() throws Throwable { ForeignKeyInfo foreignKeyInfo0 = mock(ForeignKeyInfo.class, new ViolatedAssumptionAnswer()); DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.tableHasForeignKey("", "D=", "nb&9aAhwfO", foreignKeyInfo0, dBCopyPlugin0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 19 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test019() throws Throwable { DBUtil.setPreferences((DBCopyPreferenceBean) null); } /** //Test case number: 20 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test020() throws Throwable { DBUtil.setLastStatementValues((String) null); } /** //Test case number: 21 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test021() throws Throwable { DBUtil.setLastStatement((String) null); } /** //Test case number: 22 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test022() throws Throwable { DBUtil.setLastStatement(""); } /** //Test case number: 23 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test023() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", (String) null, "V3efv74<@YKC?u", "AzG I6s0n:IsG<)", (-5), "KB", 45, 939, (-1300), (-5), "AzG I6s0n:IsG<)", (String) null, 934, 280, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy"); int int0 = DBUtil.replaceDistinctDataType(0, tableColumnInfo0, (ISession) null); assertEquals(0, int0); } /** //Test case number: 24 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test024() throws Throwable { int int0 = DBUtil.replaceDistinctDataType((-2), (TableColumnInfo) null, (ISession) null); assertEquals((-2), int0); } /** //Test case number: 25 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test025() throws Throwable { // Undeclared exception! try { DBUtil.isKeyword((ISession) null, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 26 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test026() throws Throwable { // Undeclared exception! try { DBUtil.isKeyword((ISession) null, "wrapper-characters"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 27 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test027() throws Throwable { // Undeclared exception! try { DBUtil.getTables((ISession) null, (String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 28 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test028() throws Throwable { // Undeclared exception! try { DBUtil.getTables((ISession) null, "com.jidesoft.plaf.eclipse.EclipseMenuItemUI$MenuDragMouseHandler", "com.jidesoft.plaf.eclipse.EclipseMenuItemUI$MenuDragMouseHandler", "com.jidesoft.plaf.eclipse.EclipseMenuItemUI$MenuDragMouseHandler"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 29 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test029() throws Throwable { // Undeclared exception! try { DBUtil.getTableInfo((ISession) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 30 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test030() throws Throwable { // Undeclared exception! try { DBUtil.getTableInfo((ISession) null, "NORMAL", "NORMAL"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 31 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test031() throws Throwable { // Undeclared exception! try { DBUtil.getTableCount((ISession) null, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", 2); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 32 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test032() throws Throwable { // Undeclared exception! try { DBUtil.getTableCount((ISession) null, (String) null, "1U:%v(twwz8=oE", (String) null, (-1869)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 33 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test033() throws Throwable { // Undeclared exception! try { DBUtil.getTableCount((ISession) null, (String) null, "", "DBUtil.info.executeupdate", (-1869)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 34 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test034() throws Throwable { // Undeclared exception! try { DBUtil.getTableCount((ISession) null, (String) null, (String) null, "?%rb+5Djc%_7mMH}", (-1869)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 35 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test035() throws Throwable { // Undeclared exception! try { DBUtil.getTableCount((ISession) null, "", "7(r^2MyEmX@Qi8k9u,]", "", (-1073741822)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 36 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test036() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getSelectQuery(dBCopyPlugin0, (String) null, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 37 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test037() throws Throwable { // Undeclared exception! try { DBUtil.getSelectQuery((SessionInfoProvider) null, "invalid Hibernate type for cast()", (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 38 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test038() throws Throwable { // Undeclared exception! try { DBUtil.getSchemaFromDbObject((IDatabaseObjectInfo) null, (SchemaInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 39 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test039() throws Throwable { // Undeclared exception! try { DBUtil.getQualifiedObjectName((ISession) null, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", 0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 40 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test040() throws Throwable { // Undeclared exception! try { DBUtil.getQualifiedObjectName((ISession) null, "", (String) null, (String) null, (-565)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 41 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test041() throws Throwable { // Undeclared exception! try { DBUtil.getQualifiedObjectName((ISession) null, (String) null, "@<c;.'Y@efo-$x", "|aXB2x]", (-1718)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 42 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test042() throws Throwable { // Undeclared exception! try { DBUtil.getQualifiedObjectName((ISession) null, "", "", "", (-453)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 43 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test043() throws Throwable { // Undeclared exception! try { DBUtil.getMaxColumnLengthSQL((ISession) null, (TableColumnInfo) null, "6c]$S=z", true); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 44 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test044() throws Throwable { // Undeclared exception! try { DBUtil.getMaxColumnLengthSQL((ISession) null, (TableColumnInfo) null, "6c]$S=z", false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 45 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test045() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "select last_insert_id()", 5611, "7(r^2MyEmX@Qi8k9u,]", 5611, (-683), (-683), 5611, "", "J;\"@_JMcYi_KXe", (-786), (-498), "7(r^2MyEmX@Qi8k9u,]"); // Undeclared exception! try { DBUtil.getMaxColumnLengthSQL((ISession) null, tableColumnInfo0, "", false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 46 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test046() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getInsertSQL(dBCopyPlugin0, " CHAR(10) )", (ITableInfo) null, 0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 47 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test047() throws Throwable { // Undeclared exception! try { DBUtil.getInsertSQL((SessionInfoProvider) null, (String) null, (ITableInfo) null, (-2034458190)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 48 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test048() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getInsertSQL(dBCopyPlugin0, "", (ITableInfo) null, (-1476)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 49 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test049() throws Throwable { // Undeclared exception! try { DBUtil.getInsertSQL((SessionInfoProvider) null, "invalid Hibernate type for cast()", (ITableInfo) null, 700); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 50 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test050() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); ArrayList<ITableInfo> arrayList0 = new ArrayList<ITableInfo>(); arrayList0.add((ITableInfo) null); // Undeclared exception! try { DBUtil.getForeignKeySQL(dBCopyPlugin0, (ITableInfo) null, arrayList0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 51 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test051() throws Throwable { ArrayList<ITableInfo> arrayList0 = new ArrayList<ITableInfo>(); // Undeclared exception! try { DBUtil.getForeignKeySQL((SessionInfoProvider) null, (ITableInfo) null, arrayList0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 52 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test052() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getCreateTableSql(dBCopyPlugin0, (ITableInfo) null, "", "i(2?!}Fh/Q$lq]]a4Ee", ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 53 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test053() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getCreateTableSql(dBCopyPlugin0, (ITableInfo) null, "Null 'rowKey' argument.", (String) null, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 54 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test054() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getCreateTableSql(dBCopyPlugin0, (ITableInfo) null, "fixCase: unexpected exception: ", "", "T9 nXb#"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 55 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test055() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getCreateTableSql(dBCopyPlugin0, (ITableInfo) null, (String) null, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 56 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test056() throws Throwable { // Undeclared exception! try { DBUtil.getCreateTableSql((SessionInfoProvider) null, (ITableInfo) null, "", "@uQMnbVtv`L", "org.jfree.data.gantt.SlidingGanttCategoryDataset"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 57 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test057() throws Throwable { String[] stringArray0 = new String[1]; // Undeclared exception! try { DBUtil.getColumnTypes((ISQLConnection) null, (ITableInfo) null, stringArray0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 58 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test058() throws Throwable { String[] stringArray0 = new String[0]; // Undeclared exception! try { DBUtil.getColumnTypes((ISQLConnection) null, (ITableInfo) null, stringArray0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 59 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test059() throws Throwable { int int0 = DBUtil.getColumnType((ISQLConnection) null, (ITableInfo) null, (String) null); assertEquals((-1), int0); } /** //Test case number: 60 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test060() throws Throwable { int int0 = DBUtil.getColumnType((ISQLConnection) null, (ITableInfo) null, ""); assertEquals((-1), int0); } /** //Test case number: 61 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test061() throws Throwable { // Undeclared exception! try { DBUtil.getColumnType((ISQLConnection) null, (ITableInfo) null, (-640)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 62 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test062() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("DBUtil.info.executeupdate", "", "", "CCBGT.6dE$Ptw", 3519, "", 3519, 4052, (-1239), 34, "", ")D", 4052, 43, (String) null); DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getColumnSql(dBCopyPlugin0, tableColumnInfo0, "U ", ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 63 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test063() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getColumnSql(dBCopyPlugin0, (TableColumnInfo) null, "QfYNPYo6JTndM/lk(", (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 64 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test064() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo(">t", ">t", ">t", ">t", 1544, "a4J2+Ok|", 1544, (-172), 1544, 1544, " add index ", "9%h", (-131), (-172), ">t"); DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getColumnSql(dBCopyPlugin0, tableColumnInfo0, "", " add index "); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 65 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test065() throws Throwable { Connection connection0 = mock(Connection.class, new ViolatedAssumptionAnswer()); ConnectionWrapper connectionWrapper0 = new ConnectionWrapper(connection0); SQLDriverPropertyCollection sQLDriverPropertyCollection0 = new SQLDriverPropertyCollection(); SQLDriver sQLDriver0 = new SQLDriver(); SQLConnection sQLConnection0 = new SQLConnection(connectionWrapper0, sQLDriverPropertyCollection0, sQLDriver0); // Undeclared exception! try { DBUtil.getColumnNames(sQLConnection0, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData", e); } } /** //Test case number: 66 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test066() throws Throwable { // Undeclared exception! try { DBUtil.getColumnName((ISQLConnection) null, (ITableInfo) null, 383); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 67 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test067() throws Throwable { // Undeclared exception! try { DBUtil.getColumnList((TableColumnInfo[]) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 68 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test068() throws Throwable { TableColumnInfo[] tableColumnInfoArray0 = new TableColumnInfo[0]; String string0 = DBUtil.getColumnList(tableColumnInfoArray0); assertEquals("", string0); } /** //Test case number: 69 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test069() throws Throwable { Connection connection0 = mock(Connection.class, new ViolatedAssumptionAnswer()); SQLAlias sQLAlias0 = new SQLAlias(); SQLDriverPropertyCollection sQLDriverPropertyCollection0 = sQLAlias0.getDriverPropertiesClone(); SQLDriver sQLDriver0 = new SQLDriver((IIdentifier) null); SQLConnection sQLConnection0 = new SQLConnection(connection0, sQLDriverPropertyCollection0, sQLDriver0); // Undeclared exception! try { DBUtil.getColumnCount(sQLConnection0, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.fw.sql.SQLDatabaseMetaData", e); } } /** //Test case number: 70 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test070() throws Throwable { // Undeclared exception! try { DBUtil.executeUpdate((ISQLConnection) null, (String) null, true); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 71 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test071() throws Throwable { // Undeclared exception! try { DBUtil.executeUpdate((ISQLConnection) null, "ktey", false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 72 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test072() throws Throwable { // Undeclared exception! try { DBUtil.executeQuery((ISession) null, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 73 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test073() throws Throwable { // Undeclared exception! try { DBUtil.executeQuery((ISession) null, "v_$;~Z^c%61"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 74 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test074() throws Throwable { // Undeclared exception! try { DBUtil.dropTable((String) null, (String) null, (String) null, (ISession) null, true, 0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 75 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test075() throws Throwable { // Undeclared exception! try { DBUtil.dropTable((String) null, (String) null, (String) null, (ISession) null, true, 200); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 76 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test076() throws Throwable { // Undeclared exception! try { DBUtil.dropTable("", "", "", (ISession) null, false, 305); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 77 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test077() throws Throwable { // Undeclared exception! try { DBUtil.deleteDataInExistingTable((ISession) null, "hlO[d_vM", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 78 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test078() throws Throwable { // Undeclared exception! try { DBUtil.deleteDataInExistingTable((ISession) null, (String) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 79 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test079() throws Throwable { // Undeclared exception! try { DBUtil.deleteDataInExistingTable((ISession) null, "", "", "x"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 80 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test080() throws Throwable { IDatabaseObjectInfo[] iDatabaseObjectInfoArray0 = new IDatabaseObjectInfo[0]; List<ITableInfo> list0 = DBUtil.convertObjectArrayToTableList(iDatabaseObjectInfoArray0); assertTrue(list0.isEmpty()); } /** //Test case number: 81 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test081() throws Throwable { // Undeclared exception! try { DBUtil.checkKeyword((ISession) null, (String) null, (String) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 82 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test082() throws Throwable { // Undeclared exception! try { DBUtil.checkKeyword((ISession) null, "", ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 83 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test083() throws Throwable { Connection connection0 = mock(Connection.class, new ViolatedAssumptionAnswer()); doReturn((DatabaseMetaData) null).when(connection0).getMetaData(); SQLDriver sQLDriver0 = new SQLDriver(); SQLConnection sQLConnection0 = new SQLConnection(connection0, (SQLDriverPropertyCollection) null, sQLDriver0); // Undeclared exception! try { DBUtil.tableHasPrimaryKey(sQLConnection0, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 84 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test084() throws Throwable { ForeignKeyInfo foreignKeyInfo0 = mock(ForeignKeyInfo.class, new ViolatedAssumptionAnswer()); // Undeclared exception! try { DBUtil.tableHasForeignKey((String) null, "'", ") isn't a positive integer.", foreignKeyInfo0, (SessionInfoProvider) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 85 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test085() throws Throwable { // Undeclared exception! try { DBUtil.sanityCheckPreferences((ISession) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 86 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test086() throws Throwable { // Undeclared exception! try { DBUtil.sameDatabaseType((ISession) null, (ISession) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 87 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test087() throws Throwable { // Undeclared exception! try { DBUtil.replaceOtherDataType((TableColumnInfo) null, (ISession) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 88 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test088() throws Throwable { // Undeclared exception! try { DBUtil.isKeyword((ISession) null, ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 89 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test089() throws Throwable { // Undeclared exception! try { DBUtil.isBinaryType((TableColumnInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 90 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test090() throws Throwable { // Undeclared exception! try { DBUtil.getTableInfo((ISession) null, "", ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 91 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test091() throws Throwable { // Undeclared exception! try { DBUtil.getSchemaNameFromDbObject((IDatabaseObjectInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 92 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test092() throws Throwable { DatabaseObjectInfo databaseObjectInfo0 = new DatabaseObjectInfo("YQ", "YQ", "YQ"); SchemaInfo schemaInfo0 = new SchemaInfo((IApplication) null); // Undeclared exception! try { DBUtil.getSchemaFromDbObject(databaseObjectInfo0, schemaInfo0); fail("Expecting exception: IllegalArgumentException"); } catch(IllegalArgumentException e) { // // SQLDatabaseMetaData == null // verifyException("net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectInfo", e); } } /** //Test case number: 93 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test093() throws Throwable { // Undeclared exception! try { DBUtil.getPKColumnString((ISQLConnection) null, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 94 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test094() throws Throwable { // Undeclared exception! try { DBUtil.getMaxColumnLengthSQL((ISession) null, (TableColumnInfo) null, (String) null, false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 95 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test095() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getForeignKeySQL(dBCopyPlugin0, (ITableInfo) null, (ArrayList<ITableInfo>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 96 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test096() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); ArrayList<ITableInfo> arrayList0 = new ArrayList<ITableInfo>(); List<IDatabaseObjectInfo> list0 = DBUtil.convertTableToObjectList(arrayList0); dBCopyPlugin0.setSourceDatabaseObjects(list0); // Undeclared exception! try { DBUtil.getCreateTableSql(dBCopyPlugin0, (ITableInfo) null, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy"); fail("Expecting exception: IndexOutOfBoundsException"); } catch(IndexOutOfBoundsException e) { // // Index: 0, Size: 0 // verifyException("java.util.ArrayList", e); } } /** //Test case number: 97 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test097() throws Throwable { // Undeclared exception! try { DBUtil.getColumnTypes((ISQLConnection) null, (ITableInfo) null, (String[]) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 98 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test098() throws Throwable { // Undeclared exception! try { DBUtil.getColumnTypes((ISQLConnection) null, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 99 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test099() throws Throwable { // Undeclared exception! try { DBUtil.getColumnNames((ISQLConnection) null, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 100 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test100() throws Throwable { // Undeclared exception! try { DBUtil.fixCase((ISession) null, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 101 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test101() throws Throwable { // Undeclared exception! try { DBUtil.executeUpdate((ISQLConnection) null, "", false); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 102 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test102() throws Throwable { // Undeclared exception! try { DBUtil.executeQuery((ISession) null, ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 103 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test103() throws Throwable { // Undeclared exception! try { DBUtil.dropTable(" CASCADE", " CASCADE", "p$.HwcOef{", (ISession) null, true, (-40)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 104 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test104() throws Throwable { // Undeclared exception! try { DBUtil.convertTableToObjectList((List<ITableInfo>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 105 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test105() throws Throwable { // Undeclared exception! try { DBUtil.convertObjectToTableList((List<IDatabaseObjectInfo>) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 106 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test106() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "QfwNXYo6JTndM/lk(", "dJ^9Y%4;hx 'bP8S@,", "QfwNXYo6JTndM/lk(", 1276, "QfwNXYo6JTndM/lk(", 1276, 1276, 2147000000, 2147000000, "QfwNXYo6JTndM/lk(", "QfwNXYo6JTndM/lk(", 1276, 1276, "dJ^9Y%4;hx 'bP8S@,"); ArrayList<IDatabaseObjectInfo> arrayList0 = new ArrayList<IDatabaseObjectInfo>(); arrayList0.add((IDatabaseObjectInfo) tableColumnInfo0); // Undeclared exception! try { DBUtil.convertObjectToTableList(arrayList0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // net.sourceforge.squirrel_sql.fw.sql.TableColumnInfo cannot be cast to net.sourceforge.squirrel_sql.fw.sql.ITableInfo // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 107 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test107() throws Throwable { // Undeclared exception! try { DBUtil.convertObjectArrayToTableList((IDatabaseObjectInfo[]) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 108 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test108() throws Throwable { DatabaseObjectInfo databaseObjectInfo0 = new DatabaseObjectInfo("wSvrDTW({4s3%''8T^;", ".*", ".*"); IDatabaseObjectInfo[] iDatabaseObjectInfoArray0 = new IDatabaseObjectInfo[2]; iDatabaseObjectInfoArray0[0] = (IDatabaseObjectInfo) databaseObjectInfo0; // Undeclared exception! try { DBUtil.convertObjectArrayToTableList(iDatabaseObjectInfoArray0); fail("Expecting exception: ClassCastException"); } catch(ClassCastException e) { // // net.sourceforge.squirrel_sql.fw.sql.DatabaseObjectInfo cannot be cast to net.sourceforge.squirrel_sql.fw.sql.ITableInfo // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 109 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test109() throws Throwable { DatabaseObjectInfo databaseObjectInfo0 = new DatabaseObjectInfo("/ r]y[fc", "/ r]y[fc", "/ r]y[fc"); DatabaseObjectType databaseObjectType0 = DatabaseObjectType.SCHEMA; databaseObjectInfo0.replaceDatabaseObjectTypeConstantObjectsByConstantObjectsOfThisVM(databaseObjectType0); IDatabaseObjectInfo iDatabaseObjectInfo0 = DBUtil.getSchemaFromDbObject(databaseObjectInfo0, (SchemaInfo) null); assertEquals("/ r]y[fc", iDatabaseObjectInfo0.getQualifiedName()); } /** //Test case number: 110 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test110() throws Throwable { DatabaseObjectInfo databaseObjectInfo0 = new DatabaseObjectInfo("org.jfree.ui.FilesystemFilter", "org.jfree.ui.FilesystemFilter", "DBUtil.info.bindblobmem"); DatabaseObjectType databaseObjectType0 = DatabaseObjectType.SCHEMA; databaseObjectInfo0.replaceDatabaseObjectTypeConstantObjectsByConstantObjectsOfThisVM(databaseObjectType0); String string0 = DBUtil.getSchemaNameFromDbObject(databaseObjectInfo0); assertEquals("DBUtil.info.bindblobmem", string0); } /** //Test case number: 111 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test111() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("", "", "", "fu", (-6), "@&>ii>G", (-6), (-3948), 0, 0, "", "?%b+5Djc%_7mMH}", 4000, 0, "@&>ii>G"); String string0 = DBUtil.getSchemaNameFromDbObject(tableColumnInfo0); assertEquals("", string0); } /** //Test case number: 112 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test112() throws Throwable { IDatabaseObjectInfo[] iDatabaseObjectInfoArray0 = new IDatabaseObjectInfo[9]; List<ITableInfo> list0 = DBUtil.convertObjectArrayToTableList(iDatabaseObjectInfoArray0); assertEquals(9, list0.size()); } /** //Test case number: 113 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test113() throws Throwable { LinkedList<IDatabaseObjectInfo> linkedList0 = new LinkedList<IDatabaseObjectInfo>(); linkedList0.add((IDatabaseObjectInfo) null); List<ITableInfo> list0 = DBUtil.convertObjectToTableList(linkedList0); List<IDatabaseObjectInfo> list1 = DBUtil.convertTableToObjectList(list0); assertEquals(1, list1.size()); } /** //Test case number: 114 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test114() throws Throwable { LinkedList<IDatabaseObjectInfo> linkedList0 = new LinkedList<IDatabaseObjectInfo>(); List<ITableInfo> list0 = DBUtil.convertObjectToTableList(linkedList0); assertTrue(list0.isEmpty()); } /** //Test case number: 115 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test115() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); DBUtil.validateColumnNames((ITableInfo) null, dBCopyPlugin0); assertEquals("DBCopy Plugin", dBCopyPlugin0.getDescriptiveName()); } /** //Test case number: 116 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test116() throws Throwable { String string0 = DBUtil.fixCase((ISession) null, ""); assertEquals("", string0); } /** //Test case number: 117 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test117() throws Throwable { String string0 = DBUtil.fixCase((ISession) null, (String) null); assertNull(string0); } /** //Test case number: 118 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test118() throws Throwable { // Undeclared exception! try { DBUtil.getQualifiedObjectName((ISession) null, "y,=liDl+C;d5", "org.jfree.data.gantt.SlidingGanttCategoryDataset", "y,=liDl+C;d5", 1); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 119 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test119() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("JCom>ponent == nul", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "sha", "JCom>ponent == nul", (-4), ")l}FRlb((4", (-211), (-4), (-4), (-4), "bytea", "sha", 588, (-211), ")l}FRlb((4"); boolean boolean0 = DBUtil.isBinaryType(tableColumnInfo0); assertTrue(boolean0); } /** //Test case number: 120 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test120() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("varbinary(31982)", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "varbinary(31982)", "DBUtil.error.nocolumns", 2004, "varbinary(31982)", 2004, 2004, 3091, 2517, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "DBUtil.error.nocolumns", (-3392), 1560, "varbinary(31982)"); boolean boolean0 = DBUtil.isBinaryType(tableColumnInfo0); assertTrue(boolean0); } /** //Test case number: 121 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test121() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("", "", "", "fu", (-6), "@&>ii>G", (-6), (-3948), 0, 0, "", "?%b+5Djc%_7mMH}", 4000, 0, "@&>ii>G"); boolean boolean0 = DBUtil.isBinaryType(tableColumnInfo0); assertFalse(boolean0); } /** //Test case number: 122 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test122() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("o[htfIG%BK", "o[htfIG%BK", (String) null, "o[htfIG%BK", (-2), "e;:*M!+.]I83", (-3718), 4458, (-3718), (-3718), "e;:*M!+.]I83", "e;:*M!+.]I83", (-2118), (-2), "e;:*M!+.]I83"); boolean boolean0 = DBUtil.isBinaryType(tableColumnInfo0); assertTrue(boolean0); } /** //Test case number: 123 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test123() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo((String) null, "sha", ">=4,", ", ", 23503, "org.jfree.data.gantt.SlidingGanttCategoryDataset", (-3014), 2002, 23503, (-3014), "Couldn't find an exact match for destination table ", "org.jboss.net.protocol.DelegatingURLConnection", (-3014), (-3014), "sha"); DBCopyPreferenceBean dBCopyPreferenceBean0 = new DBCopyPreferenceBean(); DBUtil.setPreferences(dBCopyPreferenceBean0); // Undeclared exception! try { DBUtil.getColumnSql((SessionInfoProvider) null, tableColumnInfo0, (String) null, ", "); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 124 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test124() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", 4, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", 4, 4, 4, 3091, "Couldn't find an exact match for destination table ", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", 3091, 1111, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy"); TableColumnInfo[] tableColumnInfoArray0 = new TableColumnInfo[2]; tableColumnInfoArray0[0] = tableColumnInfo0; // Undeclared exception! try { DBUtil.getColumnList(tableColumnInfoArray0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 125 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test125() throws Throwable { TableColumnInfo[] tableColumnInfoArray0 = new TableColumnInfo[1]; TableColumnInfo tableColumnInfo0 = new TableColumnInfo("0", "0", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "0", (-6), "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", (-6), (-6), (-6), (-6), "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "Lie@", (-6), (-6), "Lie@"); tableColumnInfoArray0[0] = tableColumnInfo0; String string0 = DBUtil.getColumnList(tableColumnInfoArray0); assertEquals("0", string0); } /** //Test case number: 126 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test126() throws Throwable { int int0 = DBUtil.getColumnType((ISQLConnection) null, (ITableInfo) null, "p$.HwcOef{"); assertEquals((-1), int0); } /** //Test case number: 127 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test127() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, 1448, 1448, 1448, (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 128 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test128() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, 2000, (-1163), 2000, (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 129 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test129() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, 12, (-3445), 12, (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 130 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test130() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, 8, (-1639), 2848, (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 131 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test131() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, (-1), (-1163), (-1), (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 132 /*Coverage entropy=0.13579395875159386 */ @Test(timeout = 4000) public void test132() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, (-3), 1032, 118, (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 133 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test133() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, (-5), (-1376), (-5), (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 134 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test134() throws Throwable { // Undeclared exception! try { DBUtil.bindVariable((PreparedStatement) null, (-7), (-7), (-1163), (ResultSet) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 135 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test135() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("_eSXo-J#=pl]D", "_eSXo-J#=pl]D", "_eSXo-J#=pl]D", "_eSXo-J#=pl]D", 25, "_eSXo-J#=pl]D", 4, 25, 716, 268, "_eSXo-J#=pl]D", "_eSXo-J#=pl]D", (-1145), 25, "_eSXo-J#=pl]D"); // Undeclared exception! try { DBUtil.replaceDistinctDataType(2001, tableColumnInfo0, (ISession) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 136 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test136() throws Throwable { TableColumnInfo tableColumnInfo0 = new TableColumnInfo("net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", 1111, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", 1784, (-187), (-187), 1111, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", (-187), (-187), "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy"); int int0 = DBUtil.replaceOtherDataType(tableColumnInfo0, (ISession) null); assertEquals(1111, int0); } /** //Test case number: 137 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test137() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent((-7), (-7)); assertTrue(boolean0); } /** //Test case number: 138 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test138() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(2, 2); assertTrue(boolean0); } /** //Test case number: 139 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test139() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(3, 2); assertTrue(boolean0); } /** //Test case number: 140 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test140() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(3, 3); assertTrue(boolean0); } /** //Test case number: 141 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test141() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(16, 16); assertTrue(boolean0); } /** //Test case number: 142 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test142() throws Throwable { boolean boolean0 = DBUtil.typesAreEquivalent(16, (-7)); assertTrue(boolean0); } /** //Test case number: 143 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test143() throws Throwable { // Undeclared exception! try { DBUtil.getTables((ISession) null, "", "", ""); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 144 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test144() throws Throwable { DBCopyPlugin dBCopyPlugin0 = new DBCopyPlugin(); // Undeclared exception! try { DBUtil.getSelectQuery(dBCopyPlugin0, "", (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 145 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test145() throws Throwable { // Undeclared exception! try { DBUtil.getColumnCount((ISQLConnection) null, (ITableInfo) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 146 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test146() throws Throwable { // Undeclared exception! try { DBUtil.getCatSep((ISession) null); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 147 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test147() throws Throwable { DBUtil dBUtil0 = new DBUtil(); assertNull(dBUtil0.getLastStatementValues()); } /** //Test case number: 148 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test148() throws Throwable { DBUtil.setLastStatementValues("DBUtil.error.tablenotfound"); } /** //Test case number: 149 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test149() throws Throwable { // Undeclared exception! try { DBUtil.getColumnName((ISQLConnection) null, (ITableInfo) null, (-1432)); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 150 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test150() throws Throwable { DBUtil.setLastStatement(" CASCADE"); } /** //Test case number: 151 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test151() throws Throwable { // Undeclared exception! try { DBUtil.getColumnType((ISQLConnection) null, (ITableInfo) null, 7); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 152 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test152() throws Throwable { String string0 = DBUtil.getLastStatement(); assertNull(string0); } /** //Test case number: 153 /*Coverage entropy=0.6931471805599453 */ @Test(timeout = 4000) public void test153() throws Throwable { // Undeclared exception! try { DBUtil.checkKeyword((ISession) null, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy"); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 154 /*Coverage entropy=0.6365141682948128 */ @Test(timeout = 4000) public void test154() throws Throwable { // Undeclared exception! try { DBUtil.getTableCount((ISession) null, "net.sourceforge.squirrel_sql.plugins.dbcopy.dbcopy", "I6ET6z-", "DBUtil.info.executeupdate", 0); fail("Expecting exception: NullPointerException"); } catch(NullPointerException e) { // // no message in exception (getMessage() returned null) // verifyException("net.sourceforge.squirrel_sql.plugins.dbcopy.util.DBUtil", e); } } /** //Test case number: 155 /*Coverage entropy=-0.0 */ @Test(timeout = 4000) public void test155() throws Throwable { String string0 = DBUtil.getLastStatementValues(); assertNull(string0); } }
3e02e2d7be160fd48025718beabd44091785aa65
603
java
Java
LACCPlus/ActiveMQ/5_1.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
LACCPlus/ActiveMQ/5_1.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
LACCPlus/ActiveMQ/5_1.java
sgholamian/log-aware-clone-detection
9993cb081c420413c231d1807bfff342c39aa69a
[ "MIT" ]
null
null
null
28.714286
82
0.462687
1,194
//,temp,JmsConsumerClient.java,173,188,temp,JmsConsumerClient.java,136,145 //,3 public class xxx { @Override public void onMessage(Message msg) { incThroughput(); sleep(); recvCount.incrementAndGet(); synchronized (recvCount) { recvCount.notify(); } try { commitTxIfNecessary(); } catch (JMSException ex) { LOG.error("Error committing transaction: " + ex.getMessage()); } } };
3e02e363caf632600801233248f2a80e2aeda812
1,688
java
Java
src/com/eviware/soapui/impl/wsdl/actions/mockservice/ExportMockService.java
juozasg/suis4j
1c9f24bfc5ca98fd32882feb76c6e90440e1bcf0
[ "MIT" ]
null
null
null
src/com/eviware/soapui/impl/wsdl/actions/mockservice/ExportMockService.java
juozasg/suis4j
1c9f24bfc5ca98fd32882feb76c6e90440e1bcf0
[ "MIT" ]
null
null
null
src/com/eviware/soapui/impl/wsdl/actions/mockservice/ExportMockService.java
juozasg/suis4j
1c9f24bfc5ca98fd32882feb76c6e90440e1bcf0
[ "MIT" ]
null
null
null
33.76
116
0.695498
1,195
/* * SoapUI, Copyright (C) 2004-2016 SmartBear Software * * Licensed under the EUPL, Version 1.1 or - as soon as they will be approved by the European Commission - subsequen * versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * * http://ec.europa.eu/idabc/eupl * * Unless required by applicable law or agreed to in writing, software distributed under the Licence is * distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the Licence for the specific language governing permissions and limitations * under the Licence. */ package com.eviware.soapui.impl.wsdl.actions.mockservice; import com.eviware.soapui.impl.wsdl.mock.WsdlMockService; import com.eviware.soapui.support.UISupport; import com.eviware.soapui.support.action.support.AbstractSoapUIAction; import java.io.File; public class ExportMockService extends AbstractSoapUIAction<WsdlMockService> { public ExportMockService() { super("Export", "Export this mock service"); } public void perform(WsdlMockService mService, Object param) { mService.beforeSave(); String defaultFileName = System.getProperty("user.home") + File.separator + mService.getName() + ".xml"; File file = UISupport.getFileDialogs().saveAs(this, "Select test case file", "xml", "XML", new File(defaultFileName)); if (file == null) { return; } String fileName = file.getAbsolutePath(); if (fileName == null) { return; } mService.export(file); } }
3e02e65f166e510eea418e2724c72b173745591e
1,931
java
Java
hedera-node/src/test/java/com/hedera/services/throttling/bucket/CapacityTestTest.java
subfallen/hedera-services
ddb3f7540a0e4c0f62f72829ea20532aed1271ac
[ "Apache-2.0" ]
null
null
null
hedera-node/src/test/java/com/hedera/services/throttling/bucket/CapacityTestTest.java
subfallen/hedera-services
ddb3f7540a0e4c0f62f72829ea20532aed1271ac
[ "Apache-2.0" ]
null
null
null
hedera-node/src/test/java/com/hedera/services/throttling/bucket/CapacityTestTest.java
subfallen/hedera-services
ddb3f7540a0e4c0f62f72829ea20532aed1271ac
[ "Apache-2.0" ]
null
null
null
25.077922
75
0.718281
1,196
package com.hedera.services.throttling.bucket; /*- * ‌ * Hedera Services Node * ​ * Copyright (C) 2018 - 2021 Hedera Hashgraph, LLC * ​ * 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. * ‍ */ import com.swirlds.common.throttle.Throttle; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.BDDMockito.given; import static org.mockito.BDDMockito.mock; import static org.mockito.BDDMockito.verify; import static org.mockito.Mockito.times; class CapacityTestTest { double req = 123.0; BucketThrottle bucket; CapacityTest subject; @BeforeEach private void setup() { bucket = mock(BucketThrottle.class); subject = new CapacityTest(req, bucket); } @Test public void delegatesAsExpected() { given(bucket.hasAvailableCapacity(req)).willReturn(true); // when: boolean flag = subject.isAvailable(); // then: assertTrue(flag); // and: verify(bucket, times(2)).hasAvailableCapacity(req); } @Test void toStringWorks() { // setup: var t = new Throttle(5.0, 1.0); // given: subject = new CapacityTest(1.011, new BucketThrottle("B", t)); // when: var repr = subject.toString(); // and: var expected = "Test{req=1.01, in=Bucket{name=B, cap=5.0, bp=1.0}}"; // then: assertEquals(expected, repr); } }
3e02e66d81ea13dd7c743514ab84c0d52432c6d9
28,276
java
Java
java/src/com/vmware/avi/sdk/model/TCPProxyProfile.java
yograjshisode/sdk
ad5579229a2821ba6d85f61bff3e7f457e0cce77
[ "Apache-2.0" ]
37
2016-03-14T22:27:17.000Z
2022-03-03T05:18:39.000Z
java/src/com/vmware/avi/sdk/model/TCPProxyProfile.java
yograjshisode/sdk
ad5579229a2821ba6d85f61bff3e7f457e0cce77
[ "Apache-2.0" ]
195
2016-03-14T23:47:55.000Z
2021-05-12T11:28:56.000Z
java/src/com/vmware/avi/sdk/model/TCPProxyProfile.java
yograjshisode/sdk
ad5579229a2821ba6d85f61bff3e7f457e0cce77
[ "Apache-2.0" ]
50
2016-03-14T05:52:14.000Z
2022-01-06T06:12:00.000Z
42.77761
146
0.69536
1,197
package com.vmware.avi.sdk.model; import java.util.*; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; /** * The TCPProxyProfile is a POJO class extends AviRestResource that used for creating * TCPProxyProfile. * * @version 1.0 * @since * */ @JsonIgnoreProperties(ignoreUnknown = true) @JsonInclude(JsonInclude.Include.NON_NULL) public class TCPProxyProfile { @JsonProperty("aggressive_congestion_avoidance") private Boolean aggressiveCongestionAvoidance = false; @JsonProperty("auto_window_growth") private Boolean autoWindowGrowth = true; @JsonProperty("automatic") private Boolean automatic = true; @JsonProperty("cc_algo") private String ccAlgo = "CC_ALGO_NEW_RENO"; @JsonProperty("congestion_recovery_scaling_factor") private Integer congestionRecoveryScalingFactor = 2; @JsonProperty("idle_connection_timeout") private Integer idleConnectionTimeout = 600; @JsonProperty("idle_connection_type") private String idleConnectionType = "KEEP_ALIVE"; @JsonProperty("ignore_time_wait") private Boolean ignoreTimeWait = false; @JsonProperty("ip_dscp") private Integer ipDscp = 0; @JsonProperty("keepalive_in_halfclose_state") private Boolean keepaliveInHalfcloseState = true; @JsonProperty("max_retransmissions") private Integer maxRetransmissions = 8; @JsonProperty("max_segment_size") private Integer maxSegmentSize = null; @JsonProperty("max_syn_retransmissions") private Integer maxSynRetransmissions = 8; @JsonProperty("min_rexmt_timeout") private Integer minRexmtTimeout = null; @JsonProperty("nagles_algorithm") private Boolean naglesAlgorithm = false; @JsonProperty("reassembly_queue_size") private Integer reassemblyQueueSize = 0; @JsonProperty("receive_window") private Integer receiveWindow = 64; @JsonProperty("reorder_threshold") private Integer reorderThreshold = null; @JsonProperty("slow_start_scaling_factor") private Integer slowStartScalingFactor = 1; @JsonProperty("time_wait_delay") private Integer timeWaitDelay = 2000; @JsonProperty("use_interface_mtu") private Boolean useInterfaceMtu = true; /** * This is the getter method this will return the attribute value. * Controls the our congestion window to send, normally it's 1 mss, if this option is turned on, we use 10 msses. * Default value when not specified in API or module is interpreted by Avi Controller as false. * @return aggressiveCongestionAvoidance */ public Boolean getAggressiveCongestionAvoidance() { return aggressiveCongestionAvoidance; } /** * This is the setter method to the attribute. * Controls the our congestion window to send, normally it's 1 mss, if this option is turned on, we use 10 msses. * Default value when not specified in API or module is interpreted by Avi Controller as false. * @param aggressiveCongestionAvoidance set the aggressiveCongestionAvoidance. */ public void setAggressiveCongestionAvoidance(Boolean aggressiveCongestionAvoidance) { this.aggressiveCongestionAvoidance = aggressiveCongestionAvoidance; } /** * This is the getter method this will return the attribute value. * Controls whether the windows are static or supports autogrowth. * Maximum that it can grow to is limited to 4mb. * Field introduced in 20.1.1. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @return autoWindowGrowth */ public Boolean getAutoWindowGrowth() { return autoWindowGrowth; } /** * This is the setter method to the attribute. * Controls whether the windows are static or supports autogrowth. * Maximum that it can grow to is limited to 4mb. * Field introduced in 20.1.1. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @param autoWindowGrowth set the autoWindowGrowth. */ public void setAutoWindowGrowth(Boolean autoWindowGrowth) { this.autoWindowGrowth = autoWindowGrowth; } /** * This is the getter method this will return the attribute value. * Dynamically pick the relevant parameters for connections. * Allowed in basic(allowed values- true) edition, enterprise edition. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @return automatic */ public Boolean getAutomatic() { return automatic; } /** * This is the setter method to the attribute. * Dynamically pick the relevant parameters for connections. * Allowed in basic(allowed values- true) edition, enterprise edition. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @param automatic set the automatic. */ public void setAutomatic(Boolean automatic) { this.automatic = automatic; } /** * This is the getter method this will return the attribute value. * Controls the congestion control algorithm we use. * Enum options - CC_ALGO_NEW_RENO, CC_ALGO_CUBIC, CC_ALGO_HTCP. * Default value when not specified in API or module is interpreted by Avi Controller as "CC_ALGO_NEW_RENO". * @return ccAlgo */ public String getCcAlgo() { return ccAlgo; } /** * This is the setter method to the attribute. * Controls the congestion control algorithm we use. * Enum options - CC_ALGO_NEW_RENO, CC_ALGO_CUBIC, CC_ALGO_HTCP. * Default value when not specified in API or module is interpreted by Avi Controller as "CC_ALGO_NEW_RENO". * @param ccAlgo set the ccAlgo. */ public void setCcAlgo(String ccAlgo) { this.ccAlgo = ccAlgo; } /** * This is the getter method this will return the attribute value. * Congestion window scaling factor after recovery. * Allowed values are 0-8. * Field introduced in 17.2.12, 18.1.3, 18.2.1. * Default value when not specified in API or module is interpreted by Avi Controller as 2. * @return congestionRecoveryScalingFactor */ public Integer getCongestionRecoveryScalingFactor() { return congestionRecoveryScalingFactor; } /** * This is the setter method to the attribute. * Congestion window scaling factor after recovery. * Allowed values are 0-8. * Field introduced in 17.2.12, 18.1.3, 18.2.1. * Default value when not specified in API or module is interpreted by Avi Controller as 2. * @param congestionRecoveryScalingFactor set the congestionRecoveryScalingFactor. */ public void setCongestionRecoveryScalingFactor(Integer congestionRecoveryScalingFactor) { this.congestionRecoveryScalingFactor = congestionRecoveryScalingFactor; } /** * This is the getter method this will return the attribute value. * The duration for keepalive probes or session idle timeout. * Max value is 3600 seconds, min is 5. * Set to 0 to allow infinite idle time. * Allowed values are 5-14400. * Special values are 0 - 'infinite'. * Unit is sec. * Default value when not specified in API or module is interpreted by Avi Controller as 600. * @return idleConnectionTimeout */ public Integer getIdleConnectionTimeout() { return idleConnectionTimeout; } /** * This is the setter method to the attribute. * The duration for keepalive probes or session idle timeout. * Max value is 3600 seconds, min is 5. * Set to 0 to allow infinite idle time. * Allowed values are 5-14400. * Special values are 0 - 'infinite'. * Unit is sec. * Default value when not specified in API or module is interpreted by Avi Controller as 600. * @param idleConnectionTimeout set the idleConnectionTimeout. */ public void setIdleConnectionTimeout(Integer idleConnectionTimeout) { this.idleConnectionTimeout = idleConnectionTimeout; } /** * This is the getter method this will return the attribute value. * Controls the behavior of idle connections. * Enum options - KEEP_ALIVE, CLOSE_IDLE. * Default value when not specified in API or module is interpreted by Avi Controller as "KEEP_ALIVE". * @return idleConnectionType */ public String getIdleConnectionType() { return idleConnectionType; } /** * This is the setter method to the attribute. * Controls the behavior of idle connections. * Enum options - KEEP_ALIVE, CLOSE_IDLE. * Default value when not specified in API or module is interpreted by Avi Controller as "KEEP_ALIVE". * @param idleConnectionType set the idleConnectionType. */ public void setIdleConnectionType(String idleConnectionType) { this.idleConnectionType = idleConnectionType; } /** * This is the getter method this will return the attribute value. * A new syn is accepted from the same 4-tuple even if there is already a connection in time_wait state. * This is equivalent of setting time wait delay to 0. * Default value when not specified in API or module is interpreted by Avi Controller as false. * @return ignoreTimeWait */ public Boolean getIgnoreTimeWait() { return ignoreTimeWait; } /** * This is the setter method to the attribute. * A new syn is accepted from the same 4-tuple even if there is already a connection in time_wait state. * This is equivalent of setting time wait delay to 0. * Default value when not specified in API or module is interpreted by Avi Controller as false. * @param ignoreTimeWait set the ignoreTimeWait. */ public void setIgnoreTimeWait(Boolean ignoreTimeWait) { this.ignoreTimeWait = ignoreTimeWait; } /** * This is the getter method this will return the attribute value. * Controls the value of the differentiated services code point field inserted in the ip header. * This has two options set to a specific value, or pass through, which uses the incoming dscp value. * Allowed values are 0-63. * Special values are max - 'passthrough'. * Default value when not specified in API or module is interpreted by Avi Controller as 0. * @return ipDscp */ public Integer getIpDscp() { return ipDscp; } /** * This is the setter method to the attribute. * Controls the value of the differentiated services code point field inserted in the ip header. * This has two options set to a specific value, or pass through, which uses the incoming dscp value. * Allowed values are 0-63. * Special values are max - 'passthrough'. * Default value when not specified in API or module is interpreted by Avi Controller as 0. * @param ipDscp set the ipDscp. */ public void setIpDscp(Integer ipDscp) { this.ipDscp = ipDscp; } /** * This is the getter method this will return the attribute value. * Controls whether to keep the connection alive with keepalive messages in the tcp half close state. * The interval for sending keepalive messages is 30s. * If a timeout is already configured in the network profile, this will not override it. * Field introduced in 18.2.6. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @return keepaliveInHalfcloseState */ public Boolean getKeepaliveInHalfcloseState() { return keepaliveInHalfcloseState; } /** * This is the setter method to the attribute. * Controls whether to keep the connection alive with keepalive messages in the tcp half close state. * The interval for sending keepalive messages is 30s. * If a timeout is already configured in the network profile, this will not override it. * Field introduced in 18.2.6. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @param keepaliveInHalfcloseState set the keepaliveInHalfcloseState. */ public void setKeepaliveInHalfcloseState(Boolean keepaliveInHalfcloseState) { this.keepaliveInHalfcloseState = keepaliveInHalfcloseState; } /** * This is the getter method this will return the attribute value. * The number of attempts at retransmit before closing the connection. * Allowed values are 3-8. * Default value when not specified in API or module is interpreted by Avi Controller as 8. * @return maxRetransmissions */ public Integer getMaxRetransmissions() { return maxRetransmissions; } /** * This is the setter method to the attribute. * The number of attempts at retransmit before closing the connection. * Allowed values are 3-8. * Default value when not specified in API or module is interpreted by Avi Controller as 8. * @param maxRetransmissions set the maxRetransmissions. */ public void setMaxRetransmissions(Integer maxRetransmissions) { this.maxRetransmissions = maxRetransmissions; } /** * This is the getter method this will return the attribute value. * Maximum tcp segment size. * Allowed values are 512-9000. * Special values are 0 - 'use interface mtu'. * Unit is bytes. * Default value when not specified in API or module is interpreted by Avi Controller as null. * @return maxSegmentSize */ public Integer getMaxSegmentSize() { return maxSegmentSize; } /** * This is the setter method to the attribute. * Maximum tcp segment size. * Allowed values are 512-9000. * Special values are 0 - 'use interface mtu'. * Unit is bytes. * Default value when not specified in API or module is interpreted by Avi Controller as null. * @param maxSegmentSize set the maxSegmentSize. */ public void setMaxSegmentSize(Integer maxSegmentSize) { this.maxSegmentSize = maxSegmentSize; } /** * This is the getter method this will return the attribute value. * The maximum number of attempts at retransmitting a syn packet before giving up. * Allowed values are 3-8. * Default value when not specified in API or module is interpreted by Avi Controller as 8. * @return maxSynRetransmissions */ public Integer getMaxSynRetransmissions() { return maxSynRetransmissions; } /** * This is the setter method to the attribute. * The maximum number of attempts at retransmitting a syn packet before giving up. * Allowed values are 3-8. * Default value when not specified in API or module is interpreted by Avi Controller as 8. * @param maxSynRetransmissions set the maxSynRetransmissions. */ public void setMaxSynRetransmissions(Integer maxSynRetransmissions) { this.maxSynRetransmissions = maxSynRetransmissions; } /** * This is the getter method this will return the attribute value. * The minimum wait time (in millisec) to retransmit packet. * Allowed values are 50-5000. * Field introduced in 17.2.8. * Unit is milliseconds. * Default value when not specified in API or module is interpreted by Avi Controller as null. * @return minRexmtTimeout */ public Integer getMinRexmtTimeout() { return minRexmtTimeout; } /** * This is the setter method to the attribute. * The minimum wait time (in millisec) to retransmit packet. * Allowed values are 50-5000. * Field introduced in 17.2.8. * Unit is milliseconds. * Default value when not specified in API or module is interpreted by Avi Controller as null. * @param minRexmtTimeout set the minRexmtTimeout. */ public void setMinRexmtTimeout(Integer minRexmtTimeout) { this.minRexmtTimeout = minRexmtTimeout; } /** * This is the getter method this will return the attribute value. * Consolidates small data packets to send clients fewer but larger packets. * Adversely affects real time protocols such as telnet or ssh. * Default value when not specified in API or module is interpreted by Avi Controller as false. * @return naglesAlgorithm */ public Boolean getNaglesAlgorithm() { return naglesAlgorithm; } /** * This is the setter method to the attribute. * Consolidates small data packets to send clients fewer but larger packets. * Adversely affects real time protocols such as telnet or ssh. * Default value when not specified in API or module is interpreted by Avi Controller as false. * @param naglesAlgorithm set the naglesAlgorithm. */ public void setNaglesAlgorithm(Boolean naglesAlgorithm) { this.naglesAlgorithm = naglesAlgorithm; } /** * This is the getter method this will return the attribute value. * Maximum number of tcp segments that can be queued for reassembly. * Configuring this to 0 disables the feature and provides unlimited queuing. * Field introduced in 17.2.13, 18.1.4, 18.2.1. * Default value when not specified in API or module is interpreted by Avi Controller as 0. * @return reassemblyQueueSize */ public Integer getReassemblyQueueSize() { return reassemblyQueueSize; } /** * This is the setter method to the attribute. * Maximum number of tcp segments that can be queued for reassembly. * Configuring this to 0 disables the feature and provides unlimited queuing. * Field introduced in 17.2.13, 18.1.4, 18.2.1. * Default value when not specified in API or module is interpreted by Avi Controller as 0. * @param reassemblyQueueSize set the reassemblyQueueSize. */ public void setReassemblyQueueSize(Integer reassemblyQueueSize) { this.reassemblyQueueSize = reassemblyQueueSize; } /** * This is the getter method this will return the attribute value. * Size of the receive window. * Allowed values are 2-65536. * Unit is kb. * Default value when not specified in API or module is interpreted by Avi Controller as 64. * @return receiveWindow */ public Integer getReceiveWindow() { return receiveWindow; } /** * This is the setter method to the attribute. * Size of the receive window. * Allowed values are 2-65536. * Unit is kb. * Default value when not specified in API or module is interpreted by Avi Controller as 64. * @param receiveWindow set the receiveWindow. */ public void setReceiveWindow(Integer receiveWindow) { this.receiveWindow = receiveWindow; } /** * This is the getter method this will return the attribute value. * Controls the number of duplicate acks required to trigger retransmission. * Setting a higher value reduces retransmission caused by packet reordering. * A larger value is recommended in public cloud environments where packet reordering is quite common. * The default value is 8 in public cloud platforms (aws, azure, gcp), and 3 in other environments. * Allowed values are 1-100. * Field introduced in 17.2.7. * Default value when not specified in API or module is interpreted by Avi Controller as null. * @return reorderThreshold */ public Integer getReorderThreshold() { return reorderThreshold; } /** * This is the setter method to the attribute. * Controls the number of duplicate acks required to trigger retransmission. * Setting a higher value reduces retransmission caused by packet reordering. * A larger value is recommended in public cloud environments where packet reordering is quite common. * The default value is 8 in public cloud platforms (aws, azure, gcp), and 3 in other environments. * Allowed values are 1-100. * Field introduced in 17.2.7. * Default value when not specified in API or module is interpreted by Avi Controller as null. * @param reorderThreshold set the reorderThreshold. */ public void setReorderThreshold(Integer reorderThreshold) { this.reorderThreshold = reorderThreshold; } /** * This is the getter method this will return the attribute value. * Congestion window scaling factor during slow start. * Allowed values are 0-8. * Field introduced in 17.2.12, 18.1.3, 18.2.1. * Default value when not specified in API or module is interpreted by Avi Controller as 1. * @return slowStartScalingFactor */ public Integer getSlowStartScalingFactor() { return slowStartScalingFactor; } /** * This is the setter method to the attribute. * Congestion window scaling factor during slow start. * Allowed values are 0-8. * Field introduced in 17.2.12, 18.1.3, 18.2.1. * Default value when not specified in API or module is interpreted by Avi Controller as 1. * @param slowStartScalingFactor set the slowStartScalingFactor. */ public void setSlowStartScalingFactor(Integer slowStartScalingFactor) { this.slowStartScalingFactor = slowStartScalingFactor; } /** * This is the getter method this will return the attribute value. * The time (in millisec) to wait before closing a connection in the time_wait state. * Allowed values are 500-2000. * Special values are 0 - 'immediate'. * Unit is milliseconds. * Default value when not specified in API or module is interpreted by Avi Controller as 2000. * @return timeWaitDelay */ public Integer getTimeWaitDelay() { return timeWaitDelay; } /** * This is the setter method to the attribute. * The time (in millisec) to wait before closing a connection in the time_wait state. * Allowed values are 500-2000. * Special values are 0 - 'immediate'. * Unit is milliseconds. * Default value when not specified in API or module is interpreted by Avi Controller as 2000. * @param timeWaitDelay set the timeWaitDelay. */ public void setTimeWaitDelay(Integer timeWaitDelay) { this.timeWaitDelay = timeWaitDelay; } /** * This is the getter method this will return the attribute value. * Use the interface mtu to calculate the tcp max segment size. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @return useInterfaceMtu */ public Boolean getUseInterfaceMtu() { return useInterfaceMtu; } /** * This is the setter method to the attribute. * Use the interface mtu to calculate the tcp max segment size. * Default value when not specified in API or module is interpreted by Avi Controller as true. * @param useInterfaceMtu set the useInterfaceMtu. */ public void setUseInterfaceMtu(Boolean useInterfaceMtu) { this.useInterfaceMtu = useInterfaceMtu; } @Override public boolean equals(java.lang.Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } TCPProxyProfile objTCPProxyProfile = (TCPProxyProfile) o; return Objects.equals(this.automatic, objTCPProxyProfile.automatic)&& Objects.equals(this.idleConnectionType, objTCPProxyProfile.idleConnectionType)&& Objects.equals(this.idleConnectionTimeout, objTCPProxyProfile.idleConnectionTimeout)&& Objects.equals(this.ignoreTimeWait, objTCPProxyProfile.ignoreTimeWait)&& Objects.equals(this.timeWaitDelay, objTCPProxyProfile.timeWaitDelay)&& Objects.equals(this.maxRetransmissions, objTCPProxyProfile.maxRetransmissions)&& Objects.equals(this.maxSynRetransmissions, objTCPProxyProfile.maxSynRetransmissions)&& Objects.equals(this.receiveWindow, objTCPProxyProfile.receiveWindow)&& Objects.equals(this.useInterfaceMtu, objTCPProxyProfile.useInterfaceMtu)&& Objects.equals(this.maxSegmentSize, objTCPProxyProfile.maxSegmentSize)&& Objects.equals(this.naglesAlgorithm, objTCPProxyProfile.naglesAlgorithm)&& Objects.equals(this.ipDscp, objTCPProxyProfile.ipDscp)&& Objects.equals(this.ccAlgo, objTCPProxyProfile.ccAlgo)&& Objects.equals(this.aggressiveCongestionAvoidance, objTCPProxyProfile.aggressiveCongestionAvoidance)&& Objects.equals(this.reorderThreshold, objTCPProxyProfile.reorderThreshold)&& Objects.equals(this.minRexmtTimeout, objTCPProxyProfile.minRexmtTimeout)&& Objects.equals(this.slowStartScalingFactor, objTCPProxyProfile.slowStartScalingFactor)&& Objects.equals(this.congestionRecoveryScalingFactor, objTCPProxyProfile.congestionRecoveryScalingFactor)&& Objects.equals(this.reassemblyQueueSize, objTCPProxyProfile.reassemblyQueueSize)&& Objects.equals(this.keepaliveInHalfcloseState, objTCPProxyProfile.keepaliveInHalfcloseState)&& Objects.equals(this.autoWindowGrowth, objTCPProxyProfile.autoWindowGrowth); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class TCPProxyProfile {\n"); sb.append(" aggressiveCongestionAvoidance: ").append(toIndentedString(aggressiveCongestionAvoidance)).append("\n"); sb.append(" autoWindowGrowth: ").append(toIndentedString(autoWindowGrowth)).append("\n"); sb.append(" automatic: ").append(toIndentedString(automatic)).append("\n"); sb.append(" ccAlgo: ").append(toIndentedString(ccAlgo)).append("\n"); sb.append(" congestionRecoveryScalingFactor: ").append(toIndentedString(congestionRecoveryScalingFactor)).append("\n"); sb.append(" idleConnectionTimeout: ").append(toIndentedString(idleConnectionTimeout)).append("\n"); sb.append(" idleConnectionType: ").append(toIndentedString(idleConnectionType)).append("\n"); sb.append(" ignoreTimeWait: ").append(toIndentedString(ignoreTimeWait)).append("\n"); sb.append(" ipDscp: ").append(toIndentedString(ipDscp)).append("\n"); sb.append(" keepaliveInHalfcloseState: ").append(toIndentedString(keepaliveInHalfcloseState)).append("\n"); sb.append(" maxRetransmissions: ").append(toIndentedString(maxRetransmissions)).append("\n"); sb.append(" maxSegmentSize: ").append(toIndentedString(maxSegmentSize)).append("\n"); sb.append(" maxSynRetransmissions: ").append(toIndentedString(maxSynRetransmissions)).append("\n"); sb.append(" minRexmtTimeout: ").append(toIndentedString(minRexmtTimeout)).append("\n"); sb.append(" naglesAlgorithm: ").append(toIndentedString(naglesAlgorithm)).append("\n"); sb.append(" reassemblyQueueSize: ").append(toIndentedString(reassemblyQueueSize)).append("\n"); sb.append(" receiveWindow: ").append(toIndentedString(receiveWindow)).append("\n"); sb.append(" reorderThreshold: ").append(toIndentedString(reorderThreshold)).append("\n"); sb.append(" slowStartScalingFactor: ").append(toIndentedString(slowStartScalingFactor)).append("\n"); sb.append(" timeWaitDelay: ").append(toIndentedString(timeWaitDelay)).append("\n"); sb.append(" useInterfaceMtu: ").append(toIndentedString(useInterfaceMtu)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(java.lang.Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
3e02e6cde3c40d85b167ec5eaea3a374235a20b8
189
java
Java
src/main/java/in/co/itlabs/sis/business/entities/Category.java
webvikrant/sis
6ed794e1a2afd68a777c97dd8a3fb58d31d19b3d
[ "Unlicense" ]
null
null
null
src/main/java/in/co/itlabs/sis/business/entities/Category.java
webvikrant/sis
6ed794e1a2afd68a777c97dd8a3fb58d31d19b3d
[ "Unlicense" ]
null
null
null
src/main/java/in/co/itlabs/sis/business/entities/Category.java
webvikrant/sis
6ed794e1a2afd68a777c97dd8a3fb58d31d19b3d
[ "Unlicense" ]
null
null
null
15.75
43
0.793651
1,198
package in.co.itlabs.sis.business.entities; import lombok.Data; import lombok.NoArgsConstructor; @Data @NoArgsConstructor public class Category { private int id; private String name; }
3e02e72f7066f95e997cea9dcd174190ace5bf61
719
java
Java
testsuite/docker/jms/src/it/java/io/thorntail/testsuite/jms/driven/Sender.java
thumb-tack/
d8f350066bd724de4d2779dcef0676e624f7d412
[ "Apache-2.0" ]
1
2019-09-23T13:39:49.000Z
2019-09-23T13:39:49.000Z
testsuite/docker/jms/src/it/java/io/thorntail/testsuite/jms/driven/Sender.java
thorntail/thorntail-poc
b123354fc85c4ed27838ff75227e3c1ef7cdc250
[ "Apache-2.0" ]
17
2019-03-24T05:50:42.000Z
2022-01-21T23:24:08.000Z
testsuite/docker/jms/src/it/java/io/thorntail/testsuite/jms/driven/Sender.java
thumb-tack/tt
d8f350066bd724de4d2779dcef0676e624f7d412
[ "Apache-2.0" ]
1
2021-08-12T09:23:24.000Z
2021-08-12T09:23:24.000Z
21.147059
62
0.720445
1,199
package io.thorntail.testsuite.jms.driven; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.jms.Destination; import javax.jms.JMSContext; import javax.jms.JMSProducer; import javax.jms.Queue; /** * Created by bob on 2/7/18. */ @ApplicationScoped public class Sender { @PostConstruct void init() { this.destination = this.context.createTopic("driven"); this.producer = context.createProducer(); } void send(String body) { this.producer.send(this.destination, body); } @Inject private JMSContext context; private JMSProducer producer; private Destination destination; }
3e02e7dc8f602409d2cf45e6d7ef9a4b9c4fb381
123
java
Java
005-LambdaExpressionWithReturnValue/src/com/javabotanist/MyInterface.java
nithin2889/Java-8-Features
49c9daeef7f62d174bfe574ab293acd477764025
[ "Apache-2.0" ]
null
null
null
005-LambdaExpressionWithReturnValue/src/com/javabotanist/MyInterface.java
nithin2889/Java-8-Features
49c9daeef7f62d174bfe574ab293acd477764025
[ "Apache-2.0" ]
null
null
null
005-LambdaExpressionWithReturnValue/src/com/javabotanist/MyInterface.java
nithin2889/Java-8-Features
49c9daeef7f62d174bfe574ab293acd477764025
[ "Apache-2.0" ]
null
null
null
13.666667
31
0.715447
1,200
package com.javabotanist; @FunctionalInterface public interface MyInterface { boolean test(int n1, int n2); }
3e02e7def84fd056b5e47a41d3eda6c81844d65a
1,158
java
Java
src/main/java/com/github/sjgibbs/pagechrome/sitemap/NavigationItem.java
sjgibbs/pagechrome
18a8250dad0d36a9637ec35ae8d5e4dcada268fe
[ "MIT" ]
null
null
null
src/main/java/com/github/sjgibbs/pagechrome/sitemap/NavigationItem.java
sjgibbs/pagechrome
18a8250dad0d36a9637ec35ae8d5e4dcada268fe
[ "MIT" ]
null
null
null
src/main/java/com/github/sjgibbs/pagechrome/sitemap/NavigationItem.java
sjgibbs/pagechrome
18a8250dad0d36a9637ec35ae8d5e4dcada268fe
[ "MIT" ]
null
null
null
17.283582
68
0.697755
1,201
package com.github.sjgibbs.pagechrome.sitemap; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Strings; import javax.validation.Valid; import javax.validation.constraints.NotNull; import java.util.List; /** * NavigationItem * * @author Simon */ public class NavigationItem { @NotNull @JsonProperty("label") String label; @JsonProperty("uri") String uri; @Valid @JsonProperty("items") List<NavigationItem> items; public boolean getDropdown() { if(Strings.isNullOrEmpty(uri)) { if(items == null || items.isEmpty()) { throw new IllegalStateException("Item has no uri and no items"); } return true; } if(items != null && !items.isEmpty()) { throw new IllegalStateException("Item has both uri and items"); } return false; } public String getLabel() { return label; } public void setLabel(String label) { this.label = label; } public String getUri() { return uri; } public void setUri(String uri) { this.uri = uri; } public List<NavigationItem> getItems() { return items; } public void setItems(List<NavigationItem> items) { this.items = items; } }
3e02e7ff6b726468e6678ce80e3a9397c73db9c4
442
java
Java
src/main/java/rkv/Pair.java
craids/rarmanKV
32b4184d9e98f5543c070ed59c8d387a4eb71c51
[ "MIT" ]
null
null
null
src/main/java/rkv/Pair.java
craids/rarmanKV
32b4184d9e98f5543c070ed59c8d387a4eb71c51
[ "MIT" ]
null
null
null
src/main/java/rkv/Pair.java
craids/rarmanKV
32b4184d9e98f5543c070ed59c8d387a4eb71c51
[ "MIT" ]
null
null
null
13.393939
56
0.642534
1,202
package rkv; import java.util.Map; public class Pair<K, V> implements Map.Entry<K, V> { final K k; final V v; Pair(K k, V v) { this.k = k; this.v = v; } @Override public K getKey() { // TODO Auto-generated method stub return k; } @Override public V getValue() { // TODO Auto-generated method stub return v; } @Override public V setValue(V value) { throw new RuntimeException("Operation not supported"); } }
3e02e85aca017576941130cd3571bcd1ac84a276
1,507
java
Java
mybatis-exercise/src/main/java/cn/manual/pojo/Orders.java
echo1937/mybatis-demo
314aaf988af17d95ee281bf5c9cdaf5489f2f91c
[ "Apache-2.0" ]
null
null
null
mybatis-exercise/src/main/java/cn/manual/pojo/Orders.java
echo1937/mybatis-demo
314aaf988af17d95ee281bf5c9cdaf5489f2f91c
[ "Apache-2.0" ]
null
null
null
mybatis-exercise/src/main/java/cn/manual/pojo/Orders.java
echo1937/mybatis-demo
314aaf988af17d95ee281bf5c9cdaf5489f2f91c
[ "Apache-2.0" ]
1
2019-03-30T02:58:33.000Z
2019-03-30T02:58:33.000Z
20.093333
60
0.525547
1,203
package cn.manual.pojo; import java.util.Date; /** * Created by Eric on 3/14/17. */ public class Orders { private Integer id; //主键 private Integer userId; //用户id private String number; //订单号 private Date createtime; //订单创建时间 private String note; //订单说明 private User user;//订单对应的用户信息 public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number == null ? null : number.trim(); } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getNote() { return note; } public void setNote(String note) { this.note = note == null ? null : note.trim(); } public User getUser() { return user; } public void setUser(User user) { this.user = user; } @Override public String toString() { return "Orders{" + "id=" + id + ", userId=" + userId + ", number='" + number + '\'' + ", createtime=" + createtime + ", note='" + note + '\'' + '}'; } }
3e02e8f4354b60d563d60aab3d42acf1893e0069
236
java
Java
endpoint/src/main/java/org/femtoframework/net/nio/SocketChannelCallback.java
femtoframework/femto-endpoint
59585fdfdee8faf0e8c67b0eacb3831d78010037
[ "Apache-2.0" ]
1
2019-03-15T06:26:28.000Z
2019-03-15T06:26:28.000Z
endpoint/src/main/java/org/femtoframework/net/nio/SocketChannelCallback.java
femtoframework/femto-endpoint
59585fdfdee8faf0e8c67b0eacb3831d78010037
[ "Apache-2.0" ]
2
2019-11-21T17:43:11.000Z
2019-11-21T18:38:45.000Z
endpoint/src/main/java/org/femtoframework/net/nio/SocketChannelCallback.java
femtoframework/femto-endpoint
59585fdfdee8faf0e8c67b0eacb3831d78010037
[ "Apache-2.0" ]
null
null
null
13.882353
44
0.622881
1,204
package org.femtoframework.net.nio; /** * Socket Channel 事件回调 * * @author fengyun */ public interface SocketChannelCallback { /** * 回调处理 * * @param event 事件 */ void callback(SocketChannelEvent event); }
3e02e9fc43aeb6c4c2daa4affd5183d0bda0aab9
3,202
java
Java
app/src/main/java/com/young/share/utils/cache/DarftUtils.java
yfujin/GraduateProjectShare
c98d9e7079809ac0821f930e40f4242302713343
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/young/share/utils/cache/DarftUtils.java
yfujin/GraduateProjectShare
c98d9e7079809ac0821f930e40f4242302713343
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/young/share/utils/cache/DarftUtils.java
yfujin/GraduateProjectShare
c98d9e7079809ac0821f930e40f4242302713343
[ "Apache-2.0" ]
null
null
null
28.589286
99
0.657714
1,205
package com.young.share.utils.cache; import android.app.Activity; import android.widget.Toast; import com.young.share.R; import com.young.share.config.Contants; import com.young.share.utils.LogUtils; import org.json.JSONArray; import java.util.List; /** * 保存草稿与删除 * <p> * Created by Nearby Yang on 2015-10-30. */ public class DarftUtils { private static DarftUtils saveDarftUtils; private ACache acache; private Activity activity; private DarftUtils(Activity mactivity) { activity = mactivity; acache = ACache.get(mactivity); } public static DarftUtils builder(Activity mactivity) { if (saveDarftUtils == null) { synchronized (ACache.class) { if (saveDarftUtils == null) { saveDarftUtils = new DarftUtils(mactivity); } } } return saveDarftUtils; } /** * 发现 * 保存草稿 */ public void saveDraft(String content, String videoPath, String videoPreview, String locationInfo, String tagLable, List<String> list) { //文字,位置,图片,标签 JSONArray imagesJsonArray = new JSONArray(list); acache.put(Contants.DRAFT_CONTENT, content, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_LOCATION_INFO, locationInfo, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_TAG, tagLable, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_IMAGES_LIST, imagesJsonArray, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_VIDEO, videoPath, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_VIDEO_PREVIEW, videoPreview, Contants.DARFT_LIVE_TIME); Toast.makeText(activity, R.string.save_draft_success, Toast.LENGTH_SHORT).show(); LogUtils.i("保存草稿"); } /** * 优惠 * 保存草稿 */ public void saveDraftDiscount(String content, String locationInfo, String tagLable, List<String> list) { //文字,位置,图片,标签 JSONArray imagesJsonArray = new JSONArray(list); acache.put(Contants.DRAFT_CONTENT_DISCOUNT, content, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_LOCATION_INFO_DISCOUNT, locationInfo, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_TAG_DISCOUNT, tagLable, Contants.DARFT_LIVE_TIME); acache.put(Contants.DRAFT_IMAGES_LIST_DISCOUNT, imagesJsonArray, Contants.DARFT_LIVE_TIME); Toast.makeText(activity, R.string.save_draft_success, Toast.LENGTH_SHORT).show(); LogUtils.i("保存草稿"); } /** * 发现 * 删除草稿 */ public void deleteDraft() { acache.remove(Contants.DRAFT_CONTENT); acache.remove(Contants.DRAFT_LOCATION_INFO); acache.remove(Contants.DRAFT_TAG); acache.remove(Contants.DRAFT_IMAGES_LIST); } /** * 优惠 * 删除草稿 */ public void deleteDraftDiscount() { acache.remove(Contants.DRAFT_CONTENT_DISCOUNT); acache.remove(Contants.DRAFT_LOCATION_INFO_DISCOUNT); acache.remove(Contants.DRAFT_TAG_DISCOUNT); acache.remove(Contants.DRAFT_IMAGES_LIST_DISCOUNT); } }
3e02ea5cd004691183ad232751c14adf50b3054a
296
java
Java
iconfactory/iconfactory-hibernate/src/main/java/com/daedafusion/iconfactory/framework/providers/daos/OrnamentSymbolDAO.java
daedafusion/infrastructure
cc6ae118125f8b2c70eaf89b463d09466e571ce3
[ "Apache-2.0" ]
null
null
null
iconfactory/iconfactory-hibernate/src/main/java/com/daedafusion/iconfactory/framework/providers/daos/OrnamentSymbolDAO.java
daedafusion/infrastructure
cc6ae118125f8b2c70eaf89b463d09466e571ce3
[ "Apache-2.0" ]
null
null
null
iconfactory/iconfactory-hibernate/src/main/java/com/daedafusion/iconfactory/framework/providers/daos/OrnamentSymbolDAO.java
daedafusion/infrastructure
cc6ae118125f8b2c70eaf89b463d09466e571ce3
[ "Apache-2.0" ]
null
null
null
24.666667
75
0.810811
1,206
package com.daedafusion.iconfactory.framework.providers.daos; import com.daedafusion.hibernate.dao.GenericDAO; import com.daedafusion.iconfactory.entities.OrnamentSymbol; /** * Created by mphilpot on 7/23/14. */ public interface OrnamentSymbolDAO extends GenericDAO<OrnamentSymbol, Long> { }