blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f0aaf0dba50a6346697cb48f27923784fbe3b563 | 4ece07f681a7d60988ec7fa1d4d46bc5dba9a639 | /unidbg-api/src/main/java/com/github/unidbg/PointerArg.java | ff20fba7ecbecf38d6fbc9f9e957e5dbf0d3733d | [
"Apache-2.0"
] | permissive | fakegit/unidbg | 499e1089b310cb0b54755aeea1d68f87ec5d3e23 | 81bb1967e4a2c3fd802cc672b393894795e6c3c5 | refs/heads/master | 2023-07-06T11:31:51.547173 | 2023-06-22T17:48:18 | 2023-06-22T17:48:18 | 231,087,918 | 0 | 0 | Apache-2.0 | 2023-09-10T18:10:48 | 2019-12-31T12:48:22 | Java | UTF-8 | Java | false | false | 117 | java | package com.github.unidbg;
import com.sun.jna.Pointer;
public interface PointerArg {
Pointer getPointer();
}
| [
"zhkl0228@qq.com"
] | zhkl0228@qq.com |
1f547288c4b95cacc4f95b3ba23ea718b89ae91c | 7a7f7f39cf335dd4864d70574a15258935861441 | /publicframework/src/main/java/com/cqkj/publicframework/tool/AsyncImageLoaderByPath.java | db0db77415b97745cb9d885883cbec29ff9bae7d | [] | no_license | wenweibo/Snail | 9550ebc177b37da4d728ef9306df2e6da30c2d8e | d602b6fe133bef1cbdb2e82a1c5b82e87e94ff67 | refs/heads/master | 2020-06-24T11:45:55.346236 | 2019-08-26T09:30:35 | 2019-08-26T09:30:35 | 198,954,405 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,179 | java | package com.cqkj.publicframework.tool;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.os.Handler;
import android.os.Message;
import com.cqkj.publicframework.globalvariable.Constant;
import java.io.File;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.util.HashMap;
public class AsyncImageLoaderByPath {
// SoftReference是软引用,是为了更好的为了系统回收变量
private HashMap<String, SoftReference<Bitmap>> imageCache;
//private int Degree;
public AsyncImageLoaderByPath() {
this.imageCache = new HashMap<String, SoftReference<Bitmap>>();
}
public HashMap<String, SoftReference<Bitmap>> getImageCache() {
return imageCache;
}
public Bitmap getBitmapFromCache(String imagePath, String key) {
if (key != null) {
if (imageCache.containsKey(key)) {
// 从缓存中获取
SoftReference<Bitmap> softReference = imageCache.get(key);
Bitmap bitmap = softReference.get();
if ((bitmap != null) && (!bitmap.isRecycled())) {
return bitmap;
}
}
}
if (imagePath != null) {
try {
imageCache.put(key, new SoftReference<Bitmap>(BitmapFactory.decodeFile(imagePath)));
} catch (OutOfMemoryError e) {
e.printStackTrace();
return null;
} catch (Exception e) {
e.printStackTrace();
return null;
}
} else {
return null;
}
if (imageCache.containsKey(key)) {
return getBitmapFromCache(null, key);
} else {
return null;
}
}
public void putBitmapToCache(String imagePath, String key, Bitmap bitmap) {
try {
if (bitmap != null) {
//imageCache.put(key, new_truck SoftReference<Bitmap>(bitmap));
ImageFunction.saveBitmapToPath(imagePath, bitmap, Bitmap.CompressFormat.JPEG, 80);
}
} catch (Exception e) {
}
}
private boolean isFile(String imagePath) {
if (imagePath == null) {
return false;
}
File file = new File(imagePath);
if (file.isDirectory()) {
return false;
}
if (!file.isFile()) {
return false;
}
if (!file.exists()) {
return false;
}
return true;
}
public void loadBitmapByPath(final String imagePath, final String key, final ImageCallback imageCallback, final int degree) {
if (imagePath == null) {
return;
}
if (!isFile(imagePath)) {
return;
}
//Degree = readPicDegree(imagePath);
final Handler handler = new Handler() {
public void handleMessage(Message message) {
if (imageCallback != null) {
imageCallback.imageLoaded((Bitmap) message.obj, Constant.project_root_folder + key);
}
}
};
// 建立新一个获取SD卡的图片
new Thread() {
@Override
public void run() {
byte[] data = ImageFunction.decodeBitmap(imagePath);
if (data != null) {
try {
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
if (degree != 0) {
bitmap = rotateBitmap(degree, bitmap);
}
// imageCache.put(key, new_truck
// SoftReference<Bitmap>(bitmap));
putBitmapToCache(Constant.project_root_folder + key, key, bitmap);
Message message = handler.obtainMessage(0, bitmap);
handler.sendMessage(message);
} catch (OutOfMemoryError e) {
} catch (Exception e) {
}
} else {
Message message = handler.obtainMessage(0, null);
handler.sendMessage(message);
}
}
}.start();
}
// 回调接口
public interface ImageCallback {
public void imageLoaded(Bitmap imageBitmap, String imagePath);
}
/**
* 通过ExifInterface类读取图片文件的被旋转角度
*
* @param path : 图片文件的路径
* @return 图片文件的被旋转角度
*/
public static int readPicDegree(String path) {
int degree = 0;
// 读取图片文件信息的类ExifInterface
ExifInterface exif = null;
try {
exif = new ExifInterface(path);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
if (exif != null) {
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
degree = 90;
break;
case ExifInterface.ORIENTATION_ROTATE_180:
degree = 180;
break;
case ExifInterface.ORIENTATION_ROTATE_270:
degree = 270;
break;
}
}
return degree;
}
/**
* 将图片纠正到正确方向
*
* @param degree : 图片被系统旋转的角度
* @param bitmap : 需纠正方向的图片
* @return 纠向后的图片
*/
public static Bitmap rotateBitmap(int degree, Bitmap bitmap) {
Matrix matrix = new Matrix();
matrix.postRotate(degree);
Bitmap bm = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
bitmap.recycle();
bitmap = null;
return bm;
}
}
| [
"714678701@qq.com"
] | 714678701@qq.com |
6cf8392afd3e7eff58760bf452c8097f7ed14b5f | 0fb6f0faa7e6d9b557ec43201f0edb2056ac08d6 | /java/src/hackerRank/daysOfCode/Day0.java | 598c2adc708daae5638535868e2ad5feb6bc2187 | [] | no_license | macoto35/Algorithms_Kata | a0bb167668aa4e8b678f9c5f47fc9142ade67553 | f92aec5674dc67be024f4ad04d40a85d09ef7b1e | refs/heads/master | 2021-07-07T13:21:16.805125 | 2020-07-21T01:25:34 | 2020-07-21T01:25:34 | 138,005,631 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package hackerRank.daysOfCode;
import java.util.*;
public class Day0 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String inputString = scanner.nextLine();
scanner.close();
System.out.println("Hello, World.");
System.out.println(inputString);
}
}
| [
"sohee.um@mercer.com"
] | sohee.um@mercer.com |
9c64965edab3607e221922a58bf0a25fcbecd731 | d4a3046f11482b1bd42c02f37cdc340649a20a0c | /app/src/androidTest/java/me/bakumon/livedatasample/ExampleInstrumentedTest.java | e58174e715c5795845517b092819e231386a684d | [] | no_license | Bakumon/LiveDataSample | 4362bb107446fa4055277dd7196f540574a54ed7 | c9610b7cd8a3b08e8dff684a67b8a785e4c81c3d | refs/heads/master | 2021-08-07T16:17:51.120443 | 2017-11-08T14:46:22 | 2017-11-08T14:46:22 | 107,663,088 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 754 | java | package me.bakumon.livedatasample;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumentation test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("me.bakumon.livedatasample", appContext.getPackageName());
}
}
| [
"bakumon@aliyun.com"
] | bakumon@aliyun.com |
cd8cf61ca9f3baf7f71f591762bf19d03f1ee07f | ca806e3cf687d96ed5b7243c684aa477cb285f6a | /frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/dialog/PopupNativeKeyPressHandler.java | d9512e128818b3211d7ef8c4ed413304d53ccf81 | [
"Apache-2.0"
] | permissive | aiminickwong/gluster-ovirt-poc | 89b0b771fa4a4c173b182784ed7c9306fbba21cf | 8778ec6809aac91034f1a497383b4ba500f11848 | refs/heads/master | 2021-01-18T00:16:20.779353 | 2012-02-06T13:40:32 | 2012-02-06T13:40:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 273 | java | package org.ovirt.engine.ui.webadmin.widget.dialog;
import com.google.gwt.dom.client.NativeEvent;
/**
* Handler interface for native key press events that occur within popups.
*/
public interface PopupNativeKeyPressHandler {
void onKeyPress(NativeEvent event);
}
| [
"vszocs@redhat.com"
] | vszocs@redhat.com |
46098e974684c9213c96bed0a0ca2c30bae2a373 | 9435a284aeaa2c3af22dc46df772dc1a6b1c6f99 | /src/main/java/com/packtpub/wflydevelopment/chapter4/controller/Poller.java | bcdf90a024faad4fb48b3363f1ad172563760a70 | [] | no_license | luiseufrasio/ticket-agency-cdi | e5170dea25413a97359c9f1b5cfb1d450044c79c | 239815d2b2cf3a99279380b1316195cc1d7f4543 | refs/heads/master | 2021-01-25T14:26:46.828823 | 2018-04-01T22:18:25 | 2018-04-01T22:18:25 | 123,697,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 660 | java | package com.packtpub.wflydevelopment.chapter4.controller;
import java.util.Collection;
import javax.enterprise.inject.Model;
import javax.inject.Inject;
import com.packtpub.wflydevelopment.chapter4.boundary.TheatreBox;
import com.packtpub.wflydevelopment.chapter4.entity.Seat;
@Model
public class Poller {
@Inject
private TheatreBox theatreBox;
public boolean isPollingActive() {
return areFreeSeatsAvailable();
}
private boolean areFreeSeatsAvailable() {
final Collection<Seat> list = theatreBox.getSeats();
for (Seat seat : list) {
if (!seat.isBooked()) {
return true;
}
}
return false;
}
}
| [
"luise@DESKTOP-PJO0HNN"
] | luise@DESKTOP-PJO0HNN |
2aab1df6b9cde76d6f5aa5990253e1b1bc6b3465 | aaa146d129a10a065a3cd1e47a34dac07b7a7681 | /src/main/java/com/example/demo/repo/EmployeeRepository.java | 265fc32329e1172728f0656162a57552533d1944 | [] | no_license | Medha23/sample | f035deb795f4a625fceb9dd5253edec4995f8130 | 3c4ae30fdadc60aed9a995c525bac9ef363c2afa | refs/heads/master | 2021-01-02T15:45:53.028955 | 2020-02-13T13:06:24 | 2020-02-13T13:06:24 | 239,688,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 289 | java | package com.example.demo.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.example.demo.entity.EmployeeEntity;
@Repository
public interface EmployeeRepository extends JpaRepository<EmployeeEntity, Long>{
}
| [
"48347021+Medha23@users.noreply.github.com"
] | 48347021+Medha23@users.noreply.github.com |
25deaf457293d8f7ec9f67ba7bb4a4f7fbabb053 | 89e9745ba8d67b33b9e529f7c477998567f44e66 | /src/MainFrame.java | e5e0bb0984a9fd2e3ab01ccfe4cb1f3419d48b7a | [
"MIT"
] | permissive | wesrchow/TerrainSim2020 | 73be3583e9eadf7df4bc3f1bc19c10c6d210fefa | a7a481f8f585f067852b828b02fc97429e0837a7 | refs/heads/master | 2022-10-28T10:44:24.148576 | 2020-06-12T20:07:02 | 2020-06-12T20:07:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,771 | java | import java.awt.Graphics;
public class MainFrame extends javax.swing.JFrame {
/**
* Creates new form MainFrame
*/
public MainFrame() {
initComponents();
TextMessageOutput.setText("Dimensions must be more than 15\n and less than 600. Parameters\n must be within dimensions");
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
PanelCanvasContainer = new javax.swing.JPanel();
PanelCanvas = new javax.swing.JPanel();
PanelControls = new javax.swing.JPanel();
ButtonGenerate = new javax.swing.JButton();
TextInputX = new javax.swing.JTextField();
TextInputZ = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
TextMessageOutput = new javax.swing.JTextArea();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
TextInputHillHeight = new javax.swing.JTextField();
TextInputGrass = new javax.swing.JTextField();
TextInputHillFreq = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
TextInputFlat = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
TextInputHillWidth = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setMaximumSize(new java.awt.Dimension(861, 592));
setMinimumSize(new java.awt.Dimension(861, 592));
setResizable(false);
PanelCanvas.setBackground(new java.awt.Color(255, 255, 255));
PanelCanvas.setPreferredSize(new java.awt.Dimension(600, 600));
javax.swing.GroupLayout PanelCanvasLayout = new javax.swing.GroupLayout(PanelCanvas);
PanelCanvas.setLayout(PanelCanvasLayout);
PanelCanvasLayout.setHorizontalGroup(
PanelCanvasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 600, Short.MAX_VALUE)
);
PanelCanvasLayout.setVerticalGroup(
PanelCanvasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 600, Short.MAX_VALUE)
);
javax.swing.GroupLayout PanelCanvasContainerLayout = new javax.swing.GroupLayout(PanelCanvasContainer);
PanelCanvasContainer.setLayout(PanelCanvasContainerLayout);
PanelCanvasContainerLayout.setHorizontalGroup(
PanelCanvasContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelCanvasContainerLayout.createSequentialGroup()
.addContainerGap()
.addComponent(PanelCanvas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
PanelCanvasContainerLayout.setVerticalGroup(
PanelCanvasContainerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(PanelCanvasContainerLayout.createSequentialGroup()
.addContainerGap()
.addComponent(PanelCanvas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
PanelControls.setMaximumSize(new java.awt.Dimension(408, 124));
PanelControls.setMinimumSize(new java.awt.Dimension(408, 124));
PanelControls.setRequestFocusEnabled(false);
PanelControls.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
ButtonGenerate.setText("Generate");
ButtonGenerate.setRequestFocusEnabled(false);
ButtonGenerate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ButtonGenerateActionPerformed(evt);
}
});
PanelControls.add(ButtonGenerate, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 568, 251, -1));
TextInputX.setText("75");
TextInputX.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TextInputXActionPerformed(evt);
}
});
PanelControls.add(TextInputX, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 120, 70, -1));
TextInputZ.setText("75");
PanelControls.add(TextInputZ, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 160, 70, -1));
jLabel1.setText("X Dimensions");
PanelControls.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(39, 124, -1, -1));
jLabel2.setText("Z Dimensions");
PanelControls.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 164, -1, -1));
TextMessageOutput.setEditable(false);
TextMessageOutput.setColumns(10);
TextMessageOutput.setFont(new java.awt.Font("Dialog", 2, 14)); // NOI18N
TextMessageOutput.setRows(2);
TextMessageOutput.setAutoscrolls(false);
TextMessageOutput.setFocusable(false);
TextMessageOutput.setRequestFocusEnabled(false);
TextMessageOutput.setVerifyInputWhenFocusTarget(false);
jScrollPane1.setViewportView(TextMessageOutput);
PanelControls.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(6, 6, 251, 80));
jLabel3.setText("Grass Level");
PanelControls.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(49, 254, -1, -1));
jLabel4.setText("Hill Frequency (0-100)");
PanelControls.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(23, 394, -1, -1));
jLabel5.setText("Hill Width (0-40)");
PanelControls.add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(52, 474, -1, -1));
TextInputHillHeight.setText("0.75");
TextInputHillHeight.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TextInputHillHeightActionPerformed(evt);
}
});
PanelControls.add(TextInputHillHeight, new org.netbeans.lib.awtextra.AbsoluteConstraints(146, 430, 70, -1));
TextInputGrass.setText("35");
PanelControls.add(TextInputGrass, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 250, 70, -1));
TextInputHillFreq.setText("93");
PanelControls.add(TextInputHillFreq, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 390, 70, -1));
jLabel6.setText("Terrain Flatness (0-1)");
PanelControls.add(jLabel6, new org.netbeans.lib.awtextra.AbsoluteConstraints(26, 294, -1, -1));
TextInputFlat.setText("0.85");
TextInputFlat.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TextInputFlatActionPerformed(evt);
}
});
PanelControls.add(TextInputFlat, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 290, 70, -1));
jLabel7.setText("Hill Height (0-1)");
PanelControls.add(jLabel7, new org.netbeans.lib.awtextra.AbsoluteConstraints(47, 434, -1, -1));
TextInputHillWidth.setText("23");
PanelControls.add(TextInputHillWidth, new org.netbeans.lib.awtextra.AbsoluteConstraints(153, 470, 70, -1));
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap()
.addComponent(PanelControls, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(PanelCanvasContainer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(PanelCanvasContainer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(PanelControls, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void ButtonGenerateActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonGenerateActionPerformed
try {
// grab all the inputs
int inputX = Integer.parseInt(TextInputX.getText());
int inputZ = Integer.parseInt(TextInputZ.getText());
int grassParam = Integer.parseInt(TextInputGrass.getText());
double flatParam = Double.parseDouble(TextInputFlat.getText());
int hillFreqParam = Integer.parseInt(TextInputHillFreq.getText());
double hillHeightParam = Double.parseDouble(TextInputHillHeight.getText());
int hillWidthParam = Integer.parseInt(TextInputHillWidth.getText());
if (TerrainGenerator.parameterCheck(inputX, inputZ, grassParam, flatParam, hillFreqParam, hillHeightParam, hillWidthParam)) { // check if inputs are within parameters
// generate the terrain
TerrainGenerator.generateTerrain(inputX, inputZ, grassParam, flatParam, hillFreqParam, hillHeightParam, hillWidthParam);
// draw terrain
int panelHeight = PanelCanvas.getHeight();
int panelWidth = PanelCanvas.getWidth();
Graphics g = PanelCanvas.getGraphics();
Drawer.drawTerrain(g, panelHeight, panelWidth, TerrainGenerator.blocksArray(), inputX, inputZ);
TextMessageOutput.setText("Terrain Drawn!");
} else {
TextMessageOutput.setText("Something wrong with inputs!");
}
} catch (Exception e) {
System.out.println(e);
TextMessageOutput.setText("Something wrong with inputs!\n" + "(" + e + ")");
}
}//GEN-LAST:event_ButtonGenerateActionPerformed
private void TextInputFlatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextInputFlatActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_TextInputFlatActionPerformed
private void TextInputHillHeightActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextInputHillHeightActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_TextInputHillHeightActionPerformed
private void TextInputXActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextInputXActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_TextInputXActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainFrame().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton ButtonGenerate;
private javax.swing.JPanel PanelCanvas;
private javax.swing.JPanel PanelCanvasContainer;
private javax.swing.JPanel PanelControls;
private javax.swing.JTextField TextInputFlat;
private javax.swing.JTextField TextInputGrass;
private javax.swing.JTextField TextInputHillFreq;
private javax.swing.JTextField TextInputHillHeight;
private javax.swing.JTextField TextInputHillWidth;
private javax.swing.JTextField TextInputX;
private javax.swing.JTextField TextInputZ;
private javax.swing.JTextArea TextMessageOutput;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
| [
"wgesh8@gmail.com"
] | wgesh8@gmail.com |
d05f934f1c8c4a8c806f718d671bac3032131060 | 4231891474ed5b26dc3b728dabc3ed14196a5b0e | /HX2-Persistence/src/main/java/com/hx/persistence/ddg/impl/SaveOrUpdateAllMethodInterceptor.java | 1b0bab947b6b987e548731b19363a16d979210c8 | [] | no_license | luisollero/HX | fc1a054849e2cfd712cb31260b09310aa9cab487 | 0d39afbd0759b2064495e88f5a91cf60e6ce5492 | refs/heads/master | 2016-09-07T18:29:01.018678 | 2012-08-15T16:30:30 | 2012-08-15T16:30:30 | 3,662,775 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 665 | java | package com.hx.persistence.ddg.impl;
import java.lang.reflect.Method;
import java.util.Collection;
import net.sf.cglib.proxy.MethodProxy;
import com.hx.persistence.tx.TransactionManager;
public class SaveOrUpdateAllMethodInterceptor extends TxMethodInterceptor {
public SaveOrUpdateAllMethodInterceptor(
TransactionManager transactionManager) {
super(transactionManager);
}
public Object intercept(Object object, Method method, Object[] args,
MethodProxy methodProxy) throws Throwable {
Collection<?> collection = (Collection<?>) args[0];
for (Object item : collection) {
this.getCurrentSession().saveOrUpdate(item);
}
return null;
}
} | [
"luisollero@gmail.com"
] | luisollero@gmail.com |
d76425300cdb51926458cbfced801f52496d3e7c | 1d928c3f90d4a0a9a3919a804597aa0a4aab19a3 | /java/neo4j/2019/12/DatabaseLogProvider.java | f83ca68322df6f303e32e41da09248e916880525 | [] | 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 | 1,729 | java | /*
* Copyright (c) 2002-2019 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.logging.internal;
import org.neo4j.logging.AbstractLogProvider;
import org.neo4j.logging.LogProvider;
import org.neo4j.logging.NullLogProvider;
public class DatabaseLogProvider extends AbstractLogProvider<DatabaseLog>
{
private final DatabaseLogContext logContext;
private final LogProvider delegate;
public DatabaseLogProvider( DatabaseLogContext logContext, LogProvider delegate )
{
this.logContext = logContext;
this.delegate = delegate;
}
public static DatabaseLogProvider nullDatabaseLogProvider()
{
return new DatabaseLogProvider( null, NullLogProvider.getInstance() );
}
@Override
protected DatabaseLog buildLog( Class<?> loggingClass )
{
return new DatabaseLog( logContext, delegate.getLog( loggingClass ) );
}
@Override
protected DatabaseLog buildLog( String name )
{
return new DatabaseLog( logContext, delegate.getLog( name ) );
}
}
| [
"rodrigosoaresilva@gmail.com"
] | rodrigosoaresilva@gmail.com |
ce30d9a26e82781cf065569b9e06d0ec7e0c0c46 | becf805f7a2c23b00c488885fefda1c5e95b13a2 | /app/src/main/java/yincheng/androidinterviwepoint/ui/dialogfragment/BaseDialogFragment.java | 64bad990d7414132bfd0670a239253bcb4408b68 | [] | no_license | luoyisen/AndroidInterviwePoint | ddd369e7b563bf46d141d2d7bd7b6c1b0d1efb02 | 53a8456594069b6d4effa5f5f7db24552c63efd3 | refs/heads/master | 2021-04-12T11:19:20.099244 | 2018-04-01T14:37:41 | 2018-04-01T14:37:41 | 126,752,089 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,156 | java | package yincheng.androidinterviwepoint.ui.dialogfragment;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* Mail : luoyincheng@gmail.com
* Date : 2018:04:01 21:47
* Github : yincheng.luo
*/
public abstract class BaseDialogFragment extends DialogFragment {
Unbinder unbinder;
/**
* onCreateView() -> onCreate() -> onCreateDialog()
*/
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(getLayoutId(), container, false);
unbinder = ButterKnife.bind(this, view);
return view;
}
public abstract int getLayoutId();
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
return super.onCreateDialog(savedInstanceState);
}
@Override
public void onStart() {
final Window window = getDialog().getWindow();
WindowManager.LayoutParams layoutParams = window.getAttributes();
layoutParams.width = (int) (getContext().getResources().getDisplayMetrics().widthPixels * 0.875);
layoutParams.height = (int) (layoutParams.width * 1.78);
window.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#00ffffff")));
window.setAttributes(layoutParams);
super.onStart();
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
@Override
public void onDestroy() {
super.onDestroy();
if (unbinder != null)
unbinder.unbind();
}
}
| [
"yixiong.luo@brightcells.com"
] | yixiong.luo@brightcells.com |
9aaf58181e7d635e8a3716221394ca3774c85fb4 | a3b6ce6e9e77fd432c2c54d722b37e6134ef857c | /app/src/main/java/com/example/birthdaycard/MainActivity.java | 495d7feb115ca811a499e3c4747a562b2bb632b9 | [] | no_license | iamsoumik18/Birthday-Card-App | 27a27c41de88750659bd492f3d054e86cf76733a | 9b8a7f4c556392448ba39df65fb9a5581cd9ca41 | refs/heads/master | 2023-01-04T07:49:33.239394 | 2020-11-03T06:35:15 | 2020-11-03T06:35:15 | 294,725,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.example.birthdaycard;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void createCard(View view) {
TextView t = (TextView) findViewById(R.id.nameInput);
String n = t.getEditableText().toString();
Intent intent = new Intent(this, BirthdayCardActivity.class);
intent.putExtra("name", n);
startActivity(intent);
}
} | [
"iamsoumik18@gmail.com"
] | iamsoumik18@gmail.com |
cfe38329487928f6cf93ccd3002a5b4efe792501 | 0f2609e764d40300f001292d5071e6b2571979f2 | /zxkj-modules/zxkj-platform/src/main/java/com/dzf/zxkj/platform/service/zncs/IVATSaleInvoiceService.java | 67b825e14275b469bfbf6f90559bcd0e12deb7bb | [] | no_license | zhoutiancheng77/dzfui | 6c46b5c120e295417b821dfcb3b61e2f1662e803 | 8b8fdac31cc03f94183949665251f172338ae7ee | refs/heads/master | 2022-12-25T02:15:35.292638 | 2020-07-09T08:36:34 | 2020-07-09T08:36:34 | 303,602,589 | 3 | 4 | null | null | null | null | UTF-8 | Java | false | false | 7,129 | java | package com.dzf.zxkj.platform.service.zncs;
import com.dzf.zxkj.base.exception.DZFWarpException;
import com.dzf.zxkj.common.entity.Grid;
import com.dzf.zxkj.common.lang.DZFBoolean;
import com.dzf.zxkj.platform.model.bdset.YntCpaccountVO;
import com.dzf.zxkj.platform.model.glic.InventoryAliasVO;
import com.dzf.zxkj.platform.model.glic.InventorySetVO;
import com.dzf.zxkj.platform.model.icset.IntradeHVO;
import com.dzf.zxkj.platform.model.image.DcModelHVO;
import com.dzf.zxkj.platform.model.pjgl.*;
import com.dzf.zxkj.platform.model.pzgl.TzpzHVO;
import com.dzf.zxkj.platform.model.sys.CorpVO;
import com.dzf.zxkj.platform.model.tax.TaxitemVO;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.util.List;
import java.util.Map;
public interface IVATSaleInvoiceService {
/**
* 查询
* @param paramvo
* @param sort
* @param order
* @return
* @throws DZFWarpException
*/
public List<VATSaleInvoiceVO> quyerByPkcorp(InvoiceParamVO paramvo, String sort, String order) throws DZFWarpException;
public VATSaleInvoiceVO queryByID(String pk) throws DZFWarpException;
/**
* 更新操作
*
* @throws DZFWarpException
*/
// public void updateVOArr(DZFBoolean isAddNew, String pk_corp, String cuserid, String sort, String order, List<VATSaleInvoiceVO> list) throws DZFWarpException;
public VATSaleInvoiceVO[] updateVOArr(String pk_corp, Map<String, VATSaleInvoiceVO[]> map) throws DZFWarpException;
/**
* 删除
* @param vo
* @param pk_corp
* @throws DZFWarpException
*/
void delete(VATSaleInvoiceVO vo, String pk_corp) throws DZFWarpException;
/**
* 导入
* @param file
* @param filename
* @param pk_corp
* @param fileType
* @param userid
* @throws DZFWarpException
*/
public void saveImp(MultipartFile file, String filename, VATSaleInvoiceVO paramvo, String pk_corp, String fileType, String userid, StringBuffer msg) throws DZFWarpException;
/**
* 生成凭证
* @throws DZFWarpException
*/
public void createPZ(VATSaleInvoiceVO vo, String pk_corp, String userid, Map<String, DcModelHVO> map, VatInvoiceSetVO setvo, DZFBoolean lwflag, boolean accway, boolean isT) throws DZFWarpException;
// public Map<String, YntCpaccountVO> construcTemKm(CorpVO corpvo) throws DZFWarpException;
public List<VATSaleInvoiceVO> constructVatSale(VATSaleInvoiceVO[] vos, String pk_corp) throws DZFWarpException;
/**
* 合并生单
* @param list
* @param pk_corp
* @param userid
* @param
* @param isT
* @throws DZFWarpException
*/
public void saveCombinePZ(List<VATSaleInvoiceVO> list, String pk_corp, String userid, Map<String, DcModelHVO> dcmap, DZFBoolean lwflag, VatInvoiceSetVO setvo, boolean accway, boolean isT) throws DZFWarpException;
public List<String> getBusiTypes(String pk_corp) throws DZFWarpException;
/**
* 设置业务类型
* @param vos
* @param busiid
* @param businame
* @param selvalue
* @param userid
* @param pk_corp
* @return
* @throws DZFWarpException
*/
public String saveBusiType(VATSaleInvoiceVO[] vos, String busiid, String businame, String selvalue, String userid, String pk_corp) throws DZFWarpException;
public CorpVO chooseTicketWay(String pk_corp) throws DZFWarpException;
/**
* 设置入账期间
* @param vos
* @param pk_corp
* @param period
* @return
* @throws DZFWarpException
*/
public String saveBusiPeriod(VATSaleInvoiceVO[] vos, String pk_corp, String period) throws DZFWarpException;
/**
* 构造凭证vo
* @param vos
* @param pk_corp
* @return
* @throws DZFWarpException
*/
public TzpzHVO getTzpzHVOByID(VATSaleInvoiceVO[] vos, String pk_corp, String userid, VatInvoiceSetVO setvo, boolean accway) throws DZFWarpException;
/**
* 合并生单前校验
* @param vos
* @throws DZFWarpException
*/
public void checkBeforeCombine(VATSaleInvoiceVO[] vos) throws DZFWarpException;
public List<String> getCustNames(String pk_corp, VATSaleInvoiceVO[] vos) throws DZFWarpException;
public Map<String, VATSaleInvoiceVO> saveCft(String pk_corp, String userid, String ccrecode, String fptqm, VATSaleInvoiceVO paramvo, StringBuffer msg) throws DZFWarpException;
public Map<String, VATSaleInvoiceVO> saveKp(String pk_corp, String userid, VATSaleInvoiceVO paramvo, TicketNssbhVO nssbvo) throws DZFWarpException;
public void scanMatchBusiName(VATSaleInvoiceVO salevo, Map<String, DcModelHVO> dcmap) throws DZFWarpException;
/**
* 根据pks查询vo记录
* @param pks
* @param pk_corp
* @return
* @throws DZFWarpException
*/
public List<VATSaleInvoiceVO> queryByPks(String[] pks, String pk_corp) throws DZFWarpException;
public List<TaxitemVO> queryTaxItems(String pk_corp) throws DZFWarpException;
/*
* 生成出库单
*/
public IntradeHVO createIC(VATSaleInvoiceVO vo, YntCpaccountVO[] accounts, CorpVO corpvo, String userid) throws DZFWarpException;
public void saveGL(IntradeHVO hvo, String pk_corp, String userid) throws DZFWarpException;
public void saveTotalGL(IntradeHVO[] vos, String pk_corp, String userid) throws DZFWarpException;
/**
* 删除凭证号
* @param pk_corp
* @param pk_tzpz_h
* @throws DZFWarpException
*/
public void deletePZH(String pk_corp, String pk_tzpz_h) throws DZFWarpException;
/**
* 更新凭证号
* @param headvo
* @throws DZFWarpException
*/
public void updatePZH(TzpzHVO headvo) throws DZFWarpException;
/**
* 更新单据出库状态
* @param pk_vatsaleinvoice
* @param pk_corp
* @param pk_ictrade_h
* @throws DZFWarpException
*/
public void updateICStatus(String pk_vatsaleinvoice, String pk_corp, String pk_ictrade_h) throws DZFWarpException;
/**
* 根据公司查询是否认证通过
* @param corpvo
* @return
* @throws DZFWarpException
*/
public TicketNssbhVO getNssbvo(CorpVO corpvo) throws DZFWarpException;
public List<VatGoosInventoryRelationVO> getGoodsInvenRela(Map<String, DcModelHVO> dcmap, List<VATSaleInvoiceVO> saleList, String pk_corp) throws DZFWarpException;
public void saveGoodsRela(Map<String, List<VatGoosInventoryRelationVO>> newRelMap, String pk_corp, String userid) throws DZFWarpException;
public List<InventoryAliasVO> matchInventoryData(String pk_corp, VATSaleInvoiceVO[] vos, InventorySetVO invsetvo)throws DZFWarpException;
public InventoryAliasVO[] saveInventoryData(String pk_corp, InventoryAliasVO[] vos, List<Grid> logList)throws DZFWarpException;
/**
* 生成凭证
* @throws DZFWarpException
*/
public void createPZ(VATSaleInvoiceVO vo, String pk_corp, String userid, boolean accway, boolean isT, VatInvoiceSetVO setvo, InventorySetVO invsetvo, String jsfs) throws DZFWarpException;
/**
* 合并生单
* @param
* @param pk_corp
* @param userid
* @param
* @param isT
* @throws DZFWarpException
*/
public void saveCombinePZ(List<VATSaleInvoiceVO> list, String pk_corp, String userid, VatInvoiceSetVO setvo, boolean accway, boolean isT, InventorySetVO invsetvo, String jsfs) throws DZFWarpException;
public List<VatBusinessTypeVO> getBusiType(String pk_corp) throws DZFWarpException;
}
| [
"admin@DESKTOP-BDERPMU"
] | admin@DESKTOP-BDERPMU |
afa1f5d013dce2461ad18822c96da7f91f9c984e | 9254e7279570ac8ef687c416a79bb472146e9b35 | /imm-20170906/src/main/java/com/aliyun/imm20170906/models/GetOfficeEditURLResponse.java | 4b809157892ff8676292076d39764519b212d343 | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,070 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.imm20170906.models;
import com.aliyun.tea.*;
public class GetOfficeEditURLResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("body")
@Validation(required = true)
public GetOfficeEditURLResponseBody body;
public static GetOfficeEditURLResponse build(java.util.Map<String, ?> map) throws Exception {
GetOfficeEditURLResponse self = new GetOfficeEditURLResponse();
return TeaModel.build(map, self);
}
public GetOfficeEditURLResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public GetOfficeEditURLResponse setBody(GetOfficeEditURLResponseBody body) {
this.body = body;
return this;
}
public GetOfficeEditURLResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
8bf039cab14d309fe9e9b627468ec357a548c804 | dcc25569e137f6a915c50fba85861f204544dc87 | /app/src/main/java/com/thekrakensolutions/gestioncobranza/Agregar_pago.java | e68f14ed6fea865d0973ca783d59927c54c42bba | [] | no_license | aguitech/TheKraken | 1a5bc4e24532984ec957c75daf49e062d323a85e | c0068aec8ffcc9838d7eca77e1d2f848a28b1c54 | refs/heads/master | 2021-01-21T16:10:38.503314 | 2017-05-26T14:58:32 | 2017-05-26T14:58:32 | 91,878,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,857 | java | package com.thekrakensolutions.gestioncobranza;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
/**
* Created by hectoraguilar on 07/03/17.
*/
public class Agregar_pago extends AppCompatActivity {
private String _urlGet;
private String _url;
public static final String idu = "idu";
SharedPreferences sharedpreferences;
public static final String MyPREFERENCES = "MyPrefs";
private int valueID = 0;
public Agregar_pago _activity = this;
RecyclerView lvMascotas;
private String _urlNotificaciones;
String idString;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_agregar_pago);
//String idString;
Bundle extras = getIntent().getExtras();
if(extras == null) {
idString= null;
} else {
idString= extras.getString("idcontrato");
Log.d("id_vet", idString);
}
sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
valueID = sharedpreferences.getInt("idu", 0);
//showMsg("prueba");
//showMsg(Integer.toString(valueID));
/*
lvMascotas = (RecyclerView) findViewById(R.id.lvVeterinarios);
//_urlGet = "http://hyperion.init-code.com/zungu/app/vt_principal.php?id_editar=" + Integer.toString(valueID);
//_urlGet = "http://hyperion.init-code.com/zungu/app/vt_principal.php?id_editar=" + idString;
_urlGet = "http://hyperion.init-code.com/zungu/app/vt_principal.php?id_editar=" + idString + "&idv=" + valueID + "&accion=true";
new Detalle_veterinario.RetrieveFeedTaskGet().execute();
_urlNotificaciones = "http://hyperion.init-code.com/zungu/app/vt_get_numero_notificaciones.php?idv=" + valueID;
new Detalle_veterinario.RetrieveFeedTaskNotificaciones().execute();
*/
//_urlGet = "http://hyperion.init-code.com/zungu/app/vt_principal.php?id_editar=" + idString + "&idv=" + valueID + "&accion=true";
//_urlGet = "http://thekrakensolutions.com/cobradores/android_get_cliente.php?id_editar=" + idString + "&idv=" + valueID + "&accion=true";
_urlGet = "http://thekrakensolutions.com/cobradores/android_get_contrato.php?id_editar=" + idString + "&idv=" + valueID + "&accion=true";
new Agregar_pago.RetrieveFeedTaskGet().execute();
}
class RetrieveFeedTaskGet extends AsyncTask<Void, Void, String> {
private Exception exception;
protected void onPreExecute() {
}
protected String doInBackground(Void... urls) {
try {
Log.i("INFO url: ", _urlGet);
URL url = new URL(_urlGet);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line).append("\n");
}
bufferedReader.close();
return stringBuilder.toString();
} finally {
urlConnection.disconnect();
}
} catch (Exception e) {
Log.e("ERROR", e.getMessage(), e);
return null;
}
}
protected void onPostExecute(String response) {
if (response == null) {
response = "THERE WAS AN ERROR";
} else {
/*
TextView lblNombre = (TextView) findViewById(R.id.lblNombre);
TextView lblDireccion = (TextView) findViewById(R.id.lblDireccion);
ImageView foto = (ImageView) findViewById(R.id.imgFoto);
*/
TextView lblNombreVo = (TextView) findViewById(R.id.txtNombreA);
TextView lblEmailVo = (TextView) findViewById(R.id.txtEmailA);
TextView lblCelVo = (TextView) findViewById(R.id.txtCelA);
//TextView lblCedVo = (TextView) findViewById(R.id.txtCedA);
TextView txtDireccion = (TextView) findViewById(R.id.txtDireccion);
final ImageView fotoVeterinario = (ImageView) findViewById(R.id.imgVeterinario);
try {
JSONObject object = (JSONObject) new JSONTokener(response).nextValue();
String _nombre_vo = object.getString("numero_cliente") + " - " + object.getString("nombre") + " " + object.getString("apaterno") + " " + object.getString("amaterno");
//String _telefono_vo = object.getString("telefono_casa");
String _cedula_vo = object.getString("numero_cliente");
String _email_vo = object.getString("fecha_nacimiento");
String _imagen_vo = object.getString("imagen");
//String txtDireccion_ = object.getString("calle") + " " + object.getString("numero_exterior") + " " + object.getString("numero_interior") + " , Colonia " + object.getString("colonia") + " , Delegación/Municipio " + object.getString("delegacion_municipio") + " , Estado " + object.getString("estado") + " , C.P. " + object.getString("codigo_postal") + " , País " + object.getString("pais") + " , entre calle " + object.getString("entre_calle") + " y calle " + object.getString("y_calle") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno");
/*
{"id_cliente":"1","cliente":"","numero_cliente":"0","fecha_nacimiento":"0000-00-00","sexo":"mkl","imagen":"",":"klmkl","":"mkl","":"mklm","":"klm","":"klmkl","telefono_casa":"","telefono_celular":"","telefono_oficina":"","":"","":"","ocupacion":"","direccion_trabajo":"","nombre_pareja":"","ocupacion_pareja":"","telefono_pareja":"","complexion":"","estatura":"","tez":"","edad_rango":"","cabello":"","color_cabello":"","tipo_identificacion":"","numero_identificacion":"","nombre_referencia_1":"","direccion_referencia_1":"","telefono_referencia_1":"","parentesco_referencia_1":"","anios_conocerce_referencia_1":"","nombre_referencia_2":"","direccion_referencia_2":"","telefono_referencia_2":"","parentesco_referencia_2":"","anios_conocerce_referencia_2":"","maps_localizacion":"","imagen_plano_localizacion":"","fachada_casa":"","a_lado_casa":"","enfrente_casa":"","autorizacion_contratos":"","id_creador":"0","id_empresa":"0"}
{"id_cliente":"1","cliente":"","numero_cliente":"0","nombre":"mklmklmklm","apaterno":"klmkl","amaterno":"mklm","fecha_nacimiento":"0000-00-00","sexo":"mkl","imagen":"","calle":"mklm","numero_exterior":"klm","numero_interior":"klmkl","colonia":"mkl","delegacion_municipio":"mkl","estado":"mklm","codigo_postal":"klm","pais":"klmkl","telefono_casa":"","telefono_celular":"","telefono_oficina":"","entre_calle":"","y_calle":"","ocupacion":"","direccion_trabajo":"","nombre_pareja":"","ocupacion_pareja":"","telefono_pareja":"","complexion":"","estatura":"","tez":"","edad_rango":"","cabello":"","color_cabello":"","tipo_identificacion":"","numero_identificacion":"","nombre_referencia_1":"","direccion_referencia_1":"","telefono_referencia_1":"","parentesco_referencia_1":"","anios_conocerce_referencia_1":"","nombre_referencia_2":"","direccion_referencia_2":"","telefono_referencia_2":"","parentesco_referencia_2":"","anios_conocerce_referencia_2":"","maps_localizacion":"","imagen_plano_localizacion":"","fachada_casa":"","a_lado_casa":"","enfrente_casa":"","autorizacion_contratos":"","id_creador":"0","id_empresa":"0"}
String _telefono_vo = object.getString("telefono_veterinario");
String _cedula_vo = object.getString("cedula_veterinario");
String _email_vo = object.getString("email_veterinario");
String _imagen_vo = object.getString("imagen_veterinario");
*/
if(_nombre_vo.length() > 3)
lblNombreVo.setText(_nombre_vo);
if(_email_vo.length() > 3)
lblEmailVo.setText(_email_vo);
/*
if(_telefono_vo.length() > 3)
lblCelVo.setText(_telefono_vo);
*/
/*
if(_cedula_vo.length() > 3)
lblCedVo.setText(_cedula_vo);
*/
//String txtDireccion_ = object.getString("calle") + " " + object.getString("numero_exterior") + " " + object.getString("numero_interior") + " , Colonia " + object.getString("colonia") + " , Delegación/Municipio " + object.getString("delegacion_municipio") + " , Estado " + object.getString("estado") + " , C.P. " + object.getString("codigo_postal") + " , País " + object.getString("pais") + " , entre calle " + object.getString("entre_calle") + " y calle " + object.getString("y_calle");
String txtDireccion_ = object.getString("calle") + " " + object.getString("numero_exterior") + " " + object.getString("numero_interior") + " , Colonia " + object.getString("colonia") + " , Delegación/Municipio " + object.getString("delegacion_municipio") + " , Estado " + object.getString("estado") + " , C.P. " + object.getString("codigo_postal") + " , País " + object.getString("pais");
if(txtDireccion_.length() > 3)
txtDireccion.setText(txtDireccion_);
if(_imagen_vo.length() > 3){
String _urlFoto = "http://thekrakensolutions.com/administrativos/images/clientes/" + _imagen_vo;
//Picasso.with(fotoVeterinario.getContext()).load(_urlFoto).fit().centerCrop().into(fotoVeterinario);
Picasso.with(fotoVeterinario.getContext()).load(_urlFoto)
.into(fotoVeterinario, new Callback() {
@Override
public void onSuccess() {
Bitmap imageBitmap = ((BitmapDrawable) fotoVeterinario.getDrawable()).getBitmap();
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(fotoVeterinario.getContext().getResources(), imageBitmap);
circularBitmapDrawable.setCircular(true);
fotoVeterinario.setImageDrawable(circularBitmapDrawable);
}
@Override
public void onError() {
}
});
}
/*
if(_imagen_vo.length() > 3){
String _urlFoto = "http://hyperion.init-code.com/zungu/imagen_establecimiento/" + _imagen_vo;
//Picasso.with(fotoVeterinario.getContext()).load(_urlFoto).fit().centerCrop().into(fotoVeterinario);
Picasso.with(fotoVeterinario.getContext()).load(_urlFoto)
.into(fotoVeterinario, new Callback() {
@Override
public void onSuccess() {
Bitmap imageBitmap = ((BitmapDrawable) fotoVeterinario.getDrawable()).getBitmap();
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(fotoVeterinario.getContext().getResources(), imageBitmap);
circularBitmapDrawable.setCircular(true);
fotoVeterinario.setImageDrawable(circularBitmapDrawable);
}
@Override
public void onError() {
}
});
}
*/
} catch (JSONException e) {
e.printStackTrace();
}
}
Log.i("INFO", response);
}
}
class RetrieveFeedTask extends AsyncTask<Void, Void, String> {
private Exception exception;
protected void onPreExecute() {
}
protected String doInBackground(Void... urls) {
try {
Log.i("INFO url: ", _url);
URL url = new URL(_url);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line).append("\n");
}
bufferedReader.close();
return stringBuilder.toString();
} finally {
urlConnection.disconnect();
}
} catch (Exception e) {
Log.e("ERROR", e.getMessage(), e);
return null;
}
}
protected void onPostExecute(String response) {
if (response == null) {
response = "THERE WAS AN ERROR";
} else {
/*
TextView lblNombreVo = (TextView) findViewById(R.id.txtNombreA);
TextView lblEmailVo = (TextView) findViewById(R.id.txtEmailA);
TextView lblCelVo = (TextView) findViewById(R.id.txtCelA);
//TextView lblCedVo = (TextView) findViewById(R.id.txtCedA);
TextView txtDireccion = (TextView) findViewById(R.id.txtDireccion);
final ImageView fotoVeterinario = (ImageView) findViewById(R.id.imgVeterinario);
*/
try {
JSONObject object = (JSONObject) new JSONTokener(response).nextValue();
/*
Intent i = new Intent(Agregar_pago.this, Confirmar_pago.class);
i.putExtra("idcliente", idString);
startActivity(i);
Intent i = new Intent(Agregar_pago.this, Confirmar_pago.class);
//i.putExtra("idcliente", _listaIdVeterinarios.get(i));
i.putExtra("idcliente", idString);
startActivity(i);
String _nombre_vo = object.getString("numero_cliente") + " - " + object.getString("nombre") + " " + object.getString("apaterno") + " " + object.getString("amaterno");
String _telefono_vo = object.getString("telefono_casa");
String _cedula_vo = object.getString("numero_cliente");
String _email_vo = object.getString("fecha_nacimiento");
String _imagen_vo = object.getString("sexo");
//String txtDireccion_ = object.getString("calle") + " " + object.getString("numero_exterior") + " " + object.getString("numero_interior") + " , Colonia " + object.getString("colonia") + " , Delegación/Municipio " + object.getString("delegacion_municipio") + " , Estado " + object.getString("estado") + " , C.P. " + object.getString("codigo_postal") + " , País " + object.getString("pais") + " , entre calle " + object.getString("entre_calle") + " y calle " + object.getString("y_calle") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno") + " " + object.getString("amaterno");
String txtDireccion_ = object.getString("calle") + " " + object.getString("numero_exterior") + " " + object.getString("numero_interior") + " , Colonia " + object.getString("colonia") + " , Delegación/Municipio " + object.getString("delegacion_municipio") + " , Estado " + object.getString("estado") + " , C.P. " + object.getString("codigo_postal") + " , País " + object.getString("pais") + " , entre calle " + object.getString("entre_calle") + " y calle " + object.getString("y_calle");
*/
/*
if(_nombre_vo.length() > 3)
lblNombreVo.setText(_nombre_vo);
if(_email_vo.length() > 3)
lblEmailVo.setText(_email_vo);
if(_telefono_vo.length() > 3)
lblCelVo.setText(_telefono_vo);
if(txtDireccion_.length() > 3)
txtDireccion.setText(txtDireccion_);
*/
} catch (JSONException e) {
e.printStackTrace();
}
}
Log.i("INFO", response);
}
}
/*
public void editarEstablecimiento(View view) {
Intent i = new Intent(Detalle_veterinario.this, Editar_establecimiento.class);
startActivity(i);
}
*/
public void goBack(View v){
//Intent i = new Intent(Agregar_pago.this, Lista_clientes.class);
Intent i = new Intent(Agregar_pago.this, Lista_contratos.class);
startActivity(i);
}
public void agregarPago(View v){
EditText cantidadPago = (EditText) findViewById(R.id.cantidadPago);
_url = "http://thekrakensolutions.com/cobradores/android_agregar_pago.php?id_editar=" + idString + "&id=" + valueID + "&cantidad_pago=" + URLEncoder.encode(cantidadPago.getText().toString()) + "&accion=true";
//_url = "http://hyperion.init-code.com/zungu/app/vt_agregar_cita.php?id_usuario=" + Integer.toString(selCliente) + "&idvh=" + Integer.toString(selVeterinario) + "&id_servicio=" + Integer.toString(selServicio) + "&motivo="+ URLEncoder.encode(txtMotivoCita.getText().toString()) + "&fecha=" + URLEncoder.encode(btnMesDia.getText().toString()) + "&hora=" + URLEncoder.encode(btnHora.getText().toString()) + "&id_veterinario=" + String.valueOf(valueID) + "&id_mascota=" + Integer.toString(selMascota);
Log.d("url", _url.toString());
new Agregar_pago.RetrieveFeedTask().execute();
Intent i = new Intent(Agregar_pago.this, Confirmar_pago.class);
i.putExtra("idcontrato", idString);
startActivity(i);
/*
Intent i = new Intent(Agregar_pago.this, Agregar_pago.class);
//i.putExtra("idcliente", _listaIdVeterinarios.get(i));
i.putExtra("idcliente", idString);
startActivity(i);
*/
}
public void goMenu(View v){
Intent i = new Intent(Agregar_pago.this, Menu.class);
startActivity(i);
}
private void showMsg(CharSequence text){
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
/*
public void goMenu(View v){
Intent i = new Intent(Detalle_veterinario.this, Menu.class);
startActivity(i);
}
public void goBack(View v){
Intent i = new Intent(Detalle_veterinario.this, Principal.class);
startActivity(i);
}
public void goNotificaciones(View v){
Intent i = new Intent(Detalle_veterinario.this, Notificaciones.class);
startActivity(i);
}
public void goAgregar(View v){
Intent i = new Intent(Detalle_veterinario.this, Agregar_veterinarios.class);
startActivity(i);
}
public void goClientes(View v){
Intent i = new Intent(Detalle_veterinario.this, Clientes.class);
startActivity(i);
}
public void goMascotas(View v){
Intent i = new Intent(Detalle_veterinario.this, Mascotas.class);
startActivity(i);
}
public void goServicio(View v){
Intent i = new Intent(Detalle_veterinario.this, Servicio.class);
startActivity(i);
}
public void goTienda(View v){
Intent i = new Intent(Detalle_veterinario.this, Tienda.class);
startActivity(i);
}
public void goEditarPerfil(View v){
Intent i = new Intent(Detalle_veterinario.this, Editar_perfil.class);
startActivity(i);
}
class RetrieveFeedTaskGet extends AsyncTask<Void, Void, String> {
private Exception exception;
protected void onPreExecute() {
}
protected String doInBackground(Void... urls) {
try {
Log.i("INFO url: ", _urlGet);
URL url = new URL(_urlGet);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line).append("\n");
}
bufferedReader.close();
return stringBuilder.toString();
} finally {
urlConnection.disconnect();
}
} catch (Exception e) {
Log.e("ERROR", e.getMessage(), e);
return null;
}
}
protected void onPostExecute(String response) {
if (response == null) {
response = "THERE WAS AN ERROR";
} else {
TextView lblNombre = (TextView) findViewById(R.id.lblNombre);
TextView lblDireccion = (TextView) findViewById(R.id.lblDireccion);
ImageView foto = (ImageView) findViewById(R.id.imgFoto);
TextView lblNombreVo = (TextView) findViewById(R.id.txtNombreA);
TextView lblEmailVo = (TextView) findViewById(R.id.txtEmailA);
TextView lblCelVo = (TextView) findViewById(R.id.txtCelA);
TextView lblCedVo = (TextView) findViewById(R.id.txtCedA);
final ImageView fotoVeterinario = (ImageView) findViewById(R.id.imgVeterinario);
try {
JSONObject object = (JSONObject) new JSONTokener(response).nextValue();
String _nombre_vo = object.getString("nombre_veterinario");
String _telefono_vo = object.getString("telefono_veterinario");
String _cedula_vo = object.getString("cedula_veterinario");
String _email_vo = object.getString("email_veterinario");
String _imagen_vo = object.getString("imagen_veterinario");
if(_nombre_vo.length() > 3)
lblNombreVo.setText(_nombre_vo);
if(_email_vo.length() > 3)
lblEmailVo.setText(_email_vo);
if(_telefono_vo.length() > 3)
lblCelVo.setText(_telefono_vo);
if(_cedula_vo.length() > 3)
lblCedVo.setText(_cedula_vo);
if(_imagen_vo.length() > 3){
String _urlFoto = "http://hyperion.init-code.com/zungu/imagen_establecimiento/" + _imagen_vo;
//Picasso.with(fotoVeterinario.getContext()).load(_urlFoto).fit().centerCrop().into(fotoVeterinario);
Picasso.with(fotoVeterinario.getContext()).load(_urlFoto)
.into(fotoVeterinario, new Callback() {
@Override
public void onSuccess() {
Bitmap imageBitmap = ((BitmapDrawable) fotoVeterinario.getDrawable()).getBitmap();
RoundedBitmapDrawable circularBitmapDrawable =
RoundedBitmapDrawableFactory.create(fotoVeterinario.getContext().getResources(), imageBitmap);
circularBitmapDrawable.setCircular(true);
fotoVeterinario.setImageDrawable(circularBitmapDrawable);
}
@Override
public void onError() {
}
});
}
} catch (JSONException e) {
e.printStackTrace();
}
}
Log.i("INFO", response);
}
}
class RetrieveFeedTaskNotificaciones extends AsyncTask<Void, Void, String> {
private Exception exception;
protected void onPreExecute() {
}
protected String doInBackground(Void... urls) {
try {
Log.i("INFO url: ", _urlNotificaciones);
URL url = new URL(_urlNotificaciones);
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
StringBuilder stringBuilder = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line).append("\n");
}
bufferedReader.close();
return stringBuilder.toString();
}
finally{
urlConnection.disconnect();
}
}
catch(Exception e) {
Log.e("ERROR", e.getMessage(), e);
return null;
}
}
protected void onPostExecute(String response) {
if(response == null) {
response = "THERE WAS AN ERROR";
} else {
Context context = getApplicationContext();
int duration = Toast.LENGTH_SHORT;
try {
JSONTokener tokener = new JSONTokener(response);
JSONArray arr = new JSONArray(tokener);
TextView numeroNotificaciones = (TextView) findViewById(R.id.numeroNotificaciones);
for (int i = 0; i < arr.length(); i++) {
JSONObject jsonobject = arr.getJSONObject(i);
//Log.d("nombre",jsonobject.getString("nombre"));
//"":"45","":"9","":"0","fecha":"2016-11-19 15:59:00","":"","acepto":"0","":"","":"1","id_pago":"0","id_veterinaria":"0"},
if(jsonobject.getString("numero_notificaciones").equals("")){
numeroNotificaciones.setVisibility(View.GONE);
}else{
numeroNotificaciones.setVisibility(View.VISIBLE);
numeroNotificaciones.setText(jsonobject.getString("numero_notificaciones"));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
Log.i("INFO", response);
}
}
*/
}
| [
"hectoraguilar.adesis@gmail.com"
] | hectoraguilar.adesis@gmail.com |
21e56194538c82bf4ee90c8673ad292d909f6629 | 047ca419614b1dbdf45838e330f5434f54cfcf0d | /src/main/java/com/mmall/concurrency/example/threadPool/ThreadPoolExample4.java | 56e030ccd59554ebaed37ecd5450a0cfcb8ba800 | [] | no_license | lynn831/concurrency | ab77116047a01b7205b3b17f2f27db56facaf430 | c588002a992c12250b3b852f0464cd6807e8a635 | refs/heads/master | 2020-04-03T11:58:27.669660 | 2018-12-01T10:08:25 | 2018-12-01T10:08:25 | 155,237,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,257 | java | package com.mmall.concurrency.example.threadPool;
import lombok.extern.slf4j.Slf4j;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@Slf4j
public class ThreadPoolExample4 {
public static void main(String[] args) {
ScheduledExecutorService executorService = Executors.newScheduledThreadPool(1);
// executorService.schedule(new Runnable() {
// @Override
// public void run() {
// log.warn("schedule run");
// }
// }, 3, TimeUnit.SECONDS);
//延迟一秒之后,固定每3秒执行一次任务
executorService.scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
log.warn("schedule run");
}
}, 1, 3, TimeUnit.SECONDS);
// executorService.shutdown();
//new Date() 代表从当前时间开始
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
log.warn("timer run");
}
}, new Date(), 5 * 1000);
}
}
| [
"lynn831@yeah.net"
] | lynn831@yeah.net |
07ced01a072a562d7d41d5ef832f8d103917b4ff | 68506ce3175e7d636deae7582ed4e1994cae96bb | /src/main/java/finalmodifier/PiMain.java | 4ba7541bbf2d77f59826c755bd5ff073f67ebf2e | [] | no_license | tlev159/training-solutions | 352e1c7f4bdac23fff83adb9b00c77a785a41f94 | 5044cd6a3fc545f062f474523bcf6abe6e468925 | refs/heads/master | 2023-05-27T03:49:14.134749 | 2021-06-08T18:14:50 | 2021-06-08T18:14:50 | 308,344,419 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package finalmodifier;
public class PiMain {
public static void main(String[] args) {
CylinderCalculator cylinderCalculator = new CylinderCalculator();
CircleCalculator circleCalculator = new CircleCalculator();
System.out.println(cylinderCalculator.calculateVolumme(3, 5));
System.out.println(cylinderCalculator.calculateSurfaceArea(3, 5));
System.out.println(circleCalculator.calculatePerimeter(4));
System.out.println(circleCalculator.calculateArea(4));
System.out.println("A PI értéke: " + circleCalculator.PI);
System.out.println(circleCalculator.calculatePerimeter(10));
}
}
| [
"t.levente1598@gmail.com"
] | t.levente1598@gmail.com |
54bb48e3bfa0b346af1bd516de3062cd3d8b4600 | cf500dd75f8d507eac4faf70c99da7fe809a5400 | /app0526/src/app0526/thread/ex4/Hero.java | 0d25b0a9da449c9d54ab8ed517db2436b8791d5c | [] | no_license | xodud2972/koreait202102_javaworkspace-master | 26cc522568a0526a4e1eb6bbf55c3821dd651ea3 | b4484b3b0f4ad774f00b54593a1728561707e38f | refs/heads/master | 2023-05-15T10:16:51.797300 | 2021-06-13T08:42:35 | 2021-06-13T08:42:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 776 | java | package app0526.thread.ex4;
import java.awt.Graphics;
//주인공을 정의한다!!
public class Hero extends GameObject{
public Hero(GamePanel gamePanel, String path, int x, int y , int width, int height, int velX, int velY) {
//자신을 초기하 하기 전에, 부모의 초기화가 더 시급하다!!!
super(gamePanel, path, x, y, width, height, velX, velY);
}
//물리량 변화
public void tick() {
this.x+=this.velX;
this.y+=this.velY;
}
//변화된 물리량 그래픽으로 표현
public void render(Graphics g) {
//g 는 패널로 부터 넘겨받은 주소값이므로
//이 g로 그림을 그리게 될 경우, 당연히
//그림은 패널에 그려지게 된다!!!
g.drawImage(img, x, y, width, height, this.gamePanel);
}
}
| [
"xodud2972@naver.com"
] | xodud2972@naver.com |
a640e8798009887c0716a239663655db358ddc1d | fedb6e46c292a1049021d4e13449921b624ae7f7 | /src/main/java/games/bevs/core/module/chat/types/FilteredWords.java | 395bbf5682b704805c666e39e02fd07d2c470e24 | [] | no_license | CyberFlameGO/BevsCore | b99957d4f59895bc81bac0515a0b8f78a05d4138 | d9bac09d360b9e67d64b57e98b29190c5456fa4c | refs/heads/master | 2022-06-22T08:19:27.265877 | 2019-09-17T12:42:43 | 2019-09-17T12:42:43 | 233,333,934 | 0 | 0 | null | 2022-05-20T21:51:59 | 2020-01-12T03:43:23 | null | UTF-8 | Java | false | false | 454 | java | package games.bevs.core.module.chat.types;
import java.util.Arrays;
import java.util.HashSet;
import lombok.Getter;
public class FilteredWords
{
@Getter
private HashSet<String> words = new HashSet<>();
public boolean isFiltered(String word)
{
return words.contains(word);
}
public void populate()
{
words.addAll(
Arrays.asList(
new String[]
{
"hypixel",
"mineplex",
}
)
);
}
}
| [
"github@heathlogancampbell.com"
] | github@heathlogancampbell.com |
1b7cc86fbc501c064911cd6260de9d132e2b9891 | 3a23cb97d668a13198964e5cea2aff843ec4bb5d | /src/main/java/Indexer/Index/IndexSearcher.java | 20f201990f873ccea4475d53180d3c8299c81b4b | [] | no_license | alikareemraja/file-system-indexer | acc3cdf6df803388bb3c5c584488bf4059daa8c2 | 89b95c5469969bd9c74807cce0d3a61035ecb5a2 | refs/heads/master | 2021-07-07T15:56:45.810781 | 2019-07-28T22:27:29 | 2019-07-28T22:27:29 | 198,911,397 | 0 | 0 | null | 2020-10-13T14:55:10 | 2019-07-25T22:57:57 | Java | UTF-8 | Java | false | false | 2,600 | java | package Indexer.Index;
import Indexer.Util.Config;
import Indexer.Util.FieldEnum;
import Indexer.Util.Util;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import java.io.IOException;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
/**
* Perform searches on the index
*/
class IndexSearcher {
/**
* Perform searches on the index
* @param queryString query string
* @param Field field to be queried
* @param analyzer analyzer for tokenization
* @return list of matching documents
* @throws IOException if the search fails
* @throws ParseException if the query fails to be parsed
*/
List<Document> searchIndex(String queryString, FieldEnum Field, Analyzer analyzer) throws IOException, ParseException {
Query query = generateQuery(queryString, Field, analyzer);
Directory index_directory = FSDirectory.open(Paths.get(Config.INDEX_LOCATION));
IndexReader indexReader = DirectoryReader.open(index_directory);
org.apache.lucene.search.IndexSearcher searcher = new org.apache.lucene.search.IndexSearcher(indexReader);
TopDocs topDocs = searcher.search(query, 10);
List<Document> documents = new ArrayList<>();
for (ScoreDoc scoreDoc : topDocs.scoreDocs) {
documents.add(searcher.doc(scoreDoc.doc));
}
return documents;
}
/**
* Depending on the Field to be searched, generate a query
* @param queryString query string
* @param Field field to be queried
* @param analyzer analyzer for tokenization
* @return query
* @throws ParseException if the querystring fails to parse
*/
private Query generateQuery(String queryString, FieldEnum Field, Analyzer analyzer) throws ParseException {
if(Field == FieldEnum.CONTENTS){
return new QueryParser(Util.getFieldMapping(Field), analyzer).parse(QueryParser.escape(queryString));
}
else return new TermQuery(new Term(Util.getFieldMapping(Field), queryString));
}
}
| [
"ali.kareem.raja@gmail.com"
] | ali.kareem.raja@gmail.com |
47e6200478117a4657200475cfe1d2dcb9c1b806 | 3f4cfff5af2597bcf00119784bf16322a31f9d70 | /circularprogressbarlib/src/androidTest/java/eu/sk/jakab/circularprogressbarlib/ExampleInstrumentedTest.java | d80821597e48528c956ea8aa909f111c682a03b5 | [] | no_license | jakabtomas/CircularProgressBar | e952a34184c54eb608817575d2d85aad580eca97 | 7d7d955ec50fbdf5c2ff0608b3ae7da875c1be1a | refs/heads/master | 2020-06-18T11:22:24.166273 | 2019-07-10T23:30:02 | 2019-07-10T23:30:02 | 196,285,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package eu.sk.jakab.circularprogressbarlib;
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("eu.sk.jakab.circularprogressbarlib.test", appContext.getPackageName());
}
}
| [
"tomas@accuratek.com"
] | tomas@accuratek.com |
3693aee96dcbc2e08279fbc310155ecc704409e1 | 907e8449a63836059a865c4afca005f5ecb5b697 | /4.JavaCollections/src/com/javarush/task/task33/task3310/strategy/Entry.java | 8c45deba6e71df701f9ca540e7f81d17df946a5d | [] | no_license | KaryNaiKo/JavaRush | 5200442363062e45a98277b26878ad4f481e9d34 | 8e88c4eb9813880d7c0d87826114c97c3e1cff78 | refs/heads/master | 2020-03-22T03:59:58.060413 | 2018-07-02T16:22:00 | 2018-07-02T16:22:00 | 139,466,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,175 | java | package com.javarush.task.task33.task3310.strategy;
import java.io.Serializable;
import java.util.Objects;
/**
* Created by Павлуша on 17.04.2018.
*/
public class Entry implements Serializable{
Long key;
String value;
Entry next;
int hash;
public Entry(int hash, Long key, String value, Entry next) {
this.hash = hash;
this.key = key;
this.value = value;
this.next = next;
}
public Long getKey(){
return key;
}
public String getValue(){
return value;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (o instanceof Entry) {
Entry entry = (Entry) o;
if (Objects.equals(key, entry.getKey()) &&
Objects.equals(value, entry.getValue()))
return true;
}
return false;
}
@Override
public final int hashCode() {
return Objects.hashCode(key) ^ Objects.hashCode(value);
}
@Override
public String toString() {
return key + "=" + value;
}
}
| [
"firamar00@gmail.com"
] | firamar00@gmail.com |
fd61df58ccb4f2c3ffcad5b10aafd39bb5ec9d93 | c15a4330ecb6b9611234345ddd25414ae04906bf | /app/src/main/java/com/thinkzi/album/ui/di/ApplicationModule.java | 066037510caa4647cd605725f1f716cb620dfb46 | [] | no_license | thinkerheart/Album | 6eb65967a792cf3443ddf72213d8f635487d9935 | 0d2e54c084e65db553caa839da9c137d0fc41033 | refs/heads/master | 2022-02-15T07:06:06.417848 | 2019-07-24T09:32:25 | 2019-07-24T09:32:25 | 198,099,113 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,113 | java | package com.thinkzi.album.ui.di;
import android.content.Context;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import com.thinkzi.album.data.executor.JobExecutor;
import com.thinkzi.album.data.repository.PhotoRepository;
import com.thinkzi.album.device.repository.NetworkConnectionRepository;
import com.thinkzi.album.domain.executor.PostExecutionThread;
import com.thinkzi.album.domain.executor.ThreadExecutor;
import com.thinkzi.album.domain.repository.INetworkConnectionRepository;
import com.thinkzi.album.domain.repository.IPhotoRepository;
import com.thinkzi.album.ui.AlbumApplication;
import com.thinkzi.album.ui.UIThread;
/**
* provide Dagger module that provides objects which will live during the application lifecycle.
*/
@Module
public class ApplicationModule {
private final AlbumApplication _albumApplication;
public ApplicationModule(AlbumApplication _albumApplication) {
this._albumApplication = _albumApplication;
}
/**
* provide a application context
*/
@Provides
@Singleton
Context provideApplicationContext() {
return this._albumApplication;
}
/**
* provide a executor thread pool
*/
@Provides
@Singleton
ThreadExecutor provideThreadExecutor(JobExecutor _jobExecutor) {
return _jobExecutor;
}
/**
* provide a thread created to change context execution
*/
@Provides
@Singleton
PostExecutionThread providePostExecutionThread(UIThread _uiThread) {
return _uiThread;
}
/**
* provide a photo repository
*/
@Provides
@Singleton
IPhotoRepository provideIPhotoRepository(PhotoRepository _photoRepository) {
return _photoRepository;
}
/**
* provide a network connection repository
*/
@Provides
@Singleton
INetworkConnectionRepository provideINetworkConnectionRepository(NetworkConnectionRepository _networkConnectionRepository) {
return _networkConnectionRepository;
}
}
| [
"ngoc_thanh.nguyen@icloud.com"
] | ngoc_thanh.nguyen@icloud.com |
675ee3e43a8cc8bc3a40791425d60d78fe8a04bf | 45582c7df6ab09479de8773c3e1488f8a1bbf6b3 | /src/main/java/template/ejemplo/Docente.java | ed5234fd1ba2a9e1f3e01a9aa15c6dc3d353ecfb | [] | no_license | NickyGon/PatronesDise-oResultados_51225 | d8e7ffd9583a65b7f3d96160222287e5ee686ef0 | 639294d39a5489751cf2e6e151b3647d58d4bd12 | refs/heads/main | 2023-06-01T11:22:52.168861 | 2021-06-28T02:30:29 | 2021-06-28T02:30:29 | 368,662,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package template.ejemplo;
public class Docente extends Persona{
public Docente(){}
public void materias(){
System.out.println("Dictando materias");
}
@Override
public void caminar(){
System.out.println("DOCENTE> Caminar");
}
}
| [
"nikita27111@hotmail.com"
] | nikita27111@hotmail.com |
d313a046ec4570d087517ebe9f82961db0d61665 | d603a4587a992eb121f39d3622ca74f010d83d98 | /Chap1_ArraysAndStrings/OneAway.java | d30b98c08ee659cb4e208cc95d76f34683acd4ab | [] | no_license | ferozbaig96/CTCI | 888ff2e700151120d9fa213c42547a1c69430456 | 25a98c30ee1a491aa2ca5541416d2ce014d735ad | refs/heads/master | 2023-02-02T02:45:21.709720 | 2020-12-20T16:12:06 | 2020-12-20T16:12:06 | 291,745,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,478 | java | package Chap1_ArraysAndStrings;
/**
* One Away: There are three types of edits that can be performed on strings: insert a character,
remove a character, or replace a character. Given two strings, write a function to check if they are
one edit (or zero edits) away.
EXAMPLE
pale, pIe -> true
pales. pale -> true
pale. bale -> true
pale. bake -> false
Hints: #23, #97, #130
ab, baa -> false
baa, ab -> false
*/
public class OneAway
{
private static boolean isOneReplaceAway(String str1, String str2)
{
char str1arr[] = str1.toCharArray();
char str2arr[] = str2.toCharArray();
boolean foundOneEdit = false;
for (int i=0; i< str1.length(); i++)
{
if (str1arr[i] == str2arr[i])
continue;
else
{
if (foundOneEdit)
return false;
foundOneEdit = true;
}
}
return true;
}
// str1 is shorter than str2. So insertion is to be done on str1 (or removal on str2)
private static boolean isOneInsertAway(String str1, String str2)
{
int index1=0, index2=0;
char str1arr[] = str1.toCharArray();
char str2arr[] = str2.toCharArray();
while (index1 < str1.length() && index2 < str2.length())
{
if (str1arr[index1] == str2arr[index2])
{
index1++; index2++; continue;
}
else{
if (index1 != index2)
return false;
else
{
index2++; continue;
}
}
}
return true;
}
private static boolean isOneEditAway(String str1, String str2)
{
int str1len = str1.length();
int str2len = str2.length();
if (str1len == str2len)
return isOneReplaceAway(str1,str2);
// str1 is shorter
else if (str1len + 1 == str2len)
return isOneInsertAway(str1,str2);
// str2 is shorter
else if (str1len == str2len + 1)
return isOneInsertAway(str2,str1);
else
return false;
}
/* public static boolean main(String str1, String str2)
{
return OneAway.isOneEditAway(str1,str2);
}*/
// via CLI - java OneAway.java bale pale
public static void main(String args[])
{
System.out.println(OneAway.isOneEditAway(args[0],args[1]));
}
}
| [
"feroz.baig96@gmail.com"
] | feroz.baig96@gmail.com |
d097f5444202093df8d32a4cefe0f785b9382415 | e8f398a2bf399c3ab8c4338e833445af7952e67a | /app/src/main/java/com/bw/movie/presenter/NowPresenterImpl.java | f62529c21f8f07db78a4ce4b4ee7cdaf1ce26750 | [] | no_license | DuanHaiTao66/WDMovie | 35eb9f932e498c78012de08aac65d31373d7602c | ab3ac9ea830b865163638187ecd7613a5727b850 | refs/heads/master | 2022-06-15T05:41:07.177491 | 2020-05-08T13:15:29 | 2020-05-08T13:15:29 | 256,643,847 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package com.bw.movie.presenter;
/*
*@auther:段海涛
*@Date: 2020-04-24
*@Time:14:53
*@Description:${DESCRIPTION}
**/
import com.bw.movie.base.BasePresenter;
import com.bw.movie.contract.HomeContract;
import com.bw.movie.contract.NowContract;
import com.bw.movie.model.NowModelImpl;
public class NowPresenterImpl extends BasePresenter<NowContract.View>implements NowContract.Presenter {
private NowModelImpl model;
@Override
protected void initModel() {
model = new NowModelImpl();
}
@Override
public void now(int page, int count) {
model.now(page, count, new NowContract.Model.NowListCallBack() {
@Override
public void nowSuccess(Object obj) {
getView().nowSuccess(obj);
}
@Override
public void nowFilter(String msg) {
getView().nowFilter(msg);
}
});
}
}
| [
"duanhaitao19970501@foxmail.com"
] | duanhaitao19970501@foxmail.com |
6a3a868479ca36987197ec9c4e947b5eed24413e | 24f13b364a56f87e624e2a873cfa936fa5dbc0c2 | /src/FractalExplorer.java | 9d47ee197f51196a60fd9a99361497abd9088765 | [] | no_license | igor008/lab5 | 6da6f3fab5b160fbdf7305a0860503bf17b37bc3 | 187466cb367a17ff5c327dba25a85cc8bf11e728 | refs/heads/master | 2023-04-12T11:09:27.415295 | 2021-04-29T20:00:51 | 2021-04-29T20:00:51 | 362,932,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,568 | java | import java.awt.*;
import javax.swing.*;
import java.awt.geom.Rectangle2D;
import java.awt.event.*;
import javax.swing.JFileChooser.*;
import javax.swing.filechooser.*;
import javax.imageio.ImageIO.*;
import java.awt.image.*;
public class FractalExplorer {
private int displaySize;
private JImageDisplay display;
private FractalGenerator fractal;
private Rectangle2D.Double range;
public FractalExplorer(int size) {
displaySize = size;
fractal = new Mandelbrot();
range = new Rectangle2D.Double();
fractal.getInitialRange(range);
display = new JImageDisplay(displaySize, displaySize);
}
public void createAndShowGUI()
{
display.setLayout(new BorderLayout());
JFrame myFrame = new JFrame("Фракталы");
myFrame.add(display, BorderLayout.CENTER);
JButton resetButton = new JButton("Сброс");
ButtonHandler resetHandler = new ButtonHandler();
resetButton.addActionListener(resetHandler);
MouseHandler click = new MouseHandler();
display.addMouseListener(click);
myFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JComboBox myComboBox = new JComboBox();
FractalGenerator mandelbrotFractal = new Mandelbrot();
myComboBox.addItem(mandelbrotFractal);
FractalGenerator tricornFractal = new Tricorn();
myComboBox.addItem(tricornFractal);
FractalGenerator burningShipFractal = new BurningShip();
myComboBox.addItem(burningShipFractal);
ButtonHandler fractalChooser = new ButtonHandler();
myComboBox.addActionListener(fractalChooser);
JPanel upprePanel = new JPanel();
JLabel myLabel = new JLabel("Фигура:");
upprePanel.add(myLabel);
upprePanel.add(myComboBox);
myFrame.add(upprePanel, BorderLayout.NORTH);
JButton saveButton = new JButton("Сохранить");
JPanel bottomPanel = new JPanel();
bottomPanel.add(saveButton);
bottomPanel.add(resetButton);
myFrame.add(bottomPanel, BorderLayout.SOUTH);
ButtonHandler saveHandler = new ButtonHandler();
saveButton.addActionListener(saveHandler);
myFrame.pack();
myFrame.setVisible(true);
myFrame.setResizable(false);
}
private void drawFractal()
{
/** Loop through every pixel in the display **/
for (int x=0; x<displaySize; x++){
for (int y=0; y<displaySize; y++){
double xCoord = fractal.getCoord(range.x, range.x + range.width, displaySize, x);
double yCoord = fractal.getCoord(range.y, range.y + range.height, displaySize, y);
int iteration = fractal.numIterations(xCoord, yCoord);
if (iteration == -1){
display.drawPixel(x, y, 0);
} else {
float hue = 0.7f + (float) iteration / 200f;
int rgbColor = Color.HSBtoRGB(hue, 1f, 1f);
display.drawPixel(x, y, rgbColor);
}
}
}
display.repaint();
}
private class ButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
String command = e.getActionCommand();
if (e.getSource() instanceof JComboBox) {
JComboBox src = (JComboBox) e.getSource();
fractal = (FractalGenerator) src.getSelectedItem();
fractal.getInitialRange(range);
drawFractal();
} else if (command.equals("Сброс")) {
fractal.getInitialRange(range);
drawFractal();
} else if (command.equals("Сохранить")) {
JFileChooser myFileChooser = new JFileChooser();
FileFilter extensionFilter = new FileNameExtensionFilter("PNG Images", "png");
myFileChooser.setFileFilter(extensionFilter);
myFileChooser.setAcceptAllFileFilterUsed(false);
int userSelection = myFileChooser.showSaveDialog(display);
if (userSelection == JFileChooser.APPROVE_OPTION) {
java.io.File file = myFileChooser.getSelectedFile();
String file_name = file.toString();
try {
BufferedImage displayImage = display.getImage();
javax.imageio.ImageIO.write(displayImage, "png", file);
} catch (Exception exception) {
JOptionPane.showMessageDialog(display,
exception.getMessage(), "Ошибка",
JOptionPane.ERROR_MESSAGE);
}
}
else return;
}
}
}
private class MouseHandler extends MouseAdapter
{
@Override
public void mouseClicked(MouseEvent e)
{
int x = e.getX();
double xCoord = fractal.getCoord(range.x, range.x + range.width, displaySize, x);
int y = e.getY();
double yCoord = fractal.getCoord(range.y, range.y + range.height, displaySize, y);
fractal.recenterAndZoomRange(range, xCoord, yCoord, 0.5);
drawFractal();
}
}
public static void main(String[] args)
{
FractalExplorer displayExplorer = new FractalExplorer(600);
displayExplorer.createAndShowGUI();
displayExplorer.drawFractal();
}
}
| [
"petukh.petr228@mail.ru"
] | petukh.petr228@mail.ru |
e26bda7e009fb3c74c49f2149f2c86d6e414c778 | 59074d2202f65c2c5371756433c9ba09437d96b6 | /locations.java | 9063d6989948fee1ba8214cc94bf1e53780d2d52 | [] | no_license | parvjain1010/Employee-management | d17e1f019b0096118442fd1d8122de0a1ba0c661 | b8ebf54d03a49ca86ea8f1f3895f191a8d8704e8 | refs/heads/master | 2022-11-25T15:07:55.403370 | 2019-10-30T13:42:31 | 2019-10-30T13:42:31 | 218,004,043 | 0 | 2 | null | 2022-11-22T04:36:24 | 2019-10-28T08:53:44 | TSQL | UTF-8 | Java | false | false | 2,263 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package q2;
import java.util.Scanner;
import java.util.Vector;
public class Q2 {
public static void main(String[] args) throws java.lang.Exception
{
Scanner sc=new Scanner(System.in);
Vector vec=new Vector();
/*vec.add("pollution");
vec.add("environment");
vec.add("human");*/
int n;
System.out.println("Enter the number of words : ");
n=sc.nextInt();
System.out.println("Enter "+n+" words : ");
sc.nextLine();
for(int i=0 ; i<n ; i++)
{
String s=new String();
s=sc.next();
vec.add(s);
}
sc.nextLine();
String str=new String();
System.out.println("Enter a paragraph :");
str=sc.nextLine();
String s=new String();
System.out.println("Solution paragraph :");
for(int i=0 ; i<str.length() ; i++)
{
if(str.charAt(i)!=' ' && str.charAt(i)!='.')
{
s=s+str.charAt(i);
}
else
{
if(vec.contains(s))
{
System.out.print(s.charAt(0));
for(int j=0 ; j<s.length()-1 ; j++)
System.out.print("*");
System.out.print(str.charAt(i));
}
else System.out.print(s+str.charAt(i));
s="";
}
}
if(vec.contains(s))
{
System.out.print(s.charAt(0));
for(int j=0 ; j<s.length()-1 ; j++)
System.out.print("*");
System.out.print("\n");
}
else System.out.println(s);
}
}
// Example Paragraph // pollution is caused by human being. it is bad for environment. human should stop pollution.
// Solution // p******** is caused by h**** being. it is bad for e**********. h**** should stop p********. | [
"bhavya1.malhotra@gmail.com"
] | bhavya1.malhotra@gmail.com |
bc509ead5ae2e57e1a770b1db0d78ccd186a6fb5 | e1e5bd6b116e71a60040ec1e1642289217d527b0 | /H5/L2jReunion/L2jReunion_2014_07_14/L2J_ReunionProject_Core/java/l2r/gameserver/model/L2Object.java | 4f5c0290d5c2df51595af91e350f831030629384 | [] | no_license | serk123/L2jOpenSource | 6d6e1988a421763a9467bba0e4ac1fe3796b34b3 | 603e784e5f58f7fd07b01f6282218e8492f7090b | refs/heads/master | 2023-03-18T01:51:23.867273 | 2020-04-23T10:44:41 | 2020-04-23T10:44:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 24,414 | java | /*
* Copyright (C) 2004-2014 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* L2J Server 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 l2r.gameserver.model;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;
import javolution.util.FastMap;
import l2r.gameserver.enums.InstanceType;
import l2r.gameserver.enums.PcCondOverride;
import l2r.gameserver.enums.ShotType;
import l2r.gameserver.enums.ZoneIdType;
import l2r.gameserver.handler.ActionHandler;
import l2r.gameserver.handler.ActionShiftHandler;
import l2r.gameserver.handler.IActionHandler;
import l2r.gameserver.idfactory.IdFactory;
import l2r.gameserver.instancemanager.InstanceManager;
import l2r.gameserver.model.actor.L2Character;
import l2r.gameserver.model.actor.L2Npc;
import l2r.gameserver.model.actor.instance.L2PcInstance;
import l2r.gameserver.model.actor.knownlist.ObjectKnownList;
import l2r.gameserver.model.actor.poly.ObjectPoly;
import l2r.gameserver.model.entity.Instance;
import l2r.gameserver.model.interfaces.IIdentifiable;
import l2r.gameserver.model.interfaces.ILocational;
import l2r.gameserver.model.interfaces.INamable;
import l2r.gameserver.model.interfaces.IPositionable;
import l2r.gameserver.model.interfaces.IUniqueId;
import l2r.gameserver.network.SystemMessageId;
import l2r.gameserver.network.serverpackets.ActionFailed;
import l2r.gameserver.network.serverpackets.DeleteObject;
import l2r.gameserver.network.serverpackets.ExSendUIEvent;
import l2r.gameserver.network.serverpackets.L2GameServerPacket;
import l2r.gameserver.util.Util;
/**
* Mother class of all objects in the world which ones is it possible to interact (PC, NPC, Item...)<BR>
* <BR>
* L2Object :<BR>
* <BR>
* <li>L2Character</li> <li>L2ItemInstance</li>
*/
public abstract class L2Object implements IIdentifiable, INamable, IUniqueId, IPositionable
{
private boolean _isVisible;
private boolean _isInvisible;
private ObjectKnownList _knownList;
/** Name */
private String _name;
/** Object ID */
private int _objectId;
/** World Region */
private L2WorldRegion _worldRegion;
/** Instance type */
private InstanceType _instanceType = null;
private volatile Map<String, Object> _scripts;
/** X coordinate */
private final AtomicInteger _x = new AtomicInteger(0);
/** Y coordinate */
private final AtomicInteger _y = new AtomicInteger(0);
/** Z coordinate */
private final AtomicInteger _z = new AtomicInteger(0);
/** Orientation */
private final AtomicInteger _heading = new AtomicInteger(0);
/** Instance id of object. 0 - Global */
private final AtomicInteger _instanceId = new AtomicInteger(0);
public L2Object(int objectId)
{
setInstanceType(InstanceType.L2Object);
_objectId = objectId;
initKnownList();
}
/**
* Gets the instance type of object.
* @return the instance type
*/
public final InstanceType getInstanceType()
{
return _instanceType;
}
/**
* Sets the instance type.
* @param newInstanceType the instance type to set
*/
protected final void setInstanceType(InstanceType newInstanceType)
{
_instanceType = newInstanceType;
}
/**
* Verifies if object is of any given instance types.
* @param instanceTypes the instance types to verify
* @return {@code true} if object is of any given instance types, {@code false} otherwise
*/
public final boolean isInstanceTypes(InstanceType... instanceTypes)
{
return _instanceType.isTypes(instanceTypes);
}
public void onAction(L2PcInstance player)
{
onAction(player, true);
}
public void onAction(L2PcInstance player, boolean interact)
{
IActionHandler handler = ActionHandler.getInstance().getHandler(getInstanceType());
if (handler != null)
{
handler.action(player, this, interact);
}
player.sendPacket(ActionFailed.STATIC_PACKET);
}
public void onActionShift(L2PcInstance player)
{
IActionHandler handler = ActionShiftHandler.getInstance().getHandler(getInstanceType());
if (handler != null)
{
handler.action(player, this, true);
}
player.sendPacket(ActionFailed.STATIC_PACKET);
}
public void onForcedAttack(L2PcInstance player)
{
player.sendPacket(ActionFailed.STATIC_PACKET);
}
/**
* Do Nothing.<BR>
* <BR>
* <B><U> Overridden in </U> :</B><BR>
* <BR>
* <li>L2GuardInstance : Set the home location of its L2GuardInstance</li> <li>L2Attackable : Reset the Spoiled flag</li><BR>
* <BR>
*/
public void onSpawn()
{
}
public void decayMe()
{
assert getWorldRegion() != null;
L2WorldRegion reg = getWorldRegion();
synchronized (this)
{
_isVisible = false;
setWorldRegion(null);
}
// this can synchronize on others instances, so it's out of
// synchronized, to avoid deadlocks
// Remove the L2Object from the world
L2World.getInstance().removeVisibleObject(this, reg);
L2World.getInstance().removeObject(this);
}
public void refreshID()
{
L2World.getInstance().removeObject(this);
IdFactory.getInstance().releaseId(getObjectId());
_objectId = IdFactory.getInstance().getNextId();
}
public final boolean spawnMe()
{
assert (getWorldRegion() == null) && (getLocation().getX() != 0) && (getLocation().getY() != 0) && (getLocation().getZ() != 0);
synchronized (this)
{
// Set the x,y,z position of the L2Object spawn and update its _worldregion
_isVisible = true;
setWorldRegion(L2World.getInstance().getRegion(getLocation()));
// Add the L2Object spawn in the _allobjects of L2World
L2World.getInstance().storeObject(this);
// Add the L2Object spawn to _visibleObjects and if necessary to _allplayers of its L2WorldRegion
getWorldRegion().addVisibleObject(this);
}
// this can synchronize on others instances, so it's out of synchronized, to avoid deadlocks
// Add the L2Object spawn in the world as a visible object
L2World.getInstance().addVisibleObject(this, getWorldRegion());
onSpawn();
return true;
}
public final void spawnMe(int x, int y, int z)
{
assert getWorldRegion() == null;
synchronized (this)
{
// Set the x,y,z position of the L2Object spawn and update its _worldregion
_isVisible = true;
if (x > L2World.MAP_MAX_X)
{
x = L2World.MAP_MAX_X - 5000;
}
if (x < L2World.MAP_MIN_X)
{
x = L2World.MAP_MIN_X + 5000;
}
if (y > L2World.MAP_MAX_Y)
{
y = L2World.MAP_MAX_Y - 5000;
}
if (y < L2World.MAP_MIN_Y)
{
y = L2World.MAP_MIN_Y + 5000;
}
setXYZ(x, y, z);
setWorldRegion(L2World.getInstance().getRegion(getLocation()));
// Add the L2Object spawn in the _allobjects of L2World
}
L2World.getInstance().storeObject(this);
// these can synchronize on others instances, so they're out of
// synchronized, to avoid deadlocks
// Add the L2Object spawn to _visibleObjects and if necessary to _allplayers of its L2WorldRegion
getWorldRegion().addVisibleObject(this);
// Add the L2Object spawn in the world as a visible object
L2World.getInstance().addVisibleObject(this, getWorldRegion());
onSpawn();
}
/**
* Verify if object can be attacked.
* @return {@code true} if object can be attacked, {@code false} otherwise
*/
public boolean canBeAttacked()
{
return false;
}
public abstract boolean isAutoAttackable(L2Character attacker);
public boolean isMarker()
{
return false;
}
/**
* Return the visibility state of the L2Object. <B><U> Concept</U> :</B><BR>
* <BR>
* A L2Object is visible if <B>__IsVisible</B>=true and <B>_worldregion</B>!=null <BR>
* <BR>
* @return
*/
public final boolean isVisible()
{
return getWorldRegion() != null;
}
public final void setIsVisible(boolean value)
{
_isVisible = value;
if (!_isVisible)
{
setWorldRegion(null);
}
}
public void toggleVisible()
{
if (isVisible())
{
decayMe();
}
else
{
spawnMe();
}
}
public ObjectKnownList getKnownList()
{
return _knownList;
}
/**
* Initializes the KnownList of the L2Object, is overwritten in classes that require a different knownlist Type. Removes the need for instanceof checks.
*/
public void initKnownList()
{
_knownList = new ObjectKnownList(this);
}
public final void setKnownList(ObjectKnownList value)
{
_knownList = value;
}
@Override
public final String getName()
{
return _name;
}
public void setName(String value)
{
_name = value;
}
@Override
public final int getObjectId()
{
return _objectId;
}
public final ObjectPoly getPoly()
{
final ObjectPoly poly = getScript(ObjectPoly.class);
return (poly == null) ? addScript(new ObjectPoly(this)) : poly;
}
public abstract void sendInfo(L2PcInstance activeChar);
public void sendPacket(L2GameServerPacket mov)
{
}
public void sendPacket(SystemMessageId id)
{
}
public L2PcInstance getActingPlayer()
{
return null;
}
/**
* Verify if object is instance of L2Attackable.
* @return {@code true} if object is instance of L2Attackable, {@code false} otherwise
*/
public boolean isAttackable()
{
return false;
}
/**
* Verify if object is instance of L2Character.
* @return {@code true} if object is instance of L2Character, {@code false} otherwise
*/
public boolean isCharacter()
{
return false;
}
/**
* Verify if object is instance of L2DoorInstance.
* @return {@code true} if object is instance of L2DoorInstance, {@code false} otherwise
*/
public boolean isDoor()
{
return false;
}
/**
* Verify if object is instance of L2MonsterInstance.
* @return {@code true} if object is instance of L2MonsterInstance, {@code false} otherwise
*/
public boolean isMonster()
{
return false;
}
/**
* Verify if object is instance of L2Npc.
* @return {@code true} if object is instance of L2Npc, {@code false} otherwise
*/
public boolean isNpc()
{
return false;
}
/**
* Verify if object is instance of L2PetInstance.
* @return {@code true} if object is instance of L2PetInstance, {@code false} otherwise
*/
public boolean isPet()
{
return false;
}
/**
* Verify if object is instance of L2PcInstance.
* @return {@code true} if object is instance of L2PcInstance, {@code false} otherwise
*/
public boolean isPlayer()
{
return false;
}
/**
* Verify if object is instance of L2Playable.
* @return {@code true} if object is instance of L2Playable, {@code false} otherwise
*/
public boolean isPlayable()
{
return false;
}
/**
* Verify if object is instance of L2ServitorInstance.
* @return {@code true} if object is instance of L2ServitorInstance, {@code false} otherwise
*/
public boolean isServitor()
{
return false;
}
/**
* Verify if object is instance of L2Summon.
* @return {@code true} if object is instance of L2Summon, {@code false} otherwise
*/
public boolean isSummon()
{
return false;
}
/**
* Verify if object is instance of L2TrapInstance.
* @return {@code true} if object is instance of L2TrapInstance, {@code false} otherwise
*/
public boolean isTrap()
{
return false;
}
/**
* Verify if object is instance of L2ItemInstance.
* @return {@code true} if object is instance of L2ItemInstance, {@code false} otherwise
*/
public boolean isItem()
{
return false;
}
/**
* @return {@code true} if object Npc Walker or Vehicle
*/
public boolean isWalker()
{
return false;
}
public boolean isRunner()
{
return false;
}
/**
* @return {@code true} if object Can be targeted
*/
public boolean isTargetable()
{
return true;
}
/**
* Check if the object is in the given zone Id.
* @param zone the zone Id to check
* @return {@code true} if the object is in that zone Id
*/
public boolean isInsideZone(ZoneIdType zone)
{
return false;
}
/**
* Check if current object has charged shot.
* @param type of the shot to be checked.
* @return {@code true} if the object has charged shot
*/
public boolean isChargedShot(ShotType type)
{
return false;
}
/**
* Charging shot into the current object.
* @param type of the shot to be charged.
* @param charged
*/
public void setChargedShot(ShotType type, boolean charged)
{
}
/**
* Try to recharge a shot.
* @param physical skill are using Soul shots.
* @param magical skill are using Spirit shots.
*/
public void rechargeShots(boolean physical, boolean magical)
{
}
/**
* @param <T>
* @param script
* @return
*/
public final <T> T addScript(T script)
{
if (_scripts == null)
{
// Double-checked locking
synchronized (this)
{
if (_scripts == null)
{
_scripts = new FastMap<String, Object>().shared();
}
}
}
_scripts.put(script.getClass().getName(), script);
return script;
}
/**
* @param <T>
* @param script
* @return
*/
@SuppressWarnings("unchecked")
public final <T> T removeScript(Class<T> script)
{
if (_scripts == null)
{
return null;
}
return (T) _scripts.remove(script.getName());
}
/**
* @param <T>
* @param script
* @return
*/
@SuppressWarnings("unchecked")
public final <T> T getScript(Class<T> script)
{
if (_scripts == null)
{
return null;
}
return (T) _scripts.get(script.getName());
}
protected void badCoords()
{
if (isCharacter())
{
decayMe();
}
else if (isPlayer())
{
((L2Character) this).teleToLocation(new Location(0, 0, 0), false);
((L2Character) this).sendMessage("Error with your coords, Please ask a GM for help!");
}
}
public final void setXYZInvisible(int x, int y, int z)
{
assert getWorldRegion() == null;
if (x > L2World.MAP_MAX_X)
{
x = L2World.MAP_MAX_X - 5000;
}
if (x < L2World.MAP_MIN_X)
{
x = L2World.MAP_MIN_X + 5000;
}
if (y > L2World.MAP_MAX_Y)
{
y = L2World.MAP_MAX_Y - 5000;
}
if (y < L2World.MAP_MIN_Y)
{
y = L2World.MAP_MIN_Y + 5000;
}
setXYZ(x, y, z);
setIsVisible(false);
}
public final void setLocationInvisible(ILocational loc)
{
setXYZInvisible(loc.getX(), loc.getY(), loc.getZ());
}
public void updateWorldRegion()
{
if (!isVisible())
{
return;
}
L2WorldRegion newRegion = L2World.getInstance().getRegion(getLocation());
if (newRegion != getWorldRegion())
{
getWorldRegion().removeVisibleObject(this);
setWorldRegion(newRegion);
// Add the L2Oject spawn to _visibleObjects and if necessary to _allplayers of its L2WorldRegion
getWorldRegion().addVisibleObject(this);
}
}
public final L2WorldRegion getWorldRegion()
{
return _worldRegion;
}
public void setWorldRegion(L2WorldRegion value)
{
if ((getWorldRegion() != null) && isCharacter()) // confirm revalidation of old region's zones
{
if (value != null)
{
getWorldRegion().revalidateZones((L2Character) this); // at world region change
}
else
{
getWorldRegion().removeFromZones((L2Character) this); // at world region change
}
}
_worldRegion = value;
}
/**
* Gets the X coordinate.
* @return the X coordinate
*/
@Override
public int getX()
{
return _x.get();
}
/**
* Gets the Y coordinate.
* @return the Y coordinate
*/
@Override
public int getY()
{
return _y.get();
}
/**
* Gets the Z coordinate.
* @return the Z coordinate
*/
@Override
public int getZ()
{
return _z.get();
}
/**
* Gets the heading.
* @return the heading
*/
@Override
public int getHeading()
{
return _heading.get();
}
/**
* Gets the instance ID.
* @return the instance ID
*/
@Override
public int getInstanceId()
{
return _instanceId.get();
}
/**
* Gets the location object.
* @return the location object
*/
@Override
public Location getLocation()
{
return new Location(getX(), getY(), getZ(), getHeading(), getInstanceId());
}
/**
* Sets the X coordinate
* @param newX the X coordinate
*/
@Override
public void setX(int newX)
{
_x.set(newX);
}
/**
* Sets the Y coordinate
* @param newY the Y coordinate
*/
@Override
public void setY(int newY)
{
_y.set(newY);
}
/**
* Sets the Z coordinate
* @param newZ the Z coordinate
*/
@Override
public void setZ(int newZ)
{
_z.set(newZ);
}
/**
* Sets the x, y, z coordinate.
* @param newX the X coordinate
* @param newY the Y coordinate
* @param newZ the Z coordinate
*/
@Override
public final void setXYZ(int newX, int newY, int newZ)
{
assert getWorldRegion() != null;
setX(newX);
setY(newY);
setZ(newZ);
try
{
if (L2World.getInstance().getRegion(getLocation()) != getWorldRegion())
{
updateWorldRegion();
}
}
catch (Exception e)
{
badCoords();
}
}
/**
* Sets the x, y, z coordinate.
* @param loc the location object
*/
@Override
public void setXYZ(ILocational loc)
{
setXYZ(loc.getX(), loc.getY(), loc.getZ());
}
/**
* Sets heading of object.
* @param newHeading the new heading
*/
@Override
public void setHeading(int newHeading)
{
_heading.set(newHeading);
}
/**
* Sets the instance ID of object.<br>
* 0 - Global<br>
* TODO: Add listener here.
* @param instanceId the ID of the instance
*/
@Override
public void setInstanceId(int instanceId)
{
if ((instanceId < 0) || (getInstanceId() == instanceId))
{
return;
}
Instance oldI = InstanceManager.getInstance().getInstance(getInstanceId());
Instance newI = InstanceManager.getInstance().getInstance(instanceId);
if (newI == null)
{
return;
}
if (isPlayer())
{
final L2PcInstance player = getActingPlayer();
if ((getInstanceId() > 0) && (oldI != null))
{
oldI.removePlayer(getObjectId());
if (oldI.isShowTimer())
{
sendInstanceUpdate(oldI, true);
}
}
if (instanceId > 0)
{
newI.addPlayer(getObjectId());
if (newI.isShowTimer())
{
sendInstanceUpdate(newI, false);
}
}
if (player.hasSummon())
{
player.getSummon().setInstanceId(instanceId);
}
}
else if (isNpc())
{
final L2Npc npc = (L2Npc) this;
if ((getInstanceId() > 0) && (oldI != null))
{
oldI.removeNpc(npc);
}
if (instanceId > 0)
{
newI.addNpc(npc);
}
}
_instanceId.set(instanceId);
if (_isVisible && (_knownList != null))
{
// We don't want some ugly looking disappear/appear effects, so don't update
// the knownlist here, but players usually enter instancezones through teleporting
// and the teleport will do the revalidation for us.
if (!isPlayer())
{
decayMe();
spawnMe();
}
}
}
/**
* Sets location of object.
* @param loc the location object
*/
@Override
public void setLocation(Location loc)
{
_x.set(loc.getX());
_y.set(loc.getY());
_z.set(loc.getZ());
_heading.set(loc.getHeading());
_instanceId.set(loc.getInstanceId());
}
/**
* Calculates distance between this L2Object and given x, y , z.
* @param x the X coordinate
* @param y the Y coordinate
* @param z the Z coordinate
* @param includeZAxis if {@code true} Z axis will be included
* @param squared if {@code true} return will be squared
* @return distance between object and given x, y, z.
*/
public final double calculateDistance(int x, int y, int z, boolean includeZAxis, boolean squared)
{
final double distance = Math.pow(x - getX(), 2) + Math.pow(y - getY(), 2) + (includeZAxis ? Math.pow(z - getZ(), 2) : 0);
return (squared) ? distance : Math.sqrt(distance);
}
/**
* Calculates distance between this L2Object and given location.
* @param loc the location object
* @param includeZAxis if {@code true} Z axis will be included
* @param squared if {@code true} return will be squared
* @return distance between object and given location.
*/
public final double calculateDistance(ILocational loc, boolean includeZAxis, boolean squared)
{
return calculateDistance(loc.getX(), loc.getY(), loc.getZ(), includeZAxis, squared);
}
/**
* Calculates the angle in degrees from this object to the given object.<br>
* The return value can be described as how much this object has to turn<br>
* to have the given object directly in front of it.
* @param target the object to which to calculate the angle
* @return the angle this object has to turn to have the given object in front of it
*/
public final double calculateDirectionTo(ILocational target)
{
int heading = Util.calculateHeadingFrom(this, target) - this.getHeading();
if (heading < 0)
{
heading = 65535 + heading;
}
return Util.convertHeadingToDegree(heading);
}
/**
* Sends an instance update for player.
* @param instance the instance to update
* @param hide if {@code true} hide the player
*/
private final void sendInstanceUpdate(Instance instance, boolean hide)
{
final int startTime = (int) ((System.currentTimeMillis() - instance.getInstanceStartTime()) / 1000);
final int endTime = (int) ((instance.getInstanceEndTime() - instance.getInstanceStartTime()) / 1000);
if (instance.isTimerIncrease())
{
sendPacket(new ExSendUIEvent(getActingPlayer(), hide, true, startTime, endTime, instance.getTimerText()));
}
else
{
sendPacket(new ExSendUIEvent(getActingPlayer(), hide, false, endTime - startTime, 0, instance.getTimerText()));
}
}
/**
* @return {@code true} if this object is invisible, {@code false} otherwise.
*/
public boolean isInvisible()
{
return _isInvisible;
}
/**
* Sets this object as invisible or not
* @param invis
*/
public void setInvisible(boolean invis)
{
_isInvisible = invis;
if (invis)
{
final DeleteObject deletePacket = new DeleteObject(this);
for (L2Object obj : getKnownList().getKnownObjects().values())
{
if ((obj != null) && obj.isPlayer())
{
final L2PcInstance player = obj.getActingPlayer();
if (!isVisibleFor(player))
{
obj.sendPacket(deletePacket);
}
}
}
}
// Broadcast information regarding the object to those which are suppose to see.
broadcastInfo();
}
/**
* @param player
* @return {@code true} if player can see an invisible object if it's invisible, {@code false} otherwise.
*/
public boolean isVisibleFor(L2PcInstance player)
{
return !isInvisible() || player.canOverrideCond(PcCondOverride.SEE_ALL_PLAYERS);
}
/**
* Broadcasts describing info to known players.
*/
public void broadcastInfo()
{
for (L2Object obj : getKnownList().getKnownObjects().values())
{
if ((obj != null) && obj.isPlayer() && isVisibleFor(obj.getActingPlayer()))
{
sendInfo(obj.getActingPlayer());
}
}
}
@Override
public boolean equals(Object obj)
{
return ((obj instanceof L2Object) && (((L2Object) obj).getObjectId() == getObjectId()));
}
@Override
public String toString()
{
return (getClass().getSimpleName() + ":" + getName() + "[" + getObjectId() + "]");
}
} | [
"64197706+L2jOpenSource@users.noreply.github.com"
] | 64197706+L2jOpenSource@users.noreply.github.com |
67b324230c099e911f1dc48769e69f610f0d8094 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_bce304985cd16aa360a07a4b49041ef49e05bbb4/IJavaBreakpoint/27_bce304985cd16aa360a07a4b49041ef49e05bbb4_IJavaBreakpoint_t.java | f337726603c0945d830da1789f1e253d150e1311 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 5,862 | java | package org.eclipse.jdt.debug.core;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.IType;
/**
* IJavaBreakpoints extend IBreakpoint by adding
* the following notions:
* <ul>
* <li>hit count - a number of times that this breakpoint
* will be "hit" before it suspends execution
* <li>type - the type the given breakpoint is installed in
* <li>installed - whether the given breakpoint is installed
* in a debug target. when a breakpoint is installed in a debug
* target, it may cause the suspension of that target
*
* Clients are not intended to implement this interface
*/
public interface IJavaBreakpoint extends IBreakpoint {
/**
* Suspend policy constant indicating a breakpoint will
* suspend the target VM when hit.
*/
public static final int SUSPEND_VM = 1;
/**
* Default suspend policy constant indicating a breakpoint will
* suspend only the thread in which it occurred.
*/
public static final int SUSPEND_THREAD = 2;
/**
* Returns whether this breakpoint is installed in at least
* one debug target.
*
* @return whether this breakpoint is installed
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public boolean isInstalled() throws CoreException;
/**
* Returns the fully qualified name of type this breakpoint
* is located in, or <code>null</code> is this breakpoint
* is not located in a type - for example, a pattern breakpoint
*
* @return the fully qualified name of the type this breakpoint
* is located in, or <code>null</code>
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public String getTypeName() throws CoreException;
/**
* Returns this breakpoint's hit count or, -1 if this
* breakpoint does not have a hit count.
*
* @return this breakpoint's hit count, or -1
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public int getHitCount() throws CoreException;
/**
* Sets the hit count attribute of this breakpoint.
* If this breakpoint is currently disabled and the hit count
* is set greater than -1, the breakpoint is enabled.
*
* @param count the new hit count
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public void setHitCount(int count) throws CoreException;
/**
* Sets whether all threads in the target VM will be suspended
* when this breakpoint is hit. When <code>SUSPEND_VM</code> the target
* VM is suspended, and when <code>SUSPEND_THREAD</code> only the thread
* in which the breakpoint occurred is suspended.
*
* @param suspendPolicy one of <code>SUSPEND_VM</code> or
* <code>SUSPEND_THREAD</code>
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public void setSuspendPolicy(int suspendPolicy) throws CoreException;
/**
* Returns the suspend policy used by this breakpoint, one of
* <code>SUSPEND_VM</code> or <code>SUSPEND_THREAD</code>.
*
* @return one of <code>SUSPEND_VM</code> or <code>SUSPEND_THREAD</code>
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public int getSuspendPolicy() throws CoreException;
/**
* Set the given threads as the thread in which this
* breakpoint is enabled. The previous thread filter, if
* any, is lost.
*
* A thread filter applies to a single debug target and is not persisted
* across invokations.
*
* While this breakpoint has a thread filter,
* it will only suspend in the filtered thread.
*
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public void setThreadFilter(IJavaThread thread) throws CoreException;
/**
* Removes this breakpoint's thread filter in the given target, if any.
* Has no effect if this breakpoint does not have a filter in the given target.
*
* While this breakpoint has a thread filter in the given target,
* it will only suspend threads which are filtered.
*
* @param target the target whose thread filter will be removed
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public void removeThreadFilter(IJavaDebugTarget target) throws CoreException;
/**
* Returns the thread in the given target in which this breakpoint
* is enabled or <code>null</code> if this breakpoint is enabled in
* all threads in the given target.
*
* @return the thread in the given target that this breakpoint is enabled for
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public IJavaThread getThreadFilter(IJavaDebugTarget target) throws CoreException;
/**
* Returns the threads in which this breakpoint is enabled or an empty array
* if this breakpoint is enabled in all threads.
*
* @return the threads that this breakpoint is enabled for
* @exception CoreException if a <code>CoreException</code> is
* thrown accessing this breakpoint's underlying marker
*/
public IJavaThread[] getThreadFilters() throws CoreException;
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
3b238b87a3ef9384c2615dd0f394378079b3e171 | 710b9b6ecc9da027d96c9746bf321f173c486a46 | /jadux/src/main/java/com/didi/soda/jadux/ComposeMiddleware.java | f26e287c67bd366af769246796ac1ceb3f52efff | [
"Apache-2.0"
] | permissive | igumiku/Andux | 54cc59877606b82f8f1369cb59b8cb466af96ab0 | 8cbed67e7de2107e9a3487ca5756cb7c027f534e | refs/heads/master | 2020-03-23T05:13:35.119965 | 2018-07-30T03:15:29 | 2018-07-30T03:15:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.didi.soda.jadux;
import com.didi.soda.jadux.function.MiddlewareInnerFunction;
import io.reactivex.functions.BiFunction;
public class ComposeMiddleware {
public static BiFunction<MiddlewareInnerFunction, MiddlewareInnerFunction, MiddlewareInnerFunction> compose =
(f, g) -> (MiddlewareInnerFunction) source -> f.apply(g.apply(source));
}
| [
"lijiang@didichuxing.com"
] | lijiang@didichuxing.com |
8311b4a986340dfbac2e739f026090b075295204 | a8acfeb59e81ca092f28f988e4422709544846f6 | /sdapv2-master/src/test/java/shinhands/com/GreetingResourceTest.java | b8f8df7914a2dd3cadaafa012b34f9247a1d66ae | [] | no_license | empty-21/sdap21 | 081bcea342d3d560ef643737a11df0bab1ae38f3 | bf4a5f4268219fd7d896e48bd67ca4dfa3748b54 | refs/heads/main | 2023-08-30T12:18:44.308418 | 2021-11-10T08:06:10 | 2021-11-10T08:06:10 | 426,528,377 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 439 | java | package shinhands.com;
import io.quarkus.test.junit.QuarkusTest;
import org.junit.jupiter.api.Test;
import static io.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.is;
@QuarkusTest
public class GreetingResourceTest {
@Test
public void testHelloEndpoint() {
given()
.when().get("/hello")
.then()
.statusCode(200)
.body(is("Hello RESTEasy"));
}
} | [
"escapees@naver.com"
] | escapees@naver.com |
54c6a8bbb10dfec449f43067ff2779b9d1fb65ed | 4a7e63257f3d819ee18a9e0ab94ef86fa609b147 | /app/src/androidTest/java/com/example/testcamerasurfaceview/ExampleInstrumentedTest.java | a528324fb54832a5e14fe6f2ff7514e18a4f3119 | [] | no_license | mat-suda/TestCameraSurfaceView | f2daa10994d12cd512713fd7ac316f6a22b29f47 | ec2ee8c5ffd1eee806fab1a2e704c86c379d1b69 | refs/heads/master | 2022-12-31T01:59:31.466112 | 2020-10-16T09:49:38 | 2020-10-16T09:49:38 | 304,531,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 780 | java | package com.example.testcamerasurfaceview;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.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.getInstrumentation().getTargetContext();
assertEquals("com.example.testcamerasurfaceview", appContext.getPackageName());
}
} | [
"matsuda@bright-sys.co.jp"
] | matsuda@bright-sys.co.jp |
9d7067dc0ce3448b1ef82b94b2c3f9d2f4f0c405 | df337d1d8b95f7b891dae0c5f4cf3599f4dbc6f0 | /schedoscope-metascope/src/main/java/org/schedoscope/metascope/conf/ProductionSpringConfiguration.java | 6a062759cb5d6553634ec74520d84c23bd7c6280 | [
"Apache-2.0"
] | permissive | PeterPannsen/schedoscope | d431aaca2f35caed9d10fe0c84ead75ba28dd2d0 | 5498cfc44e3bdcae4786bf4de30e539a7883ffe0 | refs/heads/master | 2021-01-15T12:28:25.068341 | 2016-08-16T12:47:26 | 2016-08-16T12:47:26 | 64,209,069 | 0 | 0 | null | 2016-07-26T09:35:24 | 2016-07-26T09:35:24 | null | UTF-8 | Java | false | false | 7,807 | java | /**
* Copyright 2015 Otto (GmbH & Co KG)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.schedoscope.metascope.conf;
import javax.sql.DataSource;
import org.apache.commons.lang.ArrayUtils;
import org.schedoscope.conf.BaseSettings;
import org.schedoscope.metascope.index.SolrFacade;
import org.schedoscope.metascope.service.UserEntityService;
import org.schedoscope.metascope.tasks.repository.RepositoryDAO;
import org.schedoscope.metascope.tasks.repository.jdbc.NativeSqlRepository;
import org.schedoscope.metascope.tasks.repository.mysql.MySQLRepository;
import org.schedoscope.metascope.util.ValidationQueryUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.embedded.ServletListenerRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.core.support.LdapContextSource;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.security.authentication.encoding.ShaPasswordEncoder;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.web.session.HttpSessionEventPublisher;
import com.typesafe.config.ConfigFactory;
/**
* Configuration to secure the application (login)
*/
@Configuration
@ComponentScan
@EnableAsync
@Profile("production")
public class ProductionSpringConfiguration extends WebSecurityConfigurerAdapter {
@Autowired
private UserEntityService userEntityService;
@Override
protected void configure(HttpSecurity http) throws Exception {
MetascopeConfig config = metascopeConfig();
if (config.getAuthenticationMethod().equalsIgnoreCase("ldap")) {
String[] allgroups = appendRolePrefix(config.getAllowedGroups(), config.getAdminGroups());
String[] adminGroups = appendRolePrefix(config.getAdminGroups());
http.authorizeRequests()
.antMatchers("/", "/?error=cred", "/status/*", "/expired").permitAll()
.antMatchers("/admin**").hasAnyAuthority(adminGroups)
.antMatchers("/admin/").hasAnyAuthority(adminGroups)
.antMatchers("/admin/**").hasAnyAuthority(adminGroups)
.antMatchers("/**").hasAnyAuthority(allgroups)
.anyRequest().authenticated()
.and()
.formLogin().loginPage("/").failureUrl("/?error=cred")
.defaultSuccessUrl("/home")
.and()
.logout().logoutSuccessUrl("/").and().rememberMe().and().exceptionHandling()
.accessDeniedPage("/accessdenied");
} else {
http.authorizeRequests().antMatchers("/", "/?error=cred", "/status/*", "/expired").permitAll()
.antMatchers("/admin**").hasAuthority("ROLE_ADMIN").antMatchers("/admin/").hasAuthority("ROLE_ADMIN")
.antMatchers("/admin/**").hasAuthority("ROLE_ADMIN").anyRequest().authenticated().and().formLogin()
.loginPage("/").failureUrl("/?error=cred").and().logout().logoutSuccessUrl("/").and().rememberMe().and()
.exceptionHandling().accessDeniedPage("/accessdenied");
}
http.sessionManagement().maximumSessions(1).expiredUrl("/expired").sessionRegistry(sessionRegistry());
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
MetascopeConfig config = metascopeConfig();
if (config.getAuthenticationMethod().equalsIgnoreCase("ldap")) {
auth.ldapAuthentication().userDnPatterns(config.getUserDnPattern()).groupSearchBase(config.getGroupSearchBase())
.contextSource(ldapContextSource());
} else {
auth.jdbcAuthentication().passwordEncoder(new ShaPasswordEncoder(256)).dataSource(dataSource())
.usersByUsernameQuery("select username,password_hash,'true' from user_entity where username = ?")
.authoritiesByUsernameQuery("select username,userrole from user_entity where username = ?");
userEntityService.createAdminAccount();
}
}
@Bean
public LdapContextSource ldapContextSource() {
MetascopeConfig config = metascopeConfig();
LdapContextSource contextSource = new LdapContextSource();
contextSource.setUrl(config.getLdapUrl());
contextSource.setUserDn(config.getManagerDn());
contextSource.setPassword(config.getManagerPassword());
return contextSource;
}
@Bean
public LdapTemplate ldapTemplate() {
return new LdapTemplate(ldapContextSource());
}
@Bean
public SessionRegistry sessionRegistry() {
return new SessionRegistryImpl();
}
@Bean
public ServletListenerRegistrationBean<HttpSessionEventPublisher> httpSessionEventPublisher() {
return new ServletListenerRegistrationBean<HttpSessionEventPublisher>(new HttpSessionEventPublisher());
}
@Bean
public MetascopeConfig metascopeConfig() {
return new MetascopeConfig(new BaseSettings(ConfigFactory.load()));
}
@Bean
public DataSource dataSource() {
MetascopeConfig metascopeConfig = metascopeConfig();
DataSource dataSource = DataSourceBuilder.create().username(metascopeConfig.getRepositoryUser())
.password(metascopeConfig.getRepositoryPassword()).url(metascopeConfig.getRepositoryUrl()).build();
if (dataSource instanceof org.apache.tomcat.jdbc.pool.DataSource) {
org.apache.tomcat.jdbc.pool.DataSource tomcatDataSource = (org.apache.tomcat.jdbc.pool.DataSource) dataSource;
tomcatDataSource.setTestOnBorrow(true);
tomcatDataSource.setMaxIdle(10);
tomcatDataSource.setMinIdle(1);
tomcatDataSource.setTestWhileIdle(true);
String validationQuery = ValidationQueryUtil.getValidationQuery(tomcatDataSource.getDriverClassName());
tomcatDataSource.setValidationQuery(validationQuery);
}
return dataSource;
}
@Bean
public RepositoryDAO repositoryDAO() {
MetascopeConfig config = metascopeConfig();
if (config.getRepositoryUrl().startsWith("jdbc:mysql")) {
return new MySQLRepository();
} else {
return new NativeSqlRepository();
}
}
@Bean
public SolrFacade solrFacade() {
MetascopeConfig config = metascopeConfig();
return new SolrFacade(config.getSolrUrl());
}
private String[] appendRolePrefix(String groups) {
String[] groupsArray = groups.split(",");
for (int i = 0; i < groupsArray.length; i++) {
groupsArray[i] = "ROLE_" + groupsArray[i].toUpperCase();
}
return groupsArray;
}
private String[] appendRolePrefix(String allowedGroups, String adminGroups) {
String[] allowedGroupArray = appendRolePrefix(allowedGroups);
String[] adminGroupArray = appendRolePrefix(adminGroups);
return (String[]) ArrayUtils.addAll(allowedGroupArray, adminGroupArray);
}
} | [
"kassem.tohme@ottogroup.com"
] | kassem.tohme@ottogroup.com |
8472c2fff5c20a0bf1c50d9a74cd555c88368c8e | 95bdfb407a8c880e1b9da36a5afe4f54411e292d | /app/src/main/java/openweather/openweather/MyDBHandler.java | 7ffb7ffa367692233f746d5cbf106654734d4843 | [] | no_license | SindhuManukonda/WeatherAppTrail | 6abe0d2d4fc926918735693d8e61c4e5a954457f | 75c876167088d97416a42634c10c799a1bba9e98 | refs/heads/master | 2020-12-05T01:25:36.172527 | 2016-08-26T20:25:51 | 2016-08-26T20:25:51 | 66,677,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,992 | java | package openweather.openweather;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import openweather.openweather.provider.MyContentProvider;
public class MyDBHandler extends SQLiteOpenHelper
{
private ContentResolver myCR;
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "openweather.db";
public static final String TABLE_OPENWEATHER = "openweather";
public static final String WEATHER_ID = "_id";
public static final String WEATHER_TEMP = "temp";
public static final String WEATHER_DESCRIPTION = "description";
public static final String WEATHER_HUMIDITY = "humidity";
public static final String WEATHER_TIME = "time";
public static final String[] PROJECTION = {
WEATHER_ID,
WEATHER_TEMP,
WEATHER_DESCRIPTION,
WEATHER_HUMIDITY,
WEATHER_TIME
};
public MyDBHandler (Context context, String name,
SQLiteDatabase.CursorFactory factory,int version)
{
super (context, DATABASE_NAME, factory, DATABASE_VERSION);
myCR = context.getContentResolver();
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_WEATHER_TABLE = "CREATE TABLE " + TABLE_OPENWEATHER + "("
+ WEATHER_ID + " INTEGER PRIMARY KEY, "
+ WEATHER_TEMP + " REAL, "
+ WEATHER_DESCRIPTION + " TEXT, "
+ WEATHER_HUMIDITY + " INTEGER, "
+ WEATHER_TIME + " TEXT "
+ ")";
Log.i("Log_tag","table is"+CREATE_WEATHER_TABLE);
db.execSQL(CREATE_WEATHER_TABLE);
Log.i("Log_tag","created");
}
@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1)
{
/*
In a real app, you should migrate the existing schema to the new schema,
not delete the data in the table!!!
db.execSQL ("DROP TABLE IF EXISTS " + TABLE_OPENWEATHER);
onCreate (db);
*/
}
public void addProduct(OpenWeatherProvider weather)
{
ContentValues values = new ContentValues();
values.put(WEATHER_TEMP, weather.getweather_id());
values.put(WEATHER_DESCRIPTION, weather.getweather_description());
values.put(WEATHER_HUMIDITY, weather.getweather_humidity());
values.put(WEATHER_TIME, weather.getweather_time());
myCR.insert(MyContentProvider.CONTENT_URI, values);
/*
SQLiteDatabase db = this.getWritableDatabase();
db.insert (TABLE_OPENWEATHER, null, values);
db.close();
*/
}
public OpenWeatherProvider findProduct (String productname)
{
/*
String query = "Select * FROM " + TABLE_OPENWEATHER
+ " WHERE " + WEATHER_TEMP + " =\"" + productname + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
*/
String selection = "productname = \"" + productname + "\"";
Cursor cursor = myCR.query(MyContentProvider.CONTENT_URI,
PROJECTION, selection, null, null);
OpenWeatherProvider weather = new OpenWeatherProvider();
if (cursor.moveToFirst())
{
cursor.moveToFirst();
weather.setweather_id(Integer.parseInt(cursor.getString(0)));
weather.setweather_temp(cursor.getDouble(1));
weather.setweather_description(cursor.getString(2));
weather.setweather_humidity((cursor.getInt(3)));
weather.set_weather_windtime((cursor.getString(4)));
cursor.close();
}
else
{
weather = null;
}
//db.close();
return weather;
}
public boolean deleteProduct(String productname)
{
boolean result = false;
String selection = "productname = \"" + productname + "\"";
int rowsDeleted = myCR.delete(MyContentProvider.CONTENT_URI,
selection, null);
if (rowsDeleted > 0)
{
result = true;
}
/*
String query = "Select * FROM " + TABLE_OPENWEATHER
+ " WHERE " + WEATHER_TEMP + " =\"" + productname + "\"";
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(query, null);
Product product = new Product();
if (cursor.moveToFirst()) {
product.set_id(Integer.parseInt(cursor.getString(0)));
db.delete(TABLE_OPENWEATHER, WEATHER_ID + " = ?",
new String[] {String.valueOf(product.get_id()) });
cursor.close();
result = true;
}
//db.close();
*/
return result;
}
}
| [
"sindhumanukonda9@gmail.com"
] | sindhumanukonda9@gmail.com |
7cd14fd5e2a13b2ae8f108c3c97c390b45a781b7 | 32a421ff0b1a0b7c62e1a4e8a6a2ac882bac068d | /src/TestFecha.java | b6c899cfd6ce7c9f8e8414868bf74b9d3ef059f0 | [] | no_license | eduardobritosan/dateCalculator | 63644867876ea37544d0dd9339d1a775226a5248 | 1a6080b51cb745394b509a46253bc4cfa7a621cb | refs/heads/master | 2023-08-30T19:09:45.469891 | 2021-11-17T13:54:45 | 2021-11-17T13:54:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,817 | java | import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
import org.junit.Before;
import org.junit.Test;
public class TestFecha {
@Before
public void setUp() throws Exception {
}
@Test
public void testEsBisiesto()
{
Fecha primerBisiesto = new Fecha(1, 1, 9996);
Fecha noBisiesto = new Fecha(1, 1, 1);
Fecha segundoBisiesto = new Fecha(1, 1, 4);
Fecha tercerBisiesto = new Fecha(1, 1, 400);
Fecha segundoNoBisiesto = new Fecha(1, 1, 100);
assertTrue("El anyo 9966 es bisiesto", primerBisiesto.esBisiesto());
assertFalse("El anyo 1 no es bisiesto",noBisiesto.esBisiesto());
assertTrue("El anyo 4 es bisiesto", segundoBisiesto.esBisiesto());
assertTrue("El anyo 400 es bisiesto", tercerBisiesto.esBisiesto());
assertFalse("El anyo 100 no es bisiesto",segundoNoBisiesto.esBisiesto());
}
@Test
public void testEsFechaValida()
{
Fecha valida = new Fecha(1, 1, 1);
Fecha segundaValida = new Fecha(31, 10, 9999);
Fecha bisiestaValida = new Fecha(29, 2, 9996);
assertTrue("La fecha 01/01/0001 es valida", valida.esFechaValida());
assertTrue("La fecha 31/10/9999 es valida", segundaValida.esFechaValida());
assertTrue("La fecha 29/02/9996 es valida", bisiestaValida.esFechaValida());
}
@Test
public void testGetDiaDeSemana()
{
Fecha martes = new Fecha(1, 2, 2011);
Fecha miercolesBisiesto = new Fecha(29, 02, 2012);
Fecha primerDia = new Fecha(1, 1, 1);
Fecha ultimoDia = new Fecha(31, 12, 9999);
assertThat("El 01/02/2011 es martes", martes.getDiaDeSemana(), is(2));
assertThat("El 01/02/2011 no es miercoles", martes.getDiaDeSemana(), is(not(3)));
assertThat("El 29/02/2012 es bisiesto", miercolesBisiesto.esBisiesto(), is(true));
assertThat("El 29/02/2012 de un anyo bisiesto es miercoles", miercolesBisiesto.getDiaDeSemana(), is(3));
assertThat("El 01/01/0001 es lunes", primerDia.getDiaDeSemana(), is(1));
assertThat("El 31/12/9999 es viernes", ultimoDia.getDiaDeSemana(), is(5));
}
@Test(expected = IllegalArgumentException.class)
public void testSetFechaExcepcion()
{
Fecha erronea = new Fecha();
erronea.setFecha(0, 0, 0000);
}
@Test
public void testSetFecha()
{
Fecha correcta = new Fecha();
correcta.setFecha(1, 11, 2012);
assertThat("El dia debe ser 1", correcta.getDia(), is(1));
assertThat("El mes debe ser 11", correcta.getMes(), is(11));
assertThat("El anyo debe ser 2012", correcta.getAnyo(), is(2012));
}
@Test(expected = IllegalArgumentException.class)
public void testSetAnyo()
{
Fecha setterTest = new Fecha();
setterTest.setAnyo(99999);
}
@Test(expected = IllegalArgumentException.class)
public void testSetMes()
{
Fecha setterTest = new Fecha();
setterTest.setMes(-2);
}
@Test(expected = IllegalArgumentException.class)
public void testSetDia()
{
Fecha setterDia = new Fecha();
setterDia.setDia(-1);
}
@Test
public void testDiaMax()
{
Fecha diaMaxFebreroBisiesto = new Fecha(1, 02, 2012);
Fecha diaMaxOctubre = new Fecha(1, 10, 2012);
Fecha diaMaxFebrero = new Fecha(1, 02, 2013);
Fecha diaMaxSeptiembre = new Fecha(1, 9, 2012);
assertThat(diaMaxFebreroBisiesto.getDiaMax(), is(29));
assertThat(diaMaxFebrero.getDiaMax(), is(28));
assertThat(diaMaxOctubre.getDiaMax(), is(31));
assertThat(diaMaxSeptiembre.getDiaMax(), is(30));
}
@Test
public void testToString()
{
Fecha testString = new Fecha(1, 2, 2011);
assertThat(testString.toString(), is("Martes, 1 de febrero de 2011."));
}
@Test
public void testSiguienteAnyo()
{
Fecha testAnyoBisiesto = new Fecha(29, 2, 2012);
Fecha testAnyo = new Fecha(27, 9, 2014);
assertThat("La fecha deberia ser Jueves, 28 de febrero de 2013.",
testAnyoBisiesto.siguienteAnyo().toString(), is("Jueves, 28 de febrero de 2013."));
assertThat("La fecha deberia ser Domingo, 27 de septiembre de 2015.",
testAnyo.siguienteAnyo().toString(), is("Domingo, 27 de septiembre de 2015."));
}
@Test(expected = IllegalStateException.class)
public void testSiguienteAnyoException()
{
Fecha testAnyoErroneo = new Fecha(1, 1, 9999);
assertThat(testAnyoErroneo.siguienteAnyo().toString(), is(""));
}
@Test
public void testSiguienteMes()
{
Fecha mesSiguienteBisiesto = new Fecha(31, 1, 2012);
Fecha mesSiguienteNoBisiesto = new Fecha(31, 1, 2013);
Fecha mesSiguienteFinDeAnyo = new Fecha(31, 12, 2013);
Fecha mesSiguienteTreinta = new Fecha(31, 10, 2014);
assertThat("La fecha deberia ser Miercoles, 29 de febrero de 2012.",
mesSiguienteBisiesto.siguienteMes().toString(),is("Miercoles, 29 de febrero de 2012."));
assertThat("La fecha deberia ser Jueves, 28 de febrero de 2013.",
mesSiguienteNoBisiesto.siguienteMes().toString(), is("Jueves, 28 de febrero de 2013."));
assertThat("La fecha deberia ser Viernes, 31 de enero de 2014.",
mesSiguienteFinDeAnyo.siguienteMes().toString(), is("Viernes, 31 de enero de 2014."));
assertThat("La fecha deberia ser Domingo, 30 de noviembre de 2014.",
mesSiguienteTreinta.siguienteMes().toString(), is("Domingo, 30 de noviembre de 2014."));
}
@Test(expected = IllegalStateException.class)
public void testSiguienteMesException()
{
Fecha mesSiguienteException = new Fecha(31, 12, 9999);
assertThat(mesSiguienteException.siguienteMes().toString(), is(""));
}
@Test(expected = IllegalStateException.class)
public void testSiguienteDiaException()
{
Fecha diaSiguienteException = new Fecha(31, 12, 9999);
assertThat(diaSiguienteException.siguienteDia().toString(), is(""));
}
@Test
public void testSiguienteDia()
{
Fecha anyoNuevo = new Fecha(31, 12, 2013);
Fecha mesNuevo = new Fecha(30, 11, 2013);
Fecha diaNuevo = new Fecha(1, 1, 2013);
assertThat("La fecha deberia ser Miercoles, 1 de enero de 2014.",
anyoNuevo.siguienteDia().toString(), is("Miercoles, 1 de enero de 2014."));
assertThat("La fecha deberia ser Domingo, 1 de diciembre de 2013.",
mesNuevo.siguienteDia().toString(), is("Domingo, 1 de diciembre de 2013."));
assertThat("La fecha deberia ser Miercoles, 2 de enero de 2013.",
diaNuevo.siguienteDia().toString(), is("Miercoles, 2 de enero de 2013."));
}
@Test
public void testAnteriorAnyo()
{
Fecha testAnyoBisiesto = new Fecha(29, 2, 2012);
Fecha testAnyo = new Fecha(27, 9, 2014);
assertThat("La fecha deberia ser Lunes, 28 de febrero de 2011.",
testAnyoBisiesto.anteriorAnyo().toString(), is("Lunes, 28 de febrero de 2011."));
assertThat("La fecha deberia ser Viernes, 27 de septiembre de 2013.",
testAnyo.anteriorAnyo().toString(), is("Viernes, 27 de septiembre de 2013."));
}
@Test
public void testAnteriorMes()
{
Fecha mesAnteriorBisiesto = new Fecha(31, 1, 2012);
Fecha mesAnteriorNoBisiesto = new Fecha(31, 1, 2013);
Fecha mesAnteriorTreinta = new Fecha(31, 10, 2014);
assertThat("La fecha deberia ser Sabado, 31 de diciembre de 2011.",
mesAnteriorBisiesto.anteriorMes().toString(),is("Sabado, 31 de diciembre de 2011."));
assertThat("La fecha deberia ser Lunes, 31 de diciembre de 2012.",
mesAnteriorNoBisiesto.anteriorMes().toString(), is("Lunes, 31 de diciembre de 2012."));
assertThat("La fecha deberia ser Martes, 30 de septiembre de 2014.",
mesAnteriorTreinta.anteriorMes().toString(), is("Martes, 30 de septiembre de 2014."));
}
@Test
public void testAnteriorDia()
{
Fecha anyoNuevo = new Fecha(31, 12, 2013);
Fecha diaNuevo = new Fecha(1, 1, 2013);
assertThat("La fecha deberia ser Lunes, 30 de diciembre de 2013.",
anyoNuevo.anteriorDia().toString(), is("Lunes, 30 de diciembre de 2013."));
assertThat("La fecha deberia ser Lunes, 31 de diciembre de 2012.",
diaNuevo.anteriorDia().toString(), is("Lunes, 31 de diciembre de 2012."));
}
}
| [
"eduardo_brito27@hotmail.com"
] | eduardo_brito27@hotmail.com |
f38bf0dcc6a696e714bcc9255c5937e53f242e28 | cb91955a8a42f3084170c80f600ab98c17611201 | /test/de/jungblut/datastructure/AsyncBufferedOutputStreamTest.java | c6cfc3c92958d23828ca4d4a1f7a06bb0084daad | [
"Apache-2.0"
] | permissive | EtashGuha/thomasjungblut-common | bb4c5279feb95e2127295b328b86d74d069b2bb8 | 26c694dfbf43259394f95a0e88b7114b1b89122a | refs/heads/master | 2020-03-28T07:24:04.294149 | 2017-07-01T16:46:50 | 2017-07-01T16:46:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,621 | java | package de.jungblut.datastructure;
import static org.junit.Assert.assertEquals;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Arrays;
import org.junit.Test;
public class AsyncBufferedOutputStreamTest {
@Test
public void testHugeWrites() throws Exception {
Path tmpDir = Files.createTempDirectory("tmp");
File tempFile = File.createTempFile("async_test_huge", "tmp",
tmpDir.toFile());
tempFile.deleteOnExit();
byte[] ones = new byte[513 * 1024];
Arrays.fill(ones, (byte) 1);
try (AsyncBufferedOutputStream out = new AsyncBufferedOutputStream(
new FileOutputStream(tempFile), 512 * 1024)) {
// write a few small data to prefill the buffer
out.write(25);
out.write(22);
out.write(ones, 0, ones.length);
}
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(
tempFile))) {
int numItems = 513 * 1024;
assertEquals(25, in.read());
assertEquals(22, in.read());
for (int i = 0; i < numItems; i++) {
assertEquals(1, in.read());
}
}
}
@Test
public void testOverflowWrites() throws Exception {
File tempFile = File.createTempFile("async_test_overflow", "tmp", new File(
"/tmp/"));
tempFile.deleteOnExit();
byte[] ones = new byte[32];
Arrays.fill(ones, (byte) 1);
byte[] zeros = new byte[32];
int numItems = 200;
// only 20 bytes buffered
try (AsyncBufferedOutputStream out = new AsyncBufferedOutputStream(
new FileOutputStream(tempFile), 20)) {
// test write 32 bytes 1s, and 32 bytes 0s
for (int i = 0; i < numItems; i++) {
out.write(ones);
out.write(zeros);
}
}
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(
tempFile))) {
byte[] buf = new byte[32];
for (int i = 0; i < numItems; i++) {
int read = in.read(buf);
assertEquals(32, read);
for (int x = 0; x < 32; x++) {
assertEquals(1, buf[x]);
}
read = in.read(buf);
assertEquals(32, read);
for (int x = 0; x < 32; x++) {
assertEquals(0, buf[x]);
}
}
}
}
@Test
public void testWrites() throws Exception {
File tempFile = File.createTempFile("async_test", "tmp", new File("/tmp/"));
tempFile.deleteOnExit();
byte[] ones = new byte[32];
Arrays.fill(ones, (byte) 1);
byte[] zeros = new byte[32];
int numItems = 10000;
try (AsyncBufferedOutputStream out = new AsyncBufferedOutputStream(
new FileOutputStream(tempFile), 2 * 1024)) {
// test write 32 bytes 1s, and 32 bytes 0s
for (int i = 0; i < numItems; i++) {
out.write(ones);
out.write(zeros);
}
}
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(
tempFile))) {
byte[] buf = new byte[32];
for (int i = 0; i < numItems; i++) {
int read = in.read(buf);
assertEquals(32, read);
for (int x = 0; x < 32; x++) {
assertEquals(1, buf[x]);
}
read = in.read(buf);
assertEquals(32, read);
for (int x = 0; x < 32; x++) {
assertEquals(0, buf[x]);
}
}
}
}
@Test
public void testRaceWrites() throws Exception {
File tempFile = File.createTempFile("async_test_race_writes", "tmp",
new File("/tmp/"));
tempFile.deleteOnExit();
byte[] ones = new byte[32];
Arrays.fill(ones, (byte) 1);
byte[] zeros = new byte[32];
int numItems = 2500;
AsyncBufferedOutputStream out = new AsyncBufferedOutputStream(
new FileOutputStream(tempFile), 512 * 1024);
// test write 32 bytes 1s, and 32 bytes 0s for 1gb
for (int i = 0; i < numItems; i++) {
out.write(ones);
out.write(zeros);
}
// we wait ~2s before all items are written asynchronously
Thread.sleep(2000L);
// now close would wait for an item to add infinitely
out.close();
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(
tempFile))) {
byte[] buf = new byte[32];
for (int i = 0; i < numItems; i++) {
int read = in.read(buf);
assertEquals(32, read);
for (int x = 0; x < 32; x++)
assertEquals(1, buf[x]);
read = in.read(buf);
assertEquals(32, read);
for (int x = 0; x < 32; x++)
assertEquals(0, buf[x]);
}
}
}
}
| [
"thomas.jungblut@gmail.com"
] | thomas.jungblut@gmail.com |
7735f48e26b128c3c7cfd375e6710160ceff43bb | 84e064c973c0cc0d23ce7d491d5b047314fa53e5 | /latest9.3/hej/net/sf/saxon/sxpath/IndependentContext.java | b31f152b9d2d7a9c8a66ad57a87ec23f0b9385c5 | [] | no_license | orbeon/saxon-he | 83fedc08151405b5226839115df609375a183446 | 250c5839e31eec97c90c5c942ee2753117d5aa02 | refs/heads/master | 2022-12-30T03:30:31.383330 | 2020-10-16T15:21:05 | 2020-10-16T15:21:05 | 304,712,257 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 17,010 | java | package net.sf.saxon.sxpath;
import net.sf.saxon.Configuration;
import net.sf.saxon.lib.NamespaceConstant;
import net.sf.saxon.expr.Container;
import net.sf.saxon.expr.VariableReference;
import net.sf.saxon.expr.Expression;
import net.sf.saxon.expr.instruct.SlotManager;
import net.sf.saxon.om.*;
import net.sf.saxon.tree.iter.AxisIterator;
import net.sf.saxon.trans.XPathException;
import net.sf.saxon.type.Type;
import net.sf.saxon.type.ItemType;
import net.sf.saxon.type.AnyItemType;
import net.sf.saxon.value.QNameValue;
import java.io.Serializable;
import java.util.*;
/**
* An IndependentContext provides a context for parsing an XPath expression appearing
* in a context other than a stylesheet.
*
* <p>This class is used in a number of places where freestanding XPath expressions occur.
* These include the native Saxon XPath API, the .NET XPath API, XPath expressions used
* in XML Schema identity constraints, and XPath expressions supplied to saxon:evaluate().
* It is not used by the JAXP XPath API (though it shares code with that API through
* the common superclass AbstractStaticContext).</p>
*
* <p>This class currently provides no mechanism for binding user-defined functions.</p>
*/
public class IndependentContext extends AbstractStaticContext
implements XPathStaticContext, NamespaceResolver, Serializable {
protected HashMap<String, String> namespaces = new HashMap<String, String>(10);
protected HashMap<StructuredQName, XPathVariable> variables = new HashMap<StructuredQName, XPathVariable>(20);
protected NamespaceResolver externalResolver = null;
protected ItemType requiredContextItemType = AnyItemType.getInstance();
protected Set importedSchemaNamespaces = new HashSet();
protected boolean autoDeclare = false;
/**
* Create an IndependentContext along with a new (non-schema-aware) Saxon Configuration
*/
public IndependentContext() {
this(new Configuration());
}
/**
* Create an IndependentContext using a specific Configuration
* @param config the Saxon configuration to be used
*/
public IndependentContext(Configuration config) {
setConfiguration(config);
clearNamespaces();
setDefaultFunctionLibrary();
usingDefaultFunctionLibrary = true;
}
/**
* Get the granularity of the container.
* @return 0 for a temporary container created during parsing; 1 for a container
* that operates at the level of an XPath expression; 2 for a container at the level
* of a global function or template
*/
public int getContainerGranularity() {
return 1;
}
/**
* Declare a namespace whose prefix can be used in expressions
* @param prefix The namespace prefix. Must not be null. Supplying "" sets the
* default element namespace.
* @param uri The namespace URI. Must not be null.
*/
public void declareNamespace(String prefix, String uri) {
if (prefix==null) {
throw new NullPointerException("Null prefix supplied to declareNamespace()");
}
if (uri==null) {
throw new NullPointerException("Null namespace URI supplied to declareNamespace()");
}
if ("".equals(prefix)) {
setDefaultElementNamespace(uri);
} else {
namespaces.put(prefix, uri);
getNamePool().allocateNamespaceCode(prefix, uri);
}
}
/**
* Clear all the declared namespaces, except for the standard ones (xml, xslt, saxon, xdt).
* This also resets the default element namespace to the "null" namespace
*/
public void clearNamespaces() {
namespaces.clear();
declareNamespace("xml", NamespaceConstant.XML);
declareNamespace("xsl", NamespaceConstant.XSLT);
declareNamespace("saxon", NamespaceConstant.SAXON);
declareNamespace("xs", NamespaceConstant.SCHEMA);
declareNamespace("", "");
}
/**
* Clear all the declared namespaces, including the standard ones (xml, xslt, saxon).
* Leave only the XML namespace and the default namespace (xmlns="").
* This also resets the default element namespace to the "null" namespace.
*/
public void clearAllNamespaces() {
namespaces.clear();
declareNamespace("xml", NamespaceConstant.XML);
declareNamespace("", "");
}
/**
* Declares all the namespaces that are in-scope for a given node, removing all previous
* namespace declarations.
* In addition, the standard namespaces (xml, xslt, saxon) are declared. This method also
* sets the default element namespace to be the same as the default namespace for this node.
* @param node The node whose in-scope namespaces are to be used as the context namespaces.
* If the node is an attribute, text node, etc, then the namespaces of its parent element are used.
*/
public void setNamespaces(NodeInfo node) {
namespaces.clear();
int kind = node.getNodeKind();
if (kind == Type.ATTRIBUTE || kind == Type.TEXT ||
kind == Type.COMMENT || kind == Type.PROCESSING_INSTRUCTION ||
kind == Type.NAMESPACE) {
node = node.getParent();
}
if (node == null) {
return;
}
AxisIterator iter = node.iterateAxis(Axis.NAMESPACE);
while (true) {
NodeInfo ns = (NodeInfo)iter.next();
if (ns == null) {
return;
}
String prefix = ns.getLocalPart();
if ("".equals(prefix)) {
setDefaultElementNamespace(ns.getStringValue());
} else {
declareNamespace(ns.getLocalPart(), ns.getStringValue());
}
}
}
/**
* Set an external namespace resolver. If this is set, then all resolution of namespace
* prefixes is delegated to the external namespace resolver, and namespaces declared
* individually on this IndependentContext object are ignored.
* @param resolver the external NamespaceResolver
*/
public void setNamespaceResolver(NamespaceResolver resolver) {
externalResolver = resolver;
}
/**
* Say whether undeclared variables are allowed. By default, they are not allowed. When
* undeclared variables are allowed, it is not necessary to predeclare the variables that
* may be used in the XPath expression; instead, a variable is automatically declared when a reference
* to the variable is encountered within the expression.
* @param allow true if undeclared variables are allowed, false if they are not allowed.
* @since 9.2
*/
public void setAllowUndeclaredVariables(boolean allow) {
autoDeclare = allow;
}
/**
* Ask whether undeclared variables are allowed. By default, they are not allowed. When
* undeclared variables are allowed, it is not necessary to predeclare the variables that
* may be used in the XPath expression; instead, a variable is automatically declared when a reference
* to the variable is encountered within the expression.
* @return true if undeclared variables are allowed, false if they are not allowed.
* @since 9.2
*/
public boolean isAllowUndeclaredVariables() {
return autoDeclare;
}
/**
* Declare a variable. A variable must be declared before an expression referring
* to it is compiled. The initial value of the variable will be the empty sequence
* @param qname The name of the variable
* @return an XPathVariable object representing information about the variable that has been
* declared.
*/
public XPathVariable declareVariable(QNameValue qname) {
return declareVariable(qname.toStructuredQName());
}
/**
* Declare a variable. A variable must be declared before an expression referring
* to it is compiled. The initial value of the variable will be the empty sequence
* @param namespaceURI The namespace URI of the name of the variable. Supply "" to represent
* names in no namespace (null is also accepted)
* @param localName The local part of the name of the variable (an NCName)
* @return an XPathVariable object representing information about the variable that has been
* declared.
*/
public XPathVariable declareVariable(String namespaceURI, String localName) {
StructuredQName qName = new StructuredQName("", namespaceURI, localName);
return declareVariable(qName);
}
/**
* Declare a variable. A variable must be declared before an expression referring
* to it is compiled. The initial value of the variable will be the empty sequence
* @param qName the name of the variable.
* @return an XPathVariable object representing information about the variable that has been
* declared.
* @since 9.2
*/
public XPathVariable declareVariable(StructuredQName qName) {
XPathVariable var = variables.get(qName);
if (var != null) {
return var;
} else {
var = XPathVariable.make(qName);
int slot = variables.size();
var.setSlotNumber(slot);
variables.put(qName, var);
return var;
}
}
/**
* Get an iterator over all the variables that have been declared, either explicitly by an
* application call on declareVariable(), or implicitly if the option <code>allowUndeclaredVariables</code>
* is set.
* @return an iterator; the objects returned by this iterator will be instances of XPathVariable
* @since 9.2
*/
public Iterator<XPathVariable> iterateExternalVariables() {
return variables.values().iterator();
}
/**
* Get the declared variable with a given name, if there is one
* @param qName the name of the required variable
* @return the explicitly or implicitly declared variable with this name if it exists,
* or null otherwise
* @since 9.2
*/
public XPathVariable getExternalVariable(StructuredQName qName) {
return variables.get(qName);
}
/**
* Get the slot number allocated to a particular variable
* @param qname the name of the variable
* @return the slot number, or -1 if the variable has not been declared
*/
public int getSlotNumber(QNameValue qname) {
StructuredQName sq = qname.toStructuredQName();
XPathVariable var = variables.get(sq);
if (var == null) {
return -1;
}
return var.getLocalSlotNumber();
}
/**
* Get the URI for a prefix, using the declared namespaces as
* the context for namespace resolution. The default namespace is NOT used
* when the prefix is empty.
* This method is provided for use by the XPath parser.
* @param prefix The prefix
* @throws net.sf.saxon.trans.XPathException if the prefix is not declared
*/
public String getURIForPrefix(String prefix) throws XPathException {
String uri = getURIForPrefix(prefix, false);
if (uri==null) {
throw new XPathException("Prefix " + prefix + " has not been declared");
}
return uri;
}
public NamespaceResolver getNamespaceResolver() {
if (externalResolver != null) {
return externalResolver;
} else {
return this;
}
}
/**
* Get the namespace URI corresponding to a given prefix. Return null
* if the prefix is not in scope.
* @param prefix the namespace prefix
* @param useDefault true if the default namespace is to be used when the
* prefix is ""
* @return the uri for the namespace, or null if the prefix is not in scope.
* Return "" if the prefix maps to the null namespace.
*/
public String getURIForPrefix(String prefix, boolean useDefault) {
if (externalResolver != null) {
return externalResolver.getURIForPrefix(prefix, useDefault);
}
if (prefix.length() == 0) {
return useDefault ? getDefaultElementNamespace() : "";
} else {
return namespaces.get(prefix);
}
}
/**
* Get an iterator over all the prefixes declared in this namespace context. This will include
* the default namespace (prefix="") and the XML namespace where appropriate
*/
public Iterator iteratePrefixes() {
if (externalResolver != null) {
return externalResolver.iteratePrefixes();
} else {
return namespaces.keySet().iterator();
}
}
/**
* Bind a variable used in an XPath Expression to the XSLVariable element in which it is declared.
* This method is provided for use by the XPath parser, and it should not be called by the user of
* the API, or overridden, unless variables are to be declared using a mechanism other than the
* declareVariable method of this class.
* @param qName the name of the variable
* @return the resulting variable reference
*/
public Expression bindVariable(StructuredQName qName) throws XPathException {
XPathVariable var = variables.get(qName);
if (var==null) {
if (autoDeclare) {
return new VariableReference(declareVariable(qName));
} else {
throw new XPathException("Undeclared variable in XPath expression: $" + qName.getClarkName());
}
} else {
return new VariableReference(var);
}
}
/**
* Get a Stack Frame Map containing definitions of all the declared variables. This will return a newly
* created object that the caller is free to modify by adding additional variables, without affecting
* the static context itself.
*/
public SlotManager getStackFrameMap() {
SlotManager map = getConfiguration().makeSlotManager();
XPathVariable[] va = new XPathVariable[variables.size()];
for (Iterator<XPathVariable> v = variables.values().iterator(); v.hasNext();) {
XPathVariable var = v.next();
va[var.getLocalSlotNumber()] = var;
}
for (int i=0; i<va.length; i++) {
map.allocateSlotNumber(va[i].getVariableQName());
}
return map;
}
public boolean isImportedSchema(String namespace) {
return importedSchemaNamespaces.contains(namespace);
}
/**
* Get the set of imported schemas
* @return a Set, the set of URIs representing the names of imported schemas
*/
public Set<String> getImportedSchemaNamespaces() {
return importedSchemaNamespaces;
}
/**
* Register the set of imported schema namespaces
* @param namespaces the set of namespaces for which schema components are available in the
* static context
*/
public void setImportedSchemaNamespaces(Set namespaces) {
importedSchemaNamespaces = namespaces;
if (!namespaces.isEmpty()) {
setSchemaAware(true);
}
}
/**
* Declare the static type of the context item. If this type is declared, and if a context item
* is supplied when the query is invoked, then the context item must conform to this type (no
* type conversion will take place to force it into this type).
* @param type the required type of the context item
* @since 9.3
*/
public void setRequiredContextItemType(ItemType type) {
requiredContextItemType = type;
}
/**
* Get the required type of the context item. If no type has been explicitly declared for the context
* item, an instance of AnyItemType (representing the type item()) is returned.
* @return the required type of the context item
* @since 9.3
*/
public ItemType getRequiredContextItemType() {
return requiredContextItemType;
}
}
//
// The contents of this file are subject to the Mozilla Public License Version 1.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.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied.
// See the License for the specific language governing rights and limitations under the License.
//
// The Original Code is: all this file.
//
// The Initial Developer of the Original Code is Michael H. Kay
//
// Portions created by (your name) are Copyright (C) (your legal entity). All Rights Reserved.
//
// Contributor(s): none.
//
| [
"mike@saxonica.com"
] | mike@saxonica.com |
df518445a86620e2ff9d09666a2ae88cf9861472 | 7e28cd735b9c64230851d8714e0dbf18354eff6c | /chapter_002/src/main/java/io/socket/EchoServer.java | 05abc1c8f0e3d2291f15a51062b8a936e4c49fdf | [] | no_license | Sekator778/job4j_design | 9d91a34b8ff32ddcf37e23df54b83a1bd790663d | 815313e3b4794fd3bd89a780b077834946576cf2 | refs/heads/master | 2023-05-24T22:18:50.692202 | 2022-04-07T14:06:20 | 2022-04-07T14:06:20 | 246,309,323 | 6 | 0 | null | 2020-10-13T20:15:05 | 2020-03-10T13:33:10 | Java | UTF-8 | Java | false | false | 1,906 | java | package io.socket;
import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
/**
* msg=Hello > Hello.
*
* msg=Exit > Завершить работу сервера.
*
* msg=Any > Any.
* где any такой вывод я хз там чето поусловию было сервер https://curl.haxx.se
* прысылал такого типа меседж ыаауа= вауму
* вообщем если надо то тут где Any поменять формат вывода на свой
*/
public class EchoServer {
public static void main(String[] args) throws IOException {
try (ServerSocket server = new ServerSocket(9000)) {
while (!server.isClosed()) {
Socket socket = server.accept();
try (OutputStream out = socket.getOutputStream();
BufferedReader in = new BufferedReader(
new InputStreamReader(socket.getInputStream()))) {
String str = in.readLine();
while (!(str.isEmpty())) {
if (str.contains("exit")) {
out.write("Server close\n".getBytes());
server.close();
} else if (str.contains("hello")) {
out.write("Hello, dear friend.\n".getBytes());
break;
} else {
str = str.substring(str.indexOf("=") + 1);
int x = str.indexOf("H");
str = str.substring(0, x);
out.write(str.getBytes());
out.write("\r\n".getBytes());
break;
}
str = in.readLine();
}
}
}
}
}
} | [
"sekator778@gmail.com"
] | sekator778@gmail.com |
efb3dbcea69d332144ff38d6ece111fe0f2af5f1 | cf4388cc2b8fb44443202b4bd57d87341b43a18b | /app/src/main/java/org/imemorize/fragments/MemorizeActivityInstructionsDialogFragment.java | d9b1058e626390780a1f4a25405918b3605c7dd6 | [] | no_license | Heeten/iMemorizeAndroidStudio | a7074d4a7abdf367ed4adb3d6346fd49c12305ed | c2b0c65234ddd89377cd03836996e9a7421a2cde | refs/heads/master | 2021-01-21T07:19:55.964819 | 2018-06-15T02:32:56 | 2018-06-15T02:32:56 | 23,450,316 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package org.imemorize.fragments;
import android.app.AlertDialog;
import android.app.Dialog;
import android.support.v4.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
import org.imemorize.R;
/**
* Created by briankurzius on 6/8/13.
*/
public class MemorizeActivityInstructionsDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
//builder.setTitle(R.string.choose_font_size)
builder.setMessage(R.string.prompt_memorize_activity_instructions)
.setTitle(R.string.prompt_memorize_activity_instructions_title)
// Set the action buttons
.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
});
// Create the AlertDialog object and return it
return builder.create();
}
}
| [
"bkurzius@gmail.com"
] | bkurzius@gmail.com |
9cd37c4cba2a7186f320bcd438c16603e7745d72 | 95df480a847992f4178e85ef9845f29401818ff1 | /src/main/java/com/aaa/dao/FMpersonaldao.java | 62f6e20d917700756c84554a25957316be6b511a | [] | no_license | lpy0825/aaa | 3dab7c595ed92e2a3f2d905dfaf369184842987c | 4b4d481e5c70fd69bf4f01a0428653f59cd43d23 | refs/heads/master | 2020-04-02T08:48:59.322522 | 2018-11-08T18:19:29 | 2018-11-08T18:19:29 | 154,262,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,107 | java | package com.aaa.dao;
import com.aaa.entity.FMpersonal;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@Mapper
public interface FMpersonaldao {
/*
查询所有个人认证
*/
@Select("SELECT\n" +
"fmpersonal.pid,\n" +
"fmpersonal.`name`,\n" +
"fmpersonal.eid,\n" +
"fmpersonal.eimage,\n" +
"fmuser.Fmuname,\n" +
"fmauthentication.Authentication\n" +
"FROM\n" +
"fmpersonal\n" +
"INNER JOIN fmuser ON fmpersonal.Fmuid = fmuser.Fmuid\n" +
"INNER JOIN fmauthentication ON fmpersonal.Fmaid = fmauthentication.aid\n" +
"\n")
public List<Map<String,Object>> queryFMpersonal();
/*
按ID查询
*/
@Select("SELECT\n" +
"fmpersonal.pid,\n" +
"fmpersonal.`name`,\n" +
"fmpersonal.eid,\n" +
"fmpersonal.eimage,\n" +
"fmuser.Fmuname,\n" +
"fmuser.Fmuid,\n" +
"fmauthentication.Authentication\n" +
"FROM\n" +
"fmpersonal\n" +
"INNER JOIN fmuser ON fmpersonal.Fmuid = fmuser.Fmuid\n" +
"INNER JOIN fmauthentication ON fmpersonal.Fmaid = fmauthentication.aid where pid=#{pid}\n" +
"\n")
public List<Map<String,Object>> queryPid(@Param("pid") Integer pid);
/*
查询所有未审核
*/
@Select("SELECT\n" +
"fmpersonal.pid,\n" +
"fmpersonal.`name`,\n" +
"fmpersonal.eid,\n" +
"fmpersonal.eimage,\n" +
"fmauthentication.Authentication,\n" +
"fmuser.Fmuname,\n" +
"fmuser.shenhe\n" +
"FROM\n" +
"fmpersonal\n" +
"INNER JOIN fmauthentication ON fmpersonal.Fmaid = fmauthentication.aid\n" +
"INNER JOIN fmuser ON fmpersonal.Fmuid = fmuser.Fmuid where shenhe=0\n")
public List<Map<String,Object>> queryFMpersonalsh();
}
| [
"40828442@qq.com"
] | 40828442@qq.com |
30d186f9dfecc844c618e5414752190bd9931519 | 9103a7d70263a86e72945663cfa01254f62316ef | /jakarta/graph-janus/src/main/java/org/jnosql/endgame/jakarta/janus/HRSRepositoryApp.java | f28e5aa076d8693451559e86462f16401348f95e | [
"Apache-2.0"
] | permissive | ThirumlaDevi/nosql-endgame | 857c17af14fd62e30ca89df842c91cd3e3b79d3d | 3e18abef02001b19793c29ab2c1f58c1bcaa2979 | refs/heads/master | 2023-02-03T17:22:51.214593 | 2020-12-18T13:17:39 | 2020-12-18T13:17:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,324 | java | /*
* Copyright (c) 2017 Otávio Santana and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Apache License v2.0 which accompanies this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
*
* You may elect to redistribute this code under either of these licenses.
*
* Contributors:
*
* Otavio Santana
* Werner Keil
*/
package org.jnosql.endgame.jakarta.janus;
import org.eclipse.jnosql.artemis.DatabaseQualifier;
import org.jnosql.endgame.jakarta.janus.model.Person;
import org.jnosql.endgame.jakarta.janus.repository.PersonRepository;
import javax.enterprise.inject.se.SeContainer;
import javax.enterprise.inject.se.SeContainerInitializer;
public final class HRSRepositoryApp {
private HRSRepositoryApp() {
}
@SuppressWarnings("unused")
public static void main(String[] args) {
try (SeContainer container = SeContainerInitializer.newInstance().initialize()) {
PersonRepository repository = container.select(PersonRepository.class, DatabaseQualifier.ofGraph()).get();
Person bruce = repository.save(Person.builder().withAge(30).withName("Bruce")
.withOccupation("Developer").withSalary(3_000D).build());
Person natalia = repository.save(Person.builder().withAge(32).withName("Natalia")
.withOccupation("Developer").withSalary(5_000D).build());
Person pepper = repository.save(Person.builder().withAge(40).withName("Pepper")
.withOccupation("Design").withSalary(1_000D).build());
Person tony = repository.save(Person.builder().withAge(22).withName("Tony")
.withOccupation("Developer").withSalary(4_500D).build());
System.out.println("findByOccupationAndSalaryGreaterThan");
repository.findByOccupationAndSalaryGreaterThan("Developer", 3_000D)
.forEach(System.out::println);
System.out.println("findByAgeBetween");
repository.findByAgeBetween(20, 30)
.forEach(System.out::println);
}
}
}
| [
"werner.keil@gmx.net"
] | werner.keil@gmx.net |
bd4da8a9e2c1fcf7c6cf03dfbdc9fc3d83777554 | 106eb767fac7eac1a888346cf62306f5f7acce49 | /src/SocketExample1/Main_2.java | d5594a65f9ed6c382cbbcb386dc7d83cd93244d2 | [] | no_license | RedlineAlexander/Lab1Korochkin | 9aaaf00e198abbf60a32148c56ac69888d97b5aa | 0b763a26552a19b9d980a93ece402200fab23ab0 | refs/heads/master | 2020-04-16T09:57:23.807945 | 2019-01-13T08:14:58 | 2019-01-13T08:14:58 | 165,483,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 313 | java | package SocketExample1;
public class Main_2 {
public static void main(String[] args) {
Data x = new Data();
new Thread(new MyServer1(x)).start();
new Thread(new MyServer2(x)).start();
new Thread(new MyClient1()).start();
new Thread(new MyClient2()).start();
}
}
| [
"redlinerailmetro@gmail.com"
] | redlinerailmetro@gmail.com |
6a0ece49fa479846243c0b13d625df30f615c40f | 95a6643e088f10c1cf372979cd12fee90a32bc35 | /cracking-the-coding-interview/src/chapter_3/stack_queue/Animal.java | 55afbb13cfd43e44305a33b89b2b02432b4da18b | [
"MIT"
] | permissive | rishabhs2016/crack-the-code | d5e4783f52aef1ea267b77933e12a7a3b8642706 | b4a12b8c062ca89d033bc48c36ad4f43f7471012 | refs/heads/master | 2022-02-18T14:59:59.406266 | 2017-08-23T05:31:44 | 2017-08-23T05:31:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 921 | java | package chapter_3.stack_queue;
/**
* abstract class Animal
*
* @param <T>
* @author Sudharsanan Muralidharan
*/
public abstract class Animal<T> {
private T name;
private int order;
public Animal(T name) {
this.name = name;
}
public T getName() {
return name;
}
public void setName(T name) {
this.name = name;
}
public int getOrder() {
return order;
}
public void setOrder(int order) {
this.order = order;
}
public boolean isOlderThan(Animal<T> animal) {
return (this.order < animal.order);
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Name: ").append(this.name).append(" Of Type: ").append(this.getClass().getSimpleName());
builder.append(" Of Order: ").append(this.order);
return builder.toString();
}
}
| [
"sudhar.ti@gmail.com"
] | sudhar.ti@gmail.com |
f00de683b7eac8497782a1bcfefff46ec9572848 | b32efc39bda39afe599514a742efc71dda2d17d6 | /app/src/main/java/tomerbu/edu/notificationsandtouch/MyFirebaseMessagingService.java | 63be92a581b03a4ab8d750feee5f7fdeb5cb58a3 | [] | no_license | nesscollege2016/NotificationsAndTouch | c1f533562f8212f794fcd8da0dc21de8b25cb4cc | 96ff0c83c8ed8250b6dbee2d493501e00e736cfc | refs/heads/master | 2021-01-13T09:26:05.230855 | 2016-09-22T08:52:10 | 2016-09-22T08:52:10 | 68,938,065 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,485 | java | package tomerbu.edu.notificationsandtouch;
import android.app.Notification;
import android.support.v4.app.NotificationCompat;
import android.support.v4.app.NotificationManagerCompat;
import android.util.Log;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import java.util.Map;
/**
* Created by dev on 9/22/2016.
*/
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private String TAG = "Ness";
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
super.onMessageReceived(remoteMessage);
Log.i(TAG, "MessageReceived");
Map<String, String> data = remoteMessage.getData();
String message = data.get("messagses");
String title = data.get("Title");
String icon = data.get("icon");
sendNotification(title, message, icon);
}
private void sendNotification(final String title, final String message, String icon) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(getApplicationContext());
builder.setContentTitle(title);
builder.setContentText(message);
builder.setSmallIcon(R.mipmap.ic_launcher);
Notification notification = builder.build();
NotificationManagerCompat notificationManagerCompat = NotificationManagerCompat.from(getApplicationContext());
notificationManagerCompat.notify(10, notification);
}
}
| [
"nesscollege2016@gmail.com"
] | nesscollege2016@gmail.com |
f93402ea25e85c4fdd95ca68b6a53914ae4599d5 | b30a4167a6724db191d194622eb3f824fa6d1bfc | /Service3.java | 0da51d9952f9694a7547bc2931e44751c7f88181 | [] | no_license | VanshikaNigam/Hotel_Management | 4a4ad9064c76f8e79220ff982fc1efda69489747 | fe854c4a27e09679a153e26e1d8d1f55a46ff0a7 | refs/heads/master | 2021-01-19T14:41:44.353416 | 2017-08-21T05:40:38 | 2017-08-21T05:40:38 | 100,915,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | import javax.swing.*;
public class Service3 extends JDialog
{
Service3()
{
setTitle("The Grand Mystic Falls Hotel-Services");
setSize(400,300);
setModal(true);
JLabel j=new JLabel("Services in our CLASSIC rooms are:");
JLabel ja=new JLabel("1.Morning Tea");
JLabel jb=new JLabel("2.Breafast");
JLabel jd=new JLabel("3.Lunch");
JLabel jf=new JLabel("4.Evening Snacks");
JLabel jg=new JLabel("5.Dinner");
j.setBounds(40,40,280,40);
ja.setBounds(20,90,140,30);
jb.setBounds(20,110,160,30);
jd.setBounds(20,130,180,30);
jf.setBounds(20,150,200,30);
jg.setBounds(20,170,220,30);
add(j);
add(ja);
add(jb);
add(jd);
add(jf);
add(jg);
ImageIcon i=new ImageIcon("bk.jpg");
JLabel img=new JLabel(i);
add(img);
setVisible(true);
}
} | [
"vanshika@Vanshikas-MacBook-Pro.local"
] | vanshika@Vanshikas-MacBook-Pro.local |
e8a3d60a0f96df2fa4f8d41c01c3835988d9a335 | 5b2eb8bd686db35c30925e82054ec5cc715c9f66 | /TenantProvisioning/src/com/persistent/cloudninja/utils/TenantProfileUtility.java | 379ebd2b9db9d929e9bf058243b592ec3c8f1588 | [
"Apache-2.0"
] | permissive | winevideo/PersistentSys-cloudninja-for-java-0a3bd32 | c48965ccddf230ed9bbc6f160234d73b982464cf | 36a643bcadb0673b8eb8b84e75a6fd3e3d546f09 | refs/heads/master | 2021-01-01T19:11:38.645131 | 2013-01-02T22:36:03 | 2013-01-02T22:36:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,490 | java | /*******************************************************************************
* Copyright 2012 Persistent Systems Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.persistent.cloudninja.utils;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class TenantProfileUtility {
@Value("#{'${jdbc.url}'}")
private String url;
@Value("#{'${jdbc.username}'}")
private String username;
@Value("#{'${jdbc.password}'}")
private String password;
@Value("#{'${jdbc.masterdb}'}")
private String MASTER_DB;
@Value("#{'${jdbc.primarydb}'}")
private String PRIMARY_DB;
/**
* Drops the tenant database.
*
* @param tenantDB
*/
public void deleteTenant(String tenantDB) {
Connection conn = null;
Statement stmt = null;
final String DROP_TENANT = "DROP DATABASE " + tenantDB;
int index = url.indexOf("=");
String connUrl = url.substring(0, index + 1) + MASTER_DB + ";";
try{
//JDBC driver
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//Open connection
conn = DriverManager.getConnection(connUrl,username,password);
//Query Execution
stmt = conn.createStatement();
stmt.executeUpdate(DROP_TENANT);
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}finally{
closeStatement(stmt);
closeConnection(conn);
}
}
/**
* Deletes Member records from Member for the tenant.
*
* @param tenantId
* @param tenantDB
*/
public void deleteMemberRecords(String tenantId,String tenantDB) {
Connection conn = null;
Statement stmt = null;
final String DELETE_MEMBER_TABLE_RECORDS = "DELETE FROM Member WHERE TenantId='" + tenantId + "'";
int index = url.indexOf("=");
String connUrl = url.substring(0, index + 1) + PRIMARY_DB + ";";
try{
//JDBC driver
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//Open connection
conn = DriverManager.getConnection(connUrl,username,password);
//Query Execution
stmt = conn.createStatement();
stmt.executeUpdate(DELETE_MEMBER_TABLE_RECORDS);
}catch(SQLException se){
se.printStackTrace();
}catch(Exception e){
e.printStackTrace();
}finally{
closeStatement(stmt);
closeConnection(conn);
}//end try
}
/**
* Close Statement
*/
public void closeStatement(Statement statement) {
if (statement != null) {
try {
statement.close();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
}
}
/**
* Close Connection
*/
public void closeConnection(Connection connection) {
if (connection != null) {
try {
connection.close();
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
}
}
}
| [
"winevideo@gmail.com"
] | winevideo@gmail.com |
0e7e0ee0e88c6e83affc45ec21ef11a84ff61022 | 178a95f3466dc8261d490598c120f67d6bc5120b | /src/test/java/cn/cerc/summer/sample/UtilsExample.java | 50bad24191b28d2652412e59089bebcbce6c3948 | [] | no_license | itjun/java-redis-proxy | 986bfa953105179a47b75cd800e5472d7ac62aaf | 50a6ac1d6fdb9b9e72f0222f21ab56b5c07630a8 | refs/heads/main | 2023-07-06T10:58:56.453753 | 2021-08-14T07:33:34 | 2021-08-14T07:33:34 | 386,809,445 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,508 | java | package cn.cerc.summer.sample;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.cerc.core.DataSet;
import cn.cerc.core.Record;
import cn.cerc.core.TDate;
import cn.cerc.core.TDateTime;
import cn.cerc.core.Utils;
/**
* 框架自带工具简单的使用范例
*/
public class UtilsExample {
private static final Logger log = LoggerFactory.getLogger(UtilsExample.class);
public static void main(String[] args) {
// 时间工具类 TDateTime
log.info("当前时间 {}", TDateTime.now());
log.info("今日日期 {}", TDate.today());
// 数学工具类 Utils
log.info("随机数字 {}", Utils.getNumRandom(12));
log.info("随机字符 {}", Utils.getStrRandom(32));
// DataSet 范例说明
DataSet dataSet = new DataSet();
Record head = dataSet.getHead();
head.setField("tbNo", "AB201903270001");
head.setField("tDate", TDateTime.now());
log.info("dataSet 头部信息 {}", head);
for (int i = 0; i < 2; i++) {
dataSet.append();
dataSet.setField("code_", "code_" + i);
dataSet.setField("name_", "name_" + i);
}
log.info("dataSet 完整信息 {}", dataSet);
// 遍历dataSet数据集获取每个元素的数据
while (dataSet.fetch()) {
String code = dataSet.getString("code_");
String name = dataSet.getString("name_");
log.info("{}, {}", code, name);
}
}
}
| [
"l1091462907@gmail.com"
] | l1091462907@gmail.com |
5ebacd99ee0e1d563300ed56981fbf3bd9d6f73a | 5870fdecf5775396797c19b802ad2735ad9d6307 | /testsA/src/squashTA/resources/selenium/java/INT2Test.java | b3d12a3f31ccde7aaf154b8374cdbbaee2dcc845 | [] | no_license | DjeberMerah/annalogue | 74d38783d61188f3f62085aa55c92055d750d9ae | db1b2174c9b61da56c2d3bced8559da63198efb5 | refs/heads/master | 2022-12-19T08:11:38.246700 | 2020-09-07T19:56:02 | 2020-09-07T19:56:02 | 293,619,577 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,135 | java | // Generated by Selenium IDE
import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.WebClient;
import org.junit.Test;
import org.junit.Before;
import org.junit.After;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.core.IsNot.not;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.Alert;
import org.openqa.selenium.Keys;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
public class INT2Test {
private WebDriver driver;
@Before
public void setUp() {
driver = new HtmlUnitDriver(true) {
@Override
protected WebClient newWebClient(BrowserVersion version) {
WebClient webClient = super.newWebClient(version);
webClient.getOptions().setThrowExceptionOnScriptError(false);
return webClient;
}
};
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
java.util.logging.Logger.getLogger("com.gargoylesoftware").setLevel(Level.OFF);
System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
}
@After
public void tearDown() {
driver.quit();
}
@Test
public void tes() {
driver.get(Adresse.getAdresse());
driver.findElement(By.id("mail")).click();
driver.findElement(By.id("mail")).sendKeys("resp@univ-fcomte.fr");
driver.findElement(By.id("password")).click();
driver.findElement(By.id("password")).sendKeys("1234");
driver.findElement(By.cssSelector(".btn")).click();
driver.findElement(By.linkText("Programmation d'Architecture Multi-tiers")).click();
assertThat(driver.findElement(By.cssSelector("tr:nth-child(1) > .align-middle:nth-child(3)")).getText(), is("TD"));
driver.findElement(By.linkText("Modifier")).click();
driver.findElement(By.id("subject_description")).click();
driver.findElement(By.id("subject_description")).sendKeys("descr");
driver.findElement(By.id("subject_type")).click();
{
WebElement dropdown = driver.findElement(By.id("subject_type"));
dropdown.findElement(By.xpath("//option[. = 'Cours']")).click();
}
driver.findElement(By.cssSelector("option:nth-child(1)")).click();
driver.findElement(By.id("subject_submit")).click();
assertThat(driver.findElement(By.cssSelector("tr:nth-child(1) > .align-middle:nth-child(3)")).getText(), is("Cours"));
driver.findElement(By.linkText("D\u00e9connexion")).click();
}
} | [
"djmerah360@gmail.com"
] | djmerah360@gmail.com |
a957047a3cc617f90f87c19499591b295d217982 | 22fa8e9fc974254ee1e14660d21b4254f347706b | /samples/sunflow/build/classes/org/sunflow/image/XYZColor.java | 9db72f605ba2926b135ea0dbe00e6f0148853db9 | [
"BSD-3-Clause",
"MIT"
] | permissive | pl-eco/ECO | 35aa0391dcb564bd35da8d1151dbde3c3e7c03d4 | d207aa257ab02ee5b918bb4321fcac3dbd30d479 | refs/heads/master | 2016-09-03T07:25:27.488921 | 2015-03-04T16:07:40 | 2015-03-04T16:07:40 | 17,924,190 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,717 | java | package org.sunflow.image;
public final class XYZColor {
private float X;
private float Y;
private float Z;
public XYZColor() { super(); }
public XYZColor(float X, float Y, float Z) { super();
this.X = X;
this.Y = Y;
this.Z = Z; }
public final float getX() { return X; }
public final float getY() { return Y; }
public final float getZ() { return Z; }
public final XYZColor mul(float s) { X *= s;
Y *= s;
Z *= s;
return this; }
public final void normalize() { float XYZ = X + Y + Z;
if (XYZ < 1.0E-6F) return;
float s = 1 / XYZ;
X *= s;
Y *= s;
Z *= s; }
public final String toString() { return String.format("(%.3f, %.3f, %.3f)",
X,
Y,
Z); }
public static final String jlc$CompilerVersion$jl7 = "2.6.1";
public static final long jlc$SourceLastModified$jl7 = 1425485134000L;
public static final String jlc$ClassType$jl7 = ("H4sIAAAAAAAAAK0YW2xcxXX22l4/4mT9ILFrEsdxHISTdG/TCiowTZtYDnG6" +
"JFYcomQRMeO7s+ubzH3k3ll749RtiIQc5SNAayCg4I8qEa9AUNWIVggpPy0g" +
"+AGhVv0oVP0pAvKRj1JUWuDMzH3t3fVCJK80587OnHPmnDnPey9fRw2ug7bY" +
"Fj1RoBZLkxJLH6V3pNkJm7jpPZk7xrDjktwwxa57ANYmtP5XU59/+dhUm4KS" +
"WdSJTdNimOmW6e4nrkWnSS6DUuHqCCWGy1Bb5iiexmqR6VTN6C4byqAVEVKG" +
"BjK+CCqIoIIIqhBB3RFiAdFKYhaNYU6BTeYeR79EiQxK2hoXj6EN5Uxs7GDD" +
"YzMmNAAOTfz/QVBKEJcc1BfoLnWuUPiJLerCU0fafleHUlmU0s1xLo4GQjA4" +
"JItaDWJMEsfdkcuRXBa1m4TkxomjY6rPCrmzqMPVCyZmRYcEl8QXizZxxJnh" +
"zbVqXDenqDHLCdTL64Tm/H8NeYoLoOuaUFep4S6+Dgq26CCYk8ca8Unqj+lm" +
"jqH1cYpAx4GfAwKQNhqETVnBUfUmhgXUIW1HsVlQx5mjmwVAbbCKcApDPUsy" +
"5XdtY+0YLpAJhrrjeGNyC7CaxUVwEoZWx9EEJ7BST8xKEftc33vPuZPmblMR" +
"MueIRrn8TUDUGyPaT/LEIaZGJGHr5syTeM0bZxSEAHl1DFnivPaLGz/b2nvt" +
"LYlzaxWcfZNHicYmtIuTq95bOzx4Vx0Xo8m2XJ0bv0xz4f5j3s5QyYbIWxNw" +
"5Jtpf/Pa/j8fPvUi+VRBLaMoqVm0aIAftWuWYeuUOPcSkziYkdwoaiZmbljs" +
"j6JGmGd0k8jVffm8S9goqqdiKWmJ/3BFeWDBr6gR5rqZt/y5jdmUmJdshNBK" +
"GKgDRh2SP/FkaK86ZRlExRo2ddNSwXcJdrQplWiW6mLDpmA1t2jmqTWjuo6m" +
"Wk4h+K8bYHL10OEsSGw5ae5X9rJzLHEd2mYSCbjetfHgphAXuy2aI86EtlDc" +
"OXLjlYl3lMDZPe3BreGMtHdGWpyR9s9AiYRgfQs/S1oN7vwYRC/ktdbB8Qf3" +
"PHSmH+6qZM/Uw4UpgNoPmngCjGjWcBjioyKRaeBn3b99YD79xXM/lX6mLp2P" +
"q1Kja+dnHj74qx8oSClPrFwhWGrh5GM8HQZpbyAeUNX4puY//vzKk3NWGFpl" +
"mdqL+EpKHrH98at3LI3kIAeG7Df34asTb8wNKKge0gCkPobBVSGr9MbPKIvc" +
"IT8Lcl0aQOG85RiY8i0/dbWwKceaCVeET6wS83Ywygruyp0wkp5viyff7bQ5" +
"vEX6ELdyTAuRZXf98drTV5/ZcpcSTcipSIkbJ0yGd3voJAccQmD97+fHfvPE" +
"9fkHhIcAxsZqBwxwOAzBDiaDa33kreN/++jDix8ogVclGFS94iTVtRLwuC08" +
"BVyUQjrith+43zSsnJ7X8SQl3Dn/l9q07epn59qkNSms+M6w9dsZhOvf24lO" +
"vXPkP72CTULjpSjUPESTF9AZct7hOPgEl6P08Pvrnn4TPwuZErKTq88SkXCQ" +
"0AyJq1eFqTYLmI7tbeOgz67YEws9lTZu9mzcXNXGHAzETqsTHOtA/MEajZGj" +
"G5Crp71ios51fHTswscvywCOV54YMjmzcPbr9LkFJVKeN1ZUyCiNLNFC5JVS" +
"xa/hl4DxFR9cNb4gU3THsFcn+oJCYdvcUTbUEkscsetfV+Zef35uXqrRUV6d" +
"RqD5evkv/383ff4fb1dJmhAJFhY+dbcAQto7a1hyJwc/qrSkNGX3d7HCLt4b" +
"RdLof/fRydP//EJIV5EIqxgmRp9VL1/oGd7+qaAPMxKnXl+qLCfQR4a0P3zR" +
"+LfSn/yTghqzqE3zmtSDmBZ53GehMXP9zhUa2bL98iZLdhRDQcZdG/eMyLHx" +
"XBhaBOYcm89bYumvld9yD4x6LzTq46GRQGKyR5D0C7iJg9v97NNoO/o05h0w" +
"ShwKTN4mbTly8yeNcZABZoeXgdm4zywbYVaqrovCp4PceXUT06jnIR4x65bq" +
"O0W0XDy9sJjbd2mb4jn0doaamWV/n5JpQiOskpxTWRNwn+i0Q+c5+8JLr7H3" +
"ttwt427z0g4fJ3zz9Cc9B7ZPPXQTpX99TKc4yxfuu/z2vbdpv1ZQXeCDFS8P" +
"5URD5Z7X4hB42zEPlPlfb2DILn67t8JIeYZMVS+/NQzGwaFSjdxSqLGnczDJ" +
"UH2BMOm8S1STI5Uid3oidy6/yMdr7IlFKkU+fJMid3kidy2/yCdr7M1xMC1F" +
"zn43kXlwo3We2L74yyByQqatsCo9UkPueQ5OMVRnFGkkD9UQmw+0AUa/J3b/" +
"8t/0ozX2HufgLOQeUzTC0FAJtB9zMCSZ/gTsMG3puW/VpZsv9sHY6umydfl1" +
"uVBjb5GDpxhqYpb82CCwVjPUJjpJXiDTcqNK3wBk/msabz67Kz7tyM8R2iuL" +
"qaauxfv/Kl48gk8GzfDeni9SGi2hkXnSdkheF0I2y4Jqi8clhtorXhehoIin" +
"kPGiRHyeoRURRCii3iyK9BI4HiDx6WW7iu6yOSihskJlx8vWxrICIj6E+cm+" +
"KD+FTWhXFvfsPXnjzkuicjRoFM/Oci5NGdQoX6iCgrFhSW4+r+TuwS9Xvdq8" +
"yS+EqzjoiLhKRLb11V82RgybideD2T90/f6e5xY/FG873wBwC3SnoRQAAA==");
}
| [
"anthony.canino1@gmail.com"
] | anthony.canino1@gmail.com |
16187b3e9ba305e9a8197fc9384e9e52dc04fdad | 8c95f98ad504d254314e052b9367fb06466c9abd | /ExamenAlbaladejo/src/Ejercicio2/Alumno.java | a49770488f432b2c4d4cba2fdca1b7acd788dc86 | [] | no_license | Albaladejo84/Patrones_de_Disegno | 144435fab8fc91fc17a065e291544ab9adc45465 | 6fc0a87498e4dec60ea5e6dd99196e37fb5fec62 | refs/heads/master | 2023-05-26T01:16:18.294908 | 2021-03-12T18:16:30 | 2021-03-12T18:16:30 | 345,583,197 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 727 | java | package Ejercicio2;
public abstract class Alumno {
public String nombre;
public String rango;
public int participacion;
public float calificacion;
public int regalos;
public float notaFinal;
public abstract float getCalificacion();
public abstract float getParticipacion();
public abstract float getRegalos();
public float getNotaFinal() {
notaFinal = (float) ((calificacion*0.25)+(participacion*0.3) + (regalos*0.45));
return notaFinal;
}
public Alumno(String nombre, String rango, int participacion, float calificacion, int regalos) {
super();
this.nombre = nombre;
this.rango = rango;
this.participacion = participacion;
this.calificacion = calificacion;
this.regalos = regalos;
}
}
| [
"albaladejopedro84@gmail.com"
] | albaladejopedro84@gmail.com |
394f02c1b28fde437ee696e0f728968969ac2bec | c036d246dbeb0abd1f1e0dbe95527c6b72653647 | /src/test/java/BrowserFactory.java | b8b3377482b0781ae8ec636701b0cde6158f484e | [] | no_license | ZachZugSanders/Java-Automation-POC | aeaa709c1af817ca40b093245a5a0aa752671e6e | 9312cf047ff35379bfb44974c163d5f7195649fe | refs/heads/master | 2022-05-14T16:46:43.249973 | 2020-01-30T19:50:57 | 2020-01-30T19:50:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class BrowserFactory {
private static BrowserFactory instance = new BrowserFactory();
// for completion not used...
private static String browserType = null;
private ThreadLocal<WebDriver> threadLocal = new ThreadLocal<WebDriver>() {
@Override
protected WebDriver initialValue(){
System.setProperty("webdriver.gecko.driver", "C:\\gecko\\geckodriver.exe");
return new FirefoxDriver();
}
};
private BrowserFactory(){}
public static BrowserFactory getInstance(){
return instance;
}
public WebDriver getDriver(){
return threadLocal.get();
}
public void removeDriver(){
threadLocal.get().quit();
threadLocal.remove();
}
}
| [
"calaharie@gmail.com"
] | calaharie@gmail.com |
d1f5d0d9922349f1eee387eeb24f742c5c1aa890 | cbd21c286d9614b018491c47807284a099f310c0 | /src/main/java/com/example/customermanagement/resource/dto/Response.java | 43b6654473c81f8e56d2187351db2c7d0d94783f | [] | no_license | apwellington/customer-management | 99f8ba1dc5332bd20e6daee5db78f7ccb62cdab3 | 8c1213336dba2350946ab9106076324805ed62b4 | refs/heads/master | 2023-07-05T04:05:48.684648 | 2021-08-09T04:25:49 | 2021-08-09T04:25:49 | 393,602,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package com.example.customermanagement.resource.dto;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* Created by Wellington Adames on 08/08/2021
*/
public class Response {
public Map<String, Object> response;
public Response() {
this.response = new HashMap<>();
this.response.put("date", LocalDateTime.now());
this.response.put("error", false);
}
}
| [
"wellington.adames.p@gmail.com"
] | wellington.adames.p@gmail.com |
9eb3981f11fb2603438b7fee4e1ade96103bed66 | fcf23358ed8c1b4e11f3be0fff0736b4db6f5724 | /data-model/src/main/java/io/neocdtv/domain/Car.java | e4a749572f32901c20e21ddf2b91d90269ac2591 | [] | no_license | neocdtv/JEE-Examples | 66d67747b915030ecf3437e42da4d2c3f410ce01 | 8d3964a1a70b149919d2f760eb450e477c5a3873 | refs/heads/master | 2020-12-11T21:51:51.891610 | 2017-09-01T17:15:15 | 2017-09-01T17:15:15 | 44,922,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,846 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package io.neocdtv.domain;
import static io.neocdtv.domain.AbstractEntity.FIELD_NAME_VERSION;
import static io.neocdtv.domain.Offer.ENTITY_NAME;
import java.io.Serializable;
import java.util.List;
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.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Version;
import javax.validation.constraints.Pattern;
/**
*
* @author xix
*/
@Entity
@Table(name = Car.ENTITY_NAME)
public class Car extends AbstractEntity implements Serializable {
public final static String ENTITY_NAME = "CAR";
private final static String ENTITY_GEN_NAME = ENTITY_NAME + "_GEN";
private final static String ENTITY_SEQ_NAME = ENTITY_NAME + "_SEQ";
private final static String ENTITY_FOREIGN_KEY = ENTITY_NAME + "_" + AbstractEntity.FIELD_NAME_ID;
@Id
@Column(name = AbstractEntity.FIELD_NAME_ID)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = ENTITY_GEN_NAME)
@SequenceGenerator(name = ENTITY_GEN_NAME, sequenceName = ENTITY_SEQ_NAME, allocationSize = 10)
private Long id;
@Version
@Column(name = FIELD_NAME_VERSION)
private Long version;
@Pattern(regexp = "[0-9]{12}")
private String model;
public String getModelCode() {
return model;
}
public void setModelCode(String modelCode) {
this.model = modelCode;
}
@OneToMany
@JoinColumn(name = ENTITY_FOREIGN_KEY, nullable = true)
private List<Feature> features;
}
| [
"krzysztof.wolf.1980@gmail.com"
] | krzysztof.wolf.1980@gmail.com |
d99fae45edd6445c11039dbe141984c3b7cdfd5b | b871cf435532607566d9558b8ddafc136ef80317 | /GameCentral/GridWorld Experiment/Activity3/JumperRunner.java | eb209656358807d8a297e423c3e756c40a57c8d5 | [] | no_license | abadrinath947/projects | 62427eaeb85ff453587162549b862dd3cab7c6a1 | 75e3fdb233586d1ad3e1fc107e3fa08c4f6b0dfe | refs/heads/master | 2021-06-15T06:54:40.448662 | 2021-05-19T09:58:35 | 2021-05-19T09:58:35 | 196,703,747 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,110 | java | import info.gridworld.grid.Grid;
import info.gridworld.grid.BoundedGrid;
import info.gridworld.grid.Location;
import info.gridworld.actor.ActorWorld;
import info.gridworld.actor.Actor;
import info.gridworld.actor.Bug;
import info.gridworld.actor.Rock;
import info.gridworld.actor.Flower;
public class JumperRunner
{
public static void main(String[] args)
{
BoundedGrid<Actor> mygrid = new BoundedGrid<Actor>(20,20);
ActorWorld world = new ActorWorld(mygrid);
world.add(new Location(0,0),new Jumper());
world.add(new Location(0,1),new Jumper());
world.add(new Location(1,0),new Jumper());
world.add(new Location(1,1),new Rock());
world.add(new Location(1,2),new Bug());
world.add(new Location(0,3),new Bug());
world.add(new Location(2,6),new Jumper());
world.add(new Location(2,7),new Jumper());
world.add(new Location(1,7),new Rock());
world.add(new Location(1,6),new Rock());
world.add(new Location(0,7),new Rock());
world.add(new Location(19,1),new Rock());
world.show();
}
}
| [
"abadrinath947@student.fuhsd.org"
] | abadrinath947@student.fuhsd.org |
55010725d0ea0c129efeb5ab9d0202a353f2ed70 | fd43a49ac31bf986b39a9662b4dac2953e942593 | /rubber-scaffolding/rubber-transformer/src/main/java/org/finra/scaffolding/transformer/limitation/MaxLength.java | c45f6a73c71a7712c554ee45c8357cc02c7a7abd | [
"Apache-2.0"
] | permissive | dovidkopel/DataGenerator | 2eb24940f80364e34f0ef8194f97d81548284a3b | 09b090a1938c4531502a635f6ac885ee63989076 | refs/heads/master | 2021-01-25T05:43:43.421598 | 2017-02-01T18:57:11 | 2017-02-01T18:57:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package org.finra.scaffolding.transformer.limitation;
/**
* Created by dkopel on 11/22/16.
*/
public class MaxLength implements Limitation<String> {
private final int maxLength;
public MaxLength(int maxLength) {
this.maxLength = maxLength;
}
@Override
public boolean isValid(String input) {
return input.length() <= maxLength;
}
}
| [
"dovid@dovidkopel.com"
] | dovid@dovidkopel.com |
36ea18c270b83f4b48b85f1cc15eaeefdc418ebc | e13f853c9807c1982208dfb6a883c93b02433ad6 | /src/main/java/com/glhf/bomberball/ai/novembre/November.java | 1677f79494d1d9f9409ca77545dc29906389a1b6 | [] | no_license | AghilasSini/BomberballAI | a60d04767f3d6c4e08fd237000ac6ee21d787a9b | 86c33c2fb4054c6fbaea6216b6786ee8e3d2ffbe | refs/heads/master | 2023-04-28T11:41:24.250662 | 2021-05-19T12:49:56 | 2021-05-19T12:49:56 | 368,863,558 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,597 | java | /**
* Classe implémentant une intelligence artificielle utilisant l'algorithme alpha-beta couplé à une heuristique
*/
package com.glhf.bomberball.ai.novembre;
import com.glhf.bomberball.ai.AbstractAI;
import com.glhf.bomberball.ai.GameState;
import com.glhf.bomberball.config.GameConfig;
import com.glhf.bomberball.gameobject.*;
import com.glhf.bomberball.maze.Maze;
import com.glhf.bomberball.maze.cell.Cell;
import com.glhf.bomberball.utils.Action;
import com.glhf.bomberball.utils.Directions;
import java.util.ArrayList;
import java.util.List;
public class November extends AbstractAI {
private int Alpha;
private int Beta;
private List<Action> actionsPossibles;
private MyArrayList<Action> actionsAEffectuer;
private MyArrayList<MyArrayList<Action>> listeActionsPossibles;
private boolean rechercheEffectuee=false;
private double beginOfGameCoordinatesUsX;
private double beginOfGameCoordinatesUsY;
private double beginOfGameCoordinatesHimX;
private double beginOfGameCoordinatesHimY;
private double lastPositionStartTurnUsX;
private double lastPositionStartTurnUsY;
private double lastPositionStartTurnHimX;
private double lastPositionStartTurnHimY;
private boolean beginOfGameInitialized=false;
private double beginOfTurnCoordinatesUsX;
private double beginOfTurnCoordinatesUsY;
private double beginOfTurnCoordinatesHimX;
private double beginOfTurnCoordinatesHimY;
private double distanceCoveredThisGameUs=0;
private double distanceCoveredThisGameHim=0;
private double closestDistanceEnnemyYet;
private double maxDistanceOnMap;
private int nombreToursMaximal;
private GameState dummyState;
private boolean dummyStateInitialized=false;
private final int maxProfondeur = 10;
private double finalscore=-1;
public November(GameConfig config, String player_skin, int playerId) {
super(config,player_skin,"November",playerId);
this.Alpha = -2147483646;
this.Beta = 2147483646;
this.actionsAEffectuer = new MyArrayList<>();
}
/**
* Permet de récupérer l'action mémorisée et d'arreter la recherche
* @return Action : l'action mémorisée
*/
@Override
public Action getMemorizedAction(){
rechercheEffectuee=false;
return memorizedAction;
}
/**
* @param gameState : l'état courant de la partie
* @return Action : l'action a effectuer par l'intelligence artificielle
*/
@Override
public Action choosedAction(GameState gameState) {
beginOfTurnCoordinatesUsX = gameState.getPlayers().get(this.getPlayerId()).getX();
beginOfTurnCoordinatesUsY = gameState.getPlayers().get(this.getPlayerId()).getY();
beginOfTurnCoordinatesHimX = gameState.getPlayers().get((this.getPlayerId()+1)%2).getX();
beginOfTurnCoordinatesHimY = gameState.getPlayers().get((this.getPlayerId()+1)%2).getY();
//calcul des différents paramètres nécessaires à l'heuristique : distance parcourue par les joueurs, positions des joueurs, distance maximale sur la carte
if(!beginOfGameInitialized){// si début de partie
beginOfGameCoordinatesUsX=beginOfTurnCoordinatesUsX;
beginOfGameCoordinatesUsY=beginOfTurnCoordinatesUsY;
beginOfGameCoordinatesHimX=beginOfTurnCoordinatesHimX;
beginOfGameCoordinatesHimY=beginOfTurnCoordinatesHimY;
lastPositionStartTurnUsX = beginOfTurnCoordinatesUsX;
lastPositionStartTurnUsY = beginOfTurnCoordinatesUsY;
lastPositionStartTurnHimX = beginOfTurnCoordinatesHimX;
lastPositionStartTurnHimY = beginOfTurnCoordinatesHimY;
maxDistanceOnMap = distanceBetweenCoordinates(0,0,gameState.getMaze().getHeight(),gameState.getMaze().getWidth());
closestDistanceEnnemyYet = maxDistanceOnMap;
//System.out.println("max distance on map "+maxDistanceOnMap);
nombreToursMaximal = NumberTurn.getInstance().getNbTurn();
beginOfGameInitialized=true;
}else{
Player us = gameState.getPlayers().get(this.getPlayerId());
Player him = gameState.getPlayers().get((this.getPlayerId()+1)%2);
distanceCoveredThisGameUs += distanceBetweenCoordinates(lastPositionStartTurnUsX,us.getX(),lastPositionStartTurnUsY,us.getY());
distanceCoveredThisGameHim += distanceBetweenCoordinates(lastPositionStartTurnHimX,him.getX(),lastPositionStartTurnHimY,him.getY());
lastPositionStartTurnUsX = beginOfTurnCoordinatesUsX;
lastPositionStartTurnUsY = beginOfTurnCoordinatesUsY;
lastPositionStartTurnHimX = beginOfTurnCoordinatesHimX;
lastPositionStartTurnHimY = beginOfTurnCoordinatesHimY;
}
if(rechercheEffectuee && actionsAEffectuer.size()<=0){
rechercheEffectuee=false;
}
if(!rechercheEffectuee){ // si l'on a pas encore effectué de recherche, alors l'on recherche les possibles actions à effectuer
MyArrayList<Action> actionsATester;
actionsPossibles=gameState.getAllPossibleActions();
double bestAlpha = this.Alpha;
int i =0;
try{
for(int j=2;j<10;j++){ // appel à alpha-beta
//System.out.println("search maxrecursion = "+j);
String branch = Integer.toString(i);
GameState state = gameState.clone();
actionsATester = new MyArrayList<Action>();
AlphaBetaReturnObj returnObj = alphaBeta(this.Alpha, this.Beta,state,1,j,actionsATester,branch,true);
if(returnObj.score>bestAlpha){ //on mémorise la meilleure action à effectuer
//System.out.println("old score "+bestAlpha+" new score "+returnObj.score);
bestAlpha = returnObj.score;
this.setMemorizedAction(returnObj.actions.get(0));
actionsAEffectuer.clear();
actionsAEffectuer=(MyArrayList<Action>) returnObj.actions;
finalscore=returnObj.score;
//System.out.println("message : "+returnObj.message);
}
i++;
}
rechercheEffectuee=true;
}catch (IndexOutOfBoundsException e){
System.out.println("liste des actions possibles vide");
}
}
//on récupère et on retourne la prochaine action à effectuer
if (actionsAEffectuer.size()>0){
Action actionRetournee = actionsAEffectuer.get(0);
actionsAEffectuer.remove(0);
if(actionRetournee==Action.ENDTURN){ // si la prochaine action à effectuer est une fin de tour, on supprime les suivantes car ce ne sera plus à nous de jouer
actionsAEffectuer.clear();
}
//System.out.println("le coup choisi est : "+this.actionToString(actionRetournee));
//System.out.println("le score espéré était "+finalscore);
return actionRetournee;
}
rechercheEffectuee=false;
actionsAEffectuer.clear();
return Action.ENDTURN;
}
/**
* @param alpha
* @param beta
* @param state, état sur lequel on applique notre algorithme
* @param leveOfRecursion, niveau de profondeur d'exploration
* @param maxRecursion, niveau maximal de profondeur d'exploration autorisé
* @param actions : liste d'actions
* @param branch, branche de l'arbre que l'on explore
* @param onJoueVraiment : indique si c'est à notre tour de jouer
* @return AlphaBetaReturnObj contenant un score, une liste d'actions à effectuer
*/
private AlphaBetaReturnObj alphaBeta(double alpha, double beta, GameState state, int leveOfRecursion, int maxRecursion, MyArrayList<Action> actions, String branch,boolean onJoueVraiment) {
String message="";
GameState newState;
MyArrayList<Action> actionsToReturn = actions.clone();
double foundAlpha=alpha;
double foundBeta=beta;
MyArrayList<Action> actions1;
if(onJoueVraiment){
if(this.getPlayerId()!=state.getCurrentPlayerId()){
onJoueVraiment=false;
}
}
// si l'on a dépassé la profondeur maximale autorisée, on choisit de terminer le tour
if(leveOfRecursion > maxRecursion){
GameState tryState = state.clone();
tryState.apply(Action.ENDTURN);
Player winner;
actions1 = actions.clone();
//si la partie est terminée suite à cette action : verification de victoire/defaite et mise à jour éventuelle de alpha/beta
if(tryState.gameIsOver()){
winner = tryState.getWinner();
checkGameResultReturnObject returnObject = checkGameResult(winner,state,leveOfRecursion,foundAlpha,foundBeta,actionsToReturn,actions1,message);
foundAlpha=returnObject.alpha;
foundBeta=returnObject.beta;
actionsToReturn=returnObject.actions;
message=returnObject.message;
if(tryState.getCurrentPlayerId() == this.getPlayerId()){ // our turn
return new AlphaBetaReturnObj(foundAlpha,actionsToReturn,message);
} else { //enemy turn
return new AlphaBetaReturnObj(foundBeta,actionsToReturn,message);
}
}else{ // sinon on retourne l'heuristique
AlphaBetaReturnObj ret;
double score=0;
if(this.getPlayerId()==state.getCurrentPlayerId()){ //calcul des différents paramètres nécessaires à notre heuristique, si c'est à nous de jouer
initializeDummyState(state);
double distFromEnnemy = this.distanceBetweenPlayers(state);
// si le nombre de tours restants est trop faible, on favorise le fait de se rapprocher du joueur ennemi
// si la distance à l'ennemi est suffisamment faible, on favorise également le fait de se rapprocher du joueur ennemi
if(state.getRemainingTurns() < 26 ||distFromEnnemy<8 || distFromEnnemy<closestDistanceEnnemyYet){
double scoreDistEnemy=0;
if(distFromEnnemy<closestDistanceEnnemyYet){
scoreDistEnemy=100;
closestDistanceEnnemyYet=distFromEnnemy;
}
double relativeDistFromEnnemy = distFromEnnemy/maxDistanceOnMap;
scoreDistEnemy += -0.5*NumberTurn.getInstance().getNbTurn()*relativeDistFromEnnemy;
score+=scoreDistEnemy;
message +="score dist enemy : "+scoreDistEnemy;
}
double distanceThisTurn = distanceFromBeginOfTurnPos(state.getCurrentPlayer());
double walkableScore = maxProfondeur *2-walkableDistanceToPlayer(state.getPlayers().get(state.getCurrentPlayerId()),state.getPlayers().get((state.getCurrentPlayerId()+1)%2),dummyState);
double relativedistanceThisTurn = distanceThisTurn;
//double scoreGoodBombs = walkableDistanceFromBombToPlayer(state.getPlayers().get((this.getPlayerId()+1)%2),state);
int explode = toBeDestroyedWalls(state);
score += relativedistanceThisTurn+explode;
message += " score dist this turn : "+relativedistanceThisTurn+" score explode : "+explode;
if(walkableScore>-1000000){
double walkableScoreScore = 4*walkableScore*(1+0.05*NumberTurn.getInstance().getNbTurn());
score+= walkableScoreScore;
message+=" score walkable dist : "+walkableScoreScore;
}
}else{ // on suppose que l'adversaire joue de manière "constante"
score=2;
}
if(state.getCurrentPlayerId()==this.getPlayerId()){ // on renvoie le score calculé par l'heuristique et la liste des actions associées
ret = new AlphaBetaReturnObj(score,actions,"max level from us, score = "+message);
}else{
ret = new AlphaBetaReturnObj(-score,actions,"max level from other");
}
return ret;
}
}
// exploration de l'arbre des actions possibles, algorithme alpha beta standard
List<Action> possibleActions=null;
possibleActions = state.getAllPossibleActions(); // on récupère l'ensemble des actions possibles à partir de cet état
for(int i = 0; i < possibleActions.size() && foundAlpha< foundBeta; i++){
Action chosenAction = possibleActions.get(i);
newState = state.clone();
newState.apply(chosenAction);
actions1 = actions.clone();
if(onJoueVraiment){
actions1.add(chosenAction);
}
Player winner; //on examine l'état de la partie après avoir joué l'action choisie
if(newState.gameIsOver()){
winner = newState.getWinner();
checkGameResultReturnObject returnObject = checkGameResult(winner,newState,leveOfRecursion,foundAlpha,foundBeta,actionsToReturn,actions1,message);
foundAlpha=returnObject.alpha;
foundBeta=returnObject.beta;
actionsToReturn=returnObject.actions;
message=returnObject.message;
}
else{
// on simule le reste des actions si l'action choisie précedemment n'a pas mené à une fin de partie
AlphaBetaReturnObj returnObj = alphaBeta(foundAlpha, foundBeta,newState,leveOfRecursion+1,maxRecursion,actions1,branch+i,onJoueVraiment);
if(state.getCurrentPlayerId() == this.getPlayerId()) { // noeud max
if(returnObj.score>foundAlpha){
foundAlpha=returnObj.score;
actionsToReturn = (MyArrayList<Action>) returnObj.actions;
message=returnObj.message;
}
}else{ // noeud min
if(returnObj.score<foundBeta) {
foundBeta = returnObj.score;
actionsToReturn = (MyArrayList<Action>) returnObj.actions;
message=returnObj.message;
}
}
}
}
AlphaBetaReturnObj ret;
if(state.getCurrentPlayerId() == this.getPlayerId()) { // noeud max
ret = new AlphaBetaReturnObj(foundAlpha,actionsToReturn,message);
}else { // noeud min
ret = new AlphaBetaReturnObj(foundBeta, actionsToReturn,message);
}
return ret;
}
/**
* @param a : une action
* @return String : retourne l'action passée en paramètre sous forme de chaîne de caractères
*/
public String actionToString(Action a){
String ret="";
switch (a){
case ENDTURN:ret="ENDTURN";break;
case MOVE_UP:ret="MOVE_UP";break;
case DROP_BOMB:ret="DROP_BOMB";break;
case MODE_BOMB:ret="MODE_BOMB";break;
case MODE_MOVE:ret="MODE_MOVE";break;
case MOVE_DOWN:ret="MOVE_DOWN";break;
case MOVE_LEFT:ret="MOVE_LEFT";break;
case MOVE_RIGHT:ret="MOVE_RIGHT";break;
case NEXT_SCREEN:ret="NEXT_SCREEN";break;
case DROP_BOMB_UP:ret="DROP_BOMB_UP";break;
case MENU_GO_BACK:ret="MENU_GO_BACK";break;
case DELETE_OBJECT:ret="DELETE_OBJECT";break;
case DROP_BOMB_DOWN:ret="DROP_BOMB_DOWN";break;
case DROP_BOMB_LEFT:ret="DROP_BOMB_LEFT";break;
case DROP_BOMB_RIGHT:ret="DROP_BOMB_RIGHT";break;
case DROP_SELECTED_OBJECT:ret="DROP_SELECTED_OBJECT";break;
}
return ret;
}
/**
* Affiche la liste d'actions passée en paramètres dans le terminal
* @param list : une liste d'actions
*/
public void printActions(List<Action> list){
System.out.println();
for (Action action: list){
System.out.print(" | "+actionToString(action)+" | ");
}System.out.println();
}
/**
* @param state : état courant
* @return double : la distance entre les deux joueurs
*/
public double distanceBetweenPlayers(GameState state){
Player p1 = state.getPlayers().get(0);
int x1 = p1.getX();
int y1 = p1.getY();
Player p2 = state.getPlayers().get(1);
int x2 = p2.getX();
int y2 = p2.getY();
return Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
}
/**
* @param player : un joueur
* @return double : la distance parcourue par ce joueur depuis le début de la partie
*/
public double distanceFromBeginOfGamePos(Player player){
double x1 = player.getX();
double y1 = player.getY();
double x2,y2;
if(player.getPlayerId()==this.getPlayerId()){
x2 = this.beginOfGameCoordinatesUsX;
y2 = this.beginOfGameCoordinatesUsY;
}else{
x2 = this.beginOfGameCoordinatesHimX;
y2 = this.beginOfGameCoordinatesHimY;
}
return Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
}
/**
* @param player : un joueur
* @return double : la distance parcourue par ce joueur depuis le début du tour
*/
public double distanceFromBeginOfTurnPos(Player player){
double x1 = player.getX();
double y1 = player.getY();
double x2,y2;
if(player.getPlayerId()==this.getPlayerId()) {
x2 = beginOfTurnCoordinatesUsX;
y2 = beginOfTurnCoordinatesUsY;
}else{
x2 = beginOfTurnCoordinatesHimX;
y2 = beginOfTurnCoordinatesHimY;
}
return Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
}
/**
* @param x1 : abscisse point 1
* @param y1 : ordonnée point 1
* @param x2 : abscisse point 2
* @param y2 : ordonnée point 2
* @return double : la distance entre le point 1 et le point 2
*/
public double distanceBetweenCoordinates(double x1, double y1, double x2, double y2){
return Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
}
/**
* @param player : un joueur
* @return double : la distance totale parcourue pendant la partie par ce joueur
*/
public double distanceCoveredThisGame(Player player){
if(player.getPlayerId()==this.getPlayerId()){
return distanceCoveredThisGameUs;
}else{
return distanceCoveredThisGameHim;
}
}
/**
* @param myPlayer : le joueur contrôlé par notre intelligence artificielle
* @param Ennemy : le joueur ennemi
* @param state : l'état courant
* @return double : la longeur du chemin du joueur courant à l'ennemi
*/
public double walkableDistanceToPlayer(Player myPlayer,Player Ennemy,GameState state){
// uses dummyState
MyArrayList<Player> players = new MyArrayList<Player>();
myPlayer.setPlayerId(0);
players.add(myPlayer);
state.getMaze().setPlayers(players);
state.setCurrentPlayerId(0);
myPlayer=state.getCurrentPlayer();
double walked = walkableDistanceToPlayer(myPlayer.getCell(),Ennemy,0,0,Directions.DOWN, maxProfondeur);
return walked;
}
/**
* @param Ennemy : le joueur ennemi
* @param state : l'état courant
* @return double
*/
public double walkableDistanceFromBombToPlayer(Player Ennemy,GameState state){
double ret=0;
ArrayList<Cell> cells = new ArrayList<Cell>();
for (Cell[] cell1:state.getMaze().getCells()){
for (Cell cell:cell1){
cells.add(cell);
}
}
for (Cell cell:cells) {
boolean containsBomb=false;
for (GameObject object :cell.getGameObjects()){
if(object instanceof Bomb){
containsBomb=true;
}
}
if(containsBomb){
ret+=walkableDistanceToPlayer(cell,Ennemy,0,0,Directions.DOWN, maxProfondeur);
}
}
return ret;
}
/**
* @param cell : la cellule courante
* @param Ennemy : le joueur adverse
* @param walked : la longueur du chemin courant
* @param profondeur : profondeur d'exploration courante
* @param forbiddenDirection : direction interdite dans l'exploration
* @param limit : profondeur d'exploration limite
* @return double : la longueur du chemin de la cellule courante à l'ennemi
*/
public double walkableDistanceToPlayer(Cell cell, Player Ennemy, int walked,int profondeur, Directions forbiddenDirection,int limit){
//on a trouvé le chemin jusqu'à l'ennemi
if(cell.getX()==Ennemy.getX() && cell.getY()==Ennemy.getY()){
return walked;
}else if(profondeur>limit){ // on a atteint la profondeur d'exploration limite
return 2147483646;
//return 2* distanceBetweenCoordinates(cell.getX(),cell.getY(),Ennemy.getX(),Ennemy.getY());
}
double minFound=2147483646;
double found;
List<Cell> adjacentCells = cell.getAdjacentCells();
// Right
if(forbiddenDirection!=Directions.RIGHT || profondeur==0){
if (adjacentCells.get(0) != null) {
if (adjacentCells.get(0).isWalkable()) {
found = walkableDistanceToPlayer(adjacentCells.get(0),Ennemy,walked+1,profondeur+1,Directions.RIGHT.opposite(),limit);
if(found<minFound){
minFound=found;
}
}
if (cellIsDestructible(adjacentCells.get(0))){ // on considère que détruire un objet destructible compte comme 2 actions -> walked + 2
found = walkableDistanceToPlayer(adjacentCells.get(0),Ennemy,walked+2,profondeur+1,Directions.RIGHT.opposite(),limit);
if(found<minFound){
minFound=found;
}
}
}
}
// Left
if(forbiddenDirection!=Directions.LEFT || profondeur==0) {
if (adjacentCells.get(2) != null) {
if (adjacentCells.get(2).isWalkable()) {
found = walkableDistanceToPlayer(adjacentCells.get(2), Ennemy,walked + 1, profondeur + 1, Directions.LEFT.opposite(), limit);
if (found < minFound) {
minFound = found;
}
}
if (cellIsDestructible(adjacentCells.get(2))) {
found = walkableDistanceToPlayer(adjacentCells.get(2), Ennemy,walked + 2, profondeur + 1, Directions.LEFT.opposite(), limit);
if (found < minFound) {
minFound = found;
}
}
}
}
// Up
if(forbiddenDirection!=Directions.UP || profondeur==0) {
if (adjacentCells.get(1) != null) {
if (adjacentCells.get(1).isWalkable()) {
found = walkableDistanceToPlayer(adjacentCells.get(1), Ennemy, walked + 1, profondeur + 1, Directions.UP.opposite(), limit);
if (found < minFound) {
minFound = found;
}
}
if (cellIsDestructible(adjacentCells.get(1))) {
found = walkableDistanceToPlayer(adjacentCells.get(1), Ennemy,walked + 2, profondeur + 1, Directions.UP.opposite(), limit);
if (found < minFound) {
minFound = found;
}
}
}
}
// Down
if(forbiddenDirection!=Directions.DOWN || profondeur==0) {
if (adjacentCells.get(3) != null) {
if (adjacentCells.get(3).isWalkable()) {
found = walkableDistanceToPlayer(adjacentCells.get(3), Ennemy, walked + 1, profondeur + 1, Directions.DOWN.opposite(), limit);
if (found < minFound) {
minFound = found;
}
}
if (cellIsDestructible(adjacentCells.get(3))) {
found = walkableDistanceToPlayer(adjacentCells.get(3), Ennemy, walked + 2, profondeur + 1, Directions.DOWN.opposite(), limit);
if (found < minFound) {
minFound = found;
}
}
}
}
return minFound;
}
/**
* Crée un nouvel état avec le maze de l'état passé en paramètre mais sans les joueurs
* @param state : un état
*/
public void initializeDummyState(GameState state){
Maze maze = (Maze) state.getMaze().clone();
//on enlève les players.
maze.setPlayers(new ArrayList<Player>());
dummyState = new GameState(maze,0,0);
}
/**
* @param cell : la cellule courante
* @return booléen : renvoie vrai si la cellule contient au moins un objet destructible
*/
public boolean cellIsDestructible(Cell cell){
boolean ret = false;
for (GameObject object : cell.getGameObjects()){
if(object instanceof DestructibleWall){
ret=true;
}
}
return ret;
}
/**
* @param state : l'état courant
* @return ret : le nombre de murs que les bombes posées dans le GameState passé en paramètre vont détruire.
*/
public int toBeDestroyedWalls(GameState state){
int ret=0;
ArrayList<Cell> cells = new ArrayList<Cell>();
for (Cell[] cell1 : state.getMaze().getCells()){
for (Cell cell:cell1){
cells.add(cell);
}
}
int retplus;
Cell currentCell=null;
for (Cell cell : cells) {
for (GameObject object:cell.getGameObjects()){
if(object instanceof Bomb){
retplus=0;
for (Directions dir:Directions.values()){
boolean continuer=true;
for (int l=0;l<initial_bomb_range && continuer;l++){
currentCell=cell.getAdjacentCell(dir);
if(currentCell!=null){
if (cellIsDestructible(currentCell)) {
retplus=retplus+1;
continuer = false;
}else if(!currentCell.isWalkable()){
continuer=false;
}
}
}
}
if(retplus<=0){
ret=ret-1000;
}else{
ret=ret+retplus;
}
}
}
}
return ret;
}
/**
* Examine la situation courante si la partie est terminée et met éventuellement à jour alpha ou beta avec une meilleure valeur
* @param winner : vainqueur de la partie
* @param state : état courant
* @param leveOfRecursion : niveau maximal de profondeur
* @param foundAlpha : meilleur alpha pour le moment
* @param foundBeta : meilleur beta pour le moment
* @param actionsToReturn : liste d'actions à renvoyer
* @param actions1 : liste d'actions associées à l'état
* @return checkGameResultReturnObject : un objet contenant tous les paramètres qui ont été passés à cette méthode (pour prendre en compte leur éventuelle modification)
*/
public checkGameResultReturnObject checkGameResult(Player winner, GameState state, int leveOfRecursion, double foundAlpha, double foundBeta, List<Action> actionsToReturn, List<Action> actions1, String message){
checkGameResultReturnObject ret;
if(winner!=null){
if(winner.getPlayerId() == this.getPlayerId() && this.getPlayerId()==state.getCurrentPlayerId()){ // on gagne et c'était notre tour de jouer
int possibleScore = +2147483646 - 2*leveOfRecursion;
if(possibleScore>foundAlpha){
actionsToReturn=actions1;
foundAlpha=possibleScore;
message="on gagne";
}
} else if(winner.getPlayerId() != this.getPlayerId() && this.getPlayerId()==state.getCurrentPlayerId()){ // on perd et c'était notre tour de jouer
int possibleScore = -2147483646 + 2*leveOfRecursion;
if(possibleScore>foundAlpha){
actionsToReturn=actions1;
foundAlpha=possibleScore;
message="on perd";
}
}else if(winner.getPlayerId() == this.getPlayerId() && this.getPlayerId()!=state.getCurrentPlayerId()){ // on gagne et c'était à l'adversaire de jouer
int possibleScore = +2147483646 - 2*leveOfRecursion;
if(possibleScore<foundBeta){
actionsToReturn=actions1;
foundBeta=possibleScore;
message="on gagne";
}
}else if(winner.getPlayerId() != this.getPlayerId() && this.getPlayerId()!=state.getCurrentPlayerId()){ // on perd et c'était à l'adversaire de jouer
int possibleScore = - 2147483646 + 2*leveOfRecursion;
if(possibleScore<foundBeta){
actionsToReturn=actions1;
foundBeta=possibleScore;
message="on perd";
}
}
}else{ // égalité
if(this.getPlayerId()==state.getCurrentPlayerId()){
if(0>foundAlpha){
actionsToReturn=actions1;
foundAlpha=0;
}
}else{
if(0<foundBeta){
actionsToReturn=actions1;
foundBeta=0;
}
}
message="egalité";
}
ret = new checkGameResultReturnObject(new MyArrayList<>(actionsToReturn),foundAlpha,foundBeta,message); // enregistrement des paramètres et de leur modification
return ret;
}
} | [
"aghilas.sini@univ-rennes1.fr"
] | aghilas.sini@univ-rennes1.fr |
20460052870ca75a5d77187d597e3b6d27ea6cd0 | 3572cb6d49194b538871d760c1fdc88b8ae8b48b | /app/src/main/java/com/citrobyte/mpacker/dagger/scopes/AppScope.java | 5d2a9351d42c674e4f34826c8db8afaa887c23e7 | [] | no_license | nurjan84/Kotlin-Flow-MVVM-LiveData | a74932e08b2fb413e44d3710b335bb6c2f077b44 | cc564ad1f5134e9e51d0ab724ae609f0ef658b26 | refs/heads/master | 2021-02-20T11:23:21.373600 | 2020-03-06T06:16:09 | 2020-03-06T06:16:09 | 245,334,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package com.citrobyte.mpacker.dagger.scopes;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import javax.inject.Scope;
@Scope
@Retention(RetentionPolicy.CLASS)
public @interface AppScope {
}
| [
"psw2018nt"
] | psw2018nt |
9e14b13482651d5f8882fef6ce839efc735b21a4 | 229868847c4a0aae6aae2a8d9678cbeb59c77789 | /IDIS-SDK/src/main/java/cn/ac/caict/iiiiot/idisc/security/AbstractAuthentication.java | 2246661ea07ea8b0648f56e0e1078eeb93d2d290 | [
"Apache-2.0"
] | permissive | MaXiaoran/IDIS-SDK | 57b27b913fdba75b7cf2fd5343b6ffd59ec6919b | 9ff5346aa02527d0f96a2bb2f4d69d4cf1328bb7 | refs/heads/master | 2020-07-06T00:19:47.943173 | 2019-08-16T03:55:03 | 2019-08-16T03:55:03 | 202,828,824 | 1 | 0 | Apache-2.0 | 2019-08-17T03:11:05 | 2019-08-17T03:11:04 | null | UTF-8 | Java | false | false | 2,338 | java | package cn.ac.caict.iiiiot.idisc.security;
/*
* 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.
*
*© COPYRIGHT 2019 Corporation for Institute of Industrial Internet & Internet of Things (IIIIT);
* All rights reserved.
* http://www.caict.ac.cn
* https://www.citln.cn/
*/
import cn.ac.caict.iiiiot.idisc.core.BaseRequest;
import cn.ac.caict.iiiiot.idisc.core.ChallengeResponse;
import cn.ac.caict.iiiiot.idisc.core.IdentifierException;
import cn.ac.caict.iiiiot.idisc.data.ValueReference;
public abstract class AbstractAuthentication {
/**
* 获取标识由此认证对象表示的用户的标识名称。
* @return 标识名称字节数组
*/
public abstract byte[] getUserIdentifier();
/**
* 获取标识该用户的标识值的索引。 识别此用户的标识的返回索引值应包含与该用户验证方式相对应的类型(公钥,密钥等)的值。
* @return 用户索引
*/
public abstract int getUserIndex();
/**
* 获取认证类型,公私钥认证 or 密钥认证
* @return 认证类型
*/
public abstract byte[] getTypeAuth();
/**
* 将给定的随机数和requestDigest标记为给定请求的质询。 该方法的实现也应该可以验证客户端实际上是发送指定的请求,
* 并且相关联的摘要是请求的有效摘要。 返回--随机数和requestDigest的并置签名。
* @param challenge 发起质询
* @param request 原始请求
* @return 签名数据
*/
public abstract byte[] authenticateAction(ChallengeResponse challenge, BaseRequest request) throws IdentifierException;
/**
* 获取认证对象的引用数据
* @return 返回由Index、identifier组成的ValueReference对象
*/
public ValueReference getUserValueReference() {
return new ValueReference(getUserIdentifier(), getUserIndex());
}
}
| [
"citln_dev.@163.com"
] | citln_dev.@163.com |
1f104dcdea5fa73a7dd2a197df8d69abfd05b6a2 | b2780b58b26a747ca2775d93889b84278b9b04e9 | /MergeSortedArray.java | 9e8d46c9060b7b0be96c9bc2a0cf3083c09f5f9c | [] | no_license | Copperbutton/LeetCode | c9ba8bf6ddc84e3129a18f7283539766685ade4c | f8122adbb3511a6297c5a409feb917a5fa69cd3e | refs/heads/master | 2020-12-25T17:03:18.280673 | 2014-12-08T07:35:14 | 2014-12-08T07:35:14 | 23,045,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | /**
* Given two sorted integer arrays A and B, merge B into A as one sorted array.
*
* Note: You may assume that A has enough space (size that is greater or equal
* to m + n) to hold additional elements from B. The number of elements
* initialized in A and B are m and n respectively.
*/
public class Solution {
public void merge(int A[], int m, int B[], int n) {
while (n > 0) {
if (m > 0 && A[m - 1] > B[n - 1]) {
A[--m + n] = A[m];
} else {
A[--n + m] = B[n];
}
}
}
} | [
"buptzxk2012@gmail.com"
] | buptzxk2012@gmail.com |
b991bf549d572cdca16ba9c00f1243ae6e27a684 | b6d5d94b072c5cf23f7c04773c95b6d5d55908a6 | /src/com/oreilly/demo/android/pa/uidemo/model/Dots.java | 5183bd592cc96ab96b52b99edd1c9efdc68f8fdb | [] | no_license | programmingandroid/AndroidUIDemo | 19e6e1cf73a3f96e59856d9bcfd65a02cea97f55 | 21df8223a7263e9f99246704bebec27db9cbb73b | refs/heads/master | 2021-01-01T16:05:37.974814 | 2014-02-21T05:30:16 | 2014-02-21T05:30:16 | 17,046,302 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,499 | java | package com.oreilly.demo.android.pa.uidemo.model;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
/** A list of dots. */
public class Dots {
/** DotChangeListener. */
public interface DotsChangeListener {
/** @param dots the dots that changed. */
void onDotsChange(Dots dots);
}
private final LinkedList<Dot> dots = new LinkedList<Dot>();
private final List<Dot> safeDots = Collections.unmodifiableList(dots);
private DotsChangeListener dotsChangeListener;
/** @param l set the change listener. */
public void setDotsChangeListener(DotsChangeListener l) {
dotsChangeListener = l;
}
/** @return the most recently added dot. */
public Dot getLastDot() {
return (dots.size() <= 0) ? null : dots.getLast();
}
/** @return immutable list of dots. */
public List<Dot> getDots() { return safeDots; }
/**
* @param x dot horizontal coordinate.
* @param y dot vertical coordinate.
* @param color dot color.
* @param diameter dot size.
*/
public void addDot(float x, float y, int color, int diameter) {
dots.add(new Dot(x, y, color, diameter));
notifyListener();
}
/** Remove all dots. */
public void clearDots() {
dots.clear();
notifyListener();
}
private void notifyListener() {
if (null != dotsChangeListener) {
dotsChangeListener.onDotsChange(this);
}
}
}
| [
"blake.meike@gmail.com"
] | blake.meike@gmail.com |
496ceb3115f90cf70662d4382f7810a7227d606c | 0a660a7010f8b04173e285b46970041463a4ef82 | /src/documents/resources/templates/DemoReadDao.java | 9bfebbeff86720aee54f058abea7d3141d691bfa | [
"Apache-2.0"
] | permissive | gorun8/easyfk | 24fcc45b2d910afca372e22444e6a473ba8efd2c | e1de0a00feb9146e1bb18ae63066ca887aca922d | refs/heads/master | 2021-01-10T10:56:41.703670 | 2016-03-09T00:45:41 | 2016-03-09T00:45:41 | 45,182,768 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,182 | java | /*
* Project:Easy Web Framework
* Description:
* EasyFK stands for Easy Web Framework.It's an open source product for E-Business / E-Commerce.It
* was launched by a chinese Hezhiping(QQ:110476592) in 2015.The goal of EasyFK is to provide a
* foundation and starting point for reliable, secure , simple-to-use ,cost-effective ,scalable
* and suitable-for-Chinese E-Business / E-Commerce solutions. With EasyFK, you can get started
* right away without the huge deployment and maintenance costs of E-Business / E-Commerce systems.
* Of course, you can customize it or use it as a framework to implement your most challenging business needs.
* EasyFk is licensed under the Apache License Version 2.0. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Author:hezhiping Email:110476592@qq.com
*/
package cn.gorun8.easyfk.@component-name@.dao;
import cn.gorun8.easyfk.base.util.Debug;
import cn.gorun8.easyfk.base.util.UtilIOC;
import cn.gorun8.easyfk.entity.GenericEntityException;
import cn.gorun8.easyfk.entity.GenericValue;
import cn.gorun8.easyfk.entity.dao.ReadDaoBase;
import cn.gorun8.easyfk.entity.datasource.ReadSqlSessionTemplate;
import cn.gorun8.easyfk.entity.datasource.WriteSqlSessionTemplate;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* Created by hezhiping(110476592@qq.com) on 15-10-19.
*/
public abstract class DemoReadDao extends ReadDaoBase {
private static final String module = DemoReadDao.class.getName();
public DemoReadDao(){
super("cn.gorun8.easyfk.@component-name@.dao.DemoReadDao");
}
public ReadSqlSessionTemplate getSqlSessionTemplate(){
ReadSqlSessionTemplate readSqlSessionTemplate = UtilIOC.getBean("partyReadSqlSession");
if(readSqlSessionTemplate == null){
Debug.logError("partyReadSqlSession not found", module);
return null;
}
return readSqlSessionTemplate;
}
/**
* 获取XX列表
* @return
*/
public abstract List<GenericValue> findXXList(@Param("param") String id) throws GenericEntityException;
}
| [
"hzpldx@163.com"
] | hzpldx@163.com |
0a3105584ec6045a779050039bf6781d1e4be3f1 | ce1934da3aa7107f500a2c2da6c73adae693d797 | /SD/PO135/operations/IDepartureTerminalTransferQuayPassenger.java | 8cca5f23a9b725c6a4bf72d396408d9e69951256 | [] | no_license | humariel/4Ano | fb7747ffd64f29c986f1f3c7afa37e578325b43f | e4cb28321d5266b67d5b7154f8cb4444bd39cb2c | refs/heads/master | 2022-11-09T17:32:21.407898 | 2020-06-24T18:36:07 | 2020-06-24T18:36:07 | 216,204,465 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 416 | java | package operations;
/**
* Departure Terminal Tranfer Quay interface for the passenger.
*
* @author Gonçalo Vítor
* @author Gabriel Silva
*/
public interface IDepartureTerminalTransferQuayPassenger {
/**
* @see monitors.DepartureTerminalTransferQuay#waitRide()
*/
void waitRide();
/**
* @see monitors.DepartureTerminalTransferQuay#leaveTheBus()
*/
void leaveTheBus();
} | [
"hum4r13l@gmail.com"
] | hum4r13l@gmail.com |
16772d89b1e2800b6e824f2ff42617a1b9a3cddc | 42ed12696748a102487c2f951832b77740a6b70d | /Mage.Sets/src/mage/sets/returntoravnica/EssenceBacklash.java | 9e669e89f73a1f6723cbc3932c53e82af58a1f7f | [] | no_license | p3trichor/mage | fcb354a8fc791be4713e96e4722617af86bd3865 | 5373076a7e9c2bdabdabc19ffd69a8a567f2188a | refs/heads/master | 2021-01-16T20:21:52.382334 | 2013-05-09T21:13:25 | 2013-05-09T21:13:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,276 | java | /*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``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 BetaSteward_at_googlemail.com 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.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.returntoravnica;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.stack.Spell;
import mage.players.Player;
import mage.target.TargetSpell;
/**
*
* @author LevelX2
*/
public class EssenceBacklash extends CardImpl<EssenceBacklash> {
private static final FilterSpell filter = new FilterSpell("creature spell");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public EssenceBacklash(UUID ownerId) {
super(ownerId, 160, "Essence Backlash", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{U}{R}");
this.expansionSetCode = "RTR";
this.color.setBlue(true);
this.color.setRed(true);
// Counter target creature spell. Essence Backlash deals damage equal to that spell's power to its controller.
this.getSpellAbility().addTarget(new TargetSpell(filter));
this.getSpellAbility().addEffect(new EssenceBacklashEffect());
}
public EssenceBacklash(final EssenceBacklash card) {
super(card);
}
@Override
public EssenceBacklash copy() {
return new EssenceBacklash(this);
}
}
class EssenceBacklashEffect extends OneShotEffect<EssenceBacklashEffect> {
public EssenceBacklashEffect() {
super(Constants.Outcome.Damage);
staticText = "Counter target creature spell. Essence Backlash deals damage equal to that spell's power to its controller";
}
public EssenceBacklashEffect(final EssenceBacklashEffect effect) {
super(effect);
}
@Override
public EssenceBacklashEffect copy() {
return new EssenceBacklashEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Boolean result = false;
Spell spell = game.getStack().getSpell(source.getFirstTarget());
if (spell != null) {
Player spellController = game.getPlayer(spell.getControllerId());
result = game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game);
if (spellController != null) {
spellController.damage(spell.getPower().getValue(), source.getSourceId(), game, false, true);
}
}
return result;
}
}
| [
"ludwig.hirth@online.de"
] | ludwig.hirth@online.de |
7b449e52fd69df6293eccea3b4559c8efc098f97 | a733c9fa7de7dd0348249eee8f430a76ac077037 | /support/src/main/java/com/hrms/support/manager/impl/DepartmentManagerImpl.java | f52be2c114943c69e70043dde5922d336f16374d | [] | no_license | 15254714507/hr-ms | e75329abb3464801932a2fa39d1061a1242e9f99 | f3b095e2d2ac82e1d25b108558910f2249e4f772 | refs/heads/master | 2022-07-03T06:20:49.014562 | 2020-06-02T11:21:56 | 2020-06-02T11:21:56 | 252,255,749 | 1 | 0 | null | 2022-06-17T03:06:18 | 2020-04-01T18:29:23 | Java | UTF-8 | Java | false | false | 4,087 | java | package com.hrms.support.manager.impl;
import com.alibaba.fastjson.JSON;
import com.hrms.api.domain.condition.DepartmentCondition;
import com.hrms.api.domain.entity.Department;
import com.hrms.api.exception.DaoException;
import com.hrms.api.until.LocalDateTimeFactory;
import com.hrms.support.dao.DepartmentDao;
import com.hrms.support.manager.DepartmentManager;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 孔超
* @date 2020/4/13 23:17
*/
@Slf4j
@Component("departmentManager")
public class DepartmentManagerImpl implements DepartmentManager {
@Resource
DepartmentDao departmentDao;
@Override
public Department getById(Long id) throws DaoException {
try {
return departmentDao.getById(id);
} catch (Exception e) {
throw new DaoException(e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long insert(Department department) throws DaoException {
DepartmentCondition departmentCondition = getDepartmentCondition(department);
List<Department> departmentList = list(departmentCondition);
if (departmentList != null && departmentList.size() > 0) {
log.warn("要添加的部门已存在 department:{}", JSON.toJSONString(department));
return 0L;
}
department.setCreateTime(LocalDateTimeFactory.getLocalDateTime());
department.setUpdateTime(LocalDateTimeFactory.getLocalDateTime());
try {
return departmentDao.insert(department);
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new DaoException(e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long updateById(Department department) throws DaoException {
if (getById(department.getId()) == null) {
log.warn("要修改的部门不存在 department{}", JSON.toJSONString(department));
return 0L;
}
DepartmentCondition departmentCondition = getDepartmentCondition(department);
List<Department> departmentList = list(departmentCondition);
if (departmentList != null && departmentList.size() > 0) {
log.warn("有修改的部门名称已存在 department{}", JSON.toJSONString(department));
return 0L;
}
department.setUpdateTime(LocalDateTimeFactory.getLocalDateTime());
try {
return departmentDao.updateById(department);
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new DaoException(e);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long deleteById(Long id) throws DaoException {
if (getById(id) == null) {
log.warn("要删除的部门不存在 id:{}", id);
return 0L;
}
try {
return departmentDao.deleteById(id);
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
throw new DaoException(e);
}
}
@Override
public List<Department> list(DepartmentCondition departmentCondition) throws DaoException {
try {
return departmentDao.list(departmentCondition);
} catch (Exception e) {
throw new DaoException(e);
}
}
/**
* Department转到DepartmentCondition
*
* @param department
* @return
*/
private DepartmentCondition getDepartmentCondition(Department department) {
DepartmentCondition departmentCondition = new DepartmentCondition();
departmentCondition.setDepartmentName(department.getDepartmentName());
return departmentCondition;
}
}
| [
"kongchao507@qq.com"
] | kongchao507@qq.com |
c314dccb12df7e8e1ebd7338d74335e2715c9f34 | 31702665b2bbf11ecf6dda7f5e7c4cc31cc2b905 | /src/main/java/com/csh/mms/service/LoginService.java | 7ec204e92e422eb86e202897f2d26540bab9bc6d | [] | no_license | cuishenghong/MMS_BackEnd | 600d3d12c3698e248b7550978a6245937150bbb6 | cce6d969a866e1500187af472dbb2f4416e4bff7 | refs/heads/master | 2023-05-05T14:50:53.879131 | 2021-05-23T03:44:56 | 2021-05-23T03:44:56 | 308,349,969 | 0 | 1 | null | 2021-05-23T03:44:57 | 2020-10-29T14:16:18 | Java | UTF-8 | Java | false | false | 239 | java | package com.csh.mms.service;
import com.csh.mms.domain.SysUser;
import com.csh.mms.dto.UserRoleDto;
public interface LoginService {
// SysUser getUserByAccount(String account);
UserRoleDto getUserByAccount(String account);
} | [
"cuishh123"
] | cuishh123 |
69818a89c9ce19c020edcbd0292042a868224c62 | 53a7ea78e7628541f3819e36a936c7759cfbc871 | /ZC/src/com/hct/zc/widget/XListViewFooter.java | a4159c5b0d1518f704ab81f6e090eb15ee7c5374 | [] | no_license | codecollection/zcgw | 32b07f1eb40be13a5f1d56dac8156897da11826f | 7faf6d31b9af8152bbd024d1308db7462fc000a9 | refs/heads/master | 2021-01-15T11:13:23.567286 | 2014-09-28T07:58:06 | 2014-09-28T07:58:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,143 | java | /**
* @file XFooterView.java
* @create Mar 31, 2012 9:33:43 PM
* @author Maxwin
* @description XListView's footer
*/
package com.hct.zc.widget;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.hct.zc.R;
public class XListViewFooter extends LinearLayout {
public final static int STATE_NORMAL = 0;
public final static int STATE_READY = 1;
public final static int STATE_LOADING = 2;
private Context mContext;
private View mContentView;
private View mProgressBar;
private TextView mHintView;
public XListViewFooter(Context context) {
super(context);
initView(context);
}
public XListViewFooter(Context context, AttributeSet attrs) {
super(context, attrs);
initView(context);
}
public void setState(int state) {
mHintView.setVisibility(View.INVISIBLE);
mProgressBar.setVisibility(View.INVISIBLE);
mHintView.setVisibility(View.INVISIBLE);
if (state == STATE_READY) {
mHintView.setVisibility(View.VISIBLE);
mHintView.setText(R.string.xlistview_header_hint_ready);
} else if (state == STATE_LOADING) {
mProgressBar.setVisibility(View.VISIBLE);
} else {
mHintView.setVisibility(View.VISIBLE);
mHintView.setText(R.string.xlistview_footer_hint_normal);
}
}
public void setBottomMargin(int height) {
if (height < 0)
return;
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView
.getLayoutParams();
lp.bottomMargin = height;
mContentView.setLayoutParams(lp);
}
public int getBottomMargin() {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView
.getLayoutParams();
return lp.bottomMargin;
}
/**
* normal status
*/
public void normal() {
mHintView.setVisibility(View.VISIBLE);
mProgressBar.setVisibility(View.GONE);
}
/**
* loading status
*/
public void loading() {
mHintView.setVisibility(View.GONE);
mProgressBar.setVisibility(View.VISIBLE);
}
/**
* hide footer when disable pull load more
*/
public void hide() {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView
.getLayoutParams();
lp.height = 0;
mContentView.setLayoutParams(lp);
}
/**
* show footer
*/
public void show() {
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) mContentView
.getLayoutParams();
lp.height = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
mContentView.setLayoutParams(lp);
}
private void initView(Context context) {
mContext = context;
LinearLayout moreView = (LinearLayout) LayoutInflater.from(mContext)
.inflate(R.layout.xlistview_footer, null);
addView(moreView);
moreView.setLayoutParams(new LinearLayout.LayoutParams(
android.view.ViewGroup.LayoutParams.MATCH_PARENT,
android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
mContentView = moreView.findViewById(R.id.xlistview_footer_content);
mProgressBar = moreView.findViewById(R.id.xlistview_footer_progressbar);
mHintView = (TextView) moreView
.findViewById(R.id.xlistview_footer_hint_textview);
}
}
| [
"hg_liuzl@163.com"
] | hg_liuzl@163.com |
c9d78fb384045d54cd8498f2c4e4a8e623650380 | e49ddf6e23535806c59ea175b2f7aa4f1fb7b585 | /branches/voi3d/mipav2/src/gov/nih/mipav/view/dialogs/JDialogRegistrationTSOAR.java | aa44b402ccbefc35ef20361d167a4995752e21ce | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | svn2github/mipav | ebf07acb6096dff8c7eb4714cdfb7ba1dcace76f | eb76cf7dc633d10f92a62a595e4ba12a5023d922 | refs/heads/master | 2023-09-03T12:21:28.568695 | 2019-01-18T23:13:53 | 2019-01-18T23:13:53 | 130,295,718 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,075 | java | package gov.nih.mipav.view.dialogs;
import gov.nih.mipav.model.algorithms.*;
import gov.nih.mipav.model.algorithms.registration.AlgorithmRegTSOAR;
import gov.nih.mipav.model.file.FileInfoBase;
import gov.nih.mipav.model.scripting.ParserException;
import gov.nih.mipav.model.scripting.parameters.ParameterFactory;
import gov.nih.mipav.model.structures.ModelImage;
import gov.nih.mipav.view.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
/**
* Dialog to get options for running the time series registration. Cost function, interpolation, mean or center volume,
* etc.
*
* @author Neva Cherniavsky
* @see gov.nih.mipav.model.algorithms.registration#AlgorithmRegistrationTSOAR
*/
public class JDialogRegistrationTSOAR extends JDialogScriptableBase implements AlgorithmInterface {
// ~ Static fields/initializers
// -------------------------------------------------------------------------------------
/** Use serialVersionUID for interoperability. */
private static final long serialVersionUID = 5174224884360217569L;
// ~ Instance fields
// ------------------------------------------------------------------------------------------------
/** DOCUMENT ME! */
private AlgorithmRegTSOAR algoReg;
/** DOCUMENT ME! */
private JComboBox comboBoxCostFunct;
/** DOCUMENT ME! */
private JComboBox comboBoxDOF;
/** DOCUMENT ME! */
private JComboBox comboBoxInterp;
/** DOCUMENT ME! */
private JComboBox comboBoxInterp2;
/** DOCUMENT ME! */
private int cost, interp, interp2, DOF;
/** DOCUMENT ME! */
private boolean displayTransform, useReferenceTimeSlice;
/** DOCUMENT ME! */
private boolean doGraph;
/** DOCUMENT ME! */
private boolean doSubsample;
/** DOCUMENT ME! */
private boolean finalRegistrationAtLevel2;
/** DOCUMENT ME! */
private JCheckBox graphCheckBox;
/** DOCUMENT ME! */
private ModelImage image;
/** DOCUMENT ME! */
private JLabel labelInterp2;
/** DOCUMENT ME! */
private JRadioButton meanButton;
/** DOCUMENT ME! */
private JRadioButton referenceButton;
/** DOCUMENT ME! */
private int refImageNum = 0;
/** DOCUMENT ME! */
private JTextField refImageNumText;
/** DOCUMENT ME! */
private ModelImage resultImage;
/** DOCUMENT ME! */
private JCheckBox sampleCheckBox;
/** DOCUMENT ME! */
private JCheckBox sampleCheckBoxLevel2;
/** DOCUMENT ME! */
private JCheckBox sincCheckBox;
/** DOCUMENT ME! */
private boolean sincNormalizedCrossCorrelation;
/** DOCUMENT ME! */
private JCheckBox transformCheckbox;
// ~ Constructors
// ---------------------------------------------------------------------------------------------------
/**
* Empty constructor needed for dynamic instantiation (used during scripting).
*/
public JDialogRegistrationTSOAR() {}
/**
* Creates new dialog with given parent frame and image to register.
*
* @param parent Parent frame.
* @param img Image to register.
*/
public JDialogRegistrationTSOAR(final Frame parent, final ModelImage img) {
super(parent, true);
image = img;
init();
}
// ~ Methods
// --------------------------------------------------------------------------------------------------------
/**
* Sets up the variables and calls the algorithm.
*
* @param evt Event that triggered this function.
*/
public void actionPerformed(final ActionEvent evt) {
final String command = evt.getActionCommand();
if (command.equals("OK")) {
if (setVariables()) {
callAlgorithm();
}
dispose();
} else if (command.equals("Cancel")) {
dispose();
}
}
/**
* This method is required if the AlgorithmPerformed interface is implemented. It is called by the algorithms when
* it has completed or failed to complete.
*
* @param algorithm Algorithm that caused the event.
*/
public void algorithmPerformed(final AlgorithmBase algorithm) {
float[][] rot = null;
float[][] posR = null;
float[][] trans = null;
float[][] posT = null;
int i;
if (algorithm instanceof AlgorithmRegTSOAR) {
if (algoReg.isCompleted()) {
if (displayTransform) {
final String name = JDialogBase.makeImageName(image.getImageName(), "_register");
resultImage = algoReg.getTransformedImage(interp2);
resultImage.calcMinMax();
resultImage.setImageName(name);
if (resultImage != null) {
try {
new ViewJFrameImage(resultImage, null, new Dimension(610, 200));
} catch (final OutOfMemoryError error) {
MipavUtil.displayError("Out of memory: unable to open new frame");
}
} else {
MipavUtil.displayError("Result Image is null");
}
}
if (doGraph) {
rot = algoReg.getRot();
posR = new float[3][image.getExtents()[3]];
for (i = 0; i < image.getExtents()[3]; i++) {
posR[0][i] = i + 1.0f;
posR[1][i] = i + 1.0f;
posR[2][i] = i + 1.0f;
}
final ViewJFrameGraph rotGraph = new ViewJFrameGraph(posR, rot, "Rotations", "Volume number",
"Degrees");
rotGraph.makeRangeSymmetric();
rotGraph.showXYZLegends();
rotGraph.setDefaultDirectory(ViewUserInterface.getReference().getDefaultDirectory());
rotGraph.setVisible(true);
trans = algoReg.getTrans();
posT = new float[3][image.getExtents()[3]];
for (i = 0; i < image.getExtents()[3]; i++) {
posT[0][i] = i + 1.0f;
posT[1][i] = i + 1.0f;
posT[2][i] = i + 1.0f;
}
final ViewJFrameGraph transGraph = new ViewJFrameGraph(posT, trans, "Translations",
"Volume number", "Translations in "
+ FileInfoBase
.getUnitsOfMeasureAbbrevStr(image.getFileInfo(0).getUnitsOfMeasure(0)));
transGraph.makeRangeSymmetric();
transGraph.showXYZLegends();
transGraph.setDefaultDirectory(ViewUserInterface.getReference().getDefaultDirectory());
transGraph.setVisible(true);
} // if (doGraph)
}
if (algoReg != null) {
algoReg.disposeLocal();
algoReg = null;
}
if (rot != null) {
for (i = 0; i < rot.length; i++) {
rot[i] = null;
}
rot = null;
}
if (posR != null) {
for (i = 0; i < posR.length; i++) {
posR[i] = null;
}
posR = null;
}
if (trans != null) {
for (i = 0; i < trans.length; i++) {
trans[i] = null;
}
trans = null;
}
if (posT != null) {
for (i = 0; i < posT.length; i++) {
posT[i] = null;
}
posT = null;
}
if (algorithm.isCompleted()) {
insertScriptLine();
}
}
}
/**
* Accessor to get the result image.
*
* @return Result image.
*/
public ModelImage getResultImage() {
return resultImage;
}
/**
* Changes the interpolation box to enabled or disabled depending on if the transform box is checked or not.
*
* @param event Event that triggered this function.
*/
public void itemStateChanged(final ItemEvent event) {
if (event.getSource() == transformCheckbox) {
comboBoxInterp2.setEnabled(transformCheckbox.isSelected());
labelInterp2.setEnabled(transformCheckbox.isSelected());
} else if (event.getSource() == comboBoxCostFunct) {
if (comboBoxCostFunct.getSelectedIndex() == 2) {
sincCheckBox.setEnabled(true);
} else {
sincCheckBox.setEnabled(false);
sincCheckBox.setSelected(false);
}
} else if (event.getSource() == comboBoxDOF) {
if (comboBoxDOF.getSelectedIndex() == 0) {
graphCheckBox.setEnabled(true);
} else {
graphCheckBox.setEnabled(false);
graphCheckBox.setSelected(false);
}
} else if ( (event.getSource() == meanButton) || (event.getSource() == referenceButton)) {
if (referenceButton.isSelected()) {
refImageNumText.setEnabled(true);
} else {
refImageNumText.setEnabled(false);
}
}
}
/**
* Accessor to set the choice of cost function.
*
* @param x Cost function.
*/
public void setCostChoice(final int x) {
cost = x;
}
/**
* Accessor to set whether or not the graph of the output should occur.
*
* @param doDisplay if true graph result of translations and rotations
*/
public void setDisplayResult(final boolean doDisplay) {
displayTransform = doDisplay;
}
/**
* Accessor to set the degrees of freedom.
*
* @param x Degrees of freedom
*/
public void setDOF(final int x) {
DOF = x;
}
/**
* Accessor to set whether or not subsampling occurs.
*
* @param doFinalXCorrSinc if true subsample the image
*/
public void setFinalCostXCorrSinc(final boolean doFinalXCorrSinc) {
sincNormalizedCrossCorrelation = doFinalXCorrSinc;
}
/**
* Accessor to set whether or not subsampling occurs.
*
* @param setFinalRegAtLevel2 DOCUMENT ME!
*/
public void setFinalRegistrationAtLevel2(final boolean setFinalRegAtLevel2) {
this.finalRegistrationAtLevel2 = setFinalRegAtLevel2;
}
/**
* Accessor to set whether or not the graph of the output should occur.
*
* @param doGraph if true graph result of translations and rotations
*/
public void setGraph(final boolean doGraph) {
this.doGraph = doGraph;
}
/**
* Accessor to set graphCheckBox.
*
* @param doGraph if true output graphs of rotations and translations
*/
public void setGraphCheckBox(final boolean doGraph) {
this.doGraph = doGraph;
}
/**
* Accessor to set the initial interpolation.
*
* @param x Interpolation
*/
public void setInterp(final int x) {
interp = x;
}
/**
* Accessor to set the final interpolation.
*
* @param x Interpolation
*/
public void setInterp2(final int x) {
interp2 = x;
}
/**
* Accessor to set refImageNum.
*
* @param refImageNumber number of reference volume
*/
public void setRefImageNum(final int refImageNumber) {
refImageNum = refImageNumber;
}
/**
* Accessor to set whether or not subsampling occurs.
*
* @param doSubsample if true subsample the image
*/
public void setSubsample(final boolean doSubsample) {
this.doSubsample = doSubsample;
}
/**
* Accessor to set whether or not to use average volume as a referece.
*
* @param useAverageVolumeRef if true use average volume as the referenc image
*/
public void setUseAverageVolumeRef(final boolean useAverageVolumeRef) {
this.useReferenceTimeSlice = !useAverageVolumeRef;
}
/**
* Calls the time series registration algorithm.
*/
protected void callAlgorithm() {
algoReg = new AlgorithmRegTSOAR(image, cost, DOF, interp, useReferenceTimeSlice, refImageNum,
sincNormalizedCrossCorrelation, doGraph, doSubsample, finalRegistrationAtLevel2);
algoReg.addListener(this);
createProgressBar(image.getImageName(), algoReg);
if (isRunInSeparateThread()) {
// Start the thread as a low priority because we wish to still have user interface work fast.
if (algoReg.startMethod(Thread.MIN_PRIORITY) == false) {
MipavUtil.displayError("A thread is already running on this object");
}
} else {
algoReg.run();
}
dispose();
}
/**
* Store the result image in the script runner's image table now that the action execution is finished.
*/
protected void doPostAlgorithmActions() {
if (getResultImage() != null) {
AlgorithmParameters.storeImageInRunner(getResultImage());
}
}
/**
* {@inheritDoc}
*/
protected void setGUIFromParams() {
image = scriptParameters.retrieveInputImage();
parentFrame = image.getParentFrame();
setCostChoice(scriptParameters.getParams().getInt("cost_function_type"));
setDOF(scriptParameters.getParams().getInt("degrees_of_freedom"));
setInterp(scriptParameters.getParams().getInt("initial_interpolation_type"));
setUseAverageVolumeRef(scriptParameters.getParams().getBoolean("do_use_avg_volume_as_reference"));
setRefImageNum(scriptParameters.getParams().getInt("reference_volume_num"));
setFinalCostXCorrSinc(scriptParameters.getParams().getBoolean("do_use_norm_cross_correlation_sinc"));
setGraph(scriptParameters.getParams().getBoolean("do_graph_transform"));
setSubsample(scriptParameters.getParams().getBoolean("do_subsample"));
setFinalRegistrationAtLevel2(scriptParameters.getParams().getBoolean("do_final_reg_at_level_2"));
setDisplayResult(scriptParameters.getParams().getBoolean("do_display_transform"));
setInterp2(scriptParameters.getParams().getInt("final_interpolation_type"));
}
/**
* {@inheritDoc}
*/
protected void storeParamsFromGUI() throws ParserException {
scriptParameters.storeInputImage(image);
scriptParameters.storeOutputImageParams(getResultImage(), (getResultImage() != null));
scriptParameters.getParams().put(ParameterFactory.newParameter("cost_function_type", cost));
scriptParameters.getParams().put(ParameterFactory.newParameter("degrees_of_freedom", DOF));
scriptParameters.getParams().put(ParameterFactory.newParameter("initial_interpolation_type", interp));
scriptParameters.getParams().put(ParameterFactory.newParameter("final_interpolation_type", interp2));
scriptParameters.getParams().put(
ParameterFactory.newParameter("do_use_avg_volume_as_reference", !useReferenceTimeSlice));
scriptParameters.getParams().put(ParameterFactory.newParameter("reference_volume_num", refImageNum));
scriptParameters.getParams().put(
ParameterFactory.newParameter("do_use_norm_cross_correlation_sinc", sincNormalizedCrossCorrelation));
scriptParameters.getParams().put(ParameterFactory.newParameter("do_graph_transform", doGraph));
scriptParameters.getParams().put(ParameterFactory.newParameter("do_subsample", doSubsample));
scriptParameters.getParams().put(
ParameterFactory.newParameter("do_final_reg_at_level_2", finalRegistrationAtLevel2));
scriptParameters.getParams().put(ParameterFactory.newParameter("do_display_transform", displayTransform));
}
/**
* Initializes GUI components and displays dialog.
*/
private void init() {
setTitle("Time Series Registration");
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(buildTitledBorder("Input Options"));
final JLabel labelDOF = new JLabel("Degrees of freedom:");
labelDOF.setForeground(Color.black);
labelDOF.setFont(serif12);
labelDOF.setAlignmentX(Component.LEFT_ALIGNMENT);
comboBoxDOF = new JComboBox();
comboBoxDOF.setFont(MipavUtil.font12);
comboBoxDOF.setBackground(Color.white);
comboBoxDOF.setToolTipText("Degrees of freedom");
comboBoxDOF.addItem("Rigid - 6");
comboBoxDOF.addItem("Global rescale - 7");
comboBoxDOF.addItem("Specific rescale - 9");
comboBoxDOF.addItem("Affine - 12");
comboBoxDOF.setSelectedIndex(0);
comboBoxDOF.addItemListener(this);
final JLabel labelCost = new JLabel("Cost function:");
labelCost.setForeground(Color.black);
labelCost.setFont(serif12);
labelCost.setAlignmentX(Component.LEFT_ALIGNMENT);
comboBoxCostFunct = new JComboBox();
comboBoxCostFunct.setFont(MipavUtil.font12);
comboBoxCostFunct.setBackground(Color.white);
comboBoxCostFunct.setToolTipText("Cost function");
if (image.isColorImage()) {
comboBoxCostFunct.addItem("Least squares");
comboBoxCostFunct.setSelectedIndex(0);
} else {
comboBoxCostFunct.addItem("Correlation ratio");
comboBoxCostFunct.addItem("Least squares");
comboBoxCostFunct.addItem("Normalized cross correlation");
comboBoxCostFunct.addItem("Normalized mutual information");
comboBoxCostFunct.setSelectedIndex(2);
}
comboBoxCostFunct.addItemListener(this);
final JLabel labelInterp = new JLabel("Interpolation:");
labelInterp.setForeground(Color.black);
labelInterp.setFont(serif12);
labelInterp.setAlignmentX(Component.LEFT_ALIGNMENT);
comboBoxInterp = new JComboBox();
comboBoxInterp.setFont(serif12);
comboBoxInterp.setBackground(Color.white);
comboBoxInterp.setAlignmentX(Component.LEFT_ALIGNMENT);
comboBoxInterp.addItem("Trilinear");
comboBoxInterp.addItem("Bspline 3rd order");
comboBoxInterp.addItem("Bspline 4th order");
comboBoxInterp.addItem("Cubic Lagrangian");
comboBoxInterp.addItem("Quintic Lagrangian");
comboBoxInterp.addItem("Heptic Lagrangian");
comboBoxInterp.addItem("Windowed sinc");
// comboBoxInterp.addItem("Nearest Neighbor");
sincCheckBox = new JCheckBox("Finalize with normalized cross correlation sinc");
sincCheckBox.setFont(serif12);
sincCheckBox.setForeground(Color.black);
sincCheckBox.setSelected(false);
if (image.isColorImage()) {
sincCheckBox.setEnabled(false);
}
sampleCheckBox = new JCheckBox("Subsample image for speed");
sampleCheckBox.setFont(serif12);
sampleCheckBox.setForeground(Color.black);
sampleCheckBox.setSelected(true);
sampleCheckBox.setEnabled(true);
sampleCheckBoxLevel2 = new JCheckBox("Set final subsample at Level 2 (speeds registration)");
sampleCheckBoxLevel2.setFont(serif12);
sampleCheckBoxLevel2.setForeground(Color.black);
sampleCheckBoxLevel2.setSelected(false);
sampleCheckBoxLevel2.setEnabled(true);
final ButtonGroup group = new ButtonGroup();
referenceButton = new JRadioButton("Register to reference volume(0-"
+ String.valueOf(image.getExtents()[3] - 1) + ")");
referenceButton.setSelected(true);
referenceButton.setFont(serif12);
referenceButton.setForeground(Color.black);
referenceButton.addItemListener(this);
group.add(referenceButton);
refImageNumText = new JTextField("0", 3);
refImageNumText.setEnabled(true);
meanButton = new JRadioButton("Register to average volume");
meanButton.setFont(serif12);
meanButton.setForeground(Color.black);
meanButton.addItemListener(this);
group.add(meanButton);
final Insets insets = new Insets(0, 2, 0, 2);
final GridBagConstraints gbc = new GridBagConstraints();
gbc.insets = insets;
gbc.anchor = GridBagConstraints.WEST;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.fill = GridBagConstraints.NONE;
panel.add(labelDOF, gbc);
gbc.gridx = 1;
gbc.gridy = 0;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(comboBoxDOF, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 0;
gbc.fill = GridBagConstraints.NONE;
panel.add(labelInterp, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(comboBoxInterp, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.weightx = 0;
gbc.fill = GridBagConstraints.NONE;
panel.add(labelCost, gbc);
gbc.gridx = 1;
gbc.gridy = 2;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(comboBoxCostFunct, gbc);
gbc.gridx = 0;
gbc.gridy = 3;
panel.add(sincCheckBox, gbc);
gbc.gridx = 0;
gbc.gridy = 4;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(sampleCheckBox, gbc);
gbc.gridx = 0;
gbc.gridy = 5;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
panel.add(sampleCheckBoxLevel2, gbc);
gbc.gridx = 0;
gbc.gridy = 6;
panel.add(referenceButton, gbc);
gbc.gridx = 1;
gbc.gridy = 6;
panel.add(refImageNumText, gbc);
gbc.gridx = 0;
gbc.gridy = 7;
panel.add(meanButton, gbc);
final JPanel outPanel = new JPanel();
outPanel.setLayout(new GridBagLayout());
outPanel.setBorder(buildTitledBorder("Output Options"));
transformCheckbox = new JCheckBox("Display transformed image");
transformCheckbox.setFont(serif12);
transformCheckbox.setForeground(Color.black);
transformCheckbox.setSelected(true);
transformCheckbox.addItemListener(this);
labelInterp2 = new JLabel("Interpolation:");
labelInterp2.setForeground(Color.black);
labelInterp2.setFont(serif12);
labelInterp2.setAlignmentX(Component.LEFT_ALIGNMENT);
comboBoxInterp2 = new JComboBox();
comboBoxInterp2.setFont(serif12);
comboBoxInterp2.setBackground(Color.white);
comboBoxInterp2.setAlignmentX(Component.LEFT_ALIGNMENT);
comboBoxInterp2.addItem("Trilinear");
comboBoxInterp2.addItem("Bspline 3rd order");
comboBoxInterp2.addItem("Bspline 4th order");
comboBoxInterp2.addItem("Cubic Lagrangian");
comboBoxInterp2.addItem("Quintic Lagrangian");
comboBoxInterp2.addItem("Heptic Lagrangian");
comboBoxInterp2.addItem("Windowed sinc");
comboBoxInterp2.addItem("Nearest Neighbor");
graphCheckBox = new JCheckBox("Graph rotations and translations");
graphCheckBox.setFont(serif12);
graphCheckBox.setForeground(Color.black);
graphCheckBox.setSelected(false);
graphCheckBox.setEnabled(true);
gbc.gridx = 0;
gbc.gridy = 0;
gbc.weightx = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
outPanel.add(transformCheckbox, gbc);
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 0;
gbc.fill = GridBagConstraints.NONE;
outPanel.add(labelInterp2, gbc);
gbc.gridx = 1;
gbc.gridy = 1;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
outPanel.add(comboBoxInterp2, gbc);
gbc.gridx = 0;
gbc.gridy = 2;
gbc.weightx = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
outPanel.add(graphCheckBox, gbc);
final JPanel mainPanel = new JPanel(new BorderLayout());
mainPanel.add(panel);
mainPanel.add(outPanel, BorderLayout.SOUTH);
getContentPane().add(mainPanel);
getContentPane().add(buildButtons(), BorderLayout.SOUTH);
pack();
setVisible(true);
}
/**
* Sets the variables based on what was selected in the GUI. Returns flag indicating success.
*
* @return <code>true</code> if successful.
*/
private boolean setVariables() {
switch (comboBoxDOF.getSelectedIndex()) {
case 0:
DOF = 6;
break;
case 1:
DOF = 7;
break;
case 2:
DOF = 9;
break;
case 3:
DOF = 12;
break;
default:
DOF = 12;
break;
}
switch (comboBoxInterp.getSelectedIndex()) {
case 0:
interp = AlgorithmTransform.TRILINEAR;
break;
case 1:
interp = AlgorithmTransform.BSPLINE3;
break;
case 2:
interp = AlgorithmTransform.BSPLINE4;
break;
case 3:
interp = AlgorithmTransform.CUBIC_LAGRANGIAN;
break;
case 4:
interp = AlgorithmTransform.QUINTIC_LAGRANGIAN;
break;
case 5:
interp = AlgorithmTransform.HEPTIC_LAGRANGIAN;
break;
case 6:
interp = AlgorithmTransform.WSINC;
break;
// case 7: interp = AlgorithmTransform.NEAREST_NEIGHBOR; break;
default:
interp = AlgorithmTransform.TRILINEAR;
break;
}
if (image.isColorImage()) {
switch (comboBoxCostFunct.getSelectedIndex()) {
case 0:
cost = AlgorithmCostFunctions.LEAST_SQUARES_SMOOTHED_COLOR;
break;
default:
cost = AlgorithmCostFunctions.LEAST_SQUARES_SMOOTHED_COLOR;
}
} else { // black and white image
switch (comboBoxCostFunct.getSelectedIndex()) {
case 0:
cost = AlgorithmCostFunctions.CORRELATION_RATIO_SMOOTHED;
break;
case 1:
cost = AlgorithmCostFunctions.LEAST_SQUARES_SMOOTHED;
break;
case 2:
cost = AlgorithmCostFunctions.NORMALIZED_XCORRELATION;
break;
case 3:
cost = AlgorithmCostFunctions.NORMALIZED_MUTUAL_INFORMATION_SMOOTHED;
break;
default:
cost = AlgorithmCostFunctions.NORMALIZED_XCORRELATION;
break;
}
}
sincNormalizedCrossCorrelation = sincCheckBox.isSelected();
switch (comboBoxInterp2.getSelectedIndex()) {
case 0:
interp2 = AlgorithmTransform.TRILINEAR;
break;
case 1:
interp2 = AlgorithmTransform.BSPLINE3;
break;
case 2:
interp2 = AlgorithmTransform.BSPLINE4;
break;
case 3:
interp2 = AlgorithmTransform.CUBIC_LAGRANGIAN;
break;
case 4:
interp2 = AlgorithmTransform.QUINTIC_LAGRANGIAN;
break;
case 5:
interp2 = AlgorithmTransform.HEPTIC_LAGRANGIAN;
break;
case 6:
interp2 = AlgorithmTransform.WSINC;
break;
case 7:
interp2 = AlgorithmTransform.NEAREST_NEIGHBOR;
break;
default:
interp2 = AlgorithmTransform.TRILINEAR;
break;
}
displayTransform = transformCheckbox.isSelected();
useReferenceTimeSlice = referenceButton.isSelected();
if (useReferenceTimeSlice) {
if ( !JDialogBase.testParameter(refImageNumText.getText(), 0, image.getExtents()[3] - 1)) {
refImageNumText.requestFocus();
refImageNumText.selectAll();
return false;
} else {
refImageNum = Integer.valueOf(refImageNumText.getText()).intValue();
}
} // if (reference)
doGraph = graphCheckBox.isSelected();
doSubsample = sampleCheckBox.isSelected();
finalRegistrationAtLevel2 = sampleCheckBoxLevel2.isSelected();
return true;
}
}
| [
"abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96"
] | abokinsky@ba61647d-9d00-f842-95cd-605cb4296b96 |
bee3ca91a559230369770070b4a60295df37bda4 | f525deacb5c97e139ae2d73a4c1304affb7ea197 | /gitv/src/main/java/com/gala/video/lib/share/uikit/view/HScrollView.java | 873ea55f39c521deca08e5b0e83adcd6cda15280 | [] | no_license | AgnitumuS/gitv | 93b2359e1bf9f2b6c945298c61c5c6dbfeea49b3 | 242c9a10a0aeb41b9589de9f254e6ce9f57bd77a | refs/heads/master | 2021-08-08T00:50:10.630301 | 2017-11-09T08:10:33 | 2017-11-09T08:10:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,932 | java | package com.gala.video.lib.share.uikit.view;
import android.content.Context;
import android.util.AttributeSet;
import com.gala.video.albumlist.layout.GridLayout;
import com.gala.video.albumlist.widget.HorizontalGridView;
import com.gala.video.lib.share.uikit.contract.HScrollContract.Presenter;
import com.gala.video.lib.share.uikit.contract.HScrollContract.View;
import com.gala.video.lib.share.uikit.core.BinderViewHolder;
import java.util.Collections;
public class HScrollView extends HorizontalGridView implements IViewLifecycle<Presenter>, View {
public HScrollView(Context context) {
this(context, null);
}
public HScrollView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public HScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
setClipToPadding(false);
setClipChildren(false);
setFocusMode(1);
setScrollRoteScale(0.8f, 1.0f, 2.5f);
setQuickFocusLeaveForbidden(true);
setFocusLeaveForbidden(83);
}
public void onBind(Presenter object) {
object.setView(this);
if (getAdapter() == null) {
setAdapter(object.getAdapter());
registerListener(object);
}
updateView(object);
}
private void registerListener(Presenter object) {
setOnScrollListener(object.getActionPolicy());
setOnItemClickListener(object.getActionPolicy());
setOnItemFocusChangedListener(object.getActionPolicy());
setOnFocusLostListener(object.getActionPolicy());
setOnItemStateChangeListener(object.getActionPolicy());
setOnFirstLayoutListener(object.getActionPolicy());
}
private void updateView(Presenter object) {
boolean z;
setHorizontalMargin(30);
if (object.getCardModel().getShowPosition() == 1) {
z = true;
} else {
z = false;
}
showPositionInfo(z);
setPadding(25, object.getCardModel().getBodyPaddingTop(), 25, 0);
GridLayout layout = new GridLayout();
layout.setNumRows(1);
layout.setItemCount(object.getAdapter().getCount());
getLayoutManager().setLayouts(Collections.singletonList(layout));
}
public void onUnbind(Presenter object) {
int first = getFirstAttachedPosition();
int last = getLastAttachedPosition();
for (int i = first; i <= last; i++) {
((BinderViewHolder) getViewHolderByPosition(i)).unbind();
}
}
public void onShow(Presenter object) {
int first = getFirstAttachedPosition();
int last = getLastAttachedPosition();
for (int i = first; i <= last; i++) {
((BinderViewHolder) getViewHolderByPosition(i)).show();
}
}
public void onHide(Presenter object) {
}
}
| [
"liuwencai@le.com"
] | liuwencai@le.com |
7673f2c313c707dfa4bba1f152c7e2c04fcee501 | 21f27c432e345a9c34c877072ea9ccf2221b27c7 | /src/main/java/com/xiaomi/nrb/superman/service/impl/RelationServiceImpl.java | 629668b28be0cdf04b756cbc902f712259bb8cd2 | [] | no_license | CoqCow/superman | bdb1167a8e717c7d2dd0f98d0f736f146e5b8ce9 | 1df40c85b4b290ac90e3e0f3c1a6b58092840dfd | refs/heads/master | 2022-06-23T00:27:21.604850 | 2019-11-25T07:06:15 | 2019-11-25T07:06:15 | 198,926,238 | 0 | 0 | null | 2022-06-21T02:16:22 | 2019-07-26T01:41:32 | Java | UTF-8 | Java | false | false | 2,627 | java | package com.xiaomi.nrb.superman.service.impl;
import com.xiaomi.nrb.superman.dao.PlanMapper;
import com.xiaomi.nrb.superman.dao.RelationMapper;
import com.xiaomi.nrb.superman.domain.Plan;
import com.xiaomi.nrb.superman.domain.Relation;
import com.xiaomi.nrb.superman.enums.PlanTypeEnum;
import com.xiaomi.nrb.superman.enums.RelationTypeEnum;
import com.xiaomi.nrb.superman.request.AddRelationReq;
import com.xiaomi.nrb.superman.response.PlanInfo;
import com.xiaomi.nrb.superman.service.PlanService;
import com.xiaomi.nrb.superman.service.RelationService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
/**
* @author niuruobing@xiaomi.com
* @since 2019-08-08 08:05
**/
@Service
public class RelationServiceImpl implements RelationService {
@Resource
private PlanService planService;
@Resource
private RelationMapper relationMapper;
@Resource
private PlanMapper planMapper;
@Override
public PlanInfo addRelation(AddRelationReq request) {
PlanInfo planInfo = planService.detailPlan(request);
if (planInfo == null) {
return planInfo;
}
//自己可以围观、点赞自己对计划 不可以挑战自己对计划
Integer type = null;
if (RelationTypeEnum.RELATION_SEE.getCode() == request.getType() && !planInfo.isSeeTag()) {
type = RelationTypeEnum.RELATION_SEE.getCode();
} else if (RelationTypeEnum.RELATION_UPVOTE.getCode() == request.getType() && !planInfo.isZanTag()) {
type = RelationTypeEnum.RELATION_UPVOTE.getCode();
} else if (RelationTypeEnum.RELATION_CHALLEGE.getCode() == request.getType() && !planInfo.isTag()) {
type = RelationTypeEnum.RELATION_CHALLEGE.getCode();
}
if (null == type) {
return planInfo;
}
Relation relation = new Relation();
relation.setUserId(request.getUserId());
relation.setPlanId(request.getPlanId());
relation.setPlanUserId(planInfo.getUserId());
relation.setType(type);
relation.setCtime(new Date());
relationMapper.insertSelective(relation);
//是否更新为YOU计划
if (planInfo.getType() != PlanTypeEnum.PLAN_YOU.getCode() && planService.isYouPlan(planInfo)) {
planInfo.setYouTag(true);
Plan plan = new Plan();
plan.setId(planInfo.getId());
plan.setType(PlanTypeEnum.PLAN_YOU.getCode());
planMapper.updateByPrimaryKeySelective(plan);
}
return planService.detailPlan(request);
}
}
| [
"niuruobing@xiaomi.com"
] | niuruobing@xiaomi.com |
f03cc3b36e0625d51b4de44ab223d61d4bf8a908 | e7ee311e20b40c87bf6d23a53a1d7b11fd29d2c3 | /src/chosun/ciis/ss/sls/move/dm/SS_A_MOVM_RDR_CLOS_DETAILDM.java | 8beaf565e56b673234ec1ab5f601e260522f4bb6 | [] | no_license | nosmoon/misdevteam | 4e3695ef7bbdcd231bb84d7d8d7df54a23ff0a60 | 1829d5bd489eb6dd307ca244f0e183a31a1de773 | refs/heads/master | 2020-04-15T15:57:05.480056 | 2019-01-10T01:12:01 | 2019-01-10T01:12:01 | 164,812,547 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 12,292 | java | /***************************************************************************************************
* 파일명 : .java
* 기능 :
* 작성일자 :
* 작성자 : 심정보
***************************************************************************************************/
/***************************************************************************************************
* 수정내역 :
* 수정자 :
* 수정일자 :
* 백업 :
***************************************************************************************************/
package chosun.ciis.ss.sls.move.dm;
import java.sql.*;
import oracle.jdbc.driver.*;
import somo.framework.db.*;
import somo.framework.util.*;
import chosun.ciis.ss.sls.move.ds.*;
import chosun.ciis.ss.sls.move.rec.*;
/**
*
*/
public class SS_A_MOVM_RDR_CLOS_DETAILDM extends somo.framework.db.BaseDM implements java.io.Serializable{
public String incmgpers;
public String regdt;
public String regno;
public String movmrdrtype;
public String rstsubsmonths;
public String ipju_aptcd;
public String post_dlvyn;
public String suspyn;
public String rdr_val_gb;
public String set_gb;
public String jm_gb;
public String linkalon_fix;
public String saveflag;
public String auto_gb;
public SS_A_MOVM_RDR_CLOS_DETAILDM(){}
public SS_A_MOVM_RDR_CLOS_DETAILDM(String incmgpers, String regdt, String regno, String movmrdrtype, String rstsubsmonths, String ipju_aptcd, String post_dlvyn, String suspyn, String rdr_val_gb, String set_gb, String jm_gb, String linkalon_fix, String saveflag, String auto_gb){
this.incmgpers = incmgpers;
this.regdt = regdt;
this.regno = regno;
this.movmrdrtype = movmrdrtype;
this.rstsubsmonths = rstsubsmonths;
this.ipju_aptcd = ipju_aptcd;
this.post_dlvyn = post_dlvyn;
this.suspyn = suspyn;
this.rdr_val_gb = rdr_val_gb;
this.set_gb = set_gb;
this.jm_gb = jm_gb;
this.linkalon_fix = linkalon_fix;
this.saveflag = saveflag;
this.auto_gb = auto_gb;
}
public void setIncmgpers(String incmgpers){
this.incmgpers = incmgpers;
}
public void setRegdt(String regdt){
this.regdt = regdt;
}
public void setRegno(String regno){
this.regno = regno;
}
public void setMovmrdrtype(String movmrdrtype){
this.movmrdrtype = movmrdrtype;
}
public void setRstsubsmonths(String rstsubsmonths){
this.rstsubsmonths = rstsubsmonths;
}
public void setIpju_aptcd(String ipju_aptcd){
this.ipju_aptcd = ipju_aptcd;
}
public void setPost_dlvyn(String post_dlvyn){
this.post_dlvyn = post_dlvyn;
}
public void setSuspyn(String suspyn){
this.suspyn = suspyn;
}
public void setRdr_val_gb(String rdr_val_gb){
this.rdr_val_gb = rdr_val_gb;
}
public void setSet_gb(String set_gb){
this.set_gb = set_gb;
}
public void setJm_gb(String jm_gb){
this.jm_gb = jm_gb;
}
public void setLinkalon_fix(String linkalon_fix){
this.linkalon_fix = linkalon_fix;
}
public void setSaveflag(String saveflag){
this.saveflag = saveflag;
}
public void setAuto_gb(String auto_gb){
this.auto_gb = auto_gb;
}
public String getIncmgpers(){
return this.incmgpers;
}
public String getRegdt(){
return this.regdt;
}
public String getRegno(){
return this.regno;
}
public String getMovmrdrtype(){
return this.movmrdrtype;
}
public String getRstsubsmonths(){
return this.rstsubsmonths;
}
public String getIpju_aptcd(){
return this.ipju_aptcd;
}
public String getPost_dlvyn(){
return this.post_dlvyn;
}
public String getSuspyn(){
return this.suspyn;
}
public String getRdr_val_gb(){
return this.rdr_val_gb;
}
public String getSet_gb(){
return this.set_gb;
}
public String getJm_gb(){
return this.jm_gb;
}
public String getLinkalon_fix(){
return this.linkalon_fix;
}
public String getSaveflag(){
return this.saveflag;
}
public String getAuto_gb(){
return this.auto_gb;
}
public String getSQL(){
return "{ call CRMSAL_COM.SP_SS_A_MOVM_RDR_CLOS_DETAIL(? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,? ,?) }";
}
public void setParams(CallableStatement cstmt, BaseDM bdm) throws SQLException{
SS_A_MOVM_RDR_CLOS_DETAILDM dm = (SS_A_MOVM_RDR_CLOS_DETAILDM)bdm;
cstmt.registerOutParameter(1, Types.VARCHAR);
cstmt.registerOutParameter(2, Types.VARCHAR);
cstmt.setString(3, dm.incmgpers);
cstmt.setString(4, dm.regdt);
cstmt.setString(5, dm.regno);
cstmt.setString(6, dm.movmrdrtype);
cstmt.setString(7, dm.rstsubsmonths);
cstmt.setString(8, dm.ipju_aptcd);
cstmt.setString(9, dm.post_dlvyn);
cstmt.setString(10, dm.suspyn);
cstmt.setString(11, dm.rdr_val_gb);
cstmt.setString(12, dm.set_gb);
cstmt.setString(13, dm.jm_gb);
cstmt.setString(14, dm.linkalon_fix);
cstmt.setString(15, dm.saveflag);
cstmt.setString(16, dm.auto_gb);
}
public BaseDataSet createDataSetObject(){
return new chosun.ciis.ss.sls.move.ds.SS_A_MOVM_RDR_CLOS_DETAILDataSet();
}
public void print(){
System.out.println("SQL = " + this.getSQL());
System.out.println("incmgpers = [" + getIncmgpers() + "]");
System.out.println("regdt = [" + getRegdt() + "]");
System.out.println("regno = [" + getRegno() + "]");
System.out.println("movmrdrtype = [" + getMovmrdrtype() + "]");
System.out.println("rstsubsmonths = [" + getRstsubsmonths() + "]");
System.out.println("ipju_aptcd = [" + getIpju_aptcd() + "]");
System.out.println("post_dlvyn = [" + getPost_dlvyn() + "]");
System.out.println("suspyn = [" + getSuspyn() + "]");
System.out.println("rdr_val_gb = [" + getRdr_val_gb() + "]");
System.out.println("set_gb = [" + getSet_gb() + "]");
System.out.println("jm_gb = [" + getJm_gb() + "]");
System.out.println("linkalon_fix = [" + getLinkalon_fix() + "]");
System.out.println("saveflag = [" + getSaveflag() + "]");
System.out.println("auto_gb = [" + getAuto_gb() + "]");
}
}
/*----------------------------------------------------------------------------------------------------
Web Tier에서 req.getParameter() 처리 및 결과확인 검사시 사용하십시오.
String incmgpers = req.getParameter("incmgpers");
if( incmgpers == null){
System.out.println(this.toString+" : incmgpers is null" );
}else{
System.out.println(this.toString+" : incmgpers is "+incmgpers );
}
String regdt = req.getParameter("regdt");
if( regdt == null){
System.out.println(this.toString+" : regdt is null" );
}else{
System.out.println(this.toString+" : regdt is "+regdt );
}
String regno = req.getParameter("regno");
if( regno == null){
System.out.println(this.toString+" : regno is null" );
}else{
System.out.println(this.toString+" : regno is "+regno );
}
String movmrdrtype = req.getParameter("movmrdrtype");
if( movmrdrtype == null){
System.out.println(this.toString+" : movmrdrtype is null" );
}else{
System.out.println(this.toString+" : movmrdrtype is "+movmrdrtype );
}
String rstsubsmonths = req.getParameter("rstsubsmonths");
if( rstsubsmonths == null){
System.out.println(this.toString+" : rstsubsmonths is null" );
}else{
System.out.println(this.toString+" : rstsubsmonths is "+rstsubsmonths );
}
String ipju_aptcd = req.getParameter("ipju_aptcd");
if( ipju_aptcd == null){
System.out.println(this.toString+" : ipju_aptcd is null" );
}else{
System.out.println(this.toString+" : ipju_aptcd is "+ipju_aptcd );
}
String post_dlvyn = req.getParameter("post_dlvyn");
if( post_dlvyn == null){
System.out.println(this.toString+" : post_dlvyn is null" );
}else{
System.out.println(this.toString+" : post_dlvyn is "+post_dlvyn );
}
String suspyn = req.getParameter("suspyn");
if( suspyn == null){
System.out.println(this.toString+" : suspyn is null" );
}else{
System.out.println(this.toString+" : suspyn is "+suspyn );
}
String rdr_val_gb = req.getParameter("rdr_val_gb");
if( rdr_val_gb == null){
System.out.println(this.toString+" : rdr_val_gb is null" );
}else{
System.out.println(this.toString+" : rdr_val_gb is "+rdr_val_gb );
}
String set_gb = req.getParameter("set_gb");
if( set_gb == null){
System.out.println(this.toString+" : set_gb is null" );
}else{
System.out.println(this.toString+" : set_gb is "+set_gb );
}
String jm_gb = req.getParameter("jm_gb");
if( jm_gb == null){
System.out.println(this.toString+" : jm_gb is null" );
}else{
System.out.println(this.toString+" : jm_gb is "+jm_gb );
}
String linkalon_fix = req.getParameter("linkalon_fix");
if( linkalon_fix == null){
System.out.println(this.toString+" : linkalon_fix is null" );
}else{
System.out.println(this.toString+" : linkalon_fix is "+linkalon_fix );
}
String saveflag = req.getParameter("saveflag");
if( saveflag == null){
System.out.println(this.toString+" : saveflag is null" );
}else{
System.out.println(this.toString+" : saveflag is "+saveflag );
}
----------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------
Web Tier에서 req.getParameter() 처리시 사용하십시오.
String incmgpers = Util.checkString(req.getParameter("incmgpers"));
String regdt = Util.checkString(req.getParameter("regdt"));
String regno = Util.checkString(req.getParameter("regno"));
String movmrdrtype = Util.checkString(req.getParameter("movmrdrtype"));
String rstsubsmonths = Util.checkString(req.getParameter("rstsubsmonths"));
String ipju_aptcd = Util.checkString(req.getParameter("ipju_aptcd"));
String post_dlvyn = Util.checkString(req.getParameter("post_dlvyn"));
String suspyn = Util.checkString(req.getParameter("suspyn"));
String rdr_val_gb = Util.checkString(req.getParameter("rdr_val_gb"));
String set_gb = Util.checkString(req.getParameter("set_gb"));
String jm_gb = Util.checkString(req.getParameter("jm_gb"));
String linkalon_fix = Util.checkString(req.getParameter("linkalon_fix"));
String saveflag = Util.checkString(req.getParameter("saveflag"));
----------------------------------------------------------------------------------------------------*//*----------------------------------------------------------------------------------------------------
Web Tier에서 한글처리와 동시에 req.getParameter() 처리시 사용하십시오.
String incmgpers = Util.Uni2Ksc(Util.checkString(req.getParameter("incmgpers")));
String regdt = Util.Uni2Ksc(Util.checkString(req.getParameter("regdt")));
String regno = Util.Uni2Ksc(Util.checkString(req.getParameter("regno")));
String movmrdrtype = Util.Uni2Ksc(Util.checkString(req.getParameter("movmrdrtype")));
String rstsubsmonths = Util.Uni2Ksc(Util.checkString(req.getParameter("rstsubsmonths")));
String ipju_aptcd = Util.Uni2Ksc(Util.checkString(req.getParameter("ipju_aptcd")));
String post_dlvyn = Util.Uni2Ksc(Util.checkString(req.getParameter("post_dlvyn")));
String suspyn = Util.Uni2Ksc(Util.checkString(req.getParameter("suspyn")));
String rdr_val_gb = Util.Uni2Ksc(Util.checkString(req.getParameter("rdr_val_gb")));
String set_gb = Util.Uni2Ksc(Util.checkString(req.getParameter("set_gb")));
String jm_gb = Util.Uni2Ksc(Util.checkString(req.getParameter("jm_gb")));
String linkalon_fix = Util.Uni2Ksc(Util.checkString(req.getParameter("linkalon_fix")));
String saveflag = Util.Uni2Ksc(Util.checkString(req.getParameter("saveflag")));
----------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------
Web Tier에서 DM 파일의 변수를 설정시 사용하십시오.
dm.setIncmgpers(incmgpers);
dm.setRegdt(regdt);
dm.setRegno(regno);
dm.setMovmrdrtype(movmrdrtype);
dm.setRstsubsmonths(rstsubsmonths);
dm.setIpju_aptcd(ipju_aptcd);
dm.setPost_dlvyn(post_dlvyn);
dm.setSuspyn(suspyn);
dm.setRdr_val_gb(rdr_val_gb);
dm.setSet_gb(set_gb);
dm.setJm_gb(jm_gb);
dm.setLinkalon_fix(linkalon_fix);
dm.setSaveflag(saveflag);
----------------------------------------------------------------------------------------------------*/
/* 작성시간 : Fri Jul 25 11:56:24 KST 2014 */ | [
"DLCOM000@172.16.30.11"
] | DLCOM000@172.16.30.11 |
e3322d1491f336588d3d78c23a370dc45898d0b6 | 1c71e0b1ef9490fd419ff9a260adb90faddd4994 | /move-to-sdk/app/io/sphere/sdk/facets/BaseSelectFacet.java | 2f2c2fdb9677a531640f793c6c8fd418b80a0533 | [
"Apache-2.0"
] | permissive | lufego/sphere-sunrise | 8fd290cb2db8aec59298eba003a3f9742af1d985 | ccea8d0eef548c22cf2866959056c4db4de81fbe | refs/heads/master | 2021-01-17T20:57:09.631602 | 2015-09-02T13:56:29 | 2015-09-02T13:56:29 | 45,053,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,765 | java | package io.sphere.sdk.facets;
import io.sphere.sdk.search.*;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Optional;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.stream.Collectors.toList;
abstract class BaseSelectFacet<T> extends BaseFacet<T> implements SelectFacet<T> {
private final boolean multiSelect;
private final boolean matchingAll;
private final List<String> selectedValues;
private final Optional<TermFacetResult> facetResult;
private final Optional<Long> threshold;
private final Optional<Long> limit;
protected BaseSelectFacet(final String key, final String label, final FacetType type, final UntypedSearchModel<T> searchModel,
final boolean multiSelect, final boolean matchingAll, final List<String> selectedValues,
@Nullable final TermFacetResult facetResult, @Nullable final Long threshold, @Nullable final Long limit) {
super(key, label, type, searchModel);
if (threshold != null && limit != null && threshold > limit) {
throw new InvalidSelectFacetConstraintsException(threshold, limit);
}
this.multiSelect = multiSelect;
this.matchingAll = matchingAll;
this.selectedValues = selectedValues;
this.facetResult = Optional.ofNullable(facetResult);
this.threshold = Optional.ofNullable(threshold);
this.limit = Optional.ofNullable(limit);
}
/**
* Generates the facet options according to the facet result and selected values provided.
* @return the generated facet options
*/
protected List<FacetOption> getOptions() {
return facetResult
.map(result -> result.getTerms().stream()
.map(termStats -> FacetOption.ofTermStats(termStats, selectedValues))
.collect(toList()))
.orElse(emptyList());
}
@Override
public boolean isAvailable() {
return threshold.map(threshold -> getOptions().size() >= threshold).orElse(true);
}
@Override
public List<FacetOption> getAllOptions() {
return getOptions();
}
@Override
public List<FacetOption> getLimitedOptions() {
return limit.map(limit -> getOptions().stream().limit(limit).collect(toList()))
.orElse(getOptions());
}
@Override
public boolean isMultiSelect() {
return multiSelect;
}
@Override
public boolean isMatchingAll() {
return matchingAll;
}
@Override
public List<String> getSelectedValues() {
return selectedValues;
}
@Override
public Optional<TermFacetResult> getFacetResult() {
return facetResult;
}
@Override
public Optional<Long> getThreshold() {
return threshold;
}
@Override
public Optional<Long> getLimit() {
return limit;
}
@Override
public List<FilterExpression<T>> getFilterExpressions() {
final List<FilterExpression<T>> filterExpressions;
if (selectedValues.isEmpty()) {
filterExpressions = emptyList();
} else {
if (matchingAll) {
filterExpressions = selectedValues.stream()
.map(selectedValue -> searchModel.filtered().by(selectedValue))
.collect(toList());
} else {
filterExpressions = singletonList(searchModel.filtered().by(selectedValues));
}
}
return filterExpressions;
}
@Override
public FacetExpression<T> getFacetExpression() {
return searchModel.faceted().byAllTerms();
}
}
| [
"laura.luiz@commercetools.de"
] | laura.luiz@commercetools.de |
4526e344bbf6bf083cb0ea37b4ef2f004783cecd | f05ae70c513833c81e2828cbeba3d5913616a5b1 | /src/main/java/com/qays/bms/common/tasks/ScheduleTask.java | c4d6535e4f90ecb807bae01a4362ffe573eacabd | [] | no_license | qqqays/bms | 14f1f8533a68ae539eb0bd2a2e6a38568331f7b9 | 00b7e1ce74e79d46817804f6a16fae42e1abdafd | refs/heads/master | 2020-03-09T00:38:49.384950 | 2018-05-11T06:20:50 | 2018-05-11T06:20:50 | 128,493,277 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 713 | java | package com.qays.bms.common.tasks;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* Created by Q-ays.
* whosqays@gmail.com
* 04-26-2018 9:56
*/
@Configuration
@Component
@EnableScheduling
public class ScheduleTask {
public void overTimeNotice() {
//实际的业务
System.out.println("OverTime start time"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
System.out.println("OverTime end time"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
}
}
| [
"635216690@qq.com"
] | 635216690@qq.com |
c79ba3902525d3d2f2454a3fdd3b02ed650e2c07 | df7b4d0d8c7a027a82851f9f24a0c8f55ab96921 | /src/com/inzernettechnologies/bomblobbers/Game/DoubleJump.java | 33f31f04cc5b2e19c9e2c9cd75b20991b80507b9 | [] | no_license | InZernetTechnologies/BombLobbers | 5f5582aa43a3322e341423c5beccd1020b0e83af | a59fcf95131c8d19d1c5af948f52be2e9d50372c | refs/heads/master | 2021-06-20T20:02:18.429147 | 2017-07-10T04:13:42 | 2017-07-10T04:13:42 | 48,470,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,502 | java | package com.inzernettechnologies.bomblobbers.Game;
import com.inzernettechnologies.bomblobbers.libs.ParticleEffect;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import java.util.HashMap;
public class DoubleJump {
private static HashMap<Player, Integer> players = new HashMap<>();
public boolean canUse(Player player) {
if (players.containsKey(player)) {
if (players.get(player) < com.inzernettechnologies.bomblobbers.main.instance.getConfig().getInt("game.doubleJump.usage")) {
return true;
} else {
return false;
}
} else {
return true;
}
}
public void useJump(PlayerToggleFlightEvent event) {
if (canUse(event.getPlayer())) {
event.setCancelled(true);
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.IRONGOLEM_THROW, 10, -10);
event.getPlayer().setVelocity(event.getPlayer().getLocation().getDirection().multiply(1.5).setY(1.25));
event.getPlayer().setAllowFlight(false);
ParticleEffect.CLOUD.display(0.5f, 0.1f, 0.5f, 0.01f, 100, event.getPlayer().getLocation(), 1000);
if (players.containsKey(event.getPlayer())) {
players.put(event.getPlayer(), players.get(event.getPlayer()) + 1);
} else {
players.put(event.getPlayer(), 1);
}
}
}
}
| [
"cody-admin@inzernettechnologies.com"
] | cody-admin@inzernettechnologies.com |
d6ebca1337fb717ce852adab2fae530ef601906f | 16107c005116d095010c87c450bff07abc280bf7 | /src/im/compIII/exghdecore/banco/ContratoDB.java | 3f7852721d3cf05402a3abd4da44a0ec762e3941 | [] | no_license | felipe-melo/EXGHDecore | 4a81b42b9c393ad0f22e2bf439561a57ff136e89 | 19331d25b64bdd515b5a49f11a7629dd4734bbe0 | refs/heads/master | 2021-01-17T06:07:37.874773 | 2016-07-02T16:38:41 | 2016-07-02T16:38:41 | 60,782,293 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,097 | java | package im.compIII.exghdecore.banco;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import im.compIII.exghdecore.entidades.Ambiente;
import im.compIII.exghdecore.entidades.Contrato;
import im.compIII.exghdecore.exceptions.CampoVazioException;
import im.compIII.exghdecore.exceptions.ConexaoException;
import im.compIII.exghdecore.exceptions.RelacaoException;
public class ContratoDB {
public final long salvar(Contrato contrato)
throws ConexaoException, SQLException, ClassNotFoundException, NumberFormatException, RelacaoException {
Conexao.initConnection();
long id = 0;
String sql = "INSERT INTO contrato (COMISSAO) VALUES(?);";
PreparedStatement psmt = Conexao.prepare(sql);
psmt.setFloat(1, contrato.getComissao());
int linhasAfetadas = psmt.executeUpdate();
if (linhasAfetadas == 0) {
throw new ConexaoException();
}
ResultSet generatedKeys = psmt.getGeneratedKeys();
if (generatedKeys.next()) {
id = generatedKeys.getLong(1);
} else {
Conexao.rollBack();
Conexao.closeConnection();
throw new SQLException();
}
Conexao.commit();
Conexao.closeConnection();
return id;
}
public final void atualizar(Contrato contrato)
throws ConexaoException, SQLException, ClassNotFoundException, NumberFormatException, RelacaoException {
Conexao.initConnection();
String sql = "UPDATE CONTRATO SET COMISSAO = ? WHERE CONTRATOID = " + contrato.getId();
PreparedStatement psmt = Conexao.prepare(sql);
psmt.setFloat(1, contrato.getComissao());
int linhasAfetadas = psmt.executeUpdate();
if (linhasAfetadas == 0) {
Conexao.rollBack();
Conexao.closeConnection();
throw new ConexaoException();
}else{
Conexao.commit();
Conexao.closeConnection();
}
}
public static Collection<Contrato> listarTodos(Collection<Long> ids) throws ConexaoException, SQLException, ClassNotFoundException {
Conexao.initConnection();
String sql = "SELECT * FROM CONTRATO C JOIN AMBIENTE A where C.CONTRATOID = A.CONTRATOID order by C.CONTRATOID;";
Statement psmt = Conexao.prepare();
ResultSet result = psmt.executeQuery(sql);
ArrayList<Contrato> list = new ArrayList<Contrato>();
Contrato contrato = null;
while(result.next()) {
float comissao = result.getFloat("COMISSAO");
long ambienteId = result.getLong("AMBIENTEID");
Ambiente ambiente = AmbienteDB.buscar(ambienteId);
if (!ids.contains(result.getLong("CONTRATOID"))) {
ids.add(result.getLong("CONTRATOID"));
try {
ArrayList<Ambiente> ambientes = new ArrayList<Ambiente>();
ambientes.add(ambiente);
contrato = new Contrato(comissao);
} catch (CampoVazioException e) {
e.printStackTrace();
continue;
}
list.add(contrato);
}else if (contrato != null){
//contrato.getAmbientes().add(ambiente);
}
}
Conexao.closeConnection();
return list;
}
public final static Contrato buscar(long id) throws ConexaoException, SQLException, ClassNotFoundException {
Conexao.initConnection();
String sql = "SELECT * FROM CONTRATO C JOIN AMBIENTE A where C.CONTRATOID = A.CONTRATOID AND C.CONTRATOID = " + id + " order by C.CONTRATOID;";
Statement psmt = Conexao.prepare();
ResultSet result = psmt.executeQuery(sql);
ArrayList<Contrato> list = new ArrayList<Contrato>();
Contrato contrato = null;
ArrayList<Ambiente> ambientes = new ArrayList<Ambiente>();
float comissao = 0;
while(result.next()) {
comissao = result.getFloat("COMISSAO");
long ambienteId = result.getLong("AMBIENTEID");
Ambiente ambiente = AmbienteDB.buscar(ambienteId);
ambientes.add(ambiente);
list.add(contrato);
}
try {
contrato = new Contrato(comissao);
contrato.setAmbientes(ambientes);
} catch (CampoVazioException e) {
e.printStackTrace();
}
Conexao.closeConnection();
return contrato;
}
}
| [
"felipe.melo.devel@gmail.com"
] | felipe.melo.devel@gmail.com |
f4bd710f97b74831c6cfd5ea76a4656e603dd322 | 04dfdd89aba44c44f809054d260d23c6bf7255c6 | /test/Java Examples in a Nutshell/2nd Edition/com/davidflanagan/examples/graphics/CustomStrokes.java | 20a59ef88bc7bf48857d800b4f902fbe6b2a0f5c | [
"MIT"
] | permissive | shashanksingh28/code-similarity | f7d8f113501484334d67bfd08b73b6b0685586ea | 66f8714083dfefa65f295e32e3a6168f4d8c608e | refs/heads/master | 2021-01-11T19:34:13.142050 | 2017-09-11T00:54:52 | 2017-09-11T00:54:52 | 72,508,354 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 7,521 | java | /*
* Copyright (c) 2000 David Flanagan. All rights reserved.
* This code is from the book Java Examples in a Nutshell, 2nd Edition.
* It is provided AS-IS, WITHOUT ANY WARRANTY either expressed or implied.
* You may study, use, and modify it for any non-commercial purpose.
* You may distribute it non-commercially as long as you retain this notice.
* For a commercial use license, or to purchase the book (recommended),
* visit http://www.davidflanagan.com/javaexamples2.
*/
package com.davidflanagan.examples.graphics;
import java.awt.*;
import java.awt.geom.*;
import java.awt.font.*;
/** A demonstration of writing custom Stroke classes */
public class CustomStrokes implements GraphicsExample {
static final int WIDTH = 750, HEIGHT = 200; // Size of our example
public String getName() {return "Custom Strokes";} // From GraphicsExample
public int getWidth() { return WIDTH; } // From GraphicsExample
public int getHeight() { return HEIGHT; } // From GraphicsExample
// These are the various stroke objects we'll demonstrate
Stroke[] strokes = new Stroke[] {
new BasicStroke(4.0f), // The standard, predefined stroke
new NullStroke(), // A Stroke that does nothing
new DoubleStroke(8.0f, 2.0f), // A Stroke that strokes twice
new ControlPointsStroke(2.0f), // Shows the vertices & control points
new SloppyStroke(2.0f, 3.0f) // Perturbs the shape before stroking
};
/** Draw the example */
public void draw(Graphics2D g, Component c) {
// Get a shape to work with. Here we'll use the letter B
Font f = new Font("Serif", Font.BOLD, 200);
GlyphVector gv = f.createGlyphVector(g.getFontRenderContext(), "B");
Shape shape = gv.getOutline();
// Set drawing attributes and starting position
g.setColor(Color.black);
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.translate(10, 175);
// Draw the shape once with each stroke
for(int i = 0; i < strokes.length; i++) {
g.setStroke(strokes[i]); // set the stroke
g.draw(shape); // draw the shape
g.translate(140,0); // move to the right
}
}
}
/**
* This Stroke implementation does nothing. Its createStrokedShape()
* method returns an unmodified shape. Thus, drawing a shape with
* this Stroke is the same as filling that shape!
**/
class NullStroke implements Stroke {
public Shape createStrokedShape(Shape s) { return s; }
}
/**
* This Stroke implementation applies a BasicStroke to a shape twice.
* If you draw with this Stroke, then instead of outlining the shape,
* you're outlining the outline of the shape.
**/
class DoubleStroke implements Stroke {
BasicStroke stroke1, stroke2; // the two strokes to use
public DoubleStroke(float width1, float width2) {
stroke1 = new BasicStroke(width1); // Constructor arguments specify
stroke2 = new BasicStroke(width2); // the line widths for the strokes
}
public Shape createStrokedShape(Shape s) {
// Use the first stroke to create an outline of the shape
Shape outline = stroke1.createStrokedShape(s);
// Use the second stroke to create an outline of that outline.
// It is this outline of the outline that will be filled in
return stroke2.createStrokedShape(outline);
}
}
/**
* This Stroke implementation strokes the shape using a thin line, and
* also displays the end points and Bezier curve control points of all
* the line and curve segments that make up the shape. The radius
* argument to the constructor specifies the size of the control point
* markers. Note the use of PathIterator to break the shape down into
* its segments, and of GeneralPath to build up the stroked shape.
**/
class ControlPointsStroke implements Stroke {
float radius; // how big the control point markers should be
public ControlPointsStroke(float radius) { this.radius = radius; }
public Shape createStrokedShape(Shape shape) {
// Start off by stroking the shape with a thin line. Store the
// resulting shape in a GeneralPath object so we can add to it.
GeneralPath strokedShape =
new GeneralPath(new BasicStroke(1.0f).createStrokedShape(shape));
// Use a PathIterator object to iterate through each of the line and
// curve segments of the shape. For each one, mark the endpoint and
// control points (if any) by adding a rectangle to the GeneralPath
float[] coords = new float[6];
for(PathIterator i=shape.getPathIterator(null); !i.isDone();i.next()) {
int type = i.currentSegment(coords);
Shape s = null, s2 = null, s3 = null;
switch(type) {
case PathIterator.SEG_CUBICTO:
markPoint(strokedShape, coords[4], coords[5]); // falls through
case PathIterator.SEG_QUADTO:
markPoint(strokedShape, coords[2], coords[3]); // falls through
case PathIterator.SEG_MOVETO:
case PathIterator.SEG_LINETO:
markPoint(strokedShape, coords[0], coords[1]); // falls through
case PathIterator.SEG_CLOSE:
break;
}
}
return strokedShape;
}
/** Add a small square centered at (x,y) to the specified path */
void markPoint(GeneralPath path, float x, float y) {
path.moveTo(x-radius, y-radius); // Begin a new sub-path
path.lineTo(x+radius, y-radius); // Add a line segment to it
path.lineTo(x+radius, y+radius); // Add a second line segment
path.lineTo(x-radius, y+radius); // And a third
path.closePath(); // Go back to last moveTo position
}
}
/**
* This Stroke implementation randomly perturbs the line and curve segments
* that make up a Shape, and then strokes that perturbed shape. It uses
* PathIterator to loop through the Shape and GeneralPath to build up the
* modified shape. Finally, it uses a BasicStroke to stroke the modified
* shape. The result is a "sloppy" looking shape.
**/
class SloppyStroke implements Stroke {
BasicStroke stroke;
float sloppiness;
public SloppyStroke(float width, float sloppiness) {
this.stroke = new BasicStroke(width); // Used to stroke modified shape
this.sloppiness = sloppiness; // How sloppy should we be?
}
public Shape createStrokedShape(Shape shape) {
GeneralPath newshape = new GeneralPath(); // Start with an empty shape
// Iterate through the specified shape, perturb its coordinates, and
// use them to build up the new shape.
float[] coords = new float[6];
for(PathIterator i=shape.getPathIterator(null); !i.isDone();i.next()) {
int type = i.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
perturb(coords, 2);
newshape.moveTo(coords[0], coords[1]);
break;
case PathIterator.SEG_LINETO:
perturb(coords, 2);
newshape.lineTo(coords[0], coords[1]);
break;
case PathIterator.SEG_QUADTO:
perturb(coords, 4);
newshape.quadTo(coords[0], coords[1], coords[2], coords[3]);
break;
case PathIterator.SEG_CUBICTO:
perturb(coords, 6);
newshape.curveTo(coords[0], coords[1], coords[2], coords[3],
coords[4], coords[5]);
break;
case PathIterator.SEG_CLOSE:
newshape.closePath();
break;
}
}
// Finally, stroke the perturbed shape and return the result
return stroke.createStrokedShape(newshape);
}
// Randomly modify the specified number of coordinates, by an amount
// specified by the sloppiness field.
void perturb(float[] coords, int numCoords) {
for(int i = 0; i < numCoords; i++)
coords[i] += (float)((Math.random()*2-1.0)*sloppiness);
}
}
| [
"shashanksingh28@gmail.com"
] | shashanksingh28@gmail.com |
59f7d7c55960b6f3016d0a369da4cd83d8972e83 | 6392035b0421990479baf09a3bc4ca6bcc431e6e | /projects/hazelcast-e84e96ff/prev/hazelcast/src/main/java/com/hazelcast/client/impl/protocol/codec/DistributedObjectInfoCodec.java | e3b348509701391273d574bc46f8d74f25d5056a | [] | no_license | ameyaKetkar/RMinerEvaluationTools | 4975130072bf1d4940f9aeb6583eba07d5fedd0a | 6102a69d1b78ae44c59d71168fc7569ac1ccb768 | refs/heads/master | 2020-09-26T00:18:38.389310 | 2020-05-28T17:34:39 | 2020-05-28T17:34:39 | 226,119,387 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,647 | java | /*
* Copyright (c) 2008-2015, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.client.impl.protocol.codec;
import com.hazelcast.client.impl.client.DistributedObjectInfo;
import com.hazelcast.client.impl.protocol.ClientMessage;
import com.hazelcast.client.impl.protocol.util.ParameterUtil;
public final class DistributedObjectInfoCodec {
private DistributedObjectInfoCodec() {
}
public static DistributedObjectInfo decode(ClientMessage clientMessage) {
String serviceName = clientMessage.getStringUtf8();
String name = clientMessage.getStringUtf8();
return new DistributedObjectInfo(serviceName, name);
}
public static void encode(DistributedObjectInfo info, ClientMessage clientMessage) {
clientMessage.
set(info.getServiceName()).
set(info.getName());
}
public static int calculateDataSize(DistributedObjectInfo info) {
return ParameterUtil.calculateStringDataSize(info.getServiceName())
+ ParameterUtil.calculateStringDataSize(info.getName());
}
}
| [
"ask1604@gmail.com"
] | ask1604@gmail.com |
d776c712aa8b8d37cd06730417eb92861b8a277f | 9fb272ddf7a16ff9ba3a23f6d9891b524986927f | /CartMS/src/main/java/com/ms/caseStudy/CartMS/bean/CartBean.java | 714451ca3d393d714391780d27681737a2677e04 | [] | no_license | prashanta1984/casestudy | 4789fe89e357fe9992d7779b78d9dd69fec96c1a | f71add3c32d2cd9b0f30bc86aac3ea30862a850b | refs/heads/master | 2022-12-17T03:57:38.141248 | 2020-09-28T16:52:12 | 2020-09-28T16:52:12 | 293,550,766 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.ms.caseStudy.CartMS.bean;
import java.util.List;
public class CartBean {
private String userName ;
private List<Product> products ;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public List<Product> getProducts() {
return products;
}
public void setProducts(List<Product> products) {
this.products = products;
}
}
| [
"prasjena@in.ibm.com"
] | prasjena@in.ibm.com |
6cafa9d85a5141d45bceda151bf901c49efd3b58 | d54edbdc0766ffb119ce169e8798643e9af54781 | /src/main/java/us/vicentini/services/ProductService.java | 8430d3fa611110dc8d12dedbfca0781e94f509f5 | [] | no_license | Shulander/spring-boot-actuator | 17c6aef57b95167cb7056d36da092fe401e9e33e | d787cc1085e9917bb8960a1ef8509d0363952905 | refs/heads/master | 2021-05-17T16:45:54.383617 | 2020-04-07T03:37:09 | 2020-04-07T03:37:09 | 250,879,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package us.vicentini.services;
import us.vicentini.domain.Product;
import java.util.List;
public interface ProductService {
Product getProduct(Integer id);
List<Product> listProducts();
}
| [
"henrique@vicentini.us"
] | henrique@vicentini.us |
d764384f499c5c99d73fdace0afed958c54f0883 | 60c8527e867c3ca4f00e20f99896865722e97886 | /src/main/java/com/answerlyl/myfinance/mapper/NoticeMapper.java | dc839bfa2ea7bb56682eae37790cbfdef464d1a3 | [] | no_license | answerlyl/myfinanceservice | 84a89374863675c9f25ef65c595114e6310fbd90 | b5b2f3c754eaa55120e703805d25996fd830b1bc | refs/heads/master | 2022-07-03T05:03:52.292513 | 2020-03-22T14:14:18 | 2020-03-22T14:17:06 | 249,198,716 | 1 | 0 | null | 2020-07-02T02:39:08 | 2020-03-22T14:18:04 | Java | UTF-8 | Java | false | false | 292 | java | package com.answerlyl.myfinance.mapper;
import com.answerlyl.myfinance.entity.Notice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author answerlyl
* @since 2020-02-12
*/
public interface NoticeMapper extends BaseMapper<Notice> {
}
| [
"answerlyl@163.com"
] | answerlyl@163.com |
71b47822dfa6ad01d199d4e0b0ad720e0f9d5a33 | 52309deb5c9d34dc9b93c47f8ef7af73a7960edb | /access-id-server/src/main/java/com/csuf/cs/accessid/accessidserver/controller/AWSController.java | c8e0e5c3ddd18de66fa1e6300e261c14286ac51d | [] | no_license | raninagare/Corporate-accees-card-activation-app | b0e4f7ef1e1290172a386a807662e7c9fc7ed1a2 | b338f78aabb7a5ccfca67efcf7fdb3df2c43c119 | refs/heads/master | 2022-10-03T04:20:49.340967 | 2020-01-03T20:13:40 | 2020-01-03T20:13:40 | 222,299,704 | 0 | 1 | null | 2022-09-08T01:03:58 | 2019-11-17T19:22:47 | TypeScript | UTF-8 | Java | false | false | 10,144 | java | package com.csuf.cs.accessid.accessidserver.controller;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSStaticCredentialsProvider;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.rekognition.AmazonRekognition;
import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder;
import com.amazonaws.services.rekognition.model.*;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;
import com.amazonaws.services.s3.model.ObjectMetadata;
import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.S3Object;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
@RestController
@RequestMapping("/api/facerecognition")
@CrossOrigin("*")
public class AWSController {
private static String bucketName = "facerecograni1";
// Upload user image while registration
@RequestMapping(value = "/upload", method = RequestMethod.POST, consumes = MediaType.ALL_VALUE)
public String uploadFile(@RequestParam("userName") String userName,
@RequestParam("file") MultipartFile file) throws IOException {
String status= uploadFiletos3( file );
createCollection(userName+"Collection");
//Add file to collection for indexing
addToCollection(file.getOriginalFilename(),userName+"Collection");
return status;
}
/**
* This method will allow userto login by face id, first it will store the captured image to s3 and then compare that image with existing collection
* @param userName
* @param file
* @return
*/
@RequestMapping(value = "/loginwithface", method = RequestMethod.POST, consumes = MediaType.ALL_VALUE)
public boolean validateUserByFace(@RequestParam("userName") String userName,
@RequestParam("file") MultipartFile file){
try {
String status= uploadFiletos3( file );
} catch (IOException e) {
e.printStackTrace();
}
AmazonRekognition rekognitionClient = getAmazonRekognition();
// Get an image object from S3 bucket.
Image image=new Image()
.withS3Object(new com.amazonaws.services.rekognition.model.S3Object()
.withBucket(bucketName)
.withName(file.getOriginalFilename()));
// Search collection for faces similar to the largest face in the image.
SearchFacesByImageRequest searchFacesByImageRequest = new SearchFacesByImageRequest()
.withCollectionId(userName+"Collection")
.withImage(image)
.withFaceMatchThreshold(70F)
.withMaxFaces(2);
SearchFacesByImageResult searchFacesByImageResult =
rekognitionClient.searchFacesByImage(searchFacesByImageRequest);
System.out.println("Faces matching largest face in image from" + file.getOriginalFilename());
List<FaceMatch> faceImageMatches = searchFacesByImageResult.getFaceMatches();
for (FaceMatch face: faceImageMatches) {
if(face.getSimilarity()>90){
System.out.println( "User is Authenticated :" );
return true;
}
}
return false;
}
/**
* Connect to S3 bucket and add file to s3
* @param file
* @return
* @throws IOException
*/
private String uploadFiletos3( MultipartFile file) throws IOException {
InputStream is = file.getInputStream();
String keyName = file.getOriginalFilename();
String result="";
AWSCredentials credentials;
try {
credentials = new ProfileCredentialsProvider().getCredentials();
} catch (Exception e) {
throw new AmazonClientException("Cannot load the credentials from the credential profiles file. "
+ "Please make sure that your credentials file is at the correct "
+ "location (/Users/userid/.aws/credentials), and is in valid format.", e);
}
AmazonS3 s3client = AmazonS3ClientBuilder
.standard()
.withCredentials(new AWSStaticCredentialsProvider(credentials))
.withRegion( Regions.US_WEST_1)
.build();
try {
System.out.println("Uploading a new object to S3 from a file\n");
S3Object s3Object = new S3Object();
ObjectMetadata omd = new ObjectMetadata();
omd.setContentType(file.getContentType());
omd.setContentLength(file.getSize());
omd.setHeader("filename", file.getName());
s3Object.setObjectContent(is);
s3client.putObject(new PutObjectRequest(bucketName, keyName, is, omd));
s3Object.close();
//URL url = s3client.generatePresignedUrl(bucketName, keyName, Date.from( Instant.now().plus(5, ChronoUnit.MINUTES)));
result= "File Uploaded SuccessFully";
} catch (AmazonServiceException ase) {
System.out.println("Caught an AmazonServiceException, which " +
"means your request made it " +
"to Amazon S3, but was rejected with an error response" +
" for some reason.");
System.out.println("Error Message: " + ase.getMessage());
System.out.println("HTTP Status Code: " + ase.getStatusCode());
System.out.println("AWS Error Code: " + ase.getErrorCode());
System.out.println("Error Type: " + ase.getErrorType());
System.out.println("Request ID: " + ase.getRequestId());
} catch (AmazonClientException ace) {
System.out.println("Caught an AmazonClientException, which " +
"means the client encountered " +
"an internal error while trying to " +
"communicate with S3, " +
"such as not being able to access the network.");
System.out.println("Error Message: " + ace.getMessage());
result=ace.getMessage();
}
return result;
}
/**
* Add File to collection for indexing and easy searaching
* @param imageName
*/
public void addToCollection( String imageName,String collectionName){
AmazonRekognition rekognitionClient = getAmazonRekognition();
Image image = new Image()
.withS3Object(new com.amazonaws.services.rekognition.model.S3Object()
.withBucket(bucketName)
.withName(imageName));
IndexFacesRequest indexFacesRequest = new IndexFacesRequest()
.withImage(image)
.withQualityFilter( QualityFilter.AUTO)
.withMaxFaces(1)
.withCollectionId(collectionName)
.withExternalImageId(imageName)
.withDetectionAttributes("DEFAULT");
IndexFacesResult indexFacesResult = rekognitionClient.indexFaces(indexFacesRequest);
System.out.println("Results for " + imageName);
System.out.println("Faces indexed:");
List<FaceRecord> faceRecords = indexFacesResult.getFaceRecords();
for (FaceRecord faceRecord : faceRecords) {
System.out.println(" Face ID: " + faceRecord.getFace().getFaceId());
System.out.println(" Location:" + faceRecord.getFaceDetail().getBoundingBox().toString());
}
}
/**
* Login to s3 bucket
* @return
*/
private AmazonRekognition getAmazonRekognition() {
AWSCredentials credentials;
try {
credentials = new ProfileCredentialsProvider().getCredentials();
} catch (Exception e) {
throw new AmazonClientException( "Cannot load the credentials from the credential profiles file. "
+ "Please make sure that your credentials file is at the correct "
+ "location (/Users/userid/.aws/credentials), and is in valid format.", e );
}
return AmazonRekognitionClientBuilder
.standard()
.withRegion( Regions.US_WEST_1 )
.withCredentials( new AWSStaticCredentialsProvider( credentials ) )
.build();
}
public void createCollection(String collectionId){
AmazonRekognition rekognitionClient = getAmazonRekognition();
System.out.println("Creating collection: " +
collectionId );
CreateCollectionRequest request = new CreateCollectionRequest()
.withCollectionId(collectionId);
CreateCollectionResult createCollectionResult = rekognitionClient.createCollection(request);
System.out.println("CollectionArn : " +
createCollectionResult.getCollectionArn());
System.out.println("Status code : " +
createCollectionResult.getStatusCode().toString());
}
}
| [
"raninagare29@gmail.com"
] | raninagare29@gmail.com |
34b0147b0e0569a8ee56a97c1ffde6172def432b | a5fabb5e810680d58a1e667d38180973924e4c52 | /app/src/main/java/com/coolweather/android/gson/Forecast.java | 1013020fa50f3c0110e72e322481da170ebc2db4 | [] | no_license | dontwant/coolweather | 7eab994e3bbf942aff3525b5ef6336ebfb334828 | bd6391edfc26177170edeca12fd3b2a0e6d02b98 | refs/heads/master | 2020-04-23T01:46:08.052939 | 2019-02-21T07:22:36 | 2019-02-21T07:22:36 | 170,823,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 490 | java | package com.coolweather.android.gson;
import com.google.gson.annotations.SerializedName;
/**
* Created by LI Xiao Kun on 2019/2/19.
*/
public class Forecast {
public String date;
@SerializedName("tmp")
public Temperature temperature;
@SerializedName("cond")
public More more;
public class Temperature{
public String max;
public String min;
}
public class More{
@SerializedName("txt_d")
public String info;
}
}
| [
"916313603@qq.com"
] | 916313603@qq.com |
897cda51aea933f20debd7ad8b8e1c388f36f6c4 | df48dc6e07cdf202518b41924444635f30d60893 | /jinx-com4j/src/main/java/com/exceljava/com4j/excel/IXPath.java | 7604a56b0901a867fd82dc93e9e0ce4a62e48d4a | [
"MIT"
] | permissive | ashwanikaggarwal/jinx-com4j | efc38cc2dc576eec214dc847cd97d52234ec96b3 | 41a3eaf71c073f1282c2ab57a1c91986ed92e140 | refs/heads/master | 2022-03-29T12:04:48.926303 | 2020-01-10T14:11:17 | 2020-01-10T14:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,235 | java | package com.exceljava.com4j.excel ;
import com4j.*;
@IID("{0002447E-0001-0000-C000-000000000046}")
public interface IXPath extends Com4jObject {
// Methods:
/**
* <p>
* Getter method for the COM property "Application"
* </p>
* @return Returns a value of type com.exceljava.com4j.excel._Application
*/
@VTID(7)
com.exceljava.com4j.excel._Application getApplication();
/**
* <p>
* Getter method for the COM property "Creator"
* </p>
* @return Returns a value of type com.exceljava.com4j.excel.XlCreator
*/
@VTID(8)
com.exceljava.com4j.excel.XlCreator getCreator();
/**
* <p>
* Getter method for the COM property "Parent"
* </p>
* @return Returns a value of type com4j.Com4jObject
*/
@VTID(9)
@ReturnValue(type=NativeType.Dispatch)
com4j.Com4jObject getParent();
/**
* <p>
* Getter method for the COM property "_Default"
* </p>
* @return Returns a value of type java.lang.String
*/
@VTID(10)
@DefaultMethod
java.lang.String get_Default();
/**
* <p>
* Getter method for the COM property "Value"
* </p>
* @return Returns a value of type java.lang.String
*/
@VTID(11)
java.lang.String getValue();
/**
* <p>
* Getter method for the COM property "Map"
* </p>
* @return Returns a value of type com.exceljava.com4j.excel.XmlMap
*/
@VTID(12)
com.exceljava.com4j.excel.XmlMap getMap();
/**
* <p>
* This method uses predefined default values for the following parameters:
* </p>
* <ul>
* <li>java.lang.Object parameter selectionNamespace is set to com4j.Variant.getMissing()</li><li>java.lang.Object parameter repeating is set to com4j.Variant.getMissing()</li></ul>
* <p>
* Therefore, using this method is equivalent to
* <code>
* setValue(map, xPath, com4j.Variant.getMissing(), com4j.Variant.getMissing());
* </code>
* </p>
* @param map Mandatory com.exceljava.com4j.excel.XmlMap parameter.
* @param xPath Mandatory java.lang.String parameter.
*/
@VTID(13)
@UseDefaultValues(paramIndexMapping = {0, 1}, optParamIndex = {2, 3}, javaType = {java.lang.Object.class, java.lang.Object.class}, nativeType = {NativeType.VARIANT, NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR, Variant.Type.VT_ERROR}, literal = {"80020004", "80020004"})
void setValue(
com.exceljava.com4j.excel.XmlMap map,
java.lang.String xPath);
/**
* <p>
* This method uses predefined default values for the following parameters:
* </p>
* <ul>
* <li>java.lang.Object parameter repeating is set to com4j.Variant.getMissing()</li></ul>
* <p>
* Therefore, using this method is equivalent to
* <code>
* setValue(map, xPath, selectionNamespace, com4j.Variant.getMissing());
* </code>
* </p>
* @param map Mandatory com.exceljava.com4j.excel.XmlMap parameter.
* @param xPath Mandatory java.lang.String parameter.
* @param selectionNamespace Optional parameter. Default value is com4j.Variant.getMissing()
*/
@VTID(13)
@UseDefaultValues(paramIndexMapping = {0, 1, 2}, optParamIndex = {3}, javaType = {java.lang.Object.class}, nativeType = {NativeType.VARIANT}, variantType = {Variant.Type.VT_ERROR}, literal = {"80020004"})
void setValue(
com.exceljava.com4j.excel.XmlMap map,
java.lang.String xPath,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object selectionNamespace);
/**
* @param map Mandatory com.exceljava.com4j.excel.XmlMap parameter.
* @param xPath Mandatory java.lang.String parameter.
* @param selectionNamespace Optional parameter. Default value is com4j.Variant.getMissing()
* @param repeating Optional parameter. Default value is com4j.Variant.getMissing()
*/
@VTID(13)
void setValue(
com.exceljava.com4j.excel.XmlMap map,
java.lang.String xPath,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object selectionNamespace,
@Optional @MarshalAs(NativeType.VARIANT) java.lang.Object repeating);
/**
*/
@VTID(14)
void clear();
/**
* <p>
* Getter method for the COM property "Repeating"
* </p>
* @return Returns a value of type boolean
*/
@VTID(15)
boolean getRepeating();
// Properties:
}
| [
"tony@pyxll.com"
] | tony@pyxll.com |
a940a5db5fa83eeb9328e37d9b01db3663246bfc | 00a24f0c7986187140f5e115f73245d788284d09 | /20211116/src/WrapperExample/IntegerWrapperEx.java | 8c04bb41fcb1e375e4f7f595e02ba52025e24d02 | [] | no_license | 01066564910/java- | bc52590a0fb4acb8e5492590d6879e41ca9a5480 | c0181074a1901cd0fd3c4130c29fc3beb2b92119 | refs/heads/main | 2023-09-06T01:13:49.955011 | 2021-11-16T08:51:18 | 2021-11-16T08:51:18 | 424,139,836 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 670 | java | package WrapperExample;
public class IntegerWrapperEx {
public static void main(String[] args) {
int i = 10;
String s = "10";
Integer i1 = 10; // int 랑 같다
i1 = Integer.parseInt(s); // 문자열을 숫자로 저장
byte by = 10;
byte by1 = 10;
short sh = 10; // 일반자료형
short sh1 = 10; // 렙퍼자료형
double d = 10.5;
Double d1 = 10.5;
float f = 10.5f;
float f1 = 10.6f;
//f = null; // null : 값은 존재하되 어떠한 값인지 모르는 것
// f1 = null; // 문자열을 숫자로 변화하기도 하지만 null값을 저장하기 위해서 사용도한다.
}
}
| [
"user@DESKTOP-4NMVE1B"
] | user@DESKTOP-4NMVE1B |
4f4efe33f01fcb7cfaa89f59ef36a127e1580428 | 7dece986667a167def13934088d50fc0363b411e | /src/main/java/jdk/java8/stream/TestDefaultInterface.java | b4986cb43fc1b2c715c2061b472fee8227d746c8 | [] | no_license | dongfangding/JavaDemo | 9c425b22224dee0c0a7fa44a721950893135bb9f | 6a1a7d38fbd67b952fed7190f5fc8aca859241f7 | refs/heads/master | 2022-12-06T07:01:19.913940 | 2021-04-25T08:43:09 | 2021-04-25T08:43:09 | 193,824,392 | 1 | 0 | null | 2022-11-15T23:47:30 | 2019-06-26T03:39:56 | Java | UTF-8 | Java | false | false | 227 | java | package jdk.java8.stream;
public class TestDefaultInterface {
public static void main(String[] args) {
SubClass sc = new SubClass();
System.out.println(sc.getName());
MyInterface.show();
}
}
| [
"1041765757@qq.com"
] | 1041765757@qq.com |
4fe024754a864d37d576c8810055ba1ec5103e2e | 33c083009e84d92ec5f6f154ac4ec27ecc0435a3 | /core/src/com/adea/evogame/seed/builder/SeedFactory.java | 88b5c0ede9204c3da16b16cc241802eddcbb76b9 | [] | no_license | tohasplay/TreeEvolution | 9eeae067a36e9567febebb2d4c8bb548eec34996 | 219b68792e40c3fd07b6adb6243de67716e11d6b | refs/heads/master | 2022-12-29T14:52:25.974236 | 2020-10-16T11:12:45 | 2020-10-16T11:12:45 | 304,349,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,926 | java | package com.adea.evogame.seed.builder;
import com.adea.evogame.gene.Gene;
import com.adea.evogame.gene.GeneCommand;
import com.adea.evogame.gene.GeneFactory;
import com.adea.evogame.seed.Seed;
import com.adea.evogame.seed.states.ActiveSeed;
import com.adea.evogame.tree.Tree;
import lombok.AllArgsConstructor;
import java.util.ArrayList;
import java.util.List;
@AllArgsConstructor
public class SeedFactory {
private static final int INIT_ENERGY = 300;
private final List<Seed> producedSeeds = new ArrayList<>();
private final SeedBuilder builder;
public SeedFactory construct(Seed context) {
Gene gene = context.getGenes().get(
context.getGene()
);
for (GeneCommand command :
gene.getGenes().keySet()) {
if (gene.getGenes().get(command) < GeneFactory.GENOTYPE && (context.getLocation().getY() + command.getY()) >= 0) {
Tree parent = (Tree) context.getParent();
if (!parent.getWorld().haveNeighbour(command, context.getLocation()))
producedSeeds.add(
builder
.buildEnergy(INIT_ENERGY)
.buildState(new ActiveSeed())
.buildGene(gene.getGenes().get(command))
.buildGenes(context.getGenes())
.buildLocation(
context.getLocation().getX() + command.getX(),
context.getLocation().getY() + command.getY(),
parent.getColor()
)
.getSeed()
);
}
}
return this;
}
public List<Seed> build() {
return producedSeeds;
}
}
| [
"tohasplay@gmail.com"
] | tohasplay@gmail.com |
63907828931a93bdfc58f3faaf6644865902a386 | 6c41d7eb9cc896645f94f5a7be45c5a6cf4da31b | /ocp/src/main/java/chapter9/exercise/Q12.java | 72918bdb3bf0af9ccb40df05b1fb4b1abc6ac29e | [] | no_license | chaialong/Java-OCP | 7866d0a872f602fd8eaa3b9b7f438beb9829bce7 | 56a1721fbc5bfd3a30ff4579a2e297eadfbb5ebc | refs/heads/master | 2020-04-12T09:33:47.152578 | 2017-03-02T14:49:52 | 2017-03-02T14:49:52 | 65,647,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 222 | java | package chapter9.exercise;
import java.nio.file.FileSystem;
import java.nio.file.Path;
public class Q12 {
public static void main(String[] args) {
// Path path1 = new FileSystem().getPath("C:\\temp");
}
}
| [
"chaialong@gmail.com"
] | chaialong@gmail.com |
96b912dd9d906f746d0ffe63bca7d715668fe7ff | 07b5423f606ecbf698df997a9ed68ca2bccb34c0 | /src/main/java/com/example/server/dao/RockBookdetailMapper.java | e5354e495f488ae79ba523e2165b1a7445133ceb | [] | no_license | Ricardo1601/sts | 8f10d4d0f0db97d145e0fc8e0b4222cefc1d1fc7 | 9a844be3859b40ce5b95583ccdcbe47311d1c266 | refs/heads/master | 2020-03-31T12:16:34.102201 | 2018-10-10T09:18:57 | 2018-10-10T09:18:57 | 152,209,702 | 0 | 1 | null | 2018-10-10T01:20:36 | 2018-10-09T07:46:54 | Java | UTF-8 | Java | false | false | 1,597 | java | package com.example.server.dao;
import com.example.server.core.universal.Mapper;
import com.example.server.model.RockBookdetail;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface RockBookdetailMapper extends Mapper<RockBookdetail> {
RockBookdetail selectByEmpIdAndDate(@Param("empid") String empid,@Param("date") String date);
List<Map<String,Object>> selectByEmpIdAndDateMonth(@Param("empid") String empid, @Param("date") String date);
List<Map<String,Object>> selectByEmpIdAndDateMonthBai(@Param("empid") String empid, @Param("date") String date);
List<Map<String,Object>> selectByEmpIdAndDateMonthYe(@Param("empid") String empid, @Param("date") String date);
List<Map<String,Object>> selectByEmpIdAndDateWeek(@Param("empid") String empid, @Param("startdate") String startdate,@Param("enddate") String enddate);
List<RockBookdetail> selectByEmpIdAndDateMonthDetail(@Param("empid") String empid, @Param("date") String date);
List<RockBookdetail> selectByDeptIdAndAreaAndDateDay(@Param("deptid")String deptid,@Param("area")String area, @Param("date") String date);
List<RockBookdetail> selectByDeptIdAndAreaAndDateAndShiftflagDay(@Param("deptid")String deptid,@Param("area")String area,@Param("shiftFlag")String shiftFlag, @Param("date") String date);
List<RockBookdetail> selectFutureByEmpId(@Param("empid")String empid);
List<RockBookdetail> selectByEmpIdAndFirstAndLast(@Param("empid") String empid, @Param("firstDate") String firstDate,@Param("lastDate") String lastDate);
} | [
"50109479c@VDICIM50109479C.b5.boe.com.cn"
] | 50109479c@VDICIM50109479C.b5.boe.com.cn |
2d9d7172a969862e2db25db78698b94662fbbe75 | b78849601458946daa9be2569f6f1e01e60e3795 | /src/com/HomeCenter2/ui/slidingmenu/framework/RADSlidingPaneLayout.java | ad5b76f1ec1218f926a46f26610513e2bd57beac | [] | no_license | CongBaDo/HomeCenter | 9f699520885fb9bb4fef493d649c488f7e9bf6e7 | 9be4b4880b541e6b808df14cdad6fad0c80a2f28 | refs/heads/master | 2021-01-10T18:29:51.941672 | 2015-10-13T04:46:40 | 2015-10-13T04:46:40 | 38,027,997 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 604 | java | package com.HomeCenter2.ui.slidingmenu.framework;
import android.content.Context;
import android.support.v4.widget.SlidingPaneLayout;
import android.util.AttributeSet;
import android.view.MotionEvent;
public class RADSlidingPaneLayout extends SlidingPaneLayout{
public RADSlidingPaneLayout(Context context, AttributeSet attrs){
super(context, attrs);
}
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
if (!this.isOpen() && event.getX() > (getWidth() / 5)) {
return false;
}
return super.onInterceptTouchEvent(event);
}
}
| [
"ba_do@knorex.com"
] | ba_do@knorex.com |
6da3f06fd80b65edcf4cef52ebf4810c2de5cdff | 813e0e4ec6bdc2211dc3aee6529da53b8b0acdfc | /tests/src/test/java/examples/Role.java | d17b316ae787e95ac423adbd819b9089cb78a9dd | [
"Apache-2.0"
] | permissive | lospejos/jooby | c4ce56278f6b83fcdd771cce6a19415ccce1ef54 | 421de0e04f1f5f0d9c6b963d094fc3deb3dfb6fb | refs/heads/2.x | 2023-02-07T08:13:24.480023 | 2020-12-28T09:50:40 | 2020-12-28T09:50:40 | 322,334,984 | 0 | 0 | Apache-2.0 | 2020-12-28T09:50:42 | 2020-12-17T15:25:39 | Java | UTF-8 | Java | false | false | 323 | java | package examples;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Role {
String value();
String level() default "one";
}
| [
"jeff.lefoll@outlook.fr"
] | jeff.lefoll@outlook.fr |
5e8bc90635c505e10014b92baa7fa14bb06ac747 | 57b46c0fd683174ace303523d87c64b07285c47b | /src/main/java/org/jeecgframework/core/util/HttpRequestor.java | 827947ac165d646b047c24b5305f82e589d06fbd | [] | no_license | ha543624703/jxjtzywx | 6588a1a699219b88683fe52a0dd9f44613b2342b | b44b0ab3fd2616baddd9d212b0f5c8b348c74dd3 | refs/heads/master | 2021-07-02T11:11:52.605207 | 2017-09-22T02:19:34 | 2017-09-22T02:19:34 | 104,421,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,969 | java | package org.jeecgframework.core.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.params.HttpMethodParams;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
public class HttpRequestor
{
private String charset = "utf-8";
private Integer connectTimeout = null;
private Integer socketTimeout = null;
private String proxyHost = null;
private Integer proxyPort = null;
public String doGet(String url) throws Exception
{
URL localURL = new URL(url);
URLConnection connection = openConnection(localURL);
HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
httpURLConnection.setRequestMethod("GET");
httpURLConnection.addRequestProperty("Content-Type", "application/json;charset=utf-8");
httpURLConnection.connect();
httpURLConnection.setConnectTimeout(30000);
InputStream inputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader reader = null;
StringBuffer resultBuffer = new StringBuffer();
String tempLine;
if (httpURLConnection.getResponseCode() >= 300)
{
throw new Exception("HTTP Request is not success, Response code is " + httpURLConnection.getResponseCode());
}
try
{
inputStream = httpURLConnection.getInputStream();
inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
reader = new BufferedReader(inputStreamReader);
while ((tempLine = reader.readLine()) != null)
{
resultBuffer.append(tempLine);
}
}
finally
{
if (reader != null)
{
reader.close();
}
if (inputStreamReader != null)
{
inputStreamReader.close();
}
if (inputStream != null)
{
inputStream.close();
}
}
return resultBuffer.toString();
}
public String doGetSet(String url) throws Exception
{
URL localURL = new URL(url);
// CookieHandler.setDefault(new CookieManager(null,
// CookiePolicy.ACCEPT_ALL));
URLConnection connection = openConnection(localURL);
HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
httpURLConnection.setRequestMethod("GET");
httpURLConnection.addRequestProperty("Content-Type", "application/json;charset=utf-8");
httpURLConnection.connect();
InputStream inputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader reader = null;
StringBuffer resultBuffer = new StringBuffer();
String tempLine = null;
if (httpURLConnection.getResponseCode() >= 300)
{
throw new Exception("HTTP Request is not success, Response code is " + httpURLConnection.getResponseCode());
}
try
{
inputStream = httpURLConnection.getInputStream();
inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
reader = new BufferedReader(inputStreamReader);
while ((tempLine = reader.readLine()) != null)
{
resultBuffer.append(tempLine);
}
}
finally
{
if (reader != null)
{
reader.close();
}
if (inputStreamReader != null)
{
inputStreamReader.close();
}
if (inputStream != null)
{
inputStream.close();
}
}
return resultBuffer.toString();
}
/**
* Do POST request
*
* @param url
* @param parameterMap
* @return
* @throws Exception
*/
public String doPost(String url, Map parameterMap) throws Exception
{
/* Translate parameter map to parameter date string */
StringBuffer parameterBuffer = new StringBuffer();
if (parameterMap != null)
{
Iterator iterator = parameterMap.keySet().iterator();
String key = null;
String value = null;
while (iterator.hasNext())
{
key = (String) iterator.next();
if (parameterMap.get(key) != null)
{
value = (String) parameterMap.get(key);
}
else
{
value = "";
}
parameterBuffer.append(key).append("=").append(value);
if (iterator.hasNext())
{
parameterBuffer.append("&");
}
}
}
System.out.println("POST parameter : " + parameterBuffer.toString());
URL localURL = new URL(url);
URLConnection connection = openConnection(localURL);
HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
httpURLConnection.setDoOutput(true);
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty("Accept-Charset", charset);
httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
httpURLConnection.setRequestProperty("Content-Length", String.valueOf(parameterBuffer.length()));
OutputStream outputStream = null;
OutputStreamWriter outputStreamWriter = null;
InputStream inputStream = null;
InputStreamReader inputStreamReader = null;
BufferedReader reader = null;
StringBuffer resultBuffer = new StringBuffer();
String tempLine = null;
try
{
outputStream = httpURLConnection.getOutputStream();
outputStreamWriter = new OutputStreamWriter(outputStream);
outputStreamWriter.write(parameterBuffer.toString());
outputStreamWriter.flush();
if (httpURLConnection.getResponseCode() >= 300)
{
throw new Exception("HTTP Request is not success, Response code is " + httpURLConnection.getResponseCode());
}
inputStream = httpURLConnection.getInputStream();
inputStreamReader = new InputStreamReader(inputStream);
reader = new BufferedReader(inputStreamReader);
while ((tempLine = reader.readLine()) != null)
{
resultBuffer.append(tempLine);
}
}
finally
{
if (outputStreamWriter != null)
{
outputStreamWriter.close();
}
if (outputStream != null)
{
outputStream.close();
}
if (reader != null)
{
reader.close();
}
if (inputStreamReader != null)
{
inputStreamReader.close();
}
if (inputStream != null)
{
inputStream.close();
}
}
return resultBuffer.toString();
}
private URLConnection openConnection(URL localURL) throws IOException
{
URLConnection connection;
if (proxyHost != null && proxyPort != null)
{
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));
connection = localURL.openConnection(proxy);
}
else
{
connection = localURL.openConnection();
}
return connection;
}
/**
* Render request according setting
*
* @param request
*/
private void renderRequest(URLConnection connection)
{
if (connectTimeout != null)
{
connection.setConnectTimeout(connectTimeout);
}
if (socketTimeout != null)
{
connection.setReadTimeout(socketTimeout);
}
}
/**
* @description:调用webservice接口
* @param url
* @param header
* @param map
* @return
* @author:duzl
* @createTime:2017年5月22日 下午2:03:05
*/
public Document webService(String url, String header, Map<String, String> map)
{
InputStream is = null;
HttpClient client = new HttpClient();
PostMethod method = new PostMethod(url);
client.getParams().setContentCharset("UTF-8");
client.getParams().setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "UTF-8");
method.setParameter(HttpMethodParams.HTTP_CONTENT_CHARSET, "utf-8");
method.setRequestHeader("Host", header);
method.addRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
if (map != null && !map.isEmpty())
{
for (Entry<String, String> entry : map.entrySet())
{
method.setParameter(entry.getKey(), entry.getValue());
}
}
try
{
client.executeMethod(method);
is = method.getResponseBodyAsStream();
Document document = Jsoup.parse(is, "utf-8", "");
return document;
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
method.releaseConnection();
try
{
if (is != null)
{
is.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
return null;
}
/*
* Getter & Setter
*/
public Integer getConnectTimeout()
{
return connectTimeout;
}
public void setConnectTimeout(Integer connectTimeout)
{
this.connectTimeout = connectTimeout;
}
public Integer getSocketTimeout()
{
return socketTimeout;
}
public void setSocketTimeout(Integer socketTimeout)
{
this.socketTimeout = socketTimeout;
}
public String getProxyHost()
{
return proxyHost;
}
public void setProxyHost(String proxyHost)
{
this.proxyHost = proxyHost;
}
public Integer getProxyPort()
{
return proxyPort;
}
public void setProxyPort(Integer proxyPort)
{
this.proxyPort = proxyPort;
}
public String getCharset()
{
return charset;
}
public void setCharset(String charset)
{
this.charset = charset;
}
}
| [
"543624703@qq.com"
] | 543624703@qq.com |
b737286f9b508c3c2610fa9f435b063e29df30a1 | cf729a7079373dc301d83d6b15e2451c1f105a77 | /adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201509/cm/BiddingErrors.java | 32ea40cb95ce7f16dd2f39a930ec8821097b2f73 | [] | no_license | cvsogor/Google-AdWords | 044a5627835b92c6535f807ea1eba60c398e5c38 | fe7bfa2ff3104c77757a13b93c1a22f46e98337a | refs/heads/master | 2023-03-23T05:49:33.827251 | 2021-03-17T14:35:13 | 2021-03-17T14:35:13 | 348,719,387 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,665 | java |
package com.google.api.ads.adwords.jaxws.v201509.cm;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
*
* Represents error codes for bidding strategy entities.
*
*
* <p>Java class for BiddingErrors complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="BiddingErrors">
* <complexContent>
* <extension base="{https://adwords.google.com/api/adwords/cm/v201509}ApiError">
* <sequence>
* <element name="reason" type="{https://adwords.google.com/api/adwords/cm/v201509}BiddingErrors.Reason" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "BiddingErrors", propOrder = {
"reason"
})
public class BiddingErrors
extends ApiError
{
@XmlSchemaType(name = "string")
protected BiddingErrorsReason reason;
/**
* Gets the value of the reason property.
*
* @return
* possible object is
* {@link BiddingErrorsReason }
*
*/
public BiddingErrorsReason getReason() {
return reason;
}
/**
* Sets the value of the reason property.
*
* @param value
* allowed object is
* {@link BiddingErrorsReason }
*
*/
public void setReason(BiddingErrorsReason value) {
this.reason = value;
}
}
| [
"vacuum13@gmail.com"
] | vacuum13@gmail.com |
83a775ee135598ec6757324c1919d568eaaab7f0 | 68170a7ca597158ce1cd3553c6d0f018a7e30562 | /src/it/csi/mddtools/rdbmdl/constraints/provider/IndexedColumnItemProvider.java | 8384b502321e37476696410d4d4670c871d8a251 | [] | no_license | csipiemonte/datagen | a70a5ef895c80bd504744531fb63ace131c05e79 | 6686188a61b6b6a9e97ff0f27be7bb217df8ab2f | refs/heads/master | 2020-08-29T11:57:45.033820 | 2019-08-23T16:01:17 | 2019-08-23T16:04:12 | 218,024,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,057 | java | /**
* <copyright>
* (C) Copyright 2011 CSI-PIEMONTE;
* Concesso in licenza a norma dell'EUPL, esclusivamente versione 1.1;
* Non e' possibile utilizzare l'opera salvo nel rispetto della Licenza.
* E' possibile ottenere una copia della Licenza al seguente indirizzo:
*
* http://www.eupl.it/opensource/eupl-1-1
*
* Salvo diversamente indicato dalla legge applicabile o concordato per
* iscritto, il software distribuito secondo i termini della Licenza e'
* distribuito "TAL QUALE", SENZA GARANZIE O CONDIZIONI DI ALCUN TIPO,
* esplicite o implicite.
* Si veda la Licenza per la lingua specifica che disciplina le autorizzazioni
* e le limitazioni secondo i termini della Licenza.
* </copyright>
*
* $Id$
*/
package it.csi.mddtools.rdbmdl.constraints.provider;
import it.csi.mddtools.rdbmdl.constraints.ConstraintsPackage;
import it.csi.mddtools.rdbmdl.constraints.IndexedColumn;
import it.csi.mddtools.rdbmdl.provider.NamedElementItemProvider;
import it.csi.mddtools.rdbmdl.provider.RdbmdlEditPlugin;
import java.util.Collection;
import java.util.List;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IEditingDomainItemProvider;
import org.eclipse.emf.edit.provider.IItemLabelProvider;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.IItemPropertySource;
import org.eclipse.emf.edit.provider.IStructuredItemContentProvider;
import org.eclipse.emf.edit.provider.ITreeItemContentProvider;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;
/**
* This is the item provider adapter for a {@link it.csi.mddtools.rdbmdl.constraints.IndexedColumn} object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public class IndexedColumnItemProvider
extends NamedElementItemProvider {
/**
* This constructs an instance from a factory and a notifier.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public IndexedColumnItemProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
}
/**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addAscendingPropertyDescriptor(object);
addRefColumnPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
/**
* This adds a property descriptor for the Ascending feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addAscendingPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_IndexedColumn_ascending_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_IndexedColumn_ascending_feature", "_UI_IndexedColumn_type"),
ConstraintsPackage.Literals.INDEXED_COLUMN__ASCENDING,
true,
false,
false,
ItemPropertyDescriptor.BOOLEAN_VALUE_IMAGE,
null,
null));
}
/**
* This adds a property descriptor for the Ref Column feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void addRefColumnPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_IndexedColumn_refColumn_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_IndexedColumn_refColumn_feature", "_UI_IndexedColumn_type"),
ConstraintsPackage.Literals.INDEXED_COLUMN__REF_COLUMN,
true,
false,
true,
null,
null,
null));
}
/**
* This returns IndexedColumn.gif.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object getImage(Object object) {
return overlayImage(object, getResourceLocator().getImage("full/obj16/IndexedColumn"));
}
/**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getText(Object object) {
String label = ((IndexedColumn)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_IndexedColumn_type") :
getString("_UI_IndexedColumn_type") + " " + label;
}
/**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(IndexedColumn.class)) {
case ConstraintsPackage.INDEXED_COLUMN__ASCENDING:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
return;
}
super.notifyChanged(notification);
}
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
/**
* Return the resource locator for this item provider's resources.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ResourceLocator getResourceLocator() {
return RdbmdlEditPlugin.INSTANCE;
}
}
| [
"mauro.antonaci@csi.it"
] | mauro.antonaci@csi.it |
b70e848fbbe0a5f812fd21bfb1e0f22783b14b1c | d2d802cf9b25d78fae08331c980f490bcbfa5ce4 | /src/main/java/com/misuosi/mshop/pojo/Distributor.java | b9438b2743d60d4a6dc07ff7f3be9272a2d36ed3 | [] | no_license | magicgis/mshop | 9be7ec4dee941817844b65865223b35362ffe28e | 3dfe9f19c346f670453f8dd59bb6da21df292766 | refs/heads/master | 2021-01-17T01:11:35.588209 | 2016-03-24T02:29:03 | 2016-03-24T02:29:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,805 | java | /*
* Copyright (c) 2015
* 广州米所思信息科技有限公司(Guangzhou Misuosi Information technology co., LTD)
* All rights reserved.
*/
package com.misuosi.mshop.pojo;
import java.util.List;
import java.util.Map;
/**
* Description : 分销商
* <p/>
* <br><br>Time : 2015/6/11 10:59
*
* @author LXC
* @version 1.0
* @since 1.0
*/
public class Distributor {
private Integer diacId; // 分销商ID
private Double discount; // 代理商品的折扣率
// 以商品ID为键,缓存分销商代理的商品
// 能找到表示有代理该商品,找不到表示没有代理该商品
private Map<Integer, Boolean> distributingGoodses;
private Distributor parentDistributor; // 父级分销商
private List<Distributor> childDistributors; // 子级分销商
public Integer getDiacId() {
return diacId;
}
public void setDiacId(Integer diacId) {
this.diacId = diacId;
}
public Double getDiscount() {
return discount;
}
public void setDiscount(Double discount) {
this.discount = discount;
}
public Map<Integer, Boolean> getDistributingGoodses() {
return distributingGoodses;
}
public void setDistributingGoodses(Map<Integer, Boolean> distributingGoodses) {
this.distributingGoodses = distributingGoodses;
}
public Distributor getParentDistributor() {
return parentDistributor;
}
public void setParentDistributor(Distributor parentDistributor) {
this.parentDistributor = parentDistributor;
}
public List<Distributor> getChildDistributors() {
return childDistributors;
}
public void setChildDistributors(List<Distributor> childDistributors) {
this.childDistributors = childDistributors;
}
}
| [
"jenny1994730@163.com"
] | jenny1994730@163.com |
83b059d873fde3f129bef43e5dc6923285c11946 | b9b0bc1b93bf1ff4b164a80f98bd8d3feea3798c | /chap08/src/sec03/exam02_noname_implement_class/RemoteControlExample.java | 87d7451f276b298b7b2a4e84f4c8cf3986072799 | [] | no_license | InKyu24/ThisIsJava_Study | 7008b585e2dbca0c6d64ed66c47a94b980fbb071 | 7a529ebb2c903cef4552fb15765288f8760fb49b | refs/heads/master | 2023-09-02T11:41:47.065369 | 2021-02-06T14:45:57 | 2021-02-06T14:45:57 | 334,876,212 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 318 | java | package sec03.exam02_noname_implement_class;
public class RemoteControlExample {
public static void main(String[] args) {
RemoteControl rc = new RemoteControl() {
public void turnOn() { /*실행문*/ }
public void turnOff() { /*실행문*/ }
public void setVolume(int volume) { /*실행문*/ }
};
}
}
| [
"484342@gmail.com"
] | 484342@gmail.com |
0d19d8af68e23655644e1f9b96d1ea3c7f77b6b2 | bde14ef8a18245b8bbe63d3b7ae3a72817d4f1d3 | /gn-blockchain-node/src/main/java/org/gn/blockchain/shell/jsonrpc/TransactionReceiptDTOExt.java | cdd0e877c2d4d19698b2f5bbfb56e4cd103a0abe | [] | no_license | galaxynetworkmain/galaxy_network_node | a9faa7b51787884a76914284a983e80659bc8691 | ed38effc2d11e601311710d84b9db23d81f750e0 | refs/heads/master | 2022-10-09T08:43:12.755701 | 2020-06-08T09:10:50 | 2020-06-08T09:10:50 | 229,666,585 | 0 | 1 | null | 2022-10-04T23:56:44 | 2019-12-23T03:04:14 | TSQL | UTF-8 | Java | false | false | 561 | java | package org.gn.blockchain.shell.jsonrpc;
import static org.gn.blockchain.shell.jsonrpc.TypeConverter.toJsonHex;
import org.gn.blockchain.core.Block;
import org.gn.blockchain.core.TransactionInfo;
public class TransactionReceiptDTOExt extends TransactionReceiptDTO {
public String returnData;
public String error;
public TransactionReceiptDTOExt(Block block, TransactionInfo txInfo) {
super(block, txInfo);
returnData = toJsonHex(txInfo.getReceipt().getExecutionResult());
error = txInfo.getReceipt().getError();
}
}
| [
"1009096450@qq.com"
] | 1009096450@qq.com |
5286b8b5ebd4734b052ba59cbcf7694c6d10fe72 | 2848b110d5629f4d8cad3765ab4cd1a8ca3e6e2d | /app/src/main/java/com/nineworldsdeep/gauntlet/model/HashNode.java | da7dfdafa8d0e6c2b04019f61ec4fb8f64425980 | [] | no_license | BBuchholz/Gauntlet | 6127c32f9fb005122a71a32cc6f3ab07341456bd | 7c6d8d784a931a66631a469b6838839d96dc30bb | refs/heads/master | 2021-03-03T16:28:47.085131 | 2019-02-03T22:04:20 | 2019-02-03T22:04:20 | 42,060,022 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,100 | java | package com.nineworldsdeep.gauntlet.model;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import java.util.ArrayList;
/**
* Created by brent on 6/15/16.
*/
public class HashNode implements TapestryNode {
private String mHash, mHashedAt;
private ArrayList<FileNode> mFiles =
new ArrayList<>();
private ArrayList<TagNode> mTags =
new ArrayList<>();
public HashNode(String hash, String hashedAt) {
this(null, hash, hashedAt);
}
public HashNode(FileNode file, String hashValue, String hashedAt) {
addFile(file);
setHash(hashValue);
setHashedAt(hashedAt);
}
public ArrayList<FileNode> getFiles() {
return this.mFiles;
}
public void addFile(FileNode file) {
if(file != null && !mFiles.contains(file)){
this.mFiles.add(file);
}
}
public ArrayList<TagNode> getTags() {
return this.mTags;
}
public void addTag(TagNode tag) {
if(tag != null && !mTags.contains(tag))
this.mTags.add(tag);
}
public String getHash() {
return this.mHash;
}
public void setHash(String hash) {
this.mHash = hash;
}
public String getHashedAt() {
return this.mHashedAt;
}
public void setHashedAt(String hashedAt) {
this.mHashedAt = hashedAt;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HashNode that = (HashNode) o;
return new EqualsBuilder()
.append(mHash, that.mHash)
.append(mHashedAt, that.mHashedAt)
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder(17, 37)
.append(mHash)
.append(mHashedAt)
.toHashCode();
}
@Override
public boolean supersedes(TapestryNode nd) {
return false;
}
}
| [
"brentbuchholz@gmail.com"
] | brentbuchholz@gmail.com |
b839ecac1f61a009aa7e6d7ed77906cb256fe041 | 61c6164c22142c4369d525a0997b695875865e29 | /base/src/main/java/com/spirit/client/CriteriaTarea.java | 5869aa2db95be7e88a0ca5bab4d4912f1b859735 | [] | no_license | xruiz81/spirit-creacional | e5a6398df65ac8afa42be65886b283007d190eae | 382ee7b1a6f63924b8eb895d4781576627dbb3e5 | refs/heads/master | 2016-09-05T14:19:24.440871 | 2014-11-10T17:12:34 | 2014-11-10T17:12:34 | 26,328,756 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 440 | java | package com.spirit.client;
import java.io.Serializable;
import com.spirit.client.model.SpiritModel;
import com.spirit.exception.GenericBusinessException;
public abstract class CriteriaTarea implements Serializable {
public abstract String getNombreCriteria();
public abstract String getNombrePanel();
public abstract void realizarAccion() throws GenericBusinessException;
public abstract SpiritModel getPanel() ;
}
| [
"xruiz@creacional.com"
] | xruiz@creacional.com |
c87ae69ac73373cbc0aa371d9248ceb92d646999 | d3f514c5beecc961cc6921c04418aedc047bd486 | /src/main/java/br/com/farias/sampleJwtAuthSpring/security/SecurityConstants.java | 29be915849615bb92593eade4898db95ecef0a91 | [] | no_license | Gyliarde/sampleSpringMvcJwtAuth | 3394c1cbb577965b4119ce3cc9fffb33461f272e | 172f7c8f84468fe1a4eb878ccdcc231fea199c1f | refs/heads/main | 2023-01-02T10:41:23.040858 | 2020-10-30T01:54:18 | 2020-10-30T01:54:18 | 308,497,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package br.com.farias.sampleJwtAuthSpring.security;
public class SecurityConstants {
public static final String SECRET = "SecretKeyToGenJWTs";
public static final long EXPIRATION_TIME = 864_000_000; // 10 days
public static final String TOKEN_PREFIX = "Bearer ";
public static final String HEADER_STRING = "Authorization";
public static final String SIGN_UP_URL = "/users/sign-up";
}
| [
"Gyli1234"
] | Gyli1234 |
9720e3ed1f90671e20c7109283adf79eb754f7bf | 11c423a786f67d5cbe97fc86900a443eb609d1d3 | /src/main/java/com/fcj/fcjmooc02/utils/MyMapper.java | 14ea8009a2a14c693e64ec2934c52fd0ecb88e85 | [] | no_license | Dormi1993/fcjmooc02 | 6f9346c889d449e3afcdb9d99c1f9252994eec3d | 37e5c101e62fbd5fbf7b8d030228e6a456ef1d68 | refs/heads/master | 2022-06-22T21:09:30.898328 | 2020-03-01T13:41:46 | 2020-03-01T13:41:46 | 242,474,595 | 0 | 0 | null | 2022-06-21T02:53:35 | 2020-02-23T07:25:41 | Java | UTF-8 | Java | false | false | 1,509 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2014-2016 abel533@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.fcj.fcjmooc02.utils;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;
/**
* 继承自己的MyMapper
*
* @author liuzh
* @since 2015-09-06 21:53
*/
public interface MyMapper<T> extends Mapper<T>, MySqlMapper<T> {
//TODO
//FIXME 特别注意,该接口不能被扫描到,否则会出错
}
| [
"fucj1993@163.com"
] | fucj1993@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.