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
b735a928943b6de4506bec99a13eee15125aa709
732afa5314922dd24662890f89c6d1d546793645
/algorithmprogram/SqrtFunction.java
d6f8feb409236be5348e4eb0ec26bd7e06c83d45
[]
no_license
anshuman161/All-Programs
5c76742ba2e79a99c5c465768933c915417d4aff
90a7076f6f891c5c0bd60ef5859ebc9286ac6baa
refs/heads/master
2020-06-27T06:16:34.118628
2019-08-17T09:13:00
2019-08-17T09:13:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package com.bridgelabz.algorithmprogram; public class SqrtFunction { public static void main(String[] args) { double t,c; c=100; System.out.println(c); t=c; double epsilon = 1^ -15; while (Math.abs(t - c/t) > epsilon*t) { t = (c/t + t) / 2.0; } System.out.println(t); } }
[ "prema.s2608@gmail.com" ]
prema.s2608@gmail.com
2cfe4a28db14d0273664b8fb44cdb18792b633de
d4540f5d7857dc89d83e0610a808f247ce94d411
/src/main/java/com/coviam/bookstore/gateway/DTO/QuantityUpdateDTO.java
79db004b96894c54b326dbe139f57f1e52742b8c
[]
no_license
tailordhruv/t3_gatewayMS
a3700e120cc27a7805e21ab89cc1e7119b996798
2dc618fb5e76dda5ee75df4ea4de831dd5aa1004
refs/heads/master
2020-12-14T19:59:16.129632
2020-01-24T13:43:47
2020-01-24T13:43:47
234,853,179
0
0
null
null
null
null
UTF-8
Java
false
false
261
java
package com.coviam.bookstore.gateway.DTO; import lombok.Getter; import lombok.Setter; import lombok.ToString; @Getter@Setter@ToString public class QuantityUpdateDTO { private String merchantId; private String productId; private String quantity; }
[ "dhruv.tailor@coviam.com" ]
dhruv.tailor@coviam.com
d5839f12b343343ba9a208f1c891fe86e9894595
18b98769890fa6f255412f2c96b77f36cac507c5
/app/src/main/java/com/example/joao/berrantinho/model/DocumentDate.java
3610b3f079a816f353e15eb2482e489b72657c88
[]
no_license
krllus/berrantinho
d403562c3c96d8714961de911983ff25bf71aa20
10c9692e9d5ca984be6b167fb96fd43078ba0157
refs/heads/master
2021-09-28T02:37:21.582250
2018-11-13T13:16:37
2018-11-13T13:16:37
111,083,749
0
0
null
null
null
null
UTF-8
Java
false
false
208
java
package com.example.joao.berrantinho.model; /** * Created by João Carlos on 5/14/18. * Biox Pecuária Moderna * desenvolvedorberrante@bioxbr.com */ public interface DocumentDate { String getDate(); }
[ "joaocarlusferrera@gmail.com" ]
joaocarlusferrera@gmail.com
66394b1b469442deb98caf33fe393c342d99836e
9a9ae2523c5f068a0c5f84e6af21c7459590b3c0
/TestToDB/src/main/java/commandPattern/RemoveAction.java
2ea7c68307192f32f88b8086837e3aa5b8f1d885
[]
no_license
KonstantinBuzhin/testDBJenkins
661f4d99a87e1d35439c589ccc41116429c27e08
7a312971dd45f2fdd26ea24aa259a5ec35a451dd
refs/heads/master
2023-03-27T11:46:10.764071
2021-03-28T16:33:45
2021-03-28T16:33:45
350,094,728
0
0
null
null
null
null
UTF-8
Java
false
false
486
java
package commandPattern; import java.io.IOException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import services.PageService; import services.RemovingPageService; public class RemoveAction implements Action { private final PageService service = new RemovingPageService(); @Override public void execute(HttpServletRequest request, HttpServletResponse response) throws IOException { service.createPage(request, response); } }
[ "k.buzhin.11@gmail.com" ]
k.buzhin.11@gmail.com
b6fa683a7261448cc8dd866b237739ebc1ed430b
e58a8e0fb0cfc7b9a05f43e38f1d01a4d8d8cf1f
/WidgetWarren/src/com/puttysoftware/widgetwarren/objects/Ruby.java
3cc9d2eb758eb4e505f18c65fc642eeb65a2558f
[ "Unlicense" ]
permissive
retropipes/older-java-games
777574e222f30a1dffe7936ed08c8bfeb23a21ba
786b0c165d800c49ab9977a34ec17286797c4589
refs/heads/master
2023-04-12T14:28:25.525259
2021-05-15T13:03:54
2021-05-15T13:03:54
235,693,016
0
0
null
null
null
null
UTF-8
Java
false
false
959
java
/* WidgetWarren: A Maze-Solving Game Copyright (C) 2008-2014 Eric Ahnell Any questions should be directed to the author via email at: products@puttysoftware.com */ package com.puttysoftware.widgetwarren.objects; import com.puttysoftware.widgetwarren.WidgetWarren; import com.puttysoftware.widgetwarren.generic.GenericScoreIncreaser; public class Ruby extends GenericScoreIncreaser { // Fields private static final long SCORE_INCREASE = 100L; // Constructors public Ruby() { super(); } @Override public String getName() { return "Ruby"; } @Override public String getPluralName() { return "Rubys"; } @Override public void postMoveActionHook() { WidgetWarren.getApplication().getGameManager() .addToScore(Ruby.SCORE_INCREASE); } @Override public String getDescription() { return "Rubys increase your score when picked up."; } }
[ "eric.ahnell@puttysoftware.com" ]
eric.ahnell@puttysoftware.com
011b0ffbd6f56738a181746d34d783351ed7a2bb
a2c8932f4275af22bac7d247cb23be8db90495e9
/src/main/java/cloudbase/core/client/mapreduce/CloudbaseInputFormatShim.java
d70a504f72ba09b3e52cc9f4de094d13a7c16bd5
[]
no_license
jstoneham/accumulo-cloudbase-shim
cfeac497cc6a1aa3f40fead7dc2803adbc0a1970
0a7368b28de6fe7edb0f8372ff6cff56f44a6f6a
refs/heads/master
2020-05-18T04:17:46.750762
2013-07-25T15:40:24
2013-07-25T15:40:24
8,102,700
0
1
null
null
null
null
UTF-8
Java
false
false
3,470
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 cloudbase.core.client.mapreduce; import cloudbase.core.client.Instance; import cloudbase.core.client.TableNotFoundException; import cloudbase.core.client.impl.TabletLocator; import cloudbase.core.data.Range; import cloudbase.core.security.Authorizations; import cloudbase.core.util.Pair; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.JobContext; import org.apache.log4j.Level; import java.io.IOException; import java.util.List; import java.util.Set; public class CloudbaseInputFormatShim extends CloudbaseInputFormat { public static boolean isIsolated(JobContext job) { return CloudbaseInputFormat.isIsolated(job); } public static String getUsername(JobContext job) { return CloudbaseInputFormat.getUsername(job); } public static byte[] getPassword(JobContext job) { return CloudbaseInputFormat.getPassword(job); } public static String getTablename(JobContext job) { return CloudbaseInputFormat.getTablename(job); } public static Authorizations getAuthorizations(JobContext job) { return CloudbaseInputFormat.getAuthorizations(job); } public static Instance getInstance(JobContext job) { return CloudbaseInputFormat.getInstance(job); } public static TabletLocator getTabletLocator(JobContext job) throws TableNotFoundException { return CloudbaseInputFormat.getTabletLocator(job); } public static List<Range> getRanges(JobContext job) throws IOException { return CloudbaseInputFormat.getRanges(job); } public static String getRegex(JobContext job, RegexType type) { return CloudbaseInputFormat.getRegex(job, type); } public static Set<Pair<Text, Text>> getFetchedColumns(JobContext job) { return CloudbaseInputFormat.getFetchedColumns(job); } public static boolean getAutoAdjustRanges(JobContext job) { return CloudbaseInputFormat.getAutoAdjustRanges(job); } public static Level getLogLevel(JobContext job) { return CloudbaseInputFormat.getLogLevel(job); } public static void validateOptions(JobContext job) throws IOException { CloudbaseInputFormat.validateOptions(job); } public static int getMaxVersions(JobContext job) { return CloudbaseInputFormat.getMaxVersions(job); } public static List<CBIterator> getIterators(JobContext job) { return CloudbaseInputFormat.getIterators(job); } public static List<CBIteratorOption> getIteratorOptions(JobContext job) { return CloudbaseInputFormat.getIteratorOptions(job); } }
[ "kvangrae@texeltek.com" ]
kvangrae@texeltek.com
30142333c70555b4bbbcc3f089bac71c38a00aae
509d496f1d4a37d1b56693d19cf96c528938baaa
/src/argouml-app/src/org/argouml/uml/ui/foundation/core/PropPanelAttribute.java
5a8f23f4571c9e8c7fff3c70fcc201db4fa60f25
[ "LicenseRef-scancode-other-permissive", "BSD-3-Clause" ]
permissive
SofienBoutaib/argouml
bb65203a680b6d2c977c0bb96637914fd30584b1
71809598cfc3793b14809c51c975ac305e9bea6a
refs/heads/master
2022-06-20T21:36:50.184555
2011-11-01T17:43:21
2011-11-01T17:43:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,922
java
/* $Id: PropPanelAttribute.java 18588 2010-07-28 21:30:25Z bobtarling $ ***************************************************************************** * Copyright (c) 2009 Contributors - see below * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * dthompson ***************************************************************************** * * Some portions of this file was previously release using the BSD License: */ // Copyright (c) 1996-2008 The Regents of the University of California. All // Rights Reserved. Permission to use, copy, modify, and distribute this // software and its documentation without fee, and without a written // agreement is hereby granted, provided that the above copyright notice // and this paragraph appear in all copies. This software program and // documentation are copyrighted by The Regents of the University of // California. The software program and documentation are supplied "AS // IS", without any accompanying services from The Regents. The Regents // does not warrant that the operation of the program will be // uninterrupted or error-free. The end-user understands that the program // was developed for research purposes and is advised not to rely // exclusively on the program for any reason. IN NO EVENT SHALL THE // UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, // SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, // ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF // THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF // SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE // PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF // CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, // UPDATES, ENHANCEMENTS, OR MODIFICATIONS. package org.argouml.uml.ui.foundation.core; import java.util.List; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; import org.argouml.i18n.Translator; import org.argouml.model.Model; import org.argouml.uml.ui.ActionNavigateContainerElement; import org.argouml.uml.ui.ActionNavigateUpNextDown; import org.argouml.uml.ui.ActionNavigateUpPreviousDown; import org.argouml.uml.ui.UMLComboBoxNavigator; import org.argouml.uml.ui.UMLExpressionBodyField; import org.argouml.uml.ui.UMLExpressionLanguageField; import org.argouml.uml.ui.UMLExpressionModel2; import org.argouml.uml.ui.UMLUserInterfaceContainer; import org.argouml.uml.ui.foundation.extension_mechanisms.ActionNewStereotype; /** * The properties panel for an Attribute of a Classifier, * and the Qualifier of an AssociationEnd. * * @author jrobbins * @author jaap.branderhorst * @deprecated in 0.31.2 by Bob Tarling This is replaced by the XML property * panels module */ @Deprecated public class PropPanelAttribute extends PropPanelStructuralFeature { /** * The serial version. */ private static final long serialVersionUID = -5596689167193050170L; /** * The constructor. * */ public PropPanelAttribute() { super("label.attribute", lookupIcon("Attribute")); addField(Translator.localize("label.name"), getNameTextField()); addField(Translator.localize("label.type"), new UMLComboBoxNavigator( Translator.localize("label.class.navigate.tooltip"), getTypeComboBox())); addField(Translator.localize("label.multiplicity"), getMultiplicityComboBox()); addField(Translator.localize("label.owner"), getOwnerScroll()); add(getVisibilityPanel()); addSeparator(); add(getChangeabilityRadioButtonPanel()); JPanel modifiersPanel = createBorderPanel( Translator.localize("label.modifiers")); modifiersPanel.add(getOwnerScopeCheckbox()); add(modifiersPanel); UMLExpressionModel2 initialModel = new UMLInitialValueExpressionModel( this, "initialValue"); JPanel initialPanel = createBorderPanel(Translator .localize("label.initial-value")); JScrollPane jsp = new JScrollPane(new UMLExpressionBodyField( initialModel, true)); jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER); initialPanel.add(jsp); initialPanel.add(new UMLExpressionLanguageField(initialModel, false)); add(initialPanel); addAction(new ActionNavigateContainerElement()); addAction(new ActionNavigateUpPreviousDown() { public List getFamily(Object parent) { if (Model.getFacade().isAAssociationEnd(parent)) { return Model.getFacade().getQualifiers(parent); } return Model.getFacade().getAttributes(parent); } public Object getParent(Object child) { return Model.getFacade().getModelElementContainer(child); } }); addAction(new ActionNavigateUpNextDown() { public List getFamily(Object parent) { if (Model.getFacade().isAAssociationEnd(parent)) { return Model.getFacade().getQualifiers(parent); } return Model.getFacade().getAttributes(parent); } public Object getParent(Object child) { return Model.getFacade().getModelElementContainer(child); } }); addAction(new ActionAddAttribute()); addAction(new ActionAddDataType()); addAction(new ActionAddEnumeration()); addAction(new ActionNewStereotype()); addAction(getDeleteAction()); } private class UMLInitialValueExpressionModel extends UMLExpressionModel2 { /** * The constructor. * * @param container the container of UML user interface components * @param propertyName the name of the property */ public UMLInitialValueExpressionModel( UMLUserInterfaceContainer container, String propertyName) { super(container, propertyName); } /* * @see org.argouml.uml.ui.UMLExpressionModel2#getExpression() */ public Object getExpression() { Object target = getTarget(); if (target == null) { return null; } return Model.getFacade().getInitialValue(target); } /* * @see org.argouml.uml.ui.UMLExpressionModel2#setExpression(java.lang.Object) */ public void setExpression(Object expression) { Object target = getTarget(); if (target == null) { throw new IllegalStateException( "There is no target for " + getContainer()); } Model.getCoreHelper().setInitialValue(target, expression); } /* * @see org.argouml.uml.ui.UMLExpressionModel2#newExpression() */ public Object newExpression() { return Model.getDataTypesFactory().createExpression("", ""); } } }
[ "email@cs-ware.de" ]
email@cs-ware.de
b35eeb0cf71abecad91383fd71ede4a36b94383a
efeaa8d4a75e688f332e7e6c574a24432da996ef
/src/service/InfoService.java
330292d51a207beb4cd86baed336b0217e995a28
[]
no_license
tecWang/admin
537ad7261a5dd46299e3be6cf70af2ff6c73857c
5956707dd34b435d3bfdc492b53e80c838d93a38
refs/heads/master
2020-03-19T07:37:53.721813
2018-06-11T09:40:25
2018-06-11T09:40:25
136,133,596
0
0
null
null
null
null
UTF-8
Java
false
false
412
java
package service; import beans.Info; public class InfoService { public void IsEmptyInfo(Info info) throws Exception{ if(info == null){ // 如果查询为空,则说明信息不存在 System.out.println("faild to search the info!"); throw new Exception("信息不存在"); }else { System.out.println("success to search the info!"); throw new Exception(info.getInfo_ID()); } } }
[ "tecwang@139.com" ]
tecwang@139.com
923efff441e65987038072b333942d18212883eb
d3aa03a1816bd37429971e83c4e26066626ee35e
/app/src/main/java/cn/edu/gdmec/android/mobileguard/m5virusscan/adapter/ScanVirusAdapter.java
61f615cbb45c3af2ce7efd29c6e0919cecd17117
[]
no_license
zjqzjiqzjq/MobileGuard
753ec19cf6b9b90c1c453d038e6a47a29cceb9ed
9248e0b214637744fe2941f7194ed3d5774a27f9
refs/heads/master
2021-09-03T02:45:23.775173
2018-01-05T01:13:11
2018-01-05T01:13:11
104,575,519
0
1
null
null
null
null
UTF-8
Java
false
false
2,356
java
package cn.edu.gdmec.android.mobileguard.m5virusscan.adapter; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import java.util.List; import cn.edu.gdmec.android.mobileguard.R; import cn.edu.gdmec.android.mobileguard.m5virusscan.entity.ScanAppInfo; public class ScanVirusAdapter extends BaseAdapter{ private List<ScanAppInfo> mScanAppInfos; private Context context; public ScanVirusAdapter(List<ScanAppInfo> scanAppInfo, Context context){ super(); mScanAppInfos = scanAppInfo; this.context = context; } static class ViewHolder{ ImageView mAppIconImgv; TextView mAppNameTV; ImageView mScanIconImgv; } @Override public int getCount(){ return mScanAppInfos.size (); } @Override public Object getItem(int i){ return mScanAppInfos.get ( i ); } @Override public long getItemId(int i){ return i; } @Override public View getView(int i, View view, ViewGroup viewGroup){ ViewHolder holder; if (view == null){ view = View.inflate ( context, R.layout.item_list_applock, null ); holder = new ViewHolder (); holder.mAppIconImgv = (ImageView) view.findViewById ( R.id.imgv_appicon ); holder.mAppNameTV = (TextView) view.findViewById ( R.id.tv_appname ); holder.mScanIconImgv = (ImageView) view.findViewById ( R.id.imgv_lock ); view.setTag ( holder ); }else { holder = (ViewHolder) view.getTag (); } ScanAppInfo scanAppInfo = mScanAppInfos.get ( i ); if (!scanAppInfo.isVirus){ holder.mScanIconImgv.setBackgroundResource ( R.drawable.blue_right_icon ); holder.mAppNameTV.setTextColor ( context.getResources ().getColor ( R.color.black ) ); holder.mAppNameTV.setText ( scanAppInfo.appName ); }else { holder.mAppNameTV.setTextColor ( context.getResources ().getColor ( R.color.bright_red ) ); holder.mAppNameTV.setText ( scanAppInfo.appName+"("+scanAppInfo.description+")" ); } holder.mAppIconImgv.setImageDrawable ( scanAppInfo.appicon ); return view; } }
[ "840352773@qq.com" ]
840352773@qq.com
1ae109ec2e1508e3e2c8230022ddbf1e4e641625
95205e5f656dd4fbab614915a6d6c75e8e76de98
/service2/src/main/java/com/example/service2/statistic/Statistic.java
8c81c26ecf660bcee5d46d28a016ef719f49f82f
[]
no_license
dorohovGeorge/coursework_harbour
1bff1792ad1998263dd3b1e97c93d1ff3cc9e5fe
74b9f01c01ca03432bac6cbbdd7f90a69062dd61
refs/heads/master
2023-08-23T11:08:51.728782
2021-10-02T17:44:08
2021-10-02T17:44:08
412,869,568
0
0
null
null
null
null
UTF-8
Java
false
false
5,476
java
package com.example.service2.statistic; import java.util.Arrays; import java.util.List; public class Statistic { private List<List<ShipStatistic>> statistics; private Summary summaryStatistics; public Statistic(List<List<ShipStatistic>> statistics, Summary summaryStatistics) { this.statistics = statistics; this.summaryStatistics = summaryStatistics; } public List<List<ShipStatistic>> getStatistics() { return statistics; } public Summary getSummaryStatistics() { return summaryStatistics; } public static class ShipStatistic { private String shipName; private String timeOfArrival; private long waitingTime; private long startTimeOfUnloading; private long durationOfUnloading; public ShipStatistic(String name, String timeOfArrival, long waitingTime, long startTimeOfUnloading, long durationOfUnloading) { this.shipName = name; this.timeOfArrival = timeOfArrival; this.waitingTime = waitingTime; this.startTimeOfUnloading = startTimeOfUnloading; this.durationOfUnloading = durationOfUnloading; } public String getShipName() { return shipName; } public void setShipName(String shipName) { this.shipName = shipName; } public String getTimeOfArrival() { return timeOfArrival; } public void setTimeOfArrival(String timeOfArrival) { this.timeOfArrival = timeOfArrival; } public long getWaitingTime() { return waitingTime; } public void setWaitingTime(long waitingTime) { this.waitingTime = waitingTime; } public long getStartTimeOfUnloading() { return startTimeOfUnloading; } public void setStartTimeOfUnloading(long startTimeOfUnloading) { this.startTimeOfUnloading = startTimeOfUnloading; } public long getDurationOfUnloading() { return durationOfUnloading; } public void setDurationOfUnloading(long durationOfUnloading) { this.durationOfUnloading = durationOfUnloading; } @Override public String toString() { return "ShipStatistic{" + "shipName='" + shipName + '\'' + ", timeOfArrival=" + timeOfArrival + ", waitingTime=" + waitingTime + ", startTimeOfUnloading=" + startTimeOfUnloading + ", durationOfUnloading=" + durationOfUnloading + '}'; } } public static class Summary { private int unloadedShip; private long averageWaitingTime; private long maxUnloadLatency; private long averageUnloadLatency; private long fine; private int[] requiredCountOfCranes; private int[] fineForTypesOfShips; public Summary() { this.requiredCountOfCranes = new int[3]; this.fineForTypesOfShips = new int[3]; } public int getUnloadedShip() { return unloadedShip; } public void setUnloadedShip(int unloadedShip) { this.unloadedShip = unloadedShip; } public long getAverageWaitingTime() { return averageWaitingTime; } public void setAverageWaitingTime(long averageWaitingTime) { this.averageWaitingTime = averageWaitingTime; } public long getMaxUnloadLatency() { return maxUnloadLatency; } public void setMaxUnloadLatency(long maxUnloadLatency) { this.maxUnloadLatency = maxUnloadLatency; } public long getAverageUnloadLatency() { return averageUnloadLatency; } public void setAverageUnloadLatency(long averageUnloadLatency) { this.averageUnloadLatency = averageUnloadLatency; } public long getFine() { return fine; } public void setFine(long fine) { this.fine = fine; } public int[] getRequiredCountOfCranes() { return requiredCountOfCranes; } public void setRequiredCountOfCranes(int type, int value) { this.requiredCountOfCranes[type] = value; } public int[] getFineForTypesOfShips() { return fineForTypesOfShips; } public void setFineForTypesOfShips(int type, int value) { this.fineForTypesOfShips[type] = value; } @Override public String toString() { return "Summary{" + "unloadedShip=" + unloadedShip + ", averageWaitingTime=" + averageWaitingTime + ", maxUnloadDelay=" + maxUnloadLatency + ", averageUnloadDelay=" + averageUnloadLatency + ", fine=" + fine + ", countOfShips=" + Arrays.toString(requiredCountOfCranes) + ", fineForTypesOfShips=" + Arrays.toString(fineForTypesOfShips) + '}'; } } @Override public String toString() { return "Statistic{" + "statistics=" + statistics + ", summaryStatistics=" + summaryStatistics + '}'; } }
[ "dorohovgeorge@gmail.com" ]
dorohovgeorge@gmail.com
55042a8ca17647825ef96562cdd86b134e2e73b1
d0e756c600a72bc9f34b240abc460f9a51b12ee2
/Compilateur/PMachine/src/PascalListener.java
00b4e20ab2d7233ca4e49da248ab71dec9d653b4
[]
no_license
MaximePoirier/Projets-Universitaire
c175a15be661cac9228ad231cd83259be73b66ce
a92d33b8700acc4804945f8f7b34b2b520412036
refs/heads/master
2022-12-21T21:12:00.365064
2020-01-20T10:48:47
2020-01-20T10:48:47
222,165,795
0
0
null
2022-12-16T12:13:47
2019-11-16T22:13:47
HTML
UTF-8
Java
false
false
5,526
java
// Generated from /home/maxou/Documents/Cours/M1/S2/Compilation/PMachine/src/Pascal.g4 by ANTLR 4.7.2 import java.util.*; import org.antlr.v4.runtime.tree.ParseTreeListener; /** * This interface defines a complete listener for a parse tree produced by * {@link PascalParser}. */ public interface PascalListener extends ParseTreeListener { /** * Enter a parse tree produced by {@link PascalParser#declarations}. * @param ctx the parse tree */ void enterDeclarations(PascalParser.DeclarationsContext ctx); /** * Exit a parse tree produced by {@link PascalParser#declarations}. * @param ctx the parse tree */ void exitDeclarations(PascalParser.DeclarationsContext ctx); /** * Enter a parse tree produced by {@link PascalParser#declaration}. * @param ctx the parse tree */ void enterDeclaration(PascalParser.DeclarationContext ctx); /** * Exit a parse tree produced by {@link PascalParser#declaration}. * @param ctx the parse tree */ void exitDeclaration(PascalParser.DeclarationContext ctx); /** * Enter a parse tree produced by {@link PascalParser#declavar}. * @param ctx the parse tree */ void enterDeclavar(PascalParser.DeclavarContext ctx); /** * Exit a parse tree produced by {@link PascalParser#declavar}. * @param ctx the parse tree */ void exitDeclavar(PascalParser.DeclavarContext ctx); /** * Enter a parse tree produced by {@link PascalParser#declafunc}. * @param ctx the parse tree */ void enterDeclafunc(PascalParser.DeclafuncContext ctx); /** * Exit a parse tree produced by {@link PascalParser#declafunc}. * @param ctx the parse tree */ void exitDeclafunc(PascalParser.DeclafuncContext ctx); /** * Enter a parse tree produced by {@link PascalParser#typi}. * @param ctx the parse tree */ void enterTypi(PascalParser.TypiContext ctx); /** * Exit a parse tree produced by {@link PascalParser#typi}. * @param ctx the parse tree */ void exitTypi(PascalParser.TypiContext ctx); /** * Enter a parse tree produced by {@link PascalParser#variable}. * @param ctx the parse tree */ void enterVariable(PascalParser.VariableContext ctx); /** * Exit a parse tree produced by {@link PascalParser#variable}. * @param ctx the parse tree */ void exitVariable(PascalParser.VariableContext ctx); /** * Enter a parse tree produced by {@link PascalParser#fields}. * @param ctx the parse tree */ void enterFields(PascalParser.FieldsContext ctx); /** * Exit a parse tree produced by {@link PascalParser#fields}. * @param ctx the parse tree */ void exitFields(PascalParser.FieldsContext ctx); /** * Enter a parse tree produced by {@link PascalParser#field}. * @param ctx the parse tree */ void enterField(PascalParser.FieldContext ctx); /** * Exit a parse tree produced by {@link PascalParser#field}. * @param ctx the parse tree */ void exitField(PascalParser.FieldContext ctx); /** * Enter a parse tree produced by {@link PascalParser#instructions}. * @param ctx the parse tree */ void enterInstructions(PascalParser.InstructionsContext ctx); /** * Exit a parse tree produced by {@link PascalParser#instructions}. * @param ctx the parse tree */ void exitInstructions(PascalParser.InstructionsContext ctx); /** * Enter a parse tree produced by {@link PascalParser#instruction}. * @param ctx the parse tree */ void enterInstruction(PascalParser.InstructionContext ctx); /** * Exit a parse tree produced by {@link PascalParser#instruction}. * @param ctx the parse tree */ void exitInstruction(PascalParser.InstructionContext ctx); /** * Enter a parse tree produced by {@link PascalParser#fonction}. * @param ctx the parse tree */ void enterFonction(PascalParser.FonctionContext ctx); /** * Exit a parse tree produced by {@link PascalParser#fonction}. * @param ctx the parse tree */ void exitFonction(PascalParser.FonctionContext ctx); /** * Enter a parse tree produced by {@link PascalParser#expression}. * @param ctx the parse tree */ void enterExpression(PascalParser.ExpressionContext ctx); /** * Exit a parse tree produced by {@link PascalParser#expression}. * @param ctx the parse tree */ void exitExpression(PascalParser.ExpressionContext ctx); /** * Enter a parse tree produced by {@link PascalParser#factor}. * @param ctx the parse tree */ void enterFactor(PascalParser.FactorContext ctx); /** * Exit a parse tree produced by {@link PascalParser#factor}. * @param ctx the parse tree */ void exitFactor(PascalParser.FactorContext ctx); /** * Enter a parse tree produced by {@link PascalParser#term}. * @param ctx the parse tree */ void enterTerm(PascalParser.TermContext ctx); /** * Exit a parse tree produced by {@link PascalParser#term}. * @param ctx the parse tree */ void exitTerm(PascalParser.TermContext ctx); /** * Enter a parse tree produced by {@link PascalParser#simple_expression}. * @param ctx the parse tree */ void enterSimple_expression(PascalParser.Simple_expressionContext ctx); /** * Exit a parse tree produced by {@link PascalParser#simple_expression}. * @param ctx the parse tree */ void exitSimple_expression(PascalParser.Simple_expressionContext ctx); /** * Enter a parse tree produced by {@link PascalParser#program}. * @param ctx the parse tree */ void enterProgram(PascalParser.ProgramContext ctx); /** * Exit a parse tree produced by {@link PascalParser#program}. * @param ctx the parse tree */ void exitProgram(PascalParser.ProgramContext ctx); }
[ "maxou.nat@hotmail.fr" ]
maxou.nat@hotmail.fr
8805721834a18b5d67574f19e31c0d0a38a10f16
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/12/12_59c9a408bd64a16abf1407c12ac26e8f7a190290/LiteMainFrame/12_59c9a408bd64a16abf1407c12ac26e8f7a190290_LiteMainFrame_t.java
d3154105e4d47133dc160f89f3d7b7324c2c8aeb
[]
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
48,233
java
/* * Created on 1/11/2005 * andrek24 * */ package au.gov.naa.digipres.xena.litegui; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.File; import java.io.IOException; import java.net.URL; import java.text.SimpleDateFormat; import java.util.List; import java.util.logging.ConsoleHandler; import java.util.logging.FileHandler; import java.util.logging.Level; import java.util.logging.Logger; import java.util.logging.SimpleFormatter; import java.util.prefs.Preferences; import javax.help.CSH; import javax.help.HelpBroker; import javax.help.HelpSet; import javax.help.HelpSetException; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JToolBar; import javax.swing.ListSelectionModel; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; import javax.swing.border.SoftBevelBorder; import javax.swing.border.TitledBorder; import au.gov.naa.digipres.xena.core.ReleaseInfo; import au.gov.naa.digipres.xena.core.Xena; import au.gov.naa.digipres.xena.kernel.IconFactory; import au.gov.naa.digipres.xena.kernel.XenaException; import au.gov.naa.digipres.xena.kernel.normalise.NormaliserResults; import au.gov.naa.digipres.xena.kernel.properties.PluginProperties; import au.gov.naa.digipres.xena.kernel.properties.PropertiesManager; import au.gov.naa.digipres.xena.kernel.properties.PropertiesMenuListener; import au.gov.naa.digipres.xena.util.TableSorter; import au.gov.naa.digipres.xena.util.logging.LogFrame; import au.gov.naa.digipres.xena.util.logging.LogFrameHandler; import com.jgoodies.plaf.plastic.Plastic3DLookAndFeel; /** * Main Frame for Xena Lite application. Usage in a nutshell: * The user adds files or directories * to the list of items to be normalised, and then clicks the Normalise * button to perform normalisation. Results are displayed in a table. * * @author justinw5 * created 6/12/2005 * xena * Short desc of class: */ public class LiteMainFrame extends JFrame implements NormalisationStateChangeListener { private static final String XENA_LITE_TITLE = "Xena 3.0 Lite"; private static final String NAA_TITLE = "National Archives of Australia"; // Preferences keys private static final String LAST_DIR_VISITED_KEY = "dir/lastvisited"; private static final String XENA_DEST_DIR_KEY = "dir/xenadest"; private static final String XENA_LOG_FILE_KEY = "dir/xenalog"; // Logging properties private static final String XENA_DEFAULT_LOG_PATTERN = "%t/xenalite%g.log"; private static final String ROOT_LOGGING_PACKAGE = "au.gov.naa.digipres.xena"; private static final String PAUSE_BUTTON_TEXT = "Pause"; private static final String RESUME_BUTTON_TEXT = "Resume"; // GUI items private NormalisationItemsListModel normaliseItemsLM; private JList normaliseItemsList; private JTable resultsTable; private NormalisationResultsTableModel tableModel; private TableSorter resultsSorter; private JPanel mainNormalisePanel; private JPanel mainResultsPanel; private JPanel mainPanel; private JPanel statusBarPanel; private JLabel statusLabel; private JLabel currentFileLabel; private JRadioButton guessTypeRadio; private JRadioButton binaryOnlyRadio; private JProgressBar progressBar; private JButton pauseButton; private JButton stopButton; private JButton cancelButton; private JButton normErrorsButton; private JButton newSessionButton; private JMenu pluginPropertiesMenu = new JMenu("Plugin Preferences"); private NormalisationThread normalisationThread; private Preferences prefs; private Xena xenaInterface; private Logger logger; private LogFrame logFrame; private FileHandler logFileHandler = null; private SplashScreen splashScreen; /** * Basic constructor - calls logging and GUI initialisation methods, * and then makes the main frame visible * */ public LiteMainFrame() { super(XENA_LITE_TITLE + " - " + NAA_TITLE); prefs = Preferences.userNodeForPackage(LiteMainFrame.class); // Show splash screen splashScreen = new SplashScreen(XENA_LITE_TITLE, getVersionString()); splashScreen.setVisible(true); initLogging(); initNormaliseItemsPanel(); initResultsPanel(); try { initGUI(); } catch (Exception e) { handleXenaException(e); } // Hide splash screen logger.removeHandler(splashScreen.getLogHandler()); splashScreen.setVisible(false); splashScreen.dispose(); splashScreen = null; } private String getVersionString() { SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); return "build " + ReleaseInfo.getVersionNum() + "." + ReleaseInfo.getRevisionNum() + "." + ReleaseInfo.getBuildNumber() + "/" + formatter.format(ReleaseInfo.getBuildDate()); } /** * Initialises logging for the application. Three handlers are * added - a ConsoleHandler (logs to System.err), a FileHandler * (logs to the file(s) specified in XENA_DEFAULT_LOG_PATTERN) * and a LogFrameHandler, which logs to a frame which can be * viewed from within the application. The logger variable * can then be used to log to all 3 handlers at once. * */ private void initLogging() { // Main logger object logger = Logger.getLogger(ROOT_LOGGING_PACKAGE); logger.setLevel(Level.ALL); // Console handler initialisation ConsoleHandler consoleHandler = new ConsoleHandler(); consoleHandler.setLevel(Level.ALL); logger.addHandler(consoleHandler); // Add FileHandler initLogFileHandler(); // LogFrameHandler initialisation logFrame = new LogFrame(XENA_LITE_TITLE + " Log"); LogFrameHandler lfHandler = new LogFrameHandler(logFrame); logger.addHandler(lfHandler); lfHandler.setLevel(Level.ALL); // Splash screen logger logger.addHandler(splashScreen.getLogHandler()); logger.finest("Logging initialised"); } /** * Creates a file handler and adds it to the handlers for * the current logger. If the logFileHandler is not null, * then one has already been added to the logger, and thus * it needs to be removed before adding a new file handler. * */ private void initLogFileHandler() { if (logFileHandler != null) { logger.removeHandler(logFileHandler); logFileHandler.flush(); logFileHandler.close(); } try { String logFilePattern = prefs.get(XENA_LOG_FILE_KEY, XENA_DEFAULT_LOG_PATTERN); logFileHandler = new FileHandler(logFilePattern, 1000000, 2, true); logFileHandler.setFormatter(new SimpleFormatter()); logger.addHandler(logFileHandler); } catch (Exception e) { logger.log(Level.FINER, "Could not start logging File Handler", e); } } /** * Initialises the "Choose Normalise Items" panel, which is * the screen first presented to the user on application startup. * This method creates: * <LI> The JList to display the items to be * normalised, and buttons to add and remove files and directories * from this list. * <LI> A panel to display normalisation options (currently "Binary * Normalisation Only" is the sole option). * <LI> A button to do the Normalisation. * */ private void initNormaliseItemsPanel() { // Setup normalise items panel JPanel normaliseItemsPanel = new JPanel(new GridBagLayout()); TitledBorder itemsBorder = new TitledBorder(new EtchedBorder(),"Items to Normalise"); itemsBorder.setTitleFont(itemsBorder.getTitleFont().deriveFont(13.0f)); normaliseItemsPanel.setBorder(itemsBorder); normaliseItemsLM = new NormalisationItemsListModel(); normaliseItemsList = new JList(normaliseItemsLM); normaliseItemsList.setCellRenderer(new NormalisationItemsListRenderer()); normaliseItemsList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); JScrollPane itemListSP = new JScrollPane(normaliseItemsList); JPanel normaliseButtonPanel = new JPanel(); normaliseButtonPanel.setLayout(new GridLayout(3, 1, 10, 10)); Font buttonFont = new JButton().getFont().deriveFont(13.0f); JButton addFilesButton = new JButton("Add Files"); addFilesButton.setFont(buttonFont); JButton addDirButton = new JButton("Add Directory"); addDirButton.setFont(buttonFont); JButton removeButton = new JButton("Remove"); removeButton.setFont(buttonFont); normaliseButtonPanel.add(addFilesButton); normaliseButtonPanel.add(addDirButton); normaliseButtonPanel.add(removeButton); addToGridBag(normaliseItemsPanel, itemListSP, 0, 0, GridBagConstraints.RELATIVE, GridBagConstraints.REMAINDER, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0); addToGridBag(normaliseItemsPanel, normaliseButtonPanel, 1, 0, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(5, 5, 5, 8), 0, 0); // Setup normalise options panel JPanel binaryRadioPanel = new JPanel(); binaryRadioPanel.setLayout(new BoxLayout(binaryRadioPanel, BoxLayout.Y_AXIS)); guessTypeRadio = new JRadioButton("Guess type for all files"); guessTypeRadio.setFont(guessTypeRadio.getFont().deriveFont(12.0f)); binaryOnlyRadio = new JRadioButton("Binary normalisation only"); binaryOnlyRadio.setFont(binaryOnlyRadio.getFont().deriveFont(12.0f)); binaryRadioPanel.add(guessTypeRadio); binaryRadioPanel.add(binaryOnlyRadio); ButtonGroup binaryRadioGroup = new ButtonGroup(); binaryRadioGroup.add(guessTypeRadio); binaryRadioGroup.add(binaryOnlyRadio); guessTypeRadio.setSelected(true); JPanel normaliseOptionsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); normaliseOptionsPanel.add(binaryRadioPanel); TitledBorder optionsBorder = new TitledBorder(new EtchedBorder(),"Normalisation Options"); optionsBorder.setTitleFont(optionsBorder.getTitleFont().deriveFont(13.0f)); normaliseOptionsPanel.setBorder(optionsBorder); // Setup main button panel JPanel bottomButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); JButton normaliseButton = new JButton("Normalise"); normaliseButton.setIcon(IconFactory.getIconByName("images/icons/green_r_arrow.png")); normaliseButton.setFont(normaliseButton.getFont().deriveFont(18.0f)); bottomButtonPanel.add(normaliseButton); // Setup main normalise panel mainNormalisePanel = new JPanel(new GridBagLayout()); addToGridBag(mainNormalisePanel, normaliseItemsPanel, 0, 0, GridBagConstraints.REMAINDER, 1, 1.0, 1.0, GridBagConstraints.NORTH, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0); addToGridBag(mainNormalisePanel, normaliseOptionsPanel, 0, 1, GridBagConstraints.REMAINDER, GridBagConstraints.RELATIVE, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 10); addToGridBag(mainNormalisePanel, bottomButtonPanel, 0, 2, GridBagConstraints.REMAINDER, GridBagConstraints.REMAINDER, 1.0, 0.0, GridBagConstraints.SOUTH, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0); // Action Listeners normaliseButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { // Check if binary only option has been selected int mode = binaryOnlyRadio.isSelected() ? NormalisationThread.BINARY_MODE : NormalisationThread.STANDARD_MODE; doNormalisation(mode); } }); addFilesButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { doAddItems(true); } }); addDirButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { doAddItems(false); } }); removeButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { doRemoveItems(); } }); logger.finest("Normalise Items initialised"); } /** * Initialises the "Normalisation Results" panel. A table, with * an associated TableModel and TableSorter, is used to display * the results. Double-clicking an item in the table will bring * up a window with a more detailed view and more options for * that particular NormalisationResults object. * Four buttons are also created, a Pause button, a Stop button, * a Cancel button and a Binary Normalise Errors button. * The Pause and Stop buttons control the Normalisation thread, which can * be paused or stopped completely after the completion of the current item. * When the pause button is clicked, it is renamed to a Resume button. * The Cancel button returns the user to the Normalisation Items screen, * in the same state which the user left it, ie with all items still * listed. If the user then clicked "Normalise" again, this would create * duplicate normalised items in the same output directory, and thus * all normalised objects are deleted before returning to the "Normalise * Items" screen. The user is presented with a confirm dialog before * this is carried out. * The Binary Normalise Errors button performs a binary normalisation * for all items which were not successfully normalised. * */ private void initResultsPanel() { // Initialise display table, with model, sorter and scrollpane tableModel = new NormalisationResultsTableModel(); resultsSorter = new TableSorter(tableModel); resultsTable = new JTable(resultsSorter); resultsSorter.setTableHeader(resultsTable.getTableHeader()); JScrollPane resultsTableSP = new JScrollPane(resultsTable); Font buttonFont = new JButton().getFont().deriveFont(13.0f); // Initialise Pause and Stop buttons pauseButton = new JButton(PAUSE_BUTTON_TEXT); pauseButton.setEnabled(false); pauseButton.setIcon(IconFactory.getIconByName("images/icons/pause.png")); pauseButton.setFont(buttonFont); stopButton = new JButton("Stop"); stopButton.setEnabled(false); stopButton.setIcon(IconFactory.getIconByName("images/icons/stop.png")); stopButton.setFont(buttonFont); JPanel leftButtonPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); leftButtonPanel.add(pauseButton); leftButtonPanel.add(stopButton); // Initialise Cancel and Binary Normalise Errors buttons cancelButton = new JButton("Cancel"); cancelButton.setIcon(IconFactory.getIconByName("images/icons/black_cross.png")); cancelButton.setFont(buttonFont); normErrorsButton = new JButton("Binary Normalise Failures"); normErrorsButton.setIcon(IconFactory.getIconByName("images/icons/binary.png")); normErrorsButton.setFont(buttonFont); JPanel rightButtonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); rightButtonPanel.add(normErrorsButton); rightButtonPanel.add(cancelButton); // Layout buttons JPanel resultsButtonPanel = new JPanel(new BorderLayout()); resultsButtonPanel.add(leftButtonPanel, BorderLayout.WEST); resultsButtonPanel.add(rightButtonPanel, BorderLayout.EAST); // Layout JPanel tablePanel = new JPanel(new BorderLayout()); tablePanel.setBorder(new EmptyBorder(3, 3, 10, 3)); tablePanel.add(resultsTableSP, BorderLayout.CENTER); mainResultsPanel = new JPanel(new BorderLayout()); TitledBorder titledBorder = new TitledBorder(new EmptyBorder(0, 3, 3, 3), "Normalisation Results"); titledBorder.setTitleFont(titledBorder.getTitleFont().deriveFont(13.0f)); mainResultsPanel.setBorder(titledBorder); mainResultsPanel.add(tablePanel, BorderLayout.CENTER); mainResultsPanel.add(resultsButtonPanel, BorderLayout.SOUTH); // Action Listeners resultsTable.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e) { if (e.getModifiers() == MouseEvent.BUTTON1_MASK && e.getClickCount() == 2) { try { int modelIndex = resultsSorter.modelIndex(resultsTable.getSelectedRow()); displayResults(modelIndex); } catch (Exception ex) { handleXenaException(ex); } } } }); resultsTable.addKeyListener(new KeyAdapter(){ /* (non-Javadoc) * @see java.awt.event.KeyAdapter#keyPressed(java.awt.event.KeyEvent) */ @Override public void keyPressed(KeyEvent e) { if (e.getKeyChar() == ' ') { try { int modelIndex = resultsSorter.modelIndex(resultsTable.getSelectedRow()); displayResults(modelIndex); } catch (Exception ex) { handleXenaException(ex); } } } }); pauseButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { // Check if we are pausing or resuming int newState = pauseButton.getText().equals(PAUSE_BUTTON_TEXT) ? NormalisationThread.PAUSED : NormalisationThread.RUNNING; changeNormalisationState(newState); } }); stopButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { changeNormalisationState(NormalisationThread.STOPPED); } }); cancelButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { doCancel(); } }); normErrorsButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { doNormalisation(NormalisationThread.BINARY_ERRORS_MODE); } }); logger.finest("Results Panel initialised"); } /** * Initialises the overall GUI for the application. The Menu, * Toolbar and Status Bar are set up in this method. * @throws IOException * @throws XenaException * */ private void initGUI() throws XenaException, IOException { this.setSize(800, 600); this.setLocation(120, 120); ImageIcon xenaImageIcon = IconFactory.getIconByName("images/xena-icon.png"); this.setIconImage(xenaImageIcon.getImage()); // Setup menu JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu("File"); fileMenu.setMnemonic('F'); JMenu toolsMenu = new JMenu("Tools"); toolsMenu.setMnemonic('T'); JMenu helpMenu = new JMenu("Help"); helpMenu.setMnemonic('H'); menuBar.add(fileMenu); menuBar.add(toolsMenu); menuBar.add(helpMenu); JMenuItem exitItem = new JMenuItem("Exit", 'E'); exitItem.setIcon(IconFactory.getIconByName("images/icons/exit.png")); fileMenu.add(exitItem); JMenuItem prefsItem = new JMenuItem(XENA_LITE_TITLE + " Preferences", 'X'); prefsItem.setIcon(IconFactory.getIconByName("images/icons/spanner.png")); toolsMenu.add(prefsItem); JMenuItem helpItem = new JMenuItem("Help", 'H'); helpItem.setIcon(IconFactory.getIconByName("images/icons/help.png")); try { helpItem.addActionListener(new CSH.DisplayHelpFromSource(getHelpBroker())); helpMenu.add(helpItem); } catch (XenaException xe) { xe.printStackTrace(); } JMenuItem aboutItem = new JMenuItem("About", 'A'); aboutItem.setIcon(IconFactory.getIconByName("images/icons/info.png")); helpMenu.add(aboutItem); JMenuItem aboutPluginsItem = new JMenuItem("About Plugins", 'P'); aboutPluginsItem.setIcon(IconFactory.getIconByName("images/icons/plug.png")); helpMenu.add(aboutPluginsItem); // Initialise properties menu initPluginPropertiesMenu(); pluginPropertiesMenu.setIcon(IconFactory.getIconByName("images/icons/plug_lightning.png")); toolsMenu.add(pluginPropertiesMenu); this.setJMenuBar(menuBar); // Setup toolbar JToolBar toolbar = new JToolBar(); newSessionButton = new JButton("New Session"); newSessionButton.setIcon(IconFactory.getIconByName("images/icons/window_new.png")); newSessionButton.setFont(newSessionButton.getFont().deriveFont(12.0f)); JButton viewLogButton = new JButton("View Log"); viewLogButton.setIcon(IconFactory.getIconByName("images/icons/open_book.png")); viewLogButton.setFont(viewLogButton.getFont().deriveFont(12.0f)); toolbar.setLayout(new FlowLayout(FlowLayout.LEFT)); toolbar.add(newSessionButton); toolbar.add(viewLogButton); logger.finest("Toolbar initialised"); // Setup status bar statusBarPanel = new JPanel(new BorderLayout()); statusBarPanel.add(new JLabel(" "), BorderLayout.CENTER); statusBarPanel.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED)); // Add to content pane mainPanel = new JPanel(new BorderLayout()); mainPanel.setBorder(new EtchedBorder()); mainPanel.add(mainNormalisePanel, BorderLayout.CENTER); this.getContentPane().add(toolbar, BorderLayout.NORTH); this.getContentPane().add(mainPanel, BorderLayout.CENTER); this.getContentPane().add(statusBarPanel, BorderLayout.SOUTH); // Action listeners this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e){ doShutdown(); } }); // Ensure window is not resized below 400x430 this.addComponentListener(new java.awt.event.ComponentAdapter() { public void componentResized(ComponentEvent event) { LiteMainFrame.this.setSize((LiteMainFrame.this.getWidth() < 400) ? 400 : LiteMainFrame.this.getWidth(), (LiteMainFrame.this.getHeight() < 430) ? 430 : LiteMainFrame.this.getHeight()); } }); newSessionButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { startNewSession(); } }); exitItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { doShutdown(); } }); prefsItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { showPreferencesDialog(); } }); aboutItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { LiteAboutDialog.showAboutDialog(LiteMainFrame.this, XENA_LITE_TITLE, getVersionString()); } }); aboutPluginsItem.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { try { AboutPluginsDialog.showPluginsDialog(LiteMainFrame.this, getXenaInterface(), XENA_LITE_TITLE + " Plugins"); } catch (Exception ex) { handleXenaException(ex); } } }); viewLogButton.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { logFrame.setLocationRelativeTo(LiteMainFrame.this); logFrame.setVisible(true); } }); logger.finest("Main GUI initialised"); } /** * Create Plugin Properties menu, and populate with a menu item for each * plugin with properties to set * * @return * @throws IOException * @throws XenaException */ private void initPluginPropertiesMenu() { if (pluginPropertiesMenu == null) { throw new IllegalStateException("Developer error - method should not be " + "called until properties menu object has " + "been initialised"); } pluginPropertiesMenu.removeAll(); pluginPropertiesMenu.setMnemonic('P'); // Add plugin properties try { PropertiesManager manager = getXenaInterface().getPluginManager().getPropertiesManager(); List<PluginProperties> pluginProperties = manager.getPluginProperties(); for (PluginProperties pluginProp : pluginProperties) { JMenuItem propItem = new JMenuItem(pluginProp.getName() + "..."); propItem.addActionListener(new PropertiesMenuListener(this, pluginProp)); pluginPropertiesMenu.add(propItem); } logger.finest("Plugin properties menu initialised"); } catch (Exception ex) { // Not sure if we want to display this error or not... will for the moment handleXenaException(ex); } } private HelpBroker getHelpBroker() throws XenaException { HelpBroker broker; String helpsetName = "xenalitehelp"; ClassLoader loader = getClass().getClassLoader(); URL url = HelpSet.findHelpSet(loader, "doc/litehelp/" + helpsetName); if (url != null) { HelpSet mainHS; try { mainHS = new HelpSet(loader, url); broker = mainHS.createHelpBroker(); } catch (HelpSetException e) { throw new XenaException("Could not create help set " + helpsetName); } } else { logger.log(Level.FINER, "Help Set " + helpsetName + " not found"); throw new XenaException("Could not find help set " + helpsetName); } return broker; } /** * Convenience method for adding a component to a container * which is using a GridBagLayout * * @param container * @param component * @param gridx * @param gridy * @param gridwidth * @param gridheight * @param weightx * @param weighty * @param anchor * @param fill * @param insets * @param ipadx * @param ipady */ private void addToGridBag(Container container, Component component, int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, Insets insets, int ipadx, int ipady) { GridBagConstraints gbc = new GridBagConstraints(gridx, gridy, gridwidth, gridheight, weightx, weighty, anchor, fill, insets, ipadx, ipady); container.add(component, gbc); } /** * Show "Edit Preferences" dialog. Existing preferences will be * loaded using Java preferences, and saved after the dialog has * been (successfully) closed. * */ private void showPreferencesDialog() { LitePreferencesDialog prefsDialog = new LitePreferencesDialog(this, XENA_LITE_TITLE + " Preferences"); prefsDialog.setXenaDestDir(prefs.get(XENA_DEST_DIR_KEY, "")); prefsDialog.setXenaLogFile(prefs.get(XENA_LOG_FILE_KEY, "")); prefsDialog.setLocationRelativeTo(this); prefsDialog.setVisible(true); // We have returned from the dialog if (prefsDialog.isApproved()) { if (!prefs.get(XENA_LOG_FILE_KEY, "").equals(prefsDialog.getXenaLogFile().trim())) { prefs.put(XENA_LOG_FILE_KEY, prefsDialog.getXenaLogFile()); initLogFileHandler(); } prefs.put(XENA_DEST_DIR_KEY, prefsDialog.getXenaDestDir()); } logger.finest(XENA_LITE_TITLE + " preferences saved"); } /** * Starts the NormalisationThread to carry out normalisation * of the selected objects, initialises the progress bar * and status label, and switches to the Results panel. * * The method can be called in one of three modes: * <LI><B>STANDARD_MODE</B> will use a guesser to guess the * correct type of each file; * <LI><B>BINARY_MODE</B> will use the binary normaliser * for each file; * <LI><B>BINARY_ERRORS_MODE</B> will use the binary normaliser * to normalise any files that were not normalised in a previous * attempt. * */ private void doNormalisation(int mode) { if (mode != NormalisationThread.BINARY_ERRORS_MODE) { logger.finest("Beginning normalisation process for " + normaliseItemsLM.getSize() + " items"); // Ensure that at least one file or directory has been selected if (normaliseItemsLM.getSize() == 0) { JOptionPane.showMessageDialog(this, "Please add files and/or directories.", "No Normalisation Items", JOptionPane.INFORMATION_MESSAGE); logger.finest("Attempted to normalise with no items"); return; } } else { logger.finest("Beginning error normalisation process"); } // Ensure destination directory has been set String destDir = prefs.get(XENA_DEST_DIR_KEY, ""); if (destDir.trim().equals("")) { JOptionPane.showMessageDialog(this, "Please set the destination directory" + " in Tools->" + XENA_LITE_TITLE + " Preferences.", "Destination Directory Not Set", JOptionPane.INFORMATION_MESSAGE); logger.finest("Attempted to normalise with no destination directory"); return; } try { // Initialise status bar progressBar = new JProgressBar(); progressBar.setForeground(Color.GREEN); progressBar.setMinimum(0); statusLabel = new JLabel(); currentFileLabel = new JLabel(); currentFileLabel.setHorizontalAlignment(JLabel.CENTER); // Refresh status bar statusBarPanel.removeAll(); statusBarPanel.add(statusLabel, BorderLayout.WEST); statusBarPanel.add(currentFileLabel, BorderLayout.CENTER); statusBarPanel.add(progressBar, BorderLayout.EAST); if (mode != NormalisationThread.BINARY_ERRORS_MODE) { // Create the normalisation thread normalisationThread = new NormalisationThread(mode, getXenaInterface(), tableModel, normaliseItemsLM.getNormalisationItems(), new File(destDir), this); // Display the results panel mainPanel.removeAll(); mainPanel.add(mainResultsPanel, BorderLayout.CENTER); } else { // Create the normalisation thread normalisationThread = new NormalisationThread(mode, getXenaInterface(), tableModel, null, new File(destDir), this); } // Add this object as a listener of the NormalisationThread, // so that the buttons on the Results panel can be enabled // and disabled appropriately normalisationThread.add(this); // Start the normalisation process normalisationThread.start(); this.validate(); this.repaint(); } catch (Exception e) { handleXenaException(e); } } /** * Implementation of a NormalisationStateChangeListener, * which is called whenever the NormalisationThread indicates * that it has changed its running state. There are three states - * RUNNING, PAUSED and STOPPED, and changing to any of these * states causes buttons on the results panel to be enabled or * disabled appropriately. * The status bar components are also updated based on the * values of the total items, error count, current file etc. */ public void normalisationStateChanged(int newState, int totalItems, int normalisedItems, int errorItems, String currentFile) { String statusText = (normalisedItems + errorItems) + " of " + totalItems + " completed (" + errorItems + " error(s))"; switch(newState) { case NormalisationThread.RUNNING: // Update buttons pauseButton.setText(PAUSE_BUTTON_TEXT); pauseButton.setEnabled(true); pauseButton.setIcon(IconFactory.getIconByName("images/icons/pause.png")); stopButton.setEnabled(true); normErrorsButton.setEnabled(false); cancelButton.setEnabled(false); newSessionButton.setEnabled(false); // Update progress bar progressBar.setMaximum(totalItems); progressBar.setValue(normalisedItems + errorItems); // Update status label statusLabel.setText(statusText); if (errorItems > 0) { statusLabel.setForeground(Color.RED); } // Update current file label currentFileLabel.setText("Normalising " + currentFile); break; case NormalisationThread.PAUSED: // Update buttons pauseButton.setText(RESUME_BUTTON_TEXT); pauseButton.setEnabled(true); pauseButton.setIcon(IconFactory.getIconByName("images/icons/green_r_arrow.png")); stopButton.setEnabled(true); normErrorsButton.setEnabled(false); cancelButton.setEnabled(true); newSessionButton.setEnabled(true); currentFileLabel.setText("Paused"); break; case NormalisationThread.STOPPED: // Update buttons pauseButton.setEnabled(false); stopButton.setEnabled(false); cancelButton.setEnabled(true); newSessionButton.setEnabled(true); if (errorItems > 0) { normErrorsButton.setEnabled(true); } else { normErrorsButton.setEnabled(false); } // Update status label statusLabel.setText(statusText); if (errorItems > 0) { statusLabel.setForeground(Color.RED); } currentFileLabel.setText(""); statusBarPanel.remove(progressBar); this.validate(); this.repaint(); displayConfirmationMessage("Normalisation Complete", totalItems, normalisedItems, errorItems); break; } } public void normalisationError(String message, Exception e) { handleXenaException(e); } /** * Displays a confirmation message with details of the number * of normalised items and errors * * @param title * @param totalItems * @param normalisedItems * @param errorItems */ private void displayConfirmationMessage(String title, int totalItems, int normalisedItems, int errorItems) { new NormalisationCompleteDialog(this, totalItems, normalisedItems, errorItems).setVisible(true); } /** * Clicking a button on the results panel will call this * method, which will indicate to the NormalisationThread * that it needs to take a certain action when next appropriate. * @param newState */ private void changeNormalisationState(int newState) { normalisationThread.setThreadState(newState); } /** * Displays the selected results row in a NormaliserResultsFrame. * The results object is retrieved from the table model using a * special column index RESULTS_OBJECT_INDEX. This is because the * NormalisationResultsTableModel can not be accessed directly as * the request must go through the TableSorter so that the correct * row is still selected when the table has been sorted. * * @param selectedRow * @throws XenaException * @throws IOException */ private void displayResults(int selectedRow) throws XenaException, IOException { NormaliserResults results = tableModel.getNormaliserResults(selectedRow); // Display results frame NormaliserResultsFrame resultsFrame = new NormaliserResultsFrame(results, getXenaInterface()); resultsFrame.setLocationRelativeTo(this); resultsFrame.setVisible(true); } /** * Clears the Normalisation Items List and normalisation * results table, resets the normalisation options, and * displays the Normalisation Items screen. * */ private void startNewSession() { // Check that the user really wants to restart String[] msgArr = {"Are you sure you want to start a new session?", "This will not delete any output from this session."}; int retVal = JOptionPane.showConfirmDialog(this, msgArr, "Confirm New Session", JOptionPane.OK_CANCEL_OPTION); if (retVal == JOptionPane.OK_OPTION) { // Reset item list, normalisation options and status bar normaliseItemsLM.removeAllElements(); guessTypeRadio.setSelected(true); statusBarPanel.removeAll(); statusBarPanel.add(new JLabel(" "), BorderLayout.CENTER); // Clear normalisation results table tableModel.clear(); tableModel.fireTableDataChanged(); // Display normalisation items screen mainPanel.removeAll(); mainPanel.add(mainNormalisePanel, BorderLayout.CENTER); this.validate(); this.repaint(); logger.finest("Started new normalisation session"); } } /** * The Cancel action deletes all the normalised objects currently * listed in the results table, and returns to the normalise * items screen. The user is first asked to confirm this action. * */ private void doCancel() { // Confirm file deletion String[] msgArr = {"Using the Cancel button will cause the current set " + "of normalised output files to be deleted.", "Are you sure you want to do this?"}; int retVal = JOptionPane.showConfirmDialog(this, msgArr, "Confirm File Deletion", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); if (retVal == JOptionPane.YES_OPTION) { // File deletion has been confirmed List<NormaliserResults> resultsList = tableModel.getAllNormaliserResults(); // For all results objects displayed in the table for (NormaliserResults results : resultsList) { // Delete output file String destDir = results.getDestinationDirString(); String destFile = results.getOutputFileName(); if (destDir != null && !destDir.trim().equals("") && destFile != null && !destFile.trim().equals("")) { File file = new File(destDir + File.separator + destFile); file.delete(); logger.finest("Deleted file " + file); } } // Clear results table tableModel.clear(); tableModel.fireTableDataChanged(); // Reset status bar statusBarPanel.removeAll(); statusBarPanel.add(new JLabel(" "), BorderLayout.CENTER); // Display normalisation items screen mainPanel.removeAll(); mainPanel.add(mainNormalisePanel, BorderLayout.CENTER); this.validate(); this.repaint(); logger.finest("Cancel action completed"); } } /** * Shut down application * */ private void doShutdown() { logger.finest("Shutting down " + XENA_LITE_TITLE); System.exit(0); } /** * Add items to the Normalisation Items List. If useFileMode is true, * then the file chooser is set to FILES_ONLY, otherwise the file chooser * is set to DIRECTORIES_ONLY. * * @param useFileMode True if adding files, false if adding directories */ private void doAddItems(boolean useFileMode) { /* * Initial directory is last visited directory. If this has not been * set, then the Xena Source Directory is used. If this is not set, * then the default (root) directory is used. */ JFileChooser fileChooser = new JFileChooser(prefs.get(LAST_DIR_VISITED_KEY, "")); // Set selection mode of file chooser if (useFileMode) { fileChooser.setMultiSelectionEnabled(true); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); } else { fileChooser.setMultiSelectionEnabled(false); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); } int retVal = fileChooser.showOpenDialog(this); // We have returned from the file chooser if (retVal == JFileChooser.APPROVE_OPTION) { if (useFileMode) { File[] selectedFiles = fileChooser.getSelectedFiles(); for (File file : selectedFiles) { normaliseItemsLM.addElement(file); } } else { normaliseItemsLM.addElement(fileChooser.getSelectedFile()); } prefs.put(LAST_DIR_VISITED_KEY, fileChooser.getCurrentDirectory().getPath()); } } /** * Remove an item or items from the Normalise Items List * */ private void doRemoveItems() { int[] selectedIndices = normaliseItemsList.getSelectedIndices(); for (int i = selectedIndices.length-1; i >= 0; i--) { normaliseItemsLM.remove(selectedIndices[i]); } } /** * Initialises the Xena interface (currently loads plugins) if required * @return * @throws XenaException * @throws IOException */ private Xena getXenaInterface() throws XenaException, IOException { if (xenaInterface == null) { xenaInterface = new Xena(); xenaInterface.loadPlugins(getPluginsDirectory()); logger.finest("Successfully loaded Xena Framework interface"); } return xenaInterface; } /** * Returns the xena lite plugins directory. This is set as being a directory named "plugins" * which is a subdirectory of the directory containing the xena.jar file. * First we assume that we are running xena lite from the directory containing the xena.jar file. * If the plugins directory cannot be found, then the base directory could be different to the * xena.jar directory. So first we get the URL of the litegui package. This URL * will consist of the file system path to the jar file plus a path to the package directory. The * directory containing the jar file can thus be extracted. * @return * @throws XenaException */ private File getPluginsDirectory() throws XenaException { File pluginsDir = new File("plugins"); if (!pluginsDir.exists() || !pluginsDir.isDirectory()) { boolean pluginsDirFound = false; String resourcePath = this.getClass().getResource("/" + this.getClass().getPackage().getName().replace(".", "/")).getPath(); String fileIdStr = "file:"; if (resourcePath.indexOf(fileIdStr) >= 0 && resourcePath.lastIndexOf("!") >= 0) { String jarPath = resourcePath.substring(resourcePath.indexOf(fileIdStr)+fileIdStr.length(), resourcePath.lastIndexOf("!")); if (jarPath.lastIndexOf("/") >= 0) { pluginsDir = new File(jarPath.substring(0, jarPath.lastIndexOf("/")+1) + "plugins"); if (pluginsDir.exists() && pluginsDir.isDirectory()) { pluginsDirFound = true; } } } if (!pluginsDirFound) { throw new XenaException("Cannot find default plugins directory. " + "Try running Xena Lite from the same directory as xena.jar."); } } File[] pluginFiles = pluginsDir.listFiles(); boolean foundPlugin = false; for (int i = 0; i < pluginFiles.length; i++) { if (pluginFiles[i].getName().endsWith(".jar")) { foundPlugin = true; break; } } if (!foundPlugin) { JOptionPane.showMessageDialog(this, "No plugins found in plugin directory " + pluginsDir.getAbsolutePath(), "No Plugins Found", JOptionPane.WARNING_MESSAGE); logger.finer("No plugins found, proceding without plugins"); } return pluginsDir; } /** * Displays a message dialog containing the given exception * @param ex */ private void handleXenaException(Exception ex) { logger.log(Level.FINER, ex.toString(), ex); JOptionPane.showMessageDialog(this, ex.getMessage(), XENA_LITE_TITLE, JOptionPane.ERROR_MESSAGE); } /** * Entry point for the Xena Lite application * @param args */ public static void main(String[] args) { // Set look and feel to the look and feel of the current OS try { Plastic3DLookAndFeel plaf = new Plastic3DLookAndFeel(); // Plastic3DLookAndFeel.setMyCurrentTheme(new SkyBluerTahoma()); UIManager.setLookAndFeel(plaf); } catch (Exception e) { e.printStackTrace(); } LiteMainFrame mf = new LiteMainFrame(); mf.setVisible(true); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
a1ffe9a08d6f86ce84d90ca4a937b202068f76e7
4dd3ff9bb2f415906c86c1ff38e447851b67ae7a
/OnLineTest/src/com/hp/Dao/TestDao.java
95404b40e69b069b61afa18cc8925e1e073bf1cf
[]
no_license
yangyi521/Text
1394615a60ac36b1d1b41cb8f9b31a3e2c30ed22
68f8a9af2b075667a895cda6c263947f7beb213c
refs/heads/master
2016-09-13T22:14:01.429416
2016-04-29T01:09:06
2016-04-29T01:09:06
56,823,021
0
0
null
null
null
null
UTF-8
Java
false
false
601
java
package com.hp.Dao; import java.util.List; import org.hibernate.Query; import org.hibernate.Session; import com.hp.bean.Subject; import com.hp.util.HibernateSessionFactory; public class TestDao { public List<Subject> randomFindSubject(int number){ List list = null; Session session = HibernateSessionFactory.getSession(); session.beginTransaction(); Query query = session.createQuery("from Subject as sub order by rand()"); query.setMaxResults(number); list = query.list(); session.getTransaction().commit(); HibernateSessionFactory.closeSession(); return list; } }
[ "yangyi521@163.com" ]
yangyi521@163.com
1c3d86fec9f730d6604354f26260c44c63892a87
8bf28f8eff7210bc53f19ff3ec147eebb0b76759
/ApplicationTest/themvp/src/main/java/com/inventec/frame/themvp/databind/DataBindActivity.java
7ea9004ab3358a608cede42ea2f0634b9a162e3a
[]
no_license
wlyy460/NewsBlog1.0
1f98bff7b4046048e1d95858805c18470171d5c8
603e12b9bc11a938b07a8d3084383fb3c9e1e3f3
refs/heads/master
2021-01-18T03:16:03.233127
2017-03-24T08:51:31
2017-03-24T08:51:31
84,269,760
0
0
null
null
null
null
UTF-8
Java
false
false
1,475
java
/* * Copyright (c) 2015, 张涛. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.inventec.frame.themvp.databind; import android.os.Bundle; import com.inventec.frame.themvp.model.IModel; import com.inventec.frame.themvp.presenter.ActivityPresenter; import com.inventec.frame.themvp.view.IDelegate; /** * 集成数据-视图绑定的Activity基类(Presenter层) * * @param <T> View层代理类 * @author kymjs (http://www.kymjs.com/) on 10/23/15. */ public abstract class DataBindActivity<T extends IDelegate> extends ActivityPresenter<T> { protected DataBinder binder; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); binder = getDataBinder(); } public abstract DataBinder getDataBinder(); public <D extends IModel> void notifyModelChanged(D data) { if (binder != null) binder.viewBindModel(viewDelegate, data); } }
[ "1275423024@qq.com" ]
1275423024@qq.com
4b3c217a6255784430fb33b21c7cd8179c22cb3b
8e621f8658ad2dba710d757ad16bdbd795c936b0
/src/main/java/com/siwoo/datastructure/linkedlist/LinkedListImpl.java
247816d19b2c6faae854cacabe4786f5ad19f218
[]
no_license
Siwoo-Kim/designpattern-
2e969d1728992df1612b39f71c3b6b0389db4833
ab492a1bcd7ce4b72fbb11754324cc5b9a9b9d70
refs/heads/master
2020-05-16T00:14:58.741503
2019-04-21T19:48:59
2019-04-21T19:48:59
182,575,956
0
0
null
null
null
null
UTF-8
Java
false
false
4,034
java
package com.siwoo.datastructure.linkedlist; import com.siwoo.datastructure.stack.Stack; import java.lang.reflect.Array; import java.util.Iterator; import java.util.NoSuchElementException; public class LinkedListImpl<E> implements LinkedList<E>, Stack<E> { //top element (the most recent element) of the list. private Node<E> last; private Node<E> first; private transient int size = 0; private static class Node<E> { private E el; //reference which is added earlier than the node private Node prev; //reference which is added later than the node private Node next; public Node(E el) { this.el = el; } @Override public String toString() { return el == null ? "null" : el.toString(); } } @Override public void addLast(E el) { final Node<E> l = last; final Node<E> newNode = new Node<>(el); newNode.prev = last; if (l == null) first = newNode; else l.next = newNode; last = newNode; size++; } @Override public E removeLast() { if (last == null) throw new NoSuchElementException(); final Node<E> l = last; final Node<E> prev = l.prev; final E element = l.el; if (prev == null) first = null; else prev.next = null; last = prev; size--; //GC l.el = null; l.prev = null; return element; } @Override public void addFirst(E el) { final Node<E> f = first; final Node<E> newNode = new Node<>(el); newNode.next = first; if (f == null) last = newNode; else f.prev = newNode; first = newNode; size++; } @Override public E removeFirst() { if (first == null) throw new NoSuchElementException(); final Node<E> f = first; final Node<E> next = f.next; final E element = f.el; if (next == null) last = null; else next.prev = null; first = next; size--; //GC f.el = null; f.next = null; return element; } @Override public boolean isEmpty() { return last == null; } @Override public void push(E item) { addLast(item); } @Override public E pop() { return removeLast(); } @Override public int size() { return size; } @Override public E peek() { if (isEmpty()) throw new NoSuchElementException(); return last.el; } @Override public Object[] toArray() { Object[] result = new Object[size]; int i = 0; for (Node c = last; c != null; c = c.prev) result[i++] = c.el; return result; } @Override public <T> T[] toArray(T[] array) { if (array.length < size) array = (T[]) Array.newInstance( array.getClass().getComponentType(), size); int i = 0; Object[] result = array; for (Node c = last; c != null; c = c.prev) result[i++] = c.el; //what is the situation for the condition? if (array.length > size) array[size] = null; return array; } @Override public Iterator<E> iterator() { return new Itr<>(last); } private class Itr<E> implements Iterator<E>{ private Node<E> c; private Node<E> lastReturned; public Itr(Node<E> last) { this.c = last; } @Override public boolean hasNext() { return c != null; } @Override public E next() { if (!hasNext()) throw new NoSuchElementException(); lastReturned = c; c = c.prev; return lastReturned.el; } } }
[ "siwoo.kim@davinci-retail.com" ]
siwoo.kim@davinci-retail.com
b222d1ee2daec922d545cca67ce0adaa324cc495
89b538997b7bd8f649c5dab72529dff0dc09d15b
/src/main/kotlin/hollow/generated/EntityApi.java
571a96e43d356b9edf8fbadf35444670c6c45418
[]
no_license
yonatang/hollow-delta-bug
d01e4d132a2fdee3aac324875434b53538c0de1c
fe6d0b382de4b6712bbef51fb97e8dafc7130557
refs/heads/master
2023-04-04T03:05:47.937923
2021-02-24T06:18:54
2021-02-24T06:18:54
341,798,513
0
0
null
null
null
null
UTF-8
Java
false
false
6,883
java
package hollow.generated; import hollow.generated.core.*; import java.util.Objects; import java.util.Collection; import java.util.Collections; import java.util.Set; import java.util.Map; import com.netflix.hollow.api.consumer.HollowConsumerAPI; import com.netflix.hollow.api.custom.HollowAPI; import com.netflix.hollow.core.read.dataaccess.HollowDataAccess; import com.netflix.hollow.core.read.dataaccess.HollowTypeDataAccess; import com.netflix.hollow.core.read.dataaccess.HollowObjectTypeDataAccess; import com.netflix.hollow.core.read.dataaccess.HollowListTypeDataAccess; import com.netflix.hollow.core.read.dataaccess.HollowSetTypeDataAccess; import com.netflix.hollow.core.read.dataaccess.HollowMapTypeDataAccess; import com.netflix.hollow.core.read.dataaccess.missing.HollowObjectMissingDataAccess; import com.netflix.hollow.core.read.dataaccess.missing.HollowListMissingDataAccess; import com.netflix.hollow.core.read.dataaccess.missing.HollowSetMissingDataAccess; import com.netflix.hollow.core.read.dataaccess.missing.HollowMapMissingDataAccess; import com.netflix.hollow.api.objects.provider.HollowFactory; import com.netflix.hollow.api.objects.provider.HollowObjectProvider; import com.netflix.hollow.api.objects.provider.HollowObjectCacheProvider; import com.netflix.hollow.api.objects.provider.HollowObjectFactoryProvider; import com.netflix.hollow.api.sampling.HollowObjectCreationSampler; import com.netflix.hollow.api.sampling.HollowSamplingDirector; import com.netflix.hollow.api.sampling.SampleResult; import com.netflix.hollow.core.util.AllHollowRecordCollection; @SuppressWarnings("all") public class EntityApi extends HollowAPI { private final HollowObjectCreationSampler objectCreationSampler; private final StringTypeAPI stringTypeAPI; private final EntityTypeAPI entityTypeAPI; private final HollowObjectProvider stringProvider; private final HollowObjectProvider entityProvider; public EntityApi(HollowDataAccess dataAccess) { this(dataAccess, Collections.<String>emptySet()); } public EntityApi(HollowDataAccess dataAccess, Set<String> cachedTypes) { this(dataAccess, cachedTypes, Collections.<String, HollowFactory<?>>emptyMap()); } public EntityApi(HollowDataAccess dataAccess, Set<String> cachedTypes, Map<String, HollowFactory<?>> factoryOverrides) { this(dataAccess, cachedTypes, factoryOverrides, null); } public EntityApi(HollowDataAccess dataAccess, Set<String> cachedTypes, Map<String, HollowFactory<?>> factoryOverrides, EntityApi previousCycleAPI) { super(dataAccess); HollowTypeDataAccess typeDataAccess; HollowFactory factory; objectCreationSampler = new HollowObjectCreationSampler("String","Entity"); typeDataAccess = dataAccess.getTypeDataAccess("String"); if(typeDataAccess != null) { stringTypeAPI = new StringTypeAPI(this, (HollowObjectTypeDataAccess)typeDataAccess); } else { stringTypeAPI = new StringTypeAPI(this, new HollowObjectMissingDataAccess(dataAccess, "String")); } addTypeAPI(stringTypeAPI); factory = factoryOverrides.get("String"); if(factory == null) factory = new StringHollowFactory(); if(cachedTypes.contains("String")) { HollowObjectCacheProvider previousCacheProvider = null; if(previousCycleAPI != null && (previousCycleAPI.stringProvider instanceof HollowObjectCacheProvider)) previousCacheProvider = (HollowObjectCacheProvider) previousCycleAPI.stringProvider; stringProvider = new HollowObjectCacheProvider(typeDataAccess, stringTypeAPI, factory, previousCacheProvider); } else { stringProvider = new HollowObjectFactoryProvider(typeDataAccess, stringTypeAPI, factory); } typeDataAccess = dataAccess.getTypeDataAccess("Entity"); if(typeDataAccess != null) { entityTypeAPI = new EntityTypeAPI(this, (HollowObjectTypeDataAccess)typeDataAccess); } else { entityTypeAPI = new EntityTypeAPI(this, new HollowObjectMissingDataAccess(dataAccess, "Entity")); } addTypeAPI(entityTypeAPI); factory = factoryOverrides.get("Entity"); if(factory == null) factory = new EntityHollowFactory(); if(cachedTypes.contains("Entity")) { HollowObjectCacheProvider previousCacheProvider = null; if(previousCycleAPI != null && (previousCycleAPI.entityProvider instanceof HollowObjectCacheProvider)) previousCacheProvider = (HollowObjectCacheProvider) previousCycleAPI.entityProvider; entityProvider = new HollowObjectCacheProvider(typeDataAccess, entityTypeAPI, factory, previousCacheProvider); } else { entityProvider = new HollowObjectFactoryProvider(typeDataAccess, entityTypeAPI, factory); } } public void detachCaches() { if(stringProvider instanceof HollowObjectCacheProvider) ((HollowObjectCacheProvider)stringProvider).detach(); if(entityProvider instanceof HollowObjectCacheProvider) ((HollowObjectCacheProvider)entityProvider).detach(); } public StringTypeAPI getStringTypeAPI() { return stringTypeAPI; } public EntityTypeAPI getEntityTypeAPI() { return entityTypeAPI; } public Collection<HString> getAllHString() { HollowTypeDataAccess tda = Objects.requireNonNull(getDataAccess().getTypeDataAccess("String"), "type not loaded or does not exist in dataset; type=String"); return new AllHollowRecordCollection<HString>(tda.getTypeState()) { protected HString getForOrdinal(int ordinal) { return getHString(ordinal); } }; } public HString getHString(int ordinal) { objectCreationSampler.recordCreation(0); return (HString)stringProvider.getHollowObject(ordinal); } public Collection<Entity> getAllEntity() { HollowTypeDataAccess tda = Objects.requireNonNull(getDataAccess().getTypeDataAccess("Entity"), "type not loaded or does not exist in dataset; type=Entity"); return new AllHollowRecordCollection<Entity>(tda.getTypeState()) { protected Entity getForOrdinal(int ordinal) { return getEntity(ordinal); } }; } public Entity getEntity(int ordinal) { objectCreationSampler.recordCreation(1); return (Entity)entityProvider.getHollowObject(ordinal); } public void setSamplingDirector(HollowSamplingDirector director) { super.setSamplingDirector(director); objectCreationSampler.setSamplingDirector(director); } public Collection<SampleResult> getObjectCreationSamplingResults() { return objectCreationSampler.getSampleResults(); } }
[ "yonatan.graber@gmail.com" ]
yonatan.graber@gmail.com
1ac51b35eab5a69efe55d06582b339000496bf1f
5289717d138092c317121ca0e6620c9b3fea2e95
/carRent-manager-service/src/main/java/com/song/service/CarService.java
e901e8987171b03bc74699e79a5b60e0cb4bb70e
[]
no_license
song-last/carRent
3eec6041cc99b658db0db692c942a59de0eda3bc
16045e4f0854d68857d5a11ffb719b8054f225b1
refs/heads/master
2022-12-22T16:53:56.602603
2019-12-01T13:00:20
2019-12-01T13:00:20
225,153,912
0
0
null
2022-12-16T05:09:33
2019-12-01T11:58:52
Java
UTF-8
Java
false
false
129
java
package com.song.service; import com.song.pojo.BusCar; public interface CarService { BusCar findByCarNumber(String id); }
[ "demo_glb@song.com" ]
demo_glb@song.com
2096be9496849373eaf4305af2271b48598258b5
a738b15524b0c739a4354c4b29132fe07eaebb20
/app/src/androidTest/java/com/black/flair/poscryption/ExampleInstrumentedTest.java
a7a066ad3f2f7fec20025c98cef3a331cdf98a52
[]
no_license
BlackFlair/PosCryption
d5cb695e6201696b52da46452ead58ab5dfb434c
14cdf0a727e812100eb719076439e9a34c5d404a
refs/heads/master
2021-05-22T20:11:19.943388
2020-04-04T18:49:54
2020-04-04T18:49:54
253,074,811
0
0
null
null
null
null
UTF-8
Java
false
false
770
java
package com.black.flair.poscryption; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.black.flair.poscryption", appContext.getPackageName()); } }
[ "surinmachaiah@gmail.com" ]
surinmachaiah@gmail.com
d986ef567de4ebcd111fc111dc4644a2c9a5af49
c5ca82622d155ca142cebe93b12882992e93b1f6
/src/com/geocento/webapps/earthimages/emis/application/server/utils/PolicyHelper.java
06b9676041d35786a00c025a874a778c3eecda52
[]
no_license
leforthomas/EMIS
8721a6c21ad418380e1f448322fa5c8c51e33fc0
32e58148eca1e18fd21aa583831891bc26d855b1
refs/heads/master
2020-05-17T08:54:22.044423
2019-04-29T20:45:24
2019-04-29T20:45:24
183,617,011
0
0
null
null
null
null
UTF-8
Java
false
false
1,057
java
package com.geocento.webapps.earthimages.emis.application.server.utils; import com.metaaps.webapps.earthimages.extapi.server.domain.policies.EULADocumentDTO; import com.metaaps.webapps.earthimages.extapi.server.domain.policies.LicensingPolicy; import com.metaaps.webapps.libraries.client.widget.util.ListUtil; /** * Created by thomas on 16/06/14. */ public class PolicyHelper { public static EULADocumentDTO getLicensingEULADocument(LicensingPolicy licensingPolicy, String value) { // get options // basic checks first if(licensingPolicy == null || value == null || licensingPolicy.getParameter().getLicenseOptions() == null) { return null; } // now look for the matching value return ListUtil.findValue(licensingPolicy.getParameter().getLicenseOptions(), option -> option.getOption().contentEquals(value)).getEulaDocument(); } public static String getLicensingEULAUrl(EULADocumentDTO eulaDocument) { return "./api/license/eula/download/" + eulaDocument.getId(); } }
[ "leforthomas@gmail.com" ]
leforthomas@gmail.com
f9427a7321e2c2fbd0b07af0edfa184ade5ddf40
997a46bd50ac8c9591b6cb2aa6376297168260cd
/src/main/java/rajesh/App.java
16426538d193636d9d630c9d50d27fd68479c517
[]
no_license
vuppula/new
33c0b651a349e2aa923345e7f5806e2af9852fc5
8dfe4359d0b8efcb97e1fd41ec071988b18aae43
refs/heads/master
2021-01-19T23:58:15.317072
2017-12-07T18:30:55
2017-12-07T18:30:55
89,058,637
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package rajesh; /** * Hello world! * */ public class App { public static void main( String[] args ) { System.out.println( "Hello World!" ); } }
[ "rajeshkumarvuppula@gmail.com" ]
rajeshkumarvuppula@gmail.com
fc1fa5ce9c9a9b57ab8360d1865fd8694d64f910
17f48031d3cfcd84c6961fde139820903cb7a7b7
/src/rabin/RabinTest.java
6ae47a4d632bc03e49bd6f050825050977ba2858
[]
no_license
andrey-justo/rabin-elgamal
e07dddea65aadca0af4f1a4ea26b9ce60f48ef24
6081debf36e65e3191c4921a6d907d5bacdb2451
refs/heads/master
2021-06-06T22:22:22.246493
2016-10-21T21:25:36
2016-10-21T21:25:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
package rabin; import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.List; public class RabinTest { public static void main(String[] args) throws UnsupportedEncodingException { String originalText = "Hello World!!!"; List<String> decryptedText = new ArrayList<>(); // four possibilities BigInteger[] key = Rabin.genKey(3072); BigInteger N = key[0]; BigInteger p = key[1]; // private key BigInteger q = key[2]; // private key BigInteger message = new BigInteger(originalText.getBytes(Charset.forName("ascii"))); BigInteger cipherText = Rabin.encrypt(message, N); BigInteger[] decryptedMessage = Rabin.decrypt(cipherText, p, q); for(BigInteger factors: decryptedMessage) { decryptedText.add(new String(factors.toByteArray(), Charset.forName("ascii"))); } System.out.println("For ->"); System.out.println("Private keys -> p: " + p); System.out.println("Private keys -> q: " + q); System.out.println("Public key -> N: " + N); System.out.println("Original Text: " + originalText); System.out.println("Encrypted Text: " + cipherText); System.out.println("Results:"); System.out.println("----------------------------"); decryptedText.forEach( d -> { System.out.println("Decrypted Text: " + d); }); } }
[ "andrey.justo@movile.com" ]
andrey.justo@movile.com
32e01cb253fdc3233b9567e1e45bd32b7add6299
2a8be554d680366514e6f89328719e0ddb5c73e6
/S.MiniSeconds/Example/AMazeByNathanOwen/app/src/main/java/edu/wm/cs/cs301/NathanOwen/ui/FinishActivity.java
d2c448ecec8adc94b5f1e0da14c2a0d59ca042cd
[]
no_license
kpnadmin/myData
e36bbc231b6ab9882e4991c613ceea5458f6d632
4889ee57a0d5c7767f7fdfec5acf005e63c23764
refs/heads/master
2020-04-05T13:08:38.657424
2017-08-26T10:03:36
2017-08-26T10:03:36
95,096,875
0
0
null
null
null
null
UTF-8
Java
false
false
3,722
java
package edu.wm.cs.cs301.NathanOwen.ui; import edu.wm.cs.cs301.NathanOwen.R; import edu.wm.cs.cs301.NathanOwen.R.id; import edu.wm.cs.cs301.NathanOwen.R.layout; import edu.wm.cs.cs301.NathanOwen.R.menu; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.Toast; public class FinishActivity extends Activity { private static final String TAG = "FinishActivity"; /** * Initializes this activity and sets all the appropriate widgets. */ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_finish); getActionBar().setDisplayHomeAsUpEnabled(true); TextView successText = (TextView) findViewById(R.id.textViewSuccess); TextView failureText = (TextView) findViewById(R.id.textViewFailure); TextView batteryText = (TextView) findViewById(R.id.batteryLevel); TextView pathlenText = (TextView) findViewById(R.id.pathLength); TextView startovText = (TextView) findViewById(R.id.textView3); LinearLayout finishScreen = (LinearLayout) findViewById(R.id.finishScreen); if (getIntent().getBooleanExtra("Outcome", true)){// Means the game was won. successText.setBackgroundColor(Color.WHITE); batteryText.setBackgroundColor(Color.WHITE); pathlenText.setBackgroundColor(Color.WHITE); failureText.setBackgroundColor(Color.WHITE); startovText.setBackgroundColor(Color.WHITE); Log.v(TAG, "Game Success"); failureText.setVisibility(View.INVISIBLE); successText.setVisibility(View.VISIBLE); Bitmap confetti = getConfettiBMP(); finishScreen.setBackground(new BitmapDrawable(getResources(), confetti)); } else{ Log.v(TAG, "Game Failure"); successText.setVisibility(View.INVISIBLE); failureText.setVisibility(View.VISIBLE); finishScreen.setBackgroundColor((130)<<24|((178)<<16)|((34)<<8)|(34)); } String batteryLevel = Float.toString(getIntent().getFloatExtra("BatteryLevel", 0)); String pathLength = Integer.toString(getIntent().getIntExtra("PathLength", 0)); batteryText.setText("Battery Level: " + batteryLevel); pathlenText.setText("Path Length: " + pathLength + "\n"); } /** * Handles the population of the actions in the action bar. */ @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.finish, menu); return true; } /** * Handles usage of the actions in the action bar. */ @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. return super.onOptionsItemSelected(item); } /** * Used to send a message to the user throught the GUI (for testing). Also sends the same message to * logcat through a verbose message. * @param message */ public void toast(String message){ Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_SHORT); toast.show(); Log.v(TAG, message); } /** * Helper method to the GUI Wrapper so that it may retrieve the confetti bitmap from resources. */ public Bitmap getConfettiBMP(){ Bitmap confetti = BitmapFactory.decodeResource(getResources(), R.drawable.confetti); return confetti; } }
[ "kpn@com" ]
kpn@com
648cea4cb8b970dd43dbd9338dcbb85b306c6914
1f209e3670a9a2817273c8a636c7dec28df2e6d2
/src/test/java/org/elasticgremlin/simpleQueryHandler/java/ElasticGraphStructurePerformanceTest.java
f034b32e516ce9be3d4efd8a9ef4d5d0066206d2
[]
no_license
weston100721/elastic-gremlin
76c306e1186472213f8d14042ccd692fa86e7bbd
7c0de0b6696e013507557d57f5a86107412699d5
refs/heads/develop
2021-01-22T23:58:43.548984
2015-10-26T22:19:47
2015-10-26T22:19:47
85,686,669
0
0
null
2017-03-21T10:07:17
2017-03-21T10:07:17
null
UTF-8
Java
false
false
507
java
package org.elasticgremlin.simpleQueryHandler.java; import org.apache.tinkerpop.gremlin.GraphProviderClass; import org.apache.tinkerpop.gremlin.structure.StructurePerformanceSuite; import org.elasticgremlin.ElasticGraphGraphProvider; import org.elasticgremlin.structure.ElasticGraph; import org.junit.runner.RunWith; @RunWith(StructurePerformanceSuite.class) @GraphProviderClass(provider = ElasticGraphGraphProvider.class, graph = ElasticGraph.class) public class ElasticGraphStructurePerformanceTest { }
[ "rmagen@gmail.com" ]
rmagen@gmail.com
48f8c3e34587eb5124c5bf09b13c1cbd7bb0a8a9
0232c1cfd8d5455a7a8924013823f7da8c3d2d86
/DesignPatterns/src/delegatePattern/examples/QuackingBehaviour.java
e410a2a7c3306e340c49ba1002fc34704a286b9c
[]
no_license
rajan-github/practice_and_fun
e1369b47e1e88dff0a0633fa4f52f368252c1a6a
0a415204afd190cccc09e9fbfcd8423d41607ec4
refs/heads/master
2023-01-02T00:35:49.834828
2020-10-25T10:33:52
2020-10-25T10:33:52
257,050,536
0
0
null
null
null
null
UTF-8
Java
false
false
96
java
package delegatePattern.examples; public interface QuackingBehaviour { public void quack(); }
[ "rajan-c@prod.hclpnp.com" ]
rajan-c@prod.hclpnp.com
19184a8555d18b56d7720f5392842b76060057cd
61b1f459b2460a3a6c9371efcbde7243a3f8ce93
/app/src/main/java/com/my/mlqrscan/CameraSource.java
7b34bc8794cd944f85bd7e7020943ee8d62ad4ab
[]
no_license
tejasshah720/MLQRScan
345835a970ba3d40f0c3527da840b81cb87cf978
ecc78fd765092217b0c483276b986cc156cce574
refs/heads/master
2020-04-08T11:40:47.648440
2018-11-27T10:11:46
2018-11-27T10:11:46
159,315,351
0
0
null
null
null
null
UTF-8
Java
false
false
30,431
java
package com.my.mlqrscan; import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.graphics.ImageFormat; import android.graphics.SurfaceTexture; import android.hardware.Camera; import android.hardware.Camera.CameraInfo; import android.support.annotation.Nullable; import android.support.annotation.RequiresPermission; import android.util.Log; import android.view.Surface; import android.view.SurfaceHolder; import android.view.WindowManager; import com.google.android.gms.common.images.Size; import java.io.IOException; import java.lang.Thread.State; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; /** * Created by Tejas Shah on 23/11/18. */ public class CameraSource { @SuppressLint("InlinedApi") public static final int CAMERA_FACING_BACK = Camera.CameraInfo.CAMERA_FACING_BACK; @SuppressLint("InlinedApi") public static final int CAMERA_FACING_FRONT = Camera.CameraInfo.CAMERA_FACING_FRONT; private static final String TAG = "MIDemoApp:CameraSource"; /** * The dummy surface texture must be assigned a chosen name. Since we never use an OpenGL context, * we can choose any ID we want here. The dummy surface texture is not a crazy hack - it is * actually how the camera team recommends using the camera without a preview. */ private static final int DUMMY_TEXTURE_NAME = 100; /** * If the absolute difference between a preview size aspect ratio and a picture size aspect ratio * is less than this tolerance, they are considered to be the same aspect ratio. */ private static final float ASPECT_RATIO_TOLERANCE = 0.01f; protected Activity activity; private Camera camera; protected int facing = CAMERA_FACING_BACK; /** * Rotation of the device, and thus the associated preview images captured from the device. See * Frame.Metadata#getRotation(). */ private int rotation; private Size previewSize; // These values may be requested by the caller. Due to hardware limitations, we may need to // select close, but not exactly the same values for these. private final float requestedFps = 20.0f; private final int requestedPreviewWidth = 480; private final int requestedPreviewHeight = 360; private final boolean requestedAutoFocus = true; // These instances need to be held onto to avoid GC of their underlying resources. Even though // these aren't used outside of the method that creates them, they still must have hard // references maintained to them. private SurfaceTexture dummySurfaceTexture; private final GraphicOverlay graphicOverlay; // True if a SurfaceTexture is being used for the preview, false if a SurfaceHolder is being // used for the preview. We want to be compatible back to Gingerbread, but SurfaceTexture // wasn't introduced until Honeycomb. Since the interface cannot use a SurfaceTexture, if the // developer wants to display a preview we must use a SurfaceHolder. If the developer doesn't // want to display a preview we use a SurfaceTexture if we are running at least Honeycomb. private boolean usingSurfaceTexture; /** * Dedicated thread and associated runnable for calling into the detector with frames, as the * frames become available from the camera. */ private Thread processingThread; private final FrameProcessingRunnable processingRunnable; private final Object processorLock = new Object(); // @GuardedBy("processorLock") private VisionImageProcessor frameProcessor; /** * Map to convert between a byte array, received from the camera, and its associated byte buffer. * We use byte buffers internally because this is a more efficient way to call into native code * later (avoids a potential copy). * * <p><b>Note:</b> uses IdentityHashMap here instead of HashMap because the behavior of an array's * equals, hashCode and toString methods is both useless and unexpected. IdentityHashMap enforces * identity ('==') check on the keys. */ private final Map<byte[], ByteBuffer> bytesToByteBuffer = new IdentityHashMap<>(); public CameraSource(Activity activity, GraphicOverlay overlay) { this.activity = activity; graphicOverlay = overlay; graphicOverlay.clear(); processingRunnable = new FrameProcessingRunnable(); } // ============================================================================================== // Public // ============================================================================================== /** Stops the camera and releases the resources of the camera and underlying detector. */ public void release() { synchronized (processorLock) { stop(); processingRunnable.release(); cleanScreen(); if (frameProcessor != null) { frameProcessor.stop(); } } } /** * Opens the camera and starts sending preview frames to the underlying detector. The preview * frames are not displayed. * * @throws IOException if the camera's preview texture or display could not be initialized */ @SuppressLint("MissingPermission") @RequiresPermission(Manifest.permission.CAMERA) public synchronized CameraSource start() throws IOException { if (camera != null) { return this; } camera = createCamera(); dummySurfaceTexture = new SurfaceTexture(DUMMY_TEXTURE_NAME); camera.setPreviewTexture(dummySurfaceTexture); usingSurfaceTexture = true; camera.startPreview(); processingThread = new Thread(processingRunnable); processingRunnable.setActive(true); processingThread.start(); return this; } /** * Opens the camera and starts sending preview frames to the underlying detector. The supplied * surface holder is used for the preview so frames can be displayed to the user. * * @param surfaceHolder the surface holder to use for the preview frames * @throws IOException if the supplied surface holder could not be used as the preview display */ @RequiresPermission(Manifest.permission.CAMERA) public synchronized CameraSource start(SurfaceHolder surfaceHolder) throws IOException { if (camera != null) { return this; } camera = createCamera(); camera.setPreviewDisplay(surfaceHolder); camera.startPreview(); processingThread = new Thread(processingRunnable); processingRunnable.setActive(true); processingThread.start(); usingSurfaceTexture = false; return this; } /** * Closes the camera and stops sending frames to the underlying frame detector. * * <p>This camera source may be restarted again by calling {@link #start()} or {@link * #start(SurfaceHolder)}. * * <p>Call {@link #release()} instead to completely shut down this camera source and release the * resources of the underlying detector. */ public synchronized void stop() { processingRunnable.setActive(false); if (processingThread != null) { try { // Wait for the thread to complete to ensure that we can't have multiple threads // executing at the same time (i.e., which would happen if we called start too // quickly after stop). processingThread.join(); } catch (InterruptedException e) { Log.d(TAG, "Frame processing thread interrupted on release."); } processingThread = null; } if (camera != null) { camera.stopPreview(); camera.setPreviewCallbackWithBuffer(null); try { if (usingSurfaceTexture) { camera.setPreviewTexture(null); } else { camera.setPreviewDisplay(null); } } catch (Exception e) { Log.e(TAG, "Failed to clear camera preview: " + e); } camera.release(); camera = null; } // Release the reference to any image buffers, since these will no longer be in use. bytesToByteBuffer.clear(); } /** Changes the facing of the camera. */ public synchronized void setFacing(int facing) { if ((facing != CAMERA_FACING_BACK) && (facing != CAMERA_FACING_FRONT)) { throw new IllegalArgumentException("Invalid camera: " + facing); } this.facing = facing; } /** Returns the preview size that is currently in use by the underlying camera. */ public Size getPreviewSize() { return previewSize; } /** * Returns the selected camera; one of {@link #CAMERA_FACING_BACK} or {@link * #CAMERA_FACING_FRONT}. */ public int getCameraFacing() { return facing; } /** * Opens the camera and applies the user settings. * * @throws IOException if camera cannot be found or preview cannot be processed */ @SuppressLint("InlinedApi") private Camera createCamera() throws IOException { int requestedCameraId = getIdForRequestedCamera(facing); if (requestedCameraId == -1) { throw new IOException("Could not find requested camera."); } Camera camera = Camera.open(requestedCameraId); SizePair sizePair = selectSizePair(camera, requestedPreviewWidth, requestedPreviewHeight); if (sizePair == null) { throw new IOException("Could not find suitable preview size."); } Size pictureSize = sizePair.pictureSize(); previewSize = sizePair.previewSize(); int[] previewFpsRange = selectPreviewFpsRange(camera, requestedFps); if (previewFpsRange == null) { throw new IOException("Could not find suitable preview frames per second range."); } Camera.Parameters parameters = camera.getParameters(); if (pictureSize != null) { parameters.setPictureSize(pictureSize.getWidth(), pictureSize.getHeight()); } parameters.setPreviewSize(previewSize.getWidth(), previewSize.getHeight()); parameters.setPreviewFpsRange( previewFpsRange[Camera.Parameters.PREVIEW_FPS_MIN_INDEX], previewFpsRange[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]); parameters.setPreviewFormat(ImageFormat.NV21); setRotation(camera, parameters, requestedCameraId); if (requestedAutoFocus) { if (parameters .getSupportedFocusModes() .contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) { parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO); } else { Log.i(TAG, "Camera auto focus is not supported on this device."); } } camera.setParameters(parameters); // Four frame buffers are needed for working with the camera: // // one for the frame that is currently being executed upon in doing detection // one for the next pending frame to process immediately upon completing detection // two for the frames that the camera uses to populate future preview images // // Through trial and error it appears that two free buffers, in addition to the two buffers // used in this code, are needed for the camera to work properly. Perhaps the camera has // one thread for acquiring images, and another thread for calling into user code. If only // three buffers are used, then the camera will spew thousands of warning messages when // detection takes a non-trivial amount of time. camera.setPreviewCallbackWithBuffer(new CameraPreviewCallback()); camera.addCallbackBuffer(createPreviewBuffer(previewSize)); camera.addCallbackBuffer(createPreviewBuffer(previewSize)); camera.addCallbackBuffer(createPreviewBuffer(previewSize)); camera.addCallbackBuffer(createPreviewBuffer(previewSize)); return camera; } /** * Gets the id for the camera specified by the direction it is facing. Returns -1 if no such * camera was found. * * @param facing the desired camera (front-facing or rear-facing) */ private static int getIdForRequestedCamera(int facing) { Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); for (int i = 0; i < Camera.getNumberOfCameras(); ++i) { Camera.getCameraInfo(i, cameraInfo); if (cameraInfo.facing == facing) { return i; } } return -1; } /** * Selects the most suitable preview and picture size, given the desired width and height. * * <p>Even though we only need to find the preview size, it's necessary to find both the preview * size and the picture size of the camera together, because these need to have the same aspect * ratio. On some hardware, if you would only set the preview size, you will get a distorted * image. * * @param camera the camera to select a preview size from * @param desiredWidth the desired width of the camera preview frames * @param desiredHeight the desired height of the camera preview frames * @return the selected preview and picture size pair */ private static SizePair selectSizePair(Camera camera, int desiredWidth, int desiredHeight) { List<SizePair> validPreviewSizes = generateValidPreviewSizeList(camera); // The method for selecting the best size is to minimize the sum of the differences between // the desired values and the actual values for width and height. This is certainly not the // only way to select the best size, but it provides a decent tradeoff between using the // closest aspect ratio vs. using the closest pixel area. SizePair selectedPair = null; int minDiff = Integer.MAX_VALUE; for (SizePair sizePair : validPreviewSizes) { Size size = sizePair.previewSize(); int diff = Math.abs(size.getWidth() - desiredWidth) + Math.abs(size.getHeight() - desiredHeight); if (diff < minDiff) { selectedPair = sizePair; minDiff = diff; } } return selectedPair; } /** * Stores a preview size and a corresponding same-aspect-ratio picture size. To avoid distorted * preview images on some devices, the picture size must be set to a size that is the same aspect * ratio as the preview size or the preview may end up being distorted. If the picture size is * null, then there is no picture size with the same aspect ratio as the preview size. */ private static class SizePair { private final Size preview; private Size picture; SizePair( android.hardware.Camera.Size previewSize, @Nullable android.hardware.Camera.Size pictureSize) { preview = new Size(previewSize.width, previewSize.height); if (pictureSize != null) { picture = new Size(pictureSize.width, pictureSize.height); } } Size previewSize() { return preview; } @Nullable Size pictureSize() { return picture; } } /** * Generates a list of acceptable preview sizes. Preview sizes are not acceptable if there is not * a corresponding picture size of the same aspect ratio. If there is a corresponding picture size * of the same aspect ratio, the picture size is paired up with the preview size. * * <p>This is necessary because even if we don't use still pictures, the still picture size must * be set to a size that is the same aspect ratio as the preview size we choose. Otherwise, the * preview images may be distorted on some devices. */ private static List<SizePair> generateValidPreviewSizeList(Camera camera) { Camera.Parameters parameters = camera.getParameters(); List<Camera.Size> supportedPreviewSizes = parameters.getSupportedPreviewSizes(); List<Camera.Size> supportedPictureSizes = parameters.getSupportedPictureSizes(); List<SizePair> validPreviewSizes = new ArrayList<>(); for (android.hardware.Camera.Size previewSize : supportedPreviewSizes) { float previewAspectRatio = (float) previewSize.width / (float) previewSize.height; // By looping through the picture sizes in order, we favor the higher resolutions. // We choose the highest resolution in order to support taking the full resolution // picture later. for (android.hardware.Camera.Size pictureSize : supportedPictureSizes) { float pictureAspectRatio = (float) pictureSize.width / (float) pictureSize.height; if (Math.abs(previewAspectRatio - pictureAspectRatio) < ASPECT_RATIO_TOLERANCE) { validPreviewSizes.add(new SizePair(previewSize, pictureSize)); break; } } } // If there are no picture sizes with the same aspect ratio as any preview sizes, allow all // of the preview sizes and hope that the camera can handle it. Probably unlikely, but we // still account for it. if (validPreviewSizes.size() == 0) { Log.w(TAG, "No preview sizes have a corresponding same-aspect-ratio picture size"); for (android.hardware.Camera.Size previewSize : supportedPreviewSizes) { // The null picture size will let us know that we shouldn't set a picture size. validPreviewSizes.add(new SizePair(previewSize, null)); } } return validPreviewSizes; } /** * Selects the most suitable preview frames per second range, given the desired frames per second. * * @param camera the camera to select a frames per second range from * @param desiredPreviewFps the desired frames per second for the camera preview frames * @return the selected preview frames per second range */ @SuppressLint("InlinedApi") private static int[] selectPreviewFpsRange(Camera camera, float desiredPreviewFps) { // The camera API uses integers scaled by a factor of 1000 instead of floating-point frame // rates. int desiredPreviewFpsScaled = (int) (desiredPreviewFps * 1000.0f); // The method for selecting the best range is to minimize the sum of the differences between // the desired value and the upper and lower bounds of the range. This may select a range // that the desired value is outside of, but this is often preferred. For example, if the // desired frame rate is 29.97, the range (30, 30) is probably more desirable than the // range (15, 30). int[] selectedFpsRange = null; int minDiff = Integer.MAX_VALUE; List<int[]> previewFpsRangeList = camera.getParameters().getSupportedPreviewFpsRange(); for (int[] range : previewFpsRangeList) { int deltaMin = desiredPreviewFpsScaled - range[Camera.Parameters.PREVIEW_FPS_MIN_INDEX]; int deltaMax = desiredPreviewFpsScaled - range[Camera.Parameters.PREVIEW_FPS_MAX_INDEX]; int diff = Math.abs(deltaMin) + Math.abs(deltaMax); if (diff < minDiff) { selectedFpsRange = range; minDiff = diff; } } return selectedFpsRange; } /** * Calculates the correct rotation for the given camera id and sets the rotation in the * parameters. It also sets the camera's display orientation and rotation. * * @param parameters the camera parameters for which to set the rotation * @param cameraId the camera id to set rotation based on */ private void setRotation(Camera camera, Camera.Parameters parameters, int cameraId) { WindowManager windowManager = (WindowManager) activity.getSystemService(Context.WINDOW_SERVICE); int degrees = 0; int rotation = windowManager.getDefaultDisplay().getRotation(); switch (rotation) { case Surface.ROTATION_0: degrees = 0; break; case Surface.ROTATION_90: degrees = 90; break; case Surface.ROTATION_180: degrees = 180; break; case Surface.ROTATION_270: degrees = 270; break; default: Log.e(TAG, "Bad rotation value: " + rotation); } Camera.CameraInfo cameraInfo = new Camera.CameraInfo(); Camera.getCameraInfo(cameraId, cameraInfo); int angle; int displayAngle; if (cameraInfo.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) { angle = (cameraInfo.orientation + degrees) % 360; displayAngle = (360 - angle) % 360; // compensate for it being mirrored } else { // back-facing angle = (cameraInfo.orientation - degrees + 360) % 360; displayAngle = angle; } // This corresponds to the rotation constants. this.rotation = angle / 90; camera.setDisplayOrientation(displayAngle); parameters.setRotation(angle); } /** * Creates one buffer for the camera preview callback. The size of the buffer is based off of the * camera preview size and the format of the camera image. * * @return a new preview buffer of the appropriate size for the current camera settings */ @SuppressLint("InlinedApi") private byte[] createPreviewBuffer(Size previewSize) { int bitsPerPixel = ImageFormat.getBitsPerPixel(ImageFormat.NV21); long sizeInBits = (long) previewSize.getHeight() * previewSize.getWidth() * bitsPerPixel; int bufferSize = (int) Math.ceil(sizeInBits / 8.0d) + 1; // Creating the byte array this way and wrapping it, as opposed to using .allocate(), // should guarantee that there will be an array to work with. byte[] byteArray = new byte[bufferSize]; ByteBuffer buffer = ByteBuffer.wrap(byteArray); if (!buffer.hasArray() || (buffer.array() != byteArray)) { // I don't think that this will ever happen. But if it does, then we wouldn't be // passing the preview content to the underlying detector later. throw new IllegalStateException("Failed to create valid buffer for camera source."); } bytesToByteBuffer.put(byteArray, buffer); return byteArray; } // ============================================================================================== // Frame processing // ============================================================================================== /** Called when the camera has a new preview frame. */ private class CameraPreviewCallback implements Camera.PreviewCallback { @Override public void onPreviewFrame(byte[] data, Camera camera) { processingRunnable.setNextFrame(data, camera); } } public void setMachineLearningFrameProcessor(VisionImageProcessor processor) { synchronized (processorLock) { cleanScreen(); if (frameProcessor != null) { frameProcessor.stop(); } frameProcessor = processor; } } /** * This runnable controls access to the underlying receiver, calling it to process frames when * available from the camera. This is designed to run detection on frames as fast as possible * (i.e., without unnecessary context switching or waiting on the next frame). * * <p>While detection is running on a frame, new frames may be received from the camera. As these * frames come in, the most recent frame is held onto as pending. As soon as detection and its * associated processing is done for the previous frame, detection on the mostly recently received * frame will immediately start on the same thread. */ private class FrameProcessingRunnable implements Runnable { // This lock guards all of the member variables below. private final Object lock = new Object(); private boolean active = true; // These pending variables hold the state associated with the new frame awaiting processing. private ByteBuffer pendingFrameData; FrameProcessingRunnable() {} /** * Releases the underlying receiver. This is only safe to do after the associated thread has * completed, which is managed in camera source's release method above. */ @SuppressLint("Assert") void release() { assert (processingThread.getState() == State.TERMINATED); } /** Marks the runnable as active/not active. Signals any blocked threads to continue. */ void setActive(boolean active) { synchronized (lock) { this.active = active; lock.notifyAll(); } } /** * Sets the frame data received from the camera. This adds the previous unused frame buffer (if * present) back to the camera, and keeps a pending reference to the frame data for future use. */ void setNextFrame(byte[] data, Camera camera) { synchronized (lock) { if (pendingFrameData != null) { camera.addCallbackBuffer(pendingFrameData.array()); pendingFrameData = null; } if (!bytesToByteBuffer.containsKey(data)) { Log.d( TAG, "Skipping frame. Could not find ByteBuffer associated with the image " + "data from the camera."); return; } pendingFrameData = bytesToByteBuffer.get(data); // Notify the processor thread if it is waiting on the next frame (see below). lock.notifyAll(); } } /** * As long as the processing thread is active, this executes detection on frames continuously. * The next pending frame is either immediately available or hasn't been received yet. Once it * is available, we transfer the frame info to local variables and run detection on that frame. * It immediately loops back for the next frame without pausing. * * <p>If detection takes longer than the time in between new frames from the camera, this will * mean that this loop will run without ever waiting on a frame, avoiding any context switching * or frame acquisition time latency. * * <p>If you find that this is using more CPU than you'd like, you should probably decrease the * FPS setting above to allow for some idle time in between frames. */ @SuppressLint("InlinedApi") @SuppressWarnings("GuardedBy") @Override public void run() { ByteBuffer data; while (true) { synchronized (lock) { while (active && (pendingFrameData == null)) { try { // Wait for the next frame to be received from the camera, since we // don't have it yet. lock.wait(); } catch (InterruptedException e) { Log.d(TAG, "Frame processing loop terminated.", e); return; } } if (!active) { // Exit the loop once this camera source is stopped or released. We check // this here, immediately after the wait() above, to handle the case where // setActive(false) had been called, triggering the termination of this // loop. return; } // Hold onto the frame data locally, so that we can use this for detection // below. We need to clear pendingFrameData to ensure that this buffer isn't // recycled back to the camera before we are done using that data. data = pendingFrameData; pendingFrameData = null; } // The code below needs to run outside of synchronization, because this will allow // the camera to add pending frame(s) while we are running detection on the current // frame. try { synchronized (processorLock) { Log.d(TAG, "Process an image"); frameProcessor.process( data, new FrameMetadata.Builder() .setWidth(previewSize.getWidth()) .setHeight(previewSize.getHeight()) .setRotation(rotation) .setCameraFacing(facing) .build(), graphicOverlay); } } catch (Throwable t) { Log.e(TAG, "Exception thrown from receiver.", t); } finally { camera.addCallbackBuffer(data.array()); } } } } /** Cleans up graphicOverlay and child classes can do their cleanups as well . */ private void cleanScreen() { graphicOverlay.clear(); } }
[ "tejas.shah@vaagha.com" ]
tejas.shah@vaagha.com
0cdbf6df46928578cb305667472c171fbd77a3d4
fe25d571013398e7b80336d538fd35b10c9bcf88
/src/zz/PermutationSeq.java
c2a3064745a2ca133112caae7d830b721d6c7896
[]
no_license
lyk-ohlyk/leetcode3
b17601fca2eae1df7caca65b4d55b5ad27588d8e
1df951441a2f28ddf8e4337e4ddb59573d8625d4
refs/heads/master
2020-07-23T12:20:40.546726
2017-11-29T00:21:09
2017-11-29T00:21:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,465
java
//zz reviewed package zz; import java.util.Arrays; public class PermutationSeq { public static void main(String[] args) { // TODO Auto-generated method stub PermutationSeq p=new PermutationSeq(); System.out.println(p.getPermutation(3, 4)); } public String getPermutation(int n, int k) { if(n==0 || k==0){ return ""; } //zz independent funciton int[] fact=new int[n+1];//zz why fact has length n+1, and only fact[n-1] is used? fact[0]=1; for(int i=1;i<=n;i++){ fact[i]=fact[i-1]*i; } System.out.println(Arrays.toString(fact)); boolean[] used=new boolean[n+1];//zz isUsed, why used has length n+1, while there is only n elements? used[0]=true; k--; StringBuilder resBuf=new StringBuilder(); for(int i=n-1;i>=0;i--){ int nth=k>0?k/fact[i]:0; //nth=nth==0?fact[i]:nth; System.out.println("nth="+nth+", i="+i); k=k%fact[i]; //k=k==0?fact[i]:k; System.out.println("k="+k); resBuf.append(find(nth,used)); } return resBuf.toString(); } public int find(int nth,boolean[] used){ int i=0; while(nth>=0){//zz while(i<used.length){if(nth<0) ***} is more reasonable //zz this loop is more reasonable to be written in for-loop i++; if(i>=used.length-1){ return i; } if(!used[i]){ nth--; } } used[i]=true; return i; } }
[ "zhou66.ustc@gmail.com" ]
zhou66.ustc@gmail.com
493ccfc4d9e077f9dbc08abd2ed5d3cc22cc3192
0212cf78b122a14c2d9bd276c88b6934b63aa174
/authentication/src/main/java/sc/hqu/graduationdesign/homeworkmanager/model/RequestAuthenticationToken.java
189fba6675cf2405f4c287b0356d6661c4d64918
[]
no_license
tzx2021/HomeworkManager_backend
b6701952edf84ec09469208e42ab9744bc6770fe
ff4ff63a88b394a4f650abff9790e2d6e08427cc
refs/heads/master
2023-04-07T10:59:15.740077
2021-04-13T15:04:13
2021-04-13T15:04:13
346,960,799
0
0
null
null
null
null
UTF-8
Java
false
false
1,109
java
package sc.hqu.graduationdesign.homeworkmanager.model; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.core.SpringSecurityCoreVersion; /** * 用户请求访问的鉴权令牌对象,所有web请求每次进入到服务端时都需要进行接口鉴权认证 * 在通过认证后才可以进行最终的接口访问。每个请求都会持有自己的认证令牌对象 * @author tzx * @date 2021-03-27 13:05 */ public class RequestAuthenticationToken extends AbstractAuthenticationToken { private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID; /** * 接口鉴权的token数据 */ private final Object credentials; public RequestAuthenticationToken(Object credentials){ super(null); this.credentials = credentials; } @Override public Object getCredentials() { return this.credentials; } @Override public Object getPrincipal() { // 接口鉴权只有token数据,不需要principal return null; } }
[ "207735416@qq.com" ]
207735416@qq.com
59409adb17399d43719719aaa632d0046d518fe7
e0cecd894682a55be74d15577f560dd4bd4d74a2
/app/src/main/java/pe/torganizagroup/easyhotelapp/Pojo/Ubications.java
a8e994c8bd1de16c51f2611935437260acd401cf
[]
no_license
PhoenX98/EasyHotelApp
53deb1b43615cffb5846a610e030899461e239e0
f14bf04e018ddc7c122fc3527fa41ac26cf4e9f4
refs/heads/master
2020-04-21T19:43:36.951228
2019-05-06T22:33:52
2019-05-06T22:33:52
169,817,525
0
0
null
null
null
null
UTF-8
Java
false
false
839
java
package pe.torganizagroup.easyhotelapp.Pojo; import java.util.List; import com.google.gson.annotations.Expose; import com.google.gson.annotations.SerializedName; public class Ubications { @SerializedName("type") @Expose private String type; @SerializedName("coordinates") @Expose private List<String> coordinates = null; // public Ubications() { // } public Ubications(String type, List<String> coordinates) { this.type = type; this.coordinates = coordinates; } public String getType() { return type; } public void setType(String type) { this.type = type; } public List<String> getCoordinates() { return coordinates; } public void setCoordinates(List<String> coordinates) { this.coordinates = coordinates; } }
[ "wilberthrp98@gmail.com" ]
wilberthrp98@gmail.com
c3e0225c8fa40ebf1e8d665d94612e61fca74114
1c8ff1b9291e7328c4aa72f4668aeda6ff42119d
/src/main/java/com/aws/sundgaar/Application.java
f3a29cac8f86c868883ef04e70713776426468f5
[ "MIT" ]
permissive
sundgaard-aws/simple-java-lambda
c6264b82da3576cc838f876ad2471804fa00c94d
4fc4db82aae82d321e3dbc5df6690c935b745578
refs/heads/master
2023-02-04T23:03:16.081477
2020-12-23T14:22:24
2020-12-23T14:22:24
295,700,813
0
0
null
null
null
null
UTF-8
Java
false
false
306
java
package com.aws.sundgaar; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
[ "michaelringholm@gmail.com" ]
michaelringholm@gmail.com
1909cb02b7b949acae7cc00e3bb8da388a4f166b
6c6ac53b3b8246c05f766aea59b538b9201574d6
/Sta/app/src/main/java/com/example/sri/sta/HttpPUTTask.java
3788297c989062a6af0cbdc9620361f59e32663f
[]
no_license
ranjithreddy123/Stato
d9262fdd9744f595f575c60213631e9f6126a7fb
6114806cd76817b11346230c77aeb1b5fbeecd61
refs/heads/master
2020-03-25T10:08:48.550883
2018-08-06T06:23:13
2018-08-06T06:23:34
143,684,693
0
0
null
null
null
null
UTF-8
Java
false
false
3,990
java
package com.example.sri.sta; import android.os.AsyncTask; import android.util.Log; import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.URL; import java.util.Map; import javax.net.ssl.HttpsURLConnection; /** * Created by sri on 03-08-2018. */ class HttpPUTTask extends AsyncTask<Object, String, String> { private static final String TAG = HttpPUTTask.class.getName(); private InputStream inputStream; private HttpURLConnection urlConnection; private byte[] outputBytes; private String queryParams; private String responseData; private OnResponseRetrievedCallback callback; private String mAuth; private Map<String, String> mHeaderParams; public HttpPUTTask(String queryParams, OnResponseRetrievedCallback callback) { this.queryParams = queryParams; this.callback = callback; } @Override protected String doInBackground(Object... params) { OutputStream os = null; // Send data try { // forming th java.net.URL object URL url = new URL(params[0].toString()); urlConnection = (HttpURLConnection) url.openConnection(); // set header if (mHeaderParams != null && mHeaderParams.size() > 0) { for (Map.Entry<String, String> entry : mHeaderParams.entrySet()) { urlConnection.setRequestProperty(entry.getKey(), entry.getValue()); } } // set auth if (mAuth != null && !mAuth.isEmpty()) urlConnection.setRequestProperty("Authorization", mAuth); // pass put data outputBytes = queryParams.getBytes(); urlConnection.setRequestMethod("PUT"); urlConnection.connect(); os = urlConnection.getOutputStream(); os.write(outputBytes); // Get Response and execute WebService request int statusCode = urlConnection.getResponseCode(); // 200 represents HTTP OK if (statusCode == HttpsURLConnection.HTTP_OK) { inputStream = new BufferedInputStream(urlConnection.getInputStream()); responseData = convertStreamToString(inputStream); } else if (statusCode == HttpsURLConnection.HTTP_NO_CONTENT) { responseData = "deleted with status " + statusCode; } else { responseData = null; } } catch (Exception e) { e.printStackTrace(); } finally { try { if (os != null) os.close(); } catch (IOException e) { e.printStackTrace(); } } return responseData; } // source : https://stackoverflow.com/questions/309424/read-convert-an-inputstream-to-a-string public static String convertStreamToString(InputStream inputStream) throws IOException { ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; int length; while ((length = inputStream.read(buffer)) != -1) { result.write(buffer, 0, length); } // StandardCharsets.UTF_8.name() > JDK 7 String res = ""; if (result.toString("UTF-8").isEmpty()) res = "success"; return res; } @Override protected void onPostExecute(String response) { Log.i(TAG, "onPostExecute"); if (response != null && !response.isEmpty()) callback.onSuccess(response); else callback.onError(new Exception("response is not valid")); } public void setAuth(String auth) { mAuth = auth; } public void setHeaderParams(Map<String, String> headerParams) { mHeaderParams = headerParams; } }
[ "ranju0515@gmail.com" ]
ranju0515@gmail.com
5915c627f38e5835c5d6f91f983aac4a1e008af1
e6a0b364a5cf52c99bfe8fdf8757133263668758
/coding2017 第二季/students/315863321/ood/ood-assignment/src/main/java/org/litejunit/v3/runner/Request.java
da1019f86875ed42af16bb040091e568ba7e70f6
[]
no_license
china-kook/coding2017
9d2bd0792a8defbc673fbaa5a3ccf18b7ff6f06f
fa3adef8048fab70b2daecf0c96fa549b3eb58a5
refs/heads/master
2021-01-19T13:08:51.819495
2019-02-25T13:58:20
2019-02-25T13:58:20
82,365,925
1
1
null
2017-02-18T06:10:56
2017-02-18T06:10:56
null
UTF-8
Java
false
false
3,348
java
package org.litejunit.v3.runner; import org.litejunit.v3.internal.requests.*; import org.litejunit.v3.runner.manipulation.Filter; import java.util.Comparator; /** * A <code>Request</code> is an abstract description of tests to be run. Older versions of * JUnit did not need such a concept--tests to be run were described either by classes containing * tests or a tree of <code>Tests</code>. However, we want to support filtering and sorting, * so we need a more abstract specification than the tests themselves and a richer * specification than just the classes. * <p> * The flow when JUnit runs tests is that a <code>Request</code> specifies some tests to be run -> * a <code>Runner</code> is created for each class implied by the <code>Request</code> -> the <code>Runner</code> * returns a detailed <code>Description</code> which is a tree structure of the tests to be run. */ public abstract class Request { /** * Create a <code>Request</code> that, when processed, will run a single test. * This is done by filtering out all other tests. This method is used to support rerunning * single tests. * @param clazz the class of the test * @param methodName the name of the test * @return a <code>Request</code> that will cause a single test be run */ public static Request method(Class<?> clazz, String methodName) { Description method= Description.createTestDescription(clazz, methodName); return Request.aClass(clazz).filterWith(method); } /** * Create a <code>Request</code> that, when processed, will run all the tests * in a class. The odd name is necessary because <code>class</code> is a reserved word. * @param clazz the class containing the tests * @return a <code>Request</code> that will cause all tests in the class to be run */ public static Request aClass(Class<?> clazz) { return new ClassRequest(clazz); } /** * Create a <code>Request</code> that, when processed, will run all the tests * in a set of classes. * @param collectionName a name to identify this suite of tests * @param classes the classes containing the tests * @return a <code>Request</code> that will cause all tests in the classes to be run */ public static Request classes(String collectionName, Class... classes) { return new ClassesRequest(collectionName, classes); } public static Request errorReport(Class<?> klass, Throwable cause) { return new ErrorReportingRequest(klass, cause); } public abstract Runner getRunner(); public Request filterWith(Filter filter) { return new FilterRequest(this, filter); } public Request filterWith(final Description desiredDescription) { return filterWith(new Filter() { @Override public boolean shouldRun(Description description) { // TODO: test for equality even if we have children? if (description.isTest()) return desiredDescription.equals(description); for (Description each : description.getChildren()) if (shouldRun(each)) return true; return false; } @Override public String describe() { return String.format("Method %s", desiredDescription.getDisplayName()); } }); } public Request sortWith(Comparator<Description> comparator) { return new SortingRequest(this, comparator); } }
[ "china.ikook@gmail.com" ]
china.ikook@gmail.com
e702ae4402c46c33500ec8376b780f4663f0e98c
8ccd1c071b19388f1f2e92c5e5dbedc78fead327
/src/main/java/ohos/agp/render/render3d/components/NodeComponent.java
12690de4fa26df4d67fab444ce8731cc8a7af4d9
[]
no_license
yearsyan/Harmony-OS-Java-class-library
d6c135b6a672c4c9eebf9d3857016995edeb38c9
902adac4d7dca6fd82bb133c75c64f331b58b390
refs/heads/main
2023-06-11T21:41:32.097483
2021-06-24T05:35:32
2021-06-24T05:35:32
379,816,304
6
3
null
null
null
null
UTF-8
Java
false
false
928
java
package ohos.agp.render.render3d.components; import ohos.agp.render.render3d.Component; import ohos.agp.render.render3d.Entity; public class NodeComponent implements Component { private boolean mIsEnabled; private boolean mIsExported; private String mName; private Entity mParent; public String getName() { return this.mName; } public void setName(String str) { this.mName = str; } public Entity getParent() { return this.mParent; } public void setParent(Entity entity) { this.mParent = entity; } public boolean isEnabled() { return this.mIsEnabled; } public void setEnabled(boolean z) { this.mIsEnabled = z; } public boolean isExported() { return this.mIsExported; } public void setExported(boolean z) { this.mIsExported = z; } }
[ "yearsyan@gmail.com" ]
yearsyan@gmail.com
e6783828ee943f5735bd273880f328d130ddfba0
65fa45fb0bc7515535446d42015ae4f964c49139
/app/src/main/java/com/project/equipmanagement/app/MyApplication.java
c6c72ec542a82692452a49bd6f81e3c19c86374a
[]
no_license
yeyanni910/EquipManagement
3ef399f6fadac1579d7f90d81e24d18d6b5e5bb5
692fd8f6fc4dd56de28bab03bac2bac8d1ec1a59
refs/heads/master
2021-01-02T08:11:07.380811
2017-09-07T04:36:21
2017-09-07T04:36:21
98,952,227
0
0
null
null
null
null
UTF-8
Java
false
false
6,785
java
package com.project.equipmanagement.app; import android.app.Application; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.os.Build; import android.os.Handler; import android.os.StrictMode; import com.project.equipmanagement.BuildConfig; import com.project.equipmanagement.utils.ACache; import com.project.equipmanagement.utils.NetUtils; import com.readystatesoftware.chuck.ChuckInterceptor; import com.socks.library.KLog; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import okhttp3.Cache; import okhttp3.CacheControl; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; /** * Created by AnnieYe on 17/8/1 13:56. * email:15191755477@163.com */ public class MyApplication extends Application { private static final String TAG = "okhttp"; private static MyApplication mApplication; private static Handler mHandler; private static ACache mACache; @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); } @Override public void onCreate() { super.onCreate(); initBase(); //初始化log initLog(); //开启违例检测:StrictMode if (BuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); } } private void initLog() { KLog.init(BuildConfig.DEBUG, "Equip"); } private void initBase() { mApplication = this; mHandler = new Handler(); //初始化ACache类 mACache = ACache.get(this); } public static ACache getACache() { return mACache; } public static MyApplication getInstance(){ return mApplication; } public static Handler getHandler(){ if (mHandler == null){ mHandler = new Handler(); } return mHandler; } public static OkHttpClient defaultOkHttpClient(){ OkHttpClient.Builder client = new OkHttpClient.Builder(); client.writeTimeout(30 * 1000, TimeUnit.MILLISECONDS); client.readTimeout(20 * 1000, TimeUnit.MILLISECONDS); client.connectTimeout(15 * 1000, TimeUnit.MILLISECONDS); //设置缓存路径 File httpCacheDirectory = new File(mApplication.getCacheDir(),"okHttpCache"); //设置缓存 10M Cache cache = new Cache(httpCacheDirectory,10 * 1024 * 1024); client.cache(cache); //设置拦截器 client.addInterceptor(LoggingInterceptor); //添加日志拦截器 client.addInterceptor(new ChuckInterceptor(mApplication)); client.addNetworkInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR); client.addInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR); return client.build(); } private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() { @Override public Response intercept(Interceptor.Chain chain) throws IOException { //方案一:有网和没有网都是先读缓存 // Request request = chain.request(); // Log.i(TAG, "request=" + request); // Response response = chain.proceed(request); // Log.i(TAG, "response=" + response); // // String cacheControl = request.cacheControl().toString(); // if (TextUtils.isEmpty(cacheControl)) { // cacheControl = "public, max-age=60"; // } // return response.newBuilder() // .header("Cache-Control", cacheControl) // .removeHeader("Pragma") // .build(); //方案二:无网读缓存,有网根据过期时间重新请求 boolean netWorkConection = NetUtils.hasNetWorkConection(MyApplication.getInstance()); Request request = chain.request(); if (!netWorkConection) { request = request.newBuilder() .cacheControl(CacheControl.FORCE_CACHE) .build(); } Response response = chain.proceed(request); if (netWorkConection) { //有网的时候读接口上的@Headers里的配置,你可以在这里进行统一的设置 String cacheControl = request.cacheControl().toString(); response.newBuilder() .removeHeader("Pragma")// 清除头信息,因为服务器如果不支持,会返回一些干扰信息,不清除下面无法生效 .header("Cache-Control", cacheControl) .build(); } else { int maxStale = 60 * 60 * 24 * 7; response.newBuilder() .removeHeader("Pragma") .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) .build(); } return response; } }; private static final Interceptor LoggingInterceptor = new Interceptor() { @Override public Response intercept(Interceptor.Chain chain) throws IOException { Request request = chain.request(); long t1 = System.nanoTime(); okhttp3.Response response = chain.proceed(chain.request()); long t2 = System.nanoTime(); okhttp3.MediaType mediaType = response.body().contentType(); String content = response.body().string(); KLog.i(TAG, "-----LoggingInterceptor----- :\nrequest url:" + request.url() + "\ntime:" + (t2 - t1) / 1e6d + "\nbody:" + content + "\n"); return response.newBuilder() .body(okhttp3.ResponseBody.create(mediaType, content)) .build(); } }; //版本名 public static String getVersionName() { return getPackageInfo().versionName; } //版本号 public static int getVersionCode() { return getPackageInfo().versionCode; } private static PackageInfo getPackageInfo() { PackageInfo pi = null; try { PackageManager pm = mApplication.getPackageManager(); pi = pm.getPackageInfo(mApplication.getPackageName(), PackageManager.GET_CONFIGURATIONS); return pi; } catch (Exception e) { e.printStackTrace(); } return pi; } }
[ "ye.yanni@yujianjia.com" ]
ye.yanni@yujianjia.com
398bd1bca045e4674e30123b50dddc5b0b0f25f5
a84832dd5242e0a17a9820d955432d3e8ba258f0
/src/com/retailshop/action/admin/SurveyQuestionBean.java
d95eedee9b2711337e0114a899f517d39fe234e1
[]
no_license
vivektr2007/bestkart4u
229effb614d454e03b38797b2bde6deeddac7faf
0c67b66f4d84ae0ee2c7eeca0c341bd525ccc27c
refs/heads/main
2023-02-27T05:19:05.575607
2021-02-04T09:30:10
2021-02-04T09:30:10
335,901,726
0
0
null
null
null
null
UTF-8
Java
false
false
884
java
package com.retailshop.action.admin; import java.util.ArrayList; import java.util.List; public class SurveyQuestionBean { private int questionId; private String questionDesc; private List<SurveyAnswerBean> surveyAnswerBean = new ArrayList<SurveyAnswerBean>(); public int getQuestionId() { return questionId; } public void setQuestionId(int questionId) { this.questionId = questionId; } public String getQuestionDesc() { return questionDesc; } public void setQuestionDesc(String questionDesc) { this.questionDesc = questionDesc; } public List<SurveyAnswerBean> getSurveyAnswerBean() { return surveyAnswerBean; } public void setSurveyAnswerBean(List<SurveyAnswerBean> surveyAnswerBean) { this.surveyAnswerBean = surveyAnswerBean; } public String toString(){ return "{ " + questionId + " ," + questionDesc + " ," + surveyAnswerBean + "}"; } }
[ "vivektr2007@gmail.com" ]
vivektr2007@gmail.com
e6bca74a74020a741a8039cdd350bdf7b6b87529
8b15e30df7437c9aebd8fc2c65df91f4e05b9558
/src/main/java/eu/getmangos/mapper/CreatureRespawnMapper.java
6b15817db0998d8d885c154589b3a3a835860098
[ "Apache-2.0" ]
permissive
Warkdev/instance-service
f2fe4dd8409daed8753c6527e0f65f8027894a88
6bc6fdee86ae0bf1bab66bc4ef9ccdee63e88bb5
refs/heads/main
2023-05-02T21:19:41.457719
2020-11-28T21:51:43
2020-11-28T21:51:43
314,816,039
0
0
Apache-2.0
2021-06-02T06:19:25
2020-11-21T13:16:32
Java
UTF-8
Java
false
false
597
java
package eu.getmangos.mapper; import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import eu.getmangos.dto.CreatureRespawnDTO; import eu.getmangos.entities.CreatureRespawn; @Mapper(componentModel = "cdi") public interface CreatureRespawnMapper { @Mapping(source = "respawn.creatureRespawnPK.guid", target = "guid") @Mapping(source = "respawn.creatureRespawnPK.instance", target = "instance") CreatureRespawnDTO map(CreatureRespawn respawn); @InheritInverseConfiguration CreatureRespawn map(CreatureRespawnDTO dto); }
[ "cedric.servais@outlook.com" ]
cedric.servais@outlook.com
5d58c4c1da9327c9dc9a3c9b656bfb1fc3b55ec5
b7ffcfbf6c27c58a5901eb1f5d2b3f20522fe96b
/ContainsDuplicateII.java
158be61f6f22c0e5df763b8c41dfa63bf45924b0
[]
no_license
ShuzhongChen/Java-Problems
354ca2ea7da5a008945bc29f167bd8747e72518c
8ba7b5a5c1f4f7658bca55ed20c66cd6b164a3f6
refs/heads/master
2021-08-24T04:56:51.243893
2017-12-08T04:08:14
2017-12-08T04:08:14
105,944,348
0
0
null
null
null
null
UTF-8
Java
false
false
376
java
class Solution { public boolean containsNearbyDuplicate(int[] nums, int k) { HashMap<Integer, Integer> map = new HashMap<>(); for (int i = 0; i < nums.length; i++) { if (map.containsKey(nums[i]) && i - map.get(nums[i]) <= k) { return true; } map.put(nums[i], i); } return false; } }
[ "chenshuzhongs@gmail.com" ]
chenshuzhongs@gmail.com
1203fa4602d95dc1815942dd4c55a535cce791b4
84aa13805ede450ba37c62df2210023f84e3ac69
/common/src/main/java/com/lucky/common/util/MapUtils.java
0525f6002b2b3f0295c2f3ce02c73ae9c10457c7
[]
no_license
1096064232/lucky-project
bedb5286e794576085cd7463cbac0a2bdf18cb23
58ecacf3b4eefa67fa269af6ecb38fb92099e6dc
refs/heads/master
2020-04-17T13:27:09.675110
2019-03-14T14:31:43
2019-03-14T14:31:43
166,616,522
3
1
null
null
null
null
UTF-8
Java
false
false
895
java
package com.lucky.common.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; public class MapUtils { private static Logger logger = LoggerFactory.getLogger(MapUtils.class); public static Map<String, Object> conversion(Map<String, String> map) { Map<String, Object> result = new HashMap<>(); if (map == null) return result; for (Map.Entry<String, String> entry : map.entrySet()) { result.put(entry.getKey(), entry.getValue()); } return result; } /** * 打印Map集合 * @param map */ public static void printMap(Map map){ if(map == null) logger.info("集合为空"); for(Object key:map.keySet()){ logger.info("key is :{},value is :{}, value is :",key,(String)map.get(key)); } } }
[ "“1096064232@qq.com" ]
“1096064232@qq.com
2f42971e2e236eb3d24558530993f6a7220b89e3
34bbd6c4b46602fef9ddfc34022af16ffe386e84
/jgltf-model/src/main/java/de/javagl/jgltf/model/io/v1/GltfReaderV1.java
b53b13548e33f2313a68f8eb4842bbe22833066a
[ "MIT" ]
permissive
javagl/JglTF
a1bf14745ed21c2a24336f128453b899b2edca58
ec0b0dc27b9e666e027d6cd80ac4e1feaede22a2
refs/heads/master
2023-08-19T09:50:36.919314
2023-08-06T12:50:28
2023-08-06T12:50:28
58,940,073
187
60
MIT
2023-08-06T12:50:29
2016-05-16T14:41:52
Java
UTF-8
Java
false
false
3,115
java
/* * www.javagl.de - JglTF * * Copyright 2015-2016 Marco Hutter - http://www.javagl.de * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package de.javagl.jgltf.model.io.v1; import java.io.IOException; import java.io.InputStream; import java.util.function.Consumer; import com.fasterxml.jackson.databind.ObjectMapper; import de.javagl.jgltf.impl.v1.GlTF; import de.javagl.jgltf.model.io.JacksonUtils; import de.javagl.jgltf.model.io.JsonError; import de.javagl.jgltf.model.io.JsonErrorConsumers; /** * A class for reading a version 1.0 {@link GlTF} from an input stream */ public final class GltfReaderV1 { // Note: This class could use GltfReader as a delegate, and could // then verify that the glTF has the right version. Right now, it // assumes that it is only used for glTF 1.0 inputs. /** * A consumer for {@link JsonError}s that may occur while reading * the glTF JSON */ private Consumer<? super JsonError> jsonErrorConsumer = JsonErrorConsumers.createLogging(); /** * Creates a new glTF reader */ public GltfReaderV1() { // Default constructor } /** * Set the given consumer to receive {@link JsonError}s that may * occur when the JSON part of the glTF is read * * @param jsonErrorConsumer The consumer */ public void setJsonErrorConsumer( Consumer<? super JsonError> jsonErrorConsumer) { this.jsonErrorConsumer = jsonErrorConsumer; } /** * Read the {@link GlTF} from the given stream * * @param inputStream The input stream * @return The {@link GlTF} * @throws IOException If an IO error occurs */ public GlTF read(InputStream inputStream) throws IOException { ObjectMapper objectMapper = JacksonUtils.createObjectMapper(jsonErrorConsumer); GlTF gltf = objectMapper.readValue(inputStream, GlTF.class); return gltf; } }
[ "javagl@javagl.de" ]
javagl@javagl.de
5dc1e8a250ef7b681c22f2cf1a30f54bb06e8924
5b57ac5acab8bf8340993a990ec04cca16646557
/Leetcode 050 - Pow(x, n).java
f2b0f045a5f27b676e6c5e9b10c2b37ba1a40446
[]
no_license
yuweiw823/algorithm-practice
56e7b3452c9dccf1389f79fdbd72c5f15f7b91c0
7c7dc880001df37c636783812be30a9b535b9a45
refs/heads/master
2021-05-01T00:42:50.471956
2019-02-13T08:40:03
2019-02-13T08:40:03
44,027,987
4
4
null
null
null
null
UTF-8
Java
false
false
479
java
//Leetcode 050 - Pow(x, n).java //和 029 一起看 public class Solution { public static void main(String[] args){ Double res = pow(7.0, 5); System.out.println(res + ""); } public static Double pow(Double x, int n){ return (n>0) ? power(x, n) : 1/power(x, n); } public static Double power(Double x, int n){ if(n==0) return 1.0; if(n==1) return x; Double temp = power(x, n/2); return (n%2==0) ? temp * temp : temp * temp * x; } }
[ "yuweiw823@gmail.com" ]
yuweiw823@gmail.com
4b04c5e65709ac6b02820353fb616a37a1382180
1c2875da6e4c70588983794bf0943a6c380d598f
/core/src/com/mmalk/mazeball/maputil/framework/GameMapSolution.java
d060fc30c01cfe1b416a2df1927d9c6ce127271e
[]
no_license
mmalk03/mazeball
ee8252db99930da45a0021d47c097e120f5221fc
d7dcda1d94865185b57491682a5ec26f4c860302
refs/heads/master
2020-12-09T23:37:02.207186
2020-01-12T19:40:49
2020-01-12T19:40:49
233,448,102
0
0
null
null
null
null
UTF-8
Java
false
false
984
java
package com.mmalk.mazeball.maputil.framework; import com.mmalk.mazeball.maputil.ArrayPosition; import java.util.Stack; public abstract class GameMapSolution { protected Stack<ArrayPosition> solution; public GameMapSolution(GameMapSolution gameMapSolution){ solution = (Stack<ArrayPosition>) gameMapSolution.getSolution().clone(); } public GameMapSolution(Stack<ArrayPosition> solution) { this.solution = solution; } public Stack<ArrayPosition> getSolution() { return solution; } public void setSolution(Stack<ArrayPosition> solution) { this.solution = solution; } public ArrayPosition pop(){ return solution.pop(); } public ArrayPosition peek(){ return solution.peek(); } public int size(){ return solution.size(); } public ArrayPosition push(ArrayPosition arrayPosition){return solution.push(arrayPosition);} }
[ "m.malkinski87@gmail.com" ]
m.malkinski87@gmail.com
bb09f06afc2f4a971670e2b76d06f22280174bb7
66220fbb2b7d99755860cecb02d2e02f946e0f23
/src/net/sourceforge/plantuml/activitydiagram3/ftile/AbstractConnection.java
dfe51dd58c4ec131c571f2e2ab110a86ab935c78
[ "MIT" ]
permissive
isabella232/plantuml-mit
27e7c73143241cb13b577203673e3882292e686e
63b2bdb853174c170f304bc56f97294969a87774
refs/heads/master
2022-11-09T00:41:48.471405
2020-06-28T12:42:10
2020-06-28T12:42:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,545
java
/* ======================================================================== * PlantUML : a free UML diagram generator * ======================================================================== * * (C) Copyright 2009-2020, Arnaud Roques * * Project Info: https://plantuml.com * * If you like this project or if you find it useful, you can support us at: * * https://plantuml.com/patreon (only 1$ per month!) * https://plantuml.com/paypal * * This file is part of PlantUML. * * Licensed under The MIT License (Massachusetts Institute of Technology License) * * See http://opensource.org/licenses/MIT * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * * Original Author: Arnaud Roques */ package net.sourceforge.plantuml.activitydiagram3.ftile; import net.sourceforge.plantuml.graphic.HorizontalAlignment; public abstract class AbstractConnection implements Connection { private final Ftile ftile1; private final Ftile ftile2; public AbstractConnection(Ftile ftile1, Ftile ftile2) { this.ftile1 = ftile1; this.ftile2 = ftile2; } @Override public String toString() { return "[" + ftile1 + "]->[" + ftile2 + "]"; } final public Ftile getFtile1() { return ftile1; } final public Ftile getFtile2() { return ftile2; } final public HorizontalAlignment arrowHorizontalAlignment() { if (ftile1 != null) { return ftile1.arrowHorizontalAlignment(); } if (ftile2 != null) { return ftile2.arrowHorizontalAlignment(); } return HorizontalAlignment.LEFT; } }
[ "plantuml@gmail.com" ]
plantuml@gmail.com
58ae6c5f74a2a032c56a6bb4412e83862f9be511
f27bb194c4764df742806c7df6ac1036634fa8af
/SHAclient/src/appModel/CameraDevice.java
9f711a17673d63946dedb40736c214da72df1bcf
[]
no_license
kenjudytx/SHAclient
0d332c980d8c0ba5362c545dc569c24c75132310
50be92c4cbb2ff78897d58b43a094d050a752835
refs/heads/master
2016-09-06T06:02:48.527572
2015-03-25T12:07:37
2015-03-25T12:08:45
32,859,559
0
0
null
null
null
null
UTF-8
Java
false
false
272
java
package appModel; import appControl.DeviceController; public class CameraDevice extends Device { public CameraDevice(int id, String dtype, String n, DeviceController d) { super(id,dtype,n,d); } public boolean refresh() { return false; } }
[ "kenjudytx@gmail.com" ]
kenjudytx@gmail.com
25663a3fec05df2f81601328c6a3047ef857c0d7
d6cc1db17fec8e06c4ac3462856a74d12098cafa
/src/java/br/app/teste/config/AuthenticationPhaseListener.java
7140a8f9f1ed95bf5f7b990a6ec2c7ce42e26c3a
[]
no_license
Hericksnake/OlicarDemo
4cb6794978c1708192f392138da12e01349b2075
5e20216b9b185419625a6e38bbdb7e1f8c16d7b4
refs/heads/master
2021-01-23T03:22:09.884125
2012-11-19T23:50:08
2012-11-19T23:50:08
6,695,843
0
1
null
null
null
null
UTF-8
Java
false
false
1,803
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package br.app.teste.config; import br.app.teste.beans.PessoaBean; import br.app.teste.jsf.UserSessionManagedBean; import java.util.Map; import javax.faces.application.NavigationHandler; import javax.faces.context.FacesContext; import javax.faces.event.PhaseEvent; import javax.faces.event.PhaseId; import javax.faces.event.PhaseListener; import org.apache.log4j.Logger; /** * * @author Herick * * http://www.rodrigolazoti.com.br/pt/2008/09/01/filtrando-usuarios-logados-em-jsf-com-phaselistener/ */ public class AuthenticationPhaseListener implements PhaseListener { private static final Logger logger = Logger.getLogger(AuthenticationPhaseListener.class); @Override public void afterPhase(PhaseEvent event) { logger.debug("Verificando se usuário está logado..."); FacesContext facesContext = event.getFacesContext(); String currentPage = facesContext.getViewRoot().getViewId(); boolean isLoginPage = (currentPage.lastIndexOf("login.xhtml") > -1); Map sessionMap = facesContext.getExternalContext().getSessionMap(); UserSessionManagedBean userSessionMB = (UserSessionManagedBean) sessionMap.get("userSessionMB"); PessoaBean pessoa = null; if (userSessionMB != null) { pessoa = userSessionMB.getLoggedUser(); } if (!isLoginPage && pessoa == null) { NavigationHandler nh = facesContext.getApplication().getNavigationHandler(); nh.handleNavigation(facesContext, null, "loginPage"); } } @Override public void beforePhase(PhaseEvent event) { } @Override public PhaseId getPhaseId() { return PhaseId.RESTORE_VIEW; } }
[ "herick.marques@gmail.com" ]
herick.marques@gmail.com
81d50e58eeff5b9aaf2e3b352635953b1923aa03
753e59a2277d26ceb26bfbd330aff7cd7d0d7c4b
/api-server/src/main/java/io/enmasse/api/v1/types/APIResource.java
3a4947562c23f6fbda546d43d479a37cc1677b08
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "CDDL-1.0", "GPL-2.0-only" ]
permissive
riccardo-forina/enmasse
e17bc17677015a8711073429fc1d73c2f6602ef6
f93289ec5865f87d4fb35892a2d9eec3b8125396
refs/heads/master
2020-08-10T16:40:41.189040
2020-01-14T09:35:05
2020-01-14T09:35:05
214,378,403
0
6
Apache-2.0
2020-01-14T09:35:06
2019-10-11T08:01:32
Java
UTF-8
Java
false
false
1,446
java
/* * Copyright 2018, EnMasse authors. * License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html). */ package io.enmasse.api.v1.types; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @JsonInclude(JsonInclude.Include.NON_NULL) public class APIResource { @JsonProperty("name") private String name; @JsonProperty("singularname") private String singularname = ""; @JsonProperty("namespaced") private boolean namespaced = false; @JsonProperty("kind") private String kind; @JsonProperty("verbs") private List<String> verbs; public APIResource(String name, String singularname, boolean namespaced, String kind, List<String> verbs) { this.name = name; this.singularname = singularname; this.namespaced = namespaced; this.kind = kind; this.verbs = verbs; } @JsonProperty("name") public String getName() { return name; } @JsonProperty("singularname") private String getSingularname() { return singularname; } @JsonProperty("namespaced") private boolean getNamespaced() { return namespaced; } @JsonProperty("kind") public String getKind() { return kind; } @JsonProperty("verbs") private List<String> getVerbs() { return verbs; } }
[ "lulf@pvv.ntnu.no" ]
lulf@pvv.ntnu.no
02bf52fdd6248e361d32c683965c8e507db07a13
4840938f218f583db4fddd3f3fe16767b4186281
/wnexporter/src/main/java/kr/co/wisenut/config/datasource/DBVender.java
0a19ce8b1010cf8fa4622530c7844c9191941afa
[]
no_license
yksung/wnexporter
ab64d1275bb911293dac7a15428447275f2e104f
72e494cf2e9608f984a7712a13175228b90a693b
refs/heads/master
2021-01-18T22:13:09.811571
2017-01-11T04:31:09
2017-01-11T04:31:09
69,224,451
0
0
null
null
null
null
UTF-8
Java
false
false
1,186
java
/* * @(#)DBVender.java 1.0.5 2009/03/19 * */ package kr.co.wisenut.config.datasource; /** * Created by WISEnut * <b>Filename : </b>DBVender.java<p> * Copyright 2001-2009 WISEnut, Inc. All Rights Reserved. * This software is the proprietary information of WISEnut, Inc. * SLA Exporter Release 19 March 2009 * * Date: 2009. 03. 19 * @author WISEnut<br> * @version 1.0.5<br> */ public class DBVender { public final static int ORACLE = 0; public final static int ORACLE_OCI = 1; public final static int MSSQL = 2; public final static int MSSQL2005 = 3; public final static int MYSQL = 4; public final static int INFORMIX = 5; public final static int DB2 = 6; public final static int AS400 = 7; public final static int UNISQL = 8; public final static int SYBASE = 9; public final static int ACCESS = 10; public final static int KDB_APP = 11; public final static int POSTGRE = 12; public final static int ALTIBASE3 = 13; public final static int ALTIBASE = 14; public final static int DERBY = 15; public final static int SYMFOWARE = 16; public final static int CUBRID = 17; }
[ "Holly@Holly-THINK" ]
Holly@Holly-THINK
5cc5f984d8b4db5ccba09d7dad540ad957614bd0
b6a1d21c176efc9327043f6fb379a2f93e5b958e
/scripts/src/main/java/nz/ac/massey/httpmockskeletons/scripts/commons/OWLClassLabelsJSONArrays.java
ae71bd641603bba5bfc16119e2179ba9ee8900da
[]
no_license
sudam/http-mock-skeletons
803c0f46933df2387bef706c8caa4ceaaa435562
462894ca5985d769199b934d126333d45591290e
refs/heads/master
2022-12-10T02:05:01.042261
2020-09-13T13:17:59
2020-09-13T13:17:59
295,154,176
0
0
null
null
null
null
UTF-8
Java
false
false
11,926
java
package nz.ac.massey.httpmockskeletons.scripts.commons; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.model.*; import java.io.File; import java.util.*; /** * this class creates a static JSON array of label names for each dataset types * that reflect the OWL class labels with actual OWL class name * * @author thilini bhagya */ public class OWLClassLabelsJSONArrays { public static JSONObject getOwlClassLabelsJsonArraySlack(){ JSONObject item = new JSONObject(); JSONArray array = new JSONArray(); item.put("*","*"); item.put("private","private, no-cache, no-store, must-revalidate"); item.put("keep-alive","keep-alive"); item.put("json","application/json; charset=utf-8"); item.put("26Jul1997","Mon, 26 Jul 1997 05:00:00 GMT"); item.put("no-cache","no-cache"); item.put("no-referrer","no-referrer"); item.put("Apache","Apache"); item.put("max-age","max-age=31536000; includeSubDomains; preload"); item.put("chunked","chunked"); item.put("Accept-Encoding","Accept-Encoding"); item.put("accepted-chat","chat:write:user"); item.put("cloudfront","Miss from cloudfront"); item.put("nosniff","nosniff"); item.put("chat","identify,channels:write,chat:write:user"); item.put("h","h"); item.put("1","1"); item.put("0","0"); item.put("p","p"); item.put("not-exist","not-exist"); array.add(item); return item; } public static JSONObject getOwlClassLabelsJsonArrayGoogleTasks(){ JSONObject item = new JSONObject(); JSONArray array = new JSONArray(); item.put("none","none"); item.put("quic","quic=:443; ma=2592000; v=44,43,39,35"); item.put("no-cache-must-revalidate","no-cache, no-store, max-age=0, must-revalidate"); item.put("json","application/json; charset=UTF-8"); item.put("no-cache","no-cache"); item.put("GSE","GSE"); item.put("chunked","chunked"); item.put("origin","Origin,Accept-Encoding"); item.put("nosniff","nosniff"); item.put("SAMEORIGIN","SAMEORIGIN"); item.put("block","1; mode=block"); item.put("not-exist","not-exist"); item.put("taskList","tasks#taskList"); item.put("must-revalidate","private, max-age=0, must-revalidate, no-transform"); item.put("X-Origin","X-Origin"); item.put("private","private, max-age=0"); item.put("404","404"); item.put("global","global"); item.put("NotFound","NotFound"); item.put("notFound","notFound"); item.put("503","503"); item.put("BackendError","BackendError"); item.put("backendError","backendError"); array.add(item); return item; } public static JSONObject getOwlClassLabelsJsonArrayTwitter(){ JSONObject item = new JSONObject(); JSONArray array = new JSONArray(); item.put("no-cache","no-cache, no-store, must-revalidate, pre-check=0, post-check=0"); item.put("attachment-json","attachment; filename=json.json"); item.put("json","application/json;charset=utf-8"); item.put("Tue31Mar1981","Tue, 31 Mar 1981 05:00:00 GMT"); item.put("tsa-l","tsa_l"); item.put("200OK","200 OK"); item.put("max-age","max-age=631138519"); item.put("nosniff","nosniff"); item.put("SAMEORIGIN","SAMEORIGIN"); item.put("not-exist","not-exist"); item.put("BouncerCompliant","BouncerCompliant"); item.put("mode-block","1; mode=block; report=https://twitter.com/i/xss_report"); item.put("null","null"); item.put("empty-list","[]"); item.put("0","0"); item.put("false","false"); item.put("WedMar0709","Wed Mar 07 09:41:33 +0000 2012"); item.put("64","64"); item.put("185","185"); item.put("249","249"); item.put("true","true"); item.put("517417816","517417816"); item.put("en","en"); item.put("3","3"); item.put("Kurunegala","Kurunegala"); item.put("ThiliniBhagya","ThiliniBhagya"); item.put("1A1B1F","1A1B1F"); item.put("http-abc.twimg.com","http://abs.twimg.com/images/themes/theme9/bg.gif"); item.put("https-abc.twimg.com","https://abs.twimg.com/images/themes/theme9/bg.gif"); item.put("http-pbs.twimg.com-profile-images","http://pbs.twimg.com/profile_images/950100192048562176/LKr7Ay21_normal.jpg"); item.put("https-pbs.twimg.com-profile-images","https://pbs.twimg.com/profile_images/950100192048562176/LKr7Ay21_normal.jpg"); item.put("https-pbs.twimg.com","https://pbs.twimg.com"); item.put("https-pbs.twimg.com-profile-banners","https://pbs.twimg.com/profile_banners/517417816/1399047954"); item.put("3E4547","3E4547"); item.put("FFFFFF","FFFFFF"); item.put("252429","252429"); item.put("666666","666666"); item.put("bhagyasl","bhagyasl"); item.put("none","none"); item.put("http-t.co","http://t.co/sQduiwqJiy"); item.put("900","900"); item.put("404NotFound","404 Not Found"); item.put("144","144"); item.put("no-status-found","No status found with that ID."); item.put("184","184"); item.put("187","187"); item.put("1","1"); array.add(item); return item; } public static JSONObject getOwlClassLabelsJsonArrayGHTraffic(){ JSONObject item = new JSONObject(); JSONArray array = new JSONArray(); item.put("allow-origin-all","*"); item.put("oauth","ETag, X-OAuth-Scopes, X-Accepted-OAuth-Scopes"); item.put("not-exist","not-exist"); item.put("json","application/json; charset=utf-8"); item.put("GitHub.com","GitHub.com"); item.put("repo","repo"); item.put("v3-json","github.v3; format=json"); item.put("accepted-public-repo","public_repo, repo"); item.put("public-repo","public_repo"); item.put("v3","https://developer.github.com/v3"); item.put("not-found","Not Found"); item.put("create-an-issue","https://developer.github.com/v3/issues/#create-an-issue"); item.put("problems-passing-json","Problems parsing JSON"); item.put("max-age","private, max-age=60"); item.put("accept","Accept, Authorization, Cookie"); item.put("false","false"); item.put("avatar-v3","https://avatars.githubusercontent.com/u/101568?v=3"); item.put("events-privacy","https://api.github.com/users/cgdecker/events{/privacy}"); item.put("followers-cgdecker","https://api.github.com/users/cgdecker/followers"); item.put("following-cgdecker","https://api.github.com/users/cgdecker/following{/other_user}"); item.put("gists-cgdecker","https://api.github.com/users/cgdecker/gists{/gist_id}"); item.put("html-cgdecker","https://github.com/cgdecker"); item.put("101568","101568"); item.put("organizations-cgdecker","https://api.github.com/users/cgdecker/orgs"); item.put("events-cgdecker","https://api.github.com/users/cgdecker/received_events"); item.put("repos-cgdecker","https://api.github.com/users/cgdecker/repos"); item.put("starred-cgdecker","https://api.github.com/users/cgdecker/starred{/owner}{/repo}"); item.put("subscriptions-cgdecker","https://api.github.com/users/cgdecker/subscriptions"); item.put("User","User"); item.put("creator-cgdecker","https://api.github.com/users/cgdecker"); item.put("cgdecker","cgdecker"); item.put("null","null"); item.put("0","0"); item.put("closed","closed"); item.put("open","open"); item.put("lock-an-issue","https://developer.github.com/v3/issues/#lock-an-issue"); item.put("requires-authentication","Requires authentication"); item.put("edit-an-issue","https://developer.github.com/v3/issues/#edit-an-issue"); item.put("internal-server-error","Internal Server Error"); item.put("1","1"); item.put("unlock-an-issue","https://developer.github.com/v3/issues/#unlock-an-issue"); item.put("invalid-request","Invalid request"); item.put("avatar-v2","https://avatars.githubusercontent.com/u/101568?v=2"); item.put("2","2"); item.put("avatar-7139661","https://avatars.githubusercontent.com/u/7139661?v=3"); item.put("events-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/events{/privacy}"); item.put("followers-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/followers"); item.put("following-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/following{/other_user}"); item.put("gists-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/gists{/gist_id}"); item.put("html-rgabbard-bbn","https://github.com/rgabbard-bbn"); item.put("7139661","7139661"); item.put("organizations-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/orgs"); item.put("received-events-cpovirk-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/received_events"); item.put("repos-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/repos"); item.put("starred-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/starred{/owner}{/repo}"); item.put("subscriptions-rgabbard-bbn","https://api.github.com/users/rgabbard-bbn/subscriptions"); item.put("rgabbard-bbn","https://api.github.com/users/rgabbard-bbn"); item.put("avatar-1703908","https://avatars.githubusercontent.com/u/1703908?v=3"); item.put("events-cpovirk","https://api.github.com/users/cpovirk/events{/privacy}"); item.put("followers-cpovirk","https://api.github.com/users/cpovirk/followers"); item.put("gists-cpovirk","https://api.github.com/users/cpovirk/gists{/gist_id}"); item.put("html-cpovirk","https://github.com/cpovirk"); item.put("1703908","1703908"); item.put("ThiliniBhagya","ThiliniBhagya"); item.put("organizations-cpovirk","https://api.github.com/users/cpovirk/orgs"); item.put("received-events-cpovirk","https://api.github.com/users/cpovirk/received_events"); item.put("repos-cpovirk","https://api.github.com/users/cpovirk/repos"); item.put("starred-cpovirk","https://api.github.com/users/cpovirk/starred{/owner}{/repo}"); item.put("subscriptions-cpovirk","https://api.github.com/users/cpovirk/subscriptions"); item.put("cpovirk","https://api.github.com/users/cpovirk"); item.put("avatar-544569","https://avatars.githubusercontent.com/u/544569?v=3"); item.put("events-lowasser","https://api.github.com/users/lowasser/events{/privacy}"); item.put("followers-lowasser","https://api.github.com/users/lowasser/followers"); item.put("following-lowasser","https://api.github.com/users/lowasser/following{/other_user}"); item.put("gists-lowasser","https://api.github.com/users/lowasser/gists{/gist_id}"); item.put("html-lowasser","https://github.com/lowasser"); item.put("544569","544569"); item.put("organizations-lowasser","https://api.github.com/users/lowasser/orgs"); item.put("received-events-cpovirk-lowasser","https://api.github.com/users/lowasser/received_events"); item.put("repos-lowasser","https://api.github.com/users/lowasser/repos"); item.put("starred-lowasser","https://api.github.com/users/lowasser/starred{/owner}{/repo}"); item.put("subscriptions-lowasser","https://api.github.com/users/lowasser/subscriptions"); item.put("lowasser","https://api.github.com/users/lowasser"); array.add(item); return item; } }
[ "t.bhagyasl@gmail.com" ]
t.bhagyasl@gmail.com
cec45fda7a978b3d3a6c8ffbeb9168ab9cc767ad
0fdeaea9f8d0cfd48e30c25e2d515fab7ad22be2
/bus-image/src/main/java/org/aoju/bus/image/metric/Thumbnail.java
92c006930ad34137b56d070959c18aabeab29694
[ "MIT" ]
permissive
usbwc/bus
7315d6a035631c7debf2247900fca415346b2b07
30c91fb8be0820b430bebcb816c045d013fc162f
refs/heads/master
2023-04-04T21:26:20.176586
2021-03-25T07:10:44
2021-03-25T07:10:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,351
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2021 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * * * ********************************************************************************/ package org.aoju.bus.image.metric; import java.io.File; /** * @author Kimi Liu * @version 6.2.2 * @since JDK 1.8+ */ public interface Thumbnail { void registerListeners(); File getThumbnailPath(); void dispose(); void removeMouseAndKeyListener(); }
[ "839536@qq.com" ]
839536@qq.com
378e522c7c75dd3bae7f253e6e024c5f8c322824
f7b21bafc1a5da010b47a769e0d4644f1533f515
/app/src/main/java/com/cocos/cocosapp/presentation/main/home/SubCategoryAdapter.java
e50a189c828d3564c34c3d216f0e7f4eddd5ee1e
[]
no_license
CocosApp/cocos-android
b058606e4a35da32d38c568cdd0fbfdebc7a98d6
f261feb72d9c83d380c870bab9b2e610d85e8daa
refs/heads/master
2020-03-18T07:09:02.667529
2018-09-17T06:06:58
2018-09-17T06:06:58
134,435,979
0
0
null
null
null
null
UTF-8
Java
false
false
3,485
java
package com.cocos.cocosapp.presentation.main.home; import android.content.Context; import android.os.Build; import android.support.annotation.RequiresApi; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; import com.cocos.cocosapp.R; import com.cocos.cocosapp.core.LoaderAdapter; import com.cocos.cocosapp.data.entities.SubCatEntity; import com.cocos.cocosapp.utils.OnClickListListener; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; /** * Created by katherine on 15/05/17. */ public class SubCategoryAdapter extends LoaderAdapter<SubCatEntity> implements OnClickListListener { private Context context; private SubCategoryItem citiesItem; public SubCategoryAdapter(ArrayList<SubCatEntity> cityEntities, Context context, SubCategoryItem categoryItem) { super(context); setItems(cityEntities); this.context = context; this.citiesItem = categoryItem; } public SubCategoryAdapter(ArrayList<SubCatEntity> cityEntities, Context context) { super(context); setItems(cityEntities); this.context = context; } public ArrayList<SubCatEntity> getItems() { return (ArrayList<SubCatEntity>) getmItems(); } @Override public long getYourItemId(int position) { return getmItems().get(position).getId(); } @Override public RecyclerView.ViewHolder getYourItemViewHolder(ViewGroup parent) { View root = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_category, parent, false); return new ViewHolder(root, this); } @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void bindYourViewHolder(RecyclerView.ViewHolder holder, int position) { SubCatEntity subCatEntity = getItems().get(position); ((ViewHolder) holder).tvName.setText(subCatEntity.getName()); if (subCatEntity.getPhoto()!=null){ Glide.with(context) .load(subCatEntity.getPhoto()) .into(((ViewHolder) holder).back); }else{ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { ((ViewHolder) holder).back.setImageDrawable(context.getDrawable(R.drawable.cocos_app_default)); }else{ ((ViewHolder) holder).back.setImageDrawable(context.getResources().getDrawable(R.drawable.cocos_app_default)); } } } @Override public void onClick(int position) { SubCatEntity subCatEntity = getItems().get(position); citiesItem.clickItem(subCatEntity); } static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { @BindView(R.id.tv_name) TextView tvName; @BindView(R.id.back) ImageView back; private OnClickListListener onClickListListener; ViewHolder(View itemView, OnClickListListener onClickListListener) { super(itemView); ButterKnife.bind(this, itemView); this.onClickListListener = onClickListListener; this.itemView.setOnClickListener(this); } @Override public void onClick(View v) { onClickListListener.onClick(getAdapterPosition()); } } }
[ "katherine.caillahua@gmail.com" ]
katherine.caillahua@gmail.com
2b9150c7dd3387bce0790523a8774494c2a4bc5e
6a7468295554087eb7a9e7437fcb18c05dfdbfbd
/app/src/test/java/edu/temple/wumbo/ExampleUnitTest.java
bb62fdfed49e2e10b4d0f24b605ffdee53a89e83
[]
no_license
malikvk/wumbo
24b2b605b6ba45a36beea8af4d75cb2aae1657d1
3f06aa7e09e59da45ce2a9d84bd281d4620fa691
refs/heads/master
2020-05-19T09:42:26.611348
2019-05-04T23:48:13
2019-05-04T23:48:13
184,949,439
0
0
null
null
null
null
UTF-8
Java
false
false
377
java
package edu.temple.wumbo; 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); } }
[ "tug38802@temple.edu" ]
tug38802@temple.edu
c72ad96e9974f8f1bc6d7ca816d625853319d406
cd7c0436128b9db37f45388cd0d716f9c3b17200
/src/test/java/org/osjava/signals/Signal2ThreadDispatchBase.java
2133f40522cd615a9e88e062bd33a6e301da77bf
[ "MIT" ]
permissive
SimonRichardson/java-signals
6bd3eff0b430f37caf565179606f6cd518d15aa0
ab05c6f0d83907388a668cb85e067dee9b917968
refs/heads/master
2020-12-25T08:38:04.238307
2011-12-19T19:37:08
2011-12-19T19:37:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,743
java
package org.osjava.signals; import java.util.concurrent.Callable; import org.junit.After; import org.junit.Test; import org.osjava.signals.Signal.Signal2; import org.osjava.signals.SignalListener.SignalListener2; public class Signal2ThreadDispatchBase extends SignalThreadBase { protected Signal2<Integer, Integer> signal; @After public void tearDown() { signal.removeAll(); } @Test public void test_adding_two_listeners_in_two_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(2); } @Test public void test_adding_three_listeners_in_three_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(3); } @Test public void test_adding_four_listeners_in_four_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(4); } @Test public void test_adding_eight_listeners_in_eight_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(8); } @Test public void test_adding_thirty_two_listeners_in_thirty_two_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(32); } @Test public void test_adding_once_two_listeners_in_two_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(2, true); } @Test public void test_adding_once_three_listeners_in_three_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(3, true); } @Test public void test_adding_once_four_listeners_in_four_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(4, true); } @Test public void test_adding_once_eight_listeners_in_eight_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(8, true); } @Test public void test_adding_once_thirty_two_listeners_in_thirty_two_threads_and_dispatching() throws Throwable { testDispatchWithMultipleThreads(32, true); } private void testDispatchWithMultipleThreads(final int threadCount) throws Throwable { testDispatchWithMultipleThreads(threadCount, false); } private void testDispatchWithMultipleThreads(final int threadCount, final boolean isOnce) throws Throwable { Callable<Integer> task = new Callable<Integer>() { public Integer call() throws Exception { final SignalListener2<Integer, Integer> listener = new SignalListener2<Integer, Integer>() { @Override public void apply(Integer value0, Integer value1) { incrementer.addAndGet(value0); incrementer.addAndGet(value1); } }; if (isOnce) { signal.addOnce(listener); } else { signal.add(listener); } return incrementer.get(); } }; testDispatchWithMultipleThreads(signal, task, threadCount); } }
[ "stickupkid@gmail.comm" ]
stickupkid@gmail.comm
9e237d529cdf4d37df245305bddbf52d7ade8dc4
57067de1347b64aae39007e803f2f4899f71a0a9
/src/main/java/net/minecraft/inventory/ContainerBeacon.java
3cd06904039c5314fb06881f953c21a7857f3b56
[ "MIT" ]
permissive
Akarin-project/Paper2Srg
4ae05ffeab86195c93406067ea06414cb240aad6
55798e89ed822e8d59dc55dfc6aa70cef1e47751
refs/heads/master
2020-03-20T21:57:05.620082
2018-06-23T10:17:43
2018-06-23T10:17:43
137,770,306
4
4
null
2018-06-21T14:51:05
2018-06-18T15:29:10
Java
UTF-8
Java
false
false
5,004
java
package net.minecraft.inventory; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityBeacon; import org.bukkit.craftbukkit.inventory.CraftInventoryView; public class ContainerBeacon extends Container { private final IInventory field_82866_e; private final ContainerBeacon.BeaconSlot field_82864_f; // CraftBukkit start private CraftInventoryView bukkitEntity = null; private InventoryPlayer player; // CraftBukkit end public ContainerBeacon(IInventory iinventory, IInventory iinventory1) { player = (InventoryPlayer) iinventory; // CraftBukkit - TODO: check this this.field_82866_e = iinventory1; this.field_82864_f = new ContainerBeacon.BeaconSlot(iinventory1, 0, 136, 110); this.func_75146_a((Slot) this.field_82864_f); boolean flag = true; boolean flag1 = true; int i; for (i = 0; i < 3; ++i) { for (int j = 0; j < 9; ++j) { this.func_75146_a(new Slot(iinventory, j + i * 9 + 9, 36 + j * 18, 137 + i * 18)); } } for (i = 0; i < 9; ++i) { this.func_75146_a(new Slot(iinventory, i, 36 + i * 18, 195)); } } public void func_75132_a(IContainerListener icrafting) { super.func_75132_a(icrafting); icrafting.func_175173_a(this, this.field_82866_e); } public IInventory func_180611_e() { return this.field_82866_e; } public void func_75134_a(EntityPlayer entityhuman) { super.func_75134_a(entityhuman); if (!entityhuman.field_70170_p.field_72995_K) { ItemStack itemstack = this.field_82864_f.func_75209_a(this.field_82864_f.func_75219_a()); if (!itemstack.func_190926_b()) { entityhuman.func_71019_a(itemstack, false); } } } public boolean func_75145_c(EntityPlayer entityhuman) { if (!this.checkReachable) return true; // CraftBukkit return this.field_82866_e.func_70300_a(entityhuman); } public ItemStack func_82846_b(EntityPlayer entityhuman, int i) { ItemStack itemstack = ItemStack.field_190927_a; Slot slot = (Slot) this.field_75151_b.get(i); if (slot != null && slot.func_75216_d()) { ItemStack itemstack1 = slot.func_75211_c(); itemstack = itemstack1.func_77946_l(); if (i == 0) { if (!this.func_75135_a(itemstack1, 1, 37, true)) { return ItemStack.field_190927_a; } slot.func_75220_a(itemstack1, itemstack); } else if (!this.field_82864_f.func_75216_d() && this.field_82864_f.func_75214_a(itemstack1) && itemstack1.func_190916_E() == 1) { if (!this.func_75135_a(itemstack1, 0, 1, false)) { return ItemStack.field_190927_a; } } else if (i >= 1 && i < 28) { if (!this.func_75135_a(itemstack1, 28, 37, false)) { return ItemStack.field_190927_a; } } else if (i >= 28 && i < 37) { if (!this.func_75135_a(itemstack1, 1, 28, false)) { return ItemStack.field_190927_a; } } else if (!this.func_75135_a(itemstack1, 1, 37, false)) { return ItemStack.field_190927_a; } if (itemstack1.func_190926_b()) { slot.func_75215_d(ItemStack.field_190927_a); } else { slot.func_75218_e(); } if (itemstack1.func_190916_E() == itemstack.func_190916_E()) { return ItemStack.field_190927_a; } slot.func_190901_a(entityhuman, itemstack1); } return itemstack; } class BeaconSlot extends Slot { public BeaconSlot(IInventory iinventory, int i, int j, int k) { super(iinventory, i, j, k); } public boolean func_75214_a(ItemStack itemstack) { Item item = itemstack.func_77973_b(); return item == Items.field_151166_bC || item == Items.field_151045_i || item == Items.field_151043_k || item == Items.field_151042_j; } public int func_75219_a() { return 1; } } // CraftBukkit start @Override public CraftInventoryView getBukkitView() { if (bukkitEntity != null) { return bukkitEntity; } org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon((TileEntityBeacon) this.field_82866_e); // TODO - check this bukkitEntity = new CraftInventoryView(this.player.field_70458_d.getBukkitEntity(), inventory, this); return bukkitEntity; } // CraftBukkit end }
[ "i@omc.hk" ]
i@omc.hk
faf1cf91bfe26cbfaf083f3c3f95aeb5cb3f0405
aabb2b00c0050bc717a8e9042b8d54ad21e871b9
/Algorithm/src/lintcode/Next_Permutation.java
ec81caaa0698f2cbc227cd782544b47e14fd3083
[]
no_license
littlexiaoxiao/Algorithm
7da4427bf7aeae110578077c746dcfd1a9f4b235
ff9b088558f1ba58fc48ffda404067a5d355f9eb
refs/heads/master
2016-09-06T01:10:05.260434
2015-09-22T03:11:16
2015-09-22T03:11:16
42,678,320
0
0
null
null
null
null
UTF-8
Java
false
false
938
java
package lintcode; public class Next_Permutation { public int[] nextPermutation(int[] nums) { if (nums == null || nums.length <= 1) { return nums; } int small = 0; int big = 0; for (int i = nums.length - 1; i > 0; i--) { if (nums[i] > nums[i - 1]) { small = i - 1; break; } } // if the array is increasing. if (small == 0 && nums[small] > nums[small + 1]) { reverse(nums, small, nums.length - 1); return nums; } for (int i = nums.length - 1; i > 0; i--) { if (nums[i] > nums[small]) { big = i; break; } } swap(nums, small, big); reverse(nums, small + 1, nums.length - 1); return nums; } private void swap(int[] nums, int index1, int index2) { int temp = nums[index1]; nums[index1] = nums[index2]; nums[index2] = temp; } private void reverse(int[] nums, int start, int end) { while (start < end) { swap(nums, start, end); start++; end--; } } }
[ "maojiewen@maojiewens-air.wv.cc.cmu.edu" ]
maojiewen@maojiewens-air.wv.cc.cmu.edu
7a8a8e4ee1fefffb35b82ff59b935f79389be634
61ed446dd3821825e10e9532305f15d469fee72f
/src/main/java/ru/reksoft/interns/carstore/entity/DictCarcass.java
4fd1fcb7e0139b091b4a10ba5ff6e59be5dd759d
[]
no_license
DLari/CarStore
0970c66f741d921eb173afd3351ab3c484166f99
c48ea8ffea5c8333e9131f820b7d4dce0c1cd704
refs/heads/master
2022-11-28T19:43:01.146340
2020-02-19T14:22:15
2020-02-19T14:22:15
229,778,847
0
0
null
2022-11-15T23:59:58
2019-12-23T15:33:32
Java
UTF-8
Java
false
false
699
java
package ru.reksoft.interns.carstore.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; /** * кузов */ @Entity @Table(name="dict_carcass") public class DictCarcass { /** * id */ @Id @Column(name = "id") private Integer id; /** * название кузова */ @Column( name = "name") private String name; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "vas555565@yandex.ru" ]
vas555565@yandex.ru
63731c42b1a2ed28469ef46ad68fe848ee2178fa
9673825eb58f5285651891452256e7950d233b07
/SeleniumAutomation/src/datadriven/excelDataSheet.java
522ca7503a6ab4c04e1e066f934eb93a5d1c7f61
[]
no_license
shubham8931/My_First_GitPush_Selenium
2a452e4e42890dc9f0cd0a79faba9880f2428e01
0f18191238d9283a72a824344dda993d4a49c1fa
refs/heads/master
2023-04-21T15:41:53.891652
2021-05-14T05:48:34
2021-05-14T05:48:34
366,598,265
0
0
null
null
null
null
UTF-8
Java
false
false
1,360
java
package datadriven; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.apache.poi.EncryptedDocumentException; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.WorkbookFactory; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class excelDataSheet { public static void main(String[] args) throws EncryptedDocumentException, IOException, InterruptedException { WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); FileInputStream f =new FileInputStream("./excelDataSheet.xlsx"); Workbook wb = WorkbookFactory.create(f); String url = wb.getSheet("Sheet1").getRow(1).getCell(0).getStringCellValue(); driver.get(url); driver.manage().timeouts().implicitlyWait(20,TimeUnit.SECONDS); String username = wb.getSheet("Sheet1").getRow(1).getCell(1).getStringCellValue(); driver.findElement(By.id("username")).sendKeys(username); String password = wb.getSheet("Sheet1").getRow(1).getCell(2).getStringCellValue(); driver.findElement(By.name("pwd")).sendKeys(password); driver.findElement(By.id("loginButton")).click(); Thread.sleep(4000); driver.close(); } }
[ "shreeram@PAVANPUTRA.mshome.net" ]
shreeram@PAVANPUTRA.mshome.net
bde7c119a0f29c4535d324134302216e90754659
91509739d6d388140d372a1467edf5240bcb0081
/app/src/test/java/com/dilla/myshoes/ExampleUnitTest.java
dffc643b7c1803e166628f08fd0df494b136c475
[]
no_license
adillakusumadewi/MyShoesMasterAndroid
c913a18cef0463635eb25e95b7175549758e71ea
e439e77a854b1082a8ee56010d5dacf11d375e59
refs/heads/master
2023-06-06T06:03:47.977927
2021-06-29T05:11:43
2021-06-29T05:11:43
381,246,155
0
0
null
null
null
null
UTF-8
Java
false
false
378
java
package com.dilla.myshoes; 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); } }
[ "kusumaadilla@gmail.com" ]
kusumaadilla@gmail.com
f8f4a4e19e0a57105cb37d327caa7373634fbc9c
c802aaf4730f4eefd74b273435379a496a18ab9d
/src/test/java/com/tpg/smp/persistence/entities/PersonEntities.java
74756dabd2b2cbc292a1531b429380fc70edad78
[]
no_license
tpgoldie/smp
2984074493aa6b69821ecc095dd73a59ae790ef4
fd42a1e555b0a6969bbb25aad1428c485f678dc0
refs/heads/master
2021-01-13T05:31:02.439836
2017-02-04T17:39:52
2017-02-04T17:39:52
80,115,970
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
package com.tpg.smp.persistence.entities; import java.util.Optional; public abstract class PersonEntities<T extends PersonEntity> extends SmpEntities<T> { T findByUserId(String id) { Optional<T> found = entities.stream().filter(e -> e.getIdentificationNumber().equalsIgnoreCase(id)).findAny(); if (found.isPresent()) { return found.get(); } throw new RuntimeException(String.format("Entity %s not found", id)); } }
[ "tpg@blueyonder.co.uk" ]
tpg@blueyonder.co.uk
56e8a7f271e8aa3a4b4dfa4707e0e5c488de60ec
7ceafb397501c016c1c434a9b8bec9bb9f8abd08
/speech-to-text/src/main/java/com/ibm/watson/speech_to_text/v1/model/DeleteAudioOptions.java
ecdac701c2a5bfecffa81569829cc997478552ef
[ "Apache-2.0" ]
permissive
kanazawaLri/java-sdk
0cdf1faa1b417a4da2ba56fd635f52bcc2ce8ad9
31e119269fbd8cc8c813f61913f11be1e0835edb
refs/heads/master
2020-07-18T10:37:10.387401
2019-10-07T03:27:19
2019-10-07T03:27:19
206,228,148
0
0
Apache-2.0
2019-09-04T04:03:17
2019-09-04T04:03:17
null
UTF-8
Java
false
false
3,335
java
/* * Copyright 2018 IBM Corp. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package com.ibm.watson.speech_to_text.v1.model; import com.ibm.cloud.sdk.core.service.model.GenericModel; import com.ibm.cloud.sdk.core.util.Validator; /** * The deleteAudio options. */ public class DeleteAudioOptions extends GenericModel { private String customizationId; private String audioName; /** * Builder. */ public static class Builder { private String customizationId; private String audioName; private Builder(DeleteAudioOptions deleteAudioOptions) { this.customizationId = deleteAudioOptions.customizationId; this.audioName = deleteAudioOptions.audioName; } /** * Instantiates a new builder. */ public Builder() { } /** * Instantiates a new builder with required properties. * * @param customizationId the customizationId * @param audioName the audioName */ public Builder(String customizationId, String audioName) { this.customizationId = customizationId; this.audioName = audioName; } /** * Builds a DeleteAudioOptions. * * @return the deleteAudioOptions */ public DeleteAudioOptions build() { return new DeleteAudioOptions(this); } /** * Set the customizationId. * * @param customizationId the customizationId * @return the DeleteAudioOptions builder */ public Builder customizationId(String customizationId) { this.customizationId = customizationId; return this; } /** * Set the audioName. * * @param audioName the audioName * @return the DeleteAudioOptions builder */ public Builder audioName(String audioName) { this.audioName = audioName; return this; } } private DeleteAudioOptions(Builder builder) { Validator.notEmpty(builder.customizationId, "customizationId cannot be empty"); Validator.notEmpty(builder.audioName, "audioName cannot be empty"); customizationId = builder.customizationId; audioName = builder.audioName; } /** * New builder. * * @return a DeleteAudioOptions builder */ public Builder newBuilder() { return new Builder(this); } /** * Gets the customizationId. * * The customization ID (GUID) of the custom acoustic model that is to be used for the request. You must make the * request with credentials for the instance of the service that owns the custom model. * * @return the customizationId */ public String customizationId() { return customizationId; } /** * Gets the audioName. * * The name of the audio resource for the custom acoustic model. * * @return the audioName */ public String audioName() { return audioName; } }
[ "loganpatino10@gmail.com" ]
loganpatino10@gmail.com
773e831677eff6a75ae0aa304e778e1e946f26ba
64369d2905fd0a29dfb02d82031fac2b49bccb4f
/app/src/androidTest/java/com/example/paras/firstfirebaseapplication/ExampleInstrumentedTest.java
07000c2cb249354e79381c183c6947ff6c117d6e
[]
no_license
ParryApplications/Basic-FireBase-Application
db8164089d36c40b48840d18353a26f55cc22552
4197e08b4b69e02c5d17f7a86c267ea760cc6dd6
refs/heads/master
2022-04-10T20:19:17.103206
2020-03-21T16:07:57
2020-03-21T16:07:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package com.example.paras.firstfirebaseapplication; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.example.paras.firstfirebaseapplication", appContext.getPackageName()); } }
[ "krishnabhatt104@gmail.com" ]
krishnabhatt104@gmail.com
4d1486679f071c56df8948b99425777c3a9b453c
c99ca8b3a917b790e59a0ddd5a5cdd600ed0e10d
/app/src/main/java/com/bameng/utils/WindowUtils.java
17f05e75b332641e365d03fec0f04e58daeceee6
[]
no_license
huotuinc/Android_bameng
331284e4987a1fc4618318911419319d19d178a9
7d169cf0faedb2430b8ed7583badac9f16a3b986
refs/heads/master
2021-01-13T07:39:08.901986
2017-08-18T02:04:55
2017-08-18T02:04:55
71,429,474
0
3
null
null
null
null
UTF-8
Java
false
false
348
java
package com.bameng.utils; import android.app.Activity; import android.view.WindowManager; public class WindowUtils { public static void backgroundAlpha(Activity aty, float alpha) { WindowManager.LayoutParams lp = aty.getWindow ().getAttributes (); lp.alpha = alpha; aty.getWindow ().setAttributes ( lp ); } }
[ "flsysys@163.com" ]
flsysys@163.com
756858e96b95c196b191c0ae1179b0fa57776fb4
063f3b313356c366f7c12dd73eb988a73130f9c9
/erp_ejb/src_facturacion/com/bydan/erp/facturacion/business/dataaccess/TipoDetaNotaCreditoDataAccessAdditional.java
8f636791962b84055e27f2c7c4b6807de2122061
[ "Apache-2.0" ]
permissive
bydan/pre
0c6cdfe987b964e6744ae546360785e44508045f
54674f4dcffcac5dbf458cdf57a4c69fde5c55ff
refs/heads/master
2020-12-25T14:58:12.316759
2016-09-01T03:29:06
2016-09-01T03:29:06
67,094,354
0
0
null
null
null
null
UTF-8
Java
false
false
1,685
java
/* * ============================================================================ * GNU Lesser General Public License * ============================================================================ * * BYDAN - Free Java BYDAN library. * Copyright (C) 2008 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * BYDAN Corporation */ package com.bydan.erp.facturacion.business.dataaccess; import java.util.List; import java.util.ArrayList; import java.util.Set; import java.util.HashSet; import java.util.ArrayList; import java.io.Serializable; import java.util.Date; import com.bydan.framework.erp.business.entity.DatoGeneral; import com.bydan.framework.erp.business.dataaccess.*;//DataAccessHelper; import com.bydan.erp.facturacion.business.entity.*; @SuppressWarnings("unused") public class TipoDetaNotaCreditoDataAccessAdditional extends DataAccessHelper<TipoDetaNotaCredito> { public TipoDetaNotaCreditoDataAccessAdditional () { } }
[ "byrondanilo10@hotmail.com" ]
byrondanilo10@hotmail.com
5e5c21778ea808491378b36cfe82187601078a63
c72e953e7b3cf473627f59c5fdae22b56fdb06ed
/Algorithm-Study/src/Day02/Ex11_indexSearch.java
6827f4ca3f9ed6e13c7249622c39627dca4f180b
[]
no_license
dev-mong/Algorithm
5d490c8db4f6926d56895581e38aec2dd6507c6c
1d6f4c89dc5d2291ca66c3959a80effb15d2156f
refs/heads/master
2023-07-09T20:58:18.442836
2021-08-05T07:07:33
2021-08-05T07:07:33
263,282,510
0
0
null
null
null
null
UTF-8
Java
false
false
1,168
java
package Day02; import java.util.ArrayList; import java.util.Scanner; //인덱스 검색 //n 길이 배열 a //key와 일치하는 모든 요소의 인덱스를 배열 idx의 맨 앞 부터 순서대로 저장 public class Ex11_indexSearch { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("배열의 길이 : "); int n = sc.nextInt(); int[] arr = new int[n]; int[] idx = null; for(int i=0;i<arr.length;i++) { System.out.println(i+"번쨰 값을 입력하세요"); arr[i] = sc.nextInt(); } System.out.println("\nKey 값을 입력하세요."); int key = sc.nextInt(); int result = serchIdx(arr, n, key, idx); System.out.println("Key 값과 일치하는 값의 개수 : "+result); } static int serchIdx(int[] a,int n,int key, int[] idx) { ArrayList<Integer> list=new ArrayList<Integer>(); int result = 0; for(int j=0;j<a.length;j++) { if(a[j] == key) { list.add(j); } } idx = new int[list.size()]; for(int k=0;k<idx.length;k++) { idx[k] = list.get(k); } result = idx.length; return result; } }
[ "qkrwlsaud0118@gmail.com" ]
qkrwlsaud0118@gmail.com
4b7f787c9e4f05f05b7497f7fe340f9920e217a2
9260e329cb9520de217abc88197c7e867fa3b772
/app/src/main/java/cn/redcdn/hvs/contacts/contact/ContactPagerGridViewAdapterList.java
c801b39b4060762a02d69f0471a16a1c967f8aff
[]
no_license
cdc0002829/YiLianTiButelMedical
2c27672ee01bb5fbb4563bb6be3dc18bb42c805e
46901c4c7427f51f7505d3649a04c6b4b9cd5008
refs/heads/master
2021-09-04T12:30:52.341094
2018-01-18T16:18:52
2018-01-18T16:18:52
117,952,582
1
0
null
null
null
null
UTF-8
Java
false
false
3,356
java
package cn.redcdn.hvs.contacts.contact; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import cn.redcdn.hvs.MedicalApplication; import cn.redcdn.hvs.R; import cn.redcdn.hvs.contacts.contact.diaplayImageListener.DisplayImageListener; import cn.redcdn.hvs.contacts.contact.interfaces.Contact; import cn.redcdn.hvs.contacts.contact.manager.ContactManager; import cn.redcdn.log.CustomLog; import com.nostra13.universalimageloader.core.ImageLoader; import java.util.List; /*** * * @author LB 通讯录界面GridViewAdapter * */ public class ContactPagerGridViewAdapterList extends ContactPagerGridViewAdapterBase { private final String TAG = ContactPagerAdapterList.class.getSimpleName(); private Context mContext; private DisplayImageListener mDisplayImageListener = null; public ContactPagerGridViewAdapterList(Context context, int currentPage, List<Contact> contacts, int pageCapacity) { super(context, currentPage, contacts, pageCapacity); this.mContext = context; mDisplayImageListener = new DisplayImageListener(); } @Override public int getCount() { if (contacts.size() < pageCapacity) { return contacts.size() ; } if (pageCapacity * (currentPage + 1) <= (contacts.size() )) { return pageCapacity; } else { return contacts.size() - pageCapacity * (currentPage); } } @Override public View getView(int position, View convertView, ViewGroup parent) { final int currentIndex = currentPage * pageCapacity + position; ContactHolder holder = null; if (convertView == null) { convertView = inflater.inflate(R.layout.layout_contact_viewpager_item, null); holder = new ContactHolder(); holder.rightTop = (ImageView) convertView .findViewById(R.id.contact_viewpager_iamgehead); holder.rightTop.setVisibility(View.VISIBLE); holder.rightTop.bringToFront(); CustomLog.d(TAG, "viewHolder.headImage="+holder.rightTop); convertView.setTag(holder); } else { holder = (ContactHolder) convertView.getTag(); } // if(currentIndex==contacts.size()-1){ // holder.rightTop.setImageResource(R.drawable.contact_customservice); // }else{ ImageLoader imageLoader = ImageLoader.getInstance(); imageLoader.displayImage(contacts.get(currentIndex).getPicUrl(), holder.rightTop, MedicalApplication.shareInstance().options, mDisplayImageListener); // } if(contacts.get(currentIndex).getNubeNumber()!=null){ if(contacts.get(currentIndex).getNubeNumber().equals(ContactManager.getInstance(mContext).customerServiceNum1) ||contacts.get(currentIndex).getNubeNumber().equals(ContactManager.getInstance(mContext).customerServiceNum2)){ holder.rightTop.setImageResource(R.drawable.contact_customservice); }else if(contacts.get(currentIndex).getNubeNumber().equals(ContactManager.getInstance(mContext).customerServiceNum1) ||contacts.get(currentIndex).getNubeNumber().equals(ContactManager.getInstance(mContext).customerServiceNum2)){ holder.rightTop.setImageResource(R.drawable.contact_customservice); } } return convertView; } }
[ "cdc0002829@126.com" ]
cdc0002829@126.com
b5452da84ce0cd843f0887345af65a77e41a99cc
606665facbdd4b8c0be7bfc713856a15ac618a74
/chapter05/src/ch03/Plastic.java
cc882be546ca56cd1c4aea2f921b2688e5b62c88
[]
no_license
sooyoung92/gittest1
1271bebd20018d80603f7791a426368d20b89fc4
12f407af2f796dabe9edc7bfbb74fb83c8628a93
refs/heads/main
2023-09-05T23:18:05.912716
2021-11-12T08:58:42
2021-11-12T08:58:42
426,128,361
0
0
null
null
null
null
UHC
Java
false
false
253
java
package ch03; public class Plastic extends Material{ @Override public String toString() { return "재료는 plastic 입니다"; } @Override public void doPrinting() { System.out.println("플라스틱 재료로 출력 합니다."); } }
[ "plz9chance@gmail.com" ]
plz9chance@gmail.com
6f7c4c34f733f2bdd5ef61890cbe872750317f37
1e3f5e20da81e7b38b026cce5c718592b5c34274
/Graph/DepthFirstPaths.java
f073118653127752510ba69c77a37af5dd6f9de4
[]
no_license
liumcse/EE2008_Implementation
1b3987a5ffea27bd0afaecf5bd2271467ef0fbef
c817f7e81db1413dd1740ee6065bc0c30778869d
refs/heads/master
2021-09-20T01:09:46.128443
2018-08-02T03:24:31
2018-08-02T03:24:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,604
java
import edu.princeton.cs.algs4.Stack; /** * Created by LiuMingyu on 7/3/17. */ // dfs(node current) { // mark current as visited; // visit all of current's unvisited neighbors by calling dfs(neighbor) // } // public class DepthFirstPaths { private boolean[] marked; private int[] edgeTo; private final int s; public DepthFirstPaths(Graph G, int s) { marked = new boolean[G.V()]; edgeTo = new int[G.V()]; this.s = s; dfs(G, s); } private void dfs(Graph G, int v) { marked[v] = true; for (int w: G.adj(v)) { if (!marked[w]) { edgeTo[w] = v; dfs(G, w); // search the adjacenct vertices recursively } } } public boolean hasPathTo(int v) { return marked[v]; } public Iterable<Integer> pathTo(int v) { if (!hasPathTo(v)) return null; Stack<Integer> path = new Stack<Integer>(); for (int x = v; x != s; x = edgeTo[x]) { path.push(x); } path.push(s); return path; } public static void main(String[] args) { // Create a graph with 6 vertices: Graph a = new Graph(6); // Add 8 edges a.addEdge(0, 2); a.addEdge(0, 1); a.addEdge(0, 5); a.addEdge(1, 2); a.addEdge(2, 3); a.addEdge(2, 4); a.addEdge(3, 4); a.addEdge(3, 5); DepthFirstPaths test = new DepthFirstPaths(a, 0); for (int element : test.pathTo(4)) { System.out.println(element); } } }
[ "lyming90@gmail.com" ]
lyming90@gmail.com
733859a2fec24abe94ea4b659213b68713d5ed54
6aa3e57d2fb6d109ef7766aec5be8cf059c01099
/src/com/company/Main.java
d0bedc38f1a0ca4913e99e944e9939bdeca105b6
[]
no_license
DanyaRubin/deq
349d51ed3a8271a577819b7fddc1a4500bc2f387
71f69b539832e3c87d2fa2fd71d08276a2625a5f
refs/heads/master
2023-08-29T19:31:55.104836
2021-11-17T08:05:13
2021-11-17T08:05:13
428,958,307
0
0
null
null
null
null
UTF-8
Java
false
false
659
java
package com.company; import java.util.ArrayDeque; import java.util.Deque; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); StringBuilder sb = new StringBuilder(); Deque<Integer> deque = new ArrayDeque<>(); int i = 0; while(sc.hasNext()) { if (i%2 != 0) { deque.addFirst(sc.nextInt()); sb.insert(0,((deque.getFirst()) + " ")); }else{ sc.nextInt(); } i++; } sb.setLength(sb.length() - 1); System.out.print(sb); } }
[ "masterovski@gmail.com" ]
masterovski@gmail.com
c8612a10ed27fd7e7a3b43de003075f771ff2150
655579bb2b01e03d4c49d59035e11b90d4bb876b
/src/test/java/answer/king/controller/OrderControllerTest.java
492919935b81462afb2dbb9a73f599ba5a59059d
[]
no_license
dmnian/answer-king
aa23b0840c831524e70f90945459972e87249586
5a01956356d7ab2661a9a95ec15a90e3d21d430d
refs/heads/master
2021-09-01T04:38:35.953788
2017-12-24T16:09:17
2017-12-24T16:09:17
115,288,374
1
0
null
null
null
null
UTF-8
Java
false
false
2,869
java
package answer.king.controller; import answer.king.model.Order; import answer.king.model.Receipt; import answer.king.service.OrderService; import com.fasterxml.jackson.databind.ObjectMapper; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import java.math.BigDecimal; import java.util.ArrayList; import static org.hamcrest.CoreMatchers.is; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; @RunWith(SpringRunner.class) @WebMvcTest(OrderController.class) public class OrderControllerTest { @Autowired private MockMvc mockMvc; @MockBean private OrderService orderServiceMock; @Autowired private ObjectMapper objectMapper; @Test public void createTest() throws Exception { Order order = new Order(); order.setId(1L); given(orderServiceMock.save(any(Order.class))).willReturn(order); this.mockMvc.perform(post("/order")) .andExpect(status().isOk()) .andExpect(jsonPath("$.id", is(1))); } @Test public void addItemTest() throws Exception { this.mockMvc.perform(put("/order/1/addItem/1/quantity/1")) .andExpect(status().isOk()); verify(orderServiceMock, times(1)).addItem(1L, 1L, 1); } @Test public void payTest() throws Exception { BigDecimal payment = new BigDecimal("99.99"); Receipt t = new Receipt(); Order order = new Order(); order.setLineItems(new ArrayList<>()); t.setOrder(order); t.setPayment(payment); given(orderServiceMock.pay(any(), any())).willReturn(t); String content = objectMapper.writeValueAsString(payment); this.mockMvc.perform(put("/order/1/pay") .contentType(MediaType.APPLICATION_JSON_VALUE) .content(content)) .andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payment", is(99.99))); } }
[ "dmnian@gmail.com" ]
dmnian@gmail.com
2a114b10cb10e273d8022304ba579e7f3db6d1ed
f53d8f94a51921c48056632309464db90ff24960
/src/pl/aaugustyniak/neuraltests/cases/BreastTissueMlpCase.java
39fa16e087467d9fe9177fc733ce29630370da4e
[]
no_license
artur-augustyniak/VisualCompare
2e4898927949c0af1a3a6f84ca4ef5644112667b
da7b2dc3d182183609b257771dd706c2d4fb2325
refs/heads/master
2021-07-10T21:09:32.183457
2017-10-12T13:16:50
2017-10-12T13:16:50
106,695,202
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
package pl.aaugustyniak.neuraltests.cases; import pl.aaugustyniak.neuraltests.MlpCase; import org.neuroph.core.NeuralNetwork; import org.neuroph.nnet.MultiLayerPerceptron; import org.neuroph.util.norm.MaxNormalizer; /** * Przypadek testowy * * @url http://archive.ics.uci.edu/ml/datasets/Breast+Tissue * * @author artur */ public class BreastTissueMlpCase extends MlpCase { /** * Test z podanym perceptronem eksperymentalnym * * @param ann */ public BreastTissueMlpCase(NeuralNetwork ann) { this(); this.setAnn(ann); } /** * Domyślny referencyjny perceptron MLP */ public BreastTissueMlpCase() { super("./datasets/breast_tissue/bt_preproc.csv", ",", "Breast Tissue ", 100, 0.01, new MaxNormalizer(), 9, 6); this.setAnn(new MultiLayerPerceptron(9, 6)); this.ann.setLabel("9:6[lin-sigm]"); } }
[ "artur@aaugustyniak.pl" ]
artur@aaugustyniak.pl
2fc34c4d22491cee1c496e252eb1f06170d0f874
647971d4e886c95825349c86b02dcfd543dbde99
/src/main/java/com/foursixteen/kuma/Configurable.java
93c64cda0e14f25e655ee330b20564b1ed8f3d73
[]
no_license
numbra/Kuma
7c1dc3e3e57252350f474dfae912eaa49614c7dc
03def8147105f1412a75a621c6a96b850305d9ef
refs/heads/master
2020-03-30T05:43:07.604632
2018-09-29T17:53:42
2018-09-29T17:53:42
150,815,434
0
0
null
null
null
null
UTF-8
Java
false
false
600
java
package com.foursixteen.kuma; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Properties; public class Configurable { protected Properties properties; protected FileInputStream fis; protected FileOutputStream fos; public Configurable(String path) { try { properties = new Properties(); fis = new FileInputStream(path); fos = new FileOutputStream(path); properties.load(fis); } catch (IOException e) { e.printStackTrace(); } } }
[ "penumbra420@gmail.com" ]
penumbra420@gmail.com
e290065485ae0c71b8735a8552e977e800004793
6bbdb978ca4f5af68ca67853327cc5b22a7904f5
/src/main/java/fr/eseo/dis/tristan/batucadacommander/database/entities/GroupeAndMachines.java
bba05584a9916d90f234f4c7f763722bcf622cdb
[]
no_license
Guideb/BatucalightV2-master
a4675f4baf7db2f815899c3b45375eb89e529f76
1260e2dcf8d6af65bb12383ee630f052868a13fa
refs/heads/master
2022-12-28T06:25:59.930603
2020-10-09T08:13:43
2020-10-09T08:13:43
302,577,863
0
0
null
null
null
null
UTF-8
Java
false
false
706
java
package fr.eseo.dis.tristan.batucadacommander.database.entities; import android.arch.persistence.room.Embedded; import android.arch.persistence.room.Relation; import java.util.List; /** * @author Tristan LE GACQUE * Created 12/10/2018 */ public class GroupeAndMachines { @Embedded public Groupe groupe; @Relation(parentColumn = "idGroupe", entityColumn = "refGroupe") public List<Machine> machines; /** * Get the groupe * @return The groupe */ public Groupe getGroupe() { return groupe; } /** * Get the machines in the groupe * @return The machines */ public List<Machine> getMachines() { return machines; } }
[ "guideb21@orange.fr" ]
guideb21@orange.fr
b4b1c9c803ec1cc5ca03925e8a874c311f07c534
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/17/17_b09e52164854a42eafb84722552e576efcae8c8f/AgreeEmitterUtilities/17_b09e52164854a42eafb84722552e576efcae8c8f_AgreeEmitterUtilities_s.java
81bf35661277a0d6320a75ca6b3afe8bc2997b0d
[]
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
16,325
java
package com.rockwellcollins.atc.agree.analysis; import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.Map.Entry; import jkind.lustre.BinaryExpr; import jkind.lustre.BinaryOp; import jkind.lustre.BoolExpr; import jkind.lustre.Equation; import jkind.lustre.Expr; import jkind.lustre.IdExpr; import jkind.lustre.IntExpr; import jkind.lustre.NamedType; import jkind.lustre.Node; import jkind.lustre.Type; import jkind.lustre.UnaryExpr; import jkind.lustre.UnaryOp; import jkind.lustre.VarDecl; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EObject; import org.osate.aadl2.AbstractNamedValue; import org.osate.aadl2.AnnexSubclause; import org.osate.aadl2.Classifier; import org.osate.aadl2.ComponentImplementation; import org.osate.aadl2.ComponentType; import org.osate.aadl2.ConnectedElement; import org.osate.aadl2.Connection; import org.osate.aadl2.ContainedNamedElement; import org.osate.aadl2.ContainmentPathElement; import org.osate.aadl2.Context; import org.osate.aadl2.DataSubcomponent; import org.osate.aadl2.DataType; import org.osate.aadl2.ModalPropertyValue; import org.osate.aadl2.NamedElement; import org.osate.aadl2.NamedValue; import org.osate.aadl2.Property; import org.osate.aadl2.PropertyAssociation; import org.osate.aadl2.PropertyConstant; import org.osate.aadl2.PropertyExpression; import org.osate.aadl2.Subcomponent; import org.osate.aadl2.instance.ComponentInstance; import org.osate.aadl2.instance.SystemInstance; import org.osate.aadl2.modelsupport.util.AadlUtil; import org.osate.aadl2.properties.PropertyDoesNotApplyToHolderException; import org.osate.aadl2.properties.PropertyNotPresentException; import org.osate.xtext.aadl2.properties.util.PropertyUtils; import com.rockwellcollins.atc.agree.agree.AgreeSubclause; import com.rockwellcollins.atc.agree.agree.Arg; import com.rockwellcollins.atc.agree.agree.FnCallExpr; import com.rockwellcollins.atc.agree.agree.NestedDotID; import com.rockwellcollins.atc.agree.agree.NodeEq; import com.rockwellcollins.atc.agree.agree.ThisExpr; public class AgreeEmitterUtilities { static public PropertyExpression getPropExpression(NamedElement comp, Property prop) { PropertyExpression expr; try { comp.getPropertyValue(prop); // this just checks to see if the // property is associated expr = PropertyUtils.getSimplePropertyValue(comp, prop); return expr; } catch (PropertyDoesNotApplyToHolderException propException) { return null; } catch (PropertyNotPresentException propNotPresentException) { return null; } } //TODO: i'm not sure that this function will work in more complicated cases of property inheritance public static PropertyExpression getSimplePropertyValue(final Subcomponent context,final NamedElement target, final Property pd){ if (context == null) return target.getNonModalPropertyValue(pd); EList<PropertyAssociation> props = context.getOwnedPropertyAssociations(); for (PropertyAssociation propertyAssociation : props) { if (propertyAssociation.getProperty().equals(pd)){ // we found a property with the correct type // now we need to check whether the applies to points to the holder EList<ContainedNamedElement> appliestos = propertyAssociation.getAppliesTos(); for (ContainedNamedElement containedNamedElement : appliestos) { EList<ContainmentPathElement> cpes = containedNamedElement.getContainmentPathElements(); NamedElement pathcxt = cpes.get(cpes.size()-1).getNamedElement(); if (target.equals(pathcxt)){ EList<ModalPropertyValue> vallist = propertyAssociation.getOwnedValues(); if (!vallist.isEmpty()){ ModalPropertyValue elem = vallist.get(0); PropertyExpression res = elem.getOwnedValue(); if (res instanceof NamedValue){ AbstractNamedValue nv = ((NamedValue)res).getNamedValue(); if (nv instanceof Property){ res = target.getNonModalPropertyValue((Property)nv); } else if (nv instanceof PropertyConstant){ res = ((PropertyConstant)nv).getConstantValue(); } } return res; } } } } } return null; } static public AgreeVarDecl dataTypeToVarType(DataSubcomponent sub) { DataType type = (DataType) sub.getAllClassifier(); AgreeVarDecl newStrType = new AgreeVarDecl(); newStrType.jKindStr = sub.getName(); newStrType.aadlStr = sub.getName(); do { String name = type.getQualifiedName(); switch (name) { case "Base_Types::Boolean": newStrType.type = "bool"; return newStrType; case "Base_Types::Integer": case "Base_Types::Unsigned": case "Base_Types::Unsigned_32": case "Base_Types::Unsigned_16": case "Base_Types::Unsigned_8": case "Base_Types::Integer_32": case "Base_Types::Integer_16": case "Base_Types::Integer_8": newStrType.type = "int"; return newStrType; case "Base_Types::Float": newStrType.type = "real"; return newStrType; } type = (DataType) type.getExtended(); } while (type != null); // validation should make sure that this never happens assert (false); return null; } static public String dataTypeToVarType(DataType sub) { String name = sub.getQualifiedName(); switch (name) { case "Base_Types::Boolean": return "bool"; case "Base_Types::Integer": return "int"; case "Base_Types::Float": return "real"; } return null; } public String getFnCallExprName(FnCallExpr expr) { NestedDotID dotId = expr.getFn(); NamedElement namedEl = getFinalNestId(dotId); return namedEl.getName(); } static public List<VarDecl> argsToVarDeclList(String nameTag, EList<Arg> args) { List<VarDecl> varList = new ArrayList<VarDecl>(); for (Arg arg : args) { Type type = new NamedType(arg.getType().getString()); VarDecl varDecl = new VarDecl(nameTag + arg.getName(), type); varList.add(varDecl); } return varList; } public static NamedElement getFinalNestId(NestedDotID dotId) { while (dotId.getSub() != null) { dotId = dotId.getSub(); } return dotId.getBase(); } public static ComponentImplementation getInstanceImplementation(ComponentInstance compInst){ if(compInst instanceof SystemInstance){ return ((SystemInstance)compInst).getSystemImplementation(); } try{ return (ComponentImplementation)compInst.getComponentClassifier(); }catch (ClassCastException e){ return null; } } public static ComponentType getInstanceType(ComponentInstance compInst){ if(compInst instanceof SystemInstance){ return ((SystemInstance)compInst).getSystemImplementation().getType(); } try{ return ((ComponentImplementation)compInst.getComponentClassifier()).getType(); }catch (ClassCastException e){ return (ComponentType)compInst.getComponentClassifier(); } } //warns the user if there is a cycle static public void logCycleWarning(AgreeAnnexEmitter emitter, List<Equation> eqs, boolean throwException){ Map<String, Set<String>> idGraph = new HashMap<>(); List<String> ids = new ArrayList<>(); AgreeCycleVisitor visitor = new AgreeCycleVisitor(); for(Equation eq : eqs){ for(IdExpr id : eq.lhs){ ids.add(id.id); idGraph.put(id.id, eq.expr.accept(visitor)); } } Set<String> discovered = new HashSet<>(); StringBuilder exceptionStr = new StringBuilder(); for(String id : ids){ if(discovered.contains(id)){ continue; } List<String> cycle = cycleWarning_Helper(id, id, new HashSet<String>(), idGraph); if(cycle != null){ discovered.addAll(cycle); String aadlString = emitter.varRenaming.get(id); StringBuilder cycleStr = new StringBuilder("Possible cycle: "+aadlString); String sep = " -> "; for(String cycleId : cycle){ cycleStr.append(sep); aadlString = emitter.varRenaming.get(cycleId); cycleStr.append(aadlString); } emitter.log.logWarning(cycleStr.toString()); exceptionStr.append(cycleStr); } } if(throwException && !discovered.isEmpty()){ throw new AgreeCombinationalCycleException(exceptionStr.toString()); } } static public LinkedList<String> cycleWarning_Helper(String visit, String target, Set<String> visited, Map<String, Set<String>> graph){ if(visited.contains(visited)){ return null; } visited.add(visit); Set<String> toVisit = graph.get(visit); if(toVisit != null){ for(String nextVisit : toVisit){ if(nextVisit.equals(target)){ return new LinkedList<>(Collections.singletonList(target)); } LinkedList<String> cycle = cycleWarning_Helper(nextVisit, target, visited, graph); if(cycle != null){ cycle.push(nextVisit); return cycle; } } } return null; } static public AgreeAnnexEmitter getSubcomponentEmitter(Subcomponent sub, List<AgreeAnnexEmitter> subEmitters){ for(AgreeAnnexEmitter subEmitter : subEmitters){ if(subEmitter.curComp == sub){ return subEmitter; } } return null; } static public Expr conjoin(List<Expr> exprs) { if (exprs.isEmpty()) { return new BoolExpr(true); } Iterator<Expr> iterator = exprs.iterator(); Expr result = iterator.next(); while (iterator.hasNext()) { result = new BinaryExpr(result, BinaryOp.AND, iterator.next()); } return result; } static public Expr conjoinEqs(List<Equation> eqs) { if (eqs.isEmpty()) { return new BoolExpr(true); } Iterator<Equation> iterator = eqs.iterator(); Expr result = iterator.next().expr; while (iterator.hasNext()) { result = new BinaryExpr(result, BinaryOp.AND, iterator.next().expr); } return result; } static public Expr conjoin(Expr... exprs) { return conjoin(Arrays.asList(exprs)); } static public Expr getLustreAssumptions(AgreeAnnexEmitter emitter) { if(emitter.agreeNode == null){ return conjoin(emitter.assumpExpressions); }else{ return conjoin(emitter.agreeNode.assumptions); } } static public Expr getLustreAssumptionsAndAssertions(AgreeAnnexEmitter emitter) { if(emitter.agreeNode == null){ return conjoin(conjoin(emitter.assumpExpressions), conjoin(emitter.assertExpressions)); }else{ return conjoin(conjoin(emitter.agreeNode.assertions), conjoin(emitter.agreeNode.assumptions)); } } static public Expr getLustreContract(AgreeAnnexEmitter emitter) { if(emitter.agreeNode == null){ return conjoin(conjoin(emitter.assumpExpressions), conjoin(emitter.assertExpressions), conjoinEqs(emitter.guarExpressions)); }else{ return conjoin(conjoin(emitter.agreeNode.assertions), conjoin(emitter.agreeNode.assumptions), conjoin(emitter.agreeNode.guarantees)); } } static public Expr getLustreGuarantee(AgreeAnnexEmitter emitter) { if(emitter.agreeNode == null){ return conjoinEqs(emitter.guarExpressions); }else{ return conjoin(emitter.agreeNode.guarantees); } } static public Equation getLustreHistory(Expr expr, IdExpr histId) { Expr preHist = new UnaryExpr(UnaryOp.PRE, histId); Expr histExpr = new BinaryExpr(expr, BinaryOp.AND, preHist); histExpr = new BinaryExpr(expr, BinaryOp.ARROW, histExpr); Equation histEq = new Equation(histId, histExpr); return histEq; } //returns an expression for bounded history static public Expr getFinteConsistancy(IdExpr histId, IdExpr countId, int n) { Expr countExpr = new BinaryExpr(countId, BinaryOp.EQUAL, new IntExpr(BigInteger.valueOf((long)n))); Expr consistExpr = new BinaryExpr(histId, BinaryOp.AND, countExpr); consistExpr = new UnaryExpr(UnaryOp.NOT, consistExpr); return consistExpr; } static public void getOutputClosure(List<Connection> conns, Set<Subcomponent> subs) { assert (subs.size() == 1); Subcomponent orig = (Subcomponent) (subs.toArray()[0]); int prevSize = subs.size(); do { prevSize = subs.size(); for (Connection conn : conns) { ConnectedElement absConnDest = conn.getDestination(); ConnectedElement absConnSour = conn.getSource(); Context destContext = absConnDest.getContext(); Context sourContext = absConnSour.getContext(); if (sourContext != null && subs.contains(sourContext)) { if (destContext != null && destContext instanceof Subcomponent) { //assert (destContext instanceof Subcomponent); if (orig.equals(destContext)) { // there is a loop subs.clear(); break; } subs.add((Subcomponent) destContext); } } } } while (subs.size() != prevSize); } public static boolean containsAgreeAnnex(Subcomponent subComp){ ComponentImplementation compImpl = subComp.getComponentImplementation(); if(compImpl != null){ for(AnnexSubclause subClause : compImpl.getOwnedAnnexSubclauses()){ if(subClause instanceof AgreeSubclause){ return true; } } } ComponentType compType = subComp.getComponentType(); if(compType != null){ for(AnnexSubclause subClause : compType.getOwnedAnnexSubclauses()){ if(subClause instanceof AgreeSubclause){ return true; } } } return false; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
50abe7472cb51f6a72fd8bff61756e420eadcb55
d89ffd8d2340ecf82faa6ca83421f225290d7d5b
/src/main/java/stickman/model/entity/factory/EntityFactory.java
1feafca22e835f18a11350ee3f4f01bb7a25d0f0
[]
no_license
Blackssugar/littleGame
cfeb79091844c959852db08ac5a85d384f9de6bc
6d0f5f49d1fed47f773bcdc208da7fcced9c237c
refs/heads/master
2021-05-19T03:26:39.297295
2020-04-02T14:26:06
2020-04-02T14:26:06
251,507,081
2
0
null
null
null
null
UTF-8
Java
false
false
1,128
java
package stickman.model.entity.factory; import java.util.List; import stickman.model.entity.Controllable; import stickman.model.entity.Entity; public interface EntityFactory { /** * Creates and returns an Entity of the specified type. * * @param entityType the type of entity to create. * @param xPos the entity's x position. * @param yPos the entity's y position. * @param common a list of extra data that may be necessary for entity instantiation. * @return a new Entity instance of the specified type. */ Entity createEntity(String entityType, double xPos, double yPos, List<Object> common); /** * Creates and returns a Controllable of the specified type. * * @param entityType the type of entity to create. * @param xPos the entity's x position. * @param yPos the entity's y position. * @param common a list of extra data that may be necessary for entity instantiation. * @return a new Controllable instance of the specified type. */ Controllable createControllable(String entityType, double xPos, double yPos, List<Object> common); }
[ "qxia7490@uni.sydney.edu.au" ]
qxia7490@uni.sydney.edu.au
d8ec010e8c09adee142f78d1cb985b466146a618
9e62d2b35f3b6fa29bebd4903e3dd80d8ed1a812
/src/main/java/com/uprep/userms/repository/UserRepository.java
799d7c1f996d22cf77805365abe63bb413cb8c42
[]
no_license
oyeballu/uprep_userms
4fbc5d1a1fc6da96610d06fec773025899bc6493
fb97f35456fcabf021effe50771fba77d220764d
refs/heads/master
2022-12-23T04:59:49.093412
2020-08-29T23:12:25
2020-08-29T23:12:25
291,353,197
0
0
null
null
null
null
UTF-8
Java
false
false
701
java
package com.uprep.userms.repository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.CrudRepository; import org.springframework.stereotype.Repository; import com.uprep.userms.entity.User; @Repository public interface UserRepository extends CrudRepository<User, Long> { @Query(nativeQuery = true, value = "select * from users where login_id=?1 AND password=?2") User findByLoginIdAndPassword(String loginId, String password); @Query(nativeQuery = true, value = "select * from users where login_id=?1") User findByLoginId(String username); @Query(nativeQuery = true, value = "select * from users where id=?1") User findUserById(Long userId); }
[ "balramc@cdac.in" ]
balramc@cdac.in
247e3827e826f7918ad99543e1f05baf070920af
c820a399d172e7e40fe01a3cc505b24bfcd7b0d8
/src/com/apartment/aliya/entity/Doors.java
ac45a282fffd8cc2b1a9b7172205497c36f40bb2
[]
no_license
aliya2409/Apartment
4ec3a1929fd27352147b6fb9648e08af259532c9
ede8c7dcf2dfc56611df543ad84c6ab879c21e55
refs/heads/master
2020-04-04T11:53:56.414852
2018-11-02T18:35:29
2018-11-02T18:35:29
155,907,180
0
0
null
null
null
null
UTF-8
Java
false
false
1,770
java
package com.apartment.aliya.entity; import java.util.UUID; public class Doors extends WallStuff { private double length; private double height; private wallStaffMaterial material; private boolean isLocked; private String doorID; public Doors(double length, double height, wallStaffMaterial material, boolean isLocked) { super(length, height, material); this.doorID = UUID.randomUUID().toString(); this.isLocked = isLocked; } public Doors() { } public double getLength() { return length; } public void setLength(double length) { this.length = length; } public double getHeigth() { return height; } public void setHeigth(double height) { this.height = height; } public wallStaffMaterial getMaterial() { return material; } public void setMaterial(wallStaffMaterial material) { this.material = material; } public boolean isLocked() { return isLocked; } public void setDoorLock(boolean isLocked) { this.isLocked = isLocked; } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != this.getClass()) { return false; } Doors door = (Doors) obj; if (this.height == door.height && this.length == door.length && this.material == door.material && this.isLocked == door.isLocked && this.doorID.equals(door.doorID)) { return true; } else System.out.println("DoorsMatchingError"); return false; } @Override public int hashCode() { return super.hashCode(); } }
[ "aliya2409@gmail.com" ]
aliya2409@gmail.com
4e05b029d146b75efabc80f710670d1cbdc8a922
28122481a0a4ce7260a65e8da3c8599ed8c697a1
/src/Zadanie14_2/AgeComparators.java
82509ab97888dd4c0189086be53676356233608a
[]
no_license
Ubshik/HomeWork
c093ddf14eee46cc96a42d18b6626d60f2be0813
329064a4c157e1ea5250a49957020af86931320b
refs/heads/master
2021-01-11T02:00:23.486042
2016-11-14T20:29:40
2016-11-14T20:29:40
70,823,698
0
1
null
null
null
null
UTF-8
Java
false
false
250
java
package Zadanie14_2; import java.util.Comparator; /** * Created by Acer5740 on 31.10.2016. */ public class AgeComparators implements Comparator<Sportsman> { public int compare (Sportsman a, Sportsman b){ return b.age - a.age; } }
[ "ubshik@gmail.com" ]
ubshik@gmail.com
19b8fcd5d7f9f4c4171cd7ca9ad597c6b9fc5979
3015beaa62b9a3d4553f76aa348a1bd42d2d6ce8
/switch.java
d30d83bfa2d3c5381fa7e4a0bca301cd84c8ad26
[]
no_license
yuzua/JAVA
ceccce2cab2f05f2d56e182044a72263b22e5078
91981316baf3897612f7efcf543b3720bcc21844
refs/heads/main
2023-07-04T09:02:19.514498
2021-08-15T03:08:40
2021-08-15T03:08:40
366,166,505
0
0
null
null
null
null
UTF-8
Java
false
false
828
java
import java.util.Scanner; class ArithInt { public static void main(String[] args){ Scanner stdIn = new Scanner(System.in); System.out.Println("整数を加算します。"); int total = 0; //Outerラベルの指定 Outer: for (int i = 0; i <= 10; i++) { System.out.Print("手を選べ (0・・・グー/1・・・チョキ/2・・・パー) :"); int hand = stdIn.nextInt(); // Innerラベルの指定 Inner: swtch (hand) { case 0: System.out.Println("グー"); break; case 1: System.out.Println("チョキ"); break; case 2: System.out.Println("パー"); break; default: System.out.Println("選び直してください"); break Outer; } } } }
[ "k.saito70329@gmail.com" ]
k.saito70329@gmail.com
6c1c2d8c68556a6bd991f5f8ea29ce2179ee6e61
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/test/org/apache/shardingsphere/core/routing/type/broadcast/DatabaseBroadcastRoutingEngineTest.java
5ad730a2b391a7d9a811e463ca6169ae1d996498
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
1,851
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.shardingsphere.core.routing.type.broadcast; import java.util.List; import org.apache.shardingsphere.core.routing.type.RoutingResult; import org.apache.shardingsphere.core.routing.type.TableUnit; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; public final class DatabaseBroadcastRoutingEngineTest { private DatabaseBroadcastRoutingEngine databaseBroadcastRoutingEngine; @Test public void assertRoute() { RoutingResult routingResult = databaseBroadcastRoutingEngine.route(); List<TableUnit> tableUnitList = new java.util.ArrayList(routingResult.getTableUnits().getTableUnits()); Assert.assertThat(routingResult, CoreMatchers.instanceOf(RoutingResult.class)); Assert.assertThat(routingResult.getTableUnits().getTableUnits().size(), CoreMatchers.is(2)); Assert.assertThat(tableUnitList.get(0).getDataSourceName(), CoreMatchers.is("ds0")); Assert.assertThat(tableUnitList.get(1).getDataSourceName(), CoreMatchers.is("ds1")); } }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
f11b955cbf93dcf828be80614f04483aa4bc2b1c
3259b3cce1a164456d1112fab1bdabe8c0d71f62
/app/src/main/java/no/connectica/robocop/MainActivity.java
4349c5ad35eb9475a6614c376b3404b0382dc165
[]
no_license
chiragrajk/RoboCop-SampleApp
094a7678880702cd4ef63b13712bcfb46bd4fff5
723e8c8d2d2d52007851e94e5d6553f30d861005
refs/heads/master
2021-01-10T13:35:19.252316
2015-12-22T09:50:43
2015-12-22T09:50:43
48,425,957
0
0
null
null
null
null
UTF-8
Java
false
false
334
java
package no.connectica.robocop; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "chiragrajk@gmail.com" ]
chiragrajk@gmail.com
1c2c4658e053c11c305fe37342494ec14f5a0410
332106e18ad7516f59cddd2d67cb902e6625eda1
/app/src/main/java/com/kevin/holamundo/MainActivity.java
b5440fe9f250c02330984eda823e64bc4f2c4594
[]
no_license
KevinEspericueta/HolaMundo-Boton
adda6b4b50612e927ec17b636ccd5d8ddd1ce4b3
a0c4477b424c24799e496baf311fe545dcd1dbab
refs/heads/master
2021-04-28T18:36:07.279298
2018-02-17T17:35:15
2018-02-17T17:35:15
121,876,601
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package com.kevin.holamundo; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "33431370+KevinEspericueta@users.noreply.github.com" ]
33431370+KevinEspericueta@users.noreply.github.com
e537b4089be37a39450a85f7fcdefb20890e8c36
66feb6a0722d2d7cbf9f2e25b4ad2756da9bb6e4
/src/main/br/com/ufscar/dominio/modelo/veiculo/Placa.java
411f62cc567f45142a9dd29d70510cd946ff8e8b
[]
no_license
marcelohb/ItineraNew
0a49bd884e06d80ad32b155675c56c3e6e0deff8
fe3fdd6136835b1808211a984f3806a0f57811b6
refs/heads/master
2021-01-10T07:14:06.581356
2016-01-07T00:26:48
2016-01-07T00:26:48
36,531,890
0
0
null
null
null
null
UTF-8
Java
false
false
1,333
java
package br.com.ufscar.dominio.modelo.veiculo; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.persistence.Embeddable; @Embeddable public class Placa { private String placa; public Placa(String placa) { this.placa = placa.toUpperCase(); validar(); } private Placa() {} private void validar() { Pattern padrao = Pattern.compile("[A-Z]{3,3}\\d{4,4}"); Matcher placaValida = padrao.matcher(this.placa); if (!placaValida.find()) { throw new IllegalArgumentException("Placa fora do padrão"); } } public String placaFormatada() { String placaFormatada = this.placa.substring(0, 3) + "-" + this.placa.substring(3, 7); return placaFormatada; } public String getPlaca() { return placa; } public void setPlaca(String placa) { this.placa = placa; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((placa == null) ? 0 : placa.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Placa other = (Placa) obj; if (placa == null) { if (other.placa != null) return false; } else if (!placa.equals(other.placa)) return false; return true; } }
[ "marcelobattaglion@bol.com.br" ]
marcelobattaglion@bol.com.br
e172b2b3f0a08530ae9ea1d5a6dd5785b50f27ea
50f64178fb2488c781d377ab5bedc2fc4161fb4d
/src/control/Magazine.java
a035ed7b6959726f8b1300b30928598aec23cc30
[]
no_license
mousto090/UML_Loria_Projects
53292e6794972fffc1fc7c4823067982b095e60d
7e5b0dc7f71af79cbf5da94dcc84f517752bc50c
refs/heads/master
2021-01-10T06:13:32.617065
2016-04-03T00:49:49
2016-04-03T00:49:49
55,186,539
0
0
null
null
null
null
UTF-8
Java
false
false
212
java
package control; public class Magazine{ Magazine() { throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. } }
[ "mousto090@gmail.com" ]
mousto090@gmail.com
d8bc03fbbc27edb665331ebcb30eb50370869f25
dede0fd41b853b7001b41935eb277557e44018ac
/src/main/java/de/piinguiin/guiapi/PublicGui.java
231efe00b87de2c6310f5c00592d0a5decd24d4a
[]
no_license
Piinguiin/GuiApi
17e44dab31f79736c83395c6e70ee8fb74aaed04
d8c4e0e4b3fc2d4d66978aa1dfd6f61fd886dab6
refs/heads/master
2020-09-16T01:57:19.066072
2019-11-23T16:18:59
2019-11-23T16:18:59
222,164,398
0
0
null
null
null
null
UTF-8
Java
false
false
852
java
package de.piinguiin.guiapi; import de.piinguiin.guiapi.impl.AbstractGui; import de.piinguiin.guiapi.manager.GuiManager; import org.bukkit.entity.Player; import org.bukkit.event.inventory.InventoryType; public abstract class PublicGui extends AbstractGui { public PublicGui(GuiManager guiManager, String title, InventoryType type, int raws, boolean filled) { super(guiManager, title, type, raws, filled); } public PublicGui(GuiManager guiManager, String title, InventoryType type, boolean filled) { super(guiManager, title, type, filled); } public PublicGui(GuiManager guiManager, String title, int raws, boolean filled) { super(guiManager, title, raws, filled); } public void preRender() { update(); } @Override public void open(Player player) { } @Override public void close(Player player) { } }
[ "Carlosensale99" ]
Carlosensale99
540bb5beb7c8ac91635090126d14c4d04436bf85
eaf8e32da0d6d4b62dbc94f7f267cf2156944520
/ServletJDBCApp/src/com/bridgelabz/model/User.java
5c320ef3ca297445dd6b55cbae0a4c52a70e28f0
[]
no_license
kashyapmridumurchana/Servlet
5880e1e0f6dd011fb3bacfb0515aff3b94e69079
9b10119f2bee6c10b2f8c3b9b8c829e8fe18fe8a
refs/heads/master
2020-04-18T01:21:29.125072
2019-01-29T13:46:03
2019-01-29T13:46:03
167,115,765
0
0
null
null
null
null
UTF-8
Java
false
false
920
java
package com.bridgelabz.model; public class User { int id; String name; String password; String email; long telNo; public User() { int id; this.name=name; this.password=password; this.email=email; this.telNo=telNo; } public User(int id,String name, String password, String email, long tel) { super(); this.id=id; this.name = name; this.password = password; this.email = email; this.telNo = tel; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public long getTel() { return telNo; } public void setTel(long tel) { this.telNo = tel; } }
[ "kashyapmridumurchana25@gmail.com" ]
kashyapmridumurchana25@gmail.com
6e616d471eb2d9cfde69ed1338ad371368cd877e
1249bf699981de47d3261a35b554ec1856a1520b
/foundation-service/src/main/java/org/unidal/lookup/container/model/transform/DefaultSaxMaker.java
ef7d494803e2d2fd9eb97d9504316b53120b5ed8
[]
no_license
liu76874151/frameworks
32beb451e01524de827857c7d94cc66addebcf45
e10883d2288eec6b1b3bb7a45e77dd6657484452
refs/heads/master
2021-06-30T12:24:37.616392
2017-09-15T09:14:22
2017-09-15T09:14:22
103,633,472
0
0
null
2017-09-15T08:28:08
2017-09-15T08:28:08
null
UTF-8
Java
false
false
2,418
java
package org.unidal.lookup.container.model.transform; import java.util.Arrays; import java.util.HashSet; import org.xml.sax.Attributes; import org.unidal.lookup.container.model.entity.Any; import org.unidal.lookup.container.model.entity.ComponentModel; import org.unidal.lookup.container.model.entity.ConfigurationModel; import org.unidal.lookup.container.model.entity.PlexusModel; import org.unidal.lookup.container.model.entity.RequirementModel; public class DefaultSaxMaker implements IMaker<Attributes> { @Override public Any buildAny(Attributes attributes) { throw new UnsupportedOperationException("Not needed!"); } @Override public ComponentModel buildComponent(Attributes attributes) { ComponentModel component = new ComponentModel(); return component; } @Override public ConfigurationModel buildConfiguration(Attributes attributes) { ConfigurationModel configuration = new ConfigurationModel(); return configuration; } @Override public PlexusModel buildPlexus(Attributes attributes) { PlexusModel plexus = new PlexusModel(); return plexus; } @Override public RequirementModel buildRequirement(Attributes attributes) { RequirementModel requirement = new RequirementModel(); return requirement; } @SuppressWarnings("unchecked") protected <T> T convert(Class<T> type, String value, T defaultValue) { if (value == null || value.length() == 0) { return defaultValue; } if (type == Boolean.class || type == Boolean.TYPE) { return (T) Boolean.valueOf(value); } else if (type == Integer.class || type == Integer.TYPE) { return (T) Integer.valueOf(value); } else if (type == Long.class || type == Long.TYPE) { return (T) Long.valueOf(value); } else if (type == Short.class || type == Short.TYPE) { return (T) Short.valueOf(value); } else if (type == Float.class || type == Float.TYPE) { return (T) Float.valueOf(value); } else if (type == Double.class || type == Double.TYPE) { return (T) Double.valueOf(value); } else if (type == Byte.class || type == Byte.TYPE) { return (T) Byte.valueOf(value); } else if (type == Character.class || type == Character.TYPE) { return (T) (Character) value.charAt(0); } else { return (T) value; } } }
[ "qmwu2000@gmail.com" ]
qmwu2000@gmail.com
7e1a173bc1db35603d8cc0fa5a826db4345e72c7
927c8d365e1cd66e5ec224710156939d12cbbe17
/restlet-1.1.6-5346-sonatype/modules/org.restlet.test/src/org/restlet/test/jaxrs/services/tests/InheritAnnotationTest.java
0c206ac6a7cddc78935bdefe5f52d37b51efa1d0
[]
no_license
peterlynch/spice
63531485189d794d6bdb23dd5f4baae5725a348b
e95877f143d4e9eab3c464550fabe3787da75561
refs/heads/master
2022-10-19T11:30:27.921153
2010-10-12T13:32:12
2010-10-12T13:32:12
997,598
0
0
null
2022-10-04T23:47:23
2010-10-18T13:34:10
Java
UTF-8
Java
false
false
4,658
java
/** * Copyright 2005-2008 Noelios Technologies. * * The contents of this file are subject to the terms of the following open * source licenses: LGPL 3.0 or LGPL 2.1 or CDDL 1.0 (the "Licenses"). You can * select the license that you prefer but you may not use this file except in * compliance with one of these Licenses. * * You can obtain a copy of the LGPL 3.0 license at * http://www.gnu.org/licenses/lgpl-3.0.html * * You can obtain a copy of the LGPL 2.1 license at * http://www.gnu.org/licenses/lgpl-2.1.html * * You can obtain a copy of the CDDL 1.0 license at * http://www.sun.com/cddl/cddl.html * * See the Licenses for the specific language governing permissions and * limitations under the Licenses. * * Alternatively, you can obtain a royaltee free commercial license with less * limitations, transferable or non-transferable, directly at * http://www.noelios.com/products/restlet-engine * * Restlet is a registered trademark of Noelios Technologies. */ package org.restlet.test.jaxrs.services.tests; import java.util.HashSet; import java.util.Set; import javax.ws.rs.core.Application; import org.restlet.data.MediaType; import org.restlet.data.Method; import org.restlet.data.Reference; import org.restlet.data.Response; import org.restlet.data.Status; import org.restlet.test.jaxrs.services.resources.InheritAnnotationTestService1; import org.restlet.test.jaxrs.services.resources.InheritAnnotationTestService2; import org.restlet.test.jaxrs.services.resources.InheritAnnotationTestServiceInterface; /** * Check, if the inheritation of method annotations works corerct. * * @author Stephan Koops * @see InheritAnnotationTestService1 * @see InheritAnnotationTestService2 * @see InheritAnnotationTestServiceInterface */ public class InheritAnnotationTest extends JaxRsTestCase { private static final Class<InheritAnnotationTestService1> SERVICE_1 = InheritAnnotationTestService1.class; private static final Class<InheritAnnotationTestService2> SERVICE_2 = InheritAnnotationTestService2.class; @Override protected Application getApplication() { return new Application() { @Override public Set<Class<?>> getClasses() { final Set<Class<?>> rrcs = new HashSet<Class<?>>(2); rrcs.add(SERVICE_1); rrcs.add(SERVICE_2); return rrcs; } }; } public void test1() throws Exception { final Reference reference = createReference(SERVICE_1, "getText"); final Response response = accessServer(Method.GET, reference); sysOutEntityIfError(response); assertEquals(Status.SUCCESS_OK, response.getStatus()); assertEqualMediaType(MediaType.TEXT_PLAIN, response); final String entityText = response.getEntity().getText(); assertEquals(InheritAnnotationTestService1.RETURN_STRING, entityText); } public void test2a() throws Exception { final Reference reference = createReference(SERVICE_2, "getText"); final Response response = accessServer(Method.GET, reference); sysOutEntityIfError(response); assertEquals(Status.SUCCESS_OK, response.getStatus()); assertEqualMediaType(MediaType.TEXT_PLAIN, response); final String entityText = response.getEntity().getText(); assertEquals(InheritAnnotationTestService2.RETURN_STRING, entityText); } public void test2b() throws Exception { final Reference reference = createReference(SERVICE_2, "getSubClassText"); final Response response = accessServer(Method.GET, reference); sysOutEntityIfError(response); assertEquals(Status.SUCCESS_OK, response.getStatus()); assertEqualMediaType(MediaType.TEXT_PLAIN, response); final String entityText = response.getEntity().getText(); assertEquals(InheritAnnotationTestService2.RETURN_STRING_SUB, entityText); } public void x_test2c() throws Exception { final Reference reference = createReference(SERVICE_2, "getSubClassText/sub"); final Response response = accessServer(Method.GET, reference); sysOutEntityIfError(response); assertEquals(Status.SUCCESS_OK, response.getStatus()); assertEqualMediaType(MediaType.TEXT_PLAIN, response); final String entityText = response.getEntity().getText(); assertEquals(InheritAnnotationTestService2.RETURN_STRING_SUB2, entityText); } }
[ "dbradicich@5751e0cb-dcb7-432f-92e2-260806df54be" ]
dbradicich@5751e0cb-dcb7-432f-92e2-260806df54be
93f079e8b1744c9ff13355b11d788dfa84f2c794
a21abc7f6f8bb9a879e8caebe5599ae6437c698c
/libutil/src/main/java/darkranger/libutil/view/dialog/wheel/DateNumericAdapter.java
c195003c384894941ce9374b95fac4c6f32253f9
[]
no_license
DarkRangerR1983/CommonLib
e86798b9771d58e67635d8d080b1b0af83f11bb8
e88191be3a5540f6508f502ae34e015d6787009c
refs/heads/master
2020-03-18T11:28:03.966501
2018-05-24T08:31:46
2018-05-24T08:31:46
134,673,467
0
0
null
null
null
null
UTF-8
Java
false
false
984
java
package darkranger.libutil.view.dialog.wheel; import android.content.Context; import android.graphics.Typeface; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; /** * @author vondear */ public class DateNumericAdapter extends NumericWheelAdapter { // Index of current item int currentItem; // Index of item to be highlighted int currentValue; /** * Constructor */ public DateNumericAdapter(Context context, int minValue, int maxValue, int current) { super(context, minValue, maxValue); this.currentValue = current; setTextSize(16); } @Override protected void configureTextView(TextView view) { super.configureTextView(view); /*if (currentItem == currentValue) { view.setTextColor(0xFF0000F0); }*/ view.setTypeface(Typeface.SANS_SERIF); } @Override public View getItem(int index, View cachedView, ViewGroup parent) { currentItem = index; return super.getItem(index, cachedView, parent); } }
[ "tangchaohui@eifm.net" ]
tangchaohui@eifm.net
a445073d57a038e594c4c045dd74149940d4bae7
4a750f4d61cf4d0b626bdae2ac67e8ffa8d3a53c
/src/main/java/uk/co/badgersinfoil/metaas/impl/ASTASAssignmentExpression.java
9bceecfadafe9958a3d8c7f36d554e8a55a1454b
[ "Apache-2.0" ]
permissive
Catalysts/metaas
fd37a0941dd3ff9340d91020a67d80de9c6462de
3ff41bfb9448faff728c4533eddbaac23fad69a3
refs/heads/master
2020-05-18T16:23:38.744969
2012-04-04T13:33:04
2012-04-04T13:33:04
3,927,351
2
1
null
null
null
null
UTF-8
Java
false
false
1,954
java
/* * ASTASAssignmentExpression.java * * Copyright (c) 2008 Matthew J Tretter * * 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 uk.co.badgersinfoil.metaas.impl; import uk.co.badgersinfoil.metaas.dom.ASAssignmentExpression; import uk.co.badgersinfoil.metaas.dom.Expression; import uk.co.badgersinfoil.metaas.impl.antlr.LinkedListTree; public class ASTASAssignmentExpression extends ASTExpression implements ASAssignmentExpression { public ASTASAssignmentExpression(LinkedListTree ast) { super(ast); } public Expression getLeftSubexpression() { return ExpressionBuilder.build(ast.getFirstChild()); } public Op getOperator() { return AssignmentOperatorMap.opFromType(ast.getType()); } public Expression getRightSubexpression() { return ExpressionBuilder.build(ast.getLastChild()); } public void setLeftSubexpression(Expression left) { setSubexpression(0, left); } public void setOperator(Op operator) { AssignmentOperatorMap.initialiseFromOp(operator, ast.getToken()); } public void setRightSubexpression(Expression right) { setSubexpression(1, right); } private void setSubexpression(int index, Expression subexpression) { ASTExpression sub = (ASTExpression)subexpression; LinkedListTree subExpr = sub.getAST(); ASTBuilder.assertNoParent("expression", subExpr); // TODO: handle operator precedence issues ast.setChildWithTokens(index, subExpr); } }
[ "r.knoll@me.com" ]
r.knoll@me.com
38cf2ec2b385cbcf468f606a4799a12b02e9add8
9b62a49653d5ef7e2ce8bc9b15ae7fbbcd058cd3
/src/main/java/com/zbkj/crmeb/wechat/vo/SendTemplateMessageVo.java
4f819a8fcf0922258357c8847a53eccd004d983c
[]
no_license
123guo789/E-commerce-marketing-system
cfcc00d11e0f645f30e3b3c465b4a907dd7ab5bc
14241e0777e86cd15404811bb397f820ffb4dfd9
refs/heads/master
2023-05-30T19:43:39.276634
2021-06-16T13:07:54
2021-06-16T13:07:54
363,798,792
0
0
null
null
null
null
UTF-8
Java
false
false
863
java
package com.zbkj.crmeb.wechat.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; import java.util.HashMap; /** * 微信模板发送类 */ @Data @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @ApiModel(value="SendTemplateMessageVo对象", description="微信模板发送类") public class SendTemplateMessageVo { @ApiModelProperty(value = "OPENID", required = true) private String openId; @ApiModelProperty(value = "模板ID", required = true) private String templateId; @ApiModelProperty(value = "模板跳转链接(海外帐号没有跳转能力)") private String url; @ApiModelProperty(value = "发送内容") private HashMap<String, SendTemplateMessageItemVo> data; }
[ "321458547@qq.com" ]
321458547@qq.com
4b09210b1cc0dddf8fe22ddf634c92c1b1429a54
ef7711f258768db2f6dbfffca9639da1f19f02a4
/app/src/main/java/com/call/logger/app/main/database/CallAndSmsSQLiteOpenHelper.java
d0e8ddc0669d42de714370eb6a593857d43c8bb6
[]
no_license
truonggiangkt192/CallAndSmsLogger-master
695848371ec635f647194ee2b4383b285bac747e
9d97645b8a6081d9379e34826b7a35e375571fa9
refs/heads/master
2021-01-09T20:13:55.857905
2016-06-29T08:27:14
2016-06-29T08:27:14
62,209,155
0
0
null
null
null
null
UTF-8
Java
false
false
4,969
java
package com.call.logger.app.main.database; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import com.call.logger.app.main.model.Call; import com.call.logger.app.main.model.Sms; import java.util.ArrayList; import java.util.List; public class CallAndSmsSQLiteOpenHelper extends android.database.sqlite.SQLiteOpenHelper { private SQLiteDatabase db; private ContentValues values; private Cursor cursor; private static final String DB_NAME = "calls_and_messages.db"; private static final int VERSION = 1; private static final String TABLE_CALL = "calls"; private static final String TABLE_SMS = "messages"; private static final String CALL_ID = "call_id"; private static final String MESSAGE_ID = "message_id"; private static final String NAME = "name"; private static final String NUMBER = "number"; private static final String DURATION = "duration"; private static final String DATE = "date"; private static final String TYPE = "type"; private static final String MESSAGE = "message"; public CallAndSmsSQLiteOpenHelper(Context context) { super(context, DB_NAME, null, VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL("CREATE TABLE " + TABLE_CALL + " (" + CALL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAME + " TEXT NOT NULL, " + NUMBER + " TEXT NOT NULL, " + DURATION + " TEXT NOT NULL, " + DATE + " INTEGER NOT NULL, " + TYPE + " TEXT NOT NULL);"); db.execSQL("CREATE TABLE " + TABLE_SMS + " (" + MESSAGE_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + NAME + " TEXT NOT NULL, " + NUMBER + " TEXT NOT NULL, " + MESSAGE + " TEXT NOT NULL, " + DATE + " INTEGER NOT NULL, " + TYPE + " TEXT NOT NULL);"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_CALL); db.execSQL("DROP TABLE IF EXISTS " + TABLE_SMS); onCreate(db); } public void addCall(Call call) { db = getWritableDatabase(); values = new ContentValues(); values.put("name", call.getName()); values.put("number", call.getNumber()); values.put("duration", call.getDuration()); values.put("date", call.getDate()); values.put("type", call.getType()); db.insert(TABLE_CALL, null, values); db.close(); } public void addSms(Sms sms) { db = getWritableDatabase(); values = new ContentValues(); values.put("name", sms.getName()); values.put("number", sms.getNumber()); values.put("message", sms.getMessage()); values.put("date", sms.getDate()); values.put("type", sms.getType()); db.insert(TABLE_SMS, null, values); db.close(); } public void deleteCall(int id) { db = getWritableDatabase(); db.delete(TABLE_CALL, CALL_ID + "=" + id, null); } public void deleteSms(int id) { db = getWritableDatabase(); db.delete(TABLE_SMS, MESSAGE_ID + "=" + id, null); } public int getCount(String tableName) { db = getReadableDatabase(); cursor = db.rawQuery("SELECT * FROM " + tableName, null); return cursor.getCount(); } public List<Call> getAllCalls() { List<Call> calls = new ArrayList<Call>(); Call call; db = getReadableDatabase(); cursor = db.rawQuery("SELECT * FROM " + TABLE_CALL, null); if (cursor.moveToFirst()) { while (!cursor.isAfterLast()) { call = new Call(); call.setId(cursor.getInt(0)); call.setName(cursor.getString(1)); call.setNumber(cursor.getString(2)); call.setDuration(cursor.getString(3)); call.setDate(cursor.getLong(4)); call.setType(cursor.getString(5)); calls.add(call); cursor.moveToNext(); } } cursor.close(); return calls; } public List<Sms> getAllSms() { List<Sms> smsList = new ArrayList<Sms>(); Sms sms; db = getReadableDatabase(); cursor = db.rawQuery("SELECT * FROM " + TABLE_SMS, null); if (cursor.moveToFirst()) { while (!cursor.isAfterLast()) { sms = new Sms(); sms.setId(cursor.getInt(0)); sms.setName(cursor.getString(1)); sms.setNumber(cursor.getString(2)); sms.setMessage(cursor.getString(3)); sms.setDate(cursor.getLong(4)); sms.setType(cursor.getString(5)); smsList.add(sms); cursor.moveToNext(); } } cursor.close(); return smsList; } }
[ "truonggiang.kt192@gmail.com" ]
truonggiang.kt192@gmail.com
be89887ed3a1dd0f0ae1dbf87d7c5b272cfb0436
b40b76705b45589b45744b7616209d754a5d2ac4
/ch-10/apollo-java/src/main/java/com/cxytiandi/apollo_java/App.java
b6ea440c57c0c7497affaac92fa64f320a287a8a
[]
no_license
gaohanghang/Spring-Cloud-Book-Code-2
91aa2ec166a0155198558da5d739829dae398745
6adde8b577f8238eade41571f58a5e2943b0912e
refs/heads/master
2021-10-24T04:07:36.293149
2021-10-17T10:49:48
2021-10-17T10:49:48
203,406,993
2
0
null
2020-10-13T16:17:46
2019-08-20T15:47:02
Java
UTF-8
Java
false
false
1,693
java
package com.cxytiandi.apollo_java; import com.ctrip.framework.apollo.Config; import com.ctrip.framework.apollo.ConfigChangeListener; import com.ctrip.framework.apollo.ConfigService; import com.ctrip.framework.apollo.model.ConfigChange; import com.ctrip.framework.apollo.model.ConfigChangeEvent; /** * Apollo整合Java项目示列 * * @author yinjihuan * * @about http://cxytiandi.com/about * * @date 2018-12-16 * */ public class App { public static void main(String[] args) { // 指定环境(开发演示用,不能用于生产环境)) System.setProperty("env", "DEV"); Config config = ConfigService.getAppConfig(); //getValue(config); addChangeListener(config); try { Thread.sleep(Integer.MAX_VALUE); } catch (InterruptedException e) { e.printStackTrace(); } } private static void addChangeListener(Config config) { config.addChangeListener(new ConfigChangeListener() { public void onChange(ConfigChangeEvent changeEvent) { System.out.println("发生修改数据的命名空间是:" + changeEvent.getNamespace()); for (String key : changeEvent.changedKeys()) { ConfigChange change = changeEvent.getChange(key); System.out.println(String.format("发现修改 - 配置key: %s, 原来的值: %s, 修改后的值: %s, 操作类型: %s", change.getPropertyName(), change.getOldValue(), change.getNewValue(), change.getChangeType())); } } }); } private static void getValue(Config config) { String key = "username"; String defaultValue = "尹吉欢"; String username = config.getProperty(key, defaultValue); System.out.println("username=" + username); } }
[ "1341947277@qq.com" ]
1341947277@qq.com
f118f9d1f9f3d77d39be70f9c3cbf3ce984d9ca1
c264e0c2d36c82f522c8acf71ba90665579648df
/src/main/java/pl/dusinski/defectregistrationsystem/security/WebSecurityConfig.java
ddaff51587c3ccd738ae252db4dc383964d7d19d
[]
no_license
ddusinski/DefectRegistrationSystem
d0d4b7937bd98c346d0a54537cbdc6bb296446e1
3de02c5fe27b2ad080db803982386284a3469f19
refs/heads/master
2020-04-14T12:13:09.234590
2019-01-10T17:22:40
2019-01-10T17:22:40
163,834,275
0
0
null
2019-01-04T07:49:30
2019-01-02T11:47:26
Java
UTF-8
Java
false
false
1,800
java
package pl.dusinski.defectregistrationsystem.security; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.provisioning.InMemoryUserDetailsManager; import java.util.Properties; @Configuration //@EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter { /* private InMemoryUserDetailsManager inMemoryUserDetailsManager; @Autowired protected void configureGlobal(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(inMemoryUserDetailsManager()); @Bean public InMemoryUserDetailsManager inMemoryUserDetailsManager() { final Properties users = new Properties(); users.put("admin", "{noop}123,ROLE_ADMIN"); return new InMemoryUserDetailsManager(users); }*/ @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().antMatchers("/h2-console/**").permitAll(); http.authorizeRequests().anyRequest().authenticated(); http.csrf().disable(); http.headers().frameOptions().disable(); http.formLogin().loginPage("/login"); http.formLogin().permitAll(); http.logout().permitAll(); } }
[ "dominik.dusinski@gmail.com" ]
dominik.dusinski@gmail.com
1e5bb8a8a55daa095caf47b09e1975a93255b6dc
8844df73f5e0a666850ea22bdc7439ac6f284db8
/hisDomestic/Common/src/main/java/com/hisd/common/model/TblTimezone.java
6eccdfe75e732f2e76dbecbc8d2458fc1a1a6694
[]
no_license
HELLYVIHAANINDIA/his_domestic
ffa15f8c7f057bd8210302c0de7ac2165e57b0e4
f59528917d265b0678ab89bf01950a846a848d40
refs/heads/master
2021-01-22T23:53:44.325720
2017-09-22T11:20:50
2017-09-22T11:20:50
85,677,899
1
0
null
null
null
null
UTF-8
Java
false
false
1,422
java
/* * Created on 26 Nov 2016 ( Time 05:36:42 ) */ // This Bean has a basic Primary Key (not composite) package com.hisd.common.model; import java.io.Serializable; //import javax.validation.constraints.* ; //import org.hibernate.validator.constraints.* ; import java.util.List; import javax.persistence.*; /** * Persistent class for entity stored in table "tbl_country" * * */ @Entity @Table(name="tbl_timezone") // Define named queries here public class TblTimezone implements Serializable { private static final long serialVersionUID = 1L; private Integer timezoneId ; private String countryName ; private String utcOffset ; public TblTimezone(){ super(); } public TblTimezone(int timezoneId) { this.timezoneId=timezoneId; } @Id @GeneratedValue(strategy=GenerationType.AUTO) @Column(name="timezoneId", nullable=false) public Integer getTimezoneId() { return timezoneId; } public void setTimezoneId(Integer timezoneId) { this.timezoneId = timezoneId; } @Column(name="countryName", nullable=false) public String getCountryName() { return countryName; } public void setCountryName(String countryName) { this.countryName = countryName; } @Column(name="utcOffset", nullable=false) public String getUtcOffset() { return utcOffset; } public void setUtcOffset(String utcOffset) { this.utcOffset = utcOffset; } }
[ "harsh@webstrikers.com" ]
harsh@webstrikers.com
b03a071e7412995ba5ee7c88b3d15e05a98d3dda
09d5473fc74e5577ca1a1c66eeeee32387048f16
/src/com/game/bomberman/observer/MyObserver.java
1b6651973fafd2134f6ca5f8b20b7406a0addc30
[]
no_license
quynhquynh1996/ProjectOOP
7cb9d4640c72c0c2ee0fee0de7d6f898665bb43d
a8d0e95c49a2da8ca32a963e800e9e84da73f67a
refs/heads/master
2020-03-15T13:11:46.632375
2018-05-04T14:41:56
2018-05-04T14:41:56
132,160,719
0
0
null
null
null
null
UTF-8
Java
false
false
214
java
package com.game.bomberman.observer; public interface MyObserver { public void updateQuantityItem(int quantity); public void updateImageItem(String pathImage); public void updateNameItem(String nameItem); }
[ "luanmarucntt@gmail.com" ]
luanmarucntt@gmail.com
9408dbe54cd7a6ffa13ea8b475404cbfe0c3ad40
de1dcdd74376715e85d9ca996b2c9ea5df3356e3
/src/main/java/com/ifrs/prova/modelo/dao/ContatoDAO.java
7badb7bdcab06b4a9f237b9a803a7fc591215fa5
[]
no_license
neves-eduardo/ProjetoDev1
0743fda25512f2ae60a7f42696c8f31befe38539
d253c4b12bcec037be6bc04d1e2998f1a661496e
refs/heads/master
2020-08-03T09:26:07.200291
2019-09-29T17:51:46
2019-09-29T17:51:46
211,701,362
0
0
null
null
null
null
UTF-8
Java
false
false
485
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.ifrs.prova.modelo.dao; import com.ifrs.prova.modelo.entidade.Atividade; import com.ifrs.prova.modelo.entidade.Contato; import org.springframework.data.repository.CrudRepository; /** * * @author eduardo */ public interface ContatoDAO extends CrudRepository<Contato, Integer> { }
[ "eduardoneves858@gmail.com" ]
eduardoneves858@gmail.com
4623ff913edcc6c06642e161f4e5ea50f319aef6
03daaf09c92c94d6e4360a1ec3502dc68093c2d6
/Back_End/src/main/java/com/ssafy/wine/entity/FollowId.java
7d3788c9c75240cbfaba9538337e510c99a87077
[ "MIT" ]
permissive
SkydevilK/Dionysos
47c2b75bd0736eebaa7e954253be29d61f78add0
3e5a3b980bf1a1ea518aa36f9e6cf6ffeede0f4d
refs/heads/master
2022-04-17T19:57:24.289088
2020-04-15T14:16:33
2020-04-15T14:16:33
255,937,178
0
0
null
null
null
null
UTF-8
Java
false
false
231
java
package com.ssafy.wine.entity; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode public class FollowId implements Serializable{ private Long from; private Long to; }
[ "skydevilk@gmail.com" ]
skydevilk@gmail.com
b79142c0a92ec5289edf04d320f1a5b996de5435
468d839db262368a73d5f0dd1ac046310bd0440d
/day03/src/com/momoko/java/StringBufferBuilderTest.java
03be1329d3d17971588aa4fcf2bc6f0b295336ee
[]
no_license
MomokoW/LearnJava
f41368b1ae89dc689cf5c77e6ba6792011ede278
62c03991fe5fc095b0267a491fd53764ebdb71d4
refs/heads/master
2021-07-25T16:10:27.691768
2021-07-17T13:48:36
2021-07-17T13:48:36
223,080,636
0
0
null
2020-01-08T08:08:06
2019-11-21T03:32:02
Java
UTF-8
Java
false
false
464
java
package com.momoko.java; import org.junit.Test; /** * Created by momoko on 2020/12/16. */ public class StringBufferBuilderTest { @Test public void test1() { StringBuffer sb2 = new StringBuffer("abc"); sb2.append(1); char[] hello = new char[] {'H','E','L','L','O'}; StringBuffer sb1 = new StringBuffer(String.valueOf(hello)); StringBuffer sb3 = sb1.reverse(); System.out.println(sb3.toString()); } }
[ "1165874815@qq.com" ]
1165874815@qq.com
5cc64e30eaa4bfecd548fd961fa70fb245c1f61b
2984675d47a6126787d8d4a5355d24bd8fe9a7db
/components/azureiot/src/main/java/app/bentleyis/azureiot/IotBinder.java
88229c39fdeb90cb4874edeca8ccc7beb9461a00
[ "MIT" ]
permissive
jamesrbent1ey/androidtools
15111b672a976362719e971a162da5e6556967b3
a54f6a30d09c5b8ded128403fdf7f51880ca2b07
refs/heads/master
2022-11-17T20:08:53.355549
2020-06-16T18:06:27
2020-06-16T18:06:27
264,927,669
0
0
null
null
null
null
UTF-8
Java
false
false
2,487
java
/* * Copyright (c) 2020 James Bentley * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package app.bentleyis.azureiot; import android.os.Binder; import android.os.IBinder; import android.os.RemoteException; import java.lang.ref.WeakReference; public class IotBinder extends Binder implements IotServiceAidl { WeakReference<IotService> m_service; WeakReference<IotServiceListenerAidl> m_listener; IotBinder(IotService service) { super(); m_service = new WeakReference<>(service); } @Override public IBinder asBinder() { return this; } @Override public void setListener(IotServiceListenerAidl listener) throws RemoteException { m_listener = new WeakReference<>(IotServiceListenerAidl.Stub.asInterface((IBinder) listener)); } @Override public void sendMessage(String type, byte[] payload) throws RemoteException { if(m_service.get() != null) { m_service.get().sendMessage(type, payload); } } public void receiveMessage(String json) throws RemoteException { if(m_listener == null || m_listener.get() == null) { return; } m_listener.get().receiveMessage(json); } public void callMethod(String name, byte[] payload) throws RemoteException { if(m_listener == null || m_listener.get() == null) { return; } m_listener.get().callMethod(name,payload); } }
[ "jamesrbent1ey@gmail.com" ]
jamesrbent1ey@gmail.com
344d3000f8ae5c0cb501c04e586e97b5df0e0ac8
5b22fb8c58c2f56f238f9df23bea1388c66eaa61
/src/main/java/com/sns/igscheduler/model/Igpost.java
81b200209dc9598b21e41dd412028b2b0f48cd0d
[]
no_license
sanishkr/IGScheduler
53d31998f49cde3d9d7d548d81d6fcf95239b858
b05a05c54e24ab1f8017fb5b6de8e8238dc54332
refs/heads/master
2020-03-24T18:36:56.541348
2018-11-03T07:09:05
2018-11-03T07:09:05
142,895,830
0
0
null
null
null
null
UTF-8
Java
false
false
1,257
java
package com.sns.igscheduler.model; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; @Document public class Igpost { @Id String id; String imageurl; String postdate; String posttime; String captions; public Igpost(String imageurl, String postdate, String posttime, String captions) { this.imageurl = imageurl; this.postdate = postdate; this.posttime = posttime; this.captions = captions; } public String getImageurl() { return imageurl; } public void setImageurl(String imageurl) { this.imageurl = imageurl; } public String getPostdate() { return postdate; } public void setPostdate(String postdate) { this.postdate = postdate; } public String getPosttime() { return posttime; } public void setPosttime(String posttime) { this.posttime = posttime; } public String getCaptions() { return captions; } public void setCaptions(String captions) { this.captions = captions; } public String toString(){ return this.imageurl+" "+this.postdate+" "+this.posttime+" "+this.captions; } }
[ "sanish.kumar@weddingasia.in" ]
sanish.kumar@weddingasia.in
29254d3d990a1e61049dd2f25da58855ca144160
fb386d4480779accc1353a4041a4661632881348
/10-programming-fundamentals-java/10-basics/10-variables-types/src/main/java/basic/VTCodelab06.java
42f253379fc96552bff6353ae61124dd1565b132
[]
no_license
Jermathie/javaexo1
e65ef4ae418fb2d1d23e54faaf854d97782bc7b2
3e1468f17b94f0aeb771ea611b3ef740dcd32bf8
refs/heads/main
2023-03-12T07:10:37.709324
2021-02-07T16:31:40
2021-02-07T16:31:40
336,832,107
0
0
null
null
null
null
UTF-8
Java
false
false
411
java
package basic; public class VTCodelab06 { public static void main(String[] args) { System.out.println("\n"); System.out.println("Assignment 6"); System.out.println("--------------"); // ---------------- // Declare and initialize a char variable // Print the result using: System.out.println("Printing char with value: " + <YOUR_VARIABLE_NAME>); } }
[ "jeremie.mathieu@sfpd.fgov.be" ]
jeremie.mathieu@sfpd.fgov.be
86208a2fb2c081fd9cf0b46a5890fb493242b402
d57fabcf2dc489ff3cef7d1dc2e69715281cca01
/common/data/src/main/java/org/thingsboard/server/common/data/plugin/ComponentScope.java
44009895607552006913f4dee8329c9230ffd44d
[ "Apache-2.0" ]
permissive
augustusliu/thingsboard
becd40c399a8377e8c0e9b25ca9a8367066eaae0
61d8b0fabdf0fbf5fcff06a7af42cbada45ab0d3
refs/heads/main
2023-07-10T13:36:17.117489
2021-08-15T00:39:11
2021-08-15T00:39:11
396,116,725
0
0
null
null
null
null
UTF-8
Java
false
false
187
java
package org.thingsboard.server.common.data.plugin; /** * @author Andrew Shvayka */ public enum ComponentScope { /** * 系统组件,租户组件 */ SYSTEM, TENANT }
[ "augustus.lau.cn@gmail.com" ]
augustus.lau.cn@gmail.com
dd019e08c9a888fd7a504f6aae425ff5ff640f98
995f73d30450a6dce6bc7145d89344b4ad6e0622
/Mate20-9.0/src/main/java/com/android/server/display/LocalDisplayAdapter.java
e3ec603e350393d5db741071eb16d59fac9fa0b3
[]
no_license
morningblu/HWFramework
0ceb02cbe42585d0169d9b6c4964a41b436039f5
672bb34094b8780806a10ba9b1d21036fd808b8e
refs/heads/master
2023-07-29T05:26:14.603817
2021-09-03T05:23:34
2021-09-03T05:23:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
41,197
java
package com.android.server.display; import android.app.ActivityManager; import android.app.ActivityThread; import android.content.BroadcastReceiver; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.Resources; import android.database.ContentObserver; import android.graphics.Rect; import android.hardware.display.HwFoldScreenState; import android.hardware.sidekick.SidekickInternal; import android.os.Build; import android.os.Handler; import android.os.IBinder; import android.os.Looper; import android.os.SystemProperties; import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; import android.util.HwPCUtils; import android.util.Log; import android.util.Slog; import android.util.SparseArray; import android.view.Display; import android.view.DisplayCutout; import android.view.DisplayEventReceiver; import android.view.SurfaceControl; import com.android.server.HwServiceFactory; import com.android.server.LocalServices; import com.android.server.display.DisplayAdapter; import com.android.server.display.DisplayManagerService; import com.android.server.lights.Light; import com.android.server.lights.LightsManager; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; final class LocalDisplayAdapter extends DisplayAdapter { private static final int[] BUILT_IN_DISPLAY_IDS_TO_SCAN = {0, 1}; private static final boolean DEBUG = false; /* access modifiers changed from: private */ public static final int DEFAULT_DENSITYDPI = SystemProperties.getInt("ro.sf.real_lcd_density", SystemProperties.getInt("ro.sf.lcd_density", 0)); private static final boolean FRONT_FINGERPRINT_GESTURE_NAVIGATION_SUPPORTED = SystemProperties.getBoolean("ro.config.gesture_front_support", false); /* access modifiers changed from: private */ public static final boolean FRONT_FINGERPRINT_NAVIGATION = SystemProperties.getBoolean("ro.config.hw_front_fp_navi", false); /* access modifiers changed from: private */ public static final int FRONT_FINGERPRINT_NAVIGATION_TRIKEY = SystemProperties.getInt("ro.config.hw_front_fp_trikey", 0); private static final String GESTURE_NAVIGATION = "secure_gesture_navigation"; private static final int PAD_DISPLAY_ID = 100000; private static final String PROPERTY_EMULATOR_CIRCULAR = "ro.emulator.circular"; private static final String TAG = "LocalDisplayAdapter"; private static final String UNIQUE_ID_PREFIX = "local:"; private static final boolean isChinaArea = SystemProperties.get("ro.config.hw_optb", "0").equals("156"); /* access modifiers changed from: private */ public int defaultNaviMode = 0; /* access modifiers changed from: private */ public int mButtonLightMode = 1; /* access modifiers changed from: private */ public boolean mDeviceProvisioned = true; private final SparseArray<LocalDisplayDevice> mDevices = new SparseArray<>(); private HotplugDisplayEventReceiver mHotplugReceiver; private HwFoldScreenState mHwFoldScreenState; /* access modifiers changed from: private */ public boolean mIsGestureNavEnable = false; /* access modifiers changed from: private */ public ContentResolver mResolver; /* access modifiers changed from: private */ public SettingsObserver mSettingsObserver; /* access modifiers changed from: private */ public int mTrikeyNaviMode = -1; private static final class DisplayModeRecord { public final Display.Mode mMode; public DisplayModeRecord(SurfaceControl.PhysicalDisplayInfo phys) { this.mMode = DisplayAdapter.createMode(phys.width, phys.height, phys.refreshRate); } public boolean hasMatchingMode(SurfaceControl.PhysicalDisplayInfo info) { return this.mMode.getPhysicalWidth() == info.width && this.mMode.getPhysicalHeight() == info.height && Float.floatToIntBits(this.mMode.getRefreshRate()) == Float.floatToIntBits(info.refreshRate); } public String toString() { return "DisplayModeRecord{mMode=" + this.mMode + "}"; } } private final class HotplugDisplayEventReceiver extends DisplayEventReceiver { public HotplugDisplayEventReceiver(Looper looper) { super(looper, 0); } public void onHotplug(long timestampNanos, int builtInDisplayId, boolean connected) { synchronized (LocalDisplayAdapter.this.getSyncRoot()) { if (connected) { try { LocalDisplayAdapter.this.tryConnectDisplayLocked(builtInDisplayId); } catch (Throwable th) { throw th; } } else { LocalDisplayAdapter.this.tryDisconnectDisplayLocked(builtInDisplayId); } } } } private final class LocalDisplayDevice extends DisplayDevice { static final /* synthetic */ boolean $assertionsDisabled = false; private int mActiveColorMode; private boolean mActiveColorModeInvalid; private int mActiveModeId; private boolean mActiveModeInvalid; private int mActivePhysIndex; /* access modifiers changed from: private */ public final Light mBacklight; private int mBrightness; private final int mBuiltInDisplayId; private final Light mButtonlight; private int mDefaultModeId; private SurfaceControl.PhysicalDisplayInfo[] mDisplayInfos; private boolean mHavePendingChanges; private Display.HdrCapabilities mHdrCapabilities; private DisplayDeviceInfo mInfo; public boolean mRogChange; /* access modifiers changed from: private */ public boolean mSidekickActive; /* access modifiers changed from: private */ public SidekickInternal mSidekickInternal; private int mState; private final ArrayList<Integer> mSupportedColorModes; private final SparseArray<DisplayModeRecord> mSupportedModes; static { Class<LocalDisplayAdapter> cls = LocalDisplayAdapter.class; } public LocalDisplayDevice(LocalDisplayAdapter localDisplayAdapter, IBinder displayToken, int builtInDisplayId, SurfaceControl.PhysicalDisplayInfo[] physicalDisplayInfos, int activeDisplayInfo, int[] colorModes, int activeColorMode) { this(displayToken, builtInDisplayId, physicalDisplayInfos, activeDisplayInfo, colorModes, activeColorMode, null); } public LocalDisplayDevice(IBinder displayToken, int builtInDisplayId, SurfaceControl.PhysicalDisplayInfo[] physicalDisplayInfos, int activeDisplayInfo, int[] colorModes, int activeColorMode, HwFoldScreenState foldScreenState) { super(LocalDisplayAdapter.this, displayToken, LocalDisplayAdapter.UNIQUE_ID_PREFIX + builtInDisplayId, foldScreenState); this.mSupportedModes = new SparseArray<>(); this.mSupportedColorModes = new ArrayList<>(); this.mRogChange = false; this.mState = 0; this.mBrightness = -1; this.mBuiltInDisplayId = builtInDisplayId; updatePhysicalDisplayInfoLocked(physicalDisplayInfos, activeDisplayInfo, colorModes, activeColorMode); updateColorModesLocked(colorModes, activeColorMode); this.mSidekickInternal = (SidekickInternal) LocalServices.getService(SidekickInternal.class); if (this.mBuiltInDisplayId == 0) { LightsManager lights = (LightsManager) LocalServices.getService(LightsManager.class); this.mBacklight = lights.getLight(0); if (!LocalDisplayAdapter.FRONT_FINGERPRINT_NAVIGATION || LocalDisplayAdapter.FRONT_FINGERPRINT_NAVIGATION_TRIKEY != 1) { this.mButtonlight = null; } else { this.mButtonlight = lights.getLight(2); } } else { this.mBacklight = null; this.mButtonlight = null; } this.mHdrCapabilities = SurfaceControl.getHdrCapabilities(displayToken); } public boolean hasStableUniqueId() { return true; } public void updateDesityforRog() { this.mHavePendingChanges = true; this.mRogChange = true; } public boolean updatePhysicalDisplayInfoLocked(SurfaceControl.PhysicalDisplayInfo[] physicalDisplayInfos, int activeDisplayInfo, int[] colorModes, int activeColorMode) { this.mDisplayInfos = (SurfaceControl.PhysicalDisplayInfo[]) Arrays.copyOf(physicalDisplayInfos, physicalDisplayInfos.length); this.mActivePhysIndex = activeDisplayInfo; ArrayList<DisplayModeRecord> records = new ArrayList<>(); boolean modesAdded = false; for (SurfaceControl.PhysicalDisplayInfo info : physicalDisplayInfos) { boolean existingMode = false; int j = 0; while (true) { if (j >= records.size()) { break; } else if (records.get(j).hasMatchingMode(info)) { existingMode = true; break; } else { j++; } } if (!existingMode) { DisplayModeRecord record = findDisplayModeRecord(info); if (record == null) { record = new DisplayModeRecord(info); modesAdded = true; } records.add(record); } } DisplayModeRecord activeRecord = null; int i = 0; while (true) { if (i >= records.size()) { break; } DisplayModeRecord record2 = records.get(i); if (record2.hasMatchingMode(physicalDisplayInfos[activeDisplayInfo])) { activeRecord = record2; break; } i++; } if (!(this.mActiveModeId == 0 || this.mActiveModeId == activeRecord.mMode.getModeId())) { this.mActiveModeInvalid = true; LocalDisplayAdapter.this.sendTraversalRequestLocked(); } if (!(records.size() != this.mSupportedModes.size() || modesAdded)) { return false; } this.mHavePendingChanges = true; this.mSupportedModes.clear(); Iterator<DisplayModeRecord> it = records.iterator(); while (it.hasNext()) { DisplayModeRecord record3 = it.next(); this.mSupportedModes.put(record3.mMode.getModeId(), record3); } if (findDisplayInfoIndexLocked(this.mDefaultModeId) < 0) { if (this.mDefaultModeId != 0) { Slog.w(LocalDisplayAdapter.TAG, "Default display mode no longer available, using currently active mode as default."); } this.mDefaultModeId = activeRecord.mMode.getModeId(); } if (this.mSupportedModes.indexOfKey(this.mActiveModeId) < 0) { if (this.mActiveModeId != 0) { Slog.w(LocalDisplayAdapter.TAG, "Active display mode no longer available, reverting to default mode."); } this.mActiveModeId = this.mDefaultModeId; this.mActiveModeInvalid = true; } LocalDisplayAdapter.this.sendTraversalRequestLocked(); return true; } public boolean isFoldable() { return (this.mBuiltInDisplayId == 0 || this.mBuiltInDisplayId == LocalDisplayAdapter.PAD_DISPLAY_ID) && HwFoldScreenState.isFoldScreenDevice(); } public Rect getScreenDispRect(int orientation) { if (!isFoldable() || this.mHwFoldScreenState == null) { return null; } return this.mHwFoldScreenState.getScreenDispRect(orientation); } public int getDisplayState() { if (!isFoldable() || this.mHwFoldScreenState == null) { return 0; } int state = this.mHwFoldScreenState.getDisplayMode(); Slog.d(LocalDisplayAdapter.TAG, "getDisplayState: " + state); return state; } public int setDisplayState(int state) { Slog.d(LocalDisplayAdapter.TAG, "setDisplayState=" + state); if (!isFoldable() || this.mHwFoldScreenState == null) { Slog.d(LocalDisplayAdapter.TAG, "setDisplayState: not a foldable device"); return 0; } int displayMode = this.mHwFoldScreenState.getDisplayMode(); return this.mHwFoldScreenState.setDisplayMode(state); } private boolean updateColorModesLocked(int[] colorModes, int activeColorMode) { List<Integer> pendingColorModes = new ArrayList<>(); if (colorModes == null) { return false; } boolean colorModesAdded = false; for (int colorMode : colorModes) { if (!this.mSupportedColorModes.contains(Integer.valueOf(colorMode))) { colorModesAdded = true; } pendingColorModes.add(Integer.valueOf(colorMode)); } if (!(pendingColorModes.size() != this.mSupportedColorModes.size() || colorModesAdded)) { return false; } this.mHavePendingChanges = true; this.mSupportedColorModes.clear(); this.mSupportedColorModes.addAll(pendingColorModes); Collections.sort(this.mSupportedColorModes); if (!this.mSupportedColorModes.contains(Integer.valueOf(this.mActiveColorMode))) { if (this.mActiveColorMode != 0) { Slog.w(LocalDisplayAdapter.TAG, "Active color mode no longer available, reverting to default mode."); this.mActiveColorMode = 0; this.mActiveColorModeInvalid = true; } else if (!this.mSupportedColorModes.isEmpty()) { Slog.e(LocalDisplayAdapter.TAG, "Default and active color mode is no longer available! Reverting to first available mode."); this.mActiveColorMode = this.mSupportedColorModes.get(0).intValue(); this.mActiveColorModeInvalid = true; } else { Slog.e(LocalDisplayAdapter.TAG, "No color modes available!"); } } return true; } private DisplayModeRecord findDisplayModeRecord(SurfaceControl.PhysicalDisplayInfo info) { for (int i = 0; i < this.mSupportedModes.size(); i++) { DisplayModeRecord record = this.mSupportedModes.valueAt(i); if (record.hasMatchingMode(info)) { return record; } } return null; } public void applyPendingDisplayDeviceInfoChangesLocked() { if (this.mHavePendingChanges) { this.mInfo = null; this.mHavePendingChanges = false; } } public DisplayDeviceInfo getDisplayDeviceInfoLocked() { if (this.mInfo == null) { SurfaceControl.PhysicalDisplayInfo phys = this.mDisplayInfos[this.mActivePhysIndex]; this.mInfo = new DisplayDeviceInfo(); this.mInfo.width = phys.width; this.mInfo.height = phys.height; this.mInfo.modeId = this.mActiveModeId; this.mInfo.defaultModeId = this.mDefaultModeId; this.mInfo.supportedModes = new Display.Mode[this.mSupportedModes.size()]; for (int i = 0; i < this.mSupportedModes.size(); i++) { this.mInfo.supportedModes[i] = this.mSupportedModes.valueAt(i).mMode; } this.mInfo.colorMode = this.mActiveColorMode; this.mInfo.supportedColorModes = new int[this.mSupportedColorModes.size()]; for (int i2 = 0; i2 < this.mSupportedColorModes.size(); i2++) { this.mInfo.supportedColorModes[i2] = this.mSupportedColorModes.get(i2).intValue(); } this.mInfo.hdrCapabilities = this.mHdrCapabilities; this.mInfo.appVsyncOffsetNanos = phys.appVsyncOffsetNanos; this.mInfo.presentationDeadlineNanos = phys.presentationDeadlineNanos; this.mInfo.state = this.mState; this.mInfo.uniqueId = getUniqueId(); if (phys.secure) { this.mInfo.flags = 12; } Resources res = LocalDisplayAdapter.this.getOverlayContext().getResources(); if (this.mBuiltInDisplayId == 0) { this.mInfo.name = res.getString(17039944); DisplayDeviceInfo displayDeviceInfo = this.mInfo; displayDeviceInfo.flags = 3 | displayDeviceInfo.flags; if (res.getBoolean(17956992) || (Build.IS_EMULATOR && SystemProperties.getBoolean(LocalDisplayAdapter.PROPERTY_EMULATOR_CIRCULAR, false))) { this.mInfo.flags |= 256; } this.mInfo.displayCutout = DisplayCutout.fromResources(res, SystemProperties.getInt("persist.sys.rog.width", this.mInfo.width), SystemProperties.getInt("persist.sys.rog.height", this.mInfo.height)); Slog.v(LocalDisplayAdapter.TAG, "getDisplayDeviceInfoLocked called," + width + "x" + height + ", " + this.mInfo.width + "x" + this.mInfo.height + "displayCutout " + this.mInfo.displayCutout); this.mInfo.type = 1; this.mInfo.densityDpi = (int) ((phys.density * 160.0f) + 0.5f); this.mInfo.xDpi = phys.xDpi; this.mInfo.yDpi = phys.yDpi; this.mInfo.touch = 1; } else if (this.mBuiltInDisplayId == LocalDisplayAdapter.PAD_DISPLAY_ID) { this.mInfo.name = "HUAWEI PAD PC Display"; this.mInfo.flags |= 2; this.mInfo.type = 2; this.mInfo.touch = 1; this.mInfo.densityDpi = LocalDisplayAdapter.DEFAULT_DENSITYDPI == 0 ? (int) ((phys.density * 160.0f) + 0.5f) : LocalDisplayAdapter.DEFAULT_DENSITYDPI; HwPCUtils.log(LocalDisplayAdapter.TAG, "PAD_DISPLAY_ID densityDpi:" + this.mInfo.densityDpi); this.mInfo.xDpi = phys.xDpi; this.mInfo.yDpi = phys.yDpi; HwPCUtils.log(LocalDisplayAdapter.TAG, "PAD_DISPLAY_ID mInfo.xDpi:" + this.mInfo.xDpi + ",mInfo.yDpi:" + this.mInfo.yDpi); } else { this.mInfo.displayCutout = null; this.mInfo.type = 2; this.mInfo.flags |= 64; this.mInfo.name = LocalDisplayAdapter.this.getContext().getResources().getString(17039945); this.mInfo.touch = 2; if (HwPCUtils.enabled()) { this.mInfo.densityDpi = (int) ((phys.density * 160.0f) + 0.5f); HwPCUtils.log(LocalDisplayAdapter.TAG, "densityDpi:" + this.mInfo.densityDpi); this.mInfo.xDpi = (float) this.mInfo.densityDpi; this.mInfo.yDpi = (float) this.mInfo.densityDpi; } else { this.mInfo.setAssumedDensityForExternalDisplay(phys.width, phys.height); } if ("portrait".equals(SystemProperties.get("persist.demo.hdmirotation"))) { this.mInfo.rotation = 3; } if (SystemProperties.getBoolean("persist.demo.hdmirotates", false)) { this.mInfo.flags |= 2; } if (!res.getBoolean(17956988)) { this.mInfo.flags |= 128; } if (res.getBoolean(17956989)) { this.mInfo.flags |= 16; } } } return this.mInfo; } public Runnable requestDisplayStateLocked(int state, int brightness) { int i = state; int i2 = brightness; boolean z = false; boolean stateChanged = this.mState != i; if (!(this.mBrightness == i2 || this.mBacklight == null)) { z = true; } boolean brightnessChanged = z; if (!stateChanged && !brightnessChanged) { return null; } int displayId = this.mBuiltInDisplayId; IBinder token = getDisplayTokenLocked(); int oldState = this.mState; if (stateChanged) { this.mState = i; updateDeviceInfoLocked(); } if (brightnessChanged) { this.mBrightness = i2; } final int i3 = oldState; final int i4 = i; final boolean z2 = brightnessChanged; final int i5 = i2; final int i6 = displayId; final IBinder iBinder = token; AnonymousClass1 r0 = new Runnable() { public void run() { int currentState = i3; if (Display.isSuspendedState(i3) || i3 == 0) { if (!Display.isSuspendedState(i4)) { setDisplayState(i4); currentState = i4; } else if (i4 == 4 || i3 == 4) { setDisplayState(3); currentState = 3; } else if (i4 == 6 || i3 == 6) { setDisplayState(2); currentState = 2; } else { return; } } boolean vrModeChange = false; if ((i4 == 5 || currentState == 5) && currentState != i4) { setVrMode(i4 == 5); vrModeChange = true; } if (z2 || vrModeChange) { setDisplayBrightness(i5); } if (i4 != currentState) { setDisplayState(i4); } } private void setVrMode(boolean isVrEnabled) { Slog.d(LocalDisplayAdapter.TAG, "setVrMode(id=" + i6 + ", state=" + Display.stateToString(i4) + ")"); if (LocalDisplayDevice.this.mBacklight != null) { LocalDisplayDevice.this.mBacklight.setVrMode(isVrEnabled); } } /* JADX INFO: finally extract failed */ private void setDisplayState(int state) { if (LocalDisplayDevice.this.mSidekickActive) { Trace.traceBegin(131072, "SidekickInternal#endDisplayControl"); try { LocalDisplayDevice.this.mSidekickInternal.endDisplayControl(); Trace.traceEnd(131072); boolean unused = LocalDisplayDevice.this.mSidekickActive = false; } catch (Throwable th) { Trace.traceEnd(131072); throw th; } } int mode = LocalDisplayAdapter.getPowerModeForState(state); Trace.traceBegin(131072, "setDisplayState(id=" + i6 + ", state=" + Display.stateToString(state) + ")"); try { SurfaceControl.setDisplayPowerMode(iBinder, mode); Trace.traceCounter(131072, "DisplayPowerMode", mode); Trace.traceEnd(131072); if (Display.isSuspendedState(state) && state != 1 && LocalDisplayDevice.this.mSidekickInternal != null && !LocalDisplayDevice.this.mSidekickActive) { Trace.traceBegin(131072, "SidekickInternal#startDisplayControl"); try { boolean unused2 = LocalDisplayDevice.this.mSidekickActive = LocalDisplayDevice.this.mSidekickInternal.startDisplayControl(state); } finally { Trace.traceEnd(131072); } } } catch (Throwable th2) { Trace.traceEnd(131072); throw th2; } } private void setDisplayBrightness(int brightness) { Trace.traceBegin(131072, "setDisplayBrightness(id=" + i6 + ", brightness=" + brightness + ")"); try { LocalDisplayDevice.this.mBacklight.setBrightness(brightness); LocalDisplayDevice.this.updateButtonBrightness(brightness); Trace.traceCounter(131072, "ScreenBrightness", brightness); } finally { Trace.traceEnd(131072); } } }; return r0; } /* access modifiers changed from: private */ public void updateButtonBrightness(int brightness) { if (this.mButtonlight != null && LocalDisplayAdapter.this.mDeviceProvisioned) { if (LocalDisplayAdapter.this.mTrikeyNaviMode < 0 || LocalDisplayAdapter.this.isGestureNavEnable()) { LocalDisplayAdapter.this.setButtonLightTimeout(false); this.mButtonlight.setBrightness(0); return; } if (LocalDisplayAdapter.this.mButtonLightMode != 0) { LocalDisplayAdapter.this.setButtonLightTimeout(false); } else if (brightness == 0) { LocalDisplayAdapter.this.setButtonLightTimeout(false); } if (!LocalDisplayAdapter.this.isButtonLightTimeout()) { this.mButtonlight.setBrightness(brightness); } } } public void requestDisplayModesLocked(int colorMode, int modeId) { if (requestModeLocked(modeId) || requestColorModeLocked(colorMode)) { updateDeviceInfoLocked(); } } public void onOverlayChangedLocked() { updateDeviceInfoLocked(); } public boolean requestModeLocked(int modeId) { if (modeId == 0) { modeId = this.mDefaultModeId; } else if (this.mSupportedModes.indexOfKey(modeId) < 0) { Slog.w(LocalDisplayAdapter.TAG, "Requested mode " + modeId + " is not supported by this display, reverting to default display mode."); modeId = this.mDefaultModeId; } int physIndex = findDisplayInfoIndexLocked(modeId); if (physIndex < 0) { Slog.w(LocalDisplayAdapter.TAG, "Requested mode ID " + modeId + " not available, trying with default mode ID"); modeId = this.mDefaultModeId; physIndex = findDisplayInfoIndexLocked(modeId); } if (this.mActivePhysIndex == physIndex) { return false; } SurfaceControl.setActiveConfig(getDisplayTokenLocked(), physIndex); this.mActivePhysIndex = physIndex; this.mActiveModeId = modeId; this.mActiveModeInvalid = false; return true; } public boolean requestColorModeLocked(int colorMode) { if (this.mActiveColorMode == colorMode) { return false; } if (!this.mSupportedColorModes.contains(Integer.valueOf(colorMode))) { Slog.w(LocalDisplayAdapter.TAG, "Unable to find color mode " + colorMode + ", ignoring request."); return false; } SurfaceControl.setActiveColorMode(getDisplayTokenLocked(), colorMode); this.mActiveColorMode = colorMode; this.mActiveColorModeInvalid = false; return true; } public void dumpLocked(PrintWriter pw) { super.dumpLocked(pw); pw.println("mBuiltInDisplayId=" + this.mBuiltInDisplayId); pw.println("mActivePhysIndex=" + this.mActivePhysIndex); pw.println("mActiveModeId=" + this.mActiveModeId); pw.println("mActiveColorMode=" + this.mActiveColorMode); pw.println("mState=" + Display.stateToString(this.mState)); pw.println("mBrightness=" + this.mBrightness); pw.println("mBacklight=" + this.mBacklight); pw.println("mDisplayInfos="); for (int i = 0; i < this.mDisplayInfos.length; i++) { pw.println(" " + this.mDisplayInfos[i]); } pw.println("mSupportedModes="); for (int i2 = 0; i2 < this.mSupportedModes.size(); i2++) { pw.println(" " + this.mSupportedModes.valueAt(i2)); } pw.print("mSupportedColorModes=["); for (int i3 = 0; i3 < this.mSupportedColorModes.size(); i3++) { if (i3 != 0) { pw.print(", "); } pw.print(this.mSupportedColorModes.get(i3)); } pw.println("]"); } private int findDisplayInfoIndexLocked(int modeId) { DisplayModeRecord record = this.mSupportedModes.get(modeId); if (record != null) { for (int i = 0; i < this.mDisplayInfos.length; i++) { if (record.hasMatchingMode(this.mDisplayInfos[i])) { return i; } } } return -1; } private void updateDeviceInfoLocked() { this.mInfo = null; LocalDisplayAdapter.this.sendDisplayDeviceEventLocked(this, 2); } } private class SettingsObserver extends ContentObserver { SettingsObserver(Handler handler) { super(handler); registerContentObserver(UserHandle.myUserId()); boolean z = true; boolean unused = LocalDisplayAdapter.this.mDeviceProvisioned = Settings.Secure.getIntForUser(LocalDisplayAdapter.this.mResolver, "device_provisioned", 0, ActivityManager.getCurrentUser()) != 0; int unused2 = LocalDisplayAdapter.this.mTrikeyNaviMode = Settings.System.getIntForUser(LocalDisplayAdapter.this.mResolver, "swap_key_position", LocalDisplayAdapter.this.defaultNaviMode, ActivityManager.getCurrentUser()); int unused3 = LocalDisplayAdapter.this.mButtonLightMode = Settings.System.getIntForUser(LocalDisplayAdapter.this.mResolver, "button_light_mode", 1, ActivityManager.getCurrentUser()); boolean unused4 = LocalDisplayAdapter.this.mIsGestureNavEnable = LocalDisplayAdapter.this.mIsGestureNavEnable = Settings.Secure.getIntForUser(LocalDisplayAdapter.this.mResolver, LocalDisplayAdapter.GESTURE_NAVIGATION, 0, ActivityManager.getCurrentUser()) == 0 ? false : z; } public void registerContentObserver(int userId) { LocalDisplayAdapter.this.mResolver.registerContentObserver(Settings.System.getUriFor("device_provisioned"), false, this, userId); LocalDisplayAdapter.this.mResolver.registerContentObserver(Settings.System.getUriFor("swap_key_position"), false, this, userId); LocalDisplayAdapter.this.mResolver.registerContentObserver(Settings.System.getUriFor("button_light_mode"), false, this, userId); LocalDisplayAdapter.this.mResolver.registerContentObserver(Settings.Secure.getUriFor(LocalDisplayAdapter.GESTURE_NAVIGATION), false, this, userId); } public void onChange(boolean selfChange) { boolean z = true; boolean unused = LocalDisplayAdapter.this.mDeviceProvisioned = Settings.Secure.getIntForUser(LocalDisplayAdapter.this.mResolver, "device_provisioned", 0, ActivityManager.getCurrentUser()) != 0; int unused2 = LocalDisplayAdapter.this.mTrikeyNaviMode = Settings.System.getIntForUser(LocalDisplayAdapter.this.mResolver, "swap_key_position", LocalDisplayAdapter.this.defaultNaviMode, ActivityManager.getCurrentUser()); int unused3 = LocalDisplayAdapter.this.mButtonLightMode = Settings.System.getIntForUser(LocalDisplayAdapter.this.mResolver, "button_light_mode", 1, ActivityManager.getCurrentUser()); LocalDisplayAdapter localDisplayAdapter = LocalDisplayAdapter.this; if (Settings.Secure.getIntForUser(LocalDisplayAdapter.this.mResolver, LocalDisplayAdapter.GESTURE_NAVIGATION, 0, ActivityManager.getCurrentUser()) == 0) { z = false; } boolean unused4 = localDisplayAdapter.mIsGestureNavEnable = z; Slog.i(LocalDisplayAdapter.TAG, "mTrikeyNaviMode:" + LocalDisplayAdapter.this.mTrikeyNaviMode + " mButtonLightMode:" + LocalDisplayAdapter.this.mButtonLightMode + " mIsGestureNavEnable:" + LocalDisplayAdapter.this.mIsGestureNavEnable); } } private class UserSwtichReceiver extends BroadcastReceiver { private UserSwtichReceiver() { } public void onReceive(Context context, Intent intent) { if (!(intent == null || intent.getAction() == null || !"android.intent.action.USER_SWITCHED".equals(intent.getAction()))) { int newUserId = intent.getIntExtra("android.intent.extra.user_handle", UserHandle.myUserId()); Slog.i(LocalDisplayAdapter.TAG, "UserSwtichReceiver:" + newUserId); if (LocalDisplayAdapter.this.mSettingsObserver != null) { LocalDisplayAdapter.this.mSettingsObserver.registerContentObserver(newUserId); LocalDisplayAdapter.this.mSettingsObserver.onChange(true); } } } } public LocalDisplayAdapter(DisplayManagerService.SyncRoot syncRoot, Context context, Handler handler, DisplayAdapter.Listener listener) { super(syncRoot, context, handler, listener, TAG); } public void registerLocked() { super.registerLocked(); this.mHotplugReceiver = new HotplugDisplayEventReceiver(getHandler().getLooper()); for (int builtInDisplayId : BUILT_IN_DISPLAY_IDS_TO_SCAN) { tryConnectDisplayLocked(builtInDisplayId); } if (HwPCUtils.enabledInPad()) { HwPCUtils.log(TAG, "tryConnectPadVirtualDisplayLocked"); tryConnectDisplayLocked(PAD_DISPLAY_ID); } } /* access modifiers changed from: private */ public void tryConnectDisplayLocked(int builtInDisplayId) { LocalDisplayDevice device; int i = builtInDisplayId; IBinder displayToken = SurfaceControl.getBuiltInDisplay(builtInDisplayId); if (i == PAD_DISPLAY_ID) { displayToken = SurfaceControl.getBuiltInDisplay(0); } IBinder displayToken2 = displayToken; if (displayToken2 != null) { SurfaceControl.PhysicalDisplayInfo[] configs = SurfaceControl.getDisplayConfigs(displayToken2); if (configs == null) { Slog.w(TAG, "No valid configs found for display device " + i); return; } int activeConfig = SurfaceControl.getActiveConfig(displayToken2); if (activeConfig < 0) { Slog.w(TAG, "No active config found for display device " + i); return; } int activeColorMode = SurfaceControl.getActiveColorMode(displayToken2); if (activeColorMode < 0) { Slog.w(TAG, "Unable to get active color mode for display device " + i); activeColorMode = -1; } int activeColorMode2 = activeColorMode; int[] colorModes = SurfaceControl.getDisplayColorModes(displayToken2); LocalDisplayDevice device2 = this.mDevices.get(i); if (device2 == null) { if (i != 0 && i != PAD_DISPLAY_ID) { device = new LocalDisplayDevice(this, displayToken2, i, configs, activeConfig, colorModes, activeColorMode2); } else if (this.mHwFoldScreenState != null || !HwFoldScreenState.isFoldScreenDevice()) { device = new LocalDisplayDevice(this, displayToken2, i, configs, activeConfig, colorModes, activeColorMode2); } else { this.mHwFoldScreenState = HwServiceFactory.getHwFoldScreenState(getContext()); Slog.d(TAG, "new LocalDisplayDevice() builtInDisplayId=" + i); LocalDisplayDevice localDisplayDevice = device2; device = new LocalDisplayDevice(displayToken2, i, configs, activeConfig, colorModes, activeColorMode2, this.mHwFoldScreenState); } this.mDevices.put(i, device); sendDisplayDeviceEventLocked(device, 1); } else { LocalDisplayDevice device3 = device2; if (device3.updatePhysicalDisplayInfoLocked(configs, activeConfig, colorModes, activeColorMode2)) { sendDisplayDeviceEventLocked(device3, 2); } } } } /* access modifiers changed from: private */ public void tryDisconnectDisplayLocked(int builtInDisplayId) { LocalDisplayDevice device = this.mDevices.get(builtInDisplayId); if (device != null) { this.mDevices.remove(builtInDisplayId); sendDisplayDeviceEventLocked(device, 3); } } static int getPowerModeForState(int state) { if (state == 1) { return 0; } if (state == 6) { return 4; } switch (state) { case 3: return 1; case 4: return 3; default: return 2; } } public void registerContentObserver(Context context, Handler handler) { if (context != null && FRONT_FINGERPRINT_NAVIGATION && FRONT_FINGERPRINT_NAVIGATION_TRIKEY == 1) { try { this.mResolver = context.getContentResolver(); this.mSettingsObserver = new SettingsObserver(handler); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction("android.intent.action.USER_SWITCHED"); context.registerReceiver(new UserSwtichReceiver(), intentFilter); } catch (Exception exp) { Log.e(TAG, "registerContentObserver:" + exp.getMessage()); } } } /* access modifiers changed from: private */ public boolean isButtonLightTimeout() { return SystemProperties.getBoolean("sys.button.light.timeout", false); } /* access modifiers changed from: private */ public void setButtonLightTimeout(boolean timeout) { SystemProperties.set("sys.button.light.timeout", String.valueOf(timeout)); } /* access modifiers changed from: private */ public boolean isGestureNavEnable() { return FRONT_FINGERPRINT_GESTURE_NAVIGATION_SUPPORTED && this.mIsGestureNavEnable; } /* access modifiers changed from: package-private */ public Context getOverlayContext() { return ActivityThread.currentActivityThread().getSystemUiContext(); } public void pcDisplayChangeService(boolean connected) { if (HwPCUtils.enabledInPad()) { Slog.w(TAG, "pcDisplayChangeService connected = " + connected); synchronized (getSyncRoot()) { if (connected) { try { if (this.mDevices.get(PAD_DISPLAY_ID) == null) { Slog.w(TAG, "pcDisplayChangeService tryDisconnectDisplayLocked"); tryConnectDisplayLocked(PAD_DISPLAY_ID); } } catch (Throwable th) { throw th; } } else { Slog.w(TAG, "pcDisplayChangeService tryDisconnectDisplayLocked"); tryDisconnectDisplayLocked(PAD_DISPLAY_ID); } } } } }
[ "dstmath@163.com" ]
dstmath@163.com