blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d493a9a060b2f682f40538f6d0adf39bc4d777dd | d9e37149704735d776684a15c9f2fbe6cf760993 | /ijwb/src/com/google/idea/blaze/ijwb/typescript/TsConfigRuleSection.java | e0f0d5b492bdf9f268a70e505fa2fee6e33cc558 | [
"Apache-2.0"
] | permissive | jacquesqiao/intellij | 4f3da33c5257e9beb54b68281d69730ff14da48c | 015973d885a258d9b3921e5c06572bb4e1b30045 | refs/heads/master | 2021-06-25T18:28:26.343747 | 2017-08-31T14:52:05 | 2017-08-31T14:52:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,531 | java | /*
* Copyright 2016 The Bazel Authors. 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.idea.blaze.ijwb.typescript;
import com.google.common.collect.Lists;
import com.google.idea.blaze.base.model.primitives.Label;
import com.google.idea.blaze.base.projectview.parser.ParseContext;
import com.google.idea.blaze.base.projectview.parser.ProjectViewParser;
import com.google.idea.blaze.base.projectview.section.ScalarSection;
import com.google.idea.blaze.base.projectview.section.ScalarSectionParser;
import com.google.idea.blaze.base.projectview.section.SectionKey;
import com.google.idea.blaze.base.projectview.section.SectionParser;
import com.google.idea.blaze.base.ui.BlazeValidationError;
import java.util.List;
import javax.annotation.Nullable;
/** Points to the ts_config rule. */
@Deprecated
public class TsConfigRuleSection {
public static final SectionKey<Label, ScalarSection<Label>> KEY = SectionKey.of("ts_config_rule");
public static final SectionParser PARSER = new TsConfigRuleSectionParser();
private static class TsConfigRuleSectionParser extends ScalarSectionParser<Label> {
public TsConfigRuleSectionParser() {
super(KEY, ':');
}
@Nullable
@Override
protected Label parseItem(ProjectViewParser parser, ParseContext parseContext, String rest) {
List<BlazeValidationError> errors = Lists.newArrayList();
if (!Label.validate(rest, errors)) {
parseContext.addErrors(errors);
return null;
}
return Label.create(rest);
}
@Override
protected void printItem(StringBuilder sb, Label value) {
sb.append(value.toString());
}
@Override
public ItemType getItemType() {
return ItemType.Label;
}
@Override
public boolean isDeprecated() {
return true;
}
@Nullable
@Override
public String getDeprecationMessage() {
return "Use `ts_config_rules` instead, which allows specifying multiple `ts_config` targets.";
}
}
}
| [
"brendandouglas@google.com"
] | brendandouglas@google.com |
1b91b28cad41339e1c8ec23bb2ddd3cea857f093 | 0e5d2b504cf3b47bb96a44b7ede1ab895fbab2f1 | /src/EmployeeListTest.java | 90091a29c8dfc25585d64e8265e31acf63022b72 | [] | no_license | Kwoconut/SEP-project | 647cbb4c80cee9409347faa18916bd84d596f679 | ddc82a1475e017866b3f9da0d41ca43c80d7e936 | refs/heads/master | 2020-04-10T04:41:31.911077 | 2018-12-10T10:55:39 | 2018-12-10T10:55:39 | 160,806,067 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 715 | java | import model.Employee;
import model.EmployeeList;
import model.Name;
public class EmployeeListTest
{
public static void main(String[] args)
{
Name name = new Name("Valeriu","Marandici");
Name name2 = new Name("Valeriu","Romanciuc");
Employee employee = new Employee(name,"VM");
Employee employee2 = new Employee(name2,"VMS");
EmployeeList empList = new EmployeeList();
empList.addEmployee(employee2);
empList.addEmployee(employee);
empList.getEmployee(employee).train("Fat");
empList.getEmployee(employee).train("Cereale");
empList.getEmployee(employee).train("Glucoze");
empList.setStatusTraining(0);
System.out.println(empList);
}
}
| [
"43205572+Kwoconut@users.noreply.github.com"
] | 43205572+Kwoconut@users.noreply.github.com |
6e8cd68ae31474b88038391088efb414c7180fa3 | 0cdf65294e75e14674a0031a0ce1d64b971fd1c4 | /src/com/zte/ums/an/uni/dsl/conf/cdf/dispatch/CollectPoints.java | b1cd7c38ff599d5841a683e00e270333aaa4f9a4 | [] | no_license | nodder/cdf | 519653d12b32ef71740ff7391dfb1745fee2cb9e | e62d4e7230d6938bbf8acb676158a09af801a197 | refs/heads/master | 2021-07-25T07:46:34.145033 | 2017-11-05T04:00:52 | 2017-11-05T04:00:52 | 109,546,733 | 1 | 1 | null | null | null | null | GB18030 | Java | false | false | 1,637 | java | package com.zte.ums.an.uni.dsl.conf.cdf.dispatch;
import java.util.ArrayList;
import java.util.Vector;
import com.zte.ums.api.common.snmpnode.ppu.entity.SnmpNode;
/**
* <p>文件名称: CollectPoints.java</p>
* <p>文件描述: </p>
* <p>版权所有: 版权所有(C)2007-2010</p>
* <p>公 司: 中兴通讯股份有限公司</p>
* <p>内容摘要: </p>
* <p>其他说明: </p>
* <p>完成日期:2011年9月1日</p>
* <p>修改记录1:</p>
* <pre>
* 修改日期:
* 版 本 号:
* 修 改 人:
* 修改内容:
* </pre>
* <p>修改记录2:</p>
* @version 1.0
* @author lixiaochun
*/
public class CollectPoints
{
/** 待采集网元容器 */
private static Vector snmpNodeList = new Vector();
public synchronized static void AddNes(ArrayList<SnmpNode> nes)
{
snmpNodeList.addAll(nes);
}
/** 获取前N个待采集网元列表 */
public synchronized static Vector getNes(int stepLength)
{
Vector ret = new Vector();
int len = snmpNodeList.size() > stepLength ? stepLength : snmpNodeList.size();
for(int i = 0; i < len; i++)
{
ret.add(snmpNodeList.get(i));
}
for(int i = 0; i < len; i++)
{
snmpNodeList.remove(0);
}
return ret;
}
public synchronized static boolean isEmpty()
{
return snmpNodeList.isEmpty();
}
/** 获取待采集网元个数 */
public synchronized static int getUnprocessedNeCount()
{
return snmpNodeList.size();
}
}
| [
"nodder001@163.com"
] | nodder001@163.com |
66e8ecf6b04cc69e27f67f0276dd4355814aff53 | 7626a5056238e9ba385611ee655ac3b2eec37b8e | /modules/Core/src/main/java/org/terasology/core/world/generator/e/procedural/noise/experimental/VarianceNoise.java | cb9aa635bb0224802e2a61c202d5e64d4352c4bf | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | esapetri/Terasology | 00bd8a088ed1724971491c5620f6dc0928b5d15b | 2ad4b0708677f8df82b7a7d22fcb0891bfa39762 | refs/heads/master | 2021-01-17T06:59:33.422988 | 2018-12-28T18:31:17 | 2018-12-28T18:31:17 | 26,880,318 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,094 | java | /*
* Copyright 2013 MovingBlocks
*
* 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.terasology.core.world.generator.e.procedural.noise.experimental;
import org.terasology.core.emath.BitScrampler;
import org.terasology.core.emath.Statistics;
import org.terasology.math.TeraMath;
import org.terasology.utilities.procedural.Noise2D;
import org.terasology.utilities.procedural.Noise3D;
import org.terasology.utilities.random.FastRandom;
/**
* Deterministic white noise generator
* @author Esereja
*/
public class VarianceNoise implements Noise2D, Noise3D {
final private int RANDOMS_LENGHT=3465;
private int[] randoms;
private int[] offset;
/**
* Initialize permutations with a given seed
*
* @param seed a seed value used for permutation shuffling
*/
public VarianceNoise(long seed) {
FastRandom rand=new FastRandom(seed);
randoms=new int[RANDOMS_LENGHT];
for(int i=0;i<randoms.length;i++){
randoms[i]=rand.nextInt();
}
offset= new int[4];
for(int i=0;i<offset.length;i++){
offset[i]=rand.nextInt();
}
}
/**
* 2D semi white noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @return a noise value in the interval [-1,1]
*/
@Override
public float noise(float xin, float yin) {
int x=TeraMath.floorToInt(xin)+offset[0];
int y=TeraMath.floorToInt(yin)+offset[1];
double xw = xin - TeraMath.fastFloor(xin);
double yw = yin - TeraMath.fastFloor(yin);
double xn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)
,4)),
xw);
double yn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)
,4)),
yw);
double[] array=new double[2];
array[0]=xn;
array[1]=yn;
double mean = Statistics.aritmeticMean(array);
double variance = Statistics.variance(array, mean);
double r=0;
if(!(Statistics.sign(xn)^Statistics.sign(yn))){
r+=variance;
}else{
r-=variance;
}
r*=5;
return (float) (Math.sin(
(r)*3.141*2
));
}
/**
* 3D semi white noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @param zin the z input coordinate
* @return a noise value in the interval [-1,1]
*/
@Override
public float noise(float xin, float yin, float zin) {
int x=TeraMath.floorToInt(xin)+offset[0];
int y=TeraMath.floorToInt(yin)+offset[1];
int z=TeraMath.floorToInt(zin)+offset[2];
double xw = xin - TeraMath.fastFloor(xin);
double yw = yin - TeraMath.fastFloor(yin);
double zw = zin - TeraMath.fastFloor(zin);
double xn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)
,4)),
xw);
double yn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)
,4)),
yw);
double zn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)
,4)),
zw);
double[] array=new double[3];
array[0]=xn;
array[1]=yn;
array[2]=zn;
double mean = Statistics.aritmeticMean(array);
double variance = Statistics.variance(array, mean);
double r=0;
if(!(Statistics.sign(xn)^Statistics.sign(yn)^Statistics.sign(zn))){
r+=variance;
}else{
r-=variance;
}
r*=5;
return (float) (Math.sin(
(r)*3.141*2
));
}
/**
* 4D semi white noise
*
* @param xin the x input coordinate
* @param yin the y input coordinate
* @param zin the z input coordinate
* @return a noise value in the interval [-1,1]
*/
public float noise(float xin, float yin, float zin, float win) {
int x=TeraMath.floorToInt(xin)+offset[0];
int y=TeraMath.floorToInt(yin)+offset[1];
int z=TeraMath.floorToInt(zin)+offset[2];
int w=TeraMath.floorToInt(win)+offset[3];
double xw = xin - TeraMath.fastFloor(xin);
double yw = yin - TeraMath.fastFloor(yin);
double zw = zin - TeraMath.fastFloor(zin);
double ww = zin - TeraMath.fastFloor(win);
double xn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w)%(randoms.length-1) )
]^(w),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w+1),2)
,4)),
xw);
double yn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w),2) ^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w+1),2) ^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)
,4)),
yw);
double zn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w),2) ^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(w+1),2) ^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)
,4)),
zw);
double wn= TeraMath.lerp(
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w)%(randoms.length-1) )
]^(w))^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x)%(randoms.length-1) )
]^(x),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y)%(randoms.length-1) )
]^(y),2)^
BitScrampler.scrampleBits( randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z)%(randoms.length-1) )
]^(z),2)
,4)),
BitScrampler.subZero(BitScrampler.oaatHash(
(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(w+1)%(randoms.length-1) )
]^(w+1))^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(x+1)%(randoms.length-1) )
]^(x+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(y+1)%(randoms.length-1) )
]^(y+1),2)^
BitScrampler.scrampleBits(randoms[
TeraMath.floorToInt(TeraMath.fastAbs(z+1)%(randoms.length-1) )
]^(z+1),2)
,4)),
zw);
double[] array=new double[4];
array[0]=xn;
array[1]=yn;
array[2]=zn;
array[3]=wn;
double mean = Statistics.aritmeticMean(array);
double variance = Statistics.variance(array, mean);
double r=0;
if(!(Statistics.sign(xn)^Statistics.sign(yn)^Statistics.sign(zn))){
r+=variance;
}else{
r-=variance;
}
r*=5;
return (float) (Math.sin(
(r)*3.141*2
));
}
}
| [
"esereja@yahoo.co.uk"
] | esereja@yahoo.co.uk |
30f0160e0d9583855a0e9146d2a508e86effa5f2 | 4a604d471f1c0ca063081c707cf08db5407c237a | /Servlet3/src/SessionAttributeObserver.java | cc633fcc44f643e932133722e2aa42d9447a30cc | [] | no_license | saviobm/1Z0-899 | 74a375e63b203fe4a13784d922378413c42663d1 | e011c7472f028e92117cf7ac566ca95c7aced577 | refs/heads/master | 2021-09-05T10:49:10.166201 | 2018-01-26T15:34:51 | 2018-01-26T15:34:51 | 108,963,082 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 785 | java | import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpSessionAttributeListener;
import javax.servlet.http.HttpSessionBindingEvent;
@WebListener
public class SessionAttributeObserver implements HttpSessionAttributeListener {
public void attributeAdded(HttpSessionBindingEvent event) {
System.out.println("Objeto adicionado na sessão: " + event.getName() + " value: " + event.getValue());
}
public void attributeRemoved(HttpSessionBindingEvent event) {
System.out.println("Objeto removido da sessão: " + event.getName() + " value: " + event.getValue());
}
public void attributeReplaced(HttpSessionBindingEvent event) {
System.out.println("Objeto substituído na sessão: " + event.getName() + " value: " + event.getValue());
}
} | [
"savio.maciel@cnpq.br"
] | savio.maciel@cnpq.br |
1b48b5795c7a3e9df4fedac36e20884920b23cf4 | bc7a50e08f43bc7dd155e7b91feef364328ebde9 | /spring-d06-BeanDI/src/frame/study/ui/Client.java | a677177ccfd3e220d588c5aca5302353d32e5181 | [] | no_license | beipiaocanglang/25_spring_code | 7eaff3106780256d122c3ffd7657da098cfaafbc | e5f0e367f6923b70280f20739e400055716cf081 | refs/heads/master | 2021-08-29T17:44:33.802194 | 2017-12-14T14:10:29 | 2017-12-14T14:10:29 | 114,258,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 866 | java | package frame.study.ui;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import frame.study.bean.UserBean;
import frame.study.bean.UserBean1;
import frame.study.bean.UserBean2;
import frame.study.bean.UserBean3;
import frame.study.bean.UserBean4;
public class Client {
public static void main(String[] args) {
ApplicationContext ac = new ClassPathXmlApplicationContext("bean.xml");
/*UserBean bean = (UserBean)ac.getBean("userbean");
bean.saveUser();*/
/*UserBean1 bean1 = (UserBean1)ac.getBean("userbean1");
bean1.saveUser();*/
/*UserBean2 bean2 = (UserBean2)ac.getBean("userbean2");
bean2.saveUser();*/
/*UserBean3 bean3 = (UserBean3)ac.getBean("userbean3");
bean3.saveUser();*/
UserBean4 bean4 = (UserBean4)ac.getBean("myArray");
bean4.saveUser();
}
}
| [
"yUhU13552247687"
] | yUhU13552247687 |
f7e0bfe9b720df28196a3ce8bb585547bbf77b4c | a0d26315e63decad2044a08d25672570ff9f5818 | /src/Medium/Longest_Substring_Without_Repeating_Characters.java | f003c1f04dcecdf9c029c4c938a317ef77320a7a | [
"Apache-2.0"
] | permissive | GSephrioth/LeetCode | 4bd9d84a5891805a42af47bf43cf0c8b7be41e14 | e5fde610be15a7b2266dcc61d5a4023e5841093a | refs/heads/master | 2021-05-16T18:24:20.333438 | 2020-09-29T08:23:33 | 2020-09-29T08:23:47 | 95,619,130 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,790 | java | package Medium;
import java.util.Arrays;
import java.util.HashSet;
/**
* Given a string, find the length of the longest substring without repeating characters.
* Examples:
* Given "abcabcbb", the answer is "abc", which the length is 3.
* Given "bbbbb", the answer is "b", with the length of 1.
* Given "pwwkew", the answer is "wke", with the length of 3. Note that the answer must be a substring, "pwke" is a subsequence and not a substring.
* Created by Elliott Chen on 6/27/17.
*/
class Longest_Substring_Without_Repeating_Characters {
//单次遍历字符串,将start和end之间的char存储于HS,
// int lengthOfLongestSubstring(String s) {
// int start = 0, end = 0, max = 0;
// HashSet<Character> HS = new HashSet<>();
// while (end < s.length()) {
// char endchar = s.charAt(end);
// if (HS.contains(endchar)) {
// if (max < end - start) {
// max = end - start;
// }
// while (s.charAt(start) != endchar) {
// HS.remove(s.charAt(start));
// start++;
// }
// start++;
// } else {
// HS.add(endchar);
// }
// end++;
// }
// max = Math.max(max, end - start);
// return max;
// }
//单次遍历字符串,记录两个相同char之间下标之差
int lengthOfLongestSubstring(String s) {
int[] map = new int[256];
Arrays.fill(map, -1);
int max = 0;
int last = -1;
for(int i = 0; i < s.length(); i++) {
last = Math.max(map[s.charAt(i)], last);
map[s.charAt(i)] = i;
max = Math.max(max, i - last);
}
return max;
}
}
| [
"596620726@qq.com"
] | 596620726@qq.com |
268d0270f54e396092425024a1aca3ca49ea3a6c | eb63cb2bb6e324f4514db508812aeedbcbb32735 | /spring-cloud-service-consumer-feign/src/main/java/zx/sc/springcloudserviceconsumerfeign/HelloErrorServiceImpl.java | e0ae2891a4af0189282e54b6367ba6f0c92ebd60 | [] | no_license | wm-hao/spring-cloud-sample | 551c80637500f427235a5cc4ddb935d3f465028d | 9121eac2b5d915faa9b8d4c072774ce3b22cb3e3 | refs/heads/master | 2020-03-19T21:20:14.679358 | 2018-06-14T14:02:52 | 2018-06-14T14:02:52 | 134,803,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 301 | java | package zx.sc.springcloudserviceconsumerfeign;
import org.springframework.stereotype.Component;
@Component
public class HelloErrorServiceImpl implements IHelloService{
@Override
public String sayHiFromClientOne(String name) throws Exception {
return "hi " + name + " error";
}
}
| [
"448826602@qq.com"
] | 448826602@qq.com |
be0e5d5702c2605bd8ef19b38a530815b2039589 | 4df4bcb6a849cbd6a72449f3fba7bacf33abdfc9 | /pixate-freestyle/src/com/pixate/freestyle/annotations/PXDocElement.java | ec3510d4adb48e767ce4a8a67ee9634effa5f3d5 | [
"LicenseRef-scancode-other-permissive",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | Pixate/pixate-freestyle-android | 3f89c45572a9d6909dcf6272075243c0f5707407 | d88f888834583d76658914fd62756854f953ad2c | refs/heads/master | 2022-07-05T08:29:16.111654 | 2015-09-08T20:02:18 | 2015-09-08T20:02:18 | 16,931,569 | 114 | 38 | null | 2015-02-02T17:50:59 | 2014-02-18T00:24:28 | Java | UTF-8 | Java | false | false | 1,175 | java | /*******************************************************************************
* Copyright 2012-present Pixate, 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.pixate.freestyle.annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface PXDocElement {
String comment() default "";
boolean hide() default false;
PXDocProperty[] properties() default {};
}
| [
"bill@billdawson.com"
] | bill@billdawson.com |
9fd4acb95a868154b20398959af1fb5e577acd8d | dc7b45b74b7296df23cb96f1e43dd09583b4f7af | /app/src/androidTest/java/com/example/charles/whowroteit/ExampleInstrumentedTest.java | 2ab8b6581c3e5d9e805898dea731b12f90598b20 | [] | no_license | munenek/WhoWroteIt | 5d6e244b5790ba3ba9ed7771c01f8c28219cfb32 | 9f76eae05fb438b54745f5f9f41724da5dc37072 | refs/heads/master | 2020-04-02T17:48:13.706842 | 2018-10-25T13:07:28 | 2018-10-25T13:07:28 | 154,672,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 764 | java | package com.example.charles.whowroteit;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.charles.whowroteit", appContext.getPackageName());
}
}
| [
"charlesmunenek@gmail.com"
] | charlesmunenek@gmail.com |
78fa1c6e9b49e23a4f9c94ff9c65378f2d4c60dd | 929eed8af7bc6be3b203667954a69321c1f4cf66 | /mobile/build/generated/source/r/debug/com/google/android/gms/analytics/R.java | ab1ab30a0c533bed8a5396cc93bc7e62d3df6ad5 | [] | no_license | vicjar/CalculadoraAndroid | 5f6eb4baae6bebd001b314331605a0320d41fb53 | b52cbd2adb089af347a37954df40bdbe5a256fd5 | refs/heads/master | 2016-09-13T00:15:39.685490 | 2016-05-02T05:15:20 | 2016-05-02T05:15:20 | 57,865,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 21,946 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms.analytics;
public final class R {
public static final class attr {
public static final int adSize = 0x7f010027;
public static final int adSizes = 0x7f010028;
public static final int adUnitId = 0x7f010029;
public static final int ambientEnabled = 0x7f0100e4;
public static final int appTheme = 0x7f01013e;
public static final int buttonSize = 0x7f010106;
public static final int buyButtonAppearance = 0x7f010145;
public static final int buyButtonHeight = 0x7f010142;
public static final int buyButtonText = 0x7f010144;
public static final int buyButtonWidth = 0x7f010143;
public static final int cameraBearing = 0x7f0100d5;
public static final int cameraTargetLat = 0x7f0100d6;
public static final int cameraTargetLng = 0x7f0100d7;
public static final int cameraTilt = 0x7f0100d8;
public static final int cameraZoom = 0x7f0100d9;
public static final int circleCrop = 0x7f0100d3;
public static final int colorScheme = 0x7f010107;
public static final int environment = 0x7f01013f;
public static final int fragmentMode = 0x7f010141;
public static final int fragmentStyle = 0x7f010140;
public static final int imageAspectRatio = 0x7f0100d2;
public static final int imageAspectRatioAdjust = 0x7f0100d1;
public static final int liteMode = 0x7f0100da;
public static final int mapType = 0x7f0100d4;
public static final int maskedWalletDetailsBackground = 0x7f010148;
public static final int maskedWalletDetailsButtonBackground = 0x7f01014a;
public static final int maskedWalletDetailsButtonTextAppearance = 0x7f010149;
public static final int maskedWalletDetailsHeaderTextAppearance = 0x7f010147;
public static final int maskedWalletDetailsLogoImageType = 0x7f01014c;
public static final int maskedWalletDetailsLogoTextColor = 0x7f01014b;
public static final int maskedWalletDetailsTextAppearance = 0x7f010146;
public static final int scopeUris = 0x7f010108;
public static final int uiCompass = 0x7f0100db;
public static final int uiMapToolbar = 0x7f0100e3;
public static final int uiRotateGestures = 0x7f0100dc;
public static final int uiScrollGestures = 0x7f0100dd;
public static final int uiTiltGestures = 0x7f0100de;
public static final int uiZoomControls = 0x7f0100df;
public static final int uiZoomGestures = 0x7f0100e0;
public static final int useViewLifecycle = 0x7f0100e1;
public static final int windowTransitionStyle = 0x7f0100bc;
public static final int zOrderOnTop = 0x7f0100e2;
}
public static final class color {
public static final int common_action_bar_splitter = 0x7f0c0015;
public static final int common_google_signin_btn_text_dark = 0x7f0c0075;
public static final int common_google_signin_btn_text_dark_default = 0x7f0c0016;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f0c0017;
public static final int common_google_signin_btn_text_dark_focused = 0x7f0c0018;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f0c0019;
public static final int common_google_signin_btn_text_light = 0x7f0c0076;
public static final int common_google_signin_btn_text_light_default = 0x7f0c001a;
public static final int common_google_signin_btn_text_light_disabled = 0x7f0c001b;
public static final int common_google_signin_btn_text_light_focused = 0x7f0c001c;
public static final int common_google_signin_btn_text_light_pressed = 0x7f0c001d;
public static final int common_plus_signin_btn_text_dark = 0x7f0c0077;
public static final int common_plus_signin_btn_text_dark_default = 0x7f0c001e;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f0c001f;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f0c0020;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f0c0021;
public static final int common_plus_signin_btn_text_light = 0x7f0c0078;
public static final int common_plus_signin_btn_text_light_default = 0x7f0c0022;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f0c0023;
public static final int common_plus_signin_btn_text_light_focused = 0x7f0c0024;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f0c0025;
public static final int place_autocomplete_prediction_primary_text = 0x7f0c0046;
public static final int place_autocomplete_prediction_primary_text_highlight = 0x7f0c0047;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0c0048;
public static final int place_autocomplete_search_hint = 0x7f0c0049;
public static final int place_autocomplete_search_text = 0x7f0c004a;
public static final int place_autocomplete_separator = 0x7f0c004b;
public static final int wallet_bright_foreground_disabled_holo_light = 0x7f0c005e;
public static final int wallet_bright_foreground_holo_dark = 0x7f0c005f;
public static final int wallet_bright_foreground_holo_light = 0x7f0c0060;
public static final int wallet_dim_foreground_disabled_holo_dark = 0x7f0c0061;
public static final int wallet_dim_foreground_holo_dark = 0x7f0c0062;
public static final int wallet_dim_foreground_inverse_disabled_holo_dark = 0x7f0c0063;
public static final int wallet_dim_foreground_inverse_holo_dark = 0x7f0c0064;
public static final int wallet_highlighted_text_holo_dark = 0x7f0c0065;
public static final int wallet_highlighted_text_holo_light = 0x7f0c0066;
public static final int wallet_hint_foreground_holo_dark = 0x7f0c0067;
public static final int wallet_hint_foreground_holo_light = 0x7f0c0068;
public static final int wallet_holo_blue_light = 0x7f0c0069;
public static final int wallet_link_text_light = 0x7f0c006a;
public static final int wallet_primary_text_holo_light = 0x7f0c007b;
public static final int wallet_secondary_text_holo_dark = 0x7f0c007c;
}
public static final class dimen {
public static final int place_autocomplete_button_padding = 0x7f09006f;
public static final int place_autocomplete_powered_by_google_height = 0x7f090070;
public static final int place_autocomplete_powered_by_google_start = 0x7f090071;
public static final int place_autocomplete_prediction_height = 0x7f090072;
public static final int place_autocomplete_prediction_horizontal_margin = 0x7f090073;
public static final int place_autocomplete_prediction_primary_text = 0x7f090074;
public static final int place_autocomplete_prediction_secondary_text = 0x7f090075;
public static final int place_autocomplete_progress_horizontal_margin = 0x7f090076;
public static final int place_autocomplete_progress_size = 0x7f090077;
public static final int place_autocomplete_separator_start = 0x7f090078;
}
public static final class drawable {
public static final int cast_ic_notification_0 = 0x7f02004b;
public static final int cast_ic_notification_1 = 0x7f02004c;
public static final int cast_ic_notification_2 = 0x7f02004d;
public static final int cast_ic_notification_connecting = 0x7f02004e;
public static final int cast_ic_notification_on = 0x7f02004f;
public static final int common_full_open_on_phone = 0x7f020050;
public static final int common_google_signin_btn_icon_dark = 0x7f020051;
public static final int common_google_signin_btn_icon_dark_disabled = 0x7f020052;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f020053;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f020054;
public static final int common_google_signin_btn_icon_dark_pressed = 0x7f020055;
public static final int common_google_signin_btn_icon_light = 0x7f020056;
public static final int common_google_signin_btn_icon_light_disabled = 0x7f020057;
public static final int common_google_signin_btn_icon_light_focused = 0x7f020058;
public static final int common_google_signin_btn_icon_light_normal = 0x7f020059;
public static final int common_google_signin_btn_icon_light_pressed = 0x7f02005a;
public static final int common_google_signin_btn_text_dark = 0x7f02005b;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f02005c;
public static final int common_google_signin_btn_text_dark_focused = 0x7f02005d;
public static final int common_google_signin_btn_text_dark_normal = 0x7f02005e;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f02005f;
public static final int common_google_signin_btn_text_light = 0x7f020060;
public static final int common_google_signin_btn_text_light_disabled = 0x7f020061;
public static final int common_google_signin_btn_text_light_focused = 0x7f020062;
public static final int common_google_signin_btn_text_light_normal = 0x7f020063;
public static final int common_google_signin_btn_text_light_pressed = 0x7f020064;
public static final int common_ic_googleplayservices = 0x7f020065;
public static final int common_plus_signin_btn_icon_dark = 0x7f020066;
public static final int common_plus_signin_btn_icon_dark_disabled = 0x7f020067;
public static final int common_plus_signin_btn_icon_dark_focused = 0x7f020068;
public static final int common_plus_signin_btn_icon_dark_normal = 0x7f020069;
public static final int common_plus_signin_btn_icon_dark_pressed = 0x7f02006a;
public static final int common_plus_signin_btn_icon_light = 0x7f02006b;
public static final int common_plus_signin_btn_icon_light_disabled = 0x7f02006c;
public static final int common_plus_signin_btn_icon_light_focused = 0x7f02006d;
public static final int common_plus_signin_btn_icon_light_normal = 0x7f02006e;
public static final int common_plus_signin_btn_icon_light_pressed = 0x7f02006f;
public static final int common_plus_signin_btn_text_dark = 0x7f020070;
public static final int common_plus_signin_btn_text_dark_disabled = 0x7f020071;
public static final int common_plus_signin_btn_text_dark_focused = 0x7f020072;
public static final int common_plus_signin_btn_text_dark_normal = 0x7f020073;
public static final int common_plus_signin_btn_text_dark_pressed = 0x7f020074;
public static final int common_plus_signin_btn_text_light = 0x7f020075;
public static final int common_plus_signin_btn_text_light_disabled = 0x7f020076;
public static final int common_plus_signin_btn_text_light_focused = 0x7f020077;
public static final int common_plus_signin_btn_text_light_normal = 0x7f020078;
public static final int common_plus_signin_btn_text_light_pressed = 0x7f020079;
public static final int ic_plusone_medium_off_client = 0x7f020090;
public static final int ic_plusone_small_off_client = 0x7f020091;
public static final int ic_plusone_standard_off_client = 0x7f020092;
public static final int ic_plusone_tall_off_client = 0x7f020093;
public static final int places_ic_clear = 0x7f0200a2;
public static final int places_ic_search = 0x7f0200a3;
public static final int powered_by_google_dark = 0x7f0200a4;
public static final int powered_by_google_light = 0x7f0200a5;
}
public static final class id {
public static final int adjust_height = 0x7f0d0035;
public static final int adjust_width = 0x7f0d0036;
public static final int android_pay = 0x7f0d0060;
public static final int android_pay_dark = 0x7f0d0057;
public static final int android_pay_light = 0x7f0d0058;
public static final int android_pay_light_with_border = 0x7f0d0059;
public static final int auto = 0x7f0d0042;
public static final int book_now = 0x7f0d0050;
public static final int buyButton = 0x7f0d004d;
public static final int buy_now = 0x7f0d0051;
public static final int buy_with = 0x7f0d0052;
public static final int buy_with_google = 0x7f0d0053;
public static final int cast_notification_id = 0x7f0d0004;
public static final int classic = 0x7f0d005a;
public static final int dark = 0x7f0d0043;
public static final int donate_with = 0x7f0d0054;
public static final int donate_with_google = 0x7f0d0055;
public static final int google_wallet_classic = 0x7f0d005b;
public static final int google_wallet_grayscale = 0x7f0d005c;
public static final int google_wallet_monochrome = 0x7f0d005d;
public static final int grayscale = 0x7f0d005e;
public static final int holo_dark = 0x7f0d0047;
public static final int holo_light = 0x7f0d0048;
public static final int hybrid = 0x7f0d0037;
public static final int icon_only = 0x7f0d003f;
public static final int light = 0x7f0d0044;
public static final int logo_only = 0x7f0d0056;
public static final int match_parent = 0x7f0d004f;
public static final int monochrome = 0x7f0d005f;
public static final int none = 0x7f0d0011;
public static final int normal = 0x7f0d000d;
public static final int place_autocomplete_clear_button = 0x7f0d00b9;
public static final int place_autocomplete_powered_by_google = 0x7f0d00bb;
public static final int place_autocomplete_prediction_primary_text = 0x7f0d00bd;
public static final int place_autocomplete_prediction_secondary_text = 0x7f0d00be;
public static final int place_autocomplete_progress = 0x7f0d00bc;
public static final int place_autocomplete_search_button = 0x7f0d00b7;
public static final int place_autocomplete_search_input = 0x7f0d00b8;
public static final int place_autocomplete_separator = 0x7f0d00ba;
public static final int production = 0x7f0d0049;
public static final int sandbox = 0x7f0d004a;
public static final int satellite = 0x7f0d0038;
public static final int selectionDetails = 0x7f0d004e;
public static final int slide = 0x7f0d0031;
public static final int standard = 0x7f0d0040;
public static final int strict_sandbox = 0x7f0d004b;
public static final int terrain = 0x7f0d0039;
public static final int test = 0x7f0d004c;
public static final int wide = 0x7f0d0041;
public static final int wrap_content = 0x7f0d001b;
}
public static final class integer {
public static final int google_play_services_version = 0x7f0b0006;
}
public static final class layout {
public static final int place_autocomplete_fragment = 0x7f040032;
public static final int place_autocomplete_item_powered_by_google = 0x7f040033;
public static final int place_autocomplete_item_prediction = 0x7f040034;
public static final int place_autocomplete_progress = 0x7f040035;
}
public static final class raw {
public static final int gtm_analytics = 0x7f060000;
}
public static final class string {
public static final int accept = 0x7f07003f;
public static final int auth_google_play_services_client_facebook_display_name = 0x7f070043;
public static final int auth_google_play_services_client_google_display_name = 0x7f070044;
public static final int cast_notification_connected_message = 0x7f070046;
public static final int cast_notification_connecting_message = 0x7f070047;
public static final int cast_notification_disconnect = 0x7f070048;
public static final int common_google_play_services_api_unavailable_text = 0x7f070013;
public static final int common_google_play_services_enable_button = 0x7f070014;
public static final int common_google_play_services_enable_text = 0x7f070015;
public static final int common_google_play_services_enable_title = 0x7f070016;
public static final int common_google_play_services_install_button = 0x7f070017;
public static final int common_google_play_services_install_text_phone = 0x7f070018;
public static final int common_google_play_services_install_text_tablet = 0x7f070019;
public static final int common_google_play_services_install_title = 0x7f07001a;
public static final int common_google_play_services_invalid_account_text = 0x7f07001b;
public static final int common_google_play_services_invalid_account_title = 0x7f07001c;
public static final int common_google_play_services_network_error_text = 0x7f07001d;
public static final int common_google_play_services_network_error_title = 0x7f07001e;
public static final int common_google_play_services_notification_ticker = 0x7f07001f;
public static final int common_google_play_services_restricted_profile_text = 0x7f070020;
public static final int common_google_play_services_restricted_profile_title = 0x7f070021;
public static final int common_google_play_services_sign_in_failed_text = 0x7f070022;
public static final int common_google_play_services_sign_in_failed_title = 0x7f070023;
public static final int common_google_play_services_unknown_issue = 0x7f070024;
public static final int common_google_play_services_unsupported_text = 0x7f070025;
public static final int common_google_play_services_unsupported_title = 0x7f070026;
public static final int common_google_play_services_update_button = 0x7f070027;
public static final int common_google_play_services_update_text = 0x7f070028;
public static final int common_google_play_services_update_title = 0x7f070029;
public static final int common_google_play_services_updating_text = 0x7f07002a;
public static final int common_google_play_services_updating_title = 0x7f07002b;
public static final int common_google_play_services_wear_update_text = 0x7f07002c;
public static final int common_open_on_phone = 0x7f07002d;
public static final int common_signin_button_text = 0x7f07002e;
public static final int common_signin_button_text_long = 0x7f07002f;
public static final int create_calendar_message = 0x7f07004a;
public static final int create_calendar_title = 0x7f07004b;
public static final int decline = 0x7f07004c;
public static final int place_autocomplete_clear_button = 0x7f07003b;
public static final int place_autocomplete_search_hint = 0x7f07003c;
public static final int store_picture_message = 0x7f07004d;
public static final int store_picture_title = 0x7f07004e;
public static final int wallet_buy_button_place_holder = 0x7f07003e;
}
public static final class style {
public static final int Theme_AppInvite_Preview = 0x7f0a0102;
public static final int Theme_AppInvite_Preview_Base = 0x7f0a001d;
public static final int Theme_IAPTheme = 0x7f0a0109;
public static final int WalletFragmentDefaultButtonTextAppearance = 0x7f0a0111;
public static final int WalletFragmentDefaultDetailsHeaderTextAppearance = 0x7f0a0112;
public static final int WalletFragmentDefaultDetailsTextAppearance = 0x7f0a0113;
public static final int WalletFragmentDefaultStyle = 0x7f0a0114;
}
public static final class styleable {
public static final int[] AdsAttrs = { 0x7f010027, 0x7f010028, 0x7f010029 };
public static final int AdsAttrs_adSize = 0;
public static final int AdsAttrs_adSizes = 1;
public static final int AdsAttrs_adUnitId = 2;
public static final int[] CustomWalletTheme = { 0x7f0100bc };
public static final int CustomWalletTheme_windowTransitionStyle = 0;
public static final int[] LoadingImageView = { 0x7f0100d1, 0x7f0100d2, 0x7f0100d3 };
public static final int LoadingImageView_circleCrop = 2;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 0;
public static final int[] MapAttrs = { 0x7f0100d4, 0x7f0100d5, 0x7f0100d6, 0x7f0100d7, 0x7f0100d8, 0x7f0100d9, 0x7f0100da, 0x7f0100db, 0x7f0100dc, 0x7f0100dd, 0x7f0100de, 0x7f0100df, 0x7f0100e0, 0x7f0100e1, 0x7f0100e2, 0x7f0100e3, 0x7f0100e4 };
public static final int MapAttrs_ambientEnabled = 16;
public static final int MapAttrs_cameraBearing = 1;
public static final int MapAttrs_cameraTargetLat = 2;
public static final int MapAttrs_cameraTargetLng = 3;
public static final int MapAttrs_cameraTilt = 4;
public static final int MapAttrs_cameraZoom = 5;
public static final int MapAttrs_liteMode = 6;
public static final int MapAttrs_mapType = 0;
public static final int MapAttrs_uiCompass = 7;
public static final int MapAttrs_uiMapToolbar = 15;
public static final int MapAttrs_uiRotateGestures = 8;
public static final int MapAttrs_uiScrollGestures = 9;
public static final int MapAttrs_uiTiltGestures = 10;
public static final int MapAttrs_uiZoomControls = 11;
public static final int MapAttrs_uiZoomGestures = 12;
public static final int MapAttrs_useViewLifecycle = 13;
public static final int MapAttrs_zOrderOnTop = 14;
public static final int[] SignInButton = { 0x7f010106, 0x7f010107, 0x7f010108 };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
public static final int[] WalletFragmentOptions = { 0x7f01013e, 0x7f01013f, 0x7f010140, 0x7f010141 };
public static final int WalletFragmentOptions_appTheme = 0;
public static final int WalletFragmentOptions_environment = 1;
public static final int WalletFragmentOptions_fragmentMode = 3;
public static final int WalletFragmentOptions_fragmentStyle = 2;
public static final int[] WalletFragmentStyle = { 0x7f010142, 0x7f010143, 0x7f010144, 0x7f010145, 0x7f010146, 0x7f010147, 0x7f010148, 0x7f010149, 0x7f01014a, 0x7f01014b, 0x7f01014c };
public static final int WalletFragmentStyle_buyButtonAppearance = 3;
public static final int WalletFragmentStyle_buyButtonHeight = 0;
public static final int WalletFragmentStyle_buyButtonText = 2;
public static final int WalletFragmentStyle_buyButtonWidth = 1;
public static final int WalletFragmentStyle_maskedWalletDetailsBackground = 6;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7;
public static final int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9;
public static final int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4;
}
}
| [
"victorjair100@gmail.com"
] | victorjair100@gmail.com |
e6a44df3fdcfa01b7a6d97abb3e2d8fee8be1464 | b4bd429351eadae80569c5790632fbf310760c82 | /src/com/questvisual/wordlens/messaging/e.java | 12e59e7ab70f7b0ae2bb4275ca23c9543f5a239a | [] | no_license | Kolimar/WorldLensSource | 18b615ef986296e49fde1dca25facba65338e1a2 | d0fd5c2292bcbc8a0f81adf3a18884ff6ad3d3e7 | refs/heads/master | 2020-12-05T15:16:27.560401 | 2016-06-02T05:10:30 | 2016-06-02T05:10:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 877 | java | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.questvisual.wordlens.messaging;
import com.questvisual.util.b;
// Referenced classes of package com.questvisual.wordlens.messaging:
// a, g
public class e extends a
{
public double b;
public double c;
public double d;
public double e;
public e(g g, byte abyte0[])
{
super(g, abyte0);
b = -9.2233720368547758E+18D;
c = -9.2233720368547758E+18D;
d = -9.2233720368547758E+18D;
e = -9.2233720368547758E+18D;
b = com.questvisual.util.b.c(abyte0, 0);
c = com.questvisual.util.b.c(abyte0, 8);
d = com.questvisual.util.b.c(abyte0, 16);
e = com.questvisual.util.b.c(abyte0, 24);
}
}
| [
"mvp@uber.com"
] | mvp@uber.com |
5364f7bee8a72e29b0b7384580aa6b2839db3422 | a10a42f3bcee7672b50721c01c7cdd6570e940c9 | /app/src/main/java/com/cpigeon/app/modular/usercenter/model/daoimpl/RegisterDaoImpl.java | 2db18e81739e2c64e86053e18003872e55f50ff0 | [] | no_license | carleewang/CAppPlus | b31360517bd1dbad41a8c721eb8148573be86ec7 | 33086724720da165cc225539857d2ed1728b5c2c | refs/heads/master | 2021-09-28T09:19:22.814732 | 2018-11-16T08:57:56 | 2018-11-16T08:57:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,380 | java | package com.cpigeon.app.modular.usercenter.model.daoimpl;
import com.cpigeon.app.commonstandard.model.daoimpl.SendVerificationCodeImpl;
import com.cpigeon.app.modular.usercenter.model.dao.IRegisterDao;
import com.cpigeon.app.utils.CallAPI;
import java.net.ConnectException;
/**
* Created by chenshuai on 2017/4/8.
*/
public class RegisterDaoImpl extends SendVerificationCodeImpl implements IRegisterDao {
CallAPI.Callback registUserCallback = new CallAPI.Callback() {
@Override
public void onSuccess(Object data) {
if (onCompleteListener != null)
onCompleteListener.onSuccess(data);
}
@Override
public void onError(int errorType, Object data) {
if (onCompleteListener == null) return;
String msg = "注册失败,请稍候再试";
if (errorType == ERROR_TYPE_API_RETURN) {
switch ((int) data) {
case 1000:
msg = "手机号码,验证码,或密码不能为空";
break;
case 1002:
msg = "该手机号已被注册";
break;
case 1003:
msg = "验证码失效";
}
} else if (errorType == ERROR_TYPE_REQUST_EXCEPTION) {
if (data instanceof ConnectException)
msg = "网络无法连接,请检查您的网络";
}
onCompleteListener.onFail(msg);
}
};
CallAPI.Callback resetUserPasswordCallback = new CallAPI.Callback() {
@Override
public void onSuccess(Object data) {
if (onCompleteListener != null)
onCompleteListener.onSuccess(data);
}
@Override
public void onError(int errorType, Object data) {
if (onCompleteListener == null) return;
String msg = "重置失败,请稍候再试";
if (errorType == ERROR_TYPE_API_RETURN) {
switch ((int) data) {
case 1000:
msg = "手机号码,验证码,或密码不能为空";
break;
case 1002:
msg = "没有查到与此手机号码绑定的账户";
break;
case 1003:
msg = "验证码失效";
break;
}
} else if (errorType == ERROR_TYPE_REQUST_EXCEPTION) {
if (data instanceof ConnectException)
msg = "网络无法连接,请检查您的网络";
}
onCompleteListener.onFail(msg);
}
};
IRegisterDao.OnCompleteListener onCompleteListener;
@Override
public void registUser(String phoneNumber, String password, String yzm, OnCompleteListener onCompleteListener) {
this.onCompleteListener = onCompleteListener;
CallAPI.registUser(phoneNumber, password, yzm, registUserCallback);
}
@Override
public void findUserPassword(String phoneNumber, String password, String yzm, OnCompleteListener onCompleteListener) {
this.onCompleteListener = onCompleteListener;
CallAPI.findUserPassword(phoneNumber, password, yzm, resetUserPasswordCallback);
}
}
| [
"656452024@qq.com"
] | 656452024@qq.com |
80b06ca8ece85634ef66e6ed7004089f5dcf9063 | 545f9f2023ad3727fb1a1b993239cd12e32ade5b | /src/main/java/com/leecx/controller/TwoInterceptorController.java | dba5a11e30b2cb3b6af304c203c32593a909bf5a | [] | no_license | yinfengjiujian/projectStart | 841661f93e257fda53d4cc73c896d50df6d083e1 | 8df6954e4bb9140ac90b819b018cfce533c08996 | refs/heads/master | 2020-03-10T10:46:37.432509 | 2018-04-19T08:47:05 | 2018-04-19T08:47:05 | 129,340,972 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,522 | java | package com.leecx.controller;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.leecx.pojo.User;
@Controller
@RequestMapping("/two")
public class TwoInterceptorController {
@RequestMapping("/index")
public String index(ModelMap map) {
map.addAttribute("name", "itzixi22");
return "thymeleaf/index";
}
@RequestMapping("center")
public String center() {
return "thymeleaf/center/center";
}
@RequestMapping("test")
public String test(ModelMap map) {
User user = new User();
user.setAge(18);
user.setName("manager");
user.setPassword("123456");
user.setBirthday(new Date());
map.addAttribute("user", user);
User u1 = new User();
u1.setAge(19);
u1.setName("itzixi");
u1.setPassword("123456");
u1.setBirthday(new Date());
User u2 = new User();
u2.setAge(17);
u2.setName("LeeCX");
u2.setPassword("123456");
u2.setBirthday(new Date());
List<User> userList = new ArrayList<>();
userList.add(user);
userList.add(u1);
userList.add(u2);
map.addAttribute("userList", userList);
return "thymeleaf/test";
}
@PostMapping("postform")
public String postform(User user) {
System.out.println(user.getName());
return "redirect:/th/test";
}
} | [
"duanmeilin911@163.com"
] | duanmeilin911@163.com |
2d10342e0c40fea60ffa432e4548ec2abfb12e42 | 400fa21f2e6c107e8376e17d03af4d744204a715 | /translator-gui/src/main/java/ru/ezhov/translator/gui/OutputResult.java | 932b1e09ba6fce602aa5d099e12c324dd54a4d2d | [] | no_license | ezhov-da/translator | 74ea7ed26e755de9d2ffc1e8f61e097b74d0a730 | 14707e03a8241af206f166b46715aa205cceba3e | refs/heads/master | 2022-05-26T09:27:34.627981 | 2020-06-30T05:43:05 | 2020-06-30T05:43:05 | 139,899,823 | 0 | 0 | null | 2021-08-23T19:53:32 | 2018-07-05T20:57:13 | Java | UTF-8 | Java | false | false | 99 | java | package ru.ezhov.translator.gui;
public interface OutputResult {
void setText(String text);
}
| [
"ezhdenis@yandex.ru"
] | ezhdenis@yandex.ru |
1a16974daa53b8f2d72b5e56efb2b846c223fdce | 38c145c55db02b57fe232ebf1adb580c239bce41 | /src/BasicsOfSoftwareCodeDevelopment/Branching/Task4.java | 1bb09c206ef7fad7ec30713179c7570b4dcaadca | [] | no_license | art-orient/UpSkillLab1 | 45ed3598a9f1bb13dd186cc1ac0947cf1e33e5c7 | 2e15814c30143e2d6d1ec1825406d61832021c2f | refs/heads/main | 2023-02-01T07:15:26.512383 | 2020-12-19T12:34:58 | 2020-12-19T12:34:58 | 302,310,016 | 0 | 0 | null | 2020-10-08T13:49:39 | 2020-10-08T10:50:47 | null | UTF-8 | Java | false | false | 729 | java | package BasicsOfSoftwareCodeDevelopment.Branching;
// 4. Заданы размеры А, В прямоугольного отверстия и размеры х, у, z кирпича.
// Определить, пройдет ли кирпич через отверстие.
public class Task4 {
public static String task4(int a, int b, int x, int y, int z) {
if ((a >= x && b >= y) || (a >= y && b >= x) ||
(a >= y && b >= z) || (a >= z && b >= y) ||
(a >= x && b >= z) || (a >= z && b >= x)) {
return "Кирпич пройдет через отверстие";
} else {
return "Кирпич не пройдет через отверстие";
}
}
} | [
"art-orient@tut.by"
] | art-orient@tut.by |
593d375fbf9b10775c82dabee6400ffabd17b417 | 65699b1b908eb71186f93ba10dfe483b406538e7 | /app/src/main/java/net/kaisoz/droidstorm/PreferencesActivity.java | 8438af4d4de7b717448fed57f9fa8959ba55badb | [] | no_license | kaisoz/DroidStorm | 002a72a7fda29b8522503c7481882b84169b90c4 | 8c7005b372b71abdb40a5d3fa1d8d68cefdbca94 | refs/heads/master | 2020-12-24T12:32:24.154258 | 2016-11-07T09:45:39 | 2016-11-07T09:45:39 | 72,987,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,783 | java | package net.kaisoz.droidstorm;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import net.kaisoz.droidstorm.nxt.handler.NXTHandlerBaseActivity;
import net.kaisoz.droidstorm.util.DroidStormApp;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.PreferenceActivity;
import android.widget.Toast;
/**
* Activity that manages the application preferences. Managed preferences are:
* - Application language
* - Motor ports - wheels associated
* - Operation mode: Synchronized or Follower
* - IR Emitter port (in case of follower mode)
*
* @author Tomás Tormo Franco
*/
public class PreferencesActivity extends PreferenceActivity implements OnSharedPreferenceChangeListener {
private HashMap<CharSequence, CharSequence> mSummaries;
private DroidStormApp mApp;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setLocale();
addPreferencesFromResource(R.xml.preferences);
mApp = (DroidStormApp) getApplication();
mSummaries = new HashMap<CharSequence, CharSequence>();
mSummaries.put(this.getText(R.string.prf_motorRight_id), this.getText(R.string.prf_motorRight_summary));
mSummaries.put(this.getText(R.string.prf_motorLeft_id), this.getText(R.string.prf_motorLeft_summary));
mSummaries.put(this.getText(R.string.prf_irPort_id), this.getText(R.string.prf_irPort_summary));
mSummaries.put(this.getText(R.string.prf_synchMode_id), this.getText(R.string.prf_synchMode_summary));
mSummaries.put(this.getText(R.string.prf_locale_id), this.getText(R.string.prf_locale_summary));
ListPreference synch = (ListPreference) findPreference(this.getText(R.string.prf_synchMode_id));
EditTextPreference firstStart = (EditTextPreference) findPreference(this.getText(R.string.prf_firstStart_id));
ListPreference irport = (ListPreference) findPreference(this.getText(R.string.prf_irPort_id));
boolean firstStartVal = Boolean.valueOf(firstStart.getText());
int synchVal = Integer.valueOf(synch.getValue()).intValue();
if (firstStartVal) {
Toast.makeText(this, R.string.toast_selectWheels, Toast.LENGTH_LONG).show();
ListPreference locale = (ListPreference) findPreference(this.getText(R.string.prf_locale_id));
locale.setValue(mApp.getDefaultLocale());
firstStart.setText("false");
}
if (synchVal == NXTHandlerBaseActivity.MODE_FOLLOW) {
Toast.makeText(this, R.string.toast_irEmitterOff, Toast.LENGTH_LONG).show();
irport.setEnabled(true);
irport.setSelectable(true);
} else {
irport.setEnabled(false);
irport.setSelectable(false);
}
updateSummary(null);
}
@Override
protected void onResume() {
super.onResume();
updateSummary(null);
// Set up a listener whenever a key changes
getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
if (key.equals(this.getText(R.string.prf_synchMode_id))) {
int synchVal = Integer.valueOf(((ListPreference) findPreference(key)).getValue()).intValue();
ListPreference irport = (ListPreference) findPreference(this.getText(R.string.prf_irPort_id));
if (synchVal == 1) {
irport.setEnabled(true);
irport.setSelectable(true);
} else {
irport.setEnabled(false);
irport.setSelectable(false);
}
mApp.setModeChanged(true);
} else if (key.equals(this.getText(R.string.prf_locale_id))) {
DroidStormApp app = (DroidStormApp) getApplication();
app.setDefaultLocale(((ListPreference) findPreference(key)).getValue());
app.setLocaleChanged(true);
setLocale();
refresh();
} else if (key.equals(this.getText(R.string.prf_motorLeft_id)) || key.equals(this.getText(R.string.prf_motorRight_id))) {
mApp.setWheelChanged(true);
}
updateSummary(key);
}
@Override
protected void onPause() {
super.onPause();
// Unregister the listener whenever a key changes
getPreferenceScreen().getSharedPreferences().unregisterOnSharedPreferenceChangeListener(this);
}
/**
* Sets the language
* Used to change the activity language on runtime
*/
private void setLocale() {
String locale = ((DroidStormApp) getApplication()).getDefaultLocale();
if (locale != null) {
Locale newLocale = new Locale(locale);
Locale.setDefault(newLocale);
Configuration configLocale = new Configuration();
configLocale.locale = newLocale;
getBaseContext().getResources().updateConfiguration(configLocale, null);
setTitle(R.string.activity_label_preferences);
}
}
/**
* Re-launches the activity
*/
private void refresh() {
finish();
Intent myIntent = new Intent(this, this.getClass());
startActivity(myIntent);
}
/**
* Updates configuration entries summary on runtime
*
* @param key key of the configuration entry which summary has to be changed
*/
private void updateSummary(String key) {
String summary = null;
if (key == null) {
Iterator<CharSequence> it = mSummaries.keySet().iterator();
while (it.hasNext()) {
String preferenceKey = (String) it.next();
ListPreference portPreference = (ListPreference) findPreference(preferenceKey);
if (portPreference != null && portPreference.getEntry() != null) {
summary = mSummaries.get(preferenceKey) + ": " + portPreference.getEntry();
portPreference.setSummary(summary);
}
}
} else {
ListPreference portPreference = (ListPreference) findPreference(key);
if (portPreference != null && portPreference.getEntry() != null) {
summary = mSummaries.get(key) + ": " + portPreference.getEntry();
portPreference.setSummary(summary);
}
}
}
}
| [
"tomas.tormo@gmail.com"
] | tomas.tormo@gmail.com |
65f45249836ccaf91214ed5b278d313788d8892f | 8f725927104fb791d72530356d2288689e632eee | /src/main/java/no/hib/models/MultipleAppointments.java | e950c08cb78819b37db3eea47757e08816ffffac | [
"Apache-2.0"
] | permissive | adrianrutle/msadmin | 56e0e781dcea01a36fe81c8fa64004d71bd6b9fb | 7567484cf72d510ab66fce7acf57fd34e9d74a6d | refs/heads/master | 2021-05-04T00:50:28.876017 | 2018-03-22T20:26:18 | 2018-03-22T20:26:18 | 120,348,825 | 0 | 1 | null | 2018-02-05T19:08:00 | 2018-02-05T19:07:59 | null | UTF-8 | Java | false | false | 1,535 | java | package no.hib.models;
import org.joda.time.DateTime;
import org.springframework.format.annotation.DateTimeFormat;
public class MultipleAppointments {
@DateTimeFormat(pattern = "yyyy-MM-dd'T'HH:mm")
private DateTime startDateTime;
private String patientSsn;
private String doctorSsn;
private int numberOfConsecutiveAppointments;
public MultipleAppointments(DateTime startDateTime, String patientSsn, String doctorSsn, int numberOfConsecutiveAppointments) {
this.startDateTime = startDateTime;
this.patientSsn = patientSsn;
this.doctorSsn = doctorSsn;
this.numberOfConsecutiveAppointments = numberOfConsecutiveAppointments;
}
public MultipleAppointments() {
}
public int getNumberOfConsecutiveAppointments() {
return numberOfConsecutiveAppointments;
}
public void setNumberOfConsecutiveAppointments(int numberOfConsecutiveAppointments) {
this.numberOfConsecutiveAppointments = numberOfConsecutiveAppointments;
}
public DateTime getStartDateTime() {
return startDateTime;
}
public void setStartDateTime(DateTime startDateTime) {
this.startDateTime = startDateTime;
}
public String getPatientSsn() {
return patientSsn;
}
public void setPatientSsn(String patientSsn) {
this.patientSsn = patientSsn;
}
public String getDoctorSsn() {
return doctorSsn;
}
public void setDoctorSsn(String doctorSsn) {
this.doctorSsn = doctorSsn;
}
}
| [
"Karina Haugen"
] | Karina Haugen |
2d9737900d976a9a7ae3f3ce9275157d1fda91cc | 1ca86d5d065372093c5f2eae3b1a146dc0ba4725 | /dozer/src/main/java/com/surya/dozer/MyCustomConvertor.java | 30e38bb359c985a0e76d4244256db69854b74efa | [] | no_license | Suryakanta97/DemoExample | 1e05d7f13a9bc30f581a69ce811fc4c6c97f2a6e | 5c6b831948e612bdc2d9d578a581df964ef89bfb | refs/heads/main | 2023-08-10T17:30:32.397265 | 2021-09-22T16:18:42 | 2021-09-22T16:18:42 | 391,087,435 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,524 | java | package com.surya.dozer;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.dozer.CustomConverter;
import org.dozer.MappingException;
public class MyCustomConvertor implements CustomConverter {
@Override
public Object convert(Object dest, Object source, Class<?> arg2, Class<?> arg3) {
if (source == null) {
return null;
}
if (source instanceof Personne3) {
Personne3 person = (Personne3) source;
Date date = new Date(person.getDtob());
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
String isoDate = format.format(date);
return new Person3(person.getName(), isoDate);
} else if (source instanceof Person3) {
Person3 person = (Person3) source;
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Date date = null;
try {
date = format.parse(person.getDtob());
} catch (ParseException e) {
throw new MappingException("Converter MyCustomConvertor " + "used incorrectly:" + e.getMessage());
}
long timestamp = date.getTime();
return new Personne3(person.getName(), timestamp);
} else {
throw new MappingException("Converter MyCustomConvertor " + "used incorrectly. Arguments passed in were:" + dest + " and " + source);
}
}
}
| [
"suryakanta97@github.com"
] | suryakanta97@github.com |
71a4c3b67a8b72d986f94d6f131e040f29bb2362 | 7c469369ac8f36f270e9b6bbe2958211a409e844 | /PS11_codeBlooded/src/sounds/SoundClips.java | b1fef9b3dbc5798463d1dd524c5d5570efe8921c | [] | no_license | kylePerryUT/asteroidsGame | 88107d1f4d4af184e55b4141600a91c52a7dcf46 | 3ba23126df69a8aa5b2248503c4cff68b3e97d86 | refs/heads/master | 2020-04-08T09:47:32.858699 | 2018-12-06T03:46:13 | 2018-12-06T03:46:13 | 159,239,851 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,747 | java | package sounds;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.BufferedInputStream;
import java.io.IOException;
import javax.sound.sampled.*;
import javax.swing.*;
@SuppressWarnings("serial")
public class SoundClips
{
/** A Clip that, when played, sounds like a weapon being fired */
/**
* Creates the sound clips required.
*/
public SoundClips ()
{
// We create the clips in advance so that there will be no delay
// when we need to play them back. Note that the actual wav
// files are stored in the "sounds" project.
}
/**
* Creates an audio clip from a sound file.
*/
public Clip createClip (String soundFile)
{
// Opening the sound file this way will work no matter how the
// project is exported. The only restriction is that the
// sound files must be stored in a package.
try (BufferedInputStream sound = new BufferedInputStream(getClass().getResourceAsStream(soundFile)))
{
// Create and return a Clip that will play a sound file. There are
// various reasons that the creation attempt could fail. If it
// fails, return null.
Clip clip = AudioSystem.getClip();
clip.open(AudioSystem.getAudioInputStream(sound));
return clip;
}
catch (LineUnavailableException e)
{
return null;
}
catch (IOException e)
{
return null;
}
catch (UnsupportedAudioFileException e)
{
return null;
}
}
}
| [
"user@DESKTOP-1JTHIN8"
] | user@DESKTOP-1JTHIN8 |
4350b2adffc316d9e3a55ed6d42b95e57c84d08d | fa297c819471e1eca163a63c7ade699df6c096f0 | /src/main/java/za/co/tman/inventory/web/rest/errors/ExceptionTranslator.java | e1233dbd27f683259c22bbc2af32ec1144e04c08 | [] | no_license | kappaj2/IMN-InventoryModule | ddc1b8fbe992772d44af565b2bc500100a1d965a | 9cf52940e6dda2741191192acd7d0d8b969a7ec2 | refs/heads/master | 2020-03-20T22:38:59.594555 | 2018-07-24T07:45:26 | 2018-07-24T07:45:26 | 137,808,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,049 | java | package za.co.tman.inventory.web.rest.errors;
import za.co.tman.inventory.web.rest.util.HeaderUtil;
import org.springframework.dao.ConcurrencyFailureException;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.context.request.NativeWebRequest;
import org.zalando.problem.DefaultProblem;
import org.zalando.problem.Problem;
import org.zalando.problem.ProblemBuilder;
import org.zalando.problem.Status;
import org.zalando.problem.spring.web.advice.ProblemHandling;
import org.zalando.problem.spring.web.advice.validation.ConstraintViolationProblem;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.stream.Collectors;
/**
* Controller advice to translate the server side exceptions to client-friendly json structures.
* The error response follows RFC7807 - Problem Details for HTTP APIs (https://tools.ietf.org/html/rfc7807)
*/
@ControllerAdvice
public class ExceptionTranslator implements ProblemHandling {
/**
* Post-process Problem payload to add the message key for front-end if needed
*/
@Override
public ResponseEntity<Problem> process(@Nullable ResponseEntity<Problem> entity, NativeWebRequest request) {
if (entity == null || entity.getBody() == null) {
return entity;
}
Problem problem = entity.getBody();
if (!(problem instanceof ConstraintViolationProblem || problem instanceof DefaultProblem)) {
return entity;
}
ProblemBuilder builder = Problem.builder()
.withType(Problem.DEFAULT_TYPE.equals(problem.getType()) ? ErrorConstants.DEFAULT_TYPE : problem.getType())
.withStatus(problem.getStatus())
.withTitle(problem.getTitle())
.with("path", request.getNativeRequest(HttpServletRequest.class).getRequestURI());
if (problem instanceof ConstraintViolationProblem) {
builder
.with("violations", ((ConstraintViolationProblem) problem).getViolations())
.with("message", ErrorConstants.ERR_VALIDATION);
return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode());
} else {
builder
.withCause(((DefaultProblem) problem).getCause())
.withDetail(problem.getDetail())
.withInstance(problem.getInstance());
problem.getParameters().forEach(builder::with);
if (!problem.getParameters().containsKey("message") && problem.getStatus() != null) {
builder.with("message", "error.http." + problem.getStatus().getStatusCode());
}
return new ResponseEntity<>(builder.build(), entity.getHeaders(), entity.getStatusCode());
}
}
@Override
public ResponseEntity<Problem> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, @Nonnull NativeWebRequest request) {
BindingResult result = ex.getBindingResult();
List<FieldErrorVM> fieldErrors = result.getFieldErrors().stream()
.map(f -> new FieldErrorVM(f.getObjectName(), f.getField(), f.getCode()))
.collect(Collectors.toList());
Problem problem = Problem.builder()
.withType(ErrorConstants.CONSTRAINT_VIOLATION_TYPE)
.withTitle("Method argument not valid")
.withStatus(defaultConstraintViolationStatus())
.with("message", ErrorConstants.ERR_VALIDATION)
.with("fieldErrors", fieldErrors)
.build();
return create(ex, problem, request);
}
@ExceptionHandler(NoSuchElementException.class)
public ResponseEntity<Problem> handleNoSuchElementException(NoSuchElementException ex, NativeWebRequest request) {
Problem problem = Problem.builder()
.withStatus(Status.NOT_FOUND)
.with("message", ErrorConstants.ENTITY_NOT_FOUND_TYPE)
.build();
return create(ex, problem, request);
}
@ExceptionHandler(BadRequestAlertException.class)
public ResponseEntity<Problem> handleBadRequestAlertException(BadRequestAlertException ex, NativeWebRequest request) {
return create(ex, request, HeaderUtil.createFailureAlert(ex.getEntityName(), ex.getErrorKey(), ex.getMessage()));
}
@ExceptionHandler(ConcurrencyFailureException.class)
public ResponseEntity<Problem> handleConcurrencyFailure(ConcurrencyFailureException ex, NativeWebRequest request) {
Problem problem = Problem.builder()
.withStatus(Status.CONFLICT)
.with("message", ErrorConstants.ERR_CONCURRENCY_FAILURE)
.build();
return create(ex, problem, request);
}
}
| [
"kappaj@gmail.com"
] | kappaj@gmail.com |
409e387fdb125747a58b8ca505483101de463432 | cd7bac124d1f5bc7eb5b0ef5edab1e4bfd0423e9 | /app/src/main/java/com/example/megha/myapplication/adapter/SearchAdapter.java | 52d4e031fb4906fbc127f5762122f472a0f81c6b | [] | no_license | MeghaVaishy/sampleassigment | ab2456e40dc1636f444e046bc698899bcce09767 | 68ad1d170b3e5517848a03006a22fe72f30347f3 | refs/heads/master | 2020-03-30T06:10:51.515427 | 2018-09-30T14:52:40 | 2018-09-30T14:52:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,349 | java | package com.example.megha.myapplication.adapter;
import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.bumptech.glide.Glide;
import com.example.megha.myapplication.pojo.SearchPojo;
import com.example.megha.myapplication.R;
import java.util.List;
public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ItemHolder> {
private List<SearchPojo> searchlist;
private itemListListner itemListListner;
private Activity activity;
public SearchAdapter(List<SearchPojo> searchlist, itemListListner itemListListner, Activity activity) {
this.searchlist = searchlist;
this.itemListListner = itemListListner;
this.activity = activity;
}
@Override
public ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item, parent, false);
return new ItemHolder(itemView);
}
@Override
public void onBindViewHolder(ItemHolder holder, int position) {
final SearchPojo item = searchlist.get(position);
holder.title.setText(item.getTitle());
holder.description.setText(item.getDescription());
Glide.with(activity).load(item.getImageURL()).into(holder.imageView);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
itemListListner.navigateToWebPage(item.getTitle());
}
});
}
@Override
public int getItemCount() {
return searchlist != null ? searchlist.size() : 0;
}
public interface itemListListner {
void navigateToWebPage(String title);
}
public class ItemHolder extends RecyclerView.ViewHolder {
public TextView title, description;
public ImageView imageView;
public ItemHolder(View itemView) {
super(itemView);
title = (TextView) itemView.findViewById(R.id.titletext);
description = (TextView) itemView.findViewById(R.id.description);
imageView = (ImageView) itemView.findViewById(R.id.imageView);
}
}
}
| [
"meghav303@gmail.com"
] | meghav303@gmail.com |
4d43b494df2b0079e0a5ce93474ae17e6f1a78d4 | 8c085f12963e120be684f8a049175f07d0b8c4e5 | /castor/tags/TAG_1_0_1/src/tests/ptf/jdo/rel1toN/State.java | a0fab867d09d03f4dc04990d8f871982e5e8fea1 | [] | no_license | alam93mahboob/castor | 9963d4110126b8f4ef81d82adfe62bab8c5f5bce | 974f853be5680427a195a6b8ae3ce63a65a309b6 | refs/heads/master | 2020-05-17T08:03:26.321249 | 2014-01-01T20:48:45 | 2014-01-01T20:48:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,366 | java | /*
* Copyright 2005 Ralf Joachim
*
* 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 ptf.jdo.rel1toN;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
/**
* @author <a href="mailto:ralf DOT joachim AT syscon-world DOT de">Ralf Joachim</a>
* @version $Revision$ $Date: 2005-06-24 19:41:08 -0600 (Fri, 24 Jun 2005) $
*/
public final class State {
//-------------------------------------------------------------------------
private Integer _id;
private String _name;
private Locked _locked;
private boolean _input = false;
private boolean _output = false;
private boolean _service = false;
private boolean _changeFrom = true;
private boolean _changeTo = true;
private Collection _departments = new ArrayList();
private Collection _equipments = new ArrayList();
private String _note;
private Date _createdAt;
private String _createdBy;
private Date _updatedAt;
private String _updatedBy;
//-------------------------------------------------------------------------
public Integer getId() { return _id; }
public void setId(final Integer id) { _id = id; }
public String getName() { return _name; }
public void setName(final String name) { _name = name; }
public Locked getLocked() { return _locked; }
public void setLocked(final Locked locked) { _locked = locked; }
public boolean getInput() { return _input; }
public void setInput(final boolean input) { _input = input; }
public boolean getOutput() { return _output; }
public void setOutput(final boolean output) { _output = output; }
public boolean getService() { return _service; }
public void setService(final boolean service) { _service = service; }
public boolean getChangeFrom() { return _changeFrom; }
public void setChangeFrom(final boolean changeFrom) { _changeFrom = changeFrom; }
public boolean getChangeTo() { return _changeTo; }
public void setChangeTo(final boolean changeTo) { _changeTo = changeTo; }
public Collection getDepartments() { return _departments; }
public void setDepartments(final Collection departments) {
_departments = departments;
}
public void addDepartment(final Department department) {
if ((department != null) && (!_departments.contains(department))) {
_departments.add(department);
department.setState(this);
}
}
public void removeDepartment(final Department department) {
if ((department != null) && (_departments.contains(department))) {
_departments.remove(department);
department.setState(null);
}
}
public Collection getEquipments() { return _equipments; }
public void setEquipments(final Collection equipments) {
_equipments = equipments;
}
public void addEquipment(final Equipment equipment) {
if ((equipment != null) && (!_equipments.contains(equipment))) {
_equipments.add(equipment);
equipment.setState(this);
}
}
public void removeEquipment(final Equipment equipment) {
if ((equipment != null) && (_equipments.contains(equipment))) {
_equipments.remove(equipment);
equipment.setState(null);
}
}
public String getNote() { return _note; }
public void setNote(final String note) { _note = note; }
public Date getCreatedAt() { return _createdAt; }
public void setCreatedAt(final Date createdAt) { _createdAt = createdAt; }
public String getCreatedBy() { return _createdBy; }
public void setCreatedBy(final String createdBy) { _createdBy = createdBy; }
public void setCreated(final Date createdAt, final String createdBy) {
_createdAt = createdAt;
_createdBy = createdBy;
}
public Date getUpdatedAt() { return _updatedAt; }
public void setUpdatedAt(final Date updatedAt) { _updatedAt = updatedAt; }
public String getUpdatedBy() { return _updatedBy; }
public void setUpdatedBy(final String updatedBy) { _updatedBy = updatedBy; }
public void setUpdated(final Date updatedAt, final String updatedBy) {
_updatedAt = updatedAt;
_updatedBy = updatedBy;
}
//-------------------------------------------------------------------------
public String toString() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
StringBuffer sb = new StringBuffer();
sb.append("<State id='"); sb.append(_id);
sb.append("' name='"); sb.append(_name);
sb.append("' input='"); sb.append(_input);
sb.append("' output='"); sb.append(_output);
sb.append("' service='"); sb.append(_service);
sb.append("' changeFrom='"); sb.append(_changeFrom);
sb.append("' changeTo='"); sb.append(_changeTo);
sb.append("' note='"); sb.append(_note);
sb.append("' createdAt='");
if (_createdAt != null) {
sb.append(df.format(_createdAt));
} else {
sb.append(_createdAt);
}
sb.append("' createdBy='"); sb.append(_createdBy);
sb.append("' updatedAt='");
if (_updatedAt != null) {
sb.append(df.format(_updatedAt));
} else {
sb.append(_updatedAt);
}
sb.append("' updatedBy='"); sb.append(_updatedBy);
sb.append("'>\n");
sb.append(_locked);
sb.append("</State>\n");
return sb.toString();
}
//-------------------------------------------------------------------------
}
| [
"wguttmn@b24b0d9a-6811-0410-802a-946fa971d308"
] | wguttmn@b24b0d9a-6811-0410-802a-946fa971d308 |
dd458b954fbe51f6523e7792557e9003c972749b | d24a9e4c5c75a52a1f7346a8b8f2aeb45c730baa | /src/main/java/org/gaetan/DAO/userDao.java | 88bad85fecdc9ab918277a923f61261f05ab4525 | [] | no_license | ffmc02/APIFilleRouge | f420386a91b1b3d8f1bd916a0da7f0f2abf2ba42 | 9c16c2c33074f3035424451eab44d54e566ff846 | refs/heads/master | 2022-10-17T12:19:00.373431 | 2020-06-08T14:29:07 | 2020-06-08T14:29:07 | 270,699,416 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,771 | java | package org.gaetan.DAO;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class userDao extends connexion {
public userDao() {
}
//methode d'insertion
public void Insertuser(user user) {
//appel a la fonction connexion
this.createConnection();
//requette préparer
PreparedStatement pstm;
try {
pstm = this.con.prepareStatement("INSERT INTO 1402f_user (`pseudo`, `email`, `password`, `cle`)VALUE (?, ? ,?, ?)");
pstm.setString(1, user.getPseudo());
pstm.setString(2, user.getEmail());
pstm.setString(3, user.getPassword());
pstm.setString(4, user.getCle());
pstm.execute();
pstm.close();
} catch (SQLException throwables) {
throwables.printStackTrace();
}
this.closeConnection();
}
//liste Utilisateur
public List<user> List(){
List<user> listUser= new ArrayList();
this.createConnection();
try {
Statement stm= con.createStatement();
ResultSet res =stm.executeQuery("SELECT `id`, `pseudo`, `email` FROM `1402f_user` ");
while(res.next()){
int id =res.getInt("id");
String pseudo =res.getString("pseudo");
String email = res.getString("email");
user n= new user( id, pseudo, email);
}
} catch (SQLException throwables) {
throwables.printStackTrace();
}
this.closeConnection();
return listUser;
}
}
| [
"gaetan.jonard@outlook.fr"
] | gaetan.jonard@outlook.fr |
ceb6bfd505cbfdebaab4d925f75c3759a2732e91 | bab291f97f803f3cc4bc560f87a3dfb392322d96 | /jenetics.ext/src/test/java/org/jenetics/ext/util/NodeTest.java | a0121a22665d55a9b5386cabc0570d00c849da79 | [
"Apache-2.0"
] | permissive | wilsonsf/jenetics | 0192df8491f6e10667481962e36f0cddb8f48feb | 911c4a34554eb41f1ecfa0c6eb26d650822a98b7 | refs/heads/master | 2021-08-11T12:36:26.679785 | 2017-11-13T17:34:03 | 2017-11-13T17:34:03 | 110,006,269 | 0 | 0 | null | 2017-11-08T17:13:07 | 2017-11-08T17:12:59 | Java | UTF-8 | Java | false | false | 2,474 | java | /*
* Java Genetic Algorithm Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
*
* 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.
*
* Author:
* Franz Wilhelmstötter (franz.wilhelmstoetter@gmx.at)
*/
package org.jenetics.ext.util;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.testng.Assert;
import org.testng.annotations.Test;
/**
* @author <a href="mailto:franz.wilhelmstoetter@gmx.at">Franz Wilhelmstötter</a>
*/
public class NodeTest {
@Test
public void treeToString() {
final TreeNode<Integer> tree = TreeNode.of(0)
.attach(TreeNode.of(1)
.attach(4, 5))
.attach(TreeNode.of(2)
.attach(6))
.attach(TreeNode.of(3)
.attach(TreeNode.of(7)
.attach(10, 11))
.attach(8)
.attach(9));
System.out.println(tree);
//final FlatTreeNode<Integer> flat = FlatTreeNode.of(tree);
//System.out.println(flat);
//System.out.println(Tree.toString(flat));
System.out.println(Trees.toCompactString(tree));
System.out.println(Trees.toDottyString("number_tree", tree));
System.out.println(tree.depth());
}
@Test
public void serialize() throws Exception {
final TreeNode<Integer> tree = TreeNode.of(0)
.attach(TreeNode.of(1)
.attach(4, 5))
.attach(TreeNode.of(2)
.attach(6))
.attach(TreeNode.of(3)
.attach(TreeNode.of(7)
.attach(10, 11))
.attach(TreeNode.of(8))
.attach(TreeNode.of(9)));
final ByteArrayOutputStream out = new ByteArrayOutputStream();
try (ObjectOutputStream oout = new ObjectOutputStream(out)) {
oout.writeObject(tree);
}
final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
try (ObjectInputStream oin = new ObjectInputStream(in)) {
@SuppressWarnings("unchecked")
final TreeNode<Integer> object = (TreeNode<Integer>)oin.readObject();
Assert.assertEquals(object, tree);
}
}
}
| [
"franz.wilhelmstoetter@gmail.com"
] | franz.wilhelmstoetter@gmail.com |
dbaec45084e3259116d709954343a5290b77dfbd | 7246895c0b8f9e4065b33b1db2833969a31315a2 | /tensquare_user/src/main/java/com/tensquare/user/pojo/User.java | 27367bc47a1463e28fb12bee647fc937fb32517b | [] | no_license | lastLi/tensquare_parent | 84b592e48cbf74e43d40d40a4805d3e0c9e0c536 | 228b4ff859344d4431b54c6262cdcc7065b56c85 | refs/heads/master | 2020-04-23T02:19:35.482669 | 2019-02-21T17:04:51 | 2019-02-21T17:04:51 | 170,842,737 | 0 | 1 | null | 2019-02-21T17:04:52 | 2019-02-15T09:59:58 | Java | UTF-8 | Java | false | false | 1,435 | java | package com.tensquare.user.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
/**
* 实体类
*
* @author Administrator
*/
@Data
@Entity
@Table(name = "tb_user")
@NoArgsConstructor
@AllArgsConstructor
public class User implements Serializable {
@Id
private String id;//ID
/**
* 手机号码
*/
private String mobile;
/**
* 密码
*/
private String password;
/**
* 昵称
*/
private String nickname;
/**
* 性别
*/
private String sex;
/**
* 出生年月日
*/
private java.util.Date birthday;
/**
* 头像
*/
private String avatar;
/**
* 邮箱
*/
private String email;
/**
* 注册日期
*/
private java.util.Date regdate;
/**
* 修改日期
*/
private java.util.Date updatedate;
/**
* 最好登录日期
*/
private java.util.Date lastdate;
/**
* 在线时长(分钟)
*/
private Long online;
/**
* 兴趣
*/
private String interest;
/**
* 个性签名
*/
private String personality;
/**
* 粉丝数
*/
private Integer fanscount;
/**
* 关注数
*/
private Integer followcount;
}
| [
"493734068@qq.com"
] | 493734068@qq.com |
844fd0643e2c24bc6ff98aa149c93f4643c7f868 | de101b04abfbd850e502756622c8e77fb1fcea97 | /StudentProjects/2015/Individual/M3113116_Ramadhani_Bella_Husada/Praktikum_2/src/androidTest/java/com/example/bella/praktikum_2/ApplicationTest.java | 784560487d5697e9fa72bcd194c9d492a9765d03 | [] | no_license | ivankusuma07/UNS_D3TI_ANDROID_CLASS | be5babf16db533ac3af0b7286d36ed5ecd218809 | 297392ed03d7e5675104970a9035273eb0a0589c | refs/heads/master | 2022-11-18T20:44:21.259809 | 2016-01-05T03:01:09 | 2016-01-05T03:01:09 | 41,787,680 | 0 | 0 | null | 2015-09-02T07:51:35 | 2015-09-02T07:51:35 | null | UTF-8 | Java | false | false | 360 | java | package com.example.bella.praktikum_2;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"bella.husada@gmail.com"
] | bella.husada@gmail.com |
924ddbfe47f0193e4d224838fbf9c292feb3b299 | 32de5995339f5824771fc34ede15b5079985a44a | /src/main/java/com/bugpass/service/DiscussService.java | 5919afc665c74a13d7519984774a0f1fe1affb9a | [
"MIT"
] | permissive | pj-ye/BugPass | 398bb4e0dd624b85958d681e3de613f1d14c9ea3 | f6562ada1adc6ac48306e8d7fdc2f7c2573f1c16 | refs/heads/master | 2023-03-19T18:55:55.551200 | 2018-07-13T08:06:24 | 2018-07-13T08:06:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package com.bugpass.service;
import java.util.List;
import com.bugpass.entity.Discuss;
/**
* 讨论相关业务接口
* @author QiuWenYi
* @date 2018年7月4日 下午12:38:47
*/
public interface DiscussService {
/**
* 新增评论
* @param discuss
* @return 若成功返回true
*/
boolean addDiscuss(Discuss discuss);
/**
* 根据问题ID查找相应问题的评论
*
* @param problemId 问题ID
* @return 查找到的list
*/
List<Discuss> findByProblemId(long problemId);
/**
* 根据discussId删除
*
* @param discussId 讨论的id
* @return 是否成功删除
*/
boolean delDiscussById(long discussId);
/**
* 查询所有讨论
*
* @param discussId 讨论的id
* @return 是否成功删除
*/
List<Discuss> findAllDisscuss();
}
| [
"cutecuteman@outlook.com"
] | cutecuteman@outlook.com |
fde52b44242112b6e5c086bf4178350a2d6fe6f1 | 707febcf0a91d9609d20cbbb50fb2cbe171f3cc0 | /src/main/java/ua/edu/sumdu/j2se/Resendiz/CarRentalSystem/domain/Reservation.java | 411da7af277bfdd702ee76aff62ebec7c7fa5b1e | [] | no_license | rresendizlazaro/CarRentalSystem | d2448b1461c1fda0b22371c3e99c778f6c6165b4 | ed8b526eeef9c9b26a7ca07066e78bafbf233e92 | refs/heads/master | 2023-04-22T01:21:09.042480 | 2021-05-12T03:27:30 | 2021-05-12T03:27:30 | 360,348,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 661 | java | package ua.edu.sumdu.j2se.Resendiz.CarRentalSystem.domain;
import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import lombok.Data;
@Data
@Entity
@Table(name = "reservation")
public class Reservation implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long idReservation;
@NotNull
private int idUser;
@NotNull
private int idCar;
@NotNull
private int number;
@NotNull
private String start_time;
@NotNull
private String end_time;
private int total;
}
| [
"rresendizlazaro@hotmail.com"
] | rresendizlazaro@hotmail.com |
6b520c2d859af040613b9f984cb15e13ac922cc8 | 49665d55373cff6fc7235ceadaaffa9374be1f63 | /src/main/java/com/luv2code/springdemoannotations/SwimCoach.java | af6fcfe0bdec5bd3e6c5999a8f85abb955aae4ab | [] | no_license | HrechanayaIV/UdemyPracticeSpring | a24abf97912ca377e454fff3e850e43a04a01fab | bbbfabb579f3564251749d2d1ff94919979552ed | refs/heads/master | 2021-09-02T09:37:46.606772 | 2018-01-01T14:19:54 | 2018-01-01T14:19:54 | 115,347,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 827 | java | package com.luv2code.springdemoannotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class SwimCoach implements Coach {
@Autowired
@Qualifier("sadFortuneService")
private FortuneService fortuneService;
@Value("${foo.email}")
private String email;
@Value("${foo.team}")
private String team;
public String getDailyWorkout() {
return "Practice your swimming";
}
public String getDailyFortune() {
return fortuneService.getFortune();
}
public String getEmail() {
return email;
}
public String getTeam() {
return team;
}
}
| [
"grechanayaiv777@gmail.com"
] | grechanayaiv777@gmail.com |
84e0d6cdf625464f6389c04d3e272ea0278b106a | 6c87c8fbad2af5d46c4a0c26b6e2316c17abfb99 | /TareaChat/app/src/main/java/com/example/estilos/tareachat/MainActivity.java | 0ad68d2396ce4449226da415c95558e323316701 | [] | no_license | harudes/Desarrollo-Basado-En-Plataformas | 63a00d5b08be36c4a1735c98d3a07664ef753b17 | d64142cb47dc011cb1acf359689273065d856a21 | refs/heads/master | 2021-01-20T01:12:10.702417 | 2017-07-13T13:58:51 | 2017-07-13T13:58:51 | 89,237,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,505 | java | package com.example.estilos.tareachat;
import android.animation.Animator;
import android.content.Intent;
import android.database.Cursor;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DBHelper db = new DBHelper(this);
List<ContactItems> contactos = new ArrayList<>();
final FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setScaleX(0);
fab.setScaleY(0);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
final Interpolator interpolador = AnimationUtils.loadInterpolator(getBaseContext(),
android.R.interpolator.bounce);
fab.animate()
.scaleX(1)
.scaleY(1)
.setInterpolator(interpolador)
.setDuration(600)
.setStartDelay(1000);
}
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(MainActivity.this,AddContact.class);
startActivity(i);
}
});
Cursor c = db.getTodosContactos();
//db.insertarContacto("Stefanie","Muroya","prueba@gmail.com");
while (c.moveToNext()){
String nombre = c.getString(c.getColumnIndex("nombre"));
String apellido = c.getString(c.getColumnIndex("apellido"));
String fullname = nombre +" "+apellido;
contactos.add(new ContactItems(Integer.parseInt(c.getString(c.getColumnIndex("id"))),fullname));
}
/*contactos.add(new ItemsContactos(0,"Stefanie Muroya"));
contactos.add(new ItemsContactos(1,"Paulo Rodriguez"));
contactos.add(new ItemsContactos(2,"Diego Melendez"));
contactos.add(new ItemsContactos(3,"Janet Rodriguez"));*/
}
}
| [
"Luis Rendon Zuniga"
] | Luis Rendon Zuniga |
0310e6f4fb0bc0e6c523e8bdca889c29ffd1aa0b | 015dcfdf9b560ed76cc0f33e5d95cafc27224f68 | /Carssier/Carssier_Staffs/src/ru/sibek/plugin/staff/worktime/StaffWorktimeUUIPlugin.java | 630e0b0ab73314437e149dfb0f9e6c4474843dd2 | [] | no_license | ermachkov/ERP | 4b070bb78ebb3f733a895fbe2bacbcbf5c31532e | 8017c20ea230e29031e3dd24ef58cb33ac987766 | refs/heads/master | 2020-06-07T12:32:31.019153 | 2012-10-12T10:02:17 | 2012-10-12T10:02:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,440 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ru.sibek.plugin.staff.worktime;
import java.util.ArrayList;
import java.util.List;
import org.uui.component.RightPanel;
import org.uui.component.WorkPanel;
import org.uui.plugin.Plugin;
import org.uui.plugin.RightPanelPlugin;
import org.uui.plugin.WorkPanelPlugin;
/**
*
* @author Pechenko Anton aka parilo, forpost78 aaaaaat gmail doooooot com (C)
* Copyright by Pechenko Anton, created 16.12.2010
*/
public class StaffWorktimeUUIPlugin implements Plugin, WorkPanelPlugin, RightPanelPlugin {
private String session;
@Override
public void setSession(String session) {
this.session = session;
}
private ArrayList<RightPanel> panels;
private StaffWorkTimePanel staffWorkTimePanel;
public StaffWorktimeUUIPlugin() {
}
@Override
public boolean isSingle() {
return true;
}
@Override
public String getWorkPanelName() {
return "Рабочее время";
}
@Override
public String getSelectorGroupName() {
return "Персонал";
}
@Override
public String getSelectorGroupImagePath() {
return "icons/selector_worktime.png";
}
@Override
public String getWorkPanelClassName() {
return StaffWorkTimePanel.class.getName();
}
@Override
public WorkPanel getWorkPanel() {
if (staffWorkTimePanel == null) {
staffWorkTimePanel = new StaffWorkTimePanel(session);
}
return staffWorkTimePanel;
}
@Override
public int getSelectorGroupPosition() {
return 300;
}
@Override
public int getSelectorLabelPosition() {
return 300;
}
@Override
public List getRightPanels() {
if (panels == null) {
panels = new ArrayList<>();
panels.add(new StaffWorktimeRightPanel(session));
}
return panels;
}
public String getRightPanelWorkPanelClassName() {
return StaffWorkTimePanel.class.getName();
}
@Override
public String getGroupDescription() {
return "";
}
@Override
public String getPluginName() {
return "Рабочее время";
}
@Override
public String getPluginDescription() {
return "Оформление прихода на работу работников.";
}
}
| [
"root@fc17x64-usb.beefymiracle"
] | root@fc17x64-usb.beefymiracle |
2a65c590a25fdeff4d484b3aecb066870ada5a37 | ef38d70d9b0c20da068d967e089046e626b60dea | /hibernate-orm/HibBugResults/49/Satd-Fix-Diff.java | 14bf25df44a3df6b4761f8973a41e7927241e521 | [] | no_license | martapanc/SATD-replication-package | 0ea0e8a27582750d39f8742b3b9b2e81bb7ec25d | e3235d25235b3b46416239ee9764bfeccd2d7433 | refs/heads/master | 2021-07-18T14:28:24.543613 | 2020-07-10T09:04:40 | 2020-07-10T09:04:40 | 94,113,844 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 42,909 | java | diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
index 8196261aaa..0d9ed53e2d 100644
--- a/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
+++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/SingleTableEntityPersister.java
@@ -1,1105 +1,823 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
* indicated by the @author tags or express copyright attribution
* statements applied by the authors. All third-party contributions are
* distributed under license by Red Hat Middleware LLC.
*
* This copyrighted material is made available to anyone wishing to use, modify,
* copy, or redistribute it subject to the terms and conditions of the GNU
* Lesser General Public License, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
* for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this distribution; if not, write to:
* Free Software Foundation, Inc.
* 51 Franklin Street, Fifth Floor
* Boston, MA 02110-1301 USA
*
*/
package org.hibernate.persister.entity;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.hibernate.HibernateException;
import org.hibernate.MappingException;
import org.hibernate.cache.spi.access.EntityRegionAccessStrategy;
import org.hibernate.cache.spi.access.NaturalIdRegionAccessStrategy;
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
import org.hibernate.engine.spi.Mapping;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.internal.DynamicFilterAliasGenerator;
import org.hibernate.internal.FilterAliasGenerator;
import org.hibernate.internal.util.MarkerObject;
import org.hibernate.internal.util.collections.ArrayHelper;
import org.hibernate.mapping.Column;
import org.hibernate.mapping.Formula;
import org.hibernate.mapping.Join;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
import org.hibernate.mapping.Selectable;
import org.hibernate.mapping.Subclass;
import org.hibernate.mapping.Table;
import org.hibernate.mapping.Value;
-import org.hibernate.metamodel.binding.AttributeBinding;
-import org.hibernate.metamodel.binding.CustomSQL;
-import org.hibernate.metamodel.binding.EntityBinding;
-import org.hibernate.metamodel.binding.SimpleValueBinding;
-import org.hibernate.metamodel.binding.SingularAttributeBinding;
-import org.hibernate.metamodel.relational.DerivedValue;
-import org.hibernate.metamodel.relational.SimpleValue;
-import org.hibernate.metamodel.relational.TableSpecification;
import org.hibernate.sql.InFragment;
import org.hibernate.sql.Insert;
import org.hibernate.sql.SelectFragment;
import org.hibernate.type.AssociationType;
import org.hibernate.type.DiscriminatorType;
import org.hibernate.type.Type;
/**
* The default implementation of the <tt>EntityPersister</tt> interface.
* Implements the "table-per-class-hierarchy" or "roll-up" mapping strategy
* for an entity class and its inheritence hierarchy. This is implemented
* as a single table holding all classes in the hierarchy with a discrimator
* column used to determine which concrete class is referenced.
*
* @author Gavin King
*/
public class SingleTableEntityPersister extends AbstractEntityPersister {
// the class hierarchy structure
private final int joinSpan;
private final String[] qualifiedTableNames;
private final boolean[] isInverseTable;
private final boolean[] isNullableTable;
private final String[][] keyColumnNames;
private final boolean[] cascadeDeleteEnabled;
private final boolean hasSequentialSelects;
private final String[] spaces;
private final String[] subclassClosure;
private final String[] subclassTableNameClosure;
private final boolean[] subclassTableIsLazyClosure;
private final boolean[] isInverseSubclassTable;
private final boolean[] isNullableSubclassTable;
private final boolean[] subclassTableSequentialSelect;
private final String[][] subclassTableKeyColumnClosure;
private final boolean[] isClassOrSuperclassTable;
// properties of this class, including inherited properties
private final int[] propertyTableNumbers;
// the closure of all columns used by the entire hierarchy including
// subclasses and superclasses of this class
private final int[] subclassPropertyTableNumberClosure;
private final int[] subclassColumnTableNumberClosure;
private final int[] subclassFormulaTableNumberClosure;
// discriminator column
private final Map subclassesByDiscriminatorValue = new HashMap();
private final boolean forceDiscriminator;
private final String discriminatorColumnName;
private final String discriminatorColumnReaders;
private final String discriminatorColumnReaderTemplate;
private final String discriminatorFormula;
private final String discriminatorFormulaTemplate;
private final String discriminatorAlias;
private final Type discriminatorType;
private final Object discriminatorValue;
private final String discriminatorSQLValue;
private final boolean discriminatorInsertable;
private final String[] constraintOrderedTableNames;
private final String[][] constraintOrderedKeyColumnNames;
//private final Map propertyTableNumbersByName = new HashMap();
private final Map propertyTableNumbersByNameAndSubclass = new HashMap();
private final Map sequentialSelectStringsByEntityName = new HashMap();
private static final Object NULL_DISCRIMINATOR = new MarkerObject("<null discriminator>");
private static final Object NOT_NULL_DISCRIMINATOR = new MarkerObject("<not null discriminator>");
private static final String NULL_STRING = "null";
private static final String NOT_NULL_STRING = "not null";
//INITIALIZATION:
public SingleTableEntityPersister(
final PersistentClass persistentClass,
final EntityRegionAccessStrategy cacheAccessStrategy,
final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
final SessionFactoryImplementor factory,
final Mapping mapping) throws HibernateException {
super( persistentClass, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
// CLASS + TABLE
joinSpan = persistentClass.getJoinClosureSpan()+1;
qualifiedTableNames = new String[joinSpan];
isInverseTable = new boolean[joinSpan];
isNullableTable = new boolean[joinSpan];
keyColumnNames = new String[joinSpan][];
final Table table = persistentClass.getRootTable();
qualifiedTableNames[0] = table.getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
isInverseTable[0] = false;
isNullableTable[0] = false;
keyColumnNames[0] = getIdentifierColumnNames();
cascadeDeleteEnabled = new boolean[joinSpan];
// Custom sql
customSQLInsert = new String[joinSpan];
customSQLUpdate = new String[joinSpan];
customSQLDelete = new String[joinSpan];
insertCallable = new boolean[joinSpan];
updateCallable = new boolean[joinSpan];
deleteCallable = new boolean[joinSpan];
insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
customSQLInsert[0] = persistentClass.getCustomSQLInsert();
insertCallable[0] = customSQLInsert[0] != null && persistentClass.isCustomInsertCallable();
insertResultCheckStyles[0] = persistentClass.getCustomSQLInsertCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[0], insertCallable[0] )
: persistentClass.getCustomSQLInsertCheckStyle();
customSQLUpdate[0] = persistentClass.getCustomSQLUpdate();
updateCallable[0] = customSQLUpdate[0] != null && persistentClass.isCustomUpdateCallable();
updateResultCheckStyles[0] = persistentClass.getCustomSQLUpdateCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[0], updateCallable[0] )
: persistentClass.getCustomSQLUpdateCheckStyle();
customSQLDelete[0] = persistentClass.getCustomSQLDelete();
deleteCallable[0] = customSQLDelete[0] != null && persistentClass.isCustomDeleteCallable();
deleteResultCheckStyles[0] = persistentClass.getCustomSQLDeleteCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[0], deleteCallable[0] )
: persistentClass.getCustomSQLDeleteCheckStyle();
// JOINS
Iterator joinIter = persistentClass.getJoinClosureIterator();
int j = 1;
while ( joinIter.hasNext() ) {
Join join = (Join) joinIter.next();
qualifiedTableNames[j] = join.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
);
isInverseTable[j] = join.isInverse();
isNullableTable[j] = join.isOptional();
cascadeDeleteEnabled[j] = join.getKey().isCascadeDeleteEnabled() &&
factory.getDialect().supportsCascadeDelete();
customSQLInsert[j] = join.getCustomSQLInsert();
insertCallable[j] = customSQLInsert[j] != null && join.isCustomInsertCallable();
insertResultCheckStyles[j] = join.getCustomSQLInsertCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLInsert[j], insertCallable[j] )
: join.getCustomSQLInsertCheckStyle();
customSQLUpdate[j] = join.getCustomSQLUpdate();
updateCallable[j] = customSQLUpdate[j] != null && join.isCustomUpdateCallable();
updateResultCheckStyles[j] = join.getCustomSQLUpdateCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLUpdate[j], updateCallable[j] )
: join.getCustomSQLUpdateCheckStyle();
customSQLDelete[j] = join.getCustomSQLDelete();
deleteCallable[j] = customSQLDelete[j] != null && join.isCustomDeleteCallable();
deleteResultCheckStyles[j] = join.getCustomSQLDeleteCheckStyle() == null
? ExecuteUpdateResultCheckStyle.determineDefault( customSQLDelete[j], deleteCallable[j] )
: join.getCustomSQLDeleteCheckStyle();
Iterator iter = join.getKey().getColumnIterator();
keyColumnNames[j] = new String[ join.getKey().getColumnSpan() ];
int i = 0;
while ( iter.hasNext() ) {
Column col = (Column) iter.next();
keyColumnNames[j][i++] = col.getQuotedName( factory.getDialect() );
}
j++;
}
constraintOrderedTableNames = new String[qualifiedTableNames.length];
constraintOrderedKeyColumnNames = new String[qualifiedTableNames.length][];
for ( int i = qualifiedTableNames.length - 1, position = 0; i >= 0; i--, position++ ) {
constraintOrderedTableNames[position] = qualifiedTableNames[i];
constraintOrderedKeyColumnNames[position] = keyColumnNames[i];
}
spaces = ArrayHelper.join(
qualifiedTableNames,
ArrayHelper.toStringArray( persistentClass.getSynchronizedTables() )
);
final boolean lazyAvailable = isInstrumented();
boolean hasDeferred = false;
ArrayList subclassTables = new ArrayList();
ArrayList joinKeyColumns = new ArrayList();
ArrayList<Boolean> isConcretes = new ArrayList<Boolean>();
ArrayList<Boolean> isDeferreds = new ArrayList<Boolean>();
ArrayList<Boolean> isInverses = new ArrayList<Boolean>();
ArrayList<Boolean> isNullables = new ArrayList<Boolean>();
ArrayList<Boolean> isLazies = new ArrayList<Boolean>();
subclassTables.add( qualifiedTableNames[0] );
joinKeyColumns.add( getIdentifierColumnNames() );
isConcretes.add(Boolean.TRUE);
isDeferreds.add(Boolean.FALSE);
isInverses.add(Boolean.FALSE);
isNullables.add(Boolean.FALSE);
isLazies.add(Boolean.FALSE);
joinIter = persistentClass.getSubclassJoinClosureIterator();
while ( joinIter.hasNext() ) {
Join join = (Join) joinIter.next();
isConcretes.add( persistentClass.isClassOrSuperclassJoin(join) );
isDeferreds.add( join.isSequentialSelect() );
isInverses.add( join.isInverse() );
isNullables.add( join.isOptional() );
isLazies.add( lazyAvailable && join.isLazy() );
if ( join.isSequentialSelect() && !persistentClass.isClassOrSuperclassJoin(join) ) hasDeferred = true;
subclassTables.add( join.getTable().getQualifiedName(
factory.getDialect(),
factory.getSettings().getDefaultCatalogName(),
factory.getSettings().getDefaultSchemaName()
) );
Iterator iter = join.getKey().getColumnIterator();
String[] keyCols = new String[ join.getKey().getColumnSpan() ];
int i = 0;
while ( iter.hasNext() ) {
Column col = (Column) iter.next();
keyCols[i++] = col.getQuotedName( factory.getDialect() );
}
joinKeyColumns.add(keyCols);
}
subclassTableSequentialSelect = ArrayHelper.toBooleanArray(isDeferreds);
subclassTableNameClosure = ArrayHelper.toStringArray(subclassTables);
subclassTableIsLazyClosure = ArrayHelper.toBooleanArray(isLazies);
subclassTableKeyColumnClosure = ArrayHelper.to2DStringArray( joinKeyColumns );
isClassOrSuperclassTable = ArrayHelper.toBooleanArray(isConcretes);
isInverseSubclassTable = ArrayHelper.toBooleanArray(isInverses);
isNullableSubclassTable = ArrayHelper.toBooleanArray(isNullables);
hasSequentialSelects = hasDeferred;
// DISCRIMINATOR
if ( persistentClass.isPolymorphic() ) {
Value discrimValue = persistentClass.getDiscriminator();
if (discrimValue==null) {
throw new MappingException("discriminator mapping required for single table polymorphic persistence");
}
forceDiscriminator = persistentClass.isForceDiscriminator();
Selectable selectable = (Selectable) discrimValue.getColumnIterator().next();
if ( discrimValue.hasFormula() ) {
Formula formula = (Formula) selectable;
discriminatorFormula = formula.getFormula();
discriminatorFormulaTemplate = formula.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
discriminatorColumnName = null;
discriminatorColumnReaders = null;
discriminatorColumnReaderTemplate = null;
discriminatorAlias = "clazz_";
}
else {
Column column = (Column) selectable;
discriminatorColumnName = column.getQuotedName( factory.getDialect() );
discriminatorColumnReaders = column.getReadExpr( factory.getDialect() );
discriminatorColumnReaderTemplate = column.getTemplate( factory.getDialect(), factory.getSqlFunctionRegistry() );
discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
discriminatorFormula = null;
discriminatorFormulaTemplate = null;
}
discriminatorType = persistentClass.getDiscriminator().getType();
if ( persistentClass.isDiscriminatorValueNull() ) {
discriminatorValue = NULL_DISCRIMINATOR;
discriminatorSQLValue = InFragment.NULL;
discriminatorInsertable = false;
}
else if ( persistentClass.isDiscriminatorValueNotNull() ) {
discriminatorValue = NOT_NULL_DISCRIMINATOR;
discriminatorSQLValue = InFragment.NOT_NULL;
discriminatorInsertable = false;
}
else {
discriminatorInsertable = persistentClass.isDiscriminatorInsertable() && !discrimValue.hasFormula();
try {
DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
discriminatorValue = dtype.stringToObject( persistentClass.getDiscriminatorValue() );
discriminatorSQLValue = dtype.objectToSQLString( discriminatorValue, factory.getDialect() );
}
catch (ClassCastException cce) {
throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
}
catch (Exception e) {
throw new MappingException("Could not format discriminator value to SQL string", e);
}
}
}
else {
forceDiscriminator = false;
discriminatorInsertable = false;
discriminatorColumnName = null;
discriminatorColumnReaders = null;
discriminatorColumnReaderTemplate = null;
discriminatorAlias = null;
discriminatorType = null;
discriminatorValue = null;
discriminatorSQLValue = null;
discriminatorFormula = null;
discriminatorFormulaTemplate = null;
}
// PROPERTIES
propertyTableNumbers = new int[ getPropertySpan() ];
Iterator iter = persistentClass.getPropertyClosureIterator();
int i=0;
while( iter.hasNext() ) {
Property prop = (Property) iter.next();
propertyTableNumbers[i++] = persistentClass.getJoinNumber(prop);
}
//TODO: code duplication with JoinedSubclassEntityPersister
ArrayList columnJoinNumbers = new ArrayList();
ArrayList formulaJoinedNumbers = new ArrayList();
ArrayList propertyJoinNumbers = new ArrayList();
iter = persistentClass.getSubclassPropertyClosureIterator();
while ( iter.hasNext() ) {
Property prop = (Property) iter.next();
Integer join = persistentClass.getJoinNumber(prop);
propertyJoinNumbers.add(join);
//propertyTableNumbersByName.put( prop.getName(), join );
propertyTableNumbersByNameAndSubclass.put(
prop.getPersistentClass().getEntityName() + '.' + prop.getName(),
join
);
Iterator citer = prop.getColumnIterator();
while ( citer.hasNext() ) {
Selectable thing = (Selectable) citer.next();
if ( thing.isFormula() ) {
formulaJoinedNumbers.add(join);
}
else {
columnJoinNumbers.add(join);
}
}
}
subclassColumnTableNumberClosure = ArrayHelper.toIntArray(columnJoinNumbers);
subclassFormulaTableNumberClosure = ArrayHelper.toIntArray(formulaJoinedNumbers);
subclassPropertyTableNumberClosure = ArrayHelper.toIntArray(propertyJoinNumbers);
int subclassSpan = persistentClass.getSubclassSpan() + 1;
subclassClosure = new String[subclassSpan];
subclassClosure[0] = getEntityName();
if ( persistentClass.isPolymorphic() ) {
addSubclassByDiscriminatorValue( discriminatorValue, getEntityName() );
}
// SUBCLASSES
if ( persistentClass.isPolymorphic() ) {
iter = persistentClass.getSubclassIterator();
int k=1;
while ( iter.hasNext() ) {
Subclass sc = (Subclass) iter.next();
subclassClosure[k++] = sc.getEntityName();
if ( sc.isDiscriminatorValueNull() ) {
addSubclassByDiscriminatorValue( NULL_DISCRIMINATOR, sc.getEntityName() );
}
else if ( sc.isDiscriminatorValueNotNull() ) {
addSubclassByDiscriminatorValue( NOT_NULL_DISCRIMINATOR, sc.getEntityName() );
}
else {
try {
DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
addSubclassByDiscriminatorValue(
dtype.stringToObject( sc.getDiscriminatorValue() ),
sc.getEntityName()
);
}
catch (ClassCastException cce) {
throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
}
catch (Exception e) {
throw new MappingException("Error parsing discriminator value", e);
}
}
}
}
initLockers();
initSubclassPropertyAliasesMap(persistentClass);
postConstruct(mapping);
}
private void addSubclassByDiscriminatorValue(Object discriminatorValue, String entityName) {
String mappedEntityName = (String) subclassesByDiscriminatorValue.put( discriminatorValue, entityName );
if ( mappedEntityName != null ) {
throw new MappingException(
"Entities [" + entityName + "] and [" + mappedEntityName
+ "] are mapped with the same discriminator value '" + discriminatorValue + "'."
);
}
}
- public SingleTableEntityPersister(
- final EntityBinding entityBinding,
- final EntityRegionAccessStrategy cacheAccessStrategy,
- final NaturalIdRegionAccessStrategy naturalIdRegionAccessStrategy,
- final SessionFactoryImplementor factory,
- final Mapping mapping) throws HibernateException {
-
- super( entityBinding, cacheAccessStrategy, naturalIdRegionAccessStrategy, factory );
-
- // CLASS + TABLE
-
- // TODO: fix when joins are working (HHH-6391)
- //joinSpan = entityBinding.getJoinClosureSpan() + 1;
- joinSpan = 1;
- qualifiedTableNames = new String[joinSpan];
- isInverseTable = new boolean[joinSpan];
- isNullableTable = new boolean[joinSpan];
- keyColumnNames = new String[joinSpan][];
-
- final TableSpecification table = entityBinding.getPrimaryTable();
- qualifiedTableNames[0] = table.getQualifiedName( factory.getDialect() );
- isInverseTable[0] = false;
- isNullableTable[0] = false;
- keyColumnNames[0] = getIdentifierColumnNames();
- cascadeDeleteEnabled = new boolean[joinSpan];
-
- // Custom sql
- customSQLInsert = new String[joinSpan];
- customSQLUpdate = new String[joinSpan];
- customSQLDelete = new String[joinSpan];
- insertCallable = new boolean[joinSpan];
- updateCallable = new boolean[joinSpan];
- deleteCallable = new boolean[joinSpan];
- insertResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
- updateResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
- deleteResultCheckStyles = new ExecuteUpdateResultCheckStyle[joinSpan];
-
- initializeCustomSql( entityBinding.getCustomInsert(), 0, customSQLInsert, insertCallable, insertResultCheckStyles );
- initializeCustomSql( entityBinding.getCustomUpdate(), 0, customSQLUpdate, updateCallable, updateResultCheckStyles );
- initializeCustomSql( entityBinding.getCustomDelete(), 0, customSQLDelete, deleteCallable, deleteResultCheckStyles );
-
- // JOINS
-
- // TODO: add join stuff when HHH-6391 is working
-
- constraintOrderedTableNames = new String[qualifiedTableNames.length];
- constraintOrderedKeyColumnNames = new String[qualifiedTableNames.length][];
- for ( int i = qualifiedTableNames.length - 1, position = 0; i >= 0; i--, position++ ) {
- constraintOrderedTableNames[position] = qualifiedTableNames[i];
- constraintOrderedKeyColumnNames[position] = keyColumnNames[i];
- }
-
- spaces = ArrayHelper.join(
- qualifiedTableNames,
- ArrayHelper.toStringArray( entityBinding.getSynchronizedTableNames() )
- );
-
- final boolean lazyAvailable = isInstrumented();
-
- boolean hasDeferred = false;
- ArrayList subclassTables = new ArrayList();
- ArrayList joinKeyColumns = new ArrayList();
- ArrayList<Boolean> isConcretes = new ArrayList<Boolean>();
- ArrayList<Boolean> isDeferreds = new ArrayList<Boolean>();
- ArrayList<Boolean> isInverses = new ArrayList<Boolean>();
- ArrayList<Boolean> isNullables = new ArrayList<Boolean>();
- ArrayList<Boolean> isLazies = new ArrayList<Boolean>();
- subclassTables.add( qualifiedTableNames[0] );
- joinKeyColumns.add( getIdentifierColumnNames() );
- isConcretes.add(Boolean.TRUE);
- isDeferreds.add(Boolean.FALSE);
- isInverses.add(Boolean.FALSE);
- isNullables.add(Boolean.FALSE);
- isLazies.add(Boolean.FALSE);
-
- // TODO: add join stuff when HHH-6391 is working
-
-
- subclassTableSequentialSelect = ArrayHelper.toBooleanArray(isDeferreds);
- subclassTableNameClosure = ArrayHelper.toStringArray(subclassTables);
- subclassTableIsLazyClosure = ArrayHelper.toBooleanArray(isLazies);
- subclassTableKeyColumnClosure = ArrayHelper.to2DStringArray( joinKeyColumns );
- isClassOrSuperclassTable = ArrayHelper.toBooleanArray(isConcretes);
- isInverseSubclassTable = ArrayHelper.toBooleanArray(isInverses);
- isNullableSubclassTable = ArrayHelper.toBooleanArray(isNullables);
- hasSequentialSelects = hasDeferred;
-
- // DISCRIMINATOR
-
- if ( entityBinding.isPolymorphic() ) {
- SimpleValue discriminatorRelationalValue = entityBinding.getHierarchyDetails().getEntityDiscriminator().getBoundValue();
- if ( discriminatorRelationalValue == null ) {
- throw new MappingException("discriminator mapping required for single table polymorphic persistence");
- }
- forceDiscriminator = entityBinding.getHierarchyDetails().getEntityDiscriminator().isForced();
- if ( DerivedValue.class.isInstance( discriminatorRelationalValue ) ) {
- DerivedValue formula = ( DerivedValue ) discriminatorRelationalValue;
- discriminatorFormula = formula.getExpression();
- discriminatorFormulaTemplate = getTemplateFromString( formula.getExpression(), factory );
- discriminatorColumnName = null;
- discriminatorColumnReaders = null;
- discriminatorColumnReaderTemplate = null;
- discriminatorAlias = "clazz_";
- }
- else {
- org.hibernate.metamodel.relational.Column column = ( org.hibernate.metamodel.relational.Column ) discriminatorRelationalValue;
- discriminatorColumnName = column.getColumnName().encloseInQuotesIfQuoted( factory.getDialect() );
- discriminatorColumnReaders =
- column.getReadFragment() == null ?
- column.getColumnName().encloseInQuotesIfQuoted( factory.getDialect() ) :
- column.getReadFragment();
- discriminatorColumnReaderTemplate = getTemplateFromColumn( column, factory );
- discriminatorAlias = column.getAlias( factory.getDialect() );
- discriminatorFormula = null;
- discriminatorFormulaTemplate = null;
- }
-
- discriminatorType = entityBinding.getHierarchyDetails()
- .getEntityDiscriminator()
- .getExplicitHibernateTypeDescriptor()
- .getResolvedTypeMapping();
- if ( entityBinding.getDiscriminatorMatchValue() == null ) {
- discriminatorValue = NULL_DISCRIMINATOR;
- discriminatorSQLValue = InFragment.NULL;
- discriminatorInsertable = false;
- }
- else if ( entityBinding.getDiscriminatorMatchValue().equals( NULL_STRING ) ) {
- discriminatorValue = NOT_NULL_DISCRIMINATOR;
- discriminatorSQLValue = InFragment.NOT_NULL;
- discriminatorInsertable = false;
- }
- else if ( entityBinding.getDiscriminatorMatchValue().equals( NOT_NULL_STRING ) ) {
- discriminatorValue = NOT_NULL_DISCRIMINATOR;
- discriminatorSQLValue = InFragment.NOT_NULL;
- discriminatorInsertable = false;
- }
- else {
- discriminatorInsertable = entityBinding.getHierarchyDetails().getEntityDiscriminator().isInserted()
- && ! DerivedValue.class.isInstance( discriminatorRelationalValue );
- try {
- DiscriminatorType dtype = ( DiscriminatorType ) discriminatorType;
- discriminatorValue = dtype.stringToObject( entityBinding.getDiscriminatorMatchValue() );
- discriminatorSQLValue = dtype.objectToSQLString( discriminatorValue, factory.getDialect() );
- }
- catch (ClassCastException cce) {
- throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
- }
- catch (Exception e) {
- throw new MappingException("Could not format discriminator value to SQL string", e);
- }
- }
- }
- else {
- forceDiscriminator = false;
- discriminatorInsertable = false;
- discriminatorColumnName = null;
- discriminatorColumnReaders = null;
- discriminatorColumnReaderTemplate = null;
- discriminatorAlias = null;
- discriminatorType = null;
- discriminatorValue = null;
- discriminatorSQLValue = null;
- discriminatorFormula = null;
- discriminatorFormulaTemplate = null;
- }
-
- // PROPERTIES
-
- propertyTableNumbers = new int[ getPropertySpan() ];
- int i=0;
- for( AttributeBinding attributeBinding : entityBinding.getAttributeBindingClosure() ) {
- // TODO: fix when joins are working (HHH-6391)
- //propertyTableNumbers[i++] = entityBinding.getJoinNumber( attributeBinding);
- if ( attributeBinding == entityBinding.getHierarchyDetails().getEntityIdentifier().getValueBinding() ) {
- continue; // skip identifier binding
- }
- if ( ! attributeBinding.getAttribute().isSingular() ) {
- continue;
- }
- propertyTableNumbers[ i++ ] = 0;
- }
-
- //TODO: code duplication with JoinedSubclassEntityPersister
-
- ArrayList columnJoinNumbers = new ArrayList();
- ArrayList formulaJoinedNumbers = new ArrayList();
- ArrayList propertyJoinNumbers = new ArrayList();
-
- for ( AttributeBinding attributeBinding : entityBinding.getSubEntityAttributeBindingClosure() ) {
- if ( ! attributeBinding.getAttribute().isSingular() ) {
- continue;
- }
- SingularAttributeBinding singularAttributeBinding = (SingularAttributeBinding) attributeBinding;
-
- // TODO: fix when joins are working (HHH-6391)
- //int join = entityBinding.getJoinNumber(singularAttributeBinding);
- int join = 0;
- propertyJoinNumbers.add(join);
-
- //propertyTableNumbersByName.put( singularAttributeBinding.getName(), join );
- propertyTableNumbersByNameAndSubclass.put(
- singularAttributeBinding.getContainer().getPathBase() + '.' + singularAttributeBinding.getAttribute().getName(),
- join
- );
-
- for ( SimpleValueBinding simpleValueBinding : singularAttributeBinding.getSimpleValueBindings() ) {
- if ( DerivedValue.class.isInstance( simpleValueBinding.getSimpleValue() ) ) {
- formulaJoinedNumbers.add( join );
- }
- else {
- columnJoinNumbers.add( join );
- }
- }
- }
- subclassColumnTableNumberClosure = ArrayHelper.toIntArray(columnJoinNumbers);
- subclassFormulaTableNumberClosure = ArrayHelper.toIntArray(formulaJoinedNumbers);
- subclassPropertyTableNumberClosure = ArrayHelper.toIntArray(propertyJoinNumbers);
-
- int subclassSpan = entityBinding.getSubEntityBindingClosureSpan() + 1;
- subclassClosure = new String[subclassSpan];
- subclassClosure[0] = getEntityName();
- if ( entityBinding.isPolymorphic() ) {
- addSubclassByDiscriminatorValue( discriminatorValue, getEntityName() );
- }
-
- // SUBCLASSES
- if ( entityBinding.isPolymorphic() ) {
- int k=1;
- for ( EntityBinding subEntityBinding : entityBinding.getPostOrderSubEntityBindingClosure() ) {
- subclassClosure[k++] = subEntityBinding.getEntity().getName();
- if ( subEntityBinding.isDiscriminatorMatchValueNull() ) {
- addSubclassByDiscriminatorValue( NULL_DISCRIMINATOR, subEntityBinding.getEntity().getName() );
- }
- else if ( subEntityBinding.isDiscriminatorMatchValueNotNull() ) {
- addSubclassByDiscriminatorValue( NOT_NULL_DISCRIMINATOR, subEntityBinding.getEntity().getName() );
- }
- else {
- try {
- DiscriminatorType dtype = (DiscriminatorType) discriminatorType;
- addSubclassByDiscriminatorValue(
- dtype.stringToObject( subEntityBinding.getDiscriminatorMatchValue() ),
- subEntityBinding.getEntity().getName()
- );
- }
- catch (ClassCastException cce) {
- throw new MappingException("Illegal discriminator type: " + discriminatorType.getName() );
- }
- catch (Exception e) {
- throw new MappingException("Error parsing discriminator value", e);
- }
- }
- }
- }
-
- initLockers();
-
- initSubclassPropertyAliasesMap( entityBinding );
-
- postConstruct( mapping );
- }
-
- private static void initializeCustomSql(
- CustomSQL customSql,
- int i,
- String[] sqlStrings,
- boolean[] callable,
- ExecuteUpdateResultCheckStyle[] checkStyles) {
- sqlStrings[i] = customSql != null ? customSql.getSql(): null;
- callable[i] = sqlStrings[i] != null && customSql.isCallable();
- checkStyles[i] = customSql != null && customSql.getCheckStyle() != null ?
- customSql.getCheckStyle() :
- ExecuteUpdateResultCheckStyle.determineDefault( sqlStrings[i], callable[i] );
- }
-
protected boolean isInverseTable(int j) {
return isInverseTable[j];
}
protected boolean isInverseSubclassTable(int j) {
return isInverseSubclassTable[j];
}
public String getDiscriminatorColumnName() {
return discriminatorColumnName;
}
public String getDiscriminatorColumnReaders() {
return discriminatorColumnReaders;
}
public String getDiscriminatorColumnReaderTemplate() {
return discriminatorColumnReaderTemplate;
}
protected String getDiscriminatorAlias() {
return discriminatorAlias;
}
protected String getDiscriminatorFormulaTemplate() {
return discriminatorFormulaTemplate;
}
public String getTableName() {
return qualifiedTableNames[0];
}
public Type getDiscriminatorType() {
return discriminatorType;
}
public Object getDiscriminatorValue() {
return discriminatorValue;
}
public String getDiscriminatorSQLValue() {
return discriminatorSQLValue;
}
public String[] getSubclassClosure() {
return subclassClosure;
}
public String getSubclassForDiscriminatorValue(Object value) {
if (value==null) {
return (String) subclassesByDiscriminatorValue.get(NULL_DISCRIMINATOR);
}
else {
String result = (String) subclassesByDiscriminatorValue.get(value);
if (result==null) result = (String) subclassesByDiscriminatorValue.get(NOT_NULL_DISCRIMINATOR);
return result;
}
}
public Serializable[] getPropertySpaces() {
return spaces;
}
//Access cached SQL
protected boolean isDiscriminatorFormula() {
return discriminatorColumnName==null;
}
protected String getDiscriminatorFormula() {
return discriminatorFormula;
}
protected String getTableName(int j) {
return qualifiedTableNames[j];
}
protected String[] getKeyColumns(int j) {
return keyColumnNames[j];
}
protected boolean isTableCascadeDeleteEnabled(int j) {
return cascadeDeleteEnabled[j];
}
protected boolean isPropertyOfTable(int property, int j) {
return propertyTableNumbers[property]==j;
}
protected boolean isSubclassTableSequentialSelect(int j) {
return subclassTableSequentialSelect[j] && !isClassOrSuperclassTable[j];
}
// Execute the SQL:
public String fromTableFragment(String name) {
return getTableName() + ' ' + name;
}
@Override
public String filterFragment(String alias) throws MappingException {
String result = discriminatorFilterFragment(alias);
if ( hasWhere() ) result += " and " + getSQLWhereString(alias);
return result;
}
private String discriminatorFilterFragment(String alias) throws MappingException {
return discriminatorFilterFragment( alias, null );
}
public String oneToManyFilterFragment(String alias) throws MappingException {
return forceDiscriminator
? discriminatorFilterFragment( alias, null )
: "";
}
@Override
public String oneToManyFilterFragment(String alias, Set<String> treatAsDeclarations) {
return needsDiscriminator()
? discriminatorFilterFragment( alias, treatAsDeclarations )
: "";
}
@Override
public String filterFragment(String alias, Set<String> treatAsDeclarations) {
String result = discriminatorFilterFragment( alias, treatAsDeclarations );
if ( hasWhere() ) {
result += " and " + getSQLWhereString( alias );
}
return result;
}
private String discriminatorFilterFragment(String alias, Set<String> treatAsDeclarations) {
final boolean hasTreatAs = treatAsDeclarations != null && !treatAsDeclarations.isEmpty();
if ( !needsDiscriminator() && !hasTreatAs) {
return "";
}
final InFragment frag = new InFragment();
if ( isDiscriminatorFormula() ) {
frag.setFormula( alias, getDiscriminatorFormulaTemplate() );
}
else {
frag.setColumn( alias, getDiscriminatorColumnName() );
}
if ( hasTreatAs ) {
frag.addValues( decodeTreatAsRequests( treatAsDeclarations ) );
}
else {
frag.addValues( fullDiscriminatorValues() );
}
return " and " + frag.toFragmentString();
}
private boolean needsDiscriminator() {
return forceDiscriminator || isInherited();
}
private String[] decodeTreatAsRequests(Set<String> treatAsDeclarations) {
final List<String> values = new ArrayList<String>();
for ( String subclass : treatAsDeclarations ) {
final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclass );
if ( !queryable.isAbstract() ) {
values.add( queryable.getDiscriminatorSQLValue() );
}
}
return values.toArray( new String[ values.size() ] );
}
private String[] fullDiscriminatorValues;
private String[] fullDiscriminatorValues() {
if ( fullDiscriminatorValues == null ) {
// first access; build it
final List<String> values = new ArrayList<String>();
for ( String subclass : getSubclassClosure() ) {
final Queryable queryable = (Queryable) getFactory().getEntityPersister( subclass );
if ( !queryable.isAbstract() ) {
values.add( queryable.getDiscriminatorSQLValue() );
}
}
fullDiscriminatorValues = values.toArray( new String[values.size() ] );
}
return fullDiscriminatorValues;
}
public String getSubclassPropertyTableName(int i) {
return subclassTableNameClosure[ subclassPropertyTableNumberClosure[i] ];
}
protected void addDiscriminatorToSelect(SelectFragment select, String name, String suffix) {
if ( isDiscriminatorFormula() ) {
select.addFormula( name, getDiscriminatorFormulaTemplate(), getDiscriminatorAlias() );
}
else {
select.addColumn( name, getDiscriminatorColumnName(), getDiscriminatorAlias() );
}
}
protected int[] getPropertyTableNumbersInSelect() {
return propertyTableNumbers;
}
protected int getSubclassPropertyTableNumber(int i) {
return subclassPropertyTableNumberClosure[i];
}
public int getTableSpan() {
return joinSpan;
}
protected void addDiscriminatorToInsert(Insert insert) {
if (discriminatorInsertable) {
insert.addColumn( getDiscriminatorColumnName(), discriminatorSQLValue );
}
}
protected int[] getSubclassColumnTableNumberClosure() {
return subclassColumnTableNumberClosure;
}
protected int[] getSubclassFormulaTableNumberClosure() {
return subclassFormulaTableNumberClosure;
}
protected int[] getPropertyTableNumbers() {
return propertyTableNumbers;
}
protected boolean isSubclassPropertyDeferred(String propertyName, String entityName) {
return hasSequentialSelects &&
isSubclassTableSequentialSelect( getSubclassPropertyTableNumber(propertyName, entityName) );
}
public boolean hasSequentialSelect() {
return hasSequentialSelects;
}
private int getSubclassPropertyTableNumber(String propertyName, String entityName) {
Type type = propertyMapping.toType(propertyName);
if ( type.isAssociationType() && ( (AssociationType) type ).useLHSPrimaryKey() ) return 0;
final Integer tabnum = (Integer) propertyTableNumbersByNameAndSubclass.get(entityName + '.' + propertyName);
return tabnum==null ? 0 : tabnum;
}
protected String getSequentialSelect(String entityName) {
return (String) sequentialSelectStringsByEntityName.get(entityName);
}
private String generateSequentialSelect(Loadable persister) {
//if ( this==persister || !hasSequentialSelects ) return null;
//note that this method could easily be moved up to BasicEntityPersister,
//if we ever needed to reuse it from other subclasses
//figure out which tables need to be fetched
AbstractEntityPersister subclassPersister = (AbstractEntityPersister) persister;
HashSet tableNumbers = new HashSet();
String[] props = subclassPersister.getPropertyNames();
String[] classes = subclassPersister.getPropertySubclassNames();
for ( int i=0; i<props.length; i++ ) {
int propTableNumber = getSubclassPropertyTableNumber( props[i], classes[i] );
if ( isSubclassTableSequentialSelect(propTableNumber) && !isSubclassTableLazy(propTableNumber) ) {
tableNumbers.add( propTableNumber);
}
}
if ( tableNumbers.isEmpty() ) return null;
//figure out which columns are needed
ArrayList columnNumbers = new ArrayList();
final int[] columnTableNumbers = getSubclassColumnTableNumberClosure();
for ( int i=0; i<getSubclassColumnClosure().length; i++ ) {
if ( tableNumbers.contains( columnTableNumbers[i] ) ) {
columnNumbers.add( i );
}
}
//figure out which formulas are needed
ArrayList formulaNumbers = new ArrayList();
final int[] formulaTableNumbers = getSubclassColumnTableNumberClosure();
for ( int i=0; i<getSubclassFormulaTemplateClosure().length; i++ ) {
if ( tableNumbers.contains( formulaTableNumbers[i] ) ) {
formulaNumbers.add( i );
}
}
//render the SQL
return renderSelect(
ArrayHelper.toIntArray(tableNumbers),
ArrayHelper.toIntArray(columnNumbers),
ArrayHelper.toIntArray(formulaNumbers)
);
}
protected String[] getSubclassTableKeyColumns(int j) {
return subclassTableKeyColumnClosure[j];
}
public String getSubclassTableName(int j) {
return subclassTableNameClosure[j];
}
public int getSubclassTableSpan() {
return subclassTableNameClosure.length;
}
protected boolean isClassOrSuperclassTable(int j) {
return isClassOrSuperclassTable[j];
}
protected boolean isSubclassTableLazy(int j) {
return subclassTableIsLazyClosure[j];
}
protected boolean isNullableTable(int j) {
return isNullableTable[j];
}
protected boolean isNullableSubclassTable(int j) {
return isNullableSubclassTable[j];
}
public String getPropertyTableName(String propertyName) {
Integer index = getEntityMetamodel().getPropertyIndexOrNull(propertyName);
if (index==null) return null;
return qualifiedTableNames[ propertyTableNumbers[index] ];
}
protected void doPostInstantiate() {
if (hasSequentialSelects) {
String[] entityNames = getSubclassClosure();
for ( int i=1; i<entityNames.length; i++ ) {
Loadable loadable = (Loadable) getFactory().getEntityPersister( entityNames[i] );
if ( !loadable.isAbstract() ) { //perhaps not really necessary...
String sequentialSelect = generateSequentialSelect(loadable);
sequentialSelectStringsByEntityName.put( entityNames[i], sequentialSelect );
}
}
}
}
public boolean isMultiTable() {
return getTableSpan() > 1;
}
public String[] getConstraintOrderedTableNameClosure() {
return constraintOrderedTableNames;
}
public String[][] getContraintOrderedTableKeyColumnClosure() {
return constraintOrderedKeyColumnNames;
}
@Override
public FilterAliasGenerator getFilterAliasGenerator(String rootAlias) {
return new DynamicFilterAliasGenerator(qualifiedTableNames, rootAlias);
}
}
| [
"marta.pancaldi@stud-inf.unibz.it"
] | marta.pancaldi@stud-inf.unibz.it |
b45b1d879fb75912392ca2b7a7642f067b136927 | 493a8065cf8ec4a4ccdf136170d505248ac03399 | /org.mindswap.owls-api/src/test/java/impl/jena/OWLReaderTest.java | 5ec50d8aeaf0095bf6cecfaebbc0b517b4146131 | [] | no_license | ignasi-gomez/aliveclipse | 593611b2d471ee313650faeefbed591c17beaa50 | 9dd2353c886f60012b4ee4fe8b678d56972dff97 | refs/heads/master | 2021-01-14T09:08:24.839952 | 2014-10-09T14:21:01 | 2014-10-09T14:21:01 | null | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 13,485 | java | /*
* Created 26.03.2009
*
* (c) 2009 Thorsten M÷ller - University of Basel Switzerland
*
* The MIT License
* 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 impl.jena;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.junit.Assume.assumeNoException;
import static org.junit.Assume.assumeNotNull;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.junit.BeforeClass;
import org.junit.Test;
import org.mindswap.owl.OWLFactory;
import org.mindswap.owl.OWLKnowledgeBase;
import org.mindswap.owl.OWLKnowledgeBaseManager;
import org.mindswap.owl.OWLOntology;
import org.mindswap.owl.OWLSyntax;
import org.mindswap.owls.service.Service;
import org.mindswap.owls.vocabulary.OWLS;
import org.mindswap.utils.URIUtils;
import org.mindswap.utils.Utils;
import examples.ExampleURIs;
/**
* JUnit tests for class {@link OWLReaderImpl}.
*
* @author unascribed
* @version $Rev: 2530 $; $Author: thorsten $; $Date: 2010-07-30 19:46:00 +0200 (Fr, 30 Jul 2010) $
*/
public class OWLReaderTest
{
@BeforeClass
public static void note()
{
System.out.println("Note that this test requires the local host to be connected to the Internet and " +
"the availability of remote resources, which might change, move, or disappear. Consequently, " +
"in case this test fails this does not necessarily mean that there is a problem with the code!");
}
/**
* Test method for {@link impl.jena.OWLReaderImpl#read(java.io.Reader, java.net.URI)}.
*/
@Test
public final void testReadReaderURI()
{
String invalidXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
OWLKnowledgeBase kb = OWLFactory.createKB();
try
{
kb.read(new StringReader(invalidXML), null);
fail(IOException.class + " expected.");
}
catch (IOException ignore)
{
// nice
}
}
/**
* Test method for {@link impl.jena.OWLReaderImpl#read(InputStream, java.net.URI)}.
*/
@Test
public final void testReadInputStreamURI() throws IOException
{
// try to read ont that imports owls:Service, which is available
InputStream availableImport = ClassLoader.getSystemResourceAsStream("owl/available_import.owl");
assumeNotNull(availableImport);
OWLKnowledgeBase kb = OWLFactory.createKB();
try
{
OWLOntology ont = kb.read(availableImport, null);
assertNotNull(ont);
Set<OWLOntology> imports = ont.getImports(true);
assertEquals(1, imports.size()); // the file exactly has one import
OWLOntology serviceOnt = imports.iterator().next();
assertEquals(URIUtils.standardURI(OWLS.SERVICE_NS), serviceOnt.getURI());
}
catch (IOException e)
{
fail("Unexpected exception " + e);
}
availableImport.close();
// try to read ont that imports another ont that does not exist and we ignore failure
InputStream unavailableImport = ClassLoader.getSystemResourceAsStream("owl/unavailable_import.owl");
assumeNotNull(unavailableImport);
kb = OWLFactory.createKB();
kb.getReader().setIgnoreFailedImport(true);
try
{
OWLOntology ont = kb.read(unavailableImport, null);
assertNotNull(ont);
Set<OWLOntology> imports = ont.getImports(true);
assertEquals(1, imports.size()); // imported ontology exists but should be empty
OWLOntology unavailableOnt = imports.iterator().next();
assertEquals(0, ((OWLOntologyImpl) unavailableOnt).getImplementation().size());
}
catch (IOException e)
{
fail("Unexpected exception " + e);
}
unavailableImport.close();
// try to read ont that imports another ont that does not exist and we do not ignore failure
unavailableImport = ClassLoader.getSystemResourceAsStream("owl/unavailable_import.owl");
assumeNotNull(unavailableImport);
kb = OWLFactory.createKB();
kb.getReader().setIgnoreFailedImport(false);
try
{
kb.read(unavailableImport, null);
fail("Exception expected.");
}
catch (IOException e)
{
// nice
}
unavailableImport.close();
// do the same again <-- must throw exception again even if caching is used
unavailableImport = ClassLoader.getSystemResourceAsStream("owl/unavailable_import.owl");
assumeNotNull(unavailableImport);
kb = OWLFactory.createKB();
kb.getReader().setIgnoreFailedImport(false);
try
{
kb.read(unavailableImport, null);
fail("Exception expected.");
}
catch (IOException e)
{
// nice
}
unavailableImport.close();
}
@Test
public final void testReadTurtleReader()
{
String ttl =
"@prefix owl: <http://www.w3.org/2002/07/owl#> ." + Utils.LINE_SEPARATOR +
"<http://on.cs.unibas.ch/available_import.ttl>" + Utils.LINE_SEPARATOR +
" a owl:Ontology ;" + Utils.LINE_SEPARATOR +
" owl:imports <http://www.daml.org/services/owl-s/1.2/Service.owl> .";
OWLKnowledgeBase kb = OWLFactory.createKB();
kb.getReader().setSyntax(OWLSyntax.TURTLE);
try
{
OWLOntology ont = kb.read(new StringReader(ttl), null);
assertNotNull(ont);
ont.containsOntology(OWLS.Service.describedBy.getOntology().getURI());
}
catch (IOException e)
{
fail("Unexpected exception " + e);
}
}
@Test
public final void testReadTurtleInputStream() throws IOException
{
InputStream availableImport = ClassLoader.getSystemResourceAsStream("owl/available_import.ttl");
assumeNotNull(availableImport);
OWLKnowledgeBase kb = OWLFactory.createKB();
kb.getReader().setSyntax(OWLSyntax.TURTLE);
try
{
OWLOntology ont = kb.read(availableImport, null);
assertNotNull(ont);
ont.containsOntology(OWLS.Service.describedBy.getOntology().getURI());
}
catch (IOException e)
{
fail("Unexpected exception " + e);
}
availableImport.close();
// once again with wrong format specified --> should raise exception
availableImport = ClassLoader.getSystemResourceAsStream("owl/available_import.ttl");
kb.getReader().setSyntax(OWLSyntax.RDFXML);
try
{
kb.read(availableImport, null);
fail("IOException expected.");
}
catch (IOException e)
{
// nice
}
availableImport.close();
}
/**
* Tests reading two example OWL-S services from a local file concurrently
* by multiple threads. We only want to analyze if typical concurrent
* modification exceptions occur.
*/
@Test
public final void testReadUsingMultipleThreads() throws Exception
{
int numOfConcurrentTasks = 5;
List<Callable<Exception>> tasks = new ArrayList<Callable<Exception>>(numOfConcurrentTasks);
ExecutorService executor = Executors.newFixedThreadPool(numOfConcurrentTasks);
for (int i = 0; i < numOfConcurrentTasks; i++)
{
tasks.add(new Callable<Exception>() {
public Exception call() throws Exception
{
try
{
OWLKnowledgeBase kb = OWLFactory.createKB();
// kb.getReader().setIgnoreFailedImport(true);
File f = new File("src/examples/owl-s/1.2/FrenchDictionary.owl");
FileInputStream fis = new FileInputStream(f);
Service service = kb.readService(fis, ExampleURIs.FRENCH_DICTIONARY_OWLS12);
if (service == null) return new Exception("Service null upon read.");
fis.close();
return null;
}
catch (IOException ioe)
{
return ioe;
}
}
});
tasks.add(new Callable<Exception>() {
public Exception call() throws Exception
{
try
{
OWLKnowledgeBase kb = OWLFactory.createKB();
// kb.getReader().setIgnoreFailedImport(true);
File f = new File("src/examples/owl-s/1.2/CurrencyConverter.owl");
FileInputStream fis = new FileInputStream(f);
Service service = kb.readService(fis, ExampleURIs.CURRENCY_CONVERTER_OWLS12);
if (service == null) return new Exception("Service null upon read.");
fis.close();
return null;
}
catch (IOException ioe)
{
return ioe;
}
}
});
}
List<Future<Exception>> futures = executor.invokeAll(tasks);
boolean fail = false;
StringBuilder errors = new StringBuilder();
for (Future<Exception> future : futures)
{
Exception e = future.get();
if (e != null)
{
fail = true;
errors.append(" ").append(e.toString());
}
}
if (fail)
{
fail("Callable threw exception. Details:" + errors);
}
}
@Test
public void testWithDedicatedOWLKBManager()
{
OWLKnowledgeBaseManager kbm = OWLFactory.createKBManager();
OWLKnowledgeBase kb1 = OWLFactory.createKB(kbm);
URI processURI = ExampleURIs.FIND_CHEAPER_BOOK_OWLS12;
try
{
// 1.) - from original location
long time1 = System.nanoTime();
OWLOntology ont1 = kb1.read(processURI);
time1 = System.nanoTime() - time1;
System.out.printf("First read of %s from the Web took %4dms%n",
processURI, TimeUnit.NANOSECONDS.toMillis(time1));
assertEquals(processURI, ont1.getURI());
// 2.) - just try again --> returns already loaded one in KB
long time2 = System.nanoTime();
OWLOntology ont2 = kb1.read(processURI);
time2 = System.nanoTime() - time2;
System.out.printf("Second read of %s (same KB --> use existing one) took %4dÁs%n",
processURI, TimeUnit.NANOSECONDS.toMicros(time2));
assertEquals(ont1, ont2);
assertTrue(time2 < time1);
// 3.) - use new KB but same KB manager --> load from cache
OWLKnowledgeBase kb2 = OWLFactory.createKB(kbm);
long time3 = System.nanoTime();
OWLOntology ont3 = kb2.read(processURI);
time3 = System.nanoTime() - time3;
System.out.printf("Third read of %s (new KB & existing KB manager cache) took %4dÁs%n",
processURI, TimeUnit.NANOSECONDS.toMicros(time3));
assertEquals(ont2.getURI(), ont3.getURI());
assertEquals(ont2.size(), ont3.size());
assertTrue(time3 < time1);
// 4.) - partially clear KB manager cache --> load Process ont but not imports from Web again
kbm.clear(processURI);
OWLKnowledgeBase kb3 = OWLFactory.createKB(kbm);
long time4 = System.nanoTime();
OWLOntology ont4 = kb3.read(processURI);
time4 = System.nanoTime() - time4;
System.out.printf("Forth read of %s (partially cleared KB manager cache) took %4dms%n",
processURI, TimeUnit.NANOSECONDS.toMillis(time4));
assertEquals(processURI, ont4.getURI());
assertEquals(ont3.size(), ont4.size());
assertTrue(time3 < time4);
// 5.) entirely clear KB manager cache --> load process and imports from Web again
kbm.clear(null);
OWLKnowledgeBase kb4 = OWLFactory.createKB(kbm);
long time5 = System.nanoTime();
OWLOntology ont5 = kb4.read(processURI);
time5 = System.nanoTime() - time5;
System.out.printf("Fifth read of %s (entirely cleared KB manager cache) took %4dms%n",
processURI, TimeUnit.NANOSECONDS.toMillis(time5));
assertEquals(processURI, ont5.getURI());
assertEquals(ont3.size(), ont5.size());
assertTrue(time4 < time5);
// 6.a) turn off caching for KB manager --> load process and imports from Web again
kbm.setCaching(false);
OWLKnowledgeBase kb5 = OWLFactory.createKB(kbm);
long time6 = System.nanoTime();
OWLOntology ont6 = kb5.read(processURI);
time6 = System.nanoTime() - time6;
System.out.printf("Sixth read of %s (turn off KB manager caching) took %4dms%n",
processURI, TimeUnit.NANOSECONDS.toMillis(time6));
assertEquals(processURI, ont6.getURI());
assertEquals(ont3.size(), ont6.size());
assertTrue(time4 < time6);
// 6.b) try again --> times of a) and b) should not differ much
OWLKnowledgeBase kb6 = OWLFactory.createKB(kbm);
long time7 = System.nanoTime();
OWLOntology ont7 = kb6.read(processURI);
time7 = System.nanoTime() - time7;
System.out.printf("Seventh read of %s (no KB manager caching) took %4dms%n",
processURI, TimeUnit.NANOSECONDS.toMillis(time7));
assertEquals(processURI, ont7.getURI());
assertEquals(ont3.size(), ont7.size());
// does not work perfectly: caching remains active in Jena for imported ontologies (ImportModelMaker)
// assertEquals(time6, time7, time6 / 3); // allow ~33% difference
}
catch (IOException e)
{
assumeNoException(e);
}
}
}
| [
"salvarez@lsi.upc.edu"
] | salvarez@lsi.upc.edu |
e82962bf806ea42b3ae04f0455283e89241b1e2f | 29b6a856a81a47ebab7bfdba7fe8a7b845123c9e | /dingtalk/java/src/main/java/com/aliyun/dingtalkstorage_1_0/models/MoveDentryResponse.java | b9be107ff7da2c5425cac5316501a58ce2e47727 | [
"Apache-2.0"
] | permissive | aliyun/dingtalk-sdk | f2362b6963c4dbacd82a83eeebc223c21f143beb | 586874df48466d968adf0441b3086a2841892935 | refs/heads/master | 2023-08-31T08:21:14.042410 | 2023-08-30T08:18:22 | 2023-08-30T08:18:22 | 290,671,707 | 22 | 9 | null | 2021-08-12T09:55:44 | 2020-08-27T04:05:39 | PHP | UTF-8 | Java | false | false | 1,325 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.dingtalkstorage_1_0.models;
import com.aliyun.tea.*;
public class MoveDentryResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public MoveDentryResponseBody body;
public static MoveDentryResponse build(java.util.Map<String, ?> map) throws Exception {
MoveDentryResponse self = new MoveDentryResponse();
return TeaModel.build(map, self);
}
public MoveDentryResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public MoveDentryResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public MoveDentryResponse setBody(MoveDentryResponseBody body) {
this.body = body;
return this;
}
public MoveDentryResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
78870e9fb8e7cacd4df3a2e76f6d85ed63af0edd | 757d26ebd3e7e881f8bb0f935e442957030a52fe | /src/main/java/DFIT/fitness2d/controllers/ClientController.java | e20f62ed536e010569f9d17a656722cfd9ca3b7e | [] | no_license | leo4135/fitness2d_test | 40e2fea8a553c1ff4ce7d521b08c344bf78e92c6 | dccb0dd9b9dca96f58decf7faeaa067aca2f8447 | refs/heads/master | 2023-04-01T12:17:08.017090 | 2021-04-01T12:40:36 | 2021-04-01T12:40:36 | 353,695,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,059 | java | package DFIT.fitness2d.controllers;
import DFIT.fitness2d.entity.Abonements;
import DFIT.fitness2d.entity.Client;
import DFIT.fitness2d.entity.ClientAbon;
import DFIT.fitness2d.repository.AbonementsRepository;
import DFIT.fitness2d.repository.ClientRepository;
import DFIT.fitness2d.repository.RoleRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/client")
public class ClientController {
@Autowired
private ClientRepository clients;
@Autowired
private AbonementsRepository abonementsRepository;
private RoleRepository roleRepository;
// @GetMapping
// public Iterable<Client> listClients(){
// return clients.findAll();
//}
@PostMapping
public Client addClient( @RequestParam(value = "name") String name,
@RequestParam(value = "telephone") String telephone,
@RequestParam(value = "surname") String surname,
@RequestParam(value = "id") int id
){
Client newClient = new Client();
newClient.setName(name);
newClient.setPhone(telephone);
newClient.setPassword(telephone);
newClient.setSurname(surname);
Abonements abonement = abonementsRepository.findById(id).get();
ClientAbon clientAbon = new ClientAbon();
clientAbon.setClient(newClient);
clientAbon.setAbonement(abonement);
return newClient;
}
@GetMapping
public Iterable<Client> getAll(){
return clients.findAll();
}
@GetMapping
public Page<Client> getByPage(@RequestParam int Page,
@RequestParam int Size){
Pageable pageable = PageRequest.of(Page, Size);
Page<Client> client = clients.findAll(pageable);
return client;
}
}
| [
"yuo@gmail.com"
] | yuo@gmail.com |
f9bcceeeaabd92f0e70651a919b284adaa52cbce | 0f2ee5cab08234c0c26690feb0e5572a34b1b8a6 | /JavaApplication/src/TDemo/Demo2.java | 67a03a518d485e158fd2302d5871222145335753 | [] | no_license | StephenImp/JavaBasisAndPromote | dc16504c5ec54ff6826b2d1583fe52b65966a391 | bd4991965b3add27fc22b4daf8d68c0d8da9dc03 | refs/heads/master | 2022-12-26T15:47:27.762180 | 2021-03-04T14:11:54 | 2021-03-04T14:11:54 | 150,877,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,113 | java | package TDemo;
import java.util.ArrayList;
import java.util.List;
/**
* Created by MOZi on 2018/12/22.
*/
public class Demo2<T> {
private T demoT;
public static void main(String[] args) {
//限制T 为String 类型
Demo2<String> demo = new Demo2<String>();
//获取string类型
List<String> array = new ArrayList<String>();
array.add("test");
array.add("doub");
String str = demo.getListFisrt(array);
System.out.println(str);
//获取Integer类型 T 为Integer类型
Demo2<Integer> demo2 = new Demo2<Integer>();
List<Integer> nums = new ArrayList<Integer>();
nums.add(12);
nums.add(13);
Integer num = demo2.getListFisrt(nums);
System.out.println(num);
}
/**
* 这个只能传递T类型的数据
* 返回值 就是Demo<T> 实例化传递的对象类型
* @param data
* @return
*/
private T getListFisrt(List<T> data) {
if (data == null || data.size() == 0) {
return null;
}
return data.get(0);
}
}
| [
"stephenpengwen@163.com"
] | stephenpengwen@163.com |
d90686112876db3447e9128252c0b773365e0ccf | 91aa08045d78b0aa1c855512b53ed481026e1173 | /SearchRange.java | 6386e03f18f85435f3f3bae850664e9c1fe3a9a0 | [] | no_license | purlin07/leetcode | 9a470b883b95ddb646c44361f8f486313bd24732 | b99305641fd6df27f77aa4bc0c6e4353d8a11abe | refs/heads/master | 2021-01-02T22:39:00.269520 | 2015-01-13T00:00:09 | 2015-01-13T00:00:09 | 28,541,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,041 | java | class SearchRange
{
public static void main(String[] args){
int[] test1 = {5,7,7,8,8,9,9};
int[] test2 = {8,8,8,8};
int[] test3 = {5,7,7,7,7};
int[] test4 = {8};
int[] test5 = {7};
print(search(test1,8));
print(search(test2,8));
print(search(test3,8));
print(search(test4,8));
print(search(test5,8));
}
public static int[] search(int[] A, int target){
int[] result = new int[2];
int s = -1;
int e = -1;
result[0] = s;
result[1] = e;
int start = 0;
int end = A.length - 1;
while(start <= end){
int mid = (start + end)/2;
if(A[mid] == target){
s = mid;
e = mid;
while(s >= 0 && A[s] == target){
--s;
}
while(e <= A.length - 1 && A[e] == target){
++e;
}
result[0] = s + 1;
result[1] = e - 1;
return result;
}else if(A[mid] > target){
end = mid - 1;
}else {
start = mid + 1;
}
}
return result;
}
public static void print(int[] arr){
for(int i : arr){
System.out.print(i + " ");
}
System.out.print("\n");
}
}
| [
"ghan@g.clemson.edu"
] | ghan@g.clemson.edu |
223111195f98c43f04847b36cda1306bb861fed8 | 3bb932947a00b2f77deb1f9294340710f30ed2e0 | /data/comp-changes-client/src/mainclient/classLessAccessible/ClassLessAccessiblePub2PrivExt.java | 3b86ddcfa2bf71c80c8d748743a6c76a18683641 | [
"MIT"
] | permissive | crossminer/maracas | 17684657b29293d82abe50249798e10312d192d6 | 4cb6fa22d8186d09c3bba6f5da0c548a26d044e1 | refs/heads/master | 2023-03-05T20:34:36.083662 | 2023-02-22T12:21:47 | 2023-02-22T12:21:47 | 175,425,329 | 8 | 0 | null | 2021-02-25T13:19:15 | 2019-03-13T13:21:53 | Java | UTF-8 | Java | false | false | 635 | java | package mainclient.classLessAccessible;
import main.classLessAccessible.ClassLessAccessiblePub2Priv;
public class ClassLessAccessiblePub2PrivExt extends ClassLessAccessiblePub2Priv {
public void instantiatePub2Priv() {
ClassLessAccessiblePub2PrivInner c1 = new ClassLessAccessiblePub2PrivInner();
ClassLessAccessiblePub2PrivInner c2 = new ClassLessAccessiblePub2PrivExtInner();
}
public class ClassLessAccessiblePub2PrivExtInner extends ClassLessAccessiblePub2PrivInner {
public int accessPublicField() {
return super.publicField;
}
public int invokePublicMethod() {
return super.publicMethod();
}
}
}
| [
"lina.m8a@gmail.com"
] | lina.m8a@gmail.com |
f22bafdfae9ceb50624ab458bde86b6deb01e228 | 101d979ce7d950289345cd5d36635a890e8b2db5 | /src/fmss/common/util/ColBean.java | e92a4fb2b2f8b3a599c218d96171429522ca4675 | [] | no_license | byxfvmss/vmss | a3bcbe864c6f57079a8035c92d73d0ac082a1c66 | 0b54852b2feb79ea20b982d1728754917a82e3ca | refs/heads/master | 2022-12-06T13:19:51.010451 | 2020-09-04T08:24:56 | 2020-09-04T08:24:56 | 292,790,355 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,608 | java | package fmss.common.util;
import java.util.ArrayList;
import java.util.List;
public class ColBean {
private String name;
private String nullable;//是否可为空
private String deft;//默认值
private String type;//类型
private String length;//长度
private String scale;//精度
private String constraint_type;//约束类型
private List diffType;//列不同信息 0为缺列, 1为type不同, 2为length不同, 3为nullable不同
private String err_nullable;//是否可为空
private String err_deft;//默认值
private String err_type;//类型
private String err_length;//长度
private String err_scale;//精度
private String err_constraint_type;//约束类型
public ColBean(){
diffType=new ArrayList();
}
public List getDiffType() {
return diffType;
}
public void setDiffType(List diffType) {
this.diffType = diffType;
}
public String getConstraint_type() {
return constraint_type;
}
public void setConstraint_type(String constraint_type) {
this.constraint_type = constraint_type;
}
public String getDeft() {
return deft;
}
public void setDeft(String deft) {
this.deft = deft;
}
public String getLength() {
return length;
}
public void setLength(String length) {
this.length = length;
}
public String getScale() {
return scale;
}
public void setScale(String scale) {
this.scale = scale;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNullable() {
return nullable;
}
public void setNullable(String nullable) {
this.nullable = nullable;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getErr_constraint_type() {
return err_constraint_type;
}
public void setErr_constraint_type(String err_constraint_type) {
this.err_constraint_type = err_constraint_type;
}
public String getErr_deft() {
return err_deft;
}
public void setErr_deft(String err_deft) {
this.err_deft = err_deft;
}
public String getErr_length() {
return err_length;
}
public void setErr_length(String err_length) {
this.err_length = err_length;
}
public String getErr_nullable() {
return err_nullable;
}
public void setErr_nullable(String err_nullable) {
this.err_nullable = err_nullable;
}
public String getErr_scale() {
return err_scale;
}
public void setErr_scale(String err_scale) {
this.err_scale = err_scale;
}
public String getErr_type() {
return err_type;
}
public void setErr_type(String err_type) {
this.err_type = err_type;
}
}
| [
"15231500531@163.com"
] | 15231500531@163.com |
871c091a1e9b61885395ae96db62d3853a44cf1b | 7e1511cdceeec0c0aad2b9b916431fc39bc71d9b | /flakiness-predicter/input_data/original_tests/doanduyhai-Achilles/nonFlakyMethods/info.archinnov.achilles.internal.proxy.wrapper.ListWrapperTest-should_mark_dirty_on_remove_all.java | 2785e45434bff9bd7f8d4754cf51e6d1a6d437a8 | [
"BSD-3-Clause"
] | permissive | Taher-Ghaleb/FlakeFlagger | 6fd7c95d2710632fd093346ce787fd70923a1435 | 45f3d4bc5b790a80daeb4d28ec84f5e46433e060 | refs/heads/main | 2023-07-14T16:57:24.507743 | 2021-08-26T14:50:16 | 2021-08-26T14:50:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | java | @Test public void should_mark_dirty_on_remove_all() throws Exception {
List<Object> target=Lists.<Object>newArrayList("a","b","c");
ListWrapper wrapper=prepareListWrapper(target);
wrapper.setProxifier(proxifier);
Collection<String> list=Arrays.asList("a","c");
when(proxifier.removeProxy(Mockito.<Collection<String>>any())).thenReturn(list);
wrapper.removeAll(list);
assertThat(target).containsExactly("b");
DirtyChecker dirtyChecker=dirtyMap.get(setter);
assertThat(dirtyChecker.getPropertyMeta()).isEqualTo(propertyMeta);
DirtyCheckChangeSet changeSet=dirtyChecker.getChangeSets().get(0);
assertThat(changeSet.getChangeType()).isEqualTo(REMOVE_FROM_LIST);
assertThat(changeSet.getPropertyMeta()).isEqualTo(propertyMeta);
assertThat(changeSet.getRawListChanges()).containsOnly("a","c");
}
| [
"aalsha2@masonlive.gmu.edu"
] | aalsha2@masonlive.gmu.edu |
589a9ab5dcd2edcc55edb78cfef939b66643e3a8 | 4b0ce6a0320c934bbb5606f23b21241c1d9a15d9 | /Classes/src/App.java | 1e0ce328dd2f9f6c8fbb816edadf5065db36e2b4 | [] | no_license | elarsaks/Java-Fundamentals | e35af3a8cb7ae4d536bcfa36a127eba5cef3d979 | 05c9f48c900f34260062cf3e193353ddd7bca22d | refs/heads/master | 2023-06-19T02:45:13.358263 | 2021-07-20T18:22:15 | 2021-07-20T18:22:15 | 380,316,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | class Methods {
String animal;
int value;
int month;
void run() {
System.out.println("Running!");
System.out.println("My " + animal + " is " + value + " years old.");
}
int calculateMonthsToBirthday() {
int monthsLeft = 12 - month;
return monthsLeft;
}
void talk(String text) {
System.out.println(text);
}
}
public class App {
public static void main(String[] args) {
Methods name = new Methods();
name.animal = "cat";
name.value = 1;
name.month = 8;
name.run();
int months = name.calculateMonthsToBirthday();
System.out.println(months);
name.talk("Hi, I am Steven!");
}
}
| [
"elarsaks@gmail.com"
] | elarsaks@gmail.com |
2b8db922b6a6df4cf95744c76592574deabef330 | 62ec9da51d9dcd19c5c2bf07ac69c96902b17c5e | /src/main/java/comte/ui/model/event/TurnResultListener.java | ba5c55dce77c68c10f88b11e6bd7578273cc7a96 | [] | no_license | comtef/rock-paper-scissors | 09ef6285b14bd0ba4bed1cd428561d410cad88b2 | dca90c7a338c89c071f21d865bbab4378ce4a87f | refs/heads/master | 2021-01-19T07:03:16.443663 | 2016-07-21T13:39:35 | 2016-07-21T13:39:35 | 63,870,997 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package comte.ui.model.event;
import java.util.EventListener;
/**
* Listener for turn results
*/
public interface TurnResultListener extends EventListener {
/**
* Notify of a new turn result
*
* @param event turn information
*/
void onTurnResult(TurnResultEvent event);
}
| [
"comtef@gmail.com"
] | comtef@gmail.com |
3071a027b9babd09d4105e0973b062e5973850f2 | 73525733c03ca712d201c0e123161ff3889c05c0 | /rabbitmq/src/main/java/com/forezp/rabbitmq/test/Consumer1.java | a7121e9cc580f8683c1c2086f5c76829ff1de70f | [] | no_license | zhoumiaode/SpringCloudConfigTest | b986dc03e3bf1e2c9f37a25f93474e01c29b74ca | adf198f53c87da3f0c383b8911ed0ba81f26791c | refs/heads/master | 2020-04-01T00:49:21.419134 | 2019-10-15T06:29:16 | 2019-10-15T06:29:16 | 152,714,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,606 | java | package com.forezp.rabbitmq.test;
import com.forezp.rabbitmq.util.RabbitMqConnectionUtil;
import com.rabbitmq.client.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;
/**
* @ProjectName: scfchapter6
* @Package: com.forezp.rabbitmq.test
* @ClassName: Consumer
* @Description: java类作用描述
* @Author: zhoumiaode
* @CreateDate: 2018/11/21 13:04
* @UpdateUser: Neil.Zhou
* @UpdateDate: 2018/11/21 13:04
* @UpdateRemark: The modified content
* @Version: 1.0
*/
public class Consumer1 {
public static String Simple_Name="s2";
public static String Simple_Names="exchangess";
public static void main(String[] args) throws IOException, TimeoutException {
Connection connection= RabbitMqConnectionUtil.getConnection("localhost",5672,"guest","guest");
Channel channel=connection.createChannel();
Map<String,Object> map=new HashMap<String, Object>();
map.put("x-message-ttl",20000);
channel.queueDeclare(Simple_Name,false,false,false,map);
channel.exchangeDeclare(Simple_Names,"direct");
channel.queueBind(Simple_Name,Simple_Names,"w");
channel.basicConsume(Simple_Name,false,new DefaultConsumer(channel){
@Override
public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException {
channel.basicAck(envelope.getDeliveryTag(),false);
System.out.println("第二个为:"+new String(body));
}
});
}
}
| [
"1010467470@qq.com"
] | 1010467470@qq.com |
445fec0d1361c2246876ce59774d3a590ccadba7 | 53b2483d5351f6b726bc17e9e812bc9ee63f7bd9 | /src/main/ICollectionTest.java | df0796da3a4ad87cf71a700b350533b1e1fc9cd5 | [
"Unlicense"
] | permissive | drapl-homework/java-homework5 | 20a4df56becfd07b74c85424deeb804ef90c3d3c | d8b5df4468157b93dd4cd2da44b000480bcecb8e | refs/heads/master | 2021-01-10T12:18:41.762337 | 2016-04-11T15:23:55 | 2016-04-11T15:23:55 | 55,897,140 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 172 | java | package main;
import static org.junit.Assert.*;
import org.junit.Test;
public class ICollectionTest {
@Test
public void test() {
fail("Not yet implemented");
}
}
| [
"s.susie123@gmail.com"
] | s.susie123@gmail.com |
6924b14a8edb68f5a5f7122aeb0d3ddae670133c | 26e89fbd9e6423a927912b44daf8f9d6582ebae8 | /src/main/java/com/dao/TestMapper.java | cf7221a801de19d499e4f5fc3e1741daad299a7f | [] | no_license | 321gaojiaming/ssmdemo | 9135cc980deb114dde18d10a48aac153b49a7035 | c922e6bcc9e25f99e2de37cff9ec7efbf7fb946a | refs/heads/master | 2020-03-28T20:33:52.184190 | 2018-09-18T01:23:05 | 2018-09-18T01:23:05 | 149,083,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,243 | java | package com.dao;
import com.entity.Test;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface TestMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_user
*
* @mbggenerated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_user
*
* @mbggenerated
*/
int insert(Test record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_user
*
* @mbggenerated
*/
Test selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_user
*
* @mbggenerated
*/
List<Test> selectAll();
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table t_user
*
* @mbggenerated
*/
int updateByPrimaryKey(Test record);
Test selectUserByUsernameAndPassword(Test record);
} | [
"1026800016@qq.com"
] | 1026800016@qq.com |
afb093963d72acf70b2d85e6cf80e6b0639e7810 | d2b2c559cb3c514346e7b3645f5f7a0036bd1b0f | /Kalkulator/app/src/main/java/com/example/mariolaroznaska/kalkulator/LogicService.java | 22948448dff64115a9ae814f1c860083390472a2 | [] | no_license | RozanskaMariola/Android_home | 5dc19d3124dc7dd19f01597f0791eada15d92a2b | 2f26a62697f618a37622213342d6c1c768964811 | refs/heads/master | 2020-04-16T08:45:18.674207 | 2019-01-12T21:18:32 | 2019-01-12T21:18:32 | 165,436,482 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 418 | java | package com.example.mariolaroznaska.kalkulator;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
public class LogicService extends Service {
public LogicService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
}
| [
"mariolaroznaska@Mariolas-MacBook.local"
] | mariolaroznaska@Mariolas-MacBook.local |
fb167f6cc12580801a8c36a5ff51d3f2e0c1e4b1 | 996ecef192a6798ed8a5c25640569a709cb44126 | /LibAndroid/src/main/java/com/violet/lib/android/event/EventLinearLayout.java | f545be73e1b21b2f43f18294baaedcae48d8a7ed | [] | no_license | VioletGlobal/VioletAndroid | 8032225901cf815c7528272c50d5125daeb9a4fd | bb723a5de6f8414b61e23c04017a56ec6c026462 | refs/heads/master | 2020-03-11T08:16:01.682750 | 2018-09-05T06:41:26 | 2018-09-05T06:41:26 | 129,879,235 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,270 | java | package com.violet.lib.android.event;
import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.LinearLayout;
import com.violet.core.util.LogUtil;
/**
* Created by kan212 on 2018/6/5.
*/
public class EventLinearLayout extends LinearLayout{
public EventLinearLayout(Context context) {
super(context);
}
public EventLinearLayout(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public EventLinearLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
LogUtil.d("EventLinearLayout dispatchTouchEvent " + ev.getAction());
return super.dispatchTouchEvent(ev);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
LogUtil.d("EventLinearLayout onInterceptTouchEvent "+ ev.getAction());
return super.onInterceptTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
LogUtil.d("EventLinearLayout onTouchEvent"+ event.getAction());
return true;
}
}
| [
"yaoyao1@staff.sina.com.cn"
] | yaoyao1@staff.sina.com.cn |
f06f30aba25af7ea2d7d115380edf20474c27b66 | 10fa7f6e09c73a4c7734d36ce8849d944c1aa467 | /app/src/main/java/com/yoshione/fingen/model/SimpleDebt.java | 2af362ac43c1b507fe3d32c741a5df3c26554bbf | [
"Apache-2.0"
] | permissive | kasimms/fingen | 5c486d4c4a88583c759acbb021708fe36ccf7b51 | 1ce78aa7f33411491d490cf4fc34662195193498 | refs/heads/master | 2022-11-29T16:08:49.844145 | 2020-08-13T16:29:42 | 2020-08-13T16:29:42 | 254,844,160 | 0 | 0 | Apache-2.0 | 2020-04-11T10:31:48 | 2020-04-11T10:31:48 | null | UTF-8 | Java | false | false | 4,383 | java | package com.yoshione.fingen.model;
import android.content.ContentValues;
import android.os.Parcel;
import com.yoshione.fingen.DBHelper;
import com.yoshione.fingen.interfaces.IAbstractModel;
import java.math.BigDecimal;
/**
* Created by slv on 13.08.2015.
*
*/
public class SimpleDebt extends BaseModel implements IAbstractModel {
public static final String TAG = "com.yoshione.fingen.Model.SimpleDebt";
// private long mId = -1;
private String mName;
private Boolean mIsActive;
private BigDecimal mStartAmount;//- Я должен, + мне должны
private long mCabbageID;
private BigDecimal mAmount;
private BigDecimal mOweMe;
public BigDecimal getAmount() {
return mAmount;
}
public void setAmount(BigDecimal amount) {
mAmount = amount;
}
public BigDecimal getOweMe() {
return mOweMe;
}
public void setOweMe(BigDecimal oweMe) {
mOweMe = oweMe;
}
public BigDecimal getIOwe() {
return mIOwe;
}
public void setIOwe(BigDecimal IOwe) {
mIOwe = IOwe;
}
private BigDecimal mIOwe;
public SimpleDebt(){
super();
this.mName = "";
this.mIsActive = true;
mStartAmount = BigDecimal.ZERO;
mCabbageID = -1;
}
public SimpleDebt(long id) {
super(id);
}
public SimpleDebt(long id, String name, Boolean isActive, BigDecimal startAmount, long cabbageID) {
super();
setID(id);
mName = name;
mIsActive = isActive;
mStartAmount = startAmount;
mCabbageID = cabbageID;
}
public String getName() {
return mName;
}
public String getFullName() {
return mName;
}
public void setName(String mName) {
this.mName = mName;
}
public Boolean isActive() {
return mIsActive;
}
public void setIsActive(Boolean mIsActive) {
this.mIsActive = mIsActive;
}
public BigDecimal getStartAmount() {
return mStartAmount;
}
public void setStartAmount(BigDecimal startAmount) {
mStartAmount = startAmount;
}
public long getCabbageID() {
return mCabbageID;
}
public void setCabbageID(long cabbageID) {
mCabbageID = cabbageID;
}
@Override
public String toString() {
return mName;
}
@Override
public String getSearchString() {
return mName;
}
@Override
public long getID() {
return super.getID();
}
@Override
public ContentValues getCV() {
ContentValues values = super.getCV();
values.put(DBHelper.C_REF_SIMPLEDEBTS_NAME, mName);
values.put(DBHelper.C_REF_SIMPLEDEBTS_ISACTIVE, mIsActive ? 1 : 0);
values.put(DBHelper.C_REF_SIMPLEDEBTS_START_AMOUNT, mStartAmount.doubleValue());
values.put(DBHelper.C_REF_SIMPLEDEBTS_CABBAGE, mCabbageID);
return values;
}
@Override
public String getLogTransactionsField() {
return DBHelper.C_LOG_TRANSACTIONS_SIMPLEDEBT;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(this.mName);
dest.writeValue(this.mIsActive);
dest.writeSerializable(this.mStartAmount);
dest.writeLong(this.mCabbageID);
dest.writeSerializable(this.mAmount);
dest.writeSerializable(this.mOweMe);
dest.writeSerializable(this.mIOwe);
}
protected SimpleDebt(Parcel in) {
super(in);
this.mName = in.readString();
this.mIsActive = (Boolean) in.readValue(Boolean.class.getClassLoader());
this.mStartAmount = (BigDecimal) in.readSerializable();
this.mCabbageID = in.readLong();
this.mAmount = (BigDecimal) in.readSerializable();
this.mOweMe = (BigDecimal) in.readSerializable();
this.mIOwe = (BigDecimal) in.readSerializable();
}
public static final Creator<SimpleDebt> CREATOR = new Creator<SimpleDebt>() {
@Override
public SimpleDebt createFromParcel(Parcel source) {
return new SimpleDebt(source);
}
@Override
public SimpleDebt[] newArray(int size) {
return new SimpleDebt[size];
}
};
}
| [
"sulevi82@gmail.com"
] | sulevi82@gmail.com |
1a9adc8a5a6aa209cb67519d3c884b51572a4aa9 | 5d83b528dba9b707cf73f3d5a102059da72f8419 | /src/main/org/microsys/core/mapper/HwDao.java | 1dbad582f398c229cc0ffe58a560fb56037952af | [] | no_license | hexianmin-mac/ERPSystem | 43e380539910c552442c98042a70aea678d9d8c2 | 5ba4a64af3ba0cd2f38200898c5c158639f68348 | refs/heads/master | 2020-05-15T22:41:03.098591 | 2019-04-26T14:49:43 | 2019-04-26T14:49:43 | 182,534,109 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package main.org.microsys.core.mapper;
import java.util.List;
import main.org.microsys.core.entity.Hw;
public interface HwDao {
List<Hw> sp(Hw hw);
int spxj(Hw hw);
int xjrk(Hw hw);
int jj(int id);
Hw dy(int id);
int ckkk(Hw hw);
Hw dys(String name);
int updateHw(Hw hw);
}
| [
"15521221434@163.com"
] | 15521221434@163.com |
949f15c8d8626377e075991a0d14f0a7120c7658 | 4961f4c272e8f7470d486075408d9ff6e3180e9f | /jpdftweak/gui/PreviewPanel.java | 87cfd2b295153e2875a0381fb8aaa910121b0677 | [] | no_license | Tz3entch/jpdftweak | b38e981e76a60a510283e975196e92a2ce716a35 | 92778e79c801dc3ea8db034285d6fe8160da6819 | refs/heads/master | 2020-12-24T19:36:23.670638 | 2016-04-21T00:55:55 | 2016-04-21T00:55:55 | 58,152,142 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,767 | java | package jpdftweak.gui;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import javax.swing.JPanel;
import jpdftweak.core.PageDimension;
import jpdftweak.core.ShuffleRule;
public class PreviewPanel extends JPanel {
private float pwidth = 1, pheight = 1;
private ShuffleRule[] rules = new ShuffleRule[0];
public void setConfig(ShuffleRule[] rules) {
this.rules = rules;
repaint();
}
public void setPageFormat(PageDimension dimension) {
pwidth = dimension.getWidth();
pheight = dimension.getHeight();
repaint();
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setFont(new Font("Dialog", Font.PLAIN, 20));
Graphics2D gg = (Graphics2D) g;
int pw = getWidth()-10;
int ph = (int)(pw * pheight / pwidth);
int y = -ph;
for (ShuffleRule sr : rules) {
if (sr.isNewPageBefore()) {
y+=ph+5;
g.setColor(Color.WHITE);
g.fillRect(4, y-1, pw+2, ph+2);
g.setColor(Color.BLACK);
g.drawRect(4, y-1, pw+2, ph+2);
}
AffineTransform oldTransform = gg.getTransform();
g.translate(5, y+ph);
// Begin transform
gg.rotate(Math.toRadians(sr.getRotateAngle()));
double ox = sr.getOffsetX(), oy = sr.getOffsetY();
if (sr.isOffsetXPercent())
ox = ox * pw / 100;
else
ox = ox * pw/pwidth;
if (sr.isOffsetYPercent())
oy = oy * ph /100;
else
oy = oy * ph / pheight;
gg.scale(sr.getScale(), sr.getScale());
gg.translate(ox, -oy);
// End transform
g.setColor(Color.YELLOW);
g.fillRect(0, -ph, pw, ph);
g.setColor(Color.BLUE);
g.drawRect(0, -ph, pw, ph);
g.drawString(sr.getPageString(), 5, -ph+20);
gg.setTransform(oldTransform);
}
}
}
| [
"grayjoy1@gmail.com"
] | grayjoy1@gmail.com |
0d072505cdbf25f2fbc46e2fbda1b0c11af61b41 | 6f7f0f022d0a696c25764f4f046e943dfeade7bc | /test_thread/src/com/fis/task/Task.java | 36497fbfd8b94fbf8b868d7a4db2ead45aa9faf3 | [] | no_license | yxzyh/firstIdeaProject | f6d1879c80dae6123c360a96ee9c850568798d15 | 74a5c21f75642cfbe255f4552319bdfec455bce4 | refs/heads/master | 2021-05-12T06:46:07.373217 | 2018-01-15T09:34:19 | 2018-01-15T09:34:19 | 117,225,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,550 | java | package com.fis.task;
public class Task {
/**
* 1. (多线程)代码实现火车站4个卖票窗口同时买票的场景,输出示例:
窗口1卖票
窗口2卖票
窗口1卖票
...
2. (线程同步)代码实现火车站4个窗口同时卖100张票的代码逻辑,同一个窗口不能卖同一
张张票。
3. (线程通信)小明打算去提款机上取钱,发现卡上没钱,这时候他告知妈妈去存钱,妈妈
存了钱了,告知小明存好了可以取钱了。(PS:小明分多次取钱,每次取100,当发现钱不够
100,就等待妈妈存钱,小明他妈每次存2000,当发现钱小于100就存钱,就存钱,并且
通知小明去取钱,当大于100就等待小明钱不够是再存)
4. (线程同步)设计四个线程对象对同一个数据进行操作,两个线程执行减操作,两个线程执行
加操作。
5. (线程通信)制作两个线程对象,要求用同步块的方式使第一个线程运行2次,然后将自己
阻塞起来,唤醒第二个线程,第二个线程再运行2次,然后将自己阻塞起来,唤醒第一个线
程……两个线程交替执行。
6. (线程同步)设计4个线程,其中两个线程每次对j增加1,另外两个线程对j每次减少1。
7. (线程通信)子线程循环10次,接着主线程循环100,接着又回到子线程循环10次,接着
再回到主线程又循环100,如此循环50次。
*/
}
| [
"892873967@qq.com"
] | 892873967@qq.com |
8ac551d2896d417cf7fee2206784b40ecbb19612 | 1b72958ab7d8749594fd0dca20e3d9e793151b4e | /application-ocps/contentBridge-core/src/main/java/com/ctb/contentBridge/core/publish/hibernate/persist/ItemSetProductCompositeId.java | fd4da500c3fc3e2250eab570200153fc8c7033a0 | [] | no_license | sumit-sardar/GitMigrationRepo01 | d0a89e33d3c7d873fac2dd66a7a5e59fd2b1bc3a | a474889914ea0e9805547ac7f4659c49e1a6b712 | refs/heads/master | 2021-01-17T00:45:16.256869 | 2016-05-12T18:37:01 | 2016-05-12T18:37:01 | 61,346,131 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,199 | java | package com.ctb.contentBridge.core.publish.hibernate.persist;
import java.io.Serializable;
public class ItemSetProductCompositeId implements Serializable {
private Long itemSetId;
private Long productId;
/**
* @hibernate.property
* column="ITEM_SET_ID"
* not-null="true"
*/
public Long getItemSetId() {
return itemSetId;
}
/**
* @hibernate.property
* column="PRODUCT_ID"
* not-null="true"
*/
public Long getProductId() {
return productId;
}
public void setItemSetId(Long itemSetId) {
this.itemSetId = itemSetId;
}
public void setProductId(Long productId) {
this.productId = productId;
}
public int hashCode() {
// TODO: Generated by HibernateGen.rb
return toString().hashCode();
}
public boolean equals(Object object) {
// TODO: Generated by HibernateGen.rb
return toString().equals(object.toString());
}
public String toString() {
// TODO: Generated by HibernateGen.rb
return "" + itemSetId.toString() + "|" + productId.toString();
}
}
| [
""
] | |
01f4f7011709d7da44e8e4b1da886649b97330e7 | 1607da7867f483b3cdd6d097c61a35c285f24303 | /src/main/java/com/ericsson/oss/dao/IOssProblemsDao.java | 511cfe1882d93a7e1e6a85576279e69f9c5e35e9 | [] | no_license | abidarlahcen/OLAI | c7b25c930dbaafbe262d6730e70b185ab553fbc0 | cd091f753a9184513fe9fa70c01368d30bd364e0 | refs/heads/master | 2021-04-29T13:16:44.230906 | 2018-05-22T10:54:34 | 2018-05-22T10:54:34 | 121,747,194 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | package com.ericsson.oss.dao;
import com.ericsson.oss.entites.OssProblems;
public interface IOssProblemsDao extends IGenericDao<OssProblems>{
}
| [
"abidar.lahcen@gmail.com"
] | abidar.lahcen@gmail.com |
6b2f1ee512376ab37059bd1caf12a69a2fae8dbf | 500a7f122972eb6a9f25c902121884836ca80ad4 | /CodeTool/src/Complexity/ControlStructures/CodeIdentifer.java | 4052ff8f218b7b939cb7aefb48c72f383a3f336a | [] | no_license | YasiruPriyadarshana/IT-Project-Management | ed507a05f787477512084fc0cd1a460c4d0c05d6 | b73f414bf3b1a20c12e60fdb28b65091c6301534 | refs/heads/master | 2022-07-02T12:23:11.215650 | 2020-05-09T10:59:37 | 2020-05-09T10:59:37 | 258,094,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,898 | java | package Complexity.ControlStructures;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
public class CodeIdentifer {
private static Set<String> keywords;
private static Set<String> operators;
// for control structures and datatypes
private static Set<String> dataTypes;
private static Set<String> controlStructures;
public static void setKeyword(){
Set<String> s = new HashSet<String>();
// keyword addition
String[] kws = {
// literals
"import", "public","new","return","static","extends",
"class","void","args"
};
for (String kw : kws)
s.add(kw);
keywords = Collections.unmodifiableSet(s);
}
public static boolean isKeyword(String keyword){
setKeyword();
return (keywords.contains(keyword));
}
// public static boolean isKeywordandDataType(String keyword){
// setKeyword();
// setDataTypes();
// return (keywords.contains())
// }
public static void setOperators(){
Set<String> op = new HashSet<String>();
String[] ops =
{"+", "-", "*", "/", "%", "++", "--",
"==", "!=", ">", "<", ">=", "<=",
"&&", "||", "!", "|", "^", "~"
, "<<", ">>", ">>>", "<<<",
",", "->", ".", "::",
"+=", "-=", "*=", "/=", "=", ">>>=",
"|=", "&=", "%=", "<<=", ">>=", "^="
};
for (String o : ops)
op.add(o);
operators = Collections.unmodifiableSet(op);
}
public static boolean isOperator(String operator){
setOperators();
return operators.contains(operator);
}
public static void setDataTypes(){
Set<String> ns = new HashSet<String>();
String[] nkws = {
"boolean", "char", "byte", "short", "int", "long", "float" , "double","String","Integer"
};
for (String nkw : nkws)
ns.add(nkw);
dataTypes = Collections.unmodifiableSet(ns);
}
public static void setControlStructures(){
Set<String> s = new HashSet<String>();
String[] nkws = {
"if","else","for","while","break","switch","case"
};
for (String nkw : nkws)
s.add(nkw);
controlStructures = Collections.unmodifiableSet(s);
}
public static boolean isControlStructure(String keyword){
setControlStructures();
return controlStructures.contains(keyword);
}
public static boolean isDataType(String keyword) {
setDataTypes();
return dataTypes.contains(keyword);
}
}
| [
"Yasiru Priyadarshana@DESKTOP-V9RBE98"
] | Yasiru Priyadarshana@DESKTOP-V9RBE98 |
45e8c40e8fd9ae3ea7ad57f3928c4337475a0ca7 | 03757edf03027f2096113e0b2daab7a3c5894c50 | /src/main/java/app19a/controller/BookController.java | c3dd16d80141be81fb42ea921b66e0772f9481e9 | [] | no_license | AlexHu66/app19a | 2e51485a21847b50d81f9aa81fabe650f4783013 | 3f96bd0f83bd1f7a35ad0f2859e1b8e9ce946713 | refs/heads/master | 2021-09-02T09:15:42.030641 | 2018-01-01T10:28:46 | 2018-01-01T10:28:46 | 115,912,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,046 | java | package app19a.controller;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import app19a.domain.Book;
import app19a.domain.Category;
import app19a.service.BookService;
@Controller
public class BookController {
@Autowired
private BookService bookService;
private static final Log logger = LogFactory.getLog(BookController.class);
@RequestMapping(value="/book_input")
public String inputBook(Model model){
List<Category> categories = bookService.getAllcategories();
model.addAttribute("categories", categories);
model.addAttribute("book", new Book());
return "BookAddForm";
}
@RequestMapping(value="/book_edit/{id}")
public String editBook(Model model, @PathVariable long id){
List<Category> categories = bookService.getAllcategories();
model.addAttribute("categories", categories);
Book book = bookService.get(id);
model.addAttribute("book", book);
return "BookEditForm";
}
@RequestMapping(value="/book_save")
public String saveBook(@ModelAttribute Book book){
Category category = bookService.getCategory(book.getCategory().getId());
book.setCategory(category);
bookService.save(book);
return "redirect:/book_list";
}
@RequestMapping(value="/book_update")
public String updateBook(@ModelAttribute Book book){
Category category = bookService.getCategory(book.getCategory().getId());
book.setCategory(category);
bookService.update(book);
return "redirect:/book_list";
}
@RequestMapping(value="/book_list")
public String listBooks(Model model){
logger.info("book_list");
List<Book> books = bookService.getAllBooks();
model.addAttribute("books", books);
return "BookList";
}
}
| [
"direc.fu@gmail.com"
] | direc.fu@gmail.com |
8bedda8e630438f069fe220f59eec70c99124baf | de752b1dab1d9ed20c44e30ffa1ff887b868d2b0 | /user/user-server/src/main/java/com/gapache/user/server/dao/repository/UserRepository.java | 307f115afd3f9ea110e391bbc799224b56481ee9 | [] | no_license | KeKeKuKi/IACAA30 | 33fc99ba3f1343240fe3fafe82bee01339273b80 | 6f3f6091b2ca6dd92f22b1697c0fbfc7b9b7d371 | refs/heads/main | 2023-04-07T21:18:49.105964 | 2021-04-08T08:41:57 | 2021-04-08T08:41:57 | 352,832,814 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package com.gapache.user.server.dao.repository;
import com.gapache.jpa.BaseJpaRepository;
import com.gapache.user.server.dao.entity.UserEntity;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
/**
* @author HuSen
* @since 2020/9/8 11:29 上午
*/
public interface UserRepository extends BaseJpaRepository<UserEntity, Long>, JpaSpecificationExecutor<UserEntity> {
boolean existsByUsername(String username);
UserEntity findByUsername(String username);
}
| [
"2669918628@qq.com"
] | 2669918628@qq.com |
f1968bcd6f09b363317d62d796b350de2ef38b1d | 8609976e42491c0f6efbb9b3bf082a9b204b2f73 | /src/cn/itcast/shop/categorysecond/dao/CategorySecondDao.java | 2ebb6abce33a3ecf497b45a70cf52d624563d8da | [] | no_license | liyongchang/shop | c4e206fdd77c08d90ec5952e299fc1ed456466bf | d785a5f3bdfcb76ae53000bb3ea3d25b017d4801 | refs/heads/master | 2021-01-19T04:34:39.512576 | 2016-07-11T07:34:21 | 2016-07-11T07:34:21 | 63,044,881 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,785 | java | package cn.itcast.shop.categorysecond.dao;
import cn.itcast.shop.categorysecond.vo.CategorySecond;
import cn.itcast.shop.utils.PageHibernateCallback;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import java.util.List;
/**
* 二级分类的Dao层的代码
*
* @author 传智.郭嘉
*
*/
public class CategorySecondDao extends HibernateDaoSupport {
// DAO中的统计二级分类个数的方法
public int findCount() {
String hql = "select count(*) from CategorySecond";
List<Long> list = this.getHibernateTemplate().find(hql);
if (list != null && list.size() > 0) {
return list.get(0).intValue();
}
return 0;
}
// DAO中分页查询的方法
public List<CategorySecond> findByPage(int begin, int limit) {
String hql = "from CategorySecond order by csid desc";
List<CategorySecond> list = this.getHibernateTemplate().execute(
new PageHibernateCallback<CategorySecond>(hql, null, begin,
limit));
return list;
}
// DAO中的保存二级分类的方法
public void save(CategorySecond categorySecond) {
this.getHibernateTemplate().save(categorySecond);
}
// DAO中的删除二级分类的方法
public void delete(CategorySecond categorySecond) {
this.getHibernateTemplate().delete(categorySecond);
}
// DAO中根据id查询二级分类的方法
public CategorySecond findByCsid(Integer csid) {
return this.getHibernateTemplate().get(CategorySecond.class, csid);
}
// DAO中的修改二级分类的方法
public void update(CategorySecond categorySecond) {
this.getHibernateTemplate().update(categorySecond);
}
// DAO中的查询所有二级分类的方法
public List<CategorySecond> findAll() {
String hql = "from CategorySecond";
return this.getHibernateTemplate().find(hql);
}
}
| [
"995849945@qq.com"
] | 995849945@qq.com |
fbcfcb73e4f13e700015c707e35cfe770c7d2f41 | e7c75550524f50a404cc6fa30fa72d67f71af420 | /ConcesionarioCoches/ConcesionarioCoches/utiles/Teclado.java | 3cf1266025e6a0c40fbbf6d2b7c35fecca7e3e1e | [] | no_license | DavidPeralvo/Concesionario-de-Coches | 98a352f60e31de65484a6d8246ca0fd4c1605977 | 29fecfbc873a8ea82afbfed4465b768a4728315a | refs/heads/master | 2020-06-01T13:38:11.990692 | 2015-05-17T17:45:08 | 2015-05-17T17:45:08 | 35,773,001 | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 2,290 | java | package utiles;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/**
* Permite lectura desde teclado
*/
public class Teclado {
/**
* Lee un carácter del teclado
*
* @return carácter introducido por el usuario
*/
public static char leerCaracter() {
char caracter;
try {
caracter = leerCadena().charAt(0);
} catch (Exception e) {
caracter = 0;
}
return caracter;
}
/**
* Lee un carácter del teclado
*
* @param msj
* mensaje mostrado al usuario
* @return carácter introducido por el usuario
*/
public static char leerCaracter(String msj) {
System.out.println(msj);
return leerCaracter();
}
/**
* Lee una cadena del teclado
*
* @param msj
* mensaje mostrado al usuario
* @return cadena introducida por el usuario
*/
public static String leerCadena(String msj) {
System.out.println(msj);
return leerCadena();
}
/**
* Lee una cadena del teclado
*
* @return cadena introducida por el usuario
*/
public static String leerCadena() {
BufferedReader bReader = new BufferedReader(new InputStreamReader(
System.in));
String cadena;
try {
cadena = bReader.readLine();
} catch (Exception e) {
cadena = "";
}
return cadena;
}
/**
* Lee un entero del teclado
*
*
* @return entero introducido por el usuario
*/
public static int leerEntero() {
int x;
try {
x = Integer.parseInt(leerCadena().trim());
} catch (Exception e) {
x = 0;
}
return x;
}
/**
* Lee una entero del teclado
*
* @param msj
* mensaje mostrado al usuario
* @return entero introducida por el usuario
*/
public static int leerEntero(String msj) {
System.out.println(msj);
return leerEntero();
}
/**
* Lee un decimal del teclado
*
* @return decimal introducido por el usuario
*/
public static double leerDecimal() {
double x;
try {
x = Double.parseDouble(leerCadena().trim());
} catch (Exception e) {
x = 0;
}
return x;
}
/**
* Lee una decimal del teclado
*
* @param msj
* mensaje mostrado al usuario
* @return decimal introducida por el usuario
*/
public static double leerDecimal(String msj) {
System.out.println(msj);
return leerDecimal();
}
}
| [
"davidperalvo@gmail.com"
] | davidperalvo@gmail.com |
bb219d772063e1933d640a1a150f25699666e97d | 4479a44d222573148b2c37ca980bc0ccbc5c7e07 | /src/Request_Message.java | ef442621cedcadb96138ad9622bff71e26a9404c | [] | no_license | BSJAIN92/IN4150_2 | ffd9c8b1f586742c6b15883461275caf08678d61 | 38778fe15f1f38e2ddc1f5228c80c6009690de3a | refs/heads/master | 2021-08-22T19:48:51.654857 | 2017-12-01T04:26:22 | 2017-12-01T04:26:22 | 112,664,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 719 | java |
import java.io.Serializable;
public class Request_Message implements Serializable {
/*
* source url
*/
private String sourceUrl;
/*
* index of source server
*/
private int sourceServerIndex;
/*
* clock of source server
*/
private int sourceClock;
/*
* Default Constructor
*/
public Request_Message(String sourceUrl, int sourceServerIndex, int sourceClock) {
this.sourceUrl = sourceUrl;
this.sourceServerIndex = sourceServerIndex;
this.sourceClock = sourceClock;
}
public String getSourceUrl() {
return this.sourceUrl;
}
public int getSourceServerIndex() {
return this.sourceServerIndex;
}
public int getSourceClock() {
return this.sourceClock;
}
}
| [
"contact.jain.bhavya@gmail.com"
] | contact.jain.bhavya@gmail.com |
a1d6dfed9a4575c59a105fe84b286db16594b9c6 | 4fe106927ff1bf6274b61c1a1ec00671514c5ce3 | /src/com/chinasofti/util/jdbc/template/specialsqloperation/OracleSpecialOperation.java | 3f5d654436aecdb2dd4a0e9f6f1e44b407c34791 | [] | no_license | Cass-D/OrderSys | e96438a91ff600a15413b6613c91880e171e3ffa | ce95719a4d1366cb3beb35402beb6c312dd04195 | refs/heads/master | 2021-01-20T15:50:50.274821 | 2016-08-06T14:17:04 | 2016-08-06T14:17:04 | 65,085,832 | 1 | 0 | null | null | null | null | GB18030 | Java | false | false | 3,413 | java | /**
* Copyright 2015 ChinaSoft International Ltd. All rights reserved.
*/
package com.chinasofti.util.jdbc.template.specialsqloperation;
import java.sql.PreparedStatement;
/**
* <p>
* Title: OracleSpecialOperation
* </p>
* <p>
* Description:Oracle数据库特定操作抽象
* </p>
* <p>
* Copyright: Copyright (c) 2015
* </p>
* <p>
* Company: ChinaSoft International Ltd.
* </p>
*
* @author etc
* @version 1.0
*/
public class OracleSpecialOperation extends SpecialSQLOperation {
/**
* 获取特定TopN操作SQL语句的方法
*
* @param initialSQL
* 初始化SQL语句
* @param hasOffset
* 是否支持offSet操作
* @return 获取到的特定TopN操作语句
* */
@Override
public String getTopNSQL(String initialSQL, boolean hasOffset) {
// TODO Auto-generated method stub
// 移出初始化SQL语句前后的无用空白
initialSQL = initialSQL.trim();
// 初始化SQL语句中是否有for update子句
boolean isForUpdate = false;
// 判定初始化SQL语句中是否有for update子句
if (initialSQL.toLowerCase().endsWith(" for update")) {
// 删除for update子句
initialSQL = initialSQL.substring(0, initialSQL.length() - 11);
// 保存for update子句状态
isForUpdate = true;
}
// 创建目标SQL语句字符串缓冲区
StringBuffer pagingSelect = new StringBuffer(initialSQL.length() + 200);
// 如果有offSet信息
if (hasOffset) {
// 添加rownum伪列信息
pagingSelect
.append("select * from ( select row_.*, rownum rownum_ from ( ");
// 如果没有offset信息
} else {
// 直接查询目标表格
pagingSelect.append("select * from ( ");
}
// 将初始化查询作为临时视图查询目标
pagingSelect.append(initialSQL);
// 如果有offset
if (hasOffset) {
// 添加offset条件
pagingSelect.append(" ) row_ where rownum <= ?) where rownum_ > ?");
// 如果没有offset
} else {
// 只规定查询的最大条目数
pagingSelect.append(" ) where rownum <= ?");
}
// 如果存在for update子句
if (isForUpdate) {
// 补全for update子句
pagingSelect.append(" for update");
}
// 返回结果SQL语句
return pagingSelect.toString();
}
/**
* 设置TopN查询操作特殊参数信息
*
* @param topNStatement
* 预编译语句对象
* @param args
* 查询语句对应的参数
* @param offset
* 查询的offset值
* @param size
* 单次查询返回的最大条目值
* @return 设置参数后的预编译语句对象
* */
@Override
public PreparedStatement setTopNQueryParameter(
PreparedStatement topNStatement, Object[] args, int offset, int size) {
// TODO Auto-generated method stub
// 尝试设置参数
try {
// 遍历参数值
for (int i = 0; i < args.length; i++) {
// 为相应的占位符设置对应的值
topNStatement.setObject(i + 1, args[i]);
}
// 设置每页最大条目数参数
topNStatement.setObject(args.length + 1, size + size);
// 设置offset参数
topNStatement.setObject(args.length + 2, offset);
// TODO Auto-generated method stub
// 返回设置参数后的预编译语句对象
return topNStatement;
// 捕获异常
} catch (Exception e) {
// 输出异常信息
e.printStackTrace();
// 返回null
return null;
// TODO: handle exception
}
}
}
| [
"1790887746@qq.com"
] | 1790887746@qq.com |
91c84c4d9e081bd90ac14aa079455c39c888a71d | fcb7aa3d72ae4ec05aa8a27a75a2a22b2edaced3 | /src/java/org/apache/cassandra/db/CompactionManager.java | 50c1ff508575ce17e66cb08c6b126f73ba8f568b | [
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | HyczZhu/dtcassandra | 0f2d7f63a5ccd9f0c3bea6659a686faa7c6e4a2c | abb8c73828ae94eaf8bd1be7f5c5bb7c9b6bec71 | refs/heads/master | 2021-01-17T16:51:18.873739 | 2012-12-16T17:13:27 | 2012-12-16T17:13:27 | 32,314,162 | 0 | 1 | Apache-2.0 | 2023-03-20T11:52:23 | 2015-03-16T09:27:31 | Java | UTF-8 | Java | false | false | 56,646 | java | /**
* 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.cassandra.db;
import java.io.DataOutput;
import java.io.File;
import java.io.IOError;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.nio.ByteBuffer;
import java.security.MessageDigest;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.apache.commons.collections.PredicateUtils;
import org.apache.commons.collections.iterators.CollatingIterator;
import org.apache.commons.collections.iterators.FilterIterator;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.cassandra.cache.AutoSavingCache;
import org.apache.cassandra.concurrent.DebuggableThreadPoolExecutor;
import org.apache.cassandra.concurrent.NamedThreadFactory;
import org.apache.cassandra.config.DatabaseDescriptor;
import org.apache.cassandra.dht.Range;
import org.apache.cassandra.io.*;
import org.apache.cassandra.io.sstable.*;
import org.apache.cassandra.io.util.BufferedRandomAccessFile;
import org.apache.cassandra.io.util.FileUtils;
import org.apache.cassandra.service.AntiEntropyService;
import org.apache.cassandra.service.StorageService;
import org.apache.cassandra.streaming.OperationType;
import org.apache.cassandra.utils.ByteBufferUtil;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.NodeId;
import org.apache.cassandra.utils.Pair;
import org.apache.cassandra.utils.WrappedRunnable;
import org.cliffc.high_scale_lib.NonBlockingHashMap;
/**
* A singleton which manages a private executor of ongoing compactions. A readwrite lock
* controls whether compactions can proceed: an external consumer can completely stop
* compactions by acquiring the write half of the lock via getCompactionLock().
*
* Scheduling for compaction is accomplished by swapping sstables to be compacted into
* a set via DataTracker. New scheduling attempts will ignore currently compacting
* sstables.
*/
public class CompactionManager implements CompactionManagerMBean
{
public static final String MBEAN_OBJECT_NAME = "org.apache.cassandra.db:type=CompactionManager";
private static final Logger logger = LoggerFactory.getLogger(CompactionManager.class);
public static final CompactionManager instance;
// acquire as read to perform a compaction, and as write to prevent compactions
private final ReentrantReadWriteLock compactionLock = new ReentrantReadWriteLock();
static
{
instance = new CompactionManager();
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
try
{
mbs.registerMBean(instance, new ObjectName(MBEAN_OBJECT_NAME));
}
catch (Exception e)
{
throw new RuntimeException(e);
}
}
private CompactionExecutor executor = new CompactionExecutor();
private Map<ColumnFamilyStore, Integer> estimatedCompactions = new NonBlockingHashMap<ColumnFamilyStore, Integer>();
/**
* @return A lock, for which acquisition means no compactions can run.
*/
public Lock getCompactionLock()
{
return compactionLock.writeLock();
}
/**
* Call this whenever a compaction might be needed on the given columnfamily.
* It's okay to over-call (within reason) since the compactions are single-threaded,
* and if a call is unnecessary, it will just be no-oped in the bucketing phase.
*/
public Future<Integer> submitMinorIfNeeded(final ColumnFamilyStore cfs)
{
Callable<Integer> callable = new Callable<Integer>()
{
public Integer call() throws IOException
{
compactionLock.readLock().lock();
try
{
if (cfs.isInvalid())
return 0;
Integer minThreshold = cfs.getMinimumCompactionThreshold();
Integer maxThreshold = cfs.getMaximumCompactionThreshold();
if (minThreshold == 0 || maxThreshold == 0)
{
logger.debug("Compaction is currently disabled.");
return 0;
}
logger.debug("Checking to see if compaction of " + cfs.columnFamily + " would be useful");
Set<List<SSTableReader>> buckets = getBuckets(convertSSTablesToPairs(cfs.getSSTables()), 50L * 1024L * 1024L);
updateEstimateFor(cfs, buckets);
int gcBefore = cfs.isIndex() ? Integer.MAX_VALUE : getDefaultGcBefore(cfs);
for (List<SSTableReader> sstables : buckets)
{
if (sstables.size() < minThreshold)
continue;
// if we have too many to compact all at once, compact older ones first -- this avoids
// re-compacting files we just created.
Collections.sort(sstables);
Collection<SSTableReader> tocompact = cfs.getDataTracker().markCompacting(sstables, minThreshold, maxThreshold);
if (tocompact == null)
// enough threads are busy in this bucket
continue;
try
{
return doCompaction(cfs, tocompact, gcBefore);
}
finally
{
cfs.getDataTracker().unmarkCompacting(tocompact);
}
}
}
finally
{
compactionLock.readLock().unlock();
}
return 0;
}
};
return executor.submit(callable);
}
private void updateEstimateFor(ColumnFamilyStore cfs, Set<List<SSTableReader>> buckets)
{
Integer minThreshold = cfs.getMinimumCompactionThreshold();
Integer maxThreshold = cfs.getMaximumCompactionThreshold();
if (minThreshold > 0 && maxThreshold > 0)
{
int n = 0;
for (List<SSTableReader> sstables : buckets)
{
if (sstables.size() >= minThreshold)
{
n += Math.ceil((double)sstables.size() / maxThreshold);
}
}
estimatedCompactions.put(cfs, n);
}
else
{
logger.debug("Compaction is currently disabled.");
}
}
public void performCleanup(final ColumnFamilyStore cfStore, final NodeId.OneShotRenewer renewer) throws InterruptedException, ExecutionException
{
Callable<Object> runnable = new Callable<Object>()
{
public Object call() throws IOException
{
// acquire the write lock to schedule all sstables
compactionLock.writeLock().lock();
try
{
if (cfStore.isInvalid())
return this;
Collection<SSTableReader> tocleanup = cfStore.getDataTracker().markCompacting(cfStore.getSSTables(), 1, Integer.MAX_VALUE);
if (tocleanup == null || tocleanup.isEmpty())
return this;
try
{
// downgrade the lock acquisition
compactionLock.readLock().lock();
compactionLock.writeLock().unlock();
try
{
doCleanupCompaction(cfStore, tocleanup, renewer);
}
finally
{
compactionLock.readLock().unlock();
}
}
finally
{
cfStore.getDataTracker().unmarkCompacting(tocleanup);
}
return this;
}
finally
{
// we probably already downgraded
if (compactionLock.writeLock().isHeldByCurrentThread())
compactionLock.writeLock().unlock();
}
}
};
executor.submit(runnable).get();
}
public void performScrub(final ColumnFamilyStore cfStore) throws InterruptedException, ExecutionException
{
Callable<Object> runnable = new Callable<Object>()
{
public Object call() throws IOException
{
// acquire the write lock to schedule all sstables
compactionLock.writeLock().lock();
try
{
if (cfStore.isInvalid())
return this;
Collection<SSTableReader> toscrub = cfStore.getDataTracker().markCompacting(cfStore.getSSTables(), 1, Integer.MAX_VALUE);
if (toscrub == null || toscrub.isEmpty())
return this;
try
{
// downgrade the lock acquisition
compactionLock.readLock().lock();
compactionLock.writeLock().unlock();
try
{
doScrub(cfStore, toscrub);
}
finally
{
compactionLock.readLock().unlock();
}
}
finally
{
cfStore.getDataTracker().unmarkCompacting(toscrub);
}
return this;
}
finally
{
// we probably already downgraded
if (compactionLock.writeLock().isHeldByCurrentThread())
compactionLock.writeLock().unlock();
}
}
};
executor.submit(runnable).get();
}
public void performMajor(final ColumnFamilyStore cfStore) throws InterruptedException, ExecutionException
{
submitMajor(cfStore, 0, getDefaultGcBefore(cfStore)).get();
}
public Future<Object> submitMajor(final ColumnFamilyStore cfStore, final long skip, final int gcBefore)
{
Callable<Object> callable = new Callable<Object>()
{
public Object call() throws IOException
{
// acquire the write lock long enough to schedule all sstables
compactionLock.writeLock().lock();
try
{
if (cfStore.isInvalid())
return this;
Collection<SSTableReader> sstables;
if (skip > 0)
{
sstables = new ArrayList<SSTableReader>();
for (SSTableReader sstable : cfStore.getSSTables())
{
if (sstable.length() < skip * 1024L * 1024L * 1024L)
{
sstables.add(sstable);
}
}
}
else
{
sstables = cfStore.getSSTables();
}
Collection<SSTableReader> tocompact = cfStore.getDataTracker().markCompacting(sstables, 0, Integer.MAX_VALUE);
if (tocompact == null || tocompact.isEmpty())
return this;
try
{
// downgrade the lock acquisition
compactionLock.readLock().lock();
compactionLock.writeLock().unlock();
try
{
doCompaction(cfStore, tocompact, gcBefore);
}
finally
{
compactionLock.readLock().unlock();
}
}
finally
{
cfStore.getDataTracker().unmarkCompacting(tocompact);
}
return this;
}
finally
{
// we probably already downgraded
if (compactionLock.writeLock().isHeldByCurrentThread())
compactionLock.writeLock().unlock();
}
}
};
return executor.submit(callable);
}
public void forceUserDefinedCompaction(String ksname, String dataFiles)
{
if (!DatabaseDescriptor.getTables().contains(ksname))
throw new IllegalArgumentException("Unknown keyspace " + ksname);
File directory = new File(ksname);
String[] filenames = dataFiles.split(",");
Collection<Descriptor> descriptors = new ArrayList<Descriptor>(filenames.length);
String cfname = null;
for (String filename : filenames)
{
Pair<Descriptor, String> p = Descriptor.fromFilename(directory, filename.trim());
if (!p.right.equals(Component.DATA.name()))
{
throw new IllegalArgumentException(filename + " does not appear to be a data file");
}
if (cfname == null)
{
cfname = p.left.cfname;
}
else if (!cfname.equals(p.left.cfname))
{
throw new IllegalArgumentException("All provided sstables should be for the same column family");
}
descriptors.add(p.left);
}
ColumnFamilyStore cfs = Table.open(ksname).getColumnFamilyStore(cfname);
submitUserDefined(cfs, descriptors, getDefaultGcBefore(cfs));
}
public Future<Object> submitUserDefined(final ColumnFamilyStore cfs, final Collection<Descriptor> dataFiles, final int gcBefore)
{
Callable<Object> callable = new Callable<Object>()
{
public Object call() throws IOException
{
compactionLock.readLock().lock();
try
{
if (cfs.isInvalid())
return this;
// look up the sstables now that we're on the compaction executor, so we don't try to re-compact
// something that was already being compacted earlier.
Collection<SSTableReader> sstables = new ArrayList<SSTableReader>();
for (Descriptor desc : dataFiles)
{
// inefficient but not in a performance sensitive path
SSTableReader sstable = lookupSSTable(cfs, desc);
if (sstable == null)
{
logger.info("Will not compact {}: it is not an active sstable", desc);
}
else
{
sstables.add(sstable);
}
}
if (sstables.isEmpty())
{
logger.error("No file to compact for user defined compaction");
}
// attempt to schedule the set
else if ((sstables = cfs.getDataTracker().markCompacting(sstables, 1, Integer.MAX_VALUE)) != null)
{
String location = cfs.table.getDataFileLocation(1);
// success: perform the compaction
try
{
doCompactionWithoutSizeEstimation(cfs, sstables, gcBefore, location);
}
finally
{
cfs.getDataTracker().unmarkCompacting(sstables);
}
}
else
{
logger.error("SSTables for user defined compaction are already being compacted.");
}
return this;
}
finally
{
compactionLock.readLock().unlock();
}
}
};
return executor.submit(callable);
}
private SSTableReader lookupSSTable(final ColumnFamilyStore cfs, Descriptor descriptor)
{
for (SSTableReader sstable : cfs.getSSTables())
{
// .equals() with no other changes won't work because in sstable.descriptor, the directory is an absolute path.
// We could construct descriptor with an absolute path too but I haven't found any satisfying way to do that
// (DB.getDataFileLocationForTable() may not return the right path if you have multiple volumes). Hence the
// endsWith.
if (sstable.descriptor.toString().endsWith(descriptor.toString()))
return sstable;
}
return null;
}
/**
* Does not mutate data, so is not scheduled.
*/
public Future<Object> submitValidation(final ColumnFamilyStore cfStore, final AntiEntropyService.Validator validator)
{
Callable<Object> callable = new Callable<Object>()
{
public Object call() throws IOException
{
compactionLock.readLock().lock();
try
{
if (!cfStore.isInvalid())
doValidationCompaction(cfStore, validator);
return this;
}
finally
{
compactionLock.readLock().unlock();
}
}
};
return executor.submit(callable);
}
/* Used in tests. */
public void disableAutoCompaction()
{
for (String ksname : DatabaseDescriptor.getNonSystemTables())
{
for (ColumnFamilyStore cfs : Table.open(ksname).getColumnFamilyStores())
cfs.disableAutoCompaction();
}
}
int doCompaction(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, int gcBefore) throws IOException
{
Table table = cfs.table;
// If the compaction file path is null that means we have no space left for this compaction.
// try again w/o the largest one.
Set<SSTableReader> smallerSSTables = new HashSet<SSTableReader>(sstables);
while (smallerSSTables.size() > 1)
{
String compactionFileLocation = table.getDataFileLocation(cfs.getExpectedCompactedFileSize(smallerSSTables));
if (compactionFileLocation != null)
return doCompactionWithoutSizeEstimation(cfs, smallerSSTables, gcBefore, compactionFileLocation);
logger.warn("insufficient space to compact all requested files " + StringUtils.join(smallerSSTables, ", "));
smallerSSTables.remove(cfs.getMaxSizeFile(smallerSSTables));
}
logger.error("insufficient space to compact even the two smallest files, aborting");
return 0;
}
/**
* For internal use and testing only. The rest of the system should go through the submit* methods,
* which are properly serialized.
*/
int doCompactionWithoutSizeEstimation(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, int gcBefore, String compactionFileLocation) throws IOException
{
// The collection of sstables passed may be empty (but not null); even if
// it is not empty, it may compact down to nothing if all rows are deleted.
assert sstables != null;
Table table = cfs.table;
if (DatabaseDescriptor.isSnapshotBeforeCompaction())
table.snapshot(System.currentTimeMillis() + "-" + "compact-" + cfs.columnFamily);
// sanity check: all sstables must belong to the same cfs
for (SSTableReader sstable : sstables)
assert sstable.descriptor.cfname.equals(cfs.columnFamily);
// new sstables from flush can be added during a compaction, but only the compaction can remove them,
// so in our single-threaded compaction world this is a valid way of determining if we're compacting
// all the sstables (that existed when we started)
boolean major = cfs.isCompleteSSTables(sstables);
CompactionType type = major
? CompactionType.MAJOR
: CompactionType.MINOR;
logger.info("Compacting {}: {}", type, sstables);
long startTime = System.currentTimeMillis();
long totalkeysWritten = 0;
// TODO the int cast here is potentially buggy
int expectedBloomFilterSize = Math.max(DatabaseDescriptor.getIndexInterval(), (int)SSTableReader.getApproximateKeyCount(sstables));
if (logger.isDebugEnabled())
logger.debug("Expected bloom filter size : " + expectedBloomFilterSize);
SSTableWriter writer;
CompactionController controller = new CompactionController(cfs, sstables, major, gcBefore, false);
CompactionIterator ci = new CompactionIterator(type, sstables, controller); // retain a handle so we can call close()
Iterator<AbstractCompactedRow> nni = new FilterIterator(ci, PredicateUtils.notNullPredicate());
Map<DecoratedKey, Long> cachedKeys = new HashMap<DecoratedKey, Long>();
executor.beginCompaction(ci);
try
{
if (!nni.hasNext())
{
// don't mark compacted in the finally block, since if there _is_ nondeleted data,
// we need to sync it (via closeAndOpen) first, so there is no period during which
// a crash could cause data loss.
cfs.markCompacted(sstables);
return 0;
}
writer = cfs.createCompactionWriter(expectedBloomFilterSize, compactionFileLocation, sstables);
while (nni.hasNext())
{
AbstractCompactedRow row = nni.next();
long position = writer.append(row);
totalkeysWritten++;
if (DatabaseDescriptor.getPreheatKeyCache())
{
for (SSTableReader sstable : sstables)
{
if (sstable.getCachedPosition(row.key) != null)
{
cachedKeys.put(row.key, position);
break;
}
}
}
}
}
finally
{
ci.close();
executor.finishCompaction(ci);
}
SSTableReader ssTable = writer.closeAndOpenReader(getMaxDataAge(sstables));
cfs.replaceCompactedSSTables(sstables, Arrays.asList(ssTable));
for (Entry<DecoratedKey, Long> entry : cachedKeys.entrySet()) // empty if preheat is off
ssTable.cacheKey(entry.getKey(), entry.getValue());
submitMinorIfNeeded(cfs);
long dTime = System.currentTimeMillis() - startTime;
long startsize = SSTable.getTotalBytes(sstables);
long endsize = ssTable.length();
double ratio = (double)endsize / (double)startsize;
logger.info(String.format("Compacted to %s. %,d to %,d (~%d%% of original) bytes for %,d keys. Time: %,dms.",
writer.getFilename(), startsize, endsize, (int) (ratio * 100), totalkeysWritten, dTime));
return sstables.size();
}
private static long getMaxDataAge(Collection<SSTableReader> sstables)
{
long max = 0;
for (SSTableReader sstable : sstables)
{
if (sstable.maxDataAge > max)
max = sstable.maxDataAge;
}
return max;
}
/**
* Deserialize everything in the CFS and re-serialize w/ the newest version. Also attempts to recover
* from bogus row keys / sizes using data from the index, and skips rows with garbage columns that resulted
* from early ByteBuffer bugs.
*
* @throws IOException
*/
private void doScrub(ColumnFamilyStore cfs, Collection<SSTableReader> sstables) throws IOException
{
assert !cfs.isIndex();
for (final SSTableReader sstable : sstables)
{
logger.info("Scrubbing " + sstable);
// Calculate the expected compacted filesize
String compactionFileLocation = cfs.table.getDataFileLocation(sstable.length());
if (compactionFileLocation == null)
throw new IOException("disk full");
int expectedBloomFilterSize = Math.max(DatabaseDescriptor.getIndexInterval(),
(int)(SSTableReader.getApproximateKeyCount(Arrays.asList(sstable))));
// loop through each row, deserializing to check for damage.
// we'll also loop through the index at the same time, using the position from the index to recover if the
// row header (key or data size) is corrupt. (This means our position in the index file will be one row
// "ahead" of the data file.)
final BufferedRandomAccessFile dataFile = BufferedRandomAccessFile.getUncachingReader(sstable.getFilename());
String indexFilename = sstable.descriptor.filenameFor(Component.PRIMARY_INDEX);
BufferedRandomAccessFile indexFile = BufferedRandomAccessFile.getUncachingReader(indexFilename);
ByteBuffer nextIndexKey = ByteBufferUtil.readWithShortLength(indexFile);
{
// throw away variable so we don't have a side effect in the assert
long firstRowPositionFromIndex = indexFile.readLong();
assert firstRowPositionFromIndex == 0 : firstRowPositionFromIndex;
}
SSTableWriter writer = maybeCreateWriter(cfs, compactionFileLocation, expectedBloomFilterSize, null, Collections.singletonList(sstable));
executor.beginCompaction(new ScrubInfo(dataFile, sstable));
int goodRows = 0, badRows = 0, emptyRows = 0;
while (!dataFile.isEOF())
{
long rowStart = dataFile.getFilePointer();
if (logger.isDebugEnabled())
logger.debug("Reading row at " + rowStart);
DecoratedKey key = null;
long dataSize = -1;
try
{
key = SSTableReader.decodeKey(sstable.partitioner, sstable.descriptor, ByteBufferUtil.readWithShortLength(dataFile));
dataSize = sstable.descriptor.hasIntRowSize ? dataFile.readInt() : dataFile.readLong();
if (logger.isDebugEnabled())
logger.debug(String.format("row %s is %s bytes", ByteBufferUtil.bytesToHex(key.key), dataSize));
}
catch (Throwable th)
{
throwIfFatal(th);
// check for null key below
}
ByteBuffer currentIndexKey = nextIndexKey;
long nextRowPositionFromIndex;
try
{
nextIndexKey = indexFile.isEOF() ? null : ByteBufferUtil.readWithShortLength(indexFile);
nextRowPositionFromIndex = indexFile.isEOF() ? dataFile.length() : indexFile.readLong();
}
catch (Throwable th)
{
logger.warn("Error reading index file", th);
nextIndexKey = null;
nextRowPositionFromIndex = dataFile.length();
}
long dataStart = dataFile.getFilePointer();
long dataStartFromIndex = currentIndexKey == null
? -1
: rowStart + 2 + currentIndexKey.remaining() + (sstable.descriptor.hasIntRowSize ? 4 : 8);
long dataSizeFromIndex = nextRowPositionFromIndex - dataStartFromIndex;
assert currentIndexKey != null || indexFile.isEOF();
if (logger.isDebugEnabled() && currentIndexKey != null)
logger.debug(String.format("Index doublecheck: row %s is %s bytes", ByteBufferUtil.bytesToHex(currentIndexKey), dataSizeFromIndex));
writer.mark();
try
{
if (key == null)
throw new IOError(new IOException("Unable to read row key from data file"));
if (dataSize > dataFile.length())
throw new IOError(new IOException("Impossible row size " + dataSize));
SSTableIdentityIterator row = new SSTableIdentityIterator(sstable, dataFile, key, dataStart, dataSize, true);
AbstractCompactedRow compactedRow = getCompactedRow(row, sstable.descriptor, true);
if (compactedRow.isEmpty())
{
emptyRows++;
}
else
{
writer.append(compactedRow);
goodRows++;
}
if (!key.key.equals(currentIndexKey) || dataStart != dataStartFromIndex)
logger.warn("Row scrubbed successfully but index file contains a different key or row size; consider rebuilding the index as described in http://www.mail-archive.com/user@cassandra.apache.org/msg03325.html");
}
catch (Throwable th)
{
throwIfFatal(th);
logger.warn("Non-fatal error reading row (stacktrace follows)", th);
writer.reset();
if (currentIndexKey != null
&& (key == null || !key.key.equals(currentIndexKey) || dataStart != dataStartFromIndex || dataSize != dataSizeFromIndex))
{
logger.info(String.format("Retrying from row index; data is %s bytes starting at %s",
dataSizeFromIndex, dataStartFromIndex));
key = SSTableReader.decodeKey(sstable.partitioner, sstable.descriptor, currentIndexKey);
try
{
SSTableIdentityIterator row = new SSTableIdentityIterator(sstable, dataFile, key, dataStartFromIndex, dataSizeFromIndex, true);
AbstractCompactedRow compactedRow = getCompactedRow(row, sstable.descriptor, true);
if (compactedRow.isEmpty())
{
emptyRows++;
}
else
{
writer.append(compactedRow);
goodRows++;
}
}
catch (Throwable th2)
{
throwIfFatal(th2);
logger.warn("Retry failed too. Skipping to next row (retry's stacktrace follows)", th2);
writer.reset();
dataFile.seek(nextRowPositionFromIndex);
badRows++;
}
}
else
{
logger.warn("Row at " + dataStart + " is unreadable; skipping to next");
if (currentIndexKey != null)
dataFile.seek(nextRowPositionFromIndex);
badRows++;
}
}
}
if (writer.getFilePointer() > 0)
{
SSTableReader newSstable = writer.closeAndOpenReader(sstable.maxDataAge);
cfs.replaceCompactedSSTables(Arrays.asList(sstable), Arrays.asList(newSstable));
logger.info("Scrub of " + sstable + " complete: " + goodRows + " rows in new sstable and " + emptyRows + " empty (tombstoned) rows dropped");
if (badRows > 0)
logger.warn("Unable to recover " + badRows + " rows that were skipped. You can attempt manual recovery from the pre-scrub snapshot. You can also run nodetool repair to transfer the data from a healthy replica, if any");
}
else
{
cfs.markCompacted(Arrays.asList(sstable));
if (badRows > 0)
logger.warn("No valid rows found while scrubbing " + sstable + "; it is marked for deletion now. If you want to attempt manual recovery, you can find a copy in the pre-scrub snapshot");
else
logger.info("Scrub of " + sstable + " complete; looks like all " + emptyRows + " rows were tombstoned");
}
}
}
private void throwIfFatal(Throwable th)
{
if (th instanceof Error && !(th instanceof AssertionError || th instanceof IOError))
throw (Error) th;
}
/**
* This function goes over each file and removes the keys that the node is not responsible for
* and only keeps keys that this node is responsible for.
*
* @throws IOException
*/
private void doCleanupCompaction(ColumnFamilyStore cfs, Collection<SSTableReader> sstables, NodeId.OneShotRenewer renewer) throws IOException
{
assert !cfs.isIndex();
Table table = cfs.table;
Collection<Range> ranges = StorageService.instance.getLocalRanges(table.name);
boolean isCommutative = cfs.metadata.getDefaultValidator().isCommutative();
if (ranges.isEmpty())
{
logger.info("Cleanup cannot run before a node has joined the ring");
return;
}
for (SSTableReader sstable : sstables)
{
long startTime = System.currentTimeMillis();
long totalkeysWritten = 0;
int expectedBloomFilterSize = Math.max(DatabaseDescriptor.getIndexInterval(),
(int)(SSTableReader.getApproximateKeyCount(Arrays.asList(sstable))));
if (logger.isDebugEnabled())
logger.debug("Expected bloom filter size : " + expectedBloomFilterSize);
SSTableWriter writer = null;
try
{
logger.info("Cleaning up " + sstable);
// Calculate the expected compacted filesize
long expectedRangeFileSize = cfs.getExpectedCompactedFileSize(Arrays.asList(sstable)) / 2;
String compactionFileLocation = table.getDataFileLocation(expectedRangeFileSize);
if (compactionFileLocation == null)
throw new IOException("disk full");
SSTableScanner scanner = sstable.getDirectScanner(CompactionIterator.FILE_BUFFER_SIZE);
SortedSet<ByteBuffer> indexedColumns = cfs.getIndexedColumns();
CleanupInfo ci = new CleanupInfo(sstable, scanner);
executor.beginCompaction(ci);
try
{
while (scanner.hasNext())
{
SSTableIdentityIterator row = (SSTableIdentityIterator) scanner.next();
if (Range.isTokenInRanges(row.getKey().token, ranges))
{
writer = maybeCreateWriter(cfs, compactionFileLocation, expectedBloomFilterSize, writer, Collections.singletonList(sstable));
writer.append(getCompactedRow(row, sstable.descriptor, false));
totalkeysWritten++;
}
else
{
cfs.invalidateCachedRow(row.getKey());
if (!indexedColumns.isEmpty() || isCommutative)
{
while (row.hasNext())
{
IColumn column = row.next();
if (column instanceof CounterColumn)
renewer.maybeRenew((CounterColumn)column);
if (indexedColumns.contains(column.name()))
Table.cleanupIndexEntry(cfs, row.getKey().key, column);
}
}
}
}
}
finally
{
scanner.close();
executor.finishCompaction(ci);
}
}
finally
{
cfs.getDataTracker().unmarkCompacting(Arrays.asList(sstable));
}
List<SSTableReader> results = new ArrayList<SSTableReader>();
if (writer != null)
{
SSTableReader newSstable = writer.closeAndOpenReader(sstable.maxDataAge);
results.add(newSstable);
String format = "Cleaned up to %s. %,d to %,d (~%d%% of original) bytes for %,d keys. Time: %,dms.";
long dTime = System.currentTimeMillis() - startTime;
long startsize = sstable.length();
long endsize = newSstable.length();
double ratio = (double)endsize / (double)startsize;
logger.info(String.format(format, writer.getFilename(), startsize, endsize, (int)(ratio*100), totalkeysWritten, dTime));
}
// flush to ensure we don't lose the tombstones on a restart, since they are not commitlog'd
for (ByteBuffer columnName : cfs.getIndexedColumns())
{
try
{
cfs.getIndexedColumnFamilyStore(columnName).forceBlockingFlush();
}
catch (ExecutionException e)
{
throw new RuntimeException(e);
}
catch (InterruptedException e)
{
throw new AssertionError(e);
}
}
cfs.replaceCompactedSSTables(Arrays.asList(sstable), results);
}
}
/**
* @return an AbstractCompactedRow implementation to write the row in question.
* If the data is from a current-version sstable, write it unchanged. Otherwise,
* re-serialize it in the latest version. The returned AbstractCompactedRow will not purge data.
*/
private AbstractCompactedRow getCompactedRow(SSTableIdentityIterator row, Descriptor descriptor, boolean forceDeserialize)
{
if (descriptor.isLatestVersion && !forceDeserialize)
return new EchoedRow(row);
return row.dataSize > DatabaseDescriptor.getInMemoryCompactionLimit()
? new LazilyCompactedRow(CompactionController.getBasicController(forceDeserialize), Arrays.asList(row))
: new PrecompactedRow(CompactionController.getBasicController(forceDeserialize), Arrays.asList(row));
}
private SSTableWriter maybeCreateWriter(ColumnFamilyStore cfs, String compactionFileLocation, int expectedBloomFilterSize, SSTableWriter writer, Collection<SSTableReader> sstables)
throws IOException
{
if (writer == null)
{
FileUtils.createDirectory(compactionFileLocation);
writer = cfs.createCompactionWriter(expectedBloomFilterSize, compactionFileLocation, sstables);
}
return writer;
}
/**
* Performs a readonly "compaction" of all sstables in order to validate complete rows,
* but without writing the merge result
*/
private void doValidationCompaction(ColumnFamilyStore cfs, AntiEntropyService.Validator validator) throws IOException
{
// flush first so everyone is validating data that is as similar as possible
try
{
StorageService.instance.forceTableFlush(cfs.table.name, cfs.getColumnFamilyName());
}
catch (ExecutionException e)
{
throw new IOException(e);
}
catch (InterruptedException e)
{
throw new AssertionError(e);
}
CompactionIterator ci = new ValidationCompactionIterator(cfs, validator.request.range);
executor.beginCompaction(ci);
try
{
Iterator<AbstractCompactedRow> nni = new FilterIterator(ci, PredicateUtils.notNullPredicate());
// validate the CF as we iterate over it
validator.prepare(cfs);
while (nni.hasNext())
{
AbstractCompactedRow row = nni.next();
validator.add(row);
}
validator.complete();
}
finally
{
ci.close();
executor.finishCompaction(ci);
}
}
/*
* Group files of similar size into buckets.
*/
static <T> Set<List<T>> getBuckets(Collection<Pair<T, Long>> files, long min)
{
// Sort the list in order to get deterministic results during the grouping below
List<Pair<T, Long>> sortedFiles = new ArrayList<Pair<T, Long>>(files);
Collections.sort(sortedFiles, new Comparator<Pair<T, Long>>()
{
public int compare(Pair<T, Long> p1, Pair<T, Long> p2)
{
return p1.right.compareTo(p2.right);
}
});
Map<List<T>, Long> buckets = new HashMap<List<T>, Long>();
for (Pair<T, Long> pair: sortedFiles)
{
long size = pair.right;
boolean bFound = false;
// look for a bucket containing similar-sized files:
// group in the same bucket if it's w/in 50% of the average for this bucket,
// or this file and the bucket are all considered "small" (less than `min`)
for (Entry<List<T>, Long> entry : buckets.entrySet())
{
List<T> bucket = entry.getKey();
long averageSize = entry.getValue();
if ((size > (averageSize / 2) && size < (3 * averageSize) / 2)
|| (size < min && averageSize < min))
{
// remove and re-add because adding changes the hash
buckets.remove(bucket);
long totalSize = bucket.size() * averageSize;
averageSize = (totalSize + size) / (bucket.size() + 1);
bucket.add(pair.left);
buckets.put(bucket, averageSize);
bFound = true;
break;
}
}
// no similar bucket found; put it in a new one
if (!bFound)
{
ArrayList<T> bucket = new ArrayList<T>();
bucket.add(pair.left);
buckets.put(bucket, size);
}
}
return buckets.keySet();
}
private static Collection<Pair<SSTableReader, Long>> convertSSTablesToPairs(Collection<SSTableReader> collection)
{
Collection<Pair<SSTableReader, Long>> tablePairs = new ArrayList<Pair<SSTableReader, Long>>();
for(SSTableReader table: collection)
{
tablePairs.add(new Pair<SSTableReader, Long>(table, table.length()));
}
return tablePairs;
}
/**
* Is not scheduled, because it is performing disjoint work from sstable compaction.
*/
public Future submitIndexBuild(final ColumnFamilyStore cfs, final Table.IndexBuilder builder)
{
Runnable runnable = new Runnable()
{
public void run()
{
compactionLock.readLock().lock();
try
{
if (cfs.isInvalid())
return;
executor.beginCompaction(builder);
try
{
builder.build();
}
finally
{
executor.finishCompaction(builder);
}
}
finally
{
compactionLock.readLock().unlock();
}
}
};
// don't submit to the executor if the compaction lock is held by the current thread. Instead return a simple
// future that will be immediately immediately get()ed and executed. Happens during a migration, which locks
// the compaction thread and then reinitializes a ColumnFamilyStore. Under normal circumstances, CFS spawns
// index jobs to the compaction manager (this) and blocks on them.
if (compactionLock.isWriteLockedByCurrentThread())
return new SimpleFuture(runnable);
else
return executor.submit(runnable);
}
/**
* Submits an sstable to be rebuilt: is not scheduled, since the sstable must not exist.
*/
public Future<SSTableReader> submitSSTableBuild(final Descriptor desc, OperationType type)
{
// invalid descriptions due to missing or dropped CFS are handled by SSTW and StreamInSession.
final SSTableWriter.Builder builder = SSTableWriter.createBuilder(desc, type);
Callable<SSTableReader> callable = new Callable<SSTableReader>()
{
public SSTableReader call() throws IOException
{
compactionLock.readLock().lock();
try
{
executor.beginCompaction(builder);
try
{
return builder.build();
}
finally
{
executor.finishCompaction(builder);
}
}
finally
{
compactionLock.readLock().unlock();
}
}
};
return executor.submit(callable);
}
public Future<?> submitCacheWrite(final AutoSavingCache.Writer writer)
{
Runnable runnable = new WrappedRunnable()
{
public void runMayThrow() throws IOException
{
if (!AutoSavingCache.flushInProgress.compareAndSet(false, true))
{
logger.debug("Cache flushing was already in progress: skipping {}", writer.getCompactionInfo());
return;
}
try
{
executor.beginCompaction(writer);
try
{
writer.saveCache();
}
finally
{
executor.finishCompaction(writer);
}
}
finally
{
AutoSavingCache.flushInProgress.set(false);
}
}
};
return executor.submit(runnable);
}
private static int getDefaultGcBefore(ColumnFamilyStore cfs)
{
return (int) (System.currentTimeMillis() / 1000) - cfs.metadata.getGcGraceSeconds();
}
private static class ValidationCompactionIterator extends CompactionIterator
{
public ValidationCompactionIterator(ColumnFamilyStore cfs, Range range) throws IOException
{
super(CompactionType.VALIDATION,
getCollatingIterator(cfs.getSSTables(), range),
new CompactionController(cfs, cfs.getSSTables(), true, getDefaultGcBefore(cfs), false));
}
protected static CollatingIterator getCollatingIterator(Iterable<SSTableReader> sstables, Range range) throws IOException
{
CollatingIterator iter = FBUtilities.getCollatingIterator();
for (SSTableReader sstable : sstables)
{
iter.addIterator(sstable.getDirectScanner(FILE_BUFFER_SIZE, range));
}
return iter;
}
}
public void checkAllColumnFamilies() throws IOException
{
// perform estimates
for (final ColumnFamilyStore cfs : ColumnFamilyStore.all())
{
Runnable runnable = new Runnable()
{
public void run ()
{
logger.debug("Estimating compactions for " + cfs.columnFamily);
final Set<List<SSTableReader>> buckets = getBuckets(convertSSTablesToPairs(cfs.getSSTables()), 50L * 1024L * 1024L);
updateEstimateFor(cfs, buckets);
}
};
executor.submit(runnable);
}
// actually schedule compactions. done in a second pass so all the estimates occur before we
// bog down the executor in actual compactions.
for (ColumnFamilyStore cfs : ColumnFamilyStore.all())
{
submitMinorIfNeeded(cfs);
}
}
public int getActiveCompactions()
{
return executor.getActiveCount();
}
private static class CompactionExecutor extends DebuggableThreadPoolExecutor
{
// a synchronized identity set of running tasks to their compaction info
private final Set<CompactionInfo.Holder> compactions;
public CompactionExecutor()
{
super(getThreadCount(),
60,
TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>(),
new NamedThreadFactory("CompactionExecutor", DatabaseDescriptor.getCompactionThreadPriority()));
Map<CompactionInfo.Holder, Boolean> cmap = new IdentityHashMap<CompactionInfo.Holder, Boolean>();
compactions = Collections.synchronizedSet(Collections.newSetFromMap(cmap));
}
private static int getThreadCount()
{
return Math.max(1, DatabaseDescriptor.getConcurrentCompactors());
}
void beginCompaction(CompactionInfo.Holder ci)
{
compactions.add(ci);
}
void finishCompaction(CompactionInfo.Holder ci)
{
compactions.remove(ci);
}
public List<CompactionInfo.Holder> getCompactions()
{
return new ArrayList<CompactionInfo.Holder>(compactions);
}
}
public List<CompactionInfo> getCompactions()
{
List<CompactionInfo> out = new ArrayList<CompactionInfo>();
for (CompactionInfo.Holder ci : executor.getCompactions())
out.add(ci.getCompactionInfo());
return out;
}
public List<String> getCompactionSummary()
{
List<String> out = new ArrayList<String>();
for (CompactionInfo.Holder ci : executor.getCompactions())
out.add(ci.getCompactionInfo().toString());
return out;
}
public int getPendingTasks()
{
int n = 0;
for (Integer i : estimatedCompactions.values())
n += i;
return (int) (executor.getTaskCount() - executor.getCompletedTaskCount()) + n;
}
public long getCompletedTasks()
{
return executor.getCompletedTaskCount();
}
private static class SimpleFuture implements Future
{
private Runnable runnable;
private SimpleFuture(Runnable r)
{
runnable = r;
}
public boolean cancel(boolean mayInterruptIfRunning)
{
throw new IllegalStateException("May not call SimpleFuture.cancel()");
}
public boolean isCancelled()
{
return false;
}
public boolean isDone()
{
return runnable == null;
}
public Object get() throws InterruptedException, ExecutionException
{
runnable.run();
runnable = null;
return runnable;
}
public Object get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException
{
throw new IllegalStateException("May not call SimpleFuture.get(long, TimeUnit)");
}
}
private static class EchoedRow extends AbstractCompactedRow
{
private final SSTableIdentityIterator row;
public EchoedRow(SSTableIdentityIterator row)
{
super(row.getKey());
this.row = row;
// Reset SSTableIdentityIterator because we have not guarantee the filePointer hasn't moved since the Iterator was built
row.reset();
}
public void write(DataOutput out) throws IOException
{
assert row.dataSize > 0;
out.writeLong(row.dataSize);
row.echoData(out);
}
public void update(MessageDigest digest)
{
// EchoedRow is not used in anti-entropy validation
throw new UnsupportedOperationException();
}
public boolean isEmpty()
{
return !row.hasNext();
}
public int columnCount()
{
return row.columnCount;
}
}
private static class CleanupInfo implements CompactionInfo.Holder
{
private final SSTableReader sstable;
private final SSTableScanner scanner;
public CleanupInfo(SSTableReader sstable, SSTableScanner scanner)
{
this.sstable = sstable;
this.scanner = scanner;
}
public CompactionInfo getCompactionInfo()
{
try
{
return new CompactionInfo(sstable.descriptor.ksname,
sstable.descriptor.cfname,
CompactionType.CLEANUP,
scanner.getFilePointer(),
scanner.getFileLength());
}
catch (Exception e)
{
throw new RuntimeException();
}
}
}
private static class ScrubInfo implements CompactionInfo.Holder
{
private final BufferedRandomAccessFile dataFile;
private final SSTableReader sstable;
public ScrubInfo(BufferedRandomAccessFile dataFile, SSTableReader sstable)
{
this.dataFile = dataFile;
this.sstable = sstable;
}
public CompactionInfo getCompactionInfo()
{
try
{
return new CompactionInfo(sstable.descriptor.ksname,
sstable.descriptor.cfname,
CompactionType.SCRUB,
dataFile.getFilePointer(),
dataFile.length());
}
catch (Exception e)
{
throw new RuntimeException();
}
}
}
}
| [
"hyczzhu@gmail.com@36054c91-6fe2-1485-663b-42a6e16799a3"
] | hyczzhu@gmail.com@36054c91-6fe2-1485-663b-42a6e16799a3 |
c3af9313e3074442f8a02f9ee0611d020700c41e | 818fc566816ea6ff7a3c3ef756d08095037eccc3 | /banner/src/main/java/com/marsthink/banner/transformer/ZoomOutTranformer.java | 10e91146f791cb9e8de9133b3e39d193380337aa | [] | no_license | woshizmxin/banner | b93b624f89cf7ef7cbf025c5855ffda1d6b03d8b | 0a6dc49bdaecc6a4b1047b0344e88b3d2684e79d | refs/heads/master | 2021-01-22T02:25:12.459018 | 2017-05-26T09:22:11 | 2017-05-26T09:22:11 | 92,360,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 772 | java | /*
* Copyright (c) 2016 Meituan Inc.
*
* The right to copy, distribute, modify, or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Meituan license agreement.
*
*/
package com.marsthink.banner.transformer;
import android.view.View;
public class ZoomOutTranformer extends ABaseTransformer {
@Override
protected void onTransform(View view, float position) {
final float scale = 1f + Math.abs(position);
view.setScaleX(scale);
view.setScaleY(scale);
view.setPivotX(view.getWidth() * 0.5f);
view.setPivotY(view.getHeight() * 0.5f);
view.setAlpha(position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
if(position == -1){
view.setTranslationX(view.getWidth() * -1);
}
}
}
| [
"zhoumao@meituan.com"
] | zhoumao@meituan.com |
1b1392b06595e3b3b3223919a4581417eb602da7 | c5eace7651044009fa1b74f362cab619a5b79027 | /krusty-skeleton/src/main/java/krusty/ServerMain.java | 404ae58f7d9ba663f47eb31f974ace410f2d85f7 | [] | no_license | annamajken/krusty-kookies | 4e2709aac7dc49a18710ae67d178f5283c576740 | 17141c088bd50d706d87accfaf264684d1b0f41b | refs/heads/main | 2023-04-20T22:15:30.689483 | 2021-05-04T21:41:57 | 2021-05-04T21:41:57 | 342,835,864 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,449 | java | package krusty;
import java.io.IOError;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import static spark.Spark.*;
public class ServerMain {
public static int PORT = 8888;
public static String API_ENTRYPOINT = "/api/v1";
private Database db;
public void startServer() {
staticFiles.location("/public");
db = new Database();
db.connect();
port(PORT);
enableCORS();
initIndex();
initRoutes();
}
private void initIndex() {
try {
byte[] indexData = getClass().getResource("/public/index.html").openStream().readAllBytes();
final String index = new String(indexData, StandardCharsets.UTF_8);
get("/", (req, res) -> index);
} catch (IOException e) {
throw new IOError(e);
}
}
private void initRoutes() {
get(API_ENTRYPOINT + "/customers", (req, res) -> db.getCustomers(req, res));
get(API_ENTRYPOINT + "/raw-materials", (req, res) -> db.getRawMaterials(req, res));
get(API_ENTRYPOINT + "/cookies", (req, res) -> db.getCookies(req, res));
get(API_ENTRYPOINT + "/recipes", (req, res) -> db.getRecipes(req, res));
get(API_ENTRYPOINT + "/pallets", (req, res) -> db.getPallets(req, res));
post(API_ENTRYPOINT + "/reset", (req, res) -> db.reset(req, res));
post(API_ENTRYPOINT + "/pallets", (req, res) -> db.createPallet(req, res));
}
public void stopServer() {
stop();
}
/**
* Setup CORS, see:
* - https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
* - http://sparkjava.com/tutorials/cors
*/
private void enableCORS() {
options("/*", (request, response) -> {
String accessControlRequestHeaders = request.headers("Access-Control-Request-Headers");
if (accessControlRequestHeaders != null) {
response.header("Access-Control-Allow-Headers", accessControlRequestHeaders);
}
String accessControlRequestMethod = request.headers("Access-Control-Request-Method");
if (accessControlRequestMethod != null) {
response.header("Access-Control-Allow-Methods", accessControlRequestMethod);
}
return "OK";
});
before((request, response) -> {
response.header("Access-Control-Allow-Origin", "*");
response.header("Access-Control-Allow-Headers", "Content-Type, Accept");
response.type("application/json");
});
}
public static void main(String[] args) throws InterruptedException {
new ServerMain().startServer();
}
} | [
"an7151be-s@student.lu.se"
] | an7151be-s@student.lu.se |
f356c68bd296fed60185327c75d5e3a11737a6a2 | a2afeb121e60dd889621d4ab6d719fd613f2a56a | /src/zadatak13/Zadatak13.java | e353d58a41fbd1034aef8852f7235f138349d753 | [] | no_license | erazmojava/JavaPrograming | 117686ee5ec7f382a20713f75b9cc51b6f80ddb8 | c16c52a5e3999eabf95fbb3dcc8ffa9e60be5f7e | refs/heads/master | 2020-12-30T12:54:39.262463 | 2017-06-21T17:30:03 | 2017-06-21T17:30:03 | 91,361,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | package zadatak13;
/**
* Created by osman on 6/5/17.
*/
public class Zadatak13 {
}
| [
"you@example.com"
] | you@example.com |
c8becc44d6454ca96b9c095bca67aab5d535d4f1 | af50c50851d5027fafaf084c105397cf8cc3d07f | /src/SimpleFactory/Fruit.java | c855546ada46551abaadd18c79a5f51b1d557fea | [] | no_license | LYQkeke/DesignPatternsInJava | cf63a51c06d4b3334996e08780fb7df7ad8c8b05 | bc620c773613cde8426375be0ca895866eb7180d | refs/heads/master | 2020-05-20T20:13:19.256978 | 2019-05-15T09:23:28 | 2019-05-15T09:23:28 | 185,739,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 136 | java | package SimpleFactory;
/**
* Created by KEKE on 2019/5/9
*/
public interface Fruit {
/**
* 采集
*/
void get();
}
| [
"493006007@qq.com"
] | 493006007@qq.com |
8df3da9e37045928d7e398cab89cfc4579384fd8 | 8f92ea8f594a2f7624ff09d392fe0cea13878dcd | /src/TestNG/Sample.java | 78f7716eb14e354fa4ac917aebbe383f4eb03918 | [] | no_license | vasanreddy/Selenium | d33585ddfbd6d6a9cb8c00c86aebc7eb06e0094e | d1540c966643661662dbe27a8d94d660bc57a6f1 | refs/heads/master | 2021-08-14T08:45:35.984917 | 2017-11-15T05:18:33 | 2017-11-15T05:18:33 | 110,787,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 414 | java | package TestNG;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
public class Sample {
public static void main(String[] args) {
// TODO Auto-generated method stub
FirefoxProfile profile=new FirefoxProfile();
profile.setAcceptUntrustedCertificates(false);
WebDriver driver=new FirefoxDriver(profile);
}
}
| [
"vasanreddy31@gmail.com"
] | vasanreddy31@gmail.com |
8746829bd96459f8e94c41f26d7191ceca678e88 | 16f89faf08d59270e57ec83c390def525d081b39 | /SampleAPIPrj/src/test/java/services/wsdlversion/SingleRunnerGetWSDL.java | da03a625a32ff829666e0a1eacfd5e8854ae3368 | [] | no_license | pranesh517/karateAPI | d148270cdfc1dd292be46cd12e716afd9be975f6 | 7dd156f48815c33c432a040a5b831f269bd778ee | refs/heads/main | 2023-01-06T12:36:35.422148 | 2020-10-29T11:32:48 | 2020-10-29T11:32:48 | 308,299,889 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package services.wsdlversion;
import org.junit.runner.RunWith;
import com.intuit.karate.KarateOptions;
import com.intuit.karate.junit4.Karate;
@RunWith(Karate.class)
@KarateOptions(features = "classpath:services/wsdlversion/API_GetWsdlVersion.feature")
public class SingleRunnerGetWSDL {
}
| [
"Pranesh.Gaikwad@thoughtworks.com"
] | Pranesh.Gaikwad@thoughtworks.com |
3ce38256238917f31058e9701eab76d87482c32b | 41848f87199b44077424597315e1d67a6dd5ff80 | /app/src/main/java/com/anshi/hjsign/PlaybackVideoFragment.java | 30f73bb063982bc0152a6ae99bb4bc56fe22acd2 | [] | no_license | yulu1121/HJSign | 0b433adb15b3e18fe46df9c4588e24b2e3e3bb67 | 635915217f2feeec50208bae0c5520ffc3749c1c | refs/heads/master | 2020-03-25T19:37:32.877364 | 2018-08-17T01:07:04 | 2018-08-17T01:07:04 | 144,092,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,326 | java | /*
* Copyright (C) 2017 The Android Open Source Project
*
* 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.anshi.hjsign;
import android.net.Uri;
import android.os.Bundle;
import android.support.v17.leanback.app.VideoSupportFragment;
import android.support.v17.leanback.app.VideoSupportFragmentGlueHost;
import android.support.v17.leanback.media.MediaPlayerAdapter;
import android.support.v17.leanback.media.PlaybackTransportControlGlue;
import android.support.v17.leanback.widget.PlaybackControlsRow;
/**
* Handles video playback with media controls.
*/
public class PlaybackVideoFragment extends VideoSupportFragment {
private PlaybackTransportControlGlue<MediaPlayerAdapter> mTransportControlGlue;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final Movie movie =
(Movie) getActivity().getIntent().getSerializableExtra(DetailsActivity.MOVIE);
VideoSupportFragmentGlueHost glueHost =
new VideoSupportFragmentGlueHost(PlaybackVideoFragment.this);
MediaPlayerAdapter playerAdapter = new MediaPlayerAdapter(getActivity());
playerAdapter.setRepeatAction(PlaybackControlsRow.RepeatAction.INDEX_NONE);
mTransportControlGlue = new PlaybackTransportControlGlue<>(getActivity(), playerAdapter);
mTransportControlGlue.setHost(glueHost);
mTransportControlGlue.setTitle(movie.getTitle());
mTransportControlGlue.setSubtitle(movie.getDescription());
mTransportControlGlue.playWhenPrepared();
playerAdapter.setDataSource(Uri.parse(movie.getVideoUrl()));
}
@Override
public void onPause() {
super.onPause();
if (mTransportControlGlue != null) {
mTransportControlGlue.pause();
}
}
} | [
"626899174@qq.com"
] | 626899174@qq.com |
16b08645962aa97462db04e448e24598871aaaaa | 98f3b57549676445f233cdc3f0bfee1db3bf009a | /tyyh/src/cn/tyyhoa/service/OaRlzybEmployeeService.java | 5f1130807792e653fa3919d93a2a7c4a0adb5002 | [] | no_license | wangadmin123/httpApp | 015fba335042bacfce963445496389aba38a1f52 | 0babecddd587743a2aba04dd775ff1289f9485ac | refs/heads/master | 2021-08-30T19:59:21.731037 | 2017-12-19T07:35:05 | 2017-12-19T07:43:46 | 114,734,553 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,224 | java | // Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space
// Source File Name: OaRlzybEmployeeService.java
package cn.tyyhoa.service;
import cn.tyyhoa.pojo.OaRlzybEmployee;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import cn.tyyhoa.pojo.OaRlzybContract;
import cn.tyyhoa.pojo.OaRlzybDepartment;
import cn.tyyhoa.pojo.OaRlzybEmployee;
import cn.tyyhoa.pojo.OaRlzybGrade;
import cn.tyyhoa.pojo.OaRlzybHatArea;
import cn.tyyhoa.pojo.OaRlzybHatCity;
import cn.tyyhoa.pojo.OaRlzybHatProvince;
import cn.tyyhoa.pojo.OaRlzybNative;
import cn.tyyhoa.pojo.OaRlzybNotice;
import cn.tyyhoa.pojo.OaRlzybNotifiedParty;
import cn.tyyhoa.pojo.OaRlzybPosition;
import cn.tyyhoa.pojo.OaRlzybTechnicalTitle;
import cn.tyyhoa.pojo.OaRlzybUser;
public interface OaRlzybEmployeeService
{
public abstract OaRlzybEmployee selectByPrimaryKey(Integer integer);
List<OaRlzybEmployee> selectByDepart(Integer depart_id);
/*List<OaRlzybEmployee> selectByDepart2(Integer depart_id);*/
List<OaRlzybEmployee> selectByEmpId(Integer emp_id);
List<OaRlzybEmployee> selectAllContract(String emp_name,Integer contract_id,String contract_startDate,String contract_endDate,String contract_status,Integer startPos,Integer PageSize);
OaRlzybEmployee showInfo(Integer emp_id);
Boolean updateByContractEndDate(OaRlzybEmployee record);
int selectCount(String emp_name,Integer contract_id,String contract_startDate,String contract_endDate,String contract_status);
boolean updateByEmpId(OaRlzybEmployee record);
List<OaRlzybEmployee> selectAll(String emp_name);
boolean updateStatus(OaRlzybEmployee record);
List<OaRlzybEmployee> selectEmpNameByDepartId(Integer emp_department);
OaRlzybEmployee selectPositionByEmpName(Integer emp_id);
public List<OaRlzybNative> getAllNations();
public List<OaRlzybHatProvince> getAllProvinces();
public List<OaRlzybHatCity> getAllCitys(String ProvinceId);
public List<OaRlzybHatArea> getAllAreas(String CityId);
public List<OaRlzybDepartment> getAllDepartments();
public List<OaRlzybPosition> getAllPositions(Integer DepartmentId);
public List<OaRlzybGrade> getAllGrades();
public List<OaRlzybEmployee> getHumanAffairsOaRlzybEmployees();//获得人力资源部人事的雇员名单
public int addEmpTechnicalTitlePath(OaRlzybTechnicalTitle oaRlzybTechnicalTitle);
public int addEmployee(OaRlzybEmployee oaRlzybEmployee);
public int modifyEmployee(OaRlzybEmployee oaRlzybEmployee);
public Integer getMaxEmpId();
public int modifyEmployeeByEmpIdCard(OaRlzybEmployee oaRlzybEmployee);
public int getEmpIdByEmpIdCard(OaRlzybEmployee oaRlzybEmployee);
public int addUser(OaRlzybUser OaRlzybUser);
public int getEmployeeCountByCondition(Map<String,Object> condition);
public List<OaRlzybEmployee> getOaRlzybEmployeeByPage(Map<String,Object> condition);
public OaRlzybEmployee getOaRlzybEmployeeById(int emp_id);
public int getOaRlzybUserCountByOaRlzybUser(OaRlzybUser oaRlzybUser);
public int getOaRlzybEmployeeCountByEmpIdCard(String empIdCard );
public List<OaRlzybTechnicalTitle> getOaRlzybTechnicalTitleByEmpId(int emp_id);
public int modifyOaRlzybEmployeePhotoPathByEmpId(OaRlzybEmployee oaRlzybEmployee);
public int deleteOaRlzybEmployeeByEmpId(Integer emp_id);
public int getOaRlzybEmployeeCountByPhoneNumber(String emp_phone);
public int getOaRlzybEmployeeCountByEmailAddress(String emp_Email);
public int realDeleteInformationBugOaRlzybEmployee();
public int modifyUserPositionIdByUserName(OaRlzybUser oaRlzybUser);
/*查询除自己外其他用户名*/
public List<OaRlzybUser> selectUserByUid(Integer user_id);
/*查询自己用户名*/
public OaRlzybUser selectUserNameByUid(@Param("user_id") Integer user_id);
/*插入通知信息*/
public boolean addNotice(OaRlzybNotice record);
/*收件人添加通知信息*/
public boolean addNotified_party(OaRlzybNotifiedParty record);
/* 根据用户id查询已读通知信息 */
public List<OaRlzybNotice> selectYdNoticeByUid( Integer user_id);
/* 根据用户id查询未读通知信息 */
public List<OaRlzybNotice> selectWdNoticeByUid( Integer user_id);
/* 根据用户id查询通知信息 */
public List<OaRlzybNotice> selectnotice(Integer status, Integer user_id);
/*根据通知id查询通知详情*/
public OaRlzybNotice selectXqNotice( Integer id,Integer user_id);
/*根据通知id修改通知状态*/
public int updateNoticeById(Integer npid);
/*根据用户id查询未读通知记录数*/
public int selectWdCountByUid(Integer user_id);
public abstract List<OaRlzybEmployee> getEmpByDept(Integer deptid);
}
| [
"1010249952@qq.com"
] | 1010249952@qq.com |
a59db9997a76f8ac695d451ff8af8eace4f1d5ec | 68d0db8809f41f2258418ab1051b51298ab1f4f0 | /components/paint_preview/player/android/javatests/src/org/chromium/components/paintpreview/player/PaintPreviewPlayerTest.java | 654f1237774bfd5b578b77714a12a1964f6bc7fb | [
"BSD-3-Clause"
] | permissive | nemux000/chromium | 28d7688138c7b6a41210f6def0bde7791710723f | 9b62934f4c7b14c8680fd788c19c80c4ec67717d | refs/heads/master | 2022-11-25T02:25:32.920431 | 2020-07-30T14:47:51 | 2020-07-30T14:47:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,892 | java | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.components.paintpreview.player;
import android.graphics.Rect;
import android.os.Build.VERSION_CODES;
import android.support.test.InstrumentationRegistry;
import android.support.test.uiautomator.By;
import android.support.test.uiautomator.UiDevice;
import android.support.test.uiautomator.UiObject2;
import android.util.Size;
import android.view.View;
import android.view.ViewGroup;
import androidx.test.filters.MediumTest;
import org.hamcrest.Matchers;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.chromium.base.task.PostTask;
import org.chromium.base.test.BaseJUnit4ClassRunner;
import org.chromium.base.test.util.CallbackHelper;
import org.chromium.base.test.util.DisableIf;
import org.chromium.base.test.util.ScalableTimeout;
import org.chromium.content_public.browser.UiThreadTaskTraits;
import org.chromium.content_public.browser.test.util.Criteria;
import org.chromium.content_public.browser.test.util.CriteriaHelper;
import org.chromium.ui.test.util.DummyUiActivityTestCase;
import org.chromium.url.GURL;
import java.util.List;
/**
* Instrumentation tests for the Paint Preview player.
*/
@RunWith(BaseJUnit4ClassRunner.class)
public class PaintPreviewPlayerTest extends DummyUiActivityTestCase {
private static final long TIMEOUT_MS = ScalableTimeout.scaleTimeout(5000);
private static final String TEST_DIRECTORY_KEY = "test_dir";
private static final String TEST_URL = "https://www.chromium.org";
private static final String TEST_IN_VIEWPORT_LINK_URL = "http://www.google.com/";
private static final String TEST_OUT_OF_VIEWPORT_LINK_URL = "http://example.com/";
private final Rect mInViewportLinkRect = new Rect(700, 650, 900, 700);
private final Rect mOutOfViewportLinkRect = new Rect(300, 4900, 450, 5000);
private static final int TEST_PAGE_WIDTH = 1082;
private static final int TEST_PAGE_HEIGHT = 5019;
@Rule
public PaintPreviewTestRule mPaintPreviewTestRule = new PaintPreviewTestRule();
@Rule
public TemporaryFolder mTempFolder = new TemporaryFolder();
private PlayerManager mPlayerManager;
private TestLinkClickHandler mLinkClickHandler;
private CallbackHelper mRefreshedCallback;
private boolean mInitializationFailed;
/**
* LinkClickHandler implementation for caching the last URL that was clicked.
*/
public class TestLinkClickHandler implements LinkClickHandler {
GURL mUrl;
@Override
public void onLinkClicked(GURL url) {
mUrl = url;
}
}
@Override
public void tearDownTest() throws Exception {
super.tearDownTest();
CallbackHelper destroyed = new CallbackHelper();
PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> {
mPlayerManager.destroy();
destroyed.notifyCalled();
});
destroyed.waitForFirst();
}
private void displayTest(boolean multipleFrames) {
initPlayerManager(multipleFrames);
final View playerHostView = mPlayerManager.getView();
final View activityContentView = getActivity().findViewById(android.R.id.content);
// Assert that the player view has the same dimensions as the content view.
CriteriaHelper.pollUiThread(() -> {
Criteria.checkThat(activityContentView.getWidth(), Matchers.greaterThan(0));
Criteria.checkThat(activityContentView.getHeight(), Matchers.greaterThan(0));
Criteria.checkThat(
activityContentView.getWidth(), Matchers.is(playerHostView.getWidth()));
Criteria.checkThat(
activityContentView.getHeight(), Matchers.is(playerHostView.getHeight()));
}, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
}
/**
* Tests the the player correctly initializes and displays a sample paint preview with 1 frame.
*/
@Test
@MediumTest
public void singleFrameDisplayTest() {
displayTest(false);
}
/**
* Tests the player correctly initializes and displays a sample paint preview with multiple
* frames.
*/
@Test
@MediumTest
public void multiFrameDisplayTest() {
displayTest(true);
}
/**
* Tests that link clicks in the player work correctly.
*/
@Test
@MediumTest
@DisableIf.Build(message = "Test is failing on Android P, see crbug.com/1110939.",
sdk_is_greater_than = VERSION_CODES.O_MR1, sdk_is_less_than = VERSION_CODES.Q)
public void linkClickTest() {
initPlayerManager(false);
final View playerHostView = mPlayerManager.getView();
// Click on a link that is visible in the default viewport.
assertLinkUrl(playerHostView, 720, 670, TEST_IN_VIEWPORT_LINK_URL);
assertLinkUrl(playerHostView, 880, 675, TEST_IN_VIEWPORT_LINK_URL);
assertLinkUrl(playerHostView, 800, 680, TEST_IN_VIEWPORT_LINK_URL);
// Scroll to the bottom, and click on a link.
scrollToBottom();
assertLinkUrl(playerHostView, 320, 4920, TEST_OUT_OF_VIEWPORT_LINK_URL);
assertLinkUrl(playerHostView, 375, 4950, TEST_OUT_OF_VIEWPORT_LINK_URL);
assertLinkUrl(playerHostView, 430, 4980, TEST_OUT_OF_VIEWPORT_LINK_URL);
}
@Test
@MediumTest
public void nestedLinkClickTest() throws Exception {
initPlayerManager(true);
final View playerHostView = mPlayerManager.getView();
assertLinkUrl(playerHostView, 220, 220, TEST_IN_VIEWPORT_LINK_URL);
assertLinkUrl(playerHostView, 300, 270, TEST_IN_VIEWPORT_LINK_URL);
UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
int deviceHeight = device.getDisplayHeight();
int statusBarHeight = statusBarHeight();
int navigationBarHeight = navigationBarHeight();
int padding = 20;
int fromY = deviceHeight - navigationBarHeight - padding;
int toY = statusBarHeight + padding;
mLinkClickHandler.mUrl = null;
device.swipe(300, fromY, 300, toY, 10);
// Manually click as assertLinkUrl() doesn't handle subframe scrolls well.
assertLinkUrl(playerHostView, 200, 1500, TEST_OUT_OF_VIEWPORT_LINK_URL);
}
@Test
@MediumTest
public void overscrollRefreshTest() throws Exception {
initPlayerManager(true);
UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
int deviceHeight = uiDevice.getDisplayHeight();
int statusBarHeight = statusBarHeight();
int navigationBarHeight = navigationBarHeight();
int padding = 20;
int toY = deviceHeight - navigationBarHeight - padding;
int fromY = statusBarHeight + padding;
uiDevice.swipe(50, fromY, 50, toY, 5);
mRefreshedCallback.waitForFirst();
}
/**
* Tests that an initialization failure is reported properly.
*/
@Test
@MediumTest
public void initializationCallbackErrorReported() throws Exception {
CallbackHelper compositorErrorCallback = new CallbackHelper();
mLinkClickHandler = new TestLinkClickHandler();
PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> {
PaintPreviewTestService service =
new PaintPreviewTestService(mTempFolder.getRoot().getPath());
// Use the wrong URL to simulate a failure.
mPlayerManager = new PlayerManager(new GURL("about:blank"), getActivity(), service,
TEST_DIRECTORY_KEY, mLinkClickHandler,
() -> { Assert.fail("Unexpected overscroll refresh attempted."); },
() -> {
Assert.fail("View Ready callback occurred, but expected a failure.");
}, null,
0xffffffff, () -> { compositorErrorCallback.notifyCalled(); }, false);
mPlayerManager.setCompressOnClose(false);
});
compositorErrorCallback.waitForFirst();
}
private void scaleSmokeTest(boolean multiFrame) throws Exception {
initPlayerManager(multiFrame);
UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
// Query all FrameLayout objects as the PlayerFrameView isn't recognized.
List<UiObject2> objects = device.findObjects(By.clazz("android.widget.FrameLayout"));
int viewAxHashCode = mPlayerManager.getView().createAccessibilityNodeInfo().hashCode();
boolean didPinch = false;
for (UiObject2 object : objects) {
// To ensure we only apply the gesture to the right FrameLayout we compare the hash
// codes of the underlying accessibility nodes which are equivalent for the same
// view. Hence we can avoid the lack of direct access to View objects from UiAutomator.
if (object.hashCode() != viewAxHashCode) continue;
// Just zoom in and out. The goal here is to just exercise the zoom pathway and ensure
// it doesn't smoke when driven by gestures. There are more comprehensive tests for this
// in PlayerFrameMediatorTest and PlayerFrameScaleController.
object.pinchOpen(0.3f);
object.pinchClose(0.2f);
object.pinchClose(0.1f);
didPinch = true;
}
Assert.assertTrue("Failed to pinch player view.", didPinch);
}
/**
* Tests that scaling works and doesn't crash.
*/
@Test
@MediumTest
public void singleFrameScaleSmokeTest() throws Exception {
scaleSmokeTest(false);
}
/**
* Tests that scaling works and doesn't crash with multiple frames.
*/
@Test
@MediumTest
public void multiFrameScaleSmokeTest() throws Exception {
scaleSmokeTest(true);
}
private int statusBarHeight() {
Rect visibleContentRect = new Rect();
getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(visibleContentRect);
return visibleContentRect.top;
}
private int navigationBarHeight() {
int navigationBarHeight = 100;
int resourceId = getActivity().getResources().getIdentifier(
"navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
navigationBarHeight = getActivity().getResources().getDimensionPixelSize(resourceId);
}
return navigationBarHeight;
}
/**
* Scrolls to the bottom fo the paint preview.
*/
private void scrollToBottom() {
UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
int deviceHeight = uiDevice.getDisplayHeight();
int statusBarHeight = statusBarHeight();
int navigationBarHeight = navigationBarHeight();
int padding = 20;
int swipeSteps = 5;
int viewPortBottom = deviceHeight - statusBarHeight - navigationBarHeight;
int fromY = deviceHeight - navigationBarHeight - padding;
int toY = statusBarHeight + padding;
int delta = fromY - toY;
while (viewPortBottom < scaleAbsoluteCoordinateToViewCoordinate(TEST_PAGE_HEIGHT)) {
uiDevice.swipe(50, fromY, 50, toY, swipeSteps);
viewPortBottom += delta;
}
// Repeat an addition time to avoid flakiness.
uiDevice.swipe(50, fromY, 50, toY, swipeSteps);
}
private void initSingleSkp(PaintPreviewTestService service) {
FrameData singleFrame = new FrameData(new Size(TEST_PAGE_WIDTH, TEST_PAGE_HEIGHT),
new Rect[] {mInViewportLinkRect, mOutOfViewportLinkRect},
new String[] {TEST_IN_VIEWPORT_LINK_URL, TEST_OUT_OF_VIEWPORT_LINK_URL},
new Rect[] {}, new FrameData[] {});
Assert.assertTrue(service.createFramesForKey(TEST_DIRECTORY_KEY, TEST_URL, singleFrame));
}
private void initMultiSkp(PaintPreviewTestService service) {
// This creates a frame tree of the form
//
// Main
// / \
// A B
// | |
// C D
//
// A: Doesn't scroll contains a nested c
// B: Scrolls contains a nested d out of frame
// C: Doesn't scroll
// D: Scrolls
FrameData childD = new FrameData(new Size(300, 500), new Rect[] {}, new String[] {},
new Rect[] {}, new FrameData[] {});
FrameData childB =
new FrameData(new Size(900, 3000), new Rect[] {new Rect(50, 2300, 250, 2800)},
new String[] {TEST_OUT_OF_VIEWPORT_LINK_URL},
new Rect[] {new Rect(50, 2000, 150, 2100)}, new FrameData[] {childD});
// Link is located at 200, 200.
FrameData childC = new FrameData(new Size(400, 200),
new Rect[] {new Rect(50, 50, 300, 200)}, new String[] {TEST_IN_VIEWPORT_LINK_URL},
new Rect[] {}, new FrameData[] {});
FrameData childA = new FrameData(new Size(500, 300), new Rect[] {}, new String[] {},
new Rect[] {new Rect(50, 50, 450, 250)}, new FrameData[] {childC});
FrameData rootFrame = new FrameData(new Size(TEST_PAGE_WIDTH, TEST_PAGE_HEIGHT),
new Rect[] {mInViewportLinkRect, mOutOfViewportLinkRect},
new String[] {TEST_IN_VIEWPORT_LINK_URL, TEST_OUT_OF_VIEWPORT_LINK_URL},
new Rect[] {new Rect(100, 100, 600, 400), new Rect(50, 1000, 900, 2000)},
new FrameData[] {childA, childB});
Assert.assertTrue(service.createFramesForKey(TEST_DIRECTORY_KEY, TEST_URL, rootFrame));
}
private void initPlayerManager(boolean multiSkp) {
mLinkClickHandler = new TestLinkClickHandler();
mRefreshedCallback = new CallbackHelper();
CallbackHelper viewReady = new CallbackHelper();
mInitializationFailed = false;
PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> {
PaintPreviewTestService service =
new PaintPreviewTestService(mTempFolder.getRoot().getPath());
if (multiSkp) {
initMultiSkp(service);
} else {
initSingleSkp(service);
}
mPlayerManager = new PlayerManager(new GURL(TEST_URL), getActivity(), service,
TEST_DIRECTORY_KEY, mLinkClickHandler, mRefreshedCallback::notifyCalled,
viewReady::notifyCalled, null, 0xffffffff,
() -> { mInitializationFailed = true; }, false);
mPlayerManager.setCompressOnClose(false);
getActivity().setContentView(mPlayerManager.getView());
});
// Wait until PlayerManager is initialized.
CriteriaHelper.pollUiThread(() -> {
Criteria.checkThat(
"PlayerManager was not initialized.", mPlayerManager, Matchers.notNullValue());
}, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
try {
viewReady.waitForFirst();
} catch (Exception e) {
if (mInitializationFailed) {
Assert.fail("Compositor intialization failed.");
} else {
Assert.fail("View ready was not called.");
}
}
// Assert that the player view is added to the player host view.
CriteriaHelper.pollUiThread(() -> {
Criteria.checkThat("Player view is not added to the host view.",
((ViewGroup) mPlayerManager.getView()).getChildCount(),
Matchers.greaterThan(0));
}, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
CriteriaHelper.pollUiThread(() -> {
Criteria.checkThat("Required bitmaps were not loaded.",
mPlayerManager.checkRequiredBitmapsLoadedForTest(), Matchers.is(true));
}, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
if (mInitializationFailed) {
Assert.fail("Compositor may have crashed.");
}
}
/*
* Scales the provided coordinate to be view relative
*/
private int scaleAbsoluteCoordinateToViewCoordinate(int coordinate) {
float scaleFactor = (float) mPlayerManager.getView().getWidth() / (float) TEST_PAGE_WIDTH;
return Math.round((float) coordinate * scaleFactor);
}
/*
* Asserts that the expectedUrl is found in the view at absolute coordinates x and y.
*/
private void assertLinkUrl(View view, int x, int y, String expectedUrl) {
int scaledX = scaleAbsoluteCoordinateToViewCoordinate(x);
int scaledY = scaleAbsoluteCoordinateToViewCoordinate(y);
// In this test scaledY will only exceed the view height if scrolled to the bottom of a
// page.
if (scaledY > view.getHeight()) {
scaledY = view.getHeight()
- (scaleAbsoluteCoordinateToViewCoordinate(TEST_PAGE_HEIGHT) - scaledY);
}
mLinkClickHandler.mUrl = null;
int[] locationXY = new int[2];
view.getLocationOnScreen(locationXY);
UiDevice device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
device.click(scaledX + locationXY[0], scaledY + locationXY[1]);
CriteriaHelper.pollUiThread(() -> {
GURL url = mLinkClickHandler.mUrl;
String msg = "Link press on abs (" + x + ", " + y + ") failed.";
Criteria.checkThat(msg, url, Matchers.notNullValue());
Criteria.checkThat(msg, url.getSpec(), Matchers.is(expectedUrl));
}, TIMEOUT_MS, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
}
}
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
9bd0277ae94b84246ba64b03f33041e4b1f94136 | 280fcf363fd1e56da910a676835fdc5d1d17ecac | /SpringSecurity01/src/main/java/com/springsecurity01/dto/NoteDTO.java | a7ed6f08223058a26ed5222106344d0ef1645455 | [] | no_license | MyNameIsToan/Repository12102021 | 7af23ac490f221252ffcbcf24a6e10b92cad5f79 | 8e35fcb00ab6d128735bdc3303bbe1ff781d7df5 | refs/heads/main | 2023-08-10T15:59:08.468450 | 2021-10-12T09:45:30 | 2021-10-12T09:45:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 226 | java | package com.springsecurity01.dto;
import lombok.Data;
@Data
public class NoteDTO {
private Long id;
private Long parentid;
private String content;
private String username;
private int haschild;
private int isfinish;
}
| [
"18110055@student.hcmute.edu.vn"
] | 18110055@student.hcmute.edu.vn |
ee5c0ced1706aba8d4b33f4ef074eb92927fcd47 | de7b67d4f8aa124f09fc133be5295a0c18d80171 | /workspace_xfire/xfire-autoGeneration/chi/cn/chimelong/agent/ws/QueryAllEspecialTicketResponse.java | 307e68bc673bdd02b52c596a511386922daeef10 | [] | no_license | lin-lee/eclipse_workspace_test | adce936e4ae8df97f7f28965a6728540d63224c7 | 37507f78bc942afb11490c49942cdfc6ef3dfef8 | refs/heads/master | 2021-05-09T10:02:55.854906 | 2018-01-31T07:19:02 | 2018-01-31T07:19:02 | 119,460,523 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,632 | java |
package cn.chimelong.agent.ws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import cn.grgbanking.apt.pojos.ticket.ArrayOfEspecialTicket;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="out" type="{http://ticket.pojos.apt.grgbanking.cn}ArrayOfEspecialTicket"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"out"
})
@XmlRootElement(name = "QueryAllEspecialTicketResponse")
public class QueryAllEspecialTicketResponse {
@XmlElement(required = true, nillable = true)
protected ArrayOfEspecialTicket out;
/**
* Gets the value of the out property.
*
* @return
* possible object is
* {@link ArrayOfEspecialTicket }
*
*/
public ArrayOfEspecialTicket getOut() {
return out;
}
/**
* Sets the value of the out property.
*
* @param value
* allowed object is
* {@link ArrayOfEspecialTicket }
*
*/
public void setOut(ArrayOfEspecialTicket value) {
this.out = value;
}
}
| [
"lilin@lvmama.com"
] | lilin@lvmama.com |
93e3ec721d733d449199450ff959dcc4931b54cd | 3b8215663b541f7487b5f20cef1c3d24ad7ded00 | /app/src/main/java/com/muhaiminur/videocall_voximplant_android/MainActivity.java | c27d6a7ae7a0f96dc493d6e6d1270b82812e1178 | [] | no_license | Muhaiminur/VIDEOCALL_VOXIMPLANT_ANDROID | 10e28331cfe7e93b3c2cb4a6714a576499f17e3b | bde889d1a20400d4b941de00cfcad1de681e1c1a | refs/heads/master | 2020-04-07T19:35:26.175902 | 2018-11-22T06:47:40 | 2018-11-22T06:47:40 | 158,654,651 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,179 | java | package com.muhaiminur.videocall_voximplant_android;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Button;
import com.karan.churi.PermissionManager.PermissionManager;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends AppCompatActivity {
PermissionManager permissionManager;
@BindView(R.id.video_call)
Button videoCall;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
permissionManager = new PermissionManager() {
};
permissionManager.checkAndRequestPermissions(MainActivity.this);
}
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
permissionManager.checkResult(requestCode, permissions, grantResults);
}
@OnClick(R.id.video_call)
public void onViewClicked() {
startActivity(new Intent(MainActivity.this,Video_Call.class));
}
}
| [
"muhaiminurabir@gmail.com"
] | muhaiminurabir@gmail.com |
f6435154836310483c38c818274fedacb33688c7 | f630dfac1b7235d22ee4ff672584b104ef400e4f | /src/main/java/com/oem/util/StringUtil.java | d188036506d733130e5b710bd6a14e34db92959c | [] | no_license | MaYunGuo/oem-test | fcb8c77a18fd311bdb3d1792ef3b27dbe134ef95 | 60d5ee55bd84c692710c9d217343fafb05225212 | refs/heads/master | 2022-07-28T11:27:22.345740 | 2019-06-21T10:14:16 | 2019-06-21T10:14:16 | 197,700,743 | 0 | 0 | null | 2022-06-21T01:28:24 | 2019-07-19T04:16:26 | JavaScript | UTF-8 | Java | false | false | 1,811 | java | package com.oem.util;
import java.io.PrintWriter;
import java.io.StringWriter;
public class StringUtil {
public static boolean isSpaceCheck(String str) {
if (null == str || str.length() <= 0 || ("").equals(str)) {
return true;
}
return false;
}
public static String stackTraceToString(Exception excp) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
excp.printStackTrace(pw);
pw.flush();
sw.flush();
return sw.toString();
}
public static String comInt2String(int value, int length) {
String s = String.valueOf(value);
if (s.length() > length) {
throw new RuntimeException("length is too short.");
} else if (s.length() == length) {
return s;
} else {
char[] cc = new char[length];
int i = 0;
for (; i < length - s.length(); i++) {
cc[i] = '0';
}
for (int j=0; j < s.length();i++,j++) {
// System.out.println(i);
cc[i] = s.charAt(j);
}
return new String(cc);
}
}
public static String comString2String(String s, int length) {
if (s.length() > length) {
throw new RuntimeException("length is too short.");
} else if (s.length() == length) {
return s;
} else {
char[] cc = new char[length];
int i = 0;
for (; i < length - s.length(); i++) {
cc[i] = '0';
}
for (int j=0; j < s.length();i++,j++) {
// System.out.println(i);
cc[i] = s.charAt(j);
}
return new String(cc);
}
}
}
| [
"374295981@qq.com"
] | 374295981@qq.com |
9bf62194220ae0fd8f9150f60a37062c308d6a71 | 8ed5583d1af3dbc84b9be7aea6092c4b853ca94e | /src/test/java/com/rahul/demo/TestJustificationTest.java | 5221be4116e944e7d2c2266d0b1bb4a4941fc5a8 | [] | no_license | thatrahul/legendary-eureka | e69458c25d41a1a2785789ee7d5b596679245128 | 544146f4e428f158480b34194104c1b4a49ba105 | refs/heads/master | 2021-07-05T02:25:49.351857 | 2017-09-27T05:11:23 | 2017-09-27T05:19:49 | 104,973,556 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package com.rahul.demo;
import org.junit.Test;
/**
* Created by xbbl129 on 5/30/17.
*/
@Ignore
public class TestJustificationTest {
@Test
public void textJustification() throws Exception {
String[] words = {"This", "is", "an", "example", "of", "text", "justification."};
int length = 16;
String[] lines = new TextJustification().textJustification(words, length);
for (int i =0; i<lines.length; i++) {
System.out.println(lines[i]);
}
}
} | [
"rahul.phadnis@bnymellon.com"
] | rahul.phadnis@bnymellon.com |
1af21338c3e3eb7a33e8fb03af3a7991568a637c | c7061fd9015065d556ab1dc65e65a9460159a14c | /src/main/java/com/yifan/controller/TestController.java | 4e4cfa691ea6050010973b72cfbba66d6127a538 | [] | no_license | yifan2333/yifan-security | 8cc46a3c6a44f4a6babfd4b84af3db3a2c7499c2 | 33d7a0e8832829df272e68f956ad3320a709f0a3 | refs/heads/master | 2022-06-27T13:03:42.812402 | 2019-12-06T07:25:38 | 2019-12-06T07:25:38 | 226,270,182 | 0 | 0 | null | 2022-06-17T02:41:54 | 2019-12-06T07:22:43 | Java | UTF-8 | Java | false | false | 445 | java | package com.yifan.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
*
*
* @author: wuyifan
* @since: 2019年11月18日 下午2:34
* @version 1.0
*/
@Controller
public class TestController {
@GetMapping("test")
@ResponseBody
public String test() {
return "test";
}
}
| [
"wuyifanc@enn.com"
] | wuyifanc@enn.com |
ebbd254b666d9379804d49e03ea3b8f3b1144fee | 8cb1752acec0400400c0b33737e982f980a4eb9e | /aosp/android-4.0.1_r1/frameworks/base/core/tests/coretests/src/android/os/storage/AsecTests.java | 5efbd88530609ff87430960163f655e4184728ec | [] | no_license | jollen/android-framework-mokoid | 80c1698743dac66df0ba6ba9db480731386d92c0 | 1075260ce25d320a73a3519af686e615c044d9fe | refs/heads/master | 2023-04-02T12:58:40.057364 | 2021-04-15T01:24:15 | 2021-04-15T01:24:34 | 6,413,284 | 29 | 16 | null | null | null | null | UTF-8 | Java | false | false | 20,773 | java | /*
* Copyright (C) 2006 The Android Open Source Project
*
* 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 android.os.storage;
import android.content.Context;
import android.os.Environment;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.test.AndroidTestCase;
import android.util.Log;
import java.io.File;
import java.io.FileOutputStream;
import junit.framework.Assert;
public class AsecTests extends AndroidTestCase {
private static final boolean localLOGV = true;
public static final String TAG="AsecTests";
void failStr(String errMsg) {
Log.w(TAG, "errMsg="+errMsg);
}
void failStr(Exception e) {
Log.w(TAG, "e.getMessage="+e.getMessage());
Log.w(TAG, "e="+e);
}
@Override
protected void setUp() throws Exception {
super.setUp();
if (localLOGV) Log.i(TAG, "Cleaning out old test containers");
cleanupContainers();
}
@Override
protected void tearDown() throws Exception {
super.tearDown();
if (localLOGV) Log.i(TAG, "Cleaning out old test containers");
cleanupContainers();
}
private void cleanupContainers() throws RemoteException {
IMountService ms = getMs();
String[] containers = ms.getSecureContainerList();
for (int i = 0; i < containers.length; i++) {
if (containers[i].startsWith("com.android.unittests.AsecTests.")) {
ms.destroySecureContainer(containers[i], true);
}
}
}
private boolean containerExists(String localId) throws RemoteException {
IMountService ms = getMs();
String[] containers = ms.getSecureContainerList();
String fullId = "com.android.unittests.AsecTests." + localId;
for (int i = 0; i < containers.length; i++) {
if (containers[i].equals(fullId)) {
return true;
}
}
return false;
}
private int createContainer(String localId, int size, String key) throws RemoteException {
Assert.assertTrue(isMediaMounted());
String fullId = "com.android.unittests.AsecTests." + localId;
IMountService ms = getMs();
return ms.createSecureContainer(fullId, size, "fat", key, android.os.Process.myUid());
}
private int mountContainer(String localId, String key) throws RemoteException {
Assert.assertTrue(isMediaMounted());
String fullId = "com.android.unittests.AsecTests." + localId;
IMountService ms = getMs();
return ms.mountSecureContainer(fullId, key, android.os.Process.myUid());
}
private int renameContainer(String localId1, String localId2) throws RemoteException {
Assert.assertTrue(isMediaMounted());
String fullId1 = "com.android.unittests.AsecTests." + localId1;
String fullId2 = "com.android.unittests.AsecTests." + localId2;
IMountService ms = getMs();
return ms.renameSecureContainer(fullId1, fullId2);
}
private int unmountContainer(String localId, boolean force) throws RemoteException {
Assert.assertTrue(isMediaMounted());
String fullId = "com.android.unittests.AsecTests." + localId;
IMountService ms = getMs();
return ms.unmountSecureContainer(fullId, force);
}
private int destroyContainer(String localId, boolean force) throws RemoteException {
Assert.assertTrue(isMediaMounted());
String fullId = "com.android.unittests.AsecTests." + localId;
IMountService ms = getMs();
return ms.destroySecureContainer(fullId, force);
}
private boolean isContainerMounted(String localId) throws RemoteException {
Assert.assertTrue(isMediaMounted());
String fullId = "com.android.unittests.AsecTests." + localId;
IMountService ms = getMs();
return ms.isSecureContainerMounted(fullId);
}
private IMountService getMs() {
IBinder service = ServiceManager.getService("mount");
if (service != null) {
return IMountService.Stub.asInterface(service);
} else {
Log.e(TAG, "Can't get mount service");
}
return null;
}
private boolean isMediaMounted() {
try {
String mPath = Environment.getExternalStorageDirectory().toString();
String state = getMs().getVolumeState(mPath);
return Environment.MEDIA_MOUNTED.equals(state);
} catch (RemoteException e) {
failStr(e);
return false;
}
}
public void testCreateContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testCreateContainer", 4, "none"));
Assert.assertEquals(true, containerExists("testCreateContainer"));
} catch (Exception e) {
failStr(e);
}
}
public void testCreateMinSizeContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testCreateContainer", 1, "none"));
Assert.assertEquals(true, containerExists("testCreateContainer"));
} catch (Exception e) {
failStr(e);
}
}
public void testCreateZeroSizeContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationFailedInternalError,
createContainer("testCreateZeroContainer", 0, "none"));
} catch (Exception e) {
failStr(e);
}
}
public void testCreateDuplicateContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testCreateDupContainer", 4, "none"));
Assert.assertEquals(StorageResultCode.OperationFailedInternalError,
createContainer("testCreateDupContainer", 4, "none"));
} catch (Exception e) {
failStr(e);
}
}
public void testDestroyContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testDestroyContainer", 4, "none"));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
destroyContainer("testDestroyContainer", false));
} catch (Exception e) {
failStr(e);
}
}
public void testMountContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testMountContainer", 4, "none"));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
unmountContainer("testMountContainer", false));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
mountContainer("testMountContainer", "none"));
} catch (Exception e) {
failStr(e);
}
}
public void testMountBadKey() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testMountBadKey", 4, "00000000000000000000000000000000"));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
unmountContainer("testMountBadKey", false));
Assert.assertEquals(StorageResultCode.OperationFailedInternalError,
mountContainer("testMountContainer", "000000000000000000000000000000001"));
Assert.assertEquals(StorageResultCode.OperationFailedInternalError,
mountContainer("testMountContainer", "none"));
} catch (Exception e) {
failStr(e);
}
}
public void testNonExistPath() {
IMountService ms = getMs();
try {
String path = ms.getSecureContainerPath("jparks.broke.it");
failStr(path);
} catch (IllegalArgumentException e) {
} catch (Exception e) {
failStr(e);
}
}
public void testUnmountBusyContainer() {
IMountService ms = getMs();
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testUnmountBusyContainer", 4, "none"));
String path = ms.getSecureContainerPath("com.android.unittests.AsecTests.testUnmountBusyContainer");
File f = new File(path, "reference");
FileOutputStream fos = new FileOutputStream(f);
Assert.assertEquals(StorageResultCode.OperationFailedStorageBusy,
unmountContainer("testUnmountBusyContainer", false));
fos.close();
Assert.assertEquals(StorageResultCode.OperationSucceeded,
unmountContainer("testUnmountBusyContainer", false));
} catch (Exception e) {
failStr(e);
}
}
public void testDestroyBusyContainer() {
IMountService ms = getMs();
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testDestroyBusyContainer", 4, "none"));
String path = ms.getSecureContainerPath("com.android.unittests.AsecTests.testDestroyBusyContainer");
File f = new File(path, "reference");
FileOutputStream fos = new FileOutputStream(f);
Assert.assertEquals(StorageResultCode.OperationFailedStorageBusy,
destroyContainer("testDestroyBusyContainer", false));
fos.close();
Assert.assertEquals(StorageResultCode.OperationSucceeded,
destroyContainer("testDestroyBusyContainer", false));
} catch (Exception e) {
failStr(e);
}
}
public void testRenameContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testRenameContainer.1", 4, "none"));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
unmountContainer("testRenameContainer.1", false));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
renameContainer("testRenameContainer.1", "testRenameContainer.2"));
Assert.assertEquals(false, containerExists("testRenameContainer.1"));
Assert.assertEquals(true, containerExists("testRenameContainer.2"));
} catch (Exception e) {
failStr(e);
}
}
public void testRenameSrcMountedContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testRenameContainer.1", 4, "none"));
Assert.assertEquals(StorageResultCode.OperationFailedStorageMounted,
renameContainer("testRenameContainer.1", "testRenameContainer.2"));
} catch (Exception e) {
failStr(e);
}
}
public void testRenameDstMountedContainer() {
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testRenameContainer.1", 4, "none"));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
unmountContainer("testRenameContainer.1", false));
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testRenameContainer.2", 4, "none"));
Assert.assertEquals(StorageResultCode.OperationFailedStorageMounted,
renameContainer("testRenameContainer.1", "testRenameContainer.2"));
} catch (Exception e) {
failStr(e);
}
}
public void testContainerSize() {
IMountService ms = getMs();
try {
Assert.assertEquals(StorageResultCode.OperationSucceeded,
createContainer("testContainerSize", 1, "none"));
String path = ms.getSecureContainerPath("com.android.unittests.AsecTests.testUnmountBusyContainer");
byte[] buf = new byte[4096];
File f = new File(path, "reference");
FileOutputStream fos = new FileOutputStream(f);
for (int i = 0; i < (1024 * 1024); i+= buf.length) {
fos.write(buf);
}
fos.close();
} catch (Exception e) {
failStr(e);
}
}
/*------------ Tests for unmounting volume ---*/
public final long MAX_WAIT_TIME=120*1000;
public final long WAIT_TIME_INCR=20*1000;
boolean getMediaState() {
try {
String mPath = Environment.getExternalStorageDirectory().toString();
String state = getMs().getVolumeState(mPath);
return Environment.MEDIA_MOUNTED.equals(state);
} catch (RemoteException e) {
return false;
}
}
boolean mountMedia() {
if (getMediaState()) {
return true;
}
try {
String mPath = Environment.getExternalStorageDirectory().toString();
int ret = getMs().mountVolume(mPath);
return ret == StorageResultCode.OperationSucceeded;
} catch (RemoteException e) {
return false;
}
}
class StorageListener extends StorageEventListener {
String oldState;
String newState;
String path;
private boolean doneFlag = false;
public void action() {
synchronized (this) {
doneFlag = true;
notifyAll();
}
}
public boolean isDone() {
return doneFlag;
}
@Override
public void onStorageStateChanged(String path, String oldState, String newState) {
if (localLOGV) Log.i(TAG, "Storage state changed from " + oldState + " to " + newState);
this.oldState = oldState;
this.newState = newState;
this.path = path;
action();
}
}
private boolean unmountMedia() {
if (!getMediaState()) {
return true;
}
String path = Environment.getExternalStorageDirectory().toString();
StorageListener observer = new StorageListener();
StorageManager sm = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE);
sm.registerListener(observer);
try {
// Wait on observer
synchronized(observer) {
getMs().unmountVolume(path, false, false);
long waitTime = 0;
while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
observer.wait(WAIT_TIME_INCR);
waitTime += WAIT_TIME_INCR;
}
if(!observer.isDone()) {
throw new Exception("Timed out waiting for packageInstalled callback");
}
return true;
}
} catch (Exception e) {
return false;
} finally {
sm.unregisterListener(observer);
}
}
public void testUnmount() {
boolean oldStatus = getMediaState();
Log.i(TAG, "oldStatus="+oldStatus);
try {
// Mount media firsts
if (!getMediaState()) {
mountMedia();
}
assertTrue(unmountMedia());
} finally {
// Restore old status
boolean currStatus = getMediaState();
if (oldStatus != currStatus) {
if (oldStatus) {
// Mount media
mountMedia();
} else {
unmountMedia();
}
}
}
}
class MultipleStorageLis extends StorageListener {
int count = 0;
public void onStorageStateChanged(String path, String oldState, String newState) {
count++;
super.action();
}
}
/*
* This test invokes unmount multiple time and expects the call back
* to be invoked just once.
*/
public void testUnmountMultiple() {
boolean oldStatus = getMediaState();
StorageManager sm = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE);
MultipleStorageLis observer = new MultipleStorageLis();
try {
// Mount media firsts
if (!getMediaState()) {
mountMedia();
}
String path = Environment.getExternalStorageDirectory().toString();
sm.registerListener(observer);
// Wait on observer
synchronized(observer) {
for (int i = 0; i < 5; i++) {
getMs().unmountVolume(path, false, false);
}
long waitTime = 0;
while((!observer.isDone()) && (waitTime < MAX_WAIT_TIME) ) {
observer.wait(WAIT_TIME_INCR);
waitTime += WAIT_TIME_INCR;
}
if(!observer.isDone()) {
failStr("Timed out waiting for packageInstalled callback");
}
}
assertEquals(observer.count, 1);
} catch (Exception e) {
failStr(e);
} finally {
sm.unregisterListener(observer);
// Restore old status
boolean currStatus = getMediaState();
if (oldStatus != currStatus) {
if (oldStatus) {
// Mount media
mountMedia();
} else {
unmountMedia();
}
}
}
}
class ShutdownObserver extends IMountShutdownObserver.Stub{
private boolean doneFlag = false;
int statusCode;
public void action() {
synchronized (this) {
doneFlag = true;
notifyAll();
}
}
public boolean isDone() {
return doneFlag;
}
public void onShutDownComplete(int statusCode) throws RemoteException {
this.statusCode = statusCode;
action();
}
}
boolean invokeShutdown() {
IMountService ms = getMs();
ShutdownObserver observer = new ShutdownObserver();
synchronized (observer) {
try {
ms.shutdown(observer);
return true;
} catch (RemoteException e) {
failStr(e);
}
}
return false;
}
public void testShutdown() {
boolean oldStatus = getMediaState();
try {
// Mount media firsts
if (!getMediaState()) {
mountMedia();
}
assertTrue(invokeShutdown());
} finally {
// Restore old status
boolean currStatus = getMediaState();
if (oldStatus != currStatus) {
if (oldStatus) {
// Mount media
mountMedia();
} else {
unmountMedia();
}
}
}
}
/*
* This test invokes unmount multiple time and expects the call back
* to be invoked just once.
*/
public void testShutdownMultiple() {
boolean oldStatus = getMediaState();
try {
// Mount media firsts
if (!getMediaState()) {
mountMedia();
}
IMountService ms = getMs();
ShutdownObserver observer = new ShutdownObserver();
synchronized (observer) {
try {
ms.shutdown(observer);
for (int i = 0; i < 4; i++) {
ms.shutdown(null);
}
} catch (RemoteException e) {
failStr(e);
}
}
} finally {
// Restore old status
boolean currStatus = getMediaState();
if (oldStatus != currStatus) {
if (oldStatus) {
// Mount media
mountMedia();
} else {
unmountMedia();
}
}
}
}
}
| [
"jollen@jollen.org"
] | jollen@jollen.org |
4fc14ebaa0fbf1ac447995a1c28a80887dc78838 | 896797a503200c39cdd67bc93474d34bfac2a2cc | /.history/src/main/java/fr/romgrm/Game_20201106173009.java | 0a54202a4e2f86197b14d9dcce989ba5c0c10062 | [] | no_license | romgrm/jeuDuMorpion | 35c289c8bb2720925512c05db76cea55d9ffd710 | 290f555627989d7223aaa6df8f55adc728d88182 | refs/heads/master | 2023-01-11T00:56:58.678606 | 2020-11-11T11:32:23 | 2020-11-11T11:32:23 | 310,265,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,576 | java | package fr.romgrm;
import java.util.Scanner;
public class Game {
Planche planche; // J'apelle ma class Planche pour avoir une vue dessus
Player joueur_1 = new Player("Joueur 1", 'X'); // je créer l'instance de mon joueur 1
Player joueur_2 = new Player("Joueur 2", 'O'); // je créer l'instance de mon joueur 2
Planche plancheDeJeu = new Planche(); // je créer l'instance de ma grille de morpion
/****************************************************** CREATION DE LA PARTIE ***************************************************************/
public void newGame(){
System.out.println("Commençons une partie de Morpion !");
// je veux afficher la planche de morpion
// je dois donc créer une class planche de jeu et l'afficher ici
System.out.println("\n" + "Voici la planche de jeu");
plancheDeJeu.display();
System.out.println("\n" + this.joueur_1.getNomDuJoueur() + " tu auras le symbole : " + this.joueur_1.getSymbolJoueur() + "\n" + "Quant à toi " + this.joueur_2.getNomDuJoueur() + " tu auras le symbole : " + this.joueur_2.getSymbolJoueur());
}
/**************************************************************************************************************************************************/
/*************************************** LANCEMENT DE LA PARTIE ************************************************/
public void play(){
/* Boucle pour continuer de joueur tant que la partie n'est pas gagnée */
while (joueur_1.win(this.plancheDeJeu.grilleDeMorpion) != true) {
/* Condition a chq tour pour voir si un joueur a gagné */
if(joueur_1.win(this.plancheDeJeu.grilleDeMorpion) == true){
System.out.println(this.joueur_1.getNomDuJoueur() + " a gagné la partie !");
}else if(joueur_2.win(this.plancheDeJeu.grilleDeMorpion) == true){
System.out.println(this.joueur_2.getNomDuJoueur() + " a gagné la partie !");
}else{
System.out.println("Egalité parfaite !");
}
}
/* Tour du Joueur_1 */
System.out.println("C'est à ton tour" + this.joueur_1.getNomDuJoueur() + " , entre un nombre pour choisir une ligne : ");
Scanner scan = new Scanner(System.in);
int entreeRow = scan.nextInt();
System.out.println("Maintenant, entre un nombre pour choisir la colonne : ");
int entreeColumn = scan.nextInt();
/***************************************/
/* Envoie des données à notre instance de grille de morpion */
this.plancheDeJeu.fill(this.joueur_1.symbolJoueur , entreeRow, entreeColumn);
this.plancheDeJeu.display();
/***************************************/
/* Tour du Joueur_2 */
System.out.println("C'est à ton tour joueur 2, entre un nombre pour choisir une ligne : ");
Scanner scan2 = new Scanner(System.in);
int entreeRow2 = scan.nextInt();
System.out.println("Maintenant, entre un nombre pour choisir la colonne : ");
int entreeColumn2 = scan.nextInt();
this.plancheDeJeu.fill(this.joueur_2.symbolJoueur , entreeRow2, entreeColumn2);
this.plancheDeJeu.display();
/***************************************/
//joueur_1.win(this.plancheDeJeu.grilleDeMorpion);
}
/*****************************************************************************************************************/
} | [
"romaingreaume@gmail.com"
] | romaingreaume@gmail.com |
063e9e0b7e5bccc179517c0cab7f6e72facb202b | 2b806805edffc32ec7ec783d0f45c6a9825fb12c | /app/src/main/java/com/example/administrator/helloworld/HelloWorldActivity.java | 2839cf665f70d65c94ceeccb1219767cd9eda111 | [] | no_license | EvaMmw/HelloWorld | b6c47f8f8ebbf23c6dadc925e3af1c696928ff0c | b45f3bc5b17d599cf1e310202253c15c1d2c66e3 | refs/heads/master | 2021-04-09T15:10:03.117151 | 2018-03-18T14:44:11 | 2018-03-18T14:44:11 | 125,733,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.example.administrator.helloworld;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class HelloWorldActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello_world);
}
}
| [
"1376240765@qq.com"
] | 1376240765@qq.com |
323187d67a2ebb62aabd615d42478e1f3c5bd3e3 | df026e70b4fe4a10bb3da9d8096803808e076958 | /bak_001/jszx-spider/jszx-spider-platform/src/main/java/com/jszx/spider/platform/module/service/impl/ExampleServiceImpl.java | 5261e2166af02bc6d9ba07819efa14324965db25 | [] | no_license | ljt821226/spider | d0b1764d4219b096506bc19d99e5709932bdd19d | 00fe33fdcc9bcdbf2a412ae9b9960c6fa1b06cc6 | refs/heads/master | 2020-03-23T14:15:52.377235 | 2018-07-20T05:51:12 | 2018-07-24T08:41:13 | 141,666,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,385 | java | package com.jszx.spider.platform.module.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jszx.spider.platform.code.ReturnCode;
import com.jszx.spider.platform.exception.ServiceException;
import com.jszx.spider.platform.module.dao.ExampleDao;
import com.jszx.spider.platform.module.entity.ExampleEntity;
import com.jszx.spider.platform.module.entity.PageEntity;
import com.jszx.spider.platform.module.service.ExampleService;
/**
* [程序名称]:[程序功能描述]
*
* @version 1.0
* @author 2724216806@qq.com
* @date 2018年4月18日 下午2:35:16
*
*/
@Service("com.jszx.spider.platform.service.example")
public class ExampleServiceImpl implements ExampleService {
@Autowired
private ExampleDao exampleDao;
@Override
public ExampleEntity select(ExampleEntity entity) throws ServiceException {
try {
return entity;
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public ExampleEntity[] selectBatch(ExampleEntity entity) throws ServiceException {
try {
return exampleDao.selectBatch(entity);
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public ExampleEntity[] selectPage(ExampleEntity entity, PageEntity page) throws ServiceException {
try {
return exampleDao.selectPage(entity, page);
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public int insert(ExampleEntity entity) throws ServiceException {
try {
return exampleDao.insert(entity);
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public int insertBatch(ExampleEntity[] entities) throws ServiceException {
try {
// return exampleDao.insertBatch(entities);
return 1;
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public int update(ExampleEntity entity) throws ServiceException {
try {
return exampleDao.update(entity);
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public int updateBatch(ExampleEntity[] entities) throws ServiceException {
try {
return exampleDao.updateBatch(entities);
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public int delete(ExampleEntity entity) throws ServiceException {
try {
return exampleDao.delete(entity);
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
@Override
public int deleteBatch(ExampleEntity[] entities) throws ServiceException {
try {
return exampleDao.deleteBatch(entities);
} catch (Exception e) {
throw new ServiceException(ReturnCode.CODE.FAILURE.value(), ReturnCode.MESSAGE.FAILURE.value(), e);
}
}
}
| [
"lvjt_821226@users.noreply.github.com"
] | lvjt_821226@users.noreply.github.com |
cc26aa646d5b424bf78e8436866123f9ace2d4ea | b8f487de1c3071351739887291db153c3199ec0e | /src/main/java/com/broadcom/apdk/objects/Workflow.java | 8672ae780b60167ee5dba2f925630dc69e45c809 | [
"MIT"
] | permissive | wody/action-pack-sdk | eaed5aa95eab9230f6713594eaec5fea6908849f | 5f4984f826f1a92bc95891ea8f5f6285144cc7ef | refs/heads/master | 2022-07-17T06:09:15.764506 | 2020-05-15T13:42:36 | 2020-05-15T13:42:36 | 264,159,859 | 0 | 0 | MIT | 2020-05-15T10:03:51 | 2020-05-15T10:03:50 | null | UTF-8 | Java | false | false | 14,348 | java | package com.broadcom.apdk.objects;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.eclipse.persistence.oxm.annotations.XmlMarshalNullRepresentation;
import org.eclipse.persistence.oxm.annotations.XmlNullPolicy;
import org.eclipse.persistence.oxm.annotations.XmlPath;
@XmlRootElement(name = "JOBP")
@XmlType (propOrder={"title", "archiveKey1", "archiveKey2", "active", "type", "OHSubType", "syncs", "queue", "childQueue", "jobGroup",
"extReportDefault", "extReportAll", "extReportNone", "internalAccount", "autoDeactNo", "autoDeactErrorFreeAfterExec",
"autoDeactErrorFreeAfterRestart", "errorFreeStatus", "autoDeactAlways", "deactivationDelay", "generateAtRuntime",
"priority", "passPriority", "maxSimultaneousExec", "reuseHG", "waitForTasks", "abortTasks", "timezone", "resultEvalOkStatus",
"resultEvalExecIfNotOk", "JPASubType", "tasks", "options",
"maxReturnCode", "executeObjectIfAboveMaxReturnCode", "executeObjectIfAboveMaxReturnCodeFlag", "forecastEndStatus", "ERT",
"ertMethodDefault", "ertMethodFixed", "fixedERT", "ERTDynamicMethod", "mrtMethodDynamic", "ERTNumberOfPastRuns", "ERTCorrection",
"ERTDeviationExtent", "ERTIgnoreDeviations", "ERTMinimumRuns", "mrtMethodNone", "mrtMethodFixed", "fixedDuration", "mrtMethodERT",
"additionalDuration", "mrtMethodDate", "additionalDurationDays", "finishTime", "finishTimeTZ", "srtMethodNone", "srtMethodFixed",
"fixedSRT", "srtMethodERT", "SRTERT", "cancelIfRuntimDeviation", "executeObjectIfRuntimeDevitationFlag",
"executeObjectIfRuntimDeviation", "variablesAndPrompts", "deploymentFlag", "workflowTypeA", "workflowTypeC",
"applicationName", "workflowName", "componentName", "rollbackFlag", "backupObject", "rollbackObject", "backupPath",
"deleteBefore", "includeSubDirectories", "script", "documentation"})
public class Workflow extends ExecutableAutomicObject implements IWorkflow {
private String internalAccount;
private ExtendedReport extendedReport;
private String queue;
private DeactivationOnFinish deactivateOnFinish;
private String errorFreeStatus;
private Integer deactivationDelay;
private String resultEvalOkStatus;
private String resultEvalExec;
private Integer maxSimultaneousExec;
private Integer priority;
private String timezone;
private Boolean passPriority;
private Boolean waitForRemainingTasks;
private Boolean generateAtRuntime;
private String jobGroup;
private String childQueue;
private List<IWorkflowTask> tasks;
public Workflow() {
super();
initWorkflow();
}
public Workflow(String name) {
super(name);
initWorkflow();
}
private void initWorkflow() {
this.tasks = new ArrayList<IWorkflowTask>();
this.extendedReport = ExtendedReport.DEFAULT;
this.deactivateOnFinish = DeactivationOnFinish.AFTER_ERRORFREE_RESTART;
this.setQueue("CLIENT_QUEUE");
this.setErrorFreeStatus(null);
this.setDeactivationDelay(0);
this.setMaxSimultaneousExec(0);
this.setPriority(0);
this.setPassPriority(false);
this.setGenerateAtRuntime(false);
this.setWaitForRemainingTasks(true);
List<IWorkflowTask> initalTasks = new ArrayList<IWorkflowTask>();
initalTasks.add(new WorkflowStartTask());
initalTasks.add(new WorkflowEndTask());
setTasks(initalTasks);
}
public void setInternalAccount(String internalAccount) {
this.internalAccount = internalAccount;
}
@XmlPath("ATTR_JOBP[@state='1']/IntAccount/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getInternalAccount() {
return internalAccount;
}
public void setQueue(String queue) {
this.queue = queue;
}
@XmlPath("ATTR_JOBP[@state='1']/Queue/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getQueue() {
return queue;
}
public void setErrorFreeStatus(String status) {
this.errorFreeStatus = status;
}
@XmlPath("ATTR_JOBP[@state='1']/DeactWhen/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getErrorFreeStatus() {
return errorFreeStatus;
}
public void setDeactivationDelay(Integer minutes) {
this.deactivationDelay = minutes;
}
@XmlPath("ATTR_JOBP[@state='1']/DeactDelay/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public Integer getDeactivationDelay() {
return deactivationDelay;
}
public void setDeactivateOnFinish(DeactivationOnFinish deactivationOnFinish) {
this.deactivateOnFinish = deactivationOnFinish;
}
@XmlTransient
public DeactivationOnFinish getDeactivateOnFinish() {
return deactivateOnFinish;
}
public void setExtendedReport(ExtendedReport extendedReport) {
this.extendedReport = extendedReport;
}
@XmlTransient
public ExtendedReport getExtendedReport() {
return extendedReport;
}
public void setResultEvalOkStatus(String okStatus) {
this.resultEvalOkStatus = okStatus;
}
@XmlPath("ATTR_JOBP[@state='1']/RWhen/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getResultEvalOkStatus() {
return resultEvalOkStatus;
}
public void setResultEvalExecIfNotOk(String executableObjectName) {
this.resultEvalExec = executableObjectName;
}
@XmlPath("ATTR_JOBP[@state='1']/RExecute/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getResultEvalExecIfNotOk() {
return resultEvalExec;
}
public void setMaxSimultaneousExec(Integer maxExecutions) {
this.maxSimultaneousExec = maxExecutions;
}
@XmlPath("ATTR_JOBP[@state='1']/MaxParallel2/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public Integer getMaxSimultaneousExec() {
return maxSimultaneousExec;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
@XmlPath("ATTR_JOBP[@state='1']/UC4Priority/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public Integer getPriority() {
return priority;
}
public void setTimezone(String timezoneObjectName) {
this.timezone = timezoneObjectName;
}
@XmlPath("ATTR_JOBP[@state='1']/TZ/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getTimezone() {
return timezone;
}
public void setPassPriority(Boolean passPriority) {
this.passPriority = passPriority;
}
@XmlPath("ATTR_JOBP[@state='1']/PassPriority/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
public Boolean isPassPriority() {
return passPriority;
}
public void setGenerateAtRuntime(Boolean generateAtRuntime) {
this.generateAtRuntime = generateAtRuntime;
}
@XmlPath("ATTR_JOBP[@state='1']/ActAtRun/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
public Boolean getGenerateAtRuntime() {
return generateAtRuntime;
}
public void setWaitForRemainingTasks(Boolean waitForRemainingTasks) {
this.waitForRemainingTasks = waitForRemainingTasks;
}
@XmlTransient
public Boolean isWaitForRemainingTasks() {
return waitForRemainingTasks;
}
public void setJobGroup(String jobGroup) {
this.jobGroup = jobGroup;
}
@XmlPath("ATTR_JOBP[@state='1']/StartType/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getJobGroup() {
return jobGroup;
}
public void setChildQueue(String childQueue) {
this.childQueue = childQueue;
}
@XmlPath("ATTR_JOBP[@state='1']/ChildQueue/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public String getChildQueue() {
return childQueue;
}
public void setTasks(List<IWorkflowTask> tasks) {
this.tasks = addWorkflowToTasks(tasks);
}
@XmlAnyElement(lax = true)
@XmlElementWrapper
@XmlPath("JOBP[@state='1']/JobpStruct[@mode='design']")
@XmlJavaTypeAdapter(WorkflowTaskAdapter.class)
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
public List<IWorkflowTask> getTasks() {
List<IPromptSet> promptSets = getPromptSets();
// Add PromptSets defined in JOBP to the list of promptSets in each tasks
if (promptSets != null && !promptSets.isEmpty()) {
if (tasks != null && !tasks.isEmpty()) {
List<IWorkflowTask> newTaskList = new ArrayList<IWorkflowTask>();
for (IWorkflowTask task : tasks) {
List<IPromptSet> taskPromptSets = task.getPromptSets();
if (taskPromptSets == null) {
taskPromptSets = new ArrayList<IPromptSet>();
}
// Add PromptSet only if no PromptSet with the same name already exists
for (IPromptSet wfPromptSet : promptSets) {
boolean foundInTask = false;
for (IPromptSet taskPromptSet : taskPromptSets) {
if (taskPromptSet.getName().equals(wfPromptSet.getName())) {
foundInTask = true;
}
}
if (!foundInTask) {
taskPromptSets.add(wfPromptSet);
}
}
task.setPromptSets(taskPromptSets);
newTaskList.add(task);
}
return addWorkflowToTasks(newTaskList);
}
}
return tasks;
}
// Non-Public API
@XmlPath("JOBP[@state='1']/JobpStruct[@mode='design']/OPTIONS/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
String getOptions() {
return null;
}
@XmlPath("DEPLOYMENT[@state='1']/DeploymentFlag/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isDeploymentFlag() {
return false;
}
@XmlPath("DEPLOYMENT[@state='1']/WFTypeA/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isWorkflowTypeA() {
return true;
}
@XmlPath("DEPLOYMENT[@state='1']/WFTypeC/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isWorkflowTypeC() {
return false;
}
@XmlPath("DEPLOYMENT[@state='1']/AppName/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
String getApplicationName() {
return null;
}
@XmlPath("DEPLOYMENT[@state='1']/WFName/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
String getWorkflowName() {
return null;
}
@XmlPath("DEPLOYMENT[@state='1']/ComponentName/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
String getComponentName() {
return null;
}
@XmlPath("ATTR_JOBP[@state='1']/MpElse1/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
Boolean isWaitForTasks() {
if (this.waitForRemainingTasks != null) {
return this.waitForRemainingTasks ? true : false;
}
return null;
}
@XmlPath("ATTR_JOBP[@state='1']/MpElse2/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
Boolean isAbortTasks() {
if (this.waitForRemainingTasks != null) {
return this.waitForRemainingTasks ? false: true;
}
return null;
}
@XmlPath("ATTR_JOBP[@state='1']/ExtRepDef/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isExtReportDefault() {
if (ExtendedReport.DEFAULT.equals(this.extendedReport)) {
return true;
}
return false;
}
@XmlPath("ATTR_JOBP[@state='1']/ReuseHG/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isReuseHG() {
return true;
}
@XmlPath("ATTR_JOBP[@state='1']/ExtRepAll/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isExtReportAll() {
if (ExtendedReport.ALL.equals(this.extendedReport)) {
return true;
}
return false;
}
@XmlPath("ATTR_JOBP[@state='1']/ExtRepNone/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isExtReportNone() {
if (ExtendedReport.NONE.equals(this.extendedReport)) {
return true;
}
return false;
}
@XmlPath("ATTR_JOBP[@state='1']/AutoDeactNo/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isAutoDeactNo() {
if (DeactivationOnFinish.NEVER.equals(this.deactivateOnFinish)) {
return true;
}
return false;
}
@XmlPath("ATTR_JOBP[@state='1']/AutoDeactAlways/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isAutoDeactAlways() {
if (DeactivationOnFinish.ALWAYS.equals(this.deactivateOnFinish)) {
return true;
}
return false;
}
@XmlPath("ATTR_JOBP[@state='1']/AutoDeactErrorFree/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isAutoDeactErrorFreeAfterRestart() {
if (DeactivationOnFinish.AFTER_ERRORFREE_RESTART.equals(this.deactivateOnFinish)) {
return true;
}
return false;
}
@XmlPath("ATTR_JOBP[@state='1']/AutoDeact1ErrorFree/text()")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isAutoDeactErrorFreeAfterExec() {
if (DeactivationOnFinish.AFTER_ERRORFREE_EXEC.equals(this.deactivateOnFinish)) {
return true;
}
return false;
}
@XmlPath("ATTR_JOBP[@state='1']/JPA_SubType/text()")
@XmlNullPolicy(emptyNodeRepresentsNull = true, nullRepresentationForXml = XmlMarshalNullRepresentation.EMPTY_NODE)
String getJPASubType() {
return null;
}
@XmlAttribute(name = "AllowExternal")
@XmlJavaTypeAdapter(BooleanAdapter.class)
Boolean isAllowExternal() {
return true;
}
private List<IWorkflowTask> addWorkflowToTasks(List<IWorkflowTask> tasks) {
if (tasks != null) {
List<IWorkflowTask> newTasks = new ArrayList<IWorkflowTask>();
for (IWorkflowTask task : tasks) {
task.setWorkflow(this);
newTasks.add(task);
}
return newTasks;
}
return null;
}
}
| [
"mg685065@broadcom.net"
] | mg685065@broadcom.net |
ea24b6e49a60dc49bbb25f315f35e18649ffa379 | 50a606165ab25f79fb7f2070517fd5b17cd0fb29 | /_03_form_databinding/practice/form_and_databinding/src/main/java/model/Employee.java | 4d74029d86c5cf713e826440e1403facfaaa79ab | [] | no_license | thangdinh1607/C1220G2_NguyenThanhCong_Module4 | e6fccd7106f0d1e490565b51d01ff56f6c1e29ea | 34496df56e77fbd1379f1f10416570e83afc5820 | refs/heads/main | 2023-05-04T17:17:57.465757 | 2021-05-27T01:07:59 | 2021-05-27T01:07:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 587 | java | package model;
public class Employee {
private String id;
private String name;
private String contactNumber;
public Employee() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getContactNumber() {
return contactNumber;
}
public void setContactNumber(String contactNumber) {
this.contactNumber = contactNumber;
}
}
| [
"sirrin1991@gmail.com"
] | sirrin1991@gmail.com |
7337706ad0d41db70693e72ac13b8155a907a0b9 | ae5eb1a38b4d22c82dfd67c86db73592094edc4b | /project39/src/test/java/org/gradle/test/performance/largejavamultiproject/project39/p197/Test3943.java | 383e8976f4b24de2d8dd274295c76e6972c0fbb9 | [] | no_license | big-guy/largeJavaMultiProject | 405cc7f55301e1fd87cee5878a165ec5d4a071aa | 1cd6a3f9c59e9b13dffa35ad27d911114f253c33 | refs/heads/main | 2023-03-17T10:59:53.226128 | 2021-03-04T01:01:39 | 2021-03-04T01:01:39 | 344,307,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,171 | java | package org.gradle.test.performance.largejavamultiproject.project39.p197;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test3943 {
Production3943 objectUnderTest = new Production3943();
@Test
public void testProperty0() {
Production3940 value = new Production3940();
objectUnderTest.setProperty0(value);
assertEquals(value, objectUnderTest.getProperty0());
}
@Test
public void testProperty1() {
Production3941 value = new Production3941();
objectUnderTest.setProperty1(value);
assertEquals(value, objectUnderTest.getProperty1());
}
@Test
public void testProperty2() {
Production3942 value = new Production3942();
objectUnderTest.setProperty2(value);
assertEquals(value, objectUnderTest.getProperty2());
}
@Test
public void testProperty3() {
String value = "value";
objectUnderTest.setProperty3(value);
assertEquals(value, objectUnderTest.getProperty3());
}
@Test
public void testProperty4() {
String value = "value";
objectUnderTest.setProperty4(value);
assertEquals(value, objectUnderTest.getProperty4());
}
@Test
public void testProperty5() {
String value = "value";
objectUnderTest.setProperty5(value);
assertEquals(value, objectUnderTest.getProperty5());
}
@Test
public void testProperty6() {
String value = "value";
objectUnderTest.setProperty6(value);
assertEquals(value, objectUnderTest.getProperty6());
}
@Test
public void testProperty7() {
String value = "value";
objectUnderTest.setProperty7(value);
assertEquals(value, objectUnderTest.getProperty7());
}
@Test
public void testProperty8() {
String value = "value";
objectUnderTest.setProperty8(value);
assertEquals(value, objectUnderTest.getProperty8());
}
@Test
public void testProperty9() {
String value = "value";
objectUnderTest.setProperty9(value);
assertEquals(value, objectUnderTest.getProperty9());
}
} | [
"sterling.greene@gmail.com"
] | sterling.greene@gmail.com |
b0fb95137dc794503a6cb611ab1b4ba22712dcd3 | 4d38472b3e597ed61c6c9278e4b47012bb12c862 | /lineagehw/org/lineageos/hardware/HighTouchSensitivity.java | 17dda5a26410978bdb784273e34f6408486d5e2a | [
"Apache-2.0"
] | permissive | cm-3470/android_device_samsung_kminilte | 0cf58a9ad519d9c759557f15c2cc87c85940db32 | 2ce5a9d80c83f14e8faa6bd7348568251e8dd6fa | refs/heads/lineage-15.1 | 2020-05-21T13:53:24.385991 | 2018-03-10T13:30:37 | 2018-03-10T13:30:37 | 31,184,980 | 35 | 56 | null | 2018-07-28T12:59:16 | 2015-02-22T22:58:20 | C++ | UTF-8 | Java | false | false | 3,471 | java | /*
* Copyright (C) 2014 The CyanogenMod Project
* Copyright (C) 2017 The LineageOS Project
*
* 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.lineageos.hardware;
import org.lineageos.internal.util.FileUtils;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import android.util.Log;
/**
* Glove mode / high touch sensitivity
*/
public class HighTouchSensitivity {
private static String TAG = "HighTouchSensitivity";
private static String COMMAND_PATH = "/sys/class/sec/tsp/cmd";
/* FIXME: cyttsp5 driver does not have cmd_list entry */
//private static String COMMAND_LIST_PATH = "/sys/class/sec/tsp/cmd_list";
private static String COMMAND_RESULT_PATH = "/sys/class/sec/tsp/cmd_result";
private static String GLOVE_MODE = "glove_mode";
private static String GLOVE_MODE_ENABLE = "glove_mode,1";
private static String GLOVE_MODE_DISABLE = "glove_mode,0";
private static String STATUS_OK = ":OK";
/**
* Whether device supports high touch sensitivity.
*
* @return boolean Supported devices must return always true
*/
public static boolean isSupported() {
/*
File f = new File(COMMAND_PATH);
if (f.exists()) {
BufferedReader reader = null;
try {
String currentLine;
reader = new BufferedReader(new FileReader(COMMAND_LIST_PATH));
while ((currentLine = reader.readLine()) != null) {
if (GLOVE_MODE.equals(currentLine))
return true;
}
} catch (IOException e) {
// Ignore exception, will be false anyway
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
// Ignore exception, no recovery possible
}
}
}
}
return false;
*/
return true;
}
/** This method returns the current activation status of high touch sensitivity
*
* @return boolean Must be false if high touch sensitivity is not supported or not activated,
* or the operation failed while reading the status; true in any other case.
*/
public static boolean isEnabled() {
return FileUtils.readOneLine(COMMAND_RESULT_PATH).equals(GLOVE_MODE_ENABLE + STATUS_OK);
}
/**
* This method allows to setup high touch sensitivity status.
*
* @param status The new high touch sensitivity status
* @return boolean Must be false if high touch sensitivity is not supported or the operation
* failed; true in any other case.
*/
public static boolean setEnabled(boolean status) {
return FileUtils.writeLine(COMMAND_PATH, status ? GLOVE_MODE_ENABLE : GLOVE_MODE_DISABLE);
}
}
| [
"hennymcc@yahoo.de"
] | hennymcc@yahoo.de |
615b8a153aa1f7a29c173538368666858c27041d | 7f53ff59587c1feea58fb71f7eff5608a5846798 | /temp/ffout/client/net/minecraft/src/BlockPortal.java | 98d76bb3c1642725e67be25022a32f8a94d0a22a | [] | no_license | Orazur66/Minecraft-Client | 45c918d488f2f9fca7d2df3b1a27733813d957a5 | 70a0b63a6a347fd87a7dbe28c7de588f87df97d3 | refs/heads/master | 2021-01-15T17:08:18.072298 | 2012-02-14T21:29:14 | 2012-02-14T21:29:14 | 3,423,624 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,386 | java | // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode fieldsfirst
package net.minecraft.src;
import java.util.Random;
// Referenced classes of package net.minecraft.src:
// BlockBreakable, Material, IBlockAccess, World,
// Block, BlockFire, Entity, AxisAlignedBB
public class BlockPortal extends BlockBreakable
{
public BlockPortal(int i, int j)
{
super(i, j, Material.field_4260_x, false);
}
public AxisAlignedBB func_221_d(World world, int i, int j, int k)
{
return null;
}
public void func_238_a(IBlockAccess iblockaccess, int i, int j, int k)
{
if(iblockaccess.func_600_a(i - 1, j, k) == field_376_bc || iblockaccess.func_600_a(i + 1, j, k) == field_376_bc)
{
float f = 0.5F;
float f2 = 0.125F;
func_213_a(0.5F - f, 0.0F, 0.5F - f2, 0.5F + f, 1.0F, 0.5F + f2);
} else
{
float f1 = 0.125F;
float f3 = 0.5F;
func_213_a(0.5F - f1, 0.0F, 0.5F - f3, 0.5F + f1, 1.0F, 0.5F + f3);
}
}
public boolean func_217_b()
{
return false;
}
public boolean func_242_c()
{
return false;
}
public boolean func_4032_a_(World world, int i, int j, int k)
{
int l = 0;
int i1 = 0;
if(world.func_600_a(i - 1, j, k) == Block.field_405_aq.field_376_bc || world.func_600_a(i + 1, j, k) == Block.field_405_aq.field_376_bc)
{
l = 1;
}
if(world.func_600_a(i, j, k - 1) == Block.field_405_aq.field_376_bc || world.func_600_a(i, j, k + 1) == Block.field_405_aq.field_376_bc)
{
i1 = 1;
}
if(l == i1)
{
return false;
}
if(world.func_600_a(i - l, j, k - i1) == 0)
{
i -= l;
k -= i1;
}
for(int j1 = -1; j1 <= 2; j1++)
{
for(int l1 = -1; l1 <= 3; l1++)
{
boolean flag = j1 == -1 || j1 == 2 || l1 == -1 || l1 == 3;
if((j1 == -1 || j1 == 2) && (l1 == -1 || l1 == 3))
{
continue;
}
int j2 = world.func_600_a(i + l * j1, j + l1, k + i1 * j1);
if(flag)
{
if(j2 != Block.field_405_aq.field_376_bc)
{
return false;
}
continue;
}
if(j2 != 0 && j2 != Block.field_402_as.field_376_bc)
{
return false;
}
}
}
world.field_1043_h = true;
for(int k1 = 0; k1 < 2; k1++)
{
for(int i2 = 0; i2 < 3; i2++)
{
world.func_690_d(i + l * k1, j + i2, k + i1 * k1, Block.field_4047_bf.field_376_bc);
}
}
world.field_1043_h = false;
return true;
}
public void func_226_a(World world, int i, int j, int k, int l)
{
int i1 = 0;
int j1 = 1;
if(world.func_600_a(i - 1, j, k) == field_376_bc || world.func_600_a(i + 1, j, k) == field_376_bc)
{
i1 = 1;
j1 = 0;
}
int k1;
for(k1 = j; world.func_600_a(i, k1 - 1, k) == field_376_bc; k1--) { }
if(world.func_600_a(i, k1 - 1, k) != Block.field_405_aq.field_376_bc)
{
world.func_690_d(i, j, k, 0);
return;
}
int l1;
for(l1 = 1; l1 < 4 && world.func_600_a(i, k1 + l1, k) == field_376_bc; l1++) { }
if(l1 != 3 || world.func_600_a(i, k1 + l1, k) != Block.field_405_aq.field_376_bc)
{
world.func_690_d(i, j, k, 0);
return;
}
boolean flag = world.func_600_a(i - 1, j, k) == field_376_bc || world.func_600_a(i + 1, j, k) == field_376_bc;
boolean flag1 = world.func_600_a(i, j, k - 1) == field_376_bc || world.func_600_a(i, j, k + 1) == field_376_bc;
if(flag && flag1)
{
world.func_690_d(i, j, k, 0);
return;
}
if((world.func_600_a(i + i1, j, k + j1) != Block.field_405_aq.field_376_bc || world.func_600_a(i - i1, j, k - j1) != field_376_bc) && (world.func_600_a(i - i1, j, k - j1) != Block.field_405_aq.field_376_bc || world.func_600_a(i + i1, j, k + j1) != field_376_bc))
{
world.func_690_d(i, j, k, 0);
return;
} else
{
return;
}
}
public boolean func_260_c(IBlockAccess iblockaccess, int i, int j, int k, int l)
{
if(iblockaccess.func_600_a(i, j, k) == field_376_bc)
{
return false;
}
boolean flag = iblockaccess.func_600_a(i - 1, j, k) == field_376_bc && iblockaccess.func_600_a(i - 2, j, k) != field_376_bc;
boolean flag1 = iblockaccess.func_600_a(i + 1, j, k) == field_376_bc && iblockaccess.func_600_a(i + 2, j, k) != field_376_bc;
boolean flag2 = iblockaccess.func_600_a(i, j, k - 1) == field_376_bc && iblockaccess.func_600_a(i, j, k - 2) != field_376_bc;
boolean flag3 = iblockaccess.func_600_a(i, j, k + 1) == field_376_bc && iblockaccess.func_600_a(i, j, k + 2) != field_376_bc;
boolean flag4 = flag || flag1;
boolean flag5 = flag2 || flag3;
if(flag4 && l == 4)
{
return true;
}
if(flag4 && l == 5)
{
return true;
}
if(flag5 && l == 2)
{
return true;
}
return flag5 && l == 3;
}
public int func_229_a(Random random)
{
return 0;
}
public int func_234_g()
{
return 1;
}
public void func_236_b(World world, int i, int j, int k, Entity entity)
{
if(entity.field_616_af == null && entity.field_617_ae == null)
{
entity.func_4039_q();
}
}
public void func_247_b(World world, int i, int j, int k, Random random)
{
if(random.nextInt(100) == 0)
{
world.func_684_a((double)i + 0.5D, (double)j + 0.5D, (double)k + 0.5D, "portal.portal", 0.5F, random.nextFloat() * 0.4F + 0.8F);
}
for(int l = 0; l < 4; l++)
{
double d = (float)i + random.nextFloat();
double d1 = (float)j + random.nextFloat();
double d2 = (float)k + random.nextFloat();
double d3 = 0.0D;
double d4 = 0.0D;
double d5 = 0.0D;
int i1 = random.nextInt(2) * 2 - 1;
d3 = ((double)random.nextFloat() - 0.5D) * 0.5D;
d4 = ((double)random.nextFloat() - 0.5D) * 0.5D;
d5 = ((double)random.nextFloat() - 0.5D) * 0.5D;
if(world.func_600_a(i - 1, j, k) == field_376_bc || world.func_600_a(i + 1, j, k) == field_376_bc)
{
d2 = (double)k + 0.5D + 0.25D * (double)i1;
d5 = random.nextFloat() * 2.0F * (float)i1;
} else
{
d = (double)i + 0.5D + 0.25D * (double)i1;
d3 = random.nextFloat() * 2.0F * (float)i1;
}
world.func_694_a("portal", d, d1, d2, d3, d4, d5);
}
}
}
| [
"Ninja_Buta@hotmail.fr"
] | Ninja_Buta@hotmail.fr |
02be18d429eb65d2e2d616c88a914f5b2e8db464 | 462117f8f15d4032c64e812296f983a14495f8e4 | /app/src/test/java/org/difly/testandroidapp1/ExampleUnitTest.java | 82dc7d5308755d353662061a5f381843f750fbfa | [] | no_license | DiFly/TestAndroidApp1 | 2a15191ee28f4058d7c257baa857c20c607a9214 | 7751c6de41c1233d4cc49149376db4eb3ea11b36 | refs/heads/master | 2020-11-30T05:13:33.425014 | 2019-12-26T19:15:17 | 2019-12-26T19:15:17 | 230,313,263 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package org.difly.testandroidapp1;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"kryshen.yaroslav@gmail.com"
] | kryshen.yaroslav@gmail.com |
136bec60d39d91bb4b8cb6dbdf2943387f31a961 | 2b6941b92c50f4249cae69ba78da255f533addda | /src/main/java/cooptool/utils/MapResourceBundle.java | 5a2d9bc62641993abf22bf6f66b6bbd2bcfed827 | [] | no_license | LBiasibetti/coopToolProject | 25c4d476c0a5f98e247078bfc47d80c21d56b163 | 271604fbefa294b0f3f1da26b5122c9252e4013d | refs/heads/master | 2023-02-12T03:59:20.248862 | 2021-01-12T17:58:39 | 2021-01-12T17:58:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package cooptool.utils;
import java.util.*;
/**
* MapResourceBundle class
*/
public class MapResourceBundle extends ResourceBundle {
/**
* Map that stores the resources
*/
private final Map<String, Object> map;
/**
* Constructor
* @param objects Resources
*/
public MapResourceBundle(Object[] objects) {
map = new HashMap<>();
for (int i = 0; i < objects.length; i++) {
map.put(String.valueOf(i+1), objects[i]);
}
}
@Override
protected Object handleGetObject(String key) {
return map.get(key);
}
@Override
public Enumeration<String> getKeys() {
return Collections.enumeration(map.keySet());
}
}
| [
"46460244+Guillaume-Dufour@users.noreply.github.com"
] | 46460244+Guillaume-Dufour@users.noreply.github.com |
16ea80b9d1caae30bdfd6731e2d767220491bd86 | d31081ee2af56a4245d639ec71cb6d6b62968318 | /src/main/command/ExtendSubscriptionCommand.java | 4531fa90b77b5e305f3fe91082eb32a8d23ef6db | [] | no_license | antoxafreezen/periodical_publications | 3c32511392a23de865d8e55d944321e7e5fc8e66 | 3c87a4d9cdefeb6e4f27eb8704d9944600755088 | refs/heads/master | 2021-01-10T13:52:27.306442 | 2016-01-25T22:13:59 | 2016-01-25T22:13:59 | 50,381,274 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,473 | java | package main.command;
import main.dao.PersistException;
import main.entities.Subscription;
import main.entities.SubscriptionPart;
import main.entities.User;
import main.helper.Page;
import main.helper.RequestHelper;
import main.manager.SubscriptionManager;
import org.apache.log4j.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Calendar;
import java.util.Date;
import java.util.ResourceBundle;
/**
* Class that encapsulates business logic.
* Class implements functionality of extending duration of user's subscription.
*/
public class ExtendSubscriptionCommand implements Command {
/**
* Names of request parameters.
*/
private final static String SUBSCRIPTION_ID = "id";
private final static String DURATION = "duration";
/**
* Manager to work with subscriptions in persistent context.
*/
SubscriptionManager subscriptionManager = new SubscriptionManager();
/**
* Supports and provides internationalization of the system.
*/
ResourceBundle bundle;
@Override
public Page execute(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String page = "profile.jsp";
boolean redirect = true;
bundle = RequestHelper.getResourceBundle(request);
int duration = Integer.valueOf(request.getParameter(DURATION));
int current = Integer.valueOf(request.getParameter(SUBSCRIPTION_ID));
Date currentDate = new Date();
try {
User currentUser = (User) request.getSession().getAttribute("currentUser");
Subscription subscription = currentUser.getSubscriptions().get(current);
subscription.setStartDate(currentDate);
Calendar cal = Calendar.getInstance();
cal.setTime(currentDate);
cal.set(Calendar.MONTH, (cal.get(Calendar.MONTH) + duration));
subscription.setEndDate(cal.getTime());
subscriptionManager.update(subscription);
subscription.setUser(currentUser);
} catch (PersistException e) {
Logger.getLogger(getClass()).error(e);
page = "index.jsp";
redirect = false;
request.setAttribute("message", bundle.getString("command.extend_subscription.error"));
}
return new Page(page, redirect);
}
}
| [
"babak.anton@yandex.ua"
] | babak.anton@yandex.ua |
f4062c9dd0456ca5eacc736750f974005f2c1050 | 31f77df547a63f320df8aaee43d7ef621fc6461c | /src/main/java/persistence/TipoDispositivoManager.java | 5cc2cd66cd2ffa410a96696c219899ca08525555 | [] | no_license | derekfernandez/tpdds2018 | 09e0a80882ad5cbb2711f6188e62fdf7bb7604d7 | 9b43693091dcfb97ef7dc4aebde4c02aa8fabcdf | refs/heads/master | 2020-04-30T11:18:33.586582 | 2019-03-20T18:57:22 | 2019-03-20T18:57:22 | 176,798,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package persistence;
import dominio.dispositivo.TipoDispositivo;
import org.uqbarproject.jpa.java8.extras.WithGlobalEntityManager;
import org.uqbarproject.jpa.java8.extras.transaction.TransactionalOps;
public class TipoDispositivoManager implements WithGlobalEntityManager, TransactionalOps {
private static TipoDispositivoManager instance = new TipoDispositivoManager();
public TipoDispositivo getTipoDispositivoDeLaBDPorID(Long id) {
return entityManager().find(TipoDispositivo.class, id);
}
public TipoDispositivo getTipoPorNombre(String nombre) {
return entityManager().createQuery("from TipoDispositivo where nombre = :nombre", TipoDispositivo.class)
.setParameter("nombre", nombre).getSingleResult();
}
public static TipoDispositivoManager getInstance() {
return instance;
}
}
| [
"derekfernandez182@gmail.com"
] | derekfernandez182@gmail.com |
f015470dafa90046d2d85f68738baf57e8671063 | 6c887ace72a567f4344b8f1b1073b2be507ac949 | /app/src/main/java/com/rakshit/COPS/enums/ItemType.java | 893f5860a1d0e0585181f8925401d10033a04606 | [] | no_license | mighty-phoenix/COPS-app | 69df980c17cb0bb93d8b161248398143a0f8ed12 | 60b461012407286eaa382bc50b15f9f92ae8b7f4 | refs/heads/master | 2020-03-20T03:15:40.445046 | 2018-06-13T00:14:16 | 2018-06-13T00:14:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 287 | java | package com.rakshit.COPS.enums;
/**
* Created by Alex on 21.07.16.
*/
public enum ItemType {LOAD(10), ITEM(11);
private final int typeCode;
ItemType(int typeCode) {
this.typeCode = typeCode;
}
public int getTypeCode() {
return this.typeCode;
}
} | [
"rakshit.kumar.cse17@itbhu.ac.in"
] | rakshit.kumar.cse17@itbhu.ac.in |
1e0c67e308b26c0d3c0f8d9e7ca411e99db21550 | b284cfdc28d651a7c5f41c9708d7cde8f72df36e | /src/main/java/de/intarsys/pdf/pd/PDAnyAnnotation.java | a96e218edead2248397f472eb1a91e6a0810eec0 | [
"BSD-3-Clause"
] | permissive | scireum/jpod | 0fd36b8792b041354c862f2a460dbde4fe05a805 | 59cf81c768948308b42852e483d85d9d49f9c67c | refs/heads/master | 2023-08-31T15:57:59.417443 | 2023-07-28T15:35:36 | 2023-07-28T15:35:36 | 45,109,359 | 8 | 0 | BSD-3-Clause | 2021-03-25T12:30:54 | 2015-10-28T12:00:16 | Java | UTF-8 | Java | false | false | 2,447 | java | /*
* Copyright (c) 2007, intarsys consulting GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* - Neither the name of intarsys nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package de.intarsys.pdf.pd;
import de.intarsys.pdf.cos.COSBasedObject;
import de.intarsys.pdf.cos.COSObject;
/**
* A generic annotation implementation.
*/
public class PDAnyAnnotation extends PDAnnotation {
/**
* The meta class implementation
*/
public static class MetaClass extends PDAnnotation.MetaClass {
protected MetaClass(Class instanceClass) {
super(instanceClass);
}
@Override
protected COSBasedObject doCreateCOSBasedObject(COSObject object) {
return new PDAnyAnnotation(object);
}
}
/**
* The meta class instance
*/
public static final MetaClass META = new MetaClass(MetaClass.class.getDeclaringClass());
protected PDAnyAnnotation(COSObject object) {
super(object);
}
@Override
public String getSubtypeLabel() {
return "Annotation";
}
}
| [
"sbi@scireum.de"
] | sbi@scireum.de |
6902ae05756247a7dfad11c74c16eeb3d0e91c4a | 9aaaffbddb205dba973ece59da34ae43cc4112c6 | /src/main/java/org/uniworks/groupware/admin/domain/UserInfo.java | 9fc41900ae9765bbee51d500bf0367db30e9be0e | [] | no_license | linuxwan/uniworks-admin | d4c1ba51593e3bc712634ce3c54fd2d85e2f56c4 | 227ca3bb97c31f1e560b9e147d373ff5474300d0 | refs/heads/master | 2023-07-09T05:18:28.208162 | 2021-07-30T09:04:32 | 2021-07-30T09:04:32 | 115,481,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,718 | java | /**
* 박충완(Park Chungwan)이 작성한 코드 입니다.
* Uniworks라는 개인적 프로젝트를 완성하기 위해서 작성 중 입니다.
* 이 소스의 코드를 사용하실 경우에는 꼭 출처를 명시해 주시기 바랍니다.
*/
package org.uniworks.groupware.admin.domain;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import org.uniworks.groupware.admin.domain.security.Role;
/**
* @author Park Chungwan
*
*/
@SuppressWarnings("serial")
public class UserInfo implements UserDetails, Serializable {
private String coId;
private String username;
private String password;
private String role;
private List<Role> authorities; //계정이 가지고 있는 권한 목록
private boolean accountNonExpired = true;
private boolean accountNonLocked = true;
private boolean credentialsNonExpired = true;
private boolean enabled = true;
public String getCoId() {
return coId;
}
public void setCoId(String coId) {
this.coId = coId;
}
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;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public void setAuthorities(List<Role> authorities) {
this.authorities = authorities;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
// TODO Auto-generated method stub
return authorities;
}
@Override
public boolean isAccountNonExpired() {
// TODO Auto-generated method stub
return accountNonExpired;
}
public void setAccountNonExpired(boolean accountNonExpired) {
this.accountNonExpired = accountNonExpired;
}
@Override
public boolean isAccountNonLocked() {
// TODO Auto-generated method stub
return accountNonLocked;
}
public void setAccountNonLocked(boolean accountNonLocked) {
this.accountNonLocked = accountNonLocked;
}
@Override
public boolean isCredentialsNonExpired() {
// TODO Auto-generated method stub
return credentialsNonExpired;
}
public void setCredentialsNonExpired(boolean credentialsNonExpired) {
this.credentialsNonExpired = credentialsNonExpired;
}
@Override
public boolean isEnabled() {
// TODO Auto-generated method stub
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
| [
"chungwan.park@gmail.com"
] | chungwan.park@gmail.com |
f140de6728e52de1de86bcbe3bf92f233b485908 | 524486c65d7ed1481f9b0f8294674a0327a698c9 | /trunk/Fair_Helper/src/fairhelper/panels/UpdateUserPanel.java | bacda9acb951ea4462705972c1870d25c94553d5 | [] | no_license | BGCX067/fairhelper-svn-to-git | 4c5013a863b4f1eaac79ce68fc2dc640f5895965 | 84d8fd84bd1aba595c95dceaa31e0fb698d96495 | refs/heads/master | 2016-09-01T08:56:50.641241 | 2015-12-28T14:38:27 | 2015-12-28T14:38:27 | 48,836,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,797 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* UpdateUserPanel.java
*
* Created on 18.Kas.2009, 20:47:44
*/
package fairhelper.panels;
import fairhelper.User;
import fairhelper.UserManager;
import fairhelper.language.Language;
import fairhelper.theme.Theme;
import javax.swing.JButton;
import javax.swing.JOptionPane;
/**
*
* @author Feoran
*/
public class UpdateUserPanel extends javax.swing.JPanel {
private User user;
/** Creates new form UpdateUserPanel */
public UpdateUserPanel(User user) {
this.user = user;
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
updatePanelFirstNameField = new javax.swing.JTextField();
updatePanelSurnameField = new javax.swing.JTextField();
updatePanelUserRoleField = new javax.swing.JComboBox();
updatePanelOldPasswordField = new javax.swing.JPasswordField();
updatePanelNewPasswordField = new javax.swing.JPasswordField();
updatePanelNewPasswordAgainField = new javax.swing.JPasswordField();
saveChangesButton = new javax.swing.JButton();
cleanButton = new javax.swing.JButton();
backButton = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
setBackground(Theme.getColor("backgroundColor2"));
setPreferredSize(new java.awt.Dimension(620, 480));
jLabel1.setForeground(Theme.getColor("labelColor1"));
jLabel1.setText(Language.getText("userNameLabel"));
jLabel2.setForeground(Theme.getColor("labelColor1"));
jLabel2.setText(Language.getText("firstNameField"));
jLabel3.setForeground(Theme.getColor("labelColor1"));
jLabel3.setText(Language.getText("surnameField"));
jLabel4.setForeground(Theme.getColor("labelColor1"));
jLabel4.setText(Language.getText("oldPasswordLabel"));
jLabel5.setForeground(Theme.getColor("labelColor1"));
jLabel5.setText(Language.getText("newPasswordLabel"));
jLabel6.setForeground(Theme.getColor("labelColor1"));
jLabel6.setText(Language.getText("newPasswordAgainLabel"));
jLabel7.setForeground(Theme.getColor("labelColor1"));
jLabel7.setText(Language.getText("roleLabel"));
updatePanelFirstNameField.setBackground(Theme.getColor("fieldBackgroundColor1"));
updatePanelFirstNameField.setForeground(Theme.getColor("fieldForegroundColor1"));
updatePanelFirstNameField.setText(user.getFirstName());
updatePanelSurnameField.setBackground(Theme.getColor("fieldBackgroundColor1"));
updatePanelSurnameField.setForeground(Theme.getColor("fieldForegroundColor1"));
updatePanelSurnameField.setText(user.getSurname());
updatePanelUserRoleField.setBackground(Theme.getColor("fieldBackgroundColor1"));
updatePanelUserRoleField.setForeground(Theme.getColor("fieldForegroundColor1"));
updatePanelUserRoleField.setModel(new javax.swing.DefaultComboBoxModel(getUserPriviledgesNameArray()));
updatePanelUserRoleField.setSelectedIndex(getUserPriviledgeIndex());
updatePanelOldPasswordField.setBackground(Theme.getColor("fieldBackgroundColor1"));
updatePanelOldPasswordField.setForeground(Theme.getColor("fieldForegroundColor1"));
updatePanelNewPasswordField.setBackground(Theme.getColor("fieldBackgroundColor1"));
updatePanelNewPasswordField.setForeground(Theme.getColor("fieldForegroundColor1"));
updatePanelNewPasswordAgainField.setBackground(Theme.getColor("fieldBackgroundColor1"));
updatePanelNewPasswordAgainField.setForeground(Theme.getColor("fieldForegroundColor1"));
saveChangesButton.setBackground(Theme.getColor("buttonBackgroundColor1"));
saveChangesButton.setForeground(Theme.getColor("buttonForegroundColor1"));
saveChangesButton.setText(Language.getText("saveChangesButton"));
saveChangesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
saveChangesButtonActionPerformed(evt);
}
});
cleanButton.setBackground(Theme.getColor("buttonBackgroundColor1"));
cleanButton.setForeground(Theme.getColor("buttonForegroundColor1"));
cleanButton.setText(Language.getText("returnToDefaultButton"));
cleanButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cleanButtonActionPerformed(evt);
}
});
backButton.setBackground(Theme.getColor("buttonBackgroundColor1"));
backButton.setForeground(Theme.getColor("buttonForegroundColor1"));
backButton.setText(Language.getText("backButton"));
jLabel8.setForeground(Theme.getColor("labelColor1"));
jLabel8.setText(user.getUserName());
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(148, 148, 148)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel7)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(saveChangesButton))
.addGap(26, 26, 26)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(cleanButton)
.addGap(18, 18, 18)
.addComponent(backButton))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(updatePanelNewPasswordAgainField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(updatePanelNewPasswordField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(updatePanelOldPasswordField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(updatePanelUserRoleField, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(updatePanelSurnameField, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(updatePanelFirstNameField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 149, Short.MAX_VALUE)))
.addContainerGap(188, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(71, 71, 71)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(updatePanelFirstNameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(updatePanelSurnameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(updatePanelUserRoleField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(updatePanelOldPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(updatePanelNewPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(updatePanelNewPasswordAgainField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(54, 54, 54)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveChangesButton)
.addComponent(cleanButton)
.addComponent(backButton))
.addContainerGap(88, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private String[] getUserPriviledgesNameArray() {
String[] privilegesNameArray = UserManager.getPrivilegesNameArray(true);
for (int i=0; i<privilegesNameArray.length; i++) {
privilegesNameArray[i] = Language.getText("roleName" + privilegesNameArray[i]);
}
return privilegesNameArray;
}
public int getUserPriviledgeIndex() {
String[] privilegesNameArray = UserManager.getPrivilegesNameArray(true);
for (int i=0; i<privilegesNameArray.length; i++) {
if(privilegesNameArray[i].equals(UserManager.getPrivileges(user.getPrivilegesId()).getPrivilegeName()))
return i;
}
return -1;
}
private void cleanButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cleanButtonActionPerformed
updatePanelFirstNameField.setText(user.getFirstName());
updatePanelSurnameField.setText(user.getSurname());
updatePanelUserRoleField.setSelectedIndex(getUserPriviledgeIndex());
updatePanelOldPasswordField.setText("");
updatePanelNewPasswordField.setText("");
updatePanelNewPasswordAgainField.setText("");
}//GEN-LAST:event_cleanButtonActionPerformed
private String oldUserName;
private String newUserName;
private String newFirstName;
private String newLastName;
private int role;
private String oldPassword;
private String newPassword;
private String newPasswordAgain;
private String message;
private void saveChangesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveChangesButtonActionPerformed
oldUserName = user.getUserName();
newUserName = oldUserName;
newFirstName = updatePanelFirstNameField.getText();
newLastName = updatePanelSurnameField.getText();
role = UserManager.getPrivileges(UserManager.getPrivilegesNameArray(true)[updatePanelUserRoleField.getSelectedIndex()]).getId();
oldPassword = new String(updatePanelOldPasswordField.getPassword());
newPassword = new String(updatePanelNewPasswordField.getPassword());
newPasswordAgain = new String(updatePanelNewPasswordAgainField.getPassword());
if (newUserName.equals(""))
message = Language.getText("enterUserNameMessage");
else if (!UserManager.userNameLegal(newUserName))
message = Language.getText("usernameWrongCharsMessage");
else if (!UserManager.userNameUnique(newUserName) && !newUserName.equals(user.getUserName()))
message = newUserName + " " + Language.getText("userAlreadyExistsMessage");
else {
if (oldPassword.equals("") && newPassword.equals("") && newPasswordAgain.equals("")) {
updateExceptPassword();
message = Language.getText("userUpdatedMessage");
} else {
if (oldPassword.equals(""))
message = Language.getText("enterOldPasswordMessage");
else if (newPassword.equals(""))
message = Language.getText("enterNewPasswordMessage");
else if (newPasswordAgain.equals(""))
message = Language.getText("enterNewPasswordAgainMessage");
else if (!newPassword.equals(newPasswordAgain))
message = Language.getText("newPasswordsNotSameMessage");
else if (!UserManager.passwordLegal(newPassword))
message = Language.getText("passwordWrongCharsMessage");
else if (!oldPassword.equals(UserManager.decodePassword(user.getPassword(), user.getUserName())))
message = Language.getText("oldPasswordWrondMeaage");
else {
updateWithPassword();
message = Language.getText("userUpdatedMessage");
}
}
}
JOptionPane.showMessageDialog(null, message);
updatePanelOldPasswordField.setText("");
updatePanelNewPasswordField.setText("");
updatePanelNewPasswordAgainField.setText("");
}//GEN-LAST:event_saveChangesButtonActionPerformed
/** Şifre değiştirilmediyse eski şifre aynen kaydedilir.
*/
private void updateExceptPassword() {
String password = UserManager.decodePassword(user.getPassword(), user.getUserName());
User updatedUser = new User(newUserName, password, newFirstName, newLastName, role);
UserManager.updateUser(oldUserName, updatedUser);
}
/** Şifre değiştirildiyse yeni şifre dahil edilerek kaydedilir.
*/
private void updateWithPassword() {
User updatedUser = new User(newUserName, newPassword, newFirstName, newLastName, role);
UserManager.updateUser(oldUserName, updatedUser);
}
public JButton getBackButton() {
return backButton;
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton backButton;
private javax.swing.JButton cleanButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JButton saveChangesButton;
private javax.swing.JTextField updatePanelFirstNameField;
private javax.swing.JPasswordField updatePanelNewPasswordAgainField;
private javax.swing.JPasswordField updatePanelNewPasswordField;
private javax.swing.JPasswordField updatePanelOldPasswordField;
private javax.swing.JTextField updatePanelSurnameField;
private javax.swing.JComboBox updatePanelUserRoleField;
// End of variables declaration//GEN-END:variables
}
| [
"you@example.com"
] | you@example.com |
4773f77028d91ea038171aace30e8acaa74dd092 | f0094829f498afba8f79d3b08ebe290f06d23350 | /src/main/java/com/microwise/api/blackhole/UserAction.java | 7e5e8f1378c67116d3deccdf32ba0033e8ecbe3a | [] | no_license | algsun/galaxy | 0c3c0bb6302c37aacb5a184343bc8c016a52631d | c5f40f2ed4835c803e7c2ed8ba16f84ad54f623e | refs/heads/master | 2020-03-15T20:05:07.418862 | 2018-05-06T09:45:29 | 2018-05-06T09:45:29 | 132,314,724 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,143 | java | package com.microwise.api.blackhole;
import com.microwise.api.bean.ApiResult;
import com.microwise.api.bean.UserVo;
import com.microwise.blackhole.bean.User;
import com.microwise.blackhole.service.UserService;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;
/**
* @author xiedeng
* @date 13-12-6
*/
@Controller
public class UserAction {
@Autowired
private UserService userService;
@RequestMapping(value = "/blackhole/getUsers", method = RequestMethod.GET)
@ApiOperation(value = "获取所有用户信息", position = 2, httpMethod = "GET",
notes = "获取所有用户信息"
)
@ApiResponses({
@ApiResponse(code = 200, message = "成功", response = Void.class),
@ApiResponse(code = 500, message = "服务端异常")
})
@ResponseBody
public ApiResult<Object> getUsers() {
List<User> users = userService.findUserList();
List<UserVo> userVos = new ArrayList<>();
for (User user : users) {
userVos.add(new UserVo(user.getId(), user.getUserName(), user.getEmail()));
}
return getResult(true, "获取所有用户信息成功", userVos);
}
/**
* 获取返回的json 数据
*
* @param success 是否成功 true 成功, false 失败
* @param msg 返回的信息
* @param data 返回的数据
* @return json数据
*/
private ApiResult<Object> getResult(boolean success, String msg, Object data) {
ApiResult<Object> apiResult = new ApiResult<Object>();
apiResult.setSuccess(success);
apiResult.setMessage(msg);
apiResult.setData(data);
return apiResult;
}
}
| [
"algtrue@163.com"
] | algtrue@163.com |
6a2b6d4a86841110a2700685acc9ffaa2eed03c9 | f1cd06451147cfec88909e2648736dc3b3911f1c | /src/main/java/com/projects/ApplicationSpringConfig.java | 52dc9e18b06c958d24686339080e42e8fc4e6179 | [] | no_license | IdoAlon/webserver1 | 6153f7e803de56c743758a5e0eee89d787702761 | 385d768fdeaffad9c6d8a8ed6343a25275e5b193 | refs/heads/master | 2020-07-12T22:42:56.817807 | 2016-11-16T08:06:26 | 2016-11-16T08:06:26 | 73,897,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 758 | java | package com.projects;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ApplicationSpringConfig {
private static String DB_FILE_NAME = "/tmp/students.db";
@Bean
public StudentsController studentsController() {
return new StudentsController();
}
@Bean
public StudentsRepository studentsRepository() {
return new AnotherStudentsRepository(DB_FILE_NAME);
}
// @Bean
// public StudentsRepository studentsRepository() {
// return new FilesStudentsRepository(DB_FILE_NAME);
// }
// @Bean
// public StudentsRepository studentsRepository() {
// return new InMemoryStudentsRepository();
// }
}
| [
"ido.galon@gmail.com"
] | ido.galon@gmail.com |
6de78ef5f9ad9073919e2a1808674a220fe0e7d2 | 417794e62c9edeeb509e4d931ad5b52ca5e54674 | /back/src/test/java/fr/certification/tp2/acceptance/jbehave/stories/send_substract_operation/SubstractStory.java | 84150c37a731cdebd60916f678370e98daf27db2 | [] | no_license | Reynault/TP_Certif_Spring | 2df4703ee8479a6d7b6d8830bbbe1735ae35dc06 | 53f285bd8cd9c29b79dee772757f08a1fe08ab8b | refs/heads/master | 2023-01-22T10:30:47.324919 | 2020-12-10T12:24:45 | 2020-12-10T12:24:45 | 312,567,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 826 | java | package fr.certification.tp2.acceptance.jbehave.stories.send_substract_operation;
import fr.certification.tp2.acceptance.steps.OperationsControllerSteps;
import org.jbehave.core.annotations.Given;
import org.jbehave.core.annotations.Then;
import org.jbehave.core.annotations.When;
import net.thucydides.core.annotations.Steps;
public class SubstractStory {
@Steps
private OperationsControllerSteps operationsControllerSteps;
@Given("the user is on the form page")
public void givenTheUserIsOnTheFormPage(){
}
@When("I substract two numbers $a and $b")
public void whenAddingTwoNumbers(int a, int b){
operationsControllerSteps.whenSubstract(a, b);
}
@Then("I get a substraction result")
public void thenIGetTheSum(){
operationsControllerSteps.substractUp();
}
}
| [
"reynault.sies@gmail.com"
] | reynault.sies@gmail.com |
3d17cfb4c9e4fb488521a7ea114327de337a1925 | 7f4ac22c6a06c99f13b08731d92f3b477ab72b5d | /dao/src/main/java/com/hotpot/searcher/OrderSearcher.java | 254e6e52654b1195f6ee70bd903721cef75da8f0 | [] | no_license | marstianna/serial-manage | 7181ef8adb72a381ec0488ba7ccda3fa0b88c9be | bc76f1342e33c0a0de818cd02d6c61b6743cb402 | refs/heads/master | 2021-01-10T07:18:01.851178 | 2016-02-16T10:00:23 | 2016-02-16T10:00:23 | 48,519,329 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,632 | java | package com.hotpot.searcher;
/**
* Created by zoupeng on 15/12/26.
*/
public class OrderSearcher {
private Integer id; //订单号
private Integer vipId; //会员 ID
private Integer payType;//支付方式
private Integer storeId;//店铺 ID
private String cardId; //储值卡编号
private String startTime; //查询起始时间
private String endTime; //查询结束时间
public Integer getId() {
return id;
}
public OrderSearcher setId(Integer id) {
this.id = id;
return this;
}
public Integer getVipId() {
return vipId;
}
public OrderSearcher setVipId(Integer vipId) {
this.vipId = vipId;
return this;
}
public Integer getPayType() {
return payType;
}
public OrderSearcher setPayType(Integer payType) {
this.payType = payType;
return this;
}
public Integer getStoreId() {
return storeId;
}
public OrderSearcher setStoreId(Integer storeId) {
this.storeId = storeId;
return this;
}
public String getCardId() {
return cardId;
}
public OrderSearcher setCardId(String cardId) {
this.cardId = cardId;
return this;
}
public String getStartTime() {
return startTime;
}
public OrderSearcher setStartTime(String startTime) {
this.startTime = startTime;
return this;
}
public String getEndTime() {
return endTime;
}
public OrderSearcher setEndTime(String endTime) {
this.endTime = endTime;
return this;
}
}
| [
"peng.zou@dmall.com"
] | peng.zou@dmall.com |
817d8870141ba2889021eccb179ef41ff4eb371f | 73308ecf567af9e5f4ef8d5ff10f5e9a71e81709 | /jaso78256/server/src/main/java/com/example/jaso78113/MyController.java | 60ca37ba4aa68ef0cc0f81bab96f079e8f2ef4b6 | [] | no_license | yukihane/stackoverflow-qa | bfaf371e3c61919492e2084ed4c65f33323d7231 | ba5e6a0d51f5ecfa80bb149456adea49de1bf6fb | refs/heads/main | 2023-08-03T06:54:32.086724 | 2023-07-26T20:02:07 | 2023-07-26T20:02:07 | 194,699,870 | 3 | 3 | null | 2023-03-02T23:37:45 | 2019-07-01T15:34:08 | Java | UTF-8 | Java | false | false | 461 | java | package com.example.jaso78113;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("")
public class MyController {
@RequestMapping(value = "/", consumes = "text/plain")
public String index(@RequestBody final String body) {
System.out.print(body);
return body;
}
}
| [
"yukihane.feather@gmail.com"
] | yukihane.feather@gmail.com |
d8fc5957ab63fdf2ccb818284cb75fa45859e7b4 | 6377e2dc472eeb5ccfb985cde037be45209dfdd4 | /Final Project/Server/src/gvsu457/ServerClientThreadOperations.java | ef99a4ea763ed8d36ab031d0d2dff49be85289f2 | [] | no_license | ThunderKick/CIS457 | 1a5c85bf2ab6b8c7072e894717f57600287acca5 | 87c3982fc71be19968c2c8bb6832b95cb22536c5 | refs/heads/master | 2021-04-29T23:05:04.745103 | 2016-12-05T14:15:40 | 2016-12-05T14:15:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,213 | java | package gvsu457;
import java.io.File;
import java.io.IOException;
import java.net.ServerSocket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* ServerClientThreadOperations
*
* @author Taylor Coleman, David Fletcher
*/
public class ServerClientThreadOperations extends Thread {
/**
* Port Number
*/
private static final int PORT = 33333;
/**
* Listening socket
*/
private ServerSocket clientListener;
/**
* Max number of connections
*/
private static final int MAX_CONNECTIONS = 100;
/**
* Instance of Thread Pool
*/
private ExecutorService executorService = Executors.newCachedThreadPool();
public static String DBXML_DIR_SHORTCUT = (new File(".").getAbsolutePath()) + File.separator + "DBXML";
/**
* Main method
*/
public static void main(String[] args) {
ServerClientThreadOperations serverClientThreadPool = new ServerClientThreadOperations();
serverClientThreadPool.startServer();
}
/**
* Constructor for ServerClientThreadOperations.
*/
ServerClientThreadOperations() {
try {
clientListener = new ServerSocket(PORT);
} catch (IOException e) {
throw new RuntimeException();
}
}
/**
* Starts the server.
*/
public void startServer() {
//Delete all old xml data on startup.
File curDir = new File(DBXML_DIR_SHORTCUT);
File[] FileList = curDir.listFiles();
for (File f : FileList) {
if (f.getName().contains(".xml")) {
f.delete();
System.out.println("Removing old file: " + f.getName() + " from the DB directory");
}
}
for (int i = 0; i < MAX_CONNECTIONS; i++) {
try {
System.out.println("Waiting for a connection...");
ServerThread serverThread = new ServerThread(clientListener.accept());
//serverThread.run();
executorService.submit(serverThread);
} catch (IOException e) {
throw new RuntimeException();
}
}
}
}
| [
"colemata@mail.gvsu.edu"
] | colemata@mail.gvsu.edu |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.