blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
sequencelengths
1
1
author_id
stringlengths
0
313
3c7f2176c76eef1be18605a498b7ff5f4b98f570
1e7053446858a9c15b960d32484d6703b4bdd44d
/hxe-common/src/main/java/com/hxe/common/utils/HttpContextUtils.java
cf2ba57625ea90bc5ab248590945095d2bdb3d94
[ "Apache-2.0" ]
permissive
iceseed/springboot-HXR
03741c054dab30de130eae1fe04e879733f44e7f
d7188dda02f8473b32ccad4773f126b251e433a8
refs/heads/master
2020-04-07T05:41:59.152888
2018-11-20T13:38:54
2018-11-20T13:38:54
158,106,246
0
0
null
null
null
null
UTF-8
Java
false
false
1,042
java
/** * Copyright 2018 人人开源 http://www.renren.io * <p> * 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 * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * 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.hxe.common.utils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; public class HttpContextUtils { public static HttpServletRequest getHttpServletRequest() { return ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); } }
[ "82789@DESKTOP-P3A0S22" ]
82789@DESKTOP-P3A0S22
3752905620ad507f84a049521009632c14bdea6b
123344f89fa79a5f551b69cf3217c2133bb9250c
/reporting/src/main/java/ru/click/reporting/model/ClientPayments.java
859d895b402f78e4c98ab8f726f83bea1d0475f3
[]
no_license
kasyanov23/znamenka
972cb7fb6a51137c075568410cca8c0ff9aa526f
6fec8ec5f8680ef7878cbf6fb10deb94b8c3fe4c
refs/heads/master
2021-01-12T01:44:36.564614
2016-12-26T14:14:08
2016-12-26T14:14:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
398
java
package ru.click.reporting.model; import lombok.Builder; import lombok.Getter; import java.sql.Date; @Builder @Getter public class ClientPayments { private final String clientName; private final Date paymentDate; private final Long sumPayments; private final Long leftToAdd; private final String productName; private final String trainerName; }
9e72a61dc20f915a695aa21a62ffedbb21790b4a
5a52e0ff569b38cda45faf7552b6378bb8f28e43
/app/src/main/java/com/cniao5/cniao5play/common/util/InstallAccessibilityService.java
3df7a526301730c4db756d4f9b98a230f2f295a7
[]
no_license
dazeGitHub/CNiaoPhoneAssist
d2cca26e5032310685a83bb1f835fa3a75de9dd6
0599c3a77c7c8a9473e3301c97e4909dce706e90
refs/heads/master
2021-01-01T06:25:45.213076
2019-01-09T09:16:10
2019-01-09T09:16:10
97,426,395
3
1
null
null
null
null
UTF-8
Java
false
false
1,912
java
package com.cniao5.cniao5play.common.util; import android.accessibilityservice.AccessibilityService; import android.os.Build; import android.support.annotation.RequiresApi; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import java.util.List; /** * 菜鸟窝http://www.cniao5.com 一个高端的互联网技能学习平台 * * @author Ivan * @version V1.0 * @Package com.cniao5.cniao5play.service * @Description: ${TODO}(用一句话描述该文件做什么) * @date */ public class InstallAccessibilityService extends AccessibilityService { @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) public void onAccessibilityEvent(AccessibilityEvent event) { AccessibilityNodeInfo nodeInfo = event.getSource(); if(nodeInfo==null){ return; } int evenType = event.getEventType(); if(evenType == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED || evenType == AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED) { // 中文系统 click("安装"); click("下一步"); click("确定"); click("完成"); // 英文 } } @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN) private void click(String text){ AccessibilityNodeInfo rootNodeInfo = getRootInActiveWindow(); List<AccessibilityNodeInfo> nodeInfos = rootNodeInfo.findAccessibilityNodeInfosByText(text); if(nodeInfos==null ){ return; } for (AccessibilityNodeInfo info : nodeInfos){ if(info.getClassName().equals("android.widget.Button") && info.isClickable()){ info.performAction(AccessibilityNodeInfo.ACTION_CLICK); } } } @Override public void onInterrupt() { } }
607bbaaf0143e9b094546cc226462530e075e3b4
5363429ae1ab85a0f3cb30cefd68c379b3b7aa18
/8-13/SC_TWO-1/security/src/main/java/com/two/security/config/CustomAccessDecisionManager.java
5e181c5ba3d422c4b2f04aa7a9b4d046c8abd5fa
[]
no_license
gangsijay/mySuccessDemo
d08a4e5d88817e5f783d0cb94b2a973a964f2076
6aa6553ce440a137ba2f31a03f04bcbcf1cc3cd4
refs/heads/master
2020-03-25T22:57:33.531815
2019-03-05T15:19:30
2019-03-05T15:19:30
144,252,888
0
0
null
null
null
null
UTF-8
Java
false
false
2,694
java
package com.two.security.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.access.AccessDecisionManager; import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.ConfigAttribute; import org.springframework.security.authentication.InsufficientAuthenticationException; import org.springframework.security.core.Authentication; import org.springframework.security.core.GrantedAuthority; import org.springframework.stereotype.Service; import java.util.Collection; import java.util.Iterator; /** * 权限管理决断器 * * @Author: 我爱大金子 * @Description: 权限管理决断器 * @Date: Create in 17:15 2017/7/5 */ @Service public class CustomAccessDecisionManager implements AccessDecisionManager { Logger log = LoggerFactory.getLogger(CustomAccessDecisionManager.class); // decide 方法是判定是否拥有权限的决策方法, //authentication 是释CustomUserService中循环添加到 GrantedAuthority 对象中的权限信息集合. //object 包含客户端发起的请求的requset信息,可转换为 HttpServletRequest request = ((FilterInvocation) object).getHttpRequest(); //configAttributes 为MyInvocationSecurityMetadataSource的getAttributes(Object object)这个方法返回的结果,此方法是为了判定用户请求的url 是否在权限表中,如果在权限表中,则返回给 decide 方法,用来判定用户是否有此权限。如果不在权限表中则放行。 @Override public void decide(Authentication authentication, Object object, Collection<ConfigAttribute> configAttributes) throws AccessDeniedException, InsufficientAuthenticationException { if(null== configAttributes || configAttributes.size() <=0) { return; } ConfigAttribute c; String needRole; for(Iterator<ConfigAttribute> iter = configAttributes.iterator(); iter.hasNext(); ) { c = iter.next(); needRole = c.getAttribute(); for(GrantedAuthority ga : authentication.getAuthorities()) {//authentication 为在注释1 中循环添加到 GrantedAuthority 对象中的权限信息集合 if(needRole.trim().equals(ga.getAuthority())) { return; } } log.info("【权限管理决断器】需要role:" + needRole); } throw new AccessDeniedException("Access is denied"); } @Override public boolean supports(ConfigAttribute attribute) { return true; } @Override public boolean supports(Class<?> clazz) { return true; } }
c954b35ea34c8d403815e972b0f9ff47898b3a5f
7da956597f103ec529783b5edb836f07ee6d701d
/MyApp/app/src/main/java/com/example/shreyus/myapp/TaskDbHelper.java
9ebc696ad23dd672fdcb7ac294d1005190e0c0bf
[]
no_license
xxyypp/IBM_Dementia
8cf999a188d3f5fd676f5308721b72a4dd090664
15ffc3f33f56a4a1f42f02c97b8b776e8fe7b0b5
refs/heads/master
2020-03-15T12:22:24.001643
2018-06-27T17:32:36
2018-06-27T17:32:36
132,142,285
2
0
null
null
null
null
UTF-8
Java
false
false
1,055
java
package com.example.shreyus.myapp; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; public class TaskDbHelper extends SQLiteOpenHelper { public TaskDbHelper(Context context) { super(context, TaskContract.DB_NAME, null, TaskContract.DB_VERSION); } /** * Using database here for to-do list * CREATE TABLE tasks (_id INTEGER PRIMARY KEY AUTOINCREMENT,title TEXT NOT NULL); * @param db */ @Override public void onCreate(SQLiteDatabase db) { String createTable = "CREATE TABLE " + TaskContract.TaskEntry.TABLE + " ( " + TaskContract.TaskEntry._ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + TaskContract.TaskEntry.COL_TASK_TITLE + " TEXT NOT NULL);"; db.execSQL(createTable); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TaskContract.TaskEntry.TABLE); onCreate(db); } }
ba15c2a7995364f042fdec34d87eb85ab78a336f
bf0264c9fce4e60286d045b82bacad76dcffdb0b
/demo-model/src/main/java/com/example/demo/model/profile/student/entity/Student.java
899b88b8b362de9331dd8b11d55693a0baaebc93
[]
no_license
bhodossy/demo
a9e202f275c27dc94fc64492402b5055e364b998
cc1d3c4571e472865c1e2050b1ecb376a5442ffa
refs/heads/master
2020-03-13T22:38:26.881731
2018-05-08T17:25:01
2018-05-08T17:25:01
131,320,248
1
0
null
null
null
null
UTF-8
Java
false
false
346
java
package com.example.demo.model.profile.student.entity; import com.example.demo.model.profile.Profile; import lombok.*; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; @Data @Builder @AllArgsConstructor @Entity @DiscriminatorValue("S") @EqualsAndHashCode(callSuper = true) public class Student extends Profile { }
03994d71acafa89040aaa04c45c9884b4a3ca2f1
fa1715c6b97dccc2ac91f41d7cf08e4965e8df78
/app/src/main/java/com/rockspin/bargainbits/ui/views/deallist/recycleview/storesgrid/StoreEntryViewModel.java
964b70ef878a624638cf1f6b366988fd0a0d4a1a
[]
no_license
Rockspin/BargainBytesAndroid
6b8c19aad6100b53e5125c8d2588b1994ddd23cb
b02391a5a25f47717e3e8aa5100d8dff97dc3c1a
refs/heads/master
2021-01-19T21:18:55.651771
2019-11-20T15:50:17
2019-11-20T15:50:17
88,637,719
3
1
null
2017-11-09T21:39:55
2017-04-18T14:57:53
Java
UTF-8
Java
false
false
663
java
package com.rockspin.bargainbits.ui.views.deallist.recycleview.storesgrid; import com.rockspin.bargainbits.data.models.cheapshark.Deal; public class StoreEntryViewModel { private final String storeId; private final boolean isActive; private StoreEntryViewModel(String storeId, boolean isActive) { this.storeId = storeId; this.isActive = isActive; } public String getStoreId() { return storeId; } public boolean isActive() { return isActive; } public static StoreEntryViewModel from(Deal deal) { return new StoreEntryViewModel(deal.getStoreID(), deal.getSavings() > 0.0f); } }
48875b87b3a621a28f6776774892a11b258bb56f
821ed0666d39420d2da9362d090d67915d469cc5
/core/api/src/test/java/org/onosproject/net/topology/PathServiceAdapter.java
3e699e9bd78a43de0f0cb120376f74fcbcd89e04
[ "Apache-2.0" ]
permissive
LenkayHuang/Onos-PNC-for-PCEP
03b67dcdd280565169f2543029279750da0c6540
bd7d201aba89a713f5ba6ffb473aacff85e4d38c
refs/heads/master
2021-01-01T05:19:31.547809
2016-04-12T07:25:13
2016-04-12T07:25:13
56,041,394
1
0
null
null
null
null
UTF-8
Java
false
false
1,947
java
/* * Copyright 2015 Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.onosproject.net.topology; import org.onosproject.net.DisjointPath; import org.onosproject.net.ElementId; import org.onosproject.net.Link; import org.onosproject.net.Path; import java.util.Map; import java.util.Set; /** * Test adapter for path service. */ public class PathServiceAdapter implements PathService { @Override public Set<Path> getPaths(ElementId src, ElementId dst) { return null; } @Override public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) { return null; } @Override public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst) { return null; } @Override public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight) { return null; } @Override public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, Map<Link, Object> riskProfile) { return null; } @Override public Set<DisjointPath> getDisjointPaths(ElementId src, ElementId dst, LinkWeight weight, Map<Link, Object> riskProfile) { return null; } }
5e0b063031e3e604febf884924f499d9a342443d
025cb8baa7e170c7fb202584330ad6aace26440d
/src/main/java/de/creep/steelsnake/hotkeys/LeftListener.java
7fb08603a1239b0a8b4f5165aa2592ee688cd29b
[ "MIT" ]
permissive
Creepios/SteelSnake
39f7b1fe03db0e0f3e19f0aef2ab5395d9a32395
730ee9252814624087bafa54abb9288d10ef0160
refs/heads/master
2023-01-12T03:09:52.183514
2022-12-26T20:10:37
2022-12-26T20:10:37
289,348,589
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
// SteelSnake: File was created on 19.08.2020 by Creep (Discord: Creep#4924) package de.creep.steelsnake.hotkeys; import com.tulskiy.keymaster.common.HotKey; import com.tulskiy.keymaster.common.HotKeyListener; import de.creep.steelsnake.SteelSnake; import de.creep.steelsnake.utils.Direction; import java.awt.*; public class LeftListener implements HotKeyListener { public void onHotKey(HotKey hotKey) { SteelSnake.getInstance().setSnakeDirection(Direction.LEFT); } }
c90ba328374b06428a1ac428f4ccac4aad8fb935
d04bdb5f5b8bb600ecbc7b961fe6f4cfc1d5a0dc
/app/src/main/java/org/app/prevengapp/MisReportesSinConexionAdater.java
02517a1560f739554b866f721b7a935032cba860
[]
no_license
DervisGomez/PrevengApp
86adfe4b99255d46bab00ac75c4a4dda40dc1190
c9cf441e5f0064a1c318bd5b8a39e646b6c0bd0b
refs/heads/master
2021-01-21T13:21:39.655472
2017-08-14T17:57:00
2017-08-14T17:57:00
91,810,492
0
0
null
null
null
null
UTF-8
Java
false
false
2,884
java
package org.app.prevengapp; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.TextView; import java.util.List; /** * Created by dervis on 25/01/17. */ public class MisReportesSinConexionAdater extends BaseAdapter { private ListaSinConexionActivity context; private List<String[]> items; public MisReportesSinConexionAdater(ListaSinConexionActivity context, List<String[]> items) { this.context = context; this.items = items; } @Override public int getCount() { return this.items.size(); } @Override public Object getItem(int position) { return this.items.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { View rowView = convertView; if (convertView == null) { // Create a new view into the list. LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); rowView = inflater.inflate(R.layout.adapter_reportes_sin_conexion, parent, false); } TextView titulo=(TextView) rowView.findViewById(R.id.TituloMisReporte2); TextView estado=(TextView) rowView.findViewById(R.id.EstadoMisReporte2); TextView fecha=(TextView)rowView.findViewById(R.id.tvFechaR2); TextView id=(TextView)rowView.findViewById(R.id.tvNumero2); Button sincronizar=(Button)rowView.findViewById(R.id.btnSincronizar); id.setText(items.get(position)[0]); titulo.setText(items.get(position)[1]); estado.setText(items.get(position)[2]); fecha.setVisibility(View.GONE); final String dd=items.get(position)[0]; final View finalRowView = rowView; sincronizar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(finalRowView.getContext(),IngresarActivity.class); intent.putExtra("reporte",dd); finalRowView.getContext().startActivity(intent); context.cerrarAplicacion(); } }); id.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent=new Intent(finalRowView.getContext(),DetalleSinConexionActivity.class); intent.putExtra("id",dd); finalRowView.getContext().startActivity(intent); } }); // Set data into the view return rowView; } }
4a4aedeb178e7d18695b1f4b90afbcfb69c68f5a
988eb5fcf04b2b5d4d53211aabb7f60c35ce373f
/src/main/java/com/lsz/demo/config/DataSourceConfiguration.java
92992ef281305ec6cd35872f7ea8a304f86b6742
[]
no_license
connorlsz/demo
94078a7232a8c496ddbd5e9c387e947feca79f76
1b83449419e5737179f6f51ab3593850ecc61990
refs/heads/master
2021-03-27T17:38:41.192498
2020-09-21T01:05:35
2020-09-21T01:05:35
123,768,827
0
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
package com.lsz.demo.config; import com.mchange.v2.c3p0.ComboPooledDataSource; import org.mybatis.spring.annotation.MapperScan; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.beans.PropertyVetoException; /** * 连接数据库 连接池 */ @Configuration // 扫描mapper文件 @MapperScan("com.lsz.demo.dao") public class DataSourceConfiguration { @Value("${jdbc.jdbcUserName}") private String jdbcUserName; @Value("${jdbc.jdbcDriverClass}") private String driverClass; @Value("${jdbc.jdbcUrl}") private String jdbcUrl; @Value("${jdbc.jdbcPassword}") private String jdbcPassword; @Bean(name = "dataSource") public ComboPooledDataSource createComboPooledDataSource() throws PropertyVetoException { ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource(); comboPooledDataSource.setDriverClass(driverClass); comboPooledDataSource.setJdbcUrl(jdbcUrl); comboPooledDataSource.setUser(jdbcUserName); comboPooledDataSource.setPassword(jdbcPassword); // 连接关闭时不提交事务 comboPooledDataSource.setAutoCommitOnClose(false); return comboPooledDataSource; } }
b37f90716a1f09054c2702e84cd94907ef3f5f41
3b510e7c35a0d6d10131436f09fb81a3f9414c13
/randoop/src/main/java/randoop/operation/EnumConstant.java
d325f2bd4ec7d44dc45b585b7f49d0872b8aad7d
[ "MIT", "Apache-2.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
Groostav/CMPT880-term-project
f9e680b5d54f6ff18ee2e21f091b0732bb831220
6120c4de0780aaea78870c3842be9a299b9e3100
refs/heads/master
2016-08-12T22:05:57.654319
2016-04-19T08:13:43
2016-04-19T08:13:43
55,188,786
0
1
null
null
null
null
UTF-8
Java
false
false
6,551
java
package randoop.operation; import java.io.PrintStream; import java.io.Serializable; import java.util.Collections; import java.util.List; import randoop.ExecutionOutcome; import randoop.NormalExecution; import randoop.sequence.Variable; import randoop.types.TypeNames; /** * EnumConstant is an {@link Operation} representing a constant value from an * enum. * <p> * Using the formal notation in {@link Operation}, a constant named BLUE from * the enum Colors is an operation BLUE : [] &rarr; Colors. * <p> * Execution simply returns the constant value. */ public class EnumConstant extends AbstractOperation implements Operation, Serializable { private static final long serialVersionUID = 849994347169442078L; public static final String ID = "enum"; private Enum<?> value; public EnumConstant(Enum<?> value) { if (value == null) { throw new IllegalArgumentException("enum constant cannot be null"); } this.value = value; } @Override public boolean equals(Object obj) { if (obj instanceof EnumConstant) { EnumConstant e = (EnumConstant) obj; return equals(e); } return false; } public boolean equals(EnumConstant e) { return (this.value.equals(e.value)); } @Override public int hashCode() { return value.hashCode(); } @Override public String toString() { return toParseableString(); } /** * {@inheritDoc} * * @return an empty list. */ @Override public List<Class<?>> getInputTypes() { return Collections.emptyList(); } public Class<?> type() { return value.getDeclaringClass(); } /** * {@inheritDoc} * * @return the enum type. */ @Override public Class<?> getOutputType() { return type(); } /** * {@inheritDoc} * * @return a {@link NormalExecution} object holding the value of the enum * constant. */ @Override public ExecutionOutcome execute(Object[] statementInput, PrintStream out) { assert statementInput.length == 0; return new NormalExecution(this.value, 0); } /** * {@inheritDoc} Adds qualified name of enum constant. */ @Override public void appendCode(List<Variable> inputVars, StringBuilder b) { b.append(TypeNames.getCompilableName(type()) + "." + this.value.name()); } /** * {@inheritDoc} Issues a string representation of an enum constant as a * type-value pair. The parse function should return an equivalent object. * * @see EnumConstant#parse(String) */ @Override public String toParseableString() { return type().getName() + ":" + value.name(); } /** * Parses the description of an enum constant value in a string as returned by * {@link EnumConstant#toParseableString()}. * * Valid strings may be of the form EnumType:EnumValue, or * OuterClass$InnerEnum:EnumValue for an enum that is an inner type of a * class. * * @param desc * string representing type-value pair for an enum constant * @return an EnumConstant representing the enum constant value in desc * @throws OperationParseException * if desc does not match expected form. */ public static EnumConstant parse(String desc) throws OperationParseException { if (desc == null) { throw new IllegalArgumentException("s cannot be null"); } int colonIdx = desc.indexOf(':'); if (colonIdx < 0) { String msg = "An enum constant description must be of the form \"" + "<type>:<value>" + " but description is \"" + desc + "\"."; throw new OperationParseException(msg); } String typeName = desc.substring(0, colonIdx).trim(); String valueName = desc.substring(colonIdx + 1).trim(); Enum<?> value = null; String errorPrefix = "Error when parsing type-value pair " + desc + " for an enum description of the form <type>:<value>."; if (typeName.isEmpty()) { String msg = errorPrefix + " No type given."; throw new OperationParseException(msg); } if (valueName.isEmpty()) { String msg = errorPrefix + " No value given."; throw new OperationParseException(msg); } String whitespacePattern = ".*\\s+.*"; if (typeName.matches(whitespacePattern)) { String msg = errorPrefix + " The type has unexpected whitespace characters."; throw new OperationParseException(msg); } if (valueName.matches(whitespacePattern)) { String msg = errorPrefix + " The value has unexpected whitespace characters."; throw new OperationParseException(msg); } Class<?> type; try { type = TypeNames.getTypeForName(typeName); } catch (ClassNotFoundException e) { String msg = errorPrefix + " The type given \"" + typeName + "\" was not recognized."; throw new OperationParseException(msg); } if (!type.isEnum()) { String msg = errorPrefix + " The type given \"" + typeName + "\" is not an enum."; throw new OperationParseException(msg); } value = valueOf(type, valueName); if (value == null) { String msg = errorPrefix + " The value given \"" + valueName + "\" is not a constant of the enum " + typeName + "."; throw new OperationParseException(msg); } return new EnumConstant(value); } /** * valueOf searches the enum constant list of a class for a constant with the * given name. Note: cannot make this work using valueOf method of Enum due to * typing. * * @param type * class that is already known to be an enum. * @param valueName * name for value that may be a constant of the enum. * @return reference to actual constant value, or null if none exists in type. */ private static Enum<?> valueOf(Class<?> type, String valueName) { for (Object obj : type.getEnumConstants()) { Enum<?> e = (Enum<?>) obj; if (e.name().equals(valueName)) { return e; } } return null; } /** * value * * @return object for value of enum constant. */ public Enum<?> value() { return this.value; } /** * {@inheritDoc} * * @return value of enum constant. */ @Override public Object getValue() { return value(); } /** * {@inheritDoc} * * @return enclosing enum type. */ @Override public Class<?> getDeclaringClass() { return value.getDeclaringClass(); } }
11c41ca452955ff0107ff4a2007f51a0791dafed
4397216932e035b0f6cd7b258a3e4fe701c736b3
/LeapYearCalculator/src/com/company/Main.java
64d1ea12854f4a0ad78165c00140f25a5aac73b4
[]
no_license
GitLudo95/IdeaProjects
641c6ec2c5e1729bcfd4b7213392fea7f0c54770
42fb368a71bc35a72d342ba774a3453510936471
refs/heads/master
2021-08-16T02:07:25.361026
2021-05-08T15:26:17
2021-05-08T15:26:17
150,996,614
0
0
null
2021-06-15T15:59:48
2018-09-30T18:56:37
Java
UTF-8
Java
false
false
1,477
java
package com.company; public class Main { public static void main(String[] args) { System.out.println(isLeapYear(1800)); System.out.println(getDaysInMonth(2,10000)); } public static boolean isLeapYear (int year) { if (year < 1 || year > 9999) { return false; } else if(year % 100 == 0 && year % 400 == 0) { return true; } else if(year % 100 == 0) { return false; } else if(year % 4 == 0) { return true; } else return false; } public static int getDaysInMonth (int month, int year) { if(year <1 || year >9999) { return -1; } else { } switch(month) { case 1: return 31; case 2: if(isLeapYear(year)) { return 29; } else return 28; case 3: return 31; case 4: return 30; case 5: return 31; case 6: return 30; case 7: return 31; case 8: return 31; case 9: return 30; case 10: return 31; case 11: return 30; case 12: return 31; default: return -1; } } }
777c6f4df85c7f356d1fc3137e27b2d5e78b0bc5
45665b150eb88bcb604b300a47a98bc647b4751f
/Source Code/src/ngo/music/soundcloudplayer/general/States.java
06ced897b4b0a167e7c5d964696a9b8c5f0ce896
[ "Apache-2.0" ]
permissive
FluidCoding/sound-cloud-player
613d25a12791c763e34a27f9de1a94e9b7741b65
51e4608959f4038b457bcbcf8d5d7ba4a3139431
refs/heads/master
2021-01-14T12:10:02.998415
2015-04-07T11:05:17
2015-04-07T11:05:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
235
java
package ngo.music.soundcloudplayer.general; public final class States { public static int musicPlayerState; public static int appState; public static int loginState = Constants.UserContant.NOT_LOGGED_IN; private States(){ } }
e6fc05526195d6493e568e1a6d7bc1c58afa23ce
144e1ec9468e6e3af01d2b8600ffc4e569f62984
/图片浏览选择/ChooseImages/UIL/src/main/java/com/nostra13/universalimageloader/core/display/BitmapDisplayer.java
e10df202b853c91202c674cddafae742c1f2d516
[]
no_license
blazecake/mz_demo
b7fe2f73b01f2e8b78220077fa2e3951b994174a
56db361fb57ce617b1e9edd398bf3c83ea3fdd52
refs/heads/master
2021-01-19T08:53:30.529612
2015-04-02T01:11:13
2015-04-02T01:11:13
28,904,482
4
0
null
null
null
null
UTF-8
Java
false
false
2,025
java
/******************************************************************************* * Copyright 2011-2013 Sergey Tarasevich * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *******************************************************************************/ package com.nostra13.universalimageloader.core.display; import android.graphics.Bitmap; import com.nostra13.universalimageloader.core.assist.LoadedFrom; import com.nostra13.universalimageloader.core.imageaware.ImageAware; /** * Displays {@link android.graphics.Bitmap} in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware}. Implementations can * apply some changes to Bitmap or any animation for displaying Bitmap.<br /> * Implementations have to be thread-safe. * * @author Sergey Tarasevich (nostra13[at]gmail[dot]com) * @see com.nostra13.universalimageloader.core.imageaware.ImageAware * @see com.nostra13.universalimageloader.core.assist.LoadedFrom * @since 1.5.6 */ public interface BitmapDisplayer { /** * Displays bitmap in {@link com.nostra13.universalimageloader.core.imageaware.ImageAware}. * <b>NOTE:</b> This method is called on UI thread so it's strongly recommended not to do any heavy work in it. * * @param bitmap Source bitmap * @param imageAware {@linkplain com.nostra13.universalimageloader.core.imageaware.ImageAware Image aware view} to * display Bitmap * @param loadedFrom Source of loaded image */ void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom); }
d8a5a13419f061706b166d5e5d4431d06f46ac67
43ab3c4fa9da0689f46638d0d6e0231b5a467057
/part-shop-rest/src/main/java/com/partsshop/rest/controller/PartsCategoryController.java
32b35cdf8da8287d269def835aabbc55699b3bad
[]
no_license
alaaabuzaghleh/part-shop-project
5bbe26ad0808e5807a48b20424fa2a8f6717e65d
a4dc5b21703f17da3cd7b2ecbd7f37d50415f3c1
refs/heads/master
2020-04-09T06:16:49.749315
2019-01-07T01:56:15
2019-01-07T01:56:15
160,105,692
0
0
null
null
null
null
UTF-8
Java
false
false
3,231
java
package com.partsshop.rest.controller; import java.util.ArrayList; import java.util.List; import java.util.Locale; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.security.access.annotation.Secured; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.partsshop.rest.dto.CarRest; import com.partsshop.rest.dto.PartsCategoryRest; import com.partsshop.rest.dto.RestMessage; import com.partsshop.rest.service.PartsCategoryService; @RestController @RequestMapping("/api/v1/parts-categories") public class PartsCategoryController { @Autowired private PartsCategoryService service ; @Autowired private MessageSource messageSource ; @PostMapping(value= {"", "/"}) @Secured("ROLE_ADMIN") public ResponseEntity<?> saveNewPart(@RequestBody @Valid PartsCategoryRest rest,@RequestHeader("Accept-Language") Locale locale){ PartsCategoryRest toReturn = this.service.savePart(rest) ; if(toReturn == null) { List<String> ls = new ArrayList<>() ; ls.add(this.messageSource.getMessage("Exception.unexpected", null, locale)) ; return new ResponseEntity<>(new RestMessage(false, ls), HttpStatus.INTERNAL_SERVER_ERROR) ; }else { List<String> ls = new ArrayList<>() ; ls.add(this.messageSource.getMessage("saved.success", null, locale)) ; return new ResponseEntity<>(new RestMessage(true, ls), HttpStatus.CREATED) ; } } @PutMapping(value= {"", "/"}) @Secured("ROLE_ADMIN") public ResponseEntity<?> updatePart(@RequestBody @Valid PartsCategoryRest rest,@RequestHeader("Accept-Language") Locale locale){ PartsCategoryRest tempPart = this.service.getNameById(rest.getId()); if(tempPart== null) { List<String> ls = new ArrayList<>() ; ls.add(this.messageSource.getMessage("Parts.notFound", null, locale)) ; return new ResponseEntity<>(new RestMessage(false, ls), HttpStatus.NOT_FOUND) ; }else { this.service.updatePart(rest) ; List<String> ls = new ArrayList<>() ; ls.add(this.messageSource.getMessage("saved.success", null, locale)) ; return new ResponseEntity<>(new RestMessage(true, ls), HttpStatus.ACCEPTED) ; } } @GetMapping(value= {"", "/"}) public ResponseEntity<?> getAllParts(@RequestHeader("Accept-Language") Locale locale){ List<PartsCategoryRest> parts=this.service.getNames(); if(parts==null || parts.isEmpty()) { List<String> ls = new ArrayList<>() ; ls.add(this.messageSource.getMessage("Parts.notFound", null, locale)) ; return new ResponseEntity<>(new RestMessage(false, ls), HttpStatus.NOT_FOUND) ; }else { return new ResponseEntity<>(parts, HttpStatus.OK) ; } } }
53ba70e05cb29a9c32a4656ede7c0848bda26550
d6c81db3b19e5ac5ac41b3faf4d86cb46e17d9a4
/src/main/java/com/xjt/utils/ProjectGenerateSqlFromExcel.java
2ebbc1782c2186a59dfe50f03212eb215c670ba6
[]
no_license
931145736/glassadmin
b43824885d58d39b0358ecc39c79ca83f1392ea0
d376ef92c933459f809e9c0e91eae79f29e2a0a6
refs/heads/master
2022-12-11T01:23:54.067795
2019-12-31T03:32:44
2019-12-31T03:32:44
231,019,208
0
0
null
2022-12-06T00:44:56
2019-12-31T03:29:40
Java
UTF-8
Java
false
false
17,602
java
package com.xjt.utils; import com.xjt.common.ExceptionResultInfo; import com.xjt.common.ResultInfo; import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Cell; import java.io.InputStream; import java.util.ArrayList; /** * Created by hs on 2017-06-17. */ public class ProjectGenerateSqlFromExcel { public static ArrayList<String[]> generateUserSql(InputStream inputStream) throws Exception { if (inputStream == null) { throw new Exception("没有文件导入"); } /*不支持2007以上版本**/ HSSFWorkbook workbook = new HSSFWorkbook(inputStream);//通过输入流使内存获得Excel文件 HSSFSheet sheet = null; //判断是否是模板 如果获得第一个sheet的第一行是否是模板中的标题 sheet = workbook.getSheetAt(0); HSSFCell titleCell1 = sheet.getRow(1).getCell(0); HSSFCell titleCell2 = sheet.getRow(1).getCell(1); HSSFCell titleCell3 = sheet.getRow(1).getCell(2); HSSFCell titleCell4 = sheet.getRow(1).getCell(3); HSSFCell titleCell5 = sheet.getRow(1).getCell(4); HSSFCell titleCell6 = sheet.getRow(1).getCell(5); HSSFCell titleCell7 = sheet.getRow(1).getCell(6); HSSFCell titleCell8 = sheet.getRow(1).getCell(7); HSSFCell titleCell9 = sheet.getRow(1).getCell(8); HSSFCell titleCell10 = sheet.getRow(1).getCell(9); HSSFCell titleCell11 = sheet.getRow(1).getCell(10); HSSFCell titleCell12 = sheet.getRow(1).getCell(11); HSSFCell titleCell13 = sheet.getRow(1).getCell(12); HSSFCell titleCell14 = sheet.getRow(1).getCell(13); HSSFCell titleCell15 = sheet.getRow(1).getCell(14); HSSFCell titleCell16 = sheet.getRow(1).getCell(15); HSSFCell titleCell17 = sheet.getRow(1).getCell(16); HSSFCell titleCell18 = sheet.getRow(1).getCell(17); HSSFCell titleCell19 = sheet.getRow(1).getCell(18); HSSFCell titleCell20 = sheet.getRow(1).getCell(19); HSSFCell titleCell21 = sheet.getRow(1).getCell(20); HSSFCell titleCell22 = sheet.getRow(1).getCell(21); HSSFCell titleCell23 = sheet.getRow(1).getCell(22); HSSFCell titleCell24 = sheet.getRow(1).getCell(23); HSSFCell titleCell25 = sheet.getRow(1).getCell(24); HSSFCell titleCell26 = sheet.getRow(1).getCell(25); HSSFCell titleCell27 = sheet.getRow(1).getCell(26); HSSFCell titleCell28 = sheet.getRow(1).getCell(27); HSSFCell titleCell29 = sheet.getRow(1).getCell(28); HSSFCell titleCell30 = sheet.getRow(1).getCell(29); HSSFCell titleCell31 = sheet.getRow(1).getCell(30); HSSFCell titleCell32 = sheet.getRow(1).getCell(31); HSSFCell titleCell33 = sheet.getRow(1).getCell(32); HSSFCell titleCell34 = sheet.getRow(1).getCell(33); HSSFCell titleCell35 = sheet.getRow(1).getCell(34); HSSFCell titleCell36 = sheet.getRow(1).getCell(35); HSSFCell titleCell37 = sheet.getRow(1).getCell(36); HSSFCell titleCell38 = sheet.getRow(1).getCell(37); HSSFCell titleCell39 = sheet.getRow(1).getCell(38); String titleValue1; String titleValue2; String titleValue3; String titleValue4; String titleValue5; String titleValue6; String titleValue7; String titleValue8; String titleValue9; String titleValue10; String titleValue11; String titleValue12; String titleValue13; String titleValue14; String titleValue15; String titleValue16; String titleValue17; String titleValue18; String titleValue19; String titleValue20; String titleValue21; String titleValue22; String titleValue23; String titleValue24; String titleValue25; String titleValue26; String titleValue27; String titleValue28; String titleValue29; String titleValue30; String titleValue31; String titleValue32; String titleValue33; String titleValue34; String titleValue35; String titleValue36; String titleValue37; String titleValue38; String titleValue39; if (titleCell1 == null) { titleValue1 = ""; } else { titleValue1 = titleCell1.getStringCellValue(); } if (titleCell2 == null) { titleValue2 = ""; } else { titleValue2 = titleCell2.getStringCellValue(); } if (titleCell3 == null) { titleValue3 = ""; } else { titleValue3 = titleCell3.getStringCellValue(); } if (titleCell4 == null) { titleValue4 = ""; } else { titleValue4 = titleCell4.getStringCellValue(); } if (titleCell5 == null) { titleValue5 = ""; } else { titleValue5 = titleCell5.getStringCellValue(); } if (titleCell6 == null) { titleValue6 = ""; } else { titleValue6 = titleCell6.getStringCellValue(); } if (titleCell7 == null) { titleValue7 = ""; } else { titleValue7 = titleCell7.getStringCellValue(); } if (titleCell8 == null) { titleValue8 = ""; } else { titleValue8 = titleCell8.getStringCellValue(); } if (titleCell9 == null) { titleValue9 = ""; } else { titleValue9 = titleCell9.getStringCellValue(); } if (titleCell10 == null) { titleValue10 = ""; } else { titleValue10 = titleCell10.getStringCellValue(); } if (titleCell11 == null) { titleValue11 = ""; } else { titleValue11 = titleCell11.getStringCellValue(); } if (titleCell12 == null) { titleValue12 = ""; } else { titleValue12 = titleCell12.getStringCellValue(); } if (titleCell13 == null) { titleValue13 = ""; } else { titleValue13 = titleCell13.getStringCellValue(); } if (titleCell14 == null) { titleValue14 = ""; } else { titleValue14 = titleCell14.getStringCellValue(); } if (titleCell15 == null) { titleValue15 = ""; } else { titleValue15 = titleCell15.getStringCellValue(); } if (titleCell16 == null) { titleValue16 = ""; } else { titleValue16 = titleCell16.getStringCellValue(); } if (titleCell17 == null) { titleValue17 = ""; } else { titleValue17 = titleCell17.getStringCellValue(); } if (titleCell18 == null) { titleValue18 = ""; } else { titleValue18 = titleCell18.getStringCellValue(); } if (titleCell19 == null) { titleValue19 = ""; } else { titleValue19 = titleCell19.getStringCellValue(); } if (titleCell20 == null) { titleValue20 = ""; } else { titleValue20 = titleCell20.getStringCellValue(); } if (titleCell21 == null) { titleValue21 = ""; } else { titleValue21 = titleCell21.getStringCellValue(); } if (titleCell22 == null) { titleValue22 = ""; } else { titleValue22 = titleCell22.getStringCellValue(); } if (titleCell23 == null) { titleValue23 = ""; } else { titleValue23 = titleCell23.getStringCellValue(); } if (titleCell24 == null) { titleValue24 = ""; } else { titleValue24 = titleCell24.getStringCellValue(); } if (titleCell25 == null) { titleValue25 = ""; } else { titleValue25 = titleCell25.getStringCellValue(); } if (titleCell26 == null) { titleValue26 = ""; } else { titleValue26 = titleCell26.getStringCellValue(); } if (titleCell27 == null) { titleValue27 = ""; } else { titleValue27 = titleCell27.getStringCellValue(); } if (titleCell28 == null) { titleValue28 = ""; } else { titleValue28 = titleCell28.getStringCellValue(); } if (titleCell29 == null) { titleValue29 = ""; } else { titleValue29 = titleCell29.getStringCellValue(); } if (titleCell30 == null) { titleValue30 = ""; } else { titleValue30 = titleCell30.getStringCellValue(); } if (titleCell31 == null) { titleValue31 = ""; } else { titleValue31 = titleCell31.getStringCellValue(); } if (titleCell32 == null) { titleValue32 = ""; } else { titleValue32 = titleCell32.getStringCellValue(); } if (titleCell33 == null) { titleValue33 = ""; } else { titleValue33 = titleCell33.getStringCellValue(); } if (titleCell34 == null) { titleValue34 = ""; } else { titleValue34 = titleCell34.getStringCellValue(); } if (titleCell35 == null) { titleValue35 = ""; } else { titleValue35 = titleCell35.getStringCellValue(); } if (titleCell36 == null) { titleValue36 = ""; } else { titleValue36 = titleCell36.getStringCellValue(); } if (titleCell37 == null) { titleValue37 = ""; } else { titleValue37 = titleCell37.getStringCellValue(); } if (titleCell38 == null) { titleValue38 = ""; } else { titleValue38 = titleCell38.getStringCellValue(); } if (titleCell39 == null) { titleValue39 = ""; } else { titleValue39 = titleCell39.getStringCellValue(); } if (sheet != null) { if (sheet.getRow(0) == null) { ResultInfo resultInfo = new ResultInfo(); resultInfo.setMessage("导入的表格不是标准模板。请在右上角下载模板导入!"); throw new ExceptionResultInfo(resultInfo); } else if (!titleValue1.trim().equals("序号") || !titleValue2.trim().equals("项目所属年度") || !titleValue3.trim().equals("项目名称") || !titleValue4.trim().equals("项目类别") || !titleValue5.trim().equals("项目状态") || !titleValue6.trim().equals("项目主管单位") || !titleValue7.trim().equals("乡镇")||!titleValue8.trim().equals("村") || !titleValue9.trim().equals("实施主体") || !titleValue10.trim().equals("建设详细地址") || !titleValue11.trim().equals("建设性质") || !titleValue12.trim().equals("实施年度") || !titleValue13.trim().equals("完结年度") || !titleValue14.trim().equals("建设周期") || !titleValue15.trim().equals("是否贫困村") || !titleValue16.trim().equals("覆盖贫困村") || !titleValue17.trim().equals("绩效目标") || !titleValue18.trim().equals("是否统筹整合项目") || !titleValue19.trim().equals("资金文号来源") || !titleValue20.trim().equals("县文件号") ||!titleValue21.trim().equals("对应整合资金目录类型") || !titleValue22.trim().equals("指标下达功能科目") || !titleValue23.trim().equals("整合后功能科目") ||!titleValue24.trim().equals("统筹资金规模") || !titleValue25.trim().equals("项目建设规模及内容") || !titleValue26.trim().equals("受益非贫困户") ||!titleValue27.trim().equals("受益非贫困人口") || !titleValue28.trim().equals("受益贫困户") || !titleValue29.trim().equals("受益贫困人口") || !titleValue30.trim().equals("项目负责人") || !titleValue31.trim().equals("联系方式") || !titleValue32.trim().equals("社会效益")|| !titleValue33.trim().equals("经济效益")|| !titleValue34.trim().equals("本次拟申请资金")|| !titleValue35.trim().equals("中央资金")|| !titleValue36.trim().equals("省级资金")|| !titleValue37.trim().equals("市级资金")|| !titleValue38.trim().equals("县级资金")|| !titleValue39.trim().equals("社会资金")) {//判断标题是否正确 ResultInfo resultInfo = new ResultInfo(); resultInfo.setMessage("导入的表格不是标准模板。请在右上角下载模板导入!"); throw new ExceptionResultInfo(resultInfo); } else { HSSFCell titleCell = sheet.getRow(0).getCell(0); String titleValue = titleCell.getStringCellValue(); if (!titleValue.contains("项目批量导入模板")) { ResultInfo resultInfo = new ResultInfo(); resultInfo.setMessage("导入的表格不是标准模板。请在右上角下载模板导入!"); throw new ExceptionResultInfo(resultInfo); } } } else { ResultInfo resultInfo = new ResultInfo(); resultInfo.setMessage("导入的表格不是标准模板。请在右上角下载模板导入!"); throw new ExceptionResultInfo(resultInfo); } ArrayList<String[]> list = new ArrayList<String[]>();//返回的结果集 sheet = workbook.getSheetAt(0); //从excel的第二行开始读数据内容 for (int j = 2; j <= sheet.getLastRowNum(); j++) {//循环每个工作表中的各行row String[] valStr = new String[50];//准备接受存放一行row中各cell的值 HSSFRow row = sheet.getRow(j); if (row != null) { //判断该行是否为空行 int num = 0; for (int t = 0; t <= 38; t++) { HSSFCell cell = row.getCell(t); if (cell == null || cell.equals("") || cell.getCellType() == HSSFCell.CELL_TYPE_BLANK) { num++; } } if (num < 37) { for (int k = 0; k < row.getLastCellNum(); k++) {//循环每行中的各列cell 9 System.out.print(row.getCell(k) + "\t"); Cell cell = row.getCell(k);//获得一个单元格 String content = ""; //存放一个单元格中的值 //如果单元格不为空 if (cell != null) { if (HSSFCell.CELL_TYPE_FORMULA == cell.getCellType()) { ResultInfo resultInfo = new ResultInfo(); resultInfo.setMessage("Excel表格有误,请仔细检查是否有公式!"); throw new ExceptionResultInfo(resultInfo); } ///判断单元格值的类型(日期型需要特殊处理8小时问题) if (HSSFCell.CELL_TYPE_NUMERIC == cell.getCellType()) {//判断是否是数字型 :日期也是数字型的一种 System.out.println("数字型"); /* if (DateUtil.isCellDateFormatted(cell)) {//如果是日期型特殊处理 Date dateCellValue = cell.getDateCellValue(); long eighthour = 8 * 60 * 60 * 1000; long time = dateCellValue.getTime() - eighthour;//获得正确时间毫秒数 java.util.Date date = new java.util.Date();//创建生成正确的时间 date.setTime(time); SimpleDateFormat simpledate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); content = simpledate.format(date); }*/ //普通数值型 String tempcontent = Double.toString(cell.getNumericCellValue()); content = tempcontent.trim(); } else {//如果是字符型 String tempcontent = cell.getStringCellValue() == null ? "" : cell.getStringCellValue(); content = tempcontent.trim(); } valStr[k] = content;//将excel获取到的单元格值赋值给String类型的数组 } else { //单元格为空 valStr[k] = ""; } } list.add(valStr); } } //每循环一行list接收一下数据 System.out.print("/b"); } System.out.println("---Sheet表" + 0 + "处理完毕---"); return list; } }
8d6fc1414f8f6ed090c64eae765438f07293ad25
a1526322b26a087435520bc6457463dba38eb7ec
/2020_08_11_Generics/src/main/java/Test_01/GenericArray.java
53d9f50e1d0ce6d97fc4f50b415c6b9a995814ed
[]
no_license
tiled0203/Java_Development
1ee7994ec41fb58ef948cc34090704d375c63803
e2cce7c27c5a3d3ddc1c8769fbdad67dba6f1099
refs/heads/master
2023-01-14T12:29:15.335745
2020-11-19T13:12:58
2020-11-19T13:12:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package Test_01; public class GenericArray<E> { public E[] array; public int getSize(){ return array.length; } public E peek(){ return array[array.length - 1]; } public E push(E object){ E[] newArray = (E[])new Object[array.length + 1]; for (int i = 0; i < array.length; i++) { newArray[i] = array[i]; } newArray[array.length] = object; array = newArray; return object; } public E pop(){ E object = array[array.length - 1]; E[] newArray = (E[])new Object[array.length - 1]; for (int i = 0; i < array.length - 1; i++) { newArray[i] = array[i]; } return object; } public boolean isEmpty(){ return array.length == 0; } @Override public String toString(){ return "stack: " + array.toString(); } }
3400459e30fbce042cdc0332cc4d365c38e29975
27669359b0a803e0a48ea69b4f2bc3861c9505ce
/src/com/kingmon/project/webservice/common/service/BzdzRejectIpService.java
0f819d63a7703bd92392121c4e7f00c85f87c80c
[]
no_license
radtek/project
dbc9121f048e006989d11390a55aaada1885712f
eb82bd4aa8876fc13c96d5b2ab563fe6ea168ae8
refs/heads/master
2020-05-24T15:59:55.410432
2017-09-06T02:12:04
2017-09-06T02:12:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
package com.kingmon.project.webservice.common.service; import java.util.Map; import com.kingmon.base.data.DataSet; import com.kingmon.project.webservice.common.model.ServiceBzdzRejectIp; public interface BzdzRejectIpService { /** * 加载全部信息 * @param params * @return */ DataSet rejectIpList(Map<String, String> params); ServiceBzdzRejectIp selectById(String ip); /** * 添加 * @param * @return */ public void addIp(Map<String, Object> params ); /** * 修改 * @param * @return */ public void saveIp(Map<String, Object> params ); /** * * @param ipid */ public void updateIpState(String ipid); /** * 限制Ip是否有效 * @param ipid */ public void removeIp(String ipid,String sfyy,String ip); /** * 修改限制接口 * @param params */ public void saveXzjkRejectIp(Map<String,Object> params); /** * WEB 通过IP查看限制信息 * @param ip * @return */ public ServiceBzdzRejectIp selectBdIp(String ip); /** * 根据LongIP 查询 信息 * @param longip * @return */ public ServiceBzdzRejectIp selectBdLongIp(Long longip); }
faa5bf93aab9c76364f280096cd8ed1118689ab5
1de0639eea2f9eec36ab6f96b136ba9f891e390f
/java-mockito-bdd/src/test/java/com/mkdika/javamockitobdd/EmailFilterTest.java
5d4d96a6cb3960f9f521e4720f3db506458e698a
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
mkdika/jvm-test-suite
7180872957b4de9bdc741f94a587366dd6038a9b
73932f300f76065786b2cb0a61e7dbbef2ff2a35
refs/heads/master
2020-04-06T10:45:51.427897
2018-11-16T07:04:52
2018-11-16T07:04:52
157,390,828
0
0
null
null
null
null
UTF-8
Java
false
false
1,713
java
package com.mkdika.javamockitobdd; import com.mkdika.javamockitobdd.model.Mail; import com.mkdika.javamockitobdd.service.IncomingMailService; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; import static org.assertj.core.api.BDDAssertions.then; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; import static org.mockito.internal.verification.VerificationModeFactory.times; /** * Java Mockito BDD Demo * * <p> * This class is using Mockito BDD wrapper in order to fulfill * the "Given, When, Then" Structure. * </p> */ @RunWith(MockitoJUnitRunner.class) public class EmailFilterTest { private EmailFilter emailFilter; @Mock private IncomingMailService incomingMailService; @Before public void init() { emailFilter = new EmailFilter(); } @Test public void given_notNull_email_when_called_filter_then_return_result() { // Given // stub final Mail mail = new Mail("[email protected]", "[email protected]", "End year sale for you!", "Bla..bla..bla"); given(incomingMailService.getIncomingMail()) .willReturn(mail); // When final Boolean result = emailFilter.checkIncomingMail(incomingMailService.getIncomingMail()); // Then then(result) .as("Check that sender address contain suspicious promotion phrase") .isNotNull() .isEqualTo(Boolean.TRUE); // Verify Mock verify(incomingMailService,times(1)).getIncomingMail(); } }
b7dec27881bb66741afe98b43bf1a966cfb7dfcf
5f64ef2e3d2a99f0ea2a3eeed116d9d89f8bc6ec
/java/android/GantiTab/src/aini/nur/TabSatu.java
6f8d5243d93a58e5ef85c5d22f4375e68141dba9
[]
no_license
nurainir/nuraini
3f77a22b6161065e34e3d16d9d0dfa5c21caa6e1
59704616c4a289da0a3ef39cad26376cfbb29c65
refs/heads/master
2021-01-10T19:13:28.999029
2011-04-13T13:40:36
2011-04-13T13:40:36
32,705,621
2
0
null
null
null
null
UTF-8
Java
false
false
1,269
java
package aini.nur; /** * TabSatu menampilkan rating di android * @author : Nur Aini Rakhmawati * @since : March 18, 2011 * @license : GPL */ import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.RatingBar; import android.widget.Toast; import android.widget.RatingBar.OnRatingBarChangeListener; public class TabSatu extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tab1); final RatingBar rb = (RatingBar)findViewById(R.id.RatingBar01); rb.setOnRatingBarChangeListener(new OnRatingBarChangeListener() { public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) { Toast.makeText(TabSatu.this, "Rating Sekarang: " + rating, Toast.LENGTH_SHORT).show(); } }); Button button = (Button) findViewById(R.id.Button01); button.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { } }); } }
[ "[email protected]@f4ffccde-388a-575a-2cd9-47a10c9617cc" ]
[email protected]@f4ffccde-388a-575a-2cd9-47a10c9617cc
d58eab93d22d6a1455be6a7af51f4e13f2545e98
40665051fadf3fb75e5a8f655362126c1a2a3af6
/ibinti-bugvm/c7354112b42a6c63431710a0ca33ef44998cc0a3/6369/AVCaptureFileOutput.java
75c74db19326bdfc876e3c5747640b4dc399545a
[]
no_license
fermadeiral/StyleErrors
6f44379207e8490ba618365c54bdfef554fc4fde
d1a6149d9526eb757cf053bc971dbd92b2bfcdf1
refs/heads/master
2020-07-15T12:55:10.564494
2019-10-24T02:30:45
2019-10-24T02:30:45
205,546,543
2
0
null
null
null
null
UTF-8
Java
false
false
3,533
java
/* * Copyright (C) 2013-2015 RoboVM AB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.bugvm.apple.avfoundation; /*<imports>*/ import java.io.*; import java.nio.*; import java.util.*; import com.bugvm.objc.*; import com.bugvm.objc.annotation.*; import com.bugvm.objc.block.*; import com.bugvm.rt.*; import com.bugvm.rt.annotation.*; import com.bugvm.rt.bro.*; import com.bugvm.rt.bro.annotation.*; import com.bugvm.rt.bro.ptr.*; import com.bugvm.apple.foundation.*; import com.bugvm.apple.corefoundation.*; import com.bugvm.apple.dispatch.*; import com.bugvm.apple.coreanimation.*; import com.bugvm.apple.coreimage.*; import com.bugvm.apple.coregraphics.*; import com.bugvm.apple.coreaudio.*; import com.bugvm.apple.coremedia.*; import com.bugvm.apple.corevideo.*; import com.bugvm.apple.mediatoolbox.*; import com.bugvm.apple.audiotoolbox.*; import com.bugvm.apple.audiounit.*; /*</imports>*/ /*<javadoc>*/ /** * @since Available in iOS 4.0 and later. */ /*</javadoc>*/ /*<annotations>*/@Library("AVFoundation") @NativeClass/*</annotations>*/ /*<visibility>*/public/*</visibility>*/ class /*<name>*/AVCaptureFileOutput/*</name>*/ extends /*<extends>*/AVCaptureOutput/*</extends>*/ /*<implements>*//*</implements>*/ { /*<ptr>*/public static class AVCaptureFileOutputPtr extends Ptr<AVCaptureFileOutput, AVCaptureFileOutputPtr> {}/*</ptr>*/ /*<bind>*/static { ObjCRuntime.bind(AVCaptureFileOutput.class); }/*</bind>*/ /*<constants>*//*</constants>*/ /*<constructors>*/ public AVCaptureFileOutput() {} protected AVCaptureFileOutput(SkipInit skipInit) { super(skipInit); } /*</constructors>*/ /*<properties>*/ @Property(selector = "outputFileURL") public native NSURL getOutputFileURL(); @Property(selector = "isRecording") public native boolean isRecording(); @Property(selector = "recordedDuration") public native @ByVal CMTime getRecordedDuration(); @Property(selector = "recordedFileSize") public native long getRecordedFileSize(); @Property(selector = "maxRecordedDuration") public native @ByVal CMTime getMaxRecordedDuration(); @Property(selector = "setMaxRecordedDuration:") public native void setMaxRecordedDuration(@ByVal CMTime v); @Property(selector = "maxRecordedFileSize") public native long getMaxRecordedFileSize(); @Property(selector = "setMaxRecordedFileSize:") public native void setMaxRecordedFileSize(long v); @Property(selector = "minFreeDiskSpaceLimit") public native long getMinFreeDiskSpaceLimit(); @Property(selector = "setMinFreeDiskSpaceLimit:") public native void setMinFreeDiskSpaceLimit(long v); /*</properties>*/ /*<members>*//*</members>*/ /*<methods>*/ @Method(selector = "startRecordingToOutputFileURL:recordingDelegate:") public native void startRecording(NSURL outputFileURL, AVCaptureFileOutputRecordingDelegate delegate); @Method(selector = "stopRecording") public native void stopRecording(); /*</methods>*/ }
cb34dbd9b48680566a59e6101b67123c03e761a1
e5bd22a1a327a8bfe4ec63f2e690a2d181b54c53
/src/eu/freestylecraft/entitories/data/ItemLoader.java
1e8e682b45979f8fad7474a9a30fd245e3201d86
[]
no_license
FreeStyleCraft/Entitories
7f33d2dbb9f9f9ac6f0e125b203f635ae03a023e
88f4be43512f79115b8c91ba875f10dd33643f63
refs/heads/master
2022-11-23T22:19:19.895427
2020-08-07T12:45:09
2020-08-07T12:45:09
285,401,926
0
0
null
null
null
null
UTF-8
Java
false
false
2,505
java
package eu.freestylecraft.entitories.data; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.bukkit.Material; import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; public class ItemLoader { private YamlConfiguration storage; private File storageFile; private List<Item> cache; public ItemLoader(File yamlStorage) { this.storage = new YamlConfiguration(); this.storageFile = yamlStorage; this.cache = Collections.synchronizedList(new ArrayList<Item>()); } /** * Reloads the cache from items.yml * @return true if the cache was updated, false otherwise */ public boolean reload() { try { this.storage.load(this.storageFile); List<Item> newCache = Collections.synchronizedList(new ArrayList<Item>()); for(String name : storage.getKeys(false)) { String matname = storage.getString(name + ".material", "RED_STAINED_GLASS_PANE"); Material material = Material.getMaterial(matname); if(material == null) { material = Material.RED_STAINED_GLASS_PANE; } Item item = new Item( material, storage.getInt(name + ".amount", 1), name, storage.getString(name + ".name", "???"), storage.getString(name + ".description", ""), storage.getBoolean(name + ".enchanted", false), storage.getBoolean(name + ".close-on-click", false), ItemAction.parse(storage.getString(name + ".action", "none"))); newCache.add(item); } this.cache.clear(); this.cache = newCache; return true; } catch (IOException | InvalidConfigurationException e) { return false; } } /** * Returns all currently loaded items * @return a list of all items */ public List<Item> getItems() { return this.cache; } /** * Returns an item by its name * @param name the name to search for * @return the item matching the name, null if the item was not found */ public Item getItemByName(String name) { for(Item i : this.cache) { if(i.getName().equals(name)) { return i; } } return null; } /** * Returns an item by its name, but case-insensitive * @param name the name to search for * @return the item matching the name, null if the item was not found */ public Item getItemByNameIgnoreCase(String name) { for(Item i : this.cache) { if(i.getName().equalsIgnoreCase(name)) { return i; } } return null; } }
a4bbf4ad1c3105a5e8efdd8b940bd152054aebe2
189613a4a1f8dee2607fe181d0fd60ec730c87d5
/src/main/java/com/nitish/backend/service/impl/WebScraperServiceImpl.java
3cfae1652b7109cbdeddfea7138400d684b3781d
[]
no_license
nitish31jain/backend
b8e3cef3c8ce5ef7756b43c3fc59c7818bb89972
323716bbad2c17ed7cd3e8510ae465ec8f8cfe5c
refs/heads/master
2023-03-13T05:23:02.384429
2021-02-04T05:55:58
2021-02-04T05:55:58
335,849,195
0
0
null
null
null
null
UTF-8
Java
false
false
757
java
package com.nitish.backend.service.impl; import com.nitish.backend.client.WebScraperClient; import com.nitish.backend.model.dto.webscraper.AccountInfo; import com.nitish.backend.service.WebScraperService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service @Slf4j public class WebScraperServiceImpl implements WebScraperService { @Autowired private WebScraperClient webScraperClient; @Override public String downloadJobPostingFile(int jobId) { return webScraperClient.downloadJobPostingFile(jobId); } @Override public AccountInfo retrieveAccountInfo() { return webScraperClient.retrieveAccountInfo(); } }
ca1d149b22fe0c1fe14799a21b82e1a7ddb19036
da0efa8ffd08b86713aad007f10794c4b04d8267
/com/google/android/gms/common/internal/safeparcel/C0675a.java
e661522d04cbfd7203a1adba1f1b3751c0a295a6
[]
no_license
ibeae/tcash
e200c209c63fdfe63928b94846824d7091533f8a
4bd25deb63ea7605202514f6a405961a14ef2553
refs/heads/master
2020-05-05T13:09:34.582260
2017-09-07T06:19:19
2017-09-07T06:19:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,930
java
package com.google.android.gms.common.internal.safeparcel; import android.os.Bundle; import android.os.IBinder; import android.os.Parcel; import android.os.Parcelable; import android.os.Parcelable.Creator; import com.actionbarsherlock.view.Menu; import java.util.ArrayList; import java.util.List; public class C0675a { public static class C0674a extends RuntimeException { public C0674a(String str, Parcel parcel) { super(str + " Parcel: pos=" + parcel.dataPosition() + " size=" + parcel.dataSize()); } } public static int m1480a(int i) { return Menu.USER_MASK & i; } public static int m1481a(Parcel parcel) { return parcel.readInt(); } public static int m1482a(Parcel parcel, int i) { return (i & Menu.CATEGORY_MASK) != Menu.CATEGORY_MASK ? (i >> 16) & Menu.USER_MASK : parcel.readInt(); } public static <T extends Parcelable> T m1483a(Parcel parcel, int i, Creator<T> creator) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } Parcelable parcelable = (Parcelable) creator.createFromParcel(parcel); parcel.setDataPosition(a + dataPosition); return parcelable; } private static void m1484a(Parcel parcel, int i, int i2) { int a = C0675a.m1482a(parcel, i); if (a != i2) { throw new C0674a("Expected size " + i2 + " got " + a + " (0x" + Integer.toHexString(a) + ")", parcel); } } private static void m1485a(Parcel parcel, int i, int i2, int i3) { if (i2 != i3) { throw new C0674a("Expected size " + i3 + " got " + i2 + " (0x" + Integer.toHexString(i2) + ")", parcel); } } public static void m1486a(Parcel parcel, int i, List list, ClassLoader classLoader) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a != 0) { parcel.readList(list, classLoader); parcel.setDataPosition(a + dataPosition); } } public static int m1487b(Parcel parcel) { int a = C0675a.m1481a(parcel); int a2 = C0675a.m1482a(parcel, a); int dataPosition = parcel.dataPosition(); if (C0675a.m1480a(a) != 20293) { throw new C0674a("Expected object header. Got 0x" + Integer.toHexString(a), parcel); } a = dataPosition + a2; if (a >= dataPosition && a <= parcel.dataSize()) { return a; } throw new C0674a("Size read is invalid start=" + dataPosition + " end=" + a, parcel); } public static void m1488b(Parcel parcel, int i) { parcel.setDataPosition(C0675a.m1482a(parcel, i) + parcel.dataPosition()); } public static <T> T[] m1489b(Parcel parcel, int i, Creator<T> creator) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } T[] createTypedArray = parcel.createTypedArray(creator); parcel.setDataPosition(a + dataPosition); return createTypedArray; } public static <T> ArrayList<T> m1490c(Parcel parcel, int i, Creator<T> creator) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } ArrayList<T> createTypedArrayList = parcel.createTypedArrayList(creator); parcel.setDataPosition(a + dataPosition); return createTypedArrayList; } public static boolean m1491c(Parcel parcel, int i) { C0675a.m1484a(parcel, i, 4); return parcel.readInt() != 0; } public static byte m1492d(Parcel parcel, int i) { C0675a.m1484a(parcel, i, 4); return (byte) parcel.readInt(); } public static short m1493e(Parcel parcel, int i) { C0675a.m1484a(parcel, i, 4); return (short) parcel.readInt(); } public static int m1494f(Parcel parcel, int i) { C0675a.m1484a(parcel, i, 4); return parcel.readInt(); } public static Integer m1495g(Parcel parcel, int i) { int a = C0675a.m1482a(parcel, i); if (a == 0) { return null; } C0675a.m1485a(parcel, i, a, 4); return Integer.valueOf(parcel.readInt()); } public static long m1496h(Parcel parcel, int i) { C0675a.m1484a(parcel, i, 8); return parcel.readLong(); } public static float m1497i(Parcel parcel, int i) { C0675a.m1484a(parcel, i, 4); return parcel.readFloat(); } public static double m1498j(Parcel parcel, int i) { C0675a.m1484a(parcel, i, 8); return parcel.readDouble(); } public static String m1499k(Parcel parcel, int i) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } String readString = parcel.readString(); parcel.setDataPosition(a + dataPosition); return readString; } public static IBinder m1500l(Parcel parcel, int i) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } IBinder readStrongBinder = parcel.readStrongBinder(); parcel.setDataPosition(a + dataPosition); return readStrongBinder; } public static Bundle m1501m(Parcel parcel, int i) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } Bundle readBundle = parcel.readBundle(); parcel.setDataPosition(a + dataPosition); return readBundle; } public static byte[] m1502n(Parcel parcel, int i) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } byte[] createByteArray = parcel.createByteArray(); parcel.setDataPosition(a + dataPosition); return createByteArray; } public static String[] m1503o(Parcel parcel, int i) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } String[] createStringArray = parcel.createStringArray(); parcel.setDataPosition(a + dataPosition); return createStringArray; } public static ArrayList<String> m1504p(Parcel parcel, int i) { int a = C0675a.m1482a(parcel, i); int dataPosition = parcel.dataPosition(); if (a == 0) { return null; } ArrayList<String> createStringArrayList = parcel.createStringArrayList(); parcel.setDataPosition(a + dataPosition); return createStringArrayList; } }
1acbcba560e14315416dd7c6ca4b1a3da90fa33d
8baa6a6c59abd901ad380f124f7a09b6c7e1f072
/src/specifications/RequireEngineService.java
b2cff106c99fa8db2b09e50aeb069d84fbb4fff8
[]
no_license
nlejeune359/snooker_of_doom
365e36408efd54c7c22cbba22a7038f3c257a0c0
dd1365ffc9e54a82e3a0a6351a5440a03c923925
refs/heads/master
2023-04-02T09:46:18.256033
2021-04-09T23:05:57
2021-04-09T23:05:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
464
java
/* ****************************************************** * Simulator alpha - Composants logiciels 2015. * Copyright (C) 2015 <[email protected]>. * GPL version>=3 <http://www.gnu.org/licenses/>. * $Id: specifications/RequireEngineService.java 2015-03-09 buixuan. * ******************************************************/ package specifications; public interface RequireEngineService { public void bindEngineService(EngineService service); }
10bb5e07157f90a40b8c310770bef20f7260bb1a
502ad7aa520ee11ec9918d47ae84404fa1f87f23
/ToolProject/aidl_server/src/test/java/com/modularization/runtop/aidl/server/ExampleUnitTest.java
7c6bbdf56a2c1b749fec002beabfd7b9c44f1dd3
[]
no_license
DakTop/android-sources
cc37f4a6bfab26f8e94e3a9723a6cd75bc8adef1
f72874c51e05bdab69a0b21c10bb9939ea26c548
refs/heads/master
2020-12-02T22:10:07.648620
2018-07-21T12:28:43
2018-07-21T12:28:43
95,072,496
0
0
null
null
null
null
UTF-8
Java
false
false
415
java
package com.modularization.runtop.aidl.server; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "bzlup.139.com" ]
bzlup.139.com
02f110dc01792f737dae4923889626ac83ceb716
ff9a5d1257982d94db80c9fc142a896123ad3f1d
/GU_Course3/src/main/java/Lesson6_Testing/MainClassTest.java
97720663ae70f4024d1f12e3d899c16f06e7cd31
[]
no_license
BigElmo/Java
30039fe8ccf9abb363ec49d40885154b900ce6c2
470deb08f623ad6bbd55bf143fe25a281a2d2622
refs/heads/main
2023-08-29T10:07:01.989910
2021-11-05T14:36:58
2021-11-05T14:36:58
368,553,836
1
0
null
2021-11-05T14:36:59
2021-05-18T14:08:18
Java
UTF-8
Java
false
false
2,359
java
package Lesson6_Testing; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; public class MainClassTest { private MainClass mainClass; @BeforeEach public void init() { mainClass = new MainClass(); } @Test public void testRuntimeException() { Assertions.assertThrows(RuntimeException.class, () -> { int[] arr = mainClass.getAfter4Array(new int[] { 1, 2, 3, 3, 5, 6}); }); } @ParameterizedTest @MethodSource("dataForAfter4Array") public void testAfter4Array(int[] array, int[] result) { Assertions.assertArrayEquals(result, mainClass.getAfter4Array(array)); } public static Stream<Arguments> dataForAfter4Array() { List<Arguments> out = new ArrayList<>(); out.add(Arguments.arguments(new int[] { 1, 2, 3, 4, 5, 6 }, new int[] {5, 6})); out.add(Arguments.arguments(new int[] { 2, 4, 2, 2 }, new int[] { 2, 2 })); out.add(Arguments.arguments(new int[] { 1, 1, 4, 2, 2, 4, 3, 3 }, new int[] { 3, 3 })); out.add(Arguments.arguments(new int[] { 1, 2, 3, 4 }, new int[0])); return out.stream(); } @ParameterizedTest @MethodSource("dataFor1and4Array") public void test1and4Array(int[] array, boolean result) { Assertions.assertEquals(result, mainClass.has1and4Array(array)); } public static Stream<Arguments> dataFor1and4Array() { List<Arguments> out = new ArrayList<>(); out.add(Arguments.arguments(new int[] { 1, 4, 1, 4 }, true)); out.add(Arguments.arguments(new int[] { 4, 1, 4, 1 }, true)); out.add(Arguments.arguments(new int[] { 1, 1, 4, 4 }, true)); out.add(Arguments.arguments(new int[] { 4, 4, 1, 1 }, true)); out.add(Arguments.arguments(new int[] { 1, 1, 1, 4 }, true)); out.add(Arguments.arguments(new int[] { 1, 4, 4, 4 }, true)); out.add(Arguments.arguments(new int[] { 1, 2, 1, 4 }, false)); out.add(Arguments.arguments(new int[] { 1, 1, 1, 1 }, false)); return out.stream(); } }
4749f2e8d1ebe2651c83516c4366fbf653e1ee56
2ea60b577065bb5a7d7846f14c267054ecda3d9f
/supplies/FoodImpl.java
0d4b5fbb1127ccd8bad7c11fe5e83132b4639df5
[]
no_license
ndrwum/Oregon-Trail-Knockoff
b0458e75f8195c2fa672e49545d133e7e9290a6c
68d012ab3652f889130a4b71df6e3d3730309b62
refs/heads/master
2021-01-20T18:57:44.667182
2018-02-14T19:40:42
2018-02-14T19:40:42
65,671,450
0
0
null
null
null
null
UTF-8
Java
false
false
1,241
java
package supplies; /** Common parent class for all Food classes. */ public abstract class FoodImpl extends SuppliesImpl implements Food { /* Fields */ private int days_till_expiration; private int fill; /* Constructors */ protected FoodImpl(int amount, int unit_weight, String name, int days, int fill) { super(amount, unit_weight, name); // Validate input if (days <= 0) throw new IllegalArgumentException( "Days till expiration must be positive!"); // Fill can be anything! // Initialize fields this.days_till_expiration = days; this.fill = fill; } /* Food methods */ @Override public void consume() throws NoFoodException { if (getAmount() == 0) throw new NoFoodException(); setAmount(getAmount() - 1); } @Override public int getDaysTillExpiration() { return days_till_expiration; } @Override public void age() throws FoodExpiredException { days_till_expiration -= 1; if (days_till_expiration <= 0) throw new FoodExpiredException(); } @Override public int getFill() { return fill; } @Override public String toString() { return super.toString() + " (expires in " + getDaysTillExpiration() + " days)"; } }
7a433f62c2ca6a245fbf2646ab950da624da64fe
efcf3233a2a21411eb1ae2bff3b71baa548c6f04
/tracking/src/main/java/org/lcsim/recon/tracking/vsegment/hit/base/DigiTrackerHitElemental.java
04a484476064b59a40f2b88d064e4485cdfa4026
[ "BSD-2-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
slaclab/lcsim
95af8a8821bd1e7638f3c9c039655f9b4f797a92
afdee47b0e511a6f96595deae758dedaef2f4ae3
refs/heads/master
2023-07-06T19:40:04.589633
2023-03-20T21:38:33
2023-03-20T21:38:33
95,500,068
1
7
NOASSERTION
2023-03-20T21:10:47
2017-06-27T00:08:43
Java
UTF-8
Java
false
false
2,500
java
package org.lcsim.recon.tracking.vsegment.hit.base; import java.util.List; import java.util.ArrayList; import org.lcsim.event.MCParticle; import org.lcsim.recon.tracking.vsegment.geom.Sensor; import org.lcsim.recon.tracking.vsegment.hit.DigiTrackerHit; /** * Elemental DigiTrackerHit. * In simulation, this is a digitized signal from a single channel produced by a * single <tt>MCParticle</tt>. In data, this is a single channel signal after calibration. * * @author D.Onoprienko * @version $Id: DigiTrackerHitElemental.java,v 1.1 2008/12/06 21:53:44 onoprien Exp $ */ public class DigiTrackerHitElemental extends DigiTrackerHitAdapter { // -- Constructors : ---------------------------------------------------------- /** Constract from parameters. */ public DigiTrackerHitElemental(double signal, double time, Sensor sensor, int channel, MCParticle mcParticle) { _signal = signal; _time = time; _sensor = sensor; _channel = channel; _mcParticle = mcParticle; } /** Constract from parameters with no associated <tt>MCParticle</tt>. */ public DigiTrackerHitElemental(double signal, double time, Sensor sensor, int channel) { this(signal, time, sensor, channel, null); } /** Copy constructor. */ public DigiTrackerHitElemental(DigiTrackerHitElemental digiHit) { _signal = digiHit._signal; _time = digiHit._time; _sensor = digiHit._sensor; _channel = digiHit._channel; _mcParticle = digiHit._mcParticle; } // -- Getters : --------------------------------------------------------------- /** * Returns <tt>true</tt> if the hit is a superposition of more than one elemental hit. * Objects of this class always return <tt>false</tt>. */ public boolean isComposite() {return false;} /** * Returns <tt>MCParticle</tt> that produced the hit. * If the hit is composite, or does not have <tt>MCParticle</tt> associated with * it (noise, beam test data, etc.), returns <tt>null</tt>. */ public MCParticle getMCParticle() {return _mcParticle;} /** * Returns a list of underlying elemental hits. * Since the hit is not composite, returns a list with a single element - this hit. */ public List<DigiTrackerHit> getElementalHits() { List<DigiTrackerHit> hitList = new ArrayList<DigiTrackerHit>(1); hitList.add(this); return hitList; } // -- Private parts : --------------------------------------------------------- protected MCParticle _mcParticle; }
1506f13f4f3a39ab01a0861ce704dc9e31754d76
0a69d5870cbe7d1a15065050a5219e4238d4d009
/src/main/java/com/busreseravtionsystem/busreservation/controller/v1/api/BusReservationSystemController.java
fd12b62ac3c7fedd10c3f9fed7aa28f4899c5281
[]
no_license
Bankass77/busreservation
7b44b1bd86b08a58e3f8e486bebc2c002e8cab01
e95a97605356634ce0c817c755f501b8eabf773f
refs/heads/main
2023-01-27T14:17:22.166383
2020-12-02T18:11:49
2020-12-02T18:11:49
306,359,183
0
0
null
2020-10-30T10:13:07
2020-10-22T14:13:41
Java
UTF-8
Java
false
false
5,129
java
package com.busreseravtionsystem.busreservation.controller.v1.api; import java.util.List; import java.util.Optional; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.busreseravtionsystem.busreservation.controller.v1.request.BookTicketRequest; import com.busreseravtionsystem.busreservation.controller.v1.request.GetripSchedulesRequest; import com.busreseravtionsystem.busreservation.dto.bus.TicketDto; import com.busreseravtionsystem.busreservation.dto.bus.TripDto; import com.busreseravtionsystem.busreservation.dto.bus.TripScheduleDto; import com.busreseravtionsystem.busreservation.dto.response.Response; import com.busreseravtionsystem.busreservation.dto.user.UserDto; import com.busreseravtionsystem.busreservation.service.bus.BusReservationService; import com.busreseravtionsystem.busreservation.service.user.UserService; import com.busreseravtionsystem.busreservation.util.DateUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; @RestController @RequestMapping(value = "/api/v1/reservation") @Api(value = "bsr-application", description = "Operations pertaining to agency management and ticket issue int the BSR application.") public class BusReservationSystemController { @Autowired private BusReservationService busReservationService; @Autowired private UserService userService; @GetMapping("/stops") @ApiOperation(value = "", authorizations = { @Authorization(value = "apiKey") }) public Response<Object> getAllStop() { return Response.ok().setPayload(busReservationService.getAllStopDtos()); } @GetMapping("tripsbystops") @ApiOperation(value = "", authorizations = { @Authorization(value = "apiKey") }) public Response<Object> getripByStops(@RequestBody @Valid GetripSchedulesRequest getTripSchedulesRequest) { List<TripScheduleDto> dtos = busReservationService.getAvailableTripSchedules( getTripSchedulesRequest.getSourceStop(), getTripSchedulesRequest.getArrivalStop(), getTripSchedulesRequest.getTripDate().toString()); if (!dtos.isEmpty()) { return Response.ok().setPayload(dtos); } return Response.notFound() .setErrors(String.format( "No trips between source stop- '%s' and destination stop -'%s' are available at this time.", getTripSchedulesRequest.getSourceStop(), getTripSchedulesRequest.getArrivalStop())); } @GetMapping("/tripSchedules") @ApiOperation(value = "", authorizations = { @Authorization(value = "apiKey") }) public Response<Object> getTripSchedules(@RequestBody @Valid GetripSchedulesRequest getripSchedulesRequest) { List<TripScheduleDto> tripScheduleDtos = busReservationService.getAvailableTripSchedules( getripSchedulesRequest.getSourceStop(), getripSchedulesRequest.getArrivalStop(), DateUtils.formattedDate(getripSchedulesRequest.getTripDate())); if (!tripScheduleDtos.isEmpty()) { return Response.ok().setPayload(tripScheduleDtos); } return Response.notFound().setErrors(String.format( "No trips between source stop- '%s' and destination stop -'%s' are available at this date.\",\n" + " getTripSchedulesRequest.getSourceStop(), getTripSchedulesRequest.getArrivalStop())", getripSchedulesRequest.getSourceStop(), getripSchedulesRequest.getArrivalStop(), DateUtils.formattedDate(getripSchedulesRequest.getTripDate()))); } @PostMapping("/bookticket") @ApiOperation(value = "", authorizations = { @Authorization(value = "apiKey") }) public Response<Object> bookTicket(@RequestBody @Valid BookTicketRequest bookTicketRequest) { Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); String email = (String) authentication.getPrincipal(); Optional<UserDto> userEmail = Optional.ofNullable(userService.findUserByEmail(email)); if (userEmail.isPresent()) { Optional<TripDto> TripDtoOptional = Optional .ofNullable(busReservationService.getTripById(bookTicketRequest.getTripId())); if (TripDtoOptional.isPresent()) { Optional<TripScheduleDto> tripScheduleDtoOptional = Optional .ofNullable(busReservationService.getTripScheduleDto(TripDtoOptional.get(), DateUtils.formattedDate(bookTicketRequest.getTripDate()), true)); if (tripScheduleDtoOptional.isPresent()) { Optional<TicketDto> ticketOptional = Optional.ofNullable( busReservationService.bookTicket(tripScheduleDtoOptional.get(), userEmail.get())); if (ticketOptional.isPresent()) { return Response.ok().setPayload(ticketOptional.get()); } } } } return Response.badRequest().setErrors("Unable to process ticket booking."); } }
ee7fa6c0b9860a16345ec0bac8c5d7f8db475da0
a4a0b1c6a7789094aab0ec94324916b08bd9f484
/app/src/main/java/net/fitcome/jnidemo/MainActivity.java
009e7f642fe2e3a871d8bf9f4debe7a905fbbe9e
[]
no_license
android-coco/JniDemo
1e106a095a54f262fd63a19ef3bae31a8003a145
16f55f9929c42eeb8396fc9df0beaa0a6b553212
refs/heads/master
2021-01-19T10:35:31.305830
2017-04-11T06:19:31
2017-04-11T06:19:31
87,881,612
0
0
null
null
null
null
UTF-8
Java
false
false
532
java
package net.fitcome.jnidemo; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.widget.TextView; public class MainActivity extends AppCompatActivity { JniUtil x = new JniUtil(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TextView textView = (TextView) findViewById(R.id.info); textView.setText(x.getJniAdd(1,2) + " " + x.getJniString()); } }
[ "123456" ]
123456
408a98f893c850e6726f5cdabbaf58d3e639ef2a
039b88b8fca816fff2ea4c5485a1f3a8ef2776ce
/Jspider/Connecting2Objects/src/MainClass.java
6a8fe23b6f0e94ba25b62e4c0a36934079e3b773
[]
no_license
chiragsoni2401/Jspider-Java-Practice
43e0ee2e1af021ec66431850d7bd5b4b04d2be62
f23ccfaeb77c6cef2aa01fc055cb4dae237f9477
refs/heads/main
2023-08-23T05:55:09.819163
2021-10-21T18:02:16
2021-10-21T18:02:16
419,722,611
0
0
null
null
null
null
UTF-8
Java
false
false
120
java
public class MainClass { public static void main(String[] args) { B b = new B(); b.function(new A()); } }
6cb80b29ed9c6512dfe3b6bc5807306a6c446bce
ee0f390e3ee7eea9cef5c07bf4bf53637579f0f3
/aln_tools/bbmap_38.82/current/var2/FilterSam.java
8c130b5ef2a76ddde0255bf307e2683fc2c2289c
[ "BSD-3-Clause-LBNL", "MIT" ]
permissive
jeky82/dropseq
80cc00da9ba351bc4797f9860acdc8d4c1df2eb2
a2e0187bf42321cadf1a107c4ed48e4f5b4023ce
refs/heads/master
2022-11-16T11:04:04.332117
2020-07-15T09:24:44
2020-07-15T09:24:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
27,771
java
package var2; import java.io.PrintStream; import java.util.ArrayList; import java.util.Locale; import fileIO.ByteFile; import fileIO.FileFormat; import fileIO.ReadWrite; import shared.Parser; import shared.PreParser; import shared.ReadStats; import shared.Shared; import shared.Timer; import shared.Tools; import stream.ConcurrentReadInputStream; import stream.ConcurrentReadOutputStream; import stream.FastaReadInputStream; import stream.Read; import stream.SamLine; import stream.SamReadStreamer; import stream.SamStreamer; import structures.ListNum; /** * Removes lines with unsupported variations from a sam file. * * @author Brian Bushnell * @date January 25, 2018 * */ public class FilterSam { /*--------------------------------------------------------------*/ /*---------------- Initialization ----------------*/ /*--------------------------------------------------------------*/ /** * Code entrance from the command line. * @param args Command line arguments */ public static void main(String[] args){ //Start a timer immediately upon code entrance. Timer t=new Timer(); //Create an instance of this class FilterSam x=new FilterSam(args); //Run the object x.process(t); //Close the print stream if it was redirected Shared.closeStream(x.outstream); } /** * Constructor. * @param args Command line arguments */ public FilterSam(String[] args){ {//Preparse block for help, config files, and outstream PreParser pp=new PreParser(args, getClass(), false); args=pp.args; outstream=pp.outstream; } //Set shared static variables ReadWrite.USE_PIGZ=ReadWrite.USE_UNPIGZ=true; ReadWrite.MAX_ZIP_THREADS=Shared.threads(); SamLine.SET_FROM_OK=true; Var.CALL_INS=false; Var.CALL_DEL=false; //Create a parser object Parser parser=new Parser(); //Parse each argument for(int i=0; i<args.length; i++){ String arg=args[i]; //Break arguments into their constituent parts, in the form of "a=b" String[] split=arg.split("="); String a=split[0].toLowerCase(); String b=split.length>1 ? split[1] : null; if(a.equals("verbose")){ verbose=Tools.parseBoolean(b); }else if(a.equals("ordered")){ ordered=Tools.parseBoolean(b); }else if(a.equals("ss") || a.equals("streamer")){ useStreamer=Tools.parseBoolean(b); }else if(a.equals("ploidy")){ ploidy=Integer.parseInt(b); }else if(a.equals("prefilter")){ prefilter=Tools.parseBoolean(b); }else if(a.equals("ref")){ ref=b; }else if(a.equals("outbad") || a.equals("outb")){ outBad=b; }else if(a.equals("vars") || a.equals("variants") || a.equals("varfile") || a.equals("inv")){ varFile=b; }else if(a.equals("vcf") || a.equals("vcffile")){ vcfFile=b; }else if(a.equals("maxbadsubs") || a.equals("maxbadvars") || a.equals("mbv")){ maxBadVars=Integer.parseInt(b); }else if(a.equals("maxbadsubdepth") || a.equals("maxbadvardepth") || a.equals("maxbadsuballeledepth") || a.equals("maxbadvaralleledepth") || a.equals("mbsad") || a.equals("mbvad") || a.equals("mbad")){ maxBadAlleleDepth=Integer.parseInt(b); }else if(a.equals("maxbadallelefraction") || a.equals("mbaf")){ maxBadAlleleFraction=Float.parseFloat(b); }else if(a.equals("minbadsubreaddepth") || a.equals("minbadreaddepth") || a.equals("mbsrd") || a.equals("mbrd")){ minBadReadDepth=Integer.parseInt(b); }else if(a.equals("sub") || a.equals("subs")){ Var.CALL_SUB=Tools.parseBoolean(b); }else if(a.equals("ins") || a.equals("inss")){ Var.CALL_INS=Tools.parseBoolean(b); }else if(a.equals("del") || a.equals("dels")){ Var.CALL_DEL=Tools.parseBoolean(b); }else if(a.equals("indel") || a.equals("indels")){ Var.CALL_INS=Var.CALL_DEL=Tools.parseBoolean(b); }else if(a.equals("minedist") || a.equals("minenddist") || a.equals("border")){ minEDist=Integer.parseInt(b); }else if(a.equals("parse_flag_goes_here")){ long fake_variable=Tools.parseKMG(b); //Set a variable here }else if(parser.parse(arg, a, b)){//Parse standard flags in the parser //do nothing }else{ outstream.println("Unknown parameter "+args[i]); assert(false) : "Unknown parameter "+args[i]; } } {//Process parser fields Parser.processQuality(); maxReads=parser.maxReads; overwrite=ReadStats.overwrite=parser.overwrite; append=ReadStats.append=parser.append; in1=parser.in1; outGood=parser.out1; } assert(FastaReadInputStream.settingsOK()); //Ensure there is an input file // if(in1==null){throw new RuntimeException("Error - an input file and a VCF file are required.");} if(in1==null){throw new RuntimeException("Error - an input file is required.");} //Adjust the number of threads for input file reading if(!ByteFile.FORCE_MODE_BF1 && !ByteFile.FORCE_MODE_BF2 && Shared.threads()>2){ ByteFile.FORCE_MODE_BF2=true; } //Ensure output files can be written if(!Tools.testOutputFiles(overwrite, append, false, outGood, outBad)){ outstream.println((outGood==null)+", "+(outBad==null)); throw new RuntimeException("\n\noverwrite="+overwrite+"; Can't write to output files "+outGood+", "+outBad+"\n"); } //Ensure input files can be read if(!Tools.testInputFiles(false, true, in1, vcfFile, varFile)){ throw new RuntimeException("\nCan't read some input files.\n"); } //Ensure that no file was specified multiple times if(!Tools.testForDuplicateFiles(true, in1, vcfFile, varFile, outBad, outGood)){ throw new RuntimeException("\nSome file names were specified multiple times.\n"); } //Create output FileFormat objects ffoutGood=FileFormat.testOutput(outGood, FileFormat.SAM, null, true, overwrite, append, ordered); ffoutBad=FileFormat.testOutput(outBad, FileFormat.SAM, null, true, overwrite, append, ordered); //Create input FileFormat objects ffin1=FileFormat.testInput(in1, FileFormat.SAM, null, true, true); Timer t=new Timer(outstream, true); { t.start(); outstream.print("Loading scaffolds: "); if(ref==null){ scafMap=ScafMap.loadSamHeader(in1); }else{ scafMap=ScafMap.loadReference(ref, true); } assert(scafMap!=null && scafMap.size()>0) : "No scaffold names were loaded."; t.stop(pad(scafMap.size(), 12)+" \t"); } t.start(); if(varFile!=null){ outstream.print("Loading vars: "); varMap=VcfLoader.loadVarFile(varFile, scafMap); t.stop(pad(varMap.size(), 12)+" \t"); }else if(vcfFile!=null){t.start(); outstream.print("Loading vcf: "); varMap=VcfLoader.loadVcfFile(vcfFile, scafMap, true, false); t.stop(pad(varMap.size(), 12)+" \t"); }else{ outstream.print("Calling variants:\n"); String inString="in="+in1; // private int maxBadAlleleDepth=2; // /** Maximum allele fraction for variants considered unsupported */ // private float maxBadAlleleFraction=0.01f; String[] cvargs=new String[] {inString, "ref="+ref, "clearfilters", "minreads="+(maxBadAlleleDepth), "minallelefraction="+maxBadAlleleFraction, "printexecuting=f"}; CallVariants cv=new CallVariants(cvargs); cv.prefilter=prefilter; cv.ploidy=ploidy; varMap=cv.process(new Timer()); scafMap=cv.scafMap; t.stop(/*pad(varMap.size(), 12)+" \t"*/); } assert(Var.CALL_INS || Var.CALL_DEL || Var.CALL_SUB) : "Must enable at least one of subs, insertions, or deletions."; subsOnly=!Var.CALL_INS && !Var.CALL_DEL; } /*--------------------------------------------------------------*/ /*---------------- Outer Methods ----------------*/ /*--------------------------------------------------------------*/ /** Create read streams and process all data */ void process(Timer t){ //Turn off read validation in the input threads to increase speed final boolean vic=Read.VALIDATE_IN_CONSTRUCTOR; Read.VALIDATE_IN_CONSTRUCTOR=Shared.threads()<4; final SamReadStreamer ss; //Create a read input stream final ConcurrentReadInputStream cris; if(useStreamer){ cris=null; ss=new SamReadStreamer(ffin1, streamerThreads, true, maxReads); ss.start(); if(verbose){outstream.println("Started streamer");} }else{ ss=null; cris=ConcurrentReadInputStream.getReadInputStream(maxReads, true, ffin1, null); cris.start(); //Start the stream if(verbose){outstream.println("Started cris");} } //Optionally create a read output stream final ConcurrentReadOutputStream ros, rosb; if(ffoutGood!=null){ //Select output buffer size based on whether it needs to be ordered final int buff=(ordered ? Tools.mid(16, 128, (Shared.threads()*2)/3) : 8); ros=ConcurrentReadOutputStream.getStream(ffoutGood, null, null, null, buff, null, true); ros.start(); //Start the stream }else{ros=null;} if(ffoutBad!=null){ //Select output buffer size based on whether it needs to be ordered final int buff=(ordered ? Tools.mid(16, 128, (Shared.threads()*2)/3) : 8); rosb=ConcurrentReadOutputStream.getStream(ffoutBad, null, null, null, buff, null, false); rosb.start(); //Start the stream }else{rosb=null;} //Reset counters readsProcessed=0; basesProcessed=0; //Process the reads in separate threads spawnThreads(cris, ss, ros, rosb); if(verbose){outstream.println("Finished; closing streams.");} //Write anything that was accumulated by ReadStats errorState|=ReadStats.writeAll(); //Close the read streams errorState|=ReadWrite.closeStreams(cris, ros, rosb); //Reset read validation Read.VALIDATE_IN_CONSTRUCTOR=vic; //Report timing and results { t.stop(); //Calculate units per nanosecond double rpnano=readsProcessed/(double)(t.elapsed); double bpnano=basesProcessed/(double)(t.elapsed); final long rg=readsOut, rb=readsProcessed-readsOut; final long bg=basesOut, bb=basesProcessed-basesOut; //Add "k" and "m" for large numbers // String rpstring=(readsProcessed<100000 ? ""+readsProcessed : readsProcessed<100000000 ? (readsProcessed/1000)+"k" : (readsProcessed/1000000)+"m"); // String bpstring=(basesProcessed<100000 ? ""+basesProcessed : basesProcessed<100000000 ? (basesProcessed/1000)+"k" : (basesProcessed/1000000)+"m"); // String rgstring=(rg<100000 ? ""+rg : rg<100000000 ? (rg/1000)+"k" : (rg/1000000)+"m"); // String bgstring=(bg<100000 ? ""+bg : bg<100000000 ? (bg/1000)+"k" : (bg/1000000)+"m"); // String rbstring=(rb<100000 ? ""+rb : rb<100000000 ? (rb/1000)+"k" : (rb/1000000)+"m"); // String bbstring=(bb<100000 ? ""+bb : bb<100000000 ? (bb/1000)+"k" : (bb/1000000)+"m"); final int len=12; final String rpstring=pad(readsProcessed, len); final String bpstring=pad(basesProcessed, len); final String rgstring=pad(rg, len); final String bgstring=pad(bg, len); final String rbstring=pad(rb, len); final String bbstring=pad(bb, len); final double mappedReadsDiscarded=mappedReadsProcessed-mappedReadsRetained; double avgQGood=(bqSumGood/(double)mappedReadsRetained); double avgQBad=(bqSumBad/(double)mappedReadsDiscarded); double avgMapQGood=(mapqSumGood/(double)mappedReadsRetained); double avgMapQBad=(mapqSumBad/(double)mappedReadsDiscarded); double avgVarsGood=(varSumGood/(double)mappedReadsRetained); double avgVarsBad=(varSumBad/(double)mappedReadsDiscarded); final String avgQGoodS=pad(String.format(Locale.ROOT, "%.2f", avgQGood), len); final String avgQBadS=pad(String.format(Locale.ROOT, "%.2f", avgQBad), len); final String avgMapQGoodS=pad(String.format(Locale.ROOT, "%.2f", avgMapQGood), len); final String avgMapQBadS=pad(String.format(Locale.ROOT, "%.2f", avgMapQBad), len); final String avgVarsGoodS=pad(String.format(Locale.ROOT, "%.2f", avgVarsGood), len); final String avgVarsBadS=pad(String.format(Locale.ROOT, "%.2f", avgVarsBad), len); outstream.println("Time: \t\t"+t); outstream.println("Reads Processed: "+rpstring+" \t"+String.format(Locale.ROOT, "%.2fk reads/sec", rpnano*1000000)); outstream.println("Bases Processed: "+bpstring+" \t"+String.format(Locale.ROOT, "%.2fm bases/sec", bpnano*1000)); outstream.println(); outstream.println("Reads Retained: "+rgstring+" \t"+String.format(Locale.ROOT, "%.2f%%", (rg*100.0/readsProcessed))); outstream.println("Bases Retained: "+bgstring+" \t"+String.format(Locale.ROOT, "%.2f%%", (bg*100.0/basesProcessed))); outstream.println("Avg. Qual Retained: "+avgQGoodS); outstream.println("Avg. MapQ Retained: "+avgMapQGoodS); outstream.println("Avg. Vars Retained: "+avgVarsGoodS); outstream.println(); outstream.println("Reads Discarded: "+rbstring+" \t"+String.format(Locale.ROOT, "%.2f%%", (rb*100.0/readsProcessed))); outstream.println("Bases Discarded: "+bbstring+" \t"+String.format(Locale.ROOT, "%.2f%%", (bb*100.0/basesProcessed))); outstream.println("Avg. Qual Discarded:"+avgQBadS); outstream.println("Avg. MapQ Discarded:"+avgMapQBadS); outstream.println("Avg. Vars Discarded:"+avgVarsBadS); } //Throw an exception of there was an error in a thread if(errorState){ throw new RuntimeException(getClass().getName()+" terminated in an error state; the output may be corrupt."); } } private static String pad(long s, int len){ return pad(""+s, len); } private static String pad(String s, int len){ while(s.length()<len){s=" "+s;} return s; } /** Spawn process threads */ private void spawnThreads(final ConcurrentReadInputStream cris, final SamStreamer ss, final ConcurrentReadOutputStream ros, final ConcurrentReadOutputStream rosb){ //Do anything necessary prior to processing //Determine how many threads may be used final int threads=Shared.threads(); //Fill a list with ProcessThreads ArrayList<ProcessThread> alpt=new ArrayList<ProcessThread>(threads); for(int i=0; i<threads; i++){ alpt.add(new ProcessThread(cris, ss, ros, rosb, i)); } //Start the threads for(ProcessThread pt : alpt){ pt.start(); } //Wait for completion of all threads boolean success=true; for(ProcessThread pt : alpt){ //Wait until this thread has terminated while(pt.getState()!=Thread.State.TERMINATED){ try { //Attempt a join operation pt.join(); } catch (InterruptedException e) { //Potentially handle this, if it is expected to occur e.printStackTrace(); } } //Accumulate per-thread statistics readsProcessed+=pt.readsProcessedT; basesProcessed+=pt.basesProcessedT; mappedReadsProcessed+=pt.mappedReadsProcessedT; mappedBasesProcessed+=pt.mappedBasesProcessedT; mappedReadsRetained+=pt.mappedReadsRetainedT; mappedBasesRetained+=pt.mappedBasesRetainedT; readsOut+=pt.readsOutT; basesOut+=pt.basesOutT; bqSumGood+=pt.qSumGoodT; bqSumBad+=pt.qSumBadT; // adSumGood+=pt.adSumGoodT; // adSumBad+=pt.adSumBadT; // rdSumGood+=pt.rdSumGoodT; // rdSumBad+=pt.rdSumBadT; varSumGood+=pt.varSumGoodT; varSumBad+=pt.varSumBadT; mapqSumGood+=pt.mapqSumGoodT; mapqSumBad+=pt.mapqSumBadT; success&=pt.success; } //Track whether any threads failed if(!success){errorState=true;} //Do anything necessary after processing } /*--------------------------------------------------------------*/ /*---------------- Inner Methods ----------------*/ /*--------------------------------------------------------------*/ /*--------------------------------------------------------------*/ /*---------------- Inner Classes ----------------*/ /*--------------------------------------------------------------*/ /** This class is static to prevent accidental writing to shared variables. * It is safe to remove the static modifier. */ private class ProcessThread extends Thread { //Constructor ProcessThread(final ConcurrentReadInputStream cris_, final SamStreamer ss_, final ConcurrentReadOutputStream ros_, final ConcurrentReadOutputStream rosb_, final int tid_){ cris=cris_; ss=ss_; ros=ros_; rosb=rosb_; tid=tid_; } //Called by start() @Override public void run(){ //Do anything necessary prior to processing //Process the reads if(useStreamer){ processSS(); }else{ processCris(); } //Do anything necessary after processing //Indicate successful exit status success=true; } /** Iterate through the reads */ void processCris(){ //Grab the first ListNum of reads ListNum<Read> ln=cris.nextList(); //Grab the actual read list from the ListNum ArrayList<Read> reads=(ln!=null ? ln.list : null); //Check to ensure pairing is as expected if(reads!=null && !reads.isEmpty()){ Read r=reads.get(0); // assert(ffin1.samOrBam() || (r.mate!=null)==cris.paired()); //Disabled due to non-static access } //As long as there is a nonempty read list... while(ln!=null && reads!=null && reads.size()>0){//ln!=null prevents a compiler potential null access warning // if(verbose){outstream.println("Fetched "+reads.size()+" reads.");} //Disabled due to non-static access ArrayList<Read> good=new ArrayList<Read>(reads.size()); ArrayList<Read> bad=new ArrayList<Read>(Tools.max(1, reads.size()/4)); //Loop through each read in the list for(int idx=0; idx<reads.size(); idx++){ final Read r1=reads.get(idx); //Validate reads in worker threads if(!r1.validated()){r1.validate(true);} //Track the initial length for statistics final int initialLength1=r1.length(); //Increment counters readsProcessedT++; basesProcessedT+=initialLength1; { //Reads are processed in this block. boolean keep=processRead(r1); if(keep){ //Increment counters readsOutT++; basesOutT+=initialLength1; good.add(r1); }else{ bad.add(r1); } } } //Output reads to the output stream if(ros!=null){ros.add(good, ln.id);} if(rosb!=null){rosb.add(bad, ln.id);} //Notify the input stream that the list was used cris.returnList(ln); // if(verbose){outstream.println("Returned a list.");} //Disabled due to non-static access //Fetch a new list ln=cris.nextList(); reads=(ln!=null ? ln.list : null); } //Notify the input stream that the final list was used if(ln!=null){ cris.returnList(ln.id, ln.list==null || ln.list.isEmpty()); } } /** Iterate through the reads */ void processSS(){ //Grab the first ListNum of reads ListNum<Read> ln=ss.nextList(); //Grab the actual read list from the ListNum ArrayList<Read> reads=(ln!=null ? ln.list : null); //Check to ensure pairing is as expected if(reads!=null && !reads.isEmpty()){ Read r=reads.get(0); // assert(ffin1.samOrBam() || (r.mate!=null)==cris.paired()); //Disabled due to non-static access } //As long as there is a nonempty read list... while(ln!=null && reads!=null && reads.size()>0){//ln!=null prevents a compiler potential null access warning // if(verbose){outstream.println("Fetched "+reads.size()+" reads.");} //Disabled due to non-static access ArrayList<Read> good=new ArrayList<Read>(reads.size()); ArrayList<Read> bad=new ArrayList<Read>(Tools.max(1, reads.size()/4)); //Loop through each read in the list for(int idx=0; idx<reads.size(); idx++){ final Read r1=reads.get(idx); //Validate reads in worker threads if(!r1.validated()){r1.validate(true);} //Track the initial length for statistics final int initialLength1=r1.length(); //Increment counters readsProcessedT++; basesProcessedT+=initialLength1; { //Reads are processed in this block. boolean keep=processRead(r1); if(keep){ //Increment counters readsOutT++; basesOutT+=initialLength1; good.add(r1); }else{ bad.add(r1); } } } //Output reads to the output stream if(ros!=null){ros.add(good, ln.id);} if(rosb!=null){rosb.add(bad, ln.id);} //Fetch a new list ln=ss.nextList(); reads=(ln!=null ? ln.list : null); } //Notify the input stream that the final list was used if(ln!=null){ cris.returnList(ln.id, ln.list==null || ln.list.isEmpty()); } } /** * Process a read. * @param r1 Read 1 * @return True if the read should be kept, false if it should be discarded. */ boolean processRead(final Read r1){ return passesVariantFilter(r1); } private final boolean passesVariantFilter(Read r){ if(!r.mapped() || r.bases==null || r.samline==null || r.match==null){return true;} final int vars=(subsOnly ? Read.countSubs(r.match) : Read.countVars(r.match, Var.CALL_SUB, Var.CALL_INS, Var.CALL_DEL)); final int len=r.length(); final double q=r.avgQualityByProbabilityDouble(false, r.length()); final SamLine sl=r.samline; mappedReadsProcessedT++; mappedBasesProcessedT+=len; if(vars<=maxBadVars){ varSumGoodT+=vars; qSumGoodT+=q; mapqSumGoodT+=sl.mapq; mappedReadsRetainedT++; mappedBasesRetainedT+=len; return true; } final ArrayList<Var> list; if(subsOnly){ list=CallVariants.findUniqueSubs(r, sl, varMap, scafMap, maxBadAlleleDepth, maxBadAlleleFraction, minBadReadDepth, minEDist); }else{ list=CallVariants.findUniqueVars(r, sl, varMap, scafMap, maxBadAlleleDepth, maxBadAlleleFraction, minBadReadDepth, minEDist); } if(list==null || list.size()<=maxBadVars){ varSumGoodT+=vars; qSumGoodT+=q; mapqSumGoodT+=sl.mapq; mappedReadsRetainedT++; mappedBasesRetainedT+=len; return true; }else{ assert(list.size()>maxBadVars) : list.size()+", "+maxBadVars; for(Var v : list){ assert(v!=null) : sl.cigar+"\n"+vars+"\n"+v+"\n"+list; assert((v.type()==Var.SUB && Var.CALL_SUB) || (v.type()==Var.INS && Var.CALL_INS) || (v.type()==Var.DEL && Var.CALL_DEL)) : list.size()+", "+maxBadVars+"\n"+sl.cigar+"\n"+v+"\n"+list; } varSumBadT+=vars; qSumBadT+=q; mapqSumBadT+=sl.mapq; return false; } } /** Number of reads processed by this thread */ protected long readsProcessedT=0; /** Number of reads processed by this thread */ protected long basesProcessedT=0; /** Number of mapped reads processed by this thread */ protected long mappedReadsProcessedT=0; /** Number of mapped bases processed by this thread */ protected long mappedBasesProcessedT=0; /** Number of mapped reads retained by this thread */ protected long mappedReadsRetainedT=0; /** Number of mapped bases retained by this thread */ protected long mappedBasesRetainedT=0; /** Number of good reads processed by this thread */ protected long readsOutT=0; /** Number of good bases processed by this thread */ protected long basesOutT=0; protected double qSumGoodT=0; protected double qSumBadT=0; protected long varSumGoodT=0; protected long varSumBadT=0; protected long mapqSumGoodT=0; protected long mapqSumBadT=0; /** True only if this thread has completed successfully */ boolean success=false; /** Shared input stream */ private final ConcurrentReadInputStream cris; /** Shared input stream */ private final SamStreamer ss; /** Good output stream */ private final ConcurrentReadOutputStream ros; /** Bad output stream */ private final ConcurrentReadOutputStream rosb; /** Thread ID */ final int tid; } /*--------------------------------------------------------------*/ /*---------------- Fields ----------------*/ /*--------------------------------------------------------------*/ /** Primary input file path */ private String in1=null; /** Optional reference */ private String ref=null; /** Good output file path */ private String outGood=null; /** Bad output file path */ private String outBad=null; /** VCF file path */ private String varFile=null; /** Variant file path */ private String vcfFile=null; private VarMap varMap=null; private ScafMap scafMap=null; /*--------------------------------------------------------------*/ /** Maximum allowed unsupported substitutions in a read */ private int maxBadVars=1; /** Maximum variant depth for a variant to be considered unsupported */ private int maxBadAlleleDepth=2; /** Maximum allele fraction for variants considered unsupported */ private float maxBadAlleleFraction=0.01f; /** Minimum read depth for a variant to be considered unsupported */ private int minBadReadDepth=2; /** Ignore vars within this distance of the ends */ private int minEDist=5; private int ploidy=1; private boolean prefilter=false; /** Number of reads processed */ protected long readsProcessed=0; /** Number of bases processed */ protected long basesProcessed=0; /** Number of mapped reads processed by this thread */ protected long mappedReadsProcessed=0; /** Number of mapped bases processed by this thread */ protected long mappedBasesProcessed=0; /** Number of mapped reads retained by this thread */ protected long mappedReadsRetained=0; /** Number of mapped bases retained by this thread */ protected long mappedBasesRetained=0; /** Number of good reads processed */ protected long readsOut=0; /** Number of good bases processed */ protected long basesOut=0; protected double bqSumGood=0; protected double bqSumBad=0; // protected double adSumGood=0; // protected double adSumBad=0; // protected double rdSumGood=0; // protected double rdSumBad=0; protected long varSumGood=0; protected long varSumBad=0; protected long mapqSumGood=0; protected long mapqSumBad=0; /** Quit after processing this many input reads; -1 means no limit */ private long maxReads=-1; static boolean useStreamer=true; static int streamerThreads=3; /*--------------------------------------------------------------*/ /*---------------- Final Fields ----------------*/ /*--------------------------------------------------------------*/ /** Primary input file */ private final FileFormat ffin1; /** Primary output file */ private final FileFormat ffoutGood; /** Secondary output file */ private final FileFormat ffoutBad; private final boolean subsOnly; /*--------------------------------------------------------------*/ /*---------------- Common Fields ----------------*/ /*--------------------------------------------------------------*/ /** Print status messages to this output stream */ private PrintStream outstream=System.err; /** Print verbose messages */ public static boolean verbose=false; /** True if an error was encountered */ public boolean errorState=false; /** Overwrite existing output files */ private boolean overwrite=false; /** Append to existing output files */ private boolean append=false; /** Reads are output in input order */ private boolean ordered=true; }
c1cdb0f32dc85fdbf6ad9ee3a8e065564db1a609
c5a1d1a58c8c846494d26220eaaf2ef0968229a5
/src/main/java/cn/xdevops/designpatterns/abstractfactory/ClamPizza.java
6fa7b9769882b0df0216758250fdaa8999ee5ff5
[]
no_license
cookcodeblog/design-patterns-demo
bad9b5d14074605597d33b80f138f6858e205647
9c6d1da4e6515fe1a6979b261ea4557a2405191b
refs/heads/master
2023-06-02T03:43:15.614957
2021-06-27T01:58:15
2021-06-27T01:58:15
378,298,138
0
0
null
null
null
null
UTF-8
Java
false
false
550
java
package cn.xdevops.designpatterns.abstractfactory; public class ClamPizza extends Pizza { PizzaIngredientFactory ingredientFactory; public ClamPizza(PizzaIngredientFactory ingredientFactory) { this.ingredientFactory = ingredientFactory; } @Override void prepare() { System.out.println("Preparing " + name); dough = ingredientFactory.createDough(); sauce = ingredientFactory.createSauce(); cheese = ingredientFactory.createCheese(); clam = ingredientFactory.createClam(); } }
a2c0bbaa0a35cf3ad59e56c046fac6fef895d3f4
4dc51eda244cba50be874a288245b5d44ca5f161
/web/src/test/java/rabbitmq/Recv.java
db626429d5d7f480cfb8f54fc19dffee508e3124
[]
no_license
easonlian/blind
da50ceb3bffb0a350d502d096404a6f5376548e9
5b1c699ebf902b0cf540d980b0109d5cce0b51ac
refs/heads/master
2021-01-20T20:45:09.120043
2016-10-31T09:36:16
2016-10-31T09:36:16
65,655,356
0
0
null
null
null
null
UTF-8
Java
false
false
1,345
java
/* * Copyright (c) 2016 Qunar.com. All Rights Reserved. */ package rabbitmq; import com.rabbitmq.client.AMQP; import com.rabbitmq.client.Channel; import com.rabbitmq.client.Connection; import com.rabbitmq.client.ConnectionFactory; import com.rabbitmq.client.Consumer; import com.rabbitmq.client.DefaultConsumer; import com.rabbitmq.client.Envelope; import java.io.IOException; public class Recv { private final static String QUEUE_NAME = "hello"; public static void main(String[] argv) throws Exception { ConnectionFactory factory = new ConnectionFactory(); factory.setHost("localhost"); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.queueDeclare(QUEUE_NAME, false, false, false, null); System.out.println(" [*] Waiting for messages. To exit press CTRL+C"); Consumer consumer = new DefaultConsumer(channel) { @Override public void handleDelivery(String consumerTag, Envelope envelope, AMQP.BasicProperties properties, byte[] body) throws IOException { String message = new String(body, "UTF-8"); System.out.println(" [x] Received '" + message + "'"); } }; channel.basicConsume(QUEUE_NAME, true, consumer); } }
1ab129f9a54f9d66819a520e2ce7ac8d98396445
6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386
/google/cloud/networkservices/v1beta1/google-cloud-networkservices-v1beta1-java/proto-google-cloud-networkservices-v1beta1-java/src/main/java/com/google/cloud/networkservices/v1beta1/EndpointPolicyOrBuilder.java
f2859f867d7e400c8af23d06d9981273cf87fc82
[ "Apache-2.0" ]
permissive
oltoco/googleapis-gen
bf40cfad61b4217aca07068bd4922a86e3bbd2d5
00ca50bdde80906d6f62314ef4f7630b8cdb6e15
refs/heads/master
2023-07-17T22:11:47.848185
2021-08-29T20:39:47
2021-08-29T20:39:47
null
0
0
null
null
null
null
UTF-8
Java
false
true
12,180
java
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: google/cloud/networkservices/v1beta1/endpoint_policy.proto package com.google.cloud.networkservices.v1beta1; public interface EndpointPolicyOrBuilder extends // @@protoc_insertion_point(interface_extends:google.cloud.networkservices.v1beta1.EndpointPolicy) com.google.protobuf.MessageOrBuilder { /** * <pre> * Required. Name of the EndpointPolicy resource. It matches pattern * `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code> * @return The name. */ java.lang.String getName(); /** * <pre> * Required. Name of the EndpointPolicy resource. It matches pattern * `projects/{project}/locations/global/endpointPolicies/{endpoint_policy}`. * </pre> * * <code>string name = 1 [(.google.api.field_behavior) = REQUIRED];</code> * @return The bytes for name. */ com.google.protobuf.ByteString getNameBytes(); /** * <pre> * Output only. The timestamp when the resource was created. * </pre> * * <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the createTime field is set. */ boolean hasCreateTime(); /** * <pre> * Output only. The timestamp when the resource was created. * </pre> * * <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The createTime. */ com.google.protobuf.Timestamp getCreateTime(); /** * <pre> * Output only. The timestamp when the resource was created. * </pre> * * <code>.google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder(); /** * <pre> * Output only. The timestamp when the resource was updated. * </pre> * * <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return Whether the updateTime field is set. */ boolean hasUpdateTime(); /** * <pre> * Output only. The timestamp when the resource was updated. * </pre> * * <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> * @return The updateTime. */ com.google.protobuf.Timestamp getUpdateTime(); /** * <pre> * Output only. The timestamp when the resource was updated. * </pre> * * <code>.google.protobuf.Timestamp update_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY];</code> */ com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder(); /** * <pre> * Optional. Set of label tags associated with the EndpointPolicy resource. * </pre> * * <code>map&lt;string, string&gt; labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> */ int getLabelsCount(); /** * <pre> * Optional. Set of label tags associated with the EndpointPolicy resource. * </pre> * * <code>map&lt;string, string&gt; labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> */ boolean containsLabels( java.lang.String key); /** * Use {@link #getLabelsMap()} instead. */ @java.lang.Deprecated java.util.Map<java.lang.String, java.lang.String> getLabels(); /** * <pre> * Optional. Set of label tags associated with the EndpointPolicy resource. * </pre> * * <code>map&lt;string, string&gt; labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> */ java.util.Map<java.lang.String, java.lang.String> getLabelsMap(); /** * <pre> * Optional. Set of label tags associated with the EndpointPolicy resource. * </pre> * * <code>map&lt;string, string&gt; labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> */ java.lang.String getLabelsOrDefault( java.lang.String key, java.lang.String defaultValue); /** * <pre> * Optional. Set of label tags associated with the EndpointPolicy resource. * </pre> * * <code>map&lt;string, string&gt; labels = 4 [(.google.api.field_behavior) = OPTIONAL];</code> */ java.lang.String getLabelsOrThrow( java.lang.String key); /** * <pre> * Required. The type of endpoint policy. This is primarily used to validate * the configuration. * </pre> * * <code>.google.cloud.networkservices.v1beta1.EndpointPolicy.EndpointPolicyType type = 5 [(.google.api.field_behavior) = REQUIRED];</code> * @return The enum numeric value on the wire for type. */ int getTypeValue(); /** * <pre> * Required. The type of endpoint policy. This is primarily used to validate * the configuration. * </pre> * * <code>.google.cloud.networkservices.v1beta1.EndpointPolicy.EndpointPolicyType type = 5 [(.google.api.field_behavior) = REQUIRED];</code> * @return The type. */ com.google.cloud.networkservices.v1beta1.EndpointPolicy.EndpointPolicyType getType(); /** * <pre> * Optional. This field specifies the URL of AuthorizationPolicy resource that * applies authorization policies to the inbound traffic at the * matched endpoints. Refer to Authorization. If this field is not * specified, authorization is disabled(no authz checks) for this * endpoint. Applicable only when EndpointPolicyType is * SIDECAR_PROXY. * </pre> * * <code>string authorization_policy = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code> * @return The authorizationPolicy. */ java.lang.String getAuthorizationPolicy(); /** * <pre> * Optional. This field specifies the URL of AuthorizationPolicy resource that * applies authorization policies to the inbound traffic at the * matched endpoints. Refer to Authorization. If this field is not * specified, authorization is disabled(no authz checks) for this * endpoint. Applicable only when EndpointPolicyType is * SIDECAR_PROXY. * </pre> * * <code>string authorization_policy = 7 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code> * @return The bytes for authorizationPolicy. */ com.google.protobuf.ByteString getAuthorizationPolicyBytes(); /** * <pre> * Required. A matcher that selects endpoints to which the policies should be applied. * </pre> * * <code>.google.cloud.networkservices.v1beta1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED];</code> * @return Whether the endpointMatcher field is set. */ boolean hasEndpointMatcher(); /** * <pre> * Required. A matcher that selects endpoints to which the policies should be applied. * </pre> * * <code>.google.cloud.networkservices.v1beta1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED];</code> * @return The endpointMatcher. */ com.google.cloud.networkservices.v1beta1.EndpointMatcher getEndpointMatcher(); /** * <pre> * Required. A matcher that selects endpoints to which the policies should be applied. * </pre> * * <code>.google.cloud.networkservices.v1beta1.EndpointMatcher endpoint_matcher = 9 [(.google.api.field_behavior) = REQUIRED];</code> */ com.google.cloud.networkservices.v1beta1.EndpointMatcherOrBuilder getEndpointMatcherOrBuilder(); /** * <pre> * Optional. Port selector for the (matched) endpoints. If no port selector is * provided, the matched config is applied to all ports. * </pre> * * <code>.google.cloud.networkservices.v1beta1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL];</code> * @return Whether the trafficPortSelector field is set. */ boolean hasTrafficPortSelector(); /** * <pre> * Optional. Port selector for the (matched) endpoints. If no port selector is * provided, the matched config is applied to all ports. * </pre> * * <code>.google.cloud.networkservices.v1beta1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The trafficPortSelector. */ com.google.cloud.networkservices.v1beta1.TrafficPortSelector getTrafficPortSelector(); /** * <pre> * Optional. Port selector for the (matched) endpoints. If no port selector is * provided, the matched config is applied to all ports. * </pre> * * <code>.google.cloud.networkservices.v1beta1.TrafficPortSelector traffic_port_selector = 10 [(.google.api.field_behavior) = OPTIONAL];</code> */ com.google.cloud.networkservices.v1beta1.TrafficPortSelectorOrBuilder getTrafficPortSelectorOrBuilder(); /** * <pre> * Optional. A free-text description of the resource. Max length 1024 characters. * </pre> * * <code>string description = 11 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The description. */ java.lang.String getDescription(); /** * <pre> * Optional. A free-text description of the resource. Max length 1024 characters. * </pre> * * <code>string description = 11 [(.google.api.field_behavior) = OPTIONAL];</code> * @return The bytes for description. */ com.google.protobuf.ByteString getDescriptionBytes(); /** * <pre> * Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is used to * determine the authentication policy to be applied to terminate the inbound * traffic at the identified backends. If this field is not set, * authentication is disabled(open) for this endpoint. * </pre> * * <code>string server_tls_policy = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code> * @return The serverTlsPolicy. */ java.lang.String getServerTlsPolicy(); /** * <pre> * Optional. A URL referring to ServerTlsPolicy resource. ServerTlsPolicy is used to * determine the authentication policy to be applied to terminate the inbound * traffic at the identified backends. If this field is not set, * authentication is disabled(open) for this endpoint. * </pre> * * <code>string server_tls_policy = 12 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code> * @return The bytes for serverTlsPolicy. */ com.google.protobuf.ByteString getServerTlsPolicyBytes(); /** * <pre> * Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy can be set * to specify the authentication for traffic from the proxy to the actual * endpoints. More specifically, it is applied to the outgoing traffic from * the proxy to the endpoint. This is typically used for sidecar model where * the proxy identifies itself as endpoint to the control plane, with the * connection between sidecar and endpoint requiring authentication. If this * field is not set, authentication is disabled(open). Applicable only when * EndpointPolicyType is SIDECAR_PROXY. * </pre> * * <code>string client_tls_policy = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code> * @return The clientTlsPolicy. */ java.lang.String getClientTlsPolicy(); /** * <pre> * Optional. A URL referring to a ClientTlsPolicy resource. ClientTlsPolicy can be set * to specify the authentication for traffic from the proxy to the actual * endpoints. More specifically, it is applied to the outgoing traffic from * the proxy to the endpoint. This is typically used for sidecar model where * the proxy identifies itself as endpoint to the control plane, with the * connection between sidecar and endpoint requiring authentication. If this * field is not set, authentication is disabled(open). Applicable only when * EndpointPolicyType is SIDECAR_PROXY. * </pre> * * <code>string client_tls_policy = 13 [(.google.api.field_behavior) = OPTIONAL, (.google.api.resource_reference) = { ... }</code> * @return The bytes for clientTlsPolicy. */ com.google.protobuf.ByteString getClientTlsPolicyBytes(); }
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
ae2f38d8714df8369012c5c90e1cec7f89ff9d61
fca2a99a86c527c3237fe14230b963b92c124483
/Test1b/src/model/Utilities.java
c6e7e66d465bfd4b8034e6b726e394170e31a706
[]
no_license
elghargomi-mariam/EECS1022-W21-workspace
938da06671374062c3779a78190e703a52ca943a
1ce590224d32173df202ed346bc976dda06a899a
refs/heads/main
2023-04-06T13:14:00.569593
2021-04-06T00:46:49
2021-04-06T00:46:49
330,052,250
0
0
null
null
null
null
UTF-8
Java
false
false
13,650
java
package model; public class Utilities { /* * Requirements: * - It is strictly forbidden for you to use: * + Any Java library method (e.g., Arrays.sort) * (That is, there must not be an import statement in the beginning of this class.) * + arrays * - You will receive an immediate zero for this task if the requirement is violated. * * Only write lines of code within the methods given to you. * Do not add any new helper methods. * Do not declare any variables OUTSIDE the given methods. * You can only declare local variables within each method. * * Your submission will only be graded against: * - JUnit tests given to you in TestUtilities * - additional JUnit tests * (therefore it is important that you test your own methods * by either the console application class App or your own JUnit tests) */ /* Task 1. * * Input Parameters: * - `weightUnit` : either 'p' (for pound) or 'k' (for kilogram) * - `w` : the weight value * - `heightUnit` : either 'f' (for foot) or 'i' (for inch) * - `h` : the height value * * Error conditions (in order of priority): * 1. When the `weightUnit` is neither 'p' nor 'k' (case sensitive). * 2. When the `heightUnit` is neither 'f' nor 'i' (case sensitive). * 3. When not both weight value and height value are positive. * If multiple error conditions hold, return a message related to the error with the highest priority. * e.g., invoking getBMIReport('q', -154.3, 'I', -66.92) has all inputs invalid, * but only an error message about weight unit is returned. * * What to return? * - Return an error message if there is any error. * - Otherwise, calculate the Body Mass Index (BMI) by: weight (in kilogram) divided by the square of height (in meters). * + Use the following conversion rates (when needed): * 1 inch is 0.0254 meter (use it when `heightUnit` is 'i') * 1 foot is 0.3048 meter * 1 pound is 0.453592 kilogram * + The calculation result must be formatted with 2 digits after the decimal: * Use String.format("%.2f", someNumber) * + Also, include an interpretation message (case sensitive) according to the following scheme: * BMI < 18.5 means "Underweight" * 18.5 <= BMI < 25.0 means "Normal" * 25.0 <= BMI < 30.0 means "Overweight" * 30.0 <= BMI means "Obese" * * See the JUnit tests related to this method for the precise format of the string return value. */ public static String getBMIReport(char weightUnit, double w, char heightUnit, double h) { String result = ""; /* Your task is to implement this method, * so that running TestUtilities.java will pass all JUnit tests. * * Recall from Week 1's tutorial videos: * 1. No System.out.println statements should appear here. * Instead, an explicit, final `return` statement is placed for you. * 2. No Scanner operations should appear here (e.g., input.nextInt()). * Instead, refer to the input parameters of this method. * 3. Do not re-assign any of the parameter/input variables. */ // Your implementation of this method starts here. double bmi = 0.0; String format = ""; if(weightUnit == 'k') { if(heightUnit == 'f') { bmi = w / ((h * 0.3048)*(h * 0.3048)); format = String.format("%.2f", bmi); if (bmi < 18.5) { result ="BMI is: " + format + " (Underweight)"; }else if (bmi < 25.0 && bmi >= 18.5) { result ="BMI is: " + format + " (Normal)"; }else if (bmi < 30.0 && bmi >=25.0) { result = "BMI is: " + format + " (Overweight)"; }else if (bmi >= 30.0) { result = "BMI is: " + format + " (Obese)"; } }else { bmi = w / ((h *0.0254)*(h *0.0254)); format = String.format("%.2f", bmi); if (bmi < 18.5) { result ="BMI is: " + format + " (Underweight)"; }else if (bmi < 25.0 && bmi >= 18.5) { result ="BMI is: " + format + " (Normal)"; }else if (bmi < 30.0 && bmi >=25.0) { result = "BMI is: " + format + " (Overweight)"; }else if (bmi >= 30.0) { result = "BMI is: " + format + " (Obese)"; } } }else if(weightUnit == 'p') { if(heightUnit == 'f') { bmi = (w * 0.453592) / ((h * 0.3048)*(h * 0.3048)); format = String.format("%.2f", bmi); if (bmi < 18.5) { result ="BMI is: " + format + " (Underweight)"; }else if (bmi < 25.0 && bmi >= 18.5) { result ="BMI is: " + format + " (Normal)"; }else if (bmi < 30.0 && bmi >=25.0) { result = "BMI is: " + format + " (Overweight)"; }else if (bmi >= 30.0) { result = "BMI is: " + format + " (Obese)"; } }else { bmi = (w * 0.453592) / ((h *0.0254)*(h *0.0254)); format = String.format("%.2f", bmi); if (bmi < 18.5) { result ="BMI is: " + format + " (Underweight)"; }else if (bmi < 25.0 && bmi >= 18.5) { result ="BMI is: " + format+ " (Normal)"; }else if (bmi < 30.0 && bmi >=25.0) { result = "BMI is: " + format+ " (Overweight)"; }else if (bmi >= 30.0) { result = "BMI is: " + format + " (Obese)"; } } }if (weightUnit != 'p' && weightUnit != 'k') { result = "Error: " + weightUnit +" is not a valid weight unit"; }else if (heightUnit != 'f' && heightUnit != 'i') { result = "Error: " + heightUnit +" is not a valid height unit"; }else if(w<= 0 || h <= 0) { result = "Error: both weight and height must be positive"; } // Do not modify this return statement. return result; } /* * Task 2. * * Input Parameters: * - `coffeeType` : either 'L' (for light type), 'R' (for regular type) or 'D' (for dark type) * - `cupSize` : either 'S' (for small size), 'M' (for medium size) or 'L' (for large size) * - `numberofCup` : integer represent number of cups ordered * * Assumptions: * - the numberofCups is positive value greater than zero. * - `coffeeType` and `cupSize` characters are valid (no error checking is needed). * * What to return? - First you need to determine the preparation time * of single cup of coffee in term of minutes and seconds according to the following facts * If coffee type is light coffee then the initial preparation time of single cup of any size is 25 seconds. * If coffee type is regular coffee then the initial preparation time of single cup of any size is 45 seconds. * If coffee type is dark coffee then the initial preparation time of single cup of any size is 65 seconds. * * Now, consider the size * if the cup size is small then add 15 seconds. * if the cup size is medium then add 35 seconds. * if the cup size is large then add 45 seconds. * * Do not forget to consider the number of cup to determine the final preparation time of coffee order * * The output string should include message with case sensitive. For example: * * "You ordered 5 cups of type light and size small, then your time is 3 minutes 20 seconds" * "You ordered 1 cup of type light and size small, then your time is 0 minutes 40 seconds" * "You ordered 7 cups of type dark and size large, then your time is 12 minutes 50 seconds" * * Note: we use cup when the order is for single cup and * we use cups when the order is for more than one cup * * * See the JUnit tests related to this method for the precise format of the * string return value. */ public static String getCoffeeTime(char coffeeType, char cupSize, int numberofCup) { String result = ""; /* * Your task is to implement this method, so that running TestUtilities.java * will pass all JUnit tests. * * Recall from Week 1's tutorial videos: 1. No System.out.println statements * should appear here. Instead, an explicit, final `return` statement is placed * for you. 2. No Scanner operations should appear here (e.g., input.nextInt()). * Instead, refer to the input parameters of this method. 3. Do not re-assign * any of the parameter/input variables. */ int prep = 0; String size = ""; int minutes = 0; int seconds = 0; if (coffeeType == 'L') { prep = 25; if (cupSize == 'S') { prep += 15; size = "small"; }else if (cupSize == 'M') { prep += 35; size = "medium"; }else if (cupSize == 'L') { prep += 45; size = "large"; } seconds = prep* numberofCup; minutes = seconds / 60 ; seconds = seconds % 60; if (numberofCup == 1) { result = "You ordered 1 cup of type light and size " + size +", then your time is " + minutes + " minutes " + seconds +" seconds" ; }else { result = "You ordered " + numberofCup +" cups of type light and size " + size +", then your time is "+ minutes +" minutes " + seconds +" seconds" ; } }else if (coffeeType == 'R') { prep = 45; if (cupSize == 'S') { prep += 15; size = "small"; }else if (cupSize == 'M') { prep += 35; size = "medium"; }else if (cupSize == 'L') { prep += 45; size = "large"; } seconds =prep * numberofCup; minutes = seconds / 60 ; seconds = seconds % 60; if (numberofCup == 1) { result = "You ordered 1 cup of type regular and size " + size +", then your time is " + minutes + " minutes " + seconds +" seconds" ; }else { result = "You ordered " + numberofCup +" cups of type regular and size " + size +", then your time is "+ minutes +" minutes " + seconds +" seconds" ; } }else if (coffeeType == 'D') { prep = 65; if (cupSize == 'S') { prep += 15; size = "small"; }else if (cupSize == 'M') { prep += 35; size = "medium"; }else if (cupSize == 'L') { prep += 45; size = "large"; } seconds = prep * numberofCup; minutes = seconds / 60 ; seconds = seconds % 60; if (numberofCup == 1) { result = "You ordered 1 cup of type dark and size " + size +", then your time is " + minutes + " minutes " + seconds +" seconds" ; }else { result = "You ordered " + numberofCup +" cups of type dark and size " + size +", then your time is "+ minutes +" minutes " + seconds +" seconds" ; } } // Do not modify this return statement. return result; } /* * Task 3. * * Input Parameters: * - `carSpeed` : integer value represents car speed in kilometer per hour at time of ticket * - `roadSpeed` : integer value represents the road speed limit in kilometer per hour regulated by the City * - `whenItHappen` : either 'M' (for Morning day time), 'A' (for Afternoon day time) or 'E' (for Evening day time) * * Assumptions: * - `carSpeed` is greater than `roadSpeed` always * - `whenItHappen` character is valid (no error checking is needed). * * What to return? - First you need to determine speed ticket value in dollars according to the following facts * If difference between car speed and road speed limit is less than 20 kilometer/hour * then the initial ticket value is 80 dollars. * * If difference between car speed and road speed limit is between 20 and 40 kilometer/hour inclusive * then the initial ticket value is 250 dollars. * * If difference between car speed and road speed limit is more than 40 kilometer/hour * then the initial ticket value is 800 dollars. * * Now, consider the when ticket happen. * if speeding ticket happened during morning day time then add 150 dollars to the initial speeding ticket value * if speeding ticket happened during afternoon day time then add 100 dollars to the initial speeding ticket value * if speeding ticket happened during evening day time then add 540 dollars to the initial speeding ticket value * * The output string should include message with case sensitive. For example: * * "In the morning, your speed was 25 over the limit then your ticket value is 400$" * * "In the afternoon, your speed was 10 over the limit then your ticket value is 180$" * * See the JUnit tests related to this method for the precise format of the * string return value. */ public static String getTicketValue(int carSpeed, int roadSpeed, char whenItHappen) { String result = ""; /* * Your task is to implement this method, so that running TestUtilities.java * will pass all JUnit tests. * * Recall from Week 1's tutorial videos: 1. No System.out.println statements * should appear here. Instead, an explicit, final `return` statement is placed * for you. 2. No Scanner operations should appear here (e.g., input.nextInt()). * Instead, refer to the input parameters of this method. 3. Do not re-assign * any of the parameter/input variables. */ int diff = carSpeed - roadSpeed; int ticket = 0; String when = ""; if (diff < 20) { ticket = 80; if (whenItHappen == 'M') { ticket += 150; }else if (whenItHappen == 'A') { ticket += 100; }else if (whenItHappen == 'E') { ticket += 540; } }else if (diff >= 20 && diff <= 40) { ticket = 250; if (whenItHappen == 'M') { ticket += 150; }else if (whenItHappen == 'A') { ticket += 100; }else if (whenItHappen == 'E') { ticket += 540; } }else if (diff >40) { ticket = 800; if (whenItHappen == 'M') { ticket += 150; }else if (whenItHappen == 'A') { ticket += 100; }else if (whenItHappen == 'E') { ticket += 540; } } if (whenItHappen == 'M') { when = "morning"; }else if (whenItHappen == 'A') { when = "afternoon"; }else if (whenItHappen == 'E') { when = "evening"; } result = "In the " + when +", your speed was " + diff + " over the limit then your ticket value is " + ticket + "$"; // Do not modify this return statement. return result; } }
3c0f683ff671e7ffd985bb3c9e3120a0c9638784
eac112c7bf3fd48e88a180374af395c9250fbca2
/HabitAid Points/src/main/java/com/example/sonymobile/smartextension/hellolayouts/HelloLayoutsPreferenceActivity.java
225edd8ca2b09c0cd3debe8c5e01a1726f72ea54
[]
no_license
mye-morr/SW2Points
df95e4c8746ca4f47c8aefb34fd9c05bec45ba9e
d1bb42b03fc22071c74bc3ee590a8ee52aa30ab5
refs/heads/master
2021-01-11T17:05:37.205527
2017-01-22T12:39:21
2017-01-22T12:39:21
79,716,917
0
1
null
null
null
null
UTF-8
Java
false
false
10,359
java
/* Copyright (c) 2011, Sony Ericsson Mobile Communications AB Copyright (c) 2011-2013, Sony Mobile Communications AB All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Sony Ericsson Mobile Communications AB / Sony Mobile Communications AB 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 HOLDER 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.example.sonymobile.smartextension.hellolayouts; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.Preference; import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceActivity; import android.preference.PreferenceManager; import android.util.Log; import android.widget.EditText; /** * The sample control preference activity handles the preferences for the sample * control extension. */ public class HelloLayoutsPreferenceActivity extends PreferenceActivity { private static final int DIALOG_READ_ME = 1; private static final int DIALOG_CAPTION_2 = 2; private static final int DIALOG_CAPTION_1 = 3; private static final int DIALOG_CAPTION0 = 4; private static final int DIALOG_CAPTION1 = 5; private static final int DIALOG_CAPTION2 = 6; @SuppressWarnings("deprecation") @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Load the preferences from an XML resource. addPreferencesFromResource(R.xml.preference); // Handle read me. Preference preference = findPreference(getText(R.string.preference_key_read_me)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showDialog(DIALOG_READ_ME); return true; } }); // Handle caption-2. preference = findPreference(getText(R.string.preference_key_caption_2)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showDialog(DIALOG_CAPTION_2); return true; } }); // Handle caption1. preference = findPreference(getText(R.string.preference_key_caption_1)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showDialog(DIALOG_CAPTION_1); return true; } }); // Handle caption0. preference = findPreference(getText(R.string.preference_key_caption0)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showDialog(DIALOG_CAPTION0); return true; } }); // Handle caption1. preference = findPreference(getText(R.string.preference_key_caption1)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showDialog(DIALOG_CAPTION1); return true; } }); // Handle caption2. preference = findPreference(getText(R.string.preference_key_caption2)); preference.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { showDialog(DIALOG_CAPTION2); return true; } }); } @Override protected Dialog onCreateDialog(int id) { Dialog dialog = null; switch (id) { case DIALOG_READ_ME: dialog = createReadMeDialog(); break; case DIALOG_CAPTION_2: dialog = createCaptionDialog(-2); break; case DIALOG_CAPTION_1: dialog = createCaptionDialog(-1); break; case DIALOG_CAPTION0: dialog = createCaptionDialog(0); break; case DIALOG_CAPTION1: dialog = createCaptionDialog(1); break; case DIALOG_CAPTION2: dialog = createCaptionDialog(2); break; default: Log.w(HelloLayoutsExtensionService.LOG_TAG, "Not a valid dialog id: " + id); break; } return dialog; } /** * Create the Read me dialog. * * @return the D'ialog */ private Dialog createReadMeDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setMessage(R.string.preference_option_read_me_txt) .setTitle(R.string.preference_option_read_me) .setIcon(android.R.drawable.ic_dialog_info) .setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); return builder.create(); } private Dialog createCaptionDialog(int idx) { int iXformIdx = 0; switch(idx) { case -2: iXformIdx = 0; break; case -1: iXformIdx = 1; break; case 0: iXformIdx = 2; break; case 1: iXformIdx = 3; break; case 2: iXformIdx = 4; break; default: iXformIdx = 2; } final int iCaptionIdx = iXformIdx; final EditText etInput = new EditText(this); etInput.setText("1;2;3;4;5;6;7;8;9;10;11;12;13;14"); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Edit Caption") .setIcon(android.R.drawable.ic_input_delete) .setView(etInput) .setPositiveButton("Set", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { String sBuf = etInput.getText().toString(); int iBuf = 0; iBuf = sBuf.indexOf(":"); String sCategory = sBuf.substring(0, iBuf).trim(); sBuf = sBuf.substring(iBuf + 1).trim(); String[] sxProcess = sBuf.split(";"); String sCaptions = ""; String sPoints = ""; int iBuf2 = 0; for(int i=0; i < 14; i++) { if(i < sxProcess.length) { sBuf = sxProcess[i]; if(sBuf.indexOf("(") < 0) { sCaptions += ";" + sBuf.trim(); sPoints += ";0"; } else { iBuf = sBuf.indexOf("("); iBuf2 = sBuf.indexOf(")"); sCaptions += ";" + sBuf.substring(0,iBuf).trim(); sPoints += ";" + sBuf.substring(iBuf + 1, iBuf2).trim(); } } else { sCaptions += "; "; sPoints += "; "; } } sCaptions = sCaptions.substring(1, sCaptions.length()); sPoints = sPoints.substring(1, sPoints.length()); SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); sharedPrefs.edit() .putString("category" + Integer.toString(iCaptionIdx),sCategory) .putString("captions" + Integer.toString(iCaptionIdx),sCaptions) .putString("points" + Integer.toString(iCaptionIdx),sPoints) .commit(); } }).setNegativeButton("Cancel", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { } }); return builder.create(); } }
08034d4ff370473cce538d0218f6aafba3630ba4
f15304b7b3ff986df90b40ad088db167685e1d8e
/bookmarks-springmvc/src/main/java/com/sivalabs/bookmarks/entities/BookMark.java
589dc3f73bf9c0ad5ba945b6515ecde3c41901ac
[]
no_license
achintayya/spring-samples
7801d115797b2543bab7314c996ce3c0110ac3a4
ccf8db253b35d79faf45ba499323120bae78732b
refs/heads/master
2020-12-03T10:26:53.556740
2014-06-29T13:13:21
2014-06-29T13:13:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,215
java
/** * */ package com.sivalabs.bookmarks.entities; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.xml.bind.annotation.XmlRootElement; import org.apache.commons.lang.StringUtils; /** * @author Siva * */ @Entity @Table(name = "bookmarks") @XmlRootElement public class BookMark implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "bookmark_id") private Integer id; @Column(nullable=false) private String title; @Column(nullable=false) private String url; private String description; @ManyToOne @JoinColumn(name="user_id") private User user; @ManyToMany(cascade=CascadeType.ALL) @JoinTable(name = "bookmark_tag", joinColumns = {@JoinColumn(name="bookmark_id")}, inverseJoinColumns = {@JoinColumn(name="tag_id")} ) private Set<Tag> tags; public BookMark() { } public BookMark(Integer id) { super(); this.id = id; } public BookMark(Integer id, String title, String url, String description) { super(); this.id = id; this.title = title; this.url = url; this.description = description; } public BookMark(Integer id, String title, String url) { super(); this.id = id; this.title = title; this.url = url; } public BookMark(Integer id, String title, String url, String description, User user) { super(); this.id = id; this.title = title; this.url = url; this.description = description; this.user = user; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Set<Tag> getTags() { if(tags == null){ tags = new HashSet<Tag>(); } return tags; } public void setTags(Set<Tag> tags) { this.tags = tags; } public String getFormattedTags() { StringBuilder sb = new StringBuilder(); for (Tag tag : tags) { sb.append(tag.getTagName()+","); } String str = sb.toString(); /*if(str.length()>0){ str = str.substring(0,str.length()-1); }*/ str = StringUtils.chomp(str, ","); return str; } }
27371f434824a7753109c23550470dbdaace0399
f84b9ae1e5c42ab3afc4bd4273e200de99e1a81e
/src/main/java/com/kh/myapp/member/vo/PwdChkGrp.java
9b14063ef1909a69a3c74ab8108c2246013d1209
[]
no_license
minook1231/Springedu
2a3a1167c7cb2197f938e85db5fc3f5a1d97f878
41290868482fe227f53514eab3f699eabc4dd5b5
refs/heads/master
2020-03-22T05:24:20.167817
2018-07-03T10:19:24
2018-07-03T10:19:24
139,563,429
0
0
null
null
null
null
UTF-8
Java
false
false
61
java
package com.kh.myapp.member.vo; public class PwdChkGrp { }
433df59c9d1f8b977297b0de8bb8b2e75df8a7ab
75c47b6bb5faa255b4f79c9494b9cf3b0e412b2b
/kafka+ELK企业级实时日志分析平台/kafkaProducer/src/main/java/com/xiu/fastkafka/controller/KafkaController.java
6056ed441022b2b2afc6d5338455306f6b056288
[]
no_license
williamzhang11/fastScheme
5ca5128e5880b9454a0a8fe5f4167bbb916732d8
aa3525c79347b102d5584b8a2a2a21cbfd397099
refs/heads/master
2022-11-21T02:03:28.205928
2019-07-04T12:12:49
2019-07-04T12:12:49
178,649,279
1
0
null
2022-11-16T04:24:17
2019-03-31T06:03:46
Java
UTF-8
Java
false
false
730
java
package com.xiu.fastkafka.controller; import java.util.Date; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/kafka") public class KafkaController { @Autowired private KafkaTemplate<String, String> kafkaTemplate; @RequestMapping("/send") public String sendKafka(@RequestParam String msg) { System.err.println("msg="+msg); kafkaTemplate.send("test", msg); System.err.println(new Date()+"send ok"); return "ok"; } }
3e9317fd06cd54e94915585036bc627513b9acf0
92d79f9ce37ca996fc3b099a67bc7f06c5d22d11
/FitnessTracker/src/main/java/com/pluralsight/service/ExerciseService.java
3e56c48411c8b7234efb7e256b95b145462a7681
[]
no_license
shrutikadge/Shruti
7a76e8513c09aa59fd31cdfcacec306d213496f5
cfe9d195422627825468d7c7969fa70a815ee6b9
refs/heads/master
2021-06-06T19:48:53.820913
2018-10-23T06:01:15
2018-10-23T06:01:15
58,985,337
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package com.pluralsight.service; import java.util.List; import com.pluralsight.model.Activity; import com.pluralsight.model.Exercise; public interface ExerciseService { List<Activity> findAllActivities(); Exercise save(Exercise exercise); }
f327597035b98dcb2324e0e51e39d9de5f5a1831
d9f98dd1828e25bc2e8517e5467169830c5ded60
/src/main/java/com/alipay/api/response/ZhimaCreditEpLawsuitDetailGetResponse.java
de97ce7bcb1b357b2231d7d2a586be118ae3cc11
[]
no_license
benhailong/open_kit
6c99f3239de6dcd37f594f7927dc8b0e666105dc
a45dd2916854ee8000d2fb067b75160b82bc2c04
refs/heads/master
2021-09-19T18:22:23.628389
2018-07-30T08:18:18
2018-07-30T08:18:26
117,778,328
1
1
null
null
null
null
UTF-8
Java
false
false
972
java
package com.alipay.api.response; import com.alipay.api.internal.mapping.ApiField; import com.alipay.api.domain.EpInfo; import com.alipay.api.AlipayResponse; /** * ALIPAY API: zhima.credit.ep.lawsuit.detail.get response. * * @author auto create * @since 1.0, 2017-10-13 14:43:31 */ public class ZhimaCreditEpLawsuitDetailGetResponse extends AlipayResponse { private static final long serialVersionUID = 6213198283162949671L; /** * 芝麻信用对于每一次请求返回的业务号。后续可以通过此业务号进行对账 */ @ApiField("biz_no") private String bizNo; /** * 企业涉诉详情 */ @ApiField("lawsuit_detail") private EpInfo lawsuitDetail; public void setBizNo(String bizNo) { this.bizNo = bizNo; } public String getBizNo( ) { return this.bizNo; } public void setLawsuitDetail(EpInfo lawsuitDetail) { this.lawsuitDetail = lawsuitDetail; } public EpInfo getLawsuitDetail( ) { return this.lawsuitDetail; } }
65907a32bb25c6cba9b3db2758b9420d0b320694
3a21644bcb36e37cf7ea62e5aedcd977545ed5ba
/JavaStudy/src/baekjoon/b034.java
817f923daed3b3cd8a4bfa9abfaf54ba1df2d28c
[]
no_license
jinyoung1704/JavaStudy
46e3b9ad0728b670371b2abfd2df39f7d4191413
2e30fd1318d7752df2b9e52be8c20eaa5331fb04
refs/heads/master
2023-02-11T00:27:17.192440
2021-01-04T09:28:06
2021-01-04T09:28:06
291,988,032
0
0
null
null
null
null
UTF-8
Java
false
false
1,152
java
package baekjoon; //백준 9093번 단어뒤집기 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Stack; public class b034 { public static void main(String[] args) throws NumberFormatException, IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); StringBuffer sb = new StringBuffer(); for(int i=0;i<n;i++) { Stack<Character> stack = new Stack<>(); String s = br.readLine(); for(int j=0;j<s.length();j++) { if(s.charAt(j)==' ') { while(!stack.empty()) { sb.append(stack.pop()); //System.out.print(stack.pop()); } sb.append(" "); //System.out.print(" "); } else { stack.push(s.charAt(j)); //stack.push(s.charAt(j)); } } while(!stack.empty()) { sb.append(stack.pop()); //System.out.print(stack.pop()); } sb.append("\n"); } System.out.println(sb.toString()); } }
716bb75659748cc5a3e20d346833b82550577b20
e6e439368bb814f7779dab15d306ffe6cfe9a48b
/CoolWeather-master/app/src/main/java/com/example/qingjiaxu/coolweather/EventId.java
b810ef35467485ff61c813d6d4daea2a1be7f942
[]
no_license
Sharon-liu410/weather
0db2eb79caac0ae0ae5c2c5d097aa5828ed097fe
7d099608e1795ac084107583fc97969f480563a6
refs/heads/master
2020-11-28T23:21:33.091811
2019-12-24T13:32:10
2019-12-24T13:32:10
229,947,449
0
0
null
null
null
null
UTF-8
Java
false
false
266
java
package com.example.qingjiaxu.coolweather; public class EventId { public static final int EVENT_0X001 = 0x001; public static final int EVENT_0X002 = 0x002; public static final int EVENT_0X003 = 0x003; public static final int EVENT_0X004 = 0x004; }
05ee6ea30bb12c3c97f74581baf5da285621d9eb
60a956a0e2af0229d10554f6d713f0b37d14d2e2
/算法/TodayCoding0508.java
7a4a4b090b1d21627d668fd2d34616d9bd28a9b7
[]
no_license
djxf/AlgorithmCode
7943cadf78c3f91a92885032bde429e9c4f782b9
c9d2e97c0d63ef344403a8c4a919b8172a42587a
refs/heads/master
2023-04-24T08:03:55.259342
2021-05-10T05:03:10
2021-05-10T05:03:10
262,306,323
1
0
null
null
null
null
UTF-8
Java
false
false
429
java
package 算法; public class TodayCoding0508 { public static void main(String[] args) { } //问题11 给定一个整形矩阵map,其中的值只有0/1两种,求构成全部是1的矩阵的最大面积。 //问题12 给定数组arr和整数num,返回一共有多少个子数组满足如下情况。 // Max{arr[i..j]} - Min{arr[i..j]} <= num,要求时间复杂度为O(n)。 }
[ "1763380121.qq.com" ]
1763380121.qq.com
67dd2acd6e5fb8589408f9e07eebef4668ce2239
99092c6cea81059022f65893cd84655804dae389
/src/main/java/bandtec/projeto/individual/ProjetoIndividualApplication.java
d3c05f11cfbc84ab89bafb77e5c3c2fea48ed1d6
[]
no_license
andretorellibandtec/projeto-individual-orquestra
4742e1e75b76ac79cec9382e50b01a5f81d82978
b770c468575dd56f54db1921bf635234006d75fa
refs/heads/master
2022-12-09T15:56:44.681635
2020-09-06T18:03:46
2020-09-06T18:03:46
293,127,944
0
0
null
null
null
null
UTF-8
Java
false
false
341
java
package bandtec.projeto.individual; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProjetoIndividualApplication { public static void main(String[] args) { SpringApplication.run(ProjetoIndividualApplication.class, args); } }
19f1949b84b1a755d6492545d4ce23120f72a453
83166947da1cd246617fc42407524f3b90ed23ee
/src/main/java/com/jakehonea/braedencraft/claims/Claim.java
f7be2f747ba8855c423b195f2b673bb078c57823
[]
no_license
Jatatto/Braeden-Craft
84bfee28b958d5a1d467037dc6e1002992f61b7b
ce0dc0c15644780ae5f457e3af57e583c6e5fc8f
refs/heads/master
2023-03-16T21:03:19.611877
2021-03-04T20:57:59
2021-03-04T20:57:59
342,717,368
0
0
null
null
null
null
UTF-8
Java
false
false
3,040
java
package com.jakehonea.braedencraft.claims; import com.google.common.collect.Lists; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.jakehonea.braedencraft.utils.Util; import org.bukkit.util.BoundingBox; import java.io.*; import java.util.List; import java.util.UUID; public class Claim { public static final String OWNER = "owner", TRUSTED = "trusted", MINIMUM = "minimum", MAXIMUM = "maximum", WORLD = "world"; private JsonObject obj; private File file; public Claim(File file) { this.file = file; if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } this.obj = new JsonObject(); } else { try { BufferedReader reader = new BufferedReader(new FileReader(file)); String json = ""; String ln; while ((ln = reader.readLine()) != null) json += ln + " "; obj = new JsonParser().parse(json).getAsJsonObject(); } catch (IOException e) { e.printStackTrace(); } } } public void set(String path, JsonElement element) { obj.add(path, element); save(); } public JsonElement get(String path) { return obj.get(path); } public List<UUID> getTrusted() { JsonArray array = get(Claim.TRUSTED).getAsJsonArray(); List<UUID> trusted = Lists.newArrayList(); for (int i = 0; i < array.size(); i++) trusted.add(UUID.fromString(array.remove(0).getAsString())); return trusted; } public void addTrusted(UUID id) { JsonArray array = get(Claim.TRUSTED).getAsJsonArray(); array.add(id.toString()); set(Claim.TRUSTED, array); save(); } public void removeTrusted(UUID id) { JsonArray array = new JsonArray(); getTrusted().stream().filter(uuid -> !uuid.equals(id)) .forEach(uuid -> array.add(uuid.toString())); set(Claim.TRUSTED, array); } public boolean isTrusted(UUID id) { return get(Claim.OWNER).getAsString().equals(id.toString()) || getTrusted().contains(id); } public BoundingBox getBounds() { return BoundingBox.of(Util.fromString(get(Claim.MINIMUM).getAsString()), Util.fromString(get(Claim.MAXIMUM).getAsString())); } public void save() { try { FileWriter writer = new FileWriter(file); writer.write(obj.toString()); writer.flush(); writer.close(); } catch (IOException e) { e.printStackTrace(); } } public File getFile() { return file; } public JsonObject getJson() { return this.obj; } }
7faafb87d0dc6bb2e417f8a7f7e6bd4bdd143c96
98e5b3aec60935f6768cb4e2a24b21da0b528b6d
/datalayer/message/src/main/java/com/waben/stock/datalayer/message/service/RedisCache.java
d495d17c958ef319d68ee83a006009d64d577d5a
[]
no_license
sunliang123/zhongbei-zhonghang-zhongzi-yidian
3eb95a77658d7ad9de1cdf9c3f85714ee007a871
54fed94b9784f5e392b4b9517cb5fe19c1b34443
refs/heads/master
2020-03-29T05:26:02.515289
2018-09-20T09:11:48
2018-09-20T09:11:48
149,582,090
1
5
null
null
null
null
UTF-8
Java
false
false
1,632
java
package com.waben.stock.datalayer.message.service; import javax.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import redis.clients.jedis.Jedis; import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPoolConfig; import redis.clients.jedis.Protocol; @Component("messageRedisCache") public class RedisCache { @Value("${redis.host}") private String redisHost; @Value("${redis.port}") private String redisPort; @Value("${redis.password}") private String redisPassword; private JedisPool pool; @PostConstruct public void initJedisPool() { if (redisPassword != null && !"".equals(redisPassword.trim())) { pool = new JedisPool(new JedisPoolConfig(), redisHost, Integer.parseInt(redisPort), Protocol.DEFAULT_TIMEOUT, redisPassword); } else { pool = new JedisPool(new JedisPoolConfig(), redisHost, Integer.parseInt(redisPort)); } } public String get(String key) { Jedis jedis = null; try { jedis = pool.getResource(); return jedis.get(key); } finally { if (jedis != null) { jedis.close(); } } } public void set(String key, String value) { Jedis jedis = null; try { jedis = pool.getResource(); jedis.set(key, value); } finally { if (jedis != null) { jedis.close(); } } } public void set(String key, String value, int seconds) { Jedis jedis = null; try { jedis = pool.getResource(); jedis.setex(key, seconds, value); } finally { if (jedis != null) { jedis.close(); } } } public JedisPool getPool() { return pool; } }
be8be7be90e015a599166c0a7bf82a219dbf1bb2
86e8712fe857786e7a3d3e7060c8881cb58d71a2
/src/eu/clarin/weblicht/bindings/cmd/ws/Contact.java
4959cd194fe6982f4a1c6af3eec9af2f93800660
[]
no_license
oo222bs/exmaralda
824f848d6daa59a9f87ac8c660826bbf2a29c2a0
07fc1d4c111da05ae7ad1b1cdf11c4b6629b9b97
refs/heads/master
2020-06-30T15:44:04.253185
2019-09-17T13:59:48
2019-09-17T13:59:48
200,874,879
0
0
null
2019-08-06T15:08:27
2019-08-06T15:08:26
null
UTF-8
Java
false
false
4,082
java
package eu.clarin.weblicht.bindings.cmd.ws; import eu.clarin.weblicht.bindings.cmd.AbstractComponent; import eu.clarin.weblicht.bindings.cmd.Descriptions; import eu.clarin.weblicht.bindings.cmd.StringBinding; import java.net.URI; import java.util.Collections; import java.util.List; import javax.xml.bind.annotation.*; /** * * @author akislev */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "persons", "roles", "addresses", "emails", "departments", "organisations", "telephoneNumbers", "faxNumbers", "urls", "descriptions" }) public class Contact extends AbstractComponent { @XmlElement(name = "Person") private List<StringBinding> persons; @XmlElement(name = "Role") private List<StringBinding> roles; @XmlElement(name = "Address") private List<StringBinding> addresses; @XmlElement(name = "Email") private List<StringBinding> emails; @XmlElement(name = "Department") private List<StringBinding> departments; @XmlElement(name = "Organisation") private List<StringBinding> organisations; @XmlElement(name = "TelephoneNumber") private List<StringBinding> telephoneNumbers; @XmlElement(name = "FaxNumber") private List<StringBinding> faxNumbers; @XmlElement(name = "Url") @XmlSchemaType(name = "anyURI") private List<URI> urls; @XmlElement(name = "Descriptions") private Descriptions descriptions; Contact() { } public List<StringBinding> getPersons() { return persons; } public List<StringBinding> getRoles() { return roles; } public List<StringBinding> getAddresses() { return addresses; } public List<StringBinding> getEmails() { return emails; } public StringBinding getEmail() { if (emails != null && !emails.isEmpty()) { return emails.get(0); } else { return null; } } public void setEmail(StringBinding email) { emails = Collections.singletonList(email); } public List<StringBinding> getDepartments() { return departments; } public List<StringBinding> getOrganisations() { return organisations; } public StringBinding getOrganisation() { if (organisations != null && !organisations.isEmpty()) { return organisations.get(0); } else { return null; } } public void setOrganisation(StringBinding organisation) { organisations = Collections.singletonList(organisation); } public List<StringBinding> getTelephoneNumbers() { return telephoneNumbers; } public List<StringBinding> getFaxNumbers() { return faxNumbers; } public List<URI> getUrls() { return urls; } public Descriptions getDescriptions() { return descriptions; } @Override public String toString() { if (persons != null && persons.size() == 1) { return persons.get(0).getValue(); } else if (emails != null && emails.size() == 1) { return emails.get(0).getValue(); } else if (organisations != null && organisations.size() == 1) { return organisations.get(0).getValue(); } else if (urls != null && urls.size() == 1) { return urls.get(0).toString(); } else { return null; } } @Override public Contact copy() { Contact contact = (Contact) super.copy(); contact.persons = shallowCopy(persons); contact.roles = shallowCopy(roles); contact.addresses = shallowCopy(addresses); contact.emails = shallowCopy(emails); contact.departments = shallowCopy(departments); contact.organisations = shallowCopy(organisations); contact.telephoneNumbers = shallowCopy(telephoneNumbers); contact.faxNumbers = shallowCopy(faxNumbers); contact.urls = shallowCopy(urls); contact.descriptions = copy(descriptions); return contact; } }
05827d251040f1898a4444f66b5216350cf5a240
fb1591df8f4917e010ba93eab21865534a41ba53
/Game1/MyGame1-android/gen/com/me/Main/R.java
022b23c5bfecfdec3e33559fdd6e1b2c1c366ee9
[]
no_license
luantrinh9x/Android_AirAttack
004e1257fa0783730927f00b395d8b83ed453860
8b9cfd93a10edce0fc68a4808e71b85e1739e054
refs/heads/master
2021-01-22T09:32:26.006067
2014-08-13T15:47:35
2014-08-13T15:47:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
558
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.me.Main; public final class R { public static final class attr { } public static final class drawable { public static final int aa=0x7f020000; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int app_name=0x7f040000; } }
b07622aa516f37b647ac23de4010fbdcf63c286a
dfa2c6ecdc2e6b27c4494c7f5898608ade98fbec
/cloud-stream-rabbitmq-consumer-8803/src/main/java/cn/com/springcloud/StreamMQMain8803.java
3d98d316c2ab625f901aa8107f0efe1afd76a099
[]
no_license
cai-xiaodou/MicroServices
82e7c3ef45970eb2a4be944fe11c21fed8e9e69c
53eec204949b380f44c56742fc904cf5c2574ea1
refs/heads/master
2023-05-02T16:00:36.474986
2021-05-08T08:35:00
2021-05-08T08:35:00
348,016,837
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package cn.com.springcloud; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class StreamMQMain8803 { public static void main(String[] args) { SpringApplication.run(StreamMQMain8803.class,args); } }
7401a71f2dc7c6aa52610b2ff0fbf6f53acf64ab
f2470c4cb0f23d6b2d3566ff7ef2fb43650def76
/mvc/src/main/java/org/itas/util/cache/CacheSizes.java
c774b91558bab8db13a0b4ee6f72d0a5ab912317
[]
no_license
liuxing521a/uxuan
08b5ec702375841ac7ea3cbf276e5cb61ada0694
2249ce8bb991a9580b97faac82294b27d911f7ef
refs/heads/master
2021-01-20T09:21:01.217586
2017-05-05T09:32:08
2017-05-05T09:32:08
90,242,019
0
1
null
null
null
null
UTF-8
Java
false
false
3,626
java
package org.itas.util.cache; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.util.Collection; import java.util.Map; import java.util.Map.Entry; import java.util.Objects; import java.util.concurrent.atomic.AtomicInteger; /** * <p>占用内存计算工具类</p> * 用来估算常用对象占用内存大小(以字节为单位) * @author liuzhen<[email protected]> */ public class CacheSizes { public static int sizeOfObject() { return 4; } public static int sizeOfString(String str) { if (Objects.isNull(str)) { return 0; } return 4 + str.getBytes().length; } public static int sizeOfByte() { return 1; } public static int sizeOfBoolean() { return 1; } public static int sizeOfChar() { return 2; } public static int sizeOfShort() { return 2; } public static int sizeOfInt() { return 4; } public static int sizeOfFloat() { return 4; } public static int sizeOfLong() { return 8; } public static int sizeOfDouble() { return 8; } public static int sizeOfDate() { return 12; } public static int sizeOfMap(Map<?, ?> map) throws CalculateSizeException { if (Objects.isNull(map)) { return 0; } AtomicInteger size = new AtomicInteger(36); for (Entry<?, ?> entry : map.entrySet()) { size.addAndGet(sizeOf(entry.getKey())); size.addAndGet(sizeOf(entry.getValue())); } return size.get(); } public static int sizeOfCollection(Collection<?> list) throws CalculateSizeException { if (Objects.isNull(list)) { return 0; } AtomicInteger size = new AtomicInteger(36); for (Object o : list) { size.addAndGet(sizeOf(o)); } return size.get(); } public static int sizeOf(Object o) throws CalculateSizeException { if (Objects.isNull(o)) { return 0; } if (o instanceof Cacheable) { return ((Cacheable) o).getCachedSize(); } if (o instanceof Byte) { return sizeOfObject() + sizeOfByte(); } if (o instanceof Boolean) { return sizeOfObject() + sizeOfBoolean(); } if (o instanceof Character) { return sizeOfObject() + sizeOfChar(); } if (o instanceof Short) { return sizeOfObject() + sizeOfShort(); } if (o instanceof Integer) { return sizeOfObject() + sizeOfInt(); } if (o instanceof Float) { return sizeOfObject() + sizeOfFloat(); } if (o instanceof Long) { return sizeOfObject() + sizeOfLong(); } if (o instanceof Double) { return sizeOfObject() + sizeOfDouble(); } if (o instanceof String) { return sizeOfString((String) o); } if (o instanceof Collection) { return sizeOfCollection((Collection<?>) o); } if (o instanceof Map) { return sizeOfMap((Map<?, ?>) o); } if (o instanceof long[]) { long[] array = (long[]) o; return sizeOfObject() + array.length * sizeOfLong(); } if (o instanceof byte[]) { byte[] array = (byte[]) o; return sizeOfObject() + array.length; } int size = 1; try (NullOutputStream out = new NullOutputStream(); ObjectOutputStream outObj = new ObjectOutputStream(out)){ outObj.writeObject(o); size = out.size(); } catch (IOException ioe) { throw new CalculateSizeException(o); } return size; } private static class NullOutputStream extends OutputStream { int size = 0; @Override public void write(int b) throws IOException { size++; } @Override public void write(byte[] b) throws IOException { size += b.length; } @Override public void write(byte[] b, int off, int len) { size += len; } public int size() { return size; } } }
ea9dc4d4ea109609c50ac0037dfca8883b9b780b
c2107aa03f71281def7e4e945c2a2fd7914d8ced
/PaymentWallet_MS/TransferAmount/src/test/java/com/cg/sprint2/transferamount/ms/testservice/TestService.java
58b198ac85b8304c37b57357e6b6405841d76ccc
[]
no_license
SaiPrasad245/PaymentWallet2
4991902e773807493a3eedabdb7323bcf95eade3
c028b5646ec90b00bb6e95e809f1e91ad7328faa
refs/heads/master
2022-07-16T20:42:27.557820
2020-05-17T20:32:00
2020-05-17T20:32:00
264,751,347
0
0
null
null
null
null
UTF-8
Java
false
false
2,516
java
package com.cg.sprint2.transferamount.ms.testservice; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import com.cg.sprint2.transferamount.ms.service.TransferAmountService; @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) public class TestService { @Autowired TransferAmountService taservice; @Test public void testTransferAmountToAnotherWallet_Positive() throws Exception { String response =taservice.transferAmountToAnotherWalletUser("7799208319", "9398165142", 100); Assertions.assertEquals("Transaction Sucess---->Amount Transferred", response); } @Test public void testTransferAmountToAnotherWallet_Negative() throws Exception { String response =taservice.transferAmountToAnotherWalletUser("7799208319", "9398165142", 10000); Assertions.assertEquals("Transaction Failed : Err --- Insufficient Balance",response); } @Test public void testTransferAmountToAnotherWallet_Negative1() throws Exception { String response =taservice.transferAmountToAnotherWalletUser("7799208319", "9398165242", 100); Assertions.assertEquals("Transaction Failed : Err --- The Number that the money is to be sent has to be Registerd on the Application", response); } @Test public void testUpiTransfer_Positive() throws Exception { String response =taservice.upiTransfer("9398165142","7799208319",100,8521 ); Assertions.assertEquals("Transaction Sucess:Amount Transferred", response); } @Test public void testUpiTransfer_Negative() throws Exception { String response =taservice.upiTransfer("9398165142","7799208319",8523,100 ); Assertions.assertEquals("Transaction Failed : Err ---> Incorrect PIN", response); } @Test public void testUpiTransfer_Negative2() throws Exception { String response =taservice.upiTransfer("9398165142","7799208319",852000,8521 ); Assertions.assertEquals("Transaction Failed : Err --->Insufficient Balance", response); } @Test public void testUpiTransfer_Negative3() throws Exception { String response =taservice.upiTransfer("9398165142","7799208329",8521,100 ); Assertions.assertEquals("Transaction Failed : Err --->The Number that the money is to be sent has to be Registerd on the Application", response); } }
360f6a17e59ba42b12c1b8e2315dc0db6c95a1c1
c61acf6f90795c98c4daa1c273eaa4fe1e235ba1
/app/src/main/java/com/ericho/androidstackview/MainActivity.java
1268b75f4748bb77c23107a18089b1bc07b89fbf
[]
no_license
wingsum93/Android_tack_view_example
f6bc20541a1265e5fff95bcbb30755ebdb51a1c6
71091b75abdfe05fac6ec4e81e59e778c554be59
refs/heads/master
2021-01-16T23:19:19.859172
2016-07-27T08:23:09
2016-07-27T08:23:09
64,289,963
0
0
null
null
null
null
UTF-8
Java
false
false
1,104
java
package com.ericho.androidstackview; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.StackView; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private static StackView stackView; private static ArrayList<Stack_Items> list; //Integer array for images private static final Integer[] icons = { R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); stackView = (StackView) findViewById(R.id.stackView1); list = new ArrayList<>(); //Adding items to the list for (int i = 0; i < icons.length; i++) { list.add(new Stack_Items("Item " + i, icons[i])); } //Calling adapter and setting it over stackview Stack_Adapter adapter = new Stack_Adapter(MainActivity.this, list); stackView.setAdapter(adapter); adapter.notifyDataSetChanged(); } }
dbf3ec6e52c35445b99a09a0c080a675097d49c8
305cf9c8fbb49f71f2568a1e86147a736af99c43
/src/DataTypes/StringExample.java
2cdf389340f8279bf009d8e3cbe85cedde6734da
[]
no_license
Karthiktesting05/SampleTesting
ea74f196068bc64b090e0222e398903f86c686ad
e6f25d27973b976d4568e35ef0b45161fd454811
refs/heads/master
2020-09-26T14:37:20.694591
2019-12-06T07:58:33
2019-12-06T07:58:33
226,274,915
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package DataTypes; public class StringExample { public static void main(String[] args) { // TODO Auto-generated method stub String Name = "Karthik"; String Training = "Selenium Training"; System.out.println(Training + " Provided by "+ Name); } }
d94bc305fa206cee10c82243b0e72dbbd1992f8a
8c7175ae8e0b35b680ec562ce81183cfd5913cb1
/SpringDataJpa/src/main/java/com/springdatajpa/service/UserService.java
8b04c997672aba1f180672b5f4f8956d8e5c6b31
[]
no_license
dipendra-yadav/persistence
624ba9c62126adc6af1ead20114cdc89e565e45a
6956191f57e03ae676d777d30b93d8aeed9d62bd
refs/heads/master
2021-01-19T21:29:36.789958
2017-12-21T06:42:51
2017-12-21T06:42:51
101,251,873
0
0
null
null
null
null
UTF-8
Java
false
false
452
java
package com.springdatajpa.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; import com.springdatajpa.dao.UserRepository; import com.springdatajpa.model.User; @Component @Service public class UserService { @Autowired private UserRepository userRepository; public void saveUser(User user) { userRepository.save(user); } }
e861217fef8c4ce8b061371d57c068f33f488dba
84749fc225dbb6983138bfd3c0da70e2200b8a25
/src/com/iraheta/LectorDeDatos.java
e103aabb453b640774c30818330af1fd61ecbb38
[]
no_license
belmarely/iraheta-ejercicio-1
6d44ec20a1a5326bc85b111d2f5a1e118d3459d6
64f9b41c7c5aba700d53604994e478420d703a18
refs/heads/master
2020-07-02T23:47:28.858039
2019-08-11T03:28:35
2019-08-11T03:28:35
201,711,876
0
0
null
null
null
null
UTF-8
Java
false
false
915
java
package com.iraheta; import java.util.InputMismatchException; import java.util.Scanner; public class LectorDeDatos { public static int solicitarEntero(String mensaje){ Scanner lector = new Scanner(System.in); System.out.print(mensaje); try{ int numero = lector.nextInt(); return numero; }catch (InputMismatchException e){ System.out.println("El dato ingresado no es valido"); return solicitarEntero(mensaje); } } public static double solicitarDouble(String mensaje){ Scanner lector = new Scanner(System.in); System.out.print(mensaje); try{ double numero = lector.nextDouble(); return numero; }catch (InputMismatchException e){ System.out.println("El dato ingresado no es valido"); return solicitarDouble(mensaje); } } }
9a640148b18a5021ce37253cad893cee0f917e23
349c6644fb1fe84334b432c49292f44c14bce847
/src/main/sources/com/yoparty/bean/Area.java
b290572d11d94bb2d4457080f1a61c933fae57b1
[]
no_license
wdfwolf3/yopartynet
6e79f7cbfa0f02e33d398bb56ccc98092fa77e6a
c6c32869797989a85656d3653da4c7bfe38f3cb3
refs/heads/master
2021-01-19T16:59:42.957367
2017-08-22T07:04:40
2017-08-22T07:04:40
101,032,280
0
0
null
null
null
null
UTF-8
Java
false
false
1,444
java
package com.yoparty.bean; import java.io.Serializable; public class Area implements Serializable { private String id; private String name; private String parentId; private String parent_key = "0"; private String dict_key = "0"; private int dict_level; private String root_key = "AREA"; public String getId() { return id; } public void setId(String id) { this.id = id == null ? null : id.trim(); } public String getName() { return name; } public void setName(String name) { this.name = name == null ? null : name.trim(); } public String getParentId() { return parentId; } public void setParentId(String parentId) { this.parentId = parentId == null ? null : parentId.trim(); } public String getParent_key() { return parent_key; } public void setParent_key(String parent_key) { this.parent_key = parent_key; } public String getDict_key() { return dict_key; } public void setDict_key(String dict_key) { this.dict_key = dict_key; } public int getDict_level() { return dict_level; } public void setDict_level(int dict_level) { this.dict_level = dict_level; } public String getRoot_key() { return root_key; } public void setRoot_key(String root_key) { this.root_key = root_key; } }
51868f787dab8c5145801ac86fb48716390cfd3c
9e8afc827742e6ebf18c547071dfa2e96ab945a9
/HMI112_V01/app_net/src/main/java/com/uninew/net/JT905/bean/P_ParamQuery.java
01288c6698e1597f46b16f71725d847dc768988f
[]
no_license
hgdsys007/Uninew
23c0957e58f8bdaa698db0102f62eecc91d3f538
efedd89a2d296ca6427c48441bbdb8490c2c42bb
refs/heads/master
2021-12-30T05:40:15.482254
2018-02-06T01:29:01
2018-02-06T01:29:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,378
java
package com.uninew.net.JT905.bean; import com.uninew.net.JT905.common.BaseMsgID; import com.uninew.net.JT905.common.ProtocolTool; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.util.List; /** * 参数查询 * Created by Administrator on 2017/8/19 0019. */ public class P_ParamQuery extends BaseBean { private List<Integer> paramIds;//参数列表 public P_ParamQuery() { } public P_ParamQuery(byte[] body) { getDataPacket(body); } public P_ParamQuery(List<Integer> paramIds) { this.paramIds = paramIds; } public List<Integer> getParamIds() { return paramIds; } public void setParamIds(List<Integer> paramIds) { this.paramIds = paramIds; } @Override public int getTcpId() { return this.tcpId; } @Override public void setTcpId(int tcpId) { this.tcpId = tcpId; } @Override public int getTransportId() { return this.transportId; } @Override public void setTransportId(int transportId) { this.transportId = transportId; } @Override public String getSmsPhoneNumber() { return this.smsPhonenumber; } @Override public void setSmsPhoneNumber(String smsPhonenumber) { this.smsPhonenumber = smsPhonenumber; } @Override public int getSerialNumber() { return this.serialNumber; } @Override public void setSerialNumber(int serialNumber) { this.serialNumber = serialNumber; } @Override public int getMsgId() { return BaseMsgID.TERMINAL_PARAM_QUERY; } @Override public byte[] getDataBytes() { byte[] datas = null; ByteArrayOutputStream stream = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(stream); try { for (Integer integer:paramIds){ out.writeShort(integer); } out.flush(); datas = stream.toByteArray(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (stream != null) { stream.close(); } if (out != null) { out.close(); } } catch (IOException e) { e.printStackTrace(); } } return datas; } @Override public P_ParamQuery getDataPacket(byte[] datas) { ByteArrayInputStream stream = new ByteArrayInputStream(datas); DataInputStream in = new DataInputStream(stream); try { int number=datas.length/2;//参数ID根数 int paramId; for (int i=0;i<number;i++){ paramId=in.readShort(); paramIds.add(paramId); } } catch (Exception e) { e.printStackTrace(); } finally { try { if (stream != null) { stream.close(); } if (in != null) { in.close(); } } catch (IOException e) { e.printStackTrace(); } } return this; } }
13b9b1f439dccebda6a46e2421903abb946a8367
155c66819bfb01f0c89b94c9e16f2e889e44aee7
/src/main/java/com/example/demo/util/ScraperUtil.java
e7ceabe64057d9e7e43cba25292f52d81dfe5fb6
[]
no_license
platonTsy/webscraper
6829e0dea414162571f93ab31f7346d0bb09d20e
5a079a81d4423659f200a8562efeab50db7dfe8e
refs/heads/master
2021-05-09T08:17:57.284975
2018-01-29T13:44:42
2018-01-29T13:44:42
119,386,173
0
0
null
null
null
null
UTF-8
Java
false
false
3,815
java
package com.example.demo.util; import com.example.demo.domain.Category; import com.example.demo.domain.Company; import com.example.demo.domain.CompanySearchResult; import lombok.SneakyThrows; import lombok.extern.java.Log; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Random; import static java.util.stream.Collectors.toList; /** * Created by platon on 27.01.18. */ @Log public class ScraperUtil { private static final String HOST = "https://www.pegaxis.com"; private static final String SERVICE_ROUTE = "/services"; public static final String GOOGLE_SEARCH_URL = "https://www.google.com/search"; public static List<Category> retrieveCategories(int timeout) { return getCategoryElementsByServicesDoc(getDocBy(HOST + SERVICE_ROUTE, timeout)) .stream() .map(service -> Category .builder() .name(service.text()) .uri(HOST + service.attr("href")) .build()) .peek(c -> log.info(c.toString())) .collect(toList()); } public static List<Company> retrieveCompaniesBy(Category category, int timeout) { return getCompanyNamesByServiceDoc(getDocBy(category.getUri(), timeout), category); } @SneakyThrows public static Document getDocBy(String uri, int timeout) { return Jsoup.connect(uri).timeout(timeout).get(); } public static List<Element> getCategoryElementsByServicesDoc(Document serviceDoc) { return serviceDoc.getElementsByTag("a") .stream() .filter(el -> el.hasClass("service_list_title")) .collect(toList()); } @SneakyThrows(IOException.class) public static List<CompanySearchResult> retrieveCompanySearchResults(Company company, int resultCount, int timeout) { List<CompanySearchResult> resultList = null; String searchUri = GOOGLE_SEARCH_URL + "?q=" + company.getName() + "&num=" + resultCount; Random random = new Random(); int ranTimeout = random.nextInt((5000 - 3000) + 1) + 3000; // System.setProperty("http.proxyHost", "42.104.84.107"); // set proxy server // System.setProperty("http.proxyPort", "8080"); // Document doc = null; try { doc = Jsoup.connect(searchUri).userAgent("Mozilla/5.0").timeout(ranTimeout).get(); Elements resultElements = doc.select("h3.r > a"); resultList = new ArrayList<>(); for (Element result : resultElements) { String linkHref = result.attr("href"); String linkText = result.text(); CompanySearchResult searchResult = CompanySearchResult.builder() .company(company) .uri(linkHref.substring(6, linkHref.indexOf("&"))) .title(linkText) .build(); resultList.add(searchResult); log.info(searchResult.toString()); } } catch (org.jsoup.HttpStatusException e) { log.severe(e.getMessage()); } return resultList; } public static List<Company> getCompanyNamesByServiceDoc(Document serviceDoc, Category category) { return serviceDoc.getElementsByClass("company-name") .parallelStream() .map(serviceEl -> Company.builder() .name(serviceEl.getElementsByTag("a").get(0).text()) .category(category) .build()) .peek(c -> log.info(c.toString())) .collect(toList()); } }
cf890509ade1af62db46c70c3967651a0bf4f46f
4b027a96e457f90fdd146c73a92a99a63b5f6cab
/level37/lesson10/big01/AmigoSet.java
e168eede0c777070012af5c9c6a94e15f7369708
[]
no_license
Byshevsky/JavaRush
c44a3b25afca677bbe5b6c015aec7c2561ca4830
d8965bc8b5f060af558cc86924ae6488727cdbd4
refs/heads/master
2021-05-02T12:17:48.896494
2016-12-26T21:56:12
2016-12-26T21:56:12
52,143,706
1
0
null
null
null
null
UTF-8
Java
false
false
2,650
java
package com.javarush.test.level37.lesson10.big01; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.*; /** * Created by IGOR on 31.01.2016. */ public class AmigoSet<E> extends AbstractSet implements Cloneable, Serializable, Set { private static final Object PRESENT = new Object(); private transient HashMap<E, Object> map; public AmigoSet() { map = new HashMap<>(); } public AmigoSet(Collection<? extends E> collection) { int capacity = 0; if (collection.size()/.75f > 16) { capacity = (int) (collection.size()/.75f); } else capacity = 16; map = new HashMap<>(capacity); this.addAll(collection); } @Override public boolean add(Object o) { map.put((E) o, PRESENT); return map.get(o) != null; } @Override public Iterator<E> iterator() { Set<E> keys = map.keySet(); return keys.iterator(); } @Override public int size() { return map.keySet().size(); } @Override public Object clone() { AmigoSet<E> result = null; try { result = (AmigoSet<E>) super.clone(); result.map = (HashMap<E, Object>) this.map.clone(); } catch (Exception e) { throw new InternalError(); } return result; } @Override public boolean isEmpty() { return map.keySet().isEmpty(); } @Override public boolean contains(Object o) { return map.keySet().contains(o); } @Override public void clear() { map.keySet().clear(); } @Override public boolean remove(Object o) { return map.keySet().remove(o); } private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(HashMapReflectionHelper.<Integer>callHiddenMethod(map, "capacity")); out.writeFloat(HashMapReflectionHelper.<Float>callHiddenMethod(map, "loadFactor")); out.writeObject(new HashSet<Integer>((Collection<Integer>) map.keySet())); } private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); int capacity = in.readInt(); float loadFactor = in.readFloat(); map = new HashMap<>(capacity, loadFactor); addAll((Collection) in.readObject()); } }
e296d22abbba16f40aa2e31a49f65a6e5123a034
bdb2e5040841634471cd0e4c216ef66c32c23ff3
/crawler_maven/src/main/java/Crawler.java
3a1a0e33815ae4072a75ae84efe5e3d0bb8ff946
[]
no_license
theorangeclockwork/basic-crawler
5439efd3b0d1b88e8d9606e1bd99bf8ddea41c3c
05db5571c4f23cfc319736cfd3f21c368020ab7e
refs/heads/master
2020-04-23T12:29:50.164320
2019-03-22T14:38:46
2019-03-22T14:38:46
171,169,976
0
0
null
null
null
null
UTF-8
Java
false
false
2,676
java
import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.HashMap; import java.util.Map; class Crawler { private Document doc = null; private int count = 1; private HashMap<Integer, String> indexList = new HashMap<Integer, String>(); void crawlByURL(String URL) throws IOException { try { doc = Jsoup.connect(URL).get(); } catch (Exception e) { e.printStackTrace(); } assert doc != null; Elements links = doc.select("a[href]"); scrapAndStore(doc); indexList.put(count, URL); count++; for (Element link : links) { if (!link.attr("abs:href").contains(".jpg") && !link.attr("abs:href").contains("#") && count <= 100 && !indexList.containsValue(link.attr("abs:href"))) { try { scrapAndStore(Jsoup.connect(link.attr("abs:href")).get()); indexList.put(count, link.attr("abs:href")); count++; } catch (Exception e) { e.printStackTrace(); } } } for (Element link : links) { if (!link.attr("abs:href").contains(".jpg") && !link.attr("abs:href").contains("#") && count <= 100) { try { crawlByURL(link.attr("abs:href")); } catch (Exception e) { e.printStackTrace(); } } } } private void scrapAndStore(Document doc) throws IOException { File oFile = new File("C:\\java projects\\crawler\\crawler_maven\\src\\main\\resources\\crawler_out", count + ".txt"); boolean success = oFile.createNewFile(); System.out.println(success); FileWriter writer = new FileWriter(oFile); writer.write(doc.body().text()); writer.flush(); writer.close(); } void createResult() throws IOException { File oFile = new File("C:\\java projects\\crawler\\crawler_maven\\src\\main\\resources\\crawler_out", "index.txt"); boolean success = oFile.createNewFile(); System.out.println(success); FileWriter writer = new FileWriter(oFile); for (Map.Entry<Integer, String> entry : indexList.entrySet()) { writer.append(String.valueOf(entry.getKey())).append(" ").append(entry.getValue()); writer.write(System.getProperty("line.separator")); writer.flush(); } writer.close(); } }
7715cf219f196168901b0123bc90cf2dc623d0cb
12130c5b11ebd954cecb8385059aa4693a085934
/app/src/main/java/org/imfine/fas2/Main2Activity.java
004035837885246435c4397b37ef601098ced25e
[]
no_license
jyshinv/FAS-FallAlertApp
dc9bd1187d900522baa0bc30e415c7a5a4d7ef55
d64c6aad92cd2f79d5e09ec4ec72e15ce358bc1a
refs/heads/master
2023-05-31T20:21:23.897404
2021-07-04T10:09:32
2021-07-04T10:09:32
382,819,972
1
0
null
null
null
null
UTF-8
Java
false
false
17,055
java
package org.imfine.fas2; import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.app.AlertDialog; import android.app.Dialog; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.net.Uri; import android.preference.PreferenceManager; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.android.volley.toolbox.Volley; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import org.imfine.fas2.Post.FirebaseFASPost; import org.imfine.fas2.Post.FirebaseRaspPost; import org.json.JSONArray; import org.json.JSONObject; import java.sql.Timestamp; import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.util.Timer; import java.util.TimerTask; import static java.lang.Math.max; public class Main2Activity extends AppCompatActivity implements SensorEventListener { //list 확인 버튼 Button btn; Intent intent; //파이어베이스 db연동을 위한 코드 private DatabaseReference mPostReference; String NAME = ""; String VALUE = ""; String TIME = ""; //파이어베이스 db연동 라즈베리파이 String FALLCHECK = "false"; //현재 날짜와 시간을 위한 변수 long now; private DecimalFormat df = new DecimalFormat("#.###"); //기존 알고리즘 변수 private String boundary_key; private String phoneNumber_key; private String notificationMethod_key; private TextView last_x_textView; private TextView last_y_textView; private TextView last_z_textView; private TextView x_textView; private TextView y_textView; private TextView z_textView; private TextView current_change_amount_textView; private TextView current_boundary_textView; private TextView gyro1; private TextView gyro2; private TextView gyro3; private TextView acc_svm; private TextView av_svm; private TextView timeUI; private TextView maxACC; private TextView maxAV; private Sensor sensor; private Sensor Gsensor; private SensorManager sensorManager; private SharedPreferences sharedPreferences; private double[] last_gravity = new double[3]; private double[] gravity = new double[3]; private double[] ggravity = new double[3]; private boolean firstChange = true; public int warningBoundary = 700; private double changeAmount = 0; //fas알고리즘을 위한 변수 double var_acc_svm; double result_acc; double var_av_svm; double result_av; boolean check = true; int i; //logcat avsvm, accsvm 나타내기 위한 변수 double accsvm_max = 0; double avsvm_max = 0; //fcm을 위한 변수 static RequestQueue requestQueue; static String regId="eDT6FiOyaMQ:APA91bG0GgDtAfovt4sy210IZT-y0Xt1RTeHZ6cWDW4vVLFiF0B_j6_KJeugFeCqj8ubt9aeda_KHKXzC84b_8qswuwnyPY2vxiIwnEw43mc5kRkuwR5m0dzcjimYrLR0ZnqWsEUstWe"; TextView tv; //군우아버지 폰 : eNhYhgLMHKs:APA91bH7uUnQ2NJ87DZLW-B4wMcAvKhYlgWIGDWxaFF6n4FZsl2QKSAVVlD6bt-SPH91oWs7D5iqGPFqSM8fE2pYJa0_4Q0kk53d6oTgKFxvLM_9vW7nYkzcXnsHsbFvFlDbBiizn2AN" //myphone : cEYRkBd6PSc:APA91bGap-XU9q8EYy3rjQblGHdZ9G5jkL3O1VOgpQd-WaBbC9rvwyiFag3ZYL_YbgT5Ca7tDlZZ7lDw8fjkTX4H9HDsNql_6eKSdEqgg4YyV8W6Y-pWlHim6dwdpWR7rtpFSMB2i-Oa @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main2); btn = findViewById(R.id.sensor_list_btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { intent = new Intent(getApplication(), FallAlertActivity.class); startActivity(intent); } }); if(requestQueue == null){ requestQueue = Volley.newRequestQueue(getApplicationContext()); } tv = findViewById(R.id.main2_fcm_tv); //파이어베이스 mPostReference = FirebaseDatabase.getInstance().getReference(); //기존 알고리즘 boundary_key = getString(R.string.key_boundary); phoneNumber_key = getString(R.string.key_phone_number); notificationMethod_key = getString(R.string.key_notification_method); initialUI(); initialSensor(); sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); warningBoundary = Integer.parseInt(sharedPreferences.getString(boundary_key, "20")); } // end of onCreate public void initialUI() { last_x_textView = (TextView)findViewById(R.id.last_x_value); last_y_textView = (TextView)findViewById(R.id.last_y_value); last_z_textView = (TextView)findViewById(R.id.last_z_value); x_textView = (TextView)findViewById(R.id.x_value); y_textView = (TextView)findViewById(R.id.y_value); z_textView = (TextView)findViewById(R.id.z_value); current_change_amount_textView = (TextView)findViewById(R.id.current_change_amount); current_boundary_textView = (TextView)findViewById(R.id.current_boundary); gyro1 = findViewById(R.id.gyro1); gyro2 = findViewById(R.id.gyro2); gyro3 = findViewById(R.id.gyro3); acc_svm = findViewById(R.id.acc_svm); av_svm = findViewById(R.id.av_svm); timeUI = findViewById(R.id.time); maxACC = findViewById(R.id.maxACC); maxAV = findViewById(R.id.maxAV); } public void initialSensor() { sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE); sensor = sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION); Gsensor = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE); sensorManager.registerListener(this,sensor, sensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(this,Gsensor,sensorManager.SENSOR_DELAY_NORMAL); } @Override public void onAccuracyChanged(Sensor sensor, int accuracy) { } @Override public void onSensorChanged(SensorEvent event) { Sensor sensor = event.sensor; if(sensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION){ //기존 알고리즘 last_gravity[0] = gravity[0]; last_gravity[1] = gravity[1]; last_gravity[2] = gravity[2]; gravity[0] = Double.parseDouble(String.format("%.2f",event.values[0])); gravity[1] = Double.parseDouble(String.format("%.2f",event.values[1])); gravity[2] = Double.parseDouble(String.format("%.2f",event.values[2])); changeAmount = Math.pow((gravity[0]-last_gravity[0]), 2) + Math.pow((gravity[1]-last_gravity[1]), 2) + Math.pow((gravity[2]-last_gravity[2]), 2); //fas 알고리즘 var_acc_svm = (Math.pow(gravity[0], 2)) + (Math.pow(gravity[1], 2)) + (Math.pow(gravity[2], 2)); result_acc = Math.sqrt(var_acc_svm); result_acc = Double.parseDouble(String.format("%.2f",result_acc)); acc_svm.setText("acc_svm : " +result_acc ); //max값 띄우기 accsvm_max = max(accsvm_max, result_acc); maxACC.setText("maxACC : " + accsvm_max); } if(sensor.getType() == Sensor.TYPE_GYROSCOPE){ ggravity[0] = Double.parseDouble(String.format("%.2f",event.values[0])); ggravity[1] = Double.parseDouble(String.format("%.2f",event.values[1])); //ggravity[2] = Double.parseDouble(String.format("%.2f",event.values[2])); var_av_svm = (Math.pow(ggravity[0], 2)) + (Math.pow(ggravity[1], 2)); result_av = (Math.sqrt(var_av_svm)); result_av = Double.parseDouble(String.format("%.2f",result_av)); av_svm.setText("av_svm : " +result_av); //logcat avsvm_max= max(avsvm_max, result_av); maxAV.setText("maxAV : " + avsvm_max); } //실시간 값 변동 보여주는 함수 updateSensorView(); //fas 알고리즘 계산 함수 fall_detect();//값이 바뀔때마다 계속 불러냄 //warningBoundary 설정은 여기서!! //warningBoundary = Integer.parseInt(sharedPreferences.getString(boundary_key, "2000")); //낙상이 감지 되었을 경우 코드 //if (!firstChange && changeAmount >= warningBoundary) { // Toast.makeText(this, "낙상이 감지되었습니다.", Toast.LENGTH_SHORT).show(); // now = System.currentTimeMillis(); // Date date = new Date(now); // SimpleDateFormat sdfnow = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); // TIME = sdfnow.format(date); // NAME = "김옥례 할머니"; // VALUE = "낙상 감지됨!!!"; // FBRegister(); //} //firstChange = false; } class Time extends Thread{ public void run(){ i=0; while(true){ Date dt = new Date(); SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss") ; String disp = sdf.format(dt); i++; System.out.println( i + "회 현재시간" + disp); try{ Thread.sleep(1000);} catch(Exception ex){} }//while end }//run() end }//class END public void fall_detect() { if( result_av > 10 ) { Time t = new Time(); t.start(); Timestamp time_st = new Timestamp(System.currentTimeMillis()); timeUI.setText("시간 : " + time_st.toString()); long start = System.currentTimeMillis();//시작시간 if( result_acc > 10 ) { long end = System.currentTimeMillis();//끝난시간. if(end-start <= 50000) { //50초이내 되야함. //Toast.makeText(this, "낙상이다 새꺄", Toast.LENGTH_SHORT).show(); //Toast.makeText(this, "낙상이 감지되었습니다.", Toast.LENGTH_SHORT).show(); now = System.currentTimeMillis(); Date date = new Date(now); SimpleDateFormat sdfnow = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); TIME = "낙상 시간 : "+sdfnow.format(date); NAME = "낙상인 : 김옥례 할머니"; VALUE = "낙상 의심"; FALLCHECK = "true"; //fcm을 위한 send함수 send(VALUE); //라즈베리파이에 true값 보내는 함수 FBtoRasp(); //파이어베이스에 낙상 시 낙상정보 올리는 함수 FBRegister(); } } } } // end of fall detect() //fcm 구현 코드 public void send(String input){ JSONObject requestData = new JSONObject(); try{ requestData.put("priority","high"); JSONObject dataObj = new JSONObject(); dataObj.put("contents",input); requestData.put("data",dataObj); JSONArray idArray = new JSONArray(); idArray.put(0,regId); requestData.put("registration_ids",idArray); }catch (Exception e){ e.printStackTrace(); } sendData(requestData, new FCMSendTestActivity.SendResponseListener() { @Override public void onRequestStarted() { println("onRequestStarted() 호출됨"); } @Override public void onRequesCompleted() { println("onRequestCompleted() 호출됨"); } @Override public void onRequestWithError(VolleyError error) { println("onRequestWithError() 호출됨"); } }); }//end of send() public void println(String data){ tv.append(data + "\n"); } public interface SendResponseListener{ public void onRequestStarted(); public void onRequesCompleted(); public void onRequestWithError(VolleyError error); } public void sendData(JSONObject requestData, final FCMSendTestActivity.SendResponseListener listener){ JsonObjectRequest request = new JsonObjectRequest( Request.Method.POST, "https://fcm.googleapis.com/fcm/send", requestData, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { listener.onRequesCompleted(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { listener.onRequestWithError(error); } } ) { @Override protected Map<String, String> getParams() throws AuthFailureError { //return super.getParams(); Map<String, String> params = new HashMap<String,String>(); return params; } @Override public Map<String, String> getHeaders() throws AuthFailureError { //return super.getHeaders(); Map<String, String> headers = new HashMap<String, String>(); headers.put("Authorization", "key=AAAAzsqzkm0:APA91bGVcTX8EbKAYC0fxicmK0Jjv1lB9xeDBpEh6N0y3TYCDk5SqrtjBIjcvBT2Ji8_vNS3SfIInh1SU-WaW8YqOQdATMgOoBnRQ5aNH73nOZdPWGFlthEfZYLD6Eb_YiMPdYm-S0SY"); return headers; } @Override public String getBodyContentType() { //return super.getBodyContentType(); return "application/json"; } }; request.setShouldCache(false); listener.onRequestStarted(); requestQueue.add(request); }//end of sendData //리스너 등록 @Override protected void onResume() { sensorManager.registerListener(this, sensor, sensorManager.SENSOR_DELAY_NORMAL); sensorManager.registerListener(this, Gsensor,sensorManager.SENSOR_DELAY_NORMAL); super.onResume(); } //리스너 해제 @Override protected void onPause() { sensorManager.unregisterListener(this); super.onPause(); } //센서값을 보여주기 위한 함수 private void updateSensorView() { last_x_textView.setText("Last X = "+last_gravity[0]); last_y_textView.setText("Last Y = "+last_gravity[1]); last_z_textView.setText("Last Z = "+last_gravity[2]); x_textView.setText("X = "+gravity[0]); y_textView.setText("Y = "+gravity[1]); z_textView.setText("Z = "+gravity[2]); current_change_amount_textView.setText("Current change amount = "+df.format(changeAmount)); current_boundary_textView.setText("Current boundary = "+ warningBoundary); gyro1.setText("gyro x : " + ggravity[0]); gyro2.setText("gyro y : " + ggravity[1]); gyro3.setText("gyro z : " + ggravity[2]); } //낙상 정보 db에 기록하기 public void FBRegister(){ Map<String, Object> childUpdates = new HashMap<>(); Map<String, Object> postValues = null; FirebaseFASPost post = new FirebaseFASPost(TIME,NAME,VALUE); postValues = post.toMap(); childUpdates.put("/alarm_list/"+ TIME, postValues); mPostReference.updateChildren(childUpdates); Toast.makeText(this,"update completed",Toast.LENGTH_SHORT).show(); } //라즈베리파이 카메라에 보낼 값 설정 public void FBtoRasp(){ Map<String,Object> childUpdates = new HashMap<>(); Map<String, Object> postValues = null; FirebaseRaspPost post = new FirebaseRaspPost(FALLCHECK); postValues = post.toMap(); childUpdates.put("/FallCheckToRasp/", postValues); mPostReference.updateChildren(childUpdates); } } // end of activity
9cea841724d1c0230ecf1107c2d9d5384257c4c5
6a40c204f2a0835397ef1ccd7931730c74aa8cb9
/app/src/main/java/helper/ConnectionDetector.java
f3366cac55c300f121a5aff6805dec523b5602f4
[]
no_license
pierrebrtr/Moov-in-Nantes
bb42109bcec4670f6e5fb532a670b2f036f14b24
2b71ef405ff466d30d197da15fc29206b6743de6
refs/heads/master
2021-06-07T10:28:36.627879
2016-10-25T09:57:03
2016-10-25T09:57:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
905
java
package helper; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class ConnectionDetector { private Context _context; public ConnectionDetector(Context context){ this._context = context; } /** * Checking for all possible internet providers * **/ public boolean isConnectingToInternet(){ ConnectivityManager connectivity = (ConnectivityManager) _context.getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity != null) { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) for (int i = 0; i < info.length; i++) if (info[i].getState() == NetworkInfo.State.CONNECTED) { return true; } } return false; } }
d96b103af4cc61f77427a7a3ae683e1b145e57b4
e8b0cf9ae1d5756c5de3d423e81a1142caa4c2e4
/Chronostar/src/main/java/frc/robot/commands/autos/Right8Auto.java
831039eab4689be00ac08719e3f980359e9bcc54
[]
no_license
HighlandersFRC/2020-Chronostar-Tournament
af1cebde705c2e66b577e69e9850070934a9d574
af429727c9ae8f79efecc6264b04827c0310b2b4
refs/heads/master
2023-02-18T11:18:30.482438
2021-01-09T03:57:43
2021-01-09T03:57:43
328,064,508
0
0
null
null
null
null
UTF-8
Java
false
false
1,860
java
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package frc.robot.commands.autos; import edu.wpi.first.wpilibj2.command.ParallelCommandGroup; import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; import frc.robot.commands.controls.FireSequence; import frc.robot.commands.controls.SetFlyWheelVelocity; import frc.robot.commands.controls.SetHoodPosition; import frc.robot.commands.controls.TrackVisionTarget; import frc.robot.tools.controlLoops.PurePursuitController; import frc.robot.tools.pathTools.PathList; // NOTE: Consider using this command inline, rather than writing a subclass. For more // information, see: // https://docs.wpilib.org/en/latest/docs/software/commandbased/convenience-features.html public class Right8Auto extends SequentialCommandGroup { /** * Creates a new Right8Auto. */ public Right8Auto() { // Add your commands in the super() call, e.g. // super(new FooCommand(), new BarCommand()); super(new ParallelCommandGroup(new SetFlyWheelVelocity(4500), new SetHoodPosition(10.5), new TrackVisionTarget()), new FireSequence(4500, 10, 1.0), new PurePursuitController(PathList.right8AutoPath1, 2.5, 4.0,true, true ),new ParallelCommandGroup( new PurePursuitController(PathList.right8AutoPath2, 2.5, 4.0,true, true )),new ParallelCommandGroup(new SetFlyWheelVelocity(5250), new SetHoodPosition(13.5), new TrackVisionTarget()), new FireSequence(5250, 13.5, 1.8)); } }
23c33fb87a0c719a3faefe40882297d50178e560
5b7b2efab0a2bf8e789a303f8e4d9c56bd220b78
/src/main/java/com/kov/lectures/lecture_2_StringsAndRegularExpressions/item_4/Main.java
922f490cc0fda848bd04b6c76df030fb1fe418e2
[]
no_license
DenisLaptev/ProgrammingLectures
04e9f5618e209157ffb6b59be7182a5bdbd795c5
bad94c1d6a83fd433f13c87d0635e32c824ed91b
refs/heads/master
2021-01-12T12:47:10.992714
2016-10-03T14:14:29
2016-10-03T14:14:29
69,856,827
0
0
null
null
null
null
UTF-8
Java
false
false
1,155
java
package com.kov.lectures.lecture_2_StringsAndRegularExpressions.item_4; import java.util.ArrayList; import java.util.List; /** * Created by Kovantonlenko on 11/2/2015. */ public class Main { public static void main(String[] args) { String s = "The world is mine"; String s1 = "test"; String s2 = new String(); String name = s.substring(4, s.length()-8); String name1 = s.substring(4, 9); System.out.println("length = " + s.length()); System.out.println(name); // �� ������� ������� "world" System.out.println(name1); // �� ������� ������� "world" String domain = s.substring(s.length()); System.out.println(domain); // подстрока, начиная с N+1 буквы. Получим пустую строку. String substring = s1.substring(4); // System.out.println(s.substring(4)); System.out.println(substring.equals("")); System.out.println(substring);//подстрока, начиная с N+1 буквы. Получим пустую строку. } }
8389d75343effa9dad1de56eff1d399ecbb90e88
2c6b19fa7c8d601db008a3b370d8762a469181c4
/call-customer/call-customer-core/src/main/java/com/xiaoniu/call/customer/core/business/AccountManageBusinessImpl.java
5b408c414320d2d0333cde52d2a8263b2780c7c1
[]
no_license
nearable1/cosmos
60e43a8b3522807bca466c66142fb3f33043e0bb
cfa9404d3b1360ccfa4d1f9a55ea0cdcd7a86be9
refs/heads/master
2022-07-12T10:07:55.970301
2019-10-25T09:39:02
2019-10-25T09:39:02
115,409,813
1
1
null
2022-06-29T17:43:24
2017-12-26T09:54:41
Java
UTF-8
Java
false
false
2,498
java
package com.xiaoniu.call.customer.core.business; import com.xiaoniu.architecture.page.api.bean.PageResult; import com.xiaoniu.call.customer.api.business.AccountManageBusiness; import com.xiaoniu.call.customer.api.dto.AccountManageDTO; import com.xiaoniu.call.customer.api.dto.ManagerDTO; import com.xiaoniu.call.customer.api.dto.UserLoginDTO; import com.xiaoniu.call.customer.api.vo.AccountManagerVO; import com.xiaoniu.call.customer.api.vo.ManagerVO; import com.xiaoniu.call.customer.core.service.AccountManageService; import com.xiaoniu.call.customer.core.service.ManagerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.*; @Controller @ResponseBody public class AccountManageBusinessImpl implements AccountManageBusiness { @Autowired AccountManageService accountManageService; @Autowired ManagerService managerService; @Override @PostMapping(value = "/accountManagelist") public PageResult<AccountManageDTO> accountManagelist(@RequestBody AccountManagerVO accountManagerVO) { return accountManageService.accountManageList(accountManagerVO); } @Override @PostMapping(value = "/customerLoginLoglist") public PageResult<UserLoginDTO> customerLoginLoglist(@RequestBody AccountManagerVO accountManagerVO) { return accountManageService.userLoginLoglist(accountManagerVO); } @Override @PostMapping(value = "/managerList") public PageResult<ManagerDTO> managerList(@RequestBody ManagerVO managerVO) { return accountManageService.managerList(managerVO); } /** * 管理员新增 * * @param uid * @return */ @PutMapping(value = "/saveManager") @Override public void saveManager(@RequestParam("uid") Long uid) { managerService.saveManager(uid); } /** * 管理员启停用 * * @param id * @return */ @PutMapping(value = "/enableManager") @Override public void enableManager(@RequestParam("id") Long id, @RequestParam("status") Boolean status) { managerService.enableManager(id, status); } /** * 管理员删除 * * @param id * @return */ @DeleteMapping(value = "/deleteManager") @Override public void deleteManager(@RequestParam("id") Long id) { managerService.deleteManager(id); } }
de7d0b661c9dd72889d82bb3e6862bc9ffea31b0
a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb
/dm-20151123/src/main/java/com/aliyun/dm20151123/models/QueryTaskByParamRequest.java
6ae07a3c159da15d9c58e9b0983f2e75cd5c63b5
[ "Apache-2.0" ]
permissive
aliyun/alibabacloud-java-sdk
83a6036a33c7278bca6f1bafccb0180940d58b0b
008923f156adf2e4f4785a0419f60640273854ec
refs/heads/master
2023-09-01T04:10:33.640756
2023-09-01T02:40:45
2023-09-01T02:40:45
288,968,318
40
45
null
2023-06-13T02:47:13
2020-08-20T09:51:08
Java
UTF-8
Java
false
false
2,273
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.dm20151123.models; import com.aliyun.tea.*; public class QueryTaskByParamRequest extends TeaModel { @NameInMap("KeyWord") public String keyWord; @NameInMap("OwnerId") public Long ownerId; @NameInMap("PageNo") public Integer pageNo; @NameInMap("PageSize") public Integer pageSize; @NameInMap("ResourceOwnerAccount") public String resourceOwnerAccount; @NameInMap("ResourceOwnerId") public Long resourceOwnerId; @NameInMap("Status") public Integer status; public static QueryTaskByParamRequest build(java.util.Map<String, ?> map) throws Exception { QueryTaskByParamRequest self = new QueryTaskByParamRequest(); return TeaModel.build(map, self); } public QueryTaskByParamRequest setKeyWord(String keyWord) { this.keyWord = keyWord; return this; } public String getKeyWord() { return this.keyWord; } public QueryTaskByParamRequest setOwnerId(Long ownerId) { this.ownerId = ownerId; return this; } public Long getOwnerId() { return this.ownerId; } public QueryTaskByParamRequest setPageNo(Integer pageNo) { this.pageNo = pageNo; return this; } public Integer getPageNo() { return this.pageNo; } public QueryTaskByParamRequest setPageSize(Integer pageSize) { this.pageSize = pageSize; return this; } public Integer getPageSize() { return this.pageSize; } public QueryTaskByParamRequest setResourceOwnerAccount(String resourceOwnerAccount) { this.resourceOwnerAccount = resourceOwnerAccount; return this; } public String getResourceOwnerAccount() { return this.resourceOwnerAccount; } public QueryTaskByParamRequest setResourceOwnerId(Long resourceOwnerId) { this.resourceOwnerId = resourceOwnerId; return this; } public Long getResourceOwnerId() { return this.resourceOwnerId; } public QueryTaskByParamRequest setStatus(Integer status) { this.status = status; return this; } public Integer getStatus() { return this.status; } }
2485340c8b082586de0d17ce27ed0a1bc8b254b9
443509d36d158926f26e750a0aa242c652c4aec3
/app/src/main/java/com/aralmoro/android/movlancer/http/BaseApiService.java
08e07832f95eb682576e94d56f2ae58377c873b8
[]
no_license
aralmoro/MovLancer
c86f7857bf6ab6fd5729af066fa8dca7f8b72f83
18de0338118650bd778deab807562790163c54b8
refs/heads/master
2022-12-09T13:46:12.784629
2018-08-20T14:14:56
2018-08-20T14:14:56
286,086,576
0
0
null
null
null
null
UTF-8
Java
false
false
1,019
java
package com.aralmoro.android.movlancer.http; import com.aralmoro.android.movlancer.constants.ApiConstants; import com.aralmoro.android.movlancer.http.util.OkHttpClientFactory; import okhttp3.OkHttpClient; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; /** * Created by angelaalmoro on 16/08/2018. */ public abstract class BaseApiService { protected static final long CONN_TIMEOUT_MS = 32000; protected static final long READ_TIMEOUT_MS = 32000; protected Retrofit retrofit; public BaseApiService() { retrofit = new Retrofit.Builder() .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .addConverterFactory(GsonConverterFactory.create()) .baseUrl(ApiConstants.BASE_URL) .client(OkHttpClientFactory.createOkHttpClient(0, CONN_TIMEOUT_MS, READ_TIMEOUT_MS).build()) .build(); } }
d4361762ca2c2e92a447ca12e08e7c23710d3949
e21cbbdfa2beb73c70f19f48049bf7a63c88aafa
/SSI/src/br/com/nextel/ssi/model/to/MenuProfile.java
3f7baef802ac5843f7848dcd995c4ab807b00760
[]
no_license
mauriciozanettisalomao/SSI
b70885e54f27f063f37c604baf49bc475fea386f
15b727d6ba5f387ee77fc6d225679b7f5f70c1cc
refs/heads/master
2021-01-20T09:55:07.514858
2017-05-14T21:38:47
2017-05-14T21:38:47
90,301,100
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
package br.com.nextel.ssi.model.to; public class MenuProfile { private String descriptionGroup; private String profileFunctionality; private int sequence; public String getDescriptionGroup() { return descriptionGroup; } public void setDescriptionGroup(String descriptionGroup) { this.descriptionGroup = descriptionGroup; } public String getProfileFunctionality() { return profileFunctionality; } public void setProfileFunctionality(String profileFunctionality) { this.profileFunctionality = profileFunctionality; } public int getSequence() { return sequence; } public void setSequence(int sequence) { this.sequence = sequence; } @Override public String toString() { return "MenuProfile [descriptionGroup=" + descriptionGroup + ", profileFunctionality=" + profileFunctionality + ", sequence=" + sequence + "]"; } }
6e648d362a2201d42be39d45d485d1e4d56d97f2
cc2cfc2b08fb2774afb73615a5fe6b31edfccade
/QLForm/src/ql/ast/parser/QLBaseListener.java
a8b5532a92702b88df5379ca1307de63a219c021
[]
no_license
rashadaoud/Software_construction
d9aeb30070a04e2d00c83390fe99a61e6bc41187
37e64b8a50789c530fbfbd3aec2d22154ef7bc70
refs/heads/master
2020-03-22T05:17:37.676089
2018-08-14T10:28:28
2018-08-14T10:28:28
139,555,885
0
0
null
null
null
null
UTF-8
Java
false
false
3,825
java
// Generated from .\QL\QL.g4 by ANTLR 4.7.1 package ql.ast.parser; import org.antlr.v4.runtime.ParserRuleContext; import org.antlr.v4.runtime.tree.ErrorNode; import org.antlr.v4.runtime.tree.TerminalNode; /** * This class provides an empty implementation of {@link QLListener}, * which can be extended to create a listener which only needs to handle a subset * of the available methods. */ public class QLBaseListener implements QLListener { /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterLiteral(QLParser.LiteralContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitLiteral(QLParser.LiteralContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterIdentifier(QLParser.IdentifierContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitIdentifier(QLParser.IdentifierContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterQuestionType(QLParser.QuestionTypeContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitQuestionType(QLParser.QuestionTypeContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterExpr(QLParser.ExprContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitExpr(QLParser.ExprContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterStatement(QLParser.StatementContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitStatement(QLParser.StatementContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterQuestion(QLParser.QuestionContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitQuestion(QLParser.QuestionContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterIfElseStatement(QLParser.IfElseStatementContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitIfElseStatement(QLParser.IfElseStatementContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterBlock(QLParser.BlockContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitBlock(QLParser.BlockContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterForm(QLParser.FormContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitForm(QLParser.FormContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void enterEveryRule(ParserRuleContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void exitEveryRule(ParserRuleContext ctx) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void visitTerminal(TerminalNode node) { } /** * {@inheritDoc} * * <p>The default implementation does nothing.</p> */ @Override public void visitErrorNode(ErrorNode node) { } }
d20de76bfd4fb903bb77e14d2649ff82ee32af84
aa354bbd2fc90a3274f35dc24ff6442626ab7f91
/redesocial-api/src/main/java/com/redesocial/api/security/UserDetailsImpl.java
39d4c8796f9a56628984c4e51e8c0b9a77f7a533
[]
no_license
cezarags/Spring
452733e5aa87e9aa1f5d2d37734a51ec55389471
2d677ebdf009ab714518995bdc1c355f68f70455
refs/heads/master
2022-12-14T20:32:26.245551
2020-09-17T20:14:29
2020-09-17T20:14:29
292,254,419
0
0
null
null
null
null
UTF-8
Java
false
false
1,331
java
package com.redesocial.api.security; import java.util.Collection; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; import com.redesocial.api.model.Usuario; public class UserDetailsImpl implements UserDetails{ private String userName; private String password; public UserDetailsImpl(Usuario user) { this.userName = user.getEmail(); this.password = user.getSenha(); } public UserDetailsImpl() { } /** * */ private static final long serialVersionUID = 1L; @Override public Collection<? extends GrantedAuthority> getAuthorities() { // TODO Auto-generated method stub return null; } @Override public String getPassword() { // TODO Auto-generated method stub return password; } @Override public String getUsername() { // TODO Auto-generated method stub return userName; } @Override public boolean isAccountNonExpired() { // TODO Auto-generated method stub return true; } @Override public boolean isAccountNonLocked() { // TODO Auto-generated method stub return true; } @Override public boolean isCredentialsNonExpired() { // TODO Auto-generated method stub return true; } @Override public boolean isEnabled() { // TODO Auto-generated method stub return true; } }
eb62526711fcbafc870ef948f992eb2562f9524a
409aee188dc6e7921a2cc050ae773f429eac4208
/src/GameState.java
b37f4a3665abd5f56d38e71ba451566355becbc3
[]
no_license
Hjaltejuel/DrawTree
847c7fcae24b79ddbfa1eef40474220d88471077
109a61767d095af1c86159950191f43ea3965f53
refs/heads/master
2020-04-26T04:02:42.704230
2019-03-01T11:18:08
2019-03-01T11:18:08
173,287,954
0
0
null
null
null
null
UTF-8
Java
false
false
7,291
java
import javax.swing.*; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class GameState { public JFrame jFrame; public PaintPanel paintPanel; private int nodeWidth = 25; private int nodeHeight = 20; public State result(State state, Action action,States states){ if(state.moves[action.firstArrayD][action.secondArrayD] == null) { State state1 = state.copy(); if(states==States.MAX) { state1.moves[action.firstArrayD][action.secondArrayD] = true; } else { state1.moves[action.firstArrayD][action.secondArrayD] = false; } return state1; } return null; } public List<Action> actions(State state){ List<Action> actions = new ArrayList<>(); if(state.ishead){ for(int i = 0; i <3 ; i++){ if(state.moves[0][i] == null){ actions.add(new Action(0,i)); } } } else { if(state.moves[1][0] == null){ actions.add(new Action(1,0)); } } return actions; } public double playRandomFirst(State state,int depth){ State stateR = state.copy(); stateR.ishead = true; double val = playMax(stateR,depth+1,(jFrame.getWidth()+75)/2,jFrame.getWidth(),75); paintPanel.addShape(new OverState(depth,States.RANDOM,jFrame.getHeight())); paintPanel.addShape(new Node(val,(jFrame.getWidth()+75)/2,height(depth),state)); paintPanel.addShape(new Line((int) (((jFrame.getWidth()+75)/2)+(nodeWidth/2)),(int)(height(depth)+nodeHeight),(int)(((jFrame.getWidth()+75)/2) + (nodeWidth/2)), height(depth+1),false,true)); jFrame.repaint(); return val; } public double playRandom(State state, int depth,int x, int xMax, int xLow){ if(state.isFinished()){ if(state.nextMove == States.MIN){ paintPanel.addShape(new Node(1,x,height(depth),state)); return 1; } else { paintPanel.addShape(new Node(-1,x,height(depth),state)); return -1; } } State stateRCopy; State stateLCopy; double rval; double lval; int placementR = xLow + ((x-xLow)/2); int placementL = x+((xMax-x)/2); paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,placementL+(nodeWidth/2),height(depth+1),true,true)); paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,placementR+(nodeWidth/2),height(depth+1),false,true)); switch (state.nextMove){ case MAX: stateRCopy = state.copy(); stateRCopy.ishead = true; rval = playMax(stateRCopy,depth+1,placementR,x,xLow); stateLCopy = state.copy(); stateLCopy.ishead = false; lval = playMax(stateLCopy,depth+1,placementL,xMax,x); double value = (lval + rval)/2; paintPanel.addShape(new OverState(depth,States.RANDOM,jFrame.getHeight())); paintPanel.addShape(new Node(value,x,height(depth),state)); if(value < -2){ System.out.println("Eh"); } return value; case MIN: stateRCopy = state.copy(); stateRCopy.ishead = true; rval = playMin(stateRCopy,depth+1,placementR,x,xLow); stateLCopy = state.copy(); stateLCopy.ishead = false; lval = playMin(stateLCopy,depth+1,placementL,xMax,x); double val = (rval+lval) /2; paintPanel.addShape(new OverState(depth,States.RANDOM,jFrame.getHeight())); paintPanel.addShape(new Node(val,x,height(depth),state)); if(val < -2){ System.out.println("Eh"); } return val; } return -500; } public int height(int depth){ return ((jFrame.getHeight()/9)*depth)-30; } public double playMin(State state, int depth,int x, int xMax, int xLow){ paintPanel.addShape(new OverState(depth,States.MIN,jFrame.getHeight())); List<Action> actions = actions(state); if(actions.size() == 0 ){ paintPanel.addShape(new Node(0,x,height(depth),state)); return 0; } double v = Integer.MAX_VALUE; int xlowSub = xLow; double[] connections = new double[actions.size()]; for(int i = 0 ; i< actions.size(); i++){ State result = result(state,actions.get(i),States.MIN); if(result == null){ } result.nextMove= States.MAX; int part = (xMax-xLow)/actions.size(); int xMidSub = xlowSub+ (part/2); int xMaxSub = xlowSub+ part; connections[i] = xMidSub + nodeWidth/2; double val = playRandom(result,depth+1,xMidSub,xMaxSub,xlowSub); xlowSub +=part; v = Math.min(val,v); } for(int j = 0; j< connections.length; j++){ paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,(int)connections[j],height(depth+1),!state.ishead,false)); } paintPanel.addShape(new Node(v,x,height(depth),state)); return v; } public double playMax(State state, int depth,int x, int xMax, int xLow){ paintPanel.addShape(new OverState(depth,States.MAX,jFrame.getHeight())); List<Action> actions = actions(state); if(actions.size() == 0 ){ paintPanel.addShape(new Node(0,x,height(depth),state)); return 0; } double v = Integer.MIN_VALUE; int xlowSub = xLow; double[] connections = new double[actions.size()]; for(int i = 0 ; i< actions.size(); i++){ State result = result(state,actions.get(i),States.MAX); result.nextMove= States.MIN; int part = (xMax-xLow)/actions.size(); int xMidSub = xlowSub+ (part/2); int xMaxSub = xlowSub+ part; connections[i] = xMidSub + nodeWidth/2; double val = playRandom(result,depth+1,xMidSub,xMaxSub,xlowSub); xlowSub +=part; v = Math.max(val,v); } for(int j = 0; j< connections.length; j++){ paintPanel.addShape(new Line(x+(nodeWidth/2),height(depth)+nodeHeight,(int)connections[j],height(depth+1),!state.ishead,false)); } paintPanel.addShape(new Node(v,x,height(depth),state)); return v; } public double play(){ State state = new State(); state.nextMove = States.MAX; return playRandomFirst(state,1); } public GameState (){ jFrame = new JFrame("Tree"); jFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); jFrame.setUndecorated(true); jFrame.setVisible(true); paintPanel =new PaintPanel(); jFrame.add(paintPanel); jFrame.repaint(); System.out.println(play()); Scanner s = new Scanner(System.in); s.next(); } }
6223b48241621d25e25c0e1b7869d37499bb5829
57ecf65f0c84ebcc77d37094e0cc4bf60f30d286
/trading-strategies/open-interest-api/src/main/java/com/stocks/oi/service/DailyOpenInterestSpurtsService.java
01f6eadead63154a5bb4a07addd1a5d3d93d2330
[]
no_license
brijeshbhomkar/stock-apps
a559334eefb9525ab486af6a5c8b1b192875184b
80adbf807463549d0f9c8b01e185736a349c0831
refs/heads/master
2022-12-23T07:30:37.786332
2022-10-30T10:39:09
2022-10-30T10:39:09
161,975,402
0
1
null
2022-12-10T03:30:41
2018-12-16T06:46:31
Java
UTF-8
Java
false
false
5,167
java
package com.stocks.oi.service; import com.fasterxml.jackson.databind.ObjectMapper; import com.stocks.oi.response.oi.spurts.DailyHighestOpenInterestResponse; import com.stocks.oi.response.oi.spurts.DailyOpenInterestResponse; import com.stocks.oi.util.Endpoints; import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; import org.springframework.stereotype.Service; import java.io.IOException; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; @Log4j2 @Service public class DailyOpenInterestSpurtsService { private HttpClient client = HttpClient.newHttpClient(); @SneakyThrows public DailyHighestOpenInterestResponse getOpenInterestSpurtsStocks() { log.info("Find highest open interest " + Endpoints.TOP_POSITIVE_OI_CHANGE_DATA); DailyHighestOpenInterestResponse response = null; HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.TOP_POSITIVE_OI_CHANGE_DATA)) .header("Accept", "application/json").build(); final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); final String data = httpResponse.body(); if (data != null && !data.isEmpty()) { try { response = new ObjectMapper().readValue(data, DailyHighestOpenInterestResponse.class); } catch (IOException e) { e.printStackTrace(); } } return response; } @SneakyThrows public DailyOpenInterestResponse slideInPriceSlideInOpenInterestStocks() { log.info("Find stocks with slide in price slide in open interest (Bearish stocks) " + Endpoints.SLIDE_IN_PRICE_SLIDE_IN_OI); DailyOpenInterestResponse response = null; HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.SLIDE_IN_PRICE_SLIDE_IN_OI)) .header("Accept", "application/json").build(); final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); final String data = httpResponse.body(); if (data != null && !data.isEmpty()) { try { response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class); } catch (IOException e) { e.printStackTrace(); } } return response; } @SneakyThrows public DailyOpenInterestResponse riseInPriceSlideInOpenInterestStocks() { log.info("Find stocks with rise in price slide in open interest (Bearish stocks) " + Endpoints.RISE_IN_PRICE_SLIDE_IN_OI); DailyOpenInterestResponse response = null; HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.RISE_IN_PRICE_SLIDE_IN_OI)) .header("Accept", "application/json").build(); final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); final String data = httpResponse.body(); if (data != null && !data.isEmpty()) { try { response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class); } catch (IOException e) { e.printStackTrace(); } } return response; } @SneakyThrows public DailyOpenInterestResponse riseInPriceRiseInOpenInterestStocks() { log.info("Find stocks with rise in price slide in open interest (Bearish stocks) " + Endpoints.RISE_IN_PRICE_RISE_IN_OI); DailyOpenInterestResponse response = null; HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.RISE_IN_PRICE_RISE_IN_OI)) .header("Accept", "application/json").build(); final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); final String data = httpResponse.body(); if (data != null && !data.isEmpty()) { try { response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class); } catch (IOException e) { e.printStackTrace(); } } return response; } @SneakyThrows public DailyOpenInterestResponse slideInPriceRiseInOpenInterestStocks() { log.info("Find stocks with rise in price slide in open interest (Bearish stocks) " + Endpoints.SLIDE_IN_PRICE_RISE_IN_OI); DailyOpenInterestResponse response = null; HttpRequest httpRequest = HttpRequest.newBuilder().uri(URI.create(Endpoints.SLIDE_IN_PRICE_RISE_IN_OI)) .header("Accept", "application/json").build(); final HttpResponse<String> httpResponse = client.send(httpRequest, HttpResponse.BodyHandlers.ofString()); final String data = httpResponse.body(); if (data != null && !data.isEmpty()) { try { response = new ObjectMapper().readValue(data, DailyOpenInterestResponse.class); } catch (IOException e) { e.printStackTrace(); } } return response; } }
a72e94e14f11281b468fc111338af855c4e0b3ba
330f81dc5de92d7040f259b36e1182e9093c6c38
/Algorithms/Recursion/QueenBox.java
e7b3779bca6951bbd7031d34f7978819d9e16a1d
[]
no_license
Ujwalgulhane/Data-Structure-Algorithm
75f0bdd9a20de2abf567ee1f909aa91e3c2f5cfc
e5f8db3a313b3f634c002ec975e0b53029e82d90
refs/heads/master
2023-08-25T02:36:57.045798
2021-10-26T07:13:58
2021-10-26T07:13:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
968
java
import java.io.*; import java.util.*; public class QueenBox { public static void queensCombinations(int qpsf, int tq, int row, int col, String asf){ if(row==tq){ if(qpsf==tq){ System.out.println(asf); } return; } int nr=row,nc=col; if(col==tq-1){ nc=0;nr=row+1; }else{ nc=col+1; } if(col==tq-1){ queensCombinations(qpsf+1,tq,nr,nc,asf+"q\n"); queensCombinations(qpsf,tq,nr,nc,asf+"-\n"); }else{ queensCombinations(qpsf+1,tq,nr,nc,asf+"q"); queensCombinations(qpsf,tq,nr,nc,asf+"-"); } } public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); // printArry(0,0,"") ; queensCombinations(0, n, 0, 0, ""); } }
95394cc5b1fc3f768ebf4681b6249942160fcf32
f8a8db5a3327cc8d4c7427c5d66d00c30385ffce
/algorithms/src/main/java/algos/string/multiplystrings/Solution.java
a93651dc9b2029174e18243a2eb4936d98ffd5c8
[]
no_license
imtiyazgit/integrated-project
c4cd8e8b867c05d6b428143b9ee689f10d018a97
ff2517bd0c4f8214ebd4ad3f96ea980a3f0dc431
refs/heads/master
2022-12-22T13:09:38.654926
2020-10-30T18:28:48
2020-10-30T18:28:48
60,052,267
0
0
null
2022-12-16T01:51:51
2016-05-31T02:27:05
Java
UTF-8
Java
false
false
907
java
package algos.string.multiplystrings; public class Solution { public String multiply(String num1, String num2) { int m=num1.length(), n=num2.length(); int[] vals = new int[m+n]; for (int i = m-1; i >= 0; --i) { for (int j = n-1; j >=0 ; --j) { int mul = (num1.charAt(i) - '0') * (num2.charAt(j) - '0'); int sum = vals[i+j+1] + mul; vals[i+j] += sum / 10; vals[i+j+1] = sum %10; } } StringBuilder sb = new StringBuilder(); for(int val:vals) { if(sb.length() != 0 || val != 0) { sb.append(val); } } return sb.length() == 0 ? "0" : sb.toString(); } public static void main(String[] args) { Solution solution = new Solution(); System.out.println(solution.multiply("12", "9")); } }
d3940cb086b6586c8f2643cd4535a6ee1c5a551e
c06b04186855e4e0fe5e771239b31983d92bbdd7
/T1809-Java_Architect/01_Java_Beginner/01_Java300/010_Network/doc/Code/003_Net/246-250/Net_study03/src/com/sxt/chat04/Client.java
58e5a3f0a2fe688cb83c964d4f7474e1946b1159
[ "MIT" ]
permissive
specter01wj/ShangXueTang_Course
0c6b8895c684891f72ee3f42c14ac3884d1b7db4
1de238c3385585f07e19815f680277672d2e1b9b
refs/heads/master
2020-04-05T16:46:57.934281
2019-04-17T06:12:26
2019-04-17T06:12:26
157,028,215
0
1
null
null
null
null
UTF-8
Java
false
false
862
java
package com.sxt.chat04; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.Socket; import java.net.UnknownHostException; /** * 在线聊天室: 客户端 * 目标: 加入容器实现群聊 * @author 裴新 QQ:3401997271 * */ public class Client { public static void main(String[] args) throws UnknownHostException, IOException { System.out.println("-----Client-----"); BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); System.out.println("请输入用户名:"); String name =br.readLine(); //1、建立连接: 使用Socket创建客户端 +服务的地址和端口 Socket client =new Socket("localhost",8888); //2、客户端发送消息 new Thread(new Send(client,name)).start(); new Thread(new Receive(client)).start(); } }
20f09b9f93c795a895179e307e0785cb0cdc74cc
21efb28ff32d7bbd2a719749f1316804d5f39b32
/mall-mbg/src/main/java/com/macro/mall/model/OmsProcessExample.java
5b550fbda0f6f88c3572376787d5134ad3ecc637
[ "Apache-2.0" ]
permissive
DireW/mall
3a44fe09021b1d45cc8558ad3628057548bab311
97244ac62e7c00930365e77996418cefc722789d
refs/heads/master
2023-03-21T14:12:12.545910
2021-03-11T12:25:51
2021-03-11T12:25:51
295,946,065
0
0
Apache-2.0
2020-09-16T06:41:34
2020-09-16T06:41:33
null
UTF-8
Java
false
false
21,769
java
package com.macro.mall.model; import java.util.ArrayList; import java.util.Date; import java.util.List; public class OmsProcessExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public OmsProcessExample() { oredCriteria = new ArrayList<>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } 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; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<>(); } 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 andIdIsNull() { addCriterion("id is null"); return (Criteria) this; } public Criteria andIdIsNotNull() { addCriterion("id is not null"); return (Criteria) this; } public Criteria andIdEqualTo(Long value) { addCriterion("id =", value, "id"); return (Criteria) this; } public Criteria andIdNotEqualTo(Long value) { addCriterion("id <>", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThan(Long value) { addCriterion("id >", value, "id"); return (Criteria) this; } public Criteria andIdGreaterThanOrEqualTo(Long value) { addCriterion("id >=", value, "id"); return (Criteria) this; } public Criteria andIdLessThan(Long value) { addCriterion("id <", value, "id"); return (Criteria) this; } public Criteria andIdLessThanOrEqualTo(Long value) { addCriterion("id <=", value, "id"); return (Criteria) this; } public Criteria andIdIn(List<Long> values) { addCriterion("id in", values, "id"); return (Criteria) this; } public Criteria andIdNotIn(List<Long> values) { addCriterion("id not in", values, "id"); return (Criteria) this; } public Criteria andIdBetween(Long value1, Long value2) { addCriterion("id between", value1, value2, "id"); return (Criteria) this; } public Criteria andIdNotBetween(Long value1, Long value2) { addCriterion("id not between", value1, value2, "id"); return (Criteria) this; } public Criteria andNameIsNull() { addCriterion("name is null"); return (Criteria) this; } public Criteria andNameIsNotNull() { addCriterion("name is not null"); return (Criteria) this; } public Criteria andNameEqualTo(String value) { addCriterion("name =", value, "name"); return (Criteria) this; } public Criteria andNameNotEqualTo(String value) { addCriterion("name <>", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThan(String value) { addCriterion("name >", value, "name"); return (Criteria) this; } public Criteria andNameGreaterThanOrEqualTo(String value) { addCriterion("name >=", value, "name"); return (Criteria) this; } public Criteria andNameLessThan(String value) { addCriterion("name <", value, "name"); return (Criteria) this; } public Criteria andNameLessThanOrEqualTo(String value) { addCriterion("name <=", value, "name"); return (Criteria) this; } public Criteria andNameLike(String value) { addCriterion("name like", value, "name"); return (Criteria) this; } public Criteria andNameNotLike(String value) { addCriterion("name not like", value, "name"); return (Criteria) this; } public Criteria andNameIn(List<String> values) { addCriterion("name in", values, "name"); return (Criteria) this; } public Criteria andNameNotIn(List<String> values) { addCriterion("name not in", values, "name"); return (Criteria) this; } public Criteria andNameBetween(String value1, String value2) { addCriterion("name between", value1, value2, "name"); return (Criteria) this; } public Criteria andNameNotBetween(String value1, String value2) { addCriterion("name not between", value1, value2, "name"); return (Criteria) this; } public Criteria andSortNumberIsNull() { addCriterion("sort_number is null"); return (Criteria) this; } public Criteria andSortNumberIsNotNull() { addCriterion("sort_number is not null"); return (Criteria) this; } public Criteria andSortNumberEqualTo(Integer value) { addCriterion("sort_number =", value, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberNotEqualTo(Integer value) { addCriterion("sort_number <>", value, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberGreaterThan(Integer value) { addCriterion("sort_number >", value, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberGreaterThanOrEqualTo(Integer value) { addCriterion("sort_number >=", value, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberLessThan(Integer value) { addCriterion("sort_number <", value, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberLessThanOrEqualTo(Integer value) { addCriterion("sort_number <=", value, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberIn(List<Integer> values) { addCriterion("sort_number in", values, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberNotIn(List<Integer> values) { addCriterion("sort_number not in", values, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberBetween(Integer value1, Integer value2) { addCriterion("sort_number between", value1, value2, "sortNumber"); return (Criteria) this; } public Criteria andSortNumberNotBetween(Integer value1, Integer value2) { addCriterion("sort_number not between", value1, value2, "sortNumber"); return (Criteria) this; } public Criteria andCreatedByIsNull() { addCriterion("created_by is null"); return (Criteria) this; } public Criteria andCreatedByIsNotNull() { addCriterion("created_by is not null"); return (Criteria) this; } public Criteria andCreatedByEqualTo(Long value) { addCriterion("created_by =", value, "createdBy"); return (Criteria) this; } public Criteria andCreatedByNotEqualTo(Long value) { addCriterion("created_by <>", value, "createdBy"); return (Criteria) this; } public Criteria andCreatedByGreaterThan(Long value) { addCriterion("created_by >", value, "createdBy"); return (Criteria) this; } public Criteria andCreatedByGreaterThanOrEqualTo(Long value) { addCriterion("created_by >=", value, "createdBy"); return (Criteria) this; } public Criteria andCreatedByLessThan(Long value) { addCriterion("created_by <", value, "createdBy"); return (Criteria) this; } public Criteria andCreatedByLessThanOrEqualTo(Long value) { addCriterion("created_by <=", value, "createdBy"); return (Criteria) this; } public Criteria andCreatedByIn(List<Long> values) { addCriterion("created_by in", values, "createdBy"); return (Criteria) this; } public Criteria andCreatedByNotIn(List<Long> values) { addCriterion("created_by not in", values, "createdBy"); return (Criteria) this; } public Criteria andCreatedByBetween(Long value1, Long value2) { addCriterion("created_by between", value1, value2, "createdBy"); return (Criteria) this; } public Criteria andCreatedByNotBetween(Long value1, Long value2) { addCriterion("created_by not between", value1, value2, "createdBy"); return (Criteria) this; } public Criteria andCreatedTimeIsNull() { addCriterion("created_time is null"); return (Criteria) this; } public Criteria andCreatedTimeIsNotNull() { addCriterion("created_time is not null"); return (Criteria) this; } public Criteria andCreatedTimeEqualTo(Date value) { addCriterion("created_time =", value, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeNotEqualTo(Date value) { addCriterion("created_time <>", value, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeGreaterThan(Date value) { addCriterion("created_time >", value, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeGreaterThanOrEqualTo(Date value) { addCriterion("created_time >=", value, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeLessThan(Date value) { addCriterion("created_time <", value, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeLessThanOrEqualTo(Date value) { addCriterion("created_time <=", value, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeIn(List<Date> values) { addCriterion("created_time in", values, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeNotIn(List<Date> values) { addCriterion("created_time not in", values, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeBetween(Date value1, Date value2) { addCriterion("created_time between", value1, value2, "createdTime"); return (Criteria) this; } public Criteria andCreatedTimeNotBetween(Date value1, Date value2) { addCriterion("created_time not between", value1, value2, "createdTime"); return (Criteria) this; } public Criteria andUpdatedByIsNull() { addCriterion("updated_by is null"); return (Criteria) this; } public Criteria andUpdatedByIsNotNull() { addCriterion("updated_by is not null"); return (Criteria) this; } public Criteria andUpdatedByEqualTo(Long value) { addCriterion("updated_by =", value, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByNotEqualTo(Long value) { addCriterion("updated_by <>", value, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByGreaterThan(Long value) { addCriterion("updated_by >", value, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByGreaterThanOrEqualTo(Long value) { addCriterion("updated_by >=", value, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByLessThan(Long value) { addCriterion("updated_by <", value, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByLessThanOrEqualTo(Long value) { addCriterion("updated_by <=", value, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByIn(List<Long> values) { addCriterion("updated_by in", values, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByNotIn(List<Long> values) { addCriterion("updated_by not in", values, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByBetween(Long value1, Long value2) { addCriterion("updated_by between", value1, value2, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedByNotBetween(Long value1, Long value2) { addCriterion("updated_by not between", value1, value2, "updatedBy"); return (Criteria) this; } public Criteria andUpdatedTimeIsNull() { addCriterion("updated_time is null"); return (Criteria) this; } public Criteria andUpdatedTimeIsNotNull() { addCriterion("updated_time is not null"); return (Criteria) this; } public Criteria andUpdatedTimeEqualTo(Date value) { addCriterion("updated_time =", value, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeNotEqualTo(Date value) { addCriterion("updated_time <>", value, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeGreaterThan(Date value) { addCriterion("updated_time >", value, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeGreaterThanOrEqualTo(Date value) { addCriterion("updated_time >=", value, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeLessThan(Date value) { addCriterion("updated_time <", value, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeLessThanOrEqualTo(Date value) { addCriterion("updated_time <=", value, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeIn(List<Date> values) { addCriterion("updated_time in", values, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeNotIn(List<Date> values) { addCriterion("updated_time not in", values, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeBetween(Date value1, Date value2) { addCriterion("updated_time between", value1, value2, "updatedTime"); return (Criteria) this; } public Criteria andUpdatedTimeNotBetween(Date value1, Date value2) { addCriterion("updated_time not between", value1, value2, "updatedTime"); return (Criteria) this; } public Criteria andDeletedIsNull() { addCriterion("deleted is null"); return (Criteria) this; } public Criteria andDeletedIsNotNull() { addCriterion("deleted is not null"); return (Criteria) this; } public Criteria andDeletedEqualTo(Boolean value) { addCriterion("deleted =", value, "deleted"); return (Criteria) this; } public Criteria andDeletedNotEqualTo(Boolean value) { addCriterion("deleted <>", value, "deleted"); return (Criteria) this; } public Criteria andDeletedGreaterThan(Boolean value) { addCriterion("deleted >", value, "deleted"); return (Criteria) this; } public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) { addCriterion("deleted >=", value, "deleted"); return (Criteria) this; } public Criteria andDeletedLessThan(Boolean value) { addCriterion("deleted <", value, "deleted"); return (Criteria) this; } public Criteria andDeletedLessThanOrEqualTo(Boolean value) { addCriterion("deleted <=", value, "deleted"); return (Criteria) this; } public Criteria andDeletedIn(List<Boolean> values) { addCriterion("deleted in", values, "deleted"); return (Criteria) this; } public Criteria andDeletedNotIn(List<Boolean> values) { addCriterion("deleted not in", values, "deleted"); return (Criteria) this; } public Criteria andDeletedBetween(Boolean value1, Boolean value2) { addCriterion("deleted between", value1, value2, "deleted"); return (Criteria) this; } public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) { addCriterion("deleted not between", value1, value2, "deleted"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } 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); } } }
7a75e8a9e7a27068d7ca460e720d03442781b7de
332560b666f4d2f49089ecef9f68c6ed4f5b6b28
/src/test/java/org/emamotor/hfdp/state/gumball/GumballMachineTest.java
8e306e8fc09fbcb5149c52375f2cd118ea2aab6a
[]
no_license
emag-notes/hf-dp
9e08801f15aa617ee307041ac38dcdb2276ab464
28d18f7f7801b1e93a218fe81a854e5bb76e9bde
refs/heads/master
2020-04-10T22:24:06.320151
2013-12-26T12:59:17
2013-12-26T12:59:17
8,603,452
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
package org.emamotor.hfdp.state.gumball; import org.junit.Test; /** * @author Yoshimasa Tanabe */ public class GumballMachineTest { @Test public void testAllMethod() throws Exception { // Setup GumballMachine sut = new GumballMachine(5); // Exercise // Verify System.out.println(sut); sut.insertQuarter(); sut.turnCrank(); System.out.println(sut); sut.insertQuarter(); sut.ejectQuarter(); sut.turnCrank(); System.out.println(sut); sut.insertQuarter(); sut.turnCrank(); sut.insertQuarter(); sut.turnCrank(); sut.ejectQuarter(); System.out.println(sut); sut.insertQuarter(); sut.insertQuarter(); sut.turnCrank(); sut.insertQuarter(); sut.turnCrank(); sut.insertQuarter(); sut.turnCrank(); System.out.println(sut); } }
638f1addef0de872b38b285aa0d81d0c1a930420
18c70f2a4f73a9db9975280a545066c9e4d9898e
/mirror-cmdb/cmdb-agent/src/main/java/com/aspire/cmdb/agent/client/LldpInfoServiceClient.java
e9ae10eebb2e6d6a1c24899c77a8017ac61b8092
[]
no_license
iu28igvc9o0/cmdb_aspire
1fe5d8607fdacc436b8a733f0ea44446f431dfa8
793eb6344c4468fe4c61c230df51fc44f7d8357b
refs/heads/master
2023-08-11T03:54:45.820508
2021-09-18T01:47:25
2021-09-18T01:47:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
package com.aspire.cmdb.agent.client; import com.aspire.mirror.elasticsearch.api.dto.LldpInfo; import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.List; @FeignClient("ELASTICSEARCH-SERVICE") @Component public interface LldpInfoServiceClient { @GetMapping("/v1/lldp/querylldpInfoByidcAndIp") List<LldpInfo> querylldpInfoByidcAndIp(@RequestParam(value = "idcType", required = false) String idcType, @RequestParam(value = "ips", required = false) String ips); }
964f5ff45fb723085c47caf2113be19738d3da1d
f2653c695c972120808c53622e2c47baaabb2194
/src/Formulario/FrmConLegajoNombre.java
9f1ee17cec4c6e6cdf8f45596755bbfe67b0c3bc
[]
no_license
caoeze92/CRUDJAVA
4a4a62f480d15590bdf03ca00c589f8e122edeea
0a963b3ee008241060e4bda5864ede2d41ac5c57
refs/heads/master
2022-12-27T14:47:48.337382
2020-10-17T20:23:01
2020-10-17T20:26:39
304,964,007
0
0
null
null
null
null
UTF-8
Java
false
false
15,005
java
package Formulario; import Desarrollo.Busqueda; import javax.swing.JOptionPane; public class FrmConLegajoNombre extends javax.swing.JInternalFrame { Busqueda ObjB = new Busqueda(); public FrmConLegajoNombre() { initComponents(); this.PanelNombres.setVisible(false); this.PanelPorLegajo.setVisible(false); } @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { GrupoBusqueda = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jPanel2 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); rbLegajo = new javax.swing.JRadioButton(); rbNombre = new javax.swing.JRadioButton(); txtNom = new javax.swing.JTextField(); txtNroLeg = new javax.swing.JTextField(); jPanel4 = new javax.swing.JPanel(); btnBuscar = new javax.swing.JButton(); btnSalir = new javax.swing.JButton(); PanelPorLegajo = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); lblLegajo = new javax.swing.JLabel(); txtBNombre = new javax.swing.JTextField(); lblSueldo = new javax.swing.JLabel(); lblActivo = new javax.swing.JLabel(); PanelNombres = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); TablaNombre = new javax.swing.JTable(); setIconifiable(true); setMaximizable(true); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel1.setBackground(new java.awt.Color(102, 102, 255)); jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); jPanel2.setBackground(new java.awt.Color(102, 102, 255)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 1090, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 70, Short.MAX_VALUE) ); jPanel1.add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(-10, 20, 1090, 70)); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("BUSCAR POR")); GrupoBusqueda.add(rbLegajo); rbLegajo.setSelected(true); rbLegajo.setText("NUMERO DE LEGAJO"); GrupoBusqueda.add(rbNombre); rbNombre.setText("NOMBRE"); txtNroLeg.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtNroLegActionPerformed(evt); } }); txtNroLeg.addKeyListener(new java.awt.event.KeyAdapter() { public void keyTyped(java.awt.event.KeyEvent evt) { txtNroLegKeyTyped(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(60, 60, 60) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(rbLegajo) .addComponent(rbNombre)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtNroLeg, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtNom, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(14, Short.MAX_VALUE)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(rbLegajo) .addComponent(txtNroLeg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(rbNombre) .addComponent(txtNom, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap(33, Short.MAX_VALUE)) ); jPanel1.add(jPanel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 90, 310, 130)); jPanel4.setBackground(new java.awt.Color(102, 102, 255)); btnBuscar.setText("BUSCAR"); btnBuscar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarActionPerformed(evt); } }); btnSalir.setText("SALIR"); btnSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSalirActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGap(39, 39, 39) .addComponent(btnBuscar) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 853, Short.MAX_VALUE) .addComponent(btnSalir) .addGap(44, 44, 44)) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGap(29, 29, 29) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(btnBuscar) .addComponent(btnSalir)) .addContainerGap(28, Short.MAX_VALUE)) ); jPanel1.add(jPanel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 360, 1070, 80)); PanelPorLegajo.setBackground(new java.awt.Color(153, 255, 255)); jLabel1.setText("NUMERO DE LEGAJO:"); jLabel2.setText("NOMBRE: "); jLabel3.setText("SUELDO: "); jLabel4.setText("ACTIVO: "); lblSueldo.setText(" "); javax.swing.GroupLayout PanelPorLegajoLayout = new javax.swing.GroupLayout(PanelPorLegajo); PanelPorLegajo.setLayout(PanelPorLegajoLayout); PanelPorLegajoLayout.setHorizontalGroup( PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(PanelPorLegajoLayout.createSequentialGroup() .addGap(33, 33, 33) .addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(PanelPorLegajoLayout.createSequentialGroup() .addComponent(jLabel4) .addGap(46, 46, 46) .addComponent(lblActivo, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(PanelPorLegajoLayout.createSequentialGroup() .addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel1) .addComponent(jLabel2) .addComponent(jLabel3)) .addGap(18, 18, 18) .addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(lblLegajo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtBNombre, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE) .addComponent(lblSueldo, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(50, Short.MAX_VALUE)) ); PanelPorLegajoLayout.setVerticalGroup( PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(PanelPorLegajoLayout.createSequentialGroup() .addGap(36, 36, 36) .addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(lblLegajo, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(39, 39, 39) .addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(txtBNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(37, 37, 37) .addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(lblSueldo)) .addGap(29, 29, 29) .addGroup(PanelPorLegajoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(lblActivo)) .addContainerGap(67, Short.MAX_VALUE)) ); jPanel1.add(PanelPorLegajo, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 90, 340, 270)); PanelNombres.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); TablaNombre.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Title 1", "Title 2", "Title 3", "Title 4" } )); jScrollPane1.setViewportView(TablaNombre); PanelNombres.add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 370, 270)); jPanel1.add(PanelNombres, new org.netbeans.lib.awtextra.AbsoluteConstraints(700, 90, 370, 290)); getContentPane().add(jPanel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, -20, 1090, 430)); pack(); }// </editor-fold>//GEN-END:initComponents private void txtNroLegActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNroLegActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtNroLegActionPerformed private void btnSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSalirActionPerformed dispose(); }//GEN-LAST:event_btnSalirActionPerformed private void btnBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarActionPerformed if (this.rbNombre.isSelected()) { if (this.txtNom.getText().isEmpty()) { JOptionPane.showMessageDialog(this, "Debe ingresar un nombre"); } else { //CASO 2 String Nom = this.txtNom.getText(); ObjB.setNom(Nom); //ObjB.BuscaxNom(); this.PanelNombres.setVisible(true); this.TablaNombre.setModel(ObjB.MuestroTit()); this.TablaNombre.setModel(ObjB.BuscaxNom()); } } else { //CASO 1 if (this.txtNroLeg.getText().isEmpty()) { JOptionPane.showMessageDialog(null, "Debe ingresar un numero de Legajo "); } else { int Leg = Integer.parseInt(this.txtNroLeg.getText()); boolean Existe = ObjB.BuscaxLeg(Leg); this.PanelPorLegajo.setVisible(true); if (Existe==true) { this.lblLegajo.setText(String.valueOf(ObjB.getLegajo())); this.lblActivo.setText(String.valueOf(ObjB.isAct())); this.lblSueldo.setText(String.valueOf(ObjB.getSdo())); this.txtBNombre.setText(String.valueOf(ObjB.getNom())); this.txtBNombre.setEditable(false); } else { JOptionPane.showMessageDialog(null, "Nro de legajo inexistente"); } } } }//GEN-LAST:event_btnBuscarActionPerformed private void txtNroLegKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtNroLegKeyTyped if (this.txtNroLeg.getText().length()>=6) { evt.consume(); } }//GEN-LAST:event_txtNroLegKeyTyped // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.ButtonGroup GrupoBusqueda; private javax.swing.JPanel PanelNombres; private javax.swing.JPanel PanelPorLegajo; private javax.swing.JTable TablaNombre; private javax.swing.JButton btnBuscar; private javax.swing.JButton btnSalir; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JLabel lblActivo; private javax.swing.JLabel lblLegajo; private javax.swing.JLabel lblSueldo; private javax.swing.JRadioButton rbLegajo; private javax.swing.JRadioButton rbNombre; private javax.swing.JTextField txtBNombre; private javax.swing.JTextField txtNom; private javax.swing.JTextField txtNroLeg; // End of variables declaration//GEN-END:variables }
[ "Ezequiel Cao" ]
Ezequiel Cao
7b7cae5bd721487e3155493872834b29aa832b75
a334dec57cb99bfcfb2e4d39cfea13cfa0064e2b
/src/main/java/com/crs4/sem/rest/SemanticEngineRestResources.java
3aa59338bd55e65f642fdd7bc53a7d4a8e66a1f1
[]
no_license
natcrs4/fast-semantic-engine
1ae45e7c40c36904f4dff114fbab57d020b49248
fd7dc6bdc910637f02a4a51f2eb20afcfac23333
refs/heads/master
2021-01-14T04:57:06.984198
2020-05-19T09:24:47
2020-05-19T09:24:47
242,605,996
0
0
null
null
null
null
UTF-8
Java
false
false
2,899
java
package com.crs4.sem.rest; import java.io.IOException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.logging.Logger; import javax.inject.Inject; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import com.crs4.sem.model.Document; import com.crs4.sem.model.Documentable; import com.crs4.sem.model.NewDocument; import com.crs4.sem.model.NewSearchResult; import com.crs4.sem.model.SearchResult; import com.crs4.sem.service.SemanticEngineService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.Data; @Path("/semantics") @Api(value = "Semantics", description = "Resources api for semantic processing of documents") @Data public class SemanticEngineRestResources { @Inject private SemanticEngineService documentService; @Inject private Logger log; @GET @Path("/search") @ApiOperation(value = "semantic search", notes = "Search document from a store matching text", response = SearchResult.class) @Produces(MediaType.APPLICATION_JSON) public NewSearchResult searchText(@QueryParam("text") String text,@QueryParam("entities") @DefaultValue("false") Boolean entities,@QueryParam("start") @DefaultValue("0") Integer start,@QueryParam("maxresults") @DefaultValue("1000") Integer maxresults, @QueryParam("from") String from, @QueryParam("to") String to) throws IOException, ParseException { log.info("classify text" + text); Date from_date=null; Date to_date=null; SimpleDateFormat df = new SimpleDateFormat( "yyyy-MM-dd" ); if(from!=null) from_date=df.parse(from); if(to!=null) to_date=df.parse(to); NewSearchResult searchResult = this.documentService.semanticSearch(text,start,maxresults); return searchResult; } @GET @Path("/similars/{id}") @ApiOperation(value = "get similars", notes = "Search similar documents to document id", response = Document.class) @Produces(MediaType.APPLICATION_JSON) public List<NewDocument> similars(@PathParam("id") Long id,@QueryParam("start") @DefaultValue("0") Integer start,@QueryParam("maxresults") @DefaultValue("1000") Integer maxresults) throws IOException, ParseException { log.info("searching similars to document id :" + id); Documentable doc=this.documentService.get(id,false); // doc.get //List<Document> docs = this.documentService.semanticSearch(doc,start,maxresults); List<NewDocument> docs=null; return docs; } @GET @Path("/buildgraph") @ApiOperation(value = "build entity graph", notes = "Build graph using entities") public Response buildGraph() { this.documentService.buildGraph(); return Response.ok().build(); } }
[ "mario@jortis" ]
mario@jortis
6bd21784e8c6f7d9b9e702a3cd6a6019699186d1
cde22ead6409a28a7858aef68dc536d21ae1eaaa
/core/src/test/java/io/undertow/server/handlers/proxy/AbstractLoadBalancingProxyTestCase.java
afcd21c5c0cabc68a15058d7064f0dac8a40074d
[ "Apache-2.0" ]
permissive
tmescic/undertow
9f5e6910b81d218b232f8df2cabe8367c4765933
a7f9ba00e892904b7af0e532ab62944d0bafa847
refs/heads/master
2021-01-18T05:51:10.951982
2014-07-02T15:31:40
2014-07-02T15:31:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,956
java
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * 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 io.undertow.server.handlers.proxy; import io.undertow.Undertow; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; import io.undertow.server.session.Session; import io.undertow.server.session.SessionCookieConfig; import io.undertow.server.session.SessionManager; import io.undertow.testutils.DefaultServer; import io.undertow.testutils.HttpClientUtils; import io.undertow.testutils.TestHttpClient; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import java.io.IOException; /** * Tests the load balancing proxy * * @author Stuart Douglas */ @RunWith(DefaultServer.class) public abstract class AbstractLoadBalancingProxyTestCase { private static final String COUNT = "count"; protected static Undertow server1; protected static Undertow server2; @AfterClass public static void teardown() { server1.stop(); server2.stop(); } @Test public void testLoadShared() throws IOException { final StringBuilder resultString = new StringBuilder(); for (int i = 0; i < 6; ++i) { TestHttpClient client = new TestHttpClient(); try { HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/name"); HttpResponse result = client.execute(get); Assert.assertEquals(200, result.getStatusLine().getStatusCode()); resultString.append(HttpClientUtils.readResponse(result)); resultString.append(' '); } finally { client.getConnectionManager().shutdown(); } } Assert.assertTrue(resultString.toString().contains("server1")); Assert.assertTrue(resultString.toString().contains("server2")); } @Test public void testLoadSharedWithServerShutdown() throws IOException { final StringBuilder resultString = new StringBuilder(); for (int i = 0; i < 6; ++i) { TestHttpClient client = new TestHttpClient(); try { HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/name"); HttpResponse result = client.execute(get); Assert.assertEquals(200, result.getStatusLine().getStatusCode()); resultString.append(HttpClientUtils.readResponse(result)); resultString.append(' '); } catch (Throwable t) { throw new RuntimeException("Failed with i=" + i, t); } finally { client.getConnectionManager().shutdown(); } server1.stop(); server1.start(); server2.stop(); server2.start(); } Assert.assertTrue(resultString.toString().contains("server1")); Assert.assertTrue(resultString.toString().contains("server2")); } @Test public void testStickySessions() throws IOException { int expected = 0; TestHttpClient client = new TestHttpClient(); try { for (int i = 0; i < 6; ++i) { try { HttpGet get = new HttpGet(DefaultServer.getDefaultServerURL() + "/session"); get.addHeader("Connection", "close"); HttpResponse result = client.execute(get); Assert.assertEquals(200, result.getStatusLine().getStatusCode()); int count = Integer.parseInt(HttpClientUtils.readResponse(result)); Assert.assertEquals(expected++, count); } catch (Exception e) { throw new RuntimeException("Test failed with i=" + i, e); } } } finally { client.getConnectionManager().shutdown(); } } protected static final class SessionTestHandler implements HttpHandler { private final SessionCookieConfig sessionConfig; protected SessionTestHandler(SessionCookieConfig sessionConfig) { this.sessionConfig = sessionConfig; } @Override public void handleRequest(final HttpServerExchange exchange) throws Exception { final SessionManager manager = exchange.getAttachment(SessionManager.ATTACHMENT_KEY); Session session = manager.getSession(exchange, sessionConfig); if (session == null) { session = manager.createSession(exchange, sessionConfig); session.setAttribute(COUNT, 0); } Integer count = (Integer) session.getAttribute(COUNT); session.setAttribute(COUNT, count + 1); exchange.getResponseSender().send("" + count); } } protected static final class StringSendHandler implements HttpHandler { private final String serverName; protected StringSendHandler(String serverName) { this.serverName = serverName; } @Override public void handleRequest(final HttpServerExchange exchange) throws Exception { exchange.getResponseSender().send(serverName); } } }
145307017c3078693706cf682500c3f5fac7a4f2
13dae3f6bc55ba035c1c61d929679d9454cfadc3
/TutoHelp/src/main/java/pe/edu/upc/dao/ICursoDao.java
cf9ef0080f793e1bb7a0d9ebc0a395e071ae498f
[]
no_license
Samber1234/PrograWeb_Grupo3
ccef8893fc4b25e9a4b3fee77c7b84c57f9ebe6a
e4a71e23562cec378cb452e28872d88aeff21e45
refs/heads/main
2023-08-10T20:22:58.540859
2021-09-17T04:48:14
2021-09-17T04:48:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
185
java
package pe.edu.upc.dao; import java.util.List; import pe.edu.upc.entities.Curso; public interface ICursoDao { public void insert(Curso c); public List<Curso> list(); }
91cab6412c97be43aa493717a7d5da54a9f61ed9
c16c1854880a1d806ffa2105b9b4d2b93b6baf75
/pac-service/src/main/java/com/bocom/dao/AppBasketItemDao.java
cbb98440ca8657bfedf414e1677f22722e6ddc15
[]
no_license
oldGoodSee/BSC
26e71acd8c3695cd02f3e944b14e0f4e2e03b219
56b72b79adb122b0fe85ee570665789b973e31c8
refs/heads/master
2021-08-29T15:42:42.431924
2017-12-14T03:37:20
2017-12-14T03:37:20
114,209,439
1
0
null
null
null
null
UTF-8
Java
false
false
556
java
package com.bocom.dao; import com.bocom.domain.pac.AppBasketItemInfo; import com.bocom.domain.pac.PackagingInfo; import java.util.List; public interface AppBasketItemDao { int deleteByPrimaryKey(Integer uuid); int insert(AppBasketItemInfo record); int insertSelective(AppBasketItemInfo record); AppBasketItemInfo selectByPrimaryKey(Integer uuid); int updateByPrimaryKeySelective(AppBasketItemInfo record); int updateByPrimaryKey(AppBasketItemInfo record); List<AppBasketItemInfo> queryBasketInfo(PackagingInfo param); }
b8b792418599865003e2a9287b8ba957706b4c46
fff8f77f810bbd5fb6b4e5f7a654568fd9d3098d
/src/main/java/kotlin/reflect/jvm/internal/impl/load/kotlin/KotlinClassFinder.java
bb445b163e5eb4696c7a045b1e8e772d1cacd319
[]
no_license
TL148/gorkiy
b6ac8772587e9e643d939ea399bf5e7a42e89f46
da8fbd017277cf72020c8c800326954bb1a0cee3
refs/heads/master
2021-05-21T08:24:39.286900
2020-04-03T02:57:49
2020-04-03T02:57:49
252,618,229
0
0
null
2020-04-03T02:54:39
2020-04-03T02:54:39
null
UTF-8
Java
false
false
3,507
java
package kotlin.reflect.jvm.internal.impl.load.kotlin; import java.util.Arrays; import kotlin.jvm.internal.Intrinsics; import kotlin.reflect.jvm.internal.impl.load.java.structure.JavaClass; import kotlin.reflect.jvm.internal.impl.name.ClassId; import kotlin.reflect.jvm.internal.impl.serialization.deserialization.KotlinMetadataFinder; /* compiled from: KotlinClassFinder.kt */ public interface KotlinClassFinder extends KotlinMetadataFinder { Result findKotlinClassOrContent(JavaClass javaClass); Result findKotlinClassOrContent(ClassId classId); /* compiled from: KotlinClassFinder.kt */ public static abstract class Result { private Result() { } public /* synthetic */ Result(DefaultConstructorMarker defaultConstructorMarker) { this(); } public final KotlinJvmBinaryClass toKotlinJvmBinaryClass() { KotlinClass kotlinClass = (KotlinClass) (!(this instanceof KotlinClass) ? null : this); if (kotlinClass != null) { return kotlinClass.getKotlinJvmBinaryClass(); } return null; } /* compiled from: KotlinClassFinder.kt */ public static final class KotlinClass extends Result { private final KotlinJvmBinaryClass kotlinJvmBinaryClass; public boolean equals(Object obj) { if (this != obj) { return (obj instanceof KotlinClass) && Intrinsics.areEqual(this.kotlinJvmBinaryClass, ((KotlinClass) obj).kotlinJvmBinaryClass); } return true; } public int hashCode() { KotlinJvmBinaryClass kotlinJvmBinaryClass2 = this.kotlinJvmBinaryClass; if (kotlinJvmBinaryClass2 != null) { return kotlinJvmBinaryClass2.hashCode(); } return 0; } public String toString() { return "KotlinClass(kotlinJvmBinaryClass=" + this.kotlinJvmBinaryClass + ")"; } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public KotlinClass(KotlinJvmBinaryClass kotlinJvmBinaryClass2) { super(null); Intrinsics.checkParameterIsNotNull(kotlinJvmBinaryClass2, "kotlinJvmBinaryClass"); this.kotlinJvmBinaryClass = kotlinJvmBinaryClass2; } public final KotlinJvmBinaryClass getKotlinJvmBinaryClass() { return this.kotlinJvmBinaryClass; } } /* compiled from: KotlinClassFinder.kt */ public static final class ClassFileContent extends Result { private final byte[] content; public boolean equals(Object obj) { if (this != obj) { return (obj instanceof ClassFileContent) && Intrinsics.areEqual(this.content, ((ClassFileContent) obj).content); } return true; } public int hashCode() { byte[] bArr = this.content; if (bArr != null) { return Arrays.hashCode(bArr); } return 0; } public String toString() { return "ClassFileContent(content=" + Arrays.toString(this.content) + ")"; } public final byte[] getContent() { return this.content; } } } }
7acf48961da7b770fe2da67f28a3f2bcc03d7a22
75ee376eb8e255dbb5d4d981529585c36fe78967
/Hibernate/In28Minutes/database-demo/src/test/java/com/in28minutes/database/databasedemo/SpringJDBCDemoApplicationTests.java
9817521d5ddc39cb2424b5c40ff92b0051319119
[]
no_license
nvvssmanyam/J2EEPractice
8d340d30fe3b330624788f6156e12886edf6255f
5df3c232b15e28c9d49c9975fa01010e1395fd5d
refs/heads/master
2023-08-04T16:47:49.332302
2022-05-04T04:24:19
2022-05-04T04:24:19
168,332,164
0
1
null
2023-07-23T05:27:56
2019-01-30T11:30:27
Java
UTF-8
Java
false
false
362
java
package com.in28minutes.database.databasedemo; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class SpringJDBCDemoApplicationTests { @Test public void contextLoads() { } }
7f3ef1d123da625d52080b6d1af6c830a994fb38
aee352da4736a6effca3beee0aaec634a50373ce
/app/src/main/java/com/example/reminiscence/GalleryDatabase.java
666916bdc907f07b1f53dfc47e4240cacb6a6084
[]
no_license
berniBZS/Reminiscence
40b63cb2e98a44c0715032bfee0451a1e9ca370d
26b93897146862aeffd7bc777df62b526cf434df
refs/heads/main
2023-04-27T07:39:26.128703
2021-05-13T11:58:29
2021-05-13T11:58:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,244
java
package com.example.reminiscence; import android.content.Context; import android.os.AsyncTask; import android.provider.MediaStore; import androidx.annotation.NonNull; import androidx.room.Database; import androidx.room.Room; import androidx.room.RoomDatabase; import androidx.sqlite.db.SupportSQLiteDatabase; @Database(entities = {PhotoName.class}, version = 1) public abstract class GalleryDatabase extends RoomDatabase { public abstract PhotoNameDao photoNameDao(); private static GalleryDatabase instance; public static synchronized GalleryDatabase getInstance(Context context) { if (instance == null) { instance = Room.databaseBuilder(context.getApplicationContext(), GalleryDatabase.class, "gallery_database") .fallbackToDestructiveMigration() .addCallback(roomCallback) .build(); } return instance; } private static RoomDatabase.Callback roomCallback = new RoomDatabase.Callback(){ @Override public void onCreate(@NonNull SupportSQLiteDatabase db) { super.onCreate(db); new PopulateDBAsyncTask(instance).execute(); } }; private static class PopulateDBAsyncTask extends AsyncTask<Void, Void, Void> { private PhotoNameDao photoNameDao; PopulateDBAsyncTask(GalleryDatabase db){ photoNameDao = db.photoNameDao(); } @Override protected Void doInBackground(Void... voids) { //photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A34", "brad")); //photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A33", "amigo1")); //photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A32", "amiga2")); //photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A31", "nieto")); //photoNameDao.insert(new PhotoName("content://com.android.providers.downloads.documents/document/msf%3A35", "nieta")); return null; } } }
ba993813c063530350133f7db8542d4ab1001f7a
86ec135452f3b57ecb56e28eed2e8dcbfab58a16
/JSF2-Spring-Hibernate-Example/src/main/java/com/keylesson/dao/UserDAO.java
914c3ca3c08adef2a163c042ecdf79006b694371
[]
no_license
auntaru/rokya-spring
afd3f1f02caf48618d2ec9f99d4f9c2752eeb9f7
4fd09926f81ca5931e77ab163bb518dc9c40318a
refs/heads/master
2020-05-22T07:02:11.218403
2018-01-19T19:33:04
2018-01-19T19:33:04
34,803,204
1
2
null
null
null
null
UTF-8
Java
false
false
1,213
java
package com.keylesson.dao; import java.util.HashSet; import java.util.Set; import javax.inject.Inject; import javax.inject.Named; import org.hibernate.SessionFactory; import org.springframework.transaction.annotation.Transactional; import com.keylesson.model.UserModel; import com.keylesson.persistence.Role; import com.keylesson.persistence.User; @Named @Transactional("transactionManager") public class UserDAO { @Inject private SessionFactory sessionFactory; public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } public void addUser(UserModel model) { User user = new User(); user.setLogin(model.getLogin()); user.setPwd(model.getPwd()); user.setEnabled(1); Role role = (Role) sessionFactory.getCurrentSession() .createQuery("from Role where code='ROLE_USER'").uniqueResult(); if (role == null) { role = new Role(); role.setCode("ROLE_USER"); role.setLabel("ROLE FOR SIMPLE ACCESS"); sessionFactory.getCurrentSession().save(role); } Set<Role> roles = new HashSet<Role>(); roles.add(role); user.setRoles(roles); sessionFactory.getCurrentSession().save(user); } }
375f039d16bcb13a6fd4ee34070bc6d45e693049
35477fae0c6e9161e00c8010a04b5afb9e6a7c9c
/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/rewrite/changegenerator/ChangeGenerator.java
8901a868856c8b227204ca8bcf1c4ad7d34a141b
[]
no_license
cemeyer2/fruit
959693aada218b7552ab73c89413cd2746c9182a
8a661d80b443efb928950553ef81277d5a0bf3a6
refs/heads/master
2021-01-19T19:31:09.379404
2014-05-13T14:36:48
2014-05-13T14:36:48
19,291,788
1
0
null
null
null
null
UTF-8
Java
false
false
22,962
java
/******************************************************************************* * Copyright (c) 2008 Institute for Software, HSR Hochschule fuer Technik * Rapperswil, University of applied sciences 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: * Institute for Software - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.core.dom.rewrite.changegenerator; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import org.eclipse.cdt.core.dom.ast.ASTVisitor; import org.eclipse.cdt.core.dom.ast.IASTComment; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTFileLocation; import org.eclipse.cdt.core.dom.ast.IASTInitializer; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration; import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition; import org.eclipse.cdt.internal.core.dom.rewrite.ASTModification; import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationMap; import org.eclipse.cdt.internal.core.dom.rewrite.ASTModificationStore; import org.eclipse.cdt.internal.core.dom.rewrite.ASTRewriteAnalyzer; import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ASTWriter; import org.eclipse.cdt.internal.core.dom.rewrite.astwriter.ProblemRuntimeException; import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.ASTCommenter; import org.eclipse.cdt.internal.core.dom.rewrite.commenthandler.NodeCommentMap; import org.eclipse.cdt.internal.core.dom.rewrite.util.FileContentHelper; import org.eclipse.cdt.internal.core.dom.rewrite.util.FileHelper; import org.eclipse.cdt.internal.core.parser.scanner.ILocationResolver; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.ltk.core.refactoring.Change; import org.eclipse.ltk.core.refactoring.CompositeChange; import org.eclipse.ltk.core.refactoring.TextFileChange; import org.eclipse.text.edits.DeleteEdit; import org.eclipse.text.edits.InsertEdit; import org.eclipse.text.edits.MultiTextEdit; import org.eclipse.text.edits.ReplaceEdit; import org.eclipse.text.edits.TextEditGroup; public class ChangeGenerator extends CPPASTVisitor { private final LinkedHashMap<String, Integer> sourceOffsets = new LinkedHashMap<String, Integer>(); public LinkedHashMap<IASTNode, List<ASTModification>> modificationParent = new LinkedHashMap<IASTNode, List<ASTModification>>(); private final LinkedHashMap<IFile, MultiTextEdit> changes = new LinkedHashMap<IFile, MultiTextEdit>(); private CompositeChange change; private final ASTModificationStore modificationStore; private NodeCommentMap commentMap; { shouldVisitExpressions = true; shouldVisitStatements = true; shouldVisitNames = true; shouldVisitDeclarations = true; shouldVisitDeclSpecifiers = true; shouldVisitDeclarators = true; shouldVisitInitializers = true; shouldVisitBaseSpecifiers = true; shouldVisitNamespaces = true; shouldVisitTemplateParameters = true; shouldVisitParameterDeclarations = true; shouldVisitTranslationUnit = true; } public ChangeGenerator(ASTModificationStore modificationStore) { this.modificationStore = modificationStore; } public void generateChange(IASTNode rootNode) throws ProblemRuntimeException { generateChange(rootNode, this); } public void generateChange(IASTNode rootNode, CPPASTVisitor pathProvider) throws ProblemRuntimeException { change = new CompositeChange(Messages.ChangeGenerator_compositeChange); initParentModList(); commentMap = ASTCommenter.getCommentedNodeMap(rootNode.getTranslationUnit()); rootNode.accept(pathProvider); for (IFile currentFile : changes.keySet()) { TextFileChange subchange= ASTRewriteAnalyzer.createCTextFileChange(currentFile); subchange.setEdit(changes.get(currentFile)); change.add(subchange); } } private void initParentModList() { ASTModificationMap rootModifications = modificationStore .getRootModifications(); if (rootModifications != null) { for (IASTNode modifiedNode : rootModifications.getModifiedNodes()) { List<ASTModification> modificationsForNode = rootModifications .getModificationsForNode(modifiedNode); IASTNode modifiedNodeParent = determineParentToBeRewritten(modifiedNode, modificationsForNode); modificationParent.put(modifiedNodeParent != null ? modifiedNodeParent : modifiedNode, modificationsForNode); } } } private IASTNode determineParentToBeRewritten(IASTNode modifiedNode, List<ASTModification> modificationsForNode) { IASTNode modifiedNodeParent = modifiedNode; for(ASTModification currentModification : modificationsForNode){ if(currentModification.getKind() != ASTModification.ModificationKind.APPEND_CHILD){ modifiedNodeParent = modifiedNode.getParent(); break; } } modifiedNodeParent = modifiedNodeParent != null ? modifiedNodeParent : modifiedNode; return modifiedNodeParent; } @Override public int visit(IASTTranslationUnit translationUnit) { if (hasChangedChild(translationUnit)) { synthTreatment(translationUnit); } IASTFileLocation location = getFileLocationOfEmptyTranslationUnit(translationUnit); sourceOffsets.put(location.getFileName(), Integer.valueOf(location.getNodeOffset())); return super.visit(translationUnit); } /** * This is a Workaround for a known but not jet solved Problem in IASTNode. If you get the FileFocation of a translationUnit * that was built on an empty file you will get null because there it explicitly returns null if the index and length is 0. * To get to the Filename and other information, the location is never the less needed. * @param node * @return a hopefully "unnull" FileLocation */ public IASTFileLocation getFileLocationOfEmptyTranslationUnit(IASTNode node) { IASTFileLocation fileLocation = node.getFileLocation(); if (fileLocation == null) { ILocationResolver lr = (ILocationResolver) node.getTranslationUnit().getAdapter(ILocationResolver.class); if (lr != null) { fileLocation = lr.getMappedFileLocation(0, 0); } else { // support for old location map fileLocation = node.getTranslationUnit().flattenLocationsToFile(node.getNodeLocations()); } } return fileLocation; } @Override public int leave(IASTTranslationUnit tu) { return super.leave(tu); } private int getOffsetForNodeFile(IASTNode rootNode) { Integer offset = sourceOffsets.get(rootNode.getFileLocation() .getFileName()); return offset == null ? 0 : offset.intValue(); } @Override public int visit(IASTDeclaration declaration) { if (hasChangedChild(declaration)) { synthTreatment(declaration); return ASTVisitor.PROCESS_SKIP; } return super.visit(declaration); } private void synthTreatment(IASTNode synthNode) { synthTreatment(synthNode, null); } private void synthTreatment(IASTNode synthNode, String fileScope) { String indent = getIndent(synthNode); ASTWriter synthWriter = new ASTWriter(indent); synthWriter.setModificationStore(modificationStore); String synthSource = synthWriter.write(synthNode, fileScope, commentMap); reformatSynthCode(synthNode, synthSource); /*XXX resultat wird nicht verwendet?*/ int newOffset = synthNode.getFileLocation().getNodeOffset() + synthNode.getFileLocation().getNodeLength(); sourceOffsets.put(synthNode.getFileLocation().getFileName(), Integer.valueOf(newOffset)); } private void synthTreatment(IASTTranslationUnit synthTU) { ASTWriter synthWriter = new ASTWriter(); synthWriter.setModificationStore(modificationStore); for (ASTModification modification : modificationParent.get(synthTU)) { IASTFileLocation targetLocation; targetLocation = getFileLocationOfEmptyTranslationUnit(modification.getTargetNode()); String currentFile = targetLocation.getFileName(); IPath implPath = new Path(currentFile); IFile relevantFile = ResourcesPlugin.getWorkspace().getRoot() .getFileForLocation(implPath); MultiTextEdit edit; if (changes.containsKey(relevantFile)) { edit = changes.get(relevantFile); } else { edit = new MultiTextEdit(); changes.put(relevantFile, edit); } String newNodeCode = synthWriter.write(modification.getNewNode(), null, commentMap); switch (modification.getKind()) { case REPLACE: edit.addChild(new ReplaceEdit(targetLocation.getNodeOffset(), targetLocation.getNodeLength(), newNodeCode)); break; case INSERT_BEFORE: edit.addChild(new InsertEdit(getOffsetIncludingComments(modification.getTargetNode()), newNodeCode)); break; case APPEND_CHILD: String lineDelimiter = FileHelper.determineLineDelimiter(FileHelper.getIFilefromIASTNode(modification.getTargetNode())); edit.addChild(new InsertEdit(targetLocation.getNodeOffset() + targetLocation.getNodeLength(),lineDelimiter + lineDelimiter + newNodeCode)); break; } } } private String reformatSynthCode(IASTNode synthNode, String synthSource) { IFile relevantFile = FileHelper.getIFilefromIASTNode(synthNode); StringBuilder formattedCode = new StringBuilder(); String originalCode = originalCodeOfNode(synthNode); CodeComparer codeComparer = new CodeComparer(originalCode, synthSource); int lastCommonPositionInOriginalCode = codeComparer .getLastCommonPositionInOriginalCode(); if (lastCommonPositionInOriginalCode > -1) { formattedCode.append(originalCode.substring(0, lastCommonPositionInOriginalCode + 1)); } int lastCommonPositionInSynthCode = codeComparer .getLastCommonPositionInSynthCode(); int firstPositionOfCommonEndInSynthCode = codeComparer .getFirstPositionOfCommonEndInSynthCode(lastCommonPositionInSynthCode, lastCommonPositionInOriginalCode); int firstPositionOfCommonEndInOriginalCode = codeComparer .getFirstPositionOfCommonEndInOriginalCode(lastCommonPositionInOriginalCode, lastCommonPositionInSynthCode); if (firstPositionOfCommonEndInSynthCode == -1) { formattedCode.append(synthSource .substring(lastCommonPositionInSynthCode + 1)); } else { if (lastCommonPositionInSynthCode + 1 < firstPositionOfCommonEndInSynthCode) { formattedCode.append(synthSource.substring( lastCommonPositionInSynthCode + 1, firstPositionOfCommonEndInSynthCode)); } } if (firstPositionOfCommonEndInOriginalCode > -1) { formattedCode.append(originalCode .substring(firstPositionOfCommonEndInOriginalCode)); } MultiTextEdit edit; if (changes.containsKey(relevantFile)) { edit = changes.get(relevantFile); } else { edit = new MultiTextEdit(); changes.put(relevantFile, edit); } codeComparer.createChange(edit, synthNode); return formattedCode.toString(); } public String originalCodeOfNode(IASTNode node) { if (node.getFileLocation() != null) { IFile sourceFile = FileHelper.getIFilefromIASTNode(node); int nodeOffset = getOffsetIncludingComments(node); int nodeLength = getNodeLengthIncludingComments(node); return FileContentHelper.getContent(sourceFile, nodeOffset, nodeLength); } return null; } private int getNodeLengthIncludingComments(IASTNode node) { int nodeOffset = node.getFileLocation().getNodeOffset(); int nodeLength = node.getFileLocation().getNodeLength(); ArrayList<IASTComment> comments = commentMap.getAllCommentsForNode(node); if(!comments.isEmpty()) { int startOffset = nodeOffset; int endOffset = nodeOffset + nodeLength; for(IASTComment comment : comments) { IASTFileLocation commentLocation = comment.getFileLocation(); if(commentLocation.getNodeOffset() < startOffset) { startOffset = commentLocation.getNodeOffset(); } if(commentLocation.getNodeOffset() + commentLocation.getNodeLength() >= endOffset) { endOffset = commentLocation.getNodeOffset() + commentLocation.getNodeLength(); } } nodeLength = endOffset - startOffset; } return nodeLength; } private int getOffsetIncludingComments(IASTNode node) { int nodeOffset = node.getFileLocation().getNodeOffset(); ArrayList<IASTComment> comments = commentMap.getAllCommentsForNode(node); if(!comments.isEmpty()) { int startOffset = nodeOffset; for(IASTComment comment : comments) { IASTFileLocation commentLocation = comment.getFileLocation(); if(commentLocation.getNodeOffset() < startOffset) { startOffset = commentLocation.getNodeOffset(); } } nodeOffset = startOffset; } return nodeOffset; } private String getIndent(IASTNode nextNode) { IASTFileLocation fileLocation = nextNode.getFileLocation(); int length = fileLocation.getNodeOffset() - getOffsetForNodeFile(nextNode); String originalSource = FileContentHelper.getContent(FileHelper .getIFilefromIASTNode(nextNode), getOffsetForNodeFile(nextNode), length); StringBuilder indent = new StringBuilder(originalSource); indent.reverse(); String lastline = indent .substring(0, Math.max(indent.indexOf("\n"), 0)); //$NON-NLS-1$ if (lastline.trim().length() == 0) { return lastline; } return ""; //$NON-NLS-1$ } private boolean hasChangedChild(IASTNode parent) { return modificationParent.containsKey(parent); } @Override public int visit(IASTDeclarator declarator) { if (hasChangedChild(declarator)) { synthTreatment(declarator); return ASTVisitor.PROCESS_SKIP; } return super.visit(declarator); } @Override public int visit(ICPPASTNamespaceDefinition namespaceDefinition) { if(hasChangedChild(namespaceDefinition)){ synthTreatment(namespaceDefinition); return ASTVisitor.PROCESS_SKIP; } return super.visit(namespaceDefinition); } @Override public int visit(IASTDeclSpecifier declSpec) { if (hasChangedChild(declSpec)) { synthTreatment(declSpec); return ASTVisitor.PROCESS_SKIP; } return super.visit(declSpec); } @Override public int visit(IASTExpression expression) { if (hasChangedChild(expression)) { synthTreatment(expression); return ASTVisitor.PROCESS_SKIP; } return super.visit(expression); } @Override public int visit(IASTInitializer initializer) { if (hasChangedChild(initializer)) { synthTreatment(initializer); return ASTVisitor.PROCESS_SKIP; } return super.visit(initializer); } @Override public int visit(IASTName name) { if (hasChangedChild(name)) { synthTreatment(name); return ASTVisitor.PROCESS_SKIP; } return super.visit(name); } @Override public int visit(IASTParameterDeclaration parameterDeclaration) { if (hasChangedChild(parameterDeclaration)) { synthTreatment(parameterDeclaration); return ASTVisitor.PROCESS_SKIP; } return super.visit(parameterDeclaration); } @Override public int visit(IASTStatement statement) { if (hasChangedChild(statement)) { synthTreatment(statement); return ASTVisitor.PROCESS_SKIP; } return super.visit(statement); } class CodeComparer { private final StringBuilder originalCode; private final StringBuilder synthCode; public CodeComparer(String originalCode, String synthCode) { this.originalCode = new StringBuilder(originalCode); this.synthCode = new StringBuilder(synthCode); } public int getLastCommonPositionInSynthCode() { int lastCommonPosition = -1; int originalCodePosition = -1; int synthCodePosition = -1; do { lastCommonPosition = synthCodePosition; originalCodePosition = nextInterrestingPosition(originalCode, originalCodePosition); synthCodePosition = nextInterrestingPosition(synthCode, synthCodePosition); } while (originalCodePosition > -1 && synthCodePosition > -1 && originalCode.charAt(originalCodePosition) == synthCode .charAt(synthCodePosition)); return lastCommonPosition; } public int getLastCommonPositionInOriginalCode() { int lastCommonPosition = -1; int originalCodePosition = -1; int synthCodePosition = -1; do { lastCommonPosition = originalCodePosition; originalCodePosition = nextInterrestingPosition(originalCode, originalCodePosition); synthCodePosition = nextInterrestingPosition(synthCode, synthCodePosition); } while (originalCodePosition > -1 && synthCodePosition > -1 && originalCode.charAt(originalCodePosition) == synthCode .charAt(synthCodePosition)); return lastCommonPosition; } public int getFirstPositionOfCommonEndInOriginalCode(int originalLimit, int synthLimit) { int lastCommonPosition = -1; int originalCodePosition = -1; int synthCodePosition = -1; StringBuilder reverseOriginalCode = new StringBuilder(originalCode) .reverse(); StringBuilder reverseSynthCode = new StringBuilder(synthCode) .reverse(); do { lastCommonPosition = originalCodePosition; originalCodePosition = nextInterrestingPosition( reverseOriginalCode, originalCodePosition); synthCodePosition = nextInterrestingPosition(reverseSynthCode, synthCodePosition); } while (originalCodePosition > -1 && originalCodePosition < originalCode.length() - originalLimit && synthCodePosition > -1 && synthCodePosition < synthCode.length() - synthLimit && reverseOriginalCode.charAt(originalCodePosition) == reverseSynthCode .charAt(synthCodePosition)); if (lastCommonPosition < 0 || lastCommonPosition >= originalCode.length()) { return -1; } return originalCode.length() - lastCommonPosition; } public int getFirstPositionOfCommonEndInSynthCode(int limmit, int lastCommonPositionInOriginal) { int lastCommonPosition = 0; int originalCodePosition = -1; int synthCodePosition = -1; int korOffset = 0; StringBuilder reverseOriginalCode = new StringBuilder(originalCode) .reverse(); StringBuilder reverseSynthCode = new StringBuilder(synthCode) .reverse(); do { if (lastCommonPosition >= 0 && lastCommonPositionInOriginal >= 0 && originalCode.charAt(lastCommonPositionInOriginal - korOffset) == reverseSynthCode .charAt(lastCommonPosition)) { ++korOffset; } else { korOffset = 0; } lastCommonPosition = synthCodePosition; originalCodePosition = nextInterrestingPosition( reverseOriginalCode, originalCodePosition); synthCodePosition = nextInterrestingPosition(reverseSynthCode, synthCodePosition); } while (originalCodePosition > -1 && originalCodePosition < originalCode.length() - lastCommonPositionInOriginal && synthCodePosition > -1 && synthCodePosition < synthCode.length() - limmit && reverseOriginalCode.charAt(originalCodePosition) == reverseSynthCode .charAt(synthCodePosition)); if (lastCommonPosition < 0 || lastCommonPosition >= synthCode.length()) { return -1; } if (korOffset > 0) { --korOffset; } return synthCode.length() - lastCommonPosition + korOffset; } private int nextInterrestingPosition(StringBuilder code, int position) { do { position++; if (position >= code.length()) { return -1; } } while (isUninterresting(code, position)); return position; } private boolean isUninterresting(StringBuilder code, int position) { switch (code.charAt(position)) { case ' ': case '\n': case '\r': case '\t': return true; default: return false; } } protected void createChange(MultiTextEdit edit, IASTNode changedNode) { int changeOffset = getOffsetIncludingComments(changedNode); TextEditGroup editGroup = new TextEditGroup(Messages.ChangeGenerator_group); for (ASTModification currentModification : modificationParent .get(changedNode)) { if (currentModification.getAssociatedEditGroup() != null) { editGroup = currentModification.getAssociatedEditGroup(); edit.addChildren(editGroup.getTextEdits()); break; } } createChange(edit, changeOffset); } private void createChange(MultiTextEdit edit, int changeOffset) { int lastCommonPositionInOriginal = getLastCommonPositionInOriginalCode(); int lastCommonPositionInSynth = getLastCommonPositionInSynthCode(); int firstOfCommonEndInOriginal = getFirstPositionOfCommonEndInOriginalCode(lastCommonPositionInOriginal, lastCommonPositionInSynth); int firstOfCommonEndInSynth = getFirstPositionOfCommonEndInSynthCode( lastCommonPositionInSynth, lastCommonPositionInOriginal); int i = (firstOfCommonEndInSynth >= 0 ? firstOfCommonEndInOriginal : originalCode.length()) - lastCommonPositionInOriginal; if (i <= 0) { String insertCode = synthCode.substring( lastCommonPositionInSynth, firstOfCommonEndInSynth); InsertEdit iEdit = new InsertEdit(changeOffset + lastCommonPositionInOriginal, insertCode); edit.addChild(iEdit); } else if ((firstOfCommonEndInSynth >= 0 ? firstOfCommonEndInSynth : synthCode.length()) - lastCommonPositionInSynth <= 0) { int correction = 0; if (lastCommonPositionInSynth > firstOfCommonEndInSynth) { correction = lastCommonPositionInSynth - firstOfCommonEndInSynth; } DeleteEdit dEdit = new DeleteEdit(changeOffset + lastCommonPositionInOriginal, firstOfCommonEndInOriginal - lastCommonPositionInOriginal + correction); edit.addChild(dEdit); } else { String replacementCode = getReplacementCode( lastCommonPositionInSynth, firstOfCommonEndInSynth); ReplaceEdit rEdit = new ReplaceEdit( changeOffset + Math.max(lastCommonPositionInOriginal, 0), (firstOfCommonEndInOriginal >= 0 ? firstOfCommonEndInOriginal : originalCode.length()) - Math.max(lastCommonPositionInOriginal, 0), replacementCode); edit.addChild(rEdit); } } private String getReplacementCode(int lastCommonPositionInSynth, int firstOfCommonEndInSynth) { int replacementStart = Math.max(lastCommonPositionInSynth, 0); int replacementEnd = (firstOfCommonEndInSynth >= 0 ? firstOfCommonEndInSynth : synthCode.length()); if (replacementStart < replacementEnd) { return synthCode.substring(replacementStart, replacementEnd); } return ""; //$NON-NLS-1$ } } public Change getChange() { return change; } }
178c0d9cff11a04a17e7648827be7bd3b8ec9df5
cb303468171b2d67b98dbcf0b47fe894d1daeeaf
/src/main/java/future/Test.java
ddb0ddd0e23d07983142f27e0b134231fe147e40
[]
no_license
InkInn/snail
b46d192afb7664e3c5408296dea5ba90f00bcdcb
c58ada0cb76e5146ee9bfb7a4861d0d630285de7
refs/heads/master
2022-12-21T13:28:59.221954
2020-06-21T03:06:34
2020-06-21T03:06:34
144,343,838
0
0
null
null
null
null
UTF-8
Java
false
false
4,614
java
package future; import bean.AlbumInfo; import bean.ResultInfo; import bean.TrackInfo; import bean.UserInfo; import java.time.Duration; import java.util.Arrays; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; public class Test { public static void main(String[] args) throws InterruptedException, TimeoutException, ExecutionException { // // 步骤1 // // ...... // // // 步骤2.1 // ResultInfo resultInfo = new ResultInfo(); // CompletableFuture<TrackInfo> trackInfoFuture = getTrackInfo(11111L, "声音",resultInfo); // CompletableFuture<AlbumInfo> albumInfoFuture = getAlbumInfo(22222L, "专辑",resultInfo); // CompletableFuture<UserInfo> userInfoFuture = getUserInfo(33333L, "小明",resultInfo); //// CompletableFuture<ResultInfo> resultInfoFuture = trackInfoFuture.thenCombine(albumInfoFuture, (trackInfo, albumInfo) -> { //// System.out.println("combine1 " + Thread.currentThread().getName()); //// ResultInfo resultInfo = new ResultInfo(); //// resultInfo.setAlbumInfo(albumInfo); //// resultInfo.setTrackInfo(trackInfo); //// return resultInfo; //// }).thenCombineAsync(userInfoFuture, (resultInfo, userInfo) -> { //// System.out.println("combine2 " + Thread.currentThread().getName()); //// resultInfo.setUserInfo(userInfo); //// return resultInfo; //// }); // CompletableFuture.allOf(trackInfoFuture,albumInfoFuture,userInfoFuture).get(1000,TimeUnit.MILLISECONDS); // //// System.out.println(albumInfoFuture.join()); //// Thread.sleep(3000); // // // 步骤2.2 // // // 步骤2.3 // // // 步骤3 // // .... //// ResultInfo resultInfo = resultInfoFuture.get(1000, TimeUnit.MILLISECONDS); // System.out.println(JSON.toJSONString(resultInfo)); Arrays.asList(2,3).add(1); } private static CompletableFuture<ResultInfo> getResultInfo() { return CompletableFuture.supplyAsync(() -> { ResultInfo resultInfo = new ResultInfo(); return resultInfo; }); } private static CompletableFuture<TrackInfo> getTrackInfo(long trackId, String trackName,ResultInfo resultInfo) { return CompletableFuture.supplyAsync(() -> { TrackInfo trackInfo = new TrackInfo(); trackInfo.setTrackId(trackId); trackInfo.setTrackName(trackName); resultInfo.setTrackInfo(trackInfo); return trackInfo; }); } private static CompletableFuture<UserInfo> getUserInfo(long userId, String userName,ResultInfo resultInfo) { return CompletableFuture.supplyAsync(() -> { UserInfo userInfo = new UserInfo(); userInfo.setUserId(userId); userInfo.setUserName(userName); resultInfo.setUserInfo(userInfo); return userInfo; }); } private static CompletableFuture<AlbumInfo> getAlbumInfo(long albumId, String albumName,ResultInfo resultInfo) { return CompletableFuture.supplyAsync(() -> { try { return CompletableFuture.supplyAsync(() -> { AlbumInfo albumInfo = new AlbumInfo(); albumInfo.setAlbumId(albumId); albumInfo.setAlbumName(albumName); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } resultInfo.setAlbumInfo(albumInfo); return albumInfo; }).get(1000, TimeUnit.MILLISECONDS); } catch (Exception e) { // e.printStackTrace(); } return null; }); } private static CompletableFuture<AlbumInfo> getAlbumInfo2(long albumId, String albumName) { CompletableFuture<AlbumInfo> future = CompletableFuture.supplyAsync(() -> { AlbumInfo albumInfo = new AlbumInfo(); albumInfo.setAlbumId(albumId); albumInfo.setAlbumName(albumName); try { Thread.sleep(2000); } catch (InterruptedException e) { e.printStackTrace(); } return albumInfo; }); return FutureUtils.within(future, Duration.ofMillis(100)).exceptionally(e -> { return null; }); } }
1db91ece22b5918fc5d2d73564232d511dbf55da
c023c443c53cfe4206242265c2df0ac1d168aff9
/src/main/java/lucas/introjava/Ejercicio8.java
b3c8b7317a663fac9f1201d1a9357980bb68d174
[]
no_license
Mariana-Saubidet/Java-Egg
1dcb13eff7653173ee570fae4057e1a097816982
c0d5d7cfbe44245fdd6523a3b2faa1a96da70ed0
refs/heads/main
2023-06-18T06:20:10.199070
2021-07-15T18:09:27
2021-07-15T18:09:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package lucas.introjava; import java.util.Scanner; public class Ejercicio8 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.println("Ingrese un numero"); double numero = scan.nextDouble(); scan.close(); if (numero % 2 == 0) { System.out.println("El numero " + numero + " es par"); } else { System.out.println("El numero " + numero + " es impar"); } } }
b6711859ef4b2fa6508c1cf36f5ba8a30ed5a4eb
5105b9280079c882c26835872805469b974f1f2b
/src/main/java/feed/ImageInformation.java
b5c67c1896b5dbf2333e99d7516ca116053664f3
[]
no_license
ZarinaBozhyk/thefeedfeed_api_framework1
e1cb3d1fa6d7045e6bb9c73b9d1fa6738479769b
ce7d0a061b6391204afcf70dae90bb1cad8c3bf1
refs/heads/master
2021-07-08T06:59:48.005579
2020-08-18T09:48:07
2020-08-18T09:48:07
244,440,469
0
0
null
2021-06-07T18:42:04
2020-03-02T18:07:56
JavaScript
UTF-8
Java
false
false
419
java
package feed; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; @Data @JsonIgnoreProperties(ignoreUnknown = true) public class ImageInformation { @JsonProperty("created_at") private String createdAt; String description; String name; String rating; @JsonProperty("updated_at") private String updatedAt; }
106b38cd082dff04dbf32bf903a25cb0391a3d40
e58a321ab122cfa44bb7482edef923a5fb12a5e7
/src/main/java/cm/inet/Web/EmployeController.java
fe6893eb3686b55e35fbc1fd357f996d9ec2978a
[]
no_license
FranckLibaski/gestionDepartement
34f68fb8349b0252149363992aec13b86496fa94
3c784abc36fbedff3f80c569094fea25202387e3
refs/heads/main
2023-04-16T12:32:01.626492
2021-04-23T13:31:19
2021-04-23T13:31:19
360,893,705
0
0
null
null
null
null
UTF-8
Java
false
false
1,598
java
package cm.inet.Web; import cm.inet.Entities.Employe; import cm.inet.Entities.UpdateEmploye; import cm.inet.Services.EmployeReport; import cm.inet.Services.EmployeService; import net.sf.jasperreports.engine.JRException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.io.FileNotFoundException; import java.util.List; @RestController @CrossOrigin("*") @RequestMapping(value = "/employe") public class EmployeController { @Autowired private EmployeService employeService; @Autowired private EmployeReport employeReport; @GetMapping public List<Employe> get() { return employeService.getEmployes(); } @PostMapping public Employe post(@RequestBody Employe employe) { return employeService.createEmploye(employe); } @GetMapping(value = "/{id}") public Employe getById(@PathVariable("id") Long id) { return employeService.getEmployeById(id); } @DeleteMapping(value = "/{id}") public Employe delete(@PathVariable("id") Long id) { return employeService.deleteEmploye(id); } @RequestMapping(value = "/{id}", method = RequestMethod.PUT) public Employe put(@PathVariable("id") Long id, @RequestBody UpdateEmploye updateEmploye) { return employeService.updateEmploye(id, updateEmploye); } @GetMapping(value = "/report/{format}") public String reportGenerate(@PathVariable("format") String format) throws FileNotFoundException, JRException { return employeReport.exportReport(format); } }
db5a1f9b67986ce8a6f64b390e08d058bf055f02
30b2eba9a7b563509fff637e10b8879c10657a76
/web/box-front/src/main/java/com/boxamazing/webfront/util/CheckCode.java
53c91a82381382a77062d7578504e63f0bf9757c
[]
no_license
hecj/box
73f60c11c293cac4a66b9b0b33ba79ff5aadfc2d
e59cc1cceb238b1a6d5b35ae8a98b68b7da5918f
refs/heads/master
2020-09-24T06:11:08.248173
2016-08-25T05:55:48
2016-08-25T05:55:48
66,528,932
0
0
null
null
null
null
UTF-8
Java
false
false
1,354
java
package com.boxamazing.webfront.util; import java.io.Serializable; /** * 存验证码的VO对象 */ public class CheckCode implements Serializable { private static final long serialVersionUID = 1L; /** * 手机验证码session key */ public static final String PHONE_CODE = "PHONE_CODE"; /** * 邮箱验证码session key */ public static final String EMAIL_CODE = "EMAIL_CODE"; /** * 用户id */ private Long user_id; /** * 验证码 */ private String randomCode ; /** * 手机号 */ private String phone; /** * 邮箱 */ private String email; /** * 发送时间 */ private Long sendTime; public Long getUser_id() { return user_id; } public void setUser_id(Long user_id) { this.user_id = user_id; } public String getRandomCode() { return randomCode; } public void setRandomCode(String randomCode) { this.randomCode = randomCode; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Long getSendTime() { return sendTime; } public void setSendTime(Long sendTime) { this.sendTime = sendTime; } }
d8845e7f557efe481e0aab0d47dc06fee1219f8d
8a8227bf09da277a123d0e808a6b31c2a4c9bf7a
/app/src/main/java/com/liteafrica/izigourmet/Requests/listOrdersRv.java
494746ab19ab88499ce1f40f5c364e97b13f0f2b
[]
no_license
Bbox12/IziGourmet
051d267ad5d5900eff5470d672af08d20075d97e
f93bcd4cb87c4c115f446a4f74de046fae99e595
refs/heads/main
2023-06-18T18:07:51.486621
2021-07-16T09:33:39
2021-07-16T09:33:39
379,111,219
0
0
null
null
null
null
UTF-8
Java
false
false
15,167
java
package com.liteafrica.izigourmet.Requests; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.graphics.Typeface; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.Button; import android.widget.TextView; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.recyclerview.widget.DefaultItemAnimator; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.android.volley.AuthFailureError; import com.android.volley.NetworkError; import com.android.volley.NoConnectionError; import com.android.volley.ParseError; import com.android.volley.Response; import com.android.volley.ServerError; import com.android.volley.TimeoutError; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.StringRequest; import com.google.android.material.snackbar.Snackbar; import com.liteafrica.izigourmet.Adapters.BookingAdapter; import com.liteafrica.izigourmet.AppController; import com.liteafrica.izigourmet.Model.Foods; import com.liteafrica.izigourmet.Model.User; import com.liteafrica.izigourmet.R; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.text.DecimalFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; public class listOrdersRv extends BaseExpandableListAdapter { SimpleDateFormat sdf = new SimpleDateFormat("hh:mm aa", Locale.US); SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss"); private Context _context; private List<String> _listDataHeader; // header titles private HashMap<String, ArrayList<User>> _listDataChild; private TextView laterDate, laterTime; private RecyclerView morerv; private Button details; private com.liteafrica.izigourmet.PrefManager pref; private CoordinatorLayout coordinatorLayout; public listOrdersRv(Context context, List<String> listDataHeader, HashMap<String, ArrayList<User>> listChildData) { this._context = context; this._listDataHeader = listDataHeader; this._listDataChild = listChildData; } @Override public Object getChild(int groupPosition, int childPosititon) { return this._listDataChild.get(this._listDataHeader.get(groupPosition)) .get(childPosititon); } @Override public long getChildId(int groupPosition, int childPosition) { return childPosition; } @Override public View getChildView(int groupPosition, final int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { final User album_pos = (User) getChild(groupPosition, childPosition); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.later_rv, null); } laterDate = convertView.findViewById(R.id.ride_date_later); laterTime = convertView.findViewById(R.id.ride_time_later); morerv = convertView.findViewById(R.id.moreRv); details = convertView.findViewById(R.id.details); DecimalFormat dft = new DecimalFormat("0.00"); Calendar cal = Calendar.getInstance(); TextView _status = convertView.findViewById(R.id.status); if (album_pos.getDelivered(childPosition) == 0) { _status.setText("Pending"); } if (album_pos.getDelivered(childPosition) == 1) { _status.setText("Accepted"); } if (album_pos.getDelivered(childPosition) == 2) { _status.setText("Confirmed"); } if (album_pos.getDelivered(childPosition) == 3) { _status.setText("ETA updated"); } if (album_pos.getDelivered(childPosition) == 4) { _status.setText("Dispatched"); } if (album_pos.getDelivered(childPosition) == 5) { _status.setText("Delivered"); } if (album_pos.getDelivered(childPosition) == 6) { _status.setText("Canceled"); } TextView pending = convertView.findViewById(R.id.pending); if (album_pos.getPaymentMode(childPosition) == 1) { if (album_pos.getIs_Paid(childPosition) == 1) { pending.setText(" COD, PAID"); } } else if (album_pos.getPaymentMode(childPosition) == 2) { if (album_pos.getPaymentVerified(childPosition) == 0) { pending.setText("EFT PAYMENT PENDING"); } else { pending.setText("EFT PAYMENT DONE"); } } if (album_pos.getPaymentMode(childPosition) == 0) { pending.setText("PAYMENT NOT SELECTED"); } if (!TextUtils.isEmpty(album_pos.getEnd_date(childPosition)) && !album_pos.getEnd_date(childPosition).contains("null")) { String date_ = parseDateToddMMyyyy(album_pos.getEnd_date(childPosition)); laterDate.setText(date_); } else { laterDate.setVisibility(View.GONE); } if (!TextUtils.isEmpty(album_pos.getEnd_time(childPosition))) { try { Date date = format.parse(album_pos.getEnd_time(childPosition)); cal.setTime(date); laterTime.setText("At " + sdf.format(cal.getTime())); } catch (ParseException e) { e.printStackTrace(); } } else { laterTime.setVisibility(View.GONE); } go(_context, album_pos.getOrderID(childPosition), morerv); details.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent o = new Intent(_context, OrderDashboard.class); o.putExtra("unique", album_pos.getOrderID(childPosition)); _context.startActivity(o); ((Activity) _context).overridePendingTransition(R.anim.slide_up1, R.anim.rbounce); } }); return convertView; } @Override public int getChildrenCount(int groupPosition) { return this._listDataChild.get(this._listDataHeader.get(groupPosition)) .size(); } @Override public Object getGroup(int groupPosition) { return this._listDataHeader.get(groupPosition); } @Override public int getGroupCount() { return this._listDataHeader.size(); } @Override public long getGroupId(int groupPosition) { return groupPosition; } @Override public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { String headerTitle = (String) getGroup(groupPosition); if (convertView == null) { LayoutInflater infalInflater = (LayoutInflater) this._context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = infalInflater.inflate(R.layout.list_group, null); } TextView lblListHeader = convertView .findViewById(R.id.lblListHeader); lblListHeader.setTypeface(null, Typeface.BOLD); lblListHeader.setText(headerTitle); return convertView; } @Override public boolean hasStableIds() { return false; } @Override public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } public String parseDateToddMMyyyy(String time) { String inputPattern = "yyyy-MM-dd"; String outputPattern = "dd MMM yy"; SimpleDateFormat inputFormat = new SimpleDateFormat(inputPattern); SimpleDateFormat outputFormat = new SimpleDateFormat(outputPattern); Date date = null; String str = null; try { date = inputFormat.parse(time); str = outputFormat.format(date); } catch (ParseException e) { e.printStackTrace(); } return str; } public void setPref(com.liteafrica.izigourmet.PrefManager pref1) { pref = pref1; } public void setCoordinatorlayout(CoordinatorLayout coordinatorLayout1) { coordinatorLayout = coordinatorLayout1; } private void go(final Context mContext, final String itemmenu, final RecyclerView hadapter1) { final ArrayList<Foods> mItems = new ArrayList<Foods>(); StringRequest eventoReq = new StringRequest(com.android.volley.Request.Method.POST, com.liteafrica.izigourmet.Config_URL.GET_FOODSS, new Response.Listener<String>() { @Override public void onResponse(String response) { Log.e("submenu", response); try { JSONObject jsonObj = new JSONObject(response); JSONArray Eat = jsonObj.getJSONArray("bookings"); if (Eat.length() != 0) { for (int i = 0; i < Eat.length(); i++) { JSONObject c = Eat.getJSONObject(i); if (!c.isNull("Price")) { Foods items = new Foods(); items.setID(c.getInt("ID")); items.setNoofItems(c.getInt("NoofItems")); items.seteTEZ_Price((c.getInt("NoofItems") * c.getDouble("Price")) - (c.getInt("NoofItems") * c.getDouble("Discount"))); items.setDiscount(c.getDouble("Discount")); items.setMenu_Name(c.getString("Name")); mItems.add(items); } } } } catch (final JSONException e) { Log.e("HI", "Json parsing error: " + e.getMessage()); } BookingAdapter sAdapter1 = new BookingAdapter(mContext, mItems); sAdapter1.notifyDataSetChanged(); sAdapter1.setPref(pref); sAdapter1.setFrom(1); LinearLayoutManager mLayoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false); hadapter1.setLayoutManager(mLayoutManager); hadapter1.setItemAnimator(new DefaultItemAnimator()); hadapter1.setAdapter(sAdapter1); hadapter1.setHasFixedSize(true); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { VolleyLog.d("uuu", "Error: " + error.getMessage()); if (error instanceof TimeoutError || error instanceof NoConnectionError) { Snackbar snackbar = Snackbar .make(coordinatorLayout, "Network is unreachable. Please try another time", Snackbar.LENGTH_INDEFINITE) .setAction("Refresh", new View.OnClickListener() { @Override public void onClick(View view) { } }); snackbar.setActionTextColor(Color.RED); snackbar.setTextColor(Color.WHITE); snackbar.show(); } else if (error instanceof AuthFailureError) { Snackbar snackbar = Snackbar .make(coordinatorLayout, "Network is unreachable. Please try another time", Snackbar.LENGTH_INDEFINITE) .setAction("Refresh", new View.OnClickListener() { @Override public void onClick(View view) { } }); snackbar.setActionTextColor(Color.RED); snackbar.setTextColor(Color.WHITE); snackbar.show(); } else if (error instanceof ServerError) { Snackbar snackbar = Snackbar .make(coordinatorLayout, "Server Error.Please try another time", Snackbar.LENGTH_INDEFINITE) .setAction("Refresh", new View.OnClickListener() { @Override public void onClick(View view) { } }); snackbar.setActionTextColor(Color.RED); snackbar.setTextColor(Color.WHITE); snackbar.show(); } else if (error instanceof NetworkError) { Snackbar snackbar = Snackbar .make(coordinatorLayout, "Network Error. Please try another time", Snackbar.LENGTH_INDEFINITE) .setAction("Refresh", new View.OnClickListener() { @Override public void onClick(View view) { } }); snackbar.setActionTextColor(Color.RED); snackbar.setTextColor(Color.WHITE); snackbar.show(); } else if (error instanceof ParseError) { Snackbar snackbar = Snackbar .make(coordinatorLayout, "Data Error. Please try another time", Snackbar.LENGTH_INDEFINITE) .setAction("Refresh", new View.OnClickListener() { @Override public void onClick(View view) { } }); snackbar.setActionTextColor(Color.RED); snackbar.setTextColor(Color.WHITE); snackbar.show(); } } }) { @Override protected Map<String, String> getParams() { Map<String, String> params = new HashMap<String, String>(); params.put("submenu", itemmenu); return params; } }; AppController.getInstance().addToRequestQueue(eventoReq); } }
70f37682f9bd41dfa7f21debe58fd3f7f636c514
0b9a1c2ddab3fb4bad58dfa4a0dc1c6df339c87e
/src/main/java/com/rejoice/blog/bean/http/ebook300/DownloadUrlInput.java
e805f1516d145ee2ca09afe26a65c619ba090b59
[]
no_license
rejoiceFromJesus/rejoice-blog
1b080dcfed458634cb01d7d23c87ca57f2f6a3b7
a72a4723360c931b8d8c3c84fc6dc4cfa92bd212
refs/heads/master
2020-03-11T22:48:37.487462
2019-01-21T14:20:17
2019-01-21T14:20:17
108,060,680
0
0
null
null
null
null
UTF-8
Java
false
false
666
java
package com.rejoice.blog.bean.http.ebook300; public class DownloadUrlInput { private String op = "download2"; private String id; private String rand; private String down_script = "1"; public String getOp() { return op; } public void setOp(String op) { this.op = op; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getRand() { return rand; } public void setRand(String rand) { this.rand = rand; } public String getDown_script() { return down_script; } public void setDown_script(String down_script) { this.down_script = down_script; } }
4b1e10abbb31c2a0c01a94af4bdeb9f6cbd3c420
2ca2693f5de468fc5ef0eeea4bfd34b12b32393a
/src/cn/lgx/yougou/fragment/FenLeiFragment.java
6dbf009b245f6ad5f90beaac26e752ad4bc9aa69
[]
no_license
digideskio/yougou
b925dda1d794d7875e46d60340584ab7cbfe0b77
05b9ce1e64ddd7505e2e2090069f76dee1430da5
refs/heads/master
2021-01-12T09:18:32.331385
2016-04-05T12:33:12
2016-04-05T12:33:12
null
0
0
null
null
null
null
GB18030
Java
false
false
5,291
java
package cn.lgx.yougou.fragment; import java.util.ArrayList; import java.util.List; import com.lidroid.xutils.ViewUtils; import com.lidroid.xutils.view.annotation.ViewInject; import com.lidroid.xutils.view.annotation.event.OnClick; import android.annotation.SuppressLint; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import cn.bmob.v3.BmobQuery; import cn.bmob.v3.listener.FindListener; import cn.lgx.yougou.FenLeiActivity; import cn.lgx.yougou.R; import cn.lgx.yougou.ShowGoodsListActivity; import cn.lgx.yougou.application.MyApplication; import cn.lgx.yougou.base.BaseFragment; import cn.lgx.yougou.base.BaseInterface; import cn.lgx.yougou.bean.GoodsBean; import cn.lgx.yougou.utils.DialogUtils; import cn.lgx.yougou.utils.TextUtils; public class FenLeiFragment extends BaseFragment implements BaseInterface { private String numberkey =""; @ViewInject(R.id.fragment_fenlei_et) private EditText etinfo; @SuppressLint("InflateParams") @Override public View getfragmentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_fenlei, null); ViewUtils.inject(this, view); return view; } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); initViews(); initDatas(); initViewOper(); } @Override public void initDatas() { } @Override public void initViewOper() { } //搜索操作 复合查询,可根据商品编号和商品相关内容搜索 @OnClick(R.id.fragment_fenlei_sousuo) public void searchInfoOnClick(View v){ final String info = etinfo.getText().toString().trim(); if (info==null||"".equals(info)) { toastS("请输入检索数据"); return; } numberkey = "10"; BmobQuery<GoodsBean> eq1 = new BmobQuery<GoodsBean>(); eq1.addWhereEqualTo("number", info); BmobQuery<GoodsBean> eq2 = new BmobQuery<GoodsBean>(); eq2.addWhereContains("info", info); List<BmobQuery<GoodsBean>> queries = new ArrayList<BmobQuery<GoodsBean>>(); queries.add(eq1); queries.add(eq2); BmobQuery<GoodsBean> query = new BmobQuery<GoodsBean>(); query.or(queries); query.findObjects(getActivity(), new FindListener<GoodsBean>() { @Override public void onSuccess(List<GoodsBean> data) { if (data != null && data.size() > 0) { String key = "findGoodsBean"; // 检索数据 MyApplication.putData(key, data); // 跳转界面 Intent intent = new Intent(getActivity(), FenLeiActivity.class); intent.putExtra("key", key); intent.putExtra("NumberKey", numberkey); intent.putExtra("title_Str", TextUtils.textLengthMax(info)); etinfo.setText(""); startActivity(intent); } else { toastS("对不起,没有相关内容"); return; } } @Override public void onError(int arg0, String arg1) { } }); } @Override public void initViews() { } //不同分类的监听 @OnClick({ R.id.fragment_fenlei_yudong, R.id.fragment_fenlei_huwai, R.id.fragment_fenlei_nvxie, R.id.fragment_fenlei_nanxie, R.id.fragment_fenlei_nanzhuang, R.id.fragment_fenlei_nvzhuang, R.id.fragment_fenlei_tongz, R.id.fragment_fenlei_xiangb, R.id.fragment_fenlei_jiaju ,R.id.fragment_fenlei_tuijian}) public void OnClick(View v) { switch (v.getId()) { case R.id.fragment_fenlei_yudong: numberkey = "1"; getdatas("运动"); break; case R.id.fragment_fenlei_huwai: numberkey = "2"; getdatas("户外"); break; case R.id.fragment_fenlei_nvxie: numberkey = "3"; getdatas("女鞋"); break; case R.id.fragment_fenlei_nanxie: numberkey = "4"; getdatas("男鞋"); break; case R.id.fragment_fenlei_nanzhuang: numberkey = "5"; getdatas("男装"); break; case R.id.fragment_fenlei_nvzhuang: numberkey = "6"; getdatas("女装"); break; case R.id.fragment_fenlei_tongz: numberkey = "7"; getdatas("童装"); break; case R.id.fragment_fenlei_xiangb: numberkey = "8"; getdatas("箱包"); break; case R.id.fragment_fenlei_jiaju: numberkey = "9"; getdatas("家居"); break; case R.id.fragment_fenlei_tuijian: numberkey = "11"; getdatas("热门推荐"); break; } } //得到搜索商品的数据源 private void getdatas(String string) { BmobQuery<GoodsBean> query = new BmobQuery<GoodsBean>(); query.addWhereEqualTo("type", string); DialogUtils.showDialog(getActivity(), null, null, true); query.findObjects(getActivity(), new FindListener<GoodsBean>() { @Override public void onSuccess(List<GoodsBean> arg0) { DialogUtils.dismiss(); if (arg0 != null && arg0.size() > 0) { String key = "findGoodsBean"; // 检索数据 MyApplication.putData(key, arg0); // 跳转界面 Intent intent = new Intent(getActivity(), FenLeiActivity.class); intent.putExtra("key", key); intent.putExtra("NumberKey", numberkey); startActivity(intent); } else { toastS("对不起,没有相关内容"); } } @Override public void onError(int arg0, String arg1) { DialogUtils.dismiss(); } }); } }