blob_id stringlengths 40 40 | __id__ int64 225 39,780B | directory_id stringlengths 40 40 | path stringlengths 6 313 | content_id stringlengths 40 40 | detected_licenses list | license_type stringclasses 2
values | repo_name stringlengths 6 132 | repo_url stringlengths 25 151 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 70 | visit_date timestamp[ns] | revision_date timestamp[ns] | committer_date timestamp[ns] | github_id int64 7.28k 689M ⌀ | star_events_count int64 0 131k | fork_events_count int64 0 48k | gha_license_id stringclasses 23
values | gha_fork bool 2
classes | gha_event_created_at timestamp[ns] | gha_created_at timestamp[ns] | gha_updated_at timestamp[ns] | gha_pushed_at timestamp[ns] | gha_size int64 0 40.4M ⌀ | gha_stargazers_count int32 0 112k ⌀ | gha_forks_count int32 0 39.4k ⌀ | gha_open_issues_count int32 0 11k ⌀ | gha_language stringlengths 1 21 ⌀ | gha_archived bool 2
classes | gha_disabled bool 1
class | content stringlengths 7 4.37M | src_encoding stringlengths 3 16 | language stringclasses 1
value | length_bytes int64 7 4.37M | extension stringclasses 24
values | filename stringlengths 4 174 | language_id stringclasses 1
value | entities list | contaminating_dataset stringclasses 0
values | malware_signatures list | redacted_content stringlengths 7 4.37M | redacted_length_bytes int64 7 4.37M | alphanum_fraction float32 0.25 0.94 | alpha_fraction float32 0.25 0.94 | num_lines int32 1 84k | avg_line_length float32 0.76 99.9 | std_line_length float32 0 220 | max_line_length int32 5 998 | is_vendor bool 2
classes | is_generated bool 1
class | max_hex_length int32 0 319 | hex_fraction float32 0 0.38 | max_unicode_length int32 0 408 | unicode_fraction float32 0 0.36 | max_base64_length int32 0 506 | base64_fraction float32 0 0.5 | avg_csv_sep_count float32 0 4 | is_autogen_header bool 1
class | is_empty_html bool 1
class | shard stringclasses 16
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f6b3878a0bcdf627a9c32ff50ab6ab784e1f4a08 | 24,343,874,690,250 | dcab5274f066975e6dab2bd88754e1610b69b932 | /src/com/asiainfo/dao/IUserDao.java | e27ee18355bc531a4c38f39fa31a72b9be0c9059 | [] | no_license | zhangzhiwang/spring | https://github.com/zhangzhiwang/spring | 6427b404169eb8f9f41e5f634f46784664f9aeba | 1a0668fe307ca6b109018397c93b38a68b3c767c | refs/heads/master | 2016-08-19T15:49:43.399000 | 2016-07-20T23:42:58 | 2016-07-20T23:42:58 | 63,779,783 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.asiainfo.dao;
import com.asiainfo.entity.UserEntity;
/**
* UserDao接口
*
* @author zhiwangzhang
* @date 2016年7月20日 下午9:49:22
*/
public interface IUserDao {
void add(UserEntity ue);
void delete(int id);
void update(int id);
UserEntity query();
}
| UTF-8 | Java | 286 | java | IUserDao.java | Java | [
{
"context": "entity.UserEntity;\n\n/**\n * UserDao接口\n *\n * @author zhiwangzhang\n * @date 2016年7月20日 下午9:49:22\n */\npublic interfac",
"end": 110,
"score": 0.980453372001648,
"start": 98,
"tag": "USERNAME",
"value": "zhiwangzhang"
}
] | null | [] | package com.asiainfo.dao;
import com.asiainfo.entity.UserEntity;
/**
* UserDao接口
*
* @author zhiwangzhang
* @date 2016年7月20日 下午9:49:22
*/
public interface IUserDao {
void add(UserEntity ue);
void delete(int id);
void update(int id);
UserEntity query();
}
| 286 | 0.694853 | 0.650735 | 19 | 13.315789 | 12.303412 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false | 9 |
d2a90148e6f6eeabd131b036a95ffb20ab6ebacd | 14,405,320,357,379 | 5f7177d1c67a0eb4fed2381819d6dae72f0ccc2c | /caliper-worker/src/main/java/com/google/caliper/worker/instrument/WorkerInstrumentModule.java | 3dda8b33aa313e09374ac559f1e8bde4c566dc4d | [
"Apache-2.0"
] | permissive | google/caliper | https://github.com/google/caliper | 96b1b8a2766c2a661cc45d5ba4201d59e38f20a8 | a38bbf8615d0e65aa9741af452080545ec9786c9 | refs/heads/master | 2023-08-23T17:15:54.081000 | 2023-08-01T15:01:58 | 2023-08-01T15:02:34 | 35,890,978 | 875 | 137 | Apache-2.0 | false | 2023-08-01T15:02:40 | 2015-05-19T15:28:40 | 2023-07-24T09:39:39 | 2023-08-01T15:02:39 | 8,709 | 792 | 118 | 114 | Java | false | false | /*
* Copyright (C) 2012 Google 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.google.caliper.worker.instrument;
import com.google.caliper.bridge.ExperimentSpec;
import com.google.caliper.core.Running.Benchmark;
import com.google.caliper.core.Running.BenchmarkClass;
import com.google.caliper.core.Running.BenchmarkMethod;
import com.google.caliper.model.BenchmarkSpec;
import com.google.caliper.model.InstrumentType;
import com.google.caliper.util.InvalidCommandException;
import com.google.caliper.util.Util;
import com.google.common.base.Function;
import com.google.common.base.Ticker;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Maps;
import com.google.common.primitives.Primitives;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import dagger.Reusable;
import dagger.multibindings.IntoMap;
import java.lang.reflect.Method;
import java.util.Map;
import javax.inject.Provider;
/**
* Binds classes necessary for the worker instruments. Also manages the injection of {@link
* com.google.caliper.Param parameters} from the {@link ExperimentSpec} into the benchmark.
*
* <p>TODO(gak): Ensure that each worker only has bindings for the objects it needs and not the
* objects required by different workers. (i.e. don't bind a Ticker if the worker is an allocation
* worker).
*/
@Module
public abstract class WorkerInstrumentModule {
private WorkerInstrumentModule() {}
@Provides
static BenchmarkSpec provideBenchmarkSpec(ExperimentSpec experiment) {
return experiment.benchmarkSpec();
}
@Provides
@Benchmark
static Object provideBenchmarkInstance(BenchmarkCreator creator) {
return creator.createBenchmarkInstance();
}
@Provides
@Reusable
@BenchmarkMethod
static Method provideBenchmarkMethod(
ExperimentSpec experiment,
BenchmarkSpec benchmarkSpec,
@BenchmarkClass Class<?> benchmarkClass) {
Method method =
findBenchmarkMethod(
benchmarkClass, benchmarkSpec.methodName(), experiment.methodParameterClasses());
method.setAccessible(true);
return method;
}
@Provides
@BenchmarkMethod
static String provideBenchmarkMethodName(@BenchmarkMethod Method benchmarkMethod) {
return benchmarkMethod.getName();
}
@Provides
@Benchmark
static ImmutableSortedMap<String, String> provideUserParameters(BenchmarkSpec spec) {
return spec.parameters();
}
@Provides
static InstrumentType provideInstrumentType(ExperimentSpec experiment) {
return experiment.instrumentType();
}
@Provides
@WorkerInstrument.Options
static Map<String, String> provideWorkerInstrumentOptions(ExperimentSpec experiment) {
return experiment.workerInstrumentOptions();
}
@Provides
static WorkerInstrument provideWorkerInstrument(
InstrumentType instrumentType,
Map<InstrumentType, Provider<WorkerInstrument>> availableWorkerInstruments) {
Provider<WorkerInstrument> workerInstrumentProvider =
availableWorkerInstruments.get(instrumentType);
if (workerInstrumentProvider == null) {
throw new InvalidCommandException(
"%s is not a supported instrument type (%s).",
instrumentType, availableWorkerInstruments);
}
return workerInstrumentProvider.get();
}
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.ARBITRARY_MEASUREMENT)
abstract WorkerInstrument bindArbitraryMeasurementWorkerInstrument(
ArbitraryMeasurementWorkerInstrument impl);
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.RUNTIME_MACRO)
abstract WorkerInstrument bindMacrobenchmarkWorkerInstrument(MacrobenchmarkWorkerInstrument impl);
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.RUNTIME_MICRO)
abstract WorkerInstrument bindRuntimeWorkerInstrumentMicro(RuntimeWorkerInstrument.Micro impl);
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.RUNTIME_PICO)
abstract WorkerInstrument bindRuntimeWorkerInstrumentPico(RuntimeWorkerInstrument.Pico impl);
@Provides
static Ticker provideTicker() {
return Ticker.systemTicker();
}
private static Method findBenchmarkMethod(
Class<?> benchmark, String methodName, ImmutableList<String> methodParameterClasses) {
Class<?>[] params = new Class<?>[methodParameterClasses.size()];
for (int i = 0; i < methodParameterClasses.size(); i++) {
try {
String typeName = methodParameterClasses.get(i);
Class<?> primitiveType = PRIMITIVE_TYPES.get(typeName);
if (primitiveType != null) {
params[i] = primitiveType;
} else {
params[i] = Util.loadClass(typeName);
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
try {
return benchmark.getDeclaredMethod(methodName, params);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (SecurityException e) {
// assertion error?
throw new RuntimeException(e);
}
}
private static final ImmutableMap<String, Class<?>> PRIMITIVE_TYPES =
Maps.uniqueIndex(
Primitives.allPrimitiveTypes(),
new Function<Class<?>, String>() {
@Override
public String apply(Class<?> input) {
return input.getName();
}
});
}
| UTF-8 | Java | 5,933 | java | WorkerInstrumentModule.java | Java | [] | null | [] | /*
* Copyright (C) 2012 Google 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.google.caliper.worker.instrument;
import com.google.caliper.bridge.ExperimentSpec;
import com.google.caliper.core.Running.Benchmark;
import com.google.caliper.core.Running.BenchmarkClass;
import com.google.caliper.core.Running.BenchmarkMethod;
import com.google.caliper.model.BenchmarkSpec;
import com.google.caliper.model.InstrumentType;
import com.google.caliper.util.InvalidCommandException;
import com.google.caliper.util.Util;
import com.google.common.base.Function;
import com.google.common.base.Ticker;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedMap;
import com.google.common.collect.Maps;
import com.google.common.primitives.Primitives;
import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import dagger.Reusable;
import dagger.multibindings.IntoMap;
import java.lang.reflect.Method;
import java.util.Map;
import javax.inject.Provider;
/**
* Binds classes necessary for the worker instruments. Also manages the injection of {@link
* com.google.caliper.Param parameters} from the {@link ExperimentSpec} into the benchmark.
*
* <p>TODO(gak): Ensure that each worker only has bindings for the objects it needs and not the
* objects required by different workers. (i.e. don't bind a Ticker if the worker is an allocation
* worker).
*/
@Module
public abstract class WorkerInstrumentModule {
private WorkerInstrumentModule() {}
@Provides
static BenchmarkSpec provideBenchmarkSpec(ExperimentSpec experiment) {
return experiment.benchmarkSpec();
}
@Provides
@Benchmark
static Object provideBenchmarkInstance(BenchmarkCreator creator) {
return creator.createBenchmarkInstance();
}
@Provides
@Reusable
@BenchmarkMethod
static Method provideBenchmarkMethod(
ExperimentSpec experiment,
BenchmarkSpec benchmarkSpec,
@BenchmarkClass Class<?> benchmarkClass) {
Method method =
findBenchmarkMethod(
benchmarkClass, benchmarkSpec.methodName(), experiment.methodParameterClasses());
method.setAccessible(true);
return method;
}
@Provides
@BenchmarkMethod
static String provideBenchmarkMethodName(@BenchmarkMethod Method benchmarkMethod) {
return benchmarkMethod.getName();
}
@Provides
@Benchmark
static ImmutableSortedMap<String, String> provideUserParameters(BenchmarkSpec spec) {
return spec.parameters();
}
@Provides
static InstrumentType provideInstrumentType(ExperimentSpec experiment) {
return experiment.instrumentType();
}
@Provides
@WorkerInstrument.Options
static Map<String, String> provideWorkerInstrumentOptions(ExperimentSpec experiment) {
return experiment.workerInstrumentOptions();
}
@Provides
static WorkerInstrument provideWorkerInstrument(
InstrumentType instrumentType,
Map<InstrumentType, Provider<WorkerInstrument>> availableWorkerInstruments) {
Provider<WorkerInstrument> workerInstrumentProvider =
availableWorkerInstruments.get(instrumentType);
if (workerInstrumentProvider == null) {
throw new InvalidCommandException(
"%s is not a supported instrument type (%s).",
instrumentType, availableWorkerInstruments);
}
return workerInstrumentProvider.get();
}
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.ARBITRARY_MEASUREMENT)
abstract WorkerInstrument bindArbitraryMeasurementWorkerInstrument(
ArbitraryMeasurementWorkerInstrument impl);
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.RUNTIME_MACRO)
abstract WorkerInstrument bindMacrobenchmarkWorkerInstrument(MacrobenchmarkWorkerInstrument impl);
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.RUNTIME_MICRO)
abstract WorkerInstrument bindRuntimeWorkerInstrumentMicro(RuntimeWorkerInstrument.Micro impl);
@Binds
@IntoMap
@InstrumentTypeKey(InstrumentType.RUNTIME_PICO)
abstract WorkerInstrument bindRuntimeWorkerInstrumentPico(RuntimeWorkerInstrument.Pico impl);
@Provides
static Ticker provideTicker() {
return Ticker.systemTicker();
}
private static Method findBenchmarkMethod(
Class<?> benchmark, String methodName, ImmutableList<String> methodParameterClasses) {
Class<?>[] params = new Class<?>[methodParameterClasses.size()];
for (int i = 0; i < methodParameterClasses.size(); i++) {
try {
String typeName = methodParameterClasses.get(i);
Class<?> primitiveType = PRIMITIVE_TYPES.get(typeName);
if (primitiveType != null) {
params[i] = primitiveType;
} else {
params[i] = Util.loadClass(typeName);
}
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
try {
return benchmark.getDeclaredMethod(methodName, params);
} catch (NoSuchMethodException e) {
throw new RuntimeException(e);
} catch (SecurityException e) {
// assertion error?
throw new RuntimeException(e);
}
}
private static final ImmutableMap<String, Class<?>> PRIMITIVE_TYPES =
Maps.uniqueIndex(
Primitives.allPrimitiveTypes(),
new Function<Class<?>, String>() {
@Override
public String apply(Class<?> input) {
return input.getName();
}
});
}
| 5,933 | 0.742457 | 0.740941 | 178 | 32.331459 | 27.109167 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421348 | false | false | 9 |
ddc48afb3919fc1097a74895317c13b3ce22be79 | 15,393,162,844,956 | a4e53cb6acbfd3410752c7be02bff671dc03c6c7 | /core/src/com/aaa/game/StatScreen.java | f4be934c11a14853fef1e98ed1cba02ca3a8f26f | [] | no_license | dsun15/AAA | https://github.com/dsun15/AAA | 12f3ac1103adf0607c0b337128adb1337f5827ed | fd4503f5c9ef9f0dc5a3bed8f60f112e88a2bd0a | refs/heads/master | 2018-10-22T14:31:03.760000 | 2018-09-16T23:49:21 | 2018-09-16T23:49:21 | 130,140,712 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.aaa.game;
import java.util.Arrays;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
public class StatScreen implements Screen {
AAAGame game;
GameScreen mainScreen;
Unit u;
BitmapFont font;
OrthographicCamera camera;
Viewport vp;
public StatScreen(AAAGame g, GameScreen screen, Unit unit) {
camera = new OrthographicCamera();
vp = new FitViewport(AAAGame.V_WIDTH, AAAGame.V_HEIGHT, camera);
game = g;
mainScreen = screen;
u = unit;
font = new BitmapFont();
}
@Override
public void show() {
// TODO Auto-generated method stub
}
@Override
public void render(float delta) {
//game.batch.setTransformMatrix(camera.view);
//game.batch.setProjectionMatrix(camera.projection);
// TODO Auto-generated method stub
if (game.controller.poll() == 2) {
game.setScreen(mainScreen);
}
font.setColor(Color.LIGHT_GRAY);
//font.getData().setScale(1.5f);
game.batch.begin();
String hpstring= u.currHP + "/" + (int) u.hp + " HP";
String powstring = "POW: " + (int) u.pow;
String sklstring = "SKL: " + (int) u.skl;
String spdstring = "SPD: " + (int) u.spd;
String lukstring = "LUK: " + (int) u.luk;
String defstring = "DEF: " + (int) u.def;
String resstring = "RES: " + (int) u.res;
String movstring = "MOV: " + (int) u.mov;
int hit = Formulas.getBaseHit(u);
if (u.getEqWpn() != null) hit += u.getEqWpn().acc;
String hitstring = "Hit: " + hit + "%";
String avostring = "Avo: " + Formulas.getBaseAvo(u) + "%";
String crtstring = "Crit: " + Formulas.getBaseCrit(u) + "%";
String dgestring = "Dodge: " + Formulas.getBaseDodge(u) + "%";
font.draw(game.batch, u.name, 950, 800);
font.draw(game.batch, hpstring, 950, 750);
font.draw(game.batch, powstring, 950, 700);
font.draw(game.batch, sklstring, 950, 650);
font.draw(game.batch, spdstring, 950, 600);
font.draw(game.batch, lukstring, 950, 550);
font.draw(game.batch, defstring, 950, 500);
font.draw(game.batch, resstring, 950, 450);
font.draw(game.batch, movstring, 950, 400);
font.draw(game.batch, hitstring, 1050, 700);
font.draw(game.batch, avostring, 1050, 650);
font.draw(game.batch, crtstring, 1050, 600);
font.draw(game.batch, dgestring, 1050, 550);
String wpnstring = "";
for (Weapon i: u.inv.wpns) {
wpnstring += "\n";
wpnstring += i.name;
wpnstring += " ";
wpnstring += Arrays.toString(i.range);
}
font.draw(game.batch,wpnstring, 950, 350);
String otherstring = "";
for (Item i: u.inv.other) {
otherstring += "\n";
otherstring += i.name;
}
font.draw(game.batch,otherstring, 1050, 350);
game.batch.end();
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void hide() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
}
| UTF-8 | Java | 3,266 | java | StatScreen.java | Java | [] | null | [] | package com.aaa.game;
import java.util.Arrays;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
public class StatScreen implements Screen {
AAAGame game;
GameScreen mainScreen;
Unit u;
BitmapFont font;
OrthographicCamera camera;
Viewport vp;
public StatScreen(AAAGame g, GameScreen screen, Unit unit) {
camera = new OrthographicCamera();
vp = new FitViewport(AAAGame.V_WIDTH, AAAGame.V_HEIGHT, camera);
game = g;
mainScreen = screen;
u = unit;
font = new BitmapFont();
}
@Override
public void show() {
// TODO Auto-generated method stub
}
@Override
public void render(float delta) {
//game.batch.setTransformMatrix(camera.view);
//game.batch.setProjectionMatrix(camera.projection);
// TODO Auto-generated method stub
if (game.controller.poll() == 2) {
game.setScreen(mainScreen);
}
font.setColor(Color.LIGHT_GRAY);
//font.getData().setScale(1.5f);
game.batch.begin();
String hpstring= u.currHP + "/" + (int) u.hp + " HP";
String powstring = "POW: " + (int) u.pow;
String sklstring = "SKL: " + (int) u.skl;
String spdstring = "SPD: " + (int) u.spd;
String lukstring = "LUK: " + (int) u.luk;
String defstring = "DEF: " + (int) u.def;
String resstring = "RES: " + (int) u.res;
String movstring = "MOV: " + (int) u.mov;
int hit = Formulas.getBaseHit(u);
if (u.getEqWpn() != null) hit += u.getEqWpn().acc;
String hitstring = "Hit: " + hit + "%";
String avostring = "Avo: " + Formulas.getBaseAvo(u) + "%";
String crtstring = "Crit: " + Formulas.getBaseCrit(u) + "%";
String dgestring = "Dodge: " + Formulas.getBaseDodge(u) + "%";
font.draw(game.batch, u.name, 950, 800);
font.draw(game.batch, hpstring, 950, 750);
font.draw(game.batch, powstring, 950, 700);
font.draw(game.batch, sklstring, 950, 650);
font.draw(game.batch, spdstring, 950, 600);
font.draw(game.batch, lukstring, 950, 550);
font.draw(game.batch, defstring, 950, 500);
font.draw(game.batch, resstring, 950, 450);
font.draw(game.batch, movstring, 950, 400);
font.draw(game.batch, hitstring, 1050, 700);
font.draw(game.batch, avostring, 1050, 650);
font.draw(game.batch, crtstring, 1050, 600);
font.draw(game.batch, dgestring, 1050, 550);
String wpnstring = "";
for (Weapon i: u.inv.wpns) {
wpnstring += "\n";
wpnstring += i.name;
wpnstring += " ";
wpnstring += Arrays.toString(i.range);
}
font.draw(game.batch,wpnstring, 950, 350);
String otherstring = "";
for (Item i: u.inv.other) {
otherstring += "\n";
otherstring += i.name;
}
font.draw(game.batch,otherstring, 1050, 350);
game.batch.end();
}
@Override
public void resize(int width, int height) {
// TODO Auto-generated method stub
}
@Override
public void pause() {
// TODO Auto-generated method stub
}
@Override
public void resume() {
// TODO Auto-generated method stub
}
@Override
public void hide() {
// TODO Auto-generated method stub
}
@Override
public void dispose() {
// TODO Auto-generated method stub
}
}
| 3,266 | 0.664728 | 0.634415 | 130 | 24.123077 | 19.433126 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.3 | false | false | 9 |
a2d094f2cec4579f604135a20d1f15921a93421f | 20,186,346,355,818 | f8f9a841a896c45b562e5fc2cee4fd9d58e13523 | /atlassian-plugins-webresource/src/main/java/com/atlassian/plugin/webresource/ResourceUtils.java | 07b3f7676d64607001231bf2792a7b64bc185fc9 | [] | no_license | gitsense/atlassian-plugins-webresource | https://github.com/gitsense/atlassian-plugins-webresource | bcfe87e43fecf374d81e3e7f03656c9cb24412ff | e76b0c388e75fea8cb6d9e7856d3139bf5372ff1 | refs/heads/master | 2016-08-11T03:14:37.537000 | 2016-01-21T00:45:13 | 2016-01-21T00:45:13 | 50,911,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.atlassian.plugin.webresource;
import com.atlassian.util.concurrent.NotNull;
import java.util.Map;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
public class ResourceUtils
{
/**
* @since 2.13
*/
public static final String STATIC_HASH = "_statichash";
/**
* Determines the type (css/js) of the resource from the given path.
* @param path - the path to use
* @return the type of resource
*/
public static String getType(@NotNull String path)
{
int index = path.lastIndexOf('.');
if (index > -1 && index < path.length())
return path.substring(index + 1);
return "";
}
/**
* Determines the base name (name without the extension) of the resource from the given path.
* @param path - the path to use
* @return the basename of resource
*
* @since 3.3
*/
public static String getBasename(@NotNull String path)
{
int index = path.lastIndexOf('.');
if (index > -1 && index < path.length())
{
return path.substring(0, index);
}
return path;
}
/**
* Returns a Map of query parameters from the request. If there are multiple values for the same
* query parameter, the first value is used.
*
* @see {@link javax.servlet.ServletRequest#getParameterMap()}
*/
public static Map<String, String> getQueryParameters(HttpServletRequest request)
{
Map<String, String> result = new TreeMap<String, String>();
Map<String, String[]> parameters = request.getParameterMap();
for (Map.Entry<String, String[]> entry : parameters.entrySet())
{
if (entry.getValue() != null && entry.getValue().length > 0)
result.put(entry.getKey(), entry.getValue()[0]);
}
final String hash = (String) request.getAttribute(STATIC_HASH);
if (hash != null)
{
result.put(STATIC_HASH, hash);
}
return result;
}
/**
* Given a parameter map, determine if a web resource is cacheable.
*
* This determines whether we store in the file cache or not, as well as dictating 304 behaviour.
*
* @param params
* @return if the PluginResourceDownload.STATIC_HASH is set and cache does not equal false.
*/
public static boolean canRequestedResourcesContentBeAssumedConstant(Map<String, String> params) {
final boolean nocache = "false".equals(params.get("cache"));
final boolean nohash = !params.containsKey(STATIC_HASH);
return !(nohash || nocache);
}
}
| UTF-8 | Java | 2,659 | java | ResourceUtils.java | Java | [] | null | [] | package com.atlassian.plugin.webresource;
import com.atlassian.util.concurrent.NotNull;
import java.util.Map;
import java.util.TreeMap;
import javax.servlet.http.HttpServletRequest;
public class ResourceUtils
{
/**
* @since 2.13
*/
public static final String STATIC_HASH = "_statichash";
/**
* Determines the type (css/js) of the resource from the given path.
* @param path - the path to use
* @return the type of resource
*/
public static String getType(@NotNull String path)
{
int index = path.lastIndexOf('.');
if (index > -1 && index < path.length())
return path.substring(index + 1);
return "";
}
/**
* Determines the base name (name without the extension) of the resource from the given path.
* @param path - the path to use
* @return the basename of resource
*
* @since 3.3
*/
public static String getBasename(@NotNull String path)
{
int index = path.lastIndexOf('.');
if (index > -1 && index < path.length())
{
return path.substring(0, index);
}
return path;
}
/**
* Returns a Map of query parameters from the request. If there are multiple values for the same
* query parameter, the first value is used.
*
* @see {@link javax.servlet.ServletRequest#getParameterMap()}
*/
public static Map<String, String> getQueryParameters(HttpServletRequest request)
{
Map<String, String> result = new TreeMap<String, String>();
Map<String, String[]> parameters = request.getParameterMap();
for (Map.Entry<String, String[]> entry : parameters.entrySet())
{
if (entry.getValue() != null && entry.getValue().length > 0)
result.put(entry.getKey(), entry.getValue()[0]);
}
final String hash = (String) request.getAttribute(STATIC_HASH);
if (hash != null)
{
result.put(STATIC_HASH, hash);
}
return result;
}
/**
* Given a parameter map, determine if a web resource is cacheable.
*
* This determines whether we store in the file cache or not, as well as dictating 304 behaviour.
*
* @param params
* @return if the PluginResourceDownload.STATIC_HASH is set and cache does not equal false.
*/
public static boolean canRequestedResourcesContentBeAssumedConstant(Map<String, String> params) {
final boolean nocache = "false".equals(params.get("cache"));
final boolean nohash = !params.containsKey(STATIC_HASH);
return !(nohash || nocache);
}
}
| 2,659 | 0.614141 | 0.608876 | 86 | 29.918604 | 29.531305 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.406977 | false | false | 9 |
980d1d65c2c5879ecea437099000b9548274b76f | 10,746,008,229,211 | e529a8e2202125766e7942aa0678323abbdfd886 | /app/src/main/java/com/zyla/musicapp/adapter/MusicAdapter.java | 4b5491fc5f7897ff0f6d9a79b8a5424e6784b84b | [] | no_license | iamatulkumar/Demo-Music-App | https://github.com/iamatulkumar/Demo-Music-App | 80b57efcf38e2f80929b85dc39b5bce4e4228800 | 2551fd3c92aa85e9dfc5ff94f1fa21b52829a5e2 | refs/heads/master | 2021-09-06T06:48:29.124000 | 2018-02-03T12:27:16 | 2018-02-03T12:27:16 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.zyla.musicapp.adapter;
/**
* Created by pratap.kesaboyina on 24-12-2014.
*/
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zyla.musicapp.R;
import com.zyla.musicapp.databinding.ListItemBinding;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class MusicAdapter extends RecyclerView.Adapter<MusicAdapter.ItemRowHolder> {
private String TAG ="MusicAdapter";
private HashMap<String, ArrayList<String>> nameList;
private Context mContext;
private ArrayList<String> key = new ArrayList<>();
private ArrayList<ArrayList<String>> value = new ArrayList<>();
/**
* @param context Mainactivity context
* @param listHashMap hashmap which show in mainactivity
*/
public MusicAdapter(Context context, HashMap<String, ArrayList<String>> listHashMap) {
this.nameList=listHashMap;
this.mContext = context;
for(Map.Entry<String, ArrayList<String>> e : nameList.entrySet()) {
key.add(e.getKey());
value.add(e.getValue());
Log.d(TAG,key+" "+value);
}
}
@Override
public ItemRowHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_item, null);
return new ItemRowHolder(view);
}
@Override
public void onBindViewHolder(ItemRowHolder itemRowHolder, int i) {
itemRowHolder.bindheader(key.get(i));
DataAdapter itemListDataAdapter = new DataAdapter(mContext, value.get(i));
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(mContext);
itemRowHolder.binding.recyclerViewList.setLayoutManager(mLayoutManager);
itemRowHolder.binding.recyclerViewList.setAdapter(itemListDataAdapter);
}
@Override
public int getItemCount() {
return (null != nameList ? nameList.size() : 0);
}
protected class ItemRowHolder extends RecyclerView.ViewHolder {
ListItemBinding binding;
private ItemRowHolder(View view) {
super(view);
binding = DataBindingUtil.bind(view);
}
private void bindheader(String str){
binding.setKey(str);
}
}
} | UTF-8 | Java | 2,510 | java | MusicAdapter.java | Java | [
{
"context": "kage com.zyla.musicapp.adapter;\n\n/**\n * Created by pratap.kesaboyina on 24-12-2014.\n */\n\nimport android.content.Contex",
"end": 71,
"score": 0.9962535500526428,
"start": 54,
"tag": "NAME",
"value": "pratap.kesaboyina"
}
] | null | [] | package com.zyla.musicapp.adapter;
/**
* Created by pratap.kesaboyina on 24-12-2014.
*/
import android.content.Context;
import android.databinding.DataBindingUtil;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.zyla.musicapp.R;
import com.zyla.musicapp.databinding.ListItemBinding;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class MusicAdapter extends RecyclerView.Adapter<MusicAdapter.ItemRowHolder> {
private String TAG ="MusicAdapter";
private HashMap<String, ArrayList<String>> nameList;
private Context mContext;
private ArrayList<String> key = new ArrayList<>();
private ArrayList<ArrayList<String>> value = new ArrayList<>();
/**
* @param context Mainactivity context
* @param listHashMap hashmap which show in mainactivity
*/
public MusicAdapter(Context context, HashMap<String, ArrayList<String>> listHashMap) {
this.nameList=listHashMap;
this.mContext = context;
for(Map.Entry<String, ArrayList<String>> e : nameList.entrySet()) {
key.add(e.getKey());
value.add(e.getValue());
Log.d(TAG,key+" "+value);
}
}
@Override
public ItemRowHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.list_item, null);
return new ItemRowHolder(view);
}
@Override
public void onBindViewHolder(ItemRowHolder itemRowHolder, int i) {
itemRowHolder.bindheader(key.get(i));
DataAdapter itemListDataAdapter = new DataAdapter(mContext, value.get(i));
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(mContext);
itemRowHolder.binding.recyclerViewList.setLayoutManager(mLayoutManager);
itemRowHolder.binding.recyclerViewList.setAdapter(itemListDataAdapter);
}
@Override
public int getItemCount() {
return (null != nameList ? nameList.size() : 0);
}
protected class ItemRowHolder extends RecyclerView.ViewHolder {
ListItemBinding binding;
private ItemRowHolder(View view) {
super(view);
binding = DataBindingUtil.bind(view);
}
private void bindheader(String str){
binding.setKey(str);
}
}
} | 2,510 | 0.69761 | 0.693227 | 85 | 28.541176 | 27.414703 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.529412 | false | false | 9 |
53978c8c91cfb12ae87a78c78f88856c92fbdc82 | 10,746,008,227,953 | 3b91ed788572b6d5ac4db1bee814a74560603578 | /com/tencent/mm/pluginsdk/ui/d/l.java | dbba3185a671ed74582dbe6a8f7b1267baaaec28 | [] | no_license | linsir6/WeChat_java | https://github.com/linsir6/WeChat_java | a1deee3035b555fb35a423f367eb5e3e58a17cb0 | 32e52b88c012051100315af6751111bfb6697a29 | refs/heads/master | 2020-05-31T05:40:17.161000 | 2018-08-28T02:07:02 | 2018-08-28T02:07:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tencent.mm.pluginsdk.ui.d;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;
import android.widget.Toast;
import com.tencent.mars.comm.PlatformComm.C2Java;
import com.tencent.mm.R;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.q;
import com.tencent.mm.plugin.messenger.foundation.a.i;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.protocal.c.aur;
import com.tencent.mm.protocal.c.bar;
import com.tencent.mm.protocal.c.bas;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.aa.a;
import com.tencent.mm.storage.ab;
import com.tencent.mm.ui.base.k;
import com.tencent.smtt.sdk.WebView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public final class l {
static String qQc;
static /* synthetic */ void a(Activity activity, String str, Bundle bundle) {
String oV = bi.oV(bundle.getString("Contact_User"));
if (oV == null) {
x.e("MicroMsg.MailPhoneMenuHelper", "username is null");
return;
}
ab Yg = ((i) g.l(i.class)).FR().Yg(oV);
if (Yg == null) {
x.e("MicroMsg.MailPhoneMenuHelper", "contact is null");
return;
}
int i;
ArrayList arrayList;
String string = bundle.getString("Contact_Mobile_MD5");
String str2 = Yg.csZ;
if (!bi.oW(string)) {
if (string == str) {
i = 0;
} else if (!Yg.BH()) {
i = 1;
}
arrayList = new ArrayList();
if (!bi.oW(str2)) {
String[] split = str2.split(",");
for (Object add : split) {
arrayList.add(add);
}
if (arrayList.contains(str)) {
arrayList.remove(str);
}
}
arrayList.add(str);
if (arrayList.size() + i > 5) {
a(activity, Yg, oV, arrayList);
h.mEJ.h(12040, new Object[]{Yg.field_username, Integer.valueOf(4), Integer.valueOf(i), Integer.valueOf(i + arrayList.size())});
}
Toast.makeText(activity, activity.getString(R.l.more_than_five_phone_number), 0).show();
return;
}
i = 0;
arrayList = new ArrayList();
if (bi.oW(str2)) {
String[] split2 = str2.split(",");
for (Object add2 : split2) {
arrayList.add(add2);
}
if (arrayList.contains(str)) {
arrayList.remove(str);
}
}
arrayList.add(str);
if (arrayList.size() + i > 5) {
Toast.makeText(activity, activity.getString(R.l.more_than_five_phone_number), 0).show();
return;
}
a(activity, Yg, oV, arrayList);
h.mEJ.h(12040, new Object[]{Yg.field_username, Integer.valueOf(4), Integer.valueOf(i), Integer.valueOf(i + arrayList.size())});
}
static /* synthetic */ void bn(Context context, String str) {
Intent intent = new Intent("android.intent.action.SENDTO");
intent.setData(Uri.parse(WebView.SCHEME_MAILTO));
intent.putExtra("android.intent.extra.EMAIL", new String[]{str});
if (bi.k(context, intent)) {
context.startActivity(intent);
} else {
com.tencent.mm.ui.base.h.a(context, R.l.chatting_no_default_email_app, R.l.app_tip, new 8());
}
}
static /* synthetic */ void bo(Context context, String str) {
Intent intent = new Intent("android.intent.action.INSERT_OR_EDIT", Contacts.CONTENT_URI);
intent.setType("vnd.android.cursor.item/person");
intent.putExtra("phone", str);
if (bi.k(context, intent)) {
context.startActivity(intent);
}
}
public static void b(Context context, String str, OnDismissListener onDismissListener) {
if (((q.GQ() & 1) == 0 ? 1 : 0) != 0) {
com.tencent.mm.ui.base.h.a(context, str, context.getResources().getStringArray(R.c.email_url), "", new 1(onDismissListener, str, context));
} else {
com.tencent.mm.ui.base.h.a(context, str, new String[]{context.getResources().getString(R.l.chatting_email_by_default_account)}, "", new 2(onDismissListener, str, context));
}
}
public static void a(Context context, String str, OnDismissListener onDismissListener, Bundle bundle) {
boolean booleanValue;
boolean z;
List F;
if (!(context instanceof Activity)) {
x.w("MicroMsg.MailPhoneMenuHelper", "context should be Activity, %s", new Object[]{bi.cjd()});
}
if (g.Eg().Dx()) {
booleanValue = ((Boolean) g.Ei().DT().get(a.sRf, Boolean.valueOf(false))).booleanValue();
} else {
booleanValue = false;
}
int i = bundle != null ? bundle.getInt("fromScene") : 0;
if (cfi() || cfj()) {
z = true;
} else {
z = false;
}
if (z) {
String str2;
String[] strArr;
if (bundle == null) {
str2 = "";
} else {
str2 = bundle.getString("Contact_User");
}
String oV = bi.oV(str2);
if (oV == null || oV == "" || oV.endsWith("@chatroom") || q.gQ(oV)) {
strArr = booleanValue ? new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_use_by_ipcall), context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)} : new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)};
} else {
ab Yg = ((i) g.l(i.class)).FR().Yg(oV);
if (Yg != null) {
str2 = Yg.BL();
qQc = context.getResources().getString(R.l.chatting_phone_add_remark, new Object[]{str2});
strArr = booleanValue ? new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_use_by_ipcall), qQc, context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)} : new String[]{context.getResources().getString(R.l.chatting_phone_use), qQc, context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)};
} else {
return;
}
}
F = bi.F(strArr);
} else {
F = bi.F(new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_copy)});
}
h.mEJ.h(11621, new Object[]{Integer.valueOf(i), Integer.valueOf(2)});
if (q.vq()) {
F.add(context.getResources().getString(R.l.chatting_phone_download_wxpb));
h.mEJ.h(11621, new Object[]{Integer.valueOf(i), Integer.valueOf(3)});
if (C2Java.isNetworkConnected()) {
x.v("MicroMsg.WxPhoneBookHelper", "hy: minus pb counter, ori counter = %d", new Object[]{Integer.valueOf(bi.a((Integer) g.Ei().DT().get(a.sPC, null), 3))});
g.Ei().DT().a(a.sPC, Integer.valueOf(r0 - 1));
}
}
k kVar = new k(context);
kVar.setTitle(str);
a aVar = new a(F, context, onDismissListener, bundle);
aVar.qQk = new 5(kVar, onDismissListener);
kVar.hAv = aVar;
com.tencent.mm.ui.base.h.a(context, kVar);
kVar.setOnCancelListener(new 6(onDismissListener));
kVar.qRL = new 7(str, F, context, kVar, onDismissListener, i, bundle);
kVar.show();
}
static boolean cfi() {
Context context = ad.getContext();
Intent intent = new Intent("android.intent.action.INSERT");
intent.setType("vnd.android.cursor.dir/contact");
intent.putExtra("phone", "10086");
return bi.k(context, intent);
}
static boolean cfj() {
return bi.k(ad.getContext(), new Intent("android.intent.action.PICK", Contacts.CONTENT_URI));
}
private static void a(Activity activity, ab abVar, String str, ArrayList<String> arrayList) {
String str2;
aur aur = new aur();
aur.rXy = str;
bas bas = new bas();
bas.hbF = arrayList.size();
bas.sdd = new LinkedList();
Iterator it = arrayList.iterator();
while (it.hasNext()) {
str2 = (String) it.next();
bar bar = new bar();
bar.sdc = str2;
bas.sdd.add(bar);
}
aur.rXu = bas;
((i) g.l(i.class)).FQ().b(new com.tencent.mm.plugin.messenger.foundation.a.a.h.a(60, aur));
ab Yg = ((i) g.l(i.class)).FR().Yg(str);
if (Yg != null && ((int) Yg.dhP) > 0 && com.tencent.mm.l.a.gd(Yg.field_type)) {
String str3;
str2 = "";
Iterator it2 = arrayList.iterator();
while (true) {
str3 = str2;
if (!it2.hasNext()) {
break;
}
str2 = (str3 + ((String) it2.next())) + ",";
}
abVar.dZ(str3);
((i) g.l(i.class)).FR().S(abVar);
}
Toast.makeText(activity, activity.getString(R.l.succeed_add_to_remark), 0).show();
}
}
| UTF-8 | Java | 9,901 | java | l.java | Java | [
{
"context": " if (oV == null || oV == \"\" || oV.endsWith(\"@chatroom\") || q.gQ(oV)) {\n strArr = boolean",
"end": 5675,
"score": 0.7610802054405212,
"start": 5667,
"tag": "USERNAME",
"value": "chatroom"
}
] | null | [] | package com.tencent.mm.pluginsdk.ui.d;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract.Contacts;
import android.widget.Toast;
import com.tencent.mars.comm.PlatformComm.C2Java;
import com.tencent.mm.R;
import com.tencent.mm.kernel.g;
import com.tencent.mm.model.q;
import com.tencent.mm.plugin.messenger.foundation.a.i;
import com.tencent.mm.plugin.report.service.h;
import com.tencent.mm.protocal.c.aur;
import com.tencent.mm.protocal.c.bar;
import com.tencent.mm.protocal.c.bas;
import com.tencent.mm.sdk.platformtools.ad;
import com.tencent.mm.sdk.platformtools.bi;
import com.tencent.mm.sdk.platformtools.x;
import com.tencent.mm.storage.aa.a;
import com.tencent.mm.storage.ab;
import com.tencent.mm.ui.base.k;
import com.tencent.smtt.sdk.WebView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public final class l {
static String qQc;
static /* synthetic */ void a(Activity activity, String str, Bundle bundle) {
String oV = bi.oV(bundle.getString("Contact_User"));
if (oV == null) {
x.e("MicroMsg.MailPhoneMenuHelper", "username is null");
return;
}
ab Yg = ((i) g.l(i.class)).FR().Yg(oV);
if (Yg == null) {
x.e("MicroMsg.MailPhoneMenuHelper", "contact is null");
return;
}
int i;
ArrayList arrayList;
String string = bundle.getString("Contact_Mobile_MD5");
String str2 = Yg.csZ;
if (!bi.oW(string)) {
if (string == str) {
i = 0;
} else if (!Yg.BH()) {
i = 1;
}
arrayList = new ArrayList();
if (!bi.oW(str2)) {
String[] split = str2.split(",");
for (Object add : split) {
arrayList.add(add);
}
if (arrayList.contains(str)) {
arrayList.remove(str);
}
}
arrayList.add(str);
if (arrayList.size() + i > 5) {
a(activity, Yg, oV, arrayList);
h.mEJ.h(12040, new Object[]{Yg.field_username, Integer.valueOf(4), Integer.valueOf(i), Integer.valueOf(i + arrayList.size())});
}
Toast.makeText(activity, activity.getString(R.l.more_than_five_phone_number), 0).show();
return;
}
i = 0;
arrayList = new ArrayList();
if (bi.oW(str2)) {
String[] split2 = str2.split(",");
for (Object add2 : split2) {
arrayList.add(add2);
}
if (arrayList.contains(str)) {
arrayList.remove(str);
}
}
arrayList.add(str);
if (arrayList.size() + i > 5) {
Toast.makeText(activity, activity.getString(R.l.more_than_five_phone_number), 0).show();
return;
}
a(activity, Yg, oV, arrayList);
h.mEJ.h(12040, new Object[]{Yg.field_username, Integer.valueOf(4), Integer.valueOf(i), Integer.valueOf(i + arrayList.size())});
}
static /* synthetic */ void bn(Context context, String str) {
Intent intent = new Intent("android.intent.action.SENDTO");
intent.setData(Uri.parse(WebView.SCHEME_MAILTO));
intent.putExtra("android.intent.extra.EMAIL", new String[]{str});
if (bi.k(context, intent)) {
context.startActivity(intent);
} else {
com.tencent.mm.ui.base.h.a(context, R.l.chatting_no_default_email_app, R.l.app_tip, new 8());
}
}
static /* synthetic */ void bo(Context context, String str) {
Intent intent = new Intent("android.intent.action.INSERT_OR_EDIT", Contacts.CONTENT_URI);
intent.setType("vnd.android.cursor.item/person");
intent.putExtra("phone", str);
if (bi.k(context, intent)) {
context.startActivity(intent);
}
}
public static void b(Context context, String str, OnDismissListener onDismissListener) {
if (((q.GQ() & 1) == 0 ? 1 : 0) != 0) {
com.tencent.mm.ui.base.h.a(context, str, context.getResources().getStringArray(R.c.email_url), "", new 1(onDismissListener, str, context));
} else {
com.tencent.mm.ui.base.h.a(context, str, new String[]{context.getResources().getString(R.l.chatting_email_by_default_account)}, "", new 2(onDismissListener, str, context));
}
}
public static void a(Context context, String str, OnDismissListener onDismissListener, Bundle bundle) {
boolean booleanValue;
boolean z;
List F;
if (!(context instanceof Activity)) {
x.w("MicroMsg.MailPhoneMenuHelper", "context should be Activity, %s", new Object[]{bi.cjd()});
}
if (g.Eg().Dx()) {
booleanValue = ((Boolean) g.Ei().DT().get(a.sRf, Boolean.valueOf(false))).booleanValue();
} else {
booleanValue = false;
}
int i = bundle != null ? bundle.getInt("fromScene") : 0;
if (cfi() || cfj()) {
z = true;
} else {
z = false;
}
if (z) {
String str2;
String[] strArr;
if (bundle == null) {
str2 = "";
} else {
str2 = bundle.getString("Contact_User");
}
String oV = bi.oV(str2);
if (oV == null || oV == "" || oV.endsWith("@chatroom") || q.gQ(oV)) {
strArr = booleanValue ? new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_use_by_ipcall), context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)} : new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)};
} else {
ab Yg = ((i) g.l(i.class)).FR().Yg(oV);
if (Yg != null) {
str2 = Yg.BL();
qQc = context.getResources().getString(R.l.chatting_phone_add_remark, new Object[]{str2});
strArr = booleanValue ? new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_use_by_ipcall), qQc, context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)} : new String[]{context.getResources().getString(R.l.chatting_phone_use), qQc, context.getResources().getString(R.l.chatting_phone_copy), context.getResources().getString(R.l.chatting_phone_add_op)};
} else {
return;
}
}
F = bi.F(strArr);
} else {
F = bi.F(new String[]{context.getResources().getString(R.l.chatting_phone_use), context.getResources().getString(R.l.chatting_phone_copy)});
}
h.mEJ.h(11621, new Object[]{Integer.valueOf(i), Integer.valueOf(2)});
if (q.vq()) {
F.add(context.getResources().getString(R.l.chatting_phone_download_wxpb));
h.mEJ.h(11621, new Object[]{Integer.valueOf(i), Integer.valueOf(3)});
if (C2Java.isNetworkConnected()) {
x.v("MicroMsg.WxPhoneBookHelper", "hy: minus pb counter, ori counter = %d", new Object[]{Integer.valueOf(bi.a((Integer) g.Ei().DT().get(a.sPC, null), 3))});
g.Ei().DT().a(a.sPC, Integer.valueOf(r0 - 1));
}
}
k kVar = new k(context);
kVar.setTitle(str);
a aVar = new a(F, context, onDismissListener, bundle);
aVar.qQk = new 5(kVar, onDismissListener);
kVar.hAv = aVar;
com.tencent.mm.ui.base.h.a(context, kVar);
kVar.setOnCancelListener(new 6(onDismissListener));
kVar.qRL = new 7(str, F, context, kVar, onDismissListener, i, bundle);
kVar.show();
}
static boolean cfi() {
Context context = ad.getContext();
Intent intent = new Intent("android.intent.action.INSERT");
intent.setType("vnd.android.cursor.dir/contact");
intent.putExtra("phone", "10086");
return bi.k(context, intent);
}
static boolean cfj() {
return bi.k(ad.getContext(), new Intent("android.intent.action.PICK", Contacts.CONTENT_URI));
}
private static void a(Activity activity, ab abVar, String str, ArrayList<String> arrayList) {
String str2;
aur aur = new aur();
aur.rXy = str;
bas bas = new bas();
bas.hbF = arrayList.size();
bas.sdd = new LinkedList();
Iterator it = arrayList.iterator();
while (it.hasNext()) {
str2 = (String) it.next();
bar bar = new bar();
bar.sdc = str2;
bas.sdd.add(bar);
}
aur.rXu = bas;
((i) g.l(i.class)).FQ().b(new com.tencent.mm.plugin.messenger.foundation.a.a.h.a(60, aur));
ab Yg = ((i) g.l(i.class)).FR().Yg(str);
if (Yg != null && ((int) Yg.dhP) > 0 && com.tencent.mm.l.a.gd(Yg.field_type)) {
String str3;
str2 = "";
Iterator it2 = arrayList.iterator();
while (true) {
str3 = str2;
if (!it2.hasNext()) {
break;
}
str2 = (str3 + ((String) it2.next())) + ",";
}
abVar.dZ(str3);
((i) g.l(i.class)).FR().S(abVar);
}
Toast.makeText(activity, activity.getString(R.l.succeed_add_to_remark), 0).show();
}
}
| 9,901 | 0.567922 | 0.559236 | 230 | 42.047825 | 52.993622 | 506 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.069565 | false | false | 9 |
892d501060dcfe70fd70b1b9355f38dc87d1a9c5 | 24,962,349,978,919 | 2047960e2672c62816ca6cd57bb6ed2023d36973 | /gcloud-shop-domain/src/main/java/com/gcloud/shop/domain/GoodsItem.java | 26743787647bdd839762bfe3283d2e2a2663d33e | [] | no_license | houzhenggang/gcloud-shop | https://github.com/houzhenggang/gcloud-shop | f31533fb45bf17f61e1b7cef2331157cb68aa133 | dbf16162600fa999de7fd6feb67089d40dcc00b8 | refs/heads/master | 2020-03-29T09:09:48.815000 | 2016-10-10T01:47:30 | 2016-10-10T01:47:30 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.gcloud.shop.domain;
import java.util.Date;
public class GoodsItem {
/**
* 主键 <p/>
* This field corresponds to the database column tb_goods_item.id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Long id;
/**
* 门店ID <p/>
* This field corresponds to the database column tb_goods_item.store_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String storeId;
/**
* 商品ID(口碑) <p/>
* This field corresponds to the database column tb_goods_item.itme_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String itmeId;
/**
* 商品ID(系统) <p/>
* This field corresponds to the database column tb_goods_item.item_sys_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String itemSysId;
/**
* 商品类型,券类型填写固定值VOUCHER <p/>
* This field corresponds to the database column tb_goods_item.item_type
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String itemType;
/**
* 商品名称,请勿超过15个汉字,30个字符 <p/>
* This field corresponds to the database column tb_goods_item.subject
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String subject;
/**
* 商品购买类型 OBTAIN为领取,AUTO_OBTAIN为自动领取 <p/>
* This field corresponds to the database column tb_goods_item.purchase_mode
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String purchaseMode;
/**
* 商品库存数量 <p/>
* This field corresponds to the database column tb_goods_item.inventory
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Long inventory;
/**
* 商品首图,尺寸比例在65:53范围内且图片大小不超过10k皆可,图片推荐尺寸540*420 <p/>
* This field corresponds to the database column tb_goods_item.cover
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String cover;
/**
* 商品顺序权重,必须是整数,不传默认为0,权重数值越大排序越靠前 <p/>
* This field corresponds to the database column tb_goods_item.weight
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Long weight;
/**
* 商品生效时间,到达生效时间后才可在客户端展示出来。 说明: 商品的生效时间不能早于创建当天的0点 <p/>
* This field corresponds to the database column tb_goods_item.gmt_start
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date gmtStart;
/**
* 商品下架时间,不得早于商品生效时间,商品下架 <p/>
* This field corresponds to the database column tb_goods_item.gmt_end
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date gmtEnd;
/**
* 0否 1是 是否自动延期,默认false。 如果需要设置自动延期,则gmt_start和gmt_end之间要间隔2天以上 <p/>
* This field corresponds to the database column tb_goods_item.is_auto_expanded
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Byte isAutoExpanded;
/**
* 商户通知地址,口碑发消息给商户通知其是否对商品创建、修改、变更状态成功 <p/>
* This field corresponds to the database column tb_goods_item.operate_notify_url
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String operateNotifyUrl;
/**
* 当前状态(0 未确认 1 商家确认 2 小二确认 -1 屏蔽 -2 删除) <p/>
* This field corresponds to the database column tb_goods_item.status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Byte status;
/**
* 平台信息(kb口碑 tb淘宝 bd百度外卖) <p/>
* This field corresponds to the database column tb_goods_item.platform
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String platform;
/**
* 备注 <p/>
* This field corresponds to the database column tb_goods_item.remark
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String remark;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tb_goods_item.created
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date created;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tb_goods_item.modified
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date modified;
/**
* 0否 1是 <p/>
* This field corresponds to the database column tb_goods_item.enable_status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Boolean enableStatus;
/**
* 上架门店id列表,即传入一个或多个shop_id,必须是创建商品partnerId下的店铺,目前支持的店铺最大100个,如果超过100个店铺需要报备 <p/>
* This field corresponds to the database column tb_goods_item.shop_list
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String shopList;
/**
* 主键 <p/>
* This method returns the value of the database column tb_goods_item.id
*
* @return the value of tb_goods_item.id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Long getId() {
return id;
}
/**
* 主键 <p/>
* This method sets the value of the database column tb_goods_item.id
*
* @param id the value for tb_goods_item.id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setId(Long id) {
this.id = id;
}
/**
* 门店ID <p/>
* This method returns the value of the database column tb_goods_item.store_id
*
* @return the value of tb_goods_item.store_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getStoreId() {
return storeId;
}
/**
* 门店ID <p/>
* This method sets the value of the database column tb_goods_item.store_id
*
* @param storeId the value for tb_goods_item.store_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setStoreId(String storeId) {
this.storeId = storeId == null ? null : storeId.trim();
}
/**
* 商品ID(口碑) <p/>
* This method returns the value of the database column tb_goods_item.itme_id
*
* @return the value of tb_goods_item.itme_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getItmeId() {
return itmeId;
}
/**
* 商品ID(口碑) <p/>
* This method sets the value of the database column tb_goods_item.itme_id
*
* @param itmeId the value for tb_goods_item.itme_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setItmeId(String itmeId) {
this.itmeId = itmeId == null ? null : itmeId.trim();
}
/**
* 商品ID(系统) <p/>
* This method returns the value of the database column tb_goods_item.item_sys_id
*
* @return the value of tb_goods_item.item_sys_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getItemSysId() {
return itemSysId;
}
/**
* 商品ID(系统) <p/>
* This method sets the value of the database column tb_goods_item.item_sys_id
*
* @param itemSysId the value for tb_goods_item.item_sys_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setItemSysId(String itemSysId) {
this.itemSysId = itemSysId == null ? null : itemSysId.trim();
}
/**
* 商品类型,券类型填写固定值VOUCHER <p/>
* This method returns the value of the database column tb_goods_item.item_type
*
* @return the value of tb_goods_item.item_type
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getItemType() {
return itemType;
}
/**
* 商品类型,券类型填写固定值VOUCHER <p/>
* This method sets the value of the database column tb_goods_item.item_type
*
* @param itemType the value for tb_goods_item.item_type
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setItemType(String itemType) {
this.itemType = itemType == null ? null : itemType.trim();
}
/**
* 商品名称,请勿超过15个汉字,30个字符 <p/>
* This method returns the value of the database column tb_goods_item.subject
*
* @return the value of tb_goods_item.subject
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getSubject() {
return subject;
}
/**
* 商品名称,请勿超过15个汉字,30个字符 <p/>
* This method sets the value of the database column tb_goods_item.subject
*
* @param subject the value for tb_goods_item.subject
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setSubject(String subject) {
this.subject = subject == null ? null : subject.trim();
}
/**
* 商品购买类型 OBTAIN为领取,AUTO_OBTAIN为自动领取 <p/>
* This method returns the value of the database column tb_goods_item.purchase_mode
*
* @return the value of tb_goods_item.purchase_mode
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getPurchaseMode() {
return purchaseMode;
}
/**
* 商品购买类型 OBTAIN为领取,AUTO_OBTAIN为自动领取 <p/>
* This method sets the value of the database column tb_goods_item.purchase_mode
*
* @param purchaseMode the value for tb_goods_item.purchase_mode
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setPurchaseMode(String purchaseMode) {
this.purchaseMode = purchaseMode == null ? null : purchaseMode.trim();
}
/**
* 商品库存数量 <p/>
* This method returns the value of the database column tb_goods_item.inventory
*
* @return the value of tb_goods_item.inventory
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Long getInventory() {
return inventory;
}
/**
* 商品库存数量 <p/>
* This method sets the value of the database column tb_goods_item.inventory
*
* @param inventory the value for tb_goods_item.inventory
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setInventory(Long inventory) {
this.inventory = inventory;
}
/**
* 商品首图,尺寸比例在65:53范围内且图片大小不超过10k皆可,图片推荐尺寸540*420 <p/>
* This method returns the value of the database column tb_goods_item.cover
*
* @return the value of tb_goods_item.cover
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getCover() {
return cover;
}
/**
* 商品首图,尺寸比例在65:53范围内且图片大小不超过10k皆可,图片推荐尺寸540*420 <p/>
* This method sets the value of the database column tb_goods_item.cover
*
* @param cover the value for tb_goods_item.cover
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setCover(String cover) {
this.cover = cover == null ? null : cover.trim();
}
/**
* 商品顺序权重,必须是整数,不传默认为0,权重数值越大排序越靠前 <p/>
* This method returns the value of the database column tb_goods_item.weight
*
* @return the value of tb_goods_item.weight
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Long getWeight() {
return weight;
}
/**
* 商品顺序权重,必须是整数,不传默认为0,权重数值越大排序越靠前 <p/>
* This method sets the value of the database column tb_goods_item.weight
*
* @param weight the value for tb_goods_item.weight
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setWeight(Long weight) {
this.weight = weight;
}
/**
* 商品生效时间,到达生效时间后才可在客户端展示出来。 说明: 商品的生效时间不能早于创建当天的0点 <p/>
* This method returns the value of the database column tb_goods_item.gmt_start
*
* @return the value of tb_goods_item.gmt_start
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getGmtStart() {
return gmtStart;
}
/**
* 商品生效时间,到达生效时间后才可在客户端展示出来。 说明: 商品的生效时间不能早于创建当天的0点 <p/>
* This method sets the value of the database column tb_goods_item.gmt_start
*
* @param gmtStart the value for tb_goods_item.gmt_start
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setGmtStart(Date gmtStart) {
this.gmtStart = gmtStart;
}
/**
* 商品下架时间,不得早于商品生效时间,商品下架 <p/>
* This method returns the value of the database column tb_goods_item.gmt_end
*
* @return the value of tb_goods_item.gmt_end
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getGmtEnd() {
return gmtEnd;
}
/**
* 商品下架时间,不得早于商品生效时间,商品下架 <p/>
* This method sets the value of the database column tb_goods_item.gmt_end
*
* @param gmtEnd the value for tb_goods_item.gmt_end
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setGmtEnd(Date gmtEnd) {
this.gmtEnd = gmtEnd;
}
/**
* 0否 1是 是否自动延期,默认false。 如果需要设置自动延期,则gmt_start和gmt_end之间要间隔2天以上 <p/>
* This method returns the value of the database column tb_goods_item.is_auto_expanded
*
* @return the value of tb_goods_item.is_auto_expanded
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Byte getIsAutoExpanded() {
return isAutoExpanded;
}
/**
* 0否 1是 是否自动延期,默认false。 如果需要设置自动延期,则gmt_start和gmt_end之间要间隔2天以上 <p/>
* This method sets the value of the database column tb_goods_item.is_auto_expanded
*
* @param isAutoExpanded the value for tb_goods_item.is_auto_expanded
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setIsAutoExpanded(Byte isAutoExpanded) {
this.isAutoExpanded = isAutoExpanded;
}
/**
* 商户通知地址,口碑发消息给商户通知其是否对商品创建、修改、变更状态成功 <p/>
* This method returns the value of the database column tb_goods_item.operate_notify_url
*
* @return the value of tb_goods_item.operate_notify_url
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getOperateNotifyUrl() {
return operateNotifyUrl;
}
/**
* 商户通知地址,口碑发消息给商户通知其是否对商品创建、修改、变更状态成功 <p/>
* This method sets the value of the database column tb_goods_item.operate_notify_url
*
* @param operateNotifyUrl the value for tb_goods_item.operate_notify_url
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setOperateNotifyUrl(String operateNotifyUrl) {
this.operateNotifyUrl = operateNotifyUrl == null ? null : operateNotifyUrl.trim();
}
/**
* 当前状态(0 未确认 1 商家确认 2 小二确认 -1 屏蔽 -2 删除) <p/>
* This method returns the value of the database column tb_goods_item.status
*
* @return the value of tb_goods_item.status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Byte getStatus() {
return status;
}
/**
* 当前状态(0 未确认 1 商家确认 2 小二确认 -1 屏蔽 -2 删除) <p/>
* This method sets the value of the database column tb_goods_item.status
*
* @param status the value for tb_goods_item.status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setStatus(Byte status) {
this.status = status;
}
/**
* 平台信息(kb口碑 tb淘宝 bd百度外卖) <p/>
* This method returns the value of the database column tb_goods_item.platform
*
* @return the value of tb_goods_item.platform
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getPlatform() {
return platform;
}
/**
* 平台信息(kb口碑 tb淘宝 bd百度外卖) <p/>
* This method sets the value of the database column tb_goods_item.platform
*
* @param platform the value for tb_goods_item.platform
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setPlatform(String platform) {
this.platform = platform == null ? null : platform.trim();
}
/**
* 备注 <p/>
* This method returns the value of the database column tb_goods_item.remark
*
* @return the value of tb_goods_item.remark
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getRemark() {
return remark;
}
/**
* 备注 <p/>
* This method sets the value of the database column tb_goods_item.remark
*
* @param remark the value for tb_goods_item.remark
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tb_goods_item.created
*
* @return the value of tb_goods_item.created
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getCreated() {
return created;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tb_goods_item.created
*
* @param created the value for tb_goods_item.created
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setCreated(Date created) {
this.created = created;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tb_goods_item.modified
*
* @return the value of tb_goods_item.modified
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getModified() {
return modified;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tb_goods_item.modified
*
* @param modified the value for tb_goods_item.modified
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setModified(Date modified) {
this.modified = modified;
}
/**
* 0否 1是 <p/>
* This method returns the value of the database column tb_goods_item.enable_status
*
* @return the value of tb_goods_item.enable_status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Boolean getEnableStatus() {
return enableStatus;
}
/**
* 0否 1是 <p/>
* This method sets the value of the database column tb_goods_item.enable_status
*
* @param enableStatus the value for tb_goods_item.enable_status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setEnableStatus(Boolean enableStatus) {
this.enableStatus = enableStatus;
}
/**
* 上架门店id列表,即传入一个或多个shop_id,必须是创建商品partnerId下的店铺,目前支持的店铺最大100个,如果超过100个店铺需要报备 <p/>
* This method returns the value of the database column tb_goods_item.shop_list
*
* @return the value of tb_goods_item.shop_list
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getShopList() {
return shopList;
}
/**
* 上架门店id列表,即传入一个或多个shop_id,必须是创建商品partnerId下的店铺,目前支持的店铺最大100个,如果超过100个店铺需要报备 <p/>
* This method sets the value of the database column tb_goods_item.shop_list
*
* @param shopList the value for tb_goods_item.shop_list
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setShopList(String shopList) {
this.shopList = shopList == null ? null : shopList.trim();
}
} | UTF-8 | Java | 21,174 | java | GoodsItem.java | Java | [] | null | [] | package com.gcloud.shop.domain;
import java.util.Date;
public class GoodsItem {
/**
* 主键 <p/>
* This field corresponds to the database column tb_goods_item.id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Long id;
/**
* 门店ID <p/>
* This field corresponds to the database column tb_goods_item.store_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String storeId;
/**
* 商品ID(口碑) <p/>
* This field corresponds to the database column tb_goods_item.itme_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String itmeId;
/**
* 商品ID(系统) <p/>
* This field corresponds to the database column tb_goods_item.item_sys_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String itemSysId;
/**
* 商品类型,券类型填写固定值VOUCHER <p/>
* This field corresponds to the database column tb_goods_item.item_type
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String itemType;
/**
* 商品名称,请勿超过15个汉字,30个字符 <p/>
* This field corresponds to the database column tb_goods_item.subject
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String subject;
/**
* 商品购买类型 OBTAIN为领取,AUTO_OBTAIN为自动领取 <p/>
* This field corresponds to the database column tb_goods_item.purchase_mode
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String purchaseMode;
/**
* 商品库存数量 <p/>
* This field corresponds to the database column tb_goods_item.inventory
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Long inventory;
/**
* 商品首图,尺寸比例在65:53范围内且图片大小不超过10k皆可,图片推荐尺寸540*420 <p/>
* This field corresponds to the database column tb_goods_item.cover
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String cover;
/**
* 商品顺序权重,必须是整数,不传默认为0,权重数值越大排序越靠前 <p/>
* This field corresponds to the database column tb_goods_item.weight
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Long weight;
/**
* 商品生效时间,到达生效时间后才可在客户端展示出来。 说明: 商品的生效时间不能早于创建当天的0点 <p/>
* This field corresponds to the database column tb_goods_item.gmt_start
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date gmtStart;
/**
* 商品下架时间,不得早于商品生效时间,商品下架 <p/>
* This field corresponds to the database column tb_goods_item.gmt_end
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date gmtEnd;
/**
* 0否 1是 是否自动延期,默认false。 如果需要设置自动延期,则gmt_start和gmt_end之间要间隔2天以上 <p/>
* This field corresponds to the database column tb_goods_item.is_auto_expanded
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Byte isAutoExpanded;
/**
* 商户通知地址,口碑发消息给商户通知其是否对商品创建、修改、变更状态成功 <p/>
* This field corresponds to the database column tb_goods_item.operate_notify_url
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String operateNotifyUrl;
/**
* 当前状态(0 未确认 1 商家确认 2 小二确认 -1 屏蔽 -2 删除) <p/>
* This field corresponds to the database column tb_goods_item.status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Byte status;
/**
* 平台信息(kb口碑 tb淘宝 bd百度外卖) <p/>
* This field corresponds to the database column tb_goods_item.platform
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String platform;
/**
* 备注 <p/>
* This field corresponds to the database column tb_goods_item.remark
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String remark;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tb_goods_item.created
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date created;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column tb_goods_item.modified
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Date modified;
/**
* 0否 1是 <p/>
* This field corresponds to the database column tb_goods_item.enable_status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private Boolean enableStatus;
/**
* 上架门店id列表,即传入一个或多个shop_id,必须是创建商品partnerId下的店铺,目前支持的店铺最大100个,如果超过100个店铺需要报备 <p/>
* This field corresponds to the database column tb_goods_item.shop_list
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
private String shopList;
/**
* 主键 <p/>
* This method returns the value of the database column tb_goods_item.id
*
* @return the value of tb_goods_item.id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Long getId() {
return id;
}
/**
* 主键 <p/>
* This method sets the value of the database column tb_goods_item.id
*
* @param id the value for tb_goods_item.id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setId(Long id) {
this.id = id;
}
/**
* 门店ID <p/>
* This method returns the value of the database column tb_goods_item.store_id
*
* @return the value of tb_goods_item.store_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getStoreId() {
return storeId;
}
/**
* 门店ID <p/>
* This method sets the value of the database column tb_goods_item.store_id
*
* @param storeId the value for tb_goods_item.store_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setStoreId(String storeId) {
this.storeId = storeId == null ? null : storeId.trim();
}
/**
* 商品ID(口碑) <p/>
* This method returns the value of the database column tb_goods_item.itme_id
*
* @return the value of tb_goods_item.itme_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getItmeId() {
return itmeId;
}
/**
* 商品ID(口碑) <p/>
* This method sets the value of the database column tb_goods_item.itme_id
*
* @param itmeId the value for tb_goods_item.itme_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setItmeId(String itmeId) {
this.itmeId = itmeId == null ? null : itmeId.trim();
}
/**
* 商品ID(系统) <p/>
* This method returns the value of the database column tb_goods_item.item_sys_id
*
* @return the value of tb_goods_item.item_sys_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getItemSysId() {
return itemSysId;
}
/**
* 商品ID(系统) <p/>
* This method sets the value of the database column tb_goods_item.item_sys_id
*
* @param itemSysId the value for tb_goods_item.item_sys_id
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setItemSysId(String itemSysId) {
this.itemSysId = itemSysId == null ? null : itemSysId.trim();
}
/**
* 商品类型,券类型填写固定值VOUCHER <p/>
* This method returns the value of the database column tb_goods_item.item_type
*
* @return the value of tb_goods_item.item_type
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getItemType() {
return itemType;
}
/**
* 商品类型,券类型填写固定值VOUCHER <p/>
* This method sets the value of the database column tb_goods_item.item_type
*
* @param itemType the value for tb_goods_item.item_type
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setItemType(String itemType) {
this.itemType = itemType == null ? null : itemType.trim();
}
/**
* 商品名称,请勿超过15个汉字,30个字符 <p/>
* This method returns the value of the database column tb_goods_item.subject
*
* @return the value of tb_goods_item.subject
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getSubject() {
return subject;
}
/**
* 商品名称,请勿超过15个汉字,30个字符 <p/>
* This method sets the value of the database column tb_goods_item.subject
*
* @param subject the value for tb_goods_item.subject
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setSubject(String subject) {
this.subject = subject == null ? null : subject.trim();
}
/**
* 商品购买类型 OBTAIN为领取,AUTO_OBTAIN为自动领取 <p/>
* This method returns the value of the database column tb_goods_item.purchase_mode
*
* @return the value of tb_goods_item.purchase_mode
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getPurchaseMode() {
return purchaseMode;
}
/**
* 商品购买类型 OBTAIN为领取,AUTO_OBTAIN为自动领取 <p/>
* This method sets the value of the database column tb_goods_item.purchase_mode
*
* @param purchaseMode the value for tb_goods_item.purchase_mode
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setPurchaseMode(String purchaseMode) {
this.purchaseMode = purchaseMode == null ? null : purchaseMode.trim();
}
/**
* 商品库存数量 <p/>
* This method returns the value of the database column tb_goods_item.inventory
*
* @return the value of tb_goods_item.inventory
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Long getInventory() {
return inventory;
}
/**
* 商品库存数量 <p/>
* This method sets the value of the database column tb_goods_item.inventory
*
* @param inventory the value for tb_goods_item.inventory
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setInventory(Long inventory) {
this.inventory = inventory;
}
/**
* 商品首图,尺寸比例在65:53范围内且图片大小不超过10k皆可,图片推荐尺寸540*420 <p/>
* This method returns the value of the database column tb_goods_item.cover
*
* @return the value of tb_goods_item.cover
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getCover() {
return cover;
}
/**
* 商品首图,尺寸比例在65:53范围内且图片大小不超过10k皆可,图片推荐尺寸540*420 <p/>
* This method sets the value of the database column tb_goods_item.cover
*
* @param cover the value for tb_goods_item.cover
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setCover(String cover) {
this.cover = cover == null ? null : cover.trim();
}
/**
* 商品顺序权重,必须是整数,不传默认为0,权重数值越大排序越靠前 <p/>
* This method returns the value of the database column tb_goods_item.weight
*
* @return the value of tb_goods_item.weight
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Long getWeight() {
return weight;
}
/**
* 商品顺序权重,必须是整数,不传默认为0,权重数值越大排序越靠前 <p/>
* This method sets the value of the database column tb_goods_item.weight
*
* @param weight the value for tb_goods_item.weight
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setWeight(Long weight) {
this.weight = weight;
}
/**
* 商品生效时间,到达生效时间后才可在客户端展示出来。 说明: 商品的生效时间不能早于创建当天的0点 <p/>
* This method returns the value of the database column tb_goods_item.gmt_start
*
* @return the value of tb_goods_item.gmt_start
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getGmtStart() {
return gmtStart;
}
/**
* 商品生效时间,到达生效时间后才可在客户端展示出来。 说明: 商品的生效时间不能早于创建当天的0点 <p/>
* This method sets the value of the database column tb_goods_item.gmt_start
*
* @param gmtStart the value for tb_goods_item.gmt_start
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setGmtStart(Date gmtStart) {
this.gmtStart = gmtStart;
}
/**
* 商品下架时间,不得早于商品生效时间,商品下架 <p/>
* This method returns the value of the database column tb_goods_item.gmt_end
*
* @return the value of tb_goods_item.gmt_end
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getGmtEnd() {
return gmtEnd;
}
/**
* 商品下架时间,不得早于商品生效时间,商品下架 <p/>
* This method sets the value of the database column tb_goods_item.gmt_end
*
* @param gmtEnd the value for tb_goods_item.gmt_end
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setGmtEnd(Date gmtEnd) {
this.gmtEnd = gmtEnd;
}
/**
* 0否 1是 是否自动延期,默认false。 如果需要设置自动延期,则gmt_start和gmt_end之间要间隔2天以上 <p/>
* This method returns the value of the database column tb_goods_item.is_auto_expanded
*
* @return the value of tb_goods_item.is_auto_expanded
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Byte getIsAutoExpanded() {
return isAutoExpanded;
}
/**
* 0否 1是 是否自动延期,默认false。 如果需要设置自动延期,则gmt_start和gmt_end之间要间隔2天以上 <p/>
* This method sets the value of the database column tb_goods_item.is_auto_expanded
*
* @param isAutoExpanded the value for tb_goods_item.is_auto_expanded
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setIsAutoExpanded(Byte isAutoExpanded) {
this.isAutoExpanded = isAutoExpanded;
}
/**
* 商户通知地址,口碑发消息给商户通知其是否对商品创建、修改、变更状态成功 <p/>
* This method returns the value of the database column tb_goods_item.operate_notify_url
*
* @return the value of tb_goods_item.operate_notify_url
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getOperateNotifyUrl() {
return operateNotifyUrl;
}
/**
* 商户通知地址,口碑发消息给商户通知其是否对商品创建、修改、变更状态成功 <p/>
* This method sets the value of the database column tb_goods_item.operate_notify_url
*
* @param operateNotifyUrl the value for tb_goods_item.operate_notify_url
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setOperateNotifyUrl(String operateNotifyUrl) {
this.operateNotifyUrl = operateNotifyUrl == null ? null : operateNotifyUrl.trim();
}
/**
* 当前状态(0 未确认 1 商家确认 2 小二确认 -1 屏蔽 -2 删除) <p/>
* This method returns the value of the database column tb_goods_item.status
*
* @return the value of tb_goods_item.status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Byte getStatus() {
return status;
}
/**
* 当前状态(0 未确认 1 商家确认 2 小二确认 -1 屏蔽 -2 删除) <p/>
* This method sets the value of the database column tb_goods_item.status
*
* @param status the value for tb_goods_item.status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setStatus(Byte status) {
this.status = status;
}
/**
* 平台信息(kb口碑 tb淘宝 bd百度外卖) <p/>
* This method returns the value of the database column tb_goods_item.platform
*
* @return the value of tb_goods_item.platform
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getPlatform() {
return platform;
}
/**
* 平台信息(kb口碑 tb淘宝 bd百度外卖) <p/>
* This method sets the value of the database column tb_goods_item.platform
*
* @param platform the value for tb_goods_item.platform
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setPlatform(String platform) {
this.platform = platform == null ? null : platform.trim();
}
/**
* 备注 <p/>
* This method returns the value of the database column tb_goods_item.remark
*
* @return the value of tb_goods_item.remark
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getRemark() {
return remark;
}
/**
* 备注 <p/>
* This method sets the value of the database column tb_goods_item.remark
*
* @param remark the value for tb_goods_item.remark
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setRemark(String remark) {
this.remark = remark == null ? null : remark.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tb_goods_item.created
*
* @return the value of tb_goods_item.created
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getCreated() {
return created;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tb_goods_item.created
*
* @param created the value for tb_goods_item.created
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setCreated(Date created) {
this.created = created;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column tb_goods_item.modified
*
* @return the value of tb_goods_item.modified
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Date getModified() {
return modified;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column tb_goods_item.modified
*
* @param modified the value for tb_goods_item.modified
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setModified(Date modified) {
this.modified = modified;
}
/**
* 0否 1是 <p/>
* This method returns the value of the database column tb_goods_item.enable_status
*
* @return the value of tb_goods_item.enable_status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public Boolean getEnableStatus() {
return enableStatus;
}
/**
* 0否 1是 <p/>
* This method sets the value of the database column tb_goods_item.enable_status
*
* @param enableStatus the value for tb_goods_item.enable_status
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setEnableStatus(Boolean enableStatus) {
this.enableStatus = enableStatus;
}
/**
* 上架门店id列表,即传入一个或多个shop_id,必须是创建商品partnerId下的店铺,目前支持的店铺最大100个,如果超过100个店铺需要报备 <p/>
* This method returns the value of the database column tb_goods_item.shop_list
*
* @return the value of tb_goods_item.shop_list
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public String getShopList() {
return shopList;
}
/**
* 上架门店id列表,即传入一个或多个shop_id,必须是创建商品partnerId下的店铺,目前支持的店铺最大100个,如果超过100个店铺需要报备 <p/>
* This method sets the value of the database column tb_goods_item.shop_list
*
* @param shopList the value for tb_goods_item.shop_list
*
* @mbggenerated Tue Aug 16 23:58:39 CST 2016
*/
public void setShopList(String shopList) {
this.shopList = shopList == null ? null : shopList.trim();
}
} | 21,174 | 0.612959 | 0.568089 | 677 | 27.246677 | 26.29179 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.096012 | false | false | 9 |
ae35f0102a8beb51a9a6834db0e1e961d209acad | 10,703,058,569,159 | 430dce14e611a254c52ed0205c7a171b339175b5 | /src/java/edu/yale/cs/hadoopdb/connector/DBWritable.java | db41b6b8555f995abdb82cb1240f89718d5dc67e | [
"Apache-2.0"
] | permissive | libin/hadoopdb | https://github.com/libin/hadoopdb | bd9eae96a1c71c81a3d4acb8ad37e16efdb64505 | 6c15dadd86ae6cc2e69e5b8501fcb04d92a6885e | refs/heads/master | 2021-01-20T00:56:35.840000 | 2010-11-15T04:12:27 | 2010-11-15T04:12:27 | 12,355,026 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright 2009 HadoopDB Team (http://db.cs.yale.edu/hadoopdb/hadoopdb.html)
*
* 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 edu.yale.cs.hadoopdb.connector;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* DBWritable Interface. All value classes (key-value pairs read in by MapReduce jobs
* that access a database) need to extend DBWritable. See {@link DBRecordReader} for
* more information.
*/
public interface DBWritable {
/**
* Sets the fields of the object in the {@link PreparedStatement} (not used currently).
* @param statement the statement that the fields are put into.
* @throws SQLException
*/
public void write(PreparedStatement statement) throws SQLException;
/**
* Reads the fields of the object from the {@link ResultSet}.
* @param resultSet the {@link ResultSet} to get the fields from.
* @throws SQLException
*/
public void readFields(ResultSet resultSet) throws SQLException ;
}
| UTF-8 | Java | 1,515 | java | DBWritable.java | Java | [] | null | [] | /**
* Copyright 2009 HadoopDB Team (http://db.cs.yale.edu/hadoopdb/hadoopdb.html)
*
* 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 edu.yale.cs.hadoopdb.connector;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* DBWritable Interface. All value classes (key-value pairs read in by MapReduce jobs
* that access a database) need to extend DBWritable. See {@link DBRecordReader} for
* more information.
*/
public interface DBWritable {
/**
* Sets the fields of the object in the {@link PreparedStatement} (not used currently).
* @param statement the statement that the fields are put into.
* @throws SQLException
*/
public void write(PreparedStatement statement) throws SQLException;
/**
* Reads the fields of the object from the {@link ResultSet}.
* @param resultSet the {@link ResultSet} to get the fields from.
* @throws SQLException
*/
public void readFields(ResultSet resultSet) throws SQLException ;
}
| 1,515 | 0.737954 | 0.732673 | 44 | 33.43182 | 30.805399 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false | 9 |
d765711a8e364fccc3f65bfe14fafa26e0a11a85 | 10,703,058,569,961 | 4d7f05a0c13c66073dcaab800e380a62a07d7283 | /app/src/main/java/com/acbelter/maptest/MainActivity.java | 19cfeaafc0fe529ca08cabac513a9bff73e4ca7f | [] | no_license | acbelter/GoogleMapsTest | https://github.com/acbelter/GoogleMapsTest | fbbd2abd054ffc66b823a5b5537e8f629ab2acc3 | a040b03c8a530ca9b44a763b2e177c4d0095df7b | refs/heads/master | 2021-01-01T05:12:37.278000 | 2016-05-12T20:36:41 | 2016-05-12T20:36:41 | 58,627,570 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.acbelter.maptest;
import android.content.Intent;
import android.os.Bundle;
import android.util.Pair;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.redmadrobot.chronos.gui.activity.ChronosAppCompatActivity;
public class MainActivity extends ChronosAppCompatActivity {
private EditText mStartAddress;
private EditText mFinishAddress;
private Button mFindRouteButton;
private Button mChangeAddressesButton;
private boolean mUiEnabled;
private static TestData TEST_DATA = new TestData();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mStartAddress = (EditText) findViewById(R.id.start_address);
mFinishAddress = (EditText) findViewById(R.id.finish_address);
mFindRouteButton = (Button) findViewById(R.id.btn_find_route);
mFindRouteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String startAddress = mStartAddress.getText().toString();
String finishAddress = mFinishAddress.getText().toString();
if (startAddress.isEmpty() || finishAddress.isEmpty()) {
Toast.makeText(getApplicationContext(), R.string.toast_empty_address,
Toast.LENGTH_SHORT).show();
return;
}
setUiEnabled(false);
runOperation(new FindRouteOperation(startAddress, finishAddress,
getString(R.string.maps_api_key)));
}
});
mChangeAddressesButton = (Button) findViewById(R.id.btn_change_addresses);
mChangeAddressesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Pair<String, String> addresses = TEST_DATA.getNextAddresses();
mStartAddress.setText(addresses.first);
mFinishAddress.setText(addresses.second);
}
});
mUiEnabled = true;
if (savedInstanceState == null) {
Pair<String, String> addresses = TEST_DATA.getNextAddresses();
mStartAddress.setText(addresses.first);
mFinishAddress.setText(addresses.second);
} else {
mUiEnabled = savedInstanceState.getBoolean("ui_enabled");
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean("ui_enabled", mUiEnabled);
}
private void setUiEnabled(boolean enabled) {
mStartAddress.setEnabled(enabled);
mFinishAddress.setEnabled(enabled);
mFindRouteButton.setEnabled(enabled);
mChangeAddressesButton.setEnabled(enabled);
mUiEnabled = enabled;
}
public void onOperationFinished(final FindRouteOperation.Result result) {
if (result.isSuccessful()) {
RouteData routeData = result.getOutput();
if (routeData == null) {
setUiEnabled(true);
Toast.makeText(getApplicationContext(), R.string.toast_route_not_found,
Toast.LENGTH_SHORT).show();
return;
}
Intent intent = new Intent(MainActivity.this, MapActivity.class);
intent.putExtra("route_data", routeData);
startActivity(intent);
setUiEnabled(true);
} else {
setUiEnabled(true);
Toast.makeText(getApplicationContext(), R.string.toast_route_not_found,
Toast.LENGTH_SHORT).show();
}
}
}
| UTF-8 | Java | 3,812 | java | MainActivity.java | Java | [] | null | [] | package com.acbelter.maptest;
import android.content.Intent;
import android.os.Bundle;
import android.util.Pair;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.redmadrobot.chronos.gui.activity.ChronosAppCompatActivity;
public class MainActivity extends ChronosAppCompatActivity {
private EditText mStartAddress;
private EditText mFinishAddress;
private Button mFindRouteButton;
private Button mChangeAddressesButton;
private boolean mUiEnabled;
private static TestData TEST_DATA = new TestData();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mStartAddress = (EditText) findViewById(R.id.start_address);
mFinishAddress = (EditText) findViewById(R.id.finish_address);
mFindRouteButton = (Button) findViewById(R.id.btn_find_route);
mFindRouteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String startAddress = mStartAddress.getText().toString();
String finishAddress = mFinishAddress.getText().toString();
if (startAddress.isEmpty() || finishAddress.isEmpty()) {
Toast.makeText(getApplicationContext(), R.string.toast_empty_address,
Toast.LENGTH_SHORT).show();
return;
}
setUiEnabled(false);
runOperation(new FindRouteOperation(startAddress, finishAddress,
getString(R.string.maps_api_key)));
}
});
mChangeAddressesButton = (Button) findViewById(R.id.btn_change_addresses);
mChangeAddressesButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Pair<String, String> addresses = TEST_DATA.getNextAddresses();
mStartAddress.setText(addresses.first);
mFinishAddress.setText(addresses.second);
}
});
mUiEnabled = true;
if (savedInstanceState == null) {
Pair<String, String> addresses = TEST_DATA.getNextAddresses();
mStartAddress.setText(addresses.first);
mFinishAddress.setText(addresses.second);
} else {
mUiEnabled = savedInstanceState.getBoolean("ui_enabled");
}
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean("ui_enabled", mUiEnabled);
}
private void setUiEnabled(boolean enabled) {
mStartAddress.setEnabled(enabled);
mFinishAddress.setEnabled(enabled);
mFindRouteButton.setEnabled(enabled);
mChangeAddressesButton.setEnabled(enabled);
mUiEnabled = enabled;
}
public void onOperationFinished(final FindRouteOperation.Result result) {
if (result.isSuccessful()) {
RouteData routeData = result.getOutput();
if (routeData == null) {
setUiEnabled(true);
Toast.makeText(getApplicationContext(), R.string.toast_route_not_found,
Toast.LENGTH_SHORT).show();
return;
}
Intent intent = new Intent(MainActivity.this, MapActivity.class);
intent.putExtra("route_data", routeData);
startActivity(intent);
setUiEnabled(true);
} else {
setUiEnabled(true);
Toast.makeText(getApplicationContext(), R.string.toast_route_not_found,
Toast.LENGTH_SHORT).show();
}
}
}
| 3,812 | 0.630378 | 0.630378 | 104 | 35.653847 | 26.116518 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.663462 | false | false | 9 |
0645986dc9fca5ae50a68a1985fa6beac184f171 | 32,461,362,839,057 | e245da2da841089900f82ddefe3636c817b1d4a9 | /src/com/sinosoft/lis/userMan/LDUserManBLS.java | 15527d0b1fb518532ad04669f7b1a6d3bb6f7b8b | [] | no_license | ssdtfarm/Productoin_CMS | https://github.com/ssdtfarm/Productoin_CMS | 46820daa441b449bd96ec699c554bb594017b63e | 753818ca1ddb1b05e5d459b8028580b7ac8250b5 | refs/heads/master | 2020-04-12T22:54:13.456000 | 2016-04-14T06:44:57 | 2016-04-14T06:44:57 | 60,250,819 | 0 | 3 | null | true | 2016-06-02T09:29:06 | 2016-06-02T09:29:05 | 2016-04-22T02:40:11 | 2016-04-22T02:40:01 | 69,526 | 0 | 0 | 0 | null | null | null | /**
* Copyright (c) 2002 sinosoft Co. Ltd.
* All right reserved.
*/
package com.sinosoft.lis.userMan;
import com.sinosoft.Resource.bundle;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import com.sinosoft.lis.db.LDMenuGrpDB;
import com.sinosoft.lis.db.LDMenuGrpToMenuDB;
import com.sinosoft.lis.db.LDUserDB;
import com.sinosoft.lis.db.LDUserTOMenuGrpDB;
import com.sinosoft.lis.encrypt.LisIDEA;
import com.sinosoft.lis.menumang.MenuGrpUpdate;
import com.sinosoft.lis.pubfun.PubFun;
import com.sinosoft.lis.schema.LDUserSchema;
import com.sinosoft.lis.vdb.LDUserTOMenuGrpDBSet;
import com.sinosoft.lis.vschema.LDMenuGrpToMenuSet;
import com.sinosoft.lis.vschema.LDUserTOMenuGrpSet;
import com.sinosoft.utility.CError;
import com.sinosoft.utility.CErrors;
import com.sinosoft.utility.DBConnPool;
import com.sinosoft.utility.ExeSQL;
import com.sinosoft.utility.VData;
/**
* <p>Title: Web业务系统</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: Sinosoft</p>
* @author Dingzhong
* @version 1.0
*/
public class LDUserManBLS
{
//错误处理类,每个需要错误处理的类中都放置该类
public CErrors mErrors = new CErrors();
/** 数据操作字符串 */
private String mOperate;
public LDUserManBLS()
{
}
//传输数据的公共方法
public boolean submitData(VData cInputData, String cOperate)
{
boolean tReturn = false;
//将操作数据拷贝到本类中
this.mOperate = cOperate;
// System.out.println("Start LDMenuGrp BLS Submit...");
//信息保存
if (this.mOperate.equals("insert"))
{
tReturn = save(cInputData);
}
//信息删除
if (this.mOperate.equals("delete"))
{
tReturn = remove(cInputData);
}
//信息更新
if (this.mOperate.equals("update"))
{
tReturn = update(cInputData);
}
// System.out.println("End LDUserMan BLS Submit...");
return tReturn;
}
/**
* 删除操作
* @param mInputData VData
* @return boolean
*/
private boolean remove(VData mInputData)
{
boolean tReturn = true;
// System.out.println("start remove...");
Connection conn = DBConnPool.getConnection();
if (conn == null)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserManBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("connFaild")+"!";
this.mErrors.addOneError(tError);
return false;
}
try
{
conn.setAutoCommit(false);
// System.out.println("Start 删除用户...");
LDUserDB tLDUserDB = new LDUserDB(conn);
LDUserSchema tUserSchema = (LDUserSchema) mInputData.
getObjectByObjectName("LDUserSchema", 0);
tLDUserDB.setSchema((LDUserSchema) mInputData.getObjectByObjectName(
"LDUserSchema", 0));
if (!tLDUserDB.deleteSQL())
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("deleteFaild")+"!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
// System.out.println("start 转移用户关联菜单组及用户创建菜单组....");
// System.out.println("start 转移用户关联菜单组及用户创建菜单组....");
String delUserCode = tUserSchema.getUserCode();
String deletor = (String) mInputData.getObjectByObjectName("String",
0);
// System.out.println("deletor : " + deletor);
if (deletor == null)
{
conn.rollback();
conn.close();
return false;
}
//将被删用户创建的用户的operator改为当前操作员,相当于用户由操作员deletor接管
// String sqlStr = "update lduser set operator = '" + deletor +
// "' where operator = '" + delUserCode + "'";
// tLDUserDB.executeQuery(sqlStr);
String powerSql = "update lduser set operator=? where operator=? ";
List paraList =new ArrayList();
paraList.add(deletor);
paraList.add(delUserCode);
tLDUserDB.executeQuery(powerSql,PubFun.getFormatBV(paraList));
//将被删用户创建的菜单组由当前操作员deletor接管
// sqlStr = "update ldmenugrp set operator = '" + deletor +
// "' where operator = '" + delUserCode + "'";
//// System.out.println(sqlStr);
// LDMenuGrpDB tMenuGrpDB = new LDMenuGrpDB(conn);
// tMenuGrpDB.executeQuery(sqlStr);
powerSql = "update ldmenugrp set operator=? where operator=? ";
paraList =new ArrayList();
paraList.add(deletor);
paraList.add(delUserCode);
LDMenuGrpDB tMenuGrpDB = new LDMenuGrpDB(conn);
tMenuGrpDB.executeQuery(powerSql,PubFun.getFormatBV(paraList));
// sqlStr = "delete from ldusertomenugrp where usercode = '" + delUserCode + "'";
// LDMenuGrpToMenuDB tMenuGrpToMenuDB = new LDMenuGrpToMenuDB(conn);
LDUserTOMenuGrpDB tLDUserTOMenuGrpDB = new LDUserTOMenuGrpDB(conn);
tLDUserTOMenuGrpDB.setUserCode(delUserCode);
tLDUserTOMenuGrpDB.delete();
conn.commit();
conn.close();
// System.out.println("commit end");
}
catch (Exception ex)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "submitData";
tError.errorMessage = ex.toString();
this.mErrors.addOneError(tError);
try
{
conn.rollback();
conn.close();
}
catch (Exception e)
{}
tReturn = false;
}
return tReturn;
}
/**
* 保存操作
* @param mInputData VData
* @return boolean
*/
private boolean save(VData mInputData)
{
boolean tReturn = true;
// System.out.println("Start Save...");
Connection conn = DBConnPool.getConnection();
if (conn == null)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("connFaild")+"!";
this.mErrors.addOneError(tError);
return false;
}
try
{
conn.setAutoCommit(false);
// System.out.println("Start 保存用户...");
LDUserDB tLDUserDB = new LDUserDB(conn);
LDUserSchema tLDUserSchema = (LDUserSchema) mInputData.
getObjectByObjectName("LDUserSchema",
0);
if (tLDUserSchema == null)
{
return false;
}
// 开始进行密码加密
String plainPwd = tLDUserSchema.getPassword();
LisIDEA tIdea = new LisIDEA();
String encryptPwd = tIdea.encryptString(plainPwd);
tLDUserSchema.setPassword(encryptPwd);
tLDUserDB.setSchema(tLDUserSchema);
if (!tLDUserDB.insert())
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = "用户保存失败!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
// System.out.println("Start 用户菜单组插入....");
LDUserTOMenuGrpDBSet tLDUserToMenuGrpDBSet = new
LDUserTOMenuGrpDBSet(conn);
tLDUserToMenuGrpDBSet.set((LDUserTOMenuGrpSet) mInputData.
getObjectByObjectName(
"LDUserTOMenuGrpSet", 0));
int len = tLDUserToMenuGrpDBSet.size();
// System.out.println("lens=" + len);
if (!tLDUserToMenuGrpDBSet.insert())
{
// @@错误处理
this.mErrors.copyAllErrors(tLDUserToMenuGrpDBSet.mErrors);
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = "用户菜单组关联表保存失败!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
// System.out.println("commit end");
}
catch (Exception ex)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "submitData";
tError.errorMessage = ex.toString();
this.mErrors.addOneError(tError);
try
{
conn.rollback();
conn.close();
}
catch (Exception e)
{}
tReturn = false;
}
return tReturn;
}
/**
* 更新操作
* @param mInputData VData
* @return boolean
*/
private boolean update(VData mInputData)
{
boolean tReturn = true;
Connection conn = DBConnPool.getConnection();
if (conn == null)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("connFaild")+"!";
this.mErrors.addOneError(tError);
return false;
}
try
{
conn.setAutoCommit(false);
// System.out.println("Start 更新用户...");
LDUserDB tLDUserDB = new LDUserDB(conn);
LDUserSchema tLDUserSchema = new LDUserSchema();
tLDUserSchema = (LDUserSchema) mInputData.getObjectByObjectName(
"LDUserSchema", 0);
String usercode = tLDUserSchema.getUserCode();
String operator = (String) mInputData.getObjectByObjectName(
"String", 0);
// System.out.println("go go go");
// System.out.println("password is :" + tLDUserSchema.getPassword());
//更新菜单组表,如果当前操作员和用户创建者一致
String curOperator = (String) mInputData.getObjectByObjectName(
"String", 0);
String crtOperator = tLDUserSchema.getOperator();
boolean updateUser = true;
if (curOperator.compareTo(crtOperator) == 0)
{
// System.out.println("we start tLDusertDB.update!");
// 开始进行密码加密
String plainPwd = tLDUserSchema.getPassword();
LisIDEA tIdea = new LisIDEA();
String encryptPwd = tIdea.encryptString(plainPwd);
tLDUserSchema.setPassword(encryptPwd);
tLDUserDB.setSchema(tLDUserSchema);
updateUser = tLDUserDB.update();
}
else
{
// System.out.println("we dont start tLDusertDB.update!");
}
if (!updateUser)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "update";
tError.errorMessage = ""+bundle.getString("Dataprocessingfailed")+"!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
//在更新前,必须先得到实际此用户失去的菜单节点集合,以便进行菜单组的更新
// String sqlStr =
// " select * from ldmenugrptomenu where menugrpcode in " +
// " (select menugrpcode from ldusertomenugrp where usercode = '" +
// usercode + "' and " +
// " menugrpcode in (select menugrpcode from ldmenugrp where operator = '" +
// operator + "'))";
// LDMenuGrpToMenuDB tRemoveSetDB = new LDMenuGrpToMenuDB(conn);
// //tRemoveSet是原来所有菜单集合的总集,并不是真正的删除集合,但没关系,
// //不过必须在插入新菜单组以后
// LDMenuGrpToMenuSet tRemoveSet = tRemoveSetDB.executeQuery(sqlStr);
String sqlStr = "select * from ldmenugrptomenu where menugrpcode in (select menugrpcode from ldusertomenugrp where usercode=? and menugrpcode in (select menugrpcode from ldmenugrp where operator=?)) ";
List paraList =new ArrayList();
paraList.add(usercode);
paraList.add(operator);
LDMenuGrpToMenuDB tRemoveSetDB = new LDMenuGrpToMenuDB(conn);
LDMenuGrpToMenuSet tRemoveSet=tRemoveSetDB.executeQuery(sqlStr,PubFun.getFormatBV(paraList));
//更新首先删除关联表中的相关关联,然后再插入最新的数据
sqlStr = "delete from ldusertomenugrp where usercode = '" +
usercode + "' and " +
" menugrpcode in (select menugrpcode from ldmenugrp where operator = '" +
operator + "')";
// System.out.println("****" + sqlStr + "***");
ExeSQL exeSQL = new ExeSQL(conn);
exeSQL.execUpdateSQL(sqlStr);
LDUserTOMenuGrpDBSet tLDUserToMenuGrpDBSet = new
LDUserTOMenuGrpDBSet(
conn);
tLDUserToMenuGrpDBSet.set((LDUserTOMenuGrpSet) mInputData.
getObjectByObjectName(
"LDUserTOMenuGrpSet", 0));
// System.out.println("开始插入...");
// System.out.println("BLS DBSet size:" + tLDUserToMenuGrpDBSet.size());
if (!tLDUserToMenuGrpDBSet.insert())
{
// @@错误处理
this.mErrors.copyAllErrors(tLDUserToMenuGrpDBSet.mErrors);
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("Dataprocessingfailed")+"!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
//开始更新此用户创建的菜单组
MenuGrpUpdate tMenuGrpUpdate = new MenuGrpUpdate();
boolean suc = tMenuGrpUpdate.userToMenuGrp(tRemoveSet, usercode,
conn);
if (!suc)
{
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
// System.out.println("commit end");
}
catch (Exception ex)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "submitData";
tError.errorMessage = ex.toString();
this.mErrors.addOneError(tError);
try
{
conn.rollback();
conn.close();
}
catch (Exception e)
{}
tReturn = false;
}
return tReturn;
}
}
| UTF-8 | Java | 16,507 | java | LDUserManBLS.java | Java | [
{
"context": "c) 2002</p>\n * <p>Company: Sinosoft</p>\n * @author Dingzhong\n * @version 1.0\n */\n\npublic class LDUserManBLS\n{\n",
"end": 1047,
"score": 0.6850042343139648,
"start": 1038,
"tag": "USERNAME",
"value": "Dingzhong"
}
] | null | [] | /**
* Copyright (c) 2002 sinosoft Co. Ltd.
* All right reserved.
*/
package com.sinosoft.lis.userMan;
import com.sinosoft.Resource.bundle;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import com.sinosoft.lis.db.LDMenuGrpDB;
import com.sinosoft.lis.db.LDMenuGrpToMenuDB;
import com.sinosoft.lis.db.LDUserDB;
import com.sinosoft.lis.db.LDUserTOMenuGrpDB;
import com.sinosoft.lis.encrypt.LisIDEA;
import com.sinosoft.lis.menumang.MenuGrpUpdate;
import com.sinosoft.lis.pubfun.PubFun;
import com.sinosoft.lis.schema.LDUserSchema;
import com.sinosoft.lis.vdb.LDUserTOMenuGrpDBSet;
import com.sinosoft.lis.vschema.LDMenuGrpToMenuSet;
import com.sinosoft.lis.vschema.LDUserTOMenuGrpSet;
import com.sinosoft.utility.CError;
import com.sinosoft.utility.CErrors;
import com.sinosoft.utility.DBConnPool;
import com.sinosoft.utility.ExeSQL;
import com.sinosoft.utility.VData;
/**
* <p>Title: Web业务系统</p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: Sinosoft</p>
* @author Dingzhong
* @version 1.0
*/
public class LDUserManBLS
{
//错误处理类,每个需要错误处理的类中都放置该类
public CErrors mErrors = new CErrors();
/** 数据操作字符串 */
private String mOperate;
public LDUserManBLS()
{
}
//传输数据的公共方法
public boolean submitData(VData cInputData, String cOperate)
{
boolean tReturn = false;
//将操作数据拷贝到本类中
this.mOperate = cOperate;
// System.out.println("Start LDMenuGrp BLS Submit...");
//信息保存
if (this.mOperate.equals("insert"))
{
tReturn = save(cInputData);
}
//信息删除
if (this.mOperate.equals("delete"))
{
tReturn = remove(cInputData);
}
//信息更新
if (this.mOperate.equals("update"))
{
tReturn = update(cInputData);
}
// System.out.println("End LDUserMan BLS Submit...");
return tReturn;
}
/**
* 删除操作
* @param mInputData VData
* @return boolean
*/
private boolean remove(VData mInputData)
{
boolean tReturn = true;
// System.out.println("start remove...");
Connection conn = DBConnPool.getConnection();
if (conn == null)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserManBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("connFaild")+"!";
this.mErrors.addOneError(tError);
return false;
}
try
{
conn.setAutoCommit(false);
// System.out.println("Start 删除用户...");
LDUserDB tLDUserDB = new LDUserDB(conn);
LDUserSchema tUserSchema = (LDUserSchema) mInputData.
getObjectByObjectName("LDUserSchema", 0);
tLDUserDB.setSchema((LDUserSchema) mInputData.getObjectByObjectName(
"LDUserSchema", 0));
if (!tLDUserDB.deleteSQL())
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("deleteFaild")+"!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
// System.out.println("start 转移用户关联菜单组及用户创建菜单组....");
// System.out.println("start 转移用户关联菜单组及用户创建菜单组....");
String delUserCode = tUserSchema.getUserCode();
String deletor = (String) mInputData.getObjectByObjectName("String",
0);
// System.out.println("deletor : " + deletor);
if (deletor == null)
{
conn.rollback();
conn.close();
return false;
}
//将被删用户创建的用户的operator改为当前操作员,相当于用户由操作员deletor接管
// String sqlStr = "update lduser set operator = '" + deletor +
// "' where operator = '" + delUserCode + "'";
// tLDUserDB.executeQuery(sqlStr);
String powerSql = "update lduser set operator=? where operator=? ";
List paraList =new ArrayList();
paraList.add(deletor);
paraList.add(delUserCode);
tLDUserDB.executeQuery(powerSql,PubFun.getFormatBV(paraList));
//将被删用户创建的菜单组由当前操作员deletor接管
// sqlStr = "update ldmenugrp set operator = '" + deletor +
// "' where operator = '" + delUserCode + "'";
//// System.out.println(sqlStr);
// LDMenuGrpDB tMenuGrpDB = new LDMenuGrpDB(conn);
// tMenuGrpDB.executeQuery(sqlStr);
powerSql = "update ldmenugrp set operator=? where operator=? ";
paraList =new ArrayList();
paraList.add(deletor);
paraList.add(delUserCode);
LDMenuGrpDB tMenuGrpDB = new LDMenuGrpDB(conn);
tMenuGrpDB.executeQuery(powerSql,PubFun.getFormatBV(paraList));
// sqlStr = "delete from ldusertomenugrp where usercode = '" + delUserCode + "'";
// LDMenuGrpToMenuDB tMenuGrpToMenuDB = new LDMenuGrpToMenuDB(conn);
LDUserTOMenuGrpDB tLDUserTOMenuGrpDB = new LDUserTOMenuGrpDB(conn);
tLDUserTOMenuGrpDB.setUserCode(delUserCode);
tLDUserTOMenuGrpDB.delete();
conn.commit();
conn.close();
// System.out.println("commit end");
}
catch (Exception ex)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "submitData";
tError.errorMessage = ex.toString();
this.mErrors.addOneError(tError);
try
{
conn.rollback();
conn.close();
}
catch (Exception e)
{}
tReturn = false;
}
return tReturn;
}
/**
* 保存操作
* @param mInputData VData
* @return boolean
*/
private boolean save(VData mInputData)
{
boolean tReturn = true;
// System.out.println("Start Save...");
Connection conn = DBConnPool.getConnection();
if (conn == null)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("connFaild")+"!";
this.mErrors.addOneError(tError);
return false;
}
try
{
conn.setAutoCommit(false);
// System.out.println("Start 保存用户...");
LDUserDB tLDUserDB = new LDUserDB(conn);
LDUserSchema tLDUserSchema = (LDUserSchema) mInputData.
getObjectByObjectName("LDUserSchema",
0);
if (tLDUserSchema == null)
{
return false;
}
// 开始进行密码加密
String plainPwd = tLDUserSchema.getPassword();
LisIDEA tIdea = new LisIDEA();
String encryptPwd = tIdea.encryptString(plainPwd);
tLDUserSchema.setPassword(encryptPwd);
tLDUserDB.setSchema(tLDUserSchema);
if (!tLDUserDB.insert())
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = "用户保存失败!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
// System.out.println("Start 用户菜单组插入....");
LDUserTOMenuGrpDBSet tLDUserToMenuGrpDBSet = new
LDUserTOMenuGrpDBSet(conn);
tLDUserToMenuGrpDBSet.set((LDUserTOMenuGrpSet) mInputData.
getObjectByObjectName(
"LDUserTOMenuGrpSet", 0));
int len = tLDUserToMenuGrpDBSet.size();
// System.out.println("lens=" + len);
if (!tLDUserToMenuGrpDBSet.insert())
{
// @@错误处理
this.mErrors.copyAllErrors(tLDUserToMenuGrpDBSet.mErrors);
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = "用户菜单组关联表保存失败!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
// System.out.println("commit end");
}
catch (Exception ex)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "submitData";
tError.errorMessage = ex.toString();
this.mErrors.addOneError(tError);
try
{
conn.rollback();
conn.close();
}
catch (Exception e)
{}
tReturn = false;
}
return tReturn;
}
/**
* 更新操作
* @param mInputData VData
* @return boolean
*/
private boolean update(VData mInputData)
{
boolean tReturn = true;
Connection conn = DBConnPool.getConnection();
if (conn == null)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("connFaild")+"!";
this.mErrors.addOneError(tError);
return false;
}
try
{
conn.setAutoCommit(false);
// System.out.println("Start 更新用户...");
LDUserDB tLDUserDB = new LDUserDB(conn);
LDUserSchema tLDUserSchema = new LDUserSchema();
tLDUserSchema = (LDUserSchema) mInputData.getObjectByObjectName(
"LDUserSchema", 0);
String usercode = tLDUserSchema.getUserCode();
String operator = (String) mInputData.getObjectByObjectName(
"String", 0);
// System.out.println("go go go");
// System.out.println("password is :" + tLDUserSchema.getPassword());
//更新菜单组表,如果当前操作员和用户创建者一致
String curOperator = (String) mInputData.getObjectByObjectName(
"String", 0);
String crtOperator = tLDUserSchema.getOperator();
boolean updateUser = true;
if (curOperator.compareTo(crtOperator) == 0)
{
// System.out.println("we start tLDusertDB.update!");
// 开始进行密码加密
String plainPwd = tLDUserSchema.getPassword();
LisIDEA tIdea = new LisIDEA();
String encryptPwd = tIdea.encryptString(plainPwd);
tLDUserSchema.setPassword(encryptPwd);
tLDUserDB.setSchema(tLDUserSchema);
updateUser = tLDUserDB.update();
}
else
{
// System.out.println("we dont start tLDusertDB.update!");
}
if (!updateUser)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "update";
tError.errorMessage = ""+bundle.getString("Dataprocessingfailed")+"!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
//在更新前,必须先得到实际此用户失去的菜单节点集合,以便进行菜单组的更新
// String sqlStr =
// " select * from ldmenugrptomenu where menugrpcode in " +
// " (select menugrpcode from ldusertomenugrp where usercode = '" +
// usercode + "' and " +
// " menugrpcode in (select menugrpcode from ldmenugrp where operator = '" +
// operator + "'))";
// LDMenuGrpToMenuDB tRemoveSetDB = new LDMenuGrpToMenuDB(conn);
// //tRemoveSet是原来所有菜单集合的总集,并不是真正的删除集合,但没关系,
// //不过必须在插入新菜单组以后
// LDMenuGrpToMenuSet tRemoveSet = tRemoveSetDB.executeQuery(sqlStr);
String sqlStr = "select * from ldmenugrptomenu where menugrpcode in (select menugrpcode from ldusertomenugrp where usercode=? and menugrpcode in (select menugrpcode from ldmenugrp where operator=?)) ";
List paraList =new ArrayList();
paraList.add(usercode);
paraList.add(operator);
LDMenuGrpToMenuDB tRemoveSetDB = new LDMenuGrpToMenuDB(conn);
LDMenuGrpToMenuSet tRemoveSet=tRemoveSetDB.executeQuery(sqlStr,PubFun.getFormatBV(paraList));
//更新首先删除关联表中的相关关联,然后再插入最新的数据
sqlStr = "delete from ldusertomenugrp where usercode = '" +
usercode + "' and " +
" menugrpcode in (select menugrpcode from ldmenugrp where operator = '" +
operator + "')";
// System.out.println("****" + sqlStr + "***");
ExeSQL exeSQL = new ExeSQL(conn);
exeSQL.execUpdateSQL(sqlStr);
LDUserTOMenuGrpDBSet tLDUserToMenuGrpDBSet = new
LDUserTOMenuGrpDBSet(
conn);
tLDUserToMenuGrpDBSet.set((LDUserTOMenuGrpSet) mInputData.
getObjectByObjectName(
"LDUserTOMenuGrpSet", 0));
// System.out.println("开始插入...");
// System.out.println("BLS DBSet size:" + tLDUserToMenuGrpDBSet.size());
if (!tLDUserToMenuGrpDBSet.insert())
{
// @@错误处理
this.mErrors.copyAllErrors(tLDUserToMenuGrpDBSet.mErrors);
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "saveData";
tError.errorMessage = ""+bundle.getString("Dataprocessingfailed")+"!";
this.mErrors.addOneError(tError);
conn.rollback();
conn.close();
return false;
}
//开始更新此用户创建的菜单组
MenuGrpUpdate tMenuGrpUpdate = new MenuGrpUpdate();
boolean suc = tMenuGrpUpdate.userToMenuGrp(tRemoveSet, usercode,
conn);
if (!suc)
{
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
// System.out.println("commit end");
}
catch (Exception ex)
{
// @@错误处理
CError tError = new CError();
tError.moduleName = "LDUserBLS";
tError.functionName = "submitData";
tError.errorMessage = ex.toString();
this.mErrors.addOneError(tError);
try
{
conn.rollback();
conn.close();
}
catch (Exception e)
{}
tReturn = false;
}
return tReturn;
}
}
| 16,507 | 0.526889 | 0.525616 | 452 | 33.763275 | 24.348669 | 215 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.539823 | false | false | 9 |
faa934eaed4e30dce73203c2ecb07453975a68d3 | 5,815,385,752,272 | 7f17b01d699a7999f3d58ee9d3c94114df5317e5 | /sample/Java/eSDK_TP_Demo_CS_Java/src/com/huawei/esdk/csdemo/action/LoginAction.java | b4e5dfc4c4e2de9518f28f40dcac51bbb5ef0a58 | [
"Apache-2.0"
] | permissive | Huawei/eSDK_TP_SDK_Java | https://github.com/Huawei/eSDK_TP_SDK_Java | 6858031298a74cfb1e12270757eb0ebb0d8b128d | 6f4680e86f2f3eb47546fc16e8cd3a5ce61e3ea8 | refs/heads/master | 2018-03-21T02:52:53.436000 | 2016-08-31T01:49:34 | 2016-08-31T01:49:34 | 66,938,889 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright 2016 Huawei Technologies Co., Ltd. All rights reserved.
* eSDK is 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.huawei.esdk.csdemo.action;
import com.huawei.esdk.csdemo.common.KeepAliveUtil;
import com.huawei.esdk.csdemo.common.ServiceFactory;
import com.huawei.esdk.csdemo.convert.QuerySitesServiceConvert;
import com.huawei.esdk.tp.professional.local.authentication.AuthorizeServiceEx;
import com.huawei.esdk.tp.professional.local.impl.utils.PropertiesUtils;
public class LoginAction
{
public static int loginCode = -1;
static
{
//初始化鉴权接口服务,该服务中包含登录,登出的相关接口
AuthorizeServiceEx authorizeService = ServiceFactory.getInstance().getAuthorizeServiceEx();
//登录
Integer resultCode =
authorizeService.login(PropertiesUtils.getValue("userName"), PropertiesUtils.getValue("password"));
if (null == resultCode)
{
loginCode = -1;
}
else
{
if (0 != resultCode)
{
loginCode = resultCode;
System.out.println("authorize failed...");
QuerySitesServiceConvert.showloginErrCode(loginCode);
}
else
{
loginCode = 0;
System.out.println("authorize success...");
//启动保活线程
KeepAliveUtil keepAlive = new KeepAliveUtil();
Thread t1 = new Thread(keepAlive);
keepAlive.keepAliveFlag = true;
t1.start();
}
}
}
}
| UTF-8 | Java | 2,184 | java | LoginAction.java | Java | [] | null | [] | /**
* Copyright 2016 Huawei Technologies Co., Ltd. All rights reserved.
* eSDK is 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.huawei.esdk.csdemo.action;
import com.huawei.esdk.csdemo.common.KeepAliveUtil;
import com.huawei.esdk.csdemo.common.ServiceFactory;
import com.huawei.esdk.csdemo.convert.QuerySitesServiceConvert;
import com.huawei.esdk.tp.professional.local.authentication.AuthorizeServiceEx;
import com.huawei.esdk.tp.professional.local.impl.utils.PropertiesUtils;
public class LoginAction
{
public static int loginCode = -1;
static
{
//初始化鉴权接口服务,该服务中包含登录,登出的相关接口
AuthorizeServiceEx authorizeService = ServiceFactory.getInstance().getAuthorizeServiceEx();
//登录
Integer resultCode =
authorizeService.login(PropertiesUtils.getValue("userName"), PropertiesUtils.getValue("password"));
if (null == resultCode)
{
loginCode = -1;
}
else
{
if (0 != resultCode)
{
loginCode = resultCode;
System.out.println("authorize failed...");
QuerySitesServiceConvert.showloginErrCode(loginCode);
}
else
{
loginCode = 0;
System.out.println("authorize success...");
//启动保活线程
KeepAliveUtil keepAlive = new KeepAliveUtil();
Thread t1 = new Thread(keepAlive);
keepAlive.keepAliveFlag = true;
t1.start();
}
}
}
}
| 2,184 | 0.630435 | 0.623819 | 61 | 33.688526 | 27.843557 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.42623 | false | false | 9 |
6f35cefe1c80c87ff255ee3edec850c0f63f42f8 | 27,556,510,209,167 | 12108fccd173d9688bb127b0dd48cd872b653fe1 | /SinglyLinkedListImplementation/src/test/TestNode.java | 7f489a4adc98499778fbca31e31989afc08748a7 | [] | no_license | nagask/MicrosoftPractice | https://github.com/nagask/MicrosoftPractice | 7d560166abc9b35ac00e6895432c4dd11f475da9 | ea18e9f6364c4f4cb8be2562e5e34252ad53b413 | refs/heads/master | 2022-01-01T11:26:02.670000 | 2012-10-04T05:03:53 | 2012-10-04T05:03:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import practice.Node;
public class TestNode
{
Node<String> nodeZero;
Node<String> nodeOne;
Node<String> nodeTwo;
Node<String> nodeThree;
@Before
public void createNodes()
{
nodeThree = new Node<String>(null, null);
nodeTwo = new Node<String>("Two", nodeThree);
nodeOne = new Node<String>("One", nodeThree);
nodeZero = new Node<String>(null, nodeOne);
}
@Test
public void testConstructor()
{
assertEquals(nodeOne, nodeZero.getNextNode());
assertEquals(null, nodeZero.getData());
assertEquals(nodeThree, nodeOne.getNextNode());
assertEquals("One", nodeOne.getData());
assertEquals(nodeThree, nodeTwo.getNextNode());
assertEquals("Two", nodeTwo.getData());
assertEquals(null, nodeThree.getNextNode());
assertEquals(null, nodeThree.getData());
}
}
| UTF-8 | Java | 894 | java | TestNode.java | Java | [] | null | [] | package test;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import practice.Node;
public class TestNode
{
Node<String> nodeZero;
Node<String> nodeOne;
Node<String> nodeTwo;
Node<String> nodeThree;
@Before
public void createNodes()
{
nodeThree = new Node<String>(null, null);
nodeTwo = new Node<String>("Two", nodeThree);
nodeOne = new Node<String>("One", nodeThree);
nodeZero = new Node<String>(null, nodeOne);
}
@Test
public void testConstructor()
{
assertEquals(nodeOne, nodeZero.getNextNode());
assertEquals(null, nodeZero.getData());
assertEquals(nodeThree, nodeOne.getNextNode());
assertEquals("One", nodeOne.getData());
assertEquals(nodeThree, nodeTwo.getNextNode());
assertEquals("Two", nodeTwo.getData());
assertEquals(null, nodeThree.getNextNode());
assertEquals(null, nodeThree.getData());
}
}
| 894 | 0.713647 | 0.713647 | 41 | 20.804878 | 18.211788 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.878049 | false | false | 9 |
740756df1db01e29bbf7122285708e35e02e03a6 | 31,550,829,818,280 | d07144cb655035e453e47dca35d3067785ebed39 | /docscore/src/controller/VSMEngine.java | a98835c28c44a0cfe4cb1707ffd4a434595ebc6f | [] | no_license | cen5bin/IR | https://github.com/cen5bin/IR | 6e2c3b81b783ce7042f9acf3f5852d380def0938 | 50b4c27182c6180e427d9e2490cbee9c82e4cbce | refs/heads/master | 2021-01-24T14:18:11.133000 | 2014-12-14T16:34:55 | 2014-12-14T16:34:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Map.Entry;
import util.VSMUtil;
import cluster.KMeans;
import entity.TFIndex;
import entity.VSMDoc;
public class VSMEngine {
private Queue<VSMDoc> vsmDocQueue = new PriorityQueue<VSMDoc>();
private void initVSMDocList(HashMap<Integer, HashMap<Integer, Double>> vectors,
ArrayList<Integer> queryTermList, HashMap<Integer, Integer> refMap)
{
Iterator<Entry<Integer, HashMap<Integer, Double>>> iterator = vectors.entrySet().iterator();
while (iterator.hasNext())
{
Entry entry = iterator.next();
Integer docID = (Integer)entry.getKey();
HashMap<Integer, Double> vector = (HashMap<Integer, Double>)entry.getValue();
VSMDoc doc = new VSMDoc(docID, vector, refMap.get(docID));
double score = VSMUtil.fastCosineScore(doc, queryTermList);
doc.setScore(score);
vsmDocQueue.add(doc);
}
}
public VSMEngine(HashMap<Integer, HashMap<Integer, Double>> vectors,
ArrayList<Integer> queryTermList, HashMap<Integer, Integer> refMap)
{
initVSMDocList(vectors, queryTermList, refMap);
}
public ArrayList<VSMDoc> getTopKDocuments(int K)
{
int count = 0;
ArrayList<VSMDoc> docs = new ArrayList<VSMDoc>();
while (count < K)
{
VSMDoc doc = vsmDocQueue.poll();
docs.add(doc);
System.out.println(doc.getScore());
count++;
}
return docs;
}
}
| UTF-8 | Java | 1,565 | java | VSMEngine.java | Java | [] | null | [] | package controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Map.Entry;
import util.VSMUtil;
import cluster.KMeans;
import entity.TFIndex;
import entity.VSMDoc;
public class VSMEngine {
private Queue<VSMDoc> vsmDocQueue = new PriorityQueue<VSMDoc>();
private void initVSMDocList(HashMap<Integer, HashMap<Integer, Double>> vectors,
ArrayList<Integer> queryTermList, HashMap<Integer, Integer> refMap)
{
Iterator<Entry<Integer, HashMap<Integer, Double>>> iterator = vectors.entrySet().iterator();
while (iterator.hasNext())
{
Entry entry = iterator.next();
Integer docID = (Integer)entry.getKey();
HashMap<Integer, Double> vector = (HashMap<Integer, Double>)entry.getValue();
VSMDoc doc = new VSMDoc(docID, vector, refMap.get(docID));
double score = VSMUtil.fastCosineScore(doc, queryTermList);
doc.setScore(score);
vsmDocQueue.add(doc);
}
}
public VSMEngine(HashMap<Integer, HashMap<Integer, Double>> vectors,
ArrayList<Integer> queryTermList, HashMap<Integer, Integer> refMap)
{
initVSMDocList(vectors, queryTermList, refMap);
}
public ArrayList<VSMDoc> getTopKDocuments(int K)
{
int count = 0;
ArrayList<VSMDoc> docs = new ArrayList<VSMDoc>();
while (count < K)
{
VSMDoc doc = vsmDocQueue.poll();
docs.add(doc);
System.out.println(doc.getScore());
count++;
}
return docs;
}
}
| 1,565 | 0.696486 | 0.695847 | 58 | 24.982759 | 24.864801 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.224138 | false | false | 9 |
6be87a1169510279c39ee486b10e84134dbe5e5b | 4,561,255,320,866 | be74071dec0944e656372e44f22658702d415cab | /src/cfd/backupper/observer/FileCopiedObserver.java | b871dec2a0a0ce34d13f212f564615b3038c049a | [] | no_license | easy-da-man/cfdbackup | https://github.com/easy-da-man/cfdbackup | 4e63a73403b13d552252f32aa775eb38d445308b | e8988ce24f62c2320f3368581a6efbc7be929fb2 | refs/heads/master | 2016-09-06T13:06:30.757000 | 2014-10-09T14:21:38 | 2014-10-09T14:21:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cfd.backupper.observer;
import cfd.backupper.MainForm;
import cfd.backupper.state.Operations;
import cfd.backupper.uilogger.JTextAreaLogger;
import cfd.backupper.uilogger.JTextFieldLogger;
import cfd.backupper.uilogger.LoggaLogic;
import cfd.backupper.uilogger.Logger;
import java.nio.file.Path;
/**
*
* @author edm
*/
public class FileCopiedObserver<Path> extends Observer {
protected Subject subject = null;
JTextAreaLogger textAreaLogger = new JTextAreaLogger();
JTextFieldLogger textFieldLogger = new JTextFieldLogger();
@Override
public Object update(Object t) {
//System.out.println("The path is:"+ ((Path) t).toString());
Logger.log("Copied: " + ((Path) t).toString(), textAreaLogger);
Logger.log(Integer.toString(Operations.getFileCopyOperations()), textFieldLogger);
MainForm.jProgressBar1.setValue(Operations.getFileCopyOperations());
return (Path) t;
}
}
| UTF-8 | Java | 1,217 | java | FileCopiedObserver.java | Java | [
{
"context": "\nimport java.nio.file.Path;\r\n\r\n/**\r\n *\r\n * @author edm\r\n\r\n */\r\npublic class FileCopiedObserver<Path> ext",
"end": 531,
"score": 0.9926819205284119,
"start": 528,
"tag": "USERNAME",
"value": "edm"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cfd.backupper.observer;
import cfd.backupper.MainForm;
import cfd.backupper.state.Operations;
import cfd.backupper.uilogger.JTextAreaLogger;
import cfd.backupper.uilogger.JTextFieldLogger;
import cfd.backupper.uilogger.LoggaLogic;
import cfd.backupper.uilogger.Logger;
import java.nio.file.Path;
/**
*
* @author edm
*/
public class FileCopiedObserver<Path> extends Observer {
protected Subject subject = null;
JTextAreaLogger textAreaLogger = new JTextAreaLogger();
JTextFieldLogger textFieldLogger = new JTextFieldLogger();
@Override
public Object update(Object t) {
//System.out.println("The path is:"+ ((Path) t).toString());
Logger.log("Copied: " + ((Path) t).toString(), textAreaLogger);
Logger.log(Integer.toString(Operations.getFileCopyOperations()), textFieldLogger);
MainForm.jProgressBar1.setValue(Operations.getFileCopyOperations());
return (Path) t;
}
}
| 1,217 | 0.682005 | 0.681183 | 47 | 23.893618 | 26.619648 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.446809 | false | false | 9 |
64d0a010e1f8d3c27914ab196f2d800a823d1ae0 | 6,244,882,506,351 | 28ecb4dd5cfb3894dfda6d87ae217a519fdd1b6f | /CodeKata.java | 52261a16421ba406313ccf93346b0de7ea8a270d | [] | no_license | vaijayanthimani/vjmani | https://github.com/vaijayanthimani/vjmani | 35bf64a23e9b801bd3db87208d1e16d2dd6bd55e | d8b84b33b44c273dcb1c2bc980148cbdb118c904 | refs/heads/master | 2021-01-12T05:34:12.301000 | 2017-08-17T17:40:15 | 2017-08-17T17:40:15 | 77,129,245 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package square;
import java.util.*;
public class CodeKata {
public static void main(String []args){
Scanner s=new Scanner(System.in);
System.out.println("Enter two Strings");
String str1=s.nextLine();
char ch1[]=str1.toCharArray();
String str2=s.nextLine();
char ch2[]=str2.toCharArray();
for(int i=0;i<str1.length();i++) {
ch1[i]=(char) (ch1[i]+10);}
for(int i=1;i<str2.length()-1;i++){
ch2[i]=(char) (ch2[i]+10);
if(ch2[i]+10>122){
ch2[i]=(char) (122-ch2[i]);
ch2[i]=(char) (97+10-ch2[i]-11);
}
}
for(int i=0;i<str1.length();i++)
System.out.print(ch1[i]);
System.out.println();
for(int i=0; i<str2.length();i++)
System.out.print(ch2[i]);
}
}
| UTF-8 | Java | 705 | java | CodeKata.java | Java | [] | null | [] | package square;
import java.util.*;
public class CodeKata {
public static void main(String []args){
Scanner s=new Scanner(System.in);
System.out.println("Enter two Strings");
String str1=s.nextLine();
char ch1[]=str1.toCharArray();
String str2=s.nextLine();
char ch2[]=str2.toCharArray();
for(int i=0;i<str1.length();i++) {
ch1[i]=(char) (ch1[i]+10);}
for(int i=1;i<str2.length()-1;i++){
ch2[i]=(char) (ch2[i]+10);
if(ch2[i]+10>122){
ch2[i]=(char) (122-ch2[i]);
ch2[i]=(char) (97+10-ch2[i]-11);
}
}
for(int i=0;i<str1.length();i++)
System.out.print(ch1[i]);
System.out.println();
for(int i=0; i<str2.length();i++)
System.out.print(ch2[i]);
}
}
| 705 | 0.595745 | 0.533333 | 26 | 25.038462 | 11.470634 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.115385 | false | false | 9 |
d964d9a437007f798d444f498fae91a789e1f5f2 | 21,878,563,446,312 | 23ea343227e43c0db54580a192d2fb4345d076ff | /app/src/main/java/org/androidforfun/framework/Input.java | f58bff5808ecc579c46ba4fcf55078ac7ac26da7 | [] | no_license | sasadangelo/HelloWorldApp | https://github.com/sasadangelo/HelloWorldApp | 7f7f3e1e054ecee941ab0405f2236ca6921ab3bf | 87f91378684013b6a2ea2b5fbedd8001c2914b0a | refs/heads/master | 2021-01-10T04:04:39.276000 | 2016-12-02T15:08:39 | 2016-12-02T15:08:39 | 54,482,290 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2016 Mario Zechner
* This file is part of Framework for book Beginning Android Games.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License.
*/
package org.androidforfun.framework;
import java.util.List;
/** <p>
* Interface to the input facilities. This allows polling the state of the keyboard, the touch
* screen and the accelerometer.
* </p>
*
* @author mzechner
*/
public interface Input {
/**
* This class represents a event from keyboard. Each event from keyboard could be of two type:
* KEY_DOWN or KEY_UP; depending on the pressing of releasing of a key. Whenever a keyboard
* event is generated the relative key code (keyCode) and its human readable representation
* (keyChar) is associated to the event.
*
* @author mzechner
*/
class KeyEvent {
public static final int KEY_DOWN = 0;
public static final int KEY_UP = 1;
public int type;
public int keyCode;
public char keyChar;
/**
* Returns an human readable representation of the key event.
* @return the human readable representation of the key event.
*/
public String toString() {
StringBuilder builder = new StringBuilder();
if (type == KEY_DOWN)
builder.append("key down, ");
else
builder.append("key up, ");
builder.append(keyCode);
builder.append(",");
builder.append(keyChar);
return builder.toString();
}
}
/**
* This class represents a event generated when user touch the video. A finger can touch
* (TOUCH_DOWN), release (TOUCH_UP) or drag (TOUCH_DRAGGED) on the screen.
* TWhen th event is generated it will be associated to the event also the (x, y) position
* touched by the finger. When N fingers touch the video, N event will be generated and they
* differ by the pointer value. For the first finger point=1, the second pointer=2 and so on.
*
* @author mzechner
*/
class TouchEvent {
public static final int TOUCH_DOWN = 0;
public static final int TOUCH_UP = 1;
public static final int TOUCH_DRAGGED = 2;
public int type;
public int x, y;
public int pointer;
/**
* Returns an human readable representation of the touch event.
* @return the human readable representation of the touch event.
*/
public String toString() {
StringBuilder builder = new StringBuilder();
if (type == TOUCH_DOWN)
builder.append("touch down, ");
else if (type == TOUCH_DRAGGED)
builder.append("touch dragged, ");
else
builder.append("touch up, ");
builder.append(pointer);
builder.append(",");
builder.append(x);
builder.append(",");
builder.append(y);
return builder.toString();
}
}
/**
* Whether the screen is currently touched by the pointer with the given index. Pointers are
* indexed from 0 to n. The pointer id identifies the order in which the fingers went down on
* the screen, e.g. 0 is the first finger, 1 is the second and so on. When two fingers are
* touched down and the first one is lifted the second one keeps its index. If another finger
* is placed on the touch screen the first free index will be used.
*
* @param pointer the pointer
* @return whether the screen is touched by the pointer
*/
boolean isTouchDown(int pointer);
/**
* Returns the x coordinate in screen coordinates touched by the finger identified by the input
* pointer. Pointers are indexed from 0 to n. The pointer id identifies the order in which the
* fingers went down on the screen, e.g. 0 is the first finger, 1 is the second and so on.
* When two fingers are touched down and the first one is lifted the second one keeps its index.
* If another finger is placed on the touch screen the first free index will be used.
*
* @param pointer the pointer id.
* @return the x coordinate
*/
int getTouchX(int pointer);
/**
* Returns the y coordinate in screen coordinates touched by the finger identified by the input
* pointer. Pointers are indexed from 0 to n. The pointer id identifies the order in which the
* fingers went down on the screen, e.g. 0 is the first finger, 1 is the second and so on.
* When two fingers are touched down and the first one is lifted the second one keeps its index.
* If another finger is placed on the touch screen the first free index will be used.
*
* @param pointer the pointer id.
* @return the y coordinate
*/
int getTouchY(int pointer);
/**
* @return the list of touch events on the event queue.
*/
List<TouchEvent> getTouchEvents();
}
| UTF-8 | Java | 5,531 | java | Input.java | Java | [
{
"context": "/*\n * Copyright (C) 2016 Mario Zechner\n * This file is part of Framework for book Begin",
"end": 39,
"score": 0.999841034412384,
"start": 26,
"tag": "NAME",
"value": "Mario Zechner"
},
{
"context": "creen and the accelerometer.\n * </p>\n *\n * @author mzechner\n */... | null | [] | /*
* Copyright (C) 2016 <NAME>
* This file is part of Framework for book Beginning Android Games.
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License.
*/
package org.androidforfun.framework;
import java.util.List;
/** <p>
* Interface to the input facilities. This allows polling the state of the keyboard, the touch
* screen and the accelerometer.
* </p>
*
* @author mzechner
*/
public interface Input {
/**
* This class represents a event from keyboard. Each event from keyboard could be of two type:
* KEY_DOWN or KEY_UP; depending on the pressing of releasing of a key. Whenever a keyboard
* event is generated the relative key code (keyCode) and its human readable representation
* (keyChar) is associated to the event.
*
* @author mzechner
*/
class KeyEvent {
public static final int KEY_DOWN = 0;
public static final int KEY_UP = 1;
public int type;
public int keyCode;
public char keyChar;
/**
* Returns an human readable representation of the key event.
* @return the human readable representation of the key event.
*/
public String toString() {
StringBuilder builder = new StringBuilder();
if (type == KEY_DOWN)
builder.append("key down, ");
else
builder.append("key up, ");
builder.append(keyCode);
builder.append(",");
builder.append(keyChar);
return builder.toString();
}
}
/**
* This class represents a event generated when user touch the video. A finger can touch
* (TOUCH_DOWN), release (TOUCH_UP) or drag (TOUCH_DRAGGED) on the screen.
* TWhen th event is generated it will be associated to the event also the (x, y) position
* touched by the finger. When N fingers touch the video, N event will be generated and they
* differ by the pointer value. For the first finger point=1, the second pointer=2 and so on.
*
* @author mzechner
*/
class TouchEvent {
public static final int TOUCH_DOWN = 0;
public static final int TOUCH_UP = 1;
public static final int TOUCH_DRAGGED = 2;
public int type;
public int x, y;
public int pointer;
/**
* Returns an human readable representation of the touch event.
* @return the human readable representation of the touch event.
*/
public String toString() {
StringBuilder builder = new StringBuilder();
if (type == TOUCH_DOWN)
builder.append("touch down, ");
else if (type == TOUCH_DRAGGED)
builder.append("touch dragged, ");
else
builder.append("touch up, ");
builder.append(pointer);
builder.append(",");
builder.append(x);
builder.append(",");
builder.append(y);
return builder.toString();
}
}
/**
* Whether the screen is currently touched by the pointer with the given index. Pointers are
* indexed from 0 to n. The pointer id identifies the order in which the fingers went down on
* the screen, e.g. 0 is the first finger, 1 is the second and so on. When two fingers are
* touched down and the first one is lifted the second one keeps its index. If another finger
* is placed on the touch screen the first free index will be used.
*
* @param pointer the pointer
* @return whether the screen is touched by the pointer
*/
boolean isTouchDown(int pointer);
/**
* Returns the x coordinate in screen coordinates touched by the finger identified by the input
* pointer. Pointers are indexed from 0 to n. The pointer id identifies the order in which the
* fingers went down on the screen, e.g. 0 is the first finger, 1 is the second and so on.
* When two fingers are touched down and the first one is lifted the second one keeps its index.
* If another finger is placed on the touch screen the first free index will be used.
*
* @param pointer the pointer id.
* @return the x coordinate
*/
int getTouchX(int pointer);
/**
* Returns the y coordinate in screen coordinates touched by the finger identified by the input
* pointer. Pointers are indexed from 0 to n. The pointer id identifies the order in which the
* fingers went down on the screen, e.g. 0 is the first finger, 1 is the second and so on.
* When two fingers are touched down and the first one is lifted the second one keeps its index.
* If another finger is placed on the touch screen the first free index will be used.
*
* @param pointer the pointer id.
* @return the y coordinate
*/
int getTouchY(int pointer);
/**
* @return the list of touch events on the event queue.
*/
List<TouchEvent> getTouchEvents();
}
| 5,524 | 0.642018 | 0.638221 | 140 | 38.507141 | 32.141541 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421429 | false | false | 9 |
ac8a15c66de36339e718f1a064d8246e2768b31d | 29,841,432,792,710 | b94e7c0f83412a2b93390fb16e2da36a5892b238 | /src/main/java/com/ouyue/xiwennews/consumer/ThCoreListener.java | e3968efbffb650344ac5289a70bdc9cc48383f1d | [] | no_license | SteveCris/boot_rabbitmq | https://github.com/SteveCris/boot_rabbitmq | 6a26437e13e3df89cfe92325aa304463257cdc53 | f444f90247d2beb107235750879c297cde35c286 | refs/heads/master | 2022-06-24T03:30:19.103000 | 2019-10-22T07:07:07 | 2019-10-22T07:07:07 | 215,974,973 | 0 | 0 | null | false | 2022-06-21T02:04:03 | 2019-10-18T08:16:31 | 2019-10-22T07:07:24 | 2022-06-21T02:04:03 | 83 | 0 | 0 | 3 | Java | false | false | package com.ouyue.xiwennews.consumer;
import com.ouyue.xiwennews.service.UserLikeService;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.AmqpRejectAndDontRequeueException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ThCoreListener {
private static final String ERROR_MESSAGE = "遇到不可预测错误,直接进入死信队列";
private Logger logger = LoggerFactory.getLogger(ThCoreListener.class);
@Autowired
private RabbitMQProcess rabbitMQProcess;
@Autowired
private UserLikeService userLikeService;
@RabbitListener(queues = { "queue_ouyue_play" })
public void processAuditEvent(String pushEvent, Message message, Channel channel) {
logger.info("收到");
try {
rabbitMQProcess.execute(new RetryCallBack() {
@Override
public boolean processMessage() {
return userLikeService.processPushTime(pushEvent);
}
}, message, channel,
false);
} catch (Exception e) {
throw new AmqpRejectAndDontRequeueException(ERROR_MESSAGE, e);
}
}
}
| UTF-8 | Java | 1,304 | java | ThCoreListener.java | Java | [] | null | [] | package com.ouyue.xiwennews.consumer;
import com.ouyue.xiwennews.service.UserLikeService;
import com.rabbitmq.client.Channel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.AmqpRejectAndDontRequeueException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class ThCoreListener {
private static final String ERROR_MESSAGE = "遇到不可预测错误,直接进入死信队列";
private Logger logger = LoggerFactory.getLogger(ThCoreListener.class);
@Autowired
private RabbitMQProcess rabbitMQProcess;
@Autowired
private UserLikeService userLikeService;
@RabbitListener(queues = { "queue_ouyue_play" })
public void processAuditEvent(String pushEvent, Message message, Channel channel) {
logger.info("收到");
try {
rabbitMQProcess.execute(new RetryCallBack() {
@Override
public boolean processMessage() {
return userLikeService.processPushTime(pushEvent);
}
}, message, channel,
false);
} catch (Exception e) {
throw new AmqpRejectAndDontRequeueException(ERROR_MESSAGE, e);
}
}
}
| 1,304 | 0.768562 | 0.766983 | 44 | 27.772728 | 24.986237 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.318182 | false | false | 9 |
9ec77c0d3971b4cabc7d5c6e50eda761913c57c6 | 5,720,896,451,623 | 436e74b9be818e481fffea88d1361c646a88d180 | /src/main/java/com/financeiro/model/Person.java | b96b3fc1d50d4c00c6179b35b6094f45f558ccad | [] | no_license | johnatanbrayan/financeiro | https://github.com/johnatanbrayan/financeiro | dd5122f841c2feb447f20a83547c5cbc6bda6b0e | 4e7f58fb57b71401e669c7f2c91d39cd9a47b772 | refs/heads/master | 2022-11-21T14:15:54.819000 | 2020-07-22T16:08:12 | 2020-07-22T16:08:12 | 275,234,128 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.financeiro.model;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min= 3, max= 20)
private String name;
private Boolean status;
@OneToMany(mappedBy = "person", cascade = CascadeType.ALL)
private List<Address> adresses = new ArrayList<>();
public Person() {}
public Person(Long id, String name, Boolean status) {
this.id = id;
this.name = name;
this.status = status;
}
public Long getId() { return this.id; }
public void setId(Long id) { this.id = id; }
public String getName() { return this.name; }
public void setName(String name) { this.name = name; }
public Boolean getStatus() { return this.status; }
public void setStatus(Boolean status) { this.status = status; }
public List<Address> getAdresses() { return this.adresses; }
public void setAdresses(List<Address> adresses) { this.adresses = adresses; }
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof Person)) {
return false;
}
Person person = (Person) o;
return Objects.equals(id, person.id);
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
} | UTF-8 | Java | 1,738 | java | Person.java | Java | [] | null | [] | package com.financeiro.model;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotNull
@Size(min= 3, max= 20)
private String name;
private Boolean status;
@OneToMany(mappedBy = "person", cascade = CascadeType.ALL)
private List<Address> adresses = new ArrayList<>();
public Person() {}
public Person(Long id, String name, Boolean status) {
this.id = id;
this.name = name;
this.status = status;
}
public Long getId() { return this.id; }
public void setId(Long id) { this.id = id; }
public String getName() { return this.name; }
public void setName(String name) { this.name = name; }
public Boolean getStatus() { return this.status; }
public void setStatus(Boolean status) { this.status = status; }
public List<Address> getAdresses() { return this.adresses; }
public void setAdresses(List<Address> adresses) { this.adresses = adresses; }
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof Person)) {
return false;
}
Person person = (Person) o;
return Objects.equals(id, person.id);
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
} | 1,738 | 0.665708 | 0.663982 | 66 | 25.348484 | 20.692915 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.560606 | false | false | 9 |
360c105bdffe9acaf80e91fc808f90f8ebe99a53 | 28,269,474,761,259 | 8063dedc9dfbabbf95a4f29dbedef62bec67439c | /disabled-gvr-video/app/src/main/java/org/gearvrf/video/movie/MultiplexMovieTheater.java | f272569669a5ef7d7a78f2b12a0865d4dcf8ba45 | [] | no_license | NolaDonato/GearVRf-Demos | https://github.com/NolaDonato/GearVRf-Demos | 4ce296f6edc6fc7302bb7596e3548630a3794cd3 | ef28146ff3efd528c931cbd153b6d4bc8fc5b14a | refs/heads/master | 2020-04-05T14:32:48.885000 | 2018-12-05T03:15:01 | 2018-12-05T03:15:01 | 53,160,807 | 1 | 0 | null | true | 2018-11-05T21:10:38 | 2016-03-04T19:37:40 | 2018-11-04T09:39:05 | 2018-11-05T21:10:37 | 1,472,973 | 1 | 0 | 0 | Java | false | null | /* Copyright 2015 Samsung Electronics Co., LTD
*
* 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.gearvrf.video.movie;
import android.media.MediaPlayer;
import org.gearvrf.GVRAndroidResource;
import org.gearvrf.GVRContext;
import org.gearvrf.GVRExternalTexture;
import org.gearvrf.GVRMaterial;
import org.gearvrf.GVRMesh;
import org.gearvrf.GVRRenderData;
import org.gearvrf.GVRRenderPass;
import org.gearvrf.GVRSceneObject;
import org.gearvrf.GVRShaderId;
import org.gearvrf.GVRTexture;
import org.gearvrf.scene_objects.GVRVideoSceneObject;
import org.gearvrf.video.shaders.RadiosityShader;
import java.io.IOException;
public class MultiplexMovieTheater extends MovieTheater {
GVRSceneObject background = null;
GVRSceneObject screen = null;
private boolean mIsImax = false;
private float mTransitionWeight = 0.0f;
private float mTransitionTarget = 0.0f;
private float mFadeWeight = 0.0f;
private float mFadeTarget = 1.0f;
public MultiplexMovieTheater(GVRContext context, MediaPlayer player,
GVRExternalTexture screenTexture) {
super(context);
try {
// background
GVRMesh backgroundMesh = context.getAssetLoader().loadMesh(
new GVRAndroidResource(context, "multiplex/theater_background.obj"));
GVRTexture backgroundLightOffTexture = context.getAssetLoader().loadTexture(
new GVRAndroidResource(context, "multiplex/theater_background_light_off.jpg"));
GVRTexture backgroundLightOnTexture = context.getAssetLoader().loadTexture(
new GVRAndroidResource(context, "multiplex/theater_background_light_on.jpg"));
background = new GVRSceneObject(context, backgroundMesh, backgroundLightOffTexture);
background.setName("background");
background.getRenderData().setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
// radiosity
RadiosityShader radiosityShader = new RadiosityShader(context);
// background.getRenderData().getMaterial().set(radiosityShader.getShaderId());
background.getRenderData().setMaterial(new GVRMaterial(context, new GVRShaderId(RadiosityShader.class)));
background.getRenderData().getMaterial().setTexture(
RadiosityShader.TEXTURE_OFF_KEY, backgroundLightOffTexture);
background.getRenderData().getMaterial().setTexture(
RadiosityShader.TEXTURE_ON_KEY, backgroundLightOnTexture);
background.getRenderData().getMaterial().setTexture(
RadiosityShader.SCREEN_KEY, screenTexture);
// screen
GVRMesh screenMesh = context.getAssetLoader().loadMesh(new GVRAndroidResource(
context, "multiplex/screen.obj"));
screen = new GVRVideoSceneObject(context, screenMesh, player,
screenTexture, GVRVideoSceneObject.GVRVideoType.MONO);
screen.getRenderData().setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
this.addChildObject(background);
this.addChildObject(screen);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void hideCinemaTheater() {
background.getRenderData().setRenderMask(0);
screen.getRenderData().setRenderMask(0);
}
@Override
public void showCinemaTheater() {
mFadeWeight = 0.0f;
background.getRenderData().setRenderMask(GVRRenderData.GVRRenderMaskBit.Left
| GVRRenderData.GVRRenderMaskBit.Right);
screen.getRenderData().setRenderMask(GVRRenderData.GVRRenderMaskBit.Left
| GVRRenderData.GVRRenderMaskBit.Right);
}
@Override
public void switchOnLights() {
background.getRenderData().getMaterial().setMainTexture(
background.getRenderData().getMaterial().getTexture(RadiosityShader.TEXTURE_ON_KEY));
}
@Override
public void switchOffLights() {
background.getRenderData().getMaterial().setMainTexture(
background.getRenderData().getMaterial().getTexture(RadiosityShader.TEXTURE_OFF_KEY));
}
@Override
public void switchToImax() {
if (mIsImax) {
mIsImax = false;
mTransitionTarget = 0.0f;
} else {
mIsImax = true;
mTransitionTarget = 1.0f;
}
}
@Override
public void setShaderValues() {
mTransitionWeight += 0.1f * (mTransitionTarget - mTransitionWeight);
mFadeWeight += 0.01f * (mFadeTarget - mFadeWeight);
background.getRenderData().getMaterial()
.setFloat(RadiosityShader.WEIGHT_KEY, 0.1f);
background.getRenderData().getMaterial()
.setFloat(RadiosityShader.FADE_KEY, mFadeWeight);
background.getRenderData().getMaterial()
.setFloat(RadiosityShader.LIGHT_KEY, 2.0f);
float scale = 1.0f + mTransitionWeight;
if (scale >= 1.0f) {
background.getTransform().setScale(scale, scale, 1.0f);
screen.getTransform().setScale(scale, scale, 1.0f);
}
}
}
| UTF-8 | Java | 5,718 | java | MultiplexMovieTheater.java | Java | [] | null | [] | /* Copyright 2015 Samsung Electronics Co., LTD
*
* 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.gearvrf.video.movie;
import android.media.MediaPlayer;
import org.gearvrf.GVRAndroidResource;
import org.gearvrf.GVRContext;
import org.gearvrf.GVRExternalTexture;
import org.gearvrf.GVRMaterial;
import org.gearvrf.GVRMesh;
import org.gearvrf.GVRRenderData;
import org.gearvrf.GVRRenderPass;
import org.gearvrf.GVRSceneObject;
import org.gearvrf.GVRShaderId;
import org.gearvrf.GVRTexture;
import org.gearvrf.scene_objects.GVRVideoSceneObject;
import org.gearvrf.video.shaders.RadiosityShader;
import java.io.IOException;
public class MultiplexMovieTheater extends MovieTheater {
GVRSceneObject background = null;
GVRSceneObject screen = null;
private boolean mIsImax = false;
private float mTransitionWeight = 0.0f;
private float mTransitionTarget = 0.0f;
private float mFadeWeight = 0.0f;
private float mFadeTarget = 1.0f;
public MultiplexMovieTheater(GVRContext context, MediaPlayer player,
GVRExternalTexture screenTexture) {
super(context);
try {
// background
GVRMesh backgroundMesh = context.getAssetLoader().loadMesh(
new GVRAndroidResource(context, "multiplex/theater_background.obj"));
GVRTexture backgroundLightOffTexture = context.getAssetLoader().loadTexture(
new GVRAndroidResource(context, "multiplex/theater_background_light_off.jpg"));
GVRTexture backgroundLightOnTexture = context.getAssetLoader().loadTexture(
new GVRAndroidResource(context, "multiplex/theater_background_light_on.jpg"));
background = new GVRSceneObject(context, backgroundMesh, backgroundLightOffTexture);
background.setName("background");
background.getRenderData().setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
// radiosity
RadiosityShader radiosityShader = new RadiosityShader(context);
// background.getRenderData().getMaterial().set(radiosityShader.getShaderId());
background.getRenderData().setMaterial(new GVRMaterial(context, new GVRShaderId(RadiosityShader.class)));
background.getRenderData().getMaterial().setTexture(
RadiosityShader.TEXTURE_OFF_KEY, backgroundLightOffTexture);
background.getRenderData().getMaterial().setTexture(
RadiosityShader.TEXTURE_ON_KEY, backgroundLightOnTexture);
background.getRenderData().getMaterial().setTexture(
RadiosityShader.SCREEN_KEY, screenTexture);
// screen
GVRMesh screenMesh = context.getAssetLoader().loadMesh(new GVRAndroidResource(
context, "multiplex/screen.obj"));
screen = new GVRVideoSceneObject(context, screenMesh, player,
screenTexture, GVRVideoSceneObject.GVRVideoType.MONO);
screen.getRenderData().setCullFace(GVRRenderPass.GVRCullFaceEnum.None);
this.addChildObject(background);
this.addChildObject(screen);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void hideCinemaTheater() {
background.getRenderData().setRenderMask(0);
screen.getRenderData().setRenderMask(0);
}
@Override
public void showCinemaTheater() {
mFadeWeight = 0.0f;
background.getRenderData().setRenderMask(GVRRenderData.GVRRenderMaskBit.Left
| GVRRenderData.GVRRenderMaskBit.Right);
screen.getRenderData().setRenderMask(GVRRenderData.GVRRenderMaskBit.Left
| GVRRenderData.GVRRenderMaskBit.Right);
}
@Override
public void switchOnLights() {
background.getRenderData().getMaterial().setMainTexture(
background.getRenderData().getMaterial().getTexture(RadiosityShader.TEXTURE_ON_KEY));
}
@Override
public void switchOffLights() {
background.getRenderData().getMaterial().setMainTexture(
background.getRenderData().getMaterial().getTexture(RadiosityShader.TEXTURE_OFF_KEY));
}
@Override
public void switchToImax() {
if (mIsImax) {
mIsImax = false;
mTransitionTarget = 0.0f;
} else {
mIsImax = true;
mTransitionTarget = 1.0f;
}
}
@Override
public void setShaderValues() {
mTransitionWeight += 0.1f * (mTransitionTarget - mTransitionWeight);
mFadeWeight += 0.01f * (mFadeTarget - mFadeWeight);
background.getRenderData().getMaterial()
.setFloat(RadiosityShader.WEIGHT_KEY, 0.1f);
background.getRenderData().getMaterial()
.setFloat(RadiosityShader.FADE_KEY, mFadeWeight);
background.getRenderData().getMaterial()
.setFloat(RadiosityShader.LIGHT_KEY, 2.0f);
float scale = 1.0f + mTransitionWeight;
if (scale >= 1.0f) {
background.getTransform().setScale(scale, scale, 1.0f);
screen.getTransform().setScale(scale, scale, 1.0f);
}
}
}
| 5,718 | 0.675061 | 0.667891 | 137 | 40.737225 | 29.251806 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.664234 | false | false | 9 |
50fd207f119760142caa9e7f254f737dd245b08d | 3,169,685,904,379 | bea2c7be021cf75cc3716a846c6a22c6698c0b1d | /app/src/main/java/com/ramola/vibhav/Model/UpdateStudentResponse.java | 7a538f2088190e351ba4a6e4acd26eceb8c76790 | [] | no_license | Spider34/EasyOutPass | https://github.com/Spider34/EasyOutPass | a4ec9a8f15df542cd63d56c192947547e7578ff1 | 1aede56973e2a37dc1f20a7f52300549777d431d | refs/heads/master | 2021-01-18T19:03:49.252000 | 2017-04-02T05:37:18 | 2017-04-02T05:37:18 | 86,884,971 | 3 | 0 | null | true | 2017-04-01T04:57:11 | 2017-04-01T04:57:11 | 2017-04-01T04:25:31 | 2017-04-01T04:25:30 | 0 | 0 | 0 | 0 | null | null | null | package com.ramola.vibhav.Model;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
/**
* Created by sahil on 30/3/17.
*/
public class UpdateStudentResponse implements Parcelable {
@SerializedName("message")
private String message;
@SerializedName("success")
private boolean success;
@SerializedName("rfId")
private String rfId;
public UpdateStudentResponse(String message, boolean success, String rfId) {
this.message = message;
this.success = success;
this.rfId = rfId;
}
protected UpdateStudentResponse(Parcel in) {
message = in.readString();
success = in.readByte() != 0;
rfId = in.readString();
}
public static final Creator<UpdateStudentResponse> CREATOR = new Creator<UpdateStudentResponse>() {
@Override
public UpdateStudentResponse createFromParcel(Parcel in) {
return new UpdateStudentResponse(in);
}
@Override
public UpdateStudentResponse[] newArray(int size) {
return new UpdateStudentResponse[size];
}
};
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getRfId() {
return rfId;
}
public void setRfId(String rfId) {
this.rfId = rfId;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(message);
dest.writeByte((byte) (success ? 1 : 0));
dest.writeString(rfId);
}
}
| UTF-8 | Java | 1,853 | java | UpdateStudentResponse.java | Java | [
{
"context": "son.annotations.SerializedName;\n\n/**\n * Created by sahil on 30/3/17.\n */\n\npublic class UpdateStudentRespon",
"end": 166,
"score": 0.9960116744041443,
"start": 161,
"tag": "USERNAME",
"value": "sahil"
}
] | null | [] | package com.ramola.vibhav.Model;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
/**
* Created by sahil on 30/3/17.
*/
public class UpdateStudentResponse implements Parcelable {
@SerializedName("message")
private String message;
@SerializedName("success")
private boolean success;
@SerializedName("rfId")
private String rfId;
public UpdateStudentResponse(String message, boolean success, String rfId) {
this.message = message;
this.success = success;
this.rfId = rfId;
}
protected UpdateStudentResponse(Parcel in) {
message = in.readString();
success = in.readByte() != 0;
rfId = in.readString();
}
public static final Creator<UpdateStudentResponse> CREATOR = new Creator<UpdateStudentResponse>() {
@Override
public UpdateStudentResponse createFromParcel(Parcel in) {
return new UpdateStudentResponse(in);
}
@Override
public UpdateStudentResponse[] newArray(int size) {
return new UpdateStudentResponse[size];
}
};
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getRfId() {
return rfId;
}
public void setRfId(String rfId) {
this.rfId = rfId;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(message);
dest.writeByte((byte) (success ? 1 : 0));
dest.writeString(rfId);
}
}
| 1,853 | 0.62925 | 0.624393 | 82 | 21.597561 | 21.129023 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.353659 | false | false | 9 |
d9cd6a6dc7bc9496681e3709bb4d930a776bcb6f | 15,401,752,751,674 | d8f7159399148c5993c9430aca3a296bdefda456 | /app/src/main/java/com/ziasy/xmppchatapplication/group_chat/adapter/AddUserGroupAdapter.java | 2e84fd03e24e113ad2676e0dd3b25de94ece1205 | [] | no_license | ankitshrivastava00/ChatApplication | https://github.com/ankitshrivastava00/ChatApplication | 4d3555c4f9c0241b22cbd15e601096c920b4ad8b | fe7ba488e0c59ebadbe2e19481bc1c9fa414097c | refs/heads/master | 2020-05-01T15:45:41.538000 | 2019-03-26T14:24:49 | 2019-03-26T14:24:49 | 177,554,310 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ziasy.xmppchatapplication.group_chat.adapter;
/**
* Created by Khushvinders on 15-Nov-16.
*/
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.ziasy.xmppchatapplication.ChatActivity;
import com.ziasy.xmppchatapplication.ChatUserListActivity;
import com.ziasy.xmppchatapplication.R;
import com.ziasy.xmppchatapplication.User;
import java.util.ArrayList;
import java.util.Locale;
public class AddUserGroupAdapter extends BaseAdapter {
private ViewHolder viewHolder;
private static LayoutInflater inflater = null;
private String[] userList;
private ArrayList<User> list;
private ArrayList<User> searchList;
private ImageLoader imageLoader;
private Context activity;
public AddUserGroupAdapter(Context activity, ArrayList<User> list) {
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// imageLoader = ((TextChatApplication)activity.getApplication()).getImageLoader();
this.list = list;
this.searchList = new ArrayList<>();
this.searchList.addAll(list);
this.activity = activity;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
if (convertView == null) {
vi = inflater.inflate(R.layout.ud_user_list_row, null);
viewHolder = new ViewHolder();
viewHolder.userName = (TextView) vi.findViewById(R.id.tv_name);
viewHolder.userLayout = (LinearLayout) vi.findViewById(R.id.mainLayout);
viewHolder.view_career = (RelativeLayout) vi.findViewById(R.id.view_career);
vi.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) vi.getTag();
}
if (position % 2 == 0) {
viewHolder.view_career.setBackgroundColor(ContextCompat.getColor(activity, R.color.orange));
} else {
viewHolder.view_career.setBackgroundColor(ContextCompat.getColor(activity, R.color.ud_blue));
}
viewHolder.userName.setText(list.get(position).getName());
// viewHolder.status.setImageUrl("http://"+activity.getString(R.string.server)+":9090/plugins/presence/status?jid="+userList.get(position).getUsername()+"@domain_name", imageLoader);
return vi;
}
// Filter Class
public void filter(String charText) {
charText = charText.toLowerCase(Locale.getDefault());
list.clear();
if (charText.length() == 0) {
list.addAll(searchList);
}
else
{
for (User wp : searchList)
{
if (wp.getName().toLowerCase(Locale.getDefault()).contains(charText))
{
list.add(wp);
}
}
}
notifyDataSetChanged();
}
private class ViewHolder {
NetworkImageView status;
TextView userName;
private LinearLayout userLayout;
private RelativeLayout view_career;
// private SwipeLayout swipeLayout;
}
} | UTF-8 | Java | 3,803 | java | AddUserGroupAdapter.java | Java | [
{
"context": "application.group_chat.adapter;\n\n/**\n * Created by Khushvinders on 15-Nov-16.\n */\n\nimport android.app.Activity;\ni",
"end": 89,
"score": 0.9808929562568665,
"start": 77,
"tag": "NAME",
"value": "Khushvinders"
}
] | null | [] | package com.ziasy.xmppchatapplication.group_chat.adapter;
/**
* Created by Khushvinders on 15-Nov-16.
*/
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.NetworkImageView;
import com.ziasy.xmppchatapplication.ChatActivity;
import com.ziasy.xmppchatapplication.ChatUserListActivity;
import com.ziasy.xmppchatapplication.R;
import com.ziasy.xmppchatapplication.User;
import java.util.ArrayList;
import java.util.Locale;
public class AddUserGroupAdapter extends BaseAdapter {
private ViewHolder viewHolder;
private static LayoutInflater inflater = null;
private String[] userList;
private ArrayList<User> list;
private ArrayList<User> searchList;
private ImageLoader imageLoader;
private Context activity;
public AddUserGroupAdapter(Context activity, ArrayList<User> list) {
inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// imageLoader = ((TextChatApplication)activity.getApplication()).getImageLoader();
this.list = list;
this.searchList = new ArrayList<>();
this.searchList.addAll(list);
this.activity = activity;
}
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
if (convertView == null) {
vi = inflater.inflate(R.layout.ud_user_list_row, null);
viewHolder = new ViewHolder();
viewHolder.userName = (TextView) vi.findViewById(R.id.tv_name);
viewHolder.userLayout = (LinearLayout) vi.findViewById(R.id.mainLayout);
viewHolder.view_career = (RelativeLayout) vi.findViewById(R.id.view_career);
vi.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) vi.getTag();
}
if (position % 2 == 0) {
viewHolder.view_career.setBackgroundColor(ContextCompat.getColor(activity, R.color.orange));
} else {
viewHolder.view_career.setBackgroundColor(ContextCompat.getColor(activity, R.color.ud_blue));
}
viewHolder.userName.setText(list.get(position).getName());
// viewHolder.status.setImageUrl("http://"+activity.getString(R.string.server)+":9090/plugins/presence/status?jid="+userList.get(position).getUsername()+"@domain_name", imageLoader);
return vi;
}
// Filter Class
public void filter(String charText) {
charText = charText.toLowerCase(Locale.getDefault());
list.clear();
if (charText.length() == 0) {
list.addAll(searchList);
}
else
{
for (User wp : searchList)
{
if (wp.getName().toLowerCase(Locale.getDefault()).contains(charText))
{
list.add(wp);
}
}
}
notifyDataSetChanged();
}
private class ViewHolder {
NetworkImageView status;
TextView userName;
private LinearLayout userLayout;
private RelativeLayout view_career;
// private SwipeLayout swipeLayout;
}
} | 3,803 | 0.666053 | 0.662635 | 123 | 29.926828 | 28.741678 | 189 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.544715 | false | false | 9 |
b763c5088c6535b91b99fc77ba8372ba8f695ba5 | 23,424,751,644,330 | fed8141c560f503d8941fae15235c71becb78108 | /chapter04/src/main/java/collection/QueueTest.java | ec5d960c21bc517b48e117fe61abe8879b492aa0 | [] | no_license | Choeinhyo825/java-study | https://github.com/Choeinhyo825/java-study | cb64eda31656de019478cddcc9478e4cc7c774ec | 23417240b3452f1b963478e2200310a782495e63 | refs/heads/master | 2021-01-02T01:54:05.162000 | 2020-02-10T07:15:41 | 2020-02-10T07:15:41 | 239,442,523 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package collection;
import java.util.LinkedList;
import java.util.Queue;
public class QueueTest {
public static void main(String[] args) {
Queue<String> q = new LinkedList<>();
q.offer("둘리");
q.offer("마이콜");
q.offer("또치");
while (!q.isEmpty()) {
System.out.println("poll : " + q.poll());
}
// 비어있는경우 null을 리턴
System.out.println(q.poll());
q.offer("둘리");
q.offer("마이콜");
q.offer("또치");
System.out.println("poll : " + q.poll());
System.out.println("peek : " + q.peek());
System.out.println("poll : " + q.poll());
}
}
| UTF-8 | Java | 632 | java | QueueTest.java | Java | [
{
"context": "eue<String> q = new LinkedList<>();\r\n\r\n\t\tq.offer(\"둘리\");\r\n\t\tq.offer(\"마이콜\");\r\n\t\tq.offer(\"또치\");\r\n\r\n\t\twhil",
"end": 205,
"score": 0.9767430424690247,
"start": 203,
"tag": "NAME",
"value": "둘리"
},
{
"context": "w LinkedList<>();\r\n\r\n\t\tq.offer(\... | null | [] | package collection;
import java.util.LinkedList;
import java.util.Queue;
public class QueueTest {
public static void main(String[] args) {
Queue<String> q = new LinkedList<>();
q.offer("둘리");
q.offer("마이콜");
q.offer("또치");
while (!q.isEmpty()) {
System.out.println("poll : " + q.poll());
}
// 비어있는경우 null을 리턴
System.out.println(q.poll());
q.offer("둘리");
q.offer("마이콜");
q.offer("또치");
System.out.println("poll : " + q.poll());
System.out.println("peek : " + q.peek());
System.out.println("poll : " + q.poll());
}
}
| 632 | 0.566553 | 0.566553 | 30 | 17.533333 | 15.562205 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.6 | false | false | 9 |
c0c06e76a5dbceba6e81fc806741ffe55fcc967c | 20,220,706,056,495 | ed79a3a1605d4f99eb010a8637006a5159bbd720 | /app/src/main/java/com/example/group_project_0_1/DAO/SQLDao.java | e9e61f21ac5232c5845992b5bc0afdfd25757ae5 | [] | no_license | Bucky-Cheng/Android_APP_MedPediA | https://github.com/Bucky-Cheng/Android_APP_MedPediA | 1f27c0d2652022340b1ebc16ecaf18dd8fc765f5 | 86488d42fc7cb5c8e008913813d01fefc567c292 | refs/heads/master | 2022-12-04T19:23:03.284000 | 2020-09-01T12:08:57 | 2020-09-01T12:08:57 | 256,545,066 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.example.group_project_0_1.DAO;
import com.example.group_project_0_1.Model.Dr;
import com.example.group_project_0_1.Model.Illness;
public class SQLDao {
public SQLDao() {
}
public String AddIllness(Illness illness){
String SQL="INSERT INTO illness (userid, username) VALUES ('"
+ illness.getUid()+"', '"
+illness.getUsername()+"');";
System.out.println(SQL);
return SQL;
}
public String VerifyDr(String Drid,String Pro){
String SQL="SELECT * FROM DrId WHERE did='"+Drid+"' and dpro='"+Pro+"';";
return SQL;
}
public String AddDr(Dr dr){
String SQL="INSERT INTO dr (userid, username, drid, drpro) VALUES ('"
+ dr.getUid()+"', '"
+dr.getDrName()+"', '"
+dr.getDrID()+"','"
+dr.getPro()+"');";
return SQL;
}
public String upDateDrId(int id){
String SQL="UPDATE DrId SET flag = 1 WHERE id = "+id+";";
return SQL;
}
public String VerifiedIllness(String uid){
String SQL="SELECT * FROM illness WHERE userid='"+uid+"';";
return SQL;
}
public String VerifiedDr(String uid){
String SQL="SELECT * FROM dr WHERE userid='"+uid+"';";
return SQL;
}
public String findItems(){
String SQL="SELECT * FROM indexA";
return SQL;
}
public String findContent(String table,String t_id){
String SQL="SELECT * FROM "+table+" WHERE id='"+t_id+"';";
return SQL;
}
}
| UTF-8 | Java | 1,567 | java | SQLDao.java | Java | [] | null | [] | package com.example.group_project_0_1.DAO;
import com.example.group_project_0_1.Model.Dr;
import com.example.group_project_0_1.Model.Illness;
public class SQLDao {
public SQLDao() {
}
public String AddIllness(Illness illness){
String SQL="INSERT INTO illness (userid, username) VALUES ('"
+ illness.getUid()+"', '"
+illness.getUsername()+"');";
System.out.println(SQL);
return SQL;
}
public String VerifyDr(String Drid,String Pro){
String SQL="SELECT * FROM DrId WHERE did='"+Drid+"' and dpro='"+Pro+"';";
return SQL;
}
public String AddDr(Dr dr){
String SQL="INSERT INTO dr (userid, username, drid, drpro) VALUES ('"
+ dr.getUid()+"', '"
+dr.getDrName()+"', '"
+dr.getDrID()+"','"
+dr.getPro()+"');";
return SQL;
}
public String upDateDrId(int id){
String SQL="UPDATE DrId SET flag = 1 WHERE id = "+id+";";
return SQL;
}
public String VerifiedIllness(String uid){
String SQL="SELECT * FROM illness WHERE userid='"+uid+"';";
return SQL;
}
public String VerifiedDr(String uid){
String SQL="SELECT * FROM dr WHERE userid='"+uid+"';";
return SQL;
}
public String findItems(){
String SQL="SELECT * FROM indexA";
return SQL;
}
public String findContent(String table,String t_id){
String SQL="SELECT * FROM "+table+" WHERE id='"+t_id+"';";
return SQL;
}
}
| 1,567 | 0.55201 | 0.547543 | 59 | 25.559322 | 23.528757 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.627119 | false | false | 9 |
9aa0a9a641244d12b77e4dde980aaa9ed36c9c2f | 18,330,920,445,813 | 4153b03d181e042e13a4b85f70e408b49d517ded | /app/src/main/java/me/grechka/yamblz/yamblzweatherapp/presentation/activity/MainPresenter.java | 5f61c8791d710979d6c6fcc446dc1afdae04d421 | [] | no_license | grechka62/YaMblzWeatherApp | https://github.com/grechka62/YaMblzWeatherApp | 612f6842e6007bc59fbca25a11a2e22e4f778b6f | 90bbc05f3bb1e5558e225f418a8313dca23b4675 | refs/heads/master | 2020-12-02T10:12:26.791000 | 2017-07-30T17:19:53 | 2017-07-30T17:19:53 | 96,701,883 | 0 | 1 | null | false | 2017-08-01T14:48:20 | 2017-07-09T18:03:54 | 2017-07-09T19:24:19 | 2017-08-01T14:47:10 | 1,522 | 0 | 1 | 0 | Java | null | null | package me.grechka.yamblz.yamblzweatherapp.presentation.activity;
import android.util.Log;
import com.arellomobile.mvp.InjectViewState;
import com.arellomobile.mvp.MvpPresenter;
/**
* Created by Grechka on 14.07.2017.
*/
@InjectViewState
public class MainPresenter extends MvpPresenter<MainView> {
public void showWeather() {
getViewState().showWeather();
}
public void showSettings() {
getViewState().showSettings();
}
public void showAbout() {
getViewState().showAbout();
}
public void goBack() {
getViewState().goBack();
}
public void navigate(int screenId) {
getViewState().navigate(screenId);
}
}
| UTF-8 | Java | 693 | java | MainPresenter.java | Java | [
{
"context": ".arellomobile.mvp.MvpPresenter;\n\n/**\n * Created by Grechka on 14.07.2017.\n */\n\n@InjectViewState\npublic class",
"end": 206,
"score": 0.8517246842384338,
"start": 199,
"tag": "NAME",
"value": "Grechka"
}
] | null | [] | package me.grechka.yamblz.yamblzweatherapp.presentation.activity;
import android.util.Log;
import com.arellomobile.mvp.InjectViewState;
import com.arellomobile.mvp.MvpPresenter;
/**
* Created by Grechka on 14.07.2017.
*/
@InjectViewState
public class MainPresenter extends MvpPresenter<MainView> {
public void showWeather() {
getViewState().showWeather();
}
public void showSettings() {
getViewState().showSettings();
}
public void showAbout() {
getViewState().showAbout();
}
public void goBack() {
getViewState().goBack();
}
public void navigate(int screenId) {
getViewState().navigate(screenId);
}
}
| 693 | 0.672439 | 0.660895 | 34 | 19.382353 | 19.364939 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.264706 | false | false | 9 |
cf84e340b27bbea11665d81e129d14d35ba5c621 | 154,618,826,452 | b72bb0a308be41b811b0a6bf6e5aec91c2c15d7e | /app/src/main/java/matthew/shannon/jamfam/feature/home/HomeContract.java | 95af301f9c0dc197b5e577a762ef4ae995eff617 | [
"MIT"
] | permissive | shanno29/vibetribe-android | https://github.com/shanno29/vibetribe-android | 8d2807f1024e059941da9094ccdd05f478ea1e0a | e98674065c2be90389568ae38e902523945b8628 | refs/heads/master | 2021-01-13T04:33:00.141000 | 2017-02-16T08:18:48 | 2017-02-16T08:18:48 | 79,603,676 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package matthew.shannon.jamfam.feature.home;
public interface HomeContract {
interface View {}
interface Presenter {
void unsubscribe();
}
}
| UTF-8 | Java | 167 | java | HomeContract.java | Java | [
{
"context": "package matthew.shannon.jamfam.feature.home;\n\n\npublic interface H",
"end": 15,
"score": 0.6309385299682617,
"start": 8,
"tag": "USERNAME",
"value": "matthew"
},
{
"context": "package matthew.shannon.jamfam.feature.home;\n\n\npublic interface HomeContr",
"end": 23... | null | [] | package matthew.shannon.jamfam.feature.home;
public interface HomeContract {
interface View {}
interface Presenter {
void unsubscribe();
}
}
| 167 | 0.664671 | 0.664671 | 12 | 12.916667 | 15.162774 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.166667 | false | false | 13 |
fd70cec13e6bb35e254b5d23a6f31340938e7675 | 23,106,924,057,944 | 1abe42829369660ba366b35bdfbf43155d358392 | /app/src/main/java/com/example/thierry/eventplanner/SettingsFragment.java | a83f1cf68bb0708d99ca38e33542c7890c0bb8a2 | [] | no_license | mrchechay/mobileAppDev | https://github.com/mrchechay/mobileAppDev | 96c2906a3229db1eda644c9d132fa121376e5076 | e84f6050b3c4fbb8d3542701bacb0834d1830d7e | refs/heads/master | 2020-05-26T13:17:25.112000 | 2017-05-05T19:38:44 | 2017-05-05T19:38:44 | 85,001,434 | 0 | 0 | null | false | 2017-05-05T19:38:45 | 2017-03-14T22:00:57 | 2017-03-15T12:41:14 | 2017-05-05T19:38:44 | 351 | 0 | 0 | 3 | Java | null | null | package com.example.thierry.eventplanner;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
public class SettingsFragment extends Fragment {
private TextView textView;
public SettingsFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_settings, container, false);
textView = (TextView) view.findViewById(R.id.userManual);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openManual();
}
});
Button theme = (Button) view.findViewById(R.id.changeTheme);
theme.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//getActivity().setTheme(R.style.DarkAppTheme);
}
});
Button buttonEvents = (Button) view.findViewById(R.id.deleteEvents);
buttonEvents.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
confirmDelete("events");
}
});
Button buttonTasks = (Button) view.findViewById(R.id.deleteTasks);
buttonTasks.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
confirmDelete("tasks");
}
});
Button buttonAll = (Button) view.findViewById(R.id.deleteAll);
buttonAll.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
confirmDelete("all");
}
});
return view;
}
private void openManual(){
Toast.makeText(getActivity(), "Open user manual", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getActivity(), UserManual.class);
startActivity(intent);
}
public void confirmDelete(final String type) {
if (type.equals("events")) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Are you sure you want to delete all stored events?")
.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DBHelperEvents db = new DBHelperEvents(getActivity());
db.dropTable();
Toast.makeText(getActivity(), "All events deleted", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.create();
builder.show();
} else if (type.equals("tasks")) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Are you sure you want to delete all stored daily tasks?")
.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DBHelperDailyTasks db = new DBHelperDailyTasks(getActivity());
db.dropTable();
Toast.makeText(getActivity(), "All tasks deleted", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.create();
builder.show();
} else if (type.equals("all")) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Are you sure you want to delete all stored events and daily tasks?")
.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DBHelperEvents db = new DBHelperEvents(getActivity());
DBHelperDailyTasks dbDT = new DBHelperDailyTasks(getActivity());
db.dropTable();
dbDT.dropTable();
Toast.makeText(getActivity(), "All events and tasks deleted", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.create();
builder.show();
}
}
} | UTF-8 | Java | 5,720 | java | SettingsFragment.java | Java | [
{
"context": "package com.example.thierry.eventplanner;\n\nimport android.content.Context;\nim",
"end": 27,
"score": 0.9898848533630371,
"start": 20,
"tag": "USERNAME",
"value": "thierry"
}
] | null | [] | package com.example.thierry.eventplanner;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
public class SettingsFragment extends Fragment {
private TextView textView;
public SettingsFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_settings, container, false);
textView = (TextView) view.findViewById(R.id.userManual);
textView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openManual();
}
});
Button theme = (Button) view.findViewById(R.id.changeTheme);
theme.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//getActivity().setTheme(R.style.DarkAppTheme);
}
});
Button buttonEvents = (Button) view.findViewById(R.id.deleteEvents);
buttonEvents.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
confirmDelete("events");
}
});
Button buttonTasks = (Button) view.findViewById(R.id.deleteTasks);
buttonTasks.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
confirmDelete("tasks");
}
});
Button buttonAll = (Button) view.findViewById(R.id.deleteAll);
buttonAll.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
confirmDelete("all");
}
});
return view;
}
private void openManual(){
Toast.makeText(getActivity(), "Open user manual", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getActivity(), UserManual.class);
startActivity(intent);
}
public void confirmDelete(final String type) {
if (type.equals("events")) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Are you sure you want to delete all stored events?")
.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DBHelperEvents db = new DBHelperEvents(getActivity());
db.dropTable();
Toast.makeText(getActivity(), "All events deleted", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.create();
builder.show();
} else if (type.equals("tasks")) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Are you sure you want to delete all stored daily tasks?")
.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DBHelperDailyTasks db = new DBHelperDailyTasks(getActivity());
db.dropTable();
Toast.makeText(getActivity(), "All tasks deleted", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.create();
builder.show();
} else if (type.equals("all")) {
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setMessage("Are you sure you want to delete all stored events and daily tasks?")
.setPositiveButton("Delete", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
DBHelperEvents db = new DBHelperEvents(getActivity());
DBHelperDailyTasks dbDT = new DBHelperDailyTasks(getActivity());
db.dropTable();
dbDT.dropTable();
Toast.makeText(getActivity(), "All events and tasks deleted", Toast.LENGTH_SHORT).show();
dialog.cancel();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
})
.create();
builder.show();
}
}
} | 5,720 | 0.554895 | 0.554545 | 138 | 40.45652 | 30.379513 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.637681 | false | false | 13 |
29ae48ead0e7c108a4261ddb5137066b02ac839d | 28,716,151,402,198 | ffb812e8e56c38a7c38856e49710d06c8e387efd | /src/com/braker/common/entity/CheckEntity.java | a417c00ac20021c9a067c93c3744b01a4df81f37 | [] | no_license | MengleiZhao/gxjzy_nk | https://github.com/MengleiZhao/gxjzy_nk | 81a9720f996a937c8067466c9dd4f210e9861ac5 | 7c1693092467339fa5294149b605c1d8f19d817f | refs/heads/main | 2023-08-24T18:18:59.839000 | 2021-09-24T12:57:28 | 2021-09-24T12:57:28 | 409,955,569 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.braker.common.entity;
/**
* 审批接口
* @author 李安达
*
*/
public interface CheckEntity {
/**
* 下一审批人姓名
* @param userName
*/
public void setNextCheckUserName(String userName);
/**
* 下一审批人Id
* @param userId
*/
public void setNextCheckUserId(String userId);
/**
* 下一审批人Id
* @param userId
*/
public String getNextCheckUserId();
/**
* 下一审批节点
* @param nCode
*/
public void setNextCheckKey(String nCode);
/**
* 设置审批状态
* @param checkStatus
*/
public void setCheckStauts(String checkStatus);
/**
* 获取审批状态
* @param checkStatus
*/
public String getCheckStauts();
/**
* 申请状态
* @param status
*/
public void setStauts(String status);
/**
* 出纳受理状态
* @param status
*/
public void setCashierType(String status);
/**
* 编号
* @return
*/
public String getBeanCode();
/**
* 编码对应的字段名
* @return
*/
public String getBeanCodeField();
/**
* 主键id
* @return
*/
public Integer getBeanId();
/**
* 申请人id
* @return
*/
public String getUserId();
/**
* 下一审批节点的key
* @return
*/
public String getNextCheckKey();
/**
*
* @Description: 对应数据库表
*/
public String getJoinTable();
}
| UTF-8 | Java | 1,334 | java | CheckEntity.java | Java | [
{
"context": "com.braker.common.entity;\n\n/**\n * 审批接口\n * @author 李安达\n *\n */\npublic interface CheckEntity {\n\t/**\n\t * 下一",
"end": 61,
"score": 0.9995735287666321,
"start": 58,
"tag": "NAME",
"value": "李安达"
}
] | null | [] | package com.braker.common.entity;
/**
* 审批接口
* @author 李安达
*
*/
public interface CheckEntity {
/**
* 下一审批人姓名
* @param userName
*/
public void setNextCheckUserName(String userName);
/**
* 下一审批人Id
* @param userId
*/
public void setNextCheckUserId(String userId);
/**
* 下一审批人Id
* @param userId
*/
public String getNextCheckUserId();
/**
* 下一审批节点
* @param nCode
*/
public void setNextCheckKey(String nCode);
/**
* 设置审批状态
* @param checkStatus
*/
public void setCheckStauts(String checkStatus);
/**
* 获取审批状态
* @param checkStatus
*/
public String getCheckStauts();
/**
* 申请状态
* @param status
*/
public void setStauts(String status);
/**
* 出纳受理状态
* @param status
*/
public void setCashierType(String status);
/**
* 编号
* @return
*/
public String getBeanCode();
/**
* 编码对应的字段名
* @return
*/
public String getBeanCodeField();
/**
* 主键id
* @return
*/
public Integer getBeanId();
/**
* 申请人id
* @return
*/
public String getUserId();
/**
* 下一审批节点的key
* @return
*/
public String getNextCheckKey();
/**
*
* @Description: 对应数据库表
*/
public String getJoinTable();
}
| 1,334 | 0.613288 | 0.613288 | 85 | 12.811765 | 12.867189 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.070588 | false | false | 13 |
642cac76ccf3f7457e67e9350fcd6314f1efac2b | 28,716,151,403,311 | d897292038b7620fcf9b45cad816d7e9f61e5ec3 | /src/com/nano/lanshare/utils/WifiManagerUtils.java | 8cbd766a9192996ec4d27cc3c097ff2cdb36cfa1 | [] | no_license | ljl546158733/lanshare | https://github.com/ljl546158733/lanshare | f3002e2bf50c7c49bf2cdb5a039d54a367898424 | a66e63e1e6d58b7d7c014502909aa2266b431c8a | refs/heads/master | 2021-01-18T00:52:13.143000 | 2013-05-11T17:43:39 | 2013-05-11T17:43:39 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.nano.lanshare.utils;
import java.lang.reflect.Method;
import java.util.List;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
public class WifiManagerUtils {
public static int getWifiApStatus(WifiManager wifiManager) {
return 0;
}
public static boolean setWifiApEnabled(WifiManager wifiManager, WifiConfiguration cfg,
boolean flag) {
try {
if (wifiManager.isWifiEnabled() && flag) {
wifiManager.setWifiEnabled(false);
}
Method method = wifiManager.getClass().getMethod("setWifiApEnabled",
WifiConfiguration.class, Boolean.TYPE);
Boolean enable = (Boolean) method.invoke(wifiManager, cfg, flag);
if (!flag) {
wifiManager.setWifiEnabled(true);
}
return enable;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static Boolean isWifiApEnable(WifiManager wifiManager) {
Method method;
try {
method = wifiManager.getClass().getMethod("isWifiApEnabled");
Boolean enable = (Boolean) method.invoke(wifiManager);
return enable;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static List getWifiApList(WifiManager wifiManager) {
// wifiManager.s
return null;
}
public static boolean connect2WifiAp(WifiManager wifiManager, String ssid, String bssid) {
WifiConfiguration apConfig = new WifiConfiguration();
apConfig.BSSID = bssid;
apConfig.SSID = "\"" + ssid + "\"";
apConfig.hiddenSSID = true;
apConfig.status = WifiConfiguration.Status.ENABLED;
apConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
apConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
apConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
apConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
apConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
apConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
int wcgID = wifiManager.addNetwork(apConfig);
boolean flag = wifiManager.enableNetwork(wcgID, true);
return wifiManager.reconnect();
}
}
| UTF-8 | Java | 2,454 | java | WifiManagerUtils.java | Java | [] | null | [] |
package com.nano.lanshare.utils;
import java.lang.reflect.Method;
import java.util.List;
import android.net.wifi.WifiConfiguration;
import android.net.wifi.WifiManager;
public class WifiManagerUtils {
public static int getWifiApStatus(WifiManager wifiManager) {
return 0;
}
public static boolean setWifiApEnabled(WifiManager wifiManager, WifiConfiguration cfg,
boolean flag) {
try {
if (wifiManager.isWifiEnabled() && flag) {
wifiManager.setWifiEnabled(false);
}
Method method = wifiManager.getClass().getMethod("setWifiApEnabled",
WifiConfiguration.class, Boolean.TYPE);
Boolean enable = (Boolean) method.invoke(wifiManager, cfg, flag);
if (!flag) {
wifiManager.setWifiEnabled(true);
}
return enable;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static Boolean isWifiApEnable(WifiManager wifiManager) {
Method method;
try {
method = wifiManager.getClass().getMethod("isWifiApEnabled");
Boolean enable = (Boolean) method.invoke(wifiManager);
return enable;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static List getWifiApList(WifiManager wifiManager) {
// wifiManager.s
return null;
}
public static boolean connect2WifiAp(WifiManager wifiManager, String ssid, String bssid) {
WifiConfiguration apConfig = new WifiConfiguration();
apConfig.BSSID = bssid;
apConfig.SSID = "\"" + ssid + "\"";
apConfig.hiddenSSID = true;
apConfig.status = WifiConfiguration.Status.ENABLED;
apConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP);
apConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP);
apConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
apConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP);
apConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP);
apConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN);
int wcgID = wifiManager.addNetwork(apConfig);
boolean flag = wifiManager.enableNetwork(wcgID, true);
return wifiManager.reconnect();
}
}
| 2,454 | 0.650367 | 0.649552 | 67 | 35.611938 | 27.426403 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.641791 | false | false | 13 |
4dd803e1821c068e15244393922200943bf04f41 | 26,371,099,199,217 | 42cbe78c86247f373d01a364dd1b4f9eff7bee2d | /app/src/main/java/com/quickenloans/referexpress/interfaces/PageCompletionListener.java | 273d6db58a7a61c21d99850de31dc147eb461c95 | [] | no_license | theonlyjdeville/ReferEXPRESS | https://github.com/theonlyjdeville/ReferEXPRESS | fbc3696241fbba73e6fbfe400eacb79b1d2ab49e | fbbec004535dc33da164b0a60421a66032315d74 | refs/heads/master | 2021-06-21T18:22:45.999000 | 2017-08-10T14:56:52 | 2017-08-10T14:56:52 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.quickenloans.referexpress.interfaces;
/**
* Surrounding fragments, in the ViewPager, are making callbacks AFTER
* the viewing fragment makes its callbacks. This is causing the 'Next button'
* to enable/disable incorrectly. Adding a 'requesting fragment' condition
* to the callback has rectified this issue.
*/
public interface PageCompletionListener {
void onPageCompletionChanged(int requestingFragment, boolean validated);
}
| UTF-8 | Java | 451 | java | PageCompletionListener.java | Java | [] | null | [] | package com.quickenloans.referexpress.interfaces;
/**
* Surrounding fragments, in the ViewPager, are making callbacks AFTER
* the viewing fragment makes its callbacks. This is causing the 'Next button'
* to enable/disable incorrectly. Adding a 'requesting fragment' condition
* to the callback has rectified this issue.
*/
public interface PageCompletionListener {
void onPageCompletionChanged(int requestingFragment, boolean validated);
}
| 451 | 0.791574 | 0.791574 | 12 | 36.583332 | 31.902086 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false | 13 |
83a6865c979151294b629ec103789700131ed05a | 21,758,304,346,935 | b352ab5737a210d19c7c7b9c665ae8063420e9de | /Concurrency/Increaser.java | 0f6c679f5f36e33725e8f8b70d2764b38db008cc | [] | no_license | LiliyaStefanova/JavaProgrammingExercises | https://github.com/LiliyaStefanova/JavaProgrammingExercises | e4cd20b1c96cb4c7ad4e1f4d98ea730dc986bb9d | 2651d841e1c75c1a51b4d852ac8f7d9dda3da153 | refs/heads/master | 2021-01-16T22:06:10.215000 | 2014-08-31T22:32:42 | 2014-08-31T22:32:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Concurrency;
/**
* Created with IntelliJ IDEA.
* User: liliya
* Date: 10/02/14
* Time: 19:33
* To change this template use File | Settings | File Templates.
*/
public class Increaser implements Runnable{
private Counter c;
private Object obj;
public Increaser(Counter counter){
this.c=counter;
obj=new Object();
}
public static void main(String [] args){
Counter counter=new Counter();
for(int i=0; i<100; i++){
Increaser increaserTask=new Increaser(counter);
Thread t=new Thread(increaserTask);
t.start();
}
}
@Override
public void run() {
System.out.println("Starting at: "+ c.getCount());
for(int i=0; i<1000;i++){
c.increase();
}
System.out.println("Stopping at: "+c.getCount());
}
}
| UTF-8 | Java | 924 | java | Increaser.java | Java | [
{
"context": "ency;\n\n/**\n * Created with IntelliJ IDEA.\n * User: liliya\n * Date: 10/02/14\n * Time: 19:33\n * To change thi",
"end": 72,
"score": 0.9989935755729675,
"start": 66,
"tag": "USERNAME",
"value": "liliya"
}
] | null | [] | package Concurrency;
/**
* Created with IntelliJ IDEA.
* User: liliya
* Date: 10/02/14
* Time: 19:33
* To change this template use File | Settings | File Templates.
*/
public class Increaser implements Runnable{
private Counter c;
private Object obj;
public Increaser(Counter counter){
this.c=counter;
obj=new Object();
}
public static void main(String [] args){
Counter counter=new Counter();
for(int i=0; i<100; i++){
Increaser increaserTask=new Increaser(counter);
Thread t=new Thread(increaserTask);
t.start();
}
}
@Override
public void run() {
System.out.println("Starting at: "+ c.getCount());
for(int i=0; i<1000;i++){
c.increase();
}
System.out.println("Stopping at: "+c.getCount());
}
}
| 924 | 0.536797 | 0.516234 | 39 | 22.615385 | 18.832071 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false | 13 |
3c303f2fcf60cc77f8c6458ed8346f03d0086e63 | 31,533,649,916,474 | 81206fdaceb1fa1c92def8c0fa72ba64bb02b04d | /app/src/main/java/com/thingword/alphonso/materialmanage/bean/dbbean/ProductLineIndex.java | 90e2e1092e417f51d859af18d58de2339fc6ddbd | [] | no_license | alphonso64/MaterialManage | https://github.com/alphonso64/MaterialManage | 8010976307432027be08ba9feb5e2d1e11e3bd16 | e70b205fc99d8be575efd4f3b7435318381ba9d4 | refs/heads/master | 2020-12-02T14:42:06.205000 | 2017-03-08T00:01:19 | 2017-03-08T00:01:19 | 66,237,452 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.thingword.alphonso.materialmanage.bean.dbbean;
/**
* Created by thingword-A on 2016/12/28.
*/
public class ProductLineIndex {
private Long _id;
private String tasknumber;
private String productcode;
private String line;
private String executor;
private String checker;
private String hasUpdate;
private String totalNum;
private String checkNum;
public String getTasknumber() {
return tasknumber;
}
public void setTasknumber(String tasknumber) {
this.tasknumber = tasknumber;
}
public Long get_id() {
return _id;
}
public void set_id(Long _id) {
this._id = _id;
}
public String getProductcode() {
return productcode;
}
public void setProductcode(String productcode) {
this.productcode = productcode;
}
public String getLine() {
return line;
}
public void setLine(String line) {
this.line = line;
}
public String getExecutor() {
return executor;
}
public void setExecutor(String executor) {
this.executor = executor;
}
public String getChecker() {
return checker;
}
public void setChecker(String checker) {
this.checker = checker;
}
public String getHasUpdate() {
return hasUpdate;
}
public void setHasUpdate(String hasUpdate) {
this.hasUpdate = hasUpdate;
}
public String getTotalNum() {
return totalNum;
}
public void setTotalNum(String totalNum) {
this.totalNum = totalNum;
}
public String getCheckNum() {
return checkNum;
}
public void setCheckNum(String checkNum) {
this.checkNum = checkNum;
}
}
| UTF-8 | Java | 1,756 | java | ProductLineIndex.java | Java | [
{
"context": "nso.materialmanage.bean.dbbean;\n\n/**\n * Created by thingword-A on 2016/12/28.\n */\npublic class ProductLineIndex ",
"end": 89,
"score": 0.9996652007102966,
"start": 78,
"tag": "USERNAME",
"value": "thingword-A"
}
] | null | [] | package com.thingword.alphonso.materialmanage.bean.dbbean;
/**
* Created by thingword-A on 2016/12/28.
*/
public class ProductLineIndex {
private Long _id;
private String tasknumber;
private String productcode;
private String line;
private String executor;
private String checker;
private String hasUpdate;
private String totalNum;
private String checkNum;
public String getTasknumber() {
return tasknumber;
}
public void setTasknumber(String tasknumber) {
this.tasknumber = tasknumber;
}
public Long get_id() {
return _id;
}
public void set_id(Long _id) {
this._id = _id;
}
public String getProductcode() {
return productcode;
}
public void setProductcode(String productcode) {
this.productcode = productcode;
}
public String getLine() {
return line;
}
public void setLine(String line) {
this.line = line;
}
public String getExecutor() {
return executor;
}
public void setExecutor(String executor) {
this.executor = executor;
}
public String getChecker() {
return checker;
}
public void setChecker(String checker) {
this.checker = checker;
}
public String getHasUpdate() {
return hasUpdate;
}
public void setHasUpdate(String hasUpdate) {
this.hasUpdate = hasUpdate;
}
public String getTotalNum() {
return totalNum;
}
public void setTotalNum(String totalNum) {
this.totalNum = totalNum;
}
public String getCheckNum() {
return checkNum;
}
public void setCheckNum(String checkNum) {
this.checkNum = checkNum;
}
}
| 1,756 | 0.616743 | 0.612187 | 88 | 18.954546 | 16.514395 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.318182 | false | false | 13 |
871ea6933fd1aebcb6e432aa71e88f4dadf06deb | 29,910,152,280,284 | d7a1f599c65020c77768154430087580dfd3ae92 | /src/main/java/com/tetv/verticles/Pong.java | ba5e9d4a94c7056d11dc28180a4c2dd12b6cc59d | [] | no_license | tetv/vertx3-blocking | https://github.com/tetv/vertx3-blocking | 95b46b0422da6dc05da983965110522a41b7447c | bd016afe5942bbed86bdf321ffc209f2c939c036 | refs/heads/master | 2020-04-09T16:52:59.534000 | 2017-03-11T10:36:02 | 2017-03-11T10:36:02 | 68,096,790 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.tetv.verticles;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.core.WorkerExecutor;
import io.vertx.core.eventbus.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Pong extends AbstractVerticle {
private final static Logger LOG = LoggerFactory.getLogger(Pong.class);
private final String name = System.getProperty("vertx.id", "pong");
private final int wait;
private final String mode;
private final boolean ordered;
private final ExecutorService javaExecutor;
private WorkerExecutor workerExecutor;
final Map<String, Long> finishedProcessedTimeMap = new ConcurrentHashMap<>();
public Pong() {
this.wait = Integer.parseInt(System.getProperty("wait", "-1"));
this.mode = System.getProperty("mode", "default");
this.ordered = Boolean.parseBoolean(System.getProperty("ordered", "true"));
this.javaExecutor = ordered ? Executors.newSingleThreadExecutor() : Executors.newFixedThreadPool(20);
}
public Pong(int wait, String mode, boolean ordered) {
this.wait = wait;
this.mode = mode;
this.ordered = ordered;
this.javaExecutor = ordered ? Executors.newSingleThreadExecutor() : Executors.newFixedThreadPool(20);
}
@Override
public void start() {
workerExecutor = getVertx().createSharedWorkerExecutor("vert.x-new-internal-blocking-thread", 20);
LOG.info("Ordered: {}", ordered);
LOG.info("Wait: {}", wait);
getVertx().eventBus().consumer("table", message -> {
switch (mode) {
case "default":
process(message);
break;
case "block":
getVertx().executeBlocking(future -> {
process(message);
future.complete();
}, ordered, result -> {
});
break;
case "wexec":
workerExecutor.executeBlocking(future -> {
process(message);
future.complete();
}, ordered, result -> {
});
break;
case "jexec":
javaExecutor.execute(() -> process(message));
break;
}
}).completionHandler(event -> {
if (event.failed()) {
LOG.error("{}> failed", name, event.cause());
}
});
}
private void process(Message<Object> message) {
String ball = (String)message.body();
LOG.info("{}> {} recv [{}]", name, ball, LocalTime.now());
process(wait);
LOG.info("{}> {} send [{}]", name, ball, LocalTime.now());
finishedProcessedTimeMap.put(ball, System.currentTimeMillis());
message.reply(ball);
}
private static void process(long millis) {
if(millis >= 0) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
}
}
public static void main(String[] args) {
List<String> myArgs = Arrays.asList(args);
myArgs.add(0, "run");
myArgs.add(1, Pong.class.getName());
Launcher.main(myArgs.toArray(new String[myArgs.size()]));
}
}
| UTF-8 | Java | 3,662 | java | Pong.java | Java | [] | null | [] | package com.tetv.verticles;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Launcher;
import io.vertx.core.WorkerExecutor;
import io.vertx.core.eventbus.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.time.LocalTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class Pong extends AbstractVerticle {
private final static Logger LOG = LoggerFactory.getLogger(Pong.class);
private final String name = System.getProperty("vertx.id", "pong");
private final int wait;
private final String mode;
private final boolean ordered;
private final ExecutorService javaExecutor;
private WorkerExecutor workerExecutor;
final Map<String, Long> finishedProcessedTimeMap = new ConcurrentHashMap<>();
public Pong() {
this.wait = Integer.parseInt(System.getProperty("wait", "-1"));
this.mode = System.getProperty("mode", "default");
this.ordered = Boolean.parseBoolean(System.getProperty("ordered", "true"));
this.javaExecutor = ordered ? Executors.newSingleThreadExecutor() : Executors.newFixedThreadPool(20);
}
public Pong(int wait, String mode, boolean ordered) {
this.wait = wait;
this.mode = mode;
this.ordered = ordered;
this.javaExecutor = ordered ? Executors.newSingleThreadExecutor() : Executors.newFixedThreadPool(20);
}
@Override
public void start() {
workerExecutor = getVertx().createSharedWorkerExecutor("vert.x-new-internal-blocking-thread", 20);
LOG.info("Ordered: {}", ordered);
LOG.info("Wait: {}", wait);
getVertx().eventBus().consumer("table", message -> {
switch (mode) {
case "default":
process(message);
break;
case "block":
getVertx().executeBlocking(future -> {
process(message);
future.complete();
}, ordered, result -> {
});
break;
case "wexec":
workerExecutor.executeBlocking(future -> {
process(message);
future.complete();
}, ordered, result -> {
});
break;
case "jexec":
javaExecutor.execute(() -> process(message));
break;
}
}).completionHandler(event -> {
if (event.failed()) {
LOG.error("{}> failed", name, event.cause());
}
});
}
private void process(Message<Object> message) {
String ball = (String)message.body();
LOG.info("{}> {} recv [{}]", name, ball, LocalTime.now());
process(wait);
LOG.info("{}> {} send [{}]", name, ball, LocalTime.now());
finishedProcessedTimeMap.put(ball, System.currentTimeMillis());
message.reply(ball);
}
private static void process(long millis) {
if(millis >= 0) {
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
throw new IllegalStateException(e);
}
}
}
public static void main(String[] args) {
List<String> myArgs = Arrays.asList(args);
myArgs.add(0, "run");
myArgs.add(1, Pong.class.getName());
Launcher.main(myArgs.toArray(new String[myArgs.size()]));
}
}
| 3,662 | 0.574003 | 0.570726 | 104 | 34.21154 | 24.27672 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.817308 | false | false | 13 |
4f0ba483a3b25e936e35de00674675aeaf363313 | 15,805,479,679,167 | 46946342fed948e9f65e22328d14c8f13b857ae1 | /android-supervisor/src/main/java/com/example/android_supervisor/utils/UnifiedErrorUtil.java | 2fc6be7c53b34ba8ee10957a2b3eb6f606e6b3aa | [] | no_license | UersNOer/AllInLinkApp | https://github.com/UersNOer/AllInLinkApp | a1805816198d12e9d491c8f8af1a58fcc091c4ff | 1a75da52e53921060a934bdb653d29708cb1d87d | refs/heads/master | 2023-07-09T22:48:05.180000 | 2021-08-13T06:59:17 | 2021-08-13T06:59:17 | 394,186,337 | 2 | 0 | null | false | 2021-08-13T06:59:18 | 2021-08-09T07:04:41 | 2021-08-10T00:30:10 | 2021-08-13T06:59:18 | 36,438 | 0 | 0 | 0 | Java | false | false | package com.example.android_supervisor.utils;
import android.content.Context;
import com.bumptech.glide.load.HttpException;
import com.google.gson.JsonSyntaxException;
import java.net.ConnectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
/**
* Created by dw on 2019/8/7.
*/
public class UnifiedErrorUtil {
public static Throwable unifiedError(Throwable e,Context context){
Throwable throwable;
if(e instanceof UnknownHostException || e instanceof HttpException) {
//无网络的情况,或者主机挂掉了。返回,对应消息 Unable to resolve host "m.app.haosou.com": No address associated with hostname
if (!NetworkUtil.isNetAvailable(context)) {
//无网络
throwable = new Throwable("hello?好像没网络啊!",e.getCause());
} else {
//主机挂了,也就是你服务器关了
throwable = new Throwable("服务器开小差,请稍后重试!", e.getCause());
}
} else if(e instanceof ConnectException || e instanceof SocketTimeoutException || e instanceof SocketException){
//连接超时等
throwable = new Throwable("网络连接超时,请检查您的网络状态!", e.getCause());
} else if(e instanceof NumberFormatException || e instanceof IllegalArgumentException || e instanceof JsonSyntaxException){
//也就是后台返回的数据,与你本地定义的Gson类,不一致,导致解析异常 (ps:当然这不能跟客户这么说)
throwable = new Throwable("未能请求到数据,攻城狮正在修复!", e.getCause());
}else{
//其他 未知
throwable = new Throwable("哎呀故障了,攻城狮正在修复!", e.getCause());
}
return throwable;
}
}
| UTF-8 | Java | 1,921 | java | UnifiedErrorUtil.java | Java | [
{
"context": " java.net.UnknownHostException;\n\n/**\n * Created by dw on 2019/8/7.\n */\npublic class UnifiedErrorUtil {\n",
"end": 337,
"score": 0.9803429245948792,
"start": 335,
"tag": "USERNAME",
"value": "dw"
}
] | null | [] | package com.example.android_supervisor.utils;
import android.content.Context;
import com.bumptech.glide.load.HttpException;
import com.google.gson.JsonSyntaxException;
import java.net.ConnectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.net.UnknownHostException;
/**
* Created by dw on 2019/8/7.
*/
public class UnifiedErrorUtil {
public static Throwable unifiedError(Throwable e,Context context){
Throwable throwable;
if(e instanceof UnknownHostException || e instanceof HttpException) {
//无网络的情况,或者主机挂掉了。返回,对应消息 Unable to resolve host "m.app.haosou.com": No address associated with hostname
if (!NetworkUtil.isNetAvailable(context)) {
//无网络
throwable = new Throwable("hello?好像没网络啊!",e.getCause());
} else {
//主机挂了,也就是你服务器关了
throwable = new Throwable("服务器开小差,请稍后重试!", e.getCause());
}
} else if(e instanceof ConnectException || e instanceof SocketTimeoutException || e instanceof SocketException){
//连接超时等
throwable = new Throwable("网络连接超时,请检查您的网络状态!", e.getCause());
} else if(e instanceof NumberFormatException || e instanceof IllegalArgumentException || e instanceof JsonSyntaxException){
//也就是后台返回的数据,与你本地定义的Gson类,不一致,导致解析异常 (ps:当然这不能跟客户这么说)
throwable = new Throwable("未能请求到数据,攻城狮正在修复!", e.getCause());
}else{
//其他 未知
throwable = new Throwable("哎呀故障了,攻城狮正在修复!", e.getCause());
}
return throwable;
}
}
| 1,921 | 0.6584 | 0.654681 | 41 | 38.341465 | 33.916405 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.780488 | false | false | 13 |
8297e3c2c2893c9fbda223edf16be875bf26d0a4 | 12,094,627,940,955 | ed0d1052e4bc078e0bf9378db56385a0865da590 | /src/main/java/com/blastedstudios/freeboot/plugin/quest/trigger/beinghit/BeingHitTrigger.java | 6ee4839fac0d166535c8baef2833bbc19774cafd | [
"MIT"
] | permissive | narfman0/freeboot | https://github.com/narfman0/freeboot | 42b7d5053da6546dd7596483a87c6d59a38844bd | 2b24b056b7b37506f1c20cfa30d2ee0acf9953ba | refs/heads/master | 2020-07-20T12:21:43.051000 | 2016-09-23T03:18:46 | 2016-09-23T03:18:46 | 66,181,193 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.blastedstudios.freeboot.plugin.quest.trigger.beinghit;
import com.blastedstudios.gdxworld.world.quest.trigger.AbstractQuestTrigger;
import com.blastedstudios.freeboot.world.QuestTriggerInformationProvider;
import com.blastedstudios.freeboot.world.weapon.DamageStruct;
public class BeingHitTrigger extends AbstractQuestTrigger implements IBeingHitListener {
private static final long serialVersionUID = 1L;
public static final BeingHitTrigger DEFAULT = new BeingHitTrigger();
private String target = ".*", origin = ".*";
private float damageAmount = -1f, damageRatio = -1f;
private boolean death;
private transient boolean invoked;
public BeingHitTrigger(){}
public BeingHitTrigger(String target, String origin, float damageAmount, float damageRatio, boolean death){
this.target = target;
this.damageAmount = damageAmount;
this.origin = origin;
this.damageRatio = damageRatio;
this.death = death;
}
@Override public boolean activate(float dt) {
((QuestTriggerInformationProvider)getProvider()).addBeingHitListener(this);
return invoked;
}
@Override public AbstractQuestTrigger clone(){
return super.clone(new BeingHitTrigger(target, origin, damageAmount, damageRatio, death));
}
@Override public String toString() {
return "[BeingHitTrigger target:" + target + " damageAmount:" +
damageAmount + " origin:" + origin + "]";
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
public float getDamageAmount() {
return damageAmount;
}
public void setDamageAmount(float damageAmount) {
this.damageAmount = damageAmount;
}
public float getDamageRatio() {
return damageRatio;
}
public void setDamageRatio(float damageRatio) {
this.damageRatio = damageRatio;
}
public boolean isDeath() {
return death;
}
public void setDeath(boolean death) {
this.death = death;
}
@Override public void beingHit(DamageStruct damageStruct) {
float hpAfter = damageStruct.getTarget().getHp() - damageStruct.getDamage(),
dmgRatio = hpAfter / damageStruct.getTarget().getMaxHp();
boolean damageThresholdSatisfied = damageRatio == -1f ? true : dmgRatio < damageRatio;
if(damageStruct.getDamage() >= damageAmount && damageThresholdSatisfied &&
damageStruct.getTarget().getName().matches(target) &&
damageStruct.getOrigin() != null && damageStruct.getOrigin().getName().matches(origin) &&
!death ^ damageStruct.getTarget().getHp() <= 0f)
invoked = true;
}
} | UTF-8 | Java | 2,638 | java | BeingHitTrigger.java | Java | [] | null | [] | package com.blastedstudios.freeboot.plugin.quest.trigger.beinghit;
import com.blastedstudios.gdxworld.world.quest.trigger.AbstractQuestTrigger;
import com.blastedstudios.freeboot.world.QuestTriggerInformationProvider;
import com.blastedstudios.freeboot.world.weapon.DamageStruct;
public class BeingHitTrigger extends AbstractQuestTrigger implements IBeingHitListener {
private static final long serialVersionUID = 1L;
public static final BeingHitTrigger DEFAULT = new BeingHitTrigger();
private String target = ".*", origin = ".*";
private float damageAmount = -1f, damageRatio = -1f;
private boolean death;
private transient boolean invoked;
public BeingHitTrigger(){}
public BeingHitTrigger(String target, String origin, float damageAmount, float damageRatio, boolean death){
this.target = target;
this.damageAmount = damageAmount;
this.origin = origin;
this.damageRatio = damageRatio;
this.death = death;
}
@Override public boolean activate(float dt) {
((QuestTriggerInformationProvider)getProvider()).addBeingHitListener(this);
return invoked;
}
@Override public AbstractQuestTrigger clone(){
return super.clone(new BeingHitTrigger(target, origin, damageAmount, damageRatio, death));
}
@Override public String toString() {
return "[BeingHitTrigger target:" + target + " damageAmount:" +
damageAmount + " origin:" + origin + "]";
}
public String getTarget() {
return target;
}
public void setTarget(String target) {
this.target = target;
}
public String getOrigin() {
return origin;
}
public void setOrigin(String origin) {
this.origin = origin;
}
public float getDamageAmount() {
return damageAmount;
}
public void setDamageAmount(float damageAmount) {
this.damageAmount = damageAmount;
}
public float getDamageRatio() {
return damageRatio;
}
public void setDamageRatio(float damageRatio) {
this.damageRatio = damageRatio;
}
public boolean isDeath() {
return death;
}
public void setDeath(boolean death) {
this.death = death;
}
@Override public void beingHit(DamageStruct damageStruct) {
float hpAfter = damageStruct.getTarget().getHp() - damageStruct.getDamage(),
dmgRatio = hpAfter / damageStruct.getTarget().getMaxHp();
boolean damageThresholdSatisfied = damageRatio == -1f ? true : dmgRatio < damageRatio;
if(damageStruct.getDamage() >= damageAmount && damageThresholdSatisfied &&
damageStruct.getTarget().getName().matches(target) &&
damageStruct.getOrigin() != null && damageStruct.getOrigin().getName().matches(origin) &&
!death ^ damageStruct.getTarget().getHp() <= 0f)
invoked = true;
}
} | 2,638 | 0.742608 | 0.740713 | 88 | 28.988636 | 28.421541 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.818182 | false | false | 13 |
57ab1621a470b1d17c299ebf471a2b419deb4e12 | 3,788,161,194,409 | 55fbacc4e89531be4f6568069fc6d597d55be00d | /KuaiKuai/src/me/kkuai/kuailian/http/request/RoomSignUpRequest.java | 6ed2c9e348015a9921335c8ab35af9642ccdabe3 | [
"Apache-2.0"
] | permissive | jitayangchen/CustomViewGather | https://github.com/jitayangchen/CustomViewGather | 1d89fc984c119d354e9fd8989826ba0a315c7352 | 3a3bccdb5626cf79ab16a2329c433d9a54523688 | refs/heads/master | 2021-05-29T14:56:12.822000 | 2015-06-03T03:40:59 | 2015-06-03T03:40:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package me.kkuai.kuailian.http.request;
import me.kkuai.kuailian.constant.HttpRequestTypeId;
import me.kkuai.kuailian.constant.HttpRequestUrl;
import com.kkuai.libs.managers.J_NetManager;
import com.kkuai.libs.managers.J_NetManager.OnDataBack;
public class RoomSignUpRequest extends K_Request {
public RoomSignUpRequest(OnDataBack callback) {
this.callback = callback;
this.REQUEST_TYPE = HttpRequestTypeId.TASKID_ROOM_SIGN_UP;
this.URL = HttpRequestUrl.ROOM_SIGN_UP;
}
@Override
public OnDataBack getCallback() {
return callback;
}
public void requestRoomSignUp(String roomId, String playTime, String payAbidanceTime, String playContentType, String playContent) {
addParam("roomId", roomId);
addParam("playTime", playTime);
addParam("payAbidanceTime", payAbidanceTime);
addParam("playContentType", playContentType);
addParam("playContent", playContent);
J_NetManager.getInstance().sendUnblockRequest(this);
}
public void requestRoomSignUpNoContent(String roomId, String playTime, String payAbidanceTime, String playContentType) {
addParam("roomId", roomId);
addParam("playTime", playTime);
addParam("payAbidanceTime", payAbidanceTime);
addParam("playContentType", playContentType);
J_NetManager.getInstance().sendUnblockRequest(this);
}
}
| UTF-8 | Java | 1,290 | java | RoomSignUpRequest.java | Java | [] | null | [] | package me.kkuai.kuailian.http.request;
import me.kkuai.kuailian.constant.HttpRequestTypeId;
import me.kkuai.kuailian.constant.HttpRequestUrl;
import com.kkuai.libs.managers.J_NetManager;
import com.kkuai.libs.managers.J_NetManager.OnDataBack;
public class RoomSignUpRequest extends K_Request {
public RoomSignUpRequest(OnDataBack callback) {
this.callback = callback;
this.REQUEST_TYPE = HttpRequestTypeId.TASKID_ROOM_SIGN_UP;
this.URL = HttpRequestUrl.ROOM_SIGN_UP;
}
@Override
public OnDataBack getCallback() {
return callback;
}
public void requestRoomSignUp(String roomId, String playTime, String payAbidanceTime, String playContentType, String playContent) {
addParam("roomId", roomId);
addParam("playTime", playTime);
addParam("payAbidanceTime", payAbidanceTime);
addParam("playContentType", playContentType);
addParam("playContent", playContent);
J_NetManager.getInstance().sendUnblockRequest(this);
}
public void requestRoomSignUpNoContent(String roomId, String playTime, String payAbidanceTime, String playContentType) {
addParam("roomId", roomId);
addParam("playTime", playTime);
addParam("payAbidanceTime", payAbidanceTime);
addParam("playContentType", playContentType);
J_NetManager.getInstance().sendUnblockRequest(this);
}
}
| 1,290 | 0.784496 | 0.784496 | 39 | 32.076923 | 30.376598 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false | 13 |
1ab553d5def4d49ea5afb932f0e28958ff71018c | 3,788,161,193,275 | 7118b5e438fe0f81ed2cfbef5ed68f5c0eaadcb3 | /qinyuan-lib-lang/src/test/java/com/qinyuan/lib/lang/concurrent/SuspendableThreadTest.java | b4434a54f56f8ba3a6d3f1d9a0456108bb0512ae | [] | no_license | qinyuan/qinyuan-lib | https://github.com/qinyuan/qinyuan-lib | c09a06287f67c9ae94a53a989881cf2c6fa8827b | 7e7b3fe6eb5f46894cd35d9a50f512691b874e6c | refs/heads/master | 2021-01-17T09:09:41.738000 | 2016-03-26T03:36:15 | 2016-03-26T03:36:15 | 41,036,155 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qinyuan.lib.lang.concurrent;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test SuspendableThread
* Created by qinyuan on 15-5-16.
*/
public class SuspendableThreadTest {
private boolean running = false;
@Test
public void testRunJob() throws Exception {
TestThread testThread = new TestThread();
testThread.start();
ThreadUtils.sleep(2);
assertThat(running).isFalse();
testThread.setRunning(true);
ThreadUtils.sleep(2);
assertThat(running).isTrue();
}
private class TestThread extends SuspendableThread {
TestThread() {
setUpdateInterval(1);
}
@Override
protected void runJob() {
running = true;
}
}
}
| UTF-8 | Java | 810 | java | SuspendableThreadTest.java | Java | [
{
"context": "That;\n\n/**\n * Test SuspendableThread\n * Created by qinyuan on 15-5-16.\n */\npublic class SuspendableThreadTes",
"end": 176,
"score": 0.9996781945228577,
"start": 169,
"tag": "USERNAME",
"value": "qinyuan"
}
] | null | [] | package com.qinyuan.lib.lang.concurrent;
import org.junit.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Test SuspendableThread
* Created by qinyuan on 15-5-16.
*/
public class SuspendableThreadTest {
private boolean running = false;
@Test
public void testRunJob() throws Exception {
TestThread testThread = new TestThread();
testThread.start();
ThreadUtils.sleep(2);
assertThat(running).isFalse();
testThread.setRunning(true);
ThreadUtils.sleep(2);
assertThat(running).isTrue();
}
private class TestThread extends SuspendableThread {
TestThread() {
setUpdateInterval(1);
}
@Override
protected void runJob() {
running = true;
}
}
}
| 810 | 0.625926 | 0.616049 | 37 | 20.891891 | 17.818581 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.351351 | false | false | 13 |
916e46960985447d03fd486d0b574324e07847b4 | 3,229,815,442,156 | d2f43b14be8b38c8b92b5d5b9201af43c39708f6 | /MJPayCore/src/main/java/com/mujin/response/ResponseUtils.java | f0bfea62b29a0e23516abbe6a12dac05c5955a46 | [] | no_license | summer-clt/MJPay | https://github.com/summer-clt/MJPay | 5f0212b108c2575eb04fdb6e9871c9078c32d9dd | 3297b74f2d2e3d24c468049ca42c25017c5844e3 | refs/heads/main | 2023-04-03T18:11:09.930000 | 2021-03-22T08:43:03 | 2021-03-22T08:43:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.mujin.response;
public final class ResponseUtils {
/**
*
* @Title:
* @Description:
*/
private ResponseUtils() {
}
/**
*
* @Title success
* @Description 成功有返回值
* @param <T> 泛型对象
* @param data 数据
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> success(T data) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg("OK");
result.setResData(data);
return result;
}
/**
* @Title success
* @Description 成功有返回值,有返回消息
* @param <T>
* @param data
* @param msg
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> success(T data,String msg) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg(msg);
result.setResData(data);
return result;
}
/**
* @Title successMsg
* @Description 成功无返回值,有返回消息
* @param <T>
* @param msg
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> successMsg(String msg) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg(msg);
result.setResData(null);
return result;
}
/**
*
* @Title success
* @param <T> 泛型对象
* @Description 成功无返回值
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> success() {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg("OK");
return result;
}
/**
*
* @Title fail
* @Description 错误返回
* @param <T> 泛型对象
* @param errCode 错误代码
* @param errMsg 错误信息
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> fail(int errCode, String errMsg) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(errCode);
result.setResMsg(errMsg);
return result;
}
}
| UTF-8 | Java | 2,209 | java | ResponseUtils.java | Java | [
{
"context": "data 数据\n\t * @return ResponseResult<T>\n\t * @author 伍成林\n\t * @date 2021年03月15日\n\t */\n\tpublic static <T> Res",
"end": 278,
"score": 0.9989761114120483,
"start": 275,
"tag": "NAME",
"value": "伍成林"
},
{
"context": " @return\n\t* @return ResponseResult<T>\n\t * @autho... | null | [] | package com.mujin.response;
public final class ResponseUtils {
/**
*
* @Title:
* @Description:
*/
private ResponseUtils() {
}
/**
*
* @Title success
* @Description 成功有返回值
* @param <T> 泛型对象
* @param data 数据
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> success(T data) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg("OK");
result.setResData(data);
return result;
}
/**
* @Title success
* @Description 成功有返回值,有返回消息
* @param <T>
* @param data
* @param msg
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> success(T data,String msg) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg(msg);
result.setResData(data);
return result;
}
/**
* @Title successMsg
* @Description 成功无返回值,有返回消息
* @param <T>
* @param msg
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> successMsg(String msg) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg(msg);
result.setResData(null);
return result;
}
/**
*
* @Title success
* @param <T> 泛型对象
* @Description 成功无返回值
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> success() {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(0);
result.setResMsg("OK");
return result;
}
/**
*
* @Title fail
* @Description 错误返回
* @param <T> 泛型对象
* @param errCode 错误代码
* @param errMsg 错误信息
* @return
* @return ResponseResult<T>
* @author 伍成林
* @date 2021年03月15日
*/
public static <T> ResponseResult<T> fail(int errCode, String errMsg) {
ResponseResult<T> result = new ResponseResult<T>();
result.setResCode(errCode);
result.setResMsg(errMsg);
return result;
}
}
| 2,209 | 0.652346 | 0.630617 | 104 | 18.471153 | 15.574237 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.365385 | false | false | 13 |
b81f416e3bd0378a559da1d4e364bce32c1cefee | 19,481,971,690,998 | 5d95c3c20a1901c0b769929fa56f8f1ee376685c | /src/ConfigurationPattern/ReturnContain.java | 55308f8cfe844fab682b014de28696394d8c0cb5 | [] | no_license | 13817094576/PluginInspector | https://github.com/13817094576/PluginInspector | b780e27b7f4ae53a4796ee817f6b684095477270 | 91d877c0b5692fa02486512f3c8a95ea725601f4 | refs/heads/master | 2021-03-08T19:33:32.140000 | 2016-05-26T11:21:24 | 2016-05-26T11:21:24 | 59,643,888 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ConfigurationPattern;
/**
* 确认函数的返回值是否包含某个值,目前只限于检测boolean(true或 false)
* @author zxl
*
*/
public class ReturnContain extends ConfigurationPattern{
private boolean booleanValue;
private boolean isMust=false;
private int mode=-1;
private String PROP_MUST="must";
public ReturnContain(Object v){
if(v instanceof Boolean){
booleanValue=(boolean)(v);
mode=1;
}
}
public ReturnContain(Object v,String string){
if(v instanceof Boolean){
booleanValue=(boolean)(v);
mode=1;
if(string.equals(PROP_MUST))
this.isMust=true;
}
}
public Object getReturnValue(){
switch(mode){
case 1: return booleanValue;
}
return null;
}
public String toString(){
return getReturnValue().toString();
}
public boolean isMust(){
return this.isMust;
}
}
| GB18030 | Java | 847 | java | ReturnContain.java | Java | [
{
"context": "的返回值是否包含某个值,目前只限于检测boolean(true或 false)\n * @author zxl\n *\n */\npublic class ReturnContain extends Configu",
"end": 95,
"score": 0.9996166229248047,
"start": 92,
"tag": "USERNAME",
"value": "zxl"
}
] | null | [] | package ConfigurationPattern;
/**
* 确认函数的返回值是否包含某个值,目前只限于检测boolean(true或 false)
* @author zxl
*
*/
public class ReturnContain extends ConfigurationPattern{
private boolean booleanValue;
private boolean isMust=false;
private int mode=-1;
private String PROP_MUST="must";
public ReturnContain(Object v){
if(v instanceof Boolean){
booleanValue=(boolean)(v);
mode=1;
}
}
public ReturnContain(Object v,String string){
if(v instanceof Boolean){
booleanValue=(boolean)(v);
mode=1;
if(string.equals(PROP_MUST))
this.isMust=true;
}
}
public Object getReturnValue(){
switch(mode){
case 1: return booleanValue;
}
return null;
}
public String toString(){
return getReturnValue().toString();
}
public boolean isMust(){
return this.isMust;
}
}
| 847 | 0.703145 | 0.698113 | 42 | 17.928572 | 15.063979 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.714286 | false | false | 13 |
d1334d144f7953dbeee8e7b2e141393441f56c8c | 15,238,544,007,754 | a4cf7283d5cffd0ccf6bb25df8b03156da738cca | /app/src/main/java/com/changlg/cn/newknowledge/gson/entity/FormData.java | 29ee1c85bcc6cbf62c57cc4c5bbd095b1fbecf58 | [] | no_license | changliugang/NewKnowledge | https://github.com/changliugang/NewKnowledge | 81aece5e8fa99b6825e5abc55b7117a313056cb7 | 3cc6d43e02c446581547c7f0080025456e4d0edd | refs/heads/master | 2021-01-17T17:31:43.808000 | 2016-06-26T12:26:56 | 2016-06-26T12:26:56 | 56,497,177 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.changlg.cn.newknowledge.gson.entity;
import java.util.List;
/**
* Created by chang on 2016/4/20.
*/
public class FormData {
private String formName;
private List formData;
public String getFormName() {
return formName;
}
public void setFormName(String formName) {
this.formName = formName;
}
public List getFormData() {
return formData;
}
public void setFormData(List formData) {
this.formData = formData;
}
}
| UTF-8 | Java | 505 | java | FormData.java | Java | [
{
"context": "entity;\n\nimport java.util.List;\n\n/**\n * Created by chang on 2016/4/20.\n */\npublic class FormData {\n\n pr",
"end": 97,
"score": 0.7480342388153076,
"start": 92,
"tag": "USERNAME",
"value": "chang"
}
] | null | [] | package com.changlg.cn.newknowledge.gson.entity;
import java.util.List;
/**
* Created by chang on 2016/4/20.
*/
public class FormData {
private String formName;
private List formData;
public String getFormName() {
return formName;
}
public void setFormName(String formName) {
this.formName = formName;
}
public List getFormData() {
return formData;
}
public void setFormData(List formData) {
this.formData = formData;
}
}
| 505 | 0.635644 | 0.621782 | 30 | 15.833333 | 16.223612 | 48 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false | 13 |
b53124bc966bdd7ded79014b182ac936439d5e48 | 12,721,693,134,195 | 9d562f1b28789c21770c58bd31cec725573a0e12 | /TDDD93_projekt_visualize_data/src/com/company/Randomizer.java | 2b40909954aa770f4210701466e7103914bac78c | [] | no_license | zacno/TDDD93_projekt_visualize_data | https://github.com/zacno/TDDD93_projekt_visualize_data | e69718257f0ad121f5cf66b5207e73c71f597115 | 76a0fc8dbadfa3cc821b1c9d7db5bd40ad567df0 | refs/heads/master | 2021-06-17T00:13:10.252000 | 2017-05-08T11:58:38 | 2017-05-08T11:58:38 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.company;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Random;
public class Randomizer
{
Randomizer() {
}
public void generate() {
try {
PrintWriter writer = new PrintWriter("/home/zacno594/liu/tddd93/TDDD93_projekt_visualize_data/src/com/company/random" , "UTF-8");
Random random = new Random();
//writer.println("1.0.4.0");
//writer.println("22");
for (int i = 0; i < 100000; i++) {
for (int j = 0; j < 6; j++) {
writer.print(random.nextInt(10000) + " ");
}
writer.println();
}
writer.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
| UTF-8 | Java | 806 | java | Randomizer.java | Java | [
{
"context": "\n\t PrintWriter writer = new PrintWriter(\"/home/zacno594/liu/tddd93/TDDD93_projekt_visualize_data/src/com/",
"end": 304,
"score": 0.9731371998786926,
"start": 296,
"tag": "USERNAME",
"value": "zacno594"
}
] | null | [] | package com.company;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Random;
public class Randomizer
{
Randomizer() {
}
public void generate() {
try {
PrintWriter writer = new PrintWriter("/home/zacno594/liu/tddd93/TDDD93_projekt_visualize_data/src/com/company/random" , "UTF-8");
Random random = new Random();
//writer.println("1.0.4.0");
//writer.println("22");
for (int i = 0; i < 100000; i++) {
for (int j = 0; j < 6; j++) {
writer.print(random.nextInt(10000) + " ");
}
writer.println();
}
writer.flush();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
}
| 806 | 0.635236 | 0.600496 | 32 | 24.1875 | 24.555342 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.25 | false | false | 13 |
d84ef159cd3bfe799f67dc556edaaa50acf303ea | 34,076,270,541,639 | 6634adc46da8067bbfb262161105cb76eda6955e | /src/test/java/pro/mikhail/learnsomejava/controller/DogControllerMockMVCTest.java | 3e5ca7c285ef2f89230857b6a16a89d754d5eb74 | [
"MIT"
] | permissive | promihu/LearnSomeJava | https://github.com/promihu/LearnSomeJava | e5f2229cedc509bccec51a1d08583a3d98d42974 | 44004b9439abe71e0313aa3f31ecaeb618a49597 | refs/heads/master | 2021-01-18T22:30:22.266000 | 2016-11-09T14:23:32 | 2016-11-09T14:23:32 | 64,317,284 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pro.mikhail.learnsomejava.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import pro.mikhail.learnsomejava.dao.DogDaoInMemory;
import pro.mikhail.learnsomejava.model.Dog;
import pro.mikhail.learnsomejava.service.DogService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.unitils.reflectionassert.ReflectionAssert.assertReflectionEquals;
//MockHttpServletRequestBuilder
/**
* Created by Mikhail_Prosuntsov on 9/19/2016.
*/
@ContextConfiguration(locations = "classpath:/mockcontext.xml")
@WebAppConfiguration
public class DogControllerMockMVCTest extends AbstractTestNGSpringContextTests {
@Autowired
WebApplicationContext wac;
@Autowired
MockHttpServletRequest request;
@Autowired
DogController dogController;
@Autowired
DogService dogService;
private MockMvc mockMvc;
@BeforeMethod
public void setup() {
mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
}
@Test
public void shouldReturnAllDogs() throws Exception {
mockMvc.perform(get("/dog"))
.andExpect(status().isOk());
}
//post tests
@Test
public void addDogShouldReturnNoError()throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(), "Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
}
@Test
public void shouldAddDogGetDog() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString()
;
Dog receivedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(testDog, receivedDog);
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
}
//get tests
@Test
public void shouldReturnErrorIfNoDogToGet() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
//test get
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isNotFound())
.andReturn().getResponse().getContentAsString()
;
}
//put tests
@Test
public void shouldUpdateDog() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(), "shouldGetDog", "10/01/1981", 10, 20);
Dog oldNewDog = new Dog(DogDaoInMemory.generateNextId(),"shouldUpdateDog", "10/01/1981", 1, 2);
//add dog
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
//update the dog
result = mockMvc
.perform(put(addedDogAddress)
.content(asJsonString(oldNewDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
//check dog is updated
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString()
;
Dog receivedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(oldNewDog, receivedDog);
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
}
@Test
public void shouldReturnErrorIfNoDogToUpdate() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(), "shouldGetDog", "10/01/1981", 10, 20);
Dog oldNewDog = new Dog(DogDaoInMemory.generateNextId(),"shouldUpdateDog", "10/01/1981", 1, 2);
//add dog
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
//update the dog
result = mockMvc
.perform(put(addedDogAddress)
.content(asJsonString(oldNewDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isNotFound());
}
//delete tests
@Test
public void shouldDeleteDog() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString()
;
Dog receivedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(testDog, receivedDog);
//delete the dog
returnedDogString = mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString();
;
Dog deletedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(testDog, deletedDog);
}
@Test
public void shouldReturnErrorIfNoDogToDelete() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk())
;
;
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isNotFound())
;
;
}
private static String asJsonString(final Object obj) {
try {
final ObjectMapper mapper = new ObjectMapper();
final String jsonContent = mapper.writeValueAsString(obj);
return jsonContent;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | UTF-8 | Java | 9,523 | java | DogControllerMockMVCTest.java | Java | [
{
"context": "//MockHttpServletRequestBuilder\n\n/**\n * Created by Mikhail_Prosuntsov on 9/19/2016.\n */\n\n@ContextConfiguration(location",
"end": 1271,
"score": 0.9994062185287476,
"start": 1253,
"tag": "NAME",
"value": "Mikhail_Prosuntsov"
},
{
"context": "estDog = new Dog(DogDao... | null | [] | package pro.mikhail.learnsomejava.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import pro.mikhail.learnsomejava.dao.DogDaoInMemory;
import pro.mikhail.learnsomejava.model.Dog;
import pro.mikhail.learnsomejava.service.DogService;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import static org.unitils.reflectionassert.ReflectionAssert.assertReflectionEquals;
//MockHttpServletRequestBuilder
/**
* Created by Mikhail_Prosuntsov on 9/19/2016.
*/
@ContextConfiguration(locations = "classpath:/mockcontext.xml")
@WebAppConfiguration
public class DogControllerMockMVCTest extends AbstractTestNGSpringContextTests {
@Autowired
WebApplicationContext wac;
@Autowired
MockHttpServletRequest request;
@Autowired
DogController dogController;
@Autowired
DogService dogService;
private MockMvc mockMvc;
@BeforeMethod
public void setup() {
mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
}
@Test
public void shouldReturnAllDogs() throws Exception {
mockMvc.perform(get("/dog"))
.andExpect(status().isOk());
}
//post tests
@Test
public void addDogShouldReturnNoError()throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(), "Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
}
@Test
public void shouldAddDogGetDog() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString()
;
Dog receivedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(testDog, receivedDog);
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
}
//get tests
@Test
public void shouldReturnErrorIfNoDogToGet() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
//test get
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isNotFound())
.andReturn().getResponse().getContentAsString()
;
}
//put tests
@Test
public void shouldUpdateDog() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(), "shouldGetDog", "10/01/1981", 10, 20);
Dog oldNewDog = new Dog(DogDaoInMemory.generateNextId(),"shouldUpdateDog", "10/01/1981", 1, 2);
//add dog
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
//update the dog
result = mockMvc
.perform(put(addedDogAddress)
.content(asJsonString(oldNewDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
//check dog is updated
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString()
;
Dog receivedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(oldNewDog, receivedDog);
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
}
@Test
public void shouldReturnErrorIfNoDogToUpdate() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(), "shouldGetDog", "10/01/1981", 10, 20);
Dog oldNewDog = new Dog(DogDaoInMemory.generateNextId(),"shouldUpdateDog", "10/01/1981", 1, 2);
//add dog
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk());
;
//update the dog
result = mockMvc
.perform(put(addedDogAddress)
.content(asJsonString(oldNewDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isNotFound());
}
//delete tests
@Test
public void shouldDeleteDog() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
ObjectMapper mapper = new ObjectMapper();
String returnedDogString = mockMvc
.perform(get(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString()
;
Dog receivedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(testDog, receivedDog);
//delete the dog
returnedDogString = mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk())
.andReturn().getResponse().getContentAsString();
;
Dog deletedDog = mapper.readValue(returnedDogString ,Dog.class);
assertReflectionEquals(testDog, deletedDog);
}
@Test
public void shouldReturnErrorIfNoDogToDelete() throws Exception {
Dog testDog = new Dog(DogDaoInMemory.generateNextId(),"Test1", "10/01/1981", 10, 20);
ResultActions result = mockMvc
.perform(post("/dog")
.content(asJsonString(testDog))
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated());
String addedDogAddress = result.andReturn().getResponse().getHeader("Location");
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isOk())
;
;
//delete the dog
mockMvc.perform(delete(addedDogAddress))
.andExpect(status().isNotFound())
;
;
}
private static String asJsonString(final Object obj) {
try {
final ObjectMapper mapper = new ObjectMapper();
final String jsonContent = mapper.writeValueAsString(obj);
return jsonContent;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
} | 9,523 | 0.623123 | 0.610942 | 303 | 30.432343 | 28.643154 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.435644 | false | false | 13 |
54529304d845d5bae71b25ef15c6c39e9855963e | 31,061,203,553,801 | a30182e39e8308690bc236b6a0d143ffdf2b3dd9 | /ASM_DAO/src/Form/TongHopThongKe.java | 55dfad9bdba1fa08f88eb6549325a634ce74209c | [] | no_license | TrungHieuhnt123/Du_An_Mau | https://github.com/TrungHieuhnt123/Du_An_Mau | 557d8668da04b821fab62ede048c5cb9961f3d9a | b232918ac38b5808d85aa7810deb2d5bf99c0862 | refs/heads/master | 2023-02-21T01:04:01.387000 | 2021-01-26T12:25:11 | 2021-01-26T12:25:11 | 333,074,885 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Form;
import DAO.ThongKeDAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Laptop88
*/
public class TongHopThongKe extends javax.swing.JInternalFrame {
Connection cn;
ThongKeDAO dao = new ThongKeDAO();
DefaultTableModel modelNguoiHoc;
DefaultTableModel modelBangDiem, modelDoanhThu, modelTongHop;
public TongHopThongKe(String a) throws SQLException {
cn = Helpers.Helper.KetNoi();
initComponents();
BangNguoiHoc();
BangDoanhThu();
BangDiem();
BangTongHop();
//
loadComBoboxKH();
loadComBoBoxDoanhThu();
//
loadTableBangDiem();
loadTableNguoiHoc();
loadTableDiemChuyenDe();
loadTableDoanhThu();
if (a.equalsIgnoreCase("NguoiHoc")) {
form.setSelectedComponent(NguoiHoc);
}
if (a.equalsIgnoreCase("ChuyenDe")) {
form.setSelectedComponent(TongHop);
}
if (a.equalsIgnoreCase("BangDiem")) {
form.setSelectedComponent(BangDiem);
}
if(a.equalsIgnoreCase("DoanhThu")){
form.setSelectedComponent(DoanhThu);
}
}
public void BangNguoiHoc() {
String header[] = {"Năm", "Số người học", "Ngày đầu tiên ĐK", "Ngày cuối cùng"};
String data[][] = null;
modelNguoiHoc = new DefaultTableModel(data, header);
tblNguoiHoc.setModel(modelNguoiHoc);
}
public void BangDiem() {
String header[] = {"Mã Người học", "Họ và tên", "Điểm ", "xếp loại"};
String data[][] = null;
modelBangDiem = new DefaultTableModel(data, header);
tblBangDiem.setModel(modelBangDiem);
}
public void BangTongHop() {
String header[] = {"Chuyên đề", "Tổng số HV", "Cao nhất", "Thấp nhất", "Điểm TB"};
String data[][] = null;
modelTongHop = new DefaultTableModel(data, header);
tblTongHop.setModel(modelTongHop);
}
public void BangDoanhThu() {
String header[] = {"chuyên đề", "KHóa Học", "Số HV", "Doanh thu", "Học phí Max", "Học phí Min", "Học phí TB"};
String data[][] = null;
modelDoanhThu = new DefaultTableModel(data, header);
tblDoanhThu.setModel(modelDoanhThu);
}
public void loadComBoboxKH() {
try {
String sql = "select * from KhoaHoc";
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while (rs.next()) {
cboKhoaHoc.addItem(rs.getString(1));
}
st.close();
rs.close();
} catch (Exception e) {
}
}
//
public void loadComBoBoxDoanhThu() {
try {
String sql = "select DISTINCT(year(NgayKhaiGiang)) from KhoaHoc";
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
cboDoanhThu.addItem(rs.getString(1));
}
rs.close();
st.close();
} catch (Exception e) {
}
}
//
public void loadTableBangDiem() throws SQLException {
List<Object[]> listBD = new ArrayList<>();
listBD = dao.BangDiem(Integer.parseInt((String) cboKhoaHoc.getSelectedItem()));
modelBangDiem.setRowCount(0);
for(Object[] x: listBD){
modelBangDiem.addRow(x);
}
}
// load lên bảng người học bằng cách gọi hàm thủ tục sp_LuongNguoiHoc
public void loadTableNguoiHoc() throws SQLException {
List<Object[]> listLNgH = new ArrayList<>();
listLNgH = dao.LuongNguoiHoc();
modelNguoiHoc.setRowCount(0);
for(Object[] x: listLNgH){
modelNguoiHoc.addRow(x);
}
}
public void loadTableDiemChuyenDe() throws SQLException {
List<Object[]> ListCd = new ArrayList<>();
ListCd = dao.TongHop();
modelTongHop.setRowCount(0);
for(Object[] x: ListCd){
modelTongHop.addRow(x);
}
}
//
public void loadTableDoanhThu() throws SQLException {
List<Object[]> list = new ArrayList<>();
list = dao.DoanhThu(Integer.parseInt((String) cboDoanhThu.getSelectedItem()));
modelDoanhThu.setRowCount(0);
for(Object[] x: list){
modelDoanhThu.addRow(x);
}
}
public void LoadComBoBox(){
try {
String sql = "select DISTINCT(year(NgayKhaiGiang)) from KhoaHoc";
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
cboDoanhThu.setSelectedItem(rs.getString(1));
}
rs.close();
st.close();
} catch (Exception e) {
}
}
/**
* 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();
form = new javax.swing.JTabbedPane();
NguoiHoc = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
tblNguoiHoc = new javax.swing.JTable();
BangDiem = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
tblBangDiem = new javax.swing.JTable();
jLabel2 = new javax.swing.JLabel();
cboKhoaHoc = new javax.swing.JComboBox<>();
TongHop = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
tblTongHop = new javax.swing.JTable();
DoanhThu = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tblDoanhThu = new javax.swing.JTable();
jLabel3 = new javax.swing.JLabel();
cboDoanhThu = new javax.swing.JComboBox<>();
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setForeground(new java.awt.Color(0, 0, 204));
jLabel1.setText("TỔNG HỢP THỐNG KÊ");
tblNguoiHoc.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane4.setViewportView(tblNguoiHoc);
javax.swing.GroupLayout NguoiHocLayout = new javax.swing.GroupLayout(NguoiHoc);
NguoiHoc.setLayout(NguoiHocLayout);
NguoiHocLayout.setHorizontalGroup(
NguoiHocLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
);
NguoiHocLayout.setVerticalGroup(
NguoiHocLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 551, Short.MAX_VALUE)
);
form.addTab("Người học", NguoiHoc);
tblBangDiem.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane3.setViewportView(tblBangDiem);
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N
jLabel2.setText("KHÓA HỌC:");
cboKhoaHoc.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
cboKhoaHocItemStateChanged(evt);
}
});
javax.swing.GroupLayout BangDiemLayout = new javax.swing.GroupLayout(BangDiem);
BangDiem.setLayout(BangDiemLayout);
BangDiemLayout.setHorizontalGroup(
BangDiemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
.addGroup(BangDiemLayout.createSequentialGroup()
.addGap(53, 53, 53)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39)
.addComponent(cboKhoaHoc, javax.swing.GroupLayout.PREFERRED_SIZE, 792, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
BangDiemLayout.setVerticalGroup(
BangDiemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, BangDiemLayout.createSequentialGroup()
.addGroup(BangDiemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cboKhoaHoc, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE))
);
form.addTab("Bảng điểm", BangDiem);
tblTongHop.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(tblTongHop);
javax.swing.GroupLayout TongHopLayout = new javax.swing.GroupLayout(TongHop);
TongHop.setLayout(TongHopLayout);
TongHopLayout.setHorizontalGroup(
TongHopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
);
TongHopLayout.setVerticalGroup(
TongHopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 551, Short.MAX_VALUE)
);
form.addTab("Tổng hợp điểm ", TongHop);
tblDoanhThu.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tblDoanhThu);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N
jLabel3.setText("NĂM:");
cboDoanhThu.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
cboDoanhThuItemStateChanged(evt);
}
});
cboDoanhThu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cboDoanhThuActionPerformed(evt);
}
});
javax.swing.GroupLayout DoanhThuLayout = new javax.swing.GroupLayout(DoanhThu);
DoanhThu.setLayout(DoanhThuLayout);
DoanhThuLayout.setHorizontalGroup(
DoanhThuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
.addGroup(DoanhThuLayout.createSequentialGroup()
.addGap(59, 59, 59)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39)
.addComponent(cboDoanhThu, javax.swing.GroupLayout.PREFERRED_SIZE, 786, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
DoanhThuLayout.setVerticalGroup(
DoanhThuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(DoanhThuLayout.createSequentialGroup()
.addGroup(DoanhThuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cboDoanhThu, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 503, javax.swing.GroupLayout.PREFERRED_SIZE))
);
form.addTab("Doanh thu", DoanhThu);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(form)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(form))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void cboKhoaHocItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboKhoaHocItemStateChanged
// TODO add your handling code here:
try {
loadTableBangDiem();
} catch (Exception e) {
}
}//GEN-LAST:event_cboKhoaHocItemStateChanged
private void cboDoanhThuItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboDoanhThuItemStateChanged
// TODO add your handling code here:
try {
loadTableDoanhThu();
} catch (Exception e) {
}
}//GEN-LAST:event_cboDoanhThuItemStateChanged
private void cboDoanhThuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboDoanhThuActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cboDoanhThuActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel BangDiem;
private javax.swing.JPanel DoanhThu;
private javax.swing.JPanel NguoiHoc;
private javax.swing.JPanel TongHop;
private javax.swing.JComboBox<String> cboDoanhThu;
private javax.swing.JComboBox<String> cboKhoaHoc;
private javax.swing.JTabbedPane form;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTable tblBangDiem;
private javax.swing.JTable tblDoanhThu;
private javax.swing.JTable tblNguoiHoc;
private javax.swing.JTable tblTongHop;
// End of variables declaration//GEN-END:variables
}
| UTF-8 | Java | 16,379 | java | TongHopThongKe.java | Java | [
{
"context": ".swing.table.DefaultTableModel;\n\n/**\n *\n * @author Laptop88\n */\npublic class TongHopThongKe extends javax.swi",
"end": 541,
"score": 0.9994971752166748,
"start": 533,
"tag": "USERNAME",
"value": "Laptop88"
}
] | null | [] | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Form;
import DAO.ThongKeDAO;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.sql.Date;
import java.sql.SQLException;
import java.util.List;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Laptop88
*/
public class TongHopThongKe extends javax.swing.JInternalFrame {
Connection cn;
ThongKeDAO dao = new ThongKeDAO();
DefaultTableModel modelNguoiHoc;
DefaultTableModel modelBangDiem, modelDoanhThu, modelTongHop;
public TongHopThongKe(String a) throws SQLException {
cn = Helpers.Helper.KetNoi();
initComponents();
BangNguoiHoc();
BangDoanhThu();
BangDiem();
BangTongHop();
//
loadComBoboxKH();
loadComBoBoxDoanhThu();
//
loadTableBangDiem();
loadTableNguoiHoc();
loadTableDiemChuyenDe();
loadTableDoanhThu();
if (a.equalsIgnoreCase("NguoiHoc")) {
form.setSelectedComponent(NguoiHoc);
}
if (a.equalsIgnoreCase("ChuyenDe")) {
form.setSelectedComponent(TongHop);
}
if (a.equalsIgnoreCase("BangDiem")) {
form.setSelectedComponent(BangDiem);
}
if(a.equalsIgnoreCase("DoanhThu")){
form.setSelectedComponent(DoanhThu);
}
}
public void BangNguoiHoc() {
String header[] = {"Năm", "Số người học", "Ngày đầu tiên ĐK", "Ngày cuối cùng"};
String data[][] = null;
modelNguoiHoc = new DefaultTableModel(data, header);
tblNguoiHoc.setModel(modelNguoiHoc);
}
public void BangDiem() {
String header[] = {"Mã Người học", "Họ và tên", "Điểm ", "xếp loại"};
String data[][] = null;
modelBangDiem = new DefaultTableModel(data, header);
tblBangDiem.setModel(modelBangDiem);
}
public void BangTongHop() {
String header[] = {"Chuyên đề", "Tổng số HV", "Cao nhất", "Thấp nhất", "Điểm TB"};
String data[][] = null;
modelTongHop = new DefaultTableModel(data, header);
tblTongHop.setModel(modelTongHop);
}
public void BangDoanhThu() {
String header[] = {"chuyên đề", "KHóa Học", "Số HV", "Doanh thu", "Học phí Max", "Học phí Min", "Học phí TB"};
String data[][] = null;
modelDoanhThu = new DefaultTableModel(data, header);
tblDoanhThu.setModel(modelDoanhThu);
}
public void loadComBoboxKH() {
try {
String sql = "select * from KhoaHoc";
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while (rs.next()) {
cboKhoaHoc.addItem(rs.getString(1));
}
st.close();
rs.close();
} catch (Exception e) {
}
}
//
public void loadComBoBoxDoanhThu() {
try {
String sql = "select DISTINCT(year(NgayKhaiGiang)) from KhoaHoc";
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
cboDoanhThu.addItem(rs.getString(1));
}
rs.close();
st.close();
} catch (Exception e) {
}
}
//
public void loadTableBangDiem() throws SQLException {
List<Object[]> listBD = new ArrayList<>();
listBD = dao.BangDiem(Integer.parseInt((String) cboKhoaHoc.getSelectedItem()));
modelBangDiem.setRowCount(0);
for(Object[] x: listBD){
modelBangDiem.addRow(x);
}
}
// load lên bảng người học bằng cách gọi hàm thủ tục sp_LuongNguoiHoc
public void loadTableNguoiHoc() throws SQLException {
List<Object[]> listLNgH = new ArrayList<>();
listLNgH = dao.LuongNguoiHoc();
modelNguoiHoc.setRowCount(0);
for(Object[] x: listLNgH){
modelNguoiHoc.addRow(x);
}
}
public void loadTableDiemChuyenDe() throws SQLException {
List<Object[]> ListCd = new ArrayList<>();
ListCd = dao.TongHop();
modelTongHop.setRowCount(0);
for(Object[] x: ListCd){
modelTongHop.addRow(x);
}
}
//
public void loadTableDoanhThu() throws SQLException {
List<Object[]> list = new ArrayList<>();
list = dao.DoanhThu(Integer.parseInt((String) cboDoanhThu.getSelectedItem()));
modelDoanhThu.setRowCount(0);
for(Object[] x: list){
modelDoanhThu.addRow(x);
}
}
public void LoadComBoBox(){
try {
String sql = "select DISTINCT(year(NgayKhaiGiang)) from KhoaHoc";
Statement st = cn.createStatement();
ResultSet rs = st.executeQuery(sql);
while(rs.next()){
cboDoanhThu.setSelectedItem(rs.getString(1));
}
rs.close();
st.close();
} catch (Exception e) {
}
}
/**
* 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();
form = new javax.swing.JTabbedPane();
NguoiHoc = new javax.swing.JPanel();
jScrollPane4 = new javax.swing.JScrollPane();
tblNguoiHoc = new javax.swing.JTable();
BangDiem = new javax.swing.JPanel();
jScrollPane3 = new javax.swing.JScrollPane();
tblBangDiem = new javax.swing.JTable();
jLabel2 = new javax.swing.JLabel();
cboKhoaHoc = new javax.swing.JComboBox<>();
TongHop = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
tblTongHop = new javax.swing.JTable();
DoanhThu = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
tblDoanhThu = new javax.swing.JTable();
jLabel3 = new javax.swing.JLabel();
cboDoanhThu = new javax.swing.JComboBox<>();
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setForeground(new java.awt.Color(0, 0, 204));
jLabel1.setText("TỔNG HỢP THỐNG KÊ");
tblNguoiHoc.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane4.setViewportView(tblNguoiHoc);
javax.swing.GroupLayout NguoiHocLayout = new javax.swing.GroupLayout(NguoiHoc);
NguoiHoc.setLayout(NguoiHocLayout);
NguoiHocLayout.setHorizontalGroup(
NguoiHocLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
);
NguoiHocLayout.setVerticalGroup(
NguoiHocLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 551, Short.MAX_VALUE)
);
form.addTab("Người học", NguoiHoc);
tblBangDiem.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane3.setViewportView(tblBangDiem);
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N
jLabel2.setText("KHÓA HỌC:");
cboKhoaHoc.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
cboKhoaHocItemStateChanged(evt);
}
});
javax.swing.GroupLayout BangDiemLayout = new javax.swing.GroupLayout(BangDiem);
BangDiem.setLayout(BangDiemLayout);
BangDiemLayout.setHorizontalGroup(
BangDiemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
.addGroup(BangDiemLayout.createSequentialGroup()
.addGap(53, 53, 53)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39)
.addComponent(cboKhoaHoc, javax.swing.GroupLayout.PREFERRED_SIZE, 792, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
BangDiemLayout.setVerticalGroup(
BangDiemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, BangDiemLayout.createSequentialGroup()
.addGroup(BangDiemLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(cboKhoaHoc, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 504, Short.MAX_VALUE))
);
form.addTab("Bảng điểm", BangDiem);
tblTongHop.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane2.setViewportView(tblTongHop);
javax.swing.GroupLayout TongHopLayout = new javax.swing.GroupLayout(TongHop);
TongHop.setLayout(TongHopLayout);
TongHopLayout.setHorizontalGroup(
TongHopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
);
TongHopLayout.setVerticalGroup(
TongHopLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 551, Short.MAX_VALUE)
);
form.addTab("Tổng hợp điểm ", TongHop);
tblDoanhThu.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Title 1", "Title 2", "Title 3", "Title 4"
}
));
jScrollPane1.setViewportView(tblDoanhThu);
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 15)); // NOI18N
jLabel3.setText("NĂM:");
cboDoanhThu.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
cboDoanhThuItemStateChanged(evt);
}
});
cboDoanhThu.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cboDoanhThuActionPerformed(evt);
}
});
javax.swing.GroupLayout DoanhThuLayout = new javax.swing.GroupLayout(DoanhThu);
DoanhThu.setLayout(DoanhThuLayout);
DoanhThuLayout.setHorizontalGroup(
DoanhThuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 1060, Short.MAX_VALUE)
.addGroup(DoanhThuLayout.createSequentialGroup()
.addGap(59, 59, 59)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(39, 39, 39)
.addComponent(cboDoanhThu, javax.swing.GroupLayout.PREFERRED_SIZE, 786, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
DoanhThuLayout.setVerticalGroup(
DoanhThuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(DoanhThuLayout.createSequentialGroup()
.addGroup(DoanhThuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cboDoanhThu, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 503, javax.swing.GroupLayout.PREFERRED_SIZE))
);
form.addTab("Doanh thu", DoanhThu);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 221, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(form)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(form))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void cboKhoaHocItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboKhoaHocItemStateChanged
// TODO add your handling code here:
try {
loadTableBangDiem();
} catch (Exception e) {
}
}//GEN-LAST:event_cboKhoaHocItemStateChanged
private void cboDoanhThuItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboDoanhThuItemStateChanged
// TODO add your handling code here:
try {
loadTableDoanhThu();
} catch (Exception e) {
}
}//GEN-LAST:event_cboDoanhThuItemStateChanged
private void cboDoanhThuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cboDoanhThuActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_cboDoanhThuActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel BangDiem;
private javax.swing.JPanel DoanhThu;
private javax.swing.JPanel NguoiHoc;
private javax.swing.JPanel TongHop;
private javax.swing.JComboBox<String> cboDoanhThu;
private javax.swing.JComboBox<String> cboKhoaHoc;
private javax.swing.JTabbedPane form;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JTable tblBangDiem;
private javax.swing.JTable tblDoanhThu;
private javax.swing.JTable tblNguoiHoc;
private javax.swing.JTable tblTongHop;
// End of variables declaration//GEN-END:variables
}
| 16,379 | 0.634938 | 0.625223 | 403 | 39.354839 | 31.397408 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.707196 | false | false | 13 |
641d8eb7c6c74e3496a6eea692c4092e4775b586 | 25,898,652,835,502 | b5936a5a4af93961733e5d78612a9d2aba75ed46 | /thymeleafjpa/src/main/java/com/ww/thymeleafjpa/controller/UserController.java | e4823215a3e5f2ac3616e0154dbbd3d4a3bbaf2e | [] | no_license | wwcom614/springboot2 | https://github.com/wwcom614/springboot2 | f581cbe0221c725f6e9f89cc9ed6ad8c640003c3 | afefbe7eca8c34be3ba74236f4470c611d3ad483 | refs/heads/master | 2020-03-15T23:06:52.902000 | 2018-05-24T13:19:38 | 2018-05-24T13:19:38 | 132,387,277 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.ww.thymeleafjpa.controller;
import com.ww.thymeleafjpa.model.User;
import com.ww.thymeleafjpa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Optional;
/*使用@Controller而不用@RESTController是因为这里返回一个页面而不是一个值,
如果只是使用@RestController注解Controller,则Controller中的方法无法返回页面,
配置的视图解析器InternalResourceViewResolver不起作用,返回的内容就是Return 里的内容*/
@Controller
public class UserController {
@Autowired
UserService userService;
@GetMapping("/list")
public String UserList(Model model){
model.addAttribute("users", userService.getUserList());
return "userlist";
}
@GetMapping("/toAdd")
public String toAdd() {
return "useradd";
}
@PostMapping("/add")
public String UserAdd(@RequestParam("name") String name,
@RequestParam("age") Integer age,
@RequestParam("birthday") String birthday){
User user = new User();
user.setName(name);
user.setAge(age);
user.setBirthday(birthday);
// System.out.println(user);
userService.addUser(user);
//redirect的是url地址;而直接返回的是html,url地址不会变
return "redirect:/list";
}
@GetMapping("/toEdit")
public String toEdit(Model model,Long id) {
Optional<User> user = userService.findUserById(id);
model.addAttribute("user", user);
return "useredit";
}
@PostMapping("/edit")
public String edit(User user) {
System.out.println(user);
userService.editUser(user);
return "redirect:/list";
}
@GetMapping("/delete")
public String deleteById(Long id) {
userService.deleteUserById(id);
return "redirect:/list";
}
}
| UTF-8 | Java | 2,269 | java | UserController.java | Java | [] | null | [] | package com.ww.thymeleafjpa.controller;
import com.ww.thymeleafjpa.model.User;
import com.ww.thymeleafjpa.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Optional;
/*使用@Controller而不用@RESTController是因为这里返回一个页面而不是一个值,
如果只是使用@RestController注解Controller,则Controller中的方法无法返回页面,
配置的视图解析器InternalResourceViewResolver不起作用,返回的内容就是Return 里的内容*/
@Controller
public class UserController {
@Autowired
UserService userService;
@GetMapping("/list")
public String UserList(Model model){
model.addAttribute("users", userService.getUserList());
return "userlist";
}
@GetMapping("/toAdd")
public String toAdd() {
return "useradd";
}
@PostMapping("/add")
public String UserAdd(@RequestParam("name") String name,
@RequestParam("age") Integer age,
@RequestParam("birthday") String birthday){
User user = new User();
user.setName(name);
user.setAge(age);
user.setBirthday(birthday);
// System.out.println(user);
userService.addUser(user);
//redirect的是url地址;而直接返回的是html,url地址不会变
return "redirect:/list";
}
@GetMapping("/toEdit")
public String toEdit(Model model,Long id) {
Optional<User> user = userService.findUserById(id);
model.addAttribute("user", user);
return "useredit";
}
@PostMapping("/edit")
public String edit(User user) {
System.out.println(user);
userService.editUser(user);
return "redirect:/list";
}
@GetMapping("/delete")
public String deleteById(Long id) {
userService.deleteUserById(id);
return "redirect:/list";
}
}
| 2,269 | 0.65856 | 0.65856 | 70 | 27.957144 | 20.565878 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.485714 | false | false | 13 |
1c697be096e6f4b0f52280b07b72fa6eb39c8ca7 | 14,680,198,266,474 | b268e04d77f3ce336a7fed771cb61b28845dba67 | /src/com/taupst/controller/BaseController.java | 2acf7130f6d39241834889b9f6e7778cc5f93d37 | [] | no_license | hongdong/taupst_server | https://github.com/hongdong/taupst_server | f2052cb59d6e1f98c2baeb66156f54cfa0c1dc5d | 3068f7261f9055fea744ab5b7a91ac7e44ec0c2f | refs/heads/master | 2021-01-22T09:33:48.957000 | 2014-02-17T07:06:31 | 2014-02-17T07:06:31 | 15,305,939 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.taupst.controller;
import javax.annotation.Resource;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.taupst.service.NewsService;
import com.taupst.service.PullService;
import com.taupst.service.RankingService;
import com.taupst.service.SignService;
import com.taupst.service.TaskMesService;
import com.taupst.service.TaskService;
import com.taupst.service.UserService;
import com.taupst.util.MethodUtil;
public abstract class BaseController {
public static MethodUtil util = MethodUtil.getInstance();
@Resource(name="userService")
protected UserService userService;
@Resource(name="taskService")
protected TaskService taskService;
@Resource(name="taskMesService")
protected TaskMesService taskMesService;
@Resource(name="signService")
protected SignService signService;
@Resource(name="rankingService")
protected RankingService rankingService;
@Resource(name="newsService")
protected NewsService newsService;
@Resource(name="pullService")
protected PullService pullService;
@Resource(name="taskExecutor")
protected ThreadPoolTaskExecutor taskExecutor;
}
| UTF-8 | Java | 1,141 | java | BaseController.java | Java | [] | null | [] | package com.taupst.controller;
import javax.annotation.Resource;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import com.taupst.service.NewsService;
import com.taupst.service.PullService;
import com.taupst.service.RankingService;
import com.taupst.service.SignService;
import com.taupst.service.TaskMesService;
import com.taupst.service.TaskService;
import com.taupst.service.UserService;
import com.taupst.util.MethodUtil;
public abstract class BaseController {
public static MethodUtil util = MethodUtil.getInstance();
@Resource(name="userService")
protected UserService userService;
@Resource(name="taskService")
protected TaskService taskService;
@Resource(name="taskMesService")
protected TaskMesService taskMesService;
@Resource(name="signService")
protected SignService signService;
@Resource(name="rankingService")
protected RankingService rankingService;
@Resource(name="newsService")
protected NewsService newsService;
@Resource(name="pullService")
protected PullService pullService;
@Resource(name="taskExecutor")
protected ThreadPoolTaskExecutor taskExecutor;
}
| 1,141 | 0.815075 | 0.815075 | 43 | 25.534883 | 18.693798 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.069767 | false | false | 13 |
b5fad03345a189ba0cdabe46718d3f8ede9daf39 | 17,540,646,476,399 | 061a5a2c8b95612a6e73b144735678b23c72b41a | /src/Entity.java | ac731d7bc27f6d03d2c1f4e055444d5e74488604 | [] | no_license | thomas-baskin/VerbBasedAdventureGame | https://github.com/thomas-baskin/VerbBasedAdventureGame | 5e504bf79dd93a98636b5119ad80505e4e24564f | e35dc9be5ac0ab234e9183239814b96ec39f143d | refs/heads/master | 2020-12-20T21:29:50.139000 | 2020-02-08T22:42:06 | 2020-02-08T22:42:06 | 236,214,448 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | public class Entity {
private String name;
private String description;
private boolean packable; // Can it go into the player's pack?
Entity(String name, String description, boolean packable){
this.name = name;
this.description = description;
this.packable = packable;
}
public void setName(String newName){
this.name = newName;
}
public String getName(){
return name;
}
public void setDescription(String newDescription){
this.description = newDescription;
}
public String getDescription(){
return description;
}
public void setPackable(boolean packable){
this.packable = packable;
}
public boolean getPackable(){
return packable;
}
}
| UTF-8 | Java | 776 | java | Entity.java | Java | [] | null | [] | public class Entity {
private String name;
private String description;
private boolean packable; // Can it go into the player's pack?
Entity(String name, String description, boolean packable){
this.name = name;
this.description = description;
this.packable = packable;
}
public void setName(String newName){
this.name = newName;
}
public String getName(){
return name;
}
public void setDescription(String newDescription){
this.description = newDescription;
}
public String getDescription(){
return description;
}
public void setPackable(boolean packable){
this.packable = packable;
}
public boolean getPackable(){
return packable;
}
}
| 776 | 0.637887 | 0.637887 | 29 | 25.758621 | 18.022314 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.482759 | false | false | 13 |
6302acad95a7aa5050beef9546fefc18c8b28cc7 | 19,748,259,664,485 | ab9decc9b15cdf46e49c415e0cfd0d035e329b87 | /java_module/src/main/java/com/studio/service/doc/ResponseCode.java | d11103dc84655da490bd946295d9a9042b02747d | [] | no_license | pandengke/jettyLearn | https://github.com/pandengke/jettyLearn | 7c1488dac10afd761ec96c8de74bcda60de771c5 | 9378f3e68d665106e6ca74b81cce6c14c309bc53 | refs/heads/master | 2021-01-10T05:24:26.655000 | 2016-03-15T06:58:27 | 2016-03-15T06:58:27 | 53,666,648 | 0 | 0 | null | false | 2016-03-15T06:58:27 | 2016-03-11T12:48:37 | 2016-03-11T12:56:42 | 2016-03-15T06:58:27 | 8,370 | 0 | 0 | 0 | Java | null | null | package com.studio.service.doc;
/**
* Created by Administrator on 2016/3/10.
*/
public enum ResponseCode {
/**
* ResponseCode is designed a string that length() is 6;
* each bit of the string map to a kind of info;
* 1 -> server error;
* 2 -> permission error;
* 3 -> auth error;
* 4 -> ???;
* 5 -> ???;
* 6 -> ???;
*/
OK("000000"),
UNKNOWN("900000");
public final String code;
ResponseCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
}
| UTF-8 | Java | 570 | java | ResponseCode.java | Java | [
{
"context": "package com.studio.service.doc;\n\n/**\n * Created by Administrator on 2016/3/10.\n */\npublic enum ResponseCode {\n\n ",
"end": 64,
"score": 0.745086669921875,
"start": 51,
"tag": "USERNAME",
"value": "Administrator"
}
] | null | [] | package com.studio.service.doc;
/**
* Created by Administrator on 2016/3/10.
*/
public enum ResponseCode {
/**
* ResponseCode is designed a string that length() is 6;
* each bit of the string map to a kind of info;
* 1 -> server error;
* 2 -> permission error;
* 3 -> auth error;
* 4 -> ???;
* 5 -> ???;
* 6 -> ???;
*/
OK("000000"),
UNKNOWN("900000");
public final String code;
ResponseCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
}
| 570 | 0.52807 | 0.482456 | 31 | 17.387096 | 15.679609 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.451613 | false | false | 13 |
63d2819eab741474f553036239d4102f93a42cd2 | 13,151,189,884,403 | 0e7fe898e562880add49708428811b966a2a48f9 | /src/test/java/ua/in/dmitry404/command/validator/NotesValuesValidatorTest.java | dcf3f08a703b327d5f8c30e0c0592b2d6231a1f8 | [] | no_license | Dmitry404/CashMachine | https://github.com/Dmitry404/CashMachine | 14fedd2f2c5999781419f88c3761b9ce50f331f9 | eda12a971e38fae026ebdad55fc13888afc60144 | refs/heads/master | 2020-05-18T20:27:31.760000 | 2011-11-07T06:56:27 | 2011-11-07T06:56:27 | 2,707,620 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.in.dmitry404.command.validator;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* This class contains unit-tests for NotesValueValidator
*
* @author Dmitriy Butakov
*/
public class NotesValuesValidatorTest {
private NotesValueValidator validator;
@Before
public void setUp() {
validator = new NotesValueValidator();
}
@Test
public void testSuccessfulValidation() {
int[] powerValues = { 0, 1, 2, 3 };
int[] multipliers = { 1, 5 };
int base = 10;
for (int multiplier : multipliers) {
for (int power : powerValues) {
int value = (int) (multiplier * Math.pow(base, power));
assertTrue(validator.isValid(Integer.toString(value)));
}
}
}
@Test
public void testFailedValidation() {
String firstValue = "-1";
String secondValue = "0";
String thirdValue = "2";
assertFalse(validator.isValid(firstValue));
assertFalse(validator.isValid(secondValue));
assertFalse(validator.isValid(thirdValue));
}
} | UTF-8 | Java | 1,160 | java | NotesValuesValidatorTest.java | Java | [
{
"context": "s unit-tests for NotesValueValidator\n *\n * @author Dmitriy Butakov\n */\npublic class NotesValuesValidatorTest {\n p",
"end": 219,
"score": 0.999862551689148,
"start": 204,
"tag": "NAME",
"value": "Dmitriy Butakov"
}
] | null | [] | package ua.in.dmitry404.command.validator;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* This class contains unit-tests for NotesValueValidator
*
* @author <NAME>
*/
public class NotesValuesValidatorTest {
private NotesValueValidator validator;
@Before
public void setUp() {
validator = new NotesValueValidator();
}
@Test
public void testSuccessfulValidation() {
int[] powerValues = { 0, 1, 2, 3 };
int[] multipliers = { 1, 5 };
int base = 10;
for (int multiplier : multipliers) {
for (int power : powerValues) {
int value = (int) (multiplier * Math.pow(base, power));
assertTrue(validator.isValid(Integer.toString(value)));
}
}
}
@Test
public void testFailedValidation() {
String firstValue = "-1";
String secondValue = "0";
String thirdValue = "2";
assertFalse(validator.isValid(firstValue));
assertFalse(validator.isValid(secondValue));
assertFalse(validator.isValid(thirdValue));
}
} | 1,151 | 0.60431 | 0.592241 | 47 | 23.702127 | 20.915142 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.468085 | false | false | 13 |
cd2e5a9e2cef11777923ba58460959c37a5aaae5 | 13,151,189,886,356 | c38d2a497d2dc21bd7b67dfb09709a29cd26da61 | /logback-exception-mapping/src/main/java/com/tersesystems/logback/exceptionmapping/ExceptionHierarchyIterator.java | 3238018b99e3e207c3317098dcda4ccaa980a880 | [
"CC0-1.0"
] | permissive | wsargent/terse-logback | https://github.com/wsargent/terse-logback | 4a6bb25048ee841fb26136c8d3c58738578fca75 | 32d88caa5140960145f5ecc60dc52ecd9a61840a | refs/heads/master | 2023-01-27T23:27:17.663000 | 2019-07-05T02:50:02 | 2019-07-05T02:50:02 | 172,425,075 | 0 | 1 | NOASSERTION | true | 2019-03-03T00:07:23 | 2019-02-25T03:07:20 | 2019-02-25T03:07:22 | 2019-03-03T00:07:22 | 336 | 0 | 1 | 0 | Java | false | null | package com.tersesystems.logback.exceptionmapping;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class ExceptionHierarchyIterator implements Iterator<Class<?>> {
private Class<?> clazz;
ExceptionHierarchyIterator(Class<?> clazz) {
this.clazz = clazz;
}
@Override
public boolean hasNext() {
return clazz != null;
}
@SuppressWarnings("unchecked")
@Override
public Class<?> next() {
Class<?> oldClass = clazz;
if (clazz != null) {
clazz = clazz.getSuperclass();
}
return oldClass;
}
@SuppressWarnings("unchecked")
public Stream<Class<?>> stream() {
Spliterator spliterator = Spliterators.spliteratorUnknownSize(this, 0);
return (Stream<Class<?>>) StreamSupport.stream(spliterator, false);
}
public static ExceptionHierarchyIterator create(Class<?> clazz) {
return new ExceptionHierarchyIterator(clazz);
}
}
| UTF-8 | Java | 1,075 | java | ExceptionHierarchyIterator.java | Java | [] | null | [] | package com.tersesystems.logback.exceptionmapping;
import java.util.Iterator;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class ExceptionHierarchyIterator implements Iterator<Class<?>> {
private Class<?> clazz;
ExceptionHierarchyIterator(Class<?> clazz) {
this.clazz = clazz;
}
@Override
public boolean hasNext() {
return clazz != null;
}
@SuppressWarnings("unchecked")
@Override
public Class<?> next() {
Class<?> oldClass = clazz;
if (clazz != null) {
clazz = clazz.getSuperclass();
}
return oldClass;
}
@SuppressWarnings("unchecked")
public Stream<Class<?>> stream() {
Spliterator spliterator = Spliterators.spliteratorUnknownSize(this, 0);
return (Stream<Class<?>>) StreamSupport.stream(spliterator, false);
}
public static ExceptionHierarchyIterator create(Class<?> clazz) {
return new ExceptionHierarchyIterator(clazz);
}
}
| 1,075 | 0.666047 | 0.665116 | 40 | 25.875 | 22.297071 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.425 | false | false | 13 |
2bfef50b1664a1cd615401e54fb71a7eee74cdb5 | 34,299,608,836,894 | 6fe4c2729f4db5b3c338b28ef1a99113ff040ac7 | /pnw-admin/pnw-admin-dao/src/main/java/cn/antido/admin/mapper/DistrictMapper.java | fa8a9241526d106d6baf01cb60a4ec99d9a64e95 | [] | no_license | Antido-L/PNW | https://github.com/Antido-L/PNW | 18a990400a56770457bbe2d96b4f1628eb3c5875 | 917260cf69e87882f54db8b2d00286dd78b350a9 | refs/heads/master | 2022-05-09T08:42:11.095000 | 2020-04-03T08:44:37 | 2020-04-03T08:44:37 | 147,450,573 | 1 | 0 | null | false | 2022-03-31T22:00:38 | 2018-09-05T02:50:15 | 2021-01-12T03:15:00 | 2022-03-31T22:00:38 | 30,315 | 1 | 0 | 9 | Java | false | false | package cn.antido.admin.mapper;
import java.util.List;
import cn.antido.admin.pojo.District;
/**
* @Description 行政区域DAO 没有插入和更新操作
* @author Antido
* @date 2017年12月24日 上午11:38:29
*/
public interface DistrictMapper {
/**
* 根据主键查询区域信息
*/
District selectByPrimaryKey(Integer id);
/**
* 根据父ID查询所包含的行政区域
*/
List<District> selectByParentId(Integer parent_id);
/**
* 查询所有parent_id 为null的
*/
List<District> selectByParentIdIsNull();
}
| UTF-8 | Java | 574 | java | DistrictMapper.java | Java | [
{
"context": "/**\r\n * @Description 行政区域DAO 没有插入和更新操作\r\n * @author Antido\r\n * @date 2017年12月24日 上午11:38:29\r\n */\r\npublic int",
"end": 157,
"score": 0.9613831043243408,
"start": 151,
"tag": "NAME",
"value": "Antido"
}
] | null | [] | package cn.antido.admin.mapper;
import java.util.List;
import cn.antido.admin.pojo.District;
/**
* @Description 行政区域DAO 没有插入和更新操作
* @author Antido
* @date 2017年12月24日 上午11:38:29
*/
public interface DistrictMapper {
/**
* 根据主键查询区域信息
*/
District selectByPrimaryKey(Integer id);
/**
* 根据父ID查询所包含的行政区域
*/
List<District> selectByParentId(Integer parent_id);
/**
* 查询所有parent_id 为null的
*/
List<District> selectByParentIdIsNull();
}
| 574 | 0.66875 | 0.639583 | 26 | 16.461538 | 15.872644 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.730769 | false | false | 13 |
e93a2e45eda539a559ad170bbf81d69dc8965171 | 36,679,020,712,046 | ec9a81177d82a24a35d2562e2c0a69d88f450810 | /src/main/java/com/songr/songr/SongrController.java | 4adcc081d63c1660ea0fe0d2c3f22e173a841583 | [] | no_license | EsraaAbuHana/songr | https://github.com/EsraaAbuHana/songr | 8da9d91763110a836a06200de0b690df9483b8cd | 2370a0a49da31f64f2007add9ca789605a3bac66 | refs/heads/main | 2023-04-17T04:27:46.201000 | 2021-04-21T17:56:08 | 2021-04-21T17:56:08 | 359,124,280 | 0 | 0 | null | false | 2021-04-21T17:56:08 | 2021-04-18T11:27:50 | 2021-04-21T01:27:16 | 2021-04-21T17:56:08 | 75 | 0 | 0 | 0 | Java | false | false | package com.songr.songr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.view.RedirectView;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@Controller
public class SongrController {
@Autowired
AlbumRepository albumRepository;
@GetMapping("/hello")
// @ResponseBody
public String home() {
return "HelloWorld";
}
@GetMapping("/capitalize/{word}")
public String anyWord(Model m, @PathVariable("word")String word){
m.addAttribute("word",word.toUpperCase());
return "CAPITALIZED.html";
}
@GetMapping("/home")
// @ResponseBody
public String index() {
return "index.html";
}
@GetMapping("/albums")
public String getAlbum(Model m){
m.addAttribute("albums",albumRepository.findAll());
return "albums.html";
}
@GetMapping("/addAlbum")
public String getAddAlbumView(){
return "addAlbum.html";
}
@PostMapping("/albums")
public RedirectView addAlbum(@RequestParam(value="title")String title,
@RequestParam(value="artist")String artist,
@RequestParam(value="songCount")int songCount,
@RequestParam(value="length")int length,
@RequestParam(value="imageUrl")String imageUrl){
Album album = new Album(title,artist,songCount,length,imageUrl);
albumRepository.save(album);
return new RedirectView("/albums");
}
// @GetMapping("/majors/{id}")
// public ResponseEntity<Album> getStudentById(@PathVariable(value="id") Integer id){
// Album album = majorRepository.findById(id).get();
// return new ResponseEntity(album, HttpStatus.OK);
// }
//
// @PostMapping("/majors")
// public ResponseEntity<Album> addStudent(String majorCode, String majorName){
// Album newMajor = new Album(albumCode,majorName);
// albumRepository.save(newMajor);
// return new ResponseEntity(newMajor, HttpStatus.OK);
// }
}
// Album album1 = new Album("SKY","Yiruma",8,500,"https://img.discogs.com/DgLWcqi0mMWsayw856ptriTN9qc=/fit-in/600x600/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-6875064-1428500220-1592.jpeg.jpg");
// Album album2 = new Album("Piano Serenade","Yiruma",10,320,"https://m.media-amazon.com/images/I/81fkNX0f3tL._SS500_.jpg");
// Album album3 = new Album("ATMOSFERA","Yiruma",1,120,"https://a10.gaanacdn.com/images/albums/7/225107/crop_175x175_225107.jpg");
// List<Album> albums = new ArrayList<>();
// albums.add(album1);
// albums.add(album2);
// albums.add(album3);
// m.addAttribute("albums",albums);
// @GetMapping("/hello")
//// @ResponseBody
// public String home() {
// return "HelloWorld";
// }
// @GetMapping("/capitalize/{word}")
// public String anyWord(Model m, @PathVariable("word")String word){
// m.addAttribute("word",word.toUpperCase());
//
// return "CAPITALIZED.html";
// }
| UTF-8 | Java | 3,362 | java | SongrController.java | Java | [] | null | [] | package com.songr.songr;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.view.RedirectView;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
@Controller
public class SongrController {
@Autowired
AlbumRepository albumRepository;
@GetMapping("/hello")
// @ResponseBody
public String home() {
return "HelloWorld";
}
@GetMapping("/capitalize/{word}")
public String anyWord(Model m, @PathVariable("word")String word){
m.addAttribute("word",word.toUpperCase());
return "CAPITALIZED.html";
}
@GetMapping("/home")
// @ResponseBody
public String index() {
return "index.html";
}
@GetMapping("/albums")
public String getAlbum(Model m){
m.addAttribute("albums",albumRepository.findAll());
return "albums.html";
}
@GetMapping("/addAlbum")
public String getAddAlbumView(){
return "addAlbum.html";
}
@PostMapping("/albums")
public RedirectView addAlbum(@RequestParam(value="title")String title,
@RequestParam(value="artist")String artist,
@RequestParam(value="songCount")int songCount,
@RequestParam(value="length")int length,
@RequestParam(value="imageUrl")String imageUrl){
Album album = new Album(title,artist,songCount,length,imageUrl);
albumRepository.save(album);
return new RedirectView("/albums");
}
// @GetMapping("/majors/{id}")
// public ResponseEntity<Album> getStudentById(@PathVariable(value="id") Integer id){
// Album album = majorRepository.findById(id).get();
// return new ResponseEntity(album, HttpStatus.OK);
// }
//
// @PostMapping("/majors")
// public ResponseEntity<Album> addStudent(String majorCode, String majorName){
// Album newMajor = new Album(albumCode,majorName);
// albumRepository.save(newMajor);
// return new ResponseEntity(newMajor, HttpStatus.OK);
// }
}
// Album album1 = new Album("SKY","Yiruma",8,500,"https://img.discogs.com/DgLWcqi0mMWsayw856ptriTN9qc=/fit-in/600x600/filters:strip_icc():format(jpeg):mode_rgb():quality(90)/discogs-images/R-6875064-1428500220-1592.jpeg.jpg");
// Album album2 = new Album("Piano Serenade","Yiruma",10,320,"https://m.media-amazon.com/images/I/81fkNX0f3tL._SS500_.jpg");
// Album album3 = new Album("ATMOSFERA","Yiruma",1,120,"https://a10.gaanacdn.com/images/albums/7/225107/crop_175x175_225107.jpg");
// List<Album> albums = new ArrayList<>();
// albums.add(album1);
// albums.add(album2);
// albums.add(album3);
// m.addAttribute("albums",albums);
// @GetMapping("/hello")
//// @ResponseBody
// public String home() {
// return "HelloWorld";
// }
// @GetMapping("/capitalize/{word}")
// public String anyWord(Model m, @PathVariable("word")String word){
// m.addAttribute("word",word.toUpperCase());
//
// return "CAPITALIZED.html";
// }
| 3,362 | 0.625223 | 0.60113 | 90 | 35.333332 | 34.956161 | 233 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.733333 | false | false | 13 |
c9076170b70238f995a3e0690587a27a72018c84 | 32,427,003,151,633 | 5d24c60d0825c59ea634c562e41e9ca7545e41af | /src/main/java/com/qianmi/admin/action/LoginController.java | ae93d0b8426c93ca5aded8a2aaac67d1975a493e | [] | no_license | jianghong-pc/admin-main | https://github.com/jianghong-pc/admin-main | ab3d05a375b29910179e4f8875f5bd75a67b4a1f | 048979c82620de5f3d9a5fb68cc2bbf003f2f1c9 | refs/heads/master | 2021-06-20T19:04:20.364000 | 2017-08-11T02:01:14 | 2017-08-11T02:01:14 | 99,774,572 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.qianmi.admin.action;
import com.qianmi.admin.common.constants.Constants;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.util.Map;
/**
* Description:用户登陆的控制器
*/
@CrossOrigin
@Controller
public class LoginController extends BaseController {
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = {Constants.PRODUCES})
@ResponseBody
public Map<String, Object> login(String username, String password, RedirectAttributes redirectAttributes){
return null;
}
@RequestMapping(value="/logout",method=RequestMethod.GET)
public Map<String, Object> logout(RedirectAttributes redirectAttributes ){
return null;
}
}
| UTF-8 | Java | 1,035 | java | LoginController.java | Java | [] | null | [] | package com.qianmi.admin.action;
import com.qianmi.admin.common.constants.Constants;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import java.util.Map;
/**
* Description:用户登陆的控制器
*/
@CrossOrigin
@Controller
public class LoginController extends BaseController {
@RequestMapping(value = "/login", method = RequestMethod.POST, produces = {Constants.PRODUCES})
@ResponseBody
public Map<String, Object> login(String username, String password, RedirectAttributes redirectAttributes){
return null;
}
@RequestMapping(value="/logout",method=RequestMethod.GET)
public Map<String, Object> logout(RedirectAttributes redirectAttributes ){
return null;
}
}
| 1,035 | 0.785644 | 0.785644 | 31 | 31.806452 | 31.683332 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.580645 | false | false | 13 |
9ab502936f649ae759d488d873c5d49fcf741b90 | 2,997,887,208,783 | b34e3835d4f7d4fc833853ededb8091c24b04167 | /src/com/datastructure/Stack3.java | d84bdc7daf9f4fdaa837b470520d229099d68dde | [] | no_license | caihanbin1992/Algorithm | https://github.com/caihanbin1992/Algorithm | aec46ea484d5c2e93444004b3640bacb7e4e2642 | e803230187414aa84bfcfe8c81b05957011a782d | refs/heads/master | 2020-03-12T03:59:14.457000 | 2018-04-23T13:58:56 | 2018-04-23T13:58:56 | 130,435,316 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.datastructure;
import java.util.Stack;
/**
* problem:栈的反转
* @author admin
*
*/
public class Stack3 {
public int[] reverseStack(int[] A, int n) {
Stack<Integer> stack=new Stack<Integer>();
for(int i=0;i<n;i++){
stack.push(A[i]);
}
reverse(stack);
int[] A1=new int[n];
for(int i=0;i<n;i++){
A1[i]=stack.get(i);
}
return A1;
// write code here
}
//递归函数1:将stack的栈底元素返回并移除
public static int getAndRemoveLastElement(Stack<Integer> stack){
int result=stack.pop();
if(stack.isEmpty()){
return result;
}else{
int last=getAndRemoveLastElement(stack);
stack.push(result);
return last;
}
}
public static void reverse(Stack<Integer> stack){
if(stack.isEmpty()){
return;
}
int i=getAndRemoveLastElement(stack);
reverse(stack);
stack.push(i);
}
}
| UTF-8 | Java | 947 | java | Stack3.java | Java | [
{
"context": "va.util.Stack;\r\n\r\n/**\r\n * problem:栈的反转\r\n * @author admin\r\n *\r\n */\r\npublic class Stack3 {\r\n\t\r\n\t public int[",
"end": 95,
"score": 0.9456602931022644,
"start": 90,
"tag": "USERNAME",
"value": "admin"
}
] | null | [] | package com.datastructure;
import java.util.Stack;
/**
* problem:栈的反转
* @author admin
*
*/
public class Stack3 {
public int[] reverseStack(int[] A, int n) {
Stack<Integer> stack=new Stack<Integer>();
for(int i=0;i<n;i++){
stack.push(A[i]);
}
reverse(stack);
int[] A1=new int[n];
for(int i=0;i<n;i++){
A1[i]=stack.get(i);
}
return A1;
// write code here
}
//递归函数1:将stack的栈底元素返回并移除
public static int getAndRemoveLastElement(Stack<Integer> stack){
int result=stack.pop();
if(stack.isEmpty()){
return result;
}else{
int last=getAndRemoveLastElement(stack);
stack.push(result);
return last;
}
}
public static void reverse(Stack<Integer> stack){
if(stack.isEmpty()){
return;
}
int i=getAndRemoveLastElement(stack);
reverse(stack);
stack.push(i);
}
}
| 947 | 0.583241 | 0.575524 | 48 | 16.895834 | 15.152337 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.875 | false | false | 13 |
7ac7fd2f30aab6768e3b8a5f24c41abb11763176 | 2,997,887,208,181 | afd9492bf50a0762a60201c0914d6856915a9c94 | /tracks/DualTrack.java | 0be354e9e0b998f1a28dda72685f0c34b5fd411a | [] | no_license | asix7/metromadness | https://github.com/asix7/metromadness | c7e4e816fb2f2afc8e652f2254bf5e10bb9bddc1 | db7f133d8c118bfef2bbda46c08e7cf5207df1b8 | refs/heads/master | 2021-01-01T03:58:39.310000 | 2016-04-19T10:00:40 | 2016-04-19T10:00:40 | 56,367,102 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.unimelb.swen30006.metromadness.tracks;
import java.awt.geom.Point2D.Float;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.unimelb.swen30006.metromadness.trains.Train;
public class DualTrack extends Track {
private boolean forwardOccupied;
private boolean backwardOccupied;
public DualTrack(Float start, Float end, Color col) {
super(start, end, col);
this.forwardOccupied = false;
this.backwardOccupied = false;
}
@Override
public void enter(Train t){
if(t.getForward()){
this.forwardOccupied = true;
} else {
this.backwardOccupied = true;
}
}
@Override
public boolean canEnter(boolean forward) {
if(forward){
return !this.forwardOccupied;
} else {
return !this.backwardOccupied;
}
}
@Override
public void leave(Train t) {
if(t.getForward()){
this.forwardOccupied = false;
} else {
this.backwardOccupied = false;
}
}
@Override
public void render(ShapeRenderer renderer){
renderer.rectLine(getStartPos().x, getStartPos().y, getEndPos().x, getEndPos().y, getLINEWIDTH());
renderer.setColor(new Color(245f/255f,245f/255f,245f/255f,0.5f).lerp(getTrackColour(), 0.5f));
renderer.rectLine(getStartPos().x, getStartPos().y, getEndPos().x, getEndPos().y, getLINEWIDTH()/3);
renderer.setColor(getTrackColour());
}
@Override
public String toString() {
return "Track [startPos=" + getStartPos() + ", endPos=" + getEndPos() + ", trackColour=" + getTrackColour() + ", forwardOccupied="
+ forwardOccupied + ", backwardOccupied=" + backwardOccupied + "]";
}
}
| UTF-8 | Java | 1,608 | java | DualTrack.java | Java | [] | null | [] | package com.unimelb.swen30006.metromadness.tracks;
import java.awt.geom.Point2D.Float;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.unimelb.swen30006.metromadness.trains.Train;
public class DualTrack extends Track {
private boolean forwardOccupied;
private boolean backwardOccupied;
public DualTrack(Float start, Float end, Color col) {
super(start, end, col);
this.forwardOccupied = false;
this.backwardOccupied = false;
}
@Override
public void enter(Train t){
if(t.getForward()){
this.forwardOccupied = true;
} else {
this.backwardOccupied = true;
}
}
@Override
public boolean canEnter(boolean forward) {
if(forward){
return !this.forwardOccupied;
} else {
return !this.backwardOccupied;
}
}
@Override
public void leave(Train t) {
if(t.getForward()){
this.forwardOccupied = false;
} else {
this.backwardOccupied = false;
}
}
@Override
public void render(ShapeRenderer renderer){
renderer.rectLine(getStartPos().x, getStartPos().y, getEndPos().x, getEndPos().y, getLINEWIDTH());
renderer.setColor(new Color(245f/255f,245f/255f,245f/255f,0.5f).lerp(getTrackColour(), 0.5f));
renderer.rectLine(getStartPos().x, getStartPos().y, getEndPos().x, getEndPos().y, getLINEWIDTH()/3);
renderer.setColor(getTrackColour());
}
@Override
public String toString() {
return "Track [startPos=" + getStartPos() + ", endPos=" + getEndPos() + ", trackColour=" + getTrackColour() + ", forwardOccupied="
+ forwardOccupied + ", backwardOccupied=" + backwardOccupied + "]";
}
}
| 1,608 | 0.712687 | 0.691542 | 61 | 25.360655 | 28.368786 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.983607 | false | false | 13 |
7b18a884ccd9cb559b9434babdf9f5547e3e2cb0 | 7,687,991,495,075 | 11004a83451989516af369e3dacf6179191c80f5 | /app/src/main/java/com/example/urbanclone_techhelpers/Feedback.java | 295df4fba6742cfba81afa280d4cfb6005acc8fb | [] | no_license | gargi3099/JustBook-TechHelpers | https://github.com/gargi3099/JustBook-TechHelpers | 2ac0a23872b8ed66d3464a39558a3f5a50eddf8c | 00cefea26b35ca521656dee3c3e094c30ef4347b | refs/heads/master | 2023-02-02T05:29:43.684000 | 2020-12-18T12:20:44 | 2020-12-18T12:20:44 | 295,780,245 | 0 | 0 | null | false | 2020-10-27T05:50:35 | 2020-09-15T16:04:32 | 2020-10-07T05:32:09 | 2020-10-27T05:50:35 | 225 | 0 | 0 | 0 | Java | false | false | package com.example.application2;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.application2.Home;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Feedback extends AppCompatActivity {
FirebaseAuth authf;
Button bb;
EditText fbr, fbc;
private FirebaseDatabase FFD;
private DatabaseReference FFR;
com.example.urbanclone_techhelpers.feedbackdata feeds;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
SharedPreferences sharedPreferences = getSharedPreferences("techemail", MODE_PRIVATE);
final String value = sharedPreferences.getString("value","");
bb = (Button) findViewById(R.id.btns);
fbc = (EditText) findViewById(R.id.etfbc);
fbr = (EditText) findViewById(R.id.etfbr);
authf = FirebaseAuth.getInstance();
bb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String c = fbc.getText().toString();
final String r = fbr.getText().toString();
feeds = new com.example.urbanclone_techhelpers.feedbackdata();
FFR = FirebaseDatabase.getInstance().getReference().child("Feedback Data");
authf = FirebaseAuth.getInstance();
String email = authf.getCurrentUser().getEmail().toString();
if (validates()) {
feeds.setRating(r);
feeds.setComment(c);
feeds.setEmail(email);
feeds.setTechemail(value);
FFR.push().setValue(feeds)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(getBaseContext(), "Booking Done", Toast.LENGTH_LONG).show();
bb.setEnabled(true);
Intent intent=new Intent(Feedback.this, Home.class);
startActivity(intent);
finish();
}
}
});
} else {
Toast.makeText(getBaseContext(), "Give a valid feedback", Toast.LENGTH_LONG).show();
bb.setEnabled(true);
}
}
});
}
private final boolean validates() {
boolean valid = true;
String rt = fbr.getText().toString();
String ct = fbc.getText().toString();
int rate = Integer.parseInt(rt);
//!rt.matches("([1-5][.])?[5]")
if (rt.isEmpty() || rate>5 || rate<1) {
fbr.setError("Please rate the service between 0 to 5");
valid = false;
} else {
fbr.setError(null);
}
if (ct.isEmpty()) {
fbc.setError("Please enter a review ");
valid = false;
} else {
fbc.setError(null);
}
return valid;
}
} | UTF-8 | Java | 3,885 | java | Feedback.java | Java | [] | null | [] | package com.example.application2;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.example.application2.Home;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class Feedback extends AppCompatActivity {
FirebaseAuth authf;
Button bb;
EditText fbr, fbc;
private FirebaseDatabase FFD;
private DatabaseReference FFR;
com.example.urbanclone_techhelpers.feedbackdata feeds;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_feedback);
SharedPreferences sharedPreferences = getSharedPreferences("techemail", MODE_PRIVATE);
final String value = sharedPreferences.getString("value","");
bb = (Button) findViewById(R.id.btns);
fbc = (EditText) findViewById(R.id.etfbc);
fbr = (EditText) findViewById(R.id.etfbr);
authf = FirebaseAuth.getInstance();
bb.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String c = fbc.getText().toString();
final String r = fbr.getText().toString();
feeds = new com.example.urbanclone_techhelpers.feedbackdata();
FFR = FirebaseDatabase.getInstance().getReference().child("Feedback Data");
authf = FirebaseAuth.getInstance();
String email = authf.getCurrentUser().getEmail().toString();
if (validates()) {
feeds.setRating(r);
feeds.setComment(c);
feeds.setEmail(email);
feeds.setTechemail(value);
FFR.push().setValue(feeds)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(getBaseContext(), "Booking Done", Toast.LENGTH_LONG).show();
bb.setEnabled(true);
Intent intent=new Intent(Feedback.this, Home.class);
startActivity(intent);
finish();
}
}
});
} else {
Toast.makeText(getBaseContext(), "Give a valid feedback", Toast.LENGTH_LONG).show();
bb.setEnabled(true);
}
}
});
}
private final boolean validates() {
boolean valid = true;
String rt = fbr.getText().toString();
String ct = fbc.getText().toString();
int rate = Integer.parseInt(rt);
//!rt.matches("([1-5][.])?[5]")
if (rt.isEmpty() || rate>5 || rate<1) {
fbr.setError("Please rate the service between 0 to 5");
valid = false;
} else {
fbr.setError(null);
}
if (ct.isEmpty()) {
fbc.setError("Please enter a review ");
valid = false;
} else {
fbc.setError(null);
}
return valid;
}
} | 3,885 | 0.558816 | 0.556499 | 99 | 38.252525 | 24.374744 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.737374 | false | false | 13 |
904151c3e475c58bca974b99ab6d4c2da0a941dc | 9,947,144,260,158 | cd07a002107e3081a5fc77a0d6705ef58934450b | /gmall-web-util/src/test/java/com/atguigu/dubbo/RandomLoadBalance.java | f2f373bf9d35868258882b69879522307374c461 | [] | no_license | Java-YANG/gmall0830 | https://github.com/Java-YANG/gmall0830 | b2ef9f6731467810ae2a700a8d5cb75302b8f56d | f59620a135c40f7a1a8831f96506f056903a6d80 | refs/heads/master | 2022-09-21T05:00:53.159000 | 2020-04-11T15:57:30 | 2020-04-11T15:59:25 | 231,744,673 | 0 | 0 | null | false | 2022-09-01T23:18:28 | 2020-01-04T10:25:43 | 2020-04-11T16:03:11 | 2022-09-01T23:18:26 | 17,100 | 0 | 0 | 4 | CSS | false | false | package com.atguigu.dubbo;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import java.util.List;
import java.util.Random;
/**
* 随机均匀算法
* 随机,按权重设置随机概率
* 在一个截面上碰撞的概率高,但调用量越大分布越均匀,而且按概率使用权重后也比较均匀,有利于动态调整提供者权重。
*/
public class RandomLoadBalance extends AbstractLoadBalance {
private static final String NAME = "random";
private final Random random = new Random();
@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
// provider的数量
int length = invokers.size(); // 集合数量
int totalWeight = 0; // 权重值总和
boolean sameWeight = true; // 每一个invoker都有相同的权重值
for (int i = 0; i < length; i++) {
// 获得集合中每个元素的权重值
int weight = getWeight(invokers.get(i),invocation);
// 得到总权重值
totalWeight += weight;
if(sameWeight && i > 0 && weight != getWeight(invokers.get(i - 1),invocation)){
sameWeight = false;
}
}
if(totalWeight > 0 && !sameWeight){
// 如果(不是每个调用者都有相同的重量&至少有一个调用者的重量>0),根据总重量随机选择
int offset = random.nextInt(totalWeight);
// Return a invoker based on the random value.
// 可以理解成:[0,totalWeight)取随机数,看这个随机数(每比较一次,减去响应的权重)
// 落在了以权重为刻度的数轴哪个区间内,落在那个区间即返回哪个provider
for (int i = 0; i < length; i++) {
offset -= getWeight(invokers.get(i),invocation);
if(offset < 0){
return invokers.get(i);
}
}
}
// 如果所有调用者都具有相同的权值或totalWeight=0,则均匀返回
return invokers.get(random.nextInt(length));
}
}
| UTF-8 | Java | 2,201 | java | RandomLoadBalance.java | Java | [] | null | [] | package com.atguigu.dubbo;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.rpc.Invocation;
import com.alibaba.dubbo.rpc.Invoker;
import java.util.List;
import java.util.Random;
/**
* 随机均匀算法
* 随机,按权重设置随机概率
* 在一个截面上碰撞的概率高,但调用量越大分布越均匀,而且按概率使用权重后也比较均匀,有利于动态调整提供者权重。
*/
public class RandomLoadBalance extends AbstractLoadBalance {
private static final String NAME = "random";
private final Random random = new Random();
@Override
protected <T> Invoker<T> doSelect(List<Invoker<T>> invokers, URL url, Invocation invocation) {
// provider的数量
int length = invokers.size(); // 集合数量
int totalWeight = 0; // 权重值总和
boolean sameWeight = true; // 每一个invoker都有相同的权重值
for (int i = 0; i < length; i++) {
// 获得集合中每个元素的权重值
int weight = getWeight(invokers.get(i),invocation);
// 得到总权重值
totalWeight += weight;
if(sameWeight && i > 0 && weight != getWeight(invokers.get(i - 1),invocation)){
sameWeight = false;
}
}
if(totalWeight > 0 && !sameWeight){
// 如果(不是每个调用者都有相同的重量&至少有一个调用者的重量>0),根据总重量随机选择
int offset = random.nextInt(totalWeight);
// Return a invoker based on the random value.
// 可以理解成:[0,totalWeight)取随机数,看这个随机数(每比较一次,减去响应的权重)
// 落在了以权重为刻度的数轴哪个区间内,落在那个区间即返回哪个provider
for (int i = 0; i < length; i++) {
offset -= getWeight(invokers.get(i),invocation);
if(offset < 0){
return invokers.get(i);
}
}
}
// 如果所有调用者都具有相同的权值或totalWeight=0,则均匀返回
return invokers.get(random.nextInt(length));
}
}
| 2,201 | 0.592976 | 0.587219 | 50 | 33.740002 | 23.54299 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.56 | false | false | 13 |
c2acc4b780f9523dcd994b4506fa10bc8d2c1347 | 9,947,144,261,158 | 96e4cb32b93fa044ef7314938d376c3043a2064c | /bayesian_network/web/src/main/java/web/BayesianServlet.java | 0a7209a5f90292a27b5c918548e27f3cce826597 | [] | no_license | razvansalajan/datamining | https://github.com/razvansalajan/datamining | 209a4790f9d8a20925f6797d92593c1f2f1c483b | 2d7c3fa464739c49c92ad28b0f7d3403524d89e3 | refs/heads/master | 2021-01-11T11:39:23.642000 | 2016-12-19T15:45:41 | 2016-12-19T15:45:41 | 76,861,060 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package web;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import web.com.data_mining.core.BayesianNet;
import weka.core.Instances;
public class BayesianServlet extends HttpServlet{
// @EJB
// IBayesianNetworkEjbLocal bayesianNetwork;
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// for(Test test : getTestsBean.getTests()){
// System.out.println(test.getDescription());
// }
PrintWriter printWriter = resp.getWriter();
Enumeration<String> parameterNames = req.getParameterNames();
Map<String, String> initParam = new HashMap<>();
while (parameterNames.hasMoreElements()) {
String paramName = parameterNames.nextElement();
System.out.println(paramName);
String[] paramValues = req.getParameterValues(paramName);
initParam.put(paramName, paramValues[0]);
}
BufferedReader reader = null;
try {
String path = getServletContext().getRealPath("/ski.arff");
//String path = getServletContext().getRealPath("/contact-lenses.arff");
reader = new BufferedReader(new FileReader(path));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (reader == null){
System.out.println("reader e null");
return;
}
Instances data = null;
try {
data = new Instances(reader);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (data == null){
System.out.println("data e null");
return;
}
BayesianNet bayesianNet = new BayesianNet(data);
bayesianNet.learn();
List<String> values = new ArrayList<>();
for(int i=0; i<data.numAttributes(); ++i){
String currAttributeName = data.attribute(i).name();
values.add(initParam.get(currAttributeName));
}
Map<Integer, String> map = new HashMap<>();
for(int i=0; i<values.size(); ++i){
map.put(i, values.get(i));
printWriter.println(i + " " + values.get(i));
}
printWriter.println(bayesianNet.structureToString());
double totalProb = 1.0;
for(int i=0; i<bayesianNet.getNodes().size(); ++i){
int currNode = bayesianNet.getNodes().get(i);
List<Integer> dads = bayesianNet.getParents(currNode);
double currProb = bayesianNet.getProb(currNode, values.get(i), map);
printWriter.println("node:" + i + " " + currProb);
totalProb *= currProb;
}
double sum = totalProb;
for(int i=0; i<data.attribute(bayesianNet.getIndexClass()).numValues(); ++i){
String currValue = data.attribute(bayesianNet.getIndexClass()).value(i);
if (currValue.equals (map.get(bayesianNet.getIndexClass()))){
continue;
}
String temp = values.get(bayesianNet.getIndexClass());
values.set(bayesianNet.getIndexClass(), currValue);
Double currProbTotal = 1.0;
for(int j=0; j<bayesianNet.getNodes().size(); ++j){
int currNode = bayesianNet.getNodes().get(j);
List<Integer> dads = bayesianNet.getParents(currNode);
double currProb = bayesianNet.getProb(currNode, values.get(j), map);
// printWriter.println("node:" + j + " " + currProb);
currProbTotal *= currProb;
}
sum += currProbTotal;
printWriter.println(currValue + " " + currProbTotal);
values.set(bayesianNet.getIndexClass(), temp);
}
// for(String s : values){
// printWriter.println(s);
// }
printWriter.println(values.get(bayesianNet.getIndexClass()) + " " + totalProb);
double converted = (totalProb / sum) * 100.0;
printWriter.println("converted: " + converted);
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| UTF-8 | Java | 4,082 | java | BayesianServlet.java | Java | [] | null | [] | package web;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import web.com.data_mining.core.BayesianNet;
import weka.core.Instances;
public class BayesianServlet extends HttpServlet{
// @EJB
// IBayesianNetworkEjbLocal bayesianNetwork;
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// for(Test test : getTestsBean.getTests()){
// System.out.println(test.getDescription());
// }
PrintWriter printWriter = resp.getWriter();
Enumeration<String> parameterNames = req.getParameterNames();
Map<String, String> initParam = new HashMap<>();
while (parameterNames.hasMoreElements()) {
String paramName = parameterNames.nextElement();
System.out.println(paramName);
String[] paramValues = req.getParameterValues(paramName);
initParam.put(paramName, paramValues[0]);
}
BufferedReader reader = null;
try {
String path = getServletContext().getRealPath("/ski.arff");
//String path = getServletContext().getRealPath("/contact-lenses.arff");
reader = new BufferedReader(new FileReader(path));
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if (reader == null){
System.out.println("reader e null");
return;
}
Instances data = null;
try {
data = new Instances(reader);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (data == null){
System.out.println("data e null");
return;
}
BayesianNet bayesianNet = new BayesianNet(data);
bayesianNet.learn();
List<String> values = new ArrayList<>();
for(int i=0; i<data.numAttributes(); ++i){
String currAttributeName = data.attribute(i).name();
values.add(initParam.get(currAttributeName));
}
Map<Integer, String> map = new HashMap<>();
for(int i=0; i<values.size(); ++i){
map.put(i, values.get(i));
printWriter.println(i + " " + values.get(i));
}
printWriter.println(bayesianNet.structureToString());
double totalProb = 1.0;
for(int i=0; i<bayesianNet.getNodes().size(); ++i){
int currNode = bayesianNet.getNodes().get(i);
List<Integer> dads = bayesianNet.getParents(currNode);
double currProb = bayesianNet.getProb(currNode, values.get(i), map);
printWriter.println("node:" + i + " " + currProb);
totalProb *= currProb;
}
double sum = totalProb;
for(int i=0; i<data.attribute(bayesianNet.getIndexClass()).numValues(); ++i){
String currValue = data.attribute(bayesianNet.getIndexClass()).value(i);
if (currValue.equals (map.get(bayesianNet.getIndexClass()))){
continue;
}
String temp = values.get(bayesianNet.getIndexClass());
values.set(bayesianNet.getIndexClass(), currValue);
Double currProbTotal = 1.0;
for(int j=0; j<bayesianNet.getNodes().size(); ++j){
int currNode = bayesianNet.getNodes().get(j);
List<Integer> dads = bayesianNet.getParents(currNode);
double currProb = bayesianNet.getProb(currNode, values.get(j), map);
// printWriter.println("node:" + j + " " + currProb);
currProbTotal *= currProb;
}
sum += currProbTotal;
printWriter.println(currValue + " " + currProbTotal);
values.set(bayesianNet.getIndexClass(), temp);
}
// for(String s : values){
// printWriter.println(s);
// }
printWriter.println(values.get(bayesianNet.getIndexClass()) + " " + totalProb);
double converted = (totalProb / sum) * 100.0;
printWriter.println("converted: " + converted);
}
@Override
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| 4,082 | 0.705292 | 0.701372 | 133 | 29.691729 | 24.545855 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.511278 | false | false | 13 |
3b6b2448a0bf1bd15929c944d0117d43e4d6c990 | 19,619,410,637,787 | 89d90e63fdd7210669852fda3bfea44f702c982b | /MavenSpringCoreDemo2MongoTemplateWithMongodbThruXmlAndAnnotation/src/main/java/com/app/dto/Person.java | e28b145f7f72d1c6588fde1926ebb4d53b6a5ea1 | [
"MIT"
] | permissive | DevelopByTarun/Spring-Core-Aop-Mvc-Orm-Jdbc-With-Maven | https://github.com/DevelopByTarun/Spring-Core-Aop-Mvc-Orm-Jdbc-With-Maven | 9b769a4c84cb2d50c238c80bb80f3d33f5696bd8 | fc78025e838d971c2f5a73c248786b249e52ff55 | refs/heads/master | 2020-04-18T08:16:22.212000 | 2019-01-29T16:54:36 | 2019-01-29T16:54:36 | 167,390,483 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.app.dto;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
@Document(collection = "PersonBySpring")
public class Person {
//id will be used for storing MongoDB _id
@Id
@Field(value = "person_id")
private String id;
@Field(value = "person_name")
private String name;
@Field(value = "person_address")
private String address;
public Person(){}
public Person(String i, String n, String a){
this.id=i;
this.name=n;
this.address=a;
}
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 getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
/*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Person [id=" + id + ", name=" + name + ", address=" + address + "]";
}
}
| UTF-8 | Java | 1,087 | java | Person.java | Java | [] | null | [] | package com.app.dto;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
@Document(collection = "PersonBySpring")
public class Person {
//id will be used for storing MongoDB _id
@Id
@Field(value = "person_id")
private String id;
@Field(value = "person_name")
private String name;
@Field(value = "person_address")
private String address;
public Person(){}
public Person(String i, String n, String a){
this.id=i;
this.name=n;
this.address=a;
}
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 getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
/*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "Person [id=" + id + ", name=" + name + ", address=" + address + "]";
}
}
| 1,087 | 0.671573 | 0.671573 | 59 | 17.423729 | 17.924704 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.355932 | false | false | 13 |
52c83ce628a2e29586a5d8fb1be8083ad9dd5842 | 15,745,350,136,940 | 1a01e10a555efffdf57bf96249e460fbbf70f61a | /src/main/java/com/github/glue/mvc/general/DefaultContainer.java | 5b4d958003e2b9810f45fcf30e0ee1027ea5ac19 | [] | no_license | miemiebw/glue-mvc | https://github.com/miemiebw/glue-mvc | 888536ea60d82acd64ceada89e806c2ec74cf2ad | addafb5d822f84c559c2b2b4931b23cfa1f04cc4 | refs/heads/master | 2020-12-24T15:05:34.765000 | 2012-02-27T00:53:29 | 2012-02-27T00:53:29 | 2,916,470 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright Eric Lee.
*
* 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.github.glue.mvc.general;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.glue.mvc.Container;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/**
* @author Eric.Lee
*
*/
public class DefaultContainer implements Container {
private static final Logger log = LoggerFactory.getLogger( DefaultContainer.class );
private Map<String, Object> context = Maps.newLinkedHashMap();
/* (non-Javadoc)
* @see com.github.glue.mvc.IocContainer#getInstance(java.lang.Class)
*/
@Override
public <T> T getInstance(Class<T> type) {
for (Map.Entry<String, Object> entry : context.entrySet()) {
Object instance = entry.getValue();
if(type.isInstance(instance)){
return (T) instance;
}
}
try {
return type.newInstance();
} catch (Exception e) {
}
return null;
}
public <T> Set<T> getInstances(Class<T> type){
Set<T> instances = Sets.newLinkedHashSet();
for (Map.Entry<String, Object> entry : context.entrySet()) {
Object instance = entry.getValue();
if(type.isInstance(instance)){
instances.add((T) instance) ;
}
}
return instances;
}
public void bind(String id, Object instance){
context.put(id, instance);
log.debug("bind id:{}, instance:{}",id,instance);
}
}
| UTF-8 | Java | 1,924 | java | DefaultContainer.java | Java | [
{
"context": "/*\n * Copyright Eric Lee.\n *\n * Licensed under the Apache License, Version",
"end": 24,
"score": 0.9998246431350708,
"start": 16,
"tag": "NAME",
"value": "Eric Lee"
},
{
"context": "rt com.google.common.collect.Sets;\n\n/**\n * @author Eric.Lee\n *\n */\npublic class... | null | [] | /*
* Copyright <NAME>.
*
* 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.github.glue.mvc.general;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.github.glue.mvc.Container;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
/**
* @author Eric.Lee
*
*/
public class DefaultContainer implements Container {
private static final Logger log = LoggerFactory.getLogger( DefaultContainer.class );
private Map<String, Object> context = Maps.newLinkedHashMap();
/* (non-Javadoc)
* @see com.github.glue.mvc.IocContainer#getInstance(java.lang.Class)
*/
@Override
public <T> T getInstance(Class<T> type) {
for (Map.Entry<String, Object> entry : context.entrySet()) {
Object instance = entry.getValue();
if(type.isInstance(instance)){
return (T) instance;
}
}
try {
return type.newInstance();
} catch (Exception e) {
}
return null;
}
public <T> Set<T> getInstances(Class<T> type){
Set<T> instances = Sets.newLinkedHashSet();
for (Map.Entry<String, Object> entry : context.entrySet()) {
Object instance = entry.getValue();
if(type.isInstance(instance)){
instances.add((T) instance) ;
}
}
return instances;
}
public void bind(String id, Object instance){
context.put(id, instance);
log.debug("bind id:{}, instance:{}",id,instance);
}
}
| 1,922 | 0.706861 | 0.703742 | 74 | 25 | 24.419752 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.351351 | false | false | 13 |
956e72eda84c793424c0817ea2ce19e9e39562ed | 30,356,828,879,250 | 15bed4adf381b3c8b9927cf484d4b5fb202319e8 | /src/main/java/com/jcom/cms/controllers/HomeController.java | 679c1c3c04d0a4b99b440f5b2545a614d69783ae | [] | no_license | worldthem/ReactJsSpringBoot | https://github.com/worldthem/ReactJsSpringBoot | a0a5e30fa45bc34bc7451b8eb231b45f4125917f | 3b46e5f2b748b0de62dc180d43f02966b910990b | refs/heads/master | 2023-05-05T09:29:49.363000 | 2021-04-01T20:32:40 | 2021-04-01T20:32:40 | 353,815,674 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.jcom.cms.controllers;
import com.jcom.cms.dto.ListResponse;
import com.jcom.cms.entity.Page;
import com.jcom.cms.entity.Product;
import com.jcom.cms.hepers.Helpers;
import com.jcom.cms.services.DoShortCode;
import com.jcom.cms.services.PagesServices;
import com.jcom.cms.services.ProductService;
import com.jcom.cms.services.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
//@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/api/v1/")
public class HomeController {
@Autowired // This means to get the bean called userRepository
private PagesServices pagesServices;
@Autowired
private ProductService productService;
@Autowired
UsersService usersService;
@Autowired
private DoShortCode doShortCode;
@GetMapping("/homepage") // , produces = "application/json"
public ListResponse getdata() { //@PathVariable int id
ListResponse listResponse = new ListResponse();
int settingsPageHome = Helpers.getConfig().getMinOptions().getPageHome();
Long countU = usersService.count();
if (countU==0){
//return view("frontend::start/admin");
}
if(settingsPageHome >0){
Page page = pagesServices.getOne(settingsPageHome);
try{
listResponse.setTitle(page.getTitle());
listResponse.setMetad(page.getMetad());
listResponse.setMetak(page.getMetak());
listResponse.setCss(Helpers.generateCss(page.getStyle(), page.getCss()));
listResponse.setText(doShortCode.doshortcodes(page.getText()));
}catch (Exception e){}
}else{
/*
org.springframework.data.domain.Page<Product> products = productService.findAll(pagination(request, productService.count(), model, 30));
model.addAttribute("title", Helpers.getConfig().getMinOptions().getSite_title());
model.addAttribute("metad", Helpers.getConfig().getMinOptions().getMetad());
model.addAttribute("metak", Helpers.getConfig().getMinOptions().getMetak());
model.addAttribute("products", products);
*/
}
String view= settingsPageHome>0 ? "theme::pages" : "theme::home";
return listResponse;
}
}
| UTF-8 | Java | 2,424 | java | HomeController.java | Java | [] | null | [] | package com.jcom.cms.controllers;
import com.jcom.cms.dto.ListResponse;
import com.jcom.cms.entity.Page;
import com.jcom.cms.entity.Product;
import com.jcom.cms.hepers.Helpers;
import com.jcom.cms.services.DoShortCode;
import com.jcom.cms.services.PagesServices;
import com.jcom.cms.services.ProductService;
import com.jcom.cms.services.UsersService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.Map;
//@CrossOrigin(origins = "*")
@RestController
@RequestMapping("/api/v1/")
public class HomeController {
@Autowired // This means to get the bean called userRepository
private PagesServices pagesServices;
@Autowired
private ProductService productService;
@Autowired
UsersService usersService;
@Autowired
private DoShortCode doShortCode;
@GetMapping("/homepage") // , produces = "application/json"
public ListResponse getdata() { //@PathVariable int id
ListResponse listResponse = new ListResponse();
int settingsPageHome = Helpers.getConfig().getMinOptions().getPageHome();
Long countU = usersService.count();
if (countU==0){
//return view("frontend::start/admin");
}
if(settingsPageHome >0){
Page page = pagesServices.getOne(settingsPageHome);
try{
listResponse.setTitle(page.getTitle());
listResponse.setMetad(page.getMetad());
listResponse.setMetak(page.getMetak());
listResponse.setCss(Helpers.generateCss(page.getStyle(), page.getCss()));
listResponse.setText(doShortCode.doshortcodes(page.getText()));
}catch (Exception e){}
}else{
/*
org.springframework.data.domain.Page<Product> products = productService.findAll(pagination(request, productService.count(), model, 30));
model.addAttribute("title", Helpers.getConfig().getMinOptions().getSite_title());
model.addAttribute("metad", Helpers.getConfig().getMinOptions().getMetad());
model.addAttribute("metak", Helpers.getConfig().getMinOptions().getMetak());
model.addAttribute("products", products);
*/
}
String view= settingsPageHome>0 ? "theme::pages" : "theme::home";
return listResponse;
}
}
| 2,424 | 0.669142 | 0.666667 | 76 | 30.894737 | 30.096153 | 148 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565789 | false | false | 13 |
1d840f17e4a3c3bbb1d6559075d79764a53fd2c4 | 27,934,467,326,699 | 94fa81d14aad090a92c3991af8df5946f86223e3 | /src/main/java/de/prob2/jupyter/ProBKernelModule.java | 346f7a87d44c763e251397a9e52266fdba45d1c6 | [] | no_license | hhu-stups/prob2_jupyter_kernel | https://github.com/hhu-stups/prob2_jupyter_kernel | 0a4657bb60d190f80529be6fd6507e008ae8d43f | 2b50c3c76c597a251ffab1daf773e6ec5068d464 | refs/heads/master | 2023-05-30T17:52:06.706000 | 2021-06-08T21:33:23 | 2021-06-08T21:33:23 | 361,715,133 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.prob2.jupyter;
import com.google.inject.AbstractModule;
import de.prob.MainModule;
public final class ProBKernelModule extends AbstractModule {
@Override
protected void configure() {
install(new MainModule());
}
}
| UTF-8 | Java | 233 | java | ProBKernelModule.java | Java | [] | null | [] | package de.prob2.jupyter;
import com.google.inject.AbstractModule;
import de.prob.MainModule;
public final class ProBKernelModule extends AbstractModule {
@Override
protected void configure() {
install(new MainModule());
}
}
| 233 | 0.776824 | 0.772532 | 12 | 18.416666 | 18.621038 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false | 13 |
0be0f577a28f24ab8b67cb407d38562df6e2a9c4 | 26,139,171,029,945 | 37fe985518a0ca61d5f72b87bb2999bce8be4cbe | /order/src/main/java/servlet/OrderServlet.java | e7673609b4d70bef05acb6f308402844ef0b37d7 | [] | no_license | Randy-Lv/WebOrder | https://github.com/Randy-Lv/WebOrder | 492bf0b6c1638cc165720405ef37ef59af8fa3c2 | 7a558d81009c9c91a2cc7e37391fd8da473ef73d | refs/heads/master | 2020-03-20T12:57:56.794000 | 2018-06-15T03:25:26 | 2018-06-15T03:25:26 | 137,445,105 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package servlet;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.text.SimpleDateFormat;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.alibaba.fastjson.JSON;
/**
* Servlet implementation class OrderServlet
*/
@WebServlet(description = "WebSite", urlPatterns = { "/Add" })
public class OrderServlet extends HttpServlet {
private static Log log = LogFactory.getLog(OrderServlet.class);
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public OrderServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at1: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
String code = request.getParameter("code");
// 验证验证码
if (code == null) {
response.getWriter().println("验证失败!");
return;
}
if (request.getSession().getAttribute("code") == null) {
response.getWriter().println("验证码超时,请刷新验证码!");
}
String sessionCode = request.getSession().getAttribute("code").toString();
if (!code.equalsIgnoreCase(sessionCode)) {
response.getWriter().println("验证码输入错误!");
return;
}
Order order = new Order();
order.setTitle(request.getParameter("Title"));
order.setNum(request.getParameter("Num"));
order.setCompany(request.getParameter("Company"));
order.setUserName(request.getParameter("UserName"));
order.setMobile(request.getParameter("Mobile"));
order.setFax(request.getParameter("Fax"));
order.setRemark(request.getParameter("Remark"));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//order.CreateDate = dateFormat.format(new Date());
order.setCreateDate(new Date());
String id = UUID.randomUUID().toString();
String info = JSON.toJSONString(order);
log.info(info);
try {
Map<String, Order> map = new HashMap<String, Order>();
JedisHelper.AddOrderList(info);
// JedisHelper.AddOrder(id, serializeToString(order));
// JedisHelper.AddOrder(id, info);
// Object object= deserializeToObject(serializeToString(order));
// info = JedisHelper.GetOrderByKey(id);
// order =JSON.parseObject(info,Order.class);
// List<String> orders =JedisHelper.GetListOrders();
// for (String value : orders) {
// response.getWriter().append(value);
// }
response.getWriter().append("保存成功!");
} catch (Exception e) {
e.printStackTrace();
log.error(info);
response.getWriter().append("保存失败,请重新提交!");
}
}
// 序列化
public static String serializeToString(Object obj) throws Exception {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream objOut = new ObjectOutputStream(byteOut);
objOut.writeObject(obj);
String str = byteOut.toString("ISO-8859-1");// 此处只能是ISO-8859-1,但是不会影响中文使用
return str;
}
// 反序列化
public static <T> T deserializeToObject(String str) throws Exception {
ByteArrayInputStream byteIn = new ByteArrayInputStream(str.getBytes("ISO-8859-1"));
ObjectInputStream objIn = new ObjectInputStream(byteIn);
Object obj = objIn.readObject();
return (T) obj;
}
}
| UTF-8 | Java | 4,311 | java | OrderServlet.java | Java | [
{
"context": "any\"));\n\t\torder.setUserName(request.getParameter(\"UserName\"));\n\t\torder.setMobile(request.getParameter(\"Mobil",
"end": 2472,
"score": 0.9993031620979309,
"start": 2464,
"tag": "USERNAME",
"value": "UserName"
}
] | null | [] | package servlet;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.text.SimpleDateFormat;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.alibaba.fastjson.JSON;
/**
* Servlet implementation class OrderServlet
*/
@WebServlet(description = "WebSite", urlPatterns = { "/Add" })
public class OrderServlet extends HttpServlet {
private static Log log = LogFactory.getLog(OrderServlet.class);
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public OrderServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at1: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setHeader("Content-type", "text/html;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
String code = request.getParameter("code");
// 验证验证码
if (code == null) {
response.getWriter().println("验证失败!");
return;
}
if (request.getSession().getAttribute("code") == null) {
response.getWriter().println("验证码超时,请刷新验证码!");
}
String sessionCode = request.getSession().getAttribute("code").toString();
if (!code.equalsIgnoreCase(sessionCode)) {
response.getWriter().println("验证码输入错误!");
return;
}
Order order = new Order();
order.setTitle(request.getParameter("Title"));
order.setNum(request.getParameter("Num"));
order.setCompany(request.getParameter("Company"));
order.setUserName(request.getParameter("UserName"));
order.setMobile(request.getParameter("Mobile"));
order.setFax(request.getParameter("Fax"));
order.setRemark(request.getParameter("Remark"));
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//order.CreateDate = dateFormat.format(new Date());
order.setCreateDate(new Date());
String id = UUID.randomUUID().toString();
String info = JSON.toJSONString(order);
log.info(info);
try {
Map<String, Order> map = new HashMap<String, Order>();
JedisHelper.AddOrderList(info);
// JedisHelper.AddOrder(id, serializeToString(order));
// JedisHelper.AddOrder(id, info);
// Object object= deserializeToObject(serializeToString(order));
// info = JedisHelper.GetOrderByKey(id);
// order =JSON.parseObject(info,Order.class);
// List<String> orders =JedisHelper.GetListOrders();
// for (String value : orders) {
// response.getWriter().append(value);
// }
response.getWriter().append("保存成功!");
} catch (Exception e) {
e.printStackTrace();
log.error(info);
response.getWriter().append("保存失败,请重新提交!");
}
}
// 序列化
public static String serializeToString(Object obj) throws Exception {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream objOut = new ObjectOutputStream(byteOut);
objOut.writeObject(obj);
String str = byteOut.toString("ISO-8859-1");// 此处只能是ISO-8859-1,但是不会影响中文使用
return str;
}
// 反序列化
public static <T> T deserializeToObject(String str) throws Exception {
ByteArrayInputStream byteIn = new ByteArrayInputStream(str.getBytes("ISO-8859-1"));
ObjectInputStream objIn = new ObjectInputStream(byteIn);
Object obj = objIn.readObject();
return (T) obj;
}
}
| 4,311 | 0.736161 | 0.731368 | 133 | 30.37594 | 24.107092 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.954887 | false | false | 13 |
8d3a77a77892da73be663aca401c1a25d91bfa0e | 14,070,312,925,762 | e7213d7d74436d1167d2e4f005923f3472633be2 | /src/main/files/MainFiles1.java | d41cedc7c7e31d434ac8946f846603195120171e | [] | no_license | AntonovaL/IntershipTasks | https://github.com/AntonovaL/IntershipTasks | b7116be9756a8b9b37978aa60a9675e133b99915 | fc3857fcd2c39a6f85c5a2418ed077475a23f603 | refs/heads/master | 2020-05-02T22:25:31.437000 | 2019-04-01T12:48:58 | 2019-04-01T12:48:58 | 178,251,279 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package main.files;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedList;
import java.io.File;
import io.tools.Getter;
import io.tools.Printer;
public class MainFiles1 {
public static void main(String[] args) throws IOException {
File file = new File("C:\\Users\\Лиля\\IdeaProjects\\TestProject\\src\\text.txt");
FileInputStream fis = null;
try{
fis = new FileInputStream(file);
LinkedList<String> stringList = new LinkedList<>();
Getter getter=new Getter(fis);
stringList=getter.read();
Printer pr=new Printer(System.out,"\n");
pr.printInReverceOrder(stringList);
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (fis != null) {
fis.close();
}
}
}
}
| UTF-8 | Java | 934 | java | MainFiles1.java | Java | [
{
"context": "eption {\n File file = new File(\"C:\\\\Users\\\\Лиля\\\\IdeaProjects\\\\TestProject\\\\src\\\\text.txt\");\n ",
"end": 354,
"score": 0.9983550906181335,
"start": 350,
"tag": "NAME",
"value": "Лиля"
}
] | null | [] | package main.files;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.LinkedList;
import java.io.File;
import io.tools.Getter;
import io.tools.Printer;
public class MainFiles1 {
public static void main(String[] args) throws IOException {
File file = new File("C:\\Users\\Лиля\\IdeaProjects\\TestProject\\src\\text.txt");
FileInputStream fis = null;
try{
fis = new FileInputStream(file);
LinkedList<String> stringList = new LinkedList<>();
Getter getter=new Getter(fis);
stringList=getter.read();
Printer pr=new Printer(System.out,"\n");
pr.printInReverceOrder(stringList);
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (fis != null) {
fis.close();
}
}
}
}
| 934 | 0.606452 | 0.605376 | 31 | 29 | 20.356501 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.612903 | false | false | 13 |
e2169cb7ce5d1893bdc3a7e4e2f0f0d3938ef8a4 | 171,798,700,312 | 22ee5bfe3e32debffe9964495644daf5d08b2a97 | /app/src/main/java/org/igarape/copcast/service/StreamService.java | ab8f5bf60b3584531d3cb355e0e3b96fa464323e | [] | no_license | rodrigogivisiez/copcast-android | https://github.com/rodrigogivisiez/copcast-android | 29eebad94751b743df57479368ed80f127d9f680 | dca135fb0372b0f9327cf5aeee1f1c8f3cb9c286 | refs/heads/develop | 2017-04-30T17:27:56.421000 | 2016-01-19T13:57:38 | 2016-01-19T13:57:38 | 52,549,752 | 1 | 0 | null | true | 2016-02-25T19:08:09 | 2016-02-25T19:08:09 | 2016-01-13T16:29:35 | 2016-02-24T15:16:14 | 15,949 | 0 | 0 | 0 | null | null | null | package org.igarape.copcast.service;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.media.CamcorderProfile;
import android.opengl.GLSurfaceView;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.view.Gravity;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.WindowManager;
import org.igarape.copcast.R;
import org.igarape.copcast.utils.Globals;
import org.igarape.copcast.views.MainActivity;
import org.webrtc.MediaStream;
import org.webrtc.RendererCommon;
import org.webrtc.VideoRenderer;
import org.webrtc.VideoRendererGui;
import webrtcclient.PeerConnectionParameters;
import webrtcclient.WebRtcClient;
/**
* Created by bruno on 11/19/14.
*/
public class StreamService extends Service implements SurfaceHolder.Callback, WebRtcClient.RtcListener {
private WebRtcClient client;
private static final String VIDEO_CODEC_VP9 = "VP9";
private static final String AUDIO_CODEC_OPUS = "opus";
private int mId = 5;
private WindowManager mWindowManager;
private SurfaceView mSurfaceView;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent == null){
stopSelf();
return START_STICKY;
}
Intent resultIntent = new Intent(this, MainActivity.class);
Context context = getApplicationContext();
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setContentTitle(getString(R.string.notification_stream_title))
.setContentText(getString(R.string.notification_stream_description))
.setSmallIcon(R.drawable.ic_launcher)
.setOngoing(true);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
stackBuilder.addParentStack(MainActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_NO_CREATE
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(mId, mBuilder.build());
// Create new SurfaceView, set its size to 1x1, move it to the top left corner and set this service as a callback
mWindowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
mSurfaceView = new SurfaceView(this);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
1, 1,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT
);
layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
mWindowManager.addView(mSurfaceView, layoutParams);
mSurfaceView.getHolder().addCallback(this);
return START_STICKY;
}
private void init() {
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
PeerConnectionParameters params = new PeerConnectionParameters(
true, false, profile.videoFrameWidth, profile.videoFrameHeight, 15, 1, VIDEO_CODEC_VP9, true, 1, AUDIO_CODEC_OPUS, true);
client = new WebRtcClient(this, Globals.getServerUrl(getApplicationContext()), params, Globals.getAccessTokenStraight(getApplicationContext()));
}
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
init();
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
if (Globals.isToggling()){
Globals.setToggling(false);
Intent intentAux = new Intent(this, VideoRecorderService.class);
intentAux.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startService(intentAux);
}
}
@Override
public void onDestroy() {
if(client != null) {
client.onDestroy();
if (mSurfaceView != null) {
mWindowManager.removeView(mSurfaceView);
}
}
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(mId);
super.onDestroy();
}
@Override
public void onCallReady(String callId) {
client.start("android_test");
}
@Override
public void onStatusChanged(String newStatus) {
}
@Override
public void onLocalStream(MediaStream localStream) {
}
} | UTF-8 | Java | 5,222 | java | StreamService.java | Java | [
{
"context": "ort webrtcclient.WebRtcClient;\n\n\n/**\n * Created by bruno on 11/19/14.\n */\npublic class StreamService exten",
"end": 933,
"score": 0.9912790656089783,
"start": 928,
"tag": "USERNAME",
"value": "bruno"
}
] | null | [] | package org.igarape.copcast.service;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.media.CamcorderProfile;
import android.opengl.GLSurfaceView;
import android.os.IBinder;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.TaskStackBuilder;
import android.view.Gravity;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.WindowManager;
import org.igarape.copcast.R;
import org.igarape.copcast.utils.Globals;
import org.igarape.copcast.views.MainActivity;
import org.webrtc.MediaStream;
import org.webrtc.RendererCommon;
import org.webrtc.VideoRenderer;
import org.webrtc.VideoRendererGui;
import webrtcclient.PeerConnectionParameters;
import webrtcclient.WebRtcClient;
/**
* Created by bruno on 11/19/14.
*/
public class StreamService extends Service implements SurfaceHolder.Callback, WebRtcClient.RtcListener {
private WebRtcClient client;
private static final String VIDEO_CODEC_VP9 = "VP9";
private static final String AUDIO_CODEC_OPUS = "opus";
private int mId = 5;
private WindowManager mWindowManager;
private SurfaceView mSurfaceView;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent == null){
stopSelf();
return START_STICKY;
}
Intent resultIntent = new Intent(this, MainActivity.class);
Context context = getApplicationContext();
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context)
.setContentTitle(getString(R.string.notification_stream_title))
.setContentText(getString(R.string.notification_stream_description))
.setSmallIcon(R.drawable.ic_launcher)
.setOngoing(true);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
stackBuilder.addParentStack(MainActivity.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent =
stackBuilder.getPendingIntent(
0,
PendingIntent.FLAG_NO_CREATE
);
mBuilder.setContentIntent(resultPendingIntent);
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// mId allows you to update the notification later on.
mNotificationManager.notify(mId, mBuilder.build());
// Create new SurfaceView, set its size to 1x1, move it to the top left corner and set this service as a callback
mWindowManager = (WindowManager) this.getSystemService(Context.WINDOW_SERVICE);
mSurfaceView = new SurfaceView(this);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams(
1, 1,
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT
);
layoutParams.gravity = Gravity.LEFT | Gravity.TOP;
mWindowManager.addView(mSurfaceView, layoutParams);
mSurfaceView.getHolder().addCallback(this);
return START_STICKY;
}
private void init() {
CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
PeerConnectionParameters params = new PeerConnectionParameters(
true, false, profile.videoFrameWidth, profile.videoFrameHeight, 15, 1, VIDEO_CODEC_VP9, true, 1, AUDIO_CODEC_OPUS, true);
client = new WebRtcClient(this, Globals.getServerUrl(getApplicationContext()), params, Globals.getAccessTokenStraight(getApplicationContext()));
}
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
init();
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
if (Globals.isToggling()){
Globals.setToggling(false);
Intent intentAux = new Intent(this, VideoRecorderService.class);
intentAux.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startService(intentAux);
}
}
@Override
public void onDestroy() {
if(client != null) {
client.onDestroy();
if (mSurfaceView != null) {
mWindowManager.removeView(mSurfaceView);
}
}
NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.cancel(mId);
super.onDestroy();
}
@Override
public void onCallReady(String callId) {
client.start("android_test");
}
@Override
public void onStatusChanged(String newStatus) {
}
@Override
public void onLocalStream(MediaStream localStream) {
}
} | 5,222 | 0.688817 | 0.684412 | 159 | 31.849056 | 29.553318 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.603774 | false | false | 13 |
a49d08fa1c7460ab57c1a22d08d5e2ab5299f7fa | 3,856,880,640,364 | c11aa4aed8ae1e8cf55fbaed8e3a49337dc5ca8f | /sourcecode/medicalB/medical-common-bundle/src/main/java/com/netbull/shop/dao/HDao.java | c50a0ddb018926e9aaa13017059180ce2c9ac26c | [] | no_license | zdxue/medicalB | https://github.com/zdxue/medicalB | 9adbf859c505442bb44c7fc978bdd1aa08c427df | a5e0cb01cd3ca6e47b20d9b2b76d7525adda548e | refs/heads/master | 2016-08-08T05:52:18.185000 | 2015-08-05T01:28:14 | 2015-08-05T01:28:14 | 37,568,483 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.netbull.shop.dao;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import com.netbull.shop.util.PageBean;
@SuppressWarnings("unchecked")
public class HDao implements IDao {
private static final Log logger = LogFactory.getLog(HDao.class);
private SessionFactory sessionFactory;
private ThreadLocal<Session> localSession = new ThreadLocal<Session>();
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public Session currentSession() {
Session session = localSession.get();
if (session == null || !session.isOpen()) {
session = sessionFactory.openSession();
localSession.set(session);
}
return session;
}
public boolean closeSessionIfNecessary() {
Session session = localSession.get();
if (session != null && session.isOpen()
&& !session.getTransaction().isActive()) {
session.close();
return true;
}
return false;
}
public <T> T doInTx(Atom atom) {
Object ret = null;
Transaction tx = currentSession().getTransaction();
boolean isAlreadyActive = tx.isActive();
if (!isAlreadyActive) {
tx.begin();
}
try {
ret = atom.exec();
if (!isAlreadyActive) {
tx.commit();
}
} catch (Exception e) {
if (!isAlreadyActive) {
logger.info("rollback for " + e.getMessage());
tx.rollback();
}
throw new RuntimeException(e);
} finally {
closeSessionIfNecessary();
}
return (T) ret;
}
public void save(final Object entity) {
doInTx(new Atom() {
public Object exec() {
currentSession().saveOrUpdate(entity);
return entity;
}
});
}
public void update(final Object entity) {
doInTx(new Atom() {
public Object exec() {
currentSession().update(entity);
return entity;
}
});
}
public void delete(final Object entity) {
doInTx(new Atom() {
public Object exec() {
currentSession().delete(entity);
return entity;
}
});
}
public int bulkUpdate(final String hql, final Object... values) {
return doInTx(new Atom() {
public Object exec() {
Query query = currentSession().createQuery(hql);
setQueryParam(query, values);
return query.executeUpdate();
}
});
}
public int bulkUpdateBySQL(final String sql, final Object... values) {
return doInTx(new Atom() {
public Object exec() {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, values);
return query.executeUpdate();
}
});
}
public <T> T get(Class<T> clazz, Serializable id) {
if (id == null) {
return null;
}
try {
return (T) currentSession().get(clazz, id);
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> find(String hql, Object... values) {
try {
Query query = currentSession().createQuery(hql);
setQueryParam(query, values);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> find(String hql, String[] paramNames, Object[] params) {
try {
Query query = currentSession().createQuery(hql);
setQueryParam(query, paramNames, params);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> T findSingle(String hql, Object... values) {
try {
Query query = currentSession().createQuery(hql);
setQueryParam(query, values);
return (T) query.uniqueResult();
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> findBySQL(String sql, Object... values) {
try {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, values);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> findBySQL(String sql, String[] paramNames,
Object[] params) {
try {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, paramNames, params);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> T findSingleBySQL(String sql, Object... values) {
try {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, values);
T ret = (T) query.uniqueResult();
return ret;
} finally {
closeSessionIfNecessary();
}
}
public <T> PageBean<T> find(PageBean<T> pageBean, String hql,
Object... values) {
try {
Query query = currentSession().createQuery(hql);
Query countQuery = currentSession().createQuery(toCountHQL(hql));
setQueryParam(query, values);
setQueryParam(countQuery, values);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public <T> PageBean<T> find(PageBean<T> pageBean, String hql,
String[] paramNames, Object[] params) {
try {
Query query = currentSession().createQuery(hql);
Query countQuery = currentSession().createQuery(toCountHQL(hql));
setQueryParam(query, paramNames, params);
setQueryParam(countQuery, paramNames, params);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public synchronized <T> PageBean<T> findDistinctHql(PageBean<T> pageBean, String indexString,String hql,
Object... values) {
Query query = currentSession().createQuery(hql);
Query countQuery = currentSession().createQuery(toCountDistinctHQL(indexString,hql));
setQueryParam(query, values);
setQueryParam(countQuery, values);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
}
public synchronized <T> PageBean<T> findBySQL(PageBean<T> pageBean, String sql,
Object... values) {
try {
Query query = currentSession().createSQLQuery(sql);
Query countQuery = currentSession().createSQLQuery(toCountSQL(sql));
setQueryParam(query, values);
setQueryParam(countQuery, values);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public synchronized <T> PageBean<T> findBySQL(PageBean<T> pageBean, String sql,
String[] paramNames, Object[] params) {
try {
Query query = currentSession().createSQLQuery(sql);
Query countQuery = currentSession().createSQLQuery(toCountSQL(sql));
setQueryParam(query, paramNames, params);
setQueryParam(countQuery, paramNames, params);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public long getCount(Object obj) {
if (obj instanceof Object[]) {
return getCount(((Object[]) obj)[0]);
}
if (obj instanceof List) {
return getCount(((List<?>) obj).get(0));
}
if (obj instanceof Number) {
Number count = (Number) obj;
return count.longValue();
}
return 0;
}
public String toCountHQL(String hql) {
if (null == hql || hql.trim().equals(""))
return "";
String formatQl = hql;
String pStr = "^\\s*((s|S)(e|E)(l|L)(e|E)(c|C)(t|T))?(.*?)(f|F)(r|R)(o|O)(m|M)\\s";
String pOrderStr = "\\s*(o|O)(r|R)(d|D)(e|E)(r|R)\\s+(b|B)(y|Y).*$";
Pattern p = Pattern.compile(pStr, Pattern.DOTALL);
Matcher m = p.matcher(hql);
if (m.find()) {
StringBuffer countHeader = new StringBuffer("SELECT COUNT(*)");
if (m.group(8) != null && !m.group(8).trim().equals("")) {
countHeader.append(", " + m.group(8).trim());
}
countHeader.append(" FROM ");
formatQl = formatQl.replaceFirst(pStr, countHeader.toString());
}
formatQl = formatQl.replaceFirst(pOrderStr, "");
return formatQl;
}
public String toCountDistinctHQL(String indexString, String hql) {
if (null == hql || hql.trim().equals(""))
return "";
String formatQl = hql;
String pStr = "^\\s*((s|S)(e|E)(l|L)(e|E)(c|C)(t|T))?(.*?)(f|F)(r|R)(o|O)(m|M)\\s";
String pOrderStr = "\\s*(o|O)(r|R)(d|D)(e|E)(r|R)\\s+(b|B)(y|Y).*$";
Pattern p = Pattern.compile(pStr, Pattern.DOTALL);
Matcher m = p.matcher(hql);
if (m.find()) {
StringBuffer countHeader = new StringBuffer(indexString);
countHeader.append(" FROM ");
formatQl = formatQl.replaceFirst(pStr, countHeader.toString());
}
formatQl = formatQl.replaceFirst(pOrderStr, "");
return formatQl;
}
public String toCountSQL(String sql) {
if (null == sql || sql.trim().equals(""))
return "";
return "SELECT COUNT(*) FROM (" + sql + ") as COUNT";
}
public void setQueryParam(Query query, Object... values) {
for (int i = 0; i < values.length; i++) {
query.setParameter(i, values[i]);
}
}
public void setQueryParam(Query query, String[] paramNames, Object[] params) {
if (paramNames == null || params == null)
return;
for (int i = 0; i < paramNames.length && i < params.length; i++) {
query.setParameter(paramNames[i], params[i]);
}
}
public void setListQueryParam(Query query, String[] listParamNames,
Collection<?>[] listParams) {
if (listParamNames == null || listParams == null)
return;
for (int i = 0; i < listParamNames.length; i++) {
query.setParameterList(listParamNames[i], listParams[i]);
}
}
} | UTF-8 | Java | 10,028 | java | HDao.java | Java | [] | null | [] | package com.netbull.shop.dao;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import com.netbull.shop.util.PageBean;
@SuppressWarnings("unchecked")
public class HDao implements IDao {
private static final Log logger = LogFactory.getLog(HDao.class);
private SessionFactory sessionFactory;
private ThreadLocal<Session> localSession = new ThreadLocal<Session>();
public SessionFactory getSessionFactory() {
return sessionFactory;
}
public void setSessionFactory(SessionFactory sessionFactory) {
this.sessionFactory = sessionFactory;
}
public Session currentSession() {
Session session = localSession.get();
if (session == null || !session.isOpen()) {
session = sessionFactory.openSession();
localSession.set(session);
}
return session;
}
public boolean closeSessionIfNecessary() {
Session session = localSession.get();
if (session != null && session.isOpen()
&& !session.getTransaction().isActive()) {
session.close();
return true;
}
return false;
}
public <T> T doInTx(Atom atom) {
Object ret = null;
Transaction tx = currentSession().getTransaction();
boolean isAlreadyActive = tx.isActive();
if (!isAlreadyActive) {
tx.begin();
}
try {
ret = atom.exec();
if (!isAlreadyActive) {
tx.commit();
}
} catch (Exception e) {
if (!isAlreadyActive) {
logger.info("rollback for " + e.getMessage());
tx.rollback();
}
throw new RuntimeException(e);
} finally {
closeSessionIfNecessary();
}
return (T) ret;
}
public void save(final Object entity) {
doInTx(new Atom() {
public Object exec() {
currentSession().saveOrUpdate(entity);
return entity;
}
});
}
public void update(final Object entity) {
doInTx(new Atom() {
public Object exec() {
currentSession().update(entity);
return entity;
}
});
}
public void delete(final Object entity) {
doInTx(new Atom() {
public Object exec() {
currentSession().delete(entity);
return entity;
}
});
}
public int bulkUpdate(final String hql, final Object... values) {
return doInTx(new Atom() {
public Object exec() {
Query query = currentSession().createQuery(hql);
setQueryParam(query, values);
return query.executeUpdate();
}
});
}
public int bulkUpdateBySQL(final String sql, final Object... values) {
return doInTx(new Atom() {
public Object exec() {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, values);
return query.executeUpdate();
}
});
}
public <T> T get(Class<T> clazz, Serializable id) {
if (id == null) {
return null;
}
try {
return (T) currentSession().get(clazz, id);
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> find(String hql, Object... values) {
try {
Query query = currentSession().createQuery(hql);
setQueryParam(query, values);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> find(String hql, String[] paramNames, Object[] params) {
try {
Query query = currentSession().createQuery(hql);
setQueryParam(query, paramNames, params);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> T findSingle(String hql, Object... values) {
try {
Query query = currentSession().createQuery(hql);
setQueryParam(query, values);
return (T) query.uniqueResult();
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> findBySQL(String sql, Object... values) {
try {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, values);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> List<T> findBySQL(String sql, String[] paramNames,
Object[] params) {
try {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, paramNames, params);
return query.list();
} finally {
closeSessionIfNecessary();
}
}
public <T> T findSingleBySQL(String sql, Object... values) {
try {
Query query = currentSession().createSQLQuery(sql);
setQueryParam(query, values);
T ret = (T) query.uniqueResult();
return ret;
} finally {
closeSessionIfNecessary();
}
}
public <T> PageBean<T> find(PageBean<T> pageBean, String hql,
Object... values) {
try {
Query query = currentSession().createQuery(hql);
Query countQuery = currentSession().createQuery(toCountHQL(hql));
setQueryParam(query, values);
setQueryParam(countQuery, values);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public <T> PageBean<T> find(PageBean<T> pageBean, String hql,
String[] paramNames, Object[] params) {
try {
Query query = currentSession().createQuery(hql);
Query countQuery = currentSession().createQuery(toCountHQL(hql));
setQueryParam(query, paramNames, params);
setQueryParam(countQuery, paramNames, params);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public synchronized <T> PageBean<T> findDistinctHql(PageBean<T> pageBean, String indexString,String hql,
Object... values) {
Query query = currentSession().createQuery(hql);
Query countQuery = currentSession().createQuery(toCountDistinctHQL(indexString,hql));
setQueryParam(query, values);
setQueryParam(countQuery, values);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
}
public synchronized <T> PageBean<T> findBySQL(PageBean<T> pageBean, String sql,
Object... values) {
try {
Query query = currentSession().createSQLQuery(sql);
Query countQuery = currentSession().createSQLQuery(toCountSQL(sql));
setQueryParam(query, values);
setQueryParam(countQuery, values);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public synchronized <T> PageBean<T> findBySQL(PageBean<T> pageBean, String sql,
String[] paramNames, Object[] params) {
try {
Query query = currentSession().createSQLQuery(sql);
Query countQuery = currentSession().createSQLQuery(toCountSQL(sql));
setQueryParam(query, paramNames, params);
setQueryParam(countQuery, paramNames, params);
Object obj = countQuery.uniqueResult();
pageBean.setCount(getCount(obj));
query.setFirstResult(pageBean.getStart());
query.setMaxResults(pageBean.getLimit());
pageBean.setData(query.list());
return pageBean;
} finally {
closeSessionIfNecessary();
}
}
public long getCount(Object obj) {
if (obj instanceof Object[]) {
return getCount(((Object[]) obj)[0]);
}
if (obj instanceof List) {
return getCount(((List<?>) obj).get(0));
}
if (obj instanceof Number) {
Number count = (Number) obj;
return count.longValue();
}
return 0;
}
public String toCountHQL(String hql) {
if (null == hql || hql.trim().equals(""))
return "";
String formatQl = hql;
String pStr = "^\\s*((s|S)(e|E)(l|L)(e|E)(c|C)(t|T))?(.*?)(f|F)(r|R)(o|O)(m|M)\\s";
String pOrderStr = "\\s*(o|O)(r|R)(d|D)(e|E)(r|R)\\s+(b|B)(y|Y).*$";
Pattern p = Pattern.compile(pStr, Pattern.DOTALL);
Matcher m = p.matcher(hql);
if (m.find()) {
StringBuffer countHeader = new StringBuffer("SELECT COUNT(*)");
if (m.group(8) != null && !m.group(8).trim().equals("")) {
countHeader.append(", " + m.group(8).trim());
}
countHeader.append(" FROM ");
formatQl = formatQl.replaceFirst(pStr, countHeader.toString());
}
formatQl = formatQl.replaceFirst(pOrderStr, "");
return formatQl;
}
public String toCountDistinctHQL(String indexString, String hql) {
if (null == hql || hql.trim().equals(""))
return "";
String formatQl = hql;
String pStr = "^\\s*((s|S)(e|E)(l|L)(e|E)(c|C)(t|T))?(.*?)(f|F)(r|R)(o|O)(m|M)\\s";
String pOrderStr = "\\s*(o|O)(r|R)(d|D)(e|E)(r|R)\\s+(b|B)(y|Y).*$";
Pattern p = Pattern.compile(pStr, Pattern.DOTALL);
Matcher m = p.matcher(hql);
if (m.find()) {
StringBuffer countHeader = new StringBuffer(indexString);
countHeader.append(" FROM ");
formatQl = formatQl.replaceFirst(pStr, countHeader.toString());
}
formatQl = formatQl.replaceFirst(pOrderStr, "");
return formatQl;
}
public String toCountSQL(String sql) {
if (null == sql || sql.trim().equals(""))
return "";
return "SELECT COUNT(*) FROM (" + sql + ") as COUNT";
}
public void setQueryParam(Query query, Object... values) {
for (int i = 0; i < values.length; i++) {
query.setParameter(i, values[i]);
}
}
public void setQueryParam(Query query, String[] paramNames, Object[] params) {
if (paramNames == null || params == null)
return;
for (int i = 0; i < paramNames.length && i < params.length; i++) {
query.setParameter(paramNames[i], params[i]);
}
}
public void setListQueryParam(Query query, String[] listParamNames,
Collection<?>[] listParams) {
if (listParamNames == null || listParams == null)
return;
for (int i = 0; i < listParamNames.length; i++) {
query.setParameterList(listParamNames[i], listParams[i]);
}
}
} | 10,028 | 0.675509 | 0.674611 | 362 | 26.70442 | 21.943636 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.781768 | false | false | 13 |
2e55796738eb3da029ac0dbcea067f85bbef481b | 13,271,449,001,126 | 8cb83c54d56ca1e13b6b64f07fb909865370f523 | /BulletHell/src/Main/Life.java | 92c77bb6d259d4cb27b99b5a6eafc3e01a8e13a9 | [] | no_license | Soul327/BulletHell | https://github.com/Soul327/BulletHell | aa3193afe5283730ab30533a4495f6913f3330cd | c785e98180d81e3518dea01491924f68d7b99a41 | refs/heads/master | 2022-11-17T00:27:01.136000 | 2020-07-18T17:51:56 | 2020-07-18T17:51:56 | 268,769,197 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package Main;
import java.awt.Color;
import java.util.ArrayList;
import Misc.Graphics;
public class Life {
static double scale = 4;
public static double spreadChance = .07;
public static Cell[][] cell = new Cell[(int)Math.round(Main.width/scale)][(int)Math.round(Main.height/scale)];
public Life() {
init();
}
public void init() {
spreadChance -= .001;
System.out.println(spreadChance + " " + gen);
gen = 0;
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++) {
Cell cel = new Cell(x,y);
if(Math.random()<.1) {
cel.alive = true;
if(Math.random()<.01)
cel.infected = true;
}
cell[x][y] = cel;
}
}
int tick = 0,gen=0;
public void tick() {
/*
if(tick>Main.maxFPS/60) {
tick = 0;
generationTick();
}
tick++;
//*/
generationTick();
}
public int getAliveCells() {
int re = 0;
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++)
if(cell[x][y].alive) re++;
return re;
}
boolean threadTick = false;
public void generationTick() {
gen ++;
if(threadTick) {
for(int x = 0;x < cell.length;x++)
new ThreadTick(cell[x]).start();
} else {
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++)
cell[x][y].generationTick();
}
if(getAliveCells()<25)
init();
}
boolean threadRender = true;
public void render(Graphics g) {
if(threadRender) {
for(int x = 0;x < cell.length;x++)
threadRender(g,x,cell[x]);
} else {
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++) {
if(cell[x][y].alive) {
g.setColor(Color.green);
g.fillRect(x*scale, y*scale, scale, scale);
}
g.setColor(Color.green.darker());
//g.drawRect(x*scale, y*scale, scale, scale);
}
}
}
public void threadRender(Graphics g,int x,Cell[] cells) {
for(int y = 0;y < cell[x].length;y++)
if(cell[x][y].alive) {
g.setColor(Color.green);
if(cell[x][y].infected)
g.setColor(Color.magenta);
g.fillRect(x*scale, y*scale, scale, scale);
}
}
}
class ThreadTick extends Thread {
Cell[] cells;
ThreadTick(Cell[] cells) {
this.cells = cells;
}
public void run() {
for(Cell c:cells)
c.getAdjacent();
}
}
class Cell{
boolean alive = false, infected = false;
int x, y;
public Cell(int x, int y) {
this.x = x;
this.y = y;
}
public void generationTick() {
int adj = getAdjacent();
//Cells with 0 or 1 neighbors die of loneliness
//Cells with 2 or 3 neighbors survive
//Cells with 4 or more neighbors die of overcrowding
//Cells with exactly 3 neighbors come back to life
if(alive) {
getAdjacentInfect();
if(infected & Math.random()<.1) {
alive = false;
infected = false;
return;
}
if(adj<=1) alive = false;
if(adj>=4) alive = false;
} else {
if(adj==3) alive = true;
}
}
public int getAdjacent() {
int re = 0;
//1 2 3
//4 . 5
//6 7 8
if(x-1>=0 & y-1>=0)
if(Life.cell[x-1][y-1].alive) re++;//1
if(y-1>=0)
if(Life.cell[x ][y-1].alive) re++;//2
if(x+1<Life.cell.length & y-1>=0)
if(Life.cell[x+1][y-1].alive) re++;//3
if(x-1>=0)
if(Life.cell[x-1][y ].alive) re++;//4
if(x+1<Life.cell.length)
if(Life.cell[x+1][y ].alive) re++;//5
if(x-1>=0 & y+1<Life.cell[x].length)
if(Life.cell[x-1][y+1].alive) re++;//6
if(y+1<Life.cell[x].length)
if(Life.cell[x ][y+1].alive) re++;//7
if(x+1<Life.cell.length & y+1<Life.cell[x].length)
if(Life.cell[x+1][y+1].alive) re++;//8
return re;
}
public void getAdjacentInfect() {
//1 2 3
//4 . 5
//6 7 8
if(x-1>=0 & y-1>=0)
if(Life.cell[x-1][y-1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//1
if(y-1>=0)
if(Life.cell[x ][y-1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//2
if(x+1<Life.cell.length & y-1>=0)
if(Life.cell[x+1][y-1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//3
if(x-1>=0)
if(Life.cell[x-1][y ].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//4
if(x+1<Life.cell.length)
if(Life.cell[x+1][y ].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//5
if(x-1>=0 & y+1<Life.cell[x].length)
if(Life.cell[x-1][y+1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//6
if(y+1<Life.cell[x].length)
if(Life.cell[x ][y+1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//7
if(x+1<Life.cell.length & y+1<Life.cell[x].length)
if(Life.cell[x+1][y+1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//8
}
}
| UTF-8 | Java | 4,894 | java | Life.java | Java | [] | null | [] | package Main;
import java.awt.Color;
import java.util.ArrayList;
import Misc.Graphics;
public class Life {
static double scale = 4;
public static double spreadChance = .07;
public static Cell[][] cell = new Cell[(int)Math.round(Main.width/scale)][(int)Math.round(Main.height/scale)];
public Life() {
init();
}
public void init() {
spreadChance -= .001;
System.out.println(spreadChance + " " + gen);
gen = 0;
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++) {
Cell cel = new Cell(x,y);
if(Math.random()<.1) {
cel.alive = true;
if(Math.random()<.01)
cel.infected = true;
}
cell[x][y] = cel;
}
}
int tick = 0,gen=0;
public void tick() {
/*
if(tick>Main.maxFPS/60) {
tick = 0;
generationTick();
}
tick++;
//*/
generationTick();
}
public int getAliveCells() {
int re = 0;
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++)
if(cell[x][y].alive) re++;
return re;
}
boolean threadTick = false;
public void generationTick() {
gen ++;
if(threadTick) {
for(int x = 0;x < cell.length;x++)
new ThreadTick(cell[x]).start();
} else {
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++)
cell[x][y].generationTick();
}
if(getAliveCells()<25)
init();
}
boolean threadRender = true;
public void render(Graphics g) {
if(threadRender) {
for(int x = 0;x < cell.length;x++)
threadRender(g,x,cell[x]);
} else {
for(int x = 0;x < cell.length;x++)
for(int y = 0;y < cell[x].length;y++) {
if(cell[x][y].alive) {
g.setColor(Color.green);
g.fillRect(x*scale, y*scale, scale, scale);
}
g.setColor(Color.green.darker());
//g.drawRect(x*scale, y*scale, scale, scale);
}
}
}
public void threadRender(Graphics g,int x,Cell[] cells) {
for(int y = 0;y < cell[x].length;y++)
if(cell[x][y].alive) {
g.setColor(Color.green);
if(cell[x][y].infected)
g.setColor(Color.magenta);
g.fillRect(x*scale, y*scale, scale, scale);
}
}
}
class ThreadTick extends Thread {
Cell[] cells;
ThreadTick(Cell[] cells) {
this.cells = cells;
}
public void run() {
for(Cell c:cells)
c.getAdjacent();
}
}
class Cell{
boolean alive = false, infected = false;
int x, y;
public Cell(int x, int y) {
this.x = x;
this.y = y;
}
public void generationTick() {
int adj = getAdjacent();
//Cells with 0 or 1 neighbors die of loneliness
//Cells with 2 or 3 neighbors survive
//Cells with 4 or more neighbors die of overcrowding
//Cells with exactly 3 neighbors come back to life
if(alive) {
getAdjacentInfect();
if(infected & Math.random()<.1) {
alive = false;
infected = false;
return;
}
if(adj<=1) alive = false;
if(adj>=4) alive = false;
} else {
if(adj==3) alive = true;
}
}
public int getAdjacent() {
int re = 0;
//1 2 3
//4 . 5
//6 7 8
if(x-1>=0 & y-1>=0)
if(Life.cell[x-1][y-1].alive) re++;//1
if(y-1>=0)
if(Life.cell[x ][y-1].alive) re++;//2
if(x+1<Life.cell.length & y-1>=0)
if(Life.cell[x+1][y-1].alive) re++;//3
if(x-1>=0)
if(Life.cell[x-1][y ].alive) re++;//4
if(x+1<Life.cell.length)
if(Life.cell[x+1][y ].alive) re++;//5
if(x-1>=0 & y+1<Life.cell[x].length)
if(Life.cell[x-1][y+1].alive) re++;//6
if(y+1<Life.cell[x].length)
if(Life.cell[x ][y+1].alive) re++;//7
if(x+1<Life.cell.length & y+1<Life.cell[x].length)
if(Life.cell[x+1][y+1].alive) re++;//8
return re;
}
public void getAdjacentInfect() {
//1 2 3
//4 . 5
//6 7 8
if(x-1>=0 & y-1>=0)
if(Life.cell[x-1][y-1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//1
if(y-1>=0)
if(Life.cell[x ][y-1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//2
if(x+1<Life.cell.length & y-1>=0)
if(Life.cell[x+1][y-1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//3
if(x-1>=0)
if(Life.cell[x-1][y ].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//4
if(x+1<Life.cell.length)
if(Life.cell[x+1][y ].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//5
if(x-1>=0 & y+1<Life.cell[x].length)
if(Life.cell[x-1][y+1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//6
if(y+1<Life.cell[x].length)
if(Life.cell[x ][y+1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//7
if(x+1<Life.cell.length & y+1<Life.cell[x].length)
if(Life.cell[x+1][y+1].infected) {
if(Math.random()<Life.spreadChance) {
infected = true;
return;
}
};//8
}
}
| 4,894 | 0.564978 | 0.538006 | 228 | 20.464912 | 16.172415 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.039474 | false | false | 13 |
878534806cf202521b4b245dae63e7e966e1a022 | 6,889,127,587,963 | 79b276f2d2bbafdd4e21ab531495661c88a4d26f | /app/src/main/java/com/example/notewise/Todo.java | 7f1e2dfd08c7f6fbbdb905f41d78ce492c08edc5 | [] | no_license | prath1996/NoteWise | https://github.com/prath1996/NoteWise | ac68fc9492641f970f896e929d732300056850b5 | 89152b449dd165677c49adc0f8204e93b9e9e18b | refs/heads/master | 2020-08-02T20:43:12.944000 | 2019-09-29T14:15:27 | 2019-09-29T14:15:27 | 211,501,174 | 0 | 0 | null | false | 2019-09-29T14:15:28 | 2019-09-28T13:02:13 | 2019-09-28T13:02:39 | 2019-09-29T14:15:28 | 122 | 0 | 0 | 0 | Java | false | false | package com.example.notewise;
import java.util.ArrayList;
import java.util.List;
public class Todo extends File {
private List<TodoElement> ListOfTodoElement = new ArrayList<TodoElement>();
public List getListOfTodoElement() {
return ListOfTodoElement;
}
public void addTodoElement(TodoElement Element) {
this.ListOfTodoElement.add(Element);
}
public Todo(String name) {
super(name);
}
@Override
int getType() {
return 0;
}
}
| UTF-8 | Java | 506 | java | Todo.java | Java | [] | null | [] | package com.example.notewise;
import java.util.ArrayList;
import java.util.List;
public class Todo extends File {
private List<TodoElement> ListOfTodoElement = new ArrayList<TodoElement>();
public List getListOfTodoElement() {
return ListOfTodoElement;
}
public void addTodoElement(TodoElement Element) {
this.ListOfTodoElement.add(Element);
}
public Todo(String name) {
super(name);
}
@Override
int getType() {
return 0;
}
}
| 506 | 0.660079 | 0.658103 | 27 | 17.74074 | 19.696949 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.296296 | false | false | 13 |
686a4423cfac69159ee8ee07f60654e373cbc73c | 32,555,852,172,039 | 538dcf1bcd5fa4406aee55c818e9a28340bb9c06 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/Update_Log.java | f629b83f3182cd7daf5c2030dab69b7ba9ecd3fb | [
"BSD-3-Clause"
] | permissive | prichards11232/ftc_app | https://github.com/prichards11232/ftc_app | c491691661dacc99351738aca00548e2f9af639b | 5524f67180f649f48151353467f08992476ca046 | refs/heads/master | 2021-01-20T04:29:03.638000 | 2017-01-20T23:54:17 | 2017-01-20T23:54:17 | 76,690,345 | 1 | 0 | null | true | 2016-12-16T22:39:33 | 2016-12-16T22:39:33 | 2016-12-15T00:26:48 | 2016-12-14T22:16:06 | 459,918 | 0 | 0 | 0 | null | null | null | package org.firstinspires.ftc.teamcode;
/**
* Created by robotics on 1/11/2017.
*/
public class Update_Log {
//1/11/2017
//Today we changed the ArmButtonControl and ButtonAlterationGripper programs so they function
//with the second Game Pad
//1/12/2017
//We created a test program for driving with the left and right trigger.
}
| UTF-8 | Java | 355 | java | Update_Log.java | Java | [
{
"context": "org.firstinspires.ftc.teamcode;\n\n/**\n * Created by robotics on 1/11/2017.\n */\n\npublic class Update_Log {\n ",
"end": 67,
"score": 0.9962121248245239,
"start": 59,
"tag": "USERNAME",
"value": "robotics"
}
] | null | [] | package org.firstinspires.ftc.teamcode;
/**
* Created by robotics on 1/11/2017.
*/
public class Update_Log {
//1/11/2017
//Today we changed the ArmButtonControl and ButtonAlterationGripper programs so they function
//with the second Game Pad
//1/12/2017
//We created a test program for driving with the left and right trigger.
}
| 355 | 0.709859 | 0.650704 | 14 | 24.357143 | 28.959595 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.071429 | false | false | 13 |
159968ba12df85186f0b59c82c17e4b0547570fa | 32,865,089,777,241 | 4a0a0a2d6fb833aa87347a353f621dffd14574b5 | /src/main/java/org/tinygame/herostory/async/AsyncOperationProcessor.java | dd13b8b0d9940a5ebf65d010e4f0cf3e4b09c20c | [] | no_license | zhengjian2015/herostory | https://github.com/zhengjian2015/herostory | a573603c4c8fdc54ee277477c7bdb85d3474e217 | e106907a1dc555372ee1a225b5bec4c975c2dc8f | refs/heads/master | 2022-10-23T07:47:52.430000 | 2020-04-18T02:25:28 | 2020-04-18T02:25:28 | 251,025,684 | 0 | 0 | null | false | 2022-10-04T23:57:54 | 2020-03-29T12:23:08 | 2020-04-18T02:25:39 | 2022-10-04T23:57:52 | 107 | 0 | 0 | 3 | Java | false | false | package org.tinygame.herostory.async;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tinygame.herostory.MainThreadProcessor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public final class AsyncOperationProcessor {
static private final Logger LOGGER = LoggerFactory.getLogger(AsyncOperationProcessor.class);
private static final AsyncOperationProcessor _instance = new AsyncOperationProcessor();
/**
* 线程数组 不用多线程的线程池是因为,可能出现连续点2下类似 刷单的行为
*/
private final ExecutorService[] _esArray = new ExecutorService[8];
/**
* 获取单例对象
*
* @return 异步操作处理器
*/
static public AsyncOperationProcessor getInstance() {
return _instance;
}
/**
* 私有化类默认构造器
*/
private AsyncOperationProcessor(){
for (int i = 0; i < _esArray.length; i++) {
// 线程名称
final String threadName = "AsyncOperationProcessor_" + i;
// 创建单线程服务
_esArray[i] = Executors.newSingleThreadExecutor((newRunnable) -> {
Thread newThread = new Thread(newRunnable);
newThread.setName(threadName);
return newThread;
});
}
}
/**
* 处理异步操作
*
* 异步执行 然后回到主线程执行
* @param asyncOp 异步操作
*/
public void process(IAsyncOperation asyncOp) {
if (null == asyncOp) {
return;
}
// 根据绑定 Id 获取线程索引
int bindId = Math.abs(asyncOp.getBindId());
int esIndex = bindId % _esArray.length;
System.out.println("*******");
System.out.println(esIndex);
_esArray[esIndex].submit(() -> {
try {
//执行异步操作
asyncOp.doAsync();
//返回主线程执行完成的逻辑
MainThreadProcessor.getInstance().process(() -> {
asyncOp.doFinish();
});
} catch (Exception ex) {
LOGGER.error(ex.getMessage(),ex);
}
});
}
}
| UTF-8 | Java | 2,275 | java | AsyncOperationProcessor.java | Java | [] | null | [] | package org.tinygame.herostory.async;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tinygame.herostory.MainThreadProcessor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public final class AsyncOperationProcessor {
static private final Logger LOGGER = LoggerFactory.getLogger(AsyncOperationProcessor.class);
private static final AsyncOperationProcessor _instance = new AsyncOperationProcessor();
/**
* 线程数组 不用多线程的线程池是因为,可能出现连续点2下类似 刷单的行为
*/
private final ExecutorService[] _esArray = new ExecutorService[8];
/**
* 获取单例对象
*
* @return 异步操作处理器
*/
static public AsyncOperationProcessor getInstance() {
return _instance;
}
/**
* 私有化类默认构造器
*/
private AsyncOperationProcessor(){
for (int i = 0; i < _esArray.length; i++) {
// 线程名称
final String threadName = "AsyncOperationProcessor_" + i;
// 创建单线程服务
_esArray[i] = Executors.newSingleThreadExecutor((newRunnable) -> {
Thread newThread = new Thread(newRunnable);
newThread.setName(threadName);
return newThread;
});
}
}
/**
* 处理异步操作
*
* 异步执行 然后回到主线程执行
* @param asyncOp 异步操作
*/
public void process(IAsyncOperation asyncOp) {
if (null == asyncOp) {
return;
}
// 根据绑定 Id 获取线程索引
int bindId = Math.abs(asyncOp.getBindId());
int esIndex = bindId % _esArray.length;
System.out.println("*******");
System.out.println(esIndex);
_esArray[esIndex].submit(() -> {
try {
//执行异步操作
asyncOp.doAsync();
//返回主线程执行完成的逻辑
MainThreadProcessor.getInstance().process(() -> {
asyncOp.doFinish();
});
} catch (Exception ex) {
LOGGER.error(ex.getMessage(),ex);
}
});
}
}
| 2,275 | 0.563877 | 0.561429 | 77 | 25.532467 | 23.001741 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false | 13 |
3f892300aacd7dc62ff6df39210880a3e7925664 | 5,377,299,093,682 | f746cd7fa414bdfde30eb166c5aab44b581766a6 | /GameClient/src/GameClient/Library/Animation.java | 43ac70d30a47efb8634f248f15534652978e9a2a | [] | no_license | kagbogre/tankdemolition2d | https://github.com/kagbogre/tankdemolition2d | 8e960a89b48a694fd07c132a62045e0aabb74e3a | abcb8bfc936c07dd474b7723ee244bac177f876e | refs/heads/master | 2020-03-22T10:24:44.808000 | 2018-07-05T22:25:56 | 2018-07-05T22:25:56 | 139,900,843 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package GameClient.Library;
import GameClient.Library.Interfaces.IAnimated;
import GameClient.Resources.SpriteManager;
import java.util.ArrayList;
/**
* Animación de entidades.
* @author Kedi Agbogre <kedi97@gmail.com>
*/
public class Animation {
class AnimationStep {
int duration;
Sprite sprite;
public int getDuration() {
return duration;
}
public Sprite getSprite() {
return sprite;
}
AnimationStep(Sprite sprite, int duration) {
this.duration = duration;
this.sprite = sprite;
}
}
private ArrayList<AnimationStep> steps;
private boolean loop;
private boolean stopped;
private Animator animator;
private int count;
private int offsetX;
private int offsetY;
public Animation() {
count = 0;
offsetX = 0;
offsetY = 0;
loop = false;
stopped = true;
steps = new ArrayList<>();
}
/**
* Animator que ejecutará esta animación.
* @param animator
*/
public void setAnimator(Animator animator) {
this.animator = animator;
}
/**
* Indica si la animación será en bucle.
* Se repetirá hasta que se haga stop().
* @param loop
*/
public void setLoop(boolean loop) {
this.loop = loop;
}
/**
* Añade un step de la animación.
* La animación finaliza cuando pasa por todos los steps.
* @param sprite
* @param duration Duración de este step (ms).
*/
public void addStep(Sprite sprite, int duration) {
steps.add(new AnimationStep(sprite, duration));
}
/**
* Añade un determinado número de steps.
* @param count Número de sprites.
* @param ref Referencia al archivo del sprite.
* @param uref Referencia única del sprite.
* @param duration Duración de cada step (ms).
* @param rotation Rotación inicial del sprite.
*/
public void addSteps(int count, String ref, String uref, int duration, int rotation) {
for (int i = 0; i < count; i++) {
Sprite sprite = SpriteManager.getSprite(
ref.replace('$', String.valueOf(i).charAt(0)), uref + i, rotation
);
if (sprite != null) {
sprite.setOffset(offsetX, offsetY);
steps.add(new AnimationStep(sprite, duration));
}
}
}
/**
* Definir un offset para que la animación aparezca exactamente
* donde queremos.
* @param offsetX Offset en el eje X.
* @param offsetY Offset en el eje Y.
*/
public void setOffset(int offsetX, int offsetY) {
this.offsetX = offsetX;
this.offsetY = offsetY;
}
/**
* Circula por todos los frames hasta que termine, o
* continúa en bucle si así está establecido.
*/
private void animate() {
if(!stopped) {
if(count==steps.size()) {
if(animator.getEntity() instanceof IAnimated) {
((IAnimated) animator.getEntity())
.onAnimationCycleEnd(animator.getState());
}
if(loop) {
count = 0;
} else {
stopped = true;
return;
}
}
AnimationStep step = steps.get(count);
animator.getEntity().setSprite(step.getSprite());
count++;
setTimeout(() -> {
animate();
}, step.getDuration());
}
}
/**
* Ejecuta código después de x milisegundos.
* @param runnable
* @param delay
*/
private void setTimeout(Runnable runnable, int delay) {
new Thread(() -> {
try {
Thread.sleep(delay);
runnable.run();
}
catch (InterruptedException e){
System.err.println(e);
}
}).start();
}
public void play() {
stopped = false;
count = 0;
if(steps.size()>0) {
animate();
}
}
public void stop() {
stopped = true;
count = 0;
}
}
| UTF-8 | Java | 4,417 | java | Animation.java | Java | [
{
"context": "ayList;\n\n/**\n * Animación de entidades.\n * @author Kedi Agbogre <kedi97@gmail.com>\n */\npublic class Animation {\n ",
"end": 203,
"score": 0.9998615384101868,
"start": 191,
"tag": "NAME",
"value": "Kedi Agbogre"
},
{
"context": " Animación de entidades.\n * @author... | null | [] | package GameClient.Library;
import GameClient.Library.Interfaces.IAnimated;
import GameClient.Resources.SpriteManager;
import java.util.ArrayList;
/**
* Animación de entidades.
* @author <NAME> <<EMAIL>>
*/
public class Animation {
class AnimationStep {
int duration;
Sprite sprite;
public int getDuration() {
return duration;
}
public Sprite getSprite() {
return sprite;
}
AnimationStep(Sprite sprite, int duration) {
this.duration = duration;
this.sprite = sprite;
}
}
private ArrayList<AnimationStep> steps;
private boolean loop;
private boolean stopped;
private Animator animator;
private int count;
private int offsetX;
private int offsetY;
public Animation() {
count = 0;
offsetX = 0;
offsetY = 0;
loop = false;
stopped = true;
steps = new ArrayList<>();
}
/**
* Animator que ejecutará esta animación.
* @param animator
*/
public void setAnimator(Animator animator) {
this.animator = animator;
}
/**
* Indica si la animación será en bucle.
* Se repetirá hasta que se haga stop().
* @param loop
*/
public void setLoop(boolean loop) {
this.loop = loop;
}
/**
* Añade un step de la animación.
* La animación finaliza cuando pasa por todos los steps.
* @param sprite
* @param duration Duración de este step (ms).
*/
public void addStep(Sprite sprite, int duration) {
steps.add(new AnimationStep(sprite, duration));
}
/**
* Añade un determinado número de steps.
* @param count Número de sprites.
* @param ref Referencia al archivo del sprite.
* @param uref Referencia única del sprite.
* @param duration Duración de cada step (ms).
* @param rotation Rotación inicial del sprite.
*/
public void addSteps(int count, String ref, String uref, int duration, int rotation) {
for (int i = 0; i < count; i++) {
Sprite sprite = SpriteManager.getSprite(
ref.replace('$', String.valueOf(i).charAt(0)), uref + i, rotation
);
if (sprite != null) {
sprite.setOffset(offsetX, offsetY);
steps.add(new AnimationStep(sprite, duration));
}
}
}
/**
* Definir un offset para que la animación aparezca exactamente
* donde queremos.
* @param offsetX Offset en el eje X.
* @param offsetY Offset en el eje Y.
*/
public void setOffset(int offsetX, int offsetY) {
this.offsetX = offsetX;
this.offsetY = offsetY;
}
/**
* Circula por todos los frames hasta que termine, o
* continúa en bucle si así está establecido.
*/
private void animate() {
if(!stopped) {
if(count==steps.size()) {
if(animator.getEntity() instanceof IAnimated) {
((IAnimated) animator.getEntity())
.onAnimationCycleEnd(animator.getState());
}
if(loop) {
count = 0;
} else {
stopped = true;
return;
}
}
AnimationStep step = steps.get(count);
animator.getEntity().setSprite(step.getSprite());
count++;
setTimeout(() -> {
animate();
}, step.getDuration());
}
}
/**
* Ejecuta código después de x milisegundos.
* @param runnable
* @param delay
*/
private void setTimeout(Runnable runnable, int delay) {
new Thread(() -> {
try {
Thread.sleep(delay);
runnable.run();
}
catch (InterruptedException e){
System.err.println(e);
}
}).start();
}
public void play() {
stopped = false;
count = 0;
if(steps.size()>0) {
animate();
}
}
public void stop() {
stopped = true;
count = 0;
}
}
| 4,402 | 0.5124 | 0.509898 | 170 | 24.852942 | 18.673246 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.394118 | false | false | 13 |
7d4092feb02d5b1a28cf5622d4c5cebc6076c664 | 27,238,682,596,082 | 78ebd950b6d3fbd5e440b7b47541143af1bcb324 | /src/cgShape.java | 1ba3eb3f181f4f18233461396f4a24c3ca84e2e0 | [] | no_license | smy2748/Ontarios-Bane | https://github.com/smy2748/Ontarios-Bane | ea1d2c3a756644d9f42cfd8e7c0de63ab94ea15a | e18390a937e5740b39fa6098c677a3b2ead5252b | refs/heads/master | 2021-01-01T06:55:01.372000 | 2014-04-13T02:15:04 | 2014-04-13T02:15:04 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* cgShape.java
*
* Class that includes routines for tessellating a number of basic shapes
*
* Students are to supply their implementations for the
* functions in this file using the function "addTriangle()" to do the
* tessellation.
*
*/
import java.awt.*;
import java.nio.*;
import java.awt.event.*;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import java.io.*;
/**
* A class that can draw a cube, cylinder, sphere, or cone
*
* Largely implemented by: Stephen Yingling
*/
public class cgShape extends simpleShape
{
/**
* constructor
*/
public cgShape()
{
}
/**
* makeCube - Create a unit cube, centered at the origin, with a given number
* of subdivisions in each direction on each face.
*
* @param subdivisions - number of equal subdivisons to be made in each
* direction along each face
*
* Can only use calls to addTriangle()
* Implemented by Stephen Yingling
*/
public void makeCube (int subdivisions)
{
if( subdivisions < 1 )
subdivisions = 1;
//Make all the points at the corners of the cube
MyPoint frontLowerLeft = new MyPoint(-.5f,-.5f,-.5f),
frontLowerRight = new MyPoint(.5f,-.5f,-.5f),
frontUpperRight = new MyPoint(.5f,.5f,-.5f),
frontUpperLeft = new MyPoint(-.5f,.5f,-.5f),
backLowerLeft = new MyPoint(-.5f,-.5f,.5f),
backUpperLeft = new MyPoint(-.5f,.5f,.5f),
backLowerRight = new MyPoint(.5f,-.5f,.5f),
backUpperRight = new MyPoint(.5f,.5f,.5f)
;
//Draw each face
makeQuad(frontLowerLeft,frontLowerRight,frontUpperRight,
frontUpperLeft, subdivisions);
makeQuad(backLowerLeft,frontLowerLeft,frontUpperLeft,
backUpperLeft, subdivisions);
makeQuad(backLowerRight, backLowerLeft, backUpperLeft,
backUpperRight, subdivisions);
makeQuad(frontUpperLeft, frontUpperRight, backUpperRight,
backUpperLeft, subdivisions);
makeQuad(backLowerLeft, backLowerRight, frontLowerRight,
frontLowerLeft, subdivisions);
makeQuad(frontLowerRight, backLowerRight, backUpperRight,
frontUpperRight, subdivisions);
}
/**
* Makes a quad from the given points with the given subdivisions
* @param ll - The lower left corner of the quad
* @param lr - The lower right corner of the quad
* @param ur - The upper right corner of the quad
* @param ul - The upper left corner of the quad
* @param subs - The number of subdivisions for the quad
* Implemented by: Stephen Yingling
*/
public void makeQuad(MyPoint ll, MyPoint lr, MyPoint ur, MyPoint ul, int subs ){
float subsize = 1.0f/subs;
//Subdivide the quad into columns and draw the columns
for(int i=0; i<subs; i++){
float curPos = subsize * i;
MyPoint q = ul.mult(1f-curPos).add(ur.mult(curPos));
MyPoint r = ll.mult(1f-curPos).add(lr.mult(curPos));
float iprime = curPos + subsize;
MyPoint qPrime = ul.mult(1f-iprime).add(ur.mult(iprime));
MyPoint rprime = ll.mult(1f-iprime).add(lr.mult(iprime));
makeQuadCol(q,r,qPrime,rprime,subs);
}
}
/**
* Draws a column of quads
* @param q - The left upper point of the column
* @param r - The left lower point of the column
* @param qp - The right upper point of the column
* @param rp - The right lower point of the column
* @param numSubs - The number of rows for this column
* Implemented by: Stephen Yingling
*/
public void makeQuadCol(MyPoint q, MyPoint r, MyPoint qp, MyPoint rp, int numSubs){
float sublength = 1f/numSubs;
//Calculate and draw two triangles for each row
for(int i=0; i < numSubs; i++){
float f = i * sublength;
MyPoint p1 = q.mult(1-f).add(r.mult(f)),
p2= qp.mult(1-f).add(rp.mult(f)),
p3 = q.mult(1-(f+sublength)).add(r.mult(f+sublength)),
p4 = qp.mult(1-(f+sublength)).add(rp.mult(f+sublength));
addTriangle(p3,p4,p2);
addTriangle(p3,p2,p1);
}
}
/**
* A callthrough to the other addTriangle function
* @param p1 - The first point of the triangle
* @param p2 - The second point of the triangle
* @param p3 - The third point of the triangle
* Implemented by: Stephen Yingling
*/
public void addTriangle(MyPoint p1, MyPoint p2, MyPoint p3){
addTriangle(p1.getX(), p1.getY(), p1.getZ(),
p2.getX(), p2.getY(), p2.getZ(),
p3.getX(), p3.getY(), p3.getZ());
}
/**
* makeCylinder - Create polygons for a cylinder with unit height, centered at
* the origin, with separate number of radial subdivisions and height
* subdivisions.
*
* @param radius - Radius of the base of the cylinder
* @param radialDivisions - number of subdivisions on the radial base
* @param heightDivisions - number of subdivisions along the height
*
* Can only use calls to addTriangle()
* Implemented by Stephen Yingling
*/
public void makeCylinder (float radius, int radialDivisions, int heightDivisions)
{
if( radialDivisions < 3 )
radialDivisions = 3;
if( heightDivisions < 1 )
heightDivisions = 1;
MyPoint origin = new MyPoint(0,0,-.5f);
MyPoint p1f, p2f, p1b, p2b;
float rads = (float)Math.toRadians(360f/radialDivisions);
for(int i=0; i < radialDivisions; i++){
//Make triangles for the disks
float curDegs = i * rads;
p2f = new MyPoint(radius* (float)Math.cos(curDegs),
radius * (float) Math.sin(curDegs),
-.5f);
p1f = new MyPoint(radius* (float)Math.cos(curDegs+rads),
radius * (float) Math.sin(curDegs + rads),
-.5f);
origin.setZ(-.5f);
addTriangle(origin, p1f, p2f);
origin.setZ(.5f);
p1b = new MyPoint(p1f.getX(), p1f.getY(),.5f);
p2b = new MyPoint(p2f.getX(), p2f.getY(),.5f);
addTriangle(origin,p2b,p1b);
//Make the rectangle on the side
makeQuadCol(p1f,p1b,p2f,p2b,heightDivisions);
}
}
/**
* makeCone - Create polygons for a cone with unit height, centered at the
* origin, with separate number of radial subdivisions and height
* subdivisions.
*
* @param radius - Radius of the base of the cone
* @param radialDivisions - number of subdivisions on the radial base
* @param heightDivisions - number of subdivisions along the height
*
* Can only use calls to addTriangle()
* Implemented by Stephen Yingling
*/
public void makeCone (float radius, int radialDivisions, int heightDivisions)
{
if( radialDivisions < 3 )
radialDivisions = 3;
if( heightDivisions < 1 )
heightDivisions = 1;
MyPoint origin = new MyPoint(0,0,-.5f);
MyPoint p1f, p2f, p1b, p2b;
float rads = (float)Math.toRadians(360f/radialDivisions);
//Make the disk
for(int i=0; i < radialDivisions; i++){
float curDegs = i * rads;
p2f = new MyPoint(radius* (float)Math.cos(curDegs),
radius * (float) Math.sin(curDegs),
-.5f);
p1f = new MyPoint(radius* (float)Math.cos(curDegs+rads),
radius * (float) Math.sin(curDegs + rads),
-.5f);
origin.setZ(-.5f);
addTriangle(origin, p1f, p2f);
origin.setZ(.5f);
//Make a "quad" with the far points of the quad the same
//Thus making a conical shape
makeQuadCol(p1f,origin,p2f,origin,heightDivisions);
}
}
/**
* makeSphere - Makes a sphere using the recursive subdivision method
*
* @param radius - Radius of the sphere
* @param slices - number of recursions
* @param stacks - Not used
*
* Can only use calls to addTriangle
*
* Implemented by Stephen Yingling
*/
public void makeSphere (float radius, int slices, int stacks)
{
if( slices < 3 )
slices = 3;
if (slices > 5){
slices = 5;
}
if( stacks < 3 )
stacks = 3;
//Make the isocohedron net
float a = (float)(2/(1+Math.sqrt(5))),
na = -1*a,
p = 1, np = -1*p;
MyPoint v0 = new MyPoint(0,a,np),
v1 = new MyPoint(na,p,0),
v2 = new MyPoint(a,p,0),
v3 = new MyPoint(0,a,p),
v4 = new MyPoint(np,0,a),
v5 = new MyPoint(0,na,p),
v6 = new MyPoint(p,0,a),
v7 = new MyPoint(p,0,na),
v8 = new MyPoint(0,na,np),
v9 = new MyPoint(np,0,na),
v10 = new MyPoint(na,np,0),
v11 = new MyPoint(a,np,0);
//Make recursive triangles
recurTriEngels(slices,v0,v1,v2,radius);
recurTriEngels(slices,v3,v2,v1,radius);
recurTriEngels(slices,v3,v4,v5,radius);
recurTriEngels(slices,v3,v5,v6,radius);
recurTriEngels(slices,v0,v7,v8,radius);
recurTriEngels(slices,v0,v8,v9,radius);
recurTriEngels(slices,v5,v10,v11,radius);
recurTriEngels(slices,v8,v11,v10,radius);
recurTriEngels(slices,v1,v9,v4,radius);
recurTriEngels(slices,v10,v4,v9,radius);
recurTriEngels(slices,v2,v6,v7,radius);
recurTriEngels(slices,v11,v7,v6,radius);
recurTriEngels(slices,v3,v1,v4,radius);
recurTriEngels(slices,v3,v6,v2,radius);
recurTriEngels(slices,v0,v9,v1,radius);
recurTriEngels(slices,v0,v2,v7,radius);
recurTriEngels(slices,v8,v10,v9,radius);
recurTriEngels(slices,v8,v7,v11,radius);
recurTriEngels(slices,v5,v4,v10,radius);
recurTriEngels(slices,v5,v11,v6,radius);
}
/**
* Recursively add triangles to the given triangle.
*
* @param subs - The number of subdivions
* @param p0 - The 1st point of the triangle
* @param p1 - The 2nd point of the triangle
* @param p2 - - The 3rd point of the triangle
* @param rad - The radius of the sphere
*
* Implemented by Stephen Yingling
*
* If there were three Engels, then Marx would have made triple the money!
*/
public void recurTriEngels(int subs, MyPoint p0, MyPoint p1 , MyPoint p2, float rad){
//Draw at the base case
if(subs == 1){
addTriangle(p0.mult(rad/p0.getMagnitude()),
p1.mult(rad/p1.getMagnitude()),
p2.mult(rad/p2.getMagnitude()));
return;
}
recurTriEngels(subs-1, p0,p0.midPoint(p1),p0.midPoint(p2),rad);
recurTriEngels(subs-1, p0.midPoint(p1),p1,p1.midPoint(p2),rad);
recurTriEngels(subs-1, p0.midPoint(p2),p1.midPoint(p2),p2,rad);
recurTriEngels(subs-1, p0.midPoint(p1),p1.midPoint(p2),p2.midPoint(p0),rad);
}
/**
* A class to represent a point in 3D space
* Created by: Stephen Yingling
*/
public class MyPoint{
protected float x;
protected float y;
protected float z;
/**
* Make a point
* @param x - The x value of the point
* @param y - The y value of the point
* @param z - The z value of the point
* Implemented by: Stephen Yingling
*/
public MyPoint(float x, float y, float z){
this.x = x;
this.y = y;
this.z = z;
}
/**
* Adds the value of one point to this point and returns a new point
* containg the result
* @param other - The point to add to this one
* @return A point containing the point addition of this point and the other one
* Implemented by: Stephen Yingling
*/
public MyPoint add(MyPoint other){
return new MyPoint(this.x + other.getX(), this.y + other.getY(), this.z + other.getZ());
}
/**
* Multiply this point by a scalar value
* @param f - The number to multiply the point by
* @return A new point with the new values
*
* Implemented by: Stephen Yingling
*/
public MyPoint mult(float f){
return new MyPoint(x * f, y*f, z*f);
}
/**
* Determine the midpoint between this point and another
* @param other The other point
* @return A new point representing the midpoint
* Implemented by: Stephen Yingling
*/
public MyPoint midPoint(MyPoint other){
float nx = (other.getX()+x)/2f,
ny = (other.getY()+y)/2f,
nz = (other.getZ()+z)/2f;
return new MyPoint(nx,ny,nz);
}
/**
* Gets the magnitude of this point
* @return The magnitude of this point
* Implemented by: Stephen Yingling
*/
public float getMagnitude(){
return (float)Math.sqrt(Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2));
}
/**
*
* @return The x value
* Implemented by: Stephen Yingling
*/
public float getX() {
return x;
}
/**
*
* @return The y value
* Implemented by: Stephen Yingling
*/
public float getY() {
return y;
}
/**
*
* @return The z value
* Implemented by: Stephen Yingling
*/
public float getZ() {
return z;
}
/**
* Sets the z value to the specified value
* @param z - The new z value
* Implemented by: Stephen Yingling
*/
public void setZ(float z) {
this.z = z;
}
}
}
| UTF-8 | Java | 14,373 | java | cgShape.java | Java | [
{
"context": "der, sphere, or cone\n *\n * Largely implemented by: Stephen Yingling\n */\npublic class cgShape extends simpleShape\n{\n ",
"end": 513,
"score": 0.9994379281997681,
"start": 497,
"tag": "NAME",
"value": "Stephen Yingling"
},
{
"context": "y use calls to addTriangle()\... | null | [] | /**
* cgShape.java
*
* Class that includes routines for tessellating a number of basic shapes
*
* Students are to supply their implementations for the
* functions in this file using the function "addTriangle()" to do the
* tessellation.
*
*/
import java.awt.*;
import java.nio.*;
import java.awt.event.*;
import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import java.io.*;
/**
* A class that can draw a cube, cylinder, sphere, or cone
*
* Largely implemented by: <NAME>
*/
public class cgShape extends simpleShape
{
/**
* constructor
*/
public cgShape()
{
}
/**
* makeCube - Create a unit cube, centered at the origin, with a given number
* of subdivisions in each direction on each face.
*
* @param subdivisions - number of equal subdivisons to be made in each
* direction along each face
*
* Can only use calls to addTriangle()
* Implemented by <NAME>
*/
public void makeCube (int subdivisions)
{
if( subdivisions < 1 )
subdivisions = 1;
//Make all the points at the corners of the cube
MyPoint frontLowerLeft = new MyPoint(-.5f,-.5f,-.5f),
frontLowerRight = new MyPoint(.5f,-.5f,-.5f),
frontUpperRight = new MyPoint(.5f,.5f,-.5f),
frontUpperLeft = new MyPoint(-.5f,.5f,-.5f),
backLowerLeft = new MyPoint(-.5f,-.5f,.5f),
backUpperLeft = new MyPoint(-.5f,.5f,.5f),
backLowerRight = new MyPoint(.5f,-.5f,.5f),
backUpperRight = new MyPoint(.5f,.5f,.5f)
;
//Draw each face
makeQuad(frontLowerLeft,frontLowerRight,frontUpperRight,
frontUpperLeft, subdivisions);
makeQuad(backLowerLeft,frontLowerLeft,frontUpperLeft,
backUpperLeft, subdivisions);
makeQuad(backLowerRight, backLowerLeft, backUpperLeft,
backUpperRight, subdivisions);
makeQuad(frontUpperLeft, frontUpperRight, backUpperRight,
backUpperLeft, subdivisions);
makeQuad(backLowerLeft, backLowerRight, frontLowerRight,
frontLowerLeft, subdivisions);
makeQuad(frontLowerRight, backLowerRight, backUpperRight,
frontUpperRight, subdivisions);
}
/**
* Makes a quad from the given points with the given subdivisions
* @param ll - The lower left corner of the quad
* @param lr - The lower right corner of the quad
* @param ur - The upper right corner of the quad
* @param ul - The upper left corner of the quad
* @param subs - The number of subdivisions for the quad
* Implemented by: <NAME>
*/
public void makeQuad(MyPoint ll, MyPoint lr, MyPoint ur, MyPoint ul, int subs ){
float subsize = 1.0f/subs;
//Subdivide the quad into columns and draw the columns
for(int i=0; i<subs; i++){
float curPos = subsize * i;
MyPoint q = ul.mult(1f-curPos).add(ur.mult(curPos));
MyPoint r = ll.mult(1f-curPos).add(lr.mult(curPos));
float iprime = curPos + subsize;
MyPoint qPrime = ul.mult(1f-iprime).add(ur.mult(iprime));
MyPoint rprime = ll.mult(1f-iprime).add(lr.mult(iprime));
makeQuadCol(q,r,qPrime,rprime,subs);
}
}
/**
* Draws a column of quads
* @param q - The left upper point of the column
* @param r - The left lower point of the column
* @param qp - The right upper point of the column
* @param rp - The right lower point of the column
* @param numSubs - The number of rows for this column
* Implemented by: <NAME>
*/
public void makeQuadCol(MyPoint q, MyPoint r, MyPoint qp, MyPoint rp, int numSubs){
float sublength = 1f/numSubs;
//Calculate and draw two triangles for each row
for(int i=0; i < numSubs; i++){
float f = i * sublength;
MyPoint p1 = q.mult(1-f).add(r.mult(f)),
p2= qp.mult(1-f).add(rp.mult(f)),
p3 = q.mult(1-(f+sublength)).add(r.mult(f+sublength)),
p4 = qp.mult(1-(f+sublength)).add(rp.mult(f+sublength));
addTriangle(p3,p4,p2);
addTriangle(p3,p2,p1);
}
}
/**
* A callthrough to the other addTriangle function
* @param p1 - The first point of the triangle
* @param p2 - The second point of the triangle
* @param p3 - The third point of the triangle
* Implemented by: <NAME>
*/
public void addTriangle(MyPoint p1, MyPoint p2, MyPoint p3){
addTriangle(p1.getX(), p1.getY(), p1.getZ(),
p2.getX(), p2.getY(), p2.getZ(),
p3.getX(), p3.getY(), p3.getZ());
}
/**
* makeCylinder - Create polygons for a cylinder with unit height, centered at
* the origin, with separate number of radial subdivisions and height
* subdivisions.
*
* @param radius - Radius of the base of the cylinder
* @param radialDivisions - number of subdivisions on the radial base
* @param heightDivisions - number of subdivisions along the height
*
* Can only use calls to addTriangle()
* Implemented by <NAME>
*/
public void makeCylinder (float radius, int radialDivisions, int heightDivisions)
{
if( radialDivisions < 3 )
radialDivisions = 3;
if( heightDivisions < 1 )
heightDivisions = 1;
MyPoint origin = new MyPoint(0,0,-.5f);
MyPoint p1f, p2f, p1b, p2b;
float rads = (float)Math.toRadians(360f/radialDivisions);
for(int i=0; i < radialDivisions; i++){
//Make triangles for the disks
float curDegs = i * rads;
p2f = new MyPoint(radius* (float)Math.cos(curDegs),
radius * (float) Math.sin(curDegs),
-.5f);
p1f = new MyPoint(radius* (float)Math.cos(curDegs+rads),
radius * (float) Math.sin(curDegs + rads),
-.5f);
origin.setZ(-.5f);
addTriangle(origin, p1f, p2f);
origin.setZ(.5f);
p1b = new MyPoint(p1f.getX(), p1f.getY(),.5f);
p2b = new MyPoint(p2f.getX(), p2f.getY(),.5f);
addTriangle(origin,p2b,p1b);
//Make the rectangle on the side
makeQuadCol(p1f,p1b,p2f,p2b,heightDivisions);
}
}
/**
* makeCone - Create polygons for a cone with unit height, centered at the
* origin, with separate number of radial subdivisions and height
* subdivisions.
*
* @param radius - Radius of the base of the cone
* @param radialDivisions - number of subdivisions on the radial base
* @param heightDivisions - number of subdivisions along the height
*
* Can only use calls to addTriangle()
* Implemented by <NAME>
*/
public void makeCone (float radius, int radialDivisions, int heightDivisions)
{
if( radialDivisions < 3 )
radialDivisions = 3;
if( heightDivisions < 1 )
heightDivisions = 1;
MyPoint origin = new MyPoint(0,0,-.5f);
MyPoint p1f, p2f, p1b, p2b;
float rads = (float)Math.toRadians(360f/radialDivisions);
//Make the disk
for(int i=0; i < radialDivisions; i++){
float curDegs = i * rads;
p2f = new MyPoint(radius* (float)Math.cos(curDegs),
radius * (float) Math.sin(curDegs),
-.5f);
p1f = new MyPoint(radius* (float)Math.cos(curDegs+rads),
radius * (float) Math.sin(curDegs + rads),
-.5f);
origin.setZ(-.5f);
addTriangle(origin, p1f, p2f);
origin.setZ(.5f);
//Make a "quad" with the far points of the quad the same
//Thus making a conical shape
makeQuadCol(p1f,origin,p2f,origin,heightDivisions);
}
}
/**
* makeSphere - Makes a sphere using the recursive subdivision method
*
* @param radius - Radius of the sphere
* @param slices - number of recursions
* @param stacks - Not used
*
* Can only use calls to addTriangle
*
* Implemented by <NAME>
*/
public void makeSphere (float radius, int slices, int stacks)
{
if( slices < 3 )
slices = 3;
if (slices > 5){
slices = 5;
}
if( stacks < 3 )
stacks = 3;
//Make the isocohedron net
float a = (float)(2/(1+Math.sqrt(5))),
na = -1*a,
p = 1, np = -1*p;
MyPoint v0 = new MyPoint(0,a,np),
v1 = new MyPoint(na,p,0),
v2 = new MyPoint(a,p,0),
v3 = new MyPoint(0,a,p),
v4 = new MyPoint(np,0,a),
v5 = new MyPoint(0,na,p),
v6 = new MyPoint(p,0,a),
v7 = new MyPoint(p,0,na),
v8 = new MyPoint(0,na,np),
v9 = new MyPoint(np,0,na),
v10 = new MyPoint(na,np,0),
v11 = new MyPoint(a,np,0);
//Make recursive triangles
recurTriEngels(slices,v0,v1,v2,radius);
recurTriEngels(slices,v3,v2,v1,radius);
recurTriEngels(slices,v3,v4,v5,radius);
recurTriEngels(slices,v3,v5,v6,radius);
recurTriEngels(slices,v0,v7,v8,radius);
recurTriEngels(slices,v0,v8,v9,radius);
recurTriEngels(slices,v5,v10,v11,radius);
recurTriEngels(slices,v8,v11,v10,radius);
recurTriEngels(slices,v1,v9,v4,radius);
recurTriEngels(slices,v10,v4,v9,radius);
recurTriEngels(slices,v2,v6,v7,radius);
recurTriEngels(slices,v11,v7,v6,radius);
recurTriEngels(slices,v3,v1,v4,radius);
recurTriEngels(slices,v3,v6,v2,radius);
recurTriEngels(slices,v0,v9,v1,radius);
recurTriEngels(slices,v0,v2,v7,radius);
recurTriEngels(slices,v8,v10,v9,radius);
recurTriEngels(slices,v8,v7,v11,radius);
recurTriEngels(slices,v5,v4,v10,radius);
recurTriEngels(slices,v5,v11,v6,radius);
}
/**
* Recursively add triangles to the given triangle.
*
* @param subs - The number of subdivions
* @param p0 - The 1st point of the triangle
* @param p1 - The 2nd point of the triangle
* @param p2 - - The 3rd point of the triangle
* @param rad - The radius of the sphere
*
* Implemented by <NAME>
*
* If there were three Engels, then Marx would have made triple the money!
*/
public void recurTriEngels(int subs, MyPoint p0, MyPoint p1 , MyPoint p2, float rad){
//Draw at the base case
if(subs == 1){
addTriangle(p0.mult(rad/p0.getMagnitude()),
p1.mult(rad/p1.getMagnitude()),
p2.mult(rad/p2.getMagnitude()));
return;
}
recurTriEngels(subs-1, p0,p0.midPoint(p1),p0.midPoint(p2),rad);
recurTriEngels(subs-1, p0.midPoint(p1),p1,p1.midPoint(p2),rad);
recurTriEngels(subs-1, p0.midPoint(p2),p1.midPoint(p2),p2,rad);
recurTriEngels(subs-1, p0.midPoint(p1),p1.midPoint(p2),p2.midPoint(p0),rad);
}
/**
* A class to represent a point in 3D space
* Created by: <NAME>
*/
public class MyPoint{
protected float x;
protected float y;
protected float z;
/**
* Make a point
* @param x - The x value of the point
* @param y - The y value of the point
* @param z - The z value of the point
* Implemented by: <NAME>
*/
public MyPoint(float x, float y, float z){
this.x = x;
this.y = y;
this.z = z;
}
/**
* Adds the value of one point to this point and returns a new point
* containg the result
* @param other - The point to add to this one
* @return A point containing the point addition of this point and the other one
* Implemented by: <NAME>
*/
public MyPoint add(MyPoint other){
return new MyPoint(this.x + other.getX(), this.y + other.getY(), this.z + other.getZ());
}
/**
* Multiply this point by a scalar value
* @param f - The number to multiply the point by
* @return A new point with the new values
*
* Implemented by: <NAME>
*/
public MyPoint mult(float f){
return new MyPoint(x * f, y*f, z*f);
}
/**
* Determine the midpoint between this point and another
* @param other The other point
* @return A new point representing the midpoint
* Implemented by: <NAME>
*/
public MyPoint midPoint(MyPoint other){
float nx = (other.getX()+x)/2f,
ny = (other.getY()+y)/2f,
nz = (other.getZ()+z)/2f;
return new MyPoint(nx,ny,nz);
}
/**
* Gets the magnitude of this point
* @return The magnitude of this point
* Implemented by: <NAME>
*/
public float getMagnitude(){
return (float)Math.sqrt(Math.pow(x,2) + Math.pow(y,2) + Math.pow(z,2));
}
/**
*
* @return The x value
* Implemented by: <NAME>
*/
public float getX() {
return x;
}
/**
*
* @return The y value
* Implemented by: <NAME>
*/
public float getY() {
return y;
}
/**
*
* @return The z value
* Implemented by: <NAME>
*/
public float getZ() {
return z;
}
/**
* Sets the z value to the specified value
* @param z - The new z value
* Implemented by: <NAME>
*/
public void setZ(float z) {
this.z = z;
}
}
}
| 14,183 | 0.560426 | 0.540806 | 452 | 30.798672 | 24.341536 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.862832 | false | false | 13 |
98ada0e5beb4528993d3e82a6e7e6badb2694c47 | 11,759,620,460,052 | 0b42c462686594c5571bf85c78565857d981dd78 | /src/main/java/ar/edu/unlam/tallerweb1/servicios/ServicioPartidoImpl.java | b815b1f374e601b8d3840adfb07f95f4f0305f4a | [] | no_license | LucasBenitez/cnal-spring | https://github.com/LucasBenitez/cnal-spring | f14db6303b725325d9e1b4bd44325e9d20223dab | 6868de7621c500bfc3a31404f4fe6e01754e654c | refs/heads/main | 2023-08-27T08:34:41.029000 | 2021-10-27T23:06:59 | 2021-10-27T23:06:59 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ar.edu.unlam.tallerweb1.servicios;
import ar.edu.unlam.tallerweb1.modelo.Partido;
import ar.edu.unlam.tallerweb1.modelo.Usuario;
import ar.edu.unlam.tallerweb1.modelo.UsuarioPartido;
import ar.edu.unlam.tallerweb1.repositorios.RepositorioPartido;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service("servicioCrearPartido")
@Transactional
public class ServicioPartidoImpl implements ServicioPartido {
private RepositorioPartido repositorioPartidoImpl;
@Autowired
public ServicioPartidoImpl(RepositorioPartido repositorioPartido) {
this.repositorioPartidoImpl = repositorioPartido;
}
@Override
public Partido registrarPartido(Partido partido) {
String tipo= partido.getTipo();
Integer jugadores = Integer.parseInt(tipo);
Integer jugadores_totales = jugadores * 2;
Integer lugares= 0;
if (partido.getCant_jugadores() < jugadores_totales){
lugares= jugadores_totales - partido.getCant_jugadores();
}
repositorioPartidoImpl.guardarPartido(partido);
return partido;
}
@Override
public Partido consultarPartido(String hora, String categoria) throws Exception {
Partido buscado = repositorioPartidoImpl.buscarPartido(hora, categoria);
if (buscado != null){
throw new Exception();
}
return buscado;
}
@Override
public void unirmeAlPartido(Partido partido) {
Partido partidoActualizado = repositorioPartidoImpl.buscarPartidoPorID(partido.getId());
String tipo= partidoActualizado.getTipo();
Integer jugadores = Integer.parseInt(tipo);
Integer jugadores_totales = jugadores * 2;
if (partidoActualizado.getCant_jugadores() < jugadores_totales){
partidoActualizado.setCant_jugadores(partido.getCant_jugadores() + 1);
partidoActualizado.setCant_lugaresDisp(partido.getCant_lugaresDisp() - 1);
}
repositorioPartidoImpl.actualizar(partidoActualizado);
}
@Override
public Boolean partidoLleno(Partido partido){
boolean esValido = false;
if(partido.getTipo().equals("5") && (partido.getCant_jugadores()>=1 && partido.getCant_jugadores()<=10)){
esValido = true;
}else if(partido.getTipo().equals("11") && (partido.getCant_jugadores()>=1 && partido.getCant_jugadores()<=22)){
esValido = true;
}
return esValido;
}
@Override
public List<Partido> todosLosPartidos() {
return repositorioPartidoImpl.todosLosPartidos();
}
@Override
public Boolean partidoConFiltros(Partido partido){
try{
if(partido.getLocalidad() != null && partido.getCategoria() != null){
return true;
}
return false;
}catch (Exception e){
throw e;
}
}
@Override
public List<Partido> filtrarPartidos(String localidad, String categoria){
return repositorioPartidoImpl.partidosFiltrados(localidad,categoria);
}
@Override
public Partido buscarPartidoPorID(Long id) {
Partido partidoPorID = repositorioPartidoImpl.buscarPartidoPorID(id);
return partidoPorID;
}
@Override
public void vincularJugadorAPartido(Long idUsuario, Long idPartido){
try {
UsuarioPartido registro = new UsuarioPartido();
registro.setPrimaryOne(idUsuario);
registro.setPrimaryTwo(idPartido);
repositorioPartidoImpl.registrarUsuarioAPartido(registro);
}
catch (Exception e){
throw e;
}
}
@Override
public UsuarioPartido buscarUsuarioPartido(Long idUsuario, Long idPartido) {
UsuarioPartido usuarioPartido = repositorioPartidoImpl.buscarUsuarioPartido(idUsuario, idPartido);
return usuarioPartido;
}
@Override
public List<Partido> buscarPartidosPorUsuario(Long idUsuario) {
return repositorioPartidoImpl.todosLosPartidosPorUsuario(idUsuario);
}
} | UTF-8 | Java | 4,206 | java | ServicioPartidoImpl.java | Java | [] | null | [] | package ar.edu.unlam.tallerweb1.servicios;
import ar.edu.unlam.tallerweb1.modelo.Partido;
import ar.edu.unlam.tallerweb1.modelo.Usuario;
import ar.edu.unlam.tallerweb1.modelo.UsuarioPartido;
import ar.edu.unlam.tallerweb1.repositorios.RepositorioPartido;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service("servicioCrearPartido")
@Transactional
public class ServicioPartidoImpl implements ServicioPartido {
private RepositorioPartido repositorioPartidoImpl;
@Autowired
public ServicioPartidoImpl(RepositorioPartido repositorioPartido) {
this.repositorioPartidoImpl = repositorioPartido;
}
@Override
public Partido registrarPartido(Partido partido) {
String tipo= partido.getTipo();
Integer jugadores = Integer.parseInt(tipo);
Integer jugadores_totales = jugadores * 2;
Integer lugares= 0;
if (partido.getCant_jugadores() < jugadores_totales){
lugares= jugadores_totales - partido.getCant_jugadores();
}
repositorioPartidoImpl.guardarPartido(partido);
return partido;
}
@Override
public Partido consultarPartido(String hora, String categoria) throws Exception {
Partido buscado = repositorioPartidoImpl.buscarPartido(hora, categoria);
if (buscado != null){
throw new Exception();
}
return buscado;
}
@Override
public void unirmeAlPartido(Partido partido) {
Partido partidoActualizado = repositorioPartidoImpl.buscarPartidoPorID(partido.getId());
String tipo= partidoActualizado.getTipo();
Integer jugadores = Integer.parseInt(tipo);
Integer jugadores_totales = jugadores * 2;
if (partidoActualizado.getCant_jugadores() < jugadores_totales){
partidoActualizado.setCant_jugadores(partido.getCant_jugadores() + 1);
partidoActualizado.setCant_lugaresDisp(partido.getCant_lugaresDisp() - 1);
}
repositorioPartidoImpl.actualizar(partidoActualizado);
}
@Override
public Boolean partidoLleno(Partido partido){
boolean esValido = false;
if(partido.getTipo().equals("5") && (partido.getCant_jugadores()>=1 && partido.getCant_jugadores()<=10)){
esValido = true;
}else if(partido.getTipo().equals("11") && (partido.getCant_jugadores()>=1 && partido.getCant_jugadores()<=22)){
esValido = true;
}
return esValido;
}
@Override
public List<Partido> todosLosPartidos() {
return repositorioPartidoImpl.todosLosPartidos();
}
@Override
public Boolean partidoConFiltros(Partido partido){
try{
if(partido.getLocalidad() != null && partido.getCategoria() != null){
return true;
}
return false;
}catch (Exception e){
throw e;
}
}
@Override
public List<Partido> filtrarPartidos(String localidad, String categoria){
return repositorioPartidoImpl.partidosFiltrados(localidad,categoria);
}
@Override
public Partido buscarPartidoPorID(Long id) {
Partido partidoPorID = repositorioPartidoImpl.buscarPartidoPorID(id);
return partidoPorID;
}
@Override
public void vincularJugadorAPartido(Long idUsuario, Long idPartido){
try {
UsuarioPartido registro = new UsuarioPartido();
registro.setPrimaryOne(idUsuario);
registro.setPrimaryTwo(idPartido);
repositorioPartidoImpl.registrarUsuarioAPartido(registro);
}
catch (Exception e){
throw e;
}
}
@Override
public UsuarioPartido buscarUsuarioPartido(Long idUsuario, Long idPartido) {
UsuarioPartido usuarioPartido = repositorioPartidoImpl.buscarUsuarioPartido(idUsuario, idPartido);
return usuarioPartido;
}
@Override
public List<Partido> buscarPartidosPorUsuario(Long idUsuario) {
return repositorioPartidoImpl.todosLosPartidosPorUsuario(idUsuario);
}
} | 4,206 | 0.681883 | 0.677366 | 130 | 31.361538 | 29.810429 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.415385 | false | false | 13 |
ab4cbc15c03b8f165e2b217a295da58df94c305d | 19,799,799,251,799 | d2d18c00ca2fdd5a059e0a4f6db9209df664f8ad | /src/com/meal/activity/LoginActivity.java | 321d11a8df1bdcd04cd0152ae02a9e4c2efbb7bf | [] | no_license | xiamingxing/meal | https://github.com/xiamingxing/meal | f4ffdc1bcc7845bf648a428b56d53614c47e10ad | 6e693b330c1c8f11a6ea8003afaf2946e6b52822 | refs/heads/master | 2021-01-17T17:02:25.819000 | 2016-07-19T04:29:58 | 2016-07-19T04:29:58 | 63,660,472 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.meal.activity;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.meal.action.UserManageAction;
import com.meal.activity.ipml.AsynThreadImpl;
import com.meal.activity.ipml.UIThreadImpl;
import com.meal.bean.User;
import com.meal.dialog.MyProgressDialog;
import com.meal.util.SysUtil;
public class LoginActivity extends BaseActivity{
private Button customerRegisterButton;
private Button retButton;
private MyProgressDialog loginProgressDialog;
private HashMap<String, String> loginInfo = new HashMap<String, String>(); //loginInfo
private UserManageAction userManage = UserManageAction.getInstance();
private boolean isPhoneNum = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.customer_login);
customerRegisterButton = (Button)findViewById(R.id.customerRegButton);
customerRegisterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.setClass(LoginActivity.this,
RegisterActivity.class);
startActivity(intent);
}
});
retButton = (Button)findViewById(R.id.retButton1);
retButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
LoginActivity.this.finish();
}
});
loginProgressDialog = MyProgressDialog.createDialog(this);
// initial();
addEventListener();
}
private void addEventListener(){
final EditText loginPhone=(EditText)findViewById(R.id.customerLoginName);
final EditText loginPasswd=(EditText)findViewById(R.id.customerLoginPasswd);
addClickEventListener(R.id.customerLoginButton, new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// int x = SysUtil.getAPNType(getApplicationContext());
// if(x < 0)
// {
// Log.e("net",x+"");
// Toast.makeText(LoginActivity.this, getResources().getString(R.string.badnet), Toast.LENGTH_SHORT).show();
// return;
// }
initial();
String userName=loginPhone.getText().toString();
String passWord=loginPasswd.getText().toString();
Log.d("userName", userName);
Log.d("userPasswd", passWord);
isPhoneNum = isMobileNO(userName);
if(!isPhoneNum)
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.usernamewrong), Toast.LENGTH_SHORT).show();
return;
}
if(userName == null || userName.equals("") || passWord==null || passWord.equals(""))
{
if(userName == null || userName.equals(""))
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.usernamewrong), Toast.LENGTH_SHORT).show();
}
else if(passWord==null || passWord.equals(""))
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.passwdwrong), Toast.LENGTH_SHORT).show();
}
}
else
{
loginProgressDialog.show();
if(isPhoneNum)
{
loginInfo.clear();
loginInfo.put("userName", userName);
loginInfo.put("passWord", passWord);
}
startAsynThread("login");
}
}
});
}
private void initial()
{
setUIRefreshConfig(new UIThreadImpl() {
@Override
public void refresh(Message msg) {
// TODO Auto-generated method stub
loginProgressDialog.dismiss();
if ( 1 == msg.arg2 ){
loginStart();
}
else if(0 == msg.arg2){
Toast.makeText(LoginActivity.this, getResources().getString(R.string.faillogin), Toast.LENGTH_SHORT).show();
// DialogUtil.alert(getResources().getString(R.string.faillogin), LoginActivity.this);
}
else if( 2== msg.arg2)
{
Toast toast=Toast.makeText(LoginActivity.this, getResources().getString(R.string.nonephonenum),Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP , 0,180);
toast.show();
}
}
});
setAsynThreadConfig("login", true, new AsynThreadImpl() {
@Override
public Message excute() {
// TODO Auto-generated method stub
Message msg = Message.obtain();
if(isPhoneNum)
{
msg.obj = userManage.login(loginInfo.get("userName"),
loginInfo.get("passWord"), LoginActivity.this);
if ( null != msg.obj ){
msg.arg2 = 1;
}
else{
msg.arg2 = 0;
}
}
else
{
msg.arg2 = 2;
}
finishAsynThread("login");
return msg;
}
});
}
public void loginStart()
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.successlogin), Toast.LENGTH_LONG).show();
LoginActivity.this.finish();
// Intent intent=new Intent();
// intent.setClass(LoginActivity.this,IndividualCenterActivity.class);
// startActivity(intent);
}
public boolean isMobileNO(String mobiles)
{
Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
Matcher m = p.matcher(mobiles);
System.out.println(m.matches()+"---");
return m.matches();
}
}
| UTF-8 | Java | 5,816 | java | LoginActivity.java | Java | [
{
"context": "d.getText().toString(); \r\n\t\t\t Log.d(\"userName\", userName);\r\n\t\t\t Log.d(\"userPasswd\", passWord);\r\n\t\t\t ",
"end": 2848,
"score": 0.9886406064033508,
"start": 2840,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "\"userName\", userName);\r... | null | [] | package com.meal.activity;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.meal.action.UserManageAction;
import com.meal.activity.ipml.AsynThreadImpl;
import com.meal.activity.ipml.UIThreadImpl;
import com.meal.bean.User;
import com.meal.dialog.MyProgressDialog;
import com.meal.util.SysUtil;
public class LoginActivity extends BaseActivity{
private Button customerRegisterButton;
private Button retButton;
private MyProgressDialog loginProgressDialog;
private HashMap<String, String> loginInfo = new HashMap<String, String>(); //loginInfo
private UserManageAction userManage = UserManageAction.getInstance();
private boolean isPhoneNum = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.customer_login);
customerRegisterButton = (Button)findViewById(R.id.customerRegButton);
customerRegisterButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = new Intent();
//intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.setClass(LoginActivity.this,
RegisterActivity.class);
startActivity(intent);
}
});
retButton = (Button)findViewById(R.id.retButton1);
retButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
LoginActivity.this.finish();
}
});
loginProgressDialog = MyProgressDialog.createDialog(this);
// initial();
addEventListener();
}
private void addEventListener(){
final EditText loginPhone=(EditText)findViewById(R.id.customerLoginName);
final EditText loginPasswd=(EditText)findViewById(R.id.customerLoginPasswd);
addClickEventListener(R.id.customerLoginButton, new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// int x = SysUtil.getAPNType(getApplicationContext());
// if(x < 0)
// {
// Log.e("net",x+"");
// Toast.makeText(LoginActivity.this, getResources().getString(R.string.badnet), Toast.LENGTH_SHORT).show();
// return;
// }
initial();
String userName=loginPhone.getText().toString();
String passWord=loginPasswd.getText().toString();
Log.d("userName", userName);
Log.d("userPasswd", <PASSWORD>Word);
isPhoneNum = isMobileNO(userName);
if(!isPhoneNum)
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.usernamewrong), Toast.LENGTH_SHORT).show();
return;
}
if(userName == null || userName.equals("") || passWord==null || passWord.equals(""))
{
if(userName == null || userName.equals(""))
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.usernamewrong), Toast.LENGTH_SHORT).show();
}
else if(passWord==null || passWord.equals(""))
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.passwdwrong), Toast.LENGTH_SHORT).show();
}
}
else
{
loginProgressDialog.show();
if(isPhoneNum)
{
loginInfo.clear();
loginInfo.put("userName", userName);
loginInfo.put("passWord", <PASSWORD>);
}
startAsynThread("login");
}
}
});
}
private void initial()
{
setUIRefreshConfig(new UIThreadImpl() {
@Override
public void refresh(Message msg) {
// TODO Auto-generated method stub
loginProgressDialog.dismiss();
if ( 1 == msg.arg2 ){
loginStart();
}
else if(0 == msg.arg2){
Toast.makeText(LoginActivity.this, getResources().getString(R.string.faillogin), Toast.LENGTH_SHORT).show();
// DialogUtil.alert(getResources().getString(R.string.faillogin), LoginActivity.this);
}
else if( 2== msg.arg2)
{
Toast toast=Toast.makeText(LoginActivity.this, getResources().getString(R.string.nonephonenum),Toast.LENGTH_SHORT);
toast.setGravity(Gravity.TOP , 0,180);
toast.show();
}
}
});
setAsynThreadConfig("login", true, new AsynThreadImpl() {
@Override
public Message excute() {
// TODO Auto-generated method stub
Message msg = Message.obtain();
if(isPhoneNum)
{
msg.obj = userManage.login(loginInfo.get("userName"),
loginInfo.get("passWord"), LoginActivity.this);
if ( null != msg.obj ){
msg.arg2 = 1;
}
else{
msg.arg2 = 0;
}
}
else
{
msg.arg2 = 2;
}
finishAsynThread("login");
return msg;
}
});
}
public void loginStart()
{
Toast.makeText(LoginActivity.this, getResources().getString(R.string.successlogin), Toast.LENGTH_LONG).show();
LoginActivity.this.finish();
// Intent intent=new Intent();
// intent.setClass(LoginActivity.this,IndividualCenterActivity.class);
// startActivity(intent);
}
public boolean isMobileNO(String mobiles)
{
Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$");
Matcher m = p.matcher(mobiles);
System.out.println(m.matches()+"---");
return m.matches();
}
}
| 5,824 | 0.64718 | 0.64185 | 195 | 27.825642 | 27.270164 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.235898 | false | false | 13 |
5ce9d8e30add4621fa07d9ed46090cb12e956484 | 22,651,657,539,980 | dfd09a65e7f5d1f282c03b69a53167dd1f2aac2b | /providence-core/src/test/java/net/morimekta/providence/serializer/DefaultSerialzerProviderTest.java | 30cfd001c65a1afae87e97a7c2bca2cd49d7a282 | [
"Apache-2.0",
"MIT",
"LicenseRef-scancode-public-domain"
] | permissive | frodereinertsen/providence | https://github.com/frodereinertsen/providence | 15e15898fd8c1e1fd807c8f4212e13b29a89d065 | d66aeba51a34370fa2c07a01ca6693d5e07414c5 | refs/heads/master | 2021-01-13T04:42:58.156000 | 2017-02-16T17:47:31 | 2017-02-16T18:02:11 | 79,223,015 | 0 | 0 | null | true | 2017-01-17T11:55:55 | 2017-01-17T11:55:54 | 2017-01-05T11:41:47 | 2017-01-10T07:13:00 | 9,348 | 0 | 0 | 0 | null | null | null | package net.morimekta.providence.serializer;
import org.junit.Test;
import static junit.framework.TestCase.fail;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class DefaultSerialzerProviderTest {
@Test
public void testDefault() {
assertThat(new DefaultSerializerProvider().getDefault(), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(BinarySerializer.MIME_TYPE).getDefault(), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(BinarySerializer.ALT_MIME_TYPE).getDefault(), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getDefault(), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.JSON_MIME_TYPE).getDefault(), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(FastBinarySerializer.MIME_TYPE).getDefault(), is(instanceOf(FastBinarySerializer.class)));
}
@Test
public void testGetSerializer() {
assertThat(new DefaultSerializerProvider().getSerializer(BinarySerializer.MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(BinarySerializer.ALT_MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(JsonSerializer.MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(JsonSerializer.JSON_MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(FastBinarySerializer.MIME_TYPE), is(instanceOf(FastBinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(BinarySerializer.MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(BinarySerializer.ALT_MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(JsonSerializer.MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(JsonSerializer.JSON_MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(FastBinarySerializer.MIME_TYPE), is(instanceOf(FastBinarySerializer.class)));
}
@Test
public void testGetSerializer_fail() {
try {
new DefaultSerializerProvider().getSerializer("text/plain");
fail("No exception on no serializer");
} catch (Exception e) {
assertThat(e.getMessage(), is("No such serializer for media type text/plain"));
}
}
}
| UTF-8 | Java | 3,010 | java | DefaultSerialzerProviderTest.java | Java | [] | null | [] | package net.morimekta.providence.serializer;
import org.junit.Test;
import static junit.framework.TestCase.fail;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
public class DefaultSerialzerProviderTest {
@Test
public void testDefault() {
assertThat(new DefaultSerializerProvider().getDefault(), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(BinarySerializer.MIME_TYPE).getDefault(), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(BinarySerializer.ALT_MIME_TYPE).getDefault(), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getDefault(), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.JSON_MIME_TYPE).getDefault(), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(FastBinarySerializer.MIME_TYPE).getDefault(), is(instanceOf(FastBinarySerializer.class)));
}
@Test
public void testGetSerializer() {
assertThat(new DefaultSerializerProvider().getSerializer(BinarySerializer.MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(BinarySerializer.ALT_MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(JsonSerializer.MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(JsonSerializer.JSON_MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider().getSerializer(FastBinarySerializer.MIME_TYPE), is(instanceOf(FastBinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(BinarySerializer.MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(BinarySerializer.ALT_MIME_TYPE), is(instanceOf(BinarySerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(JsonSerializer.MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(JsonSerializer.JSON_MIME_TYPE), is(instanceOf(JsonSerializer.class)));
assertThat(new DefaultSerializerProvider(JsonSerializer.MIME_TYPE).getSerializer(FastBinarySerializer.MIME_TYPE), is(instanceOf(FastBinarySerializer.class)));
}
@Test
public void testGetSerializer_fail() {
try {
new DefaultSerializerProvider().getSerializer("text/plain");
fail("No exception on no serializer");
} catch (Exception e) {
assertThat(e.getMessage(), is("No such serializer for media type text/plain"));
}
}
}
| 3,010 | 0.77309 | 0.77309 | 45 | 65.888885 | 59.427349 | 166 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.933333 | false | false | 13 |
ca5a1ae6eaad881ded6b1ee7c5500c0a6fe45ffa | 17,368,847,763,012 | db4db22f3c226c6b07589152a06c4889960e57dc | /src/main/java/com/training/modules/ec/dao/MtmyGroupActivityDao.java | dff914a207f56e08f2d2452bf54ae02cf49814c9 | [] | no_license | lgdniubi/kenuo | https://github.com/lgdniubi/kenuo | ad4f2789e483242b0bc4f7bec14ee437afa1cf2c | 8e48d7c6e60954543ffe63e34d7be9daced23fd7 | refs/heads/master | 2020-04-16T23:03:27.370000 | 2019-01-16T07:19:01 | 2019-01-16T07:19:01 | 165,996,128 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.training.modules.ec.dao;
import java.util.List;
import com.training.common.persistence.TreeDao;
import com.training.common.persistence.annotation.MyBatisDao;
import com.training.modules.ec.entity.GoodsSpecPrice;
import com.training.modules.ec.entity.MtmyGroupActivity;
import com.training.modules.ec.entity.MtmyGroupActivityGoods;
import com.training.modules.ec.entity.MtmyGroupActivityRemind;
import com.training.modules.ec.entity.Orders;
/**
* 团购活动dao
* @author coffee
* @date 2018年3月30日
*/
@MyBatisDao
public interface MtmyGroupActivityDao extends TreeDao<MtmyGroupActivity> {
/**
* 删除团购项目内的商品
* @param goodsSpecPrice
*/
public void deleteActivityGoodsByActivity(MtmyGroupActivity mtmyGroupActivity);
/**
* 查询活动下所有商品
* @param mtmyGroupActivityGoods
* @return
*/
public List<MtmyGroupActivityGoods> findGoodsList(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 获取活动下商品详情
* @param mtmyGroupActivityGoods
* @return
*/
public MtmyGroupActivityGoods findGoodsForm(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 插入团购项目商品
* @param mtmyGroupActivityGoods
*/
public void insterGroupActivityGoods(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 修改团购项目商品
* @param mtmyGroupActivityGoods
*/
public void updateGroupActivityGoods(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 修改团购项目商品的团购价格
* @param goodsSpecPrice
*/
public void updateActivityGoodsSpec(GoodsSpecPrice goodsSpecPrice);
/**
* 删除团购项目内的商品
* @param goodsSpecPrice
*/
public void deleteActivityGoods(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 查询5分钟内的活动
* @return
*/
public List<MtmyGroupActivity> findGroupActivity();
/**
* 查询提醒用户
* @param activityId
* @return
*/
public List<MtmyGroupActivityRemind> findGroupActivityRemind(String activityId);
/**
* 修改提醒用户
* @param ids
*/
public void updateGroupActivityRemind(List<Integer> list);
/**
* 查询取消团购订单
* @return
*/
public List<Orders> selectCancelGroupOrder();
/**
* 归还取消订单库存
* @param orderId
* @return
*/
public int returnGroupOrder(String orderId);
}
| UTF-8 | Java | 2,354 | java | MtmyGroupActivityDao.java | Java | [
{
"context": "dules.ec.entity.Orders;\n\n/**\n * 团购活动dao\n * @author coffee\n * @date 2018年3月30日\n */\n@MyBatisDao\npublic interf",
"end": 487,
"score": 0.9979043006896973,
"start": 481,
"tag": "USERNAME",
"value": "coffee"
}
] | null | [] | package com.training.modules.ec.dao;
import java.util.List;
import com.training.common.persistence.TreeDao;
import com.training.common.persistence.annotation.MyBatisDao;
import com.training.modules.ec.entity.GoodsSpecPrice;
import com.training.modules.ec.entity.MtmyGroupActivity;
import com.training.modules.ec.entity.MtmyGroupActivityGoods;
import com.training.modules.ec.entity.MtmyGroupActivityRemind;
import com.training.modules.ec.entity.Orders;
/**
* 团购活动dao
* @author coffee
* @date 2018年3月30日
*/
@MyBatisDao
public interface MtmyGroupActivityDao extends TreeDao<MtmyGroupActivity> {
/**
* 删除团购项目内的商品
* @param goodsSpecPrice
*/
public void deleteActivityGoodsByActivity(MtmyGroupActivity mtmyGroupActivity);
/**
* 查询活动下所有商品
* @param mtmyGroupActivityGoods
* @return
*/
public List<MtmyGroupActivityGoods> findGoodsList(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 获取活动下商品详情
* @param mtmyGroupActivityGoods
* @return
*/
public MtmyGroupActivityGoods findGoodsForm(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 插入团购项目商品
* @param mtmyGroupActivityGoods
*/
public void insterGroupActivityGoods(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 修改团购项目商品
* @param mtmyGroupActivityGoods
*/
public void updateGroupActivityGoods(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 修改团购项目商品的团购价格
* @param goodsSpecPrice
*/
public void updateActivityGoodsSpec(GoodsSpecPrice goodsSpecPrice);
/**
* 删除团购项目内的商品
* @param goodsSpecPrice
*/
public void deleteActivityGoods(MtmyGroupActivityGoods mtmyGroupActivityGoods);
/**
* 查询5分钟内的活动
* @return
*/
public List<MtmyGroupActivity> findGroupActivity();
/**
* 查询提醒用户
* @param activityId
* @return
*/
public List<MtmyGroupActivityRemind> findGroupActivityRemind(String activityId);
/**
* 修改提醒用户
* @param ids
*/
public void updateGroupActivityRemind(List<Integer> list);
/**
* 查询取消团购订单
* @return
*/
public List<Orders> selectCancelGroupOrder();
/**
* 归还取消订单库存
* @param orderId
* @return
*/
public int returnGroupOrder(String orderId);
}
| 2,354 | 0.755858 | 0.752109 | 96 | 21.229166 | 25.709305 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.010417 | false | false | 13 |
ad79560cea3621405745378c581020e2b7d72e4f | 31,430,570,694,336 | b2a7769e0e3efafb4da341e4e106fc78b92fcc7c | /upay-commons/src/main/java/com/upay/commons/util/DateUtil.java | e5a3cf0d9afc60cbf6ea540ca5ac2373560558f6 | [] | no_license | soldiers1989/upay-parent | https://github.com/soldiers1989/upay-parent | 6ed801bbdbc67add45a9619408a12687bb20a92c | 199fe079446b836e0ab8e15d3ad106cd750dd8c3 | refs/heads/master | 2020-03-28T18:17:50.015000 | 2018-09-14T10:14:45 | 2018-09-14T10:15:58 | 148,869,001 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.upay.commons.util;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import com.upay.commons.constants.CommunicationConstants;
/**
* 日期工具类
*/
public class DateUtil {
private static int FIRST_DATE_OF_WEEK = Calendar.SUNDAY;
/** 年月日时分秒(无下划线) yyyyMMddHHmmss */
public static final String dtLong = "yyyyMMddHHmmss";
/**
* Formats a Date into a date/time string.
*
* @param date
* @param pattern
* 格式 yyyyMMddHHmmss / yyMMdd /...
* @return
*/
public static String format(Date date, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(date);
}
/**
* Parses text from the beginning of the given string to produce a date.
*
* @param date
* 日期字符串
* @param pattern
* 格式 yyyyMMddHHmmss / yyMMdd /...
* @return
* @throws ParseException
*/
public static Date parse(String date, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
return d;
} catch (ParseException e) {
throw new RuntimeException("日期转换错误", e);
}
}
/**
* add(Calendar.DAY_OF_MONTH, -5)
*
* @param date
* @param calendorField
* @param amount
* @return
*/
public static Date add(Date date, int calendorField, int amount) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(calendorField, amount);
return cal.getTime();
}
/**
* @return Calendar.SUNDAY <br/>
* Calendar.MONDAY <br/>
* Calendar.TUESDAY <br/>
* Calendar.WEDNESDAY <br/>
* Calendar.THURSDAY <br/>
* Calendar.FRIDAY <br/>
* Calendar.SATURDAY <br/>
*/
public static int getDayOfWeek(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case 1:
return 7;
case 2:
return 1;
case 3:
return 2;
case 4:
return 3;
case 5:
return 4;
case 6:
return 5;
default:
return 6;
}
}
/**
* @return Calendar.SUNDAY <br/>
* Calendar.MONDAY <br/>
* Calendar.TUESDAY <br/>
* Calendar.WEDNESDAY <br/>
* Calendar.THURSDAY <br/>
* Calendar.FRIDAY <br/>
* Calendar.SATURDAY <br/>
*/
public static int getDayOfMouth(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_MONTH);
}
/**
* 计算两个日期间相差的天数
*
* @param date
* @param compareDate
* @return
* @throws ParseException
*/
public static long compareTo(Date date, Date compareDate) {
// 去掉时分秒
date = parse(format(date, "yyMMdd"), "yyMMdd");
compareDate = parse(format(compareDate, "yyMMdd"), "yyMMdd");
long a = (date.getTime() - compareDate.getTime()) / (1000 * 60 * 60 * 24);
return a;
}
/**
* 判断是否为一周的最后一天(目前配置的是周日为一周的第一天)
*
* @param date
* @return
*/
public static boolean isEndOfWeek(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, 1);
int weekDay = cal.get(Calendar.DAY_OF_WEEK);
if (weekDay == FIRST_DATE_OF_WEEK) {
return true;
}
return false;
}
/**
* 判断时间是否为月末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是月末 false 表示不为月末
*/
public static boolean isMonthEnd(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
cal.add(Calendar.DAY_OF_MONTH, 1);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1) {
return true;
}
return false;
}
/**
* 判断时间是否为月初
*
* @param nowDate
* @return
*/
public static boolean isMonthBegin(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1) {
return true;
}
return false;
}
/**
* 得到日期的年月
*
* @param dateMouth
* @return
*/
public static String findYearMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
String dateMouth = year + "-" + (month < 10 ? "0" + month : month);
return dateMouth;
}
/**
* 判断时间是否为季末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是季末 false 表示不是季末
*/
public static boolean isQuarterEnd(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
cal.add(Calendar.DAY_OF_MONTH, 1);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.MARCH || month == Calendar.JUNE || month == Calendar.SEPTEMBER
|| month == Calendar.DECEMBER)) {
return true;
}
return false;
}
/**
* 判断时间是否为季出
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是季初 false 表示不是季初
*/
public static boolean isQuarterBegin(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.JANUARY || month == Calendar.APRIL || month == Calendar.JULY
|| month == Calendar.OCTOBER)) {
return true;
}
return false;
}
/**
* 判断时间是否为半年末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是半年末 false 表示不是半年末
*/
public static boolean isHalfYearEnd(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
cal.add(Calendar.DAY_OF_MONTH, 1);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.JUNE || month == Calendar.DECEMBER)) {
return true;
}
return false;
}
/**
* 判断时间是否为半年出
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是半年初 false 表示不是半年初
*/
public static boolean isHalfYearBegin(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.JANUARY || month == Calendar.JULY)) {
return true;
}
return false;
}
/**
* 判断时间是否为年末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是年末 false 表示不为年末
*/
public static boolean isYearEnd(Date nowDate) {
if ("1231".equals(format(nowDate, "MMdd"))) {
return true;
}
return false;
}
/**
* 判断时间是否为年初
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是年初 false 表示不为年初
*/
public static boolean isYearBegin(Date nowDate) {
if ("0101".equals(format(nowDate, "MMdd"))) {
return true;
}
return false;
}
/**
* 获取日期的年月日
*
* @param txnDate
* @return
*/
public static Calendar getYMD(Date date) {
String dateStr = format(date, "yyyyMMdd");
date = parse(dateStr, "yyyyMMdd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
}
/**
* 判断是否为结算日期
*
* @param stlCycle
* ,stlCycleDay,tranDate
* @return boolean
*/
public static boolean chkStlTime(String stlCycle, String stlCycleDay, Date tranDate) {
boolean b = false;
switch (stlCycle.toCharArray()[0]) {
case '1':
// 日结
b = true;
break;
case '2':
// 周结
String nowDate = String.valueOf(DateUtil.getDayOfWeek(tranDate));
if (nowDate.equals(stlCycleDay)) {
b = true;
}
break;
case '3':
// 月结
if (stlCycleDay.equals("0")) {
// 月末结
boolean result = DateUtil.isMonthEnd(tranDate);
if (result) {
b = true;
}
} else {
// 非月末结
String nowDate1 = String.valueOf(DateUtil.getDayOfMouth(tranDate));
if (nowDate1.equals(stlCycleDay)) {
b = true;
}
}
break;
case '4':
// 季结
if ("1".equals(stlCycleDay)) {
// 季初
if (DateUtil.isQuarterBegin(tranDate)) {
b = true;
}
} else if ("0".equals(stlCycleDay)) {
// 季末
if (DateUtil.isQuarterEnd(tranDate)) {
b = true;
}
}
break;
case '5':
// 半年结
if ("1".equals(stlCycleDay)) {
// 半年初
if (DateUtil.isHalfYearBegin(tranDate)) {
b = true;
}
} else if ("0".equals(stlCycleDay)) {
// 半年末
if (DateUtil.isHalfYearEnd(tranDate)) {
b = true;
}
}
break;
case '6':
// 年结
if ("1".equals(stlCycleDay)) {
// 年初
if (DateUtil.isYearBegin(tranDate)) {
b = true;
}
} else if ("0".equals(stlCycleDay)) {
// 年末
if (DateUtil.isYearEnd(tranDate)) {
b = true;
}
}
break;
default:
break;
}
return b;
}
// 比较频繁交易前后两笔的时间间隔与指定的某个时间对比,在这个时间段内,是频繁交易
public static boolean monFreCompare(Date startTime, Date endTime, int interTime) {
boolean flag = false;
long a = (endTime.getTime() - startTime.getTime());
// 两笔交易的时间间隔<=interTime,是频繁交易
long interval = a / 1000;
if (interval <= interTime && interval > 0) {
flag = true;
}
return flag;
}
/**
* 比较两个日期是否为同一天
*
* @param firstDate
* @param secondDate
* @return
*/
public static boolean judgeDate(Date firstDate, Date secondDate) {
Calendar calFirst = Calendar.getInstance();
calFirst.setTime(firstDate);
Calendar calSecond = Calendar.getInstance();
calSecond.setTime(secondDate);
if (calFirst.compareTo(calSecond) == 0) {
return true;
} else {
return false;
}
}
/**
* 获取区间为半小时的数据
*
* @param diff
* @param minute
* @return
*/
public static final String getDiffDateTime(int diff, int minute) {
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.add(Calendar.DATE, diff);
c.add(Calendar.MINUTE, minute);
return getFormat(dtLong).format(c.getTime());
}
/**
* 获取格式
*
* @param format
* @return
*/
public static final DateFormat getFormat(String format) {
return new SimpleDateFormat(format);
}
// 获取两个时间之间相差的天数
public static int betweenDays(Date nowDate, Date LastLogpwdModifytime) {
int result = 0;
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(df.parse(df.format(nowDate)));
long time1 = cal.getTimeInMillis();
Calendar cal1 = Calendar.getInstance();
cal1.setTime(df1.parse(df1.format(LastLogpwdModifytime)));
long time2 = cal1.getTimeInMillis();
result = Integer.parseInt(String.valueOf((time1 - time2) / (1000 * 60 * 60 * 24)));
} catch (ParseException e) {
e.printStackTrace();
}
return result;
}
/**
* 比较两个时间的差值(以分钟统计)
*
* @param postDate
* @param preDate
* @return
*/
public static long betweenTimes(Date postDate, Date preDate) {
long minute = 0;
long subTime = postDate.getTime() - preDate.getTime();
if (subTime >= 0) {
minute = MoneyUtil.divide(new BigDecimal(subTime), new BigDecimal(1000), null).longValue();
}
return minute;
}
/**
* 根据查询范围,获取当日前范围日期
*
* @param date
* @param dateScope
* @return
*/
public static Date getScopeDate(Date date, String dateScope) {
Calendar sysdateCal = Calendar.getInstance();
sysdateCal.setTime(date);
if (CommunicationConstants.QUERY_SCOPE_WEEK.equals(dateScope)) {
sysdateCal.add(Calendar.WEEK_OF_MONTH, -1);
} else if (CommunicationConstants.QUERY_SCOPE_MONTH.equals(dateScope)) {
sysdateCal.add(Calendar.MONTH, -1);
} else if (CommunicationConstants.QUERY_SCOPE_THDMONTH.equals(dateScope)) {
sysdateCal.add(Calendar.MONTH, -3);
}else if(CommunicationConstants.QUERY_SCOPE_THDYEAR.equals(dateScope)){
sysdateCal.add(Calendar.MONTH, -12);
}
return sysdateCal.getTime();
}
/**
* 获取当前明确时间
*
* @param date
* @param dateFlag
* 1:起点时间 2:终点时间
* @return
*/
public static Date getRealTime(Date date, String dateFlag) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (CommunicationConstants.PRE_TIME.equals(dateFlag)) {
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
} else {
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
}
return calendar.getTime();
}
/**
* 获取当前明确日期
*
* @param date
* @param dateFlag
* 1:月初 2:月末
* @return
*/
public static Date getRealMonth(Date date, String dateFlag) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (CommunicationConstants.PRE_TIME.equals(dateFlag)) {
calendar.set(Calendar.DAY_OF_MONTH, 1);
} else {
int lastDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH, lastDay);
}
return calendar.getTime();
}
/**
* 获取日期前一天
*
* @return
*/
public static Date getPreDate(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
cal.add(Calendar.DATE, -1);
return cal.getTime();
}
/**
* 时间秒数相加
*
* @return
*/
public static Date addSecond(Date date,Integer i) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.SECOND, i);
return calendar.getTime();
}
public static void main(String[] args) {
String tempstr=format(new Date(),"yyyyMMddHHmmss");
Date tempdate=parse(tempstr, "yyyyMMddHHmmss");
System.out.println(tempstr);
System.out.println(tempdate);
System.out.println(format(addSecond(tempdate,86400),"yyyyMMddHHmmss"));
// Calendar postCalendar = Calendar.getInstance();
// postCalendar.set(Calendar.YEAR, 2005);
// postCalendar.set(Calendar.MONTH, 2);
// postCalendar.set(Calendar.DAY_OF_MONTH, 1);
// postCalendar.set(Calendar.HOUR, 13);
// postCalendar.set(Calendar.MINUTE, 20);
// postCalendar.set(Calendar.SECOND, 13);
// Calendar preCalendar = Calendar.getInstance();
// preCalendar.set(Calendar.YEAR, 2005);
// preCalendar.set(Calendar.MONTH, 2);
// preCalendar.set(Calendar.DAY_OF_MONTH, 1);
// preCalendar.set(Calendar.HOUR, 11);
// preCalendar.set(Calendar.MINUTE, 26);
// preCalendar.set(Calendar.SECOND, 25);
// long times = betweenTimes(postCalendar.getTime(),
// preCalendar.getTime());
// System.out.println(times/3600 + "小时" + (times/60 - times/3600 * 60) +
// "分钟" + times%60 + "秒");
// System.out.println(DateUtil.format(preCalendar.getTime(),
// "yyyy-MM-dd HH:mm:ss"));
// System.out.println(DateUtil.format(postCalendar.getTime(),
// "yyyy-MM-dd HH:mm:ss"));
// System.out.println(DateUtil.format(DateUtil.getRealTime(preCalendar.getTime(),
// "1"), "yyyy-MM-dd HH:mm:ss"));
// System.out.println(DateUtil.format(DateUtil.getRealTime(postCalendar.getTime(),
// "2"), "yyyy-MM-dd HH:mm:ss"));
/*System.out
.println(DateUtil.format(getRealTime(preCalendar.getTime(), "1"), "yyyy-MM-dd HH:mm:ss:SSS"));
System.out
.println(DateUtil.format(getRealTime(preCalendar.getTime(), "2"), "yyyy-MM-dd HH:mm:ss:SSS"));*/
}
}
| UTF-8 | Java | 19,295 | java | DateUtil.java | Java | [] | null | [] | package com.upay.commons.util;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import com.upay.commons.constants.CommunicationConstants;
/**
* 日期工具类
*/
public class DateUtil {
private static int FIRST_DATE_OF_WEEK = Calendar.SUNDAY;
/** 年月日时分秒(无下划线) yyyyMMddHHmmss */
public static final String dtLong = "yyyyMMddHHmmss";
/**
* Formats a Date into a date/time string.
*
* @param date
* @param pattern
* 格式 yyyyMMddHHmmss / yyMMdd /...
* @return
*/
public static String format(Date date, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return sdf.format(date);
}
/**
* Parses text from the beginning of the given string to produce a date.
*
* @param date
* 日期字符串
* @param pattern
* 格式 yyyyMMddHHmmss / yyMMdd /...
* @return
* @throws ParseException
*/
public static Date parse(String date, String pattern) {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
try {
Date d = sdf.parse(date);
return d;
} catch (ParseException e) {
throw new RuntimeException("日期转换错误", e);
}
}
/**
* add(Calendar.DAY_OF_MONTH, -5)
*
* @param date
* @param calendorField
* @param amount
* @return
*/
public static Date add(Date date, int calendorField, int amount) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(calendorField, amount);
return cal.getTime();
}
/**
* @return Calendar.SUNDAY <br/>
* Calendar.MONDAY <br/>
* Calendar.TUESDAY <br/>
* Calendar.WEDNESDAY <br/>
* Calendar.THURSDAY <br/>
* Calendar.FRIDAY <br/>
* Calendar.SATURDAY <br/>
*/
public static int getDayOfWeek(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
switch (cal.get(Calendar.DAY_OF_WEEK)) {
case 1:
return 7;
case 2:
return 1;
case 3:
return 2;
case 4:
return 3;
case 5:
return 4;
case 6:
return 5;
default:
return 6;
}
}
/**
* @return Calendar.SUNDAY <br/>
* Calendar.MONDAY <br/>
* Calendar.TUESDAY <br/>
* Calendar.WEDNESDAY <br/>
* Calendar.THURSDAY <br/>
* Calendar.FRIDAY <br/>
* Calendar.SATURDAY <br/>
*/
public static int getDayOfMouth(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal.get(Calendar.DAY_OF_MONTH);
}
/**
* 计算两个日期间相差的天数
*
* @param date
* @param compareDate
* @return
* @throws ParseException
*/
public static long compareTo(Date date, Date compareDate) {
// 去掉时分秒
date = parse(format(date, "yyMMdd"), "yyMMdd");
compareDate = parse(format(compareDate, "yyMMdd"), "yyMMdd");
long a = (date.getTime() - compareDate.getTime()) / (1000 * 60 * 60 * 24);
return a;
}
/**
* 判断是否为一周的最后一天(目前配置的是周日为一周的第一天)
*
* @param date
* @return
*/
public static boolean isEndOfWeek(Date date) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_MONTH, 1);
int weekDay = cal.get(Calendar.DAY_OF_WEEK);
if (weekDay == FIRST_DATE_OF_WEEK) {
return true;
}
return false;
}
/**
* 判断时间是否为月末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是月末 false 表示不为月末
*/
public static boolean isMonthEnd(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
cal.add(Calendar.DAY_OF_MONTH, 1);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1) {
return true;
}
return false;
}
/**
* 判断时间是否为月初
*
* @param nowDate
* @return
*/
public static boolean isMonthBegin(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1) {
return true;
}
return false;
}
/**
* 得到日期的年月
*
* @param dateMouth
* @return
*/
public static String findYearMonth(Date date) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
String dateMouth = year + "-" + (month < 10 ? "0" + month : month);
return dateMouth;
}
/**
* 判断时间是否为季末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是季末 false 表示不是季末
*/
public static boolean isQuarterEnd(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
cal.add(Calendar.DAY_OF_MONTH, 1);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.MARCH || month == Calendar.JUNE || month == Calendar.SEPTEMBER
|| month == Calendar.DECEMBER)) {
return true;
}
return false;
}
/**
* 判断时间是否为季出
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是季初 false 表示不是季初
*/
public static boolean isQuarterBegin(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.JANUARY || month == Calendar.APRIL || month == Calendar.JULY
|| month == Calendar.OCTOBER)) {
return true;
}
return false;
}
/**
* 判断时间是否为半年末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是半年末 false 表示不是半年末
*/
public static boolean isHalfYearEnd(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
cal.add(Calendar.DAY_OF_MONTH, 1);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.JUNE || month == Calendar.DECEMBER)) {
return true;
}
return false;
}
/**
* 判断时间是否为半年出
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是半年初 false 表示不是半年初
*/
public static boolean isHalfYearBegin(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
int month = cal.get(Calendar.MONTH);
int day = cal.get(Calendar.DAY_OF_MONTH);
if (day == 1 && (month == Calendar.JANUARY || month == Calendar.JULY)) {
return true;
}
return false;
}
/**
* 判断时间是否为年末
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是年末 false 表示不为年末
*/
public static boolean isYearEnd(Date nowDate) {
if ("1231".equals(format(nowDate, "MMdd"))) {
return true;
}
return false;
}
/**
* 判断时间是否为年初
*
* @param nowDate
* 日期(需要验证的日期)
* @return boolean true 表示是年初 false 表示不为年初
*/
public static boolean isYearBegin(Date nowDate) {
if ("0101".equals(format(nowDate, "MMdd"))) {
return true;
}
return false;
}
/**
* 获取日期的年月日
*
* @param txnDate
* @return
*/
public static Calendar getYMD(Date date) {
String dateStr = format(date, "yyyyMMdd");
date = parse(dateStr, "yyyyMMdd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
}
/**
* 判断是否为结算日期
*
* @param stlCycle
* ,stlCycleDay,tranDate
* @return boolean
*/
public static boolean chkStlTime(String stlCycle, String stlCycleDay, Date tranDate) {
boolean b = false;
switch (stlCycle.toCharArray()[0]) {
case '1':
// 日结
b = true;
break;
case '2':
// 周结
String nowDate = String.valueOf(DateUtil.getDayOfWeek(tranDate));
if (nowDate.equals(stlCycleDay)) {
b = true;
}
break;
case '3':
// 月结
if (stlCycleDay.equals("0")) {
// 月末结
boolean result = DateUtil.isMonthEnd(tranDate);
if (result) {
b = true;
}
} else {
// 非月末结
String nowDate1 = String.valueOf(DateUtil.getDayOfMouth(tranDate));
if (nowDate1.equals(stlCycleDay)) {
b = true;
}
}
break;
case '4':
// 季结
if ("1".equals(stlCycleDay)) {
// 季初
if (DateUtil.isQuarterBegin(tranDate)) {
b = true;
}
} else if ("0".equals(stlCycleDay)) {
// 季末
if (DateUtil.isQuarterEnd(tranDate)) {
b = true;
}
}
break;
case '5':
// 半年结
if ("1".equals(stlCycleDay)) {
// 半年初
if (DateUtil.isHalfYearBegin(tranDate)) {
b = true;
}
} else if ("0".equals(stlCycleDay)) {
// 半年末
if (DateUtil.isHalfYearEnd(tranDate)) {
b = true;
}
}
break;
case '6':
// 年结
if ("1".equals(stlCycleDay)) {
// 年初
if (DateUtil.isYearBegin(tranDate)) {
b = true;
}
} else if ("0".equals(stlCycleDay)) {
// 年末
if (DateUtil.isYearEnd(tranDate)) {
b = true;
}
}
break;
default:
break;
}
return b;
}
// 比较频繁交易前后两笔的时间间隔与指定的某个时间对比,在这个时间段内,是频繁交易
public static boolean monFreCompare(Date startTime, Date endTime, int interTime) {
boolean flag = false;
long a = (endTime.getTime() - startTime.getTime());
// 两笔交易的时间间隔<=interTime,是频繁交易
long interval = a / 1000;
if (interval <= interTime && interval > 0) {
flag = true;
}
return flag;
}
/**
* 比较两个日期是否为同一天
*
* @param firstDate
* @param secondDate
* @return
*/
public static boolean judgeDate(Date firstDate, Date secondDate) {
Calendar calFirst = Calendar.getInstance();
calFirst.setTime(firstDate);
Calendar calSecond = Calendar.getInstance();
calSecond.setTime(secondDate);
if (calFirst.compareTo(calSecond) == 0) {
return true;
} else {
return false;
}
}
/**
* 获取区间为半小时的数据
*
* @param diff
* @param minute
* @return
*/
public static final String getDiffDateTime(int diff, int minute) {
Calendar c = Calendar.getInstance();
c.setTime(new Date());
c.add(Calendar.DATE, diff);
c.add(Calendar.MINUTE, minute);
return getFormat(dtLong).format(c.getTime());
}
/**
* 获取格式
*
* @param format
* @return
*/
public static final DateFormat getFormat(String format) {
return new SimpleDateFormat(format);
}
// 获取两个时间之间相差的天数
public static int betweenDays(Date nowDate, Date LastLogpwdModifytime) {
int result = 0;
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat df1 = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
cal.setTime(df.parse(df.format(nowDate)));
long time1 = cal.getTimeInMillis();
Calendar cal1 = Calendar.getInstance();
cal1.setTime(df1.parse(df1.format(LastLogpwdModifytime)));
long time2 = cal1.getTimeInMillis();
result = Integer.parseInt(String.valueOf((time1 - time2) / (1000 * 60 * 60 * 24)));
} catch (ParseException e) {
e.printStackTrace();
}
return result;
}
/**
* 比较两个时间的差值(以分钟统计)
*
* @param postDate
* @param preDate
* @return
*/
public static long betweenTimes(Date postDate, Date preDate) {
long minute = 0;
long subTime = postDate.getTime() - preDate.getTime();
if (subTime >= 0) {
minute = MoneyUtil.divide(new BigDecimal(subTime), new BigDecimal(1000), null).longValue();
}
return minute;
}
/**
* 根据查询范围,获取当日前范围日期
*
* @param date
* @param dateScope
* @return
*/
public static Date getScopeDate(Date date, String dateScope) {
Calendar sysdateCal = Calendar.getInstance();
sysdateCal.setTime(date);
if (CommunicationConstants.QUERY_SCOPE_WEEK.equals(dateScope)) {
sysdateCal.add(Calendar.WEEK_OF_MONTH, -1);
} else if (CommunicationConstants.QUERY_SCOPE_MONTH.equals(dateScope)) {
sysdateCal.add(Calendar.MONTH, -1);
} else if (CommunicationConstants.QUERY_SCOPE_THDMONTH.equals(dateScope)) {
sysdateCal.add(Calendar.MONTH, -3);
}else if(CommunicationConstants.QUERY_SCOPE_THDYEAR.equals(dateScope)){
sysdateCal.add(Calendar.MONTH, -12);
}
return sysdateCal.getTime();
}
/**
* 获取当前明确时间
*
* @param date
* @param dateFlag
* 1:起点时间 2:终点时间
* @return
*/
public static Date getRealTime(Date date, String dateFlag) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (CommunicationConstants.PRE_TIME.equals(dateFlag)) {
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
} else {
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
calendar.set(Calendar.MILLISECOND, 999);
}
return calendar.getTime();
}
/**
* 获取当前明确日期
*
* @param date
* @param dateFlag
* 1:月初 2:月末
* @return
*/
public static Date getRealMonth(Date date, String dateFlag) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
if (CommunicationConstants.PRE_TIME.equals(dateFlag)) {
calendar.set(Calendar.DAY_OF_MONTH, 1);
} else {
int lastDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
calendar.set(Calendar.DAY_OF_MONTH, lastDay);
}
return calendar.getTime();
}
/**
* 获取日期前一天
*
* @return
*/
public static Date getPreDate(Date nowDate) {
Calendar cal = Calendar.getInstance();
cal.setTime(nowDate);
cal.add(Calendar.DATE, -1);
return cal.getTime();
}
/**
* 时间秒数相加
*
* @return
*/
public static Date addSecond(Date date,Integer i) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.SECOND, i);
return calendar.getTime();
}
public static void main(String[] args) {
String tempstr=format(new Date(),"yyyyMMddHHmmss");
Date tempdate=parse(tempstr, "yyyyMMddHHmmss");
System.out.println(tempstr);
System.out.println(tempdate);
System.out.println(format(addSecond(tempdate,86400),"yyyyMMddHHmmss"));
// Calendar postCalendar = Calendar.getInstance();
// postCalendar.set(Calendar.YEAR, 2005);
// postCalendar.set(Calendar.MONTH, 2);
// postCalendar.set(Calendar.DAY_OF_MONTH, 1);
// postCalendar.set(Calendar.HOUR, 13);
// postCalendar.set(Calendar.MINUTE, 20);
// postCalendar.set(Calendar.SECOND, 13);
// Calendar preCalendar = Calendar.getInstance();
// preCalendar.set(Calendar.YEAR, 2005);
// preCalendar.set(Calendar.MONTH, 2);
// preCalendar.set(Calendar.DAY_OF_MONTH, 1);
// preCalendar.set(Calendar.HOUR, 11);
// preCalendar.set(Calendar.MINUTE, 26);
// preCalendar.set(Calendar.SECOND, 25);
// long times = betweenTimes(postCalendar.getTime(),
// preCalendar.getTime());
// System.out.println(times/3600 + "小时" + (times/60 - times/3600 * 60) +
// "分钟" + times%60 + "秒");
// System.out.println(DateUtil.format(preCalendar.getTime(),
// "yyyy-MM-dd HH:mm:ss"));
// System.out.println(DateUtil.format(postCalendar.getTime(),
// "yyyy-MM-dd HH:mm:ss"));
// System.out.println(DateUtil.format(DateUtil.getRealTime(preCalendar.getTime(),
// "1"), "yyyy-MM-dd HH:mm:ss"));
// System.out.println(DateUtil.format(DateUtil.getRealTime(postCalendar.getTime(),
// "2"), "yyyy-MM-dd HH:mm:ss"));
/*System.out
.println(DateUtil.format(getRealTime(preCalendar.getTime(), "1"), "yyyy-MM-dd HH:mm:ss:SSS"));
System.out
.println(DateUtil.format(getRealTime(preCalendar.getTime(), "2"), "yyyy-MM-dd HH:mm:ss:SSS"));*/
}
}
| 19,295 | 0.530325 | 0.521214 | 669 | 26.233183 | 22.137957 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457399 | false | false | 13 |
7afa23b87b804f5dbf385e1b2cea083877a4aff3 | 27,212,912,808,484 | 48b3181218454150fa4990599553251be004bc0d | /HW13.7/src/hw13/pkg7/TicTacToePanel.java | 94dfd7600bbc3c69ff2d357b303ebdb75128ea32 | [] | no_license | jevans60/ClassWork | https://github.com/jevans60/ClassWork | 2a201e3e7d96f2869d9106e5325971e1a08f4c09 | 17441910da2595ac25737a1253da871bd4d82ecd | refs/heads/master | 2021-01-21T14:08:36.492000 | 2016-04-28T02:53:04 | 2016-04-28T02:53:04 | 15,921,500 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hw13.pkg7;
import java.awt.*;
import javax.swing.*;
public class TicTacToePanel extends JPanel
{
public static final int BLANK = 0;
public static final int DRAWX = 1;
public static final int DRAWO = 2;
private int currentShape;
TicTacToePanel()
{
}
TicTacToePanel(int shape)
{
currentShape = shape;
}
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
switch(currentShape){
case DRAWX:
drawX(g);
break;
case DRAWO:
drawO(g);
break;
case BLANK:
default:
break;
}
}
private void drawO(Graphics g)
{
int width = getWidth();
int height = getHeight();
int startX = (int)(width*.15);
int startY = (int)(height *.15);
int ovalWidth = (int)(width*.7);
int ovalHeight = (int)(height*.7);
g.drawOval(startX, startY, ovalWidth, ovalHeight);
}
private void drawX(Graphics g)
{
int width = getWidth();
int height = getHeight();
int startX = (int)(width*.15);
int startY = (int)(height *.15);
int endX = (int)(width*.85);
int endY = (int)(height *.85);
g.drawLine(startX, startY, endX, endY);
g.drawLine(endX, startY, startX, endY);
}
}
| UTF-8 | Java | 1,474 | java | TicTacToePanel.java | Java | [] | null | [] |
package hw13.pkg7;
import java.awt.*;
import javax.swing.*;
public class TicTacToePanel extends JPanel
{
public static final int BLANK = 0;
public static final int DRAWX = 1;
public static final int DRAWO = 2;
private int currentShape;
TicTacToePanel()
{
}
TicTacToePanel(int shape)
{
currentShape = shape;
}
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
switch(currentShape){
case DRAWX:
drawX(g);
break;
case DRAWO:
drawO(g);
break;
case BLANK:
default:
break;
}
}
private void drawO(Graphics g)
{
int width = getWidth();
int height = getHeight();
int startX = (int)(width*.15);
int startY = (int)(height *.15);
int ovalWidth = (int)(width*.7);
int ovalHeight = (int)(height*.7);
g.drawOval(startX, startY, ovalWidth, ovalHeight);
}
private void drawX(Graphics g)
{
int width = getWidth();
int height = getHeight();
int startX = (int)(width*.15);
int startY = (int)(height *.15);
int endX = (int)(width*.85);
int endY = (int)(height *.85);
g.drawLine(startX, startY, endX, endY);
g.drawLine(endX, startY, startX, endY);
}
}
| 1,474 | 0.507463 | 0.493894 | 65 | 21.661539 | 15.186307 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.584615 | false | false | 13 |
a139adb083493736a935901b56cfb5d7309eb4e8 | 3,126,736,213,504 | 628ae8742128c4c576bf29cfa474978ea31c423a | /src/com/nightfire/comms/socket/ClientSocketRequestHandler.java | e5bc8428f3e3650fa9c77880426484a90d09a2f8 | [] | no_license | harishgupta111/SOA | https://github.com/harishgupta111/SOA | f906c1b17d8109e3d0413fce4733ff6c1c643b46 | 6272f9516f34e0b86e6bf513c68c0828a5fa207e | refs/heads/master | 2020-05-17T19:04:29.561000 | 2013-06-25T11:27:49 | 2013-06-25T11:27:49 | 10,152,719 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null | /**
* Copyright (c) 2000 Nightfire Software, Inc. All rights reserved.
*/
package com.nightfire.comms.socket;
import java.net.*;
import com.nightfire.framework.util.*;
/**
* Interface that all code servicing client socket requests must implement
* in order to be associated with a socket listener. A new request handler
* will be used to service each client request.
*/
public interface ClientSocketRequestHandler
{
/**
* Initialize the request handler.
*
* @param key Property-key to use in locating initialization properties.
* @param type Property-type to use in locating initialization properties.
*
* @exception FrameworkException Thrown on errors.
*/
public void initialize ( String key, String type ) throws FrameworkException;
/**
* Process a request comming from a client over a socket.
* NOTE: The invoking socket listener will close the socket
* when the handler is done with it.
*
* @param clientSocket Socket used to interact with client.
*
* @exception FrameworkException Thrown on any errors.
*/
public void process ( Socket clientSocket ) throws FrameworkException;
}
| UTF-8 | Java | 1,241 | java | ClientSocketRequestHandler.java | Java | [] | null | [] | /**
* Copyright (c) 2000 Nightfire Software, Inc. All rights reserved.
*/
package com.nightfire.comms.socket;
import java.net.*;
import com.nightfire.framework.util.*;
/**
* Interface that all code servicing client socket requests must implement
* in order to be associated with a socket listener. A new request handler
* will be used to service each client request.
*/
public interface ClientSocketRequestHandler
{
/**
* Initialize the request handler.
*
* @param key Property-key to use in locating initialization properties.
* @param type Property-type to use in locating initialization properties.
*
* @exception FrameworkException Thrown on errors.
*/
public void initialize ( String key, String type ) throws FrameworkException;
/**
* Process a request comming from a client over a socket.
* NOTE: The invoking socket listener will close the socket
* when the handler is done with it.
*
* @param clientSocket Socket used to interact with client.
*
* @exception FrameworkException Thrown on any errors.
*/
public void process ( Socket clientSocket ) throws FrameworkException;
}
| 1,241 | 0.675262 | 0.672039 | 41 | 28.268293 | 29.756758 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.195122 | false | false | 13 |
ff9fdcece0b3ec66e50d8902eff53d77302b863f | 9,294,309,252,178 | 794bb3e1878710eaca6fb386d7f4b3436ddc6c38 | /commons/test/java/com/continuent/tungsten/common/utils/ManifestParserTest.java | 59baf90977bf9bd21a6eda36f6394481d2667ac4 | [
"Apache-2.0"
] | permissive | continuent/tungsten-replicator | https://github.com/continuent/tungsten-replicator | 29ef78c51fe61734696243953a4d75ea753c0776 | 7a0e5acda12ef290072cc4cc894e34c90c71618a | refs/heads/master | 2018-01-03T15:13:11.952000 | 2017-10-13T16:27:35 | 2017-10-13T16:27:35 | 71,462,292 | 138 | 51 | null | false | 2018-03-09T14:13:57 | 2016-10-20T12:45:55 | 2018-03-03T06:33:47 | 2018-02-08T04:29:53 | 28,818 | 77 | 31 | 7 | Java | false | null | /**
* VMware Continuent Tungsten Replicator
* Copyright (C) 2015 VMware, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Initial developer(s): Linas Virbalas
* Contributor(s):
*/
package com.continuent.tungsten.common.utils;
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.log4j.Logger;
import org.junit.Test;
import com.continuent.tungsten.common.utils.ManifestParser;
/**
* Unit test against ManifestParser.
*
* @author <a href="mailto:linas.virbalas@continuent.com">Linas Virbalas</a>
* @version 1.0
*/
public class ManifestParserTest
{
private static Logger logger = Logger.getLogger(ManifestParserTest.class);
private static final String product = "Tungsten Enterprise";
private static final int versionMajor = 1;
private static final int versionMinor = 3;
private static final int versionRevision = 2;
private static final long hudsonBuildNumber = 999;
/**
* Test method for
* {@link com.continuent.tungsten.common.utils.ManifestParser#ManifestParser()}
* with no manifest file. .
*/
@Test
public void testManifestParserNoFile() throws IOException
{
ManifestParser manifest = new ManifestParser();
deleteJSONManifest(manifest.getManifestPath());
logger.info("Parsing with ManifestParser. Error expected as there is no manifest:");
manifest.parse();
assertFalse(
"isFileParsed() should return false if no manifest is provided",
manifest.isFileParsed());
assertNull(
"getRelease() should return null if manifest was not parsed",
manifest.getProduct());
assertNull(
"getHudsonBuildNumber() should return null if manifest was not parsed",
manifest.getHudsonBuildNumber());
assertNotNull("getReleaseWithBuildNumber() should never return null",
manifest.getReleaseWithBuildNumber());
logger.info("getReleaseWithBuildNumber(): "
+ manifest.getReleaseWithBuildNumber());
}
/**
* Removes .manifest.json file form the file system.
*/
private void deleteJSONManifest(String manifestPath) throws IOException
{
logger.info("Deleting " + manifestPath);
File file = new File(manifestPath);
if (file.exists())
if (!file.delete())
throw new IOException("Unable to delete " + manifestPath);
}
/**
* Writes a simplified .manifest.json file for testing against.
*/
private void writeSampleJSONManifest(String manifestPath)
throws IOException
{
logger.info("Writing sample " + manifestPath);
FileWriter outFile = new FileWriter(manifestPath);
PrintWriter out = new PrintWriter(outFile);
out.println("{");
out.println(" \"date\": \"Mon May 9 18:53:41 CEST 2011\",");
out.println(" \"product\": \"" + product + "\",");
out.println(" \"version\":");
out.println(" {");
out.println(" \"major\": " + versionMajor + ",");
out.println(" \"minor\": " + versionMinor + ",");
out.println(" \"revision\": " + versionRevision);
out.println(" },");
out.println(" \"userAccount\": \"linasvirbalas\",");
out.println(" \"host\": \"hostalpha\",");
out.println(" \"hudson\":");
out.println(" {");
out.println(" \"buildNumber\": " + hudsonBuildNumber + ",");
out.println(" \"buildId\": 306");
out.println(" },");
out.println(" \"SVN\":");
out.println(" {");
out.println(" \"commons\":");
out.println(" {");
out.println(" \"URL\": \"https://tungsten.svn.sourceforge.net/svnroot/tungsten/branches/tungsten-1.3/commons\",");
out.println(" \"revision\": 2939");
out.println(" }");
out.println(" }");
out.println("}");
out.close();
}
/**
* Test method for
* {@link com.continuent.tungsten.common.utils.ManifestParser#ManifestParser()}
* with manifest file. Ensures that basic functionality works.
*/
@Test
public void testManifestParserWithFile() throws IOException
{
ManifestParser manifest = new ManifestParser();
writeSampleJSONManifest(manifest.getManifestPath());
manifest.parse();
assertTrue(
"isFileParsed() should return true when manifest is provided",
manifest.isFileParsed());
assertNotNull(
"getRelease() should return a String as it is defined in the manifest",
manifest.getProduct());
assertEquals(product, manifest.getProduct());
logger.info("getRelease(): " + manifest.getProduct());
assertNull(
"getHudsonJobName() should return null when hudson.jobName is not defined in the manifest",
manifest.getHudsonSVNRevision());
assertNotNull(
"getHudsonBuildNumber() should return a valid build number as it is defined in the manifest",
manifest.getHudsonBuildNumber());
assertEquals(hudsonBuildNumber, manifest.getHudsonBuildNumber());
logger.info("getHudsonBuildNumber(): "
+ manifest.getHudsonBuildNumber());
assertNotNull("getReleaseWithBuildNumber() should never return null",
manifest.getReleaseWithBuildNumber());
logger.info("getReleaseWithBuildNumber(): "
+ manifest.getReleaseWithBuildNumber());
deleteJSONManifest(manifest.getManifestPath());
}
}
| UTF-8 | Java | 6,358 | java | ManifestParserTest.java | Java | [
{
"context": "ons under the License.\n *\n * Initial developer(s): Linas Virbalas\n * Contributor(s): \n */\n\npackage com.continuent.t",
"end": 708,
"score": 0.9998853206634521,
"start": 694,
"tag": "NAME",
"value": "Linas Virbalas"
},
{
"context": "st ManifestParser.\n * \n * @auth... | null | [] | /**
* VMware Continuent Tungsten Replicator
* Copyright (C) 2015 VMware, Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Initial developer(s): <NAME>
* Contributor(s):
*/
package com.continuent.tungsten.common.utils;
import static org.junit.Assert.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import org.apache.log4j.Logger;
import org.junit.Test;
import com.continuent.tungsten.common.utils.ManifestParser;
/**
* Unit test against ManifestParser.
*
* @author <a href="mailto:<EMAIL>"><NAME></a>
* @version 1.0
*/
public class ManifestParserTest
{
private static Logger logger = Logger.getLogger(ManifestParserTest.class);
private static final String product = "Tungsten Enterprise";
private static final int versionMajor = 1;
private static final int versionMinor = 3;
private static final int versionRevision = 2;
private static final long hudsonBuildNumber = 999;
/**
* Test method for
* {@link com.continuent.tungsten.common.utils.ManifestParser#ManifestParser()}
* with no manifest file. .
*/
@Test
public void testManifestParserNoFile() throws IOException
{
ManifestParser manifest = new ManifestParser();
deleteJSONManifest(manifest.getManifestPath());
logger.info("Parsing with ManifestParser. Error expected as there is no manifest:");
manifest.parse();
assertFalse(
"isFileParsed() should return false if no manifest is provided",
manifest.isFileParsed());
assertNull(
"getRelease() should return null if manifest was not parsed",
manifest.getProduct());
assertNull(
"getHudsonBuildNumber() should return null if manifest was not parsed",
manifest.getHudsonBuildNumber());
assertNotNull("getReleaseWithBuildNumber() should never return null",
manifest.getReleaseWithBuildNumber());
logger.info("getReleaseWithBuildNumber(): "
+ manifest.getReleaseWithBuildNumber());
}
/**
* Removes .manifest.json file form the file system.
*/
private void deleteJSONManifest(String manifestPath) throws IOException
{
logger.info("Deleting " + manifestPath);
File file = new File(manifestPath);
if (file.exists())
if (!file.delete())
throw new IOException("Unable to delete " + manifestPath);
}
/**
* Writes a simplified .manifest.json file for testing against.
*/
private void writeSampleJSONManifest(String manifestPath)
throws IOException
{
logger.info("Writing sample " + manifestPath);
FileWriter outFile = new FileWriter(manifestPath);
PrintWriter out = new PrintWriter(outFile);
out.println("{");
out.println(" \"date\": \"Mon May 9 18:53:41 CEST 2011\",");
out.println(" \"product\": \"" + product + "\",");
out.println(" \"version\":");
out.println(" {");
out.println(" \"major\": " + versionMajor + ",");
out.println(" \"minor\": " + versionMinor + ",");
out.println(" \"revision\": " + versionRevision);
out.println(" },");
out.println(" \"userAccount\": \"linasvirbalas\",");
out.println(" \"host\": \"hostalpha\",");
out.println(" \"hudson\":");
out.println(" {");
out.println(" \"buildNumber\": " + hudsonBuildNumber + ",");
out.println(" \"buildId\": 306");
out.println(" },");
out.println(" \"SVN\":");
out.println(" {");
out.println(" \"commons\":");
out.println(" {");
out.println(" \"URL\": \"https://tungsten.svn.sourceforge.net/svnroot/tungsten/branches/tungsten-1.3/commons\",");
out.println(" \"revision\": 2939");
out.println(" }");
out.println(" }");
out.println("}");
out.close();
}
/**
* Test method for
* {@link com.continuent.tungsten.common.utils.ManifestParser#ManifestParser()}
* with manifest file. Ensures that basic functionality works.
*/
@Test
public void testManifestParserWithFile() throws IOException
{
ManifestParser manifest = new ManifestParser();
writeSampleJSONManifest(manifest.getManifestPath());
manifest.parse();
assertTrue(
"isFileParsed() should return true when manifest is provided",
manifest.isFileParsed());
assertNotNull(
"getRelease() should return a String as it is defined in the manifest",
manifest.getProduct());
assertEquals(product, manifest.getProduct());
logger.info("getRelease(): " + manifest.getProduct());
assertNull(
"getHudsonJobName() should return null when hudson.jobName is not defined in the manifest",
manifest.getHudsonSVNRevision());
assertNotNull(
"getHudsonBuildNumber() should return a valid build number as it is defined in the manifest",
manifest.getHudsonBuildNumber());
assertEquals(hudsonBuildNumber, manifest.getHudsonBuildNumber());
logger.info("getHudsonBuildNumber(): "
+ manifest.getHudsonBuildNumber());
assertNotNull("getReleaseWithBuildNumber() should never return null",
manifest.getReleaseWithBuildNumber());
logger.info("getReleaseWithBuildNumber(): "
+ manifest.getReleaseWithBuildNumber());
deleteJSONManifest(manifest.getManifestPath());
}
}
| 6,320 | 0.621107 | 0.615288 | 173 | 35.751446 | 28.465202 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.560694 | false | false | 13 |
2dbefeaea699800a45046714338708d924f2581a | 24,661,702,233,151 | d3da076144047a53962a7fc0e9c8c052921a41f4 | /app/src/main/java/com/lym/news/module/news/model/INewsDetailInteractor.java | 3e6368039e6a0236d062659565ea0dfbbd85a10a | [] | no_license | YangMian/NewsClient | https://github.com/YangMian/NewsClient | 7b760f5649e3a737f2feaf570107268300172cf3 | 37df6b98b1f04976d54d7754fa79382f98e669d7 | refs/heads/master | 2018-05-14T02:01:40.193000 | 2016-07-28T09:23:31 | 2016-07-28T09:23:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.lym.news.module.news.model;
import com.lym.news.callback.RequestCallback;
import rx.Subscription;
/**
* Fuction: 新闻详情的Model层接口<p>
*/
public interface INewsDetailInteractor<T> {
Subscription requestNewsDetail(RequestCallback<T> callback, String id);
}
| UTF-8 | Java | 290 | java | INewsDetailInteractor.java | Java | [] | null | [] | package com.lym.news.module.news.model;
import com.lym.news.callback.RequestCallback;
import rx.Subscription;
/**
* Fuction: 新闻详情的Model层接口<p>
*/
public interface INewsDetailInteractor<T> {
Subscription requestNewsDetail(RequestCallback<T> callback, String id);
}
| 290 | 0.766423 | 0.766423 | 14 | 18.571428 | 23.181625 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.357143 | false | false | 13 |
3e7c2aaef2e0eca97c015889fddeb5c9e453df7e | 4,612,794,900,693 | efc7e5c670fd6dabb99db9b30ec7fb67c404f2f2 | /HomeWork-18/src/ua/lviv/lgs/StringToInteger.java | f424d15be0c6d7d69b7e3a17d28a7f42b66367d0 | [] | no_license | mimo3a/Java-Core--Lesson-18 | https://github.com/mimo3a/Java-Core--Lesson-18 | 77384506e5439d41a9282436beaa66b0fd6cc629 | 9c1b7a5927c96b34652cab9c0abca60c63094467 | refs/heads/master | 2023-02-08T05:36:24.456000 | 2020-12-27T12:02:34 | 2020-12-27T12:02:34 | 324,752,704 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package ua.lviv.lgs;
import java.util.ArrayList;
import java.util.List;
public class StringToInteger <T>{
List <T>list;
public StringToInteger(List<T> list) {
super();
this.list = list;
}
public void addNumber(T number) {
this.list.add(number);
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
}
| UTF-8 | Java | 400 | java | StringToInteger.java | Java | [] | null | [] | package ua.lviv.lgs;
import java.util.ArrayList;
import java.util.List;
public class StringToInteger <T>{
List <T>list;
public StringToInteger(List<T> list) {
super();
this.list = list;
}
public void addNumber(T number) {
this.list.add(number);
}
public List<T> getList() {
return list;
}
public void setList(List<T> list) {
this.list = list;
}
}
| 400 | 0.6225 | 0.6225 | 33 | 10.939394 | 12.742055 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.272727 | false | false | 13 |
31627e832b119d90b06b8616b4a4ea6e1eadc885 | 21,036,749,835,783 | 3410bb7e8bfa0e0e4164da8faa421246310cb9ed | /app/src/main/java/com/udacity/googleindiascholarships/stories/ui/StoriesFragment.java | f807a67d31ffa3a14742503b269c6e986379f1db | [] | no_license | Jithin-Jude/gis-2k18 | https://github.com/Jithin-Jude/gis-2k18 | 9477c43614042b9300b45af76a06d36204d6c505 | 0e4ae29c62e18d5b4f1aec97f4bbac9712d3a622 | refs/heads/master | 2020-03-30T13:22:18.462000 | 2018-10-02T16:18:52 | 2018-10-02T16:18:52 | 132,159,351 | 0 | 1 | null | true | 2018-05-04T15:43:34 | 2018-05-04T15:43:33 | 2018-05-04T07:44:55 | 2018-05-04T14:51:23 | 6,120 | 0 | 0 | 0 | null | false | null | package com.udacity.googleindiascholarships.stories.ui;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SearchView;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.udacity.googleindiascholarships.R;
import com.udacity.googleindiascholarships.community.ui.entities.ExternalLinks;
import com.udacity.googleindiascholarships.stories.ui.adapters.AllStoriesAdapter;
import com.udacity.googleindiascholarships.stories.ui.adapters.FeaturedStoriesAdapter;
import com.udacity.googleindiascholarships.utils.Constants;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class StoriesFragment extends android.support.v4.app.Fragment{
RecyclerView rvFeaturedStories,rvAllStories;
LinearLayoutManager llmFeaturedStories,llmAllStories;
FeaturedStoriesAdapter featuredStoriesAdapter;
AllStoriesAdapter allStoriesAdapter;
private int numberOfFeaturedStories = 10;
private List<ExternalLinks> featuredStoriesLinks;
private List<ExternalLinks> allStoriesLinks;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View customView = inflater.inflate(R.layout.fragment_stories,container,false);
rvFeaturedStories = (RecyclerView) customView.findViewById(R.id.rv_featured_stories);
rvAllStories = (RecyclerView) customView.findViewById(R.id.rv_all_stories);
llmFeaturedStories = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false);
rvFeaturedStories.setLayoutManager(llmFeaturedStories);
allStoriesLinks = new ArrayList<ExternalLinks>();
featuredStoriesLinks = new ArrayList<ExternalLinks>();
if(checkInternetConnectivity()){
readFeaturedStoriesFromFirebase();
readAllStoriesFromFirebase();
featuredStoriesAdapter = new FeaturedStoriesAdapter(getContext(),allStoriesLinks,numberOfFeaturedStories);
rvFeaturedStories.setAdapter(featuredStoriesAdapter);
llmAllStories = new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false);
rvAllStories.setLayoutManager(llmAllStories);
allStoriesAdapter = new AllStoriesAdapter(getContext(),allStoriesLinks);
rvAllStories.setAdapter(allStoriesAdapter);
}else{
Toast.makeText(getContext(),"No internet connection",Toast.LENGTH_LONG).show();
}
return customView;
}
private void readFeaturedStoriesFromFirebase() {
FirebaseDatabase database = FirebaseDatabase.getInstance(Constants.DATABASE_URL);
DatabaseReference mExternalResourcesRef = database.getReference("stories");
mExternalResourcesRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
featuredStoriesLinks.clear();
for (DataSnapshot postSnapshot: snapshot.getChildren()) {
ExternalLinks currentBlog = postSnapshot.getValue(ExternalLinks.class);
featuredStoriesLinks.add(currentBlog);
}
Log.i("TAG", "onDataChange: Hello Testing");
featuredStoriesAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
System.out.println("The read failed: " + databaseError.getMessage());
Toast.makeText(getActivity(), "Network Error", Toast.LENGTH_SHORT).show();
}
});
}
private void readAllStoriesFromFirebase() {
final FirebaseDatabase database = FirebaseDatabase.getInstance(Constants.DATABASE_URL);
DatabaseReference mExternalResourcesRef = database.getReference("stories");
mExternalResourcesRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
allStoriesLinks.clear();
for (DataSnapshot postSnapshot: snapshot.getChildren()) {
ExternalLinks currentBlog = postSnapshot.getValue(ExternalLinks.class);
allStoriesLinks.add(currentBlog);
}
Log.i("TAG", "onDataChange: Hello Testing");
allStoriesAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.i("TAG", "onDataChange: "+databaseError.getMessage());
Toast.makeText(getActivity(), "Network Error", Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Stories");
}
public boolean checkInternetConnectivity(){
//Check internet connection//
ConnectivityManager connectivityManager = (ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
// Get details on the currently active default data network//
NetworkInfo netInformation = connectivityManager.getActiveNetworkInfo();
// If there is a network connection, then fetch data//
if(netInformation!=null && netInformation.isConnected()){
return true;
}else{
return false;
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_search,menu);
MenuItem menuItem = menu.findItem(R.id.menu_search);
SearchView searchView = (SearchView) menuItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
}
| UTF-8 | Java | 7,204 | java | StoriesFragment.java | Java | [] | null | [] | package com.udacity.googleindiascholarships.stories.ui;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SearchView;
import android.widget.Toast;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.udacity.googleindiascholarships.R;
import com.udacity.googleindiascholarships.community.ui.entities.ExternalLinks;
import com.udacity.googleindiascholarships.stories.ui.adapters.AllStoriesAdapter;
import com.udacity.googleindiascholarships.stories.ui.adapters.FeaturedStoriesAdapter;
import com.udacity.googleindiascholarships.utils.Constants;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class StoriesFragment extends android.support.v4.app.Fragment{
RecyclerView rvFeaturedStories,rvAllStories;
LinearLayoutManager llmFeaturedStories,llmAllStories;
FeaturedStoriesAdapter featuredStoriesAdapter;
AllStoriesAdapter allStoriesAdapter;
private int numberOfFeaturedStories = 10;
private List<ExternalLinks> featuredStoriesLinks;
private List<ExternalLinks> allStoriesLinks;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
View customView = inflater.inflate(R.layout.fragment_stories,container,false);
rvFeaturedStories = (RecyclerView) customView.findViewById(R.id.rv_featured_stories);
rvAllStories = (RecyclerView) customView.findViewById(R.id.rv_all_stories);
llmFeaturedStories = new LinearLayoutManager(getContext(),LinearLayoutManager.HORIZONTAL,false);
rvFeaturedStories.setLayoutManager(llmFeaturedStories);
allStoriesLinks = new ArrayList<ExternalLinks>();
featuredStoriesLinks = new ArrayList<ExternalLinks>();
if(checkInternetConnectivity()){
readFeaturedStoriesFromFirebase();
readAllStoriesFromFirebase();
featuredStoriesAdapter = new FeaturedStoriesAdapter(getContext(),allStoriesLinks,numberOfFeaturedStories);
rvFeaturedStories.setAdapter(featuredStoriesAdapter);
llmAllStories = new LinearLayoutManager(getContext(),LinearLayoutManager.VERTICAL,false);
rvAllStories.setLayoutManager(llmAllStories);
allStoriesAdapter = new AllStoriesAdapter(getContext(),allStoriesLinks);
rvAllStories.setAdapter(allStoriesAdapter);
}else{
Toast.makeText(getContext(),"No internet connection",Toast.LENGTH_LONG).show();
}
return customView;
}
private void readFeaturedStoriesFromFirebase() {
FirebaseDatabase database = FirebaseDatabase.getInstance(Constants.DATABASE_URL);
DatabaseReference mExternalResourcesRef = database.getReference("stories");
mExternalResourcesRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
featuredStoriesLinks.clear();
for (DataSnapshot postSnapshot: snapshot.getChildren()) {
ExternalLinks currentBlog = postSnapshot.getValue(ExternalLinks.class);
featuredStoriesLinks.add(currentBlog);
}
Log.i("TAG", "onDataChange: Hello Testing");
featuredStoriesAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
System.out.println("The read failed: " + databaseError.getMessage());
Toast.makeText(getActivity(), "Network Error", Toast.LENGTH_SHORT).show();
}
});
}
private void readAllStoriesFromFirebase() {
final FirebaseDatabase database = FirebaseDatabase.getInstance(Constants.DATABASE_URL);
DatabaseReference mExternalResourcesRef = database.getReference("stories");
mExternalResourcesRef.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot snapshot) {
allStoriesLinks.clear();
for (DataSnapshot postSnapshot: snapshot.getChildren()) {
ExternalLinks currentBlog = postSnapshot.getValue(ExternalLinks.class);
allStoriesLinks.add(currentBlog);
}
Log.i("TAG", "onDataChange: Hello Testing");
allStoriesAdapter.notifyDataSetChanged();
}
@Override
public void onCancelled(DatabaseError databaseError) {
Log.i("TAG", "onDataChange: "+databaseError.getMessage());
Toast.makeText(getActivity(), "Network Error", Toast.LENGTH_SHORT).show();
}
});
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
getActivity().setTitle("Stories");
}
public boolean checkInternetConnectivity(){
//Check internet connection//
ConnectivityManager connectivityManager = (ConnectivityManager)getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
// Get details on the currently active default data network//
NetworkInfo netInformation = connectivityManager.getActiveNetworkInfo();
// If there is a network connection, then fetch data//
if(netInformation!=null && netInformation.isConnected()){
return true;
}else{
return false;
}
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_search,menu);
MenuItem menuItem = menu.findItem(R.id.menu_search);
SearchView searchView = (SearchView) menuItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
return super.onOptionsItemSelected(item);
}
}
| 7,204 | 0.698778 | 0.698084 | 183 | 38.366119 | 31.097105 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.644809 | false | false | 13 |
953be161cb1fee17576bac41911e1d06ed4ebd85 | 27,565,100,154,499 | 8b90a2e5821ebfed4eea2876088510a9ec58bd6c | /src/org/field/dao/DB.java | f03671527ffa291fb8daa4b877656a08cc2117e9 | [] | no_license | Arrowfield/zip-kaola | https://github.com/Arrowfield/zip-kaola | f97106e6e1dba654b0f5e88b942ad47567a54f01 | 41ba9104dba2ed20fb429272fea42c4c84bd1bfe | refs/heads/master | 2023-04-13T16:31:28.564000 | 2020-04-19T08:54:32 | 2020-04-19T08:54:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.field.dao;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Connection;
public class DB {
private String className; // 驱动名
private String url; // 连接数据库的URL地址
private String username; // 数据库的用户名
private String password; // 数据库的密码
private Connection con; // 数据库连接对象
private PreparedStatement pstm; // 数据库预编译处理对象
public DB() {
className = "com.mysql.jdbc.Driver";
url = "jdbc:mysql://localhost:3306/d_easybuy";
username = "root";
password = "root";
try {
Class.forName(className);
} catch (ClassNotFoundException e) {
System.out.println("加载数据库驱动程序失败!");
e.printStackTrace();
}
}
public void getCon() {
try {
con = DriverManager.getConnection(url, username, password);
//System.out.println("获取数据库连接成功!");
} catch (SQLException e) {
System.out.println("获取数据库连接失败!");
e.printStackTrace();
}
}
public void doPstm(String sql,Object[] params){
if(sql!=null && !sql.equals("")){
if(con==null)
getCon();
try {
pstm=con.prepareStatement(sql);
if(params==null){
params=new Object[0];
}
for(int i=0;i<params.length;i++){
//System.out.print(params[i]);
pstm.setObject(i+1,params[i]);
}
pstm.executeQuery();
} catch (SQLException e) {
System.out.println("调用DB类中doPstm方法时出错!");
e.printStackTrace();
}finally {
close(null,pstm,con);
}
}
}
public boolean executeUpdate(String sql,Object[] params){
int count;
if(sql != null && sql.length() != 0) {
if(con == null) {
getCon();
}
try {
pstm = con.prepareStatement(sql);
for(int i = 0;i<params.length;i++) {
pstm.setObject(i+1,params[i]);
}
count = pstm.executeUpdate();
if(count > 0) {
return true;
}
}catch(SQLException e) {
e.printStackTrace();
}finally {
close(null,pstm,con);
}
}
return false;
}
public ResultSet getRs(){
try {
return pstm.getResultSet();
} catch (SQLException e) {
System.out.println("DB类中的getRs()方法出错!");
e.printStackTrace();
return null;
}
}
public void close(ResultSet rs,PreparedStatement ps,Connection con) {
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(ps!=null){
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(con!=null){
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
}
}
}
| UTF-8 | Java | 3,203 | java | DB.java | Java | [
{
"context": "06/d_easybuy\";\n\t\tusername = \"root\";\n\t\tpassword = \"root\";\n\t\ttry {\n\t\t\tClass.forName(className);\n\t\t} catch ",
"end": 578,
"score": 0.9995275735855103,
"start": 574,
"tag": "PASSWORD",
"value": "root"
}
] | null | [] | package org.field.dao;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Connection;
public class DB {
private String className; // 驱动名
private String url; // 连接数据库的URL地址
private String username; // 数据库的用户名
private String password; // 数据库的密码
private Connection con; // 数据库连接对象
private PreparedStatement pstm; // 数据库预编译处理对象
public DB() {
className = "com.mysql.jdbc.Driver";
url = "jdbc:mysql://localhost:3306/d_easybuy";
username = "root";
password = "<PASSWORD>";
try {
Class.forName(className);
} catch (ClassNotFoundException e) {
System.out.println("加载数据库驱动程序失败!");
e.printStackTrace();
}
}
public void getCon() {
try {
con = DriverManager.getConnection(url, username, password);
//System.out.println("获取数据库连接成功!");
} catch (SQLException e) {
System.out.println("获取数据库连接失败!");
e.printStackTrace();
}
}
public void doPstm(String sql,Object[] params){
if(sql!=null && !sql.equals("")){
if(con==null)
getCon();
try {
pstm=con.prepareStatement(sql);
if(params==null){
params=new Object[0];
}
for(int i=0;i<params.length;i++){
//System.out.print(params[i]);
pstm.setObject(i+1,params[i]);
}
pstm.executeQuery();
} catch (SQLException e) {
System.out.println("调用DB类中doPstm方法时出错!");
e.printStackTrace();
}finally {
close(null,pstm,con);
}
}
}
public boolean executeUpdate(String sql,Object[] params){
int count;
if(sql != null && sql.length() != 0) {
if(con == null) {
getCon();
}
try {
pstm = con.prepareStatement(sql);
for(int i = 0;i<params.length;i++) {
pstm.setObject(i+1,params[i]);
}
count = pstm.executeUpdate();
if(count > 0) {
return true;
}
}catch(SQLException e) {
e.printStackTrace();
}finally {
close(null,pstm,con);
}
}
return false;
}
public ResultSet getRs(){
try {
return pstm.getResultSet();
} catch (SQLException e) {
System.out.println("DB类中的getRs()方法出错!");
e.printStackTrace();
return null;
}
}
public void close(ResultSet rs,PreparedStatement ps,Connection con) {
if(rs!=null){
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(ps!=null){
try {
ps.close();
} catch (SQLException e) {
e.printStackTrace();
}finally{
if(con!=null){
try {
con.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
}
}
}
}
| 3,209 | 0.52433 | 0.520689 | 152 | 18.875 | 16.191824 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.611842 | false | false | 13 |
c63ccf67a0bae39bcacd23401e87030c9dce6030 | 37,220,186,595,946 | 3b970eae6044f173c4a5664edfb1efe1c77b0357 | /src/main/java/com/faint/service/PostServiceImpl.java | e39ed372942bcc277acd71f1d9c4c6ee2d90633c | [] | no_license | oolongsawel/FAINT | https://github.com/oolongsawel/FAINT | 6eb8910d28c38d9c00b2dbca50dabcf347011bd6 | 9e1f2050d1e0282bab37ea1f55cfd186659f5990 | refs/heads/master | 2020-03-08T09:02:46.144000 | 2018-04-04T06:15:58 | 2018-04-04T06:15:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.faint.service;
import java.util.List;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.faint.domain.PostVO;
import com.faint.domain.SearchCriteria;
import com.faint.domain.TagVO;
import com.faint.domain.UserVO;
import com.faint.dto.FollowinPostDTO;
import com.faint.dto.TopPostDTO;
import com.faint.persistence.PostDAO;
import com.faint.util.HashTagHelper;
@Service
public class PostServiceImpl implements PostService {
@Inject
private PostDAO dao;
//==============post 등록(사진등록+태그등록)==============
// post등록 (registPostAndTag method 사용)
@Transactional
@Override
public void regist(PostVO post) throws Exception {
dao.create(post);
// 첨부파일 목록 불러들임
String[] files = post.getFiles();
// 파일 목록 없으면 아무것도 안함
if (files != null) {
for (String url : files) {
dao.addAttach(url);
}
}
List<String> hashTags = HashTagHelper.getAllHashTags(post.getCaption());
if (!hashTags.isEmpty()) { // exist hash tag
for (String tagname : hashTags) {
registPostAndTag(post.getId(), tagname);
}
}
}
//post등록 util 메서드 = insertPostedTag/insertTag메서드 사용
public void registPostAndTag(Integer postid, String tagname) throws Exception {
TagVO vo = selectTagByName(tagname);
if (vo == null) {
// tbl_tag에 존재하지 않는 tag
// tbl_tag에 일단 tag를 넣는다
TagVO vo2 = new TagVO();
vo2.setName(tagname);
vo2.setTagcount(0);
insertTag(vo2);
insertPostedTag(postid, vo2.getId());
} else {
insertPostedTag(postid, vo.getId());
}
}
//post 등록 메서드 사용시 자동 사용
@Override
public void insertPostedTag(int postid, int tagid) throws Exception {
dao.insertPostedTag(postid, tagid);
}
//post 등록 메서드 사용시 자동 사용 (tag등록)
@Override
public void insertTag(TagVO vo) throws Exception {
dao.insertTag(vo);
}
//==============post 읽기==============
// 특정 유저 게시물목록
@Override
public List<PostVO> read(Integer userid) throws Exception{
return dao.read(userid);
}
// 특정 유저 저장 게시물목록
@Override
public List<PostVO> storeRead(Integer userid) throws Exception{
return dao.storeRead(userid);
}
// 특정게시물 세부내용(매개변수:postid, loginid)
@Override
public FollowinPostDTO detailRead(PostVO vo) throws Exception{
return dao.detailRead(vo);
}
// 메인피드 게시물 리스트(매개변수:postid, loginid)
@Override
public List<FollowinPostDTO> mainRead(Integer id) throws Exception{
return dao.mainRead(id);
}
// post전체목록
@Override
public List<PostVO> listAllPost() throws Exception {
return dao.listAllPost();
}
// post tag로 찾기( tag로 찾고나면 count +1 증가)
@Override
public List<PostVO> listPostKeyword(SearchCriteria cri) throws Exception {
return dao.listPostKeyword(cri);
}
// 인기 게시글
@Override
public List<PostVO> topPost(TopPostDTO dto) throws Exception {
return dao.topPost(dto);
}
//==============tag==============
// tag name검색
@Override
public TagVO selectTagByName(String name) throws Exception {
return dao.selectTagByName(name);
}
//==============tag검색 무한스크롤==============
@Override
public List<PostVO> tagsAjax(SearchCriteria cri) throws Exception {
return dao.tagsAjax(cri);
}
@Override
public List<PostVO> infiniteScrollTags(SearchCriteria cri, Integer row) throws Exception {
return dao.infiniteScrollTags(cri, row);
}
// 무한스크롤 위치검색
@Override
public List<PostVO> locationsAjax(SearchCriteria cri) throws Exception {
return dao.locationsAjax(cri);
}
@Override
public List<PostVO> infiniteScrollLocations(SearchCriteria cri, Integer row) throws Exception {
return dao.infiniteScrollLocations(cri, row);
}
//==============like==============
@Override
public void postLike(PostVO vo) throws Exception{
dao.postLike(vo);
}
@Override
public void postUnlike(PostVO vo) throws Exception{
dao.postUnlike(vo);
}
@Override
public List<UserVO> postLiker(PostVO vo) throws Exception{
return dao.postLiker(vo);
}
//==============store==============
@Override
public void postStore(PostVO vo) throws Exception{
dao.postStore(vo);
}
@Override
public void postTakeaway(PostVO vo) throws Exception{
dao.postTakeaway(vo);
}
}
| UTF-8 | Java | 4,503 | java | PostServiceImpl.java | Java | [] | null | [] | package com.faint.service;
import java.util.List;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.faint.domain.PostVO;
import com.faint.domain.SearchCriteria;
import com.faint.domain.TagVO;
import com.faint.domain.UserVO;
import com.faint.dto.FollowinPostDTO;
import com.faint.dto.TopPostDTO;
import com.faint.persistence.PostDAO;
import com.faint.util.HashTagHelper;
@Service
public class PostServiceImpl implements PostService {
@Inject
private PostDAO dao;
//==============post 등록(사진등록+태그등록)==============
// post등록 (registPostAndTag method 사용)
@Transactional
@Override
public void regist(PostVO post) throws Exception {
dao.create(post);
// 첨부파일 목록 불러들임
String[] files = post.getFiles();
// 파일 목록 없으면 아무것도 안함
if (files != null) {
for (String url : files) {
dao.addAttach(url);
}
}
List<String> hashTags = HashTagHelper.getAllHashTags(post.getCaption());
if (!hashTags.isEmpty()) { // exist hash tag
for (String tagname : hashTags) {
registPostAndTag(post.getId(), tagname);
}
}
}
//post등록 util 메서드 = insertPostedTag/insertTag메서드 사용
public void registPostAndTag(Integer postid, String tagname) throws Exception {
TagVO vo = selectTagByName(tagname);
if (vo == null) {
// tbl_tag에 존재하지 않는 tag
// tbl_tag에 일단 tag를 넣는다
TagVO vo2 = new TagVO();
vo2.setName(tagname);
vo2.setTagcount(0);
insertTag(vo2);
insertPostedTag(postid, vo2.getId());
} else {
insertPostedTag(postid, vo.getId());
}
}
//post 등록 메서드 사용시 자동 사용
@Override
public void insertPostedTag(int postid, int tagid) throws Exception {
dao.insertPostedTag(postid, tagid);
}
//post 등록 메서드 사용시 자동 사용 (tag등록)
@Override
public void insertTag(TagVO vo) throws Exception {
dao.insertTag(vo);
}
//==============post 읽기==============
// 특정 유저 게시물목록
@Override
public List<PostVO> read(Integer userid) throws Exception{
return dao.read(userid);
}
// 특정 유저 저장 게시물목록
@Override
public List<PostVO> storeRead(Integer userid) throws Exception{
return dao.storeRead(userid);
}
// 특정게시물 세부내용(매개변수:postid, loginid)
@Override
public FollowinPostDTO detailRead(PostVO vo) throws Exception{
return dao.detailRead(vo);
}
// 메인피드 게시물 리스트(매개변수:postid, loginid)
@Override
public List<FollowinPostDTO> mainRead(Integer id) throws Exception{
return dao.mainRead(id);
}
// post전체목록
@Override
public List<PostVO> listAllPost() throws Exception {
return dao.listAllPost();
}
// post tag로 찾기( tag로 찾고나면 count +1 증가)
@Override
public List<PostVO> listPostKeyword(SearchCriteria cri) throws Exception {
return dao.listPostKeyword(cri);
}
// 인기 게시글
@Override
public List<PostVO> topPost(TopPostDTO dto) throws Exception {
return dao.topPost(dto);
}
//==============tag==============
// tag name검색
@Override
public TagVO selectTagByName(String name) throws Exception {
return dao.selectTagByName(name);
}
//==============tag검색 무한스크롤==============
@Override
public List<PostVO> tagsAjax(SearchCriteria cri) throws Exception {
return dao.tagsAjax(cri);
}
@Override
public List<PostVO> infiniteScrollTags(SearchCriteria cri, Integer row) throws Exception {
return dao.infiniteScrollTags(cri, row);
}
// 무한스크롤 위치검색
@Override
public List<PostVO> locationsAjax(SearchCriteria cri) throws Exception {
return dao.locationsAjax(cri);
}
@Override
public List<PostVO> infiniteScrollLocations(SearchCriteria cri, Integer row) throws Exception {
return dao.infiniteScrollLocations(cri, row);
}
//==============like==============
@Override
public void postLike(PostVO vo) throws Exception{
dao.postLike(vo);
}
@Override
public void postUnlike(PostVO vo) throws Exception{
dao.postUnlike(vo);
}
@Override
public List<UserVO> postLiker(PostVO vo) throws Exception{
return dao.postLiker(vo);
}
//==============store==============
@Override
public void postStore(PostVO vo) throws Exception{
dao.postStore(vo);
}
@Override
public void postTakeaway(PostVO vo) throws Exception{
dao.postTakeaway(vo);
}
}
| 4,503 | 0.696416 | 0.694732 | 181 | 21.96685 | 21.971579 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.480663 | false | false | 13 |
b016ea78aa4da2d6e7c746f14c97952dc59716b2 | 11,252,814,371,442 | 953cc96a9990d172fb1dfbc5852c9a993bc9e95a | /src/main/java/net/lcyframework/kernel/model/response/SingleResponse.java | 6a59eb0a62044779f67e0fd9ba81f0fa3d98da9f | [] | no_license | jimmylee216/lcyframework | https://github.com/jimmylee216/lcyframework | 62cd970d566112ee037f32be82e2ea07d484fb13 | e45c71fbc79988d46a1f7cf039bc07e91de7c8a0 | refs/heads/master | 2022-12-22T16:42:26.897000 | 2019-05-28T06:10:39 | 2019-05-28T06:10:39 | 188,520,932 | 0 | 0 | null | false | 2022-12-10T06:22:40 | 2019-05-25T04:35:10 | 2019-05-28T06:10:48 | 2022-12-10T06:22:40 | 105 | 0 | 0 | 5 | Java | false | false | /*
* Copyright © 2015-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.lcyframework.kernel.model.response;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <pre>
* 名称: SingleResponse
* 描述: 单个响应实体
* </pre>
* @author Jimmy Li
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SingleResponse<RKEY extends Serializable> extends EmptyResponse {
private static final long serialVersionUID = 632714166702790372L;
/**
* 单一属性数据类型
*/
private RKEY value;
/**
* 简化构造函数
* @param value 数据类型
*/
public SingleResponse(final RKEY value) {
this.value = value;
}
/**
* 默认构造方法
*/
public SingleResponse() {
}
}
| UTF-8 | Java | 1,380 | java | SingleResponse.java | Java | [
{
"context": " SingleResponse\n * 描述: 单个响应实体\n * </pre>\n * @author Jimmy Li\n * @since 1.0.0\n */\n@Data\n@EqualsAndHashCode(call",
"end": 834,
"score": 0.9997208714485168,
"start": 826,
"tag": "NAME",
"value": "Jimmy Li"
}
] | null | [] | /*
* Copyright © 2015-2026 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.lcyframework.kernel.model.response;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <pre>
* 名称: SingleResponse
* 描述: 单个响应实体
* </pre>
* @author <NAME>
* @since 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
public class SingleResponse<RKEY extends Serializable> extends EmptyResponse {
private static final long serialVersionUID = 632714166702790372L;
/**
* 单一属性数据类型
*/
private RKEY value;
/**
* 简化构造函数
* @param value 数据类型
*/
public SingleResponse(final RKEY value) {
this.value = value;
}
/**
* 默认构造方法
*/
public SingleResponse() {
}
}
| 1,378 | 0.684973 | 0.659802 | 56 | 22.410715 | 24.189562 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.214286 | false | false | 13 |
cd880f337d6c017b51fdb452750d4c2a80519d55 | 35,553,739,304,165 | 59edc173dad0cb85a7c7a41528e34a00125e8365 | /src/main/java/com/sokil/service/impl/UserServiceImpl.java | 971d60315fff244558c02f44d40af62496f88fd1 | [
"MIT"
] | permissive | ViktorSokil/jwt-spring-security-demo | https://github.com/ViktorSokil/jwt-spring-security-demo | c9ea47b43871e5bf76b47bc23d8c1914e2772e6b | 49517b65130f2fcbde854476f3de7bdcaf792686 | refs/heads/master | 2021-05-03T07:26:41.767000 | 2018-02-07T11:57:15 | 2018-02-07T11:57:15 | 120,609,226 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.sokil.service.impl;
import com.sokil.entity.UserEntity;
import com.sokil.repository.UserRepository;
import com.sokil.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("userService")
public class UserServiceImpl implements IUserService {
@Autowired
private UserRepository userDAO;
@Override
public void saveUser(UserEntity user) {
userDAO.save(user);
}
@Override
public List<UserEntity> getAllUsers() {
return userDAO.findAll();
}
@Override
public UserEntity findByUserName(String userName) {
return userDAO.findByUserName(userName);
}
}
| UTF-8 | Java | 738 | java | UserServiceImpl.java | Java | [] | null | [] | package com.sokil.service.impl;
import com.sokil.entity.UserEntity;
import com.sokil.repository.UserRepository;
import com.sokil.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("userService")
public class UserServiceImpl implements IUserService {
@Autowired
private UserRepository userDAO;
@Override
public void saveUser(UserEntity user) {
userDAO.save(user);
}
@Override
public List<UserEntity> getAllUsers() {
return userDAO.findAll();
}
@Override
public UserEntity findByUserName(String userName) {
return userDAO.findByUserName(userName);
}
}
| 738 | 0.738482 | 0.738482 | 31 | 22.806452 | 19.750736 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.354839 | false | false | 13 |
e8bcc9be61bd5d16323f363cb8a3df6462219d24 | 20,349,555,095,692 | c78f7233018069c7c0f1e4ec35894a49d6112eb5 | /app/src/main/java/aboutdevice/com/munir/symphony/mysymphony/data/model/CCAddress.java | c7585ba8dbe5384c79d934fb186bcb57a5069597 | [] | no_license | sobuj134/AboutDevice | https://github.com/sobuj134/AboutDevice | 07c781118b4c23ae4e96ef1db0e8986c32807d7d | c3a21cc5d12810b816f872e26379c680d5a5c19f | refs/heads/master | 2020-05-24T21:17:13.951000 | 2019-05-19T12:06:38 | 2019-05-19T12:06:38 | 187,471,167 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package aboutdevice.com.munir.symphony.mysymphony.data.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import io.realm.RealmObject;
public class CCAddress extends RealmObject {
@SerializedName("name")
@Expose
private String name;
@SerializedName("district")
@Expose
private String district;
@SerializedName("latitude")
@Expose
private String latitude;
@SerializedName("longitude")
@Expose
private String longitude;
@SerializedName("address")
@Expose
private String address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "CCAddress{" +
"name='" + name + '\'' +
", district='" + district + '\'' +
", latitude='" + latitude + '\'' +
", longitude='" + longitude + '\'' +
", address='" + address + '\'' +
'}';
}
}
| UTF-8 | Java | 1,691 | java | CCAddress.java | Java | [] | null | [] | package aboutdevice.com.munir.symphony.mysymphony.data.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import io.realm.RealmObject;
public class CCAddress extends RealmObject {
@SerializedName("name")
@Expose
private String name;
@SerializedName("district")
@Expose
private String district;
@SerializedName("latitude")
@Expose
private String latitude;
@SerializedName("longitude")
@Expose
private String longitude;
@SerializedName("address")
@Expose
private String address;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Override
public String toString() {
return "CCAddress{" +
"name='" + name + '\'' +
", district='" + district + '\'' +
", latitude='" + latitude + '\'' +
", longitude='" + longitude + '\'' +
", address='" + address + '\'' +
'}';
}
}
| 1,691 | 0.581313 | 0.581313 | 80 | 20.137501 | 17.378683 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false | 13 |
cfaf077ed04ab32b6079d01e19c336473688886f | 36,885,179,155,826 | 6e0f219478a135e6278b76dee6d0e4c9cc295454 | /src/main/java/com/prismML/mapreduce/algorithms/etc/ETL_TransformMapper.java | 6f85feebccc9a359be440d6c2732aeefd302682c | [] | no_license | whitepoo/prism_ml | https://github.com/whitepoo/prism_ml | 89e1c2962bfb455e59f6ddc144e1a6d6c3e398b5 | 66ead5e4e3c1338d7737cebc974e9ac164971525 | refs/heads/master | 2017-05-11T22:01:35.718000 | 2017-02-25T03:11:35 | 2017-02-25T03:11:35 | 82,884,867 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | /*
* Copyright (C) 2011 ankus (http://www.openankus.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.prismML.mapreduce.algorithms.etc;
import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Mapper.Context;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.prismML.util.ArgumentsConstants;
public class ETL_TransformMapper extends Mapper<LongWritable, Text, LongWritable, Text>//, OutputCollector<Text, IntWritable> , Reporter>
{
private Logger logger = LoggerFactory.getLogger(ETL_TransformMapper.class);
private String mDelimiter;
private final static IntWritable one = new IntWritable(1);
private Text word = new Text("Total Lines");
protected void setup(Context context) throws IOException, InterruptedException
{
mDelimiter = context.getConfiguration().get(ArgumentsConstants.DELIMITER, "\t");
}
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException
{
String[] columns = value.toString().split(mDelimiter);
long linenum = Long.parseLong(columns[0]);
for(int ci = 1; ci < columns.length; ci++)
{
LongWritable outkey = new LongWritable(ci-1);
System.out.println("Map(" +outkey + "[" + new Text(linenum + "," + columns[ci])+"])");
context.write(outkey, new Text(linenum + "," + columns[ci]));
}
}
}
| UTF-8 | Java | 2,311 | java | ETL_TransformMapper.java | Java | [
{
"context": "/*\n * Copyright (C) 2011 ankus (http://www.openankus.org).\n *\n * This program is",
"end": 30,
"score": 0.9993194937705994,
"start": 25,
"tag": "USERNAME",
"value": "ankus"
}
] | null | [] | /*
* Copyright (C) 2011 ankus (http://www.openankus.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.prismML.mapreduce.algorithms.etc;
import java.io.IOException;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Mapper.Context;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.prismML.util.ArgumentsConstants;
public class ETL_TransformMapper extends Mapper<LongWritable, Text, LongWritable, Text>//, OutputCollector<Text, IntWritable> , Reporter>
{
private Logger logger = LoggerFactory.getLogger(ETL_TransformMapper.class);
private String mDelimiter;
private final static IntWritable one = new IntWritable(1);
private Text word = new Text("Total Lines");
protected void setup(Context context) throws IOException, InterruptedException
{
mDelimiter = context.getConfiguration().get(ArgumentsConstants.DELIMITER, "\t");
}
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException
{
String[] columns = value.toString().split(mDelimiter);
long linenum = Long.parseLong(columns[0]);
for(int ci = 1; ci < columns.length; ci++)
{
LongWritable outkey = new LongWritable(ci-1);
System.out.println("Map(" +outkey + "[" + new Text(linenum + "," + columns[ci])+"])");
context.write(outkey, new Text(linenum + "," + columns[ci]));
}
}
}
| 2,311 | 0.745565 | 0.740805 | 63 | 35.682541 | 32.169109 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false | 13 |
8b5651aae83b2ac61d1413daef80ae6c479735bc | 14,912,126,512,830 | 63910c6fd0cdaa704f164e87bb26c3d84b3a5a55 | /src/main/java/com/siliconmtn/data/report/NoStyleCellStyle.java | 9a8c9187229d728be449aedbaf3f34555ed9747a | [] | no_license | tjohnson-smt/spacelibs-java | https://github.com/tjohnson-smt/spacelibs-java | 2878a718f36c8eb95d760d3a3d7125a7cab24c44 | 7302bd97681e07ddde24df494d956d201ecf5013 | refs/heads/main | 2023-06-07T08:27:09.708000 | 2021-03-31T22:32:02 | 2021-03-31T22:32:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.siliconmtn.data.report;
// JDK 11.x
import java.util.HashMap;
import java.util.Map;
/****************************************************************************
* <b>Title</b>: NoStyleCellStyle.java
* <b>Project</b>: SpaceLibs-Java
* <b>Description: </b> produces an empty map, this allows the factory to produce
* an empty style.
*
* <b>Copyright:</b> Copyright (c) 2016
* <b>Company:</b> Silicon Mountain Technologies
* @author James Camire
* @version 1.0
* @since Feb 14, 2021
* @updates:
****************************************************************************/
public class NoStyleCellStyle extends AbstractExcelCellStyle {
public NoStyleCellStyle(){
super();
this.expandColumnFlg = false;
buildStyleMap();
}
/* (non-Javadoc)
* @see com.siliconmtn.data.report.AbstractExcelCellStyle#buildStyleMap()
*/
@Override
public void buildStyleMap() {
//empty map sent intentionally
Map<String, Map<String, Object>> styleMap = new HashMap<>();
setStyleMap(styleMap);
}
/*
* (non-javadoc)
* @see com.smt.data.report.ExcelStyleInterface#setDisplayDate()
*/
@Override
public void setDisplayDate(boolean displayDate) {
this.displayDate = displayDate;
}
}
| UTF-8 | Java | 1,221 | java | NoStyleCellStyle.java | Java | [
{
"context": "pany:</b> Silicon Mountain Technologies\n * @author James Camire\n * @version 1.0\n * @since Feb 14, 2021\n * @update",
"end": 470,
"score": 0.9996027946472168,
"start": 458,
"tag": "NAME",
"value": "James Camire"
}
] | null | [] | package com.siliconmtn.data.report;
// JDK 11.x
import java.util.HashMap;
import java.util.Map;
/****************************************************************************
* <b>Title</b>: NoStyleCellStyle.java
* <b>Project</b>: SpaceLibs-Java
* <b>Description: </b> produces an empty map, this allows the factory to produce
* an empty style.
*
* <b>Copyright:</b> Copyright (c) 2016
* <b>Company:</b> Silicon Mountain Technologies
* @author <NAME>
* @version 1.0
* @since Feb 14, 2021
* @updates:
****************************************************************************/
public class NoStyleCellStyle extends AbstractExcelCellStyle {
public NoStyleCellStyle(){
super();
this.expandColumnFlg = false;
buildStyleMap();
}
/* (non-Javadoc)
* @see com.siliconmtn.data.report.AbstractExcelCellStyle#buildStyleMap()
*/
@Override
public void buildStyleMap() {
//empty map sent intentionally
Map<String, Map<String, Object>> styleMap = new HashMap<>();
setStyleMap(styleMap);
}
/*
* (non-javadoc)
* @see com.smt.data.report.ExcelStyleInterface#setDisplayDate()
*/
@Override
public void setDisplayDate(boolean displayDate) {
this.displayDate = displayDate;
}
}
| 1,215 | 0.613432 | 0.601966 | 47 | 24.978724 | 23.690819 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.914894 | false | false | 13 |
44939adeaf10ebf4db9a954ce8f48bfb0e87dd93 | 9,113,920,648,976 | 9cd84531b7c148f13a87030de7cd9b3c95b15473 | /tools-abf-service/src/main/java/org/tis/tools/abf/module/sys/service/ISysErrCodeService.java | cad509d00264f6430aa9ed2d3980dc961cac6e40 | [] | no_license | shiyunlai/TTT | https://github.com/shiyunlai/TTT | 4ca83aef2649c2e8361c5a97eb25f641a0c30f48 | 6978949983570d14ee456fa5ad80dbcc0409e76a | refs/heads/master | 2021-04-26T23:54:39.340000 | 2018-08-14T03:39:17 | 2018-08-14T03:39:17 | 123,878,256 | 1 | 14 | null | false | 2018-08-14T03:39:18 | 2018-03-05T07:00:23 | 2018-08-13T13:36:28 | 2018-08-14T03:39:18 | 39,852 | 0 | 8 | 0 | Java | false | null | package org.tis.tools.abf.module.sys.service;
import org.tis.tools.abf.module.sys.controller.request.SysErrCodeRequest;
import org.tis.tools.abf.module.sys.entity.SysErrCode;
import com.baomidou.mybatisplus.service.IService;
import org.tis.tools.abf.module.sys.exception.SysManagementException;
/**
* sysErrCode的Service接口类
*
* @author Auto Generate Tools
* @date 2018/04/23
*/
public interface ISysErrCodeService extends IService<SysErrCode> {
/**
* 新增系统错误码
* @param sysErrCodeRequest
* @throws SysManagementException
*/
void add(SysErrCodeRequest sysErrCodeRequest) throws SysManagementException;
/**
* 修改系统错误码
* @param sysErrCodeRequest
* @throws SysManagementException
*/
SysErrCode change(SysErrCodeRequest sysErrCodeRequest) throws SysManagementException;
}
| UTF-8 | Java | 868 | java | ISysErrCodeService.java | Java | [
{
"context": "\n\n/**\n * sysErrCode的Service接口类\n * \n * @author Auto Generate Tools\n * @date 2018/04/23\n */\npublic interface ISysErrC",
"end": 360,
"score": 0.6297607421875,
"start": 346,
"tag": "USERNAME",
"value": "Generate Tools"
}
] | null | [] | package org.tis.tools.abf.module.sys.service;
import org.tis.tools.abf.module.sys.controller.request.SysErrCodeRequest;
import org.tis.tools.abf.module.sys.entity.SysErrCode;
import com.baomidou.mybatisplus.service.IService;
import org.tis.tools.abf.module.sys.exception.SysManagementException;
/**
* sysErrCode的Service接口类
*
* @author Auto Generate Tools
* @date 2018/04/23
*/
public interface ISysErrCodeService extends IService<SysErrCode> {
/**
* 新增系统错误码
* @param sysErrCodeRequest
* @throws SysManagementException
*/
void add(SysErrCodeRequest sysErrCodeRequest) throws SysManagementException;
/**
* 修改系统错误码
* @param sysErrCodeRequest
* @throws SysManagementException
*/
SysErrCode change(SysErrCodeRequest sysErrCodeRequest) throws SysManagementException;
}
| 868 | 0.748798 | 0.739183 | 30 | 26.700001 | 27.060612 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.233333 | false | false | 13 |
fe534c4bb87a77226360c2c3581ee1018605d794 | 28,432,683,538,400 | fc2879c5f6a6c1d110b4a9721a2412e4df270384 | /MyVisio/src/de/bkroeger/myvisio/model/Workbook.java | 4bb281c902458e753bf7607c09e34a4f8de6f69f | [] | no_license | bkrgr1/MyVisio | https://github.com/bkrgr1/MyVisio | 506a7387cf18d1cb7ceee0538af6d98307250e54 | 636c25754977167123f17decdabecd9f1ec24997 | refs/heads/master | 2021-01-15T12:31:53.196000 | 2016-09-26T18:11:34 | 2016-09-26T18:11:34 | 68,399,462 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package de.bkroeger.myvisio.model;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import de.bkroeger.myvisio.shapes.IShape;
import de.bkroeger.myvisio.utility.TechnicalException;
/**
* <p>
* Die WorkBook-Klasse repräsentiert ein MyVisio-Dokument bestehend aus
* mehreren Seiten ({@link Worksheet}) auf denen jeweils diverse Shapes ({@link IShape})
* angeordnet sind.
* </p><p>
* Ein WorkBook wird durch seinen voll qualifizierten Dateinamen bezeichnet
* und durch eine UUID identifiziert.
* </p><p>
* Ein Workbook besteht aus ein oder mehreren {@link Worksheet Worksheets}.
* Ein Workbook enthält ein oder mehrere {@link ShapeSet ShapeSets}.
* </p><p>
* Gespeichert werden WorkBooks als XML-Dateien.
* </p><p>
* Es gibt zwei Arten von Workbooks:</p>
* <ol>
* <li>Standard-Workbooks, die eine Zeichnung eines Benutzers speichern.
* Dabei werden die benutzten Shapes nur als Referenzen (UUID) gespeichert.
* </ol>
* <li>Example-Workbooks, die neben einer Zeichnung auch eine Liste der erforderlichen
* ShapeSets enthalten. Die ShapeSets selber sind dabei auch nur referenziert.</ol>
* </ol>
* @invariant
* <ul>
* <li>uuid ist unveränderlich</li>
* </ul>
* @pre
* @post
* <ul>
* <li>Dirty-Flag ist gesetzt, wenn ein Attribut des Workbooks oder eines Worksheets geändert wurde.</li>
* </ul>
* @author bk
*/
public class Workbook {
private static final String SETS_TAG = "shapesets";
private static final String TITLE_TAG = "title";
private static final String PAGE_TAG = "page";
private static final String DESC_TAG = "desc";
private static final String SHAPE_SETS_TAG = "shape-sets";
private static final String PAGES_TAG = "pages";
private static final String DOCUMENT_TAG = "myvisio";
private static Logger logger = Logger.getLogger(Workbook.class.getName());
/**
* Die interne UUID des Workbook
*/
private UUID uuid;
/**
* @return - die UUID des Dokuments
*/
public UUID getUUID() {
return uuid;
}
/**
* Der Dateipfad (Dateiname plus Pfad).
*/
private String filepath = "";
/**
* @return - der Dateipfad
*/
public String getFileName() { return filepath; }
/**
* @param fileName
* @throws TechnicalException
*/
public void setFileName(String fileName) throws TechnicalException {
if (fileName == null || fileName.isEmpty()) {
throw new TechnicalException("File name missing or empty!");
}
this.filepath = fileName;
// wichtig: Setter verwenden, weil dieser wichtige Funktionen enthält
this.setTitle(new File(fileName).getName());
}
/**
* Der Titel des Dokuments (Dateiname ohne Pfad).
*/
private String title = "";
/**
* @return - der Titel
*/
public String getTitle() { return title; }
/**
* @param value
* @throws TechnicalException
*/
public void setTitle(String value) throws TechnicalException {
if (value == null || value.isEmpty()) {
throw new TechnicalException("Title missing or empty!");
}
title = value;
// alle Seiten informieren
for (Worksheet sheet : worksheets) {
sheet.refreshTitle();
}
}
private boolean dirtyFlag = false;
/**
* Liefert das Dirty-Flag. Wenn eine der Seiten "schmutzig" ist,
* gilt die ganze Datei als schmutzig.
*
* @return - true, wenn wenigstens eine Seite verändert wurde
*/
public boolean isDirty() {
boolean sheetDirty = false;
for (Worksheet sheet : worksheets) {
if (sheet.isDirty()) {
sheetDirty = true;
break;
}
}
return (dirtyFlag || sheetDirty);
}
/**
* Liste der WorkSheets
*/
private List<Worksheet> worksheets = new ArrayList<Worksheet>();
/**
* @return - die Anzahl WorkSheets
*/
public int getWorksheetSize() { return worksheets.size(); }
/**
* @return - WorkSheet-Iterator
*/
public Iterator<Worksheet> getWorksheetIterator() {
return worksheets.iterator();
}
/**
* @return - das aktuelle WorkSheet
*/
public Worksheet getCurrentWorksheet() {
if (currentPageUUID == null) return null;
for (Worksheet sheet : worksheets) {
if (sheet.getUUID() == currentPageUUID) return sheet;
}
return null;
}
/**
* die aktuelle Seite
*/
private UUID currentPageUUID = null;
/**
* @return - die UUID der aktuellen Seite
*/
public UUID getCurrentPageUUID() { return currentPageUUID; }
/**
* Map der ShapeSets
*/
private Map<String, ShapeSet> shapeSets = new HashMap<String, ShapeSet>();
/**
* @return - Liste der ShapeSets
*/
public Collection<ShapeSet> getShapeSets() {
return this.shapeSets.values();
}
/**
* @return - Anzahl der ShapeSets
*/
public int getShapeSetSize() { return shapeSets.size(); }
/**
* Beschreibung
*/
private String description = "";
/**
* @return - Beschreibung
*/
public String getDescription() { return description; }
/**
* <p>
* Konstruktor für leeres/neues Worksheet.
* </p><p>
* Für ein neues Dokument wird ein Titel vergeben,
* das Page-Set initialisiert
* und eine erste leere Seite erzeugt. Dies ist die aktuelle/Default-Seite.
* Der Filename bleibt leer.
* </p>
* @throws TechnicalException
*/
public Workbook() throws TechnicalException {
this.setTitle("New Document");
this.dirtyFlag = false;
this.uuid = UUID.randomUUID();
worksheets.add(Worksheet.createDefaultWorksheet(this));
}
/**
* <p>
* Konstruktor mit Dateipfad. Der Pfad-String muss eine Datei mit
* Extension ".mvd" (myVisioDocument) oder ".xml" definieren.
* Die Datei muss existieren!
* </p><p>
* Als Titel wird der Name der Datei (ohne Pfad) verwendet.
* Das Page-Set wird initialisiert
* und die Struktur des Dokumentes aus der XML-Datei eingelesen.
* </p>
* @param fileName - Pfad zur Document-XML-Datei
* @throws TechnicalException - wenn
* <ul>
* <li>der fileName null oder leer ist</li>
* <li>der fileName nicht die richtige Extension hat</li>
* <li>die angegebene Datei nicht existiert</li>
* </ul>
*/
public Workbook(String fileName) throws TechnicalException {
if (fileName == null || fileName.isEmpty()) {
throw new TechnicalException("Filename empty");
}
if (fileName.endsWith(".xml") == false && fileName.endsWith(".mvd") == false) {
throw new TechnicalException("Invalid file type! Path="+fileName);
}
File file = new File(fileName);
if (!file.exists()) {
throw new TechnicalException("File '"+fileName+"' does not exist!");
}
// File-Name speichern
this.filepath = fileName;
// Title setzen
this.setTitle(file.getName());
// Workbook ist unverändert
this.dirtyFlag = false;
// Workbook laden
this.load(file);
// wenn kein Worksheet geladen wurde, Default-Worksheet hinzufügen
if (this.getWorksheetSize() == 0) {
this.addWorksheet(Worksheet.createDefaultWorksheet(this));
}
}
/**
* <p>
* Speichert die Document-Hierarchie in einer XML-Datei.
* </p>
* @throws TechnicalException
*/
public void store() throws TechnicalException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
// ein XML-Dokument erstellen
org.w3c.dom.Document doc = db.newDocument();
// und mit den Daten der Visio-Struktur füllen
convertToXml(doc);
// einen Transformer erstellen
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
// und Optionen setzen
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
// die XML-Struktur in die Datei schreiben
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File(this.filepath));
transformer.transform(source, result);
logger.info("File '"+this.filepath+"' stored.");
// das Dirty-Flag in allen Seiten löschen
for (Worksheet sheet : worksheets) {
sheet.clearDirty();
}
this.dirtyFlag = false;
} catch (ParserConfigurationException e) {
e.printStackTrace();
logger.severe("ParserConfiguration: "+e.getMessage());
throw new TechnicalException("ParserConfiguration: "+e.getMessage(), e);
} catch (TransformerConfigurationException e) {
e.printStackTrace();
logger.severe("TransformerConfiguration: "+e.getMessage());
throw new TechnicalException("TransformerConfiguration: "+e.getMessage(), e);
} catch (TransformerException e) {
e.printStackTrace();
logger.severe("Transformer: "+e.getMessage());
throw new TechnicalException("Transformer: "+e.getMessage(), e);
}
}
/**
* <p>
* Lädt die Document-Struktur aus der angegebenen XML-Datei.
* </p>
* @param file - XML-File
* @throws TechnicalException
*/
public void load(File file) throws TechnicalException {
logger.info("Loading WorkBook '"+file.getAbsolutePath()+"'.");
InputStream inStream = null;
try {
inStream = new FileInputStream(file);
load(inStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new TechnicalException(e.getMessage(), e);
} finally {
if (inStream != null) {
try {
inStream.close();
inStream = null;
} catch (IOException e) {
e.printStackTrace();
logger.severe(e.getMessage());
}
}
}
}
/**
* Lädt die Document-Struktur aus dem Input-Stream.
*
* @param in
* @throws TechnicalException
*/
public void load(InputStream in) throws TechnicalException {
boolean dtdValidate = false;
boolean xsdValidate = false;
try {
// XML-Datei in DOM-Struktur parsen
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(dtdValidate || xsdValidate);
DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc = db.parse(in);
// DOM-Struktur in Visio-Hierarchie umwandeln
this.parseXml(doc);
} catch(ParserConfigurationException e) {
e.printStackTrace();
logger.severe("Error parsing XML-Document from Stream: "+e.getMessage());
throw new TechnicalException("Error parsing XML-Document from Stream", e);
} catch (SAXException e) {
e.printStackTrace();
logger.severe("Error processing XML-Document from Stream: "+e.getMessage());
throw new TechnicalException("Error processing XML-Document from Stream", e);
} catch (IOException e) {
e.printStackTrace();
logger.severe("Error reading XML-Document from Stream: "+e.getMessage());
throw new TechnicalException("Error reading XML-Document from Stream", e);
}
}
/**
* <p>
* Konvertiert eine DOM-Struktur in die Visio-Document-Hierarchie
* </p>
* @param w3cDoc
* @throws TechnicalException
*/
private void parseXml(org.w3c.dom.Document w3cDoc) throws TechnicalException {
Element docElem = w3cDoc.getDocumentElement();
if (docElem.getLocalName().equals(DOCUMENT_TAG)) {
// TODO: alle Attribute analysieren
// alle untergeordneten Elemente analysieren
NodeList children = docElem.getChildNodes();
for (int i=0; i<children.getLength(); i++) {
Node child = children.item(i);
// Element-Nodes analysieren
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element)child;
switch (elem.getLocalName()) {
case PAGES_TAG:
parsePagesTag(elem);
break;
case SHAPE_SETS_TAG:
parseShapeSets(elem);
break;
case DESC_TAG:
parseDescription(elem);
break;
default:
throw new TechnicalException("Unexpected node: "+elem.getLocalName());
}
// Text-Nodes analysieren
} else if (child.getNodeType() == Node.TEXT_NODE) {
switch (child.getNodeName()) {
case TITLE_TAG:
parseTitle(child);
break;
case "#text":
break;
default:
throw new TechnicalException("Unexpected node: "+child.getNodeName());
}
} else {
throw new TechnicalException("Unexpected node type.");
}
}
} else {
logger.warning("Invalid XML-Structur: Root element not found.");
throw new TechnicalException("Invalid XML-Structur: Root element not found.");
}
}
/**
* Ein ShapeSet analysieren.
*
* @param set
* @throws TechnicalException
*/
private void parseShapeSets(Element set) throws TechnicalException {
// TODO: ShapeSets analysieren
}
/**
* Desc-Tag analysieren
*
* @param elem
*/
private void parseDescription(Element elem) {
this.description = elem.getTextContent();
}
/**
* Title-Tag analysieren
*
* @param desc
*/
private void parseTitle(Node desc) {
// TODO: Title/Description analysieren
}
/**
* Page-Tag analysieren
*
* @param pages
* @throws TechnicalException
*/
private void parsePagesTag(Element pages) throws TechnicalException {
NodeList children = pages.getChildNodes();
for (int i=0; i<children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element)child;
switch (elem.getLocalName()) {
case PAGE_TAG:
Worksheet sheet = new Worksheet(this);
sheet.parseXml(elem);
this.addWorksheet(sheet);
break;
default:
throw new TechnicalException("Unexpected node: "+elem.getLocalName());
}
}
}
}
/**
* Konvertiert die Daten in eine DOM-Struktur.
*
* @param w3cDoc
* @throws TechnicalException
*/
private void convertToXml(org.w3c.dom.Document w3cDoc) throws TechnicalException {
// Visio-Tag für das Dokument erstellen
Element docElem = w3cDoc.createElement(DOCUMENT_TAG);
w3cDoc.appendChild(docElem);
if (this.title != null && !this.title.isEmpty()) {
// Title-Tag
Element titleElem = w3cDoc.createElement(TITLE_TAG);
titleElem.setTextContent(this.title);
docElem.appendChild(titleElem);
}
// Sets-Tag
Element setsElem = w3cDoc.createElement(SETS_TAG);
docElem.appendChild(setsElem);
// alle ShapeSets schreiben
for (ShapeSet set : shapeSets.values()) {
set.convertToXml(w3cDoc, setsElem);
}
// Pages-Tag
Element pagesElem = w3cDoc.createElement(PAGES_TAG);
docElem.appendChild(pagesElem);
// alle Worksheets schreiben
for (Worksheet sheet : worksheets) {
sheet.convertToXml(w3cDoc, pagesElem);
}
}
/**
* Speichert das ShapeSet im Workbook.
*
* @param shapeSet
*/
public void addShapeSet(ShapeSet shapeSet) {
this.shapeSets.put(shapeSet.getName(), shapeSet);
}
/**
* @param sheet
*/
public void addWorksheet(Worksheet sheet) {
worksheets.add(sheet);
}
}
| ISO-8859-1 | Java | 16,118 | java | Workbook.java | Java | [
{
"context": "ksheets geändert wurde.</li>\r\n * </ul>\r\n * @author bk\r\n */\r\npublic class Workbook {\r\n\t\r\n\tprivate static",
"end": 2304,
"score": 0.9831315875053406,
"start": 2302,
"tag": "USERNAME",
"value": "bk"
}
] | null | [] | package de.bkroeger.myvisio.model;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
import de.bkroeger.myvisio.shapes.IShape;
import de.bkroeger.myvisio.utility.TechnicalException;
/**
* <p>
* Die WorkBook-Klasse repräsentiert ein MyVisio-Dokument bestehend aus
* mehreren Seiten ({@link Worksheet}) auf denen jeweils diverse Shapes ({@link IShape})
* angeordnet sind.
* </p><p>
* Ein WorkBook wird durch seinen voll qualifizierten Dateinamen bezeichnet
* und durch eine UUID identifiziert.
* </p><p>
* Ein Workbook besteht aus ein oder mehreren {@link Worksheet Worksheets}.
* Ein Workbook enthält ein oder mehrere {@link ShapeSet ShapeSets}.
* </p><p>
* Gespeichert werden WorkBooks als XML-Dateien.
* </p><p>
* Es gibt zwei Arten von Workbooks:</p>
* <ol>
* <li>Standard-Workbooks, die eine Zeichnung eines Benutzers speichern.
* Dabei werden die benutzten Shapes nur als Referenzen (UUID) gespeichert.
* </ol>
* <li>Example-Workbooks, die neben einer Zeichnung auch eine Liste der erforderlichen
* ShapeSets enthalten. Die ShapeSets selber sind dabei auch nur referenziert.</ol>
* </ol>
* @invariant
* <ul>
* <li>uuid ist unveränderlich</li>
* </ul>
* @pre
* @post
* <ul>
* <li>Dirty-Flag ist gesetzt, wenn ein Attribut des Workbooks oder eines Worksheets geändert wurde.</li>
* </ul>
* @author bk
*/
public class Workbook {
private static final String SETS_TAG = "shapesets";
private static final String TITLE_TAG = "title";
private static final String PAGE_TAG = "page";
private static final String DESC_TAG = "desc";
private static final String SHAPE_SETS_TAG = "shape-sets";
private static final String PAGES_TAG = "pages";
private static final String DOCUMENT_TAG = "myvisio";
private static Logger logger = Logger.getLogger(Workbook.class.getName());
/**
* Die interne UUID des Workbook
*/
private UUID uuid;
/**
* @return - die UUID des Dokuments
*/
public UUID getUUID() {
return uuid;
}
/**
* Der Dateipfad (Dateiname plus Pfad).
*/
private String filepath = "";
/**
* @return - der Dateipfad
*/
public String getFileName() { return filepath; }
/**
* @param fileName
* @throws TechnicalException
*/
public void setFileName(String fileName) throws TechnicalException {
if (fileName == null || fileName.isEmpty()) {
throw new TechnicalException("File name missing or empty!");
}
this.filepath = fileName;
// wichtig: Setter verwenden, weil dieser wichtige Funktionen enthält
this.setTitle(new File(fileName).getName());
}
/**
* Der Titel des Dokuments (Dateiname ohne Pfad).
*/
private String title = "";
/**
* @return - der Titel
*/
public String getTitle() { return title; }
/**
* @param value
* @throws TechnicalException
*/
public void setTitle(String value) throws TechnicalException {
if (value == null || value.isEmpty()) {
throw new TechnicalException("Title missing or empty!");
}
title = value;
// alle Seiten informieren
for (Worksheet sheet : worksheets) {
sheet.refreshTitle();
}
}
private boolean dirtyFlag = false;
/**
* Liefert das Dirty-Flag. Wenn eine der Seiten "schmutzig" ist,
* gilt die ganze Datei als schmutzig.
*
* @return - true, wenn wenigstens eine Seite verändert wurde
*/
public boolean isDirty() {
boolean sheetDirty = false;
for (Worksheet sheet : worksheets) {
if (sheet.isDirty()) {
sheetDirty = true;
break;
}
}
return (dirtyFlag || sheetDirty);
}
/**
* Liste der WorkSheets
*/
private List<Worksheet> worksheets = new ArrayList<Worksheet>();
/**
* @return - die Anzahl WorkSheets
*/
public int getWorksheetSize() { return worksheets.size(); }
/**
* @return - WorkSheet-Iterator
*/
public Iterator<Worksheet> getWorksheetIterator() {
return worksheets.iterator();
}
/**
* @return - das aktuelle WorkSheet
*/
public Worksheet getCurrentWorksheet() {
if (currentPageUUID == null) return null;
for (Worksheet sheet : worksheets) {
if (sheet.getUUID() == currentPageUUID) return sheet;
}
return null;
}
/**
* die aktuelle Seite
*/
private UUID currentPageUUID = null;
/**
* @return - die UUID der aktuellen Seite
*/
public UUID getCurrentPageUUID() { return currentPageUUID; }
/**
* Map der ShapeSets
*/
private Map<String, ShapeSet> shapeSets = new HashMap<String, ShapeSet>();
/**
* @return - Liste der ShapeSets
*/
public Collection<ShapeSet> getShapeSets() {
return this.shapeSets.values();
}
/**
* @return - Anzahl der ShapeSets
*/
public int getShapeSetSize() { return shapeSets.size(); }
/**
* Beschreibung
*/
private String description = "";
/**
* @return - Beschreibung
*/
public String getDescription() { return description; }
/**
* <p>
* Konstruktor für leeres/neues Worksheet.
* </p><p>
* Für ein neues Dokument wird ein Titel vergeben,
* das Page-Set initialisiert
* und eine erste leere Seite erzeugt. Dies ist die aktuelle/Default-Seite.
* Der Filename bleibt leer.
* </p>
* @throws TechnicalException
*/
public Workbook() throws TechnicalException {
this.setTitle("New Document");
this.dirtyFlag = false;
this.uuid = UUID.randomUUID();
worksheets.add(Worksheet.createDefaultWorksheet(this));
}
/**
* <p>
* Konstruktor mit Dateipfad. Der Pfad-String muss eine Datei mit
* Extension ".mvd" (myVisioDocument) oder ".xml" definieren.
* Die Datei muss existieren!
* </p><p>
* Als Titel wird der Name der Datei (ohne Pfad) verwendet.
* Das Page-Set wird initialisiert
* und die Struktur des Dokumentes aus der XML-Datei eingelesen.
* </p>
* @param fileName - Pfad zur Document-XML-Datei
* @throws TechnicalException - wenn
* <ul>
* <li>der fileName null oder leer ist</li>
* <li>der fileName nicht die richtige Extension hat</li>
* <li>die angegebene Datei nicht existiert</li>
* </ul>
*/
public Workbook(String fileName) throws TechnicalException {
if (fileName == null || fileName.isEmpty()) {
throw new TechnicalException("Filename empty");
}
if (fileName.endsWith(".xml") == false && fileName.endsWith(".mvd") == false) {
throw new TechnicalException("Invalid file type! Path="+fileName);
}
File file = new File(fileName);
if (!file.exists()) {
throw new TechnicalException("File '"+fileName+"' does not exist!");
}
// File-Name speichern
this.filepath = fileName;
// Title setzen
this.setTitle(file.getName());
// Workbook ist unverändert
this.dirtyFlag = false;
// Workbook laden
this.load(file);
// wenn kein Worksheet geladen wurde, Default-Worksheet hinzufügen
if (this.getWorksheetSize() == 0) {
this.addWorksheet(Worksheet.createDefaultWorksheet(this));
}
}
/**
* <p>
* Speichert die Document-Hierarchie in einer XML-Datei.
* </p>
* @throws TechnicalException
*/
public void store() throws TechnicalException {
try {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
// ein XML-Dokument erstellen
org.w3c.dom.Document doc = db.newDocument();
// und mit den Daten der Visio-Struktur füllen
convertToXml(doc);
// einen Transformer erstellen
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
// und Optionen setzen
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
// die XML-Struktur in die Datei schreiben
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File(this.filepath));
transformer.transform(source, result);
logger.info("File '"+this.filepath+"' stored.");
// das Dirty-Flag in allen Seiten löschen
for (Worksheet sheet : worksheets) {
sheet.clearDirty();
}
this.dirtyFlag = false;
} catch (ParserConfigurationException e) {
e.printStackTrace();
logger.severe("ParserConfiguration: "+e.getMessage());
throw new TechnicalException("ParserConfiguration: "+e.getMessage(), e);
} catch (TransformerConfigurationException e) {
e.printStackTrace();
logger.severe("TransformerConfiguration: "+e.getMessage());
throw new TechnicalException("TransformerConfiguration: "+e.getMessage(), e);
} catch (TransformerException e) {
e.printStackTrace();
logger.severe("Transformer: "+e.getMessage());
throw new TechnicalException("Transformer: "+e.getMessage(), e);
}
}
/**
* <p>
* Lädt die Document-Struktur aus der angegebenen XML-Datei.
* </p>
* @param file - XML-File
* @throws TechnicalException
*/
public void load(File file) throws TechnicalException {
logger.info("Loading WorkBook '"+file.getAbsolutePath()+"'.");
InputStream inStream = null;
try {
inStream = new FileInputStream(file);
load(inStream);
} catch (FileNotFoundException e) {
e.printStackTrace();
throw new TechnicalException(e.getMessage(), e);
} finally {
if (inStream != null) {
try {
inStream.close();
inStream = null;
} catch (IOException e) {
e.printStackTrace();
logger.severe(e.getMessage());
}
}
}
}
/**
* Lädt die Document-Struktur aus dem Input-Stream.
*
* @param in
* @throws TechnicalException
*/
public void load(InputStream in) throws TechnicalException {
boolean dtdValidate = false;
boolean xsdValidate = false;
try {
// XML-Datei in DOM-Struktur parsen
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(dtdValidate || xsdValidate);
DocumentBuilder db = dbf.newDocumentBuilder();
org.w3c.dom.Document doc = db.parse(in);
// DOM-Struktur in Visio-Hierarchie umwandeln
this.parseXml(doc);
} catch(ParserConfigurationException e) {
e.printStackTrace();
logger.severe("Error parsing XML-Document from Stream: "+e.getMessage());
throw new TechnicalException("Error parsing XML-Document from Stream", e);
} catch (SAXException e) {
e.printStackTrace();
logger.severe("Error processing XML-Document from Stream: "+e.getMessage());
throw new TechnicalException("Error processing XML-Document from Stream", e);
} catch (IOException e) {
e.printStackTrace();
logger.severe("Error reading XML-Document from Stream: "+e.getMessage());
throw new TechnicalException("Error reading XML-Document from Stream", e);
}
}
/**
* <p>
* Konvertiert eine DOM-Struktur in die Visio-Document-Hierarchie
* </p>
* @param w3cDoc
* @throws TechnicalException
*/
private void parseXml(org.w3c.dom.Document w3cDoc) throws TechnicalException {
Element docElem = w3cDoc.getDocumentElement();
if (docElem.getLocalName().equals(DOCUMENT_TAG)) {
// TODO: alle Attribute analysieren
// alle untergeordneten Elemente analysieren
NodeList children = docElem.getChildNodes();
for (int i=0; i<children.getLength(); i++) {
Node child = children.item(i);
// Element-Nodes analysieren
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element)child;
switch (elem.getLocalName()) {
case PAGES_TAG:
parsePagesTag(elem);
break;
case SHAPE_SETS_TAG:
parseShapeSets(elem);
break;
case DESC_TAG:
parseDescription(elem);
break;
default:
throw new TechnicalException("Unexpected node: "+elem.getLocalName());
}
// Text-Nodes analysieren
} else if (child.getNodeType() == Node.TEXT_NODE) {
switch (child.getNodeName()) {
case TITLE_TAG:
parseTitle(child);
break;
case "#text":
break;
default:
throw new TechnicalException("Unexpected node: "+child.getNodeName());
}
} else {
throw new TechnicalException("Unexpected node type.");
}
}
} else {
logger.warning("Invalid XML-Structur: Root element not found.");
throw new TechnicalException("Invalid XML-Structur: Root element not found.");
}
}
/**
* Ein ShapeSet analysieren.
*
* @param set
* @throws TechnicalException
*/
private void parseShapeSets(Element set) throws TechnicalException {
// TODO: ShapeSets analysieren
}
/**
* Desc-Tag analysieren
*
* @param elem
*/
private void parseDescription(Element elem) {
this.description = elem.getTextContent();
}
/**
* Title-Tag analysieren
*
* @param desc
*/
private void parseTitle(Node desc) {
// TODO: Title/Description analysieren
}
/**
* Page-Tag analysieren
*
* @param pages
* @throws TechnicalException
*/
private void parsePagesTag(Element pages) throws TechnicalException {
NodeList children = pages.getChildNodes();
for (int i=0; i<children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
Element elem = (Element)child;
switch (elem.getLocalName()) {
case PAGE_TAG:
Worksheet sheet = new Worksheet(this);
sheet.parseXml(elem);
this.addWorksheet(sheet);
break;
default:
throw new TechnicalException("Unexpected node: "+elem.getLocalName());
}
}
}
}
/**
* Konvertiert die Daten in eine DOM-Struktur.
*
* @param w3cDoc
* @throws TechnicalException
*/
private void convertToXml(org.w3c.dom.Document w3cDoc) throws TechnicalException {
// Visio-Tag für das Dokument erstellen
Element docElem = w3cDoc.createElement(DOCUMENT_TAG);
w3cDoc.appendChild(docElem);
if (this.title != null && !this.title.isEmpty()) {
// Title-Tag
Element titleElem = w3cDoc.createElement(TITLE_TAG);
titleElem.setTextContent(this.title);
docElem.appendChild(titleElem);
}
// Sets-Tag
Element setsElem = w3cDoc.createElement(SETS_TAG);
docElem.appendChild(setsElem);
// alle ShapeSets schreiben
for (ShapeSet set : shapeSets.values()) {
set.convertToXml(w3cDoc, setsElem);
}
// Pages-Tag
Element pagesElem = w3cDoc.createElement(PAGES_TAG);
docElem.appendChild(pagesElem);
// alle Worksheets schreiben
for (Worksheet sheet : worksheets) {
sheet.convertToXml(w3cDoc, pagesElem);
}
}
/**
* Speichert das ShapeSet im Workbook.
*
* @param shapeSet
*/
public void addShapeSet(ShapeSet shapeSet) {
this.shapeSets.put(shapeSet.getName(), shapeSet);
}
/**
* @param sheet
*/
public void addWorksheet(Worksheet sheet) {
worksheets.add(sheet);
}
}
| 16,118 | 0.659318 | 0.65789 | 586 | 25.479523 | 23.182915 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.143345 | false | false | 13 |
1561dbcb155f0f0c833eab61ec1604dc2ca87529 | 16,673,063,043,207 | 211b7f6591fb5ec173fc9add07c5f91b8b1e42f7 | /TwitterClient/app/src/main/java/com/codepath/twitterclient/activities/HomeActivity.java | 3fc247f47af399bb574fa443d4963e24613131bc | [] | no_license | ardok/codepath | https://github.com/ardok/codepath | d803c10b14aede55c8429af8484647c2ac452797 | 57332692197009940980767ec2a204c6b1c425c7 | refs/heads/master | 2021-01-10T13:52:06.709000 | 2015-12-11T05:47:12 | 2015-12-11T05:47:12 | 47,155,217 | 0 | 2 | null | false | 2015-12-11T05:47:12 | 2015-12-01T00:41:14 | 2015-12-01T00:43:24 | 2015-12-11T05:47:12 | 2,312 | 0 | 0 | 1 | Java | null | null | package com.codepath.twitterclient.activities;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.codepath.twitterclient.R;
import com.codepath.twitterclient.adapters.HomeFragmentStatePagerAdapter;
import com.codepath.twitterclient.core.TwitterApplication;
import butterknife.Bind;
import butterknife.ButterKnife;
public class HomeActivity extends AppCompatActivity {
@Bind(R.id.toolbar) Toolbar toolbar;
@Bind(R.id.mainVP) ViewPager mainVP;
@Bind(R.id.mainTL) TabLayout mainTL;
HomeFragmentStatePagerAdapter homeFragmentStatePagerAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
// Get the ViewPager and set it's PagerAdapter so that it can display items
homeFragmentStatePagerAdapter = new HomeFragmentStatePagerAdapter(getSupportFragmentManager(), this);
mainVP.setAdapter(homeFragmentStatePagerAdapter);
// Give the TabLayout the ViewPager
mainTL.setupWithViewPager(mainVP);
}
// Inflate the menu; this adds items to the action bar if it is present.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_timeline, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.action_tweet:
intent = new Intent(HomeActivity.this, PostTweetActivity.class);
startActivityForResult(intent, PostTweetActivity.REQUEST_CODE_POST_TWEET);
return true;
case R.id.action_profile:
intent = new Intent(HomeActivity.this, ProfileActivity.class);
intent.putExtra("user", TwitterApplication.getSessionUser());
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| UTF-8 | Java | 2,361 | java | HomeActivity.java | Java | [] | null | [] | package com.codepath.twitterclient.activities;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.codepath.twitterclient.R;
import com.codepath.twitterclient.adapters.HomeFragmentStatePagerAdapter;
import com.codepath.twitterclient.core.TwitterApplication;
import butterknife.Bind;
import butterknife.ButterKnife;
public class HomeActivity extends AppCompatActivity {
@Bind(R.id.toolbar) Toolbar toolbar;
@Bind(R.id.mainVP) ViewPager mainVP;
@Bind(R.id.mainTL) TabLayout mainTL;
HomeFragmentStatePagerAdapter homeFragmentStatePagerAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
ButterKnife.bind(this);
setSupportActionBar(toolbar);
// Get the ViewPager and set it's PagerAdapter so that it can display items
homeFragmentStatePagerAdapter = new HomeFragmentStatePagerAdapter(getSupportFragmentManager(), this);
mainVP.setAdapter(homeFragmentStatePagerAdapter);
// Give the TabLayout the ViewPager
mainTL.setupWithViewPager(mainVP);
}
// Inflate the menu; this adds items to the action bar if it is present.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_timeline, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent;
switch (item.getItemId()) {
case R.id.action_tweet:
intent = new Intent(HomeActivity.this, PostTweetActivity.class);
startActivityForResult(intent, PostTweetActivity.REQUEST_CODE_POST_TWEET);
return true;
case R.id.action_profile:
intent = new Intent(HomeActivity.this, ProfileActivity.class);
intent.putExtra("user", TwitterApplication.getSessionUser());
startActivity(intent);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
}
| 2,361 | 0.70648 | 0.70521 | 67 | 34.238808 | 26.439505 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.641791 | false | false | 13 |
ee51f615253aca4ed28dc96f21b2b025a2f5c963 | 18,038,862,647,554 | 2a7593ef07219a3e2cfddfd6cb0cb5b67ff3f408 | /aggregate-usage-web/src/test/java/nl/tele2/fez/aggregateusage/service/FezApiAdapterTest.java | 7f737c6ae07eca22767bd604e5d13474963c540b | [] | no_license | rajibasahoo/aggregate-usage | https://github.com/rajibasahoo/aggregate-usage | 78df08aa5d5917dabef61728f6798a3a0ad6571a | 6df0233536001fccfea0491e9ddf40eadf5092ed | refs/heads/master | 2022-12-29T13:01:01.235000 | 2019-12-17T05:29:40 | 2019-12-17T05:29:40 | 228,539,622 | 0 | 0 | null | false | 2022-12-10T04:50:19 | 2019-12-17T05:27:10 | 2019-12-17T05:30:21 | 2022-12-10T04:50:18 | 89 | 0 | 0 | 3 | Java | false | false | package nl.tele2.fez.aggregateusage.service;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.slf4j.MDC;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(SpringRunner.class)
public class FezApiAdapterTest {
@Mock
private RestTemplate restTemplate;
private FezApiAdapter fezApiAdapter;
@Before
public void setUp() throws Exception {
when(restTemplate.exchange(anyString(), any(HttpMethod.class), any(HttpEntity.class), eq(String.class), Matchers.<Object>anyVararg()))
.thenReturn(ResponseEntity.ok("Got it"));
fezApiAdapter = new FezApiAdapter(restTemplate);
MDC.put(FezApiAdapter.BUSINESS_PROCESS_ID_HEADER, "Foo-123");
MDC.put(FezApiAdapter.CONVERSATION_ID_HEADER, "Bar-123");
}
@After
public void tearDown() throws Exception {
MDC.clear();
}
@Test
public void shouldSetBusinessProcessIdHeaderForPost() {
fezApiAdapter.post("foo", "Thing");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.POST), entityCaptor.capture(), eq(Void.class));
assertThat(entityCaptor.getValue().getHeaders().get(FezApiAdapter.BUSINESS_PROCESS_ID_HEADER), contains("Foo-123"));
}
@Test
public void shouldGenerateConversationIdHeaderForPost() {
fezApiAdapter.post("foo", "Thing");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.POST), entityCaptor.capture(), eq(Void.class));
List<String> conversationId = entityCaptor.getValue().getHeaders().get(FezApiAdapter.CONVERSATION_ID_HEADER);
assertThat(conversationId, hasSize(1));
assertThat(conversationId.get(0), not(equalTo("Bar-123")));
}
@Test
public void shouldSetBusinessProcessIdHeaderForGet() {
fezApiAdapter.get("foo", String.class,"param");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.GET), entityCaptor.capture(), eq(String.class), eq("param"));
List<String> bpidHeaders = entityCaptor.getValue().getHeaders().get(FezApiAdapter.BUSINESS_PROCESS_ID_HEADER);
assertThat(bpidHeaders, hasSize(1));
assertThat(bpidHeaders.get(0), equalTo("Foo-123"));
}
@Test
public void shouldGenerateConversationIdHeaderForGet() {
fezApiAdapter.get("foo", String.class,"param");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.GET), entityCaptor.capture(), eq(String.class), eq("param"));
List<String> conversationId = entityCaptor.getValue().getHeaders().get(FezApiAdapter.CONVERSATION_ID_HEADER);
assertThat(conversationId, hasSize(1));
assertThat(conversationId.get(0), not(equalTo("Bar-123")));
}
} | UTF-8 | Java | 3,848 | java | FezApiAdapterTest.java | Java | [] | null | [] | package nl.tele2.fez.aggregateusage.service;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.slf4j.MDC;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.RestTemplate;
import java.util.List;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.not;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.hasSize;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@RunWith(SpringRunner.class)
public class FezApiAdapterTest {
@Mock
private RestTemplate restTemplate;
private FezApiAdapter fezApiAdapter;
@Before
public void setUp() throws Exception {
when(restTemplate.exchange(anyString(), any(HttpMethod.class), any(HttpEntity.class), eq(String.class), Matchers.<Object>anyVararg()))
.thenReturn(ResponseEntity.ok("Got it"));
fezApiAdapter = new FezApiAdapter(restTemplate);
MDC.put(FezApiAdapter.BUSINESS_PROCESS_ID_HEADER, "Foo-123");
MDC.put(FezApiAdapter.CONVERSATION_ID_HEADER, "Bar-123");
}
@After
public void tearDown() throws Exception {
MDC.clear();
}
@Test
public void shouldSetBusinessProcessIdHeaderForPost() {
fezApiAdapter.post("foo", "Thing");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.POST), entityCaptor.capture(), eq(Void.class));
assertThat(entityCaptor.getValue().getHeaders().get(FezApiAdapter.BUSINESS_PROCESS_ID_HEADER), contains("Foo-123"));
}
@Test
public void shouldGenerateConversationIdHeaderForPost() {
fezApiAdapter.post("foo", "Thing");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.POST), entityCaptor.capture(), eq(Void.class));
List<String> conversationId = entityCaptor.getValue().getHeaders().get(FezApiAdapter.CONVERSATION_ID_HEADER);
assertThat(conversationId, hasSize(1));
assertThat(conversationId.get(0), not(equalTo("Bar-123")));
}
@Test
public void shouldSetBusinessProcessIdHeaderForGet() {
fezApiAdapter.get("foo", String.class,"param");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.GET), entityCaptor.capture(), eq(String.class), eq("param"));
List<String> bpidHeaders = entityCaptor.getValue().getHeaders().get(FezApiAdapter.BUSINESS_PROCESS_ID_HEADER);
assertThat(bpidHeaders, hasSize(1));
assertThat(bpidHeaders.get(0), equalTo("Foo-123"));
}
@Test
public void shouldGenerateConversationIdHeaderForGet() {
fezApiAdapter.get("foo", String.class,"param");
ArgumentCaptor<HttpEntity> entityCaptor = ArgumentCaptor.forClass(HttpEntity.class);
verify(restTemplate).exchange(eq("foo"), eq(HttpMethod.GET), entityCaptor.capture(), eq(String.class), eq("param"));
List<String> conversationId = entityCaptor.getValue().getHeaders().get(FezApiAdapter.CONVERSATION_ID_HEADER);
assertThat(conversationId, hasSize(1));
assertThat(conversationId.get(0), not(equalTo("Bar-123")));
}
} | 3,848 | 0.731809 | 0.724792 | 98 | 38.275509 | 36.175529 | 142 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.887755 | false | false | 13 |
da9902dba7ebbb9e4088612e9962e363f7bcc343 | 28,535,762,719,789 | d03074998694efe9913824b943e9d4cc0facbd08 | /src/main/java/br/com/jbq/entrevista/apresentacao/business/ClienteBusiness.java | b5094e1b6748b842074bbc3e3af91e76d31db9aa | [] | no_license | ffsales/apresentacao | https://github.com/ffsales/apresentacao | 0f99c0989d67aa7fa45106217671c82b22efc2ac | ebf1b3198eeaa190d49264bdf60043c246e81401 | refs/heads/master | 2020-04-21T01:13:36.020000 | 2019-02-05T09:46:19 | 2019-02-05T09:46:19 | 169,217,712 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.jbq.entrevista.apresentacao.business;
import java.util.List;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import br.com.jbq.entrevista.apresentacao.model.Cliente;
@Component
public class ClienteBusiness {
public List<Cliente> findAll() {
RestTemplate restTemplate = new RestTemplate();
List<Cliente> clientes = restTemplate.getForObject("http://localhost:9090/clientes/listAll", List.class);
return clientes;
}
public void salvar(Cliente cliente) {
RestTemplate restTemplate = new RestTemplate();
MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
headers.add("Accept", "application/json");
HttpEntity<Object> entity = new HttpEntity<Object>(cliente, headers);
ResponseEntity<Cliente> response = restTemplate.exchange("http://localhost:9090/clientes/add", HttpMethod.POST, entity, Cliente.class);
response.getBody();
}
}
| UTF-8 | Java | 1,208 | java | ClienteBusiness.java | Java | [] | null | [] | package br.com.jbq.entrevista.apresentacao.business;
import java.util.List;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import br.com.jbq.entrevista.apresentacao.model.Cliente;
@Component
public class ClienteBusiness {
public List<Cliente> findAll() {
RestTemplate restTemplate = new RestTemplate();
List<Cliente> clientes = restTemplate.getForObject("http://localhost:9090/clientes/listAll", List.class);
return clientes;
}
public void salvar(Cliente cliente) {
RestTemplate restTemplate = new RestTemplate();
MultiValueMap<String, String> headers = new LinkedMultiValueMap<String, String>();
headers.add("Accept", "application/json");
HttpEntity<Object> entity = new HttpEntity<Object>(cliente, headers);
ResponseEntity<Cliente> response = restTemplate.exchange("http://localhost:9090/clientes/add", HttpMethod.POST, entity, Cliente.class);
response.getBody();
}
}
| 1,208 | 0.783113 | 0.77649 | 38 | 30.789474 | 32.328217 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.578947 | false | false | 13 |
2d0376f3bd7bdf691c700f745c46ccd6d0c48853 | 4,260,607,563,092 | fb1df2ea6f072cbcebdcd6ad4ec082712ff5369f | /HerokuDataTestLoad/src/main/java/com/heroku/service/HerokuDataServiceImpl.java | 6327b342c1ca7b24ff736feb915a5d9435bc6947 | [] | no_license | saimuth/HerokuDataLoadTest | https://github.com/saimuth/HerokuDataLoadTest | e58daea644871aacb42a09cfe137dab07316de41 | 5e9f11a524deeb46e7c5cad8235e4ca94c2fab9a | refs/heads/main | 2023-01-18T14:48:16.483000 | 2020-11-23T15:43:58 | 2020-11-23T15:43:58 | 315,361,846 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package com.heroku.service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.heroku.dao.HerokuDataDao;
import com.heroku.model.Application;
import com.heroku.model.Assessment;
import com.heroku.model.EmailMessage;
import com.heroku.model.ErrorLog;
import com.heroku.model.IntegrationTransaction;
import com.heroku.model.Interview;
import com.heroku.model.Note;
import com.heroku.model.Response;
import com.heroku.model.ResponseAnswer;
/**
* service Implementation class
*
*/
@Service
public class HerokuDataServiceImpl implements HerokuDataService {
@Autowired
HerokuDataDao herokuDataDao;
/**
* creating list of application objects
*
* @return void
*/
@Override
public void insertApplicationData() {
// TODO Auto-generated method stub
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
// TODO Auto-generated method stub
List<Application> lstApl = new ArrayList<Application>();
for (int i = 0; i < 10; i++) {
Application ap = new Application();
ap.setCandidate__c("candidate" + i);
ap.setNational_id_country_ps__c("national_id");
ap.setMore_than_one_application__c(true);
ap.setLegacy_taleo_external_id__c("legacytaleo" + i);
ap.setFelony_conviction_question_1__c("felony_conviction_question_1");
ap.setRequisition_hiring_function__c("requisition_hiring_function");
ap.setEmail_notification_prompt_3_text__c("email_notification_prompt_3_text");
ap.setBgc_authorization_1_date__c(ts);
ap.setHcr_hiring_manager_full_name__c("hcr_hiring_managefullname");
ap.setCandidate_withdraws_detail__c("candidatewithdraw_detail");
ap.setCandidate_owner_id__c("candidate_owner_id");
ap.setRequisition_reg_temp__c("requisition_reg_temp");
ap.setApp_performance_curve__c((float) 5.43);
ap.setTech_insight_score__c("tech_insightightcore");
ap.setUs_candidate__c(true);
ap.setLegacy_taleo_fclm_area__c("legacytaleoarea");
ap.setCreatedfrompostcard__c(true);
ap.setEmail_notification_prompt_4_text__c("emailnotificationprompt_4_text");
ap.setBgc_authorization_2_date__c(ts);
ap.setApp_performance_hours__c((float) 4.5);
ap.setPeoplesoft_pre_processing_substep__c(true);
ap.setMost_recent_substep_change_date__c(fromdate);
ap.setHr_location_code__c("hr_location_code");
ap.setHr_manager_login__c("hr_manager_login");
ap.setAgency_subsource_ps__c("agency_subsource_ps");
ap.setGender_ps__c("gender_ps");
ap.setEducation_qualification_check__c(true);
ap.setPrevious_step_substep__c("previous_stepsubstep");
ap.setTyping_accuracy__c("typingaccuracy");
ap.setJob_page_url__c("job_page_url");
ap.setEnable_concurrent_contingencies__c(true);
ap.setApplication_esignature_date_time_part2__c(ts);
ap.setArtdoc_candidate_id__c("artdoc_candidate_id");
ap.setSign_on_bonus_ps__c("sign_on_bonus_ps");
ap.setApplication_esignature_date_time__c(ts);
ap.setPhone_tool_title_ps__c("phone_tool_title_ps");
ap.setHcr_hiring_manager_title__c("hcr_hiring_manager_title");
ap.setIn_invitation_extension_substep__c(true);
ap.setReq_auto_send_contingent_offer__c("req_auto_send_contingent_offer");
ap.setApp_performance_eligibility__c("app_performance_eligibility");
ap.setLegacy_taleo_overall_assessment__c("legacytarassmt");
ap.setContingent_offer_extended__c(ts);
ap.setHr_requisition_title__c("hr_requisitiontitle");
ap.setCloned_due_to_process_on_other_req__c(true);
ap.setWorkflow__c("workflow");
ap.setBackgroundcheckoverallscore__c("backgroundckoverallscore");
ap.setLegacy_taleo_recruiter__c("legacy_taleorecruiter");
ap.setTyping_speed__c("typing_speed");
ap.setHcr_day_1_day_ps__c("hcrday1_day_ps");
ap.setPanattemptcount__c((float) 4.67);
ap.setOrder_id_override__c("order_id_override");
ap.setHr_shift_code__c("hr_shift_code");
ap.setNode_requisition__c("node_requisition");
ap.setHcr_orientation_session__c("hcr_orientation_session");
ap.setHeadcount_request__c("headcount_request");
ap.setBgc_disclosure_date__c(ts);
ap.setHr_open__c((float) 6.7);
ap.setHcr_location_address1__c("hcr_locationaddress");
ap.setRequisition_id__c("requisition_id");
ap.setLegacy_taleo_department_extension__c("dept");
ap.setBusinessunit_ps__c("businessunit_ps");
ap.setSource_details__c("sourcedetails");
ap.setSource_primary__c("sourceprimary");
ap.setSelected_shift__c("selectedshift");
ap.setCandidateid__c("candidateid");
ap.setSp_q1_response__c("sp_q1response");
ap.setAppointment_search_filter_date__c(fromdate);
ap.setApp_rehire_eligibility_status__c("app_rehireeligibility_status");
ap.setHcr_orientation_date_ps__c("hcr_orientation_date_ps");
ap.setLegacy_taleo_hiring_area_manager__c("legacy_taleo_area_manager");
ap.setLegacy_taleo_shift_comments__c("legacy_taleosft_comments");
ap.setCareer_portal_url__c("career_portal_url");
ap.setStatus_onbase__c("status_onbase");
ap.setSp_q2_response__c("sp_q2_response");
ap.setCurrent_integration_step__c("current_integration_step");
ap.setAcknowledge_no_work_experience__c(true);
ap.setRpt_compare_start_date_with_day1__c("rpt_compare_start_date_withd1");
ap.setHire_back_dated_candidates_ps__c("hire_back_dated_candidates_ps");
ap.setRequisition__c("requisition");
ap.setSp_q3_response__c("sp_q3_response");
ap.setLegacy_taleo_submission_medium__c("legacy_taleosubmission_medium");
ap.setSelected_shift_valid__c(true);
ap.setLegacy_taleo_orientation_session__c("legacy_taleoorientation_session");
ap.setRewind__c(true);
ap.setHr_hired__c((float) 6.7);
ap.setRequisition_function__c("requisitionfunction");
ap.setLegacy_taleo_overall_percentile__c((float) 5.67);
ap.setMy_job_status_global__c("my_jobstatus_global");
ap.setBgc_disclosure_frca__c("bgc_disclosurefrca");
ap.setLastvieweddate(ts);
ap.setEmail_notification_subject__c("email_notification_subject");
ap.setAccount_employee_id__c("account_employee_id");
ap.setBgc_authorization2__c("bgc_authorization2");
ap.setPs_integration_enabled__c(true);
ap.setOwner_id_validator__c(true);
ap.setHcr_location_postalcode__c("hcr_locatiopostalcode");
ap.setSubmitted_app_on_file__c(true);
ap.setReschedule_count__c((float) 5.67);
ap.setAgency_conversion_check__c(true);
ap.setPreferred_location_code__c("preflode");
ap.setBgc_authorization1__c("bgc_authorization1");
ap.setMy_job_status_de__c("my_job_status_de");
ap.setApp_my_job_status_global__c("app_myjbstatus_global");
ap.setFree_consumer_report_requested__c(true);
ap.setRespects_special_jurisdiction__c(true);
ap.setMeets_education_requirement__c(true);
ap.setStep_substep__c("step_substep");
ap.setReq_contingency_bypass__c(true);
ap.setHr_requested__c((float) 7.5);
ap.setApplication_shift_code__c("appshift");
ap.setBackgroundchkexpirydate__c(fromdate);
ap.setWork_flow_rule_trigger__c("work_flow_rule_trigger");
ap.setCurrent_mailing_state_province__c("currentmalngst_province");
ap.setSalary_ps__c("salary_ps");
ap.setLetter_of_intent_selection__c("letter_ofintent_selection");
ap.setJobcode_ps__c("jobcode_ps");
ap.setName("name");
ap.setCandidate_last_name__c("candidateast_name");
ap.setRecruiter_employee_id__c("recruiter_id");
ap.setContinue_application__c("continue_application");
ap.setHcr_department_description__c("hcr_department_description");
ap.setBgc_disclosure_frca_esignature__c("bgc_disclosurefcrasignature");
ap.setDrugtestoverallscore__c("drugterallscore");
ap.setLocation_postal_code__c("location_postal_code");
ap.setVcpprp_ps__c("vcpprp_ps");
ap.setPay_rate__c((float) 5.4);
ap.setContract_title_ps__c("contract_title_ps");
ap.setRole__c("role");
ap.setStdhours_ps__c("stdhours_ps");
ap.setHr_hiring_manager_name__c("hr_hiring_managername");
ap.setApp_language__c("applanguage");
ap.setHire_start_date__c(fromdate);
ap.setCandidate_first_name__c("candidate_first_name");
ap.setHr_day_1_day__c(fromdate);
ap.setLetter_of_intent_completed_date__c(fromdate);
ap.setLegacy_taleo_shift__c("legacytaleosift");
ap.setConversion__c(true);
ap.setLastmodifieddate(ts);
ap.setLocation_city__c("location_city");
ap.setMatching_location_code__c("matchinglocation_code");
ap.setApplication_withdrawn__c(true);
ap.setHcr_hire_end_date__c(fromdate);
ap.setOwnerid("ownerid");
ap.setTech_force_email_rule_execution__c(true);
ap.setInstance__c("instance");
ap.setRequisition_title__c("requisition_title");
ap.setAppointment_4__c(ts);
ap.setPhone_screen_results__c("phone_screenresults");
ap.setRequisition_location_code__c("requisitionloccode");
ap.setIn_manage_hire__c(true);
ap.setBest_suitable_skill__c("best_suitable_skill");
ap.setHcr_location_country__c("hcr_location_country");
ap.setLegacy_taleo_e_signature_ip__c("legtalsigip");
ap.setIsdeleted(true);
ap.setPortal_application_status__c("portal_application_status");
ap.setBackground_check_counter__c("background_check_counter");
ap.setAccurate_screening_check__c((float) 4.67);
ap.setLegacy_taleo_application_creation_date__c(fromdate);
ap.setCompany_code_ps__c("company_code_ps");
ap.setHcr_request_id__c("hcr_request_id");
ap.setAppointment_3__c(ts);
ap.setLegacy_taleo_correspondence_information__c("legacy_taleocorrespondencenformation");
ap.setRequisition_country__c("requisition_country");
ap.setEmail_notification_body__c("email_notification_body");
ap.setSystemmodstamp(ts);
ap.setDrugtestexpirydate__c(fromdate);
ap.setLastmodifiedbyid("lastmodifiedbyid");
ap.setBypass_dt_bgc_validation__c(true);
ap.setTimeslots_available__c(true);
ap.setApp_scheduling_group__c("app_scheduling_group");
ap.setApp_performance_agency__c("app_performance_agency");
ap.setHcr_department_code__c("hcr_department_code");
ap.setEmail_notification_rich_text_2__c("email_notificationrichtext_2");
ap.setPart_2_completed__c(true);
ap.setConnectionsentid("consentid");
ap.setAppointment_2__c(ts);
ap.setNational_id_type_ps__c("national_id_type_ps");
ap.setRehire_eligibility_audit__c("rehireelbty_audit");
ap.setHcr_number__c("hcr_number");
ap.setShift_comments__c("shift_comments");
ap.setCurrency_ps__c("currency_ps");
ap.setAppointment_1__c(ts);
ap.setLegacy_taleo_hire_end_date__c(fromdate);
ap.setApplication_shift_description__c("applicationsftdescription");
ap.setCandidatesfdcid__c("candidatesfdcid");
ap.setHr_requistion_id__c("hr_requistion_id");
ap.setLastactivitydate(fromdate);
ap.setSpoken_overall__c("spoken_overall");
ap.setPreferred_location_description__c("preferredlocdescription");
ap.setFirst_available_start_date__c(fromdate);
ap.setApp_performance_points__c((float) 4.67);
ap.setHcr_location_state__c("hcr_location_state");
ap.setCurrent_appointment_number__c("current_appointment_number");
ap.setPan_candidate_attempt__c((float) 6.77);
ap.setMost_recent_substep_change_datetime__c(ts);
ap.setTier_3_interview_results__c("tier_3_interview_results");
ap.setPan_package_id_trigger__c("pan_package_id_trigger");
ap.setContract_signer_name_ps__c("contract_signer_name_ps");
ap.setHr_matched__c((float) 7.8);
ap.setApp_languagelocalekey__c("app_languagelocalekey");
ap.setHr_business_title__c("hr_business_title");
ap.setBgc_disclosure__c("bgc_disclosure");
ap.setContingent_offer_accepted__c(ts);
ap.setContingent_offer_shift_code_description__c("contingentoff_code_description");
ap.setHcr_hire_start_date__c(fromdate);
ap.setAgency_source_ps__c("agency_source_ps");
ap.setApp_languagecountrycode__c("applgcountrycode");
ap.setInterview_completed__c("interview_completed");
ap.setTier_1_interview_results__c("tier_1_interview_results");
ap.setLegacy_taleo_scheduling_information__c("legacy_taleoshinformation");
ap.setHcr_location_city__c("hcr_location_city");
ap.setEmail_template_name__c("email_template_name");
ap.setApp_overall_percentile__c((float) 6.7);
ap.setReq_hourly_rate__c("req_hourly_rate");
ap.setOverride_bgc_validation__c(true);
ap.setAppointment_4_interview_results__c("appointment_4_interview_results");
ap.setCreateddate(ts);
ap.setHr_shift_differential__c("hr_shift_differential");
ap.setBackgroundcheckstatus__c("bgcheckstatus");
ap.setSubstep__c("substep");
ap.setDuplicate_contact__c("duplinta");
ap.setEsignaturepart2__c("esignaturepart2");
ap.setApplication_submitted__c(true);
ap.setStock_ps__c("stock_ps");
ap.setOrder_id__c("order_id");
ap.setSuppress_screening_validation__c(true);
ap.setHcr_manager_emp_id__c("hcr_manager_emp_id");
ap.setHire_start_date_ps__c("hire_start_date_ps");
ap.setLegacy_taleo_hours_worked__c((float) 6.7);
ap.setStep__c("step");
ap.setPreferred_last_name_ps__c("preferredlstnameps");
ap.setPaybasis_ps__c("paybasis_ps");
ap.setSource_other__c("source_other");
ap.setDate_component__c("date_component");
ap.setTranslated_requisition_title__c("translated_requisition_title");
ap.setTagged__c(true);
ap.setAppointment_3_interview_results__c("appointmentinterview_results");
ap.setLocation_country__c("location_country");
ap.setInformatica_key__c("informatica_key");
ap.setAppointment_2_interview_results__c("appointmentinterview_results");
ap.setWorkflow_name__c("workflow_name");
ap.setLocation_code_ps__c("location_code_ps");
ap.setOffer_out__c((float) 7.6);
ap.setNo_show_count__c((float) 5.78);
ap.setEsignature_read_general__c("esignature_read_general");
ap.setTranslated_address__c("translated_address");
ap.setNo_show_indicator__c(true);
ap.setMatched_onbase__c("matched_onbase");
ap.setPay_rate_ps__c("pay_rate_ps");
ap.setReq_bypass_scheduling__c(true);
ap.setHr_shift_description__c("hrdescription");
ap.setShift_differential_ps__c("shiftdiff_ps");
ap.setLegacy_taleo_app_interview_info_de__c("legacyapp_intinfo_de");
ap.setPreferred_first_name_ps__c("preferred_first_name_ps");
ap.setAppointment_1_interview_results__c("appointmentinterview_results");
ap.setAppointment_start_time__c(ts);
ap.setLocation_address_line2__c("location_address_line2");
ap.setConnectionreceivedid("conrecid");
ap.setBackground_check_initiation_date__c(fromdate);
ap.setHr_alps_code__c("hr_alps_code");
ap.setLegacy_taleo_orientation_date__c(fromdate);
ap.setApp_my_job_status__c("app_my_job_status");
ap.setApp_performance_pool__c("app_perpool");
ap.setCreatedbyid("createdbyid");
ap.setNationalidcountry__c("nationalidcountry");
ap.setCandidateidsearchsupport__c("candisupport");
ap.setSpecial_skills__c("special_skills");
ap.setApp_performance_counsel__c("app_performance_counsel");
ap.setLegacy_taleo_fclm_job__c("legtaljob");
ap.setIs_node_application__c(true);
ap.setLegacy_taleo_pool__c("A");
ap.setLocation_address_line1__c("location_address_line1");
ap.setTranslated_directions_instructions__c("translateddirinstructions");
ap.setHr_location_description__c("hr_location_description");
ap.setBypassed_cultural_assessment__c(true);
ap.setSubsource_ps__c("subsource_ps");
ap.setAssessmentoverallscore__c("assessmelscore");
ap.setHr_department__c("hr_department");
ap.setAmazon_rejects_detail_picklist__c("amazonamzrejectspicklist");
ap.setMaster_shift_code__c("master_shift_code");
ap.setOperation__c("operation");
ap.setReq_education__c(true);
ap.setSource_ps__c("source_ps");
ap.setRequisition_function_ps__c("requisition_function_ps");
ap.setCreateddateclone__c(ts);
ap.setSubstep_duration__c((float) 5.6);
ap.setLocation_state__c("location_state");
ap.setNationalidtype__c("nationalidtype");
ap.setHcr_finance_week_number__c((float) 6.5);
ap.setAlps_code_description_ps__c("alps_code_description_ps");
ap.setMy_job_status__c("my_job_status");
ap.setLast_modified_date_ps__c("last_modified_date_ps");
ap.setLegacy_taleo_amp_eligibility__c("legacytal_amp_eligibility");
ap.setNumber_of_appointments__c((float) 6.87);
ap.setLastreferenceddate(ts);
ap.setJob_page_label__c("job_page_label");
ap.setActive__c(true);
ap.setMy_job_status_canada__c("my_job_status_canada");
ap.setEmail_notification_prompt_1_text__c("emailnotiprompt_1_text");
ap.setApp_candidate_name__c("app_candidate_name");
ap.setCandidateaccountid__c("cdaccountid");
ap.setHcr_orientation_date__c(fromdate);
ap.setWritten_overall__c("written_overall");
ap.setOrientation_date_ps__c("orientation_date_ps");
ap.setRequisition_type_ps__c("requisitionps");
ap.setHire_end_date_ps__c("hire_end_date_ps");
ap.setLegacy_taleo_step_substep__c("legacy_taleo_step_substep");
ap.setEmail_notification_prompt_datetime__c(ts);
ap.setAgency_name__c("agency_name");
ap.setAlps_code_ps__c("alps_code_ps");
ap.setEmail_notification_prompt_memo__c("email_notificationmemo");
ap.setAgency_req__c(true);
ap.setMatched__c(true);
ap.setFelony_conviction_question_2__c("felony_conviction_question_2");
ap.setPanerrorcount__c((float) 5.66);
ap.setEmail_template_formatted_address_label__c("email_templateaddress_label");
ap.setLegacy_taleo_shift_differential__c("legtashdi");
ap.setAcknowledge_no_attachment_provided__c(true);
ap.setEmail_notification_prompt_2_text__c("email_notification2_text");
ap.setAmzr_error_status__c("amzrstatus");
ap.setSfid("sfid" + i);
ap.setId(Long.valueOf(i));
ap.set_hc_lastop("_hc_lastop");
ap.set_hc_err("_hc_err");
ap.setNode_bgc_bypass_for_hire__c(true);
ap.setInterview_result__c("interview_result");
ap.setHrloggedascanddiate__c(true);
ap.setBgc_california_disclosure_fcra__c(true);
ap.setEmail_notification_prompt_datetime_str__c("emailprompt_datetime_str");
ap.setI9_enabled__c(true);
ap.setBgc_california_disclosure_icraa__c(true);
ap.setVirtual_new_hire_event__c("virtual_new_hire_event");
ap.setSp_q2_first_response__c("sp_q2_first_response");
ap.setIs_papi_enabled__c(true);
ap.setComms_override_nacf_t1_node__c("comms_override_nacf_t1_node");
ap.setCandidate_last_name_kanji__c("candidate_last_name_kanji");
ap.setSp_q1_first_response__c("sp_q1_first_response");
ap.setInclined_value__c("inclined_value");
ap.setNational_id_type__c("national_id_type");
ap.setSp_q3_first_response__c("sp_q3_first_response");
ap.setCandidate_first_name_kanji__c("candidate_first_name_kanji");
lstApl.add(ap);
}
herokuDataDao.insertApplicationData(lstApl);
}
/**
* creating list of Assessment objects
*
* @return void
*/
@Override
public void insertAssessmentData() {
// TODO Auto-generated method stub
List<Assessment> lstAsmt = new ArrayList<Assessment>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Assessment as = new Assessment();
as.setId(Long.valueOf(i));
as.setAssessment_type__c("Asstype" + i);
as.setSfid("sfid" + i);
as.setLastmodifieddate(ts);
as.setReplicate_screening__c("replicate");
as.setParent_screening__c("parents");
as.setLastreferenceddate(ts);
as.setApplication_requisition__c("Applicatrion");
as.setName("Name" + i);
as.setConnectionsentid("consentid" + i);
as.setCandidate__c("candidate"+i);
as.setCreatedbyid("CreatedByid");
as.setExpired_checkbox__c(true);
as.setRecordtypeid("recordtypeid");
as.setConnectionreceivedid("Conreceivedid");
as.setLast_asr_request_date__c(fromdate);
as.setApplication__c("App" + i);
as.setScore_name__c("scorename");
as.setInitiation_date__c(fromdate);
as.setStatus_date__c(fromdate);
as.setIs_international_bgc__c(true);
as.setError_detail_long__c("errordetaillongc" + i);
as.set_hc_lastop("hclasttop" + i);
as.set_hc_err("hcerror" + i);
as.setIsdeleted(true);
as.setApplication_workflow_details__c("appwork" + i);
as.setLegacy_taleo_provider_status__c("legacytaleo");
as.setLegacy_taleo_screening_requester__c("legtalequester");
as.setLastvieweddate(ts);
as.setError_detail__c("errordetailsc" + i);
as.setAccurate_screening_check__c((float) 6.777);
as.setSystemmodstamp(ts);
as.setReceipt_id__c("receiptidc" + i);
as.setExpirationdate__c(fromdate);
as.setOriginal_external_order_id__c("origextrnalord");
as.setX15_day_screening_validator__c(true);
as.setCurrent_pan_score__c("currentpanscore");
as.setOverall_score__c("overall" + i);
as.setUs_candidate__c(true);
as.setInvalidated_screening__c(true);
as.setCreateddate(ts);
as.setOrder_id__c("orderidc" + i);
as.setStatus__c("statusc" + i);
as.setLastmodifiedbyid("lastmodbyid" + i);
as.setScreening_pan_package_id__c("screanpackge");
as.setAdpinitiatescreeningurl__c("adpinreeningurl");
as.setBgc_expire_mismatch__c(true);
as.setAdpscreeningid__c("adpscreeningid" + i);
as.setSection1_complete_dt__c(fromdate);
as.setTerm_date__c(fromdate);
as.setI9_status__c("I9status" + i);
as.setI9_master_status__c("i9masts");
as.setCheck_rehire__c(true);
as.setNo_of_retries__c((float) 6.778);
as.setForm_id__c((float) 7.43);
as.setMaster_status__c("masterstatus");
as.setI9_id_type__c("i9idtype" + i);
as.setPrevious_i9_status_number__c((float) 8.34);
as.setI9_prior_master_status__c("i9prirma");
as.setAirport__c("airport" + i);
as.setI9_id__c((float) 8.45);
as.setI9_complete__c(true);
as.setI9_status_number__c((float) 8.45);
as.setSection3_complete_dt__c(fromdate);
as.setSection2_complete_dt__c(fromdate);
as.setHas_candidate_screenings__c(true);
lstAsmt.add(as);
}
herokuDataDao.insertAssessmentData(lstAsmt);
}
/**
* creating list of EmailMessage objects
*
* @return void
*/
@Override
public void insertEmailMessageData() {
// TODO Auto-generated method stub
List<EmailMessage> lstEmms = new ArrayList<EmailMessage>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
EmailMessage em = new EmailMessage();
em.setLastmodifieddate(ts);
em.setIstracked(true);
em.setHeaders("headers" + i);
em.setThreadidentifier("threa" + i);
em.setActivityid("activityid" + i);
em.setLastopeneddate(ts);
em.setEmailtemplateid("emailtemp" + i);
em.setIsexternallyvisible(true);
em.setIsclientmanaged(true);
em.setFromname("fromname" + i);
em.setHasattachment(true);
em.setFromaddress("fromadd" + i);
em.setCreatedbyid("credbyid" + i);
em.setIsopened(true);
em.setCcaddress("ccadress" + i);
em.setParentid("parentid" + i);
em.setRelatedtoid("reltoid" + i);
em.setStatus("status" + i);
em.setMessagedate(ts);
em.setIsdeleted(true);
em.setIncoming(true);
em.setIsbounced(true);
em.setValidatedfromaddress("valfromadd" + i);
em.setSubject("subject" + i);
em.setSystemmodstamp(ts);
em.setFirstopeneddate(ts);
em.setTextbody("textbody" + i);
em.setReplytoemailmessageid("repemaid" + i);
em.setHtmlbody("htmlbody" + i);
em.setCreateddate(ts);
em.setBccaddress("bccaddr" + i);
em.setMessageidentifier("mesnifier" + i);
em.setLastmodifiedbyid("lastmodbyid" + i);
em.setToaddress("toaddress" + i);
em.setSfid("sfid" + i);
em.setId(Long.valueOf(i));
em.set_hc_lastop("hclast" + i);
em.set_hc_err("hcerror" + i);
lstEmms.add(em);
}
herokuDataDao.insertEmailMessageData(lstEmms);
}
/**
* creating list of Errorlog objects
*
* @return void
*/
@Override
public void insertErrorLogData() {
// TODO Auto-generated method stub
List<ErrorLog> lstErrlog = new ArrayList<ErrorLog>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
ErrorLog el = new ErrorLog();
el.setException_stack_trace__c("Excon" + i);
;
el.setLastmodifieddate(ts);
el.setIsdeleted(true);
el.setException_message__c("excisage" + i);
el.setException_type__c("exptypec" + i);
el.setApex_class_name__c("apexcname" + i);
el.setName("name" + i);
el.setSystemmodstamp(ts);
el.setConnectionsentid("consentid" + i);
el.setOwnerid("ownerid" + i);
el.setCreatedbyid("createdbyid" + i);
el.setCreateddate(ts);
el.setConnectionreceivedid("conrdid" + i);
el.setException_line_number__c((float) 7.6);
el.setLastmodifiedbyid("lastmoedby" + i);
el.setRelated_application__c("App" + i);
el.setSfid("sfid" + i);
el.setId(Long.valueOf(i));
el.set_hc_lastop("hclasttop" + i);
el.set_hc_err("hcerror" + i);
lstErrlog.add(el);
}
herokuDataDao.insertErrorLogData(lstErrlog);
}
/**
* creating list of IntegrationTransaction objects
*
* @return void
*/
@Override
public void insertIntegrationTransactionData() {
// TODO Auto-generated method stub
List<IntegrationTransaction> lstInttrans = new ArrayList<IntegrationTransaction>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
IntegrationTransaction it = new IntegrationTransaction();
it.setLastmodifieddate(ts);
;
it.setTransaction_type__c("trantypec" + i);
it.setLastreferenceddate(ts);
it.setName("name" + i);
it.setConnectionsentid("connsentid" + i);
it.setTransaction_date_ff__c("txndate" + i);
it.setCreatedbyid("createdbyid" + i);
it.setConnectionreceivedid("connrecid" + i);
it.setRequestor_id_ps__c("requs" + i);
it.setNumber_of_attempts__c((float) 6.4);
it.setIt_candidate__c("candidate" + i);
it.setCreation_outside__c(true);
it.setIt_application__c("App" + i);
it.setOutbound_message__c("outboundmsg" + i);
it.setIsdeleted(true);
it.setError_summary__c("errosmary" + i);
it.setIt_screening__c("itscreeningc" + i);
it.setLastvieweddate(ts);
it.setProcessed__c(true);
it.setInbound_message__c("inboundmsg" + i);
it.setSystem__c("systemc" + i);
it.setError_detail__c("errordetails" + i);
it.setSystemmodstamp(ts);
it.setX15_minutes_from_now__c(ts);
it.setTransaction_status__c("trastatus" + i);
it.setCreateddate(ts);
it.setLastactivitydate(fromdate);
it.setEnvironment__c("envientc" + i);
it.setLastmodifiedbyid("lasdbyid" + i);
it.setTransaction_date__c(ts);
it.setSfid("sfid" + i);
it.set_hc_lastop("hclasttop" + i);
it.set_hc_err("hcerror" + i);
it.setNumber_of_noshows__c((float) 6.7);
it.setIs_papi_enabled__c(true);
it.setSystem_path__c("systathc" + i);
it.setSub_status__c("substatus" + i);
it.setId(Long.valueOf(i));
lstInttrans.add(it);
}
herokuDataDao.insertIntegrationTransactionData(lstInttrans);
}
/**
* creating list of Interview objects
*
* @return void
*/
@Override
public void insertInterviewData() {
// TODO Auto-generated method stub
List<Interview> lstInterview = new ArrayList<Interview>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Interview in = new Interview();
in.setLastmodifieddate(ts);
;
in.setAppt_time_zone__c("appt one" + i);
in.setAppt_end_time__c(ts);
in.setSpecial_skills__c("speckills" + i);
in.setName("name" + i);
in.setCandidate__c("candidate" + i);
in.setCreatedbyid("creatbyid" + i);
in.setCandidate_last_name__c("candname" + i);
in.setTimeslot__c("timeslot" + i);
in.setGeneral_notes__c("genralnotes" + i);
in.setRecruiting_event_type__c("reentype" + i);
in.setAppt_start_datetime__c(ts);
in.setIsdeleted(true);
in.setAppt_recruiting_event_link__c("reentlink" + i);
in.setLastvieweddate(ts);
in.setTranslated_address__c("transadd" + i);
in.setRequisition_id__c("requonid" + i);
in.setCreateddate(ts);
in.setAppointment_date__c(fromdate);
in.setAppt_end_time_text__c("aptimetext" + i);
in.setPool_substep__c("poobstep" + i);
in.setActive__c(true);
in.setAppt_timespan_number__c("timespanr" + i);
in.setInterview_type__c("interwtype" + i);
in.setAppt_start_date__c("appttdate" + i);
in.setAppt_requisition_link__c("appqlink" + i);
in.setScheduling_type__c("schuling" + i);
in.setShift_comments__c("shifmments" + i);
in.setInterview_question_set__c("intsset" + i);
in.setEmail_template_name__c("emailtename" + i);
in.setEvent_type__c("eventtype" + i);
in.setLastreferenceddate(ts);
in.setConnectionsentid("connsentid" + i);
in.setAppt_status__c("apptstatus" + i);
in.setCandidate_actual_time_zone__c("candat zone" + i);
in.setCandidate_first_name__c("candfistname" + i);
in.setConnectionreceivedid("conrecid" + i);
in.setAppt_start_time_text__c("apptsttext" + i);
in.setTranslated_directions_instructions__c("tranection " + i);
in.setApplication__c("App" + i);
in.setAppt_end_date__c("appenddate" + i);
in.setInterview_outcome__c("intecome" + i);
in.setRole__c("role" + i);
in.setCandidate_language__c("candluage" + i);
in.setShift__c("shiftc" + i);
in.setSystemmodstamp(ts);
in.setAppt_address__c("apptaddr" + i);
in.setUniqueness_validation_key__c("uniquidation" + i);
in.setAppt_time_zone_key__c("appttimenekey" + i);
in.setAppt_start_time__c(ts);
in.setLastmodifiedbyid("lastfedbyid" + i);
in.setCandidate_email__c("candemail" + i);
in.setInterviewer__c("inteewr" + i);
in.setId(Long.valueOf(i));
in.set_hc_lastop("hclaop" + i);
in.set_hc_err("hcerr" + i);
in.setVirtual_new_hire_event__c("virtnewhire");
in.setCid__c("Cid" + i);
lstInterview.add(in);
}
herokuDataDao.insertInterviewData(lstInterview);
}
/**
* creating list of Note objects
*
* @return void
*/
@Override
public void insertNoteData() {
// TODO Auto-generated method stub
List<Note> lstNotes = new ArrayList<Note>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Note nt = new Note();
nt.setBody("body" + i);
;
nt.setParentid("parentid" + i);
nt.setLastmodifieddate(ts);
nt.setOwnerid("ownerid" + i);
nt.setIsdeleted(true);
nt.setSystemmodstamp(ts);
nt.setLastmodifiedbyid("lasyid" + i);
nt.setCreateddate(ts);
nt.setTitle("title" + i);
nt.setIsprivate(true);
nt.setCreatedbyid("crdbyid" + i);
nt.setSfid("sfid" + i);
nt.setId(Long.valueOf(i));
nt.set_hc_lastop("hclastop" + i);
nt.set_hc_err("hcerror" + i);
lstNotes.add(nt);
}
herokuDataDao.insertNoteData(lstNotes);
}
/**
* creating list of Response objects
*
* @return void
*/
@Override
public void insertResponseData() {
// TODO Auto-generated method stub
List<Response> lstResponse = new ArrayList<Response>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Response rs = new Response();
rs.setLastmodifieddate(ts);
;
rs.setQuestion_text__c("questxt" + i);
rs.setDisqualifying_answer__c(true);
rs.setLastreferenceddate(ts);
rs.setInterviewer_comment__c("interment");
rs.setResponse__c("response" + i);
rs.setInterview__c("interviewc" + i);
rs.setName("name" + i);
rs.setConnectionsentid("consentid" + i);
rs.setOwnerid("ownerid" + i);
rs.setCreatedbyid("createdid" + i);
rs.setConnectionreceivedid("coniedid" + i);
rs.setApplication__c("App" + i);
rs.setQuestion__c("Question" + i);
rs.setIsdeleted(true);
rs.setLegacy_taleo_qa_response_identifier__c("legacy" + i);
rs.setLastvieweddate(ts);
rs.setSystemmodstamp(ts);
rs.setMeets_requirements__c("meetsreqmts" + i);
rs.setQuestion_type__c("Questiontypec" + i);
rs.setCompetency__c("competency" + i);
rs.setCreateddate(ts);
rs.setScore__c("score" + i);
rs.setLastmodifiedbyid("lastmodified" + i);
rs.setQuestion_html_type__c("Questionhtml" + i);
rs.setSfid("sfid" + i);
rs.setId(Long.valueOf(i));
rs.set_hc_lastop("hclasttop" + i);
rs.set_hc_err("hcerror" + i);
rs.setRelated_field__c("relatedfield" + i);
lstResponse.add(rs);
}
herokuDataDao.insertResponseData(lstResponse);
}
/**
* creating list of ResponseAnswer objects
*
* @return void
*/
@Override
public void insertResponseAnswerData() {
// TODO Auto-generated method stub
List<ResponseAnswer> lstResponseanswer = new ArrayList<ResponseAnswer>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 100; i++) {
ResponseAnswer rsa = new ResponseAnswer();
rsa.setLastmodifieddate(ts);
rsa.setIsdeleted(true);
rsa.setAnswer__c("answer" + i);
rsa.setResponse__c("response" + i);
rsa.setName("name" + i);
rsa.setSystemmodstamp(ts);
rsa.setConnectionsentid("consentid" + i);
rsa.setOwnerid("ownerid" + i);
rsa.setCreatedbyid("createdid" + i);
rsa.setCreateddate(ts);
rsa.setConnectionreceivedid("conrviedid" + i);
rsa.setLastmodifiedbyid("lastmedbyyid" + i);
rsa.setSfid("sfid" + i);
rsa.setId(Long.valueOf(i));
rsa.set_hc_lastop("hclasttop" + i);
rsa.set_hc_err("hcerror" + i);
lstResponseanswer.add(rsa);
}
herokuDataDao.insertResponseAnswerData(lstResponseanswer);
}
}
| UTF-8 | Java | 34,568 | java | HerokuDataServiceImpl.java | Java | [
{
"context": "cr_hire_end_date__c(fromdate);\r\n\t\t\tap.setOwnerid(\"ownerid\");\r\n\t\t\tap.setTech_force_email_rule_execution__c(t",
"end": 8789,
"score": 0.6952781677246094,
"start": 8782,
"tag": "USERNAME",
"value": "ownerid"
},
{
"context": "ep__c(\"substep\");\r\n\t\t\tap.setD... | null | [] | package com.heroku.service;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.heroku.dao.HerokuDataDao;
import com.heroku.model.Application;
import com.heroku.model.Assessment;
import com.heroku.model.EmailMessage;
import com.heroku.model.ErrorLog;
import com.heroku.model.IntegrationTransaction;
import com.heroku.model.Interview;
import com.heroku.model.Note;
import com.heroku.model.Response;
import com.heroku.model.ResponseAnswer;
/**
* service Implementation class
*
*/
@Service
public class HerokuDataServiceImpl implements HerokuDataService {
@Autowired
HerokuDataDao herokuDataDao;
/**
* creating list of application objects
*
* @return void
*/
@Override
public void insertApplicationData() {
// TODO Auto-generated method stub
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
// TODO Auto-generated method stub
List<Application> lstApl = new ArrayList<Application>();
for (int i = 0; i < 10; i++) {
Application ap = new Application();
ap.setCandidate__c("candidate" + i);
ap.setNational_id_country_ps__c("national_id");
ap.setMore_than_one_application__c(true);
ap.setLegacy_taleo_external_id__c("legacytaleo" + i);
ap.setFelony_conviction_question_1__c("felony_conviction_question_1");
ap.setRequisition_hiring_function__c("requisition_hiring_function");
ap.setEmail_notification_prompt_3_text__c("email_notification_prompt_3_text");
ap.setBgc_authorization_1_date__c(ts);
ap.setHcr_hiring_manager_full_name__c("hcr_hiring_managefullname");
ap.setCandidate_withdraws_detail__c("candidatewithdraw_detail");
ap.setCandidate_owner_id__c("candidate_owner_id");
ap.setRequisition_reg_temp__c("requisition_reg_temp");
ap.setApp_performance_curve__c((float) 5.43);
ap.setTech_insight_score__c("tech_insightightcore");
ap.setUs_candidate__c(true);
ap.setLegacy_taleo_fclm_area__c("legacytaleoarea");
ap.setCreatedfrompostcard__c(true);
ap.setEmail_notification_prompt_4_text__c("emailnotificationprompt_4_text");
ap.setBgc_authorization_2_date__c(ts);
ap.setApp_performance_hours__c((float) 4.5);
ap.setPeoplesoft_pre_processing_substep__c(true);
ap.setMost_recent_substep_change_date__c(fromdate);
ap.setHr_location_code__c("hr_location_code");
ap.setHr_manager_login__c("hr_manager_login");
ap.setAgency_subsource_ps__c("agency_subsource_ps");
ap.setGender_ps__c("gender_ps");
ap.setEducation_qualification_check__c(true);
ap.setPrevious_step_substep__c("previous_stepsubstep");
ap.setTyping_accuracy__c("typingaccuracy");
ap.setJob_page_url__c("job_page_url");
ap.setEnable_concurrent_contingencies__c(true);
ap.setApplication_esignature_date_time_part2__c(ts);
ap.setArtdoc_candidate_id__c("artdoc_candidate_id");
ap.setSign_on_bonus_ps__c("sign_on_bonus_ps");
ap.setApplication_esignature_date_time__c(ts);
ap.setPhone_tool_title_ps__c("phone_tool_title_ps");
ap.setHcr_hiring_manager_title__c("hcr_hiring_manager_title");
ap.setIn_invitation_extension_substep__c(true);
ap.setReq_auto_send_contingent_offer__c("req_auto_send_contingent_offer");
ap.setApp_performance_eligibility__c("app_performance_eligibility");
ap.setLegacy_taleo_overall_assessment__c("legacytarassmt");
ap.setContingent_offer_extended__c(ts);
ap.setHr_requisition_title__c("hr_requisitiontitle");
ap.setCloned_due_to_process_on_other_req__c(true);
ap.setWorkflow__c("workflow");
ap.setBackgroundcheckoverallscore__c("backgroundckoverallscore");
ap.setLegacy_taleo_recruiter__c("legacy_taleorecruiter");
ap.setTyping_speed__c("typing_speed");
ap.setHcr_day_1_day_ps__c("hcrday1_day_ps");
ap.setPanattemptcount__c((float) 4.67);
ap.setOrder_id_override__c("order_id_override");
ap.setHr_shift_code__c("hr_shift_code");
ap.setNode_requisition__c("node_requisition");
ap.setHcr_orientation_session__c("hcr_orientation_session");
ap.setHeadcount_request__c("headcount_request");
ap.setBgc_disclosure_date__c(ts);
ap.setHr_open__c((float) 6.7);
ap.setHcr_location_address1__c("hcr_locationaddress");
ap.setRequisition_id__c("requisition_id");
ap.setLegacy_taleo_department_extension__c("dept");
ap.setBusinessunit_ps__c("businessunit_ps");
ap.setSource_details__c("sourcedetails");
ap.setSource_primary__c("sourceprimary");
ap.setSelected_shift__c("selectedshift");
ap.setCandidateid__c("candidateid");
ap.setSp_q1_response__c("sp_q1response");
ap.setAppointment_search_filter_date__c(fromdate);
ap.setApp_rehire_eligibility_status__c("app_rehireeligibility_status");
ap.setHcr_orientation_date_ps__c("hcr_orientation_date_ps");
ap.setLegacy_taleo_hiring_area_manager__c("legacy_taleo_area_manager");
ap.setLegacy_taleo_shift_comments__c("legacy_taleosft_comments");
ap.setCareer_portal_url__c("career_portal_url");
ap.setStatus_onbase__c("status_onbase");
ap.setSp_q2_response__c("sp_q2_response");
ap.setCurrent_integration_step__c("current_integration_step");
ap.setAcknowledge_no_work_experience__c(true);
ap.setRpt_compare_start_date_with_day1__c("rpt_compare_start_date_withd1");
ap.setHire_back_dated_candidates_ps__c("hire_back_dated_candidates_ps");
ap.setRequisition__c("requisition");
ap.setSp_q3_response__c("sp_q3_response");
ap.setLegacy_taleo_submission_medium__c("legacy_taleosubmission_medium");
ap.setSelected_shift_valid__c(true);
ap.setLegacy_taleo_orientation_session__c("legacy_taleoorientation_session");
ap.setRewind__c(true);
ap.setHr_hired__c((float) 6.7);
ap.setRequisition_function__c("requisitionfunction");
ap.setLegacy_taleo_overall_percentile__c((float) 5.67);
ap.setMy_job_status_global__c("my_jobstatus_global");
ap.setBgc_disclosure_frca__c("bgc_disclosurefrca");
ap.setLastvieweddate(ts);
ap.setEmail_notification_subject__c("email_notification_subject");
ap.setAccount_employee_id__c("account_employee_id");
ap.setBgc_authorization2__c("bgc_authorization2");
ap.setPs_integration_enabled__c(true);
ap.setOwner_id_validator__c(true);
ap.setHcr_location_postalcode__c("hcr_locatiopostalcode");
ap.setSubmitted_app_on_file__c(true);
ap.setReschedule_count__c((float) 5.67);
ap.setAgency_conversion_check__c(true);
ap.setPreferred_location_code__c("preflode");
ap.setBgc_authorization1__c("bgc_authorization1");
ap.setMy_job_status_de__c("my_job_status_de");
ap.setApp_my_job_status_global__c("app_myjbstatus_global");
ap.setFree_consumer_report_requested__c(true);
ap.setRespects_special_jurisdiction__c(true);
ap.setMeets_education_requirement__c(true);
ap.setStep_substep__c("step_substep");
ap.setReq_contingency_bypass__c(true);
ap.setHr_requested__c((float) 7.5);
ap.setApplication_shift_code__c("appshift");
ap.setBackgroundchkexpirydate__c(fromdate);
ap.setWork_flow_rule_trigger__c("work_flow_rule_trigger");
ap.setCurrent_mailing_state_province__c("currentmalngst_province");
ap.setSalary_ps__c("salary_ps");
ap.setLetter_of_intent_selection__c("letter_ofintent_selection");
ap.setJobcode_ps__c("jobcode_ps");
ap.setName("name");
ap.setCandidate_last_name__c("candidateast_name");
ap.setRecruiter_employee_id__c("recruiter_id");
ap.setContinue_application__c("continue_application");
ap.setHcr_department_description__c("hcr_department_description");
ap.setBgc_disclosure_frca_esignature__c("bgc_disclosurefcrasignature");
ap.setDrugtestoverallscore__c("drugterallscore");
ap.setLocation_postal_code__c("location_postal_code");
ap.setVcpprp_ps__c("vcpprp_ps");
ap.setPay_rate__c((float) 5.4);
ap.setContract_title_ps__c("contract_title_ps");
ap.setRole__c("role");
ap.setStdhours_ps__c("stdhours_ps");
ap.setHr_hiring_manager_name__c("hr_hiring_managername");
ap.setApp_language__c("applanguage");
ap.setHire_start_date__c(fromdate);
ap.setCandidate_first_name__c("candidate_first_name");
ap.setHr_day_1_day__c(fromdate);
ap.setLetter_of_intent_completed_date__c(fromdate);
ap.setLegacy_taleo_shift__c("legacytaleosift");
ap.setConversion__c(true);
ap.setLastmodifieddate(ts);
ap.setLocation_city__c("location_city");
ap.setMatching_location_code__c("matchinglocation_code");
ap.setApplication_withdrawn__c(true);
ap.setHcr_hire_end_date__c(fromdate);
ap.setOwnerid("ownerid");
ap.setTech_force_email_rule_execution__c(true);
ap.setInstance__c("instance");
ap.setRequisition_title__c("requisition_title");
ap.setAppointment_4__c(ts);
ap.setPhone_screen_results__c("phone_screenresults");
ap.setRequisition_location_code__c("requisitionloccode");
ap.setIn_manage_hire__c(true);
ap.setBest_suitable_skill__c("best_suitable_skill");
ap.setHcr_location_country__c("hcr_location_country");
ap.setLegacy_taleo_e_signature_ip__c("legtalsigip");
ap.setIsdeleted(true);
ap.setPortal_application_status__c("portal_application_status");
ap.setBackground_check_counter__c("background_check_counter");
ap.setAccurate_screening_check__c((float) 4.67);
ap.setLegacy_taleo_application_creation_date__c(fromdate);
ap.setCompany_code_ps__c("company_code_ps");
ap.setHcr_request_id__c("hcr_request_id");
ap.setAppointment_3__c(ts);
ap.setLegacy_taleo_correspondence_information__c("legacy_taleocorrespondencenformation");
ap.setRequisition_country__c("requisition_country");
ap.setEmail_notification_body__c("email_notification_body");
ap.setSystemmodstamp(ts);
ap.setDrugtestexpirydate__c(fromdate);
ap.setLastmodifiedbyid("lastmodifiedbyid");
ap.setBypass_dt_bgc_validation__c(true);
ap.setTimeslots_available__c(true);
ap.setApp_scheduling_group__c("app_scheduling_group");
ap.setApp_performance_agency__c("app_performance_agency");
ap.setHcr_department_code__c("hcr_department_code");
ap.setEmail_notification_rich_text_2__c("email_notificationrichtext_2");
ap.setPart_2_completed__c(true);
ap.setConnectionsentid("consentid");
ap.setAppointment_2__c(ts);
ap.setNational_id_type_ps__c("national_id_type_ps");
ap.setRehire_eligibility_audit__c("rehireelbty_audit");
ap.setHcr_number__c("hcr_number");
ap.setShift_comments__c("shift_comments");
ap.setCurrency_ps__c("currency_ps");
ap.setAppointment_1__c(ts);
ap.setLegacy_taleo_hire_end_date__c(fromdate);
ap.setApplication_shift_description__c("applicationsftdescription");
ap.setCandidatesfdcid__c("candidatesfdcid");
ap.setHr_requistion_id__c("hr_requistion_id");
ap.setLastactivitydate(fromdate);
ap.setSpoken_overall__c("spoken_overall");
ap.setPreferred_location_description__c("preferredlocdescription");
ap.setFirst_available_start_date__c(fromdate);
ap.setApp_performance_points__c((float) 4.67);
ap.setHcr_location_state__c("hcr_location_state");
ap.setCurrent_appointment_number__c("current_appointment_number");
ap.setPan_candidate_attempt__c((float) 6.77);
ap.setMost_recent_substep_change_datetime__c(ts);
ap.setTier_3_interview_results__c("tier_3_interview_results");
ap.setPan_package_id_trigger__c("pan_package_id_trigger");
ap.setContract_signer_name_ps__c("contract_signer_name_ps");
ap.setHr_matched__c((float) 7.8);
ap.setApp_languagelocalekey__c("app_languagelocalekey");
ap.setHr_business_title__c("hr_business_title");
ap.setBgc_disclosure__c("bgc_disclosure");
ap.setContingent_offer_accepted__c(ts);
ap.setContingent_offer_shift_code_description__c("contingentoff_code_description");
ap.setHcr_hire_start_date__c(fromdate);
ap.setAgency_source_ps__c("agency_source_ps");
ap.setApp_languagecountrycode__c("applgcountrycode");
ap.setInterview_completed__c("interview_completed");
ap.setTier_1_interview_results__c("tier_1_interview_results");
ap.setLegacy_taleo_scheduling_information__c("legacy_taleoshinformation");
ap.setHcr_location_city__c("hcr_location_city");
ap.setEmail_template_name__c("email_template_name");
ap.setApp_overall_percentile__c((float) 6.7);
ap.setReq_hourly_rate__c("req_hourly_rate");
ap.setOverride_bgc_validation__c(true);
ap.setAppointment_4_interview_results__c("appointment_4_interview_results");
ap.setCreateddate(ts);
ap.setHr_shift_differential__c("hr_shift_differential");
ap.setBackgroundcheckstatus__c("bgcheckstatus");
ap.setSubstep__c("substep");
ap.setDuplicate_contact__c("duplinta");
ap.setEsignaturepart2__c("esignaturepart2");
ap.setApplication_submitted__c(true);
ap.setStock_ps__c("stock_ps");
ap.setOrder_id__c("order_id");
ap.setSuppress_screening_validation__c(true);
ap.setHcr_manager_emp_id__c("hcr_manager_emp_id");
ap.setHire_start_date_ps__c("hire_start_date_ps");
ap.setLegacy_taleo_hours_worked__c((float) 6.7);
ap.setStep__c("step");
ap.setPreferred_last_name_ps__c("preferredlstnameps");
ap.setPaybasis_ps__c("paybasis_ps");
ap.setSource_other__c("source_other");
ap.setDate_component__c("date_component");
ap.setTranslated_requisition_title__c("translated_requisition_title");
ap.setTagged__c(true);
ap.setAppointment_3_interview_results__c("appointmentinterview_results");
ap.setLocation_country__c("location_country");
ap.setInformatica_key__c("informatica_key");
ap.setAppointment_2_interview_results__c("appointmentinterview_results");
ap.setWorkflow_name__c("workflow_name");
ap.setLocation_code_ps__c("location_code_ps");
ap.setOffer_out__c((float) 7.6);
ap.setNo_show_count__c((float) 5.78);
ap.setEsignature_read_general__c("esignature_read_general");
ap.setTranslated_address__c("translated_address");
ap.setNo_show_indicator__c(true);
ap.setMatched_onbase__c("matched_onbase");
ap.setPay_rate_ps__c("pay_rate_ps");
ap.setReq_bypass_scheduling__c(true);
ap.setHr_shift_description__c("hrdescription");
ap.setShift_differential_ps__c("shiftdiff_ps");
ap.setLegacy_taleo_app_interview_info_de__c("legacyapp_intinfo_de");
ap.setPreferred_first_name_ps__c("preferred_first_name_ps");
ap.setAppointment_1_interview_results__c("appointmentinterview_results");
ap.setAppointment_start_time__c(ts);
ap.setLocation_address_line2__c("location_address_line2");
ap.setConnectionreceivedid("conrecid");
ap.setBackground_check_initiation_date__c(fromdate);
ap.setHr_alps_code__c("hr_alps_code");
ap.setLegacy_taleo_orientation_date__c(fromdate);
ap.setApp_my_job_status__c("app_my_job_status");
ap.setApp_performance_pool__c("app_perpool");
ap.setCreatedbyid("createdbyid");
ap.setNationalidcountry__c("nationalidcountry");
ap.setCandidateidsearchsupport__c("candisupport");
ap.setSpecial_skills__c("special_skills");
ap.setApp_performance_counsel__c("app_performance_counsel");
ap.setLegacy_taleo_fclm_job__c("legtaljob");
ap.setIs_node_application__c(true);
ap.setLegacy_taleo_pool__c("A");
ap.setLocation_address_line1__c("location_address_line1");
ap.setTranslated_directions_instructions__c("translateddirinstructions");
ap.setHr_location_description__c("hr_location_description");
ap.setBypassed_cultural_assessment__c(true);
ap.setSubsource_ps__c("subsource_ps");
ap.setAssessmentoverallscore__c("assessmelscore");
ap.setHr_department__c("hr_department");
ap.setAmazon_rejects_detail_picklist__c("amazonamzrejectspicklist");
ap.setMaster_shift_code__c("master_shift_code");
ap.setOperation__c("operation");
ap.setReq_education__c(true);
ap.setSource_ps__c("source_ps");
ap.setRequisition_function_ps__c("requisition_function_ps");
ap.setCreateddateclone__c(ts);
ap.setSubstep_duration__c((float) 5.6);
ap.setLocation_state__c("location_state");
ap.setNationalidtype__c("nationalidtype");
ap.setHcr_finance_week_number__c((float) 6.5);
ap.setAlps_code_description_ps__c("alps_code_description_ps");
ap.setMy_job_status__c("my_job_status");
ap.setLast_modified_date_ps__c("last_modified_date_ps");
ap.setLegacy_taleo_amp_eligibility__c("legacytal_amp_eligibility");
ap.setNumber_of_appointments__c((float) 6.87);
ap.setLastreferenceddate(ts);
ap.setJob_page_label__c("job_page_label");
ap.setActive__c(true);
ap.setMy_job_status_canada__c("my_job_status_canada");
ap.setEmail_notification_prompt_1_text__c("emailnotiprompt_1_text");
ap.setApp_candidate_name__c("app_candidate_name");
ap.setCandidateaccountid__c("cdaccountid");
ap.setHcr_orientation_date__c(fromdate);
ap.setWritten_overall__c("written_overall");
ap.setOrientation_date_ps__c("orientation_date_ps");
ap.setRequisition_type_ps__c("requisitionps");
ap.setHire_end_date_ps__c("hire_end_date_ps");
ap.setLegacy_taleo_step_substep__c("legacy_taleo_step_substep");
ap.setEmail_notification_prompt_datetime__c(ts);
ap.setAgency_name__c("agency_name");
ap.setAlps_code_ps__c("alps_code_ps");
ap.setEmail_notification_prompt_memo__c("email_notificationmemo");
ap.setAgency_req__c(true);
ap.setMatched__c(true);
ap.setFelony_conviction_question_2__c("felony_conviction_question_2");
ap.setPanerrorcount__c((float) 5.66);
ap.setEmail_template_formatted_address_label__c("email_templateaddress_label");
ap.setLegacy_taleo_shift_differential__c("legtashdi");
ap.setAcknowledge_no_attachment_provided__c(true);
ap.setEmail_notification_prompt_2_text__c("email_notification2_text");
ap.setAmzr_error_status__c("amzrstatus");
ap.setSfid("sfid" + i);
ap.setId(Long.valueOf(i));
ap.set_hc_lastop("_hc_lastop");
ap.set_hc_err("_hc_err");
ap.setNode_bgc_bypass_for_hire__c(true);
ap.setInterview_result__c("interview_result");
ap.setHrloggedascanddiate__c(true);
ap.setBgc_california_disclosure_fcra__c(true);
ap.setEmail_notification_prompt_datetime_str__c("emailprompt_datetime_str");
ap.setI9_enabled__c(true);
ap.setBgc_california_disclosure_icraa__c(true);
ap.setVirtual_new_hire_event__c("virtual_new_hire_event");
ap.setSp_q2_first_response__c("sp_q2_first_response");
ap.setIs_papi_enabled__c(true);
ap.setComms_override_nacf_t1_node__c("comms_override_nacf_t1_node");
ap.setCandidate_last_name_kanji__c("candidate_last_name_kanji");
ap.setSp_q1_first_response__c("sp_q1_first_response");
ap.setInclined_value__c("inclined_value");
ap.setNational_id_type__c("national_id_type");
ap.setSp_q3_first_response__c("sp_q3_first_response");
ap.setCandidate_first_name_kanji__c("candidate_first_name_kanji");
lstApl.add(ap);
}
herokuDataDao.insertApplicationData(lstApl);
}
/**
* creating list of Assessment objects
*
* @return void
*/
@Override
public void insertAssessmentData() {
// TODO Auto-generated method stub
List<Assessment> lstAsmt = new ArrayList<Assessment>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Assessment as = new Assessment();
as.setId(Long.valueOf(i));
as.setAssessment_type__c("Asstype" + i);
as.setSfid("sfid" + i);
as.setLastmodifieddate(ts);
as.setReplicate_screening__c("replicate");
as.setParent_screening__c("parents");
as.setLastreferenceddate(ts);
as.setApplication_requisition__c("Applicatrion");
as.setName("Name" + i);
as.setConnectionsentid("consentid" + i);
as.setCandidate__c("candidate"+i);
as.setCreatedbyid("CreatedByid");
as.setExpired_checkbox__c(true);
as.setRecordtypeid("recordtypeid");
as.setConnectionreceivedid("Conreceivedid");
as.setLast_asr_request_date__c(fromdate);
as.setApplication__c("App" + i);
as.setScore_name__c("scorename");
as.setInitiation_date__c(fromdate);
as.setStatus_date__c(fromdate);
as.setIs_international_bgc__c(true);
as.setError_detail_long__c("errordetaillongc" + i);
as.set_hc_lastop("hclasttop" + i);
as.set_hc_err("hcerror" + i);
as.setIsdeleted(true);
as.setApplication_workflow_details__c("appwork" + i);
as.setLegacy_taleo_provider_status__c("legacytaleo");
as.setLegacy_taleo_screening_requester__c("legtalequester");
as.setLastvieweddate(ts);
as.setError_detail__c("errordetailsc" + i);
as.setAccurate_screening_check__c((float) 6.777);
as.setSystemmodstamp(ts);
as.setReceipt_id__c("receiptidc" + i);
as.setExpirationdate__c(fromdate);
as.setOriginal_external_order_id__c("origextrnalord");
as.setX15_day_screening_validator__c(true);
as.setCurrent_pan_score__c("currentpanscore");
as.setOverall_score__c("overall" + i);
as.setUs_candidate__c(true);
as.setInvalidated_screening__c(true);
as.setCreateddate(ts);
as.setOrder_id__c("orderidc" + i);
as.setStatus__c("statusc" + i);
as.setLastmodifiedbyid("lastmodbyid" + i);
as.setScreening_pan_package_id__c("screanpackge");
as.setAdpinitiatescreeningurl__c("adpinreeningurl");
as.setBgc_expire_mismatch__c(true);
as.setAdpscreeningid__c("adpscreeningid" + i);
as.setSection1_complete_dt__c(fromdate);
as.setTerm_date__c(fromdate);
as.setI9_status__c("I9status" + i);
as.setI9_master_status__c("i9masts");
as.setCheck_rehire__c(true);
as.setNo_of_retries__c((float) 6.778);
as.setForm_id__c((float) 7.43);
as.setMaster_status__c("masterstatus");
as.setI9_id_type__c("i9idtype" + i);
as.setPrevious_i9_status_number__c((float) 8.34);
as.setI9_prior_master_status__c("i9prirma");
as.setAirport__c("airport" + i);
as.setI9_id__c((float) 8.45);
as.setI9_complete__c(true);
as.setI9_status_number__c((float) 8.45);
as.setSection3_complete_dt__c(fromdate);
as.setSection2_complete_dt__c(fromdate);
as.setHas_candidate_screenings__c(true);
lstAsmt.add(as);
}
herokuDataDao.insertAssessmentData(lstAsmt);
}
/**
* creating list of EmailMessage objects
*
* @return void
*/
@Override
public void insertEmailMessageData() {
// TODO Auto-generated method stub
List<EmailMessage> lstEmms = new ArrayList<EmailMessage>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
EmailMessage em = new EmailMessage();
em.setLastmodifieddate(ts);
em.setIstracked(true);
em.setHeaders("headers" + i);
em.setThreadidentifier("threa" + i);
em.setActivityid("activityid" + i);
em.setLastopeneddate(ts);
em.setEmailtemplateid("emailtemp" + i);
em.setIsexternallyvisible(true);
em.setIsclientmanaged(true);
em.setFromname("fromname" + i);
em.setHasattachment(true);
em.setFromaddress("fromadd" + i);
em.setCreatedbyid("credbyid" + i);
em.setIsopened(true);
em.setCcaddress("ccadress" + i);
em.setParentid("parentid" + i);
em.setRelatedtoid("reltoid" + i);
em.setStatus("status" + i);
em.setMessagedate(ts);
em.setIsdeleted(true);
em.setIncoming(true);
em.setIsbounced(true);
em.setValidatedfromaddress("valfromadd" + i);
em.setSubject("subject" + i);
em.setSystemmodstamp(ts);
em.setFirstopeneddate(ts);
em.setTextbody("textbody" + i);
em.setReplytoemailmessageid("repemaid" + i);
em.setHtmlbody("htmlbody" + i);
em.setCreateddate(ts);
em.setBccaddress("bccaddr" + i);
em.setMessageidentifier("mesnifier" + i);
em.setLastmodifiedbyid("lastmodbyid" + i);
em.setToaddress("toaddress" + i);
em.setSfid("sfid" + i);
em.setId(Long.valueOf(i));
em.set_hc_lastop("hclast" + i);
em.set_hc_err("hcerror" + i);
lstEmms.add(em);
}
herokuDataDao.insertEmailMessageData(lstEmms);
}
/**
* creating list of Errorlog objects
*
* @return void
*/
@Override
public void insertErrorLogData() {
// TODO Auto-generated method stub
List<ErrorLog> lstErrlog = new ArrayList<ErrorLog>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
ErrorLog el = new ErrorLog();
el.setException_stack_trace__c("Excon" + i);
;
el.setLastmodifieddate(ts);
el.setIsdeleted(true);
el.setException_message__c("excisage" + i);
el.setException_type__c("exptypec" + i);
el.setApex_class_name__c("apexcname" + i);
el.setName("name" + i);
el.setSystemmodstamp(ts);
el.setConnectionsentid("consentid" + i);
el.setOwnerid("ownerid" + i);
el.setCreatedbyid("createdbyid" + i);
el.setCreateddate(ts);
el.setConnectionreceivedid("conrdid" + i);
el.setException_line_number__c((float) 7.6);
el.setLastmodifiedbyid("lastmoedby" + i);
el.setRelated_application__c("App" + i);
el.setSfid("sfid" + i);
el.setId(Long.valueOf(i));
el.set_hc_lastop("hclasttop" + i);
el.set_hc_err("hcerror" + i);
lstErrlog.add(el);
}
herokuDataDao.insertErrorLogData(lstErrlog);
}
/**
* creating list of IntegrationTransaction objects
*
* @return void
*/
@Override
public void insertIntegrationTransactionData() {
// TODO Auto-generated method stub
List<IntegrationTransaction> lstInttrans = new ArrayList<IntegrationTransaction>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
IntegrationTransaction it = new IntegrationTransaction();
it.setLastmodifieddate(ts);
;
it.setTransaction_type__c("trantypec" + i);
it.setLastreferenceddate(ts);
it.setName("name" + i);
it.setConnectionsentid("connsentid" + i);
it.setTransaction_date_ff__c("txndate" + i);
it.setCreatedbyid("createdbyid" + i);
it.setConnectionreceivedid("connrecid" + i);
it.setRequestor_id_ps__c("requs" + i);
it.setNumber_of_attempts__c((float) 6.4);
it.setIt_candidate__c("candidate" + i);
it.setCreation_outside__c(true);
it.setIt_application__c("App" + i);
it.setOutbound_message__c("outboundmsg" + i);
it.setIsdeleted(true);
it.setError_summary__c("errosmary" + i);
it.setIt_screening__c("itscreeningc" + i);
it.setLastvieweddate(ts);
it.setProcessed__c(true);
it.setInbound_message__c("inboundmsg" + i);
it.setSystem__c("systemc" + i);
it.setError_detail__c("errordetails" + i);
it.setSystemmodstamp(ts);
it.setX15_minutes_from_now__c(ts);
it.setTransaction_status__c("trastatus" + i);
it.setCreateddate(ts);
it.setLastactivitydate(fromdate);
it.setEnvironment__c("envientc" + i);
it.setLastmodifiedbyid("lasdbyid" + i);
it.setTransaction_date__c(ts);
it.setSfid("sfid" + i);
it.set_hc_lastop("hclasttop" + i);
it.set_hc_err("hcerror" + i);
it.setNumber_of_noshows__c((float) 6.7);
it.setIs_papi_enabled__c(true);
it.setSystem_path__c("systathc" + i);
it.setSub_status__c("substatus" + i);
it.setId(Long.valueOf(i));
lstInttrans.add(it);
}
herokuDataDao.insertIntegrationTransactionData(lstInttrans);
}
/**
* creating list of Interview objects
*
* @return void
*/
@Override
public void insertInterviewData() {
// TODO Auto-generated method stub
List<Interview> lstInterview = new ArrayList<Interview>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Interview in = new Interview();
in.setLastmodifieddate(ts);
;
in.setAppt_time_zone__c("appt one" + i);
in.setAppt_end_time__c(ts);
in.setSpecial_skills__c("speckills" + i);
in.setName("name" + i);
in.setCandidate__c("candidate" + i);
in.setCreatedbyid("creatbyid" + i);
in.setCandidate_last_name__c("candname" + i);
in.setTimeslot__c("timeslot" + i);
in.setGeneral_notes__c("genralnotes" + i);
in.setRecruiting_event_type__c("reentype" + i);
in.setAppt_start_datetime__c(ts);
in.setIsdeleted(true);
in.setAppt_recruiting_event_link__c("reentlink" + i);
in.setLastvieweddate(ts);
in.setTranslated_address__c("transadd" + i);
in.setRequisition_id__c("requonid" + i);
in.setCreateddate(ts);
in.setAppointment_date__c(fromdate);
in.setAppt_end_time_text__c("aptimetext" + i);
in.setPool_substep__c("poobstep" + i);
in.setActive__c(true);
in.setAppt_timespan_number__c("timespanr" + i);
in.setInterview_type__c("interwtype" + i);
in.setAppt_start_date__c("appttdate" + i);
in.setAppt_requisition_link__c("appqlink" + i);
in.setScheduling_type__c("schuling" + i);
in.setShift_comments__c("shifmments" + i);
in.setInterview_question_set__c("intsset" + i);
in.setEmail_template_name__c("emailtename" + i);
in.setEvent_type__c("eventtype" + i);
in.setLastreferenceddate(ts);
in.setConnectionsentid("connsentid" + i);
in.setAppt_status__c("apptstatus" + i);
in.setCandidate_actual_time_zone__c("candat zone" + i);
in.setCandidate_first_name__c("candfistname" + i);
in.setConnectionreceivedid("conrecid" + i);
in.setAppt_start_time_text__c("apptsttext" + i);
in.setTranslated_directions_instructions__c("tranection " + i);
in.setApplication__c("App" + i);
in.setAppt_end_date__c("appenddate" + i);
in.setInterview_outcome__c("intecome" + i);
in.setRole__c("role" + i);
in.setCandidate_language__c("candluage" + i);
in.setShift__c("shiftc" + i);
in.setSystemmodstamp(ts);
in.setAppt_address__c("apptaddr" + i);
in.setUniqueness_validation_key__c("uniquidation" + i);
in.setAppt_time_zone_key__c("appttimenekey" + i);
in.setAppt_start_time__c(ts);
in.setLastmodifiedbyid("lastfedbyid" + i);
in.setCandidate_email__c("candemail" + i);
in.setInterviewer__c("inteewr" + i);
in.setId(Long.valueOf(i));
in.set_hc_lastop("hclaop" + i);
in.set_hc_err("hcerr" + i);
in.setVirtual_new_hire_event__c("virtnewhire");
in.setCid__c("Cid" + i);
lstInterview.add(in);
}
herokuDataDao.insertInterviewData(lstInterview);
}
/**
* creating list of Note objects
*
* @return void
*/
@Override
public void insertNoteData() {
// TODO Auto-generated method stub
List<Note> lstNotes = new ArrayList<Note>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Note nt = new Note();
nt.setBody("body" + i);
;
nt.setParentid("parentid" + i);
nt.setLastmodifieddate(ts);
nt.setOwnerid("ownerid" + i);
nt.setIsdeleted(true);
nt.setSystemmodstamp(ts);
nt.setLastmodifiedbyid("lasyid" + i);
nt.setCreateddate(ts);
nt.setTitle("title" + i);
nt.setIsprivate(true);
nt.setCreatedbyid("crdbyid" + i);
nt.setSfid("sfid" + i);
nt.setId(Long.valueOf(i));
nt.set_hc_lastop("hclastop" + i);
nt.set_hc_err("hcerror" + i);
lstNotes.add(nt);
}
herokuDataDao.insertNoteData(lstNotes);
}
/**
* creating list of Response objects
*
* @return void
*/
@Override
public void insertResponseData() {
// TODO Auto-generated method stub
List<Response> lstResponse = new ArrayList<Response>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 10; i++) {
Response rs = new Response();
rs.setLastmodifieddate(ts);
;
rs.setQuestion_text__c("questxt" + i);
rs.setDisqualifying_answer__c(true);
rs.setLastreferenceddate(ts);
rs.setInterviewer_comment__c("interment");
rs.setResponse__c("response" + i);
rs.setInterview__c("interviewc" + i);
rs.setName("name" + i);
rs.setConnectionsentid("consentid" + i);
rs.setOwnerid("ownerid" + i);
rs.setCreatedbyid("createdid" + i);
rs.setConnectionreceivedid("coniedid" + i);
rs.setApplication__c("App" + i);
rs.setQuestion__c("Question" + i);
rs.setIsdeleted(true);
rs.setLegacy_taleo_qa_response_identifier__c("legacy" + i);
rs.setLastvieweddate(ts);
rs.setSystemmodstamp(ts);
rs.setMeets_requirements__c("meetsreqmts" + i);
rs.setQuestion_type__c("Questiontypec" + i);
rs.setCompetency__c("competency" + i);
rs.setCreateddate(ts);
rs.setScore__c("score" + i);
rs.setLastmodifiedbyid("lastmodified" + i);
rs.setQuestion_html_type__c("Questionhtml" + i);
rs.setSfid("sfid" + i);
rs.setId(Long.valueOf(i));
rs.set_hc_lastop("hclasttop" + i);
rs.set_hc_err("hcerror" + i);
rs.setRelated_field__c("relatedfield" + i);
lstResponse.add(rs);
}
herokuDataDao.insertResponseData(lstResponse);
}
/**
* creating list of ResponseAnswer objects
*
* @return void
*/
@Override
public void insertResponseAnswerData() {
// TODO Auto-generated method stub
List<ResponseAnswer> lstResponseanswer = new ArrayList<ResponseAnswer>();
Date d = new Date();
java.sql.Date fromdate = new java.sql.Date(d.getTime());
Timestamp ts = new Timestamp(d.getTime());
for (int i = 0; i < 100; i++) {
ResponseAnswer rsa = new ResponseAnswer();
rsa.setLastmodifieddate(ts);
rsa.setIsdeleted(true);
rsa.setAnswer__c("answer" + i);
rsa.setResponse__c("response" + i);
rsa.setName("name" + i);
rsa.setSystemmodstamp(ts);
rsa.setConnectionsentid("consentid" + i);
rsa.setOwnerid("ownerid" + i);
rsa.setCreatedbyid("createdid" + i);
rsa.setCreateddate(ts);
rsa.setConnectionreceivedid("conrviedid" + i);
rsa.setLastmodifiedbyid("lastmedbyyid" + i);
rsa.setSfid("sfid" + i);
rsa.setId(Long.valueOf(i));
rsa.set_hc_lastop("hclasttop" + i);
rsa.set_hc_err("hcerror" + i);
lstResponseanswer.add(rsa);
}
herokuDataDao.insertResponseAnswerData(lstResponseanswer);
}
}
| 34,568 | 0.67765 | 0.67224 | 850 | 38.668236 | 18.142588 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.390588 | false | false | 13 |
2ac9ed623c09a1337bffa79275e863e31fe5e829 | 15,410,342,663,490 | 78a89691ae32f9576143feb561cf127adf7a7a33 | /ksh-api/ksh-sys-api/src/main/java/com/fosung/ksh/sys/client/SysOrgClient.java | c48b9bfb1d406fd160d51fd041ca475351202aaa | [] | no_license | zhenqun/fosung-ksh | https://github.com/zhenqun/fosung-ksh | e1a4aac4f08ab124018fc89548d7dc9c963afec7 | 36027ee33b5d56443aafa2fcfb3a02f7159845c2 | refs/heads/master | 2022-07-10T05:19:44.742000 | 2019-10-21T01:03:56 | 2019-10-21T01:03:56 | 215,750,234 | 0 | 0 | null | false | 2022-06-29T17:43:12 | 2019-10-17T09:10:08 | 2019-10-21T01:08:56 | 2022-06-29T17:43:12 | 448 | 0 | 0 | 3 | Java | false | false | package com.fosung.ksh.sys.client;
import com.fosung.ksh.sys.dto.SysOrg;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
import java.util.List;
@FeignClient(name = "ksh-sys-web", path = "/org")
public interface SysOrgClient {
/**
* 获取当前登录的用户信息
*
* @return
*/
@RequestMapping(value = "get", method = RequestMethod.POST)
public SysOrg getOrgInfo(@RequestParam("orgId") String orgId) ;
/**
* 根据orgId,获取党组织详情
*
* @param orgId
* @return
*/
@RequestMapping(value = "list", method = RequestMethod.POST)
public List<SysOrg> queryOrgInfo(@RequestParam("orgId") String orgId) ;
/**
*
* @param orgId
* @return
*/
@RequestMapping(value = "branch", method = RequestMethod.POST)
public List<SysOrg> branch(@RequestParam("orgId") String orgId) ;
/**
* 根据orgId,获取所有下级党组织ID
*
* @param orgId
* @return
*/
@RequestMapping(value = "all-id-list", method = RequestMethod.POST)
public List<String> queryOrgAllChildId(@RequestParam("orgId") String orgId);
}
| UTF-8 | Java | 1,418 | java | SysOrgClient.java | Java | [] | null | [] | package com.fosung.ksh.sys.client;
import com.fosung.ksh.sys.dto.SysOrg;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.Date;
import java.util.List;
@FeignClient(name = "ksh-sys-web", path = "/org")
public interface SysOrgClient {
/**
* 获取当前登录的用户信息
*
* @return
*/
@RequestMapping(value = "get", method = RequestMethod.POST)
public SysOrg getOrgInfo(@RequestParam("orgId") String orgId) ;
/**
* 根据orgId,获取党组织详情
*
* @param orgId
* @return
*/
@RequestMapping(value = "list", method = RequestMethod.POST)
public List<SysOrg> queryOrgInfo(@RequestParam("orgId") String orgId) ;
/**
*
* @param orgId
* @return
*/
@RequestMapping(value = "branch", method = RequestMethod.POST)
public List<SysOrg> branch(@RequestParam("orgId") String orgId) ;
/**
* 根据orgId,获取所有下级党组织ID
*
* @param orgId
* @return
*/
@RequestMapping(value = "all-id-list", method = RequestMethod.POST)
public List<String> queryOrgAllChildId(@RequestParam("orgId") String orgId);
}
| 1,418 | 0.673077 | 0.673077 | 55 | 23.581818 | 25.435616 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.327273 | false | false | 13 |
8abc6166afca908185ab6972b9a586563e2a173e | 19,146,964,231,406 | a36aa14ccb112724ad083556ded474ddd9838dbf | /src/main/java/br/com/lelo/precos/precocarga/message/PrecoCargaMessageDesserializer.java | d56d7b0a6ee2e792220851d05ed41a1ab2fc54bc | [] | no_license | lelodois/restintegration-carga | https://github.com/lelodois/restintegration-carga | db9199b7f2df618c48f5f4f9a9f2e245fb68d6c0 | 9b78b4af138bbca31c51c27f215341860500f552 | refs/heads/master | 2021-05-09T15:46:52.783000 | 2018-01-26T22:21:27 | 2018-01-26T22:21:27 | 119,099,843 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package br.com.lelo.precos.precocarga.message;
import java.util.Map;
import org.apache.kafka.common.serialization.Deserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import br.com.lelo.precos.precocarga.model.PrecoCarga;
public class PrecoCargaMessageDesserializer implements Deserializer<PrecoCarga> {
private ObjectMapper objectMapper = new ObjectMapper();
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
}
@Override
public PrecoCarga deserialize(String arg0, byte[] arg1) {
try {
return objectMapper.readValue(arg1, PrecoCarga.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void close() {
}
}
| UTF-8 | Java | 704 | java | PrecoCargaMessageDesserializer.java | Java | [] | null | [] | package br.com.lelo.precos.precocarga.message;
import java.util.Map;
import org.apache.kafka.common.serialization.Deserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import br.com.lelo.precos.precocarga.model.PrecoCarga;
public class PrecoCargaMessageDesserializer implements Deserializer<PrecoCarga> {
private ObjectMapper objectMapper = new ObjectMapper();
@Override
public void configure(Map<String, ?> configs, boolean isKey) {
}
@Override
public PrecoCarga deserialize(String arg0, byte[] arg1) {
try {
return objectMapper.readValue(arg1, PrecoCarga.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void close() {
}
}
| 704 | 0.762784 | 0.758523 | 32 | 21 | 25.108515 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.0625 | false | false | 13 |
ee7ecb55a7d358e1999102ce51b6d5268568cacf | 21,234,318,329,459 | 56316833f7c3b5f56f2326947c5b944bf3acf16d | /src/pl/altkom/HelloWorld.java | 6daf1cb1a056ad8ff084918f20b20d3c8374e0e9 | [] | no_license | gchas01/altkom-1 | https://github.com/gchas01/altkom-1 | 135620a77012fbdeaa9d2714fa5cbc3894ff9710 | 3bd0ba6f75a8a7e73d581134dcca13ce34441e1f | refs/heads/master | 2021-01-16T08:55:16.632000 | 2014-07-02T20:06:40 | 2014-07-02T20:06:40 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.altkom;
public class HelloWorld {
public static void main3(String[] args) {
// TODO Auto-generated method stub
System.out.println("hjhjhjhj");
}
}
| UTF-8 | Java | 168 | java | HelloWorld.java | Java | [] | null | [] | package pl.altkom;
public class HelloWorld {
public static void main3(String[] args) {
// TODO Auto-generated method stub
System.out.println("hjhjhjhj");
}
}
| 168 | 0.702381 | 0.696429 | 10 | 15.7 | 16.242229 | 42 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false | 13 |
749553ae23ded71b5e7b152cd629304f47b034bd | 4,200,478,072,545 | 2620dad640ade48cb000dd7d2ab76b2d9444cd09 | /src/main/java/pl/atom/repositories/QuestionAnswerRepository.java | 5b7899ed8c25aaf7751b6968edf238759f795ed2 | [] | no_license | arttom/ankietka-db | https://github.com/arttom/ankietka-db | 611a3e9e1a38a626d0c8c835dd7988f97c50677e | f69616e767ac907ec909039035248a0e07ff7d76 | refs/heads/master | 2020-06-14T20:39:52.289000 | 2017-02-04T09:57:39 | 2017-02-04T09:57:39 | 75,341,168 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package pl.atom.repositories;
import org.springframework.data.repository.CrudRepository;
import pl.atom.entities.QuestionAnswerEntity;
/**
* Created by Atom on 03.12.2016.
*/
public interface QuestionAnswerRepository extends CrudRepository<QuestionAnswerEntity,Long> {
}
| UTF-8 | Java | 275 | java | QuestionAnswerRepository.java | Java | [] | null | [] | package pl.atom.repositories;
import org.springframework.data.repository.CrudRepository;
import pl.atom.entities.QuestionAnswerEntity;
/**
* Created by Atom on 03.12.2016.
*/
public interface QuestionAnswerRepository extends CrudRepository<QuestionAnswerEntity,Long> {
}
| 275 | 0.814545 | 0.785455 | 10 | 26.5 | 29.940775 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false | 13 |
b461fbd45c6c66b5075aae92fa664cdbe90f0d11 | 18,090,402,254,879 | 8a0e3896d5508adfa771c3395f6144a42132ac81 | /src/main/java/org/dynalang/dynalink/ChainedCallSite.java | d9f8f206ac4612c85308186d7afb135522fe4435 | [
"Apache-2.0"
] | permissive | dynjs/dynalink | https://github.com/dynjs/dynalink | c66be01260af25085f8c7be271e39019decb4669 | baac62df0269dd14ec5f0595f8e725128bff3bc1 | refs/heads/master | 2020-04-06T06:50:57.078000 | 2012-10-17T02:52:44 | 2012-11-13T14:37:52 | 6,671,897 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null | package org.dynalang.dynalink;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicReference;
import org.dynalang.dynalink.linker.GuardedInvocation;
import org.dynalang.dynalink.support.AbstractRelinkableCallSite;
/**
* A relinkable call site that maintains a chain of linked method handles. In the default implementation, up to 8 method
* handles can be chained, cascading from one to the other through
* {@link MethodHandles#guardWithTest(MethodHandle, MethodHandle, MethodHandle)}. When this call site has to link a new
* method handle and the length of the chain is already at the maximum, it will throw away the oldest method handle.
* Switchpoint-invalidated handles in the chain are removed eagerly (on each linking request, and whenever a
* switchpoint-invalidated method handle is traversed during invocation). There is currently no profiling
* attached to the handles in the chain, so they are never reordered based on usage; the most recently linked method
* handle is always at the start of the chain.
*/
public class ChainedCallSite extends AbstractRelinkableCallSite {
private final AtomicReference<LinkedList<GuardedInvocation>> invocations = new AtomicReference<>();
/**
* Creates a new chained call site.
* @param descriptor the descriptor for the call site.
*/
public ChainedCallSite(CallSiteDescriptor descriptor) {
super(descriptor);
}
/**
* The maximum number of method handles in the chain. Defaults to 8. You can override it in a subclass if you need
* to change the value. If your override returns a value less than 1, the code will break.
* @return the maximum number of method handles in the chain.
*/
@SuppressWarnings("static-method")
protected int getMaxChainLength() {
return 8;
}
@Override
public void relink(GuardedInvocation guardedInvocation, MethodHandle fallback) {
relinkInternal(guardedInvocation, fallback, false);
}
@Override
public void resetAndRelink(GuardedInvocation guardedInvocation, MethodHandle fallback) {
relinkInternal(guardedInvocation, fallback, true);
}
private MethodHandle relinkInternal(GuardedInvocation invocation, MethodHandle relink, boolean reset) {
final LinkedList<GuardedInvocation> currentInvocations = invocations.get();
@SuppressWarnings({ "unchecked", "rawtypes" })
final LinkedList<GuardedInvocation> newInvocations =
currentInvocations == null || reset ? new LinkedList<>() : (LinkedList)currentInvocations.clone();
// First, prune the chain of invalidated switchpoints.
for(Iterator<GuardedInvocation> it = newInvocations.iterator(); it.hasNext();) {
if(it.next().hasBeenInvalidated()) {
it.remove();
}
}
// prune() is allowed to invoke this method with invocation == null meaning we're just pruning the chain and not
// adding any new invocations to it.
if(invocation != null) {
// Remove oldest entry if we're at max length
if(newInvocations.size() == getMaxChainLength()) {
newInvocations.removeFirst();
}
newInvocations.addLast(invocation);
}
// prune-and-invoke is used as the fallback for invalidated switchpoints. If a switchpoint gets invalidated, we
// rebuild the chain and get rid of all invalidated switchpoints instead of letting them linger.
final MethodHandle pruneAndInvoke = makePruneAndInvokeMethod(relink);
// Fold the new chain
MethodHandle target = relink;
for(GuardedInvocation inv: newInvocations) {
target = inv.compose(pruneAndInvoke, target);
}
// If nobody else updated the call site while we were rebuilding the chain, set the target to our chain. In case
// we lost the race for multithreaded update, just do nothing. Either the other thread installed the same thing
// we wanted to install, or otherwise, we'll be asked to relink again.
if(invocations.compareAndSet(currentInvocations, newInvocations)) {
setTarget(target);
}
return target;
}
/**
* Creates a method that rebuilds our call chain, pruning it of any invalidated switchpoints, and then invokes that
* chain.
* @param relink the ultimate fallback for the chain (the {@code DynamicLinker}'s relink).
* @return a method handle for prune-and-invoke
*/
private MethodHandle makePruneAndInvokeMethod(MethodHandle relink) {
// Bind prune to (this, relink)
final MethodHandle boundPrune = MethodHandles.insertArguments(PRUNE, 0, this, relink);
// Make it ignore all incoming arguments
final MethodHandle ignoreArgsPrune = MethodHandles.dropArguments(boundPrune, 0, type().parameterList());
// Invoke prune, then invoke the call site target with original arguments
return MethodHandles.foldArguments(MethodHandles.exactInvoker(type()), ignoreArgsPrune);
}
@SuppressWarnings("unused")
private MethodHandle prune(MethodHandle relink) {
return relinkInternal(null, relink, false);
}
private static final MethodHandle PRUNE;
static {
try {
PRUNE = MethodHandles.lookup().findSpecial(ChainedCallSite.class, "prune", MethodType.methodType(
MethodHandle.class, MethodHandle.class), ChainedCallSite.class);
// NOTE: using two catch blocks so we don't introduce a reference to 1.7 ReflectiveOperationException, allowing
// Dynalink to be used on 1.6 JVMs with Remi's backport library.
} catch(IllegalAccessException e) {
throw new AssertionError(e.getMessage(), e); // Can not happen
} catch(NoSuchMethodException e) {
throw new AssertionError(e.getMessage(), e); // Can not happen
}
}
} | UTF-8 | Java | 6,093 | java | ChainedCallSite.java | Java | [] | null | [] | package org.dynalang.dynalink;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicReference;
import org.dynalang.dynalink.linker.GuardedInvocation;
import org.dynalang.dynalink.support.AbstractRelinkableCallSite;
/**
* A relinkable call site that maintains a chain of linked method handles. In the default implementation, up to 8 method
* handles can be chained, cascading from one to the other through
* {@link MethodHandles#guardWithTest(MethodHandle, MethodHandle, MethodHandle)}. When this call site has to link a new
* method handle and the length of the chain is already at the maximum, it will throw away the oldest method handle.
* Switchpoint-invalidated handles in the chain are removed eagerly (on each linking request, and whenever a
* switchpoint-invalidated method handle is traversed during invocation). There is currently no profiling
* attached to the handles in the chain, so they are never reordered based on usage; the most recently linked method
* handle is always at the start of the chain.
*/
public class ChainedCallSite extends AbstractRelinkableCallSite {
private final AtomicReference<LinkedList<GuardedInvocation>> invocations = new AtomicReference<>();
/**
* Creates a new chained call site.
* @param descriptor the descriptor for the call site.
*/
public ChainedCallSite(CallSiteDescriptor descriptor) {
super(descriptor);
}
/**
* The maximum number of method handles in the chain. Defaults to 8. You can override it in a subclass if you need
* to change the value. If your override returns a value less than 1, the code will break.
* @return the maximum number of method handles in the chain.
*/
@SuppressWarnings("static-method")
protected int getMaxChainLength() {
return 8;
}
@Override
public void relink(GuardedInvocation guardedInvocation, MethodHandle fallback) {
relinkInternal(guardedInvocation, fallback, false);
}
@Override
public void resetAndRelink(GuardedInvocation guardedInvocation, MethodHandle fallback) {
relinkInternal(guardedInvocation, fallback, true);
}
private MethodHandle relinkInternal(GuardedInvocation invocation, MethodHandle relink, boolean reset) {
final LinkedList<GuardedInvocation> currentInvocations = invocations.get();
@SuppressWarnings({ "unchecked", "rawtypes" })
final LinkedList<GuardedInvocation> newInvocations =
currentInvocations == null || reset ? new LinkedList<>() : (LinkedList)currentInvocations.clone();
// First, prune the chain of invalidated switchpoints.
for(Iterator<GuardedInvocation> it = newInvocations.iterator(); it.hasNext();) {
if(it.next().hasBeenInvalidated()) {
it.remove();
}
}
// prune() is allowed to invoke this method with invocation == null meaning we're just pruning the chain and not
// adding any new invocations to it.
if(invocation != null) {
// Remove oldest entry if we're at max length
if(newInvocations.size() == getMaxChainLength()) {
newInvocations.removeFirst();
}
newInvocations.addLast(invocation);
}
// prune-and-invoke is used as the fallback for invalidated switchpoints. If a switchpoint gets invalidated, we
// rebuild the chain and get rid of all invalidated switchpoints instead of letting them linger.
final MethodHandle pruneAndInvoke = makePruneAndInvokeMethod(relink);
// Fold the new chain
MethodHandle target = relink;
for(GuardedInvocation inv: newInvocations) {
target = inv.compose(pruneAndInvoke, target);
}
// If nobody else updated the call site while we were rebuilding the chain, set the target to our chain. In case
// we lost the race for multithreaded update, just do nothing. Either the other thread installed the same thing
// we wanted to install, or otherwise, we'll be asked to relink again.
if(invocations.compareAndSet(currentInvocations, newInvocations)) {
setTarget(target);
}
return target;
}
/**
* Creates a method that rebuilds our call chain, pruning it of any invalidated switchpoints, and then invokes that
* chain.
* @param relink the ultimate fallback for the chain (the {@code DynamicLinker}'s relink).
* @return a method handle for prune-and-invoke
*/
private MethodHandle makePruneAndInvokeMethod(MethodHandle relink) {
// Bind prune to (this, relink)
final MethodHandle boundPrune = MethodHandles.insertArguments(PRUNE, 0, this, relink);
// Make it ignore all incoming arguments
final MethodHandle ignoreArgsPrune = MethodHandles.dropArguments(boundPrune, 0, type().parameterList());
// Invoke prune, then invoke the call site target with original arguments
return MethodHandles.foldArguments(MethodHandles.exactInvoker(type()), ignoreArgsPrune);
}
@SuppressWarnings("unused")
private MethodHandle prune(MethodHandle relink) {
return relinkInternal(null, relink, false);
}
private static final MethodHandle PRUNE;
static {
try {
PRUNE = MethodHandles.lookup().findSpecial(ChainedCallSite.class, "prune", MethodType.methodType(
MethodHandle.class, MethodHandle.class), ChainedCallSite.class);
// NOTE: using two catch blocks so we don't introduce a reference to 1.7 ReflectiveOperationException, allowing
// Dynalink to be used on 1.6 JVMs with Remi's backport library.
} catch(IllegalAccessException e) {
throw new AssertionError(e.getMessage(), e); // Can not happen
} catch(NoSuchMethodException e) {
throw new AssertionError(e.getMessage(), e); // Can not happen
}
}
} | 6,093 | 0.700804 | 0.699163 | 129 | 46.240311 | 39.111801 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.627907 | false | false | 13 |
d2457f03713e5e6c98068d10797f37963a2228da | 24,567,212,941,466 | 2f5dc139866bb99027c892f45c73d9aaaab7e931 | /src/edu/ozu/cs576/phsico/test/Admin.java | 6e4f27129506bb799e0cb0fa29ecb00e9ded471e | [] | no_license | oxcafebabe2020/java-seleniumtest | https://github.com/oxcafebabe2020/java-seleniumtest | 4c644b0954e04f7e8596a858368b75a968f41b55 | 174c9fbad390bb397adfc16cd163c0d6069b50d8 | refs/heads/master | 2022-09-09T02:04:42.945000 | 2020-05-28T18:57:41 | 2020-05-28T18:57:41 | 266,792,957 | 0 | 1 | null | true | 2020-05-25T13:57:40 | 2020-05-25T13:57:39 | 2020-05-25T13:57:35 | 2020-05-25T12:31:08 | 27,572 | 0 | 0 | 0 | null | false | false | package edu.ozu.cs576.phsico.test;
import org.openqa.selenium.WebDriver;
/***
*
* purpose: bu class admin neleri yapabilir onlari listeler.
*
*/
public class Admin implements ITest {
@Override
public void run(WebDriver driver) {
// TODO Auto-generated method stub
System.out.println("Admin page test automation");
}
}
| UTF-8 | Java | 352 | java | Admin.java | Java | [] | null | [] | package edu.ozu.cs576.phsico.test;
import org.openqa.selenium.WebDriver;
/***
*
* purpose: bu class admin neleri yapabilir onlari listeler.
*
*/
public class Admin implements ITest {
@Override
public void run(WebDriver driver) {
// TODO Auto-generated method stub
System.out.println("Admin page test automation");
}
}
| 352 | 0.684659 | 0.676136 | 18 | 17.555555 | 20.11418 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.