blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
51
| license_type
stringclasses 2
values | repo_name
stringlengths 5
132
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringlengths 4
80
| visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
689M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 131
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
9.45M
| extension
stringclasses 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5b93b31d0decd459493f0011757b4e8669511f3f | d4bea825e260fa34145870d9f49fff88fdb08b47 | /Videojuego en Red/core/src/com/videojuegored/red/WorldState.java | 3c3befd631275c82afbff6816486ec16c86f4009 | [] | no_license | KarinaAbraham/Videojuego-en-red | 61a6c54ca28a389dbed46a1f3ec5e359f641d863 | 07c8cda7fbb236142b51429126a0c3b3ae13af50 | refs/heads/master | 2020-05-09T23:02:13.176560 | 2019-04-15T14:00:16 | 2019-04-15T14:00:16 | 181,490,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,212 | java | package com.videojuegored.red;
import java.util.ArrayList;
import com.videojuegored.personajes.Jugador;
import com.videojuegored.personajes.SoldadoEnemigo;
public class WorldState implements java.io.Serializable{
private ArrayList<SoldadoEnemigoRed> soldadoEnemigoRed = new ArrayList<SoldadoEnemigoRed>();
private JugadorRed[] jugadorRed = new JugadorRed[2];
public void setSoldadoEnemigo(ArrayList<SoldadoEnemigo> soldadoEnemigo){
for(int i=0; i<soldadoEnemigo.size(); i++){
SoldadoEnemigoRed soldadoEnemigoRed = new SoldadoEnemigoRed();
soldadoEnemigoRed.id = soldadoEnemigo.get(i).getId();
soldadoEnemigoRed.estado = soldadoEnemigo.get(i).getEstado();
soldadoEnemigoRed.tiempoDisparo = soldadoEnemigo.get(i).getTiempoDisparo();
soldadoEnemigoRed.tiempoEstado = soldadoEnemigo.get(i).getTiempoEstado();
soldadoEnemigoRed.vidaActual = soldadoEnemigo.get(i).getVidaActual();
soldadoEnemigoRed.estadoAnterior = soldadoEnemigo.get(i).getEstadoAnterior();
soldadoEnemigoRed.miraDerecha = soldadoEnemigo.get(i).getMiraDerecha();
soldadoEnemigoRed.velocidad = soldadoEnemigo.get(i).getVelocidad();
this.soldadoEnemigoRed.add(soldadoEnemigoRed);
}
}
public void setJugadorRed(Jugador[] jugador){
for(int i=0; i<jugador.length; i++){
JugadorRed jugadorRed = new JugadorRed();
jugadorRed.estado = jugador[i].getEstado();
jugadorRed.tiempoDisparo = jugador[i].getTiempoDisparo();
jugadorRed.tiempoEstado = jugador[i].getTiempoEstado();
jugadorRed.vidaActual = jugador[i].getVidaActual();
jugadorRed.estadoAnterior = jugador[i].getEstadoAnterior();
jugadorRed.miraDerecha = jugador[i].getMiraDerecha();
jugadorRed.armaActual = jugador[i].getArmaActual();
jugadorRed.puedeDisparar = jugador[i].getPuedeDisparar();
jugadorRed.posicionX = jugador[i].getBody().getPosition().x;
jugadorRed.posicionY = jugador[i].getBody().getPosition().y;
this.jugadorRed[i] = jugadorRed;
}
}
public JugadorRed[] getJugadorRed(){return jugadorRed;}
public ArrayList<SoldadoEnemigoRed> getSoldadoEnemigoRed(){return soldadoEnemigoRed;}
}
| [
"[email protected]"
] | |
f3270528708bca185e6abc47a254704fd997effa | c326029735a79d246069e34abfee894393d40afb | /src/com/magicpwd/e/mpro/file/AppendAction.java | 00623f81d0dae8683280f3b4dbb735cade6a74c7 | [] | no_license | zenoyao/MagicPwd | 32fa4c6c44237516ec0c69708ad7d3370b2d760e | 209a544626d84c7be0fb57bc79d9cc6fe4330f07 | refs/heads/master | 2021-10-25T08:56:05.813409 | 2019-04-03T07:06:10 | 2019-04-03T07:06:10 | 2,542,815 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,917 | java | /*
* Copyright (C) 2010 Amon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.magicpwd.e.mpro.file;
import com.magicpwd.__a.mpro.AMproAction;
import com.magicpwd._enum.AppView;
import com.magicpwd._util.Char;
/**
*
* @author Amon
*/
public class AppendAction extends AMproAction
{
public AppendAction()
{
}
@Override
public void actionPerformed(java.awt.event.ActionEvent e)
{
if (!mproPtn.newKeys())
{
return;
}
if (mproPtn.getUserMdl().isEditVisible(AppView.mpro))
{
return;
}
String cmd = e.getActionCommand();
if (Char.isValidate(cmd))
{
String[] arr = cmd.split(",");
if (arr != null && arr.length == 2)
{
mproPtn.getMenuPtn().getButton(arr[0]).setSelected(true);
mproPtn.getMenuPtn().getButton(arr[1]).setSelected(true);
}
}
mproPtn.getUserMdl().setEditVisible(AppView.mpro, true);
mproPtn.getUserMdl().setEditIsolate(AppView.mpro, true);
mproPtn.setEditVisible(true);
}
@Override
public void doInit(String value)
{
}
@Override
public void reInit(javax.swing.AbstractButton button, String value)
{
}
}
| [
"[email protected]"
] | |
ebafc8cf055e878e2dd390fde019c266203ca07a | a436024f119708f996ead6d13e5430c6444e87db | /src/main/java/nl/miwgroningen/se/ch3/bacchux/model/IbanValidation.java | c581e187665aee6c290560f67a84ac71d4fa1a25 | [] | no_license | filiusalwin/bug-free-octo-computing-machine | 23c6f13fb890d8d4a5059a01063e45f54ca95e0a | 9a6092e581b8a0e011baca4421af0047976f9c71 | refs/heads/main | 2023-03-19T02:08:05.881052 | 2020-10-28T14:05:21 | 2020-10-28T14:05:21 | 347,638,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,019 | java | package nl.miwgroningen.se.ch3.bacchux.model;
//This file contains a method to validate a Dutch IBAN number
import java.math.BigInteger;
public class IbanValidation {
private static final int IBAN_SIZE = 18;
private static final BigInteger IBAN_MODULUS = new BigInteger("97");
private String iban = "NL02 RABO 0306 6480 59";
//Check if the total IBAN length is 18. If not IBAN is invalid.
private boolean ibanLengthCorrect(String iban) {
iban = iban.replaceAll("\\s","");
return iban.length() == IBAN_SIZE;
}
//Move the four initials to the end of the string
private String moveInitialsIban(String iban) {
iban = iban.replaceAll("\\s","");
iban = iban.substring(4) + iban.substring(0, 4);
return iban;
}
//Replace each letter in the string with two digits,
//thereby expanding the string, where A = 10, B = 11, ..., Z = 35
private BigInteger convertIbanToInt(String iban) {
iban = moveInitialsIban(iban);
String str = "";
for (int i = 0; i < iban.length(); i++) {
int charValue = Character.getNumericValue(iban.charAt(i));
if (charValue < 0 || charValue > 35) {
return new BigInteger("0");
}
str += charValue;
}
return new BigInteger(str);
}
//Interpret the string as a decimal integer and compute the remainder of that number on division by 97
//If the remainder is 1, the check digit test is passed and the IBAN might be valid.
public boolean validateIban (String iban) {
if (!ibanLengthCorrect(iban)) {
return false;
}
BigInteger bigIntegerIban = convertIbanToInt(iban);
BigInteger modulusIban = bigIntegerIban.mod(IBAN_MODULUS);
return modulusIban.equals(BigInteger.ONE);
}
public String getIban() {
return iban;
}
public void setIban(String iban) {
this.iban = iban;
}
}
| [
"[email protected]"
] | |
1ed1f76130c9a219c53e7a0ea9d36969e43b93ea | 541bf0a55a049c9abea378adc831d0cb5e567eb7 | /src/main/java/com/origonetworks/isv/backend/integration/remote/type/RemoteEventType.java | 0e0b0710af76ff491f5f0f4ac1f25465b6fe8278 | [] | no_license | sweis/sample-isv | 0375943de627182911f73d452e9eabd80e544ff7 | cb9d024eabba06d44af0c6ff6038c4f678292315 | refs/heads/master | 2020-06-02T18:07:22.085946 | 2010-12-29T21:07:23 | 2010-12-29T21:07:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 115 | java | package com.origonetworks.isv.backend.integration.remote.type;
public enum RemoteEventType {
USER_LIST_CHANGE;
}
| [
"[email protected]"
] | |
70ca3fa952bf669abdf0f6e8f27874fc9f598489 | 35b99f8685bddaba15fc0c6daa01f9c282eb49cc | /904pxSpring/src/main/java/com/project/controller/HelloController.java | bcbe0a10af4fae1ac8a2f7a4d28377440e64b316 | [] | no_license | MartinFilipov/904px | dcff3259a44a285d1a04e44b1649b230579feee5 | 056bf3c9e43767a9ded0faa84668d94310b45364 | refs/heads/master | 2020-03-11T14:42:04.208156 | 2018-05-14T14:53:56 | 2018-05-14T14:53:56 | 130,062,166 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,205 | java | package com.project.controller;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.project.model.post.Post;
import com.project.model.post.PostDAO;
import com.project.model.post.PostException;
@Controller
@RequestMapping(value="/index")
public class HelloController {
@Autowired
private PostDAO postDAO;
@RequestMapping()
public String sayHello(HttpServletRequest request, Model model) {
List<Post> posts=new ArrayList<>();
if (request.getSession().getAttribute("user_id") != null) {
posts.addAll(postDAO.getAllFollowedUserPostsByUserID((int)request.getSession().getAttribute("user_id")));
}else{
try {
posts.addAll(postDAO.getFreshPosts());
} catch (PostException e) {
System.out.println("Something went wrong while getting fresh posts");
e.printStackTrace();
}
}
model.addAttribute("posts",posts);
return "index";
}
}
| [
"[email protected]"
] | |
414d1e5b777507d5872eb56174a235b0be07c528 | 947d154c8f4f6ca7d2e14678572707d1c2803067 | /src/main/java/com/barberia/app/models/Salon.java | 8490e622f397fddf67ccca090da58b98d6d0c500 | [] | no_license | thisisminh172/barberia-services | 1a4d14e29a5fefa9fcb386c42739d67faa49e042 | 0116ecacb12dd87e5e873d07f76d3f98ac1925aa | refs/heads/main | 2023-07-18T09:44:36.851168 | 2021-08-19T00:31:35 | 2021-08-19T00:31:35 | 379,179,004 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,314 | java | package com.barberia.app.models;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import org.apache.tomcat.jni.Local;
import javax.persistence.*;
import java.sql.Time;
import java.time.LocalTime;
import java.util.List;
@Entity
@Table(name = "salon")
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
public class Salon {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "salon_name", length = 200)
private String salonName;
@Column(name = "address", length = 200)
private String address;
@Column(name = "email", length = 200)
private String email;
@Column(name = "thumbnail_url", length = 200)
private String thumbnailUrl;
@Column(name = "phone_number", length = 100)
private String phoneNumber;
@Column(name = "opened_hour")
private LocalTime openedHour;
@Column(name = "closed_hour")
private LocalTime closedHour;
@Column(name = "minute_in_one_time_slot")
private int minuteInOneTimeSlot;
@Column(name = "available_for_online_booking")
private boolean availableForOnlineBooking;
@Column(name = "number_of_turn_in_one_time_slot")
private int numberOfTurnInOneTimeSlot;
@Column(name = "opened")
private boolean opened;
@Column(name = "car_parking_available")
private boolean carParkingAvailable;
@OneToMany(mappedBy = "salon")
private List<Employee> employees;
@OneToMany(mappedBy = "salon")
private List<Booking> bookings;
public Salon() {
}
public Salon(Long id, String salonName, String address, String email,String thumbnailUrl, String phoneNumber, LocalTime openedHour, LocalTime closedHour, int minuteInOneTimeSlot, boolean availableForOnlineBooking, int numberOfTurnInOneTimeSlot, boolean opened, boolean carParkingAvailable, List<Employee> employees, List<Booking> bookings) {
this.id = id;
this.salonName = salonName;
this.address = address;
this.email = email;
this.thumbnailUrl = thumbnailUrl;
this.phoneNumber = phoneNumber;
this.openedHour = openedHour;
this.closedHour = closedHour;
this.minuteInOneTimeSlot = minuteInOneTimeSlot;
this.availableForOnlineBooking = availableForOnlineBooking;
this.numberOfTurnInOneTimeSlot = numberOfTurnInOneTimeSlot;
this.opened = opened;
this.carParkingAvailable = carParkingAvailable;
this.employees = employees;
this.bookings = bookings;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSalonName() {
return salonName;
}
public void setSalonName(String salonName) {
this.salonName = salonName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public LocalTime getOpenedHour() {
return openedHour;
}
public void setOpenedHour(LocalTime openedHour) {
this.openedHour = openedHour;
}
public LocalTime getClosedHour() {
return closedHour;
}
public void setClosedHour(LocalTime closedHour) {
this.closedHour = closedHour;
}
public int getMinuteInOneTimeSlot() {
return minuteInOneTimeSlot;
}
public void setMinuteInOneTimeSlot(int minuteInOneTimeSlot) {
this.minuteInOneTimeSlot = minuteInOneTimeSlot;
}
public boolean isAvailableForOnlineBooking() {
return availableForOnlineBooking;
}
public void setAvailableForOnlineBooking(boolean availableForOnlineBooking) {
this.availableForOnlineBooking = availableForOnlineBooking;
}
public int getNumberOfTurnInOneTimeSlot() {
return numberOfTurnInOneTimeSlot;
}
public void setNumberOfTurnInOneTimeSlot(int numberOfTurnInOneTimeSlot) {
this.numberOfTurnInOneTimeSlot = numberOfTurnInOneTimeSlot;
}
public boolean isOpened() {
return opened;
}
public void setOpened(boolean opened) {
this.opened = opened;
}
public boolean isCarParkingAvailable() {
return carParkingAvailable;
}
public void setCarParkingAvailable(boolean carParkingAvailable) {
this.carParkingAvailable = carParkingAvailable;
}
public List<Employee> getEmployees() {
return employees;
}
public void setEmployees(List<Employee> employees) {
this.employees = employees;
}
public List<Booking> getBookings() {
return bookings;
}
public void setBookings(List<Booking> bookings) {
this.bookings = bookings;
}
public String getThumbnailUrl() {
return thumbnailUrl;
}
public void setThumbnailUrl(String thumbnailUrl) {
this.thumbnailUrl = thumbnailUrl;
}
}
| [
"[email protected]"
] | |
5aff33315cfaa21037778fdfda63feb860cadf66 | 3de3dae722829727edfdd6cc3b67443a69043475 | /javaUtilities/com.raytheon.uf.featureexplorer/src/com/raytheon/uf/featureexplorer/PluginManifestIndex.java | 94e6aa5023a4a369ff1e4d5cb2c7ca937cafbd90 | [
"LicenseRef-scancode-public-domain",
"Apache-2.0"
] | permissive | Unidata/awips2 | 9aee5b7ec42c2c0a2fa4d877cb7e0b399db74acb | d76c9f96e6bb06f7239c563203f226e6a6fffeef | refs/heads/unidata_18.2.1 | 2023-08-18T13:00:15.110785 | 2023-08-09T06:06:06 | 2023-08-09T06:06:06 | 19,332,079 | 161 | 75 | NOASSERTION | 2023-09-13T19:06:40 | 2014-05-01T00:59:04 | Java | UTF-8 | Java | false | false | 4,150 | java | package com.raytheon.uf.featureexplorer;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
/**
* This class is to be used for indexing sets of manifests that are found in a
* plug-in project for Eclipse.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 3, 2008 bclement Initial creation
* Oct 6, 2008 dglazesk Added support for indexing the jar files.
* This just helps with Eclipse plugin indexing.
* </pre>
*
* @author bclement
* @version 1.0
*/
public class PluginManifestIndex extends AbstractResourceIndex {
/**
* Create the index based on a base directory. The base directory must
* exist.
*
* @param aBaseDirectory
* The base directory where all the plugins are subdirectories
* @throws IOException
* Thrown if the directory does not exist or is not a directory.
*/
public PluginManifestIndex(Collection<File> aBaseDirectories)
throws IOException {
super(aBaseDirectories);
}
/**
* This function does all of the work. It looks for a manifest in the
* "META-INF" folder in the project directory and creates entries in the map
* for the IDs and the version numbers for the project into the map.
*
* @param projectDirectory
* Directory for the project to look into
*/
protected void catalog(File projectDirectory) {
File maniFile = new File(projectDirectory, "META-INF/MANIFEST.MF");
Manifest m = null;
try {
if (projectDirectory.isFile()) {
// regular file means it may be a jar, so try it
JarFile proj = new JarFile(projectDirectory);
m = proj.getManifest();
} else if (maniFile.exists()) {
m = new Manifest();
// we only care if the manifest actually exists
InputStream is = new FileInputStream(maniFile);
m.read(is);
is.close();
}
} catch (IOException e) {
e.printStackTrace();
}
// if m is null, we either didn't have the manifest or there was an
// exception, skip
if (m != null) {
Attributes attribs = m.getMainAttributes();
String id = attribs.getValue("Bundle-SymbolicName");
String version = attribs.getValue("Bundle-Version");
// ignore manifests that do not have a bundle name and version
if (id != null && version != null) {
if (index.containsValue(id)) {
index.get(id).put(version, projectDirectory);
} else {
Map<String, File> versionMap = new HashMap<String, File>();
versionMap.put(version, projectDirectory);
index.put(id, versionMap);
}
}
}
}
/**
* Finds the sub-directories and any jar files in the base directory. The
* plugin manifest index needs to support indexing the plug-in jars as well.
*
* @return The array of sub-directories or jars in the base directory
*/
@Override
public File[] getSubDirectories() {
return baseDir.listFiles(new FileFilter() {
/**
* This function accepts if the file is a directory or is a jar
* file.
*
* @param f
* The file being checked for acceptance
* @return True if the file is a directory or a jar
*/
@Override
public boolean accept(File f) {
return f.isDirectory() || f.getName().endsWith(".jar");
}
});
}
}
| [
"[email protected]"
] | |
54666f78208568d111fdb55890bcf8ea0d3ab281 | 7d6bcfbae2b12372a1fde3efc19dc93642843b3c | /app/src/main/java/com/social/yourturn/fragments/EventFragment.java | 95546113264a4eb049aed7ed1d83609e59c4ae99 | [] | no_license | rahulyhg/YourTurn | 3c771b196ee0e517f7f4b4e4111e3430aa5c0834 | 7a673041257bc7cdbea8e28902f4837f7d47c1fc | refs/heads/master | 2020-04-16T07:11:19.585057 | 2017-07-28T16:12:49 | 2017-07-28T16:12:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,124 | java | package com.social.yourturn.fragments;
import android.database.Cursor;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.CursorLoader;
import android.support.v4.content.Loader;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.social.yourturn.R;
import com.social.yourturn.adapters.EventAdapter;
import com.social.yourturn.data.YourTurnContract;
import com.social.yourturn.models.Contact;
import com.social.yourturn.models.Event;
import java.util.ArrayList;
/**
* A simple {@link Fragment} subclass.
*/
public class EventFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
private static final String TAG = EventFragment.class.getSimpleName();
private TextView emptyTextView;
private RecyclerView mRecyclerView;
private ArrayList<Event> mEventList = new ArrayList<>();
private EventAdapter mEventAdapter;
public static final String EVENT_KEY = "Event";
private static final int LOADER_ID = 0;
public EventFragment() {
// Required empty public constructor
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
Typeface typeface = Typeface.createFromAsset(getActivity().getAssets(), "fonts/RobotoCondensed-Bold.ttf");
View view = inflater.inflate(R.layout.fragment_group, container, false);
emptyTextView = (TextView) view.findViewById(R.id.empty_view);
emptyTextView.setTypeface(typeface);
mRecyclerView = (RecyclerView) view.findViewById(R.id.group_rv);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
mRecyclerView.setLayoutManager(linearLayoutManager);
mEventList = new ArrayList<>();
mEventAdapter = new EventAdapter(getActivity(), mEventList);
mRecyclerView.setAdapter(mEventAdapter);
return view;
}
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getActivity().getSupportLoaderManager().initLoader(LOADER_ID, null, this);
}
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
if(id == LOADER_ID){
return new CursorLoader(getActivity(),
YourTurnContract.EventEntry.CONTENT_URI, null, null, null, YourTurnContract.EventEntry.COLUMN_EVENT_UPDATED_DATE + " DESC");
}
return null;
}
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if(loader.getId() == LOADER_ID){
if(data == null){
Log.d(TAG, "Empty cursor");
}else {
loadData(data);
}
}
}
private void addContact(String contactId, String name, String number, String thumbnail, ArrayList<Contact> list) {
if(contactId == null) contactId = String.valueOf(0);
if(name == null) name = getString(R.string.current_user);
Contact contact = new Contact(contactId, name, number);
if(thumbnail != null) contact.setThumbnailUrl(thumbnail);
list.add(contact);
}
private void loadData(Cursor data) {
ArrayList<Contact> contactList = new ArrayList<>();
String eventId, eventName, eventUrl, eventCreator, userId, lastEventId="";
Event event = null;
for(data.moveToFirst(); !data.isAfterLast(); data.moveToNext()) {
eventId = data.getString(data.getColumnIndex(YourTurnContract.EventEntry.COLUMN_EVENT_ID));
eventName = data.getString(data.getColumnIndex(YourTurnContract.EventEntry.COLUMN_EVENT_NAME));
eventUrl = data.getString(data.getColumnIndex(YourTurnContract.EventEntry.COLUMN_EVENT_URL));
eventCreator = data.getString(data.getColumnIndex(YourTurnContract.EventEntry.COLUMN_EVENT_CREATOR));
userId = data.getString(data.getColumnIndex(YourTurnContract.EventEntry.COLUMN_USER_KEY));
Cursor userCursor = getActivity().getContentResolver().query(YourTurnContract.MemberEntry.CONTENT_URI, null,
YourTurnContract.MemberEntry.COLUMN_MEMBER_PHONE_NUMBER + "=?", new String[]{userId}, null);
if(userCursor != null && userCursor.getCount() > 0){
userCursor.moveToFirst();
String contactId = userCursor.getString(userCursor.getColumnIndex(YourTurnContract.MemberEntry._ID));
String username = userCursor.getString(userCursor.getColumnIndex(YourTurnContract.MemberEntry.COLUMN_MEMBER_NAME));
String phoneNumber = userCursor.getString(userCursor.getColumnIndex(YourTurnContract.MemberEntry.COLUMN_MEMBER_PHONE_NUMBER));
String thumbnail = userCursor.getString(userCursor.getColumnIndex(YourTurnContract.MemberEntry.COLUMN_MEMBER_THUMBNAIL));
if(lastEventId.isEmpty() || eventId.equals(lastEventId)) {
lastEventId = eventId;
}else {
lastEventId = eventId;
contactList = new ArrayList<>();
}
addContact(contactId, username, phoneNumber, thumbnail, contactList);
userCursor.close();
}
if(mEventList.isEmpty()){
event = new Event();
event.setEventId(eventId);
event.setName(eventName);
event.setEventUrl(eventUrl);
event.setGroupCreator(eventCreator);
event.setGroupUserRef(userId);
event.setContactList(contactList);
if(!mEventList.contains(event))
mEventList.add(event);
}else if (mEventList.size() > 0 && mEventList.get(mEventList.size()-1).getEventId().equals(eventId)) continue;
else {
event = new Event();
event.setEventId(eventId);
event.setName(eventName);
event.setEventUrl(eventUrl);
event.setGroupCreator(eventCreator);
event.setGroupUserRef(userId);
event.setContactList(contactList);
if(!mEventList.contains(event))
mEventList.add(event);
}
}
if(mEventList.size() > 0) {
mRecyclerView.setVisibility(View.VISIBLE);
emptyTextView.setVisibility(View.GONE);
mEventAdapter.notifyDataSetChanged();
}
}
@Override
public void onLoaderReset(Loader<Cursor> loader) {
}
}
| [
"[email protected]"
] | |
b109e16f79d3e925d2ba1535ece764833699d00c | e7c48e95f167f37edf8c4f5d9062d4d546211c81 | /chbase-jaxb/src/main/java/com/chbase/thing/oxm/jaxb/ccd/RoleClassEmployee.java | fda7f5b75387cc93ab292478a1755135650bde90 | [] | no_license | CHBase/chbase-java-sdk | 1d6b04e1884cfa20541bfe0d3ff0b7e3c1fcacd8 | 61c6143134162d11f897d446595a26a8abdcacd5 | refs/heads/master | 2023-02-19T09:14:26.321622 | 2023-02-09T07:10:58 | 2023-02-09T07:10:58 | 43,138,403 | 0 | 2 | null | 2023-02-09T07:11:00 | 2015-09-25T12:10:54 | Java | UTF-8 | Java | false | false | 1,100 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.09.23 at 03:45:28 PM IST
//
package com.chbase.thing.oxm.jaxb.ccd;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for RoleClassEmployee.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="RoleClassEmployee">
* <restriction base="{urn:hl7-org:v3}cs">
* <enumeration value="EMP"/>
* <enumeration value="MIL"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "RoleClassEmployee")
@XmlEnum
public enum RoleClassEmployee {
EMP,
MIL;
public String value() {
return name();
}
public static RoleClassEmployee fromValue(String v) {
return valueOf(v);
}
}
| [
"[email protected]"
] | |
19af850afa0d7ef4d39bf66a59370104d10537d0 | 91a442c4164c4d5b1de5d45c3d37b3e200f896d4 | /app/src/main/java/com/sec/samsung/tvcontentsync/TvContentSyncApplication.java | ca04ee26f6d5d27199ac9fb0a4d9e51eda7abc34 | [] | no_license | ndquyenanh/TVApp | bfa527deee718508dd1115fa1855a46ccedd9314 | 23360da68b27448bc75f5fd11f17767770cbdd14 | refs/heads/master | 2021-07-16T08:55:34.286640 | 2017-10-07T04:13:31 | 2017-10-07T04:13:31 | 96,737,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,607 | java | package com.sec.samsung.tvcontentsync;
import android.app.Activity;
import android.app.Application;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import com.sec.samsung.download.DownloadFile;
import com.sec.samsung.manager.AliveService;
import com.sec.samsung.utils.Debug;
import com.sec.samsung.utils.Define;
import com.sec.samsung.utils.SettingManager;
import com.sec.samsung.utils.Utils;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
/**
* Created by sev_user on 12/7/2016.
*/
public class TvContentSyncApplication extends Application {
private static TvContentSyncApplication instance;
private Handler mDebugHandler;
private Context mCurActivity;
private StringBuilder mStrBuilder;
private boolean isUpdateLogScreen = false;
private ArrayList<DownloadFile> downloadFileList = new ArrayList<>();
private boolean isBroadcasting;
private long broadcastFinishTime;
//public TvContentSyncApplication() {
// Debug.log();
// downloadFileList = new ArrayList<>();
// isUpdateLogScreen = false;
//}
public static synchronized TvContentSyncApplication getInstance() {
if (instance == null) {
instance = new TvContentSyncApplication();
}
return instance;
}
public void setBroadcasting(boolean status) {
this.isBroadcasting = status;
}
public boolean isBroadcasting() {
return isBroadcasting;
}
public long getBroadcastFinishTime() {
return broadcastFinishTime;
}
public void setBroadcastFinishTime(long broadcastFinishTime) {
this.broadcastFinishTime = broadcastFinishTime;
}
public void setCurActivity(Context context) {
mCurActivity = context;
}
public Activity getCurActivity() {
if (mCurActivity instanceof Activity)
return (Activity) mCurActivity;
return null;
}
public void clearLog() {
mStrBuilder = new StringBuilder("");
}
public String getLog() {
if (mStrBuilder != null)
return mStrBuilder.toString();
else
return "";
}
public void updateLogScreen(String log) {
try {
if (mStrBuilder == null)
mStrBuilder = new StringBuilder("");
String msgObj = log + System.getProperty("line.separator");
mStrBuilder.append(msgObj);
if (mCurActivity instanceof MainActivity) {
MainActivity ma = (MainActivity) mCurActivity;
if (mDebugHandler == null) {
mDebugHandler = ma.getDebugHandler();
}
if (isUpdateLogScreen) {
ma.setShowView(isUpdateLogScreen);
Message msg = mDebugHandler.obtainMessage();
msg.what = 1;
msg.obj = msgObj;
mDebugHandler.sendMessage(msg);
} else {
ma.setShowView(false);
}
}
} catch (Exception ex) {
Debug.logW(ex.getMessage());
}
}
@Override
public void onCreate() {
// startService(new Intent(this, AliveService.class));
Debug.log("Init app");
// Setup handler for uncaught exceptions.
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable e) {
try {
handleUncaughtException(thread, e);
// Utils.showToast(TvContentSyncApplication.this, "Hello from App!!!");
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
super.onCreate();
}
@Override
public void onTerminate() {
super.onTerminate();
}
@Override
public void onLowMemory() {
super.onLowMemory();
Debug.log();
Utils.restartApp(getApplicationContext());
}
public void handleUncaughtException(Thread thread, Throwable e) throws IOException {
File f = new File(Define.APP_PATH_LOGS + "log_exception_" + Utils.long2DateTimeFile(System.currentTimeMillis()) + ".txt");
f.createNewFile();
e.printStackTrace(new PrintStream(f)); // not all Android versions will print the stack trace automatically
Debug.logE(e.getMessage());
Intent intent = new Intent();
intent.setAction("com.sec.samsung.tvcontentsync.SEND_LOG"); // see step 5.
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // required when starting from Application
intent.putExtra("exception_name", e.getMessage());
startActivity(intent);
System.exit(1); // kill off the crashed app
}
public boolean isUpdateLogScreen() {
return isUpdateLogScreen;
}
public void setUpdateLogScreen(boolean updateLogScreen) {
isUpdateLogScreen = updateLogScreen;
}
private boolean isShowHeadUp = false;
public void updateNotification(Context c, String msg) {
NotificationManager nm = (NotificationManager) c.getSystemService(NOTIFICATION_SERVICE);
PendingIntent pi = PendingIntent.getActivity(c, 0, new Intent(c, MainActivity.class), 0);
int id = R.string.app_name;
Notification.Builder n = new Notification.Builder(c).
setContentTitle(msg).
setContentText("App version " + Utils.getVersionName(c) + "(contact: [email protected])").
setTicker("setTicker").
setSmallIcon(R.mipmap.app_icon).
setOngoing(true).
setContentIntent(pi).
// setDefaults(Notification.DEFAULT_ALL).
setPriority(Notification.PRIORITY_HIGH);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && isShowHeadUp)
n.setVibrate(new long[0]);
nm.notify(id, n.build());
}
public void updateNotification(Context c, int stt) {
NotificationManager nm = (NotificationManager) c.getSystemService(NOTIFICATION_SERVICE);
PendingIntent pi = PendingIntent.getActivity(c, 0, new Intent(c, MainActivity.class), 0);
int id = R.string.app_name;
Notification.Builder n = new Notification.Builder(c).
setContentTitle(Utils.getNameStt(stt) + SettingManager.getIPServer(c)).
setContentText("App version " + Utils.getVersionName(c) + "(contact: [email protected])").
setTicker("setTicker").
setSmallIcon(R.mipmap.app_icon).
setOngoing(true).
setContentIntent(pi).
// setDefaults(Notification.DEFAULT_ALL).
setPriority(Notification.PRIORITY_HIGH);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && isShowHeadUp)
n.setVibrate(new long[0]);
nm.notify(id, n.build());
}
public void cancelNotification(Context c) {
NotificationManager nm = (NotificationManager) c.getSystemService(NOTIFICATION_SERVICE);
nm.cancel(R.string.app_name);
}
public synchronized ArrayList<DownloadFile> getDownloadFileList() {
return downloadFileList;
}
}
| [
"[email protected]"
] | |
ddbc318fc8818ca17cfa0c5db01e1f8599fe9fb5 | b12a5c753102293b7cf0b3002a85736788df449e | /dps-publish/src/main/java/com/timeInc/dps/publish/translator/PublishResponseHandler.java | dc1fde759b05b74e2827fcf0c1aba1a444320278 | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ryanlfoster/dpsapi | 882f6b80404de0b0c2a386f477d91e2be76469d4 | 67b627114d2607491887f2fdf4aa9e5f1df4b331 | refs/heads/master | 2020-12-14T07:20:03.348482 | 2014-05-28T14:53:10 | 2014-05-28T14:53:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,126 | java | /*******************************************************************************
* Copyright 2014 Time 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.timeInc.dps.publish.translator;
import com.timeInc.dps.publish.response.Result;
import com.timeInc.dps.translator.ResponseHandler;
import com.timeInc.dps.translator.ResponseHandlerException;
import com.timeInc.dps.translator.ResponseTranslator;
/**
* Translates the response received from the Publishing API to a subtype of
* {@link com.timeInc.dps.publish.response.Result}
*/
public class PublishResponseHandler implements ResponseHandler<Result> {
private final ResponseTranslator translator;
/**
* Instantiates a new publish response handler.
*
* @param translator the translator that converts the String response to a subtype of Result
*/
public PublishResponseHandler(ResponseTranslator translator) {
this.translator = translator;
}
/** (non-Javadoc)
* @see com.timeInc.dps.translator.ResponseHandler#handleResponse(java.lang.Class, java.lang.String)
* @throws ResponseHandlerException if the status is not equal to {@link com.timeInc.dps.publish.response.Result#SUCCESS}
*/
@Override
public <V extends Result> V handleResponse(Class<V> responseCls, String response) throws ResponseHandlerException {
V result = translator.convertToObject(responseCls,response);
if(result.getStatus().equals(Result.SUCCESS))
return result;
else
throw new ResponseHandlerException(result.getStatus(), result.getMessage());
}
}
| [
"[email protected]"
] | |
4a49f63c91e42f45ae9ecc2693898360d8ccf800 | 0d8bf667f2728c13bc07362bf584c0cbaf9c9a32 | /app/src/main/java/com/pk/PkMusic/activity/GeDanInputActivity.java | 779630ead1c0e17ee8a238d5ce13cde9b9c859cb | [
"MIT"
] | permissive | pk-love-tjy/PkMusic | d74b02f730fa70ff8f1f65c2ad31ff90eae983fb | a31de18a410e4e5ceb99e0dcdc16ae10abdd7153 | refs/heads/master | 2023-01-12T18:34:36.719989 | 2020-11-02T07:48:12 | 2020-11-02T07:51:15 | 309,292,772 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,993 | java | package com.pk.PkMusic.activity;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.pk.pk_tjy_musicplayer.R;
import com.pk.PkMusic.http.requests;
import com.pk.PkMusic.utils.FileUtils;
import com.pk.PkMusic.utils.fileData;
import java.util.HashMap;
import java.util.Map;
public class GeDanInputActivity extends Activity implements View.OnClickListener{
EditText qq_edit;
Button qq_daoru;
ImageView back;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gedan_input_activity);
qq_edit=findViewById(R.id.qq_edit);
qq_daoru=findViewById(R.id.qq_daoru);
back=findViewById(R.id.gedan_input_back);
qq_daoru.setOnClickListener(this);
back.setOnClickListener(this);
}
@Override
public void onClick(View v) {
System.out.println("=========================================>");
switch (v.getId()){
case R.id.qq_daoru:{
new Thread(){
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
qq_daoru.setVisibility(View.GONE);
}
});
String key = String.valueOf(qq_edit.getText());
Map<String,String> map = new HashMap<>();
map.put("key", String.valueOf(qq_edit.getText()));
map.put("type","playlist");
map.put("source","qq");
String result = requests.doPost("http://39.97.226.107/eapi/", JSONObject.toJSONString(map));
assert result != null;
if (result.equals("")){
runOnUiThread(new Runnable() {
@Override
public void run() {
qq_daoru.setVisibility(View.VISIBLE);
Toast.makeText(GeDanInputActivity.this, "导入失败", Toast.LENGTH_SHORT).show();
}
});
}else {
JSONObject json = JSONObject.parseObject(result);
String dirname = String.valueOf(json.get("name"));
JSONArray jsonlist = json.getJSONArray("songlist");
dirname = FileUtils.stringFilter(dirname);
FileUtils.mkdirs(FileUtils.getMusicDir()+"/"+dirname);
fileData fileData = new fileData(dirname,FileUtils.getMusicDir()+"/"+dirname,requests.json2obj(jsonlist));
FileUtils.saveFile(FileUtils.getMusicDir()+"/"+dirname+".save",JSONObject.toJSONString(fileData));
runOnUiThread(new Runnable() {
@Override
public void run() {
qq_daoru.setVisibility(View.VISIBLE);
Toast.makeText(GeDanInputActivity.this, "导入成功", Toast.LENGTH_SHORT).show();
}
});
}
}
}.start();
break;
}
case R.id.gedan_input_back:{
finish();
break;
}
default:{
break;
}
}
}
}
| [
"[email protected]"
] | |
aa84638293bbab22423b744fbfc894bab4b8c8a6 | 6b19e7da15d91c4dbdd62889ac74a7bfa692003d | /lab 9/lab9/src/ro/unibuc/lab9/predicate/exercise/ExerciseOne.java | 7c3e6aff5ea31221968c93d8c7f0524f0676268d | [] | no_license | soaregeorgiana/pao-labs | aa7c7c59eba331ed97021aede74155fef6718a61 | 8031ce9a3cb06e566306c5620db260af89147d15 | refs/heads/master | 2023-05-01T23:25:00.825777 | 2021-05-18T17:02:25 | 2021-05-18T17:02:25 | 338,982,352 | 7 | 3 | null | null | null | null | UTF-8 | Java | false | false | 704 | java | package ro.unibuc.lab9.predicate.exercise;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
public class ExerciseOne {
/**
* Generate 100 codes and extract the ones started with 1
* Generate codes using UUID.randomUUID().toString()
*/
public static void main(String[] args) {
List<String> codes = new ArrayList<>();
for (int i = 0; i < 100; i++) {
codes.add(UUID.randomUUID().toString());
}
System.out.println(
codes.stream()
.filter(code -> code.startsWith("1"))
.collect(Collectors.joining(",")));
}
}
| [
"[email protected]"
] | |
3e8338dde97fddb7c12811ae59ebc9b676ce61fe | 1a4770c215544028bad90c8f673ba3d9e24f03ad | /second/quark/src/main/java/com/taobao/android/binding/core/dk.java | dd0862dbc56dd048e4421fc685f551789a5d7b67 | [] | no_license | zhang1998/browser | e480fbd6a43e0a4886fc83ea402f8fbe5f7c7fce | 4eee43a9d36ebb4573537eddb27061c67d84c7ba | refs/heads/master | 2021-05-03T06:32:24.361277 | 2018-02-10T10:35:36 | 2018-02-10T10:35:36 | 120,590,649 | 8 | 10 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | package com.taobao.android.binding.core;
import java.util.ArrayList;
import org.json.JSONException;
/* compiled from: ProGuard */
final class dk implements bg {
dk() {
}
public final Object a(ArrayList<Object> arrayList) throws NumberFormatException, JSONException {
double doubleValue = ((Double) arrayList.get(0)).doubleValue();
double doubleValue2 = ((Double) arrayList.get(1)).doubleValue();
double doubleValue3 = ((Double) arrayList.get(2)).doubleValue();
double doubleValue4 = ((Double) arrayList.get(3)).doubleValue();
doubleValue4 = (Math.min(doubleValue, doubleValue4) / doubleValue4) - 1.0d;
return Double.valueOf((((((doubleValue4 * 2.70158d) + 1.70158d) * (doubleValue4 * doubleValue4)) + 1.0d) * doubleValue3) + doubleValue2);
}
}
| [
"[email protected]"
] | |
0998dc5b87cd86224aba1910d3b566a8c3764518 | f723ed26d3282e5b01515a71ba62148f66878bab | /src/main/java/net/vanabel/vanabelscriptcore/legacy/ArgumentBit.java | 654b81ed8442ae5a26bae85d44e24712fce12939 | [
"MIT"
] | permissive | MusicScore/VanabelScriptCore | e6aa5322c8fc64a051071f6bf62071f3aa75364c | 8337e14afcb7d6c40ea09a2a856c4ad2085f55b9 | refs/heads/master | 2022-12-23T00:28:36.051393 | 2019-07-30T21:09:00 | 2019-07-30T21:09:00 | 199,727,727 | 0 | 0 | MIT | 2022-12-14T20:24:53 | 2019-07-30T21:09:08 | Java | UTF-8 | Java | false | false | 523 | java | package net.vanabel.vanabelscriptcore.legacy;
import com.github.musicscore.denizensuspiccore.tags.AbstractTagObject;
import com.github.musicscore.denizensuspiccore.utilities.Action;
import com.github.musicscore.denizensuspiccore.utilities.debugging.DebugMode;
import java.util.HashMap;
public abstract class ArgumentBit {
public abstract String getString();
public abstract AbstractTagObject parse(CommandQueue queue, HashMap<String, AbstractTagObject> variables, DebugMode debugMode, Action<String> error);
}
| [
"[email protected]"
] | |
e8d75c71f9d08fd01904e4dd6ef0d82a5a56c62e | cb762d4b0f0ea986d339759ba23327a5b6b67f64 | /src/web/com/joymain/jecs/fi/webapp/action/JfiYeepayLogFormController.java | 1777a188af9e166be89fa4811b653afd692671d6 | [
"Apache-2.0"
] | permissive | lshowbiz/agnt_ht | c7d68c72a1d5fa7cd0e424eabb9159d3552fe9dc | fd549de35cb12a2e3db1cd9750caf9ce6e93e057 | refs/heads/master | 2020-08-04T14:24:26.570794 | 2019-10-02T03:04:13 | 2019-10-02T03:04:13 | 212,160,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,573 | java | package com.joymain.jecs.fi.webapp.action;
import java.util.Locale;
import java.math.BigDecimal;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.apache.commons.lang.StringUtils;
import com.joymain.jecs.webapp.action.BaseFormController;
import com.joymain.jecs.fi.model.JfiYeepayLog;
import com.joymain.jecs.fi.service.JfiYeepayLogManager;
import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
public class JfiYeepayLogFormController extends BaseFormController {
private JfiYeepayLogManager jfiYeepayLogManager = null;
public void setJfiYeepayLogManager(JfiYeepayLogManager jfiYeepayLogManager) {
this.jfiYeepayLogManager = jfiYeepayLogManager;
}
public JfiYeepayLogFormController() {
setCommandName("jfiYeepayLog");
setCommandClass(JfiYeepayLog.class);
}
protected Object formBackingObject(HttpServletRequest request)
throws Exception {
String logId = request.getParameter("logId");
JfiYeepayLog jfiYeepayLog = null;
if (!StringUtils.isEmpty(logId)) {
jfiYeepayLog = jfiYeepayLogManager.getJfiYeepayLog(logId);
} else {
jfiYeepayLog = new JfiYeepayLog();
}
return jfiYeepayLog;
}
public ModelAndView onSubmit(HttpServletRequest request,
HttpServletResponse response, Object command,
BindException errors)
throws Exception {
if (log.isDebugEnabled()) {
log.debug("entering 'onSubmit' method...");
}
JfiYeepayLog jfiYeepayLog = (JfiYeepayLog) command;
boolean isNew = (jfiYeepayLog.getLogId() == null);
Locale locale = request.getLocale();
String key=null;
String strAction = request.getParameter("strAction");
if ("deleteJfiYeepayLog".equals(strAction) ) {
jfiYeepayLogManager.removeJfiYeepayLog(jfiYeepayLog.getLogId().toString());
key="jfiYeepayLog.delete";
}else{
jfiYeepayLogManager.saveJfiYeepayLog(jfiYeepayLog);
key="jfiYeepayLog.update";
}
return new ModelAndView(getSuccessView());
}
protected void initBinder(HttpServletRequest request,
ServletRequestDataBinder binder) {
// TODO Auto-generated method stub
// binder.setAllowedFields(allowedFields);
// binder.setDisallowedFields(disallowedFields);
// binder.setRequiredFields(requiredFields);
super.initBinder(request, binder);
}
}
| [
"[email protected]"
] | |
a9d3e601a0818742728f1afab6e9d470aa5c1023 | 102cedb0745f6f235601cbec4d841991594c3c44 | /src/main/java/com/app/dao/impl/ItemImpl.java | d807277b05540f63f281137f85747e7f9e4a84b9 | [] | no_license | santhoskumar123/WareHouse | 26235d5dcd225055bf3ca334aa084fc8516a61ae | 9065b0293e5f71379850a0921d381acb755e9ed5 | refs/heads/master | 2020-04-21T20:21:01.763632 | 2019-02-09T07:32:54 | 2019-02-09T07:32:54 | 169,840,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package com.app.dao.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate5.HibernateTemplate;
import org.springframework.stereotype.Repository;
import com.app.dao.IitemDao;
import com.app.model.Item;
import com.app.model.OrderMethod;
@Repository
public class ItemImpl implements IitemDao {
@Autowired
private HibernateTemplate ht;
@Override
public Integer saveItem(Item i) {
// TODO Auto-generated method stub
return (Integer) ht.save(i);
}
@Override
public void updateItem(Item i) {
ht.update(i);
}
@Override
public void deleteItem(Integer id) {
ht.delete(new Item(id));
}
@Override
public Item getItemById(Integer id) {
return ht.get(Item.class, id);
}
@Override
public List<Item> getAllItems() {
return ht.loadAll(Item.class);
}
}
| [
"[email protected]"
] | |
c61500ef5b109a7d51b1ec6fcce59ffa4977a5a8 | 487d450376951b378a9cb0efaeef4661e000228b | /src/main/java/com/kintone/client/model/app/ProcessAssigneeType.java | 68f496154bf39c335f5519bd1963f78dfaad6ecd | [
"MIT",
"GPL-2.0-only",
"BSD-3-Clause",
"Apache-2.0",
"CDDL-1.0",
"MPL-2.0",
"EPL-1.0",
"Classpath-exception-2.0"
] | permissive | kintone/kintone-java-client | 1bd78e0c9124cde892072e46d057e08b9918dfb6 | df13eb2867d46fc83e90a74374c0e60812773e14 | refs/heads/master | 2023-08-17T18:56:15.921847 | 2023-08-15T23:59:26 | 2023-08-15T23:59:26 | 238,640,137 | 23 | 8 | MIT | 2023-08-15T23:59:28 | 2020-02-06T08:22:36 | Java | UTF-8 | Java | false | false | 277 | java | package com.kintone.client.model.app;
public enum ProcessAssigneeType {
/** User chooses one assignee from the list to take action */
ONE,
/** All assignees in the list must take action */
ALL,
/** One assignee in the list must take action */
ANY
}
| [
"[email protected]"
] | |
aa4266e3a5980154284d5301abd5a2ea29fcb21e | 0ba4dd0e3a09285dced590355d10b69b2a320144 | /MorePowers.java | 96ac97e0f62f1f74b54596694e3ba339fab55ef4 | [] | no_license | McookeSoftware/RacingGame | a4d461ba8a52f4525afd9f824ab6ccfe44bae040 | 2b8729bf2aa272d6b06284ce05423a61c236417b | refs/heads/master | 2020-06-18T21:01:13.617266 | 2019-07-11T18:32:03 | 2019-07-11T18:32:03 | 196,446,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | 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 gamerace;
/**
*
* @author matthew cooke
*/
public abstract class MorePowers implements Power{
Power power;
}
| [
"[email protected]"
] | |
dabe0c897f91357b8af2ee87400f34a8a2d12571 | 696a3b7384c5a8c436578672f2e3c05e317b05f8 | /src/main/java/offer/FindRepeatNumber.java | 6ba1e3ef3459a657380d10a4dce6818be2100e57 | [
"Apache-2.0"
] | permissive | zybotian/leetcode | d3c0b39c23a9726b1edab21f7a0ff043a3cac576 | dbc6eb0bc867bd9d13e9ff29719b07f587360f54 | refs/heads/master | 2023-09-01T00:00:17.742224 | 2023-08-22T16:10:54 | 2023-08-22T16:10:54 | 172,421,229 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package offer;
import java.util.HashSet;
import java.util.Set;
public class FindRepeatNumber {
public int findRepeatNumber(int[] nums) {
if (nums == null || nums.length == 0) {
return -1;
}
Set<Integer> set = new HashSet<>();
for (int i = 0; i < nums.length; i++) {
if (set.contains(nums[i])) {
return nums[i];
}
set.add(nums[i]);
}
return -1;
}
}
| [
"[email protected]"
] | |
7cc1b79f082a64734b7bee082608acf9f989f7db | 100cd9e84a586949e1e5f3caca15e740bc6e0c47 | /src/main/java/reddit/springboot/ranking/cleaner/SerializeRedditPost.java | 45a13a0800025872855304afa834dfc460d63088 | [] | no_license | subhash-pujari/redditRankerSevice | 36e3e68902edad5cf7dccf406bab13423bb628d8 | 2bf811bf4e8e7505155544e43bcc92e172cdf84e | refs/heads/master | 2016-09-13T14:51:25.472824 | 2016-05-22T12:11:52 | 2016-05-22T12:11:52 | 59,410,069 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,916 | java | package reddit.springboot.ranking.cleaner;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectInputStream;
import java.io.ObjectOutput;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import reddit.springboot.ranking.importdata.ReadCsv;
import reddit.springboot.ranking.models.RedditPost;
public class SerializeRedditPost {
private static final String pathSerializedDir = "./serializedFile/";
private static final String filenameRedditPostSerializeFile = "redditPost.ser";
private static final String filenameRedditMapSerializeFile = "redditPostMap.ser";
private static final String pathDataset = "./dataset/";
public static HashMap<String, RedditPost> getRedditIdRedditPostMap(ArrayList<RedditPost> posts){
HashMap<String, RedditPost> redditIdRedditPostMap = new HashMap<String, RedditPost>();
if(new File(pathSerializedDir + filenameRedditMapSerializeFile).exists()){
redditIdRedditPostMap = deserializeRedditIdRedditPostMap(pathSerializedDir + filenameRedditMapSerializeFile);
}else{
for(RedditPost post : posts){
redditIdRedditPostMap.put(post.getId(), post);
}
serializeRedditIdRedditPostMap(redditIdRedditPostMap, pathSerializedDir + filenameRedditMapSerializeFile);
}
return redditIdRedditPostMap;
}
public static ArrayList<RedditPost> getRedditPostsFromFile(){
ArrayList<RedditPost> posts = new ArrayList<RedditPost>();
ArrayList<String> filenames = FileUtil.listFilesForFolder(new File(pathDataset));
for(String filename : filenames){
posts.addAll(ReadCsv.readCsv(new File(filename)));
}
return posts;
}
public static ArrayList<RedditPost> getRedditPosts(){
ArrayList<RedditPost> posts = new ArrayList<RedditPost>();
if(new File(pathSerializedDir + filenameRedditPostSerializeFile).exists()){
posts = deserializeRedditPosts(pathSerializedDir + filenameRedditPostSerializeFile);
}else{
for(String filename : FileUtil.listFilesForFolder(new File(pathDataset))){
posts.addAll(ReadCsv.readCsv(new File(filename)));
}
serializeRedditPosts(posts, pathSerializedDir + filenameRedditPostSerializeFile);
}
return posts;
}
private static void serializeRedditIdRedditPostMap(HashMap<String, RedditPost> redditIdRedditPostMap, String filePath){
OutputStream file = null;
try {
file = new FileOutputStream(filePath);
OutputStream buffer = new BufferedOutputStream(file);
ObjectOutput output = new ObjectOutputStream(buffer);
output.writeObject(redditIdRedditPostMap);
output.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private static HashMap<String, RedditPost> deserializeRedditIdRedditPostMap(String filepath){
InputStream file = null;
HashMap<String, RedditPost> redditIdRedditPostMap = null;
try {
file = new FileInputStream(filepath);
InputStream buffer = new BufferedInputStream(file);
ObjectInput input = new ObjectInputStream(buffer);
redditIdRedditPostMap = (HashMap<String, RedditPost>) input.readObject();
input.close();
} catch (Exception e) {
e.printStackTrace();
}
return redditIdRedditPostMap;
}
private static void serializeRedditPosts(ArrayList<RedditPost> posts, String filePath){
OutputStream file = null;
try {
file = new FileOutputStream(filePath);
OutputStream buffer = new BufferedOutputStream(file);
ObjectOutput output = new ObjectOutputStream(buffer);
output.writeObject(posts);
output.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private static ArrayList<RedditPost> deserializeRedditPosts(String filepath){
InputStream file = null;
ArrayList<RedditPost> redditPosts = null;
try {
file = new FileInputStream(filepath);
InputStream buffer = new BufferedInputStream(file);
ObjectInput input = new ObjectInputStream(buffer);
redditPosts = (ArrayList<RedditPost>) input.readObject();
input.close();
} catch (Exception e) {
e.printStackTrace();
}
return redditPosts;
}
public static void main(String[] args){
SerializeRedditPost.getRedditPosts();
}
}
| [
"[email protected]"
] | |
6e0ee9215eba34a594276c1c3b7c9782aa08f8bb | aa623c778fd88082cf59f442ad3cb671253ffc37 | /src/main/java/com/tencentcloudapi/gaap/v20180529/models/ProxyInfo.java | 7f7e72515ad1955dca862c4312d67043aca71bd6 | [
"Apache-2.0"
] | permissive | zjm9109/tencentcloud-sdk-java | 1eac89cedd70c8111c300d050f2c2f2ab1839189 | a31d2d50f75dc740457289db0bf93ed8b3994c73 | refs/heads/master | 2020-09-30T10:32:57.836303 | 2019-12-05T14:18:17 | 2019-12-05T14:18:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,470 | java | /*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.gaap.v20180529.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class ProxyInfo extends AbstractModel{
/**
* (旧参数,请使用ProxyId)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("InstanceId")
@Expose
private String InstanceId;
/**
* 创建时间,采用unix时间戳的方式,表示从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数。
*/
@SerializedName("CreateTime")
@Expose
private Long CreateTime;
/**
* 项目ID。
*/
@SerializedName("ProjectId")
@Expose
private Long ProjectId;
/**
* 通道名称。
*/
@SerializedName("ProxyName")
@Expose
private String ProxyName;
/**
* 接入地域。
*/
@SerializedName("AccessRegion")
@Expose
private String AccessRegion;
/**
* 源站地域。
*/
@SerializedName("RealServerRegion")
@Expose
private String RealServerRegion;
/**
* 带宽,单位:Mbps。
*/
@SerializedName("Bandwidth")
@Expose
private Long Bandwidth;
/**
* 并发,单位:个/秒。
*/
@SerializedName("Concurrent")
@Expose
private Long Concurrent;
/**
* 通道状态。其中:
RUNNING,运行中;
CREATING,创建中;
DESTROYING,销毁中;
OPENING,开启中;
CLOSING,关闭中;
CLOSED,已关闭;
ADJUSTING,配置变更中;
ISOLATING,隔离中(欠费触发);
ISOLATED,已隔离(欠费触发);
CLONING,复制中;
UNKNOWN,未知状态。
*/
@SerializedName("Status")
@Expose
private String Status;
/**
* 接入域名。
*/
@SerializedName("Domain")
@Expose
private String Domain;
/**
* 接入IP。
*/
@SerializedName("IP")
@Expose
private String IP;
/**
* 通道版本号:1.0,2.0,3.0。
*/
@SerializedName("Version")
@Expose
private String Version;
/**
* (新参数)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("ProxyId")
@Expose
private String ProxyId;
/**
* 1,该通道可缩扩容;0,该通道无法缩扩容。
*/
@SerializedName("Scalarable")
@Expose
private Long Scalarable;
/**
* 支持的协议类型。
*/
@SerializedName("SupportProtocols")
@Expose
private String [] SupportProtocols;
/**
* 通道组ID,当通道归属于某一通道组时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("GroupId")
@Expose
private String GroupId;
/**
* 安全策略ID,当设置了安全策略时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("PolicyId")
@Expose
private String PolicyId;
/**
* 接入地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("AccessRegionInfo")
@Expose
private RegionDetail AccessRegionInfo;
/**
* 源站地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("RealServerRegionInfo")
@Expose
private RegionDetail RealServerRegionInfo;
/**
* 通道转发IP
*/
@SerializedName("ForwardIP")
@Expose
private String ForwardIP;
/**
* 标签列表,不存在标签时,该字段为空列表。
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("TagSet")
@Expose
private TagPair [] TagSet;
/**
* 是否支持安全组配置
注意:此字段可能返回 null,表示取不到有效值。
*/
@SerializedName("SupportSecurity")
@Expose
private Long SupportSecurity;
/**
* 获取(旧参数,请使用ProxyId)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
* @return InstanceId (旧参数,请使用ProxyId)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
*/
public String getInstanceId() {
return this.InstanceId;
}
/**
* 设置(旧参数,请使用ProxyId)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
* @param InstanceId (旧参数,请使用ProxyId)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setInstanceId(String InstanceId) {
this.InstanceId = InstanceId;
}
/**
* 获取创建时间,采用unix时间戳的方式,表示从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数。
* @return CreateTime 创建时间,采用unix时间戳的方式,表示从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数。
*/
public Long getCreateTime() {
return this.CreateTime;
}
/**
* 设置创建时间,采用unix时间戳的方式,表示从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数。
* @param CreateTime 创建时间,采用unix时间戳的方式,表示从1970年1月1日(UTC/GMT的午夜)开始所经过的秒数。
*/
public void setCreateTime(Long CreateTime) {
this.CreateTime = CreateTime;
}
/**
* 获取项目ID。
* @return ProjectId 项目ID。
*/
public Long getProjectId() {
return this.ProjectId;
}
/**
* 设置项目ID。
* @param ProjectId 项目ID。
*/
public void setProjectId(Long ProjectId) {
this.ProjectId = ProjectId;
}
/**
* 获取通道名称。
* @return ProxyName 通道名称。
*/
public String getProxyName() {
return this.ProxyName;
}
/**
* 设置通道名称。
* @param ProxyName 通道名称。
*/
public void setProxyName(String ProxyName) {
this.ProxyName = ProxyName;
}
/**
* 获取接入地域。
* @return AccessRegion 接入地域。
*/
public String getAccessRegion() {
return this.AccessRegion;
}
/**
* 设置接入地域。
* @param AccessRegion 接入地域。
*/
public void setAccessRegion(String AccessRegion) {
this.AccessRegion = AccessRegion;
}
/**
* 获取源站地域。
* @return RealServerRegion 源站地域。
*/
public String getRealServerRegion() {
return this.RealServerRegion;
}
/**
* 设置源站地域。
* @param RealServerRegion 源站地域。
*/
public void setRealServerRegion(String RealServerRegion) {
this.RealServerRegion = RealServerRegion;
}
/**
* 获取带宽,单位:Mbps。
* @return Bandwidth 带宽,单位:Mbps。
*/
public Long getBandwidth() {
return this.Bandwidth;
}
/**
* 设置带宽,单位:Mbps。
* @param Bandwidth 带宽,单位:Mbps。
*/
public void setBandwidth(Long Bandwidth) {
this.Bandwidth = Bandwidth;
}
/**
* 获取并发,单位:个/秒。
* @return Concurrent 并发,单位:个/秒。
*/
public Long getConcurrent() {
return this.Concurrent;
}
/**
* 设置并发,单位:个/秒。
* @param Concurrent 并发,单位:个/秒。
*/
public void setConcurrent(Long Concurrent) {
this.Concurrent = Concurrent;
}
/**
* 获取通道状态。其中:
RUNNING,运行中;
CREATING,创建中;
DESTROYING,销毁中;
OPENING,开启中;
CLOSING,关闭中;
CLOSED,已关闭;
ADJUSTING,配置变更中;
ISOLATING,隔离中(欠费触发);
ISOLATED,已隔离(欠费触发);
CLONING,复制中;
UNKNOWN,未知状态。
* @return Status 通道状态。其中:
RUNNING,运行中;
CREATING,创建中;
DESTROYING,销毁中;
OPENING,开启中;
CLOSING,关闭中;
CLOSED,已关闭;
ADJUSTING,配置变更中;
ISOLATING,隔离中(欠费触发);
ISOLATED,已隔离(欠费触发);
CLONING,复制中;
UNKNOWN,未知状态。
*/
public String getStatus() {
return this.Status;
}
/**
* 设置通道状态。其中:
RUNNING,运行中;
CREATING,创建中;
DESTROYING,销毁中;
OPENING,开启中;
CLOSING,关闭中;
CLOSED,已关闭;
ADJUSTING,配置变更中;
ISOLATING,隔离中(欠费触发);
ISOLATED,已隔离(欠费触发);
CLONING,复制中;
UNKNOWN,未知状态。
* @param Status 通道状态。其中:
RUNNING,运行中;
CREATING,创建中;
DESTROYING,销毁中;
OPENING,开启中;
CLOSING,关闭中;
CLOSED,已关闭;
ADJUSTING,配置变更中;
ISOLATING,隔离中(欠费触发);
ISOLATED,已隔离(欠费触发);
CLONING,复制中;
UNKNOWN,未知状态。
*/
public void setStatus(String Status) {
this.Status = Status;
}
/**
* 获取接入域名。
* @return Domain 接入域名。
*/
public String getDomain() {
return this.Domain;
}
/**
* 设置接入域名。
* @param Domain 接入域名。
*/
public void setDomain(String Domain) {
this.Domain = Domain;
}
/**
* 获取接入IP。
* @return IP 接入IP。
*/
public String getIP() {
return this.IP;
}
/**
* 设置接入IP。
* @param IP 接入IP。
*/
public void setIP(String IP) {
this.IP = IP;
}
/**
* 获取通道版本号:1.0,2.0,3.0。
* @return Version 通道版本号:1.0,2.0,3.0。
*/
public String getVersion() {
return this.Version;
}
/**
* 设置通道版本号:1.0,2.0,3.0。
* @param Version 通道版本号:1.0,2.0,3.0。
*/
public void setVersion(String Version) {
this.Version = Version;
}
/**
* 获取(新参数)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
* @return ProxyId (新参数)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
*/
public String getProxyId() {
return this.ProxyId;
}
/**
* 设置(新参数)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
* @param ProxyId (新参数)通道实例ID。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setProxyId(String ProxyId) {
this.ProxyId = ProxyId;
}
/**
* 获取1,该通道可缩扩容;0,该通道无法缩扩容。
* @return Scalarable 1,该通道可缩扩容;0,该通道无法缩扩容。
*/
public Long getScalarable() {
return this.Scalarable;
}
/**
* 设置1,该通道可缩扩容;0,该通道无法缩扩容。
* @param Scalarable 1,该通道可缩扩容;0,该通道无法缩扩容。
*/
public void setScalarable(Long Scalarable) {
this.Scalarable = Scalarable;
}
/**
* 获取支持的协议类型。
* @return SupportProtocols 支持的协议类型。
*/
public String [] getSupportProtocols() {
return this.SupportProtocols;
}
/**
* 设置支持的协议类型。
* @param SupportProtocols 支持的协议类型。
*/
public void setSupportProtocols(String [] SupportProtocols) {
this.SupportProtocols = SupportProtocols;
}
/**
* 获取通道组ID,当通道归属于某一通道组时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
* @return GroupId 通道组ID,当通道归属于某一通道组时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
*/
public String getGroupId() {
return this.GroupId;
}
/**
* 设置通道组ID,当通道归属于某一通道组时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
* @param GroupId 通道组ID,当通道归属于某一通道组时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setGroupId(String GroupId) {
this.GroupId = GroupId;
}
/**
* 获取安全策略ID,当设置了安全策略时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
* @return PolicyId 安全策略ID,当设置了安全策略时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
*/
public String getPolicyId() {
return this.PolicyId;
}
/**
* 设置安全策略ID,当设置了安全策略时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
* @param PolicyId 安全策略ID,当设置了安全策略时,存在该字段。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setPolicyId(String PolicyId) {
this.PolicyId = PolicyId;
}
/**
* 获取接入地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
* @return AccessRegionInfo 接入地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
*/
public RegionDetail getAccessRegionInfo() {
return this.AccessRegionInfo;
}
/**
* 设置接入地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
* @param AccessRegionInfo 接入地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setAccessRegionInfo(RegionDetail AccessRegionInfo) {
this.AccessRegionInfo = AccessRegionInfo;
}
/**
* 获取源站地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
* @return RealServerRegionInfo 源站地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
*/
public RegionDetail getRealServerRegionInfo() {
return this.RealServerRegionInfo;
}
/**
* 设置源站地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
* @param RealServerRegionInfo 源站地域详细信息,包括地域ID和地域名。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setRealServerRegionInfo(RegionDetail RealServerRegionInfo) {
this.RealServerRegionInfo = RealServerRegionInfo;
}
/**
* 获取通道转发IP
* @return ForwardIP 通道转发IP
*/
public String getForwardIP() {
return this.ForwardIP;
}
/**
* 设置通道转发IP
* @param ForwardIP 通道转发IP
*/
public void setForwardIP(String ForwardIP) {
this.ForwardIP = ForwardIP;
}
/**
* 获取标签列表,不存在标签时,该字段为空列表。
注意:此字段可能返回 null,表示取不到有效值。
* @return TagSet 标签列表,不存在标签时,该字段为空列表。
注意:此字段可能返回 null,表示取不到有效值。
*/
public TagPair [] getTagSet() {
return this.TagSet;
}
/**
* 设置标签列表,不存在标签时,该字段为空列表。
注意:此字段可能返回 null,表示取不到有效值。
* @param TagSet 标签列表,不存在标签时,该字段为空列表。
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setTagSet(TagPair [] TagSet) {
this.TagSet = TagSet;
}
/**
* 获取是否支持安全组配置
注意:此字段可能返回 null,表示取不到有效值。
* @return SupportSecurity 是否支持安全组配置
注意:此字段可能返回 null,表示取不到有效值。
*/
public Long getSupportSecurity() {
return this.SupportSecurity;
}
/**
* 设置是否支持安全组配置
注意:此字段可能返回 null,表示取不到有效值。
* @param SupportSecurity 是否支持安全组配置
注意:此字段可能返回 null,表示取不到有效值。
*/
public void setSupportSecurity(Long SupportSecurity) {
this.SupportSecurity = SupportSecurity;
}
/**
* 内部实现,用户禁止调用
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "InstanceId", this.InstanceId);
this.setParamSimple(map, prefix + "CreateTime", this.CreateTime);
this.setParamSimple(map, prefix + "ProjectId", this.ProjectId);
this.setParamSimple(map, prefix + "ProxyName", this.ProxyName);
this.setParamSimple(map, prefix + "AccessRegion", this.AccessRegion);
this.setParamSimple(map, prefix + "RealServerRegion", this.RealServerRegion);
this.setParamSimple(map, prefix + "Bandwidth", this.Bandwidth);
this.setParamSimple(map, prefix + "Concurrent", this.Concurrent);
this.setParamSimple(map, prefix + "Status", this.Status);
this.setParamSimple(map, prefix + "Domain", this.Domain);
this.setParamSimple(map, prefix + "IP", this.IP);
this.setParamSimple(map, prefix + "Version", this.Version);
this.setParamSimple(map, prefix + "ProxyId", this.ProxyId);
this.setParamSimple(map, prefix + "Scalarable", this.Scalarable);
this.setParamArraySimple(map, prefix + "SupportProtocols.", this.SupportProtocols);
this.setParamSimple(map, prefix + "GroupId", this.GroupId);
this.setParamSimple(map, prefix + "PolicyId", this.PolicyId);
this.setParamObj(map, prefix + "AccessRegionInfo.", this.AccessRegionInfo);
this.setParamObj(map, prefix + "RealServerRegionInfo.", this.RealServerRegionInfo);
this.setParamSimple(map, prefix + "ForwardIP", this.ForwardIP);
this.setParamArrayObj(map, prefix + "TagSet.", this.TagSet);
this.setParamSimple(map, prefix + "SupportSecurity", this.SupportSecurity);
}
}
| [
"[email protected]"
] | |
0e65d93ff1f225cba0d6efd5333f1f6b3590d589 | 09649412e12bdc15cf61607e881203735cfafa50 | /proxies/com/microsoft/bingads/adintelligence/SortOrder.java | c8661fe6c8468e9b189c57b3016f5ad01e5897d0 | [
"MIT"
] | permissive | yosefarr/BingAds-Java-SDK | cec603b74a921e71c6173ce112caccdf7c1fdbc8 | d1c333d0ba5b7e434c85a92c7a80dad0add0d634 | refs/heads/master | 2021-01-18T15:02:53.945816 | 2016-03-06T13:18:32 | 2016-03-06T13:18:32 | 51,738,651 | 0 | 1 | null | 2016-02-15T07:38:14 | 2016-02-15T07:38:13 | null | UTF-8 | Java | false | false | 779 | java |
package com.microsoft.bingads.adintelligence;
import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for SortOrder.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* <p>
* <pre>
* <simpleType name="SortOrder">
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <enumeration value="ASCENDING"/>
* <enumeration value="DESCENDING"/>
* </restriction>
* </simpleType>
* </pre>
*
*/
@XmlType(name = "SortOrder")
@XmlEnum
public enum SortOrder {
ASCENDING,
DESCENDING;
public String value() {
return name();
}
public static SortOrder fromValue(String v) {
return valueOf(v);
}
}
| [
"[email protected]"
] | |
3805f6dcf8556a193d67792a26904872eef96585 | 404ef6ccbee81971974a9a80deb4efa0c260200a | /src/test/java/com/kakaopay/Utf8Config.java | 0e98cfcd99d4afad836fbbd1493ac3ac2d9257af | [] | no_license | neoty/kakaopay-money-sprinkle | 2f615cf4655fc4dcf6f3dca2cfad47c6a7faa91b | eaa129999638ada0769ec68dd24b95f092658a8d | refs/heads/main | 2023-03-13T05:38:47.184631 | 2021-03-07T03:44:42 | 2021-03-07T03:44:42 | 330,368,500 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 904 | java | package com.kakaopay;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.MockMvcBuilderCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.web.filter.CharacterEncodingFilter;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@AutoConfigureMockMvc
@Import({
Utf8Config.Config.class,
})
public @interface Utf8Config {
class Config {
@Bean
MockMvcBuilderCustomizer utf8Config() {
return builder ->
builder.addFilters(new CharacterEncodingFilter("UTF-8", true));
}
}
} | [
"[email protected]"
] | |
de2e8b3ce03fabd8dbaca632143c3ee23cd2c2d0 | afaa63d0f02fdd2d4de86545c4e47a79dea29d5d | /LeaderBoard2/src/InsertionSort.java | ed905e6889df2a2e12c90c2e0ccab2b3a578337f | [] | no_license | dart-frog/LeaderBoard2 | 33c7d3b8f24dd55d28a33ebb7401e13bc7ef6e89 | 53441af0210e70a1cf5cc956cae21a884c78fe5c | refs/heads/master | 2021-01-10T19:33:18.902707 | 2013-10-21T04:39:15 | 2013-10-21T04:39:15 | 13,721,500 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | import java.awt.List;
import java.util.ArrayList;
/**
* Uses the insertion sort method to arrange a list of key value pairs from lowest to highest based on thier value
* @author Steve
*
*/
public class InsertionSort {
/**
* takes an arraylist of keyvaluepair pairs and spits out a sorted version
* @param xlist the unsorted array
* @return the sorted array
*/
public static ArrayList<KeyValuePairs> sort(ArrayList<KeyValuePairs> xlist){
for (int j = 1; j < xlist.size(); j++){
int i = j;
while(i > 0 && translate(xlist.get(j)) < translate(xlist.get(i-1))){
i--;
}
KeyValuePairs carry = xlist.get(i);//c = 4
xlist.set(i, xlist.get(j)); // 1,5,9,1,8,3
for (int k = 1; j > (i+k); k++){ //k=1
KeyValuePairs xcarry = carry; // 4
carry = xlist.get(i+k);
xlist.set(i+k, xcarry);// 1,4,9,1,8,3
}
}
return xlist;
}
/**
* takes a key Value Pair and spits out the value as an interger
* @param x the key value
* @return the parsed value
*/
public static int translate(KeyValuePairs x){
String p = x.getValue();
int q = Integer.parseInt(p);
return q;
}
}
| [
"Steve@Steve-DellPC"
] | Steve@Steve-DellPC |
aae45a408ae22da6056fffade0a2132c69cf909d | cd4261100babeb94822baf0a25172753c0097451 | /ribbon-service/src/main/java/com/cn/bo/pojo/User.java | 4e96b9ce875d170b8b64ed9167c04b3ce2becc39 | [] | no_license | wangbo9988/springcloud-learning | 16005799b1b68a367d2f0c54512246a277f84088 | f2a01aa932445ddbf84a766793416cde9366939f | refs/heads/master | 2020-12-07T18:11:13.764459 | 2020-07-14T13:09:19 | 2020-07-14T13:09:19 | 232,768,239 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package com.cn.bo.pojo;
/**
* @ClassName User
* @Description TOD0
* @Author mr.wang
* @Date 2020/1/10 11:15 上午
* @Version v1.0
*/
public class User {
/**
* 用户id
*/
private Long id;
/**
* 用户名
*/
private String username;
/**
* 用户密码
*/
private String password;
public User() {
}
public User(Long id, String username, String password) {
this.id = id;
this.username = username;
this.password = password;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
8de0082026ba0d8d17905fdc2c0046bdcc863071 | 615e95ed985dabaa0c8ed0f861567305b27c80fe | /Assignment 9 - Lab/src/Type.java | e0269fc7c384281e9e4e877140e882fb9ed65312 | [] | no_license | VOL898/java-exercises | 61b911d2f4d4a7db19e14c2e163301e5251cb4a8 | 6782522e60f3d4ef0598640a91c7929aedc0a17e | refs/heads/master | 2022-06-21T22:36:09.890195 | 2020-05-12T13:17:00 | 2020-05-12T13:17:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | import java.util.*;
public enum Type{
HARE, TURTLE, UNDEFINED;
public static Type from(String type) {
if ( Objects.isNull(type) ) {
return UNDEFINED;
}
switch ( type.trim().toLowerCase() ) {
case "hare": return HARE;
case "turtle": return TURTLE;
}
return UNDEFINED;
}
public boolean isUndefined() {
return UNDEFINED.equals(this);
}
public boolean isHare() {
return HARE.equals(this);
}
}
| [
"[email protected]"
] | |
86653e5284bbed2abf856ea5107d74fce416c18f | 7d0cc6f3c51ccf9b88d0bf7233bc2a908c886d74 | /src/LeetCode/Leetcode134.java | 893a67ff0f05114c7613e5fc8b63da04c997a4a2 | [] | no_license | JiangYueLi/LeetcodeHyh | 533c7b44951a250a639beffe7655b65051bb496f | 381b4ccdfa301119b5a8ea91388e4f5b72ee9289 | refs/heads/master | 2023-05-15T01:43:41.709614 | 2021-05-23T09:02:56 | 2021-05-23T09:02:56 | 370,004,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package LeetCode;
public class Leetcode134 {
public int canCompleteCircuit(int[] gas, int[] cost) {
int rest = 0, run = 0, start = 0;
for (int i = 0; i < gas.length; ++i){
run += (gas[i] - cost[i]);
rest += (gas[i] - cost[i]);
if (run < 0){
start = i + 1;
run = 0;
}
}
return rest < 0 ? -1: start;
}
}
| [
"[email protected]"
] | |
bee5d4347057a220d8d62ea55b4bb9a547015844 | d3da9938824e16a28d8ef60409c956d059ddc813 | /app/src/main/java/ng/com/silveredgeprojects/nearbyshop/ShopsByCategory/Interfaces/NotifyGeneral.java | b78dd76ab6183103ea1e9565f4e3198b8f48a5ae | [] | no_license | arowolojoshuao/NearbyShop | 4de6a7be56c968f4702fa340ae1b8a0279e9749e | 725a764d94ca92eac3c98496f80b70fbe32291b7 | refs/heads/master | 2020-05-05T03:34:54.390003 | 2019-04-05T12:40:14 | 2019-04-05T12:40:14 | 179,678,460 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 261 | java | package ng.com.silveredgeprojects.nearbyshop.ShopsByCategory.Interfaces;
/**
* Created by sumeet on 27/6/16.
*/
public interface NotifyGeneral {
void insertTab(String categoryName);
void removeLastTab();
void notifySwipeToright();
}
| [
"[email protected]"
] | |
db52bcafc6fbba1dd8e9e3c996ec95e374c0b8fc | dc5a181a4d891ea0eed94a15489b6e96dcdb9502 | /app/src/main/java/psuva/com/ph/psuvotingsystem/PartyListAdd.java | 5a0bc14b8205038e4e0fbab87da500172f234f08 | [] | no_license | theshook/PSUVotingApp | 54d15b08cede8dcf317f858ec0fd97f8039420be | 48ed2473026217a31ec4c709c708032dbc3ed4c4 | refs/heads/master | 2020-04-10T06:01:58.834503 | 2018-12-13T18:50:52 | 2018-12-13T18:50:52 | 160,844,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,648 | java | package psuva.com.ph.psuvotingsystem;
import android.app.ProgressDialog;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.DocumentReference;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.Query;
import com.google.firebase.firestore.QuerySnapshot;
import java.security.acl.Group;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class PartyListAdd extends AppCompatActivity {
private FirebaseFirestore db = FirebaseFirestore.getInstance();
private EditText edtFname, edtLname;
private Spinner spinParty, spinPosition;
private Button btnSave;
private Voter voterDetails;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_party_list_add);
voterDetails = (Voter) getIntent().getSerializableExtra("voterDetails");
edtFname = findViewById(R.id.txt_p_firstName2);
edtLname = findViewById(R.id.txt_v_lastName);
spinParty = findViewById(R.id.spinPartyList2);
spinPosition = findViewById(R.id.spinPosition2);
btnSave = findViewById(R.id.btn_p_save2);
db.collection("groups").orderBy("groups", Query.Direction.ASCENDING).get()
.addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot queryDocumentSnapshots) {
if (!queryDocumentSnapshots.isEmpty()) {
List<DocumentSnapshot> list = queryDocumentSnapshots.getDocuments();
final List<String> courses = new ArrayList<String>();
for (DocumentSnapshot d : list) {
Groups p = d.toObject(Groups.class);
p.setId(d.getId());
courses.add(p.getGroups());
}
ArrayAdapter<String> courseAdapter = new ArrayAdapter<String>(PartyListAdd.this, android.R.layout.simple_spinner_item, courses);
courseAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinParty.setAdapter(courseAdapter);
}
}
});
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(PartyListAdd.this, R.array.Positions, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinPosition.setAdapter(adapter);
btnSaveOnClick();
}
private void btnSaveOnClick() {
btnSave.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String fname, lname, spinP, spinPartyList;
fname = edtFname.getText().toString().trim();
lname = edtLname.getText().toString().trim();
spinP = spinPosition.getSelectedItem().toString();
spinPartyList = spinParty.getSelectedItem().toString();
if (TextUtils.isEmpty(fname)) {
Toast.makeText(PartyListAdd.this, "Please input value for First Name.", Toast.LENGTH_SHORT).show();
return;
}
if (TextUtils.isEmpty(lname)) {
Toast.makeText(PartyListAdd.this, "Please input value for Last Name.", Toast.LENGTH_SHORT).show();
return;
}
final ProgressDialog pd = new ProgressDialog(PartyListAdd.this);
pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
pd.setMessage("Fetching data. . . ");
pd.setIndeterminate(true);
pd.setCancelable(false);
pd.show();
CollectionReference dbPartyList = db.collection("partylist");
PartyList partyList = new PartyList(fname, lname, spinP, spinPartyList, 0);
dbPartyList.add(partyList)
.addOnCompleteListener(new OnCompleteListener<DocumentReference>() {
@Override
public void onComplete(@NonNull Task<DocumentReference> task) {
if (task.isSuccessful()) {
Toast.makeText(PartyListAdd.this, "Succesfully saved.", Toast.LENGTH_SHORT).show();
Intent i = new Intent(PartyListAdd.this, MainActivity.class);
Map<String, Boolean> isVoted = (Map<String, Boolean>) voterDetails.getIsVoted();
Voter v = new Voter(
voterDetails.getVote_FirstName(),
voterDetails.getVote_LastName(),
voterDetails.getVote_Course(),
voterDetails.getVote_IdNumber(),
voterDetails.getVote_email(),
isVoted);
v.setId(voterDetails.getId());
i.putExtra("voterDetails", v);
i.putExtra("frgToLoad", "nav_gallery");
pd.dismiss();
finish();
startActivity(i);
} else {
Toast.makeText(PartyListAdd.this, "Please check your inputs.", Toast.LENGTH_SHORT).show();
}
}
});
}
});
}
}
| [
"[email protected]"
] | |
0864d304e94c06b37f9556816f1ee4f9a23d04dc | 9e40446a92a02ef7920229a62317e02afd9a3e81 | /src/garageapplication/FXMLSimulationController.java | 36a49ece2e73ab6acda024bbe52fa70bc3093da3 | [] | no_license | tijanalakic/GarageApplication | 4c7acacf96aae2461b8fe6999c9498f758bbd8be | 72f84293a4355b5dcf92e797973e13f4f9b61974 | refs/heads/master | 2022-01-29T09:55:31.462427 | 2022-01-20T11:49:15 | 2022-01-20T11:49:15 | 144,162,467 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,450 | 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 garageapplication;
import garaza.Platforma;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.ResourceBundle;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextArea;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import javafx.stage.WindowEvent;
import specijalnovozilo.InstitutionalInterface;
import vozilo.Vozilo;
/**
*
* @author Tijana Lakic
*/
public class FXMLSimulationController implements Initializable {
@FXML
private ComboBox platformaComboBox;
@FXML
private TextArea simulationTextArea;
@FXML
private Button addVoziloButton;
@FXML
private ComboBox addVoziloComboBox;
@FXML
private Label addVoziloWarningLabel;
public ExecutorService executor = Executors.newFixedThreadPool(100);
@FXML
private AnchorPane applicationMainAnchorPane;
@FXML
private Label brojPlatformeLabel;
@FXML
private Label evidencijaNaplateLabel;
@Override
public void initialize(URL url, ResourceBundle rb) {
for (int i = 0; i < Integer.parseInt(utils.Utils.PROPERTIES.getProperty("BROJ_PLATFORMI")); i++) {
platformaComboBox.getItems().add(i);
}
platformaComboBox.getSelectionModel().selectFirst();
addVoziloComboBox.getItems().addAll("Automobil", "Kombi", "Motocikl");
GarageApplication.getExchanger().setSimulacijaMatrica(simulationTextArea);
GarageApplication.getExchanger().refreshSimulacijaMatrica();
simulationTextArea.setStyle("-fx-font: 58 monospace");
for (int k = 0; k < GarageApplication.getExchanger().getGaraza().getBrojPlatformi(); k++) {
int brojVozilaKojaSeIsparkiravaju = (int) Math.round(GarageApplication.getExchanger().getBrojVozila(k) * 0.15);
for (int i = 0; i < brojVozilaKojaSeIsparkiravaju; i++) {
Boolean isparkiraj = false;
while (!isparkiraj) {
int x = new Random().nextInt(4);
int y = new Random().nextInt(8);
Object vozilo = GarageApplication.getExchanger().getGaraza().getPlatforme().get(k).getElement(Platforma.Xparking[x],
Platforma.Yparking[y]);
if (vozilo instanceof Vozilo && !(vozilo instanceof InstitutionalInterface)
&& !((Vozilo) vozilo).isAlive()) {
executor.submit((Vozilo) vozilo);
isparkiraj = true;
}
}
}
}
}
@FXML
public void addVoziloButtonAction() throws IOException {
int ukupanBrojVozilaUGarazi=0;
for(int i=0;i<GarageApplication.getExchanger().getGaraza().getBrojPlatformi();i++){
ukupanBrojVozilaUGarazi+=GarageApplication.getExchanger().getBrojVozila(i);
}
System.out.println("ukupno vozila" +ukupanBrojVozilaUGarazi);
int kapacitetGaraze=28*GarageApplication.getExchanger().getGaraza().getBrojPlatformi();
if(ukupanBrojVozilaUGarazi==kapacitetGaraze){
utils.MyAlert.display("Obavjestene", "Kapacitet garaze je trenutno popunjen.", "info");
}else{
if (addVoziloComboBox.getSelectionModel().isEmpty()) {
addVoziloWarningLabel.setText("Odaberite tip vozila!");
return;
}
addVoziloWarningLabel.setText("");
String vozilo = addVoziloComboBox.getSelectionModel().getSelectedItem().toString();
GarageApplication.getExchanger().setVoziloInput(vozilo);
Stage newStage = new Stage();
Parent root = FXMLLoader.load(getClass().getResource("FXMLAddVozilo.fxml"));
Scene stageScene = new Scene(root, 400, 500);
newStage.setScene(stageScene);
switch (vozilo) {
case "Automobil": {
newStage.setHeight(680);
break;
}
case "Kombi": {
newStage.setHeight(680);
break;
}
case "Motocikl": {
newStage.setHeight(640);
break;
}
}
newStage.showAndWait();
RootExchanger.VOZILO_KRETANJE.setParkiran(false);
RootExchanger.VOZILO_KRETANJE.start();
}
}
@FXML
private void izborPlatformeOnAction(ActionEvent event) {
int nivo = Integer.parseInt(platformaComboBox.getSelectionModel().getSelectedItem().toString());
GarageApplication.getExchanger().setNivoPrikaz(nivo);
simulationTextArea.clear();
simulationTextArea.setText(FXMLUserApplicationController.garaza.getPlatforme().
get(nivo).toString());
}
@FXML
private void evidencijaNaplateParkingaOnAction(ActionEvent event) {
Iterator it = GarageApplication.getExchanger().getGaraza().getEvidencijaNaplateParkinga().entrySet().iterator();
ArrayList<String> evidencijaNaplate = new ArrayList<>();
while (it.hasNext()) {
Map.Entry pairs = (Map.Entry) it.next();
Vozilo vozilo = (Vozilo) pairs.getKey();
evidencijaNaplate.add(vozilo.getRegistarskiBroj() + "," + vozilo.getVrijemeUlaska() + "," + pairs.getValue());
}
try {
utils.Utils.kreirajCsvFajl(evidencijaNaplate);
} catch (IOException ex) {
Logger.getLogger("error.log").log(Level.SEVERE, null, ex);
evidencijaNaplateLabel.setText("Doslo je do greske");
}
evidencijaNaplateLabel.setText("Uspjesno kreiran CSV");
}
}
| [
"[email protected]"
] | |
34c5f44ef961389c9e674e4de09fc324bcce3b6b | ebc13a3f9dbbef3fb6101c30217d3417f10543f2 | /testJava/src/main/java/cjy/com/kafka/TestConsumer.java | 9288619f5fc1f54242dc3fc4aa3a259ed6a2b40e | [] | no_license | panqingcui/test | 27aaf5ac12d0ec625f32f8b02c389065511473ef | df7c2f7f33d51e3b751338c6031764faf4c3765d | refs/heads/master | 2020-05-25T15:43:55.200443 | 2016-09-06T05:34:25 | 2016-09-06T05:34:25 | 43,406,485 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,786 | java | /*
* Copyright (c) 2013-2014 Shandong Antrol Network Technology Co.Ltd. All rights reserved. 版权所有(c) 2013-2014
* 山东蚁巡网络科技有限公司。保留所有权利
*/
package cjy.com.kafka;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import kafka.consumer.ConsumerConfig;
import kafka.consumer.ConsumerIterator;
import kafka.consumer.KafkaStream;
import com.alibaba.fastjson.JSON;
/**
* <p>功能描述,该部分必须以中文句号结尾。<p>
*
* 创建日期 2014年12月26日<br>
* @author $Author$<br>
* @version $Revision$ $Date$
* @since 3.0.0
*/
public class TestConsumer {
public static void main(String[] args) {
Properties props = new Properties();
props.put("zookeeper.connect", KafkaProperties.zkConnect);
props.put("group.id", "groupId");
props.put("zookeeper.session.timeout.ms", "60000");
props.put("rebalance.backoff.ms", "400");
props.put("zookeeper.sync.time.ms", "200");
props.put("auto.commit.interval.ms", "10000");
ConsumerConfig config = new ConsumerConfig(props);
kafka.javaapi.consumer.ConsumerConnector connector = kafka.consumer.Consumer
.createJavaConsumerConnector(config);
Map<String, Integer> topicCountMap = new HashMap<String, Integer>();
topicCountMap.put("wl", new Integer(1));
Map<String, List<KafkaStream<byte[], byte[]>>> map = connector.createMessageStreams(topicCountMap);
KafkaStream<byte[], byte[]> stream = map.get("wl").get(0);
ConsumerIterator<byte[], byte[]> it = stream.iterator();
while (it.hasNext())
System.out.println((JSON.parseObject(new String(it.next().message()), KeyWord.class)));
}
}
| [
"[email protected]"
] | |
e1495ef1767328f6a4d0e7800c6f3e980370c98b | 29df17f3b1f06317d98c384d477e0f840e47dd47 | /app/src/main/java/org/port/trade/activity/MainActivity.java | 9752e7f10bdb977df89994cd4a37811d38241b6d | [] | no_license | shenhgithub/PortTradeMobile | 916874d4c936def00147e0de041b853b7fe7f2fc | afb79a74aabb8543238fe223ef7ae16503968434 | refs/heads/master | 2020-03-24T20:42:48.543254 | 2018-07-31T09:35:02 | 2018-07-31T09:35:02 | 142,993,166 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,478 | java | package org.port.trade.activity;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import org.mobile.common.function.CheckUpdate;
import org.mobile.common.view.SlidingTabLayout;
import org.mobile.model.operate.BackHandle;
import org.mobile.model.operate.TitleHandle;
import org.mobile.util.ApplicationVersion;
import org.port.trade.R;
import org.port.trade.adapter.ViewPagerAdapter;
import org.port.trade.util.StaticValue;
public class MainActivity extends ActionBarActivity {
/**
* 版本更新提示延迟时间
*/
private static final long UPDATE_TIME = 2000;
/**
* 标题栏的标题文本
*/
private TextView toolbarTitleTextView = null;
/**
* 滑动分页
*/
private ViewPager viewPager = null;
/**
* ViewPager的Fragment适配器
*/
private ViewPagerAdapter viewPagerAdapter = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// 加载界面
initView();
// 新版本提示
showUpdate();
}
@Override
protected void onStart() {
super.onStart();
}
/**
* 初始化控件
*/
private void initView() {
// 初始化Toolbar
initToolbar();
// 初始化ViewPager和底部导航栏
initViewPagerAndTab();
}
/**
* 新版本提示
*/
private void showUpdate() {
if (!ApplicationVersion.getVersionManager().isLatestVersion()) {
// 存在新版本,进行提示
Handler handler = new Handler();
Runnable runnable = new Runnable() {
@Override
public void run() {
CheckUpdate checkUpdate = new CheckUpdate(MainActivity.this, StaticValue.APP_CODE);
checkUpdate.checkInBackground();
}
};
handler.postDelayed(runnable, UPDATE_TIME);
}
}
/**
* 初始化标题栏
*/
private void initToolbar() {
// 得到Toolbar标题栏
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
// 得到标题文本
toolbarTitleTextView = (TextView) findViewById(R.id.toolbar_title);
// 关联ActionBar
setSupportActionBar(toolbar);
// 取消原actionBar标题
getSupportActionBar().setDisplayShowTitleEnabled(false);
}
/**
* 初始化ViewPager和底部导航栏
*/
private void initViewPagerAndTab() {
// 底部导航栏
SlidingTabLayout slidingTabLayout = (SlidingTabLayout) findViewById(R.id.sliding_tab);
viewPager = (ViewPager) findViewById(R.id.pager);
viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
viewPager.setOffscreenPageLimit(4);
viewPager.setAdapter(viewPagerAdapter);
// 设置SlidingTab的自定义标签布局
slidingTabLayout.setCustomTabView(R.layout.tab_item, R.id.tab_textView, R.id.tab_imageView, viewPagerAdapter.getImageIds());
// 设置底部滚动条颜色
slidingTabLayout.setSelectedIndicatorColors(getResources().getColor(R.color.toolbar_color));
// 设置页切换监听器
slidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
// 变更标题
setTitle(getChangedPageTitle(position));
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
// 装载ViewPager
slidingTabLayout.setViewPager(viewPager);
}
/**
* 获取页切换时变更的标题
*
* @param position 页序号
*
* @return 标题字符串
*/
private CharSequence getChangedPageTitle(int position) {
// 优先尝试使用嵌套的子布局提供的标题
// 获取当前显示的对象
Object currentObject = viewPagerAdapter.instantiateItem(viewPager, position);
// 判断是否实现了标题操作接口
if (currentObject instanceof TitleHandle) {
// 转换为标题操作接口
TitleHandle titleHandle = (TitleHandle) currentObject;
// 获取标题
String title = titleHandle.getTitle();
if (title != null && title.length() > 0) {
// 不为空则返回该标题
return title;
}
}
// 如果子布局标题获取失败则使用底部导航栏标题
return viewPagerAdapter.getPageTitle(position);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
return super.onOptionsItemSelected(item);
}
@Override
public void onBackPressed() {
// 获取当前显示的对象
Object currentObject = viewPagerAdapter.instantiateItem(viewPager, viewPager.getCurrentItem());
// 判断是否实现了返回操作接口
if (currentObject instanceof BackHandle) {
// 转换为返回操作接口
BackHandle backHandled = (BackHandle) currentObject;
// 执行返回动作
if (!backHandled.onBackPressed()) {
super.onBackPressed();
}
} else {
super.onBackPressed();
}
}
@Override
protected void onTitleChanged(CharSequence title, int color) {
super.onTitleChanged(title, color);
// 设置标题
toolbarTitleTextView.setText(title);
}
}
| [
"[email protected]"
] | |
9279ea196e2a6ae27d2d6ca858b30046c97414a3 | 8e2584689a9fe5f40c78cce0b98861af134d34bf | /source/org/zootella/cheat/desktop/Open.java | 9214d90ed7f3e46022a266ff838aa1f9039fd58a | [] | no_license | zootella/cheat | 29cd99a859165c5eeb05c0246b59380f08f57814 | 69e83efe2c5f2751df5d64140dbf17bfaab4fbb7 | refs/heads/master | 2020-06-08T12:20:07.898769 | 2009-08-31T14:37:15 | 2009-08-31T14:37:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 832 | java | package org.zootella.cheat.desktop;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import org.zootella.cheat.file.Path;
import org.zootella.cheat.process.Mistake;
public class Open {
// -------- Run programs, open files, and browse to Web pages --------
/** Open the file at the given path, as though the user had double-clicked it on the desktop. */
public static void file(Path path) {
try {
Desktop.getDesktop().open(path.file);
} catch (IOException e) { Mistake.log(e); } // Don't do anything if it doesn't work
}
/** Open the given Web address in the user's default Web browser. */
public static void url(URI url) {
try {
Desktop.getDesktop().browse(url);
} catch (IOException e) { Mistake.log(e); } // Don't do anything if it doesn't work
}
}
| [
"Kevin@davepc2.(none)"
] | Kevin@davepc2.(none) |
b0617843380568766de11b76f9e8dbe9b22f42bc | e5ed99e5ecb420440c4edad08f8cdcdc90b6373b | /src/main/java/com/carlosfilipe/zup/bootcamp/nossobancodigital/nossobancodigital/service/implentacao/ClienteServiceImplement.java | a82b6e8d70eaa9c0b89f65d658d2f553fb2cca5d | [] | no_license | cfilipeandrade/Nosso-Banco-Digital | 393f0908e9887e4d791b6a1b4d6f388ef3c19782 | dfd122c73604322bab88e78398be377587dea73a | refs/heads/main | 2022-12-28T23:22:16.462978 | 2020-10-20T23:34:29 | 2020-10-20T23:34:29 | 305,823,770 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,378 | java | package com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.service.implentacao;
import java.util.List;
import java.util.Optional;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.dto.resposta.RespostaClienteDTO;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.dto.solicitacao.ClienteDTO;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.exception.RecursoNaoEncontrado;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.mapper.ClienteMapper;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.model.Cliente;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.model.Endereco;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.repository.ClienteRepository;
import com.carlosfilipe.zup.bootcamp.nossobancodigital.nossobancodigital.service.interfaces.ClienteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@Service
public class ClienteServiceImplement implements ClienteService {
@Autowired
ClienteRepository clienteRepository;
@Autowired
ClienteMapper clienteMapper;
private Cliente converterParaCliente(ClienteDTO cliente) {
return clienteMapper.converterParaCliente(cliente);
}
private List<RespostaClienteDTO> converterParaListaRespostaClienteDTO(List<Cliente> listaClientes) {
return clienteMapper.converterParaListaRespostaClienteDTO(listaClientes);
}
private Page<RespostaClienteDTO> converterParaPageRespostaClienteDTO(Page<Cliente> paginaClientes,
Pageable pageable) {
List<RespostaClienteDTO> dtos = converterParaListaRespostaClienteDTO(paginaClientes.getContent());
return new PageImpl<>(dtos, pageable, paginaClientes.getTotalElements());
}
@Override
public Page<RespostaClienteDTO> buscarTodosClientes(Pageable pageable) {
Page<Cliente> paginaClientes = clienteRepository.findAll(pageable);
return converterParaPageRespostaClienteDTO(paginaClientes, pageable);
}
@Override
public Page<RespostaClienteDTO> buscarClienteNome(String nome, Pageable pageable) {
Page<Cliente> paginaClientes = clienteRepository.findAllByPrimeiroNome(nome, pageable);
return converterParaPageRespostaClienteDTO(paginaClientes, pageable);
}
@Override
public Cliente buscarClienteId(Long id) {
Optional<Cliente> clienteOptional = clienteRepository.findById(id);
return clienteOptional.orElseThrow(() -> new RecursoNaoEncontrado("Não existe cliente com o ID: " + id));
}
@Override
public Cliente buscarClienteCPF(String cpf) {
Optional<Cliente> clienteOptional = clienteRepository.findByCpf(cpf);
return clienteOptional.orElseThrow(() -> new RecursoNaoEncontrado("Não existe cliente cadastrado com o CPF: " + cpf));
}
@Override
public Cliente buscarClienteEmail(String email) {
Optional<Cliente> clienteOptional = clienteRepository.findByEmail(email);
return clienteOptional.orElseThrow(() -> new RecursoNaoEncontrado("Não existe cliente cadastrado com o E-mail: " + email));
}
@Override
public Cliente atualizarClientePeloId(Long id, ClienteDTO cliente) {
Cliente clienteEncontrado = buscarClienteId(id);
clienteEncontrado.setCpf(cliente.getCpf());
clienteEncontrado.setDataNascimento(cliente.getDataDeNascimento());
clienteEncontrado.setEmail(cliente.getEmail());
clienteEncontrado.setPrimeiroNome(cliente.getNome());
clienteEncontrado.setSobrenome(cliente.getSobrenome());
return clienteRepository.save(clienteEncontrado);
}
@Override
public Cliente salvarNovoCliente(ClienteDTO clienteDTO) {
Cliente cliente = converterParaCliente(clienteDTO);
return clienteRepository.save(cliente);
}
@Override
public void deletarClienteId(Long id) {
Cliente clienteEncontrado = buscarClienteId(id);
clienteRepository.delete(clienteEncontrado);
}
@Override
public void salvarEnderecoCliente(Cliente cliente, Endereco endereco) {
cliente.setEndereco(endereco);
clienteRepository.save(cliente);
}
@Override
public Cliente seExistirRetornarEnderecoClienteId(Long id) {
Cliente clienteEncontrado = buscarClienteId(id);
Optional<Cliente> enderecoOptional = clienteRepository.findByEndereco(clienteEncontrado.getEndereco());
return enderecoOptional.orElseThrow(() -> new RecursoNaoEncontrado("O cliente do ID " + id + " não possui endereço cadastrado"));
}
@Override
public Page<RespostaClienteDTO> buscarTodosClientes(
org.springframework.boot.autoconfigure.data.web.SpringDataWebProperties.Pageable pageable) {
// TODO Auto-generated method stub
return null;
}
@Override
public Page<RespostaClienteDTO> buscarClienteNome(String name,
org.springframework.boot.autoconfigure.data.web.SpringDataWebProperties.Pageable pageable) {
// TODO Auto-generated method stub
return null;
}
}
| [
"[email protected]"
] | |
51fcad2f8160bcff9569b5ef046a2d66917fa02a | 00a95f3e5ef488372f0542dbf221dc8f77ce059c | /spring-cloud-reactivefeign-core/src/test/java/org/springframework/cloud/openfeign/reactive/testcase/IcecreamServiceApi.java | a570b3df83deb6485ff88ae040778165d1ce5e81 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0"
] | permissive | azeem87/spring-cloud-openfeign | b1945701c67f6e6d1a074d56c41436cc1d24924b | a563b60e70b88344efa73518decea51eb864e392 | refs/heads/master | 2020-04-24T01:41:17.097218 | 2018-07-25T20:27:15 | 2018-07-25T20:27:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,120 | java | /*
* Copyright 2013-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.openfeign.reactive.testcase;
import org.springframework.cloud.openfeign.reactive.testcase.domain.Bill;
import org.springframework.cloud.openfeign.reactive.testcase.domain.Flavor;
import org.springframework.cloud.openfeign.reactive.testcase.domain.IceCreamOrder;
import org.springframework.cloud.openfeign.reactive.testcase.domain.Mixin;
import feign.Headers;
import feign.Param;
import feign.RequestLine;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/**
* API of an iceream web service.
*
* @author Sergii Karpenko
*/
@Headers({ "Accept: application/json" })
public interface IcecreamServiceApi {
RuntimeException RUNTIME_EXCEPTION = new RuntimeException("tests exception");
@RequestLine("GET /icecream/flavors")
Flux<Flavor> getAvailableFlavors();
@RequestLine("GET /icecream/mixins")
Flux<Mixin> getAvailableMixins();
@RequestLine("POST /icecream/orders")
@Headers("Content-Type: application/json")
Mono<Bill> makeOrder(IceCreamOrder order);
@RequestLine("GET /icecream/orders/{orderId}")
Mono<IceCreamOrder> findOrder(@Param("orderId") int orderId);
@RequestLine("POST /icecream/bills/pay")
@Headers("Content-Type: application/json")
Mono<Void> payBill(Bill bill);
default Mono<IceCreamOrder> findFirstOrder() {
return findOrder(1);
}
default Mono<IceCreamOrder> throwExceptionMono() {
throw RUNTIME_EXCEPTION;
}
default Flux<IceCreamOrder> throwExceptionFlux() {
throw RUNTIME_EXCEPTION;
}
}
| [
"[email protected]"
] | |
6b98f0f874d5adb84ba471c46ad16b01ae9dad70 | c249b7323068150e6d359b63f6edabdc3f530db3 | /src/GameState/ModeChanger.java | 2c87a03fd97d992c047dae178bcaa0db5db318fe | [] | no_license | BillSdev/Java-Maplestory | 287575a484d1cdeb8c20cb46cb201aecc30fd33c | 9a6bdbd7fb5c45ffd221e17efd12d5ee18c55b93 | refs/heads/master | 2020-05-25T18:05:14.239235 | 2019-05-22T10:45:22 | 2019-05-22T10:45:22 | 187,922,309 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,731 | java | package GameState;
import java.awt.Graphics2D;
import java.awt.event.MouseEvent;
public class ModeChanger
{
Mode[] modes;
int currentMode;
public static final int NUMOFGAMEMODES = 4;
public static final int MENUMODE = 0;
public static final int PLAYMODE = 1;
public static final int DEADMODE = 2;
public static final int PAUSEMODE = 3;
public ModeChanger()
{
modes = new Mode[4];
currentMode = 0;
loadMode(currentMode);
}
private void loadMode(int mode)
{
if (mode == 0) {
modes[mode] = new MenuMode(this);
}
if (mode == 1) {
modes[mode] = new PlayMode(this);
}
// if (state == 2) { implement later
// modes[state] = new DeadMode(this);
// }
// if (state == 3) {
// modes[state] = new PauseMode(this);
// }
}
public void setMode(int mode)
{
//unloadMode();
modes[currentMode] = null;
currentMode = mode;
loadMode(currentMode);
}
// private void unloadMode()
// {
// modes[currentMode] = null;
// }
public void update() {
if(modes[currentMode] != null)
modes[currentMode].update();
}
public void draw(Graphics2D g)
{
if(modes[currentMode] != null)
modes[currentMode].draw(g);
}
public void keyPressed(int k)
{
modes[currentMode].keyPressed(k);
}
public void keyReleased(int k)
{
modes[currentMode].keyReleased(k);
}
public void mousePressed(MouseEvent e)
{
modes[currentMode].mousePressed(e);
}
public void mouseReleased(MouseEvent e)
{
modes[currentMode].mouseReleased(e);
}
}
| [
"[email protected]"
] | |
10b8b24ff77537cd38a5716e12bd36e55e6afe54 | f18c96dbd335aebfacc6553b190e5e37a00f1fc8 | /spring_project/SinChonBeer/src/main/java/com/bitcamp/sc/ScApplication.java | c5a0e33bc78ca578b7ed0361cebc4fc7e6ac3674 | [] | no_license | flip1945/Java205 | 9f710156b344048faf3aaa925302c82e24fbb268 | ea34da4a411fe7ab2ac938a48caa203a29d54b12 | refs/heads/main | 2023-07-13T20:28:59.633857 | 2021-09-01T11:27:13 | 2021-09-01T11:27:13 | 370,222,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package com.bitcamp.sc;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ScApplication {
public static void main(String[] args) {
SpringApplication.run(ScApplication.class, args);
}
}
| [
"[email protected]"
] | |
d58ac19dc6359f0416533d027204e9a169c831d8 | 4abd603f82fdfa5f5503c212605f35979b77c406 | /html/Programs/hw5-1/c49cc328f265664efb5f6b88b193eef4/ConvexHullVertix.java | 96daa45ca237812db0fc549a25bd25af89740bab | [] | no_license | dn070017/1042-PDSA | b23070f51946c8ac708d3ab9f447ab8185bd2a34 | 5e7d7b1b2c9d751a93de9725316aa3b8f59652e6 | refs/heads/master | 2020-03-20T12:13:43.229042 | 2018-06-15T01:00:48 | 2018-06-15T01:00:48 | 137,424,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,463 | java | import java.io.BufferedReader;
import java.io.FileReader;
import java.util.Random;
import java.util.Arrays;
import java.io.BufferedReader;
import java.io.FileReader;
public class MyConvexHull{
public static int[] ConvexHullVertex(Point2D[] a) {
int n = a.length;
Point2D[] points = new Point2D[n];
for(int i = 0; i < n;i++){
points[i] = new Point2D(a[i].x(), a[i].y());
}
Arrays.sort(points, Point2D.Y_ORDER );
Arrays.sort(points, points[0].POLAR_ORDER );
Stack<Integer> hull = new Stack<Integer>();
int[] p = new int[3];
p[0] = 0;p[1] = 1;p[2] = 2;
int counter = 2;
while(counter < n){
if(Point2D.ccw(points[p[0]], points[p[1]], points[p[2]]) == 1){
hull.push(p[0]);
counter++;
p[0] = p[1];
p[1] = p[2];
p[2] = counter;
}
else{
p[1] = p[0];
p[0] = hull.pop();
}
}
for(int i = 0; i<2;i++){
hull.push(p[i]);
}
int size = hull.size();
int[] result = new int[size];
int[] result2 = new int[size];
for(int i = 0; i < size; i++){
result[i] = hull.pop();
}
for(int i=0;i < size;i++){
for(int j=0;j < n;j++){
if(points[result[i]].equals(a[j])){
result2[i] = j;
}
}
}
return result2;
}
public static void main(String[] args) throws Exception{
try(BufferedReader br = new BufferedReader(new FileReader(args[0]))){
String data = br.readLine();
double r = Double.parseDouble(data);
//System.out.print(r);
//System.out.print(""\n"");
String data2 =br.readLine();
int n = Integer.parseInt(data2);
//System.out.print(n);
// System.out.print(""\n"");
Point2D[] points = new Point2D[n];
for(int i=0;i < n ; i++){
String cor[] = br.readLine().split("" "");
points[i] = new Point2D(Double.parseDouble(cor[0]), Double.parseDouble(cor[1]));
}
/*
StdDraw.setCanvasSize(500, 500);
StdDraw.setXscale(0, 1);
StdDraw.setYscale(0, 1);
StdDraw.setPenRadius(.02);
for(int i =0;i<n;i++){
points[i].draw();
}
*/
int[] result = ConvexHullVertex(points);
// 1. read in the file containing N 2-dimentional points
// 2. create an edge for each pair of points with a distance <= d
// 3. find connected components (CCs) with a size >= 3
// 4. for each CC, find its convex hull vertices by calling ConvexHullVertex(a[])
// 5. count the number of points in N serving as a convex hull vertex, print it
}
}
}
| [
"[email protected]"
] | |
49a200f388b32a8d7d8bf07fff9bd30faf149044 | d96e286e35029689176152bc056ee963020311fe | /src/main/java/com/moelyon/learning/concurrent/Priority.java | ba7a31dce843bbe6d9fd725d64a5ed4cbd414428 | [
"MIT"
] | permissive | krislint/java_learning | ff4d6ba480b08e8d414b20136d948d6455e71d74 | c1a85056296992fc5162189b03b1c410e50f6212 | refs/heads/master | 2022-12-19T15:10:31.909603 | 2020-09-19T00:44:27 | 2020-09-19T00:44:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,425 | java | package com.moelyon.learning.concurrent;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.IntStream;
public class Priority {
static volatile boolean nostart = true;
static volatile boolean notend = true;
public static void main(String[] args) throws InterruptedException {
List<Job> jobs = new ArrayList<>();
IntStream.range(0,10).forEach((value -> {
int priority = value<5?Thread.MIN_PRIORITY:Thread.MAX_PRIORITY;
Job job = new Job(priority);
jobs.add(job);
Thread thread = new Thread(job,"Thread "+value);
thread.setPriority(priority);
thread.start();
}));
nostart = false;
Thread.sleep(10*1000);
notend = false;
jobs.forEach((job -> {
System.out.println(String.format("Job priority %d count: %d",job.priority,job.jobCount));
}));
}
public static class Job implements Runnable{
private final int priority;
private long jobCount;
public Job(int priority) {
this.priority = priority;
}
@Override
public void run() {
while(nostart){
Thread.yield();
}
while(notend){
Thread.yield();
jobCount++;
}
}
}
}
| [
"[email protected]"
] | |
3e048e782379da35d6f79d94312fb0bac730d598 | 3a7742b372c0597037d9bd569e37ff330b6d7a4f | /ph-jdmc-core/src/main/java/com/helger/jdmc/core/datamodel/AbstractJDMGenType.java | 627fab70e1b8c065393698386482741e57d56d98 | [
"Apache-2.0"
] | permissive | jdrew1303/ph-jdmc | eecc5c1eec6f9d5d29030b4ce0b41a6c28648a0b | 75efd96646883aab3eecf261df7cba37ef60c9a9 | refs/heads/master | 2023-08-27T14:28:40.256248 | 2021-10-30T19:34:08 | 2021-10-30T19:34:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,235 | java | /*
* Copyright (C) 2018-2021 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* 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.helger.jdmc.core.datamodel;
import java.io.Serializable;
import javax.annotation.Nonnull;
import javax.annotation.concurrent.NotThreadSafe;
import com.helger.commons.ValueEnforcer;
import com.helger.commons.annotation.Nonempty;
import com.helger.commons.annotation.ReturnsMutableObject;
import com.helger.commons.string.StringHelper;
/**
* Base type for created classes and enums.
*
* @author Philip Helger
*/
@NotThreadSafe
public abstract class AbstractJDMGenType implements Serializable
{
private final JDMGenClassSettings m_aSettings = new JDMGenClassSettings ();
private final String m_sPackageName;
private final String m_sClassName;
@Nonnull
@Nonempty
public static String getFQCN (@Nonnull final String sPackageName, @Nonnull @Nonempty final String sClassName)
{
return (StringHelper.hasText (sPackageName) ? sPackageName + "." : "") + sClassName;
}
public AbstractJDMGenType (@Nonnull final String sPackageName, @Nonnull @Nonempty final String sClassName)
{
ValueEnforcer.notNull (sPackageName, "PackageName");
ValueEnforcer.notEmpty (sClassName, "ClassName");
m_sPackageName = sPackageName;
m_sClassName = sClassName;
}
@Nonnull
@ReturnsMutableObject
public final JDMGenClassSettings settings ()
{
return m_aSettings;
}
@Nonnull
@Nonempty
public final String getPackageName ()
{
return m_sPackageName;
}
/**
* @return The class name without a package.
*/
@Nonnull
@Nonempty
public final String getClassName ()
{
return m_sClassName;
}
@Nonnull
@Nonempty
public final String getFQInterfaceName ()
{
return getFQCN (m_sPackageName, "I" + m_sClassName);
}
@Nonnull
@Nonempty
public final String getFQClassName ()
{
return getFQCN (m_sPackageName, m_sClassName);
}
@Nonnull
@Nonempty
public final String getFQTestClassName ()
{
return getFQCN (m_sPackageName, m_sClassName + "Test");
}
@Nonnull
@Nonempty
public final String getFQMicroTypeConverterClassName ()
{
return getFQCN (m_sPackageName, m_sClassName + "MicroTypeConverter");
}
@Nonnull
@Nonempty
public final String getFQManagerClassName ()
{
return getFQCN (m_sPackageName, m_sClassName + "Manager");
}
@Nonnull
@Nonempty
public final String getFQResolverInterfaceName ()
{
return getFQCN (m_sPackageName, "I" + m_sClassName + "Resolver");
}
public final boolean isClass ()
{
return this instanceof JDMGenClass;
}
public final boolean isEnum ()
{
return this instanceof JDMGenEnum;
}
}
| [
"[email protected]"
] | |
b76e3287821d940fc1b5f09e695e1bca3b9fdebf | 0c987ac63f128de0ba9d34d873f97ed86c444f0c | /55_JumpGameGreedy.java | e3140549347ebf74d8fd7b81c03738ee35002417 | [] | no_license | github-prathma/LeetcodePractice | 9c2fbd978ad513571c4cc8cf24b4fd5662303ffc | 5a97f78dc86a1637bbde8cf536b83642943634c8 | refs/heads/master | 2020-08-12T23:38:02.739639 | 2020-06-21T20:21:36 | 2020-06-21T20:21:36 | 214,865,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | import java.util.*;
import java.io.*;
class JumpGameGreedy {
public static boolean canJump(int[] nums) {
int maxJump = 0;
for (int i=0; i<nums.length; i++) {
if (i > maxJump || maxJump >= nums.length-1) {
break;
}
maxJump = Math.max(maxJump, i+nums[i]);
}
return maxJump >= nums.length-1;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter size of an array");
int n = sc.nextInt();
int[] nums = new int[n];
for (int i=0; i<n; i++) {
nums[i] = sc.nextInt();
}
boolean ans = canJump(nums);
System.out.println(ans);
}
} | [
"[email protected]"
] | |
3b277060019cf1edeedc439268fc30096706e24f | 8efb3d483191921e8b361501c179c5a83af52845 | /src/system/report/model/TableModelReport.java | 454508aa2d7b7a950ccf5e0c5d0be387505843da | [] | no_license | soul-source/soul-app-full | 2d37d6984caf08d27573df7af9913d8685bc7470 | 37152b340450eab4be5e0a34fee69447eb742704 | refs/heads/master | 2021-01-10T21:53:07.760463 | 2015-07-17T19:13:08 | 2015-07-17T19:13:08 | 37,922,003 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,030 | java | /*
* Copyright (C) 2007 - 2014 Hyperweb2 All rights reserved.
* GNU General Public License version 3; see www.hyperweb2.com/terms/
*/
package system.report.model;
import hwcore.modules.java.src.library.database.RecordSet;
import system.common.MyQueryHandler;
import system.common.MyTableModel;
import system.common.PermissionsTypes;
import system.main.controller.ControllerJFrameMain;
public class TableModelReport extends MyTableModel {
private final int idSegnalazione;
public TableModelReport(int idSegnalazione) {
super(new MyQueryHandler(EntityModelReport.I()), PermissionsTypes.full());
this.idSegnalazione = idSegnalazione;
}
@Override
public void refreshList() {
super.refreshList(
MyQueryHandler.getQb()
.qbBuildName(EntityModelReport.I().ID_SEGNALAZIONE.getPath())
.qbCompare(idSegnalazione).toString()
);
}
@Override
protected boolean isOther(RecordSet records) {
return true;
}
}
| [
"[email protected]"
] | |
07fa3e590b0bb9329260c8fc83166d81ce751f2c | 4c36bc898fd0172a21df5dcc3b7aa7679332a0df | /app/src/main/java/component/com/model/ComWorkshop.java | 366c7ea624c9670fdff3083e012af0b641eb2681 | [] | no_license | quanyousheng/benxiao | 2d5a97629f0c1044ad0ea1253af6340f779cf71b | 73706a3e9c07248b090e097bb20f750555550bd1 | refs/heads/master | 2021-06-17T04:22:45.257609 | 2017-06-06T09:59:55 | 2017-06-06T09:59:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package component.com.model;
import java.io.Serializable;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
import component.system.model.SystemUser;
/** 车间 */
@SuppressWarnings("serial")
public class ComWorkshop implements Serializable {
@JSONField(ordinal = 1)
private int id;
@JSONField(ordinal = 2)
private String name; // 名称
@JSONField(serialize = false)
private Boolean isDel;
@JSONField(serialize = false)
private List<SystemUser> users;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getIsDel() {
return isDel;
}
public void setIsDel(Boolean isDel) {
this.isDel = isDel;
}
public List<SystemUser> getUsers() {
return users;
}
public void setUsers(List<SystemUser> users) {
this.users = users;
}
}
| [
"[email protected]"
] | |
c2d3eb1ddbc0d87ec57e4f5566075a12a794d3b3 | 6f68bf29f395c3a7e509beb6b21f064a9ac2f5a0 | /src/main/java/com/tencent/client/service/ISysLogService.java | 4b2ae426e41b3b012bc1802984e706e53beceeb7 | [] | no_license | jidongfang123/client | df88cf3c7d6187d1f4334bbc019d8aef2e23aed9 | 7512f06b2f29780d8ba1d61e95c5d779f9086c8f | refs/heads/master | 2023-08-07T17:38:53.828816 | 2022-02-23T12:27:27 | 2022-02-23T12:27:27 | 217,507,143 | 1 | 0 | null | 2023-07-22T19:45:46 | 2019-10-25T10:09:58 | Java | UTF-8 | Java | false | false | 338 | java | package com.tencent.client.service;
import com.tencent.client.model.SysLog;
/**
* @author Promise
* @createTime 2018年12月18日 下午9:29:48
* @description 日志接口
*/
public interface ISysLogService {
/**
* 插入日志
* @param entity
* @return
*/
int insertLog(SysLog entity);
}
| [
"[email protected]"
] | |
411dc7e59440050f51df4693d677c93cf4661936 | f6def0cbecf523bea923c8fa0fb05ec8dfb4fe10 | /src/main/java/co/dc/ccpt/common/utils/io/type/StringBuilderWriter.java | c7c7e756c5b040226907a6f0aa5decbfe0510790 | [] | no_license | HssInspiration/jzerp | e1cef07e4bc9cb14ed3fbf94dea0c25bf64bb2f2 | a5cf7335cef1c61c523a87d91e2b970f135fc329 | refs/heads/master | 2020-03-19T13:14:31.465305 | 2018-11-19T05:08:07 | 2018-11-19T05:08:07 | 136,569,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,079 | 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 co.dc.ccpt.common.utils.io.type;
import java.io.Serializable;
import java.io.Writer;
/**
* JDK的java.io.StringWriter使用StringBuffer,移植Commons IO使用StringBuilder的版本.
*
* {@link Writer} implementation that outputs to a {@link StringBuilder}.
* <p>
* <strong>NOTE:</strong> This implementation, as an alternative to
* <code>java.io.StringWriter</code>, provides an <i>un-synchronized</i>
* (i.e. for use in a single thread) implementation for better performance.
* For safe usage with multiple {@link Thread}s then
* <code>java.io.StringWriter</code> should be used.
*
* @version $Id: StringBuilderWriter.java 1722253 2015-12-30 00:36:12Z ggregory $
* @since 2.0
*/
public class StringBuilderWriter extends Writer implements Serializable {
private static final long serialVersionUID = -146927496096066153L;
private final StringBuilder builder;
/**
* Constructs a new {@link StringBuilder} instance with default capacity.
*/
public StringBuilderWriter() {
this.builder = new StringBuilder();
}
/**
* Constructs a new {@link StringBuilder} instance with the specified capacity.
*
* @param capacity The initial capacity of the underlying {@link StringBuilder}
*/
public StringBuilderWriter(final int capacity) {
this.builder = new StringBuilder(capacity);
}
/**
* Constructs a new instance with the specified {@link StringBuilder}.
*
* <p>If {@code builder} is null a new instance with default capacity will be created.</p>
*
* @param builder The String builder. May be null.
*/
public StringBuilderWriter(final StringBuilder builder) {
this.builder = builder != null ? builder : new StringBuilder();
}
/**
* Appends a single character to this Writer.
*
* @param value The character to append
* @return This writer instance
*/
@Override
public Writer append(final char value) {
builder.append(value);
return this;
}
/**
* Appends a character sequence to this Writer.
*
* @param value The character to append
* @return This writer instance
*/
@Override
public Writer append(final CharSequence value) {
builder.append(value);
return this;
}
/**
* Appends a portion of a character sequence to the {@link StringBuilder}.
*
* @param value The character to append
* @param start The index of the first character
* @param end The index of the last character + 1
* @return This writer instance
*/
@Override
public Writer append(final CharSequence value, final int start, final int end) {
builder.append(value, start, end);
return this;
}
/**
* Closing this writer has no effect.
*/
@Override
public void close() {
// no-op
}
/**
* Flushing this writer has no effect.
*/
@Override
public void flush() {
// no-op
}
/**
* Writes a String to the {@link StringBuilder}.
*
* @param value The value to write
*/
@Override
public void write(final String value) {
if (value != null) {
builder.append(value);
}
}
/**
* Writes a portion of a character array to the {@link StringBuilder}.
*
* @param value The value to write
* @param offset The index of the first character
* @param length The number of characters to write
*/
@Override
public void write(final char[] value, final int offset, final int length) {
if (value != null) {
builder.append(value, offset, length);
}
}
/**
* Returns the underlying builder.
*
* @return The underlying builder
*/
public StringBuilder getBuilder() {
return builder;
}
/**
* Returns {@link StringBuilder#toString()}.
*
* @return The contents of the String builder.
*/
@Override
public String toString() {
return builder.toString();
}
}
| [
"[email protected]"
] | |
00d4fe3a5e3c6ae99fdc62fed2f8afcdfde5ee99 | ebf6db8f969954143969f5edcbf2e2e1d9880f7b | /Exam/bootcamp-java-Exam2/src/main/java/co/g2academy/bootcamp/controller/PersonListController.java | 7a5ecdb256c406bc31d6756fbf9bcb7bdfab2b35 | [] | no_license | cimiko/Java | 3b09de22be8267f3a3a2f3e50005ade6c2fd8ed7 | 7d01efb6dd4d58f36675b1642575dfe03fc461a2 | refs/heads/main | 2023-01-21T00:00:29.774454 | 2020-11-28T11:05:01 | 2020-11-28T11:05:01 | 306,367,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,585 | 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 co.g2academy.bootcamp.controller;
import co.g2academy.bootcamp.helper.ControllerHelper;
import co.g2academy.bootcamp.entity.Person;
import co.g2academy.bootcamp.service.PersonService;
import java.io.IOException;
import java.util.List;
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;
/**
*
* @author cimiko
*/
@WebServlet(name = "PersonListController", urlPatterns = {"/personlist"})
public class PersonListController extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session=request.getSession();
if(session.getAttribute("name") != null){
PersonService personService = new PersonService();
List<Person> persons = personService.getPersons();
request.setAttribute("persons", persons);
ControllerHelper.dispatchToView(request, response, "/view/person-list-view.jsp");
}
ControllerHelper.dispatchToView(request, response, "/view/login-view.jsp");
}
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
}
| [
"[email protected]"
] | |
68d1be8f6bf5be89bd49c3f0d86ffaee9683400f | 97ca096643ba8395abb6b3942eed2a88a6bf5134 | /redisop/src/main/java/com/yq/redisop/config/RedissonSingleConfig.java | 5ee64ef9feed92656494cdc9ae12fb82e9bbfc66 | [] | no_license | polanpan/spring-boot-pick-up | 0de49fdfefa39495c15b53fdfba436864fdb7c53 | 1ab936fbb20ec63a3f5e12df1ce6ca17ddf489ff | refs/heads/master | 2022-10-29T14:54:28.644945 | 2020-04-28T03:29:21 | 2020-04-28T03:29:21 | 145,359,323 | 2 | 1 | null | 2022-10-04T23:56:44 | 2018-08-20T03:02:46 | Java | UTF-8 | Java | false | false | 2,974 | java | package com.polan.redisop.config;
import io.netty.channel.nio.NioEventLoopGroup;
import lombok.Data;
import org.redisson.client.codec.Codec;
import org.redisson.config.Config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;
/**
* <p> redisson 单机版 配置</p>
* @author youq 2019/4/9 14:29
*/
@Data
@Configuration
@Conditional(RedissonSingleCondition.class)
@ConfigurationProperties(prefix = "spring.redisson")
public class RedissonSingleConfig {
private String address;
private int connectionMinimumIdleSize = 10;
private int idleConnectionTimeout = 10000;
private int pingTimeout = 1000;
private int connectTimeout = 10000;
private int timeout = 3000;
private int retryAttempts = 3;
private int retryInterval = 1500;
private String password = null;
private int subscriptionsPerConnection = 5;
private String clientName = null;
private int subscriptionConnectionMinimumIdleSize = 1;
private int subscriptionConnectionPoolSize = 50;
private int connectionPoolSize = 64;
private int database = 0;
private boolean dnsMonitoring = false;
private int dnsMonitoringInterval = 5000;
/**
* 当前处理核数量 * 2
*/
private int thread;
private String codec = "org.redisson.codec.JsonJacksonCodec";
@Bean
public Config config() throws Exception {
Config config = new Config();
config.useSingleServer()
.setAddress(address)
.setConnectionMinimumIdleSize(connectionMinimumIdleSize)
.setConnectionPoolSize(connectionPoolSize)
.setDatabase(database)
.setDnsMonitoring(dnsMonitoring)
.setDnsMonitoringInterval(dnsMonitoringInterval)
.setSubscriptionConnectionMinimumIdleSize(subscriptionConnectionMinimumIdleSize)
.setSubscriptionConnectionPoolSize(subscriptionConnectionPoolSize)
.setSubscriptionsPerConnection(subscriptionsPerConnection)
.setClientName(clientName)
.setRetryAttempts(retryAttempts)
.setRetryInterval(retryInterval)
.setTimeout(timeout)
.setConnectTimeout(connectTimeout)
.setIdleConnectionTimeout(idleConnectionTimeout)
.setPingTimeout(pingTimeout)
.setPassword(StringUtils.isEmpty(password) ? null : password);
Codec codec = (Codec) ClassUtils.forName(getCodec(), ClassUtils.getDefaultClassLoader()).newInstance();
config.setCodec(codec);
config.setThreads(thread);
config.setEventLoopGroup(new NioEventLoopGroup());
return config;
}
} | [
"[email protected]"
] | |
6948364fbfe859c7be35ddac4451a1efc1fabea5 | 0abd9287dda723d31c6c420cc9433e80a718692d | /src/test/java/com/devsmile/sbmultidb/WebCrawlerServiceV1ApplicationTests.java | 1d5bd939fa1527de34f2bd76aefd72226b774da5 | [] | no_license | Oleksandr-Moik/Spring-Boot-Web-Crawler | 5c6663bf123b753200246503b0b0d226de30e18f | 355176c47b997956b65761882ce96b59afc9de71 | refs/heads/master | 2022-02-27T04:51:21.733517 | 2019-09-02T17:05:04 | 2019-09-02T17:05:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package com.devsmile.sbmultidb;
//@RunWith(SpringRunner.class)
//@SpringBootTest
public class WebCrawlerServiceV1ApplicationTests {
// @Test
public void contextLoads() {
}
}
| [
"[email protected]"
] | |
9499ab6e16d1d7a81a5c3a0b27ab74e5556cd8c4 | fc8ae6019d8e083cf86accbc52b34c6c41cdbe4c | /app/src/main/java/com/app/song/hxchat/view/RegisterView.java | a9d346727da53878e1c38f84c43c29727010c71b | [] | no_license | songju1992/HXChat | c0ad10b81500d70db082d60d4cbe60b3c379d3b1 | c5aad836586feb468936f899e1b5375f91251e02 | refs/heads/master | 2021-01-22T21:03:50.157553 | 2017-03-26T14:06:02 | 2017-03-26T14:06:02 | 85,391,760 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package com.app.song.hxchat.view;
/**
* Created by song on 2017/3/15 19:37
*/
public interface RegisterView {
void onRegister(String username,String pwd,boolean isSuccess,String msg);
}
| [
"[email protected]"
] | |
927cacd25bd29b516d48ecd51882773b1c317956 | 593f0260a13f05406f2d9a9f5fc3c548d293e326 | /core-java/src/com/coderbd/ex56/A.java | 255ccd4c14cc1a7cc42ea2690fc77612ad132c08 | [] | no_license | ARMUNNA/java-certification | be4d0259ff1242205fcaa9b089e981bdbb22f0aa | 571e544ab3618f89ab23cb7bc973c8d9159d478d | refs/heads/master | 2021-08-23T21:20:59.660454 | 2017-12-06T16:03:17 | 2017-12-06T16:03:17 | 113,346,849 | 1 | 0 | null | 2017-12-06T17:27:33 | 2017-12-06T17:27:33 | null | UTF-8 | Java | false | false | 146 | java | package com.coderbd.ex56;
public class A {
public void displayMsg() {
System.out.println("Hi, I am a method from class a");
}
}
| [
"[email protected]"
] | |
e6d08e26c32e6e76c21e62524dcaf2dc84fb42a8 | 3a8f876322d1c09cde2bebe12297429aa6366ce0 | /src/com/codewithsatyaki/strategy/ImageStore/BNWFilter.java | 002150ebb5f37904bebdd4757d70878f6e274b5d | [] | no_license | satyakisen/Design-Patterns-1 | 4659e15e90321df289e7e99c5d9d7ca805dc9c90 | adfc24a79725e62db0b2b9195a13a7e98cb5e693 | refs/heads/master | 2022-10-07T17:36:50.046451 | 2022-09-22T16:59:01 | 2022-09-22T16:59:01 | 247,073,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 203 | java | package com.codewithsatyaki.strategy.ImageStore;
public class BNWFilter implements Filter{
@Override
public void apply() {
System.out.println("Applying Black and white filter");
}
}
| [
"[email protected]"
] | |
7f8e46d63dc5b14182a07b36da8ba693a456f878 | fa984d0ec80dda218d24ce4eb348475768652a37 | /app/src/androidTest/java/com/example/axientatest/ExampleInstrumentedTest.java | 9929490a3c9ef3c9d7515ca8b69f4777eb317ae2 | [] | no_license | HiranMadhu/InterviewTest | 48e52d51332f4d5a07c668af46750d7f02220900 | 0695b0ebc1924d71251ee42b5e33512e469ad398 | refs/heads/master | 2023-07-02T04:25:38.898546 | 2021-08-11T13:30:44 | 2021-08-11T13:30:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 760 | java | package com.example.axientatest;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.axientatest", appContext.getPackageName());
}
} | [
"[email protected]"
] | |
8fe6e919f509baa8f4361eed94372b5152b1c028 | afbb9791d6cc7cf8e7bdd6afe4d93bf340cfb35f | /src/org/usfirst/frc/team3021/robot/commands/device/StopClimber.java | e32e7f2dea4ef8ad6f6731f2618c83a16dfb04bc | [] | no_license | Team3021/Steamworks | d5403d35851975c82756b18c93bce9cf2e799b3e | 29ff9c6574827a1a5ca2a1b180086a94c1d8cbc5 | refs/heads/master | 2021-01-12T00:51:21.016336 | 2018-02-07T07:11:49 | 2018-02-07T07:11:49 | 78,306,759 | 0 | 0 | null | 2017-02-12T01:14:24 | 2017-01-07T22:16:42 | null | UTF-8 | Java | false | false | 372 | java | package org.usfirst.frc.team3021.robot.commands.device;
import org.usfirst.frc.team3021.robot.Stanley;
import org.usfirst.frc.team3021.robot.commands.ClimberCommand;
public class StopClimber extends ClimberCommand {
@Override
protected void execute() {
Stanley.climber.stopMotor();
}
@Override
protected void interrupted() {
Stanley.climber.stopMotor();
}
}
| [
"[email protected]"
] | |
2db5c3dfb5e06bda77d0405ccb4210b3dc9aa3e0 | 44a62e366d0d65640e1c7618a6850ec9057bf4bb | /sign-service/src/main/java/cn/com/codeele/sign/service/impl/SystemPropertyServiceImpl.java | 55f8690160bac63c9b5355c2482b11f51b5c87d2 | [] | no_license | microcent/sign-parent | 3742282fe52fd5b6e7eddb74a9377e3d0335bf84 | e0f51b36e91911d65ccaad168e42ccca5baa437c | refs/heads/master | 2020-04-15T23:11:29.785901 | 2019-01-12T17:09:13 | 2019-01-12T17:09:13 | 165,097,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 886 | java | package cn.com.codeele.sign.service.impl;
import cn.com.codeele.sign.domain.SystemProperty;
import cn.com.codeele.sign.domain.Terminal;
import cn.com.codeele.sign.repository.SystemPropertyRepository;
import cn.com.codeele.sign.repository.TerminalRepository;
import cn.com.codeele.sign.service.SystemPropertyService;
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 java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class SystemPropertyServiceImpl implements SystemPropertyService {
@Autowired
private SystemPropertyRepository repository;
@Override
public Page<SystemProperty> findAll(Pageable pageable) {
return this.repository.findAll(pageable);
}
}
| [
"abc123456"
] | abc123456 |
d94ed2dc99613539857bc0238ea4f4fa21e102e7 | d1a97326a93462cce70c0f0ac6263fc290ba6c32 | /app/src/main/java/com/dapgarage/lecture1/receivers/BluetoothBroadcastReceiver.java | d7e0498d13ab30c9446e93e2c787d05e71fcbd94 | [] | no_license | MHamzaShahzad/Batch0LDLecture1 | 129ff3644d4b671804306902e1fd1a5d210770a3 | a13ed52e615d971034e85fdf88b2a0da69afbdf4 | refs/heads/master | 2022-12-06T12:38:12.151794 | 2020-08-09T10:30:27 | 2020-08-09T10:30:27 | 276,133,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,980 | java | package com.dapgarage.lecture1.receivers;
import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
public class BluetoothBroadcastReceiver extends BroadcastReceiver {
private static final String TAG = BluetoothBroadcastReceiver.class.getName();
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
Toast.makeText(context, "Bluetooth state changes!", Toast.LENGTH_LONG).show();
switch (intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1) ){
case BluetoothAdapter.STATE_OFF:
Log.i(TAG, "onReceive: STATE_OFF");
break;
case BluetoothAdapter.STATE_ON:
Log.i(TAG, "onReceive: STATE_ON");
break;
case BluetoothAdapter.STATE_DISCONNECTED:
Log.i(TAG, "onReceive: STATE_DISCONNECTED");
break;
case BluetoothAdapter.STATE_CONNECTED:
Log.i(TAG, "onReceive: STATE_CONNECTED");
break;
case BluetoothAdapter.STATE_DISCONNECTING:
Log.i(TAG, "onReceive: STATE_DISCONNECTING");
break;
case BluetoothAdapter.STATE_CONNECTING:
Log.i(TAG, "onReceive: STATE_CONNECTING");
break;
case BluetoothAdapter.STATE_TURNING_OFF:
Log.i(TAG, "onReceive: STATE_TURNING_OFF");
break;
case BluetoothAdapter.STATE_TURNING_ON:
Log.i(TAG, "onReceive: STATE_TURNING_ON");
break;
default:
Log.i(TAG, "onReceive: STATE_NONE");
}
}
}
}
| [
"[email protected]"
] | |
31060dc45237c793bd8a20f39be3ff1af8f43ef6 | 459cf37614511d3ce74520255e312aaf83b34c1f | /Salmans Project/src/main/java/edu/mum/cs/swe425/project/domain/Appointment.java | 459a03fb856227502940ea84f1118e27a181d592 | [] | no_license | MoSeud/SWE-CS425 | c1e782eabc69d8e173180451ffc7b544ac38d0b4 | 83123318f3c3e291aad344cf771361c2f17c6708 | refs/heads/master | 2020-06-26T20:20:20.775777 | 2019-08-14T19:36:22 | 2019-08-14T19:36:22 | 198,499,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,646 | java | package edu.mum.cs.swe425.project.domain;
import javax.persistence.*;
import java.time.LocalDate;
@Entity
@Table(name = "appointments")
public class Appointment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer appointmentId;
/***
* refers to the date chosen
* */
@Column(nullable = false)
private LocalDate appointmentDate;
/***
* refers to the date the user made the appointment,
* not the date the user chose
* */
@Column(nullable = false)
private LocalDate dateScheduled;
//should be set when saving appointment
@ManyToOne
@JoinColumn(name = "hairstylist_fk")
private User hairstylist;
@ManyToOne
@JoinColumn(name = "customer_fk")
private User customer;
@OneToOne
@JoinColumn(name = "hairstyle_fk")
private HairStyle hairStyle;
@OneToOne
@JoinColumn(name = "service_time_fk")
private ServiceTime serviceTime;
public Appointment() {
}
public Appointment(LocalDate appointmentDate, LocalDate dateScheduled, User hairstylist, User customer, HairStyle hairStyle, ServiceTime serviceTime) {
this.appointmentDate = appointmentDate;
this.dateScheduled = dateScheduled;
this.hairstylist = hairstylist;
this.customer = customer;
this.hairStyle = hairStyle;
this.serviceTime = serviceTime;
}
public Integer getAppointmentId() {
return appointmentId;
}
public void setAppointmentId(Integer appointmentId) {
this.appointmentId = appointmentId;
}
public LocalDate getAppointmentDate() {
return appointmentDate;
}
public void setAppointmentDate(LocalDate appointmentDate) {
this.appointmentDate = appointmentDate;
}
public LocalDate getDateScheduled() {
return dateScheduled;
}
public void setDateScheduled(LocalDate dateScheduled) {
this.dateScheduled = dateScheduled;
}
public User getHairstylist() {
return hairstylist;
}
public void setHairstylist(User hairstylist) {
this.hairstylist = hairstylist;
}
public User getCustomer() {
return customer;
}
public void setCustomer(User customer) {
this.customer = customer;
}
public HairStyle getHairStyle() {
return hairStyle;
}
public void setHairStyle(HairStyle hairStyle) {
this.hairStyle = hairStyle;
}
public ServiceTime getServiceTime() {
return serviceTime;
}
public void setServiceTime(ServiceTime serviceTime) {
this.serviceTime = serviceTime;
}
}
| [
"[email protected]"
] | |
6cbd4123cc97bc9d2241102f158878544bd9bf14 | 4abbe25c8ab60d47d6d715f921f4004515a1e36f | /src/com/shopping/foundation/dao/GoodsReturnLogDAO.java | 869b107dcc8cbfa52099bd947f63dec49588ac8c | [] | no_license | tsingning/likejd | cde46b17c19694b06835364ac5720ebbd29f3290 | c5184d8e416bb1c9f5ff0e9e843c1368145168ba | refs/heads/master | 2021-05-09T22:48:05.083383 | 2018-01-25T02:07:49 | 2018-01-25T02:07:49 | 118,762,828 | 0 | 0 | null | 2018-01-24T12:32:12 | 2018-01-24T12:32:11 | null | UTF-8 | Java | false | false | 300 | java | package com.shopping.foundation.dao;
import com.shopping.core.base.GenericDAO;
import com.shopping.foundation.domain.GoodsReturnLog;
import org.springframework.stereotype.Repository;
@Repository("goodsReturnLogDAO")
public class GoodsReturnLogDAO extends GenericDAO<GoodsReturnLog>
{
}
| [
"Sale@SaleComputer"
] | Sale@SaleComputer |
e31a66a0d7abb05b3097188a0a83cb61c18aec8f | 907d2852c42d7a8f76afd92c70c2770cea57c268 | /BackEnd/themis-order/src/main/java/com/oxchains/themis/order/entity/OrderComment.java | f8c746e829dad84c803bebd24930729544af0b13 | [] | no_license | oxchains/themis | f9edfaa95b5b5cb7243303e8d3f7e42cd9ff3fb1 | e9beeb37d684391957bdc4bb7ff543f5f39c82ab | refs/heads/master | 2021-08-30T19:54:27.743572 | 2017-12-18T02:05:30 | 2017-12-18T02:05:30 | 107,077,376 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,526 | java | package com.oxchains.themis.order.entity;
import lombok.Data;
import org.web3j.crypto.CipherException;
import org.web3j.crypto.Credentials;
import org.web3j.crypto.WalletUtils;
import org.web3j.protocol.Web3j;
import org.web3j.protocol.core.methods.response.Web3ClientVersion;
import org.web3j.protocol.http.HttpService;
import javax.persistence.*;
import java.io.IOException;
/**
* Created by huohuo on 2017/10/28.
* @author huohuo
*/
@Entity
@Table(name = "order_comment")
@Data
public class OrderComment {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String orderId;
private Integer sellerStatus;
private Integer buyerStatus;
private String buyerContent;
private String sellerContent;
@Transient
private Long userId;
@Transient
private String content;
@Transient
private Integer status;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
@Override
public String toString() {
return "OrderComment{" +
"id=" + id +
", orderId='" + orderId + '\'' +
", sellerStatus=" + sellerStatus +
", buyerStatus=" + buyerStatus +
", buyerContent='" + buyerContent + '\'' +
", sellerContent='" + sellerContent + '\'' +
", userId=" + userId +
", content='" + content + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
06c678bf34ebb6d6bc1bf1ebc8407bd08501ae0f | 049544b36ce917b9db602305e0f4230e1f370cd8 | /ExternalSearchServices/BigHugeLabsLib/src/main/java/SearchService/ServiceNotReachableException.java | fdde14b6701c7137bf0c3ee53410ef0443d5cd28 | [] | no_license | joacolabrisca/J2CharlieClean | e45d27e360046598ce4a4f3a601b4c56b5fef1a0 | dd8c5a24c1ff2821d7e3f5be1a673c831d4f9bd2 | refs/heads/master | 2020-03-27T06:39:37.820976 | 2018-09-03T20:21:28 | 2018-09-03T20:21:28 | 142,369,433 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package SearchService;
public class ServiceNotReachableException extends Exception {
public ServiceNotReachableException(String message) {
super(message);
}
}
| [
"[email protected]"
] | |
400d66d0eadd520d1ac1dfddbac8429c7ab34bc6 | f9a8f7f8aaecb7c0e5361c074775a5066be0544d | /example/android/app/src/main/java/io/datvo/fluttertabbarnorippleexample/MainActivity.java | e9a590f031dc8a685e53b14125cfa3a3c292f343 | [
"BSD-3-Clause"
] | permissive | Arefalhaj/flutter_tab_bar_no_ripple | e506711b5c3411abcedf1cd653448d956f05eb92 | 36ed555e5de71bf02745f0bc6f63b02e0965494c | refs/heads/master | 2020-07-16T00:09:37.313880 | 2018-12-25T15:47:48 | 2018-12-25T15:47:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package io.datvo.fluttertabbarnorippleexample;
import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;
public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
}
}
| [
"[email protected]"
] | |
052a8aff164eaf647ee0a9eda781db397584506f | dd0864dfc5e78a9dea793db8095f3e93a449382d | /src/main/java/com/lonely/test/TestArrayBeanGenera.java | 880a2097a80eb37abab8f21969c2eec800120c60 | [] | no_license | duguxiaobiao/generator-code | 62c7103eccf900803489fb49ee2e5006d049dd36 | f5f5e48f952aff97bcc136c34d3139d83836cb7c | refs/heads/master | 2022-12-26T17:46:31.663172 | 2019-12-16T07:27:15 | 2019-12-16T07:27:15 | 209,505,918 | 1 | 0 | null | 2022-12-16T00:38:16 | 2019-09-19T08:48:01 | Java | UTF-8 | Java | false | false | 6,148 | java | package com.lonely.test;
import com.lonely.bean.ModelDesc;
import com.lonely.bean.ParamTypeDesc;
import com.lonely.generator.DefaultModelHandler;
import com.lonely.util.ClassUtil;
import com.lonely.util.DefaultModelBuildUtil;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.PropertyAccessorFactory;
import java.util.ArrayList;
import java.util.List;
/**
* @author ztkj-hzb
* @Date 2019/9/25 10:30
* @Description 测试数组场景
*/
public class TestArrayBeanGenera {
public static void main(String[] args) throws InstantiationException, IllegalAccessException {
testArray();
}
public static void testArray() throws IllegalAccessException, InstantiationException {
List<ParamTypeDesc> paramTypeDescs = new ArrayList<>();
/*ParamTypeDesc paramTypeDesc1 = new ParamTypeDesc();
paramTypeDesc1.setParamName("name");
paramTypeDesc1.setCommonTypeName("java.lang.String");
paramTypeDesc1.setExistsT(false);
ParamTypeDesc paramTypeDesc2 = new ParamTypeDesc();
paramTypeDesc2.setParamName("age");
paramTypeDesc2.setCommonTypeName("java.lang.Integer");
paramTypeDesc2.setExistsT(false);
//来一个基础数据类型的数组
ParamTypeDesc paramTypeDesc3 = new ParamTypeDesc();
paramTypeDesc3.setParamName("hobbys");
paramTypeDesc3.setCommonTypeName("java.lang.String");
paramTypeDesc3.setExistsT(false);
paramTypeDesc3.setArray(true);*/
//来一个对象类型的数组
/*ParamTypeDesc paramTypeDesc4 = new ParamTypeDesc();
paramTypeDesc4.setParamName("clazz");
paramTypeDesc4.setCommonTypeName("java.util.HashMap");
List<ParamTypeDesc> childParams = new ArrayList<>();
ParamTypeDesc child1 = new ParamTypeDesc();
child1.setParamName("className");
child1.setCommonTypeName("java.lang.String");
child1.setExistsT(false);
ParamTypeDesc child2 = new ParamTypeDesc();
child2.setParamName("student");
child2.setCommonTypeName("java.util.HashMap");
List<ParamTypeDesc> childParams2 = new ArrayList<>();
ParamTypeDesc child2_1 = new ParamTypeDesc();
child2_1.setParamName("studentName");
child2_1.setCommonTypeName("java.lang.String");
child2_1.setExistsT(false);
ParamTypeDesc child2_2 = new ParamTypeDesc();
child2_2.setParamName("studentAge");
child2_2.setCommonTypeName("java.lang.Integer");
child2_2.setExistsT(false);
childParams2.add(child2_1);
childParams2.add(child2_2);
child2.setChildParams(childParams2);
child2.setExistsT(false);
childParams.add(child1);
childParams.add(child2);
paramTypeDesc4.setChildParams(childParams);
paramTypeDesc4.setExistsT(false);
paramTypeDesc4.setArray(true);*/
//嵌套数组测试 user[].student[]
ParamTypeDesc paramTypeDesc4 = new ParamTypeDesc();
paramTypeDesc4.setParamName("clazz");
paramTypeDesc4.setCommonTypeName("java.util.List");
List<ParamTypeDesc> childParams = new ArrayList<>();
ParamTypeDesc child1 = new ParamTypeDesc();
child1.setParamName("className");
child1.setCommonTypeName("java.lang.String");
child1.setExistsT(false);
ParamTypeDesc child2 = new ParamTypeDesc();
child2.setParamName("student");
child2.setCommonTypeName("java.util.HashMap");
List<ParamTypeDesc> childParams2 = new ArrayList<>();
ParamTypeDesc child2_1 = new ParamTypeDesc();
child2_1.setParamName("studentName");
child2_1.setCommonTypeName("java.lang.String");
child2_1.setExistsT(false);
ParamTypeDesc child2_2 = new ParamTypeDesc();
child2_2.setParamName("studentAge");
child2_2.setCommonTypeName("java.lang.Integer");
child2_2.setExistsT(false);
childParams2.add(child2_1);
childParams2.add(child2_2);
child2.setChildParams(childParams2);
child2.setExistsT(false);
child2.setArray(true);
childParams.add(child1);
childParams.add(child2);
paramTypeDesc4.setChildParams(childParams);
paramTypeDesc4.setExistsT(true);
paramTypeDesc4.setArray(true);
//paramTypeDescs.add(paramTypeDesc1);
//paramTypeDescs.add(paramTypeDesc2);
//paramTypeDescs.add(paramTypeDesc3);
paramTypeDescs.add(paramTypeDesc4);
//1.构建Model
ModelDesc modelDesc = DefaultModelBuildUtil.buildModelDescByParamType(paramTypeDescs);
//2.构建代码
String generator = DefaultModelHandler.generator(modelDesc);
System.out.println(generator);
//3.编译
Class<?> compile = ClassUtil.compile(modelDesc.getMainClassName(), generator);
//4.赋值
Object newInstance = compile.newInstance();
BeanWrapper beanWrapper = PropertyAccessorFactory.forBeanPropertyAccess(newInstance);
beanWrapper.setAutoGrowNestedPaths(true);
beanWrapper.setPropertyValue("clazz[0][0].className", "终极一班");
beanWrapper.setPropertyValue("clazz[0][0].student[0].studentName", "学生1");
beanWrapper.setPropertyValue("clazz[0][0].student[0].studentAge", 18);
beanWrapper.setPropertyValue("clazz[0][0].student[1].studentName", "学生2");
beanWrapper.setPropertyValue("clazz[0][0].student[1].studentAge", 19);
beanWrapper.setPropertyValue("clazz[0][1].className", "终极二班");
beanWrapper.setPropertyValue("clazz[0][1].student[0].studentName", "学生1");
beanWrapper.setPropertyValue("clazz[0][1].student[0].studentAge", 18);
beanWrapper.setPropertyValue("clazz[0][1].student[1].studentName", "学生2");
beanWrapper.setPropertyValue("clazz[0][1].student[1].studentAge", 19);
//beanWrapper.setPropertyValue("clazz.student.studentName", "stu_lonely");
//beanWrapper.setPropertyValue("clazz.student.studentAge", "26");
System.out.println(newInstance);
}
}
| [
"[email protected]"
] | |
825b10e3fce542505056cc447f13216c08a64354 | 4170a9760aef0f6397a96ef2b907d4ea7e77d158 | /org.m4is.diffmerge/src/main/java/org/m4is/diffmerge/service/DiffMergeService.java | 203984ca3a53281362e3ba26a3e62b42ef356909 | [] | no_license | xiwc/diffmerge | ff086c34fc1ab57c90da4c043b051d409f138f4a | d17014f169d13e3ba91f3457329aee5e4c815c6b | refs/heads/master | 2021-01-21T00:25:52.355228 | 2015-05-31T09:52:48 | 2015-05-31T09:52:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,252 | java | package org.m4is.diffmerge.service;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.m4is.diffmerge.diff.CollectionValueChange;
import org.m4is.diffmerge.diff.DataPrimitiveValueChange;
import org.m4is.diffmerge.diff.DeletedObject;
import org.m4is.diffmerge.diff.Diff;
import org.m4is.diffmerge.diff.Differences;
import org.m4is.diffmerge.diff.EntitySwitchValueChange;
import org.m4is.diffmerge.diff.ModifiedObject;
import org.m4is.diffmerge.diff.NewObject;
import org.m4is.diffmerge.reflection.ClassDescriptor;
import org.m4is.diffmerge.reflection.FieldInfo;
import org.m4is.diffmerge.reflection.ReflectionException;
import org.m4is.diffmerge.reflection.ReflectionUtil;
public class DiffMergeService {
ReflectionUtil reflection;
public DiffMergeService() {
reflection = new ReflectionUtil();
}
public DiffMergeService(String context) {
reflection = new ReflectionUtil(context);
}
public Differences compare(Object oldVersion, Object newVersion) {
// first, walk into both objects to find all entities that will need to
// be compared. We create two maps, key is the businessReference of each
// entity and a list of all keys.
List<Object> allKeys = new ArrayList<Object>();
EntitiesMap oldEntitiesMap = new EntitiesMap();
EntitiesMap newEntitiesMap = new EntitiesMap();
try {
createEntityMap(oldVersion, oldEntitiesMap, allKeys,
new ArrayList<Object>());
createEntityMap(newVersion, newEntitiesMap, allKeys,
new ArrayList<Object>());
return new Differences(compareEntities(oldEntitiesMap,
newEntitiesMap));
} catch (IllegalAccessException e1) {
throw new ReflectionException(
"Cannot compare (illegal access) objects ["
+ e1.getMessage() + "]");
} catch (IllegalArgumentException e1) {
throw new ReflectionException(
"Cannot compare (illegal arg) objects [" + e1.getMessage()
+ "]");
} catch (InvocationTargetException e1) {
throw new ReflectionException("Cannot compare (invoke) objects ["
+ e1.getMessage() + "]");
} catch (NoSuchMethodException e) {
throw new ReflectionException("Cannot compare (nosuch) objects ["
+ e.getMessage() + "]");
} catch (SecurityException e) {
throw new ReflectionException("Cannot compare (security) objects ["
+ e.getMessage() + "]");
}
}
private List<Diff> compareEntities(EntitiesMap oldEntitiesMap,
EntitiesMap newEntitiesMap) throws IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
List<Diff> ret = new ArrayList<Diff>();
// First, search removed objects
for (EntityKey br : oldEntitiesMap.keySet()) {
if (newEntitiesMap.getEntity(br) == null) {
// A removed entity
DeletedObject deletedChange = new DeletedObject(
oldEntitiesMap.getEntity(br),br);
ret.add(deletedChange);
}
}
// Then, search new objects and diffs
for (EntityKey br : newEntitiesMap.keySet()) {
Object oldObject = oldEntitiesMap.getEntity(br);
if (oldObject == null) {
// A new entity
Object newObject = newEntitiesMap.getEntity(br);
NewObject newChange = new NewObject(newObject,br);
ret.add(newChange);
} else {
// Entity exists in both side, compare their structure
Object newObject = newEntitiesMap.getEntity(br);
ModifiedObject modificationChange = new ModifiedObject(
oldObject, newObject, br);
compareOldAndNew(oldObject, newObject, modificationChange);
// If we've really some modifications, add them to list
// otherwise...no
if (modificationChange.getModifications() != null
&& modificationChange.getModifications().size() > 0) {
ret.add(modificationChange);
}
}
}
return ret;
}
private void compareOldAndNew(Object oldObject, Object newObject,
ModifiedObject modificationChange) throws IllegalAccessException,
IllegalArgumentException, InvocationTargetException {
// We've two versions of the same entity. They're different if :
// 1- primitive attributes do not have the same values
// 2- a collection attribute as its order modified and contained items
// not the same
// 3- an attribute which is a reference to another entity does not
// reference the same entity
// 4- an attribute which is a reference to a value object
// 5- for collection or reference to a value object, it's more
// complicated to says 'content has changed'because we consider that a
// value object is different from
// its previous version if we find a diff into the full graph starting
// from the attribute itself, up to any reference to another entity. So
// the difference can be at a low-level in the grap, not at first one.
ClassDescriptor desc = getReflection().getClassDescriptor(
oldObject.getClass());
for (FieldInfo fieldInfo : desc.getFieldsToCheck()) {
Object oldAttrVal = fieldInfo.getReadAccessor().invoke(oldObject);
Object newAttrVal = fieldInfo.getReadAccessor().invoke(newObject);
// We've a primitive type, we can compare values
if (isPrimitiveType(fieldInfo)) {
if (primitiveValuesAreDifferent(oldAttrVal, newAttrVal)) {
DataPrimitiveValueChange primitiveChange = new DataPrimitiveValueChange(
fieldInfo.getField(),fieldInfo, oldAttrVal, newAttrVal,
fieldInfo.getOpposite());
modificationChange.addModification(primitiveChange);
}
} else if (isReferenceToSingleEntity(fieldInfo)) {
// First, check null values
if (oldAttrVal != null || newAttrVal != null) {
if (oldAttrVal != null && newAttrVal != null) {
// Reference to another entity. We just check if
// referenced
// entities are the same i.e. have the same business
// reference.
ClassDescriptor oldReferencedDesc = getReflection()
.getClassDescriptor(oldAttrVal.getClass());
ClassDescriptor newReferencedDesc = getReflection()
.getClassDescriptor(newAttrVal.getClass());
// We do not check anything if class has changed
if (oldReferencedDesc == newReferencedDesc) {
Object oldBusinesRef = getBusinessReference(
oldReferencedDesc, oldAttrVal);
Object newBusinesRef = getBusinessReference(
oldReferencedDesc, newAttrVal);
if (primitiveValuesAreDifferent(oldBusinesRef,
newBusinesRef)) {
EntitySwitchValueChange switchChange = new EntitySwitchValueChange(
fieldInfo.getField(), fieldInfo, oldAttrVal,
newAttrVal, fieldInfo.getOpposite());
modificationChange
.addModification(switchChange);
}
} else {
// Classes are different so objects have been
// switched
EntitySwitchValueChange switchChange = new EntitySwitchValueChange(
fieldInfo.getField(), fieldInfo,oldAttrVal,
newAttrVal, fieldInfo.getOpposite());
modificationChange.addModification(switchChange);
}
} else {
// One value is null. Not other test is needed
EntitySwitchValueChange switchChange = new EntitySwitchValueChange(
fieldInfo.getField(), fieldInfo,oldAttrVal, newAttrVal,
fieldInfo.getOpposite());
modificationChange.addModification(switchChange);
}
}
} else {
// Here we've a collection. Of primitive types or entities or
// value objects or a single reference to a value object
// Beware, collection can be null !
if (oldAttrVal == null && newAttrVal == null) {
// Nothing to do
} else if (isReferenceToSingleValueObject(fieldInfo)) {
ModifiedObject subModification = new ModifiedObject(
oldAttrVal, newAttrVal, getBusinessReferenceIfAny(
oldAttrVal, newAttrVal));
compareOldAndNew(newAttrVal, oldAttrVal, subModification);
if (subModification.getModifications().size() > 0) {
modificationChange.addModification(subModification);
}
} else {
CollectionValueChange collChange = new CollectionValueChange(
fieldInfo.getField(), fieldInfo,oldAttrVal, newAttrVal,
fieldInfo.getOpposite());
// We will check :
// 1- added items
// 2- removed items
// 3- order
if (oldAttrVal == null && newAttrVal != null) {
// Add all items of newAttrVal as added items
Collection<?> newCollection = (Collection<?>) newAttrVal;
for (Object o : newCollection) {
collChange.addAddedItem(o);
}
}
if (oldAttrVal != null && newAttrVal == null) {
// Add all items of oldAttrVal as removed items
Collection<?> oldCollection = (Collection<?>) oldAttrVal;
for (Object o : oldCollection) {
collChange.addRemovedItem(o);
}
}
// Here we can check order and content (added/removed)
if (oldAttrVal != null && newAttrVal != null) {
Collection<?> newCollection = (Collection<?>) newAttrVal;
Collection<?> oldCollection = (Collection<?>) oldAttrVal;
// Order : we check order using the shorter size.
int min = newCollection.size() < oldCollection.size() ? newCollection
.size() : oldCollection.size();
Iterator<?> itOld = ((Collection<?>) oldCollection)
.iterator();
Iterator<?> itNew = ((Collection<?>) newCollection)
.iterator();
// check order first
compareCollectionsOrder(collChange, min, itOld, itNew);
// Check content
// need to find added and removed object whatever the
// order is
compareCollectionsContent(collChange, oldCollection,
newCollection);
}
if (collChange.isSomethingDifferent()) {
modificationChange.addModification(collChange);
}
}
}
}
}
private void compareCollectionsContent(CollectionValueChange collChange,
Collection<?> oldCollection, Collection<?> newCollection) {
// Both collections are not null but they can be collections of
// primitives or value objects or entities
// First, check type of object inside collection
// Take first item of the non empty collection
if (oldCollection.size() == 0 && newCollection.size() == 0)
return;
Collection<?> forCheck = oldCollection.size() > 0 ? oldCollection
: newCollection;
Object firstItem = forCheck.iterator().next();
if (isStandardType(firstItem.getClass())) {
// StandardTypes
// Search removed
for (Object o : oldCollection) {
if (!newCollection.contains(o)) {
collChange.addRemovedItem(o);
}
}
// Search added
for (Object o : newCollection) {
if (!oldCollection.contains(o)) {
collChange.addAddedItem(o);
}
}
} else {
ClassDescriptor desc = getReflection().getClassDescriptor(
firstItem.getClass());
if (desc.hasBusinessReference()) {
// Entities
Map<Object, Object> oldMap = new Hashtable<Object, Object>();
Map<Object, Object> newMap = new Hashtable<Object, Object>();
createEntityMapFromCollection(oldCollection, oldMap);
createEntityMapFromCollection(newCollection, newMap);
// Search removed
for (Object br : oldMap.keySet()) {
if (newMap.get(br) == null) {
collChange.addRemovedItem(oldMap.get(br));
}
}
// Search added
for (Object br : newMap.keySet()) {
if (oldMap.get(br) == null) {
collChange.addAddedItem(newMap.get(br));
}
}
} else {
// ValueObject....to see later TODO
}
}
}
private void createEntityMapFromCollection(Collection<?> coll,
Map<Object, Object> map) {
for (Object item : coll) {
ClassDescriptor desc = getReflection().getClassDescriptor(
item.getClass());
Object br = getBusinessReference(desc, item);
map.put(br, item);
}
}
private void compareCollectionsOrder(CollectionValueChange collChange,
int min, Iterator<?> itOld, Iterator<?> itNew)
throws IllegalAccessException, InvocationTargetException {
for (int i = 0; i < min; i++) {
Object oldItem = itOld.next();
Object newItem = itNew.next();
// Now we need to check if items are the same. Diff
// depends on the nature of item primitive,
// valueobject or collection or entity
if (isStandardType(oldItem.getClass())) {
if (primitiveValuesAreDifferent(oldItem, newItem)) {
collChange.setOrderChanged(true);
break;
}
} else {
ClassDescriptor descItem = getReflection().getClassDescriptor(
oldItem.getClass());
// Two items are Entities
if (descItem.hasBusinessReference()) {
// We've entity
Object brOldItem = getBusinessReference(descItem, oldItem);
Object brNewItem = getBusinessReference(descItem, newItem);
if (brOldItem == null && brNewItem != null
|| (brOldItem != null && brNewItem == null)
|| (!brOldItem.equals(brNewItem))) {
collChange.setOrderChanged(true);
break;
}
} else if (!Collection.class.isAssignableFrom(oldItem
.getClass())) {
// We do not support collection of
// collection in check order
// So here we assume that we've value
// objects. They're different if compare
// returns something.
ModifiedObject subModification = new ModifiedObject(
oldItem, newItem, getBusinessReferenceIfAny(
oldItem, newItem));
compareOldAndNew(oldItem, newItem, subModification);
if (subModification.getModifications().size() > 0) {
collChange.setOrderChanged(true);
break;
}
}
}
}
}
private boolean primitiveValuesAreDifferent(Object oldAttrVal,
Object newAttrVal) {
return (oldAttrVal == null && newAttrVal != null)
|| (oldAttrVal != null && newAttrVal == null)
|| (!oldAttrVal.equals(newAttrVal));
}
private void createEntityMap(Object aObject, EntitiesMap map,
List<Object> allKeys, List<Object> already)
throws IllegalAccessException, IllegalArgumentException,
InvocationTargetException, NoSuchMethodException, SecurityException {
if (isStandardType(aObject.getClass()))
return;
if (already.contains(aObject))
return;
already.add(aObject);
if (!isCollection(aObject)) {
// Get object descriptor to know if it is an entity, primitive type
// or
// valueobject or collection
ClassDescriptor desc = getReflection().getDescriptor(aObject);
// Got entity, add it to map
if (desc.hasBusinessReference()) {
// An entity
Object br = getBusinessReference(desc, aObject);
map.addObject(br, aObject);
allKeys.add(br);
}
}
// Now recurse into Entities, valueobjects and collection
// If object is a collection, walk into each items
if (isCollection(aObject)) {
Collection<?> collection = (Collection<?>) aObject;
for (Object o : collection) {
createEntityMap(o, map, allKeys, already);
}
} else if (!isStandardType(aObject.getClass())) {
ClassDescriptor desc = getReflection().getDescriptor(aObject);
// Type is not primitive, we walk into all fields (here attr can be
// valueobject or entity
for (FieldInfo fieldInfo : desc.getFieldsToCheck()) {
Object attr = fieldInfo.getReadAccessor().invoke(aObject);
if (attr != null) {
createEntityMap(attr, map, allKeys, already);
}
}
}
}
private boolean isCollection(Object aObject) {
return Collection.class.isAssignableFrom(aObject.getClass());
}
private boolean isReferenceToSingleValueObject(FieldInfo field) {
if (!isPrimitiveType(field) && field.getAssociation() != null
&& !field.getAssociation().isCollection()) {
// now check if field type has a business reference
ClassDescriptor cd = reflection.getClassDescriptor(field.getField()
.getType());
if (cd.hasBusinessReference())
return false;
else
return true;
} else {
return false;
}
}
private boolean isReferenceToSingleEntity(FieldInfo field) {
if (!isPrimitiveType(field)
&& (field.getAssociation() == null || !field.getAssociation()
.isCollection())) {
// now check if field type has a business reference
ClassDescriptor cd = reflection.getClassDescriptor(field.getField()
.getType());
if (cd.hasBusinessReference())
return true;
else
return false;
} else {
return false;
}
}
private boolean isPrimitiveType(FieldInfo field) {
return isStandardType(field.getField().getType());
}
static Class<?> primitives[] = { Number.class, Date.class, Calendar.class,
Character.class, String.class };
private boolean isStandardType(Class<?> type) {
if (type.isPrimitive() || type.isEnum()) {
return true;
} else {
for (int i = 0; i < primitives.length; i++) {
if (primitives[i].isAssignableFrom(type)) {
return true;
}
}
return false;
}
}
private Object getBusinessReferenceIfAny(Object o1, Object o2) {
Object o = o1 == null ? o2 : o1;
if (o == null) {
return null;
} else {
ClassDescriptor desc = getReflection().getClassDescriptor(
o.getClass());
if (desc.hasBusinessReference()) {
if (o1 != null) {
return getBusinessReference(desc, o1);
} else if (o2 != null) {
return getBusinessReference(desc, o2);
} else {
return null;
}
} else {
return null;
}
}
}
private Object getBusinessReference(ClassDescriptor desc, Object obj) {
try {
Object o = desc.getBusinessReferenceMethod().invoke(obj);
return o;
} catch (IllegalAccessException e) {
ReflectionException ex = new ReflectionException(
"ERROR(access): cannot retrieve business reference of object "
+ desc.getClass().getCanonicalName()
+ " business reference field accessor = "
+ desc.getBusinessReference());
ex.setStackTrace(ex.getStackTrace());
throw ex;
} catch (IllegalArgumentException e) {
ReflectionException ex = new ReflectionException(
"ERROR(argument): cannot retrieve business reference of object "
+ desc.getClazz().getName()
+ ", business reference field accessor = "
+ desc.getBusinessReference() + " (root message : "
+ e.getMessage() + ")");
throw ex;
} catch (InvocationTargetException e) {
ReflectionException ex = new ReflectionException(
"ERROR(invoke): cannot retrieve business reference of object "
+ desc.getClass().getCanonicalName()
+ " business reference field accessor = "
+ desc.getBusinessReference());
throw ex;
} catch (SecurityException e) {
ReflectionException ex = new ReflectionException(
"ERROR(security): cannot retrieve business reference of object "
+ desc.getClass().getCanonicalName()
+ " business reference field accessor = "
+ desc.getBusinessReference());
throw ex;
}
}
protected ReflectionUtil getReflection() {
return reflection;
}
}
| [
"[email protected]"
] | |
cfc79301f9baaa7c471d5516115f7f15816c2ed1 | f96fe9258e983db03783d3c2fc0ffbc6574f49c8 | /src/main/java/com/camunda/consulting/client/api/TaskIdentityLinkApi.java | ab170611f440f724e5ae5dc9da4424cab2a4879c | [] | no_license | lucascalsilva/camunda-rest-client-spring | cf22464bc76ad8d5cf01bb0b970d162c12dbc89f | a94a5b1948f234d8d0da9ece0d4b65ca6f4ca23b | refs/heads/master | 2022-12-19T23:47:32.846799 | 2020-09-20T13:05:57 | 2020-09-20T13:05:57 | 297,077,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,922 | java | package com.camunda.consulting.client.api;
import com.camunda.consulting.client.invoker.ApiClient;
import com.camunda.consulting.client.model.ExceptionDto;
import com.camunda.consulting.client.model.IdentityLinkDto;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.util.UriComponentsBuilder;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.core.io.FileSystemResource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-09-20T14:06:02.786934+02:00[Europe/Berlin]")
@Component("com.camunda.consulting.client.api.TaskIdentityLinkApi")
public class TaskIdentityLinkApi {
private ApiClient apiClient;
public TaskIdentityLinkApi() {
this(new ApiClient());
}
@Autowired
public TaskIdentityLinkApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
public ApiClient getApiClient() {
return apiClient;
}
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
*
* Adds an identity link to a task by id. Can be used to link any user or group to a task and specify a relation.
* <p><b>204</b> - Request successful.
* <p><b>400</b> - Task with given id does not exist. See the [Introduction](https://docs.camunda.org/manual/7.13/reference/rest/overview/#error-handling) for the error response format.
* @param id The id of the task to add a link to. (required)
* @param identityLinkDto (optional)
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void addIdentityLink(String id, IdentityLinkDto identityLinkDto) throws RestClientException {
addIdentityLinkWithHttpInfo(id, identityLinkDto);
}
/**
*
* Adds an identity link to a task by id. Can be used to link any user or group to a task and specify a relation.
* <p><b>204</b> - Request successful.
* <p><b>400</b> - Task with given id does not exist. See the [Introduction](https://docs.camunda.org/manual/7.13/reference/rest/overview/#error-handling) for the error response format.
* @param id The id of the task to add a link to. (required)
* @param identityLinkDto (optional)
* @return ResponseEntity<Void>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity<Void> addIdentityLinkWithHttpInfo(String id, IdentityLinkDto identityLinkDto) throws RestClientException {
Object postBody = identityLinkDto;
// verify the required parameter 'id' is set
if (id == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling addIdentityLink");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("id", id);
String path = apiClient.expandPath("/task/{id}/identity-links", uriVariables);
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
}
/**
*
* Removes an identity link from a task by id
* <p><b>204</b> - Request successful.
* <p><b>400</b> - Task with given id does not exist. See the [Introduction](https://docs.camunda.org/manual/7.13/reference/rest/overview/#error-handling) for the error response format.
* @param id The id of the task to remove a link from. (required)
* @param identityLinkDto (optional)
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public void deleteIdentityLink(String id, IdentityLinkDto identityLinkDto) throws RestClientException {
deleteIdentityLinkWithHttpInfo(id, identityLinkDto);
}
/**
*
* Removes an identity link from a task by id
* <p><b>204</b> - Request successful.
* <p><b>400</b> - Task with given id does not exist. See the [Introduction](https://docs.camunda.org/manual/7.13/reference/rest/overview/#error-handling) for the error response format.
* @param id The id of the task to remove a link from. (required)
* @param identityLinkDto (optional)
* @return ResponseEntity<Void>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity<Void> deleteIdentityLinkWithHttpInfo(String id, IdentityLinkDto identityLinkDto) throws RestClientException {
Object postBody = identityLinkDto;
// verify the required parameter 'id' is set
if (id == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling deleteIdentityLink");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("id", id);
String path = apiClient.expandPath("/task/{id}/identity-links/delete", uriVariables);
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = {
"application/json"
};
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<Void> returnType = new ParameterizedTypeReference<Void>() {};
return apiClient.invokeAPI(path, HttpMethod.POST, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
}
/**
*
* Gets the identity links for a task by id, which are the users and groups that are in *some* relation to it (including assignee and owner).
* <p><b>200</b> - Request successful.
* <p><b>400</b> - Task with given id does not exist. See the [Introduction](https://docs.camunda.org/manual/7.13/reference/rest/overview/#error-handling) for the error response format.
* @param id The id of the task to retrieve the identity links for. (required)
* @param type Filter by the type of links to include. (optional)
* @return List<IdentityLinkDto>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public List<IdentityLinkDto> getIdentityLinks(String id, String type) throws RestClientException {
return getIdentityLinksWithHttpInfo(id, type).getBody();
}
/**
*
* Gets the identity links for a task by id, which are the users and groups that are in *some* relation to it (including assignee and owner).
* <p><b>200</b> - Request successful.
* <p><b>400</b> - Task with given id does not exist. See the [Introduction](https://docs.camunda.org/manual/7.13/reference/rest/overview/#error-handling) for the error response format.
* @param id The id of the task to retrieve the identity links for. (required)
* @param type Filter by the type of links to include. (optional)
* @return ResponseEntity<List<IdentityLinkDto>>
* @throws RestClientException if an error occurs while attempting to invoke the API
*/
public ResponseEntity<List<IdentityLinkDto>> getIdentityLinksWithHttpInfo(String id, String type) throws RestClientException {
Object postBody = null;
// verify the required parameter 'id' is set
if (id == null) {
throw new HttpClientErrorException(HttpStatus.BAD_REQUEST, "Missing the required parameter 'id' when calling getIdentityLinks");
}
// create path and map variables
final Map<String, Object> uriVariables = new HashMap<String, Object>();
uriVariables.put("id", id);
String path = apiClient.expandPath("/task/{id}/identity-links", uriVariables);
final MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
final HttpHeaders headerParams = new HttpHeaders();
final MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
final MultiValueMap formParams = new LinkedMultiValueMap();
queryParams.putAll(apiClient.parameterToMultiValueMap(null, "type", type));
final String[] accepts = {
"application/json"
};
final List<MediaType> accept = apiClient.selectHeaderAccept(accepts);
final String[] contentTypes = { };
final MediaType contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
ParameterizedTypeReference<List<IdentityLinkDto>> returnType = new ParameterizedTypeReference<List<IdentityLinkDto>>() {};
return apiClient.invokeAPI(path, HttpMethod.GET, queryParams, postBody, headerParams, cookieParams, formParams, accept, contentType, authNames, returnType);
}
}
| [
"[email protected]"
] | |
e6983cc5beeedfddaecbe1d0ee761d9bbcea012b | 98bf0dc455f4865bea06847c12c46f4be31d2ec4 | /fhir/src/main/java/org/dhis2/fhir/adapter/fhir/transform/dhis/impl/AbstractPreparedDhisToFhirSearch.java | 4b9968adb169efd8e94dc0850fd254414cea5a65 | [
"BSD-3-Clause"
] | permissive | opensrp/dhis2-fhir-adapter | 5150e8876fb3405534792e6ce15d73a4363cf09e | e29d531f311d87089a32fbfaedde3456dbb6da6e | refs/heads/master | 2022-11-28T02:45:44.378322 | 2022-05-17T11:40:41 | 2022-05-17T11:40:41 | 472,286,673 | 1 | 2 | BSD-3-Clause | 2022-11-12T22:13:07 | 2022-03-21T10:25:17 | Java | UTF-8 | Java | false | false | 4,798 | java | package org.dhis2.fhir.adapter.fhir.transform.dhis.impl;
/*
* Copyright (c) 2004-2019, University of Oslo
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import ca.uhn.fhir.rest.param.DateRangeParam;
import org.dhis2.fhir.adapter.dhis.model.ItemContainerType;
import org.dhis2.fhir.adapter.dhis.model.UriFilterApplier;
import org.dhis2.fhir.adapter.fhir.metadata.model.AbstractRule;
import org.dhis2.fhir.adapter.fhir.metadata.model.RuleInfo;
import org.dhis2.fhir.adapter.fhir.model.FhirVersion;
import org.dhis2.fhir.adapter.fhir.transform.dhis.DhisToFhirDataProviderException;
import org.dhis2.fhir.adapter.fhir.transform.dhis.PreparedDhisToFhirSearch;
import org.dhis2.fhir.adapter.fhir.transform.dhis.search.SearchFilterCollector;
import org.springframework.web.util.UriBuilder;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
/**
* Abstract implementation of {@link PreparedDhisToFhirSearch}.
*
* @param <T> the concrete type of the rule.
* @author volsch
*/
public abstract class AbstractPreparedDhisToFhirSearch<T extends AbstractRule> implements PreparedDhisToFhirSearch, UriFilterApplier
{
private final FhirVersion fhirVersion;
private final List<RuleInfo<T>> ruleInfos;
private final Map<String, List<String>> filter;
private final DateRangeParam lastUpdatedDateRange;
private final int count;
private UriFilterApplier uriFilterApplier;
protected AbstractPreparedDhisToFhirSearch( @Nonnull FhirVersion fhirVersion, @Nonnull List<RuleInfo<T>> ruleInfos,
@Nullable Map<String, List<String>> filter, @Nullable DateRangeParam lastUpdatedDateRange, int count )
{
this.fhirVersion = fhirVersion;
this.ruleInfos = ruleInfos;
this.filter = filter;
this.lastUpdatedDateRange = lastUpdatedDateRange;
this.count = count;
}
@Nonnull
@Override
public FhirVersion getFhirVersion()
{
return fhirVersion;
}
@Nonnull
public List<RuleInfo<T>> getRuleInfos()
{
return ruleInfos;
}
@Nullable
public DateRangeParam getLastUpdatedDateRange()
{
return lastUpdatedDateRange;
}
public int getCount()
{
return count;
}
public void setUriFilterApplier( @Nonnull UriFilterApplier uriFilterApplier )
{
this.uriFilterApplier = uriFilterApplier;
}
public SearchFilterCollector createSearchFilterCollector( @Nullable ItemContainerType itemContainerType )
{
return new SearchFilterCollector( itemContainerType, filter );
}
@Nonnull
@Override
public <U extends UriBuilder> U add( @Nonnull U uriBuilder, @Nonnull List<String> variables )
{
if ( uriFilterApplier == null )
{
throw new IllegalStateException( "URI filter applier has not been set" );
}
if ( lastUpdatedDateRange != null && !lastUpdatedDateRange.isEmpty() )
{
throw new DhisToFhirDataProviderException( "Search parameter to filter last updated date range is not yet supported." );
}
return uriFilterApplier.add( uriBuilder, variables );
}
@Override
public boolean containsQueryParam( @Nonnull String name )
{
return uriFilterApplier.containsQueryParam( name );
}
}
| [
"[email protected]"
] | |
820e1b131354bf3ed36270c25b3e7a4f0956bfb4 | d3c4b9e8a20b30f6a64f9d7e4ab8c0d7e71bbd7b | /netty-in-action/src/main/java/com/manning/nettyinaction/chapter1/PlainEchoServer.java | 6475977881d163e77380eac620456235c96e19e6 | [] | no_license | mo-open/tests | 105b1b36da07ded8800dadcaf7b1d8c3ec743735 | 741c9c65ceb0237905b8f31f00cb29a98a52550d | refs/heads/master | 2021-05-28T16:43:32.675631 | 2015-05-10T05:39:26 | 2015-05-10T05:39:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,803 | java | package com.manning.nettyinaction.chapter1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
/**
* Listing 1.4 of <i>Netty in Action</i>
*
* @author <a href="mailto:[email protected]">Norman Maurer</a>
*/
public class PlainEchoServer {
public void serve(int port) throws IOException {
final ServerSocket socket = new ServerSocket(port);
try {
while (true) {
final Socket clientSocket = socket.accept();
System.out.println("Accepted connection from " + clientSocket);
new Thread(new Runnable() {
@Override
public void run() {
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(clientSocket.getInputStream()));
PrintWriter writer = new PrintWriter(clientSocket
.getOutputStream(), true);
while (true) {
writer.println(reader.readLine());
writer.flush();
}
} catch (IOException e) {
e.printStackTrace();
try {
clientSocket.close();
} catch (IOException ex) {
// ignore on close
}
}
}
}).start();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
fd111a9dd31f4442645baf4f5bf9633242ecafcc | 8ec986726b3b60170aec4cb9772d3bdb163710af | /lib/jdomodels/src/main/java/org/sagebionetworks/repo/model/dbo/file/MultipartRequestUtils.java | 0ce99b58c3adcee9b1099602811245463853c44a | [
"Apache-2.0"
] | permissive | marcomarasca/Synapse-Repository-Services | 871446d7bc8e27ca9f4e3d16c4f2007e3f69f5d3 | 294e6f422ef9a1367deaf511bc97473623233da4 | refs/heads/develop | 2023-08-17T12:25:54.442901 | 2023-08-16T15:40:47 | 2023-08-16T15:40:47 | 190,295,841 | 0 | 0 | Apache-2.0 | 2023-02-22T08:31:06 | 2019-06-04T23:55:19 | Java | UTF-8 | Java | false | false | 1,825 | java | package org.sagebionetworks.repo.model.dbo.file;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import org.apache.commons.codec.binary.Hex;
import org.sagebionetworks.repo.model.file.MultipartRequest;
import org.sagebionetworks.schema.adapter.JSONObjectAdapterException;
import org.sagebionetworks.schema.adapter.org.json.EntityFactory;
public class MultipartRequestUtils {
/**
* Get the JSON string of the request.
*
* @param request
* @return
*/
public static String createRequestJSON(MultipartRequest request) {
try {
return EntityFactory.createJSONStringForEntity(request);
} catch (JSONObjectAdapterException e) {
throw new IllegalArgumentException(e);
}
}
/**
* De-serialize the request from the json string
* @param <T>
* @param requestJson
* @param clazz
* @return
*/
public static <T extends MultipartRequest> T getRequestFromJson(String requestJson, Class<T> clazz) {
try {
return EntityFactory.createEntityFromJSONString(requestJson, clazz);
} catch (JSONObjectAdapterException e) {
throw new IllegalArgumentException(e);
}
}
/**
* Calculate the MD5 of the given multipart request
*
* @param request
* @return
*/
public static String calculateMD5AsHex(MultipartRequest request) {
try {
String json = EntityFactory.createJSONStringForEntity(request);
byte[] jsonBytes = json.getBytes(StandardCharsets.UTF_8);
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
byte[] md5Bytes = messageDigest.digest(jsonBytes);
return new String(Hex.encodeHex(md5Bytes));
} catch (JSONObjectAdapterException | NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
}
| [
"[email protected]"
] | |
8d016c94033e3ed2ed55c07ddd1f66c0758103ce | 86220a3b6fde651f1c9c8a8fc0d599cab75ebf18 | /src/com/learning/WordFileWriting.java | 1f4927ff6e8179de196c73aa47eec09cf97af59b | [] | no_license | aryamann-learning/ds-algo | 67c967e6723027a4411906e21840acb8979590f3 | b9cb40c9ba5b3095a5033980421213e0524cc3ab | refs/heads/main | 2023-07-26T05:51:05.964951 | 2021-08-28T13:27:41 | 2021-08-28T13:27:41 | 312,771,318 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,849 | java | package com.learning;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
/*import org.apache.poi.util.Units;*/
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.xwpf.usermodel.ParagraphAlignment;
import org.apache.poi.xwpf.usermodel.UnderlinePatterns;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFRun;
public class WordFileWriting{
private static Object Units;
public static void main(String[] args) throws FileNotFoundException {
XWPFDocument doc = new XWPFDocument();
XWPFParagraph paragraphOne = doc.createParagraph();
XWPFRun runOne = paragraphOne.createRun();
runOne.setText("Hi this is arya\n");
runOne.setBold(true);
runOne.setItalic(true);
runOne.setFontSize(20);
runOne.setFontFamily("Times new roman");
XWPFRun paragraphOneRunOne = paragraphOne.createRun();
paragraphOneRunOne.setBold(true);
paragraphOneRunOne.setFontSize(2);
paragraphOneRunOne.setFontFamily("Verdana");
paragraphOneRunOne.setText("HI I AM ARYA");
//XWPFRun paragraphOneRunTwo = paragraphOne.createRun();
//paragraphOneRunTwo.setText(" More text in paragraph one...");
XWPFParagraph paragraphTwo = doc.createParagraph();
paragraphTwo.setAlignment(ParagraphAlignment.CENTER);
XWPFRun paragraphTwoRunOne = paragraphTwo.createRun();
//paragraphTwoRunOne.setBold(true);
paragraphTwoRunOne.setFontSize(12);
paragraphTwoRunOne.setFontFamily("Verdana");
paragraphTwoRunOne.addBreak();
XWPFParagraph paragraphThree = doc.createParagraph();
paragraphThree.setAlignment(ParagraphAlignment.LEFT);
XWPFRun paragraphThreeRunOne = paragraphThree.createRun();
//paragraphThreeRunOne.setBold(true);
paragraphThreeRunOne.setFontSize(34);
paragraphThreeRunOne.setFontFamily("Verdana");
paragraphThreeRunOne.setText("hello this is arya");
paragraphThreeRunOne.addBreak();
XWPFParagraph paragraphFour = doc.createParagraph();
paragraphFour.setAlignment(ParagraphAlignment.LEFT);
XWPFRun paragraphFourRunOne = paragraphFour.createRun();
paragraphFourRunOne.setBold(true);
paragraphFourRunOne.setUnderline(UnderlinePatterns.SINGLE);
paragraphFourRunOne.setFontSize(10);
paragraphFourRunOne.setFontFamily("Verdana");
paragraphFourRunOne.setText("Arya");
/*up to this the code is working fine,and it is preparing the doc as expected,but after adding the rest of the part, that is adding the image,the doc got corrupted*/
InputStream pic=null;
/* try {
pic = new FileInputStream("D:\\ARYA\\arya.JPG");
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
XWPFParagraph paragraphFive = doc.createParagraph();
paragraphFive.setAlignment(ParagraphAlignment.CENTER);
XWPFRun paragraphFiveRunOne = paragraphFive.createRun();
try {
paragraphFiveRunOne.addPicture(pic, XWPFDocument.PICTURE_TYPE_JPEG, "C:\\1.JPG",Units.toEMU(200), Units.toEMU(200));
} catch (InvalidFormatException e1) {
e1.printStackTrace();
} catch (IOException e1) {
e1.printStackTrace();
}
*/
FileOutputStream outStream = null;
try {
outStream = new FileOutputStream("D:\\ARYA\\wordfilewriting.docx");
} catch (FileNotFoundException e) {
System.out.println("First Catch");
e.printStackTrace();
}
try {
doc.write(outStream);
outStream.close();
} catch (FileNotFoundException e) {
System.out.println("Second Catch");
e.printStackTrace();
} catch (IOException e) {
System.out.println("Third Catch");
e.printStackTrace();
}
}
} | [
"[email protected]"
] | |
eb371a28b9928890de8835bd6159b37b562cb18d | db6b88ca550ade48cac994e0dc2c061e9969f677 | /play-global-auth-sample/app/annotations/SkipAuth.java | 4a9bddbb99082e324525442b4e9b6c6849b9c1c6 | [] | no_license | teriusray/sample | d75abd01c34e0606b2116e2854898056d60b5742 | fc8e826263090e9d5f3a0b5026ee1abd1e81674c | refs/heads/master | 2020-04-08T21:06:05.614979 | 2013-05-07T02:00:58 | 2013-05-07T02:00:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | /**
* Author : Teriusray
* Created date : 2013/05/06
* Version : 1.0
* CopyRright (c) 2013 Teriusray
* All right reserved.
*/
package annotations;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(value = ElementType.METHOD)
@Retention(value = RetentionPolicy.RUNTIME)
public @interface SkipAuth {
}
| [
"[email protected]"
] | |
63202fe40f6650db4c0b01205c9ed3dae5198da1 | 75359750770a76cf1478ae09074a563eb9fba767 | /src/main/java/bll/validators/AgeValidator.java | 2176e40badc718a6f98c9449fdbc84736a006599 | [] | no_license | andreibursuc97/FOOD_DELIVERY | 24648cfd248ad19244c0c62a8337db3323b7011d | 9ac39bac1431386b6547f9e229f671e84b368eb4 | refs/heads/master | 2021-04-09T15:06:52.302822 | 2018-03-29T09:21:22 | 2018-03-29T09:21:22 | 125,529,469 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 455 | java | package bll.validators;
import model.Client;
/**
* Created by Andrei on 18/04/2017.
*/
public class AgeValidator implements Validator<Client> {
private static final int MIN_AGE = 18;
private static final int MAX_AGE = 100;
public void validate(Client t) {
if (t.getVarsta() < MIN_AGE || t.getVarsta() > MAX_AGE) {
throw new IllegalArgumentException("Varsta introdusa nu se incadreaza in limite!");
}
}
}
| [
"[email protected]"
] | |
642a7ced09d0ffc81a257fa7a0f425a0644274ce | 347273f2a9eb143f81e3f87758fe35fd0c63e9bc | /src/main/java/com/spare/mapper/GradeMapper.java | ba7775770e8c5486482f9997d489854fae27bd58 | [] | no_license | VERATUM/ssm | 31a55ecae98b2cb557213fc9336b0ff4d01c18d6 | b95330324acfe41028fe84e22882ccdec804d89b | refs/heads/master | 2020-04-23T00:21:16.077217 | 2019-02-15T00:23:50 | 2019-02-15T00:23:50 | 170,776,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 491 | java | package com.spare.mapper;
import com.spare.entity.Grade;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
public interface GradeMapper {
int deleteByPrimaryKey(Integer gid);
int insert(Grade record);
int insertSelective(Grade record);
Grade selectByPrimaryKey(Integer gid);
int updateByPrimaryKeySelective(Grade record);
int updateByPrimaryKey(Grade record);
List<Grade> selectAllStudent();
int getMaxGid();
} | [
"[email protected]"
] | |
0dc39ca1da7de0ec8acbce34d116cf7867417e9b | 9e0566c94f5c360888015f9a77c9a88abb11efae | /FoodOrderingApp-api/target/generated-sources/com/upgrad/FoodOrderingApp/api/model/PaymentResponse.java | eb5337de1852212149f42920a68f8cb05118f1f2 | [] | no_license | aditya8119/FoodOrderingApp-Backend | 9bb4d54fa801d216c2eec463b99bec07d8f35773 | 7722bc7f112e1b88bfa501ab8c3d1b74d7e21c2f | refs/heads/master | 2022-12-25T22:59:30.677086 | 2020-09-28T20:19:23 | 2020-09-28T20:19:23 | 298,328,409 | 1 | 0 | null | 2020-09-28T20:19:25 | 2020-09-24T16:02:20 | Java | UTF-8 | Java | false | false | 2,600 | java | package com.upgrad.FoodOrderingApp.api.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.UUID;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.*;
/**
* PaymentResponse
*/
@Validated
@javax.annotation.Generated(value = "io.swagger.codegen.languages.SpringCodegen", date = "2020-09-26T02:20:05.645+05:30")
public class PaymentResponse {
@JsonProperty("id")
private UUID id = null;
@JsonProperty("payment_name")
private String paymentName = null;
public PaymentResponse id(UUID id) {
this.id = id;
return this;
}
/**
* Unique identifier of the payment method in a standard UUID format
* @return id
**/
@ApiModelProperty(value = "Unique identifier of the payment method in a standard UUID format")
@Valid
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public PaymentResponse paymentName(String paymentName) {
this.paymentName = paymentName;
return this;
}
/**
* Name of the payment method
* @return paymentName
**/
@ApiModelProperty(value = "Name of the payment method")
public String getPaymentName() {
return paymentName;
}
public void setPaymentName(String paymentName) {
this.paymentName = paymentName;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
PaymentResponse paymentResponse = (PaymentResponse) o;
return Objects.equals(this.id, paymentResponse.id) &&
Objects.equals(this.paymentName, paymentResponse.paymentName);
}
@Override
public int hashCode() {
return Objects.hash(id, paymentName);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class PaymentResponse {\n");
sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" paymentName: ").append(toIndentedString(paymentName)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"[email protected]"
] | |
661c9aa922212f74eb3c804d1e2e96d25fde7916 | 0718f4702b422650b4d1e19bf3ca1de1708dd67b | /ProjectImplementation12/src/main/java/testcases/TC003.java | b20b2cf865d770930d61b45d4a6eccbbffef3cf0 | [] | no_license | sivajimore/Practice | 7d274fdd78bb3e024f7ada3da2e2eee791327dc1 | d1ba0d15060288408724f2fd59b95459c75b7f14 | refs/heads/master | 2022-07-05T14:55:13.929591 | 2020-04-01T08:57:37 | 2020-04-01T08:57:37 | 252,112,848 | 0 | 0 | null | 2022-06-29T18:03:01 | 2020-04-01T08:12:37 | HTML | UTF-8 | Java | false | false | 333 | java | package testcases;
import org.testng.annotations.Test;
import wrappers.GenericWrappers;
public class TC003 extends GenericWrappers {
@Test
public void IrctcFTRSignup() {
invokeApp("chrome", "https://www.ftr.irctc.co.in/ftr/");
waitproperty(3000);
clickByLink("New User? Signup");
waitproperty(3000);
}
}
| [
"THIRUMALA@Sys"
] | THIRUMALA@Sys |
764ae1ba30defed0363fdf4630b19fe526081302 | f8d887abc23f19c8e2dafec356d97fd20854e191 | /domain-models-runtime-it/src/main/java/org/folio/rest/impl/MyitemsApi.java | be444c262d733a85ff6ba38e729ba2f68ff3e51f | [
"Apache-2.0"
] | permissive | DivineRapierH/raml-module-builder | 1e2a228714d28c1e32db46b2a9728ab02a7cfe85 | 01c88f3c4f78c6c9e7edbef61ce01e8d8a0ea333 | refs/heads/master | 2023-04-29T05:52:26.668973 | 2020-03-02T00:53:06 | 2020-03-02T00:53:06 | 242,886,453 | 0 | 0 | Apache-2.0 | 2023-04-14T17:54:42 | 2020-02-25T01:59:22 | Java | UTF-8 | Java | false | false | 2,081 | java | package org.folio.rest.impl;
import java.util.Map;
import javax.ws.rs.core.Response;
import org.folio.rest.jaxrs.model.Myitem;
import org.folio.rest.jaxrs.model.Myitems;
import org.folio.rest.persist.PgUtil;
import io.vertx.core.AsyncResult;
import io.vertx.core.Context;
import io.vertx.core.Handler;
public class MyitemsApi implements org.folio.rest.jaxrs.resource.Myitems {
private static final String TABLE = "myitems";
@Override
public void getMyitems(String query, int offset, int limit, String lang, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.get(TABLE, Myitem.class, Myitems.class, query, offset, limit, okapiHeaders, vertxContext,
GetMyitemsResponse.class, asyncResultHandler);
}
@Override
public void postMyitems(String lang, Myitem entity, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.post(TABLE, entity, okapiHeaders, vertxContext,
PostMyitemsResponse.class, asyncResultHandler);
}
@Override
public void getMyitemsByMyitemId(String id, String lang, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.getById(TABLE, Myitem.class, id, okapiHeaders, vertxContext,
GetMyitemsByMyitemIdResponse.class, asyncResultHandler);
}
@Override
public void deleteMyitemsByMyitemId(String id, String lang, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.deleteById(TABLE, id, okapiHeaders, vertxContext,
DeleteMyitemsByMyitemIdResponse.class, asyncResultHandler);
}
@Override
public void putMyitemsByMyitemId(String id, String lang, Myitem entity, Map<String, String> okapiHeaders,
Handler<AsyncResult<Response>> asyncResultHandler, Context vertxContext) {
PgUtil.put(TABLE, entity, id, okapiHeaders, vertxContext,
PutMyitemsByMyitemIdResponse.class, asyncResultHandler);
}
}
| [
"[email protected]"
] | |
8e8631f167747bc67033798bf990138d04d798fa | 46694da7ad952e92756bba7fd570cb6150cc9a94 | /components/org.wso2.carbon.config/src/test/java/org/wso2/carbon/config/configprovider/UniqueElementTestConfiguration.java | 9937b895f3e0db6bbd98d248a5c221961b67f3a6 | [] | no_license | wso2/carbon-config | bb4f1009aeaafb5c7505f1a617b843bed4200f5b | 25852772c23778345b602e4dea4031921efb5e58 | refs/heads/master | 2023-08-31T13:41:17.212065 | 2019-12-17T08:55:26 | 2019-12-17T08:55:26 | 83,403,025 | 35 | 38 | null | 2019-12-17T08:52:45 | 2017-02-28T07:29:29 | Java | UTF-8 | Java | false | false | 2,909 | java | /*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.config.configprovider;
import org.wso2.carbon.config.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Sample configuration class for testing purposes.
*
* @since 2.0.6
*/
@XmlRootElement
@Configuration(description = "Unique Element Test Bean")
class UniqueElementTestBean {
private String uniqueElement = "default";
private int port = 8000;
public String getUniqueElement() {
return uniqueElement;
}
@XmlElement
public void setUniqueElement(String uniqueElement) {
this.uniqueElement = uniqueElement;
}
public int getPort() {
return port;
}
@XmlElement
public void setPort(int port) {
this.port = port;
}
}
/**
* Sample configuration class for testing purposes.
*
* @since 2.0.6
*/
@XmlRootElement
@Configuration(description = "Unique Element Test Beans")
class UniqueElementTestBeans {
private List<UniqueElementTestBean> uniqueElementTestBeanList;
UniqueElementTestBeans() {
uniqueElementTestBeanList = new ArrayList<>();
uniqueElementTestBeanList.add(new UniqueElementTestBean());
}
public List<UniqueElementTestBean> getUniqueElementTestBeanList() {
return uniqueElementTestBeanList;
}
@XmlElement
public void setUniqueElementTestBeanList(List<UniqueElementTestBean> uniqueElementTestBeanList) {
this.uniqueElementTestBeanList = uniqueElementTestBeanList;
}
}
/**
* Sample configuration class for testing purposes.
*
* @since 2.0.6
*/
@XmlRootElement(name = "uniqueelementtestconfiguration")
@Configuration(namespace = "uniqueelementtestconfiguration", description = "Unique Element Test Configurations Bean")
public class UniqueElementTestConfiguration {
private UniqueElementTestBeans uniqueElementTestBeans = new UniqueElementTestBeans();
public UniqueElementTestBeans getUniqueElementTestBeans() {
return uniqueElementTestBeans;
}
@XmlElement
public void setUniqueElementTestBeans(UniqueElementTestBeans uniqueElementTestBeans) {
this.uniqueElementTestBeans = uniqueElementTestBeans;
}
}
| [
"[email protected]"
] | |
00847f15cf3b97fd65e27f2a5cc084439eea281c | 4240f6522808b7793d75b09dba8131ac3ef3c9f5 | /src/main/java/com/dxfjyygy/test/threadTest/threadSync/Creature.java | d7c834a6e58f55945742d58c2d7fab71fd1a32c3 | [] | no_license | jwlong/springmvcDemo4 | 40c9e7087eb527e8a537cf951c839db78895aef9 | f8ca244e2ae9f987e22d02f5cc6d8f9d967fdbe8 | refs/heads/master | 2021-01-19T20:18:12.403689 | 2017-09-24T10:44:30 | 2017-09-24T10:44:30 | 83,743,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 473 | java | package com.dxfjyygy.test.threadTest.threadSync;
/**
* Created by longjinwen on 2017/4/17.
*/
public class Creature {
private static long numCreated;
public Creature() throws InterruptedException {
System.out.println("now Count:"+numCreated);
Thread.sleep(1000);
// synchronized (Creature.class){
// numCreated++;
// }
numCreated++;
}
public static long numCreated(){
return numCreated;
}
}
| [
"[email protected]"
] | |
50b736f2a373df5db5d397796ab506c4abea8fb5 | d13e9f86111e2dd033a8ef42419338350ef69078 | /app/src/main/java/org/app/mbooster/shopping_mall/RequestAnItem/RequestAnItem2.java | 708a3219c6662a5fe3266c5cc68769a1dad90c60 | [] | no_license | amirfirdausdeveloper/mboosteropenver_my | c4390134b1d0441c5d3969f8ed7ea627ac76467e | c015dbd17cc2dd3feb7c2b8b6844acb826b6518c | refs/heads/master | 2020-09-04T07:28:14.187392 | 2020-02-10T15:11:22 | 2020-02-10T15:11:22 | 219,684,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,090 | java | package org.app.mbooster.shopping_mall.RequestAnItem;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.provider.MediaStore;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Base64;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.analytics.HitBuilders;
import com.google.android.gms.analytics.Tracker;
import com.google.firebase.analytics.FirebaseAnalytics;
import org.app.mbooster.Dialog.DialogFragmentPhoto;
import org.app.mbooster.Dialog.DialogFragmentUniversal;
import org.app.mbooster.Google.AnalyticsApplication;
import org.app.mbooster.Helper.ChoosePhoto;
import org.app.mbooster.Helper.Helper;
import org.app.mbooster.Helper.LogHelper;
import org.app.mbooster.R;
import org.app.mbooster.activity_folder.MyAddressEdit;
import org.app.mbooster.model_folder.NetworkStateReceiver;
import org.app.mbooster.model_folder.SavePreferences;
import org.app.mbooster.model_folder.urlLink;
import org.json.JSONObject;
import java.io.ByteArrayOutputStream;
import cc.cloudist.acplibrary.ACProgressConstant;
import cc.cloudist.acplibrary.ACProgressFlower;
import uk.co.chrisjenx.calligraphy.CalligraphyConfig;
import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
public class RequestAnItem2 extends AppCompatActivity implements DialogFragmentPhoto.onSubmitListener, DialogFragmentUniversal.onSubmitListener, NetworkStateReceiver.NetworkStateReceiverListener {
private EditText itemname, itemdesc, pricerange;
private TextView tvitemname, tvitemdesc, tvpricerange, tvitemimage, toolbar_title, tvsubmit;
private String itemnamestr, itemdescstr, pricerangestr, userId;
private Toolbar toolbar;
private LinearLayout uploadimage_rl;
private ImageView uploadimage;
private ImageView imghistory;
private final static int REQUEST_CAMERA = 0, SELECT_FILE = 1;
private DialogFragmentPhoto fragment1;
private DialogFragmentUniversal fragment2;
private String base64 = "";
private RelativeLayout submit;
private NetworkStateReceiver networkStateReceiver;
static Activity activity;
private Context context;
private int network = 0;
private Tracker mTracker;
private FirebaseAnalytics mFirebaseAnalytics;
private ChoosePhoto choosePhoto;
private boolean crop = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_request_an_item);
context = activity = this;
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
.setDefaultFontPath("fonts/gotham_book.ttf")
.setFontAttrId(R.attr.fontPath)
.build()
);
Helper.CheckMaintenance(this);
LogHelper.debug("[RequestAnItem2]");
// firebase analytic
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
// Obtain the shared Tracker instance.
AnalyticsApplication application = (AnalyticsApplication) getApplication();
mTracker = application.getDefaultTracker();
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
setTitle("");
// final Drawable back_arrow = getResources().getDrawable(R.drawable.ic_arrow_back_black_24dp);
final Drawable back_arrow = VectorDrawableCompat.create(getResources(), R.drawable.ic_arrow_back_black_24dp, null);
back_arrow.setColorFilter(getResources().getColor(R.color.colorbutton), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(back_arrow);
//toolbar_title = (TextView) findViewById(R.id.toolbar_title);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
userId = SavePreferences.getUserID(this);
submit = (RelativeLayout) findViewById(R.id.submit);
itemname = (EditText) findViewById(R.id.itemname);
itemdesc = (EditText) findViewById(R.id.itemdesc);
pricerange = (EditText) findViewById(R.id.pricerange);
tvitemname = (TextView) findViewById(R.id.tvitemname);
tvitemdesc = (TextView) findViewById(R.id.tvitemdesc);
tvpricerange = (TextView) findViewById(R.id.tvpricerange);
tvitemimage = (TextView) findViewById(R.id.tvitemimage);
toolbar_title = (TextView) findViewById(R.id.toolbar_title);
tvsubmit = (TextView) findViewById(R.id.textView4);
imghistory = (ImageView) findViewById(R.id.imghistory);
// if (SavePreferences.getApplanguage(RequestAnItem.this).equals("CN")) {
// tvitemname.setText("商品名称");
// tvitemdesc.setText("商品描述");
// tvpricerange.setText("价格范围");
// tvitemimage.setText("商品图像");
// toolbar_title.setText("请求商品");
// tvsubmit.setText("提交");
//
// }
imghistory.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(RequestAnItem2.this, RequestAnItemHistory.class));
}
});
submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (itemname.getText().toString().trim().length() == 0 || itemdesc.getText().toString().trim().length() == 0 || pricerange.getText().toString().trim().length() == 0) {
// if (SavePreferences.getApplanguage(RequestAnItem.this).equals("CN")) {
// Toast.makeText(RequestAnItem.this, "请填入所有空格", Toast.LENGTH_SHORT).show();
//
// } else {
Toast.makeText(RequestAnItem2.this, getString(R.string.please_fill_in_all_blanks), Toast.LENGTH_SHORT).show();
// }
} else if (base64.isEmpty()) {
// if (SavePreferences.getApplanguage(RequestAnItem.this).equals("CN")) {
// Toast.makeText(RequestAnItem.this, "请上传照片", Toast.LENGTH_SHORT).show();
// } else {
Toast.makeText(RequestAnItem2.this, R.string.please_upload_an_image, Toast.LENGTH_SHORT).show();
// }
} else {
String arg = getString(R.string.request_this_item_q);
String arg2 = getString(R.string.request_an_item);
String arg3 = getString(R.string.confirm);
String arg4 = getString(R.string.cancel);
fragment2 = new DialogFragmentUniversal();
fragment2 = DialogFragmentUniversal.newInstance(arg, arg2, arg3, arg4);
fragment2.mListener = RequestAnItem2.this;
fragment2.show(getFragmentManager(), "");
}
}
});
uploadimage_rl = findViewById(R.id.uploadimage_rl);
uploadimage = findViewById(R.id.uploadimage);
uploadimage_rl.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// String arg = getString(R.string.take_photo);
// String arg2 = getString(R.string.choose_photo);
// String arg3 = getString(R.string.cancel);
//// if (SavePreferences.getApplanguage(RequestAnItem.this).equals("CN")) {
//// arg = "拍照";
//// arg2 = "选择相片";
//// arg3 = "取消";
//// }
// fragment1 = DialogFragmentPhoto.newInstance(arg, arg2, arg3);
// fragment1.mListener = RequestAnItem2.this;
// fragment1.show(getFragmentManager(), "");
choosePhoto = new ChoosePhoto(RequestAnItem2.this);
}
});
checkAddrStatus();
}
@Override
protected void attachBaseContext(Context newBase) {
super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == ChoosePhoto.CHOOSE_PHOTO_INTENT) {
if (data != null && data.getData() != null) {
choosePhoto.handleGalleryResult(data);
// if (crop) {
// choosePhoto.handleGalleryResult(data);
// } else {
// LogHelper.debug("[onActivityResult] [data.getData()] " + data.getData().getPath());
// LogHelper.debug("[onActivityResult] [choosePhoto.getCameraUri()] " + choosePhoto.getCameraUri().getPath());
// Uri rotateuri = choosePhoto.rotateImage(choosePhoto.getCameraUri());
// setImageAfterCapture(rotateuri);
// }
} else {
if (crop) {
choosePhoto.handleCameraResult(choosePhoto.getCameraUri());
} else {
Uri rotateuri = choosePhoto.rotateImage(choosePhoto.getCameraUri());
setImageAfterCapture(rotateuri);
}
}
} else if (requestCode == ChoosePhoto.SELECTED_IMG_CROP) {
try {
Bitmap photo = MediaStore.Images.Media.getBitmap(getContentResolver(), choosePhoto.getCropImageUrl());
Bitmap bMapScaled;
bMapScaled = Bitmap.createScaledBitmap(photo, 200, 200, true);
base64 = BitmapToString(bMapScaled);
uploadimage.setImageURI(choosePhoto.getCropImageUrl());
// uploadavatar(profilepicbase64,userId);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "Some error occur", Toast.LENGTH_SHORT).show();
}
}
}
}
private void setImageAfterCapture(Uri uri) {
try {
LogHelper.debug("[Uri] path = " + uri.getPath());
Bitmap photo = MediaStore.Images.Media.getBitmap(getContentResolver(), uri);
Bitmap bMapScaled;
bMapScaled = Bitmap.createScaledBitmap(photo, 200, 200, true);
base64 = BitmapToString(bMapScaled);
uploadimage.setImageURI(uri);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, "Some error occur", Toast.LENGTH_SHORT).show();
}
}
@Override
public void setOnSubmitListener(String arg) {
// if (arg.equals(getString(R.string.take_photo))) {
// String[] PERMISSIONS = {Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_EXTERNAL_STORAGE,Manifest.permission.CAMERA};
// if (!hasPermissions(RequestAnItem2.this, PERMISSIONS)) {
// ActivityCompat.requestPermissions(RequestAnItem2.this, PERMISSIONS, REQUEST_CAMERA);
// } else {
// cameraIntent();
// }
// } else if (arg.equals(getString(R.string.choose_photo))) {
//
// String[] PERMISSIONS = {Manifest.permission.WRITE_EXTERNAL_STORAGE,Manifest.permission.READ_EXTERNAL_STORAGE } ;
// if (!hasPermissions(RequestAnItem2.this, PERMISSIONS)) {
// ActivityCompat.requestPermissions(RequestAnItem2.this, PERMISSIONS, SELECT_FILE);
// } else {
// selectImageFromGallery();
// }
// } else
if (arg.equals(getString(R.string.confirm))) {
requestanitem();
} else {
//fragment1.dismiss();
}
}
// public boolean hasPermissions(Context context, String... permissions) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && context != null && permissions != null) {
// for (String permission : permissions) {
// if (ActivityCompat.checkSelfPermission(context, permission) != PackageManager.PERMISSION_GRANTED) {
// Toast.makeText(context, R.string.permission_denied, Toast.LENGTH_SHORT).show();
// return false;
// }
// }
// }
// return true;
// }
// /**
// * Callback received when a permissions request has been completed.
// */
// @TargetApi(Build.VERSION_CODES.M)
// @Override
// public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
//
// switch (requestCode) {
// case REQUEST_CAMERA: {
// if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// // permissions granted.
// cameraIntent();
// } else {
// // no permissions granted.
// Toast.makeText(RequestAnItem2.this, R.string.permission_denied, Toast.LENGTH_SHORT).show();
// }
// return;
// }
// case SELECT_FILE: {
// if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// // permissions granted.
// selectImageFromGallery();
// } else {
// // no permissions granted.
// Toast.makeText(RequestAnItem2.this, R.string.permission_denied, Toast.LENGTH_SHORT).show();
// }
// return;
// }
//
// }
//
// }
private void checkAddrStatus() {
class getinfo extends AsyncTask<String, String, JSONObject> {
ACProgressFlower flowerDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
flowerDialog = new ACProgressFlower.Builder(RequestAnItem2.this)
.direction(ACProgressConstant.DIRECT_CLOCKWISE)
.themeColor(getResources().getColor(R.color.colorbutton))
.fadeColor(Color.GRAY).build();
if (!flowerDialog.isShowing()) {
flowerDialog.show();
}
}
@Override
protected void onPostExecute(JSONObject jsonObject) {
super.onPostExecute(jsonObject);
if (flowerDialog.isShowing()) {
flowerDialog.dismiss();
}
try {
if (jsonObject.getString("success").equals("0")) {
// Toast.makeText(context, jsonObject.getString("message"), Toast.LENGTH_SHORT).show();
// finish();
final Dialog dialog = new Dialog(activity);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setCancelable(false);
dialog.setContentView(R.layout.dialog_msg);
TextView text = (TextView) dialog.findViewById(R.id.msg);
text.setText("You haven't added your Default Shipping or Billing Address.");
Button dialogButton = (Button) dialog.findViewById(R.id.btn_dialog);
dialogButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(RequestAnItem2.this, MyAddressEdit.class));
finish();
dialog.dismiss();
}
});
ImageView close_btn = (ImageView) dialog.findViewById(R.id.close_btn);
close_btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
dialog.dismiss();
}
});
dialog.show();
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected JSONObject doInBackground(String... strings) {
return new urlLink().checkAddrStatusURL(SavePreferences.getUserID(RequestAnItem2.this), SavePreferences.getApplanguage(RequestAnItem2.this));
}
}
new getinfo().execute();
}
public void requestanitem() {
itemnamestr = itemname.getText().toString();
itemdescstr = itemdesc.getText().toString();
pricerangestr = pricerange.getText().toString();
class getinfo extends AsyncTask<String, String, JSONObject> {
ACProgressFlower flowerDialog;
@Override
protected void onPreExecute() {
super.onPreExecute();
flowerDialog = new ACProgressFlower.Builder(RequestAnItem2.this)
.direction(ACProgressConstant.DIRECT_CLOCKWISE)
.themeColor(getResources().getColor(R.color.colorbutton))
.fadeColor(Color.GRAY).build();
if (!flowerDialog.isShowing()) {
flowerDialog.show();
}
}
@Override
protected void onPostExecute(JSONObject jsonObject) {
super.onPostExecute(jsonObject);
if (flowerDialog.isShowing()) {
flowerDialog.dismiss();
}
try {
if (jsonObject.getString("success").equals("1")) {
// if (SavePreferences.getApplanguage(RequestAnItem.this).equals("CN")) {
// Toast.makeText(RequestAnItem.this, "您的请求已被提交", Toast.LENGTH_SHORT).show();
// } else {
Toast.makeText(RequestAnItem2.this, jsonObject.getString("message"), Toast.LENGTH_SHORT).show();
// }
finish();
} else {
// if (SavePreferences.getApplanguage(RequestAnItem.this).equals("CN")) {
// Toast.makeText(RequestAnItem.this, "无法提交您的请求", Toast.LENGTH_SHORT).show();
// } else {
Toast.makeText(RequestAnItem2.this, jsonObject.getString("message"), Toast.LENGTH_SHORT).show();
// }
}
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
protected JSONObject doInBackground(String... params) {
urlLink url = new urlLink();
return url.requestanitem(userId, itemnamestr, itemdescstr, pricerangestr, base64, SavePreferences.getApplanguage(RequestAnItem2.this));
}
}
getinfo ge = new getinfo();
ge.execute();
}
// private void selectImageFromGallery() {
// Intent intent = new Intent();
//// intent.setType("image/*");
//// intent.setAction(Intent.ACTION_GET_CONTENT);//
// intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
// startActivityForResult(Intent.createChooser(intent, "Select File"), SELECT_FILE);
// }
//
// private void cameraIntent() {
// Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
//
// File f = new File(Environment.getExternalStorageDirectory(), "temp.jpg");
//
// intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(f));
// startActivityForResult(intent, REQUEST_CAMERA);
// }
//
// @Override
// public void onActivityResult(int requestCode, int resultCode, Intent data) {
// super.onActivityResult(requestCode, resultCode, data);
//
// if (resultCode == Activity.RESULT_OK) {
// if (requestCode == SELECT_FILE)
// onSelectFromGalleryResult(data);
// else if (requestCode == REQUEST_CAMERA)
// onCaptureImageResult(data);
// }
// }
//
// private void onCaptureImageResult(Intent data) {
// File f = new File(Environment.getExternalStorageDirectory().toString());
// for (File temp : f.listFiles()) {
// if (temp.getName().equals("temp.jpg")) {
// f = temp;
// File photo = new File(Environment.getExternalStorageDirectory(), "temp.jpg");
// //pic = photo;
// break;
// }
// }
// try {
// Bitmap bitmap;
// bitmap = getCorrectlyOrientedImage(RequestAnItem2.this, Uri.fromFile(f), 600);
//
// base64 = BitmapToString(bitmap);
// uploadimage.setImageBitmap(bitmap);
//
// } catch (Exception e) {
//
// e.printStackTrace();
//
// }
//
//
// }
//
// @SuppressWarnings("deprecation")
// private void onSelectFromGalleryResult(Intent data) {
//
// Bitmap bm = null;
// Uri uri = data.getData();
// File imageFile = new File(getRealPathFromURI(uri));
// if (data != null) {
// //get orientation right by bitmap
// try {
// bm = getCorrectlyOrientedImage(RequestAnItem2.this, uri, 600);
// } catch (Exception e) {
// e.printStackTrace();
// }
//// //get base64/String for upload to server
//// pictureBase64 = BitmapToString(bm);
//// baseimgarray.add(pictureBase64);
//// Log.i("baseimagearray", baseimgarray.toString());
////
//// //get bitmap for display on phone
//// imgarray.add(bm);
//// // gvadapter.notifyDataSetChanged();
////
//// // uploadpic += 1;
// base64 = BitmapToString(bm);
// uploadimage.setImageBitmap(bm);
//
// }
// }
//
public String BitmapToString(Bitmap bitmap) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
//100是原本
bitmap.compress(Bitmap.CompressFormat.JPEG, 80, baos);
byte[] b = baos.toByteArray();
String temp = Base64.encodeToString(b, Base64.DEFAULT);
return temp;
} catch (NullPointerException e) {
return null;
} catch (OutOfMemoryError e) {
return null;
}
}
//
// public static int getOrientation(Context context, Uri photoUri) {
//
// Cursor cursor = context.getContentResolver().query(photoUri,
// new String[]{MediaStore.Images.ImageColumns.ORIENTATION}, null, null, null);
//
// if (cursor == null || cursor.getCount() != 1) {
// return 90; //Assuming it was taken portrait
// }
//
// cursor.moveToFirst();
// return cursor.getInt(0);
// }
//
// private String getRealPathFromURI(Uri contentURI) {
// String result;
// Cursor cursor = getContentResolver().query(contentURI, null, null, null, null);
// if (cursor == null) { // Source is Dropbox or other similar local file path
// result = contentURI.getPath();
// } else {
// cursor.moveToFirst();
// int idx = cursor.getColumnIndex(MediaStore.Images.ImageColumns.DATA);
// result = cursor.getString(idx);
// cursor.close();
// }
// return result;
// }
//
// /**
// * Rotates and shrinks as needed
// */
// public static Bitmap getCorrectlyOrientedImage(Context context, Uri photoUri, int maxWidth)
// throws IOException {
//
// InputStream is = context.getContentResolver().openInputStream(photoUri);
// BitmapFactory.Options dbo = new BitmapFactory.Options();
// dbo.inJustDecodeBounds = true;
// BitmapFactory.decodeStream(is, null, dbo);
// is.close();
//
//
// int rotatedWidth, rotatedHeight;
// int orientation = getOrientation(context, photoUri);
//
// if (orientation == 90 || orientation == 270) {
// Log.d("ImageUtil", "Will be rotated");
// rotatedWidth = dbo.outHeight;
// rotatedHeight = dbo.outWidth;
// } else {
// rotatedWidth = dbo.outWidth;
// rotatedHeight = dbo.outHeight;
// }
//
// Bitmap srcBitmap;
// is = context.getContentResolver().openInputStream(photoUri);
// Log.d("ImageUtil", String.format("rotatedWidth=%s, rotatedHeight=%s, maxWidth=%s",
// rotatedWidth, rotatedHeight, maxWidth));
// if (rotatedWidth > maxWidth || rotatedHeight > maxWidth) {
// float widthRatio = ((float) rotatedWidth) / ((float) maxWidth);
// float heightRatio = ((float) rotatedHeight) / ((float) maxWidth);
// float maxRatio = Math.max(widthRatio, heightRatio);
// Log.d("ImageUtil", String.format("Shrinking. maxRatio=%s",
// maxRatio));
//
// // Create the bitmap from file
// BitmapFactory.Options options = new BitmapFactory.Options();
// options.inSampleSize = (int) maxRatio;
// srcBitmap = BitmapFactory.decodeStream(is, null, options);
// } else {
// Log.d("ImageUtil", String.format("No need for Shrinking. maxRatio=%s",
// 1));
//
// srcBitmap = BitmapFactory.decodeStream(is);
// Log.d("ImageUtil", String.format("Decoded bitmap successful"));
// }
// is.close();
//
// /*
// * if the orientation is not 0 (or -1, which means we don't know), we
// * have to do a rotation.
// */
// if (orientation > 0) {
// Matrix matrix = new Matrix();
// matrix.postRotate(orientation);
//
// srcBitmap = Bitmap.createBitmap(srcBitmap, 0, 0, srcBitmap.getWidth(),
// srcBitmap.getHeight(), matrix, true);
// }
//
// return srcBitmap;
// }
@Override
protected void onStart() {
super.onStart();
networkStateReceiver = new NetworkStateReceiver();
networkStateReceiver.addListener((NetworkStateReceiver.NetworkStateReceiverListener) this);
this.registerReceiver(networkStateReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}
@Override
protected void onStop() {
super.onStop();
try {
this.unregisterReceiver(networkStateReceiver);
} catch (Exception e) {
//e.printStackTrace();
}
}
@Override
protected void onResume() {
super.onResume();
this.registerReceiver(networkStateReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
String pagename = "(Android) Request An Item";
mTracker.setScreenName(pagename);
mTracker.send(new HitBuilders.ScreenViewBuilder().build());
mFirebaseAnalytics.setCurrentScreen(this, pagename, null /* class override */);
}
@Override
public void networkAvailable() {
network = 1;
}
@Override
public void networkUnavailable() {
network = 0;
if (network == 0) {
new AlertDialog.Builder(context, R.style.AlertDialogTheme)
.setTitle(getString(R.string.no_network_notification))
.setCancelable(false)
.setPositiveButton(getString(R.string.try_again), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
if (isOnline() == false) {
networkUnavailable();
} else {
dialog.dismiss();
}
}
})
.setNegativeButton(getString(R.string.exit), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
((Activity) context).finish();
}
})
.show();
}
}
public boolean isOnline() {
try {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo().isConnectedOrConnecting();
} catch (Exception e) {
return false;
}
}
}
| [
"Fuckacikko93"
] | Fuckacikko93 |
e54cacc675950b1dbb419da37dafe7633bcfe110 | 530c516e35785da233381c7d1a92938433153687 | /jalog/jlog/gui/optiondialog/AbstractOptionsDialogBox.java | 93511d728b5027bb1bedc5ec7a39aa34fc7a69fd | [] | no_license | septantrionalis/jalog | 2ea511501087992174fa79023fc22a2ab3e52786 | 92c8c6fbe941e91a6017c5d860fa720f7ac8c595 | refs/heads/master | 2020-09-04T18:21:13.555497 | 2019-11-05T21:00:46 | 2019-11-05T21:00:46 | 219,848,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,185 | java | package jalog.jlog.gui.optiondialog;
import java.util.ArrayList;
import jalog.jlog.gui.common.GenericDialog;
import jalog.jlog.logbook.jlogentry.LogEntry;
import jalog.jlogimpl.gui.TableColumnEnum;
import javax.swing.JFrame;
/**
* An abstract class defining common methods for a generic dialog box.
*
* @author KC0ZPS
*/
public abstract class AbstractOptionsDialogBox extends GenericDialog {
/**
* Creates a new AbstractOptionsDialogBox.
*
* @param parent The parent frame.
* @param title The title of this dialog box.
* @param showWarningOnExit Set to true if this dialog should warn the user before closing.
*/
public AbstractOptionsDialogBox(JFrame parent, String title, boolean showWarningOnExit) {
super(parent, "Options", false);
}
/**
* Gets the DefaultLogEntry defined in the options dialog box.
*
* @return a DefaultLogEntry defined in the options dialog box.
*/
public abstract LogEntry getDefaultLogEntry() ;
/**
* Sets the default log entry.
*
* @param entry the default log entry.
*/
public abstract void setDefaultLogEntry(LogEntry entry) ;
/**
* Checks if the custom theme selection is checked.
*
* @return true if the custom theme selection is checked.
*/
public abstract boolean isCustomTheme() ;
/**
* Sets the custom theme checked value.
*
* @param value the custom theme checked value.
*/
public abstract void setIsCustomTheme(boolean value) ;
/**
* Checks if the theme will load a background for the frame.
*
* @return true if the theme will load a background for the frame.
*/
public abstract boolean isDesktopBackground() ;
/**
* Sets the load background flag.
*
* @param value the load background flag.
*/
public abstract void setIsDesktopBackground(boolean value) ;
/**
* Checks if the theme will load XTra ScrollBars.
*
* @return true if the theme will load XTra ScrollBars.
*/
public abstract boolean isXtraScrollbars() ;
/**
* Sets the XTra Scrollbars flag.
*
* @param value the XTra Scrollbars flag.
*/
public abstract void setIsXtraScrollbars(boolean value) ;
/**
* Returns the selected theme.
*
* @return the selected theme.
*/
public abstract String getSelectedTheme() ;
/**
* Sets the selected theme.
*
* @param theme the theme to selected.
*/
public abstract void setSelectedTheme(String theme) ;
/**
* Cleans up this dialog box.
*/
public abstract void cleanup() ;
/**
* Tests if the ok button was pressed.
*
* @return true if ok was pressed.
*/
public abstract boolean okPressed() ;
/**
* Gets the column list that the user wants to display.
*
* @return the column list that the user wants to display.
*/
public abstract ArrayList<TableColumnEnum> getColumnList() ;
/**
* Adds a column to the column array.
*
* @param tableColumnEnum The column enumeration to add.
*/
public abstract void addColumn(TableColumnEnum tableColumnEnum) ;
}
| [
"[email protected]"
] | |
51cad3ba61cc69a9488f2a2fa85d2a0c82fb5e0d | 193880d3be2b0b1b03eae971c0465747bcf31a85 | /app/src/main/java/com/example/raniamofeed/project_androidfci/utility/Utils.java | 32f6356e3f4bb4a06931eec28bc9fcd2551f3ed4 | [] | no_license | MostafaAnter/Project_androidFCI | 42cdac6adab3a4a597c5e1a51b28b60947bdebc3 | 412c2bdbfa27e5ba610ca96396c31681ed3807f8 | refs/heads/master | 2020-03-18T14:40:24.990348 | 2018-05-31T15:30:30 | 2018-05-31T15:30:34 | 134,860,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 445 | java | package com.example.raniamofeed.project_androidfci.utility;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Utils {
public static boolean isEmailValid(String email) {
String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(email);
return matcher.matches();
}
}
| [
"[email protected]"
] | |
fa5f573b6307eb3a8eeb0cc427a547a02d70a70c | d1a6d1e511df6db8d8dd0912526e3875c7e1797d | /genny_JavaWithoutLambdas/applicationModule/src/main/java/applicationModulepackageJava11/Foo921.java | 3dae3c3392c0f50c7b618fcf4b4295381c22f324 | [] | no_license | NikitaKozlov/generated-project-for-desugaring | 0bc1443ab3ddc84cd289331c726761585766aea7 | 81506b3711004185070ca4bb9a93482b70011d36 | refs/heads/master | 2020-03-20T00:35:06.996525 | 2018-06-12T09:30:37 | 2018-06-12T09:30:37 | 137,049,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package applicationModulepackageJava11;
public class Foo921 {
public void foo0() {
new applicationModulepackageJava11.Foo920().foo5();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
}
| [
"[email protected]"
] | |
c8f9cf4c9a346ec9253790f3694408e9b04a6146 | 1513433d877144b8dfe1bb337f2fae78fed010e7 | /taotao-manager/taotao-manager-service/src/main/java/com/taotao/service/UPloadPicture.java | 883011b44bff984f61bcf997adb4a2b16a5db1e5 | [] | no_license | lixiang0103/Shop | 8ef0dfd5353ad917acba06a455531b937cd38f1f | 5939787d7ceb7fcaffa572350ff970ee45acf8d6 | refs/heads/master | 2020-04-15T15:31:08.774673 | 2019-01-19T09:30:01 | 2019-01-19T09:30:01 | 164,796,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package com.taotao.service;
import java.awt.MultipleGradientPaint;
import java.io.IOException;
import org.springframework.web.multipart.MultipartFile;
public interface UPloadPicture {
//上传文件到指定目录
public abstract String uploadFile(MultipartFile file,String filePath) throws IOException;
}
| [
"[email protected]"
] | |
22d7d133a8b6679533b40e56761ee4f6f9a5d49b | 8d6095498a17a80679c79f8721ef65be9bf838a3 | /android_new/app/src/main/java/com/kii/tutk/Logging.java | abe6429a36e99e4ee9d3bdc2d4b2b87967c5d0a2 | [] | no_license | xdutaotao/Demo | 12e1ff3260f6e422b524b41fc43a2dbfe028f366 | 9644d0b0ecbd4e082ca44f628023de73b5862142 | refs/heads/master | 2020-03-14T03:43:09.473227 | 2018-04-28T07:17:39 | 2018-04-28T07:17:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package com.kii.tutk;
import android.util.Log;
/**
* Created by Evan on 15/12/23.
*/
public class Logging {
public static void d(String TAG, String msg) {
Log.d(TAG, msg);
}
public static void e(String TAG, String msg) {
Log.e(TAG, msg);
}
public static void w(String TAG, String msg) {
Log.w(TAG, msg);
}
}
| [
"[email protected]"
] | |
40b82dac85504b633d2ddd599a6bf1519c38d06a | 4d6e6a8e5605c4ecb0a92762b8504bb2edf77b47 | /DataStructures-Algo-master/searching/SearchInANearlySortedArray.java | e6e2d74da22e2c5072d11f4fcec418747873a758 | [] | no_license | sankalpchauhan-me/InterviewPrep | aa1e81f45121dd1a5476c968e877b921f1bf9311 | 531acf86b8c1851bcb3a195c1917c63557ef3e5b | refs/heads/master | 2022-04-07T14:50:23.236024 | 2020-03-14T15:38:09 | 2020-03-14T15:38:09 | 240,069,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,715 | java | package searching;
//https://www.techiedelight.com/search-nearly-sorted-array-ologn-time/
//https://www.youtube.com/watch?v=xWOoBJUqlbI
//O(logn)
public class SearchInANearlySortedArray {
// Function to search an element x in nearly sorted array A
public static int searchElement(int[] A, int x) {
// search space is A[left..right]
int left = 0;
int right = A.length - 1;
// run till search space is exhausted
while (left <= right) {
// find middle index mid and compare A[mid - 1], A[mid]
// and A[mid + 1] with the key number
int mid = (left + right) / 2;
// return mid if middle element is equal to key number
if (A[mid] == x) {
return mid;
}
// return mid-1 if A[mid - 1] is equal to key number
else if (mid - 1 >= left && A[mid - 1] == x) {
return mid - 1;
}
// return mid+1 if A[mid + 1] is equal to key number
else if (mid + 1 <= right && A[mid + 1] == x) {
return mid + 1;
}
// if middle element is less than the key number,
// reduce search space to right subarray A[mid+2..right]
else if (x > A[mid]) {
left = mid + 2;
}
// if middle element is greater than the key number, reduce
// search space to right subarray A[left..mid-2]
else {
right = mid - 2;
}
}
// invalid input or number not present in the array
return -1;
}
public static void main(String[] args) {
int[] A = { 2, 1, 3, 5, 4, 7, 6, 8, 9 };
int key = 5;
int index = searchElement(A, key);
if (index != -1) {
System.out.println("Element " + key + " found at index " + index);
} else {
System.out.println("Element not found in the array");
}
}
}
| [
"[email protected]"
] | |
424ea761b149bf50246da23eca869284d47e1e79 | c62864ff0fdc24bb2493c0a892204810ac2b8ce2 | /app/src/main/java/it/museomobile/BarcodeGraphicTracker.java | bdb8758a41caf6228b27832339333f74f92ea605 | [] | no_license | giovannidefilippi/MuseoMobile | 3408308e63980c5a2f573471752946ec18dd8221 | 410bb8383dff38b80d8d1d977c2c8e26ec741235 | refs/heads/master | 2021-08-29T02:53:41.871015 | 2018-01-04T11:01:59 | 2018-01-04T11:01:59 | 109,968,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,226 | java | /*
* Copyright (C) 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 it.museomobile;
import android.content.Context;
import android.support.annotation.UiThread;
import com.google.android.gms.vision.*;
import com.google.android.gms.vision.barcode.Barcode;
import it.museomobile.ui.camera.GraphicOverlay;
/**
* Generic tracker which is used for tracking or reading a barcode (and can really be used for
* any type of item). This is used to receive newly detected items, add a graphical representation
* to an overlay, update the graphics as the item changes, and remove the graphics when the item
* goes away.
*/
public class BarcodeGraphicTracker extends Tracker<Barcode> {
private GraphicOverlay<BarcodeGraphic> mOverlay;
private BarcodeGraphic mGraphic;
private BarcodeUpdateListener mBarcodeUpdateListener;
/**
* Consume the item instance detected from an Activity or Fragment level by implementing the
* BarcodeUpdateListener interface method onBarcodeDetected.
*/
public interface BarcodeUpdateListener {
@UiThread
void onBarcodeDetected(Barcode barcode);
}
BarcodeGraphicTracker(GraphicOverlay<BarcodeGraphic> mOverlay, BarcodeGraphic mGraphic,
Context context) {
this.mOverlay = mOverlay;
this.mGraphic = mGraphic;
if (context instanceof BarcodeUpdateListener) {
this.mBarcodeUpdateListener = (BarcodeUpdateListener) context;
} else {
throw new RuntimeException("Hosting activity must implement BarcodeUpdateListener");
}
}
/**
* Start tracking the detected item instance within the item overlay.
*/
@Override
public void onNewItem(int id, Barcode item) {
mGraphic.setId(id);
mBarcodeUpdateListener.onBarcodeDetected(item);
}
/**
* Update the position/characteristics of the item within the overlay.
*/
@Override
public void onUpdate(Detector.Detections<Barcode> detectionResults, Barcode item) {
mOverlay.add(mGraphic);
mGraphic.updateItem(item);
}
/**
* Hide the graphic when the corresponding object was not detected. This can happen for
* intermediate frames temporarily, for example if the object was momentarily blocked from
* view.
*/
@Override
public void onMissing(Detector.Detections<Barcode> detectionResults) {
mOverlay.remove(mGraphic);
}
/**
* Called when the item is assumed to be gone for good. Remove the graphic annotation from
* the overlay.
*/
@Override
public void onDone() {
mOverlay.remove(mGraphic);
}
}
| [
"[email protected]"
] | |
ae68265a2672cbf55af3fb0714293170f0aba825 | f66ecfbc89d99479886c1eb60518dab597bd854f | /android_app/app/src/main/java/me/memory7734/moving/viewitem/LineCardView.java | 3c63e61f972052f547840726d0c16c2db4ed7f11 | [] | no_license | memory7734/Moving | 7de59217eacb225ee1c1a99e46cd235ef620d8c9 | 169522a7bacb8f787495af5a5c03de9926d58f7d | refs/heads/master | 2020-05-27T21:13:21.097665 | 2017-09-19T10:58:21 | 2017-09-19T10:58:21 | 83,618,607 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,129 | java | package me.memory7734.moving.viewitem;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.support.v7.widget.CardView;
import android.view.View;
import android.widget.TextView;
import com.db.chart.Tools;
import com.db.chart.model.LineSet;
import com.db.chart.view.AxisController;
import com.db.chart.view.LineChartView;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import me.memory7734.moving.R;
import me.memory7734.moving.bean.HealthItem;
/**
* Created by Elijah on 16/10/25.
*/
public class LineCardView implements LineCardContract.View {
// private LineCardContract.Presenter presenter;
private final LineChartView chart;
private final CardView card;
private SharedPreferences sharedPreferences;
HealthItem mHealthItem;
public LineCardView(CardView card) {
sharedPreferences = card.getContext().getSharedPreferences("system_settings", Context.MODE_PRIVATE);
this.chart = (LineChartView) card.findViewById(R.id.chart);
this.card = card;
}
@Override
public void initData() {
// Data
LineSet dataset = new LineSet(initLables(), mHealthItem.getValues());
dataset.setColor(Color.parseColor("#0581F5")) //线的颜色
.setFill(Color.parseColor("#98CBFB")) //阴影色
.setDotsColor(Color.parseColor("#f1c40f")) //点色
.setThickness(4);
chart.addData(dataset);
}
@Override
public void showView(HealthItem healthItem) {
this.mHealthItem = healthItem;
initViews(card);
initData();
chart.show();
}
@Override
public void refreshView(HealthItem healthItem) {
this.mHealthItem = healthItem;
initData();
chart.show();
}
@Override
public void initViews(View view) {
TextView chartTitle = (TextView) card.findViewById(R.id.chart_title); //图表的标题
TextView chartAverage = (TextView) card.findViewById(R.id.chart_average); //图表的平均值
TextView chartToday = (TextView) card.findViewById(R.id.chart_today); //图表的今天值
TextView chartMost = (TextView) card.findViewById(R.id.chart_most); //图表的最大值
float[] values = mHealthItem.getValues();
chartAverage.setText(card.getContext().getString(R.string.chart_average) +
getAverage(values) +
mHealthItem.getDataTypeMeasuringUnit());
chartToday.setText(card.getContext().getString(R.string.chart_today) + values[values.length - 1] + mHealthItem.getDataTypeMeasuringUnit());
chartTitle.setText(mHealthItem.getDataTypeName());
chartMost.setText("" + getUpperLimit(values));
// Chart
chart.setBorderSpacing(Tools.fromDpToPx(15))
.setAxisBorderValues(0, (int) getUpperLimit(values))
.setYLabels(AxisController.LabelPosition.NONE)
.setLabelsColor(Color.parseColor("#666565")) //标签色
.setXAxis(false)
.setYAxis(false);
}
@Override
public void setPresenter(LineCardContract.Presenter presenter) {
if (presenter == null) {
// this.presenter = presenter;
}
}
public float getAverage(float[] values) {
float sum = 0;
for (float value : values) {
sum += value;
}
BigDecimal b = new BigDecimal(sum / values.length);
return b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
}
public float getUpperLimit(float[] values) {
float maxmium = values[0];
for (float value : values) {
if (value > maxmium) {
maxmium = value;
}
}
if (maxmium < 0) return 0;
else if (maxmium < 1) return 1;
else if (maxmium<5) return 5;
else if (maxmium<10) return 10;
else {
String s = String.valueOf((int) maxmium);
if (Integer.parseInt(s.substring(1, 2)) <= 5) {
float f = Integer.parseInt(s.substring(0, 1)) * 10 + 5;
for (int i = 0; i < s.length() - 2; i++) {
f *= 10;
}
return f;
} else {
float f = (Integer.parseInt(s.substring(0, 1)) + 1);
for (int i = 0; i < s.length() - 1; i++) {
f *= 10;
}
return f;
}
}
}
public String[] initLables() {
return (sharedPreferences.getInt("time_of_show_datas", 7) == 7) ? initLablesAsWeek() : initLablesAsMonth();
}
public String[] initLablesAsWeek() {
List<String> labelsList = new ArrayList<>();
Calendar currentDate = Calendar.getInstance();
Calendar previousDate = Calendar.getInstance();
previousDate.add(Calendar.DATE, -6);
if (previousDate.get(Calendar.MONTH) == currentDate.get(Calendar.MONTH)) { //所有日期全部在一个月内
labelsList.add((previousDate.get(Calendar.MONTH) + 1) + "月" + previousDate.get(Calendar.DAY_OF_MONTH) + "日");
for (int i = previousDate.get(Calendar.DAY_OF_MONTH) + 1; i <= currentDate.get(Calendar.DAY_OF_MONTH); i++) {
labelsList.add("" + i );
}
} else { //日期不在一个月内
for (int i = previousDate.get(Calendar.DAY_OF_MONTH); i <= previousDate.getActualMaximum(Calendar.DAY_OF_MONTH); i++) {
labelsList.add("" + i);
}
labelsList.add((currentDate.get(Calendar.MONTH) + 1) + "月1日");
for (int i = 2; i <= currentDate.get(Calendar.DAY_OF_MONTH); i++) {
labelsList.add("" + i);
}
}
String[] strings = new String[labelsList.size()];
labelsList.toArray(strings);
return strings;
}
public String[] initLablesAsMonth() {
List<String> labelsList = new ArrayList<>();
Calendar currentDate = Calendar.getInstance();
Calendar previousDate = (Calendar) currentDate.clone();
previousDate.add(Calendar.DATE, -28);
if (previousDate.get(Calendar.MONTH) == currentDate.get(Calendar.MONTH)) { //所有日期全部在一个月内
labelsList.add((previousDate.get(Calendar.MONTH) + 1) + "月" + previousDate.get(Calendar.DAY_OF_MONTH) + "日");
int position = 7;
while (position <= 28) {
for (int i = 0; i < 6; i++) {
labelsList.add("");
}
previousDate.add(Calendar.DATE, 7);
labelsList.add("" + previousDate.get(Calendar.DAY_OF_MONTH));
position += 7;
}
} else { //日期不在一个月内
labelsList.add("" + previousDate.get(Calendar.DAY_OF_MONTH));
Calendar beforeDate = (Calendar) currentDate.clone();
Calendar afterDate = (Calendar) currentDate.clone();
beforeDate.add(Calendar.DATE, -28);
afterDate.add(Calendar.DATE, -21);
while (beforeDate.before(currentDate)) {
for (int i = 0; i < 6; i++) {
labelsList.add("");
}
if (beforeDate.get(Calendar.DAY_OF_MONTH) > afterDate.get(Calendar.DAY_OF_MONTH)) {
labelsList.add((afterDate.get(Calendar.MONTH) + 1) + "月" + afterDate.get(Calendar.DAY_OF_MONTH) + "日");
} else {
labelsList.add("" + afterDate.get(Calendar.DAY_OF_MONTH));
}
beforeDate = (Calendar) afterDate.clone();
afterDate.add(Calendar.DATE, 7);
}
}
String[] strings = new String[labelsList.size()];
labelsList.toArray(strings);
return strings;
}
}
| [
"[email protected]"
] | |
b5f6e75a1ebe4111100005bb4cd9bdf646f0bbf6 | 96e979ae4ea0497622f56c2c3f671abb081e9d46 | /tests/generics/wildcard_10p/Test.java | 67072bfaeaa932e05eb79f7b8f745c179d4b5a61 | [
"BSD-3-Clause"
] | permissive | ExtendJ/Regression-Tests | a8e588c452bea830a838514cc307e54c2abd3a4f | 2cae0e2f444a78857980224f9c216edb6a29ece2 | refs/heads/master | 2021-05-04T01:09:08.662395 | 2018-12-21T09:56:26 | 2018-12-21T09:56:57 | 71,147,163 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | // https://bitbucket.org/extendj/extendj/issues/259/method-applicability-error-for-generic
// .result: COMPILE_PASS
public class Test {
void add(Container<? super X> xs) {
xs.add(new Y());
}
static class X { }
static class Y extends X { }
}
interface Container<T> {
void add(T t);
}
| [
"[email protected]"
] | |
01eac041decf38ce11a54aed242fa50cfad4e099 | 32fb249ac141e317d5751a15d4e2fcbb1bf99b3f | /src/main/java/com/neeraj/reactivex/rxjava/operators/FlatMap.java | bb7288a127cf8131d697ff2883797e06e8dc7a8e | [] | no_license | neerajjain92/reactive-programming | bad9f3576bd4820ee989856033bdde7f3fce1dde | f2d073e9dd18acbf48fd1e12dbc7f7a8ac90a6b1 | refs/heads/main | 2023-03-09T20:26:10.951395 | 2021-02-21T20:02:19 | 2021-02-21T20:02:19 | 338,446,743 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 930 | java | package com.neeraj.reactivex.rxjava.operators;
import io.reactivex.Observable;
/**
* @author neeraj on 22/02/21
* Copyright (c) 2019, reactive-programming.
* All rights reserved.
*/
public class FlatMap {
public static void main(String[] args) {
flatMap();
flatMapBiFunction();
}
private static void flatMap() {
Observable<String> observable = Observable.just("foo", "bar", "jam");
observable.flatMap(
item -> item.equals("bar") ? Observable.just(item) : Observable.fromArray(item.split("")))
.subscribe(System.out::println);
}
private static void flatMapBiFunction() {
Observable<String> observable = Observable.just("foo", "bar", "jam");
observable.flatMap(item -> Observable.fromArray(item.split("")),
(actual, second) -> actual + " " + second)
.subscribe(System.out::println);
}
}
| [
"[email protected]"
] | |
9285df11c387a17486a66458fb7da3383f46f5b5 | 7da2f0d4d8b84dc29f8273f7c3b5d97d4549cb84 | /src/Week5Homework/spacedLogger.java | dd772158fb18909523ffdc5e410e914cdfe20eb6 | [] | no_license | csgarza1984/BESD-Week5 | 304f43966a41b04f87c4a39c93f65700d7223ccb | 33c02de53343bd608d17bcb88198532fed42ca8a | refs/heads/main | 2023-05-15T06:16:00.803671 | 2021-06-09T04:14:39 | 2021-06-09T04:14:39 | 363,477,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 837 | java | package Week5Homework;
public class spacedLogger implements Logger {
@Override
public void log(String log) {
//print the string with spaces added between each character
StringBuilder spacedOut = new StringBuilder("");
for (int index = 0; index < log.length(); index++) {
spacedOut.append(log.charAt(index) + " ");
}
//Remove space at end
System.out.println(spacedOut.substring(0, spacedOut.length()-1));
}
@Override
public void error(String error) {
//print the string after the word "Error" with spaces added between each character
StringBuilder spacedOutError = new StringBuilder("");
for (int index = 0; index < error.length(); index++) {
spacedOutError.append(error.charAt(index) + " ");
}
System.out.println("Error: " + spacedOutError.substring(0, spacedOutError.length()-1));
}
}
| [
"[email protected]"
] | |
1ef2d83fcc286de2fa995c025a02ac1c261d81c9 | 5c3675a683f0eadb036046e3080746e0cce81be4 | /src/main/java/com/mpango/core/model/COAAccountType.java | c1a90c39b20eb64c8be066baf5706b48414649ec | [] | no_license | mulutu/mpangoFarm | acfdb7f73bfacc41cff8fe636cd053db94245137 | 963213a125e8dbf2ca19f1030b1d663d696e987b | refs/heads/master | 2020-04-02T05:48:10.250951 | 2018-12-31T05:39:39 | 2018-12-31T05:39:39 | 152,695,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package com.mpango.core.model;
public class COAAccountType {
private int id;
private String AccountTypeName;
private String AccountTypeCode;
private int AccountGroupTypeId;
public COAAccountType() {
id = 0;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getAccountTypeName() {
return AccountTypeName;
}
public void setAccountTypeName(String accountTypeName) {
AccountTypeName = accountTypeName;
}
public String getAccountTypeCode() {
return AccountTypeCode;
}
public void setAccountTypeCode(String accountTypeCode) {
AccountTypeCode = accountTypeCode;
}
public int getAccountGroupTypeId() {
return AccountGroupTypeId;
}
public void setAccountGroupTypeId(int accountGroupTypeId) {
AccountGroupTypeId = accountGroupTypeId;
}
}
| [
"[email protected]"
] | |
62c4eb7ca855d39f098ab8b1866b07beea1c8790 | a79a01064db3764666539a746392aaba4a8c8804 | /strategy-pattern/src/test/java/example1/simuduck/duck/DuckTest.java | 1117ea3b8349e4a5fc93ab21615e69034f50e08c | [
"Apache-2.0"
] | permissive | shambhand/demystifying-design-patterns | 78a779f359f3ab20181991085d789e6de16a3abc | d570964a82421ce486a37ece2c5524af0c29c86c | refs/heads/master | 2022-01-21T20:06:26.804689 | 2019-08-17T21:55:30 | 2019-08-17T21:55:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package example1.simuduck.duck;
import example1.simuduck.fly.FlyRocketPowered;
import org.junit.Test;
import static org.junit.Assert.*;
public class DuckTest {
@Test
public void testRedheadDuck() {
Duck redhead = new RedheadDuck();
redhead.display();
redhead.performFly();
redhead.setFlyBehavior(new FlyRocketPowered());
redhead.performFly();
redhead.performQuack();
}
} | [
"[email protected]"
] | |
a99376cbde6c3b7ff9ea23b6d3c908e6177fe033 | 40fdb479cacb287fe52b563ce694e340eb44f8eb | /FtcRobotController/src/main/java/org/firstinspires/ftc/robotcontroller/external/samples/PushbotTeleopTank_Iterative.java | b23f75f988f16a84d8f0a7df3142e35eb3c6c935 | [] | no_license | Starnox/FTC-Bionic-Royals | f2565f9a9c94ecd81aa43dcb3fe9480d9741fd20 | 5c0da8b7f6299810bd8b7a9577fdbf4594d057f5 | refs/heads/master | 2021-07-11T17:54:28.384558 | 2021-04-20T08:03:25 | 2021-04-20T08:03:25 | 122,740,917 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,475 | java | /* Copyright (c) 2017 FIRST. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted (subject to the limitations in the disclaimer below) provided that
* the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list
* of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice, this
* list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* Neither the name of FIRST nor the names of its contributors may be used to endorse or
* promote products derived from this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*package org.firstinspires.ftc.robotcontroller.external.samples;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.util.Range;
/**
* This file provides basic Telop driving for a Pushbot robot.
* The code is structured as an Iterative OpMode
*
* This OpMode uses the common Pushbot hardware class to define the devices on the robot.
* All device access is managed through the HardwarePushbot class.
*
* This particular OpMode executes a basic Tank Drive Teleop for a PushBot
* It raises and lowers the claw using the Gampad Y and A buttons respectively.
* It also opens and closes the claws slowly using the left and right Bumper buttons.
*
* Use Android Studios to Copy this Class, and Paste it into your team's code folder with a new name.
* Remove or comment out the @Disabled line to add this opmode to the Driver Station OpMode list
*/
/*@TeleOp(name="Pushbot: Teleop Tank", group="Pushbot")
@Disabled
public class PushbotTeleopTank_Iterative extends OpMode{
/* Declare OpMode members. */
/*HardwarePushbot robot = new HardwarePushbot(); // use the class created to define a Pushbot's hardware
// could also use HardwarePushbotMatrix class.
double clawOffset = 0.0 ; // Servo mid position
final double CLAW_SPEED = 0.02 ; // sets rate to move servo
/*
* Code to run ONCE when the driver hits INIT
*/
/*@Override
public void init() {
/* Initialize the hardware variables.
* The init() method of the hardware class does all the work here
*/
/*robot.init(hardwareMap);
// Send telemetry message to signify robot waiting;
telemetry.addData("Say", "Hello Driver"); //
}
/*
* Code to run REPEATEDLY after the driver hits INIT, but before they hit PLAY
*/
/*@Override
public void init_loop() {
}
/*
* Code to run ONCE when the driver hits PLAY
*/
/*@Override
public void start() {
}
/*
* Code to run REPEATEDLY after the driver hits PLAY but before they hit STOP
*/
/*@Override
public void loop() {
double left;
double right;
// Run wheels in tank mode (note: The joystick goes negative when pushed forwards, so negate it)
left = -gamepad1.left_stick_y;
right = -gamepad1.right_stick_y;
robot.leftDrive.setPower(left);
robot.rightDrive.setPower(right);
// Use gamepad left & right Bumpers to open and close the claw
if (gamepad1.right_bumper)
clawOffset += CLAW_SPEED;
else if (gamepad1.left_bumper)
clawOffset -= CLAW_SPEED;
// Move both servos to new position. Assume servos are mirror image of each other.
clawOffset = Range.clip(clawOffset, -0.5, 0.5);
robot.leftClaw.setPosition(robot.MID_SERVO + clawOffset);
robot.rightClaw.setPosition(robot.MID_SERVO - clawOffset);
// Use gamepad buttons to move the arm up (Y) and down (A)
if (gamepad1.y)
robot.leftArm.setPower(robot.ARM_UP_POWER);
else if (gamepad1.a)
robot.leftArm.setPower(robot.ARM_DOWN_POWER);
else
robot.leftArm.setPower(0.0);
// Send telemetry message to signify robot running;
telemetry.addData("claw", "Offset = %.2f", clawOffset);
telemetry.addData("left", "%.2f", left);
telemetry.addData("right", "%.2f", right);
}
/*
* Code to run ONCE after the driver hits STOP
*/
/*@Override
public void stop() {
}
}
*/ | [
"[email protected]"
] | |
6db71ae1d2e535e2972aed120306c38f54429acf | 9dee9dddaef39d6fde617756c1638afc678fd19f | /ch04/wxapp/src/com/xiaogang/app/servlet/WxUploadFileServlet.java | 13dadf20671c9eca4d1bc564c62e3e17d41c528d | [] | no_license | kongxiangyue/minipro_pic | e5b4d32e79f60a0e1ba966ebf4f823583b315fcc | 8c50e7fed7967e4b1a094204c60e86329fa148b4 | refs/heads/master | 2020-12-22T02:01:12.440966 | 2020-05-20T06:15:40 | 2020-05-20T06:15:40 | 236,636,899 | 3 | 0 | null | null | null | null | GB18030 | Java | false | false | 2,299 | java | package com.xiaogang.app.servlet;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
/**
*
* @ClassName: WxUploadFileServlet
* @Description: 用于接收微信小程序上传的图片
* @author LG
* @date 2016年12月5日 下午1:30:14
*
*/
public class WxUploadFileServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public WxUploadFileServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
DiskFileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setHeaderEncoding("UTF-8");
List items = upload.parseRequest(request);
Map param = new HashMap();
for(Object object:items){
FileItem fileItem = (FileItem) object;
if (fileItem.isFormField()) {
param.put(fileItem.getFieldName(), fileItem.getString("utf-8"));//如果你页面编码是utf-8的
}else{
if("file".equals(fileItem.getFieldName())){
String fileName = fileItem.getName();
InputStream is = fileItem.getInputStream();
//创建img文件夹
new File("E:/img/").mkdir();
File file = new File("E:/img/",fileName);
file.createNewFile();
FileOutputStream fos = new FileOutputStream(file);
byte[] b = new byte[1024];
while((is.read(b)) != -1){
fos.write(b);
}
is.close();
fos.close();
}
}
}
System.out.println(param);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
2b7fca457f4427b2986ae965ada1dd9839f02a97 | 684f50dd1ae58a766ce441d460214a4f7e693101 | /sz-yld/console/src/main/java/com/dimeng/p2p/console/servlets/account/vipmanage/grxx/CcxxView.java | e6f956ad5dc113ee9aadf825fa49225c7d97dcf9 | [] | no_license | wang-shun/rainiee-core | a0361255e3957dd58f653ae922088219738e0d25 | 80a96b2ed36e3460282e9e21d4f031cfbd198e69 | refs/heads/master | 2020-03-29T16:40:18.372561 | 2018-09-22T10:05:17 | 2018-09-22T10:05:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,597 | java | /*
* 文 件 名: CcxxView.java
* 版 权: 深圳市迪蒙网络科技有限公司
* 描 述: <描述>
* 修 改 人: zhoucl
* 修改时间: 2015年11月10日
*/
package com.dimeng.p2p.console.servlets.account.vipmanage.grxx;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.dimeng.framework.http.servlet.annotation.Right;
import com.dimeng.framework.service.ServiceSession;
import com.dimeng.framework.service.query.Paging;
import com.dimeng.framework.service.query.PagingResult;
import com.dimeng.p2p.S61.entities.T6113;
import com.dimeng.p2p.console.servlets.account.AbstractAccountServlet;
import com.dimeng.p2p.modules.account.console.service.GrManage;
import com.dimeng.p2p.modules.account.console.service.entity.BasicInfo;
import com.dimeng.util.parser.IntegerParser;
/**
* <车产信息>
* <功能详细描述>
*
* @author zhoucl
* @version [版本号, 2015年11月10日]
*/
@Right(id = "P2P_C_ACCOUNT_GRVIEW", name ="查看",moduleId ="P2P_C_ACCOUNT_GRXX",order=1)
public class CcxxView extends AbstractAccountServlet
{
/**
* 注释内容
*/
private static final long serialVersionUID = -4320724456559535001L;
@Override
protected void processGet(HttpServletRequest request, HttpServletResponse response, ServiceSession serviceSession)
throws Throwable
{
processPost(request, response, serviceSession);
}
@Override
protected void processPost(final HttpServletRequest request, HttpServletResponse response,
ServiceSession serviceSession)
throws Throwable
{
GrManage manage = serviceSession.getService(GrManage.class);
int userId = IntegerParser.parse(request.getParameter("userId"));
BasicInfo basicInfo = manage.findBasicInfo(userId);
if (basicInfo == null)
{
response.sendError(HttpServletResponse.SC_NOT_FOUND);
return;
}
Paging paging = new Paging()
{
@Override
public int getSize()
{
return 10;
}
@Override
public int getCurrentPage()
{
return IntegerParser.parse(request.getParameter(PAGING_CURRENT));
}
};
PagingResult<T6113> resultCcxx = manage.seachCcxx(paging, userId);
request.setAttribute("basicInfo", basicInfo);
request.setAttribute("resultCcxx", resultCcxx);
forwardView(request, response, getClass());
}
}
| [
"[email protected]"
] | |
0f8f1b54a7e8efee492c3a48dc8292c1f6761ffc | 71d752d9211d8f7cd8b0fe0722e7bfba9724d716 | /app/src/androidTest/java/com/xiaoma/rxcache/ExampleInstrumentedTest.java | 483ebdd6b4b9edae596df34813e404a410478dd7 | [] | no_license | artshell/RxCache | 9b3874fee6b06fa57c8122f431fb340f916fe3da | 6da7695441fe815604c96b4869fdafd450d21e83 | refs/heads/master | 2020-03-23T11:59:52.014890 | 2018-07-19T05:31:04 | 2018-07-19T05:31:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 737 | java | package com.xiaoma.rxcache;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.xiaoma.rxcache", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
ec79346bc6cafc4b77cc5de0fa666d4eb2ffc707 | 0a6671c5f9f4a59d66f7df2d71b8830a2d755a30 | /Ascending-or-Decending-Sorting/Ascending-or-Descending-Sorting.java | 83d87df8a3b431407c512c259f3398aa663d180e | [
"MIT"
] | permissive | whynesspower/Number-Theory | 712395ff4bcd7ca89b1a0ed5b59298b9370c5e8d | 7b52b4a18bae336b79c2747e9d11ba22ff7a2cca | refs/heads/main | 2023-08-30T09:50:54.223472 | 2021-10-06T07:07:19 | 2021-10-06T07:07:19 | 413,688,319 | 0 | 0 | MIT | 2021-10-05T05:39:59 | 2021-10-05T05:39:59 | null | UTF-8 | Java | false | false | 1,104 | java | /* This program is to check if the given array is sorted or not, it further checks
if it is ascending or the decending order, in which it is sorted
*/
import java.io.*;
import java.util.*;
class GFG {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n, ascend = 1, decend = 1, i;
int[] s = new int[1000];
// taking array size as input
n = sc.nextInt();
// taking input of array elements
for (i = 0; i < n; i++)
s[i] = sc.nextInt();
// initilizing array iterator
i = 0;
while ((ascend == 1 || decend == 1) && i < n - 1) {
if (s[i] < s[i + 1])
decend = 0;
else if (s[i] > s[i + 1])
ascend = 0;
i++;
}
if (ascend == 1)
System.out.println("The array is sorted in ascending order.\n");
else if (decend == 1)
System.out.println("The array is sorted in descending order.\n");
else
System.out.println("The array is not sorted.\n");
}
} | [
"[email protected]"
] | |
ccd70ef5c9dd8a9bab2c27a5e251a0280188fe6e | 1c5e8605c1a4821bc2a759da670add762d0a94a2 | /easrc/pm/contract/client/SettlementDetailHelper.java | 72e9ef9cb5043abaf9e697178de6602d2379d357 | [] | no_license | shxr/NJG | 8195cfebfbda1e000c30081399c5fbafc61bb7be | 1b60a4a7458da48991de4c2d04407c26ccf2f277 | refs/heads/master | 2020-12-24T06:51:18.392426 | 2016-04-25T03:09:27 | 2016-04-25T03:09:27 | 19,804,797 | 0 | 3 | null | null | null | null | GB18030 | Java | false | false | 19,013 | java | package com.kingdee.eas.port.pm.contract.client;
import java.awt.BorderLayout;
import java.awt.Color;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import com.kingdee.bos.BOSException;
import com.kingdee.bos.ctrl.kdf.table.ICell;
import com.kingdee.bos.ctrl.kdf.table.IRow;
import com.kingdee.bos.ctrl.kdf.table.KDTSelectManager;
import com.kingdee.bos.ctrl.kdf.table.KDTable;
import com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent;
import com.kingdee.bos.ctrl.kdf.util.style.Styles.HorizontalAlignment;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.metadata.entity.EntityViewInfo;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.entity.SelectorItemCollection;
import com.kingdee.bos.metadata.entity.SelectorItemInfo;
import com.kingdee.bos.metadata.entity.SorterItemInfo;
import com.kingdee.bos.ui.face.IUIObject;
import com.kingdee.bos.ui.face.IUIWindow;
import com.kingdee.bos.ui.face.UIFactory;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.base.uiframe.client.UIFactoryHelper;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.common.client.OprtState;
import com.kingdee.eas.common.client.UIContext;
import com.kingdee.eas.common.client.UIFactoryName;
import com.kingdee.eas.fdc.basedata.FDCBillStateEnum;
import com.kingdee.eas.fdc.basedata.FDCHelper;
import com.kingdee.eas.fdc.basedata.FDCSQLBuilder;
import com.kingdee.eas.fdc.basedata.client.FDCBillListUI;
import com.kingdee.eas.fdc.contract.CompensationBillCollection;
import com.kingdee.eas.fdc.contract.CompensationBillFactory;
import com.kingdee.eas.fdc.contract.CompensationBillInfo;
import com.kingdee.eas.fdc.contract.GuerdonBillCollection;
import com.kingdee.eas.fdc.contract.GuerdonBillFactory;
import com.kingdee.eas.fdc.contract.GuerdonBillInfo;
import com.kingdee.eas.fdc.contract.client.CompensationBillEditUI;
import com.kingdee.eas.fdc.contract.client.ContractSettlementBillContants;
import com.kingdee.eas.fdc.finance.DeductBillEntryCollection;
import com.kingdee.eas.fdc.finance.DeductBillEntryFactory;
import com.kingdee.eas.fdc.finance.DeductBillEntryInfo;
import com.kingdee.eas.framework.client.CoreUI;
import com.kingdee.eas.port.pm.contract.ContractSettlementBillCollection;
import com.kingdee.eas.port.pm.contract.ContractSettlementBillFactory;
import com.kingdee.eas.port.pm.contract.ContractSettlementBillInfo;
import com.kingdee.jdbc.rowset.IRowSet;
public class SettlementDetailHelper {
private ContractSettlementBillEditUI settleUI=null;
private KDTable tblCompensationBill=null;
private KDTable tblGuerdon=null;
private KDTable tblDeduct=null;
private KDTable tblSettlementBill=null;
private String contractId=null;
SettlementDetailHelper(ContractSettlementBillEditUI settleUI){
this.settleUI=settleUI;
this.tblCompensationBill=settleUI.tblCompensationBill;
this.tblDeduct = settleUI.tblDeduct;
this.tblGuerdon = settleUI.tblGuerdon;
this.tblSettlementBill = settleUI.tblSettlementBill;
initTable();
freezeTableColumn(tblCompensationBill);
freezeTableColumn(tblDeduct);
freezeTableColumn(tblGuerdon);
freezeTableColumn(tblSettlementBill);
}
protected void freezeTableColumn(KDTable table) {
if(table!=null){
table.getSelectManager().setSelectMode(KDTSelectManager.MULTIPLE_ROW_SELECT);
if(table.getColumn("createTime")!=null){
FDCHelper.formatTableDate(table, "createTime");
}
if(table.getColumn("auditTime")!=null){
FDCHelper.formatTableDate(table, "auditTime");
}
if(table.getColumn("auditorTime")!=null){
FDCHelper.formatTableDate(table, "auditorTime");
}
if(table.getColumn("amount")!=null){
FDCHelper.formatTableNumber(table, "amount");
}
if(table.getColumn("originalAmount")!=null){
FDCHelper.formatTableNumber(table, "originalAmount");
}
if(table.getColumn("settlePrice")!=null){
FDCHelper.formatTableNumber(table, "settlePrice");
}
if(table.getColumn("qualityGuarante")!=null){
FDCHelper.formatTableNumber(table, "qualityGuarante");
}
if(table.getColumn("unitPrice")!=null){
FDCHelper.formatTableNumber(table, "unitPrice");
}
if(table.getColumn("buildArea")!=null){
FDCHelper.formatTableNumber(table, "buildArea");
}
}
}
private void initTable(){
this.tblCompensationBill.addKDTMouseListener(new com.kingdee.bos.ctrl.kdf.table.event.KDTMouseListener() {
public void tableClicked(com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent e) {
try {
tblCompensationBill_tableClicked(e);
} catch (Exception exc) {
settleUI.handUIException(exc);
} finally {
}
}
});
this.tblDeduct.addKDTMouseListener(new com.kingdee.bos.ctrl.kdf.table.event.KDTMouseListener() {
public void tableClicked(com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent e) {
try {
tblDeduct_tableClicked(e);
} catch (Exception exc) {
settleUI.handUIException(exc);
} finally {
}
}
});
this.tblGuerdon.addKDTMouseListener(new com.kingdee.bos.ctrl.kdf.table.event.KDTMouseListener() {
public void tableClicked(com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent e) {
try {
tblGuerdon_tableClicked(e);
} catch (Exception exc) {
settleUI.handUIException(exc);
} finally {
}
}
});
this.tblSettlementBill.getStyleAttributes().setLocked(true);
this.tblSettlementBill.addKDTMouseListener(new com.kingdee.bos.ctrl.kdf.table.event.KDTMouseListener() {
public void tableClicked(com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent e) {
try {
tblSettlementBill_tableClicked(e);
} catch (Exception exc) {
settleUI.handUIException(exc);
} finally {
}
}
});
}
private void tblCompensationBill_tableClicked(KDTMouseEvent e) {
if (e.getColIndex() == 0 && isFinalSettle) {
if (settleUI.getOprtState().equals("ADDNEW")
|| settleUI.getOprtState().equals("EDIT")) {
IRow row = this.tblCompensationBill.getRow(e.getRowIndex());
if (row == null) {
return;
}
ICell cell= row.getCell("select");
if(cell==null||cell.getUserObject()==null||cell.getUserObject().equals(Boolean.FALSE)){
return;
}
Boolean b = (Boolean) cell.getValue();
cell.setValue(Boolean.valueOf(!b.booleanValue()));
}
}
}
private void tblGuerdon_tableClicked(KDTMouseEvent e) {
if (e.getColIndex() == 0 && isFinalSettle) {
if (settleUI.getOprtState().equals("ADDNEW")
|| settleUI.getOprtState().equals("EDIT")) {
IRow row =this.tblGuerdon.getRow(e.getRowIndex());
if (row == null) {
return;
}
ICell cell= row.getCell("select");
if(cell==null||cell.getUserObject()==null||cell.getUserObject().equals(Boolean.FALSE)){
return;
}
Boolean b = (Boolean) cell.getValue();
cell.setValue(Boolean.valueOf(!b.booleanValue()));
}
}
}
private void tblDeduct_tableClicked(KDTMouseEvent e) {
if (e.getColIndex() == 0 && isFinalSettle) {
if (settleUI.getOprtState().equals("ADDNEW")
|| settleUI.getOprtState().equals("EDIT")) {
IRow row = this.tblDeduct.getRow(e.getRowIndex());
if (row == null) {
return;
}
ICell cell= row.getCell("select");
if(cell==null||cell.getUserObject()==null||cell.getUserObject().equals(Boolean.FALSE)){
return;
}
Boolean b = (Boolean) cell.getValue();
cell.setValue(Boolean.valueOf(!b.booleanValue()));
}
}
}
private String getContractId(){
if(contractId==null){
contractId = (String) settleUI.getUIContext().get("contractBillId");
if (contractId == null) {
String settId = settleUI.getUIContext().get(UIContext.ID).toString();
if (settId != null) {
SelectorItemCollection selector=new SelectorItemCollection();
selector.add("contractBill.id");
ContractSettlementBillInfo sett;
try {
sett = ContractSettlementBillFactory.getRemoteInstance().getContractSettlementBillInfo(new ObjectUuidPK(BOSUuid.read(settId)),selector);
contractId = sett.getContractBill().getId().toString();
} catch (Exception e) {
settleUI.handUIException(e);
}
}
}
}
return contractId;
}
boolean isFinalSettle = true;
public void unLock(boolean isFinalSettle) throws Exception{
this.isFinalSettle = isFinalSettle ;
// tblCompensationBill.getStyleAttributes().setLocked(lock);
// tblDeduct.getStyleAttributes().setLocked(lock);
// tblGuerdon.getStyleAttributes().setLocked(lock);
fillTabBack(tblCompensationBill);
fillTabBack(tblDeduct);
fillTabBack(tblGuerdon);
}
public void fill(){
try{
// fillCollectPanel();
fillTabCompensation();
fillTabDeduct();
fillTabGuerdon();
fillTabSettlementBill() ;
}catch(Exception e){
settleUI.handUIException(e);
}
}
void save() throws EASBizException, BOSException{
saveTabCompensation();
saveTabDeduct();
saveTabGuerdon();
}
void fillCollectPanel() throws Exception{
try{
// settleUI.setCursorOfWair();
settleUI.panelCollection.setLayout(new BorderLayout());
// if(true) return;
UIContext context=new UIContext(settleUI);
context.put("addSettlePanel",Boolean.FALSE);
context.put(UIContext.ID, getContractId());
String uiName=com.kingdee.eas.fdc.contract.client.ContractFullInfoUI.class.getName();
IUIObject uiObj = UIFactoryHelper.initUIObject(uiName,context, null, "VIEW");
settleUI.panelCollection.add((CoreUI)uiObj, BorderLayout.CENTER);
}finally{
// settleUI.setCursorOfDefault();
}
}
private void fillTabBack(KDTable table) throws Exception{
for (int i = 0; i < table.getRowCount(); i++) {
IRow row = table.getRow(i);
Boolean isLock =(Boolean) row.getCell("number").getUserObject();
// row.getCell("select").setUserObject(isLock);
if(row.getCell("select")!=null)
row.getCell("select").setValue(isLock);
}
}
private void fillTabCompensation() throws Exception{}
private void fillTabDeduct() throws Exception{}
private void fillTabGuerdon() throws Exception{}
private void saveTabCompensation() throws EASBizException, BOSException {
KDTable table=this.tblCompensationBill;
SelectorItemCollection selector=new SelectorItemCollection();
selector.add("isCompensated");
for(int i=0;i<table.getRowCount();i++){
ICell cell= table.getCell(i, "select");
if(cell==null||cell.getUserObject()==null||cell.getUserObject().equals(Boolean.FALSE)){
continue;
}
Object value =cell.getValue();
CompensationBillInfo info=(CompensationBillInfo)table.getRow(i).getUserObject();
if(value!=null&&!value.equals(Boolean.valueOf(info.isIsCompensated()))){
info.setIsCompensated(((Boolean)value).booleanValue());
CompensationBillFactory.getRemoteInstance().updatePartial(info, selector);
}
}
}
private void saveTabDeduct() throws EASBizException, BOSException {
KDTable table=this.tblDeduct;
SelectorItemCollection selector=new SelectorItemCollection();
selector.add("hasApplied");
for(int i=0;i<table.getRowCount();i++){
ICell cell= table.getCell(i, "select");
if(cell==null||cell.getUserObject()==null||cell.getUserObject().equals(Boolean.FALSE)){
continue;
}
Object value =cell.getValue();
DeductBillEntryInfo entry=(DeductBillEntryInfo)table.getRow(i).getUserObject();
if(value!=null&&!value.equals(Boolean.valueOf(entry.isHasApplied()))){
entry.setHasApplied(((Boolean)value).booleanValue());
DeductBillEntryFactory.getRemoteInstance().updatePartial(entry, selector);
}
}
}
private void saveTabGuerdon() throws EASBizException, BOSException {
KDTable table=this.tblGuerdon;
SelectorItemCollection selector=new SelectorItemCollection();
selector.add("isGuerdoned");
for(int i=0;i<table.getRowCount();i++){
ICell cell= table.getCell(i, "select");
if(cell==null||cell.getUserObject()==null||cell.getUserObject().equals(Boolean.FALSE)){
continue;
}
Object value =cell.getValue();
GuerdonBillInfo info=(GuerdonBillInfo)table.getRow(i).getUserObject();
if(value!=null&&!value.equals(Boolean.valueOf(info.isIsGuerdoned()))){
info.setIsGuerdoned(((Boolean)value).booleanValue());
GuerdonBillFactory.getRemoteInstance().updatePartial(info, selector);
}
}
}
//颜色
/**
* 不可编辑色
*/
public static final Color cantEditColor = new Color(0xE8E8E3);
/**
* 警告色
*/
public static final Color warnColor = new Color(0xFFEA67);
//结算单列表
private void fillTabSettlementBill() throws Exception{
tblSettlementBill.removeRows();
EntityViewInfo view = new EntityViewInfo();
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("contractBill.id", getContractId()));
view.setFilter(filter);
SelectorItemCollection selectors = genBillQuerySelector();
view.getSelector().addObjectCollection(selectors);
view.getSorter().add(new SorterItemInfo("createTime"));
ContractSettlementBillCollection contractSettlementBillCollection = ContractSettlementBillFactory
.getRemoteInstance().getContractSettlementBillCollection(view);
for (Iterator iter = contractSettlementBillCollection.iterator(); iter
.hasNext();) {
ContractSettlementBillInfo element = (ContractSettlementBillInfo) iter.next();
// String contractId = element.getContractBill().getId().toString();
// EntityViewInfo conView = new EntityViewInfo();
// FilterInfo filter = new FilterInfo();
// conView.setFilter(filter);
// filter.getFilterItems().add(
// new FilterItemInfo("contract.Id", contractId));
IRow row = tblSettlementBill.addRow();
row.getCell("bookedDate").setValue(element.getBookedDate());
row.getCell("period").setValue(element.getPeriod());
row.getCell(ContractSettlementBillContants.COL_ID).setValue(
element.getId().toString());
row.getCell(ContractSettlementBillContants.COL_STATE).setValue(
element.getState());
row.getCell(ContractSettlementBillContants.COL_NUMBER).setValue(
element.getNumber());
row.getCell(ContractSettlementBillContants.COL_BILLNAME).setValue(
element.getName());
// row.getCell(ContractSettlementBillContants.COL_CONTRACTNUMBER)
// .setValue(element.getContractBill().getNumber());
// row.getCell(ContractSettlementBillContants.COL_CONTRACTNAME)
// .setValue(element.getContractBill().getName());
if (element.getOriginalAmount() != null
&& FDCHelper.ZERO.compareTo(element.getOriginalAmount()) != 0) {
row.getCell("originalAmount")
.setValue(element.getCurSettlePrice());
}
if (element.getSettlePrice() != null
&& FDCHelper.ZERO.compareTo(element.getSettlePrice()) != 0) {
row.getCell(ContractSettlementBillContants.COL_SETTLEPRICE)
.setValue(element.getCurSettlePrice());
}
/**
* 需求约定:结算列表显示每个结算单各自的保修金,而非累计保修金 by Cassiel_peng
*/
// if (element.getQualityGuarante() != null
// && FDCHelper.ZERO.compareTo(element.getQualityGuarante()) != 0) {
// row.getCell(ContractSettlementBillContants.COL_QUALITYGUARANTE)
// .setValue(element.getQualityGuarante());
// }
if (element.getGuaranteAmt() != null
&& FDCHelper.ZERO.compareTo(element.getGuaranteAmt()) != 0) {
row.getCell(ContractSettlementBillContants.COL_QUALITYGUARANTE)
.setValue(element.getGuaranteAmt());
}
if (element.getBuildArea() != null
&& FDCHelper.ZERO.compareTo(element.getBuildArea()) != 0) {
row.getCell(ContractSettlementBillContants.COL_BUILDAREA)
.setValue(element.getBuildArea());
}
if (element.getUnitPrice() != null
&& FDCHelper.ZERO.compareTo(element.getUnitPrice()) != 0) {
row.getCell(ContractSettlementBillContants.COL_UNITPRICE)
.setValue(element.getUnitPrice());
}
row.getCell(ContractSettlementBillContants.COL_INFOPRICE).setValue(
element.getInfoPrice());
row.getCell(ContractSettlementBillContants.COL_GETFEECRITERIA)
.setValue(element.getGetFeeCriteria());
// row.getCell(ContractSettlementBillContants.COL_ISFINALSETTLE)
// .setValue(element.getIsFinalSettle());
row.getCell(ContractSettlementBillContants.COL_CREATOR).setValue(
element.getCreator().getName());
row.getCell(ContractSettlementBillContants.COL_CREATETIME)
.setValue(element.getCreateTime());
if (element.getAuditor() != null)
row.getCell(ContractSettlementBillContants.COL_AUDITOR)
.setValue(element.getAuditor().getName());
row.getCell("auditorTime").setValue(element.getAuditTime());
row.getCell(ContractSettlementBillContants.COL_DESC).setValue(
element.getDescription());
if (element.getVoucher() != null)
row.getCell(ContractSettlementBillContants.COL_VOUCHERNUMBER)
.setValue(element.getVoucher().getNumber());
row.getCell(FDCBillListUI.COL_DATE).setValue(element.getBookedDate());
row.getCell(FDCBillListUI.COL_PERIOD).setValue(element.getPeriod());
}
}
private void tblSettlementBill_tableClicked(KDTMouseEvent e) throws Exception {
if (e.getClickCount() == 2) {
UIContext uiContext = new UIContext(this);
IRow row =this.tblSettlementBill.getRow(e.getRowIndex());
if(row!=null){
String id = (String)row.getCell("id").getValue();
uiContext.put(UIContext.ID, id);
IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.NEWTAB).create(settleUI.getEditUIName(), uiContext, null,
OprtState.VIEW);
uiWindow.show();
}
}
}
protected SelectorItemCollection genBillQuerySelector() {
SelectorItemCollection selectors = new SelectorItemCollection();
selectors.add("*");
selectors.add("contractBill.number");
selectors.add("contractBill.name");
selectors.add("creator.name");
selectors.add("auditor.name");
selectors.add("voucher.number");
selectors.add("period.number");
selectors.add("period.periodNumber");
selectors.add("period.periodYear");
return selectors;
}
}
| [
"[email protected]"
] | |
207e18b5e6cb47797584570d6f60663a19fdcf65 | 78d2a2fd546c1a4fc51bd58c83cd06308f785477 | /app/src/main/java/ng/com/hybridintegrated/a365dailyreadingsfornigeria/prayerThree.java | d8f4ee539a2d27961e31eb805d94e7a418c7f568 | [] | no_license | Omamuli-Emmanuel/365job | 66b6195f92730b5ff4b8a3829c46423023065ac1 | 5d03d9dcd68f183b3dedf4a5d03815e4c2f2bd24 | refs/heads/master | 2020-06-01T10:14:12.054679 | 2019-06-07T13:11:20 | 2019-06-07T13:11:20 | 190,744,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,241 | java | package ng.com.hybridintegrated.a365dailyreadingsfornigeria;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
public class prayerThree extends AppCompatActivity {
private AdView mAdview;
private Toolbar mtoolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_prayer_three);
mAdview=findViewById(R.id.addprayerthree);
AdRequest adRequest=new AdRequest.Builder().build();
mAdview.loadAd(adRequest);
mtoolbar=findViewById(R.id.toolbarprayerthree);
setSupportActionBar(mtoolbar);
mtoolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(getApplicationContext(),churchPrayers.class));
finish();
}
});
}
}
| [
"[email protected]"
] | |
cdb4e7701cae9969358f20e9220036ea27e6f627 | b42870d83cad0eec8fb6011c8e163ddf51e24d93 | /servidorTFG/src/main/java/com/pabliyosu/servidorSpring/Estacion.java | 060106ffa566698354b2ddf2472f11e730bd51e3 | [] | no_license | pabloyosu/servidorTFG | 36b977751914abafc916b5a929eb91d8f9c86f3c | 760846c8aa43e97294c103127035719990f50e35 | refs/heads/master | 2022-09-19T22:04:05.797791 | 2020-06-03T11:39:44 | 2020-06-03T11:39:44 | 269,068,514 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,901 | java | package com.pabliyosu.servidorSpring;
import javax.persistence.*;
//Listado estaciones
@Entity
@Table(name = "estaciones")
public class Estacion {
@Id
@GeneratedValue
private int id;
@Column
private double longitud;
@Column
private double latitud;
@Column
private String calle;
@Column(name = "bicis_disponibles")
private int bicisDisponibles;
@Column(name = "anclajes_disponibles")
private int anclajesDiponibles;
@Column
private int capacidad;
@Column(name = "estacion_abierta")
private Boolean estacionAbierta;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getLongitud() {
return longitud;
}
public void setLongitud(double longitud) {
this.longitud = longitud;
}
public double getLatitud() {
return latitud;
}
public void setLatitud(double latitud) {
this.latitud = latitud;
}
public String getCalle() {
return calle;
}
public void setCalle(String calle) {
this.calle = calle;
}
public int getBicisDisponibles() {
return bicisDisponibles;
}
public void setBicisDisponibles(int bicisDisponibles) {
this.bicisDisponibles = bicisDisponibles;
}
public int getAnclajesDiponibles() {
return anclajesDiponibles;
}
public void setAnclajesDiponibles(int anclajesDiponibles) {
this.anclajesDiponibles = anclajesDiponibles;
}
public int getCapacidad() {
return capacidad;
}
public void setCapacidad(int capacidad) {
this.capacidad = capacidad;
}
public Boolean getEstacionAbierta() {
return estacionAbierta;
}
public void setEstacionAbierta(Boolean estacionAbierta) {
this.estacionAbierta = estacionAbierta;
}
}
| [
"[email protected]"
] | |
9773dc0c921f2c526492afa5aafc9f9258ad9330 | 87132e18b7ebe8dfef3408af4005bdfffec797f9 | /src/com/riotapps/word/utils/Logger.java | 14767bdea51c8575a5b9ffab58f846759de256fb | [] | no_license | rendyramon/WordAndroid | 7b6ee894b8ea8d9b0d381dff5921bfc3a455d271 | 6a3adb118aab023ead80a7a3503787bc738cd1c9 | refs/heads/master | 2021-01-18T16:11:24.891293 | 2013-04-08T01:49:55 | 2013-04-08T01:49:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,802 | java | package com.riotapps.word.utils;
import com.riotapps.word.BuildConfig;
import android.util.Log;
public class Logger {
public static final boolean LOG_OK = true;
public static void w(String tag, String msg){
if (BuildConfig.DEBUG && LOG_OK) {
Log.w((tag==null?"UNKNOWN_TAG":tag), (msg==null?"unknown message":msg), null);
}
}
public static void w(String tag, String msg, Exception e){
//is logging on?
if (BuildConfig.DEBUG && LOG_OK) {
Log.w((tag==null?"UNKNOWN_TAG":tag), (msg==null?"unknown message":msg));
}
}
public static void d(String tag, String msg){
Logger.d((tag==null?"UNKNOWN_TAG":tag), msg, null);
}
public static void d(String tag, String msg, Exception e){
//is logging on?
if (BuildConfig.DEBUG && LOG_OK) {
Log.d((tag==null?"UNKNOWN_TAG":tag), (msg==null?"unknown message":msg));
}
}
public static void longInfo(String tag, String str) {
if(str.length() > 1000) {
Log.d(tag, str.substring(0, 1000));
longInfo(tag, str.substring(1000));
} else
Log.d(tag, str);
}
public static void e(String tag, String msg){
Logger.e((tag==null?"UNKNOWN_TAG":tag), (msg==null?"unknown message":msg), null);
}
public static void e(String tag, String msg, Exception e){
////is logging on?
if (BuildConfig.DEBUG && LOG_OK) {
Log.e((tag==null?"UNKNOWN_TAG":tag), (msg==null?"unknown message":msg));
}
}
public static void v(String tag, String msg){
//is logging on?
if (BuildConfig.DEBUG && LOG_OK) {
Log.v((tag==null?"UNKNOWN_TAG":tag), (msg==null?"unknown message":msg));
}
}
public static void i(String tag, String msg){
//is logging on?
if (BuildConfig.DEBUG && LOG_OK) {
Log.i((tag==null?"UNKNOWN_TAG":tag), (msg==null?"unknown message":msg));
}
}
}
| [
"[email protected]"
] | |
4d3edba5f069297784ea4236016d00fab3162839 | bf000f639b8faf68ef26ae296ea0d01db82a2b47 | /mockito/src/test/java/com/myself/mockito/mockito/MockitoApplicationTests.java | 820b02945d2f633f0cf3d1be5320a636b165011c | [] | no_license | ZarrarMalik/TestingWIthMockito | eebb4530b6c7b6fb2a807510fda35b75f89ada5a | 0290eb5ad9142ac2059b28cb9ef466cc662a23e4 | refs/heads/master | 2020-04-06T11:21:25.795506 | 2018-11-13T16:53:27 | 2018-11-13T16:53:27 | 157,413,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.myself.mockito.mockito;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MockitoApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.