blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7619e7fb6ec588107dc20e878a2bccc49a235e97 | 104cda8eafe0617e2a5fa1e2b9f242d78370521b | /aliyun-java-sdk-sddp/src/main/java/com/aliyuncs/sddp/model/v20190103/CreateUserAuthResponse.java | 1b115e41bfeb0aa5e4a3e5a75443328a7c83e0b7 | [
"Apache-2.0"
] | permissive | SanthosheG/aliyun-openapi-java-sdk | 89f9b245c1bcdff8dac0866c36ff9a261aa40684 | 38a910b1a7f4bdb1b0dd29601a1450efb1220f79 | refs/heads/master | 2020-07-24T00:00:59.491294 | 2019-09-09T23:00:27 | 2019-09-11T04:29:56 | 207,744,099 | 2 | 0 | NOASSERTION | 2019-09-11T06:55:58 | 2019-09-11T06:55:58 | null | UTF-8 | Java | false | false | 1,321 | java | /*
* 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.aliyuncs.sddp.model.v20190103;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.sddp.transform.v20190103.CreateUserAuthResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class CreateUserAuthResponse extends AcsResponse {
private String requestId;
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
@Override
public CreateUserAuthResponse getInstance(UnmarshallerContext context) {
return CreateUserAuthResponseUnmarshaller.unmarshall(this, context);
}
@Override
public boolean checkShowJsonItemName() {
return false;
}
}
| [
"[email protected]"
] | |
86829839aa7985d5de32cc29c8c4b39ce5e1c4f5 | 18d0ecb2abc02d7c4ca400668ab6ba6118cb3c9b | /Protium/src/main/java/net/protium/core/modules/management/ModuleClassLoader.java | fae1e7b992848d6ad157e8bce9caba242b0c6b8b | [
"Apache-2.0",
"BSD-2-Clause"
] | permissive | ruslanjan/Protium | f55cb43304795839966a3b7ccbe46d7f24fb149f | 25f49f827c50d92c05b4e1c726d02be65af097f0 | refs/heads/master | 2020-03-09T05:06:51.858053 | 2018-04-08T06:13:13 | 2018-04-08T06:13:13 | 128,604,438 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,312 | java | /*
* Copyright (C) 2017 - Protium - Ussoltsev Dmitry, Jankurazov Ruslan - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
*/
package net.protium.core.modules.management;
import net.protium.api.utils.Constant;
import net.protium.api.utils.Functions;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.*;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
@SuppressWarnings("Duplicates")
class ModuleClassLoader extends ClassLoader {
private static final Logger logger = Logger.getLogger(ClassLoader.class.getName());
private final String[] modules;
private final ClassLoader parent;
ModuleClassLoader(ClassLoader parent, String[] modules) {
try {
logger.addHandler((new FileHandler(
Functions.createFile(Constant.LOG_DIR, this.getClass().getName(), Constant.LOG_EXT))));
} catch (IOException e) {
logger.log(Level.SEVERE, "Failed to write logs", e);
}
this.parent = parent;
this.modules = modules.clone();
}
private static String loadPackage(Class c) {
String[] data = c.getName().split("\\.");
data = Arrays.copyOf(data, data.length - 1);
return Functions.implode(data, ".");
}
@Override
public Class loadClass(String name) throws ClassNotFoundException {
try {
Class c = findLoadedClass(name);
return (c != null) ? c : parent.loadClass(name);
} catch (ClassNotFoundException ignored) {
String path = name.replace('.', '/') + ".class";
for (String module : modules) {
URL url;
try {
url = new URL("jar:file:" + module + "!/" + path);
} catch (MalformedURLException e) {
logger.log(Level.SEVERE, "Failed to open url: " + "jar:file:" + Constant.MOD_DIR + module + "!/" + path, e);
continue;
}
try {
URLConnection connection = url.openConnection();
InputStream input = connection.getInputStream();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int data;
data = input.read();
while (data != -1) {
buffer.write(data);
data = input.read();
}
input.close();
byte[] classData = buffer.toByteArray();
Class c = defineClass(name,
classData, 0, classData.length);
String pkgName = loadPackage(c);
if (getPackage(pkgName) == null) {
definePackage(
pkgName,
"", "", "",
"", "", "",
null);
}
return c;
} catch (IOException ignored1) {
}
}
}
return null;
}
@Override
protected URL findResource(String name) {
for (String module : modules) {
URL url;
try {
url = new URL("jar:file:" + module + "!/" + name);
} catch (MalformedURLException e) {
logger.log(Level.SEVERE, "Failed to open url: " + "jar:file:" + Constant.MOD_DIR + module + "!/" + name, e);
continue;
}
try {
URLConnection connection = url.openConnection();
InputStream inputStream = connection.getInputStream();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int data;
data = inputStream.read();
while (data != -1) {
buffer.write(data);
data = inputStream.read();
}
inputStream.close();
} catch (IOException e) {
continue;
}
return url;
}
return null;
}
@Override
protected Enumeration < URL > findResources(String name) {
List < URL > urls = new ArrayList <>();
for (String module : modules) {
URL url;
try {
url = new URL("jar:file:" + module + "!/" + name);
} catch (MalformedURLException e) {
logger.log(Level.SEVERE, "Failed to open url: " + "jar:file:" + Constant.MOD_DIR + module + "!/" + name, e);
continue;
}
try {
URLConnection connection = url.openConnection();
InputStream inputStream = connection.getInputStream();
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int data;
data = inputStream.read();
while (data != -1) {
buffer.write(data);
data = inputStream.read();
}
inputStream.close();
} catch (IOException e) {
continue;
}
urls.add(url);
}
return Collections.enumeration(urls);
}
}
| [
"[email protected]"
] | |
200a7c6d18758e98e6ae6d4b4a46c24a1f84ab04 | 944ebb7c41b63ffa7086b37e646805ef883a3d08 | /src/org/rayoub/exo19/Employee.java | fc8a4f37e6f34ec42b163dafde21556dc514ae2d | [] | no_license | Rayanou/tp-a-rendre | 76a1b70a9a5acd04d24054bff51a61549df52f75 | de8d1211671c8ca30f99b598406df178384eafd2 | refs/heads/master | 2023-04-02T19:49:51.012592 | 2021-04-13T10:27:05 | 2021-04-13T10:27:05 | 343,237,875 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,269 | java | /* Ayoub TAIHI + Rayane CHIKHI
21-03-2021 */
package org.rayoub.exo19;
import java.util.Comparator;
public class Employee {
/** Membres attributs de "Employee" **/
private String firstName;
private String lastName;
private int age;
/** Getters et setters **/
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
/** Constructeur de "Employee" **/
/* public Person(String firstName, String lastName, int age) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.age = age;
}
*/
@Override
public String toString() {
return "Person [firstName=" + firstName + ", lastName=" + lastName + ", age=" + age + "]";
}
public static Comparator<Person> ComparatorLastName = new Comparator<Person>() {
@Override
public int compare(Person p1, Person p2) {
return p1.getLastName().compareTo(p2.getLastName());
}
};
}
| [
"[email protected]"
] | |
48172e8125ae6b8a593e57d25661c41bd7487872 | ff56b880e3ff94b6e8a8c4c4d9d05e7a31a60409 | /src/pointsandlines/TwoPoints.java | f9b218a143ea63ee305af14ab49b0a81cd34351a | [] | no_license | Matthew-Wroblewski/BridgeScene | 72f1718db8e9c9982c47d188a771086d595402c8 | 0c5a7a9f51c0a4ab7270bda1b48eba78387038c9 | refs/heads/master | 2021-01-20T06:22:59.718153 | 2017-07-12T04:37:13 | 2017-07-12T04:37:13 | 89,871,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package pointsandlines;
import util.annotations.StructurePattern;
import util.annotations.StructurePatternNames;
@StructurePattern(StructurePatternNames.LINE_PATTERN)
public interface TwoPoints{
public PolarCordLine getRightSide();
public PolarCordLine getLeftSide();
public void setX(int x);
public int getY();
public int getX();
public void setY(int y);
}
| [
"[email protected]"
] | |
804e0d50ec2e11a69053da779282537b1f35d6e3 | ee63930722137539e989a36cdc7a3ac235ca1932 | /app/src/main/java/com/yksj/consultation/sonDoc/consultation/main/AccountList.java | f1e80cda2714a542806d6f095e14a2db73c9dff2 | [] | no_license | 13525846841/SixOneD | 3189a075ba58e11eedf2d56dc4592f5082649c0b | 199809593df44a7b8e2485ca7d2bd476f8faf43a | refs/heads/master | 2020-05-22T07:21:27.829669 | 2019-06-05T09:59:58 | 2019-06-05T09:59:58 | 186,261,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,984 | java | package com.yksj.consultation.sonDoc.consultation.main;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.RelativeLayout;
import com.library.base.base.BaseTitleActivity;
import com.yksj.consultation.adapter.BillAdapper;
import com.yksj.consultation.sonDoc.R;
import com.yksj.consultation.utils.DoctorHelper;
import com.yksj.healthtalk.net.http.ApiService;
import com.yksj.healthtalk.net.http.ApiCallbackWrapper;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 账单明细
*/
public class AccountList extends BaseTitleActivity implements View.OnClickListener {
private ListView mListView;
public BillAdapper adapter;
private List<JSONObject> mList = new ArrayList<>();
private RelativeLayout mEmptyView;
@Override
public int createLayoutRes() {
return R.layout.activity_account_list;
}
@Override
public void initialize(Bundle bundle) {
super.initialize(bundle);
setTitle("账单明细");
initView();
}
private void initView() {
mListView = (ListView) findViewById(R.id.account_lv);
adapter = new BillAdapper(mList,this);
mListView.setAdapter(adapter);
mEmptyView = (RelativeLayout) findViewById(R.id.load_faile_layout);
initData();
}
private String customer_id = DoctorHelper.getId();
private void initData() {
Map<String,String> map=new HashMap<>();
map.put("CUSTOMERID", customer_id);//customer_id//116305
map.put("PAGENUM", "1");
map.put("PAGECOUNT", "5");
ApiService.OKHttpACCOUNTCHANGE(map,new ApiCallbackWrapper<String>(this){
@Override
public void onResponse(String content) {
super.onResponse(content);
try {
JSONObject obj = new JSONObject(content);
if ("1".equals(obj.optString("code"))) {
JSONArray array = obj.getJSONArray("result");
mList = new ArrayList<JSONObject>();
for (int i = 0; i < array.length(); i++) {
JSONObject jsonobject = array.getJSONObject(i);
mList.add(jsonobject);
}
}
adapter.onBoundData(mList);
if (mList.size()==0){
mEmptyView.setVisibility(View.VISIBLE);
mListView.setVisibility(View.GONE);
}else {
mEmptyView.setVisibility(View.GONE);
mListView.setVisibility(View.VISIBLE);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},this);
}
}
| [
"[email protected]"
] | |
3f4a05c4786363ea2b53b18ba8ceeb9e54ea3193 | e1af7696101f8f9eb12c0791c211e27b4310ecbc | /MCP/src/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java | fee00d3f98a17f322e4d33211272db70bc61761b | [] | no_license | VinmaniaTV/Mania-Client | e36810590edf09b1d78b8eeaf5cbc46bb3e2d8ce | 7a12b8bad1a8199151b3f913581775f50cc4c39c | refs/heads/main | 2023-02-12T10:31:29.076263 | 2021-01-13T02:29:35 | 2021-01-13T02:29:35 | 329,156,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,100 | java | package net.minecraft.client.renderer.chunk;
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.primitives.Doubles;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListenableFutureTask;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.List;
import java.util.Queue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.ThreadFactory;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RegionRenderCacheBuilder;
import net.minecraft.client.renderer.VertexBufferUploader;
import net.minecraft.client.renderer.WorldVertexBufferUploader;
import net.minecraft.client.renderer.vertex.VertexBuffer;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.MathHelper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ChunkRenderDispatcher
{
private static final Logger LOGGER = LogManager.getLogger();
private static final ThreadFactory THREAD_FACTORY = (new ThreadFactoryBuilder()).setNameFormat("Chunk Batcher %d").setDaemon(true).build();
private final int countRenderBuilders;
private final List<Thread> listWorkerThreads;
private final List<ChunkRenderWorker> listThreadedWorkers;
private final PriorityBlockingQueue<ChunkCompileTaskGenerator> queueChunkUpdates;
private final BlockingQueue<RegionRenderCacheBuilder> queueFreeRenderBuilders;
private final WorldVertexBufferUploader worldVertexUploader;
private final VertexBufferUploader vertexUploader;
private final Queue<ChunkRenderDispatcher.PendingUpload> queueChunkUploads;
private final ChunkRenderWorker renderWorker;
public ChunkRenderDispatcher()
{
this(-1);
}
public ChunkRenderDispatcher(int p_i7_1_)
{
this.listWorkerThreads = Lists.<Thread>newArrayList();
this.listThreadedWorkers = Lists.<ChunkRenderWorker>newArrayList();
this.queueChunkUpdates = Queues.<ChunkCompileTaskGenerator>newPriorityBlockingQueue();
this.worldVertexUploader = new WorldVertexBufferUploader();
this.vertexUploader = new VertexBufferUploader();
this.queueChunkUploads = Queues.<ChunkRenderDispatcher.PendingUpload>newPriorityQueue();
int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760);
int j = Math.max(1, MathHelper.clamp(Runtime.getRuntime().availableProcessors(), 1, i / 5));
if (p_i7_1_ < 0)
{
this.countRenderBuilders = MathHelper.clamp(j, 1, i);
}
else
{
this.countRenderBuilders = p_i7_1_;
}
if (j > 1)
{
for (int k = 0; k < j; ++k)
{
ChunkRenderWorker chunkrenderworker = new ChunkRenderWorker(this);
Thread thread = THREAD_FACTORY.newThread(chunkrenderworker);
thread.start();
this.listThreadedWorkers.add(chunkrenderworker);
this.listWorkerThreads.add(thread);
}
}
this.queueFreeRenderBuilders = Queues.<RegionRenderCacheBuilder>newArrayBlockingQueue(this.countRenderBuilders);
for (int l = 0; l < this.countRenderBuilders; ++l)
{
this.queueFreeRenderBuilders.add(new RegionRenderCacheBuilder());
}
this.renderWorker = new ChunkRenderWorker(this, new RegionRenderCacheBuilder());
}
public String getDebugInfo()
{
return this.listWorkerThreads.isEmpty() ? String.format("pC: %03d, single-threaded", this.queueChunkUpdates.size()) : String.format("pC: %03d, pU: %1d, aB: %1d", this.queueChunkUpdates.size(), this.queueChunkUploads.size(), this.queueFreeRenderBuilders.size());
}
public boolean runChunkUploads(long p_178516_1_)
{
boolean flag = false;
while (true)
{
boolean flag1 = false;
if (this.listWorkerThreads.isEmpty())
{
ChunkCompileTaskGenerator chunkcompiletaskgenerator = this.queueChunkUpdates.poll();
if (chunkcompiletaskgenerator != null)
{
try
{
this.renderWorker.processTask(chunkcompiletaskgenerator);
flag1 = true;
}
catch (InterruptedException var8)
{
LOGGER.warn("Skipped task due to interrupt");
}
}
}
synchronized (this.queueChunkUploads)
{
if (!this.queueChunkUploads.isEmpty())
{
(this.queueChunkUploads.poll()).uploadTask.run();
flag1 = true;
flag = true;
}
}
if (p_178516_1_ == 0L || !flag1 || p_178516_1_ < System.nanoTime())
{
break;
}
}
return flag;
}
public boolean updateChunkLater(RenderChunk chunkRenderer)
{
chunkRenderer.getLockCompileTask().lock();
boolean flag;
try
{
final ChunkCompileTaskGenerator chunkcompiletaskgenerator = chunkRenderer.makeCompileTaskChunk();
chunkcompiletaskgenerator.addFinishRunnable(new Runnable()
{
public void run()
{
ChunkRenderDispatcher.this.queueChunkUpdates.remove(chunkcompiletaskgenerator);
}
});
boolean flag1 = this.queueChunkUpdates.offer(chunkcompiletaskgenerator);
if (!flag1)
{
chunkcompiletaskgenerator.finish();
}
flag = flag1;
}
finally
{
chunkRenderer.getLockCompileTask().unlock();
}
return flag;
}
public boolean updateChunkNow(RenderChunk chunkRenderer)
{
chunkRenderer.getLockCompileTask().lock();
boolean flag;
try
{
ChunkCompileTaskGenerator chunkcompiletaskgenerator = chunkRenderer.makeCompileTaskChunk();
try
{
this.renderWorker.processTask(chunkcompiletaskgenerator);
}
catch (InterruptedException var8)
{
;
}
flag = true;
}
finally
{
chunkRenderer.getLockCompileTask().unlock();
}
return flag;
}
public void stopChunkUpdates()
{
this.clearChunkUpdates();
List<RegionRenderCacheBuilder> list = Lists.<RegionRenderCacheBuilder>newArrayList();
while (list.size() != this.countRenderBuilders)
{
this.runChunkUploads(Long.MAX_VALUE);
try
{
list.add(this.allocateRenderBuilder());
}
catch (InterruptedException var3)
{
;
}
}
this.queueFreeRenderBuilders.addAll(list);
}
public void freeRenderBuilder(RegionRenderCacheBuilder p_178512_1_)
{
this.queueFreeRenderBuilders.add(p_178512_1_);
}
public RegionRenderCacheBuilder allocateRenderBuilder() throws InterruptedException
{
return this.queueFreeRenderBuilders.take();
}
public ChunkCompileTaskGenerator getNextChunkUpdate() throws InterruptedException
{
return this.queueChunkUpdates.take();
}
public boolean updateTransparencyLater(RenderChunk chunkRenderer)
{
chunkRenderer.getLockCompileTask().lock();
boolean flag1;
try
{
final ChunkCompileTaskGenerator chunkcompiletaskgenerator = chunkRenderer.makeCompileTaskTransparency();
if (chunkcompiletaskgenerator != null)
{
chunkcompiletaskgenerator.addFinishRunnable(new Runnable()
{
public void run()
{
ChunkRenderDispatcher.this.queueChunkUpdates.remove(chunkcompiletaskgenerator);
}
});
boolean flag2 = this.queueChunkUpdates.offer(chunkcompiletaskgenerator);
return flag2;
}
boolean flag = true;
flag1 = flag;
}
finally
{
chunkRenderer.getLockCompileTask().unlock();
}
return flag1;
}
public ListenableFuture<Object> uploadChunk(final BlockRenderLayer p_188245_1_, final BufferBuilder p_188245_2_, final RenderChunk p_188245_3_, final CompiledChunk p_188245_4_, final double p_188245_5_)
{
if (Minecraft.getMinecraft().isCallingFromMinecraftThread())
{
if (OpenGlHelper.useVbo())
{
this.uploadVertexBuffer(p_188245_2_, p_188245_3_.getVertexBufferByLayer(p_188245_1_.ordinal()));
}
else
{
this.uploadDisplayList(p_188245_2_, ((ListedRenderChunk)p_188245_3_).getDisplayList(p_188245_1_, p_188245_4_), p_188245_3_);
}
p_188245_2_.setTranslation(0.0D, 0.0D, 0.0D);
return Futures.<Object>immediateFuture((Object)null);
}
else
{
ListenableFutureTask<Object> listenablefuturetask = ListenableFutureTask.<Object>create(new Runnable()
{
public void run()
{
ChunkRenderDispatcher.this.uploadChunk(p_188245_1_, p_188245_2_, p_188245_3_, p_188245_4_, p_188245_5_);
}
}, (Object)null);
synchronized (this.queueChunkUploads)
{
this.queueChunkUploads.add(new ChunkRenderDispatcher.PendingUpload(listenablefuturetask, p_188245_5_));
return listenablefuturetask;
}
}
}
private void uploadDisplayList(BufferBuilder p_178510_1_, int p_178510_2_, RenderChunk chunkRenderer)
{
GlStateManager.glNewList(p_178510_2_, 4864);
GlStateManager.pushMatrix();
chunkRenderer.multModelviewMatrix();
this.worldVertexUploader.draw(p_178510_1_);
GlStateManager.popMatrix();
GlStateManager.glEndList();
}
private void uploadVertexBuffer(BufferBuilder p_178506_1_, VertexBuffer vertexBufferIn)
{
this.vertexUploader.setVertexBuffer(vertexBufferIn);
this.vertexUploader.draw(p_178506_1_);
}
public void clearChunkUpdates()
{
while (!this.queueChunkUpdates.isEmpty())
{
ChunkCompileTaskGenerator chunkcompiletaskgenerator = this.queueChunkUpdates.poll();
if (chunkcompiletaskgenerator != null)
{
chunkcompiletaskgenerator.finish();
}
}
}
public boolean hasChunkUpdates()
{
return this.queueChunkUpdates.isEmpty() && this.queueChunkUploads.isEmpty();
}
public void stopWorkerThreads()
{
this.clearChunkUpdates();
for (ChunkRenderWorker chunkrenderworker : this.listThreadedWorkers)
{
chunkrenderworker.notifyToStop();
}
for (Thread thread : this.listWorkerThreads)
{
try
{
thread.interrupt();
thread.join();
}
catch (InterruptedException interruptedexception)
{
LOGGER.warn("Interrupted whilst waiting for worker to die", (Throwable)interruptedexception);
}
}
this.queueFreeRenderBuilders.clear();
}
public boolean hasNoFreeRenderBuilders()
{
return this.queueFreeRenderBuilders.isEmpty();
}
class PendingUpload implements Comparable<ChunkRenderDispatcher.PendingUpload>
{
private final ListenableFutureTask<Object> uploadTask;
private final double distanceSq;
public PendingUpload(ListenableFutureTask<Object> p_i46994_2_, double p_i46994_3_)
{
this.uploadTask = p_i46994_2_;
this.distanceSq = p_i46994_3_;
}
public int compareTo(ChunkRenderDispatcher.PendingUpload p_compareTo_1_)
{
return Doubles.compare(this.distanceSq, p_compareTo_1_.distanceSq);
}
}
}
| [
"[email protected]"
] | |
aed4be7954c3c7d4128086f037046f277a05b99d | 3a2bf821a1a7b09917cd5cf2758fa00d723b91f0 | /app/src/main/java/com/bawei/myshopcar/Constants.java | b6ab916b5ad1fdc4be95ef0032adfca26efb9df5 | [] | no_license | Yuanlllll/MyShopCar | d334f027681b55311e6ef85053aa1ef4a1e1cabd | c98e49d6556bd889aad6f8c641707f224ac123d9 | refs/heads/master | 2020-04-17T13:18:21.422032 | 2019-01-20T01:04:10 | 2019-01-20T01:04:10 | 166,609,880 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 193 | java | package com.bawei.myshopcar;
public class Constants {
public static final String MAP_KEY_GET_PRODUCT_UID= "uid";
public static final String MAP_KEY_PRODUCT_GET_CATAGORY_CID= "cid";
}
| [
"[email protected]"
] | |
e8d33134636e1f3c571b3ed7dd4655fe8550df60 | 5d96c975ffbef0bf7e7958bfd37626bd20f51534 | /app/src/main/java/com/lgmember/impl/ScoresImpl.java | 70bec483e27b082bf6d81dc8e12934c2f850d4c7 | [] | no_license | jixiaonanzhuaizhuai/LGmember | a849ab70261cf1381456c932fb6ac399a193c385 | db68a1ba3fea7135007984e89d2a4bcfd39e70b7 | refs/heads/master | 2021-01-13T05:46:03.667052 | 2017-04-17T11:24:31 | 2017-04-17T11:24:35 | 76,851,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,019 | java | package com.lgmember.impl;
import android.content.Context;
import android.util.Log;
import com.lgmember.api.HttpApi;
import com.lgmember.bean.HistoryScoresBean;
import com.lgmember.business.score.HistoryScoresBusiness;
import com.lgmember.business.score.ScoresRuleBusiness;
import com.lgmember.util.Common;
import com.lgmember.util.JsonUtil;
import com.tsy.sdk.myokhttp.MyOkHttp;
import com.tsy.sdk.myokhttp.response.JsonResponseHandler;
import org.json.JSONException;
import org.json.JSONObject;
public class ScoresImpl extends HttpApi {
public void getScoresRule(final ScoresRuleBusiness.ScoresRuleHandler handler, Context context){
//判断没有网络应该如何处理
if (!app.isNetWorkEnable(context)) {
handler.onNetworkDisconnect();
}
MyOkHttp mMyOkhttp = new MyOkHttp(okHttpClient());
mMyOkhttp.post()
.url(Common.URL_SCORES_RULE)
.tag(this)
.enqueue(new JsonResponseHandler() {
@Override
public void onSuccess(int statusCode, JSONObject response) {
handler.onSuccess(response);
}
@Override
public void onFailure(int statusCode, String error_msg) {
handler.onFailed(statusCode,error_msg);
}
});
}
public void getScoresInfo(final ScoresRuleBusiness.ScoresRuleHandler handler, Context context){
//判断没有网络应该如何处理
if (!app.isNetWorkEnable(context)) {
handler.onNetworkDisconnect();
}
MyOkHttp mMyOkhttp = new MyOkHttp(okHttpClient());
mMyOkhttp.post()
.url(Common.URL_SCORES_INFORMATION)
.tag(this)
.enqueue(new JsonResponseHandler() {
@Override
public void onSuccess(int statusCode, JSONObject response) {
//Log.i("----999333----",response.toString());
handler.onSuccess(response);
}
@Override
public void onFailure(int statusCode, String error_msg) {
//Log.i("----666----",statusCode+error_msg);
handler.onFailed(statusCode,error_msg);
}
});
}
public void getHistoryScores(int pageNo, int pageSize, final HistoryScoresBusiness.HistoryScoresResultHandler handler, Context context){
//判断没有网络应该如何处理
if (!app.isNetWorkEnable(context)) {
handler.onNetworkDisconnect();
}
//http post的json数据格式: {"name": "****","pwd": "******"}
final JSONObject jsonObject = new JSONObject();
;
try {
jsonObject.put("pageNo", 1);
jsonObject.put("pageSize", 10);
} catch (JSONException e) {
e.printStackTrace();
}
MyOkHttp mMyOkhttp = new MyOkHttp(okHttpClient());
mMyOkhttp.post()
.url(Common.URL_HISTORY_SCORES)
.jsonParams(jsonObject.toString())
.tag(this)
.enqueue(new JsonResponseHandler() {
@Override
public void onSuccess(int statusCode, JSONObject response) {
HistoryScoresBean historyScoresBean = JsonUtil.parseHistoryScoresResult(response);
if (historyScoresBean.getCode() == 0){
Log.i("------87346767----",historyScoresBean.getHistoryScoresList().toString());
handler.onHisSuccess(historyScoresBean);
}
}
@Override
public void onFailure(int statusCode, String error_msg) {
handler.onFailed(statusCode,error_msg);
}
});
}
}
| [
"[email protected]"
] | |
ed2846a6ed4f421a7f37761eafd31e4c963df934 | 9b03b308536bdafadd482db7c558bd754307f599 | /Task25/app/src/main/java/com/david/www/task2_5/BootCompleteReceiver.java | ef1046db4c8233420f65a4a9e8ba10c3e6f7db5c | [] | no_license | zx1001011/AndroidPractice | 1b2d16761aa1a6aecd0645dc7a75030a1c6c21c6 | 121a2a4c4143f411f49b92c80e1c32add67f14f9 | refs/heads/master | 2020-04-09T21:49:28.512786 | 2018-12-10T10:42:56 | 2018-12-10T10:42:56 | 160,613,407 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | java | package com.david.www.task2_5;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
public class BootCompleteReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Boot Complete", Toast.LENGTH_LONG).show();
}
}
| [
"[email protected]"
] | |
4ecc8313296d0c9103670cbff970adfb0e1c35cf | aae27533dc945ba2fb4dc05c6470f17a19f24e76 | /src/test/java/be/multimedi/orders/products/ProductTest.java | 41fb3cc329f8fffa18c1e7c31fdd40e05be2d89d | [] | no_license | NickyMultimedi/Orders | 22695650a2616d9c52f1d18f4014723c2f8e9a4e | 2041810859160836bd04696e642e756196967187 | refs/heads/master | 2020-07-09T16:28:40.580341 | 2019-08-23T15:15:33 | 2019-08-23T15:15:33 | 204,022,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,260 | java | package be.multimedi.orders.products;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;
import org.junit.jupiter.params.provider.CsvSource;
import static org.junit.jupiter.api.Assertions.*;
class ProductTest {
private Product product;
private Product productFactory(int i) {
switch (i) {
case 1:
return new Hammer();
case 2:
return new Drill();
case 3:
return new Saw();
default:
return null;
}
}
@BeforeEach
public void init() {
product = new Hammer();
}
@ParameterizedTest
@CsvSource({"1","2","3"})
//TODO werk met Class<? ext Product> product, en geef een csv lijst mee van de te testen klassen. Dan is een factory niet nodig.
void testStockDecrease(int impl) {
product = productFactory(impl);
product.increaseStock(5);
assertEquals(product.getStock(), 5);
}
@AfterEach
public void destroy() {
product = null;
}
} | [
"[email protected]"
] | |
c79c1fc8bb45bf73d62568fe5155e7820f760143 | 3cef17a4e137d1fc969f20739dde7e6064cf3b38 | /app/src/main/java/com/uagrm/emprendecruz/easymarket/LoginActivity.java | f49744cf08c9728d2876e37468fc52ddecdc8eb3 | [] | no_license | hugo2425/EasyMarket | c50d0368c503645ae818b27fbf4f0e772b134f89 | 3da854800ecc39336921c59737b6ad90ddf75e4e | refs/heads/master | 2021-01-13T10:58:26.659134 | 2016-12-22T21:03:58 | 2016-12-22T21:03:58 | 77,170,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,441 | java | package com.uagrm.emprendecruz.easymarket;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.login.LoginResult;
import com.facebook.login.widget.LoginButton;
import com.loopj.android.http.AsyncHttpClient;
import com.loopj.android.http.AsyncHttpResponseHandler;
import com.uagrm.emprendecruz.easymarket.utils.Enviador;
import org.json.JSONArray;
import org.json.JSONException;
import cz.msebera.android.httpclient.Header;
/**
* Created by Cosio on 20/10/2016.
*/
public class LoginActivity extends AppCompatActivity {
EditText etUser, etPassword;
Button btIngresar;
String idEnviador;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login_repartidor);
etUser = (EditText)findViewById(R.id.et_user_login);
etPassword = (EditText)findViewById(R.id.et_password_login);
btIngresar = (Button)findViewById(R.id.bt_ingresar_login);
btIngresar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(!etUser.getText().toString().isEmpty()) {
if (!etPassword.getText().toString().isEmpty()) {
VerificarDatos(etUser.getText().toString(), etPassword.getText().toString());
}else {
Toast.makeText(getApplicationContext(), "Ingrese su Password", Toast.LENGTH_SHORT).show();
}
}else{
Toast.makeText(getApplicationContext(), "Ingrese su Usuario", Toast.LENGTH_SHORT).show();
}
}
});
}
public void VerificarDatos(String correo, String passw){
final ProgressDialog progresdialog=new ProgressDialog(this);
progresdialog.setTitle("Verificando Usuario ...");
progresdialog.show();
AsyncHttpClient client=new AsyncHttpClient();
boolean b = false;
//+"&contrasena="+passw+""
client.get("http://54.201.162.73/EasyMarket2/enviador.php?correo="+correo, new AsyncHttpResponseHandler() {
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
Enviador enviador = new Enviador();
if (statusCode==200){
progresdialog.dismiss();
try{
JSONArray jsonarray=new JSONArray(new String(responseBody));
if (jsonarray.isNull(0)){
Toast.makeText(getApplicationContext(),"Usuario o Contraseña Incorrecta" ,Toast.LENGTH_SHORT).show();
return;
}else{
enviador.setIdEnviador(jsonarray.getJSONObject(0).getString("idEnviador"));
idEnviador = jsonarray.getJSONObject(0).getString("idEnviador");
enviador.setNombre(jsonarray.getJSONObject(0).getString("nombre"));
enviador.setImgEnv(jsonarray.getJSONObject(0).getString("imgEnv"));
enviador.setCorreo(jsonarray.getJSONObject(0).getString("correo"));
enviador.setContrasena(jsonarray.getJSONObject(0).getString("contrasena"));
Toast.makeText(getApplicationContext(),"Sesion correcta" ,Toast.LENGTH_SHORT).show();
iniciarActividad();
}
}catch (JSONException e){
e.printStackTrace();
}
}
}
@Override
public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
}
});
}
private void iniciarActividad() {
Intent i = new Intent(getApplicationContext(), ListPedidosActivity.class);
i.putExtra("idEnviador", idEnviador);
startActivity(i);
}
}
| [
"[email protected]"
] | |
930771f3f9258f1fb411d4662b0b8bc8630c2fc7 | 95bfd224f56a47d30ff12cb7a2ef0c04cbc00f72 | /app/src/main/java/com/example/itutor/main/tools/SearchTutorAdapter.java | ebcd965f2872cfa113f4be9f8a81cc4c8690331b | [] | no_license | RahulDMello/ITutor-COMP231_Project | 962fbe5012d3f6292011fb9106612b5de35d8696 | 702ec2623876ce559ae4e6a66a194e729586d465 | refs/heads/master | 2022-04-16T20:33:17.693266 | 2020-04-15T08:50:58 | 2020-04-15T08:50:58 | 171,338,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,785 | java | package com.example.itutor.main.tools;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.itutor.main.R;
import com.example.itutor.main.model.TutorProfile;
import java.util.List;
public class SearchTutorAdapter extends RecyclerView.Adapter<SearchTutorAdapter.ViewHolder> {
public TextView tutorName;
private List<TutorProfile> tutorProfiles;
private LaunchTutorProfileListener listener;
public SearchTutorAdapter(LaunchTutorProfileListener listener, List<TutorProfile> tutorProfiles) {
this.listener = listener;
this.tutorProfiles = tutorProfiles;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_tutor_holder, viewGroup, false));
}
@Override
public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) {
tutorName.setText(String.format("%s %s", tutorProfiles.get(i).getFirstName(), tutorProfiles.get(i).getLastName()));
tutorName.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
listener.launchTutorProfile(tutorProfiles.get(i).getId());
}
});
}
@Override
public int getItemCount() {
return tutorProfiles.size();
}
public class ViewHolder extends RecyclerView.ViewHolder {
public ViewHolder(@NonNull View itemView) {
super(itemView);
tutorName = itemView.findViewById(R.id.tutorName);
}
}
}
| [
"[email protected]"
] | |
c1c393e01f330aa81975cda322303dfc9065ff59 | 5c3e96b4691a5d407b4ea9d6298d31277531d6c5 | /qtz_sm_service_impl/src/main/java/com/qtz/sm/goods/dao/impl/GdGoodsSkuDaoImpl.java | d6e8d4d301970314ac45326cfb241a99585fab2a | [] | no_license | zhangguangxi/qtz_sm | 05c8ba3ceb1d8d1bd3472b47f3f4800342dff729 | e43e04a7e0de32fc2a9a092d7b3bf9c1804ee7dd | refs/heads/master | 2021-01-20T19:26:36.516049 | 2016-07-20T17:17:43 | 2016-07-20T17:17:43 | 63,799,863 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package com.qtz.sm.goods.dao.impl;
import org.springframework.stereotype.Repository;
import com.mall.core.dao.impl.MyBaitsDaoImpl;
import com.qtz.sm.goods.dao.GdGoodsSkuDao;
import com.qtz.sm.goods.vo.GdGoodsSku;
/**
* <p>Title:GdGoodsSkuDaoImpl</p>
* <p>Description:商品SKUDAO实现类</p>
* <p>Copyright: Copyright (c) 2016</p>
* <p>Company: 深圳市擎天柱信息科技有限公司</p>
* @author 谭林清 - [email protected]
* @version v1.0 2016-04-18
*/
@Repository("gdGoodsSkuDaoImpl")
public class GdGoodsSkuDaoImpl extends MyBaitsDaoImpl<GdGoodsSku,java.lang.Long> implements GdGoodsSkuDao {
/**MYBatis命名空间名*/
private static String preName = GdGoodsSkuDao.class.getName();
/**
* 【取得】MYBatis命名空间名
* @return MYBatis命名空间名
*/
@Override
protected String getPreName() {
return preName;
}
} | [
"[email protected]"
] | |
1c16b30ef203e9e8be14b1b79cc795be3567aa68 | 6d7f20fb5f69570b2c69d618eeb940519ef6351f | /learnWeb/src/com/sxt/inter/ILdSaleProxyMembers.java | b499712318b9c6ef5fcb4bf1bf0973fa5030e0c0 | [
"Apache-2.0"
] | permissive | ZYongF/web | 083f654e30ee624020d26361013e62b2ada9509c | f2d015faf2a2d2f712d9f0abb22b3808beefd8f3 | refs/heads/master | 2021-01-18T21:31:32.720986 | 2016-10-29T10:43:51 | 2016-10-29T10:43:51 | 72,278,717 | 0 | 0 | null | 2016-10-29T10:43:53 | 2016-10-29T10:32:19 | Java | UTF-8 | Java | false | false | 1,166 | java | package com.sxt.inter;
import java.util.List;
import com.sxt.models.LdSaleProxyMembers;
import java.util.Map;
public interface ILdSaleProxyMembers {
/**
* 添加一个代销商家用户,并且给它分配ID
* @param ldSaleProxyMembers
* @return 影响行数
*/
public int insert(LdSaleProxyMembers ldSaleProxyMembers);
/**
* 编辑代销商家用户
* @param ldSaleProxyMembers
* @return 影响行数
*/
public int update(LdSaleProxyMembers ldSaleProxyMembers);
/**
* 根据ID删除代销商家用户
* @param id
* @return 影响行数
*/
public int delete(Long id);
/**
* 根据条件查询List代销商家用户
* @param maps
* @return
*/
public List<LdSaleProxyMembers> queryLdSaleProxyMembersList(Map<String, Object> params);
/**
* 根据条件查询代销商家用户
* @param ldSaleProxyMembers
* @return
*/
public LdSaleProxyMembers queryLdSaleProxyMembersByCondition(LdSaleProxyMembers ldSaleProxyMembers);
/**
* 根据条件查询代销商家用户总个数
* @param ldSaleProxyMembers
* @return
*/
public int queryLdSaleProxyMembersCount(LdSaleProxyMembers ldSaleProxyMembers);
}
| [
"[email protected]"
] | |
c8d173214d29ee752345b5452b386c274d65208d | e80c98cb01ec399f9591bae8bd0f0146a6dd8dc3 | /varsql-web/src/main/java/com/varsql/web/model/converter/DomainMapperImpl.java | 71d87071b6eecadf390fda540c25381792b42713 | [] | no_license | pencake-squad/varsql | e1de151d7a24bf36e1a41f7b195a96aca31df600 | 4aeec201e4dd2e68513886328f9069509664b023 | refs/heads/master | 2022-12-26T01:33:44.954011 | 2020-10-11T14:25:29 | 2020-10-11T14:25:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 800 | java | package com.varsql.web.model.converter;
import org.modelmapper.ModelMapper;
import org.modelmapper.config.Configuration.AccessLevel;
import org.springframework.stereotype.Component;
@Component
public class DomainMapperImpl implements DomainMapper{
private ModelMapper modelMapper;
public DomainMapperImpl(ModelMapper modelMapper) {
this.modelMapper=modelMapper;
this.modelMapper.getConfiguration()
.setFieldMatchingEnabled(true)
.setFieldAccessLevel(AccessLevel.PRIVATE)
.setMethodAccessLevel(AccessLevel.PRIVATE);
}
/*
* 공통 매퍼
*/
@Override
public <D, E> D convertToDomain(E source, Class<? extends D> classLiteral) {
return modelMapper.map(source, classLiteral);
}
}
| [
"0skym@ytkim"
] | 0skym@ytkim |
1178a3d6e1013a39b8d3ac197236cc2115e06907 | 6375c4b56ad2f898c43adb04982576c70c9c8314 | /DataStructures/Node.java | 1e5cb8c067c19634310bdbaf93397007b9c120b2 | [] | no_license | CarlosOriol3/Data-Structures-And-Algorithms-Java | 800890ec2f286eb423b2d35e79f821753e6b0751 | 7af6e44a9b092c93d74919ffd5e0c1e495ab4980 | refs/heads/master | 2022-12-11T11:20:14.558264 | 2020-08-26T04:41:16 | 2020-08-26T04:41:16 | 286,786,404 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 175 | java | package DataStructures;
public class Node<T> {
public T value;
public Node<T> next;
Node(T value) {
this.value = value;
this.next = null;
}
} | [
"[email protected]"
] | |
fc73d58b662af0e07749b074aa8b330b4d8d7ce9 | 846f5eb98d3a801fdaaa229bb2e894edabdc9dbe | /common/DifferentOperations.java | 73cbce7c245473ebc23e4b760e9eed27217b90aa | [] | no_license | DKUMAR196/BRP_BootCamp-Home | d45bd92238eb70a652653144eb51d0805948fd68 | e71cf6818bb1f7febeabd0e77eff46adcde02d50 | refs/heads/main | 2023-08-31T04:54:37.725630 | 2021-10-23T15:10:08 | 2021-10-23T15:10:08 | 403,708,476 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 850 | java | package com.bridgelabz.program.common;
interface Operation
{
int a = 50;
int b = 30;
void add(int a, int b);
void sub(int a, int b);
}
public class DifferentOperations implements Operation {
// public void add()
// {
// System.out.println("Addition of "+a+" and "+b+" is: "+(a+b));
// }
//
// public void sub()
// {
// System.out.println("Subtraction of "+a+" and "+b+" is: "+(a-b));
// }
//
public static void main(String[] args) {
DifferentOperations op = new DifferentOperations();
op.add(a,b);
op.sub(a,b);
}
@Override
public void add(int a, int b) {
System.out.println("addition of "+a+" and "+b+" is :"+(a+b));
}
@Override
public void sub(int a, int b) {
System.out.println("Subtraction of "+a+" and "+b+" is :"+(a-b));
}
}
| [
"[email protected]"
] | |
2365b10fb1ef341fed527d932c48a9131ccdf034 | 59ef9de182c850c36384529366cada845423d4e4 | /src/util/StringUtil.java | 9175c1640e678feaaff828338f89dcd350c8126a | [] | no_license | Mahitha1467/AGoldenCrown | 996d6eb3b5f43a507f4c8c3d2f73bb095ee29c96 | ef3cdf41f0f09e803bbc765c412f40b0325cee2a | refs/heads/master | 2020-04-16T10:07:10.071402 | 2019-01-13T11:17:20 | 2019-01-13T11:17:20 | 165,491,568 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,180 | java | package util;
import java.util.HashSet;
import java.util.Set;
public class StringUtil {
public static final int ZERO = 0;
public static final int ONE = 1;
private static final String EMPTY_STRING = "";
public static int getFrequencyOfChar(String string, Character character) {
int frequency = ZERO;
string = string.toLowerCase();
char lowerCaseChar = Character.toLowerCase(character);
while(string.length() > ZERO) {
int firstIndex = string.indexOf(lowerCaseChar);
int lastIndex = string.lastIndexOf(lowerCaseChar);
if(firstIndex >= ZERO) {
frequency++;
}
if(firstIndex >= ZERO && lastIndex != firstIndex) {
frequency++;
string = string.substring(firstIndex + 1, lastIndex);
} else {
string = "";
}
}
return frequency;
}
public static Set<Character> getUniqueCharsIgnoreCase(String string) {
String lowerCaseString = string.toLowerCase();
int length = lowerCaseString.length();
Set<Character> unique = new HashSet<>();
for(int i = 0; i< length; i++) {
unique.add(lowerCaseString.charAt(i));
}
return unique;
}
public static String getCapitalize(String string) {
if(string == null || EMPTY_STRING.equals(string)) {
return EMPTY_STRING;
}
char firstCharToUpperCase = Character.toUpperCase(string.charAt(ZERO));
StringBuilder stringBuilder = new StringBuilder(string);
return stringBuilder.replace(ZERO, ZERO + ONE, Character.toString(firstCharToUpperCase)).toString();
}
public static String removeFirstAndLastChars(String string) {
if(string == null || EMPTY_STRING.equals(string) || string.length() < 2) {
return EMPTY_STRING;
}
StringBuilder stringBuilder = new StringBuilder(string);
return stringBuilder
.replace(ZERO, ZERO + ONE, "")
.replace(stringBuilder.length() - ONE, stringBuilder.length(), "")
.toString();
}
}
| [
"[email protected]"
] | |
e04f6c269505f164e7b6aab3a30ca94486580882 | 563e8db7dba0131fb362d8fb77a852cae8ff4485 | /Blagosfera/core/src/main/java/ru/askor/blagosfera/domain/events/user/FeedbackAcceptedEvent.java | bc6742d109cf976f81fb3bacfeb3bfb61bcdf93c | [] | no_license | askor2005/blagosfera | 13bd28dcaab70f6c7d6623f8408384bdf337fd21 | c6cf8f1f7094ac7ccae3220ad6518343515231d0 | refs/heads/master | 2021-01-17T18:05:08.934188 | 2016-10-14T16:53:38 | 2016-10-14T16:53:48 | 70,894,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java | package ru.askor.blagosfera.domain.events.user;
import lombok.Getter;
import ru.askor.blagosfera.domain.events.BlagosferaEvent;
import ru.askor.blagosfera.domain.invite.Invitation;
import ru.askor.blagosfera.domain.support.SupportRequest;
import ru.askor.blagosfera.domain.user.User;
import java.util.List;
/**
* Created by vtarasenko on 18.05.2016.
*/
@Getter
public class FeedbackAcceptedEvent extends BlagosferaEvent {
private final User receiver;
private SupportRequest supportRequest;
private List<User> adminReceivers;
public FeedbackAcceptedEvent(Object source, User receiver,List<User> adminReceivers,SupportRequest supportRequest) {
super(source);
this.adminReceivers = adminReceivers;
this.receiver = receiver;
this.supportRequest = supportRequest;
}
}
| [
"[email protected]"
] | |
5782abe4ed71094aed4104b7497e42b35de10233 | e998709b14a24ccde483f904e93d574d64817289 | /mysql-binlog-expose/src/main/java/com/github/q742972035/mysql/binlog/expose/build/mysql/exception/TableColumnNonUniqueException.java | ee82bbfc0db3735ace27c418765c69f21d77c240 | [] | no_license | q742972035/mysql-binlog | a046c21cf77708ac36ae4d0938a965b24900fdd4 | 1490e669bd88dc922f08e62977e2e0c5163c92b3 | refs/heads/master | 2022-08-08T15:37:49.809541 | 2019-12-08T03:22:11 | 2019-12-08T03:22:11 | 220,354,788 | 0 | 0 | null | 2022-06-21T02:14:27 | 2019-11-08T00:33:03 | Java | UTF-8 | Java | false | false | 283 | java | package com.github.q742972035.mysql.binlog.expose.build.mysql.exception;
/**
* TableColumn的type不唯一异常
* @program: mysql-binlog-incr-expose
* @description
* @author: zy
* @create: 2019-08-19 16:30
**/
public class TableColumnNonUniqueException extends Exception {
}
| [
"zhangyi"
] | zhangyi |
ac44da85fdbdd6cac0aff0bf3f11e1c023c7ee37 | 35d03e3eaf0b9eec6ebfb1cade021b88c589f630 | /src/com/fee/service/StudentService.java | 8df6c558ac2e3b1c2c062f6c055d30137e54172c | [] | no_license | Thirupathi-Reddy/FeeStructuredemo | 8f8d15971391d0a884d920e04a60ef82ea502252 | 989dfc67161697dc571b1c15d2956161b411d6ec | refs/heads/master | 2021-01-19T03:24:31.441353 | 2016-07-09T06:08:39 | 2016-07-09T06:08:39 | 62,934,619 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | /**
*
*/
package com.fee.service;
import java.util.List;
import com.fee.domain.Student;
import com.fee.domain.StudentFee;
/**
* @author KARUN
*
*/
public interface StudentService {
public int checkLogin(String username, String password);
public boolean saveStudent(Student student);
public List<Student> getList();
public Student getRowById(int studentid);
public int updateRow(Student student);
public boolean saveStudentFee(StudentFee studentfee);
}
| [
"[email protected]"
] | |
a0f6599efd308898f97a86ea11fd338994781f4a | 85c848d08204d3ff5efb3ab7e62ed859f64ceb04 | /src/main/java/entity/CourseBean.java | 6cbf58efe0948165c182ac6c14e1ab4e0856f9d8 | [] | no_license | fdmooc/fdmooc | cc717d6edc3b92d83150699e411c6766e51a8f82 | e58e7af1aa71d5aaeebf0dfb39b67860908d8643 | refs/heads/master | 2020-03-23T15:09:25.668287 | 2018-08-02T15:04:55 | 2018-08-02T15:04:55 | 141,726,397 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,438 | java | package entity;
public class CourseBean {
private String cid;
private String title;
private String teacher_uid;
private String pic_url;
private String content;
public CourseBean() {
}
public CourseBean(String cid, String title, String teacher_uid, String pic_url, String content) {
this.cid = cid;
this.title = title;
this.teacher_uid = teacher_uid;
this.pic_url = pic_url;
this.content = content;
}
public CourseBean(String title, String teacher_uid, String pic_url, String content) {
this.title = title;
this.teacher_uid = teacher_uid;
this.pic_url = pic_url;
this.content = content;
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTeacher_uid() {
return teacher_uid;
}
public void setTeacher_uid(String teacher_uid) {
this.teacher_uid = teacher_uid;
}
public String getPic_url() {
return pic_url;
}
public void setPic_url(String pic_url) {
this.pic_url = pic_url;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
| [
"[email protected]"
] | |
f27118ca5c8e2fc1a0084b2b8fa418ac0602228d | e9896512fc98d0614bedae02e17b58010b500d32 | /discourse.parser.parent/discourse.conll.dataset/src/test/java/test/dkpro/PennTreeBankReader.java | 575851c47297f6fb8d8a02dac0f5ec5cd51340e6 | [
"BSD-2-Clause-Views"
] | permissive | mjlaali/CLaCDiscourseParser | 8c7b7d2988b8e2f6604c0a641215cc15d0931f82 | cc840de13d1df9294dd471050dfbfbbb4220ba0b | refs/heads/master | 2020-04-15T23:46:55.878280 | 2019-02-24T20:01:59 | 2019-02-24T20:01:59 | 35,230,582 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,503 | java | package test.dkpro;
import java.util.Collection;
import org.apache.uima.UIMAException;
import org.apache.uima.fit.factory.JCasFactory;
import org.apache.uima.fit.util.JCasUtil;
import org.apache.uima.jcas.JCas;
import org.junit.Test;
import de.tudarmstadt.ukp.dkpro.core.api.resources.MappingProvider;
import de.tudarmstadt.ukp.dkpro.core.api.resources.MappingProviderFactory;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;
import de.tudarmstadt.ukp.dkpro.core.api.syntax.type.constituent.Constituent;
import de.tudarmstadt.ukp.dkpro.core.io.penntree.PennTreeNode;
import de.tudarmstadt.ukp.dkpro.core.io.penntree.PennTreeToJCasConverter;
import de.tudarmstadt.ukp.dkpro.core.io.penntree.PennTreeUtils;
public class PennTreeBankReader {
private PennTreeToJCasConverter converter;
@Test
public void whenReadingPennTreeBankStringThenAnnotationsAreSetCorrectly() throws UIMAException{
MappingProvider posMappingProvider = MappingProviderFactory.createPosMappingProvider(null, null, "en");
MappingProvider constituentMappingProvider = MappingProviderFactory.createConstituentMappingProvider(null, null, "en");
converter = new PennTreeToJCasConverter(
posMappingProvider,
constituentMappingProvider);
String pennTree = "(TOP (S (NP (NN it)) (VP (VBZ is) (NP (DT a) (NN test))) (. .)))";
String text = "it is a test .";
PennTreeNode root = PennTreeUtils.parsePennTree(pennTree);
JCas jcas = JCasFactory.createJCas();
posMappingProvider.configure(jcas.getCas());
constituentMappingProvider.configure(jcas.getCas());
// StringBuilder sb = new StringBuilder();
converter.setCreatePosTags(true);
// converter.convertPennTree(jcas, sb, root);
jcas.setDocumentText(text);
Sentence sent = new Sentence(jcas, 0, text.length());
sent.addToIndexes();
int start = 0;
for (String token: text.split(" ")){
new Token(jcas, start, start + token.length()).addToIndexes();
start += token.length() + 1;
}
converter.convertPennTree(sent, root);
jcas.setDocumentLanguage("en");
Collection<Constituent> select = JCasUtil.select(jcas, Constituent.class);
System.out.println(select.size());
for (Constituent constituent: select){
System.out.println(constituent.getConstituentType() + ": " + constituent.getCoveredText());
}
}
}
| [
"[email protected]"
] | |
c3c12d7006e61589ec1fb707c06efec151aa6c1a | 80b22d814d3bfff2584b2061cb45d08f7047fcf2 | /src/WildcardMatching/Solution.java | a7640d3eb1d50ed1f327b4eaded1daf92507dea1 | [] | no_license | nicppa/LeetcodePractice | fbb7dcd626617fb4fb356d1cd04a9a760212ce9c | daca90baa8497aaa171e208da0f8ddeeab169437 | refs/heads/master | 2021-09-13T19:30:13.498845 | 2018-05-03T13:54:45 | 2018-05-03T13:54:45 | 115,917,748 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,668 | java | package WildcardMatching;
public class Solution {
// public boolean isMatch(String s, String p) {
// boolean[][] matchs = new boolean[s.length()+1][p.length()+1];
// matchs[s.length()][p.length()] = true;
// for(int i = p.length() - 1;i >= 0;i--){
// if(p.charAt(i) != '*' ){
// break;
// }else{
// matchs[s.length()][i] = true;
// }
// }
// for(int i = s.length() - 1;i >= 0;i-- ){
// for(int j = p.length() - 1 ; j >= 0;j--){
// if(s.charAt(i)==p.charAt(j)||p.charAt(j)=='?'){
// matchs[i][j] = matchs[i+1][j+1];
// }else if(p.charAt(j)=='*'){
// matchs[i][j] = matchs[i+1][j]||matchs[i][j+1];
// }else{
// matchs[i][j] = false;
// }
// }
// }
// return matchs[0][0];
// }
public boolean isMatch(String str, String pattern) {
int s = 0,p = 0,match = 0,starIdx = -1;
while(s < str.length()){
if( p < pattern.length() &&(pattern.charAt(p)=='?'||pattern.charAt(p)==str.charAt(s))){
s++;
p++;
}else if(p < pattern.length() && pattern.charAt(p)=='*') {
starIdx = p;
match = s;
p++;
}else if(starIdx != -1){
p = starIdx + 1;
match++;
s = match;
}else
return false;
}
while( p < pattern.length() && pattern.charAt(p) == '*')
p++;
return p==pattern.length();
}
}
| [
"[email protected]"
] | |
6eb179ba9acedd49dc5b454baa328537dd7f764c | 147885d7eb4527c20b561af7d1dc0b38312bc39f | /src/test/java/lense/sdk/math/TestWhole.java | f57e253249d282296754d9d1a8143629e0edc857 | [] | no_license | sergiotaborda/lense-lang | 931d5afd81df307f81e5770f5f8a3cbbab800f23 | 472c4fc038f3c1fb3514c56f7ec77bfaa279560e | refs/heads/master | 2023-01-31T06:12:16.812809 | 2023-01-05T17:55:12 | 2023-01-05T17:55:12 | 44,053,128 | 2 | 0 | null | 2023-01-05T17:55:13 | 2015-10-11T13:29:13 | Java | UTF-8 | Java | false | false | 6,098 | java | package lense.sdk.math;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import lense.core.lang.java.NativeString;
import lense.core.math.Int32;
import lense.core.math.Int64;
import lense.core.math.Integer;
import lense.core.math.Natural;
import lense.core.math.Natural64;
import lense.core.math.Whole;
public class TestWhole {
@Test
public void testPositive() {
Whole n = Natural64.valueOfNative(4);
Whole k = Natural64.valueOfNative(40);
//
// assertEquals( Natural.valueOfNative(44), n.plus(k));
// assertEquals( Natural.valueOfNative(44), k.plus(n));
Whole maxInt = Natural64.valueOfNative(java.lang.Integer.MAX_VALUE);
// assertEquals( Natural.valueOfNative((long)java.lang.Integer.MAX_VALUE + 4), n.plus(maxInt));
// assertEquals( Natural.valueOfNative((long)java.lang.Integer.MAX_VALUE + 4), maxInt.plus(n));
Whole maxLong = Natural64.valueOfNative(Long.MAX_VALUE);
// assertEquals( Natural.valueOf(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(4))), n.plus(maxLong));
// assertEquals( Natural.valueOf(BigInteger.valueOf(Long.MAX_VALUE).add(BigInteger.valueOf(4))), maxLong.plus(n));
//
Whole w = Natural.parse(NativeString.valueOfNative("345"));
assertTrue( w instanceof Natural64);
Whole maxULong = Natural.parse(NativeString.valueOfNative("18446744073709551615"));
Whole maxULongPlus4 = Natural.parse(NativeString.valueOfNative("18446744073709551619"));
assertEquals( maxULongPlus4, n.plus(maxULong));
assertEquals( maxULongPlus4, maxULong.plus(n));
//
// assertEquals( maxULongPlus4, maxULong.successor().successor().successor().successor());
}
@Test
public void testInteger() {
Whole n = Int32.valueOfNative(-4);
Whole k = Natural64.valueOfNative(40);
// assertEquals( Natural.valueOfNative(36), n.plus(k));
// assertEquals( Natural.valueOfNative(36), k.plus(n));
Whole maxInt = Natural64.valueOfNative(java.lang.Integer.MAX_VALUE);
// assertEquals( Natural.valueOfNative((long)java.lang.Integer.MAX_VALUE - 4), n.plus(maxInt));
// assertEquals( Natural.valueOfNative((long)java.lang.Integer.MAX_VALUE - 4), maxInt.plus(n));
Whole maxLong = Natural64.valueOfNative(Long.MAX_VALUE);
// assertEquals( Natural.valueOf(BigInteger.valueOf(Long.MAX_VALUE).subtract(BigInteger.valueOf(4))), n.plus(maxLong));
// assertEquals( Natural.valueOf(BigInteger.valueOf(Long.MAX_VALUE).subtract(BigInteger.valueOf(4))), maxLong.plus(n));
//
Whole maxULong = Natural64.MAX;
// Whole maxULongPlus4 = Natural64.valueOf("18446744073709551611");
// assertEquals( maxULongPlus4, n.plus(maxULong));
// assertEquals( maxULongPlus4, maxULong.plus(n));
//
// assertEquals( maxULongPlus4, maxULong.predecessor().predecessor().predecessor().predecessor());
}
@Test(expected = lense.core.math.ArithmeticException.class)
public void testIn32Limit(){
Whole k = Int32.valueOfNative(1);
Whole m = Int32.valueOfNative(java.lang.Integer.MAX_VALUE);
//m.plus(k);
}
@Test(expected = lense.core.math.ArithmeticException.class)
public void testInt64UpperLimit(){
Whole k = Int64.valueOfNative(2);
Whole m = Int64.valueOfNative(java.lang.Long.MAX_VALUE - 1);
//m.plus(k);
}
@Test(expected = lense.core.math.ArithmeticException.class)
public void testInt64LowerLimit(){
Whole k = Int64.valueOfNative(-2);
Whole m = Int64.valueOfNative(java.lang.Long.MIN_VALUE + 1);
//m.plus(k);
}
@Test
public void testIn64PlusInt32(){
Whole k = Int32.valueOfNative(2);
Whole m = Int64.valueOfNative(1);
//Whole r = m.plus(k);
//assertEquals(Int64.valueOfNative(3), r);
//assertTrue(r instanceof Int64);
}
@Test
public void testIn64MinusInt32(){
Whole k = Int32.valueOfNative(2);
Whole m = Int64.valueOfNative(1);
//Whole r = m.minus(k);
//assertEquals(Int64.valueOfNative(-1), r);
//assertTrue(r instanceof Int64);
}
@Test
public void testNaturalMinusNatural(){
Whole k = Natural64.valueOfNative(2);
Whole m = Natural64.valueOfNative(1);
//Whole r = m.minus(k);
//assertEquals(Int64.valueOfNative(-1), r);
//assertTrue(r instanceof Int64);
}
@Test
public void testNaturalPlusNegative(){
Whole k = Natural64.valueOfNative(2);
Whole m = Int32.valueOfNative(-1);
//Whole r = m.plus(k);
//assertEquals(Int64.valueOfNative(1), r);
//assertTrue(r instanceof Int64);
//r = k.plus(m);
//assertEquals(Int64.valueOfNative(1), r);
//assertTrue(r instanceof Int64);
}
@Test
public void testSacalableIn32Limit(){
Whole k = Int32.valueOfNative(1);
Whole m = Int32.valueOfNative(java.lang.Integer.MAX_VALUE);
//m.plus(k);
}
@Test(expected = lense.core.math.ArithmeticException.class)
public void testPredecessorWithWhole(){
Whole k = Natural64.valueOfNative(1);
Whole m = Int32.valueOfNative(-1);
assertEquals( m, k.predecessor().predecessor());
}
@Test(expected = lense.core.math.ArithmeticException.class)
public void testPredecessorWithNaturals(){
Natural k = Natural64.valueOfNative(1);
Integer m = Int32.valueOfNative(-1);
assertEquals( m, k.predecessor().predecessor());
}
@Test
public void testPredecessorWithIntegers(){
Whole k = Int32.valueOfNative(1);
Whole m = Int32.valueOfNative(-1);
assertEquals( m, k.predecessor().predecessor());
}
@Test
public void testScalablePredecessorLimit(){
// Whole k = Integer.valueOfNative(java.lang.Long.MIN_VALUE);
// Whole m = k.plus(Integer.valueOfNative(-1));
// Whole p = k.predecessor();
// assertEquals( m, p );
// assertTrue(p instanceof BigInt);
}
@Test(expected = lense.core.math.ArithmeticException.class)
public void testPredecessorLimit(){
// Whole k = Int32.valueOfNative(java.lang.Integer.MIN_VALUE);
// Whole m = k.plus(Int32.valueOfNative(-1));
// Whole p = k.predecessor();
}
}
| [
"[email protected]"
] | |
e27ffcffa0e9d4910a59916bc847b6adc4fd9058 | 7519b22414e025c20992349a23ea4fb618ed03cc | /src/test/java/com/acme/mytrader/strategy/LimitOrderTest.java | 92917e9810f09fa9d1d723ed1ac528e9bed3b749 | [] | no_license | ledormeurz/interview-exercise | 57e81cb7e4dbbcac1f09f9c233f1a90819c43db9 | 53ef9d21a81dc4d6d878e868229bc43d8620f3d8 | refs/heads/master | 2023-08-27T07:10:01.572635 | 2021-10-06T13:59:09 | 2021-10-06T13:59:09 | 413,897,203 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,750 | java | package com.acme.mytrader.strategy;
import org.junit.Test;
import java.util.Optional;
import static org.junit.Assert.*;
public class LimitOrderTest {
@Test
public void testBuyOrderLimitNotGenerated(){
// given buy order limit at 100 and volume 1000;
double orderPrice = 100;
Way orderWay = Way.BUY;
int orderVolume = 1000;
OrderStrategy orderStrategy = new LimitOrder(orderWay, orderPrice, orderVolume);
// when receive price at 101
Optional<Order> order = orderStrategy.priceUpdate(101);
// then no order generated
assertFalse(order.isPresent());
}
@Test
public void testBuyOrderLimitGeneratedWhenSourcePriceEquals(){
// given buy order limit at 100 and volume 1000;
double orderPrice = 100;
Way orderWay = Way.BUY;
int orderVolume = 1000;
OrderStrategy orderStrategy = new LimitOrder(orderWay, orderPrice, orderVolume);
// when receive price at 100
Optional<Order> orderOpt = orderStrategy.priceUpdate(100);
// then no order generated
assertTrue(orderOpt.isPresent());
Order order = orderOpt.get();
assertEquals(orderPrice, order.getPrice(),0);
assertEquals(orderWay, order.getWay());
assertEquals(orderVolume, order.getVolume());
}
@Test
public void testBuyOrderLimitGeneratedWhenSourcePriceLower(){
// given buy order limit at 100 and volume 1000;
double orderPrice = 100;
Way orderWay = Way.BUY;
int orderVolume = 1000;
OrderStrategy orderStrategy = new LimitOrder(orderWay, orderPrice, orderVolume);
// when receive price at 99
Optional<Order> orderOpt = orderStrategy.priceUpdate(99);
// then no order generated
assertTrue(orderOpt.isPresent());
Order order = orderOpt.get();
assertEquals(orderPrice, order.getPrice(),0);
assertEquals(orderWay, order.getWay());
assertEquals(orderVolume, order.getVolume());
}
@Test
public void testSellOrderLimitGeneratedWhenSourcePriceLower(){
// given buy order limit at 100 and volume 1000;
double orderPrice = 100;
Way orderWay = Way.SELL;
int orderVolume = 1000;
OrderStrategy orderStrategy = new LimitOrder(orderWay, orderPrice, orderVolume);
// when receive price at 110
Optional<Order> orderOpt = orderStrategy.priceUpdate(110);
// then no order generated
assertTrue(orderOpt.isPresent());
Order order = orderOpt.get();
assertEquals(orderPrice, order.getPrice(),0);
assertEquals(orderWay, order.getWay());
assertEquals(orderVolume, order.getVolume());
}
} | [
"[email protected]"
] | |
af763de057bac242c50956090d9d857d72469d07 | 69ee0508bf15821ea7ad5139977a237d29774101 | /cmis-core/src/main/java/vmware/vim25/LeaveCurrentDomainRequestType.java | bdf0bed09f0831c731a613c934f09c9bd7df8339 | [] | no_license | bhoflack/cmis | b15bac01a30ee1d807397c9b781129786eba4ffa | 09e852120743d3d021ec728fac28510841d5e248 | refs/heads/master | 2021-01-01T05:32:17.872620 | 2014-11-17T15:00:47 | 2014-11-17T15:00:47 | 8,852,575 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,920 | java |
package vmware.vim25;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for LeaveCurrentDomainRequestType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="LeaveCurrentDomainRequestType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="_this" type="{urn:vim25}ManagedObjectReference"/>
* <element name="force" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LeaveCurrentDomainRequestType", propOrder = {
"_this",
"force"
})
public class LeaveCurrentDomainRequestType {
@XmlElement(required = true)
protected ManagedObjectReference _this;
protected boolean force;
/**
* Gets the value of the this property.
*
* @return
* possible object is
* {@link ManagedObjectReference }
*
*/
public ManagedObjectReference getThis() {
return _this;
}
/**
* Sets the value of the this property.
*
* @param value
* allowed object is
* {@link ManagedObjectReference }
*
*/
public void setThis(ManagedObjectReference value) {
this._this = value;
}
/**
* Gets the value of the force property.
*
*/
public boolean isForce() {
return force;
}
/**
* Sets the value of the force property.
*
*/
public void setForce(boolean value) {
this.force = value;
}
}
| [
"[email protected]"
] | |
42b9194b26ec7c63d4019bb2e2b04745a9fea054 | 5b84d9e3f86b5d3ffa06337db89d822e159e21ef | /base/src/main/java/com/zero/akkaj/Result.java | 0af3deeae122f65e92afbad3c411fcd80c1196d6 | [] | no_license | zero-jianjia/scalatest | b9010ca7edbc536ef8b7881783a392a1a5c23fa3 | ae753c81814bed5828eae1a687049564faa4fbd3 | refs/heads/master | 2020-05-21T19:43:07.762768 | 2017-06-13T02:43:40 | 2017-06-13T02:43:40 | 51,893,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 93 | java | package com.zero.akkaj;
/**
* Created by Inuyasha on 16.04.12.
*/
public class Result {
}
| [
"[email protected]"
] | |
dd98a01ab5d20801931a175bdabacc93c74e3768 | 2752e40fc24f1efd1e4f3cad0ac478699f390c1e | /wcloud/src/ie/gmit/sw/WordFrequencyDatabase.java | 5515f8c7accbcf4ebe911ab2bdf83d70326c3e32 | [] | no_license | cormacmchale/4thyearaibackup | 29d2d953ac26315a7cf5c95f4be2ff7c9845395c | fb7c918ebe6d112fc904a710b9e94acd72043071 | refs/heads/master | 2021-05-18T17:37:34.129269 | 2020-03-30T15:45:55 | 2020-03-30T15:45:55 | 251,341,401 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,974 | java | package ie.gmit.sw;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import ie.gmit.sw.ai.cloud.WordFrequency;
//have all node searchers populate this data base
public class WordFrequencyDatabase {
//singleton
private WordFrequencyDatabase() {}
private static WordFrequencyDatabase database = null;
//sort the top words, word frequency can be sorted
private List<WordFrequency> topWords = new ArrayList<WordFrequency>();
//ignores these words
private Set<String> ignore = new ConcurrentSkipListSet<String>();
//for organizing thread search terms
public Set<String> getIgnore() {
return ignore;
}
//return this at the end... top 32 words
private WordFrequency[] wf = new WordFrequency[32];
//add to the hash map all the words
private ConcurrentHashMap<String, Integer> wordCount = new ConcurrentHashMap<String, Integer>();
public void addWord(String s)
{
//all caps words.
String first=s.substring(0,1);
String afterfirst=s.substring(1);
String capitalizeWord = first.toUpperCase()+afterfirst;
if(capitalizeWord.length()<3)
{
//ignore this word
}
else
{
if(ignore.contains(capitalizeWord))
{
return;
}
else
{
//add a word and increment the count of it
if (wordCount.containsKey(capitalizeWord))
{
int increment = wordCount.get(capitalizeWord);
increment++;
wordCount.put(capitalizeWord, increment);
}
else
{
wordCount.put(s, 1);
}
}
}
}
//where is where the wordFrequency is populate form the hashMap and returned
public WordFrequency[] getWf() {
//get top 32 words in hashmap
this.wordCount.entrySet().forEach(entry->{
//add to a list
topWords.add(new WordFrequency(entry.getKey(),entry.getValue()));
});
//sort the list
Collections.sort(topWords);
//add top 31 word to wf and return it from this method
for(int i =0; i<32; i++)
{
//System.out.println("Sorted?: "+topWords.get(i).getWord()+ " : "+ topWords.get(i).getFrequency());
wf[i] = topWords.get(i);
}
return wf;
}
//clear all info from previous searches
public void clearWordInfo()
{
this.wordCount.clear();
this.topWords.clear();
}
public void printWordCount()
{
//print the map for display
//for debug
this.wordCount.entrySet().forEach(entry->{
System.out.println(entry.getKey() + " : " + entry.getValue());
});
}
//get singleton
public static WordFrequencyDatabase getInstance()
{
if (database == null)
{
database = new WordFrequencyDatabase();
}
return database;
}
//populate the ignore words file
public void ignoreWordsFromFile(File f)
{
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(f));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String st;
try {
while ((st = br.readLine()) != null)
{
//System.out.println(st);
String first=st.substring(0,1);
String afterfirst=st.substring(1);
String capitalizeWord = first.toUpperCase()+afterfirst;
ignore.add(capitalizeWord);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//populate the ignore words file
public void ignoreWordsFromSearch(String s)
{
//System.out.println(st);
String first=s.substring(0,1);
String afterfirst=s.substring(1);
String capitalizeWord = first.toUpperCase()+afterfirst;
ignore.add(capitalizeWord);
}
}
| [
"[email protected]"
] | |
8ed8fb2aa201567d8c225e5a33c7de9e4bfa5dfa | 22a90901d1380d10f026cdc9e3b5001ea2adf41b | /7blog-parent/7blog-mapper/src/main/java/com/scaler7/mapper/BlogCommentMapper.java | ba95530c8313ee9ccb955e63385fe7e7ba55f45e | [] | no_license | scaler7/7blog | 5ef955d6bdc9e3bde6fac43168d9de5b980edebe | 47dfe6905dac16349a3c9d185528955c68a40737 | refs/heads/master | 2022-06-24T17:33:33.396187 | 2020-10-06T05:59:36 | 2020-10-06T05:59:36 | 229,407,127 | 1 | 0 | null | 2022-06-17T03:28:04 | 2019-12-21T09:45:52 | JavaScript | UTF-8 | Java | false | false | 427 | java | package com.scaler7.mapper;
import com.scaler7.entity.BlogComment;
import com.scaler7.vo.BlogCommentVO;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author scaler7
* @since 2019-12-21
*/
public interface BlogCommentMapper extends BaseMapper<BlogComment> {
public List<BlogCommentVO> selectTop3VisitorsByCommentCount();
}
| [
"[email protected]"
] | |
843d9007f0f8f9467be2db04ea1fed5c0e5f74b9 | 8f033f14f6208feaacd46201aa998fcdc14de720 | /src/java/litfitsserver/entities/Garment.java | 0e3df40fc682f4c8a7e5e6af19c16733c6cc51bd | [] | no_license | Charlie-sHub/Lit_Fits_Server | a2515b26c4a9dca196138544704722e9353b89d0 | 1756e6ba38d2afb5c877af858d9846751b225391 | refs/heads/master | 2022-04-01T16:21:58.458790 | 2020-01-31T13:10:52 | 2020-01-31T13:10:52 | 225,852,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,038 | java | package litfitsserver.entities;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.nio.file.Files;
import java.util.Objects;
import java.util.ResourceBundle;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import static javax.persistence.FetchType.EAGER;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import org.apache.commons.io.FileUtils;
/**
* Garment entity
*
* @author Carlos Mendez
*/
@NamedQueries({
@NamedQuery(
name = "findGarmentsByCompany",
query = "SELECT gar FROM Garment gar WHERE gar.company.nif=:nif"
)
,
@NamedQuery(
name = "findGarmentsByRequest",
query = "SELECT gar FROM Garment gar WHERE gar.promotionRequest=:requested"
)
,
@NamedQuery(
name = "findGarmentByBarcode",
query = "SELECT gar FROM Garment gar WHERE gar.barcode=:barcode"
)
,
@NamedQuery(
name = "findGarmentsPromoted",
query = "SELECT gar FROM Garment gar WHERE gar.promoted=:promoted"
)
})
@Entity
@Table(name = "garment", schema = "litfitsdb")
@XmlRootElement
public class Garment implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
/**
* Unique barcode identifier of the garment
*/
@NotNull
@Column(unique = true)
private String barcode;
/**
* Path in the database to the picture of the garment
*/
@NotNull
@Column(name = "pictureName")
private String namePicture;
/**
* The person that designed the garment
*/
@NotNull
private String designer;
/**
* How much is worth
*/
@NotNull
private Double price;
/**
* The kind of situation is suited for
*/
@NotNull
private Mood mood;
/**
* Where it is worn
*/
@NotNull
private BodyPart bodyPart;
/**
* What kind of garment it is
*/
@NotNull
private GarmentType garmentType;
/**
* Indicates if it can be bought
*/
@NotNull
private boolean available;
/**
* Indicates if the company requested a promotion for this garment
*/
@NotNull
private boolean promotionRequest;
/**
* Indicates if the promotion request is accepted
*/
@NotNull
private boolean promoted;
/**
* Company that sells the garment
*/
@NotNull
@ManyToOne
@JoinColumn(name = "company")
private Company company;
/**
* What colors are in the garment
*/
@ManyToMany(fetch = EAGER, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(name = "garment_colors", schema = "litfitsdb")
private Set<Color> colors;
/**
* What materials is the garment made out of
*/
@ManyToMany(fetch = EAGER, cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinTable(name = "garment_materials", schema = "litfitsdb")
private Set<Material> materials;
/**
* Empty constructor
*/
public Garment() {
}
/**
* Full constructor
*
* @param id
* @param barcode
* @param designer
* @param price
* @param mood
* @param bodyPart
* @param garmentType
* @param available
* @param promotionRequest
* @param promoted
* @param imagePath
* @param company
* @param colors
* @param materials
*/
public Garment(long id, String barcode, String designer, Double price, Mood mood, BodyPart bodyPart, GarmentType garmentType, boolean available, boolean promotionRequest, boolean promoted, String imagePath, Company company, Set<Color> colors, Set<Material> materials) {
this.id = id;
this.barcode = barcode;
this.designer = designer;
this.price = price;
this.mood = mood;
this.bodyPart = bodyPart;
this.garmentType = garmentType;
this.available = available;
this.promotionRequest = promotionRequest;
this.promoted = promoted;
this.namePicture = imagePath;
this.company = company;
this.colors = colors;
this.materials = materials;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
public String getDesigner() {
return designer;
}
public void setDesigner(String designer) {
this.designer = designer;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
public Mood getMood() {
return mood;
}
public void setMood(Mood mood) {
this.mood = mood;
}
public BodyPart getBodyPart() {
return bodyPart;
}
public void setBodyPart(BodyPart bodyPart) {
this.bodyPart = bodyPart;
}
public GarmentType getGarmentType() {
return garmentType;
}
public void setGarmentType(GarmentType garmentType) {
this.garmentType = garmentType;
}
public boolean isAvailable() {
return available;
}
public void setAvailable(boolean available) {
this.available = available;
}
public boolean isPromotionRequest() {
return promotionRequest;
}
public void setPromotionRequest(boolean promotionRequest) {
this.promotionRequest = promotionRequest;
}
public boolean isPromoted() {
return promoted;
}
public void setPromoted(boolean promoted) {
this.promoted = promoted;
}
public String getNamePicture() {
return namePicture;
}
public void setNamePicture(String namePicture) {
this.namePicture = namePicture;
}
public Company getCompany() {
return company;
}
public void setCompany(Company company) {
this.company = company;
}
public Set<Color> getColors() {
return colors;
}
public void setColors(Set<Color> colors) {
this.colors = colors;
}
public Set<Material> getMaterials() {
return materials;
}
public void setMaterials(Set<Material> materials) {
this.materials = materials;
}
/**
* Reads the bytes of the picture and returns them
*
* @return byte[] of the picture
* @throws java.io.IOException
*/
public byte[] getPicture() throws IOException {
String pictureFolder = ResourceBundle.getBundle("litfitsserver.miscellaneous.paths").getString("picturesFolder");
byte[] pictureBytes = Files.readAllBytes(new File(pictureFolder + "/" + namePicture).toPath());
return pictureBytes;
}
/**
* Saves the picture in the corresponding folder
*
* @param pictureBytes
* @throws Exception
*/
public void setPicture(byte[] pictureBytes) throws Exception {
String pictureFolder = ResourceBundle.getBundle("litfitsserver.miscellaneous.paths").getString("picturesFolder");
File outputFile = new File(pictureFolder + "/" + namePicture);
FileUtils.writeByteArrayToFile(outputFile, pictureBytes);
}
@Override
public int hashCode() {
int hash = 5;
hash = 29 * hash + (int) (this.id ^ (this.id >>> 32));
hash = 29 * hash + Objects.hashCode(this.barcode);
hash = 29 * hash + Objects.hashCode(this.designer);
hash = 29 * hash + Objects.hashCode(this.price);
hash = 29 * hash + Objects.hashCode(this.mood);
hash = 29 * hash + Objects.hashCode(this.bodyPart);
hash = 29 * hash + Objects.hashCode(this.garmentType);
hash = 29 * hash + (this.available ? 1 : 0);
hash = 29 * hash + (this.promotionRequest ? 1 : 0);
hash = 29 * hash + (this.promoted ? 1 : 0);
hash = 29 * hash + Objects.hashCode(this.namePicture);
hash = 29 * hash + Objects.hashCode(this.company);
hash = 29 * hash + Objects.hashCode(this.colors);
hash = 29 * hash + Objects.hashCode(this.materials);
return hash;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Garment other = (Garment) obj;
if (this.id != other.id) {
return false;
}
return Objects.equals(this.barcode, other.barcode);
}
@Override
public String toString() {
return "Garment{" + "id=" + id + ", barcode=" + barcode + ", designer=" + designer + ", price=" + price + ", mood=" + mood + ", bodyPart=" + bodyPart + ", garmentType=" + garmentType + ", available=" + available + ", promotionRequest=" + promotionRequest + ", promoted=" + promoted + ", imagePath=" + namePicture + ", company=" + company + ", colors=" + colors + ", materials=" + materials + '}';
}
}
| [
"[email protected]"
] | |
59629a470c71bf9fc96cabc3005a49b86fa5dec7 | a7973f98a56161bf3a7e63870c4791e2edc4870c | /src/com/airtactics/aitester/utils/Constants.java | d16c46504e023740396aa96e7761909c890ccd29 | [] | no_license | vladfatu/Air-Tactics-AI-Tester | 06fdea903af910d322bd526a10da024e97da9b00 | d43bcc23bf320dd0138ac97f3fdddb8e1c983725 | refs/heads/master | 2016-09-08T02:40:27.394119 | 2014-04-07T20:54:30 | 2014-04-07T20:54:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 160 | java | package com.airtactics.aitester.utils;
public class Constants {
public final static int GRID_SIZE = 10;
public final static int NUMBER_OF_PLANES = 3;
}
| [
"[email protected]"
] | |
9e82983ed525d7b16de8a7cb802ab601ba4e6ee6 | 93c2f979c2415f1db324f2529dfefb649301bb94 | /src/main/java/Utils/Utils.java | ef8bc810340a050a840aadae2d5e91740ec375dd | [] | no_license | ashley832020/booking | 7b4a6e323d47e7e2a608452e4399591e80b6353e | 25f335cf703d4f4b0249131b51c7b53fb62f1b3f | refs/heads/master | 2023-04-14T09:41:43.965894 | 2021-04-19T05:38:21 | 2021-04-19T05:38:21 | 353,942,012 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 507 | java | package Utils;
import java.util.regex.Pattern;
public class Utils {
public static Boolean isValidEmail(String email) {
String regex = "^[a-zA-Z0-9_!#$%&'*+/=?`{|}~^.-]+@[a-zA-Z0-9.-]+$";
Pattern pattern = Pattern.compile(regex);
return pattern.matcher(email).matches();
}
public static Boolean isValidPhone(String phone) {
String regex = "^[0-9]{10}$";
Pattern pattern = Pattern.compile(regex);
return pattern.matcher(phone).matches();
}
}
| [
"“[email protected]”"
] | |
c9139ad3f3652cc0a66d8355339efa0382d9ace7 | a8cf7f208abdcca7efc990615ddbf159f467ace9 | /work/SimplelinkStarter_v5.7.3_apkpure.com_source_from_JADX/sources/org/apache/http/conn/HttpHostConnectException.java | adde67226f1c68c8abe7efd64fe1ab4a19e8c826 | [] | no_license | adamkstock/FypPowerBand- | adbedf9ec82d3df61085f4aa6951ee099b8f8e7e | 7307ac76239df529db6ec97a859461ae3a02b0ff | refs/heads/master | 2022-04-23T02:45:35.073979 | 2020-04-22T23:32:56 | 2020-04-22T23:32:56 | 218,766,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 405 | java | package org.apache.http.conn;
import java.net.ConnectException;
import org.apache.http.HttpHost;
@Deprecated
public class HttpHostConnectException extends ConnectException {
public HttpHostConnectException(HttpHost httpHost, ConnectException connectException) {
throw new RuntimeException("Stub!");
}
public HttpHost getHost() {
throw new RuntimeException("Stub!");
}
}
| [
"[email protected]"
] | |
35d24c17239dc6b477ea9815f9e4dedbbf90282c | 35e732d4186f16c99b795284e6b8e8ef8ed8957f | /app/src/main/java/com/example/liuheng/company/activity/Main2Activity.java | 9bfa3b8cf729ae91f229a0afd4154316e11ecc8c | [] | no_license | liuhengheng/company | 71dc2cbe598e2696f908c16d68746a96b1708119 | c24215948dca2a0899868bd7e8dcfa268efa3e9b | refs/heads/master | 2020-03-22T00:02:53.544674 | 2018-06-30T05:21:08 | 2018-06-30T05:21:08 | 139,221,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,052 | java | package com.example.liuheng.company.activity;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import com.example.liuheng.company.R;
public class Main2Activity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
}
}
| [
"[email protected]"
] | |
9005fa68df54483c2f006ddcf93e25295e5c4bc2 | 721207cd281d8316269055dd77e72ee99194a47f | /src/model/LibraryLogic.java | e74d3dfd9c57dff75c615f74d0be905f6550e93e | [] | no_license | Nambroson/J2---Week2---Assessment | fdf604f23b6c83f383fc0425b3e32e01a088d397 | e01381b81d70b4cf019a37554f4d207569f276e8 | refs/heads/main | 2023-08-14T00:57:02.726244 | 2021-09-15T03:06:53 | 2021-09-15T03:06:53 | 406,596,609 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | package model;
/**
* @author Nick - ntambroson
* CIS175 - Fall 2021
* Sep 14, 2021
*/
public class LibraryLogic {
public boolean inStock(Library library) {
boolean bookAvailable;
int outOfStock = 0;
if (library.getInStock() > outOfStock) {
bookAvailable = true;
}else {
bookAvailable = false;
}
return bookAvailable;
}
public String titleDisplay(Library library) {
return library.getTitle();
}
}
| [
"[email protected]"
] | |
8a188484ec1ce2875290f3d1f9c4f36c40a55a42 | 22026d434fb4a7a9aeb0378a14e175c0f1f435ea | /components-snowflake/src/main/java/org/talend/components/snowflake/SnowflakeConnectionTableProperties.java | daa152375732326585e67d30f343c9111611ddbb | [
"Apache-2.0"
] | permissive | StefanLMNG/components | 9f88c60b8df28a02c0b3790591f4855fd21ad025 | c34d1ce2e9b16e7c369c0d753517a36b79009830 | refs/heads/master | 2021-01-09T08:44:28.553348 | 2016-11-16T08:22:53 | 2016-11-16T08:22:53 | 64,741,282 | 0 | 0 | null | 2016-08-02T08:59:39 | 2016-08-02T08:59:39 | null | UTF-8 | Java | false | false | 1,890 | java | package org.talend.components.snowflake;
import org.apache.avro.Schema;
import org.talend.components.api.component.Connector;
import org.talend.components.api.component.PropertyPathConnector;
import org.talend.components.common.FixedConnectorsComponentProperties;
import org.talend.daikon.properties.presentation.Form;
public abstract class SnowflakeConnectionTableProperties extends FixedConnectorsComponentProperties
implements SnowflakeProvideConnectionProperties {
// Collections
//
public SnowflakeConnectionProperties connection = new SnowflakeConnectionProperties("connection"); //$NON-NLS-1$
public SnowflakeTableProperties table;
protected transient PropertyPathConnector MAIN_CONNECTOR = new PropertyPathConnector(Connector.MAIN_NAME, "table.main");
public SnowflakeConnectionTableProperties(String name) {
super(name);
}
@Override
public void setupProperties() {
super.setupProperties();
// Allow for subclassing
table = new SnowflakeTableProperties("table");
table.connection = connection;
}
public Schema getSchema() {
return table.main.schema.getValue();
}
@Override
public void setupLayout() {
super.setupLayout();
Form mainForm = new Form(this, Form.MAIN);
mainForm.addRow(connection.getForm(Form.REFERENCE));
mainForm.addRow(table.getForm(Form.REFERENCE));
Form advancedForm = new Form(this, Form.ADVANCED);
advancedForm.addRow(connection.getForm(Form.ADVANCED));
}
@Override
public SnowflakeConnectionProperties getConnectionProperties() {
return connection;
}
@Override
public void refreshLayout(Form form) {
super.refreshLayout(form);
for (Form childForm : connection.getForms()) {
connection.refreshLayout(childForm);
}
}
}
| [
"[email protected]"
] | |
47e51f4ba2583be41a893aec38108a4ade66eb1f | c9291f953404d913598b6f8fbc45a216d22ca30d | /src/main/java/com/whitehatgaming/game/Board.java | 8e88e6716e4e9e12c915e5d11925f5da36643519 | [] | no_license | alexhandzhiev/Chess | 487354f904f1748814430aa9264c76328f2468fd | 3bf0f21af5d95622b52304f2ac75da63efa7303c | refs/heads/master | 2021-01-06T03:24:38.500052 | 2020-02-19T12:29:30 | 2020-02-19T12:29:30 | 241,211,025 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,277 | java | package com.whitehatgaming.game;
import com.whitehatgaming.pieces.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Board {
private final Map<Square, Piece> positions;
public Board() {
positions = new HashMap<>();
}
public List<Square> allSquares() {
return new ArrayList<>(positions.keySet());
}
public Piece at(Square square) {
return positions.get(square);
}
public Piece removePieceAt(Square square) {
return positions.remove(square);
}
public void setPieceAt(Square position, Piece piece) {
if (position != null && piece != null) {
positions.put(position, piece);
}
}
public void movePiece(Square src, Square dst) {
Piece piece = at(src);
removePieceAt(src);
setPieceAt(dst, piece);
}
public boolean isFree(Square square) {
if (square == null) {
return false;
}
return !positions.containsKey(square);
}
public boolean isColor(Square square, Color color) {
Piece piece = at(square);
if (piece != null) {
return piece.color().equals(color);
}
return false;
}
}
| [
"[email protected]"
] | |
b515151d8395ce1589ff9ee6f3e9d00a3d039b77 | 60239bb1ae7ecc2ce30738db51ad97688c4a669a | /src/main/java/juli/repository/TranslationRepository.java | 4137d292db1cfd12d58ad826280fe2c0aabff9da | [] | no_license | pangfei0/MyWeb | f4a62c3685fb177d27041e28dc70367c00e527e5 | 45e5d9690cff9af944da04d9f69c26b41afadf08 | refs/heads/master | 2020-09-21T20:27:54.334975 | 2016-10-03T02:43:52 | 2016-10-03T02:43:52 | 67,504,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package juli.repository;
import juli.domain.Translation;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface TranslationRepository extends PagingAndSortingRepository<Translation, String>, JpaSpecificationExecutor {
} | [
"[email protected]"
] | |
8e44b5460a1d0c2be794a336ee69094796b792b9 | ca7bc277816cfae25182b75916f733c740c629f5 | /chap10/src/sec07_user_define_exception/Account.java | 13badfe62d2af8b3432261e13b3fab266f6482c5 | [] | no_license | jupark1862/javaLab | 5f60834b7658a55b2eef86091002f249b86c2e0e | 6376402ad21ecfe836b4107560647b0ecd7a36e7 | refs/heads/master | 2023-04-10T05:12:37.251749 | 2021-04-29T04:17:56 | 2021-04-29T04:17:56 | 352,486,303 | 0 | 0 | null | null | null | null | WINDOWS-1252 | Java | false | false | 418 | java | package sec07_user_define_exception;
public class Account {
private long balance;
public long getBalance() {
return balance;
}
public void deposit(int money) {
balance += money;
}
public void withdraw(int money) throws BalanceInsufficientException {
if(balance < money) {
throw new BalanceInsufficientException("ÀܰíºÎÁ·: "+(money-balance));
}
balance -= money;
}
}
| [
"[email protected]"
] | |
c0a6447c39f15ee01fe105c8ad76b7b5c7945cc3 | 83dc6d909ed253c1518e4b22a68cec64c53b74d5 | /spring-demo-two/src/com/springdemo/annotations/sadFortuneService.java | 6dad9ee5f34ac0315f39224fdcd51c2a47fcb505 | [] | no_license | harikahoney/Annotations | d16b75513813a7dd09b6b7395ff2bde46154c435 | fd846d90ee8d5443544f249100526aaeac9f06fb | refs/heads/master | 2021-01-26T02:10:57.036023 | 2020-02-26T13:34:00 | 2020-02-26T13:34:00 | 243,269,178 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 221 | java | package com.springdemo.annotations;
public class sadFortuneService implements FortuneService {
@Override
public String getFortune() {
// TODO Auto-generated method stub
return "Today is Sad Day";
}
}
| [
"HARIKA@DESKTOP-IQ3PIDA"
] | HARIKA@DESKTOP-IQ3PIDA |
b7cd51e61edac28ec9e04ec11809b51bf8a183dd | c7cb80348cc36d80dc8a5d14f7a052b245572669 | /src/main/java/com/intellij/plugins/haxe/util/HaxeProjectUtil.java | d1ef749939b0db4d124dc0b0b76b1c59f39929d1 | [
"Apache-2.0"
] | permissive | HaxeFoundation/intellij-haxe | d7bb28f98c225d717a8e3f679a9972a5e2be5dce | cff91ff0c15003af85b2a7295f6d16059ed4336d | refs/heads/develop | 2023-08-31T08:07:19.333609 | 2023-08-20T19:26:30 | 2023-08-20T19:26:30 | 16,564,608 | 148 | 67 | Apache-2.0 | 2023-07-30T00:37:39 | 2014-02-06T01:06:24 | Java | UTF-8 | Java | false | false | 2,138 | java | /*
* Copyright 2020 Eric Bishton
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.plugins.haxe.util;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ex.ProjectManagerEx;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.plugins.haxe.config.sdk.HaxeSdkType;
import org.jetbrains.annotations.NotNull;
public class HaxeProjectUtil {
private HaxeProjectUtil() {} // Static interface only.
/**
* Gets the most likely "current" project. When multiple projects are available,
* checks for the SDK type.
*
* This should only be used when no other information (e.g. {@link Project},
* {@link com.intellij.openapi.module.Module},
* {@link com.intellij.psi.PsiElement}, or {@link com.intellij.lang.ASTNode})
* is available to give the project information.
*
* XXX: We *could* check the module types to see if any of them use a Haxe SDK.
*
* @return the first open project using a Haxe SDK; the first open project if none
* do; the default project if none are open.
*/
@NotNull
public static Project getLikelyCurrentProject() {
Project[] projects = ProjectManagerEx.getInstance().getOpenProjects();
for (Project project : projects) {
ProjectRootManager mgr = ProjectRootManager.getInstance(project);
Sdk sdk = null != mgr ? mgr.getProjectSdk() : null;
if (sdk instanceof HaxeSdkType) {
return project;
}
}
return projects.length > 0 ? projects[0] : ProjectManagerEx.getInstanceEx().getDefaultProject();
}
}
| [
"[email protected]"
] | |
c88042973c424062e2d04c985408f2006ee2cdf7 | 2a1b9f86f19deda710b00e6716b4ad5a8823c6d3 | /app/src/main/java/com/example/pc/myfirstapp/SecondActivity.java | c6d54d04bdbb22c600a79d9f5a177754f5721088 | [] | no_license | kzxwer/MyFirstApp | 9e8e4625be398fb359c666626a9373ae1d1abada | 33d6026b80ae54233fb2f180c0301a91b9a0ec2e | refs/heads/master | 2020-03-30T13:25:54.466846 | 2018-10-02T14:51:59 | 2018-10-02T14:51:59 | 151,272,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,426 | java | package com.example.pc.myfirstapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.util.Random;
public class SecondActivity extends AppCompatActivity {
private static final String TOTAL_COUNT = "total_count";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_second);
showRandomNumber();
}
public void showRandomNumber () {
// Get the text view where the random number will be displayed
TextView randomView = (TextView)
findViewById(R.id.textview_random);
// Get the text view where the heading is displayed
TextView headingView = (TextView)
findViewById(R.id.textview_label);
// Get the count from the intent extras
int count = getIntent().getIntExtra(TOTAL_COUNT, 0);
// Generate the random number
Random random = new Random();
int randomInt = 0;
if (count>0) {
randomInt = random.nextInt(count);
}
// Display the random number.
randomView.setText(Integer.toString(randomInt));
// Substitute the max value into the string resource
// for the heading, and update the heading
headingView.setText(getString(R.string.random_heading, count));
}
}
| [
"[email protected]"
] | |
fb48d1981e9440f6ac911583ba5bda2b1bac20c7 | 3f598b4d421c6f9a2e705009d650cf61a4ab5432 | /src/test/java/com/example/bddspring1573643746/DemoApplicationTests.java | 46ae42a698e600b17778364a06db56ae9d7c4f19 | [] | no_license | jenkins-x-bot-test/bdd-spring-1573643746 | 5ea12c053dfbb41e08202c3c95ab5d0f94278fd1 | 5034fe22efd2d544729299a21985e7ca786a1c83 | refs/heads/master | 2020-09-09T11:59:28.205903 | 2019-11-13T11:16:23 | 2019-11-13T11:16:23 | 221,441,536 | 0 | 0 | null | 2019-11-13T11:29:24 | 2019-11-13T11:16:30 | Makefile | UTF-8 | Java | false | false | 221 | java | package com.example.bddspring1573643746;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DemoApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
93c63eb400e1ed919707ce0158c868df04d6ad0e | 7225ae4a4a750c426d594ae9329f757663c13dec | /CRUDrestfulAPI/src/main/java/com/oscarolsson/restful/controller/ProductController.java | 9aee18f4ec3e39a67149da1a548a9842a94df9f8 | [] | no_license | oscarolsson94/springBootAPI | 12a5118ce37533055b38b723da7ebc5829ca5ec2 | ac45748b454e56d4e5c08d917e915d7ce8cd0897 | refs/heads/master | 2023-03-21T05:56:05.707126 | 2021-03-16T07:01:42 | 2021-03-16T07:01:42 | 345,955,091 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,845 | java | package com.oscarolsson.restful.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.oscarolsson.restful.entity.Product;
import com.oscarolsson.restful.service.ProductService;
@RestController
@RequestMapping("/api") //starter url localhost:9191/api
public class ProductController {
@Autowired
private ProductService service;
@PostMapping("/addProduct")
public Product addProduct(@RequestBody Product product) { //requestbody to be able to grab json
return service.saveProduct(product);
}
@PostMapping("/addProducts")
public List<Product> addProducts(@RequestBody List<Product> products) {
return service.saveProducts(products);
}
@GetMapping("/products")
public List<Product> findAllProducts(){
return service.getProducts();
}
@GetMapping("/productByID/{id}")
public Product findProductById(@PathVariable int id) {
return service.getProductById(id);
}
@GetMapping("/productByName/{name}")
public Product findProductByName(@PathVariable String name) {
return service.getProductByName(name);
}
@PutMapping("/update")
public Product updateProduct(@RequestBody Product product) {
return service.updateProduct(product);
}
@DeleteMapping("/delete/{id}")
public String deleteProduct(@PathVariable int id) {
return service.deleteProduct(id);
}
}
| [
"[email protected]"
] | |
da5093591b323c0529fa4c586b0b782e1344e799 | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /remoting/android/java/src/org/chromium/chromoting/RenderData.java | 2d6c94067c33a2ce6737cfe98995074b0ed05d7a | [
"CC-BY-4.0",
"BSD-3-Clause"
] | permissive | Samsung/Castanets | 240d9338e097b75b3f669604315b06f7cf129d64 | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | refs/heads/castanets_76_dev | 2023-08-31T09:01:04.744346 | 2021-07-30T04:56:25 | 2021-08-11T05:45:21 | 125,484,161 | 58 | 49 | BSD-3-Clause | 2022-10-16T19:31:26 | 2018-03-16T08:07:37 | null | UTF-8 | Java | false | false | 2,186 | java | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chromoting;
import android.graphics.Matrix;
import android.graphics.PointF;
/**
* This class stores UI configuration that will be used when rendering the remote desktop.
*/
public class RenderData {
/** Stores pan and zoom configuration and converts image coordinates to screen coordinates. */
public Matrix transform = new Matrix();
public int screenWidth;
public int screenHeight;
public int imageWidth;
public int imageHeight;
/** Determines whether the local cursor should be drawn. */
public boolean drawCursor;
/**
* Specifies the position, in image coordinates, at which the cursor image will be drawn.
* This will normally be at the location of the most recently injected motion event.
*/
private PointF mCursorPosition = new PointF();
/**
* Returns the position of the rendered cursor.
*
* @return A point representing the current position.
*/
public PointF getCursorPosition() {
return new PointF(mCursorPosition.x, mCursorPosition.y);
}
/**
* Sets the position of the cursor which is used for rendering.
*
* @param newX The new value of the x coordinate.
* @param newY The new value of the y coordinate
* @return True if the cursor position has changed.
*/
public boolean setCursorPosition(float newX, float newY) {
boolean cursorMoved = false;
if (newX != mCursorPosition.x) {
mCursorPosition.x = newX;
cursorMoved = true;
}
if (newY != mCursorPosition.y) {
mCursorPosition.y = newY;
cursorMoved = true;
}
return cursorMoved;
}
/**
* Indicates whether all information required to render the canvas has been set.
*
* @return True if both screen and image dimensions have been set.
*/
public boolean initialized() {
return imageWidth != 0 && imageHeight != 0 && screenWidth != 0 && screenHeight != 0;
}
}
| [
"[email protected]"
] | |
95071eb49ebfe19cb2d524fcb954777ed796a667 | 2e9a86693b665b879c59b14dfd63c2c92acbf08a | /webconverter/decomiledJars/rt/java/lang/SecurityManager.java | b777ecd423feee2c5950f156cd3c10728acd75ab | [] | no_license | shaikgsb/webproject-migration-code-java | 9e2271255077025111e7ea3f887af7d9368c6933 | 3b17211e497658c61435f6c0e118b699e7aa3ded | refs/heads/master | 2021-01-19T18:36:42.835783 | 2017-07-13T09:11:05 | 2017-07-13T09:11:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,890 | java | package java.lang;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FilePermission;
import java.net.InetAddress;
import java.net.SocketPermission;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.security.Permission;
import java.security.PrivilegedAction;
import java.security.Security;
import java.security.SecurityPermission;
import java.util.PropertyPermission;
import java.util.StringTokenizer;
import sun.reflect.CallerSensitive;
import sun.security.util.SecurityConstants;
import sun.security.util.SecurityConstants.AWT;
public class SecurityManager
{
@Deprecated
protected boolean inCheck;
private boolean initialized = false;
private static ThreadGroup rootGroup = ;
private static boolean packageAccessValid = false;
private static String[] packageAccess;
private static final Object packageAccessLock = new Object();
private static boolean packageDefinitionValid = false;
private static String[] packageDefinition;
private static final Object packageDefinitionLock = new Object();
private boolean hasAllPermission()
{
try
{
checkPermission(SecurityConstants.ALL_PERMISSION);
return true;
}
catch (SecurityException localSecurityException) {}
return false;
}
@Deprecated
public boolean getInCheck()
{
return this.inCheck;
}
public SecurityManager()
{
synchronized (SecurityManager.class)
{
SecurityManager localSecurityManager = System.getSecurityManager();
if (localSecurityManager != null) {
localSecurityManager.checkPermission(new RuntimePermission("createSecurityManager"));
}
this.initialized = true;
}
}
protected native Class[] getClassContext();
@Deprecated
protected ClassLoader currentClassLoader()
{
ClassLoader localClassLoader = currentClassLoader0();
if ((localClassLoader != null) && (hasAllPermission())) {
localClassLoader = null;
}
return localClassLoader;
}
private native ClassLoader currentClassLoader0();
@Deprecated
protected Class<?> currentLoadedClass()
{
Class localClass = currentLoadedClass0();
if ((localClass != null) && (hasAllPermission())) {
localClass = null;
}
return localClass;
}
@Deprecated
protected native int classDepth(String paramString);
@Deprecated
protected int classLoaderDepth()
{
int i = classLoaderDepth0();
if (i != -1) {
if (hasAllPermission()) {
i = -1;
} else {
i--;
}
}
return i;
}
private native int classLoaderDepth0();
@Deprecated
protected boolean inClass(String paramString)
{
return classDepth(paramString) >= 0;
}
@Deprecated
protected boolean inClassLoader()
{
return currentClassLoader() != null;
}
public Object getSecurityContext()
{
return AccessController.getContext();
}
public void checkPermission(Permission paramPermission)
{
AccessController.checkPermission(paramPermission);
}
public void checkPermission(Permission paramPermission, Object paramObject)
{
if ((paramObject instanceof AccessControlContext)) {
((AccessControlContext)paramObject).checkPermission(paramPermission);
} else {
throw new SecurityException();
}
}
public void checkCreateClassLoader()
{
checkPermission(SecurityConstants.CREATE_CLASSLOADER_PERMISSION);
}
private static ThreadGroup getRootGroup()
{
for (ThreadGroup localThreadGroup = Thread.currentThread().getThreadGroup(); localThreadGroup.getParent() != null; localThreadGroup = localThreadGroup.getParent()) {}
return localThreadGroup;
}
public void checkAccess(Thread paramThread)
{
if (paramThread == null) {
throw new NullPointerException("thread can't be null");
}
if (paramThread.getThreadGroup() == rootGroup) {
checkPermission(SecurityConstants.MODIFY_THREAD_PERMISSION);
}
}
public void checkAccess(ThreadGroup paramThreadGroup)
{
if (paramThreadGroup == null) {
throw new NullPointerException("thread group can't be null");
}
if (paramThreadGroup == rootGroup) {
checkPermission(SecurityConstants.MODIFY_THREADGROUP_PERMISSION);
}
}
public void checkExit(int paramInt)
{
checkPermission(new RuntimePermission("exitVM." + paramInt));
}
public void checkExec(String paramString)
{
File localFile = new File(paramString);
if (localFile.isAbsolute()) {
checkPermission(new FilePermission(paramString, "execute"));
} else {
checkPermission(new FilePermission("<<ALL FILES>>", "execute"));
}
}
public void checkLink(String paramString)
{
if (paramString == null) {
throw new NullPointerException("library can't be null");
}
checkPermission(new RuntimePermission("loadLibrary." + paramString));
}
public void checkRead(FileDescriptor paramFileDescriptor)
{
if (paramFileDescriptor == null) {
throw new NullPointerException("file descriptor can't be null");
}
checkPermission(new RuntimePermission("readFileDescriptor"));
}
public void checkRead(String paramString)
{
checkPermission(new FilePermission(paramString, "read"));
}
public void checkRead(String paramString, Object paramObject)
{
checkPermission(new FilePermission(paramString, "read"), paramObject);
}
public void checkWrite(FileDescriptor paramFileDescriptor)
{
if (paramFileDescriptor == null) {
throw new NullPointerException("file descriptor can't be null");
}
checkPermission(new RuntimePermission("writeFileDescriptor"));
}
public void checkWrite(String paramString)
{
checkPermission(new FilePermission(paramString, "write"));
}
public void checkDelete(String paramString)
{
checkPermission(new FilePermission(paramString, "delete"));
}
public void checkConnect(String paramString, int paramInt)
{
if (paramString == null) {
throw new NullPointerException("host can't be null");
}
if ((!paramString.startsWith("[")) && (paramString.indexOf(':') != -1)) {
paramString = "[" + paramString + "]";
}
if (paramInt == -1) {
checkPermission(new SocketPermission(paramString, "resolve"));
} else {
checkPermission(new SocketPermission(paramString + ":" + paramInt, "connect"));
}
}
public void checkConnect(String paramString, int paramInt, Object paramObject)
{
if (paramString == null) {
throw new NullPointerException("host can't be null");
}
if ((!paramString.startsWith("[")) && (paramString.indexOf(':') != -1)) {
paramString = "[" + paramString + "]";
}
if (paramInt == -1) {
checkPermission(new SocketPermission(paramString, "resolve"), paramObject);
} else {
checkPermission(new SocketPermission(paramString + ":" + paramInt, "connect"), paramObject);
}
}
public void checkListen(int paramInt)
{
checkPermission(new SocketPermission("localhost:" + paramInt, "listen"));
}
public void checkAccept(String paramString, int paramInt)
{
if (paramString == null) {
throw new NullPointerException("host can't be null");
}
if ((!paramString.startsWith("[")) && (paramString.indexOf(':') != -1)) {
paramString = "[" + paramString + "]";
}
checkPermission(new SocketPermission(paramString + ":" + paramInt, "accept"));
}
public void checkMulticast(InetAddress paramInetAddress)
{
String str = paramInetAddress.getHostAddress();
if ((!str.startsWith("[")) && (str.indexOf(':') != -1)) {
str = "[" + str + "]";
}
checkPermission(new SocketPermission(str, "connect,accept"));
}
@Deprecated
public void checkMulticast(InetAddress paramInetAddress, byte paramByte)
{
String str = paramInetAddress.getHostAddress();
if ((!str.startsWith("[")) && (str.indexOf(':') != -1)) {
str = "[" + str + "]";
}
checkPermission(new SocketPermission(str, "connect,accept"));
}
public void checkPropertiesAccess()
{
checkPermission(new PropertyPermission("*", "read,write"));
}
public void checkPropertyAccess(String paramString)
{
checkPermission(new PropertyPermission(paramString, "read"));
}
@Deprecated
public boolean checkTopLevelWindow(Object paramObject)
{
if (paramObject == null) {
throw new NullPointerException("window can't be null");
}
Object localObject = SecurityConstants.AWT.TOPLEVEL_WINDOW_PERMISSION;
if (localObject == null) {
localObject = SecurityConstants.ALL_PERMISSION;
}
try
{
checkPermission((Permission)localObject);
return true;
}
catch (SecurityException localSecurityException) {}
return false;
}
public void checkPrintJobAccess()
{
checkPermission(new RuntimePermission("queuePrintJob"));
}
@Deprecated
public void checkSystemClipboardAccess()
{
Object localObject = SecurityConstants.AWT.ACCESS_CLIPBOARD_PERMISSION;
if (localObject == null) {
localObject = SecurityConstants.ALL_PERMISSION;
}
checkPermission((Permission)localObject);
}
@Deprecated
public void checkAwtEventQueueAccess()
{
Object localObject = SecurityConstants.AWT.CHECK_AWT_EVENTQUEUE_PERMISSION;
if (localObject == null) {
localObject = SecurityConstants.ALL_PERMISSION;
}
checkPermission((Permission)localObject);
}
private static String[] getPackages(String paramString)
{
String[] arrayOfString = null;
if ((paramString != null) && (!paramString.equals("")))
{
StringTokenizer localStringTokenizer = new StringTokenizer(paramString, ",");
int i = localStringTokenizer.countTokens();
if (i > 0)
{
arrayOfString = new String[i];
int j = 0;
while (localStringTokenizer.hasMoreElements())
{
String str = localStringTokenizer.nextToken().trim();
arrayOfString[(j++)] = str;
}
}
}
if (arrayOfString == null) {
arrayOfString = new String[0];
}
return arrayOfString;
}
public void checkPackageAccess(String paramString)
{
if (paramString == null) {
throw new NullPointerException("package name can't be null");
}
String[] arrayOfString;
synchronized (packageAccessLock)
{
if (!packageAccessValid)
{
String str = (String)AccessController.doPrivileged(new PrivilegedAction()
{
public String run()
{
return Security.getProperty("package.access");
}
});
packageAccess = getPackages(str);
packageAccessValid = true;
}
arrayOfString = packageAccess;
}
for (int i = 0; i < arrayOfString.length; i++) {
if ((paramString.startsWith(arrayOfString[i])) || (arrayOfString[i].equals(paramString + ".")))
{
checkPermission(new RuntimePermission("accessClassInPackage." + paramString));
break;
}
}
}
public void checkPackageDefinition(String paramString)
{
if (paramString == null) {
throw new NullPointerException("package name can't be null");
}
String[] arrayOfString;
synchronized (packageDefinitionLock)
{
if (!packageDefinitionValid)
{
String str = (String)AccessController.doPrivileged(new PrivilegedAction()
{
public String run()
{
return Security.getProperty("package.definition");
}
});
packageDefinition = getPackages(str);
packageDefinitionValid = true;
}
arrayOfString = packageDefinition;
}
for (int i = 0; i < arrayOfString.length; i++) {
if ((paramString.startsWith(arrayOfString[i])) || (arrayOfString[i].equals(paramString + ".")))
{
checkPermission(new RuntimePermission("defineClassInPackage." + paramString));
break;
}
}
}
public void checkSetFactory()
{
checkPermission(new RuntimePermission("setFactory"));
}
@Deprecated
@CallerSensitive
public void checkMemberAccess(Class<?> paramClass, int paramInt)
{
if (paramClass == null) {
throw new NullPointerException("class can't be null");
}
if (paramInt != 0)
{
Class[] arrayOfClass = getClassContext();
if ((arrayOfClass.length < 4) || (arrayOfClass[3].getClassLoader() != paramClass.getClassLoader())) {
checkPermission(SecurityConstants.CHECK_MEMBER_ACCESS_PERMISSION);
}
}
}
public void checkSecurityAccess(String paramString)
{
checkPermission(new SecurityPermission(paramString));
}
private native Class<?> currentLoadedClass0();
public ThreadGroup getThreadGroup()
{
return Thread.currentThread().getThreadGroup();
}
}
| [
"[email protected]"
] | |
74735d7019ecc797ef2dcc9e6f8625477af99b66 | 4d1d2f0c01a0300e9c4ef4caa8dab775a5c8a4ca | /TravelAgent.java | 02c3cb8416911824772d716bd20725b40e664103 | [] | no_license | IgnazMaula/TravelAgentManager | 755de30defae4f72c5d0564d609f4ef5153fb71b | 80dbee4447e68fc9f2efc01c27fb7247a7168ba5 | refs/heads/master | 2023-01-10T23:01:10.784564 | 2020-11-13T15:27:43 | 2020-11-13T15:27:43 | 312,612,299 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,461 | java | /**
* BIT203 Advanced Programming in Java Assignment 2
* Name: Ignaz Maula Ibrahim
* StudentID: E180184
* TravelAgent.java
* Description : container class that store Flight
* and Passenger object and manage its arrayList
* @author Ignaz Maula Ibrahim
*/
import java.util.*;
import java.time.LocalDate;
import java.io.Serializable;
public class TravelAgent implements Serializable {
//instance variable
private String name;
//create Flight array and Passenger array with ArrayList
private ArrayList<Flight> flightArray =
new ArrayList<Flight>();
private ArrayList<Passenger> passengerArray =
new ArrayList<Passenger>();
//default constructor
public TravelAgent() {
name = "NONE";
}
//constructor with parameter
public TravelAgent(String name) {
this.name = name;
}
//getter method
public String getName() {
return name;
}
public ArrayList<Flight> getFlightArray() {
return flightArray;
}
public ArrayList<Passenger> getPassengerArray() {
return passengerArray;
}
//setter method
public void setName(String name) {
this.name = name;
}
//create BusinessFlight object and add it to Flight array
public BusinessFlight addBusinessFlight(String origin,
String destination, LocalDate date, String deparr,
double price, int childPerc, double rate) {
BusinessFlight flight = new BusinessFlight(origin, destination,
date, deparr, price, childPerc, rate);
flightArray.add(flight);
return flight;
}
//create EconomyFlight object and add it to Flight array
public EconomyFlight addEconomyFlight(String origin,
String destination, LocalDate date, String deparr,
double price, int childPerc) {
EconomyFlight flight = new EconomyFlight(origin, destination,
date, deparr, price, childPerc);
flightArray.add(flight);
return flight;
}
//create Passenger object and add it to Passenger array
public Passenger addPassenger(String name, int numAdults,
int numChildren, int numFlights, double totalPrice) {
Passenger passenger = new Passenger(name, numAdults,
numChildren, numFlights, totalPrice);
passengerArray.add(passenger);
return passenger;
}
//receive needed parameter to create Movie
//and pass it to selected Flight
public void addMovie(int flightNum, String title, int length)
{
Flight flight = searchFlight(flightNum);
flight.addMovie(title, length);
}
//check the size of Flight array
public int flightListSize() {
return flightArray.size();
}
//check the size of Passenger array
public int passengerListSize() {
return passengerArray.size();
}
//show list of Flight in array
public void flightListByNo() {
Collections.sort(flightArray, new FlightNoComparator());
}
//show list of Flight sorted by type of flight
public void flightListByType() {
Collections.sort(flightArray, new TypeComparator());
}
//show list of Flight sorted by date of flight
public void flightListByDate() {
Collections.sort(flightArray, new DateComparator());
}
//show list of Passenger in array
public String passengerList() {
String list = "\t---------------------------------------------\n";
for (Passenger i : passengerArray) {
list = list + i + "\n";
}
return list;
}
//show list of Passenger sorted by name
public void passengerListByName() {
Collections.sort(passengerArray, new NameComparator());
}
//show list of Passenger sorted by booking ref
public void passengerListByBookingRef() {
Collections.sort(passengerArray, new BookingRefComparator());
}
//search Flight based on flight no
public Flight searchFlight(int no) {
for (Flight i : flightArray) {
if ( i.getFlightNo() == no)
return i;
}
return null;
}
//search Passenger based on booking ref
public Passenger searchPassenger(int no) {
for (Passenger i : passengerArray) {
if (i.getBookingRef() == no)
return i;
}
return null;
}
//delete selected flight from Flight array
public void deleteFlight(Flight flight) {
flightArray.remove(flight);
}
//delete selected passenger from Passenger array
public void deletePassenger(Passenger passenger) {
passengerArray.remove(passenger);
}
//delete selected flight from Flight array located in Passenger class
public void deleteFlightinPassenger(Flight flight) {
for (Passenger i : passengerArray) {
i.deleteFlight(flight);
}
}
} | [
"[email protected]"
] | |
ebf4e7e6df2e2abe1a8794ae65e7e3714820b739 | c7ed2393bedcabe2974461feff40d2f50ecfc12c | /src/com/demo/chapter26/FlyweightFactory.java | 3bfd6968f9285b622081bc8c6671423c88131c95 | [] | no_license | zhangshaobai/design | 49abc9d9b004b384f7f6072e54fe73afbf95e937 | 2305d558dcf86e58c8caa6d84054aa0e6f0090de | refs/heads/master | 2020-06-25T20:34:11.335264 | 2019-11-03T10:32:15 | 2019-11-03T10:32:15 | 199,415,504 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 460 | java | package com.demo.chapter26;
import java.util.Hashtable;
/**
* @Copyright (C), 2019,蔚商科技
* @desc:
* @author: zhangpeng
* @date: 2019/8/6 8:20 PM
*/
public class FlyweightFactory {
Hashtable<Integer, Flyweight> flyweights = new Hashtable<>();
public Flyweight getFlyweight(int key) {
if(!flyweights.containsKey(key)) {
flyweights.put(key,new ConcreteFlyweight());
}
return flyweights.get(key);
}
}
| [
"[email protected]"
] | |
c723b17af100ecd1ea341f2dbb59daa2e36f43e4 | 1a630fc3f6ff5c102b5de5055bd6e73025ff1b1e | /mvpfragments/src/androidTest/java/com/borshevik/mvpfragments/ExampleInstrumentedTest.java | 21606e092e52781525514a37940d9f856dad1221 | [] | no_license | BORSHEVIK/StartMVPFragmentsProject | 1fb2cadb576d3dfd52da58dd60533cac38d01a34 | 619857c98ef62b7b6274ac38ed468f70bc34888c | refs/heads/master | 2020-07-01T15:44:27.481321 | 2019-08-09T08:51:05 | 2019-08-09T08:51:05 | 201,214,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.borshevik.mvpfragments;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.borshevik.mvpfragments.test", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
573fef75daeee5c80004ebddb50f4280a9b1a5d1 | cb343dd8f37c68a3b092ba4df590d1983c36c7e8 | /EmployeeWageProblem.java | 6281add40517718665b30afbc50981468af2200c | [] | no_license | mayurfcb10/Demo2 | eeed7135fdeae236b59d17b2a499f034fedc00fe | 3ff6dba139656775f0cb3f42eec118cc3e6fbc5e | refs/heads/master | 2022-12-22T12:14:26.483503 | 2020-09-27T02:25:25 | 2020-09-27T02:25:25 | 298,935,893 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,355 | java |
public class EmployeeWageProblem {
public static final int IS_PART_TIME = 1;
public static final int IS_FULL_TIME = 2;
private int numOfCompany = 0;
private CompanyEmpWage[] companyEmpWageArray;
public EmployeeWageProblem() {
companyEmpWageArray = new CompanyEmpWage[5];
}
private void addCompanyEmpWage(String company, int empRatePerHour, int numOfWorkingDays, int maxHoursPerMonth) {
companyEmpWageArray[numOfCompany] = new CompanyEmpWage(company, empRatePerHour, numOfWorkingDays, maxHoursPerMonth);
numOfCompany++;
}
private void computeEmpWage() {
for(int i = 0;i < numOfCompany; i++) {
companyEmpWageArray[i].setTotalEmpWage(this.computeEmpWage(companyEmpWageArray[i]));
System.out.println(companyEmpWageArray[i]);
System.out.println();
}
}
public int computeEmpWage(CompanyEmpWage companyEmpWage ) {
int empHrs = 0, totalEmpHrs = 0, totalWorkingDays = 0;
while(totalEmpHrs <= companyEmpWage.maxHoursPerMonth && totalWorkingDays < companyEmpWage.numOfWorkingDays) {
totalWorkingDays++;
int employeeCheck = (int)Math.floor(Math.random() * 10) % 3;
switch (employeeCheck) {
case IS_PART_TIME:
empHrs = 4;
break;
case IS_FULL_TIME:
empHrs = 8;
break;
default:
empHrs = 0;
}
totalEmpHrs += empHrs;
System.out.println("Day#: "+ totalWorkingDays +"Emp Hr: "+empHrs);
}
return totalEmpHrs * companyEmpWage.empRatePerHour;
}
public static void main(String[] args) {
EmployeeWageProblem empWageBuilder = new EmployeeWageProblem();
empWageBuilder.addCompanyEmpWage("dMart", 20, 2, 10);
empWageBuilder.addCompanyEmpWage("jioMart", 10, 4, 20);
empWageBuilder.computeEmpWage();
}
class CompanyEmpWage {
private final String company;
private final int empRatePerHour;
private final int numOfWorkingDays;
private final int maxHoursPerMonth;
private int totalEmpWage;
public CompanyEmpWage(String company, int empRatePerHour, int numOfWorkingDays, int maxHoursPerMonth) {
this.company = company;
this.empRatePerHour = empRatePerHour;
this.numOfWorkingDays = numOfWorkingDays;
this.maxHoursPerMonth = maxHoursPerMonth;
}
public void setTotalEmpWage(int totalEmpWage) {
this.totalEmpWage = totalEmpWage;
}
public String toString() {
return "Total Emp Wage for Company "+ company + " is: "+totalEmpWage ;
}
}
}
| [
"[email protected]"
] | |
85a8d364f276acea70b693f0f562a86cdf544be0 | 4b70d2b6ce782ccd69838eea8432e2f531b9d553 | /src/main/java/net/excentrix/core/WatchDog/watchDogBan.java | 9b330cbfc508c542103e3aea614b392b0ca525c1 | [] | no_license | MichaelMBrown/Atom | f359b2df821a6f65c1d5017a9ef3e0740c5c03ab | cd63a9b518233b6b712f953a2a7c9faab06ce854 | refs/heads/master | 2023-06-09T15:58:13.740982 | 2021-07-02T02:24:52 | 2021-07-02T02:24:52 | 218,404,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,079 | java | package net.excentrix.core.WatchDog;
import net.excentrix.core.utils.coreUtils;
import org.bukkit.BanList;
import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
import java.util.UUID;
public class watchDogBan implements CommandExecutor {
@Override
public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
if (commandSender instanceof ConsoleCommandSender || coreUtils.getRankInteger(commandSender.getName()) >= 2) {
String reason = "Cheating through the Unfair use of Modifications";
if (strings.length == 1) {
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(strings[0]);
OfflinePlayer targetPlayer;
if (offlinePlayer.hasPlayedBefore()) {
targetPlayer = Bukkit.getOfflinePlayer(offlinePlayer.getUniqueId());
} else targetPlayer = null;
if (targetPlayer != null) {
if (targetPlayer.isBanned()){
BanList banList = Bukkit.getBanList(BanList.Type.NAME);
coreUtils.errorMessage((Player) commandSender,"This player is already banned, they were banned by "+banList.getBanEntry(targetPlayer.getName()).getSource()+" with reason: "+banList.getBanEntry(targetPlayer.getName()).getReason());
}else{
targetPlayer.banPlayer(reason, null, commandSender.getName(), true);
if (commandSender instanceof ConsoleCommandSender)
coreUtils.notifyStaff("watchdog", "banned player " + targetPlayer.getName() + " for " + reason + ".");
else
coreUtils.notifyStaff("none", commandSender.getName() + " banned player " + targetPlayer.getName() + " for " + reason + ".");
}
} else {
coreUtils.playerDoesntExist((Player) commandSender);
}
} else coreUtils.printUsage((Player) commandSender, "ban", "<player>");
} else coreUtils.errorMessage((Player) commandSender, "You must be a Mod or higher to use this command!");
return true;
}
}
| [
"[email protected]"
] | |
30355a2916f124a5cbfdbb74e950f53cedba4b53 | 75bd2ac10b887b85f55638de3e383fa5f4cd7f4d | /Maiden-Hotels - backend/Backend/src/main/java/com/maidenhotels/Backend/security/models/ClientDetailsModel.java | 56ce7e531408ee92fede602d2ed2c5ee19b68f50 | [] | no_license | Diogofbs/Maiden-Hotel-Resort | d8449019f6a7f3647224bf4e4f3f148cf7b9da5f | b249f587b381fab5bb2485cbcdea4d5f74300267 | refs/heads/master | 2023-01-20T13:15:01.553019 | 2019-12-09T10:23:27 | 2019-12-09T10:23:27 | 217,553,914 | 1 | 0 | null | 2023-01-07T12:15:45 | 2019-10-25T14:40:13 | Java | UTF-8 | Java | false | false | 1,675 | java | package com.maidenhotels.Backend.security.models;
import com.maidenhotels.Backend.tibco.schemas.Client;
import com.maidenhotels.Backend.tibco.schemas.Guest;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
//Details: How to get username, password, roles and permission from clients
public class ClientDetailsModel implements UserDetails {
private Client client;
private Guest guest;
public ClientDetailsModel(Client client, Guest guest) {
this.client = client;
this.guest = guest;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
List<GrantedAuthority> authorities = new ArrayList<>();
try{
GrantedAuthority authority = new SimpleGrantedAuthority("ROLE_" + "CLIENT");
authorities.add(authority);
}catch(Exception e){
e.printStackTrace();
}
return authorities;
}
@Override
public String getPassword() {
return this.client.getPassword();
}
@Override
public String getUsername() {
return this.guest.getEmail();
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"[email protected]"
] | |
c1937a9416a83a77e0cd7ab2369b519ea0b29980 | e90e12fa65d06b52de0cf0c173c2091edf3087d4 | /src/main/java/com/dy/AutoTest/OperationPlatform/TestCases/OnlineRiskControl/SuspiciousTradeManagement/ProcessedSuspiciousTradeQueryPageTest.java | 10485c8e7ba94a3939cb585f1d772d0c101bc90c | [] | no_license | DyAutoTest/WebAutoTest | d663c2eeac86fbfa69e403d174b258c77c090a3a | 9e5902a7b050917161bb5d22615cbbfae2e5d216 | refs/heads/master | 2020-04-04T09:59:23.287575 | 2019-03-18T05:31:07 | 2019-03-18T05:31:07 | 155,838,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,478 | java | package com.dy.AutoTest.OperationPlatform.TestCases.OnlineRiskControl.SuspiciousTradeManagement;
import java.lang.reflect.Method;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.dy.AutoTest.web.api.SuperTest;
import com.dy.AutoTest.OperationPlatform.PageObject.OnlineRiskControl.SuspiciousTradeManagement.ProcessedSuspiciousTradeQueryPage;
import com.dy.AutoTest.OperationPlatform.POJO.SuspiciousTradeManagement_ProcessedSuspiciousTradeQueryBean;
import com.dy.AutoTest.web.business.DataBusiness;
public class ProcessedSuspiciousTradeQueryPageTest extends SuperTest{
ProcessedSuspiciousTradeQueryPage ProcessedSuspiciousTradeQueryPage;
String URL;
@BeforeClass
public void init() {
/******** instant objectPage *********/
ProcessedSuspiciousTradeQueryPage=new ProcessedSuspiciousTradeQueryPage(driver);
//ProcessedSuspiciousTradeQueryPage.setWaitTime(800);
/******** set URL *********/
URL=host.toString()+DataBusiness.getData_URL("pop_SuspiciousTradeManagement_ProcessedSuspiciousTradeQuery");
/******** instant Interface *********/
iQuery=ProcessedSuspiciousTradeQueryPage;
// iClickButton=ProcessedSuspiciousTradeQueryPage;
// iClickRadio=ProcessedSuspiciousTradeQueryPage;
// iSearchMerchant=ProcessedSuspiciousTradeQueryPage;
}
@DataProvider(name="SuspiciousTradeManagement_ProcessedSuspiciousTradeQuery")
protected static Object[][] parametersPool(){
data.loadDataBeanList("POP_Data_SuspiciousTradeManagement_ProcessedSuspiciousTradeQuery");
return data.getDataBeanArray();
}
@DataProvider(name="SuspiciousTradeManagement_ProcessedSuspiciousTradeQueryByCaseNO")
protected static Object[][] parametersPool(Method method){
data.loadDataBeanList("POP_Data_SuspiciousTradeManagement_ProcessedSuspiciousTradeQuery",method.getName());
return data.getDataBeanArray();
}
@Test(dataProvider="SuspiciousTradeManagement_ProcessedSuspiciousTradeQueryByCaseNO")
public void testQuery(SuspiciousTradeManagement_ProcessedSuspiciousTradeQueryBean bean) {
ProcessedSuspiciousTradeQueryPage.navigateTo(URL);
wait.waitFor(500);
if(!bean.getMonitorRule().equals("")) {
ProcessedSuspiciousTradeQueryPage.selectMonitorRule(bean.getMonitorRule());
doQuery();
}
if(!bean.getMerchantNOPhoneNO().equals("")) {
ProcessedSuspiciousTradeQueryPage.setMerchantNOPhoneNO(bean.getMerchantNOPhoneNO());
doQuery();
}
}
@Test(dataProvider="SuspiciousTradeManagement_ProcessedSuspiciousTradeQueryByCaseNO")
public void testCheck(SuspiciousTradeManagement_ProcessedSuspiciousTradeQueryBean bean) {
ProcessedSuspiciousTradeQueryPage.navigateTo(URL);
wait.waitFor(500);
doQueryForClickButton(bean);
ProcessedSuspiciousTradeQueryPage.clickCheck();
wait.waitFor(2000);
ProcessedSuspiciousTradeQueryPage.clickCheck_Close();
}
public void doQueryForClickButton(SuspiciousTradeManagement_ProcessedSuspiciousTradeQueryBean bean) {
if(!bean.getMonitorRule().equals("")) {
ProcessedSuspiciousTradeQueryPage.selectMonitorRule(bean.getMonitorRule());
}
if(!bean.getMerchantNOPhoneNO().equals("")) {
ProcessedSuspiciousTradeQueryPage.setMerchantNOPhoneNO(bean.getMerchantNOPhoneNO());
}
ProcessedSuspiciousTradeQueryPage.clickQuery();
wait.waitFor(500);
ProcessedSuspiciousTradeQueryPage.clickRadio(bean.getRadio());
wait.waitFor(500);
}
} | [
"[email protected]"
] | |
1981a3c0899e2586876c91a7482e2510964afff6 | ea54b9542e1e99b2f6f47c49e42ae6d444e3fdf4 | /Backend/src/main/java/net/ddns/tccapp/controller/PublicController.java | c51f158894b1a07a983cf3389ed145873582c339 | [] | no_license | vunter/tcc | 33a9b90550d6dc8a200c2adbf575e7bb01a79538 | a124f9a16d8fb135df98ad28f4ff7f2ea8f3ebac | refs/heads/master | 2023-02-01T07:07:48.366608 | 2020-12-18T01:26:10 | 2020-12-18T01:26:10 | 306,684,635 | 1 | 0 | null | 2020-12-07T01:50:45 | 2020-10-23T16:05:23 | Java | UTF-8 | Java | false | false | 1,157 | java | package net.ddns.tccapp.controller;
import lombok.RequiredArgsConstructor;
import net.ddns.tccapp.model.dto.TurmaDTO;
import net.ddns.tccapp.model.service.TurmaService;
import net.ddns.tccapp.model.service.UsuarioService;
import net.ddns.tccapp.model.vo.UserVO;
import org.springframework.http.HttpStatus;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/api/public")
@RequiredArgsConstructor
public class PublicController {
private final PasswordEncoder passwordEncoder;
private final UsuarioService usuarioService;
private final TurmaService turmaService;
@PostMapping("salvar")
@ResponseStatus(HttpStatus.CREATED)
public UserVO salvar(@RequestBody @Valid UserVO usuario) {
usuario.setPassword(passwordEncoder.encode(usuario.getPassword()));
return usuarioService.salvar(usuario);
}
@GetMapping("turmas")
@ResponseStatus(HttpStatus.OK)
public List<TurmaDTO> listPublicTurmas() {
return turmaService.findAllPublic();
}
}
| [
"[email protected]"
] | |
228ea4fd27d627b3f9cfcbd3fad3b605fd6566a2 | 72d7fa48973e31e816be076c2b97226186d41bd3 | /nivel2_leccion4_clases_abstractas_interfaces/Interfaces/src/accesodatos/ImplementacionOracle.java | d4933c5c99de8502ff47f41a1c096ab6ab9822bd | [] | no_license | eugenia1984/Universidad-Java-Udemy | e50716388177cda6d5da2588722634d20e2dd1a9 | b2111487792a50931816ec7428899039ff768f86 | refs/heads/main | 2023-08-15T09:43:56.091403 | 2021-10-09T18:02:44 | 2021-10-09T18:02:44 | 378,520,985 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 527 | java | package accesodatos;
public class ImplementacionOracle implements IAccesoDatos{
@Override
public void insertar() {
System.out.println("Insertar desde Oracle");
}
@Override
public void listar() {
System.out.println("Listar desde Oracle");
}
@Override
public void actualizar() {
System.out.println("Actualizar desde Oracle");
}
@Override
public void eliminar() {
System.out.println("Eliminar desde Oracle");
}
}
| [
"[email protected]"
] | |
c09b467a14d00c46d8e985b612a1e7ec8d30683a | 38f8654ef209f4b709620dce117d97464010f817 | /furms-integration-tests/src/test/java/io/imunity/furms/integration/tests/security/alarms/FiredAlarmsServiceSecurityTest.java | fcb2426b56f86206dc19601690030bd4e810f854 | [
"BSD-2-Clause"
] | permissive | unity-idm/furms | 2a41699eb77f582d2439b6e6a49c0ced1cdb6a7a | 3d66992bad72b782006c292612669107a9bffbc2 | refs/heads/dev | 2023-08-31T11:10:57.576761 | 2023-08-23T11:41:17 | 2023-08-23T11:41:17 | 293,072,384 | 4 | 1 | BSD-2-Clause | 2022-05-30T13:36:26 | 2020-09-05T12:34:25 | Java | UTF-8 | Java | false | false | 2,069 | java | /*
* Copyright (c) 2021 Bixbit s.c. All rights reserved.
* See LICENSE file for licensing information.
*/
package io.imunity.furms.integration.tests.security.alarms;
import io.imunity.furms.api.alarms.FiredAlarmsService;
import io.imunity.furms.integration.tests.security.SecurityTestsBase;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static io.imunity.furms.integration.tests.security.SecurityTestRulesValidator.forMethods;
import static io.imunity.furms.integration.tests.tools.users.TestUsersProvider.basicUser;
import static io.imunity.furms.integration.tests.tools.users.TestUsersProvider.communityAdmin;
import static io.imunity.furms.integration.tests.tools.users.TestUsersProvider.fenixAdmin;
import static io.imunity.furms.integration.tests.tools.users.TestUsersProvider.projectAdmin;
import static io.imunity.furms.integration.tests.tools.users.TestUsersProvider.projectUser;
import static io.imunity.furms.integration.tests.tools.users.TestUsersProvider.siteAdmin;
import static io.imunity.furms.integration.tests.tools.users.TestUsersProvider.siteSupport;
class FiredAlarmsServiceSecurityTest extends SecurityTestsBase {
@Autowired
private FiredAlarmsService service;
@Test
void shouldAllPublicMethodsHaveSecurityAnnotation() {
assertThatAllInterfaceMethodsHaveBeenAnnotatedWithSecurityAnnotation(FiredAlarmsService.class, service);
}
@Test
void shouldPassForSecurityRulesForMethodsInProjectApplicationsService() {
forMethods(
() -> service.findAllFiredAlarmsOfCurrentUser())
.accessFor(
basicUser(),
fenixAdmin(),
siteAdmin(site),
siteAdmin(otherSite),
siteSupport(site),
siteSupport(otherSite),
communityAdmin(community),
communityAdmin(otherCommunity),
projectAdmin(community, project),
projectAdmin(otherCommunity, otherProject),
projectUser(community, project),
projectUser(otherCommunity, otherProject))
.verifySecurityRulesAndInterfaceCoverage(FiredAlarmsService.class, server);
}
}
| [
"[email protected]"
] | |
9364b1ead258d0e0868d030b04995ae6ec3d7ffd | b637b1e8cf28b2b56aef9f3db0ca8ce4dc5fadba | /src/A_Star_Algorithm/EnhancedAStar1.java | e9ea87efea28c5acab8fea8359e7709a4f68720f | [] | no_license | YOUNGLOT/A_Star_Algorithm | 36867193a71f21ab4e029d09e29dd964edaf1deb | 95d52d07f60890042b38ddf45369c00b2878ff6a | refs/heads/master | 2023-01-09T19:15:59.038341 | 2020-11-05T15:37:04 | 2020-11-05T15:37:04 | 308,778,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,957 | java | package A_Star_Algorithm;
import java.util.*;
class Data {
private String key;
private int[][] array;
public Data(String key, int[][] array) {
this.key = key;
this.array = array;
}
public String getKey() {
return key;
}
public int[][] getArray() {
return array;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Data data = (Data) o;
return Objects.equals(key, data.key) &&
Arrays.equals(array, data.array);
}
@Override
public int hashCode() {
int result = Objects.hash(key);
result = 31 * result + Arrays.hashCode(array);
return result;
}
}
public class EnhancedAStar1 {
private final int[][] GOAL_ARRAY; // 목표 Array
private String resultKey = "5"; // 결과값을 넣을 필드
private int[][] resultArray;
private int loopCount = 0;
// 우선순위 큐
private final PriorityQueue<Data> priorityQueue = new PriorityQueue<Data>(new Comparator<Data>() {
// 큐 내부에서 우선순위를 매길 때 사용하는 함수
@Override
public int compare(Data data1, Data data2) {
// 두 Data 를 비교해 우선순위 를 int 값으로 return
int score = getTriageScore_Difference(data1, data2);
// 2증 삼항 연산자 사용해 봤습니다.
return (score == 0) ? 0 : (score > 0) ? 1 : -1;
// if (score == 0) {
// return 0;
// }
// return (score > 0) ? 1 : -1;
//region TriageScore 함수 (우선순위 함수)
}
// 우선순위를 정하는 함수 (모든 case 마다 2중포문이 2번씩 돌아감 -> 2중포문 한번으로 축약)
// private int getTriageScore(Data data) {
// String key = data.getKey();
// int[][] array = data.getArray();
// // default 0
// int matchPoint = 0;
//
// // 다른 항목이 있을 때 마다 matchPolong++
// for (int i = 0; i < array.length; i++) {
// for (int j = 0; j < array[i].length; j++) {
// if (GOAL_ARRAY[i][j] != array[i][j]) {
// matchPoint++;
// }
// }
// }
//
// // value가 같은 Array 일 경우 결과값 등록!
// if (matchPoint == 0) {
// resultKey = key;
// resultArray = array;
// }
//
// return matchPoint + key.length();
// }
// 원래 1개의 Data에 맞는 TriageScore를 Return 하였으나 , 2중 for문이 있기 때문에 Triage의 비교에 사용 할 때 한번에 두 값을 get
private int getTriageScore_Difference(Data data1, Data data2) {
String key1 = data1.getKey(), key2 = data2.getKey();
int[][] array1 = data1.getArray(), array2 = data2.getArray();
int score1 = 0, score2 = 0;
for (int i = 0; i < array1.length; i++) {
for (int j = 0; j < array1[i].length; j++) {
if (GOAL_ARRAY[i][j] != array1[i][j]) {
score1++;
}
if (GOAL_ARRAY[i][j] != array2[i][j]) {
score2++;
}
}
}
if (score1 == 0) {
resultKey = key1;
resultArray = array1;
}
if (score2 == 0) {
resultKey = key2;
resultArray = array2;
}
return (score1 + key1.length()/5) - (score2 + key2.length()/5);
}
//endregion
}) {
// 중복값 확인 Set (Queue 필드)
private final Set<Integer> data_ArrayHashCodeSet = new HashSet<>();
private final Set<int[][]> data_ArraySet = new HashSet<>();
// offer Method 호출시 중복확인 작업 후 실행
@Override
public boolean offer(Data data) {
// HashCode 추출 후
int arrayHashCode = data.getArray().hashCode();
// Set에서 확인함
if (data_ArrayHashCodeSet.contains(arrayHashCode)) {
// HashCode가 중복되면 Array 자체를 비교
int[][] dataArray = data.getArray();
if (data_ArraySet.contains(dataArray)) {
return false;
}
data_ArraySet.add(dataArray);
}
// Set에 없을 경우 등록
data_ArrayHashCodeSet.add(arrayHashCode);
// HashCode 가 겹친 이력이 있는 Array를 적재 하는게 (메모리 && 시간) 이득이였음 -> 주석처리함
// data_ArraySet.add(((Data) data).getArray());
loopCount++;
// 상위 클래스 offer 호출
return super.offer(data);
}
};
// 생성자
public EnhancedAStar1(int[][] goalArray, int[][] inputArray) {
// 인풋값으로 필드 생성
GOAL_ARRAY = goalArray;
// 큐에 처음에 실행 될 Input_Array를 넣는다 (Key = 5 는 unique한 숫자라 넣음)
priorityQueue.offer(new Data("5", inputArray));
}
public static void main(String[] args) {
//region 샘플용 Arrays
//3x3
// int[][] goalArray = {{1, 2, 3}, {8, 0, 4}, {7, 6, 5}};
// int[][] inputArray = {{2, 8, 3}, {1, 6, 4}, {7, 0, 5}};
//4x4
// int[][] goalArray = {{ 4, 1, 6, 2}, {8, 5, 0, 3}, {9, 10, 14, 7}, {12, 13, 15, 11}};
// int[][] inputArray = {{ 4, 1, 2, 3}, {5, 6, 10, 7}, {8, 9, 11, 15}, {0, 12, 13, 14}};
//5x5
// int[][] goalArray = {{ 5, 2, 7, 3, 4}, {6, 1, 12, 9, 0}, {10, 16, 11, 8, 13}, {15, 17, 18, 19, 14}, {20, 21, 22, 23, 24}};
// int[][] inputArray = {{ 5, 1, 2, 3, 4}, {6, 7, 8, 13, 9}, {10, 11, 12, 18, 14}, {15, 16, 22, 17, 19}, {0, 20, 21, 23, 24}};
//6x6
// int[][] goalArray = {{ 6, 2, 8, 3, 4, 5}, {0, 7, 1, 9, 10, 11}, {12, 13, 14, 15, 16, 17}, {18, 19, 20, 21, 22, 23}, {24, 25, 26, 27, 28, 29}, {30, 31, 32, 33, 34, 35}};
// int[][] inputArray = {{ 1, 7, 2, 3, 4, 5}, {6, 13, 8, 9, 10, 11}, {12, 19, 14, 15, 16, 17}, {18, 20, 26, 21, 22, 23}, {24, 25, 27, 28, 34, 29}, {30, 31, 32, 33, 0, 35}};
//7x7
// int[][] goalArray = {{ 1, 2, 3, 4, 0, 5, 6}, {7, 8, 9, 10, 11, 12, 13}, {14, 15, 16, 17, 18, 19, 20}, {21, 22, 23, 24, 25, 26, 27}, {28, 29, 30, 31, 32, 33, 34}, {35, 36, 37, 38, 39, 40, 41}, {42, 43, 44, 45, 46, 47, 48}};
// int[][] inputArray = {{ 7, 1, 2, 3, 4, 5, 6}, {8, 15, 9, 10, 11, 12, 13}, {14, 22, 16, 17, 18, 19, 20}, {21, 29, 23, 24, 25, 26, 27}, {28, 36, 30, 31, 32, 33, 34}, {35, 43, 37, 38, 39, 40, 41}, {42, 0, 44, 45, 46, 47, 48}};
//8x8
int[][] goalArray = {{8, 1, 2, 3, 4, 14, 5, 7}, {9, 17, 10, 12, 13, 6, 15, 0}, {16, 25, 18, 11, 20, 21, 22, 23}, {24, 26, 34, 19, 28, 29, 30, 31}, {32, 33, 42, 27, 36, 37, 38, 39}, {40, 41, 43, 35, 44, 45, 46, 47}, {48, 49, 50, 51, 52, 53, 54, 55}, {56, 57, 58, 59, 60, 61, 62, 63}};
int[][] inputArray = {{1, 2, 10, 3, 4, 5, 6, 7}, {16, 8, 9, 11, 12, 13, 14, 15}, {24, 17, 18, 19, 20, 21, 22, 23}, {32, 25, 26, 27, 28, 29, 30, 31}, {40, 33, 34, 35, 36, 37, 38, 39}, {48, 41, 42, 43, 44, 45, 46, 47}, {56, 49, 50, 51, 52, 53, 54, 55}, {57, 58, 59, 0, 60, 61, 62, 63}};
//9x9
// int[][] goalArray = {{ 9, 1, 2, 3, 4, 5, 6, 7, 8}, {18, 10, 11, 12, 13, 14, 15, 16, 17}, {27, 19, 20, 21, 22, 23, 24, 25, 26}, {36, 28, 29, 30, 31, 32, 33, 34, 35}, {45, 37, 38, 39, 40, 41, 42, 43, 44}, {54, 46, 47, 48, 49, 50, 51, 52, 53}, {0, 55, 56, 57, 58, 59, 60, 61, 62}, {63, 64, 65, 66, 67, 68, 69, 70, 71}, {72, 73, 74, 75, 76, 77, 78, 79, 80}};
// int[][] inputArray = {{ 1, 2, 11, 3, 4, 5, 6, 7, 8}, {9, 10, 12, 13, 14, 15, 16, 17, 26}, {18, 19, 20, 21, 22, 23, 24, 25, 35}, {27, 28, 29, 30, 31, 32, 33, 34, 44}, {36, 37, 38, 39, 40, 41, 42, 43, 53}, {45, 46, 47, 48, 49, 59, 50, 51, 52}, {54, 55, 65, 56, 57, 58, 60, 61, 62}, {63, 64, 74, 66, 67, 68, 69, 70, 71}, {72, 0, 73, 75, 76, 77, 78, 79, 80}};
// int[][] goalArray = {{ 1, 5, 2, 3}, {0, 9, 7, 11}, {4, 13, 10, 6}, {8, 12, 14, 15}};
// int[][] inputArray = {{ 9, 2, 3, 0}, {1, 7, 6, 11}, {5, 8, 14, 10}, {13, 4, 12, 15}};
//endregion
// int[][] goalArray = {{1, 2, 3, 7}, {4, 0, 11, 14}, {8, 5, 15, 6}, {12, 10, 9, 13}};
// int[][] inputArray = {{1, 5, 2, 7}, {10, 8, 6, 3}, {4, 14, 11, 13}, {12, 15, 0, 9}};
// 객체 생성
EnhancedAStar1 enhancedAStar = new EnhancedAStar1(goalArray, inputArray);
enhancedAStar.solve();
}
public void solve() {
// Queue에 처리 할 값이 있고, 결과값이 없을 때 : 반복
while (priorityQueue.size() != 0 && resultKey.length() == 1) {
// Data 를 Peek!!!!
Data data = priorityQueue.peek();
priorityQueue.remove(data);
String key = data.getKey();
int[][] array = data.getArray();
// 0의 좌표값을 가져온다 (x, y)
int x = -1, y = -1;
outer:
// outer : 다중 반복문을 한번에 나오는 키워드!
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
if (array[i][j] == 0) {
x = j;
y = i;
break outer;
}
}
}
//이전 작업과 반대 되는 작업을 막기 위해 Key의 끝자리를 cut!
String lastLet = key.substring(key.length() - 1);
// {상, 우, 하, 좌} 로 빈 공간이 이동한 경우
if (y - 1 >= 0 && !lastLet.equals("3")) { // 움직일 수 없거나, 이전 작업과 반대되는 작업을 피하는 조건문
// Array를 만들고 triageMap에 넣는 작업 *offer() 함수를 Overriding 해서 중복 제거를 함
priorityQueue.offer(new Data(key + "1", getMovedArray(x, y, x, y - 1, array)));
} //상
if (x + 1 < array.length && !lastLet.equals("4")) {
priorityQueue.offer(new Data(key + "2", getMovedArray(x, y, x + 1, y, array)));
} //우
if (y + 1 < array.length && !lastLet.equals("1")) {
priorityQueue.offer(new Data(key + "3", getMovedArray(x, y, x, y + 1, array)));
} //하
if (x - 1 >= 0 && !lastLet.equals("2")) {
priorityQueue.offer(new Data(key + "4", getMovedArray(x, y, x - 1, y, array)));
} //좌
}
int resultLength = resultKey.length();
// 결과를 출력
if (resultKey.length() == 1) {
System.out.println("이동 가능한 경로가 없습니다.");
} else {
// 목표 Array 출력
printDirectionAndArray("목표 Array", GOAL_ARRAY);
// 재귀함수로 그동안의 과정을 구현
printProcess_recursive();
}
}
public String solve_Return() {
// Queue에 처리 할 값이 있고, 결과값이 없을 때 : 반복
while (priorityQueue.size() != 0 && resultKey.length() == 1) {
// Data 를 Peek!!!!
Data data = priorityQueue.peek();
priorityQueue.remove(data);
String key = data.getKey();
int[][] array = data.getArray();
// 0의 좌표값을 가져온다 (x, y)
int x = -1, y = -1;
outer:
// outer : 다중 반복문을 한번에 나오는 키워드!
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
if (array[i][j] == 0) {
x = j;
y = i;
break outer;
}
}
}
//이전 작업과 반대 되는 작업을 막기 위해 Key의 끝자리를 cut!
String lastLet = key.substring(key.length() - 1);
// {상, 우, 하, 좌} 로 빈 공간이 이동한 경우
if (y - 1 >= 0 && !lastLet.equals("3")) { // 움직일 수 없거나, 이전 작업과 반대되는 작업을 피하는 조건문
// Array를 만들고 triageMap에 넣는 작업 *offer() 함수를 Overriding 해서 중복 제거를 함
priorityQueue.offer(new Data(key + "1", getMovedArray(x, y, x, y - 1, array)));
} //상
if (x + 1 < array.length && !lastLet.equals("4")) {
priorityQueue.offer(new Data(key + "2", getMovedArray(x, y, x + 1, y, array)));
} //우
if (y + 1 < array.length && !lastLet.equals("1")) {
priorityQueue.offer(new Data(key + "3", getMovedArray(x, y, x, y + 1, array)));
} //하
if (x - 1 >= 0 && !lastLet.equals("2")) {
priorityQueue.offer(new Data(key + "4", getMovedArray(x, y, x - 1, y, array)));
} //좌
}
int resultLength = resultKey.length();
// 결과를 출력
// if (resultKey.length() == 1) {
// System.out.println("이동 가능한 경로가 없습니다.");
// } else {
// // 목표 Array 출력
// printDirectionAndArray("목표 Array", GOAL_ARRAY);
// // 재귀함수로 그동안의 과정을 구현
// printProcess_recursive();
// }
return String.valueOf(loopCount) + "," + String.valueOf(resultLength);
}
// movedX, movedY 로 빈칸이 움직인 Array를 반환 (조건은 상위 코드에서 충족)
// print 에서 재사용 됩니다.
private int[][] getMovedArray(int x, int y, int movedX, int movedY, int[][] array) {
// DeepClone 한 Array 생성
int[][] newArray = cloneArray(array);
// 움직일 좌표의 value를 0의 좌표에 넣고, 움직일 좌표에 0을 대입
int value = array[movedY][movedX];
newArray[movedY][movedX] = 0;
newArray[y][x] = value;
return newArray;
}
//region DeepClone 함수
// DeepClone 함수 (2차 배열은 DeepClone 함수가 없더라구요;;;
private int[][] cloneArray(int[][] array) {
int[][] newArray = new int[array.length][array.length];
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
newArray[i][j] = array[i][j];
}
}
return newArray;
}
//endregion
//region Print 함수
// 풀이 과정을 프린트 하는 함수
private void printProcess_recursive() {
/* 재귀함수로 구현해 보았습니다.
풀이 과정 Array를 저장 할 수도 있지만
우리의 메모리는 소중하기 때문에
*풀이과정 Array는 과감히 버리고
결과값 resultKey (수행 횟수와 , 빈칸의 이동 방향의 정보 내포) 로
풀이과정 Array를 구해보았습니다.
*/
// 매개처럼 활용 된 key값 출력
System.out.printf(" Key : %s\n", resultKey);
// 시작 Array의 키값 (length == 1) 일때 멈춤
if (resultKey.length() == 1) {
return;
} else {
// Array를 Key값에 따라 움직인 후 출력
printDeMovedArray_By_LastLet(resultKey.substring(resultKey.length() - 1));
// 매개변수 대신 멤버변수 를 사용 (재귀함수의 매개변수와 같은 역할)
resultKey = resultKey.substring(0, resultKey.length() - 1);
// 재귀 함수 호출
printProcess_recursive();
}
}
// 매개변수의 String에 따라 움직인 Array를 출력해주는 함수
private void printDeMovedArray_By_LastLet(String string) {
// 0의 좌표를 구한 후
int x = -1, y = -1;
for (int i = 0; i < resultArray.length; i++) {
for (int j = 0; j < resultArray[i].length; j++) {
if (resultArray[i][j] == 0) {
x = j;
y = i;
}
}
}
// Key의 Last Letter 에 맞게 반대로 움직인 후 -> 필드에 저장 -> 출력
if (string.equals("1")) {
printDirectionAndArray("up", resultArray = getMovedArray(x, y, x, y + 1, resultArray));
return;
}
if (string.equals("2")) {
printDirectionAndArray("right", resultArray = getMovedArray(x, y, x - 1, y, resultArray));
return;
}
if (string.equals("3")) {
printDirectionAndArray("down", resultArray = getMovedArray(x, y, x, y - 1, resultArray));
return;
}
if (string.equals("4")) {
printDirectionAndArray("left", resultArray = getMovedArray(x, y, x + 1, y, resultArray));
return;
}
}
// Key 와 Array를 print 하는 함수
private void printDirectionAndArray(String direction, int[][] array) {
System.out.printf(" direct : %s\n------------------\n", direction);
for (int i = 0; i < array.length; i++) {
for (int j = 0; j < array[i].length; j++) {
int num = array[i][j];
if ((num == 0)) {
System.out.printf(" ");
} else {
System.out.printf("% 4d ", num);
}
}
System.out.println();
}
System.out.println("------------------");
}
//endregion
}
| [
"[email protected]"
] | |
4ee31f591c0698e2a1b37c159db20b3d9dfb0104 | 475d26efe0b4829b7f1da85ea481fb9fd7378c66 | /bundles/plugins/org.bonitasoft.studio.properties/src/org/bonitasoft/studio/properties/sections/message/wizards/AddMessageEventWizardPage.java | 5bd7e8d4575ade19833becf8ee2029f444d10d5f | [] | no_license | khurramshehzad/bonita-studio | 1b5b515f35cc72adc8245108069df6f9dbbe964e | 5aaedcad48faf507f50259265459f035782df4f7 | refs/heads/master | 2021-05-01T03:52:06.690030 | 2014-10-24T21:40:19 | 2014-10-24T21:40:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 26,424 | java | /**
* Copyright (C) 2009-2012 BonitaSoft S.A.
* BonitaSoft, 32 rue Gustave Eiffel - 38000 Grenoble
*
* 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 2.0 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 org.bonitasoft.studio.properties.sections.message.wizards;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.bonitasoft.studio.common.ExpressionConstants;
import org.bonitasoft.studio.common.emf.tools.ModelHelper;
import org.bonitasoft.studio.common.repository.RepositoryManager;
import org.bonitasoft.studio.diagram.custom.repository.DiagramRepositoryStore;
import org.bonitasoft.studio.expression.editor.filter.AvailableExpressionTypeFilter;
import org.bonitasoft.studio.expression.editor.provider.IExpressionNatureProvider;
import org.bonitasoft.studio.expression.editor.viewer.ExpressionCollectionViewer;
import org.bonitasoft.studio.expression.editor.viewer.ExpressionViewer;
import org.bonitasoft.studio.expression.editor.viewer.LineTableCreator;
import org.bonitasoft.studio.model.expression.Expression;
import org.bonitasoft.studio.model.expression.ExpressionFactory;
import org.bonitasoft.studio.model.expression.ListExpression;
import org.bonitasoft.studio.model.expression.TableExpression;
import org.bonitasoft.studio.model.process.AbstractProcess;
import org.bonitasoft.studio.model.process.CorrelationTypeActive;
import org.bonitasoft.studio.model.process.MainProcess;
import org.bonitasoft.studio.model.process.Message;
import org.bonitasoft.studio.model.process.ProcessFactory;
import org.bonitasoft.studio.model.process.ProcessPackage;
import org.bonitasoft.studio.model.process.ThrowMessageEvent;
import org.bonitasoft.studio.pics.Pics;
import org.bonitasoft.studio.properties.i18n.Messages;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.UpdateValueStrategy;
import org.eclipse.core.databinding.ValidationStatusProvider;
import org.eclipse.core.databinding.validation.IValidator;
import org.eclipse.core.databinding.validation.ValidationStatus;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.databinding.EMFObservables;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.jface.databinding.viewers.ViewersObservables;
import org.eclipse.jface.databinding.wizard.WizardPageSupport;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
/**
* @author Romain Bioteau
* @author Aurelien Pupier - integrate Correlation andf use databinding
* @author Aurelie Zara -integrate MessageContent Id and validation
*/
public class AddMessageEventWizardPage extends WizardPage implements
IWizardPage {
private final ThrowMessageEvent element;
private final Message originalMessage;
private String throwEvent;
private GridData gd;
private ExpressionViewer elementExpressionViewer;
private ExpressionViewer processExpressionViewer;
private final Message workingCopyMessage;
protected DataBindingContext databindingContext;
protected boolean allowSortOnCorrelation = true;
private CatchMessageEventNamesExpressionNatureProvider catchEventNatureProvider;
private WizardPageSupport pageSupport;
protected MainProcess diagram;
private Text nameText;
/**
* @param performer
* @param pageName
*/
protected AddMessageEventWizardPage(MainProcess diagram,
final ThrowMessageEvent element, Message originalMessage,
Message workingCopyMessage) {
super(Messages.messageEventAddWizardPageName,
Messages.messageEventAddWizardPageTitle, Pics.getWizban());
setDescription(Messages.messageEventAddWizardPageDesc);
this.element = element;
this.originalMessage = originalMessage;
if (originalMessage != null) {
if (originalMessage.getCorrelation() == null) {
originalMessage.setCorrelation(ProcessFactory.eINSTANCE
.createCorrelation());
}
}
if (workingCopyMessage == null) {
workingCopyMessage = ProcessFactory.eINSTANCE.createMessage();
}
if (workingCopyMessage.getCorrelation() == null) {
workingCopyMessage.setCorrelation(ProcessFactory.eINSTANCE
.createCorrelation());
}
this.workingCopyMessage = workingCopyMessage;
this.diagram = diagram;
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
* .Composite)
*/
@Override
public void createControl(Composite parent) {
databindingContext = new DataBindingContext();
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(GridLayoutFactory.fillDefaults().numColumns(2)
.spacing(15, 10).create());
createNameLine(composite);
createDescriptionLine(composite);
createProcessExpressionViewer(composite);
createComboEventLine(composite);
createTableFolder(composite);
pageSupport = WizardPageSupport.create(this, databindingContext);
setControl(composite);
}
private void createTableFolder(Composite composite) {
final TabFolder messageAndCorrelationFolder = new TabFolder(composite,
SWT.NONE);
messageAndCorrelationFolder.setLayout(GridLayoutFactory.fillDefaults()
.create());
messageAndCorrelationFolder.setLayoutData(GridDataFactory
.fillDefaults().grab(true, true).span(2, 1).create());
final TabItem messageContentTableItem = new TabItem(
messageAndCorrelationFolder, SWT.NONE);
messageContentTableItem.setText(Messages.addMessageContent);
final Composite messageContentComposite = new Composite(
messageAndCorrelationFolder, SWT.NONE);
createMessageContentComposite(messageContentComposite);
messageContentTableItem.setControl(messageContentComposite);
final TabItem correlationTableItem = new TabItem(
messageAndCorrelationFolder, SWT.NONE);
correlationTableItem.setText(Messages.correlation);
final Composite correlationComposite = new Composite(
messageAndCorrelationFolder, SWT.NONE);
createcorrelationComposite(correlationComposite);
correlationTableItem.setControl(correlationComposite);
}
private void createMessageContentComposite(Composite composite) {
composite.setLayout(GridLayoutFactory.fillDefaults().margins(5, 10)
.create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true)
.create());
final Label messageContentDescriptionLabel = new Label(composite,
SWT.NONE | SWT.WRAP);
messageContentDescriptionLabel.setLayoutData(GridDataFactory
.fillDefaults().grab(true, false).indent(12, 0).create());
messageContentDescriptionLabel
.setText(Messages.addMessageContentDescription);
final List<String> captions = new ArrayList<String>(2);
captions.add(Messages.messageContentID);
captions.add(Messages.expressionName);
final ExpressionCollectionViewer ecv = new ExpressionCollectionViewer(composite, 0, false, 2, true, captions, false, false);
ecv.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
ecv.setAddRowLabel(Messages.addMessageContentButton);
ecv.setRemoveRowLabel(Messages.removeMessageContent);
ecv.setLineTableCreator(new LineTableCreator(){
public ListExpression createListExpressionForNewLineInTable(int size) {
ListExpression rowExp = ExpressionFactory.eINSTANCE.createListExpression();
EList<Expression> expressions = rowExp.getExpressions();
for (int i = 0; i < size; i++) {
final Expression cellExpression = ExpressionFactory.eINSTANCE.createExpression();
if(i==0){
cellExpression.setReturnTypeFixed(true);
}
expressions.add(cellExpression);
}
return rowExp;
}
});
addMessageContentFilters(ecv);
ecv.setInput(element);
final TableExpression messageContent = getMessageContentTable();
ecv.setSelection(messageContent);
ecv.addModifyListener(new Listener() {
@Override
public void handleEvent(Event event) {
final IStatus status = AddMessageEventWizardPage.this
.validateId(workingCopyMessage.getMessageContent(),
Messages.addMessageContent);
updateValidationStatus(status);
}
});
ecv.setLayoutData(GridDataFactory.fillDefaults().grab(true, true)
.create());
}
private void addMessageContentFilters(final ExpressionCollectionViewer ecv) {
final List<ViewerFilter> filters = new ArrayList<ViewerFilter>(2);
filters.add(new AvailableExpressionTypeFilter(
new String[] { ExpressionConstants.CONSTANT_TYPE }){
});
filters.add(new AvailableExpressionTypeFilter(new String[] {
ExpressionConstants.CONSTANT_TYPE,
ExpressionConstants.SCRIPT_TYPE,
ExpressionConstants.PARAMETER_TYPE,
ExpressionConstants.VARIABLE_TYPE }));
ecv.setViewerFilters(filters);
}
private void createcorrelationComposite(Composite composite) {
composite.setLayout(GridLayoutFactory.fillDefaults().margins(5, 10)
.create());
composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true)
.create());
final Label correlationDescriptionLabel = new Label(composite, SWT.NONE
| SWT.WRAP);
correlationDescriptionLabel.setLayoutData(GridDataFactory
.fillDefaults().grab(true, false).indent(12, 0).create());
correlationDescriptionLabel.setText(Messages.correlationDescription);
final Button useCorrelationCheckbox = new Button(composite, SWT.CHECK);
useCorrelationCheckbox.setLayoutData(GridDataFactory.fillDefaults()
.grab(false, false).indent(12, 0).create());
final ControlDecoration correlationHelp = new ControlDecoration(
useCorrelationCheckbox, SWT.LEFT | SWT.CENTER);
correlationHelp.setImage(PlatformUI.getWorkbench().getSharedImages()
.getImage(ISharedImages.IMG_OBJS_INFO_TSK));
correlationHelp.setDescriptionText(Messages.correlationKeyHelp);
useCorrelationCheckbox.setText(Messages.useCorrelationkeys);
useCorrelationCheckbox.setSelection(false);
useCorrelationCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
super.widgetSelected(e);
if (!useCorrelationCheckbox.getSelection()) {
workingCopyMessage.getCorrelation().setCorrelationType(
CorrelationTypeActive.INACTIVE);
} else {
workingCopyMessage.getCorrelation().setCorrelationType(
CorrelationTypeActive.KEYS);
updateValidationStatus(AddMessageEventWizardPage.this
.hasAtLeastOneCorrelation(workingCopyMessage
.getCorrelation()
.getCorrelationAssociation()));
}
}
});
if (CorrelationTypeActive.KEYS.equals(workingCopyMessage
.getCorrelation().getCorrelationType())) {
useCorrelationCheckbox.setSelection(true);
updateValidationStatus(AddMessageEventWizardPage.this
.hasAtLeastOneCorrelation(workingCopyMessage
.getCorrelation().getCorrelationAssociation()));
} else {
useCorrelationCheckbox.setSelection(false);
}
final Composite correlationComposite = new Composite(composite,
SWT.NONE);
correlationComposite.setLayoutData(GridDataFactory.fillDefaults()
.grab(true, true).create());
correlationComposite.setLayout(GridLayoutFactory.fillDefaults()
.create());
final List<String> captions = new ArrayList<String>(2);
captions.add(Messages.correlationKey);
captions.add(Messages.correlationValue);
final ExpressionCollectionViewer ecv = new ExpressionCollectionViewer(
correlationComposite, 5, false, 2, true, captions, false, true);
ecv.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
.hint(SWT.DEFAULT, 140).create());
ecv.setAddRowLabel(Messages.AddCorrelation);
ecv.setRemoveRowLabel(Messages.removeCorrelation);
final List<ViewerFilter> filters = new ArrayList<ViewerFilter>(2);
filters.add(new AvailableExpressionTypeFilter(
new String[] { ExpressionConstants.CONSTANT_TYPE }));
filters.add(new AvailableExpressionTypeFilter(new String[] {
ExpressionConstants.CONSTANT_TYPE,
ExpressionConstants.PARAMETER_TYPE,
ExpressionConstants.SCRIPT_TYPE,
ExpressionConstants.VARIABLE_TYPE })); // Second column has
// everything except
// Form field and
// simulation type
ecv.setViewerFilters(filters);
ecv.setInput(element);
final TableExpression correlationAssociation = getCorrelationTable();
ecv.setSelection(correlationAssociation);
ecv.addModifyListener(new Listener() {
@Override
public void handleEvent(Event event) {
IStatus status = AddMessageEventWizardPage.this.validateId(
workingCopyMessage.getCorrelation()
.getCorrelationAssociation(),
Messages.correlation);
updateValidationStatus(status);
}
});
final ISWTObservableValue observeSelectionUseCorrelation = SWTObservables
.observeSelection(useCorrelationCheckbox);
databindingContext.bindValue(
SWTObservables.observeEnabled(ecv.getViewer().getControl()),
observeSelectionUseCorrelation);
databindingContext.bindValue(
SWTObservables.observeEnabled(ecv.getAddRowButton()),
observeSelectionUseCorrelation);
databindingContext.bindValue(
SWTObservables.observeEnabled(ecv.getRemoveRowButton()),
observeSelectionUseCorrelation);
}
protected TableExpression getCorrelationTable() {
TableExpression correlationAssociation = workingCopyMessage
.getCorrelation().getCorrelationAssociation();
if (correlationAssociation == null) {
workingCopyMessage.getCorrelation().setCorrelationAssociation(
ExpressionFactory.eINSTANCE.createTableExpression());
correlationAssociation = workingCopyMessage.getCorrelation()
.getCorrelationAssociation();
}
return correlationAssociation;
}
protected void updateValidationStatus(IStatus status) {
if (status.isOK()) {
setErrorMessage(null);
Iterator<?> it = databindingContext.getValidationStatusProviders()
.iterator();
while (it.hasNext()) {
final ValidationStatusProvider provider = (ValidationStatusProvider) it
.next();
final IStatus iStatus = (IStatus) provider
.getValidationStatus().getValue();
if (!iStatus.isOK()) {
setErrorMessage(iStatus.getMessage());
} else {
setPageComplete(true);
}
}
setPageComplete(isPageComplete());
} else {
setErrorMessage(status.getMessage());
setPageComplete(false);
}
}
protected TableExpression getMessageContentTable() {
TableExpression messageContent = workingCopyMessage.getMessageContent();
if (messageContent == null) {
workingCopyMessage.setMessageContent(ExpressionFactory.eINSTANCE
.createTableExpression());
messageContent = workingCopyMessage.getMessageContent();
}
return messageContent;
}
protected IStatus hasAtLeastOneCorrelation(TableExpression expTable) {
if (expTable == null) {
return ValidationStatus.error(Messages.oneCorrelationAtLeastNeeded);
} else if (expTable.getExpressions().isEmpty()) {
return ValidationStatus.error(Messages.oneCorrelationAtLeastNeeded);
}
return Status.OK_STATUS;
}
protected IStatus validateId(TableExpression expTable, String tableName) {
final Set<String> ids = new HashSet<String>();
String duplicateId = null;
for (ListExpression row : expTable.getExpressions()) {
if (row.getExpressions().size() > 0) {
final Expression expr = row.getExpressions().get(0);
final Expression value = row.getExpressions().get(1);
if (ExpressionConstants.CONSTANT_TYPE.equals(expr.getType())) {
final String id = expr.getName();
if (id != null && ids.contains(id)) {
duplicateId = id;
return ValidationStatus.error(Messages.bind(
Messages.dublicateIdErrorMessage, duplicateId,
tableName));
} else {
if (ids != null && id != null && !id.isEmpty()) {
ids.add(id);
}
if (id != null && !id.isEmpty()
&& value.getName() == null) {
return ValidationStatus.error(Messages.bind(
Messages.valueShouldBeDefined, id));
}
if ((id == null || id.isEmpty())
&& value.getName() != null) {
return ValidationStatus
.error(Messages.bind(
Messages.idShouldBeDefined,
value.getName()));
}
}
}
}
if (tableName.equals(Messages.correlation)) {
if (CorrelationTypeActive.KEYS.equals(workingCopyMessage
.getCorrelation().getCorrelationType())) {
if (ids.isEmpty()) {
return ValidationStatus
.error(Messages.oneCorrelationAtLeastNeeded);
}
}
}
if (elementExpressionViewer == null
|| elementExpressionViewer.getTextControl().getText()
.isEmpty()) {
return ValidationStatus.error(Messages.eventNameLabel + " "
+ Messages.isMandatory);
}
if (processExpressionViewer == null
|| processExpressionViewer.getTextControl().getText()
.isEmpty()) {
return ValidationStatus.error(Messages.processNameLabel + " "
+ Messages.isMandatory);
}
if (nameText.getText() == null || nameText.getText().isEmpty()) {
return ValidationStatus.error(Messages.emptyName);
}
}
return Status.OK_STATUS;
}
private void createComboEventLine(Composite composite) {
Label eventNameLabel = new Label(composite, SWT.NONE);
eventNameLabel.setText(Messages.eventNameLabel + " *");
eventNameLabel.setLayoutData(GridDataFactory.fillDefaults()
.align(SWT.END, SWT.CENTER).create());
elementExpressionViewer = new ExpressionViewer(composite, SWT.BORDER,
ProcessPackage.Literals.MESSAGE__TARGET_ELEMENT_EXPRESSION);
elementExpressionViewer.getControl().setLayoutData(gd);
elementExpressionViewer.addFilter(new AvailableExpressionTypeFilter(
new String[] { ExpressionConstants.CONSTANT_TYPE,
ExpressionConstants.SCRIPT_TYPE,
ExpressionConstants.PARAMETER_TYPE,
ExpressionConstants.VARIABLE_TYPE }));
elementExpressionViewer.setMessage(Messages.targetEventMessageHint,
IStatus.INFO);
elementExpressionViewer.setMandatoryField(Messages.eventNameLabel,
databindingContext);
elementExpressionViewer.setContext(element);
catchEventNatureProvider = new CatchMessageEventNamesExpressionNatureProvider();
catchEventNatureProvider.setThrowMessage(element);
elementExpressionViewer
.setExpressionNatureProvider(catchEventNatureProvider);
if (workingCopyMessage.getTargetElementExpression() == null) {
final Expression createExpression = ExpressionFactory.eINSTANCE
.createExpression();
createExpression.setReturnTypeFixed(true);
createExpression.setReturnType(String.class.getName());
workingCopyMessage.setTargetElementExpression(createExpression);
}
elementExpressionViewer.setInput(workingCopyMessage);
refreshTargetEventContent();
databindingContext
.bindValue(
ViewersObservables
.observeSingleSelection(elementExpressionViewer),
EMFObservables
.observeValue(
workingCopyMessage,
ProcessPackage.Literals.MESSAGE__TARGET_ELEMENT_EXPRESSION));
}
private void createProcessExpressionViewer(Composite composite) {
final Label processNameLabel = new Label(composite, SWT.NONE);
processNameLabel.setLayoutData(GridDataFactory.fillDefaults()
.align(SWT.END, SWT.CENTER).create());
processNameLabel.setText(Messages.processNameLabel + " *");
processExpressionViewer = new ExpressionViewer(composite, SWT.BORDER,
ProcessPackage.Literals.MESSAGE__TARGET_PROCESS_EXPRESSION);
gd = new GridData(GridData.FILL_HORIZONTAL);
processExpressionViewer.getControl().setLayoutData(gd);
processExpressionViewer.addFilter(new AvailableExpressionTypeFilter(
new String[] { ExpressionConstants.CONSTANT_TYPE,
ExpressionConstants.SCRIPT_TYPE,
ExpressionConstants.PARAMETER_TYPE,
ExpressionConstants.VARIABLE_TYPE }));
processExpressionViewer.setMandatoryField(Messages.processNameLabel,
databindingContext);
processExpressionViewer.setMessage(Messages.targetProcessMessageHint,
IStatus.INFO);
final IExpressionNatureProvider provider = new ProcessNamesExpressionNatureProviderForMessage();
provider.setContext(element);
processExpressionViewer.setExpressionNatureProvider(provider);
processExpressionViewer.setContext(element);
if (workingCopyMessage.getTargetProcessExpression() == null) {
final Expression createExpression = ExpressionFactory.eINSTANCE
.createExpression();
createExpression.setReturnTypeFixed(true);
createExpression.setReturnType(String.class.getName());
workingCopyMessage.setTargetProcessExpression(createExpression);
}
processExpressionViewer.setInput(workingCopyMessage);
databindingContext
.bindValue(
ViewersObservables
.observeSingleSelection(processExpressionViewer),
EMFObservables
.observeValue(
workingCopyMessage,
ProcessPackage.Literals.MESSAGE__TARGET_PROCESS_EXPRESSION));
processExpressionViewer
.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
refreshTargetEventContent();
}
});
}
private Text createDescriptionLine(Composite composite) {
Label descLabel = new Label(composite, SWT.NONE);
descLabel.setLayoutData(GridDataFactory.fillDefaults()
.align(SWT.END, SWT.TOP).create());
descLabel.setText(Messages.dataDescriptionLabel);
final Text descText = new Text(composite, SWT.MULTI | SWT.BORDER);
gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
gd.heightHint = 45;
descText.setLayoutData(gd);
databindingContext.bindValue(SWTObservables.observeDelayedValue(200,
SWTObservables.observeText(descText, SWT.Modify)),
EMFObservables.observeValue(workingCopyMessage,
ProcessPackage.Literals.ELEMENT__DOCUMENTATION));
return descText;
}
private Text createNameLine(Composite composite) {
Label nameLabel = new Label(composite, SWT.NONE);
nameLabel.setLayoutData(GridDataFactory.fillDefaults()
.align(SWT.END, SWT.CENTER).create());
nameLabel.setText(Messages.dataNameLabel);
nameText = new Text(composite, SWT.BORDER);
nameText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false)
.create());
IValidator nameValidator = new IValidator() {
@Override
public IStatus validate(Object arg0) {
if (arg0 instanceof String) {
String s = (String) arg0;
if (s == null || s.isEmpty()) {
return ValidationStatus.error(Messages.emptyName);
} else {
List<Message> events = ModelHelper.getAllItemsOfType(
ModelHelper.getMainProcess(element),
ProcessPackage.eINSTANCE.getMessage());
for (Message ev : events) {
if (!ev.equals(originalMessage)
&& ev.getName().equals(s)) {
return ValidationStatus
.error(Messages.messageEventAddWizardNameAlreadyExists);
}
}
}
}
return ValidationStatus.ok();
}
};
UpdateValueStrategy uvs = new UpdateValueStrategy(/*
* UpdateValueStrategy.
* POLICY_CONVERT
*/);
uvs.setBeforeSetValidator(nameValidator);
databindingContext.bindValue(SWTObservables.observeDelayedValue(200,
SWTObservables.observeText(nameText, SWT.Modify)),
EMFObservables.observeValue(workingCopyMessage,
ProcessPackage.Literals.ELEMENT__NAME), uvs, null);
return nameText;
}
/**
* Refresh target combo content
*/
private void refreshTargetEventContent() {
if (processExpressionViewer.getSelection() != null
&& !processExpressionViewer.getSelection().isEmpty()) {
Expression procName = (Expression) ((StructuredSelection) processExpressionViewer
.getSelection()).getFirstElement();
if (procName.getType().equals(ExpressionConstants.CONSTANT_TYPE)) {
AbstractProcess proc = getProcessOnDiagram(
ModelHelper.getMainProcess(element),
procName.getContent());
DiagramRepositoryStore store = (DiagramRepositoryStore) RepositoryManager
.getInstance().getRepositoryStore(
DiagramRepositoryStore.class);
List<AbstractProcess> processes = store
.findProcesses(procName.getContent());
if (proc != null) {
processes.add(proc);
}
catchEventNatureProvider.setFoundProcesses(processes);
}else{
catchEventNatureProvider.setFoundProcesses(null);
}
elementExpressionViewer.updateAutocompletionProposals();
}
}
private AbstractProcess getProcessOnDiagram(MainProcess mainProcess,
String procName) {
for (AbstractProcess proc : ModelHelper.getAllProcesses(mainProcess)) {
if (proc.getName().equals(procName)) {
return proc;
}
}
return null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.DialogPage#dispose()
*/
@Override
public void dispose() {
super.dispose();
if (pageSupport != null) {
pageSupport.dispose();
}
if (databindingContext != null) {
databindingContext.dispose();
}
}
public String getThrowEvent() {
return throwEvent;
}
}
| [
"[email protected]"
] | |
6ab521f64c43abd15452d0df40e6a5e69d0aa768 | ed6cb91e03d8ed07ae521bbe8aacb38de8ecfd90 | /ezdb-rocksdb-jni/src/test/java/ezdb/rocksdb/TestEzRocksDbJniTorture.java | 1feb6a7ee5860113ee92de8618d1ddd7c8a7ce52 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | subes/ezdb | 21eb67ec55e7f66b091a8c658dd25839e1a22533 | 0163c2e15f85b5918696bdf041a0bc35e0d3daca | refs/heads/master | 2023-01-01T09:38:56.329907 | 2020-10-25T15:00:58 | 2020-10-25T15:00:58 | 11,451,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,439 | java | package ezdb.rocksdb;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.io.File;
import java.util.Random;
import org.junit.Before;
import org.junit.Test;
import ezdb.Db;
import ezdb.RangeTable;
import ezdb.TableIterator;
import ezdb.comparator.LexicographicalComparator;
import ezdb.serde.IntegerSerde;
import ezdb.treemap.TreeMapTable;
/**
* This is a little test that mostly just compares random behavior between a
* mock implementation, and LevelDB. It's not really a valid performance test,
* since it resets the tables frequently enough to never get a large data set,
* and duplicates all actions in TreeMap. It does, however, test
* multi-threading.
*
* @author criccomini
*
*/
public class TestEzRocksDbJniTorture {
public static final int NUM_THREADS = 10;
public static final int ITERATIONS = 50000;
public static final String tableName = "torture";
public Db db;
@Before
public void before() {
db = new EzRocksDb(new File("/tmp"));
}
@Test
public void testTortureEzLevelDb() throws InterruptedException {
db.deleteTable(tableName);
Thread[] threads = new Thread[NUM_THREADS];
for (int i = 0; i < NUM_THREADS; ++i) {
threads[i] = new Thread(new TortureRunnable(i, db));
threads[i].start();
}
for (int i = 0; i < NUM_THREADS; ++i) {
threads[i].join();
}
}
public static class TortureRunnable implements Runnable {
private int offset;
private Db db;
public TortureRunnable(int threadId, Db db) {
this.offset = threadId * 1000;
this.db = db;
}
public void run() {
Random rand = new Random();
RangeTable<Integer, Integer, Integer> table = db.getTable(tableName, IntegerSerde.get, IntegerSerde.get, IntegerSerde.get);
RangeTable<Integer, Integer, Integer> mockTable = new TreeMapTable<Integer, Integer, Integer>(IntegerSerde.get, IntegerSerde.get, IntegerSerde.get, LexicographicalComparator.get, LexicographicalComparator.get);
long tables = 0, deletes = 0, writes = 0, reads = 0, rangeH = 0, rangeHF = 0, rangeHFT = 0;
long start = System.currentTimeMillis();
for (int i = 0; i < ITERATIONS; ++i) {
// pick something to do
double pick = rand.nextDouble();
int hashKey = rand.nextInt(500) + offset;
int rangeKey = rand.nextInt(500);
int value = rand.nextInt(500);
if (pick < 0.1) {
// 10% of the time, delete
table.delete(hashKey, rangeKey);
mockTable.delete(hashKey, rangeKey);
++deletes;
} else if (pick < 0.30) {
// 20% of the time write
table.put(hashKey, rangeKey, value);
mockTable.put(hashKey, rangeKey, value);
++writes;
} else if (pick < 0.60) {
// 30% of the time read
assertEquals(mockTable.get(hashKey, rangeKey), table.get(hashKey, rangeKey));
++reads;
} else if (pick < 0.70) {
// 10% of the time range(h)
int hash = rand.nextInt(500) + offset;
TableIterator<Integer, Integer, Integer> iterator = table.range(hash);
TableIterator<Integer, Integer, Integer> mockIterator = table.range(hash);
while (iterator.hasNext() && mockIterator.hasNext()) {
assertEquals(mockIterator.next(), iterator.next());
++rangeH;
}
assertFalse(iterator.hasNext());
assertFalse(mockIterator.hasNext());
} else if (pick < 0.80) {
// 10% of the time range(h, f)
int hash = rand.nextInt(500) + offset;
int from = rand.nextInt(500);
TableIterator<Integer, Integer, Integer> iterator = table.range(hash, from);
TableIterator<Integer, Integer, Integer> mockIterator = table.range(hash, from);
while (iterator.hasNext() && mockIterator.hasNext()) {
assertEquals(mockIterator.next(), iterator.next());
++rangeHF;
}
assertFalse(iterator.hasNext());
assertFalse(mockIterator.hasNext());
} else {
// 20% of the time range(h, f, t)
int hash = rand.nextInt(500) + offset;
int from = rand.nextInt(500);
int to = rand.nextInt(500);
TableIterator<Integer, Integer, Integer> iterator = table.range(hash, from, to);
TableIterator<Integer, Integer, Integer> mockIterator = table.range(hash, from, to);
while (iterator.hasNext() && mockIterator.hasNext()) {
assertEquals(mockIterator.next(), iterator.next());
++rangeHFT;
}
assertFalse(iterator.hasNext());
assertFalse(mockIterator.hasNext());
}
}
long seconds = (System.currentTimeMillis() - start) / 1000;
StringBuffer out = new StringBuffer().append("[").append(Thread.currentThread().getName()).append("] table creations: ").append(tables / seconds).append("/s, deletes: ").append(deletes / seconds).append("/s, writes: ").append(writes / seconds).append("/s, reads: ").append(reads / seconds).append("/s, range(hash): ").append(rangeH / seconds).append("/s, range(hash, from): ").append(rangeHF / seconds).append("/s, range(hash, from, to): ").append(rangeHFT / seconds).append("/s, total reads: ").append((reads + rangeH + rangeHF + rangeHFT) / seconds).append("/s");
System.out.println(out.toString());
}
}
}
| [
"[email protected]"
] | |
0dc9ad8ec971e826febfb42d879da47da7578f94 | 69e4b9e73ad5c2e4299c1fdcd902f7095d367333 | /etc/vsdxJava2JS/src/main/java/com/mxgraph/io/mxGraph.java | 0565571992792e462f7567f5f982c7e1c70036d4 | [
"Apache-2.0"
] | permissive | justein/drawio | 8d88f18c2b6a591978de27aa1297f1ec06569a01 | 0cfc9412040c634e150696e276237dc9106aa38a | refs/heads/master | 2021-05-11T09:08:58.435862 | 2018-01-23T01:39:27 | 2018-01-23T01:39:27 | 116,921,930 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 89,365 | java | /**
* Copyright (c) 2007, Gaudenz Alder
*/
package com.mxgraph.io;
import java.awt.Graphics;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.w3c.dom.Element;
import com.mxgraph.io.vsdx.ShapePageId;
import com.mxgraph.io.vsdx.mxCell;
import com.mxgraph.io.vsdx.mxGeometry;
import com.mxgraph.io.vsdx.mxPoint;
import com.mxgraph.io.vsdx.mxRectangle;
/**
* Implements a graph object that allows to create diagrams from a graph model
* and stylesheet.
*
* <h3>Images</h3>
* To create an image from a graph, use the following code for a given
* XML document (doc) and File (file):
*
* <code>
* Image img = mxCellRenderer.createBufferedImage(
* graph, null, 1, Color.WHITE, false, null);
* ImageIO.write(img, "png", file);
* </code>
*
* If the XML is given as a string rather than a document, the document can
* be obtained using mxUtils.parse.
*
* This class fires the following events:
*
* mxEvent.ROOT fires if the root in the model has changed. This event has no
* properties.
*
* mxEvent.ALIGN_CELLS fires between begin- and endUpdate in alignCells. The
* <code>cells</code> and <code>align</code> properties contain the respective
* arguments that were passed to alignCells.
*
* mxEvent.FLIP_EDGE fires between begin- and endUpdate in flipEdge. The
* <code>edge</code> property contains the edge passed to flipEdge.
*
* mxEvent.ORDER_CELLS fires between begin- and endUpdate in orderCells. The
* <code>cells</code> and <code>back</code> properties contain the respective
* arguments that were passed to orderCells.
*
* mxEvent.CELLS_ORDERED fires between begin- and endUpdate in cellsOrdered.
* The <code>cells</code> and <code>back</code> arguments contain the
* respective arguments that were passed to cellsOrdered.
*
* mxEvent.GROUP_CELLS fires between begin- and endUpdate in groupCells. The
* <code>group</code>, <code>cells</code> and <code>border</code> arguments
* contain the respective arguments that were passed to groupCells.
*
* mxEvent.UNGROUP_CELLS fires between begin- and endUpdate in ungroupCells.
* The <code>cells</code> property contains the array of cells that was passed
* to ungroupCells.
*
* mxEvent.REMOVE_CELLS_FROM_PARENT fires between begin- and endUpdate in
* removeCellsFromParent. The <code>cells</code> property contains the array of
* cells that was passed to removeCellsFromParent.
*
* mxEvent.ADD_CELLS fires between begin- and endUpdate in addCells. The
* <code>cells</code>, <code>parent</code>, <code>index</code>,
* <code>source</code> and <code>target</code> properties contain the
* respective arguments that were passed to addCells.
*
* mxEvent.CELLS_ADDED fires between begin- and endUpdate in cellsAdded. The
* <code>cells</code>, <code>parent</code>, <code>index</code>,
* <code>source</code>, <code>target</code> and <code>absolute</code>
* properties contain the respective arguments that were passed to cellsAdded.
*
* mxEvent.REMOVE_CELLS fires between begin- and endUpdate in removeCells. The
* <code>cells</code> and <code>includeEdges</code> arguments contain the
* respective arguments that were passed to removeCells.
*
* mxEvent.CELLS_REMOVED fires between begin- and endUpdate in cellsRemoved.
* The <code>cells</code> argument contains the array of cells that was
* removed.
*
* mxEvent.SPLIT_EDGE fires between begin- and endUpdate in splitEdge. The
* <code>edge</code> property contains the edge to be splitted, the
* <code>cells</code>, <code>newEdge</code>, <code>dx</code> and
* <code>dy</code> properties contain the respective arguments that were passed
* to splitEdge.
*
* mxEvent.TOGGLE_CELLS fires between begin- and endUpdate in toggleCells. The
* <code>show</code>, <code>cells</code> and <code>includeEdges</code>
* properties contain the respective arguments that were passed to toggleCells.
*
* mxEvent.FOLD_CELLS fires between begin- and endUpdate in foldCells. The
* <code>collapse</code>, <code>cells</code> and <code>recurse</code>
* properties contain the respective arguments that were passed to foldCells.
*
* mxEvent.CELLS_FOLDED fires between begin- and endUpdate in cellsFolded. The
* <code>collapse</code>, <code>cells</code> and <code>recurse</code>
* properties contain the respective arguments that were passed to cellsFolded.
*
* mxEvent.UPDATE_CELL_SIZE fires between begin- and endUpdate in
* updateCellSize. The <code>cell</code> and <code>ignoreChildren</code>
* properties contain the respective arguments that were passed to
* updateCellSize.
*
* mxEvent.RESIZE_CELLS fires between begin- and endUpdate in resizeCells. The
* <code>cells</code> and <code>bounds</code> properties contain the respective
* arguments that were passed to resizeCells.
*
* mxEvent.CELLS_RESIZED fires between begin- and endUpdate in cellsResized.
* The <code>cells</code> and <code>bounds</code> properties contain the
* respective arguments that were passed to cellsResized.
*
* mxEvent.MOVE_CELLS fires between begin- and endUpdate in moveCells. The
* <code>cells</code>, <code>dx</code>, <code>dy</code>, <code>clone</code>,
* <code>target</code> and <code>location</code> properties contain the
* respective arguments that were passed to moveCells.
*
* mxEvent.CELLS_MOVED fires between begin- and endUpdate in cellsMoved. The
* <code>cells</code>, <code>dx</code>, <code>dy</code> and
* <code>disconnect</code> properties contain the respective arguments that
* were passed to cellsMoved.
*
* mxEvent.CONNECT_CELL fires between begin- and endUpdate in connectCell. The
* <code>edge</code>, <code>terminal</code> and <code>source</code> properties
* contain the respective arguments that were passed to connectCell.
*
* mxEvent.CELL_CONNECTED fires between begin- and endUpdate in cellConnected.
* The <code>edge</code>, <code>terminal</code> and <code>source</code>
* properties contain the respective arguments that were passed to
* cellConnected.
*
* mxEvent.REPAINT fires if a repaint was requested by calling repaint. The
* <code>region</code> property contains the optional mxRectangle that was
* passed to repaint to define the dirty region.
*/
public class mxGraph
{
/**
* Holds the version number of this release. Current version
* is @MXGRAPH-VERSION@.
*/
public static final String VERSION = "@MXGRAPH-VERSION@";
class Model {
public mxGeometry getGeometry(Object cellParent) {
return new mxGeometry();
}
public void beginUpdate() {
// TODO Auto-generated method stub
}
public void setValue(Object defaultParent, String pageName) {
// TODO Auto-generated method stub
}
public Object getRoot() {
// TODO Auto-generated method stub
return null;
}
public HashMap<ShapePageId, mxCell> getCells() {
// TODO Auto-generated method stub
return null;
}
public boolean isEdge(Object c) {
// TODO Auto-generated method stub
return false;
}
public void endUpdate() {
// TODO Auto-generated method stub
}
public void setMaintainEdgeParent(boolean b) {
// TODO Auto-generated method stub
}
public int getChildCount(Object parent) {
// TODO Auto-generated method stub
return 0;
}
public String getStyle(Object parent) {
// TODO Auto-generated method stub
return null;
}
public Object getChildAt(Object cell, int i) {
// TODO Auto-generated method stub
return null;
}
public void remove(Object removeChild) {
// TODO Auto-generated method stub
}
public char[] getValue(Object cell) {
// TODO Auto-generated method stub
return null;
}
public boolean isVertex(Object cell) {
// TODO Auto-generated method stub
return false;
}
public Object getParent(Object c) {
// TODO Auto-generated method stub
return null;
}
}
public Model getModel() {
// TODO Auto-generated method stub
return new Model();
}
public Object getDefaultParent() {
// TODO Auto-generated method stub
return null;
}
public void addCell(Object backCell, Object root, int i, Object object, Object object2) {
// TODO Auto-generated method stub
}
public void setExtendParents(boolean b) {
// TODO Auto-generated method stub
}
public void setExtendParentsOnAdd(boolean b) {
// TODO Auto-generated method stub
}
public void setConstrainChildren(boolean b) {
// TODO Auto-generated method stub
}
public void setHtmlLabels(boolean b) {
// TODO Auto-generated method stub
}
public mxCell insertVertex(Object parent, Object object, Object object2, long l, long m, long n, long o,
String style) {
// TODO Auto-generated method stub
return null;
}
public mxCell insertVertex(Object parent, Object object, Object object2, long l, long m, int i, int j) {
// TODO Auto-generated method stub
return null;
}
public Object insertEdge(Object parent, Object object, Object object2, mxCell source, mxCell target,
String styleString) {
// TODO Auto-generated method stub
return null;
}
public Object getView() {
// TODO Auto-generated method stub
return null;
}
public Object createEdge(Object parent, Object object, Object object2, Object object3, Object object4,
String styleString) {
// TODO Auto-generated method stub
return null;
}
public Object addEdge(Object edge, Object parent, Object object, Object object2, int shapeIndex) {
// TODO Auto-generated method stub
return null;
}
// /**
// *
// */
// public interface mxICellVisitor
// {
//
// /**
// *
// * @param vertex
// * @param edge
// */
// boolean visit(Object vertex, Object edge);
//
// }
//
// /**
// * Property change event handling.
// */
// protected PropertyChangeSupport changeSupport = new PropertyChangeSupport(
// this);
//
// /**
// * Holds the model that contains the cells to be displayed.
// */
// protected Object model;
//
// /**
// * Holds the view that caches the cell states.
// */
//
// /**
// * Specifies the grid size. Default is 10.
// */
// protected int gridSize = 10;
//
// /**
// * Specifies if the grid is enabled. Default is true.
// */
// protected boolean gridEnabled = true;
//
// /**
// * Specifies if ports are enabled. This is used in <cellConnected> to update
// * the respective style. Default is true.
// */
// protected boolean portsEnabled = true;
//
// /**
// * Value returned by getOverlap if isAllowOverlapParent returns
// * true for the given cell. getOverlap is used in keepInside if
// * isKeepInsideParentOnMove returns true. The value specifies the
// * portion of the child which is allowed to overlap the parent.
// */
// protected double defaultOverlap = 0.5;
//
// /**
// * Specifies the default parent to be used to insert new cells.
// * This is used in getDefaultParent. Default is null.
// */
// protected Object defaultParent;
//
// /**
// * Specifies the alternate edge style to be used if the main control point
// * on an edge is being doubleclicked. Default is null.
// */
// protected String alternateEdgeStyle;
//
// /**
// * Specifies the return value for isEnabled. Default is true.
// */
// protected boolean enabled = true;
//
// /**
// * Specifies the return value for isCell(s)Locked. Default is false.
// */
// protected boolean cellsLocked = false;
//
// /**
// * Specifies the return value for isCell(s)Editable. Default is true.
// */
// protected boolean cellsEditable = true;
//
// /**
// * Specifies the return value for isCell(s)Sizable. Default is true.
// */
// protected boolean cellsResizable = true;
//
// /**
// * Specifies the return value for isCell(s)Movable. Default is true.
// */
// protected boolean cellsMovable = true;
//
// /**
// * Specifies the return value for isCell(s)Bendable. Default is true.
// */
// protected boolean cellsBendable = true;
//
// /**
// * Specifies the return value for isCell(s)Selectable. Default is true.
// */
// protected boolean cellsSelectable = true;
//
// /**
// * Specifies the return value for isCell(s)Deletable. Default is true.
// */
// protected boolean cellsDeletable = true;
//
// /**
// * Specifies the return value for isCell(s)Cloneable. Default is true.
// */
// protected boolean cellsCloneable = true;
//
// /**
// * Specifies the return value for isCellDisconntableFromTerminal. Default
// * is true.
// */
// protected boolean cellsDisconnectable = true;
//
// /**
// * Specifies the return value for isLabel(s)Clipped. Default is false.
// */
// protected boolean labelsClipped = false;
//
// /**
// * Specifies the return value for edges in isLabelMovable. Default is true.
// */
// protected boolean edgeLabelsMovable = true;
//
// /**
// * Specifies the return value for vertices in isLabelMovable. Default is false.
// */
// protected boolean vertexLabelsMovable = false;
//
// /**
// * Specifies the return value for isDropEnabled. Default is true.
// */
// protected boolean dropEnabled = true;
//
// /**
// * Specifies if dropping onto edges should be enabled. Default is true.
// */
// protected boolean splitEnabled = true;
//
// /**
// * Specifies if the graph should automatically update the cell size
// * after an edit. This is used in isAutoSizeCell. Default is false.
// */
// protected boolean autoSizeCells = false;
//
// /**
// * <mxRectangle> that specifies the area in which all cells in the
// * diagram should be placed. Uses in getMaximumGraphBounds. Use a width
// * or height of 0 if you only want to give a upper, left corner.
// */
// protected mxRectangle maximumGraphBounds = null;
//
// /**
// * mxRectangle that specifies the minimum size of the graph canvas inside
// * the scrollpane.
// */
// protected mxRectangle minimumGraphSize = null;
//
// /**
// * Border to be added to the bottom and right side when the container is
// * being resized after the graph has been changed. Default is 0.
// */
// protected int border = 0;
//
// /**
// * Specifies if edges should appear in the foreground regardless of their
// * order in the model. This has precendence over keepEdgeInBackground
// * Default is false.
// */
// protected boolean keepEdgesInForeground = false;
//
// /**
// * Specifies if edges should appear in the background regardless of their
// * order in the model. Default is false.
// */
// protected boolean keepEdgesInBackground = false;
//
// /**
// * Specifies if the cell size should be changed to the preferred size when
// * a cell is first collapsed. Default is true.
// */
// protected boolean collapseToPreferredSize = true;
//
// /**
// * Specifies if negative coordinates for vertices are allowed. Default is true.
// */
// protected boolean allowNegativeCoordinates = true;
//
// /**
// * Specifies the return value for isConstrainChildren. Default is true.
// */
// protected boolean constrainChildren = true;
//
// /**
// * Specifies if a parent should contain the child bounds after a resize of
// * the child. Default is true.
// */
// protected boolean extendParents = true;
//
// /**
// * Specifies if parents should be extended according to the <extendParents>
// * switch if cells are added. Default is true.
// */
// protected boolean extendParentsOnAdd = true;
//
// /**
// * Specifies if the scale and translate should be reset if
// * the root changes in the model. Default is true.
// */
// protected boolean resetViewOnRootChange = true;
//
// /**
// * Specifies if loops (aka self-references) are allowed.
// * Default is false.
// */
// protected boolean resetEdgesOnResize = false;
//
// /**
// * Specifies if edge control points should be reset after
// * the move of a connected cell. Default is false.
// */
// protected boolean resetEdgesOnMove = false;
//
// /**
// * Specifies if edge control points should be reset after
// * the the edge has been reconnected. Default is true.
// */
// protected boolean resetEdgesOnConnect = true;
//
// /**
// * Specifies if loops (aka self-references) are allowed.
// * Default is false.
// */
// protected boolean allowLoops = false;
//
// /**
// * Specifies the multiplicities to be used for validation of the graph.
// */
//
// /**
// * Specifies if multiple edges in the same direction between
// * the same pair of vertices are allowed. Default is true.
// */
// protected boolean multigraph = true;
//
// /**
// * Specifies if edges are connectable. Default is false.
// * This overrides the connectable field in edges.
// */
// protected boolean connectableEdges = false;
//
// /**
// * Specifies if edges with disconnected terminals are
// * allowed in the graph. Default is false.
// */
// protected boolean allowDanglingEdges = true;
//
// /**
// * Specifies if edges that are cloned should be validated and only inserted
// * if they are valid. Default is true.
// */
// protected boolean cloneInvalidEdges = false;
//
// /**
// * Specifies if edges should be disconnected from their terminals when they
// * are moved. Default is true.
// */
// protected boolean disconnectOnMove = true;
//
// /**
// * Specifies if labels should be visible. This is used in
// * getLabel. Default is true.
// */
// protected boolean labelsVisible = true;
//
// /**
// * Specifies the return value for isHtmlLabel. Default is false.
// */
// protected boolean htmlLabels = false;
//
// /**
// * Specifies if nesting of swimlanes is allowed. Default is true.
// */
// protected boolean swimlaneNesting = true;
//
// /**
// * Specifies the maximum number of changes that should be processed to find
// * the dirty region. If the number of changes is larger, then the complete
// * grah is repainted. A value of zero will always compute the dirty region
// * for any number of changes. Default is 1000.
// */
// protected int changesRepaintThreshold = 1000;
//
// /**
// * Specifies if the origin should be automatically updated.
// */
// protected boolean autoOrigin = false;
//
// /**
// * Holds the current automatic origin.
// */
// protected mxPoint origin = new mxPoint();
//
// /**
// * Holds the list of bundles.
// */
//
// /**
// * Constructs a new graph with an empty
// * {@link com.mxgraph.model.mxGraphModel}.
// */
// public mxGraph()
// {
// }
//
// /**
// * Constructs a new graph for the specified model. If no model is
// * specified, then a new, empty {@link com.mxgraph.model.mxGraphModel} is
// * used.
// *
// * @param model Model that contains the graph data
// */
//
// /**
// * Constructs a new graph for the specified model. If no model is
// * specified, then a new, empty {@link com.mxgraph.model.mxGraphModel} is
// * used.
// *
// * @param stylesheet The stylesheet to use for the graph.
// */
//
// /**
// * Constructs a new graph for the specified model. If no model is
// * specified, then a new, empty {@link com.mxgraph.model.mxGraphModel} is
// * used.
// *
// * @param model Model that contains the graph data
// */
// /**
// * Returns cellsLocked, the default return value for isCellLocked.
// */
// public boolean isCellsLocked()
// {
// return cellsLocked;
// }
//
// /**
// * Sets cellsLocked, the default return value for isCellLocked and fires a
// * property change event for cellsLocked.
// */
// public void setCellsLocked(boolean value)
// {
// boolean oldValue = cellsLocked;
// cellsLocked = value;
//
// changeSupport.firePropertyChange("cellsLocked", oldValue, cellsLocked);
// }
//
// /**
// * Returns true if the given cell is movable. This implementation returns editable.
// *
// * @param cell Cell whose editable state should be returned.
// * @return Returns true if the cell is editable.
// */
// public boolean isCellEditable(Object cell)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return isCellsEditable() && !isCellLocked(cell)
// && mxUtils.isTrue(style, mxConstants.STYLE_EDITABLE, true);
// }
//
// /**
// * Returns true if editing is allowed in this graph.
// *
// * @return Returns true if the graph is editable.
// */
// public boolean isCellsEditable()
// {
// return cellsEditable;
// }
//
// /**
// * Sets if the graph is editable.
// */
// public void setCellsEditable(boolean value)
// {
// boolean oldValue = cellsEditable;
// cellsEditable = value;
//
// changeSupport.firePropertyChange("cellsEditable", oldValue,
// cellsEditable);
// }
//
// /**
// * Returns true if the given cell is resizable. This implementation returns
// * cellsSizable for all cells.
// *
// * @param cell Cell whose resizable state should be returned.
// * @return Returns true if the cell is sizable.
// */
// public boolean isCellResizable(Object cell)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return isCellsResizable() && !isCellLocked(cell)
// && mxUtils.isTrue(style, mxConstants.STYLE_RESIZABLE, true);
// }
//
// /**
// * Returns true if the given cell is resizable. This implementation return sizable.
// */
// public boolean isCellsResizable()
// {
// return cellsResizable;
// }
//
// /**
// * Sets if the graph is resizable.
// */
// public void setCellsResizable(boolean value)
// {
// boolean oldValue = cellsResizable;
// cellsResizable = value;
//
// changeSupport.firePropertyChange("cellsResizable", oldValue,
// cellsResizable);
// }
//
// /**
// * Returns the cells which are movable in the given array of cells.
// */
// public Object[] getMovableCells(Object[] cells)
// {
// return mxGraphModel.filterCells(cells, new Filter()
// {
// public boolean filter(Object cell)
// {
// return isCellMovable(cell);
// }
// });
// }
//
// /**
// * Returns true if the given cell is movable. This implementation
// * returns movable.
// *
// * @param cell Cell whose movable state should be returned.
// * @return Returns true if the cell is movable.
// */
// public boolean isCellMovable(Object cell)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return isCellsMovable() && !isCellLocked(cell)
// && mxUtils.isTrue(style, mxConstants.STYLE_MOVABLE, true);
// }
//
// /**
// * Returns cellsMovable.
// */
// public boolean isCellsMovable()
// {
// return cellsMovable;
// }
//
// /**
// * Sets cellsMovable.
// */
// public void setCellsMovable(boolean value)
// {
// boolean oldValue = cellsMovable;
// cellsMovable = value;
//
// changeSupport
// .firePropertyChange("cellsMovable", oldValue, cellsMovable);
// }
//
// /**
// * Function: isTerminalPointMovable
// *
// * Returns true if the given terminal point is movable. This is independent
// * from isCellConnectable and isCellDisconnectable and controls if terminal
// * points can be moved in the graph if the edge is not connected. Note that
// * it is required for this to return true to connect unconnected edges.
// * This implementation returns true.
// *
// * @param cell Cell whose terminal point should be moved.
// * @param source Boolean indicating if the source or target terminal should be moved.
// */
// public boolean isTerminalPointMovable(Object cell, boolean source)
// {
// return true;
// }
//
// /**
// * Returns true if the given cell is bendable. This implementation returns
// * bendable. This is used in mxElbowEdgeHandler to determine if the middle
// * handle should be shown.
// *
// * @param cell Cell whose bendable state should be returned.
// * @return Returns true if the cell is bendable.
// */
// public boolean isCellBendable(Object cell)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return isCellsBendable() && !isCellLocked(cell)
// && mxUtils.isTrue(style, mxConstants.STYLE_BENDABLE, true);
// }
//
// /**
// * Returns cellsBendable.
// */
// public boolean isCellsBendable()
// {
// return cellsBendable;
// }
//
// /**
// * Sets cellsBendable.
// */
// public void setCellsBendable(boolean value)
// {
// boolean oldValue = cellsBendable;
// cellsBendable = value;
//
// changeSupport.firePropertyChange("cellsBendable", oldValue,
// cellsBendable);
// }
//
// /**
// * Returns true if the given cell is selectable. This implementation returns
// * <selectable>.
// *
// * @param cell <mxCell> whose selectable state should be returned.
// * @return Returns true if the given cell is selectable.
// */
// public boolean isCellSelectable(Object cell)
// {
// return isCellsSelectable();
// }
//
// /**
// * Returns cellsSelectable.
// */
// public boolean isCellsSelectable()
// {
// return cellsSelectable;
// }
//
// /**
// * Sets cellsSelectable.
// */
// public void setCellsSelectable(boolean value)
// {
// boolean oldValue = cellsSelectable;
// cellsSelectable = value;
//
// changeSupport.firePropertyChange("cellsSelectable", oldValue,
// cellsSelectable);
// }
//
// /**
// * Returns the cells which are movable in the given array of cells.
// */
// public Object[] getDeletableCells(Object[] cells)
// {
// return mxGraphModel.filterCells(cells, new Filter()
// {
// public boolean filter(Object cell)
// {
// return isCellDeletable(cell);
// }
// });
// }
//
// /**
// * Returns true if the given cell is movable. This implementation always
// * returns true.
// *
// * @param cell Cell whose movable state should be returned.
// * @return Returns true if the cell is movable.
// */
// public boolean isCellDeletable(Object cell)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return isCellsDeletable()
// && mxUtils.isTrue(style, mxConstants.STYLE_DELETABLE, true);
// }
//
// /**
// * Returns cellsDeletable.
// */
// public boolean isCellsDeletable()
// {
// return cellsDeletable;
// }
//
// /**
// * Sets cellsDeletable.
// */
// public void setCellsDeletable(boolean value)
// {
// boolean oldValue = cellsDeletable;
// cellsDeletable = value;
//
// changeSupport.firePropertyChange("cellsDeletable", oldValue,
// cellsDeletable);
// }
//
// /**
// * Returns the cells which are movable in the given array of cells.
// */
// public Object[] getCloneableCells(Object[] cells)
// {
// return mxGraphModel.filterCells(cells, new Filter()
// {
// public boolean filter(Object cell)
// {
// return isCellCloneable(cell);
// }
// });
// }
//
// /**
// * Returns the constant true. This does not use the cloneable field to
// * return a value for a given cell, it is simply a hook for subclassers
// * to disallow cloning of individual cells.
// */
// public boolean isCellCloneable(Object cell)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return isCellsCloneable()
// && mxUtils.isTrue(style, mxConstants.STYLE_CLONEABLE, true);
// }
//
// /**
// * Returns cellsCloneable.
// */
// public boolean isCellsCloneable()
// {
// return cellsCloneable;
// }
//
// /**
// * Specifies if the graph should allow cloning of cells by holding down the
// * control key while cells are being moved. This implementation updates
// * cellsCloneable.
// *
// * @param value Boolean indicating if the graph should be cloneable.
// */
// public void setCellsCloneable(boolean value)
// {
// boolean oldValue = cellsCloneable;
// cellsCloneable = value;
//
// changeSupport.firePropertyChange("cellsCloneable", oldValue,
// cellsCloneable);
// }
//
// /**
// * Returns true if the given cell is disconnectable from the source or
// * target terminal. This returns <disconnectable> for all given cells if
// * <isLocked> does not return true for the given cell.
// *
// * @param cell <mxCell> whose disconnectable state should be returned.
// * @param terminal <mxCell> that represents the source or target terminal.
// * @param source Boolean indicating if the source or target terminal is to be
// * disconnected.
// * @return Returns true if the given edge can be disconnected from the given
// * terminal.
// */
// public boolean isCellDisconnectable(Object cell, Object terminal,
// boolean source)
// {
// return isCellsDisconnectable() && !isCellLocked(cell);
// }
//
// /**
// * Returns cellsDisconnectable.
// */
// public boolean isCellsDisconnectable()
// {
// return cellsDisconnectable;
// }
//
// /**
// * Sets cellsDisconnectable.
// *
// * @param value Boolean indicating if the graph should allow disconnecting of
// * edges.
// */
// public void setCellsDisconnectable(boolean value)
// {
// boolean oldValue = cellsDisconnectable;
// cellsDisconnectable = value;
//
// changeSupport.firePropertyChange("cellsDisconnectable", oldValue,
// cellsDisconnectable);
// }
//
// /**
// * Returns true if the overflow portion of labels should be hidden. If this
// * returns true then vertex labels will be clipped to the size of the vertices.
// * This implementation returns true if <mxConstants.STYLE_OVERFLOW> in the
// * style of the given cell is "hidden".
// *
// * @param cell Cell whose label should be clipped.
// * @return Returns true if the cell label should be clipped.
// */
// public boolean isLabelClipped(Object cell)
// {
// if (!isLabelsClipped())
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return (style != null) ? mxUtils.getString(style,
// mxConstants.STYLE_OVERFLOW, "").equals("hidden") : false;
// }
//
// return isLabelsClipped();
// }
//
// /**
// * Returns labelsClipped.
// */
// public boolean isLabelsClipped()
// {
// return labelsClipped;
// }
//
// /**
// * Sets labelsClipped.
// */
// public void setLabelsClipped(boolean value)
// {
// boolean oldValue = labelsClipped;
// labelsClipped = value;
//
// changeSupport.firePropertyChange("labelsClipped", oldValue,
// labelsClipped);
// }
//
// /**
// * Returns true if the given edges's label is moveable. This returns
// * <movable> for all given cells if <isLocked> does not return true
// * for the given cell.
// *
// * @param cell <mxCell> whose label should be moved.
// * @return Returns true if the label of the given cell is movable.
// */
// public boolean isLabelMovable(Object cell)
// {
// return !isCellLocked(cell)
// && ((model.isEdge(cell) && isEdgeLabelsMovable()) || (model
// .isVertex(cell) && isVertexLabelsMovable()));
// }
//
// /**
// * Returns vertexLabelsMovable.
// */
// public boolean isVertexLabelsMovable()
// {
// return vertexLabelsMovable;
// }
//
// /**
// * Sets vertexLabelsMovable.
// */
// public void setVertexLabelsMovable(boolean value)
// {
// boolean oldValue = vertexLabelsMovable;
// vertexLabelsMovable = value;
//
// changeSupport.firePropertyChange("vertexLabelsMovable", oldValue,
// vertexLabelsMovable);
// }
//
// /**
// * Returns edgeLabelsMovable.
// */
// public boolean isEdgeLabelsMovable()
// {
// return edgeLabelsMovable;
// }
//
// /**
// * Returns edgeLabelsMovable.
// */
// public void setEdgeLabelsMovable(boolean value)
// {
// boolean oldValue = edgeLabelsMovable;
// edgeLabelsMovable = value;
//
// changeSupport.firePropertyChange("edgeLabelsMovable", oldValue,
// edgeLabelsMovable);
// }
//
// //
// // Graph control options
// //
//
// /**
// * Returns true if the graph is <enabled>.
// *
// * @return Returns true if the graph is enabled.
// */
// public boolean isEnabled()
// {
// return enabled;
// }
//
// /**
// * Specifies if the graph should allow any interactions. This
// * implementation updates <enabled>.
// *
// * @param value Boolean indicating if the graph should be enabled.
// */
// public void setEnabled(boolean value)
// {
// boolean oldValue = enabled;
// enabled = value;
//
// changeSupport.firePropertyChange("enabled", oldValue, enabled);
// }
//
// /**
// * Returns true if the graph allows drop into other cells.
// */
// public boolean isDropEnabled()
// {
// return dropEnabled;
// }
//
// /**
// * Sets dropEnabled.
// */
// public void setDropEnabled(boolean value)
// {
// boolean oldValue = dropEnabled;
// dropEnabled = value;
//
// changeSupport.firePropertyChange("dropEnabled", oldValue, dropEnabled);
// }
//
// /**
// * Affects the return values of isValidDropTarget to allow for edges as
// * drop targets. The splitEdge method is called in mxGraphHandler if
// * mxGraphComponent.isSplitEvent returns true for a given configuration.
// */
// public boolean isSplitEnabled()
// {
// return splitEnabled;
// }
//
// /**
// * Sets splitEnabled.
// */
// public void setSplitEnabled(boolean value)
// {
// splitEnabled = value;
// }
//
// /**
// * Returns multigraph.
// */
// public boolean isMultigraph()
// {
// return multigraph;
// }
//
// /**
// * Sets multigraph.
// */
// public void setMultigraph(boolean value)
// {
// boolean oldValue = multigraph;
// multigraph = value;
//
// changeSupport.firePropertyChange("multigraph", oldValue, multigraph);
// }
//
// /**
// * Returns swimlaneNesting.
// */
// public boolean isSwimlaneNesting()
// {
// return swimlaneNesting;
// }
//
// /**
// * Sets swimlaneNesting.
// */
// public void setSwimlaneNesting(boolean value)
// {
// boolean oldValue = swimlaneNesting;
// swimlaneNesting = value;
//
// changeSupport.firePropertyChange("swimlaneNesting", oldValue,
// swimlaneNesting);
// }
//
// /**
// * Returns allowDanglingEdges
// */
// public boolean isAllowDanglingEdges()
// {
// return allowDanglingEdges;
// }
//
// /**
// * Sets allowDanglingEdges.
// */
// public void setAllowDanglingEdges(boolean value)
// {
// boolean oldValue = allowDanglingEdges;
// allowDanglingEdges = value;
//
// changeSupport.firePropertyChange("allowDanglingEdges", oldValue,
// allowDanglingEdges);
// }
//
// /**
// * Returns cloneInvalidEdges.
// */
// public boolean isCloneInvalidEdges()
// {
// return cloneInvalidEdges;
// }
//
// /**
// * Sets cloneInvalidEdge.
// */
// public void setCloneInvalidEdges(boolean value)
// {
// boolean oldValue = cloneInvalidEdges;
// cloneInvalidEdges = value;
//
// changeSupport.firePropertyChange("cloneInvalidEdges", oldValue,
// cloneInvalidEdges);
// }
//
// /**
// * Returns disconnectOnMove
// */
// public boolean isDisconnectOnMove()
// {
// return disconnectOnMove;
// }
//
// /**
// * Sets disconnectOnMove.
// */
// public void setDisconnectOnMove(boolean value)
// {
// boolean oldValue = disconnectOnMove;
// disconnectOnMove = value;
//
// changeSupport.firePropertyChange("disconnectOnMove", oldValue,
// disconnectOnMove);
//
// }
//
// /**
// * Returns allowLoops.
// */
// public boolean isAllowLoops()
// {
// return allowLoops;
// }
//
// /**
// * Sets allowLoops.
// */
// public void setAllowLoops(boolean value)
// {
// boolean oldValue = allowLoops;
// allowLoops = value;
//
// changeSupport.firePropertyChange("allowLoops", oldValue, allowLoops);
// }
//
// /**
// * Returns connectableEdges.
// */
// public boolean isConnectableEdges()
// {
// return connectableEdges;
// }
//
// /**
// * Sets connetableEdges.
// */
// public void setConnectableEdges(boolean value)
// {
// boolean oldValue = connectableEdges;
// connectableEdges = value;
//
// changeSupport.firePropertyChange("connectableEdges", oldValue,
// connectableEdges);
//
// }
//
// /**
// * Returns resetEdgesOnMove.
// */
// public boolean isResetEdgesOnMove()
// {
// return resetEdgesOnMove;
// }
//
// /**
// * Sets resetEdgesOnMove.
// */
// public void setResetEdgesOnMove(boolean value)
// {
// boolean oldValue = resetEdgesOnMove;
// resetEdgesOnMove = value;
//
// changeSupport.firePropertyChange("resetEdgesOnMove", oldValue,
// resetEdgesOnMove);
// }
//
// /**
// * Returns resetViewOnRootChange.
// */
// public boolean isResetViewOnRootChange()
// {
// return resetViewOnRootChange;
// }
//
// /**
// * Sets resetEdgesOnResize.
// */
// public void setResetViewOnRootChange(boolean value)
// {
// boolean oldValue = resetViewOnRootChange;
// resetViewOnRootChange = value;
//
// changeSupport.firePropertyChange("resetViewOnRootChange", oldValue,
// resetViewOnRootChange);
// }
//
// /**
// * Returns resetEdgesOnResize.
// */
// public boolean isResetEdgesOnResize()
// {
// return resetEdgesOnResize;
// }
//
// /**
// * Sets resetEdgesOnResize.
// */
// public void setResetEdgesOnResize(boolean value)
// {
// boolean oldValue = resetEdgesOnResize;
// resetEdgesOnResize = value;
//
// changeSupport.firePropertyChange("resetEdgesOnResize", oldValue,
// resetEdgesOnResize);
// }
//
// /**
// * Returns resetEdgesOnConnect.
// */
// public boolean isResetEdgesOnConnect()
// {
// return resetEdgesOnConnect;
// }
//
// /**
// * Sets resetEdgesOnConnect.
// */
// public void setResetEdgesOnConnect(boolean value)
// {
// boolean oldValue = resetEdgesOnConnect;
// resetEdgesOnConnect = value;
//
// changeSupport.firePropertyChange("resetEdgesOnConnect", oldValue,
// resetEdgesOnResize);
// }
//
// /**
// * Returns true if the size of the given cell should automatically be
// * updated after a change of the label. This implementation returns
// * autoSize for all given cells or checks if the cell style does specify
// * mxConstants.STYLE_AUTOSIZE to be 1.
// *
// * @param cell Cell that should be resized.
// * @return Returns true if the size of the given cell should be updated.
// */
// public boolean isAutoSizeCell(Object cell)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return isAutoSizeCells()
// || mxUtils.isTrue(style, mxConstants.STYLE_AUTOSIZE, false);
// }
//
// /**
// * Returns true if the size of the given cell should automatically be
// * updated after a change of the label. This implementation returns
// * autoSize for all given cells.
// */
// public boolean isAutoSizeCells()
// {
// return autoSizeCells;
// }
//
// /**
// * Specifies if cell sizes should be automatically updated after a label
// * change. This implementation sets autoSize to the given parameter.
// *
// * @param value Boolean indicating if cells should be resized
// * automatically.
// */
// public void setAutoSizeCells(boolean value)
// {
// boolean oldValue = autoSizeCells;
// autoSizeCells = value;
//
// changeSupport.firePropertyChange("autoSizeCells", oldValue,
// autoSizeCells);
// }
//
// /**
// * Returns true if the parent of the given cell should be extended if the
// * child has been resized so that it overlaps the parent. This
// * implementation returns ExtendParents if cell is not an edge.
// *
// * @param cell Cell that has been resized.
// */
// public boolean isExtendParent(Object cell)
// {
// return !getModel().isEdge(cell) && isExtendParents();
// }
//
// /**
// * Returns extendParents.
// */
// public boolean isExtendParents()
// {
// return extendParents;
// }
//
// /**
// * Sets extendParents.
// */
// public void setExtendParents(boolean value)
// {
// boolean oldValue = extendParents;
// extendParents = value;
//
// changeSupport.firePropertyChange("extendParents", oldValue,
// extendParents);
// }
//
// /**
// * Returns extendParentsOnAdd.
// */
// public boolean isExtendParentsOnAdd()
// {
// return extendParentsOnAdd;
// }
//
// /**
// * Sets extendParentsOnAdd.
// */
// public void setExtendParentsOnAdd(boolean value)
// {
// boolean oldValue = extendParentsOnAdd;
// extendParentsOnAdd = value;
//
// changeSupport.firePropertyChange("extendParentsOnAdd", oldValue,
// extendParentsOnAdd);
// }
//
// /**
// * Returns true if the given cell should be kept inside the bounds of its
// * parent according to the rules defined by getOverlap and
// * isAllowOverlapParent. This implementation returns false for all children
// * of edges and isConstrainChildren() otherwise.
// */
// public boolean isConstrainChild(Object cell)
// {
// return isConstrainChildren()
// && !getModel().isEdge(getModel().getParent(cell));
// }
//
// /**
// * Returns constrainChildren.
// *
// * @return the keepInsideParentOnMove
// */
// public boolean isConstrainChildren()
// {
// return constrainChildren;
// }
//
// /**
// * @param value the constrainChildren to set
// */
// public void setConstrainChildren(boolean value)
// {
// boolean oldValue = constrainChildren;
// constrainChildren = value;
//
// changeSupport.firePropertyChange("constrainChildren", oldValue,
// constrainChildren);
// }
//
// /**
// * Returns autoOrigin.
// */
// public boolean isAutoOrigin()
// {
// return autoOrigin;
// }
//
// /**
// * @param value the autoOrigin to set
// */
// public void setAutoOrigin(boolean value)
// {
// boolean oldValue = autoOrigin;
// autoOrigin = value;
//
// changeSupport.firePropertyChange("autoOrigin", oldValue, autoOrigin);
// }
//
// /**
// * Returns origin.
// */
// public mxPoint getOrigin()
// {
// return origin;
// }
//
// /**
// * @param value the origin to set
// */
// public void setOrigin(mxPoint value)
// {
// mxPoint oldValue = origin;
// origin = value;
//
// changeSupport.firePropertyChange("origin", oldValue, origin);
// }
//
// /**
// * @return Returns changesRepaintThreshold.
// */
// public int getChangesRepaintThreshold()
// {
// return changesRepaintThreshold;
// }
//
// /**
// * @param value the changesRepaintThreshold to set
// */
// public void setChangesRepaintThreshold(int value)
// {
// int oldValue = changesRepaintThreshold;
// changesRepaintThreshold = value;
//
// changeSupport.firePropertyChange("changesRepaintThreshold", oldValue,
// changesRepaintThreshold);
// }
//
// /**
// * Returns isAllowNegativeCoordinates.
// *
// * @return the allowNegativeCoordinates
// */
// public boolean isAllowNegativeCoordinates()
// {
// return allowNegativeCoordinates;
// }
//
// /**
// * @param value the allowNegativeCoordinates to set
// */
// public void setAllowNegativeCoordinates(boolean value)
// {
// boolean oldValue = allowNegativeCoordinates;
// allowNegativeCoordinates = value;
//
// changeSupport.firePropertyChange("allowNegativeCoordinates", oldValue,
// allowNegativeCoordinates);
// }
//
// /**
// * Returns collapseToPreferredSize.
// *
// * @return the collapseToPreferredSize
// */
// public boolean isCollapseToPreferredSize()
// {
// return collapseToPreferredSize;
// }
//
// /**
// * @param value the collapseToPreferredSize to set
// */
// public void setCollapseToPreferredSize(boolean value)
// {
// boolean oldValue = collapseToPreferredSize;
// collapseToPreferredSize = value;
//
// changeSupport.firePropertyChange("collapseToPreferredSize", oldValue,
// collapseToPreferredSize);
// }
//
// /**
// * @return Returns true if edges are rendered in the foreground.
// */
// public boolean isKeepEdgesInForeground()
// {
// return keepEdgesInForeground;
// }
//
// /**
// * @param value the keepEdgesInForeground to set
// */
// public void setKeepEdgesInForeground(boolean value)
// {
// boolean oldValue = keepEdgesInForeground;
// keepEdgesInForeground = value;
//
// changeSupport.firePropertyChange("keepEdgesInForeground", oldValue,
// keepEdgesInForeground);
// }
//
// /**
// * @return Returns true if edges are rendered in the background.
// */
// public boolean isKeepEdgesInBackground()
// {
// return keepEdgesInBackground;
// }
//
// /**
// * @param value the keepEdgesInBackground to set
// */
// public void setKeepEdgesInBackground(boolean value)
// {
// boolean oldValue = keepEdgesInBackground;
// keepEdgesInBackground = value;
//
// changeSupport.firePropertyChange("keepEdgesInBackground", oldValue,
// keepEdgesInBackground);
// }
//
// /**
// * Returns true if the given cell is a valid source for new connections.
// * This implementation returns true for all non-null values and is
// * called by is called by <isValidConnection>.
// *
// * @param cell Object that represents a possible source or null.
// * @return Returns true if the given cell is a valid source terminal.
// */
// public boolean isValidSource(Object cell)
// {
// return (cell == null && allowDanglingEdges)
// || (cell != null
// && (!model.isEdge(cell) || isConnectableEdges()) && isCellConnectable(cell));
// }
//
// /**
// * Returns isValidSource for the given cell. This is called by
// * isValidConnection.
// *
// * @param cell Object that represents a possible target or null.
// * @return Returns true if the given cell is a valid target.
// */
// public boolean isValidTarget(Object cell)
// {
// return isValidSource(cell);
// }
//
// /**
// * Returns true if the given target cell is a valid target for source.
// * This is a boolean implementation for not allowing connections between
// * certain pairs of vertices and is called by <getEdgeValidationError>.
// * This implementation returns true if <isValidSource> returns true for
// * the source and <isValidTarget> returns true for the target.
// *
// * @param source Object that represents the source cell.
// * @param target Object that represents the target cell.
// * @return Returns true if the the connection between the given terminals
// * is valid.
// */
// public boolean isValidConnection(Object source, Object target)
// {
// return isValidSource(source) && isValidTarget(target)
// && (isAllowLoops() || source != target);
// }
//
// /**
// * Returns the minimum size of the diagram.
// *
// * @return Returns the minimum container size.
// */
// public mxRectangle getMinimumGraphSize()
// {
// return minimumGraphSize;
// }
//
// /**
// * @param value the minimumGraphSize to set
// */
// public void setMinimumGraphSize(mxRectangle value)
// {
// mxRectangle oldValue = minimumGraphSize;
// minimumGraphSize = value;
//
// changeSupport.firePropertyChange("minimumGraphSize", oldValue, value);
// }
//
// /**
// * Returns a decimal number representing the amount of the width and height
// * of the given cell that is allowed to overlap its parent. A value of 0
// * means all children must stay inside the parent, 1 means the child is
// * allowed to be placed outside of the parent such that it touches one of
// * the parents sides. If <isAllowOverlapParent> returns false for the given
// * cell, then this method returns 0.
// *
// * @param cell
// * @return Returns the overlapping value for the given cell inside its
// * parent.
// */
// public double getOverlap(Object cell)
// {
// return (isAllowOverlapParent(cell)) ? getDefaultOverlap() : 0;
// }
//
// /**
// * Gets defaultOverlap.
// */
// public double getDefaultOverlap()
// {
// return defaultOverlap;
// }
//
// /**
// * Sets defaultOverlap.
// */
// public void setDefaultOverlap(double value)
// {
// double oldValue = defaultOverlap;
// defaultOverlap = value;
//
// changeSupport.firePropertyChange("defaultOverlap", oldValue, value);
// }
//
// /**
// * Returns true if the given cell is allowed to be placed outside of the
// * parents area.
// *
// * @param cell
// * @return Returns true if the given cell may overlap its parent.
// */
// public boolean isAllowOverlapParent(Object cell)
// {
// return false;
// }
//
// /**
// * Returns the cells which are movable in the given array of cells.
// */
// public Object[] getFoldableCells(Object[] cells, final boolean collapse)
// {
// return mxGraphModel.filterCells(cells, new Filter()
// {
// public boolean filter(Object cell)
// {
// return isCellFoldable(cell, collapse);
// }
// });
// }
//
// /**
// * Returns true if the given cell is expandable. This implementation
// * returns true if the cell has at least one child and its style
// * does not specify mxConstants.STYLE_FOLDABLE to be 0.
// *
// * @param cell <mxCell> whose expandable state should be returned.
// * @return Returns true if the given cell is expandable.
// */
// public boolean isCellFoldable(Object cell, boolean collapse)
// {
// mxCellState state = view.getState(cell);
// Map<String, Object> style = (state != null) ? state.getStyle()
// : getCellStyle(cell);
//
// return model.getChildCount(cell) > 0
// && mxUtils.isTrue(style, mxConstants.STYLE_FOLDABLE, true);
// }
//
// /**
// * Returns true if the grid is enabled.
// *
// * @return Returns the enabled state of the grid.
// */
// public boolean isGridEnabled()
// {
// return gridEnabled;
// }
//
// /**
// * Sets if the grid is enabled.
// *
// * @param value Specifies if the grid should be enabled.
// */
// public void setGridEnabled(boolean value)
// {
// boolean oldValue = gridEnabled;
// gridEnabled = value;
//
// changeSupport.firePropertyChange("gridEnabled", oldValue, gridEnabled);
// }
//
// /**
// * Returns true if ports are enabled.
// *
// * @return Returns the enabled state of the ports.
// */
// public boolean isPortsEnabled()
// {
// return portsEnabled;
// }
//
// /**
// * Sets if ports are enabled.
// *
// * @param value Specifies if the ports should be enabled.
// */
// public void setPortsEnabled(boolean value)
// {
// boolean oldValue = portsEnabled;
// portsEnabled = value;
//
// changeSupport
// .firePropertyChange("portsEnabled", oldValue, portsEnabled);
// }
//
// /**
// * Returns the grid size.
// *
// * @return Returns the grid size
// */
// public int getGridSize()
// {
// return gridSize;
// }
//
// /**
// * Sets the grid size and fires a property change event for gridSize.
// *
// * @param value New grid size to be used.
// */
// public void setGridSize(int value)
// {
// int oldValue = gridSize;
// gridSize = value;
//
// changeSupport.firePropertyChange("gridSize", oldValue, gridSize);
// }
//
// /**
// * Returns alternateEdgeStyle.
// */
// public String getAlternateEdgeStyle()
// {
// return alternateEdgeStyle;
// }
//
// /**
// * Sets alternateEdgeStyle.
// */
// public void setAlternateEdgeStyle(String value)
// {
// String oldValue = alternateEdgeStyle;
// alternateEdgeStyle = value;
//
// changeSupport.firePropertyChange("alternateEdgeStyle", oldValue,
// alternateEdgeStyle);
// }
//
// /**
// * Returns true if the given cell is a valid drop target for the specified
// * cells. This returns true if the cell is a swimlane, has children and is
// * not collapsed, or if splitEnabled is true and isSplitTarget returns
// * true for the given arguments
// *
// * @param cell Object that represents the possible drop target.
// * @param cells Objects that are going to be dropped.
// * @return Returns true if the cell is a valid drop target for the given
// * cells.
// */
// public boolean isValidDropTarget(Object cell, Object[] cells)
// {
// return cell != null
// && ((isSplitEnabled() && isSplitTarget(cell, cells)) || (!model
// .isEdge(cell) && (isSwimlane(cell) || (model
// .getChildCount(cell) > 0 && !isCellCollapsed(cell)))));
// }
//
// /**
// * Returns true if split is enabled and the given edge may be splitted into
// * two edges with the given cell as a new terminal between the two.
// *
// * @param target Object that represents the edge to be splitted.
// * @param cells Array of cells to add into the given edge.
// * @return Returns true if the given edge may be splitted by the given
// * cell.
// */
// public boolean isSplitTarget(Object target, Object[] cells)
// {
// if (target != null && cells != null && cells.length == 1)
// {
// Object src = model.getTerminal(target, true);
// Object trg = model.getTerminal(target, false);
//
// return (model.isEdge(target)
// && isCellConnectable(cells[0])
// && getEdgeValidationError(target,
// model.getTerminal(target, true), cells[0]) == null
// && !model.isAncestor(cells[0], src) && !model.isAncestor(
// cells[0], trg));
// }
//
// return false;
// }
//
// /**
// * Returns the given cell if it is a drop target for the given cells or the
// * nearest ancestor that may be used as a drop target for the given cells.
// * If the given array contains a swimlane and swimlaneNesting is false
// * then this always returns null. If no cell is given, then the bottommost
// * swimlane at the location of the given event is returned.
// *
// * This function should only be used if isDropEnabled returns true.
// */
// public Object getDropTarget(Object[] cells, Point pt, Object cell)
// {
// if (!isSwimlaneNesting())
// {
// for (int i = 0; i < cells.length; i++)
// {
// if (isSwimlane(cells[i]))
// {
// return null;
// }
// }
// }
//
// // FIXME the else below does nothing if swimlane is null
// Object swimlane = null; //getSwimlaneAt(pt.x, pt.y);
//
// if (cell == null)
// {
// cell = swimlane;
// }
// /*else if (swimlane != null)
// {
// // Checks if the cell is an ancestor of the swimlane
// // under the mouse and uses the swimlane in that case
// Object tmp = model.getParent(swimlane);
//
// while (tmp != null && isSwimlane(tmp) && tmp != cell)
// {
// tmp = model.getParent(tmp);
// }
//
// if (tmp == cell)
// {
// cell = swimlane;
// }
// }*/
//
// while (cell != null && !isValidDropTarget(cell, cells)
// && model.getParent(cell) != model.getRoot())
// {
// cell = model.getParent(cell);
// }
//
// return (model.getParent(cell) != model.getRoot() && !mxUtils.contains(
// cells, cell)) ? cell : null;
// };
//
// //
// // Cell retrieval
// //
//
// /**
// * Returns the first child of the root in the model, that is, the first or
// * default layer of the diagram.
// *
// * @return Returns the default parent for new cells.
// */
// public Object getDefaultParent()
// {
// Object parent = defaultParent;
//
// if (parent == null)
// {
// parent = view.getCurrentRoot();
//
// if (parent == null)
// {
// Object root = model.getRoot();
// parent = model.getChildAt(root, 0);
// }
// }
//
// return parent;
// }
//
// /**
// * Sets the default parent to be returned by getDefaultParent.
// * Set this to null to return the first child of the root in
// * getDefaultParent.
// */
// public void setDefaultParent(Object value)
// {
// defaultParent = value;
// }
//
// /**
// * Returns the visible child vertices of the given parent.
// *
// * @param parent Cell whose children should be returned.
// */
// public Object[] getChildVertices(Object parent)
// {
// return getChildCells(parent, true, false);
// }
//
// /**
// * Returns the visible child edges of the given parent.
// *
// * @param parent Cell whose children should be returned.
// */
// public Object[] getChildEdges(Object parent)
// {
// return getChildCells(parent, false, true);
// }
//
// /**
// * Returns the visible children of the given parent.
// *
// * @param parent Cell whose children should be returned.
// */
// public Object[] getChildCells(Object parent)
// {
// return getChildCells(parent, false, false);
// }
//
// /**
// * Returns the visible child vertices or edges in the given parent. If
// * vertices and edges is false, then all children are returned.
// *
// * @param parent Cell whose children should be returned.
// * @param vertices Specifies if child vertices should be returned.
// * @param edges Specifies if child edges should be returned.
// * @return Returns the child vertices and edges.
// */
// public Object[] getChildCells(Object parent, boolean vertices, boolean edges)
// {
// Object[] cells = mxGraphModel.getChildCells(model, parent, vertices,
// edges);
// List<Object> result = new ArrayList<Object>(cells.length);
//
// // Filters out the non-visible child cells
// for (int i = 0; i < cells.length; i++)
// {
// if (isCellVisible(cells[i]))
// {
// result.add(cells[i]);
// }
// }
//
// return result.toArray();
// }
//
// /**
// * Returns all visible edges connected to the given cell without loops.
// *
// * @param cell Cell whose connections should be returned.
// * @return Returns the connected edges for the given cell.
// */
// public Object[] getConnections(Object cell)
// {
// return getConnections(cell, null);
// }
//
// /**
// * Returns all visible edges connected to the given cell without loops.
// * If the optional parent argument is specified, then only child
// * edges of the given parent are returned.
// *
// * @param cell Cell whose connections should be returned.
// * @param parent Optional parent of the opposite end for a connection
// * to be returned.
// * @return Returns the connected edges for the given cell.
// */
// public Object[] getConnections(Object cell, Object parent)
// {
// return getConnections(cell, parent, false);
// }
//
// /**
// * Returns all visible edges connected to the given cell without loops.
// * If the optional parent argument is specified, then only child
// * edges of the given parent are returned.
// *
// * @param cell Cell whose connections should be returned.
// * @param parent Optional parent of the opposite end for a connection
// * to be returned.
// * @return Returns the connected edges for the given cell.
// */
// public Object[] getConnections(Object cell, Object parent, boolean recurse)
// {
// return getEdges(cell, parent, true, true, false, recurse);
// }
//
// /**
// * Returns all incoming visible edges connected to the given cell without
// * loops.
// *
// * @param cell Cell whose incoming edges should be returned.
// * @return Returns the incoming edges of the given cell.
// */
// public Object[] getIncomingEdges(Object cell)
// {
// return getIncomingEdges(cell, null);
// }
//
// /**
// * Returns the visible incoming edges for the given cell. If the optional
// * parent argument is specified, then only child edges of the given parent
// * are returned.
// *
// * @param cell Cell whose incoming edges should be returned.
// * @param parent Optional parent of the opposite end for an edge
// * to be returned.
// * @return Returns the incoming edges of the given cell.
// */
// public Object[] getIncomingEdges(Object cell, Object parent)
// {
// return getEdges(cell, parent, true, false, false);
// }
//
// /**
// * Returns all outgoing visible edges connected to the given cell without
// * loops.
// *
// * @param cell Cell whose outgoing edges should be returned.
// * @return Returns the outgoing edges of the given cell.
// */
// public Object[] getOutgoingEdges(Object cell)
// {
// return getOutgoingEdges(cell, null);
// }
//
// /**
// * Returns the visible outgoing edges for the given cell. If the optional
// * parent argument is specified, then only child edges of the given parent
// * are returned.
// *
// * @param cell Cell whose outgoing edges should be returned.
// * @param parent Optional parent of the opposite end for an edge
// * to be returned.
// * @return Returns the outgoing edges of the given cell.
// */
// public Object[] getOutgoingEdges(Object cell, Object parent)
// {
// return getEdges(cell, parent, false, true, false);
// }
//
// /**
// * Returns all visible edges connected to the given cell including loops.
// *
// * @param cell Cell whose edges should be returned.
// * @return Returns the edges of the given cell.
// */
// public Object[] getEdges(Object cell)
// {
// return getEdges(cell, null);
// }
//
// /**
// * Returns all visible edges connected to the given cell including loops.
// *
// * @param cell Cell whose edges should be returned.
// * @param parent Optional parent of the opposite end for an edge
// * to be returned.
// * @return Returns the edges of the given cell.
// */
// public Object[] getEdges(Object cell, Object parent)
// {
// return getEdges(cell, parent, true, true, true);
// }
//
// /**
// * Returns the incoming and/or outgoing edges for the given cell.
// * If the optional parent argument is specified, then only edges are returned
// * where the opposite is in the given parent cell.
// *
// * @param cell Cell whose edges should be returned.
// * @param parent Optional parent. If specified the opposite end of any edge
// * must be a direct child of that parent in order for the edge to be returned.
// * @param incoming Specifies if incoming edges should be included in the
// * result.
// * @param outgoing Specifies if outgoing edges should be included in the
// * result.
// * @param includeLoops Specifies if loops should be included in the result.
// * @return Returns the edges connected to the given cell.
// */
// public Object[] getEdges(Object cell, Object parent, boolean incoming,
// boolean outgoing, boolean includeLoops)
// {
// return getEdges(cell, parent, incoming, outgoing, includeLoops, false);
// }
//
// /**
// * Returns the incoming and/or outgoing edges for the given cell.
// * If the optional parent argument is specified, then only edges are returned
// * where the opposite is in the given parent cell.
// *
// * @param cell Cell whose edges should be returned.
// * @param parent Optional parent. If specified the opposite end of any edge
// * must be a child of that parent in order for the edge to be returned. The
// * recurse parameter specifies whether or not it must be the direct child
// * or the parent just be an ancestral parent.
// * @param incoming Specifies if incoming edges should be included in the
// * result.
// * @param outgoing Specifies if outgoing edges should be included in the
// * result.
// * @param includeLoops Specifies if loops should be included in the result.
// * @param recurse Specifies if the parent specified only need be an ancestral
// * parent, <code>true</code>, or the direct parent, <code>false</code>
// * @return Returns the edges connected to the given cell.
// */
// public Object[] getEdges(Object cell, Object parent, boolean incoming,
// boolean outgoing, boolean includeLoops, boolean recurse)
// {
// boolean isCollapsed = isCellCollapsed(cell);
// List<Object> edges = new ArrayList<Object>();
// int childCount = model.getChildCount(cell);
//
// for (int i = 0; i < childCount; i++)
// {
// Object child = model.getChildAt(cell, i);
//
// if (isCollapsed || !isCellVisible(child))
// {
// edges.addAll(Arrays.asList(mxGraphModel.getEdges(model, child,
// incoming, outgoing, includeLoops)));
// }
// }
//
// edges.addAll(Arrays.asList(mxGraphModel.getEdges(model, cell, incoming,
// outgoing, includeLoops)));
// List<Object> result = new ArrayList<Object>(edges.size());
// Iterator<Object> it = edges.iterator();
//
// while (it.hasNext())
// {
// Object edge = it.next();
// mxCellState state = view.getState(edge);
// Object source = (state != null) ? state.getVisibleTerminal(true)
// : view.getVisibleTerminal(edge, true);
// Object target = (state != null) ? state.getVisibleTerminal(false)
// : view.getVisibleTerminal(edge, false);
//
// if ((includeLoops && source == target)
// || ((source != target) && ((incoming && target == cell && (parent == null || isValidAncestor(
// source, parent, recurse))) || (outgoing
// && source == cell && (parent == null || isValidAncestor(
// target, parent, recurse))))))
// {
// result.add(edge);
// }
// }
//
// return result.toArray();
// }
//
// /**
// * Returns whether or not the specified parent is a valid
// * ancestor of the specified cell, either direct or indirectly
// * based on whether ancestor recursion is enabled.
// * @param cell the possible child cell
// * @param parent the possible parent cell
// * @param recurse whether or not to recurse the child ancestors
// * @return whether or not the specified parent is a valid
// * ancestor of the specified cell, either direct or indirectly
// * based on whether ancestor recursion is enabled.
// */
// public boolean isValidAncestor(Object cell, Object parent, boolean recurse)
// {
// return (recurse ? model.isAncestor(parent, cell) : model
// .getParent(cell) == parent);
// }
//
// /**
// * Returns all distinct visible opposite cells of the terminal on the given
// * edges.
// *
// * @param edges
// * @param terminal
// * @return Returns the terminals at the opposite ends of the given edges.
// */
// public Object[] getOpposites(Object[] edges, Object terminal)
// {
// return getOpposites(edges, terminal, true, true);
// }
//
// /**
// * Returns all distincts visible opposite cells for the specified terminal
// * on the given edges.
// *
// * @param edges Edges whose opposite terminals should be returned.
// * @param terminal Terminal that specifies the end whose opposite should be
// * returned.
// * @param sources Specifies if source terminals should be included in the
// * result.
// * @param targets Specifies if target terminals should be included in the
// * result.
// * @return Returns the cells at the opposite ends of the given edges.
// */
// public Object[] getOpposites(Object[] edges, Object terminal,
// boolean sources, boolean targets)
// {
// Collection<Object> terminals = new LinkedHashSet<Object>();
//
// if (edges != null)
// {
// for (int i = 0; i < edges.length; i++)
// {
// mxCellState state = view.getState(edges[i]);
// Object source = (state != null) ? state
// .getVisibleTerminal(true) : view.getVisibleTerminal(
// edges[i], true);
// Object target = (state != null) ? state
// .getVisibleTerminal(false) : view.getVisibleTerminal(
// edges[i], false);
//
// // Checks if the terminal is the source of
// // the edge and if the target should be
// // stored in the result
// if (targets && source == terminal && target != null
// && target != terminal)
// {
// terminals.add(target);
// }
//
// // Checks if the terminal is the taget of
// // the edge and if the source should be
// // stored in the result
// else if (sources && target == terminal && source != null
// && source != terminal)
// {
// terminals.add(source);
// }
// }
// }
//
// return terminals.toArray();
// }
//
// /**
// * Returns the edges between the given source and target. This takes into
// * account collapsed and invisible cells and returns the connected edges
// * as displayed on the screen.
// *
// * @param source
// * @param target
// * @return Returns all edges between the given terminals.
// */
// public Object[] getEdgesBetween(Object source, Object target)
// {
// return getEdgesBetween(source, target, false);
// }
//
// /**
// * Returns the edges between the given source and target. This takes into
// * account collapsed and invisible cells and returns the connected edges
// * as displayed on the screen.
// *
// * @param source
// * @param target
// * @param directed
// * @return Returns all edges between the given terminals.
// */
// public Object[] getEdgesBetween(Object source, Object target,
// boolean directed)
// {
// Object[] edges = getEdges(source);
// List<Object> result = new ArrayList<Object>(edges.length);
//
// // Checks if the edge is connected to the correct
// // cell and adds any match to the result
// for (int i = 0; i < edges.length; i++)
// {
// mxCellState state = view.getState(edges[i]);
// Object src = (state != null) ? state.getVisibleTerminal(true)
// : view.getVisibleTerminal(edges[i], true);
// Object trg = (state != null) ? state.getVisibleTerminal(false)
// : view.getVisibleTerminal(edges[i], false);
//
// if ((src == source && trg == target)
// || (!directed && src == target && trg == source))
// {
// result.add(edges[i]);
// }
// }
//
// return result.toArray();
// }
//
// /**
// * Returns the children of the given parent that are contained in the
// * halfpane from the given point (x0, y0) rightwards and downwards
// * depending on rightHalfpane and bottomHalfpane.
// *
// * @param x0 X-coordinate of the origin.
// * @param y0 Y-coordinate of the origin.
// * @param parent <mxCell> whose children should be checked.
// * @param rightHalfpane Boolean indicating if the cells in the right halfpane
// * from the origin should be returned.
// * @param bottomHalfpane Boolean indicating if the cells in the bottom halfpane
// * from the origin should be returned.
// * @return Returns the cells beyond the given halfpane.
// */
// public Object[] getCellsBeyond(double x0, double y0, Object parent,
// boolean rightHalfpane, boolean bottomHalfpane)
// {
// if (parent == null)
// {
// parent = getDefaultParent();
// }
//
// int childCount = model.getChildCount(parent);
// List<Object> result = new ArrayList<Object>(childCount);
//
// if (rightHalfpane || bottomHalfpane)
// {
//
// if (parent != null)
// {
// for (int i = 0; i < childCount; i++)
// {
// Object child = model.getChildAt(parent, i);
// mxCellState state = view.getState(child);
//
// if (isCellVisible(child) && state != null)
// {
// if ((!rightHalfpane || state.getX() >= x0)
// && (!bottomHalfpane || state.getY() >= y0))
// {
// result.add(child);
// }
// }
// }
// }
// }
//
// return result.toArray();
// }
//
// /**
// * Returns all visible children in the given parent which do not have
// * incoming edges. If the result is empty then the with the greatest
// * difference between incoming and outgoing edges is returned. This
// * takes into account edges that are being promoted to the given
// * root due to invisible children or collapsed cells.
// *
// * @param parent Cell whose children should be checked.
// * @return List of tree roots in parent.
// */
// public List<Object> findTreeRoots(Object parent)
// {
// return findTreeRoots(parent, false);
// }
//
// /**
// * Returns all visible children in the given parent which do not have
// * incoming edges. If the result is empty then the children with the
// * maximum difference between incoming and outgoing edges are returned.
// * This takes into account edges that are being promoted to the given
// * root due to invisible children or collapsed cells.
// *
// * @param parent Cell whose children should be checked.
// * @param isolate Specifies if edges should be ignored if the opposite
// * end is not a child of the given parent cell.
// * @return List of tree roots in parent.
// */
// public List<Object> findTreeRoots(Object parent, boolean isolate)
// {
// return findTreeRoots(parent, isolate, false);
// }
//
// /**
// * Returns all visible children in the given parent which do not have
// * incoming edges. If the result is empty then the children with the
// * maximum difference between incoming and outgoing edges are returned.
// * This takes into account edges that are being promoted to the given
// * root due to invisible children or collapsed cells.
// *
// * @param parent Cell whose children should be checked.
// * @param isolate Specifies if edges should be ignored if the opposite
// * end is not a child of the given parent cell.
// * @param invert Specifies if outgoing or incoming edges should be counted
// * for a tree root. If false then outgoing edges will be counted.
// * @return List of tree roots in parent.
// */
// public List<Object> findTreeRoots(Object parent, boolean isolate,
// boolean invert)
// {
// List<Object> roots = new ArrayList<Object>();
//
// if (parent != null)
// {
// int childCount = model.getChildCount(parent);
// Object best = null;
// int maxDiff = 0;
//
// for (int i = 0; i < childCount; i++)
// {
// Object cell = model.getChildAt(parent, i);
//
// if (model.isVertex(cell) && isCellVisible(cell))
// {
// Object[] conns = getConnections(cell, (isolate) ? parent
// : null);
// int fanOut = 0;
// int fanIn = 0;
//
// for (int j = 0; j < conns.length; j++)
// {
// Object src = view.getVisibleTerminal(conns[j], true);
//
// if (src == cell)
// {
// fanOut++;
// }
// else
// {
// fanIn++;
// }
// }
//
// if ((invert && fanOut == 0 && fanIn > 0)
// || (!invert && fanIn == 0 && fanOut > 0))
// {
// roots.add(cell);
// }
//
// int diff = (invert) ? fanIn - fanOut : fanOut - fanIn;
//
// if (diff > maxDiff)
// {
// maxDiff = diff;
// best = cell;
// }
// }
// }
//
// if (roots.isEmpty() && best != null)
// {
// roots.add(best);
// }
// }
//
// return roots;
// }
//
// /**
// * Traverses the tree starting at the given vertex. Here is how to use this
// * method for a given vertex (root) which is typically the root of a tree:
// * <code>
// * graph.traverse(root, true, new mxICellVisitor()
// * {
// * public boolean visit(Object vertex, Object edge)
// * {
// * System.out.println("edge="+graph.convertValueToString(edge)+
// * " vertex="+graph.convertValueToString(vertex));
// *
// * return true;
// * }
// * });
// * </code>
// *
// * @param vertex
// * @param directed
// * @param visitor
// */
// public void traverse(Object vertex, boolean directed, mxICellVisitor visitor)
// {
// traverse(vertex, directed, visitor, null, null);
// }
//
// /**
// * Traverses the (directed) graph invoking the given function for each
// * visited vertex and edge. The function is invoked with the current vertex
// * and the incoming edge as a parameter. This implementation makes sure
// * each vertex is only visited once. The function may return false if the
// * traversal should stop at the given vertex.
// *
// * @param vertex <mxCell> that represents the vertex where the traversal starts.
// * @param directed Optional boolean indicating if edges should only be traversed
// * from source to target. Default is true.
// * @param visitor Visitor that takes the current vertex and the incoming edge.
// * The traversal stops if the function returns false.
// * @param edge Optional <mxCell> that represents the incoming edge. This is
// * null for the first step of the traversal.
// * @param visited Optional array of cell paths for the visited cells.
// */
// public void traverse(Object vertex, boolean directed,
// mxICellVisitor visitor, Object edge, Set<Object> visited)
// {
// if (vertex != null && visitor != null)
// {
// if (visited == null)
// {
// visited = new HashSet<Object>();
// }
//
// if (!visited.contains(vertex))
// {
// visited.add(vertex);
//
// if (visitor.visit(vertex, edge))
// {
// int edgeCount = model.getEdgeCount(vertex);
//
// if (edgeCount > 0)
// {
// for (int i = 0; i < edgeCount; i++)
// {
// Object e = model.getEdgeAt(vertex, i);
// boolean isSource = model.getTerminal(e, true) == vertex;
//
// if (!directed || isSource)
// {
// Object next = model.getTerminal(e, !isSource);
// traverse(next, directed, visitor, e, visited);
// }
// }
// }
// }
// }
// }
// }
//
// //
// // Selection
// //
//
// /**
// *
// */
// public mxGraphSelectionModel getSelectionModel()
// {
// return selectionModel;
// }
//
// /**
// *
// */
// public int getSelectionCount()
// {
// return selectionModel.size();
// }
//
// /**
// *
// * @param cell
// * @return Returns true if the given cell is selected.
// */
// public boolean isCellSelected(Object cell)
// {
// return selectionModel.isSelected(cell);
// }
//
// /**
// *
// * @return Returns true if the selection is empty.
// */
// public boolean isSelectionEmpty()
// {
// return selectionModel.isEmpty();
// }
//
// /**
// *
// */
// public void clearSelection()
// {
// selectionModel.clear();
// }
//
// /**
// *
// * @return Returns the selection cell.
// */
// public Object getSelectionCell()
// {
// return selectionModel.getCell();
// }
//
// /**
// *
// * @param cell
// */
// public void setSelectionCell(Object cell)
// {
// selectionModel.setCell(cell);
// }
//
// /**
// *
// * @return Returns the selection cells.
// */
// public Object[] getSelectionCells()
// {
// return selectionModel.getCells();
// }
//
// /**
// *
// */
// public void setSelectionCells(Object[] cells)
// {
// selectionModel.setCells(cells);
// }
//
// /**
// *
// * @param cells
// */
// public void setSelectionCells(Collection<Object> cells)
// {
// if (cells != null)
// {
// setSelectionCells(cells.toArray());
// }
// }
//
// /**
// *
// */
// public void addSelectionCell(Object cell)
// {
// selectionModel.addCell(cell);
// }
//
// /**
// *
// */
// public void addSelectionCells(Object[] cells)
// {
// selectionModel.addCells(cells);
// }
//
// /**
// *
// */
// public void removeSelectionCell(Object cell)
// {
// selectionModel.removeCell(cell);
// }
//
// /**
// *
// */
// public void removeSelectionCells(Object[] cells)
// {
// selectionModel.removeCells(cells);
// }
//
// /**
// * Selects the next cell.
// */
// public void selectNextCell()
// {
// selectCell(true, false, false);
// }
//
// /**
// * Selects the previous cell.
// */
// public void selectPreviousCell()
// {
// selectCell(false, false, false);
// }
//
// /**
// * Selects the parent cell.
// */
// public void selectParentCell()
// {
// selectCell(false, true, false);
// }
//
// /**
// * Selects the first child cell.
// */
// public void selectChildCell()
// {
// selectCell(false, false, true);
// }
//
// /**
// * Selects the next, parent, first child or previous cell, if all arguments
// * are false.
// *
// * @param isNext
// * @param isParent
// * @param isChild
// */
// public void selectCell(boolean isNext, boolean isParent, boolean isChild)
// {
// Object cell = getSelectionCell();
//
// if (getSelectionCount() > 1)
// {
// clearSelection();
// }
//
// Object parent = (cell != null) ? model.getParent(cell)
// : getDefaultParent();
// int childCount = model.getChildCount(parent);
//
// if (cell == null && childCount > 0)
// {
// Object child = model.getChildAt(parent, 0);
// setSelectionCell(child);
// }
// else if ((cell == null || isParent) && view.getState(parent) != null
// && model.getGeometry(parent) != null)
// {
// if (getCurrentRoot() != parent)
// {
// setSelectionCell(parent);
// }
// }
// else if (cell != null && isChild)
// {
// int tmp = model.getChildCount(cell);
//
// if (tmp > 0)
// {
// Object child = model.getChildAt(cell, 0);
// setSelectionCell(child);
// }
// }
// else if (childCount > 0)
// {
// int i = ((mxICell) parent).getIndex((mxICell) cell);
//
// if (isNext)
// {
// i++;
// setSelectionCell(model.getChildAt(parent, i % childCount));
// }
// else
// {
// i--;
// int index = (i < 0) ? childCount - 1 : i;
// setSelectionCell(model.getChildAt(parent, index));
// }
// }
// }
//
// /**
// * Selects all vertices inside the default parent.
// */
// public void selectVertices()
// {
// selectVertices(null);
// }
//
// /**
// * Selects all vertices inside the given parent or the default parent
// * if no parent is given.
// */
// public void selectVertices(Object parent)
// {
// selectCells(true, false, parent);
// }
//
// /**
// * Selects all vertices inside the default parent.
// */
// public void selectEdges()
// {
// selectEdges(null);
// }
//
// /**
// * Selects all vertices inside the given parent or the default parent
// * if no parent is given.
// */
// public void selectEdges(Object parent)
// {
// selectCells(false, true, parent);
// }
//
// /**
// * Selects all vertices and/or edges depending on the given boolean
// * arguments recursively, starting at the default parent. Use
// * <code>selectAll</code> to select all cells.
// *
// * @param vertices Boolean indicating if vertices should be selected.
// * @param edges Boolean indicating if edges should be selected.
// */
// public void selectCells(boolean vertices, boolean edges)
// {
// selectCells(vertices, edges, null);
// }
//
// /**
// * Selects all vertices and/or edges depending on the given boolean
// * arguments recursively, starting at the given parent or the default
// * parent if no parent is specified. Use <code>selectAll</code> to select
// * all cells.
// *
// * @param vertices Boolean indicating if vertices should be selected.
// * @param edges Boolean indicating if edges should be selected.
// * @param parent Optional cell that acts as the root of the recursion.
// * Default is <code>defaultParent</code>.
// */
// public void selectCells(final boolean vertices, final boolean edges,
// Object parent)
// {
// if (parent == null)
// {
// parent = getDefaultParent();
// }
//
// Collection<Object> cells = mxGraphModel.filterDescendants(getModel(),
// new mxGraphModel.Filter()
// {
//
// /**
// *
// */
// public boolean filter(Object cell)
// {
// return view.getState(cell) != null
// && model.getChildCount(cell) == 0
// && ((model.isVertex(cell) && vertices) || (model
// .isEdge(cell) && edges));
// }
//
// });
// setSelectionCells(cells);
// }
//
// /**
// *
// */
// public void selectAll()
// {
// selectAll(null);
// }
//
// /**
// * Selects all children of the given parent cell or the children of the
// * default parent if no parent is specified. To select leaf vertices and/or
// * edges use <selectCells>.
// *
// * @param parent Optional <mxCell> whose children should be selected.
// * Default is <defaultParent>.
// */
// public void selectAll(Object parent)
// {
// if (parent == null)
// {
// parent = getDefaultParent();
// }
//
// Object[] children = mxGraphModel.getChildren(model, parent);
//
// if (children != null)
// {
// setSelectionCells(children);
// }
// }
//
// //
// // Images and drawing
// //
//
// /**
// * Draws the graph onto the given canvas.
// *
// * @param canvas Canvas onto which the graph should be drawn.
// */
// public void drawGraph(mxICanvas canvas)
// {
// drawCell(canvas, getModel().getRoot());
// }
//
// /**
// * Draws the given cell and its descendants onto the specified canvas.
// *
// * @param canvas Canvas onto which the cell should be drawn.
// * @param cell Cell that should be drawn onto the canvas.
// */
// public void drawCell(mxICanvas canvas, Object cell)
// {
// drawState(canvas, getView().getState(cell), true);
//
// // Draws the children on top of their parent
// int childCount = model.getChildCount(cell);
//
// for (int i = 0; i < childCount; i++)
// {
// Object child = model.getChildAt(cell, i);
// drawCell(canvas, child);
// }
// }
//
// /**
// * Draws the cell state with the given label onto the canvas. No
// * children or descendants are painted here. This method invokes
// * cellDrawn after the cell, but not its descendants have been
// * painted.
// *
// * @param canvas Canvas onto which the cell should be drawn.
// * @param state State of the cell to be drawn.
// * @param drawLabel Indicates if the label should be drawn.
// */
// public void drawState(mxICanvas canvas, mxCellState state, boolean drawLabel)
// {
// Object cell = (state != null) ? state.getCell() : null;
//
// if (cell != null && cell != view.getCurrentRoot()
// && cell != model.getRoot()
// && (model.isVertex(cell) || model.isEdge(cell)))
// {
// Object obj = canvas.drawCell(state);
// Object lab = null;
//
// // Holds the current clipping region in case the label will
// // be clipped
// Shape clip = null;
// Rectangle newClip = state.getRectangle();
//
// // Indirection for image canvas that contains a graphics canvas
// mxICanvas clippedCanvas = (isLabelClipped(state.getCell())) ? canvas
// : null;
//
// if (clippedCanvas instanceof mxImageCanvas)
// {
// clippedCanvas = ((mxImageCanvas) clippedCanvas)
// .getGraphicsCanvas();
// // TODO: Shift newClip to match the image offset
// //Point pt = ((mxImageCanvas) canvas).getTranslate();
// //newClip.translate(-pt.x, -pt.y);
// }
//
// if (clippedCanvas instanceof mxGraphics2DCanvas)
// {
// Graphics g = ((mxGraphics2DCanvas) clippedCanvas).getGraphics();
// clip = g.getClip();
//
// // Ensure that our new clip resides within our old clip
// if (clip instanceof Rectangle)
// {
// g.setClip(newClip.intersection((Rectangle) clip));
// }
// // Otherwise, default to original implementation
// else
// {
// g.setClip(newClip);
// }
// }
//
// if (drawLabel)
// {
// String label = state.getLabel();
//
// if (label != null && state.getLabelBounds() != null)
// {
// lab = canvas.drawLabel(label, state, isHtmlLabel(cell));
// }
// }
//
// // Restores the previous clipping region
// if (clippedCanvas instanceof mxGraphics2DCanvas)
// {
// ((mxGraphics2DCanvas) clippedCanvas).getGraphics()
// .setClip(clip);
// }
//
// // Invokes the cellDrawn callback with the object which was created
// // by the canvas to represent the cell graphically
// if (obj != null)
// {
// cellDrawn(canvas, state, obj, lab);
// }
// }
// }
//
// /**
// * Called when a cell has been painted as the specified object, typically a
// * DOM node that represents the given cell graphically in a document.
// */
// protected void cellDrawn(mxICanvas canvas, mxCellState state,
// Object element, Object labelElement)
// {
// if (element instanceof Element)
// {
// String link = getLinkForCell(state.getCell());
//
// if (link != null)
// {
// String title = getToolTipForCell(state.getCell());
// Element elem = (Element) element;
//
// if (elem.getNodeName().startsWith("v:"))
// {
// elem.setAttribute("href", link.toString());
//
// if (title != null)
// {
// elem.setAttribute("title", title);
// }
// }
// else if (elem.getOwnerDocument().getElementsByTagName("svg")
// .getLength() > 0)
// {
// Element xlink = elem.getOwnerDocument().createElement("a");
// xlink.setAttribute("xlink:href", link.toString());
//
// elem.getParentNode().replaceChild(xlink, elem);
// xlink.appendChild(elem);
//
// if (title != null)
// {
// xlink.setAttribute("xlink:title", title);
// }
//
// elem = xlink;
// }
// else
// {
// Element a = elem.getOwnerDocument().createElement("a");
// a.setAttribute("href", link.toString());
// a.setAttribute("style", "text-decoration:none;");
//
// elem.getParentNode().replaceChild(a, elem);
// a.appendChild(elem);
//
// if (title != null)
// {
// a.setAttribute("title", title);
// }
//
// elem = a;
// }
//
// String target = getTargetForCell(state.getCell());
//
// if (target != null)
// {
// elem.setAttribute("target", target);
// }
// }
// }
// }
//
// /**
// * Returns the hyperlink to be used for the given cell.
// */
// protected String getLinkForCell(Object cell)
// {
// return null;
// }
//
// /**
// * Returns the hyperlink to be used for the given cell.
// */
// protected String getTargetForCell(Object cell)
// {
// return null;
// }
//
// //
// // Redirected to change support
// //
//
// /**
// * @param listener
// * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.beans.PropertyChangeListener)
// */
// public void addPropertyChangeListener(PropertyChangeListener listener)
// {
// changeSupport.addPropertyChangeListener(listener);
// }
//
// /**
// * @param propertyName
// * @param listener
// * @see java.beans.PropertyChangeSupport#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
// */
// public void addPropertyChangeListener(String propertyName,
// PropertyChangeListener listener)
// {
// changeSupport.addPropertyChangeListener(propertyName, listener);
// }
//
// /**
// * @param listener
// * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.beans.PropertyChangeListener)
// */
// public void removePropertyChangeListener(PropertyChangeListener listener)
// {
// changeSupport.removePropertyChangeListener(listener);
// }
//
// /**
// * @param propertyName
// * @param listener
// * @see java.beans.PropertyChangeSupport#removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
// */
// public void removePropertyChangeListener(String propertyName,
// PropertyChangeListener listener)
// {
// changeSupport.removePropertyChangeListener(propertyName, listener);
// }
//
// /**
// * Prints the version number on the console.
// */
// public static void main(String[] args)
// {
// System.out.println("mxGraph version \"" + VERSION + "\"");
// }
}
| [
"[email protected]"
] | |
222909f524c9d7c2fb4cbcc05d4cfa4bd5e2f015 | 41d6f0e7f5f8d49aac926915afd06267d3556a32 | /src/main/java/com/taobao/itest/ITestDataDriverBaseCase.java | 6ac5c4d398807a66a9f8ee6873d85b4fec4e837c | [] | no_license | taoyufan/automanx-api | 3412470ce3b6de5cc5ecdf085ce202243eeeaac8 | 0b996a5ef8be57495365d259e7b5876e0a06d795 | refs/heads/master | 2021-01-10T18:40:47.662279 | 2013-12-10T07:10:21 | 2013-12-10T07:10:21 | 15,069,475 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,632 | java | /*
* Copyright 2011 Alibaba Group Holding Limited.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.taobao.itest;
import java.sql.Timestamp;
import java.util.Date;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.runner.RunWith;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import com.taobao.itest.core.ItestDataDriverRunner;
import com.taobao.itest.core.TestListeners;
import com.taobao.itest.listener.ITestDataSetBeforeListener;
import com.taobao.itest.listener.ITestDataSetListener;
import com.taobao.itest.listener.ITestHsfStarterListener;
import com.taobao.itest.listener.ITestResourceListener;
import com.taobao.itest.listener.ITestSpringContextListener;
import com.taobao.itest.listener.ITestSpringInjectionListener;
import com.taobao.itest.listener.ItestDataPrepareListener;
import com.taobao.itest.util.DateConverter;
/**
* 可以接着使用基类ITestSpringContextBaseCase,同样具有数据驱动的功能
*
* @author yufan.yq
*
*/
@Deprecated
@RunWith(ItestDataDriverRunner.class)
@TestListeners({ ITestHsfStarterListener.class, ITestSpringContextListener.class, ITestSpringInjectionListener.class, ITestResourceListener.class, ITestDataSetBeforeListener.class, ITestDataSetListener.class, ItestDataPrepareListener.class })
public class ITestDataDriverBaseCase implements ApplicationContextAware {
static {
ConvertUtils.register(new DateConverter(), Timestamp.class);
ConvertUtils.register(new DateConverter(), Date.class);
ConvertUtils.register(new DateConverter(), String.class);
}
protected final Log logger = LogFactory.getLog(getClass());
protected ApplicationContext applicationContext;
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.applicationContext = applicationContext;
}
}
| [
"[email protected]"
] | |
83711f56b53aa4676451690a72a5f048710e4274 | a21d0531793c60958adae61b1542d2fd4944780d | /src/main/java/com/zpc/service/impl/ScheduleServiceImpl.java | 582353398e30a0cf65b367862cade8e1c7b4e1b1 | [] | no_license | zpc113/cloud_queue | 49ffa83af46e0ac659208ca39ae65e75cc5e34c5 | 828b3f99904cff1f888376d10dd5f49e02e0ca9e | refs/heads/master | 2021-05-15T06:14:46.002463 | 2018-01-04T15:00:52 | 2018-01-04T15:00:52 | 115,430,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 817 | java | package com.zpc.service.impl;
import com.zpc.dao.controlcenter.ScheduleDao;
import com.zpc.entity.controlcenter.Schedule;
import com.zpc.service.ScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* Created by 和谐社会人人有责 on 2017/12/3.
*/
@Service
public class ScheduleServiceImpl implements ScheduleService {
@Autowired
private ScheduleDao scheduleDao;
public List<Schedule> findAll(long taskId) {
return scheduleDao.findAll(taskId);
}
public long create(Schedule schedule) {
return scheduleDao.create(schedule);
}
public void setEnd(Date endTime, long scheduleId) {
scheduleDao.setEnd(endTime , scheduleId);
}
}
| [
"[email protected]"
] | |
acea516477348c01f159405d2f092c8ece4d62fa | bb771cbfbea9f2ac5f916c29bb3668bba7435e7c | /examples/oasis-web-demo/src/main/java/cn/xyz/chaos/examples/demo/provider/impl/AttributeProviderImpl.java | 95df7e8f359af779e0793b89fbdc4517024e5f5e | [] | no_license | 18965050/oasis | 3184123094bd62d62d6ae9f31622635cebbd2310 | e5f1cfa32b74fe37aaf0872c497f7c8502df052d | refs/heads/master | 2021-01-20T19:39:27.032176 | 2019-03-19T06:32:50 | 2019-03-19T06:32:50 | 61,260,765 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,566 | java | package cn.xyz.chaos.examples.demo.provider.impl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import cn.xyz.chaos.examples.demo.entity.Attribute;
import cn.xyz.chaos.examples.demo.entity.criteria.ProdSkuLinkCriteria;
import cn.xyz.chaos.examples.demo.provider.AttributeProvider;
import cn.xyz.chaos.examples.demo.provider.dto.AttributeDTO;
import cn.xyz.chaos.examples.demo.repository.dao.ProdSkuLinkDAO;
import cn.xyz.chaos.examples.demo.repository.dao.ProdSkuOptionDAO;
import cn.xyz.chaos.orm.mybatis.easylist.paginator.domain.PageBounds;
import cn.xyz.chaos.orm.mybatis.easylist.paginator.domain.PageList;
@Repository
public class AttributeProviderImpl implements AttributeProvider {
@Autowired
private ProdSkuOptionDAO attributeDAO;
@Autowired
private ProdSkuLinkDAO prodAttrDAO;
@Autowired
private Mapper dozerMapper;
@Override
public Map<String, Object> pageList(AttributeDTO queryDTO) {
Map<String, Object> map = new HashMap<String, Object>();
PageBounds pageBounds = new PageBounds(queryDTO.getLimit(), queryDTO.getPageIndex());
Attribute queryInfo = this.dozerMapper.map(queryDTO, Attribute.class, "attrDTO2Attr");
PageList<Attribute> attrList = this.attributeDAO.selectBySelectiveWithRowbounds(queryInfo, pageBounds);
map.put("currentPage", attrList.getPaginator().getPage());
map.put("totalPage", attrList.getPaginator().getTotalPages());
List<AttributeDTO> attrDTOList = new ArrayList<AttributeDTO>();
if (!CollectionUtils.isEmpty(attrList)) {
for (Attribute attr : attrList) {
attrDTOList.add(this.dozerMapper.map(attr, AttributeDTO.class, "attr2attrDTO"));
}
}
map.put("attrList", attrDTOList);
return map;
}
@Override
public AttributeDTO get(Integer id) {
return this.dozerMapper.map(this.attributeDAO.selectById(id), AttributeDTO.class, "attr2attrDTO");
}
@Override
public void add(AttributeDTO attrDTO) {
this.attributeDAO.insert(this.dozerMapper.map(attrDTO, Attribute.class, "attrDTO2Attr"));
}
@Override
public void update(AttributeDTO attrDTO) {
this.attributeDAO.updateByPrimaryKeySelective(this.dozerMapper.map(attrDTO, Attribute.class, "attrDTO2Attr"));
}
@Override
@Transactional
public void delete(Integer id) {
// (1)解除产品和标签属性绑定关系
ProdSkuLinkCriteria prodAttrCriteria = new ProdSkuLinkCriteria();
ProdSkuLinkCriteria.Criteria criteria = prodAttrCriteria.or();
criteria.andSkuOptionIdEqualTo(id);
this.prodAttrDAO.deleteByCriteria(prodAttrCriteria);
// (2) 删除属性
this.attributeDAO.deleteByPrimaryKey(id);
}
@Override
public List<AttributeDTO> getByTagId(Integer tagId) {
List<Attribute> attrList = this.attributeDAO.selectByTagId(tagId);
List<AttributeDTO> attrDTOList = new ArrayList<AttributeDTO>();
if (!CollectionUtils.isEmpty(attrList)) {
for (Attribute attr : attrList) {
attrDTOList.add(this.dozerMapper.map(attr, AttributeDTO.class, "attr2attrDTO"));
}
}
return attrDTOList;
}
}
| [
"[email protected]"
] | |
8417b53dc268505a2c8af63b854b6eb1db171597 | 77e5b45ba8669f0114153116df9af16611fdb075 | /src/de/esw/swt/forms/factories/DefaultComponentFactory.java | 3884039b4df23dbd5d8aad42915461047706d7d8 | [] | no_license | KnisterPeter/swtforms | 7299061872c3397332f53f3e760677e25aa21e63 | fbdda562cbc62701dec3ab1733aa45856dfd2b69 | refs/heads/master | 2021-01-20T12:22:21.027892 | 2012-09-24T05:54:09 | 2012-09-24T05:54:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,564 | java | /*
* Copyright (c) 2002-2007 JGoodies Karsten Lentzsch. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* o Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* o Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* o Neither the name of JGoodies Karsten Lentzsch nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package de.esw.swt.forms.factories;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
/**
* A singleton implementaton of the {@link ComponentFactory} interface that
* creates UI components as required by the
* {@link de.esw.swt.forms.builder.CompositeBuilder}.
* <p>
*
* The texts used in methods <code>#createLabel(String)</code> and
* <code>#createTitle(String)</code> can contain an optional mnemonic marker.
* The mnemonic and mnemonic index are indicated by a single ampersand (<tt>&</tt>).
* For example <tt>"&Save"</tt>, or
* <tt>"Save &as"</tt>. To use the ampersand itself
* duplicate it, for example <tt>"Look&&Feel"</tt>.
*
* @author Karsten Lentzsch
* @version $Revision: 1.7 $
*/
public class DefaultComponentFactory implements ComponentFactory {
/**
* Holds the single instance of this class.
*/
private static final DefaultComponentFactory INSTANCE = new DefaultComponentFactory();
/**
* The character used to indicate the mnemonic position for labels.
*/
private static final char MNEMONIC_MARKER = '&';
// Instance *************************************************************
/**
* Returns the sole instance of this factory class.
*
* @return the sole instance of this factory class
*/
public static DefaultComponentFactory getInstance() {
return INSTANCE;
}
// Component Creation ***************************************************
/**
* Creates and returns a label with an optional mnemonic.
* <p>
*
* <pre>
* createLabel("Name"); // No mnemonic
* createLabel("N&ame"); // Mnemonic is 'a'
* createLabel("Save &as"); // Mnemonic is the second 'a'
* createLabel("Look&&Feel"); // No mnemonic, text is Look&Feel
* </pre>
*
* @param parent
* @param textWithMnemonic
* the label's text - may contain an ampersand (<tt>&</tt>)
* to mark a mnemonic
* @return an label with optional mnemonic
*/
public Label createLabel(Composite parent, String textWithMnemonic) {
Label label = new Label(parent, SWT.HORIZONTAL);
setTextAndMnemonic(label, textWithMnemonic);
return label;
}
/**
* Creates and returns a title label that uses the foreground color and font
* of a <code>TitledBorder</code>.
* <p>
*
* <pre>
* createTitle("Name"); // No mnemonic
* createTitle("N&ame"); // Mnemonic is 'a'
* createTitle("Save &as"); // Mnemonic is the second 'a'
* createTitle("Look&&Feel"); // No mnemonic, text is Look&Feel
* </pre>
*
* @param parent
* @param textWithMnemonic
* the label's text - may contain an ampersand (<tt>&</tt>)
* to mark a mnemonic
* @return an emphasized title label
*/
public Label createTitle(Composite parent, String textWithMnemonic) {
Label label = new Label(parent, SWT.HORIZONTAL | SWT.CENTER);
setTextAndMnemonic(label, textWithMnemonic);
return label;
}
/**
* Creates and returns a labeled separator with the label in the left-hand
* side. Useful to separate paragraphs in a panel; often a better choice
* than a <code>TitledBorder</code>.
* <p>
*
* <pre>
* createSeparator("Name"); // No mnemonic
* createSeparator("N&ame"); // Mnemonic is 'a'
* createSeparator("Save &as"); // Mnemonic is the second 'a'
* createSeparator("Look&&Feel"); // No mnemonic, text is Look&Feel
* </pre>
*
* @param parent
* @param textWithMnemonic
* the label's text - may contain an ampersand (<tt>&</tt>)
* to mark a mnemonic
* @return a title label with separator on the side
*/
public Control createSeparator(Composite parent, String textWithMnemonic) {
return createSeparator(parent, textWithMnemonic, SWT.LEFT);
}
/**
* Creates and returns a labeled separator. Useful to separate paragraphs in
* a panel, which is often a better choice than a <code>TitledBorder</code>.
* <p>
*
* <pre>
* final int LEFT = SwingConstants.LEFT;
* createSeparator("Name", LEFT); // No mnemonic
* createSeparator("N&ame", LEFT); // Mnemonic is 'a'
* createSeparator("Save &as", LEFT); // Mnemonic is the second 'a'
* createSeparator("Look&&Feel", LEFT); // No mnemonic, text is Look&Feel
* </pre>
*
* @param parent
* @param textWithMnemonic
* the label's text - may contain an ampersand (<tt>&</tt>)
* to mark a mnemonic
* @param alignment
* text alignment, one of <code>SwingConstants.LEFT</code>,
* <code>SwingConstants.CENTER</code>,
* <code>SwingConstants.RIGHT</code>
* @return a separator with title label
*/
public Control createSeparator(Composite parent, String textWithMnemonic,
int alignment) {
if (textWithMnemonic == null || textWithMnemonic.length() == 0) {
return new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
}
GridLayout layout = new GridLayout();
layout.numColumns = 2;
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayout(layout);
Label title = createTitle(composite, textWithMnemonic);
title.setAlignment(alignment);
createSeparator(composite, title);
return composite;
}
/**
* Creates and returns a labeled separator. Useful to separate paragraphs in
* a panel, which is often a better choice than a <code>TitledBorder</code>.
* <p>
*
* The label's position is determined by the label's horizontal alignment,
* which must be one of: <code>SwingConstants.LEFT</code>,
* <code>SwingConstants.CENTER</code>, <code>SwingConstants.RIGHT</code>.
* <p>
*
* TODO: Since this method has been marked public in version 1.0.6, we need
* to precisely describe the semantic of this method.
* <p>
*
* TODO: Check if we can relax the constraint for the label alignment and
* also accept LEADING and TRAILING.
*
* @param parent
* @param label
* the title label component
* @return a separator with title label
*
* @throws NullPointerException
* if the label is <code>null</code>
* @throws IllegalArgumentException
* if the label's horizontal alignment is not one of:
* <code>SwingConstants.LEFT</code>,
* <code>SwingConstants.CENTER</code>,
* <code>SwingConstants.RIGHT</code>.
*
* @since 1.0.6
*/
public Control createSeparator(Composite parent, Label label) {
if (label == null)
throw new NullPointerException("The label must not be null.");
int horizontalAlignment = label.getAlignment();
if ((horizontalAlignment != SWT.LEFT)
&& (horizontalAlignment != SWT.CENTER)
&& (horizontalAlignment != SWT.RIGHT))
throw new IllegalArgumentException(
"The label's horizontal alignment"
+ " must be one of: LEFT, CENTER, RIGHT.");
Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
if (parent.getLayout() instanceof GridLayout) {
separator.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.GRAB_HORIZONTAL));
}
return separator;
}
// Helper Code ***********************************************************
/**
* Sets the text of the given label and optionally a mnemonic. The given
* text may contain an ampersand (<tt>&</tt>) to mark a mnemonic and
* its position. Such a marker indicates that the character that follows the
* ampersand shall be the mnemonic. If you want to use the ampersand itself
* duplicate it, for example <tt>"Look&&Feel"</tt>.
*
* @param label
* the label that gets a mnemonic
* @param textWithMnemonic
* the text with optional mnemonic marker
*/
private static void setTextAndMnemonic(Label label, String textWithMnemonic) {
int markerIndex = textWithMnemonic.indexOf(MNEMONIC_MARKER);
// No marker at all
if (markerIndex == -1) {
label.setText(textWithMnemonic);
return;
}
int mnemonicIndex = -1;
int begin = 0;
int end;
int length = textWithMnemonic.length();
int quotedMarkers = 0;
StringBuffer buffer = new StringBuffer();
do {
// Check whether the next index has a mnemonic marker, too
if ((markerIndex + 1 < length)
&& (textWithMnemonic.charAt(markerIndex + 1) == MNEMONIC_MARKER)) {
end = markerIndex + 1;
quotedMarkers++;
} else {
end = markerIndex;
if (mnemonicIndex == -1) {
mnemonicIndex = markerIndex - quotedMarkers;
}
}
buffer.append(textWithMnemonic.substring(begin, end));
begin = end + 1;
markerIndex = begin < length ? textWithMnemonic.indexOf(
MNEMONIC_MARKER, begin) : -1;
} while (markerIndex != -1);
buffer.append(textWithMnemonic.substring(begin));
String text = buffer.toString();
label.setText(text);
// if ((mnemonicIndex != -1) && (mnemonicIndex < text.length())) {
// label.setDisplayedMnemonic(text.charAt(mnemonicIndex));
// label.setDisplayedMnemonicIndex(mnemonicIndex);
// }
}
/**
* A label that uses the TitleBorder font and color.
*/
// private static final class TitleLabel extends Label {
//
// private TitleLabel() {
// // Just invoke the super constructor.
// }
//
// /**
// * TODO: For the Synth-based L&f we should consider asking a
// * <code>TitledBorder</code> instance for its font and color using
// * <code>#getTitleFont</code> and <code>#getTitleColor</code> resp.
// */
// public void updateUI() {
// super.updateUI();
// Color foreground = getTitleColor();
// if (foreground != null) {
// setForeground(foreground);
// }
// setFont(getTitleFont());
// }
//
// private Color getTitleColor() {
// return UIManager.getColor("TitledBorder.titleColor");
// }
//
// /**
// * Looks up and returns the font used for title labels. Since Mac Aqua
// * uses an inappropriate titled border font, we use a bold label font
// * instead. Actually if the title is used in a titled separator, the
// * bold weight is questionable. It seems that most native Aqua tools use
// * a plain label in titled separators.
// *
// * @return the font used for title labels
// */
// private Font getTitleFont() {
// return Utilities.isLafAqua() ? UIManager.getFont("Label.font")
// .deriveFont(Font.BOLD) : UIManager
// .getFont("TitledBorder.font");
// }
//
// }
/**
* A layout for the title label and separator(s) in titled separators.
*/
// private static final class TitledSeparatorLayout implements LayoutManager
// {
//
// private final boolean centerSeparators;
//
// /**
// * Constructs a TitledSeparatorLayout that either centers the separators
// * or aligns them along the font baseline of the title label.
// *
// * @param centerSeparators
// * true to center, false to align along the font baseline of
// * the title label
// */
// private TitledSeparatorLayout(boolean centerSeparators) {
// this.centerSeparators = centerSeparators;
// }
//
// /**
// * Does nothing. This layout manager looks up the components from the
// * layout container and used the component's index in the child array to
// * identify the label and separators.
// *
// * @param name
// * the string to be associated with the component
// * @param comp
// * the component to be added
// */
// public void addLayoutComponent(String name, Component comp) {
// // Does nothing.
// }
//
// /**
// * Does nothing. This layout manager looks up the components from the
// * layout container and used the component's index in the child array to
// * identify the label and separators.
// *
// * @param comp
// * the component to be removed
// */
// public void removeLayoutComponent(Component comp) {
// // Does nothing.
// }
//
// /**
// * Computes and returns the minimum size dimensions for the specified
// * container. Forwards this request to <code>#preferredLayoutSize</code>.
// *
// * @param parent
// * the component to be laid out
// * @return the container's minimum size.
// * @see #preferredLayoutSize(Container)
// */
// public Dimension minimumLayoutSize(Container parent) {
// return preferredLayoutSize(parent);
// }
//
// /**
// * Computes and returns the preferred size dimensions for the specified
// * container. Returns the title label's preferred size.
// *
// * @param parent
// * the component to be laid out
// * @return the container's preferred size.
// * @see #minimumLayoutSize(Container)
// */
// public Dimension preferredLayoutSize(Container parent) {
// Component label = getLabel(parent);
// Dimension labelSize = label.getPreferredSize();
// Insets insets = parent.getInsets();
// int width = labelSize.width + insets.left + insets.right;
// int height = labelSize.height + insets.top + insets.bottom;
// return new Dimension(width, height);
// }
//
// /**
// * Lays out the specified container.
// *
// * @param parent
// * the container to be laid out
// */
// public void layoutContainer(Container parent) {
// synchronized (parent.getTreeLock()) {
// // Look up the parent size and insets
// Dimension size = parent.getSize();
// Insets insets = parent.getInsets();
// int width = size.width - insets.left - insets.right;
//
// // Look up components and their sizes
// Label label = getLabel(parent);
// Dimension labelSize = label.getPreferredSize();
// int labelWidth = labelSize.width;
// int labelHeight = labelSize.height;
// Component separator1 = parent.getComponent(1);
// int separatorHeight = separator1.getPreferredSize().height;
//
// FontMetrics metrics = label.getFontMetrics(label.getFont());
// int ascent = metrics.getMaxAscent();
// int hGapDlu = centerSeparators ? 3 : 1;
// int hGap = Sizes.dialogUnitXAsPixel(hGapDlu, label);
// int vOffset = centerSeparators ? 1 + (labelHeight - separatorHeight) / 2
// : ascent - separatorHeight / 2;
//
// int alignment = label.getHorizontalAlignment();
// int y = insets.top;
// if (alignment == JLabel.LEFT) {
// int x = insets.left;
// label.setBounds(x, y, labelWidth, labelHeight);
// x += labelWidth;
// x += hGap;
// int separatorWidth = size.width - insets.right - x;
// separator1.setBounds(x, y + vOffset, separatorWidth,
// separatorHeight);
// } else if (alignment == JLabel.RIGHT) {
// int x = insets.left + width - labelWidth;
// label.setBounds(x, y, labelWidth, labelHeight);
// x -= hGap;
// x--;
// int separatorWidth = x - insets.left;
// separator1.setBounds(insets.left, y + vOffset,
// separatorWidth, separatorHeight);
// } else {
// int xOffset = (width - labelWidth - 2 * hGap) / 2;
// int x = insets.left;
// separator1.setBounds(x, y + vOffset, xOffset - 1,
// separatorHeight);
// x += xOffset;
// x += hGap;
// label.setBounds(x, y, labelWidth, labelHeight);
// x += labelWidth;
// x += hGap;
// Component separator2 = parent.getComponent(2);
// int separatorWidth = size.width - insets.right - x;
// separator2.setBounds(x, y + vOffset, separatorWidth,
// separatorHeight);
// }
// }
// }
//
// private Label getLabel(Container parent) {
// return (Label) parent.getComponent(0);
// }
//
// }
}
| [
"[email protected]"
] | |
81fda09c05defbf91f2bc09b3d2e70713487b685 | f3c6daf02329c6877b67b49d1c7a3f651a71c395 | /numtoint.java | 2264a75150827540afc58d219084a3a9b9cd052f | [] | no_license | mpavithra246/java222 | 3909653b9ab847ffef907faa971c71bf69cedf9c | 12123f0cedf1d4cc11cdb81d2e04cbdaf229affa | refs/heads/master | 2020-12-25T07:23:03.347031 | 2016-08-08T06:38:54 | 2016-08-08T06:38:54 | 65,171,423 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 671 | java | public class MyStringToNumber {
public static int convert_String_To_Number(String numStr){
char ch[] = numStr.toCharArray();
int sum1 = 0;
int zeroAscii = (int)'0';
for(char c:ch){
int tmpAscii = (int)c;
sum1 = (sum1*10)+(tmpAscii-zeroAscii);
}
return sum1;
}
public static void main(String a[]){
System.out.println("\"3256\" == "+convert_String_To_Number("3256"));
System.out.println("\"76289\" == "+convert_String_To_Number("76289"));
System.out.println("\"90087\" == "+convert_String_To_Number("90087"));
}
} | [
"[email protected]"
] | |
e1617208f1d000b3ed3df85befa456c08f53648e | bd7a6879db75f59fa11a08e3e4282d4517ed5f74 | /src/dms/ykl/model/Student.java | a5b159511e4d8bb72f09ba43597e4d4f4b29100b | [] | no_license | ykl1997/dormitoryMS | 8d20debd24ba7c02495bb1e1b87ae69c56b03a96 | f804b11eed2c2f2559eb53bf0e9ac73725c31d69 | refs/heads/master | 2022-11-13T11:01:21.204055 | 2020-07-09T08:43:47 | 2020-07-09T08:43:47 | 255,844,153 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,200 | java | package dms.ykl.model;
public class Student {
private int id;
private String sno;
private String name;
private String sex;
private String class1;
private String phone;
private String build;
private String room;
private String state;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSno() {
return sno;
}
public void setSno(String sno) {
this.sno = sno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getClass1() {
return class1;
}
public void setClass1(String class1) {
this.class1 = class1;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getBuild() {
return build;
}
public void setBuild(String build) {
this.build = build;
}
public String getRoom() {
return room;
}
public void setRoom(String room) {
this.room = room;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}
| [
"[email protected]"
] | |
20def7ad36a34bbc2645977e525d64d3ae53274d | 3f8d2b579a018f988fa77fe4b975326332c83b31 | /src/test/java/com/threeone/mealplanner/service/test/UserServiceTest.java | a30a172cee78589caceda91d7ff6f87d40bc69de | [] | no_license | hu-xiaokang/mealplanner | 38cabfd10e1fa4bd383c49a5a50eb2f18181b755 | dc998e0e7c2c4b150b8cf8db5f35722417e4ad3f | refs/heads/master | 2021-12-03T09:48:23.131469 | 2014-05-17T20:18:25 | 2014-05-17T20:18:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package com.threeone.mealplanner.service.test;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.threeone.mealplanner.model.entity.UserInfo;
import com.threeone.mealplanner.service.UserService;
import com.threeone.mealplanner.test.common.AbstractSpringCommonTest;
public class UserServiceTest extends AbstractSpringCommonTest{
@Autowired
private UserService userService;
@Test
public void test(){
UserInfo userInfo = userService.getUserInfoByLogin("fxm");
System.out.println(userInfo.getEmail());
}
public void setUserService(UserService userService) {
this.userService = userService;
}
} | [
"[email protected]"
] | |
449b7d05ed5b289a2eb9bf9ca2fcd92f6f66e8a4 | ad775f8d5de1866378e433eef74ef5dc83265b6e | /appinventor/appengine/src/com/google/appinventor/server/GalleryServiceImpl.java | 5909b652cf72726e2dc600d79fbdcc6decd88e3c | [
"Apache-2.0"
] | permissive | fmntf/appinventor-sources | c9ac3bd766a9df650decb82efb2ca22d48ae4ad0 | f20f55c7b318581f7001d56aa0b5063cb0334538 | refs/heads/master | 2020-04-05T23:04:10.271018 | 2016-11-08T16:12:49 | 2016-11-08T16:12:49 | 31,964,823 | 5 | 6 | null | 2015-03-10T15:21:08 | 2015-03-10T15:21:07 | null | UTF-8 | Java | false | false | 24,278 | java | // -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2012 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
package com.google.appinventor.server;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.google.appengine.api.blobstore.BlobKey;
import com.google.appengine.api.blobstore.BlobstoreServiceFactory;
import com.google.appengine.api.images.Image;
import com.google.appengine.api.images.ImagesService;
import com.google.appengine.api.images.ImagesServiceFactory;
import com.google.appengine.api.images.Transform;
import com.google.appengine.api.utils.SystemProperty;
import com.google.appengine.tools.cloudstorage.GcsFileOptions;
import com.google.appengine.tools.cloudstorage.GcsFilename;
import com.google.appengine.tools.cloudstorage.GcsInputChannel;
import com.google.appengine.tools.cloudstorage.GcsOutputChannel;
import com.google.appengine.tools.cloudstorage.GcsService;
import com.google.appengine.tools.cloudstorage.GcsServiceFactory;
import com.google.appinventor.common.utils.StringUtils;
import com.google.appinventor.server.flags.Flag;
import com.google.appinventor.server.storage.GalleryStorageIo;
import com.google.appinventor.server.storage.GalleryStorageIoInstanceHolder;
import com.google.appinventor.shared.rpc.project.Email;
import com.google.appinventor.shared.rpc.project.GalleryApp;
import com.google.appinventor.shared.rpc.project.GalleryAppListResult;
import com.google.appinventor.shared.rpc.project.GalleryAppReport;
import com.google.appinventor.shared.rpc.project.GalleryComment;
import com.google.appinventor.shared.rpc.project.GalleryModerationAction;
import com.google.appinventor.shared.rpc.project.GalleryReportListResult;
import com.google.appinventor.shared.rpc.project.GalleryService;
import com.google.appinventor.shared.rpc.project.GallerySettings;
import com.google.appinventor.shared.rpc.project.ProjectSourceZip;
import com.google.appinventor.shared.rpc.project.RawFile;
/**
* The implementation of the RPC service which runs on the server.
*
* <p>Note that this service must be state-less so that it can be run on
* multiple servers.
*
*/
public class GalleryServiceImpl extends OdeRemoteServiceServlet implements GalleryService {
private static final Logger LOG = Logger.getLogger(GalleryServiceImpl.class.getName());
private static final long serialVersionUID = -8316312003804169166L;
private final transient GalleryStorageIo galleryStorageIo =
GalleryStorageIoInstanceHolder.INSTANCE;
// fileExporter used to get the source code from project being published
private final FileExporter fileExporter = new FileExporterImpl();
@Override
public GallerySettings loadGallerySettings() {
String bucket = Flag.createFlag("gallery.bucket", "").get();
boolean galleryEnabled = Flag.createFlag("use.gallery",false).get();
String envirnment = SystemProperty.environment.value().toString();
String adminEmail = Flag.createFlag("gallery.admin.email", "").get();
GallerySettings settings = new GallerySettings(galleryEnabled, bucket, envirnment, adminEmail);
return settings;
}
/**
* Publishes a gallery app
* @param projectId id of the project being published
* @param projectName name of project
* @param title title of new gallery app
* @param description description of new gallery app
* @return a {@link GalleryApp} for new galleryApp
*/
@Override
public GalleryApp publishApp(long projectId, String title, String projectName, String description, String moreInfo, String credit) throws IOException {
final String userId = userInfoProvider.getUserId();
GalleryApp app = galleryStorageIo.createGalleryApp(title, projectName, description, moreInfo, credit, projectId, userId);
try {
storeAIA(app.getGalleryAppId(),projectId, projectName);
} catch (IOException e) {
deleteApp(app.getGalleryAppId());
throw e;
}
// see if there is a new image for the app. If so, its in cloud using projectId, need to move
// to cloud using gallery id
setGalleryAppImage(app);
// put meta data in search index
GallerySearchIndex.getInstance().indexApp(app);
return app;
}
/**
* update a gallery app
* @param app info about app being updated
* @param newImage true if the user has submitted a new image
*/
@Override
public void updateApp(GalleryApp app, boolean newImage) throws IOException {
updateAppSource(app.getGalleryAppId(),app.getProjectId(),app.getProjectName());
updateAppMetadata(app);
if (newImage)
setGalleryAppImage(app);
}
/**
* update a gallery app's meta data
* @param app info about app being updated
*
*/
@Override
public void updateAppMetadata(GalleryApp app) {
final String userId = userInfoProvider.getUserId();
galleryStorageIo.updateGalleryApp(app.getGalleryAppId(), app.getTitle(), app.getDescription(), app.getMoreInfo(), app.getCredit(), userId);
// put meta data in search index
GallerySearchIndex.getInstance().indexApp(app);
}
/**
* update a gallery app's source (aia)
* @param galleryId id of gallery app to be updated
* @param projectId id of project so we can grab source
* @param projectName name of project, this is name in new aia
*/
@Override
public void updateAppSource (long galleryId, long projectId, String projectName) throws IOException {
storeAIA(galleryId,projectId, projectName);
}
/**
* index all gallery apps (admin method)
* @param count the max number of apps to index
*/
@Override
public void indexAll(int count) {
List<GalleryApp> apps= getRecentApps(1,count).getApps();
for (GalleryApp app:apps) {
GallerySearchIndex.getInstance().indexApp(app);
}
}
/**
* Returns total number of galleryApps
* @return number of galleryApps
*/
@Override
public Integer getNumApps() {
return galleryStorageIo.getNumGalleryApps();
}
/**
* Returns a wrapped class which contains list of most recently
* updated galleryApps and total number of results in database
* @param start starting index
* @param count number of apps to return
* @return list of GalleryApps
*/
@Override
public GalleryAppListResult getRecentApps(int start,int count) {
return galleryStorageIo.getRecentGalleryApps(start,count);
}
/**
* Returns a wrapped class which contains list of featured gallery app
* @param start start index
* @param count count number
* @return list of gallery app
*/
public GalleryAppListResult getFeaturedApp(int start, int count){
return galleryStorageIo.getFeaturedApp(start, count);
}
/**
* Returns a wrapped class which contains list of tutorial gallery app
* @param start start index
* @param count count number
* @return list of gallery app
*/
public GalleryAppListResult getTutorialApp(int start, int count){
return galleryStorageIo.getTutorialApp(start, count);
}
/**
* check if app is featured already
* @param galleryId gallery id
* @return true if featured, otherwise false
*/
public boolean isFeatured(long galleryId){
return galleryStorageIo.isFeatured(galleryId);
}
/**
* check if app is tutorial already
* @param galleryId gallery id
* @return true if tutorial, otherwise false
*/
public boolean isTutorial(long galleryId){
return galleryStorageIo.isTutorial(galleryId);
}
/**
* mark an app as featured
* @param galleryId gallery id
* @return true if successful
*/
public boolean markAppAsFeatured(long galleryId){
return galleryStorageIo.markAppAsFeatured(galleryId);
}
/**
* mark an app as tutorial
* @param galleryId gallery id
* @return true if successful
*/
public boolean markAppAsTutorial(long galleryId){
return galleryStorageIo.markAppAsTutorial(galleryId);
}
/**
* Returns a wrapped class which contains a list of galleryApps
* by a particular developer and total number of results in database
* @param userId id of the developer
* @param start starting index
* @param count number of apps to return
* @return list of GalleryApps
*/
@Override
public GalleryAppListResult getDeveloperApps(String userId, int start,int count) {
return galleryStorageIo.getDeveloperApps(userId, start,count);
}
/**
* Returns a GalleryApp object for the given id
* @param galleryId gallery ID as received by
* {@link #getRecentGalleryApps()}
*
* @return gallery app object
*/
@Override
public GalleryApp getApp(long galleryId) {
return galleryStorageIo.getGalleryApp(galleryId);
}
/**
* Returns a wrapped class which contains a list of galleryApps and
* total number of results in database
* @param keywords keywords to search for
* @param start starting index
* @param count number of apps to return
* @return list of GalleryApps
*/
@Override
public GalleryAppListResult findApps(String keywords, int start, int count) {
return GallerySearchIndex.getInstance().find(keywords, start, count);
}
/**
* Returns a wrapped class which contains a list of most downloaded
* gallery apps and total number of results in database
* @param start starting index
* @param count number of apps to return
* @return list of GalleryApps
*/
@Override
public GalleryAppListResult getMostDownloadedApps(int start, int count) {
return galleryStorageIo.getMostDownloadedApps(start,count);
}
/**
* Returns a wrapped class which contains a list of most liked
* gallery apps and total number of results in database
* @param start starting index
* @param count number of apps to return
* @return list of GalleryApps
*/
@Override
public GalleryAppListResult getMostLikedApps(int start, int count) {
return galleryStorageIo.getMostLikedApps(start,count);
}
/**
* Deletes a new gallery app
* @param galleryId id of app to delete
*/
@Override
public void deleteApp(long galleryId) {
// get rid of comments and app from database
galleryStorageIo.deleteApp(galleryId);
// remove the search index entry
GallerySearchIndex.getInstance().unIndexApp(galleryId);
// remove its image/aia from cloud
deleteAIA(galleryId);
deleteImage(galleryId);
}
/**
* record fact that app was downloaded
* @param galleryId id of app that was downloaded
*/
@Override
public void appWasDownloaded(long galleryId) {
GallerySettings settings = loadGallerySettings();
galleryStorageIo.incrementDownloads(galleryId);
}
/**
* Returns the comments for an app
* @param galleryId gallery ID as received by
* {@link #getRecentGalleryApps()}
* @return a list of comments
*/
@Override
public List<GalleryComment> getComments(long galleryId) {
return galleryStorageIo.getComments(galleryId);
}
/**
* publish a comment for a gallery app
* @param galleryId the id of the app
* @param comment the comment
*/
@Override
public long publishComment(long galleryId, String comment) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.addComment(galleryId, userId, comment);
}
/**
* increase likes for a gallery app
* @param galleryId the id of the app
* @return num of like
*/
@Override
public int increaseLikes(long galleryId) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.increaseLikes(galleryId, userId);
}
/**
* decrease likes for a gallery app
* @param galleryId the id of the app
* @return num of like
*/
@Override
public int decreaseLikes(long galleryId) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.decreaseLikes(galleryId, userId);
}
/**
* get num of likes for a gallery app
* @param galleryId the id of the app
*/
@Override
public int getNumLikes(long galleryId) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.getNumLikes(galleryId);
}
/**
* check if an app is liked by a user
* @param galleryId the id of the app
*/
@Override
public boolean isLikedByUser(long galleryId) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.isLikedByUser(galleryId, userId);
}
/**
* salvage the gallery app by given galleryId
*/
@Override
public void salvageGalleryApp(long galleryId) {
galleryStorageIo.salvageGalleryApp(galleryId);
}
/**
* adds a report (flag) to a gallery app
* @param galleryId id of gallery app that was commented on
* @param report report
* @return the id of the new report
*/
@Override
public long addAppReport(GalleryApp app, String reportText) {
final String reporterId = userInfoProvider.getUserId();
String offenderId = app.getDeveloperId();
return galleryStorageIo.addAppReport(reportText, app.getGalleryAppId(), offenderId,reporterId);
}
/**
* gets recent reports
* @param start start index
* @param count number to retrieve
* @return the list of reports
*/
@Override
public GalleryReportListResult getRecentReports(int start, int count) {
return galleryStorageIo.getAppReports(start,count);
}
/**
* gets existing reports
* @param start start index
* @param count number to retrieve
* @return the list of reports
*/
@Override
public GalleryReportListResult getAllAppReports(int start, int count){
return galleryStorageIo.getAllAppReports(start,count);
}
/**
* check if an app is reprted by a user
* @param galleryId the id of the app
*/
@Override
public boolean isReportedByUser(long galleryId) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.isReportedByUser(galleryId, userId);
}
/**
* save attribution for a gallery app
* @param galleryId the id of the app
* @param attributionId the id of the attribution app
* @return num of like
*/
@Override
public long saveAttribution(long galleryId, long attributionId) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.saveAttribution(galleryId, attributionId);
}
/**
* get the attribution id for a gallery app
* @param galleryId the id of the app
* @return attribution id
*/
@Override
public long remixedFrom(long galleryId) {
final String userId = userInfoProvider.getUserId();
return galleryStorageIo.remixedFrom(galleryId);
}
/**
* get the children ids of an app
* @param galleryId the id of the app
* @return list of children gallery app
*/
@Override
public List<GalleryApp> remixedTo(long galleryId) {
return galleryStorageIo.remixedTo(galleryId);
}
/**
* mark an report as resolved
* @param reportId the id of the app
*/
@Override
public boolean markReportAsResolved(long reportId, long galleryId) {
return galleryStorageIo.markReportAsResolved(reportId, galleryId);
}
/**
* deactivate app
* @param galleryId the id of the gallery app
*/
@Override
public boolean deactivateGalleryApp(long galleryId) {
return galleryStorageIo.deactivateGalleryApp(galleryId);
}
/**
* check if gallery app is Activated
* @param galleryId the id of the gallery app
*/
@Override
public boolean isGalleryAppActivated(long galleryId){
return galleryStorageIo.isGalleryAppActivated(galleryId);
}
/**
* store aia file on cloud server
* @param galleryId gallery id
* @param projectId project id
* @param projectName project name
*/
private void storeAIA(long galleryId, long projectId, String projectName) throws IOException {
final String userId = userInfoProvider.getUserId();
// build the aia file name using the ai project name and code stolen
// from DownloadServlet to normalize...
String aiaName = StringUtils.normalizeForFilename(projectName) + ".aia";
// grab the data for the aia file using code from DownloadServlet
RawFile aiaFile = null;
byte[] aiaBytes= null;
ProjectSourceZip zipFile = fileExporter.exportProjectSourceZip(userId,
projectId, true, false, aiaName, false, false, false, true);
aiaFile = zipFile.getRawFile();
aiaBytes = aiaFile.getContent();
LOG.log(Level.INFO, "aiaFile numBytes:"+aiaBytes.length);
// now stick the aia file into the gcs
//String galleryKey = GalleryApp.getSourceKey(galleryId);//String.valueOf(galleryId);
GallerySettings settings = loadGallerySettings();
String galleryKey = settings.getSourceKey(galleryId);
// setup cloud
GcsService gcsService = GcsServiceFactory.createGcsService();
//GcsFilename filename = new GcsFilename(GalleryApp.GALLERYBUCKET, galleryKey);
GcsFilename filename = new GcsFilename(settings.getBucket(), galleryKey);
GcsFileOptions options = new GcsFileOptions.Builder().mimeType("application/zip")
.acl("public-read").cacheControl("no-cache").addUserMetadata("title", aiaName).build();
GcsOutputChannel writeChannel = gcsService.createOrReplace(filename, options);
writeChannel.write(ByteBuffer.wrap(aiaBytes));
// Now finalize
writeChannel.close();
}
/**
* delete aia file based on given gallery id
* @param galleryId gallery id
*/
private void deleteAIA(long galleryId) {
try {
//String galleryKey = GalleryApp.getSourceKey(galleryId);
GallerySettings settings = loadGallerySettings();
String galleryKey = settings.getSourceKey(galleryId);
// setup cloud
GcsService gcsService = GcsServiceFactory.createGcsService();
//GcsFilename filename = new GcsFilename(GalleryApp.GALLERYBUCKET, galleryKey);
GcsFilename filename = new GcsFilename(settings.getBucket(), galleryKey);
gcsService.delete(filename);
} catch (IOException e) {
// TODO Auto-generated catch block
LOG.log(Level.INFO, "FAILED GCS delete");
e.printStackTrace();
}
}
private void deleteImage(long galleryId) {
try {
//String galleryKey = GalleryApp.getImageKey(galleryId);
GallerySettings settings = loadGallerySettings();
String galleryKey = settings.getSourceKey(galleryId);
// setup cloud
GcsService gcsService = GcsServiceFactory.createGcsService();
//GcsFilename filename = new GcsFilename(GalleryApp.GALLERYBUCKET, galleryKey);
GcsFilename filename = new GcsFilename(settings.getBucket(), galleryKey);
gcsService.delete(filename);
} catch (IOException e) {
// TODO Auto-generated catch block
LOG.log(Level.INFO, "FAILED GCS delete");
e.printStackTrace();
}
}
/**
* when an app is published/updated, we need to move the image
* that was temporarily uploaded into projects/projectid/image
* into the gallery image
* @param app gallery app
*/
private void setGalleryAppImage(GalleryApp app) {
// best thing would be if GCS has a mv op, we can just do that.
// don't think that is there, though, so for now read one and write to other
// First, read the file from projects name
boolean lockForRead = false;
//String projectImageKey = app.getProjectImageKey();
GallerySettings settings = loadGallerySettings();
String projectImageKey = settings.getProjectImageKey(app.getProjectId());
try {
GcsService gcsService = GcsServiceFactory.createGcsService();
//GcsFilename filename = new GcsFilename(GalleryApp.GALLERYBUCKET, projectImageKey);
GcsFilename filename = new GcsFilename(settings.getBucket(), projectImageKey);
GcsInputChannel readChannel = gcsService.openReadChannel(filename, 0);
InputStream gcsis = Channels.newInputStream(readChannel);
byte[] buffer = new byte[8000];
int bytesRead = 0;
ByteArrayOutputStream bao = new ByteArrayOutputStream();
while ((bytesRead = gcsis.read(buffer)) != -1) {
bao.write(buffer, 0, bytesRead);
}
// close the project image file
readChannel.close();
// if image is greater than 200 X 200, it will be scaled (200 X 200).
// otherwise, it will be stored as origin.
byte[] oldImageData = bao.toByteArray();
byte[] newImageData;
ImagesService imagesService = ImagesServiceFactory.getImagesService();
Image oldImage = ImagesServiceFactory.makeImage(oldImageData);
//if image size is too big, scale it to a smaller size.
if(oldImage.getWidth() > 200 && oldImage.getHeight() > 200){
Transform resize = ImagesServiceFactory.makeResize(200, 200);
Image newImage = imagesService.applyTransform(resize, oldImage);
newImageData = newImage.getImageData();
}else{
newImageData = oldImageData;
}
// set up the cloud file (options)
// After publish, copy the /projects/projectId image into /apps/appId
//String galleryKey = app.getImageKey();
String galleryKey = settings.getImageKey(app.getGalleryAppId());
//GcsFilename outfilename = new GcsFilename(GalleryApp.GALLERYBUCKET, galleryKey);
GcsFilename outfilename = new GcsFilename(settings.getBucket(), galleryKey);
GcsFileOptions options = new GcsFileOptions.Builder().mimeType("image/jpeg")
.acl("public-read").cacheControl("no-cache").build();
GcsOutputChannel writeChannel = gcsService.createOrReplace(outfilename, options);
writeChannel.write(ByteBuffer.wrap(newImageData));
// Now finalize
writeChannel.close();
} catch (IOException e) {
// TODO Auto-generated catch block
LOG.log(Level.INFO, "FAILED WRITING IMAGE TO GCS");
e.printStackTrace();
}
}
/**
* Send an email to user
* @param senderId id of user sending this email
* @param receiverId id of user receiving this email
* @param receiverEmail receiver of email
* @param title title of email
* @param body body of email
*/
@Override
public long sendEmail(String senderId, String receiverId, String receiverEmail, String title, String body) {
GallerySettings settings = loadGallerySettings();
return galleryStorageIo.sendEmail(senderId, receiverId, settings.getAdminEmail(), receiverEmail, title, body);
}
/**
* Get email based on emailId
* @param emailId id of the email
* @return Email email
*/
@Override
public Email getEmail(long emailId) {
return galleryStorageIo.getEmail(emailId);
}
/**
* check if ready to send app stats to user
* @param userId
* @param galleryId
* @param adminEmail
* @param currentHost
*/
public boolean checkIfSendAppStats(String userId, long galleryId, String adminEmail, String currentHost){
return galleryStorageIo.checkIfSendAppStats(userId, galleryId, adminEmail, currentHost);
}
/**
* Store moderation actions based on actionType
* @param reportId
* @param galleryId
* @param emailId
* @param moderatorId
* @param actionType
*/
public void storeModerationAction(long reportId, long galleryId, long emailId, String moderatorId, int actionType, String moderatorName, String emailPreview){
galleryStorageIo.storeModerationAction(reportId, galleryId, emailId, moderatorId, actionType, moderatorName, emailPreview);
}
/**
* Get moderation actions based on given reportId
* @param reportId
*/
public List<GalleryModerationAction> getModerationActions(long reportId){
return galleryStorageIo.getModerationActions(reportId);
}
/**
* It will return a dev server serving url for given image url
* @param url image url
*/
@Override
public String getBlobServingUrl(String url) {
BlobKey bk = BlobstoreServiceFactory.getBlobstoreService().createGsBlobKey(url);
String u = null;
try {
u = ImagesServiceFactory.getImagesService().getServingUrl(bk);
} catch (Exception IllegalArgumentException) {
LOG.info("Could not read blob");
}
return u;
}
}
| [
"[email protected]"
] | |
e11dc389cd0b96a9298dc6962bc89a02a245b140 | eb5662713181446e4afc251d8a413adf0249535d | /src/Servlets/AdaugareCartele.java | 60696b716899686a14d404f2e50437cde400141e | [] | no_license | bobbyfurniga/ProiectPAOServlet | e1de1770f206d661460bd7be95891a77ca857f5c | 55bb04ecc780613e80b85b243d7a76a06b28a9e4 | refs/heads/master | 2021-06-17T01:27:24.211268 | 2017-05-27T16:14:44 | 2017-05-27T16:14:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,093 | java | package Servlets;
import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import java.io.IOException;
import java.sql.Connection;
import java.sql.SQLException;
import static Connectivity.Database.*;
/**
* Created by bobby on 10-05-2017.
*/
public class AdaugareCartele extends HttpServlet {
@Resource(name = "jdbc/metro")
private DataSource database;
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws SQLException, IOException {
Connection connection = null;
try {
connection = database.getConnection();
if (request.getParameter("abonamentLunar") != null)
insertAbonamenteLunare(connection, request.getParameter("nrAbonamentLunar"));
if (request.getParameter("abonamentZi") != null)
insertAbonamenteZi(connection, request.getParameter("nrAbonamenteZi"));
if (request.getParameter("cartela") != null)
insertCartela(connection, request.getParameter("nrCartela10"), request.getParameter("nrCartela2"));
String message = "Done!";
request.setAttribute("message", message);
request.getRequestDispatcher("/Adauga%20Cartele.jsp").forward(request, response);
connection.close();
} catch (Exception e) {
connection.close();
}
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
processRequest(req, resp);
} catch (SQLException e) {
e.printStackTrace();
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
try {
processRequest(req, resp);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
b01f86723e81d7d265a43ac12abb6904e8278a81 | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /third_party/android_29_sdk/public/extras/android/support/v4/src/java/android/support/v4/app/AppOpsManagerCompat.java | c0058a944c8b3a5892b13b09b89d77ab2f047e4a | [
"Apache-2.0",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"MIT",
"BSD-3-Clause"
] | permissive | Samsung/Castanets | 240d9338e097b75b3f669604315b06f7cf129d64 | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | refs/heads/castanets_76_dev | 2023-08-31T09:01:04.744346 | 2021-07-30T04:56:25 | 2021-08-11T05:45:21 | 125,484,161 | 58 | 49 | BSD-3-Clause | 2022-10-16T19:31:26 | 2018-03-16T08:07:37 | null | UTF-8 | Java | false | false | 5,706 | java | /*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.support.v4.app;
import android.content.Context;
import android.os.Build;
import android.support.annotation.NonNull;
/**
* Helper for accessing features in android.app.AppOpsManager
* introduced after API level 4 in a backwards compatible fashion.
*/
public final class AppOpsManagerCompat {
/**
* Result from {@link #noteOp}: the given caller is allowed to
* perform the given operation.
*/
public static final int MODE_ALLOWED = 0;
/**
* Result from {@link #noteOp}: the given caller is not allowed to perform
* the given operation, and this attempt should <em>silently fail</em> (it
* should not cause the app to crash).
*/
public static final int MODE_IGNORED = 1;
/**
* Result from {@link #noteOp}: the given caller should use its default
* security check. This mode is not normally used; it should only be used
* with appop permissions, and callers must explicitly check for it and
* deal with it.
*/
public static final int MODE_DEFAULT = 3;
private static class AppOpsManagerImpl {
public String permissionToOp(String permission) {
return null;
}
public int noteOp(Context context, String op, int uid, String packageName) {
return MODE_IGNORED;
}
public int noteProxyOp(Context context, String op, String proxiedPackageName) {
return MODE_IGNORED;
}
}
private static class AppOpsManager23 extends AppOpsManagerImpl {
@Override
public String permissionToOp(String permission) {
return AppOpsManagerCompat23.permissionToOp(permission);
}
@Override
public int noteOp(Context context, String op, int uid, String packageName) {
return AppOpsManagerCompat23.noteOp(context, op, uid, packageName);
}
@Override
public int noteProxyOp(Context context, String op, String proxiedPackageName) {
return AppOpsManagerCompat23.noteProxyOp(context, op, proxiedPackageName);
}
}
private static final AppOpsManagerImpl IMPL;
static {
if (Build.VERSION.SDK_INT >= 23) {
IMPL = new AppOpsManager23();
} else {
IMPL = new AppOpsManagerImpl();
}
}
private AppOpsManagerCompat() {}
/**
* Gets the app op name associated with a given permission.
*
* @param permission The permission.
* @return The app op associated with the permission or null.
*/
public static String permissionToOp(@NonNull String permission) {
return IMPL.permissionToOp(permission);
}
/**
* Make note of an application performing an operation. Note that you must pass
* in both the uid and name of the application to be checked; this function will verify
* that these two match, and if not, return {@link #MODE_IGNORED}. If this call
* succeeds, the last execution time of the operation for this app will be updated to
* the current time.
* @param context Your context.
* @param op The operation to note. One of the OPSTR_* constants.
* @param uid The user id of the application attempting to perform the operation.
* @param packageName The name of the application attempting to perform the operation.
* @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or
* {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without
* causing the app to crash).
* @throws SecurityException If the app has been configured to crash on this op.
*/
public static int noteOp(@NonNull Context context, @NonNull String op, int uid,
@NonNull String packageName) {
return IMPL.noteOp(context, op, uid, packageName);
}
/**
* Make note of an application performing an operation on behalf of another
* application when handling an IPC. Note that you must pass the package name
* of the application that is being proxied while its UID will be inferred from
* the IPC state; this function will verify that the calling uid and proxied
* package name match, and if not, return {@link #MODE_IGNORED}. If this call
* succeeds, the last execution time of the operation for the proxied app and
* your app will be updated to the current time.
* @param context Your context.
* @param op The operation to note. One of the OPSTR_* constants.
* @param proxiedPackageName The name of the application calling into the proxy application.
* @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or
* {@link #MODE_IGNORED} if it is not allowed and should be silently ignored (without
* causing the app to crash).
* @throws SecurityException If the app has been configured to crash on this op.
*/
public static int noteProxyOp(@NonNull Context context, @NonNull String op,
@NonNull String proxiedPackageName) {
return IMPL.noteProxyOp(context, op, proxiedPackageName);
}
}
| [
"[email protected]"
] | |
013b452b11c093d77e9a5e393bde7c136d08fdd3 | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/glide/2015/12/MemorySizeCalculator.java | 49ee8459b1a5eb7660493246081d5b7bfc9c9272 | [] | no_license | rosoareslv/SED99 | d8b2ff5811e7f0ffc59be066a5a0349a92cbb845 | a062c118f12b93172e31e8ca115ce3f871b64461 | refs/heads/main | 2023-02-22T21:59:02.703005 | 2021-01-28T19:40:51 | 2021-01-28T19:40:51 | 306,497,459 | 1 | 1 | null | 2020-11-24T20:56:18 | 2020-10-23T01:18:07 | null | UTF-8 | Java | false | false | 9,359 | java | package com.bumptech.glide.load.engine.cache;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.content.Context;
import android.os.Build;
import android.text.format.Formatter;
import android.util.DisplayMetrics;
import android.util.Log;
import com.bumptech.glide.util.Preconditions;
/**
* A calculator that tries to intelligently determine cache sizes for a given device based on some
* constants and the devices screen density, width, and height.
*/
public final class MemorySizeCalculator {
private static final String TAG = "MemorySizeCalculator";
// Visible for testing.
static final int BYTES_PER_ARGB_8888_PIXEL = 4;
static final int LOW_MEMORY_BYTE_ARRAY_POOL_DIVISOR = 2;
private final int bitmapPoolSize;
private final int memoryCacheSize;
private final Context context;
private final int arrayPoolSize;
interface ScreenDimensions {
int getWidthPixels();
int getHeightPixels();
}
MemorySizeCalculator(Context context, ActivityManager activityManager,
ScreenDimensions screenDimensions, float memoryCacheScreens, float bitmapPoolScreens,
int targetArrayPoolSize, float maxSizeMultiplier, float lowMemoryMaxSizeMultiplier) {
this.context = context;
arrayPoolSize =
isLowMemoryDevice(activityManager)
? targetArrayPoolSize / LOW_MEMORY_BYTE_ARRAY_POOL_DIVISOR
: targetArrayPoolSize;
final int maxSize = getMaxSize(activityManager, maxSizeMultiplier, lowMemoryMaxSizeMultiplier);
final int screenSize = screenDimensions.getWidthPixels() * screenDimensions.getHeightPixels()
* BYTES_PER_ARGB_8888_PIXEL;
int targetPoolSize = Math.round(screenSize * bitmapPoolScreens);
int targetMemoryCacheSize = Math.round(screenSize * memoryCacheScreens);
int availableSize = maxSize - arrayPoolSize;
if (targetMemoryCacheSize + targetPoolSize <= availableSize) {
memoryCacheSize = targetMemoryCacheSize;
bitmapPoolSize = targetPoolSize;
} else {
float part = availableSize / (bitmapPoolScreens + memoryCacheScreens);
memoryCacheSize = Math.round(part * memoryCacheScreens);
bitmapPoolSize = Math.round(part * bitmapPoolScreens);
}
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(
TAG,
"Calculation complete"
+ ", Calculated memory cache size: "
+ toMb(memoryCacheSize)
+ ", pool size: "
+ toMb(bitmapPoolSize)
+ ", byte array size: "
+ toMb(arrayPoolSize)
+ ", memory class limited? "
+ (targetMemoryCacheSize + targetPoolSize > maxSize)
+ ", max size: "
+ toMb(maxSize)
+ ", memoryClass: "
+ activityManager.getMemoryClass()
+ ", isLowMemoryDevice: "
+ isLowMemoryDevice(activityManager));
}
}
/**
* Returns the recommended memory cache size for the device it is run on in bytes.
*/
public int getMemoryCacheSize() {
return memoryCacheSize;
}
/**
* Returns the recommended bitmap pool size for the device it is run on in bytes.
*/
public int getBitmapPoolSize() {
return bitmapPoolSize;
}
/**
* Returns the recommended array pool size for the device it is run on in bytes.
*/
public int getArrayPoolSizeInBytes() {
return arrayPoolSize;
}
private static int getMaxSize(ActivityManager activityManager, float maxSizeMultiplier,
float lowMemoryMaxSizeMultiplier) {
final int memoryClassBytes = activityManager.getMemoryClass() * 1024 * 1024;
final boolean isLowMemoryDevice = isLowMemoryDevice(activityManager);
return Math.round(memoryClassBytes * (isLowMemoryDevice ? lowMemoryMaxSizeMultiplier
: maxSizeMultiplier));
}
private String toMb(int bytes) {
return Formatter.formatFileSize(context, bytes);
}
@TargetApi(Build.VERSION_CODES.KITKAT)
private static boolean isLowMemoryDevice(ActivityManager activityManager) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
return activityManager.isLowRamDevice();
} else {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB;
}
}
/**
* Constructs an {@link MemorySizeCalculator} with reasonable defaults that can be optionally
* overridden.
*/
public static final class Builder {
// Visible for testing.
static final int MEMORY_CACHE_TARGET_SCREENS = 2;
static final int BITMAP_POOL_TARGET_SCREENS = 4;
static final float MAX_SIZE_MULTIPLIER = 0.4f;
static final float LOW_MEMORY_MAX_SIZE_MULTIPLIER = 0.33f;
// 4MB.
static final int ARRAY_POOL_SIZE_BYTES = 4 * 1024 * 1024;
private final Context context;
// Modifiable for testing.
private ActivityManager activityManager;
private ScreenDimensions screenDimensions;
private float memoryCacheScreens = MEMORY_CACHE_TARGET_SCREENS;
private float bitmapPoolScreens = BITMAP_POOL_TARGET_SCREENS;
private float maxSizeMultiplier = MAX_SIZE_MULTIPLIER;
private float lowMemoryMaxSizeMultiplier = LOW_MEMORY_MAX_SIZE_MULTIPLIER;
private int arrayPoolSizeBytes = ARRAY_POOL_SIZE_BYTES;
public Builder(Context context) {
this.context = context;
activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
screenDimensions =
new DisplayMetricsScreenDimensions(context.getResources().getDisplayMetrics());
}
/**
* Sets the number of device screens worth of pixels the
* {@link com.bumptech.glide.load.engine.cache.MemoryCache} should be able to hold and
* returns this Builder.
*/
public Builder setMemoryCacheScreens(float memoryCacheScreens) {
Preconditions.checkArgument(bitmapPoolScreens >= 0,
"Memory cache screens must be greater than or equal to 0");
this.memoryCacheScreens = memoryCacheScreens;
return this;
}
/**
* Sets the number of device screens worth of pixels the
* {@link com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool} should be able to hold and
* returns this Builder.
*/
public Builder setBitmapPoolScreens(float bitmapPoolScreens) {
Preconditions.checkArgument(bitmapPoolScreens >= 0,
"Bitmap pool screens must be greater than or equal to 0");
this.bitmapPoolScreens = bitmapPoolScreens;
return this;
}
/**
* Sets the maximum percentage of the device's memory class for standard devices that can be
* taken up by Glide's {@link com.bumptech.glide.load.engine.cache.MemoryCache} and
* {@link com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool} put together, and returns
* this builder.
*/
public Builder setMaxSizeMultiplier(float maxSizeMultiplier) {
Preconditions.checkArgument(maxSizeMultiplier >= 0 && maxSizeMultiplier <= 1,
"Size multiplier must be between 0 and 1");
this.maxSizeMultiplier = maxSizeMultiplier;
return this;
}
/**
* Sets the maximum percentage of the device's memory class for low ram devices that can be
* taken up by Glide's {@link com.bumptech.glide.load.engine.cache.MemoryCache} and
* {@link com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool} put together, and returns
* this builder.
*
* @see ActivityManager#isLowRamDevice()
*/
public Builder setLowMemoryMaxSizeMultiplier(float lowMemoryMaxSizeMultiplier) {
Preconditions.checkArgument(
lowMemoryMaxSizeMultiplier >= 0 && lowMemoryMaxSizeMultiplier <= 1,
"Low memory max size multiplier must be between 0 and 1");
this.lowMemoryMaxSizeMultiplier = lowMemoryMaxSizeMultiplier;
return this;
}
/**
* Sets the size in bytes of the {@link
* com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool} to use to store temporary
* arrays while decoding data and returns this builder.
*
* <p>This number will be halved on low memory devices that return {@code true} from
* {@link ActivityManager#isLowRamDevice()}.
*/
public Builder setArrayPoolSize(int arrayPoolSizeBytes) {
this.arrayPoolSizeBytes = arrayPoolSizeBytes;
return this;
}
// Visible for testing.
Builder setActivityManager(ActivityManager activityManager) {
this.activityManager = activityManager;
return this;
}
// Visible for testing.
Builder setScreenDimensions(ScreenDimensions screenDimensions) {
this.screenDimensions = screenDimensions;
return this;
}
public MemorySizeCalculator build() {
return new MemorySizeCalculator(context, activityManager, screenDimensions,
memoryCacheScreens, bitmapPoolScreens, arrayPoolSizeBytes, maxSizeMultiplier,
lowMemoryMaxSizeMultiplier);
}
}
private static final class DisplayMetricsScreenDimensions implements ScreenDimensions {
private final DisplayMetrics displayMetrics;
public DisplayMetricsScreenDimensions(DisplayMetrics displayMetrics) {
this.displayMetrics = displayMetrics;
}
@Override
public int getWidthPixels() {
return displayMetrics.widthPixels;
}
@Override
public int getHeightPixels() {
return displayMetrics.heightPixels;
}
}
}
| [
"[email protected]"
] | |
fd994b8ee102f3ba0c18cecfb2064b9dd6b2476c | 0d84f3aa68e4be725db43586f5958dbec5125f05 | /app/src/main/java/com/dji/GSDemo/GaodeMap/DJIDemoApplication.java | b2fbd7eb864a222928ff26511820519728176aac | [] | no_license | yushiwo/GSDemo | 48864523c2149ed5dc0c0495d83e4597da8c6891 | 801d62fae005fa0a2c93d10309c6093e03c4c772 | refs/heads/master | 2020-06-03T10:56:42.181542 | 2019-06-17T02:34:26 | 2019-06-17T02:34:26 | 191,542,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,273 | java | package com.dji.GSDemo.GaodeMap;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.widget.Toast;
import dji.sdk.base.BaseComponent;
import dji.sdk.base.BaseProduct;
import dji.sdk.camera.Camera;
import dji.sdk.products.Aircraft;
import dji.sdk.products.HandHeld;
import dji.sdk.sdkmanager.DJISDKInitEvent;
import dji.sdk.sdkmanager.DJISDKManager;
import dji.common.error.DJIError;
import dji.common.error.DJISDKError;
public class DJIDemoApplication extends Application {
private static final String TAG = DJIDemoApplication.class.getName();
public static final String FLAG_CONNECTION_CHANGE = "dji_sdk_connection_change";
private DJISDKManager.SDKManagerCallback mDJISDKManagerCallback;
private static BaseProduct mProduct;
public Handler mHandler;
private Application instance;
public void setContext(Application application) {
instance = application;
}
@Override
public Context getApplicationContext() {
return instance;
}
public DJIDemoApplication() {
}
public static synchronized BaseProduct getProductInstance() {
if (null == mProduct) {
mProduct = DJISDKManager.getInstance().getProduct();
}
return mProduct;
}
public static synchronized Camera getCameraInstance() {
if (getProductInstance() == null) return null;
Camera camera = null;
if (getProductInstance() instanceof Aircraft){
camera = ((Aircraft) getProductInstance()).getCamera();
} else if (getProductInstance() instanceof HandHeld) {
camera = ((HandHeld) getProductInstance()).getCamera();
}
return camera;
}
@Override
public void onCreate() {
super.onCreate();
mHandler = new Handler(Looper.getMainLooper());
/**
* When starting SDK services, an instance of interface DJISDKManager.DJISDKManagerCallback will be used to listen to
* the SDK Registration result and the product changing.
*/
mDJISDKManagerCallback = new DJISDKManager.SDKManagerCallback() {
//Listens to the SDK registration result
@Override
public void onRegister(DJIError djiError) {
if(djiError == DJISDKError.REGISTRATION_SUCCESS) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "Register Success", Toast.LENGTH_LONG).show();
}
});
DJISDKManager.getInstance().startConnectionToProduct();
} else {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), "Register sdk fails, check network is available", Toast.LENGTH_LONG).show();
}
});
}
Log.e("TAG", djiError.toString());
}
@Override
public void onProductDisconnect() {
Log.d("TAG", "onProductDisconnect");
notifyStatusChange();
}
@Override
public void onProductConnect(BaseProduct baseProduct) {
Log.d("TAG", String.format("onProductConnect newProduct:%s", baseProduct));
notifyStatusChange();
}
@Override
public void onComponentChange(BaseProduct.ComponentKey componentKey, BaseComponent oldComponent,
BaseComponent newComponent) {
if (newComponent != null) {
newComponent.setComponentListener(new BaseComponent.ComponentListener() {
@Override
public void onConnectivityChange(boolean isConnected) {
Log.d("TAG", "onComponentConnectivityChanged: " + isConnected);
notifyStatusChange();
}
});
}
Log.d("TAG",
String.format("onComponentChange key:%s, oldComponent:%s, newComponent:%s",
componentKey,
oldComponent,
newComponent));
}
@Override
public void onInitProcess(DJISDKInitEvent djisdkInitEvent, int i) {
}
};
//Check the permissions before registering the application for android system 6.0 above.
int permissionCheck = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
int permissionCheck2 = ContextCompat.checkSelfPermission(getApplicationContext(), android.Manifest.permission.READ_PHONE_STATE);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M || (permissionCheck == 0 && permissionCheck2 == 0)) {
//This is used to start SDK services and initiate SDK.
DJISDKManager.getInstance().registerApp(getApplicationContext(), mDJISDKManagerCallback);
Toast.makeText(getApplicationContext(), "registering, pls wait...", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(getApplicationContext(), "Please check if the permission is granted.", Toast.LENGTH_LONG).show();
}
}
private void notifyStatusChange() {
mHandler.removeCallbacks(updateRunnable);
mHandler.postDelayed(updateRunnable, 500);
}
private Runnable updateRunnable = new Runnable() {
@Override
public void run() {
Intent intent = new Intent(FLAG_CONNECTION_CHANGE);
getApplicationContext().sendBroadcast(intent);
}
};
}
| [
"[email protected]"
] | |
1fa10cf8ee924663419bb89b0693664c9d129410 | a3976175d0bd399930a07ca3bb7a57f8507c497f | /src/main/java/com/example/mummyji/MummyjiApplication.java | 48544b0230ae3cdb83b002d04ba93a5eaf8f254a | [] | no_license | Dheeraj-Sachan/mummyji | 33d286d00c33f54cd194fde82c8c1744c7fedf5b | 454388a291ecae181b5d0443da1b7ee15d55fe19 | refs/heads/master | 2022-12-12T00:42:56.544411 | 2020-09-02T14:15:26 | 2020-09-02T14:15:26 | 292,302,735 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,014 | java | package com.example.mummyji;
import com.example.mummyji.service.CheckPalindrome;
import com.example.mummyji.service.FindHowManyNumbers;
import com.example.mummyji.service.FindtheRepetedLetterInString;
import com.example.mummyji.service.Students;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import java.util.Scanner;
@SpringBootApplication
public class MummyjiApplication implements CommandLineRunner {
Scanner s=new Scanner(System.in);
@Autowired
CheckPalindrome checkPalindrome;
public static void main(String[] args) {
SpringApplication.run(MummyjiApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
System.out.println("Please enter the the word to check :");
String e= s.nextLine();
checkPalindrome.check(e);
}
}
| [
"[email protected]"
] | |
629def62453a6a46df83002cb899e8b303892d99 | 7531ce3fd09e161ea54c633e882495227729c8e7 | /collinear/TestFastCollinearPoints.java | c5bcd65948c70fd5f0a395be219b21e6097097d5 | [] | no_license | lpang36/AlgorithmsDataStructuresI | 71475df1362d58e6d0f53be99fad750a6f09c546 | a2ccd7ca752cf4797da84c057730b81aabd86e2b | refs/heads/master | 2020-12-30T14:00:35.223656 | 2017-05-14T22:10:51 | 2017-05-14T22:10:51 | 91,274,431 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 487 | java | public class TestFastCollinearPoints {
public static void main(String[] args) {
int num = Integer.parseInt(args[0]);
Point[] points = new Point[num];
for (int i = 0; i<num; i++) {
points[i] = new Point(Integer.parseInt(args[i*2+1]),Integer.parseInt(args[i*2+2]));
}
FastCollinearPoints FCP = new FastCollinearPoints(points);
LineSegment[] LS = FCP.segments();
for (int i = 0; i<LS.length; i++) {
System.out.println(LS[i].toString());
}
}
} | [
"[email protected]"
] | |
ca9c230af217803632d41df9e4f21035837c140b | bed1b38c8e158659641344f0640b41aaaee2c515 | /src/main/java/com/example/latestone/LatestoneApplication.java | f619ca2c51d516ce36015d5f3a36629ede19a3a4 | [] | no_license | ak1386/latestone | 6734d713189e4daca3ab63eb2a181e75eac0fb38 | a2589215badcf840676b259e99b99cee26359604 | refs/heads/master | 2021-01-26T12:10:32.158847 | 2020-03-05T16:33:21 | 2020-03-05T16:33:21 | 243,431,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package com.example.latestone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class LatestoneApplication {
public static void main(String[] args) {
SpringApplication.run(LatestoneApplication.class, args);
}
}
| [
"[email protected]"
] | |
fb04c5391d15e12204dd6b3f227d899884477789 | 1ac7cd7f23dacc19b79f6d57cf72f3d4d5bc6c80 | /src/main/java/fa/appcode/entities/Role.java | a4d256eec3c166eab06fcac700f580aef03b3a85 | [] | no_license | leminhtuan61/project_vas | db6c96c8d55fadd5e93aa53eb5b29a0adf990ac8 | d6648ea5e04ce14c01fd728c937b3a3abb37e5e4 | refs/heads/master | 2023-02-15T13:36:24.114661 | 2021-01-12T10:32:36 | 2021-01-12T10:32:36 | 328,946,781 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,584 | java | package fa.appcode.entities;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;
@Entity
@Table(name = "ROLE", schema = "VACCINE")
public class Role {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ROLE_ID", nullable = false)
private Long roleId;
@Column(name = "ROLE_NAME", length = 30, nullable = false)
private String roleName;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "role_employee", schema = "VACCINE", joinColumns = {
@JoinColumn(referencedColumnName = "ROLE_ID") }, inverseJoinColumns = {
@JoinColumn(referencedColumnName = "EMPLOYEE_ID") })
private Set<Employee> employees;
public Role() {
super();
}
public Role(String roleName, Set<Employee> employees) {
super();
this.roleName = roleName;
this.employees = employees;
}
public Long getRoleId() {
return roleId;
}
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
public String getRoleName() {
return roleName;
}
public void setRoleName(String roleName) {
this.roleName = roleName;
}
public Set<Employee> getEmployees() {
return employees;
}
public void setEmployees(Set<Employee> employees) {
this.employees = employees;
}
}
| [
"[email protected]"
] | |
e88e9c6deb83b009228d1d1c0d3a76635d33e3e7 | 857cfc5178e5cdc78ad6a04a98ddd86a2f37ae33 | /src/main/java/com/example/demo/entity/Payment.java | 830b966d3d50e6fc6a4271bbec0efb26e7fcbcc2 | [] | no_license | DenRayzer/Proj-with-Spring | 5a9e99330e17cd4c2b6c0f5de03a975f90faf870 | 1f412456a99a0dd598abccaed6897f5c0bc356ea | refs/heads/master | 2020-09-28T20:35:39.642293 | 2019-12-09T11:55:49 | 2019-12-09T11:55:49 | 226,859,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,174 | java | package com.example.demo.entity;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import javax.persistence.*;
@Entity
public class Payment {
@Id
@GeneratedValue
private int id;
private String title;
private String description;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "person_id")
@JsonIgnoreProperties("payments")
private Person person;
public Payment() {
}
public Payment(String title, String description, Person person) {
this.title = title;
this.description = description;
this.person = person;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
}
| [
"[email protected]"
] | |
0a69557706d9ae670116b5153fb9976e24b38243 | 109b30c4da5910f4490306cfb8d1037792232950 | /src/br/com/rmdiariodebordo/model/vo/Setor.java | e6ae48f019a9a7975a03250873a70e5ac4b7db8e | [] | no_license | JotaFerreira/Diario-de-Bordo-IO | b8cf64de765ce3fe75580dd904fa361572710096 | 9925eeb437e723018625e541f2f347bba03f86a9 | refs/heads/master | 2021-01-20T04:36:34.914619 | 2015-07-31T19:03:18 | 2015-07-31T19:09:35 | 40,321,336 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 695 | java | package br.com.rmdiariodebordo.model.vo;
/**
*
* @author joao.oliveira
*/
public class Setor {
private String nomeSetor;
private String coordenador;
private String uf;
public String getNomeSetor() {
return nomeSetor;
}
public void setNomeSetor(String nomeSetor) {
this.nomeSetor = nomeSetor;
}
public String getCoordenador() {
return coordenador;
}
public void setCoordenador(String coordenador) {
this.coordenador = coordenador;
}
public String getUf() {
return uf;
}
public void setUf(String uf) {
this.uf = uf;
}
}
| [
"[email protected]"
] | |
8a58ad36fbf6a13b63279b075ed773460c0a8dd5 | 2ea49bfaa6bc1b9301b025c5b2ca6fde7e5bb9df | /contributions/isurunix/Java/Error Handling/2016-11-17.java | 8b473972b9b53dfc7466a687780247fc3decf08c | [] | no_license | 0x8801/commit | 18f25a9449f162ee92945b42b93700e12fd4fd77 | e7692808585bc7e9726f61f7f6baf43dc83e28ac | refs/heads/master | 2021-10-13T08:04:48.200662 | 2016-12-20T01:59:47 | 2016-12-20T01:59:47 | 76,935,980 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 241 | java | Throwing proper exceptions for unfinished code
Using specific exception types in the `throws` clause
The distinction between checked and unchecked exceptions
Most common reason behind **stack overflow** error
Careful Numeric Data Conversions | [
"[email protected]"
] | |
79daee8a3b5508982dd5aa8d3a633e566e3e9e2c | ee851f4d2db2af543d9c9d86848a527693fbb8e6 | /MyZoo/src/main/java/Zoo/Vertebrateses/Eagle.java | d3d9fc4c0864b690c97ec18f26cb7cdab9575502 | [] | no_license | ded-elisej/Task11_Zoo | de0d94d1efe3900cc5f5f9bb1bc4859afe586aa8 | 62d7e0c60fefd6264b7ef3c5a5c1f7381e94f642 | refs/heads/main | 2023-08-30T08:22:16.161760 | 2021-11-16T13:53:08 | 2021-11-16T13:53:08 | 425,206,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,249 | java | package Zoo.Vertebrateses;
import Zoo.Flying;
public class Eagle extends Birds implements Flying {
String name;
public Eagle (String name){
this.name = name;
}
@Override
public String whoIAm() {
String inform = "I am bird eagle.";
return inform;
}
@Override
public String iAmBreathing() {
String breath = "I'm breath by air.";
return breath;
}
@Override
public String iAmMoving() {
String move = "I usually fly with my wings.";
return move;
}
@Override
public String iHaveSkeleton() {
String skeleton = "I'm vertebrates. I have skeleton.";
return skeleton;
}
@Override
public String iAmBird() {
String type = "I'm bird.";
return type;
}
@Override
public String canIFly() {
String fly = "I can fly!";
return fly;
}
public String inform(){
String informAboutThisAnimal = " I'm eagle. I fly great. I look better in profile than in full face.";
return informAboutThisAnimal;
}
public String toString(){
return super.toString() + iHaveSkeleton() + iAmBird() + canIFly() + "\nMy name is " + this.name + inform();
}
}
| [
"[email protected]"
] | |
b7348eba0ed1964db185c1587fe940ee4ec4adf2 | 6ae625e310eb2f53c2e214debfefaf11f0368a35 | /hexin/src/main/java/com/example/stockmanage/activity/BaseActivity.java | 58e92abc9f3d7cc99a7ba6c2d6a3b015671b9bbc | [] | no_license | andyy1976/ZH_pro | a544322b9addfed0e7a7dcde645e6d9a4f222d60 | 3e559273943fa1ecf90311880854c4ee9753257d | refs/heads/master | 2021-09-05T05:15:09.810350 | 2018-01-24T09:23:50 | 2018-01-24T09:23:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,556 | java | package com.example.stockmanage.activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import com.example.stockmanage.AppContext;
import com.example.stockmanage.R;
public class BaseActivity extends AppCompatActivity {
protected android.support.v7.app.ActionBar actionBar ;
protected AppContext appContext;// 全局Context
public boolean exitNotify=false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
appContext = (AppContext) getApplication();
actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_bain, menu);
MenuItem actionSettings = menu.findItem(R.id.action_settings);
actionSettings.setTitle("版本号:1.0.3");
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@Override
public boolean onSupportNavigateUp() {
if(exitNotify) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("提示");
builder.setMessage("您确定要退出吗?");
//这里添加上这个view
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
});
builder.create().show();
return true;
}
finish();
return super.onSupportNavigateUp();
}
}
| [
"[email protected]"
] | |
a73a0997c8ac67a11807a6e9a17cce9472fc758d | be1ad124752df2ff5d48c371d3263188fb710ac0 | /src/main/java/com/api/ponto/controller/ClientController.java | 591157cc7aaf2f2267fa9afdfc667d1faef4e769 | [] | no_license | tuliog0/ponto-api | 50cadbe481cb775b984be488434f78e964dde4be | 54afb5efead6344debff79fafa12d221ce69f9ae | refs/heads/master | 2022-04-15T11:35:34.729397 | 2020-02-27T20:53:35 | 2020-02-27T20:53:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,089 | java | package com.api.ponto.controller;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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 com.api.ponto.service.ClientService;
import com.api.ponto.model.Client;
@Controller
public class ClientController {
@Autowired
ClientService clientService;
@ResponseBody
@RequestMapping(value = "/clients/list", method = RequestMethod.GET)
public List<Client> getClients(){
List<Client> clients = clientService.findAllClients();
return clients;
}
@ResponseBody
@RequestMapping(value = "/client/{id}", method=RequestMethod.GET)
public Client getClientById(@PathVariable("id") int id) {
Client client = clientService.getClientById(id);
return client;
}
@ResponseBody
@RequestMapping(value="/client/new", method=RequestMethod.POST, produces = { "application/json;charset=UTF-8" }, consumes = MediaType.APPLICATION_JSON_VALUE)
public Client saveClient(@RequestBody Client client, BindingResult result, RedirectAttributes attributes){
clientService.saveClient(client);
return client;
}
// @RequestMapping(value="/client/update/{id}", method=RequestMethod.POST)
// public String updateClient(@PathVariable("id") long id, @Valid Client client, BindingResult result/*, Model model*/) {
// if (result.hasErrors()) {
// client.setId(id);
// return "client-edit";
// }
//
// clientService.save(client);
// return "redirect:/clients";
// }
}
| [
"[email protected]"
] | |
a4d1252572ffaf8a468baf6b2e7921541ba12e4f | ae3e3e215c143af896267105013424f64816abe7 | /src/test/java/seedu/address/logic/commands/ForceClearCommandTest.java | 90d671e82a7d3eac65d21cead6ef943c0a33f4cf | [
"MIT"
] | permissive | shaokiat/tp | 60ba4f1c30bc7e70090ec5f9f75ecc1a18243cdc | 3ad9536b7e6505ba044c4b214c4afcdda1c80411 | refs/heads/master | 2023-01-07T14:44:24.722070 | 2020-11-09T15:41:39 | 2020-11-09T15:41:39 | 295,355,494 | 1 | 0 | NOASSERTION | 2020-11-08T10:06:01 | 2020-09-14T08:38:54 | Java | UTF-8 | Java | false | false | 1,371 | java | package seedu.address.logic.commands;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static seedu.address.commons.core.Messages.MESSAGE_CLEAR_SUCCESS;
import static seedu.address.logic.commands.CommandTestUtil.assertCommandSuccess;
import static seedu.address.testutil.TypicalModules.getTypicalGradPad;
import org.junit.jupiter.api.Test;
import seedu.address.model.GradPad;
import seedu.address.model.Model;
import seedu.address.model.ModelManager;
import seedu.address.model.UserPrefs;
public class ForceClearCommandTest {
@Test
public void execute_emptyGradPad_success() {
Model model = new ModelManager();
Model expectedModel = new ModelManager();
assertCommandSuccess(new ForceClearCommand(), model, MESSAGE_CLEAR_SUCCESS, expectedModel);
}
@Test
public void execute_nonEmptyGradPad_success() {
Model model = new ModelManager(getTypicalGradPad(), new UserPrefs());
Model expectedModel = new ModelManager(getTypicalGradPad(), new UserPrefs());
expectedModel.setGradPad(new GradPad());
assertCommandSuccess(new ForceClearCommand(), model, MESSAGE_CLEAR_SUCCESS, expectedModel);
}
@Test
public void requiresStall() {
ForceClearCommand forceClearCommand = new ForceClearCommand();
assertFalse(forceClearCommand.requiresStall());
}
}
| [
"[email protected]"
] | |
a4a4fa4f51b4ca7d91374cbcd454ac1bbd5653bd | 7a342535aab4f01aa2181078533a01f80761dc7b | /CapStore/src/main/java/com/capgemini/capstore/beans/Order.java | 9152606009fc48ac116adc1b3a3c08cd904a6c44 | [] | no_license | surajfzd/CapStore-1 | 3ff33910dfd266415554b13ee9dcf4cc223aba3b | 56786797d7e836f719b04ee0ecd215a520678073 | refs/heads/master | 2020-05-04T09:36:59.693481 | 2019-04-02T12:07:48 | 2019-04-02T12:07:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,863 | java | package com.capgemini.capstore.beans;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
@Entity
@Table(name = "OrderDetail")
public class Order {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
@NotNull
@OneToOne
private DummyOrder order;
@Column(name = "orderDate")
@NotNull
private Date orderDate;
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
@NotNull
private Customer customer;
@OneToOne
@NotNull
private Merchant merchant;
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
@NotNull
private Product product;
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
@NotNull
private Promo promo;
@Column(name = "deliveryStatus")
@NotNull
private DeliveryStatus deliveryStatus;
@Column(name = "productQuantity")
@NotNull
private int productQuantity;
@Column(name = "totalPrice")
@NotNull
private double totalProductPrice;
@Column(name = "finalPrice")
@NotNull
private double finalProductPrice;
public DummyOrder getOrder() {
return order;
}
public void setOrder(DummyOrder order) {
this.order = order;
}
public Date getOrderDate() {
return orderDate;
}
public void setOrderDate(Date orderDate) {
this.orderDate = orderDate;
}
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public Merchant getMerchant() {
return merchant;
}
public void setMerchant(Merchant merchant) {
this.merchant = merchant;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public int getProductQuantity() {
return productQuantity;
}
public void setProductQuantity(int productQuantity) {
this.productQuantity = productQuantity;
}
public double getTotalProductPrice() {
return totalProductPrice;
}
public void setTotalProductPrice(double totalProductPrice) {
this.totalProductPrice = totalProductPrice;
}
public double getFinalProductPrice() {
return finalProductPrice;
}
public void setFinalProductPrice(double finalProductPrice) {
this.finalProductPrice = finalProductPrice;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public DeliveryStatus getDeliveryStatus() {
return deliveryStatus;
}
public void setDeliveryStatus(DeliveryStatus deliveryStatus) {
this.deliveryStatus = deliveryStatus;
}
}
| [
"[email protected]"
] | |
fb3a29772638789b23188cfdc9fe0e44c74f9f1f | 74b47b895b2f739612371f871c7f940502e7165b | /aws-java-sdk-efs/src/main/java/com/amazonaws/services/elasticfilesystem/model/ResourceIdType.java | 2df32d2fe7bc1e270a40cbc52ed145de71b7dca3 | [
"Apache-2.0"
] | permissive | baganda07/aws-sdk-java | fe1958ed679cd95b4c48f971393bf03eb5512799 | f19bdb30177106b5d6394223a40a382b87adf742 | refs/heads/master | 2022-11-09T21:55:43.857201 | 2022-10-24T21:08:19 | 2022-10-24T21:08:19 | 221,028,223 | 0 | 0 | Apache-2.0 | 2019-11-11T16:57:12 | 2019-11-11T16:57:11 | null | UTF-8 | Java | false | false | 1,874 | java | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.elasticfilesystem.model;
import javax.annotation.Generated;
/**
* A preference indicating a choice to use 63bit/32bit IDs for all applicable resources.
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public enum ResourceIdType {
LONG_ID("LONG_ID"),
SHORT_ID("SHORT_ID");
private String value;
private ResourceIdType(String value) {
this.value = value;
}
@Override
public String toString() {
return this.value;
}
/**
* Use this in place of valueOf.
*
* @param value
* real value
* @return ResourceIdType corresponding to the value
*
* @throws IllegalArgumentException
* If the specified value does not map to one of the known values in this enum.
*/
public static ResourceIdType fromValue(String value) {
if (value == null || "".equals(value)) {
throw new IllegalArgumentException("Value cannot be null or empty!");
}
for (ResourceIdType enumEntry : ResourceIdType.values()) {
if (enumEntry.toString().equals(value)) {
return enumEntry;
}
}
throw new IllegalArgumentException("Cannot create enum from " + value + " value!");
}
}
| [
""
] | |
73c8fb1b74f259841a1ed75a50a4ed6f4ff4115b | 9810488568a8b75c2d16edf50b4b57e8e5c7bebb | /EncogAdvanced/src/drosa/indicators/SMA.java | 2a4104b1aba49b4ec7f1920a3c00041a182ed8e5 | [] | no_license | davidautentico/FxPredictor | 392693e32724e9196d6ab33135b916515b4bc64d | 36c1d413d472d4c1478668614df5d476fcb6c82e | refs/heads/master | 2021-06-24T08:40:47.395190 | 2021-03-21T11:05:55 | 2021-03-21T11:05:55 | 195,585,127 | 0 | 0 | null | 2020-10-13T14:24:38 | 2019-07-06T21:37:34 | Java | UTF-8 | Java | false | false | 1,125 | java | package drosa.indicators;
import java.util.ArrayList;
import java.util.List;
import drosa.finances.Quote;
import drosa.utils.PrintUtils;
public class SMA {
public static double getValue(List<Quote> data,int begin,int end,boolean close) {
// TODO Auto-generated method stub
double sum=0.0;
for (int i=begin;i<=end;i++){
if (close){
sum+=data.get(i).getClose();
}else{
sum+=data.get(i).getAdjClose();
}
}
return sum/(end-begin+1);
}
public static double getValue(ArrayList<Quote> data,int pos,int period,boolean close) {
// TODO Auto-generated method stub
double sum=0.0;
int end = pos;
int begin = pos-period+1;
if (begin<0)
begin = 0;
//System.out.println("primero y ultimo para la media "+period+"-> "+begin+" "+end+
// " "+PrintUtils.Print(data.get(begin).getClose())+
// " "+PrintUtils.Print(data.get(end).getClose()));
for (int i=begin;i<=end;i++){
if (close){
sum+=data.get(i).getClose();
}else{
sum+=data.get(i).getAdjClose();
}
}
return sum/(end-begin+1);
}
}
| [
"[email protected]"
] | |
bd9f0f17dbd0fd1049f0172bfc2d921e3d0ed90e | 448c76e0a54dcdaa933b65954f5a5b9909e9b90d | /app/src/main/java/com/begentgroup/sampledata/Person.java | bfe6cef1ab2d5d0d82ca1ae4fbd3c17df82a0d99 | [] | no_license | dongja94/SampleData_DD2 | ffade16fa3bb6eef979ede8959044bc46cd2f44d | 516abc9fb4cdc458f7d1ecc59e23115e57486858 | refs/heads/master | 2021-01-19T04:24:55.452877 | 2016-08-12T02:56:57 | 2016-08-12T02:56:57 | 65,339,835 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package com.begentgroup.sampledata;
/**
* Created by Administrator on 2016-08-11.
*/
public class Person {
long id = -1;
String name;
int age;
String phone;
String address;
@Override
public String toString() {
return name + "(" + age + ")";
}
}
| [
"[email protected]"
] | |
01f8676a3483ef500f6041c93346f10bc476f436 | 880f2908dacf1af023b89fc42e1264f7fc305aa3 | /ktamr-common/src/main/java/com/ktamr/common/utils/imports/ImportUtil.java | 8597cc88c24d709d6913613e5f054bbee05174fe | [] | no_license | ocean-wave/ktamr | 3c5fd23d76beec1e92f20be3f9ec9e998701863b | 5576e7c8e09fec543f63b2daf65d972b91fcc053 | refs/heads/master | 2020-06-16T11:53:25.179073 | 2019-07-06T14:04:38 | 2019-07-06T14:04:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package com.ktamr.common.utils.imports;
public class ImportUtil {
public static void fileNameExcel(String fileName) throws Exception{
String str = fileName.substring(fileName.lastIndexOf("."));
if(!(".xls".equals(str) || ".xlsl".equals(str))){
throw new Exception("请上传.xls或.xlsl文件");
}
}
}
| [
"[email protected]"
] | |
8c680cca9a3973889da9504a2eece1b6991513e3 | 466129a071eb9fcf5172c1cc367769a35f1f46bc | /app/src/main/java/com/treasure_ct/android_xt/studyfragment/seniorcontrols/customview/ExtendView_AliPayEdit.java | ba082075148708a1e31d9532b1bcb9d972f70d50 | [] | no_license | treasurect/Android_XT | 2a800097e02526e6ad6a1408347e23bdcac71fc8 | 35ffe3ca2031181cfd60d3f7a84fc9822346c4df | refs/heads/master | 2021-07-10T18:32:56.975458 | 2017-09-17T10:18:38 | 2017-09-17T10:18:40 | 103,820,529 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 433 | java | package com.treasure_ct.android_xt.studyfragment.seniorcontrols.customview;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.treasure_ct.android_xt.R;
public class ExtendView_AliPayEdit extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_extend_view);
}
}
| [
"[email protected]"
] | |
c71921fd2ba468a8d4829c05770bff6bd39886f2 | 049e1c020b8095d050e6da03b9682ef02456e018 | /models/src/main/java/es/psoe/models/items/CalendarItem.java | 539f7b491f4819c5f1c6d20d4cdb2ab34a9d9f7b | [
"MIT"
] | permissive | PSOEGaldar/appAndroid | 63172217555cb6a838e5e7913ba36ad93337823e | 4f5ca13a6217fd0d7bc9dea56756a291dcb59204 | refs/heads/master | 2021-01-10T01:03:16.706378 | 2015-06-27T19:50:30 | 2015-06-27T20:02:16 | 38,173,251 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 391 | java | package es.psoe.models.items;
import java.util.Date;
/**
* Created by exalu_000 on 29/03/2015.
*/
public class CalendarItem {
public Date date;
private String title;
public String location;
public String description;
public String getTitle() {
return title.toUpperCase();
}
public void setTitle(String title) {
this.title = title;
}
}
| [
"[email protected]"
] | |
cdd066b4c0776432ee620f8ce0f61f528f8858f2 | 66e8db5b135cd1a0d2ab532715231b3f63d2c9bf | /Ejercicio_Spring_MVC/src/main/java/com/iwcn/master/services/Producto.java | 2c1e0f38781b6182b0ac7a10c2ff1d462a9a5ed5 | [] | no_license | vbarrios/IWCN_spring_mvc | 43c31fcff41fb5fbb6fa818447cff7bd67f931aa | b6e54c21a21f350639c3a8f312dbc14785cfa6ec | refs/heads/master | 2021-07-19T20:33:18.760888 | 2017-10-22T22:08:11 | 2017-10-22T22:08:11 | 107,904,451 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 302 | java | package com.iwcn.master.services;
public class Producto {
public String name_;
public int reference_;
public int price_;
public int stock_;
public Producto(String name,int reference,int price,int stock)
{
name_=name;
reference_=reference;
price_=price;
stock_=stock;
}
}
| [
"[email protected]"
] | |
b94dc473453b3998c5740e321477f1c43553fc53 | 433b4683726ea6f9d35b494e620e2550029f1575 | /day10/ProductLowToHigh.java | 6c7a31a4331190a427983018fbc5be8871b4efe9 | [] | no_license | sreeja1743/Total-2 | 07b40675ff67214edad54612da6813baee1fce48 | f2dbc5184a1a6ac15462dc8eaa172264acd01657 | refs/heads/main | 2023-05-07T12:43:29.020385 | 2021-05-18T12:33:49 | 2021-05-18T12:33:49 | 368,522,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 210 | java | package day10;
import java.util.Comparator;
public class ProductLowToHigh implements Comparator<Product>{
public int compare(Product o1, Product o2) {
return o1.getCost() - o2.getCost();
}
}
| [
"[email protected]"
] | |
d9d42451e5b5c00098c8f76263dcb7e3519db50a | fcd94d9407b79a8d4278470fc1a0514e30ecb10b | /src/main/java/com/stanislav/danylenko/course/db/repository/location/CountryRepository.java | 85d37d5fb4dcd97b3d2a7ba23564537b996408e4 | [] | no_license | StanislavDanylenko/courseDrone | 53d7d344ffde9b3f9286fdb4cb2602b80928bd52 | 251ff44f3234349c1174bb85dd6f24ba155324b1 | refs/heads/master | 2020-04-07T02:59:22.122724 | 2019-01-16T15:51:37 | 2019-01-16T15:51:37 | 157,997,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 306 | java | package com.stanislav.danylenko.course.db.repository.location;
import com.stanislav.danylenko.course.db.entity.location.Country;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CountryRepository extends JpaRepository<Country, Long> {
Country findByName(String name);
}
| [
"[email protected]"
] | |
e3ea707c761cea26fb7eaeda9bfb368d2d7e14e9 | 52a7f23e4f03879a6e24ea22c246d92c7bf56ff3 | /src/main/java/com/javatesting/domainobject/TestAppEnv.java | 334abf1a46989ad4134854ee0f3dd2235e9ad2f6 | [] | no_license | ottagit/javatesting | fb5f191dd063297a8113f49db449f13ae4a4d2fe | 7c3ca2ed6e046746f8d7f74a5bc31fa6a2df1d95 | refs/heads/main | 2023-06-18T06:52:39.699849 | 2021-07-17T14:06:23 | 2021-07-17T14:06:23 | 384,083,927 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package com.javatesting.domainobject;
public class TestAppEnv {
public static final String PORT = "67";
public static final String DOMAIN = "192.123.0.3";
public static String getUrl() {
return "http://" + DOMAIN + ":" + PORT;
}
}
| [
"[email protected]"
] | |
31a29e8ef6ba9004acc1512dbefc30d038fbad2a | 25baed098f88fc0fa22d051ccc8027aa1834a52b | /src/main/java/com/ljh/controller/base/SupKindController.java | e945cff604044308dde0ac64035d7923043115a0 | [] | no_license | woai555/ljh | a5015444082f2f39d58fb3e38260a6d61a89af9f | 17cf8f4415c9ae7d9fedae46cd9e9d0d3ce536f9 | refs/heads/master | 2022-07-11T06:52:07.620091 | 2022-01-05T06:51:27 | 2022-01-05T06:51:27 | 132,585,637 | 0 | 0 | null | 2022-06-17T03:29:19 | 2018-05-08T09:25:32 | Java | UTF-8 | Java | false | false | 309 | java | package com.ljh.controller.base;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
/**
* <p>
* 前端控制器
* </p>
*
* @author ljh
* @since 2020-10-26
*/
@Controller
@RequestMapping("/supKind")
public class SupKindController {
}
| [
"[email protected]"
] | |
b700d4a679f56fcdbd262b1e68469b1144021412 | d64057c89ee9d5762abd0447179248d1519c1b67 | /dl4j-examples/src/main/java/org/deeplearning4j/examples/feedforward/classification/wineClassification/old/getWineType/WineTypeRecordReader.java | a2f8ae856005656e7a550fa8ace01adf81c74cdc | [] | no_license | chiaweil/dl4j-practice | 80a8609143e9572ec9fada818101fd2848564065 | 9939d931e0fa52001f8098250b027dca345a500b | refs/heads/master | 2020-03-22T00:42:54.249829 | 2018-07-18T15:29:25 | 2018-07-18T15:29:25 | 133,781,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,610 | java | package org.deeplearning4j.examples.feedforward.classification.wineClassification.old.getWineType;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.datavec.api.records.reader.impl.LineRecordReader;
import org.datavec.api.records.reader.impl.csv.SerializableCSVParser;
import org.datavec.api.split.FileSplit;
import org.datavec.api.split.InputSplit;
import org.datavec.api.split.InputStreamInputSplit;
import org.datavec.api.split.StringSplit;
import org.datavec.api.writable.DoubleWritable;
import org.datavec.api.writable.Text;
import org.datavec.api.writable.Writable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.util.*;
import java.util.regex.Pattern;
public class WineTypeRecordReader extends LineRecordReader
{
protected InputSplit inputSplit;
protected URI[] locations;
protected int skipNumLines = 0;
protected int dataStartIndex = 0;
protected int dataEndIndex = 0;
protected Iterator<String> iter; //for iteration in next
private SerializableCSVParser csvParser;
public static char delimiter = ',';
private static boolean iterEnd = false;
public static List<String> labels;
protected List<String> dataList = new ArrayList<>();
protected static final int RANDOM_SEED = 123;
public WineTypeRecordReader()
{
}
public WineTypeRecordReader(int skipNumLines, char delimiter, int dataStartIndex, int dataEndIndexExclusive)
{
this.skipNumLines = skipNumLines;
this.delimiter = delimiter;
this.dataStartIndex = dataStartIndex + skipNumLines;
this.dataEndIndex = dataEndIndexExclusive + skipNumLines;
}
@Override
public boolean hasNext() {
if(iterEnd == false && iter == null)
{
iter = dataList.iterator();
return true;
}
else if(iter.hasNext())
{
return true;
}
return false;
}
@Override
public List<Writable> next()
{
if (iter.hasNext())
{
/**
* Important block in here
*/
List<Writable> ret = new ArrayList<>();
String currentRecord = iter.next();
String[] temp = currentRecord.split(",");
for(int i = 0;i < temp.length; i++)
{
ret.add(new DoubleWritable(Double.parseDouble(temp[i])));
}
return ret;
}
else
throw new IllegalStateException("no more elements");
}
@Override
public void reset() {
iterEnd = false;
iter = dataList.iterator();
}
/*
protected Iterator<String> getIterator(int location) {
Iterator<String> iterator = null;
if (inputSplit instanceof StringSplit) {
StringSplit stringSplit = (StringSplit) inputSplit;
iterator = Collections.singletonList(stringSplit.getData()).listIterator();
} else if (inputSplit instanceof InputStreamInputSplit) {
InputStream is = ((InputStreamInputSplit) inputSplit).getIs();
if (is != null) {
iterator = IOUtils.lineIterator(new InputStreamReader(is));
}
} else {
this.locations = inputSplit.locations();
if (locations != null && locations.length > 0) {
InputStream inputStream;
try {
inputStream = locations[location].toURL().openStream();
} catch (IOException e) {
throw new RuntimeException(e);
}
iterator = IOUtils.lineIterator(new InputStreamReader(inputStream));
}
}
if (iterator == null)
throw new UnsupportedOperationException("Unknown input split: " + inputSplit);
return iterator;
}
*/
protected void closeIfRequired(Iterator<String> iterator) {
if (iterator instanceof LineIterator) {
LineIterator iter = (LineIterator) iterator;
iter.close();
}
}
protected List<Writable> parseLine(String line) {
String[] split;
try {
split = csvParser.parseLine(line);
} catch(IOException e) {
throw new RuntimeException(e);
}
List<Writable> ret = new ArrayList<>();
for (String s : split) {
ret.add(new Text(s));
}
return ret;
}
/**
* This only possible in the directory only contains files of the designated format to read in
* @param split
* @throws IOException
* @throws InterruptedException
*/
@Override
public void initialize(InputSplit split) throws IOException, InterruptedException
{
int iterLabel = 0;
this.inputSplit = split;
//this.iter = getIterator(0);
if (split instanceof FileSplit) {
this.locations = split.locations();
if (locations != null && locations.length > 1) {
for (URI location : locations)
{
boolean toSkipLines = false;
int linesToSkip = 0; // new File
int dataIndex = 0;
if(linesToSkip < skipNumLines)
{
toSkipLines = true;
}
File file = new File(location);
/**
* Get file name as label
*/
String[] pathsSplit = file.toString().split("/");
String fileName = pathsSplit[pathsSplit.length - 1];
String label = fileName.split(Pattern.quote("."))[0];//separate by . , like file.csv to get file name as label
System.out.println("Label: " + label);
/**
* Get data
*/
Iterator<String> iter1 = IOUtils.lineIterator(new InputStreamReader(location.toURL().openStream()));
while(iter1.hasNext())
{
if (toSkipLines && (linesToSkip++ < skipNumLines))
{
if(linesToSkip >= skipNumLines)
{
toSkipLines = false;
}
iter1.next();
++dataIndex;
}
else if(dataIndex < dataStartIndex)
{
iter1.next();
++dataIndex;
}
else if(dataIndex >= dataEndIndex)
{
break;
}
else
{
String data = iter1.next() + "," + String.valueOf(iterLabel);
String newData = data.replace(Character.toString(delimiter), ",").replaceAll("\\[", "").replaceAll("\\]","");
dataList.add(newData);
//System.out.println(newData);
++dataIndex;
}
}
++iterLabel;
}
}
}
Collections.shuffle(dataList, new Random(RANDOM_SEED));
this.iter = dataList.iterator();
}
}
| [
"[email protected]"
] | |
2f6b30696eb61f044fff9764b397f7a93c3ebc75 | dba82fd5efed0c1b8eaedfebc5d4049afece6805 | /src/main/java/wtf/gameplay/fracturing/FracVec.java | 83dff64205952040cc564de1e1476068f95b22db | [] | no_license | WesCook/Expedition-Homestead-Edition | a441328972e8492405ea73d458e183309d8a3295 | 4efec670efa7203ed3db8c1bce5f9a691b74d16a | refs/heads/master | 2020-06-27T06:06:13.312259 | 2017-07-12T22:39:09 | 2017-07-12T22:39:09 | 97,049,890 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | package wtf.gameplay.fracturing;
import java.util.Random;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
public class FracVec{
public final int maxDist;
public final int blocksToFrac;
public final double oriX;
public final double oriY;
public final double oriZ;
public final double vecX;
public final double vecY;
public final double vecZ;
float pi = (float)Math.PI*2;
public FracVec(BlockPos pos, int str, int maxDist, double x, double y, double z) {
this.oriX = pos.getX() + 0.5;
this.oriY = pos.getY() + 0.5;
this.oriZ = pos.getZ() + 0.5;
this.vecX = x;
this.vecY = y;
this.vecZ = z;
this.maxDist=maxDist;
this.blocksToFrac=str;
}
public FracVec(BlockPos pos, int str, int maxDist, Random random){
this.oriX = pos.getX() + 0.5;
this.oriY = pos.getY() + 0.5;
this.oriZ = pos.getZ() + 0.5;
float pitchX = random.nextFloat()*pi;
float pitchY = random.nextFloat()*pi;
float sinY = MathHelper.sin(pitchY);
vecY = MathHelper.cos(pitchY);
vecX = MathHelper.cos(pitchX) * sinY;
vecZ = MathHelper.sin(pitchX) * sinY;
this.maxDist=maxDist;
this.blocksToFrac=str;
}
public BlockPos getPos(int dist){
return new BlockPos(oriX+vecX*dist, oriY+vecY*dist, oriZ+vecZ*dist);
}
}
| [
"[email protected]"
] | |
2584d70d764fe2ce28a493c7082bf17ab8a5853e | 8725992f292b23a1136983c473f3fe119f01e1c3 | /src/main/java/TestHosts.java | 636774c0ed3ea7dbabc0a660a210a50a09196773 | [] | no_license | Maciej-R/Projekt_PO | ee7ee4fbe384632f4b93c26eb8ca5bade5e87629 | 792e30e8fc33a09b4710b8082494c58d59da6cc3 | refs/heads/master | 2021-01-03T08:49:14.062929 | 2020-02-12T12:28:50 | 2020-02-12T12:28:50 | 240,007,476 | 0 | 0 | null | 2020-10-13T19:29:44 | 2020-02-12T12:28:06 | Java | UTF-8 | Java | false | false | 686 | java | import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.TestInstance;
import java.util.HashMap;
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class TestHosts {
private HashMap<String, String> parameters;
@org.junit.jupiter.api.Test
void printInfo(){
Hosts h = new Hosts(parameters);
h.run();
try {
System.in.read();
}catch (Exception e){}
}
@BeforeAll
void co(){
parameters = new HashMap<String, String>();
parameters.put("h", "10.0.0.15");
//parameters.put("h", "192.168.0.45");
parameters.put("n", "10");
parameters.put("t", "1000");
}
}
| [
"[email protected]"
] | |
24c1630e75cd3754361977b1e3f8a99f21fc6a9f | 190458d340c87882394933504cac28a4f9e6517b | /week-02/day-02/Idea/src/DrawTriangle.java | 133a46d0e17b08fa821cdb02ee643c2eb2bf5183 | [] | no_license | green-fox-academy/btekse | 233ea5cd2a3b393e04a657ddf5a20cbda35819e3 | c6d82d3d1423cc7ac4e1439335e475151e39d711 | refs/heads/master | 2021-06-22T17:08:13.688447 | 2017-07-19T22:19:15 | 2017-07-19T22:19:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | import java.util.Scanner;
/**
* Created by Balázs on 2017. 03. 22..
*/
// #27
// Write a program that reads a number from the standard input, then draws a
// triangle like this:
//
// *
// **
// ***
// ****
//
// The triangle should have as many lines as the number was
public class DrawTriangle {
public static void main(String[] args) {
Scanner myScanner = new Scanner(System.in);
System.out.println("Enter number: ");
int n1 = myScanner.nextInt();
for (int i = 1; i < n1 + 1; i++) {
for (int j = 1; j < i + 1; j++) {
System.out.print("*");
}
System.out.println("");
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.