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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2cc01d21d2ffba5c89dd752d977a6a82e911c417 | 40709bb96f024822eea708b914c4c1f635a37c4c | /gismap-service/src/main/java/com/zjhz/gismap/dto/UserDTO.java | f819ebc55c1ea5416f686e260a6180e41341f4b0 | [] | no_license | java-zhangzh/zjhz_cs | 6a3f6d286d03fc6250a0de238f1ef5050d9c03cd | f4b6e186e1a6d92079ecff830c5279156baeee86 | refs/heads/master | 2022-07-02T04:42:28.376059 | 2020-03-12T06:59:45 | 2020-03-12T06:59:56 | 243,173,854 | 1 | 1 | null | 2022-06-21T02:52:14 | 2020-02-26T05:08:49 | Java | UTF-8 | Java | false | false | 792 | java | package com.zjhz.gismap.dto;
import com.zjhz.gismap.domain.User;
import lombok.Data;
import org.springframework.beans.BeanUtils;
/**
* <b>功能名:</b>UserDTO<br>
* <b>说明:</b><br>
* <b>著作权:</b> Copyright (C) 2019 ZJHZ CORPORATION<br>
* <b>修改履历:
*
* @author 2019-05-13 hufeng
*/
@Data
public class UserDTO {
public UserDTO(){}
public UserDTO(User user){
BeanUtils.copyProperties(user, this);
}
private String id;
private String name;
private Integer sex;
private String teacherId;
private String semeterId;
private String teacherUserId;
private String kgId;
private String childId;
private String userName;
private String password;
private String phone;
private String code;
}
| [
"[email protected]"
] | |
b23d708915a0fc4696cddb7ab70aeea4984f9e48 | 93b032f1181fef82800ecfd940bcb3cfd0065bbb | /MaterialDesignDemo/app/src/main/java/com/itfollowme/materialdesigndemo/RealmFragment.java | 00013f0665e08a4dde50778cf9418b37cf507f2a | [] | no_license | lastpiecexz/njit151152 | 101057e06ce4bddf1ed0a4447c6f823c8acb3a27 | 1e48297d17fa29d204065b18077e107d1caa3893 | refs/heads/master | 2021-04-06T20:16:23.889560 | 2018-06-07T07:36:36 | 2018-06-07T07:36:36 | 125,337,475 | 5 | 3 | null | 2018-03-26T08:14:44 | 2018-03-15T08:44:06 | Java | UTF-8 | Java | false | false | 617 | java | package com.itfollowme.materialdesigndemo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
/**
* A simple {@link Fragment} subclass.
*/
public class RealmFragment extends Fragment {
public RealmFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_realm, container, false);
}
}
| [
"[email protected]"
] | |
64d9d87c8023e31dc2206c50a790dd367c3075d7 | 962aa5e0d13dca4fc530868209cf2a08eaa46897 | /MIS/src/main/Foraccess.java | f709367ef645f195c0fbefcb5ff12e5f22e00d0e | [] | no_license | LeoEatle/MIS_java | ca6e111beae43f1aa94ca70d766ff0bae2587f93 | c97f2886575327360dbf7f4d46574469dfb76b01 | refs/heads/master | 2016-09-05T10:50:58.961510 | 2015-09-20T02:00:10 | 2015-09-20T02:00:10 | 42,796,692 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | package main;
import java.sql.DriverManager;
import com.mysql.jdbc.Connection;
public class Foraccess {
static java.sql.Connection conn;
public static void main(String args[])
{
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
String url = "jdbc:Access:///c:/a/db.mdb";
conn = DriverManager.getConnection(url, "", "");
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
d3d093299d6862ae272468f4d485abbe4207f53c | 33ee5a9dbd6c98014ded72601cda3385ff38ff72 | /app/src/main/java/com/wisdomrider/bloodnepal/Receivers/WifiReceiver.java | 1824eb706aa5f611200cf9346ca14a5ca58df336 | [
"Apache-2.0"
] | permissive | wisdomrider/BloodNepal | 4d5ac3a3c6869f031512a0cf5b3e929a38a7196f | 2c5f85aaec6039062fbf945bc7bb601e7842cd7f | refs/heads/master | 2020-03-28T12:19:33.013602 | 2018-09-11T08:52:00 | 2018-09-11T08:52:00 | 148,287,891 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 518 | java | package com.wisdomrider.bloodnepal.Receivers;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.wisdomrider.bloodnepal.Services.Background;
/*
CREated by avi(Wisdomrider)
on 9/10/2018
*/
public class WifiReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (Background.isConnected != 1) {
context.startService(new Intent(context, Background.class));
}
}
}
| [
"[email protected]"
] | |
470b309c7bc43d29daa2fad145a3edba4eac33e1 | 1b523bf1b3bfd9782227ca394ac20143baf4974c | /official/chapter05/phoneme/phoneme_modify_src/midp_src/src/test/common/i3test/com/sun/midp/util/FailTest.java | 1d6e0faa312eb42a91508ead7687722bb14234e9 | [] | no_license | Joyounger/armlinuxbook | 66c80192a2d4ea068bba2e21c92067705da08949 | b7fea1d8c235cbd1f4551b5495bbacc777d91916 | refs/heads/master | 2021-05-06T10:17:58.433025 | 2018-03-31T09:14:02 | 2018-03-31T09:14:02 | 114,165,147 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,610 | java | /*
*
*
* Copyright 1990-2008 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version
* 2 only, as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License version 2 for more details (a copy is
* included at /legal/license.txt).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
* Clara, CA 95054 or visit www.sun.com if you need additional
* information or have any questions.
*/
package com.sun.midp.util;
import com.sun.midp.i3test.TestCase;
/**
* An i3test that fails. Useful for ensuring that i3test runs that include a
* failure report their exit status properly. Note that this class doesn't
* follow the typical naming conventions, so it isn't included as part of the
* normal test run. To invoke it, you must name the class explicitly on the
* i3test command line.
*/
public class FailTest extends TestCase {
public void runTests() {
declare("testFail");
fail("testFail has failed as expected");
}
}
| [
"[email protected]"
] | |
65c4e5383872dce99d14434e278fd5a0a7d20368 | d9b077b5e3d6dab3c2ca0c07fe80894985b250af | /core/src/test/java/net/fortress/eventlistener/chain/factory/DefaultContractEventDetailsFactoryTest.java | 0fd83bc67342835a6a44853458eede7c70ad95d9 | [] | no_license | bydolson/fortress-event-listener | db5fc3254bab0eb410a8744783bccaf77a0e6d01 | f4ae34e53e83d01b9aa71c970cf4580c3cda83c8 | refs/heads/main | 2023-02-01T06:48:36.611589 | 2020-12-17T08:05:47 | 2020-12-17T08:05:47 | 319,055,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,273 | java | /*
* 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 net.fortress.eventlistener.chain.factory;
import net.fortress.eventlistener.chain.converter.EventParameterConverter;
import net.fortress.eventlistener.chain.settings.Node;
import net.fortress.eventlistener.chain.util.Web3jUtil;
import net.fortress.eventlistener.dto.event.ContractEventDetails;
import net.fortress.eventlistener.dto.event.ContractEventStatus;
import net.fortress.eventlistener.dto.event.filter.ContractEventFilter;
import net.fortress.eventlistener.dto.event.filter.ContractEventSpecification;
import net.fortress.eventlistener.dto.event.filter.ParameterDefinition;
import net.fortress.eventlistener.dto.event.filter.ParameterType;
import net.fortress.eventlistener.dto.event.parameter.EventParameter;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.web3j.abi.datatypes.Type;
import org.web3j.crypto.Keys;
import org.web3j.protocol.core.methods.response.EthBlock;
import java.math.BigInteger;
import java.util.Arrays;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class DefaultContractEventDetailsFactoryTest {
//Values: 123, 0x00a329c0648769a73afac7f9381e08fb43dbea72, -42
private static final String LOG_DATA = "0x000000000000000000000000000000000000000000000000000000000000007b00000000000000000000000000a329c0648769a73afac7f9381e08fb43dbea72ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd6";
//Values: 456
private static final String INDEXED_PARAM = "0x00000000000000000000000000000000000000000000000000000000000001c8";
private static final String CONTRACT_ADDRESS = "0x7a55a28856d43bba3c6a7e36f2cee9a82923e99b";
private static final String EVENT_NAME = "DummyEvent";
private static final String ADDRESS = "0x2250683dbe4e0b90395c3c5d7def87784a2b916c";
private static final BigInteger LOG_INDEX = BigInteger.TEN;
private static final String TX_HASH = "0x1fb4a22baf926bd643d796e1332b73452b4eeb1dc6e8be787d4bf54dcccf4485";
private static final BigInteger BLOCK_NUMBER = BigInteger.valueOf(12345);
private static final String BLOCK_HASH = "0xf6c7c0822df1bce82b8edf55ab93f2e69ea80ef714801789fae3b3a08f761047";
private static final String NETWORK_NAME = "ThisIsANetworkName";
private DefaultContractEventDetailsFactory underTest;
private EventParameterConverter mockParameterCoverter;
private org.web3j.protocol.core.methods.response.Log mockLog;
private static ContractEventSpecification eventSpec;
private ContractEventFilter filter;
static {
eventSpec = new ContractEventSpecification();
eventSpec.setEventName(EVENT_NAME);
eventSpec.setIndexedParameterDefinitions(
Arrays.asList(new ParameterDefinition(0, ParameterType.build("UINT256"))));
eventSpec.setNonIndexedParameterDefinitions(Arrays.asList(
new ParameterDefinition(1, ParameterType.build("UINT256")),
new ParameterDefinition(2, ParameterType.build("ADDRESS")),
new ParameterDefinition(3, ParameterType.build("INT256"))));
}
@Before
public void init() {
mockParameterCoverter = mock(EventParameterConverter.class);
mockLog = mock(org.web3j.protocol.core.methods.response.Log.class);
when(mockLog.getData()).thenReturn(LOG_DATA);
when(mockLog.getTopics()).thenReturn(Arrays.asList(null, INDEXED_PARAM));
when(mockLog.getAddress()).thenReturn(ADDRESS);
when(mockLog.getLogIndex()).thenReturn(LOG_INDEX);
when(mockLog.getTransactionHash()).thenReturn(TX_HASH);
when(mockLog.getBlockNumber()).thenReturn(BLOCK_NUMBER);
when(mockLog.getBlockHash()).thenReturn(BLOCK_HASH);
filter = new ContractEventFilter();
filter.setContractAddress(CONTRACT_ADDRESS);
filter.setEventSpecification(eventSpec);
}
@Test
public void testValuesCorrect() {
DefaultContractEventDetailsFactory underTest = createFactory(BigInteger.TEN);
final ContractEventDetails eventDetails = underTest.createEventDetails(filter, mockLog);
assertEquals(eventDetails.getName(), eventSpec.getEventName());
assertEquals(filter.getId(), eventDetails.getFilterId());
assertEquals(Keys.toChecksumAddress(ADDRESS), eventDetails.getAddress());
assertEquals(LOG_INDEX, eventDetails.getLogIndex());
assertEquals(TX_HASH, eventDetails.getTransactionHash());
assertEquals(BLOCK_NUMBER, eventDetails.getBlockNumber());
assertEquals(BLOCK_HASH, eventDetails.getBlockHash());
assertEquals(Web3jUtil.getSignature(eventSpec), eventDetails.getEventSpecificationSignature());
assertEquals(ContractEventStatus.UNCONFIRMED, eventDetails.getStatus());
assertEquals(NETWORK_NAME,eventDetails.getNetworkName());
}
@Test
public void testStatusWhenLogRemoved() {
when(mockLog.isRemoved()).thenReturn(true);
DefaultContractEventDetailsFactory underTest = createFactory(BigInteger.TEN);
final ContractEventDetails eventDetails = underTest.createEventDetails(filter, mockLog);
assertEquals(ContractEventStatus.INVALIDATED, eventDetails.getStatus());
}
@Test
public void testStatusWhenZeroConfirmationsConfigured() {
DefaultContractEventDetailsFactory underTest = createFactory(BigInteger.ZERO);
final ContractEventDetails eventDetails = underTest.createEventDetails(filter, mockLog);
assertEquals(ContractEventStatus.CONFIRMED, eventDetails.getStatus());
}
@Test
public void testIndexedParametersAreCorrect() {
final DefaultContractEventDetailsFactory underTest = createFactory(BigInteger.TEN);
final EventParameter mockParam1 = mock(EventParameter.class);
final ArgumentCaptor<Type> argumentCaptor = ArgumentCaptor.forClass(Type.class);
when(mockParameterCoverter.convert(argumentCaptor.capture())).thenReturn(mockParam1);
final ContractEventDetails eventDetails = underTest.createEventDetails(filter, mockLog);
assertEquals(Arrays.asList(mockParam1), eventDetails.getIndexedParameters());
assertEquals(BigInteger.valueOf(456), argumentCaptor.getAllValues().get(3).getValue());
}
@Test
public void testNonIndexedParametersAreCorrect() {
final DefaultContractEventDetailsFactory underTest = createFactory(BigInteger.TEN);
final EventParameter mockParam1 = mock(EventParameter.class);
final ArgumentCaptor<Type> argumentCaptor = ArgumentCaptor.forClass(Type.class);
when(mockParameterCoverter.convert(argumentCaptor.capture())).thenReturn(mockParam1);
final ContractEventDetails eventDetails = underTest.createEventDetails(filter, mockLog);
assertEquals(Arrays.asList(mockParam1, mockParam1, mockParam1), eventDetails.getNonIndexedParameters());
assertEquals(BigInteger.valueOf(123), argumentCaptor.getAllValues().get(0).getValue());
assertEquals("0x00a329c0648769a73afac7f9381e08fb43dbea72",
argumentCaptor.getAllValues().get(1).toString());
assertEquals(BigInteger.valueOf(-42), argumentCaptor.getAllValues().get(2).getValue());
}
private DefaultContractEventDetailsFactory createFactory(BigInteger confirmations) {
Node node =
new Node();
node.setBlocksToWaitForConfirmation(confirmations);
node.setBlocksToWaitForMissingTx(BigInteger.valueOf(100));
node.setBlocksToWaitBeforeInvalidating(BigInteger.valueOf(5));
return new DefaultContractEventDetailsFactory(mockParameterCoverter, node, NETWORK_NAME);
}
}
| [
"[email protected]"
] | |
73914a375ab4b66d66bd0536714f4df3ec17cf76 | 45bcb90c060c335bc18877c6154a158f67967148 | /pvmanager/datasource-graphene/src/main/java/org/diirt/datasource/graphene/ScatterGraph2DFunction.java | f6275fe424eb91b6d8afb433c8584cb2ca2eac02 | [
"MIT"
] | permissive | gcarcassi/diirt | fee958d4606fe1c619ab28dde2d39bfdb68ccb5f | f2a7caa176f3f76f24c7cfa844029168e9634bb2 | refs/heads/master | 2020-04-05T22:58:09.892003 | 2017-06-02T15:23:44 | 2017-06-02T15:23:44 | 50,449,601 | 0 | 0 | null | 2016-01-26T18:27:46 | 2016-01-26T18:27:45 | null | UTF-8 | Java | false | false | 3,338 | java | /**
* Copyright (C) 2010-14 diirt developers. See COPYRIGHT.TXT
* All rights reserved. Use is subject to license terms. See LICENSE.TXT
*/
package org.diirt.datasource.graphene;
import java.awt.image.BufferedImage;
import java.util.List;
import org.diirt.graphene.Point2DDataset;
import org.diirt.graphene.ScatterGraph2DRenderer;
import org.diirt.graphene.ScatterGraph2DRendererUpdate;
import org.diirt.datasource.QueueCollector;
import org.diirt.datasource.ReadFunction;
import org.diirt.vtype.VImage;
import org.diirt.vtype.VTable;
import org.diirt.vtype.ValueUtil;
import static org.diirt.datasource.graphene.ArgumentExpressions.*;
/**
* @author shroffk
*
*/
public class ScatterGraph2DFunction implements ReadFunction<Graph2DResult> {
private ReadFunction<? extends VTable> tableData;
private ReadFunctionArgument<String> xColumnName;
private ReadFunctionArgument<String> yColumnName;
private ReadFunctionArgument<String> tooltipColumnName;
private ScatterGraph2DRenderer renderer = new ScatterGraph2DRenderer(300,
200);
private VImage previousImage;
private final QueueCollector<ScatterGraph2DRendererUpdate> rendererUpdateQueue = new QueueCollector<>(
100);
public ScatterGraph2DFunction(ReadFunction<?> tableData,
ReadFunction<?> xColumnName,
ReadFunction<?> yColumnName,
ReadFunction<?> tooltipColumnName) {
this.tableData = new CheckedReadFunction<>(tableData, "Data", VTable.class);
this.xColumnName = stringArgument(xColumnName, "X Column");
this.yColumnName = stringArgument(yColumnName, "Y Column");
this.tooltipColumnName = stringArgument(tooltipColumnName, "Tooltip Column");
}
public QueueCollector<ScatterGraph2DRendererUpdate> getRendererUpdateQueue() {
return rendererUpdateQueue;
}
@Override
public Graph2DResult readValue() {
VTable vTable = tableData.readValue();
xColumnName.readNext();
yColumnName.readNext();
tooltipColumnName.readNext();
// Table and columns must be available
if (vTable == null || xColumnName.isMissing() || yColumnName.isMissing()) {
return null;
}
// Prepare new dataset
Point2DDataset dataset = DatasetConversions.point2DDatasetFromVTable(vTable, xColumnName.getValue(), yColumnName.getValue());
List<ScatterGraph2DRendererUpdate> updates = rendererUpdateQueue
.readValue();
for (ScatterGraph2DRendererUpdate scatterGraph2DRendererUpdate : updates) {
renderer.update(scatterGraph2DRendererUpdate);
}
if (renderer.getImageHeight() == 0 && renderer.getImageWidth() == 0) {
return null;
}
BufferedImage image = new BufferedImage(renderer.getImageWidth(),
renderer.getImageHeight(), BufferedImage.TYPE_3BYTE_BGR);
renderer.draw(image.createGraphics(), dataset);
previousImage = ValueUtil.toVImage(image);
return new Graph2DResult(vTable, previousImage,
new GraphDataRange(renderer.getXPlotRange(), renderer.getXPlotRange(), renderer.getXAggregatedRange()), new GraphDataRange(
renderer.getYPlotRange(), renderer.getYPlotRange(), renderer.getYAggregatedRange()),
-1);
}
}
| [
"[email protected]"
] | |
83918fd925e7fc11772f0054d20b3eb01edd5d98 | 552fdb092d8e29076474abb271c2e407f928a49c | /ad-core/src/main/java/com/palmtech/ad/dao/StPushAppDao.java | 8e68f674d8e3ad7fbc172b3deedd2b9082c287e5 | [] | no_license | caomingjian2012/example-core | 2ed8d8149c617923c2ba9f44083feefc39cdc180 | ebb248eb03ae567f6e4aad5b9064300e8acf6304 | refs/heads/master | 2021-01-10T12:58:17.838148 | 2015-11-15T15:54:13 | 2015-11-15T15:54:13 | 46,224,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.palmtech.ad.dao;
import cn.org.rapid_framework.page.Page;
import com.common.plugins.myframework.DaoInterface;
import com.palmtech.ad.entity.st.StPushApp;
import com.palmtech.ad.entity.st.StPushAppQuery;
public interface StPushAppDao extends DaoInterface<StPushApp,java.lang.String> {
Page<StPushApp> findPage(StPushAppQuery query);
}
| [
"[email protected]"
] | |
714e3665ac570df5c76d79aa5c74b9d62b91f4ee | 5708880334865933b337dd1d8aa33fab682966c8 | /chapter-0523/src/main/java/com/gupaoedu/michael/business/qualification/service/LotteryQualifyService.java | 24876c02d2af118ac947cb71046feaf96cc29e13 | [] | no_license | EvanLeung08/eshare-learning-materials | 2c281425dec9272f763c81c14defe8846f5d1e9f | 9ee92c9fd38a03c4b8f3d354715cea055e3dfa8b | refs/heads/master | 2020-04-15T12:54:07.969892 | 2019-01-08T16:44:41 | 2019-01-08T16:44:41 | 164,691,741 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package com.gupaoedu.michael.business.qualification.service;
import com.gupaoedu.michael.business.draw.domain.valobj.DrawLotteryContext;
/**
* 腾讯课堂搜索 咕泡学院
* 加群获取视频:608583947
* 风骚的Michael 老师
*/
public interface LotteryQualifyService {
/**
* 资格判断
* @param context
* @return
*/
boolean checkLotteryCondition(DrawLotteryContext context);
}
| [
"[email protected]"
] | |
3e85691ffccd5fa74dbb4b18bcf234c3ec1dbf92 | 3841f7991232e02c850b7e2ff6e02712e9128b17 | /小浪底泥沙三维/EV_Xld/jni/src/JAVA/EV_Spatial3DDatasetWrapper/src/com/earthview/world/spatial3d/dataset/ModelCacheUtility.java | ce542c4b68ad673114f0f5d4d0d93ee522925c30 | [] | no_license | 15831944/BeijingEVProjects | 62bf734f1cb0a8be6fed42cf6b207f9dbdf99e71 | 3b5fa4c4889557008529958fc7cb51927259f66e | refs/heads/master | 2021-07-22T14:12:15.106616 | 2017-10-15T11:33:06 | 2017-10-15T11:33:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 25,023 | java | package com.earthview.world.spatial3d.dataset;
import global.*;
import com.earthview.world.base.*;
import com.earthview.world.util.*;
import com.earthview.world.core.*;
public class ModelCacheUtility extends com.earthview.world.core.AllocatedObject {
static {
GlobalClassFactoryMap.put("EarthView::World::Spatial3D::Dataset::CModelCacheUtility", new ModelCacheUtilityClassFactory());
}
public ModelCacheUtility() {
super(CreatedWhenConstruct.CWC_NotToCreate);
Create("CModelCacheUtility", null);
}
native private static boolean clearDataset_EVString_EVString_ev_bool(String datasourceName, String datasetName, boolean bTemplDataset);
/**
* 清除数据集缓存
* @param datasourceName 数据源名
* @param datasetName 数据集名
*/
public static boolean clearDataset(String datasourceName, String datasetName, boolean bTemplDataset)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
boolean bTemplDatasetParamValue = bTemplDataset;
boolean returnValue = clearDataset_EVString_EVString_ev_bool(datasourceNameParamValue, datasetNameParamValue, bTemplDatasetParamValue);
return returnValue;
}
native private static boolean writeDatasetModel_EVString_EVString_EVString_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(String datasourceName, String datasetName, String octCode, long pMeshFeature, long thumbTextures, long origTextures, long cubeTextures, long materials, long progs, long gpus, long skeletons, long animation);
/**
* 缓存实体数据集模型
* @param
*/
public static boolean writeDatasetModel(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial.geodataset.Ifeature pMeshFeature, com.earthview.world.spatial3d.dataset.FeatureVector thumbTextures, com.earthview.world.spatial3d.dataset.FeatureVector origTextures, com.earthview.world.spatial3d.dataset.FeatureVector cubeTextures, com.earthview.world.spatial3d.dataset.FeatureVector materials, com.earthview.world.spatial3d.dataset.FeatureVector progs, com.earthview.world.spatial3d.dataset.FeatureVector gpus, com.earthview.world.spatial3d.dataset.FeatureVector skeletons, com.earthview.world.spatial3d.dataset.FeatureVector animation)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long pMeshFeatureParamValue = (pMeshFeature == null ? 0L : pMeshFeature.nativeObject.pointer);
long thumbTexturesParamValue = thumbTextures.nativeObject.pointer;
long origTexturesParamValue = origTextures.nativeObject.pointer;
long cubeTexturesParamValue = cubeTextures.nativeObject.pointer;
long materialsParamValue = materials.nativeObject.pointer;
long progsParamValue = progs.nativeObject.pointer;
long gpusParamValue = gpus.nativeObject.pointer;
long skeletonsParamValue = skeletons.nativeObject.pointer;
long animationParamValue = animation.nativeObject.pointer;
boolean returnValue = writeDatasetModel_EVString_EVString_EVString_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, pMeshFeatureParamValue, thumbTexturesParamValue, origTexturesParamValue, cubeTexturesParamValue, materialsParamValue, progsParamValue, gpusParamValue, skeletonsParamValue, animationParamValue);
return returnValue;
}
native private static boolean writeTemplDBModel_EVString_EVString_EVString_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(String datasourceName, String datasetName, String octCode, long pMeshFeature, long thumbTextures, long origTextures, long cubeTextures, long materials, long progs, long gpus, long skeletons, long animation);
/**
* 缓存实体模型库数据集模型
* @param
*/
public static boolean writeTemplDBModel(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial.geodataset.Ifeature pMeshFeature, com.earthview.world.spatial3d.dataset.FeatureVector thumbTextures, com.earthview.world.spatial3d.dataset.FeatureVector origTextures, com.earthview.world.spatial3d.dataset.FeatureVector cubeTextures, com.earthview.world.spatial3d.dataset.FeatureVector materials, com.earthview.world.spatial3d.dataset.FeatureVector progs, com.earthview.world.spatial3d.dataset.FeatureVector gpus, com.earthview.world.spatial3d.dataset.FeatureVector skeletons, com.earthview.world.spatial3d.dataset.FeatureVector animation)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long pMeshFeatureParamValue = (pMeshFeature == null ? 0L : pMeshFeature.nativeObject.pointer);
long thumbTexturesParamValue = thumbTextures.nativeObject.pointer;
long origTexturesParamValue = origTextures.nativeObject.pointer;
long cubeTexturesParamValue = cubeTextures.nativeObject.pointer;
long materialsParamValue = materials.nativeObject.pointer;
long progsParamValue = progs.nativeObject.pointer;
long gpusParamValue = gpus.nativeObject.pointer;
long skeletonsParamValue = skeletons.nativeObject.pointer;
long animationParamValue = animation.nativeObject.pointer;
boolean returnValue = writeTemplDBModel_EVString_EVString_EVString_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, pMeshFeatureParamValue, thumbTexturesParamValue, origTexturesParamValue, cubeTexturesParamValue, materialsParamValue, progsParamValue, gpusParamValue, skeletonsParamValue, animationParamValue);
return returnValue;
}
native private static boolean writeTemplEntity_EVString_EVString_EVString_IFeature(String datasourceName, String datasetName, String code, long pMeshFeature);
/**
* 缓存模型库模型
* @param
*/
public static boolean writeTemplEntity(String datasourceName, String datasetName, String code, com.earthview.world.spatial.geodataset.Ifeature pMeshFeature)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String codeParamValue = code;
long pMeshFeatureParamValue = (pMeshFeature == null ? 0L : pMeshFeature.nativeObject.pointer);
boolean returnValue = writeTemplEntity_EVString_EVString_EVString_IFeature(datasourceNameParamValue, datasetNameParamValue, codeParamValue, pMeshFeatureParamValue);
return returnValue;
}
native private static boolean deleteDatasetModel_EVString_EVString_EVString_ev_uint32(String datasourceName, String datasetName, String octCode, long id);
/**
* 删除实体数据集模型
* @param
*/
public static boolean deleteDatasetModel(String datasourceName, String datasetName, String octCode, long id)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long idParamValue = id;
boolean returnValue = deleteDatasetModel_EVString_EVString_EVString_ev_uint32(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, idParamValue);
return returnValue;
}
native private static boolean deleteTemplDBModel_EVString_EVString_EVString_ev_uint32(String datasourceName, String datasetName, String octCode, long id);
/**
* 删除实体模型库数据集模型
* @param
*/
public static boolean deleteTemplDBModel(String datasourceName, String datasetName, String octCode, long id)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long idParamValue = id;
boolean returnValue = deleteTemplDBModel_EVString_EVString_EVString_ev_uint32(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, idParamValue);
return returnValue;
}
native private static boolean deleteTemplEntity_EVString_EVString_ev_uint32(String datasourceName, String datasetName, long id);
/**
* 删除模型库模型
* @param
*/
public static boolean deleteTemplEntity(String datasourceName, String datasetName, long id)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
long idParamValue = id;
boolean returnValue = deleteTemplEntity_EVString_EVString_ev_uint32(datasourceNameParamValue, datasetNameParamValue, idParamValue);
return returnValue;
}
native private static boolean updateDatasetEntityInfo_EVString_EVString_EVString_IFeature(String datasourceName, String datasetName, String octCode, long pMeshFeature);
/**
* 更新实体数据集场景信息
* @param
*/
public static boolean updateDatasetEntityInfo(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial.geodataset.Ifeature pMeshFeature)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long pMeshFeatureParamValue = (pMeshFeature == null ? 0L : pMeshFeature.nativeObject.pointer);
boolean returnValue = updateDatasetEntityInfo_EVString_EVString_EVString_IFeature(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, pMeshFeatureParamValue);
return returnValue;
}
native private static boolean updateTemplDatasetEntityInfo_EVString_EVString_EVString_IFeature(String datasourceName, String datasetName, String octCode, long pMeshFeature);
/**
* 更新模板数据集场景信息
* @param
*/
public static boolean updateTemplDatasetEntityInfo(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial.geodataset.Ifeature pMeshFeature)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long pMeshFeatureParamValue = (pMeshFeature == null ? 0L : pMeshFeature.nativeObject.pointer);
boolean returnValue = updateTemplDatasetEntityInfo_EVString_EVString_EVString_IFeature(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, pMeshFeatureParamValue);
return returnValue;
}
native private static boolean updateTemplDBInfo_EVString_EVString_IFeature(String datasourceName, String datasetName, long pMeshFeature);
/**
* 更新模板库基础信息
* @param
*/
public static boolean updateTemplDBInfo(String datasourceName, String datasetName, com.earthview.world.spatial.geodataset.Ifeature pMeshFeature)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
long pMeshFeatureParamValue = (pMeshFeature == null ? 0L : pMeshFeature.nativeObject.pointer);
boolean returnValue = updateTemplDBInfo_EVString_EVString_IFeature(datasourceNameParamValue, datasetNameParamValue, pMeshFeatureParamValue);
return returnValue;
}
native private static boolean readDatasetModel_CEntityDataset_EVString_ev_uint32_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(long pDataset, String octCode, long id, long pMeshFeature, long thumbTextures, long origTextures, long cubeTextures, long materials, long progs, long gpus, long skeletons, long animation);
/**
* 读取实体数据集模型
* @param
*/
public static boolean readDatasetModel(com.earthview.world.spatial3d.dataset.EntityDataset pDataset, String octCode, long id, NativeObjectPointer<com.earthview.world.spatial.geodataset.Ifeature> pMeshFeature, com.earthview.world.spatial3d.dataset.FeatureVector thumbTextures, com.earthview.world.spatial3d.dataset.FeatureVector origTextures, com.earthview.world.spatial3d.dataset.FeatureVector cubeTextures, com.earthview.world.spatial3d.dataset.FeatureVector materials, com.earthview.world.spatial3d.dataset.FeatureVector progs, com.earthview.world.spatial3d.dataset.FeatureVector gpus, com.earthview.world.spatial3d.dataset.FeatureVector skeletons, com.earthview.world.spatial3d.dataset.FeatureVector animation)
{
long pDatasetParamValue = (pDataset == null ? 0L : pDataset.nativeObject.pointer);
String octCodeParamValue = octCode;
long idParamValue = id;
long pMeshFeatureParamValue = pMeshFeature.nativeObject.pointer;
long thumbTexturesParamValue = thumbTextures.nativeObject.pointer;
long origTexturesParamValue = origTextures.nativeObject.pointer;
long cubeTexturesParamValue = cubeTextures.nativeObject.pointer;
long materialsParamValue = materials.nativeObject.pointer;
long progsParamValue = progs.nativeObject.pointer;
long gpusParamValue = gpus.nativeObject.pointer;
long skeletonsParamValue = skeletons.nativeObject.pointer;
long animationParamValue = animation.nativeObject.pointer;
boolean returnValue = readDatasetModel_CEntityDataset_EVString_ev_uint32_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(pDatasetParamValue, octCodeParamValue, idParamValue, pMeshFeatureParamValue, thumbTexturesParamValue, origTexturesParamValue, cubeTexturesParamValue, materialsParamValue, progsParamValue, gpusParamValue, skeletonsParamValue, animationParamValue);
return returnValue;
}
native private static boolean readTemplDBModel_CMeshTemplateDataset_EVString_EVString_EVString_ev_uint32_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(long pDataset, String datasourceName, String datasetName, String octCode, long id, long pMeshFeature, long thumbTextures, long origTextures, long cubeTextures, long materials, long progs, long gpus, long skeletons, long animatio);
/**
* 读取实体模型库数据集模型
* @param
*/
public static boolean readTemplDBModel(com.earthview.world.spatial3d.dataset.MeshTemplateDataset pDataset, String datasourceName, String datasetName, String octCode, long id, NativeObjectPointer<com.earthview.world.spatial.geodataset.Ifeature> pMeshFeature, com.earthview.world.spatial3d.dataset.FeatureVector thumbTextures, com.earthview.world.spatial3d.dataset.FeatureVector origTextures, com.earthview.world.spatial3d.dataset.FeatureVector cubeTextures, com.earthview.world.spatial3d.dataset.FeatureVector materials, com.earthview.world.spatial3d.dataset.FeatureVector progs, com.earthview.world.spatial3d.dataset.FeatureVector gpus, com.earthview.world.spatial3d.dataset.FeatureVector skeletons, com.earthview.world.spatial3d.dataset.FeatureVector animatio)
{
long pDatasetParamValue = (pDataset == null ? 0L : pDataset.nativeObject.pointer);
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long idParamValue = id;
long pMeshFeatureParamValue = pMeshFeature.nativeObject.pointer;
long thumbTexturesParamValue = thumbTextures.nativeObject.pointer;
long origTexturesParamValue = origTextures.nativeObject.pointer;
long cubeTexturesParamValue = cubeTextures.nativeObject.pointer;
long materialsParamValue = materials.nativeObject.pointer;
long progsParamValue = progs.nativeObject.pointer;
long gpusParamValue = gpus.nativeObject.pointer;
long skeletonsParamValue = skeletons.nativeObject.pointer;
long animatioParamValue = animatio.nativeObject.pointer;
boolean returnValue = readTemplDBModel_CMeshTemplateDataset_EVString_EVString_EVString_ev_uint32_IFeature_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector_FeatureVector(pDatasetParamValue, datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, idParamValue, pMeshFeatureParamValue, thumbTexturesParamValue, origTexturesParamValue, cubeTexturesParamValue, materialsParamValue, progsParamValue, gpusParamValue, skeletonsParamValue, animatioParamValue);
return returnValue;
}
native private static long readTemplEntity_CEntityDataset_ev_uint32_EVString(long pDataset, long id, String code);
/**
* 读取模型库模型
* @param
*/
public static com.earthview.world.spatial.geodataset.Ifeature readTemplEntity(com.earthview.world.spatial3d.dataset.EntityDataset pDataset, long id, String code)
{
long pDatasetParamValue = (pDataset == null ? 0L : pDataset.nativeObject.pointer);
long idParamValue = id;
String codeParamValue = code;
long returnValue = readTemplEntity_CEntityDataset_ev_uint32_EVString(pDatasetParamValue, idParamValue, codeParamValue);
if(returnValue == 0L) {
return null;
}
com.earthview.world.spatial.geodataset.Ifeature __returnValue = new com.earthview.world.spatial.geodataset.Ifeature(CreatedWhenConstruct.CWC_NotToCreate, "IFeature");
__returnValue.setDelegate(true);
InstancePointer __instancePointer = new InstancePointer(returnValue);
__returnValue.setInstancePointer(__instancePointer);
IClassFactory __returnValueClassFactory = GlobalClassFactoryMap.get(__returnValue.getCppInstanceTypeName());
if (__returnValueClassFactory != null)
{
__returnValue.setDelegate(true);
__returnValue = (com.earthview.world.spatial.geodataset.Ifeature)__returnValueClassFactory.create();
__returnValue.setDelegate(true);
__returnValue.bindNativeObject(__instancePointer, "IFeature");
}
return __returnValue;
}
native private static boolean readDatasetModelOrigTexture_EVString_EVString_EVString_FeatureVector_TextureStreamVector(String datasourceName, String datasetName, String octCode, long origFeatureVec, long imgTextures);
/**
* 读取实体数据集模型的大纹理
* @param
*/
public static boolean readDatasetModelOrigTexture(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial3d.dataset.FeatureVector origFeatureVec, com.earthview.world.spatial3d.dataset.TextureStreamVector imgTextures)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long origFeatureVecParamValue = origFeatureVec.nativeObject.pointer;
long imgTexturesParamValue = imgTextures.nativeObject.pointer;
boolean returnValue = readDatasetModelOrigTexture_EVString_EVString_EVString_FeatureVector_TextureStreamVector(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, origFeatureVecParamValue, imgTexturesParamValue);
return returnValue;
}
native private static boolean readTemplDatasetOrigTexture_EVString_EVString_EVString_FeatureVector_TextureStreamVector(String datasourceName, String datasetName, String octCode, long origFeatureVec, long texStreams);
/**
* 读取实体模型库数据集模型的大纹理
* @param
*/
public static boolean readTemplDatasetOrigTexture(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial3d.dataset.FeatureVector origFeatureVec, com.earthview.world.spatial3d.dataset.TextureStreamVector texStreams)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long origFeatureVecParamValue = origFeatureVec.nativeObject.pointer;
long texStreamsParamValue = texStreams.nativeObject.pointer;
boolean returnValue = readTemplDatasetOrigTexture_EVString_EVString_EVString_FeatureVector_TextureStreamVector(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, origFeatureVecParamValue, texStreamsParamValue);
return returnValue;
}
native private static long readMeshTemplID_EVString_EVString_ev_uint32(String datasourceName, String datasetName, long meshInstID);
public static long readMeshTemplID(String datasourceName, String datasetName, long meshInstID)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
long meshInstIDParamValue = meshInstID;
long returnValue = readMeshTemplID_EVString_EVString_ev_uint32(datasourceNameParamValue, datasetNameParamValue, meshInstIDParamValue);
return returnValue;
}
native private static boolean readDatasetAniDataStream_EVString_EVString_EVString_ev_uint32_MemoryDataStreamPtr(String datasourceName, String datasetName, String octCode, long meshID, long stream);
/**
* 读本地模型数据集anifeature
* @param
*/
public static boolean readDatasetAniDataStream(String datasourceName, String datasetName, String octCode, long meshID, com.earthview.world.core.MemoryDataStreamPtr stream)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long meshIDParamValue = meshID;
long streamParamValue = stream.nativeObject.pointer;
boolean returnValue = readDatasetAniDataStream_EVString_EVString_EVString_ev_uint32_MemoryDataStreamPtr(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, meshIDParamValue, streamParamValue);
return returnValue;
}
native private static boolean readTemplAniDataStream_EVString_EVString_ev_uint32_MemoryDataStreamPtr(String datasourceName, String datasetName, long meshID, long stream);
/**
* 读取模型库的anifeature
* @param
*/
public static boolean readTemplAniDataStream(String datasourceName, String datasetName, long meshID, com.earthview.world.core.MemoryDataStreamPtr stream)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
long meshIDParamValue = meshID;
long streamParamValue = stream.nativeObject.pointer;
boolean returnValue = readTemplAniDataStream_EVString_EVString_ev_uint32_MemoryDataStreamPtr(datasourceNameParamValue, datasetNameParamValue, meshIDParamValue, streamParamValue);
return returnValue;
}
native private static boolean writeDatasetModelOrigTexture_EVString_EVString_EVString_FeatureVector(String datasourceName, String datasetName, String octCode, long origFeatureVec);
/**
* 缓存实体数据集大纹理
* @param
*/
public static boolean writeDatasetModelOrigTexture(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial3d.dataset.FeatureVector origFeatureVec)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long origFeatureVecParamValue = origFeatureVec.nativeObject.pointer;
boolean returnValue = writeDatasetModelOrigTexture_EVString_EVString_EVString_FeatureVector(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, origFeatureVecParamValue);
return returnValue;
}
native private static boolean writeTemplDatasetOrigTexture_EVString_EVString_EVString_FeatureVector(String datasourceName, String datasetName, String octCode, long origFeatureVec);
/**
* 缓存实体模型库数据集大纹理
* @param
*/
public static boolean writeTemplDatasetOrigTexture(String datasourceName, String datasetName, String octCode, com.earthview.world.spatial3d.dataset.FeatureVector origFeatureVec)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
String octCodeParamValue = octCode;
long origFeatureVecParamValue = origFeatureVec.nativeObject.pointer;
boolean returnValue = writeTemplDatasetOrigTexture_EVString_EVString_EVString_FeatureVector(datasourceNameParamValue, datasetNameParamValue, octCodeParamValue, origFeatureVecParamValue);
return returnValue;
}
native private static void updateAltitudeMode_EVString_EVString_EVDatasetType_EVAltitudeMode_ev_real64(String datasourceName, String datasetName, int type, int altitudeMode, double altitudeValue);
/**
* 修改缓存中的高度模式
* @param
*/
public static void updateAltitudeMode(String datasourceName, String datasetName, com.earthview.world.spatial.geodataset.EVDatasetType type, com.earthview.world.spatial.utility.EVAltitudeMode altitudeMode, double altitudeValue)
{
String datasourceNameParamValue = datasourceName;
String datasetNameParamValue = datasetName;
int typeParamValue = type.getValue();
int altitudeModeParamValue = altitudeMode.getValue();
double altitudeValueParamValue = altitudeValue;
updateAltitudeMode_EVString_EVString_EVDatasetType_EVAltitudeMode_ev_real64(datasourceNameParamValue, datasetNameParamValue, typeParamValue, altitudeModeParamValue, altitudeValueParamValue);
}
public ModelCacheUtility(CreatedWhenConstruct cwc) {
super(CreatedWhenConstruct.CWC_NotToCreate);
}
public ModelCacheUtility(CreatedWhenConstruct cwc, String classNameStr) {
super(CreatedWhenConstruct.CWC_NotToCreate, classNameStr);
}
public static ModelCacheUtility fromBaseObject(BaseObject baseObj)
{
if (baseObj == null || InstancePointer.ZERO.equals(baseObj.nativeObject))
{
return null;
}
ModelCacheUtility obj = null;
if(baseObj instanceof ModelCacheUtility)
{
obj = (ModelCacheUtility)baseObj;
} else {
obj = new ModelCacheUtility(CreatedWhenConstruct.CWC_NotToCreate);
obj.bindNativeObject(baseObj.nativeObject, "CModelCacheUtility");
obj.increaseCast();
}
return obj;
}
}
| [
"[email protected]"
] | |
50ccdd48691a17c63a2e4ff9c5a7721b487db895 | f24169e7a8f3f1b32b85c118e651c70e1a1470ad | /engine/src/main/java/com/android/zxb/engine/view/ChooseOnePopupWindow.java | 00b9671a86f073a22b9a7ebfb16256fc14b58452 | [] | no_license | 0xE4s0n/ruanjianbei | a2e691d461a10931c46125f8d98130246dd5aabc | 08300395148acfb2075f7f7ad93875e5968ed05f | refs/heads/master | 2020-09-11T05:52:56.848181 | 2019-12-29T06:56:21 | 2019-12-29T06:56:21 | 221,961,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,478 | java | package com.android.zxb.engine.view;
import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.android.zxb.engine.R;
import com.android.zxb.engine.base.ui.view.BasePopupWindow;
/**
* 必须单选弹出框
* created by zhaoxiangbin on 2019/3/27 16:03
* [email protected]
*/
public class ChooseOnePopupWindow extends BasePopupWindow {
private Context mContext;
private String[] mDatas;
private String mTitleValue;
private int selected = 0;
private TextView mTitleView;
private RecyclerView mListView;
private OneAdapter mAdapter;
public ChooseOnePopupWindow(Activity context, String[] data, String title, int choosed) {
super(context);
this.mContext = context;
this.mDatas = data;
this.mTitleValue = title;
this.selected = choosed;
initView();
initPopWindow();
}
public void setOnItemClickListener(OnItemClickListener ck) {
this.mOnItemClickListener = ck;
}
private OnItemClickListener mOnItemClickListener;
public interface OnItemClickListener {
void onItemClick(int position);
}
@Override
public void getLayoutView() {
view = inflater.inflate(R.layout.pop_choose_one_layout, null);
}
@Override
public void initView() {
mTitleView = view.findViewById(R.id.pop_title);
mListView = view.findViewById(R.id.choose_one_list);
mListView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
initData();
}
private void initData() {
mTitleView.setText(mTitleValue);
mAdapter = new OneAdapter();
mListView.setAdapter(mAdapter);
}
class OneAdapter extends RecyclerView.Adapter<OneAdapter.ViewHolder> {
public OneAdapter() {
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(mContext).inflate(R.layout.item_choose_one, parent, false);
return new OneAdapter.ViewHolder(view);
}
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
holder.itemTxv.setText(mDatas[position]);
if (selected == position) {
holder.itemSelectImg.setImageResource(R.drawable.btn_bk_gongkai_s);
} else {
holder.itemSelectImg.setImageResource(R.drawable.btn_bk_gongkai_n);
}
holder.itemTxv.setOnClickListener(v -> {
if (selected != position) {
selected = position;
mOnItemClickListener.onItemClick(selected);
}
dismiss();
});
}
@Override
public int getItemCount() {
return mDatas.length;
}
class ViewHolder extends RecyclerView.ViewHolder {
TextView itemTxv;
ImageView itemSelectImg;
public ViewHolder(View view) {
super(view);
itemTxv = view.findViewById(R.id.item_title);
itemSelectImg = view.findViewById(R.id.item_select);
}
}
}
}
| [
"[email protected]"
] | |
b7011c0f91f87d96bcc756c050579d5d0fdcfe75 | 95e944448000c08dd3d6915abb468767c9f29d3c | /sources/com/p280ss/android/ugc/aweme/newfollow/p1424vh/UpLoadRecoverItemViewHolder_ViewBinding.java | d18428062eee7fb0bcc5aa5bee1e6f81dc010179 | [] | no_license | xrealm/tiktok-src | 261b1faaf7b39d64bb7cb4106dc1a35963bd6868 | 90f305b5f981d39cfb313d75ab231326c9fca597 | refs/heads/master | 2022-11-12T06:43:07.401661 | 2020-07-04T20:21:12 | 2020-07-04T20:21:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,134 | java | package com.p280ss.android.ugc.aweme.newfollow.p1424vh;
import android.view.View;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import butterknife.Unbinder;
import butterknife.internal.Utils;
import com.p280ss.android.ugc.aweme.base.p308ui.RemoteImageView;
import com.zhiliaoapp.musically.df_live_zego_link.R;
/* renamed from: com.ss.android.ugc.aweme.newfollow.vh.UpLoadRecoverItemViewHolder_ViewBinding */
public class UpLoadRecoverItemViewHolder_ViewBinding implements Unbinder {
/* renamed from: a */
private UpLoadRecoverItemViewHolder f89378a;
public void unbind() {
UpLoadRecoverItemViewHolder upLoadRecoverItemViewHolder = this.f89378a;
if (upLoadRecoverItemViewHolder != null) {
this.f89378a = null;
upLoadRecoverItemViewHolder.mCoverImage = null;
upLoadRecoverItemViewHolder.mTextView = null;
upLoadRecoverItemViewHolder.mProgressBar = null;
upLoadRecoverItemViewHolder.mIvClose = null;
upLoadRecoverItemViewHolder.mIvRefresh = null;
return;
}
throw new IllegalStateException("Bindings already cleared.");
}
public UpLoadRecoverItemViewHolder_ViewBinding(UpLoadRecoverItemViewHolder upLoadRecoverItemViewHolder, View view) {
this.f89378a = upLoadRecoverItemViewHolder;
upLoadRecoverItemViewHolder.mCoverImage = (RemoteImageView) Utils.findRequiredViewAsType(view, R.id.a4j, "field 'mCoverImage'", RemoteImageView.class);
upLoadRecoverItemViewHolder.mTextView = (TextView) Utils.findRequiredViewAsType(view, R.id.e8a, "field 'mTextView'", TextView.class);
upLoadRecoverItemViewHolder.mProgressBar = (ProgressBar) Utils.findRequiredViewAsType(view, R.id.e8c, "field 'mProgressBar'", ProgressBar.class);
upLoadRecoverItemViewHolder.mIvClose = (ImageView) Utils.findRequiredViewAsType(view, R.id.b7g, "field 'mIvClose'", ImageView.class);
upLoadRecoverItemViewHolder.mIvRefresh = (ImageView) Utils.findRequiredViewAsType(view, R.id.bbg, "field 'mIvRefresh'", ImageView.class);
}
}
| [
"[email protected]"
] | |
1033a0a1a1f378c3c31beb54923dcf6b2b623f72 | fe62b66b1f1d36b5c25204468740bd7168acaf7d | /StubsTutorial/test/com/vodafone/test/BasicCalculatorStub.java | 37245707b352694687a7ffef961bc3a010afa362 | [] | no_license | mahwishriazjamil/TDDQA | 0ffc0d2405a4ec98cf4b74b3024eab4b2c36d9a7 | 55fcd8a25eb06ed5173cce7e0f2c9dcf0b3edb39 | refs/heads/master | 2020-04-11T12:29:22.941361 | 2018-12-14T12:34:50 | 2018-12-14T12:34:50 | 161,782,222 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 349 | java | package com.vodafone.test;
import com.company.BasicCalculatorService;
public class BasicCalculatorStub implements BasicCalculatorService {
public BasicCalculatorStub(){
}
@Override
public double fibonacciAdd(double x, double y) {
return 9999;
}
@Override
public double fibonacciSubtract(double x, double y) {
return -9999;
}
}
| [
"[email protected]"
] | |
b8a80034452f9be561b8e7e6efeefe3dc75d7515 | ff316044df4c523d284f19d5d2bfb546dd43da18 | /src/main/java/com/jikexueyuan/demo/springmvc/lesson6/controller/ProductController.java | 8e38e1b94433423ec35a94e36af5cf618c3f9e64 | [] | no_license | missionagain/FinalExam3 | 0500321be748fe161b6b9facef617738d9172155 | d51bdee67aa30e089155d46be2a5daaac2f3973f | refs/heads/master | 2020-06-30T15:02:57.136075 | 2016-11-21T13:07:27 | 2016-11-21T13:07:27 | 74,364,242 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,408 | java | package com.jikexueyuan.demo.springmvc.lesson6.controller;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import com.jikexueyuan.demo.springmvc.lesson6.dao.ProductDao;
import com.jikexueyuan.demo.springmvc.lesson6.entity.Product;
import com.jikexueyuan.demo.springmvc.lesson6.entity.User;
@Controller
public class ProductController {
@Resource
ProductDao pdtDao;
@RequestMapping(value="/editsave")
public String saveProduct(@ModelAttribute Product pdt,Model model){
pdtDao.Save(pdt);
model.addAttribute("pdt", pdt);
List<Product> pdtList=new ArrayList<Product>();
pdtList=pdtDao.searchAll();
model.addAttribute("pdtList", pdtList);
User user=new User();
user.setUserName("LEO");
user.setUserType(0);
model.addAttribute("user", user);
return "index";
}
@RequestMapping(value="/show/{id}")
public String showProduct(@PathVariable("id")int id,Model model){
Product pdt2=pdtDao.search(id);
model.addAttribute("product",pdt2);
return "show";
}
@RequestMapping(value="/account")
public String showAccount(){
return"redirect:/account.html";
}
}
| [
"[email protected]"
] | |
30034d93ae948b8fce6526168186c8f070dd2381 | 7a8e18ad7ad1cdc6b3a91ca4ff5d402d0d20be17 | /CFT/elasticsearch/c1d44780675a9ff43e87a44f62969a0214928988/TransportAction.java/anc_TransportAction.java | 08de1dfc072749945af49c4f0adef084f34099b1 | [] | no_license | mandelbrotset/Test | ec5d5ad5b29d28240f6d21073b41ca60070404b1 | 2a119c9a6077dce184d2edb872489f3f2c5d872e | refs/heads/master | 2021-01-21T04:46:42.441186 | 2016-06-30T15:10:39 | 2016-06-30T15:10:39 | 50,836,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,406 | java | /*
* Licensed to Elasticsearch under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.elasticsearch.action.support;
import org.elasticsearch.action.ActionFuture;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.common.ParseFieldMatcher;
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.logging.ESLogger;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.tasks.Task;
import org.elasticsearch.tasks.TaskManager;
import org.elasticsearch.threadpool.ThreadPool;
import java.util.concurrent.atomic.AtomicInteger;
import static org.elasticsearch.action.support.PlainActionFuture.newFuture;
/**
*
*/
public abstract class TransportAction<Request extends ActionRequest<Request>, Response extends ActionResponse> extends AbstractComponent {
protected final ThreadPool threadPool;
protected final String actionName;
private final ActionFilter[] filters;
protected final ParseFieldMatcher parseFieldMatcher;
protected final IndexNameExpressionResolver indexNameExpressionResolver;
protected final TaskManager taskManager;
protected TransportAction(Settings settings, String actionName, ThreadPool threadPool, ActionFilters actionFilters,
IndexNameExpressionResolver indexNameExpressionResolver, TaskManager taskManager) {
super(settings);
this.threadPool = threadPool;
this.actionName = actionName;
this.filters = actionFilters.filters();
this.parseFieldMatcher = new ParseFieldMatcher(settings);
this.indexNameExpressionResolver = indexNameExpressionResolver;
this.taskManager = taskManager;
}
public final ActionFuture<Response> execute(Request request) {
PlainActionFuture<Response> future = newFuture();
execute(request, future);
return future;
}
public final Task execute(Request request, ActionListener<Response> listener) {
Task task = taskManager.register("transport", actionName, request);
if (task == null) {
execute(null, request, listener);
} else {
execute(task, request, new ActionListener<Response>() {
@Override
public void onResponse(Response response) {
taskManager.unregister(task);
listener.onResponse(response);
}
@Override
public void onFailure(Throwable e) {
taskManager.unregister(task);
listener.onFailure(e);
}
});
}
return task;
}
private final void execute(Task task, Request request, ActionListener<Response> listener) {
ActionRequestValidationException validationException = request.validate();
if (validationException != null) {
listener.onFailure(validationException);
return;
}
if (filters.length == 0) {
try {
doExecute(task, request, listener);
} catch(Throwable t) {
logger.trace("Error during transport action execution.", t);
listener.onFailure(t);
}
} else {
RequestFilterChain requestFilterChain = new RequestFilterChain<>(this, logger);
requestFilterChain.proceed(task, actionName, request, listener);
}
}
protected void doExecute(Task task, Request request, ActionListener<Response> listener) {
doExecute(request, listener);
}
protected abstract void doExecute(Request request, ActionListener<Response> listener);
private static class RequestFilterChain<Request extends ActionRequest<Request>, Response extends ActionResponse> implements ActionFilterChain {
private final TransportAction<Request, Response> action;
private final AtomicInteger index = new AtomicInteger();
private final ESLogger logger;
private RequestFilterChain(TransportAction<Request, Response> action, ESLogger logger) {
this.action = action;
this.logger = logger;
}
@Override @SuppressWarnings("unchecked")
public void proceed(Task task, String actionName, ActionRequest request, ActionListener listener) {
int i = index.getAndIncrement();
try {
if (i < this.action.filters.length) {
this.action.filters[i].apply(task, actionName, request, listener, this);
} else if (i == this.action.filters.length) {
this.action.doExecute(task, (Request) request, new FilteredActionListener<Response>(actionName, listener, new ResponseFilterChain(this.action.filters, logger)));
} else {
listener.onFailure(new IllegalStateException("proceed was called too many times"));
}
} catch(Throwable t) {
logger.trace("Error during transport action execution.", t);
listener.onFailure(t);
}
}
@Override
public void proceed(String action, ActionResponse response, ActionListener listener) {
assert false : "request filter chain should never be called on the response side";
}
}
private static class ResponseFilterChain implements ActionFilterChain {
private final ActionFilter[] filters;
private final AtomicInteger index;
private final ESLogger logger;
private ResponseFilterChain(ActionFilter[] filters, ESLogger logger) {
this.filters = filters;
this.index = new AtomicInteger(filters.length);
this.logger = logger;
}
@Override
public void proceed(Task task, String action, ActionRequest request, ActionListener listener) {
assert false : "response filter chain should never be called on the request side";
}
@Override @SuppressWarnings("unchecked")
public void proceed(String action, ActionResponse response, ActionListener listener) {
int i = index.decrementAndGet();
try {
if (i >= 0) {
filters[i].apply(action, response, listener, this);
} else if (i == -1) {
listener.onResponse(response);
} else {
listener.onFailure(new IllegalStateException("proceed was called too many times"));
}
} catch (Throwable t) {
logger.trace("Error during transport action execution.", t);
listener.onFailure(t);
}
}
}
private static class FilteredActionListener<Response extends ActionResponse> implements ActionListener<Response> {
private final String actionName;
private final ActionListener listener;
private final ResponseFilterChain chain;
private FilteredActionListener(String actionName, ActionListener listener, ResponseFilterChain chain) {
this.actionName = actionName;
this.listener = listener;
this.chain = chain;
}
@Override
public void onResponse(Response response) {
chain.proceed(actionName, response, listener);
}
@Override
public void onFailure(Throwable e) {
listener.onFailure(e);
}
}
} | [
"[email protected]"
] | |
2da40e98004c894a0488b0c6b29a7f7ac0b64d58 | 4f13f9c4bca764f504a778b26da0fadd2ac3cf38 | /src/test/java/RestApi.java | 74ea9cdf65b5c9ebcd20181a50d54f3ca0886c8f | [] | no_license | MakmoKGZ/apiWeek2Project | 7771cb824a47b693f67e9987180e95ba90871bab | 8123135b3f77eda1a5a8f7f5db6ad55f1bcaed56 | refs/heads/master | 2022-12-23T07:28:58.710300 | 2020-10-02T22:23:51 | 2020-10-02T22:23:51 | 300,746,879 | 0 | 1 | null | 2020-10-02T22:29:25 | 2020-10-02T22:10:04 | Java | UTF-8 | Java | false | false | 335 | java | import java.net.http.HttpResponse;
public class RestApi {
HttpResponse<String> httpResponse = Unirest.get(“<some_url>/<endpoint>?param1=value1¶m2=value2”)
.header("header1", header1)
.header("header2", header2);
.asString();
System.out.println( httpResponse.getHeaders().get("Content-Type"));
}
| [
"[email protected]"
] | |
a3c8268012161f48f8b0e96c973d292f3b5c9237 | e598b7af2153958ccc3162063d071f0f697efbe8 | /app/src/main/java/io/andronicus/todomvp/tasks/TasksFilterType.java | a5a83aad17fc9a61ac42482282c5874cbb43297e | [
"Apache-2.0"
] | permissive | andronicus-kim/TodoMVP | 141a7921aa737eab363c790e38f157edb6d5735f | 05c1e7c102addda3a74c5c0b249e4a8f777fe549 | refs/heads/master | 2020-03-13T13:56:27.322219 | 2018-05-02T14:20:44 | 2018-05-02T14:20:44 | 131,148,393 | 0 | 0 | null | 2018-04-26T12:11:13 | 2018-04-26T11:53:25 | Java | UTF-8 | Java | false | false | 669 | java | /*
* Copyright (C) 2018 Andronicus
*
* 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.andronicus.todomvp.tasks;
public enum TasksFilterType {
}
| [
"[email protected]"
] | |
5c3c28328a224f873fc7797f0b5323154e554974 | 6482753b5eb6357e7fe70e3057195e91682db323 | /com/google/common/primitives/Primitives.java | 78b5a7e1e631625e868c74fad416541b04a8470c | [] | no_license | TheShermanTanker/Server-1.16.3 | 45cf9996afa4cd4d8963f8fd0588ae4ee9dca93c | 48cc08cb94c3094ebddb6ccfb4ea25538492bebf | refs/heads/master | 2022-12-19T02:20:01.786819 | 2020-09-18T21:29:40 | 2020-09-18T21:29:40 | 296,730,962 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,654 | java | package com.google.common.primitives;
import java.util.Collections;
import java.util.HashMap;
import com.google.common.base.Preconditions;
import java.util.Set;
import java.util.Map;
import com.google.common.annotations.GwtIncompatible;
@GwtIncompatible
public final class Primitives {
private static final Map<Class<?>, Class<?>> PRIMITIVE_TO_WRAPPER_TYPE;
private static final Map<Class<?>, Class<?>> WRAPPER_TO_PRIMITIVE_TYPE;
private Primitives() {
}
private static void add(final Map<Class<?>, Class<?>> forward, final Map<Class<?>, Class<?>> backward, final Class<?> key, final Class<?> value) {
forward.put(key, value);
backward.put(value, key);
}
public static Set<Class<?>> allPrimitiveTypes() {
return (Set<Class<?>>)Primitives.PRIMITIVE_TO_WRAPPER_TYPE.keySet();
}
public static Set<Class<?>> allWrapperTypes() {
return (Set<Class<?>>)Primitives.WRAPPER_TO_PRIMITIVE_TYPE.keySet();
}
public static boolean isWrapperType(final Class<?> type) {
return Primitives.WRAPPER_TO_PRIMITIVE_TYPE.containsKey(Preconditions.<Class<?>>checkNotNull(type));
}
public static <T> Class<T> wrap(final Class<T> type) {
Preconditions.<Class<T>>checkNotNull(type);
final Class<T> wrapped = (Class<T>)Primitives.PRIMITIVE_TO_WRAPPER_TYPE.get(type);
return (wrapped == null) ? type : wrapped;
}
public static <T> Class<T> unwrap(final Class<T> type) {
Preconditions.<Class<T>>checkNotNull(type);
final Class<T> unwrapped = (Class<T>)Primitives.WRAPPER_TO_PRIMITIVE_TYPE.get(type);
return (unwrapped == null) ? type : unwrapped;
}
static {
final Map<Class<?>, Class<?>> primToWrap = (Map<Class<?>, Class<?>>)new HashMap(16);
final Map<Class<?>, Class<?>> wrapToPrim = (Map<Class<?>, Class<?>>)new HashMap(16);
add(primToWrap, wrapToPrim, Boolean.TYPE, Boolean.class);
add(primToWrap, wrapToPrim, Byte.TYPE, Byte.class);
add(primToWrap, wrapToPrim, Character.TYPE, Character.class);
add(primToWrap, wrapToPrim, Double.TYPE, Double.class);
add(primToWrap, wrapToPrim, Float.TYPE, Float.class);
add(primToWrap, wrapToPrim, Integer.TYPE, Integer.class);
add(primToWrap, wrapToPrim, Long.TYPE, Long.class);
add(primToWrap, wrapToPrim, Short.TYPE, Short.class);
add(primToWrap, wrapToPrim, Void.TYPE, Void.class);
PRIMITIVE_TO_WRAPPER_TYPE = Collections.unmodifiableMap((Map)primToWrap);
WRAPPER_TO_PRIMITIVE_TYPE = Collections.unmodifiableMap((Map)wrapToPrim);
}
}
| [
"[email protected]"
] | |
8b3aee449f3b965b9d5d42a3b2f57a143d4514c0 | d45a868d611564fd4c0bab2086ac123c8a9f4946 | /src/main/java/com/wishlist/gateway/proxy/filters/PreFilter.java | 1c999e72398bd1409b40533e23d0500894d6d5d3 | [] | no_license | mailtosunil/wishlist-gateway | 9bda1e115c593352646f9af67c69347745659b1a | 873180fd482deb635b735118a6e4eaf36ab6cd12 | refs/heads/master | 2020-04-14T05:27:43.921215 | 2019-01-02T08:41:30 | 2019-01-02T08:41:30 | 163,661,301 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 793 | java | package com.wishlist.gateway.proxy.filters;
import javax.servlet.http.HttpServletRequest;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
public class PreFilter extends ZuulFilter {
public PreFilter() {
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() throws ZuulException {
RequestContext context = RequestContext.getCurrentContext();
HttpServletRequest request = context.getRequest();
System.out.println(
"Request method: " + request.getMethod() + " Request URL: " + request.getRequestURL().toString());
return null;
}
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 1;
}
}
| [
"[email protected]"
] | |
a69b668494285de76c367a004923b6c35810f26c | 8040df49b97cec82eb87d906580c0d0870f68217 | /labor_no_lectiva/src/labor_no_lectiva/buscar_docente.java | 09c438cdb2631ba1186210a9d84d959b26731595 | [] | no_license | frank93rodriguez/labor_no_lectiva | 8d656b3a6b8eba74680006f095a7035fde1165e5 | 342c9b5279b57f0784a0dd17ae46ce911e4be404 | refs/heads/master | 2021-05-05T18:18:55.652551 | 2017-09-15T01:42:48 | 2017-09-15T01:42:48 | 103,599,924 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,207 | java | package labor_no_lectiva;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@SuppressWarnings("serial")
public class buscar_docente extends HttpServlet{
public docente buscar_docentes(String correo , String pass , ArrayList<docente> docs){
if(docs==null){return null;}
for(docente docen : docs){
if(docen.getCorreo_electronico().equals(correo) && docen.getPass().equals(pass)){
return docen;
}
}
return null;
}
@SuppressWarnings("unchecked")
public void doPost(HttpServletRequest req, HttpServletResponse resp)throws IOException {
String correo = req.getParameter("correo").trim();
String pass = req.getParameter("pass").trim();
ArrayList<docente> docentes = (ArrayList<docente>) getServletContext().getAttribute("docentes");
docente docente_actual = buscar_docentes(correo,pass,docentes);
if(docente_actual!=null){
getServletContext().setAttribute("docente_actual", docente_actual);
resp.sendRedirect("investigacion.jsp");
}
else{
resp.sendRedirect("error_buscar.jsp");
}
}
}
| [
"[email protected]"
] | |
e81c70491609cd00fa968eb794a5029e3db1516e | a3a7d359877d69c2f0c0800cbefd70abff738ce1 | /src/obligatoriodda/dominio/Observer.java | a0951e43ebb4860a2f61415f0b7466e989aa975c | [] | no_license | Tiaghovski/Obg-DDA | a47129aebb041fb2922ee027cc13bbe0a28375bd | 31eeed863dfe492c0de584069309b9088d28681f | refs/heads/master | 2022-12-31T03:20:42.250029 | 2020-10-17T02:56:30 | 2020-10-17T02:56:30 | 304,784,622 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package obligatoriodda.dominio;
/**
*
* @author alumno
*/
public interface Observer {
void Update(Observable o, Object evento);
}
| [
"[email protected]"
] | |
628d58ffa8436d7198b3c9fbd9ee8dbc594b747b | 30262e2c47316143de877ea797702cbe98b6eca3 | /chess-demo/src/main/java/com/len/chessdemo/elements/Tile.java | ac3c225c99052d11cacae4828d9715508ffc32ee | [] | no_license | lennemo09/chess-engine-spring | 5bb7f1e00292eb671ffcaad434f04ac6fb65e004 | 36e015d65a81a943fab80a803ca6883d1693cc7d | refs/heads/main | 2023-03-13T09:40:45.462402 | 2021-03-04T08:05:10 | 2021-03-04T08:05:10 | 344,359,516 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 522 | java | package com.len.chessdemo.elements;
import com.len.chessdemo.utils.Position;
public class Tile {
private Piece piece;
private Position pos;
public Tile(Position pos, Piece piece) {
this.setPiece(piece);
this.setPos(pos);
}
public Piece getPiece() {
return piece;
}
public void setPiece(Piece piece) {
this.piece = piece;
}
public Position getPos() {
return pos;
}
public void setPos(Position pos) {
this.pos = pos;
}
}
| [
"[email protected]"
] | |
35a081963ee4aa32bfb4447ea8b6ef5d3d51cf9b | 9127f9dcf78802d3838fb75b70b7f5a06970a5db | /Java/Labs/Labs_OOP/Lab 6/src/src/ru/mirea/lab6/_1/Blackmirror.java | 313219c2d83cd0cdcc87779e356ff2df19c5fa97 | [] | no_license | Destinyr4zr/4sem | 1d725e49222495876f8688073bb5410106c27cec | 897cb97b6b446c7b131f5527a617db5f29887ec5 | refs/heads/master | 2021-04-20T14:01:50.403566 | 2020-03-24T13:19:04 | 2020-03-24T13:19:04 | 249,689,974 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 179 | java | package src.ru.mirea.lab6._1;
public class Blackmirror {
public static void main(String[] args){
Game message = new Game();
message.setVisible(true);
}
}
| [
"[email protected]"
] | |
328805ba8761c4a4f46e5ddd31a13ca40be7826c | 53e1a48014eed3f5c07ada1e09836d5c54f13857 | /yhzh/project/hxpt/Model/src/com/yhzh/biz/impl/DataObjectBizImpl.java | 742f352d0f137dea4143173f3ea3d9cb4f7fae17 | [] | no_license | yunhuazhihuii/yhzh | 64f64758a97a4a721b142f3c6ed8ecbf83979f66 | 215fd8c956c02a3392d6a8b9d98ad87dafc94afb | refs/heads/master | 2020-03-10T01:18:39.036057 | 2019-04-04T03:12:29 | 2019-04-04T03:12:29 | 129,106,198 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,537 | java | package com.yhzh.biz.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.yhzh.biz.DataObjectBiz;
import com.yhzh.dao.DataObjectDao;
import com.yhzh.pojo.S0000002;
import com.yhzh.pojo.S1120000;
import net.sf.json.JSONObject;
public class DataObjectBizImpl implements DataObjectBiz {
@Resource
DataObjectDao dataObjectDao;
@Override
public String CreateDataObject(String DataObjectString) {
StringBuffer sb = new StringBuffer();
try {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置日期格式
String date = df.format(new Date());
// 将字符串转换成json对象
JSONObject jsonObject1 = new JSONObject().fromObject(DataObjectString);
S1120000 s1120000 = new S1120000();
s1120000.setF1(jsonObject1.getString("ServerCode"));
String F2 = dataObjectDao.AutoGetCode("08");// 查询数据对象编码
s1120000.setF2(F2);
s1120000.setF3(jsonObject1.getString("DataObjectName"));
s1120000.setF4(jsonObject1.getString("DataObjectDesc"));
s1120000.setF5(date);
s1120000.setF6("1");
// 更新到s1120000表中
dataObjectDao.insertS1120000(s1120000);
// 更新到s0000002表中
S0000002 s0000002 = new S0000002();
s0000002.setF1(jsonObject1.getString("ServerCode"));// 服务编码
s0000002.setF2(F2);// 节点编码
s0000002.setF3(jsonObject1.getString("DataObjectName"));// 节点名称
s0000002.setF4("1120000");// 对象类别
s0000002.setF5("1");// 对象状态
s0000002.setF6(jsonObject1.getString("ParentId"));// 父节点
dataObjectDao.insertS0000002(s0000002);
sb.append("{isSuccess:1,");
sb.append("resultMessage:").append("'CreateDataObject success!'").append("}");
} catch (Exception e) {
// TODO Auto-generated catch block
sb.append("{isSuccess:0,");
sb.append("resultMessage:").append("'CreateDataObject error!'").append(",");
sb.append("failMessage:").append('"' + e.toString() + '"').append("}");
e.printStackTrace();
}
JSONObject jsonObject = new JSONObject().fromObject(sb.toString());
return jsonObject.toString();
}
@Override
public String findS1120000ByDataObjectCode(String DataObjectCode) {
StringBuffer sb = new StringBuffer();
try {
List<Map<String, Object>> findS1120000ByDataObjectCode = dataObjectDao
.findS1120000ByDataObjectCode(DataObjectCode);
List<Object> list = new ArrayList<Object>();
for (Map<String, Object> map : findS1120000ByDataObjectCode) {
String F1 = (String) map.get("F1");
String F2 = (String) map.get("F2");
String F3 = (String) map.get("F3");
String F4 = (String) map.get("F4");
Date F5 = (Date) map.get("F5");
String F6 = (String) map.get("F6");
String string = "{'F1':'" + F1 + "','F2':'" + F2 + "','F3':'" + F3 + "','F4':'" + F4 + "','F5':'" + F5
+ "','F6':'" + F6 + "'}";
JSONObject jsonObject = new JSONObject().fromObject(string);
list.add(jsonObject);
}
sb.append("{isSuccess:1,");
sb.append("resultMessage:").append(list).append("}");
} catch (Exception e) {
sb.append("{isSuccess:0,");
sb.append("resultMessage:").append("'findS1000000ByServerCode error!'").append(",");
sb.append("failMessage:").append('"' + e.toString() + '"').append("}");
e.printStackTrace();
}
JSONObject jsonObject = new JSONObject().fromObject(sb.toString());
return jsonObject.toString();
}
@Override
public String UpdateDataObject(String DataObjectString) {
StringBuffer sb = new StringBuffer();
JSONObject jsonObject1 = new JSONObject().fromObject(DataObjectString);
try {
// 更新S1120000表
S1120000 s1120000 = new S1120000();
s1120000.setF1(jsonObject1.getString("F1"));
s1120000.setF2(jsonObject1.getString("F2"));
s1120000.setF3(jsonObject1.getString("F3"));
s1120000.setF4(jsonObject1.getString("F4"));
s1120000.setF5(jsonObject1.getString("F5"));
s1120000.setF6(jsonObject1.getString("F6"));
dataObjectDao.UpdateDataObject(s1120000);
// 更新S0000002表
S0000002 s0000002 = new S0000002();
s0000002.setF2((String) jsonObject1.get("F2"));// 设置编码
s0000002.setF3((String) jsonObject1.get("F3"));// 设置名称
dataObjectDao.updateS0000002(s0000002);
sb.append("{isSuccess:1,");
sb.append("resultMessage:").append("'UpdateDataObject success!'").append("}");
} catch (Exception e) {
sb.append("{isSuccess:0,");
sb.append("resultMessage:").append("'UpdateDataObject error!'").append(",");
sb.append("failMessage:").append('"' + e.toString() + '"').append("}");
e.printStackTrace();
}
JSONObject jsonObject = new JSONObject().fromObject(sb.toString());
return jsonObject.toString();
}
@Override
public String DeleteDataObject(String DataObjectCode) {
StringBuffer sb = new StringBuffer();
try {
// 先删除子节点
dataObjectDao.deleteS0000002ByCodeSub(DataObjectCode);
dataObjectDao.DeleteDataObject(DataObjectCode);
dataObjectDao.deleteS0000002ByCode(DataObjectCode);
sb.append("{isSuccess:1,");
sb.append("resultMessage:").append("'DeleteDataObject success!'").append("}");
} catch (Exception e) {
sb.append("{isSuccess:0,");
sb.append("resultMessage:").append("'DeleteDataObject error!'").append(",");
sb.append("failMessage:").append('"' + e.toString() + '"').append("}");
e.printStackTrace();
}
JSONObject jsonObject = new JSONObject().fromObject(sb.toString());
return jsonObject.toString();
}
}
| [
"[email protected]"
] | |
11aaa8936d54eca37596c252a18debf47e01ed17 | 91bd01ee4348d016cbc4a45b661ffda10007379d | /Comp-Graf/lib/gluegen-java-src/com/jogamp/common/util/IntegerStack.java | 233b321909b67c56a3401a54b6029f2ba87203e9 | [] | no_license | Paesdb/Comp-Graf | cac930256d5ecdfcad7b4c25207e28f4e5f07f19 | 4c7e12fa212f3839d059445b0fddb7216ec84240 | refs/heads/master | 2021-01-18T15:34:52.194599 | 2017-03-16T19:55:46 | 2017-03-16T19:55:46 | 84,346,162 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,674 | java | /**
* Copyright 2012 JogAmp Community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community 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.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
package com.jogamp.common.util;
import java.nio.BufferOverflowException;
import java.nio.BufferUnderflowException;
import java.nio.IntBuffer;
/**
* Simple primitive-type stack.
* <p>
* Implemented operations:
* <ul>
* <li>FILO - First In, Last Out</li>
* </ul>
* </p>
*/
public class /*name*/IntegerStack/*name*/ implements PrimitiveStack {
private int position;
private int[] buffer;
private int growSize;
/**
* @param initialSize initial size, must be > zero
* @param growSize grow size if {@link #position()} is reached, maybe <code>0</code>
* in which case an {@link IndexOutOfBoundsException} is thrown.
*/
public /*name*/IntegerStack/*name*/(final int initialSize, final int growSize) {
this.position = 0;
this.growSize = growSize;
this.buffer = new int[initialSize];
}
@Override
public final int capacity() { return buffer.length; }
@Override
public final int position() { return position; }
@Override
public final void position(final int newPosition) throws IndexOutOfBoundsException {
if( 0 > position || position >= buffer.length ) {
throw new IndexOutOfBoundsException("Invalid new position "+newPosition+", "+this.toString());
}
position = newPosition;
}
@Override
public final int remaining() { return buffer.length - position; }
@Override
public final int getGrowSize() { return growSize; }
@Override
public final void setGrowSize(final int newGrowSize) { growSize = newGrowSize; }
@Override
public final String toString() {
return "IntegerStack[0..(pos "+position+").."+buffer.length+", remaining "+remaining()+"]";
}
public final int[] buffer() { return buffer; }
private final void growIfNecessary(final int length) throws IndexOutOfBoundsException {
if( position + length > buffer.length ) {
if( 0 >= growSize ) {
throw new IndexOutOfBoundsException("Out of fixed stack size: "+this);
}
final int[] newBuffer =
new int[buffer.length + growSize];
System.arraycopy(buffer, 0, newBuffer, 0, position);
buffer = newBuffer;
}
}
/**
* FILO put operation
*
* @param src source buffer
* @param srcOffset offset of src
* @param length number of float elements to put from <code>src</code> on-top this stack
* @return the src float[]
* @throws IndexOutOfBoundsException if stack cannot grow due to zero grow-size or offset+length exceeds src.
*/
public final int[]
putOnTop(final int[] src, final int srcOffset, final int length) throws IndexOutOfBoundsException {
growIfNecessary(length);
System.arraycopy(src, srcOffset, buffer, position, length);
position += length;
return src;
}
/**
* FILO put operation
*
* @param src source buffer, it's position is incremented by <code>length</code>
* @param length number of float elements to put from <code>src</code> on-top this stack
* @return the src FloatBuffer
* @throws IndexOutOfBoundsException if stack cannot grow due to zero grow-size
* @throws BufferUnderflowException if <code>src</code> FloatBuffer has less remaining elements than <code>length</code>.
*/
public final IntBuffer
putOnTop(final IntBuffer src, final int length) throws IndexOutOfBoundsException, BufferUnderflowException {
growIfNecessary(length);
src.get(buffer, position, length);
position += length;
return src;
}
/**
* FILO get operation
*
* @param dest destination buffer
* @param destOffset offset of dest
* @param length number of float elements to get from-top this stack to <code>dest</code>.
* @return the dest float[]
* @throws IndexOutOfBoundsException if stack or <code>dest</code> has less elements than <code>length</code>.
*/
public final int[]
getFromTop(final int[] dest, final int destOffset, final int length) throws IndexOutOfBoundsException {
System.arraycopy(buffer, position-length, dest, destOffset, length);
position -= length;
return dest;
}
/**
* FILO get operation
*
* @param dest destination buffer, it's position is incremented by <code>length</code>.
* @param length number of float elements to get from-top this stack to <code>dest</code>.
* @return the dest FloatBuffer
* @throws IndexOutOfBoundsException if stack has less elements than length
* @throws BufferOverflowException if <code>src</code> FloatBuffer has less remaining elements than <code>length</code>.
*/
public final IntBuffer
getFromTop(final IntBuffer dest, final int length) throws IndexOutOfBoundsException, BufferOverflowException {
dest.put(buffer, position-length, length);
position -= length;
return dest;
}
}
| [
"[email protected]"
] | |
711c387d252a7454873676228b57d301ded5b2c7 | 171d3f42ea5a5bd582d7d67593fbb2e093ae3fb2 | /app/src/main/java/com/example/antonsskafferiapplication/OrderData.java | ae825c0a5aafbe08a1b15930419d2452cd1fae93 | [] | no_license | antons-skafferi/application | 086302771a15e65c713d1008abc9d6cb2ba64115 | 52ceaf437a9fccbf0ceb70a7de19625be7528dbe | refs/heads/master | 2020-04-23T16:50:56.452415 | 2019-03-19T08:27:49 | 2019-03-19T08:27:49 | 171,312,106 | 0 | 0 | null | 2019-02-18T20:40:20 | 2019-02-18T15:52:30 | null | UTF-8 | Java | false | false | 898 | java | package com.example.antonsskafferiapplication;
import android.util.Pair;
import java.util.ArrayList;
public class OrderData {
/*Is used in kitchenActivity to load complete orders from the database*/
private String tableNumber;
private String note;
private ArrayList<OrderDetails> orders;
public OrderData(String t){
orders = new ArrayList<>();
tableNumber = t;
}
public void addOrder(String orderName, String amount, String dateTime, String orderId){
OrderDetails orderDet = new OrderDetails(orderName, amount, dateTime, orderId);
orders.add(orderDet);
}
public void setNote(String n){
note = n;
}
public String getNotes(){
return note;
}
public String getTableNumber(){
return tableNumber;
}
public ArrayList<OrderDetails> getItems(){
return orders;
}
}
| [
"[email protected]"
] | |
95f39f7d8d804fd9e539751b9f0c77b21b09d894 | 50e6f9aaa002d7abaebba71d8191faf39595e156 | /x-pack/plugin/ccr/src/test/java/org/elasticsearch/xpack/ccr/CcrTests.java | 0a9ca00590b3dfbb09a5e91d39387cea2b305a4e | [
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-other-permissive",
"Apache-2.0",
"Elastic-2.0",
"LicenseRef-scancode-elastic-license-2018"
] | permissive | szbrain/elasticsearch | 7b272e880d2dbec46308f71138c13a9a4ff573c9 | c919cf789a8c91c7c7add782df2508f36e98dd8b | refs/heads/master | 2021-09-23T14:45:07.327250 | 2018-09-24T12:04:41 | 2018-09-24T12:04:41 | 107,561,273 | 0 | 0 | Apache-2.0 | 2018-09-24T12:04:42 | 2017-10-19T15:00:15 | Java | UTF-8 | Java | false | false | 2,337 | java | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.ccr;
import org.elasticsearch.Version;
import org.elasticsearch.cluster.metadata.IndexMetaData;
import org.elasticsearch.common.UUIDs;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.Index;
import org.elasticsearch.index.IndexSettings;
import org.elasticsearch.index.engine.EngineFactory;
import org.elasticsearch.test.ESTestCase;
import org.elasticsearch.xpack.ccr.Ccr;
import org.elasticsearch.xpack.ccr.index.engine.FollowingEngineFactory;
import java.io.IOException;
import java.util.Optional;
import static org.hamcrest.Matchers.instanceOf;
public class CcrTests extends ESTestCase {
public void testGetEngineFactory() throws IOException {
final Boolean[] values = new Boolean[] { true, false, null };
for (final Boolean value : values) {
final String indexName = "following-" + value;
final Index index = new Index(indexName, UUIDs.randomBase64UUID());
final Settings.Builder builder = Settings.builder()
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
.put(IndexMetaData.SETTING_INDEX_UUID, index.getUUID());
if (value != null) {
builder.put(CcrSettings.CCR_FOLLOWING_INDEX_SETTING.getKey(), value);
}
final IndexMetaData indexMetaData = new IndexMetaData.Builder(index.getName())
.settings(builder.build())
.numberOfShards(1)
.numberOfReplicas(0)
.build();
final Ccr ccr = new Ccr(Settings.EMPTY, new CcrLicenseChecker(() -> true));
final Optional<EngineFactory> engineFactory = ccr.getEngineFactory(new IndexSettings(indexMetaData, Settings.EMPTY));
if (value != null && value) {
assertTrue(engineFactory.isPresent());
assertThat(engineFactory.get(), instanceOf(FollowingEngineFactory.class));
} else {
assertFalse(engineFactory.isPresent());
}
}
}
}
| [
"[email protected]"
] | |
1950781369806112fe71935adb528affcaa81cb6 | 8957537f636c91c29ca7ba21ece7b96fc04feb11 | /lesson2/Account HW/abstractAccount.java | 6d1f23b9500e694c4e248c13c5db534abb986706 | [] | no_license | Ziyilan/Mobile-Proto-16 | a5c2d4366634a7c25b8788ce9577ac405417d346 | 7ca2bc65907d1f85155cd3e7e7f43b16f18011e6 | refs/heads/master | 2021-01-22T01:38:42.936470 | 2016-10-31T00:42:45 | 2016-10-31T00:42:45 | 67,151,413 | 0 | 0 | null | 2021-01-05T00:51:44 | 2016-09-01T17:17:03 | Java | UTF-8 | Java | false | false | 554 | java | public abstract class abstractAccount {
protected MoneySaver owner;
protected long amount;
public abstractAccount(long amount, MoneySaver owner){
this.amount = amount;
this.owner = owner;
}
public void deposit(long depositAmount){
}
public abstract long getAmount();
public abstract void setAmount(long amount);
public abstract MoneySaver getOwner();
public abstract String toString();
public static void main(String[] args){
abstractAccount aa = new abstractAccount(10, new MoneySaver("Jason", 3));
}
}
| [
"[email protected]"
] | |
2db30b4ca6f5b68e637c9631b59f983e1971de90 | ca4b516a4be70d1074d78bade6531ecabd611e0b | /hbase191208/hbase-mr/src/main/java/com/muye/hbase/reducer/InsertDataReducer.java | 900f793ca986c8a8a8c911aa2d486c4320b77b2d | [] | no_license | dancheng0/HBASE | 9eb9e159edf652e18bd5ca3e4211eacb12c151c6 | fa9eae53b294ef65fa01963ccbe4e269e1db1e93 | refs/heads/master | 2020-11-24T23:22:10.027016 | 2019-12-19T09:26:09 | 2019-12-19T09:26:09 | 228,384,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 748 | java | package com.muye.hbase.reducer;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.TableReducer;
import org.apache.hadoop.io.NullWritable;
import java.io.IOException;
/**
* @author : gwh
* @date : 2019-12-17 10:24
**/
public class InsertDataReducer extends TableReducer<ImmutableBytesWritable,Put,NullWritable> {
@Override
protected void reduce(ImmutableBytesWritable key, Iterable<Put> values, Context context) throws IOException, InterruptedException {
//运行reducer,增加数据
for (Put put : values) {
if(!put.isEmpty()){
context.write(NullWritable.get(),put);
}
}
}
}
| [
"[email protected]"
] | |
2ce70d95a5717116c9741a3113dbc456466caf2a | 9e17f7ee73285dba2deb0a8c321973e28f33ae3a | /STACK_2018/src/ds/stack/Stack.java | 64d4efa24af0fb0e89f4408f17b136606d1b0eb6 | [] | no_license | anariky1/DataStrucure | fe12326f4f56ce977425a65061ce4abf4ebc18da | 3160fa17b4f470bd99ca9242ee80ce39782b5a20 | refs/heads/master | 2020-03-28T21:43:23.292153 | 2018-09-17T19:29:25 | 2018-09-17T19:29:25 | 149,176,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 892 | java | package ds.stack;
public class Stack {
private int maxsize; //size the stack
private long[] stackArray; //container storing list of items
private int top; //represent the index position of last item
public Stack(int maxsize){
this.maxsize=maxsize;
this.stackArray=new long[maxsize];
this.top=-1;
}
public void push(long j){
if(isFull()){
System.out.println(" the stack is already full");
}else{
top++;
stackArray[top]=j;
}
}
public long pop(){
if(isEmpty()){
System.out.println("the stack is already empty");
return -1;
}else{
int old_top=top;
top--;
return stackArray[old_top];
//we are not removing , we are shifting the top index to the below one.
}
}
public long peak(){
return stackArray[top];
}
public boolean isEmpty(){
return(top==-1);
}
public boolean isFull(){
return (maxsize-1==top);
}
}
| [
"[email protected]"
] | |
5bd0781b8eb3cad85d9e195f3104b8815714f8b8 | d2cb1f4f186238ed3075c2748552e9325763a1cb | /methods_all/nonstatic_methods/java_awt_event_ComponentEvent_wait_long_int.java | 6e1d5a042c83758e1a8115550a4a284bb559049f | [] | no_license | Adabot1/data | 9e5c64021261bf181b51b4141aab2e2877b9054a | 352b77eaebd8efdb4d343b642c71cdbfec35054e | refs/heads/master | 2020-05-16T14:22:19.491115 | 2019-05-25T04:35:00 | 2019-05-25T04:35:00 | 183,001,929 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 197 | java | class java_awt_event_ComponentEvent_wait_long_int{ public static void function() {java.awt.event.ComponentEvent obj = new java.awt.event.ComponentEvent();obj.wait(3452663207410873447,1000401425);}} | [
"[email protected]"
] | |
e7e0f56f72c5ced8f8058dc36d63cb2df50acb0f | 17d23e4467c3a17ec5164236a5ecd8b28c540eb5 | /src/insoft/handler/GetWatch.java | d03433205bb674e15c37c3dcc58dcb2897994950 | [] | no_license | DongminK/NGFClient | 877f659f6b31313d6af3c973de93696c3e7ae9ec | fa3f2a0b242fdc7793f10c22998dcbdf69b2d878 | refs/heads/master | 2020-03-19T12:52:38.134778 | 2018-06-08T00:45:11 | 2018-06-08T00:45:11 | 136,546,651 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 905 | java | package insoft.handler;
import insoft.client.IHandler;
import insoft.client.Util;
import insoft.openmanager.message.Message;
import java.util.Vector;
public class GetWatch implements IHandler {
@Override
public String getName() {
// TODO Auto-generated method stub
return "GET_WATCH";
}
@Override
public Message requestMessage() {
// TODO Auto-generated method stub
Message msg = new Message(getName());
Message filter = new Message("");
filter.setInteger("type", 0);
filter.setString("attr_name", "owner_id");
Vector<String> vValues = new Vector<String>();
vValues.add(Util.readCommand("CONFIG_ID"));
filter.setVector("values", vValues);
Vector<Message> vFilters = new Vector<Message>();
vFilters.add(filter);
msg.setVector("filters", vFilters);
return msg;
}
@Override
public void setPrevMessage(Message msg) {
// TODO Auto-generated method stub
}
}
| [
"[email protected]"
] | |
ce69645f7ba87c3fcb8ea5d09510f68f1de3bae7 | 10a831a439f8ea5584e0f01708f198efc2dcc182 | /src/main/java/qa/qcri/rahar/config/WebAppConfig.java | 016ed24af8b51a00a58e7cd21753a918ab66c908 | [] | no_license | amanagrawal9/spring-hibernate-base-app | 7c08219c15d016098cfd4eaa226049d193ae4f01 | 4d1a67b7e12945d2db3cbd95ba74934e552e2a9e | refs/heads/master | 2020-12-02T07:34:53.242745 | 2016-08-31T07:06:12 | 2016-08-31T07:06:12 | 67,012,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,045 | java | package qa.qcri.rahar.config;
import javax.persistence.EntityManagerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;
import org.springframework.orm.jpa.support.OpenEntityManagerInViewInterceptor;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.servlet.ViewResolver;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
@Configuration
@EnableWebMvc
@ComponentScan("qa.qcri.rahar")
@PropertySource("classpath:application.properties")
@EnableScheduling
public class WebAppConfig extends WebMvcConfigurerAdapter {
@Autowired
EntityManagerFactory entityManagerFactory;
/* To load properties files */
@Bean
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
PropertySourcesPlaceholderConfigurer ppc = new PropertySourcesPlaceholderConfigurer();
ClassPathResource locations[] = {
new ClassPathResource("/application.properties")};
ppc.setLocations(locations);
return ppc;
}
@Override
public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
configurer.enable();
}
@Bean
public OpenEntityManagerInViewInterceptor openEntityManagerInViewInterceptor() {
OpenEntityManagerInViewInterceptor oemiv = new OpenEntityManagerInViewInterceptor();
oemiv.setEntityManagerFactory(entityManagerFactory);
return oemiv;
}
@Bean
public ViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setViewClass(JstlView.class);
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".html");
return viewResolver;
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/*.html").addResourceLocations("/WEB-INF/pages/");
}
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("forward:/index.html");
}
/*
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/").setViewName("index");
}*/
}
| [
"[email protected]"
] | |
8f1d1629992dac489a4c37a8587da855bd6d7b5e | fef99bb243d5a63791d45cd176760f3564e68269 | /lab7/src/functional/Ex4_Consumer.java | 5c4ecb141478579f941f27f99df33c4b449bdaa6 | [] | no_license | diana-stoica-ub/PAO | 20022e253308d8123c21b611419e3903571cdff2 | 97189aa4c80403268e7e594ec734723ff2545426 | refs/heads/master | 2023-05-03T05:54:22.864986 | 2021-05-19T06:57:09 | 2021-05-19T06:57:09 | 339,512,977 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,185 | java | package functional;
import java.util.Arrays;
import java.util.function.*;
public class Ex4_Consumer {
public void printBiConsumer() {
BiConsumer<String, String> echo = (x, y) -> {
System.out.println(x);
System.out.println(y);
};
echo.accept("This is first line.", "Here is another line");
}
public void convertToLowercase() {
Consumer<String> convertToLowercase = s -> System.out.println(s.toLowerCase());
convertToLowercase.accept("convert to ALL lowercase");
}
public void printPrefix() {
Consumer<String> sayHello = name -> System.out.println("Hello, " + name);
for (String name : Arrays.asList("Silvia", "John", "Doe")) {
sayHello.accept(name);
}
}
public void printDoubleConsumer() {
DoubleConsumer echo = System.out::println;
//echo = d -> System.out.println(d);
echo.accept(3.3);
}
public void printIntConsumer() {
IntConsumer echo = System.out::println;
echo.accept(3);
}
public void printLongConsumer() {
LongConsumer echo = System.out::println;
echo.accept(34L);
}
}
| [
"[email protected]"
] | |
050202e64fb84d89c62c0b05f5be7c1e2754eaf1 | 9c7ea25a118e94970809a7b879c9f8db2964a40f | /target/generated-sources/xjc/im_03_00_38_local/ObjectFactory.java | 1d2b7e9df7903d3b750a8f1887a8c6b7fe17891b | [] | no_license | vramku/onebusaway-tcip-api-v40 | c29d6133654fcf17fe4b85f060f91ec358e6446b | cc3792c1176b033e0a505eb597bc733ff16a16fd | refs/heads/master | 2020-12-26T04:48:19.209063 | 2016-05-19T20:54:17 | 2016-05-19T20:54:17 | 37,859,287 | 0 | 0 | null | 2015-06-22T14:15:47 | 2015-06-22T14:15:46 | null | UTF-8 | Java | false | false | 22,497 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2015.06.24 at 02:32:24 PM EDT
//
package im_03_00_38_local;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the im_03_00_38_local package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: im_03_00_38_local
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link AirlineTravelInformation }
*
*/
public AirlineTravelInformation createAirlineTravelInformation() {
return new AirlineTravelInformation();
}
/**
* Create an instance of {@link AssetDescription }
*
*/
public AssetDescription createAssetDescription() {
return new AssetDescription();
}
/**
* Create an instance of {@link AvailableForHandOff }
*
*/
public AvailableForHandOff createAvailableForHandOff() {
return new AvailableForHandOff();
}
/**
* Create an instance of {@link Basics }
*
*/
public Basics createBasics() {
return new Basics();
}
/**
* Create an instance of {@link BcastCycle }
*
*/
public BcastCycle createBcastCycle() {
return new BcastCycle();
}
/**
* Create an instance of {@link CargoDocs }
*
*/
public CargoDocs createCargoDocs() {
return new CargoDocs();
}
/**
* Create an instance of {@link CargoUnits }
*
*/
public CargoUnits createCargoUnits() {
return new CargoUnits();
}
/**
* Create an instance of {@link CargoVehicle }
*
*/
public CargoVehicle createCargoVehicle() {
return new CargoVehicle();
}
/**
* Create an instance of {@link CautionsForResponders }
*
*/
public CautionsForResponders createCautionsForResponders() {
return new CautionsForResponders();
}
/**
* Create an instance of {@link CenterPlans }
*
*/
public CenterPlans createCenterPlans() {
return new CenterPlans();
}
/**
* Create an instance of {@link CenterType }
*
*/
public CenterType createCenterType() {
return new CenterType();
}
/**
* Create an instance of {@link ChangeCenterProperties }
*
*/
public ChangeCenterProperties createChangeCenterProperties() {
return new ChangeCenterProperties();
}
/**
* Create an instance of {@link ClearOrRepairPlan }
*
*/
public ClearOrRepairPlan createClearOrRepairPlan() {
return new ClearOrRepairPlan();
}
/**
* Create an instance of {@link CloseIncidentEvent }
*
*/
public CloseIncidentEvent createCloseIncidentEvent() {
return new CloseIncidentEvent();
}
/**
* Create an instance of {@link ComplexCost }
*
*/
public ComplexCost createComplexCost() {
return new ComplexCost();
}
/**
* Create an instance of {@link Description }
*
*/
public Description createDescription() {
return new Description();
}
/**
* Create an instance of {@link DifferentialGPSCorrections }
*
*/
public DifferentialGPSCorrections createDifferentialGPSCorrections() {
return new DifferentialGPSCorrections();
}
/**
* Create an instance of {@link DisableCenterOnLine }
*
*/
public DisableCenterOnLine createDisableCenterOnLine() {
return new DisableCenterOnLine();
}
/**
* Create an instance of {@link Distribution }
*
*/
public Distribution createDistribution() {
return new Distribution();
}
/**
* Create an instance of {@link EstablishCenterOnLine }
*
*/
public EstablishCenterOnLine createEstablishCenterOnLine() {
return new EstablishCenterOnLine();
}
/**
* Create an instance of {@link EstablishCenterProperties }
*
*/
public EstablishCenterProperties createEstablishCenterProperties() {
return new EstablishCenterProperties();
}
/**
* Create an instance of {@link EvacuationData }
*
*/
public EvacuationData createEvacuationData() {
return new EvacuationData();
}
/**
* Create an instance of {@link Evacuation }
*
*/
public Evacuation createEvacuation() {
return new Evacuation();
}
/**
* Create an instance of {@link EventInformation }
*
*/
public EventInformation createEventInformation() {
return new EventInformation();
}
/**
* Create an instance of {@link Facilities }
*
*/
public Facilities createFacilities() {
return new Facilities();
}
/**
* Create an instance of {@link FileTransfer }
*
*/
public FileTransfer createFileTransfer() {
return new FileTransfer();
}
/**
* Create an instance of {@link FullPositionVector }
*
*/
public FullPositionVector createFullPositionVector() {
return new FullPositionVector();
}
/**
* Create an instance of {@link GrantHandOff }
*
*/
public GrantHandOff createGrantHandOff() {
return new GrantHandOff();
}
/**
* Create an instance of {@link Header }
*
*/
public Header createHeader() {
return new Header();
}
/**
* Create an instance of {@link IDXWrapper }
*
*/
public IDXWrapper createIDXWrapper() {
return new IDXWrapper();
}
/**
* Create an instance of {@link ImmediateSiteEvacuation }
*
*/
public ImmediateSiteEvacuation createImmediateSiteEvacuation() {
return new ImmediateSiteEvacuation();
}
/**
* Create an instance of {@link Impact }
*
*/
public Impact createImpact() {
return new Impact();
}
/**
* Create an instance of {@link IMWrapper }
*
*/
public IMWrapper createIMWrapper() {
return new IMWrapper();
}
/**
* Create an instance of {@link IncidentDescription }
*
*/
public IncidentDescription createIncidentDescription() {
return new IncidentDescription();
}
/**
* Create an instance of {@link IncidentInformation }
*
*/
public IncidentInformation createIncidentInformation() {
return new IncidentInformation();
}
/**
* Create an instance of {@link InformationRequest }
*
*/
public InformationRequest createInformationRequest() {
return new InformationRequest();
}
/**
* Create an instance of {@link InformationRequestType }
*
*/
public InformationRequestType createInformationRequestType() {
return new InformationRequestType();
}
/**
* Create an instance of {@link InfrastructureReport }
*
*/
public InfrastructureReport createInfrastructureReport() {
return new InfrastructureReport();
}
/**
* Create an instance of {@link InjuryData }
*
*/
public InjuryData createInjuryData() {
return new InjuryData();
}
/**
* Create an instance of {@link IssueStamp }
*
*/
public IssueStamp createIssueStamp() {
return new IssueStamp();
}
/**
* Create an instance of {@link LinkDataSet }
*
*/
public LinkDataSet createLinkDataSet() {
return new LinkDataSet();
}
/**
* Create an instance of {@link LinkTrafficInformation }
*
*/
public LinkTrafficInformation createLinkTrafficInformation() {
return new LinkTrafficInformation();
}
/**
* Create an instance of {@link GeoLocation }
*
*/
public GeoLocation createGeoLocation() {
return new GeoLocation();
}
/**
* Create an instance of {@link ManageCommandStructure }
*
*/
public ManageCommandStructure createManageCommandStructure() {
return new ManageCommandStructure();
}
/**
* Create an instance of {@link ManeuverInstruction }
*
*/
public ManeuverInstruction createManeuverInstruction() {
return new ManeuverInstruction();
}
/**
* Create an instance of {@link MaterialRelease }
*
*/
public MaterialRelease createMaterialRelease() {
return new MaterialRelease();
}
/**
* Create an instance of {@link MaydayDataSet }
*
*/
public MaydayDataSet createMaydayDataSet() {
return new MaydayDataSet();
}
/**
* Create an instance of {@link MergeIncidentEvent }
*
*/
public MergeIncidentEvent createMergeIncidentEvent() {
return new MergeIncidentEvent();
}
/**
* Create an instance of {@link NeedEMS }
*
*/
public NeedEMS createNeedEMS() {
return new NeedEMS();
}
/**
* Create an instance of {@link NeedFireSuppression }
*
*/
public NeedFireSuppression createNeedFireSuppression() {
return new NeedFireSuppression();
}
/**
* Create an instance of {@link NeedLawEnforcement }
*
*/
public NeedLawEnforcement createNeedLawEnforcement() {
return new NeedLawEnforcement();
}
/**
* Create an instance of {@link NeedOtherServices }
*
*/
public NeedOtherServices createNeedOtherServices() {
return new NeedOtherServices();
}
/**
* Create an instance of {@link NeedRescueServices }
*
*/
public NeedRescueServices createNeedRescueServices() {
return new NeedRescueServices();
}
/**
* Create an instance of {@link NetworkConditions }
*
*/
public NetworkConditions createNetworkConditions() {
return new NetworkConditions();
}
/**
* Create an instance of {@link NewIncidentEvent }
*
*/
public NewIncidentEvent createNewIncidentEvent() {
return new NewIncidentEvent();
}
/**
* Create an instance of {@link OrganizationPosition }
*
*/
public OrganizationPosition createOrganizationPosition() {
return new OrganizationPosition();
}
/**
* Create an instance of {@link ParkingInstructions }
*
*/
public ParkingInstructions createParkingInstructions() {
return new ParkingInstructions();
}
/**
* Create an instance of {@link ParkingLotInformation }
*
*/
public ParkingLotInformation createParkingLotInformation() {
return new ParkingLotInformation();
}
/**
* Create an instance of {@link PedigreeList }
*
*/
public PedigreeList createPedigreeList() {
return new PedigreeList();
}
/**
* Create an instance of {@link PersonInformation }
*
*/
public PersonInformation createPersonInformation() {
return new PersonInformation();
}
/**
* Create an instance of {@link PhysicalAssetStatus }
*
*/
public PhysicalAssetStatus createPhysicalAssetStatus() {
return new PhysicalAssetStatus();
}
/**
* Create an instance of {@link PlacardsLabelsSignage }
*
*/
public PlacardsLabelsSignage createPlacardsLabelsSignage() {
return new PlacardsLabelsSignage();
}
/**
* Create an instance of {@link PollForHandOff }
*
*/
public PollForHandOff createPollForHandOff() {
return new PollForHandOff();
}
/**
* Create an instance of {@link PositionFix }
*
*/
public PositionFix createPositionFix() {
return new PositionFix();
}
/**
* Create an instance of {@link PreemptionUserData }
*
*/
public PreemptionUserData createPreemptionUserData() {
return new PreemptionUserData();
}
/**
* Create an instance of {@link PublicIncidentDescription }
*
*/
public PublicIncidentDescription createPublicIncidentDescription() {
return new PublicIncidentDescription();
}
/**
* Create an instance of {@link RequestForExternalInformation }
*
*/
public RequestForExternalInformation createRequestForExternalInformation() {
return new RequestForExternalInformation();
}
/**
* Create an instance of {@link RequestHandOff }
*
*/
public RequestHandOff createRequestHandOff() {
return new RequestHandOff();
}
/**
* Create an instance of {@link RequestImmediateAssistance }
*
*/
public RequestImmediateAssistance createRequestImmediateAssistance() {
return new RequestImmediateAssistance();
}
/**
* Create an instance of {@link RequestInformation }
*
*/
public RequestInformation createRequestInformation() {
return new RequestInformation();
}
/**
* Create an instance of {@link RequestNetworkConditions }
*
*/
public RequestNetworkConditions createRequestNetworkConditions() {
return new RequestNetworkConditions();
}
/**
* Create an instance of {@link RequestPhysicalAsset }
*
*/
public RequestPhysicalAsset createRequestPhysicalAsset() {
return new RequestPhysicalAsset();
}
/**
* Create an instance of {@link RequestPhysicalAssetStatus }
*
*/
public RequestPhysicalAssetStatus createRequestPhysicalAssetStatus() {
return new RequestPhysicalAssetStatus();
}
/**
* Create an instance of {@link RequestPreemptionUserData }
*
*/
public RequestPreemptionUserData createRequestPreemptionUserData() {
return new RequestPreemptionUserData();
}
/**
* Create an instance of {@link RequestRouteAdvice }
*
*/
public RequestRouteAdvice createRequestRouteAdvice() {
return new RequestRouteAdvice();
}
/**
* Create an instance of {@link RequestStatus }
*
*/
public RequestStatus createRequestStatus() {
return new RequestStatus();
}
/**
* Create an instance of {@link RequestTrafficControlPlan }
*
*/
public RequestTrafficControlPlan createRequestTrafficControlPlan() {
return new RequestTrafficControlPlan();
}
/**
* Create an instance of {@link RequestWorkZoneData }
*
*/
public RequestWorkZoneData createRequestWorkZoneData() {
return new RequestWorkZoneData();
}
/**
* Create an instance of {@link ResourceAssignment }
*
*/
public ResourceAssignment createResourceAssignment() {
return new ResourceAssignment();
}
/**
* Create an instance of {@link ResponseGroup }
*
*/
public ResponseGroup createResponseGroup() {
return new ResponseGroup();
}
/**
* Create an instance of {@link Response }
*
*/
public Response createResponse() {
return new Response();
}
/**
* Create an instance of {@link RouteAdvice }
*
*/
public RouteAdvice createRouteAdvice() {
return new RouteAdvice();
}
/**
* Create an instance of {@link Route }
*
*/
public Route createRoute() {
return new Route();
}
/**
* Create an instance of {@link RouteRequest }
*
*/
public RouteRequest createRouteRequest() {
return new RouteRequest();
}
/**
* Create an instance of {@link RouteSet }
*
*/
public RouteSet createRouteSet() {
return new RouteSet();
}
/**
* Create an instance of {@link RouteStatus }
*
*/
public RouteStatus createRouteStatus() {
return new RouteStatus();
}
/**
* Create an instance of {@link SceneStaging }
*
*/
public SceneStaging createSceneStaging() {
return new SceneStaging();
}
/**
* Create an instance of {@link Segment }
*
*/
public Segment createSegment() {
return new Segment();
}
/**
* Create an instance of {@link ServerStatus }
*
*/
public ServerStatus createServerStatus() {
return new ServerStatus();
}
/**
* Create an instance of {@link Severity }
*
*/
public Severity createSeverity() {
return new Severity();
}
/**
* Create an instance of {@link ShippingEntry }
*
*/
public ShippingEntry createShippingEntry() {
return new ShippingEntry();
}
/**
* Create an instance of {@link SplitIncidentEvent }
*
*/
public SplitIncidentEvent createSplitIncidentEvent() {
return new SplitIncidentEvent();
}
/**
* Create an instance of {@link StagingArea }
*
*/
public StagingArea createStagingArea() {
return new StagingArea();
}
/**
* Create an instance of {@link StatusBlock }
*
*/
public StatusBlock createStatusBlock() {
return new StatusBlock();
}
/**
* Create an instance of {@link SubRoute }
*
*/
public SubRoute createSubRoute() {
return new SubRoute();
}
/**
* Create an instance of {@link TimeMarks }
*
*/
public TimeMarks createTimeMarks() {
return new TimeMarks();
}
/**
* Create an instance of {@link TrackInvolvedPerson }
*
*/
public TrackInvolvedPerson createTrackInvolvedPerson() {
return new TrackInvolvedPerson();
}
/**
* Create an instance of {@link TrackInvolvedVehicle }
*
*/
public TrackInvolvedVehicle createTrackInvolvedVehicle() {
return new TrackInvolvedVehicle();
}
/**
* Create an instance of {@link TrackResponsePersonnel }
*
*/
public TrackResponsePersonnel createTrackResponsePersonnel() {
return new TrackResponsePersonnel();
}
/**
* Create an instance of {@link TrackSpecialCircumstances }
*
*/
public TrackSpecialCircumstances createTrackSpecialCircumstances() {
return new TrackSpecialCircumstances();
}
/**
* Create an instance of {@link TrafficControlPlan }
*
*/
public TrafficControlPlan createTrafficControlPlan() {
return new TrafficControlPlan();
}
/**
* Create an instance of {@link TranmissionPoint }
*
*/
public TranmissionPoint createTranmissionPoint() {
return new TranmissionPoint();
}
/**
* Create an instance of {@link TransitEventSource }
*
*/
public TransitEventSource createTransitEventSource() {
return new TransitEventSource();
}
/**
* Create an instance of {@link TransitInformation }
*
*/
public TransitInformation createTransitInformation() {
return new TransitInformation();
}
/**
* Create an instance of {@link TransitVehicleInvolved }
*
*/
public TransitVehicleInvolved createTransitVehicleInvolved() {
return new TransitVehicleInvolved();
}
/**
* Create an instance of {@link VehicleData }
*
*/
public VehicleData createVehicleData() {
return new VehicleData();
}
/**
* Create an instance of {@link VehMAYDAY }
*
*/
public VehMAYDAY createVehMAYDAY() {
return new VehMAYDAY();
}
/**
* Create an instance of {@link WatchFor }
*
*/
public WatchFor createWatchFor() {
return new WatchFor();
}
/**
* Create an instance of {@link WatchForResponse }
*
*/
public WatchForResponse createWatchForResponse() {
return new WatchForResponse();
}
/**
* Create an instance of {@link WeatherInformation }
*
*/
public WeatherInformation createWeatherInformation() {
return new WeatherInformation();
}
/**
* Create an instance of {@link WitnessIdenty }
*
*/
public WitnessIdenty createWitnessIdenty() {
return new WitnessIdenty();
}
/**
* Create an instance of {@link WitnessList }
*
*/
public WitnessList createWitnessList() {
return new WitnessList();
}
/**
* Create an instance of {@link WitnessStatement }
*
*/
public WitnessStatement createWitnessStatement() {
return new WitnessStatement();
}
/**
* Create an instance of {@link WorkZoneData }
*
*/
public WorkZoneData createWorkZoneData() {
return new WorkZoneData();
}
}
| [
"[email protected]"
] | |
864abccdcb53e4b2fff6c58ca51385beb224541f | 18e42a09d7f5dacc1bbeeae4c22284c60cc88b1f | /xstream/src/test/com/thoughtworks/acceptance/ConcurrentTypesTest.java | 0d6d16246fe57213b571a2faa77ac32d0d678ee7 | [
"BSD-3-Clause"
] | permissive | x-stream/xstream | ab7f586f1d682902bbf96f3be2b953df98ff32c3 | 289ae780001c31d7d5d75e0d58608c13f44549a2 | refs/heads/master | 2023-08-30T19:33:58.497180 | 2023-04-22T16:03:39 | 2023-04-22T16:03:39 | 32,219,624 | 818 | 270 | NOASSERTION | 2023-05-02T23:36:09 | 2015-03-14T15:57:12 | Java | UTF-8 | Java | false | false | 5,549 | java | /*
* Copyright (C) 2012, 2015, 2017, 2018, 2021, 2022 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
* style license a copy of which has been included with this distribution in
* the LICENSE.txt file.
*
* Created on 17. July 2018 by Joerg Schaible, renamed from Concurrent15TypesTest
*/
package com.thoughtworks.acceptance;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import com.thoughtworks.acceptance.objects.Original;
import com.thoughtworks.acceptance.objects.Replaced;
import com.thoughtworks.xstream.converters.collections.MapConverter;
public class ConcurrentTypesTest extends AbstractAcceptanceTest {
public void testConcurrentHashMap() {
final ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
map.put("walnes", "joe");
final String xml = xstream.toXML(map);
final String expected = ""
+ "<concurrent-hash-map>\n"
+ " <entry>\n"
+ " <string>walnes</string>\n"
+ " <string>joe</string>\n"
+ " </entry>\n"
+ "</concurrent-hash-map>";
assertEquals(xml, expected);
final ConcurrentHashMap<String, String> out = xstream.fromXML(xml);
assertEquals("{walnes=joe}", out.toString());
}
public static class DerivedConcurrentHashMap extends ConcurrentHashMap<Object, Object> {
private static final long serialVersionUID = 1L;
}
public void testDerivedConcurrentHashMap() {
xstream.alias("derived-map", DerivedConcurrentHashMap.class);
xstream.registerConverter(new MapConverter(xstream.getMapper(), DerivedConcurrentHashMap.class));
final Map<Object, Object> map = new DerivedConcurrentHashMap();
map.put("test", "JUnit");
final String xml = ""
+ "<derived-map>\n"
+ " <entry>\n"
+ " <string>test</string>\n"
+ " <string>JUnit</string>\n"
+ " </entry>\n"
+ "</derived-map>";
assertBothWays(map, xml);
}
public void testAtomicBoolean() {
final AtomicBoolean atomicBoolean = new AtomicBoolean();
assertBothWays(atomicBoolean, "<atomic-boolean>" + atomicBoolean + "</atomic-boolean>");
}
public void testAtomicBooleanWithOldFormat() {
assertEquals(new AtomicBoolean(true).toString(), xstream.fromXML("" //
+ "<java.util.concurrent.atomic.AtomicBoolean>\n" //
+ " <value>1</value>\n" //
+ "</java.util.concurrent.atomic.AtomicBoolean>").toString());
}
public void testAtomicInteger() {
final AtomicInteger atomicInteger = new AtomicInteger(42);
assertBothWays(atomicInteger, "<atomic-int>" + atomicInteger + "</atomic-int>");
}
public void testAtomicIntegerWithOldFormat() {
assertEquals(new AtomicInteger(42).toString(), xstream.fromXML("" //
+ "<java.util.concurrent.atomic.AtomicInteger>\n" //
+ " <value>42</value>\n" //
+ "</java.util.concurrent.atomic.AtomicInteger>").toString());
}
public void testAtomicLong() {
final AtomicLong atomicLong = new AtomicLong(42);
assertBothWays(atomicLong, "<atomic-long>" + atomicLong + "</atomic-long>");
}
public void testAtomicLongWithOldFormat() {
assertEquals(new AtomicInteger(42).toString(), xstream.fromXML("" //
+ "<java.util.concurrent.atomic.AtomicLong>\n" //
+ " <value>42</value>\n" //
+ "</java.util.concurrent.atomic.AtomicLong>").toString());
}
public void testAtomicReference() {
final AtomicReference<String> atomicRef = new AtomicReference<>("test");
assertBothWays(atomicRef, ("" //
+ "<atomic-reference>\n" //
+ " <value class='string'>test</value>\n" //
+ "</atomic-reference>").replace('\'', '"'));
}
@SuppressWarnings("unchecked")
public void testAtomicReferenceWithOldFormat() {
assertEquals(new AtomicReference<String>("test").get(), ((AtomicReference<String>)xstream.fromXML("" //
+ "<java.util.concurrent.atomic.AtomicReference>\n" //
+ " <value class='string'>test</value>\n" //
+ "</java.util.concurrent.atomic.AtomicReference>")).get());
}
public void testAtomicReferenceWithAlias() {
xstream.aliasField("junit", AtomicReference.class, "value");
final AtomicReference<String> atomicRef = new AtomicReference<>("test");
assertBothWays(atomicRef, ("" //
+ "<atomic-reference>\n" //
+ " <junit class='string'>test</junit>\n" //
+ "</atomic-reference>").replace('\'', '"'));
}
public void testAtomicReferenceWithReplaced() {
xstream.alias("original", Original.class);
xstream.alias("replaced", Replaced.class);
final AtomicReference<Original> atomicRef = new AtomicReference<>(new Original("test"));
assertBothWays(atomicRef, ("" //
+ "<atomic-reference>\n" //
+ " <value class='original' resolves-to='replaced'>\n"
+ " <replacedValue>TEST</replacedValue>\n"
+ " </value>\n" //
+ "</atomic-reference>").replace('\'', '"'));
}
}
| [
"[email protected]"
] | |
57e206dc18d5c46a18b2064d8c76482688b1600b | c35e0bab1a41421176f4bab3d1fe9cdfde21eb74 | /app/src/main/java/com/omegar/RSSparser/RSSUtil.java | 082f019bb48e7f13dfefed10e5eea2c1ada4134e | [] | no_license | JosiasSena/RSS-Reader | 2f54a232bd6e49429e6bf3bd363ef83db8f65bea | 94960be95fa0e00d5de7283b161f10028ea6d518 | refs/heads/master | 2021-05-28T08:15:16.445058 | 2014-12-19T21:02:28 | 2014-12-19T21:02:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,647 | java | package com.omegar.RSSparser;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.preference.PreferenceManager;
import android.view.Gravity;
import android.widget.TextView;
import com.omegar.Tools.LoadRSSFeed;
import java.net.URI;
import java.net.URISyntaxException;
public class RSSUtil {
// Put your RSS feed URL here
public static String RSSFEEDURL = "http://www.androidpit.com/feed/main.xml";
// Change to a given feed
public static void changeFeed(Context context){
changeURL(context);
}
// Returns the filename of the stored feed
public static String getFeedName(){
return getDomainName(RSSFEEDURL);
}
// Strips a URL to the domain
private static String getDomainName(String url) {
String domain = null;
try {
domain = new URI(url).getHost();
} catch (URISyntaxException e) {
e.printStackTrace();
}
return domain.startsWith("www.") ? domain.substring(4) : domain;
}
// Takes a string URL as a new feed
private static void changeURL(final Context context){
// Set the content view
AlertDialog.Builder builder = new AlertDialog.Builder(context);
// Set the alert title
builder.setTitle("The link we will use:")
// Set the alert message
.setMessage("http://www.androidpit.com/feed/main.xml")
// Can't exit via back button
.setCancelable(false)
// Set the positive button action
.setPositiveButton("OK", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int whichButton){
RSSFEEDURL = "http://www.androidpit.com/feed/main.xml";
// Parse the feed
new LoadRSSFeed(context).execute();
}
})
// Set the negative button actions
.setNegativeButton("Cancel", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int whichButton){
// If it's during initial loading
if(!PreferenceManager.getDefaultSharedPreferences(context).getBoolean("isSetup", false)){
// Exit the application
((Activity)context).finish();
} else {
// Otherwise do nothing
dialog.dismiss();
}
}
});
// Create dialog from builder
AlertDialog alert = builder.create();
// Don't exit the dialog when the screen is touched
alert.setCanceledOnTouchOutside(false);
// Show the alert
alert.show();
// Center the message
((TextView)alert.findViewById(android.R.id.message)).setGravity(Gravity.CENTER);
// Center the title of the dialog
((TextView)alert.findViewById((context.getResources().getIdentifier("alertTitle", "id", "android")))).setGravity(Gravity.CENTER);
}
}
| [
"[email protected]"
] | |
a3673b839503596d7a8219f3842f24ded3c4a375 | db336e3a8ba3682fcfd0c97a47deaaa595ef267a | /src/main/java/com/example/demo/ErrorHandler/ErrorMessage/IsNameError.java | b0f65f4012dabeb96a685b981514cb0c5c565fb8 | [] | no_license | joelfalk/RouteBuilder | 544d6b43ab267713ef67e9303fdb39d68e36b5c1 | 4a5f2bcc0f1c85b88dc39bed53d7acb6648aed62 | refs/heads/master | 2023-01-01T11:22:58.781743 | 2020-10-21T13:23:20 | 2020-10-21T13:23:20 | 296,367,099 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.example.demo.ErrorHandler.ErrorMessage;
import org.apache.camel.Exchange;
import org.apache.camel.Predicate;
import org.springframework.stereotype.Component;
@Component
public class IsNameError implements Predicate {
@Override
public boolean matches(Exchange exchange) {
return exchange.getIn().getHeader("FailReason").equals(1);
}
}
| [
"[email protected]"
] | |
7330567e060ecc3a02421706768922614a43806a | 61ad4132cbf8a6576a95ad388382488cffa333b8 | /app/src/main/java/com/example/covidapps/model/preferencesData/UserModel.java | 88005354d599c136447b70ae140214eb0b8c1a96 | [] | no_license | ghozay19/ListCovidMVVM | 1c013dfa1776f15f125afd5e31c51fb38c91524a | bdb426685924335e92ac8efd10a97332a91ab499 | refs/heads/master | 2023-01-10T01:00:04.895240 | 2020-11-08T16:30:58 | 2020-11-08T16:30:58 | 311,105,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 692 | java | package com.example.covidapps.model.preferencesData;
import android.os.Parcel;
import android.os.Parcelable;
public class UserModel {
String username;
String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "UserModel{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
bdb282cf644f8a75e55d4f6a5051102bef8cc87c | a0953114c07db399ffdf97d29a1258d8fc097e07 | /src/main/java/org/example/leetcode/CompressString.java | c648b87a944de251bba0d2e8944a17b59cc9e531 | [] | no_license | herolove/leetcodev2 | da1866262cf67209cd0903229f65b0f395cb3ed0 | ec418369a3f96b39fb770d95350cb144e5583856 | refs/heads/master | 2023-01-08T21:30:46.586493 | 2020-11-11T08:55:20 | 2020-11-11T08:55:20 | 274,327,969 | 0 | 0 | null | 2020-11-11T08:56:16 | 2020-06-23T06:34:52 | Java | UTF-8 | Java | false | false | 782 | java | package org.example.leetcode;
/**
* @Description TODO
* @Author zhangtao02
* @Date 2020/6/16
**/
public class CompressString {
public String compressString(String S) {
if (S == null || S.length() <= 2) {
return S;
}
StringBuilder sb = new StringBuilder().append(S.charAt(0));
int cnt = 1;
for (int i = 1; i < S.length(); i++) {
// 如果i与i-1相同,cnt累加
if (S.charAt(i) == S.charAt(i - 1)) {
cnt++;
} else {
// 否则拼接上i-1的次数,从i开始重新计数
sb.append(cnt).append(S.charAt(i));
cnt = 1;
}
}
return sb.append(cnt).length() < S.length()? sb.toString(): S;
}
}
| [
"[email protected]"
] | |
dfdf0136db207ec08758ca8b28e2f1df530dcd26 | 5232bc28d2bdb1eddd38e9f1eec4dda714257bd7 | /CommandExecutor.java | 5d3a4b10b4379aa6fc8eb568ae7be256d8894ba0 | [] | no_license | chadaldrich93/MiniDatabase | efbb72f70ca8190ecc9a3a03b596c59c4f3dc01e | 9cbd05c7f67cd12695dcca43f94ad4754cf9569d | refs/heads/master | 2020-03-27T17:26:41.305878 | 2019-01-10T21:05:14 | 2019-01-10T21:05:14 | 146,851,869 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 111 | java | package minidatabase;
import java.util.Vector;
class CommandExecutor{
executeQuery(Vector<String>)
} | [
"[email protected]"
] | |
a9bcbd98cb5095d9f3fbed71a3a41620c1a1bc72 | 053d1cb89bd59b38e5481863c4b1c6d24c5d08c5 | /PassengerMS/src/main/java/com/cg/controller/ExceptionController.java | ebb2d5b74c424b66b7a87850ac2fa480d2013819 | [] | no_license | Akash985/online-Bus-Booking-System | b39d2c60fa005f7cabd2211a37702d318c7f6b87 | d4d9a1d4c15ed0be6c585692b5c4fd1b4f16cedb | refs/heads/master | 2022-12-29T22:08:15.743005 | 2020-06-15T06:28:10 | 2020-06-15T06:28:10 | 272,183,994 | 0 | 0 | null | 2020-10-13T22:48:27 | 2020-06-14T10:59:58 | Java | UTF-8 | Java | false | false | 1,553 | java | package com.cg.controller;
import javax.persistence.RollbackException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import com.cg.exception.BookingIdNotFoundException;
import com.cg.exception.NoPassengerInBusException;
import com.cg.exception.PassengerNotFoundException;
@RestControllerAdvice
public class ExceptionController {
@ExceptionHandler
public ResponseEntity<String> handleBookingIdNotFoundException(BookingIdNotFoundException ex) {
return new ResponseEntity<>(ex.getMessage(),HttpStatus.NOT_FOUND);
}
@ExceptionHandler
public ResponseEntity<String> handleNumberFormatException(NumberFormatException ex) {
return new ResponseEntity<>("You can enter only numeric value --> "+ex.getMessage()+"not a numeric value",HttpStatus.NOT_ACCEPTABLE);
}
@ExceptionHandler
public ResponseEntity<String> handleNoPassengerInBusException(NoPassengerInBusException ex) {
return new ResponseEntity<>(ex.getMessage(),HttpStatus.NOT_FOUND);
}
@ExceptionHandler
public ResponseEntity<String> handlePassengerNotFoundException(PassengerNotFoundException ex) {
return new ResponseEntity<>(ex.getMessage(),HttpStatus.NOT_FOUND);
}
@ExceptionHandler
public ResponseEntity<String> handleRollbackException(RollbackException ex) {
return new ResponseEntity<>(ex.getMessage()+"Please check the fileds you have entered",HttpStatus.NOT_ACCEPTABLE);
}
}
| [
"[email protected]"
] | |
e64904e1f36eb46c9d8858a5ef5ee304979352c4 | 42b5a9797a0ccd1449ae5c0f2be581e23dce2c60 | /core/src/com/jga/jumper/levels/Level_8.java | 083481e6d4a27cd72a268f793d59d44f0a874e00 | [] | no_license | will-anthony/Monster-Jumper | 1b0082934942685bd446618cac5d5fae49a31627 | 6a9788fdb4c6e93cbbf961a5839ad77d21a79173 | refs/heads/master | 2022-12-10T10:10:35.413357 | 2020-09-01T20:55:41 | 2020-09-01T20:55:41 | 272,233,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,108 | java | package com.jga.jumper.levels;
import com.jga.jumper.controllers.ControllerRegister;
import com.jga.jumper.controllers.MageController;
import com.jga.jumper.controllers.SlugController;
public class Level_8 implements Level {
private final ControllerRegister controllerRegister;
private final SlugController slugController;
private final MageController mageController;
private float levelTimer;
private boolean levelBrake;
private boolean hasFirstWaveSpawned;
private boolean hasSecondWaveSpawned;
private boolean hasThirdWaveSpawned;
private boolean hasFourthWaveSpawned;
private boolean hasFifthWaveSpawned;
private boolean hasSixthWaveSpawned;
private static final float FINAL_WAVE_TIME = 5f;
public Level_8(ControllerRegister controllerRegister) {
this.controllerRegister = controllerRegister;
slugController = controllerRegister.getSlugController();
mageController = controllerRegister.getMageController();
levelBrake = false;
levelTimer = 0f;
hasFirstWaveSpawned = false;
hasSecondWaveSpawned = false;
hasThirdWaveSpawned = false;
hasFourthWaveSpawned = false;
hasFifthWaveSpawned = false;
hasSixthWaveSpawned = false;
}
@Override
public void update(float delta) {
if (levelTimer >= 0 && !hasFirstWaveSpawned) {
System.out.println("Level 8");
slugController.tryToAddSlugs(2);
hasFirstWaveSpawned = true;
}
if (levelTimer >= 6 && !hasSecondWaveSpawned) {
mageController.tryToAddMages(1);
slugController.tryToAddSlugs(1);
hasSecondWaveSpawned = true;
}
// if (levelTimer >= 10 && !hasThirdWaveSpawned) {
// slugController.tryToAddSlugs(1);
// hasThirdWaveSpawned = true;
// }
//
// if (levelTimer >= 12 && !hasFourthWaveSpawned) {
// slugController.tryToAddSlugs(1);
// hasFourthWaveSpawned = true;
// }
//
// if (levelTimer >= 16 && !hasFifthWaveSpawned) {
// slugController.tryToAddSlugs(1);
// hasFifthWaveSpawned = true;
// }
//
// if (levelTimer >= FINAL_WAVE_TIME && !hasSixthWaveSpawned) {
// mageController.tryToAddMages(1);
// slugController.tryToAddSlugs(1);
// hasSixthWaveSpawned = true;
// }
levelTimer += delta;
}
@Override
public boolean hasLevelFinished() {
if (levelTimer >= FINAL_WAVE_TIME && levelBrake == false) {
levelBrake = true;
levelTimer = 0;
System.out.println("Level completed");
return true;
} else {
return false;
}
}
@Override
public void reset() {
levelBrake = false;
levelTimer = 0f;
hasFirstWaveSpawned = false;
hasSecondWaveSpawned = false;
hasThirdWaveSpawned = false;
hasFourthWaveSpawned = false;
hasFifthWaveSpawned = false;
hasSixthWaveSpawned = false;
}
}
| [
"[email protected]"
] | |
0b7af350bb8d540145734b2f5cf1865ae88b3e6d | f7f99ee59500f1b83aef5c7893a3f8000501cf33 | /app/src/main/java/kr/hs/emirim/s2019w04/mirimtabhost/MainActivity.java | 691e64affd1d4227f89f06551c21e3df29580bf3 | [] | no_license | Nayoung-apeach/MirimTabHost | d1af170fe749310e178c96cbb4457817ab5cec24 | af1cf077e5482191b8c55802471a7ad23b2461e7 | refs/heads/master | 2023-01-08T00:24:24.866818 | 2020-11-09T11:43:51 | 2020-11-09T11:43:51 | 311,300,949 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 994 | java | package kr.hs.emirim.s2019w04.mirimtabhost;
import androidx.appcompat.app.AppCompatActivity;
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
public class MainActivity extends TabActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TabHost tabHost = getTabHost();
TabHost.TabSpec tabSpecJun = tabHost.newTabSpec("Jun").setIndicator("김준규");
tabSpecJun.setContent(R.id.linear_jun);
tabHost.addTab(tabSpecJun);
TabHost.TabSpec tabSpecJi = tabHost.newTabSpec("Jun").setIndicator("박지훈");
tabSpecJi.setContent(R.id.linear_ji);
tabHost.addTab(tabSpecJi);
TabHost.TabSpec tabSpecYo = tabHost.newTabSpec("Jun").setIndicator("요시");
tabSpecYo.setContent(R.id.linear_yo);
tabHost.addTab(tabSpecYo);
tabHost.setCurrentTab(0);
}
} | [
"[email protected]"
] | |
88ae1c31d8f325e84f1dbf108b51ffd9284c0c98 | db99ecb8435588d71851c5362117d938c9eac1a2 | /firstcode/chapter14_coolweather/src/main/java/com/me/diankun/coolweather/db/CoolWeatherOpenHelper.java | 230b5ce97339f4b31d0810a96c4293e01a979cdb | [
"Apache-2.0"
] | permissive | qdiankun/firstcode | 4d36768c39a3b9157cdb44a68a3eebafa718f68c | 6858ceffb4b80d33dedded99bc95ef4c4fb1ad96 | refs/heads/master | 2021-01-10T04:49:27.030497 | 2016-03-11T10:36:27 | 2016-03-11T10:36:27 | 52,836,706 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | java | package com.me.diankun.coolweather.db;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by diankun on 2016/3/10.
*/
public class CoolWeatherOpenHelper extends SQLiteOpenHelper
{
/**
* Province表建表语句
*/
public static final String CREATE_PROVINCE = "create table Province(id integer primary key autoincrement,"
+ "province_name text,province_code text)";
/**
* City表建表语句
*/
public static final String CREATE_CITY = "create table City(id integer primary key autoincrement,"
+ "city_name text," + "city_code text," + "province_id integer)";
/**
* Country表的建表语句
*/
public static final String CREATE_COUNTRY = "create table Country(id integer primary key autoincrement,"
+ "country_name text,country_code text, city_id integer)";
public CoolWeatherOpenHelper(Context context, String name,
SQLiteDatabase.CursorFactory factory, int version)
{
super(context, name, factory, version);
}
@Override
public void onCreate(SQLiteDatabase db)
{
// 创建Province表
db.execSQL(CREATE_PROVINCE);
// 创建City表
db.execSQL(CREATE_CITY);
// 创建Country表
db.execSQL(CREATE_COUNTRY);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion)
{
// TODO Auto-generated method stub
}
} | [
"[email protected]"
] | |
4ba9ee4b40a791b121e0f788d0a5a09b78abb935 | 88d031ad952813de055b5b7dfc9653acf045425d | /spring-data-mongodb/src/test/java/org/springframework/data/mongodb/core/convert/QueryMapperUnitTests.java | cf304a4b70fe8e3219eb6ec1bc0575058acbd28c | [] | no_license | whirlwind-match/spring-data-mongodb | 4efa5de37a32f0a7ecae719cc5e2e47d76c5511d | ba9abd1dd06d9c25d47d1edb8350c308ad91ec9f | refs/heads/master | 2021-01-18T10:41:21.887142 | 2012-06-20T10:23:32 | 2012-06-20T10:24:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,138 | java | /*
* Copyright (c) 2011 by the original author(s).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.mongodb.core.convert;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.springframework.data.mongodb.core.query.Criteria.*;
import static org.springframework.data.mongodb.core.query.Query.*;
import java.math.BigInteger;
import java.util.Arrays;
import org.bson.types.ObjectId;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.Person;
import org.springframework.data.mongodb.core.mapping.MongoMappingContext;
import org.springframework.data.mongodb.core.mapping.MongoPersistentEntity;
import org.springframework.data.mongodb.core.query.BasicQuery;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import com.mongodb.BasicDBList;
import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
import com.mongodb.QueryBuilder;
/**
* Unit tests for {@link QueryMapper}.
*
* @author Oliver Gierke
*/
@RunWith(MockitoJUnitRunner.class)
@SuppressWarnings("unused")
public class QueryMapperUnitTests {
QueryMapper mapper;
MongoMappingContext context;
@Mock
MongoDbFactory factory;
@Before
public void setUp() {
context = new MongoMappingContext();
MappingMongoConverter converter = new MappingMongoConverter(factory, context);
converter.afterPropertiesSet();
mapper = new QueryMapper(converter);
}
@Test
public void translatesIdPropertyIntoIdKey() {
DBObject query = new BasicDBObject("foo", "value");
MongoPersistentEntity<?> entity = context.getPersistentEntity(Sample.class);
DBObject result = mapper.getMappedObject(query, entity);
assertThat(result.get("_id"), is(notNullValue()));
assertThat(result.get("foo"), is(nullValue()));
}
@Test
public void convertsStringIntoObjectId() {
DBObject query = new BasicDBObject("_id", new ObjectId().toString());
DBObject result = mapper.getMappedObject(query, null);
assertThat(result.get("_id"), is(instanceOf(ObjectId.class)));
}
@Test
public void handlesBigIntegerIdsCorrectly() {
DBObject dbObject = new BasicDBObject("id", new BigInteger("1"));
DBObject result = mapper.getMappedObject(dbObject, null);
assertThat(result.get("_id"), is((Object) "1"));
}
@Test
public void handlesObjectIdCapableBigIntegerIdsCorrectly() {
ObjectId id = new ObjectId();
DBObject dbObject = new BasicDBObject("id", new BigInteger(id.toString(), 16));
DBObject result = mapper.getMappedObject(dbObject, null);
assertThat(result.get("_id"), is((Object) id));
}
/**
* @see DATAMONGO-278
*/
@Test
public void translates$NeCorrectly() {
Criteria criteria = where("foo").ne(new ObjectId().toString());
DBObject result = mapper.getMappedObject(criteria.getCriteriaObject(), context.getPersistentEntity(Sample.class));
Object object = result.get("_id");
assertThat(object, is(instanceOf(DBObject.class)));
DBObject dbObject = (DBObject) object;
assertThat(dbObject.get("$ne"), is(instanceOf(ObjectId.class)));
}
/**
* @see DATAMONGO-326
*/
@Test
public void handlesEnumsCorrectly() {
Query query = query(where("foo").is(Enum.INSTANCE));
DBObject result = mapper.getMappedObject(query.getQueryObject(), null);
Object object = result.get("foo");
assertThat(object, is(instanceOf(String.class)));
}
@Test
public void handlesEnumsInNotEqualCorrectly() {
Query query = query(where("foo").ne(Enum.INSTANCE));
DBObject result = mapper.getMappedObject(query.getQueryObject(), null);
Object object = result.get("foo");
assertThat(object, is(instanceOf(DBObject.class)));
Object ne = ((DBObject) object).get("$ne");
assertThat(ne, is(instanceOf(String.class)));
assertThat(ne.toString(), is(Enum.INSTANCE.name()));
}
@Test
public void handlesEnumsIn$InCorrectly() {
Query query = query(where("foo").in(Enum.INSTANCE));
DBObject result = mapper.getMappedObject(query.getQueryObject(), null);
Object object = result.get("foo");
assertThat(object, is(instanceOf(DBObject.class)));
Object in = ((DBObject) object).get("$in");
assertThat(in, is(instanceOf(BasicDBList.class)));
BasicDBList list = (BasicDBList) in;
assertThat(list.size(), is(1));
assertThat(list.get(0), is(instanceOf(String.class)));
assertThat(list.get(0).toString(), is(Enum.INSTANCE.name()));
}
/**
* @see DATAMONGO-373
*/
@Test
public void handlesNativelyBuiltQueryCorrectly() {
DBObject query = new QueryBuilder().or(new BasicDBObject("foo", "bar")).get();
mapper.getMappedObject(query, null);
}
/**
* @see DATAMONGO-369
*/
@Test
public void handlesAllPropertiesIfDBObject() {
DBObject query = new BasicDBObject();
query.put("foo", new BasicDBObject("$in", Arrays.asList(1, 2)));
query.put("bar", new Person());
DBObject result = mapper.getMappedObject(query, null);
assertThat(result.get("bar"), is(notNullValue()));
}
/**
* @see DATAMONGO-429
*/
@Test
public void transformsArraysCorrectly() {
Query query = new BasicQuery("{ 'tags' : { '$all' : [ 'green', 'orange']}}");
DBObject result = mapper.getMappedObject(query.getQueryObject(), null);
assertThat(result, is(query.getQueryObject()));
}
class Sample {
@Id
private String foo;
}
class BigIntegerId {
@Id
private BigInteger id;
}
enum Enum {
INSTANCE;
}
}
| [
"[email protected]"
] | |
8a81b4cb64b1a08aea0d4ece59b1556bc4a65d8b | 4ac72e49f1d47373651e1b4d71ec8b2fc797fd0e | /src/main/java/com/example/webjpah2/advice/EmployeeNotFoundAdvice.java | 818a560fea5843e128327f62efb3816414114ace | [] | no_license | khoanxl918/web-jpa-h2-hateoas | b6b9973824c3d40b55ff6f8d7bb608a0982a57ef | f349424e15551a1c914250397e8704dac03a5132 | refs/heads/master | 2022-11-04T22:43:32.276548 | 2020-06-20T11:02:56 | 2020-06-20T11:02:56 | 273,691,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 681 | java | package com.example.webjpah2.advice;
import com.example.webjpah2.exception.EmployeeNotFoundException;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice
public class EmployeeNotFoundAdvice {
@ResponseBody
@ExceptionHandler(EmployeeNotFoundException.class)
@ResponseStatus(HttpStatus.NOT_FOUND)
public String empNotFoundHandler(EmployeeNotFoundException e) {
return e.getMessage();
}
}
| [
"[email protected]"
] | |
e9fdce7e35c89806b66799430a11d550bd331d50 | 9ad7fe1a6ce560e4294c4637ee4a40a47317911e | /src/java/work/controllers/util/PaginationHelper.java | 1ca14bff68a0483035e0aab9860d69c20f49bd79 | [] | no_license | gksamuel/work | a1b5760a77e50aedf6c415f9631e2a28f33d4bc2 | 3422d2b54b37ac0ce40d57a1e86d118d78d67fd5 | refs/heads/master | 2020-07-06T10:16:47.149511 | 2019-08-18T09:47:58 | 2019-08-18T09:47:58 | 202,983,171 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,119 | java | package work.controllers.util;
import javax.faces.model.DataModel;
public abstract class PaginationHelper {
public int pageSize;
private int page;
public PaginationHelper(int pageSize) {
this.pageSize = pageSize;
}
public abstract int getItemsCount();
public abstract DataModel createPageDataModel();
public int getPageFirstItem() {
return page * pageSize;
}
public int getPageLastItem() {
int i = getPageFirstItem() + pageSize - 1;
int count = getItemsCount() - 1;
if (i > count) {
i = count;
}
if (i < 0) {
i = 0;
}
return i;
}
public boolean isHasNextPage() {
return (page + 1) * pageSize + 1 <= getItemsCount();
}
public void nextPage() {
if (isHasNextPage()) {
page++;
}
}
public boolean isHasPreviousPage() {
return page > 0;
}
public void previousPage() {
if (isHasPreviousPage()) {
page--;
}
}
public int getPageSize() {
return pageSize;
}
}
| [
"[email protected]"
] | |
9b744fbc2a28f83ab88ed38746f6b0c13b3b1a02 | 7109ce635db200f132a748f9a93e18bbea855874 | /architecture-demo-bridge/src/main/java/com/architecture/example/topology/submit/LocalSubmitTopology.java | 7d714486da58ebb2df65710b2848cab515e19c0d | [] | no_license | yiyongfei/jea-demo | 8da49aeaaaf8e499dfe880e9584abdfdc03c0678 | 8e0ff2f0d3fc1691ba33b1de98d8c9d40e2d839a | refs/heads/master | 2016-08-05T14:04:27.855336 | 2014-12-13T12:26:05 | 2014-12-13T12:26:05 | 27,707,129 | 3 | 4 | null | null | null | null | UTF-8 | Java | false | false | 1,615 | java | package com.architecture.example.topology.submit;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import backtype.storm.Config;
import backtype.storm.LocalCluster;
import com.ea.core.storm.TopologyDefinition;
import com.ea.core.storm.cluster.StormCluster;
import com.ea.core.storm.main.AbstractLocalSubmitTopology;
import com.ea.core.storm.topology.AbstractDRPCTopology;
import com.ea.core.storm.topology.ITopology;
public class LocalSubmitTopology extends AbstractLocalSubmitTopology {
public LocalSubmitTopology(){
super();
Config conf = new Config();
conf.setDebug(false);
conf.setMaxTaskParallelism(3);
conf.put(Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS, 30);//30秒超时
conf.put(Config.TOPOLOGY_MAX_SPOUT_PENDING, 1);
StormCluster cluster = new StormCluster(new LocalCluster());
super.init(cluster, conf);
}
@Override
protected Collection<ITopology> findTopologys() {
// TODO Auto-generated method stub
List<ITopology> list = new ArrayList<ITopology>();
Collection<ITopology> topolotys = TopologyDefinition.findAll();
ITopology tmp = null;
String topologyName = null;
for(ITopology topology : topolotys){
try {
topologyName = topology.getTopologyName();
tmp = topology.getClass().newInstance();
tmp.setTopologyName(topologyName);
if(tmp instanceof AbstractDRPCTopology){
((AbstractDRPCTopology)tmp).setLocalDRPC(this.getClient());
}
list.add(tmp);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return list;
}
}
| [
"[email protected]"
] | |
70462138c56afeb7c84cbd76f3f77d22c6464cab | f03226b4db0a576d8ee5fa53e1c189f8a8fb74c1 | /enigma/Permutation.java | 36be291552707d98386e4c4fc392c9befc9f9168 | [] | no_license | kchen1519/enigma | e011b7314b4a489aada655a660b26a0b22e4cccb | 23b13b1b13aa1f45b398be75477899d0f76fda06 | refs/heads/master | 2021-01-20T16:10:32.336788 | 2017-05-10T08:35:05 | 2017-05-10T08:35:05 | 90,822,792 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,170 | java | package enigma;
import static enigma.EnigmaException.*;
/** Represents a permutation of a range of integers starting at 0 corresponding
* to the characters of an alphabet.
* @author Kevin Chen
*/
class Permutation {
/** Set this Permutation to that specified by CYCLES, a string in the
* form "(cccc) (cc) ..." where the c's are characters in ALPHABET, which
* is interpreted as a permutation in cycle notation. Characters not
* included in any cycle map to themselves. Whitespace is ignored. */
Permutation(String cycles, Alphabet alphabet) {
cycles = cycles.replaceAll("\\s+", "");
if (cycles.length() >= 1 && cycles.charAt(cycles.length() - 1) != ')') {
throw error("Wrongly formatted cycle entered");
}
_alphabet = alphabet;
_condensed = cycles.replaceAll("[ (]", "").split("\\)");
}
/** Add the cycle c0->c1->...->cm->c0 to the permutation, where CYCLE is
* c0c1...cm. */
private void addCycle(String cycle) {
for (int i = 0; i < _condensed.length; i++) {
for (int j = 0; j < cycle.length(); j++) {
if (_condensed[i].indexOf(cycle.charAt(j)) != -1) {
throw error("Can't add cycle with "
+ "character already in other cycle!");
}
}
}
_condensed[_condensed.length] = cycle;
}
/** Return the value of P modulo the size of this permutation. */
final int wrap(int p) {
int r = p % size();
if (r < 0) {
r += size();
}
return r;
}
/** Returns the size of the alphabet I permute. */
int size() {
return _alphabet.size();
}
/** Return the result of applying this permutation to P modulo the
* alphabet size. */
int permute(int p) {
char temp = _alphabet.toChar(wrap(p));
for (int i = 0; i < _condensed.length; i++) {
if (_condensed[i].indexOf(temp) != -1) {
int x = _condensed[i].indexOf(temp);
if (x == _condensed[i].length() - 1) {
return _alphabet.toInt(_condensed[i].charAt(0));
} else {
return _alphabet.toInt(_condensed[i].charAt(x + 1));
}
}
}
return wrap(p);
}
/** Return the result of applying the inverse of this permutation
* to C modulo the alphabet size. */
int invert(int c) {
char temp = _alphabet.toChar(c);
for (int i = 0; i < _condensed.length; i++) {
if (_condensed[i].indexOf(temp) != -1) {
int x = _condensed[i].indexOf(temp);
if (x == 0) {
return _alphabet.toInt(_condensed[i].charAt
(_condensed[i].length() - 1));
} else {
return _alphabet.toInt(_condensed[i].charAt(x - 1));
}
}
}
return c;
}
/** Return the result of applying this permutation to the index of P
* in ALPHABET, and converting the result to a character of ALPHABET. */
char permute(char p) {
int x = _alphabet.toInt(p);
x = permute(x);
return _alphabet.toChar(x);
}
/** Return the result of applying the inverse of this permutation to C. */
int invert(char c) {
int x = _alphabet.toInt(c);
x = invert(x);
return _alphabet.toChar(x);
}
/** Return the alphabet used to initialize this Permutation. */
Alphabet alphabet() {
return _alphabet;
}
/** Return true iff this permutation is a derangement (i.e., a
* permutation for which no value maps to itself). */
boolean derangement() {
for (int i = 0; i < _alphabet.size(); i++) {
int x = permute(i);
if (_alphabet.toChar(i) == _alphabet.toChar(x)) {
return false;
}
}
return true;
}
/** Alphabet of this permutation. */
private Alphabet _alphabet;
/** An array of all Permutation cycles. */
private String[] _condensed;
}
| [
"[email protected]"
] | |
7e91eb5c11a66cab05be8e22aa16cb827bf9799d | e30b236bb93ba4e8c0d083b394e79201bb104bca | /java/com/example/tom_project22/MainActivity.java | 2af48bda915dfc2b931a8084bea59177da8f227b | [
"MIT"
] | permissive | TomRonen1/Kol-Hashfela-radio103.6FM | f07cbcdc2927ecdb57391a35d78f0ec96a3cda8c | ef89084c4d3721cc1798fd0584ca6fd0099b00bb | refs/heads/main | 2023-05-02T10:32:13.070488 | 2021-05-21T12:31:34 | 2021-05-21T12:31:34 | 369,497,487 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,113 | java | package com.example.tom_project22;
/**
* Tom Ronen
* final project -- Radio Kol Hashfela -- 2021
*/
import android.app.ActivityManager;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.ActionBarDrawerToggle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.GravityCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import com.google.android.material.navigation.NavigationView;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import java.util.Calendar;
import java.util.Date;
/**
* activity class
*/
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener, View.OnClickListener {
SharedPreferences sp;
public Fragment fragment;
ProgramDatabase programDatabase = new ProgramDatabase(this);
/**
* the onCreate of the activity
* check if needs to update the database
* set the variables, view, fragment
* @param savedInstanceState
*/
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/*
algorithm that checks if the app needs to update its database:
*/
Date date = Calendar.getInstance().getTime();
int monthNow= date.getMonth();
sp = this.getPreferences(Context.MODE_PRIVATE);
int month = -1;
month = sp.getInt(getResources().getString(R.string.month),-1);
if(month == -1){//if user enters for the first time ever to the app:
Player_frag.IS_FIRST_TIME = true;
SharedPreferences sharedPref = this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putInt(getResources().getString(R.string.month),monthNow);
editor.putBoolean(getString(R.string.is_first_time),true);
editor.apply();
programDatabase.deleteAllData();
programDatabase.insertAllData();
}
else if(month != monthNow){//if the app needs to update data with server:
Player_frag.IS_FIRST_TIME = true;
SharedPreferences sharedPref = this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putInt(getResources().getString(R.string.month),monthNow);
editor.putBoolean(getString(R.string.is_first_time),true);
editor.apply();
programDatabase.deleteAllData();
programDatabase.insertAllData();
}
else{
Player_frag.IS_FIRST_TIME = false;
SharedPreferences sharedPref = this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean(getString(R.string.is_first_time),false);
editor.apply();
}
/*
setting up basic variables for the activity: drawer, toolbar,fragment view and more:
*/
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
getSupportFragmentManager().beginTransaction().replace(R.id.fb, new Player_frag()).commit();
}
/**
*makes sure the code knows if the program has been visited and it does'nt necessarily have to
*update the database next time.
*/
@Override
protected void onDestroy() {
SharedPreferences sharedPref = this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean(getString(R.string.is_first_time),false);
editor.apply();
SharedPreferences sharedPreferences = this.getPreferences(Context.MODE_PRIVATE);
Log.d("called onDestroy","the value of is first time:"+ sharedPreferences.getBoolean(getResources().getString(R.string.is_first_time),false));
super.onDestroy();
}
/**
*the functions creates the dialog if needed
*/
public void createDialog(){
new AlertDialog.Builder(this)
.setTitle("103.6FM")
.setMessage("Are you sure you want to exit?")
.setPositiveButton("YES", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
MainActivity.super.onBackPressed();
}
})
.setNegativeButton("NO", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
})
.setIcon(R.drawable.exiticon)
.show();
}
/**
* when back button is pressed the app needs to take actions:
* first option is to close the drawer if open,
* else open the dialog in case the user wants to exit.
*/
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
createDialog();
}
}
/**
* creates the menu
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
/**
* navigates between the different fragments
*/
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
if(id == R.id.about){
fragment = new about_frag();
}
else if(id==R.id.player_page){
fragment = new Player_frag();
}
else if (id == R.id.nav_share) {
Intent i= new Intent();
i.setAction(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_TEXT,"come check: https://www.1036kh.com/");
i.setType("text/plain");
startActivity(i);
//"https://play.google.com/store/apps/details?id=com.arbel03.a1036fm"
}
if(fragment!=null) {
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.fb, fragment);
((FragmentTransaction) ft).commit();
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
@Override
public void onClick(View view) {}
}
| [
"[email protected]"
] | |
462258287e23b038d3c142b33ba954881aef40c8 | 5ad826c24c8932700fa77008c217a89bb63bed5e | /src/main/java/com/springboot/config/WebMvcConfig.java | 99d4cb18e2835e30e863e51f757adc4699bae8e0 | [] | no_license | zhou-github-name/spring-boot-druid | 16e5cb4589bb041e4d093eb29e55de1876c1f61a | d2679a35171d2c4a369186fcec83344d1c115eb0 | refs/heads/master | 2023-01-08T20:11:11.135077 | 2020-11-11T02:16:07 | 2020-11-11T02:16:07 | 311,834,131 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.springboot.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import com.springboot.interceptor.UserTokenInterceptor;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Bean
public UserTokenInterceptor userTokenInterceptor() {
return new UserTokenInterceptor();
}
/**
* 注册拦截器
*
* @param registry
* @param.重写addInterceptors 添加监听的路径
* @paramaddPathPatterns 添加监听的路径地址
* @paramexcludePathPatterns 排除一些路径
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(userTokenInterceptor())
.addPathPatterns("/hello")
.addPathPatterns("/shopcart/add")
.addPathPatterns("/shopcart/del")
.excludePathPatterns("/myorders/deliver")
.excludePathPatterns("/orders/notifyMerchantOrderPaid");
WebMvcConfigurer.super.addInterceptors(registry);
}
}
| [
"[email protected]"
] | |
f1da053aabafc830170c7cda68e601b432e13f03 | 45d454c5721aa604c55a00966dd7058740331000 | /Decorator/DecoratorDemo.java | fd7353545db7f7de888effa4a9004fed9295a896 | [] | no_license | doubleZ0108/Design-Pattern | b4b72198d1ea59a089ed751afc56ebd925996034 | c191aba298c7acedfa7456fd810da16fba151869 | refs/heads/master | 2021-07-17T12:06:35.516760 | 2020-09-19T12:41:52 | 2020-09-19T12:41:52 | 214,565,626 | 12 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,273 | java | /**
* @program: Design Pattern
* @description: 装饰器
* @author: doubleZ
* @create: 2020/02/22
**/
/**
* 抽象构建
*/
interface Component{
void operation();
}
/**
* 具体构建
*/
class ConcreteComponent implements Component{
@Override
public void operation() {
System.out.println("ConcreteComponent.operation");
}
}
/**
* 抽象装饰器
*/
class Decorator implements Component{
private Component component;
public Decorator(Component component) {
this.component = component;
}
@Override
public void operation() {
component.operation();
}
}
/**
* 具体装饰器
*/
class ConcreteDecorator extends Decorator{
public ConcreteDecorator(Component component) {
super(component);
}
@Override
public void operation() {
super.operation();
addedOperation();
}
public void addedOperation(){
System.out.println("为构建增加的额外功能addedOperation");
}
}
public class DecoratorDemo {
public static void main(String[] args) {
Component component = new ConcreteComponent();
component.operation();
Component decorator = new ConcreteDecorator(component);
decorator.operation();
}
}
| [
"[email protected]"
] | |
90f3cf7080e299001ff4d06c158d632175c23081 | c474b03758be154e43758220e47b3403eb7fc1fc | /apk/decompiled/com.tinder_2018-07-26_source_from_JADX/sources/com/tinder/chat/view/ae.java | e799c62ad65f28aa5ad897ff6d45172a25aab4f1 | [] | no_license | EstebanDalelR/tinderAnalysis | f80fe1f43b3b9dba283b5db1781189a0dd592c24 | 941e2c634c40e5dbf5585c6876ef33f2a578b65c | refs/heads/master | 2020-04-04T09:03:32.659099 | 2018-11-23T20:41:28 | 2018-11-23T20:41:28 | 155,805,042 | 0 | 0 | null | 2018-11-18T16:02:45 | 2018-11-02T02:44:34 | null | UTF-8 | Java | false | false | 304 | java | package com.tinder.chat.view;
import rx.functions.Action1;
final /* synthetic */ class ae implements Action1 {
/* renamed from: a */
static final Action1 f43649a = new ae();
private ae() {
}
public void call(Object obj) {
ChatInputBoxContainer.e((Throwable) obj);
}
}
| [
"[email protected]"
] | |
2fc14fb65ad3e72407a024f19dbb98db4d181fc4 | cfab485f5ff8438f881816c92e96d9571984b98e | /wifi4eu-persistence/src/main/java/wifi4eu/wifi4eu/entity/exportImport/GlobalCommitment.java | eb8e9d086475685c50c77b0d92ef0bbac1de5a44 | [] | no_license | wifi4eu/master | f9f0b7d9a29e997cd6ab0a5087bdfe91cd55f2d6 | cc4c60449e7b7ea23a47183b42869e8df2092d54 | refs/heads/master | 2021-09-25T01:16:53.953994 | 2018-10-16T07:54:45 | 2018-10-16T07:54:45 | 153,153,932 | 8 | 5 | null | null | null | null | UTF-8 | Java | false | false | 1,640 | java | package wifi4eu.wifi4eu.entity.exportImport;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name = "global_commitment")
public class GlobalCommitment {
@Column(name = "id")
@Id
private Integer id;
@Column(name = "call")
private Integer call;
@Column(name = "globalCommitment")
private String globalCommitment;
@Column(name = "ammount")
private String ammount;
@Column(name = "priority")
private Integer priority;
public GlobalCommitment() {}
public GlobalCommitment(Integer id, Integer call, String globalCommitment, String ammount, Integer priority) {
this.id = id;
this.call = call;
this.globalCommitment = globalCommitment;
this.ammount = ammount;
this.priority = priority;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getCall() {
return call;
}
public void setCall(Integer call) {
this.call = call;
}
public String getGlobalCommitment() {
return globalCommitment;
}
public void setGlobalCommitment(String globalCommitment) {
this.globalCommitment = globalCommitment;
}
public String getAmmount() {
return ammount;
}
public void setAmmount(String ammount) {
this.ammount = ammount;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
}
| [
"[email protected]"
] | |
c4b1360c95cb4c6bd9659305e19787b814aa17db | 49fe3c80f4ae2001a9b332b8318cc5946de2ea19 | /src/MaratonaJava/Jmodificadofinal/classes/Comprador.java | 928a0225180024d9148eaae7732abe54079cc769 | [] | no_license | IgorDmoura/MaratonaJava | 45c32be72d6a3744f1e70de34ce666a4ec588149 | 862c452f53981cfb4cd56420328f988d667a0006 | refs/heads/master | 2023-06-01T23:36:13.773090 | 2021-06-18T12:28:39 | 2021-06-18T12:28:39 | 346,050,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package MaratonaJava.Jmodificadofinal.classes;
public class Comprador {
private String nome;
@Override
public String toString() {
return "Comprador{" +
"nome='" + nome + '\'' +
'}';
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
| [
"[email protected]"
] | |
619837ef3e8afa2e3d95ba4d7b85952edf148276 | f904d350275f033d45ea4eb35c1233b757be3b01 | /libandroidplot/src/com/androidplot/xy/BarRenderer.java | ecf5c9db5b50108463f35919ad49535bc4b9b375 | [] | no_license | evermax/sciencetoolkit | 1407c16217575fa799edc4b7c9000623a4bb97a5 | be70f34b4b434d3f89ca909e233c26167417bb51 | refs/heads/master | 2021-01-17T08:23:50.236728 | 2016-03-10T16:59:38 | 2016-03-10T16:59:38 | 52,116,957 | 0 | 0 | null | 2016-02-19T21:16:27 | 2016-02-19T21:16:27 | null | UTF-8 | Java | false | false | 13,744 | java | /*
* Copyright 2012 AndroidPlot.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.androidplot.xy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map.Entry;
import java.util.TreeMap;
import android.graphics.Canvas;
import android.graphics.RectF;
import com.androidplot.exception.PlotRenderException;
import com.androidplot.util.ValPixConverter;
/**
* Renders a point as a Bar
*/
public class BarRenderer<T extends BarFormatter> extends XYSeriesRenderer<T> {
private BarRenderStyle renderStyle = BarRenderStyle.OVERLAID; // default Render Style
private BarWidthStyle widthStyle = BarWidthStyle.FIXED_WIDTH; // default Width Style
private float barWidth = 5;
private float barGap = 1;
public enum BarRenderStyle {
OVERLAID, // bars are overlaid in descending y-val order (largest val in back)
STACKED, // bars are drawn stacked vertically on top of each other
SIDE_BY_SIDE // bars are drawn horizontally next to each-other
}
public enum BarWidthStyle {
FIXED_WIDTH, // bar width is always barWidth
VARIABLE_WIDTH // bar width is calculated so that there is only barGap between each bar
}
public BarRenderer(XYPlot plot) {
super(plot);
}
/**
* Sets the width of the bars when using the FIXED_WIDTH render style
* @param barWidth
*/
public void setBarWidth(float barWidth) {
this.barWidth = barWidth;
}
/**
* Sets the size of the gap between the bar (or bar groups) when using the VARIABLE_WIDTH render style
* @param barGap
*/
public void setBarGap(float barGap) {
this.barGap = barGap;
}
public void setBarRenderStyle(BarRenderStyle renderStyle) {
this.renderStyle = renderStyle;
}
public void setBarWidthStyle(BarWidthStyle widthStyle) {
this.widthStyle = widthStyle;
}
public void setBarWidthStyle(BarWidthStyle style, float value) {
setBarWidthStyle(style);
switch (style) {
case FIXED_WIDTH:
setBarWidth(value);
break;
case VARIABLE_WIDTH:
setBarGap(value);
break;
default:
break;
}
}
@Override
public void doDrawLegendIcon(Canvas canvas, RectF rect, BarFormatter formatter) {
canvas.drawRect(rect, formatter.getFillPaint());
canvas.drawRect(rect, formatter.getBorderPaint());
}
/**
* Retrieves the BarFormatter instance that corresponds with the series passed in.
* Can be overridden to return other BarFormatters as a result of touch events etc.
* @param index index of the point being rendered.
* @param series XYSeries to which the point being rendered belongs.
* @return
*/
@SuppressWarnings("UnusedParameters")
public T getFormatter(int index, XYSeries series) {
return getFormatter(series);
}
public void onRender(Canvas canvas, RectF plotArea) throws PlotRenderException {
List<XYSeries> sl = getPlot().getSeriesListForRenderer(this.getClass());
TreeMap<Number, BarGroup> axisMap = new TreeMap<Number, BarGroup>();
// dont try to render anything if there's nothing to render.
if(sl == null) return;
/*
* Build the axisMap (yVal,BarGroup)... a TreeMap of BarGroups
* BarGroups represent a point on the X axis where a single or group of bars need to be drawn.
*/
// For each Series
for(XYSeries series : sl) {
BarGroup barGroup;
// For each value in the series
for(int i = 0; i < series.size(); i++) {
if (series.getX(i) != null) {
// get a new bar object
Bar b = new Bar(series,i,plotArea);
// Find or create the barGroup
if (axisMap.containsKey(b.intX)) {
barGroup = axisMap.get(b.intX);
} else {
barGroup = new BarGroup(b.intX,plotArea);
axisMap.put(b.intX, barGroup);
}
barGroup.addBar(b);
}
}
}
// Loop through the axisMap linking up prev pointers
BarGroup prev, current;
prev = null;
for(Entry<Number, BarGroup> mapEntry : axisMap.entrySet()) {
current = mapEntry.getValue();
current.prev = prev;
prev = current;
}
// The default gap between each bar section
int gap = (int) barGap;
// Determine roughly how wide (rough_width) this bar should be. This is then used as a default width
// when there are gaps in the data or for the first/last bars.
float f_rough_width = ((plotArea.width() - ((axisMap.size() - 1) * gap)) / (axisMap.size() - 1));
int rough_width = (int) f_rough_width;
if (rough_width < 0) rough_width = 0;
if (gap > rough_width) {
gap = rough_width / 2;
}
//Log.d("PARAMTER","PLOT_WIDTH=" + plotArea.width());
//Log.d("PARAMTER","BAR_GROUPS=" + axisMap.size());
//Log.d("PARAMTER","ROUGH_WIDTH=" + rough_width);
//Log.d("PARAMTER","GAP=" + gap);
/*
* Calculate the dimensions of each barGroup and then draw each bar within it according to
* the Render Style and Width Style.
*/
for(Number key : axisMap.keySet()) {
BarGroup barGroup = axisMap.get(key);
// Determine the exact left and right X for the Bar Group
switch (widthStyle) {
case FIXED_WIDTH:
// use intX and go halfwidth either side.
barGroup.leftX = barGroup.intX - (int) (barWidth / 2);
barGroup.width = (int) barWidth;
barGroup.rightX = barGroup.leftX + barGroup.width;
break;
case VARIABLE_WIDTH:
if (barGroup.prev != null) {
if (barGroup.intX - barGroup.prev.intX - gap - 1 > (int)(rough_width * 1.5)) {
// use intX and go halfwidth either side.
barGroup.leftX = barGroup.intX - (rough_width / 2);
barGroup.width = rough_width;
barGroup.rightX = barGroup.leftX + barGroup.width;
} else {
// base left off prev right to get the gap correct.
barGroup.leftX = barGroup.prev.rightX + gap + 1;
if (barGroup.leftX > barGroup.intX) barGroup.leftX = barGroup.intX;
// base right off intX + halfwidth.
barGroup.rightX = barGroup.intX + (rough_width / 2);
// calculate the width
barGroup.width = barGroup.rightX - barGroup.leftX;
}
} else {
// use intX and go halfwidth either side.
barGroup.leftX = barGroup.intX - (rough_width / 2);
barGroup.width = rough_width;
barGroup.rightX = barGroup.leftX + barGroup.width;
}
break;
default:
break;
}
//Log.d("BAR_GROUP", "rough_width=" + rough_width + " width=" + barGroup.width + " <" + barGroup.leftX + "|" + barGroup.intX + "|" + barGroup.rightX + ">");
/*
* Draw the bars within the barGroup area.
*/
switch (renderStyle) {
case OVERLAID:
Collections.sort(barGroup.bars, new BarComparator());
for (Bar b : barGroup.bars) {
BarFormatter formatter = b.formatter();
PointLabelFormatter plf = formatter.getPointLabelFormatter();
PointLabeler pointLabeler = null;
if (formatter != null) {
pointLabeler = formatter.getPointLabeler();
}
//Log.d("BAR", b.series.getTitle() + " <" + b.barGroup.leftX + "|" + b.barGroup.intX + "|" + b.barGroup.rightX + "> " + b.intY);
if (b.barGroup.width >= 2) {
canvas.drawRect(b.barGroup.leftX, b.intY, b.barGroup.rightX, b.barGroup.plotArea.bottom, formatter.getFillPaint());
}
canvas.drawRect(b.barGroup.leftX, b.intY, b.barGroup.rightX, b.barGroup.plotArea.bottom, formatter.getBorderPaint());
if(plf != null && pointLabeler != null) {
canvas.drawText(pointLabeler.getLabel(b.series, b.seriesIndex), b.intX + plf.hOffset, b.intY + plf.vOffset, plf.getTextPaint());
}
}
break;
case SIDE_BY_SIDE:
int width = (int) barGroup.width / barGroup.bars.size();
int leftX = barGroup.leftX;
Collections.sort(barGroup.bars, new BarComparator());
for (Bar b : barGroup.bars) {
BarFormatter formatter = b.formatter();
PointLabelFormatter plf = formatter.getPointLabelFormatter();
PointLabeler pointLabeler = null;
if (formatter != null) {
pointLabeler = formatter.getPointLabeler();
}
//Log.d("BAR", "width=" + width + " <" + leftX + "|" + b.intX + "|" + (leftX + width) + "> " + b.intY);
if (b.barGroup.width >= 2) {
canvas.drawRect(leftX, b.intY, leftX + width, b.barGroup.plotArea.bottom, formatter.getFillPaint());
}
canvas.drawRect(leftX, b.intY, leftX + width, b.barGroup.plotArea.bottom, formatter.getBorderPaint());
if(plf != null && pointLabeler != null) {
canvas.drawText(pointLabeler.getLabel(b.series, b.seriesIndex), leftX + width/2 + plf.hOffset, b.intY + plf.vOffset, plf.getTextPaint());
}
leftX = leftX + width;
}
break;
case STACKED:
int bottom = (int) barGroup.plotArea.bottom;
Collections.sort(barGroup.bars, new BarComparator());
for (Bar b : barGroup.bars) {
BarFormatter formatter = b.formatter();
PointLabelFormatter plf = formatter.getPointLabelFormatter();
PointLabeler pointLabeler = null;
if (formatter != null) {
pointLabeler = formatter.getPointLabeler();
}
int height = (int) b.barGroup.plotArea.bottom - b.intY;
int top = bottom - height;
//Log.d("BAR", "top=" + top + " bottom=" + bottom + " height=" + height);
if (b.barGroup.width >= 2) {
canvas.drawRect(b.barGroup.leftX, top, b.barGroup.rightX, bottom, formatter.getFillPaint());
}
canvas.drawRect(b.barGroup.leftX, top, b.barGroup.rightX, bottom, formatter.getBorderPaint());
if(plf != null && pointLabeler != null) {
canvas.drawText(pointLabeler.getLabel(b.series, b.seriesIndex), b.intX + plf.hOffset, b.intY + plf.vOffset, plf.getTextPaint());
}
bottom = top;
}
break;
default:
break;
}
}
}
private class Bar {
public XYSeries series;
public int seriesIndex;
public double yVal, xVal;
public int intX, intY;
public float pixX, pixY;
public BarGroup barGroup;
public Bar(XYSeries series, int seriesIndex, RectF plotArea) {
this.series = series;
this.seriesIndex = seriesIndex;
this.xVal = series.getX(seriesIndex).doubleValue();
this.pixX = ValPixConverter.valToPix(xVal, getPlot().getCalculatedMinX().doubleValue(), getPlot().getCalculatedMaxX().doubleValue(), plotArea.width(), false) + (plotArea.left);
this.intX = (int) pixX;
if (series.getY(seriesIndex) != null) {
this.yVal = series.getY(seriesIndex).doubleValue();
this.pixY = ValPixConverter.valToPix(yVal, getPlot().getCalculatedMinY().doubleValue(), getPlot().getCalculatedMaxY().doubleValue(), plotArea.height(), true) + plotArea.top;
this.intY = (int) pixY;
} else {
this.yVal = 0;
this.pixY = plotArea.bottom;
this.intY = (int) pixY;
}
}
public BarFormatter formatter() {
return getFormatter(seriesIndex, series);
}
}
private class BarGroup {
public ArrayList<Bar> bars;
public int intX;
public int width, leftX, rightX;
public RectF plotArea;
public BarGroup prev;
public BarGroup(int intX, RectF plotArea) {
// Setup the TreeMap with the required comparator
this.bars = new ArrayList<Bar>(); // create a comparator that compares series title given the index.
this.intX = intX;
this.plotArea = plotArea;
}
public void addBar(Bar bar) {
bar.barGroup = this;
this.bars.add(bar);
}
}
@SuppressWarnings("WeakerAccess")
public class BarComparator implements Comparator<Bar>{
@Override
public int compare(Bar bar1, Bar bar2) {
switch (renderStyle) {
case OVERLAID:
return Integer.valueOf(bar1.intY).compareTo(bar2.intY);
case SIDE_BY_SIDE:
return bar1.series.getTitle().compareToIgnoreCase(bar2.series.getTitle());
case STACKED:
return bar1.series.getTitle().compareToIgnoreCase(bar2.series.getTitle());
default:
return 0;
}
}
}
}
| [
"[email protected]"
] | |
a946f07e20b8f06480b1654faf5707f212034e9d | c598ad3ec3b18e69ae7cea968439f722ea546ce5 | /Shapes.java | b742f47eecf254c778c3e6b2e802e363d33deb56 | [
"MIT"
] | permissive | rosie-duffin/shapesoverload | d19c6b4a47c543c86dd27f4755a42acc42648b6c | 13e2978b12956cd8c6676db9c2bf66c3a552961b | refs/heads/main | 2023-07-28T08:52:43.960061 | 2021-09-08T10:13:08 | 2021-09-08T10:13:08 | 404,300,721 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | class Shapes{
static int area(int s){
return s*s;
}
static int area(int l, int w){
return l*w;
}
public static void main(String[] args){
int areaSquare=area(4);
int areaRect=area(2,6);
System.out.println("Square = "+areaSquare);
System.out.println("Rectangle = "+areaRect);
}
} | [
"[email protected]"
] | |
0bf28d14e5368199ef2be7cf4695513df5348061 | 356b6a422755a7f7b7003ef114f891d8a598148b | /gantryCranes_quanZhou/src/main/java/net/pingfang/service/websoket/SocketIoClient_Bay.java | d62f4d5a913c139837dd541bba60c70714217406 | [] | no_license | JackietLee/allproject | 886be6e5bd7d08ddeb2ef093fa4b64adc080ef48 | 743d96cdca50f5da19ddbe8ea035b18c3699091e | refs/heads/main | 2023-06-24T17:35:10.292447 | 2021-07-20T11:25:28 | 2021-07-20T11:25:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,212 | java | package net.pingfang.service.websoket;
import java.net.URISyntaxException;
import javax.annotation.Resource;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import io.socket.client.IO;
import io.socket.client.Socket;
import io.socket.emitter.Emitter;
import net.pingfang.entity.config.Config;
import net.pingfang.utils.DateUtil;
/**
* @author:cgf
* @describe:连接消息服务,进入房间,更新消息服务等操作。
* @date:2019年10月16日上午14:00:30
*/
@Component
public class SocketIoClient_Bay {
private static final Logger log = LoggerFactory.getLogger(SocketIoClient_Bay.class);
private Socket socket;
@Resource
private Config config;
public static final String MESSAGE_TYPE_FOUR = "16"; //车牌检查作业报文类型
/**
* 连接消息服务器方法
**/
public void connectSocket() throws URISyntaxException {
socket = IO.socket(config.getCon_url() + ":" + config.getCon_port() + "?clientid=" + config.getServiceCode());
/**
* 输出连接消息服务信息
**/
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
@Override
public void call(Object... args) {
log.info("用户 [" + config.getServiceCode() + "] 已连接消息服务!");
try {
inToServiceToRoom();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
/**
* 进入或者离开房间提示
**/
socket.on("JoinOrLeaveRoom", new Emitter.Listener() {
@Override
public void call(Object... args) {
String Date = args[0].toString();
JSONObject roomDataJson = null;
try {
roomDataJson = new JSONObject(Date);
log.info("用户 [" + config.getServiceCode() + "] 已进入 [" + roomDataJson.getString("roomName") + "] 房间!");
} catch (JSONException e) {
log.error("json 错误:" + e.getMessage());
}
}
});
/**
* 编辑JobQueue数据后返回uuid
**/
socket.on("uuid", new Emitter.Listener() {
@Override
public void call(Object... args) {
log.info("编辑redis缓存返回uuid:" + args[0].toString());
String uuid = args[0].toString();
String jsonStr = args[1].toString();
if (null != uuid && !"".equals(uuid) && null != jsonStr && !"".equals(jsonStr)) {
try {
JSONObject json = new JSONObject(jsonStr);
/*String conmmandName = json.getString("commandName");
if("updateBay".equals(conmmandName)) {
messageContent(uuid, conmmandName); // 广播编辑消息
}*/
messageContent(uuid, json.getString("commandName"),json.getString("crane_num"),json.get("state").toString(),json.getString("workData")); // 广播编辑消息
} catch (JSONException e) {
e.printStackTrace();
}
}
}
});
/**
* 删除缓存返回UUID
**/
socket.on("returnUuid", new Emitter.Listener() {
@Override
public void call(Object... args) {
log.info("删除redis缓存uuid:" + args[0].toString());
String uuid = args[0].toString();
String jsonStr = args[1].toString();
if (null != uuid && !"".equals(uuid) && null != jsonStr && !"".equals(jsonStr)) {
//VariableTemp vt = JSON.parseObject(jsonStr, VariableTemp.class);
//messageContent(uuid, vt.getCommandName()); // 广播编辑消息
//log.info("岸桥编号:" + vt.getSenderCode());
//log.info("commandName:" + vt.getCommandName());
}
}
});
/***
* 输出返回消息
*/
socket.on("message", new Emitter.Listener() {
@Override
public void call(Object... args) {
log.info("消息服务返回信息:" + args[0].toString());
}
});
/**
* 接收(service)房间广播消息和点对点消息
*/
/* socket.on("messageevent", new Emitter.Listener() {
@Override
public void call(Object... args) {
JSONObject jsonData = new JSONObject(args[0].toString());
log.info("用户 [" + jsonData.get("sourceClientId") + "] 发来的信息:" + jsonData.get("msgContent"));
//1、解析消息
String msgContent = jsonData.get("msgContent").toString();
JSONObject contentJson = new JSONObject(msgContent);
if(msgContent.contains("message_type")) {
if(contentJson.getString("message_type").equals("06")){
//1 调用API修改数据库
JSONObject objt = new JSONObject(contentJson.get("parameter").toString());
JSONObject jobJson = new JSONObject(objt.get("job").toString());
JobData jobData = new JobData();
jobData.setJobkey(objt.getString("jobkey"));
jobData.setJob(jobJson.toString());
//调用API放行结果保存到数据库!
log.info("开始调用API修改数据");
try {
//apiUrl = config.getApiUrl() + "/work/insertWorkRecord";
apiUrl = config.getApiUrl() + "/dataService/insertWorkRecord";
HttpEntity<String> entity = new HttpEntity<String>(jobData.getJob(), headers);
ResponseEntity<String> respMsg = restTemplate.exchange(apiUrl, HttpMethod.POST,entity, String.class);
log.info("修改数据API返回信息:" + respMsg);
} catch (Exception e) {
log.error("调用API修改数据错误,错误信息:"+e.getMessage());
}
//2删除redis
deleteByKey(jobData.getJobkey(),jobJson.getString("crane_num"),"deletejob");
}else {
log.info("报文类型错误!收到的报文类型是:"+contentJson.getString("message_type"));
}
}else {
//上锁或解锁
if(contentJson.getString("commandName").equals("lock")){
log.info("上锁指令!");
VariableTemp variable = new VariableTemp();
variable.setCommandName("lock");
variable.setJobkey(contentJson.getJSONObject("parameter").getString("jobkey"));
variable.setSenderCode(contentJson.getString("senderCode"));
variable.setSendTime(contentJson.getString("sendTime"));
findDateByRoomAndKeySave(contentJson.getJSONObject("parameter").getString("jobkey"),variable);
}else if(contentJson.getString("commandName").equals("unlock")) {
log.info("解锁指令!");
VariableTemp variable = new VariableTemp();
variable.setCommandName("unlock");
variable.setJobkey(contentJson.getJSONObject("parameter").getString("jobkey"));
variable.setSenderCode("");
variable.setSendTime("");
findDateByRoomAndKeySave(contentJson.getJSONObject("parameter").getString("jobkey"),variable);
}
}
}
});
*/
/***
* 输出类型获取所有数据
*/
socket.on("findAllDate", new Emitter.Listener() {
public void call(Object... args) {
/*try {
String jsonList = args[0].toString();//查找出来的数据
JSONObject json = new JSONObject(jsonList);
Iterator<String> it = json.keys();// 使用迭代器
JSONObject jsonObject = new JSONObject(args[1].toString()); //传过来的参数
//System.out.println("findAllDate ->" +jsonObject.toString());
String craneNum = jsonObject.getString("laneCode"); //岸桥编号
List<String> delKeyList = new ArrayList<String>(); //需要删除的KEY
String key = null;
while (it.hasNext()) {
key = it.next(); // 获取key
JSONObject jsonData = new JSONObject(json.getString(key).toString());
//报文类型("16")
if(MESSAGE_TYPE_FOUR.equals(jsonData.getString("message_type"))) {
//岸桥编号
if(craneNum.equals(jsonData.getString("crane_num"))) {
delKeyList.add(key);
// System.out.println("key: "+key);
//System.out.println(jsonData);
log.info("删除16号报文key: "+key);
log.info("删除16号报文key: "+jsonData.toString());
}
}
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}*/
}
});
/**
* 输出断开连接方法消息
*/
socket.on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
@Override
public void call(Object... args) {
log.info("用户 [" + config.getServiceCode() + "] 已断开消息服务!");
}
});
socket.connect();
}
/***
* 进入房间
*
* @throws JSONException
*/
public void inToServiceToRoom() throws JSONException {
JSONObject obj = new JSONObject();
obj.put("roomName", "Service");
obj.put("clientId", config.getServiceCode());
obj.put("state", 1);
socket.emit("joinOrLeaveRoom", obj);
}
/***
* 广播的消息内容
* @throws JSONException
**/
public void messageContent(String uuid, String updateOrdel,String crane_num,String state,String workData) throws JSONException {
/**
* "commandCode":"bfea0d75-7aff-4e1c-b4e4-93abe65ad6d8",
* "commandName":"updatejob",
* "senderCode":"webuser",
* "recipientCode":"serviceid",
* "parameter":{"jobkey":"0db9d70c-040b-4b19-914f-9de2504c79ce","job":"完整Jobqueue",},
* "sendTime":"2018-08-11 16:17:55"
*/
JSONObject objectData = new JSONObject();
JSONObject serverkeyObject = new JSONObject();
serverkeyObject.put("jobkey", uuid);
serverkeyObject.put("crane_num", crane_num);
serverkeyObject.put("state", state);
objectData.put("commandCode", "bfea0d75-7aff-4e1c-b4e4-93abe65ad6d8");
objectData.put("commandName", updateOrdel);
objectData.put("senderCode", config.getServiceCode());
objectData.put("recipientCode", "Client");
objectData.put("sendTime", DateUtil.getDate("yyyy-MM-dd HH:mm:ss"));
if(null !=workData) {
serverkeyObject.put("workData", workData);
}
objectData.put("parameter", serverkeyObject);
sendBroadcast(objectData.toString());
}
/***
* 广播消息
* @throws JSONException
*/
public void sendBroadcast(String objectData) throws JSONException {
JSONObject obj = new JSONObject();
obj.put("sourceClientId", config.getServiceCode());
obj.put("roomsName", "Client");
obj.put("state", 1);
obj.put("msgContent", objectData);
log.info("广播消息内容:" + obj);
socket.emit("broadcast", obj);
}
/**
* 新增数据service房间JobQueue数据
* @param keyId UUID
* @param crane_num 岸桥编号
* @param jobQueue 作业报文JSON字符串
* @throws InterruptedException
* @throws JSONException
*/
public void addJobQueueDate(String operationType,String msgType,String craneNum, String workData) {
try {
JSONObject jobQueueJson = new JSONObject();
JSONObject objStr = new JSONObject();
objStr.put("message_type", msgType);
objStr.put("passtime", DateUtil.getDate("yyyy-MM-dd HH:mm:ss"));
objStr.put("work_type", msgType);
objStr.put("operation_type", operationType);
objStr.put("state", 1);
jobQueueJson.put("d5a36f80-df93-449c-824f-bde81d89885f", objStr);
jobQueueJson.put("message_type", msgType);
/**
* sourceClientId:
* roomsName:房间名称
* msgContent:消息内容
* typeName:消息类型
* State:状态,状态为1
*/
JSONObject obj = new JSONObject();
obj.put("sourceClientId", config.getServiceCode());
obj.put("roomsName", "Service");
obj.put("msgContent", jobQueueJson.toString());
obj.put("typeName", "work");
obj.put("State", 1);
//obj.put("keyId", UUID.randomUUID().toString());
obj.put("keyId", "d5a36f80-df93-449c-824f-bde81d89885f");
JSONObject msgJson = new JSONObject();
msgJson.put("msgType", msgType);
msgJson.put("commandName", operationType);
msgJson.put("crane_num", craneNum);
msgJson.put("state", 1);
msgJson.put("workData", workData);
obj.put("railWayCode", msgJson.toString());
//新增数据
socket.emit("insertDateByRoomId", obj);
} catch (JSONException e1) {
e1.printStackTrace();
}
}
/****
* 断开连接
**/
public void disconnection() {
if (socket.connected()) {
socket.disconnect();
}
}
}
| [
"[email protected]"
] | |
72a085bcb1603e2507ea00e82ffff0644c55314d | 9ef21441f2ef0ede95747ba7c49ba08259fb5448 | /src/main/java/me/lqw/blog8/job/DatabaseBackupJob.java | f097354d6ea5d69315aa704108e24f3d83a9a484 | [] | no_license | qwli6/blog8 | d00a9f0ba4ae5c6a2de39cd22af91418c7621996 | b8569d9d34208563b4b845211dd456cdfeff7635 | refs/heads/master | 2022-12-16T13:37:26.289134 | 2020-09-29T09:02:43 | 2020-09-29T09:02:43 | 114,002,196 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 4,033 | java | package me.lqw.blog8.job;
import me.lqw.blog8.BlogProperties;
import me.lqw.blog8.service.SimpleMailHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.*;
/**
* 数据库数据备份 job
*
* @author liqiwen
* @version 1.2
* @since 1.2
* @since 2.3
*/
@Component
public class DatabaseBackupJob implements DisposableBean {
/**
* 记录日志
*/
private final Logger logger = LoggerFactory.getLogger(getClass().getSimpleName());
/**
* 博客配置文件
*/
private final BlogProperties blogProperties;
/**
* 邮件处理
*/
private final SimpleMailHandler mailHandler;
/**
* 构造方法
* @param blogProperties blogProperties
* @param mailHandler mailHandler
*/
public DatabaseBackupJob(BlogProperties blogProperties, SimpleMailHandler mailHandler) {
this.blogProperties = blogProperties;
this.mailHandler = mailHandler;
}
/**
* 定时备份数据库
* 每天晚上 22 点 45 分 3 秒执行一次,备份成功后将备份文件通过邮件发送至指定邮箱
* @since 2.3
*/
@Scheduled(cron = "3 45 22 * * ?")
@Async("blogThreadPoolExecutor")
public void backup() {
boolean backupDb = blogProperties.isBackupDb();
if(!backupDb){
logger.info("DatabaseBackupJob backup has closed!");
return;
}
String dbUser = blogProperties.getDbUser();
String dbHost = blogProperties.getDbHost();
String dbPass = blogProperties.getDbPassword();
String dbPort = blogProperties.getDbPort();
String dbName = blogProperties.getDbName();
String backPath = blogProperties.getBackPath();
String[] commands = new String[]{"mysqldump", dbName,
"--default-character-set=utf8mb4", "-h" + dbHost, "-P" + dbPort,
"-u" + dbUser , "-p" + dbPass, "--result-file=" + backPath};
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(commands);
Process process = null;
try {
process = processBuilder.start();
process.waitFor();
//获取线程输入流
InputStream inputStream = process.getInputStream();
//获取进程错误流
InputStream errorStream = process.getErrorStream();
//获取输出流
OutputStream outputStream = process.getOutputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
String temp;
while ((temp = bufferedReader.readLine()) != null){
//流中的内容需要读取出来,不然会阻塞 JVM
logger.info("temp: [{}]", temp);
}
logger.info("backup.sql back finished!");
File backSqlFile = new File(backPath);
if(backSqlFile.exists()){
logger.info("backup.sql file send file to admin!");
boolean sendResult = mailHandler.sendMailAttach(backSqlFile);
if(sendResult) {
logger.info("backup.sql file send file finished!");
boolean delete = backSqlFile.delete();
logger.info("file delete finished [{}]", delete);
}
}
} catch (IOException | InterruptedException e) {
logger.error("DatabaseBackupJob exception:[{}]", e.getMessage(), e);
e.printStackTrace();
} finally {
if(process != null && process.isAlive()){
process.destroy();
}
}
}
@Override
public void destroy() throws Exception {
logger.info("DatabaseBackupJob destroy()");
}
}
| [
"[email protected]"
] | |
5107f6f1a5405144df458dcd8f74fa154d90d4b1 | 2a55c133a56db06f98998bbe8750eb692444df1b | /src/test/Test.java | 64834d2dc9c3ff6a4f1dbe1efdb95536ef143743 | [] | no_license | analaurap/AnaTestProject | 54ac8afefa52d69fe6b37f127d894ada95062bd0 | 8c6045fad97e3e9b76bc7a5ed0acbec6e6e7f90d | refs/heads/master | 2021-01-12T14:06:52.427360 | 2016-10-06T14:26:10 | 2016-10-06T14:26:10 | 70,161,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package test;
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Sharing a project using GIT.");
System.out.println("Test 2.");
}
}
| [
"[email protected]"
] | |
0a8c555c571dbe602e782dd76242250ded2c034e | 5b936e0fb3752966a66a0094d4575b21f7824ac8 | /src/main/java/com/atguigu/common/pojo/aop/math3/ArithmeticCalculatorXMLImpl.java | edc42cbe241517d4e45226245528c9bbbabd2680 | [] | no_license | lhh1994hello/ssm_demo1 | eeb9f42eca3aee70659cbe432513fea614aa9712 | c8ea8dc5611129ca700d72c7a301a2be685ca66f | refs/heads/master | 2020-04-16T01:54:06.810152 | 2019-04-23T15:05:51 | 2019-04-23T15:05:51 | 165,190,011 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 775 | java | package com.atguigu.common.pojo.aop.math3;
import com.atguigu.common.pojo.aop.math2.ArithmeticCalculator2;
import org.springframework.stereotype.Component;
/**
* @Author: lhh
* @Date: 2019/4/7 15:57
* @Version 1.0
* 测试基于XML方式配置AOP
*/
@Component
public class ArithmeticCalculatorXMLImpl implements ArithmeticCalculatorXML {
@Override
public int add(int i, int j) {
int result = i + j;
return result;
}
@Override
public int sub(int i, int j) {
int result = i - j;
return result;
}
@Override
public int mul(int i, int j) {
int result = i * j;
return result;
}
@Override
public int div(int i, int j) {
int result = i / j;
return result;
}
}
| [
"[email protected]"
] | |
66eddfeb50a271bb6b337a1c4414fa1b1cb511a9 | 8d135ded56b906dde12a40a679c4a77ec1b24a49 | /app/src/main/java/com/rarahat02/rarahat02/spl3/ui/activity/login/User.java | 16e4be39f32ed0dc6cde8b1ce7c68da78a24e8c3 | [
"Apache-2.0"
] | permissive | rarahat02/spl3 | 1d6dcee25c3d555099111d7da57f912e46e56ced | b6fe7498209adc5c223492ef8548b512497f7f12 | refs/heads/master | 2021-01-20T11:38:13.359032 | 2017-12-21T13:51:39 | 2017-12-21T13:51:39 | 101,675,037 | 0 | 0 | null | 2017-10-07T08:58:27 | 2017-08-28T18:35:03 | null | UTF-8 | Java | false | false | 1,252 | java | package com.rarahat02.rarahat02.spl3.ui.activity.login;
/**
* Created by AndroidBash on 10/07/16
*/
public class User {
private String id;
private String name;
private String phoneNumber;
private String email;
private String password;
public User() {
}
public User(String id, String name, String phoneNumber, String email, String password) {
this.id = id;
this.name = name;
this.phoneNumber = phoneNumber;
this.email = email;
this.password = password;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
| [
"[email protected]"
] | |
b899e45e5227bb65f06c260e58e5a918a92a87c1 | 331434190b7659aedd8ec85367b2bd37c9970276 | /src/BinaryTree/CommonAncestorOfBinaryTree.java | bfb245412ccdcfadc21e2135845ce0bee8bcb755 | [] | no_license | bigwego/algorithm | 0eac330abecf795d526099f45327792ffee9851e | 23551df69d8443adad8001b1a33ab090230b55e4 | refs/heads/master | 2021-07-13T17:55:08.031184 | 2020-07-17T01:25:26 | 2020-07-17T01:25:26 | 159,403,625 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 655 | java | package BinaryTree;
/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/
public class CommonAncestorOfBinaryTree {
private TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) {
if (root == null || root == p || root == q) {
return root;
}
TreeNode left = lowestCommonAncestor(root.left, p, q);
TreeNode right = lowestCommonAncestor(root.right, p, q);
if (left != null && right != null) {
return root;
}
return left == null ? right : left;
}
}
| [
"[email protected]"
] | |
438e133399d8a5f1427aab3690927c4d8b0df928 | 8cd120823f23ba7ceb4ed034489e8efa2a115d00 | /MyApplication/app/src/main/java/com/example/xj/myapplication/MainActivity.java | 4abcaa54f4d568f41bc37afc1ab6145b87297ffb | [] | no_license | szxj2012/cfzz_android_studio2 | 684a83b22d1f4398144e396175108d52de81c1be | c0c3b4bba51a6391cd505a3dab9c62ba8ab94f91 | refs/heads/master | 2020-06-05T15:54:51.183862 | 2015-02-12T07:50:19 | 2015-02-12T07:50:19 | 30,689,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,338 | java | package com.example.xj.myapplication;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
public class MainActivity extends ActionBarActivity {
@InjectView(R.id.text1)
TextView text1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.inject(this);
text1.setText("xxxxx");
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
| [
"[email protected]"
] | |
eb6910a0fda3772edbf071b41fcf844a726cc8d5 | 650aa000f7a32b3e160819bd76878857770b33b4 | /weixin-sdk/src/main/java/com/kenanai/weixin/sdk/bus/BusLineSearch.java | 70e0be7c7acb9500f49bc0ef78604bdc4f223d2b | [] | no_license | guoyunsky/weixin | 1b930ee5ebb6778c79a434d8d4b64bfb7d79775a | ddc4a39b23cc13bc637ddbfe02b59586f64f63af | refs/heads/master | 2020-12-11T05:51:45.643431 | 2014-04-06T07:17:38 | 2014-04-06T07:17:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.kenanai.weixin.sdk.bus;
/**
*
* @ClassName: BusLineSearch
* @Description: 公交线路查询
* @author leixl
* @date 2014年4月3日 下午12:09:20
*
*/
public class BusLineSearch {
}
| [
"[email protected]"
] | |
2de305c4b0f2b6d937ae361c6de2712d053c02c7 | e8469ceede4c429ce6ac3a4d1d210c48702a6894 | /src/main/java/ch/sbb/fss/uic301/parser/StatementPeriod.java | 7eebda30f637c2c3426fc27674f5520030b1c13a | [] | no_license | dzaks/parser2 | 7c9981e0906c8d77d10bcfaaa66efde97a61f353 | ac90e6b8ac1ddf69dda4e7ddd8c90205325e007f | refs/heads/master | 2023-04-12T08:44:14.915979 | 2020-05-22T18:35:52 | 2020-05-22T18:35:52 | 268,142,662 | 0 | 0 | null | 2021-04-26T20:20:16 | 2020-05-30T19:01:58 | Java | UTF-8 | Java | false | false | 6,668 | java | package ch.sbb.fss.uic301.parser;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.Payload;
/**
* Statement period. YY=Year, MM=Month, PP=Period in the month (00 default,
* other usage must be bilaterally agreed upon).
*/
public final class StatementPeriod implements Comparable<StatementPeriod> {
private final int year;
private final int month;
private final int period;
/**
* Constructor with all data.
*
* @param year
* Year (0-99).
* @param month
* Month (1-12).
* @param period
* Period - Default 0, other usage must be bilaterally agreed
* upon (>=0).
*/
public StatementPeriod(final int year, final int month, final int period) {
super();
if (year < 0 || year > 99) {
throw new IllegalArgumentException(
"Expected year >=0 and <=99, but was: " + year);
}
if (month < 1 || month > 12) {
throw new IllegalArgumentException(
"Expected month 1-12, but was: " + month);
}
if (period < 0 || period > 99) {
throw new IllegalArgumentException(
"Expected period > 0, but was: " + period);
}
this.year = year;
this.month = month;
this.period = period;
}
/**
* Returns the year.
*
* @return Year (>= 1900).
*/
public final int getYear() {
return year;
}
/**
* Returns the month.
*
* @return Month (1-12).
*/
public final int getMonth() {
return month;
}
/**
* Returns the period.
*
* @return Period - Default 0, other usage must be bilaterally agreed upon
* (>=0)
*/
public final int getPeriod() {
return period;
}
@Override
public final int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + year;
result = prime * result + month;
result = prime * result + period;
return result;
}
@Override
public final boolean equals(final Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final StatementPeriod other = (StatementPeriod) obj;
if (year != other.year) {
return false;
}
if (month != other.month) {
return false;
}
if (period != other.period) {
return false;
}
return true;
}
@Override
public final int compareTo(final StatementPeriod other) {
// Year
if (year > other.year) {
return 1;
}
if (year < other.year) {
return -1;
}
// Month
if (month > other.month) {
return 1;
}
if (month < other.month) {
return -1;
}
// Period
if (period > other.period) {
return 1;
}
if (period < other.period) {
return -1;
}
return 0;
}
@Override
public String toString() {
return year + "/" + month + "-" + period;
}
/**
* Determines if the given string is a valid statement period.
*
* @param str
* String to verify or <code>null</code>.
*
* @return <code>true</code> if the string can be converted into a statement
* period.
*/
public static boolean valid(final String str) {
if (str == null) {
return true;
}
if (str.length() != 6 || !str.matches("\\d{6}")) {
return false;
}
final String yearStr = str.substring(0, 2);
final String monthStr = str.substring(2, 4);
final String periodStr = str.substring(4, 6);
final int year = Integer.valueOf(yearStr);
final int month = Integer.valueOf(monthStr);
final int period = Integer.valueOf(periodStr);
if (year < 0 || year > 99) {
return false;
}
if (month < 1 || month > 12) {
return false;
}
if (period < 0 || period > 99) {
return false;
}
return true;
}
/**
* Creates an instance from the given string.
*
* @param str
* Statement period (YYMMPP). YY=Year, MM=Month, PP=Period in the
* month or <code>null</code>.
*
* @return New instance or <code>null</code>.
*/
public static StatementPeriod valueOf(final String str) {
if (str == null) {
return null;
}
if (!valid(str)) {
throw new IllegalArgumentException(
"Expected YYMMPP, but was: '" + str + "'");
}
final String year = str.substring(0, 2);
final String month = str.substring(2, 4);
final String period = str.substring(4, 6);
return new StatementPeriod(Integer.valueOf(year),
Integer.valueOf(month), Integer.valueOf(period));
}
/**
* String that contains a statement period in format 'YYMMPP'.
*/
@Documented
@Constraint(validatedBy = Validator.class)
@Target({ METHOD, FIELD, ANNOTATION_TYPE, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface StatementPeriodStr {
String message() default "Expected 'YYMMPP', but was: '${validatedValue}'";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
}
/**
* Verifies if a string has format 'YYMMPP'.
*/
public static final class Validator
implements ConstraintValidator<StatementPeriodStr, String> {
@Override
public boolean isValid(final String value,
final ConstraintValidatorContext context) {
return StatementPeriod.valid(value);
}
}
}
| [
"[email protected]"
] | |
fdeb4a7d1a72eb8a46952d0f497d0067976d070a | af38ec4ba73a2a0fe662f2cfad7bb82afb7a1d8c | /app/src/main/java/com/uzair/chatmodulewithfirebase/SharedPrefHelper.java | b89ab1dd23e8be155282b0c1cfbb7c7c25dba8ed | [] | no_license | uzairmughal3397/chatModuleWithFirestore | b7bcb3b90645000aaeb1b557a50a9646edf9a096 | de12b7f034803d750c67d86e730077ee9516029f | refs/heads/main | 2023-02-18T12:26:46.727602 | 2021-01-17T11:16:04 | 2021-01-17T11:16:04 | 324,099,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,552 | java | package com.uzair.chatmodulewithfirebase;
import android.content.Context;
import android.content.SharedPreferences;
public class SharedPrefHelper {
private static final int MODE = 0;
public SharedPrefHelper() {
}
private static SharedPreferences getPreferences(Context context) {
return context.getSharedPreferences("", 0);
}
private static SharedPreferences.Editor getEditor(Context context) {
return getPreferences(context).edit();
}
public static void writeInteger(Context context, String str, int i) {
getEditor(context).putInt(str, i).commit();
}
public static int readInteger(Context context, String str) {
return getPreferences(context).getInt(str, 0);
}
public static void writeString(Context context, String str, String str2) {
getEditor(context).putString(str, str2).commit();
}
public static String readString(Context context, String str) {
return getPreferences(context).getString(str, null);
}
public static boolean checkContain(Context context, String str) {
return getPreferences(context).contains(str);
}
public static void clearAll(Context context) {
getEditor(context).clear().commit();
}
public static void writeBoolean(Context context, String str, boolean z) {
getPreferences(context).edit().putBoolean(str, z).apply();
}
public static boolean readBoolean(Context context, String str) {
return getPreferences(context).getBoolean(str, false);
}
} | [
"[email protected]"
] | |
90e090a40f5c30cf384420b545f316b4fca5ce01 | baee3ef7cc98badf8a87e9f74ddd1a6d70b096b0 | /.urionlinejudge/src/GRAPH/MillasToChicago.java | 9f8133bde1e3ac97021684e26d3bc4a9e399254d | [] | no_license | groverinho/Java | eb4863737888d552ac313e23f0e7e2fd2dc45aa7 | 0b0c612eb03cf27b8310448bcf72da4565be0af6 | refs/heads/master | 2021-12-25T11:32:46.222179 | 2021-09-10T22:48:14 | 2021-09-10T22:48:14 | 47,481,887 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,598 | java | package GRAPH;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;
public class MillasToChicago
{
public static void main(String[] args)
{
Scanner entrada = new Scanner(System.in);
while (true)
{
int nodo = entrada.nextInt();//cantidad de nodos
if (nodo== 0)
break;
int n = entrada.nextInt();//cantidad de vertices - conexiones
double [][] matrizAdyacencia = new double[nodo][nodo];
// inicio todas las posiciones de mi matriz en 0
for (int i = 0; i < matrizAdyacencia.length; i++)
for (int j = 0; j < matrizAdyacencia.length; j++)
matrizAdyacencia[i][j]=0.0;
//cargamos inicio, fin y pesos hasta n (cant de conexiones)
for (int i = 0; i < n; i++)
{
int a = entrada.nextInt();
int b = entrada.nextInt();
int peso = entrada.nextInt();
matrizAdyacencia[a-1][b-1]=peso/100.0;
matrizAdyacencia[b-1][a-1]=peso/100.0;
}
double[][]nueva = floyd(matrizAdyacencia,nodo);
// for (int i = 0; i < matrizAdyacencia.length; i++)
// {
// for (int j = 0; j < matrizAdyacencia.length; j++)
// {
// System.out.print(matrizAdyacencia[i][j]+"\t");
// }
// System.out.println();
// }
System.out.printf("%.6f percent\n",nueva[0][nodo-1]*100.0);
}
}
//algoritmo de floyd-warshall
static double[][] floyd (double w[][],int n)
{
for (int k = 0; k < n; k++)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
if(i!=j)
w[i][j]=Math.max(w[i][j],w[i][k]*w[k][j]);//anadimos ruta minima en la posision
}
}
}
return w;
}
}
| [
"[email protected]"
] | |
248304d17efc95b2a51f5b83f93056633f464049 | 1b0ea8ad5a9b20d4c2993b3619016f883d835560 | /src/net/jforum/view/admin/ForumAction.java | 5a988e7570a939a8be37b105482d881899b291c0 | [] | no_license | yecpster/igearbook | 97606843da226bd3f08b6c1d58c900a419cc3d9a | 35d6304bffaca9867f3acb514f48ff854054e060 | refs/heads/master | 2021-01-17T10:59:05.254408 | 2016-07-23T09:12:04 | 2016-07-23T09:12:04 | 13,015,069 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,868 | java | /*
* Copyright (c) JForum Team
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* 1) Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* 2) 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.
* 3) Neither the name of "Rafael Steil" nor
* the names of its contributors may be used to endorse
* or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
* HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
* BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
*
* This file creation date: Mar 28, 2003 / 8:21:56 PM
* The JForum Project
* http://www.jforum.net
*/
package net.jforum.view.admin;
import java.util.List;
import net.jforum.dao.CategoryDAO;
import net.jforum.dao.DataAccessDriver;
import net.jforum.dao.ForumDAO;
import net.jforum.dao.GroupDAO;
import net.jforum.dao.GroupSecurityDAO;
import net.jforum.dao.TopicDAO;
import net.jforum.dao.UserDAO;
import net.jforum.entities.Category;
import net.jforum.entities.Forum;
import net.jforum.entities.Group;
import net.jforum.entities.User;
import net.jforum.repository.ForumRepository;
import net.jforum.repository.RolesRepository;
import net.jforum.repository.SecurityRepository;
import net.jforum.security.PermissionControl;
import net.jforum.security.Role;
import net.jforum.security.RoleValue;
import net.jforum.security.RoleValueCollection;
import net.jforum.security.SecurityConstants;
import net.jforum.util.preferences.ConfigKeys;
import net.jforum.util.preferences.SystemGlobals;
import net.jforum.util.preferences.TemplateKeys;
import net.jforum.view.admin.common.ModerationCommon;
import com.google.common.collect.Lists;
/**
* @author Rafael Steil
* @version $Id: ForumAction.java,v 1.34 2007/08/25 00:11:29 rafaelsteil Exp $
*/
public class ForumAction extends AdminCommand {
// Listing
@Override
public void list() {
this.context.put("categories", DataAccessDriver.getInstance().newCategoryDAO().selectAll());
this.context.put("repository", new ForumRepository());
this.setTemplateName(TemplateKeys.FORUM_ADMIN_LIST);
}
// One more, one more
public void insert() {
final CategoryDAO cm = DataAccessDriver.getInstance().newCategoryDAO();
final GroupDAO groupDao = DataAccessDriver.getInstance().newGroupDAO();
final List<Group> selectedGroups = Lists.newArrayList();
final List<Group> candidateGrups = groupDao.getCandidateGroups(selectedGroups);
this.context.put("accessCandidateGroups", candidateGrups);
this.context.put("replyCandidateGroups", candidateGrups);
this.context.put("postCandidateGroups", candidateGrups);
this.context.put("htmlCandidateGroups", candidateGrups);
this.context.put("accessSelectedGroups", selectedGroups);
this.context.put("replySelectedGroups", selectedGroups);
this.context.put("postSelectedGroups", selectedGroups);
this.context.put("htmlSelectedGroups", selectedGroups);
this.context.put("categories", cm.selectAll());
this.context.put("action", "insertSave");
this.setTemplateName(TemplateKeys.FORUM_ADMIN_INSERT);
}
// A new one
public void insertSave() {
final Forum f = new Forum();
f.setDescription(this.request.getParameter("description"));
f.setCategoryId(this.request.getIntParameter("categories_id"));
f.setName(this.request.getParameter("forum_name"));
f.setLogo(this.request.getParameter("forum_Logo"));
f.setModerated("1".equals(this.request.getParameter("moderate")));
final int forumId = DataAccessDriver.getInstance().newForumDAO().addNew(f);
f.setId(forumId);
ForumRepository.addForum(f);
final GroupSecurityDAO gmodel = DataAccessDriver.getInstance().newGroupSecurityDAO();
final PermissionControl pc = new PermissionControl();
pc.setSecurityModel(gmodel);
// Access
final GroupDAO groupDao = DataAccessDriver.getInstance().newGroupDAO();
final Group accessGroup = groupDao.addNewEntitlementGroup(SecurityConstants.PERM_FORUM, forumId);
this.addRole(pc, SecurityConstants.PERM_FORUM, forumId, accessGroup);
final String[] groupsAccess = request.getParameterValues("groupsAccess");
updateChildGroups(accessGroup, groupsAccess, groupDao);
// Anonymous posts
final Group anonymousPostsGroup = groupDao.addNewEntitlementGroup(SecurityConstants.PERM_ANONYMOUS_POST, forumId);
this.addRole(pc, SecurityConstants.PERM_ANONYMOUS_POST, forumId, anonymousPostsGroup);
final boolean permitAnonymousPosts = "1".equals(this.request.getParameter("permitAnonymousPosts"));
if (permitAnonymousPosts) {
final UserDAO um = DataAccessDriver.getInstance().newUserDAO();
final int anonymousUid = Integer.parseInt(SystemGlobals.getValue(ConfigKeys.ANONYMOUS_USER_ID));
um.addToGroup(anonymousUid, new int[] { anonymousPostsGroup.getId() });
}
// Permit to replay
final Group replyGroup = groupDao.addNewEntitlementGroup(SecurityConstants.PERM_REPLY, forumId);
this.addRole(pc, SecurityConstants.PERM_REPLY, forumId, replyGroup);
final String[] groupsReply = request.getParameterValues("groupsReply");
updateChildGroups(replyGroup, groupsReply, groupDao);
// Permit to new post
final Group newPostGroup = groupDao.addNewEntitlementGroup(SecurityConstants.PERM_NEW_POST, forumId);
this.addRole(pc, SecurityConstants.PERM_NEW_POST, forumId, newPostGroup);
final String[] groupsPost = request.getParameterValues("groupsPost");
updateChildGroups(newPostGroup, groupsPost, groupDao);
// HTML
final Group htmlGroup = groupDao.addNewEntitlementGroup(SecurityConstants.PERM_HTML_DISABLED, forumId);
this.addRole(pc, SecurityConstants.PERM_HTML_DISABLED, forumId, htmlGroup);
final String[] groupsHtml = request.getParameterValues("groupsHtml");
updateChildGroups(htmlGroup, groupsHtml, groupDao);
SecurityRepository.clean();
RolesRepository.clear();
// this.handleMailIntegration();
this.list();
}
// Edit
public void edit() {
final int forumId = this.request.getIntParameter("forum_id");
final ForumDAO forumDao = DataAccessDriver.getInstance().newForumDAO();
final CategoryDAO cm = DataAccessDriver.getInstance().newCategoryDAO();
final GroupDAO groupDao = DataAccessDriver.getInstance().newGroupDAO();
final Group accessGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_FORUM, forumId);
final List<Group> accessSelectedGroups = groupDao.getChildGroups(accessGroup.getId());
this.context.put("accessSelectedGroups", accessSelectedGroups);
this.context.put("accessCandidateGroups", groupDao.getCandidateGroups(accessSelectedGroups));
final int anonymousUid = Integer.parseInt(SystemGlobals.getValue(ConfigKeys.ANONYMOUS_USER_ID));
final boolean permitAnonymousPosts = SecurityRepository.canAccess(anonymousUid, SecurityConstants.PERM_ANONYMOUS_POST, String.valueOf(forumId));
this.context.put("permitAnonymousPosts", permitAnonymousPosts);
Group moderationGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_MODERATION_FORUMS, forumId);
if (moderationGroup == null) {
moderationGroup = this.createModerationGroup(groupDao, forumId);
}
final List<User> moderators = DataAccessDriver.getInstance().newUserDAO().selectAllByGroup(moderationGroup.getId(), 0, 50);
this.context.put("moderationGroup", moderationGroup);
this.context.put("moderators", moderators);
final Group replyGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_REPLY, forumId);
final List<Group> replySelectedGroups = groupDao.getChildGroups(replyGroup.getId());
this.context.put("replySelectedGroups", replySelectedGroups);
this.context.put("replyCandidateGroups", groupDao.getCandidateGroups(replySelectedGroups));
final Group newPostGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_NEW_POST, forumId);
final List<Group> postSelectedGroups = groupDao.getChildGroups(newPostGroup.getId());
this.context.put("postSelectedGroups", postSelectedGroups);
this.context.put("postCandidateGroups", groupDao.getCandidateGroups(postSelectedGroups));
final Group htmlPostGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_HTML_DISABLED, forumId);
final List<Group> htmlSelectedGroups = groupDao.getChildGroups(htmlPostGroup.getId());
this.context.put("htmlSelectedGroups", htmlSelectedGroups);
this.context.put("htmlCandidateGroups", groupDao.getCandidateGroups(htmlSelectedGroups));
this.setTemplateName(TemplateKeys.FORUM_ADMIN_EDIT);
this.context.put("categories", cm.selectAll());
this.context.put("action", "editSave");
this.context.put("forum", forumDao.selectById(forumId));
// Mail Integration
// MailIntegrationDAO integrationDao =
// DataAccessDriver.getInstance().newMailIntegrationDAO();
// this.context.put("mailIntegration", integrationDao.find(forumId));
}
public void editSave() {
final ForumDAO forumDao = DataAccessDriver.getInstance().newForumDAO();
final int forumId = this.request.getIntParameter("forum_id");
final Forum f = forumDao.selectById(forumId);
final boolean moderated = f.isModerated();
final int categoryId = f.getCategoryId();
f.setDescription(this.request.getParameter("description"));
f.setCategoryId(this.request.getIntParameter("categories_id"));
f.setName(this.request.getParameter("forum_name"));
f.setLogo(this.request.getParameter("forum_logo"));
f.setModerated("1".equals(this.request.getParameter("moderate")));
forumDao.update(f);
if (moderated != f.isModerated()) {
new ModerationCommon().setTopicModerationStatus(f.getId(), f.isModerated());
}
if (categoryId != f.getCategoryId()) {
f.setCategoryId(categoryId);
ForumRepository.removeForum(f);
f.setCategoryId(this.request.getIntParameter("categories_id"));
ForumRepository.addForum(f);
} else {
ForumRepository.reloadForum(f.getId());
}
// this.handleMailIntegration();
// Forum access
final GroupDAO groupDao = DataAccessDriver.getInstance().newGroupDAO();
final Group accessGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_FORUM, forumId);
final String[] groupsAccess = request.getParameterValues("groupsAccess");
updateChildGroups(accessGroup, groupsAccess, groupDao);
// Anonymous post
final boolean permitAnonymousPosts = "1".equals(this.request.getParameter("permitAnonymousPosts"));
final Group anonymousPostsGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_ANONYMOUS_POST, forumId);
final UserDAO um = DataAccessDriver.getInstance().newUserDAO();
final int anonymousUid = Integer.parseInt(SystemGlobals.getValue(ConfigKeys.ANONYMOUS_USER_ID));
final int[] groupIds = { anonymousPostsGroup.getId() };
um.removeFromGroup(anonymousUid, groupIds);
if (permitAnonymousPosts) {
um.addToGroup(anonymousUid, groupIds);
}
// Permit to reply
final Group replyGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_REPLY, forumId);
final String[] groupsReply = request.getParameterValues("groupsReply");
updateChildGroups(replyGroup, groupsReply, groupDao);
// Permit to new post
final Group newPostGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_NEW_POST, forumId);
final String[] groupsPost = request.getParameterValues("groupsPost");
updateChildGroups(newPostGroup, groupsPost, groupDao);
// HTML
final Group htmlGroup = groupDao.getEntitlementGroup(SecurityConstants.PERM_HTML_DISABLED, forumId);
final String[] groupsHtml = request.getParameterValues("groupsHtml");
updateChildGroups(htmlGroup, groupsHtml, groupDao);
SecurityRepository.clean();
RolesRepository.clear();
this.list();
}
// private void handleMailIntegration() {
// int forumId = this.request.getIntParameter("forum_id");
// MailIntegrationDAO dao =
// DataAccessDriver.getInstance().newMailIntegrationDAO();
//
// if (!"1".equals(this.request.getParameter("mail_integration"))) {
// dao.delete(forumId);
// } else {
// boolean exists = dao.find(forumId) != null;
//
// MailIntegration m = this.fillMailIntegrationFromRequest();
//
// if (exists) {
// dao.update(m);
// } else {
// dao.add(m);
// }
// }
// }
//
// private MailIntegration fillMailIntegrationFromRequest() {
// MailIntegration m = new MailIntegration();
//
// m.setForumId(this.request.getIntParameter("forum_id"));
// m.setForumEmail(this.request.getParameter("forum_email"));
// m.setPopHost(this.request.getParameter("pop_host"));
// m.setPopUsername(this.request.getParameter("pop_username"));
// m.setPopPassword(this.request.getParameter("pop_password"));
// m.setPopPort(this.request.getIntParameter("pop_port"));
// m.setSSL("1".equals(this.request.getParameter("requires_ssl")));
//
// return m;
// }
public void up() {
this.processOrdering(true);
}
public void down() {
this.processOrdering(false);
}
private void processOrdering(final boolean up) {
final Forum toChange = new Forum(ForumRepository.getForum(Integer.parseInt(this.request.getParameter("forum_id"))));
final Category category = ForumRepository.getCategory(toChange.getCategoryId());
final List<Forum> forums = Lists.newArrayList(category.getForums());
final int index = forums.indexOf(toChange);
if (index == -1 || (up && index == 0) || (!up && index + 1 == forums.size())) {
this.list();
return;
}
final ForumDAO fm = DataAccessDriver.getInstance().newForumDAO();
if (up) {
// Get the forum which comes *before* the forum we're changing
final Forum otherForum = new Forum(forums.get(index - 1));
fm.setOrderUp(toChange, otherForum);
} else {
// Get the forum which comes *after* the forum we're changing
final Forum otherForum = new Forum(forums.get(index + 1));
fm.setOrderDown(toChange, otherForum);
}
category.changeForumOrder(toChange);
ForumRepository.refreshCategory(category);
this.list();
}
// Delete
public void delete() {
final String ids[] = this.request.getParameterValues("forum_id");
final ForumDAO forumDao = DataAccessDriver.getInstance().newForumDAO();
final TopicDAO topicDao = DataAccessDriver.getInstance().newTopicDAO();
if (ids != null) {
for (int i = 0; i < ids.length; i++) {
final int forumId = Integer.parseInt(ids[i]);
topicDao.deleteByForum(forumId);
forumDao.delete(forumId);
final Forum f = new Forum(ForumRepository.getForum(forumId));
ForumRepository.removeForum(f);
}
SecurityRepository.clean();
RolesRepository.clear();
}
this.list();
}
private Group createModerationGroup(final GroupDAO groupDao, final int forumId) {
final GroupSecurityDAO gmodel = DataAccessDriver.getInstance().newGroupSecurityDAO();
final PermissionControl pc = new PermissionControl();
pc.setSecurityModel(gmodel);
final Group moderationGroup = groupDao.addNewEntitlementGroup(SecurityConstants.PERM_MODERATION_FORUMS, forumId);
this.addRole(pc, SecurityConstants.PERM_CREATE_STICKY_ANNOUNCEMENT_TOPICS, forumId, moderationGroup);
this.addRole(pc, SecurityConstants.PERM_MODERATION_FORUMS, forumId, moderationGroup);
this.addRole(pc, SecurityConstants.PERM_MODERATION_APPROVE_MESSAGES, forumId, moderationGroup);
this.addRole(pc, SecurityConstants.PERM_MODERATION_POST_REMOVE, forumId, moderationGroup);
this.addRole(pc, SecurityConstants.PERM_MODERATION_POST_EDIT, forumId, moderationGroup);
this.addRole(pc, SecurityConstants.PERM_MODERATION_TOPIC_MOVE, forumId, moderationGroup);
this.addRole(pc, SecurityConstants.PERM_MODERATION_TOPIC_LOCK_UNLOCK, forumId, moderationGroup);
return moderationGroup;
}
private void updateChildGroups(final Group parentGroup, String[] groups, final GroupDAO groupDao) {
if (groups == null) {
groups = new String[] {};
}
final int[] childGroupIDs = new int[groups.length];
for (int i = 0; i < groups.length; i++) {
childGroupIDs[i] = Integer.parseInt(groups[i]);
}
groupDao.updateChildGroups(parentGroup.getId(), childGroupIDs);
}
private void addRole(final PermissionControl pc, final String roleName, final int forumId, final Group group) {
final Role role = new Role();
role.setName(roleName);
final RoleValueCollection roleValues = new RoleValueCollection();
final RoleValue rv = new RoleValue();
rv.setValue(Integer.toString(forumId));
roleValues.add(rv);
pc.addRoleValue(group.getId(), role, roleValues);
}
}
| [
"[email protected]"
] | |
1b2dfad91bc64db1be22a8d573278cacaea888fb | d222de126163144bef5f6bf5c733451a36218690 | /app/src/main/java/com/example/appmabbicaracommunity/HiraganaActivity.java | 09de64ef77e31ae6801e8362fcfda39c07b1c73a | [] | no_license | mrum13/kamus-3-bahasa-app | 9771b71202beffab5c1a4904d95c2b5d10b5dd94 | fc8e50635fae2f47e8fc81410e7e07aa630667c7 | refs/heads/master | 2023-08-06T08:48:11.994827 | 2021-09-18T09:25:47 | 2021-09-18T09:25:47 | 352,307,967 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,474 | java | package com.example.appmabbicaracommunity;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
public class HiraganaActivity extends AppCompatActivity implements AdapterRecyclerView.ItemClickListener {
AdapterRecyclerView adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hiragana);
// data to populate the RecyclerView with
String[] data = {"あ A", "い I", "う U", "え E", "お O", "か KA", "き KI", "く KU", "け KE", "こ KO", "さ SA", "し SHI","す SU",
"せ SE","そ SO","た TA","ち CHI","つ TSU","て TE","と TO","な NA","に NI","ぬ NU","ね NE","の NO","は HA","ひ HI","ふ FU","へ HE",
"ほ HO","ま MA","み MI","む MU","め ME","も MO","や YA","","ゆ YU","よ YO","ら RA","り RI","る RU","れ RE","ろ RO","わ WA",
"","を WO","","ん N"};
// set up the RecyclerView
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rvNumbers);
int numberOfColumns = 5;
recyclerView.setLayoutManager(new GridLayoutManager(this, numberOfColumns));
adapter = new AdapterRecyclerView(this, data);
adapter.setClickListener(this);
recyclerView.setAdapter(adapter);
}
} | [
"[email protected]"
] | |
9c335a4f5e721629ef6176cda024606ad05f9825 | 800391064d513694784e8d41c67b934fc9f885f3 | /src/com/jdon/util/ClassUtil.java | b949ad0e51be634ba58903f9d49c2467b737ae17 | [
"Apache-2.0"
] | permissive | aduan/jdonframework | 3322088502205706de66398bcfe31e74402539cb | 1a4ef2db995f9a851e387746eb8466a3189a283a | refs/heads/master | 2021-01-18T08:56:26.212888 | 2013-04-27T06:07:33 | 2013-04-27T06:07:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,504 | java | /*
* Copyright 2003-2009 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.jdon.util;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ClassUtil {
public static Class[] getParentAllInterfaces(Class pojoClass) {
Class[] interfaces = null;
try {
List interfacesL = new ArrayList();
while (pojoClass != null) {
for (int i = 0; i < pojoClass.getInterfaces().length; i++) {
Class ifc = pojoClass.getInterfaces()[i];
// not add jdk interface
if (!ifc.getName().startsWith("java."))
interfacesL.add(ifc);
}
pojoClass = pojoClass.getSuperclass();
}
if (interfacesL.size() == 0) {
throw new Exception();
}
interfaces = (Class[]) interfacesL.toArray(new Class[interfacesL.size()]);
} catch (Exception e) {
}
return interfaces;
}
public static Class[] getAllInterfaces(Class clazz) {
if (clazz == null) {
return new Class[0];
}
List<Class> classList = new ArrayList<Class>();
while (clazz != null) {
Class[] interfaces = clazz.getInterfaces();
for (Class interf : interfaces) {
if (!classList.contains(interf)) {
classList.add(interf);
}
Class[] superInterfaces = getAllInterfaces(interf);
for (Class superIntf : superInterfaces) {
if (!classList.contains(superIntf)) {
classList.add(superIntf);
}
}
}
clazz = clazz.getSuperclass();
}
return classList.toArray(new Class[classList.size()]);
}
public static Field[] getAllDecaredFields(Class clazz) {
List<Field> fields = new ArrayList<Field>();
// fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
Class[] superClasses = getAllSuperclasses(clazz);
for (Class superClass : superClasses) {
fields.addAll(Arrays.asList(superClass.getDeclaredFields()));
}
return fields.toArray(new Field[fields.size()]);
}
public static Class finddAnnotationForMethod(Class clazz, Class annotationClass) {
Class[] superClasses = getAllSuperclasses(clazz);
if (superClasses != null)
for (Class superClass : superClasses) {
if (superClass.isAnnotationPresent(annotationClass)) {
return superClass;
}
}
superClasses = getParentAllInterfaces(clazz);
if (superClasses != null)
for (Class superClass : superClasses) {
if (superClass.isAnnotationPresent(annotationClass)) {
return superClass;
}
}
return null;
}
public static Method finddAnnotationForMethod(Method m, Class annotationClass) {
try {
Class[] superClasses = getAllSuperclasses(m.getDeclaringClass());
if (superClasses != null)
for (Class superClass : superClasses) {
for (Method ms : superClass.getDeclaredMethods()) {
if (ms.isAnnotationPresent(annotationClass)) {
if (ms.getName() == m.getName()) {
return ms;
}
}
}
}
superClasses = getParentAllInterfaces(m.getDeclaringClass());
if (superClasses != null)
for (Class superClass : superClasses) {
for (Method ms : superClass.getDeclaredMethods()) {
if (ms.isAnnotationPresent(annotationClass)) {
if (ms.getName() == m.getName()) {
return ms;
}
}
}
}
} catch (SecurityException e) {
e.printStackTrace();
}
return null;
}
public static Method[] getAllDecaredMethods(Class clazz) {
List<Method> methods = new ArrayList<Method>();
// fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
Class[] superClasses = getAllSuperclasses(clazz);
for (Class superClass : superClasses) {
methods.addAll(Arrays.asList(superClass.getDeclaredMethods()));
}
// superClasses = getParentAllInterfaces(clazz);
// for (Class superClass : superClasses) {
// methods.addAll(Arrays.asList(superClass.getDeclaredMethods()));
// }
return methods.toArray(new Method[methods.size()]);
}
public static Class[] getAllSuperclasses(Class cls) {
if (cls == null) {
return new Class[0];
}
List<Class> classList = new ArrayList<Class>();
Class superClass = cls;
while (superClass != null && !Object.class.equals(superClass) && !Class.class.equals(superClass)) {
classList.add(superClass);
superClass = superClass.getSuperclass();
}
return classList.toArray(new Class[classList.size()]);
}
public static Field getDecaredField(Class clazz, String name) throws NoSuchFieldException {
Field field = null;
Class[] superClasses = getAllSuperclasses(clazz);
for (Class superClass : superClasses) {
try {
field = superClass.getDeclaredField(name);
break;
} catch (NoSuchFieldException e) {
// ignore
}
}
if (field == null) {
throw new NoSuchFieldException("No such declared field " + name + " in " + clazz);
}
return field;
}
}
| [
"[email protected]"
] | |
9ccbc288a0913f892d5c4c652e23db1b4473d8a8 | 4e83c6b2a8a5b59cd28bcbd0a33c1544b5f222b2 | /src/main/java/trex/examples/RuleR1.java | 323c8e64e4a845f6cfa4ffa314538388c511f52c | [] | no_license | BehnamKhazael/T-Rex | e936078f326e98d51aebe81572f4aca5bf2cb277 | 7ea747e731ac43de267e6a7046728c80883e7e64 | refs/heads/master | 2022-12-11T06:28:56.440014 | 2020-09-16T05:46:54 | 2020-09-16T05:46:55 | 295,935,868 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,030 | java | package trex.examples;
import trex.common.*;
import trex.marshalling.Marshaller;
import trex.packets.PubPkt;
import trex.packets.RulePkt;
import trex.packets.SubPkt;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import static trex.common.Consts.AggregateFun.AVG;
import static trex.common.Consts.CompKind.EACH_WITHIN;
import static trex.common.Consts.ConstraintOp.*;
import static trex.common.Consts.StateType.AGG;
import static trex.common.Consts.StateType.STATE;
import static trex.common.Consts.ValType.FLOAT;
import static trex.common.Consts.ValType.INT;
import static trex.common.Consts.ValType.STRING;
import static trex.examples.RuleR0.EVENT_FIRE;
import static trex.examples.RuleR0.EVENT_SMOKE;
import static trex.examples.RuleR0.EVENT_TEMP;
/**
* Created by sony on 2/10/2020.
*
*
* Rule R1:
*
* define Fire(area: string, measuredTemp: int)
* from Smoke(area=$a) and
* each Temp(area=$a and value>45) within 5 min. from Smoke
* where area=Smoke.area and measuredTemp=Temp.value
*
* char RuleR0::ATTR_TEMPVALUE[]= "value";
char RuleR0::ATTR_AREA[]= "area";
char RuleR0::ATTR_MEASUREDTEMP[]= "measuredTemp";
char RuleR0::AREA_GARDEN[]= "garden";
char RuleR0::AREA_OFFICE[]= "office";
char RuleR0::AREA_TOILET[]= "toilet";
*
*/
public class RuleR1 {
public RulePkt buildRule(){
RulePkt rule= new RulePkt(false);
int indexPredSmoke= 0;
int indexPredTemp= 1;
Long fiveMin = 1000L*60L*5L;
// Smoke root predicate
// Fake constraint as a temporary workaround to an engine's bug
// FIXME remove workaround when bug fixed
Constraint fakeConstr[] = new Constraint[1];
fakeConstr[0] = new Constraint();
// fakeConstr[1] = new Constraint();
fakeConstr[0].setName("area");
fakeConstr[0].setValType(STRING);
fakeConstr[0].setOp(IN);
fakeConstr[0].setStringVal("");
rule.addRootPredicate(EVENT_SMOKE, fakeConstr, 1);
// Temp predicate
// Constraint: Temp.value > 45
Constraint tempConstr[] = new Constraint[2];
tempConstr[0] = new Constraint();
tempConstr[0].setName("value");
tempConstr[0].setValType(INT);
tempConstr[0].setOp(GT);
tempConstr[0].setIntVal(20);
tempConstr[1] = new Constraint();
tempConstr[1].setName("accuracy");
tempConstr[1].setValType(INT);
tempConstr[1].setOp(LT);
tempConstr[1].setIntVal(5);
rule.addPredicate(EVENT_TEMP, tempConstr, 2, indexPredSmoke, fiveMin, EACH_WITHIN);
// Parameter: Smoke.area=Temp.area
rule.addParameterBetweenStates(indexPredSmoke, "area", indexPredTemp, "area");
// Fire template
EventTemplate fireTemplate= new EventTemplate(EVENT_FIRE);
// Area attribute in template
OpTree areaOpTree= new OpTree(new RulePktValueReference(indexPredSmoke, STATE, "area"), STRING);
fireTemplate.addAttribute("area", areaOpTree);
// MeasuredTemp attribute in template
OpTree measuredTempOpTree= new OpTree(new RulePktValueReference(indexPredTemp, STATE, "value"), INT);
fireTemplate.addAttribute("measuredtemp", measuredTempOpTree);
rule.setEventTemplate(fireTemplate);
return rule;
}
public SubPkt buildSubscription() {
Constraint constr[] = new Constraint[1];
// Area constraint
constr[0] = new Constraint();
constr[0].setName("area");
constr[0].setValType(STRING);
constr[0].setOp(EQ);
constr[0].setStringVal("office");
return new SubPkt(EVENT_FIRE, constr, 1);
}
public ArrayList<byte[]> buildPublication(){
// Temp event
Attribute tempAttr[] = new Attribute[3];
tempAttr[0] = new Attribute();
tempAttr[1] = new Attribute();
tempAttr[2] = new Attribute();
// Value attribute
tempAttr[0].setName("value");
tempAttr[0].setValType(INT);
tempAttr[0].setIntVal(44);
// Area attribute
tempAttr[1].setName("area");
tempAttr[1].setValType(STRING);
tempAttr[1].setStringVal("office");
tempAttr[2].setName("accuracy");
tempAttr[2].setValType(INT);
tempAttr[2].setIntVal(1);
PubPkt tempPubPkt= new PubPkt(EVENT_TEMP, tempAttr, 3);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Smoke event
// Area attribute
Attribute smokeAttr[] = new Attribute[1];
smokeAttr[0] = new Attribute();
smokeAttr[0].setName("area");
smokeAttr[0].setValType(STRING);
smokeAttr[0].setStringVal("office");
PubPkt smokePubPkt= new PubPkt(EVENT_SMOKE, smokeAttr, 1);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Temp event
Attribute tempAttr2[] = new Attribute[3];
tempAttr2[0] = new Attribute();
tempAttr2[1] = new Attribute();
tempAttr2[2] = new Attribute();
// Value attribute
tempAttr2[0].setName("value");
tempAttr2[0].setValType(INT);
tempAttr2[0].setIntVal(50);
// Area attribute
tempAttr2[1].setName("area");
tempAttr2[1].setValType(STRING);
tempAttr2[1].setStringVal("office");
tempAttr2[2].setName("accuracy");
tempAttr2[2].setValType(INT);
tempAttr2[2].setIntVal(1);
PubPkt tempPubPkt2= new PubPkt(EVENT_TEMP, tempAttr2, 3);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Temp event
Attribute tempAttr3[] = new Attribute[3];
tempAttr3[0] = new Attribute();
tempAttr3[1] = new Attribute();
tempAttr3[2] = new Attribute();
// Value attribute
tempAttr3[0].setName("value");
tempAttr3[0].setValType(INT);
tempAttr3[0].setIntVal(80);
// Area attribute
tempAttr3[1].setName("area");
tempAttr3[1].setValType(STRING);
tempAttr3[1].setStringVal("office");
tempAttr3[2].setName("accuracy");
tempAttr3[2].setValType(INT);
tempAttr3[2].setIntVal(1);
PubPkt tempPubPkt3= new PubPkt(EVENT_TEMP, tempAttr3, 3);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Temp event
Attribute tempAttr4[] = new Attribute[3];
tempAttr4[0] = new Attribute();
tempAttr4[1] = new Attribute();
tempAttr4[2] = new Attribute();
// Value attribute
tempAttr4[0].setName("value");
tempAttr4[0].setValType(INT);
tempAttr4[0].setIntVal(88);
// Area attribute
tempAttr4[1].setName("area");
tempAttr4[1].setValType(STRING);
tempAttr4[1].setStringVal("office");
tempAttr4[2].setName("accuracy");
tempAttr4[2].setValType(INT);
tempAttr4[2].setIntVal(1);
PubPkt tempPubPkt4= new PubPkt(EVENT_TEMP, tempAttr4, 3);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Smoke event
// Area attribute
Attribute smokeAttr2[] = new Attribute[1];
smokeAttr2[0] = new Attribute();
smokeAttr2[0].setName("area");
smokeAttr2[0].setValType(STRING);
smokeAttr2[0].setStringVal("office");
PubPkt smokePubPkt2= new PubPkt(EVENT_SMOKE, smokeAttr2, 1);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Smoke event
// Area attribute
Attribute smokeAttr3[] = new Attribute[1];
smokeAttr2[0] = new Attribute();
smokeAttr2[0].setName("area");
smokeAttr2[0].setValType(STRING);
smokeAttr2[0].setStringVal("office");
PubPkt smokePubPkt3= new PubPkt(EVENT_SMOKE, smokeAttr2, 1);
ArrayList<PubPkt> pubPkts = new ArrayList<>();
ArrayList<byte[]> pubPktsm = new ArrayList<>();
//pubPktsm.add(Marshaller.marshal(smokePubPkt));
pubPktsm.add(Marshaller.marshal(tempPubPkt));
pubPktsm.add(Marshaller.marshal(tempPubPkt2));
pubPktsm.add(Marshaller.marshal(smokePubPkt));
pubPktsm.add(Marshaller.marshal(tempPubPkt3));
pubPktsm.add(Marshaller.marshal(smokePubPkt3));
pubPktsm.add(Marshaller.marshal(tempPubPkt4));
pubPktsm.add(Marshaller.marshal(smokePubPkt2));
pubPkts.add(smokePubPkt);
pubPkts.add(tempPubPkt);
pubPkts.add(tempPubPkt2);
pubPkts.add(smokePubPkt);
pubPkts.add(tempPubPkt3);
pubPkts.add(tempPubPkt4);
pubPkts.add(smokePubPkt2);
return pubPktsm;
}
}
| [
"[email protected]"
] | |
3c3916ef4c6805d791a485ccd198789e5647f63f | 0f330596b5c23d6f44722376064a0fa154142605 | /Java/CSS143/HW03_DataStructures/Queue.java | f5c4705c653d2632228289d65814a356a57a008a | [] | no_license | kslevin/UWB | b2988db351040e654714bc6dffd194f9bc5db934 | 6aaf5b32faa231733cd2fffd0c22049ea174bf84 | refs/heads/master | 2020-03-24T22:30:26.245691 | 2019-05-30T16:58:44 | 2019-05-30T16:58:44 | 143,088,830 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,268 | java | import java.util.Arrays;
/**
* Queue generates a list abstact objects that follows a
* "First in First out" ruling with its listed objects.
* As such its objects cannot be extracted from the
* "middle" of the queue, and must wait to be dequeued
* until those that were queued before it are dequeued
* first.
*
*
* @author (Krystle S Levin)
* @version (January 25th 2018)
*/
public class Queue
{
// instance variables
private Object[] dataQueue;
private int indexOfLastIn;
//Default constructor
public Queue(){
dataQueue=new Object[100];
indexOfLastIn=-1;
}
//Constructor with specified size:
public Queue(int specifiedSize){
dataQueue=new Object[specifiedSize];
indexOfLastIn=-1;
}
//Adds new object to the queue:
public void enqueue(Object a){
if(!full()){
indexOfLastIn++;
dataQueue[indexOfLastIn]=a;
}
}
//removes and returns the first element of the queue and shifts the remaining
public Object dequeue(){
Object toDequeue=0;
if(!empty()){
toDequeue=dataQueue[0];
for(int i=0; i<indexOfLastIn; i++){//shifts remaining queue elements
dataQueue[i]=dataQueue[i+1];
}
dataQueue[indexOfLastIn]=null;
indexOfLastIn --;
}
else queueException("Error, Queue is empty");
return toDequeue;
}
//returns the size of the queue:
public int size(){
return indexOfLastIn+1;
}
//show the contents of the data structure in a FIFO ordering
public String toString(){
String queueContents="";
if(!empty()){
for (int i=0; i<=indexOfLastIn; i++)//Adding contents of queue to the string
queueContents+=dataQueue[i];
}
else
queueException("Error, Queue is empty");
return queueContents;
}
//compares this queue to another queue and determines if they're equal
//Character and String objects will only return true if their cases are equal
public boolean equals(Queue other){
boolean same=true;
if (this.indexOfLastIn!=other.indexOfLastIn)//checks is number of elements are equal
same=false;
else if(this.indexOfLastIn==other.indexOfLastIn){
for(int i=0; i<=this.indexOfLastIn; i++){ //filters through each element to
if(this.dataQueue[i]!=other.dataQueue[i]) //determine total queue equality
same=false;
}
}
return same;
}
//determines if queue is empty
public boolean empty(){
if(indexOfLastIn==-1){
return true;
}
return false;
}
//resizes queue if neccessary
public boolean full(){
if(indexOfLastIn+1==dataQueue.length){
dataQueue=Arrays.copyOf(dataQueue, dataQueue.length+1);
}
return false;
}
//allows for error messages throughout class methods
public void queueException(String message){
System.out.println(message);
}
//returns the data queue (getter method);
public Object[] getDataQueue(){
return dataQueue;
}
}
| [
"[email protected]"
] | |
864b5f47a559bd111fafeeff3d7d6a031f74ef2a | 71e2fd514d8c5d6973577ab36958205b3859830e | /src/h10/H10_4.java | 9a530abce9cd39122fa0a01a35a7e13410559e20 | [] | no_license | Ranz-ran/inleiding-java | 61849dbc44c4436d63ba7c117a15e5332097a7db | 715d34074df99b8b0f87589e8e995c7af38352c2 | refs/heads/master | 2023-01-27T23:42:20.196214 | 2020-12-02T10:53:55 | 2020-12-02T10:53:55 | 285,982,975 | 0 | 0 | null | 2020-08-08T05:54:29 | 2020-08-08T05:54:29 | null | UTF-8 | Java | false | false | 1,560 | java | package h10;
//Breid de applet zo uit, dat ook het jaar ingegeven kan worden en aan de hand daarvan wordt
// bepaald of het om een schrikkeljaar gaat om het juiste aantal dagen voor februari te kunnen
// vaststellen.
//
//
import java.applet.Applet;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class H10_4 extends Applet {
//general
Color b;
int y1,jaartal;
TextField txv1;
String jaar;
@Override
public void init() {
//general
b = new Color (193, 210, 239);
setBackground(b);
y1 = 30;
jaar = ("");
//TextField
txv1 = new TextField();
add(txv1);
txv1.addActionListener(new Al());
}
@Override
public void paint(Graphics g) {
txv1.setSize (50,25);
txv1.setLocation (200,y1);
g.drawString("Voer hier een jaartal in:",55,y1+16);
g.drawString(jaar,55,y1+50);
}
private class Al implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
jaar = txv1.getText();
jaartal = Integer.parseInt(jaar);
if ( (jaartal % 4 == 0 && !(jaartal % 100 == 0)) ||
jaartal % 400 == 0 ) {
jaar = ""+ jaartal + " is schrikkeljaar, februarie heeft dus 29 dagen.";
}
else {
jaar = ""+ jaartal + " is geen schrikkeljaar, februarie heeft alleen 28 dagen.";
}
repaint();
}
}
}
| [
"[email protected]"
] | |
203388e06a49ba4066453a74afef1aff20c0d96d | 84ad53d3f4e5cc305ccc82c711e756f1f946188b | /app/src/main/java/com/example/dabuff/speechevaluation/speech/setting/IseSettings.java | 75f7eefc087f92af6e81a9eed2eff6b739157fc8 | [] | no_license | nbdwddbf/SpeechEvaluation | 85d2b55e1a4158140cd543f02b529d610a4b25d0 | 529f73abdc9374cf9f3137d947afeb7bf3bc835d | refs/heads/master | 2020-03-28T15:44:00.636048 | 2018-09-13T10:25:20 | 2018-09-13T10:25:20 | 148,620,792 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,689 | java | package com.example.dabuff.speechevaluation.speech.setting;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.Preference.OnPreferenceChangeListener;
import android.text.InputType;
import android.text.TextUtils;
import android.view.Window;
import android.widget.Toast;
import com.iflytek.cloud.SpeechConstant;
import com.example.dabuff.speechevaluation.voicedemo.R;
/**
* 评测设置界面
*/
public class IseSettings extends PreferenceActivity {
private final static String PREFER_NAME = "ise_settings";
private ListPreference mLanguagePref;
private ListPreference mCategoryPref;
private ListPreference mResultLevelPref;
private EditTextPreference mVadBosPref;
private EditTextPreference mVadEosPref;
private EditTextPreference mSpeechTimeoutPref;
private Toast mToast;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
getPreferenceManager().setSharedPreferencesName(PREFER_NAME);
addPreferencesFromResource(R.xml.ise_settings);
initUI();
}
private void initUI() {
mLanguagePref = (ListPreference) findPreference(SpeechConstant.LANGUAGE);
mCategoryPref = (ListPreference) findPreference(SpeechConstant.ISE_CATEGORY);
mResultLevelPref = (ListPreference) findPreference(SpeechConstant.RESULT_LEVEL);
mVadBosPref = (EditTextPreference) findPreference(SpeechConstant.VAD_BOS);
mVadEosPref = (EditTextPreference) findPreference(SpeechConstant.VAD_EOS);
mSpeechTimeoutPref = (EditTextPreference) findPreference(SpeechConstant.KEY_SPEECH_TIMEOUT);
mToast = Toast.makeText(IseSettings.this, "", Toast.LENGTH_LONG);
mLanguagePref.setSummary("当前:" + mLanguagePref.getEntry());
mCategoryPref.setSummary("当前:" + mCategoryPref.getEntry());
mResultLevelPref.setSummary("当前:" + mResultLevelPref.getEntry());
mVadBosPref.setSummary("当前:" + mVadBosPref.getText() + "ms");
mVadEosPref.setSummary("当前:" + mVadEosPref.getText() + "ms");
String speech_timeout = mSpeechTimeoutPref.getText();
String summary = "当前:" + speech_timeout;
if (!"-1".equals(speech_timeout)) {
summary += "ms";
}
mSpeechTimeoutPref.setSummary(summary);
mLanguagePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if ("zh_cn".equals(newValue.toString())) {
if ("plain".equals(mResultLevelPref.getValue())) {
showTip("汉语评测结果格式不支持plain设置");
return false;
}
} else {
if ("read_syllable".equals(mCategoryPref.getValue())) {
showTip("英语评测不支持单字");
return false;
}
}
int newValueIndex = mLanguagePref.findIndexOfValue(newValue.toString());
String newEntry = (String) mLanguagePref.getEntries()[newValueIndex];
mLanguagePref.setSummary("当前:" + newEntry);
return true;
}
});
mCategoryPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if ("en_us".equals(mLanguagePref.getValue()) && "read_syllable".equals(newValue.toString())) {
showTip("英语评测不支持单字,请选其他项");
return false;
}
int newValueIndex = mCategoryPref.findIndexOfValue(newValue.toString());
String newEntry = (String) mCategoryPref.getEntries()[newValueIndex];
mCategoryPref.setSummary("当前:" + newEntry);
return true;
}
});
mResultLevelPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if ("zh_cn".equals(mLanguagePref.getValue()) && "plain".equals(newValue.toString())) {
showTip("汉语评测不支持plain,请选其他项");
return false;
}
mResultLevelPref.setSummary("当前:" + newValue.toString());
return true;
}
});
mVadBosPref.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
mVadBosPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int bos;
try {
bos = Integer.parseInt(newValue.toString());
} catch (Exception e) {
showTip("无效输入!");
return false;
}
if (bos < 0 || bos > 30000) {
showTip("取值范围为0~30000");
return false;
}
mVadBosPref.setSummary("当前:" + bos + "ms");
return true;
}
});
mVadEosPref.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
mVadEosPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int eos;
try {
eos = Integer.parseInt(newValue.toString());
} catch (Exception e) {
showTip("无效输入!");
return false;
}
if (eos < 0 || eos > 30000) {
showTip("取值范围为0~30000");
return false;
}
mVadEosPref.setSummary("当前:" + eos + "ms");
return true;
}
});
mSpeechTimeoutPref.getEditText().setInputType(InputType.TYPE_NUMBER_FLAG_SIGNED|InputType.TYPE_CLASS_NUMBER);
mSpeechTimeoutPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
int speech_timeout;
try {
speech_timeout = Integer.parseInt(newValue.toString());
} catch (Exception e) {
showTip("无效输入!");
return false;
}
if (speech_timeout < -1) {
showTip("必须大于等于-1");
return false;
}
if (speech_timeout == -1) {
mSpeechTimeoutPref.setSummary("当前:-1");
} else {
mSpeechTimeoutPref.setSummary("当前:" + speech_timeout + "ms");
}
return true;
}
});
}
private void showTip(String str) {
if(!TextUtils.isEmpty(str)) {
mToast.setText(str);
mToast.show();
}
}
}
| [
"[email protected]"
] | |
8af064c4bc70476f84693dc513078ef4181633c1 | 8b0ae134884d6f84217587194a2a0f775866ef55 | /Vivo_y93/src/main/java/android/text/TextUtils.java | 0afcdd1a52014b8da6db7e20479e91e24c673a6c | [] | no_license | wanbing/VivoFramework | 69032750f376178d27d0d1ac170cf89bba907cc7 | 8d31381ecc788afb023960535bafbfa3b7df7d9b | refs/heads/master | 2023-05-11T16:57:04.582985 | 2019-02-27T04:43:44 | 2019-02-27T04:43:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 49,000 | java | package android.text;
import android.content.Context;
import android.content.res.Resources;
import android.icu.lang.UCharacter;
import android.icu.text.CaseMap;
import android.icu.text.Edits;
import android.icu.util.ULocale;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import android.os.SystemProperties;
import android.provider.Settings.Global;
import android.text.format.DateFormat;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.AccessibilityClickableSpan;
import android.text.style.AccessibilityURLSpan;
import android.text.style.AlignmentSpan.Standard;
import android.text.style.BackgroundColorSpan;
import android.text.style.BulletSpan;
import android.text.style.CharacterStyle;
import android.text.style.EasyEditSpan;
import android.text.style.ForegroundColorSpan;
import android.text.style.LeadingMarginSpan;
import android.text.style.LocaleSpan;
import android.text.style.MetricAffectingSpan;
import android.text.style.ParagraphStyle;
import android.text.style.QuoteSpan;
import android.text.style.RelativeSizeSpan;
import android.text.style.ReplacementSpan;
import android.text.style.ScaleXSpan;
import android.text.style.SpellCheckSpan;
import android.text.style.StrikethroughSpan;
import android.text.style.StyleSpan;
import android.text.style.SubscriptSpan;
import android.text.style.SuggestionRangeSpan;
import android.text.style.SuggestionSpan;
import android.text.style.SuperscriptSpan;
import android.text.style.TextAppearanceSpan;
import android.text.style.TtsSpan;
import android.text.style.TypefaceSpan;
import android.text.style.URLSpan;
import android.text.style.UnderlineSpan;
import android.text.style.UpdateAppearance;
import android.util.Log;
import android.util.Printer;
import com.android.internal.R;
import com.android.internal.content.NativeLibraryHelper;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.Preconditions;
import java.lang.reflect.Array;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.regex.Pattern;
public class TextUtils {
public static final int ABSOLUTE_SIZE_SPAN = 16;
public static final int ACCESSIBILITY_CLICKABLE_SPAN = 25;
public static final int ACCESSIBILITY_URL_SPAN = 26;
public static final int ALIGNMENT_SPAN = 1;
public static final int ANNOTATION = 18;
public static final int BACKGROUND_COLOR_SPAN = 12;
public static final int BULLET_SPAN = 8;
public static final int CAP_MODE_CHARACTERS = 4096;
public static final int CAP_MODE_SENTENCES = 16384;
public static final int CAP_MODE_WORDS = 8192;
public static final Creator<CharSequence> CHAR_SEQUENCE_CREATOR = new Creator<CharSequence>() {
public CharSequence createFromParcel(Parcel p) {
int kind = p.readInt();
String string = p.readString();
if (string == null) {
return null;
}
if (kind == 1) {
return string;
}
SpannableString sp = new SpannableString(string);
while (true) {
kind = p.readInt();
if (kind == 0) {
return sp;
}
switch (kind) {
case 1:
TextUtils.readSpan(p, sp, new Standard(p));
break;
case 2:
TextUtils.readSpan(p, sp, new ForegroundColorSpan(p));
break;
case 3:
TextUtils.readSpan(p, sp, new RelativeSizeSpan(p));
break;
case 4:
TextUtils.readSpan(p, sp, new ScaleXSpan(p));
break;
case 5:
TextUtils.readSpan(p, sp, new StrikethroughSpan(p));
break;
case 6:
TextUtils.readSpan(p, sp, new UnderlineSpan(p));
break;
case 7:
TextUtils.readSpan(p, sp, new StyleSpan(p));
break;
case 8:
TextUtils.readSpan(p, sp, new BulletSpan(p));
break;
case 9:
TextUtils.readSpan(p, sp, new QuoteSpan(p));
break;
case 10:
TextUtils.readSpan(p, sp, new LeadingMarginSpan.Standard(p));
break;
case 11:
TextUtils.readSpan(p, sp, new URLSpan(p));
break;
case 12:
TextUtils.readSpan(p, sp, new BackgroundColorSpan(p));
break;
case 13:
TextUtils.readSpan(p, sp, new TypefaceSpan(p));
break;
case 14:
TextUtils.readSpan(p, sp, new SuperscriptSpan(p));
break;
case 15:
TextUtils.readSpan(p, sp, new SubscriptSpan(p));
break;
case 16:
TextUtils.readSpan(p, sp, new AbsoluteSizeSpan(p));
break;
case 17:
TextUtils.readSpan(p, sp, new TextAppearanceSpan(p));
break;
case 18:
TextUtils.readSpan(p, sp, new Annotation(p));
break;
case 19:
TextUtils.readSpan(p, sp, new SuggestionSpan(p));
break;
case 20:
TextUtils.readSpan(p, sp, new SpellCheckSpan(p));
break;
case 21:
TextUtils.readSpan(p, sp, new SuggestionRangeSpan(p));
break;
case 22:
TextUtils.readSpan(p, sp, new EasyEditSpan(p));
break;
case 23:
TextUtils.readSpan(p, sp, new LocaleSpan(p));
break;
case 24:
TextUtils.readSpan(p, sp, new TtsSpan(p));
break;
case 25:
TextUtils.readSpan(p, sp, new AccessibilityClickableSpan(p));
break;
case 26:
TextUtils.readSpan(p, sp, new AccessibilityURLSpan(p));
break;
default:
throw new RuntimeException("bogus span encoding " + kind);
}
}
}
public CharSequence[] newArray(int size) {
return new CharSequence[size];
}
};
public static final int EASY_EDIT_SPAN = 22;
static final char[] ELLIPSIS_NORMAL = new char[]{8230};
public static final String ELLIPSIS_STRING = new String(ELLIPSIS_NORMAL);
static final char[] ELLIPSIS_TWO_DOTS = new char[]{8229};
private static final String ELLIPSIS_TWO_DOTS_STRING = new String(ELLIPSIS_TWO_DOTS);
private static String[] EMPTY_STRING_ARRAY = new String[0];
public static final int FIRST_SPAN = 1;
public static final int FOREGROUND_COLOR_SPAN = 2;
public static final int LAST_SPAN = 26;
public static final int LEADING_MARGIN_SPAN = 10;
public static final int LOCALE_SPAN = 23;
public static final int QUOTE_SPAN = 9;
public static final int RELATIVE_SIZE_SPAN = 3;
public static final int SCALE_X_SPAN = 4;
public static final int SPELL_CHECK_SPAN = 20;
public static final int STRIKETHROUGH_SPAN = 5;
public static final int STYLE_SPAN = 7;
public static final int SUBSCRIPT_SPAN = 15;
public static final int SUGGESTION_RANGE_SPAN = 21;
public static final int SUGGESTION_SPAN = 19;
public static final int SUPERSCRIPT_SPAN = 14;
private static final String TAG = "TextUtils";
public static final int TEXT_APPEARANCE_SPAN = 17;
public static final int TTS_SPAN = 24;
public static final int TYPEFACE_SPAN = 13;
public static final int UNDERLINE_SPAN = 6;
public static final int URL_SPAN = 11;
private static final char ZWNBS_CHAR = '';
private static Object sLock = new Object();
private static char[] sTemp = null;
public interface EllipsizeCallback {
void ellipsized(int i, int i2);
}
private static class Reverser implements CharSequence, GetChars {
private int mEnd;
private CharSequence mSource;
private int mStart;
public Reverser(CharSequence source, int start, int end) {
this.mSource = source;
this.mStart = start;
this.mEnd = end;
}
public int length() {
return this.mEnd - this.mStart;
}
public CharSequence subSequence(int start, int end) {
char[] buf = new char[(end - start)];
getChars(start, end, buf, 0);
return new String(buf);
}
public String toString() {
return subSequence(0, length()).toString();
}
public char charAt(int off) {
return (char) UCharacter.getMirror(this.mSource.charAt((this.mEnd - 1) - off));
}
public void getChars(int start, int end, char[] dest, int destoff) {
TextUtils.getChars(this.mSource, this.mStart + start, this.mStart + end, dest, destoff);
AndroidCharacter.mirror(dest, 0, end - start);
int len = end - start;
int n = (end - start) / 2;
for (int i = 0; i < n; i++) {
char tmp = dest[destoff + i];
dest[destoff + i] = dest[((destoff + len) - i) - 1];
dest[((destoff + len) - i) - 1] = tmp;
}
}
}
public interface StringSplitter extends Iterable<String> {
void setString(String str);
}
public static class SimpleStringSplitter implements StringSplitter, Iterator<String> {
private char mDelimiter;
private int mLength;
private int mPosition;
private String mString;
public SimpleStringSplitter(char delimiter) {
this.mDelimiter = delimiter;
}
public void setString(String string) {
this.mString = string;
this.mPosition = 0;
this.mLength = this.mString.length();
}
public Iterator<String> iterator() {
return this;
}
public boolean hasNext() {
return this.mPosition < this.mLength;
}
public String next() {
int end = this.mString.indexOf(this.mDelimiter, this.mPosition);
if (end == -1) {
end = this.mLength;
}
String nextString = this.mString.substring(this.mPosition, end);
this.mPosition = end + 1;
return nextString;
}
public void remove() {
throw new UnsupportedOperationException();
}
}
public enum TruncateAt {
START,
MIDDLE,
END,
MARQUEE,
END_SMALL
}
private TextUtils() {
}
public static void getChars(CharSequence s, int start, int end, char[] dest, int destoff) {
Class<? extends CharSequence> c = s.getClass();
if (c == String.class) {
((String) s).getChars(start, end, dest, destoff);
} else if (c == StringBuffer.class) {
((StringBuffer) s).getChars(start, end, dest, destoff);
} else if (c == StringBuilder.class) {
((StringBuilder) s).getChars(start, end, dest, destoff);
} else if (s instanceof GetChars) {
((GetChars) s).getChars(start, end, dest, destoff);
} else {
int i = start;
int destoff2 = destoff;
while (i < end) {
destoff = destoff2 + 1;
dest[destoff2] = s.charAt(i);
i++;
destoff2 = destoff;
}
destoff = destoff2;
}
}
public static int indexOf(CharSequence s, char ch) {
return indexOf(s, ch, 0);
}
public static int indexOf(CharSequence s, char ch, int start) {
if (s.getClass() == String.class) {
return ((String) s).indexOf(ch, start);
}
return indexOf(s, ch, start, s.length());
}
public static int indexOf(CharSequence s, char ch, int start, int end) {
Class<? extends CharSequence> c = s.getClass();
int i;
if ((s instanceof GetChars) || c == StringBuffer.class || c == StringBuilder.class || c == String.class) {
char[] temp = obtain(500);
while (start < end) {
int segend = start + 500;
if (segend > end) {
segend = end;
}
getChars(s, start, segend, temp, 0);
int count = segend - start;
for (i = 0; i < count; i++) {
if (temp[i] == ch) {
recycle(temp);
return i + start;
}
}
start = segend;
}
recycle(temp);
return -1;
}
for (i = start; i < end; i++) {
if (s.charAt(i) == ch) {
return i;
}
}
return -1;
}
public static int lastIndexOf(CharSequence s, char ch) {
return lastIndexOf(s, ch, s.length() - 1);
}
public static int lastIndexOf(CharSequence s, char ch, int last) {
if (s.getClass() == String.class) {
return ((String) s).lastIndexOf(ch, last);
}
return lastIndexOf(s, ch, 0, last);
}
public static int lastIndexOf(CharSequence s, char ch, int start, int last) {
if (last < 0) {
return -1;
}
if (last >= s.length()) {
last = s.length() - 1;
}
int end = last + 1;
Class<? extends CharSequence> c = s.getClass();
int i;
if ((s instanceof GetChars) || c == StringBuffer.class || c == StringBuilder.class || c == String.class) {
char[] temp = obtain(500);
while (start < end) {
int segstart = end - 500;
if (segstart < start) {
segstart = start;
}
getChars(s, segstart, end, temp, 0);
for (i = (end - segstart) - 1; i >= 0; i--) {
if (temp[i] == ch) {
recycle(temp);
return i + segstart;
}
}
end = segstart;
}
recycle(temp);
return -1;
}
for (i = end - 1; i >= start; i--) {
if (s.charAt(i) == ch) {
return i;
}
}
return -1;
}
public static int indexOf(CharSequence s, CharSequence needle) {
return indexOf(s, needle, 0, s.length());
}
public static int indexOf(CharSequence s, CharSequence needle, int start) {
return indexOf(s, needle, start, s.length());
}
public static int indexOf(CharSequence s, CharSequence needle, int start, int end) {
int nlen = needle.length();
if (nlen == 0) {
return start;
}
char c = needle.charAt(0);
while (true) {
start = indexOf(s, c, start);
if (start > end - nlen || start < 0) {
return -1;
}
if (regionMatches(s, start, needle, 0, nlen)) {
return start;
}
start++;
}
}
public static boolean regionMatches(CharSequence one, int toffset, CharSequence two, int ooffset, int len) {
int tempLen = len * 2;
if (tempLen < len) {
throw new IndexOutOfBoundsException();
}
char[] temp = obtain(tempLen);
getChars(one, toffset, toffset + len, temp, 0);
getChars(two, ooffset, ooffset + len, temp, len);
boolean match = true;
for (int i = 0; i < len; i++) {
if (temp[i] != temp[i + len]) {
match = false;
break;
}
}
recycle(temp);
return match;
}
public static String substring(CharSequence source, int start, int end) {
if (source instanceof String) {
return ((String) source).substring(start, end);
}
if (source instanceof StringBuilder) {
return ((StringBuilder) source).substring(start, end);
}
if (source instanceof StringBuffer) {
return ((StringBuffer) source).substring(start, end);
}
char[] temp = obtain(end - start);
getChars(source, start, end, temp, 0);
String ret = new String(temp, 0, end - start);
recycle(temp);
return ret;
}
public static String join(CharSequence delimiter, Object[] tokens) {
StringBuilder sb = new StringBuilder();
boolean firstTime = true;
for (Object token : tokens) {
if (firstTime) {
firstTime = false;
} else {
sb.append(delimiter);
}
sb.append(token);
}
return sb.toString();
}
public static String join(CharSequence delimiter, Iterable tokens) {
StringBuilder sb = new StringBuilder();
Iterator<?> it = tokens.iterator();
if (it.hasNext()) {
sb.append(it.next());
while (it.hasNext()) {
sb.append(delimiter);
sb.append(it.next());
}
}
return sb.toString();
}
public static String[] split(String text, String expression) {
if (text.length() == 0) {
return EMPTY_STRING_ARRAY;
}
return text.split(expression, -1);
}
public static String[] split(String text, Pattern pattern) {
if (text.length() == 0) {
return EMPTY_STRING_ARRAY;
}
return pattern.split(text, -1);
}
public static CharSequence stringOrSpannedString(CharSequence source) {
if (source == null) {
return null;
}
if (source instanceof SpannedString) {
return source;
}
if (source instanceof Spanned) {
return new SpannedString(source);
}
return source.toString();
}
public static boolean isEmpty(CharSequence str) {
return str == null || str.length() == 0;
}
public static String nullIfEmpty(String str) {
return isEmpty(str) ? null : str;
}
public static String emptyIfNull(String str) {
return str == null ? "" : str;
}
public static String firstNotEmpty(String a, String b) {
return !isEmpty(a) ? a : (String) Preconditions.checkStringNotEmpty(b);
}
public static int length(String s) {
return isEmpty(s) ? 0 : s.length();
}
public static String safeIntern(String s) {
return s != null ? s.intern() : null;
}
public static int getTrimmedLength(CharSequence s) {
int len = s.length();
int start = 0;
while (start < len && s.charAt(start) <= ' ') {
start++;
}
int end = len;
while (end > start && s.charAt(end - 1) <= ' ') {
end--;
}
return end - start;
}
public static boolean equals(CharSequence a, CharSequence b) {
if (a == b) {
return true;
}
if (!(a == null || b == null)) {
int length = a.length();
if (length == b.length()) {
if ((a instanceof String) && (b instanceof String)) {
return a.equals(b);
}
for (int i = 0; i < length; i++) {
if (a.charAt(i) != b.charAt(i)) {
return false;
}
}
return true;
}
}
return false;
}
@Deprecated
public static CharSequence getReverse(CharSequence source, int start, int end) {
return new Reverser(source, start, end);
}
public static void writeToParcel(CharSequence cs, Parcel p, int parcelableFlags) {
if (cs instanceof Spanned) {
p.writeInt(0);
p.writeString(cs.toString());
Spanned sp = (Spanned) cs;
Object[] os = sp.getSpans(0, cs.length(), Object.class);
for (int i = 0; i < os.length; i++) {
Object o = os[i];
ParcelableSpan prop = os[i];
if (prop instanceof CharacterStyle) {
prop = ((CharacterStyle) prop).getUnderlying();
}
if (prop instanceof ParcelableSpan) {
ParcelableSpan ps = prop;
int spanTypeId = ps.getSpanTypeIdInternal();
if (spanTypeId < 1 || spanTypeId > 26) {
Log.e(TAG, "External class \"" + ps.getClass().getSimpleName() + "\" is attempting to use the frameworks-only ParcelableSpan" + " interface");
} else {
p.writeInt(spanTypeId);
ps.writeToParcelInternal(p, parcelableFlags);
writeWhere(p, sp, o);
}
}
}
p.writeInt(0);
return;
}
p.writeInt(1);
if (cs != null) {
p.writeString(cs.toString());
} else {
p.writeString(null);
}
}
private static void writeWhere(Parcel p, Spanned sp, Object o) {
p.writeInt(sp.getSpanStart(o));
p.writeInt(sp.getSpanEnd(o));
p.writeInt(sp.getSpanFlags(o));
}
public static void dumpSpans(CharSequence cs, Printer printer, String prefix) {
if (cs instanceof Spanned) {
Spanned sp = (Spanned) cs;
Object[] os = sp.getSpans(0, cs.length(), Object.class);
for (Object o : os) {
printer.println(prefix + cs.subSequence(sp.getSpanStart(o), sp.getSpanEnd(o)) + ": " + Integer.toHexString(System.identityHashCode(o)) + " " + o.getClass().getCanonicalName() + " (" + sp.getSpanStart(o) + NativeLibraryHelper.CLEAR_ABI_OVERRIDE + sp.getSpanEnd(o) + ") fl=#" + sp.getSpanFlags(o));
}
return;
}
printer.println(prefix + cs + ": (no spans)");
}
public static CharSequence replace(CharSequence template, String[] sources, CharSequence[] destinations) {
int i;
CharSequence tb = new SpannableStringBuilder(template);
for (i = 0; i < sources.length; i++) {
int where = indexOf(tb, sources[i]);
if (where >= 0) {
tb.setSpan(sources[i], where, sources[i].length() + where, 33);
}
}
for (i = 0; i < sources.length; i++) {
int start = tb.getSpanStart(sources[i]);
int end = tb.getSpanEnd(sources[i]);
if (start >= 0) {
tb.replace(start, end, destinations[i]);
}
}
return tb;
}
public static CharSequence expandTemplate(CharSequence template, CharSequence... values) {
if (values.length > 9) {
throw new IllegalArgumentException("max of 9 values are supported");
}
SpannableStringBuilder ssb = new SpannableStringBuilder(template);
int i = 0;
while (i < ssb.length()) {
try {
if (ssb.charAt(i) == '^') {
char next = ssb.charAt(i + 1);
if (next == '^') {
ssb.delete(i + 1, i + 2);
i++;
} else if (Character.isDigit(next)) {
int which = Character.getNumericValue(next) - 1;
if (which < 0) {
throw new IllegalArgumentException("template requests value ^" + (which + 1));
} else if (which >= values.length) {
throw new IllegalArgumentException("template requests value ^" + (which + 1) + "; only " + values.length + " provided");
} else {
ssb.replace(i, i + 2, values[which]);
i += values[which].length();
}
}
}
i++;
} catch (IndexOutOfBoundsException e) {
}
}
return ssb;
}
public static int getOffsetBefore(CharSequence text, int offset) {
if (offset == 0 || offset == 1) {
return 0;
}
char c = text.charAt(offset - 1);
if (c < 56320 || c > 57343) {
offset--;
} else {
char c1 = text.charAt(offset - 2);
if (c1 < 55296 || c1 > 56319) {
offset--;
} else {
offset -= 2;
}
}
if (text instanceof Spanned) {
ReplacementSpan[] spans = (ReplacementSpan[]) ((Spanned) text).getSpans(offset, offset, ReplacementSpan.class);
for (int i = 0; i < spans.length; i++) {
int start = ((Spanned) text).getSpanStart(spans[i]);
int end = ((Spanned) text).getSpanEnd(spans[i]);
if (start < offset && end > offset) {
offset = start;
}
}
}
return offset;
}
public static int getOffsetAfter(CharSequence text, int offset) {
int len = text.length();
if (offset == len || offset == len - 1) {
return len;
}
char c = text.charAt(offset);
if (c < 55296 || c > 56319) {
offset++;
} else {
char c1 = text.charAt(offset + 1);
if (c1 < 56320 || c1 > 57343) {
offset++;
} else {
offset += 2;
}
}
if (text instanceof Spanned) {
ReplacementSpan[] spans = (ReplacementSpan[]) ((Spanned) text).getSpans(offset, offset, ReplacementSpan.class);
for (int i = 0; i < spans.length; i++) {
int start = ((Spanned) text).getSpanStart(spans[i]);
int end = ((Spanned) text).getSpanEnd(spans[i]);
if (start < offset && end > offset) {
offset = end;
}
}
}
return offset;
}
private static void readSpan(Parcel p, Spannable sp, Object o) {
sp.setSpan(o, p.readInt(), p.readInt(), p.readInt());
}
public static void copySpansFrom(Spanned source, int start, int end, Class kind, Spannable dest, int destoff) {
if (kind == null) {
kind = Object.class;
}
Object[] spans = source.getSpans(start, end, kind);
for (int i = 0; i < spans.length; i++) {
int st = source.getSpanStart(spans[i]);
int en = source.getSpanEnd(spans[i]);
int fl = source.getSpanFlags(spans[i]);
if (st < start) {
st = start;
}
if (en > end) {
en = end;
}
dest.setSpan(spans[i], (st - start) + destoff, (en - start) + destoff, fl);
}
}
public static CharSequence toUpperCase(Locale locale, CharSequence source, boolean copySpans) {
Edits edits = new Edits();
if (copySpans) {
SpannableStringBuilder result = (SpannableStringBuilder) CaseMap.toUpper().apply(locale, source, new SpannableStringBuilder(), edits);
if (!edits.hasChanges()) {
return source;
}
Edits.Iterator iterator = edits.getFineIterator();
int sourceLength = source.length();
Spanned spanned = (Spanned) source;
for (Object span : spanned.getSpans(0, sourceLength, Object.class)) {
int destStart;
int destEnd;
int sourceStart = spanned.getSpanStart(span);
int sourceEnd = spanned.getSpanEnd(span);
int flags = spanned.getSpanFlags(span);
if (sourceStart == sourceLength) {
destStart = result.length();
} else {
destStart = toUpperMapToDest(iterator, sourceStart);
}
if (sourceEnd == sourceLength) {
destEnd = result.length();
} else {
destEnd = toUpperMapToDest(iterator, sourceEnd);
}
result.setSpan(span, destStart, destEnd, flags);
}
return result;
}
StringBuilder result2 = (StringBuilder) CaseMap.toUpper().apply(locale, source, new StringBuilder(), edits);
if (!edits.hasChanges()) {
CharSequence result22 = source;
}
return result22;
}
private static int toUpperMapToDest(Edits.Iterator iterator, int sourceIndex) {
iterator.findSourceIndex(sourceIndex);
if (sourceIndex == iterator.sourceIndex()) {
return iterator.destinationIndex();
}
if (iterator.hasChange()) {
return iterator.destinationIndex() + iterator.newLength();
}
return iterator.destinationIndex() + (sourceIndex - iterator.sourceIndex());
}
public static CharSequence ellipsize(CharSequence text, TextPaint p, float avail, TruncateAt where) {
return ellipsize(text, p, avail, where, false, null);
}
public static CharSequence ellipsize(CharSequence text, TextPaint paint, float avail, TruncateAt where, boolean preserveLength, EllipsizeCallback callback) {
return ellipsize(text, paint, avail, where, preserveLength, callback, TextDirectionHeuristics.FIRSTSTRONG_LTR, where == TruncateAt.END_SMALL ? ELLIPSIS_TWO_DOTS_STRING : ELLIPSIS_STRING);
}
public static CharSequence ellipsize(CharSequence text, TextPaint paint, float avail, TruncateAt where, boolean preserveLength, EllipsizeCallback callback, TextDirectionHeuristic textDir, String ellipsis) {
int len = text.length();
MeasuredText mt = MeasuredText.obtain();
try {
if (setPara(mt, paint, text, 0, text.length(), textDir) <= avail) {
if (callback != null) {
callback.ellipsized(0, 0);
}
MeasuredText.recycle(mt);
return text;
}
avail -= paint.measureText(ellipsis);
int left = 0;
int right = len;
if (avail >= 0.0f) {
if (where == TruncateAt.START) {
right = len - mt.breakText(len, false, avail);
} else if (where == TruncateAt.END || where == TruncateAt.END_SMALL) {
left = mt.breakText(len, true, avail);
} else {
right = len - mt.breakText(len, false, avail / 2.0f);
left = mt.breakText(right, true, avail - mt.measure(right, len));
}
}
if (callback != null) {
callback.ellipsized(left, right);
}
char[] buf = mt.mChars;
Spanned sp = text instanceof Spanned ? (Spanned) text : null;
int remaining = len - (right - left);
CharSequence charSequence;
if (preserveLength) {
if (remaining > 0) {
int left2;
int ellIndex = 0;
while (true) {
left2 = left;
if (ellIndex >= ellipsis.length() || left2 >= right) {
left = left2;
} else {
left = left2 + 1;
buf[left2] = ellipsis.charAt(ellIndex);
ellIndex++;
}
}
left = left2;
}
for (int i = left; i < right; i++) {
buf[i] = ZWNBS_CHAR;
}
String str = new String(buf, 0, len);
if (sp == null) {
MeasuredText.recycle(mt);
return str;
}
SpannableString ss = new SpannableString(str);
copySpansFrom(sp, 0, len, Object.class, ss, 0);
MeasuredText.recycle(mt);
return ss;
} else if (remaining == 0) {
charSequence = "";
MeasuredText.recycle(mt);
return charSequence;
} else if (sp == null) {
StringBuilder stringBuilder = new StringBuilder(ellipsis.length() + remaining);
stringBuilder.append(buf, 0, left);
stringBuilder.append(ellipsis);
stringBuilder.append(buf, right, len - right);
charSequence = stringBuilder.toString();
MeasuredText.recycle(mt);
return charSequence;
} else {
SpannableStringBuilder ssb = new SpannableStringBuilder();
ssb.append(text, 0, left);
ssb.append((CharSequence) ellipsis);
ssb.append(text, right, len);
MeasuredText.recycle(mt);
return ssb;
}
} catch (Throwable th) {
MeasuredText.recycle(mt);
}
}
public static CharSequence listEllipsize(Context context, List<CharSequence> elements, String separator, TextPaint paint, float avail, int moreId) {
if (elements == null) {
return "";
}
int totalLen = elements.size();
if (totalLen == 0) {
return "";
}
Resources res;
BidiFormatter bidiFormatter;
int i;
if (context == null) {
res = null;
bidiFormatter = BidiFormatter.getInstance();
} else {
res = context.getResources();
bidiFormatter = BidiFormatter.getInstance(res.getConfiguration().getLocales().get(0));
}
SpannableStringBuilder output = new SpannableStringBuilder();
int[] endIndexes = new int[totalLen];
for (i = 0; i < totalLen; i++) {
output.append(bidiFormatter.unicodeWrap((CharSequence) elements.get(i)));
if (i != totalLen - 1) {
output.append((CharSequence) separator);
}
endIndexes[i] = output.length();
}
for (i = totalLen - 1; i >= 0; i--) {
output.delete(endIndexes[i], output.length());
int remainingElements = (totalLen - i) - 1;
if (remainingElements > 0) {
CharSequence morePiece;
if (res == null) {
morePiece = ELLIPSIS_STRING;
} else {
morePiece = res.getQuantityString(moreId, remainingElements, new Object[]{Integer.valueOf(remainingElements)});
}
output.append(bidiFormatter.unicodeWrap(morePiece));
}
if (paint.measureText(output, 0, output.length()) <= avail) {
return output;
}
}
return "";
}
@Deprecated
public static CharSequence commaEllipsize(CharSequence text, TextPaint p, float avail, String oneMore, String more) {
return commaEllipsize(text, p, avail, oneMore, more, TextDirectionHeuristics.FIRSTSTRONG_LTR);
}
@Deprecated
public static CharSequence commaEllipsize(CharSequence text, TextPaint p, float avail, String oneMore, String more, TextDirectionHeuristic textDir) {
MeasuredText mt = MeasuredText.obtain();
try {
int len = text.length();
if (setPara(mt, p, text, 0, len, textDir) <= avail) {
return text;
}
int i;
char[] buf = mt.mChars;
int commaCount = 0;
for (i = 0; i < len; i++) {
if (buf[i] == ',') {
commaCount++;
}
}
int remaining = commaCount + 1;
int ok = 0;
String okFormat = "";
int w = 0;
int count = 0;
float[] widths = mt.mWidths;
MeasuredText tempMt = MeasuredText.obtain();
for (i = 0; i < len; i++) {
w = (int) (((float) w) + widths[i]);
if (buf[i] == ',') {
String format;
count++;
remaining--;
if (remaining == 1) {
format = " " + oneMore;
} else {
format = " " + String.format(more, new Object[]{Integer.valueOf(remaining)});
}
tempMt.setPara(format, 0, format.length(), textDir, null);
if (((float) w) + tempMt.addStyleRun(p, tempMt.mLen, null) <= avail) {
ok = i + 1;
okFormat = format;
}
}
}
MeasuredText.recycle(tempMt);
SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(okFormat);
spannableStringBuilder.insert(0, text, 0, ok);
MeasuredText.recycle(mt);
return spannableStringBuilder;
} finally {
MeasuredText.recycle(mt);
}
}
private static float setPara(MeasuredText mt, TextPaint paint, CharSequence text, int start, int end, TextDirectionHeuristic textDir) {
mt.setPara(text, start, end, textDir, null);
Spanned sp = text instanceof Spanned ? (Spanned) text : null;
int len = end - start;
if (sp == null) {
return mt.addStyleRun(paint, len, null);
}
float width = 0.0f;
int spanStart = 0;
while (spanStart < len) {
int spanEnd = sp.nextSpanTransition(spanStart, len, MetricAffectingSpan.class);
width += mt.addStyleRun(paint, (MetricAffectingSpan[]) removeEmptySpans((MetricAffectingSpan[]) sp.getSpans(spanStart, spanEnd, MetricAffectingSpan.class), sp, MetricAffectingSpan.class), spanEnd - spanStart, null);
spanStart = spanEnd;
}
return width;
}
static boolean couldAffectRtl(char c) {
if ((1424 <= c && c <= 2303) || c == 8206 || c == 8207) {
return true;
}
if (8234 <= c && c <= 8238) {
return true;
}
if (8294 <= c && c <= 8297) {
return true;
}
if (55296 <= c && c <= 57343) {
return true;
}
if (64285 <= c && c <= 65023) {
return true;
}
if (65136 > c || c > 65278) {
return false;
}
return true;
}
static boolean doesNotNeedBidi(char[] text, int start, int len) {
int end = start + len;
for (int i = start; i < end; i++) {
if (couldAffectRtl(text[i])) {
return false;
}
}
return true;
}
static char[] obtain(int len) {
char[] buf;
synchronized (sLock) {
buf = sTemp;
sTemp = null;
}
if (buf == null || buf.length < len) {
return ArrayUtils.newUnpaddedCharArray(len);
}
return buf;
}
static void recycle(char[] temp) {
if (temp.length <= 1000) {
synchronized (sLock) {
sTemp = temp;
}
}
}
public static String htmlEncode(String s) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
switch (c) {
case '\"':
sb.append(""");
break;
case '&':
sb.append("&");
break;
case '\'':
sb.append("'");
break;
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
default:
sb.append(c);
break;
}
}
return sb.toString();
}
public static CharSequence concat(CharSequence... text) {
int i = 0;
if (text.length == 0) {
return "";
}
if (text.length == 1) {
return text[0];
}
int length;
CharSequence piece;
boolean spanned = false;
for (CharSequence piece2 : text) {
if (piece2 instanceof Spanned) {
spanned = true;
break;
}
}
if (spanned) {
SpannableStringBuilder ssb = new SpannableStringBuilder();
length = text.length;
while (i < length) {
piece2 = text[i];
if (piece2 == null) {
piece2 = "null";
}
ssb.append(piece2);
i++;
}
return new SpannedString(ssb);
}
StringBuilder sb = new StringBuilder();
length = text.length;
while (i < length) {
sb.append(text[i]);
i++;
}
return sb.toString();
}
public static boolean isGraphic(CharSequence str) {
int len = str.length();
int i = 0;
while (i < len) {
int cp = Character.codePointAt(str, i);
int gc = Character.getType(cp);
if (gc != 15 && gc != 16 && gc != 19 && gc != 0 && gc != 13 && gc != 14 && gc != 12) {
return true;
}
i += Character.charCount(cp);
}
return false;
}
@Deprecated
public static boolean isGraphic(char c) {
int gc = Character.getType(c);
if (gc == 15 || gc == 16 || gc == 19 || gc == 0 || gc == 13 || gc == 14 || gc == 12) {
return false;
}
return true;
}
public static boolean isDigitsOnly(CharSequence str) {
int len = str.length();
int i = 0;
while (i < len) {
int cp = Character.codePointAt(str, i);
if (!Character.isDigit(cp)) {
return false;
}
i += Character.charCount(cp);
}
return true;
}
public static boolean isPrintableAscii(char c) {
if ((' ' <= c && c <= '~') || c == 13 || c == 10) {
return true;
}
return false;
}
public static boolean isPrintableAsciiOnly(CharSequence str) {
int len = str.length();
for (int i = 0; i < len; i++) {
if (!isPrintableAscii(str.charAt(i))) {
return false;
}
}
return true;
}
public static int getCapsMode(CharSequence cs, int off, int reqModes) {
if (off < 0) {
return 0;
}
int mode = 0;
if ((reqModes & 4096) != 0) {
mode = 4096;
}
if ((reqModes & 24576) == 0) {
return mode;
}
char c;
int i = off;
while (i > 0) {
c = cs.charAt(i - 1);
if (c != '\"' && c != DateFormat.QUOTE && Character.getType(c) != 21) {
break;
}
i--;
}
int j = i;
while (j > 0) {
c = cs.charAt(j - 1);
if (c != ' ' && c != 9) {
break;
}
j--;
}
if (j == 0 || cs.charAt(j - 1) == 10) {
return mode | 8192;
}
if ((reqModes & 16384) == 0) {
if (i != j) {
mode |= 8192;
}
return mode;
} else if (i == j) {
return mode;
} else {
while (j > 0) {
c = cs.charAt(j - 1);
if (c != '\"' && c != DateFormat.QUOTE && Character.getType(c) != 22) {
break;
}
j--;
}
if (j > 0) {
c = cs.charAt(j - 1);
if (c == '.' || c == '?' || c == '!') {
if (c == '.') {
for (int k = j - 2; k >= 0; k--) {
c = cs.charAt(k);
if (c == '.') {
return mode;
}
if (!Character.isLetter(c)) {
break;
}
}
}
return mode | 16384;
}
}
return mode;
}
}
public static boolean delimitedStringContains(String delimitedString, char delimiter, String item) {
if (isEmpty(delimitedString) || isEmpty(item)) {
return false;
}
int pos = -1;
int length = delimitedString.length();
while (true) {
pos = delimitedString.indexOf(item, pos + 1);
if (pos == -1) {
return false;
}
if (pos <= 0 || delimitedString.charAt(pos - 1) == delimiter) {
int expectedDelimiterPos = pos + item.length();
if (expectedDelimiterPos == length || delimitedString.charAt(expectedDelimiterPos) == delimiter) {
return true;
}
}
}
}
public static <T> T[] removeEmptySpans(T[] spans, Spanned spanned, Class<T> klass) {
T[] copy = null;
int count = 0;
for (int i = 0; i < spans.length; i++) {
T span = spans[i];
if (spanned.getSpanStart(span) == spanned.getSpanEnd(span)) {
if (copy == null) {
copy = (Object[]) Array.newInstance(klass, spans.length - 1);
System.arraycopy(spans, 0, copy, 0, i);
count = i;
}
} else if (copy != null) {
copy[count] = span;
count++;
}
}
if (copy == null) {
return spans;
}
Object[] result = (Object[]) Array.newInstance(klass, count);
System.arraycopy(copy, 0, result, 0, count);
return result;
}
public static long packRangeInLong(int start, int end) {
return (((long) start) << 32) | ((long) end);
}
public static int unpackRangeStartFromLong(long range) {
return (int) (range >>> 32);
}
public static int unpackRangeEndFromLong(long range) {
return (int) (4294967295L & range);
}
public static int getLayoutDirectionFromLocale(Locale locale) {
if ((locale == null || (locale.equals(Locale.ROOT) ^ 1) == 0 || !ULocale.forLocale(locale).isRightToLeft()) && !SystemProperties.getBoolean(Global.DEVELOPMENT_FORCE_RTL, false)) {
return 0;
}
return 1;
}
public static CharSequence formatSelectedCount(int count) {
return Resources.getSystem().getQuantityString(R.plurals.selected_count, count, new Object[]{Integer.valueOf(count)});
}
public static boolean hasStyleSpan(Spanned spanned) {
boolean z;
if (spanned != null) {
z = true;
} else {
z = false;
}
Preconditions.checkArgument(z);
for (Class<?> clazz : new Class[]{CharacterStyle.class, ParagraphStyle.class, UpdateAppearance.class}) {
if (spanned.nextSpanTransition(-1, spanned.length(), clazz) < spanned.length()) {
return true;
}
}
return false;
}
public static CharSequence trimNoCopySpans(CharSequence charSequence) {
if (charSequence == null || !(charSequence instanceof Spanned)) {
return charSequence;
}
return new SpannableStringBuilder(charSequence);
}
public static void wrap(StringBuilder builder, String start, String end) {
builder.insert(0, start);
builder.append(end);
}
}
| [
"[email protected]"
] | |
0c9b9eaa4fbaf18efae2c6b14427d503f4af80ef | def82370964655905717674e0be7b783ebed7731 | /trading-api/src/main/java/ca/ulaval/glo4002/trading/domain/market/Market.java | 87e5df5ebcbca901295511135f0de211fa702905 | [] | no_license | olgam4/GLO-4002_TradingAPI | 67dbeb0be4e074837f930b1da4b08e19bbc24880 | a0255075227ce9d9c0d870b03e5a716f56b06c66 | refs/heads/master | 2020-05-17T11:53:29.120913 | 2019-04-26T21:37:28 | 2019-04-26T21:45:36 | 183,696,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,902 | java | package ca.ulaval.glo4002.trading.domain.market;
import ca.ulaval.glo4002.trading.domain.commons.Period;
import ca.ulaval.glo4002.trading.domain.money.Currency;
import java.time.*;
import java.util.List;
public class Market {
private String marketSymbol;
private List<Period> openHours;
private ZoneOffset zoneOffset;
private Currency currency;
public Market(String marketSymbol, ZoneOffset zoneOffset, List<Period> openHours, Currency currency) {
this.marketSymbol = marketSymbol;
this.openHours = openHours;
this.zoneOffset = zoneOffset;
this.currency = currency;
}
public List<Period> getOpenHours() {
return openHours;
}
public ZoneOffset getZoneOffset() {
return zoneOffset;
}
public boolean isMarketOpen(LocalDateTime date) {
OffsetDateTime transactionDate = date.atOffset(ZoneOffset.UTC);
OffsetDateTime transactionAtMarketTime = transactionDate.withOffsetSameInstant(getZoneOffset());
if (isWeekDay(transactionAtMarketTime)) {
for (Period period : getOpenHours()) {
LocalTime localTime = transactionAtMarketTime.toLocalTime();
if (period.contains(LocalDateTime.of(LocalDate.now(), localTime))) {
return true;
}
}
}
return false;
}
public boolean isMarketClose(LocalDateTime date) {
return !isMarketOpen(date);
}
private boolean isWeekDay(OffsetDateTime date) {
DayOfWeek dayOfWeek = date.getDayOfWeek();
return !(dayOfWeek == DayOfWeek.SATURDAY || dayOfWeek == DayOfWeek.SUNDAY);
}
public String getMarketSymbol() {
return marketSymbol;
}
public Currency getCurrency() {
return currency;
}
public void setCurrency(Currency currency) {
this.currency = currency;
}
}
| [
"[email protected]"
] | |
70fdc3a1196f8a5639f358b1f999ca333d44df71 | 2d65fe9c26ea9ae354bd28028083f9cfe71d0579 | /app/src/main/java/com/example/xxovek/salesman_tracker1/admin/routes/ShowRoutesFragment.java | 5e4cd8451ccbe98eb5f8ebc097da95233936824b | [] | no_license | rockstarsantosh1994/Salesman_tracker1 | 937400c507b748c31a5e1b5d230c627e86f27c63 | 39e38365babf33f12a451622029480e9862a1b77 | refs/heads/master | 2020-06-22T20:22:13.390225 | 2019-08-09T06:39:49 | 2019-08-09T06:39:49 | 195,234,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,679 | java | package com.example.xxovek.salesman_tracker1.admin.routes;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.DividerItemDecoration;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import 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.StringRequest;
import com.android.volley.toolbox.Volley;
import com.example.xxovek.salesman_tracker1.ConfigUrls;
import com.example.xxovek.salesman_tracker1.R;
import com.example.xxovek.salesman_tracker1.admin.addshopsonroute.AddRouteForShopsFragment;
import com.example.xxovek.salesman_tracker1.admin.tabs.AddShopOnRoutesTab;
import com.example.xxovek.salesman_tracker1.admin.tabs.RoutesFragmentTab;
import com.example.xxovek.salesman_tracker1.user.MyRecyclerViewAdapter;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class ShowRoutesFragment extends Fragment implements MyRecyclerViewAdapter.ItemClickListener{
RecyclerView recyclerView;
public int i;
public MyRecyclerViewAdapter adapter;
Button button77;
String n [] ;
String a="";
List<String> al = new ArrayList<String>();
List<String> al1 = new ArrayList<String>();
List<String> al2 = new ArrayList<String>();
List<String> al3 = new ArrayList<String>();
List<String> al4 = new ArrayList<String>();
List<String> al5 = new ArrayList<String>();
public String st_assignid;
private String cid="3";
public ShowRoutesFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_show_route_details, container, false);
recyclerView = view.findViewById(R.id.admin_show_recycle_id);
final String LOGIN_URL = "http://track.xxovek.com/src/display_routes";
//Creating a string request
StringRequest stringRequest = new StringRequest(Request.Method.POST, ConfigUrls.DISPLAY_ROUTE,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//If we are getting success from server
if(TextUtils.isEmpty(response)){
//Creating a shared preference
//.makeText(ShowRoutesFragment.this.getContext(), "No Shops"+response.toString(), //.LENGTH_LONG).show();
}else{
JSONArray json_data = null;
try {
json_data = new JSONArray(response);
int len = json_data.length();
//.makeText(getContext(), response.toString(), //.LENGTH_SHORT).show();
for(int i=0; i<json_data.length();i++){
JSONObject json = json_data.getJSONObject(i);
al1.add((json.getString("RouteId")));
al2.add("Src: ".concat(json.getString("source")));
al3.add("Dest: ".concat(json.getString("dest")));
al4.add("Created At : ".concat(json.getString("creattime")));
al5.add("Updated At : ".concat(json.getString("updatetime")));
// st_assignid =(json.getString("status"));
// a= a + "Age : "+json.getString("c_phone")+"\n";
//j= j + "Job : "+json.getString("Job")+"\n";
}
// ////.makeText(getContext(), n.toString(), //.LENGTH_SHORT).show();
String result1 = response.replace("\"", "");
result1 = result1.replaceAll("[\\[\\]\\(\\)]", "");
String str[] = result1.split(",");
//.makeText(getContext(), al.toString(), //.LENGTH_SHORT).show();
//.makeText(getContext(), al2.toString(), //.LENGTH_SHORT).show();
//al = Arrays.asList(n);
final RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
adapter = new MyRecyclerViewAdapter(getContext(), al1,al2,al3,al4,al5,al5,al3,al2,al1,al1,"2");
adapter.setClickListener(ShowRoutesFragment.this);
recyclerView.setAdapter(adapter);
recyclerView.addItemDecoration(new DividerItemDecoration(getContext(),
DividerItemDecoration.VERTICAL));
} catch (JSONException e) {
e.printStackTrace();
}
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//You can handle error here if you want
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
//Adding parameters to request
params.put("admin_id", cid);
//returning parameter
return params;
}
};
//Adding the string request to the queue
RequestQueue requestQueue = Volley.newRequestQueue(getContext());
requestQueue.add(stringRequest);
return view;
}
@Override
public void onItemClick(View view, int position) {
int id=view.getId();
String user_id1 = adapter.getItem(position);
String source = adapter.getItem2(position);
String dest = adapter.getItem3(position);
// //.makeText(getContext(), "getitem is " + user_id1.toString() + " on row number " + position, //.LENGTH_SHORT).show();
//.makeText(getContext(), "On Item Clicked"+id, //.LENGTH_SHORT).show();
switch (id){
case R.id.ib_edit:Fragment fragment = new AddRoutesFragment();
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Bundle data = new Bundle();//Use bundle to pass data
data.putString("data", user_id1);
data.putString("source", source);
data.putString("dest", dest);
fragment.setArguments(data);
fragmentTransaction.replace(R.id.main_container, fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
break;
case R.id.ib_delete: final String st_delid= adapter.getItem(position);
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setIcon(android.R.drawable.ic_lock_power_off);
builder.setTitle("Delete");
builder.setMessage("Do you really want to delete?");
builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//.makeText(getContext(), "st_delid\n"+st_delid, //.LENGTH_SHORT).show();
StringRequest stringRequest = new StringRequest(Request.Method.POST, ConfigUrls.REMOVE_DETAILS,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//If we are getting success from server
if(TextUtils.isEmpty(response)){
//Creating a shared preference
//.makeText(getContext(), "Unable to delete product data"+response.toString(), //.LENGTH_LONG).show();
}else{
//.makeText(getContext(), "Customer Deleted Successfully"+response, //.LENGTH_SHORT).show();
Log.d("mytag", "onResponse:REMOVE_DETAILS "+response);
Fragment fragment = new RoutesFragmentTab();
FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
fragmentTransaction.replace(R.id.main_container, fragment);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
adapter.notifyDataSetChanged();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//You can handle error here if you want
}
}){
@Override
protected Map<String, String> getParams() throws AuthFailureError {
Map<String,String> params = new HashMap<>();
//Adding parameters to request
String tblname="RouteMaster";
String colname="RouteId";
params.put("id", st_delid);
params.put("tblName", tblname);
params.put("colName", colname);
// params.put("password", password);
Log.d("mytag", "\ngetParams: ID "+st_delid+"\ntblname "+tblname+"\ncolname "+colname);
//returning parameter
return params;
}
};
//Adding the string request to the queue
RequestQueue requestQueue = Volley.newRequestQueue(getContext());
requestQueue.add(stringRequest);
}
});
builder.setNegativeButton("No", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
//.makeText(getContext(), "Delete Operation Cancelled", //.LENGTH_SHORT).show();
}
});
AlertDialog dialog = builder.create();
dialog.show();
break;
}
// Intent intent = new Intent(getContext(), Clientsinfo.class);
// startActivity(intent);
}
}
| [
"[email protected]"
] | |
ea1becddbaf5ac2b14b80f2c5038392ff61b3c30 | 0a77007c133d2d2f0203602daf06c2471327eba8 | /src/JavaAlgorithms/Main.java | b7e14b668bad87497699401b5813dd08affd5226 | [] | no_license | Dragonxero/ChallengeOneAlgorithmEveryDay | 0367940e12d2f11aaabd10afe9ab8b85fb32823c | c31fc48e8ffb1e29d1cfdca72c8571015f55cf5e | refs/heads/master | 2021-01-21T15:49:45.792841 | 2016-07-27T07:09:23 | 2016-07-27T07:09:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,832 | java | package JavaAlgorithms;
import JavaAlgorithms.Algorithms.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
/**
* Hey!! This is a list of algorithms. Originally, these algorithms are from FreeCodeCamp.com where you
* need to code them in Javascript. I will convert them to Java.
*/
public class Main {
public static void main(String[] args) {
int option;
while (true) {
Scanner reader = new Scanner (System.in);
menu();
try {
option = reader.nextInt();
} catch (InputMismatchException ex) {
System.out.println("\nJust numbers, pls\n");
continue;
}
switch (option) {
case 1:
System.out.println("The Chunkey Monkey algorithm takes an array and a chunk parameter");
System.out.println("to split the array into a multidimensional one.");
System.out.println("\nThis is the array that is using:");
System.out.println("[1, 2, 3, 4, 6]");
System.out.println("The chunk parameter is: 2\n");
System.out.println("And this is the result:");
int[] arr = new int[] {1, 2, 3, 4, 5, 6};
ChunkeyMonkey chunkey = new ChunkeyMonkey(arr, 2);
ArrayList<int[]> chunkeyArr = chunkey.doChunkey();
for (int[] item : chunkeyArr)
System.out.print(Arrays.toString(item) + " ");
System.out.print("\n");
break;
case 2:
System.out.println("The Mutations algorithm takes two Strings. The second parameter is");
System.out.println("the letters that I want to know if the first string contains.");
System.out.print("\nEnter the first String: ");
String[] parameters = new String[2];
reader.nextLine();
parameters[0] = reader.nextLine();
System.out.print("And the second, pls: ");
parameters[1] = reader.nextLine();
Mutations mut = new Mutations(parameters);
System.out.println("The result is: " + mut.checkMutation());
break;
case 3:
System.out.println("\nThe algorithm takes two arguments: The first is the numbers that You have");
System.out.println("and the second is those You want to seek to destroy them in the first arguments.");
System.out.println("\nEnter the firsts numbers:");
ArrayList<Integer> arr1 = new ArrayList<>();
reader.nextLine();
for (String token; (token = reader.findInLine("[0-9]+")) != null;)
arr1.add(Integer.valueOf(token));
System.out.println("Now, enter the numbers that you want to destroy:");
ArrayList<Integer> arr2 = new ArrayList<>();
reader.nextLine();
for (String token; (token = reader.findInLine("[0-9]+")) != null;)
arr2.add(Integer.valueOf(token));
SeekAndDestroy sd = new SeekAndDestroy(arr1, arr2);
System.out.println("\nResult:");
System.out.println(sd.doDestroy().toString() + "\n");
break;
case 4:
System.out.println("Returns the lowest index at which a value (second argument) should be inserted into an array");
System.out.println("(first argument). The returned value is a number.");
System.out.println("\nEnter some numbers separated with spaces:");
reader.nextLine();
ArrayList<Double> listOfNumbers = new ArrayList<>();
for (String token; (token = reader.findInLine("[0-9]+(\\.\\d+)?")) != null;)
listOfNumbers.add(Double.valueOf(token));
System.out.println("Enter the number that you want to insert:");
reader.nextLine();
double number = 0;
for (String token; (token = reader.findInLine("[0-9]+(\\.\\d+)?")) != null;)
number = Double.parseDouble(token);
WhereDoIBelong wdib = new WhereDoIBelong(listOfNumbers, number);
System.out.println("\nResult: " + wdib.getIndexToIns());
break;
case 5:
DiffTwoArrays dta = new DiffTwoArrays();
dta.showAlg(reader);
break;
case 6:
SearchAndReplace sr = new SearchAndReplace();
sr.showAlg(reader);
break;
case 7:
PigLatin pl = new PigLatin();
pl.showAlg(reader);
break;
case 8:
SpinalCase sc = new SpinalCase();
sc.showAlg(reader);
break;
case 9:
RomanNumeralConverter rnc = new RomanNumeralConverter();
rnc.showAlg();
break;
case 10:
FibonacciOddSum fos = new FibonacciOddSum();
fos.showAlg(reader);
break;
case 11:
SumAllPrimes sap = new SumAllPrimes();
sap.showAlg(reader);
break;
case 12:
SmallestCommonMultiple scm = new SmallestCommonMultiple();
scm.showAlg(reader);
break;
case 13:
FriendlyNumbers fn = new FriendlyNumbers();
fn.showAlg(reader);
break;
case 14:
NetPresentValue npv = new NetPresentValue();
npv.showAlg(reader);
break;
case 15:
HarmonicMean hm = new HarmonicMean();
hm.showAlg(reader);
break;
case 16:
FoodMachine fm = new FoodMachine();
fm.showAlg(reader);
break;
case 17:
SquareRoot sq = new SquareRoot();
sq.showAlg(reader);
break;
case 18:
TruncateAString ts = new TruncateAString();
ts.showAlg(reader);
break;
case 19:
ConfirmTheEnding ce = new ConfirmTheEnding();
ce.showAlg(reader);
break;
case 20:
FactorializeANumber fan = new FactorializeANumber();
fan.showAlg(reader);
break;
case 21:
FindersKeepers fk = new FindersKeepers();
fk.showAlg(reader);
break;
case 22:
RepeatAStringRepeatAString rsrs = new RepeatAStringRepeatAString();
rsrs.showAlg(reader);
break;
case 23:
SumAllNumbersInARange saniar = new SumAllNumbersInARange();
saniar.showAlg(reader);
break;
case 24:
BinaryAgents ba = new BinaryAgents();
ba.showAlg(reader);
break;
case 25:
Palindromes p = new Palindromes();
p.showAlg(reader);
break;
case 26:
TitleCaseASentence tcas = new TitleCaseASentence();
tcas.showAlg(reader);
break;
case 27:
SlasherFlick sf = new SlasherFlick();
sf.showAlg(reader);
break;
case 28:
RoleTheDice rtd = new RoleTheDice();
rtd.showAlg(reader);
break;
case 29:
HTMLEntriesConverter htmlec = new HTMLEntriesConverter();
htmlec.showAlg(reader);
break;
case 30:
Pythagoras py = new Pythagoras();
py.showAlg(reader);
break;
case 31:
CollatzConjecture cc = new CollatzConjecture();
cc.showAlg(reader);
break;
case 32:
SaintStackoverflow ss = new SaintStackoverflow();
ss.showAlg(reader);
break;
case 33:
String outro = "/**\n" +
" * Thanks for check my work. I really appreciate that.\n" +
" *\n" +
" * Don't forget to visit my profile on GitHub and LinkedIN!\n" +
" * Github: https://github.com/Naturalsoul\n" +
" * LinkedIN: https://cl.linkedin.com/in/rauleduardoc\n" +
" *\n" +
" * Good Bye!\n" +
" */";
System.out.println("\n" + outro);
System.exit(0);
break;
}
}
}
private static void menu () {
String intro = "/**\n" +
" * Author: Naturalsoul\n" +
" *\n" +
" * It has been interesting doing this challenge.\n" +
" * Some days I really felt unmotivated but I preferred to think that I'm\n" +
" * more than those bad feelings and thoughts. That the only real failure is\n" +
" * when I give up 'cause I always can continue and those \"bad things\"\n" +
" * are just another ingredient of success.\n" +
" *\n" +
" * I hope these algorithms and challenge can help and motivate you to do things and to grow.\n" +
" *\n" +
" * My profile on Github: https://github.com/Naturalsoul\n" +
" * My profile on LinkedIN: https://cl.linkedin.com/in/rauleduardoc\n" +
" */";
System.out.println(intro + "\n");
System.out.println("--------------------");
System.out.println("Hi!! :D. Choose an algorithm!");
System.out.println("1) Chunkey Monkey.");
System.out.println("2) Mutations.");
System.out.println("3) Seek and Destroy.");
System.out.println("4) Where Do I Belong.");
System.out.println("5) Diff Two Arrays.");
System.out.println("6) Search And Replace.");
System.out.println("7) Pig Latin.");
System.out.println("8) Spinal Case.");
System.out.println("9) Roman Numeral Converter.");
System.out.println("10) Fibonacci's Odd Sum.");
System.out.println("11) Sum All Primes.");
System.out.println("12) Smallest Common Multiple.");
System.out.println("13) Friendly Numbers.");
System.out.println("14) Net Present Values.");
System.out.println("15) Harmonic Mean.");
System.out.println("16) Food Machine.");
System.out.println("17) Square Root.");
System.out.println("18) Truncate a String.");
System.out.println("19) Confirm The Ending.");
System.out.println("20) Factorialize a Number.");
System.out.println("21) Finders Keepers.");
System.out.println("22) Repeat a String Repeat a String.");
System.out.println("23) Sum All Numbers In A Range.");
System.out.println("24) Binary Agents.");
System.out.println("25) Palindromes.");
System.out.println("26) Title Case a Sentence.");
System.out.println("27) Slasher Flick.");
System.out.println("28) RoleTheDice.");
System.out.println("29) HTML Entries Converter.");
System.out.println("30) Pythagoras.");
System.out.println("31) Collatz Conjecture.");
System.out.println("32) Saint Stackoverflow.");
System.out.println("33) Thanks for the algorithms. Good Bye!!");
System.out.println("--------------------");
System.out.print("Choose an option: ");
}
}
| [
"[email protected]"
] | |
35f4c7da46b322034228570c05cbb2077b926ef8 | 4f5cd2de89cfd0131ed04100dc68e6b557d7f908 | /src/main/java/constant/AppConstants.java | 613aeece7aecb225594da7590aa1938ad9bf8e62 | [] | no_license | 673229632/XTspeakService | ac699b5808cf4d6111d90b86c1217af7de1284fd | a1f4203647d1068011dfa6955690e08b6ee1aab7 | refs/heads/master | 2022-12-04T21:07:37.079148 | 2022-11-18T02:02:34 | 2022-11-18T02:02:34 | 199,411,738 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package constant;
/**
* 默认常量类.
*
* @author zhangrui.i
*/
public class AppConstants {
/**
* 服务器Socket端口.
*/
public static final int PORT = 30000;
}
| [
"[email protected]"
] | |
d042835f3948c9bcdf5bdfcce94881be16221ef3 | 36dae58d1e0256fec216762fd48351b82ca3070e | /src/com/vebora/oauth2/cache/services/YoutubeService.java | a737ec8e9a07897d66db6454e93c36922884b57e | [] | no_license | arikanorh/repo2 | 78d19b32fe43a3ec276c1239f58cebfd7b1c0d4a | 4fb760095bcbfca096c1feb2c3bbcefdee359df0 | refs/heads/master | 2016-08-12T04:01:42.070068 | 2016-03-22T19:49:02 | 2016-03-22T19:49:02 | 54,468,487 | 0 | 0 | null | 2016-03-22T19:01:37 | 2016-03-22T11:06:50 | Java | UTF-8 | Java | false | false | 1,364 | java | package com.vebora.oauth2.cache.services;
import java.io.IOException;
import java.util.List;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.util.Utils;
import com.google.api.services.youtube.YouTube;
import com.google.api.services.youtube.model.Subscription;
import com.google.api.services.youtube.model.SubscriptionListResponse;
import com.vebora.oauth2.main.user.UserCredentialStore;
public class YoutubeService
{
private static final Long NUMBER_OF_VIDEOS_RETURNED = 25L;
public YoutubeService()
{
}
public static void getSomething(String userId) throws IOException
{
GoogleCredential credential = UserCredentialStore.getUserCredential(userId);
YouTube youTube = new YouTube.Builder(Utils.getDefaultTransport(), Utils.getDefaultJsonFactory(), credential).build();
YouTube.Subscriptions.List search = youTube.subscriptions().list("snippet");
// To increase efficiency, only retrieve the fields that the
// application uses.
search.setMine(true);
// search.setFields("items(id/kind,id/videoId,snippet/title,snippet/thumbnails/default/url)");
search.setMaxResults(NUMBER_OF_VIDEOS_RETURNED);
SubscriptionListResponse searchResponse = search.execute();
List<Subscription> searchResultList = searchResponse.getItems();
System.out.println(searchResultList);
}
}
| [
"[email protected]"
] | |
75742f8cda1353652b18d39164dfa187baff1e0e | 91934389484a2a6afba2782d6a3915b913e1a6c9 | /moco-core/src/main/java/com/github/dreamhead/moco/extractor/FormsRequestExtractor.java | d4b51e06b328167941331c28e2e578d5d254be8a | [
"MIT"
] | permissive | edgevagrant/moco | 7ce1f1936578b6da72d9d80735d8e427fcfa4da4 | 9b3ab80f6b45612c80fc172b9814051f76e6c79d | refs/heads/master | 2021-01-14T12:14:41.397409 | 2013-12-10T23:04:16 | 2013-12-10T23:04:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,914 | java | package com.github.dreamhead.moco.extractor;
import com.github.dreamhead.moco.RequestExtractor;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import io.netty.handler.codec.http.FullHttpRequest;
import io.netty.handler.codec.http.multipart.Attribute;
import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder;
import io.netty.handler.codec.http.multipart.InterfaceHttpData;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import static com.google.common.base.Optional.absent;
import static com.google.common.base.Optional.of;
import static com.google.common.collect.ImmutableMap.copyOf;
import static com.google.common.collect.Maps.newHashMap;
public class FormsRequestExtractor implements RequestExtractor {
public Optional<ImmutableMap<String, String>> extract(FullHttpRequest request) {
HttpPostRequestDecoder decoder = null;
try {
decoder = new HttpPostRequestDecoder(request);
return of(doExtractForms(decoder));
} catch (HttpPostRequestDecoder.IncompatibleDataDecoderException idde) {
return absent();
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
if (decoder != null) {
decoder.destroy();
}
}
}
private ImmutableMap<String, String> doExtractForms(HttpPostRequestDecoder decoder) throws IOException {
List<InterfaceHttpData> bodyHttpDatas = decoder.getBodyHttpDatas();
Map<String, String> forms = newHashMap();
for (InterfaceHttpData data : bodyHttpDatas) {
if (data.getHttpDataType() == InterfaceHttpData.HttpDataType.Attribute) {
Attribute attribute = (Attribute) data;
forms.put(attribute.getName(), attribute.getValue());
}
}
return copyOf(forms);
}
}
| [
"[email protected]"
] | |
3131a656c0240219c14e4a8dd86c19459a2b37a6 | 9db1fa08c7aabab96d291f18b7c4165eb0081058 | /practica3/src/main/java/es/unican/is2/controller/AlarmaOffAction.java | 680efa425eebe57897a147dbafa0082625572cd1 | [] | no_license | Loboshj/Practica3 | f0912e983de333fb400e4151ff3403e40b120ba8 | 197106fd96413c3f24f6f68723ef437bd9b2977d | refs/heads/master | 2023-06-14T02:18:25.845896 | 2021-07-07T17:12:46 | 2021-07-07T17:12:46 | 382,682,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 585 | java | package es.unican.is2.controller;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import es.unican.is2.model.Despertador;
import es.unican.is2.view.InterfazGrafica;
public class AlarmaOffAction extends AbstractAction{
private InterfazGrafica vista;
private Despertador despertador;
public AlarmaOffAction(InterfazGrafica vista,Despertador despertador) {
putValue(Action.NAME,"Alarma Off");
this.vista=vista;
this.despertador=despertador;
}
public void actionPerformed(ActionEvent arg0) {
despertador.alarmaOff();
}
}
| [
"[email protected]"
] | |
c19d909446cdcf14339cdf1f2e8341245cadb94c | 7c1985ddebb92bb651a9bb9d34f59dd0f02ade42 | /oaManSystem/src/com/in/service/LeaveService.java | b784b99d6d5645e861450bdd792b1686061de911 | [] | no_license | accp-in/accpin | 58fd7939216b4fe66a0864bc49e59705c7ae5a12 | 3e990072c06f966e38170b3f75b3987cc557ff04 | refs/heads/master | 2021-01-23T10:03:26.927411 | 2014-09-29T11:49:31 | 2014-09-29T11:49:31 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 811 | java | package com.in.service;
import java.util.List;
import java.util.Map;
import com.in.entity.Leave;
/**
* 请假表
* */
public interface LeaveService {
//添加请假信息
public void addLeave(Leave levave);
//修改请假信息
public void updateLeave(Leave levave);
//删除请假信息
public void deleteLeave(Integer id);
//根据ID查找对象
public Leave findById(Integer id);
//查询数据行数
public int findAll();
//Map
public Map<String, Object> allByPage(String name,int pageNo, int pageSize,String hql,String[] paramNames,Object[] values);
//分页查询(根据那么查询)
public List<Leave> findByList(String name,int pageNo, int pageSize,String hql,String[] paramNames,Object[] values);
}
| [
"[email protected]"
] | |
548838d8d2315fb54cffc45561f32a7accc8d261 | 64137d25e00a5591a9cbdafd16daf00b10368f7e | /src/test/java/com/shanhaihen/rabbitdemo/SpringBootRabbitMQTest.java | 655f5169c5bcf4bdc1b3761265d44147e4d33836 | [] | no_license | shanhaihen/rabbitmq-demo | a272454eb3b57c59fd487d27f1bda6ed1ee84b50 | d5f8680c58e86a2aed92c0bf8dbdb0405a7aacfa | refs/heads/main | 2023-02-04T02:12:36.900048 | 2020-12-28T09:32:19 | 2020-12-28T09:32:19 | 323,837,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,037 | java | package com.shanhaihen.rabbitdemo;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = RabbitDemoApplication.class)
@RunWith(SpringRunner.class)
public class SpringBootRabbitMQTest {
@Autowired
private RabbitTemplate rabbitTemplate;
/**
* topic 动态路由 订阅模式
*/
@Test
public void topicTest() {
rabbitTemplate.convertAndSend("topic1", "user", "topic模型发送的[user]消息");
rabbitTemplate.convertAndSend("topic1", "user.save", "topic模型发送的[user.save]消息");
rabbitTemplate.convertAndSend("topic1", "user.save.query", "topic 模型发送的[user.save.query]消息");
rabbitTemplate.convertAndSend("topic1", "order", "topic模型发送的[order]消息");
}
/**
* route 路由模式
*/
@Test
public void routeTest() {
rabbitTemplate.convertAndSend("route1", "info", "route1 模型发送的[info]消息");
rabbitTemplate.convertAndSend("route1", "error", "route1 模型发送的[error]消息");
}
/**
* fanout 广播
*
* @throws InterruptedException
*/
@Test
public void fanOutTest() {
for (int i = 0; i < 10; i++) {
rabbitTemplate.convertAndSend("fanout1", "", i + "fanout 模型发送的消息");
}
}
/**
* 生产者不创建队列
*/
@Test
public void simpleQueueTest() {
rabbitTemplate.convertAndSend("hello", "hello world");
}
/**
* 生产者不创建队列
*/
@Test
public void workQueueTest() {
for (int i = 0; i < 10; i++) {
System.out.println("=================>>>::" + i);
rabbitTemplate.convertAndSend("spring_work1", i + "hello world");
}
}
}
| [
"[email protected]"
] | |
0a0dffb6901153582973cadb8b9572f270220971 | 1eaacabdf2a8b6688211c4e627a68fa69643c78d | /src/com/algorithms/Average.java | af779eb55dc20d9ae89e0811cc3a4c46d00984a0 | [] | no_license | mrLysyi/AlgorithmsOne | 59a20291193db3ec798f5c3f03cc10d037d49fc7 | 005ddc324191f23d3481498e88e5fb6ea2656889 | refs/heads/master | 2016-09-05T13:53:57.759280 | 2014-11-26T15:19:30 | 2014-11-26T15:19:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,639 | java | package com.algorithms;
/*************************************************************************
* Compilation: javac Average.java
* Execution: java Average < data.txt
* Dependencies: StdIn.java StdOut.java
*
* Reads in a sequence of real numbers, and computes their average.
*
* % java Average
* 10.0 5.0 6.0
* 3.0 7.0 32.0
* <Ctrl-d>
* Average is 10.5
* Note <Ctrl-d> signifies the end of file on Unix.
* On windows use <Ctrl-z>.
*
*************************************************************************/
/**
* The <tt>Average</tt> class provides a client for reading in a sequence
* of real numbers and printing out their average.
* <p>
* For additional documentation, see <a href="http://algs4.cs.princeton.edu/11model">Section 1.1</a> of
* <i>Algorithms, 4th Edition</i> by Robert Sedgewick and Kevin Wayne.
*
* @author Robert Sedgewick
* @author Kevin Wayne
*/
public class Average {
// this class should not be instantiated
private Average() { }
/**
* Reads in a sequence of real numbers from standard input and prints
* out their average to standard output.
*/
public static void main(String[] args) {
int count = 0; // number input values
double sum = 0.0; // sum of input values
// read data and compute statistics
while (!StdIn.isEmpty()) {
double value = StdIn.readDouble();
sum += value;
count++;
}
// compute the average
double average = sum / count;
// print results
StdOut.println("Average is " + average);
}
}
| [
"[email protected]"
] | |
54d3fe5c277214cdff558f27d63bc1fc46065ff4 | 2d46cff448051266819b8fb9abfec58627381834 | /src/test/java/de/zalando/buildstatus/BuildStatusMonitorTest.java | cb55a83220900952ca676d13845499d1f2718f42 | [
"MIT"
] | permissive | cjander/build-status-traffic-light | 19f1a82c1b5d92fc191a8b8550a22324eb98b3f7 | d30486e017413a9dbc4405c2ca040d9d0522df6d | refs/heads/master | 2021-01-11T07:24:01.635564 | 2016-09-12T15:45:21 | 2016-09-12T15:45:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,519 | java | package de.zalando.buildstatus;
import de.zalando.buildstatus.display.Display;
import de.zalando.buildstatus.http.SimpleHttpClient;
import de.zalando.buildstatus.job.JenkinsJob;
import de.zalando.buildstatus.job.Job;
import org.apache.commons.io.IOUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockserver.integration.ClientAndServer;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static org.mockserver.model.HttpRequest.request;
import static org.mockserver.model.HttpResponse.response;
public class BuildStatusMonitorTest {
private final String jenkinsJobRedJson;
private final String jenkinsJobYellowJson;
private final String jenkinsJobBlueJson;
private final String jenkinsJobRedAnimatedJson;
private final String jenkinsJobBlueAnimatedJson;
private final String jenkinsJobYellowAnimatedJson;
private ClientAndServer mockServer;
@Mock private Display display;
private BuildStatusMonitor monitor;
private int port= 8082;
public BuildStatusMonitorTest() throws IOException {
jenkinsJobRedJson = IOUtils.toString(this.getClass().getResourceAsStream("/jenkinsapi-job-red.json"));
jenkinsJobYellowJson = IOUtils.toString(this.getClass().getResourceAsStream("/jenkinsapi-job-yellow.json"));
jenkinsJobBlueJson = IOUtils.toString(this.getClass().getResourceAsStream("/jenkinsapi-job-blue.json"));
jenkinsJobRedAnimatedJson = IOUtils.toString(
this.getClass().getResourceAsStream("/jenkinsapi-job-red_anime.json"));
jenkinsJobBlueAnimatedJson = IOUtils.toString(
this.getClass().getResourceAsStream("/jenkinsapi-job-blue_anime.json"));
jenkinsJobYellowAnimatedJson = IOUtils.toString(
this.getClass().getResourceAsStream("/jenkinsapi-job-yellow_anime.json"));
}
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
mockServer = new ClientAndServer(port);
monitor = new BuildStatusMonitor(display, new SimpleHttpClient());
}
@After
public void tearDown() {
mockServer.stop();
}
@Test
public void ifJenkinsJobIsRedIndicatorShouldDisplayFailed() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobRedJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
private Collection<Job> createJobsListFromJson(String... json) {
List<Job> jobs = new ArrayList<>(json.length);
int i = 0;
for(String s : json) {
String jobName = "job" + i++;
configureJenkinsJob(jobName, s);
jobs.add(new JenkinsJob("http://localhost:" + port +"/", jobName, "user", "password", true));
}
return jobs;
}
private void configureJenkinsJob(String jobId, String body) {
mockServer
.when(request()
.withMethod("GET")
.withPath("/job/" + jobId + "/api/json"))
.respond(response()
.withStatusCode(200)
.withHeader("Content-Type", "application/json")
.withBody(body)
);
}
@Test
public void ifJenkinsJobIsYellowIndicatorShouldDisplayUnstable() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobYellowJson));
Mockito.verify(display, Mockito.times(1)).displayUnstable();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifJenkinsJobIsBlueIndicatorShouldDisplaySuccess() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobBlueJson));
Mockito.verify(display, Mockito.times(1)).displaySuccess();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifAtLeastOneJobIsFailedIndicatorShouldDisplayFailure() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobBlueJson, jenkinsJobRedJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifAtLeastOneJobIsUnstableIndicatorShouldDisplayUnstable() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobBlueJson, jenkinsJobYellowJson));
Mockito.verify(display, Mockito.times(1)).displayUnstable();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifThereAreUnstableAndFailedJobsIndicatorShouldDisplayFailed() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobRedJson, jenkinsJobYellowJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifAllJobsAreSuccessIndicatorShouldDisplaySuccess() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobBlueJson, jenkinsJobBlueJson));
Mockito.verify(display, Mockito.times(1)).displaySuccess();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifJenkinsJobIsBlueAnimatedIndicatorShouldDisplaySuccess() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobBlueAnimatedJson));
Mockito.verify(display, Mockito.times(1)).displaySuccess();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifJenkinsJobIsRedAnimatedIndicatorShouldDisplayFailure() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobRedAnimatedJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void ifJenkinsJobIsYellowAnimatedIndicatorShouldDisplayUnstable() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobRedAnimatedJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void successBlinkingStatusShouldOverrideNonBlinkingStatus() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobBlueJson, jenkinsJobBlueAnimatedJson));
Mockito.verify(display, Mockito.times(1)).displaySuccess();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void unstableBlinkingStatusShouldOverrideNonBlinkingStatus() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobYellowJson, jenkinsJobYellowAnimatedJson));
Mockito.verify(display, Mockito.times(1)).displayUnstable();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void failureBlinkingStatusShouldOverrideNonBlinkingStatus() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobRedJson, jenkinsJobRedAnimatedJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void failureBlinkingStatusShouldOverrideSuccessStatus() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobRedAnimatedJson, jenkinsJobBlueJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void failureBlinkingStatusShouldOverrideUnstableStatus() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobYellowJson, jenkinsJobRedAnimatedJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void unstableBlinkingStatusShouldNotOverrideFailedStatus() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobYellowAnimatedJson, jenkinsJobRedJson));
Mockito.verify(display, Mockito.times(1)).displayFailure();
Mockito.verifyNoMoreInteractions(display);
}
@Test
public void unstableBlinkingStatusShouldOverrideSuccessStatus() throws Exception {
monitor.updateDisplay(createJobsListFromJson(jenkinsJobYellowAnimatedJson, jenkinsJobBlueJson));
Mockito.verify(display, Mockito.times(1)).displayUnstable();
Mockito.verifyNoMoreInteractions(display);
}
}
| [
"[email protected]"
] | |
626b4e890f3da97e2b32fb84ec54bdd11c6f406f | 9b80a515194b84fe1e995511c7ddc232cb9b0a01 | /clink-appsdk/android/demo/TOSClientLibDemo/online_service/threepart/src/main/java/com/org/gzuliyujiang/filepicker/contract/OnPathClickedListener.java | 9178c3baf1fceb53fb75befb120b3032649cfdad | [
"Apache-2.0"
] | permissive | ti-net/clink-sdk | e5f17050c37d26d215b11f6ff19d30f23cf7cc9b | cb918ee1bb5b108159d3d9bae788dd9d9fd2a486 | refs/heads/master | 2023-08-18T21:44:35.676263 | 2023-08-17T12:22:13 | 2023-08-17T12:22:13 | 200,053,531 | 12 | 10 | Apache-2.0 | 2023-09-13T06:09:42 | 2019-08-01T13:13:27 | Objective-C | UTF-8 | Java | false | false | 1,006 | java | /*
* Copyright (c) 2016-present 贵州纳雍穿青人李裕江<[email protected]>
*
* The software is licensed under the Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
* PURPOSE.
* See the Mulan PSL v2 for more details.
*/
package com.org.gzuliyujiang.filepicker.contract;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.org.gzuliyujiang.filepicker.adapter.ViewHolder;
/**
* @author 贵州山野羡民([email protected])
* @since 2021/6/10 20:15
*/
public interface OnPathClickedListener {
void onPathClicked(RecyclerView.Adapter<ViewHolder> adapter, int position, @NonNull String path);
}
| [
"[email protected]"
] | |
c69b08e2fb7c34efd64fa74ccbaec92ae37c1aee | 246bd3fbfadb1864c30bfdb20990474161b52df1 | /read-n-characters-given-read4-ii.java | da8447f9be4db4ac95e34243e71d80ef684b737b | [] | no_license | renmengfei/leetcode | 8200b155477b43da8b701c102a422e9a4127ea47 | f263d32a4e49c5249d655baee7c7b1aeb481f0c5 | refs/heads/master | 2020-04-06T06:58:58.286956 | 2019-07-10T06:55:34 | 2019-07-10T06:55:34 | 19,768,032 | 0 | 0 | null | 2019-07-10T06:55:35 | 2014-05-14T05:52:09 | Java | UTF-8 | Java | false | false | 659 | java | public class Solution extends Reader4 {
char[] buffer = new char[4];
int offset=0;
int buffersize = 0;
public int read(char[] buf, int n) {
int result = 0;
boolean eof = false;
while(!eof && result <n){
//empty
if(buffersize==0){
buffersize = read4(buffer);
if(buffersize<4) eof = true;
}
int bytes = Math.min(buffersize, n-result);
System.arraycopy(buffer,offset,buf,result,bytes);
offset = (offset+bytes)%4;
result+=bytes;
buffersize-=bytes;
}
return result;
}
}
| [
"[email protected]"
] | |
11e315c624dccee40e69e57caa1c4898335b7ec1 | 0fcdd676181754b9f93081b597fac5c4c62bcda6 | /p0261intentfilter/src/main/java/ru/startandroid/p0261intentfilter/ActivityTime.java | d71c75f23742af27d4474f3f865df0809d1483c5 | [] | no_license | vladislawovk/AndroidLessons | 3ff622b3e2ec2a063d9f4c0dd39fcfcd4193b159 | 1ea6bd67d789c55d8da8ef5add7f202c0c4e003c | refs/heads/master | 2023-02-20T04:37:10.211928 | 2021-01-25T11:02:20 | 2021-01-25T11:02:20 | 322,619,068 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package ru.startandroid.p0261intentfilter;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
import java.sql.Date;
import java.text.SimpleDateFormat;
public class ActivityTime extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_time);
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
String time = sdf.format(new Date(System.currentTimeMillis()));
TextView tvTime = (TextView) findViewById(R.id.tvTime);
tvTime.setText(time);
}
} | [
"[email protected]"
] | |
29c6d99edb60fd7a40feec7a95e48e8d64476f9d | afa3842152755199fc3813d8f9a72541382b9f3e | /src/main/java/com/kraytech/restdemo/repositories/domain/Medico.java | 2ef17a656e04a6ed4bc7eeb912a3cf878dd6ec42 | [] | no_license | kjrg56/hosprest | 77ed9d08678b2272adde52e4f3f79b746965aec5 | 05ec18e7d75618a0638d7d6d08ac9accc6b26d6c | refs/heads/master | 2020-12-21T23:04:11.510467 | 2020-09-16T05:12:33 | 2020-09-16T05:12:33 | 236,592,857 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package com.kraytech.restdemo.repositories.domain;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import lombok.Data;
@Data
@Entity
public class Medico {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String nombres;
private String apellidos;
private String telefono;
public Medico() {
}
public Medico(String nombres, String apellidos, String telefono) {
this.nombres = nombres;
this.apellidos = apellidos;
this.telefono = telefono;
}
}
| [
"Kevin Raymundo"
] | Kevin Raymundo |
1873fc68caee9c6647862804bf4c829033a564f3 | 9282591635f3cf5a640800f2b643cd57048ed29f | /app/src/main/java/com/android/p2pflowernet/project/view/fragments/mine/setting/feedback/FeedBackPopupWindow.java | 15ed25d22dba532cc3a36b980f4794afc493d6e9 | [] | no_license | AHGZ/B2CFlowerNetProject | de5dcbf2cbb67809b00f86639d592309d84b3283 | b1556c4b633fa7c0c1463af94db9f91285070714 | refs/heads/master | 2020-03-09T17:27:14.889919 | 2018-04-10T09:36:33 | 2018-04-10T09:36:33 | 128,908,791 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,380 | java | package com.android.p2pflowernet.project.view.fragments.mine.setting.feedback;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.EditText;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.p2pflowernet.project.R;
/**
* Created by caishen on 2017/11/24.
* by--
*/
public class FeedBackPopupWindow extends PopupWindow {
private FragmentActivity mContext;
private View view;
public FeedBackPopupWindow(FragmentActivity activity, String tvType, String tvReply, String etFeedback, String loginName) {
this.mContext = activity;
this.view = LayoutInflater.from(mContext).inflate(R.layout.feedback_popup_window, null);
Button btn_cancle = (Button) view.findViewById(R.id.btn_cancle);
TextView tv_reply = (TextView) view.findViewById(R.id.tv_reply);
TextView tv_num_text = (TextView) view.findViewById(R.id.tv_num_text);
TextView tv_type = (TextView) view.findViewById(R.id.tv_type);
EditText et_feedback = (EditText) view.findViewById(R.id.et_feedback);
TextView tv_login_name = (TextView) view.findViewById(R.id.tv_login_name);
tv_login_name.setText(loginName);
tv_type.setText(tvType);
tv_num_text.setText(etFeedback.length() + "/100字");
tv_reply.setText(tvReply);
et_feedback.setText(etFeedback);
btn_cancle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
// 设置外部可点击
this.setOutsideTouchable(true);
// mMenuView添加OnTouchListener监听判断获取触屏位置如果在选择框外面则销毁弹出框
this.view.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
int height = view.findViewById(R.id.id_pop_layout).getTop();
int y = (int) event.getY();
if (event.getAction() == MotionEvent.ACTION_UP) {
if (y < height) {
dismiss();
}
}
return true;
}
});
/* 设置弹出窗口特征 */
// 设置视图
this.setContentView(this.view);
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
int width = wm.getDefaultDisplay().getWidth();
int height = wm.getDefaultDisplay().getHeight();
// 设置弹出窗体的宽和高
this.setHeight(height * 2 / 3);
this.setWidth(RelativeLayout.LayoutParams.MATCH_PARENT);
// 设置弹出窗体可点击
this.setFocusable(true);
// 实例化一个ColorDrawable颜色为半透明
ColorDrawable dw = new ColorDrawable(0xb0000000);
// 设置弹出窗体的背景
this.setBackgroundDrawable(dw);
// 设置弹出窗体显示时的动画,从底部向上弹出
this.setAnimationStyle(R.style.take_photo_anim);
}
}
| [
"[email protected]"
] | |
517d272cc885257299930b5bf11e18d71d3d44c8 | 49b4cb79c910a17525b59d4b497a09fa28a9e3a8 | /parserValidCheck/src/main/java/com/ke/css/cimp/fwb/fwb7/Rule_Hid_Goods_data_Identifier_S.java | 11eda4b5085f914a04f3f6747fd7e727e49b921e | [] | no_license | ganzijo/koreanair | a7d750b62cec2647bfb2bed4ca1bf8648d9a447d | e980fb11bc4b8defae62c9d88e5c70a659bef436 | refs/heads/master | 2021-04-26T22:04:17.478461 | 2018-03-06T05:59:32 | 2018-03-06T05:59:32 | 124,018,887 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,359 | java | package com.ke.css.cimp.fwb.fwb7;
/* -----------------------------------------------------------------------------
* Rule_Hid_Goods_data_Identifier_S.java
* -----------------------------------------------------------------------------
*
* Producer : com.parse2.aparse.Parser 2.5
* Produced : Tue Mar 06 10:38:08 KST 2018
*
* -----------------------------------------------------------------------------
*/
import java.util.ArrayList;
final public class Rule_Hid_Goods_data_Identifier_S extends Rule
{
public Rule_Hid_Goods_data_Identifier_S(String spelling, ArrayList<Rule> rules)
{
super(spelling, rules);
}
public Object accept(Visitor visitor)
{
return visitor.visit(this);
}
public static Rule_Hid_Goods_data_Identifier_S parse(ParserContext context)
{
context.push("Hid_Goods_data_Identifier_S");
boolean parsed = true;
int s0 = context.index;
ParserAlternative a0 = new ParserAlternative(s0);
ArrayList<ParserAlternative> as1 = new ArrayList<ParserAlternative>();
parsed = false;
{
int s1 = context.index;
ParserAlternative a1 = new ParserAlternative(s1);
parsed = true;
if (parsed)
{
boolean f1 = true;
int c1 = 0;
for (int i1 = 0; i1 < 1 && f1; i1++)
{
Rule rule = Terminal_StringValue.parse(context, "S");
if ((f1 = rule != null))
{
a1.add(rule, context.index);
c1++;
}
}
parsed = c1 == 1;
}
if (parsed)
{
as1.add(a1);
}
context.index = s1;
}
ParserAlternative b = ParserAlternative.getBest(as1);
parsed = b != null;
if (parsed)
{
a0.add(b.rules, b.end);
context.index = b.end;
}
Rule rule = null;
if (parsed)
{
rule = new Rule_Hid_Goods_data_Identifier_S(context.text.substring(a0.start, a0.end), a0.rules);
}
else
{
context.index = s0;
}
context.pop("Hid_Goods_data_Identifier_S", parsed);
return (Rule_Hid_Goods_data_Identifier_S)rule;
}
}
/* -----------------------------------------------------------------------------
* eof
* -----------------------------------------------------------------------------
*/
| [
"wrjo@wrjo-PC"
] | wrjo@wrjo-PC |
393eb7d3bfe93b93e042cd949295cb7dc5fb2aa1 | abeecfef5a3cd8fbfdeea0b81ef918710d5141a0 | /class02/src/androidTest/java/com/ourdreamit/batch002class02/ExampleInstrumentedTest.java | 1af289943bdfad2318b40504f6c3a8d1bebb0ffd | [] | no_license | anismizicse/Android_Batch_Two_Master | 2a9c3fd4707a47aff0cc78f9d397167f828e8cc5 | 2182c360188b56a59857b6fcd28c1175efad9166 | refs/heads/master | 2020-12-04T03:46:43.627368 | 2020-01-18T15:29:50 | 2020-01-18T15:29:50 | 231,596,627 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 776 | java | package com.ourdreamit.batch002class02;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.ourdreamit.batch002class02", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
c97230ee3c19c618d159e5aabde3cf16653e0f15 | 079dc9d52c65c121662ebd016184eeb16fc36769 | /bitcamp-assignment-04/src/main/java/bitcamp/assignment/repository/MemberRepository.java | 4f741ec7694676cb524ac457933412d3f5a07006 | [] | no_license | humonidtyphoon/bitcamp-cloud-computing | b3807072378bb6eb8e19b731f3415cb330763ba1 | e23f2c8cd0e2094c7723015ddaf7541c85233398 | refs/heads/master | 2021-05-16T23:43:55.553888 | 2018-09-04T10:51:11 | 2018-09-04T10:51:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package bitcamp.assignment.repository;
import java.util.Map;
import bitcamp.assignment.domain.Member;
public interface MemberRepository {
int insert(Member member);
Member findByEmailAndPassword(Map<String,Object> params);
}
| [
"[email protected]"
] | |
23177aa6c647103ac4193756ab2410d240fd8144 | 5ce9f7f8ab8d6d5b492e64b7cb3f2e4a34a69ae1 | /src/com/learning/module/Customer.java | cdd1cf724e09ba28615bc68ac643a2e195643764 | [] | no_license | MayuriMusalgaonkar/gl-development | c37de0f5999f80687db97643bb4ca949aa297200 | f8c5506c5bb29469a61a7158b7ace7893e6b4420 | refs/heads/master | 2023-07-15T09:45:15.617478 | 2021-08-23T16:24:26 | 2021-08-23T16:24:26 | 394,716,131 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package com.learning.module;
public class Customer {
private String password;
private int bankAccountNo;
private int balance;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getBankAccountNo() {
return bankAccountNo;
}
public void setBankAccountNo(int bankAccountNo) {
this.bankAccountNo = bankAccountNo;
}
public int getBalance() {
return balance;
}
public void setBalance(int balance) {
this.balance = balance;
}
public Customer(String password, int bankAccountNo) {
this.password = password;
this.bankAccountNo = bankAccountNo;
}
public Customer(String password, int bankAccountNo,int balance) {
this.password = password;
this.bankAccountNo = bankAccountNo;
this.balance=balance;
}
}
| [
"[email protected]"
] | |
cf8bdf58a32c4cbd9fdab941e6fcd26cf047ec9b | f4bb30d1ba864dfcc2a6b2e646f740693760a973 | /javaenhance/src/cn/itcast/day3/MyAdvice.java | c5523efb20ec5ed66436a2050968faec7c7fa175 | [] | no_license | zhaoccx/JavaBase | 762e3a075aec5e369774fb4937692614fcca8c66 | 152d71eec8b7af444a2c5fc410a6bdbb3b576d4f | refs/heads/master | 2020-12-13T07:45:35.219768 | 2017-10-25T13:04:37 | 2017-10-25T13:04:37 | 26,492,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 529 | java | package cn.itcast.day3;
import java.lang.reflect.Method;
public class MyAdvice implements Advice {
long beginTime = 0;
@Override
public void afterMethod(Method method) {
System.out.println("从传智播客毕业上班啦!");
long endTime = System.currentTimeMillis();
System.out.println(method.getName() + " running time of " + (endTime - beginTime));
}
@Override
public void beforeMethod(Method method) {
System.out.println("到传智播客来学习啦!");
beginTime = System.currentTimeMillis();
}
}
| [
"[email protected]"
] | |
fb9ec0190db2cf8cec9d976443b312887f9610ae | 30f62fe9ee60f49acfe1b08567246a26ea362c67 | /src/main/java/com/edugility/maven/ArtifactsProcessingException.java | b9e3b15976b858d90f6c27cda838dc6a5decf297 | [
"MIT"
] | permissive | ljnelson/artifact-maven-plugin | e55bfbb919017e90a7bf8dffe85efd8422a6cd43 | e64bfb315363945aba389d9ec167c5162a9e1a04 | refs/heads/master | 2021-03-12T19:17:10.322099 | 2015-10-12T23:18:23 | 2015-10-12T23:18:23 | 25,285,790 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,900 | java | /* -*- mode: Java; c-basic-offset: 2; indent-tabs-mode: nil; coding: utf-8-unix -*-
*
* Copyright (c) 2014 Edugility LLC.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* The original copy of this license is available at
* http://www.opensource.org/license/mit-license.html.
*/
package com.edugility.maven;
import java.io.Serializable; // for javadoc only
import java.util.Collection;
import org.apache.maven.artifact.Artifact;
/**
* An {@link Exception} indicating that something has gone wrong
* during {@linkplain ArtifactsProcessor#process(MavenProject,
* Collection, Log) <code>Artifact</code> processing}.
*
* @author <a href="http://about.me/lairdnelson"
* target="_parent">Laird Nelson</a>
*
* @see ArtifactsProcessor
*
* @see ArtifactMojo
*/
public class ArtifactsProcessingException extends Exception {
/**
* The version of this class for {@linkplain Serializable
* serialization} purposes.
*/
private static final long serialVersionUID = 1L;
/**
* The {@link Collection} of {@link Artifact}s that caused this
* {@link ArtifactsProcessingException} to be thrown.
*
* <p>This field may be {@code null}.</p>
*
* @see #setArtifacts(Collection)
*/
private Collection<? extends Artifact> artifacts;
/**
* Creates a new {@link ArtifactsProcessingException}.
*/
public ArtifactsProcessingException() {
super();
}
/**
* Creates a new {@link ArtifactsProcessingException}.
*
* @param message a message describing the error; may be {@code
* null}
*/
public ArtifactsProcessingException(final String message) {
super(message);
}
/**
* Creates a new {@link ArtifactsProcessingException}.
*
* @param cause the {@link Throwable} that caused this {@link
* ArtifactsProcessingException} to be thrown; may be {@code null}
*/
public ArtifactsProcessingException(final Throwable cause) {
super(cause);
}
/**
* Returns the {@link Collection} of {@link Artifact}s that caused
* this {@link ArtifactsProcessingException} to be thrown.
*
* <p>This method may return {@code null}.</p>
*
* @return the {@link Collection} of {@link Artifact}s that caused
* this {@link ArtifactsProcessingException} to be thrown, or {@code
* null}
*
* @see #setArtifacts(Collection)
*/
public Collection<? extends Artifact> getArtifacts() {
return this.artifacts;
}
/**
* Sets the {@link Collection} of {@link Artifact}s that caused this
* {@link ArtifactsProcessingException} to be thrown.
*
* @param artifacts the {@link Collection} of {@link Artifact}s that
* caused this {@link ArtifactsProcessingException} to be thrown;
* may be {@code null}
*
* @see #getArtifacts()
*/
public void setArtifacts(final Collection<? extends Artifact> artifacts) {
this.artifacts = artifacts;
}
}
| [
"[email protected]"
] | |
2c7984d314dd286d28d3d69d8a853e2d5dfe1a9c | 391df28a26a8115dec2686c30f9c9c8c47123401 | /ManyToOne/src/main/java/com/bridgelabz/ManyToOne/App.java | ac6652a9a83da1096aab4a8c472449d682f00eaa | [] | no_license | sujitchincholkar/Hibernate | c7d05e8be8de78e94a665ac8c3bb4cd90c5d6d57 | 4b547c545173a0af8dce0fd0a2c011c191edd2bb | refs/heads/master | 2021-07-18T14:19:38.010311 | 2017-10-27T12:51:49 | 2017-10-27T12:51:49 | 107,673,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package com.bridgelabz.ManyToOne;
import java.util.Scanner;
import com.bridgelabz.ManyToOne.EmployeDao;
public class App
{
public static void main( String[] args )
{
Scanner scanner=new Scanner(System.in);
int choice;
String continueLoop="y";
while(continueLoop.equals("y"))
{
System.out.println("Enter choice \n1.Add \n2.update \n3.Delete");
choice=scanner.nextInt();
switch(choice)
{
case 1:
EmployeDao.addEmployee();
break;
case 2:
EmployeDao.updateEmployee();
break;
case 3:
EmployeDao.deleteEmployee();
break;
default:
System.out.println("wrong choice ");
}
System.out.println("Do you want to continue[Y/N]");
continueLoop=scanner.next();
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.