blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
476caf747ac1b950b6cd9d7d4910bb0e1ffd3512 | fcf78ac99922eaa665311770de6176815347e6e8 | /3-4springCloud/sc-homework-1/sc-common/src/main/java/com/shred/sc/pojo/Token.java | 775deee54bca74c761d25290d9a88336d5605600 | [] | no_license | shredoreo/lgjava | 6e2fa29011d1906478b3d5b6e66c0e2924d6b35d | 76796fc3a57d16cbb594dc29ce1e37817f4527d7 | refs/heads/master | 2023-08-27T00:20:46.145210 | 2021-10-07T17:29:12 | 2021-10-07T17:29:12 | 380,703,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 277 | java | package com.shred.sc.pojo;
import lombok.Data;
import javax.persistence.*;
@Data
@Entity
@Table(name="shred_token")
public class Token {
@Id@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
private String email;
private String token;
}
| [
"shreddd@live.com"
] | shreddd@live.com |
f29e54726f7a35df49696106b14b09ac841b3584 | a804b81f0565358a0cfd88444a696bcf7f4b5de3 | /ExcelParser/src/com/a4/product/beans/Configurations.java | 28dc6097fd23f926aa7406364d23eb30a1c40dce | [] | no_license | AMEYA4TECH/ExcelParser | 1ee714947989c31d2b63cb6551252abba854329d | e37d035495bc131cdf9c37f5ce8ef598b12e0e3c | refs/heads/master | 2016-09-14T05:52:24.003725 | 2016-05-12T09:01:33 | 2016-05-12T09:01:33 | 56,528,882 | 0 | 2 | null | 2016-05-09T10:43:44 | 2016-04-18T17:44:57 | Java | UTF-8 | Java | false | false | 1,364 | java | package com.a4.product.beans;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(Include.NON_NULL)
@XmlAccessorType(XmlAccessType.FIELD)
@XmlSeeAlso({ValueWrapper.class})
public class Configurations {
@JsonProperty("Criteria")
private String criteria;
@JsonProperty("OptionName")
private String optionName;
@JsonProperty("Value")
@XmlElement(name="Value")
private List<Object> value;
// @JsonProperty("Value")
// private BaseValue value;
public String getOptionName() {
return optionName;
}
public void setOptionName(String optionName) {
this.optionName = optionName;
}
@JsonProperty("Criteria")
public String getCriteria() {
return criteria;
}
@JsonProperty("Criteria")
public void setCriteria(String criteria) {
this.criteria = criteria;
}
@JsonProperty("Value")
public List<Object> getValue() {
return value;
}
@JsonProperty("Value")
public void setValue(List<Object> value) {
this.value = value;
}
}
| [
"amey.more@a4technology.com"
] | amey.more@a4technology.com |
ccd38daa2c4e81ce4311ec41c5b54eff8bf2a69b | 043db7840b725c6611ec636c1f61ae4c2f3d9e88 | /GasPumpsProject/src/iit/softwaresystarch/project/model/factories/package-info.java | bafeeb3d2deb4ce351891d2bd57b32cd63cfce1c | [] | no_license | Valpich/SoftwareArchitectureProject | 95db734cbbd3d89b1a0dbf6e219814287b9e56ce | dfa692511ed6d5bfe1aa4f69ee1fcb06ae1cb344 | refs/heads/master | 2021-01-23T10:56:56.715036 | 2017-06-02T00:43:25 | 2017-06-02T00:43:25 | 93,110,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 150 | java | /**
* is a package containing the classes mostly related to AbstractFactory design pattern.
*/
package iit.softwaresystarch.project.model.factories; | [
"valentin.pichavant@hotmail.fr"
] | valentin.pichavant@hotmail.fr |
21361bad5df7c5b23f2e82396d1f40bcf8657662 | c309e50ba6b06c9b0363400e2e5c06398551d425 | /src/main/java/com/crowd/funding/order/controller/OrderController.java | 8f2e541f8fd35f5141163b3434c728a6a29cae0b | [] | no_license | lumos1211/Funding | b99e4591a9cf703c5c5a2e2614d67cb0fb3fb4c0 | 84493d368149e1feca434dd31d519a2c606f8be9 | refs/heads/master | 2023-01-08T23:13:32.680331 | 2020-11-09T14:10:42 | 2020-11-09T14:10:42 | 311,357,654 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,191 | java | package com.crowd.funding.order.controller;
import javax.inject.Inject;
import javax.servlet.http.HttpSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.crowd.funding.member.model.MemberDTO;
import com.crowd.funding.myorder.domain.MyoptionDTO;
import com.crowd.funding.myorder.domain.MyorderDTO;
import com.crowd.funding.order.domain.OrderDTO;
import com.crowd.funding.order.service.OrderService;
@Controller
@RequestMapping("/order")
public class OrderController {
@Inject
OrderService orderService;
private static final Logger logger = LoggerFactory.getLogger(OrderController.class);
@RequestMapping(value="/reservation/{pro_id}", method = RequestMethod.POST)
public String orderInsert(Model model, OrderDTO orderDTO, @PathVariable("pro_id") int pro_id,
MyorderDTO myorderDTO, MyoptionDTO myoptionDTO, RedirectAttributes redirectAttributes, HttpSession session) throws Exception {
if(session.getAttribute("login") == null) {
return "/user/login";
}
System.out.println("reservation 동작체크");
System.out.println("orderDTO phone value:"+"'"+orderDTO.getOrder_phone()+"'");
MemberDTO memDTO = (MemberDTO) session.getAttribute("login");
int memIdx = memDTO.getMem_idx();
orderDTO.setMem_idx(memIdx);
orderService.insert(orderDTO);
int orderId = orderDTO.getOrder_id();
System.out.println("memIdx:"+memIdx);
//int memIdx = myorderDTO.getMem_idx();
//myorder : order_id, memidx, pro_id 값 설정
for(int i = 0 ; i < myorderDTO.getOrderList().size(); i++) {
myorderDTO.getOrderList().get(i).setOrder_id(orderId);
myorderDTO.getOrderList().get(i).setMem_idx(memIdx);
myorderDTO.getOrderList().get(i).setPro_id(pro_id);
}
// myorder 주문 삽입
orderService.myOrderInsert(myorderDTO.getOrderList());
// option Myinfo값 설정
if(myoptionDTO.getOrderOptList() != null) {
for(int i = 0 ; i < myorderDTO.getOrderList().size(); i++) {
int myinfo = myorderDTO.getOrderList().get(i).getMyinfo();
int rewardId = myorderDTO.getOrderList().get(i).getReward_id();
for(int j = 0; j < myoptionDTO.getOrderOptList().size(); j++) {
if(rewardId == myoptionDTO.getOrderOptList().get(j).getReward_id())
myoptionDTO.getOrderOptList().get(j).setMyinfo(myinfo);
}
}
orderService.myOptionInsert(myoptionDTO.getOrderOptList());
}
redirectAttributes.addAttribute("order_id", orderId);
return "redirect:/order/orderbill";
}
@RequestMapping(value="/orderbill", method = RequestMethod.GET)
public String orderBill(Model model, @RequestParam("order_id") int order_id, HttpSession session) throws Exception {
if(session.getAttribute("login") == null) {
return "/user/login";
}
model.addAttribute("order_id", order_id);
return "/order/orderbill";
}
}
| [
"jyng1211@gmail.com"
] | jyng1211@gmail.com |
60bb44a2fe360f7cd530f51c201b041de2f8fca1 | 31284760168af3f8b2932b7562c97fe9d725b7df | /dcae-analytics/dcae-analytics-web/src/test/java/org/onap/dcae/analytics/web/util/AnalyticsHttpUtilsTest.java | d20cd6579cd07ddfeed8b9c7e5d4c1af9db8b74d | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | onap/dcaegen2-analytics-tca-gen2 | 755fae9600541eaa2f0acfabdd6ddaff15a0101a | 2b9387a15bbe55c1584031640975646324aa60a0 | refs/heads/master | 2023-09-02T03:01:53.958622 | 2023-03-31T09:19:52 | 2023-03-31T09:20:22 | 159,415,150 | 2 | 2 | NOASSERTION | 2021-06-29T18:15:28 | 2018-11-27T23:32:51 | Java | UTF-8 | Java | false | false | 3,116 | java | /*
* ============LICENSE_START=======================================================
* Copyright (c) 2022 Huawei. 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.
* ============LICENSE_END=========================================================
*
*/
package org.onap.dcae.analytics.web.util;
import org.junit.jupiter.api.Test;
import org.springframework.http.HttpHeaders;
import org.springframework.messaging.MessageHeaders;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
public class AnalyticsHttpUtilsTest {
@Test
public void createDefaultHttpHeadersTest () throws Exception {
HttpHeaders httpHeaders = AnalyticsHttpUtils.createDefaultHttpHeaders();
httpHeaders.set("X-TransactionID", "transactionID");
String transactionId = AnalyticsHttpUtils.getTransactionId(httpHeaders);
assertEquals("transactionID", transactionId);
}
@Test
public void createDefaultHttpHeadersRequestIDTest () throws Exception {
HttpHeaders httpHeaders = AnalyticsHttpUtils.createDefaultHttpHeaders("requestID");
String requestId = AnalyticsHttpUtils.getRequestId(httpHeaders);
assertEquals("requestID", requestId);
}
@Test
public void createDefaultHttpHeadersTransactionIDTest () throws Exception {
HttpHeaders httpHeaders = AnalyticsHttpUtils.createDefaultHttpHeaders();
httpHeaders.set("X-TransactionID", "transactionID");
String requestId = AnalyticsHttpUtils.getTransactionId(httpHeaders);
assertEquals("transactionID", requestId);
}
@Test
public void getTransactionIdTest () throws Exception {
MessageHeaders httpHeaders = new MessageHeaders(null);
String transactionId = AnalyticsHttpUtils.getTransactionId(httpHeaders);
assertEquals("UNKNOWN-TRANSACTION_ID", transactionId);
}
@Test
public void getRequestIdTest () throws Exception {
MessageHeaders httpHeaders = new MessageHeaders(null);
String requestId = AnalyticsHttpUtils.getRequestId(httpHeaders);
assertEquals("UNKNOWN-REQUEST_ID", requestId);
}
@Test
public void getTimestampFromHeadersTest () throws Exception {
Map<String, Object> headers = new HashMap<String, Object>();
Date dt = AnalyticsHttpUtils.getTimestampFromHeaders(headers, null);
assertNotNull(dt);
}
}
| [
"mukesh.paliwal1@huawei.com"
] | mukesh.paliwal1@huawei.com |
1278edafb5d62324bae1df95a4ca9f89135675db | d0cb148823216c0ba9467ce6f804a2272f2f6646 | /app/src/main/java/com/theboredengineers/easylipo/objects/NfcTag.java | 787df72cf777ac1122d43c82d08f154e265796c6 | [] | no_license | psykhi/EasyLiPo | 21ae0714bc4bf0d4d4c92b4211b19e2478378356 | 7bb733acf2dee0395ed6df4b3a047041d17d3ffe | refs/heads/master | 2021-01-10T21:00:39.308734 | 2015-09-18T17:11:51 | 2015-09-18T17:11:51 | 42,735,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,582 | java | package com.theboredengineers.easylipo.objects;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.nfc.FormatException;
import android.nfc.NdefMessage;
import android.nfc.NdefRecord;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.tech.Ndef;
import android.os.Build;
import android.os.Parcelable;
import android.util.Log;
import java.io.IOException;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.util.Locale;
/**
* Created by Benoit on 08/01/2015.
*/
public class NfcTag implements Serializable {
byte[] bytes;
String string;
private static final String mimeType = "com.theboredengineers/easylipo";
public NfcTag(byte[] bytes) {
this.bytes = bytes;
this.string = bytesToHex(bytes);
}
public NfcTag(Tag tag) {
this(tag.getId());
}
public NfcTag(String str) {
this.string = str;
this.bytes = hexToBytes(str);
}
@Override
public String toString() {
return string;
}
@Override
public boolean equals(Object ob) {
if (ob instanceof NfcTag) {
NfcTag oth = (NfcTag) ob;
return oth.string.equals(this.string);
} else if (ob instanceof String) {
if (this.string.equals(((String) ob).toUpperCase(Locale.US)))
return true;
else return this.toFormattedString().equals(((String) ob).toUpperCase(Locale.US));
} else if (ob instanceof byte[]) {
byte[] otherBytes = (byte[]) ob;
NfcTag otherTag = NfcTag.BuildFromBytes(otherBytes);
return this.equals(otherTag);
} else
return false;
}
public String toFormattedString() {
// add enough space for an additional ":" for every 2 chars:
char[] chars = new char[string.length() + (string.length() / 2) - 1];
// this offset will give us the first ":" position from the LEFT:
int offset = string.length() % 2;
int idx = 0, strIdx = 0;
for (; strIdx < string.length(); idx++, strIdx++) {
if (((strIdx % 2) == offset) && (strIdx != 0))
chars[idx++] = ':';
chars[idx] = string.charAt(strIdx);
}
return new String(chars);
}
public byte[] toBytes() {
return bytes;
}
public static NfcTag BuildFromBytes(byte[] bTag) {
return new NfcTag(bTag);
}
public static NfcTag BuildFromTag(Tag tag) {
return new NfcTag(tag);
}
public static NfcTag BuildFromString(String strTag) {
if(strTag == null)
return null;
if (strTag.length() % 2 == 1)
strTag = "0" + strTag;
return new NfcTag(strTag);
}
/**
* Convert hex string to an array of bytes
*
* @param s string containing 0..F, and an EVEN number (2 used for one byte).
* @return the array of bytes
*/
private byte[] hexToBytes(String s) {
int len = s.length();
byte[] data = new byte[len / 2];
for (int i = 0; i < len; i += 2) {
data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4)
+ Character.digit(s.charAt(i + 1), 16));
}
return data;
}
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();
/**
* Create string from byte array
*
* @param bytes the byte array
* @return the string containing an even number of 0..F.
*/
public static String bytesToHex(byte[] bytes) {
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
}
@SuppressLint("NewApi")
/**
* @brief Formats an NFC Tag with our mime type
* @param tag the NFC tag
*/
public static boolean formatNdef(Ndef tag, String server_id, Boolean force) {
NdefMessage ndefMessage;
NdefRecord ndefRecord;
boolean alreadyWellFormatted = false;
boolean success = false;
//Insert mime theboredengineers/easylipo.
byte[] mimeData = server_id.getBytes();
ndefMessage = tag.getCachedNdefMessage();
if (ndefMessage != null && ndefMessage.getRecords().length == 1) {
byte TypeAsByte[];
ndefRecord = ndefMessage.getRecords()[0];
TypeAsByte = ndefRecord.getType();
String type;
type = new String(TypeAsByte);
if (type.equals(mimeType))
alreadyWellFormatted = true;
}
if (tag.isWritable() && (force ||!alreadyWellFormatted)) {
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
ndefRecord = NdefRecord.createMime(mimeType, mimeData);
}
else
{
ndefRecord = new NdefRecord(
NdefRecord.TNF_MIME_MEDIA ,mimeType.getBytes(Charset.forName("US-ASCII")),
new byte[0]
, mimeData);
}
ndefMessage = new NdefMessage(new NdefRecord[]{ndefRecord});
try {
tag.connect();
tag.writeNdefMessage(ndefMessage);
tag.close();
Log.i("NFC", "tag formatted as " + mimeType + ":" + server_id);
success = true;
} catch (IOException | FormatException e) {
Log.i("NFC", "Can't format... Unexpected");
}
} else {
if (alreadyWellFormatted)
Log.i("NFC", "Tag is already formatted");
else
Log.i("NFC", "Tag is not editable.");
}
return success;
}
public static String getServerIDFromIntent(Intent intent) {
Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
if (rawMsgs != null) {
NdefMessage[] msgs = new NdefMessage[rawMsgs.length];
for (int i = 0; i < rawMsgs.length; i++) {
msgs[i] = (NdefMessage) rawMsgs[i];
}
if(msgs.length != 0) {
if (msgs[0] != null)
return new String(msgs[0].getRecords()[0].getPayload());
else return "";
}
else
return "";
}
else
return "";
}
}
| [
"alexandre.pesant@gmail.com"
] | alexandre.pesant@gmail.com |
02d10389ef407b1cc958da04328562ae2b8fc103 | 7d2bcfa0a21c2daaedc47eb9c837bd90a10e43c3 | /CoffBucks Reloaded/main/java/com/example/coffbucks/OdometerActivity.java | 4648582b62e0ffac9c8690906aa835ba6ee50c25 | [] | no_license | WiseSoul/Android-Applications | e65939c3141598dff4b0957fcd39ad43dc85120d | 007f1d0aec219d06b64de391cad22ae9da449c93 | refs/heads/master | 2021-01-12T12:58:51.785258 | 2017-04-27T18:28:45 | 2017-04-27T18:28:45 | 69,766,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,418 | java | package com.example.coffbucks;
import android.Manifest;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Handler;
import android.os.IBinder;
import android.os.health.ServiceHealthStats;
import android.support.v4.app.ActivityCompat;
import android.support.v4.app.ServiceCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class OdometerActivity extends AppCompatActivity {
// This is used for the OdometerService
private OdometerService odometerService;
// This is used to store whether or not the activity's bound to the service
private boolean bound = false;
// This is used to check whether or not the Odometer is running
protected boolean running = false;
// This is used to store the distance traveled by the device
protected double distance = 0.0;
// Establish a connection with the service, so that the Activity can bound to it.
private ServiceConnection connection = new ServiceConnection() {
@Override // When the service is connected...
public void onServiceConnected(ComponentName name, IBinder binder) { // <- We need to define a service connection
// Create a odometerBinder based on a IBinder obj, casted to OdometerBinder
// This is why we always need to define a Binder object in our Service
// (because onServiceConnected() has a IBinder as a parameter that is used to create an instance of the service)
OdometerService.OdometerBinder odometerBinder =
(OdometerService.OdometerBinder) binder;
// Get a reference to the OdometerService when the service is connected.
odometerService = odometerBinder.getOdometer();
bound = true;
}
@Override // When the service is disconnected...
public void onServiceDisconnected(ComponentName name) {
bound = false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
// savedInstanceState -> it's value is initially null,but after you tilt your screen onDestroy() is called,and the state loses all it's previous data.
// you have to save all the data you previously had,if you want your app to continue running after you tilt the screen
// (savedInstanceState != null) => onDestroy() was called,so the data you saved must be put back in the variables you lost within the initial state
if (savedInstanceState != null) {
savedInstanceState.getDouble("distance");
savedInstanceState.getBoolean("bound");
savedInstanceState.getBoolean("running");
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_odometer);
// This method is called when the activity is created.
updateKm();
}
// Saving the data in the bundle savedInstanceState,before onDestroy() is called.
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
savedInstanceState.putBoolean("bound", bound);
savedInstanceState.putBoolean("running", running);
savedInstanceState.putDouble("distance",distance);
}
// We want the service to be bound to the activity when the activity starts.
// That is because onStart() is on average more frequently called than onCreate()
@Override
protected void onStart() {
super.onStart();
// Bind the service when the activity starts.
Intent intent = new Intent(this, OdometerService.class);
bindService(intent, connection, Context.BIND_AUTO_CREATE);
}
// And to unbound when the activity stops.
// That is because onStop() is on average more frequently called than onDestroy()
@Override
protected void onStop() {
super.onStop();
// Unbind the service when the activity stops.
if (bound) {
unbindService(connection);
}
}
private void updateKm() {
// Get a reference to the TextView that will display the distance.
final TextView distanceView = (TextView) findViewById(R.id.distance);
// Create a handler to post data using a thread.
final Handler handler = new Handler();
handler.post(new Runnable() {
@Override
public void run() {
// Check to avoid NullPointerException
if (odometerService != null && running) {
distance = odometerService.getKm();
}
// Create the string that holds the distance
String distanceStr = String.valueOf(distance);
// Set the text
distanceView.setText(distanceStr);
// Update the distance every second
handler.postDelayed(this, 1000);
}
});
}
public void onClickStart(View view) {
running = true;
}
public void onClickReset(View view) {
running = false;
distance = 0.01;
}
public void onClickStop(View view) {
running = false;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0149f17315fe6fb5b1473b8e5ab596592bddf2d1 | 9e2fa2779c7db9b99b4ffcc8272ce643e2199d0c | /src/main/java/hrms/hrmsBackend/business/abstracts/JobSeekerCheckService.java | b47ad97f48b3641c001ac8d86dff4fdbd94f7112 | [] | no_license | cagllan/hrmsBackend | d9627900bb99c8d3f9ca2e3a7cf95fb97e82f6b3 | 244ed606fe2d784aeb062570fc50183574348574 | refs/heads/master | 2023-05-21T01:21:09.131078 | 2021-06-12T16:21:08 | 2021-06-12T16:21:08 | 366,131,827 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 195 | java | package hrms.hrmsBackend.business.abstracts;
import hrms.hrmsBackend.entities.concretes.JobSeeker;
public interface JobSeekerCheckService {
boolean checkIfRealPerson(JobSeeker jobSeeker);
}
| [
"caglanatay@windowslive.com"
] | caglanatay@windowslive.com |
2f0d0256560c1904dbc40b01212b135a37e01c3d | 49de9fb0df8c6f57f353080b85e37f3ca87810e8 | /src/main/java/eu/ebbitsproject/peoplemanager/IsPersonAvailableByRfid.java | 5f230c132aaf945be85de34ce3d68b4dfd68aaff | [] | no_license | intersoft-sk/people-manager-client | 63615ea6808b81d02a4880c451de059b22e1c7bc | ff9438e78532ab4294cd12819036d15c3027f833 | refs/heads/master | 2020-05-30T14:28:47.186614 | 2015-02-26T08:49:49 | 2015-02-26T08:49:49 | 31,358,427 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,368 | java |
package eu.ebbitsproject.peoplemanager;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for isPersonAvailableByRfid complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="isPersonAvailableByRfid">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="arg0" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "isPersonAvailableByRfid", propOrder = {
"arg0"
})
public class IsPersonAvailableByRfid {
protected String arg0;
/**
* Gets the value of the arg0 property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getArg0() {
return arg0;
}
/**
* Sets the value of the arg0 property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setArg0(String value) {
this.arg0 = value;
}
}
| [
"gl@intersoft.sk"
] | gl@intersoft.sk |
631d2963a49f9e574df488c0c7508d47828a0b23 | f50734a062c5dbec147713b0aed1c9daf73ed728 | /MyTracks/src/com/google/android/apps/mytracks/ChartView.java | f2df8403d53b1e820d0d161fbb563b0fa5f859cb | [] | no_license | xtu/mytracks1 | 7aebc475b23e0bfba38e83fb930ea6feaa083961 | ed520de514282721d6e13475a625c447e9fe732a | refs/heads/master | 2016-09-10T18:54:49.298824 | 2013-03-18T03:22:05 | 2013-03-18T03:22:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 30,268 | java | /*
* Copyright 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.mytracks;
import com.google.android.apps.mytracks.content.Waypoint;
import com.google.android.apps.mytracks.content.Waypoint.WaypointType;
import com.google.android.apps.mytracks.stats.ExtremityMonitor;
import com.google.android.apps.mytracks.util.IntentUtils;
import com.google.android.apps.mytracks.util.StringUtils;
import com.google.android.apps.mytracks.util.UnitConversions;
import com.google.android.maps.mytracks.R;
import com.google.common.annotations.VisibleForTesting;
import android.content.Context;
import android.content.Intent;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.DashPathEffect;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.widget.Scroller;
import java.text.NumberFormat;
import java.util.ArrayList;
/**
* Visualization of the chart.
*
* @author Sandor Dornbush
* @author Leif Hendrik Wilden
*/
public class ChartView extends View {
public static final float MEDIUM_TEXT_SIZE = 18f;
public static final float SMALL_TEXT_SIZE = 12f;
public static final int Y_AXIS_INTERVALS = 5;
public static final int NUM_SERIES = 6;
public static final int ELEVATION_SERIES = 0;
public static final int SPEED_SERIES = 1;
public static final int PACE_SERIES = 2;
public static final int HEART_RATE_SERIES = 3;
public static final int CADENCE_SERIES = 4;
public static final int POWER_SERIES = 5;
private static final int TARGET_X_AXIS_INTERVALS = 4;
private static final int MIN_ZOOM_LEVEL = 1;
private static final int MAX_ZOOM_LEVEL = 10;
private static final NumberFormat X_NUMBER_FORMAT = NumberFormat.getIntegerInstance();
private static final NumberFormat X_FRACTION_FORMAT = NumberFormat.getNumberInstance();
static {
X_FRACTION_FORMAT.setMaximumFractionDigits(1);
X_FRACTION_FORMAT.setMinimumFractionDigits(1);
}
private static final int BORDER = 8;
private static final int SPACER = 4;
private static final int Y_AXIS_OFFSET = 16;
private final ChartValueSeries[] series = new ChartValueSeries[NUM_SERIES];
private final ArrayList<double[]> chartData = new ArrayList<double[]>();
private final ArrayList<Waypoint> waypoints = new ArrayList<Waypoint>();
private final ExtremityMonitor xExtremityMonitor = new ExtremityMonitor();
private double maxX = 1.0;
private final Paint axisPaint;
private final Paint xAxisMarkerPaint;
private final Paint gridPaint;
private final Paint markerPaint;
private final Drawable pointer;
private final Drawable statisticsMarker;
private final Drawable waypointMarker;
private final int markerWidth;
private final int markerHeight;
private final Scroller scroller;
private VelocityTracker velocityTracker = null;
private float lastMotionEventX = -1;
private int zoomLevel = 1;
private int leftBorder = BORDER;
private int topBorder = BORDER;
private int bottomBorder = BORDER;
private int rightBorder = BORDER;
private int spacer = SPACER;
private int yAxisOffset = Y_AXIS_OFFSET;
private int width = 0;
private int height = 0;
private int effectiveWidth = 0;
private int effectiveHeight = 0;
private boolean chartByDistance = true;
private boolean metricUnits = true;
private boolean reportSpeed = true;
private boolean showPointer = false;
/**
* Constructor.
*
* @param context the context
*/
public ChartView(Context context) {
super(context);
series[ELEVATION_SERIES] = new ChartValueSeries(context,
Integer.MIN_VALUE,
Integer.MAX_VALUE,
new int[] { 5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000 },
R.string.description_elevation_metric,
R.string.description_elevation_imperial,
R.color.elevation_fill,
R.color.elevation_border);
series[SPEED_SERIES] = new ChartValueSeries(context,
0,
Integer.MAX_VALUE,
new int[] {1, 5, 10, 20, 50, 100 },
R.string.description_speed_metric,
R.string.description_speed_imperial,
R.color.speed_fill,
R.color.speed_border);
series[PACE_SERIES] = new ChartValueSeries(context,
0,
Integer.MAX_VALUE,
new int[] {1, 2, 5, 10, 15, 20, 30, 60, 120 },
R.string.description_pace_metric,
R.string.description_pace_imperial,
R.color.pace_fill,
R.color.pace_border);
series[HEART_RATE_SERIES] = new ChartValueSeries(context,
0,
Integer.MAX_VALUE,
new int[] {25, 50 },
R.string.description_sensor_heart_rate,
R.string.description_sensor_heart_rate,
R.color.heart_rate_fill,
R.color.heart_rate_border);
series[CADENCE_SERIES] = new ChartValueSeries(context,
0,
Integer.MAX_VALUE,
new int[] {5, 10, 25, 50 },
R.string.description_sensor_cadence,
R.string.description_sensor_cadence,
R.color.cadence_fill,
R.color.cadence_border);
series[POWER_SERIES] = new ChartValueSeries(context,
0,
1000,
new int[] { 5, 50, 100, 200 },
R.string.description_sensor_power,
R.string.description_sensor_power,
R.color.power_fill,
R.color.power_border);
float scale = context.getResources().getDisplayMetrics().density;
axisPaint = new Paint();
axisPaint.setStyle(Style.STROKE);
axisPaint.setColor(context.getResources().getColor(R.color.black));
axisPaint.setAntiAlias(true);
axisPaint.setTextSize(SMALL_TEXT_SIZE * scale);
xAxisMarkerPaint = new Paint(axisPaint);
xAxisMarkerPaint.setTextAlign(Align.CENTER);
gridPaint = new Paint();
gridPaint.setStyle(Style.STROKE);
gridPaint.setColor(context.getResources().getColor(R.color.gray));
gridPaint.setAntiAlias(false);
gridPaint.setPathEffect(new DashPathEffect(new float[] { 3, 2 }, 0));
markerPaint = new Paint();
markerPaint.setStyle(Style.STROKE);
markerPaint.setColor(context.getResources().getColor(R.color.gray));
markerPaint.setAntiAlias(false);
pointer = context.getResources().getDrawable(R.drawable.arrow_180);
pointer.setBounds(0, 0, pointer.getIntrinsicWidth(), pointer.getIntrinsicHeight());
statisticsMarker = getResources().getDrawable(R.drawable.yellow_pushpin);
markerWidth = statisticsMarker.getIntrinsicWidth();
markerHeight = statisticsMarker.getIntrinsicHeight();
statisticsMarker.setBounds(0, 0, markerWidth, markerHeight);
waypointMarker = getResources().getDrawable(R.drawable.blue_pushpin);
waypointMarker.setBounds(0, 0, markerWidth, markerHeight);
scroller = new Scroller(context);
setFocusable(true);
setClickable(true);
updateDimensions();
}
/**
* Sets the enabled value for a chart value series.
*
* @param index the chart value series index
*/
public void setChartValueSeriesEnabled(int index, boolean enabled) {
series[index].setEnabled(enabled);
}
/**
* Sets chart by distance. It is expected that after changing this value, data
* will be reloaded.
*
* @param value true for by distance, false for by time
*/
public void setChartByDistance(boolean value) {
chartByDistance = value;
}
/**
* Sets metric units.
*
* @param value true to use metric units
*/
public void setMetricUnits(boolean value) {
metricUnits = value;
}
/**
* Sets report speed.
*
* @param value true to report speed
*/
public void setReportSpeed(boolean value) {
reportSpeed = value;
}
/**
* Sets show pointer.
*
* @param value true to show pointer
*/
public void setShowPointer(boolean value) {
showPointer = value;
}
/**
* Adds data points.
*
* @param dataPoints an array of data points to be added
*/
public void addDataPoints(ArrayList<double[]> dataPoints) {
synchronized (chartData) {
chartData.addAll(dataPoints);
for (int i = 0; i < dataPoints.size(); i++) {
double[] dataPoint = dataPoints.get(i);
xExtremityMonitor.update(dataPoint[0]);
for (int j = 0; j < series.length; j++) {
if (!Double.isNaN(dataPoint[j + 1])) {
series[j].update(dataPoint[j + 1]);
}
}
}
updateDimensions();
updatePaths();
}
}
/**
* Clears all data.
*/
public void reset() {
synchronized (chartData) {
chartData.clear();
xExtremityMonitor.reset();
zoomLevel = 1;
updateDimensions();
}
}
/**
* Resets scroll. To be called on the UI thread.
*/
public void resetScroll() {
scrollTo(0, 0);
}
/**
* Adds a waypoint.
*
* @param waypoint the waypoint
*/
public void addWaypoint(Waypoint waypoint) {
synchronized (waypoints) {
waypoints.add(waypoint);
}
}
/**
* Clears the waypoints.
*/
public void clearWaypoints() {
synchronized (waypoints) {
waypoints.clear();
}
}
/**
* Returns true if can zoom in.
*/
public boolean canZoomIn() {
return zoomLevel < MAX_ZOOM_LEVEL;
}
/**
* Returns true if can zoom out.
*/
public boolean canZoomOut() {
return zoomLevel > MIN_ZOOM_LEVEL;
}
/**
* Zooms in one level.
*/
public void zoomIn() {
if (canZoomIn()) {
zoomLevel++;
updatePaths();
invalidate();
}
}
/**
* Zooms out one level.
*/
public void zoomOut() {
if (canZoomOut()) {
zoomLevel--;
scroller.abortAnimation();
int scrollX = getScrollX();
int maxWidth = effectiveWidth * (zoomLevel - 1);
if (scrollX > maxWidth) {
scrollX = maxWidth;
scrollTo(scrollX, 0);
}
updatePaths();
invalidate();
}
}
/**
* Initiates flinging.
*
* @param velocityX velocity of fling in pixels per second
*/
public void fling(int velocityX) {
int maxWidth = effectiveWidth * (zoomLevel - 1);
scroller.fling(getScrollX(), 0, velocityX, 0, 0, maxWidth, 0, 0);
invalidate();
}
/**
* Scrolls the view horizontally by a given amount.
*
* @param deltaX the number of pixels to scroll
*/
public void scrollBy(int deltaX) {
int scrollX = getScrollX() + deltaX;
if (scrollX < 0) {
scrollX = 0;
}
int maxWidth = effectiveWidth * (zoomLevel - 1);
if (scrollX > maxWidth) {
scrollX = maxWidth;
}
scrollTo(scrollX, 0);
}
/**
* Called by the parent to indicate that the mScrollX/Y values need to be
* updated. Triggers a redraw during flinging.
*/
@Override
public void computeScroll() {
if (scroller.computeScrollOffset()) {
int oldX = getScrollX();
int x = scroller.getCurrX();
scrollTo(x, 0);
if (oldX != x) {
onScrollChanged(x, 0, oldX, 0);
postInvalidate();
}
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (velocityTracker == null) {
velocityTracker = VelocityTracker.obtain();
}
velocityTracker.addMovement(event);
float x = event.getX();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// Stop the fling
if (!scroller.isFinished()) {
scroller.abortAnimation();
}
lastMotionEventX = x;
break;
case MotionEvent.ACTION_MOVE:
if (lastMotionEventX == -1) {
break;
}
// Scroll to follow the motion event
int deltaX = (int) (lastMotionEventX - x);
lastMotionEventX = x;
if (deltaX < 0) {
if (getScrollX() > 0) {
scrollBy(deltaX);
}
} else if (deltaX > 0) {
int availableToScroll = effectiveWidth * (zoomLevel - 1) - getScrollX();
if (availableToScroll > 0) {
scrollBy(Math.min(availableToScroll, deltaX));
}
}
break;
case MotionEvent.ACTION_UP:
// Check if the y event is within markerHeight of the marker center
if (Math.abs(event.getY() - topBorder - spacer - markerHeight / 2) < markerHeight) {
int minDistance = Integer.MAX_VALUE;
Waypoint nearestWaypoint = null;
synchronized (waypoints) {
for (int i = 0; i < waypoints.size(); i++) {
Waypoint waypoint = waypoints.get(i);
int distance = Math.abs(
getX(getWaypointXValue(waypoint)) - (int) event.getX() - getScrollX());
if (distance < minDistance) {
minDistance = distance;
nearestWaypoint = waypoint;
}
}
}
if (nearestWaypoint != null && minDistance < markerWidth) {
Intent intent = IntentUtils.newIntent(getContext(), MarkerDetailActivity.class)
.putExtra(MarkerDetailActivity.EXTRA_MARKER_ID, nearestWaypoint.getId());
getContext().startActivity(intent);
return true;
}
}
VelocityTracker myVelocityTracker = velocityTracker;
myVelocityTracker.computeCurrentVelocity(1000);
int initialVelocity = (int) myVelocityTracker.getXVelocity();
if (Math.abs(initialVelocity) > ViewConfiguration.getMinimumFlingVelocity()) {
fling(-initialVelocity);
}
if (velocityTracker != null) {
velocityTracker.recycle();
velocityTracker = null;
}
break;
}
return true;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
updateEffectiveDimensionsIfChanged(
View.MeasureSpec.getSize(widthMeasureSpec), View.MeasureSpec.getSize(heightMeasureSpec));
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
protected void onDraw(Canvas canvas) {
synchronized (chartData) {
canvas.save();
canvas.drawColor(Color.WHITE);
canvas.save();
clipToGraphArea(canvas);
drawDataSeries(canvas);
drawWaypoints(canvas);
drawGrid(canvas);
canvas.restore();
drawSeriesTitles(canvas);
drawXAxis(canvas);
drawYAxis(canvas);
canvas.restore();
if (showPointer) {
drawPointer(canvas);
}
}
}
/**
* Clips a canvas to the graph area.
*
* @param canvas the canvas
*/
private void clipToGraphArea(Canvas canvas) {
int x = getScrollX() + leftBorder;
int y = topBorder;
canvas.clipRect(x, y, x + effectiveWidth, y + effectiveHeight);
}
/**
* Draws the data series.
*
* @param canvas the canvas
*/
private void drawDataSeries(Canvas canvas) {
for (ChartValueSeries chartValueSeries : series) {
if (chartValueSeries.isEnabled() && chartValueSeries.hasData()) {
chartValueSeries.drawPath(canvas);
}
}
}
/**
* Draws the waypoints.
*
* @param canvas the canvas
*/
private void drawWaypoints(Canvas canvas) {
synchronized (waypoints) {
for (int i = 0; i < waypoints.size(); i++) {
final Waypoint waypoint = waypoints.get(i);
if (waypoint.getLocation() == null) {
continue;
}
double xValue = getWaypointXValue(waypoint);
if (xValue > maxX) {
continue;
}
canvas.save();
float x = getX(getWaypointXValue(waypoint));
canvas.drawLine(
x, topBorder + spacer + markerHeight / 2, x, topBorder + effectiveHeight, markerPaint);
canvas.translate(
x - (float) (markerWidth * MapOverlay.WAYPOINT_X_ANCHOR), topBorder + spacer);
if (waypoints.get(i).getType() == WaypointType.STATISTICS) {
statisticsMarker.draw(canvas);
} else {
waypointMarker.draw(canvas);
}
canvas.restore();
}
}
}
/**
* Draws the grid.
*
* @param canvas the canvas
*/
private void drawGrid(Canvas canvas) {
// X axis grid
ArrayList<Double> xAxisMarkerPositions = getXAxisMarkerPositions(getXAxisInterval());
for (int i = 0; i < xAxisMarkerPositions.size(); i++) {
int x = getX(xAxisMarkerPositions.get(i));
canvas.drawLine(x, topBorder, x, topBorder + effectiveHeight, gridPaint);
}
// Y axis grid
float rightEdge = getX(maxX);
for (int i = 0; i <= Y_AXIS_INTERVALS; i++) {
double percentage = (double) i / Y_AXIS_INTERVALS;
int range = effectiveHeight - 2 * yAxisOffset;
int y = topBorder + yAxisOffset + (int) (percentage * range);
canvas.drawLine(leftBorder, y, rightEdge, y, gridPaint);
}
}
/**
* Draws series titles.
*
* @param canvas the canvas
*/
private void drawSeriesTitles(Canvas canvas) {
int[] titleDimensions = getTitleDimenions();
int lines = titleDimensions[0];
int lineHeight = titleDimensions[1];
int count = 0;
for (int i = 0; i < series.length; i++) {
ChartValueSeries chartValueSeries = series[i];
if (chartValueSeries.isEnabled() && chartValueSeries.hasData() || allowIfEmpty(i)) {
count++;
String title = getContext().getString(chartValueSeries.getTitleId(metricUnits));
Paint paint = chartValueSeries.getTitlePaint();
int x = (int) (0.5 * width) + getScrollX();
int y = topBorder - spacer - (lines - count) * (lineHeight + spacer);
canvas.drawText(title, x, y, paint);
}
}
}
/**
* Gets the title dimensions. Returns an array of 2 integers, first element is
* the number of lines and the second element is the line height.
*/
private int[] getTitleDimenions() {
int lines = 0;
int lineHeight = 0;
for (int i = 0; i < series.length; i++) {
ChartValueSeries chartValueSeries = series[i];
if (chartValueSeries.isEnabled() && chartValueSeries.hasData() || allowIfEmpty(i)) {
lines++;
String title = getContext().getString(chartValueSeries.getTitleId(metricUnits));
Rect rect = getRect(chartValueSeries.getTitlePaint(), title);
if (rect.height() > lineHeight) {
lineHeight = rect.height();
}
}
}
return new int[] { lines, lineHeight };
}
/**
* Draws the x axis.
*
* @param canvas the canvas
*/
private void drawXAxis(Canvas canvas) {
int x = getScrollX() + leftBorder;
int y = topBorder + effectiveHeight;
canvas.drawLine(x, y, x + effectiveWidth, y, axisPaint);
String label = getXAxisLabel();
Rect rect = getRect(axisPaint, label);
canvas.drawText(label, x + effectiveWidth + spacer, y + ((int) rect.height() / 2), axisPaint);
double interval = getXAxisInterval();
ArrayList<Double> markerPositions = getXAxisMarkerPositions(interval);
NumberFormat numberFormat = interval < 1 ? X_FRACTION_FORMAT : X_NUMBER_FORMAT;
for (int i = 0; i < markerPositions.size(); i++) {
drawXAxisMarker(canvas, markerPositions.get(i), numberFormat);
}
}
/**
* Gets the x axis label.
*/
private String getXAxisLabel() {
Context context = getContext();
if (chartByDistance) {
return metricUnits ? context.getString(R.string.unit_kilometer)
: context.getString(R.string.unit_mile);
} else {
return context.getString(R.string.description_time);
}
}
/**
* Draws a x axis marker.
*
* @param canvas
* @param value value
* @param numberFormat the number format
*/
private void drawXAxisMarker(Canvas canvas, double value, NumberFormat numberFormat) {
String marker = chartByDistance ? numberFormat.format(value)
: StringUtils.formatElapsedTime((long) value);
Rect rect = getRect(xAxisMarkerPaint, marker);
canvas.drawText(marker, getX(value), topBorder + effectiveHeight + spacer + rect.height(),
xAxisMarkerPaint);
}
/**
* Gets the x axis interval.
*/
private double getXAxisInterval() {
double interval = maxX / zoomLevel / TARGET_X_AXIS_INTERVALS;
if (interval < 1) {
interval = .5;
} else if (interval < 5) {
interval = 2;
} else if (interval < 10) {
interval = 5;
} else {
interval = (interval / 10) * 10;
}
return interval;
}
/**
* Gets the x axis marker positions.
*/
private ArrayList<Double> getXAxisMarkerPositions(double interval) {
ArrayList<Double> markers = new ArrayList<Double>();
markers.add(0d);
for (int i = 1; i * interval < maxX; i++) {
markers.add(i * interval);
}
// At least 2 markers
if (markers.size() < 2) {
markers.add(maxX);
}
return markers;
}
/**
* Draws the y axis.
*
* @param canvas the canvas
*/
private void drawYAxis(Canvas canvas) {
int x = getScrollX() + leftBorder;
int y = topBorder;
canvas.drawLine(x, y, x, y + effectiveHeight, axisPaint);
int markerXPosition = x - spacer;
for (int i = 0; i < series.length; i++) {
int index = series.length - 1 - i;
ChartValueSeries chartValueSeries = series[index];
if (chartValueSeries.isEnabled() && chartValueSeries.hasData() || allowIfEmpty(index)) {
markerXPosition -= drawYAxisMarkers(chartValueSeries, canvas, markerXPosition) + spacer;
}
}
}
/**
* Draws the y axis markers for a chart value series.
*
* @param chartValueSeries the chart value series
* @param canvas the canvas
* @param xPosition the right most x position
* @return the maximum marker width.
*/
private float drawYAxisMarkers(ChartValueSeries chartValueSeries, Canvas canvas, int xPosition) {
int interval = chartValueSeries.getInterval();
float maxMarkerWidth = 0;
for (int i = 0; i <= Y_AXIS_INTERVALS; i++) {
maxMarkerWidth = Math.max(maxMarkerWidth, drawYAxisMarker(chartValueSeries, canvas, xPosition,
i * interval + chartValueSeries.getMinMarkerValue()));
}
return maxMarkerWidth;
}
/**
* Draws a y axis marker.
*
* @param chartValueSeries the chart value series
* @param canvas the canvas
* @param xPosition the right most x position
* @param yValue the y value
* @return the marker width.
*/
private float drawYAxisMarker(
ChartValueSeries chartValueSeries, Canvas canvas, int xPosition, int yValue) {
String marker = chartValueSeries.formatMarker(yValue);
Paint paint = chartValueSeries.getMarkerPaint();
Rect rect = getRect(paint, marker);
int yPosition = getY(chartValueSeries, yValue) + (int) (rect.height() / 2);
canvas.drawText(marker, xPosition, yPosition, paint);
return paint.measureText(marker);
}
/**
* Draws the current pointer.
*
* @param canvas the canvas
*/
private void drawPointer(Canvas canvas) {
int index = -1;
for (int i = 0; i < series.length; i++) {
ChartValueSeries chartValueSeries = series[i];
if (chartValueSeries.isEnabled() && chartValueSeries.hasData()) {
index = i;
break;
}
}
if (index != -1 && chartData.size() > 0) {
int dx = getX(maxX) - pointer.getIntrinsicWidth() / 2;
int dy = getY(series[index], chartData.get(chartData.size() - 1)[index + 1])
- pointer.getIntrinsicHeight();
canvas.translate(dx, dy);
pointer.draw(canvas);
}
}
/**
* Updates paths. The path needs to be updated any time after the data or the
* dimensions change.
*/
private void updatePaths() {
synchronized (chartData) {
for (ChartValueSeries chartValueSeries : series) {
chartValueSeries.getPath().reset();
}
drawPaths();
closePaths();
}
}
/**
* Draws all paths.
*/
private void drawPaths() {
boolean[] hasMoved = new boolean[series.length];
for (int i = 0; i < chartData.size(); i++) {
double[] dataPoint = chartData.get(i);
for (int j = 0; j < series.length; j++) {
double value = dataPoint[j + 1];
if (Double.isNaN(value)) {
continue;
}
ChartValueSeries chartValueSeries = series[j];
Path path = chartValueSeries.getPath();
int x = getX(dataPoint[0]);
int y = getY(chartValueSeries, value);
if (!hasMoved[j]) {
hasMoved[j] = true;
path.moveTo(x, y);
} else {
path.lineTo(x, y);
}
}
}
}
/**
* Closes all paths.
*/
private void closePaths() {
for (int i = 0; i < series.length; i++) {
int first = getFirstPopulatedChartDataIndex(i);
if (first != -1) {
int xCorner = getX(chartData.get(first)[0]);
int yCorner = topBorder + effectiveHeight;
ChartValueSeries chartValueSeries = series[i];
Path path = chartValueSeries.getPath();
// Bottom right corner
path.lineTo(getX(chartData.get(chartData.size() - 1)[0]), yCorner);
// Bottom left corner
path.lineTo(xCorner, yCorner);
// Top right corner
path.lineTo(xCorner, getY(chartValueSeries, chartData.get(first)[i + 1]));
}
}
}
/**
* Finds the index of the first data point containing data for a series.
* Returns -1 if no data point contains data for the series.
*
* @param seriesIndex the series's index
*/
private int getFirstPopulatedChartDataIndex(int seriesIndex) {
for (int i = 0; i < chartData.size(); i++) {
if (!Double.isNaN(chartData.get(i)[seriesIndex + 1])) {
return i;
}
}
return -1;
}
/**
* Updates the chart dimensions.
*/
private void updateDimensions() {
maxX = xExtremityMonitor.hasData() ? xExtremityMonitor.getMax() : 1.0;
for (ChartValueSeries chartValueSeries : series) {
chartValueSeries.updateDimension();
}
float density = getContext().getResources().getDisplayMetrics().density;
spacer = (int) (density * SPACER);
yAxisOffset = (int) (density * Y_AXIS_OFFSET);
int markerLength = 0;
for (int i = 0; i < series.length; i ++) {
ChartValueSeries chartValueSeries = series[i];
if (chartValueSeries.isEnabled() && chartValueSeries.hasData() || allowIfEmpty(i)) {
Rect rect = getRect(chartValueSeries.getMarkerPaint(), chartValueSeries.getLargestMarker());
markerLength += rect.width() + spacer;
}
}
leftBorder = (int) (density * BORDER + markerLength);
int[] titleDimensions = getTitleDimenions();
topBorder = (int) (density * BORDER + titleDimensions[0] * (titleDimensions[1] + spacer));
bottomBorder = (int) (density * BORDER + getRect(xAxisMarkerPaint, "1").height() + spacer);
rightBorder = (int) (density * BORDER + getRect(axisPaint, getXAxisLabel()).width() + spacer);
updateEffectiveDimensions();
}
/**
* Updates the effective dimensions.
*/
private void updateEffectiveDimensions() {
effectiveWidth = Math.max(0, width - leftBorder - rightBorder);
effectiveHeight = Math.max(0, height - topBorder - bottomBorder);
}
/**
* Updates the effective dimensions if changed.
*
* @param newWidth the new width
* @param newHeight the new height
*/
private void updateEffectiveDimensionsIfChanged(int newWidth, int newHeight) {
if (width != newWidth || height != newHeight) {
width = newWidth;
height = newHeight;
updateEffectiveDimensions();
updatePaths();
}
}
/**
* Gets the x position for a value.
*
* @param value the value
*/
private int getX(double value) {
if (value > maxX) {
value = maxX;
}
double percentage = value / maxX;
return leftBorder + (int) (percentage * effectiveWidth * zoomLevel);
}
/**
* Gets the y position for a value in a chart value series
*
* @param chartValueSeries the chart value series
* @param value the value
*/
private int getY(ChartValueSeries chartValueSeries, double value) {
int effectiveSpread = chartValueSeries.getInterval() * Y_AXIS_INTERVALS;
double percentage = (value - chartValueSeries.getMinMarkerValue()) / effectiveSpread;
int rangeHeight = effectiveHeight - 2 * yAxisOffset;
return topBorder + yAxisOffset + (int) ((1 - percentage) * rangeHeight);
}
/**
* Gets a waypoint's x value.
*
* @param waypoint the waypoint
*/
private double getWaypointXValue(Waypoint waypoint) {
if (chartByDistance) {
double lenghtInKm = waypoint.getLength() * UnitConversions.M_TO_KM;
return metricUnits ? lenghtInKm : lenghtInKm * UnitConversions.KM_TO_MI;
} else {
return waypoint.getDuration();
}
}
/**
* Gets a paint's Rect for a string.
*
* @param paint the paint
* @param string the string
*/
private Rect getRect(Paint paint, String string) {
Rect rect = new Rect();
paint.getTextBounds(string, 0, string.length(), rect);
return rect;
}
/**
* Returns true if the index is allowed when the chartData is empty.
*
* @param index the index
*/
private boolean allowIfEmpty(int index) {
if (!chartData.isEmpty()) {
return false;
}
switch (index) {
case ELEVATION_SERIES:
return true;
case SPEED_SERIES:
return reportSpeed;
case PACE_SERIES:
return !reportSpeed;
default:
return false;
}
}
/**
* Returns the status of metricUnits.
*
* @return the status of metricUnits
*/
@VisibleForTesting
public boolean isMetricUnits() {
return metricUnits;
}
}
| [
"youtaol@youtaol.bej.corp.google.com"
] | youtaol@youtaol.bej.corp.google.com |
ae3520523d47e7f86980cb727094cf620e17adcc | e85a519fbc05ced36aa732cb197b6ee3cf27352d | /mdo-core/authentication/src/main/java/fr/mch/mdo/restaurant/services/authorization/jaas/MdoAuthorizationServiceImpl.java | 49a2bec911e7bbaeaf74159caa8e6148da6347aa | [] | no_license | mathieu-ma/montagnesdor | 1791fae256c7525e0f2a23a2cd7f03ca65ca13bb | e149fc14253b60d30a9e98f6c7b467b807ec5d65 | refs/heads/master | 2021-01-23T11:48:43.639476 | 2014-08-20T20:41:27 | 2014-08-20T20:41:27 | 3,204,171 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,824 | java | package fr.mch.mdo.restaurant.services.authorization.jaas;
import java.security.AccessControlException;
import java.security.Permission;
import java.security.PrivilegedAction;
import javax.security.auth.Subject;
import fr.mch.mdo.logs.ILogger;
import fr.mch.mdo.restaurant.authorization.IMdoAuthorizationService;
import fr.mch.mdo.restaurant.services.logs.LoggerServiceImpl;
/**
* @author Mathieu MA
*
* To change this generated comment edit the template variable
* "typecomment": Window>Preferences>Java>Templates. To enable and
* disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class MdoAuthorizationServiceImpl implements IMdoAuthorizationService
{
private static class LazyHolder {
private static IMdoAuthorizationService instance = new MdoAuthorizationServiceImpl(
LoggerServiceImpl.getInstance().getLogger(MdoAuthorizationServiceImpl.class.getName()));
}
public static IMdoAuthorizationService getInstance() {
return LazyHolder.instance;
}
private ILogger logger;
private MdoAuthorizationServiceImpl(ILogger logger) {
this();
this.logger = logger;
}
public MdoAuthorizationServiceImpl() {
}
public Permission getPermission(String url) {
return new URLPermission(url);
}
public String permitted(final Subject subject, final String pageReq) {
final SecurityManager securityManager;
if (System.getSecurityManager() == null) {
securityManager = new SecurityManager();
} else {
securityManager = System.getSecurityManager();
}
try {
this.getLogger().debug("message.debug.permitted.action", new String[] { pageReq });
String result = (String) Subject.doAsPrivileged(subject, new PrivilegedAction<String>() {
public String run() {
String path = null;
try {
Permission permission = getPermission(pageReq);
securityManager.checkPermission(permission);
path = pageReq;
} catch (Exception e) {
getLogger().error("message.error.permitted.action", new String[] { pageReq + " " + e.getMessage() });
}
return path;
}
}, null);
if (result == null) {
this.getLogger().error("message.error.permitted.action", new String[] { pageReq });
}
return result;
} catch (AccessControlException e) {
this.getLogger().error("message.error.permitted.action", new String[] { pageReq + " " + e.getMessage() });
return null;
} catch (Exception e) {
this.getLogger().error("message.error.permitted.action", new String[] { pageReq + " " + e.getMessage() });
return null;
}
}
@Override
public ILogger getLogger() {
return logger;
}
@Override
public void setLogger(ILogger logger) {
this.logger = logger;
}
}
| [
"mathieu.ma.dev@free.fr"
] | mathieu.ma.dev@free.fr |
a3d08dabfd54f8ecb03da2db6ff24f2c9ccd6dc6 | 9a3cbdb19cc093974604719357b0975834e673b7 | /network/src/main/java/me/w5e/sdk/network/request/UploadFileProcessor.java | 85662bdd06dd997acc0e3a5d7cf79e5e80f1d3f8 | [
"Apache-2.0"
] | permissive | hustliubo/Tomoko-Android | 1648dca45f4d4f75628c2145ea63d4f99125e86a | 530ca014d3959c2fc610861de9d07db0498b0859 | refs/heads/master | 2020-05-27T07:54:11.304697 | 2019-02-15T13:07:10 | 2019-02-15T13:07:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,686 | java | /*
* Copyright (c) 2019 CELLA
* 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 me.w5e.sdk.network.request;
import android.util.Log;
import androidx.annotation.NonNull;
import me.w5e.sdk.network.HttpClient;
import me.w5e.sdk.network.progress.ProgressListener;
import me.w5e.sdk.network.progress.ProgressRequestBody;
import okhttp3.RequestBody;
import java.io.File;
/**
* Created by w5e on 2018/7/31.
*/
public abstract class UploadFileProcessor<T> extends HttpClient.RequestProcessor<T> {
protected File mFile;
private ProgressListener mListener;
public UploadFileProcessor(@NonNull HttpClient httpClient,
@NonNull File file, ProgressListener progressListener) {
super(httpClient);
mFile = file;
mListener = progressListener;
}
@NonNull
@Override
protected final RequestBody getRequestBody() {
RequestBody requestBody = new ProgressRequestBody(
RequestBody.create(HttpClient.CONTENT_TYPE_DEFAULT, mFile), mListener);
if (HttpClient.DEBUG) {
Log.d(HttpClient.TAG, "Upload: " + mFile);
}
return requestBody;
}
}
| [
"waynegreen@outlook.com"
] | waynegreen@outlook.com |
944d8a77cbaf3ae96b1cb646887e845f474fcbf5 | 268592c417a8f6fbcfec98a8af17d7cb9f1f6cee | /debop4k-data-mybatis/src/test/java/debop4k/data/mybatis/cache/EhCacheConfiguration.java | 0129320c46a29075336f3f069e66f6e9df1581cd | [
"Apache-2.0"
] | permissive | debop/debop4k | 8a8e29e76b590e72599fb69888c2eb2e90952c10 | 5a621998b88b4d416f510971536abf3bf82fb2f0 | refs/heads/develop | 2021-06-14T22:48:58.156606 | 2019-08-06T15:49:34 | 2019-08-06T15:49:34 | 60,844,667 | 37 | 12 | Apache-2.0 | 2021-04-22T17:45:14 | 2016-06-10T12:01:14 | Kotlin | UTF-8 | Java | false | false | 2,767 | java | /*
* Copyright (c) 2016. Sunghyouk Bae <sunghyouk.bae@gmail.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 debop4k.data.mybatis.cache;
import debop4k.data.mybatis.config.MyBatisConfiguration;
import lombok.extern.slf4j.Slf4j;
import net.sf.ehcache.config.CacheConfiguration;
import net.sf.ehcache.config.Configuration;
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.ehcache.EhCacheCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
/**
* EhCache 환경설정을 Java Config 에서 설정한 예제입니다.
*
* @author sunghyouk.bae@gmail.com
*/
@Slf4j
@EnableCaching(proxyTargetClass = true)
@ComponentScan(basePackageClasses = {EhCacheActorRepository.class})
public class EhCacheConfiguration extends MyBatisConfiguration {
/**
* EhCache 사용을 위한 환경설정 정보
*/
@Bean
public Configuration ehcacheConfiguration() {
Configuration cfg = new Configuration();
// NOTE: EhCache 는 미리 cache 를 정의해주어야 한다. ( resources 의 ehcache.xml 을 보면 자세한 속성 및 설명이 있습니다 )
// 다른 캐시 서버는 그럴 필요가 없다. (Memcached, Redis, Hazelcast, Apache Ignite)
//
cfg.addCache(new CacheConfiguration("ehcache-actors", 10000));
cfg.addCache(new CacheConfiguration("ehcache-company", 10000));
cfg.setName("mybatis-ehcache-manager-by-java-config");
return cfg;
}
/**
* EhCache 의 CacheManager
*
* @param cfg EhCache 의 환경설정
*/
@Bean
public net.sf.ehcache.CacheManager cacheManager(Configuration cfg) {
return new net.sf.ehcache.CacheManager(cfg);
}
/**
* Spring 의 CacheManager
*
* @param ehcacheManager EhCache의 CacheManager
*/
@Bean
public CacheManager ehcacheCacheManager(net.sf.ehcache.CacheManager ehcacheManager) {
EhCacheCacheManager cm = new EhCacheCacheManager(ehcacheManager);
if (cm.getCache("ehcache-actors") == null) {
throw new RuntimeException("Cache 설정이 잘못되었습니다.");
}
log.info("Create EhCache CacheManagner instance.");
return cm;
}
}
| [
"sunghyouk.bae@gmail.com"
] | sunghyouk.bae@gmail.com |
75b1cbd716e821cded3dae3a2200f693a8c24b42 | 870f62cf75fcfa80268fd60f458d6f37b9f417c0 | /employeemanagementsystem.java | 60bf815c14e0bc69e0e94d8312412ec3bd6c7738 | [] | no_license | Shivanandh1/Employeesmanagement | d251f09e74c9ff772de3f4973bff771a592ed50c | 39f09401df4c67943e2dc9420d8dc02edbeab51d | refs/heads/main | 2023-08-15T07:27:35.725949 | 2021-10-04T18:26:16 | 2021-10-04T18:26:16 | 391,978,140 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,989 | java |
/******************** Importing Essential Libraries ************************/
import java.util.*;
import java.io.*;
/*************************** MENU OF EMS ****************************/
class MainMenu
{
public void menu()
{
System.out.println("*******************************************");
System.out.println("\t EMPLOYEE MANAGEMENT SYSTEM");
System.out.println("*******************************************");
System.out.println("\t\t\t--------------------");
System.out.println("\t\t\t ~$ shivanandh");
System.out.println("\t\t\t--------------------");
System.out.println("\n\nPress 1 : To Add an Employee Details");
System.out.println("Press 2 : To See an Employee Details ");
System.out.println("Press 3 : To Remove an Employee");
System.out.println("Press 4 : To Update Employee Details");
System.out.println("Press 5 : To Exit the EMS Portal");
}
}
/************************ To add details of Employee *********************/
class Employee_Add
{
public void createFile()
{
Scanner sc=new Scanner(System.in);
EmployDetail emp=new EmployDetail();
emp.getInfo();
try{
File f1=new File("file"+emp.employ_id+".txt");
if(f1.createNewFile()){
FileWriter myWriter = new FileWriter("file"+emp.employ_id+".txt");
myWriter.write("Employee ID:"+emp.employ_id+"\n"+"Employee Name :"+emp.name+"\n"+
"Father's Name :"+emp.father_name+"\n"+"Employee Contact :"+emp.employ_contact+"\n"+
"Email Information :"+emp.email+"\n"+"Employee position :"+emp.position+"\n"+
"Employee Salary :"+emp.employ_salary);
myWriter.close();
System.out.println("\nEmployee has been Added :)\n");
System.out.print("\nPress Enter to Continue...");
sc.nextLine();
}
else {
System.out.println("\nEmployee already exists :(");
System.out.print("\nPress Enter to Continue...");
sc.nextLine();
}
}
catch(Exception e){System.out.println(e);}
}
}
/************************* Taking Employee Details ************************/
class EmployDetail
{
String name;
String father_name;
String email;
String position;
String employ_id;
String employ_salary;
String employ_contact;
public void getInfo()
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter Employee's name --------: ");
name=sc.nextLine();
System.out.print("Enter Employee's Father name -: ");
father_name=sc.nextLine();
System.out.print("Enter Employee's ID ----------: ");
employ_id=sc.nextLine();
System.out.print("Enter Employee's Email ID ----: ");
email=sc.nextLine();
System.out.print("Enter Employee's Position ----: ");
position=sc.nextLine();
System.out.print("Enter Employee contact Info --: ");
employ_contact=sc.nextLine();
System.out.print("Enter Employee's Salary ------: ");
employ_salary=sc.nextLine();
}
}
/************************ To Show details of Employee *********************/
class Employee_Show
{
public void viewFile(String s) throws Exception
{
File file = new File("file"+s+".txt");
Scanner sc = new Scanner(file);
while (sc.hasNextLine())
{
System.out.println(sc.nextLine());
}
}
}
/***************************** To Remove Employee *************************/
class Employee_Remove
{
public void removeFile(String ID)
{
File file = new File("file"+ID+".txt");
if(file.exists())
{
if(file.delete());
{
System.out.println("\nEmployee has been removed Successfully");
}
}
else
{
System.out.println("\nEmployee does not exists :( ");
}
}
}
/************************ To Update details of Employee ********************/
class Employee_Update
{
public void updateFile(String s,String o,String n) throws IOException
{
File file = new File("file"+s+".txt");
Scanner sc = new Scanner(file);
String fileContext="";
while (sc.hasNextLine())
{
fileContext =fileContext+"\n"+sc.nextLine();
}
FileWriter myWriter = new FileWriter("file"+s+".txt");
fileContext = fileContext.replaceAll(o,n);
myWriter.write(fileContext);
myWriter.close();
}
}
/************************ To Exit from the EMS Portal *********************/
class CodeExit
{
public void out()
{
System.out.println("\n*****************************************");
System.out.println("$ cat Thank You For Using my Software :) ");
System.out.println("*****************************************");
System.out.println("\t\t/~ <0d3d by Abhinav Dubey\n");
System.exit(0);
}
}
/***************************** Main Class *******************************/
class EmployManagementSystem
{
public static void main(String arv[])
{
/** To clear the output Screen **/
System.out.print("\033[H\033[2J");
Scanner sc=new Scanner(System.in);
Employee_Show epv =new Employee_Show();
int i=0;
/*** Callining Mainmenu Class function ****/
MainMenu obj1 = new MainMenu();
obj1.menu();
/*** Initialising loop for Menu Choices ***/
while(i<6)
{
System.out.print("\nPlease Enter choice :");
i=Integer.parseInt(sc.nextLine());
/** Switch Case Statements **/
switch(i)
{
case 1:
{
/** Creating class's object and calling Function using that object **/
Employee_Add ep =new Employee_Add();
ep.createFile();
System.out.print("\033[H\033[2J");
obj1.menu();
break;
}
case 2:
{
System.out.print("\nPlease Enter Employee's ID :");
String s=sc.nextLine();
try
{
epv.viewFile(s);}
catch(Exception e){System.out.println(e);}
System.out.print("\nPress Enter to Continue...");
sc.nextLine();
System.out.print("\033[H\033[2J");
obj1.menu();
break;
}
case 3:
{
System.out.print("\nPlease Enter Employee's ID :");
String s=sc.nextLine();
Employee_Remove epr =new Employee_Remove();
epr.removeFile(s);
System.out.print("\nPress Enter to Continue...");
sc.nextLine();
System.out.print("\033[H\033[2J");
obj1.menu();
break;
}
case 4:
{
System.out.print("\nPlease Enter Employee's ID :");
String I=sc.nextLine();
try
{
epv.viewFile(I);
}
catch(Exception e)
{
System.out.println(e);
}
Employee_Update epu = new Employee_Update();
System.out.print("Please Enter the detail you want to Update :");
System.out.print("\nFor Example :\n");
System.out.println("If you want to Change the Name, then Enter Current Name and Press Enter. Then write the new Name then Press Enter. It will Update the Name.\n");
String s=sc.nextLine();
System.out.print("Please Enter the Updated Info :");
String n=sc.nextLine();
try
{
epu.updateFile(I,s,n);
System.out.print("\nPress Enter to Continue...");
sc.nextLine();
System.out.print("\033[H\033[2J");
obj1.menu();
break;
}
catch(IOException e)
{
System.out.println(e);
}
}
case 5:
{
CodeExit obj = new CodeExit();
obj.out();
}
}
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
169e982b3e4a56052d3022365f5e52ad32893488 | 63fccace7fbf944db412adcae79b40a459c10f47 | /Project_Code/FiberFiyatHesaplama/src/tayfunerkorkmaz/designpatterns/observer/Observer.java | aa9347607ab62472fef4c85cf92cd1c5db8901bf | [] | no_license | tayfunerkorkmaz/FiberFiyatHesaplama | bc859391cb6fa02dfc520709f199855442c1da7c | 8bea7128cb64de0c8d993b5cb4696ec163b4e8fb | refs/heads/master | 2020-04-30T04:04:06.688739 | 2019-06-18T05:06:04 | 2019-06-18T05:06:04 | 176,602,644 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 364 | 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 tayfunerkorkmaz.designpatterns.observer;
/**
*
* @author tayfunerkorkmaz
*/
public interface Observer {
public boolean update(double dolarKur, double euroKur);
}
| [
"tayfunerkorkmaz@gmail.com"
] | tayfunerkorkmaz@gmail.com |
332bfc4f1ba4622b3a62da323f984bda4c66a536 | ad190ac30bd0e9ad009684457f1138cf9177f373 | /src/main/java/trashsoftware/deepSearcher/itemUnits/SpecialFile.java | 3d705ca47628c2d42fcd0da96e3e1c44d159b83f | [
"Apache-2.0"
] | permissive | ZhangBohan233/DeepSearcher | e2a6ac9eec3a09524d6b50b7599e3d47002019ef | aa067fb8f922a2b66878beaa8b7850ba31d8edf5 | refs/heads/master | 2022-07-15T04:11:59.223439 | 2021-04-16T18:58:30 | 2021-04-16T18:58:30 | 183,555,280 | 0 | 0 | Apache-2.0 | 2022-06-29T17:20:15 | 2019-04-26T04:12:39 | Java | UTF-8 | Java | false | false | 838 | java | package trashsoftware.deepSearcher.itemUnits;
import java.io.File;
public class SpecialFile extends File {
/**
* Constructor of a new SpecialFile object.
*
* @param path the absolute path of this SpecialFile object.
*/
public SpecialFile(String path) {
super(path);
}
/**
* Returns a readable String object.
* <p>
* This method overrides the "toString" method of the File class. It returns only the native name of this file.
*
* @return the native name of this file.
*/
@Override
public String toString() {
String result = super.getName();
if (result.length() == 0) {
return super.toString();
} else if (super.isDirectory()) {
return result;
} else {
return null;
}
}
}
| [
"bokhaam.zhang@mail.utoronto.ca"
] | bokhaam.zhang@mail.utoronto.ca |
7b0b0beeeb0fdb52722929fb0e80b874d48149d7 | f0eb073e47fd6e5e47bf6c0846a5f7755f3d29db | /youchat-creative-factory/src/main/java/com/youchat/creative/factory/http/HttpHeader.java | a122c9270ea47a1f6886976fa18107e2a7d99ee6 | [] | no_license | Lien6o/youchat | 285e880bb8871ee1b226ede936580732624b3d91 | d3564275fcd26f80bb81f3e1c76b5168bed01d39 | refs/heads/master | 2022-10-12T12:32:05.880597 | 2021-04-02T12:25:21 | 2021-04-02T12:25:21 | 144,699,046 | 1 | 1 | null | 2022-10-05T00:06:08 | 2018-08-14T09:31:45 | Java | UTF-8 | Java | false | false | 3,118 | java | package com.youchat.creative.factory.http;
import com.google.common.base.Splitter;
import lombok.Data;
import lombok.SneakyThrows;
import java.io.BufferedReader;
import java.net.URLDecoder;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// GET /lienbo HTTP/1.1
// Host: 127.0.0.1:8080
// Connection: keep-alive
// Cache-Control: max-age=0
// Upgrade-Insecure-Requests: 1
// User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_2_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36
// Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
// Sec-Fetch-Site: none
// Sec-Fetch-Mode: navigate
// Sec-Fetch-User: ?1
// Sec-Fetch-Dest: document
// Accept-Encoding: gzip, deflate, br
// Accept-Language: zh-CN,zh;q=0.9,zh-TW;q=0.8,en;q=0.7
@Data
public class HttpHeader {
@SneakyThrows
public HttpHeader(BufferedReader reader) {
String first = reader.readLine();
List<String> strings = Splitter.on(' ').splitToList(first);
String s = strings.get(0);
switch (s){
case "GET":
this.requestMethod = HttpEnum.GET;
break;
case "POST":
this.requestMethod = HttpEnum.POST;
break;
default:
throw new IllegalStateException("Unexpected value: " + s);
}
this.path = strings.get(1);
this.httpVersion = strings.get(2);
this.paramMap = getParameter(this.path);
for (; ; ) {
String header = reader.readLine();
// 读取到空行时, HTTP Header读取完毕
if (header.isEmpty()) {
break;
}
System.out.println(header);
}
}
private Map<String,String> paramMap;
private HttpEnum requestMethod;
private String path;
private String httpVersion;
private String host;
private String connection;
private String cacheControl;
private String upgradeInsecureRequests;
private String userAgent;
private String acceptEncoding;
private String acceptLanguage;
private static Map<String, String> getParameter(String url) {
Map<String, String> map = new HashMap<>();
try {
final String charset = "utf-8";
url = URLDecoder.decode(url, charset);
if (url.indexOf('?') != -1) {
final String contents = url.substring(url.indexOf('?') + 1);
String[] keyValues = contents.split("&");
for (int i = 0; i < keyValues.length; i++) {
String key = keyValues[i].substring(0, keyValues[i].indexOf("="));
String value = keyValues[i].substring(keyValues[i].indexOf("=") + 1);
map.put(key, value);
}
}
} catch (Exception e) {
e.printStackTrace();
}
return map;
}
}
| [
"lienbo@meituan.com"
] | lienbo@meituan.com |
c328dc79584992136869ff98c02f483073b8644d | 4007f34e7fa7d7fd91e8211e2fa1a717f424abb1 | /Java8SAM/src/SAM/ABImplementation.java | ea65108f84cb3b49d5426927e812c18ac31ad3bd | [] | no_license | chvnaveenkumar/Java8-Practice | 93d838e46a407cb4332162ea8bdd59ff41786064 | 316e6e8079238e28d1272f0f33443399af16d89d | refs/heads/master | 2020-04-29T13:49:51.046634 | 2019-04-02T05:20:47 | 2019-04-02T05:20:47 | 176,179,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 566 | java | package SAM;
public class ABImplementation {
public static void main(String args[]) {
// General Implmentation
A aObj = new A() {
public String m1() {
return "Testing Anonymous impl for interface ..";
}
};
System.out.println(aObj.m1());
System.out.println(aObj.wish());
A a1 = () -> "Testing Lambda";
System.out.println(a1.m1());
A a2 = () -> { return "My New Imp1 FOR A"; };
System.out.println(a2.m1());
B b = (s1,s2) -> { return s1+" Hello "+s2; };
b.test("New User!!", " Test");
b.testB();
B.helloB();
}
}
| [
"s530742@ol23201m.nwmissouri.edu"
] | s530742@ol23201m.nwmissouri.edu |
bc4a3bea8b7afa5edaed47c2c2f99fb2d15f40ce | 50ea43b60512f187fb09b84ab50c27dc10d69f46 | /TP5r EX3/src/PokemonDeMer.java | a019aca4354fd01500e9cf2dc05123568f76d6ba | [] | no_license | Anissa-BH/Gestion-cinema | 1356b959c49eea57a3541fdb3d4b8ddb4edc0fa4 | a67d6f408c4bb150c0f1e1dc8f336b7af2439f99 | refs/heads/master | 2020-04-16T16:31:08.082777 | 2019-11-08T22:17:07 | 2019-11-08T22:17:07 | 165,740,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java |
public class PokemonDeMer extends Pokemon {
private int nbrNageaoires;
public PokemonDeMer(String nom,double poids,int nbrNageaoires) {
super(nom,poids);
this.nbrNageaoires=nbrNageaoires;
}
public int getNbrNageaoires() {
return nbrNageaoires;
}
public void setNbrNageaoires(int nbrnageaoires) {
this.nbrNageaoires=nbrnageaoires;
}
public String toString() {
return super.toString()+" \n Nombre de nageoires: "+nbrNageaoires;
}
}
| [
"anissabenhafsia@gmail.com"
] | anissabenhafsia@gmail.com |
2d245c54f9ddbb48e40a7f5dd97fbbb55c0d3f12 | e9bdd67d310f9637b06462537385c00aa41ad8ac | /src/transactions/TheMainClass.java | 20aed975146366dd74f20c2c200671ca6c6a1ff3 | [] | no_license | rohitAgarwal86/MapReduceSampleProjects | 3d01bc3d49fce840fa93a052073b55e296a99b0f | 960165fb43b2f9edca667772b70d38839a708577 | refs/heads/master | 2022-11-28T01:20:35.929756 | 2020-08-02T09:38:09 | 2020-08-02T09:38:09 | 284,432,014 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package transactions;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
import org.apache.hadoop.mapreduce.lib.input.*;
public class TheMainClass {
@SuppressWarnings("deprecation")
public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
// TODO Auto-generated method stub
Configuration conf = new Configuration();
Job job = new Job(conf, "the transaction Program");
job.setJarByClass(TheMainClass.class);
job.setMapperClass(MyMapper2.class);
job.setReducerClass(MyReducer2.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(IntWritable.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(DoubleWritable.class);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}
| [
"37442290+rohitAgarwal86@users.noreply.github.com"
] | 37442290+rohitAgarwal86@users.noreply.github.com |
bee735df4e74355793964a9102bdb4debe5b2c56 | fa0fd5a17814fee7218bf0fe9ab190722b3e9131 | /Blood bank application/Final_Project/src/business/Organization/PharmacistOrganization.java | 97845636cbca692e1749f0b1d093457e8ae423a5 | [] | no_license | kaustubhchaudhari/Projects | 29923e4d9cd717b41de64fb514c90d73f1480eac | 9a6337317c77e5c15ad6a4eae97096396d7f4097 | refs/heads/master | 2021-01-23T13:08:14.687893 | 2018-10-02T17:53:11 | 2018-10-02T17:53:11 | 93,222,656 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | 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 business.Organization;
import business.Role.PharmacistRole;
import business.Role.ReceptionRole;
import business.Role.Role;
import java.util.ArrayList;
/**
*
* @author Kaustubh Chaudhari
*/
public class PharmacistOrganization extends Organization{
public PharmacistOrganization() {
super(Organization.Type.Pharmacist.getValue());
}
@Override
public ArrayList<Role> getSupportedRole() {
ArrayList<Role> roles = new ArrayList();
roles.add(new PharmacistRole());
return roles;
}
}
| [
"chaudhari.k@husky.neu.edu"
] | chaudhari.k@husky.neu.edu |
c4b41d595e8710ee7a5e9912f3f4e3e4b89f6238 | 571a9a707f2af883d7b1b1efba035d4789f86a17 | /BasicCode/MapCodeDemo/src/demo04.java | eaf00398d5e584f1fcce9f8690b8f7e02c753128 | [] | no_license | monster6699/JavaBasicsCode | 8c50610efdd2128e0a690fc4bb890090e4325ccd | 22f484de449addb51abca06dde96f86dff0ec679 | refs/heads/master | 2023-01-31T22:10:50.089539 | 2020-12-09T10:48:36 | 2020-12-09T10:48:36 | 296,530,514 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,267 | java | import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class demo04 {
public static void main(String[] args) {
ArrayList<HashMap<String, String>> hashMaps = new ArrayList<>();
HashMap<String, String> stringStringHashMap1 = new HashMap<>();
stringStringHashMap1.put("name", "one");
stringStringHashMap1.put("address", "BeiJing");
HashMap<String, String> stringStringHashMap2 = new HashMap<>();
stringStringHashMap2.put("name", "two");
stringStringHashMap2.put("address", "ShangHai");
HashMap<String, String> stringStringHashMap3 = new HashMap<>();
stringStringHashMap3.put("name", "three");
stringStringHashMap3.put("address", "Shengzheng");
hashMaps.add(stringStringHashMap1);
hashMaps.add(stringStringHashMap2);
hashMaps.add(stringStringHashMap3);
for (HashMap<String, String> hm :
hashMaps) {
Set<Map.Entry<String, String>> entries = hm.entrySet();
for (Map.Entry<String, String> me: entries
) {
System.out.println(me.getKey() + "," + me.getValue());
}
}
}
}
| [
"chenhu@chinafocus.net"
] | chenhu@chinafocus.net |
558df6c089757896bb91f2966a9c0d0b59f406c9 | 1ce83661fca309ff5536f2df645017f6541ddb32 | /src/main/java/com/qf/controller/UserController.java | 6b5d49724fc8bfc95735845d96295ffe9dfc8ef9 | [] | no_license | Aisa-GitHub/ssm | ad82c7d5db7dd713ca6f5d6c02b55127e5530da3 | 06b4edc469f0e15ee8530c68a7e44680309a8edb | refs/heads/master | 2022-12-22T06:37:07.733544 | 2019-07-19T14:18:34 | 2019-07-19T14:18:34 | 197,787,580 | 0 | 0 | null | 2022-12-16T11:54:01 | 2019-07-19T14:31:26 | JavaScript | UTF-8 | Java | false | false | 4,979 | java | package com.qf.controller;
import static com.qf.constant.SsmConstant.*;
import com.qf.constant.SsmConstant;
import com.qf.pojo.User;
import com.qf.service.UserService;
import com.qf.util.SendSMSUtil;
import com.qf.vo.PesultVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Map;
import static com.qf.constant.SsmConstant.CODE;
/**
* @program: ssm
* @description: 用户模块的controller层
* @author: 狗十三
* @create: 2019-07-15 10:28
**/
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private UserService userService;
@Autowired
private SendSMSUtil sendSMSUtil;
//跳转路径
@GetMapping("/register-ui")
public String registerUI(){
//转发到注册页面
return "user/register";
}
//Request URL:http//localhost/user/check-username
//1.json数据需要饭序列化成pojo对象
//josnlib
//jeckson
// gson
// fastJSON
@PostMapping("/check-username")
//不走视图解析器,直接响应 如果返回Map或者pojo累直接生成josn
@ResponseBody
public Map<String,Object> checkUsername(@RequestBody User user) {
Integer count= userService.checkUsername(user.getUsername());
//封装响应usermapper
Map<String,Object> result = new HashMap<>();
result.put("code",0);
result.put("msg","成功");
//(0代表用户名可用,1代表用户名已被注册)
result.put("data",count);
return result;
}
@PostMapping(value = "/register",produces = "text/html;charset=utf-8")
public String register(@Valid User user, BindingResult bindingResult, String register, String registerCode, HttpSession session,RedirectAttributes redirectAttributes) throws UnsupportedEncodingException {
//校验验证码
if (!StringUtils.isEmpty(registerCode)) {
//验证码不为空
String code = (String) session.getAttribute(SsmConstant.CODE);
if(!registerCode.equals(code)){
redirectAttributes.addAttribute("registerInfo","验证码错误!");
//验证码不正确
return REDIRECT+REGISTER_UI;
}
}
//校验验证码是否合法
if (bindingResult.hasErrors() || StringUtils.isEmpty(registerCode)){
//参数不合法
String msg = bindingResult.getFieldError().getDefaultMessage();
if (StringUtils.isEmpty(msg)){
msg = "验证码为必填项!";
}
redirectAttributes.addAttribute("registerInfo",msg);
return REDIRECT+REGISTER_UI;
}
//调用service执行注册
Integer count = userService.register(user);
//根据service返回结果跳转至指定页面
if (count == 1){
return REDIRECT + LOGIN_UI;
}else {
//注册失败
redirectAttributes.addAttribute("registerInfo","服务器断开链接");
return REDIRECT + REGISTER_UI;
}
}
@PostMapping(value = "/send-sms",produces = "text/html;charset=UTF-8")//通过produces = "text/charset = UTF-8"设置响应头信息,避免乱码
@ResponseBody
public String sendSMS(@RequestParam String phone,HttpSession session){
//调用工具短信
String result = sendSMSUtil.sendSMS(session, phone);
return result;
}
@GetMapping("/login-ui")
public String loginUI(){
return "user/login";
}
//执行登录
@PostMapping("/login")
@ResponseBody
public PesultVO login (String username, String password , HttpSession session){
//校验参数是否合法
if (StringUtils.isEmpty(username) || StringUtils.isEmpty(password) ){
return new PesultVO(1,"用户名与密码位必填项",null);
}
//调用service执行登录
User user = userService.login(username,password);
//根据service返回结果判断登录能否成功
if (user != null){
//如果成功,将用户的信息放到session中
session.setAttribute(USER,user);
return new PesultVO(0,"成功",null);
}else {
//如果失败,响应错误信息给ajax引擎
return new PesultVO(2,"用户名或密码错误",null);
}
}
}
| [
"951856618@qq.com"
] | 951856618@qq.com |
eb2252ad00e914a09582189209f6fd9acdabb61f | 436d27ff6957545656353b861202c1675ec26421 | /ClinicaE_MEA-war/src/java/clinica/com/dgo/bean/RolFacade.java | c8b1d4f7d99c8d9f133e0ed575f5aa007108d66c | [] | no_license | DGOrganization/Sist_Clinica | 9ec043a4c96643f25428246e389e3bfa8a4b9886 | 91e4e1a99bec8c5fc2dcb93ff86fe35d96ec6fcf | refs/heads/master | 2020-06-23T15:35:10.409244 | 2019-07-27T22:22:27 | 2019-07-27T22:22:27 | 198,665,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | 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 clinica.com.dgo.bean;
import clinica.com.dgo.entidades.Rol;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
*
* @author gerardo
*/
@Stateless
public class RolFacade extends AbstractFacade<Rol> {
@PersistenceContext(unitName = "ClinicaE_MEA-warPU")
private EntityManager em;
@Override
protected EntityManager getEntityManager() {
return em;
}
public RolFacade() {
super(Rol.class);
}
}
| [
"gerardo@WINDOWS-5T243DT"
] | gerardo@WINDOWS-5T243DT |
f4461c30e0ef6015574fddcaac3617dbff755bc8 | 3f576fb327925dd350dab37610f0f3676c5b9b3e | /src/main/java/com/citicup/model/correlationAnalysis/TenoreRatio_20DKey.java | 46db584445bcc650817f4fb0fbf83456f3770dd7 | [] | no_license | CitiCupBricksCarrier/CitiCup | 80542fa9d675bdab229a9de95df20f97bf380adb | 7f02be48e53e68e944e63774b36c2b560a084f6c | refs/heads/master | 2021-08-22T01:53:36.847290 | 2018-11-01T11:57:33 | 2018-11-01T11:57:33 | 141,294,182 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,967 | java | package com.citicup.model.correlationAnalysis;
import java.io.Serializable;
public class TenoreRatio_20DKey implements Serializable {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column 价量20日特诺雷比率.stkcd
*
* @mbggenerated
*/
private String stkcd;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database column 价量20日特诺雷比率.date
*
* @mbggenerated
*/
private String date;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table 价量20日特诺雷比率
*
* @mbggenerated
*/
private static final long serialVersionUID = 1L;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column 价量20日特诺雷比率.stkcd
*
* @return the value of 价量20日特诺雷比率.stkcd
*
* @mbggenerated
*/
public String getStkcd() {
return stkcd;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column 价量20日特诺雷比率.stkcd
*
* @param stkcd the value for 价量20日特诺雷比率.stkcd
*
* @mbggenerated
*/
public void setStkcd(String stkcd) {
this.stkcd = stkcd == null ? null : stkcd.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column 价量20日特诺雷比率.date
*
* @return the value of 价量20日特诺雷比率.date
*
* @mbggenerated
*/
public String getDate() {
return date;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column 价量20日特诺雷比率.date
*
* @param date the value for 价量20日特诺雷比率.date
*
* @mbggenerated
*/
public void setDate(String date) {
this.date = date == null ? null : date.trim();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table 价量20日特诺雷比率
*
* @mbggenerated
*/
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
TenoreRatio_20DKey other = (TenoreRatio_20DKey) that;
return (this.getStkcd() == null ? other.getStkcd() == null : this.getStkcd().equals(other.getStkcd()))
&& (this.getDate() == null ? other.getDate() == null : this.getDate().equals(other.getDate()));
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table 价量20日特诺雷比率
*
* @mbggenerated
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getStkcd() == null) ? 0 : getStkcd().hashCode());
result = prime * result + ((getDate() == null) ? 0 : getDate().hashCode());
return result;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table 价量20日特诺雷比率
*
* @mbggenerated
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", stkcd=").append(stkcd);
sb.append(", date=").append(date);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
} | [
"987801208@qq.com"
] | 987801208@qq.com |
501b61467b04f497990f8ccb58abc28d0c13dd20 | 5719371a4e761f043c1fef2bfb9b292ff6754ed4 | /CDAGenerator/src/main/java/de/fhg/isst/cda/choices/clinicalstatements/BL.java | 6fbde785b34a176623eea08ca205e861032a3108 | [] | no_license | FraunhoferISST/ehealth-cdagenerator | 052ecd1723d2014b074d565563acd6b12ca820ac | 53e860a2410ddbb9bded1eb016630cea3686580b | refs/heads/master | 2023-05-01T14:05:40.635639 | 2015-06-24T15:12:47 | 2015-06-24T15:12:47 | 37,991,785 | 3 | 3 | null | 2023-04-18T07:47:11 | 2015-06-24T15:05:24 | Java | UTF-8 | Java | false | false | 1,327 | java | //
package de.fhg.isst.cda.choices.clinicalstatements;
// TODO: Auto-generated Javadoc
/**
* The Class BL.
*/
public class BL
{
/** The __ null flavor. */
private String __NullFlavor = new String();
/**
* Gets the null flavor.
*
* @return the null flavor
*/
public String getNullFlavor() {
return __NullFlavor;
}
/**
* Sets the null flavor.
*
* @param value
* the new null flavor
*/
public void setNullFlavor(String value) {
__NullFlavor = value;
}
/** The __ value. */
private boolean __Value;
/**
* Gets the value.
*
* @return the value
*/
public boolean getValue() {
return __Value;
}
/**
* Sets the value.
*
* @param value
* the new value
*/
public void setValue(boolean value) {
__Value = value;
}
/** The __ value specified. */
private boolean __ValueSpecified;
/**
* Gets the value specified.
*
* @return the value specified
*/
public boolean getValueSpecified() {
return __ValueSpecified;
}
/**
* Sets the value specified.
*
* @param value
* the new value specified
*/
public void setValueSpecified(boolean value) {
__ValueSpecified = value;
}
}
| [
"jannic.hartwecker@isst.fraunhofer.de"
] | jannic.hartwecker@isst.fraunhofer.de |
f1e23d3444a2caa914128e57c49f37e7037328d8 | a709a56585401ccb5235a31ccd24f6c349a7bfcd | /src/com/Class8/ForLoop.java | 297f2fa6a1d9314a15e801211838864359199e79 | [] | no_license | fabs19/javaClasses | cc994adc25ba373c73385f19ff26d7fa8345d84f | cd72e2eb5111e1e0c7107c8314cee5155c28e84e | refs/heads/master | 2020-09-04T21:03:38.750733 | 2020-02-07T06:18:50 | 2020-02-07T06:18:50 | 219,891,329 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 535 | java | package com.Class8;
public class ForLoop {
public static void main(String[] args) {
// TODO Auto-generated method stub
//say good morning 5 times
for(int i=0; i<=4; i++) {
System.out.println("Good morning");
}
//print numbers from 1-10
for(int i=1; i<=10; i++) {
System.out.println(i);
}
//print numbers from 10 to 1
for(int i=10; i>=1; i--) {
System.out.println(i);
}
// print 5 10 15 20 25 30 to 50
for(int i=0; i<=50; i+=5) {
System.out.println(i);
}
}
}
| [
"fabigutier5@gmail.com"
] | fabigutier5@gmail.com |
d26e3c149ec3f144c33e507d4003d907408094f9 | b42400265253e6b75fbe7d09400e5a08e38ec1f7 | /src/main/java/sist/com/aop/basic/AroundAdviceEx.java | ea149c4bd2d6ef30a0bb323e00d16e862e8e6472 | [] | no_license | HaHaHaImMinje/HI- | b8aa6ee30f8c25a72755098362cc2c01e803d0e3 | 02415e2845a96ddef0d35117f65319cee8c2f4d3 | refs/heads/master | 2023-08-27T04:03:01.075874 | 2021-11-02T03:26:16 | 2021-11-02T03:26:16 | 404,312,129 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 435 | java | package sist.com.aop.basic;
import org.aspectj.lang.ProceedingJoinPoint;
public class AroundAdviceEx {
public void messageAround(ProceedingJoinPoint jp) throws Throwable {
jp.proceed(); // 핵심코드 구현된다
long start = System.currentTimeMillis();
for (int i = 0; i < (int) (Math.random() * 10000); i++) {
}
long end = System.currentTimeMillis();
System.out.println((end - start) + "밀리초 소요...");
}
}
| [
"alswp0401@gmail.com"
] | alswp0401@gmail.com |
2495c75f545bcbe65f8ac8a7bb25462b8c658c83 | 0bdb3af18cf7d2ea070545c7e27e340ae67c9b75 | /Módulo - VIII/biblioteca/src/main/java/br/com/codenation/livro/service/LivroServiceImpl.java | a9da1291979ecdcf1ce4681fe39cc5d993575c2f | [] | no_license | WillianFarias/aceleradev-codenation-java | 6e2b25111e7d3179ecafc3a1d4cdd234b2a2e54b | 752fd9988391d891df87077fb7aa9371bc76cb72 | refs/heads/master | 2022-12-06T19:07:06.684495 | 2020-08-31T12:25:22 | 2020-08-31T12:25:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,987 | java | package br.com.codenation.livro.service;
import br.com.codenation.avaliacao.service.AvaliacaoService;
import br.com.codenation.categoria.model.Categoria;
import br.com.codenation.categoria.service.CategoriaService;
import br.com.codenation.livro.model.Livro;
import br.com.codenation.livro.repository.LivroRepository;
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.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Service
public class LivroServiceImpl implements LivroService {
@Autowired
private LivroRepository livroRepository;
@Autowired
private CategoriaService categoriaService;
@Autowired
private AvaliacaoService avaliacaoService;
@Override
public List<Livro> findAll(Pageable pageable) {
return this.livroRepository.findAll(pageable).getContent();
}
@Override
public List<Livro> findByCategoria(Long idCategoria) {
Categoria categoria = this.categoriaService.findById(idCategoria).get();
return this.livroRepository.findByCategorias(categoria);
}
@Override
public Optional<Livro> findById(Long id) {
return livroRepository.findById(id);
}
@Override
public Livro save(Livro livro) {
preencherCategorias(livro);
return this.livroRepository.save(livro);
}
@Override
public void deleteById(Long id) {
this.livroRepository.deleteById(id);
}
@Override
public List<Livro> findByNome(String nome, Pageable pageable) {
return this.livroRepository.findByTituloContaining(nome, pageable).getContent();
}
@Override
public List<Livro> findByNomeCategoria(String nomeCategoria) {
return this.livroRepository.findByNomeCategoria(nomeCategoria);
}
@Override
public List<Livro> findComCategorias() {
return this.livroRepository.findComCategoria();
}
@Override
public Livro findByMaiorMediaAvaliacao() {
return this.livroRepository.findComAvaliacao().stream().
collect(Collectors.
maxBy(Comparator.
comparingInt(Livro::getMediaAvaliacoes))).
get();
}
private void preencherCategorias(Livro livro) {
if (livro.getCategorias() != null) {
List<Categoria> persistedCategorias = new ArrayList<>();
for (Categoria categoria : livro.getCategorias()) {
if (categoria.getId() != null) {
persistedCategorias.add(this.categoriaService.findById(categoria.getId()).get());
} else {
persistedCategorias.add(this.categoriaService.save(categoria));
}
}
livro.setCategorias(persistedCategorias);
}
}
}
| [
"williansousafarias@gmail.com"
] | williansousafarias@gmail.com |
b35746c921a579b19d47e49af9e59157066acef6 | 368c0c806f01b2ce79244f085eb89708387ff866 | /library/android-mvc-test/src/main/java/com/shipdream/lib/android/mvc/view/viewpager/controller/TabController.java | 3a1dfce9207d4a346f3d16cce393ea05a344178b | [
"Apache-2.0"
] | permissive | venkatesh3007/AndroidMvc | 014a678152cc53fa8c4a1989050bfb0f37f35113 | 45bdb05bf347a42bf93d289808db4751ebae0f94 | refs/heads/master | 2021-01-20T17:29:46.005118 | 2015-10-06T05:50:41 | 2015-10-06T05:50:41 | 42,567,594 | 0 | 1 | null | 2015-09-16T05:56:16 | 2015-09-16T05:56:16 | null | UTF-8 | Java | false | false | 293 | java | package com.shipdream.lib.android.mvc.view.viewpager.controller;
import com.shipdream.lib.android.mvc.controller.BaseController;
import com.shipdream.lib.android.mvc.view.viewpager.TabModel;
public interface TabController extends BaseController<TabModel> {
void setName(String name);
}
| [
"ideablast@gmail.com"
] | ideablast@gmail.com |
57175aea3bb2a3d565d7532f1b1bad9486ce0c69 | 8370a2c6515c5cbf2e686812b10306b834508233 | /stackCalculator/src/test/java/at/edu/c02/calculator/logic/CalculatorTest.java | c771f402da4ad493dd58413916017eeb93cafffe | [] | no_license | dietmarczell/iwi15calc | 3aa9c1aa1b6b908ae7c89558c41f34825eeab63c | 4b8a76f487e295ecb6445b429ceeabe2663afcbe | refs/heads/master | 2020-06-13T01:56:33.092524 | 2016-12-03T08:53:47 | 2016-12-03T08:53:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | package at.edu.c02.calculator.logic;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Test;
import at.edu.c02.calculator.Calculator;
import at.edu.c02.calculator.CalculatorException;
import at.edu.c02.calculator.Calculator.Operation;
import at.edu.c02.calculator.logic.CalculatorImpl;
public class CalculatorTest {
@Test
public void testSimpleAddOperation() throws Exception {
//setup
Calculator calc = new CalculatorImpl();
//execute
calc.push(2.0);
calc.push(3);
double result = calc.perform(Operation.add);
//verify
assertEquals(5, result, 0);
}
@Test
public void testSimpleMulOperation() throws Exception {
Calculator calc = new CalculatorImpl();
calc.push(2.0);
calc.push(3);
double result = calc.perform(Operation.mul);
assertEquals(6, result, 0);
}
@Test
public void testSimpleDivOperation() throws Exception {
Calculator calc = new CalculatorImpl();
calc.push(6.0);
calc.push(2);
double result = calc.perform(Operation.div);
assertEquals(3, result, 0);
}
//
@Test(expected = CalculatorException.class)
public void testPopOnEmptyStack() throws Exception {
Calculator calc = new CalculatorImpl();
calc.pop();
}
@Test
public void testDivisionByZero() throws Exception {
//Setup
Calculator calc = new CalculatorImpl();
try {
calc.push(2);
calc.push(0);
calc.perform(Operation.div);
fail("Exception expected");
} catch (CalculatorException e) {
assertEquals("Division by zero", e.getMessage());
// e.getCause()
}
}
}
| [
"gfliess@172.32.1.161"
] | gfliess@172.32.1.161 |
55c858044b083d71811b743f89af5779e8e0f147 | 4d96e1460004d0333a0762db075d37210f74f02a | /version1/maven_use/eclipse_processmonitor_ver1/processmonitorver1/src/main/java/kev/utility/UtilityPack.java | dec6fcd7be7abc34dac9fc77896bbbb0cc8189cf | [] | no_license | vivekVells/TaskProcessManager | 574e887eff6954450da21ffd64942753f1ec3f01 | 283dddd7237c8a77f989d129021795d18ca0c6be | refs/heads/master | 2021-12-20T10:40:32.837909 | 2021-11-18T19:19:22 | 2021-11-18T19:19:22 | 148,704,840 | 5 | 0 | null | 2021-12-14T21:16:08 | 2018-09-13T22:24:12 | Java | UTF-8 | Java | false | false | 1,475 | java | /**
* This class acts as utility power belt for commonly used entities
*/
package kev.utility;
import java.math.BigDecimal;
import java.math.RoundingMode;
import org.hyperic.sigar.Sigar;
/**
* @author Vivek
*
* File reference/headsup notes: TaskProcessManager\resource_house\reference\NotesHub\version1-maven_use-eclipse_processmonitor_ver1-processmonitorver1\thingsToRemember.txt
*/
public class UtilityPack {
/**
* Creates & returns new sigar object
*
* @return newly created sigar object
*/
public static Sigar getSigarObject() {
return new Sigar();
}
/**
* Trim up to desired decimal places
*
* @param arg
* @return trimmed double decimal value
*/
public static Double getFormattedDecimal(double value, int places) {
if (places < 0) throw new IllegalArgumentException();
BigDecimal bd = new BigDecimal(Double.toString(value));
bd = bd.setScale(places, RoundingMode.HALF_UP);
return Double.valueOf(bd.doubleValue());
}
/**
* Value if not present should return unkown string
*
* @param checkArg
* @return "unknown" if arg not having value
*/
public static String getUnkownIfValueNotPresent(String checkArg) {
String result = (checkArg.length() > 0) ? checkArg : "unknown";
return result;
}
/**
* @param args
*/
public static void main(String[] args) { }
}
| [
"noreply@github.com"
] | noreply@github.com |
985411b31e44919db9ab2756304119b6e4018999 | 83905ea61547dd68a98eb556b55c36a12a57c343 | /src/java/com/neu/cloud/DAO/UserDAO.java | c3acb1f1708e55f2e20dd30f41fbb7d414981be0 | [] | no_license | pawanmatta/trtr | 659f9b3bebd0745fc83caec55ca821f131cebb96 | 5d6a13af85c7b62fb0d1fd124aaab48aa16dc1d2 | refs/heads/master | 2021-01-18T22:13:50.832638 | 2016-11-03T07:31:59 | 2016-11-03T07:31:59 | 72,314,986 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,271 | 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 com.neu.cloud.DAO;
import com.neu.cloud.POJO.User;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
/**
*
* @author admin
*/
public class UserDAO extends DAO{
private Connection connection;
private Statement statement;
public void addUser(List<User> userList) throws ClassNotFoundException, SQLException {
try{
connection = getConnection();
statement = connection.createStatement();
String sql = "";
for (User user : userList) {
sql = "Insert into orders (User_Id, User_name, Password, product_name) values(" + user.getUserID() + ",'" + user.getUsername() + "','" + user.getPassword() + "','" + user.getProductName() + "');";
statement.addBatch(sql);
}
statement.executeBatch();
}
catch (SQLException ex) {
System.out.println(ex.getMessage());
} finally {
close(statement);
close(connection);
}
}
}
| [
"matta.p@husky.neu.edu"
] | matta.p@husky.neu.edu |
8ffa17bc889964c0c379442840ec8f22d853077c | 82bebc06a91729b82d5e6759e966b34b659502bf | /test/src/main/java/com/toly1994/test/common/ColUtils.java | 7bfd022d6af4a4abe55768a1de9ad00c8e03c086 | [] | no_license | philip-knight/Android_Material_Design_Test | ad2e6e120ac6e8b2f26fcf9b0247f527432817b2 | 3ebe842c49201b0e59223c0611ba2ba3f4c1ed22 | refs/heads/master | 2021-10-08T22:28:04.583884 | 2018-12-18T12:24:07 | 2018-12-18T12:24:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,092 | java | package com.toly1994.test.common;
import android.content.res.ColorStateList;
import android.graphics.Color;
import java.util.Random;
/**
* 作者:张风捷特烈
* 时间:2018/5/19:17:02
* 邮箱:1981462002@qq.com
* 说明:颜色工具类
*/
public class ColUtils {
/**
* 改变一个颜色的透明度
*
* @param color
* @param alpha
*/
public static int changeColorAlpha(int color, int alpha) {
int a = (color >> 24) & 0xFF;
a = (int) (a * (alpha / 255f));
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
return (a << 24) | (r << 16) | (g << 8) | b;
}
/**
* 返回随机颜色
*
* @return 随机颜色
*/
public static int randomColor() {
Random random = new Random();
int a = 250 + random.nextInt(255);
int r = 30 + random.nextInt(200);
int g = 30 + random.nextInt(200);
int b = 30 + random.nextInt(200);
int randomColor = Color.argb(a, r, g, b);
return randomColor;
}
/**
* 返回随机颜色
*
* @return 随机颜色
*/
public static int randomRGB() {
Random random = new Random();
int r = 30 + random.nextInt(200);
int g = 30 + random.nextInt(200);
int b = 30 + random.nextInt(200);
return Color.rgb(r, g, b);
}
/**
* 颜色变换
*
* @param fraction 分度值
* @param startValue 开始色
* @param endValue 结束色
* @return 分度值处颜色
*/
public static int evaluateColor(float fraction, int startValue,
int endValue) {
int startA = (startValue >> 24) & 0xff;
int startR = (startValue >> 16) & 0xff;
int startG = (startValue >> 8) & 0xff;
int startB = startValue & 0xff;
int endA = (endValue >> 24) & 0xff;
int endR = (endValue >> 16) & 0xff;
int endG = (endValue >> 8) & 0xff;
int endB = endValue & 0xff;
return (startA + (int) (fraction * (endA - startA)) << 24)
| (startR + (int) (fraction * (endR - startR)) << 16)
| (startG + (int) (fraction * (endG - startG)) << 8)
| startB + (int) (fraction * (endB - startB));
}
private static final int ENABLE_ATTR = android.R.attr.state_enabled;
private static final int CHECKED_ATTR = android.R.attr.state_checked;
private static final int PRESSED_ATTR = android.R.attr.state_pressed;
/**
* @param tintColor
* @return
*/
public static ColorStateList generateThumbColorWithTintColor(final int tintColor) {
int[][] states = new int[][]{
{-ENABLE_ATTR, CHECKED_ATTR},
{-ENABLE_ATTR},
{PRESSED_ATTR, -CHECKED_ATTR},
{PRESSED_ATTR, CHECKED_ATTR},
{CHECKED_ATTR},
{-CHECKED_ATTR}
};
int[] colors = new int[]{
tintColor - 0xAA000000,
0xFFBABABA,
tintColor - 0x99000000,
tintColor - 0x99000000,
tintColor | 0xFF000000,
0xFFEEEEEE
};
return new ColorStateList(states, colors);
}
/**
* @param tintColor
* @return
*/
public static ColorStateList generateBackColorWithTintColor(final int tintColor) {
int[][] states = new int[][]{
{-ENABLE_ATTR, CHECKED_ATTR},
{-ENABLE_ATTR},
{CHECKED_ATTR, PRESSED_ATTR},
{-CHECKED_ATTR, PRESSED_ATTR},
{CHECKED_ATTR},
{-CHECKED_ATTR}
};
int[] colors = new int[]{
tintColor - 0xE1000000,
0x10000000,
tintColor - 0xD0000000,
0x20000000,
tintColor - 0xD0000000,
0x20000000
};
return new ColorStateList(states, colors);
}
/**
* 颜色加深处理
*
* @param RGBValues RGB的值,由alpha(透明度)、red(红)、green(绿)、blue(蓝)构成,
* Android中我们一般使用它的16进制,
* 例如:"#FFAABBCC",最左边到最右每两个字母就是代表alpha(透明度)、
* red(红)、green(绿)、blue(蓝)。每种颜色值占一个字节(8位),值域0~255
* 所以下面使用移位的方法可以得到每种颜色的值,然后每种颜色值减小一下,在合成RGB颜色,颜色就会看起来深一些了
* @return
*/
public static int colorBurn(int RGBValues) {
int red = RGBValues >> 16 & 0xFF;
int green = RGBValues >> 8 & 0xFF;
int blue = RGBValues & 0xFF;
red = (int) Math.floor(red * (1 - 0.1));
green = (int) Math.floor(green * (1 - 0.1));
blue = (int) Math.floor(blue * (1 - 0.1));
return Color.rgb(red, green, blue);
}
}
| [
"1981462002@qq.com"
] | 1981462002@qq.com |
6e3d35723b3571b4646df4e1fc7c54ef05e0b4a2 | 0016005ee6a22429433a4e0e66ff1303147179ec | /src/InterviewCodingTasks/FactorialNumbers.java | 2ec8e8b2ee7562cb51c901c3521c1bbd23715d5b | [] | no_license | OrkhanMusayev/B18_JavaCourse | 7d1fee404169ec7f45b20efc42456f0173577327 | 017a6cfca170ec0c0ace15fa5d5fb319529f2921 | refs/heads/master | 2022-12-10T06:03:38.178027 | 2020-08-22T23:31:10 | 2020-08-22T23:31:10 | 286,326,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 438 | java | package InterviewCodingTasks;
/**
* Write a return method that returns the factorial number of any given number
*/
public class FactorialNumbers {
public static int factorialNumber(int n){
int result = 1;
for(int i = 1; i <= n; i++){
result = result * i;
}
return result;
}
public static void main(String[] args) {
System.out.println(factorialNumber(4));
}
}
| [
"mussayevorkhan@gmail.com"
] | mussayevorkhan@gmail.com |
36820278eb950b0c2f1eb24e5c1ece0bf8f50fb6 | 7eb094c115ff755ea961474f5fe79d227451444d | /src/main/java/cn/evilcoder/innotation/TestAnnotation.java | 47b5fc6bd7cf2d4b8a87307d02797d3343dacb0a | [
"MIT"
] | permissive | chongtianfeiyu/java-base-learn | 14f0ef77e8efe8f2d42130f6ab92a427064f7461 | c9cb9e9611cf8ab7f835aef5bf369125adba646c | refs/heads/master | 2021-01-19T16:05:18.330516 | 2016-10-16T04:53:55 | 2016-10-16T04:53:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 401 | java | package cn.evilcoder.innotation;
/**
* Created by huangshanqi on 2016/5/4.
*/
public class TestAnnotation {
public static void main(String[] args) {
UserTable userTable = new UserTable();
userTable.setId(System.currentTimeMillis());
userTable.setUsername("testname");
userTable.setPassword("11111");
System.out.println(userTable.entityInfo());
}
}
| [
"hsqmobile@gmail.com"
] | hsqmobile@gmail.com |
e7cc17859dab3a25a39c1bf868b428eaa09eccb7 | 453e89334c23807a72eba5df7d000e3437dfd02b | /src/main/java/edu/kit/datamanager/notification/dao/spec/NotificationCreationDateSpec.java | ffb347955e0a640690a52b50af64a21b2ee28412 | [
"Apache-2.0"
] | permissive | kit-data-manager/notification-service | f423c662cec20b6cc806c8b0d27f63971d0fdc10 | 71daa2d15d633f19a5ecda69fc96fab235ea8b23 | refs/heads/master | 2021-07-08T18:16:50.933205 | 2020-11-23T10:54:22 | 2020-11-23T10:54:22 | 209,776,771 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,914 | java | /*
* Copyright 2019 Karlsruhe Institute of Technology.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package edu.kit.datamanager.notification.dao.spec;
import edu.kit.datamanager.notification.domain.Notification;
import java.time.Instant;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root;
import org.springframework.data.jpa.domain.Specification;
/**
*
* @author jejkal
*/
public class NotificationCreationDateSpec{
/**
* Hidden constructor.
*/
private NotificationCreationDateSpec(){
}
public static Specification<Notification> toSpecification(Instant createdFrom, Instant createdUntil){
Specification<Notification> newSpec = Specification.where(null);
if(createdFrom == null && createdUntil == null){
return newSpec;
}
return (Root<Notification> root, CriteriaQuery<?> query, CriteriaBuilder builder) -> {
if(createdFrom != null && createdUntil != null){
return builder.and(builder.between(root.get("createdAt"), createdFrom, createdUntil));
} else if(createdFrom == null){
return builder.and(builder.lessThan(root.get("createdAt"), createdUntil));
}
//otherwise, lastUpdateUntil is null
return builder.and(builder.greaterThan(root.get("createdAt"), createdFrom), root.get("createdAt").isNotNull());
};
}
}
| [
"thomas.jejkal@kit.edu"
] | thomas.jejkal@kit.edu |
7345671379f4fa89e99cca89b7590b108edf3854 | d94194ae07a182392741ac2ea654f51737dc747b | /src/main/java/com/web/SpringService/repositories/ItemPedidoRepository.java | 7d6ae0059976e061c8ccdc0f75e23b4685354c39 | [] | no_license | JonasMoura-J/SpringBoot-Ionic | e26f8225917cc27bfaf3a10ed310d5c8c34abda2 | 3ee114884b0f3bbc19550bb9fb3ab78596d1c5a7 | refs/heads/main | 2023-08-23T08:53:08.281975 | 2021-10-31T18:04:47 | 2021-10-31T18:04:47 | 387,611,634 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 243 | java | package com.web.SpringService.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import com.web.SpringService.domain.ItemPedido;
public interface ItemPedidoRepository extends JpaRepository<ItemPedido, Integer> {
}
| [
"jonasmourat9090@gmail.com"
] | jonasmourat9090@gmail.com |
d2244ab7e27d4ac3e8758c7ef5e851ca356031a8 | ddcfaadf222bfb485ecc711dc518c07f2c420c96 | /sampleapplication14/src/main/java/com/fastcode/sampleapplication14/restcontrollers/core/RoleController.java | c752d8236b6dbe1471a690c737705d9063dbde2e | [] | no_license | fastcoderepos/u3-sampleApplication1 | 9bf50ae68a8475e6f1e08e14d66f1f8fc050412f | 90cf3678b28221666848f54ec0c5d5320a386d93 | refs/heads/master | 2023-06-27T13:55:52.251444 | 2021-07-28T14:42:22 | 2021-07-28T14:42:22 | 390,385,879 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,845 | java | package com.fastcode.sampleapplication14.restcontrollers.core;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import javax.persistence.EntityNotFoundException;
import javax.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.core.env.Environment;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import com.fastcode.sampleapplication14.commons.search.SearchCriteria;
import com.fastcode.sampleapplication14.commons.search.SearchUtils;
import com.fastcode.sampleapplication14.commons.search.OffsetBasedPageRequest;
import com.fastcode.sampleapplication14.application.core.authorization.role.IRoleAppService;
import com.fastcode.sampleapplication14.application.core.authorization.role.dto.*;
import com.fastcode.sampleapplication14.application.core.authorization.rolepermission.IRolepermissionAppService;
import com.fastcode.sampleapplication14.application.core.authorization.rolepermission.dto.FindRolepermissionByIdOutput;
import com.fastcode.sampleapplication14.application.core.authorization.usersrole.IUsersroleAppService;
import com.fastcode.sampleapplication14.application.core.authorization.usersrole.dto.FindUsersroleByIdOutput;
import java.util.*;
import java.time.*;
import com.fastcode.sampleapplication14.commons.logging.LoggingHelper;
@RestController
@RequestMapping("/role")
@RequiredArgsConstructor
public class RoleController {
@Qualifier("roleAppService")
@NonNull protected final IRoleAppService _roleAppService;
@Qualifier("rolepermissionAppService")
@NonNull protected final IRolepermissionAppService _rolepermissionAppService;
@Qualifier("usersroleAppService")
@NonNull protected final IUsersroleAppService _usersroleAppService;
@NonNull protected final LoggingHelper logHelper;
@NonNull protected final Environment env;
@PreAuthorize("hasAnyAuthority('ROLEENTITY_CREATE')")
@RequestMapping(method = RequestMethod.POST, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity<CreateRoleOutput> create(@RequestBody @Valid CreateRoleInput role) {
CreateRoleOutput output=_roleAppService.create(role);
return new ResponseEntity(output, HttpStatus.OK);
}
// ------------ Delete role ------------
@PreAuthorize("hasAnyAuthority('ROLEENTITY_DELETE')")
@ResponseStatus(value = HttpStatus.NO_CONTENT)
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE, consumes = {"application/json"})
public void delete(@PathVariable String id) {
FindRoleByIdOutput output = _roleAppService.findById(Long.valueOf(id));
Optional.ofNullable(output).orElseThrow(() -> new EntityNotFoundException(String.format("There does not exist a role with a id=%s", id)));
_roleAppService.delete(Long.valueOf(id));
}
// ------------ Update role ------------
@PreAuthorize("hasAnyAuthority('ROLEENTITY_UPDATE')")
@RequestMapping(value = "/{id}", method = RequestMethod.PUT, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity<UpdateRoleOutput> update(@PathVariable String id, @RequestBody @Valid UpdateRoleInput role) {
FindRoleByIdOutput currentRole = _roleAppService.findById(Long.valueOf(id));
Optional.ofNullable(currentRole).orElseThrow(() -> new EntityNotFoundException(String.format("Unable to update. Role with id=%s not found.", id)));
role.setVersiono(currentRole.getVersiono());
UpdateRoleOutput output = _roleAppService.update(Long.valueOf(id),role);
return new ResponseEntity(output, HttpStatus.OK);
}
@PreAuthorize("hasAnyAuthority('ROLEENTITY_READ')")
@RequestMapping(value = "/{id}", method = RequestMethod.GET, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity<FindRoleByIdOutput> findById(@PathVariable String id) {
FindRoleByIdOutput output = _roleAppService.findById(Long.valueOf(id));
Optional.ofNullable(output).orElseThrow(() -> new EntityNotFoundException(String.format("Not found")));
return new ResponseEntity(output, HttpStatus.OK);
}
@PreAuthorize("hasAnyAuthority('ROLEENTITY_READ')")
@RequestMapping(method = RequestMethod.GET, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity find(@RequestParam(value="search", required=false) String search, @RequestParam(value = "offset", required=false) String offset, @RequestParam(value = "limit", required=false) String limit, Sort sort) throws Exception {
if (offset == null) { offset = env.getProperty("fastCode.offset.default"); }
if (limit == null) { limit = env.getProperty("fastCode.limit.default"); }
Pageable Pageable = new OffsetBasedPageRequest(Integer.parseInt(offset), Integer.parseInt(limit), sort);
SearchCriteria searchCriteria = SearchUtils.generateSearchCriteriaObject(search);
return ResponseEntity.ok(_roleAppService.find(searchCriteria,Pageable));
}
@PreAuthorize("hasAnyAuthority('ROLEENTITY_READ')")
@RequestMapping(value = "/{id}/rolepermissions", method = RequestMethod.GET, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity getRolepermissions(@PathVariable String id, @RequestParam(value="search", required=false) String search, @RequestParam(value = "offset", required=false) String offset, @RequestParam(value = "limit", required=false) String limit, Sort sort)throws Exception {
if (offset == null) { offset = env.getProperty("fastCode.offset.default"); }
if (limit == null) { limit = env.getProperty("fastCode.limit.default"); }
Pageable pageable = new OffsetBasedPageRequest(Integer.parseInt(offset), Integer.parseInt(limit), sort);
SearchCriteria searchCriteria = SearchUtils.generateSearchCriteriaObject(search);
Map<String,String> joinColDetails=_roleAppService.parseRolepermissionsJoinColumn(id);
Optional.ofNullable(joinColDetails).orElseThrow(() -> new EntityNotFoundException(String.format("Invalid join column")));
searchCriteria.setJoinColumns(joinColDetails);
List<FindRolepermissionByIdOutput> output = _rolepermissionAppService.find(searchCriteria,pageable);
Optional.ofNullable(output).orElseThrow(() -> new EntityNotFoundException(String.format("Not found")));
return new ResponseEntity(output, HttpStatus.OK);
}
@PreAuthorize("hasAnyAuthority('ROLEENTITY_READ')")
@RequestMapping(value = "/{id}/usersroles", method = RequestMethod.GET, consumes = {"application/json"}, produces = {"application/json"})
public ResponseEntity getUsersroles(@PathVariable String id, @RequestParam(value="search", required=false) String search, @RequestParam(value = "offset", required=false) String offset, @RequestParam(value = "limit", required=false) String limit, Sort sort)throws Exception {
if (offset == null) { offset = env.getProperty("fastCode.offset.default"); }
if (limit == null) { limit = env.getProperty("fastCode.limit.default"); }
Pageable pageable = new OffsetBasedPageRequest(Integer.parseInt(offset), Integer.parseInt(limit), sort);
SearchCriteria searchCriteria = SearchUtils.generateSearchCriteriaObject(search);
Map<String,String> joinColDetails=_roleAppService.parseUsersrolesJoinColumn(id);
Optional.ofNullable(joinColDetails).orElseThrow(() -> new EntityNotFoundException(String.format("Invalid join column")));
searchCriteria.setJoinColumns(joinColDetails);
List<FindUsersroleByIdOutput> output = _usersroleAppService.find(searchCriteria,pageable);
Optional.ofNullable(output).orElseThrow(() -> new EntityNotFoundException(String.format("Not found")));
return new ResponseEntity(output, HttpStatus.OK);
}
}
| [
"info@nfinityllc.com"
] | info@nfinityllc.com |
dcd1c74fa121b1ba946f25a32f14d31caa89d67f | 2b2fcb1902206ad0f207305b9268838504c3749b | /WakfuClientSources/srcx/class_13052_WT.java | 3a8c3ddb19a60b90c3733a3767e9a65c04564842 | [] | no_license | shelsonjava/Synx | 4fbcee964631f747efc9296477dee5a22826791a | 0cb26d5473ba1f36a3ea1d7163a5b9e6ebcb0b1d | refs/heads/master | 2021-01-15T13:51:41.816571 | 2013-11-17T10:46:22 | 2013-11-17T10:46:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | import java.util.ArrayList;
import javax.swing.JFrame;
class WT
implements Runnable
{
WT(tr paramtr)
{
}
public void run()
{
if (beV.a(this.cGH.bdH) != null)
beV.a(this.cGH.bdH).b(this.cGH.bdH.dYL, this.cGH.bdH.aUq);
StringBuilder localStringBuilder = new StringBuilder("PSys Debug ").append(" Part.: ").append(this.cGH.bdH.dYL.size()).append(" (max ").append(this.cGH.bdH.fsk).append(") Lights: ").append(this.cGH.bdH.aUq.size()).append(" (max ").append(this.cGH.bdH.fsl).append(")");
beV.b(this.cGH.bdH).setTitle(localStringBuilder.toString());
}
} | [
"music_inme@hotmail.fr"
] | music_inme@hotmail.fr |
42868d66c8fdd7bf64c72dd0372a100637552063 | 6cdc4f13607436a8b8fe23a5e88c86b27d855cf9 | /app/src/main/java/com/akzaki/mycontacts/util/UserManage.java | 2561a09ed333a431192f995a02cdb3dc66e67642 | [] | no_license | teamteam321/Contacts | 3ebe4433397e39046f5b976f6ad68ec6267cf628 | 43afe9e9ccd645aa752fd9e65f0842eea6999bbf | refs/heads/master | 2023-01-18T21:54:51.033875 | 2020-11-21T20:05:50 | 2020-11-21T20:05:50 | 314,835,572 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 536 | java | package com.akzaki.mycontacts.util;
import com.akzaki.mycontacts.model.User;
public class UserManage {
public static User[] sortUser(User[]arr){
User [] nnn = arr;
User temp;
for(int e = 0;e<arr.length-1;e++){
for(int r = e+1;r<arr.length;r++){
if(arr[e].firstName.compareTo(arr[r].firstName) > 0){
temp = arr[e];
arr[e] = arr[r];
arr[r] = temp;
}
}
}
return nnn;
}
}
| [
"36959658+teamteam321@users.noreply.github.com"
] | 36959658+teamteam321@users.noreply.github.com |
994a86210ea15b0dcd4eae952f40e982d7fd4bf6 | b7b81f001e661ce6ee5e26ae76fd21d7cedf0fa9 | /src/main/java/com/desafio/spring/exceptions/ProductNotFoundException.java | 28ac998aaca766241400fbf9f5f23f1ec581a7d6 | [] | no_license | pgaudenzi/desafio_spring | 6ee42600e4b288a963182f2475b7834ff5674e36 | 914b156e8dd066043cdb0b77a0d5d64eaf2bcb82 | refs/heads/main | 2023-03-31T22:31:24.141717 | 2021-04-14T21:53:02 | 2021-04-14T21:53:02 | 355,210,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 211 | java | package com.desafio.spring.exceptions;
public class ProductNotFoundException extends Exception {
public ProductNotFoundException(int id) {
super("El producto con ID " + id + " no existe");
}
}
| [
"pgaudenzi@ar0c02dx29zml85.fibertel.com.ar"
] | pgaudenzi@ar0c02dx29zml85.fibertel.com.ar |
794e6e7b8c3f20b0399d30f4761c9cbff4243ec8 | fc57e22585ec8a653c1b45f3c06a346dd6eb01cf | /src/convex_hull/Main.java | fc1769d2ad6ece7973fd3575555439305a8d53ea | [
"MIT"
] | permissive | CristianAbrante/QuickHull | b65c30d621e8d7a0305b3d1b13c1e64890e26d7f | 2095e4805c9f4e6edaa26795a520001447b29443 | refs/heads/master | 2020-03-20T15:16:03.151146 | 2018-06-17T15:59:25 | 2018-06-17T15:59:25 | 137,506,486 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,223 | java | /**
*
*/
package convex_hull;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.util.ArrayList;
/**
* <h2>Main</h2>
*
* @author Cristian Abrante Dorta
* @company University Of La Laguna
* @date 22/04/2018
* @version 1.0.0
*/
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
ArrayList<Point2D> points = new ArrayList<Point2D>();
points.add(new Point2D.Double(2.0, 2.0));
points.add(new Point2D.Double(3.0, 7.0));
points.add(new Point2D.Double(4.0, 5.0));
points.add(new Point2D.Double(6.0, 3.0));
points.add(new Point2D.Double(6.0, 5.0));
points.add(new Point2D.Double(8.0, 7.0));
QuickHull hull = new QuickHull(points);
while (hull.nextIteration() != false) {
Line2D line = hull.getCurrentLine();
System.out.println(String.format("l = [(%f, %f), (%f, %f)]", line.getP1().getX(), line.getP1().getY(), line.getP2().getX(),line.getP2().getY()));
String hullStr = "h = [";
for (Point2D point : hull.getConvexHull()) {
hullStr += String.format("(%f, %f)", point.getX(), point.getY());
}
hullStr += "]\n";
System.out.println(hullStr);
}
}
}
| [
"alu0100945850@ull.edu.es"
] | alu0100945850@ull.edu.es |
6d678413741fa5d8e64bde02acdfa9e6de22b41a | c7df6c7df0098289b51f0a8791c3a57ec37eaef8 | /src/java/Dao/tanimlarDAO.java | 6f9283809aca79f6cad9d175010d78dee3e3f9e8 | [] | no_license | SaidKaygisiz/ClassManagementSystem | 984615b88e4f76cb1cdaa763a7dcd87b8161ad81 | d54df03a8a1bd349fc27146efb71ba0155cfe195 | refs/heads/master | 2022-12-08T05:11:20.354086 | 2020-08-30T15:58:15 | 2020-08-30T15:58:15 | 291,501,754 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,148 | java | package Dao;
import Entity.tanimlar;
import Util.DBConnection;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class tanimlarDAO {
DBConnection db = new DBConnection();
Connection con = db.connect();
private ogretmenDAO ogretmendao;
private gorevDAO gorevdao;
public int tanimlarSayisi() {
int ts = 0;
try {
PreparedStatement pst = con.prepareStatement("select * from tanimlar");
ResultSet rs = pst.executeQuery();
while (rs.next()) {
ts++;
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return ts;
}
public List<tanimlar> getList(int page,int lic) {
List<tanimlar> tanimlarList = new ArrayList();
int start=0;
start=(page-1)*lic;
try {
PreparedStatement pst = con.prepareStatement("select * from tanimlar order by tanimlar_id limit "+lic+" OFFSET "+start);
ResultSet rs = pst.executeQuery();
while (rs.next()) {
tanimlar tanimlar = new tanimlar();
tanimlar.setTanimlar_id(rs.getInt("tanimlar_id"));
tanimlar.getOgretmen().setOgrt_id(rs.getInt("ogrt_id"));
tanimlar.getGorev().setGorev_id(rs.getInt("gorev_id"));
tanimlar.setEkleme_tarih(rs.getString("ekleme_tarih"));
tanimlar.setOgretmen(this.getOgretmendao().findOgretmen(rs.getInt("ogrt_id")));
tanimlar.setGorev(this.getGorevdao().findGorev(rs.getInt("gorev_id")));
tanimlarList.add(tanimlar);
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
return tanimlarList;
}
public void Save(tanimlar tanimlar) {
try {
PreparedStatement pst = con.prepareStatement("insert into tanimlar (ogrt_id,gorev_id,ekleme_tarih) values(?,?,?)");
pst.setInt(1, tanimlar.getOgretmen().getOgrt_id());
pst.setInt(2, tanimlar.getGorev().getGorev_id());
pst.setString(3, sistemTarihiniGetir());
pst.executeUpdate();
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
public void Delete(tanimlar tanimlar) {
try {
PreparedStatement pst = con.prepareStatement("delete from tanimlar where tanimlar_id=" + tanimlar.getTanimlar_id());
pst.executeUpdate();
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
public void update(tanimlar tanimlar) {
try {
Statement st = con.createStatement();
st.executeUpdate("update tanimlar set ogrt_id='" + tanimlar.getOgretmen().getOgrt_id() + "'where tanimlar_id=" + tanimlar.getTanimlar_id());
st.executeUpdate("update tanimlar set gorev_id='" + tanimlar.getGorev().getGorev_id() + "'where tanimlar_id=" + tanimlar.getTanimlar_id());
st.executeUpdate("update tanimlar set ekleme_tarih='" + sistemTarihiniGetir() + "' where tanimlar_id=" + tanimlar.getTanimlar_id());
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
public ogretmenDAO getOgretmendao() {
if (this.ogretmendao == null) {
this.ogretmendao = new ogretmenDAO();
}
return ogretmendao;
}
public gorevDAO getGorevdao() {
if (this.gorevdao == null) {
this.gorevdao = new gorevDAO();
}
return gorevdao;
}
public String sistemTarihiniGetir() {
Calendar takvim = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd H:mm:ss");
return sdf.format(takvim.getTime());
}
}
| [
"noreply@github.com"
] | noreply@github.com |
ed976b5a3a04820e6497ac8ff0f4b784dc52232a | bf9ef236d7e07d66cbf9c7256a68cff825f15b04 | /Titanic_API/titanic/src/main/java/com/egen/titanic/service/AddressService.java | 0e3b2d93d4a2694bbd49b76036fdcd89c9147a25 | [] | no_license | vishwajith1/titanic | c45f6968a6850380d3a750510bf9bd0abeadad67 | 69d230563b0f1b17ff2eafd64febb9943961f4c9 | refs/heads/main | 2023-03-16T21:46:25.855456 | 2021-03-02T15:50:05 | 2021-03-02T15:50:05 | 343,620,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package com.egen.titanic.service;
import com.egen.titanic.entity.Address;
import org.springframework.stereotype.Service;
import java.util.Optional;
@Service
public interface AddressService {
public Optional<Address> getById(Integer id);
public Address saveOrUpdate(Address address);
public void deleteById(Integer id);
}
| [
"vishwajithmatad@gmail.com"
] | vishwajithmatad@gmail.com |
cb347384ba984530718a48944c0e80385aa892dd | 4f438e81ebd051e9fb3b4cdfd04c08636c3a386d | /src/musichub/util/ElementXML.java | 4867d0f5c4c999f10079c44262ca1744a93c58ff | [] | no_license | BankaiOnegai/JMUSICHUB | a1f95196631e03e23a0e71f23ac252bc661daf8f | 4ce56aebbf6aabed3f1c85f05ccd92b118dcde5c | refs/heads/main | 2023-04-09T10:57:35.975256 | 2021-04-16T18:02:27 | 2021-04-16T18:02:27 | 358,680,833 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,260 | java | /**
* Definition du package util
*/
package src.musichub.util;
/**
* Import des packages necessaires a l'utilisation de notre Class
*/
import src.musichub.business.*;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.xml.sax.SAXException;
import org.w3c.dom.*;
import java.io.IOException;
import java.io.File;
import java.util.*;
/**
* Class ElementXML
* Elle permet de lire et ecrire dans un fichier XML
*/
public class ElementXML {
private TransformerFactory transformerFactory;
private Transformer transformer;
private DocumentBuilderFactory documentFactory;
private DocumentBuilder documentBuilder;
/**
* Le nom du fichier XML qu'on lit
*/
private static String XML_INPUT_FILE = "files/Element.xml";
public ElementXML() {
try {
transformerFactory = TransformerFactory.newInstance();
transformer = transformerFactory.newTransformer();
documentFactory = DocumentBuilderFactory.newInstance();
documentBuilder = documentFactory.newDocumentBuilder();
} catch (TransformerException tfe) {
tfe.printStackTrace();
} catch (ParserConfigurationException pce) {
pce.printStackTrace();
}
}
/**
* La methode qui transforme le document en memoire en fichier XML sur le disque dur
* @param document le document à transformer
* @param filePath le chemin (répértoire et nom) du fichier XML à créer
*/
public void createXMLFile(Document document, String filePath)
{
try {
DOMSource domSource = new DOMSource(document);
StreamResult streamResult = new StreamResult(new File(filePath));
//transform the DOM Object to an XML File
transformer.transform(domSource, streamResult);
} catch (TransformerException tfe) {
tfe.printStackTrace();
}
System.out.println("Done creating Element XML File");
}
/**
* La methode qui crée le document en memoire
* @return le document créé
*/
public Document createXMLDocument()
{
return documentBuilder.newDocument();
}
/**
* La methode qui lit un fichier XML et le transforme en liste de noeuds en mémoire
* @param filePath le chemin (répértoire et nom) du fichier XML à lire
* @return la liste des noeuds lus
*/
public NodeList parseXMLFile (String filePath) {
NodeList elementNodes = null;
try {
Document document= documentBuilder.parse(new File(filePath));
Element root = document.getDocumentElement();
elementNodes = root.getChildNodes();
}
catch (SAXException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
return elementNodes;
}
/**
* Methode qui permet de lire plusieurs Chansons contenue dans le fichier Element.xml
* Elle return une ChansonTemp qui contient une list de Chansons
* @return
*/
public ChansonTemp readXMLChanson(){
NodeList nodes = this.parseXMLFile(XML_INPUT_FILE);
ChansonTemp chansonTemp = new ChansonTemp();
if (nodes == null) return null;
for (int i = 0; i<nodes.getLength(); i++) {
if (nodes.item(i).getNodeType() == Node.ELEMENT_NODE){
Element currentElement = (Element) nodes.item(i);
System.out.println(currentElement.getNodeName());
if (currentElement.getNodeName().equals("Chanson")) {
try {
String title = currentElement.getElementsByTagName("Title").item(0).getTextContent();
String idString = currentElement.getElementsByTagName("ID").item(0).getTextContent();
int id = Integer.parseInt(idString);
String artiste = currentElement.getElementsByTagName("Artiste").item(0).getTextContent();
String contenu = currentElement.getElementsByTagName("Contenu").item(0).getTextContent();
Genres genre = Genres.valueOf(currentElement.getElementsByTagName("Genre").item(0).getTextContent());
String dureeString = currentElement.getElementsByTagName("Duree").item(0).getTextContent();
int duree = Integer.parseInt(dureeString);
Chanson chanson = new Chanson(title, id, artiste, contenu, genre, duree);
chansonTemp.addChanson(chanson);
} catch (Exception ex) {
System.out.println("Something is wrong with the XML client element");
}
}
}
}
return chansonTemp;
}
/**
* Methode qui permet de lire plusieurs LvireAudio contenue dans le fichier Element.xml
* Elle return un LivreAudioTemp qui contient une liste de LivreAudio
* @return
*/
public LivreAudioTemp readXMLLivreAudio(){
NodeList nodes = this.parseXMLFile(XML_INPUT_FILE);
LivreAudioTemp livreAudioTemp = new LivreAudioTemp();
if (nodes == null) return null;
for (int i = 0; i<nodes.getLength(); i++) {
if (nodes.item(i).getNodeType() == Node.ELEMENT_NODE){
Element currentElement = (Element) nodes.item(i);
if (currentElement.getNodeName().equals("LivreAudio")){
try {
String title = currentElement.getElementsByTagName("Title").item(0).getTextContent();
String idString = currentElement.getElementsByTagName("ID").item(0).getTextContent();
int id = Integer.parseInt(idString);
String auteur = currentElement.getElementsByTagName("Auteur").item(0).getTextContent();
String contenu = currentElement.getElementsByTagName("Contenu").item(0).getTextContent();
Langues langue = Langues.valueOf(currentElement.getElementsByTagName("Langue").item(0).getTextContent());
Categories categorie = Categories.valueOf(currentElement.getElementsByTagName("Categorie").item(0).getTextContent());
String dureeString = currentElement.getElementsByTagName("Duree").item(0).getTextContent();
int duree = Integer.parseInt(dureeString);
LivreAudio livreAudio = new LivreAudio(title, id, auteur, contenu, langue, categorie, duree);
livreAudioTemp.addLivreAudio(livreAudio);
} catch (Exception ex) {
System.out.println("Something is wrong with the XML client element");
}
}
}
}
return livreAudioTemp;
}
/**
* Methode pour démontrer l'écriture d'un fichier XML avec un seul élément
*/
public void writeXMLElement(ChansonTemp chansonTemp, LivreAudioTemp livreAudioTemp) {
Document document = this.createXMLDocument();
List<Audio> listAudio = new ArrayList<>();
if (document == null) return;
for(Audio audio : chansonTemp.getListChanson()){ //boucle pour recuperer les chansons de chansonTemp et les mettre dans listAudio
listAudio.add(audio);
}
for(Audio audio : livreAudioTemp.getListLivreAudio()){ //boucle pour recuperer les livreAudio et les mettre dans listAudio
listAudio.add(audio);
}
Element root = document.createElement("Elements");
document.appendChild(root);
for(Audio audio : listAudio){ //boucle pour mettre tout les elements dans les elements dans root
root.appendChild(audio.getElement(document));
}
this.createXMLFile(document, XML_INPUT_FILE);
}
}
| [
"raph99.rph@gmail.com"
] | raph99.rph@gmail.com |
588f3bcb6ccbc29064e97bb9eda151456cf3ca00 | 49ce7ed3bdd0031df115ddd7119c64cb273a7fcc | /src/main/java/com/haier/service/impl/ImportServiceImpl.java | f386a074a21a782c619f01fcb7f52c4957717019 | [] | no_license | lishanghan/easyAuto | c1d2aed64ecab4a5a7abd3ad849bacf7b44f43b4 | 17991a76f337a1e4963a68a68c2128bb7ea0015e | refs/heads/master | 2020-04-16T22:23:43.570853 | 2019-02-17T15:39:00 | 2019-02-17T15:39:00 | 165,965,805 | 4 | 2 | null | null | null | null | UTF-8 | Java | false | false | 20,822 | java | package com.haier.service.impl;
import com.alibaba.druid.support.json.JSONUtils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.haier.enums.*;
import com.haier.exception.HryException;
import com.haier.mapper.TserviceMapper;
import com.haier.po.*;
import com.haier.service.*;
import com.haier.util.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description:
* @Author: luqiwei
* @Date: 2018/5/19 13:21
*/
@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
@Slf4j
@Service
public class ImportServiceImpl implements ImportService {
@Autowired
TserviceMapper tserviceMapper;
@Autowired
TiService tiService;
@Autowired
TcaseService tcaseService;
@Autowired
TserviceService tserviceService;
@Autowired
TservicedetailService tservicedetailService;
@Override
public ImportInterfaceResult importInterface(Integer serviceId, JSONObject jsonObject, Boolean overwrite, Boolean isDelete, String iDev) {
String serviceKey = jsonObject.getJSONObject("info").getString("title");
String serviceName = jsonObject.getJSONObject("info").getString("description");
ImportInterfaceResult result = new ImportInterfaceResult();
result.setServiceId(serviceId);
result.setServiceKey(serviceKey);
result.setServiceName(serviceName);
List<String> insertList = new ArrayList<>();
List<String> updateList = new ArrayList<>();
List<String> failList = new ArrayList<>();
//获取接口表(ti)已经存在的记录,by serviceId
Ti condition = new Ti();
condition.setServiceid(serviceId);
List<Ti> tis = tiService.selectAllStatusByCondition(condition);//ti表中所有的此serviceId存在的记录的集合,包括删除与作废的
List<String> existIuri = new ArrayList<>();
List<String> deleteIuri = new ArrayList<>();
List<String> invalidIuri = new ArrayList<>();
Map<String, Integer> existIuriId = new HashMap<>();//后续更新记录时会用到primaryKey
Map<String, Integer> deleteIuriId = new HashMap<>();
Map<String, Integer> invalidIuriId = new HashMap<>();
for (Ti i : tis) {
if (i.getIstatus() > 0) {
existIuri.add(i.getIuri());
existIuriId.put(i.getIuri(), i.getId());
}
if (i.getIstatus().equals(StatusEnum._ONE.getId())) {
deleteIuri.add(i.getIuri());
deleteIuriId.put(i.getIuri(), i.getId());
}
if (i.getIstatus().equals(StatusEnum._TWO.getId())) {
invalidIuri.add(i.getIuri());
invalidIuriId.put(i.getIuri(), i.getId());
}
}
JSONObject paths = jsonObject.getJSONObject("paths");//获取path:
//definitions主要用于获取示例参数,这里暂时忽略,获取示例参数将改由Selenium从页面抓取
JSONObject definitions = jsonObject.getJSONObject("definitions");//获取definitions
//解析paths,
for (Map.Entry<String, Object> entry : paths.entrySet()) {
String iUri = entry.getKey();//ti.iuri
try {
JSONObject iUriJsonObject = (JSONObject) entry.getValue();
JSONObject postJsonObject = iUriJsonObject.getJSONObject("post");
String summary = postJsonObject.getString("summary");//接口描述信息,作为i.remark插入
Ti ti = new Ti();
ti.setServiceid(serviceId);
ti.setIuri(iUri);
ti.setRemark(summary);
ti.setIdev(iDev);
JSONArray consumes = postJsonObject.getJSONArray("consumes");
String consumesType = consumes.getString(0);
if (ContentTypeEnum.getId(consumesType) != null) {
ti.setIcontenttype(ContentTypeEnum.getId(consumesType));
} else {
ti.setIcontenttype(-1);
}
//解析Json,设置Iparamsample和Iheadersample
JSONArray parametersJSONArr = postJsonObject.getJSONArray("parameters");
if (parametersJSONArr != null && parametersJSONArr.size() > 0) {
Map<String, Object> headermap = new LinkedHashMap<>();
for (Object obj : parametersJSONArr) {
JSONObject someoneParameterJSONObj;
if (obj instanceof JSONObject) {
someoneParameterJSONObj = (JSONObject) obj;
} else {
continue;
}
if ("header".equals(someoneParameterJSONObj.getString("in"))) {
headermap.put((someoneParameterJSONObj.getString("name")), someoneParameterJSONObj.get("default"));
}
if ("body".equals(someoneParameterJSONObj.get("in")) && ti.getIparamsample() == null) {//ti.iparamsample如果存在值,则不执行这里的逻辑
//设置特殊的iparamsample字段
JSONObject schema = someoneParameterJSONObj.getJSONObject("schema");
//如果schema为空
if (Objects.isNull(schema)) {
log.info("parameter中in=body,但是Schema获取不到值 -----" + iUri);
} else {
//判断schema下的ref是否存在
String ref = schema.getString("$ref");
StringBuilder paramsamples = new StringBuilder();
parseRef(ref, definitions, paramsamples);
//设置paramsample
String paramSmapleJSON = JSONUtil.verify(paramsamples.toString());
if (paramSmapleJSON != null) {
if (paramSmapleJSON.length() > 5000) {
String params = paramsamples.substring(0, 4999);
ti.setIparamsample(params);
} else {
ti.setIparamsample(paramSmapleJSON);
}
} else {
if (paramsamples != null) {
if (paramsamples.length() > 5000) {
ti.setIparamsample(paramsamples.substring(0, 4999));
} else {
ti.setIparamsample(paramsamples.toString());
}
}
}
}
}
}
if (headermap.size() > 0) {
//设置headersmaple
ti.setIheadersample(JSONUtils.toJSONString(headermap));
}
}
//如果此接口已经作废,则直接忽略引接口
if (invalidIuri.size() > 0 && invalidIuri.contains(iUri) /*&& (existIuri.size() == 0 || !existIuri.contains(iUri))*/) {
failList.add(iUri + "(已作废)");
continue;
}
//如果此服务下不存在接口,或者虽然存在接口,但是不包含当前这条接口记录
if (existIuri.size() == 0 || !existIuri.contains(iUri)) {
tiService.insertOne(ti);
insertList.add(iUri);
} else {//existIuri.size()>0 && existIuri包含当前要插入的记录
if (overwrite) {//如果overwrite==true,则覆盖存在的记录,将数据更新
ti.setId(existIuriId.get(iUri));
tiService.updateOne(ti);
updateList.add(iUri);
existIuri.remove(iUri);
} else {//如果overwrite==false,则不覆盖记录,直接忽略这条ti记录
failList.add(iUri + "(已存在)");
existIuri.remove(iUri);
}
}
} catch (Exception e) {
log.error(iUri + "解析json错误", e);
throw new HryException(StatusCodeEnum.PARSE_JSON_ERROR, "解析json错误");
}
}
List<String> deleteList = new ArrayList<>();
//如果existIuri没有被remove,则说明这些Iuri没有存在于最新的swagger文档中,如果用户选择删除这些接口,则将这些接口删除
if (isDelete) {
for (int i = 0; i < existIuri.size(); i++) {
//如果此接口是虚拟接口,则忽略
if (existIuri.get(i).matches(RegexEnum.VIRTUAL_INTERFACE.getRegex())) {
continue;
}
Integer deleteId = existIuriId.get(existIuri.get(i));
tiService.deleteOne(deleteId);
deleteList.add(existIuri.get(i));
}
}
//构建返回信息
result.setTotalCount(paths.size());
result.setInsertCount(insertList.size());
result.setInsertList(insertList);
result.setUpdateCount(updateList.size());
result.setUpdateList(updateList);
result.setFailCount(failList.size());
result.setFailList(failList);
result.setDeleteCount(deleteList.size());
result.setDeleteList(deleteList);
return result;
}
@Override
public ImportInterfaceResult importInterface(Integer serviceId, Integer envId, JSONObject postmanJson, Boolean overwriteI, Boolean overwriteC, String dev, String cAuthor) {
Tservice tservice = tserviceService.selectOne(serviceId);
ImportInterfaceResult result = new ImportInterfaceResult();
result.setServiceId(serviceId);
result.setServiceKey(tservice.getServicekey());
result.setServiceName(tservice.getServicename());
List<String> insertList = new ArrayList<>();
List<String> updateList = new ArrayList<>();
List<String> deleteList = new ArrayList<>();
List<String> failList = new ArrayList<>();
JSONArray is = postmanJson.getJSONArray("item");
if (is == null || is.size() == 0) {
return result;
}
Tservicedetail tservicedetail = tservicedetailService.selectOne(serviceId, envId);
String hostInfo = tservicedetail.getHostinfo();
Map<String, Ti> i_map = new HashMap<>();
Map<String, List<Tcase>> c_map = new HashMap<>();
collectTiTcase(serviceId, dev, cAuthor, is, hostInfo, i_map, c_map);
/**
* 根据是否覆盖的需求 ,入库
*/
Ti condition = new Ti();
condition.setServiceid(serviceId);
List<Ti> tis = tiService.selectByCondition(condition);
// List<String> existIUri = tis.stream().map(Ti::getIuri).collect(Collectors.toList());
Map<String, Ti> existTi = tis.stream().collect(Collectors.toMap(Ti::getIuri, ti -> ti));
for (Map.Entry<String, Ti> entry : i_map.entrySet()) {
String iUri = entry.getKey();
Ti ti = entry.getValue();
//如果新接口不在已存在的接口列表中,则直接插入
if (!existTi.containsKey(iUri)) {
Integer newTiId = tiService.insertOne(ti);
insertList.add(ti.getIuri());
List<Tcase> tcases = c_map.get(iUri);
for (Tcase tcase : tcases) {
tcase.setIid(newTiId);
tcaseService.insertOne(tcase);
}
} else {//数据库中包含本条要插入的接口
if (overwriteI) {//如果覆盖此接口,则此接口的用例也会覆盖
//1.删除老的接口,老的用例
tiService.deleteOne(existTi.get(iUri).getId());
deleteList.add(iUri + "(老接口)");
//2.新增此接口及对应用例
Integer newTiId = tiService.insertOne(ti);
insertList.add(iUri);
List<Tcase> tcases = c_map.get(iUri);
for (Tcase tcase : tcases) {
tcase.setIid(newTiId);
tcaseService.insertOne(tcase);
}
} else {//不覆盖接口
ti.setId(existTi.get(iUri).getId());
/*tiService.updateOne(ti);*///不对接口进行更新
if (overwriteC) {//如果覆盖用例,则将新用例插入,老用例删除,否则 ,不对用例做处理
updateList.add(iUri + "(覆盖用例)");
Tcase conditionTcase = new Tcase();
conditionTcase.setIid(ti.getId());
tcaseService.deleteByCondition(conditionTcase);
} else {//追加用例
updateList.add(iUri + "(追加用例)");
}
//不管是覆盖还是追加,都会有新增用例
List<Tcase> tcases = c_map.get(iUri);
for (Tcase tcase : tcases) {
tcase.setIid(ti.getId());
tcaseService.insertOne(tcase);
}
}
}
}
result.setTotalCount(i_map.size());
result.setInsertList(insertList);
result.setInsertCount(insertList.size());
result.setUpdateList(updateList);
result.setUpdateCount(updateList.size());
result.setDeleteList(deleteList);
result.setDeleteCount(deleteList.size());
result.setFailList(failList);
result.setFailCount(failList.size());
return result;
}
public void collectTiTcase(Integer serviceId, String dev, String cAuthor, JSONArray is, String hostInfo, Map<String, Ti> i_map, Map<String, List<Tcase>> c_map) {
for (int i = 0; i < is.size(); i++) {
JSONObject iObj = is.getJSONObject(i);
if (iObj == null) {
continue;
}
String iName = iObj.getString("name");
JSONArray cs = iObj.getJSONArray("item");
for (int j = 0; j < cs.size(); j++) {
JSONObject cObj = cs.getJSONObject(j);
String cName = cObj.getString("name");
if (cName.length() > 50) {
throw new HryException(StatusCodeEnum.CHECK_ERROR, "caseName过长,不允许超过50个字符,请检查postman中的用例名");
}
JSONObject cRequest = cObj.getJSONObject("request");
String method = cRequest.getString("method");
//JSONArray header = cRequest.getJSONArray("header");
JSONObject body = cRequest.getJSONObject("body");
String cParam = body.getString("raw");
JSONObject url = cRequest.getJSONObject("url");
String fullUrl = url.getString("raw");//http://10.255.12.173:8015/cbp-api/resource/com.cbp.biz.cfLoan.facade.rs.CfLoanResource/createCfXszrLoan
String iUri;//截取hostInfo后面的字符,即/cbp-api/resource/com.cbp.biz.cfLoan.facade.rs.CfLoanResource/createCfXszrLoan
//iUri为空的,直接忽略
try {
iUri = fullUrl.substring(fullUrl.indexOf(hostInfo) + hostInfo.length());
} catch (StringIndexOutOfBoundsException e) {
continue;
}
if (!i_map.containsKey(iUri)) {
Ti ti = new Ti();
ti.setServiceid(serviceId);
ti.setIuri(iUri);
ti.setRemark(iName);
ti.setIrequestmethod(RequestMethodTypeEnum.getId(method));
if (StringUtils.isNotBlank(dev)) {
ti.setIdev(dev);
}
i_map.put(iUri, ti);
}
Tcase tcase = new Tcase();
tcase.setServiceid(serviceId);
tcase.setCasename(cName);
tcase.setRequestparam(cParam);
tcase.setAuthor(cAuthor);
if (!c_map.containsKey(iUri)) {
c_map.put(iUri, Arrays.asList(tcase));
} else {
/*
//java.lang.UnsupportedOperationException
c_map.get(iUri).add(tcase);
*/
List newList = new ArrayList();
newList.addAll(c_map.get(iUri));
newList.add(tcase);
c_map.put(iUri, newList);
}
}
}
}
//ref内层嵌套json解析
private static void parseRef(String ref, JSONObject definitions, StringBuilder paramsamples) {
if (ref == null || ref.length() == 0) {
return;
}
//ref值的/之后的最后一段字英文字符
String refKey = ref.substring(ref.lastIndexOf("/") + 1);
JSONObject refValue = definitions.getJSONObject(refKey);
//ref打开后获取type和properties
String type = refValue.getString("type");
JSONObject propertiesJSONObject = refValue.getJSONObject("properties");
//type为object且properties不为空
if ("object".equals(type) && Objects.nonNull(propertiesJSONObject)) {
paramsamples.append("{");
for (String paramName : propertiesJSONObject.keySet()) {
paramsamples.append("\"").append(paramName).append("\":");
JSONObject paramValueJSONObject = propertiesJSONObject.getJSONObject(paramName);
String paramValueType = paramValueJSONObject.getString("type");
//properties的参数类型判断
if ("array".equals(paramValueType)) {
JSONObject itemsJSONObject = paramValueJSONObject.getJSONObject("items");
String ref1 = itemsJSONObject.getString("$ref");
if (StringUtils.isNotBlank(ref1)) {
paramsamples.append("[");
parseRef(ref1, definitions, paramsamples);
paramsamples.append("]");
paramsamples.replace(paramsamples.lastIndexOf("]"), paramsamples.lastIndexOf("]") + 1, "],");
} else {
log.info("array 中的item为null");
}
} else if ("integer".equals(paramValueType) || "number".equals(paramValueType)) {
paramsamples.append("0,");
} else if ("string".equals(paramValueType)) {
paramsamples.append("\"").append("\",");
} else if ("boolean".equals(paramValueType)) {
paramsamples.append("true,");
} else if ("object".equals(paramValueType)) {
JSONObject additionalPropertiesobj = paramValueJSONObject.getJSONObject("additionalProperties");
String objectPropertiestype = additionalPropertiesobj.getString("type");
if ("object".equals(objectPropertiestype) || "array".equals(objectPropertiestype)) {
paramsamples.append("{},");
}
} else if (StringUtils.isBlank(paramValueType)) {
String propertiesref = paramValueJSONObject.getString("$ref");
if (StringUtils.isNotBlank(propertiesref)) {
parseRef(propertiesref, definitions, paramsamples);
paramsamples.replace(paramsamples.lastIndexOf("}"), paramsamples.lastIndexOf("}") + 1, "},");
}
}
}
if (paramsamples.lastIndexOf(",") >= 0) {
paramsamples.replace(paramsamples.lastIndexOf(","), paramsamples.lastIndexOf(",") + 1, "");
paramsamples.append("}");
}
} else if ("object".equals(type) && Objects.isNull(propertiesJSONObject)) {
paramsamples.append(" ");
}
}
}
| [
"lishaghan@kjtpay.com.cn"
] | lishaghan@kjtpay.com.cn |
a8493dccacc57ed921722d403ac8f2df2878cd4f | 9ea2f84d5241a4761f5c2c9d3a65bf186502815b | /code/demo/IDesignPattern/structural/Decorator/src/main/java/cn/i/xportal/jdp/decorator/printinvoice/SalesOrder.java | 379c84076c7007ae6cf3690efd101ea6b71bab94 | [] | no_license | icesx/IResearch | ffee22cd5846df11ffc9e4bdd22305b753def2c3 | 8349098219f062e07fa0eab6122503eb72d94223 | refs/heads/master | 2022-11-28T22:29:00.062512 | 2021-09-03T02:04:33 | 2021-09-03T02:04:33 | 120,061,918 | 0 | 0 | null | 2022-11-16T00:53:13 | 2018-02-03T05:19:16 | Java | UTF-8 | Java | false | false | 162 | java | package cn.i.xportal.jdp.decorator.printinvoice;
public class SalesOrder extends Order {
public SalesOrder() {
}
public void print() {
super.print();
}
}
| [
"chengtao@ithink"
] | chengtao@ithink |
168c902852b7c0c8f899fd1b635278b68c6cc3d9 | da39432f3c0f93567c576a42211a56e871ea9239 | /workspace_comp/CompUeb1/src/classes/ScannerImpl.java | 15528a20398e2a12abd16690265c78a232346cd2 | [] | no_license | Miluba/Kompilerbau | 061820ea725ea83ecc2d566450d6f23448adbf72 | 2724a784b62847af68830e940ee6e66083278bad | refs/heads/master | 2021-01-22T06:06:20.938815 | 2012-05-14T08:56:16 | 2012-05-14T08:56:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,449 | java | package classes;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
import interfaces.Scanner;
public class ScannerImpl implements Scanner {
private char[] eingabe = null;
private String lexem = "";
private int arrayPosition = 0;
public ScannerImpl() {
BufferedReader in = null;
String input = null;
try {
in = new BufferedReader(new InputStreamReader(System.in));
input = in.readLine();
eingabe = input.toCharArray();
} catch (IOException e) {
System.out.println("InputStreamReader" + e.getMessage());
e.printStackTrace();
}
}
private void init() {
lexem = "";
}
private String nextCharachter() {
if (eingabe.length > arrayPosition)
lexem = lexem + eingabe[arrayPosition++];
else
return null;
return lexem;
}
@Override
public ScanOutputImpl scan() {
this.init();
nextCharachter();
// Leerzeichen
while (lexem.equals(" ")) {
this.init();
if (nextCharachter() == null)
break;
}
if (lexem.equals("+")) {
return new ScanOutputImpl(PLUS, lexem, 0);
} else if (lexem.equals("-"))
return new ScanOutputImpl(MINUS, lexem, 0);
else if (lexem.equals("/"))
return new ScanOutputImpl(GETEILT, lexem, 0);
else if (lexem.equals("*"))
return new ScanOutputImpl(MAL, lexem, 0);
else if (lexem.equals("^"))
return new ScanOutputImpl(HOCH, lexem, 0);
else if (lexem.equals("("))
return new ScanOutputImpl(KLAMMER_AUF, lexem, 0);
else if (lexem.equals(")"))
return new ScanOutputImpl(KLAMMER_ZU, lexem, 0);
else if (lexem.equals("."))
return new ScanOutputImpl(FALSCHE_KONST, lexem, FEHLER);
else if (lexem.equals(";")) {
return new ScanOutputImpl(ENDE, lexem, 0);
} else if (!isNumber(lexem))
return new ScanOutputImpl(FALSCHES_ZEICHEN, lexem, FEHLER);
else if (isNumber(lexem)) {
while (isNumber(lexem)) {
String next = nextCharachter();
if (lexem.endsWith("."))
nextCharachter();
else if (!isNumber(lexem)) {
arrayPosition--;
return new ScanOutputImpl(ZAHL, lexem.substring(0,
lexem.length() - 1), 0);
} else if (next == null)
return new ScanOutputImpl(ZAHL, lexem, 0);
}
}
return new ScanOutputImpl(FALSCHES_ZEICHEN, lexem, FEHLER);
}
public boolean isNumber(String regex) {
return Pattern.matches("([0-9]*\\.)?[0-9]+", regex);
}
public int getIndex(){
return arrayPosition;
}
}
| [
"johannes-merz-2006@web.de"
] | johannes-merz-2006@web.de |
0934b31791b21b57d3fe8125e150fbfa6680abf9 | e0cc36833a32623f2ccafb27142cdd3afd5c8083 | /producer/src/main/java/testdemo/fanout/FanoutProducerTest.java | e1aee9a8a3b8ee7bcfa670decc80829d332c2df8 | [] | no_license | guopy666/rabmqdemo | 29d3ce00a33af2af7d4778c8d753e6df0dd6ec65 | 8d8f0213cfb7459e3fef9c3744aa1ce868a04836 | refs/heads/master | 2021-05-18T13:03:42.893398 | 2020-03-30T09:16:10 | 2020-03-30T09:16:10 | 251,253,969 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,465 | java | package testdemo.fanout;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import utils.RabbitMQUtil;
import java.io.IOException;
import java.util.concurrent.TimeoutException;
/**
* @Description: 订阅模式
* @author: guopy
* @Date: 2020/3/28 17:49
* @version: v1.0.0
*/
public class FanoutProducerTest {
private static final String EXCHANGE_NAME = "fanout_exchange";
public static void main(String[] args) throws IOException, TimeoutException {
/** 1.创建新的连接 */
Connection connection = RabbitMQUtil.newConnection();
/** 2.创建通道 */
Channel channel = connection.createChannel();
/** 3.绑定的交换机 参数1交互机名称 参数2 exchange类型 */
channel.exchangeDeclare(EXCHANGE_NAME, "fanout");
/** 4.发送消息 */
for (int i = 0; i < 10; i++)
{
String message = "用户注册消息:" + i;
System.out.println("[send]:" + message);
//发送消息
channel.basicPublish(EXCHANGE_NAME, "", null, message.getBytes("utf-8"));
try {
Thread.sleep(5 * i);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/** 5.关闭通道、连接 */
channel.close();
connection.close();
/** 注意:如果消费没有绑定交换机和队列,则消息会丢失 */
}
} | [
"guo_pengying@163.com"
] | guo_pengying@163.com |
b6343f682ed2e4600de681700cf219aa74e490da | d1baebfdb5870888b69f7f04ebdea49ec70367bb | /java/Q5_1/Main.java | 5198496f43155a8f690344f32571933e752fc25b | [] | no_license | kimcww/leetcode | 0c15c7d5fd66e82aaeb4ee81bcc4e1a7251f17ae | 21e04fe6a1659c320e53d323d11052ad08d48c46 | refs/heads/main | 2023-08-29T07:49:33.795834 | 2021-10-15T11:37:28 | 2021-10-15T11:37:28 | 330,284,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 716 | java | import java.util.*;
public class Main {
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
String input = in.next();
Stack<Character> data = new Stack<Character>();
for(char c : input.toCharArray())
{
if(c == '(')
data.push('(');
else if(c == ')')
{
if(data.empty()){
System.out.print("NO");
return;
}
else
data.pop();
}
}
if(!data.empty())
System.out.print("NO");
else
System.out.print("YES");
}
} | [
"kimcww@github.com"
] | kimcww@github.com |
1049e78d6cc370ffbde84acf4d147f8d9e4ae021 | 42f198fb0317d9ba2611be5373c55fc3aa17a4a2 | /src/chatbot/ChatBot.java | 323bdb4c775137b03922984e3af35a1ed27ec78d | [] | no_license | cyborg18/Chat-Bot | a92ccf38c39273cf8e01f44fe6de0a43c0af231e | 2c14771880e29f68a2cead8c101e620c9c269ae1 | refs/heads/master | 2020-12-24T19:46:30.429843 | 2016-05-24T05:06:25 | 2016-05-24T05:06:25 | 59,542,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,007 | java | package chatbot;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import java.awt.Color;
import java.awt.event.KeyListener;
import java.awt.event.KeyEvent;
import java.lang.Math;
public class ChatBot extends JFrame implements KeyListener{
JPanel p=new JPanel();
JTextArea dialog=new JTextArea(20,50);
JTextArea input=new JTextArea(1,50);
JScrollPane scroll=new JScrollPane(
dialog,
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER
);
String[][] chatBot={
//standard greetings
{"hi","hello","hola","ola","howdy"},
{"hi","hello","hey"},
//question greetings
{"how are you","how r you","how r u","how are u"},
{"good","doing well"},
//yes
{"yes"},
{"no","NO","NO!!!!!!!"},
//default
{"shut up","you're bad","noob","stop talking",
"(michael is unavailable, due to LOL)"}
};
public static void main(String[] args){
new ChatBot();
}
public ChatBot(){
super("Chat Bot");
setSize(600,400);
setResizable(false);
setDefaultCloseOperation(EXIT_ON_CLOSE);
dialog.setEditable(false);
input.addKeyListener(this);
p.add(scroll);
p.add(input);
p.setBackground(new Color(255,200,0));
add(p);
setVisible(true);
}
public void keyPressed(KeyEvent e){
if(e.getKeyCode()==KeyEvent.VK_ENTER){
input.setEditable(false);
//-----grab quote-----------
String quote=input.getText();
input.setText("");
addText("-->You:\t"+quote);
quote.trim();
while(
quote.charAt(quote.length()-1)=='!' ||
quote.charAt(quote.length()-1)=='.' ||
quote.charAt(quote.length()-1)=='?'
){
quote=quote.substring(0,quote.length()-1);
}
quote.trim();
byte response=0;
/*
0:we're searching through chatBot[][] for matches
1:we didn't find anything
2:we did find something
*/
//-----check for matches----
int j=0;//which group we're checking
while(response==0){
if(inArray(quote.toLowerCase(),chatBot[j*2])){
response=2;
int r=(int)Math.floor(Math.random()*chatBot[(j*2)+1].length);
addText("\n-->Michael\t"+chatBot[(j*2)+1][r]);
}
j++;
if(j*2==chatBot.length-1 && response==0){
response=1;
}
}
//-----default--------------
if(response==1){
int r=(int)Math.floor(Math.random()*chatBot[chatBot.length-1].length);
addText("\n-->Michael\t"+chatBot[chatBot.length-1][r]);
}
addText("\n");
}
}
public void keyReleased(KeyEvent e){
if(e.getKeyCode()==KeyEvent.VK_ENTER){
input.setEditable(true);
}
}
public void keyTyped(KeyEvent e){}
public void addText(String str){
dialog.setText(dialog.getText()+str);
}
public boolean inArray(String in,String[] str){
boolean match=false;
for(int i=0;i<str.length;i++){
if(str[i].equals(in)){
match=true;
}
}
return match;
}
}
| [
"saitejareddy26@gmail.com"
] | saitejareddy26@gmail.com |
43cd40f21d2117ebd15947cf1731c4c9c20ee4c6 | f5bc2d398b15700beff987a528fa8a4315faed3e | /apps/orchestrator/web/src/main/java/org/onosproject/orchestrator/dismi/primitives/extended/DelayConstraintExtended.java | e28df5e544fcac3321293eae1ad7e47a4c34f023 | [
"Apache-2.0"
] | permissive | ACINO-H2020/network-orchestrator | 6dc73109589b0cc95e28d58f1f8fffbd9b2d4d16 | 33bafd60caf868e3d9e3353f0c34654771cc00f7 | refs/heads/master | 2021-04-18T21:35:40.730336 | 2018-04-10T17:41:25 | 2018-04-17T14:55:09 | 126,780,637 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,961 | java | /*
* Copyright (c) 2018 ACINO Consortium
*
* 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.onosproject.orchestrator.dismi.primitives.extended;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.onosproject.orchestrator.dismi.primitives.DelayConstraint;
import java.util.Objects;
/**
* Maximum latency and maximum jitter are simple primitives that are interpreted
* as one way latency/jitter or two-way latency/jitter depending on the Action
* they are associated with (i.e. one-way for Path, two-way for Connection).
**/
@ApiModel(description = "\"A DelayConstraintExtended is an inernal primitive " +
"that extends the DelayConstraint with\" +\n" +
"\" its associated parameters. It is created during the " +
"resolution phase of an intent validation and\" +\n" +
"\" resolution process.\")")
@javax.annotation.Generated(
value = "class io.swagger.codegen.languages.JavaJerseyServerCodegen",
date = "2016-10-11T12:29:51.886Z")
public class DelayConstraintExtended extends DelayConstraint {
private Double latencyExt = null;
private Double jitterExt = null;
/**
**/
public DelayConstraintExtended(DelayConstraint delayConstraint) {
setLatency(delayConstraint.getLatency());
setJitter(delayConstraint.getJitter());
}
@ApiModelProperty(required = true,
value = "Latency constraint, specified as a time - FIXME: should we use date-time format?")
@JsonProperty("latencyExt")
public Double getLatencyExt() {
return latencyExt;
}
public void setLatencyExt(Double latencyExt) {
this.latencyExt = latencyExt;
}
@ApiModelProperty(required = true,
value = "Jitter constraint, specified as a time - FIXME: should we use date-time format?")
@JsonProperty("jitterExt")
public Double getJitterExt() {
return jitterExt;
}
public void setJitterExt(Double jitterExt) {
this.jitterExt = jitterExt;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
DelayConstraintExtended delayConstraint = (DelayConstraintExtended) o;
return Objects.equals(latencyExt, delayConstraint.latencyExt) &&
Objects.equals(jitterExt, delayConstraint.jitterExt) &&
super.equals(o);
}
@Override
public int hashCode() {
return Objects.hash(latencyExt, jitterExt, super.hashCode());
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class DelayConstraint {\n");
sb.append(" ").append(toIndentedString(super.toString())).append("\n");
sb.append(" latency: ").append(toIndentedString(latencyExt)).append("\n");
sb.append(" jitter: ").append(toIndentedString(jitterExt)).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(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
| [
"info@acino.eu"
] | info@acino.eu |
de763239f4983696c142177461b0f9e29e358954 | 907797579a1b24481538a618dd406ee50da2031f | /src/dao/Seance_GroupeDAO.java | 59d05974b72c2d05e49082c686e23da2c97c89ca | [] | no_license | DominikCarbon/TimeTable | 5f47a32b61903a677467f049f91d910383d885d9 | 76095f4bea80ac586c04ed87016cd4c1a80093c5 | refs/heads/master | 2022-10-17T13:16:05.807482 | 2020-06-07T21:48:58 | 2020-06-07T21:48:58 | 268,539,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,590 | 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 dao;
import static dao.DAO.stmt;
import java.sql.SQLException;
import model.Seance_Groupe;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import model.Etudiant;
/**
*
* @author Dominik
*/
public class Seance_GroupeDAO extends DAO<Seance_Groupe>{
@Override
public boolean create(Seance_Groupe obj) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean delete(Seance_Groupe obj) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean update(Seance_Groupe obj) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Seance_Groupe find(Seance_Groupe obj) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public ArrayList<Seance_Groupe> trouver(Seance_Groupe obj)
{
if(obj==null)
{
System.out.println("nuuuuul");
}
else
{
try {
int idG=obj.getIDGroupe();
stmt=this.co.createStatement();
rset = stmt.executeQuery("SELECT * FROM `projet_java`.`Seance_Groupe` WHERE (ID_Groupe='"+idG+"')");
// récupération du résultat de l'ordre
rsetMeta = rset.getMetaData();
// calcul du nombre de colonnes du resultat
int nbColonne = rsetMeta.getColumnCount();
System.out.println("on est dans find, nb colonne="+nbColonne);
if(nbColonne==0)
{
return null;
}
else
{
int idS;
ArrayList<Seance_Groupe> A=new ArrayList<>();
while(rset.next())
{
idS=rset.getInt(1);
Seance_Groupe S=new Seance_Groupe(obj.getIDGroupe(),idS);
A.add(S);
}
return A;
}
} catch (SQLException ex) {
Logger.getLogger(UtilisateurDAO.class.getName()).log(Level.SEVERE, null, ex);
}
}
return null;
}
}
| [
"tescelin.hanoteaux@edu.ece.fr"
] | tescelin.hanoteaux@edu.ece.fr |
701a972f5aac15529fa4f9d98e5175ff33d095f5 | 97561bfc5238f2fd6b4fbe5bb5e7d1d78e1bc3de | /nitrite/src/main/java/org/dizitart/no2/internals/IndexingService.java | 9de42c07d11dc0780409cb4474eaddf611e53941 | [
"Apache-2.0"
] | permissive | mmariuzzo/nitrite-database | 23a495f046dfc184b695ca97ec5aedf16a9dbdb0 | 36aa3a64e9b80f9b33274f0d5068357de55afbba | refs/heads/master | 2022-04-13T16:10:27.090621 | 2020-03-25T18:19:41 | 2020-03-25T18:19:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,746 | java | /*
*
* Copyright 2017-2018 Nitrite 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.dizitart.no2.internals;
import org.dizitart.no2.*;
import org.dizitart.no2.exceptions.IndexingException;
import org.dizitart.no2.exceptions.UniqueConstraintException;
import org.dizitart.no2.fulltext.TextIndexingService;
import org.dizitart.no2.store.NitriteMap;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicBoolean;
import static org.dizitart.no2.exceptions.ErrorCodes.*;
import static org.dizitart.no2.exceptions.ErrorMessage.NON_STRING_VALUE_IN_FULL_TEXT_INDEX;
import static org.dizitart.no2.exceptions.ErrorMessage.errorMessage;
import static org.dizitart.no2.util.DocumentUtils.getFieldValue;
import static org.dizitart.no2.util.DocumentUtils.getFields;
import static org.dizitart.no2.util.ValidationUtils.validateDocumentIndexField;
/**
* @author Anindya Chatterjee.
*/
class IndexingService {
private final NitriteMap<NitriteId, Document> underlyingMap;
private final IndexMetaService indexMetaService;
private final Map<String, AtomicBoolean> indexBuildRegistry;
private final ExecutorService rebuildExecutor;
private final TextIndexingService textIndexingService;
IndexingService(IndexMetaService indexMetaService,
TextIndexingService textIndexingService,
NitriteContext nitriteContext) {
this.indexBuildRegistry = new ConcurrentHashMap<>();
this.rebuildExecutor = nitriteContext.getWorkerPool();
this.indexMetaService = indexMetaService;
this.textIndexingService = textIndexingService;
this.underlyingMap = indexMetaService.getUnderlyingMap();
}
void createIndex(String field, IndexType indexType, boolean isAsync) {
Index index;
if (!indexMetaService.hasIndex(field)) {
// if no index create index
index = indexMetaService.createIndexMetadata(field, indexType);
} else {
// if index already there throw
throw new IndexingException(errorMessage(
"index already exists on " + field, IE_INDEX_EXISTS));
}
try {
rebuildIndex(index, isAsync);
} catch (IllegalStateException ise) {
throw new IndexingException(errorMessage(
ise.getMessage(), IE_CREATE_INDEX_FAILED), ise);
}
}
void updateIndexEntry(Document document, NitriteId nitriteId) {
Set<String> fields = getFields(document);
for (String field : fields) {
Index index = indexMetaService.findIndex(field);
if (index != null) {
Object fieldValue = getFieldValue(document, field);
if (fieldValue == null) continue;
validateDocumentIndexField(fieldValue, field);
// if dirty index and currently indexing is not running, rebuild
if (indexMetaService.isDirtyIndex(field)
&& indexBuildRegistry.get(field) != null
&& !indexBuildRegistry.get(field).get()) {
// rebuild will also take care of the current document
rebuildIndex(index, true);
} else {
IndexType indexType = index.getIndexType();
if (indexType == IndexType.Fulltext && fieldValue instanceof String) {
// update text index
textIndexingService.updateIndex(nitriteId, field, (String) fieldValue);
} else {
NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
= indexMetaService.getIndexMap(field);
// create the nitriteId list associated with the value
ConcurrentSkipListSet<NitriteId> nitriteIdList
= indexMap.get((Comparable) fieldValue);
if (nitriteIdList == null) {
nitriteIdList = new ConcurrentSkipListSet<>();
}
if (indexType == IndexType.Unique && nitriteIdList.size() == 1
&& !nitriteIdList.contains(nitriteId)) {
// if key is already exists for unique type, throw error
throw new UniqueConstraintException(errorMessage(
"unique key constraint violation for " + field,
UCE_UPDATE_INDEX_CONSTRAINT_VIOLATED));
}
// add the nitriteId to the list
nitriteIdList.add(nitriteId);
indexMap.put((Comparable) fieldValue, nitriteIdList);
}
}
}
}
}
void removeIndexEntry(Document document, NitriteId nitriteId) {
Set<String> fields = getFields(document);
for (String field : fields) {
Index index = indexMetaService.findIndex(field);
if (index != null) {
Object fieldValue = getFieldValue(document, field);
if (fieldValue == null) continue;
// if dirty index and currently indexing is not running, rebuild
if (indexMetaService.isDirtyIndex(field)
&& indexBuildRegistry.get(field) != null
&& !indexBuildRegistry.get(field).get()) {
// rebuild will also take care of the current document
rebuildIndex(index, true);
} else {
IndexType indexType = index.getIndexType();
if (indexType == IndexType.Fulltext && fieldValue instanceof String) {
textIndexingService.deleteIndex(nitriteId, field, (String) fieldValue);
} else {
NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
= indexMetaService.getIndexMap(field);
// create the nitrite list associated with the value
if (fieldValue instanceof Comparable) {
ConcurrentSkipListSet<NitriteId> nitriteIdList = indexMap.get((Comparable) fieldValue);
if (nitriteIdList != null) {
nitriteIdList.remove(nitriteId);
if (nitriteIdList.size() == 0) {
indexMap.remove((Comparable) fieldValue);
} else {
indexMap.put((Comparable) fieldValue, nitriteIdList);
}
}
}
}
}
}
}
}
@SuppressWarnings({"unchecked", "ConstantConditions"})
void refreshIndexEntry(Document oldDocument, Document newDocument, NitriteId nitriteId) {
Set<String> fields = getFields(newDocument);
for (String field : fields) {
Index index = indexMetaService.findIndex(field);
if (index != null) {
Object newValue = getFieldValue(newDocument, field);
Object oldValue = getFieldValue(oldDocument, field);
if (newValue == null) continue;
if (newValue instanceof Comparable && oldValue instanceof Comparable) {
if (((Comparable) newValue).compareTo(oldValue) == 0) continue;
}
validateDocumentIndexField(newValue, field);
// if dirty index and currently indexing is not running, rebuild
if (indexMetaService.isDirtyIndex(field) &&
indexBuildRegistry.get(field) != null
&& !indexBuildRegistry.get(field).get()) {
// rebuild will also take care of the current document
rebuildIndex(index, true);
} else {
IndexType indexType = index.getIndexType();
if (indexType == IndexType.Fulltext && newValue instanceof String) {
// update text index
textIndexingService.updateIndex(nitriteId, field, (String) newValue);
} else {
NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
= indexMetaService.getIndexMap(field);
// create the nitriteId list associated with the value
ConcurrentSkipListSet<NitriteId> nitriteIdList
= indexMap.get((Comparable) newValue);
if (nitriteIdList == null) {
nitriteIdList = new ConcurrentSkipListSet<>();
}
if (indexType == IndexType.Unique && nitriteIdList.size() == 1
&& !nitriteIdList.contains(nitriteId)) {
// if key is already exists for unique type, throw error
throw new UniqueConstraintException(errorMessage(
"unique key constraint violation for " + field,
UCE_REFRESH_INDEX_CONSTRAINT_VIOLATED));
}
// add the nitriteId to the list
nitriteIdList.add(nitriteId);
indexMap.put((Comparable) newValue, nitriteIdList);
nitriteIdList = indexMap.get((Comparable) oldValue);
if (nitriteIdList != null && !nitriteIdList.isEmpty()) {
nitriteIdList.remove(nitriteId);
if (nitriteIdList.size() == 0) {
indexMap.remove((Comparable) oldValue);
} else {
indexMap.put((Comparable) oldValue, nitriteIdList);
}
}
}
}
}
}
}
Collection<Index> listIndexes() {
return indexMetaService.listIndexes();
}
boolean isIndexing(String field) {
// has index will only return true, if there is an index on
// the value and indexing is not running on it
return indexMetaService.hasIndex(field)
&& indexBuildRegistry.get(field) != null
&& indexBuildRegistry.get(field).get();
}
void dropIndex(String field) {
if (indexBuildRegistry.get(field) != null
&& indexBuildRegistry.get(field).get()) {
throw new IndexingException(errorMessage(
"can not drop index as indexing is running on " + field,
IE_CAN_NOT_DROP_RUNNING_INDEX));
}
if (indexMetaService.hasTextIndex(field)) {
textIndexingService.deleteIndexesByField(field);
if (!(textIndexingService instanceof NitriteTextIndexingService)) {
indexMetaService.dropIndex(field);
}
} else {
indexMetaService.dropIndex(field);
}
indexBuildRegistry.remove(field);
}
void dropAllIndices() {
for (Map.Entry<String, AtomicBoolean> entry :indexBuildRegistry.entrySet()) {
if (entry.getValue() != null && entry.getValue().get()) {
throw new IndexingException(errorMessage(
"can not drop index as indexing is running on " + entry.getKey(),
IE_CAN_NOT_DROP_ALL_RUNNING_INDEX));
}
}
indexMetaService.dropAll();
textIndexingService.drop();
indexBuildRegistry.clear();
}
// call to this method is already synchronized, only one thread per value
// can access it only if rebuild is already not running for that value
void rebuildIndex(final Index index, boolean isAsync) {
final String field = index.getField();
if (getBuildFlag(field).compareAndSet(false, true)) {
if (isAsync) {
rebuildExecutor.submit(new Runnable() {
@Override
public void run() {
buildIndexInternal(field, index);
}
});
} else {
buildIndexInternal(field, index);
}
return;
}
throw new IndexingException(errorMessage(
"indexing is already running on " + index.getField(),
IE_REBUILD_INDEX_RUNNING));
}
private void buildIndexInternal(final String field, final Index index) {
try {
// first put dirty marker
indexMetaService.markDirty(field);
if (index.getIndexType() != IndexType.Fulltext) {
// create index map
NitriteMap<Comparable, ConcurrentSkipListSet<NitriteId>> indexMap
= indexMetaService.getIndexMap(field);
// remove old values
indexMap.clear();
for (Map.Entry<NitriteId, Document> entry : underlyingMap.entrySet()) {
// create the document
Document object = entry.getValue();
// retrieved the value from document
Object fieldValue = getFieldValue(object, field);
if (fieldValue == null) continue;
validateDocumentIndexField(fieldValue, field);
// create the id list associated with the value
ConcurrentSkipListSet<NitriteId> nitriteIdList = indexMap.get((Comparable) fieldValue);
if (nitriteIdList == null) {
nitriteIdList = new ConcurrentSkipListSet<>();
}
if (index.getIndexType() == IndexType.Unique
&& nitriteIdList.size() == 1) {
// if key is already exists for unique type, throw error
throw new UniqueConstraintException(errorMessage(
"unique key constraint violation for " + field,
UCE_BUILD_INDEX_CONSTRAINT_VIOLATED));
}
// add the id to the list
nitriteIdList.add(entry.getKey());
indexMap.put((Comparable) fieldValue, nitriteIdList);
}
} else {
// for update-rebuild or remove-rebuild this block will never come
for (Map.Entry<NitriteId, Document> entry : underlyingMap.entrySet()) {
// create the document
Document object = entry.getValue();
// retrieve the value from document
Object fieldValue = getFieldValue(object, field);
if (fieldValue == null) continue;
if (!(fieldValue instanceof String)) {
throw new IndexingException(NON_STRING_VALUE_IN_FULL_TEXT_INDEX);
}
textIndexingService.createIndex(entry.getKey(), field, (String) fieldValue);
}
}
} finally {
// remove dirty marker to denote indexing completed successfully
// if dirty marker is found in any index, it needs to be rebuild
indexMetaService.unmarkDirty(field);
getBuildFlag(field).set(false);
}
}
private synchronized AtomicBoolean getBuildFlag(String field) {
AtomicBoolean flag = indexBuildRegistry.get(field);
if (flag != null) return flag;
flag = new AtomicBoolean(false);
indexBuildRegistry.put(field, flag);
return flag;
}
}
| [
"anidotnet@gmail.com"
] | anidotnet@gmail.com |
2f1ab3ec7eb4f3815c6adea15e8afec8210b8dd9 | ab4bfb431ddc0083037514a460820311fc8d40c9 | /cloud-eureka-server7002/src/main/java/com/atguigu/springcloud/EurekaMain7002.java | 53f3cc4cc2aed064f41709d2d62346371cb3ec19 | [] | no_license | Xfengjin/springcloud-source | 002a297694aa5b9b9df1da9bd3fef6bf72074b11 | f8d3ee000c2916da9ebfeae65b1a676ebeda449e | refs/heads/master | 2023-02-02T08:11:22.506472 | 2020-12-22T05:47:13 | 2020-12-22T05:47:13 | 323,532,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 489 | java | package com.atguigu.springcloud;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
/**
* @author fengjin
* @Slogan 致敬大师,致敬未来的你
*/
@SpringBootApplication
@EnableEurekaServer
public class EurekaMain7002 {
public static void main(String[] args) {
SpringApplication.run(EurekaMain7002.class, args);
}
}
| [
"fengjin@noahsi.con.cn"
] | fengjin@noahsi.con.cn |
043e22f8d471b57ee8cea5ae31583716a23ffa55 | 09126842e0e884e87e343e495559dbdb61f0fd34 | /src/com/readbook/pojo/RbWish.java | aed64a3552b1b7cc484335684040833d6f4f4b4a | [] | no_license | Caikanghua/ReadBook | 8a08813278fdf2cedf43f84d2f2560535b8ad7e9 | 628b1ccbbbd1c98b6885a19588e0999aa13e9008 | refs/heads/master | 2020-03-30T15:38:30.788296 | 2019-03-12T12:35:37 | 2019-03-12T12:35:37 | 151,372,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,681 | java | package com.readbook.pojo;
import java.util.Date;
public class RbWish {
private Integer wishId;
private String userId;
private String bookName;
private String pubHouse;
private String wishDetail;
private Integer hasCheck;
private Date wishDate;
private String author;
public Integer getWishId() {
return wishId;
}
public void setWishId(Integer wishId) {
this.wishId = wishId;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId == null ? null : userId.trim();
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName == null ? null : bookName.trim();
}
public String getPubHouse() {
return pubHouse;
}
public void setPubHouse(String pubHouse) {
this.pubHouse = pubHouse == null ? null : pubHouse.trim();
}
public String getWishDetail() {
return wishDetail;
}
public void setWishDetail(String wishDetail) {
this.wishDetail = wishDetail == null ? null : wishDetail.trim();
}
public Integer getHasCheck() {
return hasCheck;
}
public void setHasCheck(Integer hasCheck) {
this.hasCheck = hasCheck;
}
public Date getWishDate() {
return wishDate;
}
public void setWishDate(Date wishDate) {
this.wishDate = wishDate;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author == null ? null : author.trim();
}
} | [
"1247958670@qq.com"
] | 1247958670@qq.com |
b52d7c1345d81a09f4df3db1fb15430d89e1a3dc | 7cdd1b618fe8a8afb7520f7cbc98eaf8cf154466 | /SpringFrameWork5_BeginnerToGuru/jokes-app/src/main/java/be/vdab/jokesapp/services/JokeService.java | d4eefdb99bf6cf36502329daba453be75eb2e088 | [] | no_license | Goos0018/Udemy_Courses | bd7f8802fa409c8f00a70d13e27b3210d8955d36 | bbe42f214bdc37486fffb855ffd0aa30f99d612f | refs/heads/main | 2023-02-19T02:26:41.623381 | 2021-01-13T07:47:43 | 2021-01-13T07:47:43 | 316,442,715 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 92 | java | package be.vdab.jokesapp.services;
public interface JokeService {
String getJoke();
}
| [
"goosthomas@gmail.com"
] | goosthomas@gmail.com |
7fb789f8e9a23b95348bae892582ace2bd762f68 | 8f103c8a2424f0e869fc2df3e2b4a74454bac6be | /Fridge Reminder/src/edu/calpoly/cpe409/fridgereminder/ExpirationDatabase.java | e290ea7c898514a7930ff8c5bd9f6431aebc79ea | [] | no_license | hitesh24by365/Fridge-Reminder | 41a5dade48477854627dbcafd3488f612280f47e | 8c9a78b3124ba36084f8ebaf6c07acd36a1172b9 | refs/heads/master | 2021-01-16T17:42:29.047877 | 2011-10-16T22:28:00 | 2011-10-16T22:28:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,714 | java | package edu.calpoly.cpe409.fridgereminder;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.net.UnknownHostException;
import java.util.Scanner;
import android.content.Context;
import android.content.res.Resources.NotFoundException;
/**
* This class connects the app to the database online.
*/
public class ExpirationDatabase {
/**
* With the given information this method looks up the expiration date
* on the database.
*
* @param name name of the item
* @param context context of the activity requesting the info
* @return the number of expiration date
* @throws UnknownHostException if this method can not find the database it throws this
* exception.
*/
public static int lookUp(String name, Context context)
throws UnknownHostException {
int toReturn = -1;
Scanner in = null;
try {
URL url = new URL(context.getResources().getString(
R.string.expiration_database_url)
+ "?name=" + URLEncoder.encode(name, "UTF-8"));
in = new Scanner(new InputStreamReader(url.openStream()))
.useDelimiter("\n");
if (in.hasNext())
toReturn = Integer.parseInt(in.next().trim());
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (NotFoundException e) {
e.printStackTrace();
} catch (NumberFormatException e) {
// Do nothing
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (UnknownHostException e) {
throw e;
} catch (IOException e) {
e.printStackTrace();
}
return toReturn;
}
}
| [
"sejuhong@gmail.com"
] | sejuhong@gmail.com |
6093f25bdc2c0b30d6ee6b9d1771eed67dd48e58 | c0314f5ae0b5f9897f4d11c75d62880671e0ec8c | /source/utils.atv/src/main/java/ru/ps/vlcatv/utils/json/JSONException.java | e9893618293a115ff8ed307e6c21e791368ae597 | [
"MIT"
] | permissive | CloneTV/VLC-TV-Remote | 1e1ccf7bf940387cc7d63e183f418551142cd4b8 | 50539a0fab02622cf175f6eca15ffcfc4e3a1ef2 | refs/heads/master | 2021-05-20T10:23:35.721008 | 2021-03-07T10:16:33 | 2021-03-07T10:16:33 | 252,246,482 | 8 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,235 | java | package ru.ps.vlcatv.utils.json;
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/**
* The JSONException is thrown by the JSON.org classes when things are amiss.
*
* @author JSON.org
* @version 2015-12-09
*/
public class JSONException extends RuntimeException {
/** Serialization ID */
private static final long serialVersionUID = 0;
/**
* Constructs a JSONException with an explanatory message.
*
* @param message
* Detail about the reason for the exception.
*/
public JSONException(final String message) {
super(message);
}
/**
* Constructs a JSONException with an explanatory message and cause.
*
* @param message
* Detail about the reason for the exception.
* @param cause
* The cause.
*/
public JSONException(final String message, final Throwable cause) {
super(message, cause);
}
/**
* Constructs a new JSONException with the specified cause.
*
* @param cause
* The cause.
*/
public JSONException(final Throwable cause) {
super(cause.getMessage(), cause);
}
}
| [
"clon@gmail.net"
] | clon@gmail.net |
f8b89de4c6abd255e408d1bc6a19158a3dfd57ad | a6a0473ebbc108cf68de124c9a42d53a6713db33 | /src/br/com/siseduc/controller/FuncionarioController.java | a7a2897b11ae0b67adef466e2ebe79c1285e7d5d | [] | no_license | wjuanps/SistemaEscolar | f923719b014e7eeaa614d24b24eb4d447052447c | e8a667b2a349cecdd16fb9cbaa598db4d952d670 | refs/heads/master | 2020-05-19T02:59:26.850284 | 2020-02-10T19:43:47 | 2020-02-10T19:43:47 | 184,790,133 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,433 | 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 br.com.siseduc.controller;
import br.com.siseduc.model.bo.EscolaBO;
import br.com.siseduc.model.bo.FuncionarioBO;
import br.com.siseduc.model.bo.PessoaBO;
import br.com.siseduc.model.bo.Session;
import br.com.siseduc.model.dao.Arquivo;
import br.com.siseduc.model.vo.Funcionario;
import br.com.siseduc.model.vo.Pessoa;
import br.com.siseduc.model.vo.Usuario;
import br.com.siseduc.view.TelaCadastroFuncionario;
import br.com.siseduc.view.TelaInicial;
import br.com.siseduc.view.TelaPesquisa;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.util.Calendar;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JTable;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Juan Soares
*/
public class FuncionarioController extends FuncionarioBO implements ActionListener, ItemListener, ChangeListener {
private static final int CARGA_HORARIA_PADRAO = 44;
/**
*
*/
private final TelaPesquisa telaPesquisa;
/**
*
*/
private final TelaCadastroFuncionario telaCadastro;
/**
*
*/
private final TelaInicial telaInicial;
/**
*
*/
private final EscolaBO escolaBO = new EscolaBO();
/**
*
*/
private Funcionario funcionario;
/**
*
*/
private Usuario usuario;
private String foto = null;
private String temp = null;
private String aux = "";
/**
*
*/
private int tipo = -1;
/**
*
*/
private final String[] columns = {"Matricula", "Nome", "Telefone", "Celular", "Email"};
/**
*
*/
private final String[] strings = {"Matricula", "Nome", "Cargo/Função", "Data Cadastro", "Naturalidade", "Estado", "Cidade", "Bairro"};
/**
*
*/
private final String[] itens = {""};
/**
*
*/
private final boolean[] separator = {false};
/**
*
*/
private final String[] images = {""};
/**
*
* @param telaInicial
* @param session
*/
public FuncionarioController(TelaInicial telaInicial, Session session) {
/* Inicializando as variaveis */
this.telaInicial = telaInicial;
telaPesquisa = new TelaPesquisa(this.telaInicial, true, columns);
telaPesquisa.setMenuItem(itens, images, separator);
telaPesquisa.setString(strings);
telaCadastro = new TelaCadastroFuncionario(this.telaInicial, true);
this.telaInicial.getJmiFuncionario().addActionListener(this);
this.telaInicial.getBtnFuncionario().addActionListener(this);
this.telaPesquisa.getBtnNovo().addActionListener(this);
this.telaPesquisa.getBtnEditar().addActionListener(this);
this.telaPesquisa.getBtnSair().addActionListener(new Controller(this.telaPesquisa, session, false));
this.telaPesquisa.getJcbOrdenar().addItemListener(this);
this.telaPesquisa.getTxtPesquisar().addKeyListener(this.new AdapdtadorTeclado());
this.telaPesquisa.getTabelaListar().addMouseListener(this.new AdaptadorMouse());
this.telaCadastro.getBtnProximoPasso().addActionListener(this);
this.telaCadastro.getBtnCancelar().addActionListener(this);
this.telaCadastro.getBtnConfirmar().addActionListener(this);
this.telaCadastro.getJcbCargoFuncao().addItemListener(this);
this.telaCadastro.getRbUsuarioSim().addItemListener(this);
this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster().addItemListener(this);
this.telaCadastro.getJtPainelCadastro().addChangeListener(this);
this.addItemListener(this);
this.telaCadastro.getLbFoto().addMouseListener(this.new AdaptadorMouse());
this.telaCadastro.getTxtNomeFuncionario().addKeyListener(new AdapdtadorTeclado());
Controller.rollover(telaPesquisa.getBarraDeFerramentas().getComponents());
}
@Override
public void stateChanged(ChangeEvent e) {
if (e.getSource() == this.telaCadastro.getJtPainelCadastro()) {
if (foto == null) {
this.aux = "default.png";
this.foto = PessoaBO.criptografar(aux.concat(String.valueOf(new Random(1_000_000).nextInt()))).concat(".png");
}
this.funcionario = this.dadosFuncionario(funcionario);
if (this.funcionario != null) {
final int index = this.telaCadastro.getJtPainelCadastro().getSelectedIndex();
if (this.telaCadastro.getJtPainelCadastro().getTitleAt(index).equals("Confirmar Cadastro")) {
this.usuario = this.dadosUsuario(usuario);
final StringBuilder confirmarDados = super.dadosFuncionario(funcionario, usuario);
this.telaCadastro.getTxtConfirmar().setText(confirmarDados.toString());
}
}
}
}
private final class AdaptadorMouse extends MouseAdapter {
@Override
public void mouseClicked(MouseEvent e) {
if (e.getSource() == FuncionarioController.this.telaCadastro.getLbFoto()) {
FuncionarioController.this.foto = PessoaBO.alterarFoto(FuncionarioController.this.telaCadastro.getLbFoto(), FuncionarioController.this.foto);
} else if (e.getSource() == FuncionarioController.this.telaPesquisa.getTabelaListar()) {
if (e.getClickCount() > 1) {
FuncionarioController.this.editarFuncionario();
}
}
}
}
private final class AdapdtadorTeclado extends KeyAdapter {
@Override
public void keyReleased(KeyEvent e) {
if (e.getSource() == FuncionarioController.this.telaCadastro.getTxtNomeFuncionario()) {
FuncionarioController.this.telaCadastro.getTxtNomeDesabilitado().setText(FuncionarioController.this.telaCadastro.getTxtNomeFuncionario().getText());
return;
}
if (e.getSource() == FuncionarioController.this.telaPesquisa.getTxtPesquisar()) {
FuncionarioController.this.ordenarFuncionario();
}
}
}
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == this.telaInicial.getJmiFuncionario()
|| e.getSource() == this.telaInicial.getBtnFuncionario()) {
final JTable table = this.telaPesquisa.getTabelaListar();
final DefaultTableModel model = this.telaPesquisa.getModel();
super.preencherTabela(table, model);
this.telaPesquisa.setVisible(true);
return;
}
if (e.getSource() == this.telaCadastro.getBtnProximoPasso()) {
Controller.nextTab(this.telaCadastro.getJtPainelCadastro());
return;
}
if (e.getSource() == this.telaPesquisa.getBtnNovo()) {
this.telaCadastro.getTxtMatricula().setText(this.escolaBO.getId("funcionario"));
this.telaCadastro.getJcbCargoFuncao().removeAllItems();
this.telaCadastro.getJcbCargoFuncao().addItem("Cargo/Função");
this.escolaBO.get(EscolaBO.STR_CARGO_FUNCAO, true).stream().forEach((funcao) -> {
this.telaCadastro.getJcbCargoFuncao().addItem(funcao);
});
tipo = Pessoa.CADASTRAR;
this.telaCadastro.setVisible(true);
return;
}
if (e.getSource() == this.telaCadastro.getBtnCancelar()) {
try {
foto = (foto == null) ? "null.png" : foto;
Arquivo.excluirArquivo(Arquivo.DIR_TEMP, foto);
this.limparTodosCampos();
this.telaCadastro.setVisible(false);
this.telaCadastro.dispose();
} catch (IOException ex) {
Logger.getLogger(FuncionarioController.class.getName()).log(Level.SEVERE, null, ex);
}
return;
}
if (e.getSource() == this.telaCadastro.getBtnConfirmar()) {
final String user = this.telaInicial.getLbUsuario().getText();
boolean confirmar = (funcionario.isUsuario())
? super.confirmarCadastro(funcionario, usuario, user, tipo)
: super.confirmarCadastro(funcionario, user, tipo);
if (confirmar) {
try {
if (!this.aux.equals("default.png")) {
Arquivo.moverArquivo(Arquivo.DIR_TEMP.concat(foto), Arquivo.DIR_FOTOS.concat(funcionario.getFoto()));
} else {
final String fileName = Arquivo.DIR_FOTOS.concat(foto);
Arquivo.copiarArquivo(Arquivo.DIR_FOTOS.concat(aux), fileName);
}
if (!(foto.equals(temp)) && (temp != null) && !(temp.equals("default.png"))) {
Arquivo.excluirArquivo(Arquivo.DIR_FOTOS, temp);
}
} catch (IOException ex) {
Logger.getLogger(FuncionarioController.class.getName()).log(Level.SEVERE, null, ex);
return;
}
final JTable table = this.telaPesquisa.getTabelaListar();
final DefaultTableModel model = this.telaPesquisa.getModel();
super.preencherTabela(table, model);
this.limparTodosCampos();
this.telaCadastro.setVisible(false);
this.telaCadastro.dispose();
}
return;
}
if (e.getSource() == this.telaPesquisa.getBtnEditar()) {
this.editarFuncionario();
}
}
@Override
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
if (e.getSource() == this.telaCadastro.getJcbCargoFuncao()) {
if (this.telaCadastro.getJcbCargoFuncao().getSelectedIndex() != 0) {
final String cond = this.telaCadastro.getJcbCargoFuncao().getSelectedItem().toString();
this.telaCadastro.getTxtDescricaoFuncao().setText((String) this.escolaBO.get(EscolaBO.DESCRICAO, EscolaBO.STR_CARGO_FUNCAO, "descricao", cond));
} else {
this.telaCadastro.getTxtDescricaoFuncao().setText(null);
}
return;
}
if (e.getSource() == this.telaPesquisa.getJcbOrdenar()) {
this.ordenarFuncionario();
return;
}
}
if (e.getSource() == telaCadastro.getRbUsuarioSim()) {
if (telaCadastro.getRbUsuarioSim().isSelected()) {
telaCadastro.getJtPainelCadastro().insertTab("Dados do Usuário", null, telaCadastro.getTelaCadastroUsuario(), "", 2);
telaCadastro.getJtPainelCadastro().setSelectedIndex(2);
} else {
telaCadastro.getJtPainelCadastro().removeTabAt(2);
}
return;
}
if (e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster()) {
if (this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster().isSelected()) {
this.usuarioMaster();
} else {
this.usuarioPadrao();
}
return;
}
selectMaster(e);
}
/**
*
* @param funcionario
* @return
*/
private Funcionario dadosFuncionario(Funcionario funcionario) {
funcionario = new Funcionario();
funcionario.setFoto(foto);
this.telaCadastro.getLbFoto().setName(foto);
funcionario.setMatricula(this.telaCadastro.getTxtMatricula().getText());
funcionario.setNome(this.telaCadastro.getTxtNomeFuncionario().getText());
funcionario.setSexo((this.telaCadastro.getRbSexoMasculino().isSelected()) ? "Masculino" : "Feminino");
funcionario.setDataNascimento(PessoaBO.data(this.telaCadastro.getTxtDataNascimentoFuncionario().getText(), '/', '-'));
funcionario.setNacionalidade(this.telaCadastro.getTxtNacionalidadeFuncionario().getText());
funcionario.setNaturalidade(this.telaCadastro.getTxtNaturalidadeFuncionario().getText());
funcionario.setUfNaturalidade(this.telaCadastro.getJcbUfNaturalidadeFuncionario().getSelectedItem().toString());
funcionario.setIdentidade(this.telaCadastro.getTxtIdentidadeFuncionario().getText());
funcionario.setCpf(this.telaCadastro.getTxtCpfFuncionario().getText());
funcionario.setDataCadastro(String.format("%1$tY-%1$tm-%1$td", Calendar.getInstance()));
funcionario.setEndereco(this.telaCadastro.getTxtEnderecoFuncionario().getText());
funcionario.setComplemento(this.telaCadastro.getTxtComplementoEnderecoFuncionario().getText());
funcionario.setBairro(this.telaCadastro.getTxtBairroFuncionario().getText());
funcionario.setCidade(this.telaCadastro.getTxtCidadeFuncionario().getText());
funcionario.setUf(this.telaCadastro.getJcbUfResidenciaFuncionario().getSelectedItem().toString());
funcionario.setCep(this.telaCadastro.getTxtCepFuncionario().getText());
funcionario.setTelefone(this.telaCadastro.getTxtTelefoneFuncionario().getText());
funcionario.setCelular(this.telaCadastro.getTxtCelularFuncionario().getText());
funcionario.setEmail(this.telaCadastro.getTxtEmailFuncionario().getText());
try {
funcionario.setCargaHoraria(Integer.parseInt(this.telaCadastro.getTxtCargaHoraria().getText()));
} catch (NumberFormatException n) {
funcionario.setCargaHoraria(CARGA_HORARIA_PADRAO);
}
funcionario.setCargoFuncao(this.telaCadastro.getJcbCargoFuncao().getSelectedItem().toString());
funcionario.setEscolaridade(this.telaCadastro.getJcbEscolaridade().getSelectedItem().toString());
funcionario.setNumeroCtps(this.telaCadastro.getTxtNumeroCTPS().getText());
funcionario.setSerieCtps(this.telaCadastro.getTxtSerieCTPS().getText());
funcionario.setDataEmissaoCarteira(PessoaBO.data(this.telaCadastro.getTxtDataEmissao().getText(), '/', '-'));
funcionario.setNumeroPis(this.telaCadastro.getTxtNumeroPIS().getText());
funcionario.setDependentes(Integer.parseInt(this.telaCadastro.getTxtDependentes().getText()));
funcionario.setUsuario(this.telaCadastro.getRbUsuarioSim().isSelected());
return funcionario;
}
/**
*
* @param usuario
* @return
*/
private Usuario dadosUsuario(Usuario usuario) {
usuario = new Usuario();
usuario.setUsuario(this.telaCadastro.getTelaCadastroUsuario().getTxtLogin().getText());
usuario.setSenha(new String(this.telaCadastro.getTelaCadastroUsuario().getTxtSenha().getPassword()));
usuario.setrSenha(new String(this.telaCadastro.getTelaCadastroUsuario().getTxtRepetirSenha().getPassword()));
usuario.setUsuarioMaster(this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster().isSelected());
usuario.setCadastrarAtualizarAluno(this.telaCadastro.getTelaCadastroUsuario().getRbCAAlunoSim().isSelected());
usuario.setCadastrarAtualizarProfessor(this.telaCadastro.getTelaCadastroUsuario().getRbCAProfessorSim().isSelected());
usuario.setCadastrarAtualizarFuncionario(this.telaCadastro.getTelaCadastroUsuario().getRbCAFuncionarioSim().isSelected());
usuario.setCadastrarUsuario(this.telaCadastro.getTelaCadastroUsuario().getRbCadastrarUsuarioSim().isSelected());
usuario.setControleFinanceiro(this.telaCadastro.getTelaCadastroUsuario().getRbControleFinanceiroSim().isSelected());
usuario.setExcluirAluno(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirAlunoSim().isSelected());
usuario.setExcluirProfessor(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirProfessorSim().isSelected());
usuario.setExcluirFuncionario(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFuncionarioSim().isSelected());
usuario.setExcluirUsuario(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirUsuarioSim().isSelected());
usuario.setEmitirRelatorios(this.telaCadastro.getTelaCadastroUsuario().getRbEmitirRelatoriosSim().isSelected());
usuario.setCadastrarAlterarTurma(this.telaCadastro.getTelaCadastroUsuario().getRbCATurmaSim().isSelected());
usuario.setCadastrarAlterarDisciplina(this.telaCadastro.getTelaCadastroUsuario().getRbCADisciplinaSim().isSelected());
usuario.setExcluirTurma(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirTurmaSim().isSelected());
usuario.setExcluirDisciplina(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirDisciplinaSim().isSelected());
usuario.setEmitirDocumentos(this.telaCadastro.getTelaCadastroUsuario().getRbEmitirDocumentosSim().isSelected());
usuario.setCadastrarAtualizarFornecedores(this.telaCadastro.getTelaCadastroUsuario().getRbCAFornecedorSim().isSelected());
usuario.setCadastrarAtualizarBensPatrimoniais(this.telaCadastro.getTelaCadastroUsuario().getRbCABensConsumorSim().isSelected());
usuario.setExcluirFornecedores(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFornecedoresSim().isSelected());
usuario.setExcluirBensPatrimoniais(this.telaCadastro.getTelaCadastroUsuario().getRbExcluirBensConsumoSim().isSelected());
return usuario;
}
/**
*
*/
private void usuarioMaster() {
this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCAAlunoSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCAProfessorSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCAFuncionarioSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCadastrarUsuarioSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbControleFinanceiroSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirAlunoSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirProfessorSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFuncionarioSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirUsuarioSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbEmitirRelatoriosSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCATurmaSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCADisciplinaSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirTurmaSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirDisciplinaSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbEmitirDocumentosSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCAFornecedorSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCABensConsumorSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFornecedoresSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirBensConsumoSim().setSelected(true);
}
/**
*
*/
private void usuarioPadrao() {
this.telaCadastro.getTelaCadastroUsuario().getRbCAAlunoSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCAProfessorSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCAFuncionarioSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCadastrarUsuarioSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbControleFinanceiroNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirAlunoNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirProfessorNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFuncionarioNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirUsuarioNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbEmitirRelatoriosSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCATurmaSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCADisciplinaSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirTurmaNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirDisciplinaNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbEmitirDocumentosSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCAFornecedorSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbCABensConsumorSim().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFornecedoresNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirBensConsumoNao().setSelected(true);
}
/**
*
* @param e
*/
private void selectMaster(ItemEvent e) {
if (e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCAAlunoSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCAProfessorSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCAFuncionarioSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCadastrarUsuarioSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbControleFinanceiroSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirAlunoSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirProfessorSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFuncionarioSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirUsuarioSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbEmitirRelatoriosSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCATurmaSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCADisciplinaSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirTurmaSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirDisciplinaSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbEmitirDocumentosSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCAFornecedorSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbCABensConsumorSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFornecedoresSim()
|| e.getSource() == this.telaCadastro.getTelaCadastroUsuario().getRbExcluirBensConsumoSim()) {
if (this.telaCadastro.getTelaCadastroUsuario().getRbCAAlunoSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbCAProfessorSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbCAFuncionarioSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbCadastrarUsuarioSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbControleFinanceiroSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirAlunoSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirProfessorSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFuncionarioSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirUsuarioSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbEmitirRelatoriosSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbCATurmaSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbCADisciplinaSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirTurmaSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirDisciplinaSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbEmitirDocumentosSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbCAFornecedorSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbCABensConsumorSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFornecedoresSim().isSelected()
&& this.telaCadastro.getTelaCadastroUsuario().getRbExcluirBensConsumoSim().isSelected()) {
this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster().setSelected(true);
} else {
this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster().setSelected(false);
}
}
}
/**
*
* @param e
*/
private void addItemListener(ItemListener e) {
this.telaCadastro.getTelaCadastroUsuario().getRbCAAlunoSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbCAProfessorSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbCAFuncionarioSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbCadastrarUsuarioSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbControleFinanceiroSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirAlunoSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirProfessorSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFuncionarioSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirUsuarioSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbEmitirRelatoriosSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbCATurmaSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbCADisciplinaSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirTurmaSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirDisciplinaSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbEmitirDocumentosSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbCAFornecedorSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbCABensConsumorSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirFornecedoresSim().addItemListener(e);
this.telaCadastro.getTelaCadastroUsuario().getRbExcluirBensConsumoSim().addItemListener(e);
}
/**
*
*/
private void limparTodosCampos() {
this.foto = null;
this.telaCadastro.getLbFoto().setName(foto);
this.telaCadastro.getLbFoto().setIcon(new ImageIcon(Arquivo.DIR_FOTOS.concat("default.png")));
this.telaCadastro.getTxtNomeDesabilitado().setText(null);
this.telaCadastro.getTxtNomeFuncionario().setText(null);
this.telaCadastro.getTxtDataNascimentoFuncionario().setText(null);
this.telaCadastro.getTxtNacionalidadeFuncionario().setText(null);
this.telaCadastro.getTxtNaturalidadeFuncionario().setText(null);
this.telaCadastro.getJcbUfNaturalidadeFuncionario().setSelectedItem("PA");
this.telaCadastro.getTxtIdentidadeFuncionario().setText(null);
this.telaCadastro.getTxtCpfFuncionario().setText(null);
this.telaCadastro.getTxtDataCadastroFuncionario().setText(String.format("%1$td/%1$tm/%1$tY", Calendar.getInstance()));
this.telaCadastro.getTxtEnderecoFuncionario().setText(null);
this.telaCadastro.getTxtComplementoEnderecoFuncionario().setText(null);
this.telaCadastro.getTxtBairroFuncionario().setText(null);
this.telaCadastro.getTxtCidadeFuncionario().setText(null);
this.telaCadastro.getJcbUfResidenciaFuncionario().setSelectedItem("PA");
this.telaCadastro.getTxtCepFuncionario().setText(null);
this.telaCadastro.getTxtTelefoneFuncionario().setText(null);
this.telaCadastro.getTxtCelularFuncionario().setText(null);
this.telaCadastro.getTxtEmailFuncionario().setText(null);
this.telaCadastro.getTxtCargaHoraria().setText(String.valueOf(CARGA_HORARIA_PADRAO));
this.telaCadastro.getJcbCargoFuncao().setSelectedIndex(0);
this.telaCadastro.getJcbEscolaridade().setSelectedIndex(0);
this.telaCadastro.getTxtNumeroCTPS().setText(null);
this.telaCadastro.getTxtSerieCTPS().setText(null);
this.telaCadastro.getTxtDataEmissao().setText(null);
this.telaCadastro.getTxtNumeroPIS().setText(null);
this.telaCadastro.getTxtDependentes().setText("0");
this.telaCadastro.getTelaCadastroUsuario().getTxtLogin().setText(null);
this.telaCadastro.getTelaCadastroUsuario().getTxtSenha().setText(null);
this.telaCadastro.getTelaCadastroUsuario().getTxtRepetirSenha().setText(null);
this.telaCadastro.getRbUsuarioNao().setSelected(true);
this.telaCadastro.getTelaCadastroUsuario().getCheckUsuarioMaster().setSelected(false);
this.temp = this.foto;
this.aux = "";
this.usuario = null;
this.funcionario = null;
this.telaCadastro.getJtPainelCadastro().setSelectedIndex(0);
tipo = -1;
}
/**
*
*/
private void ordenarFuncionario() {
final JTable table = this.telaPesquisa.getTabelaListar();
final DefaultTableModel model = this.telaPesquisa.getModel();
String order = this.telaPesquisa.getJcbOrdenar().getSelectedItem().toString().toLowerCase().replace(' ', '_').replace('/', '_');
final String nome = this.telaPesquisa.getTxtPesquisar().getText().trim();
order = (order.equals("matricula"))
? "id_funcionario"
: (order.equals("data_cadastro"))
? "funcionario.data_cadastro"
: (order.equals("estado"))
? "uf"
: PessoaBO.removerAcentos(order);
super.preencherTabela(table, model, super.ordernarFuncionario(order, nome));
}
private void editarFuncionario() {
JTable table = this.telaPesquisa.getTabelaListar();
if (table.getSelectedRowCount() == 1) {
try {
this.telaCadastro.getJcbCargoFuncao().removeAllItems();
this.telaCadastro.getJcbCargoFuncao().addItem("Cargo/Função");
this.escolaBO.get(EscolaBO.STR_CARGO_FUNCAO, true).stream().forEach((funcao) -> {
this.telaCadastro.getJcbCargoFuncao().addItem(funcao);
});
final int matricula = Integer.parseInt(table.getValueAt(table.getSelectedRow(), 0).toString());
usuario = super.getFuncionario(matricula);
temp = foto = usuario.getFoto();
tipo = Pessoa.ATUALIZAR;
this.telaCadastro.editarFuncionario(usuario);
this.telaCadastro.setVisible(true);
} catch (NullPointerException n) {}
}
}
} | [
"wjuan.ps@gmail.com"
] | wjuan.ps@gmail.com |
94d5092d19a70df6540ea1324a70b01b737f8c1d | 6a7cadae205b5c054bb8c04453f50e8777f30b96 | /xkjava-framework/src/main/java/me/ixk/framework/ioc/injector/DefaultPropertyInjector.java | f29eb79ca21beba8724f6a3b1d7215c5a4e3d06d | [
"Apache-2.0"
] | permissive | melodyjerry/xkjava | 053c22882c14e117d6a5614598247541e1b46bdf | 4743497edeadb64bb409384b5ee42625d8b5c523 | refs/heads/master | 2022-12-29T17:48:23.268539 | 2020-10-09T02:30:52 | 2020-10-09T02:30:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,547 | java | /*
* Copyright (c) 2020, Otstar Lin (syfxlin@gmail.com). All Rights Reserved.
*/
package me.ixk.framework.ioc.injector;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ReflectUtil;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import me.ixk.framework.annotations.Autowired;
import me.ixk.framework.annotations.SkipPropertyAutowired;
import me.ixk.framework.ioc.Binding;
import me.ixk.framework.ioc.Container;
import me.ixk.framework.ioc.DataBinder;
import me.ixk.framework.ioc.InstanceInjector;
import me.ixk.framework.utils.AnnotationUtils;
public class DefaultPropertyInjector implements InstanceInjector {
@Override
public Object inject(
Container container,
Binding binding,
Object instance,
Class<?> instanceClass,
DataBinder dataBinder
) {
if (instanceClass.getAnnotation(SkipPropertyAutowired.class) != null) {
return instance;
}
Field[] fields = instanceClass.getDeclaredFields();
for (Field field : fields) {
if (field.getAnnotation(SkipPropertyAutowired.class) != null) {
continue;
}
Autowired autowired = AnnotationUtils.getAnnotation(
field,
Autowired.class
);
if (autowired == null) {
PropertyDescriptor propertyDescriptor = BeanUtil.getPropertyDescriptor(
instanceClass,
field.getName()
);
if (propertyDescriptor == null) {
continue;
}
Method writeMethod = propertyDescriptor.getWriteMethod();
if (writeMethod == null) {
continue;
}
Object dependency = dataBinder.getObject(
field.getName(),
field.getType()
);
if (dependency == null) {
dependency = ReflectUtil.getFieldValue(instance, field);
}
ReflectUtil.invoke(instance, writeMethod, dependency);
} else {
Object dependency;
if (!"".equals(autowired.name())) {
dependency =
container.make(autowired.name(), field.getType());
} else {
Class<?> autowiredClass;
if (autowired.type() == Class.class) {
autowiredClass = field.getType();
} else {
autowiredClass = autowired.type();
}
dependency =
dataBinder.getObject(field.getName(), autowiredClass);
}
if (dependency == null) {
dependency = ReflectUtil.getFieldValue(instance, field);
}
// 如果必须注入,但是为 null,则抛出错误
if (dependency == null && autowired.required()) {
throw new NullPointerException(
"Target [" +
instanceClass.getName() +
"::" +
field.getName() +
"] is required, but inject value is null"
);
}
ReflectUtil.setFieldValue(instance, field, dependency);
}
}
return instance;
}
}
| [
"syfxlin@gmail.com"
] | syfxlin@gmail.com |
06f99ee4c22e3deb23e3ed711b9a3ecd44e85c29 | 5c611a36867615919a23193652847a866b4a5bdb | /src/test/java/com/egobob/dsandalgos/TestUtil.java | a17a3198a7a51dbe165322ead21f963858cf412a | [] | no_license | EgorBobrov/dsandalgos | 954712d445be9939c01909b7157e8e55d6b6eb58 | 4a5735654a27c01c954926ff6bb4c0320dade3f1 | refs/heads/master | 2020-12-18T14:35:52.343901 | 2020-01-22T19:16:01 | 2020-01-22T19:16:01 | 235,421,731 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,510 | java | package com.egobob.dsandalgos;
import java.util.Arrays;
import java.util.Random;
public final class TestUtil {
private static final Random RANDOM = new Random();
public static Integer[] generateIntArray() {
return generateIntArray(40);
}
public static Integer[] generateIntArray(int size) {
return generateLimitedIntArray(-100, 100, size);
}
public static Integer[] generateLimitedIntArray(int fromIncluded, int toExcluded, int size) {
return RANDOM.ints(fromIncluded, toExcluded)
.limit(size).boxed().toArray(Integer[]::new);
}
public static Integer[] reverseArray(Integer[] array) {
if (array.length < 2) return array;
for (int i = 0; i < array.length / 2; i++) {
int temp = array[i];
array[i] = array[array.length - i - 1];
array[array.length - i - 1] = temp;
}
return array;
}
public static String[] generateStringArray(int arraySize) {
return generateLimitedStringArray(arraySize,4, 'a', 'z');
}
public static String[] generateLimitedStringArray(int arraySize, int stringLength, int leftBound, int rightBound) {
String[] strings = new String[arraySize];
for (int i = 0; i < arraySize; i++) {
StringBuilder builder = new StringBuilder();
RANDOM.ints(leftBound, rightBound + 1).limit(stringLength)
.forEach(number -> builder.append((char) number));
strings[i] = builder.toString();
}
return strings;
}
}
| [
"egorbobrov1776@gmail.com"
] | egorbobrov1776@gmail.com |
161c53b6845740064f88f23267e16ced47eb72ea | 585dfe45379f3499fcaa20fb28f59081ac863973 | /src/javascriptExecutor_Examples/javascriptExecutor_Example_3.java | 97b693cc0a70b313ac840513910a56ed95613f5e | [] | no_license | UserTest30/SeleniumBasics | de0bc265fe2ccd358f4113434c0496dad6168ad7 | 0db7c57b8b3a4a752215d53ef2c944d2b6630467 | refs/heads/main | 2023-06-07T08:29:31.489465 | 2021-07-03T10:35:24 | 2021-07-03T10:35:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 811 | java | package javascriptExecutor_Examples;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class javascriptExecutor_Example_3 {
public static void main(String[] args)
{
System.setProperty("webdriver.chrome.driver", ".\\drivers\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.navigate().to("http://demowebshop.tricentis.com/login");
driver.manage().window().maximize();
//Clicking on an element/ hidden element
JavascriptExecutor js=(JavascriptExecutor)driver;
WebElement remember_me_button =driver.findElement(By.xpath("//*[@id='RememberMe']"));
js.executeScript("arguments[0].click()", remember_me_button);
}
}
| [
"knowledgeshare.technologies@gmail.com"
] | knowledgeshare.technologies@gmail.com |
bbeb9bc54239f82e85b1c9177ef1c17b68929a1e | c9e911c067753c68a63217550e85757f24914e3f | /src/main/java/fun4/nonogrambackend/security/WebSecurity.java | 5e9ecd2d850c804f987a0607d2b25db9342f44db | [] | no_license | arjen0203/Nonogram-Backend | b59d5acfbe662ff3bcc1213a7bc8b62cd0b6bd41 | d037e6e5d0b7fba64abd029c889bdfc9c6ab3dae | refs/heads/master | 2021-04-01T17:41:05.998738 | 2020-06-02T17:00:02 | 2020-06-02T17:00:02 | 248,202,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,595 | java | package fun4.nonogrambackend.security;
import fun4.nonogrambackend.services.UserDetailsServiceImpl;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.context.annotation.Bean;
import static fun4.nonogrambackend.security.SecurityConstants.SIGN_UP_URL;
@EnableWebSecurity
public class WebSecurity extends WebSecurityConfigurerAdapter {
private UserDetailsServiceImpl userDetailsService;
private BCryptPasswordEncoder bCryptPasswordEncoder;
public WebSecurity(UserDetailsServiceImpl userDetailsService, BCryptPasswordEncoder bCryptPasswordEncoder) {
this.userDetailsService = userDetailsService;
this.bCryptPasswordEncoder = bCryptPasswordEncoder;
}
@Override
protected void configure(HttpSecurity http) throws Exception {
http.cors().and().csrf().disable().authorizeRequests()
.antMatchers(SIGN_UP_URL, "/nonogram/get**").permitAll()
.anyRequest().authenticated()
.and()
.addFilter(new JWTAuthenticationFilter(authenticationManager()))
.addFilter(new JWTAuthorizationFilter(authenticationManager()))
// this disables session creation on Spring Security
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);
}
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(bCryptPasswordEncoder);
}
@Bean
CorsConfigurationSource corsConfigurationSource() {
final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
var corse = new CorsConfiguration().applyPermitDefaultValues();
corse.addExposedHeader("Authorization");
corse.addExposedHeader("TotalPages");
source.registerCorsConfiguration("/**", corse);
return source;
}
} | [
"arjenmeer@hotmail.nl"
] | arjenmeer@hotmail.nl |
2866f78d5c13f58ea0aab9d20709634e28c788ed | 14e8be4acdcc0cfbde9f8a85fa2579c793a0ed4d | /src/main/java/web/tasks/companies/CreateCompany.java | 44d66e3a1c483d684d2b62cbfba4f893443dd57e | [] | no_license | dhtien/serenity-web | 75bbdd05a0d75350cfde5e3822968af1b0ac883f | 0a955e13b32f2c35a7c2430e49fd1f56504f4b57 | refs/heads/master | 2023-05-09T06:27:32.238228 | 2021-05-31T11:03:43 | 2021-05-31T11:03:43 | 372,474,520 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package web.tasks.companies;
import net.serenitybdd.screenplay.Task;
import net.serenitybdd.screenplay.actions.Click;
import net.serenitybdd.screenplay.actions.Enter;
import static web.ui.CompaniesPage.*;
public class CreateCompany {
public static Task withName(String comapnyName) {
return Task.where("{0} create company name #comapnyName",
Click.on(CREATE_BUTTON),
Enter.theValue(comapnyName).into(COMAPNY_NAME_INPUT),
Click.on(SAVE_BUTTON));
}
}
| [
"baovu333@gmail.com"
] | baovu333@gmail.com |
7deba8165b521181ea2d8d0b4014bc37568e9aed | ba828ee5674646138c7b6818c22e72e4dbf0e46b | /app/src/main/java/com/danieldonato/olxclone/activity/DetalhesProdutoActivity.java | 28661d0d6833bd5154a154770b9df7e04ae04612 | [] | no_license | DanielDonato/olx-clone | d0459cb960e8fbfae9d09caac231092a4d51fcb1 | 7ef7a4206ebf96057c18ff5c95e9b851fa93307e | refs/heads/master | 2020-09-29T07:32:29.859240 | 2019-12-09T23:26:38 | 2019-12-09T23:26:38 | 226,987,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,376 | java | package com.danieldonato.olxclone.activity;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.danieldonato.olxclone.R;
import com.danieldonato.olxclone.model.Anuncio;
import com.squareup.picasso.Picasso;
import com.synnapps.carouselview.CarouselView;
import com.synnapps.carouselview.ImageListener;
public class DetalhesProdutoActivity extends AppCompatActivity {
private CarouselView carouselView;
private TextView titulo, descricao, estado, preco;
private Anuncio anuncioSelecionado;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detalhes_produto);
getSupportActionBar().setTitle("Detalhe Produto");
inicializarComponentes();
anuncioSelecionado = (Anuncio) getIntent().getSerializableExtra("anuncioSelecionado");
if(anuncioSelecionado != null) {
titulo.setText(anuncioSelecionado.getTitulo());
descricao.setText(anuncioSelecionado.getDescricao());
estado.setText(anuncioSelecionado.getEstado());
preco.setText(anuncioSelecionado.getValor());
ImageListener imageListener = new ImageListener() {
@Override
public void setImageForPosition(int position, ImageView imageView) {
String urlString = anuncioSelecionado.getFotos().get(position);
Picasso.get().load(urlString).into(imageView);
}
};
carouselView.setPageCount(anuncioSelecionado.getFotos().size());
carouselView.setImageListener(imageListener);
}
}
public void visualizarTelefone(View view) {
Intent i = new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", anuncioSelecionado.getTelefone(), null));
startActivity(i);
}
private void inicializarComponentes() {
carouselView = findViewById(R.id.carouselView);
titulo = findViewById(R.id.textTituloDetalhe);
descricao = findViewById(R.id.textDescricaoDetalhe);
estado = findViewById(R.id.textEstadoDetalhe);
preco = findViewById(R.id.textPrecoDetalhe);
}
}
| [
"daniel_donato10@yahoo.com.br"
] | daniel_donato10@yahoo.com.br |
6183ef9be5d09e7bc712df9d0e9ba1ee16bd7efd | 61e627d9ab083a019bec946149a22e7a0177b043 | /biz-framework/biz-framework-component-payment/src/main/java/org/yoara/framework/component/payment/support/AddservicePayTypeEnums.java | 22b89b9c9a64548e5acd0c6e3e1ad25eeb67826c | [] | no_license | yoara/web-old-infra | 95f6b60d23d73d910d3f6c398591c88b0bb71fd1 | b4fd76d4238821fd96df0b9dbd6cf63515f404bc | refs/heads/master | 2022-07-25T20:17:00.482401 | 2019-03-11T02:57:46 | 2019-03-11T02:57:46 | 174,911,258 | 0 | 1 | null | 2022-07-07T22:51:43 | 2019-03-11T02:28:02 | Java | UTF-8 | Java | false | false | 249 | java | package org.yoara.framework.component.payment.support;
public enum AddservicePayTypeEnums {
ALIPAY("支付宝"),
WECHAT("微信");
public final String desc;
AddservicePayTypeEnums(String desc) {
this.desc = desc;
}
}
| [
"yoara@126.com"
] | yoara@126.com |
3f637c34b1aa7f4ff5979d5cee4017c8dfbbd248 | bc9864fe146c85bbc86191fb2ea69525fbfbd17f | /tport/src/main/java/com/spaceman/tport/commands/tport/Sort.java | e492a5cd3c212f3dd6cf6ec540f7402a3d254dfb | [
"MIT"
] | permissive | JasperBouwman/TPort | 5f0cfb25a7237a95406cafc12d8d21ee40bf4776 | 70b0a271d9786632c478e116b65293618d22205a | refs/heads/master | 2023-08-25T18:38:20.072325 | 2023-08-14T21:26:42 | 2023-08-14T21:26:42 | 99,251,553 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,929 | java | package com.spaceman.tport.commands.tport;
import com.spaceman.tport.Pair;
import com.spaceman.tport.inventories.ItemFactory;
import com.spaceman.tport.inventories.TPortInventories;
import com.spaceman.tport.commandHandler.ArgumentType;
import com.spaceman.tport.commandHandler.EmptyCommand;
import com.spaceman.tport.commandHandler.SubCommand;
import com.spaceman.tport.fancyMessage.Message;
import com.spaceman.tport.fancyMessage.events.HoverEvent;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nullable;
import java.util.*;
import static com.spaceman.tport.fancyMessage.TextComponent.textComponent;
import static com.spaceman.tport.fancyMessage.colorTheme.ColorTheme.ColorType.varInfo2Color;
import static com.spaceman.tport.fancyMessage.colorTheme.ColorTheme.ColorType.varInfoColor;
import static com.spaceman.tport.fancyMessage.colorTheme.ColorTheme.*;
import static com.spaceman.tport.fileHander.Files.tportData;
import static com.spaceman.tport.permissions.PermissionHandler.hasPermission;
public class Sort extends SubCommand {
private static final String permissionPrefix = "TPort.sort.";
public Sort() {
EmptyCommand emptySorter = new EmptyCommand();
emptySorter.setCommandName("sorter", ArgumentType.OPTIONAL);
emptySorter.setCommandDescription(formatInfoTranslation("tport.command.sort.sorter.commandDescription"));
emptySorter.setPermissions(permissionPrefix + "<sorter>");
addAction(emptySorter);
setCommandDescription(formatInfoTranslation("tport.command.sort.commandDescription"));
}
private static final HashMap<String, Pair<Sorter, Message>> sorters = new HashMap<>();
public static Set<String> getSorters() {
return sorters.keySet();
}
public static Message getDescription(String name) {
return sorters.getOrDefault(name, new Pair<>(null, null)).getRight();
}
public static Sorter getSorter(String name) {
Sorter sorter = getSorterExact(name);
if (sorter == null) {
sorter = getSorterExact("oldest");
if (sorter == null) {
sorter = getSorterExact(getSorters().iterator().next());
}
}
return sorter;
}
public static String getSorterForPlayer(Player player) {
return tportData.getConfig().getString("tport." + player.getUniqueId() + ".sorter", "oldest");
}
public static Sorter getSorter(Player player) {
return getSorter(getSorterForPlayer(player));
}
public static String getNextSorterName(Player player) { //todo test
String currentSorter = Sort.getSorterForPlayer(player);
ArrayList<String> list = new ArrayList<>(getSorters());
boolean next = false;
int indexOfCurrent = 0;
for (int i = 0; i < list.size(); i++) {
String sorter = list.get(i);
if (next) {
if (hasPermission(player, false, permissionPrefix + sorter)) {
return sorter;
}
} else if (sorter.equalsIgnoreCase(currentSorter)) {
next = true;
indexOfCurrent = i;
}
}
for (int i = 0; i < indexOfCurrent; i++) {
String sorter = list.get(i);
if (hasPermission(player, false, permissionPrefix + sorter)) {
return sorter;
}
}
return null;
}
@Nullable
public static String getPreviousSorterName(Player player) { //todo test
String currentSorter = Sort.getSorterForPlayer(player);
ArrayList<String> list = new ArrayList<>(getSorters());
boolean next = false;
int indexOfCurrent = 0;
for (int i = list.size() - 1; i >= 0; i--) {
String sorter = list.get(i);
if (next) {
if (hasPermission(player, false, permissionPrefix + sorter)) {
return sorter;
}
} else if (sorter.equalsIgnoreCase(currentSorter)) {
next = true;
indexOfCurrent = i;
}
}
for (int i = list.size() - 1; i > indexOfCurrent; i--) {
String sorter = list.get(i);
if (hasPermission(player, false, permissionPrefix + sorter)) {
return sorter;
}
}
return null;
}
public static Sorter getSorterExact(String name) {
return sorters.getOrDefault(name, new Pair<>(null, null)).getLeft();
}
public static boolean addSorter(String name, Sorter sorter, Message description) {
if (!sorters.containsKey(name) && !name.contains(" ")) {
sorters.put(name, new Pair<>(sorter, description));
return true;
}
return false;
}
@Override
public Collection<String> tabList(Player player, String[] args) {
return getSorters();
}
@Override
public void run(String[] args, Player player) {
// tport sort [sorter]
/*
* sort types:
* popularity //todo
* alphabet
* newest
* oldest (default)
* */
if (args.length == 1) {
String sorterName = tportData.getConfig().getString("tport." + player.getUniqueId() + ".sorter", "oldest");
if (getSorter(sorterName) != null) {
tportData.getConfig().set("tport." + player.getUniqueId() + ".sorter", "oldest");
tportData.saveConfig();
sorterName = "oldest";
}
Message availableSorters = new Message();
ArrayList<String> sorters = new ArrayList<>(getSorters());
int sortersSize = sorters.size();
boolean color = true;
for (int i = 0; i < sortersSize; i++) {
String sorter = sorters.get(i);
availableSorters.addText(textComponent(sorter, (color ? varInfoColor : varInfo2Color), new HoverEvent(getDescription(sorter))));
if (i + 2 == sortersSize) availableSorters.addMessage(formatInfoTranslation("tport.command.sort.lastDelimiter"));
else availableSorters.addMessage(formatInfoTranslation("tport.command.sort.delimiter"));
color = !color;
}
availableSorters.removeLast();
sendInfoTranslation(player, "tport.command.sort.succeeded",
textComponent(sorterName, varInfoColor, new HoverEvent(getDescription(sorterName))),
availableSorters);
} else if (args.length == 2) {
if (setSorter(player, args[1])) {
TPortInventories.openMainTPortGUI(player);
}
} else {
sendErrorTranslation(player, "tport.command.wrongUsage", "/tport sort [sorter]");
}
}
public static boolean setSorter(Player player, String sorterName) {
Sorter sorter = getSorterExact(sorterName);
if (sorter == null) {
sendErrorTranslation(player, "tport.command.sort.sorter.notExist", sorterName);
return false;
}
if (!hasPermission(player, true, permissionPrefix + sorterName)) {
return false;
}
tportData.getConfig().set("tport." + player.getUniqueId() + ".sorter", sorterName);
tportData.saveConfig();
sendSuccessTranslation(player, "tport.command.sort.sorter.succeeded", sorterName);
return true;
}
@FunctionalInterface
public interface Sorter {
List<ItemStack> sort(Player player, ItemFactory.HeadAttributes... attributes);
}
}
| [
"jphbouwman@gmail.com"
] | jphbouwman@gmail.com |
91569592d75c8222c2298ae8eb9d023504d28a93 | 5cca9df309f4ecfaaf6e2428b15a7c3f4222e52d | /src/main/java/com/wangzhu/component/api/annotation/RpcComponentScan.java | 17440e69f271e9366a956da60d0aed2089ec1a10 | [] | no_license | qingyezhu/SpringBootWeb | 855b2b5ac96cbd0a81458b93902c31a0dfb856c0 | e853bd91c4bd9feb67f87259bead4b480c67153c | refs/heads/master | 2023-05-08T14:52:53.444324 | 2021-05-28T12:32:26 | 2021-05-28T12:32:26 | 329,239,838 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 632 | java | package com.wangzhu.component.api.annotation;
import com.wangzhu.component.wrap.RpcComponentScanRegistrar;
import org.springframework.context.annotation.Import;
import org.springframework.core.annotation.AliasFor;
import java.lang.annotation.*;
/**
* Created by wang.zhu on 2021-05-28 19:51.
**/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Import(RpcComponentScanRegistrar.class)
public @interface RpcComponentScan {
@AliasFor("basePackages")
String[] value() default {};
@AliasFor("value")
String[] basePackages() default {};
Class<?>[] basePackageClasses() default {};
}
| [
"wang.zhu@immomo.com"
] | wang.zhu@immomo.com |
fadceabc74585652a5014ac5935d229a4765b547 | 345c4045ac0d4059700c8e12241d7b798d46ec70 | /spring-demo-AOP/src/co/com/david/aopdemo/aspect/before/MyApiAnalyticsAspect.java | 64b13436e081a100d2d5219b80a83f27ce57142e | [] | no_license | csdavidg/SpringBest | f6edb5f600acb3787264dbe189fc2b95db4526a0 | fdb645f1edfb322f84699bf4d80e57eef7ae6cac | refs/heads/master | 2022-12-24T09:02:48.514722 | 2019-06-14T20:09:28 | 2019-06-14T20:09:28 | 189,491,116 | 0 | 0 | null | 2022-12-16T00:39:58 | 2019-05-30T22:34:28 | JavaScript | UTF-8 | Java | false | false | 633 | java | package co.com.david.aopdemo.aspect.before;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
//@Aspect
//@Order(2)
//@Component
public class MyApiAnalyticsAspect extends MajorAspect{
/*@Pointcut("execution(* co.com.david.aopdemo.controller.*.*(..))")
private void forControllerPackageAnyMethods() {
}*/
@Before("forControllerPackageAnyMethods()") // specific PACKAGE
public void beforeAddAccountAdvice() {
System.out.println("\n" + getClass() + " --> : beforeAddAccountAdvice()");
}
}
| [
"cristian.sanchez@globant.com"
] | cristian.sanchez@globant.com |
49c30da1e234953340d5974aa889eae35cdd0733 | b00ace991cc3b72ee90d4b03b512a1cec75a3935 | /native-platform/android/LibUU/app/src/main/java/qiong/mylib/libuu/UUHelper.java | 94e21929d9c02932f1b9b6ec39b4dc04eedb9b84 | [
"MIT"
] | permissive | sric0880/unity-framework | 82fed30f791d18d668f3d1dd2c8bab3cbad4d384 | bf27ea2997ef4ae92f0ab58bf13d72e1a3425d74 | refs/heads/master | 2021-04-26T16:13:41.878550 | 2018-02-10T15:46:50 | 2018-02-10T15:46:50 | 70,407,615 | 2 | 2 | null | 2017-05-04T08:51:53 | 2016-10-09T14:15:13 | C# | UTF-8 | Java | false | false | 1,595 | java | package qiong.mylib.libuu;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.res.AssetManager;
import java.io.File;
/**
* Created by qiong on 16/10/22.
*/
public class UUHelper {
static {
System.loadLibrary("uu");
}
private static String sAssetsPath;
private static Context mContext;
public static void init(final Context context)
{
mContext = context;
final ApplicationInfo applicationInfo = context.getApplicationInfo();
setAssetManager(context.getAssets());
int versionCode = 1;
try {
versionCode = UUHelper.mContext.getPackageManager().getPackageInfo(applicationInfo.packageName, 0).versionCode;
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
String pathToOBB = context.getObbDir() + "/main." + versionCode + ".obb";
File obbFile = new File(pathToOBB);
if (obbFile.exists()) {
UUHelper.sAssetsPath = pathToOBB;
newObbFile(pathToOBB);
}
else {
UUHelper.sAssetsPath = applicationInfo.sourceDir;
}
}
// This function returns the absolute path to the OBB if it exists,
// else it returns the absolute path to the APK.
public static String getAssetsPath()
{
return UUHelper.sAssetsPath;
}
private static native void setAssetManager(final AssetManager assetManager);
private static native void newObbFile(final String assetPath);
}
| [
"lzqiong@gmail.com"
] | lzqiong@gmail.com |
8a98e89a66594d8cdd49939b1cf5a57bdf6848f0 | 99824951e16658219b3136b0dd059c1d20d6d67d | /src/main/java/uk/org/whoami/authme/task/MessageTask.java | 5f4ae275ce306b49228dd11284c20a9867befa4e | [
"Apache-2.0"
] | permissive | minecraftkyle457/AuthMe-Reloaded | 08f97c8141b5a776ce39263f750e14789c2e3a62 | f3e6a1cf639f0bd0ce2fcd041aed4802699cc4b3 | refs/heads/master | 2021-01-17T22:37:50.284774 | 2012-08-08T21:32:35 | 2012-08-08T21:32:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,744 | java | /*
* Copyright 2011 Sebastian Köhler <sebkoehler@whoami.org.uk>.
*
* 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 uk.org.whoami.authme.task;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
import uk.org.whoami.authme.cache.auth.PlayerCache;
public class MessageTask implements Runnable {
private JavaPlugin plugin;
private String name;
private String msg;
private int interval;
public MessageTask(JavaPlugin plugin, String name, String msg, int interval) {
this.plugin = plugin;
this.name = name;
this.msg = msg;
this.interval = interval;
}
@Override
public void run() {
if (PlayerCache.getInstance().isAuthenticated(name)) {
return;
}
for (Player player : plugin.getServer().getOnlinePlayers()) {
if (player.getName().toLowerCase().equals(name)) {
player.sendMessage(msg);
BukkitScheduler sched = plugin.getServer().getScheduler();
sched.scheduleSyncDelayedTask(plugin, this, interval * 20);
}
}
}
}
| [
"st3fan_01@hotmail.com"
] | st3fan_01@hotmail.com |
98f87bdeae06f9952aa152ca019540a44c424683 | c2aa7652067f30d6fee3cb992cd2017432b5cc89 | /src/main/java/com/xym/bean/Cat.java | 45a9758967e1f5cf568c0b6a3dffcd4b6eb198b1 | [] | no_license | aikf/springannotationnote | dbf0e8a8df83492e8c35be25041f223bbc0c6602 | ac61dae6d95d77b3f27b619b2e7bb7a0b1b40a97 | refs/heads/master | 2020-04-07T20:47:48.872078 | 2018-11-22T13:28:51 | 2018-11-22T13:28:51 | 158,703,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package com.xym.bean;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;
/**
* @ClassName Cat
* @Description TODO
* @Author ak
* @Date 2018/11/22 下午2:24
* @Version 1.0
**/
@Component
public class Cat implements InitializingBean,DisposableBean {
public Cat(){
System.out.println("cat constructor...");
}
public void destroy() throws Exception {
System.out.println("cat destroy...");
}
public void afterPropertiesSet() throws Exception {
System.out.println("cat init...");
}
} | [
"aikfes@gmail.com"
] | aikfes@gmail.com |
7eea92ee491851fa0658e7a39f1f5bc9d6fe5988 | 786a40ce8dbaf2ffe460936eead8f8ba210251c7 | /android/app/src/main/java/com/sweeprtest/MainApplication.java | 8bb36d6d586282399c4343ce0eb718561255205a | [] | no_license | lee197/ReactNative-MoneyConverter | 4538bed1e3fea70e35dd06fd58e24756fb6f7097 | c27c1e2a62777cad81e8006a5bd6d3cdd4f8f5e8 | refs/heads/master | 2023-01-08T07:56:45.253876 | 2020-02-20T13:05:08 | 2020-02-20T13:05:08 | 240,616,785 | 0 | 0 | null | 2023-01-05T07:50:11 | 2020-02-14T23:34:38 | JavaScript | UTF-8 | Java | false | false | 2,277 | java | package com.sweeprtest;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this); // Remove this line if you don't want Flipper enabled
}
/**
* Loads Flipper in React Native templates.
*
* @param context
*/
private static void initializeFlipper(Context context) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper");
aClass.getMethod("initializeFlipper", Context.class).invoke(null, context);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"lee5187415@gmail.com"
] | lee5187415@gmail.com |
661df3eb77acdd80d06a65b32095620234b8562c | f1bd14d06f6c50d4854808101e2d152cc42c832a | /src/main/java/me/blayyke/reflex/command/commands/utilities/CommandGuildInfo.java | 51d088200cdb8e5e0bada34bf9d919dd731747de | [] | no_license | Chiearf-Chaotic/Reflex | e0f84acd466779222a9b4af872917d54968cfc63 | 789068ad0a620d7ff2440f42c578410f23b6fde6 | refs/heads/master | 2021-09-08T19:11:48.275807 | 2018-03-02T08:27:14 | 2018-03-02T08:27:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,801 | java | package me.blayyke.reflex.command.commands.utilities;
import me.blayyke.reflex.command.AbstractCommand;
import me.blayyke.reflex.command.CommandCategory;
import me.blayyke.reflex.command.CommandEnvironment;
import me.blayyke.reflex.utils.UserUtils;
import net.dv8tion.jda.core.EmbedBuilder;
import net.dv8tion.jda.core.entities.Guild;
public class CommandGuildInfo extends AbstractCommand {
@Override
public String getName() {
return "guildinfo";
}
@Override
public CommandCategory getCategory() {
return CommandCategory.UTILITIES;
}
@Override
public String getDesc() {
return "View information about this guild";
}
@Override
public String[] getAliases() {
return new String[]{"guild", "gi", "server", "serverinfo", "si"};
}
@Override
public void onCommand(CommandEnvironment env) {
EmbedBuilder embedBuilder = createEmbed();
Guild guild = env.getGuild();
embedBuilder.setTitle("Guild Information");
embedBuilder.setThumbnail(guild.getIconUrl());
embedBuilder.setDescription("Here is some information about this guild.");
embedBuilder.addField("Owner", UserUtils.formatUser(guild.getOwner().getUser()), true);
embedBuilder.addField("ID", guild.getId(), true);
embedBuilder.addField("Region", guild.getRegion().getName(), true);
embedBuilder.addField("Members", String.valueOf(guild.getMembers().size()), true);
embedBuilder.addField("2FA Enabled", (guild.getRequiredMFALevel() == Guild.MFALevel.TWO_FACTOR_AUTH ? "Yes" : "No"), true);
embedBuilder.addField("Voice AFK Timeout", guild.getAfkTimeout().getSeconds() / 60 + " minutes", true);
env.getChannel().sendMessage(embedBuilder.build()).queue();
}
} | [
"blakeredenius@gmail.com"
] | blakeredenius@gmail.com |
033d9085e1df5e673e43c1570fa704945be4c9be | c079d0a6da15d811f9c0668ce761b6c3dcbea182 | /src/com/dao/interfaces/InterfSocieteDao.java | 8da4833edad3868a2144a5135fa80d4ffa8387d5 | [] | no_license | ouaddioussama/GestFerme | ec685477e734892c64aff07689404bff8a23b919 | 957734fa9e185c9972d2c4c1790c7fbb65ef20bb | refs/heads/master | 2022-01-10T04:46:12.082774 | 2019-06-08T18:40:30 | 2019-06-08T18:40:30 | 186,079,830 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java | package com.dao.interfaces;
import com.entities.Societe;
public interface InterfSocieteDao extends InterfDao<Societe> {}
| [
"oussama.ouaddi@gmail.com"
] | oussama.ouaddi@gmail.com |
4295faf3fe26d69bb2fe410701e664c23a13612e | fc7b5226eca010a3f6f22185c4349bab4246cf76 | /02-java-oop/03-zoo-keeper-pt1/ZooKeeper1/GorilaTest.java | aed83d3f8a472617e4923bc5af0113112249ca81 | [] | no_license | java-july-2021/tahmin-assignments | 60f346176d21b6927f1ed5d47c213474ca6789ea | 6ed557e6e953b407fada944d4862802d4600a75c | refs/heads/master | 2023-06-06T20:47:39.699104 | 2021-07-14T11:47:23 | 2021-07-14T11:47:23 | 384,346,491 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package OOP.ZooKeeper1;
public class GorilaTest {
public static void main(String[] args) {
Mammal mam=new Mammal(100);
Gorila gor=new Gorila(80);
mam.displyEnergy();
System.out.println("It is Mamal and the mamal energyLevel:\n"+mam.energyLevel);
gor.throwSometing();
System.out.println(gor.energyLevel);
gor.EatBanana();
System.out.println(gor.energyLevel);
gor.Climb();
System.out.println(gor.energyLevel);
}
}
| [
"tahmena.barna@gmail.com"
] | tahmena.barna@gmail.com |
79cb810006e7d5d710b8055eb32388ac7561a019 | fc54bc5ab9a6b0fbb74a612ac78142061722a2a7 | /src/main/java/com/jtrio/zagzag/product/ProductRepository.java | 24c0b063e266028cc646855e2e09ade4f0f649d5 | [] | no_license | songji1165/zagzag | dde6efc7201b2fff8f478d29f12cb162c750a495 | a21172890f181855d171fa23d77d5de56f29eae7 | refs/heads/master | 2023-03-14T11:24:17.845609 | 2021-03-01T09:21:59 | 2021-03-01T09:21:59 | 319,635,467 | 0 | 0 | null | 2021-03-01T09:22:00 | 2020-12-08T12:43:05 | Java | UTF-8 | Java | false | false | 576 | java | package com.jtrio.zagzag.product;
import com.jtrio.zagzag.model.Category;
import com.jtrio.zagzag.model.Product;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import java.util.Optional;
@Repository
public interface ProductRepository extends PagingAndSortingRepository<Product, Long> {
Page<Product> findAllByCategory(Category category, Pageable pageable);
Optional<Product> findById(Long id);
}
| [
"songji1165@gmail.com"
] | songji1165@gmail.com |
538d15ce78c8f119f72d1aac41e0f908d8f3cbf0 | 12b14b30fcaf3da3f6e9dc3cb3e717346a35870a | /examples/commons-math3/mutations/mutants-BracketingNthOrderBrentSolver/536/org/apache/commons/math3/analysis/solvers/BracketingNthOrderBrentSolver.java | 236ba4c3bfedcf4917b41c655c216737ecbf0335 | [
"BSD-3-Clause",
"Minpack",
"Apache-2.0"
] | permissive | SmartTests/smartTest | b1de326998857e715dcd5075ee322482e4b34fb6 | b30e8ec7d571e83e9f38cd003476a6842c06ef39 | refs/heads/main | 2023-01-03T01:27:05.262904 | 2020-10-27T20:24:48 | 2020-10-27T20:24:48 | 305,502,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,817 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math3.analysis.solvers;
import org.apache.commons.math3.analysis.UnivariateFunction;
import org.apache.commons.math3.exception.MathInternalError;
import org.apache.commons.math3.exception.NoBracketingException;
import org.apache.commons.math3.exception.NumberIsTooSmallException;
import org.apache.commons.math3.exception.NumberIsTooLargeException;
import org.apache.commons.math3.exception.TooManyEvaluationsException;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.Precision;
/**
* This class implements a modification of the <a
* href="http://mathworld.wolfram.com/BrentsMethod.html"> Brent algorithm</a>.
* <p>
* The changes with respect to the original Brent algorithm are:
* <ul>
* <li>the returned value is chosen in the current interval according
* to user specified {@link AllowedSolution},</li>
* <li>the maximal order for the invert polynomial root search is
* user-specified instead of being invert quadratic only</li>
* </ul>
* </p>
* The given interval must bracket the root.
*
* @version $Id$
*/
public class BracketingNthOrderBrentSolver
extends AbstractUnivariateSolver
implements BracketedUnivariateSolver<UnivariateFunction> {
/** Default absolute accuracy. */
private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
/** Default maximal order. */
private static final int DEFAULT_MAXIMAL_ORDER = 5;
/** Maximal aging triggering an attempt to balance the bracketing interval. */
private static final int MAXIMAL_AGING = 2;
/** Reduction factor for attempts to balance the bracketing interval. */
private static final double REDUCTION_FACTOR = 1.0 / 16.0;
/** Maximal order. */
private final int maximalOrder;
/** The kinds of solutions that the algorithm may accept. */
private AllowedSolution allowed;
/**
* Construct a solver with default accuracy and maximal order (1e-6 and 5 respectively)
*/
public BracketingNthOrderBrentSolver() {
this(DEFAULT_ABSOLUTE_ACCURACY, DEFAULT_MAXIMAL_ORDER);
}
/**
* Construct a solver.
*
* @param absoluteAccuracy Absolute accuracy.
* @param maximalOrder maximal order.
* @exception NumberIsTooSmallException if maximal order is lower than 2
*/
public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
final int maximalOrder)
throws NumberIsTooSmallException {
super(absoluteAccuracy);
if (maximalOrder < 2) {
throw new NumberIsTooSmallException(maximalOrder, 2, true);
}
this.maximalOrder = maximalOrder;
this.allowed = AllowedSolution.ANY_SIDE;
}
/**
* Construct a solver.
*
* @param relativeAccuracy Relative accuracy.
* @param absoluteAccuracy Absolute accuracy.
* @param maximalOrder maximal order.
* @exception NumberIsTooSmallException if maximal order is lower than 2
*/
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
final double absoluteAccuracy,
final int maximalOrder)
throws NumberIsTooSmallException {
super(relativeAccuracy, absoluteAccuracy);
if (maximalOrder < 2) {
throw new NumberIsTooSmallException(maximalOrder, 2, true);
}
this.maximalOrder = maximalOrder;
this.allowed = AllowedSolution.ANY_SIDE;
}
/**
* Construct a solver.
*
* @param relativeAccuracy Relative accuracy.
* @param absoluteAccuracy Absolute accuracy.
* @param functionValueAccuracy Function value accuracy.
* @param maximalOrder maximal order.
* @exception NumberIsTooSmallException if maximal order is lower than 2
*/
public BracketingNthOrderBrentSolver(final double relativeAccuracy,
final double absoluteAccuracy,
final double functionValueAccuracy,
final int maximalOrder)
throws NumberIsTooSmallException {
super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
if (maximalOrder < 2) {
throw new NumberIsTooSmallException(maximalOrder, 2, true);
}
this.maximalOrder = maximalOrder;
this.allowed = AllowedSolution.ANY_SIDE;
}
/** Get the maximal order.
* @return maximal order
*/
public int getMaximalOrder() {
return maximalOrder;
}
/**
* {@inheritDoc}
*/
@Override
protected double doSolve()
throws TooManyEvaluationsException,
NumberIsTooLargeException,
NoBracketingException {
// prepare arrays with the first points
final double[] x = new double[maximalOrder + 1];
final double[] y = new double[maximalOrder + 1];
x[0] = getMin();
x[1] = getStartValue();
x[2] = getMax();
verifySequence(x[0], x[1], x[2]);
// evaluate initial guess
y[1] = computeObjectiveValue(x[1]);
if (Precision.equals(y[1], 0.0, 1)) {
// return the initial guess if it is a perfect root.
return x[1];
}
// evaluate first endpoint
y[0] = computeObjectiveValue(x[0]);
if (Precision.equals(y[0], 0.0, 1)) {
// return the first endpoint if it is a perfect root.
return x[0];
}
int nbPoints;
int signChangeIndex;
if (y[0] * y[1] < 0) {
// reduce interval if it brackets the root
nbPoints = 2;
signChangeIndex = 1;
} else {
// evaluate second endpoint
y[2] = computeObjectiveValue(x[2]);
if (Precision.equals(y[2], 0.0, 1)) {
// return the second endpoint if it is a perfect root.
return x[2];
}
if (y[1] * y[2] < 0) {
// use all computed point as a start sampling array for solving
nbPoints = 3;
signChangeIndex = 2;
} else {
throw new NoBracketingException(x[0], x[2], y[0], y[2]);
}
}
// prepare a work array for inverse polynomial interpolation
final double[] tmpX = new double[x.length];
// current tightest bracketing of the root
double xA = x[signChangeIndex - 1];
double yA = y[signChangeIndex - 1];
double absYA = FastMath.abs(yA);
int agingA = 0;
double xB = x[signChangeIndex];
double yB = y[signChangeIndex];
double absYB = FastMath.abs(yB);
int agingB = 0;
// search loop
while (true) {
// check convergence of bracketing interval
final double xTol = getAbsoluteAccuracy() +
getRelativeAccuracy() * FastMath.max(FastMath.abs(xA), FastMath.abs(xB));
if (((xB - xA) <= xTol) || (FastMath.max(absYA, absYB) < getFunctionValueAccuracy())) {
switch (allowed) {
case ANY_SIDE :
return absYA < absYB ? xA : xB;
case LEFT_SIDE :
return xA;
case RIGHT_SIDE :
return xB;
case BELOW_SIDE :
return (yA <= 0) ? xA : xB;
case ABOVE_SIDE :
return (yA < 0) ? xB : xA;
default :
// this should never happen
throw new MathInternalError();
}
}
// target for the next evaluation point
double targetY;
if (agingA >= MAXIMAL_AGING) {
// we keep updating the high bracket, try to compensate this
final int p = agingA - MAXIMAL_AGING;
final double weightA = (1 << p) - 1;
final double weightB = p + 1;
targetY = (weightA * yA - weightB * REDUCTION_FACTOR * yB) / (weightA + weightB);
} else if (agingB >= MAXIMAL_AGING) {
// we keep updating the low bracket, try to compensate this
final int p = agingB - MAXIMAL_AGING;
final double weightA = p + 1;
final double weightB = (1 << p) - 1;
targetY = (weightB * yB - weightA * REDUCTION_FACTOR * yA) / (weightA + weightB);
} else {
// bracketing is balanced, try to find the root itself
targetY = 0;
}
// make a few attempts to guess a root,
double nextX;
int start = 0;
int end = nbPoints;
do {
// guess a value for current target, using inverse polynomial interpolation
System.arraycopy(x, start, tmpX, start, end - start);
nextX = guessX(targetY, tmpX, y, start, end);
if (!((nextX > xA) && (nextX < xB))) {
// the guessed root is not strictly inside of the tightest bracketing interval
// the guessed root is either not strictly inside the interval or it
// is a NaN (which occurs when some sampling points share the same y)
// we try again with a lower interpolation order
if (signChangeIndex - start >= end - signChangeIndex) {
// we have more points before the sign change, drop the lowest point
++start;
} else {
// we have more points after sign change, drop the highest point
--end;
}
// we need to do one more attempt
nextX = Double.NaN;
}
} while (Double.isNaN(nextX) && (end - start > 1));
if (Double.isNaN(nextX)) {
// fall back to bisection
nextX = xA + 0.5 * (xB - xA);
start = signChangeIndex - 1;
end = signChangeIndex;
}
// evaluate the function at the guessed root
final double nextY = computeObjectiveValue(nextX);
if (Precision.equals(nextY, 0.0, 1)) {
// we have found an exact root, since it is not an approximation
// we don't need to bother about the allowed solutions setting
return nextX;
}
if ((nbPoints > 2) && (end - start != nbPoints)) {
// we have been forced to ignore some points to keep bracketing,
// they are probably too far from the root, drop them from now on
nbPoints = end - start;
System.arraycopy(x, start, x, 0, nbPoints);
System.arraycopy(y, start, y, 0, nbPoints);
signChangeIndex -= start;
} else if (nbPoints == x.length) {
// we have to drop one point in order to insert the new one
nbPoints--;
// keep the tightest bracketing interval as centered as possible
if (signChangeIndex >= (x.length + 1) / 2) {
// we drop the lowest point, we have to shift the arrays and the index
System.arraycopy(x, 1, x, 0, nbPoints);
System.arraycopy(y, 1, y, 0, nbPoints);
--signChangeIndex;
}
}
// insert the last computed point
//(by construction, we know it lies inside the tightest bracketing interval)
System.arraycopy(x, signChangeIndex, x, signChangeIndex + 1, nbPoints - signChangeIndex);
x[signChangeIndex] = nextX;
System.arraycopy(y, signChangeIndex, y, signChangeIndex + 1, nbPoints - signChangeIndex);
y[signChangeIndex] = nextY;
++nbPoints;
// update the bracketing interval
if (nextY * yA <= 0) {
// the sign change occurs before the inserted point
xB = nextX;
yB = nextY;
absYB = FastMath.abs(yB);
++agingA;
agingB = 0;
} else {
// the sign change occurs after the inserted point
xA = nextX;
yA = nextY;
absYA = FastMath.abs(yA);
agingA = 0;
++agingB;
// update the sign change index
signChangeIndex++;
}
}
}
/** Guess an x value by n<sup>th</sup> order inverse polynomial interpolation.
* <p>
* The x value is guessed by evaluating polynomial Q(y) at y = targetY, where Q
* is built such that for all considered points (x<sub>i</sub>, y<sub>i</sub>),
* Q(y<sub>i</sub>) = x<sub>i</sub>.
* </p>
* @param targetY target value for y
* @param x reference points abscissas for interpolation,
* note that this array <em>is</em> modified during computation
* @param y reference points ordinates for interpolation
* @param start start index of the points to consider (inclusive)
* @param end end index of the points to consider (exclusive)
* @return guessed root (will be a NaN if two points share the same y)
*/
private double guessX(final double targetY, final double[] x, final double[] y,
final int start, final int end) {
// compute Q Newton coefficients by divided differences
for (int i = start; i < end - 1; ++i) {
final int delta = i + 1 - start;
for (int j = end - 1; j > i; --j) {
x[j] = (x[j] - x[j-1]) / (y[j] - y[j / delta]);
}
}
// evaluate Q(targetY)
double x0 = 0;
for (int j = end - 1; j >= start; --j) {
x0 = x[j] + x0 * (targetY - y[j]);
}
return x0;
}
/** {@inheritDoc} */
public double solve(int maxEval, UnivariateFunction f, double min,
double max, AllowedSolution allowedSolution)
throws TooManyEvaluationsException,
NumberIsTooLargeException,
NoBracketingException {
this.allowed = allowedSolution;
return super.solve(maxEval, f, min, max);
}
/** {@inheritDoc} */
public double solve(int maxEval, UnivariateFunction f, double min,
double max, double startValue,
AllowedSolution allowedSolution)
throws TooManyEvaluationsException,
NumberIsTooLargeException,
NoBracketingException {
this.allowed = allowedSolution;
return super.solve(maxEval, f, min, max, startValue);
}
}
| [
"kesina@Kesinas-MBP.lan"
] | kesina@Kesinas-MBP.lan |
0a519885d877e156793ea40e02d90f20a399b015 | bd10597dc133237e68d07d8d6f9a2a1914e551ad | /BCA/Java/Polymorphism.java | 9d751190ca14f1c47643d974392b793b26c2a08d | [
"MIT"
] | permissive | muhammadmuzzammil1998/CollegeStuff | a1bf16a3d9a5b8586c10dd4ea2c0078baaae64fa | 618cec9ebfbfd29a2d1e5a182b90cfb36b38a906 | refs/heads/master | 2021-12-26T16:57:33.875599 | 2021-12-21T21:43:15 | 2021-12-21T21:43:15 | 125,047,706 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,210 | java | class Shape {
Shape(int side) {
System.out.println(" Assuming a square");
System.out.println(" Area: " + Math.pow(side, 2));
}
Shape(int edge, boolean is3D) {
System.out.println(" Assuming a cube");
System.out.println(" Volume: " + Math.pow(edge, 3));
}
Shape(int length, int width) {
System.out.println(" Assuming a rectangle");
System.out.println(" Area: " + length * width);
}
Shape(int length, int width, int height) {
System.out.println(" Assuming a cuboid");
System.out.println(" Volume: " + length * width * height);
}
}
class Polymorphism {
public static int add(int a, int b) {
return a + b;
}
public static String add(String a, String b) {
return a.concat(b);
}
public static void main(String[] args) {
System.out.println("Function overloading");
System.out.println(" Adding as numbers");
System.out.println(" 3 + 5 = " + add(3, 5));
System.out.println(" Adding as strings");
System.out.println(" 3 + 5 = " + add("3", "5"));
System.out.println();
System.out.println("Constructor overloading");
new Shape(3);
new Shape(3, true);
new Shape(3, 4);
new Shape(3, 4, 2);
}
} | [
"muhammadmuzzammil.cs@gmail.com"
] | muhammadmuzzammil.cs@gmail.com |
b09148cf08723a31032694f9ace970c495a65d51 | 7bbb7916f09f4b65007319bc3a6221683bbd2e5c | /JAVA/Material/Exercícios das Listas - POO/ExerciciosAprendizagem/src/senac/poo/exercicios/lista5/ProgramaVenda.java | ffde48f2bc886f3cc801bf9db2b877645f45b53c | [] | no_license | novaesMatheus/JAVA | f2dda37296c2a282ee137aa2667a5999b8051df9 | adc900b58e0e92734599ebf966efada0b35b35bf | refs/heads/master | 2021-09-15T16:33:15.299710 | 2018-06-06T19:22:17 | 2018-06-06T19:22:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 74 | java | package senac.poo.exercicios.lista5;
public class ProgramaVenda {
}
| [
"mathias21novaes@gmail.com"
] | mathias21novaes@gmail.com |
a1d79cdaacb7748d9be81b0769ffabca060814e1 | f3f713c98ed02639ecddabba3fd1ef438b0a05f2 | /src/main/java/com/cg/flightmgmt/service/IFlightBookingService.java | 44dc0414e1e36401c5b8d5065a9d791820417352 | [] | no_license | AmirPatel59/Flight-Management-System | dc8009b405bb5f17aebc5dd0e40bf494fa57719e | 5d691d9a0b15448d29d71b6ea6a22aa4b3123304 | refs/heads/master | 2023-03-16T02:50:21.103802 | 2021-03-23T05:13:51 | 2021-03-23T05:13:51 | 348,348,259 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package com.cg.flightmgmt.service;
import java.math.BigInteger;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import com.cg.flightmgmt.dto.Booking;
import com.cg.flightmgmt.dto.User;
import com.cg.flightmgmt.exception.BookingNotFoundException;
public interface IFlightBookingService {
public Booking addBooking(Booking booking);
public Booking cancelBooking(BigInteger bookingid) throws BookingNotFoundException;
public Booking viewBooking(BigInteger bookingid) throws BookingNotFoundException;
public List<Booking> viewBookingList(LocalDate bookingdate);
// public List<Booking> viewBookingList(BigInteger flightid);
public List<Booking> viewBookingHistory(BigInteger userId);
public Booking updateBooking(Booking booking) throws BookingNotFoundException;
}
| [
"80754833+AmirPatel59@users.noreply.github.com"
] | 80754833+AmirPatel59@users.noreply.github.com |
02c03093389b070a914c9069ee9db9d44b5b2120 | 2c2fdf1b6f7a6cbd860b59315b57d9d4ae8d2662 | /src/company/LargeNumver.java | 9317f3601ef3cb23b168adaec8e8cf0dc3f87827 | [] | no_license | sukbear/oj | bdef3ae70feea252f91c370ff78ce5d32325513b | 0181e9f00e79a0bf49f24683d81aed5b4d5dcdbd | refs/heads/master | 2020-06-19T18:14:17.506454 | 2020-04-12T21:36:09 | 2020-04-12T21:36:11 | 196,816,825 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,359 | java | package company;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.List;
import java.util.Random;
/***
*@ClassName LargeNumver
*@Description
* @author sukbear
* @create 2019-05-22 20:35
*/
public class LargeNumver {
/** BitSet
* 常见的应用场景是对海量数据进行一些统计工作,比如日志分析、用户数统计等。
* 有1千万个随机数,随机数的范围在1到1亿之间。
* 现在要求写出一种算法,将1到1亿之间没有在随机数中的数求出来?
*/
public static void main(String[] args) {
Random random = new Random();
List<Integer> list = new ArrayList<>();
for (int i = 0; i < 10000000; i++) {
int randomResult = random.nextInt(100000000);
list.add(randomResult);
}
System.out.println("产生的随机数有");
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
}
BitSet bitSet = new BitSet(100000000);
for (int i = 0; i < 10000000; i++) {
bitSet.set(list.get(i));
}
System.out.println("0~1亿不在上述随机数中有" + bitSet.size());
for (int i = 0; i < 100000000; i++) {
if (!bitSet.get(i)) {
System.out.println(i);
}
}
}
}
| [
"704759810@qq.com"
] | 704759810@qq.com |
4262dc15878a7da559525b3e295040e3bd7679fa | 6613d9537cd928f2dd5b6f2d8f775bdb5c03471d | /src/main/java/com/pr/website/providers/SessionProvider.java | 1861be0aaf500f527d05a978c2c9ee2f837e71b8 | [] | no_license | sagaranand015/spring-mvc-sample | c64a3776f403e6360bcbd9dee0c19b9a92592108 | 86c16c5bec3ab6cd226392ce8acd81f5be2b979e | refs/heads/master | 2020-03-10T12:34:54.454903 | 2018-04-13T10:14:51 | 2018-04-13T10:14:51 | 129,381,517 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | package com.pr.website.providers;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.session.SessionAuthenticationException;
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
import org.springframework.security.web.context.SecurityContextRepository;
import org.springframework.security.web.session.InvalidSessionStrategy;
import org.springframework.security.web.session.SessionManagementFilter;
public class SessionProvider implements SessionAuthenticationStrategy {
public void onAuthentication(Authentication arg0, HttpServletRequest arg1, HttpServletResponse arg2)
throws SessionAuthenticationException {
try {
System.out.println("The session has been authenticated.");
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"sagaranand@Sagars-MacBook-Pro-2.local"
] | sagaranand@Sagars-MacBook-Pro-2.local |
f874cb25030e63e87552c4c5c15128a24a1f317f | 0c126daf79ef421ff84ff4062276b1a3340e0c66 | /JAVA AP Practie/basicGapWidth.java | 4a2e82b8035b54a86e608d0601e95ed14188b180 | [] | no_license | vasuParanji-coder/MyProjects | 4859a4de7d10c67b71f3a1a2ea04bac0d75298c3 | 8fc4f22712b6e252bc6e3bced8a580e8e17af8b9 | refs/heads/master | 2023-06-17T20:41:02.651703 | 2021-07-14T16:41:50 | 2021-07-14T16:41:50 | 236,336,993 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,616 | java | import java.util.*;
public class basicGapWidth
{
public static int totalLetters(List<String> wordList)
{
int letCount = 0;
for(int i = 0; i < wordList.size(); i++)
{
if(wordList.get(i).isEmpty() != true)
{
letCount += wordList.get(i).length();
}
}
return letCount;
}
public static int basicWidthGap(List<String> wordList, int formattedLen)
{
int letterCount = totalLetters(wordList);
int spaceCount = wordList.size()-1;
int availableSpaces = formattedLen - letterCount;
int basicGap = availableSpaces/spaceCount;
return basicGap;
}
public static int leftoverSpaces(List<String> wordList, int formattedLen)
{
int l = totalLetters(wordList);
int left = formattedLen - l -(basicWidthGap(wordList,formattedLen)*(wordList.size()-1));
return left;
}
public static String format(List<String> wordList, int formattedLen)
{
int gapWidth = basicWidthGap(wordList, formattedLen);
int leftOverSpaces = leftoverSpaces(wordList, formattedLen);
StringBuilder sb = new StringBuilder();
for(int i = 0; i < wordList.size(); i++)
{
sb.append(wordList.get(i));
for(int j=0; j<gapWidth; j++)
{
sb.append(' ');
}
if(leftOverSpaces>0)
{
sb.append(' ');
leftOverSpaces--;
}
}
return sb.toString();
}
public static void main(String[] a)
{
List<String> l = new ArrayList<String>();
l.add("AP");
l.add("COMP");
l.add("SCI");
l.add("ROCKS");
System.out.println(format(l,20));
}
} | [
"noreply@github.com"
] | noreply@github.com |
c3aa7b24977739a0e6c01a09041b4174e4226abd | 21e188b07b5414981db81566337bc470868ec653 | /Vehicle/src/main/java/com/cug/vehicle/KeyDecrypt.java | cca27e6c9b5996683cfa05cb832266753e6a415a | [] | no_license | qiuweihui/Authentication | 4798258c2f38806ee16c9055b5d5b060435fd65e | 153e7fc346fe037a4a3d859e5d01a068e9e90f0c | refs/heads/master | 2023-01-23T16:01:50.264938 | 2020-11-23T08:24:59 | 2020-11-23T08:24:59 | 307,727,934 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,182 | java | package com.cug.vehicle;
import cn.xjfme.encrypt.utils.Util;
import cn.xjfme.encrypt.utils.sm2.SM2EncDecUtils;
import com.cug.utils.Input;
import com.cug.utils.Output;
import java.io.IOException;
/**
* @author qiuweihui
* @create 2020-11-02 14:38
* 小车用自己的私钥解密出服务器发过来的加密内容(服务器的公钥,SM4Key),其中服务器公钥用于到区块链验证,SM4Key用于加密数据
* 步骤6、8的前提
*/
public class KeyDecrypt {
public static void main(String[] args) throws Exception {
String prikey = jsonToString("D:\\TestData\\Vehicle\\prikey.json","prikey");
//读入小车的SM2私钥
String encrypt = jsonToString("D:\\TestData\\Vehicle\\response_receive.json","encrypt");
//读入服务器发来的加密内容
String decryptInfo = SM2Dec(prikey,encrypt);
//解密出SM4Key和服务器公钥,分别存储,输出为json对象存储
String pubkey_server = decryptInfo.substring(0,130);
String sm4key = decryptInfo.substring(130);
cn.hutool.json.JSONObject json1 =new cn.hutool.json.JSONObject();
json1.accumulate("pubkey",pubkey_server);
Output.wirteText(String.valueOf(json1),"D:\\TestData\\Vehicle\\pubkey_server.json");
cn.hutool.json.JSONObject json2 =new cn.hutool.json.JSONObject();
json2.accumulate("sm4key",sm4key);
Output.wirteText(String.valueOf(json2),"D:\\TestData\\Vehicle\\sm4key.json");
}
//私钥解密
public static String SM2Dec(String priKey, String encryptedData) throws IOException {
//填充04
encryptedData="04"+encryptedData;
byte[] decrypt = SM2EncDecUtils.decrypt(Util.hexStringToBytes(priKey), Util.hexStringToBytes(encryptedData));
return new String(decrypt);
}
public static String jsonToString(String path , String key) throws Exception {
String fi = Input.getString(path);
com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(fi);
String src = jsonObject.getString(key);
return src;
//返回传入路径和Key值对应的value值
}
}
| [
"2304735480@qq.com"
] | 2304735480@qq.com |
14f4241399b95ece12da37e9b8b7f694dd5e523e | 06b1819f0fb204c3af35755f34d18beb8af78a6e | /TradingPersistence/src/cl/dsoto/trading/components/OptimizationManager.java | bec2d69854b5bb00ec54d0e7a30f25d0da2d579f | [] | no_license | diego1982chile/Trading | 298de008bc413a632d089767d7bea46a9e335807 | 2f7bbb738056106500410bad19f660d0b8bc565e | refs/heads/master | 2023-05-01T17:48:57.984309 | 2023-04-17T22:20:22 | 2023-04-17T22:20:22 | 178,484,518 | 0 | 0 | null | 2023-04-17T22:20:23 | 2019-03-29T22:46:21 | CSS | UTF-8 | Java | false | false | 469 | java | package cl.dsoto.trading.components;
import cl.dsoto.trading.model.Optimization;
import cl.dsoto.trading.model.Period;
import cl.dsoto.trading.model.Strategy;
import javax.ejb.Remote;
import java.util.List;
/**
* Created by des01c7 on 25-03-19.
*/
@Remote
public interface OptimizationManager {
public Optimization persist(Optimization optimization) throws Exception;
public List<Optimization> getOptimizationsByPeriod(Period period) throws Exception;
}
| [
"gustavopunucura@gmail.com"
] | gustavopunucura@gmail.com |
87814fc5e69168fc323b89c103b6908b5b92c97e | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/13/13_83d60942ff6f60b2ae06d5a7188126d685018113/RemoteLineUpQueue/13_83d60942ff6f60b2ae06d5a7188126d685018113_RemoteLineUpQueue_s.java | d86d2bb5e0a37443ec170d28c2e0a2eb99e44442 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 7,952 | java | /**
*
* lineup - In-Memory high-throughput queue
* Copyright (c) 2013, Sandeep Gupta
*
* http://www.sangupta/projects/lineup
*
* 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.sangupta.lineup.domain;
import java.util.List;
import javax.ws.rs.core.MediaType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sangupta.jerry.http.WebInvoker;
import com.sangupta.jerry.http.WebRequestMethod;
import com.sangupta.jerry.http.WebResponse;
import com.sangupta.jerry.util.AssertUtils;
import com.sangupta.jerry.util.DateUtils;
import com.sangupta.jerry.util.UriUtils;
import com.sangupta.jerry.util.XStreamUtils;
/**
* @author sangupta
*
*/
public class RemoteLineUpQueue extends AbstractLineUpBlockingQueue {
private static final Logger LOGGER = LoggerFactory.getLogger(RemoteLineUpQueue.class);
private static final long DEFAULT_POLL_TIME = DateUtils.ONE_SECOND;
/**
* The URL of the remote queue.
*
*/
private final String remoteQueue;
/**
* The default poll time to use for this queue
*/
private final long messagePollTime;
/**
* Create a {@link LineUpQueue} that connects to the given remote queue.
*
* @param queueURL
*/
public RemoteLineUpQueue(String queueURL) {
if(AssertUtils.isEmpty(queueURL)) {
throw new IllegalArgumentException("Remote server URL cannot be null/empty");
}
this.remoteQueue = queueURL;
this.messagePollTime = DEFAULT_POLL_TIME;
}
/**
* Create a {@link LineUpQueue} that connects to the given remote server, and connects
* to an already existing queue.
*
* @param lineUpServer
* @param queueName
*/
public RemoteLineUpQueue(String lineUpServer, String queueName) {
this(lineUpServer, queueName, QueueOptions.getOptions(QueueType.AllowDuplicates));
}
/**
* Create a {@link LineUpQueue} that connects to the given remote server, and creates
* a new queue with the given name and options.
*
* @param lineUpServer
* @param queueName
* @param queueOptions
*/
public RemoteLineUpQueue(String lineUpServer, String queueName, QueueOptions queueOptions) {
if(queueOptions == null) {
throw new IllegalArgumentException("Queue options cannot be null");
}
final String xml = XStreamUtils.getXStream(QueueOptions.class).toXML(queueOptions);
final String endPoint = UriUtils.addWebPaths(lineUpServer, "queue/" + queueName + "?queueType=" + queueOptions.getQueueType());
WebResponse response = WebInvoker.invokeUrl(endPoint, WebRequestMethod.PUT, MediaType.TEXT_XML, xml);
if(response == null) {
throw new RuntimeException("Unable to connect to create a new remote queue.");
}
if(response.getResponseCode() != 200) {
throw new RuntimeException("Unable to connect to create a new remote queue.");
}
DefaultLineUpQueue queue = (DefaultLineUpQueue) XStreamUtils.getXStream(DefaultLineUpQueue.class).fromXML(response.asStream());
if(queue == null) {
throw new RuntimeException("Unable to connect to create a new remote queue.");
}
this.remoteQueue = UriUtils.addWebPaths(lineUpServer, "messages/" + queue.getSecurityCode() + "/" + queueName);
this.messagePollTime = DEFAULT_POLL_TIME;
}
/**
* Create a {@link LineUpQueue} that connects to the given remote server, and connects
* to an already existing queue with the given name and security code.
*
* @param lineUpServer
* @param queueName
* @param securityCode
*/
public RemoteLineUpQueue(String lineUpServer, String queueName, String securityCode) {
this(lineUpServer, queueName, securityCode, DEFAULT_POLL_TIME);
}
public RemoteLineUpQueue(String lineUpServer, String queueName, String securityCode, long defaultPollTime) {
this.remoteQueue = UriUtils.addWebPaths(lineUpServer, "messages/" + securityCode + "/" + queueName);
this.messagePollTime = defaultPollTime;
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#addMessage(java.lang.String)
*/
@Override
public QueueMessage addMessage(String message) {
WebResponse response = WebInvoker.postXML(this.remoteQueue, new QueueMessage(message, 0, 1));
if(response == null) {
return null;
}
if(!response.isSuccess()) {
LOGGER.error("Error posting message to remote queue for reason: ", response);
return null;
}
return (QueueMessage) XStreamUtils.getXStream(QueueMessage.class).fromXML(response.asStream());
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#addMessage(java.lang.String, int)
*/
@Override
public QueueMessage addMessage(String message, int delaySeconds) {
WebResponse response = WebInvoker.postXML(this.remoteQueue, new QueueMessage(message, delaySeconds, 1));
if(response == null) {
return null;
}
return (QueueMessage) XStreamUtils.getXStream(QueueMessage.class).fromXML(response.asStream());
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#addMessage(com.sangupta.lineup.domain.QueueMessage)
*/
@Override
public QueueMessage addMessage(QueueMessage queueMessage) {
WebResponse response = WebInvoker.postXML(this.remoteQueue, queueMessage);
if(response == null) {
return null;
}
return (QueueMessage) XStreamUtils.getXStream(QueueMessage.class).fromXML(response.asStream());
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#getMessage()
*/
@Override
public QueueMessage getMessage() {
return getMessage(this.messagePollTime);
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#getMessage(int)
*/
@Override
public QueueMessage getMessage(long longPollTime) {
WebResponse response = WebInvoker.getResponse(this.remoteQueue + "?pollTime=" + longPollTime);
if(response == null) {
return null;
}
if(response.getResponseCode() == 200) {
return (QueueMessage) XStreamUtils.getXStream(QueueMessage.class).fromXML(response.asStream());
}
// consume the entity so that the connection can be closed
response.close();
// return null
return null;
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#getMessages(int)
*/
@SuppressWarnings("unchecked")
@Override
public List<QueueMessage> getMessages(int numMessages) {
WebResponse response = WebInvoker.getResponse(this.remoteQueue + "?numMessages=" + numMessages);
if(response == null) {
return null;
}
return (List<QueueMessage>) XStreamUtils.getXStream(QueueMessage.class).fromXML(response.asStream());
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#deleteMessage(java.lang.String)
*/
@Override
public boolean deleteMessage(String messageID) {
QueueMessage queueMessage = QueueMessage.createMessage(messageID);
String xml = XStreamUtils.getXStream(QueueMessage.class).toXML(queueMessage);
WebResponse response = WebInvoker.invokeUrl(this.remoteQueue, WebRequestMethod.DELETE, MediaType.TEXT_XML, xml);
if(response == null) {
return false;
}
if(response.isSuccess()) {
return true;
}
return false;
}
/**
* @see com.sangupta.lineup.domain.LineUpQueue#numMessages()
*/
@Override
public int numMessages() {
throw new RuntimeException("Not yet implemented");
}
/**
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return this.remoteQueue;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
638d7c4bd7d52ffd63a7f289a736e52e597d7c53 | 6758da174ff73608ef60fd0e66991c98c88ddab3 | /src/main/java/br/jus/trf2/intelijus/IIntelijus.java | 131ce7b7c0a2c78c1516d6b5f45d7c1f140ae2be | [
"MIT"
] | permissive | trf2-jus-br/intelijus | b2908e626f5d53096f8cf4dd797b8abbae77af71 | 6931872ab2358a8cfaad3fbf430cac9c6b564107 | refs/heads/master | 2021-01-18T17:52:25.363013 | 2017-04-03T20:47:58 | 2017-04-03T20:47:58 | 86,819,527 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,081 | java | package br.jus.trf2.intelijus;
import java.util.List;
import com.crivano.swaggerservlet.ISwaggerMethod;
import com.crivano.swaggerservlet.ISwaggerModel;
import com.crivano.swaggerservlet.ISwaggerRequest;
import com.crivano.swaggerservlet.ISwaggerResponse;
public interface IIntelijus {
public class Orgao implements ISwaggerModel {
public String nome;
public String descricao;
public String codigo;
}
public class Unidade implements ISwaggerModel {
public String nome;
public String descricao;
public String codigo;
public String localidade;
}
public class Indicador implements ISwaggerModel {
public String nome;
public String descricao;
public Double valor;
public String memoriaDeCalculo;
}
public class LinhaRelatorioDinamico implements ISwaggerModel {
public String orgao;
public String instancia;
public String tipoUnidade;
public String unidade;
public String natureza;
public String tipoMovimentacao;
public String classe;
public String assuntoPrincipal;
public String coletivo;
public Double ano;
public Double quantidade;
}
public class Error implements ISwaggerModel {
public String error;
}
public class OrgaoOrgaoUnidadeUnidadeMetasNacionaisGetRequest implements ISwaggerRequest {
public String orgao;
public String unidade;
}
public class OrgaoOrgaoUnidadeUnidadeMetasNacionaisGetResponse implements ISwaggerResponse {
public List<Indicador> list;
}
public interface IOrgaoOrgaoUnidadeUnidadeMetasNacionaisGet extends ISwaggerMethod {
public void run(OrgaoOrgaoUnidadeUnidadeMetasNacionaisGetRequest req,
OrgaoOrgaoUnidadeUnidadeMetasNacionaisGetResponse resp) throws Exception;
}
public class OrgaoOrgaoUnidadeUnidadeMetasEspecificasGetRequest implements ISwaggerRequest {
public String orgao;
public String unidade;
}
public class OrgaoOrgaoUnidadeUnidadeMetasEspecificasGetResponse implements ISwaggerResponse {
public List<Indicador> list;
}
public interface IOrgaoOrgaoUnidadeUnidadeMetasEspecificasGet extends ISwaggerMethod {
public void run(OrgaoOrgaoUnidadeUnidadeMetasEspecificasGetRequest req,
OrgaoOrgaoUnidadeUnidadeMetasEspecificasGetResponse resp) throws Exception;
}
public class OrgaoOrgaoUnidadeUnidadePendenciasGetRequest implements ISwaggerRequest {
public String orgao;
public String unidade;
}
public class OrgaoOrgaoUnidadeUnidadePendenciasGetResponse implements ISwaggerResponse {
public List<Indicador> list;
}
public interface IOrgaoOrgaoUnidadeUnidadePendenciasGet extends ISwaggerMethod {
public void run(OrgaoOrgaoUnidadeUnidadePendenciasGetRequest req,
OrgaoOrgaoUnidadeUnidadePendenciasGetResponse resp) throws Exception;
}
public class OrgaoOrgaoUnidadeUnidadeProducaoGetRequest implements ISwaggerRequest {
public String orgao;
public String unidade;
}
public class OrgaoOrgaoUnidadeUnidadeProducaoGetResponse implements ISwaggerResponse {
public List<Indicador> list;
}
public interface IOrgaoOrgaoUnidadeUnidadeProducaoGet extends ISwaggerMethod {
public void run(OrgaoOrgaoUnidadeUnidadeProducaoGetRequest req,
OrgaoOrgaoUnidadeUnidadeProducaoGetResponse resp) throws Exception;
}
public class OrgaoOrgaoUnidadeUnidadeAcervoGetRequest implements ISwaggerRequest {
public String orgao;
public String unidade;
}
public class OrgaoOrgaoUnidadeUnidadeAcervoGetResponse implements ISwaggerResponse {
public List<Indicador> list;
}
public interface IOrgaoOrgaoUnidadeUnidadeAcervoGet extends ISwaggerMethod {
public void run(OrgaoOrgaoUnidadeUnidadeAcervoGetRequest req, OrgaoOrgaoUnidadeUnidadeAcervoGetResponse resp)
throws Exception;
}
public class OrgaoOrgaoUnidadesGetRequest implements ISwaggerRequest {
public String orgao;
}
public class OrgaoOrgaoUnidadesGetResponse implements ISwaggerResponse {
public List<Unidade> list;
}
public interface IOrgaoOrgaoUnidadesGet extends ISwaggerMethod {
public void run(OrgaoOrgaoUnidadesGetRequest req, OrgaoOrgaoUnidadesGetResponse resp) throws Exception;
}
public class OrgaosGetRequest implements ISwaggerRequest {
}
public class OrgaosGetResponse implements ISwaggerResponse {
public List<Orgao> list;
}
public interface IOrgaosGet extends ISwaggerMethod {
public void run(OrgaosGetRequest req, OrgaosGetResponse resp) throws Exception;
}
public class RelatorioDinamicoGetRequest implements ISwaggerRequest {
}
public class RelatorioDinamicoGetResponse implements ISwaggerResponse {
public List<LinhaRelatorioDinamico> list;
}
public interface IRelatorioDinamicoGet extends ISwaggerMethod {
public void run(RelatorioDinamicoGetRequest req, RelatorioDinamicoGetResponse resp) throws Exception;
}
public class SugestaoPostRequest implements ISwaggerRequest {
public String nome;
public String email;
public String mensagem;
}
public class SugestaoPostResponse implements ISwaggerResponse {
public String status;
}
public interface ISugestaoPost extends ISwaggerMethod {
public void run(SugestaoPostRequest req, SugestaoPostResponse resp) throws Exception;
}
} | [
"renato.crivano@gmail.com"
] | renato.crivano@gmail.com |
a7ebd644ca0a360cef3756ba9f41f094dacb39ff | 5b1e300a80e700a0c829dbb15bb287292772ace2 | /SydovaVladaFirstProject/src/main/java/ua/repository/CourtsRepository.java | b156bc6817cc76e937d68299a137484edda34ea7 | [] | no_license | SaveskulSviatoslav/First | d4c300ce51b620886411be57403e3d48cf9161e3 | e9cda7c0d788e280285139a0a5eac000c5e0c293 | refs/heads/master | 2021-01-19T13:31:35.616473 | 2017-11-08T20:37:25 | 2017-11-08T20:37:25 | 88,097,039 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package ua.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import ua.entity.Courts;
@Repository
public interface CourtsRepository extends JpaRepository<Courts, Integer>{
public List<Courts> findAll();
}
| [
"saveskul@ukr.net"
] | saveskul@ukr.net |
a47dc0358544c4506b0edea5b6fedf8e8c7f4541 | cc511ceb3194cfdd51f591e50e52385ba46a91b3 | /example/source_code/jackrabbit/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/retention/HoldImpl.java | 19dc7a21612f045ad10fdc446d3f0895e4a90767 | [] | no_license | huox-lamda/testing_hw | a86cdce8d92983e31e653dd460abf38b94a647e4 | d41642c1e3ffa298684ec6f0196f2094527793c3 | refs/heads/master | 2020-04-16T19:24:49.643149 | 2019-01-16T15:47:13 | 2019-01-16T15:47:13 | 165,858,365 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,218 | java | org apach jackrabbit core retent
org apach jackrabbit spi
org apach jackrabbit spi factori namefactori
org apach jackrabbit spi common factori impl namefactoryimpl
org apach jackrabbit spi common convers resolv nameresolv
org apach jackrabbit core node nodeid
org apach jackrabbit core properti impl propertyimpl
org apach jackrabbit core session impl sessionimpl
javax jcr retent hold
javax jcr
javax jcr repositori except repositoryexcept
javax jcr factori valuefactori
code holdimpl code
hold impl holdimpl hold
factori namefactori factori factori factori impl namefactoryimpl instanc getinst
string deep
string shallow
deep isdeep
node nodeid node nodeid
resolv nameresolv resolv
hash code hashcod
hold impl holdimpl deep isdeep node nodeid node nodeid resolv nameresolv resolv
deep isdeep deep isdeep
node nodeid node nodeid
resolv resolv
node nodeid node getnodeid
node nodeid
tovalu factori valuefactori factori valuefactori repositori except repositoryexcept
string str deep isdeep deep shallow string tostr
factori valuefactori creat createvalu str
hold impl holdimpl creat createfromvalu val node nodeid node nodeid resolv nameresolv resolv repositori except repositoryexcept
string str val string getstr
factori factori creat str substr
deep isdeep str start startswith deep
hold impl holdimpl deep isdeep node nodeid resolv
hold impl holdimpl creat properti createfromproperti properti impl propertyimpl properti node nodeid node nodeid repositori except repositoryexcept
properti valu getvalu
hold impl holdimpl hold hold impl holdimpl length
length
hold creat createfromvalu node nodeid session impl sessionimpl properti session getsess
hold
hold
javax jcr retent hold isdeep
deep isdeep repositori except repositoryexcept
deep isdeep
javax jcr retent hold getnam
string getnam repositori except repositoryexcept
resolv jcr getjcrnam
object
object hashcod
overrid
hash code hashcod
hash code hashcod
hash code hashcod
node nodeid hash code hashcod
boolean valueof deep isdeep hash code hashcod
hash code hashcod
hash code hashcod
object equal object
overrid
equal object obj
obj
obj hold impl holdimpl
hold impl holdimpl hold impl holdimpl obj
deep isdeep deep isdeep equal node nodeid equal node nodeid
| [
"huox@lamda.nju.edu.cn"
] | huox@lamda.nju.edu.cn |
58f99a5d2ed27d51917e7874f15d74298b47fea8 | ca8616101634895b067e58e942ac0c335bd7fffd | /Camera/src/com/dgut/main/dao/impl/InstallationRecordDaoImpl.java | fffdd31d7f594ae2d283f970608d6a056b31aa4a | [] | no_license | Zhang-BigSmart/Camera | 0c717aa62324dbe72f12bc7ab430c459f5ba72b8 | 200f81450b113c16248f5d9df6ee366bd4cb8387 | refs/heads/master | 2022-11-13T09:27:52.823639 | 2017-01-07T01:44:36 | 2017-01-07T01:44:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,012 | java | package com.dgut.main.dao.impl;
import java.io.Serializable;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.hibernate.Query;
import com.dgut.common.hibernate3.Finder;
import com.dgut.common.hibernate3.HibernateBaseDao;
import com.dgut.common.page.Pagination;
import com.dgut.main.dao.InstallationRecordDao;
import com.dgut.main.entity.InstallationRecord;
public class InstallationRecordDaoImpl extends HibernateBaseDao<InstallationRecord, Integer> implements InstallationRecordDao {
public void save(InstallationRecord bean) {
getSession().save(bean);
}
public void delete(InstallationRecord bean){
getSession().delete(bean);
}
public InstallationRecord findById(Serializable id) {
return (InstallationRecord) getSession().get(InstallationRecord.class, id);
}
public void update(InstallationRecord bean){
getSession().update(bean);
}
public List<InstallationRecord> getAll() {
String hql = "from InstallationRecord bean";
return find(hql);
}
public List<InstallationRecord> findUserId(String id) {
Finder f = Finder.create("select bean from InstallationRecord bean where (userNo like :userId or userName like :userId) and flag = 0");
f.setParam("userId", "%"+id+"%");
return find(f);
}
public List<InstallationRecord> findByUserNo(String No) {
Finder f = Finder.create("select bean from InstallationRecord bean where userNo like :userNo");
f.setParam("userNo",No);
return find(f);
}
public List<InstallationRecord> findByWorkSheetNo(String worksheetNo){
Finder f = Finder.create("select bean from InstallationRecord bean where bean.worksheetNo = :worksheetNo");
f.setParam("worksheetNo", worksheetNo);
return find(f);
}
protected Class<InstallationRecord> getEntityClass() {
return InstallationRecord.class;
}
public InstallationRecord findOne(String id){
return findUniqueByProperty("userNo", id);
}
public Integer countAll(){
String hql = "select count(*) from InstallationRecord";
Query q = getSession().createQuery(hql);
return ((Number) q.iterate().next()).intValue();
}
public Integer getCount(String worksheetNo){
String hql = "select count(*) from InstallationRecord bean where bean.worksheetNo=:worksheetNo";
Query q = getSession().createQuery(hql).setParameter("worksheetNo", worksheetNo);
return ((Number) q.iterate().next()).intValue();
}
public Pagination getCurPage(String worksheetNo, int pageNo, int pageSize,String sortOrder){
Finder f = Finder.create("select bean from InstallationRecord bean where 1=1");
if (StringUtils.isNotBlank(worksheetNo)) {
f.append(" and bean.worksheetNo=:worksheetNo");
f.setParam("worksheetNo", worksheetNo);
}
if (StringUtils.isNotBlank(sortOrder)) {
if(sortOrder.equalsIgnoreCase("asc")){
f.append(" order by bean.worksheetNo asc");
}
if(sortOrder.equalsIgnoreCase("desc")){
f.append(" order by bean.worksheetNo desc");
}
}
return find(f, pageNo, pageSize);
}
}
| [
"931337038@qq.com"
] | 931337038@qq.com |
e7c5f7ac9027b6da02b9396507a89e335976b6d5 | 42a321a05e12081b1bf6d3fd7af5a7805421986a | /app/src/main/java/com/example/hoanbk/movieguide/ui/main/listing/MoviesListingContract.java | 43d26092deb93d4daefce2ad74f37e8bfb4017de | [] | no_license | dohoan259/MovieGuideMVP | 5b56cf30ad1d091b5e8b646bddd8e918d7655d6f | fd85d1ec9b86011e6cf9aac838fe6bd18c131d2a | refs/heads/master | 2021-04-09T16:11:40.954646 | 2018-03-18T15:17:48 | 2018-03-18T15:17:48 | 125,736,410 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package com.example.hoanbk.movieguide.ui.main.listing;
import com.example.hoanbk.movieguide.ui.base.IBasePresenter;
import com.example.hoanbk.movieguide.ui.base.IBaseView;
/**
* Created by HoanBK on 3/14/2018.
*/
public interface MoviesListingContract {
interface IMoviesListingView extends IBaseView{
void openLoginActivity();
}
interface IMoviesListingPresenter<V extends IMoviesListingView> extends IBasePresenter<V> {
}
}
| [
"dohoan259@gmail.com"
] | dohoan259@gmail.com |
ce7a0299f4157cfe283d505231a1a59cff93d73c | 0fa8a5255d2c298e4b3706d491f6a05760e27e09 | /app/src/main/java/com/amazonaws/mobile/content/ContentRemovedListener.java | 904ab831b151cb075a031b3ec0bd6aaab2f60fea | [] | no_license | mrsaurabh10/SocialEveningSaurabh | 449999bb8c857ee12556e4dcdd691f4ac2961074 | 959dcee0170bf1f7bdcdb5b74aae15881d581c45 | refs/heads/master | 2021-01-10T06:11:22.646626 | 2015-11-01T14:22:26 | 2015-11-01T14:22:26 | 45,343,352 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,047 | java | //
// Copyright 2015 Amazon.com, Inc. or its affiliates (Amazon). All Rights Reserved.
//
// Code generated by AWS Mobile Hub. Amazon gives unlimited permission to
// copy, distribute and modify it.
//
package com.amazonaws.mobile.content;
import java.io.File;
/** Listener for detecting content being removed due to cache pressure. */
public interface ContentRemovedListener {
/**
* Called on the main thread if an item is removed due to an item being added to the cache such
* that the cache size is exceeded.
* @param removedItem The removed file reference.
*/
void onFileRemoved(File removedItem);
/**
* Called on the main thread if there is an error removing a file from the cache. The Android
* OS does not provide an exception or reason if this error occurs, so here we only give the
* file. This should not happen unless the file system permissions have been tampered with.
*
* @param file The file that failed removal by the OS.
*/
void onRemoveError(File file);
}
| [
"saurabhgupta10@gmail.com"
] | saurabhgupta10@gmail.com |
6cd141a43c0320258f0fa2a375bc6775fe85e055 | cace1c709b227e55b008adaad1a796fc53117484 | /Lab3/ASN_LP3/src/mx/iteso/desi/cloud/hw3/ASN_HW3.java | 59f4ce261b982feadb6cd0e3c358912cba244010 | [
"MIT"
] | permissive | GalaxiasKyklos/CloudComputing | 1e8c9426b038e09d168b48dfdfd118a41857486f | 6cb8f8863b00c4ae156f274a280938b147ebeebe | refs/heads/master | 2021-03-27T15:27:22.967478 | 2018-04-15T16:00:17 | 2018-04-15T16:00:17 | 118,488,225 | 0 | 0 | null | 2018-03-19T19:28:17 | 2018-01-22T17:05:44 | Java | UTF-8 | Java | false | false | 792 | java | package mx.iteso.desi.cloud.hw3;
import org.opencv.core.Core;
public class ASN_HW3 {
public void initAuth() {
FaceAuthFrame frame;
frame = new FaceAuthFrame();
frame.setVisible(true);
}
public void initAdd() {
FaceAddFrame frame;
frame = new FaceAddFrame();
frame.setVisible(true);
}
public static void main(String[] args) {
System.load("C:\\opencv34\\opencv\\build\\java\\x64\\opencv_java341.dll");
ASN_HW3 self = new ASN_HW3();
if(args.length > 0) {
if(args[0].compareToIgnoreCase("-add")==0) {
self.initAdd();
} else {
self.initAuth();
}
} else {
self.initAuth();
}
}
}
| [
"saul_enrique-7285-96@hotmail.com"
] | saul_enrique-7285-96@hotmail.com |
7534178fc794dbfbde31c13cd8070f9f6ac4439c | 063d6a989e0ff5765ba0c64192de1b9af2824426 | /Week_01/design-circular-deque.java | adbf748844964e7c6e9e3432ff81b68a1ca0d2bd | [] | no_license | lswzzz/algorithm012 | a6e503e9fc288ab60b05b6d19ea66cdbbfbd08c7 | 51c5865a6ece9a0832c3ccbb8a5279d7a5615869 | refs/heads/master | 2022-12-13T00:41:04.561966 | 2020-09-16T07:42:53 | 2020-09-16T07:42:53 | 277,302,569 | 1 | 0 | null | 2020-07-05T12:59:05 | 2020-07-05T12:59:04 | null | UTF-8 | Java | false | false | 1,961 | java | import java.util.*;
class MyCircularDeque {
private int capacity;
private int[] array;
private int front;
private int rear;
/** Initialize your data structure here. Set the size of the deque to be k. */
public MyCircularDeque(int k) {
capacity = k + 1;
array = new int[capacity];
front = rear = 0;
}
/** Adds an item at the front of Deque. Return true if the operation is successful. */
public boolean insertFront(int value) {
if(isFull()) return false;
front = (front - 1 + capacity) % capacity;
array[front] = value;
return true;
}
/** Adds an item at the rear of Deque. Return true if the operation is successful. */
public boolean insertLast(int value) {
if(isFull()) return false;
array[rear] = value;
rear = (rear + 1) % capacity;
return true;
}
/** Deletes an item from the front of Deque. Return true if the operation is successful. */
public boolean deleteFront() {
if(isEmpty()) return false;
front = (front + 1) % capacity;
return true;
}
/** Deletes an item from the rear of Deque. Return true if the operation is successful. */
public boolean deleteLast() {
if(isEmpty()) return false;
rear = (rear - 1 + capacity) % capacity;
return true;
}
/** Get the front item from the deque. */
public int getFront() {
if(isEmpty()) return -1;
return array[front];
}
/** Get the last item from the deque. */
public int getRear() {
if(isEmpty()) return -1;
return array[(rear - 1 + capacity) % capacity];
}
/** Checks whether the circular deque is empty or not. */
public boolean isEmpty() {
return front == rear;
}
/** Checks whether the circular deque is full or not. */
public boolean isFull() {
return front == (rear + 1) % capacity;
}
} | [
"793620896@qq.com"
] | 793620896@qq.com |
460085616715c662266456e54f4ce5a46e1b41dd | 9e813a0872e330fa9a60e822763b708ef4dd8a94 | /app-server/app-user/src/main/java/com/nisum/user/controller/BaseController.java | 1a4dc21e311e79b8abe6103428d2950856d2ce4f | [] | no_license | atanveer-nisum-com/current_integration | 91dd34b1d263cedb6d9a9ca0d7a99736e284e3a3 | 3ff86ba840165da6fc3b104e80059028baf6f9cd | refs/heads/master | 2021-05-02T09:55:27.609575 | 2018-02-08T16:21:22 | 2018-02-08T16:21:22 | 120,785,029 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.nisum.user.controller;
/**
* Abstract base class for {@link Controller} implementations. Provides
* infrastructure for mapping handlers to URLs and configurable URL lookup. The
* most exact match is defined as the longest path pattern that matches the
* current request path.
*
*/
public abstract class BaseController {
/** The Constant PAGE_SIZE_12. */
final static protected int PAGE_SIZE_12 = 12;
/** The Constant PAGE_SIZE_3. */
final static protected int PAGE_SIZE_3 = 3;
}
| [
"atanveer@nisum.com"
] | atanveer@nisum.com |
bb236f1d52e1798f3c65469222d356b1fc48fa8a | 2ab03c4f54dbbb057beb3a0349b9256343b648e2 | /JavaOOPAdvanced/InterfacesAndAbstractionExercises/src/collection_hierarchy/AddRemoveCollection.java | a0e6aa1d4a96a310b8772d486724691b7ec0985b | [
"MIT"
] | permissive | tabria/Java | 8ef04c0ec5d5072d4e7bf15e372e7c2b600a1cea | 9bfc733510b660bc3f46579a1cc98ff17fb955dd | refs/heads/master | 2021-05-05T11:50:05.175943 | 2018-03-07T06:53:54 | 2018-03-07T06:53:54 | 104,714,168 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,020 | java | package collection_hierarchy;
import java.util.LinkedList;
import java.util.List;
public class AddRemoveCollection implements Addable, EndRemovable {
private List<String> addRemoveCollection;
private List<Integer> addIndexes;
public AddRemoveCollection() {
this.addRemoveCollection = new LinkedList<>();
this.addIndexes = new LinkedList<>();
}
void addIndexes(int index){
this.addIndexes.add(index);
}
void remove(int cycles){
}
@Override
public int addAtStart(String element) {
this.addRemoveCollection.add(0, element);
return 0;
}
@Override
public String removeAtEnd() {
String element = this.addRemoveCollection.get(this.addRemoveCollection.size()-1);
this.addRemoveCollection.remove(this.addRemoveCollection.size()-1);
return element;
}
@Override
public String toString() {
return this.addIndexes.toString().replace("[", "").replace("]","").replace(",", "") ;
}
}
| [
"forexftg@yahoo.com"
] | forexftg@yahoo.com |
0f1c4e432b4509bee60ffac16ed01ca2e82188be | 21f052cf7a8984601170495849f5f3786f0ddaa3 | /src/_07_abstract_class_interface/exercise/resizeable/Resizeable.java | ed1936c351ee40b0f50f51416dfec06cd2c3d3be | [] | no_license | hoangvantuong0/Ho-ng-V-n-T-ng_module2 | ad2e3634b28b4d838c5e7eb823ca00824111afb4 | 14d6859e577b0d5e2fd4f10f31b269f1f7d74184 | refs/heads/main | 2023-07-31T12:14:40.583124 | 2021-10-01T04:55:57 | 2021-10-01T04:55:57 | 402,058,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 121 | java | package _07_abstract_class_interface.exercise.resizeable;
public interface Resizeable {
void resize(double percent);
}
| [
"hoangvantuongdhqt@gmail.com"
] | hoangvantuongdhqt@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.