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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f82ff5e2ade8a48ad255f2c6aa20a84a540c4926 | 145a17175c66092c0fa8a467c02412a3a5e7aa3d | /src/main/java/hospital/Hospital.java | 1e00ef04fc554e15360ea26c8b9796ed1e88673e | [] | no_license | AlexRichards9595/hospital | 45038c3cdf320443a63b053166b770cd535c3855 | 5fdc46bf41e90e77ae27b6920f02ec1b386c4120 | refs/heads/master | 2021-05-04T04:32:00.778712 | 2018-02-06T20:20:06 | 2018-02-06T20:20:06 | 120,334,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package hospital;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
public class Hospital {
Map<String, Employee> employees = new HashMap<>();
public void addEmployee(Employee employee) {
employees.put(employee.empNumber, employee);
}
public Collection<Employee> getAllEmployees() {
return employees.values();
}
public void showPayRates() {
for (Employee employee : employees.values()) {
System.out.println(employee.getEmpName() + " " + employee.getSalary());
;
}
}
public void showAllMedicalPersonnel() {
for (Employee employee : employees.values()) {
if (employee instanceof MedicalDuties) {
System.out.println(employee);
}
}
}
public void removeEmployee(String empNumber) {
employees.remove(empNumber);
}
}
| [
"wcadidas15@gmail.com"
] | wcadidas15@gmail.com |
f56cb3f947b86369531945f67f6a8bcc4216d6fc | 7962de4664f2850e734c4194662b7999e3ad4871 | /AreaCalculator/src/Main.java | e374b7d13c2e4d638f245e4aadad95f3531f0697 | [] | no_license | ckomopou/JAVA | d72a329b2423251845390717934b09381423829e | c9209eb35f457704216305eebd0c71a56b0b5254 | refs/heads/main | 2023-05-09T22:39:02.834435 | 2021-06-10T09:55:48 | 2021-06-10T09:55:48 | 329,882,170 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | public class Main {
public static void main(String[] args) {
double result = AreaCalculator.area(-1);
System.out.println(result);
double result2 = AreaCalculator.area(2, 4);
System.out.println(result2);
}
}
| [
"ckomopou@redhat.com"
] | ckomopou@redhat.com |
d3f88d70dd6befa034740255387160a11cabd6e5 | 28c9ea70c846d131c0e2868ebbd034d678caf1b2 | /src/main/java/com/amazon/opendistroforelasticsearch/sql/query/join/ESJoinQueryActionFactory.java | c6979bf65e7a22bc542b5749d53d2bcb6f4c8a99 | [
"Apache-2.0"
] | permissive | allwinsr/sql | 124b9629470b66924782e43dc691caad734513b8 | 10808c8fb13511adeaa274ccbea7d47b05ac7780 | refs/heads/master | 2020-06-29T01:00:34.396279 | 2019-08-01T20:45:52 | 2019-08-01T20:45:52 | 200,393,021 | 1 | 0 | Apache-2.0 | 2019-08-03T15:46:12 | 2019-08-03T15:46:12 | null | UTF-8 | Java | false | false | 2,100 | java | /*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazon.opendistroforelasticsearch.sql.query.join;
import com.amazon.opendistroforelasticsearch.sql.domain.Condition;
import com.amazon.opendistroforelasticsearch.sql.domain.JoinSelect;
import com.amazon.opendistroforelasticsearch.sql.domain.hints.Hint;
import com.amazon.opendistroforelasticsearch.sql.domain.hints.HintType;
import org.elasticsearch.client.Client;
import com.amazon.opendistroforelasticsearch.sql.query.QueryAction;
import java.util.List;
/**
* Created by Eliran on 15/9/2015.
*/
public class ESJoinQueryActionFactory {
public static QueryAction createJoinAction(Client client, JoinSelect joinSelect) {
List<Condition> connectedConditions = joinSelect.getConnectedConditions();
boolean allEqual = true;
for (Condition condition : connectedConditions) {
if (condition.getOpear() != Condition.OPEAR.EQ) {
allEqual = false;
break;
}
}
if (!allEqual)
return new ESNestedLoopsQueryAction(client, joinSelect);
boolean useNestedLoopsHintExist = false;
for (Hint hint : joinSelect.getHints()) {
if (hint.getType() == HintType.USE_NESTED_LOOPS) {
useNestedLoopsHintExist = true;
break;
}
}
if (useNestedLoopsHintExist)
return new ESNestedLoopsQueryAction(client, joinSelect);
return new ESHashJoinQueryAction(client, joinSelect);
}
}
| [
"daichen@amazon.com"
] | daichen@amazon.com |
ef3eed1668e2874d68f5b3719bab51194141ac5e | 0a0752dd39277c619e8c89823632b0757d5051f3 | /pi_bench/video/adapt/video/Main.java | c8b88e1b512850c021677ab657e3d1ffa2213bdf | [] | no_license | anthonycanino1/entbench | fc5386f6806124a13059a1d7f21ba1128af7bb19 | 3c664cc693d4415fd8367c8307212d5aa2f3ae68 | refs/heads/master | 2021-01-10T13:49:12.811846 | 2016-11-14T21:57:38 | 2016-11-14T21:57:38 | 52,231,403 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,741 | java | package video;
modes {low <: mid; mid <: high; };
public class Main@mode<?->X> {
int width = 0;
int height = 0;
public Main(int width, int height) {
this.width = width;
this.height = height;
}
attributor {
if (ENT_Util.Battery.percentRemaining() >= 0.75) {
return @mode<high>;
} else if (ENT_Util.Battery.percentRemaining() >= 0.50) {
return @mode<mid>;
} else {
return @mode<low>;
}
}
mcase<int> vidFreq = mcase<int> {
low: 10;
mid: 20;
high: 30;
};
public void execute(int timeout) {
try {
RaspiVid video = new RaspiVid();
video.TakeVideo("vid.mp4", this.width, this.height, this.vidFreq, timeout);
} catch (Exception e) {
System.exit(e.hashCode());
}
}
public static void main(String[] args) {
if (args.length < 2) {
System.err.format("usage: [WIDTH] [HEIGHT]\n", args[0]);
System.exit(1);
}
int width = Integer.parseInt(args[0]);
int height = Integer.parseInt(args[1]);
ENT_Util.initModeFile();
int PANDA_RUNS = Integer.parseInt(System.getenv("PANDA_RUNS"));
Main@mode<?> maindyn = new Main@mode<?>(width, height);
Main@mode<*> main = snapshot maindyn ?mode[@mode<low>,@mode<high>];
System.err.format("Starting warmup\n");
main.execute(30000);
System.out.format("Done with warmup\n");
for (int k = 0; k < PANDA_RUNS; k++) {
try {
Thread.sleep(5000);
} catch (Exception e) {
System.err.println(e);
}
Main@mode<?> maindyn2 = new Main@mode<?>(width, height);
Main@mode<*> main2 = snapshot maindyn2 ?mode[@mode<low>,@mode<high>];
System.err.format("Starting main %d\n", k);
main2.execute(60000);
System.err.format("Finished main %d\n", k);
}
ENT_Util.closeModeFile();
}
}
| [
"anthony.canino1@gmail.com"
] | anthony.canino1@gmail.com |
8bd52ac8f9327d3917a7a0c10636066ef10e4314 | d56baeedcbf657eb065a591673020db3c73a6668 | /app/src/main/java/com/example/administrator/caidaomvp/FragmentPresenter/HomeView_commPresenter.java | fc0345870ad0cc7cf824b2bdcac941cd6a5c3efb | [] | no_license | shielwen/caidaoMVP | bbda038af1ff42297fbb3ce89c7452184d77f41d | 96e0f8ba0e726de8ab34549d239fc60dd0c0470d | refs/heads/master | 2020-05-29T13:52:00.660390 | 2019-05-29T07:43:18 | 2019-05-29T07:43:18 | 187,933,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,045 | java | package com.example.administrator.caidaomvp.FragmentPresenter;
import com.example.administrator.caidaomvp.FragmentView.HomeView_comm;
import com.example.administrator.caidaomvp.Model.VideoModel;
import com.example.administrator.caidaomvp.WebHttp.HttpUtil;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2019/5/27 0027.
*/
public class HomeView_commPresenter {
private HomeView_comm mhomeView_comm;
private List<VideoModel> mlist;
public HomeView_commPresenter(HomeView_comm homeView_comm){
this.mhomeView_comm=homeView_comm;
mlist=new ArrayList<>();
}
public void initData(){
VideoModel videoModel=new VideoModel();
videoModel.setImage(HttpUtil.ip + "/img/img1.jpg");
videoModel.setTitle("123456");
videoModel.setUrl("video");
mlist.add(videoModel);
mlist.add(videoModel);
mlist.add(videoModel);
mlist.add(videoModel);
mlist.add(videoModel);
mhomeView_comm.initAdapter(mlist);
}
}
| [
"shieldwen@163.com"
] | shieldwen@163.com |
78b8b06d52b19f54853cd9591fd3e352a159c24c | bc32b189f28474492cceb24afe8ceb60081d0754 | /src/ch02/face/FaceComponent.java | 605e434ec582647b8edadce1d41ba88240ac34cd | [
"MIT"
] | permissive | raeffu/prog1 | 3e8cd444d9709df2e9c192fd0d6b0551ce6a7ce1 | b8014a1af972308572495c3d33a1f4ac159929b6 | refs/heads/master | 2020-06-04T10:06:13.464856 | 2014-01-26T19:46:50 | 2014-01-26T19:46:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 974 | java | package ch02.face;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Line2D;
import javax.swing.JComponent;
/*
A component that draws an alien face
*/
public class FaceComponent extends JComponent
{
public void paintComponent(Graphics g)
{
// Recover Graphics2D
Graphics2D g2 = (Graphics2D) g;
// Draw the head
Ellipse2D.Double head = new Ellipse2D.Double(5, 10, 100, 150);
g2.draw(head);
// Draw the eyes
g2.setColor(Color.GREEN);
Rectangle eye = new Rectangle(25, 70, 15, 15);
g2.fill(eye);
eye.translate(50, 0);
g2.fill(eye);
// Draw the mouth
Line2D.Double mouth = new Line2D.Double(30, 110, 80, 110);
g2.setColor(Color.RED);
g2.draw(mouth);
// Draw the greeting
g2.setColor(Color.BLUE);
g2.drawString("Hello, World!", 5, 175);
}
}
| [
"raeffu@raeffu.ch"
] | raeffu@raeffu.ch |
f4172f11e86edb18c0f8c66e51d2a4faddc6874a | b5e07769e36f3e519d569fb222d5071b433344eb | /src/main/java/cyan/simple/pgsql/service/ThingService.java | a70b63222d7a3be81a0eef32400e27af38b18c01 | [
"Apache-2.0"
] | permissive | Cyanss/pgsql-simple | 9096a4897d5c3b060a6e8a9c1ae16e75c67b85d9 | a6c695c5a7397cb1c1d638423eab00f12a3acc4b | refs/heads/main | 2023-06-09T18:07:13.218371 | 2021-05-31T02:28:40 | 2021-05-31T02:28:40 | 372,353,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,164 | java | package cyan.simple.pgsql.service;
import cyan.simple.pgsql.error.PgsqlException;
import cyan.simple.pgsql.filter.JsonbFilter;
import cyan.simple.pgsql.model.RestPage;
import cyan.simple.pgsql.model.Thing;
import java.util.Collection;
import java.util.List;
/**
* <p>ThingService</p>
* @author Cyan (snow22314@outlook.com)
* @version V.0.0.1
* @group cyan.tool.kit
* @date 17:41 2021/5/7
*/
public interface ThingService {
/**
* 单个保存
* @param model 对象信息
* @return M 创建的对象
* @throws PgsqlException 模块异常
*/
Thing save(Thing model) throws PgsqlException;
/**
* 批量保存(存在更新,不存在新增)
* @param modelList 对象信息集合
* @return List<M> 更新的对象
* @throws PgsqlException 模块异常
*/
List<Thing> saveAll(Collection<Thing> modelList) throws PgsqlException;
/**
* 通过id集合批量删除
* @param idList 对象的id集合
* @throws PgsqlException 模块异常
*/
void deleteAll(Collection<Long> idList) throws PgsqlException;
/**
* 通过id单个删除
* @param id 对象的id
* @throws PgsqlException 模块异常
*/
void deleteById(Long id) throws PgsqlException;
/**
* 通过id集合查询所有
* @param idList 对象id集合
* @return List<M> 查询的数据
* @throws PgsqlException 模块异常
*/
List<Thing> queryAll(Collection<Long> idList) throws PgsqlException;
/**
* 通过id集合查询单个
* @param id 对象id
* @return M 查询的对象
* @throws PgsqlException 模块异常
*/
Thing queryById(Long id) throws PgsqlException;
/**
* 通过过滤器查询
* @param filter 过滤器
* @return GxPage<M> 查询的数据(分页)
* @throws PgsqlException 模块异常
*/
RestPage<Thing> queryAllWithFilter(JsonbFilter filter) throws PgsqlException;
/**
* 通过过滤器删除
* @param filter 过滤器
* @throws PgsqlException 模块异常
*/
void deleteAllWithFilter(JsonbFilter filter) throws PgsqlException;
}
| [
"snow22314@outlook.com"
] | snow22314@outlook.com |
5c66c8c3fd3f1222195c971e1bb3002cb5b513f9 | e8a27da3717b79d66165a4c8d76cec870c619745 | /lbi_test1/src/org/letsbuyindian/lbi_test1/personals.java | 1bba1034b169761856d9a2c8e06b1437c04333a5 | [] | no_license | rajesh3439/letsbuyindian | 655ea214cc1f4c15dfa3e6a949ce48b96694dddf | 05da0d9a8299e1372f69c710312cdab330d5e972 | refs/heads/master | 2021-05-30T06:14:54.113629 | 2014-12-04T13:06:41 | 2014-12-04T13:06:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package org.letsbuyindian.lbi_test1;
import java.util.List;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class personals extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.personals_layout);
Button btn_p_baby = (Button) findViewById(R.id.btn_p_baby);
btn_p_baby.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getApplicationContext(), ProductList.class);
i.putExtra("cat", "cat" );
startActivity(i);
}
});
}
}
| [
"arunbluez@gmail.com"
] | arunbluez@gmail.com |
d5495edfc22aef47f2cf1c4f6d155459ed79e570 | 697e8d0a012693876df14ce2440b42d7818149ac | /XChange-develop/xchange-clevercoin/src/main/java/com/xeiam/xchange/clevercoin/dto/marketdata/CleverCoinTransaction.java | 2d5c6723d60aa054041de195bdd8de64ebef3f49 | [
"MIT"
] | permissive | tochkov/coin-eye | 0bdadf195408d77dda220d6558ebc775330ee75c | f04bb141cab3a04d348b04bbf9f00351176bb8d3 | refs/heads/master | 2021-01-01T04:26:00.984029 | 2016-04-15T14:22:17 | 2016-04-15T14:22:17 | 56,127,186 | 2 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,525 | java | package com.xeiam.xchange.clevercoin.dto.marketdata;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* @author Karsten Nilsen
*/
public class CleverCoinTransaction {
private final long date;
private final int tid;
private final BigDecimal price;
private final BigDecimal amount;
/**
* Constructor
*
* @param date Unix timestamp date and time
* @param tid Transaction id
* @param price BTC price
* @param amount BTC amount
*/
public CleverCoinTransaction(@JsonProperty("date") long date, @JsonProperty("tid") int tid, @JsonProperty("price") BigDecimal price,
@JsonProperty("amount") BigDecimal amount) {
this.date = date;
this.tid = tid;
this.price = price;
this.amount = amount;
}
public int getTid() {
return tid;
}
public BigDecimal getPrice() {
return price;
}
public BigDecimal getAmount() {
return amount;
}
public long getDate() {
return date;
}
public BigDecimal calculateFeeBtc() {
return roundUp(amount.multiply(new BigDecimal(.5))).divide(new BigDecimal(100.));
}
private BigDecimal roundUp(BigDecimal x) {
long n = x.longValue();
return new BigDecimal(x.equals(new BigDecimal(n)) ? n : n + 1);
}
public BigDecimal calculateFeeUsd() {
return calculateFeeBtc().multiply(price);
}
@Override
public String toString() {
return "Transaction [date=" + date + ", tid=" + tid + ", price=" + price + ", amount=" + amount + "]";
}
}
| [
"philip.tochkov@gmail.com"
] | philip.tochkov@gmail.com |
1116a5ea1e33774c59df07a87e13e794cf13f99c | c29f31c61022157be8f1b1aaed63ed47e93c9c9b | /src/test/java/ru/javawebinar/topjava/service/jpa/JpaMealServiceTest.java | 456c6e7486f8a4831e3e714b33e650d3dc4d13cc | [] | no_license | kastiel-404/topjava-1 | ef44df7fb16c24b5f829d0b5c64a220df4c7c823 | 008c5fe64f4e5f12f32a33d1a9678e3dad9a5bc9 | refs/heads/master | 2020-05-17T04:22:46.150215 | 2019-10-02T22:57:46 | 2019-10-02T22:57:46 | 183,507,242 | 0 | 0 | null | 2019-04-25T20:45:25 | 2019-04-25T20:45:24 | null | UTF-8 | Java | false | false | 307 | java | package ru.javawebinar.topjava.service.jpa;
import org.springframework.test.context.ActiveProfiles;
import ru.javawebinar.topjava.service.AbstractMealServiceTest;
import static ru.javawebinar.topjava.Profiles.JPA;
@ActiveProfiles(JPA)
public class JpaMealServiceTest extends AbstractMealServiceTest {
}
| [
"kastiel404@gmail.com"
] | kastiel404@gmail.com |
fb89daab5164e52582d579a04a2c4433ba469b4b | 33867238a41fbdf22714a5846d66a57e002d1bfd | /app/src/main/java/com/capricot/fieldprocustomer/Pref_storage.java | 627e49e3fb94dd558286b05cb915efae1a9c0189 | [] | no_license | vijivenket/FieldProCus | cc26db4a49f953beb900b0c4aeed2b88d2057ce3 | af60c162ee783abf48f8f64081c1b9ec612ed5e3 | refs/heads/master | 2020-04-29T22:19:11.448511 | 2019-06-14T13:19:08 | 2019-06-14T13:19:08 | 176,443,425 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,950 | java | package com.capricot.fieldprocustomer;
import android.content.Context;
import android.content.SharedPreferences;
import java.util.HashMap;
import java.util.Map;
/**
* Created by ansari on 2/2/17.
*/
public class Pref_storage {
private static SharedPreferences sharedPreferences = null;
public static void openPref(Context context)
{
try {
sharedPreferences = context.getSharedPreferences("Entry000123", Context.MODE_PRIVATE);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public static void deleteKey(Context context, String key)
{
HashMap<String, String> result = new HashMap<String, String>();
Pref_storage.openPref(context);
for (Map.Entry<String, ?> entry : Pref_storage.sharedPreferences.getAll().entrySet())
{
result.put(entry.getKey(), (String) entry.getValue());
}
boolean b = result.containsKey(key);
if (b)
{
Pref_storage.openPref(context);
SharedPreferences.Editor prefsPrivateEditor = Pref_storage.sharedPreferences.edit();
prefsPrivateEditor.remove(key);
prefsPrivateEditor.apply();
prefsPrivateEditor = null;
Pref_storage.sharedPreferences = null;
}
}
public static void setDetail(Context context, String key, String value)
{
try {
Pref_storage.openPref(context);
SharedPreferences.Editor prefsPrivateEditor = Pref_storage.sharedPreferences.edit();
prefsPrivateEditor.putString(key, value);
prefsPrivateEditor.apply();
prefsPrivateEditor = null;
Pref_storage.sharedPreferences = null;
}
catch (Exception e)
{
}
}
public static Boolean checkDetail(Context context, String key)
{
HashMap<String, String> result = new HashMap<String, String>();
Pref_storage.openPref(context);
for (Map.Entry<String, ?> entry : Pref_storage.sharedPreferences.getAll().entrySet())
{
result.put(entry.getKey(), (String) entry.getValue());
}
boolean b = result.containsKey(key);
return b;
}
public static String getDetail(Context context, String key)
{
HashMap<String, String> result = new HashMap<String, String>();
Pref_storage.openPref(context);
for (Map.Entry<String, ?> entry : Pref_storage.sharedPreferences.getAll().entrySet())
{
result.put(entry.getKey(), (String) entry.getValue());
}
String b = result.get(key);
return b;
}
}
| [
"foodwall@kaspontech.com"
] | foodwall@kaspontech.com |
43189f5befda4cdd5b7ca39f569c50ac61a225ef | da9b0db05f0729edd51367c6e0700f78f6037900 | /src/Java/Customer.java | dff14acecf2ab6e4bd7060a228467274596f93bb | [] | no_license | mcsantana/GymDemo | 86a73109820df7a4c62d2a562976d4e79a19d859 | 9a8e4df5a679526bfd1020960e2f9c2efd71b6ae | refs/heads/master | 2023-01-06T06:20:09.676207 | 2020-10-16T09:00:03 | 2020-10-16T09:00:03 | 304,366,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 825 | java | package Java;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* created by Mimi Santana
* Date: 2020-10-13
* Time: 22:10
* Project: GymDemo
* Copyright: MIT
*/
public class Customer {
private String personID;
private String name;
private LocalDate lastPayment;
public Customer() {
}
public Customer(String personID, String name, LocalDate lastPayment) {
this.personID = personID;
this.name = name;
this.lastPayment = lastPayment;
}
public String getPersonID() {
return personID;
}
public String getName() {
return name;
}
public LocalDate getLastPayment() {
return lastPayment;
}
}
| [
"mdeverdier@gmail.com"
] | mdeverdier@gmail.com |
28d62983ad207f8a903ec017c534a122c715aa27 | a9ca6716a8b6d5e3472bc0585ef098e77101b244 | /src/main/java/com/superexercisebook/justchat/client/Client.java | 48c9982934d1b06e8f8191a28b675c13ee64e0b2 | [] | no_license | ParaParty/JustChat_Sponge | f04b2fdb66ed9e56320ccda946631f405145da9f | 2ca87fb0512eb9c25d47fcb2c1fca82cf6137429 | refs/heads/master | 2022-04-09T16:00:23.523738 | 2020-03-07T15:33:04 | 2020-03-07T15:33:04 | 169,339,158 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,609 | java | package com.superexercisebook.justchat.client;
import com.superexercisebook.justchat.GlobalState;
import com.xuhao.didi.socket.client.sdk.OkSocket;
import com.xuhao.didi.socket.client.sdk.client.ConnectionInfo;
import com.xuhao.didi.socket.client.sdk.client.OkSocketOptions;
import com.xuhao.didi.socket.client.sdk.client.connection.IConnectionManager;
public class Client extends Thread {
public IConnectionManager clientManager;
public Client() {
}
@Override
public void run() {
ConnectionInfo info = new ConnectionInfo(GlobalState.config.getGeneral().server().ip(), GlobalState.config.getGeneral().server().port());
GlobalState.logger.info("Target server: " + GlobalState.config.getGeneral().server().ip() + ":" + GlobalState.config.getGeneral().server().port());
clientManager = OkSocket.open(info);
OkSocketOptions.Builder okOptionsBuilder = new OkSocketOptions.Builder();
okOptionsBuilder.setReaderProtocol(new ProtocolDefinition());
clientManager.option(okOptionsBuilder.build());
clientManager.getReconnectionManager().addIgnoreException(ReloadException.class);
MessageHandler justChatClientHandler = new MessageHandler(clientManager, okOptionsBuilder);
clientManager.registerReceiver(justChatClientHandler);
clientManager.connect();
}
public void updateConfig() {
ConnectionInfo info = new ConnectionInfo(GlobalState.config.getGeneral().server().ip(), GlobalState.config.getGeneral().server().port());
clientManager.disconnect(new ReloadException(info));
}
}
| [
"git@SuperExerciseBook.com"
] | git@SuperExerciseBook.com |
710db75b0079449836fdb03b341c68be6731b7cb | 4b6448ed9f7306c33d895c2a021779013d349418 | /src/main/java/com/siberhus/commons/converter/SqlDateTypeConverter.java | 0c6b6e2d673a56d5deaeab9576acf78b78500779 | [] | no_license | hussachai/siberhus-commons | e6e449916adc4ef53a4fa1259ee5428d47b0e4c9 | 4bdc9f5a84e85f6c23357ce75faa5e9b72bf04e7 | refs/heads/master | 2016-09-06T20:15:25.034046 | 2012-11-27T05:12:26 | 2012-11-27T05:12:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,023 | java |
package com.siberhus.commons.converter;
import java.sql.Date;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;
public class SqlDateTypeConverter implements ITypeConverter<Date> {
private Locale locale;
private DateFormat[] formats;
public void setLocale(Locale locale) {
this.locale = locale;
this.formats = getDateFormats();
}
/** The default set of date patterns used to parse dates with SimpleDateFormat. */
private String[] formatStrings = new String[] {
"dd/MM/yyyy"
};
public void setFormatStrings(String[] formatStrings){
this.formatStrings = formatStrings;
}
public String[] getFormatStrings() {
return formatStrings;
}
protected DateFormat[] getDateFormats() {
String[] formatStrings = getFormatStrings();
SimpleDateFormat[] dateFormats = new SimpleDateFormat[formatStrings.length];
// First create the ones from the format Strings
for (int i=0; i<formatStrings.length; ++i) {
dateFormats[i] = new SimpleDateFormat(formatStrings[i], locale);
dateFormats[i].setLenient(false);
}
return dateFormats;
}
public Date convert(String input) throws ConvertException{
return convert(input,Date.class);
}
public Date convert(String input,
Class<? extends Date> targetType) throws ConvertException {
java.util.Date date = null;
for (DateFormat format : this.formats) {
try {
date = format.parse(input);
break;
}
catch (ParseException pe) { /* Do nothing, we'll get lots of these. */ }
}
if (date != null) {
return new Date(date.getTime());
}
else {
throw new ConvertException("invalidDate");
}
}
}
| [
"hussachai@gmail.com"
] | hussachai@gmail.com |
66e3909d3eac375dd428d73d1ddce6e82048007a | b79f76836f9ccff6f7706e58456e2b10f79f7a5f | /src/me/wokis/oposiciones/gfx/Preguntas.java | 775f1d6d143b8fb0ffee1c8cbadab93ebff5d316 | [] | no_license | Wikijito7/oposiciones | dc015f8e5617303e6f5bbc344dfe9e9b7f254d1c | 86d1a186de872de769096279c29c356c6706bbf8 | refs/heads/master | 2022-05-27T13:54:16.013274 | 2021-02-14T10:30:47 | 2021-02-14T10:30:47 | 215,028,513 | 0 | 0 | null | 2022-05-20T21:12:21 | 2019-10-14T11:41:35 | Java | UTF-8 | Java | false | false | 4,977 | java | package me.wokis.oposiciones.gfx;
import me.wokis.oposiciones.Oposiciones;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
public class Preguntas extends JFrame {
private Oposiciones main;
public Preguntas(Oposiciones instance){
this.main = instance;
}
private int x = 10, width = 570, y = 15, puntuacion = -1;
private final ButtonGroup rGroup = new ButtonGroup();
private JRadioButton[] radioButtons = new JRadioButton[4];
private JTextArea area;
private JComboBox<String> preguntaCB, tipopreguntaCB;
private JButton btnCont, finBtn;
private JLabel rlabel;
private ArrayList<String> tipos = new ArrayList<>();
public void confVent(){
main.setTitle("Oposiciones Mecánicos");
main.setFocusable(true);
main.setBounds(50,50,600,900);
main.setLayout(null);
main.setResizable(false);
main.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
registerJThingies();
}
private void registerJThingies() {
JLabel tipoPreguntaLbl = new JLabel();
tipoPreguntaLbl.setText("Tipo de pregunta:");
tipoPreguntaLbl.setBounds(x, y, width, 30);
tipopreguntaCB = new JComboBox<>();
main.archivos.loadFilesFromLocal().forEach(e->{
if (!tipos.contains(e.getType())){
tipos.add(e.getType());
tipopreguntaCB.addItem(e.getType());
}
});
tipopreguntaCB.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
preguntaCB.removeAllItems();
main.archivos.loadFilesFromLocal().stream().filter(b -> b.getType().equals(tipopreguntaCB.getSelectedItem())).forEach(g-> preguntaCB.addItem(g.getPregunta()));
}
});
tipopreguntaCB.setBounds(x, y + 30, width/3, 30);
area = new JTextArea();
area.setBounds(x,y + 210, width, 200);
area.setLineWrap(true);
area.setBorder(new LineBorder(Color.black));
preguntaCB = new JComboBox<>();
//preguntaCB.setBorder(new LineBorder(Color.black));
preguntaCB.setBounds(x, y + 90, width, 30);
JLabel preguntaLbl = new JLabel();
preguntaLbl.setText("Pregunta:");
preguntaLbl.setBounds(x, y + 60, width, 30);
JLabel obslabel = new JLabel();
obslabel.setText("Observaciones:");
obslabel.setBounds(x, y + 180, width, 30);
rlabel = new JLabel();
rlabel.setText("Puntación:");
rlabel.setBounds(x, y + 120, width, 30);
btnCont = new JButton("Siguiente pregunta");
btnCont.setBounds(main.getWidth()/2 - 255, 500, 200, 50);
btnCont.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
guardarPregunta();
}
});
finBtn = new JButton("Finalizar");
finBtn.setBounds(main.getWidth()/2 + 50, 500, 200, 50);
finBtn.setVisible(false);
finBtn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
guardarPregunta();
main.fileManager.checkFile();
}
});
for(int b = 0; b < 4; b++){
radioButtons[b] = new JRadioButton(Integer.toString(b));
JRadioButton r1 = radioButtons[b];
r1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
puntuacion = Integer.parseInt(r1.getText());
}
});
r1.setBounds(x + 40*b, y + 150, 40, 30);
rGroup.add(r1);
main.add(r1);
}
main.add(tipoPreguntaLbl);
main.add(tipopreguntaCB);
main.add(preguntaLbl);
main.add(rlabel);
main.add(preguntaCB);
main.add(obslabel);
main.add(area);
main.add(btnCont);
main.add(finBtn);
}
private void guardarPregunta(){
if(puntuacion == -1) {
rlabel.setForeground(Color.red);
System.out.println("No hay puntuacion escrita");
return;
}
String[] textarea = area.getText().split("\n");
String obs = "";
for(int r = 0; r < textarea.length; r++){
if(r == 0) obs = textarea[r];
else obs = obs + "/" + textarea[r];
}
/*main.data.respuestas.add(preguntaTF.getText() + ", " + puntuacion + ", " + obs);
System.out.println(preguntaTF.getText() + ", " + puntuacion + ", " + obs);
preguntaTF.setBorder(new LineBorder(Color.black));
rlabel.setForeground(Color.black);
preguntaTF.setText("");*/
area.setText("");
rGroup.clearSelection();
finBtn.setVisible(true);
}
}
| [
"wikyfg@gmail.com"
] | wikyfg@gmail.com |
3d31c5a845fc7e30f70a20a16d83387947495336 | c9ff4c7d1c23a05b4e5e1e243325d6d004829511 | /aws-java-sdk-iot/src/main/java/com/amazonaws/services/iot/model/SearchIndexResult.java | 8580b54293e7504c96bd0cc6fe9b6986d2b390f6 | [
"Apache-2.0"
] | permissive | Purushotam-Thakur/aws-sdk-java | 3c5789fe0b0dbd25e1ebfdd48dfd71e25a945f62 | ab58baac6370f160b66da96d46afa57ba5bdee06 | refs/heads/master | 2020-07-22T23:27:57.700466 | 2019-09-06T23:28:26 | 2019-09-06T23:28:26 | 207,350,924 | 1 | 0 | Apache-2.0 | 2019-09-09T16:11:46 | 2019-09-09T16:11:45 | null | UTF-8 | Java | false | false | 9,040 | java | /*
* Copyright 2014-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.iot.model;
import java.io.Serializable;
import javax.annotation.Generated;
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class SearchIndexResult extends com.amazonaws.AmazonWebServiceResult<com.amazonaws.ResponseMetadata> implements Serializable, Cloneable {
/**
* <p>
* The token used to get the next set of results, or null if there are no additional results.
* </p>
*/
private String nextToken;
/**
* <p>
* The things that match the search query.
* </p>
*/
private java.util.List<ThingDocument> things;
/**
* <p>
* The thing groups that match the search query.
* </p>
*/
private java.util.List<ThingGroupDocument> thingGroups;
/**
* <p>
* The token used to get the next set of results, or null if there are no additional results.
* </p>
*
* @param nextToken
* The token used to get the next set of results, or null if there are no additional results.
*/
public void setNextToken(String nextToken) {
this.nextToken = nextToken;
}
/**
* <p>
* The token used to get the next set of results, or null if there are no additional results.
* </p>
*
* @return The token used to get the next set of results, or null if there are no additional results.
*/
public String getNextToken() {
return this.nextToken;
}
/**
* <p>
* The token used to get the next set of results, or null if there are no additional results.
* </p>
*
* @param nextToken
* The token used to get the next set of results, or null if there are no additional results.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchIndexResult withNextToken(String nextToken) {
setNextToken(nextToken);
return this;
}
/**
* <p>
* The things that match the search query.
* </p>
*
* @return The things that match the search query.
*/
public java.util.List<ThingDocument> getThings() {
return things;
}
/**
* <p>
* The things that match the search query.
* </p>
*
* @param things
* The things that match the search query.
*/
public void setThings(java.util.Collection<ThingDocument> things) {
if (things == null) {
this.things = null;
return;
}
this.things = new java.util.ArrayList<ThingDocument>(things);
}
/**
* <p>
* The things that match the search query.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setThings(java.util.Collection)} or {@link #withThings(java.util.Collection)} if you want to override the
* existing values.
* </p>
*
* @param things
* The things that match the search query.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchIndexResult withThings(ThingDocument... things) {
if (this.things == null) {
setThings(new java.util.ArrayList<ThingDocument>(things.length));
}
for (ThingDocument ele : things) {
this.things.add(ele);
}
return this;
}
/**
* <p>
* The things that match the search query.
* </p>
*
* @param things
* The things that match the search query.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchIndexResult withThings(java.util.Collection<ThingDocument> things) {
setThings(things);
return this;
}
/**
* <p>
* The thing groups that match the search query.
* </p>
*
* @return The thing groups that match the search query.
*/
public java.util.List<ThingGroupDocument> getThingGroups() {
return thingGroups;
}
/**
* <p>
* The thing groups that match the search query.
* </p>
*
* @param thingGroups
* The thing groups that match the search query.
*/
public void setThingGroups(java.util.Collection<ThingGroupDocument> thingGroups) {
if (thingGroups == null) {
this.thingGroups = null;
return;
}
this.thingGroups = new java.util.ArrayList<ThingGroupDocument>(thingGroups);
}
/**
* <p>
* The thing groups that match the search query.
* </p>
* <p>
* <b>NOTE:</b> This method appends the values to the existing list (if any). Use
* {@link #setThingGroups(java.util.Collection)} or {@link #withThingGroups(java.util.Collection)} if you want to
* override the existing values.
* </p>
*
* @param thingGroups
* The thing groups that match the search query.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchIndexResult withThingGroups(ThingGroupDocument... thingGroups) {
if (this.thingGroups == null) {
setThingGroups(new java.util.ArrayList<ThingGroupDocument>(thingGroups.length));
}
for (ThingGroupDocument ele : thingGroups) {
this.thingGroups.add(ele);
}
return this;
}
/**
* <p>
* The thing groups that match the search query.
* </p>
*
* @param thingGroups
* The thing groups that match the search query.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public SearchIndexResult withThingGroups(java.util.Collection<ThingGroupDocument> thingGroups) {
setThingGroups(thingGroups);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getNextToken() != null)
sb.append("NextToken: ").append(getNextToken()).append(",");
if (getThings() != null)
sb.append("Things: ").append(getThings()).append(",");
if (getThingGroups() != null)
sb.append("ThingGroups: ").append(getThingGroups());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof SearchIndexResult == false)
return false;
SearchIndexResult other = (SearchIndexResult) obj;
if (other.getNextToken() == null ^ this.getNextToken() == null)
return false;
if (other.getNextToken() != null && other.getNextToken().equals(this.getNextToken()) == false)
return false;
if (other.getThings() == null ^ this.getThings() == null)
return false;
if (other.getThings() != null && other.getThings().equals(this.getThings()) == false)
return false;
if (other.getThingGroups() == null ^ this.getThingGroups() == null)
return false;
if (other.getThingGroups() != null && other.getThingGroups().equals(this.getThingGroups()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getNextToken() == null) ? 0 : getNextToken().hashCode());
hashCode = prime * hashCode + ((getThings() == null) ? 0 : getThings().hashCode());
hashCode = prime * hashCode + ((getThingGroups() == null) ? 0 : getThingGroups().hashCode());
return hashCode;
}
@Override
public SearchIndexResult clone() {
try {
return (SearchIndexResult) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
}
| [
""
] | |
927211aac23501b61c5248e0ae291375af97bef7 | c098dc33dd329932c4295ae4526e8e0b0725b276 | /service/service_test/src/main/java/com/yang/mvntest/dao/HbaseDao.java | becc532ee15ea15d3025e43baa12d63586526a79 | [] | no_license | yangwbud/guli_parent | b566fc98decc59183c9f8f6c155cd06a748584d1 | 9087cfac5557b8489876a0444ac5b9163e6ee3ec | refs/heads/master | 2022-07-15T11:21:28.350192 | 2020-03-31T23:39:12 | 2020-03-31T23:39:12 | 250,969,732 | 0 | 0 | null | 2022-06-17T03:04:18 | 2020-03-29T06:35:10 | Java | UTF-8 | Java | false | false | 92 | java | package com.yang.mvntest.dao;
public interface HbaseDao {
String add(Integer id);
}
| [
"li4@125.com"
] | li4@125.com |
168e60fa96e0eefa244e5779b713d5c9534eb420 | 48f4703f92bde679a4573ba54ccd8fa38ce0d19c | /src/it/polito/TdP/DAO/DBConnect.java | 0f2730d04a6a83384e68d13c12c8aac9dc199e9a | [] | no_license | tanymanera/Country-Borders | 5c324ad91658716484580b5abc3af9e2c6037119 | fc849c5a8c4fdba97cd310cfa3c25c902c83a908 | refs/heads/master | 2020-03-29T17:22:09.909774 | 2018-10-04T16:48:18 | 2018-10-04T16:48:18 | 150,158,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 899 | java | package it.polito.TdP.DAO;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
import com.mchange.v2.c3p0.DataSources;
public class DBConnect {
private static String jdbcURL = "jdbc:mysql://localhost/countries?user=root&password=root";
private static DataSource ds;
public static Connection getConnection() {
if(ds==null) {
// initialize DataSource
try {
ds = DataSources.pooledDataSource(DataSources.unpooledDataSource(jdbcURL));
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.exit(1);
}
}
try {
Connection c = ds.getConnection() ;
return c;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
}
| [
"gaetanomanera@outlook.com"
] | gaetanomanera@outlook.com |
c0cd7bd6cb40c4f8c10a7776272458084a7bfc2d | 8d6267edaf65409a8f0c073b5d12a343db88c98f | /app/src/test/java/com/namangarg/androiddocumentscanandfilter/ExampleUnitTest.java | bd67cbb9838109e96affab0f2b2badb04afa3550 | [
"Apache-2.0"
] | permissive | woth2k3/AndroidDocumentFilter | fa62240d38e6b0c04036a7a1837cc1b663c6a2e3 | 5a190bec5be0218a76da33419e11c4fdb65a975d | refs/heads/master | 2023-06-24T08:22:07.491863 | 2021-07-26T18:50:45 | 2021-07-26T18:50:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package com.namangarg.androiddocumentscanandfilter;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"naman33jii@gmail.com"
] | naman33jii@gmail.com |
1eab103f5f2c6f47c577b872eb235500ce73bd29 | 9cefbb5ef88b3d4db72bacbe660eb340cbc8de47 | /src/class12/Code04_RegularExpressionMatch.java | f649a770ae5fd1677fd284b9ebe3d254b55e5100 | [] | no_license | monkey408/coding-for-great-offer | 863b795657f5f89315cdfb7de99ec5704e8ea23c | 1b8b0aca8dcbdc6c0e256366729541849557b338 | refs/heads/main | 2023-05-09T09:43:53.530632 | 2021-05-31T06:14:25 | 2021-05-31T06:14:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,239 | java | package class12;
// 测试链接 : https://leetcode.com/problems/regular-expression-matching/
public class Code04_RegularExpressionMatch {
public static boolean isValid(char[] s, char[] e) {
// s中不能有'.' or '*'
for (int i = 0; i < s.length; i++) {
if (s[i] == '*' || s[i] == '.') {
return false;
}
}
// 开头的e[0]不能是'*',没有相邻的'*'
for (int i = 0; i < e.length; i++) {
if (e[i] == '*' && (i == 0 || e[i - 1] == '*')) {
return false;
}
}
return true;
}
// 初始尝试版本,不包含斜率优化
public static boolean isMatch1(String str, String exp) {
if (str == null || exp == null) {
return false;
}
char[] s = str.toCharArray();
char[] e = exp.toCharArray();
return isValid(s, e) && process(s, e, 0, 0);
}
public static boolean process(char[] s, char[] e, int si, int ei) {
if (ei == e.length) {
return si == s.length;
}
if (ei + 1 == e.length || e[ei + 1] != '*') {
return si != s.length && (e[ei] == s[si] || e[ei] == '.') && process(s, e, si + 1, ei + 1);
}
while (si != s.length && (e[ei] == s[si] || e[ei] == '.')) {
if (process(s, e, si, ei + 2)) {
return true;
}
si++;
}
return process(s, e, si, ei + 2);
}
// 动态规划版本 + 斜率优化
public static boolean isMatch2(String str, String pattern) {
if (str == null || pattern == null) {
return false;
}
char[] s = str.toCharArray();
char[] p = pattern.toCharArray();
if (!isValid(s, p)) {
return false;
}
int N = s.length;
int M = p.length;
boolean[][] dp = new boolean[N + 1][M + 1];
dp[N][M] = true;
for (int j = M - 1; j >= 0; j--) {
dp[N][j] = (j + 1 < M && p[j + 1] == '*') && dp[N][j + 2];
}
// dp[0..N-2][M-1]都等于false,只有dp[N-1][M-1]需要讨论
if (N > 0 && M > 0) {
dp[N - 1][M - 1] = (s[N - 1] == p[M - 1] || p[M - 1] == '.');
}
for (int i = N - 1; i >= 0; i--) {
for (int j = M - 2; j >= 0; j--) {
if (p[j + 1] != '*') {
dp[i][j] = ((s[i] == p[j]) || (p[j] == '.')) && dp[i + 1][j + 1];
} else {
if ((s[i] == p[j] || p[j] == '.') && dp[i + 1][j]) {
dp[i][j] = true;
} else {
dp[i][j] = dp[i][j + 2];
}
}
}
}
return dp[0][0];
}
}
| [
"algorithmzuo@163.com"
] | algorithmzuo@163.com |
b831ea86599baa7b4359794ec6f96ef80c7b6d21 | 2fc025b87900192ffc2c9dde091d94a5841adb5e | /app/src/main/java/layout/SummaryPraOrderFragment.java | bbbca0a7609f3189f271cfcf5ff25d4bd71c798e | [] | no_license | tonnymao/Cello | ca668b700e1173077a3fb7d898d9e9e760b071b9 | 9bb4322e216692723622ddf6f37c892e7b20d5ab | refs/heads/master | 2021-04-26T23:48:56.400715 | 2018-03-08T09:40:25 | 2018-03-08T09:40:25 | 123,862,037 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,927 | java | package layout;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import com.inspira.cello.LibInspira;
import com.inspira.cello.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import static com.inspira.cello.IndexInternal.global;
import static com.inspira.cello.IndexInternal.jsonObject;
//import android.app.Fragment;
public class SummaryPraOrderFragment extends Fragment implements View.OnClickListener{
// private TextView tvCustomer, tvBroker, tvValuta, tvDate, tvSubtotal, tvGrandTotal, tvDiscNominal, tvPPNNominal;
// private TextView tvPPN, tvDisc; //added by Tonny @17-Sep-2017 //untuk tampilan pada approval
// private EditText etDisc, etPPN;
private TextView tvCabang,tvSales,tvJenisHarga,tvKode,tvTanggal,tvCustomer,tvKeterangan,tvStatus,tvSetujuOleh,tvSetujuPada;
private Button btnEdit;
private InsertingData insertingData;
public SummaryPraOrderFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_praorder_summary, container, false);
getActivity().setTitle("Pra Order Summary");
//tidak ganti title jika dipanggil pada saat approval atau disapproval
// if(!LibInspira.getShared(global.temppreferences, global.temp.salesorder_type_task, "").equals("approval") &&
// !LibInspira.getShared(global.temppreferences, global.temp.salesorder_type_task, "").equals("disapproval")) {
// getActivity().setTitle("Sales Order Summary");
// }else{ //added by Tonny @17-Sep-2017 //jika dipakai untuk approval, maka layout menggunakan fragment_summary_sales_order_approval untuk view saja
// v = inflater.inflate(R.layout.fragment_summary_sales_order_approval, container, false);
// }
Log.d("sumasd","on create");
return v;
}
/*****************************************************************************/
//OnAttach dijalankan pada saat fragment ini terpasang pada Activity penampungnya
/*****************************************************************************/
@Override
public void onAttach(Context context) {
super.onAttach(context);
}
//added by Tonny @15-Jul-2017
//untuk mapping UI pada fragment, jangan dilakukan pada OnCreate, tapi dilakukan pada onActivityCreated
@Override
public void onActivityCreated(Bundle bundle){
super.onActivityCreated(bundle);
// tvDate = (TextView) getView().findViewById(R.id.tvDate);
// tvCustomer = (TextView) getView().findViewById(R.id.tvCustomer);
// tvBroker = (TextView) getView().findViewById(R.id.tvBroker);
// tvValuta = (TextView) getView().findViewById(R.id.tvValuta);
// tvSubtotal = (TextView) getView().findViewById(R.id.tvSubtotal);
// tvGrandTotal = (TextView) getView().findViewById(R.id.tvGrandTotal);
// tvDiscNominal = (TextView) getView().findViewById(R.id.tvDiscNominal);
// tvPPNNominal = (TextView) getView().findViewById(R.id.tvPPNNominal);
tvCabang = (TextView) getView().findViewById(R.id.tvNamaCabang);
tvSales = (TextView) getView().findViewById(R.id.tvNamaSales);
tvJenisHarga = (TextView) getView().findViewById(R.id.tvJenisHarga);
tvKode= (TextView) getView().findViewById(R.id.tvKode);
tvTanggal= (TextView) getView().findViewById(R.id.tvTanggal);
tvCustomer= (TextView) getView().findViewById(R.id.tvNamaKodeCustomer);
tvKeterangan= (TextView) getView().findViewById(R.id.tvKeterangan);
tvStatus= (TextView) getView().findViewById(R.id.tvStatus);
tvSetujuOleh = (TextView) getView().findViewById(R.id.tvSetujuOleh);
tvSetujuPada = (TextView) getView().findViewById(R.id.tvSetujuPada);
btnEdit = (Button) getView().findViewById(R.id.btnEdit);
btnEdit.setOnClickListener(this);
loadDataFromShared();
//### reset submenu handle ketika back fragment dan, finish button di formNewPraorderItemList
LibInspira.setShared(global.temppreferences, global.temp.praorder_submenu, "");
//Log.d("sumasd","activ created");
// tvDate.setText(LibInspira.getShared(global.temppreferences, global.temp.salesorder_date, ""));
// tvCustomer.setText(LibInspira.getShared(global.temppreferences, global.temp.salesorder_customer_nama, ""));
// tvBroker.setText(LibInspira.getShared(global.temppreferences, global.temp.salesorder_broker_nama, ""));
// tvValuta.setText(LibInspira.getShared(global.temppreferences, global.temp.salesorder_valuta_nama, ""));
//
// if(!LibInspira.getShared(global.temppreferences, global.temp.salesorder_type_task, "").equals("approval") &&
// !LibInspira.getShared(global.temppreferences, global.temp.salesorder_type_task, "").equals("disapproval")){
// etPPN = (EditText) getView().findViewById(R.id.etPPN);
// etDisc = (EditText) getView().findViewById(R.id.etDisc);
// etDisc.setText("0");
// etPPN.setText("0");
// btnSave.setOnClickListener(this);
// etDisc.addTextChangedListener(new TextWatcher() {
// @Override
// public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//
// }
//
// @Override
// public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//
// }
//
// @Override
// public void afterTextChanged(Editable editable) {
// LibInspira.formatNumberEditText(etDisc, this, true, false);
// tvDiscNominal.setText(LibInspira.delimeter(getNominalDiskon().toString()));
// tvPPNNominal.setText(LibInspira.delimeter(getNominalPPN().toString()));
// tvGrandTotal.setText("Rp. " + LibInspira.delimeter(getGrandTotal().toString()));
// LibInspira.setShared(global.temppreferences, global.temp.salesorder_disc, etDisc.getText().toString().replace(",", ""));
// LibInspira.setShared(global.temppreferences, global.temp.salesorder_disc_nominal, tvDiscNominal.getText().toString().replace(",", ""));
// }
// });
//
// etPPN.addTextChangedListener(new TextWatcher() {
// @Override
// public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//
// }
//
// @Override
// public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
//
// }
//
// @Override
// public void afterTextChanged(Editable editable) {
// LibInspira.formatNumberEditText(etPPN, this, true, false);
// tvPPNNominal.setText(LibInspira.delimeter(getNominalPPN().toString()));
// tvGrandTotal.setText("Rp. " + LibInspira.delimeter(getGrandTotal().toString()));
// LibInspira.setShared(global.temppreferences, global.temp.salesorder_ppn, etPPN.getText().toString().replace(",", ""));
// LibInspira.setShared(global.temppreferences, global.temp.salesorder_ppn_nominal, tvPPNNominal.getText().toString().replace(",", ""));
// }
// });
//
// tvSubtotal.setText(LibInspira.delimeter(getSubtotal().toString()));
// tvGrandTotal.setText("Rp. " + LibInspira.delimeter(getGrandTotal().toString()));
//
// if(LibInspira.getShared(global.temppreferences, global.temp.salesorder_type_task, "").equals("nonppn"))
// {
// getView().findViewById(R.id.trPPN).setVisibility(View.GONE);
// }
//
// }else{ //added by Tonny @17-Sep-2017 jika untuk approval, beberapa property dihilangkan/diganti
// tvPPN = (TextView) getView().findViewById(R.id.tvPPN);
// tvDisc = (TextView) getView().findViewById(R.id.tvDisc);
// btnSave.setVisibility(View.GONE);
// tvSubtotal.setText(LibInspira.delimeter(LibInspira.getShared(global.temppreferences, global.temp.salesorder_subtotal, "")));
// tvGrandTotal.setText("Rp. " + LibInspira.delimeter(LibInspira.getShared(global.temppreferences, global.temp.salesorder_total, "")));
// tvDisc.setText(LibInspira.delimeter(LibInspira.getShared(global.temppreferences, global.temp.salesorder_disc, "")));
// tvDiscNominal.setText(LibInspira.delimeter(LibInspira.getShared(global.temppreferences, global.temp.salesorder_disc_nominal, "")));
// tvPPN.setText(LibInspira.delimeter(LibInspira.getShared(global.temppreferences, global.temp.salesorder_ppn, "")));
// tvPPNNominal.setText(LibInspira.delimeter(LibInspira.getShared(global.temppreferences, global.temp.salesorder_ppn_nominal, "")));
// }
}
@Override
public void onDetach() {
super.onDetach();
}
@Override
public void onClick(View view) {
int id = view.getId();
if(id==R.id.btnEdit)
{
// klo sdh di approve tdk isa di edit
// klo belum di approve bisa di edit
//BELUM DI BYPASS
if(LibInspira.getShared(global.temppreferences, global.temp.praorder_selected_list_status, "").equals("1"))
{
//btnEdit.setVisibility(View.GONE);
LibInspira.showLongToast(getActivity(),"Tidak bisa diedit karena sudah di APPROVE");
}
else
{
//btnEdit.setVisibility(View.VISIBLE);
LibInspira.setShared(global.temppreferences, global.temp.praorder_menu, "edit");
if(!LibInspira.getShared(global.temppreferences, global.temp.praorder_summary, "").equals(""))
{
// LibInspira.setShared(global.temppreferences, global.temp.praorder_header_edit,
// LibInspira.getShared(global.temppreferences, global.temp.praorder_summary, ""));
trimDataShared(LibInspira.getShared(global.temppreferences, global.temp.praorder_summary, ""));
}
else{
LibInspira.showShortToast(getActivity(),"error load data header");
}
// di isi list dr item list
if(!LibInspira.getShared(global.temppreferences, global.temp.praorder_item, "").equals("")) {
LibInspira.setShared(global.temppreferences, global.temp.praorder_item_add,
LibInspira.getShared(global.temppreferences, global.temp.praorder_item, ""));
}
else{
LibInspira.showShortToast(getActivity(),"error load data list items");
}
LibInspira.ReplaceFragment(getActivity().getSupportFragmentManager(), R.id.fragment_container, new FormNewPraOrderHeader());
}
}
// else if(id==R.id.btnBack)
// {
// LibInspira.BackFragment(getActivity().getSupportFragmentManager());
// }
}
public void trimDataShared(String data)
{
// data[0] = obj.getString("nomor");
// data[1] = obj.getString("namaCabang");
// data[2] = obj.getString("nomorSales");
// data[3] = obj.getString("namaSales");
//
// data[4] = obj.getString("nomorJenisHarga");
// data[5] = obj.getString("namaJenisHarga");
// data[6] = obj.getString("kode");
// data[7] = obj.getString("tanggal");
// data[8] = obj.getString("nomorCustomer");
// data[9] = obj.getString("kodeCustomer");
// data[10] = obj.getString("namaCustomer");
//
// data[11] = obj.getString("ppnPersen");
// data[12] = obj.getString("ppnNom");
// data[13] = obj.getString("diskonPersen");
// data[14] = obj.getString("diskonNom");
// data[15] = obj.getString("kurs");
//
// data[16] = obj.getString("keterangan");
// data[17] = obj.getString("status_disetujui");
//
// data[18] = obj.getString("disetujui_oleh");
// data[19] = obj.getString("disetujui_pada");
if(!data.equals(""))
{
String[] parts = data.trim().split("\\~");
LibInspira.setShared(global.temppreferences, global.temp.praorder_header_nomor, parts[0]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_header_kode, parts[6]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_customer_nomor, parts[8]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_customer_nama, parts[10]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_sales_nomor, parts[2]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_sales_nama, parts[3]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_jenis_harga_nomor, parts[4]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_jenis_harga_nama, parts[5]);
LibInspira.setShared(global.temppreferences, global.temp.praorder_date, parts[7].substring(0,10));
LibInspira.setShared(global.temppreferences, global.temp.praorder_keterangan,parts[16] );
}
}
private void loadDataFromShared()
{
// data[0] = obj.getString("nomor");
// data[1] = obj.getString("namaCabang");
// data[2] = obj.getString("nomorSales");
// data[3] = obj.getString("namaSales");
//
// data[4] = obj.getString("nomorJenisHarga");
// data[5] = obj.getString("namaJenisHarga");
// data[6] = obj.getString("kode");
// data[7] = obj.getString("tanggal");
// data[8] = obj.getString("nomorCustomer");
// data[9] = obj.getString("kodeCustomer");
// data[10] = obj.getString("namaCustomer");
//
// data[11] = obj.getString("ppnPersen");
// data[12] = obj.getString("ppnNom");
// data[13] = obj.getString("diskonPersen");
// data[14] = obj.getString("diskonNom");
// data[15] = obj.getString("kurs");
//
// data[16] = obj.getString("keterangan");
// data[17] = obj.getString("status_disetujui");
//
// data[18] = obj.getString("disetujui_oleh");
// data[19] = obj.getString("disetujui_pada");
//Log.d("sumasd","masuk");
String data = LibInspira.getShared(global.temppreferences, global.temp.praorder_summary, "");
Log.d("sumasd",data);
//String[] pieces = data.trim().split("\\|");
if(!data.equals(""))
{
String[] parts = data.trim().split("\\~");
// for(String k : parts) {
// Log.d("sumasd", k);
// }
tvCabang.setText(parts[1]);
tvSales.setText(parts[2] +" - "+ parts[3]);
tvJenisHarga.setText(parts[5]);
tvKode.setText(parts[6]);
tvTanggal.setText(parts[7]);
tvCustomer.setText(parts[9]+" - "+parts[10]);
tvKeterangan.setText(parts[16]);
if(parts[17].equals("1"))
{
tvStatus.setText("APPROVE");
}
else if(parts[17].equals("0"))
{
tvStatus.setText("DISAPPROVE");
tvSetujuOleh.setVisibility(View.INVISIBLE);
tvSetujuPada.setVisibility(View.INVISIBLE);
}
else
{
tvStatus.setText(parts[17]);
}
tvSetujuOleh.setText(parts[18]);
tvSetujuPada.setText(parts[19]);
}
// for(int i=0 ; i < pieces.length ; i++){
// Log.d("item", pieces[i] + "a");
// if(!pieces[i].equals(""))
// {
// String nomor = parts[0];
// String nama = parts[1];
// String kode = parts[2];
// if(nomor.equals("null")) nomor = "";
// if(nama.equals("null")) nama = "";
// if(kode.equals("null")) kode = "";
// }
// }
// if(pieces.length==1)
// {
// //tvNoData.setVisibility(View.VISIBLE);
// }
// else
// {
// //tvNoData.setVisibility(View.GONE);
// }
}
//added by Tonny @02-Sep-2017
//untuk menjalankan perintah send data ke web service
private void sendData(){
String actionUrl = "Order/insertNewOrderJual/";
insertingData = new InsertingData();
insertingData.execute(actionUrl);
}
//added by Tonny @04-Sep-2017
//class yang digunakan untuk insert data
private class InsertingData extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
jsonObject = new JSONObject();
//---------------------------------------------HEADER-----------------------------------------------------//
try {
jsonObject.put("nomorcustomer", LibInspira.getShared(global.temppreferences, global.temp.salesorder_customer_nomor, ""));
jsonObject.put("kodecustomer", LibInspira.getShared(global.temppreferences, global.temp.salesorder_customer_kode, ""));
jsonObject.put("nomorbroker", LibInspira.getShared(global.temppreferences, global.temp.salesorder_broker_nomor, ""));
jsonObject.put("kodebroker", LibInspira.getShared(global.temppreferences, global.temp.salesorder_broker_kode, ""));
jsonObject.put("nomorsales", LibInspira.getShared(global.userpreferences, global.user.nomor_sales, ""));
//jsonObject.put("kodesales", LibInspira.getShared(global.userpreferences, global.user.kode, ""));
jsonObject.put("subtotal", LibInspira.getShared(global.temppreferences, global.temp.salesorder_subtotal, ""));
jsonObject.put("subtotaljasa", LibInspira.getShared(global.temppreferences, global.temp.salesorder_pekerjaan_subtotal, ""));
jsonObject.put("subtotalbiaya", LibInspira.getShared(global.temppreferences, global.temp.salesorder_subtotal_fee, ""));
jsonObject.put("disc", LibInspira.getShared(global.temppreferences, global.temp.salesorder_disc, "0"));
jsonObject.put("discnominal", LibInspira.getShared(global.temppreferences, global.temp.salesorder_disc_nominal, "0"));
jsonObject.put("dpp", LibInspira.getShared(global.temppreferences, global.temp.salesorder_total, ""));
jsonObject.put("ppn", LibInspira.getShared(global.temppreferences, global.temp.salesorder_ppn, "0"));
jsonObject.put("ppnnominal", LibInspira.getShared(global.temppreferences, global.temp.salesorder_ppn_nominal, "0"));
jsonObject.put("total", LibInspira.getShared(global.temppreferences, global.temp.salesorder_total, "0"));
//jsonObject.put("totalrp", Double.toString(getGrandTotal() * Double.parseDouble(LibInspira.getShared(global.temppreferences, global.temp.salesorder_valuta_kurs, ""))));
jsonObject.put("pembuat", LibInspira.getShared(global.userpreferences, global.user.nama, ""));
jsonObject.put("nomorcabang", LibInspira.getShared(global.userpreferences, global.user.cabang, ""));
jsonObject.put("cabang", LibInspira.getShared(global.temppreferences, global.user.namacabang, ""));
jsonObject.put("valuta", LibInspira.getShared(global.temppreferences, global.temp.salesorder_valuta_nama, ""));
jsonObject.put("kurs", LibInspira.getShared(global.temppreferences, global.temp.salesorder_valuta_kurs, ""));
jsonObject.put("jenispenjualan", "Material");
jsonObject.put("isbarangimport", LibInspira.getShared(global.temppreferences, global.temp.salesorder_import, ""));
jsonObject.put("isppn", LibInspira.getShared(global.temppreferences, global.temp.salesorder_isPPN, ""));
if(LibInspira.getShared(global.temppreferences, global.temp.salesorder_type_proyek, "").equals("proyek"))
{
jsonObject.put("proyek", 1);
}
else if(LibInspira.getShared(global.temppreferences, global.temp.salesorder_type_proyek, "").equals("nonproyek"))
{
jsonObject.put("proyek", 0);
}
jsonObject.put("user", LibInspira.getShared(global.userpreferences, global.user.nomor, ""));
//-------------------------------------------------------------------------------------------------------//
//---------------------------------------------DETAIL----------------------------------------------------//
jsonObject.put("dataitemdetail", LibInspira.getShared(global.temppreferences, global.temp.salesorder_item, "")); //mengirimkan data item
jsonObject.put("datapekerjaandetail", LibInspira.getShared(global.temppreferences, global.temp.salesorder_pekerjaan, "")); //mengirimkan data pekerjaan
Log.d("detailitemdetail", LibInspira.getShared(global.temppreferences, global.temp.salesorder_item, ""));
Log.d("detailpekerjaandetail", LibInspira.getShared(global.temppreferences, global.temp.salesorder_pekerjaan, ""));
} catch (JSONException e) {
e.printStackTrace();
}
return LibInspira.executePost(getContext(), urls[0], jsonObject);
}
// onPostExecute displays the results of the AsyncTask.
@Override
protected void onPostExecute(String result) {
Log.d("resultQuery", result);
try {
JSONArray jsonarray = new JSONArray(result);
if(jsonarray.length() > 0){
for (int i = 0; i < jsonarray.length(); i++) {
JSONObject obj = jsonarray.getJSONObject(i);
if(!obj.has("query")){
LibInspira.hideLoading();
LibInspira.showShortToast(getContext(), "Data has been successfully added");
LibInspira.clearShared(global.temppreferences); //hapus cache jika data berhasil ditambahkan
LibInspira.BackFragmentCount(getFragmentManager(), 6); //kembali ke menu depan sales order
}
else
{
LibInspira.showShortToast(getContext(), "Adding new data failed");
LibInspira.hideLoading();
}
}
}
}
catch(Exception e)
{
e.printStackTrace();
LibInspira.showShortToast(getContext(), "Adding new data failed");
LibInspira.hideLoading();
}
}
@Override
protected void onPreExecute() {
super.onPreExecute();
LibInspira.showLoading(getContext(), "Inserting Data", "Loading");
//tvInformation.setVisibility(View.VISIBLE);
}
}
}
| [
"tonnymul0908@gmail.com"
] | tonnymul0908@gmail.com |
bf2aba55cf8874cb5e82b91ab7df42eb3321b84a | 2cdf91a25e135784fa9483d148eab349cfc7f8c7 | /sample-gwt/src/main/java/fr/generali/ccj/sample/gwt/shared/dispatch/FooResult.java | 3fe6030d47ad20c1a20300bd23be54cd3471aed3 | [] | no_license | vdupain/gwt | 37e9edba27e1ffac11cc8f5b02ce845d0dab30e8 | 5668193a8492a9b4aad6659ad3ffafca98304623 | refs/heads/master | 2021-01-25T10:06:42.354052 | 2012-06-29T12:55:44 | 2012-06-29T12:55:44 | 3,303,709 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | package fr.generali.ccj.sample.gwt.shared.dispatch;
import net.customware.gwt.dispatch.shared.Result;
import fr.generali.ccj.sample.gwt.shared.dto.FooDto;
public class FooResult implements Result {
private FooDto fooDto;
/** For serialization only. */
FooResult() {
}
public FooResult(FooDto fooDto) {
this.fooDto = fooDto;
}
public FooDto getFooDto() {
return fooDto;
}
}
| [
"vdupain@gmail.com"
] | vdupain@gmail.com |
473368aa8c7705c2a1eb7776d2dbcf46e2d82f7f | d7bbd9994cb26ba09d1eb12412b8335cfd9ffef6 | /app/src/main/java/com/esraa/android/plannertracker/BroadCastRecievers/AlarmDialog.java | 9868c232a5be14b015f1e40ef24c7b80c9d89b14 | [] | no_license | esraaabuseada/My-Tripminder | 0d5b868143afb7afd64863b893af9794ccee6d40 | f39d3ce53205a51e799578a55eea0136cf52bb59 | refs/heads/master | 2020-05-25T23:10:39.554219 | 2019-05-22T12:08:30 | 2019-05-22T12:08:30 | 188,029,937 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,252 | java | package com.esraa.android.plannertracker.BroadCastRecievers;
import android.app.AlertDialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.support.v4.app.NotificationCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.esraa.android.plannertracker.R;
import java.util.Locale;
public class AlarmDialog extends AppCompatActivity {
public static final int NOTIFICATION_ALARM = 1;
Ringtone ringtone;
public static final String PREFS_NAME ="MyPrefsFile";
boolean flag = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (!flag) {
playSound();
}
showAlarmDialog();
flag = true;
}
private void playSound() {
Uri sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
ringtone = RingtoneManager.getRingtone(getApplicationContext(),sound);
ringtone.play();
}
private void showAlarmDialog() {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Reminder To your Trip")
.setMessage("Check out your trip")
.setPositiveButton("Ok Start", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
ringtone.stop();
Toast.makeText(AlarmDialog.this, "Starting", Toast.LENGTH_SHORT).show();
openMap();
finish();
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
ringtone.stop();
finish();
}
})
.setNeutralButton("later", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
ringtone.stop();
Toast.makeText(AlarmDialog.this, "sending Notification", Toast.LENGTH_SHORT).show();
sendNotification();
finish();
}
}).create().show();
}
private void openMap() {
SharedPreferences settings = getSharedPreferences(PREFS_NAME , 0);
String startPoint=(settings.getString("start",null));
String endPoint=(settings.getString("end",null));
String uri = String.format(Locale.ENGLISH, "http://maps.google.com/maps?saddr="+startPoint+"&daddr="+endPoint);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
intent.setPackage("com.google.android.apps.maps");
startActivity(intent);
}
private void sendNotification() {
SharedPreferences settings = getSharedPreferences(PREFS_NAME , 0);
String tripName = settings.getString("tripName","No trip");
PendingIntent again = PendingIntent.getActivity(this,0,
new Intent(this,AlarmDialog.class),PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
builder.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_SOUND)
.setSmallIcon(R.drawable.map)
.setContentTitle("Your trip " + tripName)
.setContentText("Check out your Trip")
.setContentInfo("will Start soon ")
.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_ALL | Notification.DEFAULT_SOUND)
.setContentIntent(again);
NotificationManager manager = (NotificationManager) this.
getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(NOTIFICATION_ALARM, builder.build());
}
}
| [
"esraaabuseada28@gmail.com"
] | esraaabuseada28@gmail.com |
0088209c1838b18a3dd3f3499c395ffa8a2fd80d | 21d9e8e819129e331d9a33feda21885e89549b33 | /app/src/main/java/com/example/nalijev/drawmovingcircle/DrawScene.java | d1386be12d1f19a92367ef3d59adb092c716fc0f | [] | no_license | NAlijev/DrawMovingCircle | ff598bcc1e9be63e94c27ace8f36ca6f38a30d38 | 3ce972abaed5a30bd2f75f3ba155ee8a892beed9 | refs/heads/master | 2016-09-15T08:50:03.276844 | 2015-10-14T18:22:08 | 2015-10-14T18:22:08 | 44,173,093 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,127 | java | package com.example.nalijev.drawmovingcircle;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Point;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class DrawScene extends View {
private Paint canvasPaint;
private Paint circlePaint;
public int x;
public int y;
private int circleRadius = 60;
public int dx;
public int dy;
private final int FRAME_RATE = 50;
private int scene_width;
private int scene_height;
private Handler h;
public DrawScene(Context context, int start_x, int start_y, int start_dx, int start_dy) {
super(context);
x = start_x;
y = start_y;
dx = start_dx;
dy = start_dy;
canvasPaint = new Paint();
canvasPaint.setStyle(Paint.Style.FILL);
canvasPaint.setColor(Color.BLACK);
circlePaint = new Paint();
circlePaint.setColor(Color.WHITE);
h = new Handler();
}
private Runnable r = new Runnable() {
@Override public void run() {
invalidate();
}
};
@Override protected void onDraw(Canvas sceneCanvas) {
super.onDraw(sceneCanvas);
sceneCanvas.drawPaint(canvasPaint);
scene_width=this.getWidth();
scene_height=this.getHeight();
sceneCanvas.drawCircle(x, y, circleRadius, circlePaint);
x += dx;
y += dy;
if ((x > scene_width - circleRadius) || (x < circleRadius)) {
dx = dx*-1;
}
if ((y > scene_height - circleRadius) || (y < circleRadius)) {
dy = dy*-1;
}
h.postDelayed(r, FRAME_RATE);
}
public Point pointXY() {
Point p = new Point(this.x, this.y);
return p;
}
public Point pointDxDy() {
Point p = new Point(this.dx, this.dy);
return p;
}
} | [
"nizami.ee@mail.ru"
] | nizami.ee@mail.ru |
850b2a7c991a44411f994cbeab5042b98abb5557 | fc8de5ed9c7555824668c5c23662d655b956456d | /src/main/java/FileAndDirectorySystem/search/SearchByFormat.java | 50fbfa32a57dbdc9620dc98fcfcbae6863f3a784 | [] | no_license | phusdu/System-Design | 2d5328e45910c29e3aad14e31826ad21f586c80a | 18d9635c44a3b1a2be02f55aee0f0886c4368582 | refs/heads/master | 2022-06-12T17:24:12.354415 | 2020-05-02T21:42:32 | 2020-05-02T21:42:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 690 | java | package FileAndDirectorySystem.search;
import FileAndDirectorySystem.Directory;
import FileAndDirectorySystem.Entry;
public class SearchByFormat implements SearchCriteria {
// Assuming top level provided data is directory (not file)
private Directory directory;
public SearchByFormat(Directory directory) {
this.directory = directory;
}
@Override
public SearchResponse search(String value) {
return search(value, directory);
}
public SearchResponse search(String fileName, Directory path) {
for (Entry e : path.getEntries()) {
// add code stub here
}
return new SearchResponse(null, "404");
}
}
| [
"nikhil.agrwl07@gmail.com"
] | nikhil.agrwl07@gmail.com |
ef4a13245e7d05471351d29cb6983f7b3c907f11 | db0400a06644e6ee5302201ac18ab87f08b0d3fa | /src/com/program/collection/HashNode.java | 2aada56a01e826d94c72daa51e357decbaafdf4e | [] | no_license | ashoknineleaps/demo-javacode | 48b4a2d6db7be2b5610b85f8e65b3fb1fa424bc6 | b32409caff091a075849fb327cf585b5f5134a8f | refs/heads/master | 2022-11-09T06:53:03.982925 | 2020-07-01T06:11:52 | 2020-07-01T06:11:52 | 269,146,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,900 | java | package com.program.collection;
public class HashNode<K, V> {
private K key;
private V value;
private HashNode<K, V> next;
private int hash;
public HashNode(K key, V value, HashNode<K, V> next, int hash) {
super();
this.key = key;
this.value = value;
this.next = next;
this.hash = hash;
}
public K getKey() {
return key;
}
public void setKey(K key) {
this.key = key;
}
public V getValue() {
return value;
}
public void setValue(V value) {
this.value = value;
}
public HashNode<K, V> getNext() {
return next;
}
public void setNext(HashNode<K, V> next) {
this.next = next;
}
public int getHash() {
return hash;
}
public void setHash(int hash) {
this.hash = hash;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + hash;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + ((next == null) ? 0 : next.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
HashNode<K, V> other = (HashNode) obj;
if (hash != other.hash)
return false;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (next == null) {
if (other.next != null)
return false;
} else if (!next.equals(other.next))
return false;
if (value == null) {
if (other.value != null)
return false;
} else if (!value.equals(other.value))
return false;
return true;
}
@Override
public String toString() {
return "HashNode [key=" + key + ", value=" + value + ", next=" + next + ", hash=" + hash + "]";
}
}
| [
"ashok.kumar@nineleaps.com"
] | ashok.kumar@nineleaps.com |
0a93744761a3729f94f68ee080cd8146b06c8de5 | ab3f2b2bd666e0f8ab95dd8311c2d15ea00669c8 | /java_programs/All example of notes/Access Modifier example/use_of_AccessModifier/src/package1/anirudh.java | 6cbaece1a5a7b31bc467cdca466ab3921be373da | [] | no_license | HarshitVerma1/Programs | 630eef2f6f68a614d369bc05426b69c5d9bc074e | 6c079bfda0cc1af25493dc7d62644a54e70f58ed | refs/heads/master | 2022-11-15T06:45:46.235368 | 2020-07-09T16:36:46 | 2020-07-09T16:36:46 | 265,278,335 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 914 | java | package package1;
import package1.AccessModifier_in_Class_or_Interface1;
class Radhe{ //<----DefaultAccessModiifier//this class inherit in anirudh class because this class is not public and i want to call in "Main" Class.
protected void Radhe() // this method is called in "Main()" by inheritance method and ----> At here we can only use "'public','default' and 'protected'"
{
System.out.println("Radhe class & method called which is placed in package1");
}
}
public class anirudh extends Radhe {
public void anirudh() // here "void" and "public" is required because Main() is placed in outside Package.
{
System.out.println("anirudh() method called which is placed in package1 ");
AccessModifier_in_Class_or_Interface1 a=new AccessModifier_in_Class_or_Interface1();
a.shubham();
Radhe();//calling "with in" package with default access modifier
}
}
| [
"harshitverma14366@gmail.com"
] | harshitverma14366@gmail.com |
38f2b854b1fa1e55cd114077d338fd3abdcad54d | 6ea26cdb5b1d79e85e9874b96899ecaa535c849a | /src/org/simpleim/common/message/Response.java | dae39d1b79e5eb52b5f03c3545cb86d6f37a0ee1 | [
"Apache-2.0"
] | permissive | SimpleInstantMessage/SimpleIM_common | b5b5fd5909acac0546129d6f23d6f569f7371b3c | ce5072260045ca944dc63a6915005ce83660d51c | refs/heads/master | 2020-04-14T15:51:23.865822 | 2014-01-29T17:57:16 | 2014-01-29T17:57:16 | 15,875,456 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 81 | java | package org.simpleim.common.message;
public class Response extends Message {
}
| [
"baijie1991@gmail.com"
] | baijie1991@gmail.com |
92b38440ed0c8b3b0446b16095b27256dedceb36 | 75950d61f2e7517f3fe4c32f0109b203d41466bf | /modules/tags/fabric3-modules-parent-pom-1.9.6/extension/core/fabric3-jetty/src/main/java/org/fabric3/transport/jetty/management/ManagedServletHolder.java | 3dc6f665f770f57abb0278e43d851697d91ce9b1 | [] | no_license | codehaus/fabric3 | 3677d558dca066fb58845db5b0ad73d951acf880 | 491ff9ddaff6cb47cbb4452e4ddbf715314cd340 | refs/heads/master | 2023-07-20T00:34:33.992727 | 2012-10-31T16:32:19 | 2012-10-31T16:32:19 | 36,338,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,236 | java | /*
* Fabric3
* Copyright (c) 2009-2012 Metaform Systems
*
* Fabric3 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version, with the
* following exception:
*
* Linking this software statically or dynamically with other
* modules is making a combined work based on this software.
* Thus, the terms and conditions of the GNU General Public
* License cover the whole combination.
*
* As a special exception, the copyright holders of this software
* give you permission to link this software with independent
* modules to produce an executable, regardless of the license
* terms of these independent modules, and to copy and distribute
* the resulting executable under terms of your choice, provided
* that you also meet, for each linked independent module, the
* terms and conditions of the license of that module. An
* independent module is a module which is not derived from or
* based on this software. If you modify this software, you may
* extend this exception to your version of the software, but
* you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version.
*
* Fabric3 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the
* GNU General Public License along with Fabric3.
* If not, see <http://www.gnu.org/licenses/>.
*
* ----------------------------------------------------
*
* Portions originally based on Apache Tuscany 2007
* licensed under the Apache 2.0 license.
*
*/
package org.fabric3.transport.jetty.management;
import javax.servlet.Servlet;
import org.eclipse.jetty.servlet.ServletHolder;
import org.fabric3.api.annotation.management.Management;
import org.fabric3.api.annotation.management.ManagementOperation;
/**
* Overrides the Jetty <code>ServletHolder</code> to provide a custom management view.
*
* @version $Rev: 9172 $ $Date: 2010-06-30 16:49:34 +0200 (Wed, 30 Jun 2010) $
*/
@Management
public class ManagedServletHolder extends ServletHolder {
public ManagedServletHolder() {
}
public ManagedServletHolder(Servlet servlet) {
super(servlet);
}
public ManagedServletHolder(Class servlet) {
super(servlet);
}
@Override
@ManagementOperation(description = "Servlet availability")
public boolean isAvailable() {
return super.isAvailable();
}
@Override
@ManagementOperation(description = "Servlet context path")
public String getContextPath() {
return super.getContextPath();
}
@Override
@ManagementOperation(description = "Start the servlet from servicing requests")
public void doStart() throws Exception {
super.doStart();
}
@Override
@ManagementOperation(description = "Stop the servlet from servicing requests")
public void doStop() throws Exception {
super.doStop();
}
} | [
"jmarino@83866bfc-822f-0410-aa35-bd5043b85eaf"
] | jmarino@83866bfc-822f-0410-aa35-bd5043b85eaf |
5d61a7f909265a737c0843e7096f9b4abdec6ad9 | 6b42914b2af3764dbd6e6f141bcc8490ec895d6b | /continuum-core/src/main/java/org/apache/maven/continuum/execution/shared/JUnitReportArchiver.java | 43295242eab9c1fb9a80033d5ac136cdc184be0f | [
"Apache-2.0"
] | permissive | isabella232/continuum | 621da8775aa7e6c8a28ea94e5a1dcc9c35cd4839 | 2a3bf5fc272606c8a23d2535afdb70dfc9772137 | refs/heads/trunk | 2023-08-28T10:18:27.475765 | 2016-06-10T11:14:55 | 2016-06-10T11:14:55 | 424,191,236 | 0 | 0 | Apache-2.0 | 2021-11-03T11:16:01 | 2021-11-03T11:09:05 | null | UTF-8 | Java | false | false | 1,759 | java | package org.apache.maven.continuum.execution.shared;
import org.apache.continuum.utils.file.FileSystemManager;
import org.codehaus.plexus.util.DirectoryScanner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
public class JUnitReportArchiver
{
private static Logger log = LoggerFactory.getLogger( JUnitReportArchiver.class );
private String[] includeFiles = {};
private String[] excludeFiles = {};
private FileSystemManager fsManager;
public void setIncludeFiles( String[] includeFiles )
{
this.includeFiles = includeFiles;
}
public void setExcludeFiles( String[] excludeFiles )
{
this.excludeFiles = excludeFiles;
}
public void setFileSystemManager( FileSystemManager fsManager )
{
this.fsManager = fsManager;
}
public String[] findReports( File workingDir )
{
DirectoryScanner scanner = new DirectoryScanner();
scanner.setBasedir( workingDir );
scanner.setIncludes( includeFiles );
scanner.setExcludes( excludeFiles );
scanner.scan();
return scanner.getIncludedFiles();
}
public void archiveReports( File workingDir, File backupDir )
throws IOException
{
String[] testResultFiles = findReports( workingDir );
if ( testResultFiles.length > 0 )
{
log.info( "Backing up {} test reports", testResultFiles.length );
}
for ( String testResultFile : testResultFiles )
{
File xmlFile = new File( workingDir, testResultFile );
if ( backupDir != null )
{
fsManager.copyFileToDir( xmlFile, backupDir );
}
}
}
}
| [
"batkinson@apache.org"
] | batkinson@apache.org |
37c4694ab33dc59ea10148b000def98833d6b59f | f4f4e690c33793a0b0cda5c4bb8a575fb1778139 | /asm_kiemthunangcao/nguyenltpd03408/src/test/java/testModel/NhanVienTest.java | c44e675cb4072022c847bd24144954a4ee3f8df3 | [] | no_license | letannguyen/testcaseduanmau | 5307b7e90af0cf74f8c165afdff67f7539b18bd2 | 1d5c3af7f094dbebce7b5932e0b9fba36e53f6ea | refs/heads/master | 2023-06-13T07:46:30.101773 | 2021-07-09T16:37:14 | 2021-07-09T16:37:14 | 384,495,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,596 | java | package testModel;
import org.testng.annotations.Test;
import com.polypro.model.NhanVien;
import org.testng.annotations.BeforeMethod;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
public class NhanVienTest {
NhanVien nv;
@BeforeMethod
public void beforeMethod() {
nv = new NhanVien();
}
@AfterMethod
public void afterMethod() {
nv = null;
}
@Test
public void getHoTenTest() {
String expected = null;
String actual = nv.getHoTen();
Assert.assertEquals(actual, expected);
}
@Test
public void getMaNVTest() {
String expected = null;
String actual = nv.getMaNV();
Assert.assertEquals(actual, expected);
}
@Test
public void getMatKhauTest() {
String expected = null;
String actual = nv.getMatKhau();
Assert.assertEquals(actual, expected);
}
@Test
public void getVaiTroTest() {
boolean expected = false;
boolean actual = nv.isVaiTro();
Assert.assertEquals(actual, expected);
}
@Test
public void isVaiTroTest() {
boolean expected = false;
boolean actual = nv.isVaiTro();
Assert.assertEquals(actual, expected);
}
@Test
public void setHoTenTest() {
String expected = "Nguyen Van Teo";
nv.setHoTen("Nguyen Van Teo");
String actual = nv.getHoTen();
Assert.assertEquals(actual, expected);
}
@Test(expectedExceptions = Exception.class)
public void setHoTenNullTest() {
String expected = null;
nv.setHoTen(null);
String actual = nv.getHoTen();
Assert.assertEquals(actual, expected);
}
@Test
public void setMaNVTest() {
String expected = "NV010";
nv.setMaNV("NV010");
String actual = nv.getMaNV();
Assert.assertEquals(actual, expected);
}
@Test(expectedExceptions = Exception.class)
public void setMaNVNullTest() {
String expected = null;
nv.setMaNV(null);
String actual = nv.getMaNV();
Assert.assertEquals(actual, expected);
}
@Test
public void setMatKhauTest() {
String expected = "123456";
nv.setMatKhau("123456");
String actual = nv.getMatKhau();
Assert.assertEquals(actual, expected);
}
@Test(expectedExceptions = Exception.class)
public void setMatKhauNullTest() {
String expected = null;
nv.setMatKhau(null);
String actual = nv.getMatKhau();
Assert.assertEquals(actual, expected);
}
@Test
public void setVaiTroTrueTest() {
boolean expected = true;
nv.setVaiTro(true);
boolean actual = nv.isVaiTro();
Assert.assertEquals(actual, expected);
}
@Test
public void setVaiTrofalseTest() {
boolean expected = false;
nv.setVaiTro(false);
boolean actual = nv.isVaiTro();
Assert.assertEquals(actual, expected);
}
}
| [
"nguyenltpd03408@fpt.edu.vn"
] | nguyenltpd03408@fpt.edu.vn |
081bb8bdac4bd778b703dd0ece9390126acaa71d | a2833cef7a092fad3b35c37337a749c6b6d6e61c | /src/node/ADiffOperacaologica.java | e6d1d072f8c4b7d2577b28e99698040958316d79 | [] | no_license | lucasomac/Cebola | 42152903b3f95ce0fc0a21e4beff8ac46ad44aa8 | 7f7c41f1b44abc249f2fd50bcee1a668e3b0178a | refs/heads/master | 2020-03-18T20:49:14.154038 | 2018-10-08T23:52:17 | 2018-10-08T23:52:17 | 135,240,450 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,018 | java | /* This file was generated by SableCC (http://www.sablecc.org/). */
package node;
import analysis.*;
@SuppressWarnings("nls")
public final class ADiffOperacaologica extends POperacaologica
{
private TDiferente _diferente_;
public ADiffOperacaologica()
{
// Constructor
}
public ADiffOperacaologica(
@SuppressWarnings("hiding") TDiferente _diferente_)
{
// Constructor
setDiferente(_diferente_);
}
@Override
public Object clone()
{
return new ADiffOperacaologica(
cloneNode(this._diferente_));
}
@Override
public void apply(Switch sw)
{
((Analysis) sw).caseADiffOperacaologica(this);
}
public TDiferente getDiferente()
{
return this._diferente_;
}
public void setDiferente(TDiferente node)
{
if(this._diferente_ != null)
{
this._diferente_.parent(null);
}
if(node != null)
{
if(node.parent() != null)
{
node.parent().removeChild(node);
}
node.parent(this);
}
this._diferente_ = node;
}
@Override
public String toString()
{
return ""
+ toString(this._diferente_);
}
@Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._diferente_ == child)
{
this._diferente_ = null;
return;
}
throw new RuntimeException("Not a child.");
}
@Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._diferente_ == oldChild)
{
setDiferente((TDiferente) newChild);
return;
}
throw new RuntimeException("Not a child.");
}
}
| [
"lucasomac@outlook.com"
] | lucasomac@outlook.com |
7676dc5cf7a71362679aef3717b441a728e385e7 | 2cf1e5a7e3532b1db2d28074f57123c9f75619ef | /src/main/java/practice/problem/DivideTwoIntegers.java | 022e8bbd8ce1f1bd48a901b33cdebc9a4ffb7a77 | [] | no_license | jimty0511/algorithmPractice | 33f15c828a1463d7a1ea247b424e577fde37e1dd | dd524388e9d5c70ee97869b63465f3cd171f9460 | refs/heads/master | 2020-03-20T14:57:01.722957 | 2020-02-19T19:43:39 | 2020-02-19T19:43:39 | 137,497,450 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,459 | java | package practice.problem;
// 29. Divide Two Integers
// Microsoft ladder
public class DivideTwoIntegers {
public int divideTwo(int dividend, int divisor) {
if (dividend == Integer.MIN_VALUE && divisor == -1)
return Integer.MAX_VALUE;
int a = Math.abs(dividend);
int b = Math.abs(divisor);
boolean isNegative = (dividend < 0 && divisor > 0) ||
(dividend > 0 && divisor < 0);
int res = 0;
while (a - b >= 0) {
int x = 0;
while (a - (b << 1 << x) >= 0)
x++;
res += 1 << x;
a -= b << x;
}
return !isNegative ? res : -res;
}
public int divide(int dividend, int divisor) {
long result = divideLong(dividend, divisor);
return result > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) result;
}
private long divideLong(long dividend, long divisor) {
boolean negative = dividend < 0 != divisor < 0;
if (dividend < 0)
dividend = -dividend;
if (divisor < 0)
divisor = -divisor;
if (dividend < divisor)
return 0;
long sum = divisor;
long divide = 1;
while ((sum + sum) <= dividend) {
sum += sum;
divide += divide;
}
return negative ? -(divide + divideLong((dividend - sum), divisor)) : (divide + divideLong((dividend - sum), divisor));
}
}
| [
"ty90511@gmail.com"
] | ty90511@gmail.com |
bafb3319c398316556deec893061bb60e698f9c7 | a1ecefb7992f30e638f15a20a7b49f307a4cd1d0 | /wuffy-bot/src/main/java/net/wuffy/bot/command/commands/settings/CommandMention.java | dd8a9bcb4ba72d963345b4322a4829e96e7bf354 | [
"Apache-2.0"
] | permissive | NgLoader/Discord-Bot-Wuffy-v1 | 33e4c5d233dd889bae4c37d21c0ad9c39e5a2a8e | 8ea01c1bcf88444e7bccb6406026985e5264398d | refs/heads/master | 2023-04-14T23:20:44.747321 | 2021-05-02T20:43:12 | 2021-05-02T20:43:12 | 363,535,699 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | package net.wuffy.bot.command.commands.settings;
import net.wuffy.bot.command.CommandHandler;
import net.wuffy.bot.command.commands.Command;
import net.wuffy.bot.command.commands.CommandCategory;
import net.wuffy.bot.command.commands.CommandSettings;
import net.wuffy.bot.command.commands.MessageType;
import net.wuffy.bot.database.guild.WuffyGuild;
import net.wuffy.bot.database.guild.WuffyMember;
import net.wuffy.bot.keys.PermissionKeys;
import net.wuffy.bot.keys.TranslationKeys;
import net.wuffy.core.event.WuffyMessageRecivedEvent;
import net.wuffy.core.util.ArgumentBuffer;
@CommandSettings(
category = CommandCategory.SETTINGS,
memberPermissionList = { PermissionKeys.COMMAND_MENTION },
memberPermissionRequierd = { PermissionKeys.COMMAND_MENTION },
aliases = { "mention" })
public class CommandMention extends Command {
public CommandMention(CommandHandler handler) {
super(handler);
}
@Override
public void onGuild(WuffyMessageRecivedEvent event, String command, ArgumentBuffer args) {
WuffyMember member = event.getMember(WuffyMember.class);
WuffyGuild guild = event.getGuild(WuffyGuild.class);
String locale = member.getLocale();
Boolean mention = !guild.isMention();
guild.setMention(mention);
if(mention)
this.sendMessage(event, MessageType.SUCCESS, i18n.format(TranslationKeys.MESSAGE_MENTION_ENABLE, locale));
else
this.sendMessage(event, MessageType.SUCCESS, i18n.format(TranslationKeys.MESSAGE_MENTION_DISABLE, locale));
}
@Override
public void onPrivate(WuffyMessageRecivedEvent event, String command, ArgumentBuffer args) { }
} | [
"nilsgereke1@gmail.com"
] | nilsgereke1@gmail.com |
37ec89b2ae3c35339dc4a54230a80d1e3b23a093 | ae7e64ccf7b9607cbfe8bb8663437e8911246a87 | /app/src/main/java/com/example/mockup/consulta_cep.java | c32b91bc6f78a1d0af3e7a6196041af38d10805d | [] | no_license | Pollyana-eng/Mockup | ecaeed3b60567fcd038f6b9df1b363c3a53d4462 | a55c7f5906f71b03a175fa870e9e3314e26875d3 | refs/heads/master | 2020-12-06T04:43:04.177997 | 2020-01-30T14:27:40 | 2020-01-30T14:27:40 | 232,346,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,266 | java | package com.example.mockup;
import android.app.Activity;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.concurrent.ExecutionException;
public class consulta_cep extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.consulta_cep);
Button btnBuscarCep = findViewById(R.id.btnMain_buscarCep);
final EditText cep = findViewById(R.id.etMain_cep);
final TextView resposta = findViewById(R.id.etMain_resposta);
btnBuscarCep.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
try {
CEP retorno = new HttpService(cep.getText().toString()).execute().get();
resposta.setText(retorno.toString());
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
});
}
} | [
"pollckmg@gmail.com"
] | pollckmg@gmail.com |
f774a1e07952388ee361bc83438cb6759a68c5cd | 5cdc63571f0202cea01ca1f3f07a0fe1158e517e | /src/main/java/br/com/univali/kob/poo/pizzaria/main/Main.java | 9a9563bc6e6f37405f87fb12fd5af216f6d4120d | [] | no_license | LuizdosReis/Pizzaria | 6f4e6534385a3c179d155fd7efbaa427bc522965 | a5aff2f564860a05fe4454e4c711a3b7e3512fba | refs/heads/master | 2020-06-10T12:53:44.915550 | 2016-12-15T23:12:11 | 2016-12-15T23:12:11 | 75,959,157 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package br.com.univali.kob.poo.pizzaria.main;
import java.io.FileNotFoundException;
import br.com.univali.kob.poo.pizzaria.sistema.Pizzaria;
/**
*
* @author luizhenrique
*/
public class Main {
/**
* @param args the command line arguments
* @throws FileNotFoundException
*/
public static void main(String[] args) throws FileNotFoundException {
Pizzaria pizzaria = new Pizzaria(20);
pizzaria.executa();
}
}
| [
"caio.gaspar2@gmail.com"
] | caio.gaspar2@gmail.com |
fc1dcdaba4b9455eb6398a3b270ea5415c8e08d4 | 7ef99d97acd5af43256f90da23f7eabb2cef8e5d | /backend/src/main/java/com/codetris/dto/response/JwtResponse.java | b795a17694095ace4f950347cdae7c007e3c93a1 | [] | no_license | Fellway/Codetris | bed2b2953af0fdc436b08712917ff56d027e97bb | efa16115678b84bdb5e84c25b5de2ad566840e57 | refs/heads/master | 2023-07-27T21:02:11.795376 | 2021-09-10T22:41:08 | 2021-09-10T22:41:08 | 345,464,001 | 2 | 0 | null | 2021-05-08T11:17:08 | 2021-03-07T22:06:37 | JavaScript | UTF-8 | Java | false | false | 317 | java | package com.codetris.dto.response;
import lombok.Getter;
@Getter
public class JwtResponse {
private final String token;
private final String refreshToken;
public JwtResponse(final String token, final String refreshToken) {
this.token = token;
this.refreshToken = refreshToken;
}
}
| [
"mateusz.skrzypczyk1@hotmail.com"
] | mateusz.skrzypczyk1@hotmail.com |
180edd900f35b8ed2cf15933cb2181af3422b77e | ad42a78de75645689b6c972dc9721d04684b437a | /A0/src/InfixReader.java | e4d6977ae7c2f38647889fba45c0e800272cde60 | [] | no_license | alice86663766/Java_Projects | 523c23c70a625881b3430d201481d5f87557e2f0 | c4057e1cf793cd2ad1d966be7ebea972628da97e | refs/heads/master | 2021-01-22T05:01:12.009413 | 2017-09-03T16:13:19 | 2017-09-03T16:13:19 | 102,276,922 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,797 | java | import java.io.*;
/**
* The InfixReader class, used to convert infix to postfix.
* @author Chen Hung-Yu
*/
public class InfixReader {
public static void main(String[] args) {
InfixReader myAnswer = new InfixReader();
myAnswer.doConversion();
}
/**
* Compare precedency of input operator with the operator on the top of the stack.
* @param s The stack of operators
* @param op The operator that is now pointed to
* @return True if the input operator has a higher or equal precedency than the operator on the top of the stack.
* False if the input operator has a lower precedency or the input operator is parenthesis.
*/
public boolean opLarge(Stack s, String op) {
if (s.size() == 0) {
return true;
}
String top = s.top();
if (top.equals(op)) {
return false;
}
if (top.equals("^") || op.equals("+") || op.equals("-")) {
return false;
}
if ((op.equals("*") || op.equals("/")) && (top.equals("*") || top.equals("/"))) {
return false;
}
if (op.equals("(") || op.equals(")")) {
return false;
}
return true;
}
/**
* Convert infix to postfix and print out the postfix.
*/
public void doConversion() {
// TODO: read infix from input using readInfix(), then convert it to postfix and print it out
String[] input = this.readInfix();
Stack s = new Stack(input.length);
for (int i = 0; i < input.length; i++) {
if (input[i].equals("+") || input[i].equals("-") || input[i].equals("*") || input[i].equals("/") || input[i].equals("^") || input[i].equals("(") || input[i].equals(")")) {
if (opLarge(s, input[i]) || input[i].equals("(")) {
s.push(input[i]);
}
else {
if (input[i].equals(")")) {
while(s.size() != 0 && !s.top().equals("(")) {
System.out.print(s.pop() + " ");
}
s.pop();
}
else {
while(s.size() != 0 && !s.top().equals("(") && !opLarge(s, input[i])) {
System.out.print(s.pop() + " ");
}
s.push(input[i]);
}
}
}
else {
System.out.print(input[i] + " ");
}
}
while(s.size() != 0) {
System.out.print(s.pop() + " ");
}
}
/**
* Read the input infix.
* @return the input infix as an array of numbers and operators
*/
private String [] readInfix() {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String inputLine;
try {
System.out.print("Please input infix: ");
inputLine = input.readLine();
return inputLine.split(" ");
} catch (IOException e) {
System.err.println("Input ERROR.");
}
// return empty array if error occurs
return new String[] { };
}
}
/**
* The Stack class, used as stack for operators.
* @author Chen Hung-Yu
*
*/
class Stack {
// TODO: implement Stack in this class
private String[] stack;
private int size;
private int top_p;
/**
* Create a Stack object.
* @param s the maximum size of the stack
*/
public Stack(int s) {
size = s;
stack = new String[size];
top_p = -1;
}
/**
* Push an item to stack.
* @param item the operator string to be pushed onto the stack.
*/
public void push(String item) {
top_p = top_p + 1;
stack[top_p] = item;
}
/**
* Pop out the item on the top of the stack.
* @return the item on the top of the stack.
*/
public String pop() {
top_p = top_p - 1;
return stack[top_p + 1];
}
/**
* Access the item on the top of the stack.
* @return the item on the top of the stack.
*/
public String top() {
return stack[top_p];
}
/**
* Get the current size of the stack.
* @return the current size of the stack.
*/
public int size() {
return top_p + 1;
}
}
| [
"alice86663766@Alicede-MacBook-Pro.local"
] | alice86663766@Alicede-MacBook-Pro.local |
b2eacc210b6ae32cb3a7b891809e6255e4a6a0f1 | b59fa02726aa24412758ac9eedde727ef331a4dd | /dialogue-futures/src/main/java/com/palantir/dialogue/futures/DialogueDirectAsyncTransformationFuture.java | 5b21ef7c3bf7b1415cc4508290bbb37523359ca9 | [
"Apache-2.0"
] | permissive | palantir/dialogue | 374ad750c28e6b2d9c6e946850c7c6be5490a37c | d657ee0832041991b1fe1e162b9f36d148281d84 | refs/heads/develop | 2023-09-03T13:05:34.457651 | 2023-09-02T01:07:32 | 2023-09-02T01:07:32 | 164,943,450 | 25 | 13 | Apache-2.0 | 2023-09-14T15:29:28 | 2019-01-09T21:49:50 | Java | UTF-8 | Java | false | false | 3,450 | java | /*
* (c) Copyright 2020 Palantir Technologies Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.palantir.dialogue.futures;
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
/**
* This {@link ListenableFuture} implementation differs from
* {@link Futures#transformAsync(ListenableFuture, AsyncFunction, Executor)}
* in two ways:
* Firstly, it only allows transformations on the same thread. Second, calling cancel on this future
* does not allow the input future to successfully set a result while this future reports cancellation.
*
* Note that this means it's possible for a cancel invocation to return false and fail to terminate the future,
* which allows dialogue to close responses properly without leaking resources.
*/
final class DialogueDirectAsyncTransformationFuture<I, O> implements ListenableFuture<O>, Runnable {
private volatile ListenableFuture<?> currentFuture;
private final ListenableFuture<O> output;
@SuppressWarnings("unchecked")
DialogueDirectAsyncTransformationFuture(ListenableFuture<I> input, AsyncFunction<? super I, ? extends O> function) {
this.currentFuture = input;
this.output = Futures.transformAsync(
input,
result -> {
ListenableFuture<O> future = (ListenableFuture<O>) function.apply(result);
currentFuture = future;
return future;
},
DialogueFutures.safeDirectExecutor());
output.addListener(this, DialogueFutures.safeDirectExecutor());
}
@Override
public void addListener(Runnable listener, Executor executor) {
output.addListener(listener, executor);
}
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
ListenableFuture<?> snapshot = currentFuture;
return snapshot.cancel(mayInterruptIfRunning);
}
@Override
public boolean isCancelled() {
ListenableFuture<?> snapshot = currentFuture;
return snapshot.isCancelled();
}
@Override
public boolean isDone() {
return output.isDone();
}
@Override
public O get() throws InterruptedException, ExecutionException {
return output.get();
}
@Override
public O get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return output.get(timeout, unit);
}
/** Output completion listener. When the output future is completed, previous futures can be garbage collected. */
@Override
public void run() {
this.currentFuture = output;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
dbbf0352cde50c2d1d2461eb97cce93e0df6100f | bba500de85a63191717c1c883ed6186863d7eeb9 | /app/src/main/java/swcontest/dwu/blooming/db/UserDBHelper.java | 7c96a139de3d607c5f520bc655744096ffae4416 | [] | no_license | sion0305/Blooming | 258315426d2116d5d15ded67369bd81ad9583039 | cd27864dc754add75a60136fda94b7604246cefe | refs/heads/master | 2023-08-11T13:43:11.180715 | 2021-09-09T12:30:13 | 2021-09-09T12:30:13 | 389,601,906 | 0 | 3 | null | 2021-07-28T08:02:20 | 2021-07-26T10:59:09 | Java | UTF-8 | Java | false | false | 1,650 | java | package swcontest.dwu.blooming.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import java.util.Date;
public class UserDBHelper extends SQLiteOpenHelper {
final static String DB_NAME = "user.db";
public final static String TABLE_NAME = "user_table";
public final static String COL_ID = "_id";
public final static String COL_NAME = "name";
public final static String COL_MONTH = "month";
public final static String COL_DAY = "day";
public final static String COL_YEAR = "year";
public final static String COL_ADDRESS = "address";
public final static String COL_PERIOD = "period";
public final static String COL_WAKE = "wake";
public final static String COL_SLEEP = "sleep";
public final static String COL_PHONE = "phone";
public UserDBHelper(Context context){
super(context, DB_NAME, null, 1);
}
@Override
public void onCreate(SQLiteDatabase db) {
String sql = "CREATE TABLE " + TABLE_NAME + " (" + COL_ID + " integer primary key autoincrement, " +
COL_NAME + " TEXT, " + COL_YEAR + " INTEGER, " + COL_MONTH + " INTEGER, " + COL_DAY + " INTEGER, " +
COL_ADDRESS + " TEXT, " + COL_PERIOD + " INTEGER, " + COL_WAKE + " TEXT, " + COL_SLEEP + " TEXT, " + COL_PHONE + " TEXT)";
Log.d("UserDBHelper", sql);
db.execSQL(sql);
}
@Override
public void onUpgrade(SQLiteDatabase db, int i, int i1) {
db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME);
onCreate(db);
}
}
| [
"yny026@gmail.com"
] | yny026@gmail.com |
e424288315e975c44e5d81b5155ee04ad7c3faf0 | f889af881f82505aa2fd10c0918129ffe3833142 | /app/src/main/java/com/example/lenovo/myfinance/Model/Category.java | 882b8ef2bcf5e6315a11383fa77ad843c34ff378 | [] | no_license | suyashratna/myfi | 12bda12171fcb14c48f0dbf67901ae820b9200e5 | 817984b70d9ba9713feff70d10f11b016be070b8 | refs/heads/master | 2021-09-14T07:18:17.807691 | 2018-05-09T13:50:30 | 2018-05-09T13:50:30 | 121,462,036 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,822 | java | package com.example.lenovo.myfinance.Model;
/**
* Created by lenovo on 3/18/2018.
*/
public class Category {
Long category_id;
String category_image;
String category_name;
String category_type;
String category_amount;
String category_saving;
public Category(Long category_id, String category_image, String category_name, String category_type, String category_amount, String category_saving) {
this.category_id = category_id;
this.category_image = category_image;
this.category_name = category_name;
this.category_type = category_type;
this.category_amount = category_amount;
this.category_saving = category_saving;
}
public Long getCategory_id() {
return category_id;
}
public void setCategory_id(Long category_id) {
this.category_id = category_id;
}
public String getCategory_image() {
return category_image;
}
public void setCategory_image(String category_image) {
this.category_image = category_image;
}
public String getCategory_name() {
return category_name;
}
public void setCategory_name(String category_name) {
this.category_name = category_name;
}
public String getCategory_type() {
return category_type;
}
public void setCategory_type(String category_type) {
this.category_type = category_type;
}
public String getCategory_amount() {
return category_amount;
}
public void setCategory_amount(String category_amount) {
this.category_amount = category_amount;
}
public String getCategory_saving() {
return category_saving;
}
public void setCategory_saving(String category_saving) {
this.category_saving = category_saving;
}
}
| [
"suyashratna96@gmail.com"
] | suyashratna96@gmail.com |
e84d0f685a9721cf06ee77bb077a0edc8c87dcc2 | 1697984fcacbb72130ea8db8763180d07f3b533d | /PriorityQueue_With_CommandPatterns/src/test/java/TestTheTests/TestPriorityQueueTest/TestSetupTests.java | 41426e9adedc5eef2397e4aab86b78d174602576 | [] | no_license | j-fitzgerald/CommandPattern-PriorityQueue | b9bb914b0123d0185fb62220d61bd534def0312c | e0e976db94b104b606b7cb055d1be922fc16d49b | refs/heads/master | 2020-03-30T20:58:44.769879 | 2018-10-04T18:18:19 | 2018-10-04T18:18:19 | 151,612,126 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,100 | java | package TestTheTests.TestPriorityQueueTest;
import jsf.PriorityQueue;
import jsf.Student;
public class TestSetupTests {
PriorityQueue<Student> priorityQueue;
Student veryLowPriority, lowPriority, mediumPriority,
highPriority, veryHighPriority, zeroPriority, maxPriority;
@org.junit.jupiter.api.BeforeEach
void setUp() {
priorityQueue = new PriorityQueue<Student>
(((Student s1, Student s2) ->
(s1.getPriority() > s2.getPriority()) ? -1 : 1));
zeroPriority = new Student("zero", 123, "zeroEmail", 0, 0.0);
veryLowPriority =
new Student("veryLow", 123, "veryLowEmail", 10, 0.5);
lowPriority = new Student("Low", 123, "LowEmail", 25, 1.0);
mediumPriority = new Student("Med", 123, "MedEmail", 50, 2.0);
highPriority =
new Student("High", 123, "HighEmail", 75, 3.0);
veryHighPriority =
new Student("veryHigh", 123,
"veryHighEmail", 100, 4.0);
maxPriority = new Student("max", 123, "maxEmail", 150, 4.0);
}
}
| [
"james.s.fitzgerald@outlook.com"
] | james.s.fitzgerald@outlook.com |
92b8dd1367fb1d32d9a5bc17403823b3b80ce8ca | ac158a8502fa95011f27ff2a138f0c543b28f677 | /OAI-PMHHarvester/src/org/xmlsoap/schemas/soap/encoding/Boolean.java | 527b11b7426f94f6c25477eed5ae605c96598064 | [] | no_license | vkalokyri/SOAP-OAI-PMH | a068fdecb66ee6c28f4324b3da12765d5ec16d42 | 2c80e0a37ded7bbbb75542ce3cbff6eeee96a622 | refs/heads/master | 2022-11-26T14:32:39.447262 | 2020-07-27T23:19:55 | 2020-07-27T23:19:55 | 283,038,160 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,079 | java | /*
* XML Type: boolean
* Namespace: http://schemas.xmlsoap.org/soap/encoding/
* Java type: org.xmlsoap.schemas.soap.encoding.Boolean
*
* Automatically generated - do not modify.
*/
package org.xmlsoap.schemas.soap.encoding;
/**
* An XML boolean(@http://schemas.xmlsoap.org/soap/encoding/).
*
* This is an atomic type that is a restriction of org.xmlsoap.schemas.soap.encoding.Boolean.
*/
public interface Boolean extends org.apache.xmlbeans.XmlBoolean
{
public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(Boolean.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.sFACEC922E044F47C2BCCEF7F9AF312FA").resolveHandle("boolean183ctype");
/**
* Gets the "id" attribute
*/
java.lang.String getId();
/**
* Gets (as xml) the "id" attribute
*/
org.apache.xmlbeans.XmlID xgetId();
/**
* True if has "id" attribute
*/
boolean isSetId();
/**
* Sets the "id" attribute
*/
void setId(java.lang.String id);
/**
* Sets (as xml) the "id" attribute
*/
void xsetId(org.apache.xmlbeans.XmlID id);
/**
* Unsets the "id" attribute
*/
void unsetId();
/**
* Gets the "href" attribute
*/
java.lang.String getHref();
/**
* Gets (as xml) the "href" attribute
*/
org.apache.xmlbeans.XmlAnyURI xgetHref();
/**
* True if has "href" attribute
*/
boolean isSetHref();
/**
* Sets the "href" attribute
*/
void setHref(java.lang.String href);
/**
* Sets (as xml) the "href" attribute
*/
void xsetHref(org.apache.xmlbeans.XmlAnyURI href);
/**
* Unsets the "href" attribute
*/
void unsetHref();
/**
* A factory class with static methods for creating instances
* of this type.
*/
public static final class Factory
{
public static org.xmlsoap.schemas.soap.encoding.Boolean newInstance() {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean newInstance(org.apache.xmlbeans.XmlOptions options) {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newInstance( type, options ); }
/** @param xmlAsString the string value to parse */
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.lang.String xmlAsString) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.lang.String xmlAsString, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xmlAsString, type, options ); }
/** @param file the file from which to load an xml document */
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.io.File file) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.io.File file, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( file, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.net.URL u) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.net.URL u, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( u, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.io.InputStream is) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.io.InputStream is, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( is, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.io.Reader r) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(java.io.Reader r, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, java.io.IOException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( r, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(javax.xml.stream.XMLStreamReader sr) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(javax.xml.stream.XMLStreamReader sr, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( sr, type, options ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(org.w3c.dom.Node node) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, null ); }
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(org.w3c.dom.Node node, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( node, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.xmlsoap.schemas.soap.encoding.Boolean parse(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return (org.xmlsoap.schemas.soap.encoding.Boolean) org.apache.xmlbeans.XmlBeans.getContextTypeLoader().parse( xis, type, options ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, null ); }
/** @deprecated {@link org.apache.xmlbeans.xml.stream.XMLInputStream} */
public static org.apache.xmlbeans.xml.stream.XMLInputStream newValidatingXMLInputStream(org.apache.xmlbeans.xml.stream.XMLInputStream xis, org.apache.xmlbeans.XmlOptions options) throws org.apache.xmlbeans.XmlException, org.apache.xmlbeans.xml.stream.XMLStreamException {
return org.apache.xmlbeans.XmlBeans.getContextTypeLoader().newValidatingXMLInputStream( xis, type, options ); }
private Factory() { } // No instance of this class allowed
}
}
| [
"suitcase@Valias-MBP.home"
] | suitcase@Valias-MBP.home |
bea0342a7f3b13ee1c31e74e6e59015ce3b93de5 | ef6e41914df4c7864f6100642c791a8b73c10d7f | /cloud-payment-hystrix-provider8001/src/main/java/com/ccb/springcloud/PaymentHystrixMain8001.java | bb7371e4b1870f740e48be04d53e8fee744f1cf5 | [] | no_license | 2568808909/SpringCloudDemo | 465ac2788e38f3001a4921d817783d6ff8cf11c4 | 8723544222b891307876bf40e1d57ef611c12196 | refs/heads/master | 2022-07-18T18:46:12.168200 | 2020-04-06T13:46:41 | 2020-04-06T13:46:41 | 246,804,742 | 0 | 0 | null | 2022-06-21T02:58:35 | 2020-03-12T10:20:59 | Java | UTF-8 | Java | false | false | 1,379 | java | package com.ccb.springcloud;
import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
@EnableDiscoveryClient
@EnableCircuitBreaker
public class PaymentHystrixMain8001 {
public static void main(String[] args) {
SpringApplication.run(PaymentHystrixMain8001.class, args);
}
//要在启动类中加上这个Bean的配置,不然使用Hystrix Dashboard进行监控时就会报错
//Unable to connect to Command Metric Stream.
@Bean
public ServletRegistrationBean getServletBean() {
HystrixMetricsStreamServlet streamServlet = new HystrixMetricsStreamServlet();
ServletRegistrationBean<HystrixMetricsStreamServlet> registrationBean = new ServletRegistrationBean<>(streamServlet);
registrationBean.setLoadOnStartup(1);
registrationBean.addUrlMappings("/hystrix.stream");
registrationBean.setName("HystrixMetricsStreamServlet");
return registrationBean;
}
}
| [
"2568808909@qq.com"
] | 2568808909@qq.com |
4c00a1d2f583b376335115f5ced2e30fa7a8f5c1 | d7faa9e96cc1bb7a3be39b8aa5938bb80ce2fe8f | /src/algorithm_sort/QuickSort2.java | 8b88fbbefded439c2f988065026198fc62f3b1be | [] | no_license | gbyman/Algorithm_exercise | e6b5cbb040a64f777d2178557c4d725fc21819f1 | eff1e98685eb0f0e5107c6e5706d322750e3c4ca | refs/heads/master | 2020-05-18T23:14:22.892752 | 2019-05-03T06:34:05 | 2019-05-03T06:34:05 | 184,707,818 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 1,974 | java | package algorithm_sort;
//퀵 소트(비재귀 버전)
public class QuickSort2 {
//partition 메소드는 QuickSort1과 같다
// 배열 a[1] ~ a[r]을 분할한다. 추축의 첨자를 반환
private static int partition(int[] a, int l, int r) {
//포인터 i와 j를 초기화한다
int i = l - 1;
int j = r;
//오른쪽 끝 요소를 추축으로 한다
int pivot = a[r];
//포인터 i와 j가 충돌할 때까지 반복한다
for(;;) {
//포인터 i를 오른쪽으로 이동시킨다
while(a[++i] < pivot);
//포인터 j를 왼쪽으로 이동시킨다
while(i < --j && pivot < a[j]);
//포인터 i와 j가 충돌하면 루프를 빠져나간다
if(i >= j) {
break;
}
//i가 가리키는 요소와 j가 가리키는 요소를 교환한다
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
//a[i]와 추축을 교환한다
int temp = a[i];
a[i] = a[j];
a[r] = temp;
return i;
}
// 퀵 소트를 이용하여 배열을 정렬한다
//
// @param a 정렬할 배열
public static void sort(int[] a) {
int n = a.length;
int[] low = new int[30];
int[] high = new int[30];
int sp;
//스택을 초기화한다
low[0] = 0;
high[0] = n - 1;
sp = 1;
//스택이 빌 때가지 반복한다
while(sp > 0) {
//스택에서 정렬할 범위를 꺼낸다
int l = low[--sp];
int r = high[sp];
//정렬할 요소가 하나라면 아무것도 하지 않는다
//(다시 while 문을 실행한다)
if(l >= r) {
//아무것도 하지 않는다
} else {
//추축 v를 기준으로 분할한다
int v = partition(a, l, r);
//왼쪽, 오른쪽 순서로 부분 배열을 정렬한다
//(스택이기 때문에, "오른쪽 -> 왼쪽"순으로 쌓는 것에 주의)
low[sp] = v + 1;
high[sp++] = r;
low[sp] = l;
high[sp++] = v - 1;
}
}
}
}
| [
"dongchan-2@hanmail.net"
] | dongchan-2@hanmail.net |
bafd64f94687a006a2b14956daff0712cb4eba0a | ed6cd7cf01e48d56b88110bae39c658320b54218 | /Database/src/main/java/db/Inserter.java | 3e40d83045435e96e3fd93875eed3cb23893c79b | [] | no_license | RecuencoJones/STW-P5 | 35eef441bcc9036c08e8bd0ca2a3d489fc938a89 | 2a7986e183437b968d9682ac9a3ca7567816b8e1 | refs/heads/master | 2021-01-23T10:44:00.438082 | 2015-04-07T19:41:20 | 2015-04-07T19:41:20 | 33,548,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 845 | java | package db;
import db.dao.IntervaloDAO;
import db.dao.PrediccionDAO;
import db.datos.Periodo;
import db.datos.PrediccionSemana;
import java.sql.SQLException;
/**
* Created by david on 06/04/2015.
*/
public class Inserter {
public static boolean guardar(String filename, PrediccionSemana prediccionSemana) throws SQLException {
// Insertar valores de Intervalos
IntervaloDAO idao = new IntervaloDAO();
idao.setConnection(ConnectionAdmin.getConnection());
for(Periodo.Interval intervalo : Periodo.Interval.values()){
idao.guardarIntervalo(intervalo);
}
// Insertar predicción
PrediccionDAO pdao = new PrediccionDAO();
pdao.setConnection(ConnectionAdmin.getConnection());
return pdao.guardarPrediccion(filename, prediccionSemana);
}
}
| [
"david.recuencogadea@gmail.com"
] | david.recuencogadea@gmail.com |
25916f98c34b5442cf0006ebc7248de14cf55c49 | a1b7e630dcbcc72d89ad155c7d6a2f5b25a5233b | /JavaSE-8/src/tr/com/cihan/java/jse8/lambda/Lambda2.java | 45b57b440e12087af361b97c18c6eafe7c093962 | [] | no_license | cihanbulut1979/java-examples | b5768f8c0698aeadf2595318dce28bb148d16d19 | 419f7ac15f73eef6da7a3ec5c14582a9dba10aa9 | refs/heads/master | 2021-11-26T02:25:50.320196 | 2021-11-11T13:01:14 | 2021-11-11T13:01:14 | 169,397,011 | 1 | 0 | null | null | null | null | ISO-8859-9 | Java | false | false | 361 | java | package tr.com.cihan.java.jse8.lambda;
public class Lambda2 {
public static void main(String[] args) {
Bar bar = new Bar();
int sonuc = bar.calculate((x, y) -> (2 * x + y), 3, 4);
System.out.println("Sonuç: " + sonuc); // Çıktı: 10
}
}
class Bar {
public int calculate(Foo foo, int x, int y) {
return foo.apply(x, y);
}
} | [
"cihan.bulut.1979@gmail.com"
] | cihan.bulut.1979@gmail.com |
f8f6d1f0b093604300b71dd9714f3a21caba725d | 35860dce4cbe900d57bad14b67ab39abea7c1b48 | /leetcode/recursion/KthGrammar/Solution.java | 406aada600c4385aae2fbc04d7385dd908ec0098 | [] | no_license | youngkih/algorithm-problems | edeea04c23cb74c25ae054951d402b9f01572311 | 2609f1e30bb7bedfedf90aad2c6e59a29980b5cc | refs/heads/master | 2022-12-16T10:37:08.301577 | 2020-09-02T11:15:44 | 2020-09-02T11:15:44 | 282,792,543 | 0 | 0 | null | 2020-07-27T04:35:38 | 2020-07-27T04:19:18 | null | UTF-8 | Java | false | false | 763 | java | package recursion.KthGrammar;
// Problem: https://leetcode.com/explore/learn/card/recursion-i/253/conclusion/1675/
class Solution {
public int kthGrammar(int N, int K) {
// Base case
if(N==1)
return 0;
if(N==2){
if(K==1)
return 0;
if(K==2)
return 1;
}
int res;
if(K % 2 == 0){
res = kthGrammar(N-1, K/2);
if(res == 0){
return 1;
}else{
return 0;
}
}else{
res = kthGrammar(N-1, K/2 + 1); // Round up column value
if(res == 0){
return 0;
}else{
return 1;
}
}
}
} | [
"youngkih21@gmail.com"
] | youngkih21@gmail.com |
3a6b9889d3f9f4ee7086156d0c25398b8ac9f35f | 932b7d3d0029bf0897d0afa6bc721e98aa48cf5b | /src/main/java/com/wuhan/City.java | b4c345f919a3c8aa09f1fa0f2a9e18c7566ed7d1 | [] | no_license | wy19940706/wenyao-study-demo | 8b8a98b2ac59502f0b149c16badff0329e04b2b4 | 58dc8454c2274b97667316ff2849805645c718a5 | refs/heads/master | 2022-06-24T06:22:43.186822 | 2021-03-15T14:32:23 | 2021-06-25T08:39:19 | 202,165,885 | 0 | 0 | null | 2022-06-17T02:21:56 | 2019-08-13T14:49:14 | Java | UTF-8 | Java | false | false | 638 | java | package com.wuhan;
/**
* 城市描述对象
*
* @ClassName: City
* @Description: 城市描述对象
* @author: Bruce Young
* @date: 2020年02月02日 17:48
*/
public class City {
private int centerX;
private int centerY;
public City(int centerX, int centerY) {
this.centerX = centerX;
this.centerY = centerY;
}
public int getCenterX() {
return centerX;
}
public void setCenterX(int centerX) {
this.centerX = centerX;
}
public int getCenterY() {
return centerY;
}
public void setCenterY(int centerY) {
this.centerY = centerY;
}
}
| [
"wenyao@haixue.com"
] | wenyao@haixue.com |
a16011840920dad4701e28421c77080c8c14175e | 044b0c61738dc64308379d02dbaeaaa3d6e79d76 | /com.munch.exchange.optimization/src/demos/org/goataa/trees/math/real/sr/SRObjectiveFunction1.java | b60b1e1dc4661c8056ab5d5a7d1e8eabe13e8eff | [] | no_license | KanchanV/ExChange | 049640abda8922db73d3e8c03574473cfd3bc74b | 11724d6b040b44340dc6a90e618fe2f7deb8bcd8 | refs/heads/master | 2021-01-18T00:42:59.152363 | 2014-10-27T16:34:39 | 2014-10-27T16:34:39 | 25,905,405 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,279 | java | // Copyright (c) 2010 Thomas Weise (http://www.it-weise.de/, tweise@gmx.de)
// GNU LESSER GENERAL PUBLIC LICENSE (Version 2.1, February 1999)
package demos.org.goataa.trees.math.real.sr;
import java.util.Random;
import org.goataa.impl.OptimizationModule;
import org.goataa.impl.searchSpaces.trees.math.real.RealContext;
import org.goataa.impl.searchSpaces.trees.math.real.RealFunction;
import org.goataa.impl.utils.Constants;
import org.goataa.spec.IObjectiveFunction;
/**
* An objective RealFunction for Symbolic Regression which evaluates a
* program on basis of test cases. It incorporates the approximation
* accuracy of the program into the fitness as well as its size.
*
* @author Thomas Weise
*/
public class SRObjectiveFunction1 extends OptimizationModule implements
IObjectiveFunction<RealFunction> {
/** a constant required by Java serialization */
private static final long serialVersionUID = 1;
/** the training data */
private final TrainingCase[] tc;
/** the real context */
private final RealContext rc;
/**
* Create a new instance of the symbolic regression objective
* RealFunction.
*
* @param t
* the training case
*/
public SRObjectiveFunction1(final TrainingCase[] t) {
super();
this.tc = t;
this.rc = new RealContext(10000, t[0].data.length);
}
/**
* Compute the objective value, i.e., determine the utility of the
* solution candidate x as specified in
* Definition D2.3.
*
* @param x
* the phenotype to be rated
* @param r
* the randomizer
* @return the objective value of x, the lower the better (see
* Section 6.3.4)
*/
public double compute(final RealFunction x, final Random r) {
TrainingCase[] y;
int i;
TrainingCase q;
double res, v;
RealContext c;
res = 0d;
y = this.tc;
c = this.rc;
for (i = y.length; (--i) >= 0;) {
q = y[i];
c.beginProgram();
c.copy(q.data);
v = (q.result - x.compute(c));
res += (v * v);
c.endProgram();
}
if (Double.isInfinite(res) || Double.isNaN(res)) {
return Constants.WORST_OBJECTIVE;
}
return res;
}
} | [
"pemunch@hotmail.com"
] | pemunch@hotmail.com |
4a1478d0b3da8eb99aa9d8460e4da4b233b2160c | 55dd60fe01ee88deda273f9ab1e3616e390b2d5b | /JDK1.8/src/java/util/concurrent/BlockingQueue.java | 3229dba9b4485ba1eb8829b5b099c54b2fccd345 | [] | no_license | wanghengGit/JDK-1 | d7c1a86ecadb2590c8d58a23c47fdd7ebfcc3a66 | 1be52fd27316c82e06296dbdd25e41ad3da37d12 | refs/heads/master | 2021-09-10T07:23:17.576037 | 2021-09-09T07:19:16 | 2021-09-09T07:19:16 | 202,044,942 | 0 | 0 | null | 2019-08-13T02:13:35 | 2019-08-13T02:13:34 | null | UTF-8 | Java | false | false | 16,215 | java | /*
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
/*
*
*
*
*
*
* Written by Doug Lea with assistance from members of JCP JSR-166
* Expert Group and released to the public domain, as explained at
* http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util.concurrent;
import java.util.Collection;
import java.util.Queue;
/**
* A {@link java.util.Queue} that additionally supports operations
* that wait for the queue to become non-empty when retrieving an
* element, and wait for space to become available in the queue when
* storing an element.
*
* <p>{@code BlockingQueue} methods come in four forms, with different ways
* of handling operations that cannot be satisfied immediately, but may be
* satisfied at some point in the future:
* one throws an exception, the second returns a special value (either
* {@code null} or {@code false}, depending on the operation), the third
* blocks the current thread indefinitely until the operation can succeed,
* and the fourth blocks for only a given maximum time limit before giving
* up. These methods are summarized in the following table:
*
* <table BORDER CELLPADDING=3 CELLSPACING=1>
* <caption>Summary of BlockingQueue methods</caption>
* <tr>
* <td></td>
* <td ALIGN=CENTER><em>Throws exception</em></td>
* <td ALIGN=CENTER><em>Special value</em></td>
* <td ALIGN=CENTER><em>Blocks</em></td>
* <td ALIGN=CENTER><em>Times out</em></td>
* </tr>
* <tr>
* <td><b>Insert</b></td>
* <td>{@link #add add(e)}</td>
* <td>{@link #offer offer(e)}</td>
* <td>{@link #put put(e)}</td>
* <td>{@link #offer(Object, long, TimeUnit) offer(e, time, unit)}</td>
* </tr>
* <tr>
* <td><b>Remove</b></td>
* <td>{@link #remove remove()}</td>
* <td>{@link #poll poll()}</td>
* <td>{@link #take take()}</td>
* <td>{@link #poll(long, TimeUnit) poll(time, unit)}</td>
* </tr>
* <tr>
* <td><b>Examine</b></td>
* <td>{@link #element element()}</td>
* <td>{@link #peek peek()}</td>
* <td><em>not applicable</em></td>
* <td><em>not applicable</em></td>
* </tr>
* </table>
*
* <p>A {@code BlockingQueue} does not accept {@code null} elements.
* Implementations throw {@code NullPointerException} on attempts
* to {@code add}, {@code put} or {@code offer} a {@code null}. A
* {@code null} is used as a sentinel value to indicate failure of
* {@code poll} operations.
*
* <p>A {@code BlockingQueue} may be capacity bounded. At any given
* time it may have a {@code remainingCapacity} beyond which no
* additional elements can be {@code put} without blocking.
* A {@code BlockingQueue} without any intrinsic capacity constraints always
* reports a remaining capacity of {@code Integer.MAX_VALUE}.
*
* <p>{@code BlockingQueue} implementations are designed to be used
* primarily for producer-consumer queues, but additionally support
* the {@link java.util.Collection} interface. So, for example, it is
* possible to remove an arbitrary element from a queue using
* {@code remove(x)}. However, such operations are in general
* <em>not</em> performed very efficiently, and are intended for only
* occasional use, such as when a queued message is cancelled.
*
* <p>{@code BlockingQueue} implementations are thread-safe. All
* queuing methods achieve their effects atomically using internal
* locks or other forms of concurrency control. However, the
* <em>bulk</em> Collection operations {@code addAll},
* {@code containsAll}, {@code retainAll} and {@code removeAll} are
* <em>not</em> necessarily performed atomically unless specified
* otherwise in an implementation. So it is possible, for example, for
* {@code addAll(c)} to fail (throwing an exception) after adding
* only some of the elements in {@code c}.
*
* <p>A {@code BlockingQueue} does <em>not</em> intrinsically support
* any kind of "close" or "shutdown" operation to
* indicate that no more items will be added. The needs and usage of
* such features tend to be implementation-dependent. For example, a
* common tactic is for producers to insert special
* <em>end-of-stream</em> or <em>poison</em> objects, that are
* interpreted accordingly when taken by consumers.
*
* <p>
* Usage example, based on a typical producer-consumer scenario.
* Note that a {@code BlockingQueue} can safely be used with multiple
* producers and multiple consumers.
* <pre> {@code
* class Producer implements Runnable {
* private final BlockingQueue queue;
* Producer(BlockingQueue q) { queue = q; }
* public void run() {
* try {
* while (true) { queue.put(produce()); }
* } catch (InterruptedException ex) { ... handle ...}
* }
* Object produce() { ... }
* }
*
* class Consumer implements Runnable {
* private final BlockingQueue queue;
* Consumer(BlockingQueue q) { queue = q; }
* public void run() {
* try {
* while (true) { consume(queue.take()); }
* } catch (InterruptedException ex) { ... handle ...}
* }
* void consume(Object x) { ... }
* }
*
* class Setup {
* void main() {
* BlockingQueue q = new SomeQueueImplementation();
* Producer p = new Producer(q);
* Consumer c1 = new Consumer(q);
* Consumer c2 = new Consumer(q);
* new Thread(p).start();
* new Thread(c1).start();
* new Thread(c2).start();
* }
* }}</pre>
*
* <p>Memory consistency effects: As with other concurrent
* collections, actions in a thread prior to placing an object into a
* {@code BlockingQueue}
* <a href="package-summary.html#MemoryVisibility"><i>happen-before</i></a>
* actions subsequent to the access or removal of that element from
* the {@code BlockingQueue} in another thread.
*
* <p>This interface is a member of the
* <a href="{@docRoot}/../technotes/guides/collections/index.html">
* Java Collections Framework</a>.
*
* @since 1.5
* @author Doug Lea
* @param <E> the type of elements held in this collection
* @date 20200411
* 主要实现类:ArrayBlockingQueue,LinkedBlockingQueue,PriorityBlockingQueue
*/
public interface BlockingQueue<E> extends Queue<E> {
/**
* Inserts the specified element into this queue if it is possible to do
* so immediately without violating capacity restrictions, returning
* {@code true} upon success and throwing an
* {@code IllegalStateException} if no space is currently available.
* When using a capacity-restricted queue, it is generally preferable to
* use {@link #offer(Object) offer}.
*
* @param e the element to add
* @return {@code true} (as specified by {@link Collection#add})
* @throws IllegalStateException if the element cannot be added at this
* time due to capacity restrictions
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
boolean add(E e);
/**
* Inserts the specified element into this queue if it is possible to do
* so immediately without violating capacity restrictions, returning
* {@code true} upon success and {@code false} if no space is currently
* available. When using a capacity-restricted queue, this method is
* generally preferable to {@link #add}, which can fail to insert an
* element only by throwing an exception.
*
* @param e the element to add
* @return {@code true} if the element was added to this queue, else
* {@code false}
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
boolean offer(E e);
/**
* Inserts the specified element into this queue, waiting if necessary
* for space to become available.
*
* @param e the element to add
* @throws InterruptedException if interrupted while waiting
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
void put(E e) throws InterruptedException;
/**
* Inserts the specified element into this queue, waiting up to the
* specified wait time if necessary for space to become available.
*
* @param e the element to add
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return {@code true} if successful, or {@code false} if
* the specified waiting time elapses before space is available
* @throws InterruptedException if interrupted while waiting
* @throws ClassCastException if the class of the specified element
* prevents it from being added to this queue
* @throws NullPointerException if the specified element is null
* @throws IllegalArgumentException if some property of the specified
* element prevents it from being added to this queue
*/
boolean offer(E e, long timeout, TimeUnit unit)
throws InterruptedException;
/**
* Retrieves and removes the head of this queue, waiting if necessary
* until an element becomes available.
*
* @return the head of this queue
* @throws InterruptedException if interrupted while waiting
*/
E take() throws InterruptedException;
/**
* Retrieves and removes the head of this queue, waiting up to the
* specified wait time if necessary for an element to become available.
*
* @param timeout how long to wait before giving up, in units of
* {@code unit}
* @param unit a {@code TimeUnit} determining how to interpret the
* {@code timeout} parameter
* @return the head of this queue, or {@code null} if the
* specified waiting time elapses before an element is available
* @throws InterruptedException if interrupted while waiting
*/
E poll(long timeout, TimeUnit unit)
throws InterruptedException;
/**
* Returns the number of additional elements that this queue can ideally
* (in the absence of memory or resource constraints) accept without
* blocking, or {@code Integer.MAX_VALUE} if there is no intrinsic
* limit.
*
* <p>Note that you <em>cannot</em> always tell if an attempt to insert
* an element will succeed by inspecting {@code remainingCapacity}
* because it may be the case that another thread is about to
* insert or remove an element.
*
* @return the remaining capacity
*/
int remainingCapacity();
/**
* Removes a single instance of the specified element from this queue,
* if it is present. More formally, removes an element {@code e} such
* that {@code o.equals(e)}, if this queue contains one or more such
* elements.
* Returns {@code true} if this queue contained the specified element
* (or equivalently, if this queue changed as a result of the call).
*
* @param o element to be removed from this queue, if present
* @return {@code true} if this queue changed as a result of the call
* @throws ClassCastException if the class of the specified element
* is incompatible with this queue
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
*/
boolean remove(Object o);
/**
* Returns {@code true} if this queue contains the specified element.
* More formally, returns {@code true} if and only if this queue contains
* at least one element {@code e} such that {@code o.equals(e)}.
*
* @param o object to be checked for containment in this queue
* @return {@code true} if this queue contains the specified element
* @throws ClassCastException if the class of the specified element
* is incompatible with this queue
* (<a href="../Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified element is null
* (<a href="../Collection.html#optional-restrictions">optional</a>)
*/
public boolean contains(Object o);
/**
* Removes all available elements from this queue and adds them
* to the given collection. This operation may be more
* efficient than repeatedly polling this queue. A failure
* encountered while attempting to add elements to
* collection {@code c} may result in elements being in neither,
* either or both collections when the associated exception is
* thrown. Attempts to drain a queue to itself result in
* {@code IllegalArgumentException}. Further, the behavior of
* this operation is undefined if the specified collection is
* modified while the operation is in progress.
*
* @param c the collection to transfer elements into
* @return the number of elements transferred
* @throws UnsupportedOperationException if addition of elements
* is not supported by the specified collection
* @throws ClassCastException if the class of an element of this queue
* prevents it from being added to the specified collection
* @throws NullPointerException if the specified collection is null
* @throws IllegalArgumentException if the specified collection is this
* queue, or some property of an element of this queue prevents
* it from being added to the specified collection
*/
int drainTo(Collection<? super E> c);
/**
* Removes at most the given number of available elements from
* this queue and adds them to the given collection. A failure
* encountered while attempting to add elements to
* collection {@code c} may result in elements being in neither,
* either or both collections when the associated exception is
* thrown. Attempts to drain a queue to itself result in
* {@code IllegalArgumentException}. Further, the behavior of
* this operation is undefined if the specified collection is
* modified while the operation is in progress.
*
* @param c the collection to transfer elements into
* @param maxElements the maximum number of elements to transfer
* @return the number of elements transferred
* @throws UnsupportedOperationException if addition of elements
* is not supported by the specified collection
* @throws ClassCastException if the class of an element of this queue
* prevents it from being added to the specified collection
* @throws NullPointerException if the specified collection is null
* @throws IllegalArgumentException if the specified collection is this
* queue, or some property of an element of this queue prevents
* it from being added to the specified collection
*/
int drainTo(Collection<? super E> c, int maxElements);
}
| [
"1012056369@qq.com"
] | 1012056369@qq.com |
7006c49f3361a4c54bb0dc3d487722399fd729f8 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /slb-20140515/src/main/java/com/aliyun/slb20140515/models/DescribeHighDefinationMonitorResponseBody.java | 89104e4d6ffa41f04147a24862c2e8df7ac74a77 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,746 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.slb20140515.models;
import com.aliyun.tea.*;
public class DescribeHighDefinationMonitorResponseBody extends TeaModel {
/**
* <p>The ID of the request.</p>
*/
@NameInMap("LogProject")
public String logProject;
@NameInMap("LogStore")
public String logStore;
/**
* <p>The operation that you want to perform. Set the value to **DescribeHighDefinationMonitor**.</p>
*/
@NameInMap("RequestId")
public String requestId;
@NameInMap("Success")
public String success;
public static DescribeHighDefinationMonitorResponseBody build(java.util.Map<String, ?> map) throws Exception {
DescribeHighDefinationMonitorResponseBody self = new DescribeHighDefinationMonitorResponseBody();
return TeaModel.build(map, self);
}
public DescribeHighDefinationMonitorResponseBody setLogProject(String logProject) {
this.logProject = logProject;
return this;
}
public String getLogProject() {
return this.logProject;
}
public DescribeHighDefinationMonitorResponseBody setLogStore(String logStore) {
this.logStore = logStore;
return this;
}
public String getLogStore() {
return this.logStore;
}
public DescribeHighDefinationMonitorResponseBody setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public String getRequestId() {
return this.requestId;
}
public DescribeHighDefinationMonitorResponseBody setSuccess(String success) {
this.success = success;
return this;
}
public String getSuccess() {
return this.success;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
216a65b6c09dc0f2d2372ffa2e6e984ac0358744 | 0ccbf91b11e5212b5179e9a1979362106f30fccd | /misc/instrumentation/parsers/cobol_85_plain/syntaxtree/AcceptStatement.java | 92a16527690a1930d255d4260a522f5b9e1e2b14 | [] | no_license | fmselab/codecover2 | e3161be22a1601a4aa00f2933fb7923074aea2ce | 9ad4be4b7e54c49716b71b3e81937404ab5af9c6 | refs/heads/master | 2023-02-21T05:22:00.372690 | 2021-03-08T22:04:17 | 2021-03-08T22:04:17 | 133,975,747 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,595 | java | //
// Generated by JTB 1.3.2
//
package org.codecover.instrumentation.cobol85.syntaxtree;
/**
* Grammar production:
* <PRE>
* f0 -> <ACCEPT>
* f1 -> Identifier()
* f2 -> [ <FROM> ( MnemonicName() | EnvironmentName() | <DATE> | <DAY> | <DAY_OF_WEEK> | <TIME> ) ]
* </PRE>
*/
public class AcceptStatement implements Node {
private Node parent;
public NodeToken f0;
public Identifier f1;
public NodeOptional f2;
public AcceptStatement(NodeToken n0, Identifier n1, NodeOptional n2) {
f0 = n0;
if ( f0 != null ) f0.setParent(this);
f1 = n1;
if ( f1 != null ) f1.setParent(this);
f2 = n2;
if ( f2 != null ) f2.setParent(this);
}
public AcceptStatement(Identifier n0, NodeOptional n1) {
f0 = new NodeToken("accept");
if ( f0 != null ) f0.setParent(this);
f1 = n0;
if ( f1 != null ) f1.setParent(this);
f2 = n1;
if ( f2 != null ) f2.setParent(this);
}
public void accept(org.codecover.instrumentation.cobol85.visitor.Visitor v) {
v.visit(this);
}
public <R,A> R accept(org.codecover.instrumentation.cobol85.visitor.GJVisitor<R,A> v, A argu) {
return v.visit(this,argu);
}
public <R> R accept(org.codecover.instrumentation.cobol85.visitor.GJNoArguVisitor<R> v) {
return v.visit(this);
}
public <A> void accept(org.codecover.instrumentation.cobol85.visitor.GJVoidVisitor<A> v, A argu) {
v.visit(this,argu);
}
public void setParent(Node n) { parent = n; }
public Node getParent() { return parent; }
}
| [
"angelo.gargantini@unibg.it"
] | angelo.gargantini@unibg.it |
b10783335da5a44e67ee65c8cbfc46f67ecf6278 | 39c94cfe8225176c3502537a77e94e52479d3551 | /myjavabase/src/com/stjia/javabase/masterworker/Master.java | d74218bba301c6c52fb1e66d62a59644721bf9ab | [] | no_license | hellojst/myjava | 5f715e957660b3166e81fc1585b9ca60976307d4 | d8d0c31897ed213b5e6cc8dcead01247178e271d | refs/heads/master | 2021-04-09T16:00:12.830437 | 2018-06-18T15:16:58 | 2018-06-18T15:16:58 | 125,636,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,462 | java | package com.stjia.javabase.masterworker;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
public class Master {
//任务队列
protected Queue<Object> workQueue = new ConcurrentLinkedQueue<>();
//Worker队列
protected Map<String, Thread> threadMap = new HashMap<>();
//子任务处理结果集
protected Map<String, Object> resultMap = new ConcurrentHashMap<>();
public Master(Worker worker, int workerCount) {
//将每个小任务放到任务队列中去
worker.setWorkQueue(workQueue);
worker.setResultMap(resultMap);
for (int i = 0; i < workerCount; i++) {
threadMap.put(Integer.toString(i), new Thread(worker, Integer.toString(i)));
}
}
public boolean isAllComplete() {
for (Entry<String, Thread> entry : threadMap.entrySet()) {
if (entry.getValue().getState() != Thread.State.TERMINATED) {
return false;
}
}
return true;
}
public void submit(Object object) {
workQueue.add(object);
}
public void execute() {
for (Entry<String, Thread> entry : threadMap.entrySet()) {
entry.getValue().start();
System.out.println("线程--" + entry.getValue().getName() + ":启动");
}
}
public Map<String, Object> getResultMap() {
return resultMap;
}
public void setResultMap(Map<String, Object> resultMap) {
this.resultMap = resultMap;
}
}
| [
"shtjia@163.com"
] | shtjia@163.com |
46e370a297094434c8dafe672c726161284b22ff | 940d2db3ecdfb529b634c88c975612ee654b2a39 | /app/src/main/java/wigdet/adapters/AbstractWheelTextAdapter.java | bc442c09d74f4c7cf7d4e84ae342bc8b734d925a | [] | no_license | yyc6640/AT_android | 5d10980c347bece4c37061f3dc88cf0e7a605a86 | e0bd21db1740094e9b96ea3563da349f8f4d99e0 | refs/heads/master | 2023-03-27T07:04:27.909967 | 2018-01-18T13:56:16 | 2018-01-18T13:56:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,667 | java | package wigdet.adapters;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
/**
* Abstract wheel com.example.administrator.atandroid.adapter provides common functionality for adapters.
*/
public abstract class AbstractWheelTextAdapter extends AbstractWheelAdapter {
/** Text view resource. Used as a default view for com.example.administrator.atandroid.adapter. */
public static final int TEXT_VIEW_ITEM_RESOURCE = -1;
/** No resource constant. */
protected static final int NO_RESOURCE = 0;
/** Default text color */
public static final int DEFAULT_TEXT_COLOR = 0xFF585858;
/** Default text color */
public static final int LABEL_COLOR = 0xFF700070;
/** Default text size */
public static final int DEFAULT_TEXT_SIZE = 18;
// Text settings
private int textColor = DEFAULT_TEXT_COLOR;
private int textSize = DEFAULT_TEXT_SIZE;
// Current context
protected Context context;
// Layout inflater
protected LayoutInflater inflater;
// Items resources
protected int itemResourceId;
protected int itemTextResourceId;
// Empty items resources
protected int emptyItemResourceId;
/**
* Constructor
* @param context the current context
*/
protected AbstractWheelTextAdapter(Context context) {
this(context, TEXT_VIEW_ITEM_RESOURCE);
}
/**
* Constructor
* @param context the current context
* @param itemResource the resource ID for a layout file containing a TextView to use when instantiating items views
*/
protected AbstractWheelTextAdapter(Context context, int itemResource) {
this(context, itemResource, NO_RESOURCE);
}
/**
* Constructor
* @param context the current context
* @param itemResource the resource ID for a layout file containing a TextView to use when instantiating items views
* @param itemTextResource the resource ID for a text view in the item layout
*/
protected AbstractWheelTextAdapter(Context context, int itemResource, int itemTextResource) {
this.context = context;
itemResourceId = itemResource;
itemTextResourceId = itemTextResource;
inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
/**
* Gets text color
* @return the text color
*/
public int getTextColor() {
return textColor;
}
/**
* Sets text color
* @param textColor the text color to set
*/
public void setTextColor(int textColor) {
this.textColor = textColor;
}
/**
* Gets text size
* @return the text size
*/
public int getTextSize() {
return textSize;
}
/**
* Sets text size
* @param textSize the text size to set
*/
public void setTextSize(int textSize) {
this.textSize = textSize;
}
/**
* Gets resource Id for items views
* @return the item resource Id
*/
public int getItemResource() {
return itemResourceId;
}
/**
* Sets resource Id for items views
* @param itemResourceId the resource Id to set
*/
public void setItemResource(int itemResourceId) {
this.itemResourceId = itemResourceId;
}
/**
* Gets resource Id for text view in item layout
* @return the item text resource Id
*/
public int getItemTextResource() {
return itemTextResourceId;
}
/**
* Sets resource Id for text view in item layout
* @param itemTextResourceId the item text resource Id to set
*/
public void setItemTextResource(int itemTextResourceId) {
this.itemTextResourceId = itemTextResourceId;
}
/**
* Gets resource Id for empty items views
* @return the empty item resource Id
*/
public int getEmptyItemResource() {
return emptyItemResourceId;
}
/**
* Sets resource Id for empty items views
* @param emptyItemResourceId the empty item resource Id to set
*/
public void setEmptyItemResource(int emptyItemResourceId) {
this.emptyItemResourceId = emptyItemResourceId;
}
/**
* Returns text for specified item
* @param index the item index
* @return the text of specified items
*/
protected abstract CharSequence getItemText(int index);
@Override
public View getItem(int index, View convertView, ViewGroup parent) {
if (index >= 0 && index < getItemsCount()) {
if (convertView == null) {
convertView = getView(itemResourceId, parent);
}
TextView textView = getTextView(convertView, itemTextResourceId);
if (textView != null) {
CharSequence text = getItemText(index);
if (text == null) {
text = "";
}
textView.setText(text);
if (itemResourceId == TEXT_VIEW_ITEM_RESOURCE) {
configureTextView(textView);
}
}
return convertView;
}
return null;
}
@Override
public View getEmptyItem(View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = getView(emptyItemResourceId, parent);
}
if (emptyItemResourceId == TEXT_VIEW_ITEM_RESOURCE && convertView instanceof TextView) {
configureTextView((TextView)convertView);
}
return convertView;
}
/**
* Configures text view. Is called for the TEXT_VIEW_ITEM_RESOURCE views.
* @param view the text view to be configured
*/
protected void configureTextView(TextView view) {
view.setTextColor(textColor);
view.setGravity(Gravity.CENTER);
view.setTextSize(textSize);
view.setEllipsize(TextUtils.TruncateAt.END);
view.setLines(1);
// view.setCompoundDrawablePadding(20);
// view.setTypeface(Typeface.SANS_SERIF, Typeface.BOLD);
}
/**
* Loads a text view from view
* @param view the text view or layout containing it
* @param textResource the text resource Id in layout
* @return the loaded text view
*/
private TextView getTextView(View view, int textResource) {
TextView text = null;
try {
if (textResource == NO_RESOURCE && view instanceof TextView) {
text = (TextView) view;
} else if (textResource != NO_RESOURCE) {
text = (TextView) view.findViewById(textResource);
}
} catch (ClassCastException e) {
Log.e("AbstractWheelAdapter", "You must supply a resource ID for a TextView");
throw new IllegalStateException(
"AbstractWheelAdapter requires the resource ID to be a TextView", e);
}
return text;
}
/**
* Loads view from resources
* @param resource the resource Id
* @return the loaded view or null if resource is not set
*/
private View getView(int resource, ViewGroup parent) {
switch (resource) {
case NO_RESOURCE:
return null;
case TEXT_VIEW_ITEM_RESOURCE:
return new TextView(context);
default:
return inflater.inflate(resource, parent, false);
}
}
}
| [
"1424675677@qq.com"
] | 1424675677@qq.com |
e17605658b96586751f0f90ef602dbb8e311e5ce | ddd6d3a2f4c6082c962377640f65758726a03e60 | /LCMedium/CountAndSay.java | b4db2f1bd6d18f0d87c2607fcb668d8199965da3 | [] | no_license | bonyscarvalho/CrackingCodingInterviewProblems | 1484cc57c3ba8666f45e987b55198d5308d0cf4a | 7fb11f28faedd338a270d47e457f8f079aebe662 | refs/heads/main | 2023-07-25T10:03:24.684686 | 2021-08-30T01:07:58 | 2021-08-30T01:07:58 | 330,066,001 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 828 | java | package LeetCodeMedium;
public class CountAndSay {
public static void main(String[] args) {
System.out.println(countAndSay(4));
}
public static String countAndSay(int n) {
if(n == 1) return "1";
String val = "1"; //n --> 1
for(int num = 2; num <= n; num++){ //2 to n
char ch = val.charAt(0);
StringBuilder sb = new StringBuilder();
int count = 1;
for(int idx = 1; idx < val.length(); idx++){
if(ch != val.charAt(idx)){
sb.append(count).append(ch);
ch = val.charAt(idx);
count = 0;
}
count++;
}
sb.append(count).append(ch);
val = sb.toString();
}
return val;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
da7f36874b8ce1db8944ec27938d188e457252e9 | bdd402d44afb1c3cadb29700afd5360f07117faf | /ExamenOlivierThas/src/entity/Beurs.java | 1d886bd8a72ce71471bab57bcd0bf45720c98231 | [
"MIT"
] | permissive | olivierthas/Programming-Essentials-2 | f7835b545a943e74b6e5e4ff6abcf22b1f2bd6dd | 7a92d562e9e7603a2642e573dc925c29893fde70 | refs/heads/master | 2023-03-29T10:15:51.757020 | 2021-03-21T22:49:03 | 2021-03-21T22:49:03 | 266,134,652 | 0 | 0 | MIT | 2020-05-22T14:46:40 | 2020-05-22T14:46:39 | null | UTF-8 | Java | false | false | 2,404 | java | package entity;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.TreeMap;
public class Beurs implements Comparable<Stand> {
private String naam;
private TreeMap<Stand, String> standenLijst;
public Beurs(String naam) {
this.naam = naam;
this.standenLijst = new TreeMap<Stand, String>();
}
public String getNaam() {
return naam;
}
public void setNaam(String naam) {
this.naam = naam;
}
public TreeMap<Stand, String> getStandenLijst() {
return standenLijst;
}
public void setStandenLijst(TreeMap<Stand, String> standenLijst) {
this.standenLijst = standenLijst;
}
@Override
public int compareTo(Stand o) {
return this.naam.compareTo(o.getNaam());
}
public void voegStandToe(Stand s, String locatie) {
standenLijst.put(s, locatie);
}
//ik weet niet meer hoe ik de int id omzet naar een instance van Stand
// hierbij de functie met parameter Stand s.
public boolean wijzigStandLocatie(Stand s, String locatie) throws NietVerplaatsbaarException {
if(standenLijst.containsKey(s)) {
throw new NietVerplaatsbaarException();
}
while(standenLijst.get(s)!=locatie){
standenLijst.replace(s, locatie);
return true;
}
return false;
}
// // hierbij een poging met int id
// public boolean wijzigStandLocatie(int id, String locatie) throws NietVerplaatsbaarException {
//
// if(standenLijst.containsKey(id.instanceOf(Stand))) {
// throw new NietVerplaatsbaarException();
// }
//
// while(standenLijst.get(id.instanceOf(Stand))!=locatie){
// standenLijst.replace(id.instanceOf(Stand), locatie);
// return true;
// }
// return false;
// }
public void bewaar() {
try {
PrintWriter pw = new PrintWriter(new File("Beurs.obj"));
pw.println(this);
for(Stand stand : standenLijst.keySet()) {
pw.println(stand + "-" + standenLijst.get(stand));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
@Override
public String toString() {
return "Beurs{" +
"naam='" + naam + '\'' +
'}';
}
}
| [
"olivier.thas@student.ehb.be"
] | olivier.thas@student.ehb.be |
4cdfc417d6bb3e6b3ec5fb3671168b1248192ae7 | 118233db8d100cad7aec0c380411f4297d61bb10 | /src/com/rkylin/crawler/engine/flood/model/ProxyContent.java | dbe5af91633809c7fb2c9f9e695f5a23ee639d9f | [] | no_license | cuihengji/crawler_v1 | a5f5f1399cd23558ceb5382b1aec34193b41bba7 | b804eca27f3ed2f0ec89b48934a07e5f64308e4e | refs/heads/master | 2020-06-04T20:02:05.644127 | 2019-07-21T13:21:25 | 2019-07-21T13:21:25 | 192,171,757 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,235 | java | package com.rkylin.crawler.engine.flood.model;
/**
* @author Administrator
*
* "mode": "fixed_servers",
"ip": "172.20.6.253",
"port": "1080"
*/
public class ProxyContent {
private String mode;
private String ip;
private int port;
private String user_name;
private String pass_word;
private String bypassList;
private String blockedUrlList;
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getPass_word() {
return pass_word;
}
public void setPass_word(String pass_word) {
this.pass_word = pass_word;
}
public String getBypassList() {
return bypassList;
}
public void setBypassList(String bypassList) {
this.bypassList = bypassList;
}
public String getBlockedUrlList() {
return blockedUrlList;
}
public void setBlockedUrlList(String blockedUrlList) {
this.blockedUrlList = blockedUrlList;
}
}
| [
"cuihengji@163.com"
] | cuihengji@163.com |
2ee19a1c028a728eafa5b3e9c75290eded898dbc | 05e4ce899b31030574f470e3c04c7f953e70b2df | /src/pl/sages/zadanka/generyki/Milk.java | 28967918ab3c4039a669f57496d6d4bb7cbd4838 | [] | no_license | GregSied/sternik-kody | b27d0342b08dc8545179f5e46603a6e833c05f94 | 8635774098d8077704645847c8ba887a5ce34f10 | refs/heads/master | 2021-06-15T11:48:39.693269 | 2017-03-17T13:50:48 | 2017-03-17T13:50:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 76 | java | package pl.sages.zadanka.generyki;
public class Milk extends ShopItem {
}
| [
"cackoarek@gmail.com"
] | cackoarek@gmail.com |
466f45cd0e040c4f3e4faf4664d3d1190aa8be60 | 25df6627aa12e39bbf19617606d18c90a30172cf | /Java/src/ch07/_04_ManualCar.java | 5bcd9328daef7761011d07f0b2d4d3c34f66aaba | [] | no_license | dlwo01/github50 | ae527df99d2cba60236aaeb6c74691b146edf4c6 | 93254809d3385729013b745dddbefae87169906a | refs/heads/master | 2020-06-26T23:33:27.299173 | 2019-07-31T06:03:35 | 2019-07-31T06:03:35 | 199,788,153 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package ch07;
public class _04_ManualCar extends _04_Car{
@Override
public void drive() {
System.out.println("사람이 운전합니다.");
System.out.println("사람이 핸들을 조작합니다.");
}
@Override
public void stop() {
System.out.println("브레이크로 정지합니다.");
}
}
| [
"kosmo26@DESKTOP-TP6RN64"
] | kosmo26@DESKTOP-TP6RN64 |
e64642b7e8b6b37eb338ff47f198c16b152270be | 9585852884b2edab425f19ac81c5e5147b142163 | /gmall-item-web/src/main/java/com/atguigu/gmall0422/item/GmallItemWebApplication.java | 22f59107e579570332aeefbb70d0ea898dc8b4b5 | [] | no_license | ObjectGitHub/gmall0422 | 0a65d3ac44d7e485575b58f336e21cb894e52281 | 2993fac2992ab9613d20b26d302fc9476e705f46 | refs/heads/master | 2022-09-20T16:03:38.138752 | 2020-05-17T08:03:09 | 2020-05-17T08:03:27 | 249,105,211 | 0 | 0 | null | 2022-06-10T20:02:13 | 2020-03-22T03:23:36 | Java | UTF-8 | Java | false | false | 458 | java | package com.atguigu.gmall0422.item;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@ComponentScan(basePackages = "com.atguigu.gmall0422")
@SpringBootApplication
public class GmallItemWebApplication {
public static void main(String[] args) {
SpringApplication.run(GmallItemWebApplication.class, args);
}
}
| [
"18203447319@163.com"
] | 18203447319@163.com |
c1705323f7cc05a3cd774aec074ced64bce3cbd0 | 087637662f967b83f6806daea4d121b6904bd27f | /src/edu/rest/api/TableExample.java | 1c401b63b11b0fce1488f4a6f7931243db98c859 | [] | no_license | Kaushik-cg-giri/TableCreation | 5b47482c10e531f5714bb72501cc651410a2ee66 | 13a5655e890e126ab99f103beccc9ac1f15c28e1 | refs/heads/main | 2023-03-02T15:27:56.202180 | 2021-02-12T10:27:12 | 2021-02-12T10:27:12 | 338,285,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,536 | java | package edu.rest.api;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class TableExample {
public static void main(String[] args) {
// TODO Auto-generated method stub
Connection con =null;
PreparedStatement pstmt=null;
Statement stmt =null;
ResultSet rslt =null;
try {
Class.forName("com.mysql.jdbc.Driver");
String dburl="jdbc:mysql://localhost:3306/rest_schema";
con= DriverManager.getConnection(dburl,"root","password");
System.out.println(con);
String insertquery = "insert into employees_details values (101,'Ajay','Edappally','945281010'),(102,'Binu','kurottu','8281454525'),(103,'Ebin','kanthn','757474747410')";
pstmt= con.prepareStatement(insertquery);
int count = pstmt.executeUpdate();
System.out.println(count);
String retrivequery = "select * from employees_details";
stmt = con.createStatement();
rslt=stmt.executeQuery(retrivequery);
while(rslt.next()) {
System.out.println("Employee_id>>"+rslt.getInt(1));
System.out.println("Employee_name>>"+rslt.getString(2));
System.out.println("Employee_address>>"+rslt.getString(3));
System.out.println("Employee _number>>"+rslt.getString(4));
System.out.println("------------------------------------------");
}
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
0eb0950322f29cbc5bb9f8f1171c4194cd5fc0c1 | 2b69df646ac5e3188a90cc1ceabba621c91875bc | /spring_code/13.bankapp_v2_jdbc/src/main/java/com/bankapp/dao/AccountDaoImplJdbc.java | f08b13d0bf741b1e663f10ce5ab0743d6d1f3497 | [] | no_license | rgupta00/ymsli-spring | b20d0d8b53f94b00c57c3f57c4ebaac4eddb1a1c | 29c6ecf37aaf0476f48584cec80062f7e11d365a | refs/heads/master | 2023-03-08T15:33:03.610866 | 2021-02-19T10:40:51 | 2021-02-19T10:40:51 | 338,943,772 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package com.bankapp.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Repository;
@Repository
@Primary
public class AccountDaoImplJdbc implements AccountDao {
private DataSource dataSource;
@Autowired
public AccountDaoImplJdbc(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public List<Account> getAllAccounts() {
return null;
}
@Override
public Account getById(int id) {
return null;
}
@Override
public void update(Account account) {
}
@Override
public void delete(int id) {
}
//id name,balance,address,phone, email
@Override
public void insert(Account account) {
try {
Connection connection=dataSource.getConnection();
PreparedStatement pstmt=
connection.prepareStatement
("insert into account2(name,balance,address,phone, email) values (?,?,?,?,?)");
pstmt.setString(1, account.getName());
pstmt.setDouble(2, account.getBalance());
pstmt.setString(3, account.getAddress());
pstmt.setString(4, account.getPhone());
pstmt.setString(5, account.getEmail());
pstmt.executeUpdate();
System.out.println("----inserted....");
} catch (SQLException e) {
e.printStackTrace();
}
}
}
| [
"rgupta.mtech@gmail.com"
] | rgupta.mtech@gmail.com |
050a1d8d1dff038ee119602e18d70285037f98da | 67c80e1d90e5df6d8bfd29a4403598707257b3bf | /ShopppingCart/src/main/java/com/niit/shoppingcart/controllers/AdminController.java | 70f7b12ff08285473f93701c55f9b80e1c9907b7 | [] | no_license | siparmar/Shopping-Cart-Front-End-Back-End | 146903eb869ca0787227aa7947344d023e2cfae6 | 939f0b9963a30fd38e7a8f7097a195dd6a169d5e | refs/heads/master | 2021-01-19T04:39:05.608241 | 2017-03-10T11:33:39 | 2017-03-10T11:33:39 | 84,437,244 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,952 | java | package com.niit.shoppingcart.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.niit.shopppingcart.dao.CategoryDAO;
import com.niit.shopppingcart.domain.Category;
import com.niit.shopppingcart.domain.Supplier;
import com.niit.shopppingcart.dao.SupplierDAO;
@Controller
public class AdminController {
// define 3 methods
@Autowired
CategoryDAO categoryDAO;
@Autowired
Category category;
@Autowired
SupplierDAO supplierDAO;
@Autowired
Supplier supplier;
@RequestMapping("/manage_categories")
public ModelAndView manageCategories() {
System.out.println("method called manage categories");
ModelAndView mv = new ModelAndView("/Admin/AdminHome");
mv.addObject("isUserClickedCategories", "true");
// get the categories from the db .
List<Category> categoryList = categoryDAO.list();
mv.addObject("categoryList",categoryList);
mv.addObject("category", category); //to access category domain object in category.jsp
return mv;
}
@RequestMapping("/manage_suppliers")
public ModelAndView manageSuppliers() {
System.out.println("method called manage suppliers ");
ModelAndView mv = new ModelAndView("/Admin/AdminHome");
mv.addObject("isUserClickedSuppliers", "true");
// get the categories from the db .
List<Supplier> supplierList = supplierDAO.list();
mv.addObject("supplierList",supplierList);
mv.addObject("supplier", supplier); //to access category domain object in category.jsp
return mv;
}
@RequestMapping("/manage_products")
public ModelAndView manageProducts() {
System.out.println("method called manage products ");
ModelAndView mv = new ModelAndView("/Admin/AdminHome");
mv.addObject("isUserClickedProducts", "true");
return mv;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
69c062b502b21b0ebc24e0d7d38d5772df394e4c | 8efa4f9563aa9c32c6df3d0e8f05c17c9c10bc52 | /easymock-integration/src/test/java/org/easymock/itests/OsgiClassExtensionTest.java | 543b8523b7d0165f76050fff5a14fb08a962b42c | [
"Apache-2.0"
] | permissive | jzmq/easymock | 7b024fc77d114dcc1caf2ce8a4b2158ea244303b | 3ad9a21a7669d63200d6b6280f101ffb19ca50fb | refs/heads/master | 2023-09-01T13:41:10.419413 | 2014-04-15T22:43:50 | 2014-04-15T22:43:50 | 18,945,764 | 0 | 0 | null | 2019-10-09T10:56:32 | 2014-04-19T16:47:40 | Java | UTF-8 | Java | false | false | 4,154 | java | /**
* Copyright 2009-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.easymock.itests;
import static org.easymock.EasyMock.*;
import java.util.ArrayList;
import java.util.jar.Manifest;
import org.easymock.internal.MocksControl;
import org.objenesis.Objenesis;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.springframework.osgi.util.OsgiStringUtils;
/**
* Note: This is a JUnit 3 test because of the Spring OSGi test framework
*
* @author Henri Tremblay
*/
public class OsgiClassExtensionTest extends OsgiBaseTest {
public static abstract class A {
public abstract void foo();
}
@Override
protected String[] getTestBundlesNames() {
final String cglibVersion = "2.2.0";
final String objenesisVersion = getImplementationVersion(Objenesis.class);
final String easymockVersion = getEasyMockVersion();
return new String[] { "net.sourceforge.cglib, com.springsource.net.sf.cglib, " + cglibVersion,
"org.easymock, easymock, " + easymockVersion, "org.objenesis, objenesis, " + objenesisVersion };
}
@Override
protected Manifest getManifest() {
final Manifest mf = super.getManifest();
String imports = mf.getMainAttributes().getValue(Constants.IMPORT_PACKAGE);
imports = imports.replace("org.easymock.classextension.internal,",
"org.easymock.classextension.internal;poweruser=true,");
imports = imports.replace("org.easymock.internal,", "org.easymock.internal;poweruser=true,");
imports += ",net.sf.cglib.reflect,net.sf.cglib.core,net.sf.cglib.proxy";
mf.getMainAttributes().putValue(Constants.IMPORT_PACKAGE, imports);
return mf;
}
@Override
public void testOsgiPlatformStarts() throws Exception {
System.out.println("Framework vendor: " + this.bundleContext.getProperty(Constants.FRAMEWORK_VENDOR));
System.out.println("Framework version: " + bundleContext.getProperty(Constants.FRAMEWORK_VERSION));
System.out.println("-----------------------------");
final Bundle[] bundles = bundleContext.getBundles();
for (final Bundle bundle : bundles) {
System.out.println(OsgiStringUtils.nullSafeName(bundle) + ": "
+ bundle.getHeaders().get(Constants.BUNDLE_VERSION));
}
}
/**
* Class loaded in the bootstrap class loader have a null class loader. In
* this case, cglib creates the proxy in its own class loader. So I need to
* test this case is working
*/
public void testCanMock_BootstrapClassLoader() {
final ArrayList<?> mock = createMock(ArrayList.class);
expect(mock.size()).andReturn(5);
replayAll();
assertEquals(5, mock.size());
verifyAll();
}
/**
* Normal case of a class in this class loader
*/
public void testCanMock_OtherClassLoader() {
final A mock = createMock(A.class);
mock.foo();
replayAll();
mock.foo();
verifyAll();
}
public void testCanPartialMock() throws Exception {
final A mock = createMockBuilder(A.class).withConstructor().addMockedMethod("foo").createMock();
mock.foo();
replay(mock);
mock.foo();
verify(mock);
}
public void testCanUseInternal() {
final ArrayList<?> mock = createMock(ArrayList.class);
MocksControl.getControl(mock);
}
}
| [
"henri.tremblay@gmail.com"
] | henri.tremblay@gmail.com |
cc9ab7b162a7a3f218f81ac488d270b46a7b4413 | d4896a7eb2ee39cca5734585a28ca79bd6cc78da | /sources/com/google/android/gms/internal/ads/zzsu.java | ebaae782d24def040c6e5d7d0fbb0204bff7aebd | [] | no_license | zadweb/zadedu.apk | a235ad005829e6e34ac525cbb3aeca3164cf88be | 8f89db0590333929897217631b162e39cb2fe51d | refs/heads/master | 2023-08-13T03:03:37.015952 | 2021-10-12T21:22:59 | 2021-10-12T21:22:59 | 416,498,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,540 | java | package com.google.android.gms.internal.ads;
import android.os.RemoteException;
final class zzsu extends zzki {
private final /* synthetic */ zzst zzbnw;
zzsu(zzst zzst) {
this.zzbnw = zzst;
}
@Override // com.google.android.gms.internal.ads.zzkh
public final void onAdClicked() throws RemoteException {
this.zzbnw.zzxo.add(new zztb(this));
}
@Override // com.google.android.gms.internal.ads.zzkh
public final void onAdClosed() throws RemoteException {
this.zzbnw.zzxo.add(new zzsv(this));
}
@Override // com.google.android.gms.internal.ads.zzkh
public final void onAdFailedToLoad(int i) throws RemoteException {
this.zzbnw.zzxo.add(new zzsw(this, i));
zzakb.v("Pooled interstitial failed to load.");
}
@Override // com.google.android.gms.internal.ads.zzkh
public final void onAdImpression() throws RemoteException {
this.zzbnw.zzxo.add(new zzta(this));
}
@Override // com.google.android.gms.internal.ads.zzkh
public final void onAdLeftApplication() throws RemoteException {
this.zzbnw.zzxo.add(new zzsx(this));
}
@Override // com.google.android.gms.internal.ads.zzkh
public final void onAdLoaded() throws RemoteException {
this.zzbnw.zzxo.add(new zzsy(this));
zzakb.v("Pooled interstitial loaded.");
}
@Override // com.google.android.gms.internal.ads.zzkh
public final void onAdOpened() throws RemoteException {
this.zzbnw.zzxo.add(new zzsz(this));
}
}
| [
"midoekid@gmail.com"
] | midoekid@gmail.com |
5ea7303f02ca2a49a49197e58344281ca32a7c52 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/main/java/org/gradle/test/performancenull_411/Productionnull_41016.java | 16a04ea77ac4ffb2591a67c1605d7a58a6d8ffb8 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 588 | java | package org.gradle.test.performancenull_411;
public class Productionnull_41016 {
private final String property;
public Productionnull_41016(String param) {
this.property = param;
}
public String getProperty() {
return property;
}
private String prop0;
public String getProp0() {
return prop0;
}
public void setProp0(String value) {
prop0 = value;
}
private String prop1;
public String getProp1() {
return prop1;
}
public void setProp1(String value) {
prop1 = value;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
37e7d6a8d6525f9537ea2202a52bcfca0bacce60 | 5243f0d735d1ba22d6b5de1ba8ebde870f3fd54e | /app/src/main/java/com/example/gsb/ListEtudiantItemAdapter.java | e04f77947076fe37b2c9d69e983cba51bfe215a9 | [] | no_license | BarenneM/AppMobile_PromotionsEtudiants | 1885d61c669827fdbb03ffa5fc03f9b4d5796844 | 47171d9e4dd526cf6e32875a91b0dd86ce232b85 | refs/heads/master | 2023-06-02T00:05:49.344124 | 2021-06-21T14:32:20 | 2021-06-21T14:32:20 | 378,902,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,176 | java | package com.example.gsb;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.TextView;
import com.example.gsb.entite.Etudiant;
import com.example.gsb.entite.Promotion;
import com.example.gsb.rest.IServiceRest;
import java.util.List;
public class ListEtudiantItemAdapter extends BaseAdapter {
private Context context;
private List<Etudiant> etudiants;
private LayoutInflater inflater;
// constructeur
public ListEtudiantItemAdapter(Context context, List<Etudiant> etudiants) {
this.context = context;
this.etudiants = etudiants;
this.inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return etudiants.size();
}
@Override
public Etudiant getItem(int position) {
return etudiants.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int i, View view, ViewGroup parent) {
view = inflater.inflate(R.layout.adapter_itemsetudiant, null);
//Recuperer le infos de l'objet courrant
Etudiant currentEtudiant = getItem(i);
//Long itemId = currentEtudiant.getId();
String itemNom = currentEtudiant.getNom();
String itemPrenom = currentEtudiant.getPrenom();
//int itemNbRetard = currentEtudiant.getNbRetard();
//int itemNbAbs = currentEtudiant.getNbAbsence();
//On recupere le champs dans lequel on doit positionner les attributs
TextView itemNomView = view.findViewById(R.id.item_nom);
itemNomView.setText(itemNom);
TextView itemPrenomView = view.findViewById(R.id.item_prenom);
itemPrenomView.setText(itemPrenom);
/*TextView itemNbRetardView = view.findViewById(R.id.item_nbRetard);
itemNbRetardView.setText(itemNbRetard);
TextView itemNbAbsView = view.findViewById(R.id.item_nbAbs);
itemNbAbsView.setText(itemNbAbs);*/
return view;
}
}
| [
"barenne.marie@outlook.com"
] | barenne.marie@outlook.com |
3b71895332246aaec2383803ca0ed11ea9c31c7b | 22f8d001b3d96763a336dd070c2242e6b7cf65bb | /src/LongestSubstringWithoutRepeatingCharacters_3.java | 99fca382920e7a406737bc0755b27f4ee4bd1a1a | [] | no_license | KevinZhouBigSailor/LeetCode | 19dbeaabe66578ad4e501a5b5d2e2543b38975ac | b0d0553657a1c258d31e166728b95f2b9325c338 | refs/heads/master | 2022-03-25T17:54:27.444575 | 2022-03-12T05:48:39 | 2022-03-12T05:48:39 | 160,070,412 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,123 | java | /*
* Given a string, find the length of the longest substring without repeating characters.
* For example, the longest substring without repeating letters for "abcabcbb" is "abc", which the length is 3. For "bbbbb" the longest substring is "b", with the length of 1.
*/
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
public class LongestSubstringWithoutRepeatingCharacters_3 {
public int lengthOfLongestSubstring(String s) {
// HashSet<Character> hash = new HashSet<Character>();
// int n = s.length();
// int max = 0;
// for(int i = 0; i < n; i++){
// int j = i;
// int an = 0;
// while(j < n&&hash.add(s.charAt(j))){
// j++;
// an++;
// }
// max = Math.max(max, an);
// hash.clear();
// }
// return max;
/*int max = 0, left = 0;
HashMap<Character, Integer> map = new HashMap<Character, Integer>();
//init map
for (int i = 0; i < s.length(); ++i) {
if (!map.containsKey(s.charAt(i))) {
map.put(s.charAt(i), -1);
}
}
for (int i = 0; i < s.length(); ++i) {
if (map.get(s.charAt(i)) >= left)
left = map.get(s.charAt(i)) + 1;
map.put(s.charAt(i), i) ;
max = Math.max(max, i - left + 1);
}
return max;*/
int n = s.length(), ans = 0;
Map<Character, Integer> map = new HashMap<>(); // current index of character
// try to extend the range [i, j]
for (int j = 0, i = 0; j < n; j++) {
if (map.containsKey(s.charAt(j))) {
i = Math.max(map.get(s.charAt(j)), i);
}
ans = Math.max(ans, j - i + 1);
map.put(s.charAt(j), j + 1);
}
return ans;
}
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
LongestSubstringWithoutRepeatingCharacters_3 s = new LongestSubstringWithoutRepeatingCharacters_3();
System.out.println(s.lengthOfLongestSubstring("abcabcbb"));
}
}
| [
"kevinzhou1990@hotmail.com"
] | kevinzhou1990@hotmail.com |
5fbceafffb51ab77b962089cf8fe645022aee6ba | 6f816687a5165f59ac04ff8de5891f4e63c6bd3b | /src/main/java/com/beatus/app/manufacturer/model/BillDTO.java | 4057800aea9f21c690fe2d82f6e26f6edad45282 | [] | no_license | goodbyeq/manufacturer-app | fd89852749da7c525cf15edf546574b8cfa315fc | 5f5dbc96246147e22b4ffa6ad7af92659c586e86 | refs/heads/master | 2020-03-25T06:35:45.159995 | 2018-08-12T04:25:19 | 2018-08-12T04:25:19 | 143,512,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,624 | java | package com.beatus.app.manufacturer.model;
import java.util.List;
public class BillDTO {
private String billNumber;
private String billFromContactId;
private String billToContactId;
private String companyId;
private String uid;
private List<ItemDTO> items;
private String dateOfBill;
private String dueDate;
private Double totalAmount;
private Double totalTax;
private Double totalCGST;
private Double totalSGST;
private Double totalIGST;
private String referenceMobileNumber;
private String referenceAadharCardNumber;
private String isTaxeble;
private String isUpdated;
private String isDeleted;
private String year;
private String month;
private String day;
public String getBillNumber() {
return billNumber;
}
public void setBillNumber(String billNumber) {
this.billNumber = billNumber;
}
public String getBillFromContactId() {
return billFromContactId;
}
public void setBillFromContactId(String billFromContactId) {
this.billFromContactId = billFromContactId;
}
public String getBillToContactId() {
return billToContactId;
}
public void setBillToContactId(String billToContactId) {
this.billToContactId = billToContactId;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getDateOfBill() {
return dateOfBill;
}
public void setDateOfBill(String dateOfBill) {
this.dateOfBill = dateOfBill;
}
public String getDueDate() {
return dueDate;
}
public void setDueDate(String dueDate) {
this.dueDate = dueDate;
}
public List<ItemDTO> getItems() {
return items;
}
public void setItems(List<ItemDTO> items) {
this.items = items;
}
public String getIsUpdated() {
return isUpdated;
}
public void setIsUpdated(String isUpdated) {
this.isUpdated = isUpdated;
}
public String getIsDeleted() {
return isDeleted;
}
public void setIsDeleted(String isDeleted) {
this.isDeleted = isDeleted;
}
public String getIsTaxeble() {
return isTaxeble;
}
public void setIsTaxeble(String isTaxeble) {
this.isTaxeble = isTaxeble;
}
public String getCompanyId() {
return companyId;
}
public void setCompanyId(String companyId) {
this.companyId = companyId;
}
public Double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
public String getReferenceMobileNumber() {
return referenceMobileNumber;
}
public void setReferenceMobileNumber(String referenceMobileNumber) {
this.referenceMobileNumber = referenceMobileNumber;
}
public String getReferenceAadharCardNumber() {
return referenceAadharCardNumber;
}
public void setReferenceAadharCardNumber(String referenceAadharCardNumber) {
this.referenceAadharCardNumber = referenceAadharCardNumber;
}
public Double getTotalTax() {
return totalTax;
}
public void setTotalTax(Double totalTax) {
this.totalTax = totalTax;
}
public Double getTotalCGST() {
return totalCGST;
}
public void setTotalCGST(Double totalCGST) {
this.totalCGST = totalCGST;
}
public Double getTotalSGST() {
return totalSGST;
}
public void setTotalSGST(Double totalSGST) {
this.totalSGST = totalSGST;
}
public Double getTotalIGST() {
return totalIGST;
}
public void setTotalIGST(Double totalIGST) {
this.totalIGST = totalIGST;
}
public String getYear() {
return year;
}
public void setYear(String year) {
this.year = year;
}
public String getMonth() {
return month;
}
public void setMonth(String month) {
this.month = month;
}
public String getDay() {
return day;
}
public void setDay(String day) {
this.day = day;
}
}
| [
"akeyanudeep@gmail.com"
] | akeyanudeep@gmail.com |
22d3c9c0c36e36c8312093a2ecd6b23ddc6809ce | 0c796bd215b2ed430c833880911202c60d07494c | /backend/src/test/java/com/example/restaurant/domainTests/MappingTest.java | e100839842406cdad06f9537d51872a95b4a133c | [] | no_license | ArekKrawczyk98/restaurant | 26e415b51ae1a4c5f8f6afeadad94be4c400c020 | 309f04153082b68d9e885e65aeca7831e9d78a2a | refs/heads/master | 2022-12-11T18:08:55.472018 | 2021-02-25T22:49:48 | 2021-02-25T22:49:48 | 220,451,658 | 0 | 0 | null | 2019-11-08T11:27:17 | 2019-11-08T11:19:12 | Java | UTF-8 | Java | false | false | 857 | java | package com.example.restaurant.domainTests;
import com.example.restaurant.api.bill.BillEntity;
import com.example.restaurant.api.bill.BillMapper;
import com.example.restaurant.domain.Bill;
import org.junit.Assert;
import org.junit.Test;
import java.util.Date;
public class MappingTest {
@Test
public void shouldMapEntityToDomain(){
BillEntity billEntity = new BillEntity(1,new Date(),50.0,5);
Bill domain = BillMapper.mapFromEntityToDomainModel(billEntity);
Assert.assertEquals(billEntity.getMoneyPaid(),domain.getToPay());
}
@Test
public void shouldMapEntityToDomainAndTableShouldntExist(){
BillEntity billEntity = new BillEntity(1,new Date(),50.0,5);
Bill domain = BillMapper.mapFromEntityToDomainModel(billEntity);
Assert.assertEquals(1L,domain.getId().longValue());
}
}
| [
"arekk41051@gmail.com"
] | arekk41051@gmail.com |
bde9eb1e1fa2a2fe4a765f923d0deb235f094d07 | 14169af14e64e495f241c37efd35627b13df4850 | /app/src/main/java/com/astir_trotter/miscall/OutgoingCallReceiver.java | 3c64059ea4142acbcb5e32e936fb1dad66ecb6b6 | [] | no_license | astirtrotter/miscall-android | 31f81fadf2a72c0fc12066de9f42035811a56199 | f174162ace1740f4613e014c08a2602580109b6f | refs/heads/master | 2021-06-18T05:46:22.615278 | 2017-06-13T08:21:42 | 2017-06-13T08:21:42 | 94,172,802 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 676 | java | package com.astir_trotter.miscall;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;
public class OutgoingCallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
Log.d(OutgoingCallReceiver.class.getSimpleName(), intent.toString() + ", call to: " + phoneNumber);
Toast.makeText(context, "Outgoing call catched: " + phoneNumber, Toast.LENGTH_LONG).show();
//TODO: Handle outgoing call event here
}
}
| [
"yonis.larsson.biz@gmail.com"
] | yonis.larsson.biz@gmail.com |
24fc727176495c31dd1313f8457b7e7db9048131 | 19b3f6291fa520b576944bfecbaeb647a2e70b36 | /customtwowayscroll/src/main/java/co/clubmahindra/customtwowayscroll/BaseTableAdapter.java | aeb734a183f03463d8a8c681f99fddb9aa9ce971 | [] | no_license | ashishgoel989/calnder_twoway_scroll | dc26a858dd3d62cf753f17c08e39b9dd736ab3f8 | 9a4320a61b0ba2607b86df70f31f6eceefada903 | refs/heads/master | 2021-01-20T20:56:22.590251 | 2016-03-30T13:06:09 | 2016-03-30T13:06:09 | 60,233,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package co.clubmahindra.customtwowayscroll;
import android.database.DataSetObservable;
import android.database.DataSetObserver;
/**
* Common base class of common implementation for an {@link TableAdapter} that
* can be used in {@link TableFixHeaders}.
*
* @author Brais Gabín (InQBarna)
*/
public abstract class BaseTableAdapter implements TableAdapter {
private final DataSetObservable mDataSetObservable = new DataSetObservable();
@Override
public void registerDataSetObserver(DataSetObserver observer) {
mDataSetObservable.registerObserver(observer);
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
mDataSetObservable.unregisterObserver(observer);
}
/**
* Notifies the attached observers that the underlying data has been changed
* and any View reflecting the data set should refresh itself.
*/
public void notifyDataSetChanged() {
mDataSetObservable.notifyChanged();
}
/**
* Notifies the attached observers that the underlying data is no longer
* valid or available. Once invoked this adapter is no longer valid and
* should not report further data set changes.
*/
public void notifyDataSetInvalidated() {
mDataSetObservable.notifyInvalidated();
}
}
| [
"coolkhan007"
] | coolkhan007 |
4e46b9166f9faa345e93c56978d058d84df172d4 | 39e32b978526b825be53878157bc8da69410c464 | /MyFirstProgram/src/lecture20/DPDEMO.java | f3fc0c62552988ae2a363dc2c9fda32b03a0aca9 | [] | no_license | 9717/Data-structures-and-algorithm-questions-using-java | 8d277211a555ad2763bfb8ee0bfd9f39cd3ac6b7 | 0367bf9c6324863953f61f024b090be768f7b6ca | refs/heads/master | 2020-07-12T15:16:29.092662 | 2019-10-24T15:12:22 | 2019-10-24T15:12:22 | 204,849,228 | 4 | 1 | null | 2019-10-24T15:12:23 | 2019-08-28T04:39:55 | Java | UTF-8 | Java | false | false | 2,742 | java | package lecture20;
import java.util.Scanner;
public class DPDEMO {
public static long start;
public static long end;
public static void startAlgo() {
start = System.currentTimeMillis();
}
public static long endAlgo() {
end = System.currentTimeMillis();
return end - start;
}
public static void main(String[] args) {
// TODO Auto-generated method
// Scanner s = new Scanner(System.in);
//
// int n = s.nextInt();
//
// int[][] strg = new int[n + 1][n + 1];
// System.out.println(cbp(n, 0,strg));
// System.out.println(cbp(n, 0, strg));
// startAlgo();
// System.out.println(countMazepathRS(n, n, 0, 0,strg));
// System.out.println("The cmpRS took time " + endAlgo() + " ms");
String S1 = "abbg";
String S2 = "agbg";
startAlgo();
System.out.println(lcs(S1, S2));
System.out.println("The lcs took time " + endAlgo() + " ms");
}
public static int cbp(int end, int curr, int[] strg) {
int count = 0;
if (curr == end) {
return 1;
}
if (curr > end) {
return 0;
}
if (strg[curr] != 0) {
return strg[curr];
}
for (int dice = 1; dice <= 6; dice++) {
int cbp1 = cbp(end, curr + dice, strg);
count = count + cbp1;
}
strg[curr] = count;
return count;
}
public static int cbpIS(int end, int curr) {
int[] strg = new int[end + 1];
strg[end] = 1;
for (int i = end - 1; i >= 0; i--) {
int count = 0;
for (int dice = 1; dice <= 6 && dice + i < strg.length; dice++) {
count = count = strg[dice + 1];
}
strg[i] = count;
}
return strg[curr];
}
public static int countMazepathRS(int er, int ec, int cr, int cc,int[][]strg) {
if (er == cr && ec == cc) {
return 1;
}
if (cr > er || cc > ec) {
return 0;
}
if (strg[cr][cc] != 0) {
return strg[cr][cc];
}
int mycount = 0;
mycount = countMazepathRS(er, ec, cr, cc+1, strg)+countMazepathRS(er, ec, cr+1, cc, strg);
strg[cr][cc] = mycount;
return mycount;
}
public static int cmpIS(int er, int ec, int cr, int cc) {
int[][] strg = new int[er + 1][ec + 1];
strg[er][ec] = 1;
for (int i = er; i >= 0; i--) {
for (int j = ec; j >= 0; j--) {
if (i == er || j == ec) {
strg[i][j] = 1;
} else {
strg[i][j] = strg[i][j + 1] + strg[i + 1][j];
}
}
}
return strg[cr][cc];
}
public static int lcs(String S1, String S2) {
char cc1=S1.charAt(0);
char cc2=S2.charAt(0);
String ros1=S1.substring(1);
String ros2=S2.substring(1);
int ans=0;
if(cc1==cc2) {
ans=1+lcs(ros1, ros2);
}else {
int f1=lcs(ros1, ros2);
int f2=lcs(S1, ros2);
ans=Math.max(f1,f2);
}
return ans;
}
}
| [
"nandankr.43@gmail.com"
] | nandankr.43@gmail.com |
cff088ce5ef97732c6dc3de71c65d92155452be2 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_51_buggy/mutated/348/CharacterReader.java | 557b5e038ca7b97f64d079429a4b5a7f386c0536 | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,729 | java | package org.jsoup.parser;
/**
CharacterReader cosumes tokens off a string. To replace the old TokenQueue.
*/
class CharacterReader {
static final char EOF = (char) -1;
private final String input;
private final int length;
private int pos = 0;
private int mark = 0;
CharacterReader(String input) {
this.input = input;
this.length = input.length();
}
int pos() {
return pos;
}
boolean isEmpty() {
return pos >= length;
}
char current() {
return isEmpty() ? EOF : input.charAt(pos);
}
char consume() {
return isEmpty() ? EOF : input.charAt(pos++);
}
void unconsume() {
pos--;
}
void advance() {
pos++;
}
void mark() {
mark = pos;
}
void rewindToMark() {
pos = mark;
}
String consumeAsString() {
return input.substring(pos, pos++);
}
String consumeTo(char c) {
int offset = input.indexOf(c, pos);
if (offset != -1) {
String consumed = input.substring(pos, offset);
pos += consumed.length();
return consumed;
} else {
return consumeToEnd();
}
}
String consumeTo(String seq) {
int offset = input.indexOf(seq, pos);
if (offset != -1) {
String consumed = input.substring(pos, offset);
pos += consumed.length();
return consumed;
} else {
return consumeToEnd();
}
}
String consumeToAny(char... seq) {
int start = pos;
OUTER: while (!isEmpty()) {
char c = input.charAt(pos);
for (char seek : seq) {
if (seek == c)
break OUTER;
}
pos++;
}
return pos > start ? input.substring(start, pos) : "";
}
String consumeToEnd() {
String data = input.substring(pos, input.length() - 1);
pos = input.length();
return data;
}
String consumeLetterSequence() {
int start = pos;
while (!isEmpty()) {
char c = input.charAt(pos);
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && (c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z')))
pos++;
else
break;
}
return input.substring(start, pos);
}
String consumeHexSequence() {
int start = pos;
while (!isEmpty()) {
char c = input.charAt(pos);
if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'))
pos++;
else
break;
}
return input.substring(start, pos);
}
String consumeDigitSequence() {
int start = pos;
while (!isEmpty()) {
char c = input.charAt(pos);
if (c >= '0' && c <= '9')
pos++;
else
break;
}
return input.substring(start, pos);
}
boolean matches(char c) {
return !isEmpty() && input.charAt(pos) == c;
}
boolean matches(String seq) {
return input.startsWith(seq, pos);
}
boolean matchesIgnoreCase(String seq) {
return input.regionMatches(true, pos, seq, 0, seq.length());
}
boolean matchesAny(char... seq) {
if (isEmpty())
return false;
char c = input.charAt(pos);
for (char seek : seq) {
if (seek == c)
return true;
}
return false;
}
boolean matchesLetter() {
if (isEmpty())
return false;
char c = input.charAt(pos);
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
}
boolean matchesDigit() {
if (isEmpty())
return false;
char c = input.charAt(pos);
return (c >= '0' && c <= '9');
}
boolean matchConsume(String seq) {
if (matches(seq)) {
pos += seq.length();
return true;
} else {
return false;
}
}
boolean matchConsumeIgnoreCase(String seq) {
if (matchesIgnoreCase(seq)) {
pos += seq.length();
return true;
} else {
return false;
}
}
boolean containsIgnoreCase(String seq) {
// used to check presence of </title>, </style>. only finds consistent case.
String loScan = seq.toLowerCase();
String hiScan = seq.toUpperCase();
return (input.indexOf(loScan, pos) > -1) || (input.indexOf(hiScan, pos) > -1);
}
@Override
public String toString() {
return input.substring(pos);
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
b4c699df41d9a47de27d6246caaf5e94fb330bb6 | cf403235a54279e189ee2d9aacb846d3fd163603 | /collections/HashingBasedDS/POJOs/Truck.java | ddc9b8a79d75fd7b45ffead95c6d3c419044f0b7 | [] | no_license | shubham9415/ProgramsJava | bfa0d3606716b899758b0200cc327248690dbbe3 | 3bfc4e9c9ffeff064d6bf1fc3a02b1f45425f4d5 | refs/heads/main | 2023-01-13T03:53:42.488416 | 2020-10-30T07:38:56 | 2020-10-30T07:38:56 | 308,555,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package com.practice.mustseeinterviewproblems.collections.HashingBasedDS.POJOs;
public class Truck {
private int modelYear;
private String name;
public int getModelYear() {
return modelYear;
}
public void setModelYear(int modelYear) {
this.modelYear = modelYear;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
856088744613d9a5df57b871c52c3e432f5c9ac2 | 2af8e2dc8f6c70c2a638ece5da2f591f5e7f2454 | /src/cn/ascending/ascendingAlgorithm/array/findFirLastEle.java | be2235ff85d2e1775e3d4aa6533ef9857466862c | [] | no_license | wcao2/alg-and-dt | 370159c362b7983de09ec52e1ccd13bd981e42f2 | 5a1c9b7c5bbf690099805c74ff03f1623c49e063 | refs/heads/master | 2023-02-03T06:36:20.765407 | 2020-11-20T21:00:38 | 2020-11-20T21:00:38 | 256,337,199 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,657 | java | package cn.ascending.ascendingAlgorithm.array;
//https://www.youtube.com/watch?time_continue=19&v=bU-q1OJ0KWw&feature=emb_logo
//find the first and last position of the Element in sorted Array
public class findFirLastEle {
public static int[] searchRange(int[] nums,int target){
int[] result=new int[2];
result[0]=findStartingIndex(nums,target);
result[1]=findEndingIndex(nums,target);
return result;
}
public static int findStartingIndex(int[] nums,int target){
int index=-1;
int start=0;
int end=nums.length-1;
while(start<=end){
int midpoint=start+(end-start)/2;
if(nums[midpoint]>=target){//due to want to find the first occurrence of the duplicates
end=midpoint-1;
}else {
start=midpoint+1;
}
if(nums[midpoint]==target) index=midpoint;
}
return index;
}
public static int findEndingIndex(int[] nums,int target){
int index=-1;
int start=0;
int end=nums.length-1;
while(start<=end){
int midpoint=start+(end-start)/2;
if(nums[midpoint]<=target){
start=midpoint+1;//keep going to the rightmost one
}else{
end=midpoint-1;
}
if(nums[midpoint]==target) index=midpoint;
}
return index;
}
public static void main(String[] args) {
int[] arr={1,2,3,3,4,5};
int[] res= findFirLastEle.searchRange(arr,3);
for(int a:res){
System.out.println(a);
}
}
}
| [
"caowei20171218@gmail.com"
] | caowei20171218@gmail.com |
dc839ec62e9d7603b806ca3a9d89c2dbd9a194d2 | 95aa29979c8ef263e14a820f84ae1440e8b74bf8 | /jsp files/SendSms.java | 1a6a8ac98f3049c9200101694507b7ff5e763294 | [] | no_license | GirishBB/SIT_MINI_PROJECT | 6dd25a40543c626431f443669afd6667601a56c2 | 1a4c985646fc922c500b76b600e8042ed7764b01 | refs/heads/master | 2021-01-19T19:51:52.184632 | 2017-08-23T19:34:01 | 2017-08-23T19:34:01 | 101,212,101 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,663 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Date;
public class SendSms {
public void sendSmstouser(String mobnumber,String type,String msg)
{
try
{
Date mydate = new Date(System.currentTimeMillis());
String data = "";
data += "method=sendMessage";
data += "&userid= 2000167496";
// your loginId
data += "&password=" +URLEncoder.encode("IcGjHfKnn", "UTF-8");
// your password
data data+= "&msg=" + URLEncoder.encode("Type of Message: " +type+" Message: "+msg+" Date "+ mydate.toString(), "UTF-8");
data += "&send_to=" +URLEncoder.encode(mobnumber, "UTF-8");
// a valid 10 digit phone no.
data += "&v=1.1" ;
data += "&msg_type=TEXT"; /* Can by "FLASH" or"UNICODE_TEXT" or “BINARY” data += "&auth_scheme=PLAIN"; */
URL url = new URL("http://enterprise.smsgupshup.com/GatewayAPI/rest?" + data);
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("GET");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.connect();
try (BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())))
{
String line;
StringBuilder buffer = new StringBuilder();
while ((line = rd.readLine()) != null)
{
buffer.append(line).append("\n");
}
System.out.println(buffer.toString());
}
conn.disconnect();
}
catch(IOException e){
}
}
} | [
"noreply@github.com"
] | noreply@github.com |
b95bcd3cc84dd44bf8a50f8f7928f5fbad24912b | 5f7a8324aaa946d9c7c644758a921e8fe6c82454 | /src/main/java/co/miranext/nosql/DocumentRef.java | fab655eccb827d147bfc22a5ae43c3a0fafdd465 | [
"MIT"
] | permissive | wmira/nosql-jdbc | 90fa11532f515f7863bdb32a7e5dc1022d9661c6 | 67c8a1866caa03713baacd1ce80db526b851613c | refs/heads/master | 2020-04-12T15:13:50.308647 | 2015-03-05T11:36:46 | 2015-03-05T11:36:46 | 28,564,056 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 441 | java | package co.miranext.nosql;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface DocumentRef {
/**
* A DocumentRef can be a another document definition
*
* @return
*/
Class document() default Void.class;
}
| [
"warrenmira@gmail.com"
] | warrenmira@gmail.com |
caf6348d9ce2a40c372e7452cd3b963587664dea | da2e0b128c4d875beb6b6a516ecfd50c96ba5a9b | /oa_interface/src/main/java/com/friends/dao/MfInvitationUserDataDao.java | 6b2b613252c47f402933b1e6f43cd0e9aa51049a | [] | no_license | shanghuxiaozi/oa | 2fbb9a276cfe2f6f4cb3f5b031a45462e9d256f0 | 78165217b1632138bda5edc940b26f4727243a1f | refs/heads/master | 2021-01-20T01:44:30.956910 | 2018-07-14T11:00:31 | 2018-07-14T11:00:31 | 89,322,913 | 0 | 3 | null | null | null | null | UTF-8 | Java | false | false | 279 | java | package com.friends.dao;
import com.friends.entity.MfInvitationUserData;
//
public interface MfInvitationUserDataDao extends BaseDao<MfInvitationUserData>{
public MfInvitationUserData findByIdcard(String idcard);
public MfInvitationUserData findByUserId(String userId);
}
| [
"921233883@qq.com"
] | 921233883@qq.com |
36a11c49a0949d786a827ef6d5bfd89be9911ea1 | 85fad1a3e0d6b7cda90c596dfeda4c63d69945b3 | /app/src/main/java/com/thinkgeniux/sportsmatch/Adapters/Stories_Adapter_horizontal.java | c6450d5230dea50818c75436ca679fb42b993149 | [] | no_license | zahidalichaudhry/SportsMatch | bf80bfdc1dd41002b5b1b4b999acc46365e6f023 | 0269cd8340e14d541582a48e17970bcdc083ba9f | refs/heads/master | 2020-04-21T12:25:09.166121 | 2019-02-21T14:39:47 | 2019-02-21T14:39:47 | 169,561,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,115 | java | package com.thinkgeniux.sportsmatch.Adapters;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.support.constraint.ConstraintLayout;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.MediaController;
import android.widget.TextView;
import android.widget.VideoView;
import com.thinkgeniux.sportsmatch.PojoClasses.Stories;
import com.thinkgeniux.sportsmatch.R;
import java.util.ArrayList;
import de.hdodenhof.circleimageview.CircleImageView;
/**
* Created by CH-Hamza on 2/21/2018.
*/
public class Stories_Adapter_horizontal extends RecyclerView.Adapter<Stories_Adapter_horizontal.MyViewHolder> {
Activity activity;
ArrayList<Stories> arrayList=new ArrayList<>();
Dialog dialog;
ConstraintLayout cl_full;
String uriString;
VideoView vv;
String id;
MediaController mediaController;
public Stories_Adapter_horizontal(ArrayList<Stories> arrayList, Context context) {
this.arrayList=arrayList;
activity = (Activity) context;
}
@Override
public Stories_Adapter_horizontal.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.stories_item, parent, false);
return new Stories_Adapter_horizontal.MyViewHolder(view);
}
@Override
public void onBindViewHolder(final Stories_Adapter_horizontal.MyViewHolder holder, final int position)
{
holder.name.setText(arrayList.get(position).getCategName());
holder.imageView.setImageResource(arrayList.get(position).getCategImage());
View view2 = activity.getLayoutInflater().inflate(R.layout.full_screen_dialog,null);
dialog= new Dialog(activity,android.R.style.Theme_DeviceDefault_Light_NoActionBar_Fullscreen);
dialog.setContentView(view2);
cl_full=view2.findViewById(R.id.cl_fullscreen);
vv = view2.findViewById(R.id.main_videoView);
mediaController =new MediaController(activity);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
id=arrayList.get(position).getID();
if (id.equals("1")||id.equals("3"))
{
uriString = "android.resource://" + activity.getPackageName() + "/" + R.raw.bestgoals;
}else
{
uriString = "android.resource://" + activity.getPackageName() + "/" + R.raw.fight;
}
vv.setVideoURI(Uri.parse(uriString));
vv.setMediaController(mediaController);
vv.setZOrderOnTop(true);
vv.start();
dialog.show();
}
});
vv.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// dialog.dismiss();
}
});
cl_full.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
}
@Override
public int getItemCount() {
return arrayList.size();
}
public static class MyViewHolder extends RecyclerView.ViewHolder {
TextView name,price;
FloatingActionButton remove;
ImageView imageView;
public MyViewHolder(View itemView) {
super(itemView);
// imageView = (ImageView) itemView.findViewById(R.id.product_pic);
// remove=(FloatingActionButton)itemView.findViewById(R.id.floatingremove);
imageView = (CircleImageView) itemView.findViewById(R.id.circleImageView);
name=(TextView)itemView.findViewById(R.id.name);
}
}
}
| [
"32008062+zahidalichaudhry@users.noreply.github.com"
] | 32008062+zahidalichaudhry@users.noreply.github.com |
bb75739d551be7e0bfa2d02502a29fd361042277 | b6600fd872b606d9046e4bab77c86493e799db70 | /taf-swing-server/src/main/java/com/baloise/testautomation/taf/swing/server/elements/SwUnsupportedElement.java | 1465ca6934c9b711014af03ef1a2bfcf2c647940 | [
"MIT"
] | permissive | baloise/test-automation-framework | c022ee9fe9a3a1b39487b1cada99e9c464eba040 | 2ef2b08a0148ab296e1d61b8da6dc1c819a3adac | refs/heads/master | 2023-08-31T10:43:46.046285 | 2023-08-22T14:58:04 | 2023-08-22T14:58:04 | 37,980,614 | 2 | 19 | MIT | 2023-07-07T21:24:46 | 2015-06-24T11:31:05 | Java | UTF-8 | Java | false | false | 952 | java | package com.baloise.testautomation.taf.swing.server.elements;
import java.awt.Component;
import org.assertj.swing.fixture.AbstractComponentFixture;
import com.baloise.testautomation.taf.common.utils.TafProperties;
public class SwUnsupportedElement extends ASwElement {
public SwUnsupportedElement(long tid, Component component) {
super(tid, component);
}
@Override
public TafProperties basicExecCommand(TafProperties props) {
throw new IllegalArgumentException("unsupported element");
}
@Override
public void fillProperties() {}
@Override
public Component getComponent() {
return component;
}
@Override
public AbstractComponentFixture getFixture() {
return null;
}
@Override
public String getType() {
Component c = getComponent();
if (c == null) {
return "unsupportedelement-nullcomponent";
}
return "unsupportedelement-" + getComponent().getClass().getSimpleName();
}
}
| [
"christian.josephy@baloise.ch"
] | christian.josephy@baloise.ch |
a44ebf2322c68076cd0f10e82305a46b171a3962 | 817e3442a6d1de41d1c9115efa11d7f0c8fbcdfc | /itcast/day05_dataSource_jdbcTemplate/src/cn/itcast/datasource/druid/DruidDemo.java | 9d453de9bf3c31865a4a5a00614bcd80feaeef0d | [] | no_license | newMyLxc/repo3 | b282938658949832f122cb06360063912d6f00b4 | ee8aec9b1eb339e6114af80a13a297cb9e3871f3 | refs/heads/main | 2023-03-24T17:31:30.300975 | 2021-03-23T07:33:37 | 2021-03-23T07:33:37 | 350,587,281 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 830 | java | package cn.itcast.datasource.druid;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import javax.sql.DataSource;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Properties;
/**
* Druid演示
* @author ASUS
*/
public class DruidDemo {
public static void main(String[] args) throws Exception {
//1.导入jar包
//2.定义配置文件
//3.加载配置文件
Properties pro = new Properties();
InputStream is = DruidDemo.class.getClassLoader().getResourceAsStream("druid.properties");
pro.load(is);
//4.获取连接池对象
DataSource ds = DruidDataSourceFactory.createDataSource(pro);
//5.获取连接
Connection conn = ds.getConnection();
System.out.println(conn);
}
}
| [
"1215995953@qq.com"
] | 1215995953@qq.com |
f2b4c5cba618ed5e9b6e10d9a8f3cd273158cc1b | 510c132e8b0a3d21ca53a4a3ad6748044b2c361d | /cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/deployments/_ListDeploymentsResponse.java | 515c11409dbb933187c6e2078099e1a78faa2cc5 | [
"Apache-2.0"
] | permissive | keviningvalson/cf-java-client | 1193c941c8d823c4adfa35f52f77993b4b734fb2 | 6a14b7a3e76328a758b5e02fa2c5b6457d7f6a34 | refs/heads/master | 2020-09-02T11:21:30.115615 | 2020-08-14T13:44:24 | 2020-08-14T13:44:24 | 219,210,049 | 0 | 0 | Apache-2.0 | 2019-11-02T20:29:03 | 2019-11-02T20:29:03 | null | UTF-8 | Java | false | false | 1,019 | java | /*
* Copyright 2013-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.cloudfoundry.client.v3.deployments;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.cloudfoundry.client.v3.PaginatedResponse;
import org.immutables.value.Value;
/**
* The response payload for the List Deployments operation.
*/
@JsonDeserialize
@Value.Immutable
abstract class _ListDeploymentsResponse extends PaginatedResponse<DeploymentResource> {
}
| [
"pharris@pivotal.io"
] | pharris@pivotal.io |
1e72012f9d17b90c1ece53256212228a3f15a23e | 698024cc84220c783ec5a7505fdf3caded1acfc4 | /foshan-core/src/main/java/com/ycnet/frms/vo/DeviceEntityVo.java | 986e15a6e34a26ba173ce023a317c5960c587bd1 | [] | no_license | tao-ge/public | cd7b1f01999f67f8aa5861e876d38d75c922356e | 93cdb6891bcf8a1af915233139cf04227e29d337 | refs/heads/master | 2020-04-08T21:54:20.796744 | 2018-11-30T07:07:59 | 2018-11-30T07:07:59 | 159,763,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,749 | java | package com.ycnet.frms.vo;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.ycnet.frms.bean.FacilityEntity;
public class DeviceEntityVo{
private Long codId;
private String codCode;
private String codName;
private String codMac;
private String codImei;
private Long devId;
private String codState;
private Date rptTime;
private String rptTimeSta;
private String rptTimeEnd;
private Date createTime;
private Long createUser;
private Date lastModifyTime;
private Long lastModifyUser;
private Long orgId;
private Long hardId;
private Date lastHardTime;
private String devNameRoom;//机房名称
private String devCodeRoom;//机房编码
private String devAddr;//设施地址
private String devType;
private BigDecimal baiduX;
private BigDecimal baiduY;
private DiscInfoEntityVo disc;//光交箱里的端子控制器状态
private List<DiscInfoEntityVo> discList;
private List<FacilityEntity> facilityList;
private String lockWorkStatus;
private String temp;
private String battery;
private String signals;
private String tilt;
private String lockOpen01;//锁1状态
private String doorOpen01;//门1状态
private String lockOpen02;//锁2状态
private String doorOpen02;//门2状态
private String workState;//中控器工作状态
public Long getCodId() {
return codId;
}
public void setCodId(Long codId) {
this.codId = codId;
}
public String getCodCode() {
return codCode;
}
public void setCodCode(String codCode) {
this.codCode = codCode;
}
public String getCodName() {
return codName;
}
public void setCodName(String codName) {
this.codName = codName;
}
public String getCodMac() {
return codMac;
}
public void setCodMac(String codMac) {
this.codMac = codMac;
}
public String getCodImei() {
return codImei;
}
public void setCodImei(String codImei) {
this.codImei = codImei;
}
public Long getDevId() {
return devId;
}
public void setDevId(Long devId) {
this.devId = devId;
}
public String getCodState() {
return codState;
}
public void setCodState(String codState) {
this.codState = codState;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Date getLastModifyTime() {
return lastModifyTime;
}
public void setLastModifyTime(Date lastModifyTime) {
this.lastModifyTime = lastModifyTime;
}
public Long getLastModifyUser() {
return lastModifyUser;
}
public void setLastModifyUser(Long lastModifyUser) {
this.lastModifyUser = lastModifyUser;
}
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
public Long getHardId() {
return hardId;
}
public void setHardId(Long hardId) {
this.hardId = hardId;
}
public String getDevNameRoom() {
return devNameRoom;
}
public void setDevNameRoom(String devNameRoom) {
this.devNameRoom = devNameRoom.trim();
}
public List<DiscInfoEntityVo> getDiscList() {
return discList;
}
public void setDiscList(List<DiscInfoEntityVo> discList) {
this.discList = discList;
}
public String getDevCodeRoom() {
return devCodeRoom;
}
public void setDevCodeRoom(String devCodeRoom) {
this.devCodeRoom = devCodeRoom.trim();
}
public String getDevAddr() {
return devAddr;
}
public void setDevAddr(String devAddr) {
this.devAddr = devAddr;
}
public List<FacilityEntity> getFacilityList() {
return facilityList;
}
public void setFacilityList(List<FacilityEntity> facilityList) {
this.facilityList = facilityList;
}
public BigDecimal getBaiduX() {
return baiduX;
}
public void setBaiduX(BigDecimal baiduX) {
this.baiduX = baiduX;
}
public BigDecimal getBaiduY() {
return baiduY;
}
public void setBaiduY(BigDecimal baiduY) {
this.baiduY = baiduY;
}
public DiscInfoEntityVo getDisc() {
return disc;
}
public void setDisc(DiscInfoEntityVo disc) {
this.disc = disc;
}
public String getDevType() {
return devType;
}
public void setDevType(String devType) {
this.devType = devType;
}
public String getRptTimeSta() {
return rptTimeSta;
}
public void setRptTimeSta(String rptTimeSta) {
this.rptTimeSta = rptTimeSta;
}
public String getRptTimeEnd() {
return rptTimeEnd;
}
public void setRptTimeEnd(String rptTimeEnd) {
this.rptTimeEnd = rptTimeEnd;
}
public String getLockWorkStatus() {
return lockWorkStatus;
}
public String getTemp() {
return temp;
}
public String getBattery() {
return battery;
}
public String getSignals() {
return signals;
}
public String getTilt() {
return tilt;
}
public void setLockWorkStatus(String lockWorkStatus) {
this.lockWorkStatus = lockWorkStatus;
}
public void setTemp(String temp) {
this.temp = temp;
}
public void setBattery(String battery) {
this.battery = battery;
}
public void setSignals(String signals) {
this.signals = signals;
}
public void setTilt(String tilt) {
this.tilt = tilt;
}
public Date getRptTime() {
return rptTime;
}
public void setRptTime(Date rptTime) {
this.rptTime = rptTime;
}
public String getWorkState() {
return workState;
}
public void setWorkState(String workState) {
this.workState = workState;
}
public String getLockOpen01() {
return lockOpen01;
}
public void setLockOpen01(String lockOpen01) {
this.lockOpen01 = lockOpen01;
}
public String getDoorOpen01() {
return doorOpen01;
}
public void setDoorOpen01(String doorOpen01) {
this.doorOpen01 = doorOpen01;
}
public String getLockOpen02() {
return lockOpen02;
}
public void setLockOpen02(String lockOpen02) {
this.lockOpen02 = lockOpen02;
}
public String getDoorOpen02() {
return doorOpen02;
}
public void setDoorOpen02(String doorOpen02) {
this.doorOpen02 = doorOpen02;
}
public Date getLastHardTime() {
return lastHardTime;
}
public void setLastHardTime(Date lastHardTime) {
this.lastHardTime = lastHardTime;
}
}
| [
"YHT@DESKTOP-7FHE6O3"
] | YHT@DESKTOP-7FHE6O3 |
8df364e3655cbadf5cc772c7a7eb0ea3a1b8dec3 | 6821f3c32b12b9859077aa82372f11683b7191d0 | /problems/src/Loop/src/For/for16.java | 903f5794ef469f0324fa251d8b2362d644f149c2 | [] | no_license | mayk007/Foundation_JAVA | 42ad72bd0e2851139a05a4ead1a5bc05e5e54f53 | 2f85acc96166b57c75230f21d0be6b5600f6985e | refs/heads/main | 2023-08-24T15:59:23.335009 | 2021-11-07T05:04:23 | 2021-11-07T05:04:23 | 392,253,560 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 501 | java | package Loop.src.For;
import java.util.Scanner;
public class for16 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("(a>0), Son a= ");
double a = in.nextDouble();
System.out.print("(n>0), Daraja n= ");
int n = in.nextInt();
double Sum = 1;
for (int i = 1; i <= n; i++) {
Sum *= a;
System.out.println(a + " ning " + i + " - darajasi = "+ Sum);
}
}
}
| [
"bek1991@mail.ru"
] | bek1991@mail.ru |
3c5158fc4808baa0050d6056c4a36ffdf213ea36 | 6839e7abfa2e354becd034ea46f14db3cbcc7488 | /src/com/sinosoft/schema/SDDREmailExtractRecodeSet.java | 5652720327026f6cb2d64e1bce635a155221ef25 | [] | no_license | trigrass2/wj | aa2d310baa876f9e32a65238bcd36e7a2440b8c6 | 0d4da9d033c6fa2edb014e3a80715c9751a93cd5 | refs/heads/master | 2021-04-19T11:03:25.609807 | 2018-01-12T09:26:11 | 2018-01-12T09:26:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,585 | java | package com.sinosoft.schema;
import com.sinosoft.schema.SDDREmailExtractRecodeSchema;
import com.sinosoft.framework.orm.SchemaSet;
public class SDDREmailExtractRecodeSet extends SchemaSet {
public SDDREmailExtractRecodeSet() {
this(10,0);
}
public SDDREmailExtractRecodeSet(int initialCapacity) {
this(initialCapacity,0);
}
public SDDREmailExtractRecodeSet(int initialCapacity,int capacityIncrement) {
super(initialCapacity,capacityIncrement);
TableCode = SDDREmailExtractRecodeSchema._TableCode;
Columns = SDDREmailExtractRecodeSchema._Columns;
NameSpace = SDDREmailExtractRecodeSchema._NameSpace;
InsertAllSQL = SDDREmailExtractRecodeSchema._InsertAllSQL;
UpdateAllSQL = SDDREmailExtractRecodeSchema._UpdateAllSQL;
FillAllSQL = SDDREmailExtractRecodeSchema._FillAllSQL;
DeleteSQL = SDDREmailExtractRecodeSchema._DeleteSQL;
}
protected SchemaSet newInstance(){
return new SDDREmailExtractRecodeSet();
}
public boolean add(SDDREmailExtractRecodeSchema aSchema) {
return super.add(aSchema);
}
public boolean add(SDDREmailExtractRecodeSet aSet) {
return super.add(aSet);
}
public boolean remove(SDDREmailExtractRecodeSchema aSchema) {
return super.remove(aSchema);
}
public SDDREmailExtractRecodeSchema get(int index) {
SDDREmailExtractRecodeSchema tSchema = (SDDREmailExtractRecodeSchema) super.getObject(index);
return tSchema;
}
public boolean set(int index, SDDREmailExtractRecodeSchema aSchema) {
return super.set(index, aSchema);
}
public boolean set(SDDREmailExtractRecodeSet aSet) {
return super.set(aSet);
}
}
| [
"liyinfeng0520@163.com"
] | liyinfeng0520@163.com |
8645498b2ce504cbed71800aeb584d4cf01bedad | a710eb59b2547bb763200c9ac06972c15a6fbcdc | /emart_eclipse/emart_eclipse/BuyerItemservice/src/main/java/com/abc/BuyerItemservice/model/ItemPojo.java | 25764e022e74f81661359d64ada3f270d6293174 | [] | no_license | sneha546/844827_eMart_finalProject | 00e78df5909d668354dacd51d838b83815aee4db | eda2c6b1449445f1a3a1878735c1968dbf49064d | refs/heads/master | 2023-05-04T17:28:26.703807 | 2020-03-14T12:36:58 | 2020-03-14T12:36:58 | 247,256,796 | 0 | 0 | null | 2023-04-17T19:41:51 | 2020-03-14T10:36:53 | Java | UTF-8 | Java | false | false | 2,564 | java | package com.abc.BuyerItemservice.model;
public class ItemPojo {
private int itemId;
private String itemName;
private String itemImage;
private int itemPrice;
private int itemStock;
private String itemDescription;
private String itemRemarks;
private SubCategoryPojo subcategory;
private SellerSignupPojo sellersignup;
public int getItemId() {
return itemId;
}
public void setItemId(int itemId) {
this.itemId = itemId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public String getItemImage() {
return itemImage;
}
public void setItemImage(String itemImage) {
this.itemImage = itemImage;
}
public int getItemPrice() {
return itemPrice;
}
public void setItemPrice(int itemPrice) {
this.itemPrice = itemPrice;
}
public int getItemStock() {
return itemStock;
}
public void setItemStock(int itemStock) {
this.itemStock = itemStock;
}
public String getItemDescription() {
return itemDescription;
}
public void setItemDescription(String itemDescription) {
this.itemDescription = itemDescription;
}
public String getItemRemarks() {
return itemRemarks;
}
public void setItemRemarks(String itemRemarks) {
this.itemRemarks = itemRemarks;
}
public SubCategoryPojo getSubcategory() {
return subcategory;
}
public void setSubcategory(SubCategoryPojo subcategory) {
this.subcategory = subcategory;
}
public SellerSignupPojo getSellersignup() {
return sellersignup;
}
public void setSellersignup(SellerSignupPojo sellersignup) {
this.sellersignup = sellersignup;
}
public ItemPojo(int itemId, String itemName, String itemImage, int itemPrice, int itemStock, String itemDescription,
String itemRemarks, SubCategoryPojo subcategory, SellerSignupPojo sellersignup) {
super();
this.itemId = itemId;
this.itemName = itemName;
this.itemImage = itemImage;
this.itemPrice = itemPrice;
this.itemStock = itemStock;
this.itemDescription = itemDescription;
this.itemRemarks = itemRemarks;
this.subcategory = subcategory;
this.sellersignup = sellersignup;
}
public ItemPojo() {
super();
// TODO Auto-generated constructor stub
}
@Override
public String toString() {
return "ItemPojo [itemId=" + itemId + ", itemName=" + itemName + ", itemImage=" + itemImage + ", itemPrice="
+ itemPrice + ", itemStock=" + itemStock + ", itemDescription=" + itemDescription + ", itemRemarks="
+ itemRemarks + ", subcategory=" + subcategory + ", sellersignup=" + sellersignup + "]";
}
} | [
"snehasweetykvsv@gmail.com"
] | snehasweetykvsv@gmail.com |
f30032280f54a2b475d8e0decda65668ead4cf0f | 469da40c238685b3a21af37e12265e7a3b126322 | /java/season03/hw03/src/main/java/Main3.java | 9b23018d50d89a21e2eba985cf022fb956f93215 | [] | no_license | peanuts6/homework | 0583325b6e3d4d50d9c3ce1ffb2797d768c82d9b | cc01976ed33fad08e7546996e083f646abf9c29d | refs/heads/master | 2021-01-01T16:54:53.783942 | 2018-01-29T04:19:03 | 2018-01-29T04:19:03 | 97,952,408 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 859 | java | import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import leader.bean.AnnotationBean;
import java.util.Date;
/**
* Created by leader on 17/8/28.
*/
@Configuration
@ComponentScan("leader.bean")
public class Main3 {
public static void main(String[] args) throws InterruptedException {
System.out.println(new Date() + " begin");
ApplicationContext ctx = new AnnotationConfigApplicationContext(Main3.class);
AnnotationBean bean = (AnnotationBean) ctx.getBean("annotationBean");
bean.setMyName("i am annotation domain");
System.out.println(new Date()+" get domain "+bean);
bean.sayHello();
}
}
| [
"24599489@qq.com"
] | 24599489@qq.com |
22e6453516f65295af86e032cd6c5a06f147b328 | 13674743295415fdf14bcd126c31320ecd48fb06 | /work/src/main/java/BasicException/NameNotValidException.java | 7aecc676ee0d5280f227d64e799f6b008999a194 | [] | no_license | Rathorepradhumna/java-work | 2aef570b21ed78d3384bd6813035713d7681d65e | 2cb65d8fb70ff953be28e416dfa7e1cb468edbec | refs/heads/master | 2022-12-26T19:48:18.130916 | 2020-10-06T18:36:09 | 2020-10-06T18:36:09 | 298,371,620 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 138 | java | package BasicException;
public class NameNotValidException extends Exception {
NameNotValidException(String s){
super(s);
}
}
| [
"pradhumnarathore1998@gmail.com"
] | pradhumnarathore1998@gmail.com |
c8af6e39e13033c0ca9fac58149b9b4b1c723f7a | d59728e3059cbee0fdccf1df739a740f4dd36cba | /src/main/java/com/powersoft/itec2017/framework/DatabaseManager.java | 84392671aeabf6492e69325d2d28a13549b1bc21 | [] | no_license | TeodorVecerdi/itec2017 | 9615397bd67784c6d07fc8beb470c2fe3c17bdbd | 849db5c592f2a28501af40863fd620f2e3a42c8b | refs/heads/master | 2021-01-19T07:22:10.362831 | 2017-04-08T22:31:15 | 2017-04-08T22:31:15 | 87,539,880 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,002 | java | package com.powersoft.itec2017.framework;
import com.powersoft.itec2017.Main;
import com.sun.org.apache.bcel.internal.generic.INSTANCEOF;
import javax.swing.plaf.nimbus.State;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class DatabaseManager {
public static void executePreparedUpdate(String sql, Object... params) {
PreparedStatement statement = null;
try {
statement = Main.getConnection().prepareStatement(sql);
for (int i = 0; i < params.length; i++) {
if (params[i] instanceof byte[])
statement.setBytes(i + 1, ((byte[]) params[i]));
else
statement.setObject(i + 1, params[i]);
}
statement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
}
}
public static void executeUpdate(String sql) {
Statement statement = null;
try {
statement = Main.getConnection().createStatement();
statement.executeUpdate(sql);
} catch (SQLException e) {
e.printStackTrace();
}
}
public static ResultSet executePreparedQuery(String sql, Object... params) {
PreparedStatement statement = null;
try {
statement = Main.getConnection().prepareStatement(sql);
for (int i = 0; i < params.length; i++) {
statement.setObject(i + 1, params[i]);
}
return statement.executeQuery();
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
public static ResultSet executeQuery(String sql) {
try {
Statement statement = Main.getConnection().createStatement();
return statement.executeQuery(sql);
} catch (SQLException e) {
e.printStackTrace();
return null;
}
}
}
| [
"teo.vecerdi@gmail.com"
] | teo.vecerdi@gmail.com |
29c3c088c8d786b2d0fe385e37f0e5cf412fa2e3 | df33bb5856ce3baac9f4ee88b7f851a653142858 | /eu.scasefp7.eclipse.mde.wrapper/src/AuthenticationLayerPSM/impl/AuthenticationLayerPSMPackageImpl.java | 62a4670de674997605b8c58981feabcd9012c002 | [] | no_license | LeonoraG/mde | 6414c607a2a8db43b74cc93ecd7feee6ef90eea1 | 3b411ea45ae466b4eb01e3626af35efe34a4ced3 | refs/heads/master | 2021-01-24T22:35:23.508664 | 2016-04-20T11:57:38 | 2016-04-20T11:57:38 | 43,670,655 | 0 | 0 | null | 2015-10-05T07:29:17 | 2015-10-05T07:29:16 | null | UTF-8 | Java | false | false | 23,112 | java | /**
*/
package AuthenticationLayerPSM.impl;
import AuthenticationLayerPSM.AnnHTTPActivity;
import AuthenticationLayerPSM.AnnHTTPActivityHandler;
import AuthenticationLayerPSM.AnnJPAController;
import AuthenticationLayerPSM.AnnotatedElement;
import AuthenticationLayerPSM.Annotation;
import AuthenticationLayerPSM.AnnotationModel;
import AuthenticationLayerPSM.AuthenticationLayerPSMFactory;
import AuthenticationLayerPSM.AuthenticationLayerPSMPackage;
import AuthenticationLayerPSM.AuthenticationMode;
import AuthenticationLayerPSM.AuthenticationOnlyMode;
import AuthenticationLayerPSM.AuthenticationPerformer;
import AuthenticationLayerPSM.AuthenticationToken;
import AuthenticationLayerPSM.BothMode;
import AuthenticationLayerPSM.GuestMode;
import AuthenticationLayerPSM.Password;
import RESTfulServicePSM.RESTfulServicePSMPackage;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.EPackageImpl;
/**
* <!-- begin-user-doc -->
* An implementation of the model <b>Package</b>.
* <!-- end-user-doc -->
* @generated
*/
public class AuthenticationLayerPSMPackageImpl extends EPackageImpl implements AuthenticationLayerPSMPackage {
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass annotationModelEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass annotationEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass annotatedElementEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass authenticationModeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass authenticationPerformerEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass authenticationTokenEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass passwordEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass annHTTPActivityEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass annHTTPActivityHandlerEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass annJPAControllerEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass guestModeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass authenticationOnlyModeEClass = null;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private EClass bothModeEClass = null;
/**
* Creates an instance of the model <b>Package</b>, registered with
* {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
* package URI value.
* <p>Note: the correct way to create the package is via the static
* factory method {@link #init init()}, which also performs
* initialization of the package, or returns the registered package,
* if one already exists.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see org.eclipse.emf.ecore.EPackage.Registry
* @see AuthenticationLayerPSM.AuthenticationLayerPSMPackage#eNS_URI
* @see #init()
* @generated
*/
private AuthenticationLayerPSMPackageImpl() {
super(eNS_URI, AuthenticationLayerPSMFactory.eINSTANCE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private static boolean isInited = false;
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link AuthenticationLayerPSMPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/
public static AuthenticationLayerPSMPackage init() {
if (isInited) return (AuthenticationLayerPSMPackage)EPackage.Registry.INSTANCE.getEPackage(AuthenticationLayerPSMPackage.eNS_URI);
// Obtain or create and register package
AuthenticationLayerPSMPackageImpl theAuthenticationLayerPSMPackage = (AuthenticationLayerPSMPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof AuthenticationLayerPSMPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new AuthenticationLayerPSMPackageImpl());
isInited = true;
// Initialize simple dependencies
RESTfulServicePSMPackage.eINSTANCE.eClass();
// Create package meta-data objects
theAuthenticationLayerPSMPackage.createPackageContents();
// Initialize created meta-data
theAuthenticationLayerPSMPackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
theAuthenticationLayerPSMPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(AuthenticationLayerPSMPackage.eNS_URI, theAuthenticationLayerPSMPackage);
return theAuthenticationLayerPSMPackage;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAnnotationModel() {
return annotationModelEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAnnotationModel_Name() {
return (EAttribute)annotationModelEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAnnotationModel_HasAnnotatedElement() {
return (EReference)annotationModelEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAnnotationModel_HasAnnotation() {
return (EReference)annotationModelEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAnnotationModel_AnnotatesRESTfulServicePSM() {
return (EReference)annotationModelEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAnnotationModel_AnnotationType() {
return (EAttribute)annotationModelEClass.getEStructuralFeatures().get(4);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAnnotation() {
return annotationEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAnnotatedElement() {
return annotatedElementEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAnnotatedElement_Name() {
return (EAttribute)annotatedElementEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAuthenticationMode() {
return authenticationModeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAuthenticationMode_HTTPActivityHandlerHasAuthenticationMode() {
return (EReference)authenticationModeEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAuthenticationMode_HTTPActivityHasAuthenticationMode() {
return (EReference)authenticationModeEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAuthenticationPerformer() {
return authenticationPerformerEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAuthenticationPerformer_HasAuthenticationToken() {
return (EReference)authenticationPerformerEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAuthenticationPerformer_IsSystemAuthenticationPerformer() {
return (EReference)authenticationPerformerEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAuthenticationPerformer_AuthenticationModelName() {
return (EAttribute)authenticationPerformerEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAuthenticationPerformer_AuthenticationModelParentName() {
return (EAttribute)authenticationPerformerEClass.getEStructuralFeatures().get(3);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAuthenticationToken() {
return authenticationTokenEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAuthenticationToken_Name() {
return (EAttribute)authenticationTokenEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAuthenticationToken_Type() {
return (EAttribute)authenticationTokenEClass.getEStructuralFeatures().get(1);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EAttribute getAuthenticationToken_BIsUnique() {
return (EAttribute)authenticationTokenEClass.getEStructuralFeatures().get(2);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getPassword() {
return passwordEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAnnHTTPActivity() {
return annHTTPActivityEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAnnHTTPActivity_AnnotatesHTTPActivity() {
return (EReference)annHTTPActivityEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAnnHTTPActivityHandler() {
return annHTTPActivityHandlerEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAnnHTTPActivityHandler_AnnotatesHTTPActivityHandler() {
return (EReference)annHTTPActivityHandlerEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAnnJPAController() {
return annJPAControllerEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EReference getAnnJPAController_AnnotatesJPAController() {
return (EReference)annJPAControllerEClass.getEStructuralFeatures().get(0);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getGuestMode() {
return guestModeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getAuthenticationOnlyMode() {
return authenticationOnlyModeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EClass getBothMode() {
return bothModeEClass;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AuthenticationLayerPSMFactory getAuthenticationLayerPSMFactory() {
return (AuthenticationLayerPSMFactory)getEFactoryInstance();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isCreated = false;
/**
* Creates the meta-model objects for the package. This method is
* guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createPackageContents() {
if (isCreated) return;
isCreated = true;
// Create classes and their features
annotationModelEClass = createEClass(ANNOTATION_MODEL);
createEAttribute(annotationModelEClass, ANNOTATION_MODEL__NAME);
createEReference(annotationModelEClass, ANNOTATION_MODEL__HAS_ANNOTATED_ELEMENT);
createEReference(annotationModelEClass, ANNOTATION_MODEL__HAS_ANNOTATION);
createEReference(annotationModelEClass, ANNOTATION_MODEL__ANNOTATES_RES_TFUL_SERVICE_PSM);
createEAttribute(annotationModelEClass, ANNOTATION_MODEL__ANNOTATION_TYPE);
annotationEClass = createEClass(ANNOTATION);
annotatedElementEClass = createEClass(ANNOTATED_ELEMENT);
createEAttribute(annotatedElementEClass, ANNOTATED_ELEMENT__NAME);
authenticationModeEClass = createEClass(AUTHENTICATION_MODE);
createEReference(authenticationModeEClass, AUTHENTICATION_MODE__HTTP_ACTIVITY_HANDLER_HAS_AUTHENTICATION_MODE);
createEReference(authenticationModeEClass, AUTHENTICATION_MODE__HTTP_ACTIVITY_HAS_AUTHENTICATION_MODE);
authenticationPerformerEClass = createEClass(AUTHENTICATION_PERFORMER);
createEReference(authenticationPerformerEClass, AUTHENTICATION_PERFORMER__HAS_AUTHENTICATION_TOKEN);
createEReference(authenticationPerformerEClass, AUTHENTICATION_PERFORMER__IS_SYSTEM_AUTHENTICATION_PERFORMER);
createEAttribute(authenticationPerformerEClass, AUTHENTICATION_PERFORMER__AUTHENTICATION_MODEL_NAME);
createEAttribute(authenticationPerformerEClass, AUTHENTICATION_PERFORMER__AUTHENTICATION_MODEL_PARENT_NAME);
authenticationTokenEClass = createEClass(AUTHENTICATION_TOKEN);
createEAttribute(authenticationTokenEClass, AUTHENTICATION_TOKEN__NAME);
createEAttribute(authenticationTokenEClass, AUTHENTICATION_TOKEN__TYPE);
createEAttribute(authenticationTokenEClass, AUTHENTICATION_TOKEN__BIS_UNIQUE);
passwordEClass = createEClass(PASSWORD);
annHTTPActivityEClass = createEClass(ANN_HTTP_ACTIVITY);
createEReference(annHTTPActivityEClass, ANN_HTTP_ACTIVITY__ANNOTATES_HTTP_ACTIVITY);
annHTTPActivityHandlerEClass = createEClass(ANN_HTTP_ACTIVITY_HANDLER);
createEReference(annHTTPActivityHandlerEClass, ANN_HTTP_ACTIVITY_HANDLER__ANNOTATES_HTTP_ACTIVITY_HANDLER);
annJPAControllerEClass = createEClass(ANN_JPA_CONTROLLER);
createEReference(annJPAControllerEClass, ANN_JPA_CONTROLLER__ANNOTATES_JPA_CONTROLLER);
guestModeEClass = createEClass(GUEST_MODE);
authenticationOnlyModeEClass = createEClass(AUTHENTICATION_ONLY_MODE);
bothModeEClass = createEClass(BOTH_MODE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
private boolean isInitialized = false;
/**
* Complete the initialization of the package and its meta-model. This
* method is guarded to have no affect on any invocation but its first.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void initializePackageContents() {
if (isInitialized) return;
isInitialized = true;
// Initialize package
setName(eNAME);
setNsPrefix(eNS_PREFIX);
setNsURI(eNS_URI);
// Obtain other dependent packages
RESTfulServicePSMPackage theRESTfulServicePSMPackage = (RESTfulServicePSMPackage)EPackage.Registry.INSTANCE.getEPackage(RESTfulServicePSMPackage.eNS_URI);
// Create type parameters
// Set bounds for type parameters
// Add supertypes to classes
authenticationModeEClass.getESuperTypes().add(this.getAnnotation());
authenticationPerformerEClass.getESuperTypes().add(this.getAnnotation());
passwordEClass.getESuperTypes().add(this.getAuthenticationToken());
annHTTPActivityEClass.getESuperTypes().add(this.getAnnotatedElement());
annHTTPActivityHandlerEClass.getESuperTypes().add(this.getAnnotatedElement());
annJPAControllerEClass.getESuperTypes().add(this.getAnnotatedElement());
guestModeEClass.getESuperTypes().add(this.getAuthenticationMode());
authenticationOnlyModeEClass.getESuperTypes().add(this.getAuthenticationMode());
bothModeEClass.getESuperTypes().add(this.getAuthenticationMode());
// Initialize classes, features, and operations; add parameters
initEClass(annotationModelEClass, AnnotationModel.class, "AnnotationModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getAnnotationModel_Name(), ecorePackage.getEString(), "name", null, 1, 1, AnnotationModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getAnnotationModel_HasAnnotatedElement(), this.getAnnotatedElement(), null, "hasAnnotatedElement", null, 1, -1, AnnotationModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getAnnotationModel_HasAnnotation(), this.getAnnotation(), null, "hasAnnotation", null, 1, -1, AnnotationModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getAnnotationModel_AnnotatesRESTfulServicePSM(), theRESTfulServicePSMPackage.getServicePSM(), null, "annotatesRESTfulServicePSM", null, 1, 1, AnnotationModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getAnnotationModel_AnnotationType(), ecorePackage.getEString(), "annotationType", null, 1, 1, AnnotationModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(annotationEClass, Annotation.class, "Annotation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(annotatedElementEClass, AnnotatedElement.class, "AnnotatedElement", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getAnnotatedElement_Name(), ecorePackage.getEString(), "name", null, 1, 1, AnnotatedElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(authenticationModeEClass, AuthenticationMode.class, "AuthenticationMode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getAuthenticationMode_HTTPActivityHandlerHasAuthenticationMode(), this.getAnnHTTPActivityHandler(), null, "HTTPActivityHandlerHasAuthenticationMode", null, 1, -1, AuthenticationMode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getAuthenticationMode_HTTPActivityHasAuthenticationMode(), this.getAnnHTTPActivity(), null, "HTTPActivityHasAuthenticationMode", null, 1, -1, AuthenticationMode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(authenticationPerformerEClass, AuthenticationPerformer.class, "AuthenticationPerformer", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getAuthenticationPerformer_HasAuthenticationToken(), this.getAuthenticationToken(), null, "hasAuthenticationToken", null, 2, 2, AuthenticationPerformer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getAuthenticationPerformer_IsSystemAuthenticationPerformer(), this.getAnnJPAController(), null, "isSystemAuthenticationPerformer", null, 1, 1, AuthenticationPerformer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getAuthenticationPerformer_AuthenticationModelName(), ecorePackage.getEString(), "authenticationModelName", null, 1, 1, AuthenticationPerformer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getAuthenticationPerformer_AuthenticationModelParentName(), ecorePackage.getEString(), "authenticationModelParentName", null, 1, 1, AuthenticationPerformer.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(authenticationTokenEClass, AuthenticationToken.class, "AuthenticationToken", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getAuthenticationToken_Name(), ecorePackage.getEString(), "name", null, 1, 1, AuthenticationToken.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getAuthenticationToken_Type(), ecorePackage.getEString(), "type", null, 1, 1, AuthenticationToken.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getAuthenticationToken_BIsUnique(), ecorePackage.getEBoolean(), "bIsUnique", null, 1, 1, AuthenticationToken.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(passwordEClass, Password.class, "Password", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(annHTTPActivityEClass, AnnHTTPActivity.class, "AnnHTTPActivity", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getAnnHTTPActivity_AnnotatesHTTPActivity(), theRESTfulServicePSMPackage.getHTTPActivity(), null, "annotatesHTTPActivity", null, 1, 1, AnnHTTPActivity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(annHTTPActivityHandlerEClass, AnnHTTPActivityHandler.class, "AnnHTTPActivityHandler", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getAnnHTTPActivityHandler_AnnotatesHTTPActivityHandler(), theRESTfulServicePSMPackage.getHTTPActivityHandler(), null, "annotatesHTTPActivityHandler", null, 1, 1, AnnHTTPActivityHandler.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(annJPAControllerEClass, AnnJPAController.class, "AnnJPAController", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getAnnJPAController_AnnotatesJPAController(), theRESTfulServicePSMPackage.getHibernateController(), null, "annotatesJPAController", null, 1, 1, AnnJPAController.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(guestModeEClass, GuestMode.class, "GuestMode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(authenticationOnlyModeEClass, AuthenticationOnlyMode.class, "AuthenticationOnlyMode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(bothModeEClass, BothMode.class, "BothMode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
// Create resource
createResource(eNS_URI);
}
} //AuthenticationLayerPSMPackageImpl
| [
"christopherzolotas@gmail.com"
] | christopherzolotas@gmail.com |
fba12044ed68de10e2ad5cee26d192353ca9b89c | 92225460ebca1bb6a594d77b6559b3629b7a94fa | /src/com/kingdee/eas/fdc/tenancy/client/TenRoomChargeSelectUI.java | 72d5d1a9a45984f59a435ef579e4754b32cf88b1 | [] | no_license | yangfan0725/sd | 45182d34575381be3bbdd55f3f68854a6900a362 | 39ebad6e2eb76286d551a9e21967f3f5dc4880da | refs/heads/master | 2023-04-29T01:56:43.770005 | 2023-04-24T05:41:13 | 2023-04-24T05:41:13 | 512,073,641 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 1,331 | java | package com.kingdee.eas.fdc.tenancy.client;
import java.awt.event.ActionEvent;
import com.kingdee.eas.fdc.propertymgmt.RoomChargeInfo;
import com.kingdee.eas.fdc.propertymgmt.client.RoomChargeEditUI;
public class TenRoomChargeSelectUI extends RoomChargeEditUI {
private static final String KEY_ROOM_CHARGE = "roomCharge";
public TenRoomChargeSelectUI() throws Exception {
super();
}
public void onLoad() throws Exception {
super.onLoad();
//设置该值会触发值改变事件,从而家在客户
this.prmtroom.setValue(this.getUIContext().get("room"));
// prmtroom_propertyChange(null);
this.menuBar.setVisible(false);
this.actionAddNew.setVisible(false);
this.actionEdit.setVisible(false);
this.actionRemove.setVisible(false);
this.btnSubmit.setText("确定");
this.btnSubmit.setToolTipText("确定");
this.prmtroom.setEnabled(false);
}
public void actionSubmit_actionPerformed(ActionEvent e) throws Exception {
//TODO 封装TenancyRoomChargeEntryInfo对象用以返回.可能还会有些验证的过程
super.storeFields();
RoomChargeInfo roomCharge = this.editData;
this.getUIContext().put(KEY_ROOM_CHARGE, roomCharge);
this.disposeUIWindow();
}
public RoomChargeInfo getRoomCharge() {
return (RoomChargeInfo)this.getUIContext().get(KEY_ROOM_CHARGE);
}
}
| [
"yfsmile@qq.com"
] | yfsmile@qq.com |
e5295aed0ef13be820eabe1408bdbaefa5bbcac2 | 596cebd1a830a819cc3aba6ba80ef97722e60ccb | /app/src/androidTest/java/com/example/myapplication14/ExampleInstrumentedTest.java | 251053d9526adbec9d225e11483b06b6a2623bf1 | [] | no_license | 17396743/Android_Toolbar | e9031e4038290cea8ebb0c14dc4946cd44dbc68a | e3c8585d8d6ada7eb9e1cb7e96ea9854158a78f7 | refs/heads/master | 2023-03-22T16:11:42.162965 | 2021-03-10T06:44:54 | 2021-03-10T06:44:54 | 346,252,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 768 | java | package com.example.myapplication14;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.myapplication14", appContext.getPackageName());
}
} | [
"1481583730@qq.com"
] | 1481583730@qq.com |
85898ca17811d259ab82889923dae34bb47a0f78 | dbeead532527814b742686aeddd9dee2d2f0dbbf | /jenetics.ext/src/main/java/io/jenetics/ext/util/Tree.java | 3029f0a2a149e835437c72394b1a5ffc7c780a13 | [
"Apache-2.0"
] | permissive | jenetics/jenetics | bdec1d05ab953ed7e421ee4a7a0eeb95efc7b768 | 7bba9e64f4cc003074dd76a416d88e5b14683493 | refs/heads/master | 2023-08-24T12:12:03.331620 | 2023-08-03T20:03:43 | 2023-08-03T20:03:43 | 15,365,897 | 878 | 188 | Apache-2.0 | 2023-08-31T22:04:26 | 2013-12-21T21:24:50 | Java | UTF-8 | Java | false | false | 38,245 | java | /*
* Java Genetic Algorithm Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
*
* 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.
*
* Author:
* Franz Wilhelmstötter (franz.wilhelmstoetter@gmail.com)
*/
package io.jenetics.ext.util;
import static java.lang.String.format;
import static java.util.Objects.requireNonNull;
import static java.util.Spliterators.spliteratorUnknownSize;
import static io.jenetics.internal.util.SerialIO.readIntArray;
import static io.jenetics.internal.util.SerialIO.writeIntArray;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Objects;
import java.util.Optional;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import io.jenetics.util.ISeq;
import io.jenetics.util.Self;
/**
* General purpose tree structure. The interface only contains tree read methods.
* For a mutable tree implementation have a look at the {@link TreeNode} class.
*
* @see TreeNode
*
* @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
* @version 7.0
* @since 3.9
*/
public interface Tree<V, T extends Tree<V, T>> extends Self<T>, Iterable<T> {
/* *************************************************************************
* Basic (abstract) operations. All other tree operations can be derived
* from these methods.
**************************************************************************/
/**
* Return the value of the current {@code Tree} node. The value may be
* {@code null}.
*
* @return the value of the current {@code Tree} node
*/
V value();
/**
* Return the <em>parent</em> node of this tree node.
*
* @return the parent node, or {@code Optional.empty()} if this node is the
* root of the tree
*/
Optional<T> parent();
/**
* Return the child node with the given index.
*
* @param index the child index
* @return the child node with the given index
* @throws IndexOutOfBoundsException if the {@code index} is out of
* bounds ({@code [0, childCount())})
*/
T childAt(final int index);
/**
* Return the number of children this tree node consists of.
*
* @return the number of children this tree node consists of
*/
int childCount();
/* *************************************************************************
* Derived operations
**************************************************************************/
/**
* Return an iterator of the children of this {@code Tree} node.
*
* @return an iterator of the children of this {@code Tree} node.
*/
default Iterator<T> childIterator() {
return new TreeChildIterator<V, T>(self());
}
/**
* Return a forward-order stream of this node's children.
*
* @return a stream of children of {@code this} node
*/
default Stream<T> childStream() {
return StreamSupport.stream(
Spliterators.spliterator(
childIterator(),
childCount(),
Spliterator.SIZED | Spliterator.ORDERED
),
false
);
}
/**
* Returns {@code true} if this node is the root of the tree.
*
* @return {@code true} if this node is the root of its tree, {@code false}
* otherwise
*/
default boolean isRoot() {
return parent().isEmpty();
}
/**
* Returns the depth of the tree rooted at this node. The <i>depth</i> of a
* tree is the longest distance from {@code this} node to a leaf. If
* {@code this} node has no children, 0 is returned. This operation is much
* more expensive than {@link #level()} because it must effectively traverse
* the entire tree rooted at {@code this} node.
*
* @return the depth of the tree whose root is this node
*/
default int depth() {
final Iterator<T> it = breadthFirstIterator();
T last = null;
while (it.hasNext()) {
last = it.next();
}
assert last != null;
return last.level() - level();
}
/**
* Returns the number of levels above this node. The <i>level</i> of a tree
* is the distance from the root to {@code this} node. If {@code this} node
* is the root, returns 0.
*
* @return the number of levels above this node
*/
default int level() {
Optional<T> ancestor = Optional.of(self());
int levels = 0;
while ((ancestor = ancestor.flatMap(Tree::parent)).isPresent()) {
++levels;
}
return levels;
}
/**
* Returns the index of the specified child in this node's child array, or
* {@code -1} if {@code this} node doesn't contain the given {@code child}.
* This method performs a linear search and is O(n) where {@code n} is the
* number of children.
*
* @param child the TreeNode to search for among this node's children
* @throws NullPointerException if the given {@code child} is {@code null}
* @return the index of the node in this node's child array, or {@code -1}
* if the node could not be found
*/
default int indexOf(final Tree<?, ?> child) {
int index = -1;
for (int i = 0, n = childCount(); i < n && index == -1; ++i) {
if (childAt(i).identical(child)) {
index = i;
}
}
return index;
}
/**
* Return the number of nodes of {@code this} node (sub-tree).
*
* @return the number of nodes of {@code this} node (sub-tree)
*/
default int size() {
return Trees.countChildren(this) + 1;
}
/**
* A tree is considered <em>empty</em> if it's {@link #value()} is
* {@code null} and has no children and parent. A newly created tree node
* with no value is <em>empty</em>.
*
* <pre>{@code
* final Tree<String, ?> tree = TreeNode.of();
* assert tree.isEmpty();
* }</pre>
*
* @since 7.0
*
* @return {@code true} if {@code this} tree is empty, {@code false}
* otherwise
*/
default boolean isEmpty() {
return value() == null && childCount() == 0 && parent().isEmpty();
}
/* *************************************************************************
* Query operations
**************************************************************************/
/**
* Return the child node at the given {@code path}. A path consists of the
* child index at a give level, starting with level 1. (The root note has
* level zero.) {@code tree.childAtPath(Path.of(2))} will return the third
* child node of {@code this} node, if it exists and
* {@code tree.childAtPath(Path.of(2, 0))} will return the first child of
* the third child of {@code this node}.
*
* @since 4.4
*
* @see #childAtPath(int...)
*
* @param path the child path
* @return the child node at the given {@code path}
* @throws NullPointerException if the given {@code path} array is
* {@code null}
*/
default Optional<T> childAtPath(final Path path) {
T node = self();
for (int i = 0; i < path.length() && node != null; ++i) {
node = path.get(i) < node.childCount()
? node.childAt(path.get(i))
: null;
}
return Optional.ofNullable(node);
}
/**
* Return the child node at the given {@code path}. A path consists of the
* child index at a give level, starting with level 1. (The root note has
* level zero.) {@code tree.childAtPath(2)} will return the third child node
* of {@code this} node, if it exists and {@code tree.childAtPath(2, 0)} will
* return the first child of the third child of {@code this node}.
*
* @since 4.3
*
* @see #childAtPath(Path)
*
* @param path the child path
* @return the child node at the given {@code path}
* @throws NullPointerException if the given {@code path} array is
* {@code null}
* @throws IllegalArgumentException if one of the path elements is smaller
* than zero
*/
default Optional<T> childAtPath(final int... path) {
return childAtPath(Path.of(path));
}
/**
* Return {@code true} if the given {@code node} is an ancestor of
* {@code this} node. This operation is at worst {@code O(h)} where {@code h}
* is the distance from the root to {@code this} node.
*
* @param node the node to test
* @return {@code true} if the given {@code node} is an ancestor of
* {@code this} node, {@code false} otherwise
* @throws NullPointerException if the given {@code node} is {@code null}
*/
default boolean isAncestor(final Tree<?, ?> node) {
requireNonNull(node);
Optional<T> ancestor = Optional.of(self());
boolean result;
do {
result = ancestor.filter(a -> a.identical(node)).isPresent();
} while (!result &&
(ancestor = ancestor.flatMap(Tree::parent)).isPresent());
return result;
}
/**
* Return {@code true} if the given {@code node} is a descendant of
* {@code this} node. If the given {@code node} is {@code null},
* {@code false} is returned. This operation is at worst {@code O(h)} where
* {@code h} is the distance from the root to {@code this} node.
*
* @param node the node to test as descendant of this node
* @return {@code true} if this node is an ancestor of the given {@code node}
* @throws NullPointerException if the given {@code node} is {@code null}
*/
default boolean isDescendant(final Tree<?, ?> node) {
return requireNonNull(node).isAncestor(this);
}
/**
* Returns the nearest common ancestor to this node and the given {@code node}.
* A node is considered an ancestor of itself.
*
* @param node {@code node} to find common ancestor with
* @return nearest ancestor common to this node and the given {@code node},
* or {@link Optional#empty()} if no common ancestor exists.
* @throws NullPointerException if the given {@code node} is {@code null}
*/
default Optional<T> sharedAncestor(final T node) {
requireNonNull(node);
T ancestor = null;
if (node.identical(this)) {
ancestor = self();
} else {
final int level1 = level();
final int level2 = node.level();
T node1;
T node2;
int diff;
if (level2 > level1) {
diff = level2 - level1;
node1 = node;
node2 = self();
} else {
diff = level1 - level2;
node1 = self();
node2 = node;
}
while (diff > 0 && node1 != null) {
node1 = node1.parent().orElse(null);
--diff;
}
do {
if (node1 != null && node1.identical(node2)) {
ancestor = node1;
}
node1 = node1 != null
? node1.parent().orElse(null)
: null;
node2 = node2.parent().orElse(null);
} while (node1 != null && node2 != null && ancestor == null);
}
return Optional.ofNullable(ancestor);
}
/**
* Returns true if and only if the given {@code node} is in the same tree as
* {@code this} node.
*
* @param node the other node to check
* @return true if the given {@code node} is in the same tree as {@code this}
* node, {@code false} otherwise.
* @throws NullPointerException if the given {@code node} is {@code null}
*/
default boolean isRelated(final Tree<?, ?> node) {
requireNonNull(node);
return node.root().identical(root());
}
/**
* Returns the path from the root, to get to this node. The last element in
* the path is this node.
*
* @since 5.1
*
* @return an array of TreeNode objects giving the path, where the
* first element in the path is the root and the last
* element is this node.
*/
default ISeq<T> pathElements() {
return Trees.pathElementsFromRoot(self(), 0).toISeq();
}
/**
* Return the {@link Path} of {@code this} tree, such that
* <pre>{@code
* final Tree<Integer, ?> tree = ...;
* final Tree.Path path = tree.path();
* assert tree == tree.getRoot()
* .childAtPath(path)
* .orElse(null);
* }</pre>
*
* @since 5.1
*
* @return the path from the root element to {@code this} node.
*/
default Path path() {
final int[] p = Trees.pathFromRoot(self(), 0);
return Path.of(p);
}
/**
* Returns the root of the tree that contains this node. The root is the
* ancestor with no parent.
*
* @return the root of the tree that contains this node
*/
default T root() {
T anc = self();
T prev;
do {
prev = anc;
anc = anc.parent().orElse(null);
} while (anc != null);
return prev;
}
/* *************************************************************************
* Child query operations
**************************************************************************/
/**
* Return {@code true} if the given {@code node} is a child of {@code this}
* node.
*
* @param node the other node to check
* @return {@code true} if {@code node}is a child, {@code false} otherwise
* @throws NullPointerException if the given {@code node} is {@code null}
*/
default boolean isChild(final Tree<?, ?> node) {
requireNonNull(node);
return childCount() != 0 &&
node.parent().equals(Optional.of(self()));
}
/**
* Return the first child of {@code this} node, or {@code Optional.empty()}
* if {@code this} node has no children.
*
* @return the first child of this node
*/
default Optional<T> firstChild() {
return childCount() > 0
? Optional.of(childAt(0))
: Optional.empty();
}
/**
* Return the last child of {@code this} node, or {@code Optional.empty()}
* if {@code this} node has no children.
*
* @return the last child of this node
*/
default Optional<T> lastChild() {
return childCount() > 0
? Optional.of(childAt(childCount() - 1))
: Optional.empty();
}
/**
* Return the child which comes immediately after {@code this} node. This
* method performs a linear search of this node's children for {@code child}
* and is {@code O(n)} where n is the number of children.
*
* @param child the child node
* @return the child of this node that immediately follows the {@code child},
* or {@code Optional.empty()} if the given {@code node} is the
* first node.
* @throws NullPointerException if the given {@code child} is {@code null}
*/
default Optional<T> childAfter(final Tree<?, ?> child) {
requireNonNull(child);
final int index = indexOf(child);
if (index == -1) {
throw new IllegalArgumentException("The given node is not a child.");
}
return index < childCount() - 1
? Optional.of(childAt(index + 1))
: Optional.empty();
}
/**
* Return the child which comes immediately before {@code this} node. This
* method performs a linear search of this node's children for {@code child}
* and is {@code O(n)} where n is the number of children.
*
* @param child the child node
* @return the child of this node that immediately precedes the {@code child},
* or {@code null} if the given {@code node} is the first node.
* @throws NullPointerException if the given {@code child} is {@code null}
*/
default Optional<T> childBefore(final Tree<?, ?> child) {
requireNonNull(child);
final int index = indexOf(child);
if (index == -1) {
throw new IllegalArgumentException("The given node is not a child.");
}
return index > 0
? Optional.of(childAt(index - 1))
: Optional.empty();
}
/**
* Return the node that follows {@code this} node in a pre-order traversal
* of {@code this} tree node. Return {@code Optional.empty()} if this node
* is the last node of the traversal. This is an inefficient way to traverse
* the entire tree use an iterator instead.
*
* @see #preorderIterator
* @return the node that follows this node in a pre-order traversal, or
* {@code Optional.empty()} if this node is last
*/
default Optional<T> nextNode() {
Optional<T> next = Optional.empty();
if (childCount() == 0) {
T node = self();
while (node != null && (next = node.nextSibling()).isEmpty()) {
node = node.parent().orElse(null);
}
} else {
next = Optional.of(childAt(0));
}
return next;
}
/**
* Return the node that precedes this node in a pre-order traversal of
* {@code this} tree node. Returns {@code Optional.empty()} if this node is
* the first node of the traversal, the root of the tree. This is an
* inefficient way to traverse the entire tree; use an iterator instead.
*
* @see #preorderIterator
* @return the node that precedes this node in a pre-order traversal, or
* {@code Optional.empty()} if this node is the first
*/
default Optional<T> previousNode() {
Optional<T> node = Optional.empty();
if (parent().isPresent()) {
final Optional<T> prev = previousSibling();
if (prev.isPresent()) {
node = prev.get().childCount() == 0
? prev
: prev.map(Tree::lastLeaf);
} else {
node = parent();
}
}
return node;
}
/* *************************************************************************
* Sibling query operations
**************************************************************************/
/**
* Test if the given {@code node} is a sibling of {@code this} node.
*
* @param node node to test as sibling of this node
* @return {@code true} if the {@code node} is a sibling of {@code this}
* node
* @throws NullPointerException if the given {@code node} is {@code null}
*/
default boolean isSibling(final Tree<?, ?> node) {
return identical(requireNonNull(node)) ||
parent().equals(node.parent());
}
/**
* Return the number of siblings of {@code this} node. A node is its own
* sibling (if it has no parent or no siblings, this method returns
* {@code 1}).
*
* @return the number of siblings of {@code this} node
*/
default int siblingCount() {
return parent().map(Tree::childCount).orElse(1);
}
/**
* Return the next sibling of {@code this} node in the parent's children
* array, or {@code null} if {@code this} node has no parent or it is the
* last child of the paren. This method performs a linear search that is
* {@code O(n)} where n is the number of children; to traverse the entire
* array, use the iterator of the parent instead.
*
* @see #childStream()
* @return the sibling of {@code this} node that immediately follows
* {@code this} node
*/
default Optional<T> nextSibling() {
return parent().flatMap(p -> p.childAfter(self()));
}
/**
* Return the previous sibling of {@code this} node in the parent's children
* list, or {@code Optional.empty()} if this node has no parent or is the
* parent's first child. This method performs a linear search that is O(n)
* where n is the number of children.
*
* @return the sibling of {@code this} node that immediately precedes this
* node
*/
default Optional<T> previousSibling() {
return parent().flatMap(p -> p.childBefore(self()));
}
/* *************************************************************************
* Leaf query operations
**************************************************************************/
/**
* Return {@code true} if {@code this} node has no children.
*
* @return {@code true} if {@code this} node has no children, {@code false}
* otherwise
*/
default boolean isLeaf() {
return childCount() == 0;
}
/**
* Return the first leaf that is a descendant of {@code this} node; either
* this node or its first child's first leaf. {@code this} node is returned
* if it is a leaf.
*
* @see #isLeaf
* @see #isDescendant
* @return the first leaf in the subtree rooted at this node
*/
default T firstLeaf() {
T leaf = self();
while (!leaf.isLeaf()) {
leaf = leaf.firstChild().orElseThrow(AssertionError::new);
}
return leaf;
}
/**
* Return the last leaf that is a descendant of this node; either
* {@code this} node or its last child's last leaf. Returns {@code this}
* node if it is a leaf.
*
* @see #isLeaf
* @see #isDescendant
* @return the last leaf in this subtree
*/
default T lastLeaf() {
T leaf = self();
while (!leaf.isLeaf()) {
leaf = leaf.lastChild().orElseThrow(AssertionError::new);
}
return leaf;
}
/**
* Returns the leaf after {@code this} node or {@code Optional.empty()} if
* this node is the last leaf in the tree.
* <p>
* In order to determine the next node, this method first performs a linear
* search in the parent's child-list in order to find the current node.
* <p>
* That implementation makes the operation suitable for short traversals
* from a known position. But to traverse all the leaves in the tree, you
* should use {@link #depthFirstIterator()} to iterator the nodes in the
* tree and use {@link #isLeaf()} on each node to determine which are leaves.
*
* @see #depthFirstIterator
* @see #isLeaf
* @return return the next leaf past this node
*/
default Optional<T> nextLeaf() {
return nextSibling()
.map(Tree::firstLeaf)
.or(() -> parent().flatMap(Tree::nextLeaf));
}
/**
* Return the leaf before {@code this} node or {@code null} if {@code this}
* node is the first leaf in the tree.
* <p>
* In order to determine the previous node, this method first performs a
* linear search in the parent's child-list in order to find the current
* node.
* <p>
* That implementation makes the operation suitable for short traversals
* from a known position. But to traverse all the leaves in the tree, you
* should use {@link #depthFirstIterator()} to iterate the nodes in the tree
* and use {@link #isLeaf()} on each node to determine which are leaves.
*
* @see #depthFirstIterator
* @see #isLeaf
* @return returns the leaf before {@code this} node
*/
default Optional<T> previousLeaf() {
return previousSibling()
.map(Tree::lastLeaf)
.or(() -> parent().flatMap(Tree::previousLeaf));
}
/**
* Returns the total number of leaves that are descendants of this node.
* If this node is a leaf, returns {@code 1}. This method is {@code O(n)},
* where n is the number of descendants of {@code this} node.
*
* @see #isLeaf()
* @return the number of leaves beneath this node
*/
default int leafCount() {
return (int)leaves().count();
}
/**
* Return a stream of leaves that are descendants of this node.
*
* @since 7.0
*
* @return a stream of leaves that are descendants of this node
*/
default Stream<T> leaves() {
return breadthFirstStream().filter(Tree::isLeaf);
}
/* *************************************************************************
* Tree traversing.
**************************************************************************/
/**
* Return an iterator that traverses the subtree rooted at {@code this}
* node in breadth-first order. The first node returned by the iterator is
* {@code this} node.
* <p>
* Modifying the tree by inserting, removing, or moving a node invalidates
* any iterator created before the modification.
*
* @see #depthFirstIterator
* @return an iterator for traversing the tree in breadth-first order
*/
default Iterator<T> breadthFirstIterator() {
return new TreeNodeBreadthFirstIterator<>(self());
}
/**
* Return an iterator that traverses the subtree rooted at {@code this}.
* The first node returned by the iterator is {@code this} node.
* <p>
* Modifying the tree by inserting, removing, or moving a node invalidates
* any iterator created before the modification.
*
* @see #breadthFirstIterator
* @return an iterator for traversing the tree in breadth-first order
*/
@Override
default Iterator<T> iterator() {
return breadthFirstIterator();
}
/**
* Return a stream that traverses the subtree rooted at {@code this} node in
* breadth-first order. The first node returned by the stream is
* {@code this} node.
*
* @see #depthFirstIterator
* @see #stream()
* @return a stream for traversing the tree in breadth-first order
*/
default Stream<T> breadthFirstStream() {
return StreamSupport
.stream(spliteratorUnknownSize(breadthFirstIterator(), 0), false);
}
/**
* Return a stream that traverses the subtree rooted at {@code this} node in
* breadth-first order. The first node returned by the stream is
* {@code this} node.
*
* @see #breadthFirstStream
* @return a stream for traversing the tree in breadth-first order
*/
default Stream<T> stream() {
return breadthFirstStream();
}
/**
* Return an iterator that traverses the subtree rooted at {@code this} node
* in pre-order. The first node returned by the iterator is {@code this}
* node.
* <p>
* Modifying the tree by inserting, removing, or moving a node invalidates
* any iterator created before the modification.
*
* @see #postorderIterator
* @return an iterator for traversing the tree in pre-order
*/
default Iterator<T> preorderIterator() {
return new TreeNodePreorderIterator<>(self());
}
/**
* Return a stream that traverses the subtree rooted at {@code this} node
* in pre-order. The first node returned by the stream is {@code this} node.
* <p>
* Modifying the tree by inserting, removing, or moving a node invalidates
* any iterator created before the modification.
*
* @see #preorderIterator
* @return a stream for traversing the tree in pre-order
*/
default Stream<T> preorderStream() {
return StreamSupport
.stream(spliteratorUnknownSize(preorderIterator(), 0), false);
}
/**
* Return an iterator that traverses the subtree rooted at {@code this}
* node in post-order. The first node returned by the iterator is the
* leftmost leaf. This is the same as a depth-first traversal.
*
* @see #depthFirstIterator
* @see #preorderIterator
* @return an iterator for traversing the tree in post-order
*/
default Iterator<T> postorderIterator() {
return new TreeNodePostorderIterator<>(self());
}
/**
* Return a stream that traverses the subtree rooted at {@code this} node in
* post-order. The first node returned by the iterator is the leftmost leaf.
* This is the same as a depth-first traversal.
*
* @see #depthFirstIterator
* @see #preorderIterator
* @return a stream for traversing the tree in post-order
*/
default Stream<T> postorderStream() {
return StreamSupport
.stream(spliteratorUnknownSize(postorderIterator(), 0), false);
}
/**
* Return an iterator that traverses the subtree rooted at {@code this} node
* in depth-first order. The first node returned by the iterator is the
* leftmost leaf. This is the same as a postorder traversal.
* <p>
* Modifying the tree by inserting, removing, or moving a node invalidates
* any iterator created before the modification.
*
* @see #breadthFirstIterator
* @see #postorderIterator
* @return an iterator for traversing the tree in depth-first order
*/
default Iterator<T> depthFirstIterator() {
return postorderIterator();
}
/**
* Return a stream that traverses the subtree rooted at {@code this} node in
* depth-first. The first node returned by the iterator is the leftmost leaf.
* This is the same as a post-order traversal.
*
* @see #depthFirstIterator
* @see #preorderIterator
* @return a stream for traversing the tree in post-order
*/
default Stream<T> depthFirstStream() {
return postorderStream();
}
/**
* Return an iterator that follows the path from {@code ancestor} to
* {@code this} node. The iterator return {@code ancestor} as first element,
* The creation of the iterator is O(m), where m is the number of nodes
* between {@code this} node and the {@code ancestor}, inclusive.
* <p>
* Modifying the tree by inserting, removing, or moving a node invalidates
* any iterator created before the modification.
*
* @see #isAncestor
* @see #isDescendant
* @param ancestor the ancestor node
* @return an iterator for following the path from an ancestor of {@code this}
* node to this one
* @throws IllegalArgumentException if the {@code ancestor} is not an
* ancestor of this node
* @throws NullPointerException if the given {@code ancestor} is {@code null}
*/
default Iterator<T> pathFromAncestorIterator(final Tree<?, ?> ancestor) {
return new TreeNodePathIterator<>(ancestor, self());
}
/**
* Return the path of {@code this} child node from the root node. You will
* get {@code this} node, if you call {@link #childAtPath(Path)} on the
* root node of {@code this} node.
* <pre>{@code
* final Tree<?, ?> node = ...;
* final Tree<?, ?> root = node.getRoot();
* final int[] path = node.childPath();
* assert node == root.childAtPath(path);
* }</pre>
*
* @since 4.4
*
* @see #childAtPath(Path)
*
* @return the path of {@code this} child node from the root node.
*/
default Path childPath() {
final Iterator<T> it = pathFromAncestorIterator(root());
final int[] path = new int[level()];
T tree = null;
int index = 0;
while (it.hasNext()) {
final T child = it.next();
if (tree != null) {
path[index++] = tree.indexOf(child);
}
tree = child;
}
assert index == path.length;
return new Path(path);
}
/**
* Tests whether {@code this} node is the same as the {@code other} node.
* The default implementation returns the object identity,
* {@code this == other}, of the two objects, but other implementations may
* use different criteria for checking the <i>identity</i>.
*
* @param other the {@code other} node
* @return {@code true} if the {@code other} node is the same as {@code this}
* node.
*/
default boolean identical(final Tree<?, ?> other) {
return this == other;
}
/**
* Performs a reduction on the elements of {@code this} tree, using an
* associative reduction function. This can be used for evaluating a given
* expression tree in pre-order.
* <pre>{@code
* final Tree<String, ?> formula = TreeNode.parse("add(sub(6,div(230,10)),mul(5,6))");
* final double result = formula.reduce(new Double[0], (op, args) ->
* switch (op) {
* case "add" -> args[0] + args[1];
* case "sub" -> args[0] - args[1];
* case "mul" -> args[0] * args[1];
* case "div" -> args[0] / args[1];
* default -> Double.parseDouble(op);
* }
* );
* assert result == 13.0;
* }</pre>
*
* @since 7.1
*
* @param neutral the neutral element of the reduction. In most cases this will
* be {@code new U[0]}.
* @param reducer the reduce function
* @param <U> the result type
* @return the result of the reduction, or {@code null} if {@code this} tree
* is empty ({@code isEmpty() == true})
*/
default <U> U reduce(
final U[] neutral,
final BiFunction<? super V, ? super U[], ? extends U> reducer
) {
requireNonNull(neutral);
requireNonNull(reducer);
@SuppressWarnings("unchecked")
final class Reducing {
private U reduce(final Tree<V, ?> node) {
return node.isLeaf()
? reducer.apply(node.value(), neutral)
: reducer.apply(node.value(), children(node));
}
private U[] children(final Tree<V, ?> node) {
final U[] values = (U[])Array.newInstance(
neutral.getClass().getComponentType(),
node.childCount()
);
for (int i = 0; i < node.childCount(); ++i) {
values[i] = reduce(node.childAt(i));
}
return values;
}
}
return isEmpty() ? null : new Reducing().reduce(this);
}
/* *************************************************************************
* 'toString' methods
**************************************************************************/
/**
* Return a compact string representation of the given tree. The tree
* <pre>
* mul
* ├── div
* │ ├── cos
* │ │ └── 1.0
* │ └── cos
* │ └── π
* └── sin
* └── mul
* ├── 1.0
* └── z
* </pre>
* is printed as
* <pre>
* mul(div(cos(1.0),cos(π)),sin(mul(1.0,z)))
* </pre>
*
* @since 4.3
*
* @see #toParenthesesString()
* @see TreeFormatter#PARENTHESES
*
* @param mapper the {@code mapper} which converts the tree value to a string
* @return the string representation of the given tree
*/
default String toParenthesesString(final Function<? super V, String> mapper) {
return TreeFormatter.PARENTHESES.format(this, mapper);
}
/**
* Return a compact string representation of the given tree. The tree
* <pre>
* mul
* ├── div
* │ ├── cos
* │ │ └── 1.0
* │ └── cos
* │ └── π
* └── sin
* └── mul
* ├── 1.0
* └── z
* </pre>
* is printed as
* <pre>
* mul(div(cos(1.0), cos(π)), sin(mul(1.0, z)))
* </pre>
*
* @since 4.3
*
* @see #toParenthesesString(Function)
* @see TreeFormatter#PARENTHESES
*
* @return the string representation of the given tree
* @throws NullPointerException if the {@code mapper} is {@code null}
*/
default String toParenthesesString() {
return toParenthesesString(Objects::toString);
}
/* *************************************************************************
* Static helper methods.
**************************************************************************/
/**
* Calculates the hash code of the given tree.
*
* @param tree the tree where the hash is calculated from
* @return the hash code of the tree
* @throws NullPointerException if the given {@code tree} is {@code null}
*/
static int hashCode(final Tree<?, ?> tree) {
return tree != null
? tree.breadthFirstStream()
.mapToInt(node -> 31*Objects.hashCode(node.value()) + 37)
.sum() + 17
: 0;
}
/**
* Checks if the two given trees has the same structure with the same values.
*
* @param a the first tree
* @param b the second tree
* @return {@code true} if the two given trees are structurally equals,
* {@code false} otherwise
*/
static boolean equals(final Tree<?, ?> a, final Tree<?, ?> b) {
return Trees.equals(a, b);
}
/**
* Return a string representation of the given tree, like the following
* example.
*
* <pre>
* mul(div(cos(1.0), cos(π)), sin(mul(1.0, z)))
* </pre>
*
* This method is intended to be used when override the
* {@link Object#toString()} method.
*
* @param tree the input tree
* @return the string representation of the given tree
*/
static String toString(final Tree<?, ?> tree) {
return tree.toParenthesesString();
}
/* *************************************************************************
* Inner classes
**************************************************************************/
/**
* This class represents the path to child within a given tree. It allows
* pointing (and fetch) a tree child.
*
* @see Tree#childAtPath(Path)
*
* @author <a href="mailto:franz.wilhelmstoetter@gmail.com">Franz Wilhelmstötter</a>
* @version 6.0
* @since 4.4
*/
final class Path implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private final int[] _path;
private Path(final int[] path) {
_path = requireNonNull(path);
}
/**
* Return the path length, which is the level of the child {@code this}
* path points to.
*
* @return the path length
*/
public int length() {
return _path.length;
}
/**
* Return the child index at the given index (child level).
*
* @param index the path index
* @return the child index at the given child level
* @throws IndexOutOfBoundsException if the index is not with the range
* {@code [0, length())}
*/
public int get(final int index) {
return _path[index];
}
/**
* Return the path as {@code int[]} array.
*
* @return the path as {@code int[]} array
*/
public int[] toArray() {
return _path.clone();
}
/**
* Appends the given {@code path} to {@code this} one.
*
* @param path the path to append
* @return a new {@code Path} with the given {@code path} appended
* @throws NullPointerException if the given {@code path} is {@code null}
*/
public Path append(final Path path) {
final int[] p = new int[length() + path.length()];
System.arraycopy(_path, 0, p, 0, length());
System.arraycopy(path._path, 0, p, length(), path.length());
return new Path(p);
}
@Override
public int hashCode() {
return Arrays.hashCode(_path);
}
@Override
public boolean equals(final Object obj) {
return obj == this ||
obj instanceof Path other &&
Arrays.equals(_path, other._path);
}
@Override
public String toString() {
return Arrays.toString(_path);
}
/**
* Create a new path object from the given child indexes.
*
* @param path the child indexes
* @return a new tree path
* @throws IllegalArgumentException if one of the path elements is
* smaller than zero
*/
public static Path of(final int... path) {
for (int i = 0; i < path.length; ++i) {
if (path[i] < 0) {
throw new IllegalArgumentException(format(
"Path element at position %d is smaller than zero: %d",
i, path[i]
));
}
}
return new Path(path.clone());
}
/* *********************************************************************
* Java object serialization
* ********************************************************************/
@Serial
private Object writeReplace() {
return new SerialProxy(SerialProxy.TREE_PATH, this);
}
@Serial
private void readObject(final ObjectInputStream stream)
throws InvalidObjectException
{
throw new InvalidObjectException("Serialization proxy required.");
}
void write(final DataOutput out) throws IOException {
writeIntArray(_path, out);
}
static Object read(final DataInput in) throws IOException {
return Path.of(readIntArray(in));
}
}
}
| [
"franz.wilhelmstoetter@gmail.com"
] | franz.wilhelmstoetter@gmail.com |
38ff8f4ef4ba182e826a30f2854656b7b2a02394 | 066733572d3a43b3fcadd187d2e6865fc6b404e7 | /blogmx-blog/src/main/java/com/blogmx/service/UploadService.java | f9be13ad482e5d77d69319d9701f87b632428bec | [] | no_license | muoxuan/Blogmx | 4696372db65cd98b620ebc1f6e75c1f820b31488 | 09811b7a9541e01c414b050143221ab1e75c05bf | refs/heads/master | 2022-12-26T02:36:07.016795 | 2020-04-05T04:30:08 | 2020-04-05T04:30:08 | 244,929,023 | 1 | 0 | null | 2022-11-16T11:33:47 | 2020-03-04T14:59:57 | HTML | UTF-8 | Java | false | false | 4,124 | java | package com.blogmx.service;
import com.blogmx.mapper.UpBlogMapper;
import com.blogmx.pojo.Blog;
import com.blogmx.pojo.SearchBlog;
import com.blogmx.repository.BlogRepository;
import com.github.tobato.fastdfs.domain.StorePath;
import com.github.tobato.fastdfs.service.FastFileStorageClient;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.util.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service
public class UploadService {
@Autowired
private FastFileStorageClient storageClient;
@Autowired
private UpBlogMapper blogMapper;
private static final Logger LOGGER = LoggerFactory.getLogger(UploadService.class);
@Autowired
private BlogRepository blogRepository;
@Autowired
private ElasticsearchTemplate elasticsearchTemplate;
@Autowired
private ArticleService articleService;
@Autowired
private BlogService blogService;
/**
* 将数据保存进数据库
* @param file
* @param titleName
* @param subTitle
* @param isTop
* @param isHot
* @param index
* @param watchNum
* @param image
*/
public int saveBlog(MultipartFile file,
String titleName,
String subTitle,
Boolean isTop,
Boolean isHot,
String index,
Long watchNum,
String image,
Long date)
{
Blog blog = new Blog();
blog.setTitleName(titleName);
String url = upload(file);
String str = blogService.mdToHtml(blogService.download(url));
blog.setSubTitle(str.substring(0, Math.min(280, str.length() - 1)));
blog.setIsHot(isHot);
blog.setIsTop(isTop);
blog.setIndex(index);
blog.setWatchNum(watchNum);
blog.setImage(image);
Date date1 = new Date();
date1.setTime(date);
System.out.println(date1);
//System.out.println(new Date());
blog.setCreateTime(date1);
blog.setFile(url);
if(Strings.isBlank(url)){
return 0;
}
int i = blogMapper.insert(blog);
saveElasticsearch(blog);
System.out.println(blog.getId());
articleService.saveBlog(blog);
return i;
}
public String upload(MultipartFile file) {
String originalFilename = file.getOriginalFilename();
try {
// 保存到服务器
String ext = StringUtils.substringAfterLast(originalFilename, ".");
StorePath storePath = this.storageClient.uploadFile(file.getInputStream(), file.getSize(), ext, null);
// 生成url地址,返回
return "http://47.99.81.136//" + storePath.getFullPath();
} catch (IOException e) {
LOGGER.info("服务器内部错误:{}", originalFilename);
e.printStackTrace();
}
return null;
}
public void saveElasticsearch(Blog blog){
SearchBlog temp = new SearchBlog();
temp.setWatchNum(blog.getWatchNum());
Long id = blog.getId();
temp.setUrl("http://www.blogmx.cn/blog/" + blog.getId() + ".html");
temp.setDay(new SimpleDateFormat("dd").format(blog.getCreateTime()));
temp.setMonth(new SimpleDateFormat("MM").format(blog.getCreateTime()) + "月");
temp.setYear(new SimpleDateFormat("yyyy").format(blog.getCreateTime()));
temp.setTitleName(blog.getTitleName());
temp.setSubTitle(blog.getSubTitle());
temp.setIsTop(blog.getIsTop());
temp.setId(id);
temp.setIsHot(blog.getIsHot());
temp.setImage(blog.getImage());
blogRepository.save(temp);
}
}
| [
"1469925734@qq.com"
] | 1469925734@qq.com |
325419dc759518fc17534c8fb1849b54951c37ba | 6e01224b4a51c8f3021df6d11d5fb6a9d390e474 | /ChatDemoUI3.0/src/cn/ucai/superwechat/ui/PublicGroupsActivity.java | 1131d5c2ba3b7b2c63f9d02331bd24190c44dd8e | [
"Apache-2.0"
] | permissive | chongye/SuperWeChat | b98b31272115370546ee0bee409c9821c818ae64 | eaf4f5f4ff6521a3ce56c6564541940d3e32fff9 | refs/heads/master | 2021-01-13T13:32:26.023727 | 2016-12-14T12:40:26 | 2016-12-14T12:40:26 | 72,409,296 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,511 | java | /**
* Copyright (C) 2016 Hyphenate Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cn.ucai.superwechat.ui;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMCursorResult;
import com.hyphenate.chat.EMGroupInfo;
import cn.ucai.superwechat.R;
import com.hyphenate.easeui.utils.EaseUserUtils;
import com.hyphenate.exceptions.HyphenateException;
import java.util.ArrayList;
import java.util.List;
public class PublicGroupsActivity extends BaseActivity {
private ProgressBar pb;
private ListView listView;
private GroupsAdapter adapter;
private List<EMGroupInfo> groupsList;
private boolean isLoading;
private boolean isFirstLoading = true;
private boolean hasMoreData = true;
private String cursor;
private final int pagesize = 20;
private LinearLayout footLoadingLayout;
private ProgressBar footLoadingPB;
private TextView footLoadingText;
private Button searchBtn;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.em_activity_public_groups);
pb = (ProgressBar) findViewById(R.id.progressBar);
listView = (ListView) findViewById(R.id.list);
groupsList = new ArrayList<EMGroupInfo>();
searchBtn = (Button) findViewById(R.id.btn_search);
View footView = getLayoutInflater().inflate(R.layout.em_listview_footer_view, listView, false);
footLoadingLayout = (LinearLayout) footView.findViewById(R.id.loading_layout);
footLoadingPB = (ProgressBar)footView.findViewById(R.id.loading_bar);
footLoadingText = (TextView) footView.findViewById(R.id.loading_text);
listView.addFooterView(footView, null, false);
footLoadingLayout.setVisibility(View.GONE);
loadAndShowData();
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
startActivity(new Intent(PublicGroupsActivity.this, GroupSimpleDetailActivity.class).
putExtra("groupinfo", adapter.getItem(position)));
}
});
listView.setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
if(scrollState == OnScrollListener.SCROLL_STATE_IDLE){
if(listView.getCount() != 0){
int lasPos = view.getLastVisiblePosition();
if(hasMoreData && !isLoading && lasPos == listView.getCount()-1){
loadAndShowData();
}
}
}
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
}
});
}
public void search(View view){
startActivity(new Intent(this, PublicGroupsSeachActivity.class));
}
private void loadAndShowData(){
new Thread(new Runnable() {
public void run() {
try {
isLoading = true;
final EMCursorResult<EMGroupInfo> result = EMClient.getInstance().groupManager().getPublicGroupsFromServer(pagesize, cursor);
final List<EMGroupInfo> returnGroups = result.getData();
runOnUiThread(new Runnable() {
public void run() {
searchBtn.setVisibility(View.VISIBLE);
groupsList.addAll(returnGroups);
if(returnGroups.size() != 0){
cursor = result.getCursor();
if(returnGroups.size() == pagesize)
footLoadingLayout.setVisibility(View.VISIBLE);
}
if(isFirstLoading){
pb.setVisibility(View.INVISIBLE);
isFirstLoading = false;
adapter = new GroupsAdapter(PublicGroupsActivity.this, 1, groupsList);
listView.setAdapter(adapter);
}else{
if(returnGroups.size() < pagesize){
hasMoreData = false;
footLoadingLayout.setVisibility(View.VISIBLE);
footLoadingPB.setVisibility(View.GONE);
footLoadingText.setText("No more data");
}
adapter.notifyDataSetChanged();
}
isLoading = false;
}
});
} catch (HyphenateException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
isLoading = false;
pb.setVisibility(View.INVISIBLE);
footLoadingLayout.setVisibility(View.GONE);
Toast.makeText(PublicGroupsActivity.this, "load failed, please check your network or try it later", Toast.LENGTH_SHORT).show();
}
});
}
}
}).start();
}
/**
* adapter
*
*/
private class GroupsAdapter extends ArrayAdapter<EMGroupInfo> {
private LayoutInflater inflater;
public GroupsAdapter(Context context, int res, List<EMGroupInfo> groups) {
super(context, res, groups);
this.inflater = LayoutInflater.from(context);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = inflater.inflate(R.layout.em_row_group, parent, false);
}
((TextView) convertView.findViewById(R.id.name)).setText(getItem(position).getGroupName());
EaseUserUtils.setGroupAvatar(PublicGroupsActivity.this,getItem(position).getGroupId(),(ImageView) convertView.findViewById(R.id.avatar));
return convertView;
}
}
public void back(View view){
finish();
}
}
| [
"770678496@qq.com"
] | 770678496@qq.com |
50981643057be8b76030145f36989d90063c98c2 | 10d6a60b657543cb7861755a3565dc72c6fb8146 | /restful-web-services/src/main/java/com/pozarycki/rest/webservices/restfulwebservices/todo/Todo.java | dadc02aa1cf13677115e97078345412fc77d8099 | [] | no_license | jpozarycki/todo | c9f5bc546cd206da2e4a82c2ef9ce2e00bdf385d | bd534dc4a343e7601d9a5e16ad4c91d30e2f2b59 | refs/heads/master | 2020-05-01T11:43:46.455881 | 2019-04-05T15:27:05 | 2019-04-05T15:27:05 | 177,450,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,800 | java | package com.pozarycki.rest.webservices.restfulwebservices.todo;
import org.springframework.context.annotation.Bean;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.util.Date;
import java.util.Objects;
@Entity
public class Todo {
@Id
@GeneratedValue
private Long id;
private String username;
private String description;
private Date targetDate;
private boolean isDone;
public Todo(Long id, String username, String description, Date targetDate, boolean isDone) {
this.id = id;
this.username = username;
this.description = description;
this.targetDate = targetDate;
this.isDone = isDone;
}
public Todo() {
}
public long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Date getTargetDate() {
return targetDate;
}
public void setTargetDate(Date targetDate) {
this.targetDate = targetDate;
}
public boolean isDone() {
return isDone;
}
public void setDone(boolean done) {
isDone = done;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Todo todo = (Todo) o;
return id == todo.id;
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
| [
"jakub.pozarycki@gmail.com"
] | jakub.pozarycki@gmail.com |
18e9173bee7913ff0fe5658ff34a3bdc76769969 | 8d2e356bf7dbd7cc7d55b824a9391200888e3305 | /ak_tos-master/src/com/matson/tos/jaxb/snx/TUnitRenumber.java | c6a73c2781d61ce47583b4fdf2a3d8b43cd4d289 | [] | no_license | nrkrishnan/ak_tos-master | f989d8a607fa4ed26920a9e52232752464e9c995 | 3d959f2d8935db4e1fcf186a6590e2ff17987746 | refs/heads/master | 2021-05-03T06:02:51.570083 | 2018-02-07T08:49:04 | 2018-02-07T08:49:04 | 120,587,843 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,144 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.5-b01-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2011.08.11 at 01:33:48 PM GMT-10:00
//
package com.matson.tos.jaxb.snx;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for tUnitRenumber complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="tUnitRenumber">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="unit-identity" type="{http://www.navis.com/argo}tUnitIdentity"/>
* <element name="renumber">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="bad-id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="corrected-id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "tUnitRenumber", propOrder = {
"unitIdentity",
"renumber"
})
public class TUnitRenumber {
@XmlElement(name = "unit-identity", required = true)
protected TUnitIdentity unitIdentity;
@XmlElement(required = true)
protected TUnitRenumber.Renumber renumber;
/**
* Gets the value of the unitIdentity property.
*
* @return
* possible object is
* {@link TUnitIdentity }
*
*/
public TUnitIdentity getUnitIdentity() {
return unitIdentity;
}
/**
* Sets the value of the unitIdentity property.
*
* @param value
* allowed object is
* {@link TUnitIdentity }
*
*/
public void setUnitIdentity(TUnitIdentity value) {
this.unitIdentity = value;
}
/**
* Gets the value of the renumber property.
*
* @return
* possible object is
* {@link TUnitRenumber.Renumber }
*
*/
public TUnitRenumber.Renumber getRenumber() {
return renumber;
}
/**
* Sets the value of the renumber property.
*
* @param value
* allowed object is
* {@link TUnitRenumber.Renumber }
*
*/
public void setRenumber(TUnitRenumber.Renumber value) {
this.renumber = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <attribute name="bad-id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* <attribute name="corrected-id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "")
public static class Renumber {
@XmlAttribute(name = "bad-id", required = true)
protected String badId;
@XmlAttribute(name = "corrected-id", required = true)
protected String correctedId;
/**
* Gets the value of the badId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getBadId() {
return badId;
}
/**
* Sets the value of the badId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setBadId(String value) {
this.badId = value;
}
/**
* Gets the value of the correctedId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getCorrectedId() {
return correctedId;
}
/**
* Sets the value of the correctedId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setCorrectedId(String value) {
this.correctedId = value;
}
}
}
| [
"nkrishnan@matson.com"
] | nkrishnan@matson.com |
261f6619670621ca76f6ab4173e7d107ad278543 | e4256d648ad11b9d198e237f646f18d16efa08d7 | /1.6.4-src/common/zeroquest/item/ItemEssence.java | c4dea94b731efd7035ec7153569c0bab8f72c746 | [
"Apache-2.0"
] | permissive | NovaViper/ZeroQuest | 54f4a800a9e57565ce7b9661122257b5b48c74ba | b6350b0de5f8ea4bb3a1343a399e62605030f0f9 | refs/heads/master | 2020-12-25T19:03:50.867790 | 2015-09-15T18:55:34 | 2015-09-15T18:55:34 | 18,490,794 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 592 | java | package common.zeroquest.item;
import common.zeroquest.ZeroQuest;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;
public class ItemEssence extends Item
{
public ItemEssence(int id)
{
super(id);
this.setCreativeTab(ZeroQuest.ZeroTab);
}
/*@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister){
this.itemIcon = iconRegister.registerIcon(ZeroQuest.modid + ":" + this.getUnlocalizedName().substring(5));
}*/
} | [
"nova.leary@yahoo.com"
] | nova.leary@yahoo.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.