blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | 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 132 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 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
dd70b35cad37326318b0fee4e60ee7be5b7e5876 | fb7a7dd604bcfe07e0b9c62f53b31a578c308a69 | /message-service-web/src/main/java/org/xiao/message/monitor/api/topicRel/api/ServerConfigTopicRelationshipApi.java | 9aeb6f0e335a98162ed88ac762d2f43ea6dd8411 | [] | no_license | Xlinlin/MMS | 2eedae889cccf2e6ee14d42c0c80b389cad3840d | cf3e10dedd0d819332d5e0b53a4a7638736b3c3b | refs/heads/master | 2020-04-08T11:11:05.691409 | 2018-12-10T08:15:45 | 2018-12-10T08:15:45 | 159,296,228 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | package org.xiao.message.monitor.api.topicRel.api;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.xiao.message.common.page.MongoPageImp;
import org.xiao.message.monitor.api.topicRel.dto.ServerConfigTopicRelationshipDto;
import org.xiao.message.monitor.api.topicRel.query.RelateshipQuery;
import org.xiao.message.monitor.constants.ServiceProduceConstants;
/**
* [简要描述]:
* [详细描述]:
*
* @author nietao
* @version 1.0, 2018/11/5
* @since JDK 1.8
*/
@FeignClient(value = ServiceProduceConstants.MESSAGE_ADMIN)
@RequestMapping("/serverConfig/relationship")
public interface ServerConfigTopicRelationshipApi
{
@RequestMapping(value = "/findPage")
MongoPageImp<ServerConfigTopicRelationshipDto> findPage(@RequestBody RelateshipQuery relateshipQuery);
}
| [
"llxiao@winnermedical.com"
] | llxiao@winnermedical.com |
deda2c223f1558a216a787187b1e90aed012084e | eac908e49991a4cb6ee72be1b26f1724b6e24084 | /flog/src/main/java/com/tencent/mars/xlog/Xlog.java | d110c8ee2217f997b7a949c68a75e316c9804229 | [] | no_license | yi291047383/Mas | 823606de707c27cd7f2b734791f6fbae5a6e1866 | 82a3be64f5414672b82bbb527121eada9d7082ee | refs/heads/master | 2021-10-10T22:17:39.619187 | 2019-01-18T07:37:02 | 2019-01-18T07:37:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,609 | java | package com.tencent.mars.xlog;
@SuppressWarnings("JniMissingFunction")
public class Xlog implements Log.LogImp {
public static final int LEVEL_ALL = 0;
public static final int LEVEL_VERBOSE = 0;
public static final int LEVEL_DEBUG = 1;
public static final int LEVEL_INFO = 2;
public static final int LEVEL_WARNING = 3;
public static final int LEVEL_ERROR = 4;
public static final int LEVEL_FATAL = 5;
public static final int LEVEL_NONE = 6;
public static final int AppednerModeAsync = 0;
public static final int AppednerModeSync = 1;
public static void open(boolean isLoadLib, int level, int mode, String cacheDir, String logDir, String nameprefix, String pubkey) {
if (isLoadLib) {
System.loadLibrary("stlport_shared");
System.loadLibrary("marsxlog");
}
appenderOpen(level, mode, cacheDir, logDir, nameprefix, pubkey);
}
private static String decryptTag(String tag) {
return tag;
}
public static native void logWrite(XLoggerInfo logInfo, String log);
public static native void logWrite2(int level, String tag, String filename, String funcname, int line, int pid, long tid, long maintid, String log);
public static native void setAppenderMode(int mode);
public static native void setConsoleLogOpen(boolean isOpen); //set whether the console prints log
public static native void setErrLogOpen(boolean isOpen); //set whether the prints err log into a separate file
public static native void appenderOpen(int level, int mode, String cacheDir, String logDir, String nameprefix, String pubkey);
@Override
public void logV(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, String log) {
logWrite2(LEVEL_VERBOSE, decryptTag(tag), filename, funcname, line, pid, tid, maintid, log);
}
@Override
public void logD(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, String log) {
logWrite2(LEVEL_DEBUG, decryptTag(tag), filename, funcname, line, pid, tid, maintid, log);
}
@Override
public void logI(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, String log) {
logWrite2(LEVEL_INFO, decryptTag(tag), filename, funcname, line, pid, tid, maintid, log);
}
@Override
public void logW(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, String log) {
logWrite2(LEVEL_WARNING, decryptTag(tag), filename, funcname, line, pid, tid, maintid, log);
}
@Override
public void logE(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, String log) {
logWrite2(LEVEL_ERROR, decryptTag(tag), filename, funcname, line, pid, tid, maintid, log);
}
@Override
public void logF(String tag, String filename, String funcname, int line, int pid, long tid, long maintid, String log) {
logWrite2(LEVEL_FATAL, decryptTag(tag), filename, funcname, line, pid, tid, maintid, log);
}
@Override
public native int getLogLevel();
public static native void setLogLevel(int logLevel);
@Override
public native void appenderClose();
@Override
public native void appenderFlush(boolean isSync);
static class XLoggerInfo {
public int level;
public String tag;
public String filename;
public String funcname;
public int line;
public long pid;
public long tid;
public long maintid;
}
}
| [
"qiudaoyu@2dfire.com"
] | qiudaoyu@2dfire.com |
26dae71ffc026aa4f56cb22dd249b0ada0023537 | aba752ff3b58aa8c39bf2454ace3214041843d74 | /src/main/java/com/aliyun/aksls/chlde/log/request/ApplyConfigToMachineGroupRequest.java | 7a3f20d97bb39fb2fdf505d95b311bfd45ce39d6 | [
"Apache-2.0"
] | permissive | isyours/aliyun-log-java-producer | af9f17112e73c93711f599313bcb26331b15b096 | 7b79eca312701f5512471d46872a4142c85e35c5 | refs/heads/master | 2020-06-23T23:49:13.221936 | 2020-01-19T06:04:21 | 2020-01-19T06:04:21 | 198,787,166 | 0 | 0 | null | 2019-07-25T08:08:39 | 2019-07-25T08:08:39 | null | UTF-8 | Java | false | false | 724 | java | package com.aliyun.aksls.chlde.log.request;
public class ApplyConfigToMachineGroupRequest extends Request {
/**
*
*/
private static final long serialVersionUID = -864880502847206082L;
protected String groupName = "";
protected String configName = "";
public ApplyConfigToMachineGroupRequest(String project, String groupName, String configName) {
super(project);
this.groupName = groupName;
this.configName = configName;
}
public String GetGroupName() {
return groupName;
}
public void SetGroupName(String groupName) {
this.groupName = groupName;
}
public String GetConfigName() {
return configName;
}
public void SetConfigName(String configName) {
this.configName = configName;
}
}
| [
"haolong.chl@alibaba-inc.com"
] | haolong.chl@alibaba-inc.com |
45e3c3c296f41b5e61c233e3ddd5a518dfa9bb9e | 4425dc5cffa0b895c8a5e73e18f8fc53a13fe83d | /src/test/java/cn/sinobest/core/config/schema/PatternTest.java | 84fcdd8995e613085159734fd4e9d81908a26b79 | [] | no_license | AnsonLoveLina/DataTraversal | 250158e4a948320a930913438001a4f6fb562ea9 | f3b5992f71f7ba3f6a6298a3bcc7262276564d87 | refs/heads/master | 2021-01-17T07:08:35.138655 | 2016-06-23T02:16:08 | 2016-06-23T02:16:08 | 49,942,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 608 | java | package cn.sinobest.core.config.schema;
import cn.sinobest.core.common.util.SqlUtil;
import cn.sinobest.traverse.analyzer.regular.DefaultRegularConvertor;
import org.junit.Test;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by zy-xx on 16/1/25.
*/
public class PatternTest {
@Test
public void test(){
Pattern pattern = SqlUtil.getPattern("/^\\d{9}/", new DefaultRegularConvertor());
String str = "326236882";
Matcher matcher = pattern.matcher(str);
while(matcher.matches()){
System.out.println(str);
}
}
}
| [
"xx198742"
] | xx198742 |
414ee782c7b731ab71d91b03a029fffe1345f14b | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/18/18_f4ae373cb62e01b9455eeedbce4a8afd9649750e/JDBCTestingBase/18_f4ae373cb62e01b9455eeedbce4a8afd9649750e_JDBCTestingBase_t.java | 30d568bd973bc3d8aeab605b379a9f88176a74b6 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 17,426 | java | /*
* Copyright (c) 2007-2013 Concurrent, Inc. All Rights Reserved.
*
* Project and contact information: http://www.cascading.org/
*
* This file is part of the Cascading project.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package cascading.jdbc;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
import java.net.URL;
import java.util.Enumeration;
import java.util.Properties;
import java.util.Set;
import cascading.flow.Flow;
import cascading.flow.hadoop.HadoopFlowConnector;
import cascading.jdbc.db.DBInputFormat;
import cascading.jdbc.db.DBWritable;
import cascading.lingual.catalog.provider.ProviderDefinition;
import cascading.operation.Identity;
import cascading.operation.regex.RegexSplitter;
import cascading.pipe.Each;
import cascading.pipe.Pipe;
import cascading.property.AppProps;
import cascading.scheme.hadoop.TextLine;
import cascading.tap.SinkMode;
import cascading.tap.Tap;
import cascading.tap.hadoop.Hfs;
import cascading.tuple.Fields;
import cascading.tuple.TupleEntryIterator;
import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.slf4j.LoggerFactory;
import static org.junit.Assert.assertEquals;
/**
* Base class for the various database tests. This class contains the actual
* tests, while the subclasses can implement their own specific setUp and
* tearDown methods.
*/
public abstract class JDBCTestingBase
{
String inputFile = "../cascading-jdbc-core/src/test/resources/data/small.txt";
/** the JDBC url for the tests. subclasses have to set this */
protected String jdbcurl;
/** the name of the JDBC driver to use. */
protected String driverName;
/** The input format class to use. */
protected Class<? extends DBInputFormat> inputFormatClass = DBInputFormat.class;
/** The jdbc factory to use. */
private JDBCFactory factory = new JDBCFactory();
protected org.slf4j.Logger LOG = LoggerFactory.getLogger( getClass() );
protected static final String TESTING_TABLE_NAME = "testingtable";
@Test
public void testJDBC() throws IOException
{
// CREATE NEW TABLE FROM SOURCE
Tap<?, ?, ?> source = new Hfs( new TextLine(), inputFile );
Fields fields = new Fields( new Comparable[]{"num", "lwr", "upr"}, new Type[]{int.class, String.class,
String.class} );
Pipe parsePipe = new Each( "insert", new Fields( "line" ), new RegexSplitter( fields, "\\s" ) );
String[] columnNames = {"num", "lwr", "upr"};
String[] columnDefs = {"INT NOT NULL", "VARCHAR(100) NOT NULL", "VARCHAR(100) NOT NULL"};
String[] primaryKeys = {"num", "lwr"};
TableDesc tableDesc = getNewTableDesc( TESTING_TABLE_NAME, columnNames, columnDefs, primaryKeys );
JDBCScheme scheme = getNewJDBCScheme( fields, columnNames );
JDBCTap replaceTap = getNewJDBCTap( tableDesc, scheme, SinkMode.REPLACE );
// forcing commits to test the batch behaviour
replaceTap.setBatchSize( 2 );
Flow<?> parseFlow = new HadoopFlowConnector( createProperties() ).connect( source, replaceTap, parsePipe );
parseFlow.complete();
verifySink( parseFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE
Tap<?, ?, ?> sink = new Hfs( new TextLine(), "build/test/jdbc", SinkMode.REPLACE );
Pipe copyPipe = new Each( "read", new Identity() );
Flow<?> copyFlow = new HadoopFlowConnector( createProperties() ).connect( replaceTap, sink, copyPipe );
copyFlow.complete();
verifySink( copyFlow, 13 );
// READ DATA FROM TEXT FILE AND UPDATE TABLE
JDBCScheme jdbcScheme = getNewJDBCScheme( columnNames, null, new String[]{"num", "lwr"} );
jdbcScheme.setSinkFields( fields );
Tap<?, ?, ?> updateTap = getNewJDBCTap( tableDesc, jdbcScheme, SinkMode.UPDATE );
Flow<?> updateFlow = new HadoopFlowConnector( createProperties() ).connect( sink, updateTap, parsePipe );
updateFlow.complete();
updateFlow.cleanup();
verifySink( updateFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE, USING CUSTOM QUERY
Tap<?, ?, ?> sourceTap = getNewJDBCTap( getNewJDBCScheme( columnNames,
String.format( "select num, lwr, upr from %s %s", TESTING_TABLE_NAME, TESTING_TABLE_NAME), "select count(*) from " + TESTING_TABLE_NAME ) );
Pipe readPipe = new Each( "read", new Identity() );
Flow<?> readFlow = new HadoopFlowConnector( createProperties() ).connect( sourceTap, sink, readPipe );
readFlow.complete();
verifySink( readFlow, 13 );
}
@Test
public void testJDBCAliased() throws IOException
{
// CREATE NEW TABLE FROM SOURCE
Tap<?, ?, ?> source = new Hfs( new TextLine(), inputFile );
Fields fields = new Fields( new Comparable[]{"num", "lwr", "upr"}, new Type[]{int.class, String.class,
String.class} );
Pipe parsePipe = new Each( "insert", new Fields( "line" ), new RegexSplitter( fields, "\\s" ) );
String tableAlias = TESTING_TABLE_NAME + "alias";
String[] columnNames = {"num", "lwr", "upr"};
String[] columnDefs = {"INT NOT NULL", "VARCHAR(100) NOT NULL", "VARCHAR(100) NOT NULL"};
String[] primaryKeys = {"num", "lwr"};
TableDesc tableDesc = getNewTableDesc( tableAlias, columnNames, columnDefs, primaryKeys );
Tap<?, ?, ?> replaceTap = getNewJDBCTap( tableDesc, getNewJDBCScheme( fields, columnNames ), SinkMode.REPLACE );
Flow<?> parseFlow = new HadoopFlowConnector( createProperties() ).connect( source, replaceTap, parsePipe );
parseFlow.complete();
verifySink( parseFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE
Tap<?, ?, ?> sink = new Hfs( new TextLine(), "build/test/jdbc", SinkMode.REPLACE );
Pipe copyPipe = new Each( "read", new Identity() );
Flow<?> copyFlow = new HadoopFlowConnector( createProperties() ).connect( replaceTap, sink, copyPipe );
copyFlow.complete();
verifySink( copyFlow, 13 );
// READ DATA FROM TEXT FILE AND UPDATE TABLE
JDBCScheme jdbcScheme = getNewJDBCScheme( columnNames, null, new String[]{"num", "lwr"} );
jdbcScheme.setSinkFields( fields );
Tap<?, ?, ?> updateTap = getNewJDBCTap( tableDesc, jdbcScheme, SinkMode.UPDATE );
Flow<?> updateFlow = new HadoopFlowConnector( createProperties() ).connect( sink, updateTap, parsePipe );
updateFlow.complete();
verifySink( updateFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE, USING CUSTOM QUERY
Tap<?, ?, ?> sourceTap = getNewJDBCTap( getNewJDBCScheme( columnNames,
String.format( "select num, lwr, upr from %s %s", tableAlias, TESTING_TABLE_NAME), "select count(*) from " + tableAlias ) );
Pipe readPipe = new Each( "read", new Identity() );
Flow<?> readFlow = new HadoopFlowConnector( createProperties() ).connect( sourceTap, sink, readPipe );
readFlow.complete();
verifySink( readFlow, 13 );
// CREATE NEW TABLE FROM SOURCE
}
@Test
public void testJDBCWithFactory() throws IOException
{
// CREATE NEW TABLE FROM SOURCE
Tap<?, ?, ?> source = new Hfs( new TextLine(), inputFile );
Fields columnFields = new Fields( new Comparable[]{"num", "lwr", "upr"}, new Type[]{int.class, String.class,
String.class} );
Pipe parsePipe = new Each( "insert", new Fields( "line" ), new RegexSplitter( columnFields, "\\s" ) );
Properties tapProperties = new Properties();
tapProperties.setProperty( JDBCFactory.PROTOCOL_COLUMN_DEFS, "int not null:varchar(100) not null: varchar(100) not null" );
tapProperties.setProperty( JDBCFactory.PROTOCOL_COLUMN_NAMES, "num:lwr:upr" );
tapProperties.setProperty( JDBCFactory.PROTOCOL_PRIMARY_KEYS, "num:lwr" );
tapProperties.setProperty( JDBCFactory.PROTOCOL_TABLE_NAME, TESTING_TABLE_NAME );
tapProperties.setProperty( JDBCFactory.PROTOCOL_JDBC_DRIVER, driverName );
tapProperties.setProperty( JDBCFactory.PROTOCOL_TABLE_EXISTS_QUERY, getTableExistsQuery() );
String[] columnNames = new String[]{"num", "lwr", "upr"};
Properties schemeProperties = new Properties();
schemeProperties.setProperty( JDBCFactory.FORMAT_COLUMNS, StringUtils.join( columnNames, ":" ) );
JDBCScheme scheme = (JDBCScheme) factory.createScheme( "somename", columnFields, schemeProperties );
Tap<?, ?, ?> replaceTap = factory.createTap( "jdbc", scheme, jdbcurl, SinkMode.REPLACE, tapProperties );
Flow<?> parseFlow = new HadoopFlowConnector( createProperties() ).connect( source, replaceTap, parsePipe );
parseFlow.complete();
verifySink( parseFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE
Tap<?, ?, ?> sink = new Hfs( new TextLine(), "build/test/jdbc", SinkMode.REPLACE );
Pipe copyPipe = new Each( "read", new Identity() );
Flow<?> copyFlow = new HadoopFlowConnector( createProperties() ).connect( replaceTap, sink, copyPipe );
copyFlow.complete();
verifySink( copyFlow, 13 );
// READ DATA FROM TEXT FILE AND UPDATE TABLE
schemeProperties.put( JDBCFactory.FORMAT_UPDATE_BY, "num:lwr" );
JDBCScheme updateScheme = (JDBCScheme) factory.createScheme( "somename", columnFields, schemeProperties );
Tap<?, ?, ?> updateTap = factory.createTap( "jdbc", updateScheme, jdbcurl, getSinkModeForReset(), tapProperties );
Flow<?> updateFlow = new HadoopFlowConnector( createProperties() ).connect( sink, updateTap, parsePipe );
updateFlow.complete();
verifySink( updateFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE, USING CUSTOM QUERY
schemeProperties.remove( JDBCFactory.FORMAT_UPDATE_BY );
JDBCScheme sourceScheme = (JDBCScheme) factory.createScheme( "somename", columnFields, schemeProperties );
Tap<?, ?, ?> sourceTap = factory.createTap( "jdbc", sourceScheme, jdbcurl, SinkMode.KEEP, tapProperties );
Pipe readPipe = new Each( "read", new Identity() );
Flow<?> readFlow = new HadoopFlowConnector( createProperties() ).connect( sourceTap, sink, readPipe );
readFlow.complete();
verifySink( readFlow, 13 );
}
@Test
public void testJDBCWithFactoryMissingTypes() throws IOException
{
// CREATE NEW TABLE FROM SOURCE
Tap<?, ?, ?> source = new Hfs( new TextLine(), inputFile );
Fields columnFields = new Fields( new Comparable[]{"num", "lwr", "upr"}, new Type[]{int.class, String.class,
String.class} );
Pipe parsePipe = new Each( "insert", new Fields( "line" ), new RegexSplitter( columnFields, "\\s" ) );
Properties tapProperties = new Properties();
tapProperties.setProperty( JDBCFactory.PROTOCOL_TABLE_NAME, TESTING_TABLE_NAME );
tapProperties.setProperty( JDBCFactory.PROTOCOL_JDBC_DRIVER, driverName );
tapProperties.setProperty( JDBCFactory.PROTOCOL_TABLE_EXISTS_QUERY, getTableExistsQuery() );
Properties schemeProperties = new Properties();
JDBCScheme scheme = (JDBCScheme) factory.createScheme( "somename", columnFields, schemeProperties );
Tap<?, ?, ?> replaceTap = factory.createTap( "jdbc", scheme, jdbcurl, SinkMode.REPLACE, tapProperties );
Flow<?> parseFlow = new HadoopFlowConnector( createProperties() ).connect( source, replaceTap, parsePipe );
parseFlow.complete();
verifySink( parseFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE
Tap<?, ?, ?> sink = new Hfs( new TextLine(), "build/test/jdbc", SinkMode.REPLACE );
Pipe copyPipe = new Each( "read", new Identity() );
Flow<?> copyFlow = new HadoopFlowConnector( createProperties() ).connect( replaceTap, sink, copyPipe );
copyFlow.complete();
verifySink( copyFlow, 13 );
// READ DATA FROM TEXT FILE AND UPDATE TABLE
schemeProperties.put( JDBCFactory.FORMAT_UPDATE_BY, "num:lwr" );
JDBCScheme updateScheme = (JDBCScheme) factory.createScheme( "somename", columnFields, schemeProperties );
Tap<?, ?, ?> updateTap = factory.createTap( "jdbc", updateScheme, jdbcurl, getSinkModeForReset(), tapProperties );
Flow<?> updateFlow = new HadoopFlowConnector( createProperties() ).connect( sink, updateTap, parsePipe );
updateFlow.complete();
verifySink( updateFlow, 13 );
// READ DATA FROM TABLE INTO TEXT FILE, USING CUSTOM QUERY
schemeProperties.remove( JDBCFactory.FORMAT_UPDATE_BY );
JDBCScheme sourceScheme = (JDBCScheme) factory.createScheme( "somename", columnFields, schemeProperties );
Tap<?, ?, ?> sourceTap = factory.createTap( "jdbc", sourceScheme, jdbcurl, SinkMode.KEEP, tapProperties );
Pipe readPipe = new Each( "read", new Identity() );
Flow<?> readFlow = new HadoopFlowConnector( createProperties() ).connect( sourceTap, sink, readPipe );
readFlow.complete();
verifySink( readFlow, 13 );
}
private void verifySink( Flow<?> flow, int expects ) throws IOException
{
int count = 0;
TupleEntryIterator iterator = flow.openSink();
while( iterator.hasNext() )
{
count++;
iterator.next();
}
iterator.close();
assertEquals( "wrong number of values", expects, count );
}
protected JDBCScheme getNewJDBCScheme( Fields fields, String[] columnNames )
{
return new JDBCScheme( inputFormatClass, fields, columnNames );
}
protected JDBCScheme getNewJDBCScheme( String[] columns, String[] orderBy, String[] updateBy )
{
return new JDBCScheme( columns, orderBy, updateBy );
}
protected JDBCScheme getNewJDBCScheme( String[] columnsNames, String contentsQuery, String countStarQuery )
{
return new JDBCScheme( columnsNames, contentsQuery, countStarQuery );
}
protected TableDesc getNewTableDesc( String tableName, String[] columnNames, String[] columnDefs, String[] primaryKeys )
{
return new TableDesc( tableName, columnNames, columnDefs, primaryKeys, getTableExistsQuery() );
}
protected JDBCTap getNewJDBCTap( TableDesc tableDesc, JDBCScheme jdbcScheme, SinkMode sinkMode )
{
return new JDBCTap( jdbcurl, driverName, tableDesc, jdbcScheme, sinkMode );
}
protected JDBCTap getNewJDBCTap( JDBCScheme jdbcScheme )
{
return new JDBCTap( jdbcurl, driverName, jdbcScheme );
}
/**
* SinkMode.UPDATE is not intended for production use so allow data sources that have different semantics for data
* swapping to override this.
*/
protected SinkMode getSinkModeForReset() {
return SinkMode.UPDATE;
}
protected Properties createProperties()
{
Properties props = new Properties();
props.put( "mapred.reduce.tasks.speculative.execution", "false" );
props.put( "mapred.map.tasks.speculative.execution", "false" );
AppProps.setApplicationJarClass( props, getClass() );
LOG.info( "running with properties {}", props);
return props;
}
public String getTableExistsQuery() {
Enumeration<URL> resources = null;
try
{
resources = this.getClass().getClassLoader().getResources( ProviderDefinition.CASCADING_BIND_PROVIDER_PROPERTIES );
URL url = resources.nextElement();
LOG.debug( "loading properties from: {}", url );
InputStream inputStream = url.openStream();
Properties properties = new Properties();
properties.load( inputStream );
inputStream.close();
String tableExistsQuery = JDBCFactory.DEFAULT_TABLE_EXISTS_QUERY;
Set<String> keySet = properties.stringPropertyNames();
for (String keyName : keySet)
if (keyName.toString().endsWith( JDBCFactory.PROTOCOL_TABLE_EXISTS_QUERY ))
tableExistsQuery = properties.getProperty( keyName ) ;
return tableExistsQuery;
}
catch( IOException exception )
{
LOG.error( "unable to read {}. using default query", ProviderDefinition.CASCADING_BIND_PROVIDER_PROPERTIES, exception );
return JDBCFactory.DEFAULT_TABLE_EXISTS_QUERY;
}
}
public void setJdbcurl( String jdbcurl )
{
this.jdbcurl = jdbcurl;
}
public void setDriverName( String driverName )
{
this.driverName = driverName;
}
public void setJDBCFactory( JDBCFactory factory )
{
this.factory = factory;
}
public void setInputFormatClass( Class<? extends DBInputFormat<DBWritable>> inputFormatClass )
{
this.inputFormatClass = inputFormatClass;
}
public void setFactory( JDBCFactory factory )
{
this.factory = factory;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
d68f7066f86f0448ad22e3929050086ac51dd82c | 053acd645565b00e39cef72c994209f21d98aa4a | /springMVC_day02_04_interceptor/src/main/java/com/wang/controller/UserInterceptor.java | af66021559da3f19251327b8f5fdd688db0ff3f9 | [] | no_license | wangzhu-hongshi/MyProjectLibrary | 463e0414e459692ee94fb7b64bc45649d0e96381 | 8c0c8432bd17d0511ae2e21348b661d9c3131f8a | refs/heads/master | 2022-12-25T21:32:58.445856 | 2019-11-27T14:09:21 | 2019-11-27T14:09:21 | 224,441,335 | 0 | 0 | null | 2022-12-16T02:36:54 | 2019-11-27T13:50:02 | Java | UTF-8 | Java | false | false | 394 | java | package com.wang.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* 拦截器的类
*/
@Controller
@RequestMapping("/User")
public class UserInterceptor {
@RequestMapping("/interceptor")
public String interceptor(){
System.out.println("interceptor执行了");
return "success";
}
}
| [
"1094322722@qq.com"
] | 1094322722@qq.com |
2cad4a238923ae8d49493fea817a6ac10d41a2c7 | b491caded8b4b2b4240b844f52e5cc9de0db0c2d | /ted/src/main/java/fr/xgouchet/texteditor/TedAboutActivity.java | 3eb54aed6b728f1e20e345d9de5074094ab580ba | [] | no_license | JJertok/Ted-Editor | 235fe60edb743eb04bd94b33901f524f296fa8d4 | 160067fb9e4affa7c9633b72e05a19794fc6ea81 | refs/heads/master | 2021-01-15T12:54:55.702460 | 2016-11-09T20:26:35 | 2016-11-09T20:26:35 | 68,805,952 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 379 | java | package fr.xgouchet.texteditor;
import android.os.Bundle;
import fr.xgouchet.androidlib.ui.activity.AboutActivity;
public class TedAboutActivity extends AboutActivity {
/**
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_about);
}
}
| [
"zelios_work@outlook.com"
] | zelios_work@outlook.com |
6160d0e7d3e4031fdd2db1de59a0ce8911d8380a | 8dfbf64086eb858f0e572f27389dee7d034b149d | /app/build/generated/source/r/debug/android/support/graphics/drawable/R.java | a30724c9da186b4a8692ac1e4e9af302879c7eda | [] | no_license | pandeypiyush94/Have-ToDo | 14d12da45a8c29c6e0181a32bbd373ee172bf581 | 0210eb92efb3820d527acd6ec388068a8f9d62e2 | refs/heads/master | 2022-11-18T07:58:47.238128 | 2020-07-07T12:56:20 | 2020-07-07T12:56:20 | 277,814,257 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,621 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.graphics.drawable;
public final class R {
public static final class attr {
public static final int font = 0x7f0400a7;
public static final int fontProviderAuthority = 0x7f0400aa;
public static final int fontProviderCerts = 0x7f0400ab;
public static final int fontProviderFetchStrategy = 0x7f0400ac;
public static final int fontProviderFetchTimeout = 0x7f0400ad;
public static final int fontProviderPackage = 0x7f0400ae;
public static final int fontProviderQuery = 0x7f0400af;
public static final int fontStyle = 0x7f0400b0;
public static final int fontWeight = 0x7f0400b1;
}
public static final class bool {
public static final int abc_action_bar_embed_tabs = 0x7f050000;
}
public static final class color {
public static final int notification_action_color_filter = 0x7f060080;
public static final int notification_icon_bg_color = 0x7f060081;
public static final int ripple_material_light = 0x7f060095;
public static final int secondary_text_default_material_light = 0x7f060098;
}
public static final class dimen {
public static final int compat_button_inset_horizontal_material = 0x7f07004d;
public static final int compat_button_inset_vertical_material = 0x7f07004e;
public static final int compat_button_padding_horizontal_material = 0x7f07004f;
public static final int compat_button_padding_vertical_material = 0x7f070050;
public static final int compat_control_corner_material = 0x7f070051;
public static final int notification_action_icon_size = 0x7f0700b4;
public static final int notification_action_text_size = 0x7f0700b5;
public static final int notification_big_circle_margin = 0x7f0700b6;
public static final int notification_content_margin_start = 0x7f0700b7;
public static final int notification_large_icon_height = 0x7f0700b8;
public static final int notification_large_icon_width = 0x7f0700b9;
public static final int notification_main_column_padding_top = 0x7f0700ba;
public static final int notification_media_narrow_margin = 0x7f0700bb;
public static final int notification_right_icon_size = 0x7f0700bc;
public static final int notification_right_side_padding_top = 0x7f0700bd;
public static final int notification_small_icon_background_padding = 0x7f0700be;
public static final int notification_small_icon_size_as_large = 0x7f0700bf;
public static final int notification_subtext_size = 0x7f0700c0;
public static final int notification_top_pad = 0x7f0700c1;
public static final int notification_top_pad_large_text = 0x7f0700c2;
}
public static final class drawable {
public static final int notification_action_background = 0x7f080081;
public static final int notification_bg = 0x7f080082;
public static final int notification_bg_low = 0x7f080083;
public static final int notification_bg_low_normal = 0x7f080084;
public static final int notification_bg_low_pressed = 0x7f080085;
public static final int notification_bg_normal = 0x7f080086;
public static final int notification_bg_normal_pressed = 0x7f080087;
public static final int notification_icon_background = 0x7f080088;
public static final int notification_template_icon_bg = 0x7f080089;
public static final int notification_template_icon_low_bg = 0x7f08008a;
public static final int notification_tile_bg = 0x7f08008b;
public static final int notify_panel_notification_icon_bg = 0x7f08008d;
}
public static final class id {
public static final int action_container = 0x7f09000f;
public static final int action_divider = 0x7f090012;
public static final int action_image = 0x7f090013;
public static final int action_text = 0x7f09001a;
public static final int actions = 0x7f09001b;
public static final int async = 0x7f09002f;
public static final int blocking = 0x7f090034;
public static final int chronometer = 0x7f090042;
public static final int forever = 0x7f090073;
public static final int icon = 0x7f090079;
public static final int icon_group = 0x7f09007a;
public static final int info = 0x7f090082;
public static final int italic = 0x7f090083;
public static final int line1 = 0x7f090088;
public static final int line3 = 0x7f090089;
public static final int normal = 0x7f09009b;
public static final int notification_background = 0x7f09009c;
public static final int notification_main_column = 0x7f09009d;
public static final int notification_main_column_container = 0x7f09009e;
public static final int right_icon = 0x7f0900ac;
public static final int right_side = 0x7f0900ad;
public static final int text = 0x7f0900dc;
public static final int text2 = 0x7f0900dd;
public static final int time = 0x7f0900e4;
public static final int title = 0x7f0900ea;
}
public static final class integer {
public static final int status_bar_notification_info_maxnum = 0x7f0a0009;
}
public static final class layout {
public static final int notification_action = 0x7f0b003b;
public static final int notification_action_tombstone = 0x7f0b003c;
public static final int notification_template_custom_big = 0x7f0b0043;
public static final int notification_template_icon_group = 0x7f0b0044;
public static final int notification_template_part_chronometer = 0x7f0b0048;
public static final int notification_template_part_time = 0x7f0b0049;
}
public static final class string {
public static final int status_bar_notification_info_overflow = 0x7f0e005d;
}
public static final class style {
public static final int TextAppearance_Compat_Notification = 0x7f0f0112;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f0113;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0115;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0118;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f011a;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f0193;
public static final int Widget_Compat_NotificationActionText = 0x7f0f0194;
}
public static final class styleable {
public static final int[] FontFamily = { 0x7f0400aa, 0x7f0400ab, 0x7f0400ac, 0x7f0400ad, 0x7f0400ae, 0x7f0400af };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x7f0400a7, 0x7f0400b0, 0x7f0400b1 };
public static final int FontFamilyFont_font = 0;
public static final int FontFamilyFont_fontStyle = 1;
public static final int FontFamilyFont_fontWeight = 2;
}
}
| [
"piyu.pandey794@rediffmail.com"
] | piyu.pandey794@rediffmail.com |
6616560833643c62bc683b13c1bc92bebd1588f8 | 47d74f476c37be7e6e5a75d3f2d07147246833ad | /WissPlayStore/src/games/moorhuhn/views/Hitmarker.java | 77415c7c8f117eeea2190ec8d9d12366a4f1dd72 | [] | no_license | CoffeeAndCodeSwitzerland/WISSPlayStore | 08cdde8f6b296772991e0af9ee5a46c6a995a883 | 77cae3ed0b80d52649f4bf530f5c885b03515fac | refs/heads/master | 2020-03-19T14:07:15.484145 | 2018-07-10T14:31:20 | 2018-07-10T14:31:20 | 136,609,506 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,290 | java | package games.moorhuhn.views;
import games.moorhuhn.controllers.Moorhuhn;
import processing.core.PApplet;
/**
* Diese Klasse bestimmt die Zeit für welche der Hitmarker angezeigt werden soll und stellt diesen dar.
* V1.0 / 20.04.2018
* @author Patrick Bauersfeld
*
*/
public class Hitmarker {
PApplet parent;
int xPos = 0;
int yPos = 0;
int scale = 50;
int myWidth = scale;
int myHeight = scale;
int counterHitmarker;
public int useHitmarker = 0;
Moorhuhn moorhuhn;
public Hitmarker(PApplet p){
parent = p;
}
void myDraw()
{
if (counterHitmarker < 10)
{
parent.image(Moorhuhn.getMyImage().imgWhiteHitmarker, xPos, yPos, myWidth, myHeight);
}
}
public void showHitmarker()
{
if (useHitmarker > 0)
{
useHitmarker++;
setPos();
myDraw();
counterHitmarker++;
delHitmarker();
}
}
void setPos()
{
if (useHitmarker < 3)
{
xPos = parent.mouseX-35;
yPos = parent.mouseY-35;
//Spielt Ton ab
//moorhuhn.music.playSound("sndHitmarker");
}
}
void delHitmarker()
{
if (counterHitmarker > 10)
{
useHitmarker = 0;
counterHitmarker = 0;
//Setzt Ton zurück
}
}
}
| [
"35994864+Lenny5156@users.noreply.github.com"
] | 35994864+Lenny5156@users.noreply.github.com |
1fffc502039c83143285807df46aaa9761f16fd0 | be5e148c938608449c1e64cbea348a462a8ddb7e | /src/test/java/net/stolsvik/etools/TailTrampolineTest.java | e058ba6f7243847c33244f0580988886f3f17540 | [] | no_license | stolsvik/etools | 1a8d44174ad6a3001cf4d8e1c92ae3b5031c15c3 | e1714497d8e4cd388892759ddd07bac4c287aa8b | refs/heads/master | 2021-01-23T21:49:07.951547 | 2017-09-08T22:15:14 | 2017-09-09T23:22:03 | 102,908,897 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,961 | java | package net.stolsvik.etools;
import org.junit.Assert;
import org.junit.Test;
/**
* Tests the {@link TailTrampoline} class.
*
* @author Endre Stølsvik, 2017-09-08 23:00 - http://endre.stolsvik.com/
*/
public class TailTrampolineTest {
@Test
public void testTriangular() {
Assert.assertEquals(triangular(0), computeTriangular(0).compute(), 0);
Assert.assertEquals(triangular(1), computeTriangular(1).compute(), 0);
Assert.assertEquals(triangular(2), computeTriangular(2).compute(), 0);
Assert.assertEquals(triangular(3), computeTriangular(3).compute(), 0);
Assert.assertEquals(triangular(4), computeTriangular(4).compute(), 0);
Assert.assertEquals(triangular(500), computeTriangular(500).compute(), 0);
Assert.assertEquals(triangular(10000), computeTriangular(10000).compute(), 0);
Assert.assertEquals(triangular(2539071), computeTriangular(2539071).compute(), 0);
}
private static long triangular(long n) {
return n*(n+1)/2;
}
@Test
public void testFactorial() {
Assert.assertEquals(1d, computeFactorial(0).compute(), 0);
Assert.assertEquals(1d, computeFactorial(1).compute(), 0);
Assert.assertEquals(40320d, computeFactorial(8).compute(), 0);
Assert.assertEquals(9.33262154439441e157, computeFactorial(100).compute(), 0);
}
@Test
public void testFibonacci() {
Assert.assertEquals(0, computeFibonacci(0).compute().a);
Assert.assertEquals(1, computeFibonacci(1).compute().a);
Assert.assertEquals(1, computeFibonacci(2).compute().a);
Assert.assertEquals(2, computeFibonacci(3).compute().a);
Assert.assertEquals(8665637060948656192L, computeFibonacci(1200).compute().a);
}
@Test
public void testPalindrome() {
Assert.assertEquals(true, isPalindrome("").compute());
Assert.assertEquals(true, isPalindrome("x").compute());
Assert.assertEquals(true, isPalindrome("xx").compute());
Assert.assertEquals(true, isPalindrome("xax").compute());
Assert.assertEquals(true, isPalindrome("testset").compute());
Assert.assertEquals(true, isPalindrome("amanaplanacanalpanama").compute());
Assert.assertEquals(false, isPalindrome("xaf").compute());
Assert.assertEquals(false, isPalindrome("amanaplanacanalpanamx").compute());
Assert.assertEquals(false, isPalindrome("amanaplanacxnalpanama").compute());
Assert.assertEquals(false, isPalindrome("amanaplanacxanalpanama").compute());
}
static TailTrampoline<Long> computeTriangular(long n) {
if (n == 0) {
return TailTrampoline.stop(0L);
}
return TailTrampoline.recurse(n, (in, parent) -> in + parent, (in) -> computeTriangular(in - 1));
}
static TailTrampoline<Double> computeFactorial(long n) {
if (n == 0) {
return TailTrampoline.stop(1d);
}
return TailTrampoline.recurse(n, (in, parent) -> in * parent, (in) -> computeFactorial(in - 1));
}
static TailTrampoline<FibState> computeFibonacci(int n) {
if (n == 0) {
return TailTrampoline.stop(new FibState(0L, 1L));
}
return TailTrampoline.recurse(n,
(in, parentFib) -> new FibState(parentFib.b, parentFib.a + parentFib.b),
(in) -> computeFibonacci(in - 1));
}
static TailTrampoline<Boolean> isPalindrome(String s) {
if (s.length() <= 1) {
return TailTrampoline.stop(true);
}
if (s.charAt(0) != s.charAt(s.length()-1)) {
return TailTrampoline.stop(false);
}
return TailTrampoline.recurse(s, (in, parent) -> parent, (in) -> isPalindrome(in.substring(1, in.length() - 1)));
}
private static class FibState {
long a;
long b;
public FibState(long a, long b) {
this.a = a;
this.b = b;
}
}
}
| [
"endre@stolsvik.com"
] | endre@stolsvik.com |
1dadb4c9f7e677cc8633b388c3de3befead08b93 | 9da8610126efeea968854f04d7df0788eadcf8e8 | /afm-ear-ejb/src/main/java/is/ejb/bl/business/OfferCurrency.java | 397f54b6fe65b183f8d2f7709e08546021a96c77 | [] | no_license | NTRsolutions/AppsFarm | 6bc2cdc83ea277dc71f7c11ece10ebd3e44195dd | 6a4fa0a9550620cc826970596d237869ae76e5dd | refs/heads/master | 2020-03-28T19:16:32.482775 | 2017-11-28T08:59:08 | 2017-11-28T08:59:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package is.ejb.bl.business;
public enum OfferCurrency {
USD, KSH, INR, ZAR, GBP, ;
}
| [
"mariusz.jacyno@gmail.com"
] | mariusz.jacyno@gmail.com |
ee31a4eddd5cda397e4a9e82813f96bd209ce083 | 30fb57d45aa33af600898998f30924185ea21872 | /src/main/java/it/unimi/dsi/fastutil/floats/FloatBigList.java | 1b1993eb5bf21128a9ea320fbae165e204cf6534 | [
"Apache-2.0"
] | permissive | mrfsong363/fastutil | 7fb632c577360a44d9787feaf2bcfc6617287770 | 4609803e953926e0670e59335a75624f74388e2a | refs/heads/master | 2021-09-24T08:14:41.094887 | 2018-10-05T14:34:55 | 2018-10-05T14:35:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,624 | java |
/*
* Copyright (C) 2010-2017 Sebastiano Vigna
*
* 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 it.unimi.dsi.fastutil.floats;
import it.unimi.dsi.fastutil.BigList;
import it.unimi.dsi.fastutil.Size64;
import java.util.List;
/** A type-specific {@link BigList}; provides some additional methods that use polymorphism to avoid (un)boxing.
*
* <p>Additionally, this interface strengthens {@link #iterator()}, {@link #listIterator()},
* {@link #listIterator(long)} and {@link #subList(long,long)}.
*
* <p>Besides polymorphic methods, this interfaces specifies methods to copy into an array or remove contiguous
* sublists. Although the abstract implementation of this interface provides simple, one-by-one implementations
* of these methods, it is expected that concrete implementation override them with optimized versions.
*
* @see List
*/
public interface FloatBigList extends BigList<Float>, FloatCollection , Size64, Comparable<BigList<? extends Float>> {
/** Returns a type-specific iterator on the elements of this list.
*
* <p>Note that this specification strengthens the one given in {@link java.util.Collection#iterator()}.
* @see java.util.Collection#iterator()
*/
@Override
FloatBigListIterator iterator();
/** Returns a type-specific big-list iterator on this type-specific big list.
*
* <p>Note that this specification strengthens the one given in {@link BigList#listIterator()}.
* @see BigList#listIterator()
*/
@Override
FloatBigListIterator listIterator();
/** Returns a type-specific list iterator on this type-specific big list starting at a given index.
*
* <p>Note that this specification strengthens the one given in {@link BigList#listIterator(long)}.
* @see BigList#listIterator(long)
*/
@Override
FloatBigListIterator listIterator(long index);
/** Returns a type-specific view of the portion of this type-specific big list from the index {@code from}, inclusive, to the index {@code to}, exclusive.
*
* <p>Note that this specification strengthens the one given in {@link BigList#subList(long,long)}.
*
* @see BigList#subList(long,long)
*/
@Override
FloatBigList subList(long from, long to);
/** Copies (hopefully quickly) elements of this type-specific big list into the given big array.
*
* @param from the start index (inclusive).
* @param a the destination big array.
* @param offset the offset into the destination big array where to store the first element copied.
* @param length the number of elements to be copied.
*/
void getElements(long from, float a[][], long offset, long length);
/** Removes (hopefully quickly) elements of this type-specific big list.
*
* @param from the start index (inclusive).
* @param to the end index (exclusive).
*/
void removeElements(long from, long to);
/** Add (hopefully quickly) elements to this type-specific big list.
*
* @param index the index at which to add elements.
* @param a the big array containing the elements.
*/
void addElements(long index, float a[][]);
/** Add (hopefully quickly) elements to this type-specific big list.
*
* @param index the index at which to add elements.
* @param a the big array containing the elements.
* @param offset the offset of the first element to add.
* @param length the number of elements to add.
*/
void addElements(long index, float a[][], long offset, long length);
/** Inserts the specified element at the specified position in this type-specific big list (optional operation).
* @see BigList#add(long,Object)
*/
void add(long index, float key);
/** Inserts all of the elements in the specified type-specific collection into this type-specific big list at the specified position (optional operation).
* @see List#addAll(int,java.util.Collection)
*/
boolean addAll(long index, FloatCollection c);
/** Inserts all of the elements in the specified type-specific big list into this type-specific big list at the specified position (optional operation).
* @see List#addAll(int,java.util.Collection)
*/
boolean addAll(long index, FloatBigList c);
/** Appends all of the elements in the specified type-specific big list to the end of this type-specific big list (optional operation).
* @see List#addAll(int,java.util.Collection)
*/
boolean addAll(FloatBigList c);
/** Returns the element at the specified position.
* @see BigList#get(long)
*/
float getFloat(long index);
/** Removes the element at the specified position.
* @see BigList#remove(long) */
float removeFloat(long index);
/** Replaces the element at the specified position in this big list with the specified element (optional operation).
* @see BigList#set(long,Object)
*/
float set(long index, float k);
/** Returns the index of the first occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.
* @see BigList#indexOf(Object)
*/
long indexOf(float k);
/** Returns the index of the last occurrence of the specified element in this type-specific big list, or -1 if this big list does not contain the element.
* @see BigList#lastIndexOf(Object)
*/
long lastIndexOf(float k);
/** {@inheritDoc}
* @deprecated Please use the corresponding type-specific method instead. */
@Deprecated
@Override
void add(long index, Float key);
/** {@inheritDoc}
* @deprecated Please use the corresponding type-specific method instead. */
@Deprecated
@Override
Float get(long index);
/** {@inheritDoc}
* @deprecated Please use the corresponding type-specific method instead. */
@Deprecated
@Override
long indexOf(Object o);
/** {@inheritDoc}
* @deprecated Please use the corresponding type-specific method instead. */
@Deprecated
@Override
long lastIndexOf(Object o);
/** {@inheritDoc}
* @deprecated Please use the corresponding type-specific method instead. */
@Deprecated
@Override
Float remove(long index);
/** {@inheritDoc}
* @deprecated Please use the corresponding type-specific method instead. */
@Deprecated
@Override
Float set(long index, Float k);
}
| [
"lysongfei@gmail.com"
] | lysongfei@gmail.com |
d39132dc86095982a3fa2fe4b7f813f889b5da97 | 9088b46cfbc3ac8fed72796d62350ac5adc72cd3 | /code/aihack/c_cubed/coevo/ActionSequencer.java | 67ad849f66b8898583c2ab3daf2c4395e8761df8 | [] | no_license | GAIGResearch/AIGD2 | 2b95b2f1a72f0dc8d16383ae254e64750717a409 | 0ce3630f31d4b6142a7d7e724d8ead70a43da6d5 | refs/heads/master | 2021-06-19T14:11:47.469864 | 2019-06-13T06:32:17 | 2019-06-13T06:32:17 | 131,163,461 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,453 | java | package c_cubed.coevo;
import ggi.core.AbstractGameState;
import ggi.core.SimplePlayerInterface;
import plot.NullPlayoutPlotter;
import plot.PlayoutPlotterInterface;
public class ActionSequencer {
public static void main(String[] args) {
// // fix a random seed to check repeatability
// Random random = new Random(3);
// GameState.random = random;
//
// GameState gameState = new GameState().defaultState();
// int[] seq = new int[]{0, 1, 2, 3, 4, 0, 1, 2, 2, 3, 4, 0, 1, 2, 1, 2, 3};
// System.out.println("Initial fitness: " + gameState.getScore());
// ActionSequencer actionSequencer = new ActionSequencer().setGameState(gameState).setPlayerId(0);
// double fitness = actionSequencer.fitness(seq);
// System.out.println("Final fitness: " + fitness);
}
AbstractGameState initialState, terminalState;
int playerId;
// double
PlayoutPlotterInterface playoutPlotter;
public ActionSequencer() {
// don't plot the playouts by default
playoutPlotter = new NullPlayoutPlotter();
}
public ActionSequencer setGameState(AbstractGameState gameState) {
// actually makes a copy of it to avoid modifying the original
this.initialState = gameState.copy();
return this;
}
public ActionSequencer setPlayerId(int playerId) {
this.playerId = playerId;
return this;
}
public ActionSequencer setOpponent(SimplePlayerInterface opponent) {
return this;
}
public ActionSequencer actVersusAgent(int[] seq, int playerId, int[] opSeq) {
// careful, this may not be copiing the game state ...
terminalState = initialState.copy();
playoutPlotter.startPlayout(terminalState.getScore());
int[] actions = new int[2];
for (int i = 0; i < seq.length; i++) {
actions[playerId] = seq[i];
actions[1 - playerId] = opSeq[i];
terminalState.next(actions);
playoutPlotter.addScore(terminalState.getScore());
}
// System.out.println("Terminal score: " + terminalState.getScore());
playoutPlotter.plotPlayout();
return this;
}
public double fitness(int[] solution, int[] opSolution) {
double rawScore = actVersusAgent(
solution, playerId, opSolution).terminalState.getScore();
return playerId == 0 ? rawScore : -rawScore;
}
}
| [
"diego@Diegos-MacBook-Air.local"
] | diego@Diegos-MacBook-Air.local |
0ba417a2e10d6611ab755fb4dfc3fece5bf7a3e2 | 1aaa5dae0f65d85eaa9f12d1adf3f521c2beb57f | /src/CodePractice/AnagramStringCompare.java | ddaf8ebd17ee4b0eef4d6488d89f8c229747af33 | [] | no_license | Kamal9380/Learning | 4fa58a3ed61927d4743eab668acc089e63d31077 | f8557168112c967ec7c9c12cc3ae67b7ace08adf | refs/heads/master | 2022-12-25T14:43:07.854350 | 2020-10-10T08:24:21 | 2020-10-10T08:24:21 | 291,425,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 752 | java | package CodePractice;
import java.util.Arrays;
public class AnagramStringCompare {
public static void main(String[] args) {
// TODO Auto-generated method stub
String s1="SILENT";
String s2="KIMBEL";
if(s1.length()==s2.length()){
char[] c1=s1.toCharArray();
Arrays.sort(c1);
System.out.println(c1);
char[] c2=s2.toCharArray();
Arrays.sort(c2);
System.out.println(c2);
if(Arrays.equals(c1, c2)){
System.out.println("Given two strings is Anagram");
}
else{
System.out.println("Given two strings are not Anagram");
}
}
}
}
| [
"kamalrajnov@gmail.com"
] | kamalrajnov@gmail.com |
f99c079d6686366d30f46764da62bc08273b9d25 | e27e606093db4c5c7bcac29193e34b3ff13b23c2 | /app/src/main/java/com/example/jaden/medicoapp/doctor/request/RequestFragment.java | 700bff71c53fe68b52eb84b233d31d7035a4b115 | [] | no_license | jxie215/MediCoApp | e27802eb28c84e7ed36a2f43f9e7d0f0bbff7936 | 4401a1a49a66aa9552e7c7fa79ac41bf00d60f8e | refs/heads/master | 2021-01-20T07:52:03.941273 | 2017-05-05T14:44:03 | 2017-05-05T14:44:03 | 90,056,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,100 | java | package com.example.jaden.medicoapp.doctor.request;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.jaden.medicoapp.R;
public class RequestFragment extends Fragment {
private View rootView;
private RecyclerView mRecyclerView;
public RequestFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
rootView = inflater.inflate(R.layout.fragment_request, container, false);
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.request_container);
mRecyclerView.setAdapter(new RequestAdapter(getContext()));
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
return rootView;
}
}
| [
"jaden@Jadens-MacBook-Pro.local"
] | jaden@Jadens-MacBook-Pro.local |
e0bc9ab4c03b70b5e73b321be1481f5cba33e940 | b55c1e4196221ea19d3091027cbe6b599d911648 | /hbase-server/src/main/java/org/apache/hadoop/hbase/procedure/ProcedureMember.java | 89760f9e6b2b14958676531d4149179a436627fe | [
"Apache-2.0",
"CPL-1.0",
"MPL-1.0"
] | permissive | wangbin83-gmail-com/hbase-0.98.6-cdh5.3.1-rong | dc3b18a893a59aa75df7e4269723c71825ccd3fc | 236648546ee847da2420c44c9a8d5040c2e45b40 | refs/heads/master | 2021-01-09T21:54:49.734109 | 2017-09-25T07:20:34 | 2017-09-25T07:20:34 | 50,658,326 | 0 | 1 | Apache-2.0 | 2023-03-20T11:47:20 | 2016-01-29T11:24:29 | Java | UTF-8 | Java | false | false | 9,277 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.procedure;
import java.io.Closeable;
import java.io.IOException;
import java.util.Collection;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hbase.DaemonThreadFactory;
import org.apache.hadoop.hbase.errorhandling.ForeignException;
import com.google.common.collect.MapMaker;
/**
* Process to kick off and manage a running {@link Subprocedure} on a member. This is the
* specialized part of a {@link Procedure} that actually does procedure type-specific work
* and reports back to the coordinator as it completes each phase.
* <p>
* If there is a connection error ({@link #controllerConnectionFailure(String, IOException)}), all
* currently running subprocedures are notify to failed since there is no longer a way to reach any
* other members or coordinators since the rpcs are down.
*/
@InterfaceAudience.Private
public class ProcedureMember implements Closeable {
private static final Log LOG = LogFactory.getLog(ProcedureMember.class);
final static long KEEP_ALIVE_MILLIS_DEFAULT = 5000;
private final SubprocedureFactory builder;
private final ProcedureMemberRpcs rpcs;
private final ConcurrentMap<String,Subprocedure> subprocs =
new MapMaker().concurrencyLevel(4).weakValues().makeMap();
private final ExecutorService pool;
/**
* Instantiate a new ProcedureMember. This is a slave that executes subprocedures.
*
* @param rpcs controller used to send notifications to the procedure coordinator
* @param pool thread pool to submit subprocedures
* @param factory class that creates instances of a subprocedure.
*/
public ProcedureMember(ProcedureMemberRpcs rpcs, ThreadPoolExecutor pool,
SubprocedureFactory factory) {
this.pool = pool;
this.rpcs = rpcs;
this.builder = factory;
}
/**
* Default thread pool for the procedure
*
* @param memberName
* @param procThreads the maximum number of threads to allow in the pool
*/
public static ThreadPoolExecutor defaultPool(String memberName, int procThreads) {
return defaultPool(memberName, procThreads, KEEP_ALIVE_MILLIS_DEFAULT);
}
/**
* Default thread pool for the procedure
*
* @param memberName
* @param procThreads the maximum number of threads to allow in the pool
* @param keepAliveMillis the maximum time (ms) that excess idle threads will wait for new tasks
*/
public static ThreadPoolExecutor defaultPool(String memberName, int procThreads,
long keepAliveMillis) {
return new ThreadPoolExecutor(1, procThreads, keepAliveMillis, TimeUnit.MILLISECONDS,
new SynchronousQueue<Runnable>(),
new DaemonThreadFactory("member: '" + memberName + "' subprocedure-pool"));
}
/**
* Package exposed. Not for public use.
*
* @return reference to the Procedure member's rpcs object
*/
ProcedureMemberRpcs getRpcs() {
return rpcs;
}
/**
* This is separated from execution so that we can detect and handle the case where the
* subprocedure is invalid and inactionable due to bad info (like DISABLED snapshot type being
* sent here)
* @param opName
* @param data
* @return subprocedure
*/
public Subprocedure createSubprocedure(String opName, byte[] data) {
return builder.buildSubprocedure(opName, data);
}
/**
* Submit an subprocedure for execution. This starts the local acquire phase.
* @param subproc the subprocedure to execute.
* @return <tt>true</tt> if the subprocedure was started correctly, <tt>false</tt> if it
* could not be started. In the latter case, the subprocedure holds a reference to
* the exception that caused the failure.
*/
public boolean submitSubprocedure(Subprocedure subproc) {
// if the submitted subprocedure was null, bail.
if (subproc == null) {
LOG.warn("Submitted null subprocedure, nothing to run here.");
return false;
}
String procName = subproc.getName();
if (procName == null || procName.length() == 0) {
LOG.error("Subproc name cannot be null or the empty string");
return false;
}
// make sure we aren't already running an subprocedure of that name
Subprocedure rsub = subprocs.get(procName);
if (rsub != null) {
if (!rsub.isComplete()) {
LOG.error("Subproc '" + procName + "' is already running. Bailing out");
return false;
}
LOG.warn("A completed old subproc " + procName + " is still present, removing");
if (!subprocs.remove(procName, rsub)) {
LOG.error("Another thread has replaced existing subproc '" + procName + "'. Bailing out");
return false;
}
}
LOG.debug("Submitting new Subprocedure:" + procName);
// kick off the subprocedure
try {
if (subprocs.putIfAbsent(procName, subproc) == null) {
this.pool.submit(subproc);
return true;
} else {
LOG.error("Another thread has submitted subproc '" + procName + "'. Bailing out");
return false;
}
} catch (RejectedExecutionException e) {
subprocs.remove(procName, subproc);
// the thread pool is full and we can't run the subprocedure
String msg = "Subprocedure pool is full!";
subproc.cancel(msg, e.getCause());
}
LOG.error("Failed to start subprocedure '" + procName + "'");
return false;
}
/**
* Notification that procedure coordinator has reached the global barrier
* @param procName name of the subprocedure that should start running the in-barrier phase
*/
public void receivedReachedGlobalBarrier(String procName) {
Subprocedure subproc = subprocs.get(procName);
if (subproc == null) {
LOG.warn("Unexpected reached glabal barrier message for Sub-Procedure '" + procName + "'");
return;
}
subproc.receiveReachedGlobalBarrier();
}
/**
* Best effort attempt to close the threadpool via Thread.interrupt.
*/
@Override
public void close() throws IOException {
// have to use shutdown now to break any latch waiting
pool.shutdownNow();
}
/**
* Shutdown the threadpool, and wait for upto timeoutMs millis before bailing
* @param timeoutMs timeout limit in millis
* @return true if successfully, false if bailed due to timeout.
* @throws InterruptedException
*/
boolean closeAndWait(long timeoutMs) throws InterruptedException {
pool.shutdown();
return pool.awaitTermination(timeoutMs, TimeUnit.MILLISECONDS);
}
/**
* The connection to the rest of the procedure group (member and coordinator) has been
* broken/lost/failed. This should fail any interested subprocedure, but not attempt to notify
* other members since we cannot reach them anymore.
* @param message description of the error
* @param cause the actual cause of the failure
*
* TODO i'm tempted to just remove this code completely and treat it like any other abort.
* Implementation wise, if this happens it is a ZK failure which means the RS will abort.
*/
public void controllerConnectionFailure(final String message, final IOException cause) {
Collection<Subprocedure> toNotify = subprocs.values();
LOG.error(message, cause);
for (Subprocedure sub : toNotify) {
// TODO notify the elements, if they aren't null
sub.cancel(message, cause);
}
}
/**
* Send abort to the specified procedure
* @param procName name of the procedure to about
* @param ee exception information about the abort
*/
public void receiveAbortProcedure(String procName, ForeignException ee) {
LOG.debug("Request received to abort procedure " + procName, ee);
// if we know about the procedure, notify it
Subprocedure sub = subprocs.get(procName);
if (sub == null) {
LOG.info("Received abort on procedure with no local subprocedure " + procName +
", ignoring it.", ee);
return; // Procedure has already completed
}
String msg = "Propagating foreign exception to subprocedure " + sub.getName();
LOG.error(msg, ee);
sub.cancel(msg, ee);
}
}
| [
"wangbin@ipa.rong360.com"
] | wangbin@ipa.rong360.com |
de4ed84ef53c898f4f4880ff17d380346d5deff7 | 67b580772366f55e306b7c4d05258eec3db17ace | /src/main/java/com/gabyval/services/security/users/GBStaffService.java | de66dd5c13104ee92bd444aab262a25038d69d57 | [] | no_license | gustavoovalle470/GBReferenceBOs | ba4bcb673a2479c1d390de9e1ebd637c2347d32e | d471cfc4d1c8c177ba0db8dc1738950e21f59ff8 | refs/heads/master | 2022-12-21T11:47:36.425890 | 2020-07-01T00:32:19 | 2020-07-01T00:32:19 | 190,635,403 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.gabyval.services.security.users;
import com.gabyval.persistence.exception.GBPersistenceException;
import com.gabyval.referencesbo.GBSentencesRBOs;
import com.gabyval.referencesbo.security.users.GbStaff;
import com.gabyval.services.GabyvalService;
import java.io.Serializable;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
*
* @author OvalleGA
*/
@Service
@Transactional
public class GBStaffService extends GabyvalService{
@Override
public Object load(Serializable o_id) throws GBPersistenceException {
return (GbStaff) persistence.load(o_id, GbStaff.class);
}
@Override
public List<Object> getAll() throws GBPersistenceException {
return persistence.getAll(GBSentencesRBOs.GBSTAFF_FINDALL);
}
}
| [
"Gustavo.ovalle@iurUnisysCSPLATAM.onmicrosoft.com"
] | Gustavo.ovalle@iurUnisysCSPLATAM.onmicrosoft.com |
93c4686c5ce7820b03f0a39e02b4f894e71b6cce | ae2497903fbdffae78e5da3708befc5313382bf0 | /6380956/src/edu/uva/sc/oberon0/Evaluators/Boolean/Or.java | a67b80c16dedc96dcc875ce9bcf3f2cf2e6d38e1 | [] | no_license | tvdstorm/sea-of-oberon0 | 88cdf8ace2f039050d1a6879bd90962bd1326f42 | 1ad75a7aeb7367af5a9854b38584561a7df5f5d1 | refs/heads/master | 2021-01-10T18:38:25.532083 | 2011-03-06T22:07:55 | 2011-03-06T22:07:55 | 33,249,217 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 627 | java | package edu.uva.sc.oberon0.Evaluators.Boolean;
import edu.uva.sc.oberon0.Evaluators.IEvaluator;
import edu.uva.sc.oberon0.Evaluators.Structural.IScope;
public class Or implements IBool {
/**
*
*/
private static final long serialVersionUID = 1L;
private IBool arg1;
private IBool arg2;
@Override
public Boolean evaluate(IScope scope) {
return arg1.evaluate(scope) && arg2.evaluate(scope);
}
public Or(IEvaluator arg1, IEvaluator arg2) {
super();
this.arg1 = (IBool)arg1;
this.arg2 = (IBool)arg2;
}
public String toString(IScope scope){
return evaluate(scope).toString();
}
}
| [
"zhelyazkov.anton@085e46ef-660c-bccc-452f-9e56fe5268ae"
] | zhelyazkov.anton@085e46ef-660c-bccc-452f-9e56fe5268ae |
77424159df6e75b0687dcf7b36d89625754df2d8 | 1fc89c80068348031fdd012453d081bac68c85b0 | /CalculadoraDeHorasDeProjetos/src/main/java/br/com/rsi/business/rules/DataPatterns.java | dd7f572a25015c8e763976a68584e519c1d77acf | [] | no_license | Jose-R-Vieira/WorkspaceEstudosJava | e81858e295972928d3463f23390d5d5ee67966c9 | 7ba374eef760ba2c3ee3e8a69657a96f9adec5c1 | refs/heads/master | 2020-03-26T16:47:26.846023 | 2018-08-17T14:06:57 | 2018-08-17T14:06:57 | 145,123,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,687 | java | package br.com.rsi.business.rules;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class DataPatterns {
String symbols = ":\\/,\\.";
Pattern numberComponents = Pattern.compile("^[0-9]*$");
Pattern numberScreens = Pattern.compile("^[0-9]*$");
Pattern timeMapping1 = Pattern.compile("^[0-9]*$");
Pattern timeMapping2 = Pattern.compile("^[0-6]*$");
Pattern symbolExpression = Pattern.compile("^\\d*([" + symbols + "]?)\\d*$");
List<String> temporaryData = new ArrayList<String>();
List<Pattern> patterns = new ArrayList<Pattern>();
Matcher validate;
int[] returnRules = { 0, 0, 0 };
Matcher receivedSymbol = null;
String stringReceivedSymbol = null;
public DataPatterns() {
patterns.add(numberComponents);
patterns.add(numberScreens);
patterns.add(timeMapping1);
patterns.add(timeMapping2);
returnRules[0] = 0;
returnRules[1] = 0;
returnRules[2] = 0;
}
public int[] checkRules(List<String> data) {
temporaryData.add(data.get(0));
temporaryData.add(data.get(1));
receivedSymbol = symbolExpression.matcher(data.get(2));
if (receivedSymbol.matches()) {
stringReceivedSymbol = receivedSymbol.group(1);
String temporaryDataChar[] = data.get(2).split(stringReceivedSymbol);
temporaryData.add(temporaryDataChar[0]);
temporaryData.add(temporaryDataChar[1]);
}
int i = 0;
for (; i < patterns.size(); i++) {
validate = patterns.get(i).matcher(temporaryData.get(i));
if (validate.matches()&& i<returnRules.length) {
returnRules[i] = 1;
}else if (!validate.matches()){
returnRules[(i-1)] = 0;
}
}
return returnRules;
}
}
| [
"jose.rodrigues@rsinet.com.br"
] | jose.rodrigues@rsinet.com.br |
b5d822089b9de8a494c3dd8a4835f9dcf4a5abae | dc72291d817c3e61bd427b50eac9706c2b80b963 | /ConcurrencyLabAugust2017/src/lesson170830/SerialExecutor.java | 20278321670730e914fed7366220add86bfd6ec9 | [] | no_license | zstudent/ConcurrencyLabAug2017 | 7a5eee7d519ff2e2d740823f69c69d4a97977bec | 72c672dd7c8b31b1304173e261f5cad28967f256 | refs/heads/master | 2021-01-19T17:30:25.261856 | 2017-09-02T10:18:07 | 2017-09-02T10:18:07 | 101,063,220 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 668 | java | package lesson170830;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.concurrent.Executor;
public class SerialExecutor implements Executor {
final Queue<Runnable> tasks = new ArrayDeque<Runnable>();
final Executor executor;
Runnable active;
SerialExecutor(Executor executor) {
this.executor = executor;
}
@Override
public synchronized void execute(final Runnable r) {
tasks.offer(() -> {
try {
r.run();
} finally {
scheduleNext();
}
});
if (active == null) {
scheduleNext();
}
}
protected synchronized void scheduleNext() {
if ((active = tasks.poll()) != null) {
executor.execute(active);
}
}
} | [
"Zaal_Lyanov@epam.com"
] | Zaal_Lyanov@epam.com |
ace1ed8aea858336d1cf172fc11b7a90beb65d71 | 30b5f4451305f0603cabee3c3dbbd65fa8412085 | /src/ArrayManipulations.java | b180ea05752b04da8b197a0d3bdceb128a601eca | [] | no_license | shingaki/Java_8_Fundamentals | 56ce6ac418ddeced1257584c3d21e618a280fd3a | 4f69f1979ac2b5cedf2a8361bb262e283391d601 | refs/heads/master | 2018-07-03T11:52:22.699382 | 2018-05-31T18:14:56 | 2018-05-31T18:14:56 | 119,079,690 | 0 | 0 | null | 2018-05-31T18:14:57 | 2018-01-26T17:07:07 | Java | UTF-8 | Java | false | false | 2,197 | java | // Fig. 7.22: ArrayManipulations.java
// Arrays class methods and System.arraycopy.
import java.util.Arrays;
public class ArrayManipulations
{
public static void main(String[] args) {
// sort doubleArray into ascending order
double[] doubleArray = {8.4, 9.3, 0.2, 7.9, 3.4};
Arrays.sort(doubleArray);
System.out.printf("%ndoubleArray: ");
for (double value : doubleArray)
System.out.printf("%.1f ", value);
// fill 10-element array with 7s
int[] filledIntArray = new int[10];
Arrays.fill(filledIntArray, 7);
displayArray(filledIntArray, "filledIntArray");
// copy Array intArray into array intArrayCopy'
int[] intArray = {1, 2, 3, 4, 5, 6};
int[] intArrayCopy = new int[intArray.length];
System.arraycopy(intArray, 0, intArrayCopy, 0, intArray.length);
displayArray(intArray, "intArray");
displayArray(intArrayCopy, "intArrayCopy");
// compare intArray and intArrayCopy for equality
boolean b = Arrays.equals(intArray, intArrayCopy);
System.out.printf("%n%nintArray %s intArrayCopy%n",
(b ? "==" : "!="));
// compare intArray and filledIntArray for equality
b = Arrays.equals(intArray, filledIntArray);
System.out.printf("intArray %s filledIntArray%n",
(b ? "==" : "!="));
// search intArray for the value 5
int location = Arrays.binarySearch(intArray, 5);
if (location >= 0)
System.out.printf(
"Found 5 at element %d in intArray%n", location);
else
System.out.println("5 not found in intArray");
// search intArray for the value 8763
location = Arrays.binarySearch(intArray, 8763);
if (location >= 0)
System.out.printf(
"Found 8763 at element %d in intArray%n", location);
else
System.out.println("8763 not found in intArray");
}
// output values in each array
public static void displayArray(int[] array, String description)
{
System.out.printf("%n%s: ", description);
for (int value : array)
System.out.printf("%d ", value);
}
} // end class ArrayManipulation
| [
"tamami_polk@hotmail.com"
] | tamami_polk@hotmail.com |
c89fc31515c86b8c64ad0c61e05a081e9c387f75 | 119c7f78292ed6830e6076543c3aef556b8f13a5 | /pinyougou/pinyougou-pojo/src/main/java/com/pinyougou/pojo/TbAreas.java | 2d39dac6a9bee1f7090bead96403781619196033 | [] | no_license | tianzhen45/pinyougou_shizhan | c68839cbcb4cdd472be0cf88cfd9644a0d82916c | 380c759c6b8b0b15740e4c037f0ded615c16f2f8 | refs/heads/master | 2022-12-23T00:07:47.987190 | 2019-09-29T04:52:05 | 2019-09-29T04:52:05 | 221,681,138 | 0 | 0 | null | 2022-12-16T04:25:42 | 2019-11-14T11:25:02 | JavaScript | UTF-8 | Java | false | false | 1,027 | java | package com.pinyougou.pojo;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
@Table(name = "tb_areas")
public class TbAreas implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
private String areaId;
private String area;
private String cityId;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getAreaId() {
return areaId;
}
public void setAreaId(String areaId) {
this.areaId = areaId;
}
public String getCityId() {
return cityId;
}
public void setCityId(String cityId) {
this.cityId = cityId;
}
public String getArea() {
return area;
}
public void setArea(String area) {
this.area = area;
}
}
| [
"18703680763@163.com"
] | 18703680763@163.com |
b74a6724c85af0ff854eeb5a5766e97650f3c565 | 88aa02a2a58075151451cee607988def0822cbf4 | /MusicParadise.comV3.5.3/ProgettoIS/src/Test_Bean/ProdottoOrdineBean_Test.java | b491a728043e585b703dd5a91b96ee87e062b033 | [] | no_license | alexderiso/MusicParadise.com | 1819c4757f77a24d26969769ff5186b41a2b4ee4 | 0cbc69d13b70b3bd07abd7609064b23e5e103af1 | refs/heads/master | 2021-09-06T05:21:04.537540 | 2018-02-02T17:35:55 | 2018-02-02T17:35:55 | 105,653,181 | 0 | 0 | null | null | null | null | ISO-8859-3 | Java | false | false | 3,250 | java | package Test_Bean;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import junit.framework.*;
import org.junit.Before;
import org.junit.Test;
import Bean.ProdottoOrdineBean;
import junit.framework.TestCase;
public class ProdottoOrdineBean_Test {
ProdottoOrdineBean prodotto;
@Before
public void setUp() {
try {
prodotto = new ProdottoOrdineBean();
prodotto.setCodice(001);
prodotto.setColore("Verde");
prodotto.setDescrizione("Microfono professionale");
prodotto.setMarca("Apple");
prodotto.setNome("Microfono Apple");
prodotto.setPeso(3);
prodotto.setPrezzo(300);
prodotto.setQuantità(300);
prodotto.setStrumento("Microfono");
}catch (Exception e) {
fail();
}
}
@Test
public void TestGetCodice() {
assertEquals(prodotto.getCodice(), 001);
}
@Test
public void TestSetCodice() {
prodotto.setCodice(003);
assertEquals(prodotto.getCodice(), 003);
}
@Test
public void TestGetNome() {
assertEquals(prodotto.getNome(), "Microfono Apple");
}
@Test
public void TestSetNome() {
prodotto.setNome("P45 B");
assertEquals(prodotto.getNome(), "P45 B");
}
@Test
public void TestGetColore() {
assertEquals(prodotto.getColore(), "Verde");
}
@Test
public void TestSetColore() {
prodotto.setColore("Rosso");
assertEquals(prodotto.getColore(), "Rosso");
}
@Test
public void TestGetMarca() {
assertEquals(prodotto.getMarca(), "Apple");
}
@Test
public void TestSetMarca() {
prodotto.setMarca("Yamaaha");
assertEquals(prodotto.getMarca(), "Yamaaha");
}
@Test
public void TestGetQuantita() {
assertEquals(prodotto.getQuantità(), 300);
}
@Test
public void TestSetQuantita() {
prodotto.setQuantità(2);
assertEquals(prodotto.getQuantità(), 2);
}
@Test
public void TestGetDescrizione() {
assertEquals(prodotto.getDescrizione(), "Microfono professionale");
}
@Test
public void TestSetDescrizione() {
prodotto.setDescrizione("Tastiera della Yamahaa");
assertEquals(prodotto.getDescrizione(), "Tastiera della Yamahaa");
}
@Test
public void TestGetPeso () {
assertEquals(prodotto.getPeso(), 3);
}
@Test
public void TestSetPeso() {
prodotto.setPeso(6);
assertEquals(prodotto.getPeso(), 6);
}
/**
* Ci sono 3 parametri nel metodo assertEquals :
* 1: valore attuale
* 2: valore atteso
* 3: valore delta per i numeri double, dove ci sarà la perdita di precisione
*/
@Test
public void TestGetPrezzo () {
assertEquals(prodotto.getPrezzo(),300.0,2);
}
/**
* Ci sono 3 parametri nel metodo assertEquals :
* 1: valore attuale
* 2: valore atteso
* 3: valore delta per i numeri double, dove ci sarà la perdita di precisione
*/
@Test
public void TestSetPrezzo() {
prodotto.setPrezzo(111);
assertEquals(prodotto.getPrezzo(),111.0,2);
}
@Test
public void TestGetStrumento() {
assertEquals(prodotto.getStrumento(), "Microfono");
}
@Test
public void TestSetStrumento() {
prodotto.setStrumento("Tastiera");
assertEquals(prodotto.getStrumento(), "Tastiera");
}
}
| [
"32486071+alexderiso@users.noreply.github.com"
] | 32486071+alexderiso@users.noreply.github.com |
a987e8e6b11765c0b5dfd30e82db794d7e9f866e | 8974c1718811d3c1046c96924b88c333b1d58a92 | /src/main/java/com/mhxks/zjy/zjyQianDaoMain.java | c1a56d437d6d46fa9c19e5c90ccd6d44ec3ce8b6 | [] | no_license | xiaojiucai666/zjySign | 05d085d4ccc78dd0dea7893db5b0f817315e2f4c | f01e1a612dd600072264b2131c1ec2327fd5d280 | refs/heads/master | 2023-05-10T20:39:50.009805 | 2021-05-28T03:29:25 | 2021-05-28T03:29:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,725 | java | package com.mhxks.zjy;
import com.google.gson.JsonElement;
import com.mhxks.zjy.config.APIConfig;
import com.mhxks.zjy.config.UserConfig;
import com.mhxks.zjy.time.TimeMeasurement;
import com.mhxks.zjy.time.TimeUtils;
import com.mhxks.zjy.user.User;
import com.mhxks.zjy.utils.ImageUtils;
import com.mhxks.zjy.utils.ResponeWrapper;
import com.mhxks.zjy.utils.StuWrapper;
import com.mhxks.zjy.utils.zjyUtils;
import org.apache.log4j.Logger;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.net.URL;
import java.net.URLEncoder;
import java.util.*;
public class zjyQianDaoMain {
public static final Logger logger = Logger.getLogger(zjyQianDaoMain.class);
public static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
logger.info("职教云自动签到启动!飞飞飞 v1.0.2");
UserConfig.init(new File("config.json"));
logger.info("json配置文件加载完毕");
int tryLoginInterval = UserConfig.tryLoginInterval;
int signInterval = UserConfig.signInterval;
boolean randomInterval = UserConfig.randomInterval;
logger.info("tryLoginInterval:"+tryLoginInterval);
logger.info("signInterval:"+signInterval);
logger.info("randomInterval:"+randomInterval);
List<User> users = UserConfig.users;
int index = 1;
for (User user : users) {
logger.info("USER"+index+":"+user.getUserName());
}
while(true){
logger.info("开始任务");
logger.info("开始登录签到");
for (User user : users) {
int time = TimeUtils.getWeekday();
if(UserConfig.signWeekDay.indexOf(time+"")==-1){
logger.info("时间不在执行日内,跳过执行");
break;
}
String cookie = user.getCookie();
if(!zjyUtils.isOnline(cookie)){
logger.info(user+"未登录,将要尝试登录");
while(true){
try {
TimeMeasurement.cutStartTime();
ResponeWrapper responeWrapper = zjyUtils.getImageBytesAndCookie();
logger.info("获取验证码共花费:"+TimeMeasurement.getTimeCost()+"毫秒");
String responeWrapperCookie = responeWrapper.getCookie();
byte[] bs = (byte[]) responeWrapper.map.get("bytes");
String code = "";
if(UserConfig.enableAPI){
String base64 = zjyUtils.encoder.encode(bs);
base64 = base64.replaceAll("(\r\n|\r|\n|\n\r)", "");
base64 = URLEncoder.encode(base64,"utf-8");
APIConfig apiConfig = UserConfig.apiConfig;
String host = apiConfig.host;
Map<String,String> head = apiConfig.head;
Map<String,String> formData = new HashMap<String, String>();
formData.putAll(apiConfig.formData);
for (Map.Entry<String, String> stringStringEntry : formData.entrySet()) {
stringStringEntry.setValue(stringStringEntry.getValue().replace("[base64]",base64));
}
TimeMeasurement.cutStartTime();
code = zjyUtils.getCodeByApi(new URL(host), head, formData);
logger.info("请求API共花费"+TimeMeasurement.getTimeCost()+"毫秒");
if(code==null){
logger.info("API异常,尝试从新获取验证码");
continue;
}
//save Image
BufferedImage bufferedImage = ImageUtils.removeBackground(bs);
File file = new File("img", UUID.randomUUID() + ".jpg");
ImageIO.write(bufferedImage, "jpg", file);
logger.info("图片已被保存到"+file.getPath());
}else {
BufferedImage bufferedImage = ImageUtils.removeBackground(bs);
File file = new File("img", UUID.randomUUID() + ".jpg");
ImageIO.write(bufferedImage, "jpg", file);
//String code = ImageUtils.executeTess4J(bufferedImage);
logger.info("请输入" + file.getPath() + "文件上的code");
code = scanner.nextLine();
}
logger.info("尝试code:"+code);
StuWrapper stuWrapper = new StuWrapper();
//stuWrapper.putAttribute("schoolId",UserConfig.schoolId);
stuWrapper.putAttribute("userName",user.getUserName());
stuWrapper.putAttribute("userPwd",user.getUserPass());
stuWrapper.putAttribute("verifyCode",code);
TimeMeasurement.cutStartTime();
ResponeWrapper responeWrapper1 = zjyUtils.login(stuWrapper,responeWrapperCookie);
logger.info("登录账号共花费"+TimeMeasurement.getTimeCost()+"毫秒");
JsonElement jsonElement = zjyUtils.jsonParser.parse(responeWrapper1.getLore());
if(jsonElement.getAsJsonObject().get("code").getAsInt()!=1){
logger.info(jsonElement.getAsJsonObject().get("msg").getAsString());
logger.info("进入等待阶段");
int waitTime = 10;
if(randomInterval){
waitTime = zjyUtils.random.nextInt(tryLoginInterval);
}else{
waitTime = tryLoginInterval;
}
try {
logger.info("等待时间:"+waitTime+"秒");
Thread.sleep(waitTime * 1000);
}catch (Exception e){
e.printStackTrace();
}
}else{
logger.info("登录成功");
String displayName = jsonElement.getAsJsonObject().get("displayName").getAsString();
String schoolName = jsonElement.getAsJsonObject().get("schoolName").getAsString();
logger.info("displayName:"+displayName);
logger.info("schoolName:"+schoolName);
logger.info("cookie:"+responeWrapper1.getCookie());
user.setCookie(responeWrapper1.getCookie());
break;
}
}catch (Exception e){
logger.info("验证码请求失败");
e.printStackTrace();
}
}
}else{
logger.info("已经登录,无需尝试登录");
}
logger.info("准备获取签到列表");
TimeMeasurement.cutStartTime();
List<StuWrapper> stuWrapperList = zjyUtils.getAllTaskType(user.getCookie());
logger.info("获取签到列表共花费"+TimeMeasurement.getTimeCost()+"毫秒");
TimeMeasurement.cutStartTime();
for (StuWrapper stuWrapper : stuWrapperList) {
String title = stuWrapper.getValueByKey("title");
String activityType = stuWrapper.getValueByKey("activityType");
String Id = stuWrapper.getValueByKey("Id");
if(activityType.equals("1")){
logger.info("正在签到"+title);
String signId = Id;
String activityId = stuWrapper.getValueByKey("activityId");
String courseOpenId = stuWrapper.getValueByKey("courseOpenId");
String openClassId = stuWrapper.getValueByKey("openClassId");
String answerCount = stuWrapper.getValueByKey("answerCount");
if(Integer.parseInt(answerCount)<=0) {
StuWrapper stuWrapper1 = new StuWrapper();
stuWrapper1.putAttribute("signId", signId);
stuWrapper1.putAttribute("activityId", activityId);
stuWrapper1.putAttribute("courseOpenId", courseOpenId);
stuWrapper1.putAttribute("openClassId", openClassId);
ResponeWrapper responeWrapper = zjyUtils.sign(stuWrapper1, user.getCookie());
int code = Integer.parseInt(responeWrapper.getStuWrapper().getValueByKey("code"));
if (code > 0) {
logger.info("签到成功!");
} else {
logger.info(responeWrapper.getStuWrapper().getValueByKey("msg"));
}
}else{
logger.info("参与次数大于0,跳过签到");
}
}
}
logger.info("完成所有签到共花费"+TimeMeasurement.getTimeCost()+"毫秒");
}
logger.info("任务结束");
logger.info("进入等待阶段");
int waitTime = 10;
if(randomInterval){
int minSignInterval = UserConfig.minSignInterval;
waitTime = zjyUtils.random.nextInt(signInterval-minSignInterval)+minSignInterval+1;
}else{
waitTime = signInterval;
}
try {
logger.info("等待时间:"+waitTime+"秒");
Thread.sleep(waitTime * 1000);
}catch (Exception e){
e.printStackTrace();
}
}
}
}
| [
"unconfigured@null.spigotmc.org"
] | unconfigured@null.spigotmc.org |
0f7b87b7e667b3e537727e0b510c09c5b15815b1 | c44922dc43202796a7966cfb2dcaf52b94a3f4a2 | /ModelValidator/branches/scrolling-down/src/org/tzi/kodkod/model/iface/IInvariant.java | 2c3be386657d9bdd2bb5fb3849f2de09aac48eab | [] | no_license | useocl/use_plugins | 5c733251077ed176de1b4812fa669d6abb1e2f4a | 3cc4e612235ab18812aa2fb3fe1bb11691f8f3bb | refs/heads/master | 2023-07-18T20:45:19.822954 | 2021-09-30T12:11:41 | 2021-09-30T12:11:41 | 302,649,944 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,478 | java | package org.tzi.kodkod.model.iface;
import kodkod.ast.Formula;
/**
* Instances of the type IInvariant represent invariants in a model.
*
* @author Hendrik Reitmann
*
*/
public interface IInvariant extends IElement {
/**
* Returns the name of this invariant.
*
* @return
*/
public String name();
/**
* Returns the qualified name (with class name) of this invariant.
*
* @return
*/
public String qualifiedName();
/**
* Returns the formula for this invariant.
*
* @return
*/
public Formula formula();
/**
* Sets the formula of this invariant.
*
* @param formula
*/
public void setFormula(Formula formula);
/**
* Returns the context class of this invariant.
*
* @return
*/
public IClass clazz();
/**
* Activates the invariant.
*/
public void activate();
/**
* Deactivates the invariant.
*/
public void deactivate();
/**
* Negates the invariant.
*/
public void negate();
/**
* Reverses a possible negation of the invariant.
*/
void denegate();
/**
* Returns true if the invariant is activated.
*
* @return
*/
public boolean isActivated();
/**
* Returns true if the invariant is negated.
*
* @return
*/
public boolean isNegated();
/**
* Resets the invariant to the normal state which means. the invariant is
* activated and not negated.
*/
public void reset();
}
| [
"fhilken@e95982d2-0d12-e879-a455-8ce5a0885042"
] | fhilken@e95982d2-0d12-e879-a455-8ce5a0885042 |
c1eb1aa896d75613114ac2d8f4bd1edbeedb7256 | fcec9a7a648a9221088b42700612aa0320adc312 | /SeleniumTraining/src/com/abc/day1/stringtest.java | 58cfa868333a42c02a6be7054d1f846fa05a2792 | [] | no_license | nikhilmehetre/Mygitproject | 44e5df74694e5275026660b04e7b3e2c62fdba8b | c5abd13df5f66e5b4f8127b369187f6a60b21ebb | refs/heads/master | 2022-06-01T18:56:56.208856 | 2019-11-17T07:27:13 | 2019-11-17T07:27:13 | 222,204,727 | 0 | 0 | null | 2022-05-20T21:16:48 | 2019-11-17T06:03:16 | Java | UTF-8 | Java | false | false | 885 | java | package com.abc.day1;
public class stringtest {
public static void main(String[] args) {
// TODO Auto-generated method stub
String firstName = "Nikhil";
String LastName = "Meh";
/*System.out.println(firstName.concat(" ").concat(LastName));
System.out.println(firstName.toLowerCase());
System.out.println(firstName.toUpperCase());
System.out.println(firstName.charAt(2));
System.out.println(firstName.length());
System.out.println(firstName.replace('i', 'u'));
System.out.println(firstName.replace("nik", "jyo"));
System.out.println(firstName + LastName);
System.out.println(firstName.substring(3));
System.out.println(firstName.substring(2,3));
*/
System.out.println(firstName.equals(LastName));
String names = "Weather is nice in mumbai";
String [] substr = names.split("i");
System.out.println(substr[1]);
}
}
| [
"Nikhil@DESKTOP-5CJ3U00"
] | Nikhil@DESKTOP-5CJ3U00 |
5e50049eedf237b7c46bad3b1dce0d8fc38d3c4e | 88407296e0dff332d33d82b3e2f8a2aca19e2489 | /00_algorithm/algo_basic/src/algo_basic/day5/JA_탑.java | d27563d2101b51e162af6e0533a3636b0d757673 | [] | no_license | Kwon-Nam-Boo/algorithm | 1ee50de85084503bfea1d3f30ca2dac7094738f5 | 834ea72faf61b7b2f90ac1891bca2e8ef2e16f01 | refs/heads/master | 2023-05-08T14:07:10.009952 | 2021-06-05T07:25:32 | 2021-06-05T07:25:32 | 296,360,983 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 839 | java | package algo_basic.day5;
import java.util.Scanner;
import java.util.Stack;
public class JA_탑 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
StringBuilder sb = new StringBuilder();
int n = sc.nextInt();
Stack<Wall> stack = new Stack<>();
for (int i = 1; i <= n; i++) {
int newHeight = sc.nextInt();
while(!stack.isEmpty()) {
if(stack.peek().height < newHeight) {
stack.pop();
}else{
break;
}
}
if(stack.isEmpty()) {
sb.append("0 ");
}else {
sb.append(stack.peek().idx +" ");
}
stack.push(new Wall(newHeight,i));
}
System.out.println(sb);
}
static class Wall{
int height;
int idx;
public Wall(int height, int idx) {
super();
this.height = height;
this.idx = idx;
}
}
}
| [
"namboo1994@gmail.com"
] | namboo1994@gmail.com |
156fe8e56791e8548e038364df5548d0af4f7c23 | 7928d76b970dbc78f030e8b5cbfc90d749ae3146 | /lamp-oauth/lamp-oauth-biz/src/main/java/top/tangyh/lamp/oauth/granter/AbstractTokenGranter.java | b76dbefd267fbc928a0a8f504d8b70b347ce7c53 | [
"Apache-2.0"
] | permissive | 120386135/lamp-boot | c42408f98fdbeddcb12659c9116755551dfd287b | 5b2db610f3a510fa537f2304b7b6d96e751863fb | refs/heads/master | 2023-07-19T01:56:15.891466 | 2021-08-25T14:13:41 | 2021-08-25T14:13:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,200 | java | /*
* Copyright 2006-2011 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
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package top.tangyh.lamp.oauth.granter;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.extra.servlet.ServletUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import top.tangyh.basic.base.R;
import top.tangyh.basic.boot.utils.WebUtils;
import top.tangyh.basic.context.ContextUtil;
import top.tangyh.basic.database.properties.DatabaseProperties;
import top.tangyh.basic.database.properties.MultiTenantType;
import top.tangyh.basic.exception.code.ExceptionCode;
import top.tangyh.basic.jwt.TokenUtil;
import top.tangyh.basic.jwt.model.AuthInfo;
import top.tangyh.basic.jwt.model.JwtUserInfo;
import top.tangyh.basic.jwt.utils.JwtUtil;
import top.tangyh.basic.utils.ArgumentAssert;
import top.tangyh.basic.utils.BeanPlusUtil;
import top.tangyh.basic.utils.DateUtils;
import top.tangyh.basic.utils.SpringUtils;
import top.tangyh.basic.utils.StrHelper;
import top.tangyh.basic.utils.StrPool;
import top.tangyh.lamp.authority.dto.auth.LoginParamDTO;
import top.tangyh.lamp.authority.dto.auth.Online;
import top.tangyh.lamp.authority.entity.auth.Application;
import top.tangyh.lamp.authority.entity.auth.User;
import top.tangyh.lamp.authority.service.auth.ApplicationService;
import top.tangyh.lamp.authority.service.auth.OnlineService;
import top.tangyh.lamp.authority.service.auth.UserService;
import top.tangyh.lamp.common.constant.AppendixType;
import top.tangyh.lamp.common.properties.SystemProperties;
import top.tangyh.lamp.common.vo.result.AppendixResultVO;
import top.tangyh.lamp.file.service.AppendixService;
import top.tangyh.lamp.oauth.event.LoginEvent;
import top.tangyh.lamp.oauth.event.model.LoginStatusDTO;
import top.tangyh.lamp.tenant.entity.Tenant;
import top.tangyh.lamp.tenant.enumeration.TenantStatusEnum;
import top.tangyh.lamp.tenant.service.TenantService;
import java.time.LocalDateTime;
import static top.tangyh.basic.context.ContextConstants.BASIC_HEADER_KEY;
import static top.tangyh.basic.utils.ArgumentAssert.notNull;
/**
* 验证码TokenGranter
*
* @author zuihou
*/
@Slf4j
@RequiredArgsConstructor
public abstract class AbstractTokenGranter implements TokenGranter {
protected final TokenUtil tokenUtil;
protected final UserService userService;
protected final TenantService tenantService;
protected final ApplicationService applicationService;
protected final DatabaseProperties databaseProperties;
protected final OnlineService onlineService;
protected final SystemProperties systemProperties;
protected final AppendixService appendixService;
/**
* 处理登录逻辑
*
* @param loginParam 登录参数
* @return 认证信息
*/
protected R<AuthInfo> login(LoginParamDTO loginParam) {
if (StrHelper.isAnyBlank(loginParam.getAccount(), loginParam.getPassword())) {
return R.fail("请输入用户名或密码");
}
// 1,检测租户是否可用
if (!MultiTenantType.NONE.eq(databaseProperties.getMultiTenantType())) {
Tenant tenant = this.tenantService.getByCode(ContextUtil.getTenant());
notNull(tenant, "企业不存在");
ArgumentAssert.equals(TenantStatusEnum.NORMAL, tenant.getStatus(), "企业不可用~");
if (tenant.getExpirationTime() != null) {
ArgumentAssert.isFalse(LocalDateTime.now().isAfter(tenant.getExpirationTime()), "企业服务已到期!");
}
}
// 2.检测client是否可用
R<String[]> checkClient = checkClient();
if (!checkClient.getIsSuccess()) {
return R.fail(checkClient.getMsg());
}
// 3. 验证登录
R<User> result = this.getUser(loginParam.getAccount(), loginParam.getPassword());
if (!result.getIsSuccess()) {
return R.fail(result.getCode(), result.getMsg());
}
// 4.生成 token
User user = result.getData();
AuthInfo authInfo = this.createToken(user);
Online online = getOnline(checkClient.getData()[0], authInfo);
//成功登录事件
LoginStatusDTO loginStatus = LoginStatusDTO.success(user.getId(), online);
SpringUtils.publishEvent(new LoginEvent(loginStatus));
onlineService.save(online);
return R.success(authInfo);
}
protected Online getOnline(String clientId, AuthInfo authInfo) {
Online online = new Online();
BeanPlusUtil.copyProperties(authInfo, online);
online.setClientId(clientId);
online.setExpireTime(authInfo.getExpiration());
online.setLoginTime(LocalDateTime.now());
return online;
}
/**
* 检测 client
*/
protected R<String[]> checkClient() {
String basicHeader = ServletUtil.getHeader(WebUtils.request(), BASIC_HEADER_KEY, StrPool.UTF_8);
String[] client = JwtUtil.getClient(basicHeader);
Application application = applicationService.getByClient(client[0], client[1]);
if (application == null) {
return R.fail("请填写正确的客户端ID或者客户端秘钥");
}
if (!application.getState()) {
return R.fail("客户端[%s]已被禁用", application.getClientId());
}
return R.success(client);
}
/**
* 检测用户密码是否正确
*
* @param account 账号
* @param password 密码
* @return 用户信息
*/
protected R<User> getUser(String account, String password) {
User user = this.userService.getByAccount(account);
// 密码错误
if (user == null) {
return R.fail(ExceptionCode.JWT_USER_INVALID);
}
// 方便开发、测试、演示环境 开发者登录别人的账号,生产环境禁用。
if (!systemProperties.getVerifyPassword()) {
return R.success(user);
}
String passwordMd5 = SecureUtil.sha256(password + user.getSalt());
if (!passwordMd5.equalsIgnoreCase(user.getPassword())) {
String msg = "用户名或密码错误!";
// 密码错误事件
SpringUtils.publishEvent(new LoginEvent(LoginStatusDTO.pwdError(user.getId(), msg)));
return R.fail(msg);
}
// 密码过期
if (user.getPasswordExpireTime() != null && LocalDateTime.now().isAfter(user.getPasswordExpireTime())) {
String msg = "用户密码已过期,请修改密码或者联系管理员重置!";
SpringUtils.publishEvent(new LoginEvent(LoginStatusDTO.fail(user.getId(), msg)));
return R.fail(msg);
}
if (!user.getState()) {
String msg = "用户被禁用,请联系管理员!";
SpringUtils.publishEvent(new LoginEvent(LoginStatusDTO.fail(user.getId(), msg)));
return R.fail(msg);
}
// 用户锁定
Integer maxPasswordErrorNum = systemProperties.getMaxPasswordErrorNum();
Integer passwordErrorNum = Convert.toInt(user.getPasswordErrorNum(), 0);
if (maxPasswordErrorNum > 0 && passwordErrorNum >= maxPasswordErrorNum) {
log.info("[{}][{}], 输错密码次数:{}, 最大限制次数:{}", user.getName(), user.getId(), passwordErrorNum, maxPasswordErrorNum);
LocalDateTime passwordErrorLockTime = DateUtils.conversionDateTime(systemProperties.getPasswordErrorLockUserTime());
log.info("passwordErrorLockTime={}", passwordErrorLockTime);
if (passwordErrorLockTime.isAfter(user.getPasswordErrorLastTime())) {
// 登录失败事件
String msg = StrUtil.format("密码连续输错次数已达到{}次,用户已被锁定~", maxPasswordErrorNum);
SpringUtils.publishEvent(new LoginEvent(LoginStatusDTO.fail(user.getId(), msg)));
return R.fail(msg);
}
}
return R.success(user);
}
/**
* 创建用户TOKEN
*
* @param user 用户
* @return token
*/
protected AuthInfo createToken(User user) {
JwtUserInfo userInfo = new JwtUserInfo(user.getId(), user.getAccount(), user.getName());
AuthInfo authInfo = tokenUtil.createAuthInfo(userInfo, null);
AppendixResultVO appendixResultVO = appendixService.getBiz(user.getId(), AppendixType.Authority.BASE_USER_AVATAR);
authInfo.setAvatarId(appendixResultVO != null ? appendixResultVO.getId() : null);
authInfo.setWorkDescribe(user.getWorkDescribe());
return authInfo;
}
}
| [
"244387066@qq.com"
] | 244387066@qq.com |
6b3542722d2a538fad415d2feb08837ab64bd1a9 | e48489ccc70ec9e8b618397d4b84b0ffff36a11d | /37-Spring-MVC-Demo-Form-Validation-DebuggingTrick-OverridingErrorMessage/src/com/ugurcan/springdemo/mvc/Customer.java | 8f2a2dabbc040d720748a34ce9bd9b6e1a108ce4 | [
"MIT",
"Apache-2.0"
] | permissive | demirramazan/Spring-Training | 5429e781dd59facf2a361e70292abdcb1e1e7443 | 6174904eab459c7655714dab06dc67813d8ee12e | refs/heads/master | 2020-03-19T08:09:08.512343 | 2017-07-14T22:16:05 | 2017-07-14T22:18:16 | 136,179,683 | 1 | 0 | null | 2018-06-05T13:13:37 | 2018-06-05T13:13:37 | null | UTF-8 | Java | false | false | 1,280 | java |
package com.ugurcan.springdemo.mvc;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
public class Customer
{
private String firstName;
@NotNull( message = "Required" )
@Size( min = 4, max = 25, message = "must be between 4 - 25 characters" )
private String lastName;
@NotNull( message = "Required" )
@Min( value = 1, message = "Minumum 1 passing" )
@Max( value = 5, message = "Maximum 5 passes" )
private Integer freePasses;
@Pattern(regexp="^[a-zA-z0-9]{5}", message="Not Valid Postal Code")
private String postalCode;
public String getFirstName()
{
return firstName;
}
public void setFirstName( String firstName )
{
this.firstName = firstName;
}
public String getLastName()
{
return lastName;
}
public void setLastName( String lastName )
{
this.lastName = lastName;
}
public Integer getFreePasses()
{
return freePasses;
}
public void setFreePasses( Integer freePasses )
{
this.freePasses = freePasses;
}
public String getPostalCode()
{
return postalCode;
}
public void setPostalCode( String postalCode )
{
this.postalCode = postalCode;
}
}
| [
"ugurcan.cetin@liferay.com"
] | ugurcan.cetin@liferay.com |
a35f23f0028e37f3744fa44cefd91730349a2326 | 57f86152d3948df80a3fd1bebfacb788c5940cb0 | /app/src/main/java/sg/edu/rp/c346/smsapp/MessageReceiver.java | a29666a751f1cd093fbe5f74e6b236c04905b983 | [] | no_license | VanessaGoo/SMSApp | 96622a11d1d64b6f62726c1054eb7fc7b00dd405 | 758de3236a8deab9e6f6b42ae92e9e85a3ae0de8 | refs/heads/master | 2020-03-26T08:00:51.495475 | 2018-08-14T07:04:35 | 2018-08-14T07:04:35 | 144,682,019 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,627 | java | package sg.edu.rp.c346.smsapp;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;
import android.widget.Toast;
/**
* Created by 17010336 on 14/8/2018.
*/
public class MessageReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//SMS messages are retrieved from intent's extra using the key "pdus"
Bundle bundle = intent.getExtras();
try{
if(bundle != null){
Object[] pdusObj = (Object[]) bundle.get("pdus");
SmsMessage currentMessage;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M){
String format = bundle.getString("format");
currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[0], format);
}else{
currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[0]);
}
//obtain the originating phone number(sender's number)
String senderNum = currentMessage.getDisplayOriginatingAddress();
//obtain message body
String message = currentMessage.getDisplayMessageBody();
//Display in Toast
Toast.makeText(context, "You received a message from " + senderNum + ": \n\n" + message, Toast.LENGTH_LONG).show();
}
} catch (Exception e){
Log.e("smsReceiver" , "Error: " + e);
}
}
} | [
"17010336@myrp.edu.sg"
] | 17010336@myrp.edu.sg |
89a1de6f03969a322354c3d691bef545f40e579c | 20aee0308533d72b97fb0c01e79f435f2a0d7ebd | /src/test/java/com/ex1/Module1/NavigateEx.java | 03462367998edd110dce93dcf2630e72583cbe0e | [] | no_license | chetankanani87/Miscellaneous | c39c1136a77a7a51223c171112aef1e5f7807ba6 | d17bb2c88eb44c772ce40a31ad9eb01b5ac5ed5f | refs/heads/master | 2020-03-28T16:47:04.263609 | 2018-09-14T03:19:25 | 2018-09-14T03:19:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package com.ex1.Module1;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class NavigateEx {
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.chrome.driver","chromedriver.exe" );
WebDriver driver = new ChromeDriver();
driver.get("https://www.google.ca/");
driver.manage().window().maximize();
Thread.sleep(2000);
//Navigate To
driver.navigate().to("http://www.youtube.com");
Thread.sleep(2000);
//Back
driver.navigate().back();
Thread.sleep(2000);
//Forward
driver.navigate().forward();
Thread.sleep(2000);
//Refresh
driver.navigate().refresh();
//Browser window close
Thread.sleep(2000);
driver.close();
}
}
| [
"chetankanani87@gmail.com"
] | chetankanani87@gmail.com |
d1e1e0ee7b346fd0ada2adc95072ec33e9aaf521 | 411e58c52e01ac048a51be7d7489d29ff09b6b92 | /summerframework-mybatis/platform-mybatis-core/src/main/java/com/bkjk/platform/mybatis/encrypt/StrongStringEncryptor.java | 7083cac068df6ad83935a2e7984f242c7f9ec1ae | [
"Apache-2.0"
] | permissive | huangchanghuan/summerframework | 65a7f4148c4061492b4f49da48310de7db55c114 | 3305a1da1e5675624902e1dea32dbc8001588907 | refs/heads/master | 2023-09-04T07:26:58.304678 | 2023-08-16T06:54:10 | 2023-08-16T06:54:10 | 297,965,539 | 0 | 0 | Apache-2.0 | 2020-09-23T12:39:16 | 2020-09-23T12:39:16 | null | UTF-8 | Java | false | false | 690 | java | package com.bkjk.platform.mybatis.encrypt;
import org.springframework.security.crypto.encrypt.Encryptors;
import org.springframework.security.crypto.encrypt.TextEncryptor;
public class StrongStringEncryptor extends AbstractEncryptorHolder {
private final TextEncryptor encryptor;
public StrongStringEncryptor(String password, String salt) {
super(password, salt);
encryptor = Encryptors.delux(super.getPassword(), super.getSalt());
}
@Override
public String decrypt(String encryptedText) {
return encryptor.decrypt(encryptedText);
}
@Override
public String encrypt(String text) {
return encryptor.encrypt(text);
}
}
| [
"shiming.liu@bkjk.com"
] | shiming.liu@bkjk.com |
08fcea8cf6229410a04e6464d7b6a02b858beb82 | d493ea81ba7eac08190e2daca69bc1e16db78945 | /Unionpay/app/src/main/java/cn/basewin/unionpay/trade/SwipingSecondCardAty.java | 62d49b288c0aacdbbb81b3120d10d3e6bd11e3cc | [] | no_license | Innoverex/pos | 0a1ac9d26f179e92ea22ca7cca8dc29216b2c008 | fbf5c4911dc45a8fcb874c6d0c01811e8a672134 | refs/heads/master | 2021-06-09T15:25:38.155943 | 2016-12-05T10:51:57 | 2016-12-05T10:51:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,992 | java | package cn.basewin.unionpay.trade;
import android.content.Intent;
import android.os.Bundle;
import android.os.RemoteException;
import android.util.Log;
import com.basewin.define.InputPBOCInitData;
import com.basewin.define.OutputECBalance;
import com.basewin.define.OutputOfflineRecord;
import java.util.ArrayList;
import cn.basewin.unionpay.AppConfig;
import cn.basewin.unionpay.R;
import cn.basewin.unionpay.entity.Card;
import cn.basewin.unionpay.utils.IDUtil;
import cn.basewin.unionpay.utils.PosUtil;
/**
* 作者: wdh <br>
* 内容摘要: <br>
* 创建时间: 2016/7/13 13:49<br>
* 描述:因为刷卡界面可能不同,键盘也可能不一样,所以这个类的功能为整合 刷卡和键盘 <br>
* 实现具体的键盘和确定具体的刷卡ui界面,以及获取数据后对这写键盘或者ui 进行操作
* --下一级子类 实现获取数据后 的流程操作
*/
public class SwipingSecondCardAty extends SwipingCardUI1Aty {
private static final String TAG = SwipingSecondCardAty.class.getName();
/**
* 存储刷卡类型的Key
*/
public static final String KEY_INPUT_TYPE = "SwipingSecondCardAty_input_initdata";
/**
* 存储Card对象的Key
*/
public static final String KEY_CARD = "SwipingSecondCardAty_key_card";
/**
* 存储联机类型。是联机交易还是电子现金
*/
public static final String KEY_TRANSACTION = "SwipingSecondCardAty_Transaction_type";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
int intExtra = getIntent().getIntExtra(AppConfig.KEY_MONEY, 1);
set_money(intExtra);
setSwipeCardTips(getString(R.string.swipe_transfer_in_card));
new Thread() {
@Override
public void run() {
//设置是否为电子现金标志
setECFlag(IDUtil.isEC(FlowControl.MapHelper.getAction()));
//设置非接改造标志
setRfFirst(IDUtil.isRfFirst(FlowControl.MapHelper.getAction()));
//设置交易类型。联机或脱机的各种类型(查询电子现金余额、查询电子现金最近10笔明细)
int transactionType = FlowControl.MapHelper.getTransactionType();
if (transactionType != -1) {
setType_pay(transactionType);
}
int type = FlowControl.MapHelper.getSwipingType();
if (type == -1) {
type = InputPBOCInitData.USE_MAG_CARD | InputPBOCInitData.USE_RF_CARD | InputPBOCInitData.USE_IC_CARD;
}
startPBOC(type);
}
}.start();
}
@Override
protected void swipingCardEnd(Card _card) {
Log.d(TAG, "卡号[2]:" + _card.getPan());
FlowControl.MapHelper.setSecondCard(_card);
startNextFlow();
}
// @Override
// protected void swipingCardEndOAA(Card _card) {
// Log.d(TAG, "卡信息[2]:" + _card.toString());
// FlowControl.MapHelper.setSecondCard(_card);
// }
@Override
public void onReadECBalance(Intent intent) throws RemoteException {
OutputECBalance ecBalance = new OutputECBalance(intent);
FlowControl.MapHelper.setBalance(PosUtil.centToYuan(String.valueOf((ecBalance.getECBalance()))));
startNextFlow();
}
@Override
public void onReadCardOfflineRecord(Intent intent) throws RemoteException {
OutputOfflineRecord list = new OutputOfflineRecord(intent);
ArrayList<String> ECDetail = new ArrayList<>();
String recordStr;
for (int i = 0; i < 10; i++) {
recordStr = list.getRecord(i);
if (recordStr != null) {
Log.d(TAG, "第" + (i + 1) + "条记录:\n" + recordStr);
ECDetail.add(recordStr);
}
}
FlowControl.MapHelper.ECDetail = ECDetail;
startNextFlow();
}
}
| [
"1605639412@qq.com"
] | 1605639412@qq.com |
e7cae6b8c443b7cb609c00c0dd35415aa9b8ac81 | 8b6f42415b617072aa3b81ade82f1345d2c1962e | /src/main/java/org/realityforge/replicant/client/transport/RequestDebugger.java | 034f4e7846d73f3ff0d9049b85d7e6fd5b1fba9a | [
"Apache-2.0"
] | permissive | icaughley/replicant | 31a7e418a5fe99cd8e64b1729c5a0f5fead3621c | fafad58c9876d8fb9b37d5c50123d70467e3cdef | refs/heads/master | 2021-01-18T01:12:40.072622 | 2015-04-02T02:33:05 | 2015-04-02T02:33:05 | 33,848,399 | 0 | 0 | null | 2015-04-13T04:49:53 | 2015-04-13T04:49:53 | null | UTF-8 | Java | false | false | 1,131 | java | package org.realityforge.replicant.client.transport;
import java.util.logging.Logger;
import javax.annotation.Nonnull;
public class RequestDebugger
{
protected static final Logger LOG = Logger.getLogger( RequestDebugger.class.getName() );
public void outputRequests( @Nonnull final String prefix, @Nonnull final ClientSession<?, ?> session )
{
LOG.info( prefix + " Request Count: " + session.getRequests().size() );
for ( final RequestEntry entry : session.getRequests().values() )
{
outputRequest( prefix, entry );
}
}
protected void outputRequest( @Nonnull final String prefix, @Nonnull final RequestEntry entry )
{
LOG.info( prefix + " Request: " + entry.getRequestKey() +
" / " + entry.getRequestID() +
" CacheKey: " + entry.getCacheKey() +
" BulkLoad: " + entry.isBulkLoad() +
" CompletionDataPresent?: " + entry.isCompletionDataPresent() +
" ExpectingResults?: " + entry.isExpectingResults() +
" NormalCompletion?: " + ( entry.isCompletionDataPresent() ? entry.isNormalCompletion() : '?' ) );
}
}
| [
"peter@realityforge.org"
] | peter@realityforge.org |
a2bf15a138c17a1ef6f366d89c80822d96e7c83f | e2144632cbbe8d671e9917cba7406bee5548cfc0 | /textdb/textdb-dataflow/src/test/java/edu/uci/ics/textdb/engine/EngineTest.java | 7ee82d8895a0ca7ef3e377e8280f6373df71b448 | [] | no_license | xuxip/textdb | b887665d1b98ed6dc2e665f7a11810f8d78fcc92 | e8794cc6f5fab13ca26535059b84a7aba4b8acec | refs/heads/master | 2021-01-18T12:28:32.226538 | 2016-06-15T03:10:05 | 2016-06-15T03:10:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,165 | java | package edu.uci.ics.textdb.engine;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import edu.uci.ics.textdb.api.dataflow.ISink;
import edu.uci.ics.textdb.api.plan.Plan;
public class EngineTest {
private Engine engine;
private Plan plan;
private ISink sink;
@Before
public void setUp(){
engine = Engine.getEngine();
//mock the Plan object
plan = Mockito.mock(Plan.class);
//mock Sink object
sink = Mockito.mock(ISink.class);
}
@Test
public void testEvaluate() throws Exception{
//set behavior for Plan Object.
Mockito.when(plan.getRoot()).thenReturn(sink);
engine.evaluate(plan);
//Verify that open(), processTuples() and close() methods are called on the Sink object
Mockito.verify(sink).open();
Mockito.verify(sink).processTuples();
Mockito.verify(sink).close();
}
@Test
public void testSingleton(){
Engine engine2 = Engine.getEngine();
Assert.assertSame(engine2, engine);
}
}
| [
"reddy602.sandeep@gmail.com"
] | reddy602.sandeep@gmail.com |
98ec9c370ab2eadc51467dc1f74fe4097834eea8 | 87a3fbfcf40a8194048edd915123eb721234975f | /app/src/main/java/com/example/ctorres/superagentemovil3/adapter/ComercioQRAdapter.java | 3e720511d1e0911254c9f549610fbcff165a7fe4 | [] | no_license | pierosanchez/SuperAgente2.0 | 5ed189563b33c7d8202931c24d64953ed1d74ee9 | 9e85afa809b591c6296a16b2fbbc736a783abbfa | refs/heads/master | 2021-09-07T03:56:53.009119 | 2018-02-17T00:13:13 | 2018-02-17T00:13:13 | 108,472,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,687 | java | package com.example.ctorres.superagentemovil3.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.example.ctorres.superagentemovil3.R;
import com.example.ctorres.superagentemovil3.entity.BeneficiarioEntity;
import com.example.ctorres.superagentemovil3.entity.ComercioEntity;
import java.util.ArrayList;
/**
* Created by CTORRES on 18/05/2017.
*/
public class ComercioQRAdapter extends BaseAdapter {
ArrayList<ComercioEntity> items;
Context context;
LayoutInflater layoutInflater = null;
public ComercioQRAdapter(ArrayList<ComercioEntity> items, Context context) {
this.items = items;
this.context = context;
layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
@Override
public int getCount() {
if(items == null){
return 0;
}else {
return items.size();
}
}
@Override
public ComercioEntity getItem(int position) {
if(items == null){
return null;
}else{
return items.get(position);
}
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
return null;
}
public static final class ViewHolder{
TextView tv_nombre, tv_apellido;
}
public void setNewListDetalleComercio(ArrayList<ComercioEntity> listBeneficiario){
items = listBeneficiario;
}
}
| [
"papilofire@hotmail.com"
] | papilofire@hotmail.com |
3f9767a9777f1835d0ee88bbcfad707ac734d88d | 84338f703df577a33f9f45145dfbe30442627c17 | /src/main/java/com/graduate/restaurant_rating/to/DishWithVotes.java | b5b1801c1a0aa25294628e013402fe42307c7b5a | [] | no_license | JohannStolz/restaurant_rating | 3e734a34513215184a0a3777b93de6447c50990a | 6bfb558fb283fb6729352bcca9f2f61134402d07 | refs/heads/master | 2020-03-30T12:27:28.485093 | 2018-10-30T11:25:54 | 2018-10-30T11:25:54 | 151,224,999 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,416 | java | package com.graduate.restaurant_rating.to;
import com.graduate.restaurant_rating.domain.Dish;
import java.time.LocalDate;
import java.util.Objects;
public class DishWithVotes {
private Dish dish;
private long countOfVotes;
private LocalDate date;
public DishWithVotes() {
}
public DishWithVotes(Dish dish, long countOfVotes) {
this.dish = dish;
this.countOfVotes = countOfVotes;
this.date = dish.getDate();
}
public Dish getDish() {
return dish;
}
public void setDish(Dish dish) {
this.dish = dish;
}
public long getCountOfVotes() {
return countOfVotes;
}
public void setCountOfVotes(long countOfVotes) {
this.countOfVotes = countOfVotes;
}
public LocalDate getDate() {
return date;
}
public void setDate(LocalDate date) {
this.date = date;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DishWithVotes that = (DishWithVotes) o;
return getCountOfVotes() == that.getCountOfVotes() &&
Objects.equals(getDish(), that.getDish()) &&
Objects.equals(getDate(), that.getDate());
}
@Override
public int hashCode() {
return Objects.hash(getDish(), getCountOfVotes(), getDate());
}
}
| [
"shtolz35@gmail.com"
] | shtolz35@gmail.com |
0201787e64c77070b199f5d161ff0ec08160cf10 | b8fd9f42ed67181b841eeeddca0aad631a1fb913 | /src/Composite/A2/Directory.java | 6bf53e44581c7d92d867e7af1eb34018f1dc47a2 | [] | no_license | Codywei/design-patterns | b07449c173b1ab6e078ce03aa220377ac4c1e4de | 9bb94075514b10f42900e3bca3240cfce001d072 | refs/heads/master | 2021-09-27T14:47:53.847167 | 2018-11-09T06:34:47 | 2018-11-09T06:34:47 | 111,673,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,025 | java | package Composite.A2;
import java.util.Iterator;
import java.util.ArrayList;
public class Directory extends Entry {
private String name;
private ArrayList directory = new ArrayList();
public Directory(String name) {
this.name = name;
}
public String getName() {
return name;
}
public int getSize() {
int size = 0;
Iterator it = directory.iterator();
while (it.hasNext()) {
Entry entry = (Entry)it.next();
size += entry.getSize();
}
return size;
}
public Entry add(Entry entry) {
directory.add(entry);
entry.parent = this; //将父类加上,为了迭代输出全路径使用
return this;
}
protected void printList(String prefix) {
System.out.println(prefix + "/" + this);
Iterator it = directory.iterator();
while (it.hasNext()) {
Entry entry = (Entry)it.next();
entry.printList(prefix + "/" + name);
}
}
}
| [
"33363378+Codywei@users.noreply.github.com"
] | 33363378+Codywei@users.noreply.github.com |
3d80d7d4af2f3fe0e714b2af3449eb2b386f8582 | 91a0c9eb9496f176229330d0b822f5c341c1534d | /src/main/java/com/loacg/kayo/entity/Bind.java | c1f5cead114d0f2bc0bcdd0f7db9a6c302608f93 | [] | no_license | mio2mugi/kayosan | 2bf5f53158180bdafd8349c920679addc7fd10e2 | 7fb4db6e74c71928b1eb5ca90bbbc719d6ae11eb | refs/heads/master | 2021-06-14T06:11:33.266173 | 2016-11-21T05:48:15 | 2016-11-21T05:48:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 986 | java | package com.loacg.kayo.entity;
/**
* Project: kayosan
* Author: Sendya <18x@loacg.com>
* Time: 2016/10/20 9:37
*/
public class Bind {
private int id;
private int type;
private long chatId;
private long userId;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public long getChatId() {
return chatId;
}
public void setChatId(long chatId) {
this.chatId = chatId;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
@Override
public String toString() {
return "Bind{" +
"id=" + id +
", type=" + type +
", chatId=" + chatId +
", userId=" + userId +
'}';
}
}
| [
"18x@loacg.com"
] | 18x@loacg.com |
1b47d4ca11b6c8755c122f0c5343b1185687bc65 | 4876fd384052ea716529bd39cf9da14edfa7e292 | /JMeet/src/main/classes/request/UpcomingMeetingRequest.java | f0bae82476387d4ba9eeed923270b12ceb2f1146 | [] | no_license | Yashikaj14/JMeet | 346d6229893bf83bc8079fe191644e06dd0e53f5 | 1839d4efda987de0dc3c959ac35b346f7ae20bef | refs/heads/master | 2023-06-17T03:55:19.320808 | 2021-07-14T11:21:01 | 2021-07-14T11:21:01 | 381,492,527 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 481 | java | package request;
import constants.RequestCode;
import java.io.Serializable;
public class UpcomingMeetingRequest extends Request implements Serializable {
private String userID;
public UpcomingMeetingRequest(String userID) {
this.userID = userID;
this.requestCode = RequestCode.UPCOMING_MEETING_REQUEST;
}
public String getUserID() {
return userID;
}
public void setUserID(String userID) {
this.userID = userID;
}
}
| [
"jain.yashikaswm@gmail.com"
] | jain.yashikaswm@gmail.com |
7543c645c488dca0a0e38c0c257c79ce9c1cd51c | 88b0e1d7b01ecb3971434021c3305c1e38bdf153 | /app/src/main/java/mta/com/final_project/LoginActivity.java | f6e82c07834d23b0ff631d2c0d89ae970ee1b3dc | [] | no_license | ranelchanan/Final_Project | 7782ee154e448be337110f6d5e57d203cfaa3567 | bcd6cea53c2f9bd32e8ae821fd758c04233778fb | refs/heads/master | 2020-03-13T19:42:54.274335 | 2018-04-27T09:24:10 | 2018-04-27T09:24:10 | 131,190,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,548 | java | package mta.com.final_project;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Patterns;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
public class LoginActivity extends AppCompatActivity {
private EditText emailEditText;
private EditText passwordEditText;
private Button loginButton;
private ProgressDialog loginProgressDialog;
private TextView signUpTextView;
private FirebaseAuth mAuth;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
initViews();
registerReceiver(broadcast_reciever, new IntentFilter("finish"));
}
private void initViews() {
emailEditText = findViewById(R.id.emailEditText_login);
passwordEditText = findViewById(R.id.passwordEditText_login);
loginButton = findViewById(R.id.loginButton_login);
signUpTextView = findViewById(R.id.signUpTextView_login);
loginProgressDialog = new ProgressDialog(this);
mAuth = FirebaseAuth.getInstance();
loginUser();
goToSignUpActivityHandler();
}
private void goToSignUpActivityHandler() {
signUpTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(LoginActivity.this, SignUpActivity.class));
}
});
}
private void loginUser(){
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
final String emailStr = emailEditText.getText().toString().trim();
final String passwordStr = passwordEditText.getText().toString().trim();
if (emailStr.equals("") || !Patterns.EMAIL_ADDRESS.matcher(emailStr).matches()) {
emailEditText.setError("please enter valid email address");
emailEditText.requestFocus();
} else if (passwordStr.length() < 6) {
passwordEditText.setError("password minimum contain 6 character");
passwordEditText.requestFocus();
} else if (passwordStr.equals("")) {
passwordEditText.setError("please enter password");
passwordEditText.requestFocus();
} else {
loginProgressDialog.setMessage("Please wait...");
loginProgressDialog.show();
createAccount(emailStr, passwordStr);
}
}
});
}
private void createAccount(String email, String password){
mAuth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
loginProgressDialog.dismiss();
if (task.isSuccessful()) {
finish();
startActivity(new Intent(LoginActivity.this, HomeActivity.class));
} else {
Toast.makeText(LoginActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
}
}
});
}
//this function gets notified if the login activity needed to be finished (if a new user signed up and is now in the home activity)
BroadcastReceiver broadcast_reciever = new BroadcastReceiver() {
@Override
public void onReceive(Context arg0, Intent intent) {
String action = intent.getAction();
if (action.equals("finish")) {
//finishing the activity
finish();
}
}
};
}
| [
"ranelchanan@gmail.com"
] | ranelchanan@gmail.com |
e9ec5651f059c635b5fc8114c8b66cf676d6c206 | d88c7fc98a6bc0b94322dc1b6fcdaac7b41a2a20 | /src/main/java/com/niit/dao/Cart_DetailsDAOImpl.java | bc0093c9246d55e2bf5125528d6c11d53edab288 | [] | no_license | 123poornima/Shopingkartproject-with-folder | 8366a57148750e93aa0dce7a5caa0ffd9244173a | 91d2fe6d8adefae2312b3fa4bd3abc41edcbb777 | refs/heads/master | 2020-06-29T07:11:20.417626 | 2016-11-22T05:52:51 | 2016-11-22T05:52:51 | 74,439,564 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,628 | java | package com.niit.dao;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;
import com.niit.model.Cart_Details;
//to connect to database by taking all attributes from pojo class
//REPOSITORY ANNOTATION-data access layer for application which used to get data from database
@EnableTransactionManagement
@Repository("cartDAO")
public class Cart_DetailsDAOImpl implements Cart_DetailsDAO
{
//tell where injection need to occur
@Autowired
private SessionFactory sessionfactory;
public Cart_DetailsDAOImpl(SessionFactory sessionfactory)
{
this.sessionfactory=sessionfactory;
}
//used for transaction from model to DAO class
@Transactional
public void addToFurnitureCart(Cart_Details cart)
{
sessionfactory.getCurrentSession().saveOrUpdate(cart);
}
@Transactional
public void deleteFurnitureCart(int id)
{
Cart_Details cart=new Cart_Details();
cart.setId(id);
sessionfactory.getCurrentSession().delete(cart);
}
@Transactional
public Cart_Details getFurnitureCart(String p_id)
{
String hql="from Cart where u_id="+"'"+p_id+"'";
Query query=sessionfactory.getCurrentSession().createQuery(hql);
List<Cart_Details> list=(List<Cart_Details>) query.list();
if(list!=null&& !list.isEmpty())
{
return list.get(0);
}
return null;
}
@Transactional
public List<Cart_Details> furnitureCartList()
{
List<Cart_Details> list= (List<Cart_Details>) sessionfactory.getCurrentSession().createCriteria(Cart_Details.class).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY).list();
return list;
}
@Transactional
public List<Cart_Details> userFurnitureCartList(String uname)
{
//HQL(hibernate query language) is an object-oriented query language, similar to SQL, but instead of operating on tables and columns,HQL works with persistent objects and their properties.
//data is fetched from cart using user id
String hql="from Cart_Details where u_id="+"'"+uname+"'";
@SuppressWarnings("rawtypes")
Query query=sessionfactory.getCurrentSession().createQuery(hql);
@SuppressWarnings("unchecked")
List<Cart_Details> list=query.list();
if(list!=null&& !list.isEmpty())
{
return list;
}
return null;
}
}
| [
"Poornima M"
] | Poornima M |
08648e53fd2bbbc3cb823f2a332cd5196decdd0a | 4ca7313bb9810325fa7707a36cb270a6f5d5c38c | /IPersistence/src/main/java/com/lagou/sqlSession/simpleExecutor.java | 51edf0df7a7d0d85a6bd067995a297b15020974a | [] | no_license | sunyb123/mybatis- | 718ed5db09ed6d743a7fd24a41ce3ead4efcaac9 | a4531acdc8f43ebccefd2edb58d99670469da288 | refs/heads/master | 2022-12-23T02:34:05.976814 | 2020-10-03T15:34:40 | 2020-10-03T15:34:40 | 300,908,379 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,899 | java | package com.lagou.sqlSession;
import com.lagou.config.BoundSql;
import com.lagou.pojo.Configuration;
import com.lagou.pojo.MappedStatement;
import com.lagou.utils.GenericTokenParser;
import com.lagou.utils.ParameterMapping;
import com.lagou.utils.ParameterMappingTokenHandler;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.ArrayList;
import java.util.List;
public class simpleExecutor implements Executor {
@Override //user
public <E> List<E> query(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception {
// 1. 注册驱动,获取连接
Connection connection = configuration.getDataSource().getConnection();
// 2. 获取sql语句 : select * from user where id = #{id} and username = #{username}
//转换sql语句: select * from user where id = ? and username = ? ,转换的过程中,还需要对#{}里面的值进行解析存储
String sql = mappedStatement.getSql();
BoundSql boundSql = getBoundSql(sql);
// 3.获取预处理对象:preparedStatement
PreparedStatement preparedStatement = connection.prepareStatement(boundSql.getSqlText());
// 4. 设置参数
//获取到了参数的全路径
String paramterType = mappedStatement.getParamterType();
Class<?> paramtertypeClass = getClassType(paramterType);
List<ParameterMapping> parameterMappingList = boundSql.getParameterMappingList();
for (int i = 0; i < parameterMappingList.size(); i++) {
ParameterMapping parameterMapping = parameterMappingList.get(i);
String content = parameterMapping.getContent();
//反射
Field declaredField = paramtertypeClass.getDeclaredField(content);
//暴力访问
declaredField.setAccessible(true);
Object o = declaredField.get(params[0]);
preparedStatement.setObject(i+1,o);
}
// 5. 执行sql
ResultSet resultSet = preparedStatement.executeQuery();
String resultType = mappedStatement.getResultType();
Class<?> resultTypeClass = getClassType(resultType);
ArrayList<Object> objects = new ArrayList<>();
// 6. 封装返回结果集
while (resultSet.next()){
Object o =resultTypeClass.newInstance();
//元数据
ResultSetMetaData metaData = resultSet.getMetaData();
for (int i = 1; i <= metaData.getColumnCount(); i++) {
// 字段名
String columnName = metaData.getColumnName(i);
// 字段的值
Object value = resultSet.getObject(columnName);
//使用反射或者内省,根据数据库表和实体的对应关系,完成封装
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(columnName, resultTypeClass);
Method writeMethod = propertyDescriptor.getWriteMethod();
writeMethod.invoke(o,value);
}
objects.add(o);
}
return (List<E>) objects;
}
@Override
public int upd(Configuration configuration, MappedStatement mappedStatement, Object... params) throws Exception {
// 1. 注册驱动,获取连接
Connection connection = configuration.getDataSource().getConnection();
String sql = mappedStatement.getSql();
BoundSql boundSql = getBoundSql(sql);
// 3.获取预处理对象:preparedStatement
PreparedStatement preparedStatement = connection.prepareStatement(boundSql.getSqlText());
// 4. 设置参数
//获取到了参数的全路径
String paramterType = mappedStatement.getParamterType();
Class<?> paramtertypeClass = getClassType(paramterType);
List<ParameterMapping> parameterMappingList = boundSql.getParameterMappingList();
for (int i = 0; i < parameterMappingList.size(); i++) {
ParameterMapping parameterMapping = parameterMappingList.get(i);
String content = parameterMapping.getContent();
//反射
Field declaredField = paramtertypeClass.getDeclaredField(content);
//暴力访问
declaredField.setAccessible(true);
Object o = declaredField.get(params[0]);
preparedStatement.setObject(i+1,o);
}
// 5. 执行sql
int i = preparedStatement.executeUpdate();
return i;
}
private Class<?> getClassType(String paramterType) throws ClassNotFoundException {
if(paramterType!=null){
Class<?> aClass = Class.forName(paramterType);
return aClass;
}
return null;
}
/**
* 完成对#{}的解析工作:1.将#{}使用?进行代替,2.解析出#{}里面的值进行存储
* @param sql
* @return
*/
private BoundSql getBoundSql(String sql) {
//标记处理类:配置标记解析器来完成对占位符的解析处理工作
ParameterMappingTokenHandler parameterMappingTokenHandler = new ParameterMappingTokenHandler();
GenericTokenParser genericTokenParser = new GenericTokenParser("#{", "}", parameterMappingTokenHandler);
//解析出来的sql
String parseSql = genericTokenParser.parse(sql);
//#{}里面解析出来的参数名称
List<ParameterMapping> parameterMappings = parameterMappingTokenHandler.getParameterMappings();
BoundSql boundSql = new BoundSql(parseSql,parameterMappings);
return boundSql;
}
}
| [
"sunyb1029@163.com"
] | sunyb1029@163.com |
06fa54f02262b91eea65c6ebe2966ff6b4cb937d | b1d141afc689569dd85d23e16ad7a010b0c0edeb | /profileTest/app/src/main/java/njit/oa/profiletest/ui/login/LoginViewModel.java | a064debfa1b55becbf24adf0f6cef148c08b81f9 | [] | no_license | OmairAbdulNJIT/CS388 | f9c78fac5d70e09b16266f12bef2035c5ae06017 | ce97adcfc9bd33597de785482a0ddec868607785 | refs/heads/master | 2023-04-05T17:43:37.835012 | 2021-05-10T03:30:34 | 2021-05-10T03:30:34 | 332,792,034 | 0 | 0 | null | 2021-05-10T03:30:35 | 2021-01-25T15:28:14 | Java | UTF-8 | Java | false | false | 71 | java | package njit.oa.profiletest.ui.login;
public class LoginViewModel {
}
| [
"oa236@njit.edu"
] | oa236@njit.edu |
c0f12dcb7eb9f7d461a3c1afce8f42ac3bad0214 | 007f39f9a94646a880e4f0365176bd6a30d6fca5 | /1.JavaSyntax/src/com/javarush/task/task01/task0125/Solution.java | 8c46303f4deec2c7be89ebd545c04e70fa30ef25 | [] | no_license | CubStaska/JavaRushTasks | 3a3273a45c5b27a469e6c38c982d635a4848251c | a62f45922f3fcd6db2436203810152f38f56e811 | refs/heads/master | 2021-01-21T14:57:11.803452 | 2017-07-18T14:40:22 | 2017-07-18T14:40:22 | 95,360,759 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.javarush.task.task01.task0125;
/*
Большая чистка
*/
public class Solution {
public static void main(String[] args) {
// String s = "15";
int a = 5;
// int z = 18;
int d = 18;
int c = a + d;
String b = " better then ";
System.out.println(a + b + c);
}
}
| [
"bubub@mail.ru"
] | bubub@mail.ru |
69942c664270984b7a33de1e7e3389b015d9a264 | 8366519081df9e3ca5581dea95235bb5a80055b6 | /src/dis/DiabetesDisease.java | d65cc40177f0027cc5f1f9590cb76bfca74fe865 | [] | no_license | orenStern2/ANN | 57784fd5005213047c44fae805091c598500f4d9 | 19f58492159a91ce38df502edba1c25e1f121542 | refs/heads/master | 2022-07-24T09:52:40.986251 | 2022-07-18T11:00:47 | 2022-07-18T11:00:47 | 122,870,634 | 0 | 0 | null | 2018-02-25T20:02:05 | 2018-02-25T19:53:14 | null | UTF-8 | Java | false | false | 3,683 | java | package dis;
import java.io.IOException;
import java.util.ArrayList;
import ann.NeuralNet;
import ann.learn.Training;
import ann.learn.Training.ActivationFncENUM;
import ann.learn.Training.TrainingTypesENUM;
import ann.util.Chart;
import ann.util.Classification;
import ann.util.Data;
import ann.util.Data.NormalizationTypesENUM;
public class DiabetesDisease {
public static void main(String args[]){
Data diseaseDataInput = new Data("data", "diabetes_inputs_training.csv");
Data diseaseDataOutput = new Data("data", "diabetes_output_training.csv");
Data diseaseDataInputTestRNA = new Data("data", "diabetes_inputs_test.csv");
Data diseaseDataOutputTestRNA = new Data("data", "diabetes_output_test.csv");
NormalizationTypesENUM NORMALIZATION_TYPE = Data.NormalizationTypesENUM.MAX_MIN_EQUALIZED;
try {
double[][] matrixInput = diseaseDataInput.rawData2Matrix( diseaseDataInput );
double[][] matrixOutput = diseaseDataOutput.rawData2Matrix( diseaseDataOutput );
double[][] matrixInputTestRNA = diseaseDataOutput.rawData2Matrix( diseaseDataInputTestRNA );
double[][] matrixOutputTestRNA = diseaseDataOutput.rawData2Matrix( diseaseDataOutputTestRNA );
double[][] matrixInputNorm = diseaseDataInput.normalize(matrixInput, NORMALIZATION_TYPE);
double[][] matrixInputTestRNANorm = diseaseDataOutput.normalize(matrixInputTestRNA, NORMALIZATION_TYPE);
NeuralNet n1 = new NeuralNet();
n1 = n1.initNet(8, 1, 3, 2);
n1.setTrainSet( matrixInputNorm );
n1.setRealMatrixOutputSet( matrixOutput );
n1.setMaxEpochs(1000);
n1.setTargetError(0.00001);
n1.setLearningRate(0.1);
n1.setTrainType(TrainingTypesENUM.BACKPROPAGATION);
n1.setActivationFnc(ActivationFncENUM.HYPERTAN);
n1.setActivationFncOutputLayer(ActivationFncENUM.SIGLOG);
NeuralNet n1Trained = new NeuralNet();
n1Trained = n1.trainNet(n1);
System.out.println();
//ERROR:
Chart c1 = new Chart();
c1.plotXYData(n1.getListOfMSE().toArray(), "MSE Error", "Epochs", "MSE Value");
//
Classification classif = new Classification();
//TEST:
n1Trained.setTrainSet( matrixInputTestRNANorm );
n1Trained.setRealMatrixOutputSet( matrixOutputTestRNA );;
double[][] matrixOutputRNATest = n1Trained.getNetOutputValues(n1Trained);
if(n1Trained.getOutputLayer().getNumberOfNeuronsInLayer() > 1) {
matrixOutputTestRNA = classif.convertToOneColumn(matrixOutputTestRNA);
matrixOutputRNATest = classif.convertToOneColumn(matrixOutputRNATest);
}
ArrayList<double[][]> listOfArraysToJoinTest = new ArrayList<double[][]>();
listOfArraysToJoinTest.add( matrixOutputTestRNA );
listOfArraysToJoinTest.add( matrixOutputRNATest );
double[][] matrixOutputsJoinedTest = new Data().joinArrays(listOfArraysToJoinTest);
Chart c3 = new Chart();
c3.plotBarChart(matrixOutputsJoinedTest, "Real x Estimated - Test Data", "Diabetes Data", "Diagnosis (0: NO / 1: YES)");
//CONFUSION MATRIX
double[][] confusionMatrix = classif.calculateConfusionMatrix(0.6, matrixOutputsJoinedTest);
classif.printConfusionMatrix(confusionMatrix);
//SENSITIVITY
System.out.println("SENSITIVITY = " + classif.calculateSensitvity(confusionMatrix));
//SPECIFICITY
System.out.println("SPECIFICITY = " + classif.calculateSpecificity(confusionMatrix));
//ACCURACY
System.out.println("ACCURACY = " + classif.calculateAccuracy(confusionMatrix));
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"orenst@LTH80033036"
] | orenst@LTH80033036 |
dc009fb03448bd438db24818a1eca2f019869049 | 2da8c28dce9b45107b20cffb88c9e6b283f83ebf | /src/main/java/com/example/demo/Repo/PostRepo.java | 413777868621f232f207ae73563554c4ee0be477 | [] | no_license | RenuJaishankar/SecondJavaGraphQLRepo | 1e9b3998c107330933b0169653532776de977288 | e47fbbd3a66cfe7a356215f365eec158cd59cdde | refs/heads/master | 2021-05-19T13:02:51.957753 | 2020-04-26T20:42:08 | 2020-04-26T20:42:08 | 251,713,268 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package com.example.demo.Repo;
import com.example.demo.Model.Post;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;
//import org.springframework.data.repository.Repository;
import java.util.List;
public interface PostRepo extends PagingAndSortingRepository<Post,Long> {
}
| [
"Renu.Jaishankar@yahoo.com"
] | Renu.Jaishankar@yahoo.com |
93f25b65234c8bcff395cc1cd69b7847b7f858fe | bac67f42744b2d7f31051aa6bc7824298f84754f | /android-agent-develop/engine_module/src/main/java/com/rsupport/rsperm/IRSPerm.java | de8fa7410c4e9c19458a60937f62465197eb4778 | [] | no_license | Parkduksung/1Month1Book | e93b8a3664c1c3b62729ed703ddb51a99ff4b43a | b50523730a43a831994c81a9df3cba6d6ed9ef12 | refs/heads/master | 2023-05-13T13:42:40.464467 | 2021-05-21T07:56:51 | 2021-06-05T10:00:21 | 308,900,317 | 1 | 1 | null | 2021-03-30T05:20:42 | 2020-10-31T14:31:17 | Java | UTF-8 | Java | false | false | 3,321 | java | package com.rsupport.rsperm;
import android.app.ActivityManager;
import android.graphics.Point;
import android.view.Surface;
import java.io.FileDescriptor;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.List;
public interface IRSPerm {
public boolean bind(String address);
public void unbind();
public boolean isBinded();
public boolean loadJni(String soPath);
/**
* @return 접속 Address, rsperm 을 사용하면 rsperm package name 그렇지 않으면 uds address
*/
public String getAddress();
public FileDescriptor getFile(String args) throws Exception;
public boolean initScreen(int w, int h) throws Exception;
public boolean capture(int w, int h) throws Exception;
public void inject(byte[] data, int offset, int length) throws Exception;
public void injectTouchEvent(int action, int x, int y, int x2, int y2) throws Exception;
public void injectKeyEvent(int action, int key) throws Exception;
public boolean screenshot(String imgPath) throws Exception;
public String exec(String cmd) throws Exception;
public int hwrotation() throws Exception;
public boolean putSFloat(String name, float value) throws Exception;
public boolean putSInt(String name, int value) throws Exception;
public boolean putSLong(String name, long value) throws Exception;
public boolean putSString(String name, String value) throws Exception;
public boolean putGFloat(String name, float value) throws Exception;
public boolean putGInt(String name, int value) throws Exception;
public boolean putGLong(String name, long value) throws Exception;
public boolean putGString(String name, String value) throws Exception;
public boolean createVirtualDisplay(String vdname, int width, int height, int dpi, int flags, Surface surf);
public List<ActivityManager.RunningAppProcessInfo> getRunningProcesses();
/**
* Dumpsys 명령을 수행할 수 있는지를 판단한다.
*
* @return dumpsys 명령어를 실행할 수 있으면 true, 그렇지 않으면 false`
*/
boolean hasDumpsys();
final static int COMMAND_OK = 0;
static final int JNI_ASHMInject = 19;
static final int JNI_ASHMCreate = 20;
static final int JNI_ASHMCapture = 21;
static final int JNI_ASHMScreenshot = 22; // dump to file
static final int JNI_Execute = 23;
static final int JNI_GetHWRotation = 24;
static final int JNI_ASHMInitScreen = 25;
}
class RSPermHelper {
static ByteBuffer buildRequest(boolean uds, int bufSize, int type, Object... args) {
ByteBuffer bb = ByteBuffer.allocate(bufSize).order(ByteOrder.LITTLE_ENDIAN);
if (uds)
bb.position(4);
bb.put((byte) type);
for (Object arg : args) {
if (arg instanceof Integer)
bb.putInt((Integer) arg);
else if (arg instanceof Byte)
bb.put((Byte) arg);
else if (arg instanceof String)
bb.put(((String) arg).getBytes());
else if (arg instanceof Point)
bb.putInt(((Point) arg).x).putInt(((Point) arg).y);
}
if (uds) {
int size = bb.position();
bb.putInt(0, size - 4);
}
return bb;
}
}
| [
"duksung1234@naver.com"
] | duksung1234@naver.com |
6b2fa9c281cae2f427922149e726893a85b5e710 | 458f5f273720e13a4c16e4411c36d4754d1916f3 | /spider/spider-parent/spider-web/src/main/java/com/xwke/spider/huntsman/JxGovPageHunter.java | 9f191075bbe664a03ee3c6538f36134fa4ee5f3e | [] | no_license | lxg776/html-web | 4afa3a8710f2dbcd9c81a645148371527f06f8a6 | 7fd3ab37c6d404659c638463098887846d914f5b | refs/heads/master | 2021-01-20T08:06:33.074083 | 2017-10-10T13:47:45 | 2017-10-10T13:47:45 | 90,094,499 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,958 | java | package com.xwke.spider.huntsman;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import com.xwke.base.core.beans.WherePrams;
import com.xwke.spider.dao.SiteConfigDao;
import com.xwke.spider.huntsman.configuration.NewsConfiguration;
import com.xwke.spider.modle.SiteConfigModle;
import us.codecraft.webmagic.Page;
import us.codecraft.webmagic.Site;
import us.codecraft.webmagic.Spider;
import us.codecraft.webmagic.processor.PageProcessor;
@Component
public class JxGovPageHunter implements PageProcessor {
public void crawl() {
Spider.create(this).addUrl(getSite().getDomain()).addPipeline(detailPipeLine).thread(20).run();
}
public JxGovPageHunter() {
}
/**
* 抓取多urls
*
* @param urls
*/
public void crawl(String[] urls) {
// jxGovConfig.setConfig("123123");
Spider.create(this).addUrl(urls).addPipeline(detailPipeLine).thread(20).run();
}
NewsConfiguration jxGovConfig;
@Resource(name = "detailPipeLine")
DetailPipeLine detailPipeLine;
@Resource
SiteConfigDao siteConfigDao;
public void process(Page page) {
if (page.getUrl().toString().contains("a=show")) {
page.putField(DetailPipeLine.PARM_HTML, page);
page.putField(DetailPipeLine.CONFIG, jxGovConfig);
}
// 把"amp"转化成空格
List<String> urls = page.getHtml().$(".box .list li").regex("<a(?:\\s+.+?)*?\\s+href=\"([^\"]*?)\".+>(.*?)</a>")
.all();
for (int i = 0; i < urls.size(); i++) {
String url = urls.get(i);
url = url.replace("amp;", "");
page.addTargetRequest(url);
}
}
public Site getSite() {
// TODO Auto-generated method stub
if (jxGovConfig == null) {
jxGovConfig = new NewsConfiguration();
List<SiteConfigModle> list = siteConfigDao.list(new WherePrams("c_alias", " = ", "jxGov"));
if (list != null && list.size() > 0) {
jxGovConfig.setConfig(list.get(0).getConfigJsonText());
}
}
return jxGovConfig.getSite();
}
}
| [
"262621979@qq.com"
] | 262621979@qq.com |
844afa53e66a1ca2ffafa2e1196fc6ba06866d57 | 1382c42cb32e6809e451f6fe872cf719b6cb83cd | /src/main/java/in/dealo/svc/DealContentSvc.java | 45ad317d1b7a078772e8ca0018c389a6f069e900 | [
"Apache-2.0"
] | permissive | touchsy/dealo | 94fa4220c55332282bc77a52773f81660d6ebf99 | fafbd4e7b9a14ea9ee529b834a2b9e01282f3f42 | refs/heads/master | 2016-09-06T11:40:28.878770 | 2014-05-23T09:01:01 | 2014-05-23T09:01:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 189 | java | package in.dealo.svc;
import org.springframework.roo.addon.layers.service.RooService;
@RooService(domainTypes = { in.dealo.entity.DealContent.class })
public interface DealContentSvc {
}
| [
"sanjeev@sellerforce.com"
] | sanjeev@sellerforce.com |
0a917936216f74423347fe17d82279e1f31161dd | 2fb8bc59cfaa6cef59f0212cc394fa4e51208a35 | /src/main/java/com/yisingle/webapp/websocket/HandshakeInterceptor.java | 2e5fbbdb15ce4ccca9ecbc993659c6edcd25976f | [] | no_license | ooozxv2/yisingle | e48322e6699d4d79549db10cb60300b55c645185 | 976757d3152fdc9a3fcda92d4ceb209aee3e5233 | refs/heads/master | 2020-05-20T05:25:33.736914 | 2018-11-01T10:21:45 | 2018-11-01T10:21:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,251 | java | package com.yisingle.webapp.websocket;
import java.util.Map;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.socket.WebSocketHandler;
import org.springframework.web.socket.server.support.HttpSessionHandshakeInterceptor;
@Component
public class HandshakeInterceptor extends HttpSessionHandshakeInterceptor {
@Override
public boolean beforeHandshake(ServerHttpRequest request,
ServerHttpResponse response, WebSocketHandler wsHandler,
Map<String, Object> attributes) throws Exception {
//解决The extension [x-webkit-deflate-frame] is not supported问题
if(request.getHeaders().containsKey("Sec-WebSocket-Extensions")) {
request.getHeaders().set("Sec-WebSocket-Extensions", "permessage-deflate");
}
System.out.println("Before Handshake");
return super.beforeHandshake(request, response, wsHandler, attributes);
}
@Override
public void afterHandshake(ServerHttpRequest request,
ServerHttpResponse response, WebSocketHandler wsHandler,
Exception ex) {
System.out.println("After Handshake");
super.afterHandshake(request, response, wsHandler, ex);
}
}
| [
"j314815101@qq.com"
] | j314815101@qq.com |
977d4ef411d52231f6344b047fe7ad57a1178c4f | c7b7b650861a8d20d62531f2b0b81ad08f89a45b | /src/main/java/com/linjia/wxpay/protocol/RefundQueryResData.java | 326d1c0e89ac15e771a5d3d82d5187d62d90a52e | [] | no_license | 598605338/tiexin_app | 89eac38a86c9b6db1d37afbe6c0343e81a152b28 | f24c8cc24fc9ac93e64208dbc6bc9a3aa0aa7c16 | refs/heads/master | 2020-05-20T22:44:20.210692 | 2017-03-21T10:15:39 | 2017-03-21T10:15:39 | 84,538,026 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,878 | java | package com.linjia.wxpay.protocol;
/**
* User: rizenguo
* Date: 2014/10/25
* Time: 16:36
*/
public class RefundQueryResData {
//协议层
private String return_code = "";
private String return_msg = "";
//协议返回的具体数据(以下字段在return_code 为SUCCESS 的时候有返回)
private String result_code = "";
private String err_code = "";
private String err_code_des = "";
private String appid = "";
private String mch_id = "";
private String nonce_str = "";
private String sign = "";
private String device_info = "";
private String transaction_id = "";
private String out_trade_no = "";
private int refund_count = 0;
// 这里要用对象来装,因为有可能出现多个数据
private String out_refund_no = "";
private String refund_id = "";
private String refund_channel = "";
private String refund_fee = "";
private String coupon_refund_fee = "";
private String refund_status = "";
// 微信退款单查询数据
private String cash_fee = "";
private String out_refund_no_0 = "";
private String refund_channel_0 = "";
private String refund_fee_0 = "";
private String refund_id_0 = "";
private String refund_recv_accout_0 = "";
private String refund_status_0 = "";
private String total_fee = "";
public String getReturn_code() {
return return_code;
}
public void setReturn_code(String return_code) {
this.return_code = return_code;
}
public String getReturn_msg() {
return return_msg;
}
public void setReturn_msg(String return_msg) {
this.return_msg = return_msg;
}
public String getResult_code() {
return result_code;
}
public void setResult_code(String result_code) {
this.result_code = result_code;
}
public String getErr_code() {
return err_code;
}
public void setErr_code(String err_code) {
this.err_code = err_code;
}
public String getErr_code_des() {
return err_code_des;
}
public void setErr_code_des(String err_code_des) {
this.err_code_des = err_code_des;
}
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getMch_id() {
return mch_id;
}
public void setMch_id(String mch_id) {
this.mch_id = mch_id;
}
public String getNonce_str() {
return nonce_str;
}
public void setNonce_str(String nonce_str) {
this.nonce_str = nonce_str;
}
public String getSign() {
return sign;
}
public void setSign(String sign) {
this.sign = sign;
}
public String getDevice_info() {
return device_info;
}
public void setDevice_info(String device_info) {
this.device_info = device_info;
}
public String getTransaction_id() {
return transaction_id;
}
public void setTransaction_id(String transaction_id) {
this.transaction_id = transaction_id;
}
public String getOut_trade_no() {
return out_trade_no;
}
public void setOut_trade_no(String out_trade_no) {
this.out_trade_no = out_trade_no;
}
public int getRefund_count() {
return refund_count;
}
public void setRefund_count(int refund_count) {
this.refund_count = refund_count;
}
public String getOut_refund_no() {
return out_refund_no;
}
public void setOut_refund_no(String out_refund_no) {
this.out_refund_no = out_refund_no;
}
public String getRefund_id() {
return refund_id;
}
public void setRefund_id(String refund_id) {
this.refund_id = refund_id;
}
public String getRefund_channel() {
return refund_channel;
}
public void setRefund_channel(String refund_channel) {
this.refund_channel = refund_channel;
}
public String getRefund_fee() {
return refund_fee;
}
public void setRefund_fee(String refund_fee) {
this.refund_fee = refund_fee;
}
public String getCoupon_refund_fee() {
return coupon_refund_fee;
}
public void setCoupon_refund_fee(String coupon_refund_fee) {
this.coupon_refund_fee = coupon_refund_fee;
}
public String getRefund_status() {
return refund_status;
}
public void setRefund_status(String refund_status) {
this.refund_status = refund_status;
}
public String getCash_fee() {
return cash_fee;
}
public void setCash_fee(String cash_fee) {
this.cash_fee = cash_fee;
}
public String getOut_refund_no_0() {
return out_refund_no_0;
}
public void setOut_refund_no_0(String out_refund_no_0) {
this.out_refund_no_0 = out_refund_no_0;
}
public String getRefund_channel_0() {
return refund_channel_0;
}
public void setRefund_channel_0(String refund_channel_0) {
this.refund_channel_0 = refund_channel_0;
}
public String getRefund_fee_0() {
return refund_fee_0;
}
public void setRefund_fee_0(String refund_fee_0) {
this.refund_fee_0 = refund_fee_0;
}
public String getRefund_id_0() {
return refund_id_0;
}
public void setRefund_id_0(String refund_id_0) {
this.refund_id_0 = refund_id_0;
}
public String getRefund_recv_accout_0() {
return refund_recv_accout_0;
}
public void setRefund_recv_accout_0(String refund_recv_accout_0) {
this.refund_recv_accout_0 = refund_recv_accout_0;
}
public String getRefund_status_0() {
return refund_status_0;
}
public void setRefund_status_0(String refund_status_0) {
this.refund_status_0 = refund_status_0;
}
public String getTotal_fee() {
return total_fee;
}
public void setTotal_fee(String total_fee) {
this.total_fee = total_fee;
}
}
| [
"598605338@qq.com"
] | 598605338@qq.com |
c386249dcd17d287ab3ccf87b31baa497e6fdc63 | f414bbf19b24be9d238fba53bd59dd725865c0d7 | /crawler-worker-node/src/main/java/edu/uci/ics/crawler4j/crawler/exceptions/ParseException.java | d6b3aebee59bfadd93a11440b805b84dde35609a | [] | no_license | nmiodice/domain-trustworthiness | accd5dbf80e5689bbfc5accf299af2461c92448c | eb02b4d29bed8cc5b562f273b13b8008d559c142 | refs/heads/master | 2021-01-20T11:47:56.366561 | 2017-09-04T13:02:39 | 2017-09-04T13:02:39 | 83,571,533 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package edu.uci.ics.crawler4j.crawler.exceptions;
/**
* Created by Avi Hayun on 12/8/2014.
* <p>
* Thrown when there is a problem with the parsing of the content - this is a tagging exception
*/
public class ParseException extends Exception {
} | [
"nickio@amazon.com"
] | nickio@amazon.com |
15523b68de30fa810d475a4d602d4e1e78b74331 | 8c8bd7d2ce9ea835079d3791297cd578cb346be3 | /src/lesson_05/lesson05/Road.java | 8808c155f189ea0dc6960d9e6e14de107e7b2726 | [] | no_license | YulDmi/Java_GeekBrains_3 | 783d83ff66022ba252ecae36eea629bdfc17017f | 96a2a338b2b7dd3cd212674036df0efc82ef6d5e | refs/heads/master | 2021-04-24T07:18:57.642670 | 2020-04-11T14:40:16 | 2020-04-11T14:40:16 | 250,098,998 | 0 | 0 | null | 2021-01-16T10:40:39 | 2020-03-25T21:49:04 | Java | UTF-8 | Java | false | false | 584 | java | package lesson_05.lesson05;
public class Road extends Stage {
public Road(int length) {
this.length = length;
this.description = "Дорога " + length + " метров";
}
@Override
public void go(Car c) {
try {
System.out.println(c.getName() + " начал этап: " + description);
Thread.sleep(length / c.getSpeed() * 1000);
System.out.println(c.getName() + " закончил этап: " + description);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
| [
"barsetca@rambler.ru"
] | barsetca@rambler.ru |
394e45bdb4d119d804d19f2127761318c9eb258f | bffeafc8e15474639fd55650d8e5ec8990c96f6b | /src/main/java/helpertools/renders/ItemRenderStaff4.java | 8d92b8dda06c87c93ee22a0fe2e5229bd5f24bc1 | [
"MIT"
] | permissive | immortalcatz/HelperTools | a657e4f0090dc0b993adb0a88385c5ec8ac7dd50 | ff207fc58e0bc201e696798f97d1b6f87d17b256 | refs/heads/master | 2020-12-02T19:41:39.111967 | 2016-09-04T01:03:42 | 2016-09-04T01:03:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,783 | java | package helpertools.renders;
import helpertools.models.Modelv5Staff5;
import helpertools.tools.ItemStaffofExpansion;
import java.lang.ref.Reference;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.common.ForgeHooks;
//@SideOnly(Side.CLIENT)
public class ItemRenderStaff4 implements IItemRenderer {
private Modelv5Staff5 Modelv5Staff5;
public ItemRenderStaff4()
{
Modelv5Staff5 = new Modelv5Staff5();
}
////////////////////////////////////////
//Expansion staff model
/////////////////////////////////////////
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
switch(type)
{
case EQUIPPED: return true;
//
case EQUIPPED_FIRST_PERSON: return true;
//
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
ItemRendererHelper helper) {
return false;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
//ItemStaffofExpansion entitywolf = (ItemStaffofExpansion)item.getItem();
switch(type){
case EQUIPPED:{
GL11.glPushMatrix();
//
GL11.glScalef(.1F,.1F,.1F);
GL11.glRotatef(200, 0F,0F,20F);
//GL11.glRotatef(90, -3F,10F,10F);
GL11.glTranslatef(-9F,0F,0F);
GL11.glTranslatef(0F,-6.5F,0F);
//GL11.glTranslatef(3F,+3.5F,-6F);
//
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("helpertools", "textures/models/Staff5.png"));
//
//Modelv5Staff5.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F);
//
Modelv5Staff5.renderModel(item, 0.625F);
//
GL11.glPopMatrix();
break;
}
case EQUIPPED_FIRST_PERSON:{
GL11.glPushMatrix();
GL11.glScalef(.1F,.1F,.1F);
GL11.glRotatef(200, 0F,0F,20F);
GL11.glTranslatef(-9F,0F,0F);
GL11.glTranslatef(0F,-6.5F,0F);
//
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("helpertools", "textures/models/Staff5.png"));
//
//Modelv5Staff5.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.07F);
//
Modelv5Staff5.renderModel(item, 0.625F);
//
GL11.glPopMatrix();
break;
}
default:
break;
}
}
}
| [
"GrizzlyHonker@Gmail.com"
] | GrizzlyHonker@Gmail.com |
59efb919e558c46a34199c3f8376e96704f23ca8 | 2fd9d77d529e9b90fd077d0aa5ed2889525129e3 | /DecompiledViberSrc/app/src/main/java/twitter4j/internal/http/XAuthAuthorization.java | 94361165a5a052d3f57c1a7785e866ba87366c87 | [] | no_license | cga2351/code | 703f5d49dc3be45eafc4521e931f8d9d270e8a92 | 4e35fb567d359c252c2feca1e21b3a2a386f2bdb | refs/heads/master | 2021-07-08T15:11:06.299852 | 2021-05-06T13:22:21 | 2021-05-06T13:22:21 | 60,314,071 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,559 | java | package twitter4j.internal.http;
import java.io.Serializable;
import twitter4j.auth.Authorization;
import twitter4j.auth.BasicAuthorization;
public class XAuthAuthorization
implements Serializable, Authorization
{
private static final long serialVersionUID = -6082451214083464902L;
private BasicAuthorization basic;
private String consumerKey;
private String consumerSecret;
public XAuthAuthorization(BasicAuthorization paramBasicAuthorization)
{
this.basic = paramBasicAuthorization;
}
public String getAuthorizationHeader(HttpRequest paramHttpRequest)
{
return this.basic.getAuthorizationHeader(paramHttpRequest);
}
public String getConsumerKey()
{
return this.consumerKey;
}
public String getConsumerSecret()
{
return this.consumerSecret;
}
public String getPassword()
{
return this.basic.getPassword();
}
public String getUserId()
{
return this.basic.getUserId();
}
public boolean isEnabled()
{
return this.basic.isEnabled();
}
public void setOAuthConsumer(String paramString1, String paramString2)
{
try
{
this.consumerKey = paramString1;
this.consumerSecret = paramString2;
return;
}
finally
{
localObject = finally;
throw localObject;
}
}
}
/* Location: E:\Study\Tools\apktool2_2\dex2jar-0.0.9.15\classes_viber_5_dex2jar.jar
* Qualified Name: twitter4j.internal.http.XAuthAuthorization
* JD-Core Version: 0.6.2
*/ | [
"yu.liang@navercorp.com"
] | yu.liang@navercorp.com |
eba5e4b7a2ba2f196679fa92c0d884c79468e817 | c93321634515f65b2458834c9a3358f353c1f893 | /erp-pro/src/com/pt/core/persistence/dialect/db/SQLServerDialect.java | f5d147ab2b3896ae0e0bc5fffd2a8105086c4860 | [] | no_license | taojin1122/erp-pro | 0e3eaaee675135761b8c42b29c853b3c9178bde2 | f3e8653d2a185eab7c0cf39182d21c93096d1666 | refs/heads/master | 2020-05-25T02:23:54.093373 | 2019-05-20T05:42:56 | 2019-05-20T05:42:56 | 187,573,633 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,699 | java | /**
* Copyright © 2015-2020 <a href="http://www.pt.org/">pt</a> All rights reserved.
*/
package com.pt.core.persistence.dialect.db;
import com.pt.core.persistence.dialect.Dialect;
/**
* MSSQLServer 数据库实现分页方言
*
* @author poplar.yfyang
* @version 1.0 2010-10-10 下午12:31
* @since JDK 1.5
*/
public class SQLServerDialect implements Dialect {
public boolean supportsLimit() {
return true;
}
static int getAfterSelectInsertPoint(String sql) {
int selectIndex = sql.toLowerCase().indexOf("select");
final int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
}
public String getLimitString(String sql, int offset, int limit) {
return getLimit(sql, offset, limit);
}
/**
* 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换.
* <pre>
* 如mysql
* dialect.getLimitString("select * from user", 12, ":offset",0,":limit") 将返回
* select * from user limit :offset,:limit
* </pre>
*
* @param sql 实际SQL语句
* @param offset 分页开始纪录条数
* @param limit 分页每页显示纪录条数
* @return 包含占位符的分页sql
*/
public String getLimit(String sql, int offset, int limit) {
if (offset > 0) {
throw new UnsupportedOperationException("sql server has no offset");
}
return new StringBuffer(sql.length() + 8)
.append(sql)
.insert(getAfterSelectInsertPoint(sql), " top " + limit)
.toString();
}
}
| [
"1027679890@qq.com"
] | 1027679890@qq.com |
7ed7f9cdbf258ced8dbc775b394c728d942995ff | 0013548e586cbc47fcfa96c8978302788a432661 | /spring/src/main/java/com/kaishengit/controller/FileController.java | 74d6f320e86ede6edda2cd8e2b3eda42c87e89b7 | [] | no_license | 1142007022/freamwork | f017bc71f07aceb99e8ab833fc5ce39e196c977e | d5dee13e9881a3937ced178384b4eab66eb1b1a3 | refs/heads/master | 2022-12-23T19:24:35.603056 | 2019-08-20T02:36:55 | 2019-08-20T02:36:55 | 128,018,288 | 1 | 0 | null | 2022-12-16T09:41:54 | 2018-04-04T06:36:14 | JavaScript | UTF-8 | Java | false | false | 1,245 | java | package com.kaishengit.controller;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.UUID;
@Controller
@RequestMapping("/file")
public class FileController {
@GetMapping
public String file() {
return "customer/upload";
}
@PostMapping
public String file(String name, MultipartFile photo) throws IOException {
InputStream inputStream = photo.getInputStream();
OutputStream outputStream = new FileOutputStream(new File("D:/upload/" + UUID.randomUUID() + photo.getOriginalFilename().substring(photo.getOriginalFilename().lastIndexOf("."))));
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.close();
//photo.transferTo(new File("D:/upload/"+ UUID.randomUUID()+photo.getOriginalFilename().substring(photo.getOriginalFilename().lastIndexOf("."))));
return "redirect:/file";
}
}
| [
"1142007022@qq.com"
] | 1142007022@qq.com |
bb3cc2fd552f9c2ffa48940eaff61dc9a0adacca | 5ebf8e5463d207b5cc17e14cc51e5a1df135ccb9 | /moe.apple/moe.platform.ios/src/main/java/apple/networkextension/NEAppRule.java | a4d5ac60e74010c94627032e666c7cf136e88d1d | [
"ICU",
"Apache-2.0",
"W3C"
] | permissive | multi-os-engine-community/moe-core | 1cd1ea1c2caf6c097d2cd6d258f0026dbf679725 | a1d54be2cf009dd57953c9ed613da48cdfc01779 | refs/heads/master | 2021-07-09T15:31:19.785525 | 2017-08-22T10:34:50 | 2017-08-22T10:59:02 | 101,847,137 | 1 | 0 | null | 2017-08-30T06:43:46 | 2017-08-30T06:43:46 | null | UTF-8 | Java | false | false | 6,341 | java | /*
Copyright 2014-2016 Intel Corporation
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 apple.networkextension;
import apple.NSObject;
import apple.foundation.NSArray;
import apple.foundation.NSCoder;
import apple.foundation.NSMethodSignature;
import apple.foundation.NSSet;
import apple.foundation.protocol.NSCopying;
import apple.foundation.protocol.NSSecureCoding;
import org.moe.natj.c.ann.FunctionPtr;
import org.moe.natj.general.NatJ;
import org.moe.natj.general.Pointer;
import org.moe.natj.general.ann.Generated;
import org.moe.natj.general.ann.Library;
import org.moe.natj.general.ann.Mapped;
import org.moe.natj.general.ann.MappedReturn;
import org.moe.natj.general.ann.NInt;
import org.moe.natj.general.ann.NUInt;
import org.moe.natj.general.ann.Owned;
import org.moe.natj.general.ann.Runtime;
import org.moe.natj.general.ptr.VoidPtr;
import org.moe.natj.objc.Class;
import org.moe.natj.objc.ObjCRuntime;
import org.moe.natj.objc.SEL;
import org.moe.natj.objc.ann.ObjCClassBinding;
import org.moe.natj.objc.ann.ProtocolClassMethod;
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.map.ObjCObjectMapper;
@Generated
@Library("NetworkExtension")
@Runtime(ObjCRuntime.class)
@ObjCClassBinding
public class NEAppRule extends NSObject implements NSSecureCoding, NSCopying {
static {
NatJ.register();
}
@Generated
protected NEAppRule(Pointer peer) {
super(peer);
}
@Generated
@Selector("accessInstanceVariablesDirectly")
public static native boolean accessInstanceVariablesDirectly();
@Generated
@Owned
@Selector("alloc")
public static native NEAppRule alloc();
@Generated
@Selector("allocWithZone:")
@MappedReturn(ObjCObjectMapper.class)
public static native Object allocWithZone(VoidPtr zone);
@Generated
@Selector("automaticallyNotifiesObserversForKey:")
public static native boolean automaticallyNotifiesObserversForKey(String key);
@Generated
@Selector("cancelPreviousPerformRequestsWithTarget:")
public static native void cancelPreviousPerformRequestsWithTarget(@Mapped(ObjCObjectMapper.class) Object aTarget);
@Generated
@Selector("cancelPreviousPerformRequestsWithTarget:selector:object:")
public static native void cancelPreviousPerformRequestsWithTargetSelectorObject(
@Mapped(ObjCObjectMapper.class) Object aTarget, SEL aSelector,
@Mapped(ObjCObjectMapper.class) Object anArgument);
@Generated
@Selector("classFallbacksForKeyedArchiver")
public static native NSArray<String> classFallbacksForKeyedArchiver();
@Generated
@Selector("classForKeyedUnarchiver")
public static native Class classForKeyedUnarchiver();
@Generated
@Selector("debugDescription")
public static native String debugDescription_static();
@Generated
@Selector("description")
public static native String description_static();
@Generated
@Selector("hash")
@NUInt
public static native long hash_static();
@Generated
@Selector("instanceMethodForSelector:")
@FunctionPtr(name = "call_instanceMethodForSelector_ret")
public static native NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(SEL aSelector);
@Generated
@Selector("instanceMethodSignatureForSelector:")
public static native NSMethodSignature instanceMethodSignatureForSelector(SEL aSelector);
@Generated
@Selector("instancesRespondToSelector:")
public static native boolean instancesRespondToSelector(SEL aSelector);
@Generated
@Selector("isSubclassOfClass:")
public static native boolean isSubclassOfClass(Class aClass);
@Generated
@Selector("keyPathsForValuesAffectingValueForKey:")
public static native NSSet<String> keyPathsForValuesAffectingValueForKey(String key);
@Generated
@Owned
@Selector("new")
@MappedReturn(ObjCObjectMapper.class)
public static native Object new_objc();
@Generated
@Selector("resolveClassMethod:")
public static native boolean resolveClassMethod(SEL sel);
@Generated
@Selector("resolveInstanceMethod:")
public static native boolean resolveInstanceMethod(SEL sel);
@Generated
@Selector("setVersion:")
public static native void setVersion_static(@NInt long aVersion);
@Generated
@Selector("superclass")
public static native Class superclass_static();
@Generated
@Selector("supportsSecureCoding")
public static native boolean supportsSecureCoding();
@Generated
@Selector("version")
@NInt
public static native long version_static();
@Generated
@Owned
@Selector("copyWithZone:")
@MappedReturn(ObjCObjectMapper.class)
public native Object copyWithZone(VoidPtr zone);
@Generated
@Selector("encodeWithCoder:")
public native void encodeWithCoder(NSCoder aCoder);
@Generated
@Selector("init")
public native NEAppRule init();
@Generated
@Selector("initWithCoder:")
public native NEAppRule initWithCoder(NSCoder aDecoder);
@Generated
@Selector("initWithSigningIdentifier:")
public native NEAppRule initWithSigningIdentifier(String signingIdentifier);
@Generated
@Selector("matchDomains")
public native NSArray<?> matchDomains();
@Generated
@Selector("matchPath")
public native String matchPath();
@Generated
@Selector("matchSigningIdentifier")
public native String matchSigningIdentifier();
@Generated
@Selector("setMatchDomains:")
public native void setMatchDomains(NSArray<?> value);
@Generated
@Selector("setMatchPath:")
public native void setMatchPath(String value);
@Generated
@ProtocolClassMethod("supportsSecureCoding")
public boolean _supportsSecureCoding() {
return supportsSecureCoding();
}
}
| [
"kristof.liliom@migeran.com"
] | kristof.liliom@migeran.com |
bd348979ece40b700b66a051c98142ab83f5335e | e7b14ab36032a83e3e96e153eb5442577773da60 | /open-metadata-implementation/access-services/discovery-engine/discovery-engine-server/src/main/java/org/odpi/openmetadata/accessservices/discoveryengine/converters/DiscoveryServicePropertiesConverter.java | 4eeb5cba0820cfc4d377c3e99c323cba920538a1 | [
"CC-BY-4.0",
"Apache-2.0"
] | permissive | popa-raluca/egeria | fc2f45c84ef3f16d33762f7bfeb1718177b2d727 | cb9dc3189d4a4954fa7e43e492d6e1f6dab586cf | refs/heads/master | 2023-06-22T07:56:58.117738 | 2021-05-25T08:44:23 | 2021-05-25T08:44:23 | 149,274,100 | 0 | 0 | Apache-2.0 | 2018-09-18T11:02:17 | 2018-09-18T11:02:16 | null | UTF-8 | Java | false | false | 8,134 | java | /* SPDX-License-Identifier: Apache 2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.accessservices.discoveryengine.converters;
import org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIMapper;
import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException;
import org.odpi.openmetadata.frameworks.discovery.properties.DiscoveryServiceProperties;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.*;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefCategory;
import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper;
import java.util.List;
/**
* DiscoveryServicePropertiesConverter transfers the relevant properties from an Open Metadata Repository Services (OMRS)
* EntityDetail object into a DiscoveryServiceProperties bean.
*/
public class DiscoveryServicePropertiesConverter<B> extends DiscoveryEngineOMASConverter<B>
{
/**
* Constructor
*
* @param repositoryHelper helper object to parse entity/relationship objects
* @param serviceName name of this component
* @param serverName local server name
*/
public DiscoveryServicePropertiesConverter(OMRSRepositoryHelper repositoryHelper,
String serviceName,
String serverName)
{
super(repositoryHelper, serviceName, serverName);
}
/**
* Using the supplied instances, return a new instance of the bean. It is used for beans such as
* a connection bean which made up of 3 entities (Connection, ConnectorType and Endpoint) plus the
* relationships between them. The relationships may be omitted if they do not have an properties.
*
* @param beanClass name of the class to create
* @param primaryEntity entity that is the root of the cluster of entities that make up the
* content of the bean
* @param supplementaryEntities entities connected to the primary entity by the relationships
* @param relationships relationships linking the entities
* @param methodName calling method
* @return bean populated with properties from the instances supplied
* @throws PropertyServerException there is a problem instantiating the bean
*/
@Override
public B getNewComplexBean(Class<B> beanClass,
EntityDetail primaryEntity,
List<EntityDetail> supplementaryEntities,
List<Relationship> relationships,
String methodName) throws PropertyServerException
{
try
{
/*
* This is initial confirmation that the generic converter has been initialized with an appropriate bean class.
*/
B returnBean = beanClass.newInstance();
if (returnBean instanceof DiscoveryServiceProperties)
{
DiscoveryServiceProperties bean = (DiscoveryServiceProperties)returnBean;
if (primaryEntity != null)
{
/*
* Check that the entity is of the correct type.
*/
bean.setElementHeader(this.getMetadataElementHeader(beanClass, primaryEntity, methodName));
/*
* The initial set of values come from the entity properties. The super class properties are removed from a copy of the entities
* properties, leaving any subclass properties to be stored in extended properties.
*/
InstanceProperties instanceProperties = new InstanceProperties(primaryEntity.getProperties());
bean.setQualifiedName(this.removeQualifiedName(instanceProperties));
bean.setAdditionalProperties(this.removeAdditionalProperties(instanceProperties));
bean.setDisplayName(this.removeName(instanceProperties));
bean.setDescription(this.removeDescription(instanceProperties));
/* Note this value should be in the classification */
bean.setOwner(this.removeOwner(instanceProperties));
/* Note this value should be in the classification */
bean.setOwnerType(this.removeOwnerTypeFromProperties(instanceProperties));
/* Note this value should be in the classification */
bean.setZoneMembership(this.removeZoneMembership(instanceProperties));
/*
* Any remaining properties are returned in the extended properties. They are
* assumed to be defined in a subtype.
*/
bean.setExtendedProperties(this.getRemainingExtendedProperties(instanceProperties));
/*
* The values in the classifications override the values in the main properties of the Asset's entity.
* Having these properties in the main entity is deprecated.
*/
instanceProperties = super.getClassificationProperties(OpenMetadataAPIMapper.ASSET_ZONES_CLASSIFICATION_NAME, primaryEntity);
bean.setZoneMembership(this.getZoneMembership(instanceProperties));
instanceProperties = super.getClassificationProperties(OpenMetadataAPIMapper.ASSET_OWNERSHIP_CLASSIFICATION_NAME, primaryEntity);
bean.setOwner(this.getOwner(instanceProperties));
bean.setOwnerType(this.getOwnerTypeFromProperties(instanceProperties));
instanceProperties = super.getClassificationProperties(OpenMetadataAPIMapper.ASSET_ORIGIN_CLASSIFICATION_NAME, primaryEntity);
bean.setOriginOrganizationGUID(this.getOriginOrganizationGUID(instanceProperties));
bean.setOriginBusinessCapabilityGUID(this.getOriginBusinessCapabilityGUID(instanceProperties));
bean.setOtherOriginValues(this.getOtherOriginValues(instanceProperties));
if (supplementaryEntities != null)
{
for (EntityDetail entity : supplementaryEntities)
{
if ((entity != null) && (entity.getType() != null))
{
if (repositoryHelper.isTypeOf(serviceName, entity.getType().getTypeDefName(), OpenMetadataAPIMapper.CONNECTION_TYPE_NAME))
{
bean.setConnection(super.getEmbeddedConnection(beanClass,
entity,
supplementaryEntities,
relationships,
methodName));
}
}
}
}
}
else
{
handleMissingMetadataInstance(beanClass.getName(), TypeDefCategory.ENTITY_DEF, methodName);
}
}
else
{
handleUnexpectedBeanClass(beanClass.getName(), DiscoveryServiceProperties.class.getName(), methodName);
}
return returnBean;
}
catch (IllegalAccessException | InstantiationException | ClassCastException error)
{
super.handleInvalidBeanClass(beanClass.getName(), error, methodName);
}
return null;
}
}
| [
"mandy_chessell@uk.ibm.com"
] | mandy_chessell@uk.ibm.com |
fd77255e273cd645d38aeab2fc7ce3768ccb8aac | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-importexport/src/main/java/com/amazonaws/services/importexport/AmazonImportExportClientBuilder.java | 27802a3cf73b968b2f3ab40fb9491e0d0852ed79 | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 2,410 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.importexport;
import javax.annotation.Generated;
import com.amazonaws.ClientConfigurationFactory;
import com.amazonaws.annotation.NotThreadSafe;
import com.amazonaws.client.builder.AwsSyncClientBuilder;
import com.amazonaws.client.AwsSyncClientParams;
/**
* Fluent builder for {@link com.amazonaws.services.importexport.AmazonImportExport}. Use of the builder is preferred
* over using constructors of the client class.
**/
@NotThreadSafe
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public final class AmazonImportExportClientBuilder extends AwsSyncClientBuilder<AmazonImportExportClientBuilder, AmazonImportExport> {
private static final ClientConfigurationFactory CLIENT_CONFIG_FACTORY = new ClientConfigurationFactory();
/**
* @return Create new instance of builder with all defaults set.
*/
public static AmazonImportExportClientBuilder standard() {
return new AmazonImportExportClientBuilder();
}
/**
* @return Default client using the {@link com.amazonaws.auth.DefaultAWSCredentialsProviderChain} and
* {@link com.amazonaws.regions.DefaultAwsRegionProviderChain} chain
*/
public static AmazonImportExport defaultClient() {
return standard().build();
}
private AmazonImportExportClientBuilder() {
super(CLIENT_CONFIG_FACTORY);
}
/**
* Construct a synchronous implementation of AmazonImportExport using the current builder configuration.
*
* @param params
* Current builder configuration represented as a parameter object.
* @return Fully configured implementation of AmazonImportExport.
*/
@Override
protected AmazonImportExport build(AwsSyncClientParams params) {
return new AmazonImportExportClient(params);
}
}
| [
""
] | |
c6bf814b85b8f7956e6befb2cd7b7e9f6ba630f8 | ea60a6f37a87fc2adaf3f7970244984c10d569e3 | /src/main/java/com/wallethub/log_parser/ApplicationShutdown.java | be8617533d74e8bbb2be239eb241fdc38baf9bef | [] | no_license | adrian-sobiczewski/log-parser | 273dd6bbcc493f11356e3d2ec7da48bafcf5831d | 91f66c5ae49716043f904cdc60f614dd801eb9e7 | refs/heads/master | 2020-03-30T13:07:07.177859 | 2018-10-02T00:46:12 | 2018-10-02T00:46:12 | 151,257,002 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 447 | java | package com.wallethub.log_parser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
@Service
public class ApplicationShutdown {
@Autowired
private ApplicationContext appContext;
public void shutdown() {
SpringApplication.exit(appContext, () -> 0);
}
}
| [
"adrian.sobiczewski.official@gmail.com"
] | adrian.sobiczewski.official@gmail.com |
0968a6d3b9a7786aa2400a4b1c05287d251f28c5 | 6fab1c03fcff98a514e44cc81580dbd7a042910e | /@Note20120112/src/lector/client/catalogo/client/TagEntity.java | 281bff77f5324b8282edab0ad10c08bac668ef5f | [] | no_license | gayoxo/Atnote | f0e1457f33acaf7cd068d7f9f967570436fe1cca | 828a2e36d1b30bb8ccd7788833d49c0b2cb5b3f1 | refs/heads/master | 2020-05-27T08:18:45.435551 | 2014-11-06T11:29:22 | 2014-11-06T11:29:22 | 3,170,222 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 771 | java | package lector.client.catalogo.client;
import java.util.ArrayList;
public class TagEntity extends Entity {
/**
*
*/
private static final long serialVersionUID = 1L;
public TagEntity(String Namein, Long ID,Long IDpadre) {
super(Namein, ID, IDpadre);
}
@Override
public void addSon(Entity entity) throws FileException {
}
@Override
public void removeSon(Entity entity) throws FileException {
}
@Override
public ArrayList<Entity> getSons() throws FileException {
return null;
}
@Override
public void setSons(ArrayList<Entity> sons) throws FileException {
}
@Override
public boolean isFolder() {
return false;
}
@Override
public boolean isType() {
return false;
}
}
| [
"gayoxo@gmail.com"
] | gayoxo@gmail.com |
fc93749dded336dc376a234417eb50966cbdc36b | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-connect/src/main/java/com/amazonaws/services/connect/model/transform/ChatMessageMarshaller.java | b53161cd11f217a89013f6ad3072b8f611278750 | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 2,224 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.connect.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.connect.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* ChatMessageMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class ChatMessageMarshaller {
private static final MarshallingInfo<String> CONTENTTYPE_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("ContentType").build();
private static final MarshallingInfo<String> CONTENT_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
.marshallLocationName("Content").build();
private static final ChatMessageMarshaller instance = new ChatMessageMarshaller();
public static ChatMessageMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(ChatMessage chatMessage, ProtocolMarshaller protocolMarshaller) {
if (chatMessage == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(chatMessage.getContentType(), CONTENTTYPE_BINDING);
protocolMarshaller.marshall(chatMessage.getContent(), CONTENT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
| [
""
] | |
24f5364e1943eba40168ef385efbd9e7933d1ea6 | 2e2ae515e594695f9610d80c08fc8c41265d545c | /src/projekt/systemanalyse/client/event/RundeBeendetEvent.java | a2bde8801b6f66a26d86dd5f3947d72d8055577b | [] | no_license | TobiasHoeh/Systemanalyse | 6ed9d8478f7d897e8bbe236ea569db7ebee0e08a | d136d020d0236543749bb0be6e569426635b1fce | refs/heads/master | 2016-08-05T09:58:29.479327 | 2011-05-23T09:12:43 | 2011-05-23T09:12:43 | 1,787,265 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 731 | java | package projekt.systemanalyse.client.event;
import projekt.systemanalyse.shared.Spieler;
import projekt.systemanalyse.shared.Spiel;
import com.google.gwt.event.shared.GwtEvent;
public class RundeBeendetEvent extends GwtEvent<RundeBeendetEventHandler> {
public static Type<RundeBeendetEventHandler> TYPE = new Type<RundeBeendetEventHandler>();
Spiel spiel;
Spieler spieler;
public RundeBeendetEvent(Spiel spiel, Spieler spieler) {
this.spiel = spiel;
this.spieler = spieler;
}
@Override
public Type<RundeBeendetEventHandler> getAssociatedType() {
return TYPE;
}
@Override
protected void dispatch(RundeBeendetEventHandler handler) {
handler.onRundeBeendet(this,spiel,spieler);
}
} | [
"tobiashoehmann@googlemail.com"
] | tobiashoehmann@googlemail.com |
cde346adf1ced1a306773babc58a27da1824f9a8 | 482972cc1d363e6064ae2b62ff74926b11e3c45d | /icedust/lib-java/src/derivations/Settings.java | d46538c3f80d0fbb08f4a449b19113da31844dd6 | [] | no_license | MetaBorgCube/PixieDust | dc6eafbe9fe8ee70d9a57543f2b1ed69efab5054 | 4b1215d2defcc16f15570ce7e83474e0bb9897d7 | refs/heads/master | 2021-01-21T16:44:20.501801 | 2019-04-11T08:33:54 | 2019-04-11T08:33:54 | 91,901,916 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,184 | java | package derivations;
import java.util.ArrayList;
import java.util.Map;
import java.util.Set;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import utils.AbstractPageServlet;
import utils.GlobalVariables;
import utils.GlobalsPageServlet;
import utils.ThreadLocalOut;
import utils.ThreadLocalPage;
public class Settings {
static volatile boolean updatesEnabled = true;
public static boolean getUpdatesEnabled() {
return updatesEnabled;
}
public static void setUpdatesEnabled(boolean setting) {
updatesEnabled = setting;
}
static WorkerSet workers;
public Settings(int n, int millis) {
workers = new WorkerSet(millis);
workers.setNumWorkers(n);
}
public static void setNumWorkers(int n) {
workers.setNumWorkers(n);
}
public static int getNumWorkers() {
return workers.getNumWorkers();
}
public static boolean getLogincremental() {
return DirtyCollections.logincremental;
}
public static void setLogincremental(boolean setting) {
DirtyCollections.logincremental = setting;
}
public static boolean getLogeventualupdate() {
return DirtyCollections.logeventualupdate;
}
public static void setLogeventualupdate(boolean setting) {
DirtyCollections.logeventualupdate = setting;
}
public static boolean getLogeventualstatus() {
return DirtyCollections.logeventualstatus;
}
public static void setLogeventualstatus(boolean setting) {
DirtyCollections.logeventualstatus = setting;
}
private static Map<Thread, Set<String>> threadFieldMap = new ConcurrentHashMap<Thread, Set<String>>();
private static Map<Thread, String> threadUuidMap = new ConcurrentHashMap<Thread, String>();
public static void threadMapsSet(Thread t, Set<String> hashmap, String uuid) {
threadFieldMap.put(t, hashmap);
threadUuidMap.put(t, uuid);
}
public static void reschedule(Thread t) {
Set<String> hashmap = threadFieldMap.get(t);
String uuid = threadUuidMap.get(t);
hashmap.add(uuid);
DirtyCollections.dirtyI(0);
}
}
class WorkerSet {
private int numWorkers = 0;
private int checkInterval;
private ScheduledExecutorService ex = Executors.newScheduledThreadPool(16); // is maxThreads
private ArrayList<ScheduledFuture<?>> schedules = new ArrayList<ScheduledFuture<?>>();
public WorkerSet(int checkInterval) {
this.checkInterval = checkInterval;
}
public void setNumWorkers(int numWorkers) {
int oldNumWorkers = schedules.size();
this.numWorkers = numWorkers;
if (numWorkers > oldNumWorkers) {
for (int i = oldNumWorkers; i < numWorkers; i++) {
addWorker(i);
}
}
if (numWorkers < oldNumWorkers) {
for (int i = oldNumWorkers - 1; i >= numWorkers; i--) {
removeWorker(i);
}
}
}
public int getNumWorkers() {
return numWorkers;
}
private void addWorker(int index) {
if (schedules.size() <= index) {
System.out.println("Adding Worker " + index);
TimerTask task = newTask(index);
ScheduledFuture<?> schedule = ex.scheduleWithFixedDelay(task, 0, checkInterval, TimeUnit.MILLISECONDS);
schedules.add(index, schedule);
}
}
private TimerTask newTask(final int index) {
return new java.util.TimerTask() {
public void run() {
Thread thisThread = Thread.currentThread();
while (DirtyCollections.getI() < 2147483647 && Settings.getUpdatesEnabled()) {
if (numWorkers <= index) {
System.out.println("Worker " + index + ": shutting down");
break;
}
if (utils.GlobalVariables.globalvarsChecked && utils.GlobalInit.initChecked) {
org.hibernate.Session hibSession = null;
try {
org.webdsl.servlet.ServletState.scheduledTaskStarted(
"invoke updateDerivationsAsync() every x milliseconds with y threads");
AbstractPageServlet ps = new GlobalsPageServlet();
ThreadLocalPage.set(ps);
ps.initRequestVars();
hibSession = utils.HibernateUtil.getCurrentSession();
hibSession.beginTransaction();
if (GlobalVariables.initGlobalVars(ps.envGlobalAndSession,
utils.HibernateUtil.getCurrentSession())) {
java.io.PrintWriter out = new java.io.PrintWriter(System.out);
ThreadLocalOut.push(out);
webdsl.generated.functions.updateDerivationsAsyncThread_
.updateDerivationsAsyncThread_(thisThread);
utils.HibernateUtil.getCurrentSession().getTransaction().commit();
ThreadLocalOut.popChecked(out);
ps.invalidatePageCacheIfNeeded();
}
} catch (org.hibernate.StaleStateException
| org.hibernate.exception.LockAcquisitionException ex) {
org.webdsl.logging.Logger
.error("updateDerivationsAsync() database collision, rescheduling");
Settings.reschedule(thisThread);
utils.HibernateUtil.getCurrentSession().getTransaction().rollback();
} catch (Exception ex) {
org.webdsl.logging.Logger.error(ex.getClass().getCanonicalName());
org.webdsl.logging.Logger.error("exception occured while executing timed function: "
+ "invoke updateDerivationsAsync() every x milliseconds");
org.webdsl.logging.Logger.error("exception message: " + ex.getMessage(), ex);
utils.HibernateUtil.getCurrentSession().getTransaction().rollback();
} finally {
org.webdsl.servlet.ServletState.scheduledTaskEnded();
ThreadLocalPage.set(null);
}
}
}
}
};
}
private void removeWorker(int index) {
if (schedules.get(index) != null) {
System.out.println("Removing Worker " + index);
schedules.get(index).cancel(false);
schedules.remove(index);
}
}
public void shutdown() {
setNumWorkers(0);
ex.shutdown();
}
}
| [
"dc.harkes@gmail.com"
] | dc.harkes@gmail.com |
95c830815acd794b076d4a18bfd240d5c66cb2fe | 3260347f876bb74d768abe68d546971ae511af6b | /ServerModel.java | 8b696be44ace3216d30b73e0ece7c37f2a61c6f1 | [] | no_license | fanzhang312/csci5105_RMI | 8d42f1b20720c5af16637231655a17d9e5c0bcd3 | da195e34559e0a5cfbe58c0956b7c812405979ef | refs/heads/master | 2020-05-18T18:00:16.540212 | 2013-02-25T23:41:01 | 2013-02-25T23:41:01 | 8,168,744 | 1 | 0 | null | 2013-02-25T03:12:08 | 2013-02-12T22:26:40 | Java | UTF-8 | Java | false | false | 443 | java | /**
* ServerModel is used to store server information: IP, BindingName, Port
*
* @author Fan Zhang, Zhiqi Chen
*
*/
public class ServerModel {
String ip;
String bindingName;
int port;
public ServerModel(String ip, String bindingName, String port){
this.ip = ip.trim();
this.bindingName = bindingName.trim();
this.port = Integer.parseInt(port.trim());
}
public String toString(){
return ip+";"+"bindingName"+";"+port;
}
}
| [
"fanzhang312@gmail.com"
] | fanzhang312@gmail.com |
03eae6770594896db5f4e8840a88a3c3f9ff6407 | 9e9f245076380794519067fe50ad39c237d7388f | /src/part2/ZBug.java | af2c25760cbd2c48a8297a92de443196e2ee6116 | [] | no_license | mmish321/GridWorld | 1435267cda27670d4721d63dd70e03e6a0c84655 | 24dc731229403242dea6fca60c7df2de36d68eef | refs/heads/master | 2020-12-25T03:20:36.377817 | 2016-03-02T05:09:36 | 2016-03-02T05:09:36 | 50,853,798 | 0 | 0 | null | 2016-02-01T16:40:21 | 2016-02-01T16:40:20 | null | UTF-8 | Java | false | false | 809 | java | package part2;
import info.gridworld.actor.Bug;
public class ZBug extends Bug {
private boolean done = false;
private int steps;
private int sideLength;
/**
* Constructs a box bug that traces a square of a given side length
*
* @param length
* the side length
*/
public ZBug(int length) {
steps = 0;
sideLength = length;
}
/**
* Moves to the next location of the square.
*/
public void act() {
if (!done) {
this.setDirection(90);
for (int i = 0; i < sideLength; i++) {
move();
}
this.turn();
this.turn();
this.turn();
for (int i = 0; i < sideLength; i++) {
move();
}
this.turn();
this.turn();
this.turn();
this.turn();
this.turn();
for (int i = 0; i < sideLength; i++) {
move();
}
done = true;
}
}
}
| [
"maom@s.dcsdk12.org"
] | maom@s.dcsdk12.org |
f0d900915b970339f745c59986b0805e12cbb007 | 7fffc39739869f259fe2d103efa05b87739778d1 | /Java/1135.java | 0a29fbdaf1d966088961bb9ab069463600444b5f | [] | no_license | yunbinni/CodeUp | be39b3bd9fbeaa64be2a77a92918ebcc79b1799b | 5cb95442edb2b766de74154e0b91e8e1c236dd13 | refs/heads/main | 2023-08-15T19:02:29.819912 | 2021-10-12T00:50:16 | 2021-10-12T00:50:16 | 366,761,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 298 | java | import java.util.Scanner;
public class Main{
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
if(a>=b) System.out.println(1);
else System.out.println(0);
}
} | [
"yunbin9049@gmail.com"
] | yunbin9049@gmail.com |
524c9a39696378ae1a408a3335d9af6753724c51 | df021ea0028565d96caf98ee36dacde0db956e23 | /src/main/java/com/awesome/service/MypageServiceImpl.java | a934df60034abfdceb3ad1f9ee73da624a7d0d83 | [] | no_license | NohJihyun/awesomeproject | c700b645213d375076323f3dc763f94cbb63d1cc | c44e508661c258821393d3ec147cceb6b156acd3 | refs/heads/master | 2023-06-10T23:10:40.421059 | 2021-07-09T01:41:09 | 2021-07-09T01:41:09 | 381,263,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,107 | java | package com.awesome.service;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.awesome.domain.BookingVO;
import com.awesome.domain.FavoriteVO;
import com.awesome.domain.HotdealStorageVO;
import com.awesome.domain.ReviewVO;
import com.awesome.domain.UsersVO;
import com.awesome.mapper.MypageDAO;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j;
@Log4j
@Service
@AllArgsConstructor
public class MypageServiceImpl implements MypageService {
private MypageDAO mypageDAO;
@Override
public List<BookingVO> getBookingList(String id) {
log.info("getBookingList() ...........");
return mypageDAO.getBookingList(id);
}
@Override
public List<HotdealStorageVO> myhotdeal_sort(String orderby, String id) {
log.info("getHotdealList() ...........");
return mypageDAO.myhotdeal_sort(orderby, id);
}
@Override
public List<FavoriteVO> getFavoriteList(String id) {
log.info("getFavoriteList() ...........");
return mypageDAO.getFavoriteList(id);
}
@Override
public void myhotdeal_cancel(int hdsseq) {
log.info("myhotdeal_cancel() ...........");
mypageDAO.myhotdeal_cancel(hdsseq);
}
@Override
public void myhotdeal_use(int hdsseq) {
log.info("myhotdeal_use() ...........");
mypageDAO.myhotdeal_use(hdsseq);
}
@Override
public List<HotdealStorageVO> getHotdealList(String id) {
log.info("getHotdealList() ...........");
return mypageDAO.getHotdealList(id);
}
@Override
public void favorite_cancel(int rscode) {
log.info("favorite_cancel() ...........");
mypageDAO.favorite_cancel(rscode);
}
@Override
public void booking_cancel(int bkcode) {
log.info("booking_cancel() ...........");
mypageDAO.booking_cancel(bkcode);
}
@Override
public List<BookingVO> getReviewList(String id) {
log.info("getReviewList() ...........");
return mypageDAO.getReviewList(id);
}
@Override
public void submit_review(MultipartHttpServletRequest request) {
}
@Override
public void insertReview(ReviewVO reviewVO) {
log.info("insertReview().........");
mypageDAO.insertReview(reviewVO);
}
@Override
public void uploadFile(MultipartHttpServletRequest request, MultipartFile[] file, int rvcode) {
String uploadPath = request.getServletContext().getRealPath("/resources/assets/img/reviewpic");
log.info(uploadPath);
String fileOriginName = "";
String fileMultiName = "";
HashMap<String, Integer> reviewpicMap = new HashMap<String, Integer>(); // rsimg, rscode 를 담을 컬렉션
for (int i = 0; i < file.length; i++) {
fileOriginName = file[i].getOriginalFilename();
log.info("기존 파일명 : " + fileOriginName);
// 확장자명
String extension = fileOriginName.split("\\.")[1];
// fileOriginName에 식당코드 + . + 확장자명으로 저장시킴. 예) 300-1.jpg
fileOriginName = rvcode + "-" + i + "." + extension;
log.info("변경된 파일명 : " + fileOriginName);
File f = new File(uploadPath + "\\" + fileOriginName);
try {
file[i].transferTo(f);
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
reviewpicMap.put(fileOriginName, rvcode); // hashmap 객체에 저장 rsimg(키), rscode(값)
}
HashMap<String, Object> dbParams = new HashMap<String, Object>();
dbParams.put("reviewpicList", reviewpicMap);
log.info("reviewpicList.size()>>>" + reviewpicMap.size());
// 식당이미지 DB저장
mypageDAO.insertReviewPic(dbParams);
}
@Override
public UsersVO getMyinfo(String id) {
log.info("getMyinfo() ...........");
return mypageDAO.getMyinfo(id);
}
@Override
public void update_user(UsersVO usersVO) {
log.info("update_user().........");
mypageDAO.update_user(usersVO);
}
@Override
public void uploadUserPic(MultipartHttpServletRequest request, MultipartFile file, String id) {
String uploadPath = request.getServletContext().getRealPath("/resources/assets/img/userpic");
log.info(uploadPath);
//파일처리 /////////////////////////////////////////////
String fileOriginName = "";
String userpicList;
fileOriginName = file.getOriginalFilename();
log.info("기존 파일명 : " + fileOriginName);
// 확장자명
String extension = fileOriginName.split("\\.")[1];
// fileOriginName에 식당코드 + . + 확장자명으로 저장시킴. 예) 300-1.jpg
fileOriginName = id + "." + extension;
log.info("변경된 파일명 : " + fileOriginName);
File f = new File(uploadPath + "\\" + fileOriginName);
try {
file.transferTo(f);
} catch (IllegalStateException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
userpicList = fileOriginName;
mypageDAO.insertUserPic(userpicList);
}
@Override
public ReviewVO showReview(int rvcode) {
log.info("show_review().........");
return mypageDAO.showReview(rvcode);
}
}
| [
"blue900823@gmail.com"
] | blue900823@gmail.com |
0ca62bf040a303604fd916c71a7c6745565a2aa1 | e09f51d7293ba3d357a096fec4a091a3aaa295be | /src/main/java/product/impl/Pepsi.java | 9856f2f6932d4391a73199d8798a152df43d6b52 | [] | no_license | aatulgoel/vendingmachine | 359d850fa4c75c2341b937d8723059049ec69b83 | b205dcb15396f7608c7217fc242c46bf86597e59 | refs/heads/master | 2020-04-17T13:21:58.698390 | 2019-01-20T04:11:51 | 2019-01-20T04:11:51 | 166,612,585 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 687 | java | package product.impl;
import product.Product;
import java.util.Objects;
public class Pepsi implements Product {
private String name = "Pepsi";
private Integer price = 120;
public String name() {
return name;
}
public Integer price() {
return price;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Pepsi pepsi = (Pepsi) o;
return Objects.equals(name, pepsi.name) &&
Objects.equals(price, pepsi.price);
}
@Override
public int hashCode() {
return Objects.hash(name, price);
}
}
| [
"aatulgoel@gmail.com"
] | aatulgoel@gmail.com |
073bdffd344d0e8a2add42b2517e4012fa093441 | 7677b9d4a79af4a105d51d48b28494d1aa0754bb | /story_utils/src/test/java/com/xuhui/story_utils/ExampleUnitTest.java | 79de8c97ab4e028c39bcff2aa4f21c7e88ce23a9 | [] | no_license | StoryGithub/StoryUtil | de030e15827427a4280e432a37bc98878c073fb3 | efa1b4829658b006da988336d452b91762cddd4f | refs/heads/master | 2020-08-17T14:59:18.181093 | 2019-10-17T06:04:46 | 2019-10-17T06:04:46 | 215,677,750 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 382 | java | package com.xuhui.story_utils;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"kxq_work@163.com"
] | kxq_work@163.com |
a3902c7ec0e91cb22ac8afe4929251b3a0ef364b | b6f5ad1e4feb2877cc0f7910fe7c3ef33864fbab | /src/main/java/com/aif/model/weight/AbstractWeightItem.java | 419a86b28281137765f2f1ede5581a47497db10b | [] | no_license | b0no1/Artificial-Intelligence-FrameWork | a027ecb9656553dc2ce69519117988508f527b51 | f1ce9fe5278a05f24ee921ec9591a4558358a95f | refs/heads/master | 2021-01-12T08:10:57.491493 | 2013-05-19T18:14:10 | 2013-05-19T18:14:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.aif.model.weight;
import com.aif.model.memory.short_time.Word;
public abstract class AbstractWeightItem {
static final double DEFAULT_INFLUENT_LEVEL = 1.0;
public abstract double calculateWeight(Word word);
public double getInfluent(){
return AbstractWeightItem.DEFAULT_INFLUENT_LEVEL;
}
}
| [
"Viacheslav@b0noI.com"
] | Viacheslav@b0noI.com |
ffcdfdd870161ee30f6f0fe4a3131c47701841a1 | 3270d68aec3ec459a0bb40670587e8aaa431dc20 | /src/binarytree/BinaryTreeLevelOrderTraversal.java | 0789c5c9e888a72b7344e108bf8d28d92510f1ef | [
"MIT"
] | permissive | shogo54/leetcode | d4a215af31c6535eb9a50671166bcfb1a7758dfb | f44eacd5028c9eaeee3d1a1d84d423a876edd8bb | refs/heads/master | 2021-07-13T11:14:59.641831 | 2020-07-10T06:11:31 | 2020-07-10T06:11:31 | 181,615,968 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,176 | java | package binarytree;
import java.util.*;
import binarytree.BinaryTreeTest.TreeNode;
/**
* @author Shogo Akiyama
* Solved on 08/18/2019
*
* 102. Binary Tree Level Order Traversal
* https://leetcode.com/problems/binary-tree-level-order-traversal/
* Difficulty: Medium
*
* Approach: Recursion & DFS
* Runtime: 1 ms, faster than 89.30% of Java online submissions for Binary Tree Level Order Traversal.
* Memory Usage: 36.2 MB, less than 100.00% of Java online submissions for Binary Tree Level Order Traversal.
*
* @see BinaryTreeTest#testBinaryTreeLevelOrderTraversal()
*/
public class BinaryTreeLevelOrderTraversal {
Map<Integer, List<Integer>> map = new HashMap<Integer, List<Integer>>();
public List<List<Integer>> levelOrder(TreeNode root) {
depth(root, 0);
return new ArrayList<List<Integer>>(map.values());
}
private void depth(TreeNode node, int count) {
if (node == null) {
return;
}
if (!map.containsKey(count)) {
map.put(count, new ArrayList<Integer>());
}
map.get(count).add(node.val);
if (node.left != null) {
depth(node.left, count + 1);
}
if (node.right != null) {
depth(node.right, count + 1);
}
}
}
| [
"sakiyama@knox.edu"
] | sakiyama@knox.edu |
3acc00adbb801307f25366b6b41dc620b2f670ca | 9208ba403c8902b1374444a895ef2438a029ed5c | /sources/androidx/media/AudioAttributesImplApi21.java | d41089aaf21d10d0254b137405480c08003b43eb | [] | no_license | MewX/kantv-decompiled-v3.1.2 | 3e68b7046cebd8810e4f852601b1ee6a60d050a8 | d70dfaedf66cdde267d99ad22d0089505a355aa1 | refs/heads/main | 2023-02-27T05:32:32.517948 | 2021-02-02T13:38:05 | 2021-02-02T13:44:31 | 335,299,807 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,701 | java | package androidx.media;
import android.media.AudioAttributes;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.RestrictTo.Scope;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@RequiresApi(21)
@RestrictTo({Scope.LIBRARY_GROUP})
public class AudioAttributesImplApi21 implements AudioAttributesImpl {
private static final String TAG = "AudioAttributesCompat21";
static Method sAudioAttributesToLegacyStreamType;
@RestrictTo({Scope.LIBRARY_GROUP})
public AudioAttributes mAudioAttributes;
@RestrictTo({Scope.LIBRARY_GROUP})
public int mLegacyStreamType;
AudioAttributesImplApi21() {
this.mLegacyStreamType = -1;
}
AudioAttributesImplApi21(AudioAttributes audioAttributes) {
this(audioAttributes, -1);
}
AudioAttributesImplApi21(AudioAttributes audioAttributes, int i) {
this.mLegacyStreamType = -1;
this.mAudioAttributes = audioAttributes;
this.mLegacyStreamType = i;
}
static Method getAudioAttributesToLegacyStreamTypeMethod() {
try {
if (sAudioAttributesToLegacyStreamType == null) {
sAudioAttributesToLegacyStreamType = AudioAttributes.class.getMethod("toLegacyStreamType", new Class[]{AudioAttributes.class});
}
return sAudioAttributesToLegacyStreamType;
} catch (NoSuchMethodException unused) {
return null;
}
}
public Object getAudioAttributes() {
return this.mAudioAttributes;
}
public int getVolumeControlStream() {
if (VERSION.SDK_INT >= 26) {
return this.mAudioAttributes.getVolumeControlStream();
}
return AudioAttributesCompat.toVolumeStreamType(true, getFlags(), getUsage());
}
public int getLegacyStreamType() {
int i = this.mLegacyStreamType;
if (i != -1) {
return i;
}
Method audioAttributesToLegacyStreamTypeMethod = getAudioAttributesToLegacyStreamTypeMethod();
String str = TAG;
if (audioAttributesToLegacyStreamTypeMethod == null) {
StringBuilder sb = new StringBuilder();
sb.append("No AudioAttributes#toLegacyStreamType() on API: ");
sb.append(VERSION.SDK_INT);
Log.w(str, sb.toString());
return -1;
}
try {
return ((Integer) audioAttributesToLegacyStreamTypeMethod.invoke(null, new Object[]{this.mAudioAttributes})).intValue();
} catch (IllegalAccessException | InvocationTargetException e) {
StringBuilder sb2 = new StringBuilder();
sb2.append("getLegacyStreamType() failed on API: ");
sb2.append(VERSION.SDK_INT);
Log.w(str, sb2.toString(), e);
return -1;
}
}
public int getRawLegacyStreamType() {
return this.mLegacyStreamType;
}
public int getContentType() {
return this.mAudioAttributes.getContentType();
}
public int getUsage() {
return this.mAudioAttributes.getUsage();
}
public int getFlags() {
return this.mAudioAttributes.getFlags();
}
@NonNull
public Bundle toBundle() {
Bundle bundle = new Bundle();
bundle.putParcelable("androidx.media.audio_attrs.FRAMEWORKS", this.mAudioAttributes);
int i = this.mLegacyStreamType;
if (i != -1) {
bundle.putInt("androidx.media.audio_attrs.LEGACY_STREAM_TYPE", i);
}
return bundle;
}
public int hashCode() {
return this.mAudioAttributes.hashCode();
}
public boolean equals(Object obj) {
if (!(obj instanceof AudioAttributesImplApi21)) {
return false;
}
return this.mAudioAttributes.equals(((AudioAttributesImplApi21) obj).mAudioAttributes);
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("AudioAttributesCompat: audioattributes=");
sb.append(this.mAudioAttributes);
return sb.toString();
}
public static AudioAttributesImpl fromBundle(Bundle bundle) {
if (bundle == null) {
return null;
}
AudioAttributes audioAttributes = (AudioAttributes) bundle.getParcelable("androidx.media.audio_attrs.FRAMEWORKS");
if (audioAttributes == null) {
return null;
}
return new AudioAttributesImplApi21(audioAttributes, bundle.getInt("androidx.media.audio_attrs.LEGACY_STREAM_TYPE", -1));
}
}
| [
"xiayuanzhong@gmail.com"
] | xiayuanzhong@gmail.com |
646b35b4126c334db5eb3444db3e83186abfbc3a | a2d1df7ba16a6596e110e6ce8f69a85b0e868905 | /src/oocamp/Token.java | 3c2698a1ffbd43b95c4c4e96dac498a0ceb891c8 | [] | no_license | freewind/oocamp | e0041d4b2b0e44f06d0ae144b8dfbc5ed4683f46 | 91949cc44df81eddda7b40fca3908155151a401e | refs/heads/master | 2021-01-01T19:43:29.802163 | 2014-06-27T13:55:00 | 2014-06-27T13:55:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45 | java | package oocamp;
public interface Token {
}
| [
"peng.li@rea-group.com"
] | peng.li@rea-group.com |
6a11f1046cd90a096f5c374682941e1d96b4d627 | bdc6fdc6cf28405ae6cac1c21a89ee3c62510fa3 | /TimchenkoProj/src/main/java/pages/EditSparePage.java | 95c588b8217a5c78c89e89bc4386e9255ea484ce | [] | no_license | SeleniumQALight/G37Project | a89ca5d01dcbe15f902f672d43e8a06c884dbe9c | 4f9c591da64049aaf0a3bfba79b2461ece45b20f | refs/heads/master | 2020-04-03T07:22:09.330570 | 2018-12-21T08:31:19 | 2018-12-21T08:31:19 | 155,100,488 | 1 | 0 | null | 2018-12-21T08:31:20 | 2018-10-28T18:09:21 | Java | UTF-8 | Java | false | false | 1,241 | java | package pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class EditSparePage extends ParentPage {
@FindBy (id = "spares_spareName")
private WebElement spareNameInput;
@FindBy (id = "spares_spareType")
private WebElement spareTypeDropDown;
@FindBy (name = "delete")
private WebElement buttonDelete;
@FindBy (name = "add")
private WebElement buttonCreate;
public EditSparePage(WebDriver webDriver) {
super(webDriver, "/dictionary/spares/edit");
}
public boolean checkSpareNameInInput (String spareName) {
return spareNameInput.getAttribute("value").equals(spareName);
}
public void clickButtonDelete () {
actionsWithOurElements.clickOnElement (buttonDelete);
}
public void enterSpareInToInput(String spareName) {
actionsWithOurElements.enterTextIntoElement(spareNameInput,spareName);
}
public void clickButtonCreate() {
actionsWithOurElements.clickOnElement(buttonCreate);
}
public void selectSpareTypeInDropDown(String spareType) {
actionsWithOurElements.selectTextInDropDown (spareTypeDropDown, spareType);
}
}
| [
"successor@syneforge.com"
] | successor@syneforge.com |
73f1be5eba6a577adb90a435141cca4f60e64344 | a5b807d69b3785e017a251964d47a4542b5598c1 | /File_System_Server/src/FSS/WriteRequest.java | e7cbdf9bf72670750c70f9aae4755e1e3fcc33e2 | [] | no_license | Prashant00005/Distributed_File_Systems | d08d20984eb9479e8d6bc54f995e1a084da31dbb | 2b328d636d0a5db6ce2f6d09f6db6cb9826d62e1 | refs/heads/master | 2021-08-30T03:21:45.586917 | 2017-12-15T21:24:08 | 2017-12-15T21:24:08 | 113,518,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,299 | java | package FSS;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class WriteRequest {
String filename;
String token;
String encryptedUsername;
String directory;
String filecontent;
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getToken() {
return token;
}
public void setToken(String token) {
this.token = token;
}
public String getEncryptedUsername() {
return encryptedUsername;
}
public void setEncryptedUsername(String encryptedUsername) {
this.encryptedUsername = encryptedUsername;
}
public String getDirectory() {
return directory;
}
public void setDirectory(String directory) {
this.directory = directory;
}
public String getFilecontent() {
return filecontent;
}
public void setFilecontent(String filecontent) {
this.filecontent = filecontent;
}
public String getJsonString() {
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
String req = gson.toJson(this);
return req;
}
public WriteRequest getClassFromJsonString(String replyInString) {
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
WriteRequest resp = gson.fromJson(replyInString, WriteRequest.class);
return resp;
}
} | [
"aggarwap@tcd.ie"
] | aggarwap@tcd.ie |
feb0ae6223764d6925fa8c2194c337b502fb7f54 | 3d489c8023d03146b5d6be925f3f17a8bf21c719 | /health-base/src/main/java/com/theus/health/base/model/dto/system/dict/SysDictDTO.java | aa2b1d74be70e8e70eb0dccdd4c16497c717bd10 | [] | no_license | tw-health-team/health-platform | c1f75f4a1064c818ba21501eb8698129caaca6c6 | 8a00edafa5e64a343315aeb2a64d177b5974c9a3 | refs/heads/master | 2022-06-27T05:23:38.916294 | 2021-03-24T02:24:11 | 2021-03-24T02:24:11 | 215,287,126 | 0 | 0 | null | 2022-02-09T22:18:47 | 2019-10-15T11:57:00 | Java | UTF-8 | Java | false | false | 281 | java | package com.theus.health.base.model.dto.system.dict;
import lombok.Data;
/**
* @author tangwei
* @date 2019-10-16 21:00
*/
@Data
public class SysDictDTO {
private String classCode;
private String itemName;
private String itemValue;
private Integer sort;
}
| [
"angel21magic@163.com"
] | angel21magic@163.com |
98ee0b9583041653ba1db020d19239cfa05bbc55 | b31ae69273dca4b371c084c06e3fcbd661a5d064 | /business/src/main/java/pt/uc/dei/aor/project/business/filter/PositionFilter.java | de3efad652ac7e0e2266afe24e0c608168c3462e | [] | no_license | kwakiutlCS/jobapplication | d7b9fc557427fee889c32546856df00826d0af2c | 53a0b2c9976d89abd8d0eaefaea600840f4a7dc5 | refs/heads/master | 2020-05-18T16:43:57.655130 | 2015-10-03T21:37:00 | 2015-10-03T21:37:00 | 40,110,712 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,492 | java | package pt.uc.dei.aor.project.business.filter;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import pt.uc.dei.aor.project.business.exception.IllegalFilterParamException;
import pt.uc.dei.aor.project.business.util.Localization;
import pt.uc.dei.aor.project.business.util.PositionState;
import pt.uc.dei.aor.project.business.util.TechnicalArea;
public class PositionFilter extends GenericFilter {
private int code;
private Set<String> titles;
private PositionState state;
private List<Set<Localization>> localizationSets;
private List<Set<TechnicalArea>> areaSets;
private String company;
private Date startDate;
private Date finishDate;
private Set<String> keywords;
public PositionFilter() {
code = -1;
titles = new HashSet<>();
setState(PositionState.OPEN);
areaSets = new ArrayList<>();
localizationSets = new ArrayList<>();
setCompany(null);
startDate = null;
finishDate = null;
keywords = new HashSet<>();
}
// and or section
public void addAreaSet(TechnicalArea area) {
System.out.println(area);
addGenericSet(areaSets, area);
System.out.println(areaSets);
}
public void deleteArea(int setIndex, int pos) throws IllegalFilterParamException {
deleteGenericElement(areaSets, setIndex, pos);
}
public void mergeAreas(int setPos) throws IllegalFilterParamException {
mergeElements(areaSets, setPos);
}
public void splitAreas(int setPos, int pos) throws IllegalFilterParamException {
splitElements(areaSets, setPos, pos);
}
public List<List<TechnicalArea>> getAreaSets() {
return getGenericSets(areaSets);
}
public void addLocalizationSet(Localization localization) {
addGenericSet(localizationSets, localization);
}
public void deleteLocalization(int setIndex, int pos) throws IllegalFilterParamException {
deleteGenericElement(localizationSets, setIndex, pos);
}
public void mergeLocalizations(int setPos) throws IllegalFilterParamException {
mergeElements(localizationSets, setPos);
}
public void splitLocalizations(int setPos, int pos) throws IllegalFilterParamException {
splitElements(localizationSets, setPos, pos);
}
public List<List<Localization>> getLocalizationSets() {
return getGenericSets(localizationSets);
}
// or section
public void addTitle(String title) {
titles.add(title);
}
public List<String> getTitles() {
return new ArrayList<>(titles);
}
public void deleteTitle(int index) {
titles.remove(getTitles().get(index));
}
public void addKeyword(String keyword) {
keywords.add(keyword);
}
public List<String> getKeywords() {
return new ArrayList<>(keywords);
}
public void deleteKeyword(int index) {
keywords.remove(getKeywords().get(index));
}
// getters and setters
public void setCode(int code) {
this.code = code;
}
public int getCode() {
return code;
}
public PositionState getState() {
return state;
}
public void setState(PositionState state) {
this.state = state;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = prepareStartDate(startDate);
}
public Date getFinishDate() {
return finishDate;
}
public void setFinishDate(Date finishDate) {
this.finishDate = prepareFinishDate(finishDate);
}
}
| [
"ricardo.rsr.rodrigues@gmail.com"
] | ricardo.rsr.rodrigues@gmail.com |
d19a9f00ce04c7c3bf584a7562d082bca95fe04c | 52c7bb00d31a8fb0353f1b624485e9112bd1e26f | /Eletrica3/src/br/aplicacao/eletrica/dao/FonteDAO.java | af1ce24be1e375460083953f1ee2999de5392a92 | [] | no_license | davidbentolila/Eletrica3 | 825059941e6ffba98c952e8b65bc5d4eb4d06220 | 178f2c74d006a70777f0b38d9ce264545821a000 | refs/heads/master | 2021-05-05T12:41:11.642507 | 2018-08-02T01:52:11 | 2018-08-02T01:52:11 | 118,271,095 | 0 | 0 | null | 2018-01-20T18:48:03 | 2018-01-20T18:48:03 | null | UTF-8 | Java | false | false | 826 | java | package br.aplicacao.eletrica.dao;
import javax.persistence.NoResultException;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import br.aplicacao.eletrica.modelo.projeto.Fonte;
public class FonteDAO extends AbstractDAO<Fonte> {
public FonteDAO() {
super(Fonte.class);
}
public Fonte getByName(String nome) {
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<Fonte> cq = cb.createQuery(Fonte.class);
Root<Fonte> fonte = cq.from(Fonte.class);
Predicate cond1 = cb.equal(fonte.get("nome"), nome);
cq.where(cond1);
try {
return getEntityManager().createQuery(cq).getSingleResult();
} catch (NoResultException e) {
return null;
}
}
}
| [
"chris@Inspiron"
] | chris@Inspiron |
d61ff6a9b29dd451c2b987da2f5847174725d610 | ccdb80501cb1724a4084f987b7315bb7289e21a0 | /praxis.core/src/net/neilcsmith/praxis/core/interfaces/ServiceManager.java | c588473cbbce51ae17e72742a003822bc16e6574 | [] | no_license | omzo006/praxis | 1f33796b14e968e3de6237441ce8fc6072373a52 | d2e561739dd326ad96b7f61c4a269bcfd6f3804f | refs/heads/master | 2021-01-01T03:36:32.452130 | 2013-12-05T16:55:57 | 2013-12-05T16:55:57 | 56,091,630 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,248 | java | /*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 2010 Neil C Smith.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3 only, as
* published by the Free Software Foundation.
*
* This code 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 3 for more details.
*
* You should have received a copy of the GNU General Public License version 3
* along with this work; if not, see http://www.gnu.org/licenses/
*
*
* Please visit http://neilcsmith.net if you need additional information or
* have any questions.
*/
package net.neilcsmith.praxis.core.interfaces;
import net.neilcsmith.praxis.core.ComponentAddress;
import net.neilcsmith.praxis.core.InterfaceDefinition;
/**
*
* @author Neil C Smith
*/
public interface ServiceManager {
public ComponentAddress findService(InterfaceDefinition info) throws ServiceUnavailableException;
public ComponentAddress[] findAllServices(InterfaceDefinition info) throws ServiceUnavailableException;
}
| [
"neilcsmith.net@googlemail.com"
] | neilcsmith.net@googlemail.com |
6370b073428ce8b5b7a5d9fea6bb4a17f1534a66 | 7f8c323de19a42a0da033c8662b9a5165ba5ff75 | /app/src/main/java/technobytes/com/eloquence/rest/models/RoomCollection.java | d268aa9e12c77f7e8c20996e0354a355c07008f3 | [] | no_license | EloquencePMS/EloquenceAndroid | eee3ff2e86d92a51a66fc709b1d1538cc7b74904 | c43eeed7e1ed0a912f66590d4e086e3156b0ca79 | refs/heads/master | 2020-12-31T07:43:24.012399 | 2016-05-05T22:39:12 | 2016-05-05T22:39:12 | 57,144,123 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,105 | java | package technobytes.com.eloquence.rest.models;
/**
* Created by seisan on 5/5/16.
*/
public class RoomCollection {
HousekeepingStatus houseeepingStatus;
int roomNumber,houseKeepingStatusId;
RoomType roomType;
public HousekeepingStatus getHouseeepingStatus() {
return houseeepingStatus;
}
public void setHouseeepingStatus(HousekeepingStatus houseeepingStatus) {
this.houseeepingStatus = houseeepingStatus;
}
public int getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(int roomNumber) {
this.roomNumber = roomNumber;
}
public int getHouseKeepingStatusId() {
return houseKeepingStatusId;
}
public void setHouseKeepingStatusId(int houseKeepingStatusId) {
this.houseKeepingStatusId = houseKeepingStatusId;
}
public RoomType getRoomType() {
return roomType;
}
public void setRoomType(RoomType roomType) {
this.roomType = roomType;
}
}
| [
"mleffert@lhup.edu"
] | mleffert@lhup.edu |
8b2c4372e10830718ca92511f2467ef7e8194f52 | f2abb8e6c4fed28ff22cf4946984ed48bc83064b | /src/main/java/com/my1rm/model/pojo/AttemptPojo/GetDataForGraphPOJO.java | efaa42026e7776743a53318035c7ef0e6ee562ab | [] | no_license | DuS4NN/My1RM | f89d969a47293ebcbf42a60c73354ca27d2304b4 | 886e68d4b68bb23cbd60ecafb01b5cbf53bd6001 | refs/heads/main | 2023-07-26T01:16:24.371628 | 2021-09-02T12:14:00 | 2021-09-02T12:14:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 270 | java | package com.my1rm.model.pojo.AttemptPojo;
import java.sql.Timestamp;
public class GetDataForGraphPOJO {
public long attemptId;
public Timestamp attemptDate;
public double attemptWeight;
public byte attemptSuccess;
public short attemptRepetitions;
} | [
"dusan.orlicek@gmail.com"
] | dusan.orlicek@gmail.com |
51f915e9884d369aae0b576dfff954a1c55a7fe0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/4/4_85ae7734a6160a2eda4799164abec36688807bcb/RootHandler/4_85ae7734a6160a2eda4799164abec36688807bcb_RootHandler_t.java | fd8accace6d1c27c88cba1b67340553b062d8a90 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 8,626 | java | package ch.amana.android.cputuner.hw;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Writer;
import android.content.Context;
import android.os.Environment;
import android.text.TextUtils;
import ch.amana.android.cputuner.helper.ScriptCache;
import ch.amana.android.cputuner.helper.SettingsStorage;
import ch.amana.android.cputuner.log.Logger;
public class RootHandler {
public static final String NOT_AVAILABLE = "not available";
private static final String NEW_LINE = "\n";
private static boolean isRoot = false;
private static boolean checkedSystemApp = false;
private static boolean isSystemApp = false;
private static Writer logWriter;
public static boolean waitForPrcess = false;
public static boolean execute(String cmd) {
return execute(cmd, null, null);
}
public static boolean execute(String cmd, StringBuilder result) {
return execute(cmd, result, result);
}
public static boolean execute(String cmd, StringBuilder out, StringBuilder err) {
try {
if (Logger.DEBUG) {
Logger.v("Running " + cmd);
}
if (ScriptCache.isRecoding()) {
ScriptCache.recordLine(cmd);
return true;
}
Process p = new ProcessBuilder()
.command("su")
.start();
// p = Runtime.getRuntime().exec("su");
DataOutputStream os = new DataOutputStream(p.getOutputStream());
if (!cmd.endsWith(NEW_LINE)) {
cmd += NEW_LINE;
}
os.writeBytes(cmd);
os.writeBytes("exit\n");
os.flush();
if (waitForPrcess) {
try {
p.waitFor();
} catch (InterruptedException e) {
}
}
if (Logger.DEBUG) {
String msg = "Command >" + cmd.trim() + "< returned " + p.exitValue();
writeLog(msg);
Logger.i(msg);
}
if (out != null) {
copyStreamToLog("OUT", p.getInputStream(), out);
if (out != null && !TextUtils.isEmpty(out)) {
Logger.v(cmd.trim() + " stdout: " + out);
}
}
if (err != null) {
copyStreamToLog("ERR", p.getErrorStream(), err);
if (err != null && !TextUtils.isEmpty(err)) {
Logger.v(cmd.trim() + " stderr: " + err);
}
}
return true;
} catch (FileNotFoundException e) {
Logger.e("File not found in " + cmd);
} catch (IOException e) {
Logger.e("IO error from: " + cmd, e);
}
return false;
}
private static void copyStreamToLog(String preAmp, InputStream in, StringBuilder result) {
if (in == null) {
return;
}
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
String line;
line = reader.readLine();
while (line != null && !line.trim().equals("")) {
if (Logger.DEBUG) {
Logger.v(preAmp + ": " + line);
writeLog(line);
}
if (result != null) {
result.append(line);
}
line = reader.readLine();
}
reader.close();
} catch (IOException e) {
Logger.w("Cannot read process stream", e);
}
}
public static void writeLog(String line) {
if (logWriter != null) {
try {
logWriter.write(line);
logWriter.write("\n");
logWriter.flush();
//Runtime.getRuntime().exec("sync");
} catch (Exception e) {
Logger.w("Cannot write >" + line + "< to log file", e);
}
}
}
public static boolean isRoot() {
if (!isRoot) {
isRoot = execute("ls -l -d /");
}
return isRoot;
}
public static boolean isSystemApp(Context ctx) {
if (!checkedSystemApp) {
String[] fileList = findAppPath(ctx, Environment.getRootDirectory());
isSystemApp = fileList != null && fileList.length > 0;
checkedSystemApp = true;
Logger.i("Is system app: " + isSystemApp);
}
return isSystemApp;
}
public static String[] findAppPath(Context ctx, File root) {
if (!root.isDirectory()) {
return new String[] {};
}
File appsRoot = new File(root, "app");
final String packageName = ctx.getPackageName();
String[] fileList = appsRoot.list(new FilenameFilter() {
@Override
public boolean accept(File dir, String filename) {
return filename.contains(packageName);
}
});
return fileList;
}
static String readFile(File file) {
if (file == null || file == CpuHandler.DUMMY_FILE || !file.exists()) {
return NOT_AVAILABLE;
}
synchronized (file) {
StringBuilder val = new StringBuilder();
BufferedReader reader = null;
try {
ensureAccess(file);
if (file.canRead()) {
reader = new BufferedReader(new FileReader(file), 256);
String line = reader.readLine();
while (line != null && !line.trim().equals("")) {
if (Logger.DEBUG) {
writeLog(line);
}
if (val.length() > 0) {
val.append("\n");
}
val.append(line);
line = reader.readLine();
}
reader.close();
} else if (execute("cat " + file.getAbsolutePath(), val, null)) {
} else {
if (Logger.DEBUG) {
String msg = "Cannot read from file >" + file + "< it does not exist.";
Logger.v(msg);
writeLog(msg);
}
}
} catch (Throwable e) {
Logger.e("Cannot open file for reading ", e);
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
Logger.w("Cannot close reader...", e);
}
reader = null;
}
}
String ret = val.toString();
if (ret.trim().equals("")) {
ret = NOT_AVAILABLE;
}
if (Logger.DEBUG) {
String msg = "Reading file " + file + " yielded >" + ret + "<";
Logger.v(msg);
writeLog(msg);
}
return ret;
}
}
public static boolean writeFile(File file, String val) {
if (file == CpuHandler.DUMMY_FILE || !file.exists()) {
if (Logger.DEBUG) {
Logger.logStacktrace(file.getAbsolutePath() + " does not exist!");
}
return false;
}
String cmd = "echo " + val + " > " + file.getAbsolutePath();
if (ScriptCache.isRecoding()) {
ScriptCache.recordLine(cmd);
return true;
}
String readFile = readFile(file);
if (val == null || val.equals(readFile) || RootHandler.NOT_AVAILABLE.equals(readFile)) {
return false;
}
synchronized (file) {
ensureAccess(file);
if (file.canWrite()) {
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(file), 256);
writer.write(val);
writer.flush();
return true;
} catch (IOException e) {
Logger.w("Could not write " + file.getAbsolutePath() + " tring exec echo", e);
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
}
}
}
}
if (Logger.DEBUG) {
Logger.w("Setting " + file.getAbsolutePath() + " to " + val);
}
return RootHandler.execute(cmd);
}
}
private static void ensureAccess(File file) {
if (SettingsStorage.getInstance().isMakeFilesWritable() && !file.canWrite()) {
String absolutePath = file.getAbsolutePath();
Logger.i("Changing permissions of " + absolutePath);
boolean wait = waitForPrcess;
waitForPrcess = true;
int gid = SettingsStorage.getInstance().getUserId();
StringBuilder cmd = new StringBuilder();
if (gid > -1) {
cmd.append("chgrp " + gid + " " + absolutePath + " ; ");
}
cmd.append("chmod 775 " + absolutePath);
RootHandler.execute(cmd.toString());
Logger.i("Changed permissions of " + absolutePath);
waitForPrcess = wait;
}
}
public static void setLogLocation(File file) {
if (file == null) {
logWriter = null;
return;
}
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
Logger.w("Cannot creat log file " + file.toString(), e);
logWriter = null;
return;
}
}
if (file.isFile() && file.canWrite()) {
if (Logger.DEBUG) {
Logger.i("Opening logfile " + file.getAbsolutePath());
}
try {
logWriter = new FileWriter(file);
} catch (IOException e) {
Logger.w("Cannot open logfile", e);
}
} else {
logWriter = null;
}
}
public static void clearLogLocation() {
if (logWriter != null) {
try {
logWriter.flush();
logWriter.close();
} catch (IOException e) {
Logger.w("Cannot close logfile", e);
}
}
logWriter = null;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
f0038f6903c42f19b689512bab25479457e4938f | 8d571d9eb9de0cc964c8e1149459866121326142 | /app/src/main/java/com/example/administrator/layzyweek/selfadapter/SecondCategoryAdapter.java | d442ebff793d09a49d8c15e2d44bf39349d43921 | [] | no_license | yulu1121/LayzyWeek | f82698a7655fea1e5743bbff8efd5f937de37765 | 6831e098e51d56acc244f7dc9aa4c0cc785d8bfd | refs/heads/master | 2021-01-09T05:18:44.506014 | 2017-02-07T11:03:21 | 2017-02-07T11:03:21 | 80,798,519 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,656 | java | package com.example.administrator.layzyweek.selfadapter;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.administrator.layzyweek.R;
import com.example.administrator.layzyweek.activities.FirstFormationActivity;
import com.example.administrator.layzyweek.entries.FirstPage;
import com.example.administrator.layzyweek.utils.ImageLoader;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
*
* Created by Administrator on 2017/2/5.
*/
public class SecondCategoryAdapter extends BaseAdapter{
private Context context;
private List<FirstPage.ResultBean> mlist;
private LayoutInflater inflater;
public SecondCategoryAdapter(Context context,List<FirstPage.ResultBean> list){
this.context = context;
this.mlist = list;
inflater = LayoutInflater.from(context);
}
@Override
public int getCount() {
return null==mlist?0:mlist.size();
}
@Override
public Object getItem(int position) {
return mlist.get(position);
}
@Override
public long getItemId(int position) {
return mlist.get(position).getLeo_id();
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view=convertView;
final ViewHolder viewHolder;
if(null==view){
view = inflater.inflate(R.layout.second_category_item,parent,false);
viewHolder = new ViewHolder(view);
}else {
viewHolder = (ViewHolder) view.getTag();
}
final FirstPage.ResultBean bean = mlist.get(position);
//向详情界面传递数据
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(context, FirstFormationActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("leo_id",bean.getLeo_id());
intent.putExtra("formation",bundle);
context.startActivity(intent);
}
});
viewHolder.mainTitle.setText(bean.getTitle());
viewHolder.mainCompany.setText(bean.getPoi_name()+"\t·\t"+bean.getCategory());
viewHolder.clicksMain.setText(String.valueOf(bean.getCollected_num())+"人收藏");
viewHolder.priceMain.setText("¥"+String.valueOf(bean.getPrice()));
String imageUrlOne = bean.getFront_cover_image_list().get(0);
viewHolder.mainImageView.setTag(imageUrlOne);
ImageLoader.loadImage(imageUrlOne,450,150,new ImageLoader.ImageListener() {
@Override
public void ImageComplete(Bitmap bitMap, String Url) {
if(Url.equals(viewHolder.mainImageView.getTag())){
viewHolder.mainImageView.setImageBitmap(bitMap);
}
}
});
return view;
}
class ViewHolder{
@BindView(R.id.second_backgroud)
ImageView mainImageView;
@BindView(R.id.second_title)
TextView mainTitle;
@BindView(R.id.second_company)
TextView mainCompany;
@BindView(R.id.clicks_second)
TextView clicksMain;
@BindView(R.id.price_second)
TextView priceMain;
ViewHolder(View view){
view.setTag(this);
ButterKnife.bind(this,view);
}
}
}
| [
"626899174@qq.com"
] | 626899174@qq.com |
a641d51e04bcd2a43fc6ceefbab9c6911087efe4 | 6246192bd74586581c3917cd4628d6d70b8ac348 | /src/main/java/br/com/testePratico/controller/CityController.java | 02df22af0398a115cb59ebf8b90d90596161796b | [] | no_license | HelderRodriguesMendes/API_CadasdroEmpresas | 8e92f2929ee37b4b25181d1df1012f7b05cee435 | 1dfd9c514c03bd63fe6e9b8866fc6961301f76a8 | refs/heads/main | 2023-01-10T01:01:01.676139 | 2020-11-09T03:43:00 | 2020-11-09T03:43:00 | 307,816,368 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,261 | java | package br.com.testePratico.controller;
import java.util.List;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import br.com.testePratico.model.City;
import br.com.testePratico.service.CityService;
@RestController
@RequestMapping("/city")
public class CityController {
@Autowired
CityService cityService;
// SALVA UMA CITY NO BANCO E NO ARQUIVO DE LOG
@PostMapping(value = "/cadastrar", produces = "application/json")
public ResponseEntity<Boolean> cadastrar(@Valid @RequestBody City city) {
return new ResponseEntity<Boolean>(cityService.cadastrar(city, "cadastrar"), HttpStatus.CREATED);
}
// BUSCA TODOS AS CITYS CADASTRADAS
@GetMapping("/findAllCity")
public ResponseEntity<List<City>> findAllCity() {
List<City> CITYS = cityService.findAllCity();
return new ResponseEntity<List<City>>(CITYS, HttpStatus.OK);
}
// BUSCA POR NOME AS CITYS CADASTRADAS
@GetMapping("/findAllCity/name")
public ResponseEntity<List<City>> cityName(@RequestParam String name) {
List<City> CITYS = cityService.cityName(name);
return new ResponseEntity<List<City>>(CITYS, HttpStatus.OK);
}
// BUSCA AS CITYS POR STATES
@GetMapping("/findAllCityState/name")
public ResponseEntity<List<City>> cityNameState(@RequestParam String name) {
List<City> CITYS = cityService.cityNameState(name);
return new ResponseEntity<List<City>>(CITYS, HttpStatus.OK);
}
// ALTERA UMA CITY
@PutMapping("/alterar/{id}")
public ResponseEntity<Boolean> alterar(@Valid @RequestBody City city, @PathVariable Long id) {
city.setId(id);
return new ResponseEntity<Boolean>(cityService.cadastrar(city, "alterar"), HttpStatus.CREATED);
}
}
| [
"helderrodrigues37@gmail.com"
] | helderrodrigues37@gmail.com |
37100e870374daa77006258dd04dd909a7f65b51 | 871b1cc621dfd623c64fc003e7c88580e02f0347 | /spring-boot-rest/spring-boot-rest/spring-boot-starter-dubbo/src/main/java/com/xqt/springboot/dubbo/commands/ShutdownLatchMBean.java | 060c59c3335d4d1fdfd5f2e23b422e8c06aaf090 | [] | no_license | doudecheng/springcloud | ae7e85c6fbc50e8fdb5069241896465643739f6b | f308955dc29d16996c53cb973b6b3a5db8509895 | refs/heads/master | 2021-08-23T13:45:51.177093 | 2017-12-05T03:22:01 | 2017-12-05T03:22:01 | 113,126,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 103 | java | package com.xqt.springboot.dubbo.commands;
public interface ShutdownLatchMBean {
String shutdown();
} | [
"andydou_dc@aliyun.com"
] | andydou_dc@aliyun.com |
0956753aa8cd83f620911f6176839fbac071a2c9 | 658ba5ced01da4918f8f511f39a429f981da1164 | /week-02/day-1/Elso/src/DrawChessTable.java | 4d561ef42439c22a677547c44c03895e4b503063 | [] | no_license | green-fox-academy/v-peter | 8d300b4c5db81f97137ca0725a76444c30bf314b | a08021b91ed473ea62b724471c2c89d78a5522a8 | refs/heads/master | 2020-04-02T10:01:00.334358 | 2019-03-05T13:04:23 | 2019-03-05T13:04:23 | 154,320,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 322 | java | public class DrawChessTable {
public static void main(String[] args) {
for (int i = 1; i <= 8; i++){
for (int j = 1; j <= 8; j++){
if ((j+i)%2 == 0) System.out.print("%");
else System.out.print(" ");
}
System.out.println();
}
}
}
| [
"vadasz.peter@freemail.hu"
] | vadasz.peter@freemail.hu |
171b0821174a809cb95643a8f1a9813393b0d3d3 | b8a521c4e65bdc9ab26a050bb1431e389a8a565a | /besselloadingview/src/main/java/com/bluestrom/gao/customview/SurfaceViewBesselLoading.java | 93670bf2ced001996ddd436e5e1e6104bac65ee3 | [] | no_license | StormBlue/BesselLoadingView | 3b5156c4be1dc4a37d7fe74aa024b4e02a17f1f1 | bf7b86ee3547fb1acc690b6ec451ece7c6263061 | refs/heads/master | 2021-01-20T19:16:02.310079 | 2017-07-28T12:04:19 | 2017-07-28T12:04:19 | 64,922,139 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,144 | java | package com.bluestrom.gao.customview;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.SweepGradient;
import android.os.Build;
import android.util.AttributeSet;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* Created by Gao-Krund on 2016/7/5.
*/
public class SurfaceViewBesselLoading extends SurfaceView implements SurfaceHolder.Callback {
private final String TAG = this.getClass().getSimpleName();
private final static int ROTATE_PATH = 0;
private float strokeWidth;
private float octagonAngle;
private int loadingStartColor;
private int loadingEndColor;
private int maskColor;
private DrawMode drawMode;// 绘制模式
private float rotateAngle = 0;
private float octagonAngleTangent = 0.17409388f;
private final float lengthRatio = 0.1107427056f;
private float ringOutRadius;// 圆环外层半径
private float lengthMargin = 0f;
private int width, height, lengthDValue, rotateX, rotateY;
private Paint pathPaint, bitmapPaint;
private float[] coordinate_01, coordinate_02, coordinate_03, coordinate_04, coordinate_05, coordinate_06, coordinate_07, coordinate_08, coordinate_a, coordinate_b, coordinate_c, coordinate_d;
private Path besselPath;
private Canvas mSrcCanvas;
private Bitmap mSrcBitmap;
private Matrix matrix;
private SweepGradient sweepGradient;
private boolean firstDraw;// 是否为第一次绘制,保证背景只绘制一次
private LoopThread thread;
private final float default_octagon_angle = 9.8758636243f;
private final float default_stroke_width = 10;
private final int default_loading_start_color = Color.BLUE;
private final int default_loading_end_color = Color.WHITE;
private final int default_mask_color = Color.WHITE;
private final DrawMode default_draw_mode = DrawMode.STANDARD;
private static final String INSTANCE_STATE = "saved_instance";
private static final String INSTANCE_OCTAGON_ANGLE = "octagon_angle";
private static final String INSTANCE_STROKE_WIDTH = "stroke_width";
private static final String INSTANCE_LOADING_START_COLOR = "loading_start_color";
private static final String INSTANCE_LOADING_END_COLOR = "loading_end_color";
private static final String INSTANCE_MASK_COLOR = "mask_color";
private static final String INSTANCE_DRAW_MODE = "draw_mode";
private Bitmap bg;
public SurfaceViewBesselLoading(Context context) {
super(context);
}
public SurfaceViewBesselLoading(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray mTypedArray = context.obtainStyledAttributes(attrs, R.styleable.BesselLoading);
initByAttributes(mTypedArray);
init();
mTypedArray.recycle();
}
public SurfaceViewBesselLoading(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public SurfaceViewBesselLoading(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
private void init() {
initView();
SurfaceHolder holder = getHolder();
holder.addCallback(this); //设置Surface生命周期回调
thread = new LoopThread(holder, getContext());
}
private void initView() {
firstDraw = true;
octagonAngleTangent = (float) Math.tan(octagonAngle / 180 * Math.PI);
pathPaint = new Paint();
pathPaint.setStyle(Paint.Style.STROKE);
pathPaint.setStrokeWidth(strokeWidth);
pathPaint.setDither(true);
pathPaint.setAntiAlias(true);
pathPaint.setStrokeCap(Paint.Cap.ROUND);
bitmapPaint = new Paint();
bitmapPaint.setAntiAlias(true);
}
protected void initByAttributes(TypedArray attributes) {
octagonAngle = attributes.getFloat(R.styleable.BesselLoading_octagon_angle, default_octagon_angle);
strokeWidth = attributes.getDimension(R.styleable.BesselLoading_loading_stroke_width, default_stroke_width);
loadingStartColor = attributes.getColor(R.styleable.BesselLoading_loading_start_color, default_loading_start_color);
loadingEndColor = attributes.getColor(R.styleable.BesselLoading_loading_end_color, default_loading_end_color);
maskColor = attributes.getColor(R.styleable.BesselLoading_loading_end_color, default_mask_color);
drawMode = DrawMode.valueOf(attributes.getInt(R.styleable.BesselLoading_loading_draw_mode, default_draw_mode.nativeInt));
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(widthMeasureSpec, heightMeasureSpec);
width = MeasureSpec.getSize(widthMeasureSpec);
height = MeasureSpec.getSize(heightMeasureSpec);
lengthDValue = (width - height) / 2;
rotateX = width / 2;
rotateY = height / 2;
initBesselCoordinate();
}
// 初始化bessel曲线控制参数
private void initBesselCoordinate() {
// 圆环左端坐标与view最左侧的间距
float leftD = lengthDValue > 0f ? lengthDValue : 0f;
ringOutRadius = rotateX - leftD;
if (DrawMode.RIVISION.nativeInt == getDrawMode().nativeInt) {
lengthMargin = lengthRatio * ringOutRadius - (float) strokeWidth;
}
float pointMargin = octagonAngleTangent * ringOutRadius;
coordinate_01 = new float[]{rotateX - ringOutRadius - lengthMargin, rotateY - pointMargin - lengthMargin};
coordinate_02 = new float[]{rotateX - ringOutRadius - lengthMargin, rotateY + pointMargin + lengthMargin};
coordinate_03 = new float[]{rotateX - pointMargin - lengthMargin, rotateY + ringOutRadius + lengthMargin};
coordinate_04 = new float[]{rotateX + pointMargin + lengthMargin, rotateY + ringOutRadius + lengthMargin};
coordinate_05 = new float[]{rotateX + ringOutRadius + lengthMargin, rotateY + pointMargin + lengthMargin};
coordinate_06 = new float[]{rotateX + ringOutRadius + lengthMargin, rotateY - pointMargin - lengthMargin};
coordinate_07 = new float[]{rotateX + pointMargin + lengthMargin, rotateY - ringOutRadius - lengthMargin};
coordinate_08 = new float[]{rotateX - pointMargin - lengthMargin, rotateY - ringOutRadius - lengthMargin};
coordinate_a = new float[]{(coordinate_01[0] + coordinate_08[0]) / 2, (coordinate_01[1] + coordinate_08[1]) / 2};
coordinate_b = new float[]{(coordinate_02[0] + coordinate_03[0]) / 2, (coordinate_02[1] + coordinate_03[1]) / 2};
coordinate_c = new float[]{(coordinate_04[0] + coordinate_05[0]) / 2, (coordinate_04[1] + coordinate_05[1]) / 2};
coordinate_d = new float[]{(coordinate_06[0] + coordinate_07[0]) / 2, (coordinate_06[1] + coordinate_07[1]) / 2};
besselPath = new Path();
besselPath.moveTo(coordinate_a[0], coordinate_a[1]);
besselPath.cubicTo(coordinate_01[0], coordinate_01[1], coordinate_02[0], coordinate_02[1], coordinate_b[0], coordinate_b[1]);
besselPath.cubicTo(coordinate_03[0], coordinate_03[1], coordinate_04[0], coordinate_04[1], coordinate_c[0], coordinate_c[1]);
besselPath.cubicTo(coordinate_05[0], coordinate_05[1], coordinate_06[0], coordinate_06[1], coordinate_d[0], coordinate_d[1]);
besselPath.cubicTo(coordinate_07[0], coordinate_07[1], coordinate_08[0], coordinate_08[1], coordinate_a[0], coordinate_a[1]);
}
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
thread.isRunning = true;
thread.start();
// // 设置透明
// setZOrderOnTop(true);
// getHolder().setFormat(PixelFormat.TRANSLUCENT);
}
@Override
public void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i1, int i2) {
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
thread.isRunning = false;
try {
thread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public float getStrokeWidth() {
return strokeWidth;
}
public void setStrokeWidth(float strokeWidth) {
this.strokeWidth = strokeWidth;
}
public float getOctagonAngle() {
return octagonAngle;
}
public void setOctagonAngle(float octagonAngle) {
this.octagonAngle = octagonAngle;
}
public int getLoadingStartColor() {
return loadingStartColor;
}
public void setLoadingStartColor(int loadingStartColor) {
this.loadingStartColor = loadingStartColor;
}
public int getLoadingEndColor() {
return loadingEndColor;
}
public void setLoadingEndColor(int loadingEndColor) {
this.loadingEndColor = loadingEndColor;
}
public int getMaskColor() {
return maskColor;
}
public void setMaskColor(int maskColor) {
this.maskColor = maskColor;
}
public DrawMode getDrawMode() {
return drawMode;
}
public void setDrawMode(DrawMode drawMode) {
this.drawMode = drawMode;
}
public enum DrawMode {
STANDARD(0),
RIVISION(1);
DrawMode(int ni) {
nativeInt = ni;
}
final int nativeInt;
public static DrawMode valueOf(int ordinal) {
if (ordinal < 0 || ordinal >= values().length) {
throw new IndexOutOfBoundsException("Invalid ordinal");
}
return values()[ordinal];
}
}
/**
* 执行绘制的绘制线程
*
* @author Administrator
*/
class LoopThread extends Thread {
SurfaceHolder surfaceHolder;
Context context;
boolean isRunning;
Paint paint;
public LoopThread(SurfaceHolder surfaceHolder, Context context) {
this.surfaceHolder = surfaceHolder;
this.context = context;
isRunning = false;
paint = new Paint();
paint.setColor(Color.YELLOW);
paint.setStyle(Paint.Style.STROKE);
}
@Override
public void run() {
Canvas c = null;
while (isRunning) {
synchronized (surfaceHolder) {
c = surfaceHolder.lockCanvas(null);
// c.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR);
drawBackground(c);
firstDraw = false;
rotateAngle += 3;
rotateAngle = (rotateAngle % 360);
// drawPathBitmap(c);
}
surfaceHolder.unlockCanvasAndPost(c);
}
}
// 绘制有透明区域的背景
private void drawBackground(Canvas c) {
// 绘制背景
if (bg == null) {
bg = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas bgCanvas = new Canvas(bg);
Paint paintBg = new Paint();
paintBg.setStyle(Paint.Style.FILL);
Bitmap dstBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas dstCanvas = new Canvas(dstBitmap);
paintBg.setColor(Color.rgb(255, 255, 255));
paintBg.setAntiAlias(true);
dstCanvas.drawPath(besselPath, paintBg);
bgCanvas.drawBitmap(dstBitmap, 0, 0, paintBg);
Bitmap srcBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas srcCanvas = new Canvas(srcBitmap);
paintBg.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_OUT));
srcCanvas.drawColor(maskColor);
bgCanvas.drawBitmap(srcBitmap, 0, 0, paintBg);
}
c.drawBitmap(bg, 0, 0, bitmapPaint);
if (firstDraw) {
// 绘制首次显示的贝塞尔曲线
mSrcBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mSrcCanvas = new Canvas(mSrcBitmap);
sweepGradient = new SweepGradient(rotateX, rotateY, Color.WHITE, Color.BLUE);
matrix = new Matrix();
pathPaint.setShader(sweepGradient);
}
drawPathBitmap(c);
}
private void drawPathBitmap(Canvas c) {
matrix.setRotate(rotateAngle - 90, rotateX, rotateY);
sweepGradient.setLocalMatrix(matrix);
mSrcCanvas.drawPath(besselPath, pathPaint);
c.drawBitmap(mSrcBitmap, 0, 0, bitmapPaint);
}
}
}
| [
"gao2808941@gmail.com"
] | gao2808941@gmail.com |
ab1eb9ac82350f59677eb00f0a725f2593a3a506 | 1b96e0764761bf0abbdafc51d98e2a06914a40fa | /M4DVDSpringDI/src/main/java/com/sg/M4DVD/controller/DVDLibraryController.java | 4afaa7721c0eaff8a63a69b7b5e92bfc8f3d94d8 | [] | no_license | NarishSingh/SG4-Spring | 2210b27d6a0d2924deda06fa5f0b70796b561814 | 95bb4c1b270cc5a930321051f91c782d7227426a | refs/heads/master | 2022-12-01T21:05:35.555479 | 2020-07-31T03:52:15 | 2020-07-31T03:52:15 | 272,453,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,605 | java | package com.sg.M4DVD.controller;
import com.sg.M4DVD.dao.DVDLibraryDAO;
import com.sg.M4DVD.dao.DVDLibraryDAOException;
import com.sg.M4DVD.dao.DVDLibraryDAOImpl;
import com.sg.M4DVD.dto.DVD;
import com.sg.M4DVD.ui.DVDLibraryView;
import com.sg.M4DVD.ui.UserIO;
import com.sg.M4DVD.ui.UserIOImpl;
import java.util.List;
public class DVDLibraryController {
//since no service, need to get these instantiated
private UserIO io = new UserIOImpl();
private DVDLibraryDAO dao = new DVDLibraryDAOImpl();
private DVDLibraryView view = new DVDLibraryView(io);
/**
* App's run loop
*/
public void run() {
boolean inProgram = true;
boolean editingLibrary = true;
boolean viewingLibrary = true;
int menuSelection = 0;
int editSubMenuSlt = 0;
int viewSubMenuSlt = 0;
try {
while (inProgram) {
menuSelection = getMenuSelection();
switch (menuSelection) {
case 1: {
while (editingLibrary) {
editSubMenuSlt = getEditLibrarySubMenuSelection();
switch (editSubMenuSlt) {
case 1: {
createDVD();
break;
}
case 2: {
removeDVD();
break;
}
case 3: {
editDVD();
break;
}
case 0: {
editingLibrary = false;
break;
}
default: {
unknownCommand();
}
}
}
break;
}
case 2: {
while (viewingLibrary) {
viewSubMenuSlt = getViewLibrarySubMenuSelection();
switch (viewSubMenuSlt) {
case 1: { //view DVD's
listLibrary();
break;
}
case 2: {
viewDVD();
break;
}
case 3: {
getSinceYear();
break;
}
case 4: {
getByStudio();
break;
}
case 5: {
getByRating();
break;
}
case 6: { //stats
getAvgAge();
break;
}
case 7: {
getNewestDVD();
break;
}
case 8: {
getOldestDVD();
break;
}
case 9: {
getAvgNotes();
break;
}
case 0: {
viewingLibrary = false;
break;
}
default: {
unknownCommand();
}
}
}
break;
}
case 0: {
inProgram = false;
break;
}
default: {
unknownCommand();
}
}
exitMessage();
}
} catch (DVDLibraryDAOException e) {
view.displayErrorMessage(e.getMessage());
}
}
/**
* Get input for menu choice
*
* @return {int} 1-6 for menu actions
*/
private int getMenuSelection() {
return view.printMenuGetSelection();
}
/**
* Get input for editing sub-menu
*
* @return {int} 1-4 for sub-menu actions
*/
private int getEditLibrarySubMenuSelection() {
return view.printEditLibrarySubMenuGetSelection();
}
/**
* Get input for view sub-menu
*
* @return {int} 1-9 for sub-menu action
*/
private int getViewLibrarySubMenuSelection() {
return view.printViewLibrarySubMenuGetSelection();
}
/**
* Display banners for DVD entry creation. Construct new DVD obj and fill
* fields from user inputs. Add to library
*
* @throws DVDLibraryDAOException if unable to write to library
*/
private void createDVD() throws DVDLibraryDAOException {
view.displayNewDVDInfo();
DVD newDVD = view.getNewDVDInfo();
dao.addDVD(newDVD.getTitle(), newDVD);
view.displayNewDVDSuccessBanner();
}
/**
* Display banners for DVD entry removal. Get title of DVD from user and
* remove from library HashMap
*
* @throws DVDLibraryDAOException if unable to read from or write to library
*/
private void removeDVD() throws DVDLibraryDAOException {
view.displayRemoveDVDBanner();
String dvdTitle = view.getDVDTitle();
DVD removedDVD = dao.removeDVD(dvdTitle);
view.displayRemoveResult(removedDVD);
}
/**
* Display banners for DVD entry editing. Get title of DVD, copy obj and
* then get the new info for entry. Add edited entry to HashMap, overwriting
* the DVD obj value at that key
*
* @throws DVDLibraryDAOException if unable to read from or write to library
*/
private void editDVD() throws DVDLibraryDAOException {
view.displayEditDVDBanner();
String dvdTitle = view.getDVDTitle();
if (dao.getDVD(dvdTitle) != null) {
DVD editedDVD = dao.getDVD(dvdTitle);
view.editDVDEntry(editedDVD);
dao.addDVD(dvdTitle, editedDVD); //will overwrite the value in HashMap
view.displayEditDVDSuccessBanner();
} else {
view.displayEditDVDFailBanner();
}
}
/**
* Display banners for DVD library titles listing. Retrieve and display
* titles from key set of library HashMap, or feedback of library is empty
*
* @throws DVDLibraryDAOException if cannot read from library
*/
private void listLibrary() throws DVDLibraryDAOException {
view.displayDisplayLibraryBanner();
List<DVD> dvdList = dao.getLibrary();
if (!dvdList.isEmpty()) {
view.displayLibrary(dvdList);
} else {
view.displayLibraryEmptyBanner();
}
}
/*ANY VIEW DATA TYPE OF METHODS SHOULD BE PUBLIC*/
/**
* Display banners for DVD entry viewing. Get title from user, then retrieve
* and display DVD obj
*
* @throws DVDLibraryDAOException if cannot read from library
*/
public void viewDVD() throws DVDLibraryDAOException {
view.displayDisplayDVDBanner();
String dvdTitle = view.getDVDTitle();
DVD dvd = dao.getDVD(dvdTitle);
view.getDVDEntry(dvd);
}
/**
* Display banner for Get Titles Since Year. Get year as int between 1888 to
* 2020 from user, then retrieve list of DVD's after this year and print to
* UI
*
* @throws DVDLibraryDAOException if cannot read from library
*/
public void getSinceYear() throws DVDLibraryDAOException {
view.displayGetSinceYearBanner();
int minYear = view.getYearFromUser();
List<DVD> titlesByYear = dao.getDVDsSince(minYear);
if (titlesByYear.isEmpty()) {
view.displayGetSinceYearFailBanner();
} else {
view.displayLibrary(titlesByYear);
}
}
/**
* Display banner for Get Titles by Studio. Get studio as String from user,
* retrieve List of DVD's which contain this studio name as a field, and
* print List to UI
*
* @throws DVDLibraryDAOException if cannot read from library
*/
public void getByStudio() throws DVDLibraryDAOException {
view.displayGetByStudioBanner();
String studioName = view.getStudioFromUser();
List<DVD> titlesByStudio = dao.getDVDsByStudio(studioName);
if (titlesByStudio.isEmpty()) {
view.displayGetByStudioFailBanner();
} else {
view.displayLibrary(titlesByStudio);
}
}
/**
* Display banners for Get Titles by Rating. Get rating as String from user,
* retrieve List of DVD's with this rating, and print to UI
*
* @throws DVDLibraryDAOException if cannot read from library
*/
public void getByRating() throws DVDLibraryDAOException {
view.displayGetByRatingBanner();
String rating = view.getRatingFromUser();
List<DVD> titlesByRating = dao.getDVDsByRating(rating);
if (titlesByRating.isEmpty()) {
view.displayGetByRatingFailBanner();
} else {
view.displayLibrary(titlesByRating);
}
}
/**
* Display Average Age of Films banners, calculate the average and print to
* UI
*
* @throws DVDLibraryDAOException if cannot read from library
*/
public void getAvgAge() throws DVDLibraryDAOException {
view.displayGetAvgAgeBanner();
double avgAge = dao.averageAgeOfDVDs();
view.displayAvgFilmAge(avgAge);
}
/**
* Display Newest Title banners, and then calculate newest DVD by release
* date
*
* @throws DVDLibraryDAOException if cannot read from library
*/
public void getNewestDVD() throws DVDLibraryDAOException {
view.displayNewestTitleBanner();
DVD newest = dao.getNewestDVD();
view.displayNewestTitle(newest);
}
/**
* Display Newest Title banners, and then calculate newest DVD by release
* date
*
* @throws DVDLibraryDAOException if cannot read from library
*/
public void getOldestDVD() throws DVDLibraryDAOException {
view.displayOldestTitleBanner();
DVD oldest = dao.getOldestDVD();
view.displayOldestTitle(oldest);
}
public void getAvgNotes() throws DVDLibraryDAOException {
view.displayAvgNotesBanner();
double noteAvg = dao.averageNotes();
view.displayAvgUserNotes(noteAvg);
}
/*error and exit*/
/**
* Display banner for an invalid Menu choice
*/
private void unknownCommand() {
view.displayUnknownCommandBanner();
}
/**
* Display banner for exiting app
*/
private void exitMessage() {
view.displayExitBanner();
}
}
| [
"62305841+NarishSingh@users.noreply.github.com"
] | 62305841+NarishSingh@users.noreply.github.com |
7f864ae86982821dfb5dcc878012e65400239b18 | 1983964b1c049f426f100b833775eec21a3e9917 | /JavaKnow/src/main/java/com/feagle/learn/thread/racecondition/EnergySystem.java | b0b58fcf22328f2ffb7193b466ed81c6287eace4 | [] | no_license | adanac/java-project | 688accbb97773dd52c0e68d96d99003d637d8ecb | f90418ea89406f0c0ddf4f0383f7fbd0b532a205 | refs/heads/master | 2021-01-21T15:03:46.890994 | 2017-08-29T14:24:54 | 2017-08-29T14:24:54 | 95,373,196 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,864 | java | package com.feagle.learn.thread.racecondition;
/**
* 宇宙的能量系统
* 遵循能量守恒定律:
* 能量不会凭空创生或消失,只会从一处转移到另一处
*/
public class EnergySystem {
//能量盒子,能量存贮的地方
private final double[] energyBoxes;
private final Object lockObj = new Object();
/**
*
* @param n 能量盒子的数量
* @param initialEnergy 每个能量盒子初始含有的能量值
*/
public EnergySystem(int n, double initialEnergy){
energyBoxes = new double[n];
for (int i = 0; i < energyBoxes.length; i++)
energyBoxes[i] = initialEnergy;
}
/**
* 能量的转移,从一个盒子到另一个盒子
* @param from 能量源
* @param to 能量终点
* @param amount 能量值
*/
public void transfer(int from, int to, double amount){
synchronized(lockObj){
// if (energyBoxes[from] < amount)
// return;
//while循环,保证条件不满足时任务都会被条件阻挡
//而不是继续竞争CPU资源,提高性能
while (energyBoxes[from] < amount){
try {
//条件不满足, 将当前线程放入Wait Set
lockObj.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.print(Thread.currentThread().getName());
energyBoxes[from] -= amount;
System.out.printf("从%d转移%10.2f单位能量到%d", from, amount, to);
energyBoxes[to] += amount;
System.out.printf(" 能量总和:%10.2f%n", getTotalEnergies());
//唤醒所有在lockObj对象上等待的线程
lockObj.notifyAll();
}
}
/**
* 获取能量世界的能量总和
*/
public double getTotalEnergies(){
double sum = 0;
for (double amount : energyBoxes)
sum += amount;
return sum;
}
/**
* 返回能量盒子的长度
*/
public int getBoxAmount(){
return energyBoxes.length;
}
}
| [
"adanac@sina.com"
] | adanac@sina.com |
af3134c79072e8ffacaffb3af2d113dc2819bef1 | 350f50831472558c1412e5e45162c85fccd1c2e6 | /src/main/java/com/eviware/soapui/impl/wsdl/teststeps/AMFRequestTestStep.java | 7b229b1bd31d60d2ef63e91c94429979bbfb7ba1 | [
"MIT"
] | permissive | ZihengSun/suis4j | 759b387adbc4daa0300a360ce78112ffcf606fbc | 6b6a233e45f14f8482fa5599fb50f5f0055a6b07 | refs/heads/master | 2021-07-12T17:26:23.651375 | 2019-03-08T00:18:06 | 2019-03-08T00:18:06 | 119,863,920 | 5 | 3 | MIT | 2019-03-07T14:56:21 | 2018-02-01T16:42:40 | Java | UTF-8 | Java | false | false | 24,450 | java | /*
* SoapUI, Copyright (C) 2004-2016 SmartBear Software
*
* Licensed under the EUPL, Version 1.1 or - as soon as they will be approved by the European Commission - subsequent
* versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in writing, software distributed under the Licence is
* distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the Licence for the specific language governing permissions and limitations
* under the Licence.
*/
package com.eviware.soapui.impl.wsdl.teststeps;
import com.eviware.soapui.SoapUI;
import com.eviware.soapui.config.AMFRequestTestStepConfig;
import com.eviware.soapui.config.TestAssertionConfig;
import com.eviware.soapui.config.TestStepConfig;
import com.eviware.soapui.impl.wsdl.MutableTestPropertyHolder;
import com.eviware.soapui.impl.wsdl.panels.teststeps.amf.AMFRequest;
import com.eviware.soapui.impl.wsdl.panels.teststeps.amf.AMFResponse;
import com.eviware.soapui.impl.wsdl.panels.teststeps.amf.AMFSubmit;
import com.eviware.soapui.impl.wsdl.support.AMFMessageExchange;
import com.eviware.soapui.impl.wsdl.support.XmlBeansPropertiesTestPropertyHolder;
import com.eviware.soapui.impl.wsdl.support.assertions.AssertableConfig;
import com.eviware.soapui.impl.wsdl.support.assertions.AssertedXPathsContainer;
import com.eviware.soapui.impl.wsdl.support.assertions.AssertionsSupport;
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestRunContext;
import com.eviware.soapui.impl.wsdl.teststeps.assertions.TestAssertionRegistry.AssertableType;
import com.eviware.soapui.model.iface.Interface;
import com.eviware.soapui.model.iface.Request.SubmitException;
import com.eviware.soapui.model.iface.Submit;
import com.eviware.soapui.model.iface.SubmitContext;
import com.eviware.soapui.model.propertyexpansion.PropertyExpander;
import com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils;
import com.eviware.soapui.model.support.TestStepBeanProperty;
import com.eviware.soapui.model.testsuite.Assertable;
import com.eviware.soapui.model.testsuite.AssertionError;
import com.eviware.soapui.model.testsuite.AssertionsListener;
import com.eviware.soapui.model.testsuite.SamplerTestStep;
import com.eviware.soapui.model.testsuite.TestAssertion;
import com.eviware.soapui.model.testsuite.TestCaseRunContext;
import com.eviware.soapui.model.testsuite.TestCaseRunner;
import com.eviware.soapui.model.testsuite.TestProperty;
import com.eviware.soapui.model.testsuite.TestPropertyListener;
import com.eviware.soapui.model.testsuite.TestStep;
import com.eviware.soapui.model.testsuite.TestStepResult;
import com.eviware.soapui.model.testsuite.TestStepResult.TestStepStatus;
import com.eviware.soapui.support.scripting.SoapUIScriptEngine;
import com.eviware.soapui.support.scripting.SoapUIScriptEngineRegistry;
import com.eviware.soapui.support.types.StringToStringMap;
import com.eviware.soapui.support.types.StringToStringsMap;
import org.apache.log4j.Logger;
import javax.swing.ImageIcon;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.eviware.soapui.impl.wsdl.teststeps.Script.SCRIPT_PROPERTY;
/**
* @author nebojsa.tasic
*/
public class AMFRequestTestStep extends WsdlTestStepWithProperties implements Assertable, MutableTestPropertyHolder,
PropertyChangeListener, SamplerTestStep {
@SuppressWarnings("unused")
private final static Logger log = Logger.getLogger(WsdlTestRequestStep.class);
protected AMFRequestTestStepConfig amfRequestTestStepConfig;
public final static String amfREQUEST = AMFRequestTestStep.class.getName() + "@amfrequest";
public static final String STATUS_PROPERTY = WsdlTestRequest.class.getName() + "@status";
public static final String RESPONSE_PROPERTY = "response";
public static final String REQUEST_PROPERTY = "request";
public static final String HTTP_HEADERS_PROPERTY = AMFRequest.class.getName() + "@request-headers";
public static final String AMF_HEADERS_PROPERTY = AMFRequest.class.getName() + "@amfrequest-amfheaders";
private AMFSubmit submit;
private SoapUIScriptEngine scriptEngine;
private AssertionsSupport assertionsSupport;
private PropertyChangeNotifier notifier;
private XmlBeansPropertiesTestPropertyHolder propertyHolderSupport;
private AMFRequest amfRequest;
public AMFRequestTestStep(WsdlTestCase testCase, TestStepConfig config, boolean forLoadTest) {
super(testCase, config, true, forLoadTest);
if (getConfig().getConfig() != null) {
amfRequestTestStepConfig = (AMFRequestTestStepConfig) getConfig().getConfig().changeType(
AMFRequestTestStepConfig.type);
} else {
amfRequestTestStepConfig = (AMFRequestTestStepConfig) getConfig().addNewConfig().changeType(
AMFRequestTestStepConfig.type);
}
if (amfRequestTestStepConfig.getProperties() == null) {
amfRequestTestStepConfig.addNewProperties();
}
amfRequest = new AMFRequest(this, forLoadTest);
propertyHolderSupport = new XmlBeansPropertiesTestPropertyHolder(this, amfRequestTestStepConfig.getProperties());
addResponseAsXmlVirtualProperty();
initAssertions();
scriptEngine = SoapUIScriptEngineRegistry.create(this);
scriptEngine.setScript(getScript());
if (forLoadTest && !isDisabled()) {
try {
scriptEngine.compile();
} catch (Exception e) {
SoapUI.logError(e);
}
}
}
private void addResponseAsXmlVirtualProperty() {
TestStepBeanProperty responseProperty = new TestStepBeanProperty(WsdlTestStepWithProperties.RESPONSE_AS_XML,
false, amfRequest, "responseContent", this) {
@Override
public String getDefaultValue() {
return "";
}
};
propertyHolderSupport.addVirtualProperty(WsdlTestStepWithProperties.RESPONSE_AS_XML, responseProperty);
}
public AMFRequestTestStepConfig getAMFRequestTestStepConfig() {
return amfRequestTestStepConfig;
}
@Override
public WsdlTestStep clone(WsdlTestCase targetTestCase, String name) {
beforeSave();
TestStepConfig config = (TestStepConfig) getConfig().copy();
AMFRequestTestStep result = (AMFRequestTestStep) targetTestCase.addTestStep(config);
return result;
}
@Override
public void release() {
super.release();
}
public TestStepResult run(TestCaseRunner runner, TestCaseRunContext runContext) {
AMFTestStepResult testStepResult = new AMFTestStepResult(this);
testStepResult.startTimer();
runContext.setProperty(AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, testStepResult);
try {
if (!initAmfRequest(runContext)) {
throw new SubmitException("AMF request is not initialised properly !");
}
submit = amfRequest.submit(runContext, false);
AMFResponse response = submit.getResponse();
if (submit.getStatus() != Submit.Status.CANCELED) {
if (submit.getStatus() == Submit.Status.ERROR) {
testStepResult.setStatus(TestStepStatus.FAILED);
testStepResult.addMessage(submit.getError().toString());
amfRequest.setResponse(null);
} else if (response == null) {
testStepResult.setStatus(TestStepStatus.FAILED);
testStepResult.addMessage("Request is missing response");
amfRequest.setResponse(null);
} else {
runContext.setProperty(AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, testStepResult);
amfRequest.setResponse(response);
testStepResult.setTimeTaken(response.getTimeTaken());
testStepResult.setSize(response.getContentLength());
switch (amfRequest.getAssertionStatus()) {
case FAILED:
testStepResult.setStatus(TestStepStatus.FAILED);
break;
case VALID:
testStepResult.setStatus(TestStepStatus.OK);
break;
case UNKNOWN:
testStepResult.setStatus(TestStepStatus.UNKNOWN);
break;
}
testStepResult.setResponse(response, testStepResult.getStatus() != TestStepStatus.FAILED);
}
} else {
testStepResult.setStatus(TestStepStatus.CANCELED);
testStepResult.addMessage("Request was canceled");
}
if (response != null) {
testStepResult.setRequestContent(response.getRequestContent());
} else {
testStepResult.setRequestContent(amfRequest.getRequestContent());
}
testStepResult.stopTimer();
} catch (SubmitException e) {
testStepResult.setStatus(TestStepStatus.FAILED);
testStepResult.addMessage("SubmitException: " + e);
testStepResult.stopTimer();
} finally {
submit = null;
}
if (testStepResult.getStatus() != TestStepStatus.CANCELED) {
assertResponse(runContext);
AssertionStatus assertionStatus = amfRequest.getAssertionStatus();
switch (assertionStatus) {
case FAILED: {
testStepResult.setStatus(TestStepStatus.FAILED);
if (getAssertionCount() == 0) {
testStepResult.addMessage("Invalid/empty response");
} else {
for (int c = 0; c < getAssertionCount(); c++) {
TestAssertion assertion = getAssertionAt(c);
AssertionError[] errors = assertion.getErrors();
if (errors != null) {
for (AssertionError error : errors) {
testStepResult.addMessage("[" + assertion.getName() + "] " + error.getMessage());
}
}
}
}
break;
}
// default : testStepResult.setStatus( TestStepStatus.OK ); break;
}
}
if (isDiscardResponse() && !SoapUI.getDesktop().hasDesktopPanel(this)) {
amfRequest.setResponse(null);
}
// FIXME This should not be hard coded
// FIXME This has to be tested before release
firePropertyValueChanged("ResponseAsXml", null, testStepResult.getResponseContentAsXml());
return testStepResult;
}
@Override
public boolean cancel() {
if (submit == null) {
return false;
}
submit.cancel();
return true;
}
public String getDefaultSourcePropertyName() {
return "Response";
}
private void initAssertions() {
assertionsSupport = new AssertionsSupport(this, new AssertableConfig() {
public TestAssertionConfig addNewAssertion() {
return getAMFRequestTestStepConfig().addNewAssertion();
}
public List<TestAssertionConfig> getAssertionList() {
return getAMFRequestTestStepConfig().getAssertionList();
}
public void removeAssertion(int ix) {
getAMFRequestTestStepConfig().removeAssertion(ix);
}
public TestAssertionConfig insertAssertion(TestAssertionConfig source, int ix) {
TestAssertionConfig conf = getAMFRequestTestStepConfig().insertNewAssertion(ix);
conf.set(source);
return conf;
}
});
}
private class PropertyChangeNotifier {
private AssertionStatus oldStatus;
private ImageIcon oldIcon;
public PropertyChangeNotifier() {
oldStatus = getAssertionStatus();
oldIcon = getIcon();
}
public void notifyChange() {
AssertionStatus newStatus = getAssertionStatus();
ImageIcon newIcon = getIcon();
if (oldStatus != newStatus) {
notifyPropertyChanged(STATUS_PROPERTY, oldStatus, newStatus);
}
if (oldIcon != newIcon) {
notifyPropertyChanged(ICON_PROPERTY, oldIcon, getIcon());
}
oldStatus = newStatus;
oldIcon = newIcon;
}
}
public TestAssertion addAssertion(String assertionLabel) {
PropertyChangeNotifier notifier = new PropertyChangeNotifier();
try {
WsdlMessageAssertion assertion = assertionsSupport.addWsdlAssertion(assertionLabel);
if (assertion == null) {
return null;
}
if (getAMFRequest().getResponse() != null) {
assertion.assertResponse(new AMFMessageExchange(this, getAMFRequest().getResponse()),
new WsdlTestRunContext(this));
notifier.notifyChange();
}
return assertion;
} catch (Exception e) {
SoapUI.logError(e);
return null;
}
}
public void addAssertionsListener(AssertionsListener listener) {
assertionsSupport.addAssertionsListener(listener);
}
public TestAssertion cloneAssertion(TestAssertion source, String name) {
return assertionsSupport.cloneAssertion(source, name);
}
public String getAssertableContentAsXml() {
return getAssertableContent();
}
public String getAssertableContent() {
return getAMFRequest().getResponse() == null ? null : getAMFRequest().getResponse().getContentAsString();
}
public WsdlMessageAssertion importAssertion(WsdlMessageAssertion source, boolean overwrite, boolean createCopy,
String newName) {
return assertionsSupport.importAssertion(source, overwrite, createCopy, newName);
}
public AssertableType getAssertableType() {
return AssertableType.RESPONSE;
}
public TestAssertion getAssertionAt(int c) {
return assertionsSupport.getAssertionAt(c);
}
public TestAssertion getAssertionByName(String name) {
return assertionsSupport.getAssertionByName(name);
}
public int getAssertionCount() {
return assertionsSupport.getAssertionCount();
}
public List<TestAssertion> getAssertionList() {
return new ArrayList<TestAssertion>(assertionsSupport.getAssertionList());
}
public void propertyChange(PropertyChangeEvent arg0) {
if (arg0.getPropertyName().equals(TestAssertion.CONFIGURATION_PROPERTY)
|| arg0.getPropertyName().equals(TestAssertion.DISABLED_PROPERTY)) {
if (getAMFRequest().getResponse() != null) {
assertResponse(new WsdlTestRunContext(this));
}
}
}
public Map<String, TestAssertion> getAssertions() {
return assertionsSupport.getAssertions();
}
public String getDefaultAssertableContent() {
return null;
}
public AssertionStatus getAssertionStatus() {
return amfRequest.getAssertionStatus();
}
public ImageIcon getIcon() {
return amfRequest.getIcon();
}
public Interface getInterface() {
return null;
}
public TestAssertion moveAssertion(int ix, int offset) {
PropertyChangeNotifier notifier = new PropertyChangeNotifier();
TestAssertion assertion = getAssertionAt(ix);
try {
return assertionsSupport.moveAssertion(ix, offset);
} finally {
((WsdlMessageAssertion) assertion).release();
notifier.notifyChange();
}
}
public void removeAssertion(TestAssertion assertion) {
PropertyChangeNotifier notifier = new PropertyChangeNotifier();
try {
assertionsSupport.removeAssertion((WsdlMessageAssertion) assertion);
} finally {
((WsdlMessageAssertion) assertion).release();
notifier.notifyChange();
}
}
public void removeAssertionsListener(AssertionsListener listener) {
assertionsSupport.removeAssertionsListener(listener);
}
public void assertResponse(SubmitContext context) {
try {
if (notifier == null) {
notifier = new PropertyChangeNotifier();
}
AMFMessageExchange messageExchange = new AMFMessageExchange(this, getAMFRequest().getResponse());
// assert!
for (WsdlMessageAssertion assertion : assertionsSupport.getAssertionList()) {
assertion.assertResponse(messageExchange, context);
}
notifier.notifyChange();
} catch (Exception e) {
e.printStackTrace();
}
}
public TestProperty addProperty(String name) {
return propertyHolderSupport.addProperty(name);
}
public TestProperty removeProperty(String propertyName) {
return propertyHolderSupport.removeProperty(propertyName);
}
public boolean renameProperty(String name, String newName) {
return PropertyExpansionUtils.renameProperty(propertyHolderSupport.getProperty(name), newName, getTestCase()) != null;
}
// FIXME Remove the overridden methods in TestPropertyHolder
@Override
public Map<String, TestProperty> getProperties() {
return propertyHolderSupport.getProperties();
}
@Override
public TestProperty getProperty(String name) {
return propertyHolderSupport.getProperty(name);
}
@Override
public TestProperty getPropertyAt(int index) {
return propertyHolderSupport.getPropertyAt(index);
}
@Override
public int getPropertyCount() {
return propertyHolderSupport.getPropertyCount();
}
@Override
public List<TestProperty> getPropertyList() {
return propertyHolderSupport.getPropertyList();
}
@Override
public String[] getPropertyNames() {
return propertyHolderSupport.getPropertyNames();
}
@Override
public String getPropertyValue(String name) {
return propertyHolderSupport.getPropertyValue(name);
}
@Override
public void addTestPropertyListener(TestPropertyListener listener) {
propertyHolderSupport.addTestPropertyListener(listener);
}
@Override
public void removeTestPropertyListener(TestPropertyListener listener) {
propertyHolderSupport.removeTestPropertyListener(listener);
}
@Override
public boolean hasProperty(String name) {
return propertyHolderSupport.hasProperty(name);
}
@Override
public void setPropertyValue(String name, String value) {
propertyHolderSupport.setPropertyValue(name, value);
}
public void setPropertyValue(String name, Object value) {
setPropertyValue(name, String.valueOf(value));
}
@Override
public void moveProperty(String propertyName, int targetIndex) {
propertyHolderSupport.moveProperty(propertyName, targetIndex);
}
public AMFRequest getAMFRequest() {
return amfRequest;
}
public void setResponse(AMFResponse response, SubmitContext context) {
AMFResponse oldResponse = amfRequest.getResponse();
amfRequest.setResponse(response);
notifyPropertyChanged(RESPONSE_PROPERTY, oldResponse, response);
assertResponse(context);
}
public String getScript() {
return amfRequestTestStepConfig.getScript() != null ? amfRequestTestStepConfig.getScript().getStringValue() : "";
}
public void setScript(String script) {
String old = getScript();
scriptEngine.setScript(script);
if (amfRequestTestStepConfig.getScript() == null) {
amfRequestTestStepConfig.addNewScript();
}
amfRequestTestStepConfig.getScript().setStringValue(script);
notifyPropertyChanged(SCRIPT_PROPERTY, old, script);
}
public String getAmfCall() {
return amfRequestTestStepConfig.getAmfCall();
}
public void setAmfCall(String amfCall) {
String old = getAmfCall();
amfRequestTestStepConfig.setAmfCall(amfCall);
notifyPropertyChanged("amfCall", old, amfCall);
}
public String getEndpoint() {
return amfRequestTestStepConfig.getEndpoint();
}
public void setEndpoint(String endpoint) {
String old = getEndpoint();
amfRequestTestStepConfig.setEndpoint(endpoint);
notifyPropertyChanged("endpoint", old, endpoint);
}
public boolean initAmfRequest(SubmitContext submitContext) {
amfRequest.setScriptEngine(scriptEngine);
amfRequest.setAmfCall(PropertyExpander.expandProperties(submitContext, getAmfCall()));
amfRequest.setEndpoint(PropertyExpander.expandProperties(submitContext, getEndpoint()));
amfRequest.setScript(getScript());
amfRequest.setPropertyNames(getPropertyNames());
amfRequest.setPropertyMap((HashMap<String, TestProperty>) getProperties());
amfRequest.setHttpHeaders(getHttpHeaders());
amfRequest.setAmfHeadersString(getAmfHeaders());
return amfRequest.executeAmfScript(submitContext);
}
public void setHttpHeaders(StringToStringsMap httpHeaders) {
StringToStringsMap old = getHttpHeaders();
getSettings().setString(HTTP_HEADERS_PROPERTY, httpHeaders.toXml());
notifyPropertyChanged(HTTP_HEADERS_PROPERTY, old, httpHeaders);
}
public StringToStringsMap getHttpHeaders() {
return StringToStringsMap.fromXml(getSettings().getString(HTTP_HEADERS_PROPERTY, null));
}
public void setAmfHeaders(StringToStringMap amfHeaders) {
StringToStringMap old = getAmfHeaders();
getSettings().setString(AMF_HEADERS_PROPERTY, amfHeaders.toXml());
notifyPropertyChanged(AMF_HEADERS_PROPERTY, old, amfHeaders);
}
public StringToStringMap getAmfHeaders() {
return StringToStringMap.fromXml(getSettings().getString(AMF_HEADERS_PROPERTY, null));
}
public void resetConfigOnMove(TestStepConfig config) {
super.resetConfigOnMove(config);
amfRequestTestStepConfig = (AMFRequestTestStepConfig) config.getConfig().changeType(
AMFRequestTestStepConfig.type);
propertyHolderSupport.resetPropertiesConfig(amfRequestTestStepConfig.getProperties());
// addResponseAsXmlVirtualProperty();
assertionsSupport.refresh();
}
public XmlBeansPropertiesTestPropertyHolder getPropertyHolderSupport() {
return propertyHolderSupport;
}
public TestStep getTestStep() {
return this;
}
public boolean isDiscardResponse() {
return amfRequest.isDiscardResponse();
}
public void setDiscardResponse(boolean discardResponse) {
amfRequest.setDiscardResponse(discardResponse);
}
public TestRequest getTestRequest() {
return amfRequest;
}
}
| [
"zsun@gmu.edu"
] | zsun@gmu.edu |
812887664ef11d4ef10352f820768a2e60d6599e | c191091d788194f4d400f8e0698e16403a6a7d19 | /app/src/main/java/com/yashsoni/visualrecognitionsample/MenuActivity.java | 63f3193c2fa723aca539477326f35d322e5166ea | [] | no_license | retto710/TDP | ad95929993840bab6d3204944028c001f95c8808 | 2d77c89bc7390a5dce4d32efd497b46fba1c7f28 | refs/heads/master | 2020-05-05T13:50:17.054787 | 2019-05-28T22:26:34 | 2019-05-28T22:26:34 | 180,095,135 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,612 | java | package com.yashsoni.visualrecognitionsample;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.BottomNavigationView;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.TextView;
public class MenuActivity extends AppCompatActivity {
private TextView mTextMessage;
private BottomNavigationView.OnNavigationItemSelectedListener mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_home:
mTextMessage.setText(R.string.title_home);
return true;
case R.id.navigation_dashboard:
mTextMessage.setText(R.string.title_dashboard);
return true;
case R.id.navigation_notifications:
mTextMessage.setText(R.string.title_notifications);
return true;
}
return false;
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
mTextMessage = (TextView) findViewById(R.id.message);
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
}
| [
"31112329+retto710@users.noreply.github.com"
] | 31112329+retto710@users.noreply.github.com |
4a49584181da9e0498f07610404b32cf6764835a | 0bde5bd3149ba8cea8e15ca55d606210cf80c84e | /1.JavaSyntax/src/com/javarush/task/task07/task0707/Solution.java | d1b71ed7c87e2536266be6b58a323e0004a5940e | [] | no_license | Rasskopovaa/JavaRush | 481922d5626924002a9f22778e1c2844dc7a4df8 | 8c6f448c3a205f641aee43d4ec09158c85eb89c9 | refs/heads/master | 2020-06-18T09:04:47.362904 | 2019-09-06T16:25:06 | 2019-09-06T16:25:06 | 195,804,298 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 521 | java | package com.javarush.task.task07.task0707;
import java.util.ArrayList;
/*
Что за список такой?
*/
public class Solution {
public static void main(String[] args) {
ArrayList<String> list = new ArrayList<String>(5);
list.add("Home");
list.add("Cat");
list.add("Dog");
list.add("Mouse");
list.add("Minni");
System.out.println(list.size());
for (int i = 0; i < 5; i++) {
System.out.println(list.get(i));
}
}
}
| [
"raskopovaa@gmail.com"
] | raskopovaa@gmail.com |
488e8d9ffa1fa305cab39831d4874dcc47f44e1d | e9474845462e5f2531a74c760b7770d17c74baef | /10-Application/Application/Swing-Sample-APP/src/main/java/com/sgu/infowksporga/jfx/views/file/explorer/action/PasteFilesAction.java | 9cca6777f0f1fd4f0b50af0ca9104e243f2c4783 | [
"Apache-2.0"
] | permissive | github188/InfoWkspOrga | 869051f4e70ebc9a0125a0bddecdc1704e868b52 | 89162f127af51d697e25a46bc32dc90553388a54 | refs/heads/master | 2020-12-03T00:43:46.453187 | 2016-11-06T05:48:37 | 2016-11-06T05:48:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,137 | java | package com.sgu.infowksporga.jfx.views.file.explorer.action;
import java.awt.event.ActionEvent;
import com.sgu.apt.annotation.AnnotationConfig;
import com.sgu.apt.annotation.i18n.I18n;
import com.sgu.apt.annotation.i18n.I18nProperty;
import com.sgu.core.framework.spring.loader.SpringBeanHelper;
import com.sgu.infowksporga.jfx.menu.action.AbstractInfoWrkspOrgaAction;
import com.sgu.infowksporga.jfx.views.file.explorer.FileExplorerView;
import com.sgu.infowksporga.jfx.views.file.explorer.rules.IsAtLeastViewFileSelectedRule;
import com.sgu.infowksporga.jfx.zfacade.local.edit.PasteFilesFromClipboardServiceUI;
/**
* Description : Paste Files Action class<br>
*
* @author SGU
*/
public class PasteFilesAction extends AbstractInfoWrkspOrgaAction {
/**
* The attribute serialVersionUID
*/
private static final long serialVersionUID = -3651435084049489336L;
/**
* The reference to get the directory tree
*/
private final FileExplorerView fileExplorerView;
/**
* Constructor<br>
*/
@I18n(baseProject = AnnotationConfig.I18N_TARGET_APPLICATION_PROPERTIES_FOLDER, filePackage = "i18n", fileName = "application-prez",
properties = { // Force \n
@I18nProperty(key = "file.explorer.view.action.paste.files.text", value = "Coller les fichiers"), // Force \n
@I18nProperty(key = "file.explorer.view.action.paste.files.tooltip",
value = "Coller les fichiers/dossiers de la vue en cours dans le répertoire selectionné"), // Force \n
@I18nProperty(key = "file.explorer.view.action.paste.files.icon", value = "/icons/paste.png"), // Force \n
})
public PasteFilesAction(final FileExplorerView fileExplorerView) {
super("file.explorer.view.action.paste.files");
this.fileExplorerView = fileExplorerView;
setRule(new IsAtLeastViewFileSelectedRule(fileExplorerView));
}
/** {@inheritDoc} */
@Override
public void actionPerformed(final ActionEvent evt) {
final PasteFilesFromClipboardServiceUI facade = SpringBeanHelper.getImplementationByInterface(PasteFilesFromClipboardServiceUI.class);
facade.execute();
}
}
| [
"sebguisse@gmail.com"
] | sebguisse@gmail.com |
592c9d649a0f9a7a3a0efeb9c84a002d5cec01a5 | c2d19a381c139e7bbc9cd424eba43df69f02c029 | /java-demo/src/main/java/thread/semaphore/instance1/SemaphoreDemo.java | bf43a70d4ad79634ad1b3ded6ec6f211c3b3a882 | [] | no_license | Stongtong/learning-practise | c3c49b56f48de3503346404584277dcb14bc1afe | a36b233840816d1def38ebbf0a0a6ab3cd823e0b | refs/heads/master | 2022-11-20T14:17:22.876652 | 2019-06-28T09:59:41 | 2019-06-28T09:59:41 | 193,324,727 | 1 | 0 | null | 2022-11-16T12:22:27 | 2019-06-23T08:36:38 | Java | UTF-8 | Java | false | false | 1,104 | java | package thread.semaphore.instance1;
import java.util.concurrent.Semaphore;
/**
* @Description semaphore直译过来是信号量,其实质是许可管理器,用来管理可用的资源,
* 并且整个过程是阻塞的
* @Author tong
* @Date 2019/6/28 17:00
* @Version 1.0
**/
public class SemaphoreDemo {
private static Semaphore semaphore = new Semaphore(2, true);
public static void main(String[] args) throws InterruptedException {
Thread[] students101 = new Thread[5];
for (int i = 0; i < 20; i++) {
if (i < 10) {
new Thread(new Student(semaphore, "打饭学生" + i, 1)).start();
} else if (i >= 10 && i < 15) {
new Thread(new Student(semaphore, "泡面学生" + i, 2)).start();
} else {
students101[i - 15] = new Thread(new Student(semaphore, "聚餐学生" + i, 3));
students101[i - 15].start();
}
}
//
Thread.sleep(5000);
for (int i = 0; i < 5; i++) {
students101[i].interrupt();
}
}
}
| [
"tongxiao@outlook.com"
] | tongxiao@outlook.com |
8f0500a2ae04fa9f84bcd639e5b3c0ee5266b7c0 | 51934a954934c21cae6a8482a6f5e6c3b3bd5c5a | /output/3f666486d0364f2d8e12ad5b6d8ad515.java | cba06194911d91cbda8e20d9fc7c3e511c4e6f29 | [
"MIT",
"Apache-2.0"
] | permissive | comprakt/comprakt-fuzz-tests | e8c954d94b4f4615c856fd3108010011610a5f73 | c0082d105d7c54ad31ab4ea461c3b8319358eaaa | refs/heads/master | 2021-09-25T15:29:58.589346 | 2018-10-23T17:33:46 | 2018-10-23T17:33:46 | 154,370,249 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,772 | java | class fiyI7fQ {
}
class au {
public boolean p8q;
}
class crCSAs4wbw0PHj {
public static void dlwyigJSlJp (String[] rxjTj) {
while ( false.bipttFgNwxBDf) while ( !new void[ !new h4iymF3EXj9hT().vIlgoah68R0R()].U513OCbYNjAojx) while ( new QuuqGMY3HnGOa().p) return;
!2367214.NmqRkv1I;
void[] MlJs3qIleM3R = -false.LYepkH7YSQfq = -new eDVGHV().PeX8;
boolean tPZWu8I;
void[][] pJ6;
boolean[] TJm7O3Rm = !false[ !true.Z()] = -!new Wt12[ false.WsMUEDKryRvr()].eXp();
;
int[][] i2qhH;
KG fdVUwao4pNP36 = -new qS5Sb[ --null[ -!!!false.ZZQS]].Pc9OKARCDGkE = -jhS3Vtvz70pP1J[ ( -aSBt.WyABeWSo1M)._9woEutb()];
QwbvP tNt62UAp69z;
boolean YmiZOjyrOw_;
_lcM9[][] RA = !true.yTrpV0;
i[][] KVfP_wmXxL;
QaHEtDyDvJV6 uCaqE9QPy6;
void mzO37fxS;
{
boolean hC3;
{
DYLypLlJYfQPT[][][][][] IzssNeOp;
}
while ( this.v_us4qiK) ;
{
boolean ZNb8p9m2;
}
if ( !aEw76.u8WKpS786yfWq) uVn01tnvycvx5R().lbhYLpsr;
{
int[][] vow9;
}
;
return;
while ( true.hRwVq) null[ QcMdpNP6cP7b.Rn()];
void p8Ba6TB1WJQK;
void[][][][][][][][][][][] n7;
void HLP8nepQYLrHA;
int[][] NBu3;
while ( true[ --!-( !191.b6pt9mdRvWs()).euc2L]) {
!new Q[ !new Vwbvm1T_Wk().bIGGFgcfZZ_Y]._V0OCZ0;
}
boolean oL34BoIQHRfr;
int[][] EUv9;
int[][][][] PDPhLOBGfpkC;
{
int akro;
}
int[] LS;
}
}
public int Y;
public void[][][] VPUJH4dI7i () {
int F = 233297418[ null[ 5.byGPTU]];
;
boolean txX6 = -!( !--!4[ RpEbA7d3xsj[ true[ !false.NaPbYc()]]])[ XN.jbLQDO8Mhh()] = !this[ !-null.HroKLNV1aBgL];
new Rv_ijt[ 31[ this.tTT()]][ !this.Dre()];
void D4M = rJRdfv9vd3id5().D3V5LSoTkK();
boolean[][][] Th;
if ( !-!x()[ tJ8bKkIFcQ1Ivs.Kk94174kV2xZz]) while ( this.O()) ;else !!!!( null.MnGE8)[ 83[ -7056537.bwNtji()]];
!719.hT();
{
void[] oRx6svMtA;
void ZaA_hsZ;
if ( true.trg()) !-3370.M4WXRAvDEJH();
}
{
int[][][] Z;
if ( !new dBp7akzhc().G0rU0zE1KfZWVb()) {
int HG4T;
}
;
int Q71Ny0zxgGO0n;
void[] Bfm8sIRRBSIVz;
}
int Eoe = ---!new int[ !-new void[ new int[ -!_().W0n6Hn22].o6211M3_wPB].DxK7dlst1J()].S3_4o() = !new e4N7GZKjNEI().qnqNxeyezxSnP;
Z6CcXwb7Jxb.CdTX;
boolean n;
if ( !( new q7KZQ_m78tOmP[ null.qFg2ex2vi6rm2J].xVGhJuHrIqQw()).YGAqpYV5BF43r) return;else {
;
}
H_873KY[][][][] j;
void[][][] XQIzFKq = hrBWHHY[ -!this.D11];
!( !false.oDRKFlTzRk_).hQa8fwUMara_y;
int[] xxcy;
if ( !!true.h3kVJbg1RaJI9) {
if ( new int[ this.Ig6ma69m1qe33].kvs) !V31Sa1_sGh7o()[ new epOTA[ 6073492.o()].F];
}else return;
return !new G_aY6().C();
}
public int[][][][] taYldvpp7;
public L[] s5lxPXk () {
int PYmxIWXIMu1H = ( ( 930114.EFHZDhadm40Zs)[ -LYtbITIl0fHSU().gWD8nEW]).ojkxKSnU = this.wOGGyr;
;
if ( -ha.TVVD3zUAYQ()) ;
}
public DsgtML[] p0;
public int[][] R_iL6;
public int[] G3cV0qBtImFBG3 (int ps8Fd) throws d {
!!!!!!Btqe().uKaxX4();
boolean NBjSHh99jU = null.Gp1L1DdfgpNi4Q() = !XZ4.K_XyUUIpqHGwG();
;
;
}
public int TC6FpFqNtn59Fs (boolean k_mhxbu8dn9J_, int[] tOnODPKqGmcE) {
void[][] ksfd = !this.kr_Bx;
void h = !null[ !!!this.AIgM];
int ot_ABIZOP = !---wyubcP2NW.w8dWDPE0qRX1yY();
while ( this.zbAslOWZhR0jCE) return;
void[][][] glfoQzptjQ6Mc = -78[ -!HqkQvZ2xgMhU[ -new int[ new int[ true.A][ p0qsL_kd_bQv_().EXk6WQKiPuEpk()]].hO7XI29()]] = true.jHkxGWA67V160;
}
}
class ERmFTogRitb0QC {
}
class yLmRxO {
}
class MdpjkAETmYjEy {
public int[][][] PzfihVw;
public boolean OiuYjv (boolean KI7pWOR, void FYs9siv, boolean[][] q) {
void[] FqmBHi = this.MiSI5ICLJ;
return;
boolean Mz9DRZa9wFz;
return this.hmP_fs9ziU_;
;
void[] yDo7sw0;
if ( !O7h31F2hED[ !-!---true.JIE3Wr1Ehb9m9()]) ;else {
{
int[] v;
}
}
rdWyMZflw[] n;
return;
{
_do9pT[][] NNj6oRorI;
xW7fXwMSqWCVd jQhKJC6wbRA;
;
while ( this[ !!-dtCk.E3_Sa()]) 15596147[ false[ !-PcGq5alfl()[ this[ false.EpvW8NYgu7XWb()]]]];
while ( uts().j1qaQO4()) {
boolean[][] CJElLkZHTCfRRA;
}
void[][][][] gqUJ9x;
void[] fOa;
!!new ABYg3D()[ !!!false.YUyqnfN82s()];
return;
int CWEeLOegEZU;
return;
void Xw16qUKpMq;
boolean[][] d6qCVCslGbtAF;
int s;
;
}
void LdwLvdbXyRxt6c;
if ( !!( 2228[ false[ -false[ 16251.COpUClRAIf]]]).oz()) R()[ !!y1vQ9NN82mXQa().FA()];
if ( !--true.LCrg_Rbqzy) while ( --false[ !true[ new mUmZkk5RCQf9q_().QoQMIN3Heu7QQ8()]]) return;else {
if ( null.BZ1674c15Yktgc) while ( ( -new EC5gSixjMUM()[ !this.F30LzA8]).HTWh()) ;
}
}
}
class OHzsDEza8nlEDC {
public EzoEhNKPneWQ[][][][] OhF1m9mM (int[] Xul2ElXqx7, void[][][] ti, boolean[][] nhrSr, boolean HoK1) {
return;
return;
int[][] voDepxLB;
boolean T4rF_Z = !!this[ this.yr1tFG1bnA()];
void[] aNAtmYBnXeA1 = -true.ldH();
int mukf1y0NJ;
boolean wlfw = -!!null.A1dw1() = !!new AiGtFX[ !!-true[ !this.z931H()]].LqqcK5();
}
public static void RL (String[] SzX) throws R9IA9G5d {
if ( null.uqroxEgaeZp) ;
dpOdCuznium[][] B2Gsfx5Hc = new void[ zEpyuHfsGk.e5xcAC()].sUm = 9835777[ !( !-( !this.K)._C7_OK).ZbnRCbW()];
{
void[][][] XvvuNut1;
;
fuDMPk[][][][] iNOhq;
;
void HIs;
void[] wmD;
void[] QPbQX;
return;
aN[][][][][][] oM2;
boolean[] L;
void A7hG;
boolean lH4IR9gKIis0X;
int[][] efLB;
void[][][][] BucQk_pbDHXIW;
KCHsOD[] qDzDs0ojSj8op;
return;
ZgE9WJuczGx At98o;
}
void[][] KEON;
boolean vj9BhK15 = ppRVMv1t.F() = -!!-( false.dDSBP53crLk())[ null.FV()];
-true.QfS();
void[][][][] yIpy8fzdVHOorD;
int[][][][][] cNf4bN;
while ( -new void[ !5742.t5CqqHlJG].Uy8fn_AU()) while ( !!!38183543[ this.j12I]) ;
boolean[] jFwUWOYauLF;
void[][] BJRGI = -!-828229857.fKIuwqDG() = -true[ --Rv.OoQS8pVsPLXhEF];
-!true[ !!!!( !pz4zg6V8M().fLyowj).G()];
int[] MY4CQneG1RmNJI;
gIYu1oo g8vW5018lCR0yE = -new akzA9Oa6Lfba7C()[ !null._lFDV6];
false[ true.k()];
while ( this.DWvdNHrhUibze()) if ( bz.y2ZRnw) if ( --!!-9103.k4d2q67jf112) while ( -new int[ !--!!wOTGajRJ[ !--false[ !-new boolean[ !new rV4()[ !-!true[ seqFh0siNdH().xWtVgXl8NT]]].Lvf]]][ -620017842.FHo6Ke]) this.I3tjA();
this.XFvY3yPCj;
dddNxKUKQxjzX[] Vw;
int MIznjT_HDH0;
}
public boolean[] Ux3wLtkqwmT (boolean _RrDqmhvmxaMhJ, void[][] m5xqH, void[][] E0yMz) throws x_D8aL33Zgels {
return null.cQ();
--new k7LPg().SvL9OY_w2;
;
;
int[] tesTqH77L_AO;
eQNQxUaGBngsQZ Qt9xxTDnxy6 = !false.fFaz7 = n1eL().i_dQBgjTiy;
if ( false.i7c8vNLsg6JJp) true[ true.R()];
void[] Zrm913df7Xvh = new wkgSaHa().SABUBa() = !new JUlA9k6ryyMeG().Gus();
if ( this.OkNlDFHvk()) return;else VfD1tVOuHl8hHo.e3BYe5();
}
public static void re3V5VGPlzcqs1 (String[] H) throws v {
return;
yGEx9oGRO0_lb[] JSglTecnOP;
;
boolean ALx_My4fZ;
void[] DYBd2;
yBLSULIPL4hlK[][][] byXoKs = new orzmQThI[ !this.ZM].XxzL6Wsd5k = -C491by()[ -!--!this.mmrRSQ5S()];
int[][] hwbM_;
void[][][][][][] q6kxq1Fg = !fYeJAvuAzC3uUF.E();
!w2.b8TMmnlgK5();
boolean[][] B = false[ !this[ !!-!new epeGiYG().iNldjT7nXuVg()]];
boolean Yq = false[ kx.Cd()];
if ( new void[ -null[ -!565016[ !L_zF6Jxjy.laEWuLPQFa()]]][ NbSF02ircyNF[ -new SJDI3etM().OhnamYP()]]) return;
return ---null.k1E9kOHRDGX();
}
public boolean HeVHE () throws SsaEn7KPaK3f {
if ( new XYxgs()[ uprJIC9HL.upuy2l9CUQB_qF]) return;else {
int[] PX7i_ft;
}
int JNdicAlGU;
boolean qJiS1mfK = ( ( !--false.usqi).eYyjS_()).QYwpSZ0G4SEwKc();
boolean nhptPw = !new void[ 53.GnqNpUFkU()][ -uirMO3jFURZj()[ -null.u8DLNZQ6BaMG]];
boolean F5p8 = -( -null.d8nGQYQd8()).kM6;
;
CcrWK2oZgmne[] Goc139tT = ( !null[ true[ !1294.oJGGOE0MHCTn()]]).Al0q5tIO1SWZI = -null.R7l8KS4m();
if ( -!!-!--86499[ ( -!( !-false.yuR6Bbyf2IBh).pdoZBPp0Z5X).y02yW9BXYDQh]) if ( !new void[ !----true.Cbldg].c) if ( ytHdla8A().TN_1qfqss7TzOP) while ( --!!-oxb8jI.SB_) if ( -( false.iItIt).zandtiB()) {
F6wq[][][][][] jjlJX0Bx;
}else if ( new int[ v1oOW.lGVFcPFzPG].Y7aVPC6pW()) ;
boolean PkS5mux9bRJIBd;
;
}
public int[][] b7T (cO mtPSjxxCGJ6BX, int[][][] xFJUh) throws fN88C {
return ------( Te_tBHJ0Ieu()[ 32132.wa0hoZdl9nq()]).AYLao5ENOgORB;
{
void[] akbnmUnsSd;
;
return;
-XwmlA5.G;
boolean mvkpFmnUkm1;
;
boolean zl;
while ( !new _().DbEw) {
return;
}
int hVdZJt;
void Fcxkuq8;
N9SgFpR5la7Lp[][] Nhpha1UbUcy;
while ( GEt2Fri.JiV3n8jt4()) return;
boolean MOx89BOl4UkgW;
;
while ( ( null.WC)[ -null.U_()]) ;
if ( !-vzGye4.mSh()) null.pNVHD;
int otYmVU;
}
;
return false.Qb6zf9MTZ_bb;
}
public boolean[] tywdtiJJXZ9JRN;
public static void SKCwe9ANubrv7Z (String[] J1v80) throws uvZ_30OvR {
{
{
if ( -new bla()[ 1570319.zu_x6duU1CSoyA]) ;
}
while ( jAOKF6.uVGnP0ha) if ( -this.bg) while ( false[ null.M2x]) while ( ---true.Zj) while ( !( -new qCJ().pxeCJ).InM3Gvraj) while ( ( TOLxmjeYnKj()[ !-new void[ !null.NQ()].yzWjH5]).LNkT()) ;
{
while ( !null.sVE7Iv()) while ( new D6bTPBGCnir5m()[ new AMFbwHfGnP()[ this.uSW7oUnXa4ITN_()]]) while ( !---false._rdysLO7QOyt()) ;
}
if ( this[ -MD_.ky9F_BDF()]) {
while ( 0.clbwp) -!-( --173385.kT3gaVi)[ true.A8Kd()];
}
int F5rkvhhdVGIiE;
boolean xVzrQXUaMc4bI;
void[] LI2GRY;
boolean[] wKxdtB9VNej8je;
boolean[] fPxE6i;
{
_HKN[] B1fQHE;
}
}
--this.phfjWZZpA_dOo;
;
boolean[][] XrffERDbtb17Y4;
void XO1BejS3L = --!TxPAZ_c47EaJc().CYVSu();
while ( !-true[ false.r_3dN7eejA]) return;
( !-!-!new int[ !-!!-new gZlXlafZuz[ QkUcqP()[ 27308.Y()]][ RT4u()[ new void[ new int[ 692811750[ false.np()]].lLudKU8].or4ICODv]]].yDAw3x3cKf)[ !false.I()];
D_O4PsUetnP[][][][] ta0J5CpTL;
void[] Qq9844tnYfa8;
false.gB();
}
}
| [
"hello@philkrones.com"
] | hello@philkrones.com |
558b0b588351843f79de42691c20832976f63f5c | ca8a5fe30f50cee94c9abcfbf05b11f271078e47 | /src/edu/ucsd/dbmi/drugtarget/genomicsqs/ProteinSimcomp.java | 8700dd86b5a71e3fd98c85f5f310be0f984ccfd5 | [] | no_license | zongnansu1982/drug-target-prediction | 8a2d4b43614eca065ae03a7133a3928f5dd3e48f | 40a7cc1d9cc5c091226dc8a3cec295fa8564cfde | refs/heads/master | 2022-09-21T23:10:16.672229 | 2021-02-15T14:54:49 | 2021-02-15T14:54:49 | 77,171,926 | 14 | 4 | null | 2022-09-01T22:22:47 | 2016-12-22T19:54:04 | Java | UTF-8 | Java | false | false | 2,172 | java | package edu.ucsd.dbmi.drugtarget.genomicsqs;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
public class ProteinSimcomp {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
public HashMap<String,String> idx;
public HashSet<String> sourceProtein;
public ProteinSimcomp () throws IOException{
idx=new ProteinCollector().getProtein("data/input/drugbank/drugbank_dump.nt");
sourceProtein=new ProteinCollector().getSourceProtein("D:/data/drug-target/input/tri/external/connected/external_connected_filtered.nt");
}
public void getBatchScores(String outfolder) throws InterruptedException, IOException{
int k=0;
HashSet<String> computations=new HashSet<>();
for (String source:sourceProtein) {
for(Entry<String,String> entry:idx.entrySet()){
computations.add(source+" "+entry.getKey());
}
}
ArrayList<String> computationList=new ArrayList<>();
for(String string:computations){
computationList.add(string);
}
int size=computations.size()/10;
ExecutorService pool = Executors.newFixedThreadPool(10);
for (int i = 0; i < 10; i++) {
HashSet<String> set=new HashSet<>();
for (int j = size*i; j < size*(i+1)&j<computationList.size(); j++) {
set.add(computationList.get(j));
}
pool.execute(new ProteinSimilarityRunable(set, idx, new File(outfolder+"/thread_"+i+".txt"),"@ Thread_"+i));
}
pool.shutdown(); // Disable new tasks from being submitted
while(!pool.awaitTermination(10, TimeUnit.MINUTES))
{
Date now = new Date();
Calendar cal = Calendar.getInstance();
DateFormat d2 = DateFormat.getDateTimeInstance();
String str2 = d2.format(now);
System.out.println(str2);
}
}
}
| [
"zongnansu1982@gmail.com"
] | zongnansu1982@gmail.com |
57a2730ff1bc91fb59298ee2231555ccf7cea9a6 | f7160c0f0526cc5afc0fe4e6f06d384394059aa1 | /fsa/fs-gridservice/src/impl/java/com/fs/gridservice/core/impl/hazelcast/objects/DgSetHC.java | 9de3c93f60b79e4a4e2fd16b0c8b917058f962be | [] | no_license | o1711/somecode | e2461c4fb51b3d75421c4827c43be52885df3a56 | a084f71786e886bac8f217255f54f5740fa786de | refs/heads/master | 2021-09-14T14:51:58.704495 | 2018-05-15T07:51:05 | 2018-05-15T07:51:05 | 112,574,683 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,718 | java | /**
* Dec 13, 2012
*/
package com.fs.gridservice.core.impl.hazelcast.objects;
import java.util.ArrayList;
import java.util.List;
import com.fs.gridservice.core.api.objects.DgSetI;
import com.fs.gridservice.core.impl.hazelcast.DataGridHC;
import com.fs.gridservice.core.impl.hazelcast.HazelcastObjectWrapper;
import com.hazelcast.core.ISet;
import com.hazelcast.core.Instance;
/**
* @author wuzhen
*
*/
public class DgSetHC<V> extends HazelcastObjectWrapper<ISet<V>> implements
DgSetI<V> {
/**
* @param q
*/
public DgSetHC(String name, Instance q, DataGridHC dg) {
super(name, (ISet<V>) q, dg);
}
/*
* (non-Javadoc)
*
* @see
* com.fs.gridservice.core.api.objects.DgSetI#contains(java.lang.Object)
*/
@Override
public boolean contains(V value) {
this.assertNotDestroied();
return this.target.contains(value);
}
/*
* (non-Javadoc)
*
* @see com.fs.gridservice.core.api.objects.DgSetI#remove(java.lang.Object)
*/
@Override
public boolean remove(V value) {
return this.target.remove(value);
}
/*
* (non-Javadoc)
*
* @see com.fs.gridservice.core.api.objects.DgSetI#add(java.lang.Object)
*/
@Override
public boolean add(V value) {
return this.target.add(value);
}
/*
* (non-Javadoc)
*
* @see com.fs.gridservice.core.api.objects.DgSetI#valueList()
*/
@Override
public List<V> valueList() {
return new ArrayList<V>(this.target);
}
@Override
public void dump() {
System.out.println("set:" + this.name);
System.out.println("-Start------------------------");
System.out.println("TODO");
System.out.println("------------------------End-");
}
}
| [
"wkz808@163.com"
] | wkz808@163.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.