blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
a39e56be7661c311f398df36db0f6d6e224a6711
fc160694094b89ab09e5c9a0f03db80437eabc93
/java-video-stitcher/samples/snippets/generated/com/google/cloud/video/stitcher/v1/videostitcherservice/getslate/SyncGetSlateSlatename.java
a10c8b24fb0f0f24a171932f1dcd970d477c51ca
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
googleapis/google-cloud-java
4f4d97a145e0310db142ecbc3340ce3a2a444e5e
6e23c3a406e19af410a1a1dd0d0487329875040e
refs/heads/main
2023-09-04T09:09:02.481897
2023-08-31T20:45:11
2023-08-31T20:45:11
26,181,278
1,122
685
Apache-2.0
2023-09-13T21:21:23
2014-11-04T17:57:16
Java
UTF-8
Java
false
false
1,861
java
/* * Copyright 2023 Google LLC * * 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 * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.video.stitcher.v1.samples; // [START videostitcher_v1_generated_VideoStitcherService_GetSlate_Slatename_sync] import com.google.cloud.video.stitcher.v1.Slate; import com.google.cloud.video.stitcher.v1.SlateName; import com.google.cloud.video.stitcher.v1.VideoStitcherServiceClient; public class SyncGetSlateSlatename { public static void main(String[] args) throws Exception { syncGetSlateSlatename(); } public static void syncGetSlateSlatename() throws Exception { // This snippet has been automatically generated and should be regarded as a code template only. // It will require modifications to work: // - It may require correct/in-range values for request initialization. // - It may require specifying regional endpoints when creating the service client as shown in // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library try (VideoStitcherServiceClient videoStitcherServiceClient = VideoStitcherServiceClient.create()) { SlateName name = SlateName.of("[PROJECT]", "[LOCATION]", "[SLATE]"); Slate response = videoStitcherServiceClient.getSlate(name); } } } // [END videostitcher_v1_generated_VideoStitcherService_GetSlate_Slatename_sync]
04d24aba1a5f0541b644ee5a9deaa12d569f9796
5a631bb8be3c92dbc34628bca590ba33b9ff7347
/Chapter7/app/build/generated/source/r/debug/android/support/v7/recyclerview/R.java
6250d345045962661e0adb3c90ef24d38b8f86ca
[ "Apache-2.0", "MIT" ]
permissive
play3577/MLmobileapps
253bc57b08930ba767564342a6ed526f8c2e0557
b9a2c83f568856948ea2f35155a4d22a9ca32f41
refs/heads/master
2020-04-17T05:15:00.247029
2018-11-20T08:57:31
2018-11-20T08:57:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,538
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.v7.recyclerview; public final class R { public static final class attr { public static final int layoutManager = 0x7f010177; public static final int reverseLayout = 0x7f010179; public static final int spanCount = 0x7f010178; public static final int stackFromEnd = 0x7f01017a; } public static final class dimen { public static final int item_touch_helper_max_drag_scroll_per_frame = 0x7f0a00a1; public static final int item_touch_helper_swipe_escape_max_velocity = 0x7f0a00a2; public static final int item_touch_helper_swipe_escape_velocity = 0x7f0a00a3; } public static final class id { public static final int item_touch_helper_previous_elevation = 0x7f100013; } public static final class styleable { public static final int[] RecyclerView = { 0x010100c4, 0x010100f1, 0x7f010177, 0x7f010178, 0x7f010179, 0x7f01017a }; public static final int RecyclerView_android_descendantFocusability = 1; public static final int RecyclerView_android_orientation = 0; public static final int RecyclerView_layoutManager = 2; public static final int RecyclerView_reverseLayout = 4; public static final int RecyclerView_spanCount = 3; public static final int RecyclerView_stackFromEnd = 5; } }
0116011f3d866ff4982075c6ec9816187c3bdbeb
22f14db6af33b5d9e5c051f035ec43b60dce2503
/Praktikum2Ayusriwahyuni-master/app/src/main/java/org/nsh/praktikum2ditasekarasri/activity/LoginActivity.java
def791d6dd4f95687c0853cdd6de0c36514c527d
[]
no_license
Ayusriwahyuni570/Tugas3-Ayusriwahyuni
19378bc421d517f0ee7b4e8bd2ae774a0f97a0ca
c91d6daeee4d2759195e177797326d220cc34d00
refs/heads/master
2023-03-30T05:42:26.989636
2021-04-01T01:30:01
2021-04-01T01:30:01
353,536,374
0
0
null
null
null
null
UTF-8
Java
false
false
1,508
java
package org.nsh.praktikum2ditasekarasri.activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import org.nsh.praktikum2ditasekarasri.R; public class LoginActivity extends AppCompatActivity { Button login; EditText username, password; protected void onCreate(Bundle saveInstanceState){ super.onCreate(saveInstanceState); setContentView(R.layout.login_relative); login = (Button) findViewById(R.id.btnLogin); username = (EditText) findViewById(R.id.etUsername); password = (EditText) findViewById(R.id.etPassword); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (password.getText().toString().toUpperCase().equals("TEST1")) { login_sukses(); } else { Toast.makeText(getApplicationContext(),"salah password", Toast.LENGTH_SHORT).show(); } } }); } private void login_sukses() { String user_login = username.getText().toString(); Intent i = new Intent(this,MainActivity.class); //kirimkan usernamenya ke tampilan utama i.putExtra("USERNAME",user_login); startActivity(i); } }
cf816564f0a3be701f0ffd78e457510f6f7a1035
23cb24099ad9d89ff20b471ff48d9922f213d2cb
/src/main/java/print/PrintAndVisit.java
d4e34c40c542cbbc6ddacbda620f6b93e8c58658
[]
no_license
SarhadSalam/ClientMS
2ac74ad6f9cebcb96f5225dbc21f7c8db16eb4e5
bb4d5969812eb2ece1ccd21e2b3aa178d7c17480
refs/heads/master
2021-09-18T19:55:19.239684
2018-07-19T03:39:02
2018-07-19T03:39:02
132,216,843
0
0
null
null
null
null
UTF-8
Java
false
false
3,332
java
package print; import authentication.DatabaseConnection; import customers.PatientVisits; import models.Employee; import models.Patient; import models.Visits; import properties.Properties; import java.io.IOException; import java.math.BigDecimal; import java.sql.*; import errors.Error; /** * Class Details:- Author: Sarhad User: sarhad Date: 13/05/18 Time : 11:27 AM Project Name: ClientMS Class Name: * PrintAndVisit */ public class PrintAndVisit { private Employee empl; private Patient patient; public PrintAndVisit(Patient patient, Employee empl) { this.patient = patient; this.empl = empl; } public void updateVisit(Visits visits) throws IOException, SQLException { Properties prop = new Properties(); DatabaseConnection databaseConnection = new DatabaseConnection(); Connection c = databaseConnection.getConnection(prop.getProperty("dbUsername", Properties.PROPERTY_TYPE.env), prop.getProperty(( "dbPassword" ), Properties.PROPERTY_TYPE.env)); String statement = "UPDATE patient_visit_details SET amount_paid = ?, services = ? WHERE visit_id = ?"; PreparedStatement ps = c.prepareStatement(statement); ps.setBigDecimal(1, visits.getAmount_paid()); ps.setString(2, visits.getServices()); ps.setInt(3, visits.getVisitId()); ps.executeUpdate(); c.close(); } //add to database public Visits addVisit(String services, double amountPaid, Visits visits) throws SQLException, IOException { Properties prop = new Properties(); DatabaseConnection databaseConnection = new DatabaseConnection(); Connection c = databaseConnection.getConnection(prop.getProperty("dbUsername", Properties.PROPERTY_TYPE.env), prop.getProperty(( "dbPassword" ), Properties.PROPERTY_TYPE.env)); String colName[] = new String[]{"visit_id"}; String statement = "INSERT INTO patient_visit_details (patient_id, employee_entered, services, amount_paid) values (?,?,?,?)"; PreparedStatement ps = c.prepareStatement(statement, colName); ps.setInt(1, patient.getId()); ps.setString(2, empl.getUsername()); ps.setString(3, services); ps.setBigDecimal(4, new BigDecimal(amountPaid).setScale(new Visits().CURRENCY_PRECISION, BigDecimal.ROUND_HALF_UP)); visits.setAmount_paid(new BigDecimal(amountPaid)); visits.setEmployeeEntered(empl.getFirst_name()+" "+empl.getLast_name()); visits.setPatientId(patient.getId()); visits.setTimestamp(new Timestamp(System.currentTimeMillis())); visits.setServices(services); if( ps.executeUpdate()>0 ) { ResultSet rs = ps.getGeneratedKeys(); if( rs.next() ) visits.setVisitId(rs.getInt(1)); } c.close(); return visits; } public boolean validateInput(String services, String amountPaid, Error error) { boolean isCorrect = true; if( services == null || services.equals("") ) { isCorrect = false; error.getErrors().add("Services cannot be empty."); } if( amountPaid == null || amountPaid.equals("") ) { isCorrect = false; error.getErrors().add("Amount cannot be empty."); } if( services.length()>500 ) { error.getErrors().add("Services rendered has to be smaller than 5 characters."); isCorrect = false; } if( !amountPaid.matches("^[0-9.]*$") ) { error.getErrors().add("Amount paid has to be only numbers."); isCorrect = false; } return isCorrect; } }
59fb15adde259aea4e1630dd2dee3471b0bb021b
ded8a831629aecd190176a61401fa402c4e40430
/src/main/java/org/way/quartz/examples/example13/SimpleRecoveryJob.java
ba590efd41e301eb93a8a101ce39ee30e03540a6
[]
no_license
way1110/way-quartz
fc63fdec35a66f4bcdc6d6dc3c6b3c6eef18821e
f7eb41e2a3dc35464e216d3b4d52969111f02ae0
refs/heads/master
2021-01-10T02:14:50.264974
2015-12-14T09:23:57
2015-12-14T09:23:57
47,825,460
0
0
null
null
null
null
UTF-8
Java
false
false
2,437
java
/* * All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy * of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. * */ package org.way.quartz.examples.example13; import org.quartz.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Date; /** * <p> * A dumb implementation of Job, for unit testing purposes. * </p> * * @author James House */ public class SimpleRecoveryJob implements Job { private static Logger _log = LoggerFactory.getLogger(SimpleRecoveryJob.class); private static final String COUNT = "count"; /** * Quartz requires a public empty constructor so that the scheduler can instantiate the class whenever it needs. */ public SimpleRecoveryJob() { } /** * <p> * Called by the <code>{@link org.quartz.Scheduler}</code> when a <code>{@link org.quartz.Trigger}</code> fires that * is associated with the <code>Job</code>. * </p> * * @throws JobExecutionException if there is an exception while executing the job. */ public void execute(JobExecutionContext context) throws JobExecutionException { JobKey jobKey = context.getJobDetail().getKey(); // if the job is recovering print a message if (context.isRecovering()) { _log.info("SimpleRecoveryJob: " + jobKey + " RECOVERING at " + new Date()); } else { _log.info("SimpleRecoveryJob: " + jobKey + " starting at " + new Date()); } // delay for ten seconds long delay = 10L * 1000L; try { Thread.sleep(delay); } catch (Exception e) { // } JobDataMap data = context.getJobDetail().getJobDataMap(); int count; if (data.containsKey(COUNT)) { count = data.getInt(COUNT); } else { count = 0; } count++; data.put(COUNT, count); _log.info("SimpleRecoveryJob: " + jobKey + " done at " + new Date() + "\n Execution #" + count); } }
1c90d7ac32feef7ea40048c302373b9eff6e82bf
7b73756ba240202ea92f8f0c5c51c8343c0efa5f
/classes/mqq/manager/VerifyCodeManager.java
8016ed8158db65ea846a124a3b2062dd4ee4ecd0
[]
no_license
meeidol-luo/qooq
588a4ca6d8ad579b28dec66ec8084399fb0991ef
e723920ac555e99d5325b1d4024552383713c28d
refs/heads/master
2020-03-27T03:16:06.616300
2016-10-08T07:33:58
2016-10-08T07:33:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,486
java
package mqq.manager; import com.tencent.qphone.base.remote.FromServiceMsg; import com.tencent.qphone.base.remote.ToServiceMsg; import java.util.HashMap; import mqq.observer.HttpVerifyHandler; import mqq.observer.ServerNotifyObserver; public abstract interface VerifyCodeManager extends Manager { public static final String EXTRA_IMAGE = "image"; public static final String EXTRA_KEY = "key"; public static final String EXTRA_NOTE = "note"; public static final String EXTRA_SEQ = "seq"; public abstract void cancelVerifyCode(ServerNotifyObserver paramServerNotifyObserver); public abstract boolean checkVerifyCodeResp(ToServiceMsg paramToServiceMsg, FromServiceMsg paramFromServiceMsg); public abstract void onHttpVerifyCodeFail(String paramString1, String paramString2); public abstract void onHttpVerifyCodeSucc(String paramString); public abstract void onRecvHttpVerifyCode(HttpVerifyHandler paramHttpVerifyHandler, byte[] paramArrayOfByte, String paramString, HashMap paramHashMap); public abstract void refreVerifyCode(ServerNotifyObserver paramServerNotifyObserver); public abstract void submitPuzzleVerifyCodeTicket(int paramInt, String paramString); public abstract void submitVerifyCode(ServerNotifyObserver paramServerNotifyObserver, String paramString); } /* Location: E:\apk\QQ_91\classes-dex2jar.jar!\mqq\manager\VerifyCodeManager.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
15c2ce93071ded8483a65f0544dc71f2cbc3176e
c0f09a8eb9cc7ecc535d60a7266b14f2627f10ae
/analytics/msf4j-analytics/src/test/java/org/wso2/msf4j/analytics/HTTPMonitoringConfigTest.java
4fb96f932a178e5fc216cfc04a0b98aa2a888146
[ "Apache-2.0" ]
permissive
SabaTurday/msf4j
264754f83cdc01752bb01b0923a6d98ff74a8886
2aec41a80bd8b8e15324e8403fa97a84ac45d78b
refs/heads/master
2021-01-24T21:25:27.109920
2016-07-25T11:23:21
2016-07-25T11:23:21
64,263,931
1
0
null
2016-07-27T00:26:12
2016-07-27T00:26:12
null
UTF-8
Java
false
false
1,882
java
/* * Copyright 2016 WSO2 Inc. (http://wso2.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wso2.msf4j.analytics; import org.testng.Assert; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import org.wso2.msf4j.analytics.httpmonitoring.config.HTTPMonitoringConfigBuilder; import org.wso2.msf4j.analytics.httpmonitoring.config.model.DasConfig; import org.wso2.msf4j.analytics.httpmonitoring.config.model.HTTPMonitoringConfig; /** * Test Cases for {@link HTTPMonitoringConfig} */ public class HTTPMonitoringConfigTest { private static HTTPMonitoringConfig httpMonitoringConfig; @BeforeClass private void load() { httpMonitoringConfig = HTTPMonitoringConfigBuilder.build(); } @Test public void testEnabled() { Assert.assertTrue(httpMonitoringConfig.isEnabled()); } @Test public void testDasConfigLoad() { DasConfig config = httpMonitoringConfig.getDas(); Assert.assertEquals(config.getReceiverURL(), "tcp://localhost:7611"); Assert.assertNull(config.getAuthURL()); Assert.assertEquals(config.getType(), "thrift"); Assert.assertEquals(config.getUsername(), "admin"); Assert.assertEquals(config.getPassword(), "admin"); Assert.assertEquals(config.getDataAgentConfigPath(), "data-agent-config.xml"); } }
ad6ce3ea2f0577b56d1785b97c2a60b4399c0953
4d3a8855b13a8c2e469abd358ff4d3a0847c4c37
/CONSULTORIO-WS-CLIENT/src/pe/com/consultorio/ws/EliminarPacienteResponse.java
ca35aa43ff3fa7b78ae12cda8e56fab2079e12fa
[]
no_license
eberttc/therevengeultimate2015
1029d38b50ae1353754ddd0a4a97fc3e7b0aa8e1
c396d5335b705711d60ed84f205e06986d884b9f
refs/heads/master
2021-05-29T12:37:26.563615
2015-02-21T21:28:14
2015-02-21T21:28:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
832
java
package pe.com.consultorio.ws; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "") @XmlRootElement(name = "eliminarPacienteResponse") public class EliminarPacienteResponse { }
510a737927744fe6187f12e451ed05dc6a9fa8f0
264a3bb6fa255f054d35e9a3f2d8b370a4952305
/src/cn/net/colin/entity/sysManage/GoodsInfoCriteria.java
ba6fdb3564a9b6af833695967f7ecd4fbbc30f2c
[]
no_license
siasColin/SecondHandShopping_BSM
7b8e7a756580a1d5d9c8e83e1c6a39410170003a
224ec931e961d4c7e2c8248be5b30194eb327111
refs/heads/master
2022-06-28T10:45:17.302195
2020-05-10T10:28:50
2020-05-10T10:28:50
262,703,233
0
0
null
null
null
null
UTF-8
Java
false
false
25,692
java
package cn.net.colin.entity.sysManage; import java.util.ArrayList; import java.util.List; /** * @author sxf code generator * date:2020/05/03 15:08 */ public class GoodsInfoCriteria { /** * 排序字段 */ protected String orderByClause; /** * 过滤重复数据 */ protected boolean distinct; /** * 查询条件 */ protected List<Criteria> oredCriteria; /** * 构造查询条件 */ public GoodsInfoCriteria() { oredCriteria = new ArrayList<Criteria>(); } /** * 设置排序字段 * @param orderByClause 排序字段 */ public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } /** * 获取排序字段 */ public String getOrderByClause() { return orderByClause; } /** * 设置过滤重复数据 * @param distinct 是否过滤重复数据 */ public void setDistinct(boolean distinct) { this.distinct = distinct; } /** * 是否过滤重复数据 */ public boolean isDistinct() { return distinct; } /** * 获取当前的查询条件实例 */ public List<Criteria> getOredCriteria() { return oredCriteria; } /** * 增加或者的查询条件,用于构建或者查询 * @param criteria 过滤条件实例 */ public void or(Criteria criteria) { oredCriteria.add(criteria); } /** * 创建一个新的或者查询条件 */ public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } /** * 创建一个查询条件 */ public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } /** * 内部构建查询条件对象 */ protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } /** * 清除查询条件 */ public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } /** * 商品信息表goods_info */ protected abstract static class BaseCriteria { protected List<Criterion> criteria; protected BaseCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andGoodsIdIsNull() { addCriterion("goods_id is null"); return (Criteria) this; } public Criteria andGoodsIdIsNotNull() { addCriterion("goods_id is not null"); return (Criteria) this; } public Criteria andGoodsIdEqualTo(String value) { addCriterion("goods_id =", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdNotEqualTo(String value) { addCriterion("goods_id <>", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdGreaterThan(String value) { addCriterion("goods_id >", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdGreaterThanOrEqualTo(String value) { addCriterion("goods_id >=", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdLessThan(String value) { addCriterion("goods_id <", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdLessThanOrEqualTo(String value) { addCriterion("goods_id <=", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdLike(String value) { addCriterion("goods_id like", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdNotLike(String value) { addCriterion("goods_id not like", value, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdIn(List<String> values) { addCriterion("goods_id in", values, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdNotIn(List<String> values) { addCriterion("goods_id not in", values, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdBetween(String value1, String value2) { addCriterion("goods_id between", value1, value2, "goodsId"); return (Criteria) this; } public Criteria andGoodsIdNotBetween(String value1, String value2) { addCriterion("goods_id not between", value1, value2, "goodsId"); return (Criteria) this; } public Criteria andGoodsNameIsNull() { addCriterion("goods_name is null"); return (Criteria) this; } public Criteria andGoodsNameIsNotNull() { addCriterion("goods_name is not null"); return (Criteria) this; } public Criteria andGoodsNameEqualTo(String value) { addCriterion("goods_name =", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameNotEqualTo(String value) { addCriterion("goods_name <>", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameGreaterThan(String value) { addCriterion("goods_name >", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameGreaterThanOrEqualTo(String value) { addCriterion("goods_name >=", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameLessThan(String value) { addCriterion("goods_name <", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameLessThanOrEqualTo(String value) { addCriterion("goods_name <=", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameLike(String value) { addCriterion("goods_name like", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameNotLike(String value) { addCriterion("goods_name not like", value, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameIn(List<String> values) { addCriterion("goods_name in", values, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameNotIn(List<String> values) { addCriterion("goods_name not in", values, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameBetween(String value1, String value2) { addCriterion("goods_name between", value1, value2, "goodsName"); return (Criteria) this; } public Criteria andGoodsNameNotBetween(String value1, String value2) { addCriterion("goods_name not between", value1, value2, "goodsName"); return (Criteria) this; } public Criteria andGoodsPublisherIsNull() { addCriterion("goods_publisher is null"); return (Criteria) this; } public Criteria andGoodsPublisherIsNotNull() { addCriterion("goods_publisher is not null"); return (Criteria) this; } public Criteria andGoodsPublisherEqualTo(String value) { addCriterion("goods_publisher =", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherNotEqualTo(String value) { addCriterion("goods_publisher <>", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherGreaterThan(String value) { addCriterion("goods_publisher >", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherGreaterThanOrEqualTo(String value) { addCriterion("goods_publisher >=", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherLessThan(String value) { addCriterion("goods_publisher <", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherLessThanOrEqualTo(String value) { addCriterion("goods_publisher <=", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherLike(String value) { addCriterion("goods_publisher like", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherNotLike(String value) { addCriterion("goods_publisher not like", value, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherIn(List<String> values) { addCriterion("goods_publisher in", values, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherNotIn(List<String> values) { addCriterion("goods_publisher not in", values, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherBetween(String value1, String value2) { addCriterion("goods_publisher between", value1, value2, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsPublisherNotBetween(String value1, String value2) { addCriterion("goods_publisher not between", value1, value2, "goodsPublisher"); return (Criteria) this; } public Criteria andGoodsIssudateIsNull() { addCriterion("goods_issuDate is null"); return (Criteria) this; } public Criteria andGoodsIssudateIsNotNull() { addCriterion("goods_issuDate is not null"); return (Criteria) this; } public Criteria andGoodsIssudateEqualTo(String value) { addCriterion("goods_issuDate =", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateNotEqualTo(String value) { addCriterion("goods_issuDate <>", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateGreaterThan(String value) { addCriterion("goods_issuDate >", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateGreaterThanOrEqualTo(String value) { addCriterion("goods_issuDate >=", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateLessThan(String value) { addCriterion("goods_issuDate <", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateLessThanOrEqualTo(String value) { addCriterion("goods_issuDate <=", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateLike(String value) { addCriterion("goods_issuDate like", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateNotLike(String value) { addCriterion("goods_issuDate not like", value, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateIn(List<String> values) { addCriterion("goods_issuDate in", values, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateNotIn(List<String> values) { addCriterion("goods_issuDate not in", values, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateBetween(String value1, String value2) { addCriterion("goods_issuDate between", value1, value2, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsIssudateNotBetween(String value1, String value2) { addCriterion("goods_issuDate not between", value1, value2, "goodsIssudate"); return (Criteria) this; } public Criteria andGoodsCategoryIsNull() { addCriterion("goods_category is null"); return (Criteria) this; } public Criteria andGoodsCategoryIsNotNull() { addCriterion("goods_category is not null"); return (Criteria) this; } public Criteria andGoodsCategoryEqualTo(String value) { addCriterion("goods_category =", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryNotEqualTo(String value) { addCriterion("goods_category <>", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryGreaterThan(String value) { addCriterion("goods_category >", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryGreaterThanOrEqualTo(String value) { addCriterion("goods_category >=", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryLessThan(String value) { addCriterion("goods_category <", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryLessThanOrEqualTo(String value) { addCriterion("goods_category <=", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryLike(String value) { addCriterion("goods_category like", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryNotLike(String value) { addCriterion("goods_category not like", value, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryIn(List<String> values) { addCriterion("goods_category in", values, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryNotIn(List<String> values) { addCriterion("goods_category not in", values, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryBetween(String value1, String value2) { addCriterion("goods_category between", value1, value2, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsCategoryNotBetween(String value1, String value2) { addCriterion("goods_category not between", value1, value2, "goodsCategory"); return (Criteria) this; } public Criteria andGoodsDescribeIsNull() { addCriterion("goods_describe is null"); return (Criteria) this; } public Criteria andGoodsDescribeIsNotNull() { addCriterion("goods_describe is not null"); return (Criteria) this; } public Criteria andGoodsDescribeEqualTo(String value) { addCriterion("goods_describe =", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeNotEqualTo(String value) { addCriterion("goods_describe <>", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeGreaterThan(String value) { addCriterion("goods_describe >", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeGreaterThanOrEqualTo(String value) { addCriterion("goods_describe >=", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeLessThan(String value) { addCriterion("goods_describe <", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeLessThanOrEqualTo(String value) { addCriterion("goods_describe <=", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeLike(String value) { addCriterion("goods_describe like", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeNotLike(String value) { addCriterion("goods_describe not like", value, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeIn(List<String> values) { addCriterion("goods_describe in", values, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeNotIn(List<String> values) { addCriterion("goods_describe not in", values, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeBetween(String value1, String value2) { addCriterion("goods_describe between", value1, value2, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsDescribeNotBetween(String value1, String value2) { addCriterion("goods_describe not between", value1, value2, "goodsDescribe"); return (Criteria) this; } public Criteria andGoodsPriceIsNull() { addCriterion("goods_price is null"); return (Criteria) this; } public Criteria andGoodsPriceIsNotNull() { addCriterion("goods_price is not null"); return (Criteria) this; } public Criteria andGoodsPriceEqualTo(Double value) { addCriterion("goods_price =", value, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceNotEqualTo(Double value) { addCriterion("goods_price <>", value, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceGreaterThan(Double value) { addCriterion("goods_price >", value, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceGreaterThanOrEqualTo(Double value) { addCriterion("goods_price >=", value, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceLessThan(Double value) { addCriterion("goods_price <", value, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceLessThanOrEqualTo(Double value) { addCriterion("goods_price <=", value, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceIn(List<Double> values) { addCriterion("goods_price in", values, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceNotIn(List<Double> values) { addCriterion("goods_price not in", values, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceBetween(Double value1, Double value2) { addCriterion("goods_price between", value1, value2, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsPriceNotBetween(Double value1, Double value2) { addCriterion("goods_price not between", value1, value2, "goodsPrice"); return (Criteria) this; } public Criteria andGoodsStockIsNull() { addCriterion("goods_stock is null"); return (Criteria) this; } public Criteria andGoodsStockIsNotNull() { addCriterion("goods_stock is not null"); return (Criteria) this; } public Criteria andGoodsStockEqualTo(Integer value) { addCriterion("goods_stock =", value, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockNotEqualTo(Integer value) { addCriterion("goods_stock <>", value, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockGreaterThan(Integer value) { addCriterion("goods_stock >", value, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockGreaterThanOrEqualTo(Integer value) { addCriterion("goods_stock >=", value, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockLessThan(Integer value) { addCriterion("goods_stock <", value, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockLessThanOrEqualTo(Integer value) { addCriterion("goods_stock <=", value, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockIn(List<Integer> values) { addCriterion("goods_stock in", values, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockNotIn(List<Integer> values) { addCriterion("goods_stock not in", values, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockBetween(Integer value1, Integer value2) { addCriterion("goods_stock between", value1, value2, "goodsStock"); return (Criteria) this; } public Criteria andGoodsStockNotBetween(Integer value1, Integer value2) { addCriterion("goods_stock not between", value1, value2, "goodsStock"); return (Criteria) this; } } /** * 商品信息表goods_info的映射实体 */ public static class Criteria extends BaseCriteria { protected Criteria() { super(); } } /** * 商品信息表goods_info的动态SQL对象. */ public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
5db15509a8a550a95b1a7b8f73f645ccc7732e61
47926eeb896724f7770ee3c52ca22756ff95ae97
/src/main/java/com/example/resource/SampleResourceApplication.java
a388444edd72db1ced3dec8406ad70af167a7ca3
[]
no_license
alexanderkarpov/oauth2
fb045a2dba6f9eabc740fe42d96ed36ac42b441c
2c6d818917ea937519563e9f4dc15963a2b58d51
refs/heads/master
2021-01-20T19:00:37.352061
2016-07-19T07:32:48
2016-07-19T07:32:48
63,403,868
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package com.example.resource; import java.util.UUID; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.PropertySource; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @SpringBootApplication @RestController @EnableResourceServer @PropertySource("classpath:resource-server.properties") public class SampleResourceApplication { public static void main(String[] args) { SpringApplication.run(SampleResourceApplication.class, args); } @RequestMapping("/") public String securedCall() { return "success (id: " + UUID.randomUUID().toString().toUpperCase() + ")"; } }
9f8e2915a5ab010c7513431b20fd6aaed14de5f0
9085e36f6ea75622aebd4db188e3d62ad9eeb971
/src/ximias/dk/au/cs/fh/Commands/Dialog.java
f80dec7f2ac495b19d7a4b38ce4f5d111a0e5252
[]
no_license
aalleexxx5/Simply
c89f53eaf1055513c62b05e37652d72a0e616d44
9843966ff9abf1daa7af54bf7dcfda07068c651a
refs/heads/master
2020-04-17T21:04:29.310146
2018-05-16T17:53:50
2018-05-16T17:53:50
67,369,867
0
0
null
null
null
null
UTF-8
Java
false
false
3,178
java
package ximias.dk.au.cs.fh.Commands; import ximias.dk.au.cs.fh.Components.*; import javax.swing.*; import java.util.Arrays; import java.util.Optional; /** * Created by Alex on 26/03/2016. * Command. Opens a dialog box with configurable options. */ public class Dialog extends Command {//TODO: Implement this @Override public String use() { /* decode this by looping through args till a valid type name is found. * everything between arg[0] and this is the message. * Loop backwards till an invalid option is found, the arg to the left of that is the var name * everything between this and type is the title. */ return "dialog <message> <type> <title> <variableName> <selectedOption> <options> ... <options> \n" + "<message>: The text in the box\n" + "<title>: the title at the top of the box\n"+ "<type>: the type of message. valid types are: plain, error, information, warning and question\n" + "<variableName>: a name for a variable containing what the user pressed \n" + "<options>: the options of the box, every argument adds one more button"; } @Override public String description() { return "Shows a dialog box in the center of the screen. This is an advanced version of popup"; } @Override public boolean execute(String[] args) { args= Mem.getValuesInArgs(args); if (args.length<5){ Viewer.print("Not enough arguments. needs min. 5"); return false; } int messageArgs=-1,varPos=-1,type=JOptionPane.PLAIN_MESSAGE; for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase("error")){ messageArgs=i; type=JOptionPane.ERROR_MESSAGE; i=i+2; }else if (args[i].equalsIgnoreCase("Information")){ messageArgs=i; type=JOptionPane.INFORMATION_MESSAGE; i=i+2; }else if (args[i].equalsIgnoreCase("warning")){ messageArgs=i; type=JOptionPane.WARNING_MESSAGE; i=i+2; }else if (args[i].equalsIgnoreCase("question")){ messageArgs=i; type=JOptionPane.QUESTION_MESSAGE; i=i+2; }else if (args[i].equalsIgnoreCase("plain")){ messageArgs=i; type=JOptionPane.PLAIN_MESSAGE; i=i+2; } if (messageArgs != -1&& ArgManipulation.isNumber(args[i])) { varPos=i; break; } } if (varPos==-1){ Viewer.print("Missing type and/or selected option"); return false; } int value = JOptionPane.showOptionDialog(null,ArgManipulation.argsToString(0,messageArgs,args),ArgManipulation.argsToString(messageArgs+1,varPos-1,args),JOptionPane.DEFAULT_OPTION,type,null, Arrays.copyOfRange(args,varPos+1,args.length),args[varPos]); Lookup.getMemInstance().add(new MemPair(args[varPos-1],args[value+varPos+1])); return true; } }
40a96f44d24bcdf4f2c2bf155eb67917670e6f22
8df00d1e6c2f8989913f2fd230da9edca1c9a186
/app/src/main/java/com/example/instagram_clone/fragments/PostsFragment.java
14db9f6215e36a25fbc31ced0b095cf57a301112
[ "Apache-2.0" ]
permissive
dion-shushi/InstagramClone
5d00fa1e68095854a579d3caeb6763cf95f22707
900f2191c9a13ec1aaad30cc9a2c99ba1e12103b
refs/heads/master
2023-07-11T15:32:20.429073
2021-08-22T07:32:52
2021-08-22T07:32:52
394,815,320
0
0
null
null
null
null
UTF-8
Java
false
false
5,624
java
package com.example.instagram_clone.fragments; import android.os.Bundle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Toast; import com.example.instagram_clone.Post; import com.example.instagram_clone.PostsAdapter; import com.example.instagram_clone.R; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseQuery; import java.util.ArrayList; import java.util.List; /** * A simple {@link Fragment} subclass. * Use the {@link PostsFragment#newInstance} factory method to * create an instance of this fragment. */ public class PostsFragment extends Fragment { public static final String TAG = "PostsFragment"; protected RecyclerView rv_posts; protected PostsAdapter adapter; protected List<Post> allPosts; private SwipeRefreshLayout swipeContainer; // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public PostsFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment Post. */ // TODO: Rename and change types and number of parameters public static PostsFragment newInstance(String param1, String param2) { PostsFragment fragment = new PostsFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_post, container, false); } @Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); allPosts = new ArrayList<>(); // create a layout rv_posts = view.findViewById(R.id.rv_posts); // create the adapter adapter = new PostsAdapter(getContext(), allPosts); // create the data source // set the adapter on the rv rv_posts.setAdapter(adapter); // set the layout manager on the rv rv_posts.setLayoutManager(new LinearLayoutManager(getContext())); // Lookup the swipe container view swipeContainer = (SwipeRefreshLayout) view.findViewById(R.id.swipeContainer); // Setup refresh listener which triggers new data loading swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // Your code to refresh the list here. // Make sure you call swipeContainer.setRefreshing(false) // once the network request has completed successfully. fetchTimelineAsync(0); } private void fetchTimelineAsync(int page) { // Send the network request to fetch the updated data // `client` here is an instance of Android Async HTTP // getHomeTimeline is an example endpoint. adapter.clear(); queryPosts(); swipeContainer.setRefreshing(false); Toast.makeText(view.getContext(), "Refreshed", Toast.LENGTH_LONG).show(); } }); // Configure the refreshing colors swipeContainer.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); queryPosts(); } protected void queryPosts(){ ParseQuery<Post> query = ParseQuery.getQuery(Post.class); query.include(Post.KEY_USER); query.setLimit(20); query.addDescendingOrder(Post.KEY_CREATED_AT); query.findInBackground(new FindCallback<Post>() { @Override public void done(List<Post> postObjs, ParseException e) { if (e != null){ Log.e(TAG, "Issue with getting posts", e); return; } for (Post post: postObjs){ Log.i(TAG, "Post: " + post.getKeyDescription() + ", username: " + post.getKeyUser().getUsername()); } allPosts.addAll(postObjs); adapter.notifyDataSetChanged(); } }); } }
7650e6241b0d7c8f659d5d890a4c309af9a2d76b
2a0b8f2cb21ddb51d2c980c5a3231168e89012c7
/src/main/java/io/github/vananos/sosedi/components/converters/GeoInfoConverter.java
7fe4ea9d15c52c3d5329983c6e1832438ff71b5c
[]
no_license
vananos/sosedi-backend
2ed56f446d12047d17b14147265f3a20ea0bee37
91c92dd77db232ec561087dd9512e848bbec7f79
refs/heads/master
2022-04-16T07:56:16.754827
2020-03-29T06:53:58
2020-03-29T06:53:58
185,743,859
1
0
null
2019-06-21T06:00:47
2019-05-09T06:57:42
Java
UTF-8
Java
false
false
325
java
package io.github.vananos.sosedi.components.converters; import com.fasterxml.jackson.core.type.TypeReference; import io.github.vananos.sosedi.models.GeoInfo; public class GeoInfoConverter extends BaseJsonConverter<GeoInfo> { public GeoInfoConverter() { super(new TypeReference<GeoInfo>() { }); } }
c1430ef1128beb84f726a83d88bcc0db62afadad
8e68a3f54af61605672029b8bece51ed74a2e9e2
/daikon-crypto/crypto-utils/src/test/java/org/talend/daikon/crypto/digest/DigestSourcesTest.java
2f21729b7d86dd511a467443b79ff93ae77bc1d4
[ "Apache-2.0" ]
permissive
cmeng-talend/daikon
22f2e15f5e2b73c350bb482d36327f0f2b98c503
fb5ce5d67dd76f04ed78c0444d89be1a2e860ea6
refs/heads/master
2020-08-24T01:21:55.240808
2019-10-21T07:11:48
2019-10-21T07:11:48
216,739,815
0
0
Apache-2.0
2019-10-22T06:32:19
2019-10-22T06:32:19
null
UTF-8
Java
false
false
1,813
java
package org.talend.daikon.crypto.digest; import org.junit.Test; import org.talend.daikon.crypto.KeySources; import static org.junit.Assert.*; public class DigestSourcesTest { @Test public void shouldUseSaltInSha256() throws Exception { // Given final String data = "value to digest"; // When final String digest = DigestSources.sha256().digest(data, KeySources.fixedKey("abcd1234").getKey()); // Then assertEquals("6c7nGrky/ehjM40Ivk3p3+OeoEm9r7NCzmWexUULaa7IG36TBiw+3zjgPRtgPlyVMhJAo7BDDZ6176QavT7/Eg==", digest); } @Test public void shouldNotUseSaltInSha256() { // Given final String data = "value to digest"; // When final String digest1 = DigestSources.sha256().digest(data, null); final String digest2 = DigestSources.sha256().digest(data, new byte[0]); // Then assertEquals(digest1, digest2); assertEquals("yBt+kwYsPt844D0bYD5clTISQKOwQw2ete+kGr0+/xI=", digest1); } @Test public void cannotUsePbkDf2WithoutSalt() { // When try { DigestSources.pbkDf2().digest("value", null); fail(); } catch (IllegalArgumentException e) { // Expected } try { DigestSources.pbkDf2().digest("value", new byte[0]); fail(); } catch (IllegalArgumentException e) { // Expected } } @Test public void shouldUseSaltInPbkDf2() throws Exception { // Given final String data = "value to digest"; // When final String digest = DigestSources.pbkDf2().digest(data, KeySources.fixedKey("abcd1234").getKey()); // Then assertEquals("jAPuCXK/9TVMcpzqkS32je+dTE6FnTVAVH1d6FnMoy4=", digest); } }
c6603510574163cb5315cc087958d00c951f5bb2
1844ca4a59edfd7c22c01bb5173a9f1e07974e44
/decorator/src/main/java/pt/kirill/designpatterns/WeaponDecorator.java
2018a547e29cc1db95e8ea3ecf23465633614644
[]
no_license
ramzesucr/design-patterns
514194a76cd4f5e684e7374e75b91035f8d927f6
3b17403cfbe29c3c82c89d435409e3082584df41
refs/heads/master
2021-01-10T05:38:47.894818
2016-03-02T11:07:13
2016-03-02T11:07:13
44,177,668
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package pt.kirill.designpatterns; /** * Created by kirillryabin on 05/02/16. */ public class WeaponDecorator implements Weapon { private Weapon decorated; public WeaponDecorator(Weapon weapon) { decorated = weapon; } @Override public int fire() { return decorated.fire(); } }
e9ec2e57377a9265e7d67327f81723c1d3e817b3
8cb5fd01b4a3802688656097806637cf740e1398
/src/utils/myObject/ComplexNode.java
fb10c65502b50aacb43fe7e5bbb6f824dce79cbc
[]
no_license
XZZMemory/Offer
e903f64feb2eb3a46a201405562e706e2bd049b6
4c127d6b3f99126c16bca0c013886ee496cdcb0c
refs/heads/master
2022-01-23T18:39:39.638456
2022-01-21T03:02:28
2022-01-21T03:02:28
143,127,073
0
0
null
null
null
null
UTF-8
Java
false
false
295
java
package utils.myObject; public class ComplexNode { public char info; public ComplexNode next; public ComplexNode sibling; public ComplexNode(char info) { this.info = info; this.next = null; this.sibling = null; } public ComplexNode() { } }
bee293ad635e3db88cbf9c226c4152acaaa1783a
2bc48f227f1eb8544a1677f8472092dd8995f6b9
/src/main/java/trm/Main.java
0d5859c40804910c73c84a9e0fd2423f6b0123db
[]
no_license
JefersonPedraza/proyecto1
c5c9d4cf77f5c0df22274a5b121649ab4325c44b
e799cd4b8c1e490833797bc6ec33422703efd138
refs/heads/master
2022-07-19T09:23:24.783285
2019-06-25T15:21:47
2019-06-25T15:21:47
193,718,414
0
0
null
2022-06-29T17:28:12
2019-06-25T13:58:21
Java
UTF-8
Java
false
false
124
java
package trm; public class Main { public static void main(String[] args) throws Throwable { Vista.abstra(); } }
[ "1016091js" ]
1016091js
755c49f4c5ec773ec898bf64f93dbe2c17a5beb2
a399f6cdfb9472d1ec45f359a2f1449eb3933014
/src/main/java/com/c4wrd/gatekeeper/defaults/DefaultGatekeeperTemplateEngine.java
fbbdccd2ef8488b4c440f51788cfe9c74f553a0d
[]
no_license
c4wrd/gatekeeper
907bc86a33210031b602c83c9f5cef5cb65e18aa
10f5fb447d0ea7fc604ef55c55ad0212e9fa99f5
refs/heads/master
2020-03-22T10:24:35.221755
2018-07-06T22:13:51
2018-07-06T22:13:51
139,900,732
0
0
null
null
null
null
UTF-8
Java
false
false
1,467
java
package com.c4wrd.gatekeeper.defaults; import com.c4wrd.gatekeeper.api.AccessRequest; import com.c4wrd.gatekeeper.api.GatekeeperTemplateEngine; import com.google.common.collect.Maps; import org.apache.commons.text.StringSubstitutor; import org.apache.commons.text.lookup.StringLookup; import org.apache.commons.text.lookup.StringLookupFactory; import java.util.Map; /** * A default implementation of the GatekeeperTemplateEngine that will perform the following things: * * <p>1. For each context value in the access request, it will be made available as ${ctx:ID} in the * template, where `ID` is the identifier of the context value * * <p>2. The subjects id will be made available as ${subject:id} */ public class DefaultGatekeeperTemplateEngine implements GatekeeperTemplateEngine { @Override public String render(String template, AccessRequest request) { StringSubstitutor substitutor = new StringSubstitutor(getVariableResolver(request)); return substitutor.replace(template); } @Override public StringLookup getVariableResolver(AccessRequest request) { return StringLookupFactory.INSTANCE.mapStringLookup(makeValueMap(request)); } private Map<String, Object> makeValueMap(AccessRequest request) { Map<String, Object> values = Maps.newHashMap(); values.putAll(request.getContext()); if (request.getSubject() != null) { values.put("subject:id", request.getSubject().getId()); } return values; } }
fde67e8b3e02d0dd85d3cf364cb8d3ddf498e569
0c82167829663eb83014a250883d949d2c315d34
/swagger-compare/swagger-compare-rest/src/main/java/de/haug_dev/swagger_compare_rest/RestResponseEntityExceptionHandler.java
f6b012607384530c8b92e80cd53ed33f920e5790
[ "MIT" ]
permissive
TorbenHaug/swagger-compare
ff32cccbd1dd7220de845a48ac469b4fd1113d6f
c407135bd9a6e9b3d3685cc80d64ef17c9ffaf94
refs/heads/master
2018-09-07T19:39:19.857921
2018-07-09T17:32:46
2018-07-09T17:32:46
115,719,978
0
0
MIT
2018-02-19T23:55:23
2017-12-29T12:16:37
Java
UTF-8
Java
false
false
1,909
java
package de.haug_dev.swagger_compare_rest; import de.haug_dev.swagger_compare.swagger_compare_reader.InvalidOpenAPIFileException; import org.apache.commons.lang3.exception.ExceptionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import java.net.MalformedURLException; @ControllerAdvice public class RestResponseEntityExceptionHandler extends ResponseEntityExceptionHandler { Logger logger = LoggerFactory.getLogger(RestResponseEntityExceptionHandler.class); @ExceptionHandler({ InvalidOpenAPIFileException.class }) @ResponseBody @ResponseStatus(HttpStatus.NOT_FOUND) public ErrorMessage notFound(final Exception error) { Throwable rootError = getRootCause(error); logger.debug("Generating error: " + rootError.getMessage()); return new ErrorMessage(rootError.getMessage(), ExceptionUtils.getStackTrace(rootError)); } @ExceptionHandler({ MalformedURLException.class }) @ResponseBody @ResponseStatus(HttpStatus.BAD_REQUEST) public ErrorMessage badRequest(final Exception error) { Throwable rootError = getRootCause(error); logger.debug("Generating error: " + rootError.getMessage()); return new ErrorMessage(rootError.getMessage(), ExceptionUtils.getStackTrace(rootError)); } private Throwable getRootCause(Throwable throwable){ if(throwable.getCause() == null) { return throwable; } return getRootCause(throwable.getCause()); } }
02eb90150f1aea9455c8bbb75cd0adabef10682f
b6d08cd67f6b46aa8a17ba409e1428bfde0ee53c
/app/src/main/java/com/xmrbi/warehouse/data/entity/main/StoreHouseAioConfig.java
33bf50acf264e1819dd137197124f0d453e7f13e
[]
no_license
ghit700/warehouse
6424f297939a7b5deca7cf80209874716e14d825
afbff2cc5765a5b1648244ed1669561327c83c06
refs/heads/master
2020-03-07T22:40:11.104267
2018-07-09T00:48:50
2018-07-09T00:48:50
127,760,348
1
0
null
null
null
null
UTF-8
Java
false
false
6,846
java
package com.xmrbi.warehouse.data.entity.main; import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Generated; /** * Created by wzn on 2018/4/17. */ @Entity public class StoreHouseAioConfig { /** * ID */ @Id private Long id; /** * 仓库ID */ private Long storeHouseId; /** * 仓库名称 */ private String storeHouseName; /** * 租户 */ private Long lesseeId; /** * 门禁-开 */ private Integer entranceOpen; /** * 门禁-关 */ private Integer entranceClose; /** * 考勤机地址 */ private String fingerprintAddress; /** * 硬盘录像机ip */ private String vcrIp; /** * 硬盘录像机端口号 */ private Integer vcrPort; /** * 硬盘录像机登录用户名 */ private String vcrUsername; /** * 硬盘录像机登录密码 */ private String vcrPassword; /** * 关键摄像机地址 */ private String vcrPrimaryAddress; /** * RFID读写器ip */ private String rfidIp; /** * RFID读写器端口号 */ private Integer rfidPort; /** * 打印机串口名称 */ private String printSerialName; /** * 打印机波特率 */ private String printBautRate; /** * 灯控串口名称 */ private String lightSerialName; /** * 灯控波特率 */ private String lightBautRate; /** * 门禁串口名称 */ private String entranceSerialName; /** * 门禁波特率 */ private String entranceBautRate; @Generated(hash = 217289313) public StoreHouseAioConfig(Long id, Long storeHouseId, String storeHouseName, Long lesseeId, Integer entranceOpen, Integer entranceClose, String fingerprintAddress, String vcrIp, Integer vcrPort, String vcrUsername, String vcrPassword, String vcrPrimaryAddress, String rfidIp, Integer rfidPort, String printSerialName, String printBautRate, String lightSerialName, String lightBautRate, String entranceSerialName, String entranceBautRate) { this.id = id; this.storeHouseId = storeHouseId; this.storeHouseName = storeHouseName; this.lesseeId = lesseeId; this.entranceOpen = entranceOpen; this.entranceClose = entranceClose; this.fingerprintAddress = fingerprintAddress; this.vcrIp = vcrIp; this.vcrPort = vcrPort; this.vcrUsername = vcrUsername; this.vcrPassword = vcrPassword; this.vcrPrimaryAddress = vcrPrimaryAddress; this.rfidIp = rfidIp; this.rfidPort = rfidPort; this.printSerialName = printSerialName; this.printBautRate = printBautRate; this.lightSerialName = lightSerialName; this.lightBautRate = lightBautRate; this.entranceSerialName = entranceSerialName; this.entranceBautRate = entranceBautRate; } @Generated(hash = 1197133150) public StoreHouseAioConfig() { } public Long getId() { return this.id; } public void setId(Long id) { this.id = id; } public Long getStoreHouseId() { return this.storeHouseId; } public void setStoreHouseId(Long storeHouseId) { this.storeHouseId = storeHouseId; } public String getStoreHouseName() { return this.storeHouseName; } public void setStoreHouseName(String storeHouseName) { this.storeHouseName = storeHouseName; } public Long getLesseeId() { return this.lesseeId; } public void setLesseeId(Long lesseeId) { this.lesseeId = lesseeId; } public Integer getEntranceOpen() { return this.entranceOpen; } public void setEntranceOpen(Integer entranceOpen) { this.entranceOpen = entranceOpen; } public Integer getEntranceClose() { return this.entranceClose; } public void setEntranceClose(Integer entranceClose) { this.entranceClose = entranceClose; } public String getFingerprintAddress() { return this.fingerprintAddress; } public void setFingerprintAddress(String fingerprintAddress) { this.fingerprintAddress = fingerprintAddress; } public String getVcrIp() { return this.vcrIp; } public void setVcrIp(String vcrIp) { this.vcrIp = vcrIp; } public Integer getVcrPort() { return this.vcrPort; } public void setVcrPort(Integer vcrPort) { this.vcrPort = vcrPort; } public String getVcrUsername() { return this.vcrUsername; } public void setVcrUsername(String vcrUsername) { this.vcrUsername = vcrUsername; } public String getVcrPassword() { return this.vcrPassword; } public void setVcrPassword(String vcrPassword) { this.vcrPassword = vcrPassword; } public String getVcrPrimaryAddress() { return this.vcrPrimaryAddress; } public void setVcrPrimaryAddress(String vcrPrimaryAddress) { this.vcrPrimaryAddress = vcrPrimaryAddress; } public String getRfidIp() { return this.rfidIp; } public void setRfidIp(String rfidIp) { this.rfidIp = rfidIp; } public Integer getRfidPort() { return this.rfidPort; } public void setRfidPort(Integer rfidPort) { this.rfidPort = rfidPort; } public String getPrintSerialName() { return this.printSerialName; } public void setPrintSerialName(String printSerialName) { this.printSerialName = printSerialName; } public String getPrintBautRate() { return this.printBautRate; } public void setPrintBautRate(String printBautRate) { this.printBautRate = printBautRate; } public String getLightSerialName() { return this.lightSerialName; } public void setLightSerialName(String lightSerialName) { this.lightSerialName = lightSerialName; } public String getLightBautRate() { return this.lightBautRate; } public void setLightBautRate(String lightBautRate) { this.lightBautRate = lightBautRate; } public String getEntranceSerialName() { return this.entranceSerialName; } public void setEntranceSerialName(String entranceSerialName) { this.entranceSerialName = entranceSerialName; } public String getEntranceBautRate() { return this.entranceBautRate; } public void setEntranceBautRate(String entranceBautRate) { this.entranceBautRate = entranceBautRate; } }
9d8df27be82f958f96f704e80002f6f56363b0ed
d0e85d0b39f7d8f3c2007bc949979622eefc4ab9
/src/test/java/com/framework/workflow/MockFailFlow.java
da0126d89d2f83600799905067bdb7c3e6cd9cdf
[ "Apache-2.0" ]
permissive
yarntime/framework
eac574a9d8d53335eb0585631aeef3f66941a128
a7cea955502481958552828cd886be3576b85ead
refs/heads/master
2021-01-10T01:14:46.239430
2017-06-07T03:24:38
2017-06-07T03:24:38
45,776,965
2
0
null
null
null
null
UTF-8
Java
false
false
504
java
/** * * Function Description * * @author: zhangwei * @date: Apr 1, 2016 * @version: 1.0 */ package com.framework.workflow; import com.framework.exception.WorkFlowException; public class MockFailFlow extends WorkFlow { @Override public void process(WorkFlowChainContext chainContext) throws WorkFlowException { throw new WorkFlowException("failed"); } @Override public void rollback(WorkFlowChainContext chainContext) throws WorkFlowException { } }
9bc5cd6153c655ec5ca9de7c474d9acbc47ab132
7d01d0ee1bab9ed80d02dc766feeb7d88956f2a7
/src/main/java/gov/usgs/cida/pubs/domain/sipp/USGSProgram.java
33553a0da08580c0802ffd096b332253fb041100
[ "LicenseRef-scancode-public-domain", "CC0-1.0" ]
permissive
usgs/pubs-services
db39ccda73ed24d33dfc53953048c6cb18f9649e
56703c9c69c05c17c45e642b71f930a4ad7c5ef0
refs/heads/master
2021-12-24T16:51:57.382707
2021-08-18T17:36:24
2021-08-18T17:36:24
199,486,310
4
7
NOASSERTION
2021-08-18T17:36:25
2019-07-29T16:09:30
Java
UTF-8
Java
false
false
607
java
package gov.usgs.cida.pubs.domain.sipp; import org.apache.commons.lang3.StringUtils; import com.fasterxml.jackson.annotation.JsonProperty; public class USGSProgram { @JsonProperty("IPNumber") private String ipNumber; @JsonProperty("USGSProgram") private String usgsProgram; public String getIpNumber() { return StringUtils.trimToNull(ipNumber); } public void setIpNumber(String ipNumber) { this.ipNumber = ipNumber; } public String getUsgsProgram() { return StringUtils.trimToNull(usgsProgram); } public void setUsgsProgram(String usgsProgram) { this.usgsProgram = usgsProgram; } }
73dd87ba78b1646f69507c59419ee11cae4ef02a
3e9dd3298b85ab9b081117eb9c88032715ce13cf
/focWebServer/src/com/foc/vaadin/gui/components/popupButton/FVPopupButton.java
93d1cc8d98b1d1eaa70b88a05982ff5fc5f7eaa1
[ "Apache-2.0" ]
permissive
focframework/framework
d0a151755f14a04b4a72a562b22f6bad83fe8836
6d07b694e7713d27b95f0ca69e2ec3c056969054
refs/heads/master
2020-05-30T16:48:32.505610
2019-05-30T07:38:36
2019-05-30T07:38:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,327
java
package com.foc.vaadin.gui.components.popupButton; import java.util.HashMap; import com.vaadin.ui.Button.ClickListener; import com.foc.util.Utils; import com.foc.vaadin.gui.FocXMLGuiComponentStatic; import com.foc.vaadin.gui.components.FVNativeButton; import com.foc.vaadin.gui.layouts.FVHorizontalLayout; import com.foc.web.gui.INavigationWindow; import com.vaadin.ui.UI; @SuppressWarnings("serial") public class FVPopupButton extends FVNativeButton implements ClickListener { private FVPopupWindow popupWindow = null; private String styleName = null; private HashMap<String, FVPopupContentButton> buttonMap = null;//Basically used for Unit testing public FVPopupButton(String content) { this(content, null); } public FVPopupButton(String content, int styleIndex) { this(content, FocXMLGuiComponentStatic.getButtonStyleForIndex(styleIndex)); } public FVPopupButton(String content, String styleName) { super(content); init(styleName); } private void init(String styleName){ this.styleName = styleName; buttonMap = new HashMap<String, FVPopupContentButton>(); popupWindow = new FVPopupWindow(this); if(!Utils.isStringEmpty(styleName)){ addStyleName(styleName); }else{ addStyleName("foc-button-orange"); } addClickListener(this); } public void dispose(){ super.dispose(); if(popupWindow != null){ popupWindow.dispose(); popupWindow = null; } if(buttonMap != null){ buttonMap.clear(); } } @Override public void buttonClick(ClickEvent event) { if(getPopupWindow() != null){ getPopupWindow().setPositionX(event.getClientX()); getPopupWindow().setPositionY(event.getClientY() + 30); UI.getCurrent().addWindow(getPopupWindow()); getPopupWindow().focus(); } } public FVPopupContentButton newButton(INavigationWindow iNavigationWindow, String caption, String menuCode){ FVHorizontalLayout menuItemHorizontalLayout = new FVHorizontalLayout(null); menuItemHorizontalLayout.setWidth("100%"); FVPopupContentButton contentButton = new FVPopupContentButton(getPopupWindow(), iNavigationWindow, caption); contentButton.addStyleName(styleName); contentButton.setWidth("100%"); contentButton.setHeight("40px"); menuItemHorizontalLayout.addComponent(contentButton); if(buttonMap != null){ buttonMap.put(menuCode, contentButton); } // if(withAddShortCut){ // FVPopupContentButton addShortcutButton = new FVPopupContentButton(mainFocData, getPopupWindow(), "", iNavigationWindow, moduleCode, menuCode, withAddShortCut); // // menuItemHorizontalLayout.addComponent(addShortcutButton); // menuItemHorizontalLayout.setComponentAlignment(addShortcutButton, Alignment.BOTTOM_LEFT); // addShortcutButton.setStyleName(BaseTheme.BUTTON_LINK); // addShortcutButton.setIcon(FVIconFactory.getInstance().getFVIcon_Small(FVIconFactory.ICON_ADD)); // } getPopupWindow().addComponentToVerticalLayout(menuItemHorizontalLayout); return contentButton; } public FVPopupWindow getPopupWindow(){ return popupWindow; } public String getStyleName() { return styleName; } public FVPopupContentButton getContentButton(String code){ return buttonMap != null ? buttonMap.get(code) : null; } }
5808aebcb9c53ec4dc941a224176d896d780f32c
c257d8afd0785bddaff12819ca3fea58efef375c
/juju-logger/src/test/java/com/juju/sport/logger/dao/test/LoggerTableManageDaoTest.java
1a724aea8bd09f55f8f7ce2699a336939b790425
[]
no_license
wwbg1988/juju_sport
37c2177a185a6485cd75ef0d72d084476dc51b8b
39a2d91ef815c85de60649adc50372f7ee3e3343
refs/heads/master
2020-06-21T03:47:28.924899
2016-11-26T06:08:46
2016-11-26T06:08:46
74,807,863
0
1
null
null
null
null
UTF-8
Java
false
false
84
java
package com.juju.sport.logger.dao.test; public class LoggerTableManageDaoTest { }
ad64d5f686613ac23e7061b6a9699c21fa9d97f7
5a38dec460ec5570a03d4ae1c8b98672c96759a4
/src/main/java/com/leomara/cursomc/domain/Categoria.java
52b9c6142f62a10656642f89b284fc5302645d3c
[]
no_license
LeomaraAC/curso-Spring-Boot-Ionic
814915befeffff7fbb79942ede58d45a098730b8
b5a3ee1f0365d7cf3f19b614a8078e16e521fdf3
refs/heads/master
2020-04-14T22:34:29.651808
2019-07-13T00:25:18
2019-07-13T00:25:18
164,168,301
0
0
null
null
null
null
UTF-8
Java
false
false
1,396
java
package com.leomara.cursomc.domain; import javax.persistence.*; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Objects; @Entity public class Categoria implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private String nome; @ManyToMany(mappedBy = "categorias") private List<Produto> produtos = new ArrayList<>(); public Categoria(){} public Categoria(Integer id, String nome) { this.id = id; this.nome = nome; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public List<Produto> getProdutos() { return produtos; } public void setProdutos(List<Produto> produtos) { this.produtos = produtos; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Categoria categoria = (Categoria) o; return Objects.equals(getId(), categoria.getId()); } @Override public int hashCode() { return Objects.hash(getId()); } }
57e76092d941df14616b698c70d932bc1c6fbf86
3da2c6544edc8934125763550c914a13112f2941
/sources/com/google/android/material/chip/ChipDrawable.java
7692e751fb67c123ee52b7843871ef123546c4ae
[]
no_license
poloyacero/arduino-pn532-android-hce
a140802fc00baa3049828cb80a611cf1145377ff
5aa812baa2d1bc7089ac6ca321b0c2806500caab
refs/heads/master
2023-02-28T11:16:17.134995
2021-02-04T15:08:31
2021-02-04T15:08:31
335,988,326
1
0
null
null
null
null
UTF-8
Java
false
false
54,963
java
package com.google.android.material.chip; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PointF; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.text.TextPaint; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Xml; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.ActivityChooserView; import androidx.core.content.res.ResourcesCompat; import androidx.core.graphics.ColorUtils; import androidx.core.graphics.drawable.DrawableCompat; import androidx.core.graphics.drawable.TintAwareDrawable; import androidx.core.internal.view.SupportMenu; import androidx.core.text.BidiFormatter; import androidx.core.view.ViewCompat; import com.example.application.BuildConfig; import com.google.android.material.R; import com.google.android.material.animation.MotionSpec; import com.google.android.material.canvas.CanvasCompat; import com.google.android.material.drawable.DrawableUtils; import com.google.android.material.internal.ThemeEnforcement; import com.google.android.material.resources.MaterialResources; import com.google.android.material.resources.TextAppearance; import com.google.android.material.ripple.RippleUtils; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.Arrays; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; public class ChipDrawable extends Drawable implements TintAwareDrawable, Drawable.Callback { private static final boolean DEBUG = false; private static final int[] DEFAULT_STATE = {16842910}; private static final String NAMESPACE_APP = "http://schemas.android.com/apk/res-auto"; private int alpha = 255; private boolean checkable; private Drawable checkedIcon; private boolean checkedIconVisible; private ColorStateList chipBackgroundColor; private float chipCornerRadius; private float chipEndPadding; private Drawable chipIcon; private float chipIconSize; private ColorStateList chipIconTint; private boolean chipIconVisible; private float chipMinHeight; private final Paint chipPaint = new Paint(1); private float chipStartPadding; private ColorStateList chipStrokeColor; private float chipStrokeWidth; private Drawable closeIcon; private CharSequence closeIconContentDescription; private float closeIconEndPadding; private float closeIconSize; private float closeIconStartPadding; private int[] closeIconStateSet; private ColorStateList closeIconTint; private boolean closeIconVisible; private ColorFilter colorFilter; private ColorStateList compatRippleColor; private final Context context; private boolean currentChecked; private int currentChipBackgroundColor; private int currentChipStrokeColor; private int currentCompatRippleColor; private int currentTextColor; private int currentTint; private final Paint debugPaint; private WeakReference<Delegate> delegate; private final ResourcesCompat.FontCallback fontCallback = new ResourcesCompat.FontCallback() { /* class com.google.android.material.chip.ChipDrawable.AnonymousClass1 */ @Override // androidx.core.content.res.ResourcesCompat.FontCallback public void onFontRetrieved(Typeface typeface) { ChipDrawable.this.textWidthDirty = true; ChipDrawable.this.onSizeChange(); ChipDrawable.this.invalidateSelf(); } @Override // androidx.core.content.res.ResourcesCompat.FontCallback public void onFontRetrievalFailed(int reason) { } }; private final Paint.FontMetrics fontMetrics = new Paint.FontMetrics(); private MotionSpec hideMotionSpec; private float iconEndPadding; private float iconStartPadding; private int maxWidth; private final PointF pointF = new PointF(); private CharSequence rawText; private final RectF rectF = new RectF(); private ColorStateList rippleColor; private boolean shouldDrawText; private MotionSpec showMotionSpec; private TextAppearance textAppearance; private float textEndPadding; private final TextPaint textPaint = new TextPaint(1); private float textStartPadding; private float textWidth; private boolean textWidthDirty; private ColorStateList tint; private PorterDuffColorFilter tintFilter; private PorterDuff.Mode tintMode = PorterDuff.Mode.SRC_IN; private TextUtils.TruncateAt truncateAt; private CharSequence unicodeWrappedText; private boolean useCompatRipple; public interface Delegate { void onChipDrawableSizeChange(); } public static ChipDrawable createFromAttributes(Context context2, AttributeSet attrs, int defStyleAttr, int defStyleRes) { ChipDrawable chip = new ChipDrawable(context2); chip.loadFromAttributes(attrs, defStyleAttr, defStyleRes); return chip; } public static ChipDrawable createFromResource(Context context2, int id) { int type; try { XmlPullParser parser = context2.getResources().getXml(id); do { type = parser.next(); if (type == 2) { break; } } while (type != 1); if (type != 2) { throw new XmlPullParserException("No start tag found"); } else if (TextUtils.equals(parser.getName(), "chip")) { AttributeSet attrs = Xml.asAttributeSet(parser); int style = attrs.getStyleAttribute(); if (style == 0) { style = R.style.Widget_MaterialComponents_Chip_Entry; } return createFromAttributes(context2, attrs, R.attr.chipStandaloneStyle, style); } else { throw new XmlPullParserException("Must have a <chip> start tag"); } } catch (IOException | XmlPullParserException e) { Resources.NotFoundException exception = new Resources.NotFoundException("Can't load chip resource ID #0x" + Integer.toHexString(id)); exception.initCause(e); throw exception; } } private ChipDrawable(Context context2) { Paint paint = null; this.delegate = new WeakReference<>(null); this.textWidthDirty = true; this.context = context2; this.rawText = BuildConfig.FLAVOR; this.textPaint.density = context2.getResources().getDisplayMetrics().density; this.debugPaint = null; if (0 != 0) { paint.setStyle(Paint.Style.STROKE); } setState(DEFAULT_STATE); setCloseIconState(DEFAULT_STATE); this.shouldDrawText = true; } private void loadFromAttributes(AttributeSet attrs, int defStyleAttr, int defStyleRes) { TypedArray a = ThemeEnforcement.obtainStyledAttributes(this.context, attrs, R.styleable.Chip, defStyleAttr, defStyleRes, new int[0]); setChipBackgroundColor(MaterialResources.getColorStateList(this.context, a, R.styleable.Chip_chipBackgroundColor)); setChipMinHeight(a.getDimension(R.styleable.Chip_chipMinHeight, 0.0f)); setChipCornerRadius(a.getDimension(R.styleable.Chip_chipCornerRadius, 0.0f)); setChipStrokeColor(MaterialResources.getColorStateList(this.context, a, R.styleable.Chip_chipStrokeColor)); setChipStrokeWidth(a.getDimension(R.styleable.Chip_chipStrokeWidth, 0.0f)); setRippleColor(MaterialResources.getColorStateList(this.context, a, R.styleable.Chip_rippleColor)); setText(a.getText(R.styleable.Chip_android_text)); setTextAppearance(MaterialResources.getTextAppearance(this.context, a, R.styleable.Chip_android_textAppearance)); int ellipsize = a.getInt(R.styleable.Chip_android_ellipsize, 0); if (ellipsize == 1) { setEllipsize(TextUtils.TruncateAt.START); } else if (ellipsize == 2) { setEllipsize(TextUtils.TruncateAt.MIDDLE); } else if (ellipsize == 3) { setEllipsize(TextUtils.TruncateAt.END); } setChipIconVisible(a.getBoolean(R.styleable.Chip_chipIconVisible, false)); if (!(attrs == null || attrs.getAttributeValue(NAMESPACE_APP, "chipIconEnabled") == null || attrs.getAttributeValue(NAMESPACE_APP, "chipIconVisible") != null)) { setChipIconVisible(a.getBoolean(R.styleable.Chip_chipIconEnabled, false)); } setChipIcon(MaterialResources.getDrawable(this.context, a, R.styleable.Chip_chipIcon)); setChipIconTint(MaterialResources.getColorStateList(this.context, a, R.styleable.Chip_chipIconTint)); setChipIconSize(a.getDimension(R.styleable.Chip_chipIconSize, 0.0f)); setCloseIconVisible(a.getBoolean(R.styleable.Chip_closeIconVisible, false)); if (!(attrs == null || attrs.getAttributeValue(NAMESPACE_APP, "closeIconEnabled") == null || attrs.getAttributeValue(NAMESPACE_APP, "closeIconVisible") != null)) { setCloseIconVisible(a.getBoolean(R.styleable.Chip_closeIconEnabled, false)); } setCloseIcon(MaterialResources.getDrawable(this.context, a, R.styleable.Chip_closeIcon)); setCloseIconTint(MaterialResources.getColorStateList(this.context, a, R.styleable.Chip_closeIconTint)); setCloseIconSize(a.getDimension(R.styleable.Chip_closeIconSize, 0.0f)); setCheckable(a.getBoolean(R.styleable.Chip_android_checkable, false)); setCheckedIconVisible(a.getBoolean(R.styleable.Chip_checkedIconVisible, false)); if (!(attrs == null || attrs.getAttributeValue(NAMESPACE_APP, "checkedIconEnabled") == null || attrs.getAttributeValue(NAMESPACE_APP, "checkedIconVisible") != null)) { setCheckedIconVisible(a.getBoolean(R.styleable.Chip_checkedIconEnabled, false)); } setCheckedIcon(MaterialResources.getDrawable(this.context, a, R.styleable.Chip_checkedIcon)); setShowMotionSpec(MotionSpec.createFromAttribute(this.context, a, R.styleable.Chip_showMotionSpec)); setHideMotionSpec(MotionSpec.createFromAttribute(this.context, a, R.styleable.Chip_hideMotionSpec)); setChipStartPadding(a.getDimension(R.styleable.Chip_chipStartPadding, 0.0f)); setIconStartPadding(a.getDimension(R.styleable.Chip_iconStartPadding, 0.0f)); setIconEndPadding(a.getDimension(R.styleable.Chip_iconEndPadding, 0.0f)); setTextStartPadding(a.getDimension(R.styleable.Chip_textStartPadding, 0.0f)); setTextEndPadding(a.getDimension(R.styleable.Chip_textEndPadding, 0.0f)); setCloseIconStartPadding(a.getDimension(R.styleable.Chip_closeIconStartPadding, 0.0f)); setCloseIconEndPadding(a.getDimension(R.styleable.Chip_closeIconEndPadding, 0.0f)); setChipEndPadding(a.getDimension(R.styleable.Chip_chipEndPadding, 0.0f)); setMaxWidth(a.getDimensionPixelSize(R.styleable.Chip_android_maxWidth, ActivityChooserView.ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED)); a.recycle(); } public void setUseCompatRipple(boolean useCompatRipple2) { if (this.useCompatRipple != useCompatRipple2) { this.useCompatRipple = useCompatRipple2; updateCompatRippleColor(); onStateChange(getState()); } } public boolean getUseCompatRipple() { return this.useCompatRipple; } public void setDelegate(Delegate delegate2) { this.delegate = new WeakReference<>(delegate2); } /* access modifiers changed from: protected */ public void onSizeChange() { Delegate delegate2 = this.delegate.get(); if (delegate2 != null) { delegate2.onChipDrawableSizeChange(); } } public void getChipTouchBounds(RectF bounds) { calculateChipTouchBounds(getBounds(), bounds); } public void getCloseIconTouchBounds(RectF bounds) { calculateCloseIconTouchBounds(getBounds(), bounds); } public int getIntrinsicWidth() { return Math.min(Math.round(this.chipStartPadding + calculateChipIconWidth() + this.textStartPadding + getTextWidth() + this.textEndPadding + calculateCloseIconWidth() + this.chipEndPadding), this.maxWidth); } public int getIntrinsicHeight() { return (int) this.chipMinHeight; } private boolean showsChipIcon() { return this.chipIconVisible && this.chipIcon != null; } private boolean showsCheckedIcon() { return this.checkedIconVisible && this.checkedIcon != null && this.currentChecked; } private boolean showsCloseIcon() { return this.closeIconVisible && this.closeIcon != null; } private boolean canShowCheckedIcon() { return this.checkedIconVisible && this.checkedIcon != null && this.checkable; } /* access modifiers changed from: package-private */ public float calculateChipIconWidth() { if (showsChipIcon() || showsCheckedIcon()) { return this.iconStartPadding + this.chipIconSize + this.iconEndPadding; } return 0.0f; } private float getTextWidth() { if (!this.textWidthDirty) { return this.textWidth; } float calculateTextWidth = calculateTextWidth(this.unicodeWrappedText); this.textWidth = calculateTextWidth; this.textWidthDirty = false; return calculateTextWidth; } private float calculateTextWidth(CharSequence charSequence) { if (charSequence == null) { return 0.0f; } return this.textPaint.measureText(charSequence, 0, charSequence.length()); } private float calculateCloseIconWidth() { if (showsCloseIcon()) { return this.closeIconStartPadding + this.closeIconSize + this.closeIconEndPadding; } return 0.0f; } public void draw(Canvas canvas) { Rect bounds = getBounds(); if (!bounds.isEmpty() && getAlpha() != 0) { int saveCount = 0; if (this.alpha < 255) { saveCount = CanvasCompat.saveLayerAlpha(canvas, (float) bounds.left, (float) bounds.top, (float) bounds.right, (float) bounds.bottom, this.alpha); } drawChipBackground(canvas, bounds); drawChipStroke(canvas, bounds); drawCompatRipple(canvas, bounds); drawChipIcon(canvas, bounds); drawCheckedIcon(canvas, bounds); if (this.shouldDrawText) { drawText(canvas, bounds); } drawCloseIcon(canvas, bounds); drawDebug(canvas, bounds); if (this.alpha < 255) { canvas.restoreToCount(saveCount); } } } private void drawChipBackground(Canvas canvas, Rect bounds) { this.chipPaint.setColor(this.currentChipBackgroundColor); this.chipPaint.setStyle(Paint.Style.FILL); this.chipPaint.setColorFilter(getTintColorFilter()); this.rectF.set(bounds); RectF rectF2 = this.rectF; float f = this.chipCornerRadius; canvas.drawRoundRect(rectF2, f, f, this.chipPaint); } private void drawChipStroke(Canvas canvas, Rect bounds) { if (this.chipStrokeWidth > 0.0f) { this.chipPaint.setColor(this.currentChipStrokeColor); this.chipPaint.setStyle(Paint.Style.STROKE); this.chipPaint.setColorFilter(getTintColorFilter()); this.rectF.set(((float) bounds.left) + (this.chipStrokeWidth / 2.0f), ((float) bounds.top) + (this.chipStrokeWidth / 2.0f), ((float) bounds.right) - (this.chipStrokeWidth / 2.0f), ((float) bounds.bottom) - (this.chipStrokeWidth / 2.0f)); float strokeCornerRadius = this.chipCornerRadius - (this.chipStrokeWidth / 2.0f); canvas.drawRoundRect(this.rectF, strokeCornerRadius, strokeCornerRadius, this.chipPaint); } } private void drawCompatRipple(Canvas canvas, Rect bounds) { this.chipPaint.setColor(this.currentCompatRippleColor); this.chipPaint.setStyle(Paint.Style.FILL); this.rectF.set(bounds); RectF rectF2 = this.rectF; float f = this.chipCornerRadius; canvas.drawRoundRect(rectF2, f, f, this.chipPaint); } private void drawChipIcon(Canvas canvas, Rect bounds) { if (showsChipIcon()) { calculateChipIconBounds(bounds, this.rectF); float tx = this.rectF.left; float ty = this.rectF.top; canvas.translate(tx, ty); this.chipIcon.setBounds(0, 0, (int) this.rectF.width(), (int) this.rectF.height()); this.chipIcon.draw(canvas); canvas.translate(-tx, -ty); } } private void drawCheckedIcon(Canvas canvas, Rect bounds) { if (showsCheckedIcon()) { calculateChipIconBounds(bounds, this.rectF); float tx = this.rectF.left; float ty = this.rectF.top; canvas.translate(tx, ty); this.checkedIcon.setBounds(0, 0, (int) this.rectF.width(), (int) this.rectF.height()); this.checkedIcon.draw(canvas); canvas.translate(-tx, -ty); } } private void drawText(Canvas canvas, Rect bounds) { if (this.unicodeWrappedText != null) { Paint.Align align = calculateTextOriginAndAlignment(bounds, this.pointF); calculateTextBounds(bounds, this.rectF); if (this.textAppearance != null) { this.textPaint.drawableState = getState(); this.textAppearance.updateDrawState(this.context, this.textPaint, this.fontCallback); } this.textPaint.setTextAlign(align); boolean clip = Math.round(getTextWidth()) > Math.round(this.rectF.width()); int saveCount = 0; if (clip) { saveCount = canvas.save(); canvas.clipRect(this.rectF); } CharSequence finalText = this.unicodeWrappedText; if (clip && this.truncateAt != null) { finalText = TextUtils.ellipsize(this.unicodeWrappedText, this.textPaint, this.rectF.width(), this.truncateAt); } canvas.drawText(finalText, 0, finalText.length(), this.pointF.x, this.pointF.y, this.textPaint); if (clip) { canvas.restoreToCount(saveCount); } } } private void drawCloseIcon(Canvas canvas, Rect bounds) { if (showsCloseIcon()) { calculateCloseIconBounds(bounds, this.rectF); float tx = this.rectF.left; float ty = this.rectF.top; canvas.translate(tx, ty); this.closeIcon.setBounds(0, 0, (int) this.rectF.width(), (int) this.rectF.height()); this.closeIcon.draw(canvas); canvas.translate(-tx, -ty); } } private void drawDebug(Canvas canvas, Rect bounds) { Paint paint = this.debugPaint; if (paint != null) { paint.setColor(ColorUtils.setAlphaComponent(ViewCompat.MEASURED_STATE_MASK, 127)); canvas.drawRect(bounds, this.debugPaint); if (showsChipIcon() || showsCheckedIcon()) { calculateChipIconBounds(bounds, this.rectF); canvas.drawRect(this.rectF, this.debugPaint); } if (this.unicodeWrappedText != null) { canvas.drawLine((float) bounds.left, bounds.exactCenterY(), (float) bounds.right, bounds.exactCenterY(), this.debugPaint); } if (showsCloseIcon()) { calculateCloseIconBounds(bounds, this.rectF); canvas.drawRect(this.rectF, this.debugPaint); } this.debugPaint.setColor(ColorUtils.setAlphaComponent(SupportMenu.CATEGORY_MASK, 127)); calculateChipTouchBounds(bounds, this.rectF); canvas.drawRect(this.rectF, this.debugPaint); this.debugPaint.setColor(ColorUtils.setAlphaComponent(-16711936, 127)); calculateCloseIconTouchBounds(bounds, this.rectF); canvas.drawRect(this.rectF, this.debugPaint); } } private void calculateChipIconBounds(Rect bounds, RectF outBounds) { outBounds.setEmpty(); if (showsChipIcon() || showsCheckedIcon()) { float offsetFromStart = this.chipStartPadding + this.iconStartPadding; if (DrawableCompat.getLayoutDirection(this) == 0) { outBounds.left = ((float) bounds.left) + offsetFromStart; outBounds.right = outBounds.left + this.chipIconSize; } else { outBounds.right = ((float) bounds.right) - offsetFromStart; outBounds.left = outBounds.right - this.chipIconSize; } outBounds.top = bounds.exactCenterY() - (this.chipIconSize / 2.0f); outBounds.bottom = outBounds.top + this.chipIconSize; } } /* access modifiers changed from: package-private */ public Paint.Align calculateTextOriginAndAlignment(Rect bounds, PointF pointF2) { pointF2.set(0.0f, 0.0f); Paint.Align align = Paint.Align.LEFT; if (this.unicodeWrappedText != null) { float offsetFromStart = this.chipStartPadding + calculateChipIconWidth() + this.textStartPadding; if (DrawableCompat.getLayoutDirection(this) == 0) { pointF2.x = ((float) bounds.left) + offsetFromStart; align = Paint.Align.LEFT; } else { pointF2.x = ((float) bounds.right) - offsetFromStart; align = Paint.Align.RIGHT; } pointF2.y = ((float) bounds.centerY()) - calculateTextCenterFromBaseline(); } return align; } private float calculateTextCenterFromBaseline() { this.textPaint.getFontMetrics(this.fontMetrics); return (this.fontMetrics.descent + this.fontMetrics.ascent) / 2.0f; } private void calculateTextBounds(Rect bounds, RectF outBounds) { outBounds.setEmpty(); if (this.unicodeWrappedText != null) { float offsetFromStart = this.chipStartPadding + calculateChipIconWidth() + this.textStartPadding; float offsetFromEnd = this.chipEndPadding + calculateCloseIconWidth() + this.textEndPadding; if (DrawableCompat.getLayoutDirection(this) == 0) { outBounds.left = ((float) bounds.left) + offsetFromStart; outBounds.right = ((float) bounds.right) - offsetFromEnd; } else { outBounds.left = ((float) bounds.left) + offsetFromEnd; outBounds.right = ((float) bounds.right) - offsetFromStart; } outBounds.top = (float) bounds.top; outBounds.bottom = (float) bounds.bottom; } } private void calculateCloseIconBounds(Rect bounds, RectF outBounds) { outBounds.setEmpty(); if (showsCloseIcon()) { float offsetFromEnd = this.chipEndPadding + this.closeIconEndPadding; if (DrawableCompat.getLayoutDirection(this) == 0) { outBounds.right = ((float) bounds.right) - offsetFromEnd; outBounds.left = outBounds.right - this.closeIconSize; } else { outBounds.left = ((float) bounds.left) + offsetFromEnd; outBounds.right = outBounds.left + this.closeIconSize; } outBounds.top = bounds.exactCenterY() - (this.closeIconSize / 2.0f); outBounds.bottom = outBounds.top + this.closeIconSize; } } private void calculateChipTouchBounds(Rect bounds, RectF outBounds) { outBounds.set(bounds); if (showsCloseIcon()) { float offsetFromEnd = this.chipEndPadding + this.closeIconEndPadding + this.closeIconSize + this.closeIconStartPadding + this.textEndPadding; if (DrawableCompat.getLayoutDirection(this) == 0) { outBounds.right = ((float) bounds.right) - offsetFromEnd; } else { outBounds.left = ((float) bounds.left) + offsetFromEnd; } } } private void calculateCloseIconTouchBounds(Rect bounds, RectF outBounds) { outBounds.setEmpty(); if (showsCloseIcon()) { float offsetFromEnd = this.chipEndPadding + this.closeIconEndPadding + this.closeIconSize + this.closeIconStartPadding + this.textEndPadding; if (DrawableCompat.getLayoutDirection(this) == 0) { outBounds.right = (float) bounds.right; outBounds.left = outBounds.right - offsetFromEnd; } else { outBounds.left = (float) bounds.left; outBounds.right = ((float) bounds.left) + offsetFromEnd; } outBounds.top = (float) bounds.top; outBounds.bottom = (float) bounds.bottom; } } public boolean isStateful() { return isStateful(this.chipBackgroundColor) || isStateful(this.chipStrokeColor) || (this.useCompatRipple && isStateful(this.compatRippleColor)) || isStateful(this.textAppearance) || canShowCheckedIcon() || isStateful(this.chipIcon) || isStateful(this.checkedIcon) || isStateful(this.tint); } public boolean isCloseIconStateful() { return isStateful(this.closeIcon); } public boolean setCloseIconState(int[] stateSet) { if (Arrays.equals(this.closeIconStateSet, stateSet)) { return false; } this.closeIconStateSet = stateSet; if (showsCloseIcon()) { return onStateChange(getState(), stateSet); } return false; } public int[] getCloseIconState() { return this.closeIconStateSet; } /* access modifiers changed from: protected */ public boolean onStateChange(int[] state) { return onStateChange(state, getCloseIconState()); } private boolean onStateChange(int[] chipState, int[] closeIconState) { boolean invalidate = super.onStateChange(chipState); boolean sizeChanged = false; ColorStateList colorStateList = this.chipBackgroundColor; int newTint = 0; int newChipBackgroundColor = colorStateList != null ? colorStateList.getColorForState(chipState, this.currentChipBackgroundColor) : 0; if (this.currentChipBackgroundColor != newChipBackgroundColor) { this.currentChipBackgroundColor = newChipBackgroundColor; invalidate = true; } ColorStateList colorStateList2 = this.chipStrokeColor; int newChipStrokeColor = colorStateList2 != null ? colorStateList2.getColorForState(chipState, this.currentChipStrokeColor) : 0; if (this.currentChipStrokeColor != newChipStrokeColor) { this.currentChipStrokeColor = newChipStrokeColor; invalidate = true; } ColorStateList colorStateList3 = this.compatRippleColor; int newCompatRippleColor = colorStateList3 != null ? colorStateList3.getColorForState(chipState, this.currentCompatRippleColor) : 0; if (this.currentCompatRippleColor != newCompatRippleColor) { this.currentCompatRippleColor = newCompatRippleColor; if (this.useCompatRipple) { invalidate = true; } } TextAppearance textAppearance2 = this.textAppearance; int newTextColor = (textAppearance2 == null || textAppearance2.textColor == null) ? 0 : this.textAppearance.textColor.getColorForState(chipState, this.currentTextColor); if (this.currentTextColor != newTextColor) { this.currentTextColor = newTextColor; invalidate = true; } boolean newChecked = hasState(getState(), 16842912) && this.checkable; if (!(this.currentChecked == newChecked || this.checkedIcon == null)) { float oldChipIconWidth = calculateChipIconWidth(); this.currentChecked = newChecked; invalidate = true; if (oldChipIconWidth != calculateChipIconWidth()) { sizeChanged = true; } } ColorStateList colorStateList4 = this.tint; if (colorStateList4 != null) { newTint = colorStateList4.getColorForState(chipState, this.currentTint); } if (this.currentTint != newTint) { this.currentTint = newTint; this.tintFilter = DrawableUtils.updateTintFilter(this, this.tint, this.tintMode); invalidate = true; } if (isStateful(this.chipIcon)) { invalidate |= this.chipIcon.setState(chipState); } if (isStateful(this.checkedIcon)) { invalidate |= this.checkedIcon.setState(chipState); } if (isStateful(this.closeIcon)) { invalidate |= this.closeIcon.setState(closeIconState); } if (invalidate) { invalidateSelf(); } if (sizeChanged) { onSizeChange(); } return invalidate; } private static boolean isStateful(ColorStateList colorStateList) { return colorStateList != null && colorStateList.isStateful(); } private static boolean isStateful(Drawable drawable) { return drawable != null && drawable.isStateful(); } private static boolean isStateful(TextAppearance textAppearance2) { return (textAppearance2 == null || textAppearance2.textColor == null || !textAppearance2.textColor.isStateful()) ? false : true; } public boolean onLayoutDirectionChanged(int layoutDirection) { boolean invalidate = super.onLayoutDirectionChanged(layoutDirection); if (showsChipIcon()) { invalidate |= this.chipIcon.setLayoutDirection(layoutDirection); } if (showsCheckedIcon()) { invalidate |= this.checkedIcon.setLayoutDirection(layoutDirection); } if (showsCloseIcon()) { invalidate |= this.closeIcon.setLayoutDirection(layoutDirection); } if (!invalidate) { return true; } invalidateSelf(); return true; } /* access modifiers changed from: protected */ public boolean onLevelChange(int level) { boolean invalidate = super.onLevelChange(level); if (showsChipIcon()) { invalidate |= this.chipIcon.setLevel(level); } if (showsCheckedIcon()) { invalidate |= this.checkedIcon.setLevel(level); } if (showsCloseIcon()) { invalidate |= this.closeIcon.setLevel(level); } if (invalidate) { invalidateSelf(); } return invalidate; } public boolean setVisible(boolean visible, boolean restart) { boolean invalidate = super.setVisible(visible, restart); if (showsChipIcon()) { invalidate |= this.chipIcon.setVisible(visible, restart); } if (showsCheckedIcon()) { invalidate |= this.checkedIcon.setVisible(visible, restart); } if (showsCloseIcon()) { invalidate |= this.closeIcon.setVisible(visible, restart); } if (invalidate) { invalidateSelf(); } return invalidate; } public void setAlpha(int alpha2) { if (this.alpha != alpha2) { this.alpha = alpha2; invalidateSelf(); } } public int getAlpha() { return this.alpha; } public void setColorFilter(ColorFilter colorFilter2) { if (this.colorFilter != colorFilter2) { this.colorFilter = colorFilter2; invalidateSelf(); } } public ColorFilter getColorFilter() { return this.colorFilter; } @Override // androidx.core.graphics.drawable.TintAwareDrawable public void setTintList(ColorStateList tint2) { if (this.tint != tint2) { this.tint = tint2; onStateChange(getState()); } } @Override // androidx.core.graphics.drawable.TintAwareDrawable public void setTintMode(PorterDuff.Mode tintMode2) { if (this.tintMode != tintMode2) { this.tintMode = tintMode2; this.tintFilter = DrawableUtils.updateTintFilter(this, this.tint, tintMode2); invalidateSelf(); } } public int getOpacity() { return -3; } public void getOutline(Outline outline) { Rect bounds = getBounds(); if (!bounds.isEmpty()) { outline.setRoundRect(bounds, this.chipCornerRadius); } else { outline.setRoundRect(0, 0, getIntrinsicWidth(), getIntrinsicHeight(), this.chipCornerRadius); } outline.setAlpha(((float) getAlpha()) / 255.0f); } public void invalidateDrawable(Drawable who) { Drawable.Callback callback = getCallback(); if (callback != null) { callback.invalidateDrawable(this); } } public void scheduleDrawable(Drawable who, Runnable what, long when) { Drawable.Callback callback = getCallback(); if (callback != null) { callback.scheduleDrawable(this, what, when); } } public void unscheduleDrawable(Drawable who, Runnable what) { Drawable.Callback callback = getCallback(); if (callback != null) { callback.unscheduleDrawable(this, what); } } private void unapplyChildDrawable(Drawable drawable) { if (drawable != null) { drawable.setCallback(null); } } private void applyChildDrawable(Drawable drawable) { if (drawable != null) { drawable.setCallback(this); DrawableCompat.setLayoutDirection(drawable, DrawableCompat.getLayoutDirection(this)); drawable.setLevel(getLevel()); drawable.setVisible(isVisible(), false); if (drawable == this.closeIcon) { if (drawable.isStateful()) { drawable.setState(getCloseIconState()); } DrawableCompat.setTintList(drawable, this.closeIconTint); } else if (drawable.isStateful()) { drawable.setState(getState()); } } } private ColorFilter getTintColorFilter() { ColorFilter colorFilter2 = this.colorFilter; return colorFilter2 != null ? colorFilter2 : this.tintFilter; } private void updateCompatRippleColor() { this.compatRippleColor = this.useCompatRipple ? RippleUtils.convertToRippleDrawableColor(this.rippleColor) : null; } private static boolean hasState(int[] stateSet, int state) { if (stateSet == null) { return false; } for (int s : stateSet) { if (s == state) { return true; } } return false; } public ColorStateList getChipBackgroundColor() { return this.chipBackgroundColor; } public void setChipBackgroundColorResource(int id) { setChipBackgroundColor(AppCompatResources.getColorStateList(this.context, id)); } public void setChipBackgroundColor(ColorStateList chipBackgroundColor2) { if (this.chipBackgroundColor != chipBackgroundColor2) { this.chipBackgroundColor = chipBackgroundColor2; onStateChange(getState()); } } public float getChipMinHeight() { return this.chipMinHeight; } public void setChipMinHeightResource(int id) { setChipMinHeight(this.context.getResources().getDimension(id)); } public void setChipMinHeight(float chipMinHeight2) { if (this.chipMinHeight != chipMinHeight2) { this.chipMinHeight = chipMinHeight2; invalidateSelf(); onSizeChange(); } } public float getChipCornerRadius() { return this.chipCornerRadius; } public void setChipCornerRadiusResource(int id) { setChipCornerRadius(this.context.getResources().getDimension(id)); } public void setChipCornerRadius(float chipCornerRadius2) { if (this.chipCornerRadius != chipCornerRadius2) { this.chipCornerRadius = chipCornerRadius2; invalidateSelf(); } } public ColorStateList getChipStrokeColor() { return this.chipStrokeColor; } public void setChipStrokeColorResource(int id) { setChipStrokeColor(AppCompatResources.getColorStateList(this.context, id)); } public void setChipStrokeColor(ColorStateList chipStrokeColor2) { if (this.chipStrokeColor != chipStrokeColor2) { this.chipStrokeColor = chipStrokeColor2; onStateChange(getState()); } } public float getChipStrokeWidth() { return this.chipStrokeWidth; } public void setChipStrokeWidthResource(int id) { setChipStrokeWidth(this.context.getResources().getDimension(id)); } public void setChipStrokeWidth(float chipStrokeWidth2) { if (this.chipStrokeWidth != chipStrokeWidth2) { this.chipStrokeWidth = chipStrokeWidth2; this.chipPaint.setStrokeWidth(chipStrokeWidth2); invalidateSelf(); } } public ColorStateList getRippleColor() { return this.rippleColor; } public void setRippleColorResource(int id) { setRippleColor(AppCompatResources.getColorStateList(this.context, id)); } public void setRippleColor(ColorStateList rippleColor2) { if (this.rippleColor != rippleColor2) { this.rippleColor = rippleColor2; updateCompatRippleColor(); onStateChange(getState()); } } public CharSequence getText() { return this.rawText; } public void setTextResource(int id) { setText(this.context.getResources().getString(id)); } public void setText(CharSequence text) { if (text == null) { text = BuildConfig.FLAVOR; } if (this.rawText != text) { this.rawText = text; this.unicodeWrappedText = BidiFormatter.getInstance().unicodeWrap(text); this.textWidthDirty = true; invalidateSelf(); onSizeChange(); } } public TextAppearance getTextAppearance() { return this.textAppearance; } public void setTextAppearanceResource(int id) { setTextAppearance(new TextAppearance(this.context, id)); } public void setTextAppearance(TextAppearance textAppearance2) { if (this.textAppearance != textAppearance2) { this.textAppearance = textAppearance2; if (textAppearance2 != null) { textAppearance2.updateMeasureState(this.context, this.textPaint, this.fontCallback); this.textWidthDirty = true; } onStateChange(getState()); onSizeChange(); } } public TextUtils.TruncateAt getEllipsize() { return this.truncateAt; } public void setEllipsize(TextUtils.TruncateAt truncateAt2) { this.truncateAt = truncateAt2; } public boolean isChipIconVisible() { return this.chipIconVisible; } @Deprecated public boolean isChipIconEnabled() { return isChipIconVisible(); } public void setChipIconVisible(int id) { setChipIconVisible(this.context.getResources().getBoolean(id)); } public void setChipIconVisible(boolean chipIconVisible2) { if (this.chipIconVisible != chipIconVisible2) { boolean oldShowsChipIcon = showsChipIcon(); this.chipIconVisible = chipIconVisible2; boolean newShowsChipIcon = showsChipIcon(); if (oldShowsChipIcon != newShowsChipIcon) { if (newShowsChipIcon) { applyChildDrawable(this.chipIcon); } else { unapplyChildDrawable(this.chipIcon); } invalidateSelf(); onSizeChange(); } } } @Deprecated public void setChipIconEnabledResource(int id) { setChipIconVisible(id); } @Deprecated public void setChipIconEnabled(boolean chipIconEnabled) { setChipIconVisible(chipIconEnabled); } public Drawable getChipIcon() { Drawable drawable = this.chipIcon; if (drawable != null) { return DrawableCompat.unwrap(drawable); } return null; } public void setChipIconResource(int id) { setChipIcon(AppCompatResources.getDrawable(this.context, id)); } public void setChipIcon(Drawable chipIcon2) { Drawable oldChipIcon = getChipIcon(); if (oldChipIcon != chipIcon2) { float oldChipIconWidth = calculateChipIconWidth(); this.chipIcon = chipIcon2 != null ? DrawableCompat.wrap(chipIcon2).mutate() : null; float newChipIconWidth = calculateChipIconWidth(); unapplyChildDrawable(oldChipIcon); if (showsChipIcon()) { applyChildDrawable(this.chipIcon); } invalidateSelf(); if (oldChipIconWidth != newChipIconWidth) { onSizeChange(); } } } public ColorStateList getChipIconTint() { return this.chipIconTint; } public void setChipIconTintResource(int id) { setChipIconTint(AppCompatResources.getColorStateList(this.context, id)); } public void setChipIconTint(ColorStateList chipIconTint2) { if (this.chipIconTint != chipIconTint2) { this.chipIconTint = chipIconTint2; if (showsChipIcon()) { DrawableCompat.setTintList(this.chipIcon, chipIconTint2); } onStateChange(getState()); } } public float getChipIconSize() { return this.chipIconSize; } public void setChipIconSizeResource(int id) { setChipIconSize(this.context.getResources().getDimension(id)); } public void setChipIconSize(float chipIconSize2) { if (this.chipIconSize != chipIconSize2) { float oldChipIconWidth = calculateChipIconWidth(); this.chipIconSize = chipIconSize2; float newChipIconWidth = calculateChipIconWidth(); invalidateSelf(); if (oldChipIconWidth != newChipIconWidth) { onSizeChange(); } } } public boolean isCloseIconVisible() { return this.closeIconVisible; } @Deprecated public boolean isCloseIconEnabled() { return isCloseIconVisible(); } public void setCloseIconVisible(int id) { setCloseIconVisible(this.context.getResources().getBoolean(id)); } public void setCloseIconVisible(boolean closeIconVisible2) { if (this.closeIconVisible != closeIconVisible2) { boolean oldShowsCloseIcon = showsCloseIcon(); this.closeIconVisible = closeIconVisible2; boolean newShowsCloseIcon = showsCloseIcon(); if (oldShowsCloseIcon != newShowsCloseIcon) { if (newShowsCloseIcon) { applyChildDrawable(this.closeIcon); } else { unapplyChildDrawable(this.closeIcon); } invalidateSelf(); onSizeChange(); } } } @Deprecated public void setCloseIconEnabledResource(int id) { setCloseIconVisible(id); } @Deprecated public void setCloseIconEnabled(boolean closeIconEnabled) { setCloseIconVisible(closeIconEnabled); } public Drawable getCloseIcon() { Drawable drawable = this.closeIcon; if (drawable != null) { return DrawableCompat.unwrap(drawable); } return null; } public void setCloseIconResource(int id) { setCloseIcon(AppCompatResources.getDrawable(this.context, id)); } public void setCloseIcon(Drawable closeIcon2) { Drawable oldCloseIcon = getCloseIcon(); if (oldCloseIcon != closeIcon2) { float oldCloseIconWidth = calculateCloseIconWidth(); this.closeIcon = closeIcon2 != null ? DrawableCompat.wrap(closeIcon2).mutate() : null; float newCloseIconWidth = calculateCloseIconWidth(); unapplyChildDrawable(oldCloseIcon); if (showsCloseIcon()) { applyChildDrawable(this.closeIcon); } invalidateSelf(); if (oldCloseIconWidth != newCloseIconWidth) { onSizeChange(); } } } public ColorStateList getCloseIconTint() { return this.closeIconTint; } public void setCloseIconTintResource(int id) { setCloseIconTint(AppCompatResources.getColorStateList(this.context, id)); } public void setCloseIconTint(ColorStateList closeIconTint2) { if (this.closeIconTint != closeIconTint2) { this.closeIconTint = closeIconTint2; if (showsCloseIcon()) { DrawableCompat.setTintList(this.closeIcon, closeIconTint2); } onStateChange(getState()); } } public float getCloseIconSize() { return this.closeIconSize; } public void setCloseIconSizeResource(int id) { setCloseIconSize(this.context.getResources().getDimension(id)); } public void setCloseIconSize(float closeIconSize2) { if (this.closeIconSize != closeIconSize2) { this.closeIconSize = closeIconSize2; invalidateSelf(); if (showsCloseIcon()) { onSizeChange(); } } } public void setCloseIconContentDescription(CharSequence closeIconContentDescription2) { if (this.closeIconContentDescription != closeIconContentDescription2) { this.closeIconContentDescription = BidiFormatter.getInstance().unicodeWrap(closeIconContentDescription2); invalidateSelf(); } } public CharSequence getCloseIconContentDescription() { return this.closeIconContentDescription; } public boolean isCheckable() { return this.checkable; } public void setCheckableResource(int id) { setCheckable(this.context.getResources().getBoolean(id)); } public void setCheckable(boolean checkable2) { if (this.checkable != checkable2) { this.checkable = checkable2; float oldChipIconWidth = calculateChipIconWidth(); if (!checkable2 && this.currentChecked) { this.currentChecked = false; } float newChipIconWidth = calculateChipIconWidth(); invalidateSelf(); if (oldChipIconWidth != newChipIconWidth) { onSizeChange(); } } } public boolean isCheckedIconVisible() { return this.checkedIconVisible; } @Deprecated public boolean isCheckedIconEnabled() { return isCheckedIconVisible(); } public void setCheckedIconVisible(int id) { setCheckedIconVisible(this.context.getResources().getBoolean(id)); } public void setCheckedIconVisible(boolean checkedIconVisible2) { if (this.checkedIconVisible != checkedIconVisible2) { boolean oldShowsCheckedIcon = showsCheckedIcon(); this.checkedIconVisible = checkedIconVisible2; boolean newShowsCheckedIcon = showsCheckedIcon(); if (oldShowsCheckedIcon != newShowsCheckedIcon) { if (newShowsCheckedIcon) { applyChildDrawable(this.checkedIcon); } else { unapplyChildDrawable(this.checkedIcon); } invalidateSelf(); onSizeChange(); } } } @Deprecated public void setCheckedIconEnabledResource(int id) { setCheckedIconVisible(this.context.getResources().getBoolean(id)); } @Deprecated public void setCheckedIconEnabled(boolean checkedIconEnabled) { setCheckedIconVisible(checkedIconEnabled); } public Drawable getCheckedIcon() { return this.checkedIcon; } public void setCheckedIconResource(int id) { setCheckedIcon(AppCompatResources.getDrawable(this.context, id)); } public void setCheckedIcon(Drawable checkedIcon2) { if (this.checkedIcon != checkedIcon2) { float oldChipIconWidth = calculateChipIconWidth(); this.checkedIcon = checkedIcon2; float newChipIconWidth = calculateChipIconWidth(); unapplyChildDrawable(this.checkedIcon); applyChildDrawable(this.checkedIcon); invalidateSelf(); if (oldChipIconWidth != newChipIconWidth) { onSizeChange(); } } } public MotionSpec getShowMotionSpec() { return this.showMotionSpec; } public void setShowMotionSpecResource(int id) { setShowMotionSpec(MotionSpec.createFromResource(this.context, id)); } public void setShowMotionSpec(MotionSpec showMotionSpec2) { this.showMotionSpec = showMotionSpec2; } public MotionSpec getHideMotionSpec() { return this.hideMotionSpec; } public void setHideMotionSpecResource(int id) { setHideMotionSpec(MotionSpec.createFromResource(this.context, id)); } public void setHideMotionSpec(MotionSpec hideMotionSpec2) { this.hideMotionSpec = hideMotionSpec2; } public float getChipStartPadding() { return this.chipStartPadding; } public void setChipStartPaddingResource(int id) { setChipStartPadding(this.context.getResources().getDimension(id)); } public void setChipStartPadding(float chipStartPadding2) { if (this.chipStartPadding != chipStartPadding2) { this.chipStartPadding = chipStartPadding2; invalidateSelf(); onSizeChange(); } } public float getIconStartPadding() { return this.iconStartPadding; } public void setIconStartPaddingResource(int id) { setIconStartPadding(this.context.getResources().getDimension(id)); } public void setIconStartPadding(float iconStartPadding2) { if (this.iconStartPadding != iconStartPadding2) { float oldChipIconWidth = calculateChipIconWidth(); this.iconStartPadding = iconStartPadding2; float newChipIconWidth = calculateChipIconWidth(); invalidateSelf(); if (oldChipIconWidth != newChipIconWidth) { onSizeChange(); } } } public float getIconEndPadding() { return this.iconEndPadding; } public void setIconEndPaddingResource(int id) { setIconEndPadding(this.context.getResources().getDimension(id)); } public void setIconEndPadding(float iconEndPadding2) { if (this.iconEndPadding != iconEndPadding2) { float oldChipIconWidth = calculateChipIconWidth(); this.iconEndPadding = iconEndPadding2; float newChipIconWidth = calculateChipIconWidth(); invalidateSelf(); if (oldChipIconWidth != newChipIconWidth) { onSizeChange(); } } } public float getTextStartPadding() { return this.textStartPadding; } public void setTextStartPaddingResource(int id) { setTextStartPadding(this.context.getResources().getDimension(id)); } public void setTextStartPadding(float textStartPadding2) { if (this.textStartPadding != textStartPadding2) { this.textStartPadding = textStartPadding2; invalidateSelf(); onSizeChange(); } } public float getTextEndPadding() { return this.textEndPadding; } public void setTextEndPaddingResource(int id) { setTextEndPadding(this.context.getResources().getDimension(id)); } public void setTextEndPadding(float textEndPadding2) { if (this.textEndPadding != textEndPadding2) { this.textEndPadding = textEndPadding2; invalidateSelf(); onSizeChange(); } } public float getCloseIconStartPadding() { return this.closeIconStartPadding; } public void setCloseIconStartPaddingResource(int id) { setCloseIconStartPadding(this.context.getResources().getDimension(id)); } public void setCloseIconStartPadding(float closeIconStartPadding2) { if (this.closeIconStartPadding != closeIconStartPadding2) { this.closeIconStartPadding = closeIconStartPadding2; invalidateSelf(); if (showsCloseIcon()) { onSizeChange(); } } } public float getCloseIconEndPadding() { return this.closeIconEndPadding; } public void setCloseIconEndPaddingResource(int id) { setCloseIconEndPadding(this.context.getResources().getDimension(id)); } public void setCloseIconEndPadding(float closeIconEndPadding2) { if (this.closeIconEndPadding != closeIconEndPadding2) { this.closeIconEndPadding = closeIconEndPadding2; invalidateSelf(); if (showsCloseIcon()) { onSizeChange(); } } } public float getChipEndPadding() { return this.chipEndPadding; } public void setChipEndPaddingResource(int id) { setChipEndPadding(this.context.getResources().getDimension(id)); } public void setChipEndPadding(float chipEndPadding2) { if (this.chipEndPadding != chipEndPadding2) { this.chipEndPadding = chipEndPadding2; invalidateSelf(); onSizeChange(); } } public int getMaxWidth() { return this.maxWidth; } public void setMaxWidth(int maxWidth2) { this.maxWidth = maxWidth2; } /* access modifiers changed from: package-private */ public boolean shouldDrawText() { return this.shouldDrawText; } /* access modifiers changed from: package-private */ public void setShouldDrawText(boolean shouldDrawText2) { this.shouldDrawText = shouldDrawText2; } }
2b4faf32d19b9ee174b5298364431382e0a85fb5
46b42d43a86f2c4d8616a76ffb1c48dc63870f71
/coursera/algs4part1/trees/Node.java
49a264542c987d9147c0decd30e00ebaad465d71
[]
no_license
EvgenyBondarenko/algs
9f5cd88c598c1499ed1af934885e3af76d16b604
540af1030d0b51b2c2232552a20edb76e6fe47d8
refs/heads/master
2021-01-17T08:38:57.885352
2020-04-15T17:20:47
2020-04-15T17:20:47
23,621,187
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
class Node<K extends Comparable<K>, V> { K key; V value; Node<K, V> left; Node<K, V> right; public Node(K key, V value) { this.key = key; this.value = value; } public static void main(String[] args) { Node<String, String> root = new Node<>("abc", null); root.left = new Node<>("cdeee", null); root.right = new Node<>("ff", null); root.left.left = new Node<>("gh", null); root.left.right = new Node<>("ijklmno", null); root.right.right = new Node<>("pq", null); root.right.right.left = new Node<>("llll", null); System.out.println(root); } public StringBuilder toString(StringBuilder prefix, boolean isTail, StringBuilder sb) { if (right != null) { right.toString(new StringBuilder().append(prefix).append(isTail ? "│ " : " "), false, sb); } sb.append(prefix).append(isTail ? "└── " : "┌── ").append(key.toString()).append("\n"); if (left != null) { left.toString(new StringBuilder().append(prefix).append(isTail ? " " : "│ "), true, sb); } return sb; } @Override public String toString() { return this.toString(new StringBuilder(), true, new StringBuilder()).toString(); } }
62d4187a8e4ad413bb47dfa9041c384fc5a19b46
e0ba7ddeb226fe452e5114ce2b8b94ddb4b97b3e
/app/src/main/java/com/zhuye/ershoufang/wxapi/WXEntryActivity.java
b7fbe75be3cac47a4891ffffd35cd4e01f90c71e
[]
no_license
jingzhixb/trunk
5337a676f9eb91888171bd06f7a657e72cb05636
e9201b355323c86db5b3a22a8e869b1243b00763
refs/heads/master
2020-03-28T01:34:08.005377
2018-09-05T12:34:05
2018-09-05T12:34:05
147,514,146
0
1
null
null
null
null
UTF-8
Java
false
false
214
java
package com.zhuye.ershoufang.wxapi; import com.umeng.socialize.weixin.view.WXCallbackActivity; /** * Created by Administrator on 2018/3/29 0029. */ public class WXEntryActivity extends WXCallbackActivity { }
[ "1390056147qq.com" ]
1390056147qq.com
b969a43c63f6fdddd53db3c868827174a1937441
5f13c94194459ef7d61b9d416bfc61abdfeb536f
/APPLICATION/SpringSecurityJdbcCustomUserDetailsAnnotatonExample/src/main/java/com/espark/adarsh/entity/UserRole.java
7abd97dd5a9f0d0ba5b0cd8f9f18ee38ae9e410d
[]
no_license
adarshkumarsingh83/spring_security
092cd3a7385cf2abfdf8e165ec08995de30cd835
8d655c1e0ae80ad3d1b1fe6a400da92af8032c08
refs/heads/master
2023-02-03T06:17:55.941921
2023-01-24T05:33:26
2023-01-24T05:33:26
46,787,876
2
3
null
2023-01-23T21:06:45
2015-11-24T11:37:09
Java
UTF-8
Java
false
false
2,823
java
/* * Copyright (c) Sourcen Inc. 2004-2012 * All rights reserved. */ /* * Copyright (c) 2015 Espark And ©Adarsh Development Services @copyright All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * - Neither the name of Espark nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package com.espark.adarsh.entity; /** * @author Adarsh Kumar * @author $LastChangedBy: Adarsh Kumar$ * @version $Revision: 0001 $, $Date:: 1/1/10 0:00 AM#$ * @Espark @copyright all right reserve */ public final class UserRole { private Long id; private Long userId; private String name; public UserRole() { } public UserRole(Long id) { this.id = id; } public UserRole(String name) { this.name = name; } public UserRole(Long id, Long userId, String name) { this.id = id; this.userId = userId; this.name = name; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getUserId() { return userId; } public void setUserId(Long userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "UserRole{" + "name='" + name + '\'' + '}'; } }
ddc85c58157049221147cea58fbb8989a651dcd2
f46e5113682bfed994d09d6ff29c6b451ce3e806
/src/main/java/org/smart4j/chapter2/controller/CustomerShowServlet.java
ccc8afa00d661afc1a97b422923ada2b2d119539
[]
no_license
leorenyp/chapter2
57da36890422902990cf0cef685cc3c7c53cae6c
e9dd00aded340b8a296e6186aad85dd861e57d1e
refs/heads/master
2020-03-22T10:20:36.289363
2016-11-28T13:06:43
2016-11-28T13:06:43
74,375,712
0
0
null
null
null
null
UTF-8
Java
false
false
614
java
package org.smart4j.chapter2.controller; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; /** * Created by renyp on 2016/11/21. */ @WebServlet("/customer_show") public class CustomerShowServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { super.doGet(req, resp); //// TODO: 2016/11/21 } }
c63fa6afa6082c8e970ab01621c3b8b49e2b7eb6
05d0a9553358fbf159e566c403626de2718e17c9
/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
8bdc102892e99e7a6efc8a12365374db59c34d9f
[ "CC-BY-2.5", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "EPL-1.0", "Classpath-exception-2.0", "GCC-exception-3.1", "BSD-3-Clause", "CC-PDDC", "GPL-2.0-only", "CDDL-1.0", "MIT", "Apache-2.0", "LicenseRef-scancode-public-domain", "GPL-1.0-or-later", "LicenseRef-scancode-jdom", "LicenseRef-scancode-proprietary-license", "BSD-2-Clause-Views", "MPL-2.0-no-copyleft-exception", "MPL-2.0", "CC-BY-3.0", "AGPL-3.0-only", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "CDDL-1.1", "LicenseRef-scancode-protobuf", "LGPL-2.1-or-later", "LGPL-2.0-or-later", "LicenseRef-scancode-oracle-bcl-javase-javafx-2012", "LGPL-2.0-only", "LicenseRef-scancode-unknown" ]
permissive
hopshadoop/hops
d8baaf20bc418af460e582974839a3a9a72f173a
ed0d4de3dadbde5afa12899e703954aa67db7b3b
refs/heads/master
2023-08-31T20:36:31.212647
2023-08-28T15:31:37
2023-08-28T15:31:37
32,975,439
295
85
Apache-2.0
2023-09-05T09:19:57
2015-03-27T08:31:42
Java
UTF-8
Java
false
false
5,960
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.yarn.service.utils; import com.google.common.base.Charsets; import com.google.common.base.Preconditions; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.yarn.service.api.records.ConfigFormat; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.DumperOptions.FlowStyle; import org.yaml.snakeyaml.Yaml; import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.io.StringWriter; import java.nio.charset.StandardCharsets; import java.util.Properties; /** * Output a published configuration */ public abstract class PublishedConfigurationOutputter { private static final String COMMENTS = "Generated by Apache Slider"; protected final PublishedConfiguration owner; protected PublishedConfigurationOutputter(PublishedConfiguration owner) { this.owner = owner; } /** * Save the config to a destination file, in the format of this outputter * @param dest destination file * @throws IOException */ /* JDK7 public void save(File dest) throws IOException { try(FileOutputStream out = new FileOutputStream(dest)) { save(out); out.close(); } } */ public void save(File dest) throws IOException { FileUtils.writeStringToFile(dest, asString(), StandardCharsets.UTF_8); } /** * Save the content. The default saves the asString() value * to the output stream * @param out output stream * @throws IOException */ public void save(OutputStream out) throws IOException { IOUtils.write(asString(), out, Charsets.UTF_8); } /** * Convert to a string * @return the string form * @throws IOException */ public abstract String asString() throws IOException; /** * Create an outputter for the chosen format * @param format format enumeration * @param owner owning config * @return the outputter */ public static PublishedConfigurationOutputter createOutputter(ConfigFormat format, PublishedConfiguration owner) { Preconditions.checkNotNull(owner); switch (format) { case XML: case HADOOP_XML: return new XmlOutputter(owner); case PROPERTIES: return new PropertiesOutputter(owner); case JSON: return new JsonOutputter(owner); case ENV: return new EnvOutputter(owner); case TEMPLATE: return new TemplateOutputter(owner); case YAML: return new YamlOutputter(owner); default: throw new RuntimeException("Unsupported format :" + format); } } public static class XmlOutputter extends PublishedConfigurationOutputter { private final Configuration configuration; public XmlOutputter(PublishedConfiguration owner) { super(owner); configuration = owner.asConfiguration(); } @Override public void save(OutputStream out) throws IOException { configuration.writeXml(out); } @Override public String asString() throws IOException { return ConfigHelper.toXml(configuration); } public Configuration getConfiguration() { return configuration; } } public static class PropertiesOutputter extends PublishedConfigurationOutputter { private final Properties properties; public PropertiesOutputter(PublishedConfiguration owner) { super(owner); properties = owner.asProperties(); } @Override public void save(OutputStream out) throws IOException { properties.store(out, COMMENTS); } public String asString() throws IOException { StringWriter sw = new StringWriter(); properties.store(sw, COMMENTS); return sw.toString(); } } public static class JsonOutputter extends PublishedConfigurationOutputter { public JsonOutputter(PublishedConfiguration owner) { super(owner); } @Override public String asString() throws IOException { return owner.asJson(); } } public static class EnvOutputter extends PublishedConfigurationOutputter { public EnvOutputter(PublishedConfiguration owner) { super(owner); } @Override public String asString() throws IOException { if (!owner.entries.containsKey("content")) { throw new IOException("Configuration has no content field and cannot " + "be retrieved as type 'env'"); } String content = owner.entries.get("content"); return ConfigUtils.replaceProps(owner.entries, content); } } public static class TemplateOutputter extends EnvOutputter { public TemplateOutputter(PublishedConfiguration owner) { super(owner); } } public static class YamlOutputter extends PublishedConfigurationOutputter { private final Yaml yaml; public YamlOutputter(PublishedConfiguration owner) { super(owner); DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(FlowStyle.BLOCK); yaml = new Yaml(options); } public String asString() throws IOException { return yaml.dump(owner.entries); } } }
9ec386cf85cb11424a2206993023f82772519cf6
82ccfb8514fad9c32f40c4de6a5e8b3d11c67a9d
/app/src/main/java/org/communityboating/kioskclient/progress/validator/ProgressStateValueValidatorProgressStateContext.java
4c24c61daf70ca19b814b5a40a1fdc4bd95970f2
[]
no_license
community-boating/kiosk-client
e22afa945320ac751d041db27bd2c4d6e4d4c6bc
0ca898776346933a769c0cbc4213b9172ac39340
refs/heads/master
2022-07-23T00:45:38.755606
2022-07-15T01:52:28
2022-07-15T01:52:28
176,619,718
0
1
null
null
null
null
UTF-8
Java
false
false
315
java
package org.communityboating.kioskclient.progress.validator; import org.communityboating.kioskclient.progress.ProgressState; public abstract class ProgressStateValueValidatorProgressStateContext implements ProgressStateValueValidatorBase { abstract String isValueValid(String value, ProgressState context); }
8c8563514566bece16e570ab97c8ee3168bbb24d
6875f224c19924eb05a79642c1ada4b0afcc768f
/utils/Math.java
74a919015f07f07c4d0a3922bd385369ceaca48c
[]
no_license
AramSar/cs110_hw7
2035e63ae4a7f3cd63a27e9ebd2703569be8c8cb
f4e157daae002683d943a6fc189e25ac27efdb87
refs/heads/master
2021-08-22T09:02:51.878004
2017-11-29T21:03:44
2017-11-29T21:03:44
112,527,439
0
0
null
null
null
null
UTF-8
Java
false
false
307
java
package utils; public class Math { public static int factorial (int num) { if(num <= 0) return 1; return num * factorial(--num); } public static int factorialLoop (int num){ int fact = 1; for(int i = num; i > 0; i--) { fact *= i; } if(num == 0) return 1; return fact; } }
2454c6e39552496c96f504bd0683918b916cd9f0
b55259e1d1eb295595f7b585c1cdc0b4450dd950
/sangphpc00958_ProjectMini/src/main/java/sangphpc00958_ProjectMini/service/UploadService.java
d8dfc6278a9df5759ab0223f03e98804cf4f71d1
[]
no_license
PhamHoangSang2k/sangphpc00958_ProjectMini
000854f432af8789b902d7ccd226239da50f05ce
21afa75043372d1776d3af963cb4069b318abfc0
refs/heads/master
2023-07-28T07:46:18.592331
2021-09-08T08:53:01
2021-09-08T08:53:01
403,919,304
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
package sangphpc00958_ProjectMini.service; import java.io.File; import org.springframework.web.multipart.MultipartFile; public interface UploadService { File save(MultipartFile file, String folder); }
0517365dbe7dd9effecaa39b25d3671e8b473b52
ae3c3cd37144a39ac7559d23c791bb38cd8d1b10
/src/main/java/com/example/axon_test/ds/bean/in/ServiceInResponseParam.java
4c441351e4af2632b8908d30ae69f75fa174e4df
[]
no_license
espressox/axon_test
f4a3ab783a9a72034bdcd07dfc5e194bfc7deeca
9616cd0faf2aba4baa7816d6736c04ef3141c866
refs/heads/master
2023-07-15T10:19:53.381193
2021-08-31T03:36:29
2021-08-31T03:36:29
392,230,861
1
0
null
null
null
null
UTF-8
Java
false
false
1,250
java
package com.example.axon_test.ds.bean.in; import com.example.axon_test.ds.bean.Result; import com.example.axon_test.ds.bean.ResultBase; import com.example.axon_test.ds.bean.ResultSetter; /** * 请求的响应基类 */ public class ServiceInResponseParam extends ServiceInParam implements Result, ResultSetter { /** * 结果类 */ private final ResultBase result; /** * @param resultCode String * @param resultMsg String */ public ServiceInResponseParam(String resultCode, String resultMsg) { result = new ResultBase(resultCode, resultMsg); } @Override public String getResultCode() { return result.getResultCode(); } @Override public void setResultCode(String resultCode) { this.result.setResultCode(resultCode); } @Override public String getResultMsg() { return result.getResultMsg(); } @Override public void setResultMsg(String resultMsg) { result.setResultMsg(resultMsg); } @Override public boolean isSuccess() { return result != null && result.isSuccess(); } @Override public void setSuccess(boolean success) { this.result.setSuccess(success); } }
d06f6dea25ba70ef9694ccba3f1f0462aff82f0f
d002bfc0bd80a49e10f2d0dc02fffffe4d93b20f
/ddth-queue-core/src/test/java/com/github/ddth/pubsub/test/universal/idint/inmem/TestInmemPubSubMT.java
cc74b9f6ca59029d7e0cebccafa3d021bcc0d88a
[ "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
DDTH/ddth-queue
1b744bf64ea2d18d739a64dbb08121aea8e7d7b4
359257b80edd622b7791f0d3bee2123f6892b347
refs/heads/master
2023-08-19T13:54:50.837423
2019-07-24T18:55:52
2019-07-24T18:55:52
31,454,120
6
5
MIT
2022-09-22T17:29:46
2015-02-28T06:54:19
Java
UTF-8
Java
false
false
890
java
package com.github.ddth.pubsub.test.universal.idint.inmem; import com.github.ddth.pubsub.IPubSubHub; import com.github.ddth.pubsub.impl.universal.idint.UniversalInmemPubSubHub; import com.github.ddth.pubsub.test.universal.BasePubSubMultiThreadsTest; import junit.framework.Test; import junit.framework.TestSuite; /** * Test pub-sub functionality, multi-threads. */ public class TestInmemPubSubMT extends BasePubSubMultiThreadsTest<Long> { public TestInmemPubSubMT(String testName) { super(testName); } public static Test suite() { return new TestSuite(TestInmemPubSubMT.class); } /** * {@inheritDoc} */ @Override protected IPubSubHub<Long, byte[]> initPubSubHubInstance() { if (System.getProperty("skipTestsInmem") != null) { return null; } return new UniversalInmemPubSubHub().init(); } }
f6b3c88d86c7a4a78e25d1159bb1d2b440da5bad
416eb0978cb10e551ab44f16653bbf0955d3f7dc
/src/com/syntax/class09/Student.java
bafd6f3fd2c597b528eb84174f78e0b3bd333290
[]
no_license
true991/JavaBatch7
0e158a7667e94446ffd51a83d8255d41427d0ee2
47e422cc18ce219fd95a6837a6ff87e3b2639f59
refs/heads/master
2022-12-16T13:49:04.038671
2020-08-29T18:14:22
2020-08-29T18:14:22
272,066,506
0
0
null
null
null
null
UTF-8
Java
false
false
370
java
package com.syntax.class09; public class Student { public String name, adress; Student(String name, String adress) { this.name = name; this.adress = adress; } void info () { System.out.println(this.name + " " + this.adress); } public static void main(String[] args) { Student x = new Student("RHPAEP", "XATA"); x.info(); } }
2b4fa703432fab9c7253aac1509ccc0ed1431a4c
942c5021817d284f47382433eee4a5c24ca781bf
/core/store/src/main/java/mil/nga/giat/geowave/core/store/memory/AbstractMemoryStoreFactory.java
c965b292325474ab8dbb51ea5ceeece385882b91
[ "Apache-2.0", "LicenseRef-scancode-free-unknown", "LicenseRef-scancode-public-domain" ]
permissive
rfecher/geowave
9e41c93ec474db7b3c32e75ebb7c30f6f1f19c1a
b5dfb64abb6efdcdc75f46222ffd2d4c3f7d64a5
refs/heads/master
2022-06-28T02:03:32.509352
2017-02-15T17:56:32
2017-02-15T17:56:32
39,567,101
0
2
Apache-2.0
2018-07-23T12:23:08
2015-07-23T12:50:18
Java
UTF-8
Java
false
false
234
java
package mil.nga.giat.geowave.core.store.memory; import mil.nga.giat.geowave.core.store.GenericStoreFactory; abstract public class AbstractMemoryStoreFactory<T> extends AbstractMemoryFactory implements GenericStoreFactory<T> { }
cab0592792b6362035ab4fc081729f2e67c6fcf6
4d7cb5b5785c3487b9272b55d9aec882d0e8422f
/src/com/apiit/flyweight/ShapeSimulator.java
7a8ce7f4c4297b3e88e492ba9ce2c1bb504d010d
[]
no_license
alphagamer7/DPExample
0a00ff2f9699bbc9d75f88c3f76370df5ced187b
b4e5a0075e18bafe28db50855b4e0a4baf8fc095
refs/heads/master
2021-08-30T07:20:51.807221
2017-12-01T04:53:55
2017-12-01T04:53:55
112,050,998
0
0
null
null
null
null
UTF-8
Java
false
false
817
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.apiit.flyweight; /** * * @author Chathura */ public class ShapeSimulator { public static void main(String[] args) { ShapeFactory sfact = new ShapeFactory(); sfact.populate(); Heart myheartshape1 = (Heart)sfact.constructHeart("red"); Heart myheartshape2 = (Heart)sfact.constructHeart("blue"); Heart myheartshape3 = (Heart)sfact.constructHeart("green"); Heart myheartshape4 = (Heart)sfact.constructHeart("white"); myheartshape1.draw(); myheartshape2.draw(); myheartshape3.draw(); myheartshape4.draw(); } }
124c718581aa5141bde7a3a76e955ee5ae58cfec
c9b34b5c78f80bb98d1aeb95b9931b01eb7efe1d
/compilejar/src/main/java/com/fxn/compilejar/utils/OpenGPSUtil.java
45b65a147fcecdee57bd75aa1e7e72e5e847b7df
[]
no_license
fxn-sm/MyTool
925ae04b5cea60a56cfb94211b65fd056f3b81e2
a5eef709283e1c01a4e07fdcdc00f85c5d19559a
refs/heads/master
2020-07-16T08:39:32.861655
2019-09-23T07:43:01
2019-09-23T07:43:01
205,756,434
1
0
null
null
null
null
UTF-8
Java
false
false
1,935
java
package com.fxn.compilejar.utils; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.location.LocationManager; import android.provider.Settings; public class OpenGPSUtil { /** * 判断GPS是否开启,GPS或者AGPS开启一个就认为是开启的 * @param context * @return true 表示开启 */ public static final boolean isOPen(final Context context) { boolean isOpen; LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); isOpen = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); return isOpen; } /** * 强制帮用户打开GPS * @param context */ public static final void openGPS(final Activity context, String title, String message) { new AlertDialog.Builder(context).setTitle("打开GPS") .setMessage("为了定位流畅,请打开GPS") // 取消选项 .setNegativeButton("取消",new DialogInterface.OnClickListener(){ @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }) // 确认选项 .setPositiveButton("确认", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { //跳转到手机原生设置页面 Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); context.startActivityForResult(intent,1); } }) .setCancelable(false) .show(); } }
9d011d794e16868918c0f2b386e9af669fd31aef
5c2a4a08e6966f2790d938f5f255f1d538536383
/StormTopologies/TwoSources/TwoSourcesTopology.java
f1963498ba0c599e731f091c423ef3ab0011a186
[]
no_license
annavalentina/Equality
f89e856ffd108fc40bb2b19c7ef1f4a3b8766b94
2da835105dc58ea16be98373709825738e72cf1d
refs/heads/main
2023-08-11T14:20:35.154318
2021-10-11T13:21:30
2021-10-11T13:21:30
308,358,455
1
0
null
null
null
null
UTF-8
Java
false
false
5,812
java
import org.apache.storm.Config; import org.apache.storm.StormSubmitter; import org.apache.storm.topology.TopologyBuilder; import java.io.BufferedReader; import java.io.FileReader; import java.util.*; public class TwoSourcesTopology { public static void main(String[] args) throws Exception { //Use treemaps to store fractions List<TreeMap<Double, Integer>> treemaps = new ArrayList<TreeMap<Double, Integer>>(); treemaps.add(new TreeMap<Double, Integer>()); treemaps.add(new TreeMap<Double, Integer>()); treemaps.add(new TreeMap<Double, Integer>()); treemaps.add(new TreeMap<Double, Integer>()); int numberOfBolts = 4; String path = args[2] + "twoSources/";//Path to files String mode = args[1]; String numberOfExperiment = args[3]; Integer numberOfTuples = Integer.parseInt(args[4]); String selectivitiesFilename = path + "selectivities" + numberOfExperiment + ".txt"; List<Double> selectivities = new ArrayList<Double>(); BufferedReader br2 = new BufferedReader(new FileReader(selectivitiesFilename)); String line2; while ((line2 = br2.readLine()) != null) { selectivities.add(Double.parseDouble(line2)); } if (mode.equals("opt")) {//Optimized-Equality int ex = Integer.parseInt(args[5]); String fractionsFilename = path + "fractions" + numberOfExperiment + ".txt"; BufferedReader br = new BufferedReader(new FileReader(fractionsFilename)); String line; int treeId = 0; while ((line = br.readLine()) != null) { int id = 0; double sum = 0.0; for (String a : line.split(", ")) { if (Float.parseFloat(a) != 0) { sum += (int) (Float.parseFloat(a) * 100); treemaps.get(treeId).put(sum, id); } id += 1; } treeId += 1; } TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("TopologySpout1", new TopologySpout1(treemaps.get(0), mode, numberOfTuples)).addConfiguration("group-id", "1"); builder.setSpout("TopologySpout2", new TopologySpout2(treemaps.get(1), mode, numberOfTuples)).addConfiguration("group-id", "2"); builder.setBolt("MultiplierBolt1", new MultiplierBolt(treemaps.get(2), selectivities.get(0), mode), ex).directGrouping("TopologySpout1").setNumTasks(ex); builder.setBolt("MultiplierBolt2", new MultiplierBolt(treemaps.get(2), selectivities.get(1), mode), ex).directGrouping("TopologySpout2").setNumTasks(ex); builder.setBolt("AddingBolt1", new AddingBolt1(treemaps.get(3), selectivities.get(2), mode), ex).directGrouping("MultiplierBolt1").directGrouping("MultiplierBolt2").setNumTasks(ex); builder.setBolt("AddingBolt2", new AddingBolt2(), ex).directGrouping("AddingBolt1").setNumTasks(ex); Config config = new Config(); config.setMessageTimeoutSecs(300); StormSubmitter.submitTopology(args[0], config, builder.createTopology()); } else if (mode.equals("equal")) {//Equal distribution int ex = Integer.parseInt(args[5]); //Divide tasks for (int j = 0; j < numberOfBolts; j++) { double sum = 0.0; double divided = 100.0 / ex; for (int i = 0; i < ex; i++) { sum += divided; treemaps.get(j).put(sum, i); } } TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("TopologySpout1", new TopologySpout1(treemaps.get(0), mode, numberOfTuples)).addConfiguration("group-id", "1"); builder.setSpout("TopologySpout2", new TopologySpout2(treemaps.get(1), mode, numberOfTuples)).addConfiguration("group-id", "2"); builder.setBolt("MultiplierBolt1", new MultiplierBolt(treemaps.get(2), selectivities.get(0), mode), ex).directGrouping("TopologySpout1").setNumTasks(ex); builder.setBolt("MultiplierBolt2", new MultiplierBolt(treemaps.get(2), selectivities.get(1), mode), ex).directGrouping("TopologySpout2").setNumTasks(ex); builder.setBolt("AddingBolt1", new AddingBolt1(treemaps.get(3), selectivities.get(2), mode), ex).directGrouping("MultiplierBolt1").directGrouping("MultiplierBolt2").setNumTasks(ex); builder.setBolt("AddingBolt2", new AddingBolt2(), ex).directGrouping("AddingBolt1").setNumTasks(ex); Config config = new Config(); config.setMessageTimeoutSecs(300); StormSubmitter.submitTopology(args[0], config, builder.createTopology()); } else if (mode.equals("default")) {//Default storm TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("TopologySpout1", new TopologySpout1(mode, numberOfTuples)); builder.setSpout("TopologySpout2", new TopologySpout2(mode, numberOfTuples)); builder.setBolt("MultiplierBolt1", new MultiplierBolt(selectivities.get(0), mode)).shuffleGrouping("TopologySpout1"); builder.setBolt("MultiplierBolt2", new MultiplierBolt(selectivities.get(1), mode)).shuffleGrouping("TopologySpout2"); builder.setBolt("AddingBolt1", new AddingBolt1(selectivities.get(2), mode)).shuffleGrouping("MultiplierBolt1").shuffleGrouping("MultiplierBolt2"); builder.setBolt("AddingBolt2", new AddingBolt2()).shuffleGrouping("AddingBolt1"); Config config = new Config(); config.setMessageTimeoutSecs(300); StormSubmitter.submitTopology(args[0], config, builder.createTopology()); } } }
a7c364021e0085504718c966b00f0a9649c327ed
73c4e905ae1e0e12acf9e2b9ecb00c5665538cf5
/easybatch-core/src/main/java/org/easybatch/core/api/RecordDispatcher.java
e9a176ddf5a8107d47488900f827bf34277d4620
[ "MIT" ]
permissive
gilgnekoe/easy-batch
66d6c302ed41ed66c350c33d349f8c235ad8e7ec
a7f3e4c0ced87eb91a34f9bff6bd7567e145e6ed
refs/heads/master
2020-12-26T04:49:42.575867
2014-12-28T12:08:21
2014-12-28T12:08:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,625
java
/* * The MIT License * * Copyright (c) 2015, Mahmoud Ben Hassine ([email protected]) * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.easybatch.core.api; /** * A record dispatcher dispatches input records to multiple worker engines. * * @author Mahmoud Ben Hassine ([email protected]) */ public interface RecordDispatcher { /** * Dispatch a record. * @param record the record to dispatch * @throws Exception thrown if an error occurs when dispatching the record */ void dispatchRecord(Record record) throws Exception; }
ce5cd2fff220e0e7cd66c09a9480ed18f9a07dc6
c15d4c4a40a627d4270a468aed986e18418e1229
/3rdPartyServices/EnterpriseServices/collabtools/src/main/java/org/societies/enterprise/collabtools/Interpretation/AlchemyAPISimple.java
43d14436538e67bc409822ad58f44a06fa8c6c0c
[ "BSD-2-Clause" ]
permissive
efdouk/SOCIETIES-SCE-Services
2e0983a0194560986190fab3aac0169f28a58729
c43f6e354bebfb5ef4273528964a4b4bc92baa6b
refs/heads/master
2021-01-15T09:38:56.786692
2012-07-02T10:53:19
2012-07-02T10:53:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,588
java
package org.societies.enterprise.collabtools.Interpretation; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.net.HttpURLConnection; import java.net.URL; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; public class AlchemyAPISimple { private String _apiKey; private static final String _requestUri = "http://access.alchemyapi.com/calls/"; public static AlchemyAPISimple GetInstanceFromString(String apiKey) { AlchemyAPISimple api = new AlchemyAPISimple(); api.SetAPIKey(apiKey); return api; } private void SetAPIKey(String apiKey) { _apiKey = apiKey; if (null == _apiKey || _apiKey.length() < 5) throw new IllegalArgumentException("Too short API key."); } public Document TextGetRankedConcepts(String text) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { return TextGetRankedConcepts(text, new AlchemyAPIConceptParams()); } private Document TextGetRankedConcepts(String text, AlchemyAPIConceptParams params) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { CheckText(text); params.setText(text); return POST("TextGetRankedConcepts", "text", params); } private Document POST(String callName, String callPrefix, AlchemyAPIParams params) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { URL url = new URL(_requestUri + callPrefix + "/" + callName); HttpURLConnection handle = (HttpURLConnection) url.openConnection(); handle.setDoOutput(true); StringBuilder data = new StringBuilder(); data.append("apikey=").append(this._apiKey); data.append(params.getParameterString()); handle.addRequestProperty("Content-Length", Integer.toString(data.length())); DataOutputStream ostream = new DataOutputStream(handle.getOutputStream()); ostream.write(data.toString().getBytes()); ostream.close(); return doRequest(handle, params.getOutputMode()); } private Document doRequest(HttpURLConnection handle, String outputMode) throws IOException, SAXException, ParserConfigurationException, XPathExpressionException { DataInputStream istream = new DataInputStream(handle.getInputStream()); Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(istream); istream.close(); handle.disconnect(); XPathFactory factory = XPathFactory.newInstance(); if(AlchemyAPIParams.OUTPUT_XML.equals(outputMode)) { String statusStr = getNodeValue(factory, doc, "/results/status/text()"); if (null == statusStr || !statusStr.equals("OK")) { String statusInfoStr = getNodeValue(factory, doc, "/results/statusInfo/text()"); if (null != statusInfoStr && statusInfoStr.length() > 0) throw new IOException("Error making API call: " + statusInfoStr + '.'); throw new IOException("Error making API call: " + statusStr + '.'); } } else if(AlchemyAPIParams.OUTPUT_RDF.equals(outputMode)) { String statusStr = getNodeValue(factory, doc, "//RDF/Description/ResultStatus/text()"); if (null == statusStr || !statusStr.equals("OK")) { String statusInfoStr = getNodeValue(factory, doc, "//RDF/Description/ResultStatus/text()"); if (null != statusInfoStr && statusInfoStr.length() > 0) throw new IOException("Error making API call: " + statusInfoStr + '.'); throw new IOException("Error making API call: " + statusStr + '.'); } } return doc; } private String getNodeValue(XPathFactory factory, Document doc, String xpathStr) throws XPathExpressionException { XPath xpath = factory.newXPath(); XPathExpression expr = xpath.compile(xpathStr); Object result = expr.evaluate(doc, XPathConstants.NODESET); NodeList results = (NodeList) result; if (results.getLength() > 0 && null != results.item(0)) return results.item(0).getNodeValue(); return null; } private void CheckText(String text) { if (null == text || text.length() < 5) throw new IllegalArgumentException("Enter some text to analyze. The text must have at least 5 words"); } }
024e556cc9904541992b9b6fed3b443d3ad3b18f
b6fc79e9c63dbf687cfcb65d48096277b31f86af
/codingtest/programmers/level1/HateSameNumber.java
bc21b454c8884c4ba45c18b27a698f5359749fff
[]
no_license
Choiyounho/algorithm-interview
c432fd4280e5dd673baa996e88671d41dbee7d74
45739528f1726d952f8596cd1ccd510bed4e9b9e
refs/heads/master
2023-06-29T23:09:29.868142
2021-08-05T13:38:18
2021-08-05T13:38:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,495
java
/** * 프로그래머스 * Level1 * 같은 숫자는 싫어 */ class Solution { public static void main(String[] args) { int[] results = hateSameNumber(new int[]{1, 1, 3, 3, 0, 1, 1}); System.out.println(Arrays.toString(results)); } private int[] hateSameNumber(int[] array) { List<Integer> results = getHateSameNumbers(array); return toArrays(results); } private List<Integer> getHateSameNumbers(int[] array) { List<Integer> results = new ArrayList<>(); results.add(array[0]); int arrayLength = array.length; for (int i = 1; i < arrayLength; i++) { if (array[i] != array[i - 1]) { results.add(array[i]); } } return results; } private int[] toArrays(List<Integer> results) { int resultsSize = results.size(); int[] numbers = new int[resultsSize]; for (int i = 0; i < resultsSize; i++) { numbers[i] = results.get(i); } return numbers; } /** * 다른 사람의 풀이 */ private List<Integer> getHateSameNumbers(int[] array) { List<Integer> results = new ArrayList<>(); int current = 10; int arrayLength = array.length; for (int i = 0; i < arrayLength; i++) { if (array[i] != current) { results.add(array[i]); current = array[i]; } } return results; } }
f611eb9664f3d3bdba650240039cacf5dc45db77
532470b88a7ad4475e76c003cee6ca94d7f2e7f7
/src/main/java/com/softcell/datascience/model/request/package-info.java
3ccbca687b4965aa4b8695020bac136a77868280
[]
no_license
manoharvare/data-science
bb54d55d48cd48442604452f3a200619b29e1990
a1121afe6e463349b9c78ad0efd5bb180c73e8be
refs/heads/master
2021-05-13T21:40:53.846249
2018-01-04T09:03:39
2018-01-04T09:03:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
47
java
package com.softcell.datascience.model.request;
52be9ee9a833339d5580a5e69142711dd4f67e62
e1c4084250beacd90272ca89f187e5ee46c91a5c
/app/src/main/java/info/androidhive/scandemo/MainActivity.java
a74c87163d80ed191a00a325bd4fda2dc1d8f7b2
[]
no_license
sekar-worx/scandemo
ac50c2afcf27cf1fc0d56ed2d06a2f307b9daa43
d5fa7a2dea172fdd01442bb8557070fe93cdac1c
refs/heads/master
2021-01-24T04:01:48.043542
2018-02-26T05:27:11
2018-02-26T05:27:11
122,917,755
0
0
null
null
null
null
UTF-8
Java
false
false
3,577
java
package info.androidhive.scandemo; import android.annotation.SuppressLint; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; import android.provider.MediaStore; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import com.scanlibrary.ScanActivity; import com.scanlibrary.ScanConstants; import java.io.IOException; public class MainActivity extends AppCompatActivity { private static final int REQUEST_CODE = 99; private Button scanButton; private Button cameraButton; private Button mediaButton; private ImageView scannedImageView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); init(); } @SuppressLint("WrongViewCast") private void init() { scanButton = findViewById(R.id.scanButton); scanButton.setOnClickListener(new ScanButtonClickListener()); cameraButton = findViewById(R.id.cameraButton); cameraButton.setOnClickListener(new ScanButtonClickListener(ScanConstants.OPEN_CAMERA)); mediaButton = findViewById(R.id.mediaButton); mediaButton.setOnClickListener(new ScanButtonClickListener(ScanConstants.OPEN_MEDIA)); scannedImageView = findViewById(R.id.scannedImage); } private class ScanButtonClickListener implements View.OnClickListener { private int preference; public ScanButtonClickListener(int preference) { this.preference = preference; } public ScanButtonClickListener() { } @Override public void onClick(View v) { startScan(preference); } } protected void startScan(int preference) { Intent intent = new Intent(this, ScanActivity.class); intent.putExtra(ScanConstants.OPEN_INTENT_PREFERENCE, preference); startActivityForResult(intent, REQUEST_CODE); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK) { Uri uri = data.getExtras().getParcelable(ScanConstants.SCANNED_RESULT); Bitmap bitmap = null; try { bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), uri); getContentResolver().delete(uri, null, null); scannedImageView.setImageBitmap(bitmap); } catch (IOException e) { e.printStackTrace(); } } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
ae44607122e4d76a3a182b1b97673a65d03e9a9f
02ffbb38c34c2f9880d7ab62e1223c07648670fb
/src/main/java/nl/cz/testsupport/service/dto/PasswordChangeDTO.java
703c66da80084e5c057de9ebf41a71bd6a08fd75
[]
no_license
goos76/testsupport
4a71d7909d8e4860ac5370586e8fa6c2642f85b6
d411b817c5e15201b399762c8c0c9e52a00a38f2
refs/heads/main
2023-03-13T20:34:13.765908
2021-03-11T14:53:50
2021-03-11T14:53:50
346,737,371
0
0
null
2021-03-11T15:09:43
2021-03-11T14:53:35
Java
UTF-8
Java
false
false
860
java
package nl.cz.testsupport.service.dto; /** * A DTO representing a password change required data - current and new password. */ public class PasswordChangeDTO { private String currentPassword; private String newPassword; public PasswordChangeDTO() { // Empty constructor needed for Jackson. } public PasswordChangeDTO(String currentPassword, String newPassword) { this.currentPassword = currentPassword; this.newPassword = newPassword; } public String getCurrentPassword() { return currentPassword; } public void setCurrentPassword(String currentPassword) { this.currentPassword = currentPassword; } public String getNewPassword() { return newPassword; } public void setNewPassword(String newPassword) { this.newPassword = newPassword; } }
9bfaa7e435c60690b4449902e22bbdd51593302b
0dd5cbdecb8f0b276effeeebea3f18b6152dae59
/KimMinJi/frogjump.java
cc85920ce2904185bf5884e5d0cb66ce35422b83
[]
no_license
lovings2u/Algorithm
e85cdb5530f267aa5832f6f0decbc5445e469224
fa72c9449e5b6789c27fd169d2c409b23c62e972
refs/heads/master
2021-04-22T06:45:04.127744
2017-03-21T20:08:58
2017-03-21T20:08:58
57,963,551
0
0
null
2017-01-25T10:05:24
2016-05-03T11:15:53
Java
UHC
Java
false
false
1,750
java
import java.util.Scanner; import java.io.FileInputStream; class frogjump { public static void main(String args[]) throws Exception { /* 아래 메소드 호출은 앞으로 표준입력(키보드) 대신 input.txt 파일로 부터 읽어오겠다는 의미의 코드입니다. 만약 본인의 PC 에서 테스트 할 때는, 입력값을 input.txt에 저장한 후 이 코드를 첫 부분에 사용하면, 표준입력 대신 input.txt 파일로 부터 입력값을 읽어 올 수 있습니다. 또한, 본인 PC에서 아래 메소드를 사용하지 않고 표준입력을 사용하여 테스트하셔도 무방합니다. 단, Codeground 시스템에서 "제출하기" 할 때에는 반드시 이 메소드를 지우거나 주석(//) 처리 하셔야 합니다. */ //Scanner sc = new Scanner(new FileInputStream("input.txt")); Scanner sc = new Scanner(System.in); int TC;//테스트개수 int test_case;//현재 몇번째 테스트인지 int n,k,i,jump=0,max=0,sum=0;//입력받을 돌개수,점프거리,결과 TC = sc.nextInt();//테스트개수 입력받음 for(test_case = 1; test_case <= TC; test_case++) { n=sc.nextInt(); int []stone = new int [n]; int []gap = new int [n-1]; for(i=0;i<n;i++){ stone[i]=sc.nextInt(); } gap[0]=stone[0]; for(i=1;i<n-1;i++){ gap[i]=stone[i+1]-stone[i]; max=Math.max(max,gap[i]); } k=sc.nextInt(); i=0; if(k<max){jump=-1;} else{ while(i==n){ if(k>sum){ sum+=gap[i]; i++; }else{ sum=gap[i]; jump++; i++; } } } System.out.println("Case #" + test_case); System.out.println(jump); } } }
61b579d1c5608136a878f3b2aabb6a65b3e94260
75c847f93177ba81c7269a1604575d1ba0ee4e9e
/Connect with DB/db.java
4bb38d4886314a8ad1e8a09d610d0fbdfbe14f9a
[]
no_license
ggchilev/Java_Projects
f65437ddf5a8e12763b7b71b10e132e185778834
42297e9b661cd370621cf611d950bd11d39872b8
refs/heads/master
2021-01-10T11:24:24.743769
2016-01-26T12:17:31
2016-01-26T12:17:31
50,426,586
0
0
null
null
null
null
WINDOWS-1251
Java
false
false
2,181
java
import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.ResultSet; import java.sql.SQLException; public class jiktak{ // метод който се свързва със SQL сървъра и връща ресурс (връзка) към него, // а ако свързването е неуспешно, ще върне NULL private static Connection connect(String url, String user, String password){ Connection result = null; try{ result = DriverManager.getConnection(url, user, password); } catch(SQLException e){ e.printStackTrace(); } return result; } public static void main(String[] args){ // localhost е IP на сървъра, 3306 е порта, mydb е базата String url = "jdbc:mysql://localhost:3306/tv"; String user = "pesho"; String pass = "1234"; Connection link = jiktak.connect(url, user, pass); if(link == null){ System.out.println("Опа, MySQL не е пуснат!"); return; } else{ System.out.println("Свързах се с MySQL сървъра!"); } // В JDBC Statement е заявката, а ResultSet е резултата от нея Statement stmt = null; ResultSet resultSet = null; try{ stmt = link.createStatement(); resultSet = stmt.executeQuery("SELECT number, name, secondname FROM televisions"); // Обхождаме резултатната таблица ред по ред и отпечатваме на екрана while (resultSet.next()) { System.out.print("FN: "+resultSet.getLong("number")); System.out.print(", Name: "+resultSet.getString("name")); System.out.println(", Group: "+resultSet.getString("secondname")); } } catch(SQLException e){ e.printStackTrace(); } finally{ try{ if(stmt != null) stmt.close(); if(resultSet != null) resultSet.close(); if(link != null) link.close(); } catch(SQLException e2){ e2.printStackTrace(); } } } }
cc63bdfd272dcc5105daa8398b4e95dde83fda09
4a200307844a77355b5bca8c4c6f37e988398dec
/WEB/com.xinwei.minas.server/src/com/xinwei/minas/server/enb/facade/EnbNeighbourFacadeImpl.java
6285f340d6d7c532c22e60193b703dd0abe477c4
[]
no_license
qqhappy/mesh-omc
a623679647fb22feba1ed8dfa43cc2740ccc90f4
c06fb739aab39a550f14442697ad1916c1243261
refs/heads/master
2021-05-11T23:41:40.986485
2018-01-17T06:42:25
2018-01-17T06:42:25
117,513,317
1
0
null
null
null
null
GB18030
Java
false
false
1,998
java
/* * Copyright 2015 Beijing Xinwei, Inc. All rights reserved. * * History: * ------------------------------------------------------------------------------ * Date | Who | What * 2015-2-12 | fanhaoyu | create the file */ package com.xinwei.minas.server.enb.facade; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.util.List; import com.xinwei.minas.core.model.OperObject; import com.xinwei.minas.enb.core.facade.EnbNeighbourFacade; import com.xinwei.minas.enb.core.model.EnbNeighbourRecord; import com.xinwei.minas.server.enb.service.EnbNeighbourService; import com.xinwei.omp.core.model.biz.XBizRecord; import com.xinwei.omp.server.OmpAppContext; /** * * eNB邻区关系配置门面接口实现 * * @author fanhaoyu * */ @SuppressWarnings("serial") public class EnbNeighbourFacadeImpl extends UnicastRemoteObject implements EnbNeighbourFacade { protected EnbNeighbourFacadeImpl() throws RemoteException { super(); } @Override public List<EnbNeighbourRecord> queryNeighbourRecords(long moId) throws Exception { return getService().queryNeighbourRecords(moId); } @Override public EnbNeighbourRecord queryNeighbourRecord(long moId, XBizRecord condition) throws Exception { return getService().queryNeighbourRecord(moId, condition); } @Override public void addNeighbour(OperObject operObject, long moId, EnbNeighbourRecord record) throws Exception { getService().addNeighbour(moId, record); } @Override public void updateNeighbour(OperObject operObject, long moId, EnbNeighbourRecord record) throws Exception { getService().updateNeighbour(moId, record); } @Override public void deleteNeighbour(OperObject operObject, long moId, EnbNeighbourRecord record) throws Exception { getService().deleteNeighbour(moId, record); } private EnbNeighbourService getService() { return OmpAppContext.getCtx().getBean(EnbNeighbourService.class); } }
c19f7adb76fc32425da5363178935ad1b7775347
d211f2ba77257b2cca37d2ddd1181e7217917137
/src/org/usfirst/frc/team4627/robot/subsystems/DriveTrain.java
3c2cbd75fbee0d138c498af443a78ce0599cc8e8
[]
no_license
4627ManningRobotics/2018-Offseason-backup
6c95ec032a578c375eb265846b083c5610c20059
8ee218824edb3a595bf8727f6d97edfd45312b8f
refs/heads/master
2020-03-14T19:58:34.914332
2018-05-01T22:19:24
2018-05-01T22:19:24
131,768,918
0
0
null
null
null
null
UTF-8
Java
false
false
3,772
java
package org.usfirst.frc.team4627.robot.subsystems; import org.usfirst.frc.team4627.robot.RobotMap; import org.usfirst.frc.team4627.robot.commands.DriverControls; import com.ctre.phoenix.motorcontrol.can.TalonSRX; import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.Solenoid; import edu.wpi.first.wpilibj.command.Subsystem; /** * */ public class DriveTrain extends Subsystem { //instantiate motor controllers private final TalonSRX leftMotor1 = new TalonSRX(RobotMap.LEFT_MOTOR_1); private final TalonSRX leftMotor2 = new TalonSRX(RobotMap.LEFT_MOTOR_2); private final TalonSRX rightMotor1 = new TalonSRX(RobotMap.RIGHT_MOTOR_1); private final TalonSRX rightMotor2 = new TalonSRX(RobotMap.RIGHT_MOTOR_2); private final Solenoid theSolenoid = new Solenoid(RobotMap.SOLENOID); public boolean isInHighGear = false; //, isSmoothDriving = false, wasSmooth = false; private static final Encoder leftEncoder = new Encoder(0, 1, false, Encoder.EncodingType.k4X); private static final Encoder rightEncoder = new Encoder(2, 3, false, Encoder.EncodingType.k4X); private double distancePerPulse = (2*RobotMap.WHEEL_DIAMETER)/(RobotMap.ENCODER_PULSES_PER_REVOLUTION/RobotMap.ENCODER_GEAR_RATIO); public DriveTrain() { this.leftMotor1.configOpenloopRamp(RobotMap.RAMP_RATE, 0); // configure the time it takes for the motors to reach max speed this.leftMotor2.configOpenloopRamp(RobotMap.RAMP_RATE, 0); this.rightMotor1.configOpenloopRamp(RobotMap.RAMP_RATE, 0); this.rightMotor2.configOpenloopRamp(RobotMap.RAMP_RATE, 0); /* this.leftMotor1.configPeakCurrentLimit(RobotMap.CURRENT_LIMIT, 10); this.leftMotor2.configPeakCurrentLimit(RobotMap.CURRENT_LIMIT, 10); this.rightMotor1.configPeakCurrentLimit(RobotMap.CURRENT_LIMIT, 10); this.rightMotor2.configPeakCurrentLimit(RobotMap.CURRENT_LIMIT, 10); this.leftMotor1.enableCurrentLimit(true); this.leftMotor2.enableCurrentLimit(true); this.rightMotor1.enableCurrentLimit(true); this.rightMotor2.enableCurrentLimit(true); */ this.theSolenoid.set(!this.isInHighGear); } public void initEncoders() { leftEncoder.setDistancePerPulse(this.distancePerPulse); rightEncoder.setDistancePerPulse(this.distancePerPulse); } public void resetEncoders() { leftEncoder.reset(); rightEncoder.reset(); } public double getDistance() { //System.out.println(leftEncoder + " " + rightEncoder); double distance = (leftEncoder.getDistance() + rightEncoder.getDistance()/2); return distance; } public double getRightPulse() { return rightEncoder.getRaw(); } public double getLeftPulse() { return leftEncoder.getRaw(); } public void initDefaultCommand() { super.setDefaultCommand(new DriverControls()); } public void setLeftMotor(double motorSetting) { motorSetting *= RobotMap.DRIVER_MAX_SPEED; leftMotor1.set(leftMotor1.getControlMode(), motorSetting); leftMotor2.set(leftMotor2.getControlMode(), motorSetting); } public void setRightMotor(double motorSetting) { motorSetting *= RobotMap.DRIVER_MAX_SPEED; rightMotor1.set(rightMotor1.getControlMode(), -motorSetting); //reverse setting rightMotor2.set(rightMotor2.getControlMode(), -motorSetting); } public void changeGears() { this.isInHighGear = !this.isInHighGear; this.theSolenoid.set(!this.isInHighGear); } public void setGear(boolean set) { this.isInHighGear = set; this.theSolenoid.set(!this.isInHighGear); } public void setRampRate(double rr) { this.leftMotor1.configClosedloopRamp(rr, 0); this.leftMotor2.configClosedloopRamp(rr, 0); this.rightMotor1.configClosedloopRamp(rr, 0); this.rightMotor2.configClosedloopRamp(rr, 0); } }
7d66274b38ebceb74df08155056cc908a502a81c
11d2f1807fbfa341bb82b30fc413649558f787bf
/NumberPrinting/src/numberPrinting/NumperPrinting.java
badf410fa123afa7cfe0e8ad1338ca730ea0d1b8
[]
no_license
skshaya/Training-Session
cda352584f4a747f95097ad48394f0fc8b92bb37
04ac1242212e8f39cc21fba5547e63ae0f6ec2a4
refs/heads/master
2022-06-21T17:52:29.425898
2020-02-22T19:29:27
2020-02-22T19:29:27
238,169,531
0
0
null
2022-06-21T02:50:48
2020-02-04T09:35:24
Java
UTF-8
Java
false
false
720
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package numberPrinting; /** * * @author Shaya */ public class NumperPrinting { /** * @param args the command line arguments */ public static void main(String[] args) { int a,b,c; for (a = 1; a < 10; a++) { System.out.print("" + a + " |"); for (b = 1; b < 10; b++) { // System.out.println(""); c = b * a; System.out.print(" " + c + ""); } System.out.println(""); } } }
aabd92f440656cea83d4d4fca235b111df7e6423
048cca048123a103a25e0505fa1aa862e5f10baa
/src/main/java/guru/springframework/model/UnitOfMeasure.java
6b1d36731ddd2abf040f3054e5469392bfeba155
[]
no_license
555ab/spring5-recipe-app
5564b45b8f43a1ba264d16de99156826d2219197
dfb11de6f1ac7c3e7ff3e7d0b1e88531089ccbfa
refs/heads/master
2021-01-02T01:26:20.433005
2020-02-11T08:50:57
2020-02-11T08:50:57
239,432,127
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package guru.springframework.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity public class UnitOfMeasure { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String description; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } }
c66bde50e3400abd7f1f3b68d5775f0215f8ac98
2982fb08921b0849284487e3e905050491f19e71
/src/com/javaeasy/overload/UseOverLoad2.java
990a9b03e08f21748b7dcc9e2fd51d4c29ebd5ad
[]
no_license
fengzige1993/hello
00ca1231e26cd2e746f81ae4804726f86a10a618
631418049ffc6c79cc8774922ee3e1cca6342dc7
refs/heads/master
2021-05-17T02:42:46.973665
2020-04-25T17:10:12
2020-04-25T17:10:12
250,580,355
0
0
null
null
null
null
UTF-8
Java
false
false
1,854
java
package com.javaeasy.overload; import com.javaeasy.override.Bus; import com.javaeasy.override.CarBase; import com.javaeasy.override.ElectronicBus; import com.javaeasy.override.SportsCar; public class UseOverLoad2 { public static void main(String[] args){ UseCar useCar = new UseCar(); CarBase base = new CarBase(); System.out.println("使用CarBase类的对象做参数调用UseCar类的setCar()方法:"); useCar.setCar(base); System.out.println("使用SportsCar类的对象做参数调用UseCar类的setCar()方法:"); base = new SportsCar(); useCar.setCar(base); System.out.println("使用Bus类的对象做参数调用UseCar类的setCar()方法:"); base = new Bus(); useCar.setCar(base); System.out.println("使用ElectronicBus类的对象做参数调用UseCar类的set.Car()方法:"); base = new ElectronicBus(); useCar.setCar(base); } } // // CarBase类的构造方法被调用了 // 使用CarBase类的对象做参数调用UseCar类的setCar()方法: // setCar(CarBase)方法被调用了 // 使用SportsCar类的对象做参数调用UseCar类的setCar()方法: // CarBase类的构造方法被调用了 // SportsCar类的构造方法被调用了 // setCar(CarBase)方法被调用了 // 使用Bus类的对象做参数调用UseCar类的setCar()方法: // CarBase类的构造方法被调用了 // Bus类的构造方法被调用了! // setCar(CarBase)方法被调用了 // 使用ElectronicBus类的对象做参数调用UseCar类的set.Car()方法: // CarBase类的构造方法被调用了 // Bus类的构造方法被调用了! // ElectronicBus类的构造方法被调用了! // setCar(CarBase)方法被调用了
2a6082288dff841d0284b66fd93e206a86ac17a2
034a1bec648285f2927383d63cc09c282aa4f5b5
/projekat/src/main/java/xmlweb/projekat/model/dtos/AccomodationAdminDTO.java
8eff08f79fd604bed2f02e8c15203ab0705cabaa
[]
no_license
nikola310/XWS
d29a53093a83b106bea0caf589c7d7f0192e1f43
e884c9e78ed0e3c4dbbdf0542fa17b9de9f14bfb
refs/heads/master
2021-07-19T10:28:05.253715
2018-11-13T16:24:21
2018-11-13T16:24:21
129,967,817
0
1
null
null
null
null
UTF-8
Java
false
false
1,228
java
package xmlweb.projekat.model.dtos; /** * @author Nikola * */ public class AccomodationAdminDTO { private long id; private String accomodationName; private String accomodationType; private int capacity; private int category; private String location; private int version; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getAccomodationName() { return accomodationName; } public void setAccomodationName(String accomodationName) { this.accomodationName = accomodationName; } public String getAccomodationType() { return accomodationType; } public void setAccomodationType(String accomdoationType) { this.accomodationType = accomdoationType; } public int getCapacity() { return capacity; } public void setCapacity(int capacity) { this.capacity = capacity; } public int getCategory() { return category; } public void setCategory(int category) { this.category = category; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public int getVersion() { return version; } public void setVersion(int version) { this.version = version; } }
f7588935ab697af88dfd1928054a64a49bea756f
10186b7d128e5e61f6baf491e0947db76b0dadbc
/jp/cssj/sakae/sac/parser/DefaultClassCondition.java
b17050bf37970cc19d6b5e5f5089ded5a239701d
[ "SMLNJ", "Apache-1.1", "Apache-2.0", "BSD-2-Clause" ]
permissive
MewX/contendo-viewer-v1.6.3
7aa1021e8290378315a480ede6640fd1ef5fdfd7
69fba3cea4f9a43e48f43148774cfa61b388e7de
refs/heads/main
2022-07-30T04:51:40.637912
2021-03-28T05:06:26
2021-03-28T05:06:26
351,630,911
2
0
Apache-2.0
2021-10-12T22:24:53
2021-03-26T01:53:24
Java
UTF-8
Java
false
false
1,352
java
/* */ package jp.cssj.sakae.sac.parser; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class DefaultClassCondition /* */ extends DefaultAttributeCondition /* */ { /* */ public DefaultClassCondition(String namespaceURI, String value) { /* 67 */ super("class", namespaceURI, true, value); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public short getConditionType() { /* 75 */ return 9; /* */ } /* */ /* */ /* */ /* */ /* */ public String toString() { /* 82 */ return "." + getValue(); /* */ } /* */ } /* Location: /mnt/r/ConTenDoViewer.jar!/jp/cssj/sakae/sac/parser/DefaultClassCondition.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
b284a4c1ded0a075b1d4f2a5b9b4c7369f6ad208
d775f84c8fab3ad796542dcca215bcf5f77b70c5
/addressbook-web-tests/src/test/java/ru/stqa/pft/addressbook/tests/RemoveContactFromGroup.java
ca3a4052d0453f27d7f736e35174cf160d51b24b
[ "Apache-2.0" ]
permissive
ivanrightman/JavaForTestersTraining
be82a3435f50000b5f04e807d7ad6717133d347c
7aaeedb6c7a1efff08dd83d88f4cad0a7afd834b
refs/heads/master
2022-06-09T11:58:51.959875
2020-05-10T10:49:46
2020-05-10T10:49:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,966
java
package ru.stqa.pft.addressbook.tests; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import ru.stqa.pft.addressbook.model.ContactData; import ru.stqa.pft.addressbook.model.GroupData; import ru.stqa.pft.addressbook.model.Groups; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.core.IsNot.not; public class RemoveContactFromGroup extends TestBase{ @BeforeMethod public void ensurePreconditions() { if (app.db().groups().size() == 0) { app.goTo().groupPage(); app.group().create(new GroupData().withName("test1")); } if (app.db().contacts().size() == 0) { Groups groups = app.db().groups(); app.goTo().homePage(); app.contact().create(new ContactData() .withFirstName("firstname") .withLastName("lastname") .withAddress("address") .withMobile("mobile") .withEmail("email") .withEmail2("email2") .withEmail3("email3") .withHomephone("home") .withWorkPhone("work") .inGroup(groups.iterator().next()) ); } } @Test public void removeContactFromGroupTests() { ContactData contact = app.db().contacts().iterator().next(); Groups allGroups = app.db().groups(); GroupData deletedGroup = allGroups.iterator().next(); if (!deletedGroup.equals(contact.getGroups())) { app.contact().addToGroup(contact, deletedGroup); } allGroups.removeAll(contact.getGroups()); app.goTo().homePage(); app.contact().removeFromGroup(contact, deletedGroup); app.db().sessionRefresh(contact); assertThat(contact.getGroups(), not(hasItem(deletedGroup))); } }
1e50dccf6f5525b8777b5ba196ad14fc77801dcf
8a9e2ce77cfef4b43400839dae2f74ed4590f1ba
/step10_miniProject/src/miniproject/exception/DuplicateException.java
937fd96076e19dea22afc0fb2dcb9457a97e664a
[]
no_license
aNnaHmiK/MiniProject
a46bbfec26bfc8a38bfc6d48dd7058c554eed44e
68ef7748a1a69c418192d0f2a26a58970bb0e05f
refs/heads/main
2023-07-02T19:44:54.300212
2021-08-06T08:27:05
2021-08-06T08:27:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
199
java
package miniproject.exception; public class DuplicateException extends Exception{ public DuplicateException() {} public DuplicateException(String message) { super(message); } }
ddbd3ef6ec1d0d25aae13bf5f06ff7678682d84e
6136bded20fd21a1d10f8433ec9b25bd123eed40
/seaglass/tags/seaglasslookandfeel-0.1.6/src/main/java/com/seaglasslookandfeel/painter/FrameAndRootPainter.java
f150fd634f9fc9e42291ceff809609188834c3f1
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
amertkara/seaglass
fe1da62ff6196affd3c1c3217cf8f38614c97760
4936a1715b6f17831425a516b62fcec323dca4ed
refs/heads/master
2016-08-12T05:51:28.894005
2015-05-27T12:29:59
2015-05-27T12:29:59
36,365,097
0
0
null
null
null
null
UTF-8
Java
false
false
10,025
java
/* * Copyright (c) 2009 Kathryn Huxtable and Kenneth Orr. * * This file is part of the SeaGlass Pluggable Look and Feel. * * 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. * * $Id$ */ package com.seaglasslookandfeel.painter; import java.awt.Color; import java.awt.Component; import java.awt.Graphics2D; import java.awt.Paint; import java.awt.Shape; import java.awt.geom.Rectangle2D; import javax.swing.JComponent; import javax.swing.JInternalFrame; import javax.swing.JMenuBar; import javax.swing.JRootPane; import javax.swing.JToolBar; import com.seaglasslookandfeel.painter.util.ShapeUtil; import com.seaglasslookandfeel.painter.util.ShapeUtil.CornerSize; import com.seaglasslookandfeel.state.State; import com.seaglasslookandfeel.state.ToolBarNorthState; import com.seaglasslookandfeel.state.ToolBarSouthState; /** * Nimbus's FrameAndRootPainter. */ public final class FrameAndRootPainter extends AbstractRegionPainter { public static enum Which { BACKGROUND_ENABLED, BACKGROUND_ENABLED_WINDOWFOCUSED, BACKGROUND_ENABLED_NOFRAME }; private Color frameBorderBase = decodeColor("frameBorderBase"); private Color frameInnerHighlightInactive = decodeColor("frameInnerHighlightInactive"); private Color frameInnerHighlightActive = decodeColor("frameInnerHighlightActive"); private Color frameBaseActive = decodeColor("frameBaseActive"); private Color frameBaseInactive = decodeColor("frameBaseInactive"); private Color frameBorderActive = frameBorderBase; private Color frameBorderInactive = frameBorderBase; private Color frameTopActive = deriveColor(frameBaseActive, 0.005208f, -0.080105f, 0.043137f, 0); private Color frameUpperMidActive = frameBaseActive; private Color frameLowerMidActive = frameBaseActive; private Color frameBottomActive = deriveColor(frameBaseActive, 0f, 0.025723f, -0.015686f, 0); private Color frameTopInactive = deriveColor(frameBaseInactive, 0f, 0f, 0.050980f, 0); private Color frameUpperMidInactive = frameBaseInactive; private Color frameLowerMidInactive = frameBaseInactive; private Color frameBottomInactive = deriveColor(frameBaseInactive, 0f, 0f, -0.050980f, 0); private FourColors frameActive = new FourColors(frameTopActive, frameUpperMidActive, frameLowerMidActive, frameBottomActive); private FourColors frameInactive = new FourColors(frameTopInactive, frameUpperMidInactive, frameLowerMidInactive, frameBottomInactive); private static final int TITLE_BAR_HEIGHT = 25; private static final State toolBarNorthState = new ToolBarNorthState(); private static final State toolBarSouthState = new ToolBarSouthState(); private PaintContext ctx; private CommonControlType type; public FrameAndRootPainter(Which state) { super(); this.ctx = new PaintContext(PaintContext.CacheMode.FIXED_SIZES); type = getButtonType(state); } protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) { paintFrame(g, c, width, height); } protected final PaintContext getPaintContext() { return ctx; } private CommonControlType getButtonType(Which state) { switch (state) { case BACKGROUND_ENABLED: return CommonControlType.DISABLED; case BACKGROUND_ENABLED_WINDOWFOCUSED: return CommonControlType.ENABLED; } return null; } private void paintFrame(Graphics2D g, JComponent c, int width, int height) { Shape s = ShapeUtil.createRoundRectangle(0, 0, (width - 1), (height - 1), CornerSize.FRAME_BORDER); if (type != null) { g.setPaint(getFrameBorderPaint(s, type)); g.draw(s); } JMenuBar mb = null; Component[] cArray = null; if (c instanceof JInternalFrame) { JInternalFrame iframe = (JInternalFrame) c; mb = iframe.getJMenuBar(); cArray = iframe.getContentPane().getComponents(); } else if (c instanceof JRootPane) { JRootPane root = (JRootPane) c; mb = root.getJMenuBar(); cArray = root.getContentPane().getComponents(); } int topToolBarHeight = 0; int bottomToolBarHeight = 0; if (cArray != null) { for (Component comp : cArray) { if (comp instanceof JToolBar) { if (toolBarNorthState.isInState((JComponent) comp)) { topToolBarHeight = comp.getHeight(); } else if (toolBarSouthState.isInState((JComponent) comp)) { bottomToolBarHeight = comp.getHeight(); } } } } int titleHeight = TITLE_BAR_HEIGHT; if (mb != null && !"true".equals(c.getClientProperty("SeaGlass.JRootPane.MenuInTitle"))) { titleHeight += mb.getHeight(); } s = ShapeUtil.createRoundRectangle(1, 1, (width - 2), (height - 2), CornerSize.FRAME_INNER_HIGHLIGHT); g.setPaint(getFrameInteriorPaint(s, type, titleHeight, topToolBarHeight, bottomToolBarHeight)); g.fill(s); s = ShapeUtil.createRoundRectangle(1, 1, (width - 3), (height - 3), CornerSize.FRAME_INTERIOR); g.setPaint(getFrameInnerHighlightPaint(s, type)); g.draw(s); } private Color getFrameBorderColors(CommonControlType type) { switch (type) { case DISABLED: return frameBorderInactive; case ENABLED: return frameBorderActive; } return null; } public Paint getFrameBorderPaint(Shape s, CommonControlType type) { return getFrameBorderColors(type); } private FourColors getFrameInteriorColors(CommonControlType type) { switch (type) { case DISABLED: return frameInactive; case ENABLED: return frameActive; } return null; } public Paint getFrameInteriorPaint(Shape s, CommonControlType type, int titleHeight, int topToolBarHeight, int bottomToolBarHeight) { FourColors colors = getFrameInteriorColors(type); return createFrameGradient(s, titleHeight, topToolBarHeight, bottomToolBarHeight, colors); } private Color getFrameInnerHighlightColors(CommonControlType type) { switch (type) { case DISABLED: return frameInnerHighlightInactive; case ENABLED: return frameInnerHighlightActive; } return null; } public Paint getFrameInnerHighlightPaint(Shape s, CommonControlType type) { return getFrameInnerHighlightColors(type); } private Paint createFrameGradient(Shape s, int titleHeight, int topToolBarHeight, int bottomToolBarHeight, FourColors defColors) { Rectangle2D bounds = s.getBounds2D(); float x = (float) bounds.getX(); float y = (float) bounds.getY(); float w = (float) bounds.getWidth(); float h = (float) bounds.getHeight(); float midX = x + w / 2.0f; float titleBottom = titleHeight / h; if (titleBottom >= 1.0f) { titleBottom = 1.0f - 0.00004f; } float[] midPoints = null; Color[] colors = null; if (topToolBarHeight > 0 && bottomToolBarHeight > 0) { float topToolBarBottom = (titleHeight + topToolBarHeight) / h; if (topToolBarBottom >= 1.0f) { topToolBarBottom = 1.0f - 0.00002f; } float bottomToolBarTop = (h - 2 - bottomToolBarHeight) / h; if (bottomToolBarTop >= 1.0f) { bottomToolBarTop = 1.0f - 0.00002f; } midPoints = new float[] { 0.0f, topToolBarBottom, bottomToolBarTop, 1.0f }; colors = new Color[] { defColors.top, defColors.upperMid, defColors.lowerMid, defColors.bottom }; } else if (topToolBarHeight > 0) { float toolBarBottom = (titleHeight + topToolBarHeight) / h; if (toolBarBottom >= 1.0f) { toolBarBottom = 1.0f - 0.00002f; } midPoints = new float[] { 0.0f, toolBarBottom, 1.0f }; colors = new Color[] { defColors.top, defColors.upperMid, defColors.lowerMid }; } else if (bottomToolBarHeight > 0) { float bottomToolBarTop = (h - 2 - bottomToolBarHeight) / h; if (bottomToolBarTop >= 1.0f) { bottomToolBarTop = 1.0f - 0.00002f; } midPoints = new float[] { 0.0f, titleBottom, bottomToolBarTop, 1.0f }; colors = new Color[] { defColors.top, defColors.upperMid, defColors.lowerMid, defColors.bottom }; } else { midPoints = new float[] { 0.0f, titleBottom, 1.0f }; colors = new Color[] { defColors.top, defColors.upperMid, defColors.bottom }; } return createGradient(midX, y, x + midX, y + h, midPoints, colors); } }
4dde88ce5b2747f94cc4bb1d4ff3521dd2c71d94
a226665fade4ea4ebb7bc3e7870fcef7716dff1d
/src/main/java/com/knife/agilemind/repository/story/StoryRepository.java
372f3574508d030e7dced6fea1783a9f6a3e3ef7
[]
no_license
KnifeOnlyI/AgileMind
ca11313a1f117d6157778add16f9297a089602c1
00e0bca462bb80a7133e34728200dc6935608566
refs/heads/master
2023-07-10T07:18:38.368741
2023-06-28T10:17:55
2023-06-28T10:17:55
251,386,518
0
0
null
null
null
null
UTF-8
Java
false
false
408
java
package com.knife.agilemind.repository.story; import com.knife.agilemind.domain.story.StoryEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; /** * Repository to manage stories in database * * @author Dany Pignoux ([email protected]) */ @Repository public interface StoryRepository extends JpaRepository<StoryEntity, Long> { }
82e135e2d70be9523b1436efbb4992b418962bb9
1e600c3d9cb23283e854bec7d14f188c47b885db
/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/CodeAssistPreferencePage.java
8dc0fe26d3b031aa878b7566f3b047d0fd21e67a
[]
no_license
AmanziTel/awe-rdt
3144c96bb322c1c35a00d5fe0fa66d974e0ebb47
476693295b84a3a91f8bdeee974eaeb0ff293f09
refs/heads/master
2016-09-03T03:58:56.498965
2011-08-23T09:08:41
2011-08-23T09:08:41
2,254,984
0
0
null
null
null
null
UTF-8
Java
false
false
2,991
java
/******************************************************************************* * Copyright (c) 2000, 2005 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.rubypeople.rdt.internal.ui.preferences; import org.eclipse.core.resources.IProject; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.ui.IWorkbenchPreferencePage; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds; /** * Content Assist preference page. * <p> * Note: Must be public since it is referenced from plugin.xml * </p> * * @since 1.0 */ public class CodeAssistPreferencePage extends PropertyAndPreferencePage implements IWorkbenchPreferencePage { private CodeAssistConfigurationBlock fConfigurationBlock; public void createControl(Composite parent) { IWorkbenchPreferenceContainer container= (IWorkbenchPreferenceContainer) getContainer(); fConfigurationBlock= new CodeAssistConfigurationBlock(getNewStatusChangedListener(), container); super.createControl(parent); PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IRubyHelpContextIds.RUBY_EDITOR_PREFERENCE_PAGE); } protected Control createPreferenceContent(Composite composite) { return fConfigurationBlock.createContents(composite); } protected boolean hasProjectSpecificOptions(IProject project) { return false; } protected String getPreferencePageID() { return "org.rubypeople.rdt.ui.preferences.CodeAssistPreferencePage"; //$NON-NLS-1$ } protected String getPropertyPageID() { return null; } /* (non-Rubydoc) * @see org.eclipse.jface.dialogs.DialogPage#dispose() */ public void dispose() { if (fConfigurationBlock != null) { fConfigurationBlock.dispose(); } super.dispose(); } /* * @see org.eclipse.jface.preference.IPreferencePage#performDefaults() */ protected void performDefaults() { super.performDefaults(); if (fConfigurationBlock != null) { fConfigurationBlock.performDefaults(); } } /* * @see org.eclipse.jface.preference.IPreferencePage#performOk() */ public boolean performOk() { if (fConfigurationBlock != null && !fConfigurationBlock.performOk()) { return false; } return super.performOk(); } /* * @see org.eclipse.jface.preference.IPreferencePage#performApply() */ public void performApply() { if (fConfigurationBlock != null) { fConfigurationBlock.performApply(); } } }
[ "lagutko@0edadee9-8154-4c59-a661-b5f45207fcbd" ]
lagutko@0edadee9-8154-4c59-a661-b5f45207fcbd
1aa10cf627932b9102d58ab8beae36811fe676ab
a7d9d89e83d2fe8d0363103c48469eef3e3ffb26
/src/leetcode/LeetCode83.java
78227c130c635823a2b485c3646151b5f48003b0
[]
no_license
Flywith24/MyLeetCode
382b1d7ed1c85baba5ab7860c862e34a03636f02
8f733df31be26a41d98f9ed18904bae98ff09e75
refs/heads/master
2023-02-12T23:22:50.117356
2021-01-13T14:07:25
2021-01-13T14:07:25
281,310,974
2
0
null
null
null
null
UTF-8
Java
false
false
588
java
package leetcode; /** * https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/ */ public class LeetCode83 { private static class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } public ListNode deleteDuplicates(ListNode head) { ListNode current = head; while (current != null) { while (current.next != null && current.val == current.next.val) current.next = current.next.next; current = current.next; } return head; } }
aa5b3a30da1def771c961475f91b9e4fb2ffa00f
26941f5d82d28c8ec3567ac4ac6dd8c8357e8f30
/src/main/java/com/kymryd/starfood/controller/OfferController.java
696a95d5a82cf53f99846463a4fa517a686ddb6f
[]
no_license
Legacy0013/StarFood
f6564ba8675df408f63b1e24fac6c4deb40202f4
1deafe5c1f2899c7aa056d9070956c0bd0b7ae65
refs/heads/main
2023-02-24T17:02:04.256693
2021-01-14T12:51:14
2021-01-14T12:51:14
329,614,405
0
0
null
null
null
null
UTF-8
Java
false
false
1,182
java
package com.kymryd.starfood.controller; import com.kymryd.starfood.model.entities.OfferEntity; import com.kymryd.starfood.service.OfferService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; @CrossOrigin(origins = "*", maxAge = 3600) @RestController @RequestMapping("/offers") public class OfferController { @Autowired private OfferService offerService; @PostMapping public OfferEntity create(@RequestBody OfferEntity offer){ return offerService.create(offer); } @GetMapping(path = {"/{id}"}) public OfferEntity findOne(@PathVariable("id") int id){ return offerService.findById(id); } @PutMapping(path = {"/{id}"}) public OfferEntity update(@PathVariable("id") int id, @RequestBody OfferEntity offer){ offer.setOfferId(id); return offerService.update(offer); } @DeleteMapping(path ={"/{id}"}) public OfferEntity delete(@PathVariable("id") int id) { return offerService.delete(id); } @GetMapping public List<OfferEntity> findAll(){ return offerService.findAll(); } }
144c1a86ad201384cf99d66ceb30ee28d27e49c6
8336777a456a4af644bcc7112c9371fccb2b3ddb
/MRY/server/web/src/main/java/com/mry/entity/dao/system/TreatmentDao.java
e23501f5a7b3cd9e742e83bb146a759e0235bf2a
[]
no_license
SomeDargon/mry
9d54e8617a99762849ee01e2b7969dc2a32000fc
a7c633f746516cfcb602a699385f11c1f766f53b
refs/heads/master
2020-03-18T21:05:20.055536
2018-05-29T07:41:05
2018-05-29T07:41:05
135,258,484
0
0
null
null
null
null
UTF-8
Java
false
false
1,955
java
package com.mry.entity.dao.system; import com.mry.entity.dao.AbstractDao; import com.mry.entity.store.card.TreatmentCardManagement; import org.springframework.stereotype.Repository; import javax.persistence.Query; import java.util.List; /** * Created by kaik on 2018/1/7. */ @SuppressWarnings("unchecked") @Repository public class TreatmentDao extends AbstractDao<Object>{ public TreatmentCardManagement findById(Long id) { String querString = "SELECT d FROM TreatmentCardManagement d WHERE d.isEnable = true AND d.id = :id"; Query query = getEntityManager().createQuery(querString); query.setParameter("id",id); List<TreatmentCardManagement> list = query.getResultList(); return list.size() > 0 ? list.get(0) : null; } public int delete(Long id) { String querString = "UPDATE TreatmentCardManagement a SET a.isEnable=false WHERE a.id =:id"; Query query = getEntityManager().createQuery(querString); query.setParameter("id", id); int res=query.executeUpdate(); return res; } public List<TreatmentCardManagement> findTreatment(Long storeId,String name) { String str = "select u from TreatmentCardManagement u where u.isEnable = true"; if(storeId != null) { str +=" and u.storeId =:storeId"; } if(name != null && name !="") { str +=" and u.treatmentName like '%"+name+"%'"; } str +=" order by u.id desc"; Query query = getEntityManager().createQuery(str); query.setParameter("storeId", storeId); return query.getResultList(); } public int deleteProjectById(Long id) { String querString = "delete FROM ExtensionCardProject u where u.treatment.id =:id"; Query query = getEntityManager().createQuery(querString); query.setParameter("id", id); int res=query.executeUpdate(); return res; } }
d458cd2ac24bafc3f496067d3b3ed7f0b22d3c9a
53f69f20e5c8f15ad2b9191167beaf8e10eb4527
/Beto/arbol/src/arbol/tree.java
ab3803d981cb738fecfc5661e6c2af3d38cc393a
[]
no_license
i6arcia/Tree_AVL
7314729e02b23491307ad4b69eda2614040591c2
7c119337c938fb38cd44d938db7e78365a11695e
refs/heads/master
2021-01-10T10:11:59.281617
2015-12-02T10:09:55
2015-12-02T10:09:57
47,089,174
0
0
null
null
null
null
UTF-8
Java
false
false
3,771
java
package arbol; import javax.swing.JOptionPane; public class tree { private Nodo a; String sTxt="", sPre="", sOrd="", sPost=""; public void insert(int dato){ a = insert(dato, a); } private Nodo insert(int d, Nodo p){ if (p == null) p = new Nodo(d, null, null); else{ if (d == p.dato) return p; else if (d < p.dato){ p.left = insert(d, p.left); }else if (d > p.dato){ p.right = insert (d, p.right); } } p.prof = (profNodo(p.left)> profNodo(p.right) ? profNodo(p.left): profNodo(p.right))+1; p.facE = facEqNodo(p); if (p.facE > 1 || p.facE < -1){ JOptionPane.showMessageDialog(null, "El árbol quedaria desiquilibrado \n Nodo no agregado"); eliminarHoja(d, p); } return p; } private int profNodo(Nodo p){ return p == null ? -1 : p.prof; } private int facEqNodo(Nodo raiz){ int fEleft, fEright; fEleft = raiz.left == null ? -1 : raiz.left.prof; fEright = raiz.right == null ? -1 : raiz.right.prof; return fEright- fEleft; } public int facEqRaiz(){ if (a!= null){ int fEleft, fEright; fEleft = a.left == null ? -1 : a.left.prof; fEright = a.right == null ? -1 : a.right.prof; return fEright- fEleft; }else return 0; } private Nodo eliminarHoja (int dato, Nodo p){ if (p == null) ; else{ //Eliminar nodo raiz if (dato == p.dato && p.left == null && p.right == null){ p = null; return p; } else if (dato < p.dato){ if (p.left.dato == dato){ p.left = null; p.prof = (profNodo(p.left)> profNodo(p.right) ? profNodo(p.left): profNodo(p.right))+1; p.facE = facEqNodo(p); } else eliminarHoja(dato, p.left); } else if (dato > p.dato){ if (p.right.dato == dato){ p.right= null; p.prof = (profNodo(p.left)> profNodo(p.right) ? profNodo(p.left): profNodo(p.right))+1; p.facE = facEqNodo(p); } else eliminarHoja(dato, p.right); } } return p; } ////////////////////////////////// //Mostrar Árbol ///////////////////////////////// public String imprimir(int val){ if (val == 0){ sPre = "<html>"; return mostrarPre(a); }else if (val == 1){ sOrd = "<html>"; return mostrarOrd(a); }else if (val ==2){ sPost = "<html>"; return mostrarPost(a); } return ""; } public String mostrarPre(Nodo p){ if (p == null) ; else{ sPre += "dato -> [ "+ p.dato+" ]<br>" ; mostrarPre(p.left); mostrarPre(p.right); } return sPre; } public String mostrarOrd(Nodo p){ if (p == null) ; else{ mostrarOrd(p.left); sOrd += "Dato -> [ "+p.dato+" ]<br>" ; mostrarOrd(p.right); } return sOrd; } public String mostrarPost(Nodo p){ if (p == null) ; else{ mostrarPost(p.left); mostrarPost(p.right); sPost += "Dato -> [ "+p.dato+" ]<br>" ; } return sPost; } public Nodo getArbol (){ return a; } }
7290d046b998bad5af0ec4bda86798519889acf5
fe94bb01bbaf452ab1752cb3c1d1e4ecf297b9be
/src/main/java/com/opencart/entity/dao/OcLayoutRouteDao.java
a153ccf6b73a4f2b4b1ff8d9db02407cdbfc7d1d
[]
no_license
gmai2006/opencart
9d3b037f09294973112bafbadd22d5edd8457de5
dba44adabf4b8eab3bdb07062c887ba0a2a5405f
refs/heads/master
2020-12-31T06:13:33.113098
2018-01-24T07:35:45
2018-01-24T07:35:45
80,637,392
0
0
null
null
null
null
UTF-8
Java
false
false
1,137
java
/************************************************************************* * * DATASCIENCE9 LLC CONFIDENTIAL * __________________ * * [2018] Datascience9 LLC * All Rights Reserved. * * NOTICE: All information contained herein is, and remains * the property of Datascience9 LLC and its suppliers, * if any. The intellectual and technical concepts contained * herein are proprietary to Datascience9 LLC * and its suppliers and may be covered by U.S. and Foreign Patents, * patents in process, and are protected by trade secret or copyright law. * Dissemination of this information or reproduction of this material * is strictly forbidden unless prior written permission is obtained * from Datascience9 LLC. * @author Paul Mai - Datascience9 LLC */ package com.opencart.entity.dao; import java.util.List; import com.opencart.entity.*; public interface OcLayoutRouteDao { public List<OcLayoutRoute> select(int maxResult); public List<OcLayoutRoute> selectAll(); public OcLayoutRoute create(OcLayoutRoute e); public OcLayoutRoute update(OcLayoutRoute e); public void delete(OcLayoutRoute e); }
342ee7ec24f1c61e6620301831c82f98b4a4fd2d
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project3/src/main/java/org/gradle/test/performance3_2/Production3_164.java
8dbdbed0f775746cbe8982ca63a37ba6ecb4a075
[]
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
300
java
package org.gradle.test.performance3_2; public class Production3_164 extends org.gradle.test.performance2_2.Production2_164 { private final String property; public Production3_164() { this.property = "foo"; } public String getProperty() { return property; } }
d146be7d83e3e6416950860cf35d76f9714c3def
c97e8873b87c87f1ef59553de91fcf4ad3668feb
/src/AESViews/JFramePrincipal.java
3028929fd77fc1014924ef3f598766304c52b92b
[]
no_license
otamega93/AutismExpertSystem
e52247c2cb5b56994df6cf5a552fd83bc07ab219
ce6e65b6c31e9885f60d3f072c12943963dd37e6
refs/heads/master
2016-09-13T23:06:20.387306
2016-05-10T03:58:05
2016-05-10T03:58:05
58,093,801
0
0
null
null
null
null
UTF-8
Java
false
false
14,866
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package AESViews; import java.beans.PropertyVetoException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author otamega */ public class JFramePrincipal extends javax.swing.JFrame { /** * Creates new form NewJFramePrincipal */ public JFramePrincipal() { initComponents(); this.setExtendedState(JFramePrincipal.MAXIMIZED_BOTH); //this.setExtendedState(NewJFramePrincipal.MAXIMIZED_BOTH); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jMenuItem1 = new javax.swing.JMenuItem(); desktopPane = new javax.swing.JDesktopPane(); menuBar = new javax.swing.JMenuBar(); MenuRegisters = new javax.swing.JMenu(); jMenuItemNewPatient = new javax.swing.JMenuItem(); jMenuItemNewUser = new javax.swing.JMenuItem(); jMenuItemViewPatients = new javax.swing.JMenuItem(); jMenuItemViewUsers = new javax.swing.JMenuItem(); editMenu = new javax.swing.JMenu(); InitDiagnosisMenuItem = new javax.swing.JMenuItem(); deleteMenuItem = new javax.swing.JMenuItem(); patientDiagnosisMenuItem = new javax.swing.JMenuItem(); jMenu1 = new javax.swing.JMenu(); jMenuItem1.setText("jMenuItem1"); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("ESA: Sistema experto para el diagnóstico de autismo"); MenuRegisters.setMnemonic('f'); MenuRegisters.setText("Registro"); jMenuItemNewPatient.setMnemonic('o'); jMenuItemNewPatient.setText("Registrar nuevo paciente"); jMenuItemNewPatient.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemNewPatientActionPerformed(evt); } }); MenuRegisters.add(jMenuItemNewPatient); jMenuItemNewUser.setMnemonic('s'); jMenuItemNewUser.setText("Registrar nuevo usuario"); jMenuItemNewUser.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMenuItemNewUserMouseClicked(evt); } }); jMenuItemNewUser.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemNewUserActionPerformed(evt); } }); MenuRegisters.add(jMenuItemNewUser); jMenuItemViewPatients.setText("Ver pacientes"); jMenuItemViewPatients.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemViewPatientsActionPerformed(evt); } }); MenuRegisters.add(jMenuItemViewPatients); jMenuItemViewUsers.setText("Ver usuarios"); jMenuItemViewUsers.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMenuItemViewUsersMouseClicked(evt); } }); jMenuItemViewUsers.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItemViewUsersActionPerformed(evt); } }); MenuRegisters.add(jMenuItemViewUsers); menuBar.add(MenuRegisters); editMenu.setMnemonic('e'); editMenu.setText("Diagnóstico"); InitDiagnosisMenuItem.setMnemonic('t'); InitDiagnosisMenuItem.setText("Iniciar diagnóstico"); InitDiagnosisMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { InitDiagnosisMenuItemActionPerformed(evt); } }); editMenu.add(InitDiagnosisMenuItem); deleteMenuItem.setMnemonic('d'); deleteMenuItem.setText("Ver diagnósticos"); deleteMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { deleteMenuItemActionPerformed(evt); } }); editMenu.add(deleteMenuItem); patientDiagnosisMenuItem.setText("Ver pacientes diagnósticados"); patientDiagnosisMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { patientDiagnosisMenuItemActionPerformed(evt); } }); editMenu.add(patientDiagnosisMenuItem); menuBar.add(editMenu); jMenu1.setText("Salir"); jMenu1.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jMenu1MouseClicked(evt); } }); jMenu1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu1ActionPerformed(evt); } }); menuBar.add(jMenu1); setJMenuBar(menuBar); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 904, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(desktopPane, javax.swing.GroupLayout.DEFAULT_SIZE, 577, Short.MAX_VALUE) ); pack(); }// </editor-fold>//GEN-END:initComponents private void InitDiagnosisMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_InitDiagnosisMenuItemActionPerformed JInternalFrameStartDiagnosis FrameStartDiagnosis = new JInternalFrameStartDiagnosis(); desktopPane.add(FrameStartDiagnosis); FrameStartDiagnosis.show(); try { FrameStartDiagnosis.setMaximum(true); } catch (PropertyVetoException ex) { Logger.getLogger(JFramePrincipal.class.getName()).log(Level.SEVERE, null, ex); } FrameStartDiagnosis.setMaximizable(true); FrameStartDiagnosis.setIconifiable(true); FrameStartDiagnosis.setResizable(false); FrameStartDiagnosis.setClosable(true); FrameStartDiagnosis.toFront(); }//GEN-LAST:event_InitDiagnosisMenuItemActionPerformed private void jMenuItemNewPatientActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNewPatientActionPerformed JInternalFrameNewPatient FrameNewPatient = new JInternalFrameNewPatient(); desktopPane.add(FrameNewPatient); FrameNewPatient.show(); FrameNewPatient.setMaximizable(true); FrameNewPatient.setIconifiable(true); FrameNewPatient.setResizable(false); FrameNewPatient.setClosable(true); FrameNewPatient.toFront(); }//GEN-LAST:event_jMenuItemNewPatientActionPerformed private void jMenuItemViewUsersMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItemViewUsersMouseClicked // TODO add your handling code here: }//GEN-LAST:event_jMenuItemViewUsersMouseClicked private void jMenuItemNewUserMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenuItemNewUserMouseClicked }//GEN-LAST:event_jMenuItemNewUserMouseClicked private void jMenuItemNewUserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemNewUserActionPerformed JInternalFrameNewUser FrameNewUser = new JInternalFrameNewUser(); desktopPane.add(FrameNewUser); FrameNewUser.show(); FrameNewUser.setMaximizable(true); FrameNewUser.setIconifiable(true); FrameNewUser.setResizable(false); FrameNewUser.setClosable(true); FrameNewUser.toFront(); }//GEN-LAST:event_jMenuItemNewUserActionPerformed private void jMenuItemViewPatientsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemViewPatientsActionPerformed JInternalFrameViewPatient FrameViewPatient = new JInternalFrameViewPatient(); desktopPane.add(FrameViewPatient); FrameViewPatient.show(); try { FrameViewPatient.setMaximum(true); } catch (PropertyVetoException ex) { Logger.getLogger(JFramePrincipal.class.getName()).log(Level.SEVERE, null, ex); } FrameViewPatient.setMaximizable(true); FrameViewPatient.setIconifiable(true); FrameViewPatient.setResizable(false); FrameViewPatient.setClosable(true); FrameViewPatient.toFront(); }//GEN-LAST:event_jMenuItemViewPatientsActionPerformed private void deleteMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteMenuItemActionPerformed JInternalFrameViewDiagnosis FrameViewDiagnosis = new JInternalFrameViewDiagnosis(); desktopPane.add(FrameViewDiagnosis); FrameViewDiagnosis.show(); try { FrameViewDiagnosis.setMaximum(true); } catch (PropertyVetoException ex) { Logger.getLogger(JFramePrincipal.class.getName()).log(Level.SEVERE, null, ex); } FrameViewDiagnosis.setMaximizable(true); FrameViewDiagnosis.setIconifiable(true); FrameViewDiagnosis.setResizable(false); FrameViewDiagnosis.setClosable(true); FrameViewDiagnosis.toFront(); }//GEN-LAST:event_deleteMenuItemActionPerformed private void jMenuItemViewUsersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemViewUsersActionPerformed JInternalFrameViewUser FrameViewUser = new JInternalFrameViewUser(); desktopPane.add(FrameViewUser); FrameViewUser.show(); try { FrameViewUser.setMaximum(true); } catch (PropertyVetoException ex) { Logger.getLogger(JFramePrincipal.class.getName()).log(Level.SEVERE, null, ex); } FrameViewUser.setMaximizable(true); FrameViewUser.setIconifiable(true); FrameViewUser.setResizable(false); FrameViewUser.setClosable(true); FrameViewUser.toFront(); }//GEN-LAST:event_jMenuItemViewUsersActionPerformed private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu1ActionPerformed }//GEN-LAST:event_jMenu1ActionPerformed private void jMenu1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu1MouseClicked System.exit(0); }//GEN-LAST:event_jMenu1MouseClicked private void patientDiagnosisMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_patientDiagnosisMenuItemActionPerformed JInternalFramePatientDiagnosis jInternalFramePatientDiagnosis = new JInternalFramePatientDiagnosis(); desktopPane.add(jInternalFramePatientDiagnosis); jInternalFramePatientDiagnosis.show(); try { jInternalFramePatientDiagnosis.setMaximum(true); } catch (PropertyVetoException ex) { Logger.getLogger(JFramePrincipal.class.getName()).log(Level.SEVERE, null, ex); } jInternalFramePatientDiagnosis.setMaximizable(true); jInternalFramePatientDiagnosis.setIconifiable(true); jInternalFramePatientDiagnosis.setResizable(false); jInternalFramePatientDiagnosis.setClosable(true); jInternalFramePatientDiagnosis.toFront(); }//GEN-LAST:event_patientDiagnosisMenuItemActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(JFramePrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new JFramePrincipal().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JMenuItem InitDiagnosisMenuItem; private javax.swing.JMenu MenuRegisters; private javax.swing.JMenuItem deleteMenuItem; private javax.swing.JDesktopPane desktopPane; private javax.swing.JMenu editMenu; private javax.swing.JMenu jMenu1; private javax.swing.JMenuItem jMenuItem1; private javax.swing.JMenuItem jMenuItemNewPatient; private javax.swing.JMenuItem jMenuItemNewUser; private javax.swing.JMenuItem jMenuItemViewPatients; private javax.swing.JMenuItem jMenuItemViewUsers; private javax.swing.JMenuBar menuBar; private javax.swing.JMenuItem patientDiagnosisMenuItem; // End of variables declaration//GEN-END:variables }
9a9bb6d73a589f2f8fdd221a66edc028ff6ff984
bfcd3c3d2349a5a1ce67b307463f73dbd2f82364
/android-sdk/realtime-android/src/main/java/cn/leancloud/utils/RemoteInputCompatBase.java
795e47962e5605767b3c9de4ae3048cd685cc64e
[ "Apache-2.0" ]
permissive
leancloud/java-unified-sdk
02bf727fdcde33d9172a2eac46976f8dd5e71f62
4dee5b1ff167493a001052b56fd817c8865fdd2b
refs/heads/master
2023-06-26T05:10:08.906059
2023-06-14T08:04:54
2023-06-14T08:04:54
121,136,295
51
27
Apache-2.0
2023-06-14T08:01:37
2018-02-11T15:20:02
Java
UTF-8
Java
false
false
1,360
java
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.leancloud.utils; import android.os.Bundle; /* * copy from android-25 / android / support / v4 / app / */ class RemoteInputCompatBase { public static abstract class RemoteInput { protected abstract String getResultKey(); protected abstract CharSequence getLabel(); protected abstract CharSequence[] getChoices(); protected abstract boolean getAllowFreeFormInput(); protected abstract Bundle getExtras(); public interface Factory { RemoteInput build(String resultKey, CharSequence label, CharSequence[] choices, boolean allowFreeFormInput, Bundle extras); RemoteInput[] newArray(int length); } } }
f82c8203827ea570504ea2a2b9504e40193ad1ff
a57b452cd697227aecc26a5e878255985b72859a
/leetcode/IPO.java
c33c784eaf393704a1f217663a4422365b0cade3
[]
no_license
maruoovv/algorithm
17736457555f3224c318c7e12e8809189989e13c
6f3b1b7dfa1b72792a6b897b7bd76cd3788a04c2
refs/heads/master
2022-05-01T07:54:57.089928
2022-04-17T13:17:20
2022-04-17T13:17:20
239,527,254
1
0
null
null
null
null
UTF-8
Java
false
false
1,701
java
import java.util.Arrays; public class IPO { // 이익을 가장 극대화 하는 project 를 선택 하는 문제. // 현재의 capital 보다 같거나 작은 capital 만을 선택할 수 있다. public int findMaximizedCapital(int k, int W, int[] Profits, int[] Capital) { int ans = W; // ans 보다 같거나 작은 capital 을 선택해야 하고, // 그 중 가장 큰 profit 을 선택해야 함 // 이를 위해 먼저 Profit 의 크기 순으로 정렬을 한다. // 정렬된 배열에서, capital 의 값이 현재 capital 의 합보다 작거나 같은 첫번째 project를 선택하고 더해준다. // 배열보다 우선순위 큐를 활용하면 코드가 더 깔끔해지고 시간복잡도도 더 줄일 수 있을것 같다. int len = Profits.length; if (len == 0) return ans; int[][] pcMap = new int[len][3]; for (int i = 0; i < len; i++) { pcMap[i][0] = Profits[i]; pcMap[i][1] = Capital[i]; pcMap[i][2] = 0; } Arrays.sort(pcMap, (o1, o2) -> { if (o1[0] > o2[0]) return -1; else if (o1[0] < o2[0]) return 1; else { if (o1[1] < o2[1]) return 1; else if (o1[1] > o2[1]) return -1; else return 0; } }); while (k > 0) { k--; for (int i = 0; i < len; i++) { if (pcMap[i][2] == 0 && ans >= pcMap[i][1]) { ans += pcMap[i][0]; pcMap[i][2] = 1; break; } } } return ans; } }
d681b7b5dd0f80c3ee432f3e0d6e0b0f82343a38
da95a88e5896a27dd1ab142bfa621e016cac4abd
/src/test/java/com/xx/spring/jdbc/dao/JdbcTemplateTest.java
3ad57ed320889b2e657a9de59da19578596cb29e
[]
no_license
wxiaoxin/spring-jdbc
e1d10ec625f115338f1cb4f3019a041989f8813c
e30b947006b0a4ecc7da7a01f76aef0fe3ea723c
refs/heads/master
2021-01-13T12:49:24.763726
2016-09-27T08:41:58
2016-09-27T08:41:58
69,238,949
0
0
null
null
null
null
UTF-8
Java
false
false
11,331
java
package com.xx.spring.jdbc.dao; import com.xx.spring.jdbc.entity.User; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.jdbc.core.RowCallbackHandler; import org.springframework.jdbc.core.RowMapper; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import javax.sql.DataSource; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; import java.util.List; import java.util.Map; /** * Created by wxiao on 2016.9.20. */ @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {"classpath:applicationContext.xml"}) public class JdbcTemplateTest { private JdbcTemplate jt; @Autowired private void setJt(DataSource dataSource) { jt = new JdbcTemplate(dataSource); } @Test public void testExecute() { // 创建表 // String sql = "create table a(id int)"; // 添加列 // String sql = "ALTER TABLE a ADD name VARCHAR(20) NOT NULL"; // 删除列 // String sql = "ALTER TABLE a DROP name"; // 修改列 // String sql = "ALTER TABLE a " String sql = "CREATE TABLE t_user (" + "id VARCHAR(64) PRIMARY KEY COMMENT '主键'," + "name VARCHAR(20) NOT NULL COMMENT '用户名'," + "pwd VARCHAR(20) NOT NULL COMMENT '密码'," + "status INT NOT NULL COMMENT '状态码:0-正常 -1-删除 1-禁用'" + ")"; jt.execute(sql); } /** * update用于添加数据操作 */ @Test public void testInsert() { // 无参 // String sql = "insert into a values(222,'222')"; // int result = jt.update(sql); // 有参 String sql = "insert into a values(?, ?)"; // 变长Object类型参数 int result = jt.update(sql, 123, "123"); // Object类型数组 // int result = jt.update(sql, new Object[]{234, "234"}); System.out.println(result); } /** * update用于删除数据 */ @Test public void testDel() { // 无参 // String sql = "delete from a where id=456"; // int result = jt.update(sql); // 有参 String sql = "delete from a where id=? "; // int result = jt.update(sql, 111); int result = jt.update(sql, new Object[]{111}); System.out.println(result); } /** * update用于修改数据 */ @Test public void testUpdate() { // 无参 // String sql = "update a set name='aaa' where id=111 "; // int result = jt.update(sql); // 有参 String sql = "update a set name=? where id=? "; // int result = jt.update(sql, 333); int result = jt.update(sql, new Object[]{"haaa",222}); System.out.println(result); } /** * 查询 * ResultSetExtractor 用于结果集数据提取,用户需实现方法extractData(ResultSet rs)来处理结果集,用户必须处理整个结果集 */ @Test public void query1() { // 无参 String sql = "select * from t_user t where t.id='444652e3-c95a-493b-b385-7f81d7f8a546'"; User user = jt.query(sql, new ResultSetExtractor<User>() { @Override public User extractData(ResultSet rs) throws SQLException, DataAccessException { User user = new User(); while (rs.next()) { user.setId(rs.getString("id")); user.setName(rs.getString("name")); user.setPwd(rs.getString("pwd")); user.setStatus(rs.getInt("status")); } return user; } }); System.out.println(user); // 有参 // String sql2 = "select * from t_user t where t.id=? and t.status=? "; String sql2 = "select * from t_user t where t.id=? "; User user2 = jt.query(sql2, new Object[]{"444652e3-c95a-493b-b385-7f81d7f8a546"}, new int[]{Types.VARCHAR}, new ResultSetExtractor<User>() { @Override public User extractData(ResultSet rs) throws SQLException, DataAccessException { User user = new User(); while (rs.next()) { user.setId(rs.getString("id")); user.setName(rs.getString("name")); user.setPwd(rs.getString("pwd")); user.setStatus(rs.getInt("status")); } return user; } }); // User user = jt.query(sql, new ResultSetExtractor<User>() { // @Override // public User extractData(ResultSet rs) throws SQLException, DataAccessException { // User user = new User(); // while (rs.next()) { // user.setId(rs.getString("id")); // user.setName(rs.getString("name")); // user.setPwd(rs.getString("pwd")); // user.setStatus(rs.getInt("status")); // } // return user; // } // }, "", -1); System.out.println(user2); } /** * RowCallbackHandler 用于处理ResultSet的每一行结果,用户需实现方法processRow(ResultSet rs)来完成处理 * 在该回调方法中无需执行rs.next(),该操作由JdbcTemplate来执行,用户只需按行获取数据然后处理即可 */ @Test public void query2() { String sql = "select * from t_user t where t.id=? "; // jt.query(sql, new Object[]{"444652e3-c95a-493b-b385-7f81d7f8a546"}, new RowCallbackHandler() { // @Override // public void processRow(ResultSet rs) throws SQLException { // User user = new User(); // user.setId(rs.getString("id")); // user.setName(rs.getString("name")); // user.setPwd(rs.getString("pwd")); // user.setStatus(rs.getInt("status")); // System.out.println(user); // } // }); jt.query(sql, new RowCallbackHandler() { @Override public void processRow(ResultSet rs) throws SQLException { User user = new User(); user.setId(rs.getString("id")); user.setName(rs.getString("name")); user.setPwd(rs.getString("pwd")); user.setStatus(rs.getInt("status")); System.out.println(user); } }, new Object[]{"444652e3-c95a-493b-b385-7f81d7f8a546"}); } /** * RowMapper 用于将结果集每行数据转换为需要的类型,用户需实现方法mapRow(ResultSet rs, int rowNum)来完成将每行数据转换为相应的类型 */ @Test public void query3() { String sql = "select * from t_user t"; List<User> userList = jt.query(sql, new RowMapper<User>() { @Override public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); user.setId(rs.getString("id")); user.setName(rs.getString("name")); user.setPwd(rs.getString("pwd")); user.setStatus(rs.getInt("status")); return user; } }); System.out.println(userList); } /** * queryForList 将查询结果包装成Map<String, Object>类型的数据 */ @Test public void query4() { // 查询结果 List<Map<String, Object>> result; // 无参 String sql = "select * from t_user t"; // result = jt.queryForList(sql); // 有参 String sql2 = "select * from t_user t where t.status=? "; result = jt.queryForList(sql2, 0); // for(Map<String, Object> map : result) { // User user = new User(); // user.setId(String.valueOf(map.get("id"))); // user.setName(String.valueOf(map.get("name"))); // user.setPwd(String.valueOf(map.get("pwd"))); // user.setStatus(Integer.valueOf(String.valueOf(map.get("status")))); // System.out.println(user); // } /** * queryForList(String sql, Class<T> elementTypes, Object... args) * 只能用于查询单独列值 */ String sql3 = "select name from t_user t where t.status=? "; List<String> userList = jt.queryForList(sql3, String.class, 0); for(String user : userList) { System.out.println(userList); } } /** * 查询单行数据,并将结果封装在Map<String, Object>中 */ @Test public void query5() { String sql = "select * from t_user t where t.id=? "; Map<String, Object> map = jt.queryForMap(sql, "444652e3-c95a-493b-b385-7f81d7f8a546"); User user = new User(); user.setId(String.valueOf(map.get("id"))); user.setName(String.valueOf(map.get("name"))); user.setPwd(String.valueOf(map.get("pwd"))); user.setStatus(Integer.valueOf(String.valueOf(map.get("status")))); System.out.println(user); } /** * 返回单行单列的值 */ @Test public void query6() { String name; String sql = "select t.name from t_user t where t.id='444652e3-c95a-493b-b385-7f81d7f8a546' "; name = jt.queryForObject(sql, String.class); String sql2 = "select t.name from t_user t where t.id=? "; // name = jt.queryForObject(sql2, String.class, "444652e3-c95a-493b-b385-7f81d7f8a546"); name = jt.queryForObject(sql2, new Object[]{"444652e3-c95a-493b-b385-7f81d7f8a546"}, String.class); // System.out.println(name); String sql3 = "select t.* from t_user t where t.id='444652e3-c95a-493b-b385-7f81d7f8a546'"; User user = jt.queryForObject(sql3, new RowMapper<User>() { @Override public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); user.setId(rs.getString("id")); user.setName(rs.getString("name")); user.setPwd(rs.getString("pwd")); user.setStatus(rs.getInt("status")); return user; } }); System.out.println(user); String sql4 = "select t.* from t_user t where t.id=? "; User user2 = jt.queryForObject(sql4, new RowMapper<User>() { @Override public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); user.setId(rs.getString("id")); user.setName(rs.getString("name")); user.setPwd(rs.getString("pwd")); user.setStatus(rs.getInt("status")); return user; } }, "444652e3-c95a-493b-b385-7f81d7f8a546"); System.out.println(user2); } }
18ab3d98f90420a3b10f40097681cad1d43b129c
bccb412254b3e6f35a5c4dd227f440ecbbb60db9
/hl7/model/V2_5/table/Table0442.java
62ae440ed46d73c5377d47b8960d89a2f6c9651d
[]
no_license
nlp-lap/Version_Compatible_HL7_Parser
8bdb307aa75a5317265f730c5b2ac92ae430962b
9977e1fcd1400916efc4aa161588beae81900cfd
refs/heads/master
2021-03-03T15:05:36.071491
2020-03-09T07:54:42
2020-03-09T07:54:42
245,967,680
0
0
null
null
null
null
UTF-8
Java
false
false
626
java
package hl7.model.V2_5.table; import hl7.bean.table.Table; public class Table0442 extends Table{ private static final String VERSION = "2.5"; public static Table getInstance(){ if(table==null) new Table0442(); return table; } public static final String D = "D"; public static final String E = "E"; public static final String P = "P"; public static final String T = "T"; private Table0442(){ setTableName("Location Service Code"); setOID("2.16.840.1.113883.12.442"); putMap("D", "Diagnostic"); putMap("E", "Emergency Room Casualty"); putMap("P", "Primary Care"); putMap("T", "Therapeutic"); } }
750c6636318dac51eb371ed2571e997eb66be29e
3d17822bb2d2871340796409e69906850482643d
/src/main/java/org/capgemini/social/api/service/SocialFriendBlockingServiceImpl.java
545bcff58b46340b76b432d32c0aaf7792d366ab
[]
no_license
vishwakarma19/social-frd-mgnt-test
55dfd6deb99d5dc592b8fa5729a352957850cad1
e91acfe71562a92025f62aeaa891df65e9e4126e
refs/heads/master
2020-04-23T06:20:35.734003
2019-02-21T17:28:25
2019-02-21T18:14:44
170,970,097
0
0
null
null
null
null
UTF-8
Java
false
false
2,478
java
package org.capgemini.social.api.service; import java.util.List; import org.capgemini.social.api.dto.ToggleFriendSubscribeDTO; import org.capgemini.social.api.exception.FriendBlockingException; import org.capgemini.social.api.exception.InvalidFriendRequestException; import org.capgemini.social.api.model.SocialFriendBlock; import org.capgemini.social.api.repository.SocialFriendBlockRepository; import org.capgemini.social.api.util.SocialFriendValidationUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cglib.core.Block; import org.springframework.stereotype.Service; /** * @author Ravi */ @Service public class SocialFriendBlockingServiceImpl implements SocialFriendBlockingService { private static final Logger LOGGER = LoggerFactory.getLogger(SocialFriendBlockingServiceImpl.class); @Autowired SocialFriendValidationUtils socialFrdValidationUtils; @Autowired SocialFriendBlockRepository blockRepo; @Override public void block(ToggleFriendSubscribeDTO toggleSubscriptionDTO) { LOGGER.info("blocking status {} {}", toggleSubscriptionDTO.getRequestor(), toggleSubscriptionDTO.getTarget()); checkBlockCondition(toggleSubscriptionDTO.getRequestor(), toggleSubscriptionDTO.getTarget()); } /** * @param requestor * @param target */ private void checkBlockCondition(final String requestor, final String target) { LOGGER.info("blocking condition {} {}", requestor, target); if (requestor == null || target == null) { throw new InvalidFriendRequestException("Invalid request :Required requestor and target"); } socialFrdValidationUtils.validateFriendShipCriteria(requestor, target); List<String> targetBlockers = blockRepo.fetchBlockers(target); if (targetBlockers.contains(requestor)) { LOGGER.info("Exception :: blocking condition {} {}", requestor, target); throw new FriendBlockingException(requestor, target); } blockRepo.save(createBlock(requestor, target)); LOGGER.info("blocking condition {} {}", requestor, target); } /** * @param requestor * @param target * @return SocialFriendBlock */ private SocialFriendBlock createBlock(final String requestor, final String target) { return new SocialFriendBlock(requestor, target); } }
7f56d0dbb84c0d568bd1d6118ac4e2084e0ae5f4
87ab3f04169772ee22862218e4eeda9d31f8bb0b
/leetcode/src/main/java/com/yangzl/StateMachine.java
08c29d6e2a82b144cd1e809bc1322d5a4f3aaede
[]
no_license
Timesless/awesome-java
0bf45b4d235a477611f1c13015bfb26ba4bca862
62fedd8939447919a92a70b3529ce65828e8fe94
refs/heads/master
2023-06-29T00:30:35.584869
2021-07-24T03:05:07
2021-07-24T03:05:07
216,328,240
0
1
null
null
null
null
UTF-8
Java
false
false
7,786
java
package com.yangzl; import org.junit.jupiter.api.Test; /** * @author yangzl * @date 2020/4/19 22:33 * * 状态机 */ public class StateMachine { // ======================================================================= // 121. 买卖股票的最佳时机 // 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 // 如果你最多只允许完成一笔交易(即买入和卖出一支股票一次),设计一个算法来计算你所能获取的最大利润。 // 注意:你不能在买入股票前卖出股票。 // 输入: [7,1,5,3,6,4] 输出: 5 // 输入: [7,6,4,3,1] 输出: 0 // ======================================================================= public int maxProfit(int[] prices) { int n = prices.length; if (n < 2) return 0; // 状态机解法 // dp[i][k][0] 当前第i天,总共允许k次交易,未持有股票的利润 // dp[i][k][1] 当前第i天,总共允许k次交易,持有股票的利润 // 该题k = 1, 所以直接降维 int[][] dp = new int[n][2]; // base case,第一天未持有股票利润0,持有股票利润-prices[0] // dp[0][0] = 0; dp[0][1] = -prices[0]; for (int i = 0; i < n; ++i) { // 未持有股票有两种可能 -> 前一天未持有股票;前一天持有股票今天sell dp[i][0] = Math.max(dp[i-1][0], dp[i-1][1] + prices[i]); // 持有股票两种可能 -> 前一天持有股票今天ret,前一天未持有股票今天buy(buy会消耗一次k,k = 0为basecase) dp[i][1] = Math.max(dp[i-1][1], -prices[i]); } return dp[n - 1][0]; } // ======================================================================= // 122. 买卖股票的最佳时机 II // 给定一个数组,它的第 i 个元素是一支给定股票第 i 天的价格。 // 设计一个算法来计算你所能获取的最大利润。你可以尽可能地完成更多的交易(多次买卖一支股票)。 // 注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 // 输入: [7,1,5,3,6,4] 输出: 7 // ======================================================================= public int maxProfit2(int[] prices) { int n = prices.length; if (n < 2) return 0; // dp[i][k][0] // dp[i][k][1] // k无限直接降维,且dp[i][1]只由dp[i-1][0]这个状态转移而来(dp[i][0]同理),再降维 int unHold = 0, hold = Integer.MIN_VALUE; for (int i = 0; i < n; ++i) { int tmp = unHold; // 未持有分两种情况 unHold = Math.max(unHold, hold + prices[i]); // 持有分两种情况,前一天持有今天ret,前一天未持有今天buy hold = Math.max(hold, tmp - prices[i]); } return unHold; } // ======================================================================= // 714. 买卖股票的最佳时机含手续费 // 给定一个整数数组 prices,其中第 i 个元素代表了第 i 天的股票价格 ;非负整数 fee 代表了交易股票的手续费用。 // 你可以无限次地完成交易,但是你每笔交易都需要付手续费。如果你已经购买了一个股票,在卖出它之前你就不能再继续购买股票了。 // 返回获得利润的最大值。注意:这里的一笔交易指买入持有并卖出股票的整个过程,每笔交易你只需要为支付一次手续费。 // 输入: prices = [1, 3, 2, 8, 4, 9], fee = 2 输出: 8 // ======================================================================= public int maxProfit3(int[] prices, int fee) { int n = prices.length; if (n < 2) return 0; int unHold = 0, hold = Integer.MIN_VALUE; for (int i = 0; i < n; ++i) { // 前一天未持有股票的利润(先保存一下) int tmp = unHold; unHold = Math.max(unHold, hold + prices[i]); hold = Math.max(hold, tmp - prices[i] - fee); } return unHold; } // ======================================================================= // 309. 最佳买卖股票时机含冷冻期 // 给定一个整数数组,其中第 i 个元素代表了第 i 天的股票价格 。​ // 设计一个算法计算出最大利润。在满足以下约束条件下,你可以尽可能地完成更多的交易(多次买卖一支股票): // 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 // 卖出股票后,你无法在第二天买入股票 (即冷冻期为 1 天)。 // 输入: [1,2,3,0,2] 输出: 3 解释: 对应的交易状态为: [买入, 卖出, 冷冻期, 买入, 卖出] // ======================================================================= public int maxProfit4(int[] prices) { int n = prices.length; if (n < 2) return 0; int[][] dp = new int[n][2]; /* * dp[i][k][0] * dp[i][k][1] * 这里k取无限,直接降维 * 注意含冷冻期 */ // base case -> 第一天未持有股票利润位0, 持有股票利润为-prices[0] // dp[0][0] = 0; dp[0][1] = -prices[0]; for (int i = 1; i < n; ++i) { dp[i][0] = Math.max(dp[i-1][0], dp[i-1][1] + prices[i]); // 前一天未持有股票,今天买入(今天买入需要看今天之前的两天是卖出) // <= 0天未斥候股票的利润都是0, 所以当i <= 1时dp[i-2][0] = 0 dp[i][1] = i > 1 ? Math.max(dp[i-1][1], dp[i-2][0] - prices[i]) : Math.max(dp[i-1][1], 0 - prices[i]); } return dp[n-1][0]; } @Test public void testMaxProfit4() { int[] prices = {1, 2, 3, 0, 2}; System.out.println(maxProfit4(prices)); } // ======================================================================= // 188. 买卖股票的最佳时机 IV // 给定一个数组,它的第 i 个元素是一支给定的股票在第 i 天的价格。 // 设计一个算法来计算你所能获取的最大利润。你最多可以完成 k 笔交易。 // 注意: 你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 // 输入: [2,4,1], k = 2 输出: 2 // 解释: 在第 1 天 (股票价格 = 2) 的时候买入,在第 2 天 (股票价格 = 4) 的时候卖出,这笔交易所能获得利润 = 4-2 = 2 。 // ======================================================================= public int maxProfit6(int k, int[] prices) { int n = prices.length; if (n < 2 || k < 1) return 0; if (k > (n >>> 1)) { // 这里相当于k取无限,直接降维 // 且今天持有状态只与前一天未持有状态,今天未持有只与前一天持有状态有关,所以2个状态足以保存 int unHold = 0, hold = Integer.MIN_VALUE; for (int i = 0; i < n; ++i) { // 前一天未持有股票的利润(先保存一下) int tmp = unHold; unHold = Math.max(unHold, hold + prices[i]); hold = Math.max(hold, tmp - prices[i]); } return unHold; } // 状态机 // dp[i][k][0] 当前第i天,完成k笔交易,未持有股票的最大利润 // dp[i][k][1] 当前第i天,完成k笔交易,持有股票的最大利润 int[][][] dp = new int[n][k + 1][2]; // base case // 1 -> k = 0时, 利润为0 // 2 -> i = 0时,第一天未持有利润为0,第一天持有股票利润为-prices[0] for (int i = 1; i <= k; ++i) { // dp[0][i][0] = 0; dp[0][i][1] = -prices[0]; } for (int i = 1; i < n; ++i) { for (int j = k; j >= 1; --j) { // 当天(i)未持有股票,前一天未持有今天ret,前一天持有今天sell dp[i][j][0] = Math.max(dp[i-1][j][0], dp[i-1][j][1] + prices[i]); // 当前持有股票,买股票需要消耗一次交易(在卖股票的时候-1同样可以) dp[i][j][1] = Math.max(dp[i-1][j][1], dp[i-1][j-1][0] - prices[i]); } } return dp[n-1][k][0]; } @Test public void test2() { int[] prices = {3, 2, 6, 5, 0, 3}; System.out.println(maxProfit6(20, prices)); } }
0e3a98371fcd9923a8214470fc0a8fa81ed5b800
8728ea0aeedd6df212c226ac8a3c12cba047f5e4
/app/src/main/java/il/co/idocare/authentication/LoggedInUserEntity.java
c584801d5d56703377b352a5c4d5e9f677a84f59
[]
no_license
Rikenm/idocare-android
e13a39ca1e704bed2fca5323594f9a02713042d1
af9dbe752e987cb096ad2d7be22824f0f3e5bb22
refs/heads/master
2020-03-31T06:09:56.942757
2018-09-04T13:09:09
2018-09-04T13:09:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
577
java
package il.co.idocare.authentication; /** * This POJO encapsulates information related to logged in user */ public class LoggedInUserEntity { private final String mEmail; private final String mUserId; private final String mAuthToken; public LoggedInUserEntity(String email, String userId, String authToken) { mEmail = email; mUserId = userId; mAuthToken = authToken; } public String getAuthToken() { return mAuthToken; } public String getUserId() { return mUserId; } }
86d5d72fc5564879ac742962469472de4d7bae64
f601065e7a8a4adcb0befa9fc436354ed8922b5f
/src/main/java/com/ocp/day23/SetDemo5.java
971f743915cbd614a0de3a064cc84a1f151ef464
[]
no_license
Beast090320/Java0316
a17336ab7ceb8f29a88ffd014f0949bd131911ea
1a42edf5ba99bfb978f7fdce2d47058a09ec0536
refs/heads/master
2023-05-12T05:55:00.830995
2021-06-10T13:51:33
2021-06-10T13:51:33
348,325,835
0
0
null
null
null
null
UTF-8
Java
false
false
523
java
package com.ocp.day23; import java.util.Random; import java.util.Set; import java.util.TreeSet; public class SetDemo5 { public static void main(String[] args) { // 排序性 (小 -> 大) Set<Integer> nums = new TreeSet<>(); // 1-9 任意 5 個 Random r = new Random(); while (nums.size() < 7) { int n = r.nextInt(9) + 1; System.out.println("n: " + n); nums.add(n); } System.out.println(nums); } }
c09602e1391c94b3c3f28a286a93b72cf0fc503c
3b293f4ffd93b8af98283206d34c62d5c50faf85
/spring-boot-jdbc/src/main/java/com/spring/dao/GenreDaoJdbc.java
3d9cc67aa0de455751d8944a6fda91a69d9e77e2
[]
no_license
sojicute/spring-projects
b40018469b6f8df88ab67282bf59426397e3568c
a06589862bd6f1f3982e169cb2a52ea27622a6e7
refs/heads/master
2023-08-13T09:35:30.162703
2021-10-12T18:43:27
2021-10-12T18:43:27
406,057,784
0
0
null
null
null
null
UTF-8
Java
false
false
1,664
java
package com.spring.dao; import com.spring.domain.Author; import com.spring.domain.Genre; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations; import org.springframework.stereotype.Repository; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.Map; @Repository public class GenreDaoJdbc implements GenreDao { private NamedParameterJdbcOperations jdbc; public GenreDaoJdbc(NamedParameterJdbcOperations jdbc) { this.jdbc = jdbc; } @Override public int count() { return jdbc.getJdbcOperations().queryForObject("select count(*) from genres", Integer.class); } @Override public void insert(Genre genre) { jdbc.update("insert into genres(id, name) values(:id, :name)", Map.of("id", genre.getId(), "name", genre.getName())); } @Override public Genre getById(long id) { return jdbc.queryForObject("select * from genres where genres.id = :id", Map.of("id", id), new GenreMapper()); } @Override public List<Genre> getAll() { return jdbc.query("select * from genres", new GenreMapper()); } @Override public void deleteById(long id) { jdbc.update("delete from genres where id = :id", Map.of("id", id)); } public static class GenreMapper implements RowMapper<Genre> { @Override public Genre mapRow(ResultSet resultSet, int i) throws SQLException { long id = resultSet.getLong("id"); String name = resultSet.getString("name"); return new Genre(id, name); } } }
a070e88b6105bc4da9ab0339bf581d4acc9692ae
4d7a0f00d7dc9050e4118bec612bdae8925a37d1
/app/src/main/java/com/patels95/sanam/ribbit/ui/LoginActivity.java
a4d1e2ee0245d3a0219d6a462400ad6b57235f24
[]
no_license
patels95/Ribbit
c2e59305365e914c41a07f880b607d819c0bd93f
ffd2eec9d7106cd6be11fc93bb94cff8715ccdc2
refs/heads/master
2020-12-24T14:18:41.676168
2015-11-11T17:19:59
2015-11-11T17:19:59
33,511,461
0
0
null
null
null
null
UTF-8
Java
false
false
4,038
java
package com.patels95.sanam.ribbit.ui; import android.app.AlertDialog; import android.content.Intent; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.os.Bundle; import android.view.View; import android.view.Window; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import com.parse.LogInCallback; import com.parse.ParseException; import com.parse.ParseUser; import com.patels95.sanam.ribbit.R; import com.patels95.sanam.ribbit.RibbitApplication; import butterknife.ButterKnife; import butterknife.InjectView; public class LoginActivity extends ActionBarActivity { @InjectView(R.id.signUpText) TextView mSignUpTextView; @InjectView(R.id.usernameField) EditText mUsername; @InjectView(R.id.passwordField) EditText mPassword; @InjectView(R.id.loginButton) Button mLoginButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); setContentView(R.layout.activity_login); ButterKnife.inject(this); // hide the action bar ActionBar actionBar = getSupportActionBar(); actionBar.hide(); mLoginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // get String text from user input. trim() will remove whitespace String username = mUsername.getText().toString().trim(); String password = mPassword.getText().toString().trim(); // display error message in AlertDialog if (username.isEmpty() || password.isEmpty()) { AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this); builder.setMessage(R.string.login_error_message) .setTitle(R.string.login_error_title) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } else { // login setSupportProgressBarIndeterminateVisibility(true); ParseUser.logInInBackground(username, password, new LogInCallback() { @Override public void done(ParseUser parseUser, ParseException e) { setSupportProgressBarIndeterminateVisibility(false); if (e == null) { // successful login RibbitApplication.updateParseInstallation(parseUser); Intent intent = new Intent(LoginActivity.this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); startActivity(intent); } else { AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this); builder.setMessage(e.getMessage()) .setTitle(R.string.login_error_title) .setPositiveButton(android.R.string.ok, null); AlertDialog dialog = builder.create(); dialog.show(); } } }); } } }); mSignUpTextView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LoginActivity.this, SignUpActivity.class); startActivity(intent); } }); } }
40515ec93197f5ce2b3f5ecc048a853e2df59ce1
4e96f27aed9325a7e5a8c55f50261b5fb02176e8
/lzw-item/lzw-item-interface/src/main/java/com/lzw/item/pojo/TbSpecification.java
6cd2e28456e13ec5253a56097cfc589b2cc0aeb2
[]
no_license
lzw1017400172/LZW_DS
6c0d3e34161710656aac08233c8a1875b62bef0f
7267f1f42e90cc984d9f6b32d660b30f7ea28b35
refs/heads/master
2020-05-05T03:47:59.048192
2019-05-12T09:24:37
2019-05-12T09:24:37
179,685,516
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package com.lzw.item.pojo; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import lombok.Data; import java.io.Serializable; /** * <p> * 分类-规格模版 * </p> * * @author LZW * @since 2019-04-06 */ @TableName("tb_specification") @Data public class TbSpecification implements Serializable { private static final long serialVersionUID = 1L; /** * 规格模板所属商品分类id */ @TableId("category_id") private Long categoryId; /** * 规格参数模板,json格式 */ private String specifications; }
99c3e6e746a8389958e409f88d082ff527d061ac
2f680f78f6e5a4a2252ab3afd8d4dca0ade2a6da
/Hangman-Patterns/src/hangman/domain/Player.java
ba1b61cfde5dee31991be94e897cc0aa18514d9c
[]
no_license
stapetro/hangman-design-patterns
134c0fb64c00b947dd2991233a6cd8f92df9c1c6
ad9ee670e59357d86e3460fed096605e592be68a
refs/heads/master
2021-01-01T17:06:05.349971
2015-05-24T12:11:10
2015-05-24T12:11:10
32,282,140
1
0
null
null
null
null
UTF-8
Java
false
false
3,173
java
package hangman.domain; import hangman.constants.PlayerProperty; import java.util.HashMap; /** * Represents player of hangman game. * * @author Stanislav Petrov * */ public class Player implements Comparable<Player> { private String name; private Integer totalMistakes; private boolean cheatTheGame; /** * Initializes player's information to default values. */ public Player() { this.name = ""; this.totalMistakes = 0; this.cheatTheGame = false; } public Player(String name, int totalMistakes) { this(); this.name = name; this.totalMistakes = totalMistakes; } public Player(Player player) { this(player.getName(), player.getTotalMistakes()); this.cheatTheGame = player.isCheatTheGame(); } public Player(HashMap<String, String> playerProperties) { if (playerProperties.size() > 0) { PlayerProperty[] playerPropertyNames = PlayerProperty.values(); String propValue = null; for (PlayerProperty playerPropName : playerPropertyNames) { propValue = playerProperties.get(playerPropName.toString()); if (propValue != null) { setProperty(playerPropName, propValue); } } } } public String getName() { return name; } public void setName(String name) { this.name = name; } public void setCheatTheGame(boolean cheatTheGame) { this.cheatTheGame = cheatTheGame; } public boolean isCheatTheGame() { return this.cheatTheGame; } public Integer getTotalMistakes() { return this.totalMistakes; } public HashMap<String, String> getProperties() { HashMap<String, String> playerProperties = new HashMap<String, String>(); if ((this.name != null && this.name.length() > 0) && this.totalMistakes != null) { playerProperties.put(PlayerProperty.NAME.toString(), this.name); playerProperties.put(PlayerProperty.TOTAL_MISTAKES.toString(), this.totalMistakes.toString()); } return playerProperties; } public void incrementTotalMistakes() { this.totalMistakes++; } @Override public int compareTo(Player otherPlayer) { Integer otherPlayerTotalMistakes = otherPlayer.getTotalMistakes(); if (this.totalMistakes == null && otherPlayerTotalMistakes != null) { return -1; } else if (this.totalMistakes != null && otherPlayerTotalMistakes == null) { return 1; } else if (this.totalMistakes == null && otherPlayerTotalMistakes == null) { return 0; } return this.totalMistakes.compareTo(otherPlayer.getTotalMistakes()); } public String toString() { return String.format( "Player name: %s, Total mistakes: %d, Cheated: %b", this.name, this.totalMistakes, this.cheatTheGame); } private void setProperty(PlayerProperty playerPropName, String propValue) { switch (playerPropName) { case NAME: this.name = propValue; break; case TOTAL_MISTAKES: try { this.totalMistakes = Integer.valueOf(propValue); } catch (NumberFormatException ex) { System.out.println("Total mistakes property value '" + propValue + "' cannot be parsed."); ex.printStackTrace(); } break; } } }
[ "devilfighter1806@47e568b5-045d-55d2-85c0-dd34ee1906ef" ]
devilfighter1806@47e568b5-045d-55d2-85c0-dd34ee1906ef
3db6ccba50269d05f1d6d31785cb799f1a773460
3c8db443f46fe2f1a66ec262d0c842bef6e98ce0
/src/datastructure/stack/InfixToPostfix.java
c66fb3f4780009341ab78ebabdae45095b26b8c2
[]
no_license
vijaymishra94/DataStructureAndAlgorithms
6f58dcd0fe39be604c859f764bff7bb84734acc4
3c23abc58f0552518dee12ee8a609f28c1699318
refs/heads/master
2023-05-12T06:58:21.316492
2021-05-15T05:41:02
2021-05-15T05:41:02
367,548,037
0
0
null
null
null
null
UTF-8
Java
false
false
1,280
java
package datastructure.stack; import java.util.Stack; /** * @author vijay * */ public class InfixToPostfix { public int precedence(char ch) { switch (ch) { case '+': case '-': return 1; case '*': case '/': return 2; case '^': return 3; default: return -1; } } public String convert(String expression) { StringBuffer buffer = new StringBuffer(); Stack<Character> stack = new Stack<>(); for (int i = 0; i < expression.length(); i++) { char c = expression.charAt(i); if (Character.isLetterOrDigit(c)) { buffer.append(c); continue; } else if (c == '(') { stack.push(c); } else if (c == ')') { while (!stack.isEmpty() && stack.peek() != '(') { buffer.append(stack.pop()); } stack.pop(); } else { while (!stack.isEmpty() && precedence(c) <= precedence(stack.peek())) { buffer.append(stack.pop()); } stack.push(c); } } return buffer.toString(); } public static void main(String[] args) { String expression = "a+b*(c^d-e)^(f+g*h)-i"; InfixToPostfix infixToPostfix = new InfixToPostfix(); String postfix = infixToPostfix.convert(expression); System.out.println("Infix Expression :- " + expression); System.out.println("Postfix Expression :- " + postfix); } }
d2264d917e4dc41ea969ccc63e2b40d074c0786a
f1400dc557838d00475e79d0ae885a02e6106baa
/app/src/main/java/com/jgermaine/fyp/samplesforca/TableForm.java
aea27965502866877882c0528955be4c5f225bd4
[]
no_license
JasonGermaine/SamplesForCA
6ca03fba5b1a3decb0f65721ddd1839e29301f94
1572601e5970f055543ed832c6e4c514fc9aa70a
refs/heads/master
2016-09-05T08:46:28.880522
2015-04-12T15:45:32
2015-04-12T15:45:32
33,822,808
0
0
null
null
null
null
UTF-8
Java
false
false
1,715
java
package com.jgermaine.fyp.samplesforca; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.Toast; public class TableForm extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_table_form); } public void submitForm(View view) { String name = ((EditText) findViewById(R.id.formName)).getText().toString(); String number = ((EditText) findViewById(R.id.formNumber)).getText().toString(); String password = ((EditText) findViewById(R.id.formPassword)).getText().toString(); String message = "Submitted:"; if (isNotNullOrEmpty(name)) { message += "\nName: " + name; } if (isNotNullOrEmpty(number)) { message += "\nNumber: " + number; } if (isNotNullOrEmpty(password)) { message += "\nPassword: " + password; } Toast.makeText(this, message, Toast.LENGTH_SHORT).show(); } private boolean isNotNullOrEmpty(String value) { return value != null && !value.isEmpty(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_table_form, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
f727ecc28e931116d6a2ba89f8e5440e6749d22e
07650e36c040f1affdbcb752bcbfb2571e55563c
/app/src/main/java/com/example/adventureapp/HelperClasses/HomeAdapter/CartHelperClass.java
9cdf45cd4e1d6536d508e06af5c2297311d57e3a
[]
no_license
technophile22/AdventureApp
c861184335a4c6ef693a9f402238e8f470d95e58
b4eccb5b7cd84d10ace9202398c0030b59c5025c
refs/heads/master
2023-01-24T22:33:33.975368
2020-12-13T18:07:50
2020-12-13T18:07:50
295,982,174
0
0
null
null
null
null
UTF-8
Java
false
false
587
java
package com.example.adventureapp.HelperClasses.HomeAdapter; public class CartHelperClass { int image; String title, quantity, price; public CartHelperClass(int image, String price, String title, String quantity) { this.image = image; this.price = price; this.title = title; this.quantity = quantity; } public int getImage() { return image; } public String getTitle() { return title; } public String getQuantity() { return quantity; } public String getPrice() { return price; } }
abea8d05c43942efa219b53e1dc5ecae1800898e
c38f138f32ac362926c7e782e418125bf2bb4c4c
/app/src/main/java/com/eunzzi/p0617/ActivityBoardRead.java
01d4f29ecc539d2fee20da3b5f5382471e4cea20
[]
no_license
DT-Kim8700/FinalProject
9ea4ed1d1c2e617f7d2c06b47160a4aef03fe52a
8af2bfa9e65f0513f33cd9478bd3436f8e3d1e4f
refs/heads/master
2022-12-12T23:10:46.486503
2020-09-15T07:57:24
2020-09-15T07:57:24
281,679,808
0
0
null
null
null
null
UTF-8
Java
false
false
1,154
java
package com.eunzzi.p0617; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.widget.TextView; public class ActivityBoardRead extends AppCompatActivity { private TextView read_title, read_name, read_content = null; private String title, name, content = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_read); viewSetting(); getIntentExtra(); viewSetText(); } private void viewSetting(){ read_title = findViewById(R.id.read_title); read_name = findViewById(R.id.read_name); read_content = findViewById(R.id.read_content); } private void getIntentExtra(){ Intent intent = getIntent(); title = intent.getStringExtra("title"); name = intent.getStringExtra("name"); content = intent.getStringExtra("content"); } private void viewSetText(){ read_title.setText(title); read_name.setText(name); read_content.setText(content); } }
7013c6000718f329b156584ad282aa22f3794869
0b4905c679f3a41a556b9102114eda4d0c32ee98
/BlackJackProject_combine/src/com/heart/impl/correct/Extends_06_Choi.java
23d9d9abe0fa12338bae5352427ad97be5114f1a
[]
no_license
soparifly/Java_project
18ac16dcfd36b13f4310fbd975f61c3c37773824
5ce09adea9a6b0c32ece661a0a853dd554a07218
refs/heads/master
2023-04-14T06:18:47.455263
2021-04-20T04:19:04
2021-04-20T04:19:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,871
java
package com.heart.impl.correct; public class Extends_06_Choi extends Extends_05_Cho{ // TODO 최선영 돈계산 @Override public void gamerMoney() { // 플레이어, 딜러 둘 다 블랙잭,BUST 아님 // 양 쪽 점수 비교 if (voP.getBust()) { lose(); } else if ((voP.getScore() > voD.getScore()) || voD.getBust()) { win(); } else if (voD.getScore() > voP.getScore()) { lose(); } else if (voD.getScore() == voP.getScore()) { push(); } if (voP.getBj()) { if (voP.getBj()) { this.push(); } else { this.win_bj(); } } } public void win_bj() { // TODO 플레이어가 블랙잭으로 이겼을 경우 System.out.println("\n" + voP.getName() + "님 BlackJack으로 승리"); voP.setMoney((int) (voP.getMoney() + (betMoney * 2.5))); } public void win() { // TODO 플레이어가 이겼을 경우 돈계산 // 양쪽 카드 오픈 후 플레이어 점수 합이 더 높을 때 // (플레이어는 BUST가 아니고) 딜러가 BUST일 때 // 배팅금의 2배 돌려받음 System.out.println("\n" + voP.getName() + "님 승리"); voP.setMoney((voP.getMoney() + (betMoney * 2))); } public void lose() { // TODO 플레이어가 졌을 경우 돈계산 // 플레이어가 BUST일 때 // 양쪽 카드 오픈 후 딜러 점수 합이 더 높을 때 // (플레이어는 블랙잭이 아니고) 딜러가 블랙잭일 때 // 배팅금 잃은 거라 그대로임 System.out.println("\n" + voP.getName() + "님 패배"); return; } public void push() { // TODO 비겼을 경우 돈계산 // 양쪽 카드 오픈 후 플레이어와 딜러 점수 합이 같을 때 // 양쪽 다 블랙잭인 경우 // 배팅금 다시 돌려줌 System.out.println("\n" + "무 승 부"); voP.setMoney((voP.getMoney() + betMoney)); } }
d7b89a8ce9750be5ddbb48789f172795dd41ecf0
6848700142be08209354f36e6df2103bbe842402
/day12/src/com/flora/extend/Student.java
bf45f83547aa1f79d481115f13c224df91868add
[]
no_license
Supernovaliu/OOP-practice
49b6cbe02806f73e34498cc53b43fd5c926650b4
d12f40c7c839cc56ad62b1cf387d21c4e2b0c39c
refs/heads/master
2020-12-03T20:41:37.889187
2020-01-03T00:34:50
2020-01-03T00:34:50
231,480,061
0
0
null
null
null
null
UTF-8
Java
false
false
301
java
package com.flora.extend; public class Student extends Person{ String major; public Student() { } public Student(String name, int age, String major) { super(); this.name = name; this.age = age; this.major = major; } public void study() { System.out.println("学习"); } }
59b9726cf3886839c7ea1ab547806d9d40a2a79e
d3164af5552a3b4a896fdfe57432034d43786d28
/rating-service/src/main/java/com/lanu/spring/cloud/ratingservice/RatingServiceApplication.java
42215a455c25eebaebfa82658a940da051e0a0ed
[]
no_license
mrlanu/spring-cloud
25b63b98bf02387294f498d8e24f7f8ed9e767e0
a25f8154b81f1ae44e2c50c4f34789c2edf0208e
refs/heads/master
2020-06-03T17:44:33.446654
2019-06-13T04:01:44
2019-06-13T04:01:44
191,670,663
0
0
null
null
null
null
UTF-8
Java
false
false
1,477
java
package com.lanu.spring.cloud.ratingservice; import com.lanu.spring.cloud.ratingservice.entities.Rating; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @SpringBootApplication @EnableEurekaClient @RestController @RequestMapping("/ratings") public class RatingServiceApplication { public static void main(String[] args) { SpringApplication.run(RatingServiceApplication.class, args); } private List<Rating> ratingList = Arrays.asList( new Rating(1L, 1L, 2), new Rating(2L, 1L, 3), new Rating(3L, 2L, 4), new Rating(4L, 2L, 5) ); @GetMapping("") public List<Rating> findRatingsByBookId(@RequestParam Long bookId) { return bookId == null || bookId.equals(0L) ? Collections.EMPTY_LIST : ratingList.stream().filter(r -> r.getBookId().equals(bookId)).collect(Collectors.toList()); } @GetMapping("/all") public List<Rating> findAllRatings() { return ratingList; } }
c2bb9d5f23b0a2cd3fb477629ed55bf941c37b80
0524570edad83d4727c413904ab3afdd096674d1
/hadoop-2.6.5-src/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/nfs/nfs3/request/CREATE3Request.java
473d5276463104a81b481dc5c1c2994e1f22609c
[ "LicenseRef-scancode-unknown", "BSD-3-Clause", "BSD-2-Clause-Views", "LicenseRef-scancode-protobuf", "CDDL-1.0", "CDDL-1.1", "MIT", "EPL-1.0", "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-2-Clause", "Classpath-exception-2.0", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "GCC-exception-3.1", "GPL-2.0-only", "LicenseRef-scancode-public-domain", "CC-PDDC", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-free-unknown", "LGPL-2.0-or-later", "GPL-1.0-or-later", "CPL-1.0", "MPL-1.1", "MPL-1.0" ]
permissive
lsds/sgx-spark
559426f71be03ad3cd12ac4856fb1af686f2c64c
7ce0009050b30ba63e5090635925fbe86f5a3e2d
refs/heads/v1
2023-08-22T16:48:53.818334
2019-04-24T16:51:01
2019-04-24T16:51:01
179,549,243
25
9
Apache-2.0
2022-12-05T23:36:45
2019-04-04T17:58:03
Java
UTF-8
Java
false
false
2,466
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.nfs.nfs3.request; import java.io.IOException; import org.apache.hadoop.nfs.nfs3.FileHandle; import org.apache.hadoop.nfs.nfs3.Nfs3Constant; import org.apache.hadoop.oncrpc.XDR; /** * CREATE3 Request */ public class CREATE3Request extends RequestWithHandle { private final String name; private final int mode; private final SetAttr3 objAttr; private long verf = 0; public CREATE3Request(FileHandle handle, String name, int mode, SetAttr3 objAttr, long verf) { super(handle); this.name = name; this.mode = mode; this.objAttr = objAttr; this.verf = verf; } public static CREATE3Request deserialize(XDR xdr) throws IOException { FileHandle handle = readHandle(xdr); String name = xdr.readString(); int mode = xdr.readInt(); SetAttr3 objAttr = new SetAttr3(); long verf = 0; if ((mode == Nfs3Constant.CREATE_UNCHECKED) || (mode == Nfs3Constant.CREATE_GUARDED)) { objAttr.deserialize(xdr); } else if (mode == Nfs3Constant.CREATE_EXCLUSIVE) { verf = xdr.readHyper(); } else { throw new IOException("Wrong create mode:" + mode); } return new CREATE3Request(handle, name, mode, objAttr, verf); } public String getName() { return name; } public int getMode() { return mode; } public SetAttr3 getObjAttr() { return objAttr; } public long getVerf() { return verf; } @Override public void serialize(XDR xdr) { handle.serialize(xdr); xdr.writeInt(name.length()); xdr.writeFixedOpaque(name.getBytes(), name.length()); xdr.writeInt(mode); objAttr.serialize(xdr); } }
28c82a4cd4c92ae516dacccf5b1d20f8446f6af0
7f2b672494f4e6ff94b0b8a6452ce2bcc88f2118
/src/inf011/plugins/PDFDocument.java
4b072a379c1cef4366a78965ff931ab3d81fdb5b
[]
no_license
mtlmacedo/Documents
87d94ea4285960a72919995f6ca3e4076d388a2f
b5ad7d2096b161c2363bdd3df537435e1e003f98
refs/heads/master
2023-04-25T12:27:45.083540
2021-04-30T00:26:15
2021-04-30T00:26:15
362,972,878
0
0
null
null
null
null
UTF-8
Java
false
false
949
java
package inf011.plugins; import java.io.File; import java.io.IOException; import javax.swing.JFrame; import org.apache.pdfbox.Loader; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.text.PDFTextStripper; import inf011.interfaces.IDocument; import inf011.ui.DocumentEditor; public class PDFDocument implements IDocument { private PDDocument document; @Override public void open(File file) { try { this.document = Loader.loadPDF(file); } catch (IOException e) { e.printStackTrace(); } } @Override public JFrame getEditor() { try { int page = 1; String pageText = ""; if(this.document != null) { PDFTextStripper reader; reader = new PDFTextStripper(); reader.setStartPage(page); reader.setEndPage(page); pageText = reader.getText(this.document); } return new DocumentEditor(pageText); } catch (IOException e) { e.printStackTrace(); return null; } } }
7f9e72a9621e5f10b91961f905023a47ced0c49e
72ccd6ee31dcb6cbb1ca1472d615d9a359e90722
/src/test/java/net/ssehub/ai_perf/net/CliDummyPeer.java
1e4d46cc11c447cc3551669747fce1d8c1fba672
[ "Apache-2.0" ]
permissive
adam-sse/ai-perf-controller
e2a8b27840eec49c945abc52ccc6d3c73ec93a15
3e5b429c7d7afcdc4366c0ab3a84bf72cd32dfaf
refs/heads/main
2023-05-24T02:30:18.878915
2021-06-09T15:35:32
2021-06-09T15:35:32
363,197,220
0
0
null
null
null
null
UTF-8
Java
false
false
1,650
java
package net.ssehub.ai_perf.net; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.Writer; import java.net.ServerSocket; import java.net.Socket; import java.nio.charset.StandardCharsets; public class CliDummyPeer { public static void main(String[] args) throws IOException { ServerSocket serverSocket = new ServerSocket(NetworkConnection.PORT); System.out.println("Waiting for connection on port " + NetworkConnection.PORT); Socket socket = serverSocket.accept(); System.out.println("Got connection from " + socket.getInetAddress().getHostName()); serverSocket.close(); new Thread(() -> { try (BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8))) { String line; while ((line = in.readLine()) != null) { System.out.println("I: " + line); } } catch (IOException e) { e.printStackTrace(); } }).start(); try (Writer out = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8)); BufferedReader cli = new BufferedReader(new InputStreamReader(System.in))) { String line; while ((line = cli.readLine()) != null) { out.write(line + "\n"); out.flush(); } } } }
9ff7e715bf1b3539ab1ebae156f1214af9e8426d
30b24992db43820e5e311b1d597369fbff086718
/src/main/java/com/event/flow/core/Execution.java
0c0bac0d1fb90f3d6304f4f4a0c2d602b91f4e7b
[]
no_license
lsl-526401/eventflow
d6e07e8751e039515de52e0249f56157d8cd58fe
32ed5e4022c2b7e19ba90b39aa8edaad9302a357
refs/heads/master
2021-08-27T17:41:49.221764
2017-09-06T11:52:35
2017-09-06T11:52:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,338
java
package com.event.flow.core; import com.event.flow.core.entity.Order; import com.event.flow.core.entity.Process; import com.event.flow.core.entity.Task; import com.event.flow.core.model.ProcessModel; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.Map; /** * @author jun * @Date 17/9/3 . * @des: 流程执行过程中所传递的执行对象,其中包含流程定义、流程模型、流程实例对象、执行参数、返回的任务列表 */ public class Execution implements Serializable { /** * */ private static final long serialVersionUID = 3730741790729624400L; /** * EventFlowEngine holder */ private EventFlowEngine engine; /** * 流程定义对象 */ private Process process; /** * 流程实例对象 */ private Order order; /** * 父流程实例 */ private Order parentOrder; /** * 父流程实例节点名称 */ private String parentNodeName; /** * 子流程实例节点名称 */ private String childOrderId; /** * 执行参数 */ private Map<String, Object> args; /** * 操作人 */ private String operator; /** * 任务 */ private Task task; /** * 返回的任务列表 */ private List<Task> tasks = new ArrayList<Task>(); /** * 是否已合并 * 针对join节点的处理 */ private boolean isMerged = false; /** * 用于产生子流程执行对象使用 * @param execution * @param process * @param parentNodeName */ Execution(Execution execution, Process process, String parentNodeName) { if(execution == null || process == null || parentNodeName == null) { throw new EventFlowException("构造Execution对象失败,请检查execution、process、parentNodeName是否为空"); } this.engine = execution.getEngine(); this.process = process; this.args = execution.getArgs(); this.parentOrder = execution.getOrder(); this.parentNodeName = parentNodeName; this.operator = execution.getOperator(); } /** * 构造函数,接收流程定义、流程实例对象、执行参数 * @param process * @param order * @param args */ public Execution(EventFlowEngine engine, Process process, Order order, Map<String, Object> args) { if(process == null || order == null) { throw new EventFlowException("构造Execution对象失败,请检查process、order是否为空"); } this.engine = engine; this.process = process; this.order = order; this.args = args; } /** * 根据当前执行对象execution、子流程定义process、当前节点名称产生子流程的执行对象 * @param execution * @param process * @param parentNodeName * @return */ public Execution createSubExecution(Execution execution, Process process, String parentNodeName) { return new Execution(execution, process, parentNodeName); } /** * 获取流程定义对象 * @return */ public Process getProcess() { return process; } /** * 获取流程模型对象 * @return */ public ProcessModel getModel() { return process.getModel(); } /** * 获取流程实例对象 * @return */ public Order getOrder() { return order; } /** * 获取执行参数 * @return */ public Map<String, Object> getArgs() { return args; } /** * 返回任务结果集 * @return */ public List<Task> getTasks() { return tasks; } /** * 添加任务集合 * @param tasks */ public void addTasks(List<Task> tasks) { this.tasks.addAll(tasks); } /** * 添加任务 * @param task */ public void addTask(Task task) { this.tasks.add(task); } /** * 返回当前操作人ID * @return */ public String getOperator() { return operator; } /** * 设置当前操作人ID * @param operator */ public void setOperator(String operator) { this.operator = operator; } /** * 返回任务 * @return */ public Task getTask() { return task; } /** * 设置任务 * @param task */ public void setTask(Task task) { this.task = task; } /** * 判断是否已经成功合并 * @return */ public boolean isMerged() { return isMerged; } /** * 设置是否为已合并 * @param isMerged */ public void setMerged(boolean isMerged) { this.isMerged = isMerged; } /** * 获取引擎 * @return */ public EventFlowEngine getEngine() { return engine; } public Order getParentOrder() { return parentOrder; } public String getParentNodeName() { return parentNodeName; } public String getChildOrderId() { return childOrderId; } public void setChildOrderId(String childOrderId) { this.childOrderId = childOrderId; } }
ef8318fc01530a68b0c9b534a40411f1157b7f1b
34e74d9a2007821c313cf77f72a615a2cb511fb2
/app/src/main/java/com/afap/discuz/chh/greendao/BaseListAtom.java
33ac45db04394941fae5dc4044cb9cd789bf8c95
[]
no_license
AFAP/CHH
66302aeffa2076540cdd828e92565a52e432060e
cf2b5cc4178527ce9ba7f87cd316bdd2bf6f6262
refs/heads/master
2020-05-22T20:38:37.611166
2018-12-20T16:45:51
2018-12-20T16:45:51
84,722,150
5
0
null
null
null
null
UTF-8
Java
false
false
638
java
package com.afap.discuz.chh.greendao; import java.io.Serializable; public class BaseListAtom implements Serializable { protected String href; protected String title; private int page_label = -1; public String getHref() { return href; } public void setHref(String href) { this.href = href; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getPage_label() { return page_label; } public void setPage_label(int page_label) { this.page_label = page_label; } }
f406b9a25b57fff75a6094bbce8082375c068c21
e3c4870c8e8192df2c5735b0c27f51c22e059720
/src/sun/misc/MessageUtils.java
f8f1b7b5730a85232dd1f76f0848a36d35bdc862
[]
no_license
xiangtch/Java
fec461aee7fd1dfd71dd21a482a75022ce35af9d
64440428d9af03779ba96b120dbb4503c83283b1
refs/heads/master
2020-07-14T01:23:46.298973
2019-08-29T17:49:18
2019-08-29T17:49:18
205,199,738
0
0
null
null
null
null
UTF-8
Java
false
false
4,054
java
/* */ package sun.misc; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class MessageUtils /* */ { /* */ public static String subst(String paramString1, String paramString2) /* */ { /* 42 */ String[] arrayOfString = { paramString2 }; /* 43 */ return subst(paramString1, arrayOfString); /* */ } /* */ /* */ public static String subst(String paramString1, String paramString2, String paramString3) { /* 47 */ String[] arrayOfString = { paramString2, paramString3 }; /* 48 */ return subst(paramString1, arrayOfString); /* */ } /* */ /* */ public static String subst(String paramString1, String paramString2, String paramString3, String paramString4) /* */ { /* 53 */ String[] arrayOfString = { paramString2, paramString3, paramString4 }; /* 54 */ return subst(paramString1, arrayOfString); /* */ } /* */ /* */ public static String subst(String paramString, String[] paramArrayOfString) { /* 58 */ StringBuffer localStringBuffer = new StringBuffer(); /* 59 */ int i = paramString.length(); /* 60 */ for (int j = 0; (j >= 0) && (j < i); j++) { /* 61 */ char c = paramString.charAt(j); /* 62 */ if (c == '%') { /* 63 */ if (j != i) { /* 64 */ int k = Character.digit(paramString.charAt(j + 1), 10); /* 65 */ if (k == -1) { /* 66 */ localStringBuffer.append(paramString.charAt(j + 1)); /* 67 */ j++; /* 68 */ } else if (k < paramArrayOfString.length) { /* 69 */ localStringBuffer.append(paramArrayOfString[k]); /* 70 */ j++; /* */ } /* */ } /* */ } else { /* 74 */ localStringBuffer.append(c); /* */ } /* */ } /* 77 */ return localStringBuffer.toString(); /* */ } /* */ /* */ public static String substProp(String paramString1, String paramString2) { /* 81 */ return subst(System.getProperty(paramString1), paramString2); /* */ } /* */ /* */ public static String substProp(String paramString1, String paramString2, String paramString3) { /* 85 */ return subst(System.getProperty(paramString1), paramString2, paramString3); /* */ } /* */ /* */ public static String substProp(String paramString1, String paramString2, String paramString3, String paramString4) /* */ { /* 90 */ return subst(System.getProperty(paramString1), paramString2, paramString3, paramString4); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public static native void toStderr(String paramString); /* */ /* */ /* */ /* */ /* */ /* */ public static native void toStdout(String paramString); /* */ /* */ /* */ /* */ /* */ /* */ public static void err(String paramString) /* */ { /* 111 */ toStderr(paramString + "\n"); /* */ } /* */ /* */ public static void out(String paramString) { /* 115 */ toStdout(paramString + "\n"); /* */ } /* */ /* */ /* */ public static void where() /* */ { /* 121 */ Throwable localThrowable = new Throwable(); /* 122 */ StackTraceElement[] arrayOfStackTraceElement = localThrowable.getStackTrace(); /* 123 */ for (int i = 1; i < arrayOfStackTraceElement.length; i++) { /* 124 */ toStderr("\t" + arrayOfStackTraceElement[i].toString() + "\n"); /* */ } /* */ } /* */ } /* Location: E:\java_source\rt.jar!\sun\misc\MessageUtils.class * Java compiler version: 8 (52.0) * JD-Core Version: 0.7.1 */
[ "imsmallmouse@gmail" ]
imsmallmouse@gmail
3edd7b898cc4915817b4e7d54b45a0e7af96b39d
e9dc17a2293a5a1ec69a589dc493928dc3f738cd
/app/src/main/java/com/kamel/kameltv/FavouriteActivity.java
f77532704bd14393c4746faa39eba6409a39c06f
[]
no_license
cabralfilho/SuperMaxTv
d38250e8d7f7de46f9e7bd354c71b91e54e8e01e
0e3a51b252dc52e3f2091408b6a81d7cc96b36b6
refs/heads/master
2022-01-25T14:01:07.621679
2019-06-14T16:01:23
2019-06-14T16:01:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,230
java
package com.kamel.kameltv; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; import android.net.Uri; import android.os.AsyncTask; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.ContextMenu; import android.view.KeyEvent; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.GridView; import android.widget.SearchView; import android.widget.Toast; import android.widget.VideoView; import com.kamel.kameltv.channels.ChannelAdapter; import com.kamel.kameltv.channels.ChannelsModel; import com.kamel.kameltv.channels.favouritechannels.FavouriteChannels; import com.kamel.kameltv.epg.model.constants.Constants; import com.kamel.kameltv.m3u.M3UListConstants; import com.kamel.kameltv.m3u.model.M3UItem; import com.kamel.kameltv.player.VLCActivity; import com.kamel.kameltv.player.exoplayer.ExoPlayerActivity; //import com.kamel.kameltv.player.xplyer.XVideoPlayer; //import com.kamel.kameltv.player.ijk.IJKVidoPlayear; import com.kamel.kameltv.sqlitedatabase.DatabaseHelper; import com.kamel.kameltv.useaccount.UserAccount; import java.util.ArrayList; import java.util.List; public class FavouriteActivity extends AppCompatActivity implements MediaPlayer.OnPreparedListener{ static GridView channelGrid; private static ChannelAdapter channelAdapter; private static List<ChannelsModel> channelList; SearchView channelSearch; private long exitTime = 0; private VideoView videoView; private ProgressDialog progressDialog; String url; static Context context; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); channelList= new DatabaseHelper(this).getAllChannel(); if(channelList.size()==0){ Toast.makeText(this, "No channel in favourites", Toast.LENGTH_SHORT).show(); onBackPressed(); } setContentView(R.layout.activity_favourite); context=this; channelSearch=findViewById(R.id.channelsearch); channelSearch.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText) { channelAdapter.filter(newText); return false; } }); channelSearch.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if(!hasFocus){ channelAdapter.filter(""); } } }); channelGrid=findViewById(R.id.channelgrid); channelAdapter=new ChannelAdapter(this,channelList); channelGrid.setAdapter(channelAdapter); channelGrid.setDrawSelectorOnTop(true); registerForContextMenu(channelGrid); try{ channelGrid.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { com.kamel.kameltv.epg.model.constants.Constants.channelAdapters=channelAdapter; Constants.streamid=channelList.get(position).getStreamId(); String url="http://cuthecord.ddns.net:25461/live/"+ UserAccount.userAccount.getUserName()+"/"+UserAccount.userAccount.getPassword()+"/"+channelList.get(position).getStreamId()+".ts"; FavouriteActivity.this.url=url; final Uri videoUri = Uri.parse(FavouriteActivity.this.url); fullScreen(null); /// videoView.setVideoURI(videoUri); } }); }catch (Exception ex){ Toast.makeText(this, "No channel in favourites", Toast.LENGTH_SHORT).show(); onBackPressed(); } } @Override protected void onPause() { super.onPause(); //videoView.pause(); // videoView.setVisibility(View.GONE ); } @Override protected void onResume() { super.onResume(); // videoView.resume(); // videoView.setVisibility(View.VISIBLE); } public void onBackPressed() { super.onBackPressed(); } public void closeStreaming() { if ((System.currentTimeMillis() - exitTime) > 2000) { // exitTime = System.currentTimeMillis(); } else { finish(); } } @Override public void onPrepared(MediaPlayer mp) { // hideProgress(); //Starts the video playback as soon as it is ready // videoView.start(); } public void showProgress() { progressDialog = new ProgressDialog(FavouriteActivity.this); progressDialog = ProgressDialog.show(FavouriteActivity.this, "Please Wait", "Loading...", true); } public void hideProgress() { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } } public void fullScreen(View view){ Intent intent=new Intent(FavouriteActivity.this, VLCActivity.class); intent.putExtra("url",FavouriteActivity.this.url); startActivity(intent); } public static void updateChannelList(List<ChannelsModel> list){ channelList=list; ChannelAdapter channelAdapter=new ChannelAdapter(context,list); channelGrid.setAdapter(channelAdapter); System.out.println("INUPDATE"+list.size()); channelAdapter.notifyDataSetChanged(); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.chanelcontextmenu, menu); } @Override public boolean onContextItemSelected(MenuItem item) { // below variable info contains clicked item info and it can be null; scroll down to see a fix for it // ChannelAdapter info = (ChannelAdapter) item.getMenuInfo(); switch (item.getItemId()) { case R.id.addfavorite: //hidTesteItem(info.position); ChannelsModel m3UItem= (ChannelsModel) channelGrid.getSelectedItem(); FavouriteChannels.databaseHelper.addChannel(m3UItem); Toast.makeText(context, m3UItem.getName()+" Favourite Added!"+channelGrid.getCheckedItemPosition(), Toast.LENGTH_SHORT).show(); return true; case R.id.removefavorite: ChannelsModel m3UItemr= (ChannelsModel) channelGrid.getSelectedItem(); FavouriteChannels.databaseHelper.deletechannel(m3UItemr); Toast.makeText(context, m3UItemr.getName()+" Removed from favourite!", Toast.LENGTH_SHORT).show(); return true; default: return super.onContextItemSelected(item); } } }
6e37803b88d041e915c8619597db0d241889124d
de094bf4514ce0f4d3bf33d8444624af03ff4396
/src/main/java/my/com/infoconnect/service/ReportServiceImpl.java
f406775e839d130393499701eb1fb4b1bc7e5b95
[]
no_license
InfoConnect-Java/Report
8512897df2f29df596c9562ba431dbe5e7b3c41a
cbbb1dd2d86f2e25caae1584856af3fc21a35010
refs/heads/main
2023-07-11T23:30:34.908952
2021-08-15T15:31:23
2021-08-15T15:31:23
396,405,848
0
0
null
null
null
null
UTF-8
Java
false
false
96
java
package my.com.infoconnect.service; public class ReportServiceImpl implements ReportService{ }
818f87aedfc01821b5ce08556d531439d52caa77
ab7c374e12ef55482d1c622a0099a7b262195322
/jami-enricher/src/main/java/psidev/psi/mi/jami/enricher/listener/PolymerEnricherListener.java
92fb676d6c8b0576f6ba97fa20342ffe12b94234
[ "Apache-2.0" ]
permissive
colin-combe/psi-jami
9f945d885d76454f7b652382cc676ac98e6faa39
64fb0596b99aa8996d865b5eae0a2094be0889c8
refs/heads/master
2020-12-07T02:17:10.909871
2017-06-07T07:05:14
2017-06-07T07:05:14
64,655,225
0
0
null
2017-03-09T14:26:30
2016-08-01T09:43:06
Java
UTF-8
Java
false
false
415
java
package psidev.psi.mi.jami.enricher.listener; import psidev.psi.mi.jami.listener.PolymerChangeListener; import psidev.psi.mi.jami.model.Polymer; /** * Interface for polymer enricher listener * * @author Marine Dumousseau ([email protected]) * @version $Id$ * @since <pre>01/10/13</pre> */ public interface PolymerEnricherListener<T extends Polymer> extends PolymerChangeListener<T>, EnricherListener<T> { }
[ "[email protected]@73e66818-4ebf-11de-a6a3-df26d2c71dbe" ]
[email protected]@73e66818-4ebf-11de-a6a3-df26d2c71dbe
05b5c75e753ab06d6554a4edc2340af2c62095b6
59841cd549fa389f6de2da5c963a6a59eb860a44
/app/src/androidTest/java/com/jwen/expandrecycler/ApplicationTest.java
7cd034797d9a14bd9188b28b9e952df833aeb905
[]
no_license
jwenzhu/ExpandRecyclerView
054284dabadb6fd0ae16b1ddd56672a9a7344c94
05ea7896f0294edb0390b5f668f7506df247b21b
refs/heads/master
2021-01-19T12:16:08.189290
2016-10-29T08:44:22
2016-10-29T08:44:22
69,652,623
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.jwen.expandrecycler; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
155f67d2744fec28a0e1eef196e8c3be66f5e641
9d18b447ee548f40f55025501f7262bcb7d92f5d
/src/main/java/org/food/supplier/dao/CategoryDAO.java
999d63e60ab9f7932e2059cd6a6a02139f5efb70
[]
no_license
PushpendraParmar/SupplierServices
f3d71dc0364775c2a1598fdc2eb7a937499f37d5
ec0d8e7b9be0f66f79b81955503b4351621f0bd0
refs/heads/master
2020-04-11T03:47:16.112002
2018-03-24T12:21:08
2018-03-24T12:21:08
124,323,587
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package org.food.supplier.dao; import java.util.List; import org.food.supplier.domain.Category; public interface CategoryDAO { Category getCategoryById(Integer id); public List<Category> getCategory(); void save(Category category); }
20815020c2e4777d1cec8351ef655b2d4540459e
5ad72c7355e2a80629514f3627b59c757f0cfccf
/src/main/java/com/capstone/converter/umlparser/objects/Data.java
799f313f559c37be15ea892cf1503178ad1cf868
[ "Apache-2.0" ]
permissive
chohanjoo/java2uml
7c117731a67b5a437ac3406e30f62656888f8373
6767f8fafe89bc5461996f8a9c895f8f30390af8
refs/heads/master
2020-04-03T09:02:44.894024
2018-11-07T05:32:50
2018-11-07T05:32:50
155,152,531
0
0
NOASSERTION
2018-10-29T04:34:45
2018-10-29T04:34:45
null
UTF-8
Java
false
false
1,764
java
package com.capstone.converter.umlparser.objects; import java.util.ArrayList; public class Data { private int numOfClasses; private int numOfInterfaces; private ArrayList<Class> classes; private ArrayList<Interface> interfaces; private InheritanceRelation inheritanceRelation; private InterfaceRelation interfaceRelation; public Data() { this.numOfClasses = 0; this.numOfInterfaces = 0; this.classes = new ArrayList<>(); this.interfaces = new ArrayList<>(); this.inheritanceRelation = new InheritanceRelation(); this.interfaceRelation = new InterfaceRelation(); } public int getNumOfClasses() { return numOfClasses; } public int getNumOfInterfaces() { return numOfInterfaces; } public Class getClass(int index){ return classes.get(index); } public Interface getInterface(int index){ return interfaces.get(index); } public InheritanceRelation getInheritanceRelation() { return inheritanceRelation; } public InterfaceRelation getInterfaceRelation() { return interfaceRelation; } public void setNumOfClasses(int numOfClasses) { this.numOfClasses = numOfClasses; } public void setNumOfInterfaces(int numOfInterfaces) { this.numOfInterfaces = numOfInterfaces; } public void setInheritanceRelation() { this.inheritanceRelation = new InheritanceRelation(); } public void setInterfaceRelation() { this.interfaceRelation = new InterfaceRelation(); } public void addClass(Class clazz){ classes.add(clazz); } public void addInterface(Interface interfacz) { interfaces.add(interfacz); } }
677c06db71593eb2b83c77937a26af44ca6aa306
3c70339cb78fd85fdbe41b50be443268e31e10e6
/core/src/main/java/me/piggypiglet/referrals/bootstrap/framework/Registerable.java
f56956576f00420ae10e674d1f7a2ed87dd69c9a
[]
no_license
GiansCode/GianReferrals
2bb91da25e327c7e7018772e823ba82239663421
8aa0ad00ea793692d1b0839aa83c09bdc5227c92
refs/heads/main
2023-06-06T02:43:52.005084
2021-06-21T13:21:14
2021-06-21T13:21:14
376,022,060
0
0
null
null
null
null
UTF-8
Java
false
false
3,305
java
package me.piggypiglet.referrals.bootstrap.framework; import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.TypeLiteral; import me.piggypiglet.referrals.bootstrap.exceptions.BootstrapHaltException; import me.piggypiglet.referrals.guice.modules.DynamicModule; import me.piggypiglet.referrals.guice.objects.Binding; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.lang.annotation.Annotation; import java.util.Arrays; import java.util.HashSet; import java.util.Optional; import java.util.Set; // ------------------------------ // Copyright (c) PiggyPiglet 2021 // https://www.piggypiglet.me // ------------------------------ public abstract class Registerable { private final Set<Binding<?>> bindings = new HashSet<>(); private final Set<Class<?>> staticInjections = new HashSet<>(); private BootstrapHaltException halt = null; public void execute() {} public void execute(@NotNull final Injector injector) {} public final void run(@NotNull final Injector injector) { execute(); execute(injector); } protected <T> void addBinding(@NotNull final Class<? super T> type, @NotNull final T instance) { addBinding(Key.get(type), instance); } protected <T> void addBinding(@NotNull final TypeLiteral<? super T> type, @NotNull final T instance) { addBinding(Key.get(type), instance); } protected <T> void addBinding(@NotNull final Class<? super T> type, @NotNull final Annotation annotation, @NotNull final T instance) { addBinding(Key.get(type, annotation), instance); } protected <T> void addBinding(@NotNull final Class<? super T> type, @NotNull final Class<? extends Annotation> annotation, @NotNull final T instance) { addBinding(Key.get(type, annotation), instance); } protected <T> void addBinding(@NotNull final TypeLiteral<? super T> type, @NotNull final Annotation annotation, @NotNull final T instance) { addBinding(Key.get(type, annotation), instance); } protected <T> void addBinding(@NotNull final TypeLiteral<? super T> type, @NotNull final Class<? extends Annotation> annotation, @NotNull final T instance) { addBinding(Key.get(type, annotation), instance); } protected <T> void addBinding(@NotNull final Key<? super T> key, @NotNull final T instance) { bindings.add(new Binding<>(key, instance)); } protected void requestStaticInjections(@NotNull final Class<?>@NotNull... classes) { staticInjections.addAll(Arrays.asList(classes)); } protected void haltBootstrap(@NotNull final String reason, @NotNull final Object... variables) { halt = new BootstrapHaltException(String.format(reason, variables)); } @NotNull public Optional<DynamicModule> createModule() { if (bindings.isEmpty() && staticInjections.isEmpty()) { return Optional.empty(); } return Optional.of(new DynamicModule(bindings, staticInjections.toArray(new Class<?>[]{}))); } @Nullable public BootstrapHaltException halt() { return halt; } }