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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
632bf2147ade4ed175ab11d285c2bc24f4b2f604 | 4eda9f9d39fcce71a97382bc9dcea1c6f2e74b1c | /longcheng_app/trunk_V2.4.0/libsuperplayer/src/main/java/com/tencent/liteav/demo/play/bean/TCPlayKeyFrameDescInfo.java | 5204d8bb3bc9d6edd318beb8f89b901a83875732 | [] | no_license | junwei0000/all | 4eacc518a93f2e1b92a921fa294bdce7b6694e79 | dffe32c16e38c46a60ec2022f5da198b7c02a383 | refs/heads/master | 2021-07-17T22:13:06.343261 | 2021-02-23T06:41:11 | 2021-02-23T06:41:11 | 54,452,127 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package com.tencent.liteav.demo.play.bean;
public class TCPlayKeyFrameDescInfo {
public String content; // 描述信息
public float time;// (秒)
@Override
public String toString() {
return "TCPlayKeyFrameDescInfo{" +
"content='" + content + '\'' +
", time=" + time +
'}';
}
}
| [
""
] | |
67261a2df92926e45de471cfa91d5442ab724842 | 5f0d7b8f7834101213b88cdbc80343d60c8e778d | /app/src/main/java/com/example/app_choferes/ui/fragments/ExpensesFragment.java | 606a143c7d67894f58886940982907e873bf9269 | [] | no_license | davidPerezRamirez/app_choferes | 83da14a91ec3fed92e6973d1aa74465aa3b98bb7 | 73b301a2165050658277c2169e8525584d40db72 | refs/heads/master | 2020-05-19T22:26:14.898476 | 2019-05-25T19:04:07 | 2019-05-25T19:04:07 | 185,245,872 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,986 | java | package com.example.app_choferes.ui.fragments;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.design.widget.CoordinatorLayout;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Spinner;
import com.example.app_choferes.R;
import com.example.app_choferes.adapters.ExpenseTypeListAdapter;
import com.example.app_choferes.contracts.ExpensesFragmentContract;
import com.example.app_choferes.listeners.OnBackPressedListener;
import com.example.app_choferes.models.ExpenseType;
import com.example.app_choferes.models.User;
import com.example.app_choferes.presenter.ExpensesFragmentPresenterImp;
import java.io.IOException;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import static com.example.app_choferes.constants.AppConstants.SELECT_PHOTO;
import static com.example.app_choferes.constants.AppConstants.TAKE_PHOTO;
public class ExpensesFragment extends BaseFragment<ExpensesFragmentContract.Presenter> implements OnBackPressedListener, ExpensesFragmentContract.View {
private static final int MAX_ATTEMPT = 3;
private Bitmap capturedImage;
private User currentUser;
@BindView(R.id.clContainer)
CoordinatorLayout clContainer;
@BindView(R.id.image)
ImageView image;
@BindView(R.id.spTypeExpenseList)
Spinner spTypeExpenseList;
@BindView(R.id.etAmount)
EditText etAmount;
@BindView(R.id.etDescription)
EditText etDescrption;
@OnClick(R.id.btn_accept)
public void onClickBtnAccept() {
String description = etDescrption.getText().toString();
int idTypeExpense = ((ExpenseType) spTypeExpenseList.getSelectedItem()).getId();
Double amount = Double.parseDouble(etAmount.getText().toString());
getPresenter().saveNewExpense(description, idTypeExpense, amount, capturedImage);
}
@OnClick(R.id.btn_camera)
public void onClickBtnCamera() {
this.getPresenter().openCamera();
}
@OnClick(R.id.btn_open_gallery)
public void onClickBtnOpenGallery() {
this.getPresenter().openGallery();
}
public static ExpensesFragment newInstance(User currentUser) {
ExpensesFragment fragment = new ExpensesFragment();
fragment.setCurrentUser(currentUser);
return fragment;
}
public void setCurrentUser(User currentUser) {
this.currentUser = currentUser;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
clContainer = (CoordinatorLayout) inflater.inflate(R.layout.expenses_fragment, container, false);
unbinder = ButterKnife.bind(this, clContainer);
faActivity.setOnBackPressedListener(this);
this.initializeSpinnerExpenseTypes();
return clContainer;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Uri imageUri = null;
capturedImage = null;
int currentAttempt = 0;
if (data != null) {
if (requestCode == TAKE_PHOTO) {
imageUri = Uri.parse(presenter.getPathImage());
} else if (requestCode == SELECT_PHOTO) {
imageUri = data.getData();
}
try {
while (capturedImage == null && currentAttempt < MAX_ATTEMPT) {
capturedImage = MediaStore.Images.Media.getBitmap(this.getMainActivity().getContentResolver(), imageUri);
currentAttempt++;
}
if (capturedImage == null) {
showTemporalMsg("No fue posible cargar la imagen. Intente nuevamente");
} else {
image.setImageURI(imageUri);
}
} catch (IOException ex) {
Log.e("ExpensesFragment", ex.getMessage());
} catch (NullPointerException ex) {
Log.e("ExpensesFragment", ex.getMessage());
}
}
}
@Override
public boolean doBack() {
this.switchFragmentBack();
return false;
}
@Override
protected ExpensesFragmentContract.Presenter createPresenter() {
return new ExpensesFragmentPresenterImp(this);
}
private void initializeSpinnerExpenseTypes() {
getPresenter().loadExpenseTypes();
}
@Override
public void loadExpenseTypes(List<ExpenseType> expenseTypes) {
spTypeExpenseList.setAdapter(new ExpenseTypeListAdapter(this.getMainActivity(), R.layout.spinner_item_list, expenseTypes));
}
@Override
public User getCurrentUser() {
return currentUser;
}
}
| [
"pucarauntref@gmail.com"
] | pucarauntref@gmail.com |
6815385573978b6bfa6d8e6ea9b87922066d18bc | ea7ba99bec1c13ba9aa3d074605d88d4686a69ec | /src/lesson5/Exeption123.java | 5183ac9013f48bc6cbd84f22519a3add5f639bf1 | [] | no_license | Vika-Domaskina/java_test_2 | 6478a536abacbec100ad19ad7f79e065667d476c | 8eb0ca862c7300986327f73d1bfe853e31de558e | refs/heads/master | 2020-12-07T17:15:02.685371 | 2017-10-17T13:46:40 | 2017-10-17T13:46:40 | 95,446,159 | 1 | 1 | null | 2017-09-21T12:44:12 | 2017-06-26T12:53:55 | Java | UTF-8 | Java | false | false | 1,465 | java | package lesson5;
/**
* Created by Viktoriya.D on 9/26/2017.
*/
public class Exeption123 {
public static void main(String[] args) throws Exception {
//напишите тут ваш код
try {
method1();
} catch (Exception3 s) {
System.out.println(s + "intercepted33333!!!!!");
} catch (Exception2 r) {
System.out.println(r + "intercepted22222!!!!!!!");
} catch (Exception1 e) {
System.out.println(e + "intercepted11111!!!!!!");
}
//напишите тут ваш код
}
public static void method1() throws Exception1, Exception2, Exception3, Exception4 {
int i = (int) (Math.random() * 30); /*27;*/
System.out.println(i);
if (i == 0)
throw new Exception1();
if (i < 10)
throw new Exception2();
if (i < 100)
throw new Exception3();
if (i == 27)
throw new Exception4();
}
}
class Exception1 extends RuntimeException {
public String toString() {
return "RuntimeException [= 0]";
}
}
class Exception2 extends Exception {
public String toString() {
return "MyException2 [<10]";
}
}
class Exception3 extends Exception {
public String toString() {
return "MyException3 [< 100]";
}
}
class Exception4 extends RuntimeException {
public String toString() {
return "RuntimeException [==27]";
}
}
| [
"v1ktor1ya.domask1na@gmail.com"
] | v1ktor1ya.domask1na@gmail.com |
bbf157da7670b52e148818c6e6405f996a469ea2 | 6e88b342403e57463745e7de2217b96dcb841bfd | /src/test/java/com/vipgti/nvempleados/web/rest/UserResourceIntTest.java | 46bb1f7b242ea9bc333d14dd210f32ca7fe8a9e0 | [] | no_license | BulkSecurityGeneratorProject/nvempleados | 56d2815d607a98abdf6ce9791c8869f3f49440c6 | c58258cc6d099283dc5f26ec3f374864266943e6 | refs/heads/master | 2022-12-19T20:42:52.596469 | 2017-07-15T23:17:01 | 2017-07-15T23:17:01 | 296,568,103 | 0 | 0 | null | 2020-09-18T08:56:11 | 2020-09-18T08:56:10 | null | UTF-8 | Java | false | false | 2,908 | java | package com.vipgti.nvempleados.web.rest;
import com.vipgti.nvempleados.NvempleadosApp;
import com.vipgti.nvempleados.domain.User;
import com.vipgti.nvempleados.repository.UserRepository;
import com.vipgti.nvempleados.service.UserService;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Test class for the UserResource REST controller.
*
* @see UserResource
*/
@RunWith(SpringRunner.class)
@SpringBootTest(classes = NvempleadosApp.class)
public class UserResourceIntTest {
@Inject
private UserRepository userRepository;
@Inject
private UserService userService;
private MockMvc restUserMockMvc;
/**
* Create a User.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which has a required relationship to the User entity.
*/
public static User createEntity(EntityManager em) {
User user = new User();
user.setLogin("test");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail("test@test.com");
user.setFirstName("test");
user.setLastName("test");
user.setLangKey("en");
em.persist(user);
em.flush();
return user;
}
@Before
public void setup() {
UserResource userResource = new UserResource();
ReflectionTestUtils.setField(userResource, "userRepository", userRepository);
ReflectionTestUtils.setField(userResource, "userService", userService);
this.restUserMockMvc = MockMvcBuilders.standaloneSetup(userResource).build();
}
@Test
public void testGetExistingUser() throws Exception {
restUserMockMvc.perform(get("/api/users/admin")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.lastName").value("Administrator"));
}
@Test
public void testGetUnknownUser() throws Exception {
restUserMockMvc.perform(get("/api/users/unknown")
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isNotFound());
}
}
| [
"fernandoyandun@softwareevolutivo.com.ec"
] | fernandoyandun@softwareevolutivo.com.ec |
eb43d9f3621e58055b83d837c15daf6bc2f79467 | ba26af1bfe70673303f39fb34bf83f5c08ed5905 | /analysis/src/test/java/org/apache/calcite/test/DiffTestCase.java | 10f47ba73b1858a598f3637d8fe44eb75625d2b9 | [
"MIT"
] | permissive | GinPonson/Quicksql | 5a4a6671e87b3278e2d77eee497a4910ac340617 | e31f65fb96ea2f2c373ba3acc43473a48dca10d1 | refs/heads/master | 2020-07-30T06:23:41.805009 | 2019-09-22T08:50:18 | 2019-09-22T08:50:18 | 210,116,844 | 0 | 0 | MIT | 2019-09-22T08:48:23 | 2019-09-22T08:48:23 | null | UTF-8 | Java | false | false | 16,758 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to you under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.calcite.test;
import org.apache.calcite.util.ReflectUtil;
import org.apache.calcite.util.Util;
import org.incava.diff.Diff;
import org.incava.diff.Difference;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.LineNumberReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* DiffTestCase is an abstract base for JUnit tests which produce multi-line
* output to be verified by diffing against a pre-existing reference file.
*/
public abstract class DiffTestCase {
//~ Instance fields --------------------------------------------------------
private final String testCaseName;
/**
* Name of current .log file.
*/
protected File logFile;
/**
* Name of current .ref file.
*/
protected File refFile;
/**
* OutputStream for current test log.
*/
protected OutputStream logOutputStream;
/**
* Diff masks defined so far
*/
// private List diffMasks;
private String diffMasks;
Matcher compiledDiffMatcher;
private String ignorePatterns;
Matcher compiledIgnoreMatcher;
/**
* Whether to give verbose message if diff fails.
*/
private boolean verbose;
//~ Constructors -----------------------------------------------------------
/**
* Initializes a new DiffTestCase.
*
* @param testCaseName Test case name
*/
protected DiffTestCase(String testCaseName) throws Exception {
this.testCaseName = testCaseName;
// diffMasks = new ArrayList();
diffMasks = "";
ignorePatterns = "";
compiledIgnoreMatcher = null;
compiledDiffMatcher = null;
String verboseVal =
System.getProperty(DiffTestCase.class.getName() + ".verbose");
if (verboseVal != null) {
verbose = true;
}
}
//~ Methods ----------------------------------------------------------------
@Before
protected void setUp() {
// diffMasks.clear();
diffMasks = "";
ignorePatterns = "";
compiledIgnoreMatcher = null;
compiledDiffMatcher = null;
}
@After
protected void tearDown() throws IOException {
if (logOutputStream != null) {
logOutputStream.close();
logOutputStream = null;
}
}
/**
* Initializes a diff-based test. Any existing .log and .dif files
* corresponding to this test case are deleted, and a new, empty .log file
* is created. The default log file location is a subdirectory under the
* result getTestlogRoot(), where the subdirectory name is based on the
* unqualified name of the test class. The generated log file name will be
* testMethodName.log, and the expected reference file will be
* testMethodName.ref.
*
* @return Writer for log file, which caller should use as a destination for
* test output to be diffed
*/
protected Writer openTestLog() throws Exception {
File testClassDir =
new File(
getTestlogRoot(),
ReflectUtil.getUnqualifiedClassName(getClass()));
testClassDir.mkdirs();
File testLogFile =
new File(
testClassDir,
testCaseName);
return new OutputStreamWriter(
openTestLogOutputStream(testLogFile), StandardCharsets.UTF_8);
}
/**
* @return the root under which testlogs should be written
*/
protected abstract File getTestlogRoot() throws Exception;
/**
* Initializes a diff-based test, overriding the default log file naming
* scheme altogether.
*
* @param testFileSansExt full path to log filename, without .log/.ref
* extension
*/
protected OutputStream openTestLogOutputStream(File testFileSansExt)
throws IOException {
assert logOutputStream == null;
logFile = new File(testFileSansExt.toString() + ".log");
logFile.delete();
refFile = new File(testFileSansExt.toString() + ".ref");
logOutputStream = new FileOutputStream(logFile);
return logOutputStream;
}
/**
* Finishes a diff-based test. Output that was written to the Writer
* returned by openTestLog is diffed against a .ref file, and if any
* differences are detected, the test case fails. Note that the diff used is
* just a boolean test, and does not create any .dif ouput.
*
* <p>NOTE: if you wrap the Writer returned by openTestLog() (e.g. with a
* PrintWriter), be sure to flush the wrapping Writer before calling this
* method.</p>
*
* @see #diffFile(File, File)
*/
protected void diffTestLog() throws IOException {
assert logOutputStream != null;
logOutputStream.close();
logOutputStream = null;
if (!refFile.exists()) {
Assert.fail("Reference file " + refFile + " does not exist");
}
diffFile(logFile, refFile);
}
/**
* Compares a log file with its reference log.
*
* <p>Usually, the log file and the reference log are in the same directory,
* one ending with '.log' and the other with '.ref'.
*
* <p>If the files are identical, removes logFile.
*
* @param logFile Log file
* @param refFile Reference log
*/
protected void diffFile(File logFile, File refFile) throws IOException {
int n = 0;
BufferedReader logReader = null;
BufferedReader refReader = null;
try {
// NOTE: Use of diff.mask is deprecated, use diff_mask.
String diffMask = System.getProperty("diff.mask", null);
if (diffMask != null) {
addDiffMask(diffMask);
}
diffMask = System.getProperty("diff_mask", null);
if (diffMask != null) {
addDiffMask(diffMask);
}
logReader = Util.reader(logFile);
refReader = Util.reader(refFile);
LineNumberReader logLineReader = new LineNumberReader(logReader);
LineNumberReader refLineReader = new LineNumberReader(refReader);
for (;;) {
String logLine = logLineReader.readLine();
String refLine = refLineReader.readLine();
while ((logLine != null) && matchIgnorePatterns(logLine)) {
// System.out.println("logMatch Line:" + logLine);
logLine = logLineReader.readLine();
}
while ((refLine != null) && matchIgnorePatterns(refLine)) {
// System.out.println("refMatch Line:" + logLine);
refLine = refLineReader.readLine();
}
if ((logLine == null) || (refLine == null)) {
if (logLine != null) {
diffFail(
logFile,
logLineReader.getLineNumber());
}
if (refLine != null) {
diffFail(
logFile,
refLineReader.getLineNumber());
}
break;
}
logLine = applyDiffMask(logLine);
refLine = applyDiffMask(refLine);
if (!logLine.equals(refLine)) {
diffFail(
logFile,
logLineReader.getLineNumber());
}
}
} finally {
if (logReader != null) {
logReader.close();
}
if (refReader != null) {
refReader.close();
}
}
// no diffs detected, so delete redundant .log file
logFile.delete();
}
/**
* Adds a diff mask. Strings matching the given regular expression will be
* masked before diffing. This can be used to suppress spurious diffs on a
* case-by-case basis.
*
* @param mask a regular expression, as per String.replaceAll
*/
protected void addDiffMask(String mask) {
// diffMasks.add(mask);
if (diffMasks.length() == 0) {
diffMasks = mask;
} else {
diffMasks = diffMasks + "|" + mask;
}
Pattern compiledDiffPattern = Pattern.compile(diffMasks);
compiledDiffMatcher = compiledDiffPattern.matcher("");
}
protected void addIgnorePattern(String javaPattern) {
if (ignorePatterns.length() == 0) {
ignorePatterns = javaPattern;
} else {
ignorePatterns = ignorePatterns + "|" + javaPattern;
}
Pattern compiledIgnorePattern = Pattern.compile(ignorePatterns);
compiledIgnoreMatcher = compiledIgnorePattern.matcher("");
}
private String applyDiffMask(String s) {
if (compiledDiffMatcher != null) {
compiledDiffMatcher.reset(s);
// we assume most of lines do not match
// so compiled matches will be faster than replaceAll.
if (compiledDiffMatcher.find()) {
return s.replaceAll(diffMasks, "XYZZY");
}
}
return s;
}
private boolean matchIgnorePatterns(String s) {
if (compiledIgnoreMatcher != null) {
compiledIgnoreMatcher.reset(s);
return compiledIgnoreMatcher.matches();
}
return false;
}
private void diffFail(
File logFile,
int lineNumber) {
final String message =
"diff detected at line " + lineNumber + " in " + logFile;
if (verbose) {
if (inIde()) {
// If we're in IntelliJ, it's worth printing the 'expected
// <...> actual <...>' string, becauase IntelliJ can format
// this intelligently. Otherwise, use the more concise
// diff format.
Assert.assertEquals(
message,
fileContents(refFile),
fileContents(logFile));
} else {
String s = diff(refFile, logFile);
Assert.fail(message + '\n' + s + '\n');
}
}
Assert.fail(message);
}
/**
* Returns whether this test is running inside the IntelliJ IDE.
*
* @return whether we're running in IntelliJ.
*/
private static boolean inIde() {
Throwable runtimeException = new Throwable();
runtimeException.fillInStackTrace();
final StackTraceElement[] stackTrace =
runtimeException.getStackTrace();
StackTraceElement lastStackTraceElement =
stackTrace[stackTrace.length - 1];
// Junit test launched from IntelliJ 6.0
if (lastStackTraceElement.getClassName().equals(
"com.intellij.rt.execution.junit.JUnitStarter")
&& lastStackTraceElement.getMethodName().equals("main")) {
return true;
}
// Application launched from IntelliJ 6.0
if (lastStackTraceElement.getClassName().equals(
"com.intellij.rt.execution.application.AppMain")
&& lastStackTraceElement.getMethodName().equals("main")) {
return true;
}
return false;
}
/**
* Returns a string containing the difference between the contents of two
* files. The string has a similar format to the UNIX 'diff' utility.
*/
public static String diff(File file1, File file2) {
List<String> lines1 = fileLines(file1);
List<String> lines2 = fileLines(file2);
return diffLines(lines1, lines2);
}
/**
* Returns a string containing the difference between the two sets of lines.
*/
public static String diffLines(List<String> lines1, List<String> lines2) {
final Diff<String> differencer = new Diff<>(lines1, lines2);
final List<Difference> differences = differencer.execute();
StringWriter sw = new StringWriter();
int offset = 0;
for (Difference d : differences) {
final int as = d.getAddedStart() + 1;
final int ae = d.getAddedEnd() + 1;
final int ds = d.getDeletedStart() + 1;
final int de = d.getDeletedEnd() + 1;
if (ae == 0) {
if (de == 0) {
// no change
} else {
// a deletion: "<ds>,<de>d<as>"
sw.append(String.valueOf(ds));
if (de > ds) {
sw.append(",").append(String.valueOf(de));
}
sw.append("d").append(String.valueOf(as - 1)).append('\n');
for (int i = ds - 1; i < de; ++i) {
sw.append("< ").append(lines1.get(i)).append('\n');
}
}
} else {
if (de == 0) {
// an addition: "<ds>a<as,ae>"
sw.append(String.valueOf(ds - 1)).append("a").append(
String.valueOf(as));
if (ae > as) {
sw.append(",").append(String.valueOf(ae));
}
sw.append('\n');
for (int i = as - 1; i < ae; ++i) {
sw.append("> ").append(lines2.get(i)).append('\n');
}
} else {
// a change: "<ds>,<de>c<as>,<ae>
sw.append(String.valueOf(ds));
if (de > ds) {
sw.append(",").append(String.valueOf(de));
}
sw.append("c").append(String.valueOf(as));
if (ae > as) {
sw.append(",").append(String.valueOf(ae));
}
sw.append('\n');
for (int i = ds - 1; i < de; ++i) {
sw.append("< ").append(lines1.get(i)).append('\n');
}
sw.append("---\n");
for (int i = as - 1; i < ae; ++i) {
sw.append("> ").append(lines2.get(i)).append('\n');
}
offset = offset + (ae - as) - (de - ds);
}
}
}
return sw.toString();
}
/**
* Returns a list of the lines in a given file.
*
* @param file File
* @return List of lines
*/
private static List<String> fileLines(File file) {
List<String> lines = new ArrayList<>();
try (LineNumberReader r = new LineNumberReader(Util.reader(file))) {
String line;
while ((line = r.readLine()) != null) {
lines.add(line);
}
return lines;
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
/**
* Returns the contents of a file as a string.
*
* @param file File
* @return Contents of the file
*/
protected static String fileContents(File file) {
byte[] buf = new byte[2048];
try (FileInputStream reader = new FileInputStream(file)) {
int readCount;
final ByteArrayOutputStream writer = new ByteArrayOutputStream();
while ((readCount = reader.read(buf)) >= 0) {
writer.write(buf, 0, readCount);
}
return writer.toString(StandardCharsets.UTF_8.name());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
/**
* Sets whether to give verbose message if diff fails.
*/
protected void setVerbose(boolean verbose) {
this.verbose = verbose;
}
/**
* Sets the diff masks that are common to .REF files
*/
protected void setRefFileDiffMasks() {
// mask out source control Id
addDiffMask("\\$Id.*\\$");
// NOTE hersker 2006-06-02:
// The following two patterns can be used to mask out the
// sqlline JDBC URI and continuation prompts. This is useful
// during transition periods when URIs are changed, or when
// new drivers are deployed which have their own URIs but
// should first pass the existing test suite before their
// own .ref files get checked in.
//
// It is not recommended to use these patterns on an everyday
// basis. Real differences in the output are difficult to spot
// when diff-ing .ref and .log files which have different
// sqlline prompts at the start of each line.
// mask out sqlline JDBC URI prompt
addDiffMask("0: \\bjdbc(:[^:>]+)+:>");
// mask out different-length sqlline continuation prompts
addDiffMask("^(\\.\\s?)+>");
}
}
// End DiffTestCase.java
| [
"xushengguo-xy@360.cn"
] | xushengguo-xy@360.cn |
964272b2001fb947abfbf841684f2fed6d5366b1 | 214408363ebd4b3f44a811bfcb2d3164d5aef11f | /background/src/main/java/com/cikers/wechat/mall/modules/app/controller/AppProductController.java | cf9f717b175df4deafb64dabb42f684b459a5b91 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | david-hwp/cikers | b2da3743f957361ba57929b1d03f407db36c9c26 | 3bc803e476aba3c450a6417387141fcb17f00d6a | refs/heads/master | 2020-03-19T06:42:49.543408 | 2018-07-02T13:51:18 | 2018-07-02T13:51:18 | 136,048,300 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,203 | java | package com.cikers.wechat.mall.modules.app.controller;
import com.cikers.wechat.mall.common.utils.BaseResp;
import com.cikers.wechat.mall.modules.app.dto.EquipmentDTO;
import com.cikers.wechat.mall.modules.app.entity.EquipmentEntity;
import com.cikers.wechat.mall.modules.app.entity.ProductEntity;
import com.cikers.wechat.mall.modules.app.entity.PropertyEntity;
import com.cikers.wechat.mall.modules.app.entity.PropertyRelationEntity;
import com.cikers.wechat.mall.modules.app.form.ProductForm;
import com.cikers.wechat.mall.modules.app.service.EquipmentService;
import com.cikers.wechat.mall.modules.app.service.ProductService;
import com.cikers.wechat.mall.modules.app.service.PropertyRelationService;
import com.cikers.wechat.mall.modules.app.service.PropertyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by WeiPing He on 2018/6/4 01:22.
* Email: weiping_he@hansight.com
*/
@Slf4j
@Api(value = "商品操作", tags = {"商品的查询"})
@RestController
@RequestMapping("/wechat/products")
@ConfigurationProperties(prefix = "cikers.server")
public class AppProductController {
@Autowired
private RestTemplate restTemplate;
@Autowired
private EquipmentService equipmentService;
@Autowired
private ProductService productService;
@Autowired
private PropertyService propertyService;
@Autowired
private PropertyRelationService propertyRelationService;
private String host;
@PostMapping(value = "list", produces = "application/json")
// @ApiOperation("获得商品")
// @ApiImplicitParams({
// @ApiImplicitParam(paramType = "body", dataType = "String", name = "keyword", value = "用户搜索的关键字", required = false),
// @ApiImplicitParam(paramType = "body", dataType = "String", name = "type", value = "商品类型", required = false),
// @ApiImplicitParam(paramType = "body", dataType = "int", name = "pageSize", value = "页大小", required = true),
// @ApiImplicitParam(paramType = "body", dataType = "int", name = "pageIndex", value = "页码", required = true),
// })
@ApiOperation(value = "获得商品列表", produces = "application/json")
@ResponseBody
public BaseResp products(@RequestBody ProductForm productForm) {
log.debug(productForm.toString());
if (productForm.getPageIndex() == null) {
productForm.setPageIndex(1);
}
if (productForm.getPageSize() == null) {
productForm.setPageSize(10);
}
return BaseResp.ok(equipmentService.queryList(productForm));
// if (allProducts.isEmpty()) {
// //拼接参数
// String url = host + version + "/products/";
//
// //get json数据
// EquipmentDTO product = restTemplate.getForEntity(url, EquipmentDTO.class).getBody();
// log.info("赛克商品接口返回:{}", product.getData().size());
//
// if (product.getE() != 0 && product.getMsg() != null) {
// //返回异常信息
// return BaseResp.error(product.getMsg());
// }
//
// allProducts = product.getData();
// }
// return BaseResp.ok().put("product", allProducts);
}
@GetMapping(value = "update", produces = "application/json")
@ApiOperation(value = "商品列表更新接口", produces = "application/json")
@ResponseBody
public BaseResp update() {
try {
//拼接参数
String url = host + "/products";
//get json数据
// restTemplate.get
EquipmentDTO equipmentDTO = restTemplate.getForObject(url, EquipmentDTO.class);
log.info("赛克商品接口返回商品数据量:{}", equipmentDTO.getData().size());
propertyRelationService.truncate();
propertyService.truncate();
productService.truncate();
equipmentService.truncate();
Map<Long, PropertyEntity> properties = new HashMap<>();
List<EquipmentEntity> equipmentEntities = equipmentDTO.getData();
for (EquipmentEntity equipmentEntity : equipmentEntities) {
List<ProductEntity> products = equipmentEntity.getProudcts();
for (ProductEntity product : products) {
Map<String, PropertyEntity> props = product.getProps();
for (String s : props.keySet()) {
PropertyEntity propertyEntity = props.get(s);
properties.put(propertyEntity.getId(), propertyEntity);
// propertyService.insert(propertyEntity);
PropertyRelationEntity propertyRelationEntity = new PropertyRelationEntity();
propertyRelationEntity.setProductId(product.getId());
propertyRelationEntity.setPropertyName(s);
propertyRelationEntity.setPropertyId(propertyEntity.getId());
propertyRelationService.insert(propertyRelationEntity);
}
productService.insert(product);
}
Map<String, PropertyEntity> props = equipmentEntity.getProps();
for (String s : props.keySet()) {
PropertyEntity propertyEntity = props.get(s);
properties.put(propertyEntity.getId(), propertyEntity);
// propertyService.insert(propertyEntity);
PropertyRelationEntity propertyRelationEntity = new PropertyRelationEntity();
propertyRelationEntity.setEquipmentId(equipmentEntity.getId());
propertyRelationEntity.setPropertyName(s);
propertyRelationEntity.setPropertyId(propertyEntity.getId());
propertyRelationService.insert(propertyRelationEntity);
}
equipmentService.insert(equipmentEntity);
}
for (Long id : properties.keySet()) {
propertyService.insert(properties.get(id));
}
} catch (Exception e) {
return BaseResp.error(e.getMessage());
}
return BaseResp.ok();
}
@GetMapping(value = "group", produces = "application/json")
@ApiOperation(value = "获取商品分组信息", produces = "application/json")
@ResponseBody
public BaseResp group() {
try {
List<PropertyEntity> propertyEntities = propertyService.queryTypes();
return BaseResp.ok(propertyEntities);
} catch (Exception e) {
return BaseResp.error(e.getMessage());
}
}
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
}
| [
"weiping_he@hansight.com"
] | weiping_he@hansight.com |
bf8297e9b9e0a85b141ceb87a571a644a2a69195 | 7874c5125ed36259c95c6d1fac27fa1bc24c5f87 | /src/RootElement/Task/impl/TaskPackageImpl.java | edaf8449b5c70a32170ca384eb6ff3ad23e24b90 | [] | no_license | Jiaxin-li/PegasusMDD | f3455386a7b8584f9edda0914a96b51f7617fcc4 | 400c627c09c63d063fa97a6573631a5e00963988 | refs/heads/master | 2021-01-10T16:37:38.345296 | 2016-01-07T08:04:03 | 2016-01-07T08:04:03 | 47,560,844 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,964 | java | /**
*/
package RootElement.Task.impl;
import RootElement.Account.AccountPackage;
import RootElement.Account.impl.AccountPackageImpl;
import RootElement.Booking.BookingPackage;
import RootElement.Booking.impl.BookingPackageImpl;
import RootElement.CheckIO.CheckIOPackage;
import RootElement.CheckIO.impl.CheckIOPackageImpl;
import RootElement.Payment.PaymentPackage;
import RootElement.Payment.impl.PaymentPackageImpl;
import RootElement.Room.RoomPackage;
import RootElement.Room.impl.RoomPackageImpl;
import RootElement.Schedule.SchedulePackage;
import RootElement.Schedule.impl.SchedulePackageImpl;
import RootElement.Service.ServicePackage;
import RootElement.Service.impl.ServicePackageImpl;
import RootElement.Task.Task;
import RootElement.Task.TaskFactory;
import RootElement.Task.TaskManagement;
import RootElement.Task.TaskPackage;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;
import org.eclipse.uml2.types.TypesPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Package</b>.
* <!-- end-user-doc -->
* @generated
*/
public class TaskPackageImpl extends EPackageImpl implements TaskPackage {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass taskManagementEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass taskEClass = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
* <p>Note: the correct way to create the package is via the static
* factory method {@link #init init()}, which also performs
* initialization of the package, or returns the registered package,
* if one already exists.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see RootElement.Task.TaskPackage#eNS_URI
* @see #init()
* @generated
*/
private TaskPackageImpl() {
super(eNS_URI, TaskFactory.eINSTANCE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static boolean isInited = false;
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link TaskPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/
public static TaskPackage init() {
if (isInited) return (TaskPackage)EPackage.Registry.INSTANCE.getEPackage(TaskPackage.eNS_URI);
// Obtain or create and register package
TaskPackageImpl theTaskPackage = (TaskPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TaskPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new TaskPackageImpl());
isInited = true;
// Initialize simple dependencies
TypesPackage.eINSTANCE.eClass();
// Obtain or create and register interdependencies
PaymentPackageImpl thePaymentPackage = (PaymentPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(PaymentPackage.eNS_URI) instanceof PaymentPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(PaymentPackage.eNS_URI) : PaymentPackage.eINSTANCE);
BookingPackageImpl theBookingPackage = (BookingPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(BookingPackage.eNS_URI) instanceof BookingPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(BookingPackage.eNS_URI) : BookingPackage.eINSTANCE);
AccountPackageImpl theAccountPackage = (AccountPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(AccountPackage.eNS_URI) instanceof AccountPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(AccountPackage.eNS_URI) : AccountPackage.eINSTANCE);
RoomPackageImpl theRoomPackage = (RoomPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(RoomPackage.eNS_URI) instanceof RoomPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(RoomPackage.eNS_URI) : RoomPackage.eINSTANCE);
SchedulePackageImpl theSchedulePackage = (SchedulePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(SchedulePackage.eNS_URI) instanceof SchedulePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(SchedulePackage.eNS_URI) : SchedulePackage.eINSTANCE);
ServicePackageImpl theServicePackage = (ServicePackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ServicePackage.eNS_URI) instanceof ServicePackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ServicePackage.eNS_URI) : ServicePackage.eINSTANCE);
CheckIOPackageImpl theCheckIOPackage = (CheckIOPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(CheckIOPackage.eNS_URI) instanceof CheckIOPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(CheckIOPackage.eNS_URI) : CheckIOPackage.eINSTANCE);
// Create package meta-data objects
theTaskPackage.createPackageContents();
thePaymentPackage.createPackageContents();
theBookingPackage.createPackageContents();
theAccountPackage.createPackageContents();
theRoomPackage.createPackageContents();
theSchedulePackage.createPackageContents();
theServicePackage.createPackageContents();
theCheckIOPackage.createPackageContents();
// Initialize created meta-data
theTaskPackage.initializePackageContents();
thePaymentPackage.initializePackageContents();
theBookingPackage.initializePackageContents();
theAccountPackage.initializePackageContents();
theRoomPackage.initializePackageContents();
theSchedulePackage.initializePackageContents();
theServicePackage.initializePackageContents();
theCheckIOPackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
theTaskPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(TaskPackage.eNS_URI, theTaskPackage);
return theTaskPackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTaskManagement() {
return taskManagementEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTaskManagement_Staff() {
return (EReference)taskManagementEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getTaskManagement_TaskList() {
return (EReference)taskManagementEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getTaskManagement__AddTask__Task() {
return taskManagementEClass.getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getTaskManagement__RemoveTask__int() {
return taskManagementEClass.getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getTask() {
return taskEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getTask_Description() {
return (EAttribute)taskEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getTask_Id() {
return (EAttribute)taskEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getTask__SetDescription() {
return taskEClass.getEOperations().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EOperation getTask__GetID() {
return taskEClass.getEOperations().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TaskFactory getTaskFactory() {
return (TaskFactory)getEFactoryInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isCreated = false;
/**
* Creates the meta-model objects for the package. This method is
* guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createPackageContents() {
if (isCreated) return;
isCreated = true;
// Create classes and their features
taskManagementEClass = createEClass(TASK_MANAGEMENT);
createEReference(taskManagementEClass, TASK_MANAGEMENT__STAFF);
createEReference(taskManagementEClass, TASK_MANAGEMENT__TASK_LIST);
createEOperation(taskManagementEClass, TASK_MANAGEMENT___ADD_TASK__TASK);
createEOperation(taskManagementEClass, TASK_MANAGEMENT___REMOVE_TASK__INT);
taskEClass = createEClass(TASK);
createEAttribute(taskEClass, TASK__DESCRIPTION);
createEAttribute(taskEClass, TASK__ID);
createEOperation(taskEClass, TASK___SET_DESCRIPTION);
createEOperation(taskEClass, TASK___GET_ID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isInitialized = false;
/**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void initializePackageContents() {
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
AccountPackage theAccountPackage = (AccountPackage)EPackage.Registry.INSTANCE.getEPackage(AccountPackage.eNS_URI);
TypesPackage theTypesPackage = (TypesPackage)EPackage.Registry.INSTANCE.getEPackage(TypesPackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
// Initialize classes, features, and operations; add parameters
initEClass(taskManagementEClass, TaskManagement.class, "TaskManagement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getTaskManagement_Staff(), theAccountPackage.getStaffAccount(), null, "staff", null, 1, 1, TaskManagement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEReference(getTaskManagement_TaskList(), this.getTask(), null, "taskList", null, 0, -1, TaskManagement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
EOperation op = initEOperation(getTaskManagement__AddTask__Task(), null, "addTask", 1, 1, IS_UNIQUE, !IS_ORDERED);
addEParameter(op, this.getTask(), "t", 1, 1, IS_UNIQUE, !IS_ORDERED);
op = initEOperation(getTaskManagement__RemoveTask__int(), ecorePackage.getEBoolean(), "removeTask", 1, 1, IS_UNIQUE, !IS_ORDERED);
addEParameter(op, ecorePackage.getEInt(), "id", 1, 1, IS_UNIQUE, !IS_ORDERED);
initEClass(taskEClass, Task.class, "Task", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getTask_Description(), theTypesPackage.getString(), "description", null, 1, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEAttribute(getTask_Id(), ecorePackage.getEInt(), "id", null, 1, 1, Task.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, !IS_ORDERED);
initEOperation(getTask__SetDescription(), null, "setDescription", 1, 1, IS_UNIQUE, !IS_ORDERED);
initEOperation(getTask__GetID(), ecorePackage.getEInt(), "getID", 1, 1, IS_UNIQUE, !IS_ORDERED);
// Create resource
createResource(eNS_URI);
}
} //TaskPackageImpl
| [
"lijiaxin1012@gmail.com"
] | lijiaxin1012@gmail.com |
630851c2f08d842a21834da8475d3ce68601b107 | 20e612ba5c071a9329f8f54d35c6c57a7a8e140d | /src/main/java/com/milotnt/service/MemberService.java | 9aff52017009deaed7d28d6a2abd581a28d5dcd5 | [] | no_license | neaos/gym-management-system | 6aef85adb65538f2ae2f7853b66e03ab994f797c | 7cda620c47b43d7d0a7e63cb609848cc1372e2cd | refs/heads/master | 2023-07-17T00:14:06.899454 | 2021-08-24T04:32:57 | 2021-08-24T04:32:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 808 | java | package com.milotnt.service;
import com.milotnt.pojo.Member;
import java.util.List;
/**
* @author ZhangMing [1157038410@qq.com]
* @date 2021/8/11
*/
public interface MemberService {
//查询会员信息
List<Member> findAll();
//新增会员信息
Boolean insertMember(Member member);
//根据会员账号修改会员信息
Boolean updateMemberByMemberAccount(Member member);
//查询会员账号密码(登录)
Member userLogin(Member member);
//Member selectByAccountAndPassword(Member member);
//根据会员账号删除会员信息
Boolean deleteByMemberAccount(Integer memberAccount);
//查询会员数
Integer selectTotalCount();
//根据会员账号查询会员
List<Member> selectByMemberAccount(Integer memberAccount);
}
| [
"zach.milo@qq.com"
] | zach.milo@qq.com |
a591a57c625f1b800940247b236dc7a59ad7bf98 | c90727fac12309862657d90f52553870524df908 | /AndroidImageSlider/app/src/test/java/com/mounts/lenovo/androidimageslider/ExampleUnitTest.java | b8a8555cd9ca5d7873d64878304f74d8e4b5d359 | [] | no_license | 1026linnlinn/Delivery-App | 7e2ed51e1ab06926960bab320b12842e991c4c99 | 7a1c6b6ffaea713e9fbb61e9a4e0f1a701b0dafb | refs/heads/master | 2020-07-04T13:20:01.227365 | 2019-10-03T10:35:02 | 2019-10-03T10:35:02 | 202,297,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.mounts.lenovo.androidimageslider;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"linnlinnhtet4662@gmail.com"
] | linnlinnhtet4662@gmail.com |
5014f8def03eb5fe2cc746d75c87df2da0f1d839 | 112992129b02cc3e07345403e71b09ad42a2876b | /src/tests/V230.java | 2afbe35c1522098b59e0a5902cecb7cbac03bf7d | [] | no_license | xashenx/sectesting | ccbe7dcc87e157d0cdd337a8f50ef8736ef42574 | 73a6ee03099ff8661adb8c73c6576074357462ba | refs/heads/master | 2021-05-26T19:51:49.773224 | 2013-07-13T12:36:13 | 2013-07-13T12:36:13 | 9,753,526 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 992 | java | package tests;
import net.sourceforge.jwebunit.junit.WebTester;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import util.Functions;
import util.Vulnerabilities;
public class V230 {
private static WebTester tester;
@Before
public void prepare(){
tester = new WebTester();
tester.setBaseUrl("http://localhost/sm/");
tester.beginAt("index.php");
Functions.login(tester,"admin");
tester.assertMatch("Manage Classes");
}
@Test
public void page(){
Vulnerabilities.page(tester,"classes","Show in Grid");
tester.assertMatch("School Class Schedule");
tester.assertLinkNotPresentWithText("malicious");
}
@Test
public void page2(){
Vulnerabilities.page2(tester,"classes","Show in Grid");
tester.assertMatch("School Class Schedule");
tester.assertLinkNotPresentWithText("malicious");
}
@After
public void cleanup(){
Functions.click(tester,"Log Out",0);
tester = null;
}
}
| [
"fabrizio.zeni@gmail.com"
] | fabrizio.zeni@gmail.com |
5c1f5330edc5aa8d3a34e0e5e889dc10ea05defe | 5e21a07eb3b6d6ddb567009869e37b3eb8c7bb08 | /jpingus-animator/src/main/java/gee/imaging/sprites/Sprite.java | bd4379893b6339eedaf6ce4c90ccec34bb687dab | [
"MIT"
] | permissive | j-pingus/jpingus | 32041a191e5197f812b2d8d04cc21eb4e2cb0cb8 | 467f20844b3b0b33d4219e0fa14447e09ac60389 | refs/heads/master | 2021-01-23T04:59:28.460449 | 2017-03-26T21:26:33 | 2017-03-26T21:26:33 | 86,265,823 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,691 | java | package gee.imaging.sprites;
import gee.imaging.ImageToolkit;
import gee.imaging.Renderable;
import java.awt.*;
import java.awt.image.*;
//All managing things for a sprite.
public class Sprite implements Renderable {
long animTime = 0;
int z;
int animSpeed = 70;
Image source[][];
Image currentImage;
boolean tiled;
protected int width, height;
protected int i_width, i_height;
int idx = 0, idy = 0;
public void free() {
for (int x = 0; x < source.length; x++) {
for (int y = 0; y < source[x].length; y++) {
try {
source[x][y].getGraphics().dispose();
} catch (Throwable e) {
// TODO: handle exception
}
source[x][y] = null;
}
}
}
public int getSpriteLength() {
return source[0].length;
}
public Sprite(Image img) {
this(img, 0, 0);
}
public void setTiled(int w, int h, boolean tiled) {
this.width = w;
this.height = h;
this.tiled = (width > i_width || height > i_height) && tiled;
}
public Sprite(Image img, int w, int h) {
width = w;
height = h;
i_width = img.getWidth(null);
i_height = img.getHeight(null);
idx = 0;
if (w == 0) {
width = i_width;
}
if (h == 0) {
height = i_height;
}
tiled = width > i_width || height > i_height;
if (!tiled) {
int nbWitdh = i_width / width;
int nbHeight = i_height / height;
source = new Image[nbHeight][nbWitdh];
if (nbHeight == 1 && nbWitdh == 1) {
source[0][0] = img;
return;
}
ImageProducer sourceI = img.getSource();
for (int x = 0; x < nbWitdh; x++) {
for (int y = 0; y < nbHeight; y++) {
ImageFilter extractFilter = new CropImageFilter(
(x * width), (y * height), width, height);
ImageProducer producer = new FilteredImageSource(sourceI,
extractFilter);
source[y][x] = Toolkit.getDefaultToolkit().createImage(
producer);
ImageToolkit.waitForImage(source[y][x]);
producer = null;
extractFilter = null;
}
}
} else {
source = new Image[1][1];
source[0][0] = img;
}
if (w != 0) {
i_width = width;
}
if (h != 0) {
i_height = height;
}
}
public Image getImage(int idImg) {
if (idImg < 0)
return null;
if (source.length == 1) {
return source[0][idImg % source[0].length];
} else if (source[0].length == 1) {
return source[idImg % source.length][0];
} else {
throw new Error("Please specify y");
}
}
public Image getImage(int idImgX, int idImgY) {
if (idImgX < 0)
return null;
if (idImgY < 0)
return null;
return source[idImgY % source.length][idImgX % source[0].length];
}
public boolean update(long elapsed) {
boolean ret = false;
if (source[0].length != 1) {
animTime += elapsed;
idx += animTime / animSpeed;
ret = idx > source[0].length;
idx = idx % source[0].length;
if (idx < 0)
idx = -idx;
animTime = animTime % animSpeed;
}
currentImage = source[idy][idx];
return ret;
// idx_source++;
// idx_source = idx_source % source[0].length;
}
public void paint(Graphics g, int _x, int _y) {
if (!tiled) {
g.drawImage(currentImage, _x, _y, width, height, null);
} else {
for (int x = 0; x + _x <= width; x += i_width) {
for (int y = 0; y <= height; y += i_height) {
if (x == 0) {
g.drawImage(currentImage, x + _x, y + _y, null);
} else {
g.drawImage(source[idy][idx], x + _x, y + _y, null);
}
}
}
}
}
public int getHeight() {
return height;
}
public int getWidth() {
return width;
}
public Image getCurrentImage() {
return currentImage;
}
public void render(Graphics2D g) {
g.drawImage(currentImage, 0, 0, null);
}
public void renderMap(Graphics2D g, float rate, int x, int y) {
float _w = width * rate;
float _h = height * rate;
g.drawImage(currentImage, x, y, (int) _w, (int) _h, null);
}
public int getType() {
return SPRITE;
}
public void initOffset(int offsetx, int offsety) {
// TODO Auto-generated method stub
}
public void setUseOffset(boolean useOffset) {
// TODO Auto-generated method stub
}
public int getX() {
// TODO Auto-generated method stub
return 0;
}
public int getY() {
// TODO Auto-generated method stub
return 0;
}
public int getZ() {
// TODO Auto-generated method stub
return z;
}
public void init(int x, int y, int z) {
// TODO Auto-generated method stub
this.z = z;
}
public boolean contained(int x, int y) {
// TODO Auto-generated method stub
return false;
}
public int getIdx() {
return idx;
}
public void setIdx(int idx) {
this.idx = idx % source[0].length;
}
public int getIdy() {
return idy;
}
public void setIdy(int idy) {
this.idy = idy % source.length;
}
}
| [
"gerald.even@gmail.com"
] | gerald.even@gmail.com |
c90c190811f0a636bd5297074e9f92340adb6ba6 | af7e3c5042220ef99eb77e667fd66148f77c7ed3 | /src/main/java/ms/events/Difficulty.java | 05d92952d872f925f703db0459271b5e3f985c02 | [] | no_license | denzelhall20/Minesweeper-Clone | 25454ed0af36b1dc24046b02aa06309e35fd76b5 | 6e72ad9070fac0503290d3c7f0082feac8a61956 | refs/heads/master | 2023-02-13T19:11:05.864547 | 2021-01-06T21:43:31 | 2021-01-06T21:43:31 | 306,709,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | package ms.events;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
public class Difficulty {
@Getter
private final int numRows;
@Getter
private final int numCols;
@Getter
private final int numBombs;
}
| [
"denzelch19@gmail.com"
] | denzelch19@gmail.com |
dcd413632c5dd595b77c9044d8a3fa428f8c167d | dbd270d5494a86e4b85ddc75b74f8c46dd9e36c5 | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/OurTeleOpUndeclared.java | e44362d31269255b571c8cf08d11de08f4578e6f | [
"BSD-3-Clause"
] | permissive | SHP-Robotics/base-bot-new | edb347c3d34b00528267eb60cbbf6261afb667a5 | 3605e6ddb07acaab116dcd54701e24768d2aad30 | refs/heads/main | 2023-08-17T07:44:48.455805 | 2021-09-19T01:55:34 | 2021-09-19T01:55:34 | 390,071,380 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,016 | java | package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.util.ElapsedTime;
import org.firstinspires.ftc.teamcode.PixyWorking.PixyBlock;
import org.firstinspires.ftc.teamcode.PixyWorking.PixyBlockList;
import org.firstinspires.ftc.teamcode.PixyWorking.PixyCam;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
@TeleOp
public class OurTeleOpUndeclared extends BaseRobot {
PixyCam pixyCam;
public static PixyBlockList blocks1;
PixyBlockList blocks2;
PixyBlockList blocks3;
ElapsedTime elapsedTime = new ElapsedTime();
ElapsedTime elapsedTime2 = new ElapsedTime();
ElapsedTime elapsedTime3 = new ElapsedTime();
PrintWriter file;
@Override
public void init() {
try {
file = new PrintWriter("/sdcard/pixyResults.txt", "UTF-8");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
super.init();
}
@Override
public void start() {
super.start();
}
@Override
public void loop() {
if (elapsedTime3.milliseconds() > 100) {
elapsedTime3.reset();
blocks1 = pixyCam.getBiggestBlocks(1);
// blocks2 = pixyCam.getBiggestBlocks(2);
// blocks3 = pixyCam.getBiggestBlocks(3);
telemetry.addData("Counts", "%d", blocks1.totalCount);
file.println("----------------------------");
// file.format("Elapsed: %s Counts: %d/%d\n", elapsedTime2.toString(), blocks2.totalCount, blocks3.totalCount);
for (int i = 0; i < blocks1.size(); i++) {
PixyBlock block = blocks1.get(i);
if (!block.isEmpty()) {
telemetry.addData("Block 1[" + i + "]", block.toString());
}
}
super.loop();
}
// int min = 1;
// int max = 3;
//
// int random_int;
// int multi_power = 0;
//
// String current_lap = "Starting Race...";
// int current_lap_int = 0;
//
// String current_powerup = "None";
double rightstick_y = gamepad1.right_stick_y/2;
double leftstick_y = gamepad1.left_stick_y/2;
double rightstick_x = gamepad1.right_stick_x/2;
double rightstick_y75 = 3 * (gamepad1.right_stick_y/4);
double leftstick_y75 = 3 * (gamepad1.left_stick_y/4);
double rightstick_x75 = 3 * (gamepad1.right_stick_x/4);
tankanum_drive(gamepad1.right_stick_y, gamepad1.left_stick_y,gamepad1.right_stick_x);
// if (gamepad1.dpad_up || gamepad1.b) {
// setArmLiftMotor(-1);
// } else if (gamepad1.dpad_down || gamepad1.a) {
// setArmLiftMotor(1);
// } else {
// setArmLiftMotor(0);
// }
//
// if (gamepad1.dpad_left) {
// set_right_servo(0);
// set_left_servo(1);
// }
// else if (gamepad1.dpad_right) {
// set_right_servo(1);
// set_left_servo(0);
// }
//
// // lap, blue
// if (checkBlueColor(colorBlock.green(), colorBlock.blue(), colorBlock.red())) {
// reset_drive_encoders();
// current_lap_int++;
// }
//
// if (current_lap_int == 1) {
// current_lap = "1/3";
// }
//
// if (current_lap_int == 2) {
// current_lap = "2/3";
// }
//
// if (current_lap_int == 3) {
// current_lap = "3/3 FINAL LAP";
// }
//
// if (current_lap_int == 4) {
// current_lap = "Finished!";
// }
//
// telemetry.addData("Current Power-Up: ", current_powerup);
// telemetry.addData("Current Lap: ", current_lap);
// telemetry.addData();
telemetry.update();
}
@Override
public void stop() {
file.close();
}
} | [
"bcraftyminer@gmail.com"
] | bcraftyminer@gmail.com |
4b1c5f7a76391bac6ae39618a0db0c037d73e3c6 | c5d952b4faf909eaf85f7e49f862c23117cba597 | /src/main/java/com/jobsearchtry/Employer_Profile_Detail.java | af6be0b45252b9cf823ca5078a47035f4cf78f48 | [] | no_license | KozaSol/TRY1 | 2756126ccb54f41d3a549dfb131946d940f6d936 | 40e57b0e2861dddba46a5eb810bb7f7f65064b0a | refs/heads/master | 2020-12-31T07:11:34.996514 | 2017-02-01T06:34:26 | 2017-02-01T06:34:26 | 80,595,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,278 | java | package com.jobsearchtry;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ToggleButton;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.jobsearchtry.utils.DisplayToastMessage;
import com.jobsearchtry.utils.GlobalData;
import com.jobsearchtry.utils.UtilService;
import com.jobsearchtry.wrapper.Employer;
import org.json.JSONObject;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import okhttp3.FormBody;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
/*In this class we can view|edit the details of employer. Employer can possible to set the
time for contacting the jobseeker(Employer - My Profile).IF the profile status is active,
we can schedule the time,else the jobseeker call us functionality is hidden*/
public class Employer_Profile_Detail extends Activity {
private TextView companame, email, industry, location, phoneno, contactperson, emp_per_gettime,
emp_per_getdays, emp_days, emp_time;
private String getStatus, getCallStatus, getFromTime, getToTime, getFromTimeAM, getToTomeAM, languages;
private ToggleButton showmyprofile;
private ProgressDialog pg;
private OkHttpClient client = null;
private final String[] select_fromm = {"1:00 AM", "2:00 AM", "3:00 AM", "4:00 AM", "5:00 AM", "6:00 AM",
"7:00 AM", "8:00 AM", "9:00 AM",
"10:00 AM", "11:00 AM", "12:00 PM", "1:00 PM", "2:00 PM", "3:00 PM", "4:00 PM",
"5:00 PM", "6:00 PM", "7:00 PM", "8:00 PM", "9:00 PM", "10:00 PM", "11:00 PM",
"12:00" +
" " +
"AM"};
private ArrayList<String> selected_fromampm;
private LinearLayout calluslay, emp_dayslayout,email_lay;
private int indexfromtime = -1, indextotime = -1;
private ArrayAdapter<String> fromtimeAdapter, totimeAdapter;
private ArrayList<String> selectedDays = new ArrayList<>();
@Override
public void onBackPressed() {
startActivity(new Intent(Employer_Profile_Detail.this,
EmployerDashboard.class));
finish();
}
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.employer_profile_detail);
languages = getResources().getConfiguration().locale.getDisplayLanguage();
SharedPreferences sharedPreferences = PreferenceManager
.getDefaultSharedPreferences((getApplicationContext()));
//get the company id from session
GlobalData.emp_login_status = sharedPreferences.getString("ELS",
GlobalData.emp_login_status);
showmyprofile = (ToggleButton) findViewById(R.id.d_e_s_switch_showmyprofile);
emp_per_gettime = (TextView) findViewById(R.id.emp_per_gettime);
emp_per_getdays = (TextView) findViewById(R.id.emp_per_getdays);
calluslay = (LinearLayout) findViewById(R.id.calluslay);
emp_dayslayout = (LinearLayout) findViewById(R.id.emp_dayslayout);
ImageButton changetime = (ImageButton) findViewById(R.id.emp_personal_settime_editicon);
//add the timing from 1AM to 24 PM
selected_fromampm = new ArrayList<>();
for (int i = 1; i < 25; i++) {
if (i < 12) {
selected_fromampm.add(Integer.toString(i));
} else {
selected_fromampm.add(Integer.toString(i));
}
}
changetime.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
changetimepopup();
}
});
//header logo clicking go to dashboard page
ImageButton emp_pro_header = (ImageButton) findViewById(R.id.js_r_h);
emp_pro_header.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Employer_Profile_Detail.this,
EmployerDashboard.class));
finish();
}
});
ImageButton back = (ImageButton) findViewById(R.id.js_r_back);
back.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Employer_Profile_Detail.this,
EmployerDashboard.class));
finish();
}
});
//go to the employer detail edit page when edit icon clicking
ImageButton emp_personal_editicon = (ImageButton) findViewById(R.id.emp_personal_editicon);
emp_personal_editicon.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(Employer_Profile_Detail.this,
Employer_Profile.class));
}
});
companame = (TextView) findViewById(R.id.d_emp_u_r_companyname);
email = (TextView) findViewById(R.id.d_emp_u_r_emailaddress);
email_lay = (LinearLayout) findViewById(R.id.email_lay);
phoneno = (TextView) findViewById(R.id.d_emp_u_r_phonenumber);
contactperson = (TextView) findViewById(R.id.d_emp_u_r_contactperson);
industry = (TextView) findViewById(R.id.d_emp_u_r_industry);
location = (TextView) findViewById(R.id.d_emp_u_r_location);
emp_days = (TextView) findViewById(R.id.emp_days);
emp_time = (TextView) findViewById(R.id.emp_time);
}
private void changetimepopup() {
final Dialog alertDialog = new Dialog(Employer_Profile_Detail.this,R.style.MyThemeDialog);
alertDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
alertDialog.setCanceledOnTouchOutside(false);
View emppromptView = View.inflate(Employer_Profile_Detail.this, R.layout.callsetting, null);
RadioGroup emp_settime_call = (RadioGroup) emppromptView.findViewById(R.id
.emp_settime_call);
RadioButton anytime = (RadioButton) emppromptView.findViewById(R.id.emp_anytime);
LinearLayout emp_time_from_lay = (LinearLayout) emppromptView.findViewById(R.id
.emp_time_from_lay);
LinearLayout emp_time_to_lay = (LinearLayout) emppromptView.findViewById(R.id
.emp_time_to_lay);
final LinearLayout specitimelay = (LinearLayout) emppromptView.findViewById(R.id
.specftimelayy);
ImageButton exit = (ImageButton) emppromptView.findViewById(R.id.exit_callset);
final Button emp_time_to = (Button) emppromptView.findViewById(R.id.emp_time_to);
final Button emp_time_from = (Button) emppromptView.findViewById(R.id.emp_time_from);
Button sabetime = (Button) emppromptView.findViewById(R.id.emp_profille_time_Submit);
RadioButton specifictime = (RadioButton) emppromptView.findViewById(R.id.emp_specifictime);
final CheckBox monday = (CheckBox) emppromptView.findViewById(R.id.call_monday);
final CheckBox tuesday = (CheckBox) emppromptView.findViewById(R.id.call_tuesday);
final CheckBox wednesday = (CheckBox) emppromptView.findViewById(R.id.call_wed);
final CheckBox thursday = (CheckBox) emppromptView.findViewById(R.id.call_thurs);
final CheckBox friday = (CheckBox) emppromptView.findViewById(R.id.call_fri);
final CheckBox saturday = (CheckBox) emppromptView.findViewById(R.id.call_sat);
final CheckBox sunday = (CheckBox) emppromptView.findViewById(R.id.call_sun);
if (selectedDays.contains("Monday")) {
monday.setChecked(true);
}
if (selectedDays.contains("Tuesday")) {
tuesday.setChecked(true);
}
if (selectedDays.contains("Wednesday")) {
wednesday.setChecked(true);
}
if (selectedDays.contains("Thursday")) {
thursday.setChecked(true);
}
if (selectedDays.contains("Friday")) {
friday.setChecked(true);
}
if (selectedDays.contains("Saturday")) {
saturday.setChecked(true);
}
if (selectedDays.contains("Sunday")) {
sunday.setChecked(true);
}
monday.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (monday.isChecked() && !selectedDays.contains("Monday")) {
selectedDays.add("Monday");
} else {
selectedDays.remove("Monday");
}
}
});
tuesday.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (tuesday.isChecked() && !selectedDays.contains("Tuesday")) {
selectedDays.add("Tuesday");
} else {
selectedDays.remove("Tuesday");
}
}
});
wednesday.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (wednesday.isChecked() && !selectedDays.contains("Wednesday")) {
selectedDays.add("Wednesday");
} else {
selectedDays.remove("Wednesday");
}
}
});
thursday.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (thursday.isChecked() && !selectedDays.contains("Thursday")) {
selectedDays.add("Thursday");
} else {
selectedDays.remove("Thursday");
}
}
});
friday.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (friday.isChecked() && !selectedDays.contains("Friday")) {
selectedDays.add("Friday");
} else {
selectedDays.remove("Friday");
}
}
});
saturday.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (saturday.isChecked() && !selectedDays.contains("Saturday")) {
selectedDays.add("Saturday");
} else {
selectedDays.remove("Saturday");
}
}
});
sunday.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) {
if (sunday.isChecked() && !selectedDays.contains("Sunday")) {
selectedDays.add("Sunday");
} else {
selectedDays.remove("Sunday");
}
}
});
emp_time_from_lay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
timeFromAlert(emp_time_from);
}
});
emp_time_to_lay.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
timeToAlert(emp_time_to);
}
});
if (getCallStatus.equals("Y")) {
anytime.setChecked(false);
specifictime.setChecked(true);
specitimelay.setVisibility(View.VISIBLE);
if (getToTomeAM != null && !getToTomeAM.isEmpty() && !getToTomeAM.equalsIgnoreCase(getString(R.string.time))) {
emp_time_to.setText(getToTomeAM);
} else {
emp_time_to.setText(getString(R.string.time));
}
if (getFromTimeAM != null && !getFromTimeAM.isEmpty() && !getFromTimeAM.equalsIgnoreCase(getString(R.string.time))) {
emp_time_from.setText(getFromTimeAM);
} else {
emp_time_from.setText(getString(R.string.time));
}
} else {
//showmyproefile active and selecting any time means hide the time selection view.
getFromTime = "";
getToTime = "";
getFromTimeAM = "";
getToTomeAM = "";
anytime.setChecked(true);
specifictime.setChecked(false);
specitimelay.setVisibility(View.GONE);
}
//radio group(from/to) changes
emp_settime_call.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
switch (checkedId) {
case R.id.emp_anytime:
getCallStatus = "N";
getFromTime = "";
getFromTimeAM = "";
getToTime = "";
getToTomeAM = "";
specitimelay.setVisibility(View.GONE);
break;
case R.id.emp_specifictime:
getCallStatus = "Y";
emp_time_to.setText(getString(R.string.to));
emp_time_from.setText(getString(R.string.from));
specitimelay.setVisibility(View.VISIBLE);
break;
default:
break;
}
}
});
alertDialog.setContentView(emppromptView);
alertDialog.show();
exit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (verifiedTime()) {
new ShowMyProfileTimeUpdate().execute();
}
}
});
sabetime.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (verifiedTime()) {
new ShowMyProfileTimeUpdate().execute();
}
}
});
}
//select from time from call setting
private void timeFromAlert(final Button emp_time_from) {
final Dialog alertDialog = new Dialog(Employer_Profile_Detail.this,R.style.MyThemeDialog);
alertDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
alertDialog.setCanceledOnTouchOutside(false);
View emppromptView = View.inflate(Employer_Profile_Detail.this, R.layout.spinner, null);
TextView f_popupheader = (TextView) emppromptView.findViewById(R.id.spinn_popupheader);
f_popupheader.setText(R.string.from);
Button fromtimedone = (Button) emppromptView.findViewById(R.id.spinner_done);
ImageButton exit = (ImageButton) emppromptView.findViewById(R.id.exit_spinner);
final ListView filterfromtime = (ListView) emppromptView.findViewById(R.id.spinnerlist);
if (getFromTimeAM != null && !getFromTimeAM.isEmpty() && !getFromTimeAM.equalsIgnoreCase(getString(R.string.from))) {
indexfromtime = -1;
for (int i = 0; i < select_fromm.length; i++) {
if (select_fromm[i].equals(getFromTimeAM)) {
indexfromtime = i;
}
}
} else {
indexfromtime = -1;
}
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item_text, select_fromm) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
Context mContext = this.getContext();
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context
.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.spinner_item_text, parent, false);
}
TextView textView = (TextView) v.findViewById(R.id.spinneritemqualification);
String yourValue = select_fromm[position];
if (indexfromtime != -1 && (indexfromtime == position)) {
textView.setBackgroundColor(Color.parseColor("#a7c1cc"));
} else {
textView.setBackgroundColor(Color.parseColor("#dedede"));
}
textView.setText(yourValue);
return textView;
}
};
filterfromtime.setAdapter(adapter);
filterfromtime.setSelection(indexfromtime);
alertDialog.setContentView(emppromptView);
alertDialog.show();
exit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
setFromTime(emp_time_from);
alertDialog.dismiss();
}
});
filterfromtime.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
if (indexfromtime != -1 && (indexfromtime == position)) {
getFromTimeAM = getString(R.string.time);
indexfromtime = -1;
} else {
indexfromtime = position;
getFromTimeAM = select_fromm[position];
if (getFromTimeAM.equals(select_fromm[position])) {
getFromTime = selected_fromampm.get(position);
}
}
setFromTime(emp_time_from);
adapter.notifyDataSetChanged();
}
});
fromtimedone.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
setFromTime(emp_time_from);
alertDialog.dismiss();
}
});
}
private void setFromTime(Button emp_time_from) {
if (getFromTimeAM != null && !getFromTimeAM.isEmpty() && !getFromTimeAM.equalsIgnoreCase(getString(R.string.from))) {
emp_time_from.setText(getFromTimeAM);
} else {
emp_time_from.setText(getString(R.string.from));
}
}
//select to time from call setting
private void timeToAlert(final Button emp_time_to) {
final Dialog alertDialog = new Dialog(Employer_Profile_Detail.this,R.style.MyThemeDialog);
alertDialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent);
alertDialog.setCanceledOnTouchOutside(false);
View emppromptView = View.inflate(Employer_Profile_Detail.this, R.layout.spinner, null);
TextView f_popupheader = (TextView) emppromptView.findViewById(R.id.spinn_popupheader);
f_popupheader.setText(R.string.to);
Button totimedone = (Button) emppromptView.findViewById(R.id.spinner_done);
ImageButton exit = (ImageButton) emppromptView.findViewById(R.id.exit_spinner);
final ListView filtertotime = (ListView) emppromptView.findViewById(R.id.spinnerlist);
if (getToTomeAM != null && !getToTomeAM.isEmpty() && !getToTomeAM.equalsIgnoreCase(getString(R.string.to))) {
indextotime = -1;
for (int i = 0; i < select_fromm.length; i++) {
if (select_fromm[i].equals(getToTomeAM)) {
indextotime = i;
}
}
} else {
indextotime = -1;
}
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item_text, select_fromm) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
Context mContext = this.getContext();
LayoutInflater vi = (LayoutInflater) mContext.getSystemService(Context
.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.spinner_item_text, parent, false);
}
TextView textView = (TextView) v.findViewById(R.id.spinneritemqualification);
String yourValue = select_fromm[position];
if (indextotime != -1 && (indextotime == position)) {
textView.setBackgroundColor(Color.parseColor("#a7c1cc"));
} else {
textView.setBackgroundColor(Color.parseColor("#dedede"));
}
textView.setText(yourValue);
return textView;
}
};
filtertotime.setAdapter(adapter);
filtertotime.setSelection(indextotime);
alertDialog.setContentView(emppromptView);
alertDialog.show();
exit.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
setToTime(emp_time_to);
alertDialog.dismiss();
}
});
filtertotime.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
if (indextotime != -1 && (indextotime == position)) {
getToTomeAM = getString(R.string.to);
indextotime = -1;
} else {
indextotime = position;
getToTomeAM = select_fromm[position];
if (getToTomeAM.equals(select_fromm[position])) {
getToTime = selected_fromampm.get(position);
}
}
setToTime(emp_time_to);
adapter.notifyDataSetChanged();
}
});
totimedone.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
setToTime(emp_time_to);
alertDialog.dismiss();
}
});
}
private void setToTime(Button emp_time_to) {
if (getToTomeAM != null && !getToTomeAM.isEmpty() && !getToTomeAM.equalsIgnoreCase(getString(R.string.to))) {
emp_time_to.setText(getToTomeAM);
} else {
emp_time_to.setText(getString(R.string.to));
}
}
private boolean verifiedTime() {
//validation of this page
if (getCallStatus != null && !getCallStatus.isEmpty() && getCallStatus.equalsIgnoreCase
("Y")) {
if (getFromTimeAM != null && !getFromTimeAM.isEmpty() && !getFromTimeAM.equalsIgnoreCase(getString(R.string.to))) {
if (getToTomeAM != null && !getToTomeAM.isEmpty() && !getToTomeAM.equalsIgnoreCase(getString(R.string.to))) {
if (Integer.parseInt(getFromTime) > Integer.parseInt(getToTime)) {
Toast.makeText(
getApplicationContext(),
getString(R.string.fromtotime),
Toast.LENGTH_SHORT).show();
return false;
}
} else {
Toast.makeText(
getApplicationContext(),
getString(R.string.totime),
Toast.LENGTH_SHORT).show();
return false;
}
} else {
Toast.makeText(
getApplicationContext(),
getString(R.string.fromtime),
Toast.LENGTH_SHORT).show();
return false;
}
}
if (!new UtilService().isNetworkAvailable(getApplicationContext())) {
Toast.makeText(
getApplicationContext(),
getString(R.string.checkconnection),
Toast.LENGTH_SHORT).show();
return false;
}
return true;
}
//resume-get the detail of the employer from database
@Override
protected void onResume() {
super.onResume();
if (new UtilService().isNetworkAvailable(getApplicationContext())) {
new getEmployerDetail().execute();
} else {
Toast.makeText(getApplicationContext(),
getString(R.string.checkconnection), Toast.LENGTH_SHORT)
.show();
}
}
//get the details of employer webservices
private class getEmployerDetail extends AsyncTask<String, String, String> {
String empdetailresponse;
@Override
protected void onPreExecute() {
super.onPreExecute();
try {
if (pg != null && pg.isShowing())
pg.dismiss();
} catch (Exception ignored) {
}
pg = new ProgressDialog(Employer_Profile_Detail.this,
R.style.MyTheme);
pg.setCancelable(false);
pg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pg.setIndeterminate(true);
pg.setIndeterminateDrawable(getResources().getDrawable(R.drawable.custom_progress_dialog_animation));
pg.show();
}
protected String doInBackground(String... args) {
MultipartBody.Builder paramsadd = new MultipartBody.Builder().setType(MultipartBody
.FORM);
if (!languages.equalsIgnoreCase("English")) {
paramsadd.addFormDataPart("languages", languages);
}
paramsadd.addFormDataPart("company_id", GlobalData.emp_login_status);
paramsadd.addFormDataPart("action", "EmpProfileView");
MultipartBody requestBody = paramsadd.build();
Request request = new Request.Builder()
.url(GlobalData.url + "employer_View_update.php")
.post(requestBody).build();
client = new OkHttpClient();
try {
Response response = client.newCall(request).execute();
empdetailresponse = response.body().string();
} catch (IOException ignored) {
}
return null;
}
protected void onPostExecute(String file_url) {
super.onPostExecute(file_url);
if (pg != null && pg.isShowing())
pg.dismiss();
if (empdetailresponse != null
&& !empdetailresponse.contains("connectionFailure")) {
try {
JSONObject responseObj = new JSONObject(empdetailresponse);
Gson gson = new Gson();
final Employer employer = gson.fromJson(
responseObj.getString("list"),
new TypeToken<Employer>() {
}.getType());
companame.setText(employer.getCompanyName());
String getEmail = employer.getEmailId();
if (!(getEmail !=null && getEmail.isEmpty())) {
email_lay.setVisibility(View.VISIBLE);
email.setText(employer.getEmailId());
}
else {
email_lay.setVisibility(View.GONE);
}
industry.setText(employer.getIndustry());
location.setText(employer.getLocation());
phoneno.setText(employer.getMobile());
contactperson.setText(employer.getContactPerson());
GlobalData.empusername = employer.getCompanyName();
if (!languages.equalsIgnoreCase("English")) {
if (!responseObj.getString("location_local").isEmpty() && responseObj.getString("location_local") != null) {
location.setText(responseObj.getString("location_local"));
}
if (!responseObj.getString("emp_industry_local").isEmpty() && responseObj.getString("emp_industry_local") != null) {
industry.setText(responseObj.getString("emp_industry_local"));
}
}
getStatus = employer.getShowMyPhone();
selectedDays = new ArrayList<>();
if (responseObj.getString("specificdays") != "null") {
emp_per_getdays.setText(responseObj.getString("specificdays"));
if (!languages.equalsIgnoreCase("English")) {
if (!responseObj.getString("emp_specificdays_local").isEmpty() && responseObj.getString("emp_specificdays_local") != null) {
emp_per_getdays.setText(responseObj.getString("emp_specificdays_local"));
}
}
emp_dayslayout.setVisibility(View.VISIBLE);
List<String> dayslist = Arrays.asList(responseObj.getString("specificdays").split(","));
for (int i = 0; i < dayslist.size(); i++) {
if (!(selectedDays.contains(dayslist.get(i)))) {
selectedDays.add(dayslist.get(i));
}
}
} else {
emp_dayslayout.setVisibility(View.GONE);
}
//if get status = 0 ,show my profile is off and job seeker call us view is
// h
// idden,else show my profile is on and call us view is visible, we can set
// the time for contact the jobseeker
final int valuemax = (int) getResources().getDimension(R.dimen.buttonHeightToSmall);
final int valuemin = (int) getResources().getDimension(R.dimen.margintop);
if (getStatus.equalsIgnoreCase("0")) {
calluslay.setVisibility(View.GONE);
emp_time.setVisibility(View.GONE);
emp_per_gettime.setText(R.string.anytime);
showmyprofile.setChecked(false);
showmyprofile.setTextOff("No");
showmyprofile.setTextOn("Yes");
showmyprofile.setPadding(valuemax, 0, valuemin, 0);
getCallStatus = "N";
} else {
getCallStatus = employer.getTime_status();
if (getCallStatus.equals("Y")) {
//showmyproefile active and specific time means get the time and
// show it
if (!employer.getSettime().isEmpty()) {
String time = employer.getSettime();
settime(time);
}
} else {
emp_per_gettime.setText(R.string.anytime);
}
calluslay.setVisibility(View.VISIBLE);
emp_time.setVisibility(View.VISIBLE);
showmyprofile.setChecked(true);
showmyprofile.setTextOff("No");
showmyprofile.setTextOn("Yes");
showmyprofile.setPadding(valuemin, 0, valuemax, 0);
}
//toggle the showmyprofile active/inactive and the status will be updating to
// database
showmyprofile
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(
CompoundButton arg0, boolean isChecked) {
if (showmyprofile.isChecked()) {
showmyprofile.setPadding(valuemin, 0, valuemax, 0);
showmyprofile.setTextOff("No");
showmyprofile.setTextOn("Yes");
getCallStatus = employer.getTime_status();
if (getCallStatus.equals("Y")) {
//showmyproefile active and specific time means get
// the time and show it
if (!employer.getSettime().isEmpty()) {
String time = employer.getSettime();
settime(time);
}
} else {
emp_per_gettime.setText(R.string.anytime);
}
calluslay.setVisibility(View.VISIBLE);
} else {
showmyprofile.setTextOff("No");
showmyprofile.setTextOn("Yes");
showmyprofile.setPadding(valuemax, 0, valuemin, 0);
getCallStatus = "N";
emp_per_gettime.setText(R.string.anytime);
calluslay.setVisibility(View.GONE);
}
if (new UtilService()
.isNetworkAvailable(getApplicationContext())) {
new ShowMyProfileUpdate().execute();
} else {
Toast.makeText(
getApplicationContext(),
getString(R.string.checkconnection),
Toast.LENGTH_SHORT).show();
}
}
});
} catch (Exception e) {
Toast.makeText(Employer_Profile_Detail.this,
getString(R.string.errortoparse), Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(Employer_Profile_Detail.this,
getString(R.string.connectionfailure), Toast.LENGTH_SHORT)
.show();
}
}
}
private void settime(String time) {
//showmyproefile active means get the time
if (getCallStatus.equals("Y")) {
emp_per_gettime.setText(getFromTimeAM + " - " + getToTomeAM);
//showmyproefile active and specific time means get the time and show it
if (!time.isEmpty()) {
String[] out = time.split("-");
getFromTimeAM = out[0];
if (Arrays.asList(select_fromm).contains(getFromTimeAM)) {
int frompos = Arrays.asList(select_fromm).indexOf(getFromTimeAM);
getFromTime = selected_fromampm.get(frompos);
}
getToTomeAM = out[1];
if (Arrays.asList(select_fromm).contains(getToTomeAM)) {
int topos = Arrays.asList(select_fromm).indexOf(getToTomeAM);
getToTime = selected_fromampm.get(topos);
}
emp_per_gettime.setText(getFromTimeAM + " - " + getToTomeAM);
} else {
getFromTime = "1";
getToTime = "1";
getFromTimeAM = "1:00 AM";
getToTomeAM = "1:00 AM";
emp_per_gettime.setText(getFromTimeAM + " - " + getToTomeAM);
}
} else {
//showmyproefile active and selecting any time means hide the time selection view.
getFromTime = "1";
getToTime = "1";
getFromTimeAM = "1:00 AM";
getToTomeAM = "1:00 AM";
emp_per_gettime.setText(R.string.anytime);
}
}
//show my profile active/inactive update to database
private class ShowMyProfileUpdate extends AsyncTask<String, String, String> {
String gsonresponse;
@Override
protected void onPreExecute() {
super.onPreExecute();
try {
if (pg != null && pg.isShowing())
pg.dismiss();
} catch (Exception ignored) {
}
pg = new ProgressDialog(Employer_Profile_Detail.this,
R.style.MyTheme);
pg.setCancelable(false);
pg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pg.setIndeterminate(true);
pg.setIndeterminateDrawable(getResources().getDrawable(R.drawable.custom_progress_dialog_animation));
pg.show();
}
protected String doInBackground(String... args) {
RequestBody formBody = new FormBody.Builder()
.add("action", "change_status")
.add("company_id", GlobalData.emp_login_status).build();
Request request = new Request.Builder()
.url(GlobalData.url + "show_phone_employer.php")
.post(formBody).build();
client = new OkHttpClient();
try {
Response response = client.newCall(request).execute();
gsonresponse = response.body().string();
} catch (IOException ignored) {
}
return null;
}
protected void onPostExecute(String file_url) {
super.onPostExecute(file_url);
if (pg != null && pg.isShowing())
pg.dismiss();
if (gsonresponse != null
&& !gsonresponse.contains("connectionFailure")) {
try {
JSONObject responseObj = new JSONObject(gsonresponse);
String updateStatus = responseObj.getString("show_phone_no");
//if 0 means phoneno visible to jobseeker, 1 means phoneno is now viisble,so
// jobseeker doesnot contact to employer
if (updateStatus.equalsIgnoreCase("0")) {
new DisplayToastMessage().isToastMessage(Employer_Profile_Detail.this,
getString(R.string.showmyphonenocant));
} else {
new DisplayToastMessage().isToastMessage(Employer_Profile_Detail.this,
getString(R.string.showmyphoneno));
}
} catch (Exception e) {
Toast.makeText(getBaseContext(), getString(R.string.errortoparse),
Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getBaseContext(),
getString(R.string.connectionfailure), Toast.LENGTH_SHORT)
.show();
}
}
}
//updating a specific(AM/PM) or anytime to database
private class ShowMyProfileTimeUpdate extends AsyncTask<String, String, String> {
String gsonresponse;
@Override
protected void onPreExecute() {
super.onPreExecute();
try {
if (pg != null && pg.isShowing())
pg.dismiss();
} catch (Exception ignored) {
}
pg = new ProgressDialog(Employer_Profile_Detail.this,
R.style.MyTheme);
pg.setCancelable(false);
pg.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pg.setIndeterminate(true);
pg.setIndeterminateDrawable(getResources().getDrawable(R.drawable.custom_progress_dialog_animation));
pg.show();
}
protected String doInBackground(String... args) {
String selecteddays = "";
if (getCallStatus.equalsIgnoreCase("Y")) {
String[] getdays = selectedDays.toArray(new
String[selectedDays.size()]);
String getdaysarray = Arrays.toString(getdays);
selecteddays = getdaysarray.substring(1, getdaysarray
.length() - 1);
selecteddays = selecteddays.replace(", ", ",");
} else {
selecteddays = "";
}
MultipartBody.Builder paramsadd = new MultipartBody.Builder().setType(MultipartBody
.FORM);
paramsadd.addFormDataPart("action", "filter");
if (!languages.equalsIgnoreCase("English")) {
paramsadd.addFormDataPart("languages", languages);
}
paramsadd.addFormDataPart("company_id", GlobalData.emp_login_status);
paramsadd.addFormDataPart("time_status", getCallStatus);
paramsadd.addFormDataPart("settime", getFromTimeAM + "-" + getToTomeAM);
paramsadd.addFormDataPart("specificdays", selecteddays);
MultipartBody requestBody = paramsadd.build();
Request request = new Request.Builder()
.url(GlobalData.url + "employer_set_time.php")
.post(requestBody).build();
client = new OkHttpClient();
try {
Response response = client.newCall(request).execute();
gsonresponse = response.body().string();
} catch (IOException ignored) {
}
return null;
}
protected void onPostExecute(String file_url) {
super.onPostExecute(file_url);
if (pg != null && pg.isShowing())
pg.dismiss();
if (gsonresponse != null
&& !gsonresponse.contains("connectionFailure")) {
try {
JSONObject json = new JSONObject(gsonresponse);
String message = json.getString("call_toast");
int statuscode = json.getInt("status_code");
//if the getCallStatus is "N" means anytime , else Specific time
if (getCallStatus.equalsIgnoreCase("N")) {
Toast.makeText(getBaseContext(),
getString(R.string.anytimecall),
Toast.LENGTH_SHORT).show();
} else {
if (statuscode == 1) {
new DisplayToastMessage().isToastMessage(Employer_Profile_Detail.this, message);
}
}
startActivity(new Intent(Employer_Profile_Detail.this,
Employer_Profile_Detail.class));
} catch (Exception e) {
Toast.makeText(getBaseContext(), getString(R.string.errortoparse),
Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getBaseContext(),
getString(R.string.connectionfailure), Toast.LENGTH_SHORT)
.show();
}
}
}
} | [
"ramyaavinoth.22@gmail.com"
] | ramyaavinoth.22@gmail.com |
1882fe4a06daf3a0e6ca4fdf385f1ae46cafe4ab | b5eab0e8fe7ce6749720e1a116fe72cde4c2fea0 | /spring/src/main/java/io/xgeeks/examples/spring/PaymentService.java | 787695b923a8cccea156300f24e81349e17e68cb | [
"MIT"
] | permissive | xgeekshq/workshop-intro-java-11-spring | 4bd1250f5cb9e14bacf849402d6dbd6248878df1 | a2d07955d175496b5850d26ef05d468dedaa72d4 | refs/heads/main | 2023-05-02T12:35:47.107437 | 2021-05-06T13:48:53 | 2021-05-06T13:48:53 | 359,374,781 | 3 | 0 | MIT | 2021-04-26T18:24:01 | 2021-04-19T07:54:31 | Java | UTF-8 | Java | false | false | 484 | java | package io.xgeeks.examples.spring;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
public class PaymentService {
private final Payment payment;
public PaymentService(@Qualifier("creditCard") Payment payment) {
this.payment = payment;
}
@Override
public String toString() {
return "PaymentService{" +
"payment=" + payment +
'}';
}
}
| [
"otaviopolianasantana@gmail.com"
] | otaviopolianasantana@gmail.com |
aefd6326ff72b38dd1550f0883f2662d40f0f542 | ec2b483eb4313f1843f3483c574d4ab7406f53ae | /sqfx/core/src/org/squirrelsql/session/objecttree/ObjectTreeFindCtrl.java | e90fc7dd8f333aabcf2fd419abc324b04df3586f | [] | no_license | Bartman0/SQuirreLSQL | cd813a48fac8b7b653da9b8e8689eddd1568bfde | c53798894835c6b16f18a256d56c8e7846d5f2e1 | refs/heads/master | 2021-01-01T04:12:14.816599 | 2016-04-10T19:22:22 | 2016-04-10T19:22:22 | 57,206,180 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,170 | java | package org.squirrelsql.session.objecttree;
import javafx.scene.Node;
import javafx.scene.control.Tooltip;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeView;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyCodeCombination;
import javafx.scene.input.KeyEvent;
import org.squirrelsql.Props;
import org.squirrelsql.globalicons.GlobalIconNames;
import org.squirrelsql.services.FxmlHelper;
import org.squirrelsql.services.I18n;
import org.squirrelsql.session.Session;
import org.squirrelsql.session.action.StdActionCfg;
import org.squirrelsql.session.completion.CompletionCtrl;
import org.squirrelsql.session.completion.TextFieldTextComponentAdapter;
import org.squirrelsql.workaround.KeyMatchWA;
import java.util.List;
public class ObjectTreeFindCtrl
{
private final FxmlHelper<ObjectTreeFindView> _fxmlHelper;
private final Props _props = new Props(getClass());
private final CompletionCtrl _completionCtrl;
private I18n _i18n = new I18n(getClass());
private TreeView<ObjectTreeNode> _objectsTree;
private Session _session;
private ObjectTreeFindView _view;
public ObjectTreeFindCtrl(TreeView<ObjectTreeNode> objectsTree, Session session)
{
_objectsTree = objectsTree;
_session = session;
_fxmlHelper = new FxmlHelper<>(ObjectTreeFindView.class);
_view = _fxmlHelper.getView();
_view.btnFind.setGraphic(_props.getImageView(GlobalIconNames.SEARCH));
_view.btnFind.setTooltip(new Tooltip(_i18n.t("objecttreefind.find.tooltip")));
_view.btnFind.setOnAction(e -> onFind());
_view.btnFilter.setGraphic(_props.getImageView("filter.png"));
_view.btnFilter.setTooltip(new Tooltip(_i18n.t("objecttreefind.filter.tooltip")));
_view.btnFilter.setOnAction(e -> onFilter());
_completionCtrl = new CompletionCtrl(_session, new TextFieldTextComponentAdapter(_view.txtText));
_view.txtText.setOnKeyPressed(e -> onHandleKeyEvent(e, false));
_view.txtText.setOnKeyTyped(e -> onHandleKeyEvent(e, true));
}
private void onFilter()
{
new FilterResultCtrl(_session, _objectsTree, _view.txtText.getText());
}
private void onHandleKeyEvent(KeyEvent keyEvent, boolean consumeOnly)
{
if ( KeyMatchWA.matches(keyEvent, StdActionCfg.SQL_CODE_COMPLETION.getActionCfg().getKeyCodeCombination()) )
{
if (false == consumeOnly)
{
_completionCtrl.completeCode();
}
keyEvent.consume();
return;
}
if ( KeyMatchWA.matches(keyEvent, new KeyCodeCombination(KeyCode.ENTER)))
{
if (false == consumeOnly)
{
onFind();
}
keyEvent.consume();
return;
}
}
private void onFind()
{
List<TreeItem<ObjectTreeNode>> objectsMatchingNames = ObjectTreeUtil.findObjectsMatchingName(_objectsTree, _view.txtText.getText(), NameMatchMode.EQUALS);
if(0 == objectsMatchingNames.size())
{
return;
}
ObjectTreeUtil.selectItem(_objectsTree, objectsMatchingNames.get(0));
}
public Node getNode()
{
return _fxmlHelper.getRegion();
}
}
| [
"gerdhwagner@t-online.de"
] | gerdhwagner@t-online.de |
2ae077fff22e7b3052b60a7de6026ba5cc3256af | bce034d1302504f4a46043d9537d3c5678032d07 | /src/main/java/resourceater/controller/CpuResourceController.java | b541bae6442fc95af2f0fc9857e26be43bb6dc31 | [] | no_license | rajendrapenumalli/resourceater | 12435632e6750ff706b7705af8ec846ea199372b | 14b01ed6f1e2088558190357cd58161aa1e790a1 | refs/heads/master | 2020-06-15T03:13:32.006869 | 2019-05-31T17:49:37 | 2019-05-31T17:49:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | package resourceater.controller;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import resourceater.model.resource.cpu.CpuResource;
import resourceater.model.resource.cpu.CpuResourceRequest;
import resourceater.repository.ResourceRepository;
import static resourceater.controller.Mappings.CORES;
/**
* @author Jonatan Ivanov
*/
@RestController
@RequestMapping(CORES)
@Api(tags = {"CPU Cores"})
public class CpuResourceController extends ResourceController<CpuResourceRequest, CpuResource> {
public CpuResourceController(ResourceRepository<CpuResource> repository) {
super(repository);
}
@Override
CpuResource createResource(CpuResourceRequest request) {
return new CpuResource(request);
}
}
| [
"jonatan.ivanov@gmail.com"
] | jonatan.ivanov@gmail.com |
694c2d97dcd8fcf298db0e86e9a68290c1b6752e | 578c31dfc1131c6c44b0e8e36a7a092ea798d2a0 | /apnahome/src/p1/DBInfo.java | 37c04d04313d4fc5432960be96f6578a54c64eb1 | [] | no_license | vkgupta0025/HouseHive | 1c1308b15dcf3f2716c73e3378ec859a64b77752 | ca15c2c26be8af453edb062c6ca0bf00fd620fe3 | refs/heads/master | 2021-01-22T20:50:21.632597 | 2017-03-18T03:36:12 | 2017-03-18T03:36:12 | 85,369,066 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package p1;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBInfo
{
static Connection con=null;
static
{
//Drivers
try
{
Class.forName("com.mysql.jdbc.Driver");
}
catch (ClassNotFoundException e)
{
e.printStackTrace();
}
System.out.println("Driver loaded");
}
public static Connection getConnection()
{
String url="jdbc:mysql://localhost:3306/apnahome";
String username="root";
String password="rat";
try
{
con=DriverManager.getConnection(url,username,password);
}
catch (SQLException e)
{
e.printStackTrace();
}
return con;
}
public static void close()
{
try
{
con.close();
}
catch (SQLException e)
{
e.printStackTrace();
}
}
}
| [
"vkgupta0025@gmail.com"
] | vkgupta0025@gmail.com |
1f1a1da57a08b2584ebbaef08b1d12e99e927944 | 2de38654933350bf9c04afcb2ec264979865262e | /com.windhoverlabs.cfside/src/com/windhoverlabs/cfside/preferences/PreferenceConstants.java | baa9bd1aeb35bdd8446c30f2ea9ff0a0fd0b5418 | [] | no_license | Z-WHL/whlide | 70f04150685d5c4e5449afeda36121066bf48692 | 8165f5e18895590eeeb7a2e96bd089ac9a06e39f | refs/heads/master | 2020-07-17T22:31:42.588479 | 2019-10-07T18:44:33 | 2019-10-07T18:44:33 | 206,113,574 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.windhoverlabs.cfside.preferences;
public class PreferenceConstants {
public static final String P_PATH = "pathPreference";
public static final String P_BOOLEAN = "booleanPreference";
public static final String P_CHOICE = "choicePreference";
public static final String P_STRING = "stringPreference";
}
| [
"canzhong@windhoverlabs.com"
] | canzhong@windhoverlabs.com |
e9f468500807ffb4864aab9ec4b986c25a89defa | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /IntroClassJava/dataset/digits/313d572e1f050451c688b97510efa105685fa275a8442f9119ce9b3f85f46e234cdf03593568e19798aed6b79c66f45c97be937d09b6ff9544f0f59162538575/000/mutations/1449/digits_313d572e_000.java | 514d65dc025c8246e11dbfb8806e794438c2224e | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,742 | java | package introclassJava;
class IntObj {
public int value;
public IntObj () {
} public IntObj (int i) {
value = i;
}
}
class FloatObj {
public float value;
public FloatObj () {
} public FloatObj (float i) {
value = i;
}
}
class LongObj {
public long value;
public LongObj () {
} public LongObj (long i) {
value = i;
}
}
class DoubleObj {
public double value;
public DoubleObj () {
} public DoubleObj (double i) {
value = i;
}
}
class CharObj {
public char value;
public CharObj () {
} public CharObj (char i) {
value = i;
}
}
public class digits_313d572e_000 {
public java.util.Scanner scanner;
public String output = "";
public static void main (String[]args) throws Exception {
digits_313d572e_000 mainClass = new digits_313d572e_000 ();
String output;
if (args.length > 0) {
mainClass.scanner = new java.util.Scanner (args[0]);
} else {
mainClass.scanner = new java.util.Scanner (System.in);
}
mainClass.exec ();
System.out.println (mainClass.output);
}
public void exec () throws Exception {
IntObj given = new IntObj (), digit10 = new IntObj (), digit9 =
new IntObj (), digit8 = new IntObj (), digit7 = new IntObj (), digit6 =
new IntObj (), digit5 = new IntObj (), digit4 = new IntObj (), digit3 =
new IntObj (), digit2 = new IntObj (), digit1 = new IntObj ();
output += (String.format ("\nEnter an interger > "));
given.value = scanner.nextInt ();
if (given.value >= 1 && given.value < 10) {
digit10.value = given.value % 10;
output +=
(String.format
("\n%d\nThat's all, have a nice day!\n", digit10.value));
}
if (given.value >= 10 && given.value < 100) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
output +=
(String.format
("\n%d\n%d\nThat's all, have a nice day!\n", digit10.value,
digit9.value));
}
if (given.value >= 100 && given.value < 1000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
output +=
(String.format ("\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value));
}
if (given.value >= 1000 && given.value < 10000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
output +=
(String.format ("\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value,
digit7.value));
}
if (given.value >= 10000 && given.value < 100000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value));
}
if (given.value >= 100000 && given.value < 1000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value));
}
if (given.value >= 1000000 && given.value < 10000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit10.value = (given.value / 1000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value));
}
if (given.value >= 10000000 && given.value < 100000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value));
}
if (given.value >= 100000000 && given.value < 1000000000) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value));
}
if (given.value >= 1000000000 && given.value < 10000000000L) {
digit10.value = given.value % 10;
digit9.value = (given.value / 10) % 10;
digit8.value = (given.value / 100) % 10;
digit7.value = (given.value / 1000) % 10;
digit6.value = (given.value / 10000) % 10;
digit5.value = (given.value / 100000) % 10;
digit4.value = (given.value / 1000000) % 10;
digit3.value = (given.value / 10000000) % 10;
digit2.value = (given.value / 100000000) % 10;
digit1.value = (given.value / 1000000000) % 10;
output +=
(String.format
("\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\n%d\nThat's all, have a nice day!\n",
digit10.value, digit9.value, digit8.value, digit7.value,
digit6.value, digit5.value, digit4.value, digit3.value,
digit2.value, digit1.value));
}
if (true)
return;;
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
624dec56fedcfe7322793f6d4c9f23cc9eaeca82 | 33fbbf4a94dd8704b1e601a4046a3137c74d9c4c | /src/InterviewQuestions/java/arrays/OddAndEvenInArray.java | a772283653881767710cf8382bfd56233d39068e | [] | no_license | Deepika-at-git/MyProject | 333c6133a6b5e802acdad575ccaa91f3a6250184 | 7f6e76930436e161eb4a5b5a3c0ddca683bfd5f3 | refs/heads/master | 2023-08-22T11:14:21.665307 | 2021-10-26T16:07:31 | 2021-10-26T16:07:31 | 405,781,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 919 | java | package InterviewQuestions.java.arrays;
public class OddAndEvenInArray {
public static void main(String[] args) {
int[] arr = {12, 17, 70, 15, 22, 65, 21, 90};
separateOddAndEvenInArray(arr);
}
public static void separateOddAndEvenInArray(int[] arr) {
System.out.println("Array after separating odd and even numbers :");
//Arrays.sort(arr);
int left = 0;
int right = arr.length - 1;
while (left < right) {
while (arr[left] % 2 == 0 && left < right) {
left++;
}
while (arr[right] % 2 != 0 && left < right) {
right--;
}
int temp;
temp = arr[left];
arr[left] = arr[right];
arr[right] = temp;
}
for (int i = 0; i < arr.length; i++) {
System.out.print(arr[i] + " ");
}
}
}
| [
"dpka3012@gmail.com"
] | dpka3012@gmail.com |
d44ee291349835909ddcfb5d4b8f5f3bd0917575 | 5593c4003370b9e922136d38ec20ba458348a5d9 | /src/ServletPackage/AmiServlet.java | 39ae1d10a7a8f4e6020f0c559dcc78f50aab034d | [] | no_license | la-carte/WebCovid | f15ba0646d7d14497f4b86f06f4dfd2ebdaa8d8f | c556d8340c5f985f898bcf6a2a330184e13da71b | refs/heads/main | 2023-02-11T02:55:46.403829 | 2021-01-10T11:33:55 | 2021-01-10T11:33:55 | 315,270,289 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,828 | java | package ServletPackage;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import BeanPackage.UserBean;
import SQLPackage.SQLConnector;
/**
* Servlet implementation class AmiServlet
*/
@WebServlet("/AmiServlet")
public class AmiServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public AmiServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
ArrayList<String> friends = new ArrayList<>();
HttpSession session = request.getSession();
SQLConnector sc = new SQLConnector();
UserBean user = (UserBean) session.getAttribute("current_user");
friends = sc.getFriendRequest(user.getLogin()); // passer le login de l'ami
for(String friend : friends) {
user.getFriendsRequest().add(friend);
System.out.println(friend);
}
session.setAttribute("current_user",user);
request.setAttribute("current_user",user);
response.sendRedirect("/WebCovid/JSP_Pages/amis.jsp");
}
}
| [
"twix_vr@msn.com"
] | twix_vr@msn.com |
fa4d5a17cf54bfc1d6da93fb241a079beac171eb | 1ed6a958ab46c4ddf0794f4e2f01811bf00df36c | /Acme-Explorer/src/main/java/controllers/ranger/CurriculumRangerController.java | 50682b14369aa605249fe2b7fedaf87e7add183a | [] | no_license | MrMJ06/ProyectosDP | 3042d5a6af0eedabcecf97d8ef4df3592830a868 | 4c766fedcf7a2d82d9e3010239d81b0661483f9f | refs/heads/master | 2021-05-04T05:34:38.552264 | 2018-03-02T11:00:44 | 2018-03-02T11:00:44 | 120,339,531 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,950 | java |
package controllers.ranger;
import java.util.Collection;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import services.ActorService;
import services.CurriculumService;
import services.RangerService;
import controllers.AbstractController;
import domain.Actor;
import domain.Curriculum;
import domain.EducationRecord;
import domain.EndorserRecord;
import domain.MiscellaneousRecord;
import domain.PersonalRecord;
import domain.ProfessionalRecord;
import domain.Ranger;
@Controller
@RequestMapping("/curriculum")
public class CurriculumRangerController extends AbstractController {
@Autowired
CurriculumService curriculumService;
@Autowired
ActorService actorService;
@Autowired
RangerService rangerService;
// Constructors -----------------------------------------------------------
public CurriculumRangerController() {
super();
}
// Listing ---------------------------------------------------------------
@RequestMapping("/ranger/list")
public ModelAndView list() {
ModelAndView result;
final Collection<ProfessionalRecord> professional;
final PersonalRecord personal;
final Collection<EndorserRecord> endorser;
final Collection<MiscellaneousRecord> miscellaneous;
final Collection<EducationRecord> education;
final Curriculum curriculum;
boolean isProfile = true;
Actor actor;
curriculum = this.curriculumService.findCurriculumByRangerID();
actor = this.actorService.findActorByPrincipal();
if (curriculum != null)
isProfile = curriculum.getRanger().equals(actor);
result = new ModelAndView("curriculum/list");
result.addObject("curriculum", curriculum);
result.addObject("isProfile", isProfile);
if (curriculum != null) {
professional = curriculum.getProfessionalRecords();
endorser = curriculum.getEndorserRecords();
personal = curriculum.getPersonalRecord();
education = curriculum.getEducationRecords();
miscellaneous = curriculum.getMiscellaneousRecords();
result.addObject("professionalRecords", professional);
result.addObject("endorserRecords", endorser);
result.addObject("educationRecords", education);
result.addObject("personalRecord", personal);
result.addObject("miscellaneousRecords", miscellaneous);
}
result.addObject("requestUri", "curriculum/ranger/list.do");
return result;
}
@RequestMapping(value = "/show", method = RequestMethod.GET)
public ModelAndView listWithoutRangerLogin(@RequestParam final int rangerId, @RequestParam(defaultValue = "false") final Boolean isRanger) {
ModelAndView result;
final Collection<ProfessionalRecord> professional;
final PersonalRecord personal;
final Collection<EndorserRecord> endorser;
final Collection<MiscellaneousRecord> miscellaneous;
final Collection<EducationRecord> education;
Boolean curriculumRanger = false;
final boolean isProfile = false;
Curriculum curriculum;
//Actor actor;
curriculum = this.curriculumService.findCurriculumByRangerID(rangerId);
//actor = this.actorService.findActorByPrincipal();
try {
result = new ModelAndView("curriculum/list");
//if (curriculum != null) {
//isProfile = curriculum.getRanger().equals(actor);
result.addObject("isProfile", isProfile);
//}
final Ranger ranger = this.rangerService.findOne(rangerId);
if (ranger.getCurriculum() != null)
curriculum = this.curriculumService.findOne(ranger.getCurriculum().getId());
else
curriculum = null;
Ranger r1;
if (isRanger) {
r1 = (Ranger) this.actorService.findActorByPrincipal();
if (r1.equals(ranger))
curriculumRanger = true;
}
result.addObject("curriculumRanger", curriculumRanger);
if (curriculum != (null)) {
professional = curriculum.getProfessionalRecords();
endorser = curriculum.getEndorserRecords();
personal = curriculum.getPersonalRecord();
education = curriculum.getEducationRecords();
miscellaneous = curriculum.getMiscellaneousRecords();
result.addObject("curriculum", curriculum);
result.addObject("professionalRecords", professional);
result.addObject("endorserRecords", endorser);
result.addObject("educationRecords", education);
result.addObject("personalRecord", personal);
result.addObject("miscellaneousRecords", miscellaneous);
}
result.addObject("requestUri", "curriculum/show.do");
} catch (final Throwable oops) {
result = new ModelAndView("redirect:/misc/403");
}
return result;
}
// Creating -------------------------------------
@RequestMapping(value = "/ranger/create", method = RequestMethod.GET)
public ModelAndView create() {
ModelAndView result;
Curriculum curriculum;
curriculum = this.curriculumService.create();
result = this.createEditModelAndView(curriculum);
return result;
}
// Editing ---------------------------------------------
// Saving ----------------------------------------------
@RequestMapping(value = "/ranger/edit", method = RequestMethod.POST, params = "save")
public ModelAndView save(@Valid final Curriculum c, final BindingResult binding) {
ModelAndView result;
Ranger ranger;
if (binding.hasErrors())
result = this.createEditModelAndView(c, "curriculum.params.error");
else
try {
ranger = (Ranger) this.actorService.findActorByPrincipal();
result = new ModelAndView("redirect:list.do");
Assert.isTrue(c.getRanger().equals(ranger));
this.curriculumService.save(c);
} catch (final Throwable oops) {
result = this.createEditModelAndView(c, "curriculum.commit.error");
}
return result;
}
// Deleting --------------------------------------------
@RequestMapping(value = "/ranger/delete", method = RequestMethod.GET)
public ModelAndView delete(@RequestParam final int curriculumId) {
ModelAndView result;
Curriculum c;
c = this.curriculumService.findOne(curriculumId);
try {
this.curriculumService.delete(c);
result = new ModelAndView("redirect:list.do");
} catch (final Throwable oops) {
result = new ModelAndView("redirect:list.do");
}
return result;
}
// Ancillary methods -------------------------------------
protected ModelAndView createEditModelAndView(final Curriculum curriculum) {
ModelAndView result;
result = this.createEditModelAndView(curriculum, null);
return result;
}
protected ModelAndView createEditModelAndView(final Curriculum curriculum, final String messageCode) {
final ModelAndView result;
result = new ModelAndView("curriculum/edit");
result.addObject("curriculum", curriculum);
return result;
}
}
| [
"mrmj1996@gmail.com"
] | mrmj1996@gmail.com |
9f8ee6f3789b8e02463e20d91ee44b17bc78014d | cbdebd2dd6b7564318bbd8e1520f0ff57214716f | /clinic-data/src/main/java/com/example/springclinic/model/Person.java | 56e298dddf96d32910cc0b431617461d59a6c8d5 | [] | no_license | Lillian007-lab/spring-clinic | 2a8b81e5dae4af899a4cd3e4f60691a7193a78ec | 35e1261e348fb3e8a22f838a86e692898ed225ac | refs/heads/main | 2023-06-01T03:13:29.035638 | 2021-07-05T01:13:05 | 2021-07-05T01:13:05 | 371,251,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 556 | java | package com.example.springclinic.model;
import lombok.*;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@MappedSuperclass
public class Person extends BaseEntity{
public Person(Long id,
String firstName, String lastName) {
super(id);
this.firstName = firstName;
this.lastName = lastName;
}
@Column(name = "first_name")
private String firstName;
@Column(name = "last_name")
private String lastName;
}
| [
"zcarol.530@gmail.com"
] | zcarol.530@gmail.com |
88f46d5f85d76ae5a9e1c7a8900eb4edec2d818f | c392b6cfcd9872dc7a310e4b8bc6867ab40d962e | /HW07-Department/src/main/java/ru/otus/hw07/Container/ContainerImpl.java | 9900288fd9f943c6cfad9bae95ca4d5588783b80 | [
"MIT"
] | permissive | nesteg/jotus | 13b7a5cd61a5e5dca3374c925fde68c75a4f8428 | b743d303cb238d73c848d3254b2feee0f3937afe | refs/heads/master | 2021-06-12T20:03:15.250122 | 2020-08-08T03:49:29 | 2020-08-08T03:49:29 | 254,387,861 | 0 | 0 | MIT | 2020-08-08T03:49:30 | 2020-04-09T14:04:47 | Java | UTF-8 | Java | false | false | 1,708 | java | package ru.otus.hw07.Container;
import ru.otus.hw07.Bill.Bill;
import ru.otus.hw07.Cell.Cell;
import ru.otus.hw07.Cell.CellImpl;
import ru.otus.hw07.Operation.Operation;
import java.util.*;
import java.util.function.BiConsumer;
public class ContainerImpl implements Container{
private Map<Bill, Cell> container;
{
container = new TreeMap<>(Comparator.comparing(Bill::getNominal).reversed());
}
public ContainerImpl(Collection<Bill> c) {
for (var e:c){
container.putIfAbsent(e,new CellImpl(e));
}
}
@Override
public void add(Cell cell) {
container.putIfAbsent(cell.getBill(),cell);
}
@Override
public void update(Map<Bill,Integer> group, BiConsumer<Cell, Integer> op) {
group.forEach((bill,quantity) -> op.accept(container.get(bill),quantity));
}
@Override
public Optional<Map<Bill,Integer>> give(int amount) {
var remain = amount;
Map<Bill,Integer> history = new HashMap<>();
for (var cell : container.entrySet()){
var quantity = cell.getValue().give(remain);
if (quantity != 0) {
history.put(cell.getKey(),quantity);
}
remain -= cell.getValue().getNominal() * quantity;
}
if (remain > 0) {
return Optional.empty();
}
update(history,Operation.OPERATION_DEGREASE);
return Optional.of(history);
}
@Override
public int getBalance() {
return container.entrySet().stream()
.reduce(0, (m,e)->m + (e.getValue().getBalance()),Integer::sum);
}
@Override
public void clear() {
container.clear();
}
}
| [
"evgnest5@gmail.com"
] | evgnest5@gmail.com |
1a712b31260ce808aaa44f6df319c2f59a9118b4 | 28d1354e63724bb72300507c1b61695bd92fc27c | /app/src/main/java/com/test/xiaojian/simple_reader/model/remote/RemoteRepository.java | 302383faf1b2aea6e20e3267b51964b575d8e09d | [
"MIT"
] | permissive | yxiaojian33/NovelReader | c2a4dc81653e5a37f9ffea5062ec2a646bf07fa3 | e21ca1d6b84b2420efeaa676fe9a3e850644be22 | refs/heads/master | 2022-02-02T19:58:52.614710 | 2019-05-09T05:22:11 | 2019-05-09T05:22:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,549 | java | package com.test.xiaojian.simple_reader.model.remote;
import com.test.xiaojian.simple_reader.model.bean.BookChapterBean;
import com.test.xiaojian.simple_reader.model.bean.BookDetailBean;
import com.test.xiaojian.simple_reader.model.bean.ChapterInfoBean;
import com.test.xiaojian.simple_reader.model.bean.CollBookBean;
import com.test.xiaojian.simple_reader.model.bean.packages.BillboardPackage;
import com.test.xiaojian.simple_reader.model.bean.BillBookBean;
import com.test.xiaojian.simple_reader.model.bean.BookHelpsBean;
import com.test.xiaojian.simple_reader.model.bean.BookListBean;
import com.test.xiaojian.simple_reader.model.bean.BookListDetailBean;
import com.test.xiaojian.simple_reader.model.bean.BookReviewBean;
import com.test.xiaojian.simple_reader.model.bean.BookCommentBean;
import com.test.xiaojian.simple_reader.model.bean.packages.BookSortPackage;
import com.test.xiaojian.simple_reader.model.bean.packages.BookSubSortPackage;
import com.test.xiaojian.simple_reader.model.bean.BookTagBean;
import com.test.xiaojian.simple_reader.model.bean.CommentBean;
import com.test.xiaojian.simple_reader.model.bean.CommentDetailBean;
import com.test.xiaojian.simple_reader.model.bean.HelpsDetailBean;
import com.test.xiaojian.simple_reader.model.bean.HotCommentBean;
import com.test.xiaojian.simple_reader.model.bean.ReviewDetailBean;
import com.test.xiaojian.simple_reader.model.bean.SortBookBean;
import com.test.xiaojian.simple_reader.model.bean.packages.SearchBookPackage;
import java.util.ArrayList;
import java.util.List;
import io.reactivex.Single;
import retrofit2.Retrofit;
/**
* Created by xiaojian on 17-4-20.
*/
public class RemoteRepository {
private static final String TAG = "RemoteRepository";
private static RemoteRepository sInstance;
private Retrofit mRetrofit;
private BookApi mBookApi;
private RemoteRepository(){
mRetrofit = RemoteHelper.getInstance()
.getRetrofit();
mBookApi = mRetrofit.create(BookApi.class);
}
public static RemoteRepository getInstance(){
if (sInstance == null){
synchronized (RemoteHelper.class){
if (sInstance == null){
sInstance = new RemoteRepository();
}
}
}
return sInstance;
}
public Single<List<CollBookBean>> getRecommendBooks(String gender){
return mBookApi.getRecommendBookPackage(gender)
.map(bean -> bean.getBooks());
}
public Single<List<BookChapterBean>> getBookChapters(String bookId){
return mBookApi.getBookChapterPackage(bookId, "chapter")
.map(bean -> {
if (bean.getMixToc() == null){
return new ArrayList<BookChapterBean>(1);
}
else {
return bean.getMixToc().getChapters();
}
});
}
/**
* 注意这里用的是同步请求
* @param url
* @return
*/
public Single<ChapterInfoBean> getChapterInfo(String url){
return mBookApi.getChapterInfoPackage(url)
.map(bean -> bean.getChapter());
}
/***********************************************************************************/
public Single<List<BookCommentBean>> getBookComment(String block, String sort, int start, int limit, String distillate){
return mBookApi.getBookCommentList(block,"all",sort,"all",start+"",limit+"",distillate)
.map((listBean)-> listBean.getPosts());
}
public Single<List<BookHelpsBean>> getBookHelps(String sort, int start, int limit, String distillate){
return mBookApi.getBookHelpList("all",sort,start+"",limit+"",distillate)
.map((listBean)-> listBean.getHelps());
}
public Single<List<BookReviewBean>> getBookReviews(String sort, String bookType, int start, int limited, String distillate){
return mBookApi.getBookReviewList("all",sort,bookType,start+"",limited+"",distillate)
.map(listBean-> listBean.getReviews());
}
public Single<CommentDetailBean> getCommentDetail(String detailId){
return mBookApi.getCommentDetailPackage(detailId)
.map(bean -> bean.getPost());
}
public Single<ReviewDetailBean> getReviewDetail(String detailId){
return mBookApi.getReviewDetailPacakge(detailId)
.map(bean -> bean.getReview());
}
public Single<HelpsDetailBean> getHelpsDetail(String detailId){
return mBookApi.getHelpsDetailPackage(detailId)
.map(bean -> bean.getHelp());
}
public Single<List<CommentBean>> getBestComments(String detailId){
return mBookApi.getBestCommentPackage(detailId)
.map(bean -> bean.getComments());
}
/**
* 获取的是 综合讨论区的 评论
* @param detailId
* @param start
* @param limit
* @return
*/
public Single<List<CommentBean>> getDetailComments(String detailId, int start, int limit){
return mBookApi.getCommentPackage(detailId,start+"",limit+"")
.map(bean -> bean.getComments());
}
/**
* 获取的是 书评区和书荒区的 评论
* @param detailId
* @param start
* @param limit
* @return
*/
public Single<List<CommentBean>> getDetailBookComments(String detailId, int start, int limit){
return mBookApi.getBookCommentPackage(detailId,start+"",limit+"")
.map(bean -> bean.getComments());
}
/*****************************************************************************/
/**
* 获取书籍的分类
* @return
*/
public Single<BookSortPackage> getBookSortPackage(){
return mBookApi.getBookSortPackage();
}
/**
* 获取书籍的子分类
* @return
*/
public Single<BookSubSortPackage> getBookSubSortPackage(){
return mBookApi.getBookSubSortPackage();
}
/**
* 根据分类获取书籍列表
* @param gender
* @param type
* @param major
* @param minor
* @param start
* @param limit
* @return
*/
public Single<List<SortBookBean>> getSortBooks(String gender,String type,String major,String minor,int start,int limit){
return mBookApi.getSortBookPackage(gender, type, major, minor, start, limit)
.map(bean -> bean.getBooks());
}
/*******************************************************************************/
/**
* 排行榜的类型
* @return
*/
public Single<BillboardPackage> getBillboardPackage(){
return mBookApi.getBillboardPackage();
}
/**
* 排行榜的书籍
* @param billId
* @return
*/
public Single<List<BillBookBean>> getBillBooks(String billId){
return mBookApi.getBillBookPackage(billId)
.map(bean -> bean.getRanking().getBooks());
}
/***********************************书单*************************************/
/**
* 获取书单列表
* @param duration
* @param sort
* @param start
* @param limit
* @param tag
* @param gender
* @return
*/
public Single<List<BookListBean>> getBookLists(String duration, String sort,
int start, int limit,
String tag, String gender){
return mBookApi.getBookListPackage(duration, sort, start+"", limit+"", tag, gender)
.map(bean -> bean.getBookLists());
}
/**
* 获取书单的标签|类型
* @return
*/
public Single<List<BookTagBean>> getBookTags(){
return mBookApi.getBookTagPackage()
.map(bean -> bean.getData());
}
/**
* 获取书单的详情
* @param detailId
* @return
*/
public Single<BookListDetailBean> getBookListDetail(String detailId){
return mBookApi.getBookListDetailPackage(detailId)
.map(bean -> bean.getBookList());
}
/***************************************书籍详情**********************************************/
public Single<BookDetailBean> getBookDetail(String bookId){
return mBookApi.getBookDetail(bookId);
}
public Single<List<HotCommentBean>> getHotComments(String bookId){
return mBookApi.getHotCommnentPackage(bookId)
.map(bean -> bean.getReviews());
}
public Single<List<BookListBean>> getRecommendBookList(String bookId,int limit){
return mBookApi.getRecommendBookListPackage(bookId,limit+"")
.map(bean -> bean.getBooklists());
}
/********************************书籍搜索*********************************************/
/**
* 搜索热词
* @return
*/
public Single<List<String>> getHotWords(){
return mBookApi.getHotWordPackage()
.map(bean -> bean.getHotWords());
}
/**
* 搜索关键字
* @param query
* @return
*/
public Single<List<String>> getKeyWords(String query){
return mBookApi.getKeyWordPacakge(query)
.map(bean -> bean.getKeywords());
}
/**
* 查询书籍
* @param query:书名|作者名
* @return
*/
public Single<List<SearchBookPackage.BooksBean>> getSearchBooks(String query){
return mBookApi.getSearchBookPackage(query)
.map(bean -> bean.getBooks());
}
}
| [
"Xiaojianlei@users.noreply.github.com"
] | Xiaojianlei@users.noreply.github.com |
0786660a8887872fd1f4734a7dbd9ebbc82725ba | f11e34be143fbccb08bd5cabbcd1d8f99cddf08f | /HW_3/4/src/com/company/Board.java | 3844cad022430ed283cec0d8ccd114902d10e3b7 | [] | no_license | AlexeyLukynchik/Senla | 94dc2f9dab13f815b07cb6147e9f39fa1f554a5f | 9b26c0bebc60e30477318bc80e2fed05ec147a3f | refs/heads/master | 2021-08-10T12:03:02.906663 | 2017-11-12T14:33:15 | 2017-11-12T14:33:15 | 105,445,411 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 539 | java | package com.company;
import java.util.Arrays;
public class Board {
private APassenger[] passengers;
@Override
public String toString() {
return "Board{" +
"passengers=" + Arrays.toString(passengers) +
'}';
}
public Board(APassenger[] passengers) {
this.passengers = passengers;
}
public APassenger[] getPassengers() {
return passengers;
}
public void setPassengers(APassenger[] passengers) {
this.passengers = passengers;
}
}
| [
"aleksejlukynchik@gmail.com"
] | aleksejlukynchik@gmail.com |
adbe4311c65743af3573b433574b2768b6d8c15d | 0e21ac74ef54e0fb046a54398e751b78866685f1 | /src/api/java/thaumcraft/api/IScribeTools.java | b465d77c3cc1141ba5d974318076fd4f8eb6a3e4 | [
"MIT"
] | permissive | Kiwi233/RemoteIO | e1154eeaf8b979d47dda840b45eff7dcb1c79674 | b8076cf1481ed397eceefadea05eaa5d8e565e76 | refs/heads/master | 2022-09-26T21:01:17.594607 | 2020-05-24T10:26:26 | 2020-05-24T10:26:26 | 266,515,958 | 0 | 0 | MIT | 2020-05-24T10:16:32 | 2020-05-24T10:16:31 | null | UTF-8 | Java | false | false | 187 | java | package thaumcraft.api;
/**
*
* @author Azanor
*
* Interface used to identify scribing tool items used in research table
*
*/
public interface IScribeTools {
}
| [
"asyncronous16@gmail.com"
] | asyncronous16@gmail.com |
857267671f98d9b9c311f843e2008b49470cfbbf | 3b5d8e5ad1b069aa55e857b6ff98b43c6ce0bbb8 | /src/main/java/repository/ProvinceRepository.java | 78c18dd56ab2d7cf7b210cfdccc1218a0f813b01 | [] | no_license | voduyquocthai/m4-spring-repo-customer | bc7f42ed590b287a86864cc06ba074e2144b4a1e | a863eeae36033c4049ff1df4e4d12cf39319b701 | refs/heads/master | 2023-03-29T13:25:50.788503 | 2021-04-01T08:22:23 | 2021-04-01T08:22:23 | 353,602,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 207 | java | package repository;
import model.Province;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ProvinceRepository extends PagingAndSortingRepository<Province, Long> {
}
| [
"voduyquocthai@gmail.com"
] | voduyquocthai@gmail.com |
2a636e8f2e4e92d6bfaac5327a8cbba32363b10b | 1f45dafb232759e3028b7d524cf708dc2a31d1b3 | /gc program/gc/jini/com/sun/jini/norm/LoggedOperation.java | dde157a4f66a30ed7aa7e81e230106d8e23b8002 | [] | no_license | gcsr/btech-practice-codes | 06eacfeb6a7074b2244383a6110f77abdfc052b3 | f95a79f23484740d82eebe24763996beddd1ace7 | refs/heads/master | 2022-11-19T17:37:39.220405 | 2020-07-23T18:17:58 | 2020-07-23T18:17:58 | 263,967,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,773 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.sun.jini.norm;
import java.io.Serializable;
import java.util.Map;
import net.jini.id.Uuid;
/**
* Base class for the objects Norm logs as delta for each state
* changing operation.
*
* @author Sun Microsystems, Inc.
*/
abstract class LoggedOperation implements Serializable {
private static final long serialVersionUID = 2;
/**
* The <code>Uuid</code> of the set this operation was on
* @serial
*/
protected Uuid setID;
/**
* Simple constructor
* @param setID The <code>Uuid</code> for the set this operation is on
*/
protected LoggedOperation(Uuid setID) {
this.setID = setID;
}
/**
* Update state of the passed <code>Map</code> of
* <code>LeaseSet</code>s to reflect the state of server after
* this operation was performed.
* @throws StoreException if there is a problem applying the update
*/
abstract void apply(Map setTable) throws StoreException;
}
| [
"gc.sekhar002@gmail.com"
] | gc.sekhar002@gmail.com |
a0eb2631a4d9cd31017d3bd012e7fbe81f96e7fc | a1595e219b1971c90e697dfa167d3ffb9f512a82 | /src/main/java/com/ufa/mall/util/ExcelUtil.java | 01407fe5eff3ab71d15fc1d75d21107df280c602 | [] | no_license | xieyuanzheng/appinterface | 2f944f0ca786b64f2ae8c19f8d936ca6ffc4a5bc | 9380f726706c58e43cf7ae822ca4e065dae3d960 | refs/heads/master | 2020-03-26T08:14:19.415532 | 2018-08-14T08:43:15 | 2018-08-14T08:43:15 | 144,692,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,397 | java | package com.ufa.mall.util;
import com.ufa.mall.dao.TrackingDao;
import com.ufa.mall.entity.Tracking;
import com.ufa.mall.mapper.TrackingMapper;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
public class ExcelUtil {
//记录类的输出信息
private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class);
@Autowired
private TrackingDao trackingDao;
@Autowired
private TrackingMapper trackingMapper;
//获取Excel文档的路径
//public static String filePath = "E:\\files\\svn\\Tech Center\\01-文档\\04-测试文档\\05-质量管理\\UFA问题反馈跟进表.xlsx";
public List<Tracking> saveTracking(String filename) {
List<Tracking> list = new ArrayList<Tracking>();
//String filename = "F:\\UFA问题反馈跟进表1.xlsx";
Workbook xssfWorkbook = null;
//TrackingDao trackingDao = new TrackingDaoImpl();
try {
InputStream is = new FileInputStream(filename);
xssfWorkbook = new XSSFWorkbook(is);
// 获取每一个工作薄
for (int numSheet = 0; numSheet < xssfWorkbook.getNumberOfSheets(); numSheet++) {
XSSFSheet xssfSheet = (XSSFSheet) xssfWorkbook.getSheetAt(numSheet);
if (xssfSheet == null) {
continue;
}
// 获取当前工作薄的每一行
//for (int rowNum = 2; rowNum <= xssfSheet.getLastRowNum(); rowNum++) {
for (int rowNum = 2; rowNum <= xssfSheet.getLastRowNum(); rowNum++) {
XSSFRow xssfRow = xssfSheet.getRow(rowNum);
if (xssfRow != null) {
XSSFCell number = xssfRow.getCell(0);
//读取第一列数据
XSSFCell date = xssfRow.getCell(1);
//读取第二至十三列数据
XSSFCell feedbackman = xssfRow.getCell(2);
XSSFCell feedbackdept = xssfRow.getCell(3);
XSSFCell feedbacktype = xssfRow.getCell(4);
XSSFCell item = xssfRow.getCell(5);
XSSFCell module = xssfRow.getCell(6);
XSSFCell description = xssfRow.getCell(7);
XSSFCell reason = xssfRow.getCell(8);
XSSFCell followman = xssfRow.getCell(9);
XSSFCell followresult = xssfRow.getCell(10);
XSSFCell chandaono = xssfRow.getCell(11);
XSSFCell remark = xssfRow.getCell(12);
//读取第三列数据
//需要转换数据的话直接调用getValue获取字符串
//写入实体类
Tracking tracking = new Tracking();
if(number == null || getValue(number).isEmpty()){
log.info("number : 等于null或为空 ");
}else {
tracking.setNumber((int)Float.parseFloat(getValue(number)));
tracking.setDate(getValue(date));
tracking.setFeedbackman(getValue(feedbackman));
tracking.setFeedbackdept(getValue(feedbackdept));
tracking.setFeedbacktype(getValue(feedbacktype));
tracking.setItem(getValue(item));
tracking.setModule(getValue(module));
tracking.setDescription(getValue(description));
tracking.setReason(getValue(reason));
tracking.setFollowman(getValue(followman));
tracking.setFollowresult(getValue(followresult));
if(chandaono != null){
tracking.setChandaono(getValue(chandaono));
}
if(remark != null){
tracking.setRemark(getValue(remark));
}
log.info("tracking.getDescription() : " + tracking.getDescription() + rowNum);
list.add(tracking);
}
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return list;
}//end of main()
//转换数据格式
private static String getValue(XSSFCell xssfRow) {
if (xssfRow.getCellType() == xssfRow.CELL_TYPE_BOOLEAN) {
return String.valueOf(xssfRow.getBooleanCellValue());
} else if (xssfRow.getCellType() == xssfRow.CELL_TYPE_NUMERIC) {
return String.valueOf(xssfRow.getNumericCellValue());
} else {
return String.valueOf(xssfRow.getStringCellValue());
}
}
}
| [
"121546683@qq.com"
] | 121546683@qq.com |
825114cc487735ad545a423374060ee04fa407f8 | abe7713bad375c7adb223609ff20396970bdf4db | /src/main/java/org/mongodb/errorHandling/InsertWithPasswordChangeHandling.java | 418a717f82445afcdc656121e63da6e696e27c3b | [
"Apache-2.0"
] | permissive | sqa9999/MongoDB-ErrorHandling | d973885eeab7be2863448e1483758caf8a28d39a | d6e88b8aaf7dedd92bbfdbe2c3360358c7001284 | refs/heads/master | 2021-09-01T03:41:54.099209 | 2017-12-24T15:12:43 | 2017-12-24T15:12:43 | 111,558,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,666 | java | package org.mongodb.errorHandling;
import java.net.UnknownHostException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.bson.Document;
import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.MongoSecurityException;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
public class InsertWithPasswordChangeHandling {
@SuppressWarnings("static-access")
private static CommandLine initializeAndParseCommandLineOptions(
String[] args) {
Options options = new Options();
options.addOption(OptionBuilder.withArgName("connection uri").hasArgs()
.isRequired().withDescription("mongodb connection string uri")
.withLongOpt("uri").create("c"));
CommandLineParser parser = new GnuParser();
CommandLine line = null;
try {
line = parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
// printHelpAndExit(options);
} catch (Exception e) {
e.printStackTrace();
// printHelpAndExit(options);
}
return line;
}
public static void main(String[] args) throws UnknownHostException {
// CommandLine line = initializeAndParseCommandLineOptions(args);
// String uri = line.getOptionValue("c");
// System.out.println(uri);
// MongoDatabase db = null;
MongoClient client = new MongoClient(new MongoClientURI("mongodb://admin:admin@localhost:27017,localhost:27018,localhost:27019/?maxIdleTimeMS=1000"));
MongoDatabase db = client.getDatabase("test");
MongoCollection<Document> insertColl = db.getCollection("insertColl");
insertColl.drop();
Document obj = null;
for (int i = 0; i < 10000; i++) {
try {
obj = new Document();
obj.put("_id", i);
if(i%10==0)
System.out.println(obj);
insertColl.insertOne(obj);
} catch (MongoSecurityException e1){
//TODO Handle appropriately
System.out.println(e1.toString());
System.out.println(e1.getMessage());
e1.printStackTrace();
client = new MongoClient(new MongoClientURI("mongodb://admin:admin1@localhost:27017,localhost:27018,localhost:27019/?maxIdleTimeMS=1000"));
db = client.getDatabase("test");
insertColl = db.getCollection("insertColl");
insertColl.insertOne(obj);
}catch (Exception e1){
//TODO Handle appropriately
System.out.println(e1.toString());
System.out.println(e1.getMessage());
e1.printStackTrace();
}
}
client.close();
}
} | [
"sqa9999@gmail.com"
] | sqa9999@gmail.com |
6b9e57bc5484bbf412c981e2433cb716d8e59326 | 581a533a04299ea2b372d21803ed27b6317d2275 | /Github API Project/src/Extract.java | ecf6103cae6b6092d1778a89904847d9376dec99 | [] | no_license | SharlZY/CS3012-Software-Engineering | e0dca72842e9207802430305c083b9563435ee79 | c5cd7631c7842deafeef80c1b21bfac73e0e85de | refs/heads/master | 2020-03-29T06:34:14.497815 | 2018-11-18T17:12:13 | 2018-11-18T17:12:13 | 149,630,751 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,190 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import org.json.JSONException;
import org.json.JSONObject;
//Credits to https://stackoverflow.com/questions/4308554/simplest-way-to-read-json-from-a-url-in-java
public class Extract {
static String jsonString;
public static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject readJsonFromUrl(String url) throws IOException, JSONException {
InputStream is = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
jsonString = readAll(rd);
JSONObject json = new JSONObject(jsonString);
return json;
} finally {
is.close();
}
}
public static void main(String[] args) throws IOException, JSONException {
JSONObject json = readJsonFromUrl("https://api.github.com/users/phadej");
// System.out.println(json.toString());
}
}
| [
"bangs@tcd.ie"
] | bangs@tcd.ie |
1ab604c5df3121e72c5f7db3c49996172b3b45cd | 9d7f910dfd80f8b35efc38cf940f91df5863362c | /unziped/media2/player/src/androidTest/java/androidx/media2/player/SubtitleDataTest.java | d0a327d4d5729417213173a20a18070d3388e294 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | flyfire/AndroidXLearningDemo | 0e870d16c1536c16bc56ab18bec6b7712593e828 | e331d2708bbc567b54e81bb91c720e9a782a1af4 | refs/heads/master | 2022-12-01T18:58:46.123343 | 2020-08-14T10:08:17 | 2020-08-14T10:08:17 | 287,503,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | /*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.media2.player;
import static junit.framework.Assert.assertEquals;
import android.media.MediaFormat;
import androidx.media2.player.MediaPlayer.TrackInfo;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.SmallTest;
import org.junit.Test;
import org.junit.runner.RunWith;
/**
* Tests {@link SubtitleData}.
*/
@RunWith(AndroidJUnit4.class)
@SmallTest
public class SubtitleDataTest extends MediaTestBase {
@Test
public void testConstructor() {
byte[] testData = {4, 3, 2, 1};
final MediaFormat format = new MediaFormat();
final TrackInfo info = new TrackInfo(0, null, TrackInfo.MEDIA_TRACK_TYPE_UNKNOWN, format);
SubtitleData data = new SubtitleData(info, 123, 456, testData);
assertEquals(info, data.getTrackInfo());
assertEquals(123, data.getStartTimeUs());
assertEquals(456, data.getDurationUs());
assertEquals(testData, data.getData());
}
}
| [
"rh.hou.work@gmail.com"
] | rh.hou.work@gmail.com |
a480c85d0500ccad6b05a34a47e8972ceeefd034 | 5ce4515d6853357e2de661f6d9c7dd87f1debf73 | /my-gdx-java-client/html/src/com/mygdx/java/client/HtmlLauncher.java | 5226d3e8c56f528afa0087f62e021638fe4888ee | [
"Apache-2.0",
"BSD-2-Clause"
] | permissive | badthinking/libgdx-cookbook | 3f6cf9b4ad1d6a8e61ffc8d1bbd21586757001a1 | a45dfbaae8aa6e8577b6c7ca34bc9cc70dbedb84 | refs/heads/master | 2020-06-02T03:11:36.421508 | 2015-02-02T13:58:58 | 2015-02-02T13:58:58 | 29,731,886 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | package com.mygdx.java.client;
import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.backends.gwt.GwtApplication;
import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration;
import com.mygdx.java.MyGdxJava;
public class HtmlLauncher extends GwtApplication {
@Override
public GwtApplicationConfiguration getConfig () {
return new GwtApplicationConfiguration(1024, 800);
}
@Override
public ApplicationListener getApplicationListener () {
return new MyGdxJava();
}
} | [
"forsrc@gmail.com"
] | forsrc@gmail.com |
be7629d34ab9312b8ae697841071d7bbd2919f60 | b3fd2546327e1b3d798fd0f9c9deabf5152eb386 | /src/main/java/com/mycmv/server/service/impl/exam/PaperQuestionTypeServiceImpl.java | 7790a62aa31eb8b587c445d8ee68d44203d07839 | [] | no_license | oudi2012/cmv-server | 67ca1fec358f1e6fdde56c27ccd5327c7f2a1c99 | 2a330edf2b8f70f635ae5e284b0d37129cb70cb5 | refs/heads/master | 2023-01-02T17:12:33.860702 | 2020-10-21T07:03:01 | 2020-10-21T07:03:01 | 296,192,254 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 806 | java | package com.mycmv.server.service.impl.exam;
import com.mycmv.server.mapper.ExamInfoMapper;
import com.mycmv.server.mapper.exam.PaperQuestionTypeMapper;
import com.mycmv.server.model.exam.entry.PaperQuestionType;
import com.mycmv.server.service.exam.AbstractExamService;
import com.mycmv.server.service.exam.PaperQuestionTypeService;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
/***
* PageQuestionTypeService
* @author a
*/
@Service
public class PaperQuestionTypeServiceImpl extends AbstractExamService<PaperQuestionType> implements PaperQuestionTypeService {
@Resource
private PaperQuestionTypeMapper pageQuestionTypeMapper;
@Override
public ExamInfoMapper<PaperQuestionType> getExamInfoMapper() {
return pageQuestionTypeMapper;
}
}
| [
"wanghaikuo000@163.com"
] | wanghaikuo000@163.com |
62eb514dba348456171141117fb8707ba7c73011 | 7ee551a157f4bd5528f228971d8b6ce753b88521 | /jpo-ode-plugins/src/main/java/us/dot/its/jpo/ode/plugin/j2735/J2735MovementEventList.java | ed4da8fda84f135ed5193603b0d54b5b3d5bcab5 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | Trihydro/jpo-ode | 39e29e46c5aeddf9d8afed2579237fe3d630fbb5 | d265c51e52fad4edcd79258f88759dea653c867d | refs/heads/master | 2022-05-05T23:38:11.520302 | 2022-03-31T16:08:34 | 2022-03-31T16:08:34 | 188,295,405 | 1 | 0 | NOASSERTION | 2019-11-15T20:24:51 | 2019-05-23T19:37:31 | Java | UTF-8 | Java | false | false | 547 | java | package us.dot.its.jpo.ode.plugin.j2735;
import java.util.ArrayList;
import java.util.List;
import us.dot.its.jpo.ode.plugin.asn1.Asn1Object;
public class J2735MovementEventList extends Asn1Object {
private static final long serialVersionUID = 1L;
private List<J2735MovementEvent> movementEventList = new ArrayList<>();
public List<J2735MovementEvent> getMovementEventList() {
return movementEventList;
}
public void setMovementEventList(List<J2735MovementEvent> movementEventList) {
this.movementEventList = movementEventList;
}
}
| [
"dan.du@leidos.com"
] | dan.du@leidos.com |
f282ae267d5ace11d5d950c7e5518bad7188f20b | fa6804179140782afa8497b4f67ef206d60e601b | /likanglin/src/reverse/ReverseTest.java | bb768224adc84cc22d9631f861aadbe52b117101 | [] | no_license | yuhaibao324/leetcode | 22513f2cbdf23ed4d56c9a03914d1e5766cb23e8 | 055c9817efa8dbda5672dc7da4aa4246bc2443c0 | refs/heads/master | 2020-03-19T04:24:04.515168 | 2017-07-28T04:02:11 | 2017-07-28T04:02:11 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 275 | java | package reverse;
/**
* @author ALKL
* 又做了一回吃瓜群众
*/
public class ReverseTest {
public static void main(String[] args) {
int abs= 0;
Solution solution= new Solution();
abs =solution.reverse(abs);
System.out.println(abs);
}
}
| [
"821953655@qq.com"
] | 821953655@qq.com |
2d9c0759bb22043c3b6b47fb47ed362c4a3dceef | 8a6453cd49949798c11f57462d3f64a1fa2fc441 | /aws-java-sdk-xray/src/main/java/com/amazonaws/services/xray/model/transform/UpdateSamplingRuleRequestProtocolMarshaller.java | 40e3c16a7a4f081fe204a1f6fe3a66948c0356f0 | [
"Apache-2.0"
] | permissive | tedyu/aws-sdk-java | 138837a2be45ecb73c14c0d1b5b021e7470520e1 | c97c472fd66d7fc8982cb4cf3c4ae78de590cfe8 | refs/heads/master | 2020-04-14T14:17:28.985045 | 2019-01-02T21:46:53 | 2019-01-02T21:46:53 | 163,892,339 | 0 | 0 | Apache-2.0 | 2019-01-02T21:38:39 | 2019-01-02T21:38:39 | null | UTF-8 | Java | false | false | 2,673 | java | /*
* Copyright 2013-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.xray.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.Request;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.xray.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.protocol.*;
import com.amazonaws.protocol.Protocol;
import com.amazonaws.annotation.SdkInternalApi;
/**
* UpdateSamplingRuleRequest Marshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class UpdateSamplingRuleRequestProtocolMarshaller implements Marshaller<Request<UpdateSamplingRuleRequest>, UpdateSamplingRuleRequest> {
private static final OperationInfo SDK_OPERATION_BINDING = OperationInfo.builder().protocol(Protocol.REST_JSON).requestUri("/UpdateSamplingRule")
.httpMethodName(HttpMethodName.POST).hasExplicitPayloadMember(false).hasPayloadMembers(true).serviceName("AWSXRay").build();
private final com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory;
public UpdateSamplingRuleRequestProtocolMarshaller(com.amazonaws.protocol.json.SdkJsonProtocolFactory protocolFactory) {
this.protocolFactory = protocolFactory;
}
public Request<UpdateSamplingRuleRequest> marshall(UpdateSamplingRuleRequest updateSamplingRuleRequest) {
if (updateSamplingRuleRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
final ProtocolRequestMarshaller<UpdateSamplingRuleRequest> protocolMarshaller = protocolFactory.createProtocolMarshaller(SDK_OPERATION_BINDING,
updateSamplingRuleRequest);
protocolMarshaller.startMarshalling();
UpdateSamplingRuleRequestMarshaller.getInstance().marshall(updateSamplingRuleRequest, protocolMarshaller);
return protocolMarshaller.finishMarshalling();
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
cd43c4e970297b5557ef4e778eae57df777585ac | a620a17ea7de3a98303e1cf53f4e6072eb7b87d1 | /app/src/main/java/com/example/concretetest/model/pullRequests/PullRequestModel.java | 429634634f2c7b21502602fd977fe21dedb5fc3a | [] | no_license | liebersonsantos/ConcreteTest | d4942cb45a3674e7ab76b0435105172625fc9ac6 | 7860f0fec5cd591c8e1758cdc442375fc6fe7878 | refs/heads/master | 2020-06-30T02:54:50.553443 | 2019-08-05T17:28:07 | 2019-08-05T17:28:07 | 200,699,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | package com.example.concretetest.model.pullRequests;
import com.example.concretetest.contract.PullRequestContract;
import com.example.concretetest.model.service.ApiService;
import java.util.List;
import io.reactivex.Single;
public class PullRequestModel implements PullRequestContract.Model {
private PullRequestContract.Presenter presenter;
private PullRequestContract.View view;
public PullRequestModel(PullRequestContract.Presenter presenter, PullRequestContract.View view){
this.presenter = presenter;
this.view = view;
}
@Override
public Single<List<PullResquestResponse>> getPullRequest(String owner, String repositoryName) {
return ApiService.getInstancePull(view).getPullRequestByRepositoryName(owner, repositoryName);
}
}
| [
"lieberson.santos@zup.com.br"
] | lieberson.santos@zup.com.br |
096d26c659fc83c6e013c2e3ed584374b66de45c | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_3/src/b/d/f/b/Calc_1_3_13512.java | 22e615e2762617ec04c0917e71bec0af613f9fea | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package b.d.f.b;
public class Calc_1_3_13512 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
db9c1071f1be07de6a032a9d73db721107ca3efb | 975fbab8c29f859e7c685fdcd01ec85d81c2c11e | /plugin.idea/src/com/microsoft/alm/plugin/idea/tfvc/ui/workspace/WorkspaceModel.java | beabfd0835405fd38d6f62c110e4d54a457e3cfb | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jagadeesh1492/vso-intellij | 277b9d50395abc655ba92092cc5945eeb608d681 | 52909bb7b67fe7a16c447e921a641424111fd3d3 | refs/heads/master | 2021-05-04T01:02:38.874019 | 2016-10-14T21:03:16 | 2016-10-14T21:03:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,671 | java | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See License.txt in the project root.
package com.microsoft.alm.plugin.idea.tfvc.ui.workspace;
import com.intellij.notification.Notification;
import com.intellij.notification.NotificationListener;
import com.intellij.openapi.progress.PerformInBackgroundOption;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsNotifier;
import com.microsoft.alm.common.utils.ArgumentHelper;
import com.microsoft.alm.plugin.context.RepositoryContext;
import com.microsoft.alm.plugin.context.ServerContext;
import com.microsoft.alm.plugin.context.ServerContextManager;
import com.microsoft.alm.plugin.external.models.Workspace;
import com.microsoft.alm.plugin.external.utils.CommandUtils;
import com.microsoft.alm.plugin.external.utils.WorkspaceHelper;
import com.microsoft.alm.plugin.idea.common.resources.TfPluginBundle;
import com.microsoft.alm.plugin.idea.common.services.LocalizationServiceImpl;
import com.microsoft.alm.plugin.idea.common.ui.common.AbstractModel;
import com.microsoft.alm.plugin.idea.common.ui.common.ModelValidationInfo;
import com.microsoft.alm.plugin.idea.common.utils.IdeaHelper;
import com.microsoft.alm.plugin.idea.common.utils.VcsHelper;
import com.microsoft.alm.plugin.operations.OperationExecutor;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.swing.event.HyperlinkEvent;
import javax.ws.rs.NotAuthorizedException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class WorkspaceModel extends AbstractModel {
private final Logger logger = LoggerFactory.getLogger(WorkspaceModel.class);
public static final String PROP_NAME = "name";
public static final String PROP_COMPUTER = "computer";
public static final String PROP_OWNER = "owner";
public static final String PROP_COMMENT = "comment";
public static final String PROP_SERVER = "server";
public static final String PROP_MAPPINGS = "mappings";
public static final String PROP_LOADING = "loading";
private boolean loading;
private String name;
private String computer;
private String owner;
private String comment;
private String server;
private List<Workspace.Mapping> mappings;
private Workspace oldWorkspace;
private ServerContext currentServerContext;
public WorkspaceModel() {
}
public boolean isLoading() {
return loading;
}
private void setLoading(final boolean loading) {
this.loading = loading;
setChangedAndNotify(PROP_LOADING);
}
public String getName() {
return name;
}
public void setName(final String name) {
if (!StringUtils.equals(this.name, name)) {
this.name = name;
super.setChangedAndNotify(PROP_NAME);
}
}
public String getComputer() {
return computer;
}
public void setComputer(final String computer) {
if (!StringUtils.equals(this.computer, computer)) {
this.computer = computer;
super.setChangedAndNotify(PROP_COMPUTER);
}
}
public String getOwner() {
return owner;
}
public void setOwner(final String owner) {
if (!StringUtils.equals(this.owner, owner)) {
this.owner = owner;
super.setChangedAndNotify(PROP_OWNER);
}
}
public String getComment() {
return comment;
}
public void setComment(final String comment) {
if (!StringUtils.equals(this.comment, comment)) {
this.comment = comment;
super.setChangedAndNotify(PROP_COMMENT);
}
}
public String getServer() {
return server;
}
public void setServer(final String server) {
if (!StringUtils.equals(this.server, server)) {
this.server = server;
super.setChangedAndNotify(PROP_SERVER);
}
}
public List<Workspace.Mapping> getMappings() {
if (mappings == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(mappings);
}
public void setMappings(@NotNull final List<Workspace.Mapping> mappings) {
if (WorkspaceHelper.areMappingsDifferent(this.mappings, mappings)) {
this.mappings = mappings;
super.setChangedAndNotify(PROP_MAPPINGS);
}
}
public ModelValidationInfo validate() {
if (StringUtils.isEmpty(getName())) {
return ModelValidationInfo.createWithResource(PROP_NAME,
TfPluginBundle.KEY_WORKSPACE_DIALOG_ERRORS_NAME_EMPTY);
}
if (getMappings().size() == 0) {
return ModelValidationInfo.createWithResource(PROP_MAPPINGS,
TfPluginBundle.KEY_WORKSPACE_DIALOG_ERRORS_MAPPINGS_EMPTY);
}
return ModelValidationInfo.NO_ERRORS;
}
public void loadWorkspace(final Project project) {
logger.info("loadWorkspace starting");
setLoading(true);
// Load
OperationExecutor.getInstance().submitOperationTask(new Runnable() {
@Override
public void run() {
try {
logger.info("loadWorkspace: getting repository context");
final RepositoryContext repositoryContext = VcsHelper.getRepositoryContext(project);
if (repositoryContext == null) {
logger.warn("loadWorkspace: Could not determine repositoryContext for project");
throw new RuntimeException(TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_ERRORS_CONTEXT_FAILED));
}
logger.info("loadWorkspace: getting server context");
currentServerContext = ServerContextManager.getInstance().createContextFromTfvcServerUrl(repositoryContext.getUrl(), repositoryContext.getTeamProjectName(), true);
if (currentServerContext == null) {
logger.warn("loadWorkspace: Could not get the context for the repository. User may have canceled.");
throw new NotAuthorizedException(TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_ERRORS_AUTH_FAILED, repositoryContext.getUrl()));
}
logger.info("loadWorkspace: getting workspace");
// It would be a bit more efficient here to pass the workspace name into the getWorkspace command.
// However, when you change the name of the workspace that causes errors. So for now, we are not optimal.
loadWorkspaceInternal(CommandUtils.getWorkspace(currentServerContext, project));
} finally {
loadWorkspaceComplete();
}
}
});
}
public void loadWorkspace(final RepositoryContext repositoryContext, final String workspaceName) {
logger.info("loadWorkspace starting");
ArgumentHelper.checkNotNull(repositoryContext, "repositoryContext");
ArgumentHelper.checkNotEmptyString(workspaceName);
setLoading(true);
// Load
OperationExecutor.getInstance().submitOperationTask(new Runnable() {
@Override
public void run() {
try {
logger.info("loadWorkspace: getting server context");
currentServerContext = ServerContextManager.getInstance().createContextFromTfvcServerUrl(repositoryContext.getUrl(), repositoryContext.getTeamProjectName(), true);
if (currentServerContext == null) {
logger.warn("loadWorkspace: Could not get the context for the repository. User may have canceled.");
throw new NotAuthorizedException(TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_ERRORS_AUTH_FAILED, repositoryContext.getUrl()));
}
logger.info("loadWorkspace: getting workspace by name");
loadWorkspaceInternal(CommandUtils.getWorkspace(currentServerContext, workspaceName));
} finally {
// Make sure to fire events only on the UI thread
loadWorkspaceComplete();
}
}
});
}
private void loadWorkspaceInternal(final Workspace workspace) {
oldWorkspace = workspace;
if (oldWorkspace != null) {
logger.info("loadWorkspace: got workspace, setting fields");
server = oldWorkspace.getServer();
owner = oldWorkspace.getOwner();
computer = oldWorkspace.getComputer();
name = oldWorkspace.getName();
comment = oldWorkspace.getComment();
mappings = new ArrayList<Workspace.Mapping>(oldWorkspace.getMappings());
} else {
// This shouldn't happen, so we will log this case, but not throw
logger.warn("loadWorkspace: workspace was returned as null");
}
}
private void loadWorkspaceComplete() {
// Make sure to fire events only on the UI thread
IdeaHelper.runOnUIThread(new Runnable() {
@Override
public void run() {
// Update all fields
setChangedAndNotify(null);
// Set loading to false
setLoading(false);
logger.info("loadWorkspace: done loading");
}
});
}
public void saveWorkspace(final Project project, final String workspaceRootPath, final boolean syncFiles, final Runnable onSuccess) {
final ServerContext serverContext = currentServerContext;
final Workspace oldWorkspace = this.oldWorkspace;
final Workspace newWorkspace = new Workspace(server, name, computer, owner, comment, mappings);
// Using IntelliJ's background framework here so the user can choose to wait or continue working
final Task.Backgroundable backgroundTask = new Task.Backgroundable(project,
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_PROGRESS_TITLE),
true, PerformInBackgroundOption.DEAF) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
try {
IdeaHelper.setProgress(indicator, 0.10,
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_SAVE_PROGRESS_UPDATING));
// Update the workspace mappings and other properties
CommandUtils.updateWorkspace(serverContext, oldWorkspace, newWorkspace);
if (syncFiles) {
IdeaHelper.setProgress(indicator, 0.30,
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_SAVE_PROGRESS_SYNCING));
CommandUtils.syncWorkspace(serverContext, workspaceRootPath);
}
IdeaHelper.setProgress(indicator, 1.00,
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_SAVE_PROGRESS_DONE), true);
if (onSuccess != null) {
// Trigger the onSuccess callback on the UI thread (it is up to the success handler to notify the user)
IdeaHelper.runOnUIThread(onSuccess);
} else {
// Notify the user of success and provide a link to sync the workspace
// (It doesn't make sense to tell the user we are done here if there is another thread still doing work)
VcsNotifier.getInstance(project).notifyImportantInfo(
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_SUCCESS_TITLE),
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_SUCCESS_MESSAGE),
new NotificationListener() {
@Override
public void hyperlinkUpdate(@NotNull final Notification n, @NotNull final HyperlinkEvent e) {
syncWorkspaceAsync(serverContext, project, workspaceRootPath);
}
});
}
} catch (final Throwable t) {
//TODO on failure we could provide a link that reopened the dialog with the values they tried to save
VcsNotifier.getInstance(project).notifyError(
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_FAILURE_TITLE),
LocalizationServiceImpl.getInstance().getExceptionMessage(t));
}
}
};
backgroundTask.queue();
}
public void syncWorkspaceAsync(final ServerContext context, final Project project, final String workspaceRootPath) {
final Task.Backgroundable backgroundTask = new Task.Backgroundable(project,
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_PROGRESS_TITLE),
true, PerformInBackgroundOption.DEAF) {
@Override
public void run(@NotNull final ProgressIndicator indicator) {
try {
IdeaHelper.setProgress(indicator, 0.30,
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_SAVE_PROGRESS_SYNCING));
// Sync all files recursively
CommandUtils.syncWorkspace(context, workspaceRootPath);
// Notify the user of a successful sync
VcsNotifier.getInstance(project).notifySuccess(
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_SUCCESS_TITLE),
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_SUCCESS_SYNC_MESSAGE));
} catch (final Throwable t) {
VcsNotifier.getInstance(project).notifyError(
TfPluginBundle.message(TfPluginBundle.KEY_WORKSPACE_DIALOG_NOTIFY_FAILURE_TITLE),
LocalizationServiceImpl.getInstance().getExceptionMessage(t));
}
}
};
backgroundTask.queue();
}
} | [
"jpricket@microsoft.com"
] | jpricket@microsoft.com |
388d4e57a54ebd54623d02da63d4fea2383ac9e5 | 0f379dd1f2d53e19b7bfae4ab9ffb6844bb59a20 | /Problem272.java | 266f8f42b37254dd737827d9c1eec9c79d8a9f4f | [] | no_license | jdh104/Project-Euler-Solutions | 34f59e8c6aad8aecc311ed259d1e0cacc1ac6588 | d5ff1090c12080866e053d1f92f4f24b1706c99c | refs/heads/master | 2021-01-10T09:03:09.698910 | 2019-05-22T03:49:29 | 2019-05-22T03:49:29 | 50,816,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25 | java | public class Problem272{
| [
"jdh104@latech.edu"
] | jdh104@latech.edu |
fac1a708e2b661a87c9f7d544cf26b28e85a1f24 | 34810fc1839db6a5cf393c3ef7b980ca7dc9449c | /lab5/FormatException.java | c3639b55e5d0d15f8f9f32b57045977d2f5e8b46 | [] | no_license | prznoc/Obiektowe | fe04ec77991315c5c49b8e38f45df2d0bf30a18d | 5b4e3b8ebfc7728389ce8fa53e25268143a84d89 | refs/heads/master | 2020-03-31T23:09:59.775303 | 2019-01-08T22:17:05 | 2019-01-08T22:17:05 | 152,644,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 185 | java | package lab5;
public class FormatException extends Exception{
FormatException(String text, int line, String in){
super(text + " in line "+ line+ "\n" + in);
}
}
| [
"przemeknok@interia.pl"
] | przemeknok@interia.pl |
0185871a4b13e81fc752135ad812e1d5c304b928 | 9c3f61b8817f067afcdd61fea72f9b8130bbfce2 | /04-elasticsearch/src/main/java/com/sandbox/elasticsearch/api/UserController.java | e2fe03bd02342248f9cbf00fa5674cd164be2873 | [] | no_license | fatihsert/spring-dev | 60831da608e5bdffc839b3707595bc2fc2ddf32a | 00eec6571bdf649093c935aa9b1926862962084c | refs/heads/master | 2022-04-22T20:01:59.733107 | 2020-04-10T21:57:14 | 2020-04-10T21:57:14 | 254,743,135 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,491 | java | package com.sandbox.elasticsearch.api;
import com.sandbox.elasticsearch.entity.User;
import com.sandbox.elasticsearch.repository.IUserRepository;
import lombok.RequiredArgsConstructor;
import org.joda.time.DateTime;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.List;
@RestController
@RequestMapping("/Users")
@RequiredArgsConstructor
public class UserController {
private final IUserRepository userRepository;
@PostConstruct
public void Init()
{
User user = new User();
user.setName("rıza");
user.setLastName("özdemir");
user.setAddress("yozgat");
user.setBirthdate(DateTime.now().toDate());
userRepository.save(user);
}
@GetMapping("/{search}")
public ResponseEntity<List<User>> Users(@PathVariable String search) {
List<User> result=userRepository.findByNameOrLastName(search,search);
/*List<User> users = new ArrayList<User>();
Iterable<User> userIterable = userRepository.findAll();
userIterable.forEach(user -> users.add(user));
return ResponseEntity.ok(users);
*/
return ResponseEntity.ok(result);
}
}
| [
"fatihsert@outlook.com"
] | fatihsert@outlook.com |
d98d2e5e8e7a20e89ee74e3694247dcf53163724 | c734ed4df0d2dab1594592b7e851ab4ff045f3a5 | /SDMEntities/src/com/lynxspa/sdm/entities/events/providers/CAInfoEventProvider.java | 018da81750bd89cc0e89b5a651cda19572bdd8bd | [] | no_license | Jeff-Lewis/SDMEntities | 0c09d7d5b64288c0f5d5140b723f23093a2a792a | 95b5ee933a0f4cb6937a0b1c4f9f30dabaed0e26 | refs/heads/master | 2020-12-31T07:19:24.924288 | 2015-04-06T14:48:07 | 2015-04-06T14:48:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | package com.lynxspa.sdm.entities.events.providers;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
@Entity
@DiscriminatorValue("external.info")
public class CAInfoEventProvider extends CAExternalEventProvider{
private static final long serialVersionUID = 4567033317511668061L;
protected int weight=3;
public CAInfoEventProvider(){
this(null,null,null);
}
public CAInfoEventProvider(String _user,String _id){
this(_user,_id,null);
}
public CAInfoEventProvider(String _user,String _id,String _name){
super(_user,_id,_name);
}
}
| [
"albertoolivan@gmail.com"
] | albertoolivan@gmail.com |
8d3bbc42e025a3b2922045fa5a0962206f2a1bd2 | c1935c2c52716bf388d2377609d1b71130176311 | /MSocketEverything/msocketSource/msocket1/src/edu/umass/cs/gnsclient/console/GnsCli.java | cb63f757e4f97271af23d7dba40d62d81e49c441 | [
"Apache-2.0"
] | permissive | cyjing/mengThesis | a40b95edd8c12cef62a06df5c53934215a11b2d2 | 7afe312c0866da6cfe99183e22bfda647002c380 | refs/heads/master | 2021-01-17T18:23:48.194128 | 2016-06-02T09:16:43 | 2016-06-02T09:16:43 | 60,248,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,445 | java | /*
*
* Copyright (c) 2015 University of Massachusetts
*
* Licensed under the Apache License, Version 2.0 (the "License"); you
* may not use this file except in compliance with the License. You
* may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*
* Initial developer(s): Westy, Emmanuel Cecchet
*
*/
package edu.umass.cs.gnsclient.console;
import edu.umass.cs.gnsclient.client.GNSClient;
import edu.umass.cs.gnsclient.client.util.KeyPairUtils;
import java.io.IOException;
import java.io.PrintWriter;
import jline.ConsoleReader;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.GnuParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
/**
* This class defines a GnsCli
*
* @author <a href="mailto:cecchet@cs.umass.edu">Emmanuel Cecchet</a>
* @version 1.0
*/
public class GnsCli {
/**
* Starts the GNS command line interface (CLI) console
*
* @param args optional argument is -silent for no console output
* @throws Exception
*/
public static void main(String[] args) throws Exception {
try {
CommandLine parser = initializeOptions(args);
if (parser.hasOption("help")) {
printUsage();
//System.out.println("-host and -port are required!");
System.exit(1);
}
boolean silent = parser.hasOption("silent");
boolean noDefaults = parser.hasOption("noDefaults");
ConsoleReader consoleReader = new ConsoleReader(System.in,
new PrintWriter(System.out, true));
ConsoleModule module = new ConsoleModule(consoleReader);
if (noDefaults) {
module.setUseGnsDefaults(false);
KeyPairUtils.removeDefaultGns();
}
module.setSilent(silent);
if (!silent) {
module.printString("GNS Client Version: " + GNSClient.readBuildVersion() + "\n");
}
module.handlePrompt();
System.exit(0);
} catch (IOException e) {
e.printStackTrace();
System.exit(-1);
}
}
// command line arguments
// COMMAND LINE STUFF
private static HelpFormatter formatter = new HelpFormatter();
private static Options commandLineOptions;
private static CommandLine initializeOptions(String[] args) throws ParseException {
Option help = new Option("help", "Prints Usage");
Option silent = new Option("silent", "Disables output");
Option noDefaults = new Option("noDefaults", "Don't use server and guid defaults");
commandLineOptions = new Options();
commandLineOptions.addOption(help);
commandLineOptions.addOption(silent);
commandLineOptions.addOption(noDefaults);
CommandLineParser parser = new GnuParser();
return parser.parse(commandLineOptions, args);
}
private static void printUsage() {
formatter.printHelp("java -jar <JAR> <options>", commandLineOptions);
}
}
| [
"cyjing@secant.csail.mit.edu"
] | cyjing@secant.csail.mit.edu |
e7662aa938f1b4da95eac83d12ea0114359699b3 | 5c2192c98b8f3d21dd03200a8ee26b71cc354c8f | /src/test/java/by/home/eventOrganizer/controller/StaffControllerTest.java | d6b6219369a02577d42a73309a646b4f756f64e5 | [] | no_license | yarovoy-it/event-organizer | c222a406548a156e3f5d989042ac879fcaae77d3 | 12bdfbe1c1e907a594318bde62c0717be0d81a95 | refs/heads/master | 2022-12-23T13:57:41.768652 | 2020-01-19T16:43:51 | 2020-01-19T16:43:51 | 223,160,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,865 | java | package by.home.eventOrganizer.controller;
import by.home.eventOrganizer.configuration.TestWebConfiguration;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.WebApplicationContext;
import java.nio.charset.Charset;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
/**
* The type Staff controller test.
*/
@ExtendWith(SpringExtension.class)
@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {TestWebConfiguration.class})
@WebAppConfiguration
@Transactional
public class StaffControllerTest {
/**
* The constant APPLICATION_JSON_UTF8.
*/
public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
@Autowired
private WebApplicationContext webApplicationContext;
private MockMvc mockMvc;
/**
* Sets .
*/
@BeforeEach
public void setup() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).build();
}
/**
* Test save duplicate staff.
*
* @throws Exception the exception
*/
@Test
public void testSaveDuplicateStaff() throws Exception {
mockMvc.perform(post("/staff").contentType(APPLICATION_JSON_UTF8).content("{\n" +
" \"id\": 24,\n" +
" \"name\": \"testStaff\",\n" +
" \"surname\": \"testStaff\",\n" +
" \"phoneNumber\": 375297272387,\n" +
" \"address\": {\n" +
" \"id\": 5,\n" +
" \"city\": \"GRODNO\",\n" +
" \"street\": \"Pushkina\",\n" +
" \"houseNumber\": 34,\n" +
" \"apartment\": 28\n" +
" },\n" +
" \"department\": \"PLANNER\",\n" +
" \"salary\": 40.5\n" +
" }"))
.andDo(print())
.andExpect(status().is5xxServerError())
.andExpect(jsonPath("$.message").isEmpty())
.andReturn();
}
/**
* Test save address.
*
* @throws Exception the exception
*/
@Test
public void testSaveAddress() throws Exception {
mockMvc.perform(post("/staff").contentType(APPLICATION_JSON_UTF8).content("{\n" +
" \"id\": 24,\n" +
" \"name\": \"testStaff\",\n" +
" \"surname\": \"testStaff\",\n" +
" \"phoneNumber\": 3752922223,\n" +
" \"address\": {\n" +
" \"id\": 135,\n" +
" \"city\": \"GRODNO\",\n" +
" \"street\": \"TestStreet\",\n" +
" \"houseNumber\": 134,\n" +
" \"apartment\": 328\n" +
" },\n" +
" \"department\": \"PLANNER\",\n" +
" \"salary\": 40.5\n" +
" }"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value("testStaff"))
.andExpect(jsonPath("$.surname").value("testStaff"))
.andExpect(jsonPath("$.phoneNumber").value("3752922223"))
.andExpect(jsonPath("$.address.city").value("GRODNO"))
.andExpect(jsonPath("$.address.street").value("TestStreet"))
.andExpect(jsonPath("$.department").value("PLANNER"))
.andExpect(jsonPath("$.salary").value("40.5"))
.andReturn();
}
/**
* Test save null address.
*
* @throws Exception the exception
*/
@Test
public void testSaveNullAddress() throws Exception {
mockMvc.perform(post("/staff").contentType(APPLICATION_JSON_UTF8).content("{\n" +
" \"id\": 101,\n" +
" \"name\": \"testStaff\",\n" +
" \"surname\": \"testStaff\",\n" +
" \"phoneNumber\": 3752922222,\n" +
" \"department\": \"WAITER\",\n" +
" \"salary\": 99.9\n" +
" }"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.name").value("testStaff"))
.andExpect(jsonPath("$.surname").value("testStaff"))
.andExpect(jsonPath("$.phoneNumber").value("3752922222"))
.andExpect(jsonPath("$.department").value("WAITER"))
.andExpect(jsonPath("$.salary").value("99.9"))
.andReturn();
}
/**
* Test get all null address.
*
* @throws Exception the exception
*/
@Test
public void testGetAllNullAddress() throws Exception {
mockMvc.perform(get("/staff"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$[1].name").value("Dasha"))
.andExpect(jsonPath("$[1].surname").value("Mudilova"))
.andExpect(jsonPath("$[1].phoneNumber").value("375297452387"))
.andReturn();
}
/**
* Test get all.
*
* @throws Exception the exception
*/
@Test
public void testGetAll() throws Exception {
mockMvc.perform(get("/staff"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].name").value("Vasia"))
.andExpect(jsonPath("$[0].surname").value("Vasichkin"))
.andExpect(jsonPath("$[0].address.id").value("2"))
.andExpect(jsonPath("$[0].address.city").value("GRODNO"))
.andExpect(jsonPath("$[0].address.street").value("Derzinskogo"))
.andExpect(jsonPath("$[0].address.houseNumber").value("56"))
.andExpect(jsonPath("$[0].address.apartment").value("16"))
.andExpect(jsonPath("$[0].phoneNumber").value("375297642865"))
.andReturn();
}
/**
* Test get by department.
*
* @throws Exception the exception
*/
@Test
public void testGetByDepartment() throws Exception {
mockMvc.perform(get("/staff/dep/waiter"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$[0].name").value("Dasha"))
.andExpect(jsonPath("$[0].surname").value("Mudilova"))
.andExpect(jsonPath("$[0].phoneNumber").value("375297452387"))
.andExpect(jsonPath("$[0].department").value("WAITER"))
.andReturn();
}
}
| [
"yarovoy1000@gmail.com"
] | yarovoy1000@gmail.com |
4dd053677721d6531d51ef218a81e4b760c3a464 | 8ba438bf4a29bd705b4bd3b10dab5b3beef4eff7 | /fluent-jdbc/src/main/java/org/codejargon/fluentjdbc/api/query/UpdateResultGenKeys.java | d84e708d37f1f93fd90545a320e389027a498c66 | [
"Apache-2.0"
] | permissive | MichaelOwenDyer/fluent-jdbc | 217618ebe7330ee9d4af8a1718db8d4278788c19 | 8a665b4fb95575e8edd4b28ffed51e078cb4789b | refs/heads/master | 2023-06-07T15:31:06.358152 | 2021-03-08T19:49:10 | 2021-03-08T19:49:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | package org.codejargon.fluentjdbc.api.query;
import java.util.List;
import java.util.Optional;
/**
* Result of an update / insert including generated keys
* @param <T> Type of generated key(s) for a single row inserted
*/
public interface UpdateResultGenKeys<T> extends UpdateResult {
/**
* @return generated key(s) for each row inserted by the statement
*/
List<T> generatedKeys();
Optional<T> firstKey();
}
| [
"zsolt.herpai@gmail.com"
] | zsolt.herpai@gmail.com |
6d32fa328f8e833df15639cfbc662c45431588a8 | 1af49694004c6fbc31deada5618dae37255ce978 | /weblayer/public/java/org/chromium/weblayer/ImageDecoderService.java | cdd85796c69e8569c1d863f47dc062ec335e5309 | [
"BSD-3-Clause"
] | permissive | sadrulhc/chromium | 59682b173a00269ed036eee5ebfa317ba3a770cc | a4b950c23db47a0fdd63549cccf9ac8acd8e2c41 | refs/heads/master | 2023-02-02T07:59:20.295144 | 2020-12-01T21:32:32 | 2020-12-01T21:32:32 | 317,678,056 | 3 | 0 | BSD-3-Clause | 2020-12-01T21:56:26 | 2020-12-01T21:56:25 | null | UTF-8 | Java | false | false | 1,064 | java | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.weblayer;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import org.chromium.weblayer_private.interfaces.APICallException;
import org.chromium.weblayer_private.interfaces.ObjectWrapper;
/**
* A service used internally by WebLayer for decoding images on the local device.
* @since 87
*/
public class ImageDecoderService extends Service {
private IBinder mImageDecoder;
@Override
public void onCreate() {
try {
mImageDecoder =
WebLayer.getIWebLayer(this).initializeImageDecoder(ObjectWrapper.wrap(this),
ObjectWrapper.wrap(WebLayer.getOrCreateRemoteContext(this)));
} catch (Exception e) {
throw new APICallException(e);
}
}
@Override
public IBinder onBind(Intent intent) {
return mImageDecoder;
}
}
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
378c89d9b2cf605c5ab128408e9671f219497e5f | 78da5c34df2d9f98592fffca68752c1104905e39 | /ci-webapp/src/main/java/AddProductServlet.java | 4542895b07a9aa3a9d80a32a03bef120180c6f05 | [] | no_license | architRaj2159/ProjectGladiator | 8444bc948e3442a5b62657732fbb8201cc676ec1 | 415cbf29323edfe5dc0e52f83041daa31182744d | refs/heads/master | 2022-12-16T17:35:20.282270 | 2020-08-27T20:58:47 | 2020-08-27T20:58:47 | 289,845,618 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 822 | java |
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.lti.dao.ProductDao;
import com.lti.entity.Product;
public class AddProductServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Product p = new Product();
p.setId(Integer.parseInt(request.getParameter("id")));
p.setName(request.getParameter("name"));
p.setPrice(Double.parseDouble(request.getParameter("price")));
ProductDao dao = new ProductDao();
dao.insert(p);
response.getWriter().write("Product Added Successfully. <a href='addProduct.jsp'>Click Here</a> to add more Products");
}
}
| [
"aryany996699@gmail.com"
] | aryany996699@gmail.com |
99971fea40094f0f4ba0174a7b05ec37399cc775 | a3baba7fd455b22af854b0bab7e749b44ab5942c | /src/com/liu/newcode/huawei/ConversionOfNumberSystem.java | 4c6d576e463bd6c4c4a9f1c7700d9dbd3a317fcf | [] | no_license | pkuliuliu/Algorithm | d0455c612c6f2d3a8c85cdcf20e291826f460990 | 16d45fd9881d921065dda8d53f4441f5010299d7 | refs/heads/master | 2021-05-23T05:36:43.620486 | 2017-10-17T02:51:32 | 2017-10-17T02:51:32 | 95,091,939 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.liu.newcode.huawei;
import java.util.Scanner;
/**
* Created by liu on 17-8-22.
*/
public class ConversionOfNumberSystem {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
while(in.hasNext()) {
String value = in.next().substring(2);
System.out.println(Integer.parseInt(value, 16));
}
}
}
| [
"pkuliuliu@163.com"
] | pkuliuliu@163.com |
b37ac5b7ad710e1e8646d185214b87f4e78818f1 | 34dc8530a2941819a47b4bd26a9342cda4840c8d | /src/Java_Interveiw_Coding_Session/IntegerList_removeValueGreaterThan100.java | 56038a3ea67717af82366a0205d0dbe3eb9289a0 | [] | no_license | KMsuccess/Replit_Practices | 22c84bf22b2e86407efdf3cf88b045b3b0867497 | abc84622fd9b5b28a48be81dd4dac4743ef53c86 | refs/heads/master | 2023-04-22T15:35:11.149581 | 2021-05-04T03:13:41 | 2021-05-04T03:13:41 | 364,125,691 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,364 | java | package Java_Interveiw_Coding_Session;
import java.util.*;
public class IntegerList_removeValueGreaterThan100 {
/*
19. Given a list of Integers 1, 2, 3, 4, 5, 6 ....etc. remove all values
greater than 100.
*/
public static void main(String[] args) {
// Solution 1:
ArrayList<Integer> list1 = new ArrayList<>(Arrays.asList(1,2,3,4,5,6,7,8,9,101,200,300));
ArrayList<Integer> list2 = new ArrayList<>();
for(int each : list1)
if( each < 100)
list2.add(each);
list1=list2;
System.out.println(list1);
// Solution 2:
List<Integer> list = new ArrayList<>(Arrays.asList(1,2,3,4,5,6,7,8,9,101,200,300));
Iterator<Integer> it = list.iterator();
while(it.hasNext())
if(it.next()>100)
it.remove();
System.out.println(list);
// Solution 3:
List<Integer> list3 = new ArrayList<>(Arrays.asList(1,2,3,4,5,6,7,8,9,101,200,300));
for(ListIterator<Integer> il = list3.listIterator(); il.hasNext();)
if(il.next()>100)
il.remove();
System.out.println(list3);
// Solution 4:
ArrayList<Integer> list4 = new ArrayList<>(Arrays.asList(1,2,3,4,5,6,7,8,9,101,200,300));
list4.removeIf(p -> p>100);
System.out.println(list4);
}
}
| [
"https://github.com/MakhmudAkhmedov/Group_30_Project.git"
] | https://github.com/MakhmudAkhmedov/Group_30_Project.git |
bf3b50969f875b0830317be04a8b4cba1e6778f6 | cbcb6f871c6423b8f883e1c4e01de48d84563f05 | /quickstep/src/com/android/quickstep/views/RecentsViewContainer.java | c6cd52769e691c7df7786b1a77d789718cc3d1b8 | [
"Apache-2.0",
"MIT"
] | permissive | richard-branch/branch-android-launcher | 9184ac36b9596189319b58dd0441694389b0928c | 9f04715fbf943d37877b457657907d0fefae9f97 | refs/heads/master | 2022-06-20T07:05:19.036537 | 2020-04-12T18:05:03 | 2020-04-12T18:05:03 | 261,534,995 | 0 | 0 | NOASSERTION | 2020-05-05T17:08:43 | 2020-05-05T17:08:42 | null | UTF-8 | Java | false | false | 4,731 | java | /*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.quickstep.views;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CLEAR_ALL_BUTTON;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.FloatProperty;
import android.view.MotionEvent;
import android.view.View;
import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.R;
import java.util.ArrayList;
public class RecentsViewContainer extends InsettableFrameLayout {
public static final FloatProperty<RecentsViewContainer> CONTENT_ALPHA =
new FloatProperty<RecentsViewContainer>("contentAlpha") {
@Override
public void setValue(RecentsViewContainer view, float v) {
view.setContentAlpha(v);
}
@Override
public Float get(RecentsViewContainer view) {
return view.mRecentsView.getContentAlpha();
}
};
private final Rect mTempRect = new Rect();
private RecentsView mRecentsView;
private ClearAllButton mClearAllButton;
public RecentsViewContainer(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
mClearAllButton = findViewById(R.id.clear_all_button);
mClearAllButton.setOnClickListener((v) -> {
mRecentsView.mActivity.getUserEventDispatcher()
.logActionOnControl(TAP, CLEAR_ALL_BUTTON);
mRecentsView.dismissAllTasks();
});
mRecentsView = findViewById(R.id.overview_panel);
mClearAllButton.forceHasOverlappingRendering(false);
mRecentsView.setClearAllButton(mClearAllButton);
mClearAllButton.setRecentsView(mRecentsView);
if (mRecentsView.isRtl()) {
mClearAllButton.setNextFocusRightId(mRecentsView.getId());
mRecentsView.setNextFocusLeftId(mClearAllButton.getId());
} else {
mClearAllButton.setNextFocusLeftId(mRecentsView.getId());
mRecentsView.setNextFocusRightId(mClearAllButton.getId());
}
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
mRecentsView.getTaskSize(mTempRect);
mClearAllButton.setTranslationX(
(mRecentsView.isRtl() ? 1 : -1) *
(getResources().getDimension(R.dimen.clear_all_container_width)
- mClearAllButton.getMeasuredWidth()) / 2);
mClearAllButton.setTranslationY(
mTempRect.top + (mTempRect.height() - mClearAllButton.getMeasuredHeight()) / 2
- mClearAllButton.getTop());
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
super.onTouchEvent(ev);
// Do not let touch escape to siblings below this view. This prevents scrolling of the
// workspace while in Recents.
return true;
}
public void setContentAlpha(float alpha) {
if (alpha == mRecentsView.getContentAlpha()) {
return;
}
mRecentsView.setContentAlpha(alpha);
setVisibility(alpha > 0 ? VISIBLE : GONE);
}
@Override
public void addFocusables(ArrayList<View> views, int direction, int focusableMode) {
if (mRecentsView.getChildCount() > 0) {
// Carousel is first in tab order.
views.add(mRecentsView);
views.add(mClearAllButton);
}
}
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
return mRecentsView.requestFocus(direction, previouslyFocusedRect) ||
super.requestFocus(direction, previouslyFocusedRect);
}
@Override
public void addChildrenForAccessibility(ArrayList<View> outChildren) {
outChildren.add(mRecentsView);
}
} | [
"adrian.picui@gmail.com"
] | adrian.picui@gmail.com |
93143cfafeeca4372e11d50bc66910b6e3661311 | d6b990fcbe2d3dab1cced7168103f6519a8f1a9c | /sourcecode/checkers/NormalStateWhite.java | 3c26ab8ffdaa716c0722871c1f627756d4de5f9c | [] | no_license | MavisHO/HONG_HONG_set09117 | a9322370927098f5febe1b79f415002ca4036d8c | 3219c630d9afd8b63d617fac8df417e0ac6cd28b | refs/heads/master | 2021-08-08T03:40:14.710929 | 2017-11-09T13:48:40 | 2017-11-09T13:48:40 | 110,034,296 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,834 | 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 checkers;
import java.io.Serializable;
/** Implements the state pattern for the metods findValidMoves and
* findValidJumps in class Checker.
*/
public class NormalStateWhite implements CheckerState,Serializable {
// Attaches valid moves to the validMoves list. Returns true if a valid jump
// exist.
public boolean findValidMoves(final CheckerPosition c, final Board board,
MoveList validMoves) {
if (! findValidJumps(c, board, validMoves)) {
// If no valid jump exist then look for valid moves.
if (GameSearch.validWhiteMove(c.getPosition(), c.getPosition().upLeftMove(),
board))
validMoves.add(new MoveNormal(c, c.getPosition().upLeftMove()));
if (GameSearch.validWhiteMove(c.getPosition(), c.getPosition().upRightMove(),
board))
validMoves.add(new MoveNormal(c, c.getPosition().upRightMove()));
return false;
}
else
return true;
}
public boolean findValidJumps(CheckerPosition c, Board board, MoveList validJumps) {
boolean found = false;
if (GameSearch.validWhiteJump(c.getPosition(), c.getPosition().upLeftJump(),
board)) {
validJumps.add(new MoveJump(c, c.getPosition().upLeftJump()));
found = true;
}
if (GameSearch.validWhiteJump(c.getPosition(), c.getPosition().upRightJump(),
board)) {
validJumps.add(new MoveJump(c, c.getPosition().upRightJump()));
found = true;
}
return found;
}
}
/**
*
* @author Administrator
*/
| [
"31990650+MavisHO@users.noreply.github.com"
] | 31990650+MavisHO@users.noreply.github.com |
0cd72522d4f302bb287ac11bdcbf12f058d66f79 | 896b6881c6ecc1e8908062d9cd7bf067d7707310 | /src/com/_520/student/servlet/RegisterServlet.java | c4d46ca98cb211389fcd77f79bc904150d3271c2 | [] | no_license | Werdio66/student-mybatis | f28b59dfa494b3a820e0d5aea55175fe2362c503 | bd7ece2900299fd03fc161eea8e6dc3341cd680b | refs/heads/master | 2020-08-04T05:16:28.240222 | 2019-10-01T05:31:24 | 2019-10-01T05:31:24 | 212,019,435 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,680 | java | package com._520.student.servlet;
import com._520.student.mybatis.mapper.User;
import com._520.student.mybatis.mapper.UserMapper;
import com._520.student.mybatis.util.MybatisUtil;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/register")
public class RegisterServlet extends HttpServlet {
UserMapper userMapper;
User user;
@Override
public void init(ServletConfig config) throws ServletException {
userMapper = MybatisUtil.getMapper(UserMapper.class);
user = new User();
}
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String randomCode = req.getParameter("randomCode");
String randomCodeInSession = (String)req.getSession().getAttribute("RANDOM_IN_SESSION");
if (!randomCode.equalsIgnoreCase(randomCodeInSession)){
req.setAttribute("errorMsg","验证码错误!");
req.getRequestDispatcher("/registerr.jsp").forward(req,resp);
}else {
String username = req.getParameter("username");
String password = req.getParameter("password");
user.setUsername(username);
user.setPassword(password);
System.out.println(user);
userMapper.save(user);
req.setAttribute("errorMsg","注册成功!");
req.getRequestDispatcher("/login.jsp").forward(req,resp);
}
}
}
| [
"1171472801@qq.com"
] | 1171472801@qq.com |
7416efacf4beb905c9ad5d576253c85a8a939b8e | 2ac35f6a5b6d3931d0f843edd7471b3be48e3860 | /src/TempConvert.java | e3bcaa117e3bda7b102b20b1429b8a8164438e7c | [] | no_license | jrrpanix/CMP-129 | 252f775f58aa0644f9813aa9f0db6bb05bc145fa | e881ff84a3d46c175f2dcb1e04c6230fcea1b669 | refs/heads/master | 2020-12-13T18:44:39.795323 | 2019-05-24T11:54:27 | 2019-05-24T11:54:27 | 28,812,911 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,359 | java | package gui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
public class TempConvert extends JFrame {
private JTextField _temp;
private JLabel _result;
public TempConvert(String title ) {
super(title);
this.setSize(600,600);
this.setLocation(700,200);
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
calcPanel();
this.setVisible(true);
}
private void calcPanel() {
JPanel panel = new JPanel();
JLabel label = new JLabel("Enter temperature F:");
_temp = new JTextField(6);
JButton button = new JButton("calc");
button.addActionListener(new CalcListener());
_result = new JLabel(" ");
panel.add(label);
panel.add(_temp);
panel.add(button);
panel.add(_result);
this.add(panel);
}
static private double toC( double F) {
return (F-32.0)*5.0/9.0;
}
private class CalcListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
double F = Double.parseDouble(_temp.getText());
double C = toC(F);
_result.setText(Double.toString(C));
}
}
public static void main(String [] args) {
new TempConvert("Simple Temperature Converter");
}
}
| [
"jreynoldsvc@gmail.com"
] | jreynoldsvc@gmail.com |
4affbcbab91724f491dde11e42e074bb52961bc6 | 312e02ac31d750ac91e0fbe7aaf52705edcb7ab1 | /other/2061/12.Polymorphism/example/02.PolyExample/src/club/banyuan/fighter/Main.java | 134f960ed33443150f15979caa73f5a4ebc90e52 | [] | no_license | samho2008/2010JavaSE | 52f423c4c135a7ce61c62911ed62cbe2ad91c7ba | 890a4f5467aa2e325383f0e4328e6a9249815ebc | refs/heads/master | 2023-06-14T07:57:37.914624 | 2021-07-05T16:34:18 | 2021-07-05T16:34:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 638 | java | package club.banyuan.fighter;
import club.banyuan.fighter.weapon.SpearWeapon;
import club.banyuan.fighter.weapon.Sword;
public class Main {
public static void main(String[] args) {
Fighter f1 = new Fighter("吕布", new Sword());
Fighter f2 = new Fighter("张飞", new SpearWeapon());
while (f1.getHp() > 0 && f2.getHp() > 0) {
f1.attack(f2);
if (f2.getHp() > 0) {
f2.attack(f1);
}
}
if (f1.getHp() > 0) {
System.out.println(f1.getName() + "获胜,剩余血量" + f1.getHp());
} else {
System.out.println(f2.getName() + "获胜,剩余血量" + f2.getHp());
}
}
}
| [
"zhoujian@banyuan.club"
] | zhoujian@banyuan.club |
f73f96594f569d242ac83de7920ff752f480ad43 | 02b80390be3141581650cd8f8c963825cf726624 | /app/src/main/java/com/playground/skypass/activity/EnterPinForRedeemActivity.java | 9d0ffef7059f8fa9f77d63c82dd2803a78860b98 | [] | no_license | aderifaldi/tripvia | 6094cbc584dd21134c9a84d482fd0b5c4294af51 | 52c668b77925d81d15198996f2f851728fe3e384 | refs/heads/master | 2021-08-24T05:28:56.851148 | 2017-12-08T04:10:41 | 2017-12-08T04:10:41 | 113,523,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,358 | java | package com.playground.skypass.activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.andrognito.pinlockview.IndicatorDots;
import com.andrognito.pinlockview.PinLockListener;
import com.andrognito.pinlockview.PinLockView;
import com.google.gson.JsonObject;
import com.playground.skypass.R;
import com.playground.skypass.app.util.GlobalVariable;
import com.playground.skypass.model.ModelBase;
import butterknife.BindView;
import butterknife.ButterKnife;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class EnterPinForRedeemActivity extends BaseActivity {
@BindView(R.id.indicator_dots)
IndicatorDots mIndicatorDots;
@BindView(R.id.pin_lock_view)
PinLockView mPinLockView;
private final static String TAG = "TAG";
private String title;
private int redeemId;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_enter_pin);
ButterKnife.bind(this);
title = getIntent().getStringExtra("title");
redeemId = getIntent().getIntExtra("redeemId", 0);
mPinLockView.attachIndicatorDots(mIndicatorDots);
//set lock code length
mPinLockView.setPinLength(4);
//set listener for lock code change
mPinLockView.setPinLockListener(new PinLockListener() {
@Override
public void onComplete(String pin) {
Log.d(TAG, "lock code: " + pin);
//User input true code
if (pin.equals("1234")){
letPay();
mPinLockView.resetPinLockView();
}else {
Toast.makeText(EnterPinForRedeemActivity.this, "Invalid pin", Toast.LENGTH_SHORT).show();
onBackPressed();
backAnimation();
}
}
@Override
public void onEmpty() {
Log.d(TAG, "lock code is empty!");
}
@Override
public void onPinChange(int pinLength, String intermediatePin) {
Log.d(TAG, "Pin changed, new length " + pinLength + " with intermediate pin " + intermediatePin);
}
});
}
private void letPay(){
JsonObject jsonObject = new JsonObject();
jsonObject.addProperty("user_id", GlobalVariable.getUserEmail(getApplicationContext()));
jsonObject.addProperty("reward_id", redeemId);
jsonObject.addProperty("title", title);
showLoading();
Call<ModelBase> call = apiService.redeem(jsonObject);
call.enqueue(new Callback<ModelBase>() {
@Override
public void onResponse(Call<ModelBase> call, Response<ModelBase> response) {
dismissLoading();
if (!response.body().isError()) {
Toast.makeText(getApplicationContext(),
response.body().getAlerts().getMessage(), Toast.LENGTH_SHORT).show();
onBackPressed();
backAnimation();
}
}
@Override
public void onFailure(Call<ModelBase> call, Throwable t) {
dismissLoading();
}
});
}
}
| [
"ade.rifaldi@gmail.com"
] | ade.rifaldi@gmail.com |
09294a15f29a46f0fab0c002c382aa9dd81fccf2 | 23471d211f2fa3563895bdfe8904fda51b67254a | /Application/app/src/androidTest/java/org/esiea/im_mooroogen/application/ApplicationTest.java | 179256b32aab5c6b7836d742b35777007dbd0026 | [] | no_license | Raiden0/INF4042_Im_Mooroogen | 228c8abcf3384f22e40d6a9774e2dcc624984c49 | a3066b4d24012b376892cd01c6085cfd6a218081 | refs/heads/master | 2021-04-30T18:46:48.237185 | 2015-12-31T14:00:11 | 2015-12-31T14:00:11 | 44,091,207 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 365 | java | package org.esiea.im_mooroogen.application;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"mooroogen@et.esiea.fr"
] | mooroogen@et.esiea.fr |
5c2c1d4ca1083f9f4de1b43d09138e867d9880a8 | f610fe23245831d5cbc16534138e508af46dcfe5 | /base/src/main/java/com/xiaofei/base/redis/LockTest.java | 3b08a4ddb8176a2e64dc7b434f5964243688d81e | [] | no_license | xiaoxiao-0796/javatest | 1697cd77a0e57b783e0ae31d98827794880a7a8d | fa999b73e4721b61a33c59b7c18d92e12d59f802 | refs/heads/master | 2021-01-21T09:23:44.845378 | 2017-12-01T07:50:23 | 2017-12-01T07:50:23 | 101,970,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,122 | java | package com.xiaofei.base.redis;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
/**
* 类描述
* <p>
* 方法描述列表
* </p>
* User: xiao Date: 2017/8/15 0015 ProjectName: javatest
*/
public class LockTest implements Runnable{
static Lock lock1 = new ReentrantLock();
static Lock lock2 = new ReentrantLock();
static List<Lock> list = new ArrayList<Lock>(){
{
add(lock1);
add(lock2);
}
};
public static void main(String[] args) {
LockTest test = new LockTest();
Thread thread = new Thread(test);
thread.start();
Thread thread1 = new Thread(test);
thread1.start();
}
@Override
public void run() {
Lock lock = list.remove(0);
System.out.println(lock.toString());
lock.lock();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("hello !");
lock.unlock();
}
}
| [
"17091913660@163.com"
] | 17091913660@163.com |
0704c8a1e9e9d95606c419a081a875b3744f1989 | cf1d9682117d512230de27e1e6d1caadc68a0741 | /src/main/java/com/sundar/reditclone/service/SubredditServices.java | e8514467341d72908e070be1c6a9f39439606be7 | [] | no_license | sundarshahi/redit_clone_backend | 6439c49d5482fba2d9f8c10c514d06792c867f4f | 1998aa59a9e0ee468002b8da44fccabef4af6ebd | refs/heads/master | 2022-07-19T19:39:30.603372 | 2020-05-23T21:53:16 | 2020-05-23T21:53:16 | 265,744,338 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,543 | java | package com.sundar.reditclone.service;
import com.sundar.reditclone.dto.SubredditDto;
import com.sundar.reditclone.exceptions.SpringRedditException;
import com.sundar.reditclone.mapper.SubredditMapper;
import com.sundar.reditclone.model.Subreddit;
import com.sundar.reditclone.repository.SubredditRepository;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import static java.util.stream.Collectors.toList;
@Service
@AllArgsConstructor
@Slf4j
public class SubredditServices {
private final SubredditRepository subredditRepository;
private final SubredditMapper subredditMapper;
@Transactional
public SubredditDto save(SubredditDto subredditDto) {
Subreddit subreddit = subredditRepository.save(subredditMapper.mapDtoToSubreddit(subredditDto));
subredditDto.setId(subreddit.getId());
return subredditDto;
}
@Transactional(readOnly = true)
public List<SubredditDto> getAll() {
return subredditRepository.findAll()
.stream()
.map(subredditMapper::mapSubredditToDto)
.collect(toList());
}
public SubredditDto getSubreddit(Long id) {
Subreddit subreddit = subredditRepository.findById(id)
.orElseThrow(() -> new SpringRedditException("No subreddit found with ID - " + id));
return subredditMapper.mapSubredditToDto(subreddit);
}
}
| [
"shahithakurisundar@gmail.com"
] | shahithakurisundar@gmail.com |
7457bd8f050dce256277ef8688f3b3ef0cbac586 | 541bc2a6b05fa44c4ad32d034d7718b1c21bd562 | /src/com/kaduihuan/tool/DataUtil.java | a43208a75d7ac66a80123f91b85ad326b3f2988b | [] | no_license | howe/mobile | 324d577f03085a0042a832ed0b4eeeacd74e3a9d | 6da3cd2b9614e684842046ea19915f0777d10dc1 | refs/heads/master | 2016-09-13T08:10:36.920853 | 2016-05-10T13:48:48 | 2016-05-10T13:48:48 | 58,468,629 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,221 | java | package com.kaduihuan.tool;
/**
* 数据转换
*
* @author Howe
*
*/
public class DataUtil {
public static String getLeft(String sort){
switch (sort) {
case "A":
return "134px";
case "B":
return "164px";
case "C":
return "194px";
case "D":
return "224px";
case "E":
return "254px";
case "F":
return "284px";
case "G":
return "314px";
case "H":
return "344px";
case "I":
return "374px";
case "J":
return "404px";
case "K":
return "434px";
case "L":
return "464px";
case "M":
return "494px";
case "N":
return "524px";
case "O":
return "554px";
case "P":
return "584px";
case "Q":
return "614px";
case "R":
return "644px";
case "S":
return "674px";
case "T":
return "704px";
case "U":
return "734px";
case "V":
return "764px";
case "W":
return "794px";
case "X":
return "824px";
case "Y":
return "854px";
case "Z":
return "884px";
default:
return "42px";
}
}
public static String plid2Url(Integer id){
switch (id){
case 1:
return "/apple.html";
case 2:
return "/android.html";
case 3:
return "/online.html";
case 4:
return "/web.html";
case 5:
return "/wp.html";
default:
return "/";
}
}
public static String plid2Buy(String id){
switch (id) {
case "1":
return "/ibuy.jspx";
case "2":
return "/abuy3.jspx";
case "3":
return "/wbuy.jspx";
case "4":
return "/obuy.jspx";
case "5":
return "/wpbuy.jspx";
default:
return "/";
}
}
public static Integer plid2Name(String name){
switch (name){
case "苹果版":
return 1;
case "安卓版":
return 2;
case "端游":
return 3;
case "页游":
return 4;
case "WP版":
return 5;
default:
return null;
}
}
public static String changeTenpayBankType(String bank_type) {
switch (bank_type.toUpperCase()) {
case "BL":
return "余额支付";
case "ICBC":
return "工商银行";
case "CCB":
return "建设银行";
case "ABC":
return "农业银行";
case "CMB":
return "招商银行";
case "SPDB":
return "上海浦发银行";
case "SDB":
return "深圳发展银行";
case "CIB":
return "兴业银行";
case "BOB":
return "北京银行";
case "CEB":
return "光大银行";
case "CMBC":
return "民生银行";
case "CITIC":
return "中信银行";
case "GDB":
return "广东发展银行";
case "PAB":
return "平安银行";
case "BOC":
return "中国银行";
case "COMM":
return "交通银行";
case "NJCB":
return "南京银行";
case "NBCB":
return "宁波银行";
case "SRCB":
return "上海农商";
case "BEA":
return "东亚银行";
case "POSTGC":
return "邮政储蓄";
case "ICBCB2B":
return "工商银行(企业版)";
case "CMBB2B":
return "招商银行(企业版)";
case "CCBB2B":
return "建设银行(企业版)";
case "ABCB2B":
return "农业银行(企业版)";
case "SPDBB2B":
return "浦发银行(企业版)";
case "CEBB2B":
return "光大银行(企业版)";
default:
return "未知";
}
}
public static String changeKuaiqianBankType(String bankId) {
switch (bankId.toUpperCase()) {
case "BL":
return "余额支付";
case "GZCB":
return "广州银行";
case "CBHB":
return "渤海银行";
case "BJRCB":
return "北京农商银行";
case "ICBC":
return "工商银行";
case "CCB":
return "建设银行";
case "ABC":
return "农业银行";
case "CMB":
return "招商银行";
case "SPDB":
return "上海浦发银行";
case "SDB":
return "深圳发展银行";
case "CIB":
return "兴业银行";
case "HXB":
return "华夏银行";
case "BOB":
return "北京银行";
case "CEB":
return "光大银行";
case "CMBC":
return "民生银行";
case "CITIC":
return "中信银行";
case "GDB":
return "广东发展银行";
case "PAB":
return "平安银行";
case "BOC":
return "中国银行";
case "BCOM":
return "交通银行";
case "NJCB":
return "南京银行";
case "HSB":
return "徽商银行";
case "CZB":
return "浙商银行";
case "HZB":
return "杭州银行";
case "NBCB":
return "宁波银行";
case "SRCB":
return "上海农商";
case "UPOP":
return "银联在线支付";
case "BEA":
return "东亚银行";
case "JSB":
return "江苏银行";
case "DLB":
return "大连银行";
case "SHB":
return "上海银行";
case "PSBC":
return "邮政储蓄";
case "ICBC_B2B":
return "工商银行(企业版)";
case "CMB_B2B":
return "招商银行(企业版)";
case "CCB_B2B":
return "建设银行(企业版)";
case "ABC_B2B":
return "农业银行(企业版)";
case "BOC_B2B":
return "中国银行(企业版)";
case "BCOM_B2B":
return "交通银行(企业版)";
case "CIB_B2B":
return "兴业银行(企业版)";
case "SPDB_B2B":
return "浦发银行(企业版)";
case "CEB_B2B":
return "光大银行(企业版)";
default:
return "未知";
}
}
}
| [
"howechiang@gmail.com"
] | howechiang@gmail.com |
cf8858630438fe06122f161a5d78dfc6718a35f0 | 446f0d4e821a237812c6a906a61f25c1e1a3d99a | /app/src/main/java/com/example/dufangyu/letcat4g/helper/GenericHelper.java | a767faf689914101c72707da3fd658db25260259 | [
"Apache-2.0"
] | permissive | dufangyu1990/LetCat4G | 87962be4774f5c4b54791c45264d241cdad0d8b0 | 196f9b358798a3f6b2e371e10b07e8f0bf8df59d | refs/heads/master | 2021-01-23T10:34:28.198858 | 2018-03-09T09:09:34 | 2018-03-09T09:09:34 | 102,619,236 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 982 | java | package com.example.dufangyu.letcat4g.helper;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
/**
* Created by dufangyu on 2016/9/5.
*/
public class GenericHelper {
//根据我们提供的class,来获取这个类实现的那个泛型的类型
public static <T>Class<T> getViewClass(Class<?> klass)
{
//getGenericSuperclass()获得带有泛型的父类
Type type = klass.getGenericSuperclass();
if(type==null || !(type instanceof ParameterizedType))
return null;
//ParameterizedType参数化类型,即泛型
ParameterizedType parameterizedType = (ParameterizedType) type;
//getActualTypeArguments获取参数化类型的数组,泛型可能有多个
Type[] types = parameterizedType.getActualTypeArguments();
if(types == null || types.length == 0) return null;
// Log.d("dfy","返回"+(Class<T>) types[0]);
return (Class<T>) types[0];
}
}
| [
"781675707@qq.com"
] | 781675707@qq.com |
dda268d16e91b605fdc096000e7c96370e09151c | 81da5059b422e34498c54e13046000ccabd43da0 | /src/main/java/com/example/testapp/service/impl/BlogServiceImpl.java | 9223bbf0a4a7339e6c7a6faff2a3a6e746efd6d4 | [] | no_license | dingquan/spring-angular-oauth | 761226fdc89837d13525cbddb92951eded106099 | fa91d7cc2e74f6cc0a05aea2e3af80b181f55c5f | refs/heads/master | 2021-01-10T22:44:29.097299 | 2016-10-08T23:14:21 | 2016-10-08T23:14:21 | 70,362,124 | 2 | 1 | null | 2016-10-09T20:05:13 | 2016-10-08T23:04:49 | Java | UTF-8 | Java | false | false | 2,599 | java | package com.example.testapp.service.impl;
import javax.persistence.EntityNotFoundException;
import javax.transaction.Transactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import com.example.testapp.dao.BlogRepository;
import com.example.testapp.model.Blog;
import com.example.testapp.model.User;
import com.example.testapp.service.BlogService;
import com.example.testapp.util.NullAwareBeanUtils;
@Service
public class BlogServiceImpl extends BaseServiceImpl implements BlogService {
private final Logger log = LoggerFactory.getLogger(this.getClass());
@Autowired
private BlogRepository blogRepository;
@Override
public Page<Blog> findAllPublishedBlogs(Pageable page) {
Page<Blog> blogs = blogRepository.findByStatusOrderByCreatedAtDesc(Blog.Status.PUBLISHED, page);
return blogs;
}
@Override
@Transactional
public Blog createBlog(Blog blog) {
User currentUser = getCurrentUser();
blog.setOwner(currentUser);
return blogRepository.save(blog);
}
@Override
@Transactional
public void deleteBlog(String id) {
Blog blog = blogRepository.findOne(id);
if (blog == null) {
throw new EntityNotFoundException("Blog with id doesn't exist. blogId=" + id);
}
blogRepository.delete(blog);
}
@Override
@Transactional
public Blog getBlog(String id) {
Blog blog = blogRepository.findOne(id);
if (blog == null) {
throw new EntityNotFoundException("Blog with given id not found. blogId=" + id);
}
blog.setViewCount(blog.getViewCount() + 1);
blog = blogRepository.save(blog);
User currentUser = getCurrentUserIfExists();
return blog.publicClone();
}
@Override
@Transactional
public Blog updateBlog(String id, Blog blog) {
Blog dbBlog = blogRepository.findOne(id);
User currentUser = getCurrentUser();
NullAwareBeanUtils beanUtils = new NullAwareBeanUtils("viewCount", "likeCount", "commentCount", "status");
beanUtils.copyProperties(dbBlog, blog);
dbBlog = blogRepository.save(dbBlog);
return dbBlog;
}
@Override
public Page<Blog> findMyBlogs(Pageable page) {
User user = getCurrentUser();
Page<Blog> blogs = blogRepository.findByOwnerOrderByCreatedAtDesc(user, page);
return blogs;
}
@Override
@Transactional
public Blog changeStatus(String id, Blog.Status status) {
Blog blog = blogRepository.findOne(id);
blog.setStatus(status);
return blogRepository.save(blog);
}
}
| [
"qding.bit@outlook.com"
] | qding.bit@outlook.com |
ca3da3b45d37736fb7a933c940090c34a4af6f34 | dd43f7332de200a0d30abf5b3e58e716c0f8a4dc | /app/bootstrap/MongoHandler.java | 9196329837f5f1bb3217c4abd8d069e4d5fb4eee | [
"Apache-2.0"
] | permissive | Musicamise/musicamise-storeAdm | b523940db6a4bfd991207ba6fad2a5f6152e5926 | 95b4b6b952e5b8b195eb36efc6a26d8b2ada74d1 | refs/heads/master | 2021-08-01T22:46:10.471272 | 2021-07-27T14:46:12 | 2021-07-27T14:46:12 | 37,084,216 | 1 | 1 | null | 2015-10-08T21:46:24 | 2015-06-08T18:15:11 | HTML | UTF-8 | Java | false | false | 1,962 | java | package bootstrap;
import java.util.Date;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.mongodb.core.MongoOperations;
import com.mongodb.MongoClient;
public class MongoHandler {
private static MongoOperations mop = null;
private static MongoClient client = null;
private static MongoHandler instance = null;
/**
* Intantiate a connection to mongodb
*/
public MongoHandler() {
init();
}
public static MongoHandler getInstance(String dbName) {
if(dbName!=null){
///ThreadLocalDbNameMongoDbFactory.clearDefaultNameForCurrentThread();
// ThreadLocalDbNameMongoDbFactory.setDefaultNameForCurrentThread(dbName);
}
return (instance == null ? instance = new MongoHandler() : instance);
}
public static MongoHandler getInstance() {
//ThreadLocalDbNameMongoDbFactory.clearDefaultNameForCurrentThread();
//ThreadLocalDbNameMongoDbFactory.setDefaultNameForCurrentThread(null);
return (instance == null ? instance = new MongoHandler() : instance);
}
@SuppressWarnings("resource")
public static void init(){
ApplicationContext ctx = new AnnotationConfigApplicationContext(SpringMongoConfig.class);
if(mop == null){
mop = (MongoOperations)ctx.getBean("mongoTemplate");
}
}
/**
* Gets the time from mongodb server
* @return the time from the machine hosting the mongodb server
*/
public static Date getServerTime(){
try{
return ((Date) SpringMongoConfig.mongoInfo.getServerStatus().get("localTime"));
}catch(Exception e){
return new Date();
}
}
public MongoOperations getMongo(){
return mop;
}
public MongoClient getClient(){
return client;
}
}
| [
"alvaro@silvino.me"
] | alvaro@silvino.me |
31efad375d69d2325924f76f77066c3833365455 | 95372fa6919ffdd4dcd47e615fc1e02dcb2ca0a4 | /h_pana_ejb/integracion/PersonaFacadeLocal.java | 845875eaf7bcaebc9d263f04cd2d188c2e1da4ff | [] | no_license | angelpriest/h_pana | 74d15d100a1e7403a32a5faf19a53164d6f2da71 | 0a5e8cef23e76fef4fadad1ae9cf7d7af2a88721 | refs/heads/master | 2021-01-17T15:34:39.913819 | 2016-05-31T03:25:46 | 2016-05-31T03:25:46 | 55,740,236 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 624 | 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 integracion;
import entidades.Persona;
import java.util.List;
import javax.ejb.Local;
/**
*
* @author Juan Carlos
*/
@Local
public interface PersonaFacadeLocal {
void create(Persona persona);
void edit(Persona persona);
void remove(Persona persona);
Persona find(Object id);
List<Persona> findAll();
List<Persona> findRange(int[] range);
int count();
}
| [
"angelrivera9508@gmail.com"
] | angelrivera9508@gmail.com |
09f7c5ea53928e15ebe703c19575aa94329a8047 | 9e38b74e80d32e088fb188212da0bbe32e099e8a | /src/main/java/io/github/jhipster/areaapp/web/rest/vm/KeyAndPasswordVM.java | 6435356dc98d10a3e348f1539786c7e77bdf6611 | [] | no_license | BulkSecurityGeneratorProject/areaApp | 2878e75d7ba6cb93949f9a35326d6e1f12a55ab1 | 8010983638aeb6c4095994b265eb22090734c414 | refs/heads/master | 2022-12-15T13:33:09.793172 | 2019-05-15T10:23:45 | 2019-05-15T10:23:45 | 296,585,810 | 0 | 0 | null | 2020-09-18T10:12:21 | 2020-09-18T10:12:20 | null | UTF-8 | Java | false | false | 507 | java | package io.github.jhipster.areaapp.web.rest.vm;
/**
* View Model object for storing the user's key and password.
*/
public class KeyAndPasswordVM {
private String key;
private String newPassword;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
8048ff78296a2a3e46be296e75258a49bb529baa | 15f42588c231883474afe9840964c6298b66feaf | /app/src/main/java/com/aan/taskit2/SplashScreen.java | a068180032d52fefc79c31258c7f880938c2b2e3 | [] | no_license | ferdianzh/PemrogramanMobile-UAS_TaskIt | a881abef0bf7ea2b4b6787cf48efbbff8caa92d3 | f343d73ef835f3249bf490c7567a39eddfd08b76 | refs/heads/main | 2023-02-20T23:46:46.625182 | 2021-01-13T12:54:42 | 2021-01-13T12:54:42 | 329,195,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package com.aan.taskit2;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
public class SplashScreen extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
getSupportActionBar().hide();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent in = new Intent(SplashScreen.this, LoginActivity.class);
startActivity(in);
finish();
}
}, 1000);
}
} | [
"ferdianzh30@gmail.com"
] | ferdianzh30@gmail.com |
314353f3984c46c47b8d325bda0c9c78e45ef094 | 5019fe77a57e28ac988f2e3c61efa4ba6a00c959 | /sdk/src/main/java/org/zstack/sdk/DetachIsoFromVmInstanceAction.java | fc62a478c4a5086eee3fbcfa06b64ad30eeccde7 | [
"Apache-2.0"
] | permissive | liuyong240/zstack | 45b69b2faaf893ea4bbc0941effef773c780c8e2 | c57c001f1ce377c64bf00ec765bcc7144e6ca273 | refs/heads/master | 2020-05-22T22:37:57.602737 | 2017-03-12T17:22:30 | 2017-03-12T17:22:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,583 | java | package org.zstack.sdk;
import java.util.HashMap;
import java.util.Map;
public class DetachIsoFromVmInstanceAction extends AbstractAction {
private static final HashMap<String, Parameter> parameterMap = new HashMap<>();
public static class Result {
public ErrorCode error;
public DetachIsoFromVmInstanceResult value;
public Result throwExceptionIfError() {
if (error != null) {
throw new ApiException(
String.format("error[code: %s, description: %s, details: %s]", error.code, error.description, error.details)
);
}
return this;
}
}
@Param(required = true, nonempty = false, nullElements = false, emptyString = true, noTrim = false)
public java.lang.String vmInstanceUuid;
@Param(required = false)
public java.util.List systemTags;
@Param(required = false)
public java.util.List userTags;
@Param(required = true)
public String sessionId;
public long timeout;
public long pollingInterval;
public Result call() {
ApiResult res = ZSClient.call(this);
Result ret = new Result();
if (res.error != null) {
ret.error = res.error;
return ret;
}
DetachIsoFromVmInstanceResult value = res.getResult(DetachIsoFromVmInstanceResult.class);
ret.value = value == null ? new DetachIsoFromVmInstanceResult() : value;
return ret;
}
public void call(final Completion<Result> completion) {
ZSClient.call(this, new InternalCompletion() {
@Override
public void complete(ApiResult res) {
Result ret = new Result();
if (res.error != null) {
ret.error = res.error;
completion.complete(ret);
return;
}
DetachIsoFromVmInstanceResult value = res.getResult(DetachIsoFromVmInstanceResult.class);
ret.value = value == null ? new DetachIsoFromVmInstanceResult() : value;
completion.complete(ret);
}
});
}
Map<String, Parameter> getParameterMap() {
return parameterMap;
}
RestInfo getRestInfo() {
RestInfo info = new RestInfo();
info.httpMethod = "DELETE";
info.path = "/vm-instances/{vmInstanceUuid}/iso";
info.needSession = true;
info.needPoll = true;
info.parameterName = "null";
return info;
}
}
| [
"xin.zhang@mevoco.com"
] | xin.zhang@mevoco.com |
2bb40aa7b12315c54254d230ae3514015e9866db | e082b91bd40ef2791060f81277be6dd585e3b454 | /src/main/lc_medium/LC142_LinkedListCycleII.java | 2c14b7d3a464d64e130eb8f82ed44cbf3d239a19 | [] | no_license | wxwcase/LC_Solutions | 25c394e3a6946e45d53058efe729a300d318f97a | e01c3dff8b7d2148f3d0356e40a5113749e7a3a2 | refs/heads/master | 2021-01-13T13:39:19.143060 | 2017-03-27T19:55:32 | 2017-03-27T19:55:32 | 76,404,910 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 846 | java | package main.lc_medium;
import main.lc_easy.ListNode;
/**
* Created by weiwang on 3/18/17.
*/
public class LC142_LinkedListCycleII {
public ListNode detectCycle(ListNode head) {
if (head == null || head.next == null) return null;
ListNode fast = head;
ListNode slow = head;
while (fast.next != null) {
fast = fast.next;
slow = slow.next;
if (fast.next != null) {
fast = fast.next;
} else {
// no cycle
return null;
}
if (fast == slow) {
slow = head;
while (fast != slow) {
fast = fast.next;
slow = slow.next;
}
return fast;
}
}
return null;
}
}
| [
"weicwru@gmail.com"
] | weicwru@gmail.com |
5dc17e9d5a376cf4b0eb59b98129781ceed82056 | 1d6de366430041e3f9229bc646301860d1614ad9 | /agent/agent-management/src/main/java/com/yz/boster/commons/ueditor/define/MIMEType.java | a71e1cd6c8d271162a4358424fff8cf2432ad6d0 | [] | no_license | solong1980/projects | 0df1c4161ac3772d1f95e939d906c05a1d0babab | a685fe4eb846c99f5f0add78ef706ed4044ad60f | refs/heads/master | 2021-01-22T03:29:42.548922 | 2017-07-05T13:51:22 | 2017-07-05T13:51:22 | 92,380,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 550 | java | package com.yz.boster.commons.ueditor.define;
import java.util.HashMap;
import java.util.Map;
public class MIMEType {
public static final Map<String, String> types = new HashMap<String, String>() {
private static final long serialVersionUID = -2881802098108442811L;
{
put("image/gif", ".gif");
put("image/jpeg", ".jpg");
put("image/jpg", ".jpg");
put("image/png", ".png");
put("image/bmp", ".bmp");
put("image/webp", ".webp");
}
};
public static String getSuffix(String mime) {
return MIMEType.types.get(mime);
}
}
| [
"solong1980@163.com"
] | solong1980@163.com |
f876c14366fb3656ae8aacde40264d65640c24c3 | a875fa92761db3b95a465b2b3591146c04d7a318 | /app/src/main/java/com/onesoft/digitaledu/presenter/person/WallPaperPresenter.java | 2d1ef4cc5878e33c93499b3a8baecf6539652fc0 | [] | no_license | 1019350030wfj/DigitalSchool | 9d20e06136396fb633ba9e90d9d2628f7914598f | bbd3cceb254c0b99bd909f34919b742f07927c47 | refs/heads/master | 2020-03-17T16:50:14.692057 | 2018-05-17T05:45:22 | 2018-05-17T05:45:22 | 133,764,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | java | package com.onesoft.digitaledu.presenter.person;
import android.content.Context;
import com.onesoft.digitaledu.presenter.BasePresenter;
import com.onesoft.digitaledu.view.iview.person.IWallPaperView;
/**
* Created by Jayden on 2016/11/17.
*/
public class WallPaperPresenter extends BasePresenter<IWallPaperView> {
public WallPaperPresenter(Context context, IWallPaperView iView) {
super(context, iView);
}
}
| [
"jayden@qq.com"
] | jayden@qq.com |
3d4ed4be383c5eb79ffd09fb5212af2e5532e878 | c2f76c020c370802a9e5a40bb650f4476e7a6185 | /spring-security101-step4/src/main/java/com/lukeshannon/meetup/springsecurity/config/SecurityConfig.java | c03d5ee54a5f795dc742f7283ab556c2e96785cd | [] | no_license | luiz158/spring-security-101 | fa8cea6c6fcb2b8f3f2d909ed7d36b02987f9758 | e9187f47107f9a9721c938b42f80d1cb9e655de3 | refs/heads/master | 2020-12-28T19:06:41.410551 | 2016-06-29T21:31:21 | 2016-06-29T21:31:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,791 | java | /**
*
*/
package com.lukeshannon.meetup.springsecurity.config;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
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.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.provisioning.JdbcUserDetailsManager;
/**
* @author lshannon
*
*/
@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
DataSource dataSource;
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/images", "/hello", "/login").permitAll()
.anyRequest().authenticated().and().formLogin().and().logout().permitAll();
}
/**
* Notes:
* 1. Can override the queries
* 2. Can enable password encoding
* 3. Could have configured for LDAP
* @param auth
* @throws Exception
*/
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth)
throws Exception {
auth
.jdbcAuthentication()
.dataSource(dataSource);
}
/**
* To configure both
*/
//@Bean
//public UserDetailsService userDetailsService(DataSource dataSource) {
/// JdbcUserDetailsManager uds = new JdbcUserDetailsManager();
// uds.setDataSource(dataSource);
// return uds;
//}
}
| [
"luke.shannon@gmail.com"
] | luke.shannon@gmail.com |
3bcbff6f9a6a3e08543cb4a9f46328ab2bd6462c | 7e8242064366acdd6821d1cbc2402e4f51d6087f | /src/com/googlecode/connect4java/gui/listener/GameListener.java | ea66a9b0a4a4cbee4a14fdd2e87287995a125a78 | [] | no_license | noxan/connect4java | 5e4120c1a6ddc6c132407435a6b6b4c22e003470 | 2fbf4b066668475ec1690d61259889743d177f2e | refs/heads/master | 2016-09-06T21:23:26.271501 | 2010-07-05T17:41:41 | 2010-07-05T17:41:41 | 1,431,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,027 | java | package com.googlecode.connect4java.gui.listener;
import java.awt.event.ActionEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import com.googlecode.connect4java.field.DefaultField;
import com.googlecode.connect4java.gui.card.GameCard;
/**
*
* @author richard.stromer
* @version 1.1b4(r34)
* @since 0.6.12
*/
public class GameListener extends AbstractListener<GameCard> implements MouseListener {
public GameListener(GameCard card) {
super(card);
}
@Override
public void actionPerformed(ActionEvent e) {
}
/**
* @since 0.8.17
*/
@Override
public void mouseReleased(MouseEvent e) {
int column = (int) (e.getX()/((float)card.getGamePanel().getWidth()/DefaultField.FIELD_WIDTH));
card.getGame().click(column);
}
@Override public void mouseClicked(MouseEvent e) {}
@Override public void mouseEntered(MouseEvent e) {}
@Override public void mouseExited(MouseEvent e) {}
@Override public void mousePressed(MouseEvent e) {}
}
| [
"richard.stromer@011b0be2-c168-11de-bb5c-85734917f5ce"
] | richard.stromer@011b0be2-c168-11de-bb5c-85734917f5ce |
269b84f400f7a8b6ec3e8e8d2294fe65313baf66 | b31de098d9f5c85ec7536fe5e73e17457fa5971c | /src/main/java/com/gmail/yeritsyankoryun/weather/dao/WeatherDataAccessService.java | fe37c9f08fd7c24cafc9f12d1ca47b68e6334fb7 | [] | no_license | KoryunY/weather | 88082c9ae96915907b7838bf952ecaa4f5845f0f | b4cc21aae8dd8b07aca48e2a174a769ce9c11ab1 | refs/heads/master | 2023-06-16T21:22:28.302853 | 2021-07-19T16:56:29 | 2021-07-19T16:56:29 | 386,263,275 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,920 | java | package com.gmail.yeritsyankoryun.weather.dao;
import com.gmail.yeritsyankoryun.weather.dto.WeatherInfoDto;
import com.gmail.yeritsyankoryun.weather.model.WeatherInfoModel;
import com.gmail.yeritsyankoryun.weather.model.WeatherType;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@Repository
public class WeatherDataAccessService {
private static List<WeatherInfoModel> weathers = new ArrayList<>();
static {
weathers.add(new WeatherInfoModel("Arm", "Yerevan", 37, WeatherType.SUNNY, 5));
weathers.add(new WeatherInfoModel("Arm", "Abovyan", 17, WeatherType.RAIN, 17));
}
public List<WeatherInfoModel> getAll() {
return weathers;
}
public Optional<WeatherInfoModel> getByCC(String country, String city) {
return weathers.stream().filter(weather -> weather.getCity().equals(city) && weather.getCountry().equals(country)).findFirst();
}
public void persist(WeatherInfoModel weather) {
if(getByCC(weather.getCountry(), weather.getCity()).isEmpty())
weathers.add(weather);
else throw new IllegalArgumentException("Exist",new Throwable("Model"));
}
public void update(WeatherInfoModel newWeather) {
WeatherInfoModel oldWeather = getByCC(newWeather.getCountry(), newWeather.getCity()).get();
if (newWeather.getTemperature() != null)
oldWeather.setTemperature(newWeather.getTemperature());
if (newWeather.getWindSpeed() != null)
oldWeather.setWindSpeed(newWeather.getWindSpeed());
if (newWeather.getType() != null)
oldWeather.setType(newWeather.getType());
}
public void deleteByCC(String country, String city) {
getByCC(country, city).ifPresent(model -> weathers.remove(model));
}
public void deleteAll() {
weathers.clear();
}
}
| [
"yeritsyankoryun@gmail.com"
] | yeritsyankoryun@gmail.com |
b1134851d47e00cc8af8fca3100f2cc772fc79e8 | afb78b6d9d2a3cb1f8d9714231a44d4423b7184b | /Java-OCP2-master/Lesson_6_Interfaces_and_Lambda_Expressions/Lesson6_Interfaces_ProductSalesInterfaces02/Main.java | e7e0b9653b9dd41c2db0c3eabe6a1f17727258e5 | [] | no_license | Shaigift/Java2HerbertSchildt | 056afb53a536ce2936fcae25f8888be0681a0180 | b55046273bfd53b6088366c1c9895652da260025 | refs/heads/main | 2023-05-09T03:14:09.633196 | 2021-06-08T09:03:20 | 2021-06-08T09:03:20 | 374,947,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 149 | java | package Lesson6_Interfaces_ProductSalesInterfaces02;
public class Main {
public static void main(String[] args) {
TestSales.main(args);
}
}
| [
"mphogivenshai@gmail.com"
] | mphogivenshai@gmail.com |
20a6552d2a5f5fbd919f5a68af659235e6149de1 | 666b64547cb37fa78e29a7b8c62e26bc4ae845d6 | /messagepasserlab3/src/Client.java | 473492cf0582db81f42e4abb7139fc0cc66aaf1d | [] | no_license | jingcmu/Distributed_System | 3cecb92739d93678d723c5912dbc4a892fff4106 | 169a571c9b32bdcaf924b521305b3bd05b0e0c21 | refs/heads/master | 2016-09-10T19:31:04.591771 | 2014-02-17T17:26:39 | 2014-02-17T17:26:39 | 16,238,771 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,898 | java |
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Map;
import java.util.Scanner;
import org.yaml.snakeyaml.Yaml;
public class Client {
private static MessagePasser mp = null;
static ClockService clock = null;
static TimestampedMessage tsm = null;
static MulticastService mcs = null;
static MutualExclusionService mutexService = null;
static MessageShower M = null;
public static MessagePasser getMp() {
return mp;
}
public static MulticastService getMcs() {
return mcs;
}
public static ClockService getClock() {
return clock;
}
public static MutualExclusionService getMetux() {
return mutexService;
}
public static MessageShower getMessageShower() {
return M;
}
public static void setMp(MessagePasser MP) {
mp = MP;
}
public static void setMcs(MulticastService MCS) {
mcs = MCS;
}
public static void setClock(ClockService Clock) {
clock = Clock;
}
public static void setMetux(MutualExclusionService MutexService) {
mutexService = MutexService;
}
public static void setMessageShower(MessageShower MS) {
M = MS;
}
public static void main(String[] args) {
M = new MessageShower(args[0], args[1]);
}
public static void initClock(String configFilePath, String processName,
String clockType) throws Exception {
if(clockType.equals("Logical"))
{
clock = new LogicalClock();
}
else if(clockType.equals("Vector"))
{
int [] config;
config = readConfiguration(configFilePath, processName);
Integer nProcesses = config[0];
Integer myIndex = config[1];
if (myIndex == -1) {
throw new Exception("Config for "+ processName +" not found!");
}
clock = new VectorClock(nProcesses, myIndex);
}
else {
throw new Exception("Invalid clocktype selected!");
}
}
/*
* Read number of processes and self index for vector clock.
*/
private static int [] readConfiguration(String FilePath, String processName)
throws Exception {
try {
int [] config = new int[2];
int nProcesses = 0;
int myIndex = 0;
File file = new File(FilePath);
InputStream input = new FileInputStream(file);
Yaml yaml = new Yaml();
Map<String, Object> data = (Map<String, Object>) yaml.load(input);
ArrayList<Map> peers = null;
peers = (ArrayList<Map>) data.get("configuration");
nProcesses = peers.size();
for (Map peer : peers) {
String name = peer.get("name").toString();
if (name.equals(processName)) {
break;
}
myIndex++;
}
input.close();
config[0] = nProcesses;
if (myIndex == nProcesses) {
config[1] = -1;
}
else {
config[1] = myIndex;
}
return config;
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
} | [
"jingchen@cmu.edu"
] | jingchen@cmu.edu |
906d9fd2fdcc1a3d8e605da15782077be18ee679 | ee461488c62d86f729eda976b421ac75a964114c | /tags/HtmlUnit-2.3/src/main/java/com/gargoylesoftware/htmlunit/util/DebuggingWebConnection.java | 5e6d9add8a356a88f1d292c82a85305ad1e14607 | [
"Apache-2.0"
] | permissive | svn2github/htmlunit | 2c56f7abbd412e6d9e0efd0934fcd1277090af74 | 6fc1a7d70c08fb50fef1800673671fd9cada4899 | refs/heads/master | 2023-09-03T10:35:41.987099 | 2015-07-26T13:12:45 | 2015-07-26T13:12:45 | 37,107,064 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,232 | java | /*
* Copyright (c) 2002-2008 Gargoyle Software Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gargoylesoftware.htmlunit.util;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
import org.apache.commons.httpclient.NameValuePair;
import org.apache.commons.io.FileUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.gargoylesoftware.htmlunit.TextUtil;
import com.gargoylesoftware.htmlunit.WebConnection;
import com.gargoylesoftware.htmlunit.WebRequestSettings;
import com.gargoylesoftware.htmlunit.WebResponse;
/**
* Wrapper around a "real" WebConnection that will use the wrapped web connection
* to do the real job and save all received responses
* in the temp directory with an overview page.<br>
* <br>
* This may be useful at conception time to understand what is "browsed".<br>
* <br>
* Example:
* <pre>
* final WebClient client = new WebClient();
* final WebConnection connection = new DebuggingWebConnection(client.getWebConnection(), "myTest");
* client.setWebConnection(connection);
* </pre>
* In this example an overview page will be generated under the name myTest.html in the temp directory.<br>
* <br>
* <em>This class is only intended as an help during the conception.</em>
*
* @version $Revision$
* @author Marc Guillemot
* @author Ahmed Ashour
*/
public class DebuggingWebConnection extends WebConnectionWrapper {
private static final Log LOG = LogFactory.getLog(DebuggingWebConnection.class);
private int counter_;
private final WebConnection wrappedWebConnection_;
private final String reportBaseName_;
private final File javaScriptFile_;
/**
* Wraps a web connection to have a report generated of the received responses.
* @param webConnection the webConnection that do the real work
* @param reportBaseName the base name to use for the generated files
* The report will be reportBaseName + ".html" in the temp file.
* @throws IOException in case of problems writing the files
*/
public DebuggingWebConnection(final WebConnection webConnection,
final String reportBaseName) throws IOException {
super(webConnection);
wrappedWebConnection_ = webConnection;
reportBaseName_ = reportBaseName;
javaScriptFile_ = File.createTempFile(reportBaseName_, ".js");
createOverview();
}
/**
* Calls the wrapped webconnection and save the received response.
* {@inheritDoc}
*/
@Override
public WebResponse getResponse(final WebRequestSettings settings) throws IOException {
final WebResponse response = wrappedWebConnection_.getResponse(settings);
saveResponse(response, settings);
return response;
}
/**
* Saves the response content in the temp dir and adds it to the summary page.
* @param response the response to save
* @param settings the settings used to get the response
* @throws IOException if a problem occurs writing the file
*/
protected void saveResponse(final WebResponse response, final WebRequestSettings settings)
throws IOException {
counter_++;
final String extension;
if ("application/x-javascript".equals(response.getContentType())) {
extension = ".js";
}
else if ("text/html".equals(response.getContentType())) {
extension = ".html";
}
else {
extension = ".txt";
}
final File f = File.createTempFile(reportBaseName_ + counter_ + "-", extension);
final String content = response.getContentAsString();
FileUtils.writeStringToFile(f, content, response.getContentCharSet());
LOG.info("Created file " + f.getAbsolutePath()
+ " for response " + counter_ + ": " + response.getUrl());
final StringBuilder buffer = new StringBuilder();
buffer.append("tab[tab.length] = {code: " + response.getStatusCode() + ", ");
buffer.append("fileName: '" + f.getName() + "', ");
buffer.append("contentType: '" + response.getContentType() + "', ");
buffer.append("method: '" + settings.getHttpMethod().name() + "', ");
buffer.append("url: '" + response.getUrl() + "', ");
buffer.append("headers: " + nameValueListToJsMap(response.getResponseHeaders()));
buffer.append("};\n");
final FileWriter jsFileWriter = new FileWriter(javaScriptFile_, true);
jsFileWriter.write(buffer.toString());
jsFileWriter.close();
}
/**
* Produces a String that will produce a JS map like "{'key1': 'value1', 'key 2': 'value2'}"
* @param headers a list of {@link NameValuePair}
* @return the JS String
*/
static String nameValueListToJsMap(final List<NameValuePair> headers) {
if (headers == null || headers.isEmpty()) {
return "{}";
}
final StringBuilder buffer = new StringBuilder("{");
for (final NameValuePair header : headers) {
buffer.append("'" + header.getName() + "': '" + header.getValue().replaceAll("'", "\\'") + "', ");
}
buffer.delete(buffer.length() - 2, buffer.length());
buffer.append("}");
return buffer.toString();
}
/**
* Creates the summary file and the JavaScript file that will be updated for each received response
* @throws IOException if a problem occurs writing the file
*/
private void createOverview() throws IOException {
FileUtils.writeStringToFile(javaScriptFile_, "var tab = [];\n", TextUtil.DEFAULT_CHARSET);
final File summary = new File(javaScriptFile_.getParentFile(), reportBaseName_ + ".html");
final String content = "<html><head><title>Summary for " + reportBaseName_ + "</title>\n"
+ "<h1>Received responses</h1>\n"
+ "<script src='" + javaScriptFile_.getName() + "' type='text/javascript'></script>\n"
+ "</head>\n"
+ "<body>"
+ "<ol>\n"
+ "<script>\n"
+ "for (var i=0; i<tab.length; i++) {\n"
+ " var curRes = tab[i];\n"
+ " document.writeln('<li>'"
+ " + curRes.code + ' ' + curRes.method + ' ' "
+ " + '<a href=\"' + curRes.fileName + '\" target=_blank>' + curRes.url + '</a> "
+ " (' + curRes.contentType + ')</li>');\n"
+ "}\n"
+ "</script>\n"
+ "</ol>"
+ "</body></html>";
FileUtils.writeStringToFile(summary, content, TextUtil.DEFAULT_CHARSET);
LOG.info("Summary will be in " + summary.getAbsolutePath());
}
}
| [
"mguillem@5f5364db-9458-4db8-a492-e30667be6df6"
] | mguillem@5f5364db-9458-4db8-a492-e30667be6df6 |
740662083ac12ce18182c4162d8971ad317294a2 | dc090f1f6ef6b6cfee6fa47c944606c9437e3de7 | /SACEM version2/src/java/Beans/PersonaBean.java | 80ca5877ee0d3fcfd2e400d156683fd3e49df609 | [] | no_license | SW-2/Miraflores | 246ead3957ae80c085f2bcd7685b243a2fbdca0c | 5fe14957801609816ceca887382330a6f60ef523 | refs/heads/master | 2021-01-25T04:09:00.767717 | 2013-08-10T19:02:56 | 2013-08-10T19:02:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,212 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Beans;
import Clases.Persona;
import java.io.Serializable;
import java.util.ArrayList;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import logica.EstudianteLogic;
import logica.PadreFamiliaLogic;
import logica.PersonaLogic;
import logica.ProfesorLogic;
import org.primefaces.event.SelectEvent;
import org.primefaces.event.UnselectEvent;
/**
*
* @author Jorge Garcia
*/
@ManagedBean
@SessionScoped
public class PersonaBean implements Serializable{
private String query;
private Persona selectedPersona;
private Persona nuevoEstudiante;
private Persona nuevoRepresentante;
PersonaDataModel results;
PersonaLogic pl;
/**
* Creates a new instance of personaController
*/
public PersonaBean(){
pl = new PersonaLogic();
nuevoEstudiante = new Persona();
nuevoRepresentante = new Persona();
}
public Persona getNuevoEstudiante() {
return nuevoEstudiante;
}
public void setNuevoEstudiante(Persona nuevoEstudiante) {
this.nuevoEstudiante = nuevoEstudiante;
}
public Persona getNuevoRepresentante() {
return nuevoRepresentante;
}
public void setNuevoRepresentante(Persona nuevoRepresentante) {
this.nuevoRepresentante = nuevoRepresentante;
}
public PersonaDataModel getResults() {
if (results == null) {
search();
}
return results;
}
public String getQuery(){
return query;
}
public void setQuery(String s){
this.query = s;
}
public Persona getSelectedPersona() {
return selectedPersona;
}
public void setSelectedPersona(Persona selectedPersona) {
this.selectedPersona = selectedPersona;
}
public void search(){
System.out.println("APELLIDO A BUSCAR -------------->"+query);
pl = new PersonaLogic();
results = new PersonaDataModel(pl.buscarPorApellidos(query));
}
public void onRowSelect(SelectEvent event) {
FacesMessage msg = new FacesMessage("Persona Seleccionada", ((Persona) event.getObject()).getPerApellidos()+" "+((Persona) event.getObject()).getPerNombres() );
FacesContext.getCurrentInstance().addMessage(null, msg);
}
public void onRowUnselect(UnselectEvent event) {
FacesMessage msg = new FacesMessage("Persona Seleccionada", ((Persona) event.getObject()).getPerCedula());
FacesContext.getCurrentInstance().addMessage(null, msg);
}
public void hacerEstudiante(){
EstudianteLogic el = new EstudianteLogic();
System.out.println("en hacer estudiante -------------");
el.guardarEstudiante2(selectedPersona);
}
public void hacerProfesor(){
ProfesorLogic pl = new ProfesorLogic();
System.out.println("en hacer Profesor -------------");
pl.guardarProfesor2(selectedPersona);
}
public void guardarNuevo(String parent){
EstudianteLogic el = new EstudianteLogic();
PadreFamiliaLogic pfl = new PadreFamiliaLogic();
System.out.println("estudiante: "+nuevoEstudiante.getPerApellidos());
System.out.println("representante: "+nuevoRepresentante.getPerApellidos());
System.out.println("PArentesco: "+parent);
int estId = pl.guardarPersona2(nuevoEstudiante);
int repId = pl.guardarPersona2(nuevoRepresentante);
if( estId != 0){
if(repId != 0){
//estan registradas las 2 personas
el.guardarEstudiante2(pl.buscarUnica(""+estId));
if(pfl.guardarRelacion(""+repId, ""+estId, parent)){
System.out.println("Se guardo correctamente la relacion");
}
}
}
}
public void hazAlgo(){
System.out.println("estudiante: "+nuevoEstudiante.getPerNombres());
}
}
| [
"josc_info@hotmail.com"
] | josc_info@hotmail.com |
831a0d23d0ca24613a561268ce480d97e0b5f3fb | 4550748c37ac82ae179e3e55b4ab37bfd353b685 | /src/com/mm/pojo/Exam.java | c9699e32a89b9527d19af689e4fcda94d0f0fd7a | [] | no_license | poornaa/Automated-College-Result-Management-System- | 39b2a2fe58ff415ced4a524a91459927efe4ef7e | cf41f980de07109e2b8830739ff500d4ee5bf0a6 | refs/heads/master | 2023-06-18T18:59:23.813723 | 2018-04-06T14:29:59 | 2018-04-06T14:29:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,348 | java | package com.mm.pojo;
/**
* @author Kaustubh Devkar
*
*/
public class Exam {
private int id;
private String exam_name,branch,year;
private int sem;
private String batch;
private int insem_max,endsem_max,prac_max,tw_max,oral_max;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getExam_name() {
return exam_name;
}
public void setExam_name(String exam_name) {
this.exam_name = exam_name;
}
public String getBranch() {
return branch;
}
public void setBranch(String branch) {
this.branch = branch;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public int getSem() {
return sem;
}
public void setSem(int sem) {
this.sem = sem;
}
public String getBatch() {
return batch;
}
public void setBatch(String batch) {
this.batch = batch;
}
public int getInsem_max() {
return insem_max;
}
public void setInsem_max(int insem_max) {
this.insem_max = insem_max;
}
public int getEndsem_max() {
return endsem_max;
}
public void setEndsem_max(int endsem_max) {
this.endsem_max = endsem_max;
}
public int getPrac_max() {
return prac_max;
}
public void setPrac_max(int prac_max) {
this.prac_max = prac_max;
}
public int getTw_max() {
return tw_max;
}
public void setTw_max(int tw_max) {
this.tw_max = tw_max;
}
public int getOral_max() {
return oral_max;
}
public void setOral_max(int oral_max) {
this.oral_max = oral_max;
}
public Exam(int id, String exam_name, String branch, String year, int sem, String batch, int insem_max, int endsem_max,
int prac_max, int tw_max, int oral_max) {
super();
this.id = id;
this.exam_name = exam_name;
this.branch = branch;
this.year = year;
this.sem = sem;
this.batch = batch;
this.insem_max = insem_max;
this.endsem_max = endsem_max;
this.prac_max = prac_max;
this.tw_max = tw_max;
this.oral_max = oral_max;
}
public Exam(String exam_name, String branch, String year, int sem, String batch, int insem_max, int endsem_max,
int prac_max, int tw_max, int oral_max) {
super();
this.exam_name = exam_name;
this.branch = branch;
this.year = year;
this.sem = sem;
this.batch = batch;
this.insem_max = insem_max;
this.endsem_max = endsem_max;
this.prac_max = prac_max;
this.tw_max = tw_max;
this.oral_max = oral_max;
}
public Exam() {
super();
// TODO Auto-generated constructor stub
}
}
| [
"kdevkar1998@gmail.com"
] | kdevkar1998@gmail.com |
3d24f999728c3835f3e90aa8e321b8046aa80a24 | 8b54d6c461189278ace5336fd8e86aa8f812c244 | /toolbar/src/main/java/de/marza/firstspirit/modules/logging/toolbar/LoggingViewToolbarItem.java | 4ff55c6e6eaeedd14a8e2d3ce4965b8445993f08 | [
"MIT"
] | permissive | zaplatynski/second-hand-log | 27136e0382e9a9e348a7f88bb083be3bd4520330 | 91de1204f60d4996d67ab5f1e42df772a131efa1 | refs/heads/master | 2020-02-26T15:44:20.500738 | 2018-09-22T15:44:15 | 2018-09-22T15:44:15 | 56,872,793 | 10 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,827 | java | package de.marza.firstspirit.modules.logging.toolbar;
import de.espirit.firstspirit.agency.ProjectAgent;
import de.espirit.firstspirit.client.plugin.toolbar.ExecutableToolbarItem;
import de.espirit.firstspirit.client.plugin.toolbar.ToolbarContext;
import de.marza.firstspirit.modules.logging.console.ConsoleWindow;
import org.jetbrains.annotations.NotNull;
import java.util.ResourceBundle;
import javax.swing.Icon;
/**
* The type Create experiment site architect toolbar item.
*/
public final class LoggingViewToolbarItem implements ExecutableToolbarItem {
private final ResourceBundle menuLabels;
private final ConsoleWindow consoleWindow;
/**
* Instantiates a new Logging view toolbar item.
*/
public LoggingViewToolbarItem() {
consoleWindow = ConsoleWindow.getInstance();
menuLabels = consoleWindow.getMenuLabels();
}
@Override
public void execute(@NotNull final ToolbarContext context) {
final ProjectAgent projectAgent = context.requireSpecialist(ProjectAgent.TYPE);
final String projectName = projectAgent.getName(); //NOPMD
consoleWindow.show(projectName);
}
@Override
public String getLabel(@NotNull final ToolbarContext context) {
return menuLabels.getString("appName");
}
@Override
public boolean isEnabled(@NotNull final ToolbarContext context) {
return true;
}
@Override
public boolean isVisible(@NotNull final ToolbarContext context) {
return true;
}
@Override
public Icon getIcon(@NotNull final ToolbarContext context) {
return consoleWindow.getIcon();
}
@Override
public Icon getPressedIcon(@NotNull final ToolbarContext context) {
return consoleWindow.getImageIconPressed();
}
@Override
public Icon getRollOverIcon(@NotNull final ToolbarContext context) {
return consoleWindow.getIcon();
}
}
| [
"marian.zaplatynski@gmail.com"
] | marian.zaplatynski@gmail.com |
0f5fac4651c0cda3aaa61d62f1b366214a487572 | 5aaebaafeb75c7616689bcf71b8dd5ab2c89fa3b | /src/ANXGallery/sources/com/xiaomi/metoknlp/devicediscover/f.java | 5cb24a8248e4a28f555c726c866b62e24aa33115 | [] | no_license | gitgeek4dx/ANXGallery9 | 9bf2b4da409ab16492e64340bde4836d716ea7ec | af2e3c031d1857fa25636ada923652b66a37ff9e | refs/heads/master | 2022-01-15T05:23:24.065872 | 2019-07-25T17:34:35 | 2019-07-25T17:34:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,891 | java | package com.xiaomi.metoknlp.devicediscover;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.HandlerThread;
import android.os.Message;
import com.xiaomi.metoknlp.MetokApplication;
import com.xiaomi.metoknlp.a;
/* compiled from: WifiCampStatistics */
public class f {
private static final long H = (a.h() ? 30000 : 1800000);
private static final Object mLock = new Object();
private ConnectivityManager I;
private o J;
private b K;
/* access modifiers changed from: private */
public n L;
private Context mContext;
private HandlerThread mHandlerThread;
private BroadcastReceiver mReceiver = new k(this);
static {
a.g();
}
public f(Context context) {
this.mContext = context;
}
private boolean A() {
if (!a.g().m()) {
return true;
}
long n = a.g().n();
if (n == Long.MAX_VALUE) {
n = 172800000;
}
this.K.d();
return this.K.getDuration() > n;
}
private boolean B() {
long c = this.K.c();
long l = a.g().l();
if (l == Long.MAX_VALUE) {
l = 172800000;
}
return System.currentTimeMillis() - c > l;
}
private void C() {
this.J.a(this.K.a(), this.K.b(), this.K.getDuration());
}
private void D() {
this.mContext.registerReceiver(this.mReceiver, new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE"));
}
private void E() {
if (this.L.hasMessages(1)) {
this.L.removeMessages(1);
}
if (this.L.hasMessages(2)) {
this.L.removeMessages(2);
}
this.mContext.unregisterReceiver(this.mReceiver);
}
/* access modifiers changed from: private */
public void a(boolean z) {
NetworkInfo networkInfo = null;
try {
if (!(this.mContext == null || this.mContext.getPackageManager().checkPermission("android.permission.ACCESS_NETWORK_STATE", this.mContext.getPackageName()) != 0 || this.I == null)) {
networkInfo = this.I.getActiveNetworkInfo();
}
} catch (Exception unused) {
}
if (this.K != null) {
if (networkInfo == null || networkInfo.getType() != 1 || !networkInfo.isConnected()) {
this.K.f();
} else {
String a = i.a(this.mContext, 1);
if (this.K.a() == null || !this.K.a().equals(a)) {
this.K.a(a);
}
if (this.L.hasMessages(2)) {
this.L.removeMessages(2);
}
Message obtainMessage = this.L.obtainMessage(2);
long j = H;
obtainMessage.obj = Boolean.valueOf(z);
if (z) {
this.L.sendMessage(obtainMessage);
} else {
this.L.sendMessageDelayed(obtainMessage, j);
}
}
}
}
/* access modifiers changed from: private */
public void b(boolean z) {
if (!a.g().k()) {
return;
}
if (z || (z() && B() && A())) {
C();
this.K.e();
this.K.save();
}
}
private int getFetchDeviceWay() {
try {
return ((MetokApplication) this.mContext).getFetchDeviceWay();
} catch (Exception unused) {
return 0;
}
}
private boolean z() {
long currentTimeMillis = System.currentTimeMillis();
long b = this.K.b();
long o = a.g().o();
if (o == Long.MAX_VALUE) {
o = H;
}
String a = this.K.a();
return a != null && a.equals(i.a(this.mContext, 1)) && currentTimeMillis - b >= o;
}
public void F() {
synchronized (mLock) {
this.J = null;
}
}
public void a(o oVar) {
synchronized (mLock) {
this.J = oVar;
}
}
public void fecthDeviceImmediately() {
a(true);
}
public void start() {
this.K = new b(this.mContext);
this.I = (ConnectivityManager) this.mContext.getSystemService("connectivity");
this.mHandlerThread = new HandlerThread("WifiCampStatics");
this.mHandlerThread.start();
this.L = new n(this, this.mHandlerThread.getLooper());
if (getFetchDeviceWay() == 0) {
D();
}
}
public void stop() {
if (getFetchDeviceWay() == 0) {
E();
}
this.I = null;
this.K.reset();
if (this.mHandlerThread != null) {
this.mHandlerThread.quitSafely();
this.mHandlerThread = null;
}
}
}
| [
"sv.xeon@gmail.com"
] | sv.xeon@gmail.com |
75795e5a5ecdf7774ac50ea0f7bb3cb98df6185d | fcd2fbd398150a3f2ecbe700b22bfd50d522faf7 | /src/main/java/com/srl/srlbi/repo/PurchaseOrderDAO.java | bd28dfa851048933d08756c453f44d9d6b702462 | [] | no_license | nvselva/srl-bi | 833ce50e5848df3e5b97ee16e713857b615b0fbc | f16e76e3ec42674abd01b7aa46cb94ed7f049fa2 | refs/heads/master | 2020-04-04T15:19:47.884783 | 2018-11-04T23:38:34 | 2018-11-04T23:38:34 | 156,033,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package com.srl.srlbi.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.srl.srlbi.model.Purchase_order;
@Repository
public interface PurchaseOrderDAO extends JpaRepository <Purchase_order, Long> {
}
| [
"nvselva@gmail.com"
] | nvselva@gmail.com |
92dbc18ad7e1f5601676fb7b6a023be384621794 | 1e5634ff0818730bcece11850b88f95523ef8543 | /Group_Timer/Wombat/src/dk/aau/cs/giraf/wombat/SubProfileFragment.java | 925bd460e959205ae1b3a3c9bc82015fb486feb2 | [] | no_license | andreoramos/sw6-2012 | c75972b19697c0f12c4ef40247d811b0422fb6fe | 0213a03f277dd1a97ee4cdc42590c4f1a0fec3ec | refs/heads/master | 2016-09-06T12:36:23.904814 | 2012-06-24T15:10:38 | 2012-06-24T15:10:38 | 36,255,253 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,344 | java | package dk.aau.cs.giraf.wombat;
import java.util.ArrayList;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import dk.aau.cs.giraf.TimerLib.Guardian;
import dk.aau.cs.giraf.TimerLib.SubProfile;
import dk.aau.cs.giraf.oasis.lib.Helper;
public class SubProfileFragment extends android.app.ListFragment {
Guardian guard = Guardian.getInstance();
ListView thisListView;
@Override
// Start the list empty
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if(guard.profileID >= 0){
Helper helper = new Helper(getActivity());
int position;
// Marks the selected profile in the guard singleton
position = guard.publishList().indexOf(helper.profilesHelper.getProfileById(guard.profileID));
if(position != -1){
guard.publishList().get(position).select();
ArrayList<SubProfile> subprofiles = guard.getChild().SubProfiles();
SubProfileAdapter adapter = new SubProfileAdapter(getActivity(),
android.R.layout.simple_list_item_1, subprofiles);
setListAdapter(adapter);
}
else {
setListAdapter(null);
}
}else {
setListAdapter(null);
}
ListView lv = getListView();
lv.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> arg0, View v,
final int row, long arg3) {
TextView tv = new TextView(getActivity());
tv.setText(getString(R.string.delete_description) + " " + guard.getChild().SubProfiles().get(row).name + "?");
tv.setTextColor(0xFFFFFFFF);
final WDialog deleteDialog = new WDialog(getActivity(), R.string.delete_subprofile_message);
deleteDialog.addTextView(getString(R.string.delete_description) + " " + guard.getChild().SubProfiles().get(row).name + "?", 1);
deleteDialog.addButton(R.string.delete_yes, 2, new View.OnClickListener() {
public void onClick(View v) {
if (guard.getChild() != null && guard.getChild().deleteCheck()) {
guard.getChild().SubProfiles().get(row)
.delete();
CustomizeFragment cf = (CustomizeFragment) getFragmentManager()
.findFragmentById(R.id.customizeFragment);
cf.setDefaultProfile();
Toast t = Toast.makeText(getActivity(),
R.string.delete_subprofile_toast,
5000);
t.show();
loadSubProfiles();
} else {
Toast t = Toast.makeText(getActivity(),
R.string.cannot_delete_subprofile_toast, 5000);
t.show();
}
deleteDialog.dismiss();
}
});
deleteDialog.addButton(R.string.delete_no, 3, new View.OnClickListener() {
public void onClick(View v) {
deleteDialog.cancel();
}
});
deleteDialog.show();
return true;
}
});
}
@Override
public void onResume() {
super.onResume();
loadSubProfiles();
}
/**
* Inserts the templates on profile id in the details list
*
*/
public void loadSubProfiles() {
if(guard.getChild() != null){
ArrayList<SubProfile> subprofiles = guard.getChild().SubProfiles();
SubProfileAdapter adapter = new SubProfileAdapter(getActivity(),
android.R.layout.simple_list_item_1, subprofiles);
setListAdapter(adapter);
}
}
public void onListItemClick(ListView lv, View view, int position, long id) {
if (guard.subProfileFirstClick) {
for (int i = 0; i < lv.getChildCount(); i++) {
lv.getChildAt(i).setBackgroundResource(R.drawable.list);
}
guard.subProfileFirstClick = false;
}
for (int i = 0; i < lv.getChildCount(); i++) {
lv.getChildAt(i).setSelected(false);
}
view.setSelected(true);
guard.subProfileID = guard.getChild().SubProfiles().get(position).getId();
@SuppressWarnings("unused")
SubProfile asd = guard.getChild().SubProfiles().get(position);
CustomizeFragment fragment = (CustomizeFragment) getFragmentManager()
.findFragmentById(R.id.customizeFragment);
fragment.loadSettings(guard.getChild().SubProfiles().get(position));
}
}
| [
"rasmus5034@gmail.com@c0638ea9-114b-2d6f-4d9a-f24ace1891a2"
] | rasmus5034@gmail.com@c0638ea9-114b-2d6f-4d9a-f24ace1891a2 |
4179b552507496caa03713ae6e98cfe7e552198a | 36155fc6d1b1cd36edb4b80cb2fc2653be933ebd | /lc/src/LC/SOL/NaryTreePreorderTraversal.java | a1bf01a935b28acb8f45d3bab54c0a440ce53246 | [] | no_license | Delon88/leetcode | c9d46a6e29749f7a2c240b22e8577952300f2b0f | 84d17ee935f8e64caa7949772f20301ff94b9829 | refs/heads/master | 2021-08-11T05:52:28.972895 | 2021-08-09T03:12:46 | 2021-08-09T03:12:46 | 96,177,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 740 | java | package LC.SOL;
import java.util.ArrayList;
import java.util.List;
public class NaryTreePreorderTraversal {
class Node {
public int val;
public List<Node> children;
public Node() {}
public Node(int _val,List<Node> _children) {
val = _val;
children = _children;
}
};
class Solution {
List<Integer> ret;
public List<Integer> preorder(Node root) {
ret = new ArrayList<>();
pre(root);
return ret;
}
void pre(Node root) {
if ( root == null ) return;
ret.add(root.val);
for ( Node ch : root.children) {
pre(ch);
}
}
}
}
| [
"Mr.AlainDelon@gmail.com"
] | Mr.AlainDelon@gmail.com |
8769a16696800fe4792d6228af14cf96a0584842 | 1fa6cf2fe133ecfe3ddc7d821fb64975abeaf81c | /app/src/main/java/bharatia/com/bharatia/Adapter/PostAdapter.java | 5053f8d654cab5d79f3781a8628d25b4a72dc27f | [] | no_license | Ratul-Bin-Tazul/Bharatia | 9ce3b4f93f8e0992600921c9889a9cf4b4a0ad3d | 62f288415c0d8d1a053d8d1c855412073474db90 | refs/heads/master | 2020-04-22T06:04:05.010704 | 2019-08-05T20:59:01 | 2019-08-05T20:59:01 | 170,177,953 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,934 | java | package bharatia.com.bharatia.Adapter;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Build;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.support.v7.widget.CardView;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.bumptech.glide.Glide;
import java.util.ArrayList;
import java.util.List;
import bharatia.com.bharatia.DataModel.Post;
import bharatia.com.bharatia.PostDetailsActivity;
import bharatia.com.bharatia.R;
/**
* Created by SAMSUNG on 9/16/2017.
*/
public class PostAdapter extends RecyclerView.Adapter<PostAdapter.PostHolder>{
private ArrayList<Post> arrayList;
private Context context;
public PostAdapter(ArrayList<Post> arrayList, Context ctx) {
this.arrayList = arrayList;
this.context = ctx;
}
@Override
public PostAdapter.PostHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_item_layout,parent,false);
PostAdapter.PostHolder PostHolder = new PostAdapter.PostHolder(view);
return PostHolder;
}
@Override
public void onBindViewHolder(final PostHolder holder, final int position) {
final Post post = arrayList.get(position);
//holder.message.setText(Post.getMessage());
//holder.messageSent.setText(Post.getMessage());
Calendar c = Calendar.getInstance();
int year = c.get(Calendar.YEAR);
int month = c.get(Calendar.MONTH);
int day = c.get(Calendar.DAY_OF_MONTH);
//int year = c.get(Calendar.YEAR);
//System.out.println("Current time => " + c.getTime());
SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
String formattedDate = df.format(c.getTime());
try {
String[] date = post.getDate().split("-");
int diff;
if(year != Integer.parseInt(date[0])) {
diff = year - Integer.parseInt(date[0]);
holder.postTime.setText(diff+ context.getString(R.string.post_item_years_ago));
}else {
if(month+1 != Integer.parseInt(date[1])) {
diff = month+1 - Integer.parseInt(date[1]);
holder.postTime.setText(diff+context.getString(R.string.post_item_months_ago));
}else {
if(day != Integer.parseInt(date[2])) {
diff = day - Integer.parseInt(date[2]);
if(diff>7) {
diff = diff%7;
holder.postTime.setText(diff + context.getString(R.string.post_item_weeks_ago));
}else{
holder.postTime.setText(diff + context.getString(R.string.post_item_days_ago));
}
}else {
holder.postTime.setText(R.string.post_item_posted_today);
}
}
}
}catch (Exception e) {
holder.postTime.setText(R.string.post_item_uknown_time);
}
holder.postCall.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:"+post.getPhoneNo()));
context.startActivity(intent);
}
});
holder.postMail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto: "+post.getEmail()));
context.startActivity(Intent.createChooser(emailIntent, "Choose email sender"));
}
});
holder.postMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("https://www.google.com/maps/dir/?api=1&destination="+post.getLat()+","+post.getLon()));
context.startActivity(intent);
}
});
holder.area.setText(post.getArea());
holder.price.setText(context.getString(R.string.post_item_tk)+post.getPrice());
holder.room.setText(post.getRoomNo()+context.getString(R.string.post_item_room));
holder.size.setText(post.getSize()+context.getString(R.string.post_item_sqft));
holder.postType.setText(post.getType2().toUpperCase());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
holder.postImg.setClipToOutline(true);
}
if(post.getCoverPhoto()!=null) {
Glide
.with(context)
.load(post.getCoverPhoto())
.into(holder.postImg);
}
holder.card.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(context,PostDetailsActivity.class);
i.putExtra("postId",post.getPostID());
i.putExtra("photoLink",post.getCoverPhoto());
i.putExtra("area",post.getArea());
i.putExtra("price",post.getPrice());
i.putExtra("room",post.getRoomNo());
i.putExtra("size",post.getSize());
i.putExtra("address",post.getAddress());
i.putExtra("description",post.getDescription());
i.putExtra("phone",post.getPhoneNo());
i.putExtra("email",post.getEmail());
i.putExtra("lat",post.getLat());
i.putExtra("lon",post.getLon());
i.putExtra("type1",post.getType1());
i.putExtra("type2",post.getType2());
context.startActivity(i);
}
});
}
@Override
public int getItemCount() {
return arrayList.size();
}
public class PostHolder extends RecyclerView.ViewHolder {
public TextView room,size,area,price,postType,postTime;
public ImageView postImg,postCall,postMail,postMap;
public RelativeLayout card;
public PostHolder(final View itemView) {
super(itemView);
area = (TextView)itemView.findViewById(R.id.area);
price = (TextView)itemView.findViewById(R.id.price);
room = (TextView)itemView.findViewById(R.id.room);
size = (TextView)itemView.findViewById(R.id.size);
postType = (TextView)itemView.findViewById(R.id.postType);
postTime = (TextView)itemView.findViewById(R.id.postTime);
postImg = (ImageView) itemView.findViewById(R.id.postImg);
card = (RelativeLayout) itemView.findViewById(R.id.postCard);
postCall = itemView.findViewById(R.id.postCall);
postMail = itemView.findViewById(R.id.postMail);
postMap = itemView.findViewById(R.id.postMap);
}
}
}
| [
"ratul38@gmail.com"
] | ratul38@gmail.com |
0d2868ec262c3ebaa9a6895ba907340382405d4f | 8f97f036d36c56401ea67bf084ee56254bb122ed | /src/com/manyanger/ui/CategoryActivity.java | 2e4d47f0eb70b96abce0721b9adadb374fb3b968 | [] | no_license | yzff/Otooman | bc88205d8b840c7b34d3ecee17b3c2887e872326 | 5842f448c011445e21881c6954d86923672e937f | refs/heads/master | 2021-01-19T14:33:21.767617 | 2014-07-01T03:07:10 | 2014-07-01T03:07:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,541 | java | package com.manyanger.ui;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Message;
import android.os.SystemClock;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.ListFragment;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import com.google.common.base.Constants;
import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
import com.manyanger.GlobalData;
import com.manyanger.adapter.CategoryAdapter;
import com.manyanger.common.ToastUtil;
import com.manyanger.data.ComicThemeDataLoader;
import com.manyanger.data.OnDataLoadedListener;
import com.manyanger.entries.BaseThemeItem;
import com.manyanger.ui.widget.TipDialog;
import com.manyounger.otooman.R;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName: CategoryActivity
* @Description: 漫画分类列表
* @author Zephan.Yu
* @date 2014-6-19 下午11:16:05
*/
public class CategoryActivity extends SlidingFragmentActivity implements OnDataLoadedListener,
OnItemClickListener, OnClickListener {
// UI
private GridView gv_gategory;
// DATA
private CategoryAdapter mCategoryAdapter;
private List<BaseThemeItem> categorys;
private ComicThemeDataLoader mComicThemeDataLoader;
private SlidingMenu sm;
protected ListFragment mFrag;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GlobalData.cateActivity = this;
setContentView(R.layout.category);
// set the Behind View
setBehindContentView(R.layout.menu_frame);
if (savedInstanceState == null) {
FragmentTransaction t = this.getSupportFragmentManager()
.beginTransaction();
// mFrag = new SampleListFragment();
// t.replace(R.id.menu_frame, mFrag);
t.commit();
} else {
mFrag = (ListFragment) this.getSupportFragmentManager()
.findFragmentById(R.id.menu_frame);
}
// customize the SlidingMenu
sm = getSlidingMenu();
sm.setShadowWidthRes(R.dimen.shadow_width);
sm.setShadowDrawable(R.drawable.shadow);
sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
sm.setFadeDegree(0.35f);
// sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
initMenuView();
gv_gategory = (GridView) findViewById(R.id.gv_gategory);
gv_gategory.setOnItemClickListener(this);
categorys = GlobalData.getCategorys();
if(categorys == null || categorys.size() == 0){
mComicThemeDataLoader = new ComicThemeDataLoader(this);
mComicThemeDataLoader.loadThemeList();
TipDialog.showWait(this, null);
} else {
mCategoryAdapter = new CategoryAdapter(this, categorys,
gv_gategory.getNumColumns());
gv_gategory.setAdapter(mCategoryAdapter);
}
}
private void initMenuView() {
View mainBtn = findViewById(R.id.btn_main);
if (mainBtn != null) {
mainBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(CategoryActivity.this,
MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
sm.showContent();
// finish();
}
});
}
View mineBtn = findViewById(R.id.btn_mine);
if (mineBtn != null) {
mineBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(CategoryActivity.this,
MyComicActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
sm.showContent();
// finish();
}
});
}
View catoryBtn = findViewById(R.id.btn_catory);
if (catoryBtn != null) {
catoryBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
sm.showContent();
}
});
}
}
@SuppressWarnings("unchecked")
@Override
public void OnDataLoaded(Message msg) {
if (msg.what == GlobalData.NOTIFY_COMICTHEME_LOADED) {
categorys = (List<BaseThemeItem>) msg.obj;
// TODO 问题 暂时处理,NULL也传回来了,增加错误管理
if (categorys == null)
categorys = new ArrayList<BaseThemeItem>();
mCategoryAdapter = new CategoryAdapter(this, categorys,
3); //gv_gategory.getNumColumns());
gv_gategory.setAdapter(mCategoryAdapter);
GlobalData.setCategorys(categorys);
TipDialog.dissmissTip();
}
}
@Override
protected void onDestroy() {
super.onDestroy();
GlobalData.cateActivity = null;
if(mComicThemeDataLoader != null){
mComicThemeDataLoader.unregisteOnDataLoadedListener(this);
}
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
final BaseThemeItem mBaseThemeItem = (BaseThemeItem) mCategoryAdapter
.getItem(arg2);
startComicListActivity(mBaseThemeItem.getId(),
mBaseThemeItem.getTitle());
}
private void startComicListActivity(int id, String title) {
Intent intent = new Intent(CategoryActivity.this,
ComicListActivity.class);
intent.putExtra(GlobalData.STR_TITLE, title);
intent.putExtra(GlobalData.STR_LISTTYPE, Constants.COMIC_LIST_TYPE_THEME);
intent.putExtra(GlobalData.STR_LISTID, id);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
// case R.id.back_btn:
// finish();
// break;
case R.id.menu_btn:
toggle();
break;
default:
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
sm.showMenu();
return true;
}
@Override
public void onBackPressed()
{
ToastUtil.cancel();
//“提示再按一次可退出..”
toastExtrance();
}
private static long trigleCancel;
protected void toastExtrance()
{
final long uptimeMillis = SystemClock.uptimeMillis();
if (uptimeMillis - trigleCancel > 2000)
{
trigleCancel = uptimeMillis;
ToastUtil.showToastShort(getString(R.string.note_exit));
}
else
{
if(GlobalData.homeActivity != null){
GlobalData.homeActivity.finish();
}
if(GlobalData.myActivity != null){
GlobalData.myActivity.finish();
}
finish();
System.exit(0);
}
}
}
| [
"yuzhif@gmail.com"
] | yuzhif@gmail.com |
f9bfd65cc3af67e4494bf709bd500fac00cd5c34 | 266bae0259ba70bd9e42e7125e0240383b838229 | /MyMvp/app/src/main/java/com/android/mp/view/NewClassTest.java | 4479d1f73218c4e38d22dd274f80a9a79bf65783 | [] | no_license | rualham/my_mvp_demo | fecdf32e909cd304f8f9756afe9bb9d1c674933e | a7a3ad987d1d11089e9966b975a61092b9e01180 | refs/heads/main | 2023-08-15T11:06:06.489600 | 2021-10-08T03:28:03 | 2021-10-08T03:28:03 | 398,189,391 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 173 | java | package com.android.mp.view;
/**
* @author david
* @date 2021/8/21 1:21
* @description V层接口,定义V层需要作出的动作的接口
*/
class NewClassTest {
}
| [
"672724425@qq.com"
] | 672724425@qq.com |
8d54695dc69dd3b3bc502c5f24ad69ff76cd14bb | 489d94c38293450a3094855d136a5fe207c12aea | /app/src/main/java/com/bsreeinf/jobapp/util/CompanyContainer.java | a781de14d64306fa83c844970b9d97d9f8847bcf | [] | no_license | VikramHaridas/iparttime-android | ae35482ca0190a4ad81f37e40ff29ba7ee41065b | c0e8f0a520851a0a24f81ca6799f707a722b2d77 | refs/heads/master | 2021-05-29T07:05:37.718165 | 2015-08-12T16:41:47 | 2015-08-12T16:41:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,452 | java | package com.bsreeinf.jobapp.util;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import java.util.ArrayList;
import java.util.List;
/**
* Created by bsreeinf on 06/07/15.
*/
public class CompanyContainer {
List<Company> listCoimpanies;
public CompanyContainer(JsonArray companies) {
listCoimpanies = new ArrayList<>();
for (int i = 0; i < companies.size(); i++) {
listCoimpanies.add(new Company(companies.get(i).getAsJsonObject()));
}
}
public Company getCompanyByID(String id) {
for (int i = 0; i < listCoimpanies.size(); i++) {
if (id.equals(listCoimpanies.get(i).getId()))
return listCoimpanies.get(i);
}
return null;
}
public List<SimpleContainer.SimpleBlock> getElementList() {
List<SimpleContainer.SimpleBlock> elementList = new ArrayList<>();
for (int i = 0; i < listCoimpanies.size(); i++) {
String id = listCoimpanies.get(i).getId();
String title = listCoimpanies.get(i).getName();
elementList.add(new SimpleContainer.SimpleBlock(id, title));
}
return elementList;
}
public class Company {
private String id;
private String company_id;
private String name;
private String phone;
private String email;
private String pan;
private boolean is_verified;
public Company(JsonObject company) {
this.id = company.get("id").getAsString();
this.company_id = company.get("company_id").getAsString();
this.name = company.get("name").getAsString();
this.phone = company.get("phone").getAsString();
this.email = company.get("email").getAsString();
this.pan = company.get("pan").getAsString();
this.is_verified = company.get("is_verified").getAsBoolean();
}
public String getId() {
return id;
}
public String getCompany_id() {
return company_id;
}
public String getName() {
return name;
}
public String getPhone() {
return phone;
}
public String getEmail() {
return email;
}
public String getPan() {
return pan;
}
public boolean getIs_verified() {
return is_verified;
}
}
}
| [
"bsreeinf@gmail.com"
] | bsreeinf@gmail.com |
5d1418d1bcfa91ebd108aa753acdb36e8ecca0eb | 6af080903b77fa00526e2ad2863b5f65f26fc1b8 | /data-mining/src/datamining/test/Driver.java | ead82864000b9909dc86bff9581eda4f026cb3db | [] | no_license | tarunjr/datascience | dfd0911a29044510e9f58fe2f24a842bffe46ecc | 0051787137b047de0a4b6341802781feed163bf1 | refs/heads/master | 2016-09-06T02:10:10.921052 | 2015-08-03T04:56:17 | 2015-08-03T04:56:17 | 40,104,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,368 | java | package datamining.test;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;
import datamining.base.Data;
import datamining.base.Matrix;
import datamining.classification.CondensedNearestNeighbour;
import datamining.classification.NearestNeighbourClassifier;
import datamining.clustering.Cluster;
import datamining.clustering.KMeansClustering;
public class Driver {
public static void main(String[] args)
{
Driver d = new Driver();
// Default file to use if none specified on command line
String inputDataSetFile = "C:/iris.data";
if(args.length > 0)
inputDataSetFile = args[0];
Matrix allDataSet = d.getAllData(inputDataSetFile);
Data data = d.getData(inputDataSetFile, 0.6);
Matrix trainingDataSet = data.train;
Matrix testDataSet = data.test;
d.Assignment1_NN(trainingDataSet, testDataSet);
d.Assignment2_CNN(trainingDataSet, testDataSet);
d.Assignment3_KMeans(allDataSet);
}
public void Assignment1_NN(Matrix trainingDataSet, Matrix testDataSet)
{
int total = testDataSet.rowSize();
int correct = 0;
NearestNeighbourClassifier classifier = new NearestNeighbourClassifier(trainingDataSet);
for(int i=0; i < total;i++)
{
double[] testPattern = Arrays.copyOfRange(testDataSet.getRow(i),0,testDataSet.columnSize()-1);
double predictedClassValue = classifier.classify(testPattern);
double actualClassValue = testDataSet.get(i, testDataSet.columnSize()-1);
if(predictedClassValue == actualClassValue)
correct++;
}
report("NearestNeighbour Classifier (NN)", total, correct);
}
public void Assignment2_CNN(Matrix trainingDataSet, Matrix testDataSet)
{
int total = testDataSet.rowSize();
int correct = 0;
CondensedNearestNeighbour classifier = new CondensedNearestNeighbour(trainingDataSet);
for(int i=0; i < total;i++)
{
double[] testPattern = Arrays.copyOfRange(testDataSet.getRow(i),0,testDataSet.columnSize()-1);
double predictedClassValue = classifier.classify(testPattern);
double actualClassValue = testDataSet.get(i, testDataSet.columnSize()-1);
if(predictedClassValue == actualClassValue)
correct++;
}
report("CondensedNearestNeighbour Classifier (CNN)", total, correct);
classifier.printDiganostic();
}
public void Assignment3_KMeans(Matrix dataSet)
{
System.out.println("K= First 3 patterns");
int [] kIndexes = {0,1,2};
KMeansClustering clustering = new KMeansClustering(dataSet, kIndexes);
List<Cluster> clusters = clustering.getClusters();
clustering.printDiganostic();
System.out.println("K=First pattern from each class");
int [] kIndexes2 = {0,50,100};
KMeansClustering clustering2 = new KMeansClustering(dataSet, kIndexes2);
List<Cluster> clusters2 = clustering2.getClusters();
clustering2.printDiganostic();
System.out.println("K=3 random pattern from entire dataset");
int [] kIndexes3 = {95,145,73};
KMeansClustering clustering3 = new KMeansClustering(dataSet, kIndexes3);
List<Cluster> clusters3 = clustering3.getClusters();
clustering3.printDiganostic();
}
public void report(String header, int total, int classified)
{
System.out.println("---------------------------------------------");
System.out.println(header);
System.out.println("---------------------------------------------");
System.out.print("Total Patterns=");
System.out.println(total);
System.out.print("Classified Patterns=");
System.out.println(classified);
System.out.print("Mis-Classified Patterns=");
System.out.println(total-classified);
System.out.print("Classification Accuracy=");
double accuracy = ((double)classified / (double)total) * 100;
System.out.println(accuracy);
System.out.println("---------------------------------------------");
}
public Data getData(String file, double train_percentage)
{
InputStream fis = null;
BufferedReader br = null;
String line;
List<double[]> setosa = new ArrayList<double[]>();
List<double[]> versicolor= new ArrayList<double[]>();
List<double[]> virginica = new ArrayList<double[]>();
try {
fis = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(fis, Charset.forName("UTF-8")));
while ((line = br.readLine()) != null) {
StringTokenizer token = new StringTokenizer(line, ",");
if(token.countTokens() < 5)
continue;
double[] row = new double[5];
row[0] = new Double(token.nextToken());
row[1] = new Double(token.nextToken());
row[2] = new Double(token.nextToken());
row[3] = new Double(token.nextToken());
row[4] = discretize(token.nextToken());
if(row[4] == 1)
setosa.add(row);
else if(row[4] == 2)
versicolor.add(row);
else if(row[4] == 3)
virginica.add(row);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
int part = (int)(setosa.size() * train_percentage);
List<double[]> setosaTrain = setosa.subList(0, part);
List<double[]> setosaTest = setosa.subList(part, setosa.size());
part = (int)(versicolor.size() * train_percentage);
List<double[]> versicolorTrain = versicolor.subList(0, part);
List<double[]> versicolorTest = versicolor.subList(part, versicolor.size());
part = (int)(virginica.size() * train_percentage);
List<double[]> virginicaTrain = virginica.subList(0, part);
List<double[]> virginicaTest = virginica.subList(part, virginica.size());
Matrix train = new Matrix(virginicaTrain.size() + setosaTrain.size() + versicolorTrain.size(), 5);
int rowIndex = 0;
for(int i=0; i < setosaTrain.size();i++)
{
double[] row = setosaTrain.get(i);
train.add(rowIndex, 0, row[0]);
train.add(rowIndex, 1, row[1]);
train.add(rowIndex, 2, row[2]);
train.add(rowIndex, 3, row[3]);
train.add(rowIndex, 4, row[4]);
rowIndex++;
}
for(int i=0; i < versicolorTrain.size();i++)
{
double[] row = versicolorTrain.get(i);
train.add(rowIndex, 0, row[0]);
train.add(rowIndex, 1, row[1]);
train.add(rowIndex, 2, row[2]);
train.add(rowIndex, 3, row[3]);
train.add(rowIndex, 4, row[4]);
rowIndex++;
}
for(int i=0; i < virginicaTrain.size();i++)
{
double[] row = virginicaTrain.get(i);
train.add(rowIndex, 0, row[0]);
train.add(rowIndex, 1, row[1]);
train.add(rowIndex, 2, row[2]);
train.add(rowIndex, 3, row[3]);
train.add(rowIndex, 4, row[4]);
rowIndex++;
}
Matrix test = new Matrix(setosaTest.size() + versicolorTest.size() + virginicaTest.size(), 5);
rowIndex = 0;
for(int i=0; i < setosaTest.size();i++)
{
double[] row = setosaTest.get(i);
test.add(rowIndex, 0, row[0]);
test.add(rowIndex, 1, row[1]);
test.add(rowIndex, 2, row[2]);
test.add(rowIndex, 3, row[3]);
test.add(rowIndex, 4, row[4]);
rowIndex++;
}
for(int i=0; i < versicolorTest.size();i++)
{
double[] row = versicolorTest.get(i);
test.add(rowIndex, 0, row[0]);
test.add(rowIndex, 1, row[1]);
test.add(rowIndex, 2, row[2]);
test.add(rowIndex, 3, row[3]);
test.add(rowIndex, 4, row[4]);
rowIndex++;
}
for(int i=0; i < virginicaTest.size();i++)
{
double[] row = virginicaTest.get(i);
test.add(rowIndex, 0, row[0]);
test.add(rowIndex, 1, row[1]);
test.add(rowIndex, 2, row[2]);
test.add(rowIndex, 3, row[3]);
test.add(rowIndex, 4, row[4]);
rowIndex++;
}
Data d = new Data();
d.train = train;
d.test = test;
return d;
}
public Matrix getAllData(String file)
{
InputStream fis = null;
BufferedReader br = null;
String line;
List<double[]> patterns = new ArrayList<double[]>();
try {
fis = new FileInputStream(file);
br = new BufferedReader(new InputStreamReader(fis, Charset.forName("UTF-8")));
while ((line = br.readLine()) != null) {
StringTokenizer token = new StringTokenizer(line, ",");
if(token.countTokens() < 5)
continue;
double[] pattern = new double[5];
pattern[0] = new Double(token.nextToken());
pattern[1] = new Double(token.nextToken());
pattern[2] = new Double(token.nextToken());
pattern[3] = new Double(token.nextToken());
pattern[4] = discretize(token.nextToken());
patterns.add(pattern);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Matrix dataSet = new Matrix(patterns.size(), 5);
for(int i=0; i < patterns.size();i++)
{
double[] row = patterns.get(i);
dataSet.addRow(i, row);
}
return dataSet;
}
private double discretize(String variable)
{
double result = 1;
if(variable.equals("Iris-setosa"))
result = 1;
else if(variable.equals("Iris-versicolor"))
result = 2;
else if(variable.equals("Iris-virginica"))
result = 3;
return(result);
}
}
| [
"tarun_rathor@intuit.com"
] | tarun_rathor@intuit.com |
bc978ed436d91c3bea9096bfec9b914dedfcaffc | d436fade2ee33c96f79a841177a6229fdd6303b7 | /com/planet_ink/coffee_mud/Abilities/Prayers/Prayer_CureLight.java | f9dbf1c9f20024ffb859e66a4e8cbe3a38870268 | [
"Apache-2.0"
] | permissive | SJonesy/UOMUD | bd4bde3614a6cec6fba0e200ac24c6b8b40a2268 | 010684f83a8caec4ea9d38a7d57af2a33100299a | refs/heads/master | 2021-01-20T18:30:23.641775 | 2017-05-19T21:38:36 | 2017-05-19T21:38:36 | 90,917,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,024 | java | package com.planet_ink.coffee_mud.Abilities.Prayers;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;
import java.util.*;
/*
Copyright 2001-2017 Bo Zimmerman
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.
*/
public class Prayer_CureLight extends Prayer implements MendingSkill
{
@Override public String ID() { return "Prayer_CureLight"; }
private final static String localizedName = CMLib.lang().L("Cure Light Wounds");
@Override public String name() { return localizedName; }
@Override public int abstractQuality(){ return Ability.QUALITY_BENEFICIAL_OTHERS;}
@Override public int classificationCode(){return Ability.ACODE_PRAYER|Ability.DOMAIN_HEALING;}
@Override public long flags(){return Ability.FLAG_HOLY|Ability.FLAG_HEALINGMAGIC;}
@Override protected long minCastWaitTime(){return CMProps.getTickMillis()/2;}
@Override
public boolean supportsMending(Physical item)
{
return (item instanceof MOB)
&&((((MOB)item).curState()).getHitPoints()<(((MOB)item).maxState()).getHitPoints());
}
@Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(target instanceof MOB)
{
if(!supportsMending(target))
return Ability.QUALITY_INDIFFERENT;
if(CMLib.flags().isUndead((MOB)target))
return Ability.QUALITY_MALICIOUS;
}
}
return super.castingQuality(mob,target);
}
@Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
final boolean undead=CMLib.flags().isUndead(target);
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficiencyCheck(mob,0,auto);
if(success)
{
final CMMsg msg=CMClass.getMsg(mob,target,this,(!undead?0:CMMsg.MASK_MALICIOUS)|verbalCastCode(mob,target,auto),auto?L("A faint white glow surrounds <T-NAME>."):L("^S<S-NAME> @x1, delivering a light healing touch to <T-NAMESELF>.^?",prayWord(mob)));
if(mob.location().okMessage(mob,msg))
{
mob.location().send(mob,msg);
final int healing=CMLib.dice().roll(2,adjustedLevel(mob,asLevel),4);
final int oldHP=target.curState().getHitPoints();
CMLib.combat().postHealing(mob,target,this,healing,CMMsg.MASK_ALWAYS|CMMsg.TYP_CAST_SPELL,null);
if(target.curState().getHitPoints()>oldHP)
target.tell(L("You feel a little better!"));
lastCastHelp=System.currentTimeMillis();
}
}
else
beneficialWordsFizzle(mob,target,auto?"":L("<S-NAME> @x1 for <T-NAMESELF>, but nothing happens.",prayWord(mob)));
// return whether it worked
return success;
}
}
| [
"bo@zimmers.net"
] | bo@zimmers.net |
080249577b652265c6d613b7267c9ad3291738e4 | 9898faa41af35a93dd8ac007188bb47074dbc7a1 | /src/main/java/fr/uga/miashs/restservice/SempicUserService.java | 518ea239ce2569a8f0ae1e17856fe0c3b9a492f5 | [] | no_license | BettinaGr/JavaEE-AnnotationPhotos | 8fa5b956a4eef18ae8453ac9116ad977385c6490 | 3c0ca1feb678025a1a61e89c4ca572d4644ec202 | refs/heads/master | 2020-12-04T15:53:34.322275 | 2020-01-17T09:03:24 | 2020-01-17T09:03:24 | 231,824,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,086 | 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 fr.uga.miashs.restservice;
import fr.uga.miashs.sempic.SempicModelException;
import fr.uga.miashs.sempic.dao.SempicUserFacade;
import fr.uga.miashs.sempic.entities.SempicUser;
import java.net.URI;
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Inject;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
/**
*
* @author pitarcho
*/
@Stateless
public class SempicUserService {
@Inject
private SempicUserFacade userDao;
@Path("/users")
// @Produces(MediaType.APPLICATION_XML)
// possible grâce au JSON moxy qui transforme le XML en JSON (le XML est plus simple à trier)
@Produces(MediaType.APPLICATION_JSON)
@GET
public List<SempicUser> listAll() {
return userDao.findAll();
}
@Path("/users/{id}")
@Produces(MediaType.APPLICATION_JSON)
@GET
public SempicUser get(@PathParam("id") long id) {
// SempicUser u = userDao.read(id);
// u.getGroups().size();
// u.getMemberOf().size();
// return u;
return userDao.readEager(id);
}
// utiliser curl ou pstman pour voir le résultat de cette méthode (attribue un id à la création d'un nouvel utilisateur)
@Path("/users")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_XML)
@POST
public Response create(SempicUser u, @Context UriInfo uriInfo) throws SempicModelException {
long id = userDao.create(u);
URI location = uriInfo.getRequestUriBuilder()
.path(String.valueOf(id))
.build();
return Response.created(location).entity(u).build();
}
}
| [
"orlane.pitatch@gmail.com"
] | orlane.pitatch@gmail.com |
da79a2c0092e22d9714043d1927a079a7a78352c | bd1bb74de782403d2d99bafc55bacbf8bb1bc375 | /SecondHand/src/main/java/com/thanh/hayhen/ServletInitializer.java | be73fa9adf9a10134e056c8e8db92c03ce6fde8a | [] | no_license | thanhnguyen97/ReduxFirst | 4ad2f4c88407d294bbd52bc47827845e11a6b158 | d3a273cc6235dfceb37a553727534680e1b4ee86 | refs/heads/master | 2020-04-26T03:51:04.467332 | 2019-03-01T17:02:10 | 2019-03-01T17:02:10 | 173,281,374 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 421 | java | package com.thanh.hayhen;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(HayhenApplication.class);
}
}
| [
"thanhnguyenxh97@gmail.com"
] | thanhnguyenxh97@gmail.com |
238dfff5fc7f0a46fcf31c9e4fb72634fb3fb38a | 2a6158df5157d983b3bc24cf2de249eb3b2925ea | /old_version/JavaBasics/src/code_08_annotation/code_01/EmployeeName.java | a5adead3805417239f8dfb9b651683784fb03d1a | [] | no_license | zhifuzheng3012/Java | 36f00d97e5a4b694319ce724305dc5466a74174b | a89c3f7fd2672bc3b76494729d9c9dfe24d6fa11 | refs/heads/master | 2020-07-24T13:41:00.693650 | 2019-09-09T14:20:20 | 2019-09-09T14:20:20 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package code_08_annotation.code_01;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target(FIELD)
@Retention(RUNTIME)
@Documented
public @interface EmployeeName {
String value() default "";
}
| [
"18351926682@163.com"
] | 18351926682@163.com |
e5b9368637a1eebfd04fd3b2cf4d2380006d2861 | 2448b5ed8fe4430e46abacc622275007dcfcc49a | /DesignPrinciplesTask/src/main/java/Calc_Application/Calculators.java | fff208484c0594e02086f84f64c0172cb4c30f69 | [] | no_license | Sayan-ECE-99/SayanMitra_EPAM_DesignPrinciple | 79f9c6b3f626a481c411a8f69ebb5addd65d1589 | a010898242a8984da34b86dec676be02709c9f0d | refs/heads/master | 2021-01-01T11:14:26.978968 | 2020-02-09T06:03:44 | 2020-02-09T06:03:44 | 239,251,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,056 | java | package Calc_Application;
import java.io.*;
import java.util.*;
import java.util.Scanner;
public class Calculators {
public double addition(double x,double y)
{
double add = x+y;
return add;
}
public double substraction(double x,double y)
{
double sub = x-y;
return sub;
}
public double multiplication(double x,double y)
{
double mul = x*y;
return mul;
}
public double division(double x,double y)
{
double div = x/y;
return div;
}
public static void main(String[] args) {
System.out.println("Welcome to our Calculator ");
char ch;
Calculators obj = new Calculators();
do
{
Scanner sc = new Scanner(System.in);
System.out.println(" Enter the First Operand : ");
double op1 = sc.nextDouble();
System.out.println(" Enter the Second Operand : ");
double op2 = sc.nextDouble();
System.out.println(" Enter the Operator : + , - , * , / ");
char c = sc.next().charAt(0);
if(c=='+')
{
double a=obj.addition(op1,op2);
System.out.println("Your Result is : " + a);
}
else if (c=='-')
{
double s=obj.substraction(op1,op2);
System.out.println("Your Result is : " + s);
}
else if (c=='*')
{
double m=obj.multiplication(op1,op2);
System.out.println("Your Result is : " + m);
}
else if (c=='/')
{
double d=obj.division(op1,op2);
System.out.println("Your Result is : " + d);
}
else
{
System.out.println("Sorry our input is invalid ");
}
System.out.println("Press Y to continue using calculator else enter any key : Thank You :) ");
ch = sc.next().charAt(0);
}while(ch=='Y');
}
}
| [
"sayan mitra@LAPTOP-8UJH6I3N"
] | sayan mitra@LAPTOP-8UJH6I3N |
bed0023411016dc5fc588468aebf82559ba4e258 | 3a0bc08564506f801087d5e5bd6614c4b834ff11 | /app/build/generated/source/r/debug/android/support/v7/recyclerview/R.java | 56ce8aa6ad6b6be5d976f246eef3af5fabbb5cda | [] | no_license | Felixcity35/WhatsAppCloneApp | 19de72ad38a4653ff9018619467dae5b0b06e27f | 4eb604ac0c1dc247cbb3f724317bbaa84b89403a | refs/heads/master | 2021-09-05T16:39:44.245629 | 2018-01-29T17:26:16 | 2018-01-29T17:26:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,445 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.v7.recyclerview;
public final class R {
public static final class attr {
public static final int layoutManager = 0x7f0100d2;
public static final int reverseLayout = 0x7f0100d4;
public static final int spanCount = 0x7f0100d3;
public static final int stackFromEnd = 0x7f0100d5;
}
public static final class dimen {
public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f080067;
public static final int item_touch_helper_swipe_escape_max_velocity = 0x7f080068;
public static final int item_touch_helper_swipe_escape_velocity = 0x7f080069;
}
public static final class id {
public static final int item_touch_helper_previous_elevation = 0x7f0d0005;
}
public static final class styleable {
public static final int[] RecyclerView = { 0x010100c4, 0x7f0100d2, 0x7f0100d3, 0x7f0100d4, 0x7f0100d5 };
public static final int RecyclerView_android_orientation = 0;
public static final int RecyclerView_layoutManager = 1;
public static final int RecyclerView_reverseLayout = 3;
public static final int RecyclerView_spanCount = 2;
public static final int RecyclerView_stackFromEnd = 4;
}
}
| [
"haroonfazal@outlook.com"
] | haroonfazal@outlook.com |
bbd07a59c22e915b77bbaaa3d23eebfcdf4981be | 52dc709ac91adc068482a17e2b10597882536874 | /src/main/java/com/song/leetcode/RemoveDuplicates.java | b282578ed8fa862427252b67004569335453a985 | [] | no_license | chyong/studydemo | b33ed8f574b3f4e3ea996d02e3efa480d3cea076 | af1a04caa522d0ce70aeea227108ff08b99a86bb | refs/heads/master | 2022-09-02T10:43:06.360268 | 2022-08-28T02:10:47 | 2022-08-28T02:10:47 | 253,502,726 | 0 | 0 | null | 2022-06-21T03:09:17 | 2020-04-06T13:15:46 | Java | UTF-8 | Java | false | false | 653 | java | package com.song.leetcode;
import java.util.Arrays;
/**
* 26.删除排序数组中的重复项
*/
public class RemoveDuplicates {
public static void main(String[] args) {
System.out.println(removeDuplicates(new int[]{1,1,3,5,5,6}));
}
public static int removeDuplicates(int[] nums) {
int newLength = 0;
for (int i = 0; i < nums.length; i++) {
if (i > 0 && nums[i] != nums[i - 1]) {
newLength++;
nums[newLength] = nums[i];
}
}
System.out.println(Arrays.toString(nums));
return nums.length == 0 ? newLength : newLength + 1;
}
}
| [
"1871626766@qq.com"
] | 1871626766@qq.com |
c81c97ec3741b7edb0e970ebce2ca598baa62c3b | a744882fb7cf18944bd6719408e5a9f2f0d6c0dd | /sourcecode8/src/java/awt/TrayIcon.java | dfc7ef0f890c45bb8c8268fa1c1b1c238a70f8b2 | [
"Apache-2.0"
] | permissive | hanekawasann/learn | a39b8d17fd50fa8438baaa5b41fdbe8bd299ab33 | eef678f1b8e14b7aab966e79a8b5a777cfc7ab14 | refs/heads/master | 2022-09-13T02:18:07.127489 | 2020-04-26T07:58:35 | 2020-04-26T07:58:35 | 176,686,231 | 0 | 0 | Apache-2.0 | 2022-09-01T23:21:38 | 2019-03-20T08:16:05 | Java | UTF-8 | Java | false | false | 28,372 | java | /*
* Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.awt;
import java.awt.event.*;
import java.awt.peer.TrayIconPeer;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
import sun.awt.AWTAccessor;
import sun.awt.HeadlessToolkit;
import java.util.EventObject;
import java.security.AccessControlContext;
import java.security.AccessController;
/**
* A <code>TrayIcon</code> object represents a tray icon that can be
* added to the {@link SystemTray system tray}. A
* <code>TrayIcon</code> can have a tooltip (text), an image, a popup
* menu, and a set of listeners associated with it.
*
* <p>A <code>TrayIcon</code> can generate various {@link MouseEvent
* MouseEvents} and supports adding corresponding listeners to receive
* notification of these events. <code>TrayIcon</code> processes some
* of the events by itself. For example, by default, when the
* right-mouse click is performed on the <code>TrayIcon</code> it
* displays the specified popup menu. When the mouse hovers
* over the <code>TrayIcon</code> the tooltip is displayed.
*
* <p><strong>Note:</strong> When the <code>MouseEvent</code> is
* dispatched to its registered listeners its <code>component</code>
* property will be set to <code>null</code>. (See {@link
* java.awt.event.ComponentEvent#getComponent}) The
* <code>source</code> property will be set to this
* <code>TrayIcon</code>. (See {@link
* java.util.EventObject#getSource})
*
* <p><b>Note:</b> A well-behaved {@link TrayIcon} implementation
* will assign different gestures to showing a popup menu and
* selecting a tray icon.
*
* <p>A <code>TrayIcon</code> can generate an {@link ActionEvent
* ActionEvent}. On some platforms, this occurs when the user selects
* the tray icon using either the mouse or keyboard.
*
* <p>If a SecurityManager is installed, the AWTPermission
* {@code accessSystemTray} must be granted in order to create
* a {@code TrayIcon}. Otherwise the constructor will throw a
* SecurityException.
*
* <p> See the {@link SystemTray} class overview for an example on how
* to use the <code>TrayIcon</code> API.
*
* @author Bino George
* @author Denis Mikhalkin
* @author Sharon Zakhour
* @author Anton Tarasov
* @see SystemTray#add
* @see java.awt.event.ComponentEvent#getComponent
* @see java.util.EventObject#getSource
* @since 1.6
*/
public class TrayIcon {
private Image image;
private String tooltip;
private PopupMenu popup;
private boolean autosize;
private int id;
private String actionCommand;
transient private TrayIconPeer peer;
transient MouseListener mouseListener;
transient MouseMotionListener mouseMotionListener;
transient ActionListener actionListener;
/*
* The tray icon's AccessControlContext.
*
* Unlike the acc in Component, this field is made final
* because TrayIcon is not serializable.
*/
private final AccessControlContext acc = AccessController.getContext();
/*
* Returns the acc this tray icon was constructed with.
*/
final AccessControlContext getAccessControlContext() {
if (acc == null) {
throw new SecurityException("TrayIcon is missing AccessControlContext");
}
return acc;
}
static {
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
AWTAccessor.setTrayIconAccessor(new AWTAccessor.TrayIconAccessor() {
public void addNotify(TrayIcon trayIcon) throws AWTException {
trayIcon.addNotify();
}
public void removeNotify(TrayIcon trayIcon) {
trayIcon.removeNotify();
}
});
}
private TrayIcon() throws UnsupportedOperationException, SecurityException {
SystemTray.checkSystemTrayAllowed();
if (GraphicsEnvironment.isHeadless()) {
throw new HeadlessException();
}
if (!SystemTray.isSupported()) {
throw new UnsupportedOperationException();
}
SunToolkit.insertTargetMapping(this, AppContext.getAppContext());
}
/**
* Creates a <code>TrayIcon</code> with the specified image.
*
* @param image the <code>Image</code> to be used
* @throws IllegalArgumentException if <code>image</code> is
* <code>null</code>
* @throws UnsupportedOperationException if the system tray isn't
* supported by the current platform
* @throws HeadlessException if
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
* @throws SecurityException if {@code accessSystemTray} permission
* is not granted
* @see SystemTray#add(TrayIcon)
* @see TrayIcon#TrayIcon(Image, String, PopupMenu)
* @see TrayIcon#TrayIcon(Image, String)
* @see SecurityManager#checkPermission
* @see AWTPermission
*/
public TrayIcon(Image image) {
this();
if (image == null) {
throw new IllegalArgumentException("creating TrayIcon with null Image");
}
setImage(image);
}
/**
* Creates a <code>TrayIcon</code> with the specified image and
* tooltip text.
*
* @param image the <code>Image</code> to be used
* @param tooltip the string to be used as tooltip text; if the
* value is <code>null</code> no tooltip is shown
* @throws IllegalArgumentException if <code>image</code> is
* <code>null</code>
* @throws UnsupportedOperationException if the system tray isn't
* supported by the current platform
* @throws HeadlessException if
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
* @throws SecurityException if {@code accessSystemTray} permission
* is not granted
* @see SystemTray#add(TrayIcon)
* @see TrayIcon#TrayIcon(Image)
* @see TrayIcon#TrayIcon(Image, String, PopupMenu)
* @see SecurityManager#checkPermission
* @see AWTPermission
*/
public TrayIcon(Image image, String tooltip) {
this(image);
setToolTip(tooltip);
}
/**
* Creates a <code>TrayIcon</code> with the specified image,
* tooltip and popup menu.
*
* @param image the <code>Image</code> to be used
* @param tooltip the string to be used as tooltip text; if the
* value is <code>null</code> no tooltip is shown
* @param popup the menu to be used for the tray icon's popup
* menu; if the value is <code>null</code> no popup menu is shown
* @throws IllegalArgumentException if <code>image</code> is <code>null</code>
* @throws UnsupportedOperationException if the system tray isn't
* supported by the current platform
* @throws HeadlessException if
* {@code GraphicsEnvironment.isHeadless()} returns {@code true}
* @throws SecurityException if {@code accessSystemTray} permission
* is not granted
* @see SystemTray#add(TrayIcon)
* @see TrayIcon#TrayIcon(Image, String)
* @see TrayIcon#TrayIcon(Image)
* @see PopupMenu
* @see MouseListener
* @see #addMouseListener(MouseListener)
* @see SecurityManager#checkPermission
* @see AWTPermission
*/
public TrayIcon(Image image, String tooltip, PopupMenu popup) {
this(image, tooltip);
setPopupMenu(popup);
}
/**
* Sets the image for this <code>TrayIcon</code>. The previous
* tray icon image is discarded without calling the {@link
* java.awt.Image#flush} method — you will need to call it
* manually.
*
* <p> If the image represents an animated image, it will be
* animated automatically.
*
* <p> See the {@link #setImageAutoSize(boolean)} property for
* details on the size of the displayed image.
*
* <p> Calling this method with the same image that is currently
* being used has no effect.
*
* @param image the non-null <code>Image</code> to be used
* @throws NullPointerException if <code>image</code> is <code>null</code>
* @see #getImage
* @see Image
* @see SystemTray#add(TrayIcon)
* @see TrayIcon#TrayIcon(Image, String)
*/
public void setImage(Image image) {
if (image == null) {
throw new NullPointerException("setting null Image");
}
this.image = image;
TrayIconPeer peer = this.peer;
if (peer != null) {
peer.updateImage();
}
}
/**
* Returns the current image used for this <code>TrayIcon</code>.
*
* @return the image
* @see #setImage(Image)
* @see Image
*/
public Image getImage() {
return image;
}
/**
* Sets the popup menu for this <code>TrayIcon</code>. If
* <code>popup</code> is <code>null</code>, no popup menu will be
* associated with this <code>TrayIcon</code>.
*
* <p>Note that this <code>popup</code> must not be added to any
* parent before or after it is set on the tray icon. If you add
* it to some parent, the <code>popup</code> may be removed from
* that parent.
*
* <p>The {@code popup} can be set on one {@code TrayIcon} only.
* Setting the same popup on multiple {@code TrayIcon}s will cause
* an {@code IllegalArgumentException}.
*
* <p><strong>Note:</strong> Some platforms may not support
* showing the user-specified popup menu component when the user
* right-clicks the tray icon. In this situation, either no menu
* will be displayed or, on some systems, a native version of the
* menu may be displayed.
*
* @param popup a <code>PopupMenu</code> or <code>null</code> to
* remove any popup menu
* @throws IllegalArgumentException if the {@code popup} is already
* set for another {@code TrayIcon}
* @see #getPopupMenu
*/
public void setPopupMenu(PopupMenu popup) {
if (popup == this.popup) {
return;
}
synchronized (TrayIcon.class) {
if (popup != null) {
if (popup.isTrayIconPopup) {
throw new IllegalArgumentException("the PopupMenu is already set for another TrayIcon");
}
popup.isTrayIconPopup = true;
}
if (this.popup != null) {
this.popup.isTrayIconPopup = false;
}
this.popup = popup;
}
}
/**
* Returns the popup menu associated with this <code>TrayIcon</code>.
*
* @return the popup menu or <code>null</code> if none exists
* @see #setPopupMenu(PopupMenu)
*/
public PopupMenu getPopupMenu() {
return popup;
}
/**
* Sets the tooltip string for this <code>TrayIcon</code>. The
* tooltip is displayed automatically when the mouse hovers over
* the icon. Setting the tooltip to <code>null</code> removes any
* tooltip text.
* <p>
* When displayed, the tooltip string may be truncated on some platforms;
* the number of characters that may be displayed is platform-dependent.
*
* @param tooltip the string for the tooltip; if the value is
* <code>null</code> no tooltip is shown
* @see #getToolTip
*/
public void setToolTip(String tooltip) {
this.tooltip = tooltip;
TrayIconPeer peer = this.peer;
if (peer != null) {
peer.setToolTip(tooltip);
}
}
/**
* Returns the tooltip string associated with this
* <code>TrayIcon</code>.
*
* @return the tooltip string or <code>null</code> if none exists
* @see #setToolTip(String)
*/
public String getToolTip() {
return tooltip;
}
/**
* Sets the auto-size property. Auto-size determines whether the
* tray image is automatically sized to fit the space allocated
* for the image on the tray. By default, the auto-size property
* is set to <code>false</code>.
*
* <p> If auto-size is <code>false</code>, and the image size
* doesn't match the tray icon space, the image is painted as-is
* inside that space — if larger than the allocated space, it will
* be cropped.
*
* <p> If auto-size is <code>true</code>, the image is stretched or shrunk to
* fit the tray icon space.
*
* @param autosize <code>true</code> to auto-size the image,
* <code>false</code> otherwise
* @see #isImageAutoSize
*/
public void setImageAutoSize(boolean autosize) {
this.autosize = autosize;
TrayIconPeer peer = this.peer;
if (peer != null) {
peer.updateImage();
}
}
/**
* Returns the value of the auto-size property.
*
* @return <code>true</code> if the image will be auto-sized,
* <code>false</code> otherwise
* @see #setImageAutoSize(boolean)
*/
public boolean isImageAutoSize() {
return autosize;
}
/**
* Adds the specified mouse listener to receive mouse events from
* this <code>TrayIcon</code>. Calling this method with a
* <code>null</code> value has no effect.
*
* <p><b>Note</b>: The {@code MouseEvent}'s coordinates (received
* from the {@code TrayIcon}) are relative to the screen, not the
* {@code TrayIcon}.
*
* <p> <b>Note: </b>The <code>MOUSE_ENTERED</code> and
* <code>MOUSE_EXITED</code> mouse events are not supported.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param listener the mouse listener
* @see java.awt.event.MouseEvent
* @see java.awt.event.MouseListener
* @see #removeMouseListener(MouseListener)
* @see #getMouseListeners
*/
public synchronized void addMouseListener(MouseListener listener) {
if (listener == null) {
return;
}
mouseListener = AWTEventMulticaster.add(mouseListener, listener);
}
/**
* Removes the specified mouse listener. Calling this method with
* <code>null</code> or an invalid value has no effect.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param listener the mouse listener
* @see java.awt.event.MouseEvent
* @see java.awt.event.MouseListener
* @see #addMouseListener(MouseListener)
* @see #getMouseListeners
*/
public synchronized void removeMouseListener(MouseListener listener) {
if (listener == null) {
return;
}
mouseListener = AWTEventMulticaster.remove(mouseListener, listener);
}
/**
* Returns an array of all the mouse listeners
* registered on this <code>TrayIcon</code>.
*
* @return all of the <code>MouseListeners</code> registered on
* this <code>TrayIcon</code> or an empty array if no mouse
* listeners are currently registered
* @see #addMouseListener(MouseListener)
* @see #removeMouseListener(MouseListener)
* @see java.awt.event.MouseListener
*/
public synchronized MouseListener[] getMouseListeners() {
return AWTEventMulticaster.getListeners(mouseListener, MouseListener.class);
}
/**
* Adds the specified mouse listener to receive mouse-motion
* events from this <code>TrayIcon</code>. Calling this method
* with a <code>null</code> value has no effect.
*
* <p><b>Note</b>: The {@code MouseEvent}'s coordinates (received
* from the {@code TrayIcon}) are relative to the screen, not the
* {@code TrayIcon}.
*
* <p> <b>Note: </b>The <code>MOUSE_DRAGGED</code> mouse event is not supported.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param listener the mouse listener
* @see java.awt.event.MouseEvent
* @see java.awt.event.MouseMotionListener
* @see #removeMouseMotionListener(MouseMotionListener)
* @see #getMouseMotionListeners
*/
public synchronized void addMouseMotionListener(MouseMotionListener listener) {
if (listener == null) {
return;
}
mouseMotionListener = AWTEventMulticaster.add(mouseMotionListener, listener);
}
/**
* Removes the specified mouse-motion listener. Calling this method with
* <code>null</code> or an invalid value has no effect.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param listener the mouse listener
* @see java.awt.event.MouseEvent
* @see java.awt.event.MouseMotionListener
* @see #addMouseMotionListener(MouseMotionListener)
* @see #getMouseMotionListeners
*/
public synchronized void removeMouseMotionListener(MouseMotionListener listener) {
if (listener == null) {
return;
}
mouseMotionListener = AWTEventMulticaster.remove(mouseMotionListener, listener);
}
/**
* Returns an array of all the mouse-motion listeners
* registered on this <code>TrayIcon</code>.
*
* @return all of the <code>MouseInputListeners</code> registered on
* this <code>TrayIcon</code> or an empty array if no mouse
* listeners are currently registered
* @see #addMouseMotionListener(MouseMotionListener)
* @see #removeMouseMotionListener(MouseMotionListener)
* @see java.awt.event.MouseMotionListener
*/
public synchronized MouseMotionListener[] getMouseMotionListeners() {
return AWTEventMulticaster.getListeners(mouseMotionListener, MouseMotionListener.class);
}
/**
* Returns the command name of the action event fired by this tray icon.
*
* @return the action command name, or <code>null</code> if none exists
* @see #addActionListener(ActionListener)
* @see #setActionCommand(String)
*/
public String getActionCommand() {
return actionCommand;
}
/**
* Sets the command name for the action event fired by this tray
* icon. By default, this action command is set to
* <code>null</code>.
*
* @param command a string used to set the tray icon's
* action command.
* @see java.awt.event.ActionEvent
* @see #addActionListener(ActionListener)
* @see #getActionCommand
*/
public void setActionCommand(String command) {
actionCommand = command;
}
/**
* Adds the specified action listener to receive
* <code>ActionEvent</code>s from this <code>TrayIcon</code>.
* Action events usually occur when a user selects the tray icon,
* using either the mouse or keyboard. The conditions in which
* action events are generated are platform-dependent.
*
* <p>Calling this method with a <code>null</code> value has no
* effect.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param listener the action listener
* @see #removeActionListener
* @see #getActionListeners
* @see java.awt.event.ActionListener
* @see #setActionCommand(String)
*/
public synchronized void addActionListener(ActionListener listener) {
if (listener == null) {
return;
}
actionListener = AWTEventMulticaster.add(actionListener, listener);
}
/**
* Removes the specified action listener. Calling this method with
* <code>null</code> or an invalid value has no effect.
* <p>Refer to <a href="doc-files/AWTThreadIssues.html#ListenersThreads"
* >AWT Threading Issues</a> for details on AWT's threading model.
*
* @param listener the action listener
* @see java.awt.event.ActionEvent
* @see java.awt.event.ActionListener
* @see #addActionListener(ActionListener)
* @see #getActionListeners
* @see #setActionCommand(String)
*/
public synchronized void removeActionListener(ActionListener listener) {
if (listener == null) {
return;
}
actionListener = AWTEventMulticaster.remove(actionListener, listener);
}
/**
* Returns an array of all the action listeners
* registered on this <code>TrayIcon</code>.
*
* @return all of the <code>ActionListeners</code> registered on
* this <code>TrayIcon</code> or an empty array if no action
* listeners are currently registered
* @see #addActionListener(ActionListener)
* @see #removeActionListener(ActionListener)
* @see java.awt.event.ActionListener
*/
public synchronized ActionListener[] getActionListeners() {
return AWTEventMulticaster.getListeners(actionListener, ActionListener.class);
}
/**
* The message type determines which icon will be displayed in the
* caption of the message, and a possible system sound a message
* may generate upon showing.
*
* @see TrayIcon
* @see TrayIcon#displayMessage(String, String, MessageType)
* @since 1.6
*/
public enum MessageType {
/** An error message */
ERROR,
/** A warning message */
WARNING,
/** An information message */
INFO,
/** Simple message */
NONE
}
/**
* Displays a popup message near the tray icon. The message will
* disappear after a time or if the user clicks on it. Clicking
* on the message may trigger an {@code ActionEvent}.
*
* <p>Either the caption or the text may be <code>null</code>, but an
* <code>NullPointerException</code> is thrown if both are
* <code>null</code>.
* <p>
* When displayed, the caption or text strings may be truncated on
* some platforms; the number of characters that may be displayed is
* platform-dependent.
*
* <p><strong>Note:</strong> Some platforms may not support
* showing a message.
*
* @param caption the caption displayed above the text, usually in
* bold; may be <code>null</code>
* @param text the text displayed for the particular message; may be
* <code>null</code>
* @param messageType an enum indicating the message type
* @throws NullPointerException if both <code>caption</code>
* and <code>text</code> are <code>null</code>
*/
public void displayMessage(String caption, String text, MessageType messageType) {
if (caption == null && text == null) {
throw new NullPointerException("displaying the message with both caption and text being null");
}
TrayIconPeer peer = this.peer;
if (peer != null) {
peer.displayMessage(caption, text, messageType.name());
}
}
/**
* Returns the size, in pixels, of the space that the tray icon
* occupies in the system tray. For the tray icon that is not yet
* added to the system tray, the returned size is equal to the
* result of the {@link SystemTray#getTrayIconSize}.
*
* @return the size of the tray icon, in pixels
* @see TrayIcon#setImageAutoSize(boolean)
* @see java.awt.Image
* @see TrayIcon#getSize()
*/
public Dimension getSize() {
return SystemTray.getSystemTray().getTrayIconSize();
}
// ****************************************************************
// ****************************************************************
void addNotify() throws AWTException {
synchronized (this) {
if (peer == null) {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (toolkit instanceof SunToolkit) {
peer = ((SunToolkit) Toolkit.getDefaultToolkit()).createTrayIcon(this);
} else if (toolkit instanceof HeadlessToolkit) {
peer = ((HeadlessToolkit) Toolkit.getDefaultToolkit()).createTrayIcon(this);
}
}
}
peer.setToolTip(tooltip);
}
void removeNotify() {
TrayIconPeer p = null;
synchronized (this) {
p = peer;
peer = null;
}
if (p != null) {
p.dispose();
}
}
void setID(int id) {
this.id = id;
}
int getID() {
return id;
}
void dispatchEvent(AWTEvent e) {
EventQueue.setCurrentEventAndMostRecentTime(e);
Toolkit.getDefaultToolkit().notifyAWTEventListeners(e);
processEvent(e);
}
void processEvent(AWTEvent e) {
if (e instanceof MouseEvent) {
switch (e.getID()) {
case MouseEvent.MOUSE_PRESSED:
case MouseEvent.MOUSE_RELEASED:
case MouseEvent.MOUSE_CLICKED:
processMouseEvent((MouseEvent) e);
break;
case MouseEvent.MOUSE_MOVED:
processMouseMotionEvent((MouseEvent) e);
break;
default:
return;
}
} else if (e instanceof ActionEvent) {
processActionEvent((ActionEvent) e);
}
}
void processMouseEvent(MouseEvent e) {
MouseListener listener = mouseListener;
if (listener != null) {
int id = e.getID();
switch (id) {
case MouseEvent.MOUSE_PRESSED:
listener.mousePressed(e);
break;
case MouseEvent.MOUSE_RELEASED:
listener.mouseReleased(e);
break;
case MouseEvent.MOUSE_CLICKED:
listener.mouseClicked(e);
break;
default:
return;
}
}
}
void processMouseMotionEvent(MouseEvent e) {
MouseMotionListener listener = mouseMotionListener;
if (listener != null && e.getID() == MouseEvent.MOUSE_MOVED) {
listener.mouseMoved(e);
}
}
void processActionEvent(ActionEvent e) {
ActionListener listener = actionListener;
if (listener != null) {
listener.actionPerformed(e);
}
}
private static native void initIDs();
}
| [
"763803382@qq.com"
] | 763803382@qq.com |
d1ea6f8e9f4a4fe4fc5e39e01e23f44d8ac666ad | 24908d392ba6950574f9fc207f9e7f176517aa9b | /org/spongepowered/asm/lib/util/Printer.java | b4330fe0f0a9ead3eaa8430dab7a29f44930e297 | [] | no_license | cybrpop/catware-source | d02660b5b911a9e35d990ec60cfa9ddfa21898ee | 28387587dde9de027d955fe71baf0f53542753bf | refs/heads/main | 2023-06-18T19:20:40.758118 | 2021-07-12T10:56:41 | 2021-07-12T10:56:41 | 372,690,461 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 24,574 | java | /* */ package org.spongepowered.asm.lib.util;
/* */
/* */ import java.io.PrintWriter;
/* */ import java.util.ArrayList;
/* */ import java.util.List;
/* */ import org.spongepowered.asm.lib.Attribute;
/* */ import org.spongepowered.asm.lib.Handle;
/* */ import org.spongepowered.asm.lib.Label;
/* */ import org.spongepowered.asm.lib.TypePath;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public abstract class Printer
/* */ {
/* */ static {
/* 68 */ String s = "NOP,ACONST_NULL,ICONST_M1,ICONST_0,ICONST_1,ICONST_2,ICONST_3,ICONST_4,ICONST_5,LCONST_0,LCONST_1,FCONST_0,FCONST_1,FCONST_2,DCONST_0,DCONST_1,BIPUSH,SIPUSH,LDC,,,ILOAD,LLOAD,FLOAD,DLOAD,ALOAD,,,,,,,,,,,,,,,,,,,,,IALOAD,LALOAD,FALOAD,DALOAD,AALOAD,BALOAD,CALOAD,SALOAD,ISTORE,LSTORE,FSTORE,DSTORE,ASTORE,,,,,,,,,,,,,,,,,,,,,IASTORE,LASTORE,FASTORE,DASTORE,AASTORE,BASTORE,CASTORE,SASTORE,POP,POP2,DUP,DUP_X1,DUP_X2,DUP2,DUP2_X1,DUP2_X2,SWAP,IADD,LADD,FADD,DADD,ISUB,LSUB,FSUB,DSUB,IMUL,LMUL,FMUL,DMUL,IDIV,LDIV,FDIV,DDIV,IREM,LREM,FREM,DREM,INEG,LNEG,FNEG,DNEG,ISHL,LSHL,ISHR,LSHR,IUSHR,LUSHR,IAND,LAND,IOR,LOR,IXOR,LXOR,IINC,I2L,I2F,I2D,L2I,L2F,L2D,F2I,F2L,F2D,D2I,D2L,D2F,I2B,I2C,I2S,LCMP,FCMPL,FCMPG,DCMPL,DCMPG,IFEQ,IFNE,IFLT,IFGE,IFGT,IFLE,IF_ICMPEQ,IF_ICMPNE,IF_ICMPLT,IF_ICMPGE,IF_ICMPGT,IF_ICMPLE,IF_ACMPEQ,IF_ACMPNE,GOTO,JSR,RET,TABLESWITCH,LOOKUPSWITCH,IRETURN,LRETURN,FRETURN,DRETURN,ARETURN,RETURN,GETSTATIC,PUTSTATIC,GETFIELD,PUTFIELD,INVOKEVIRTUAL,INVOKESPECIAL,INVOKESTATIC,INVOKEINTERFACE,INVOKEDYNAMIC,NEW,NEWARRAY,ANEWARRAY,ARRAYLENGTH,ATHROW,CHECKCAST,INSTANCEOF,MONITORENTER,MONITOREXIT,,MULTIANEWARRAY,IFNULL,IFNONNULL,";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 88 */ public static final String[] OPCODES = new String[200]; static {
/* 89 */ int i = 0;
/* 90 */ int j = 0;
/* */ int l;
/* 92 */ while ((l = s.indexOf(',', j)) > 0) {
/* 93 */ OPCODES[i++] = (j + 1 == l) ? null : s.substring(j, l);
/* 94 */ j = l + 1;
/* */ }
/* */
/* 97 */ s = "T_BOOLEAN,T_CHAR,T_FLOAT,T_DOUBLE,T_BYTE,T_SHORT,T_INT,T_LONG,";
/* 98 */ } public static final String[] TYPES = new String[12]; static {
/* 99 */ j = 0;
/* 100 */ i = 4;
/* 101 */ while ((l = s.indexOf(',', j)) > 0) {
/* 102 */ TYPES[i++] = s.substring(j, l);
/* 103 */ j = l + 1;
/* */ }
/* */
/* 106 */ s = "H_GETFIELD,H_GETSTATIC,H_PUTFIELD,H_PUTSTATIC,H_INVOKEVIRTUAL,H_INVOKESTATIC,H_INVOKESPECIAL,H_NEWINVOKESPECIAL,H_INVOKEINTERFACE,";
/* */ }
/* */
/* 109 */ public static final String[] HANDLE_TAG = new String[10]; static {
/* 110 */ j = 0;
/* 111 */ i = 1;
/* 112 */ while ((l = s.indexOf(',', j)) > 0) {
/* 113 */ HANDLE_TAG[i++] = s.substring(j, l);
/* 114 */ j = l + 1;
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected final int api;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected final StringBuffer buf;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public final List<Object> text;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected Printer(int api) {
/* 151 */ this.api = api;
/* 152 */ this.buf = new StringBuffer();
/* 153 */ this.text = new ArrayList();
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Printer visitClassTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
/* 257 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Printer visitFieldTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
/* 457 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void visitParameter(String name, int access) {
/* 491 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Printer visitMethodTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
/* 535 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Deprecated
/* */ public void visitMethodInsn(int opcode, String owner, String name, String desc) {
/* 762 */ if (this.api >= 327680) {
/* 763 */ boolean itf = (opcode == 185);
/* 764 */ visitMethodInsn(opcode, owner, name, desc, itf);
/* */ return;
/* */ }
/* 767 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
/* 790 */ if (this.api < 327680) {
/* 791 */ if (itf != ((opcode == 185))) {
/* 792 */ throw new IllegalArgumentException("INVOKESPECIAL/STATIC on interfaces require ASM 5");
/* */ }
/* */
/* 795 */ visitMethodInsn(opcode, owner, name, desc);
/* */ return;
/* */ }
/* 798 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Printer visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
/* 980 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Printer visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
/* 1025 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public Printer visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) {
/* 1089 */ throw new RuntimeException("Must be overriden");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public List<Object> getText() {
/* 1130 */ return this.text;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void print(PrintWriter pw) {
/* 1140 */ printList(pw, this.text);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static void appendString(StringBuffer buf, String s) {
/* 1152 */ buf.append('"');
/* 1153 */ for (int i = 0; i < s.length(); i++) {
/* 1154 */ char c = s.charAt(i);
/* 1155 */ if (c == '\n') {
/* 1156 */ buf.append("\\n");
/* 1157 */ } else if (c == '\r') {
/* 1158 */ buf.append("\\r");
/* 1159 */ } else if (c == '\\') {
/* 1160 */ buf.append("\\\\");
/* 1161 */ } else if (c == '"') {
/* 1162 */ buf.append("\\\"");
/* 1163 */ } else if (c < ' ' || c > '') {
/* 1164 */ buf.append("\\u");
/* 1165 */ if (c < '\020') {
/* 1166 */ buf.append("000");
/* 1167 */ } else if (c < 'Ā') {
/* 1168 */ buf.append("00");
/* 1169 */ } else if (c < 'က') {
/* 1170 */ buf.append('0');
/* */ }
/* 1172 */ buf.append(Integer.toString(c, 16));
/* */ } else {
/* 1174 */ buf.append(c);
/* */ }
/* */ }
/* 1177 */ buf.append('"');
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ static void printList(PrintWriter pw, List<?> l) {
/* 1190 */ for (int i = 0; i < l.size(); i++) {
/* 1191 */ Object o = l.get(i);
/* 1192 */ if (o instanceof List) {
/* 1193 */ printList(pw, (List)o);
/* */ } else {
/* 1195 */ pw.print(o.toString());
/* */ }
/* */ }
/* */ }
/* */
/* */ public abstract void visit(int paramInt1, int paramInt2, String paramString1, String paramString2, String paramString3, String[] paramArrayOfString);
/* */
/* */ public abstract void visitSource(String paramString1, String paramString2);
/* */
/* */ public abstract void visitOuterClass(String paramString1, String paramString2, String paramString3);
/* */
/* */ public abstract Printer visitClassAnnotation(String paramString, boolean paramBoolean);
/* */
/* */ public abstract void visitClassAttribute(Attribute paramAttribute);
/* */
/* */ public abstract void visitInnerClass(String paramString1, String paramString2, String paramString3, int paramInt);
/* */
/* */ public abstract Printer visitField(int paramInt, String paramString1, String paramString2, String paramString3, Object paramObject);
/* */
/* */ public abstract Printer visitMethod(int paramInt, String paramString1, String paramString2, String paramString3, String[] paramArrayOfString);
/* */
/* */ public abstract void visitClassEnd();
/* */
/* */ public abstract void visit(String paramString, Object paramObject);
/* */
/* */ public abstract void visitEnum(String paramString1, String paramString2, String paramString3);
/* */
/* */ public abstract Printer visitAnnotation(String paramString1, String paramString2);
/* */
/* */ public abstract Printer visitArray(String paramString);
/* */
/* */ public abstract void visitAnnotationEnd();
/* */
/* */ public abstract Printer visitFieldAnnotation(String paramString, boolean paramBoolean);
/* */
/* */ public abstract void visitFieldAttribute(Attribute paramAttribute);
/* */
/* */ public abstract void visitFieldEnd();
/* */
/* */ public abstract Printer visitAnnotationDefault();
/* */
/* */ public abstract Printer visitMethodAnnotation(String paramString, boolean paramBoolean);
/* */
/* */ public abstract Printer visitParameterAnnotation(int paramInt, String paramString, boolean paramBoolean);
/* */
/* */ public abstract void visitMethodAttribute(Attribute paramAttribute);
/* */
/* */ public abstract void visitCode();
/* */
/* */ public abstract void visitFrame(int paramInt1, int paramInt2, Object[] paramArrayOfObject1, int paramInt3, Object[] paramArrayOfObject2);
/* */
/* */ public abstract void visitInsn(int paramInt);
/* */
/* */ public abstract void visitIntInsn(int paramInt1, int paramInt2);
/* */
/* */ public abstract void visitVarInsn(int paramInt1, int paramInt2);
/* */
/* */ public abstract void visitTypeInsn(int paramInt, String paramString);
/* */
/* */ public abstract void visitFieldInsn(int paramInt, String paramString1, String paramString2, String paramString3);
/* */
/* */ public abstract void visitInvokeDynamicInsn(String paramString1, String paramString2, Handle paramHandle, Object... paramVarArgs);
/* */
/* */ public abstract void visitJumpInsn(int paramInt, Label paramLabel);
/* */
/* */ public abstract void visitLabel(Label paramLabel);
/* */
/* */ public abstract void visitLdcInsn(Object paramObject);
/* */
/* */ public abstract void visitIincInsn(int paramInt1, int paramInt2);
/* */
/* */ public abstract void visitTableSwitchInsn(int paramInt1, int paramInt2, Label paramLabel, Label... paramVarArgs);
/* */
/* */ public abstract void visitLookupSwitchInsn(Label paramLabel, int[] paramArrayOfint, Label[] paramArrayOfLabel);
/* */
/* */ public abstract void visitMultiANewArrayInsn(String paramString, int paramInt);
/* */
/* */ public abstract void visitTryCatchBlock(Label paramLabel1, Label paramLabel2, Label paramLabel3, String paramString);
/* */
/* */ public abstract void visitLocalVariable(String paramString1, String paramString2, String paramString3, Label paramLabel1, Label paramLabel2, int paramInt);
/* */
/* */ public abstract void visitLineNumber(int paramInt, Label paramLabel);
/* */
/* */ public abstract void visitMaxs(int paramInt1, int paramInt2);
/* */
/* */ public abstract void visitMethodEnd();
/* */ }
/* Location: C:\Users\taruv\Documents\Client\Catware_1.0_Official_Release_UwU.jar!\org\spongepowered\asm\li\\util\Printer.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 1.1.3
*/ | [
"80264293+cybrpop@users.noreply.github.com"
] | 80264293+cybrpop@users.noreply.github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.