blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d78b2f281590f1b5a57dc0a4acc53c92f94e5dae | 214e2ccb93d31090b57c9955e83a8451ff4ae6c7 | /app/src/main/java/com/simens/us/myapplication/Network/ProtocolListener.java | 4b140da80e32f1f0b00e37448e2dbe4865019cf7 | [] | no_license | KumaPark/KumaProduct | d97ebbb905a9b5d62b0565c6e4b172ae1165a902 | bb1aa0f1483f28b58ac6c5880d3ccf5aeb4bb961 | refs/heads/master | 2021-04-27T15:51:43.765018 | 2019-12-03T14:03:43 | 2019-12-03T14:03:43 | 122,478,866 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 223 | java | package com.simens.us.myapplication.Network;
import com.simens.us.myapplication.Network.response.ResponseProtocol;
public interface ProtocolListener {
public void onResponse(int tag, ResponseProtocol resProtocol);
}
| [
"lionska83@gmail.com"
] | lionska83@gmail.com |
4817a228aab029b3c3d6a1936a6fc631bae4c745 | a948ba58f9013686dc645558d858940a2652c851 | /app/src/test/java/com/example/weatheralerts/ExampleUnitTest.java | 3cbccf7041d480e335bce41798e2824c660eb602 | [] | no_license | blooney100/WeatherAlerts | ce6978ec23bbb995c8f83d6ec0dfa71ee24e08ac | 7761b21610bcde2b494de2f489bb88005b782295 | refs/heads/master | 2020-04-27T22:38:18.450220 | 2019-03-09T20:41:56 | 2019-03-09T20:41:56 | 174,743,237 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.example.weatheralerts;
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);
}
} | [
"brian@looneyconsulting.net"
] | brian@looneyconsulting.net |
2fa4f0eda04717fbad4f1f85ed3621892977213b | b6f8c56b30a306bce5780b60f549bc66e7382fb3 | /AlarmGame/My_Plugin/Android/My_Plugin_Android/My_Plugin/src/main/java/android/unity/myplugin/CheckAlarmService.java | 9e0af43fd1b2b89a1b494022259009bec3085610 | [] | no_license | Sarenias/NewAlarmApp | 1654528e1025cccbb6ef270baac35364e66cef92 | 102cc30636674f6a43d75a101d3753f0c233c5e5 | refs/heads/master | 2020-09-14T08:12:31.709709 | 2017-06-15T19:20:06 | 2017-06-15T19:20:06 | 94,471,006 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 580 | java | package android.unity.myplugin;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
/**
* Created by Sarenias on 5/31/2017.
*/
public class CheckAlarmService extends Service {
public void onCreate()
{
super.onCreate();
}
@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
BackgroundAlarm alarm = new BackgroundAlarm();
alarm.setAlarm(this, intent);
return START_STICKY;
}
public IBinder onBind(Intent intent)
{
return null;
}
}
| [
"jenna.graves@centre.edu"
] | jenna.graves@centre.edu |
2028ebdee97e9c4de41572302d7fb4f2faaf336d | 13cbb329807224bd736ff0ac38fd731eb6739389 | /sun/reflect/SignatureIterator.java | 0f79929352c2b6412f70cea372a4564e524b0687 | [] | no_license | ZhipingLi/rt-source | 5e2537ed5f25d9ba9a0f8009ff8eeca33930564c | 1a70a036a07b2c6b8a2aac6f71964192c89aae3c | refs/heads/master | 2023-07-14T15:00:33.100256 | 2021-09-01T04:49:04 | 2021-09-01T04:49:04 | 401,933,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,163 | java | package sun.reflect;
public class SignatureIterator {
private final String sig;
private int idx;
public SignatureIterator(String paramString) {
this.sig = paramString;
reset();
}
public void reset() { this.idx = 1; }
public boolean atEnd() { return (this.sig.charAt(this.idx) == ')'); }
public String next() {
if (atEnd())
return null;
char c = this.sig.charAt(this.idx);
if (c != '[' && c != 'L') {
this.idx++;
return new String(new char[] { c });
}
int i = this.idx;
if (c == '[')
while ((c = this.sig.charAt(i)) == '[')
i++;
if (c == 'L')
while (this.sig.charAt(i) != ';')
i++;
int j = this.idx;
this.idx = i + 1;
return this.sig.substring(j, this.idx);
}
public String returnType() {
if (!atEnd())
throw new InternalError("Illegal use of SignatureIterator");
return this.sig.substring(this.idx + 1, this.sig.length());
}
}
/* Location: D:\software\jd-gui\jd-gui-windows-1.6.3\rt.jar!\sun\reflect\SignatureIterator.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 1.0.7
*/ | [
"michael__lee@yeah.net"
] | michael__lee@yeah.net |
dc86cee18f2447b7fd663680a64cf6f0f5212da6 | af6d57d9e9f0d78fee0d30760808ff95129171dd | /permissionslibrary/src/main/java/com/tao/permissionslibrary/PermissionsChecker.java | 5bc1f99308b05b78c2ebf8f97f416f13ac6f33ee | [] | no_license | dhtyogor/PermissionsTools-demo | 4ed4f73725762a910bb5077c158b62afc1e8dcd9 | 0b846b8cb3dc2d8bee327ffb393081beed5b1d7e | refs/heads/master | 2021-01-13T09:59:32.769434 | 2016-10-28T09:30:49 | 2016-10-28T09:30:49 | 72,194,064 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 866 | java | package com.tao.permissionslibrary;
import android.content.Context;
import android.content.pm.PackageManager;
import android.support.v4.content.ContextCompat;
/**
* Created by Tao on 2016/4/20.
*/
public class PermissionsChecker {
private final Context mContext;
public PermissionsChecker(Context context) {
mContext = context.getApplicationContext();
}
// 判断权限集合
public boolean lacksPermissions(String... permissions) {
for (String permission : permissions) {
if (lacksPermission(permission)) {
return true;
}
}
return false;
}
// 判断是否缺少权限
private boolean lacksPermission(String permission) {
return ContextCompat.checkSelfPermission(mContext, permission) ==
PackageManager.PERMISSION_DENIED;
}
}
| [
"18801147313@163.com"
] | 18801147313@163.com |
4ee09a2680fdbcfe9ac14c5249e5e2c4bc644a83 | 597e6b9b9ac35a32d44d219980cf9c32bd87bff9 | /Marvin/src/main/java/kutch/biff/marvin/widget/SteelLCDWidget.java | 78c021a5500b3f0f37f48bc2798d24f70b21591b | [
"Apache-2.0"
] | permissive | netronome-support/BIFF | 90394d9e9bc9e71e18b2d5415a4c28146723a424 | ae1c7e2b7bd0601eab9630a076fc52e6148920f8 | refs/heads/master | 2020-03-23T10:20:56.154367 | 2018-07-18T13:38:34 | 2018-07-18T13:38:34 | 141,438,303 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,536 | java | /*
* ##############################################################################
* # Copyright (c) 2016 Intel Corporation
* #
* # Licensed under the Apache License, Version 2.0 (the "License");
* # you may not use this file except in compliance with the License.
* # You may obtain a copy of the License at
* #
* # http://www.apache.org/licenses/LICENSE-2.0
* #
* # Unless required by applicable law or agreed to in writing, software
* # distributed under the License is distributed on an "AS IS" BASIS,
* # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* # See the License for the specific language governing permissions and
* # limitations under the License.
* ##############################################################################
* # File Abstract:
* #
* #
* ##############################################################################
*/
package kutch.biff.marvin.widget;
import eu.hansolo.enzo.lcd.Lcd;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.ObservableList;
import javafx.scene.layout.GridPane;
import kutch.biff.marvin.datamanager.DataManager;
import kutch.biff.marvin.utility.FrameworkNode;
/**
*
* @author Patrick Kutch
*/
public class SteelLCDWidget extends BaseWidget
{
private static double aspectRatio = 2.75;
private Lcd _LCD = null;
private String UnitText;
private boolean ShowMeasuredMax;
private boolean ShowMeasuredMin;
private double MinValue;
private double MaxValue;
private boolean KeepAspectRatio;
private boolean _TextMode;
private String _InitialValue="";
public SteelLCDWidget()
{
_LCD = new Lcd();
KeepAspectRatio = true;
_TextMode = false;
UnitText = "";
_LCD.setAnimationDuration(300);
}
@Override
public javafx.scene.Node getStylableObject()
{
return _LCD;
}
@Override
public ObservableList<String> getStylesheets()
{
return _LCD.getStylesheets();
}
@Override
public boolean Create(GridPane pane, DataManager dataMgr)
{
SetParent(pane);
if (false == SetupLCD())
{
return false;
}
if (_InitialValue.length()>0)
{
SetValue(_InitialValue);
}
ConfigureAlignment();
ConfigureDimentions();
pane.add(_LCD, getColumn(), getRow(), getColumnSpan(), getRowSpan());
SetupPeekaboo(dataMgr);
dataMgr.AddListener(getMinionID(), getNamespace(), new ChangeListener()
{
@Override
public void changed(ObservableValue o, Object oldVal, Object newVal)
{
if (IsPaused())
{
return;
}
SetValue(newVal.toString());
}
});
SetupTaskAction();
return ApplyCSS();
}
@Override
public void SetInitialValue(String value)
{
_InitialValue = value;
}
public boolean getTextMode()
{
return _TextMode;
}
public void setTextMode(boolean newMode)
{
_TextMode = newMode;
_LCD.setTextMode(newMode);
if (newMode)
{
_LCD.setDecimals(0);
}
else
{
_LCD.setDecimals(getDecimalPlaces());
}
}
public void SetValue(String newVal)
{
if (true || !_TextMode)
{
double newDialValue;
String strVal = newVal;
try
{
newDialValue = Double.parseDouble(strVal);
setTextMode(false);
}
catch (NumberFormatException ex)
{
_LCD.setText(strVal);
return;
}
_LCD.setValue(newDialValue);
}
else
{
_LCD.setText(newVal);
}
}
private boolean SetupLCD()
{
if (!_TextMode)
{
_LCD.setMinMeasuredValueVisible(ShowMeasuredMin);
_LCD.setMaxMeasuredValueVisible(ShowMeasuredMax);
_LCD.setMaxValue(getMaxValue());
_LCD.setKeepAspect(KeepAspectRatio);
_LCD.setDecimals(getDecimalPlaces());
}
if (getTitle().length() > 0)
{
_LCD.setTitle(getTitle());
}
if (null != getUnitsOverride())
{
_LCD.setUnit(getUnitsOverride());
LOGGER.config("Overriding Widget Units Text to " + getUnitsOverride());
}
else if (UnitText.length() > 0)
{
_LCD.setUnit(UnitText);
}
_LCD.setCrystalOverlayVisible(true); //'rgainy, LCD like overlay, very subtle
return true;
}
public String getUnitText()
{
return UnitText;
}
public void setUnitText(String UnitText)
{
this.UnitText = UnitText;
}
public boolean isShowMeasuredMax()
{
return ShowMeasuredMax;
}
public void setShowMeasuredMax(boolean ShowMeasuredMax)
{
this.ShowMeasuredMax = ShowMeasuredMax;
}
public boolean isShowMeasuredMin()
{
return ShowMeasuredMin;
}
public void setShowMeasuredMin(boolean ShowMeasuredMin)
{
this.ShowMeasuredMin = ShowMeasuredMin;
}
public double getMinValue()
{
return MinValue;
}
public void setMinValue(double MinValue)
{
this.MinValue = MinValue;
}
public double getMaxValue()
{
return MaxValue;
}
public void setMaxValue(double MaxValue)
{
this.MaxValue = MaxValue;
}
public boolean isKeepAspectRatio()
{
return KeepAspectRatio;
}
public void setKeepAspectRatio(boolean KeepAspectRation)
{
this.KeepAspectRatio = KeepAspectRation;
}
@Override
protected void ConfigureDimentions()
{
if (KeepAspectRatio)
{
if (getWidth() > 0)
{
setHeight(getWidth() / aspectRatio);
}
else if (getHeight() > 0)
{
setWidth(getHeight() * aspectRatio);
}
}
super.ConfigureDimentions();
}
/**
* Sets range for widget - not valid for all widgets
*
* @param rangeNode
* @return
*/
@Override
public boolean HandleValueRange(FrameworkNode rangeNode)
{
double Min = -1234.5678;
double Max = -1234.5678;
if (rangeNode.hasAttribute("Min"))
{
Min = rangeNode.getDoubleAttribute("Min", Min);
if (Min == -1234.5678)
{
return false;
}
this.MinValue = Min;
}
if (rangeNode.hasAttribute("Max"))
{
Max = rangeNode.getDoubleAttribute("Max", Max);
if (Max == -1234.5678)
{
return false;
}
this.MaxValue = Max;
}
return true;
}
@Override
public void UpdateTitle(String strTitle)
{
_LCD.setTitle(strTitle);
}
}
| [
"root@LAPTOP-TMJ9A534.localdomain"
] | root@LAPTOP-TMJ9A534.localdomain |
94f450765316ad7b4147552a9f5b7523f2b3476e | c1b29ae46d02b46bffdb1e672006660ce15f0f01 | /src/main/java/com/uchain/networkmanager/message/MessageType.java | aa3e6b332bd7d499d85ed9d9c08395513beceeb6 | [] | no_license | UCHAIN-WORLD/uchain-core | 47c1692d7290b7d030cd2fcae8a2c0781679777c | 10feba7bcf8f8fe622826795bb1dc8cda75840c7 | refs/heads/master | 2020-03-28T10:33:37.796634 | 2019-02-22T07:00:38 | 2019-02-22T07:00:38 | 148,120,183 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 962 | java | package com.uchain.networkmanager.message;
public enum MessageType {
Version(0), BlockProduced(1), GetBlocks(2), Block(3), Blocks(4), Inventory(5),Getdata(6), Transactions(7), RPCCommand(8);
private int value;
private MessageType(int value) {
this.value = value;
}
public static int getMessageTypeByType(MessageType messageType) {
for (MessageType c : MessageType.values()) {
if (c.value == messageType.value) {
return c.value;
}
}
return 100;
}
public static String getMessageTypeStringByType(MessageType messageType) {
for (MessageType c : MessageType.values()) {
if (c.value == messageType.value) {
return c.toString();
}
}
return "";
}
public static MessageType getMessageTypeByValue(byte value) {
for (MessageType c : MessageType.values()) {
if ((byte)c.value == value) {
return c;
}
}
return null;
}
}
| [
"416841146@qq.com"
] | 416841146@qq.com |
cf24acf08b3814629a4aa83322fd2510e902b79d | b8dbe516dde16b1d0288bb33a1c0fdb63c7d3e67 | /12WADMVC/src/java/paquete/ActionForm1.java | a3ba426f03900111752c6eed2bdd966abd6fa212 | [] | no_license | MelisaLuciano/WAD | 10aaeab81e7cdd68816f142a84d4085444012d81 | 0478c5c3f4ca20d70cc60e76491f788bef4b457a | refs/heads/master | 2020-09-22T05:40:41.828972 | 2019-12-06T00:52:49 | 2019-12-06T00:52:49 | 225,070,761 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | 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 paquete;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
/**
*
* @author cat-b
*/
public class ActionForm1 extends org.apache.struts.action.ActionForm {
private String nombre;
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
9af5471e1196a2472a00546dab0af68f3505a16d | 10b27f1b5095f07bb0dfd733a8168980f32e5d5d | /src/main/java/com/luv2code/springboot/crud/cruddemo/service/EmployeeService.java | affab4b1943c444531a59203c5c6ff76c33c6326 | [] | no_license | kamrulbari14/spring-rest-api-data-jpa | 4e5eaf549c99d4e4f16436a9549a605a068f91da | 2069faa5896ec4e476d82c3cd24f518d2648f5c6 | refs/heads/master | 2023-02-22T02:10:48.170376 | 2021-01-24T19:27:55 | 2021-01-24T19:27:55 | 332,536,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.luv2code.springboot.crud.cruddemo.service;
import com.luv2code.springboot.crud.cruddemo.entity.Employee;
import java.util.List;
public interface EmployeeService {
public List<Employee> findAll();
public Employee findById(int theId);
public void saveEmployee(Employee employee);
public void deleteById(int theId);
}
| [
"kamrulbpriyo0523@gmail.com"
] | kamrulbpriyo0523@gmail.com |
7503b8ab49f78fba8734bff97816f5d5813db00e | 44e18ca299a845b1df0135552d20fc14ba023e76 | /ph-commons/src/main/java/com/helger/commons/mutable/INumber.java | 0e3c498a0db7ba2d8811aa02c4939e388ec1ad1c | [
"Apache-2.0"
] | permissive | dliang2000/ph-commons | fb25f68f840e1ee0c5a6086498f681209738009d | 397300ee7fb81bfa7dd4f8665d13ce7e0e6fe09a | refs/heads/master | 2022-07-03T03:39:21.618644 | 2020-05-04T00:28:55 | 2020-05-08T04:03:28 | 260,987,902 | 1 | 0 | null | 2020-05-03T17:51:16 | 2020-05-03T17:51:16 | null | UTF-8 | Java | false | false | 2,762 | java | /**
* Copyright (C) 2014-2020 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.commons.mutable;
import java.io.Serializable;
/**
* Base interface comparable to {@link Number} - but an interface and not an
* abstract class.
*
* @author Philip Helger
*/
public interface INumber extends Serializable
{
/**
* Returns the value of the specified number as an {@code int}, which may
* involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion to
* type {@code int}.
*/
int intValue ();
/**
* Returns the value of the specified number as a {@code long}, which may
* involve rounding or truncation.
*
* @return the numeric value represented by this object after conversion to
* type {@code long}.
*/
long longValue ();
/**
* Returns the value of the specified number as a {@code float}, which may
* involve rounding.
*
* @return the numeric value represented by this object after conversion to
* type {@code float}.
*/
float floatValue ();
/**
* Returns the value of the specified number as a {@code double}, which may
* involve rounding.
*
* @return the numeric value represented by this object after conversion to
* type {@code double}.
*/
double doubleValue ();
/**
* Returns the value of the specified number as a {@code byte}, which may
* involve rounding or truncation.
* <p>
* This implementation returns the result of {@link #intValue} cast to a
* {@code byte}.
*
* @return the numeric value represented by this object after conversion to
* type {@code byte}.
*/
default byte byteValue ()
{
return (byte) intValue ();
}
/**
* Returns the value of the specified number as a {@code short}, which may
* involve rounding or truncation.
* <p>
* This implementation returns the result of {@link #intValue} cast to a
* {@code short}.
*
* @return the numeric value represented by this object after conversion to
* type {@code short}.
*/
default short shortValue ()
{
return (short) intValue ();
}
}
| [
"philip@helger.com"
] | philip@helger.com |
4446cf0b5463c5d280c1f2542f006dc67d300ca6 | 981ce99a47ec42b34cbb404ba28a4a3d4559b601 | /src/main/java/template/NpcDrop.java | c552d445ebe7c493d800b2855d5df75024e8c3e3 | [] | no_license | kristomangol/l2onParser | 0120955ee88f6bfec369c9188674340372863719 | d679efbc727e9cc0d66662e208cf747c70dc0b06 | refs/heads/master | 2021-01-10T08:35:09.764480 | 2015-11-03T23:59:30 | 2015-11-03T23:59:30 | 45,502,333 | 1 | 3 | null | null | null | null | UTF-8 | Java | false | false | 742 | java | package template;
import java.math.BigDecimal;
/**
* Create by Mangol on 31.10.2015.
*/
public class NpcDrop
{
private final int itemId;
private final String name;
private final long countMin;
private final long countMax;
private final BigDecimal chance;
public NpcDrop(int itemId, String name, long countMin, long countMax, BigDecimal chance)
{
this.itemId = itemId;
this.name = name;
this.countMin = countMin;
this.countMax = countMax;
this.chance = chance;
}
public int getItemId()
{
return itemId;
}
public String getName()
{
return name;
}
public long getCountMin()
{
return countMin;
}
public long getCountMax()
{
return countMax;
}
public BigDecimal getChance()
{
return chance;
}
}
| [
"linice@bk.ru"
] | linice@bk.ru |
0c79cb45f3ff806d214ab44a3675387392dbc116 | de3bdd177f664b5fa15f01f0f2afb17a604b46e1 | /app/src/main/java/br/usjt/deswebmob/servicedeskcco/DetalheChamadoActivity.java | 06fb34cca5711c9b61498205dc41718457f48316 | [] | no_license | pedroariel/ServiceDeskCCO | 75a051feaa2c0821db426ae3e63918e3010225e9 | 941a69e632b06464a4fdd17d75f827f68a566e29 | refs/heads/master | 2021-04-15T13:59:03.718338 | 2018-03-22T23:50:31 | 2018-03-22T23:50:31 | 126,408,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 712 | java | package br.usjt.deswebmob.servicedeskcco;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import br.usjt.deswebmob.servicedeskcco.model.Chamado;
public class DetalheChamadoActivity extends Activity {
TextView txtNome;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detalhe_chamado);
txtNome = (TextView)findViewById(R.id.chamado_nome);
Intent intent = getIntent();
Chamado chamado = intent.getSerializableExtra(ListarChamadosActivity.CHAMADO);
txtNome.setText(chamado.getDescricao());
}
}
| [
"arqdsis@mocli10205.animaedu.intranet"
] | arqdsis@mocli10205.animaedu.intranet |
045a1fe58c6ba4fac227709f7271a7799dafbc07 | 4a0f932f1f1b6e47662b8993377cce1d122cd7b8 | /src/test/java/com/cn/template/xutil/mail/HTMLSpirit.java | e93908e60454f02c033fdb4718a3a31dfb5266dd | [] | no_license | rong1005/template | 244934af4f6848d42f2aaf7c1d7f6d278f404684 | 66ccedbcdf074a93186c2d38ae7838c026b57de0 | refs/heads/master | 2016-09-06T21:24:23.123524 | 2014-09-22T13:02:39 | 2014-09-22T13:02:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,184 | java | package com.cn.template.xutil.mail;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class HTMLSpirit {
private static final String regEx_script = "<script[^>]*?>[\\s\\S]*?<\\/script>"; // 定义script的正则表达式
private static final String regEx_style = "<style[^>]*?>[\\s\\S]*?<\\/style>"; // 定义style的正则表达式
private static final String regEx_html = "<[^>]+>"; // 定义HTML标签的正则表达式
public static String delHTMLTag(String htmlStr) {
Pattern p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
Matcher m_script = p_script.matcher(htmlStr);
htmlStr = m_script.replaceAll(""); // 过滤script标签
Pattern p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
Matcher m_style = p_style.matcher(htmlStr);
htmlStr = m_style.replaceAll(""); // 过滤style标签
Pattern p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
Matcher m_html = p_html.matcher(htmlStr);
htmlStr = m_html.replaceAll(""); // 过滤html标签
return htmlStr.trim(); // 返回文本字符串
}
} | [
"rong_1005@163.com"
] | rong_1005@163.com |
1c11b258497b67375c0d79170622d8757ca00882 | 756e8262d78c9599f07e59ac8c2adca585d4a287 | /EJERCICIOS_Autor/cap 15/EjecutaRegEmpleado1.java | aded098b600c40bd764dff703ac3a15bd7137c8f | [] | no_license | SergioFarid/Metodologia_POO | daa0a624efb380655f2d0fd13453ce8fac944c8c | 41f4b0257e2dbe5e40162f26571ecc6e47b3bf56 | refs/heads/master | 2023-08-22T04:15:29.098160 | 2021-10-24T15:17:24 | 2021-10-24T15:17:24 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 2,185 | java | // Programa LEE E IMPRIME REGISTROS DE EMPLEADOS
// Elaborado por: Leobardo López Román
// Esta formado por dos clases: RegEmpleado1 y EjecutaRegEmpleado1
// EjecutaRegEmpleado1.java
import java.util.Scanner;
import java.io.*;
public class EjecutaRegEmpleado1
{
public static void main(String args[]) throws IOException
{
// Crear objeto para entrada de datos por el teclado
Scanner entrada = new Scanner(System.in);
String entradaChar;
char desea;
int numEmp;
String nomEmp;
int depEmp;
int pueEmp;
float sueEmp;
do
{
RegEmpleado1 objEmpleado = new RegEmpleado1();
System.out.println("-------- Entrada de datos del empleado --------");
System.out.print("Teclee numero: ");
numEmp = entrada.nextInt();
entrada.nextLine();
System.out.print("Teclee nombre: ");
nomEmp = entrada.nextLine();
System.out.print("Teclee departamento: ");
depEmp = entrada.nextInt();
System.out.print("Teclee puesto: ");
pueEmp = entrada.nextInt();
System.out.print("Teclee sueldo: ");
sueEmp = entrada.nextFloat();
objEmpleado.establecerNumero(numEmp);
objEmpleado.establecerNombreEmp(nomEmp);
objEmpleado.establecerDepto(depEmp);
objEmpleado.establecerPuesto(pueEmp);
objEmpleado.establecerSueldo(sueEmp);
System.out.println("------Salida de informacion del empleado ------");
System.out.println("Numero = " + objEmpleado.obtenerNumero());
System.out.println("Nombre = " + objEmpleado.obtenerNombreEmp());
System.out.println("Departamento = " + objEmpleado.obtenerDepto());
System.out.println("Puesto = " + objEmpleado.obtenerPuesto());
System.out.println("Sueldo = " + objEmpleado.obtenerSueldo());
System.out.print("\n¿Otro empleado(S/N)?: ");
entradaChar = entrada.next();
desea = entradaChar.charAt(0);
entrada.nextLine();
} while (desea == 'S' || desea == 's');
}
} | [
"te.puy@hotmail.com"
] | te.puy@hotmail.com |
36eb7b76782eb86d83b65c97f3d4de626148f621 | 0faebb6405b41748c96d34b80633ebde97ab4ef4 | /src/test/java/delta/common/utils/i18n/TestI18n.java | 293f013278a4a22ad52c0d127ac7c0543c2bd9fe | [] | no_license | dmorcellet/delta-common | 8231550435866ac8136489de9eeb6a35547a73ba | 114c9843c5f1a76f2e6ebfbc4fd6b29bd279f2a0 | refs/heads/master | 2023-08-16T15:47:59.797952 | 2023-08-04T15:26:22 | 2023-08-04T15:26:22 | 79,831,761 | 0 | 1 | null | 2022-11-17T06:59:20 | 2017-01-23T18:01:15 | Java | UTF-8 | Java | false | false | 841 | java | package delta.common.utils.i18n;
import org.apache.log4j.Logger;
import junit.framework.TestCase;
/**
* Internationalization test.
* @author DAM
*/
public class TestI18n extends TestCase
{
private static final Logger LOGGER=Logger.getLogger(TestI18n.class);
private static final Translator _translator=TranslatorsManager.getInstance().createTranslator(TestI18n.class);
/**
* Constructor.
*/
public TestI18n()
{
super("I18N test");
}
/**
* Test basic i18n usage.
*/
public void testTranslation()
{
String simpleMsg=_translator.translate("test");
LOGGER.info("Translation for 'test' : '"+simpleMsg+"'");
Object[] params=new String[] {"1", "2", "3"};
String complexMsg=_translator.translate("test_args",params);
LOGGER.info("Translation for 'test_args' : '"+complexMsg+"'");
}
}
| [
"dmorcellet@free.fr"
] | dmorcellet@free.fr |
b21c6fbd7a2dd210d596185f1b4f0152cee8ef85 | 5a4a5bc94a939e0ef94e8014b639d54e2c96ec18 | /Regex_task5/src/main/java/org/Marta/PasswordValidator.java | 93a1bd774db762a6fd038ce3b3c7bd5609791f58 | [] | no_license | MartaKwiatek/future_collars_tasks | 5a6717c967a312c62eb935fc799def0b366ebe8b | 6d2d9695be486fd26167b0dd77badf6c7bc9c70c | refs/heads/master | 2023-05-14T04:45:34.502180 | 2021-06-03T14:57:42 | 2021-06-03T14:57:42 | 352,951,907 | 0 | 0 | null | 2021-06-08T11:04:23 | 2021-03-30T09:56:05 | Java | UTF-8 | Java | false | false | 665 | java | package org.Marta;
import java.time.LocalDateTime;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class PasswordValidator {
private static String year = String.valueOf(LocalDateTime.now().getYear());
private static String year2 = year.substring(2,4);
private static final Pattern pattern = Pattern.compile("^(?=.*[A-Z])(?=.*[0-9])(?=\\S+$).{7,}$");
public static boolean isValid(String password) {
if (password.contains(year) || password.contains(year2)) {
return false;
} else {
Matcher matcher = pattern.matcher(password);
return matcher.matches();
}
}
}
| [
"marta.kwiatek13@gmail.com"
] | marta.kwiatek13@gmail.com |
77a3737073540bd2850dc89973a364b51c5f8a0e | 047beecf267778c364eb357d8fb6cbccd1e63dd9 | /redisson/src/main/java/org/redisson/api/geo/BaseOptionalGeoSearch.java | fa9d99559c70ef319d6d9587aad88433c1877a00 | [
"Apache-2.0",
"LicenseRef-scancode-dco-1.1"
] | permissive | douglasdan/redisson | a60376803e19b55016c1a7dbafcab6be0fe7bf04 | acbff29eab675ddc6fcfac4e4ae5dbb0f7c3ae45 | refs/heads/master | 2023-03-30T11:45:11.101416 | 2021-03-26T07:11:17 | 2021-03-26T07:11:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,532 | java | /**
* Copyright (c) 2013-2020 Nikita Koksharov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.redisson.api.geo;
import org.redisson.api.GeoOrder;
import java.util.Map;
/**
* @author Nikita Koksharov
*/
class BaseOptionalGeoSearch implements OptionalGeoSearch, GeoSearchNode {
private final Map<Params, Object> params;
BaseOptionalGeoSearch(Map<Params, Object> params) {
this.params = params;
}
@Override
public OptionalGeoSearch count(int value) {
params.put(Params.COUNT, value);
params.remove(Params.COUNT_ANY);
return this;
}
@Override
public OptionalGeoSearch countAny(int value) {
params.put(Params.COUNT, value);
params.put(Params.COUNT_ANY, true);
return this;
}
@Override
public OptionalGeoSearch order(GeoOrder geoOrder) {
params.put(Params.ORDER, geoOrder);
return this;
}
@Override
public Map<Params, Object> getParams() {
return params;
}
}
| [
"nkoksharov@redisson.pro"
] | nkoksharov@redisson.pro |
7df8183ac0bb4175932cd3864511b387f24cf7db | 43c2c6c1593b1d391a03f3a7b5b80dde986824f2 | /src/main/java/duke/learn/elibrary/model/Book.java | 10c5310b4e36cd1753f5ee3c5e40b217720adc15 | [
"MIT"
] | permissive | duketeaches/elibrary-servlet-app | c3388b031c0d863ebbb1837333905137162cf36b | 2eaa4fd6d15b8c3202116c801dd7eed2bbf66479 | refs/heads/master | 2023-05-26T17:32:56.445579 | 2023-05-09T22:36:30 | 2023-05-09T22:36:30 | 199,213,923 | 0 | 0 | MIT | 2023-02-22T08:17:26 | 2019-07-27T21:13:47 | CSS | UTF-8 | Java | false | false | 2,141 | java | /**
*
*/
package duke.learn.elibrary.model;
/**
* @author Kazi
*
*/
public class Book {
private Integer bookId;
private String name;
private String author;
private Integer year;
private String isbn;
private String imagePath;
private String storagePath;
/**
*
* @param bookId
* @param name
* @param author
* @param year
* @param isbn
* @param imagePath
* @param storagePath
*/
public Book(Integer bookId, String name, String author, Integer year, String isbn, String imagePath,
String storagePath) {
super();
this.bookId = bookId;
this.name = name;
this.author = author;
this.year = year;
this.isbn = isbn;
this.imagePath = imagePath;
this.storagePath = storagePath;
}
/**
*
*/
public Book() {
super();
// TODO Auto-generated constructor stub
}
public Integer getBookId() {
return bookId;
}
public void setBookId(Integer bookId) {
this.bookId = bookId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Integer getYear() {
return year;
}
public void setYear(Integer year) {
this.year = year;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
@Override
public String toString() {
return "Book [bookId=" + bookId + ", name=" + name + ", author=" + author + ", year=" + year + ", isbn=" + isbn
+ ", imagePath=" + imagePath + ", storagePath=" + storagePath + "]";
}
public String getImagePath() {
return imagePath;
}
public void setImagePath(String imagePath) {
this.imagePath = imagePath;
}
public String getStoragePath() {
return storagePath;
}
public void setStoragePath(String storagePath) {
this.storagePath = storagePath;
}
}
| [
"kaziabidazad@gmail.com"
] | kaziabidazad@gmail.com |
8be3c90e2d589fd9e6e62e0a0c2b627b37ea9714 | be32522fdae9b0e322201c3777e97d3ec7fb34a6 | /src/design/singleton/lan/TestCase.java | 09e65d46cfd386b19bbd7878f2b1bb72fbc22ca3 | [] | no_license | neuedu-tj/course.java.08-08 | e4705da3d386d5095f949fea1d9b37b6fddfcf24 | 2c571ea0ecae165fee35816d13eddf00c6ff1142 | refs/heads/master | 2020-03-28T00:48:29.110675 | 2018-09-17T08:30:27 | 2018-09-17T08:30:27 | 147,451,250 | 4 | 1 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package design.singleton.lan;
public class TestCase {
public static void main(String[] args) {
Connection c1 = Connection.getInstance();
Connection c2 = Connection.getInstance();
System.out.println( c1== c2 );
}
}
| [
"cofcoltd@qq.com"
] | cofcoltd@qq.com |
b20a35e36698ea9eaaae4e403a2c8a904ee27853 | 60ae606671fb41ef2349d6075723b86efb7cbbe4 | /baizhi-cmfz-sys/src/main/java/com/cmfz/controller/ImageBrowserController.java | ff8ad440b2cd4fb5b0d110e8830898ab5ed22f89 | [] | no_license | SingleNoble/codes | 13bdae64fb7a8ed4b5f50407f85ac2ca27f1d2a2 | 46c48683b8a6c14d9f503531f16a6c6c8d32f772 | refs/heads/master | 2020-06-02T17:35:01.710762 | 2017-06-20T11:12:30 | 2017-06-20T11:12:43 | 94,100,311 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,733 | java | package com.cmfz.controller;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.cmfz.until.FileBrowserUtil;
import org.apache.commons.io.FilenameUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
@Controller
@RequestMapping("/imgs")
public class ImageBrowserController {
//浏览文件
@RequestMapping("/browser")
public void browser(String path, HttpServletRequest request,HttpServletResponse response){
try {
String jsons= FileBrowserUtil.getFiles(request.getSession().getServletContext().getRealPath("/upload"+path),request.getContextPath(), request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort());
response.setCharacterEncoding("utf-8");
response.setContentType("application/json;charset=utf-8");
PrintWriter out = response.getWriter();
out.write(jsons);
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 上传文件
* @param image
* @param request
* @param response
*/
@RequestMapping("/uploadImg")
public void upload(MultipartFile image,HttpServletRequest request,HttpServletResponse response){
Map<String,Object> map=new HashMap<String, Object>();
Map<String, String> message=new HashMap<String, String>();
try {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
String dateDir=simpleDateFormat.format(new Date());
String path=request.getSession().getServletContext().getRealPath("/upload")+"/"+dateDir;
File fileDir=new File(path);
if(!fileDir.exists()){
fileDir.mkdirs();
}
String originalFilename = UUID.randomUUID().toString()+"."+FilenameUtils.getExtension(image.getOriginalFilename());
image.transferTo(new File(path,originalFilename));
message.put("type", "success");
String url= request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
map.put("url",url+"/upload/"+dateDir+File.separator+originalFilename);
} catch (IOException e) {
message.put("type", "error");
e.printStackTrace();
}
map.put("message", message);
try {
String jsons=JSONObject.toJSONString(map);
response.setCharacterEncoding("utf-8");
response.setContentType("text/html;charset=utf-8");
PrintWriter out = response.getWriter();
out.write(jsons);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"908686019@qq.com"
] | 908686019@qq.com |
cf47165296ed27f4d712cb293ee5345b848f8745 | c074acf2945feebfe5927478eb36dee946364f0a | /leetcode/src/main/java/com/chang/leetcode/Problem450.java | f70d5c357c5b3a36b1b26e400b036872dfd7859e | [] | no_license | wooyeeyii/think-in-java | fcbf9d7baf9fe30ac0dbdb8ebe43a98f69541175 | 3d8c7ab5a7ede7b9d625881bda350ecc19a47375 | refs/heads/master | 2021-11-08T17:08:10.117191 | 2021-11-05T01:22:40 | 2021-11-05T01:22:40 | 178,848,694 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,235 | java | /*
* 450. Delete Node in a BST
*
* Given a root node reference of a BST and a key, delete the node with the given key in the BST.
* Return the root node reference (possibly updated) of the BST.
*
* Basically, the deletion can be divided into two stages:
*
* Search for a node to remove.
* If the node is found, delete the node.
*
* Note: Time complexity should be O(height of tree).
*
* Example:
*
* root = [5,3,6,2,4,null,7]
* key = 3
*
* 5
* / \
* 3 6
* / \ \
* 2 4 7
*
* Given key to delete is 3. So we find the node with value 3 and delete it.
*
* One valid answer is [5,4,6,2,null,null,7], shown in the following BST.
*
* 5
* / \
* 4 6
* / \
* 2 7
*
* Another valid answer is [5,2,6,null,4,null,7].
*
* 5
* / \
* 2 6
* \ \
* 4 7
*/
package com.chang.leetcode;
import com.chang.common.TreeNode;
public class Problem450 {
public TreeNode deleteNode(TreeNode root, int key) {
TreeNode parent = null;
TreeNode node = root;
while (node != null) {
if (key == node.val) {
break;
} else if (key < node.val) {
parent = node;
node = node.left;
} else {
parent = node;
node = node.right;
}
}
if (null == node) {
return root;
}
TreeNode head = null;
if (null == parent) {
head = reShape(root, null, root);
return head;
} else {
head = reShape(root, parent, node);
}
return head;
}
private TreeNode reShape(TreeNode root, TreeNode parent, TreeNode node) {
if (null == node.left) {
if (null == parent) {
return node.right;
} else {
if (node == parent.left) {
parent.left = node.right;
} else {
parent.right = node.right;
}
}
} else if (null == node.right) {
if (null == parent) {
return node.left;
} else {
if (node == parent.left) {
parent.left = node.left;
} else {
parent.right = node.left;
}
}
} else {
if (null == parent) {
root = node.left;
insert(node.left, node.right);
} else {
if (node == parent.left) {
parent.left = node.left;
} else {
parent.right = node.left;
}
insert(node.left, node.right);
}
}
return root;
}
private void insert(TreeNode root, TreeNode node) {
if (node.val > root.val) {
if (null == root.right) {
root.right = node;
return;
} else {
insert(root.right, node);
}
} else {
if (null == root.left) {
root.left = node;
return;
} else {
insert(root.left, node);
}
}
}
}
| [
"wooyeeyii@163.com"
] | wooyeeyii@163.com |
cdae3d8176c40d2f928a1b1ac85813b5a5fbdfb6 | c426f7b90138151ffeb50a0d2c0d631abeb466b6 | /inception/inception-ui-curation/src/main/java/de/tudarmstadt/ukp/inception/ui/curation/sidebar/render/CurationSidebarRenderer.java | 744c197424d2ede1c5075d12598627e8efb5e31b | [
"Apache-2.0"
] | permissive | inception-project/inception | 7a06b8cd1f8e6a7eb44ee69e842590cf2989df5f | ec95327e195ca461dd90c2761237f92a879a1e61 | refs/heads/main | 2023-09-02T07:52:53.578849 | 2023-09-02T07:44:11 | 2023-09-02T07:44:11 | 127,004,420 | 511 | 141 | Apache-2.0 | 2023-09-13T19:09:49 | 2018-03-27T15:04:00 | Java | UTF-8 | Java | false | false | 12,147 | java | /*
* Licensed to the Technische Universität Darmstadt under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Technische Universität Darmstadt
* 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.
*
* 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 de.tudarmstadt.ukp.inception.ui.curation.sidebar.render;
import static de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.doDiffSingle;
import static de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.getDiffAdapters;
import static de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.LinkCompareBehavior.LINK_ROLE_AS_LABEL;
import static de.tudarmstadt.ukp.clarin.webanno.model.Mode.ANNOTATION;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import java.io.IOException;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.uima.cas.CAS;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.text.AnnotationFS;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import de.tudarmstadt.ukp.clarin.webanno.api.DocumentService;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.Configuration;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.ConfigurationSet;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.CasDiff.DiffResult;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.DiffAdapter;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.api.Position;
import de.tudarmstadt.ukp.clarin.webanno.curation.casdiff.internal.AID;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer;
import de.tudarmstadt.ukp.clarin.webanno.security.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.security.model.User;
import de.tudarmstadt.ukp.inception.rendering.Renderer;
import de.tudarmstadt.ukp.inception.rendering.editorstate.AnnotatorState;
import de.tudarmstadt.ukp.inception.rendering.pipeline.RenderStep;
import de.tudarmstadt.ukp.inception.rendering.request.RenderRequest;
import de.tudarmstadt.ukp.inception.rendering.vmodel.VArc;
import de.tudarmstadt.ukp.inception.rendering.vmodel.VComment;
import de.tudarmstadt.ukp.inception.rendering.vmodel.VCommentType;
import de.tudarmstadt.ukp.inception.rendering.vmodel.VDocument;
import de.tudarmstadt.ukp.inception.rendering.vmodel.VID;
import de.tudarmstadt.ukp.inception.rendering.vmodel.VObject;
import de.tudarmstadt.ukp.inception.schema.AnnotationSchemaService;
import de.tudarmstadt.ukp.inception.schema.layer.LayerSupport;
import de.tudarmstadt.ukp.inception.schema.layer.LayerSupportRegistry;
import de.tudarmstadt.ukp.inception.ui.curation.sidebar.CurationSidebarService;
import de.tudarmstadt.ukp.inception.ui.curation.sidebar.config.CurationSidebarAutoConfiguration;
/**
* <p>
* This class is exposed as a Spring Component via
* {@link CurationSidebarAutoConfiguration#curationSidebarRenderer}.
* </p>
*/
@Order(RenderStep.RENDER_SYNTHETIC_STRUCTURE)
public class CurationSidebarRenderer
implements RenderStep
{
public static final String ID = "CurationRenderer";
private static final String COLOR = "#ccccff";
private final Logger log = LoggerFactory.getLogger(getClass());
private final CurationSidebarService curationService;
private final LayerSupportRegistry layerSupportRegistry;
private final DocumentService documentService;
private final UserDao userRepository;
private final AnnotationSchemaService annotationService;
public CurationSidebarRenderer(CurationSidebarService aCurationService,
LayerSupportRegistry aLayerSupportRegistry, DocumentService aDocumentService,
UserDao aUserRepository, AnnotationSchemaService aAnnotationService)
{
curationService = aCurationService;
layerSupportRegistry = aLayerSupportRegistry;
documentService = aDocumentService;
userRepository = aUserRepository;
annotationService = aAnnotationService;
}
@Override
public String getId()
{
return ID;
}
@Override
public boolean accepts(RenderRequest aRequest)
{
AnnotatorState state = aRequest.getState();
// do not show predictions on the decicated curation page
if (state != null && state.getMode() != ANNOTATION) {
return false;
}
if (aRequest.getCas() == null) {
return false;
}
return true;
}
@Override
public void render(VDocument aVdoc, RenderRequest aRequest)
{
String sessionOwner = userRepository.getCurrentUsername();
if (!curationService.existsSession(sessionOwner, aRequest.getProject().getId())) {
return;
}
List<User> selectedUsers = curationService.listUsersReadyForCuration(sessionOwner,
aRequest.getProject(), aRequest.getSourceDocument());
if (selectedUsers.isEmpty()) {
return;
}
Map<String, CAS> casses = new LinkedHashMap<>();
// This is the CAS that the user can actively edit
casses.put(aRequest.getAnnotationUser().getUsername(), aRequest.getCas());
for (User user : selectedUsers) {
try {
CAS userCas = documentService.readAnnotationCas(aRequest.getSourceDocument(),
user.getUsername());
casses.put(user.getUsername(), userCas);
}
catch (IOException e) {
log.error("Could not retrieve CAS for user [{}] and project {}", user.getUsername(),
aRequest.getProject(), e);
}
}
List<DiffAdapter> adapters = getDiffAdapters(annotationService,
aRequest.getVisibleLayers());
CasDiff casDiff = doDiffSingle(adapters, LINK_ROLE_AS_LABEL, casses,
aRequest.getWindowBeginOffset(), aRequest.getWindowEndOffset());
DiffResult diff = casDiff.toResult();
// Listing the features once is faster than repeatedly hitting the DB to list features for
// every layer.
List<AnnotationFeature> supportedFeatures = annotationService
.listSupportedFeatures(aRequest.getProject());
List<AnnotationFeature> allFeatures = annotationService
.listAnnotationFeature(aRequest.getProject());
// Set up a cache for resolving type to layer to avoid hammering the DB as we process each
// position
Map<String, AnnotationLayer> type2layer = diff.getPositions().stream()
.map(Position::getType).distinct()
.map(type -> annotationService.findLayer(aRequest.getProject(), type))
.collect(toMap(AnnotationLayer::getName, identity()));
Set<VID> generatedCurationVids = new HashSet<>();
boolean showAll = curationService.isShowAll(sessionOwner, aRequest.getProject().getId());
String curationTarget = curationService.getCurationTarget(sessionOwner,
aRequest.getProject().getId());
for (ConfigurationSet cfgSet : diff.getConfigurationSets()) {
if (!showAll && cfgSet.getCasGroupIds().contains(curationTarget)) {
// Hide configuration sets where the curator has already curated (likely)
continue;
}
AnnotationLayer layer = type2layer.get(cfgSet.getPosition().getType());
List<AnnotationFeature> layerSupportedFeatures = supportedFeatures.stream() //
.filter(feature -> feature.getLayer().equals(layer)) //
.collect(toList());
List<AnnotationFeature> layerAllFeatures = allFeatures.stream() //
.filter(feature -> feature.getLayer().equals(layer)) //
.collect(toList());
for (Configuration cfg : cfgSet.getConfigurations()) {
FeatureStructure fs = cfg.getRepresentative(casDiff.getCasMap());
String user = cfg.getRepresentativeCasGroupId();
// We need to pass in *all* the annotation features here because we also to that in
// other places where we create renderers - and the set of features must always be
// the same because otherwise the IDs of armed slots would be inconsistent
LayerSupport<?, ?> layerSupport = layerSupportRegistry.getLayerSupport(layer);
Renderer renderer = layerSupport.createRenderer(layer, () -> layerAllFeatures);
List<VObject> objects = renderer.render(aVdoc, (AnnotationFS) fs,
layerSupportedFeatures, aRequest.getWindowBeginOffset(),
aRequest.getWindowEndOffset());
for (VObject object : objects) {
VID curationVid = new CurationVID(user, object.getVid());
if (generatedCurationVids.contains(curationVid)) {
continue;
}
generatedCurationVids.add(curationVid);
object.setVid(curationVid);
object.setColorHint(COLOR);
aVdoc.add(object);
aVdoc.add(new VComment(object.getVid(), VCommentType.INFO,
"Users with this annotation:\n" + cfg.getCasGroupIds().stream()
.collect(Collectors.joining(", "))));
if (object instanceof VArc) {
VArc arc = (VArc) object;
// Currently works for relations but not for slots
arc.setSource(getCurationVid(aRequest.getAnnotationUser(), diff, cfg,
arc.getSource()));
arc.setTarget(getCurationVid(aRequest.getAnnotationUser(), diff, cfg,
arc.getTarget()));
log.trace("Rendering curation vid: {} source: {} target: {}", arc.getVid(),
arc.getSource(), arc.getTarget());
}
else {
log.trace("Rendering curation vid: {}", object.getVid());
}
}
}
}
}
/**
* Find and return the rendered VID which is equivalent to the given VID. E.g. if the given VID
* belongs to an already curated annotation, then locate the VID for the rendered annotation of
* the curation user by searching the diff for configuration set that contains the annotators
* annotation and then switching over to the configuration containing the curators annotation.
*/
private VID getCurationVid(User aAnnotator, DiffResult aDiff, Configuration aCfg, VID aVid)
{
Optional<Configuration> sourceConfiguration = aDiff
.findConfiguration(aCfg.getRepresentativeCasGroupId(), new AID(aVid.getId()));
if (sourceConfiguration.isPresent()) {
AID curatedAID = sourceConfiguration.get().getAID(aAnnotator.getUsername());
if (curatedAID != null) {
return new VID(curatedAID.addr);
}
}
return new CurationVID(aCfg.getRepresentativeCasGroupId(), aVid);
}
}
| [
"richard.eckart@gmail.com"
] | richard.eckart@gmail.com |
83147e17d1ad1d51d00b2a573189cbe0ac0e702c | 80eeb3d8621f870b8da9cfaf73b81bb57b8096ea | /itmayiedu-shopp-messages/src/main/java/com/itmayiedu/adapter/MessageAdapter.java | 4de9b2278fd15697299cacdb2e163d96e609a8fd | [] | no_license | zhengym9666/itmayiedu-shopp-parent | 3073cc234ccb20c598357b1f8dd9a19dda44bbdf | 2df68976fc677cc91b9e207a5019ce385841632f | refs/heads/master | 2022-12-13T23:27:37.576248 | 2020-04-06T09:42:46 | 2020-04-06T09:42:46 | 253,449,870 | 0 | 0 | null | 2022-03-31T19:05:35 | 2020-04-06T09:20:24 | Roff | UTF-8 | Java | false | false | 496 | java |
package com.itmayiedu.adapter;
import com.alibaba.fastjson.JSONObject;
/**
*
*
* @classDesc: 功能描述:(所有消息都会交给他进行妆发)
* @author: 蚂蚁课堂创始人-余胜军
* @QQ: 644064779
* @QQ粉丝群: 116295598
* @createTime: 2017年10月25日 上午12:07:08
* @version: v1.0
* @copyright:每特学院(蚂蚁课堂)上海每特教育科技有限公司
*/
public interface MessageAdapter {
//接受消息
public void distribute(JSONObject jsonObject);
}
| [
"1039230702@qq.com"
] | 1039230702@qq.com |
b2c8c2f7382086a0a5ce4121ee120ddde6aca5e8 | 1b1c1d88361597dea3bf0ff723e0fb3e25244a09 | /app/src/main/java/com/example/mac_soong/weather/gson/AQI.java | 191e9dcbbe77f2674fc028c7eafdbcfdb33fd76b | [] | no_license | Soongz/weather | 884bbb241b1bc5a5356425d4d6c1cf99a4b3338b | ef222e17df74910da865581f5f40523f4b33c254 | refs/heads/master | 2021-06-14T09:08:54.149341 | 2017-03-20T16:16:23 | 2017-03-20T16:16:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.example.mac_soong.weather.gson;
/**
* Created by mac_soong on 2017/3/19.
*/
public class AQI {
public AQICity city;
public class AQICity{
public String aqi;
public String pm25;
}
}
| [
"840147322@qq.com"
] | 840147322@qq.com |
6a67a9e26a7f79a4f31411cc6e5a68463740444f | d017d869b0493ae943e3ea07e5d24d46c95f442c | /src/chapter4/ConnectionDriver.java | 676e5bca790f71b36b0c0213c9806fda7e6900ea | [] | no_license | silversunlight/art-of-javacocurrency | 45a5c481233b1871a44e49349fa99c7e7d01433a | de63eec55b7f4c367dea545afe4a40e7ed9baf6b | refs/heads/master | 2020-03-19T05:21:15.806226 | 2018-06-07T16:32:14 | 2018-06-07T16:32:14 | 135,922,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 997 | java | package chapter4;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.sql.Connection;
import java.util.concurrent.TimeUnit;
//用动态代理构造一个connection,
// 该connection的代理实现仅仅实在commit方法调用时休眠100毫秒
public class ConnectionDriver {
static class ConnectionHandler implements InvocationHandler {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws InterruptedException {
if (method.getName().equals("commit")) {
TimeUnit.MILLISECONDS.sleep(100);
}
return null;
}
}
//创建一个新的connection的代理,在commit时休眠100毫秒
public static final Connection createConnection() {
return (Connection) Proxy.newProxyInstance(ConnectionDriver.class.getClassLoader(),
new Class[]{Connection.class}, new ConnectionHandler());
}
}
| [
"sunlight328@163.com"
] | sunlight328@163.com |
04fa1f8cc99f6224111f27a2583906932d391332 | 121e51f80b3b44232ebfb4872ec1b224423b5904 | /src/main/java/com/lmig/gfc/happydogs/services/DogRepository.java | 019c10361248f26df37ee9fa8754aeb392f486c8 | [] | no_license | jograca/happydogs | f72109245b599c6f7c8fc7e9235b895d9a562808 | ca12bc7ec44349f22d6f294e60c02aa11048118c | refs/heads/master | 2021-08-28T09:16:42.785786 | 2017-12-11T20:08:15 | 2017-12-11T20:08:15 | 113,366,823 | 0 | 0 | null | 2017-12-11T20:08:16 | 2017-12-06T21:00:39 | Java | UTF-8 | Java | false | false | 405 | java | package com.lmig.gfc.happydogs.services;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.lmig.gfc.happydogs.model.Dog;
@Repository
public interface DogRepository extends JpaRepository<Dog, Long> {
List<Dog> findByColorIgnoringCase(String color);
List<Dog> findByGenderIgnoringCase(String gender);
}
| [
"jon.graca@libertymutual.com"
] | jon.graca@libertymutual.com |
184c99d00a05997e808170f1932c61b846c9216b | 01ae5dfa1c32f2e67d202a2805961dd00b8ed56a | /src/main/java/com/krotos/MoneyTransfer/exchangeRates/daemon/Updater.java | 0e13878d25d37a15e85b7e9944d46be64278927b | [] | no_license | mkrotos/MoneyTransfer | ed7738b554fea539e99096f689e15ed1a11ac047 | cf2d504045b7929653e46bb0e982423ac3cd9997 | refs/heads/master | 2020-04-18T22:20:18.174864 | 2019-02-09T14:29:04 | 2019-02-09T14:29:04 | 167,790,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,315 | java | package com.krotos.MoneyTransfer.exchangeRates.daemon;
import com.krotos.MoneyTransfer.Currency;
import com.krotos.MoneyTransfer.exchangeRates.RatesService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service
class Updater {
@Autowired
private RatesService ratesService;
private Logger log = LogManager.getLogger(this.getClass());
void updateAllRates(RatesResponseModel ratesResponseModel) {
Map<String, Double> newRates = ratesResponseModel.getRates();
for (Currency currency : Currency.values()) {
updateRateIfExists(newRates, currency);
}
}
private void updateRateIfExists(Map<String, Double> rates, Currency currency) {
if (!rates.containsKey(currency.toString())) {
log.info(String.format("Nie znaleziono przelicznika %s w pobranych danych", currency));
return;
}
Double rate = rates.get(currency.toString());
updateSingleRate(currency, rate);
}
private void updateSingleRate(Currency currency, Double rate) {
double usdValue = 1 / rate;
ratesService.updateRate(currency, usdValue);
}
}
| [
"mar.krotos@gmail.com"
] | mar.krotos@gmail.com |
841aae1a9d741bf33bb946be8b9fd5fe52ffb294 | 8f37412fd8a8650a793e80e9b9569a1a6058e291 | /SQLiEchallengeJFormation/src/main/java/com/sqli/echallenge/jformation/web/responsableformation/SessionFormationDeleteAction.java | 01908cb85bc97d71d9f6d8ee1f7045feeba8c3e0 | [
"Apache-2.0"
] | permissive | medbelmahi/SQLiEchallengeJFormation | 0f3c45604b58641e863ac494465d54d6ccec4775 | 176961564566ab03ef201de45e7cdba5dfda6323 | refs/heads/master | 2021-01-22T17:48:47.865939 | 2014-12-14T14:52:30 | 2014-12-14T14:52:30 | 27,490,447 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,580 | java | /**
*
*/
package com.sqli.echallenge.jformation.web.responsableformation;
import java.util.Calendar;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import com.opensymphony.xwork2.validator.annotations.RequiredFieldValidator;
import com.sqli.echallenge.jformation.metier.FormationMetier;
import com.sqli.echallenge.jformation.metier.SessionFormationMetier;
import com.sqli.echallenge.jformation.model.entity.Formation;
import com.sqli.echallenge.jformation.model.entity.SessionFormation;
import com.sqli.echallenge.jformation.util.SqliException;
import com.sqli.echallenge.jformation.web.SqliActionSupport;
/**
* @author Mouad
*
*/
@Controller
public class SessionFormationDeleteAction extends SqliActionSupport {
private static final long serialVersionUID = 4290228081029920376L;
@Autowired
public SessionFormationMetier sessionFormationMetier;
@Autowired
public FormationMetier formationMetier;
private Long idFormation;//for reload (redirect)
private Long idSession;
@Override
public String execute() throws Exception {
try {
//1// get formation from db (for validation)
@SuppressWarnings("unused")
Formation formation = formationMetier.get(idFormation);
//2// get Session from db
SessionFormation session = sessionFormationMetier.get(idSession);
//3// Valid dates!!!
//3.1// is session already started but not ended yet
Calendar caldebut = Calendar.getInstance(); caldebut.setTime(session.getDateDebutSessionFormation());
Calendar calfin = Calendar.getInstance(); calfin.setTime(session.getDateFinSessionFormation());
Calendar caltoday = Calendar.getInstance();
if(caldebut.before(caltoday) && calfin.after(caltoday)){
throw new SqliException(getText("session.delete.fail.session_in_progress"));
}
//4// remove session
sessionFormationMetier.remove(idSession);
//5/show success message
setSessionActionMessageText(getText("session.delete.success"));
return SqliActionSupport.SUCCESS;
} catch (Exception e) {
//show error message
setSessionActionErrorText(e.getMessage());
return SqliActionSupport.ERROR;
}
}
@RequiredFieldValidator(shortCircuit=true)
public Long getIdFormation() {
return idFormation;
}
public void setIdFormation(Long idFormation) {
this.idFormation = idFormation;
}
@RequiredFieldValidator(shortCircuit=true)
public Long getIdSession() {
return idSession;
}
public void setIdSession(Long idSession) {
this.idSession = idSession;
}
}
| [
"Mouad.fkr@gmail.com"
] | Mouad.fkr@gmail.com |
d20c60d7d4a60d2a3bc553afccce03f30a39f799 | b407ed98f3ea7d08e9436230d6da6207e711f885 | /Well-designed/src/cn/edu/tju/sparqlresult/SparqlResult.java | 0f12d30fa2239a36bde1f7cfcb61f2ea56d6f50f | [] | no_license | szyhw/WD | effb6360daccfaf7a43af8dfa8517f2651c1ccae | d449ffcf0729624a5562a61e5bf51b1efd93704c | refs/heads/master | 2021-01-10T03:15:54.834767 | 2015-10-26T07:46:50 | 2015-10-26T07:47:02 | 44,670,523 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,025 | java | package cn.edu.tju.sparqlresult;
import java.util.ArrayList;
import cn.edu.tju.rules.Caculate;
public class SparqlResult {
public static ArrayList<String> get_result(String result){
ArrayList<String> results = new ArrayList<String>();
if(!result.contains("empty result")){
String[] temp=result.split(" ");
int length=result.length();
for (int i = 0; i < temp.length; i++) {
String str=temp[i];
if(!str.contains("\"")){
results.add(str);
}
else if(str.contains("\"")){
if(Caculate.calculate(str, "\"")%2!=0){
String collection=str;
for (int j = i+1; j < length; j++) {
if(!temp[j].contains("\"")){
collection=collection+" "+temp[j];
}
else{
collection=collection+" "+temp[j];
results.add(collection);
i=j;
break;
}
}
}
else{
results.add(str);
}
}
}
return results;
}
else{
results.clear();
return results;
}
}
}
| [
"hanling@lenovo-PC"
] | hanling@lenovo-PC |
7970c3704cec1f52c3494b6a62002a403fc1c420 | 08d9767584a670be4ff0179409ad4480bc693990 | /University_fee1/src/University_fee.java | 140d336c7422868b6629ce4a00445e378564cc67 | [] | no_license | Mansamarasani/university_fee_structure | ce9b49e4349546b9b508273e7f112537fc8e1bc2 | 7c30efea6cc2020776c48e75f6ab47431f4c6437 | refs/heads/master | 2020-06-26T18:29:17.894948 | 2019-07-31T05:10:21 | 2019-07-31T05:10:21 | 199,714,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,799 | java | import java.io.*;
import java.util.Scanner;
import java.lang.Integer.*;
class Fee
{
public static void main(String[] args)
{
int e_fee; //integer to store user provided exam fee
final String n[] = {"Indian","Foreigner","NRI","SAARC"}; //array to store nationalities
final int e_fee_1[] = {400,100,600}; //array to store exam fee
final String c[]= {"Medical","Dental","Ayurveda"}; //array to store cources
final int ind[] = {200,300,500}; //array to store All_level indian application fee
final int foreign[]= {400,400,700}; //array to store All_level foreign application fee
final String al[] = {"UG","UG-Diploma","PG"}; //array to store All_levels
System.out.println("Please select the exam fees from the below");
for(int f=0; f<=2; f++) System.out.println(e_fee_1[f]);
Scanner sc = new Scanner(System.in); //Reading user input
e_fee = sc.nextInt();
if(e_fee==(e_fee_1[0]) || e_fee==(e_fee_1[1]) ||e_fee ==(e_fee_1[2]) ) //Validating exam fee input
{
for(int i=0;i<=2;i++)
{
if (e_fee==(e_fee_1[2]))
{
System.out.println("please select your nationalaity from below");
System.out.println(n[2]);
System.out.println(n[3]);
String s1= sc.next();
if ((s1.toUpperCase()).equals("NRI") || (s1.toUpperCase()).equals("SAARC"))
{
System.out.println("Total amount of fee is "+e_fee);
break; //calculating total amount for NRI and SAARC
}
else
{
System.out.println("You have selected invalid option. Please select the valid option");
continue;
}
}
else
if(e_fee==(e_fee_1[i]))
{
if (n[i].equals("Indian"))
System.out.println("Thanks for choosing your nationality. You belong to "+n[i]+" nationality");
else
System.out.println("Thanks for choosing your nationality. You belong to other nationality"+" ("+n[i]+")");
System.out.println("Please choose one of the course from below");
for(int k=1; k<=3; k++) System.out.println("select "+k +" for "+ c[k-1]);
int st= sc.nextInt();
if (st<=0 || st>3)
{
System.out.println("Invalid selection");
break; //To verify the valid courses
}
else
System.out.println("You have selected "+c[st-1]);
System.out.println("Choose the qualification level");
for(int l=1; l<=3; l++) System.out.println("select "+l +" for "+ al[l-1]);
int sl=sc.nextInt();
if (sl<=0 || sl>3)
System.out.println("Invalid selection"); //To verify the valid levels
else
for(int m=1;m<=3;m++)
{
System.out.println("Thanks for selecting " +al[sl-1]);
if (n[i].equals("Indian"))
System.out.println("The total fee amount is " + (e_fee_1[i]+ind[sl-1]));
else if (n[i].equals("Foreigner"))
System.out.println("The total fee amount is " +(e_fee_1[i]+foreign[sl-1])); //To calculate total fee amount for indian and foreigner
break;
}
break;
}
}
} else
System.out.println("You have selected Invalid Amount");
}
}
| [
"ram@ram-PC"
] | ram@ram-PC |
1c1e18ddbd66d76a73219416540c1d40b157e26d | 2c3bfd5870bf6d02e6fdc5cc50f9ee71564803c9 | /Common Operations/Dec2Binary.java | 89ea7be0388484610dd4199688e5ce95bd4a7089 | [] | no_license | claireluchen/Java-Notes | 8e2de9c7eaefdfcdf5cdb192c28192aedd757049 | 2c51f4585477985fcd502542df6c917c73b61fbc | refs/heads/main | 2023-08-21T02:47:20.569513 | 2021-10-06T19:48:31 | 2021-10-06T19:48:31 | 359,258,985 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | import java.util.Scanner;
public class Dec2Binary {
public static void main(String[] args) {
//Convert a decimal number to a binary number
Scanner in = new Scanner(System.in);
int input = in.nextInt();
int bi = 0;
for (int i = 1; input >= 1; i++) {
int temp = input % 2;
bi += temp * Math.pow(10, i-1);
input /= 2;
}
System.out.println(bi);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
85eae75f66851300e313cad213ca2986bbca352d | 329f4c79a71258acf736d474cfb942a2bdf3de80 | /ControladorPermiso.java | bc66c2c8c00011dc9ea1d6348d62f2cf3be7966d | [] | no_license | Abigail210/Proyecto-final | 53fb50d04894c63ce4c1a4df115122b859396b63 | cb5160831609198a99fd9f60665bab96756422d2 | refs/heads/main | 2023-02-22T20:54:01.128186 | 2021-01-25T12:46:10 | 2021-01-25T12:46:10 | 332,658,753 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 510 | java | package controlador;
import modelo.Permiso;
import servicio.ServicioPermiso;
import servicio.ServicioPermiso;
public class ControladorPermiso {
private ServicioPermiso servicioPermiso;
public ControladorPermiso() {
servicioPermiso = new ServicioPermiso();
}
public String leerTodosLosPermisos() {
return servicioPermiso.leerTodosLosPermisos();
}
public Permiso leerPermiso(String id) {
return servicioPermiso.leerPermiso(id);
}
}
| [
"noreply@github.com"
] | noreply@github.com |
88f0d4dcd539bd33d928239e01975c3c19dfcc2d | 31106a2612f17a4503e54c238bfe13065832f664 | /src/tienganhchobe/webmvc/model/Users.java | c725c91e813a7b1fae9d6ea3192de84681ad00b4 | [] | no_license | quocdat1912/tienganhchoem | e0bcef757a8f784c2244bb49c65837a18bffe35e | ade4503a946750ee7410c458aaef6df048d36f36 | refs/heads/master | 2020-04-05T15:22:00.426502 | 2018-11-05T11:07:25 | 2018-11-05T11:07:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,580 | java | package tienganhchobe.webmvc.model;
public class Users {
private String user_id;
private String user_fullname;
private String user_email;
private String user_name;
private String user_password;
private int user_roleid;
private String user_address;
private String user_about;
private int user_age;
private String user_city;
private String user_country;
private int user_phone;
private int user_sex;
public Users()
{
}
public Users(String user_id, String user_fullname, String user_email, String user_name, String user_password,
int user_roleid, String user_address, String user_about, int user_age, String user_city,
String user_country) {
super();
this.user_id = user_id;
this.user_fullname = user_fullname;
this.user_email = user_email;
this.user_name = user_name;
this.user_password = user_password;
this.user_roleid = user_roleid;
this.user_address = user_address;
this.user_about = user_about;
this.user_age = user_age;
this.user_city = user_city;
this.user_country = user_country;
}
public Users(String user_fullname, String user_email, String user_name, String user_password,int user_roleid) {
super();
this.user_fullname = user_fullname;
this.user_email = user_email;
this.user_name = user_name;
this.user_password = user_password;
this.user_roleid=user_roleid;
}
public Users(String user_fullname, String user_email, String user_address, String user_about, int user_age,
String user_city, String user_country) {
super();
this.user_fullname = user_fullname;
this.user_email = user_email;
this.user_address = user_address;
this.user_about = user_about;
this.user_age = user_age;
this.user_city = user_city;
this.user_country = user_country;
}
public String getUser_id() {
return user_id;
}
public void setUser_id(String user_id) {
this.user_id = user_id;
}
public String getUser_fullname() {
return user_fullname;
}
public void setUser_fullname(String user_fullname) {
this.user_fullname = user_fullname;
}
public String getUser_email() {
return user_email;
}
public void setUser_email(String user_email) {
this.user_email = user_email;
}
public String getUser_name() {
return user_name;
}
public void setUser_name(String user_name) {
this.user_name = user_name;
}
public String getUser_password() {
return user_password;
}
public void setUser_password(String user_password) {
this.user_password = user_password;
}
public int getUser_roleid() {
return user_roleid;
}
public void setUser_roleid(int user_roleid) {
this.user_roleid = user_roleid;
}
public String getUser_address() {
return user_address;
}
public void setUser_address(String user_address) {
this.user_address = user_address;
}
public String getUser_about() {
return user_about;
}
public void setUser_about(String user_about) {
this.user_about = user_about;
}
public int getUser_age() {
return user_age;
}
public void setUser_age(int user_age) {
this.user_age = user_age;
}
public String getUser_city() {
return user_city;
}
public void setUser_city(String user_city) {
this.user_city = user_city;
}
public String getUser_country() {
return user_country;
}
public void setUser_country(String user_country) {
this.user_country = user_country;
}
public int getUser_phone() {
return user_phone;
}
public void setUser_phone(int user_phone) {
this.user_phone = user_phone;
}
public int getUser_sex() {
return user_sex;
}
public void setUser_sex(int user_sex) {
this.user_sex = user_sex;
}
}
| [
"hongsonflute@gmail.com"
] | hongsonflute@gmail.com |
1d89bc0b4c163cfc0ae58c70d739cfc82bb124ec | d620fc17858ec5646f6786013394d5f843a4d468 | /src/MillersAlgorithm.java | a2561b56c02923e64999b13c757651b04bf2feaf | [] | no_license | putthidaSR/TCSS543-Homework2 | 7d14c016e0c49010b36bb7c589b80bfc2b67f19e | f4f686402f6c0d5a31eca2863b775acdead13937 | refs/heads/master | 2020-09-03T20:10:42.522307 | 2019-11-05T07:15:21 | 2019-11-05T07:15:21 | 219,557,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,957 | java | /**
* This class contains business logic to implement Wu Miller Algorithm.
*
* Reference:
*
* S. Wu, U, Manber, E. Myers, W. Miller, “An O(NP) sequence comparison algorithm”,
* Information Processing Letters vol. 35, pp. 317-323, Springer, 1990
*/
public class MillersAlgorithm {
public static void main(String[] args) {
int[] listA = RandomGenerator.getFirstList();
int[] listB = RandomGenerator.getSecondList(listA, 2);
millerAlgorithm(listA, listB);
}
/**
* Apply Wu Miller Algorithm (Edit Distance) to find the minimum cost of edit operations to transform one string to the other.
*
* @param listA sequence of positive integer
* @param listB sequence of positive integer
* @return minimum cost of edit operations (copy, insert, delete)
*/
public static int millerAlgorithm(int[] listA, int[] listB) {
int m = listA.length;
int n = listB.length;
// if one of the strings is empty
if (n * m == 0) {
return n + m;
}
// initialize the array to store the conversion history
int[] fp = new int[m + n + 3];
int p, delta;
delta = n - m;
p = -1;
/*
* Loop through the sequence of integers from both given lists to perform three opertions:
* - copying one character to another character
* - deleting a character
* - inserting a character
*/
while (fp[delta] != n) {
p = p + 1;
for (int k = -p; k <= delta - 1; k++) {
fp[k] = snake(listA, listB, m, n, k, Math.max(fp[k - 1] + 1, fp[k + 1]));
}
for(int k = delta + p; k >= delta + 1; k--) {
fp[k] = snake(listA, listB, m, n, k, Math.max(fp[k - 1] + 1, fp[k + 1]));
}
fp[delta] = snake(listA, listB, m, n, delta, Math.max(fp[delta - 1] + 1, fp[delta + 1]));
}
return delta + 2 * p;
}
private static int snake(int[] listA, int[] listB, int m, int n, int k, int j) {
int i = j - k;
while (i < m && j < n && listA[i + 1] == listB[j + 1]) {
i++;
j++;
}
return j;
}
}
| [
"psamrith@uw.edu"
] | psamrith@uw.edu |
61dd406b1bc7a547b847d9bdb39fe50838525c9f | 6b5cd4f9cdea125eda921828da1999e118ee1293 | /src/com/google/codeu/mathlang/core/tokens/Token.java | de3e77e7588a44827291fe0c7a0743cef8946d78 | [
"Apache-2.0"
] | permissive | netcables/codeu_coding_assessment_b_2017 | 219c02388cb13880cc9fd99b3b467c9b94afe9a4 | 193f39dc581604469c8031f572426f131c391ca4 | refs/heads/master | 2021-01-02T08:38:14.154658 | 2017-08-05T05:41:23 | 2017-08-05T05:41:23 | 99,038,101 | 1 | 0 | null | 2017-08-01T19:56:30 | 2017-08-01T19:56:30 | null | UTF-8 | Java | false | false | 1,262 | java | // Copyright 2017 Google Inc.
//
// 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.google.codeu.mathlang.core.tokens;
// TOKEN
//
// This is the common interface for all token types. A token is a
// block of information parsed from the input.
public interface Token {
// TO STRING
//
// Require all tokens to supply a |toString| implementation so that
// tokens can be printed when debugging.
String toString();
// HASH CODE
//
// All tokens must implement hashCode to ensure that tokens can work
// well with hash-based data structures.
int hashCode();
// EQUALS
//
// Check for equality with other objects. All tokens must implement
// this to make working with tokens easier.
boolean equals(Object other);
}
| [
"vaage@google.com"
] | vaage@google.com |
696028cac36583397eb7e20fa4bc1bd93965dd9c | b06949f1e26d7fb3cd37a4ae337be74cefce6628 | /src/main/java/com/elvarg/game/definition/loader/DefinitionLoader.java | 54e08adc0e4df4c6db6fb5b2f327892d75cf70d0 | [] | no_license | NightPlex/CastleWars | dbb2a32ecdef98a328b74475539b1ab054bfbe5c | 00f254f455e133c0c96b65696789f7f44ffca8e7 | refs/heads/master | 2021-01-22T01:14:26.198492 | 2017-09-10T07:23:17 | 2017-09-10T07:23:17 | 102,214,318 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 773 | java | package com.elvarg.game.definition.loader;
import java.util.logging.Level;
import com.elvarg.Server;
/**
* An abstract class which handles the loading
* of some sort of definition-related file.
*
* @author Professor Oak
*/
public abstract class DefinitionLoader implements Runnable {
public abstract void load() throws Throwable;
public abstract String file();
@Override
public void run() {
try {
long start = System.currentTimeMillis();
load();
long elapsed = System.currentTimeMillis() - start;
Server.getLogger().log(Level.INFO, "Loaded definitions for: "+file()+". It took "+elapsed+" milliseconds.");
} catch(Throwable e) {
e.printStackTrace();
Server.getLogger().log(Level.SEVERE, "Loaded definitions for: "+file(), e);
}
}
}
| [
"steventihomirov@hotmail.com"
] | steventihomirov@hotmail.com |
673f342079191da2a7c4be4930ac5bb0bbbdcfa1 | 05061b6fe9ab002145615a5b1b2015a0b6fff0a1 | /src/main/java/io/github/mk/application/web/rest/errors/package-info.java | 43aec7183ac10c44a42bcc56d7afaab32760d400 | [] | no_license | BulkSecurityGeneratorProject/angularDemo | 6c823d695a0efef9f1fcaa77b3cad4afea02466e | eca0679e757b81f1fb6e0b5f33636c10e2170688 | refs/heads/master | 2022-12-14T06:54:59.081522 | 2020-05-05T13:31:22 | 2020-05-05T13:31:22 | 296,675,246 | 0 | 0 | null | 2020-09-18T16:33:29 | 2020-09-18T16:33:26 | null | UTF-8 | Java | false | false | 199 | java | /**
* Specific errors used with Zalando's "problem-spring-web" library.
*
* More information on https://github.com/zalando/problem-spring-web
*/
package io.github.mk.application.web.rest.errors;
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
c60656eba5364b4b28fbdf80f03b935684caef67 | 5ba8f9607a98aa1124bc9114ea2b01f19d666935 | /SRM 161 DIV 2/src/StringTrain.java | 2f91a1269d8f168417ae37de028c937a1e7e266f | [] | no_license | pmonkelban/TopCodingSolutions | 109facb985faa2bd22faf32d729d0f1db13befef | 7a2a4a016d2dd9ae70a51f14c8fd5c72bb904594 | refs/heads/master | 2016-09-08T01:54:26.409310 | 2015-11-22T15:35:21 | 2015-11-22T15:35:21 | 28,159,578 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,666 | java | import java.util.HashSet;
import java.util.Set;
public class StringTrain {
// The method called by TopCoder
public String buildTrain(String[] cars) {
String train = cars[0];
// Process each car in turn.
for (int i = 1; i < cars.length; i++) {
train = processCar(train, cars[i]);
}
// Get the train length before removing characters.
int trainLength1 = train.length();
train = removeAllButLastChar(train);
return trainLength1 + " " + train;
}
private static String processCar(String train, String car) {
int trainIdx = 0;
int carIdx = 0;
while (trainIdx < train.length()) {
/*
* Move forward through the characters in train until one that
* matches the first character of car is found.
*/
while ((trainIdx < train.length()) &&
(car.charAt(carIdx) != train.charAt(trainIdx))) {
trainIdx++;
}
// If we reach the end of train, return train.
if (trainIdx == train.length()) {
return train;
}
// Mark the start of this possible suffix.
int startOfSuffix = trainIdx;
/*
* While the characters match, and we haven't reached the
* end of either string, move to the next character of each string.
*/
while ((trainIdx < train.length()) &&
(carIdx < car.length()) &&
(car.charAt(carIdx) == train.charAt(trainIdx))) {
trainIdx++;
carIdx++;
}
// If we've reached the end of the train.
if (trainIdx == train.length()) {
/*
* If startOfSuffix == 0, then the entire train String
* is being used. If carIdx == car.length, then the entire
* car String is used. In either case, it's not a proper
* pre/suf-fix.
*/
if ((startOfSuffix != 0) && (carIdx < car.length())) {
/*
* Create the return string by starting with train as the
* base and adding the remaining characters from car.
*/
StringBuilder sb = new StringBuilder();
sb.append(train);
for (int i = carIdx; i < car.length(); i++) {
sb.append(car.charAt(i));
}
return sb.toString();
}
}
// Move train index forward, and reset the car index. Try again.
trainIdx = startOfSuffix + 1;
carIdx = 0;
}
return train;
}
private static String removeAllButLastChar(String s) {
// This set contains all characters that have been seen.
Set<Character> usedChars = new HashSet<>();
StringBuilder sb = new StringBuilder(s.length());
/*
* Work backward from the end of the String to the front.
* Add characters to the output only if they are not in the usedChars
* set. When a new character is encountered, add it to the front
* of the output, and add the character to usedChars so it is not
* added again.
*/
for (int i = s.length() - 1; i >= 0; i--) {
if (!usedChars.contains(s.charAt(i))) {
usedChars.add(s.charAt(i));
sb.insert(0, s.charAt(i));
}
}
return sb.toString();
}
}
| [
"pmonkelban@gmail.com"
] | pmonkelban@gmail.com |
0c40233a82794a897fc9c16511bece79b685debe | d1a81baa4fa51d89c8a7f74d4889d1079f93afcc | /src/net/s3gfault/capp/ide/headparser/Variable.java | bf4ff71257d916afa943c43fb8ec9e99e7d5a32d | [] | no_license | s3gm3ntat1onf4ult/C-IDE-Android | 900439265b7856c2045a85b60555f211df1c85b1 | e0fc93728070ab76f9630c0779ca88e566657537 | refs/heads/master | 2020-03-21T23:23:08.098095 | 2018-08-06T19:04:10 | 2018-08-06T19:04:10 | 139,184,350 | 8 | 0 | null | null | null | null | UTF-8 | Java | false | false | 476 | java | package net.s3gfault.capp.ide.headparser;
public class Variable
{
private String name, type;
public Variable(String name, String type)
{
this.name = name;
this.type = type;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
@Override
public String toString()
{
return type + " " + name;
}
}
| [
"carloshenriquech.2102001@gmail.com"
] | carloshenriquech.2102001@gmail.com |
c4c0fcd15fc1fc1c583330b40c72324021173395 | 471a1d9598d792c18392ca1485bbb3b29d1165c5 | /jadx-MFP/src/main/java/com/google/android/gms/internal/fitness/zzeb.java | 1dbee3e7b961b5b91836b629ca2d66ee4fe02f05 | [] | no_license | reed07/MyPreferencePal | 84db3a93c114868dd3691217cc175a8675e5544f | 365b42fcc5670844187ae61b8cbc02c542aa348e | refs/heads/master | 2020-03-10T23:10:43.112303 | 2019-07-08T00:39:32 | 2019-07-08T00:39:32 | 129,635,379 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,211 | java | package com.google.android.gms.internal.fitness;
import android.os.RemoteException;
import com.google.android.gms.common.api.Api.AnyClient;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.Result;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.fitness.request.DataSourcesRequest;
import com.google.android.gms.fitness.result.DataSourcesResult;
import java.util.Collections;
final class zzeb extends zzav<DataSourcesResult> {
private final /* synthetic */ DataSourcesRequest zzft;
zzeb(zzea zzea, GoogleApiClient googleApiClient, DataSourcesRequest dataSourcesRequest) {
this.zzft = dataSourcesRequest;
super(googleApiClient);
}
/* access modifiers changed from: protected */
public final /* synthetic */ void doExecute(AnyClient anyClient) throws RemoteException {
((zzcd) ((zzas) anyClient).getService()).zza(new DataSourcesRequest(this.zzft, (zzbk) new zzo(this)));
}
/* access modifiers changed from: protected */
public final /* synthetic */ Result createFailedResult(Status status) {
return new DataSourcesResult(Collections.emptyList(), status);
}
}
| [
"anon@ymous.email"
] | anon@ymous.email |
9c7d7e3bfe8ad2ec748943f5664b1b81d8d2e484 | 9577ce6e1948f90238c0389071339153562dd08b | /HW08Problem2/src/ITransform.java | 67b5091988e5d6eacf64893739d48451e28e1a8e | [] | no_license | burdenp/Java | a0d6ed32d0c74a5dfe7391ee59f41779923a872d | 20da6a19646cb3fef9af0790668d2ec13e66ce1b | refs/heads/master | 2020-04-29T08:52:39.105618 | 2019-03-16T17:29:18 | 2019-03-16T17:29:18 | 176,002,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 454 | java | // Assignment 8 Problem 2
// Partner James Kandebo
// partner1username Kandebo
// Partner Name2 Patrick Burden
// partner2username pburden
// 14 March 2012
//copied code from problem one that inclueds answer to problem 2
//since they are both from the same lab and use
//all the same classes
public interface ITransform< T, S> {
public S transform(T t);
/* Template
* Fields
* Methods
* ... this.transform(T t)... --T
*/
}
| [
"patrick@yptokey.com"
] | patrick@yptokey.com |
68ce69b072cdfc6156974cdc7f6ded79a0e3a644 | e63363389e72c0822a171e450a41c094c0c1a49c | /Mate20_9_0_0/src/main/java/android/content/pm/HwInvisibleAppsFilter.java | 5a18c419d4a168e22c2f37eac6ac67712e3b5b18 | [] | no_license | solartcc/HwFrameWorkSource | fc23ca63bcf17865e99b607cc85d89e16ec1b177 | 5b92ed0f1ccb4bafc0fdb08b6fc4d98447b754ad | refs/heads/master | 2022-12-04T21:14:37.581438 | 2020-08-25T04:30:43 | 2020-08-25T04:30:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,515 | java | package android.content.pm;
import android.content.Context;
import android.provider.Settings.System;
import android.text.TextUtils;
import java.util.ArrayList;
import java.util.List;
public class HwInvisibleAppsFilter {
public static final String HIDE_APP_KEY = "hw_invisible_apps_in_appmanager";
private String mConfigHideApps;
public HwInvisibleAppsFilter(Context context) {
this.mConfigHideApps = System.getString(context.getContentResolver(), HIDE_APP_KEY);
}
/* JADX WARNING: Missing block: B:11:0x001f, code skipped:
return false;
*/
/* Code decompiled incorrectly, please refer to instructions dump. */
public boolean isConfigToHide(String packageName) {
if (this.mConfigHideApps == null || this.mConfigHideApps.isEmpty() || TextUtils.isEmpty(packageName) || !this.mConfigHideApps.contains(packageName)) {
return false;
}
return true;
}
public List<ApplicationInfo> filterHideApp(List<ApplicationInfo> allApps) {
if (this.mConfigHideApps == null || this.mConfigHideApps.isEmpty() || allApps == null) {
return allApps;
}
List<ApplicationInfo> willRemove = new ArrayList();
for (ApplicationInfo info : allApps) {
if (this.mConfigHideApps.contains(info.packageName)) {
willRemove.add(info);
}
}
if (willRemove.size() > 0) {
allApps.removeAll(willRemove);
}
return allApps;
}
}
| [
"lygforbs0@gmail.com"
] | lygforbs0@gmail.com |
93e1ce74ab09a814752dff5b39259bcdb1b6f1ac | 447520f40e82a060368a0802a391697bc00be96f | /apks/malware/app98/source/uk/co/senab/actionbarpulltorefresh/extras/actionbarsherlock/AbsPullToRefreshAttacher.java | 90ce22cc5e7402951327fee859bc6190087b6dee | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 3,684 | java | package uk.co.senab.actionbarpulltorefresh.extras.actionbarsherlock;
import android.app.Activity;
import android.content.Context;
import android.os.Build.VERSION;
import android.view.View;
import android.widget.FrameLayout;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.app.SherlockExpandableListActivity;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.app.SherlockListActivity;
import com.actionbarsherlock.app.SherlockPreferenceActivity;
import uk.co.senab.actionbarpulltorefresh.library.EnvironmentDelegate;
import uk.co.senab.actionbarpulltorefresh.library.HeaderTransformer;
import uk.co.senab.actionbarpulltorefresh.library.Options;
import uk.co.senab.actionbarpulltorefresh.library.PullToRefreshAttacher;
class AbsPullToRefreshAttacher
extends PullToRefreshAttacher
{
private FrameLayout mHeaderViewWrapper;
protected AbsPullToRefreshAttacher(Activity paramActivity, Options paramOptions)
{
super(paramActivity, paramOptions);
}
protected void addHeaderViewToActivity(View paramView)
{
if (Build.VERSION.SDK_INT >= 14)
{
super.addHeaderViewToActivity(paramView);
return;
}
this.mHeaderViewWrapper = new FrameLayout(getAttachedActivity());
this.mHeaderViewWrapper.addView(paramView);
super.addHeaderViewToActivity(this.mHeaderViewWrapper);
}
protected EnvironmentDelegate createDefaultEnvironmentDelegate()
{
return new AbsEnvironmentDelegate();
}
protected HeaderTransformer createDefaultHeaderTransformer()
{
return new AbsDefaultHeaderTransformer();
}
protected void removeHeaderViewFromActivity(View paramView)
{
if (Build.VERSION.SDK_INT >= 14) {
super.removeHeaderViewFromActivity(paramView);
}
while (this.mHeaderViewWrapper == null) {
return;
}
super.removeHeaderViewFromActivity(this.mHeaderViewWrapper);
this.mHeaderViewWrapper = null;
}
protected void updateHeaderViewPosition(View paramView)
{
if (Build.VERSION.SDK_INT >= 14) {
super.updateHeaderViewPosition(paramView);
}
while (this.mHeaderViewWrapper == null) {
return;
}
super.updateHeaderViewPosition(this.mHeaderViewWrapper);
}
public static class AbsEnvironmentDelegate
implements EnvironmentDelegate
{
public AbsEnvironmentDelegate() {}
public Context getContextForInflater(Activity paramActivity)
{
Object localObject = null;
if ((paramActivity instanceof SherlockActivity)) {
localObject = ((SherlockActivity)paramActivity).getSupportActionBar();
}
for (;;)
{
Context localContext = null;
if (localObject != null) {
localContext = ((ActionBar)localObject).getThemedContext();
}
localObject = localContext;
if (localContext == null) {
localObject = paramActivity;
}
return localObject;
if ((paramActivity instanceof SherlockListActivity)) {
localObject = ((SherlockListActivity)paramActivity).getSupportActionBar();
} else if ((paramActivity instanceof SherlockFragmentActivity)) {
localObject = ((SherlockFragmentActivity)paramActivity).getSupportActionBar();
} else if ((paramActivity instanceof SherlockExpandableListActivity)) {
localObject = ((SherlockExpandableListActivity)paramActivity).getSupportActionBar();
} else if ((paramActivity instanceof SherlockPreferenceActivity)) {
localObject = ((SherlockPreferenceActivity)paramActivity).getSupportActionBar();
}
}
}
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
9b3dff3c7e79ca1d708f0f59efd592a0549eeac5 | 9cc18aeb9795e46c098d316230b5cfa73a6db9b7 | /src/main/java/com/rest/live/domain/BaseTimeEntity.java | b30a9afe108dec7ba24d27445dcfacb81f12a30f | [] | no_license | dudeoeoeo/liveTest | 4b2889fca53153396fe527a561130a694b65097b | f34992d175b11a693050a90a0b03571f11c57aab | refs/heads/master | 2023-08-02T13:03:29.524994 | 2021-10-07T11:01:41 | 2021-10-07T11:01:41 | 413,712,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 589 | java | package com.rest.live.domain;
import lombok.Getter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.EntityListeners;
import javax.persistence.MappedSuperclass;
import java.time.LocalDateTime;
@Getter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public class BaseTimeEntity {
@CreatedDate
private LocalDateTime createdDate;
@LastModifiedDate
private LocalDateTime modifiedDate;
}
| [
"dudekekek@naver.com"
] | dudekekek@naver.com |
452d5004289c0a3486bb6c5a2e517aca2a8577aa | f15710e2d64f4250d34b85cdb03a56dc553f0fe9 | /selenium-webdriver-testng/src/test/java/io/github/bonigarcia/webdriver/testng/ch3/keyboard/SliderNGTest.java | b486245defcd7485476e67f95c153cb763fc5c30 | [
"Apache-2.0"
] | permissive | zbynek/selenium-webdriver-java | fe4a99b7479dc48ccf1ddbfe34467eace6f631b4 | ba2cb93bc630086df8e05abbb91d4ef12b6fbe45 | refs/heads/master | 2023-08-06T19:56:34.256173 | 2021-09-26T08:18:12 | 2021-09-26T08:18:12 | 410,492,220 | 0 | 0 | Apache-2.0 | 2021-09-26T17:49:51 | 2021-09-26T08:17:05 | Java | UTF-8 | Java | false | false | 2,290 | java | /*
* (C) Copyright 2021 Boni Garcia (https://bonigarcia.github.io/)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package io.github.bonigarcia.webdriver.testng.ch3.keyboard;
import static java.lang.invoke.MethodHandles.lookup;
import static org.assertj.core.api.Assertions.assertThat;
import static org.slf4j.LoggerFactory.getLogger;
import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.slf4j.Logger;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import io.github.bonigarcia.wdm.WebDriverManager;
public class SliderNGTest {
static final Logger log = getLogger(lookup().lookupClass());
WebDriver driver;
@BeforeMethod
public void setup() {
driver = WebDriverManager.chromedriver().create();
}
@AfterMethod
public void teardown() throws InterruptedException {
// FIXME: pause for manual browser inspection
Thread.sleep(Duration.ofSeconds(3).toMillis());
driver.quit();
}
@Test
public void testSlider() {
driver.get(
"https://bonigarcia.dev/selenium-webdriver-java/web-form.html");
WebElement slider = driver.findElement(By.name("my-range"));
String initValue = slider.getAttribute("value");
log.debug("The initial value of the slider is {}", initValue);
for (int i = 0; i < 5; i++) {
slider.sendKeys(Keys.ARROW_RIGHT);
}
String endValue = slider.getAttribute("value");
log.debug("The final value of the slider is {}", endValue);
assertThat(initValue).isNotEqualTo(endValue);
}
}
| [
"boni.garcia@uc3m.es"
] | boni.garcia@uc3m.es |
b4d3750536effcbd1af495386707f4d0f194b679 | 0fe6cba7f00bd7b3517eb63ba81b25a3cb424443 | /GMSLib/src/com/jstakun/gms/android/ui/LayerArrayAdapter.java | b8ca3a210e787a73cd70618822c54b3ee3081311 | [] | no_license | zhaozw/gms-world-client | e9f66c293b05e7b9ccd75336db750111fb7c1a1c | ede01ae54929fdcf14843d2131d62f2f4ae35bd9 | refs/heads/master | 2021-01-16T21:57:09.560402 | 2014-07-15T08:24:00 | 2014-07-15T08:24:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,694 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.jstakun.gms.android.ui;
import android.app.Activity;
import android.graphics.drawable.BitmapDrawable;
import android.os.Handler;
import android.os.Message;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.TextView;
import com.jstakun.gms.android.config.Commons;
import com.jstakun.gms.android.config.ConfigurationManager;
import com.jstakun.gms.android.landmarks.LandmarkManager;
import com.jstakun.gms.android.landmarks.Layer;
import com.jstakun.gms.android.landmarks.LayerManager;
import com.jstakun.gms.android.routes.RoutesManager;
import com.jstakun.gms.android.ui.lib.R;
import com.jstakun.gms.android.utils.Locale;
import java.lang.ref.WeakReference;
import java.util.List;
import org.apache.commons.lang.StringUtils;
/**
*
* @author jstakun
*/
public class LayerArrayAdapter extends ArrayAdapter<String> {
private final LayerListActivity parentActivity;
private final LandmarkManager landmarkManager;
private final RoutesManager routesManager;
public LayerArrayAdapter(LayerListActivity context, List<String> names) {
super(context, R.layout.layerrow, names);
this.parentActivity = context;
this.landmarkManager = ConfigurationManager.getInstance().getLandmarkManager();
this.routesManager = ConfigurationManager.getInstance().getRoutesManager();
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
final ViewHolder holder;
View rowView = convertView;
if (rowView == null) {
LayoutInflater inflater = parentActivity.getLayoutInflater();
rowView = inflater.inflate(R.layout.layerrow, null, true);
holder = new ViewHolder();
holder.headerText = (TextView) rowView.findViewById(R.id.layerNameHeader);
holder.layerCheckbox = (CheckBox) rowView.findViewById(R.id.layerStatusCheckbox);
holder.detailText = (TextView) rowView.findViewById(R.id.layerDetailsHeader);
rowView.setTag(holder);
} else {
holder = (ViewHolder) rowView.getTag();
}
String[] layerStr = getItem(position).split(";");
final String layerKey = layerStr[0];
final String layerName = layerStr[1];
rowView.setOnClickListener(new PositionClickListener(position));
holder.headerText.setText(layerName);
BitmapDrawable image = LayerManager.getLayerIcon(layerKey, LayerManager.LAYER_ICON_SMALL,
getContext().getResources().getDisplayMetrics(), new LayerImageLoadingHandler(holder, parentActivity, layerKey));
holder.headerText.setCompoundDrawablesWithIntrinsicBounds(image, null, null, null);
holder.layerCheckbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
//System.out.println("Setting " + names[position] + " checked " + buttonView.isChecked());
landmarkManager.getLayerManager().setLayerEnabled(getItem(position).split(";")[0], buttonView.isChecked());
notifyDataSetChanged();
}
});
if (landmarkManager.getLayerType(layerKey) == LayerManager.LAYER_DYNAMIC) {
holder.layerCheckbox.setVisibility(View.GONE);
} else if (landmarkManager.getLayerManager().isLayerEnabled(layerKey)) {
holder.layerCheckbox.setVisibility(View.VISIBLE);
holder.layerCheckbox.setChecked(true);
holder.layerCheckbox.setText(Locale.getMessage(R.string.Layer_enabled));
} else {
holder.layerCheckbox.setVisibility(View.VISIBLE);
holder.layerCheckbox.setChecked(false);
holder.layerCheckbox.setText(Locale.getMessage(R.string.Layer_disabled));
}
String message = "";
String desc = null;
Layer layer = landmarkManager.getLayerManager().getLayer(layerKey);
if (layer.getType() == LayerManager.LAYER_DYNAMIC) {
String[] keywords = layer.getKeywords();
if (keywords != null) {
desc = "Keywords: " + StringUtils.join(keywords, ", ");
}
} else {
desc = layer.getDesc();
}
if (StringUtils.isNotEmpty(desc)) {
message += desc + ".\n";
}
if (layerKey.equals(Commons.ROUTES_LAYER)) {
message += Locale.getMessage(R.string.Routes_in_layer_count, routesManager.getCount());
} else {
message += Locale.getMessage(R.string.Landmark_in_layer_count, landmarkManager.getLayerSize(layerKey));
}
holder.detailText.setText(message);
rowView.setOnCreateContextMenuListener(parentActivity);
return rowView;
}
private static class ViewHolder {
protected CheckBox layerCheckbox;
protected TextView headerText;
protected TextView detailText;
}
private class PositionClickListener implements View.OnClickListener {
private int position;
public PositionClickListener(int pos) {
this.position = pos;
}
public void onClick(View v) {
parentActivity.layerAction(LayerListActivity.ACTION_OPEN, position);
}
}
private static class LayerImageLoadingHandler extends Handler {
private WeakReference<ViewHolder> viewHolder;
private WeakReference<Activity> parentActivity;
private WeakReference<String> layerName;
public LayerImageLoadingHandler(ViewHolder viewHolder, Activity parentActivity, String layerName) {
this.viewHolder = new WeakReference<ViewHolder>(viewHolder);
this.parentActivity = new WeakReference<Activity>(parentActivity);
this.layerName = new WeakReference<String>(layerName);
}
@Override
public void handleMessage(Message message) {
if (parentActivity != null && parentActivity.get() != null && !parentActivity.get().isFinishing() && viewHolder != null && viewHolder.get() != null) {
BitmapDrawable image = LayerManager.getLayerIcon(layerName.get(), LayerManager.LAYER_ICON_SMALL, parentActivity.get().getResources().getDisplayMetrics(), null);
viewHolder.get().headerText.setCompoundDrawablesWithIntrinsicBounds(image, null, null, null);
}
}
}
}
| [
"jstakun@redhat.com"
] | jstakun@redhat.com |
fe77eb59c709091ba7b2e44e4b265893de17ecb4 | b095af896ffc63db62632455d6665c872a252c86 | /springboot-retrofit-demo/src/main/java/com/example/demo/chen/UserandUpdate.java | 7d2ca61c42cd90c77a3b0b1aa76570437f6f99b1 | [] | no_license | xiaoxiaoyunlu/http-web | 8dba56207c4751e43d89c8dba0f60f3c303e486c | 92003a05be6abe4d7b906dd20d67d81b8cb55a60 | refs/heads/master | 2020-04-12T18:37:59.913918 | 2018-12-21T08:48:14 | 2018-12-21T08:48:14 | 162,685,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 464 | java | package com.example.demo.chen;
public class UserandUpdate {
String body;
String head;
UserandUpdate(){
this.head = Main.bean2Str(new HeadBase(100004));
this.body = Main.bean2Str(new Body());
}
class Body{
String phone = "18621986579" ;
Integer is_consumer = 0;
String openid="c685f4a911c7e49abcd5df2122c43e46";
String token= "976324b97982938954ef8be29c934a1f";
String username="18621986579";
}
}
| [
"374185282@qq.com"
] | 374185282@qq.com |
18f4fa618f4c736d534fc899033bcf9ff6e53051 | 7efecfed100d574bf33477c9fe658ae13f2064a7 | /SoftItFacturasC/src/common/interfaces/IControlCheque.java | 6e7effff22b0fb4b4f944d5bfbdc6287e2b1f4a4 | [] | no_license | mluceroit10/itFacturasC | 115ac1b1f2524c4f1111f718d6574cb555d8cdad | 516e64d0502ccc8ea0b067f0c29bba9ad9dcb186 | refs/heads/master | 2021-01-10T21:06:17.536028 | 2015-04-27T18:31:23 | 2015-04-27T18:31:23 | 34,683,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java | package common.interfaces;
import java.rmi.Remote;
import java.util.Vector;
import persistencia.domain.Cheque;
import server.ManipuladorPersistencia;
import common.dto.ChequeDTO;
public interface IControlCheque extends Remote {
public boolean agregarCheque(ChequeDTO ch)throws Exception;
public void eliminarCheque(Long id)throws Exception;
public void modificarCheque(Long id,ChequeDTO modificado)throws Exception;
public Vector obtenerChequesPeriodo(int mesLI,int anioLI, String estado)throws Exception;
public Vector obtenerChequesFiltro(int mesLI,int anioLI,String numero, String para, String banco, String estado)throws Exception;
public Vector obtenerChequesVencidos(int dia,int mes,int anio)throws Exception;
public boolean existeChequeNumero(Long num)throws Exception;
public ChequeDTO buscarCheque(Long id) throws Exception;
public boolean puedoEditar(ChequeDTO dto,ChequeDTO modificado)throws Exception;
public Cheque buscarChequePersistentePorId(ManipuladorPersistencia mp,Long id) throws Exception;
public void cambiarEstado(Long id,String estado,String remitidoA) throws Exception;
}
| [
"marialucero@it10coop.com.ar"
] | marialucero@it10coop.com.ar |
e10fab9f1ee57a567120a1826b54d7e9d6a7d223 | 5bd35f4cb1bbcb54405211241be722b297e3e898 | /MAYHEM-services-impl/src/main/java/es/sanitas/hos/ehealth/services/converter/AgendaConverter.java | 780f888533ada469171984843312c12437064ee9 | [] | no_license | DiegoZarco/mayhem | b812373686900d33550eb994575b40a71864b114 | 13d0ef83ce072d90632c34a3782e7d0de644d066 | refs/heads/master | 2020-05-17T12:35:02.217702 | 2015-02-20T16:41:22 | 2015-02-20T16:41:22 | 30,862,679 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,232 | java | package es.sanitas.hos.ehealth.services.converter;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import es.sanitas.hos.ehealth.services.api.vo.agenda.AgendaVO;
import es.sanitas.hos.mayhem.persistence.entities.agenda.Agenda;
@Service("agendaConverter")
public class AgendaConverter {
@Autowired
private ProveedorConverter proveedorConverter;
@Autowired
private PrestacionConverter prestacionConverter;
@Autowired
private CitaConverter citaConverter;
public AgendaVO entityToVo(final Agenda entity){
AgendaVO vo = null;
if (entity!=null){
vo = new AgendaVO();
vo.setFecha(entity.getFecha());
vo.setId(entity.getId());
vo.setLstCitas(citaConverter.lstEntitiesToLstVo(entity.getCitas()));
vo.setProveedor(proveedorConverter.entityToVo(entity.getProveedor()));
vo.setPrestacion(prestacionConverter.entityToVo(entity.getPrestacion()));
}
return vo;
}
public List<AgendaVO> lstEntitiesToLstVo(List<Agenda> lstEntities){
List<AgendaVO> lstVo = new ArrayList<AgendaVO>();
for (Agenda entity : lstEntities){
lstVo.add(this.entityToVo(entity));
}
return lstVo;
}
}
| [
"diegozarco@gmail.com"
] | diegozarco@gmail.com |
fc6515625d9e1a24493fceb99c19f25fac8eb349 | e5f9f4ee819b8151eb3fcd73de9b7deedd2f9e26 | /ad-service/ad-common/src/main/java/com/gavin/ad/dump/DConstant.java | 02ba53b901a09c6911b49a475989324fc12f2579 | [] | no_license | codemonkey-gavin/ad | 39ff4796bdd333c353e7733a465651d82b5c0b66 | f1794aaa949561248d2242c81c7018a39c474f44 | refs/heads/master | 2022-06-28T06:13:39.050183 | 2019-10-07T15:22:37 | 2019-10-07T15:22:37 | 200,477,062 | 0 | 0 | null | 2023-09-05T22:00:34 | 2019-08-04T10:06:04 | Java | UTF-8 | Java | false | false | 624 | java | package com.gavin.ad.dump;
public class DConstant {
public static final String DATA_ROOT_PATH = "E:/ad_data/";
// 各个表数据的存储文件名
public static final String AD_PLAN = "ad_plan.data";
public static final String AD_UNIT = "ad_unit.data";
public static final String AD_CREATIVE = "ad_creative.data";
public static final String AD_CREATIVE_UNIT = "ad_creative_unit.data";
public static final String AD_UNIT_IT = "ad_unit_it.data";
public static final String AD_UNIT_DISTRICT = "ad_unit_district.data";
public static final String AD_UNIT_KEYWORD = "ad_unit_keyword.data";
}
| [
"chenggang_cn@126.com"
] | chenggang_cn@126.com |
8f16cb6c39155e8cd725d058ec0aaac4afaf5396 | 7753664215d195a569089d6b877806bf01e26a55 | /src/com/balsamiq/mockups/AlertBox.java | b8ea5094ef480215022b2a0e361f1d1f344e184c | [
"MIT"
] | permissive | edgarator/MostoQotto | f7e8b182ffaa0b83b455b09b6599f9314665bd3b | 1214bfd4137d7c4566091d812edb7526e466d4eb | refs/heads/master | 2020-05-18T16:37:01.396594 | 2014-04-29T21:35:32 | 2014-04-29T21:35:32 | 19,292,119 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,311 | java | package com.balsamiq.mockups;
/**
* @author Edgar Anzaldúa Moreno
* Follow me @edgarator
* Created on Tue Apr 29 21:37:36 CST 2014
*/
public class AlertBox extends UIElement{
public AlertBox() {
super();
super.getControlAttributes().get("controlTypeID").setPropertyValue("com.balsamiq.mockups::AlertBox");
super.getControlNodes().put("map", null);
super.getControlNodes().put("text", null);
super.getControlNodes().put("hrefs", null);
}
public Property getMap() {
return super.getControlNodes().get("map");
}
public void setMap(String map) {
this.setPropertyNode("map", map);
}
public Property getText() {
return super.getControlNodes().get("text");
}
public void setText(String text) {
this.setPropertyNode("text", text);
}
public Property getHrefs() {
return super.getControlNodes().get("hrefs");
}
public void setHrefs(String hrefs) {
this.setPropertyNode("hrefs", hrefs);
}
@Override
public String toString() {
return super.toString() + "\nAlertBox{" + "map=" + super.getControlNodes().get("map") + ", " + "text=" + super.getControlNodes().get("text") + ", " + "hrefs=" + super.getControlNodes().get("hrefs") + "}";
}
} | [
"edgar.anzaldua@gmail.com"
] | edgar.anzaldua@gmail.com |
0b9da0e9d744a6a9eb6b7f33eabe11225d8f1c52 | 886c194d785ebf2110df82e57594b981edb947cd | /app/src/main/java/com/wonsuc/coc/heavenlycontrol/model/Record.java | 5af474c8edb22531ed0df3aeccbd92fdb678254c | [] | no_license | wonsuc/heavenlycontrol | 205840efd1c0f7a5c1bbe86f42c589a850b20908 | 46da8f5134c40a9a95a8b1ec65f6972cc63e18b8 | refs/heads/master | 2021-01-01T19:42:03.722882 | 2015-07-29T22:39:09 | 2015-07-29T22:39:09 | 39,919,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,299 | java | package com.wonsuc.coc.heavenlycontrol.model;
public class Record {
/*public static final String CREATE_RECORD_TABLE = "CREATE TABLE record_list ( " +
"id INTEGER PRIMARY KEY AUTOINCREMENT, " +
"war_id INT, " +
"member_id INT, " +
"real_star INT, " +
"half_star INT, " +
"FOREIGN KEY( war_id ) REFERENCES " +
"war_list( id )," +
"FOREIGN KEY( member_id ) REFERENCES " +
"member_list( id )" + ")";*/
public int id;
public int warId;
public int memberId;
public float realStar;
public float dupStar;
public float advantage;
public float base;
public Record(){}
public Record(int id, int warId, int memberId, float realStar, float dupStar, float advantage, float base) {
super();
this.id = id;
this.warId = warId;
this.memberId = memberId;
this.realStar = realStar;
this.dupStar = dupStar;
this.advantage = advantage;
this.base = base;
}
@Override
public String toString() {
return "Record [id=" + id + ", warId=" + warId + ", memberId=" + memberId + ", realStar=" + realStar + ", dupStar=" + dupStar + ", advantage=" + advantage + ", base=" + base + "]";
}
}
| [
"wonsuc@gmail.com"
] | wonsuc@gmail.com |
564f44b2552d81b25eb74c70b8d731c1a052ab53 | 53b61f55711c19184ef6b4bb63d28ba628a60596 | /PureZhihuD/app/src/main/java/io/github/laucherish/purezhihud/ui/activity/NewsListActivity.java | 366421bae4c6d88293395a7033e34ffeb722e2dd | [] | no_license | Jack234740898/PartTimeJobAndroid | 346990b8ecb21d8e0fb00efe3582ba9015141aa9 | d89d6c8543339f56ef4b24498f3425d7f61486ca | refs/heads/master | 2021-03-17T11:02:13.665770 | 2019-07-08T11:39:52 | 2019-07-08T11:39:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,867 | java | package io.github.laucherish.purezhihud.ui.activity;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.app.FragmentTransaction;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import butterknife.Bind;
import io.github.laucherish.purezhihud.R;
import io.github.laucherish.purezhihud.base.BaseActivity;
import io.github.laucherish.purezhihud.base.Constant;
import io.github.laucherish.purezhihud.ui.adapter.NewsListAdapter;
import io.github.laucherish.purezhihud.ui.fragment.NewsListFragment;
import io.github.laucherish.purezhihud.utils.PrefUtil;
public class NewsListActivity extends BaseActivity {
@Bind(R.id.fl_main)
ViewGroup mViewGroup;
@Bind(R.id.iv_main)
ImageView mIvMain;
private final long ANIMTION_TIME = 1000;
private NewsListFragment mFragment;
private static final String TAG = "NewsListActivity";
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
onBackPressed();
}
return true;
}
@Override
protected int getLayoutId() {
return R.layout.activity_news_list;
}
@Override
protected void afterCreate(Bundle savedInstanceState) {
addFragment(0, 0, null, null);
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(SettingActivity.ACTION_LOGOUT);
registerReceiver(mBroadcastReceiver, intentFilter);
}
private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
finish();
}
};
@Override
protected void onDestroy() {
super.onDestroy();
unregisterReceiver(mBroadcastReceiver);
}
private void addFragment(int position, int scroll, NewsListAdapter adapter, String curDate) {
FragmentTransaction transaction = getFragmentManager().beginTransaction();
if (mFragment != null) {
transaction.remove(mFragment);
}
mFragment = NewsListFragment.newInstance(position, scroll, adapter, curDate);
mFragment.setmOnRecyclerViewCreated(new onViewCreatedListener());
transaction.replace(R.id.fl_container, mFragment);
transaction.commit();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_action_about:
SettingActivity.start(this);
return true;
case R.id.menu_action_daynight:
boolean isNight = PrefUtil.isNight();
if (isNight) {
PrefUtil.setDay();
setTheme(Constant.RESOURCES_DAYTHEME);
} else {
PrefUtil.setNight();
setTheme(Constant.RESOURCES_NIGHTTHEME);
}
setDrawableCahe();
getState();
return true;
default:
return super.onOptionsItemSelected(item);
}
}
@Override
protected void onResume() {
super.onResume();
}
@Override
protected void onPause() {
super.onPause();
}
private void setDrawableCahe() {
//设置false清除缓存
mViewGroup.setDrawingCacheEnabled(false);
//设置true之后可以获取Bitmap
mViewGroup.setDrawingCacheEnabled(true);
mIvMain.setImageBitmap(mViewGroup.getDrawingCache());
mIvMain.setAlpha(1f);
mIvMain.setVisibility(View.VISIBLE);
}
public void getState() {
RecyclerView recyclerView = mFragment.getRecyclerView();
recyclerView.stopScroll();
if (recyclerView.getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
int position = layoutManager.findFirstVisibleItemPosition();
int scroll = recyclerView.getChildAt(0).getTop();
addFragment(position, scroll, mFragment.getmNewsListAdapter(), mFragment.getCurDate());
}
}
private void startAnimation(final View view) {
ValueAnimator animator = ValueAnimator.ofFloat(1f).setDuration(ANIMTION_TIME);
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animation) {
float n = (float) animation.getAnimatedValue();
view.setAlpha(1f - n);
}
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
mIvMain.setVisibility(View.INVISIBLE);
}
});
animator.start();
}
class onViewCreatedListener implements NewsListFragment.OnRecyclerViewCreated {
@Override
public void recyclerViewCreated() {
startAnimation(mIvMain);
}
}
}
| [
"zfyoung799699@gmail.com"
] | zfyoung799699@gmail.com |
a6893291c0d3f4179f82200bec1fe8195fcb63bc | 60baa828af308c5a112d1b661ff5df70e7e169d0 | /src/br/com/milkmoney/service/searchers/SearchMachos.java | c115f4b1d8dd613210c2b3875fedc8d8c1923a4c | [] | no_license | ruminiki/MilkMoney | 2727ba1a9e15cd57947113f0cb6bfd1230a5d252 | 4a03b9da51c0298de25d1f2f06c37f26f515cfc5 | refs/heads/master | 2021-01-10T04:33:01.070465 | 2017-10-27T12:09:47 | 2017-10-27T12:09:47 | 36,127,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | package br.com.milkmoney.service.searchers;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import br.com.milkmoney.dao.AnimalDao;
import br.com.milkmoney.model.Animal;
import br.com.milkmoney.model.Limit;
@Service
public class SearchMachos extends Search<Integer, Animal> {
@Autowired AnimalDao dao;
@Override
public ObservableList<Animal> doSearch(Object ...objects) {
return FXCollections.observableArrayList(dao.findAllMachos(Limit.UNLIMITED));
}
}
| [
"ruminikis@gmail.com"
] | ruminikis@gmail.com |
fc953194f70c66e67b097924b06705bfbf675e08 | 57ee988f58e7dbdeffcbe1ce58b566f71452bcd0 | /kf5sdkModule/src/main/java/com/kf5/sdk/helpcenter/ui/HelpCenterTypeChildActivity.java | 1089edb94ed599e69e8e64679a72815057def1bc | [] | no_license | AndroidLwk/android_unlimited | 52d0e75533f80a8eacb75d368b28f0cf88b1dedc | 67fb33539f75d47cebcaf6cbc5718991a3e5db87 | refs/heads/master | 2022-10-17T10:36:10.593566 | 2020-06-08T01:36:17 | 2020-06-08T01:36:17 | 270,985,317 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 717 | java | package com.kf5.sdk.helpcenter.ui;
import com.kf5.sdk.R;
import com.kf5.sdk.system.entity.TitleBarProperty;
/**
* 帮助中心之文档列表
*/
public class HelpCenterTypeChildActivity extends BaseHelpCenter {
@Override
protected HelpCenterType getHelpCenterType() {
return HelpCenterType.Post;
}
@Override
protected TitleBarProperty getTitleBarProperty() {
return new TitleBarProperty.Builder()
.setTitleContent(getResources().getString(R.string.kf5_article_list))
.setRightViewVisible(true)
.setRightViewClick(true)
.setRightViewContent(getString(R.string.kf5_contact_us))
.build();
}
}
| [
"jason1985"
] | jason1985 |
72e0aab00219902507d63e2e6f24ee21477c99f4 | aaa11746d5e1642cd1372fa1bd2e2b520a9369d9 | /src/main/java/com/wang/gongzuoliu/config/MyUserGroupManager.java | 446017881e15b73dc2e98e0cc4f40c363d2d28eb | [] | no_license | 13294033711/ActivitiDemo | d2f11131dec484a92c05cb61ecfd60ad07a9d9ba | d0e6c946200364d034bbf020e3b541fdb2ec75e4 | refs/heads/master | 2022-12-26T22:00:30.432741 | 2020-03-30T07:34:27 | 2020-03-30T07:34:27 | 304,513,566 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 647 | java | package com.wang.gongzuoliu.config;
import org.activiti.api.runtime.shared.identity.UserGroupManager;
import org.springframework.context.annotation.Configuration;
import java.util.List;
@Configuration
public class MyUserGroupManager implements UserGroupManager {
@Override
public List<String> getUserGroups(String s) {
return null;
}
@Override
public List<String> getUserRoles(String s) {
System.out.println("测试");
return null;
}
@Override
public List<String> getGroups() {
return null;
}
@Override
public List<String> getUsers() {
return null;
}
}
| [
"wangchen@etongeis.com"
] | wangchen@etongeis.com |
e1ba42cc1e747ac4fc6208be1c6bb630c8baea71 | 52a21781aa76164257d38318a4f7f96b01dbc641 | /it/uniroma1/sapy/exception/SintassiException.java | 784265e2c440b0809bafb0ee42d82013d399145b | [] | no_license | LarstackUSAL/sapy1.0 | be038356990d56f3a3a02706046d40ceb4a84021 | b96af7eece97a15795e223a8957bf3f5d1e2f402 | refs/heads/master | 2021-05-27T09:55:09.643014 | 2014-10-30T18:06:18 | 2014-10-30T18:06:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package it.uniroma1.sapy.exception;
import it.uniroma1.sapy.lexer.token.Tok;
/**
* Eccezione lanciata in caso di errore di sintassi.
*/
public class SintassiException extends Exception
{
/**
* Tok che definisce il tipo di Token previsto.
*/
private Tok tipo;
/**
* Costruttore
* @param tipo - tipo di token previsto.
*/
public SintassiException(Tok tipo)
{
this.tipo = tipo;
}
/**
* Stampa l'errore che si è verificato.
*/
@Override
public void printStackTrace()
{
System.out.println("Errore di sintassi - Previsto il token "+tipo);
}
}
| [
"leonardo.ricciotti@gmail.com"
] | leonardo.ricciotti@gmail.com |
64da18bfa69056e3dcb368c07b6fe63404a9aed7 | b77bf23ba60db5794445b8204317ed8b7388a2fd | /net/minecraft/item/ItemAppleGold.java | 7460f63f8fa03a8b543c554b3051953b38bd43e1 | [] | no_license | SulfurClient/Sulfur | f41abb5335ae9617a629ced0cde4703ef7cc5f2c | e54efe14bb52d09752f9a38d7282f0d1cd81e469 | refs/heads/main | 2022-07-29T03:18:53.078298 | 2022-02-02T15:09:34 | 2022-02-02T15:09:34 | 426,418,356 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | package net.minecraft.item;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;
import java.util.List;
public class ItemAppleGold extends ItemFood {
// private static final String __OBFID = "CL_00000037";
public ItemAppleGold(int p_i45341_1_, float p_i45341_2_, boolean p_i45341_3_) {
super(p_i45341_1_, p_i45341_2_, p_i45341_3_);
this.setHasSubtypes(true);
}
public boolean hasEffect(ItemStack stack) {
return stack.getMetadata() > 0;
}
/**
* Return an item rarity from EnumRarity
*/
public EnumRarity getRarity(ItemStack stack) {
return stack.getMetadata() == 0 ? EnumRarity.RARE : EnumRarity.EPIC;
}
protected void onFoodEaten(ItemStack p_77849_1_, World worldIn, EntityPlayer p_77849_3_) {
if (!worldIn.isRemote) {
p_77849_3_.addPotionEffect(new PotionEffect(Potion.absorption.id, 2400, 0));
}
if (p_77849_1_.getMetadata() > 0) {
if (!worldIn.isRemote) {
p_77849_3_.addPotionEffect(new PotionEffect(Potion.regeneration.id, 600, 4));
p_77849_3_.addPotionEffect(new PotionEffect(Potion.resistance.id, 6000, 0));
p_77849_3_.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 6000, 0));
}
} else {
super.onFoodEaten(p_77849_1_, worldIn, p_77849_3_);
}
}
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
*
* @param subItems The List of sub-items. This is a List of ItemStacks.
*/
public void getSubItems(Item itemIn, CreativeTabs tab, List subItems) {
subItems.add(new ItemStack(itemIn, 1, 0));
subItems.add(new ItemStack(itemIn, 1, 1));
}
}
| [
"45654930+Kansioo@users.noreply.github.com"
] | 45654930+Kansioo@users.noreply.github.com |
9542658d3f78b4298240c21d9344f7b5a7eba5c4 | 5e39d702888f62c4e41e117a9cc5ae871331fed6 | /my algorithms/src/io/MyCompressorOutputStream.java | 138830252c00fbd31d4eb5aed6d386ef33024c28 | [] | no_license | kenanbarak/Java-Project | 7855d2ca05d478a24d3d359d327b6e43b680c3c7 | 7b106fc971d459462b16c947732e62cd75327ccc | refs/heads/master | 2021-01-10T23:48:13.044711 | 2016-10-13T11:09:16 | 2016-10-13T11:09:16 | 70,794,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,606 | java | package io;
import java.io.IOException;
import java.io.OutputStream;
/**
* compress information and write it to the output stream source
* @author Barak Kenan
*/
public class MyCompressorOutputStream extends OutputStream
{
private OutputStream out;
private int count;
private int prevSign;
/**
* constructor
* @param out output stream source
*/
public MyCompressorOutputStream(OutputStream out)
{
this.out=out;
this.count=0;
this.prevSign=0;
}
/**
* {@inheritDoc}
*/
@Override
public void write(int b) throws IOException
{
if(count==0) //the first time we are writing
{
prevSign=b;
count++;
}
else if(b==prevSign) //if it's the same sign, we count it
{
count++;
}
else
{
while(count>255) //if there are more than 255 times the same sign, we will restart the counter (modulo)
{
out.write(prevSign);
out.write(255);
count-=255;
}
//there is a new sign - so write the previous with it's counter and start again to count
out.write(prevSign);
out.write(count);
prevSign=b;
count=1;
}
}
public void write(byte[] arr)throws IOException
{
super.write(arr);
out.write(prevSign); //writing the last sign
out.write(count); //writing it's counter
out.close();
}
/**
* getter
* @return the output stream source
*/
public OutputStream getOut()
{
return out;
}
/**
* setter
* @param out the new output stream source
*/
public void setOut(OutputStream out)
{
this.out = out;
}
}
| [
"barakkenann@gmail.com"
] | barakkenann@gmail.com |
9df9c0e86f6071091d01f51dbd253611d071a47f | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project40/src/main/java/org/gradle/test/performance40_3/Production40_265.java | 82eef76c500c1f6a53bd8ee49ce8802ac57b06c7 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance40_3;
public class Production40_265 extends org.gradle.test.performance13_3.Production13_265 {
private final String property;
public Production40_265() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
108c97d99887e0f43cb0cbbbb9cffa8fd727e7ee | e772eea47a3de5fae1ac6d2962af4061d1d9ba5d | /io.github.dice-project.ddsm/src/ddsm/validation/ResourceValidator.java | ab74a998747b3e12b8b093e4cd0d78599a893c8b | [] | no_license | perezp/DICE-Models | 7081d114070d9231245bc3d7f56a18093b293e6b | 9c18de4b27ef98477029cfad9b9ba6dd4d72b3ba | refs/heads/master | 2020-04-08T16:18:38.833523 | 2016-06-28T10:51:43 | 2016-06-28T10:51:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 633 | java | /**
*
* $Id$
*/
package ddsm.validation;
import ddsm.Script;
import org.eclipse.emf.common.util.EList;
/**
* A sample validator interface for {@link ddsm.Resource}.
* This doesn't really do anything, and it's not a real EMF artifact.
* It was generated by the org.eclipse.emf.examples.generator.validator plug-in to illustrate how EMF's code generator can be extended.
* This can be disabled with -vmargs -Dorg.eclipse.emf.examples.generator.validator=false.
*/
public interface ResourceValidator {
boolean validate();
boolean validateResourceId(String value);
boolean validateScripts(EList<Script> value);
}
| [
"michele.guerriero2391@gmail.com"
] | michele.guerriero2391@gmail.com |
b4d57d773ad98624f99201859122ba3af2f1b8b9 | cac365ea219f729960563735e44bc0e76002ca90 | /src/main/java/com/senla/povargo/hotel/service/ServiceManagement.java | e13aea3100ac12d2628153f09f7ecc669a75877c | [] | no_license | dilexet/senla.task_5 | ee559018e6fafd1f9b7ef0e8c7f7ed9c5bea4105 | f2fe69aa31c04674fb44062b22d83fb80ae7fcb6 | refs/heads/main | 2023-05-08T13:08:32.067351 | 2021-05-31T13:22:33 | 2021-05-31T13:22:33 | 364,858,388 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,825 | java | package com.senla.povargo.hotel.service;
import com.senla.povargo.hotel.repository.ServiceRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ServiceManagement {
@Autowired
ServiceRepository serviceRepository;
public List<com.senla.povargo.hotel.entity.Service> getServices(Sort sort) throws Exception {
var services = serviceRepository.findAll(sort);
if (services.isEmpty()) {
throw new Exception("No services");
}
return services;
}
public String changePriceService(String serviceName, double newPrice) {
var service = serviceRepository.findByServiceName(serviceName);
if (service == null) {
return "Service not found";
} else {
service.setPrice(newPrice);
serviceRepository.save(service);
return "The cost of the " + service.getServiceName() + " service has been changed to " + service.getPrice() + "$";
}
}
public String addService(com.senla.povargo.hotel.entity.Service service) {
var services = serviceRepository.findByServiceName(service.getServiceName());
if (services != null) {
return "A service with this name already exists";
} else {
serviceRepository.save(service);
return "Service " + service.getServiceName() + " added successfully";
}
}
public com.senla.povargo.hotel.entity.Service getById(Long id) throws Exception {
var service = serviceRepository.findById(id).orElse(null);
if (service == null) {
throw new Exception("Service not found");
}
return service;
}
}
| [
"63055058+dilexet@users.noreply.github.com"
] | 63055058+dilexet@users.noreply.github.com |
e2123a9198e0700ad2c43cb5a0f0549f33d11289 | cb58fcd42c06a4cc9474a991466e62ece9c31327 | /src/main/java/com/boot/template/extendstest/AbstractClass.java | 6f51ccf8bec705c287ae34726808de637d053e10 | [] | no_license | shangshier/springboot01 | 91f428ad6cbd360137d04617d766e836742f405a | 05cf41bbc2fbc37fd480a4185548655284543ac8 | refs/heads/master | 2021-08-12T06:48:28.525828 | 2020-04-14T06:57:05 | 2020-04-14T06:57:05 | 209,731,581 | 0 | 0 | null | 2021-08-02T17:18:45 | 2019-09-20T07:27:49 | Java | UTF-8 | Java | false | false | 608 | java | package com.boot.template.extendstest;
import org.springframework.stereotype.Component;
/**
* @author: shangshanshan
* @date: 2019-6-24 10:27
* @Description: 抽象类
*/
@Component
public abstract class AbstractClass implements InterfaceClass {
@Override
public int selectName(String name) {
return 3;
}
@Override
public String select(String str) {
return "asdhakjhkzcnkasd";
}
public abstract void getStr();
public String create(){
return "测试一下";
}
private static String getBody() {
return "private方法";
}
}
| [
"2384471184@qq.com"
] | 2384471184@qq.com |
550156eee56ebd7a6ea5586438bfb7929f608441 | 63f1a3c7faee5503744da36d7466a5cc6cdaa8e7 | /Toan4/app/src/main/java/code/admin/myapplication/MainActivity.java | 6a83fa11a4cbb0aeabf4bc499a863a3a4b85ae36 | [] | no_license | hieutran2307/bai-tap-android | 418f95693704069dea3b4ed6986b7aaf4cfa6195 | 982d20bdc58b6450f0447a240dfdba779864108b | refs/heads/master | 2020-04-11T11:29:38.249831 | 2018-12-14T07:52:33 | 2018-12-14T07:52:33 | 161,749,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,596 | java | package code.admin.myapplication;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;
public class MainActivity extends Activity {
private Restaurent r=new Restaurent();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button save =findViewById(R.id.save);
save.setOnClickListener(onSave);
}
private View.OnClickListener onSave = new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText name = (EditText) findViewById(R.id.name);
EditText address = (EditText) findViewById(R.id.addr);
r.setName(name.getText().toString());
r.setAddress(address.getText().toString());
RadioGroup type = (RadioGroup) findViewById(R.id.type);
switch (type.getCheckedRadioButtonId()) {
case R.id.take_out:
r.setType("Take out");
break;
case R.id.sit_down:
r.setType("Sit down");
break;
case R.id.delivery:
r.setType("Deleviry");
break;
}
Toast.makeText(MainActivity.this, r.getName() + " " + r.getAddress()+" "+r.getType(), Toast.LENGTH_SHORT).show();
}
};
}
| [
"sinhvien"
] | sinhvien |
7dab6d0417e30e9443692479903312b051cc7a31 | 5376e93faa13bb818854bb45f6a01e46dd4d405c | /android/app/src/main/java/com/projectgit/MainApplication.java | 37fd2efbabce9f79564037e518f77c4a6e852850 | [] | no_license | ChashikaDissanayake/projectgit | c2812e1f07270871420d7e31b210da1f155c791b | b42549ebe12cad5c45d8488be08991f7dc3eb030 | refs/heads/master | 2023-03-02T15:54:39.629149 | 2021-02-12T09:09:17 | 2021-02-12T09:09:17 | 338,262,327 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,603 | java | package com.projectgit;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.projectgit.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"chashikamalshan28@gmail.com"
] | chashikamalshan28@gmail.com |
d4b5916d7b2976b06563ae972939f2fa46a8358e | ce89b93ae3d58313e09ed2d3c24e7c558b154865 | /src/com/services/ReadWords.java | e5b92ffce326ae231175923ea2762fdad2da22b5 | [
"MIT"
] | permissive | alexandermeek/Hangman | 85c91c4e50ad2571cb96314de7a2c0ca400a8d29 | 94f79cd9d04d4365a0139aae069c582bbdda932e | refs/heads/master | 2021-04-27T15:16:06.916483 | 2018-02-22T10:57:43 | 2018-02-22T10:57:43 | 122,466,732 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,754 | java | package com.services;
import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
/**
* This class reads words for a game of hangman from a file.
* @author Alex Meek
*/
public class ReadWords {
private static final String FILEPATH = "data/";
private static final String NO_FILE_ERROR_MSG = "Cannot open ";
/**
* Reads the file.
* @param filename The name of the file to read.
* @return A list of all the words in the file.
*/
public static ArrayList<String> readFile(String filename) {
File inputFile = getOrMakeFile(filename);
Scanner in = null;
try {
in = new Scanner(inputFile);
} catch (FileNotFoundException e) {
System.out.println(NO_FILE_ERROR_MSG + filename);
System.exit(0);
}
return readData(in);
}
/**
* Gets the file itself.
* @param filename The name of the file.
* @return The file.
*/
private static File getOrMakeFile(String filename) {
File inputFile = new File(FILEPATH + filename);
File pdir = inputFile.getParentFile();
// Checks if the parent dir exists if it doesn't create it.
if (! pdir.exists()){
pdir.mkdirs();
}
return inputFile;
}
/**
* Reads the data from the file.
* @param in The scanner containing the file.
* @return A list of all the words.
*/
private static ArrayList<String> readData(Scanner in) {
ArrayList<String> lines = new ArrayList<>();
while (in.hasNextLine()) {
lines.add(in.nextLine());
}
in.close();
return lines;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
781256ee4426e63a1e7d49f0d42833e681548967 | 54556275ca0ad0fb4850b92e5921725da73e3473 | /src/com/google/common/collect/ForwardingImmutableCollection.java | a3e3ec47a15ae640ec7baa8ebbc9d176dbebf6fc | [] | no_license | xSke/CoreServer | f7ea539617c08e4bd2206f8fa3c13c58dfb76d30 | d3655412008da22b58f031f4e7f08a6f6940bf46 | refs/heads/master | 2020-03-19T02:33:15.256865 | 2018-05-31T22:00:17 | 2018-05-31T22:00:17 | 135,638,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 249 | java | /*
* Decompiled with CFR 0_129.
*/
package com.google.common.collect;
import com.google.common.annotations.GwtCompatible;
@GwtCompatible(emulated=true)
class ForwardingImmutableCollection {
private ForwardingImmutableCollection() {
}
}
| [
"voltasalt@gmail.com"
] | voltasalt@gmail.com |
ed83aa400e73bebfebff32d141c4709d7891068c | 9151fdbdcf59bb71a41815ca5cb9555ae21ac159 | /src/main/java/bj/springboot/ocproject/webappemp/model/Employee.java | fb7a43712a9e4d943685791ab91289bda4554fbd | [] | no_license | koudousI/webappemp | 38a4ea7720e684cccd1d7baecae7e7f641a6aeb4 | 2292c96337a74d969efcd72d086d42996c52ac29 | refs/heads/master | 2023-03-06T19:53:58.627854 | 2021-02-15T20:35:18 | 2021-02-15T20:35:18 | 339,198,616 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package bj.springboot.ocproject.webappemp.model;
import lombok.Data;
@Data
public class Employee {
private Integer id;
private String firstName;
private String lastName;
private String mail;
private String password;
} | [
"kudux01@gmail.com"
] | kudux01@gmail.com |
bbe34275569def9659545cf6c36a0eea64bd0670 | 16d0a2d50659354f8b2df6509cfb1360f0ee0562 | /app/src/main/java/com/rpd/irepair/MainActivity.java | d1779e91895ee100c6870f8ad2c2a24ceff666c5 | [] | no_license | petardan/Rep200917 | a2d5c5f0552d18aeb91f8fe6551b51a3c4dcf2fd | 918f99a2e89402a22cfbc588b9bd9621f6d87ef8 | refs/heads/master | 2018-12-01T06:28:00.947448 | 2018-09-21T19:15:19 | 2018-09-21T19:15:19 | 104,206,909 | 0 | 0 | null | 2018-09-21T12:00:45 | 2017-09-20T11:29:36 | Java | UTF-8 | Java | false | false | 23,261 | java | package com.rpd.irepair;
import android.annotation.TargetApi;
import android.app.DialogFragment;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.util.Log;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.GridLayout;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.rpd.customClasses.Profession;
import com.rpd.customClasses.Region;
import com.rpd.customClasses.Repairman;
import com.rpd.customClasses.User;
import com.rpd.customViews.LargeRepairmanInfoFragment;
import com.rpd.customViews.SmallRepairmanItem;
import com.rpd.datawrappers.DataWrapperRegions;
import com.rpd.services.BackgroundService;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
SharedPreferences mPrefs;
Context context;
//Current loged-in user
User user;
ImageView headerProfilePictureImageView;
TextView headerUsernameTextView;
TextView headerEmailTextView;
//Category navigationVIew
NavigationView categoryNavigationView;
Menu navigationDrawerMenu;
//Define list of professions, regions and repairmans, for testing purpose
ArrayList<Profession> professions;
ArrayList<Region> regions;
ArrayList<Repairman> repairmans;
//Grid layout for the repairman list
GridLayout repairmanList;
//Firebase authentification
FirebaseAuth auth;
FirebaseAuth.AuthStateListener mAuthStateListener;
FirebaseUser currentFirebaseUser;
//Firebase database
FirebaseDatabase mFirebaseDatabase;
DatabaseReference professionsDatabaseReference;
DatabaseReference userDatabaseReference;
DatabaseReference repairmanDatabaseReference;
@Override
protected void onCreate(Bundle savedInstanceState) {
//Getting the professions list from Loading.class
DataWrapperRegions dwReg = (DataWrapperRegions) getIntent().getSerializableExtra("REGIONS");
professions = new ArrayList<Profession>();
repairmans = new ArrayList<Repairman>();
regions = dwReg.getParliaments();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Start of Initializing
context = this;
mPrefs = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);
//Get Firebase auth instance
auth = FirebaseAuth.getInstance();
currentFirebaseUser = FirebaseAuth.getInstance().getCurrentUser();
//Initiate Firebase database
mFirebaseDatabase = FirebaseDatabase.getInstance();
professionsDatabaseReference = mFirebaseDatabase.getReference().child("professions");
userDatabaseReference = mFirebaseDatabase.getReference().child("users").child(currentFirebaseUser.getUid());
repairmanDatabaseReference = mFirebaseDatabase.getReference().child("repairmans");
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//Add job button
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(context, BackgroundService.class);
context.startService(intent);
Snackbar.make(view, "Background service started", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
//Left side drawer
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
categoryNavigationView = (NavigationView) findViewById(R.id.nav_view);
navigationDrawerMenu = categoryNavigationView.getMenu();
categoryNavigationView.inflateMenu(R.menu.categories);
categoryNavigationView.setNavigationItemSelectedListener(this);
repairmanList = (GridLayout)findViewById(R.id.repairmen_list);
//End of Initializing
//Firebase Auth listener
mAuthStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if(user != null){
}
else {
Intent i = new Intent(MainActivity.this, LoginActivity.class);
startActivity(i);
finish();
}
}
};
//Adding the listener to the database reference
professionsDatabaseReference.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
professions.add(dataSnapshot.getValue(Profession.class)); //add result into array list
addProfessionToDrawer(dataSnapshot.getValue(Profession.class));
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
professions.add(dataSnapshot.getValue(Profession.class)); //add result into array list
addProfessionToDrawer(dataSnapshot.getValue(Profession.class));
Log.d("Profesion", s);
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
Toast.makeText(context, "Error retreiving professions from database", Toast.LENGTH_LONG).show();
}
});
//Get current user
userDatabaseReference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(dataSnapshot.exists())
{
user = dataSnapshot.getValue(User.class);
setUserHeaderProfile(user);
} else {
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
//Get repairmans
repairmanDatabaseReference.addChildEventListener(new ChildEventListener() {
@Override
public void onChildAdded(DataSnapshot dataSnapshot, String s) {
repairmans.add(dataSnapshot.getValue(Repairman.class)); //add result into array list
addRepairmanItem(dataSnapshot.getValue(Repairman.class));
Log.d("Test", dataSnapshot.toString());
}
@Override
public void onChildChanged(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onChildRemoved(DataSnapshot dataSnapshot) {
}
@Override
public void onChildMoved(DataSnapshot dataSnapshot, String s) {
}
@Override
public void onCancelled(DatabaseError databaseError) {
}
});
}
private void setUserHeaderProfile(User user) {
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
//User profile elements initialization
headerProfilePictureImageView = (ImageView) findViewById(R.id.profilePicture);
headerUsernameTextView = (TextView) findViewById(R.id.userName);
headerEmailTextView = (TextView) findViewById(R.id.userEmail);
Picasso.with(context).load(user.getProfilePictureURL()).into(headerProfilePictureImageView);
headerUsernameTextView.setText("Welcome " + user.getUserName());
headerEmailTextView.setText(user.getEmail());
}
private void addRepairmanItem(final Repairman repairman) {
SmallRepairmanItem smallReapiSmallRepairmanItem = new SmallRepairmanItem(context, repairmanList.getColumnCount(), repairman);
smallReapiSmallRepairmanItem.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle bundle = new Bundle();
bundle.putSerializable("REPAIRMAN", repairman);
DialogFragment largeRepaimanFragment = new LargeRepairmanInfoFragment();
largeRepaimanFragment.setArguments(bundle);
largeRepaimanFragment.show(getFragmentManager(),"Large Repairman Fragment");
}
});
repairmanList.addView(smallReapiSmallRepairmanItem);
}
private ArrayList<Repairman> setRepairmansToDatabase() {
ArrayList<Repairman> repairmans = new ArrayList<Repairman>();
//Create dummy professions for testing purposes
ArrayList<Profession> professions = new ArrayList<Profession>();
Profession profession1 = new Profession(Integer.valueOf(1).toString(),Integer.valueOf(100).toString(), "profession1", "prof1_desc");
Profession profession2 = new Profession(Integer.valueOf(2).toString(),Integer.valueOf(100).toString(), "profession2", "prof2_desc");
Profession profession3 = new Profession(Integer.valueOf(3).toString(),Integer.valueOf(200).toString(), "profession3", "prof3_desc");
Profession profession4 = new Profession(Integer.valueOf(4).toString(),Integer.valueOf(200).toString(), "profession4", "prof4_desc");
professions.add(profession1);
professions.add(profession2);
professions.add(profession3);
professions.add(profession4);
//Create dummy repairmans
ArrayList<Region> rep1reg = new ArrayList<Region>();
rep1reg.add(regions.get(0));
rep1reg.add(regions.get(1));
ArrayList<Profession> rep1prof = new ArrayList<Profession>();
rep1prof.add(professions.get(0));
rep1prof.add(professions.get(1));
Repairman repairman1 = new Repairman("1", "Rep", "1", "rep1@rep.com", "Addr1", "111", "112", "First repairman", "4.7" , rep1reg, rep1prof, "www.rep1.com/url" );
ArrayList<Region> rep2reg = new ArrayList<Region>();
rep2reg.add(regions.get(2));
ArrayList<Profession> rep2prof = new ArrayList<Profession>();
rep2prof.add(professions.get(0));
Repairman repairman2 = new Repairman("2", "Rep", "2", "rep2@rep.com", "Addr2", "221", "222", "Second repairman", "3.7" , rep2reg, rep2prof, "www.rep2.com/url" );
ArrayList<Region> rep3reg = new ArrayList<Region>();
rep3reg.add(regions.get(2));
ArrayList<Profession> rep3prof = new ArrayList<Profession>();
rep3prof.add(professions.get(0));
rep3prof.add(professions.get(2));
Repairman repairman3 = new Repairman("3", "Rep", "3", "rep3@rep.com", "Addr3", "331", "332", "Third repairman", "2.7" , rep3reg, rep3prof, "www.rep3.com/url" );
ArrayList<Region> rep4reg = new ArrayList<Region>();
rep4reg.add(regions.get(0));
rep4reg.add(regions.get(1));
ArrayList<Profession> rep4prof = new ArrayList<Profession>();
rep4prof.add(professions.get(2));
rep4prof.add(professions.get(3));
Repairman repairman4 = new Repairman("4", "Rep", "4", "rep4@rep.com", "Addr4", "441", "442", "Fourth repairman", "1.7" , rep4reg, rep4prof, "www.rep4.com/url" );
repairmans.add(repairman1);
repairmans.add(repairman2);
repairmans.add(repairman3);
repairmans.add(repairman4);
repairmanDatabaseReference.child("Repairman1").setValue(repairman1).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
} else{
Toast.makeText(MainActivity.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
}
}
});
repairmanDatabaseReference.child("Repairman2").setValue(repairman1).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Log.d("Test", "Do tuka stiga");
} else{
Log.d("Test", "Do tuka ne stiga " + task.getException());
Toast.makeText(MainActivity.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
}
}
});
repairmanDatabaseReference.child("Repairman3").setValue(repairman1).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Log.d("Test", "Do tuka stiga");
} else{
Log.d("Test", "Do tuka ne stiga " + task.getException());
Toast.makeText(MainActivity.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
}
}
});
repairmanDatabaseReference.child("Repairman4").setValue(repairman1).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()){
Log.d("Test", "Do tuka stiga");
} else{
Log.d("Test", "Do tuka ne stiga " + task.getException());
Toast.makeText(MainActivity.this, "Authentication failed." + task.getException(),
Toast.LENGTH_SHORT).show();
}
}
});
return repairmans;
}
private void addProfessionToDrawer(Profession profession) {
MenuItem professionMenuItem = navigationDrawerMenu.add(R.id.category_group, profession.getId(), profession.getCategoryId()+1, profession.getName());
professionMenuItem.setVisible(false);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
//Create menu in the top right corner (Settings)
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
//OnClick listener for top right corner (Settings) menu
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
if (id == R.id.sign_out){
signoutUser();
return true;
}
return super.onOptionsItemSelected(item);
}
//onClick listener for category selection
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
//Get strings.xml resource
Resources res = getResources();
//Set default menu item from the professions - first profession
MenuItem menuItem = navigationDrawerMenu.findItem(professions.get(0).getId());;
if (id == R.id.category_construction) {
for(int i=0; i<professions.size(); i++){
menuItem = navigationDrawerMenu.findItem(professions.get(i).getId());
if((menuItem.getOrder() == item.getOrder()+1)&&(!menuItem.isVisible())){
menuItem.setVisible(true);
}
else{
menuItem.setVisible(false);
}
}
//categoryNavigationView.getMenu().clear();
} else if (id == R.id.category_appliances) {
for(int i=0; i<professions.size(); i++){
menuItem = navigationDrawerMenu.findItem(professions.get(i).getId());
if((menuItem.getOrder() == item.getOrder()+1)&&(!menuItem.isVisible())){
menuItem.setVisible(true);
}
else{
menuItem.setVisible(false);
}
}
} else if (id == R.id.category_cars) {
for(int i=0; i<professions.size(); i++){
menuItem = navigationDrawerMenu.findItem(professions.get(i).getId());
if((menuItem.getOrder() == item.getOrder()+1)&&(!menuItem.isVisible())){
menuItem.setVisible(true);
}
else{
menuItem.setVisible(false);
}
}
} else if (id == R.id.category_food) {
for(int i=0; i<professions.size(); i++){
menuItem = navigationDrawerMenu.findItem(professions.get(i).getId());
if((menuItem.getOrder() == item.getOrder()+1)&&(!menuItem.isVisible())){
menuItem.setVisible(true);
}
else{
menuItem.setVisible(false);
}
}
} else if (id == R.id.category_technology) {
for(int i=0; i<professions.size(); i++){
menuItem = navigationDrawerMenu.findItem(professions.get(i).getId());
if((menuItem.getOrder() == item.getOrder()+1)&&(!menuItem.isVisible())){
menuItem.setVisible(true);
}
else{
menuItem.setVisible(false);
}
}
} else if (id == R.id.category_style) {
for(int i=0; i<professions.size(); i++){
menuItem = navigationDrawerMenu.findItem(professions.get(i).getId());
if((menuItem.getOrder() == item.getOrder()+1)&&(!menuItem.isVisible())){
menuItem.setVisible(true);
}
else{
menuItem.setVisible(false);
}
}
} else if (id == R.id.category_other) {
for(int i=0; i<professions.size(); i++){
menuItem = navigationDrawerMenu.findItem(professions.get(i).getId());
if((menuItem.getOrder() == item.getOrder()+1)&&(!menuItem.isVisible())){
menuItem.setVisible(true);
}
else{
menuItem.setVisible(false);
}
}
} else if (id == R.id.category_logout){
auth.signOut();
// this listener will be called when there is change in firebase user session
FirebaseAuth.AuthStateListener authListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user == null) {
// user auth state is changed - user is null
// launch login activity
startActivity(new Intent(MainActivity.this, LoginActivity.class));
finish();
}
}
};
} else if(id == R.id.category_user_settings){
Intent i = new Intent(MainActivity.this, UserProfileActivity.class);
startActivity(i);
} else if (id == R.id.category_opened_jobs){
Intent i = new Intent(MainActivity.this, OpenedJobsPerUserActivity.class);
startActivity(i);
} else if (id == R.id.category_confirmed_jobs){
Intent i = new Intent(MainActivity.this, ConfirmedJobsPerUserActivity.class);
startActivity(i);
} else if (id == R.id.category_finished_jobs){
Intent i = new Intent(MainActivity.this, FinishedJobsPerUserActivity.class);
startActivity(i);
} else if (id == R.id.category_canceled_jobs){
Intent i = new Intent(MainActivity.this, CanceledJobsPerUserActivity.class);
startActivity(i);
}
else {
setActionBarSubtitle(item.getTitle().toString());
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
}
return true;
}
//Setting Action Bar title and subtitle
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setActionBarSubtitle(String subtitle) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
android.support.v7.app.ActionBar ab = getSupportActionBar();
ab.setTitle("iRepair");
ab.setSubtitle(subtitle);
}
}
private void signoutUser(){
auth.signOut();
}
@Override
protected void onResume() {
super.onResume();
auth.addAuthStateListener(mAuthStateListener);
}
@Override
protected void onPause() {
super.onPause();
auth.removeAuthStateListener(mAuthStateListener);
}
}
| [
"danilovski.petar@gmail.com"
] | danilovski.petar@gmail.com |
8909e8b68368a585204ee7f708ddbfad23ad47aa | acc6daa193c18b381742a6ca711587e989735b15 | /src/test/java/com/github/stoton/timetablebackend/parser/optivum/tests/OptivumTimetableStudentParseAllLessonsTests.java | 88ca0e200a86bc93c0d145fd2f16abedb7df87cb | [] | no_license | stoton/timetablebackend | bd2924c845b6f25173a8b97ec2982ef8960f2c47 | dc19f46e60a11c1b489cb62ac535972e91fac37f | refs/heads/master | 2020-03-25T13:07:03.719445 | 2019-06-21T23:32:48 | 2019-06-21T23:32:48 | 143,809,234 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,517 | java | package com.github.stoton.timetablebackend.parser.optivum.tests;
import com.github.stoton.timetablebackend.domain.timetable.*;
import com.github.stoton.timetablebackend.domain.timetableindexitem.optivum.OptivumTimetableIndexItem;
import com.github.stoton.timetablebackend.exception.UnknownTimetableTypeException;
import com.github.stoton.timetablebackend.parser.optivum.strategy.OptivumTimetableStrategy;
import com.github.stoton.timetablebackend.parser.optivum.strategy.OptivumTimetableStudentStrategy;
import com.github.stoton.timetablebackend.repository.optivum.OptivumTimetableIndexItemRepository;
import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.springframework.boot.jdbc.EmbeddedDatabaseConnection;
import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase;
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import static org.mockito.Mockito.when;
@RunWith(SpringRunner.class)
@SpringBootTest
@DataJpaTest
@AutoConfigureTestDatabase(connection = EmbeddedDatabaseConnection.H2)
public class OptivumTimetableStudentParseAllLessonsTests {
@Mock
OptivumTimetableIndexItemRepository optivumTimetableIndexItemRepository;
@Test
public void parseStudentTimetableWhenTimetableIsEmptyTest() throws IOException, UnknownTimetableTypeException {
Timetable expected = new Timetable();
expected.setSchedule(new Schedule());
expected.setName("4 Tż");
expected.setType("student");
OptivumTimetableStrategy optivumTimetableStrategy =
new OptivumTimetableStudentStrategy(TimetableType.STUDENT, 1L, optivumTimetableIndexItemRepository);
ClassLoader classLoader = getClass().getClassLoader();
InputStream file = classLoader.getResourceAsStream("OptivumTimetableHtmls/student.emptyTimetable.html");
assert file != null;
String html = CharStreams.toString(new InputStreamReader(
file, Charsets.UTF_8));
Document document = Jsoup.parse(html);
Timetable actual = optivumTimetableStrategy.parseAllLessonsFromHtml(document);
actual.setTimestamp(null);
Assert.assertEquals(expected, actual);
}
@Test
public void parseStudentTimetableHtmlWhenTwoGroupsAreInvalid() throws IOException, UnknownTimetableTypeException {
Timetable expected = new Timetable();
expected.setSchedule(new Schedule());
expected.setName("4 Tż");
expected.setType("student");
List<Group> groups = new ArrayList<>();
groups.add(new Group("4 Tż-1/2", "#W8", "wf", "@"));
groups.add(new Group("4 Tż-2/2", "#W9", "wf", "@"));
expected.getSchedule().getWed().add(new Lesson(0, "8:00", "8:45", groups));
OptivumTimetableStrategy optivumTimetableStrategy =
new OptivumTimetableStudentStrategy(TimetableType.STUDENT, 58L, optivumTimetableIndexItemRepository);
OptivumTimetableIndexItem optivumTimetableIndexItemW8 = new OptivumTimetableIndexItem(null, null, "#W8",
null, null, null);
OptivumTimetableIndexItem optivumTimetableIndexItemW9 = new OptivumTimetableIndexItem(null, null, "#W9",
null, null, null);
when(optivumTimetableIndexItemRepository.findFirstByShortNameAndSchool_Id("#W8", 58L)).thenReturn(optivumTimetableIndexItemW8);
when(optivumTimetableIndexItemRepository.findFirstByShortNameAndSchool_Id("#W9", 58L)).thenReturn(optivumTimetableIndexItemW9);
ClassLoader classLoader = getClass().getClassLoader();
InputStream file = classLoader.getResourceAsStream("OptivumTimetableHtmls/student.twoInvalidGroupNumer.html");
assert file != null;
String html = CharStreams.toString(new InputStreamReader(
file, Charsets.UTF_8));
Document document = Jsoup.parse(html);
Timetable actual = optivumTimetableStrategy.parseAllLessonsFromHtml(document);
actual.setTimestamp(null);
Assert.assertEquals(expected, actual);
}
}
| [
"sebastian.toton@protonmail.com"
] | sebastian.toton@protonmail.com |
f1f634e12d1e5d5cc2ab3ca83faa71b7bfb87793 | a9e7c4ffb87a8b70a5d90e0ad10a5e5f3a5d71ce | /app/src/main/java/com/example/myapplication/AddMarkerActivity.java | e764c3b6fe0c551af81f247a5c216e52db521012 | [] | no_license | fadeynotchenko/Samsung-project | 037f3ae0f6efde2f2f6d285c0e1ac422a4c03344 | 54ac3eac1440db4017c05a5f4d2802bc8b56b5e2 | refs/heads/master | 2023-06-02T03:53:20.368453 | 2021-06-14T10:02:17 | 2021-06-14T10:02:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,929 | java | package com.example.myapplication;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.MimeTypeMap;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RadioGroup;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.storage.FirebaseStorage;
import com.google.firebase.storage.StorageReference;
import java.util.Objects;
import de.hdodenhof.circleimageview.CircleImageView;
public class AddMarkerActivity extends AppCompatActivity {
private DatabaseReference reference, reference2;
private String email, name, phone;
private RadioGroup radioGroup;
private FirebaseAuth mAuth;
private ImageView uploadImage;
private CircleImageView imageView;
private StorageReference root = FirebaseStorage.getInstance().getReference();
private Uri imageUri;
private ProgressBar progressBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_marker);
radioGroup = findViewById(R.id.radioGroup);
imageView = findViewById(R.id.viewImage);
imageView.setImageResource(R.drawable.ic_user2);
uploadImage = findViewById(R.id.addImage);
progressBar = findViewById(R.id.progressBar);
progressBar.setVisibility(View.INVISIBLE);
//data
FirebaseDatabase rootNode = FirebaseDatabase.getInstance();
reference = rootNode.getReference("markers");
reference2 = rootNode.getReference("users");
mAuth = FirebaseAuth.getInstance();
email = Objects.requireNonNull(mAuth.getCurrentUser()).getEmail();
SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(email, MODE_PRIVATE);
name = sharedPreferences.getString("name", "");
phone = sharedPreferences.getString("phone", "");
ImageView close = findViewById(R.id.close2);
close.setOnClickListener(v -> finish());
Button save = findViewById(R.id.addBtn);
save.setOnClickListener(v -> addMarker());
uploadImage.setOnClickListener(v -> {
Intent gallery = new Intent();
gallery.setAction(Intent.ACTION_GET_CONTENT);
gallery.setType("image/*");
startActivityForResult(gallery, 2);
});
}
private void addMarker() {
if (imageUri != null) {
uploadToFirebase(imageUri);
}
int radioId = radioGroup.getCheckedRadioButtonId();
String markerString = Integer.toString(radioId);
EditText addproblem = findViewById(R.id.addProblem);
String info = addproblem.getText().toString().trim();
if (info.isEmpty()) {
addproblem.setError(getString(R.string.infoEmpty));
return;
}
String img = "null";
Marker marker = new Marker(info, name, phone, markerString, img);
reference.child(phone).setValue(marker);
reference2.child(phone).child("info").setValue(markerString);
startActivity(new Intent(AddMarkerActivity.this, MapsActivity.class));
finish();
}
private void uploadToFirebase(Uri uri) {
StorageReference fileRef = root.child(System.currentTimeMillis() + "." + getFile(uri));
fileRef.putFile(uri).addOnSuccessListener(taskSnapshot -> fileRef.getDownloadUrl().addOnSuccessListener(uri1 -> {
Model model = new Model(uri1.toString());
reference.child(phone).child("image").setValue(model);
Toast.makeText(this, getString(R.string.addMarker), Toast.LENGTH_SHORT).show();
})).addOnProgressListener(snapshot -> progressBar.setVisibility(View.VISIBLE)).addOnFailureListener(e -> {
progressBar.setVisibility(View.INVISIBLE);
Toast.makeText(this, "Ошибка!" + e, Toast.LENGTH_LONG).show();
});
}
private String getFile(Uri mUri) {
ContentResolver cr = getContentResolver();
MimeTypeMap mime = MimeTypeMap.getSingleton();
return mime.getExtensionFromMimeType(cr.getType(mUri));
}
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 2 && resultCode == RESULT_OK && data != null) {
imageUri = data.getData();
imageView.setImageURI(imageUri);
}
}
} | [
"notchenkofaddey@gmail.com"
] | notchenkofaddey@gmail.com |
a84ac3288afb7fb67011969296f4a629e06d5f9a | 01a5dbb8f408dd40b886360058674835d11c9dc0 | /src/g_oop2/Accesstest.java | 018d2907186afaad9416e36861075e23efa9a14b | [] | no_license | zxc5608/basicJava | ca4a81d0a794fbb9a69db26cf3c20f0129f19b8e | d5ad78d906fa8a936c74d770c34fb6edc241978b | refs/heads/master | 2023-04-03T22:45:12.019083 | 2021-04-10T00:18:03 | 2021-04-10T00:18:03 | 356,427,841 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 583 | java | package g_oop2;
public class Accesstest {
public static void main(String[] args) {
AccessModifier am= new AccessModifier();
System.out.println(am.publicVar);
am.publicMethod();
//접근제한이없기떄문에 다접근가능
System.out.println(am.protectedVar);
am.protectedMethod();
//같은패키지인경우 접근가능
System.out.println(am.defaultVar);
am.defaultMethod();
//같은패키지안이라
// System.out.println(am.prvateVar);
// am.privateVar;
//같은클래스안에서만 가능이라 컴파일 에러가뜸
}
}
| [
"kk109608@gmail.com"
] | kk109608@gmail.com |
5aa6cfe274b34b834ec9cc21c0973f329ef136f5 | ddaa8d1c36d81b8bf66f61045474dbd3c176e9b5 | /src/main/java/pl/sda/library/command/CreateAudioBookCommandStrategy.java | 881ca2f0c57939c95aac85d563f8895f39f76bc8 | [] | no_license | Skalaris/library | 5c088c50bf98855b57b90b8f3dc4b60d762a5ffc | 29595e8386f349dfb884038a604cccbf44df259c | refs/heads/master | 2020-04-20T11:15:30.121644 | 2019-02-24T08:59:36 | 2019-02-24T08:59:36 | 168,810,968 | 0 | 0 | null | 2019-02-24T08:59:37 | 2019-02-02T08:26:16 | Java | UTF-8 | Java | false | false | 1,362 | java | package pl.sda.library.command;
import pl.sda.library.model.AudioBookBuilder;
import pl.sda.library.model.Format;
import pl.sda.library.model.Multimedia;
import java.io.PrintStream;
import java.util.Objects;
import java.util.Scanner;
class CreateAudioBookCommandStrategy implements CreateMultimediaStrategy {
public static final String AUDIO_BOOK = "AudioBook";
@Override
public Multimedia createMultimedia(Scanner scanner, PrintStream printStream) {
printStream.println("Tytuł:");
String title = scanner.nextLine();
printStream.println("Imię autora:");
String authorFirstName = scanner.nextLine();
printStream.println("Nazwisko autora:");
String authorLastName = scanner.nextLine();
printStream.println("Format:");
String format = scanner.nextLine();
printStream.println("Czas trwania:");
int duration = scanner.nextInt();
scanner.nextLine();
return new AudioBookBuilder()//
.title(title)//
.authorFirstName(authorFirstName)//
.authorLastName(authorLastName)//
.format(Format.valueOf(format))//
.duration(duration)//
.build();
}
@Override
public boolean isTypeCorrect(String type) {
return Objects.equals(type,AUDIO_BOOK);
}
}
| [
"liralen@op.pl"
] | liralen@op.pl |
71594a182a38a4fe507f5ec2b4cbeb7d90876697 | 411ca4102b5ef85a1dc1ed4dd607a2dddccf2992 | /app/src/main/java/com/example/android/movieapp/data/MovieDbHelper.java | 41a25f3aaf55988ebd22920ebfe6940f508e7b8b | [] | no_license | AM51/MovieApp | 30e36000f70828e3108c4789cc101a75e4548eaa | e99595acb73020e6f9912381e221c1abd617304d | refs/heads/master | 2021-01-13T00:41:52.526253 | 2016-02-15T11:56:37 | 2016-02-15T11:56:37 | 51,752,245 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,564 | java | package com.example.android.movieapp.data;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by archit.m on 25/12/15.
*/
public class MovieDbHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 7;
private static final String DATABASE_NAME = "movie.db";
public MovieDbHelper(Context context) {
super(context, DATABASE_NAME,null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_MOVIE_TABLE = "CREATE TABLE "+ MovieContract.MovieEntry.TABLE_NAME + " ( "+
// MovieContract.MovieEntry._ID +" INTEGER PRIMARY KEY ," +
MovieContract.MovieEntry.COLUMN_MOVIEID + " LONG PRIMARY KEY, " +
MovieContract.MovieEntry.COLUMN_MOVIE_TITLE +" VARCHAR(100), "+
MovieContract.MovieEntry.COLUMN_MOVIE_OVERVIEW+" VARCHAR(100), "+
MovieContract.MovieEntry.COLUMN_MOVIE_DATE+" VARCHAR(100), "+
MovieContract.MovieEntry.COLUMN_MOVIE_LANGUAGE+" VARCHAR(100), "+
MovieContract.MovieEntry.COLUMN_MOVIE_RATING+" DOUBLE, "+
MovieContract.MovieEntry.COLUMN_POSTER_PATH+" VARCHAR(100) "+
" );";
db.execSQL(CREATE_MOVIE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS "+ MovieContract.MovieEntry.TABLE_NAME);
onCreate(db);
}
}
| [
"archit.m@blrmc-C02NNFLJG3QJ.local"
] | archit.m@blrmc-C02NNFLJG3QJ.local |
7e9aa681dc0e84474fb8674ed744e788688b4310 | bf2462aeff0ab1cdd819247e3c8070449f0b6e84 | /src/main/java/razvan/Tema_finala/database/repository/ProvisoryUserJpaRepository.java | f36600e31a54b3befaea9be40ab73c17b15eb601 | [] | no_license | Ravliox/tema-backend | f6a473eb24e05b868ba1f916e53fa815bf50aebf | ff6306e452093209e223245ed7cf3ccf24dd8e6c | refs/heads/master | 2020-03-19T16:44:29.162225 | 2018-06-09T17:40:41 | 2018-06-09T17:40:41 | 136,728,108 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package razvan.Tema_finala.database.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import razvan.Tema_finala.database.ProvisoryEntity.ProvisoryUser;
public interface ProvisoryUserJpaRepository extends JpaRepository<ProvisoryUser, Integer> {
ProvisoryUser findByEmail(String email);
}
| [
"istratee@gmail.com"
] | istratee@gmail.com |
6692c2dbc01abf65b07f2c239cb646ef3e187e20 | 03bda5f70e8850b04a04b68895703dd1ced336b0 | /8-session/src/main/java/com/example/a8_session/DieselEngineModule.java | 4c5347bceb8bace03595a79233586a3b09cf89a2 | [] | no_license | Edris-Ahani/Demo_Dagger2 | 160603dd027adbc32093b2760e8ce9f4be0e107c | 62853e55a75d5787c351497c4538c786a11caaee | refs/heads/master | 2023-07-31T02:37:16.722593 | 2021-10-03T06:49:01 | 2021-10-03T06:49:01 | 412,999,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package com.example.a8_session;
import dagger.Module;
import dagger.Provides;
@Module
public class DieselEngineModule {
private int horsePower;
public DieselEngineModule(int horsePower) {
this.horsePower = horsePower;
}
@Provides
int provideHorsePower(){
return horsePower;
}
@Provides
Engine providePetrolEngine(DieselEngine dieselEngine){
return dieselEngine;
}
}
| [
"edris.ahani.tutorial@gmail.com"
] | edris.ahani.tutorial@gmail.com |
ff1a672b02ca5f7db2abd785dead587933ab7678 | b4e9a2659c3d8cbf0608261a6a75e185bc4a1125 | /src/main/java/com/baomidou/springwind/mapper/RoleMapper.java | 508dbbc7130a5c15c84127248e0cdb37a5279658 | [] | no_license | fengchangsheng/SpringWind | 7ad194d0c46f3026ee0d35b0944a6c9bca0172c1 | 0ffc54f466b336da9d6cea094cd58a36c61b6ae6 | refs/heads/master | 2020-12-31T06:10:54.210856 | 2016-04-22T03:02:14 | 2016-04-22T03:02:14 | 56,822,146 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.baomidou.springwind.mapper;
import com.baomidou.springwind.entity.Role;
import com.baomidou.mybatisplus.mapper.AutoMapper;
/**
*
* Role 表数据库控制层接口
*
*/
public interface RoleMapper extends AutoMapper<Role> {
} | [
"fengchangsheng123@qq.com"
] | fengchangsheng123@qq.com |
3289abf66761ffa8ea84b404a53dc798be2ee5cb | 1bf789f0e721a7ad8fcc94cb168e4a7a0f44ceef | /app/src/main/java/org/ieselcaminas/pmdm/lightsensorexample/MainActivity.java | c8f404267ebe7c51d4ec0e13af80adb22f7215d4 | [] | no_license | ElCaminas2DAM2018/LightSensorExample | ee238a6ce75718a392cfa7a84e33e46a63fc3e3a | 6599ff83cefdb2fe079ee62aa413e618e6e594e0 | refs/heads/master | 2020-04-16T18:38:02.757636 | 2019-01-15T10:07:55 | 2019-01-15T10:07:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,723 | java | package org.ieselcaminas.pmdm.lightsensorexample;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity implements SensorEventListener {
private SensorManager mSensorManager;
private Sensor mLight;
private TextView textView;
@Override
public final void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
textView = (TextView) findViewById(R.id.textView);
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mLight = mSensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
}
@Override
public final void
onAccuracyChanged
(Sensor sensor, int accuracy) {
// Do something here if sensor accuracy changes.
}
@Override
public final void
onSensorChanged
(SensorEvent event) {
// The light sensor returns a single value.
// Many sensors return 3 values, one for each axis.
float lux = event.values[0];
// Do something with this sensor value.
textView.setText(String.format("Lux:%.2f ",lux));
}
@Override
protected void onResume() {
super.onResume();
mSensorManager.registerListener(this, mLight, SensorManager.SENSOR_DELAY_NORMAL);
}
@Override
protected void onPause() {
super.onPause();
mSensorManager.unregisterListener(this);
}
} | [
"victor@ieselcaminas.org"
] | victor@ieselcaminas.org |
02dd710885081249b44066d209b443b11555318f | f5f8b028a4c09e1946153c9b7b4bc002f303886f | /src/main/java/br/com/springboot/api_rest_w_front/Application.java | 67f1a2058a398208d24e518e62f7765764aff1ac | [] | no_license | CairoOliveiraDev/springboot-rest-api-w-front | 6d74036865632f8b2c4aacf42d09e5c1654cf947 | 8983ccbcfdd1ada0fcee5f5deb1feb43379a4f18 | refs/heads/main | 2023-06-30T12:52:03.599135 | 2021-08-06T08:41:49 | 2021-08-06T08:41:49 | 391,809,752 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package br.com.springboot.api_rest_w_front;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.ui.Model;
/**
*
* Spring Boot application starter class
*/
@EntityScan(basePackages= {"br.com.springboot.api_rest_w_front.model"})
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
| [
"cairo.aco@hotmail.com"
] | cairo.aco@hotmail.com |
87ffaeb756ec586056e131f482f61bf7bdb790c8 | f4ffc3e34e47f62d2c0fe5832d54d641c9de82bc | /app/src/androidTest/java/com/example/android/animatedrecycler/ExampleInstrumentedTest.java | 1b81e6a29eb905f2300c816e90028d5fd4abd8ce | [] | no_license | chunmun/animated-recycler-test | 7d4ef1c77c16a752022279caf43ecb5c91915a55 | 96e127d0469740cd1877e98166d2ce5765277185 | refs/heads/master | 2020-04-17T18:54:53.385164 | 2019-01-27T15:31:44 | 2019-01-27T15:31:44 | 166,846,369 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.example.android.animatedrecycler;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.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.android.animatedrecycler", appContext.getPackageName());
}
}
| [
"xilasirc@gmail.com"
] | xilasirc@gmail.com |
bded6e563ebe580d59d9f5ac3a712cb0472c918b | 72130ff045bebee3131fe5e7ba70b077d2a65925 | /odalic/src/main/java/cz/cuni/mff/xrg/odalic/api/rest/values/AmbiguityValue.java | 260d22a748e17150d82b383c3f27a936e09d6665 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | odalic/sti | f29dbcd5e0d8633f108146e04d1d8e312d0fe169 | 580785a88ea9789d87f003eecf818bed93cf4bf4 | refs/heads/master | 2020-12-26T02:12:06.839462 | 2017-06-01T22:54:39 | 2017-06-01T22:54:39 | 54,390,133 | 4 | 0 | Apache-2.0 | 2018-03-07T00:23:16 | 2016-03-21T13:15:09 | Web Ontology Language | UTF-8 | Java | false | false | 1,249 | java | package cz.cuni.mff.xrg.odalic.api.rest.values;
import java.io.Serializable;
import javax.annotation.Nullable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Preconditions;
import cz.cuni.mff.xrg.odalic.feedbacks.Ambiguity;
import cz.cuni.mff.xrg.odalic.positions.CellPosition;
/**
* Domain class {@link Ambiguity} adapted for REST API.
*
* @author Václav Brodec
*
*/
@XmlRootElement(name = "ambiguity")
public final class AmbiguityValue implements Serializable {
private static final long serialVersionUID = -9087389821835847372L;
private CellPosition position;
public AmbiguityValue() {}
public AmbiguityValue(final Ambiguity adaptee) {
this.position = adaptee.getPosition();
}
/**
* @return the position
*/
@XmlElement
@Nullable
public CellPosition getPosition() {
return this.position;
}
/**
* @param position the position to set
*/
public void setPosition(final CellPosition position) {
Preconditions.checkNotNull(position, "The position cannot be null!");
this.position = position;
}
@Override
public String toString() {
return "AmbiguityValue [position=" + this.position + "]";
}
}
| [
"brodecva@gmail.com"
] | brodecva@gmail.com |
964a46b4cdbab3e5f46a562d38b847ea8f4af6a3 | f1f8537f0fe627c435b2614e8ab930a6d04414d7 | /src/test/java/tn/aes/convid/web/rest/AccountResourceIT.java | 87847d15a0ff51eaefcb61af93b2c29ce62f8f84 | [] | no_license | aissaouik/aes-convis-19 | 56e19df8ff838415702d9a4ad204f6d5ad82d90f | 117c8b3181b907b8caadec8e5bfb1b85dd4309b4 | refs/heads/master | 2022-12-11T21:49:41.232444 | 2020-09-16T13:59:13 | 2020-09-16T13:59:13 | 296,004,211 | 0 | 0 | null | 2020-09-16T13:59:14 | 2020-09-16T10:49:50 | Java | UTF-8 | Java | false | false | 33,100 | java | package tn.aes.convid.web.rest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
import static tn.aes.convid.web.rest.AccountResourceIT.TEST_USER_LOGIN;
import java.time.Instant;
import java.util.*;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.test.context.support.WithMockUser;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.transaction.annotation.Transactional;
import tn.aes.convid.ConvidApp;
import tn.aes.convid.config.Constants;
import tn.aes.convid.domain.User;
import tn.aes.convid.repository.AuthorityRepository;
import tn.aes.convid.repository.UserRepository;
import tn.aes.convid.security.AuthoritiesConstants;
import tn.aes.convid.service.UserService;
import tn.aes.convid.service.dto.PasswordChangeDTO;
import tn.aes.convid.service.dto.UserDTO;
import tn.aes.convid.web.rest.vm.KeyAndPasswordVM;
import tn.aes.convid.web.rest.vm.ManagedUserVM;
/**
* Integration tests for the {@link AccountResource} REST controller.
*/
@AutoConfigureMockMvc
@WithMockUser(value = TEST_USER_LOGIN)
@SpringBootTest(classes = ConvidApp.class)
public class AccountResourceIT {
static final String TEST_USER_LOGIN = "test";
@Autowired
private UserRepository userRepository;
@Autowired
private AuthorityRepository authorityRepository;
@Autowired
private UserService userService;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private MockMvc restAccountMockMvc;
@Test
@WithUnauthenticatedMockUser
public void testNonAuthenticatedUser() throws Exception {
restAccountMockMvc
.perform(get("/api/authenticate").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(""));
}
@Test
public void testAuthenticatedUser() throws Exception {
restAccountMockMvc
.perform(
get("/api/authenticate")
.with(
request -> {
request.setRemoteUser(TEST_USER_LOGIN);
return request;
}
)
.accept(MediaType.APPLICATION_JSON)
)
.andExpect(status().isOk())
.andExpect(content().string(TEST_USER_LOGIN));
}
@Test
public void testGetExistingAccount() throws Exception {
Set<String> authorities = new HashSet<>();
authorities.add(AuthoritiesConstants.ADMIN);
UserDTO user = new UserDTO();
user.setLogin(TEST_USER_LOGIN);
user.setFirstName("john");
user.setLastName("doe");
user.setEmail("john.doe@jhipster.com");
user.setImageUrl("http://placehold.it/50x50");
user.setLangKey("en");
user.setAuthorities(authorities);
userService.createUser(user);
restAccountMockMvc
.perform(get("/api/account").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
.andExpect(jsonPath("$.login").value(TEST_USER_LOGIN))
.andExpect(jsonPath("$.firstName").value("john"))
.andExpect(jsonPath("$.lastName").value("doe"))
.andExpect(jsonPath("$.email").value("john.doe@jhipster.com"))
.andExpect(jsonPath("$.imageUrl").value("http://placehold.it/50x50"))
.andExpect(jsonPath("$.langKey").value("en"))
.andExpect(jsonPath("$.authorities").value(AuthoritiesConstants.ADMIN));
}
@Test
public void testGetUnknownAccount() throws Exception {
restAccountMockMvc
.perform(get("/api/account").accept(MediaType.APPLICATION_PROBLEM_JSON))
.andExpect(status().isInternalServerError());
}
@Test
@Transactional
public void testRegisterValid() throws Exception {
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("test-register-valid");
validUser.setPassword("password");
validUser.setFirstName("Alice");
validUser.setLastName("Test");
validUser.setEmail("test-register-valid@example.com");
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
assertThat(userRepository.findOneByLogin("test-register-valid").isPresent()).isFalse();
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
assertThat(userRepository.findOneByLogin("test-register-valid").isPresent()).isTrue();
}
@Test
@Transactional
public void testRegisterInvalidLogin() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("funky-log(n"); // <-- invalid
invalidUser.setPassword("password");
invalidUser.setFirstName("Funky");
invalidUser.setLastName("One");
invalidUser.setEmail("funky@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByEmailIgnoreCase("funky@example.com");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterInvalidEmail() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword("password");
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("invalid"); // <-- invalid
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterInvalidPassword() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword("123"); // password with only 3 digits
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("bob@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterNullPassword() throws Exception {
ManagedUserVM invalidUser = new ManagedUserVM();
invalidUser.setLogin("bob");
invalidUser.setPassword(null); // invalid null password
invalidUser.setFirstName("Bob");
invalidUser.setLastName("Green");
invalidUser.setEmail("bob@example.com");
invalidUser.setActivated(true);
invalidUser.setImageUrl("http://placehold.it/50x50");
invalidUser.setLangKey(Constants.DEFAULT_LANGUAGE);
invalidUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(invalidUser)))
.andExpect(status().isBadRequest());
Optional<User> user = userRepository.findOneByLogin("bob");
assertThat(user.isPresent()).isFalse();
}
@Test
@Transactional
public void testRegisterDuplicateLogin() throws Exception {
// First registration
ManagedUserVM firstUser = new ManagedUserVM();
firstUser.setLogin("alice");
firstUser.setPassword("password");
firstUser.setFirstName("Alice");
firstUser.setLastName("Something");
firstUser.setEmail("alice@example.com");
firstUser.setImageUrl("http://placehold.it/50x50");
firstUser.setLangKey(Constants.DEFAULT_LANGUAGE);
firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Duplicate login, different email
ManagedUserVM secondUser = new ManagedUserVM();
secondUser.setLogin(firstUser.getLogin());
secondUser.setPassword(firstUser.getPassword());
secondUser.setFirstName(firstUser.getFirstName());
secondUser.setLastName(firstUser.getLastName());
secondUser.setEmail("alice2@example.com");
secondUser.setImageUrl(firstUser.getImageUrl());
secondUser.setLangKey(firstUser.getLangKey());
secondUser.setCreatedBy(firstUser.getCreatedBy());
secondUser.setCreatedDate(firstUser.getCreatedDate());
secondUser.setLastModifiedBy(firstUser.getLastModifiedBy());
secondUser.setLastModifiedDate(firstUser.getLastModifiedDate());
secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities()));
// First user
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(firstUser)))
.andExpect(status().isCreated());
// Second (non activated) user
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser)))
.andExpect(status().isCreated());
Optional<User> testUser = userRepository.findOneByEmailIgnoreCase("alice2@example.com");
assertThat(testUser.isPresent()).isTrue();
testUser.get().setActivated(true);
userRepository.save(testUser.get());
// Second (already activated) user
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser)))
.andExpect(status().is4xxClientError());
}
@Test
@Transactional
public void testRegisterDuplicateEmail() throws Exception {
// First user
ManagedUserVM firstUser = new ManagedUserVM();
firstUser.setLogin("test-register-duplicate-email");
firstUser.setPassword("password");
firstUser.setFirstName("Alice");
firstUser.setLastName("Test");
firstUser.setEmail("test-register-duplicate-email@example.com");
firstUser.setImageUrl("http://placehold.it/50x50");
firstUser.setLangKey(Constants.DEFAULT_LANGUAGE);
firstUser.setAuthorities(Collections.singleton(AuthoritiesConstants.USER));
// Register first user
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(firstUser)))
.andExpect(status().isCreated());
Optional<User> testUser1 = userRepository.findOneByLogin("test-register-duplicate-email");
assertThat(testUser1.isPresent()).isTrue();
// Duplicate email, different login
ManagedUserVM secondUser = new ManagedUserVM();
secondUser.setLogin("test-register-duplicate-email-2");
secondUser.setPassword(firstUser.getPassword());
secondUser.setFirstName(firstUser.getFirstName());
secondUser.setLastName(firstUser.getLastName());
secondUser.setEmail(firstUser.getEmail());
secondUser.setImageUrl(firstUser.getImageUrl());
secondUser.setLangKey(firstUser.getLangKey());
secondUser.setAuthorities(new HashSet<>(firstUser.getAuthorities()));
// Register second (non activated) user
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser)))
.andExpect(status().isCreated());
Optional<User> testUser2 = userRepository.findOneByLogin("test-register-duplicate-email");
assertThat(testUser2.isPresent()).isFalse();
Optional<User> testUser3 = userRepository.findOneByLogin("test-register-duplicate-email-2");
assertThat(testUser3.isPresent()).isTrue();
// Duplicate email - with uppercase email address
ManagedUserVM userWithUpperCaseEmail = new ManagedUserVM();
userWithUpperCaseEmail.setId(firstUser.getId());
userWithUpperCaseEmail.setLogin("test-register-duplicate-email-3");
userWithUpperCaseEmail.setPassword(firstUser.getPassword());
userWithUpperCaseEmail.setFirstName(firstUser.getFirstName());
userWithUpperCaseEmail.setLastName(firstUser.getLastName());
userWithUpperCaseEmail.setEmail("TEST-register-duplicate-email@example.com");
userWithUpperCaseEmail.setImageUrl(firstUser.getImageUrl());
userWithUpperCaseEmail.setLangKey(firstUser.getLangKey());
userWithUpperCaseEmail.setAuthorities(new HashSet<>(firstUser.getAuthorities()));
// Register third (not activated) user
restAccountMockMvc
.perform(
post("/api/register")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(userWithUpperCaseEmail))
)
.andExpect(status().isCreated());
Optional<User> testUser4 = userRepository.findOneByLogin("test-register-duplicate-email-3");
assertThat(testUser4.isPresent()).isTrue();
assertThat(testUser4.get().getEmail()).isEqualTo("test-register-duplicate-email@example.com");
testUser4.get().setActivated(true);
userService.updateUser((new UserDTO(testUser4.get())));
// Register 4th (already activated) user
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(secondUser)))
.andExpect(status().is4xxClientError());
}
@Test
@Transactional
public void testRegisterAdminIsIgnored() throws Exception {
ManagedUserVM validUser = new ManagedUserVM();
validUser.setLogin("badguy");
validUser.setPassword("password");
validUser.setFirstName("Bad");
validUser.setLastName("Guy");
validUser.setEmail("badguy@example.com");
validUser.setActivated(true);
validUser.setImageUrl("http://placehold.it/50x50");
validUser.setLangKey(Constants.DEFAULT_LANGUAGE);
validUser.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restAccountMockMvc
.perform(post("/api/register").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(validUser)))
.andExpect(status().isCreated());
Optional<User> userDup = userRepository.findOneWithAuthoritiesByLogin("badguy");
assertThat(userDup.isPresent()).isTrue();
assertThat(userDup.get().getAuthorities())
.hasSize(1)
.containsExactly(authorityRepository.findById(AuthoritiesConstants.USER).get());
}
@Test
@Transactional
public void testActivateAccount() throws Exception {
final String activationKey = "some activation key";
User user = new User();
user.setLogin("activate-account");
user.setEmail("activate-account@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(false);
user.setActivationKey(activationKey);
userRepository.saveAndFlush(user);
restAccountMockMvc.perform(get("/api/activate?key={activationKey}", activationKey)).andExpect(status().isOk());
user = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(user.getActivated()).isTrue();
}
@Test
@Transactional
public void testActivateAccountWithWrongKey() throws Exception {
restAccountMockMvc.perform(get("/api/activate?key=wrongActivationKey")).andExpect(status().isInternalServerError());
}
@Test
@Transactional
@WithMockUser("save-account")
public void testSaveAccount() throws Exception {
User user = new User();
user.setLogin("save-account");
user.setEmail("save-account@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-account@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restAccountMockMvc
.perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneWithAuthoritiesByLogin(user.getLogin()).orElse(null);
assertThat(updatedUser.getFirstName()).isEqualTo(userDTO.getFirstName());
assertThat(updatedUser.getLastName()).isEqualTo(userDTO.getLastName());
assertThat(updatedUser.getEmail()).isEqualTo(userDTO.getEmail());
assertThat(updatedUser.getLangKey()).isEqualTo(userDTO.getLangKey());
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
assertThat(updatedUser.getImageUrl()).isEqualTo(userDTO.getImageUrl());
assertThat(updatedUser.getActivated()).isEqualTo(true);
assertThat(updatedUser.getAuthorities()).isEmpty();
}
@Test
@Transactional
@WithMockUser("save-invalid-email")
public void testSaveInvalidEmail() throws Exception {
User user = new User();
user.setLogin("save-invalid-email");
user.setEmail("save-invalid-email@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("invalid email");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restAccountMockMvc
.perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isBadRequest());
assertThat(userRepository.findOneByEmailIgnoreCase("invalid email")).isNotPresent();
}
@Test
@Transactional
@WithMockUser("save-existing-email")
public void testSaveExistingEmail() throws Exception {
User user = new User();
user.setLogin("save-existing-email");
user.setEmail("save-existing-email@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
User anotherUser = new User();
anotherUser.setLogin("save-existing-email2");
anotherUser.setEmail("save-existing-email2@example.com");
anotherUser.setPassword(RandomStringUtils.random(60));
anotherUser.setActivated(true);
userRepository.saveAndFlush(anotherUser);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-existing-email2@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restAccountMockMvc
.perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("save-existing-email").orElse(null);
assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email@example.com");
}
@Test
@Transactional
@WithMockUser("save-existing-email-and-login")
public void testSaveExistingEmailAndLogin() throws Exception {
User user = new User();
user.setLogin("save-existing-email-and-login");
user.setEmail("save-existing-email-and-login@example.com");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
userRepository.saveAndFlush(user);
UserDTO userDTO = new UserDTO();
userDTO.setLogin("not-used");
userDTO.setFirstName("firstname");
userDTO.setLastName("lastname");
userDTO.setEmail("save-existing-email-and-login@example.com");
userDTO.setActivated(false);
userDTO.setImageUrl("http://placehold.it/50x50");
userDTO.setLangKey(Constants.DEFAULT_LANGUAGE);
userDTO.setAuthorities(Collections.singleton(AuthoritiesConstants.ADMIN));
restAccountMockMvc
.perform(post("/api/account").contentType(MediaType.APPLICATION_JSON).content(TestUtil.convertObjectToJsonBytes(userDTO)))
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin("save-existing-email-and-login").orElse(null);
assertThat(updatedUser.getEmail()).isEqualTo("save-existing-email-and-login@example.com");
}
@Test
@Transactional
@WithMockUser("change-password-wrong-existing-password")
public void testChangePasswordWrongExistingPassword() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password-wrong-existing-password");
user.setEmail("change-password-wrong-existing-password@example.com");
userRepository.saveAndFlush(user);
restAccountMockMvc
.perform(
post("/api/account/change-password")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO("1" + currentPassword, "new password")))
)
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-wrong-existing-password").orElse(null);
assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isFalse();
assertThat(passwordEncoder.matches(currentPassword, updatedUser.getPassword())).isTrue();
}
@Test
@Transactional
@WithMockUser("change-password")
public void testChangePassword() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password");
user.setEmail("change-password@example.com");
userRepository.saveAndFlush(user);
restAccountMockMvc
.perform(
post("/api/account/change-password")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "new password")))
)
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin("change-password").orElse(null);
assertThat(passwordEncoder.matches("new password", updatedUser.getPassword())).isTrue();
}
@Test
@Transactional
@WithMockUser("change-password-too-small")
public void testChangePasswordTooSmall() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password-too-small");
user.setEmail("change-password-too-small@example.com");
userRepository.saveAndFlush(user);
String newPassword = RandomStringUtils.random(ManagedUserVM.PASSWORD_MIN_LENGTH - 1);
restAccountMockMvc
.perform(
post("/api/account/change-password")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, newPassword)))
)
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-too-small").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@Transactional
@WithMockUser("change-password-too-long")
public void testChangePasswordTooLong() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password-too-long");
user.setEmail("change-password-too-long@example.com");
userRepository.saveAndFlush(user);
String newPassword = RandomStringUtils.random(ManagedUserVM.PASSWORD_MAX_LENGTH + 1);
restAccountMockMvc
.perform(
post("/api/account/change-password")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, newPassword)))
)
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-too-long").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@Transactional
@WithMockUser("change-password-empty")
public void testChangePasswordEmpty() throws Exception {
User user = new User();
String currentPassword = RandomStringUtils.random(60);
user.setPassword(passwordEncoder.encode(currentPassword));
user.setLogin("change-password-empty");
user.setEmail("change-password-empty@example.com");
userRepository.saveAndFlush(user);
restAccountMockMvc
.perform(
post("/api/account/change-password")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(new PasswordChangeDTO(currentPassword, "")))
)
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin("change-password-empty").orElse(null);
assertThat(updatedUser.getPassword()).isEqualTo(user.getPassword());
}
@Test
@Transactional
public void testRequestPasswordReset() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setLogin("password-reset");
user.setEmail("password-reset@example.com");
userRepository.saveAndFlush(user);
restAccountMockMvc
.perform(post("/api/account/reset-password/init").content("password-reset@example.com"))
.andExpect(status().isOk());
}
@Test
@Transactional
public void testRequestPasswordResetUpperCaseEmail() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setLogin("password-reset-upper-case");
user.setEmail("password-reset-upper-case@example.com");
userRepository.saveAndFlush(user);
restAccountMockMvc
.perform(post("/api/account/reset-password/init").content("password-reset-upper-case@EXAMPLE.COM"))
.andExpect(status().isOk());
}
@Test
public void testRequestPasswordResetWrongEmail() throws Exception {
restAccountMockMvc
.perform(post("/api/account/reset-password/init").content("password-reset-wrong-email@example.com"))
.andExpect(status().isOk());
}
@Test
@Transactional
public void testFinishPasswordReset() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("finish-password-reset");
user.setEmail("finish-password-reset@example.com");
user.setResetDate(Instant.now().plusSeconds(60));
user.setResetKey("reset key");
userRepository.saveAndFlush(user);
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey(user.getResetKey());
keyAndPassword.setNewPassword("new password");
restAccountMockMvc
.perform(
post("/api/account/reset-password/finish")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword))
)
.andExpect(status().isOk());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isTrue();
}
@Test
@Transactional
public void testFinishPasswordResetTooSmall() throws Exception {
User user = new User();
user.setPassword(RandomStringUtils.random(60));
user.setLogin("finish-password-reset-too-small");
user.setEmail("finish-password-reset-too-small@example.com");
user.setResetDate(Instant.now().plusSeconds(60));
user.setResetKey("reset key too small");
userRepository.saveAndFlush(user);
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey(user.getResetKey());
keyAndPassword.setNewPassword("foo");
restAccountMockMvc
.perform(
post("/api/account/reset-password/finish")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword))
)
.andExpect(status().isBadRequest());
User updatedUser = userRepository.findOneByLogin(user.getLogin()).orElse(null);
assertThat(passwordEncoder.matches(keyAndPassword.getNewPassword(), updatedUser.getPassword())).isFalse();
}
@Test
@Transactional
public void testFinishPasswordResetWrongKey() throws Exception {
KeyAndPasswordVM keyAndPassword = new KeyAndPasswordVM();
keyAndPassword.setKey("wrong reset key");
keyAndPassword.setNewPassword("new password");
restAccountMockMvc
.perform(
post("/api/account/reset-password/finish")
.contentType(MediaType.APPLICATION_JSON)
.content(TestUtil.convertObjectToJsonBytes(keyAndPassword))
)
.andExpect(status().isInternalServerError());
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
516579311fc606785568401d1c7db30606e04eba | 2cd5a50b9cb367297009d7b158a64bfbb3d193ab | /Kun/leetcode/208-Course-Schedule-II/208-Course-Schedule-II.java | 491ccf055782a98edec2801dcd904dcd070e0f53 | [] | no_license | Kun17/JobHunting2020 | 5eb12c5495b422d9c697b1dfb7c8041e609938ff | b738c21106b9b371148079ffef5b947e7117aad4 | refs/heads/main | 2023-03-23T12:07:33.448422 | 2021-03-18T22:50:45 | 2021-03-18T22:50:45 | 329,748,525 | 1 | 1 | null | 2021-03-18T22:50:46 | 2021-01-14T22:22:24 | Java | UTF-8 | Java | false | false | 2,227 | java | import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.HashSet;
import java.util.List;
class Solution {
class Node {
int indgree;
List<Integer> outNodes;
Node(){this.indgree = 0; this.outNodes = new ArrayList<>();}
}
Map<Integer, Node> Graph;
List<Integer> sortedGraph;
public int[] findOrder(int numCourses, int[][] prerequisites) {
// BFS is impossible
// Let's try Kahn's algorithm to bring about topologically sorted graph
this.Graph = new HashMap<>();
sortedGraph = topologicalSort_Kahn(prerequisites);
if(sortedGraph.isEmpty()) return new int[]{};
return new int[]{1,2};
}
// Kahn's algorithm
List<Integer> topologicalSort_Kahn(int[][] prerequisites){
for(int[] relation: prerequisites){
insert(relation[1], relation[0]);
}
List<Integer> L = new ArrayList<>();
Set<Integer> S = new HashSet<>();
for(Map.Entry<Integer, Node> entry: Graph.entrySet()){
if(entry.getValue().indgree == 0){
S.add(entry.getKey());
}
}
if(S.isEmpty()) return L;
for(Integer course: S){
L.add(course);
Node courseNode = Graph.get(course);
while(!courseNode.outNodes.isEmpty()){
Integer next = courseNode.outNodes.remove(0);
Node nextNode =Graph.get(next);
nextNode.indgree--;
if(nextNode.indgree == 0) S.add(next);
}
}
return L;
}
// u -> v
void insert(int u, int v){
Node uNode = Graph.getOrDefault(u, new Node());
Node vNode = Graph.getOrDefault(v, new Node());
uNode.outNodes.add(v);
vNode.indgree++;
Graph.put(u, uNode);
Graph.put(v, vNode);
}
public static void main(String[] Args){
Solution s = new Solution();
int[][] prerequisites = new int[][]{{1,0},{0,1}};
int[] res = s.findOrder(2, prerequisites);
for(int r: res){
System.out.println(r);
}
}
} | [
"edwardpeng91@gmail.com"
] | edwardpeng91@gmail.com |
a3f74d1f69aa0acd5e7be8ae89ac01db256806ab | b11fc100408d858794853729d0bbdfa54cbe923d | /android/V4.3.6_08.09/.svn/pristine/a3/a3f74d1f69aa0acd5e7be8ae89ac01db256806ab.svn-base | 9d755394bae2b4db51bb22631c96ba15f545ff00 | [] | no_license | dengjiaping/zland | 23b0e87ff00ad9dd5a977f58166072272b02f09d | d31183fce689a42cbf35f5b8a0780390f9d6d6c9 | refs/heads/master | 2021-08-11T01:56:08.742546 | 2017-11-13T03:43:39 | 2017-11-13T03:43:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,537 | package com.zhisland.lib.view.pulltorefresh.absview;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import android.widget.AbsListView;
import android.widget.AbsListView.OnScrollListener;
import com.handmark.pulltorefresh.library.PullToRefreshAdapterViewBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.zhisland.lib.component.adapter.BaseListAdapter;
import com.zhisland.lib.component.adapter.ZHPageData;
import com.zhisland.lib.util.MLog;
import com.zhisland.lib.view.pulltorefresh.PullEvent;
import com.zhisland.lib.view.pulltorefresh.PullToRefreshProxy;
public class PullToRefreshAbsListViewProxy<D, V extends AbsListView> extends
PullToRefreshProxy<V> {
protected BaseListAdapter<D> adapter;
private String maxId;
public boolean isLastPage = true;
private List<D> newCacheData = null;
public PullToRefreshAbsListViewProxy() {
super();
}
@SuppressWarnings("unchecked")
@Override
public void onCreate() {
if (pullCache != null) {
Object cacheData = pullCache.getCache();
if (cacheData instanceof ArrayList<?>) {
ArrayList<D> data = (ArrayList<D>) cacheData;
adapter.add(data);
}
}
adapter.setAbsView(pullView.getRefreshableView());
pullView.getRefreshableView().setAdapter(adapter);
super.onCreate();
}
@Override
public void onDestroy() {
super.onDestroy();
saveCacheData();
}
public void saveCacheData() {
if (newCacheData != null && newCacheData.size() > 0
&& pullCache != null) {
pullCache.cacheData((Serializable) newCacheData);
}
}
public void onLoadFailed(Throwable failture) {
if(maxId == null){
isLastPage = true;
}
if (isLastPage) {
this.pullView.setMode(Mode.PULL_FROM_START);
} else {
this.pullView.setMode(Mode.BOTH);
}
this.adapter.notifyDataSetChanged();
this.onRefreshFinished();
}
/**
* 由于没有分页信息,会先清楚所有的数据,再将list中的数据增加到adapter中
*/
public void onLoadSucessfully(List<D> data) {
switch (currentEvent) {
case normal:
this.adapter.clearItems();
newCacheData = data;
break;
default:
break;
}
if (data != null) {
this.adapter.add(data);
}
this.onRefreshFinished();
}
/**
* 根据当前的刷新状态,如果是获取更多,直接将数据append,否则将清掉所有数据后,再将数据加入adapter
*/
public void onLoadSucessfully(ZHPageData<D> dataList) {
if (dataList != null) {
this.onLoadSucessfully(dataList, dataList.data);
} else {
this.onLoadSucessfully(dataList, null);
}
}
/**
* 具体的将数据插入到adapter
*
* @param dataList
* @param data
*/
protected void onLoadSucessfully(ZHPageData<D> dataList, ArrayList<D> data) {
if (dataList == null) {
isLastPage = false;
} else {
if (data == null || data.size() == 0) {
}
String curMaxId = dataList.nextId;
PullEvent currentEvent = this.getCurrentEvent();
switch (currentEvent) {
case normal:
case none:
this.maxId = curMaxId;
this.adapter.clearItems(); // clear cached datas
this.adapter.add(data);
isLastPage = dataList.page_is_last;
newCacheData = data;
break;
case more:
this.maxId = curMaxId;
this.adapter.add(data);
isLastPage = dataList.page_is_last;
break;
default:
break;
}
}
this.onRefreshFinished();
if (isLastPage) {
this.pullView.setMode(Mode.PULL_FROM_START);
} else {
this.pullView.setMode(Mode.BOTH);
}
}
/**
* 获取当前abslistview的adapter
*
* @return
*/
public BaseListAdapter<D> getAdapter() {
return adapter;
}
/**
* 重载上拉刷新的逻辑
*/
@Override
public void onPullUpToRefresh(PullToRefreshBase<V> refreshView) {
if (this.isRefreshing() == false) {
this.currentEvent = PullEvent.more;
pullListener.loadMore(maxId);
}
}
/**
* 设置adater
*
* @param adapter
*/
public void setAdapter(BaseListAdapter<D> adapter) {
this.adapter = adapter;
}
@Override
public void setPullView(PullToRefreshBase<? extends V> view) {
super.setPullView(view);
PullToRefreshAdapterViewBase<? extends V> absView = (PullToRefreshAdapterViewBase<? extends V>) view;
absView.setOnScrollListener(new OnScrollListener() {
int scrollState;
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
this.scrollState = scrollState;
}
@Override
public void onScroll(AbsListView view, int firstVisibleItem,
int visibleItemCount, int totalItemCount) {
// 如果滚动的位置已经超过倒数第二条,并且不是最后一页,以及没有正在刷新,则自动加载后面更多
if (isLastPage || scrollState == 0)
return;
if (isRefreshing())
return;
MLog.d("zhscroll", firstVisibleItem + " " + visibleItemCount
+ " " + totalItemCount);
if (totalItemCount - (firstVisibleItem + visibleItemCount) < 2) {
MLog.d("zhscroll", "自动下拉刷新");
currentEvent = PullEvent.more;
pullListener.loadMore(maxId);
}
}
});
}
@Override
public PullToRefreshAdapterViewBase<? extends V> getPullView() {
return (PullToRefreshAdapterViewBase<? extends V>) super.getPullView();
}
}
| [
"lipengju@yixia.com"
] | lipengju@yixia.com | |
8c4ab220a40424ab51e0807d8a51c4aa42250b02 | d3a1af16ea21edb51618b36e86cb3b3c29f560b7 | /servletWork01/src/javasm/constant/PageConstant.java | 6a903fc6c6fa18b34ca111269ac390d7df405145 | [] | no_license | jiang542/jiang | f2ada8d780ef2a7e81d98d89529d169f59822c96 | eb59e263bbe1864bca1d23ccc89d74c1822a0459 | refs/heads/main | 2023-02-01T08:28:33.716357 | 2020-12-21T07:30:39 | 2020-12-21T07:30:39 | 309,278,930 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 94 | java | package javasm.constant;
public interface PageConstant {
Integer PAGENUM = 3;
}
| [
"noreply@github.com"
] | noreply@github.com |
2b0782511b3e5a9ce755986b43de389c29f549c3 | 650337c11f8c1a82fdefcbf68a8b5f4f8735dbf4 | /cgo_db/src/main/java/com/cgo/db/entity/RptOiladddetail.java | df05e5fee7429795b45c46ee40b147b56adb0cdc | [] | no_license | qq237784669/cgo | d0b96b79d54961b919b2ab63ee1606f8affcc01e | 4bb226b17f56886fac0c69d3ff892e724bc2d5e5 | refs/heads/master | 2022-07-02T04:39:45.701421 | 2019-12-17T08:07:51 | 2019-12-17T08:07:51 | 223,833,681 | 0 | 0 | null | 2021-04-26T19:43:38 | 2019-11-25T00:53:15 | Java | UTF-8 | Java | false | false | 1,600 | java | package com.cgo.db.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author Mht
* @since 2019-11-18
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("rpt_OilAddDetail")
public class RptOiladddetail extends Model<RptOiladddetail> {
private static final long serialVersionUID=1L;
@TableField("GpsDate")
private LocalDateTime GpsDate;
@TableId(value = "Id", type = IdType.AUTO)
private Long Id;
@TableField("Mileage2")
private Double Mileage2;
@TableField("Speed1")
private Double Speed1;
@TableField("OilStatic")
private Double OilStatic;
@TableField("SimNum")
private String SimNum;
@TableField("GpsTime1")
private LocalDateTime GpsTime1;
@TableField("OilValue1")
private Double OilValue1;
@TableField("Speed2")
private Double Speed2;
@TableField("GpsTime2")
private LocalDateTime GpsTime2;
@TableField("OilValue2")
private Double OilValue2;
@TableField("DeviceId")
private Integer DeviceId;
@TableField("Mileage1")
private Double Mileage1;
@Override
protected Serializable pkVal() {
return this.Id;
}
}
| [
"asd@1.com"
] | asd@1.com |
d950b129215df90cd91cece8cb3adbb48f194840 | e3b359be38073437b3a91fd0b18149ef65092bfb | /testProject/src/testProject/testGame.java | ed2612e72012fe5b044ce18e7beb46788d16b23e | [] | no_license | rmelis/GIP | d5ac13dc81379cfd7ba8b39c1633e22fed83bca4 | ac4028985c55e6181e4512c4c1644a788362dca7 | refs/heads/master | 2021-05-26T19:20:50.136434 | 2020-04-22T11:44:34 | 2020-04-22T11:44:34 | 254,155,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 551 | java | package testProject;
import java.awt.EventQueue;
import javax.swing.JFrame;
public class testGame extends JFrame {
public testGame() {
startGame();
}
private void startGame() {
add(new testBoard());
setTitle("testGame");
setSize(1000, 1000);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setResizable(false);
setLocationRelativeTo(null);
}
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
testGame testgame = new testGame();
testgame.setVisible(true);
});
}
} | [
"noreply@github.com"
] | noreply@github.com |
6fac462f5c60bc7a7bfbfb0d17d4244f3ef367d1 | daae183b831e5c0afdb9da8978bae4ef2c01ed81 | /multithread/src/test/java/chapter2/t2/synchronizedMethodLockObject2/MyObjectTest.java | 5795aa581e36f14c41405fcb7198fb75a081cb7e | [] | no_license | apple006/FaithAkaJava | 95c5f1c600a48e4a46f08c53462054243fe0b715 | 1df80dfed44492d2ad315d062980acf8e9ac91fe | refs/heads/master | 2021-03-30T22:08:11.319054 | 2017-12-08T03:40:11 | 2017-12-08T03:40:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 435 | java | package chapter2.t2.synchronizedMethodLockObject2;
import static org.junit.Assert.*;
/**
* @author nickChen
* @create 2017-04-20 11:32.
*/
public class MyObjectTest {
public static void main(String[] args) {
MyObject object = new MyObject();
ThreadA a = new ThreadA(object);
a.setName("A");
ThreadB b = new ThreadB(object);
b.setName("B");
a.start();
b.start();
}
} | [
"nickChenyx@gmail.com"
] | nickChenyx@gmail.com |
6c17b13ac9250eabdb24c8f00a3b90f6cfddddb6 | 1f5c8a9af07d53574221060544c31b1668fd236a | /src/main/java/com/bigdata/thrift/PersonID.java | 45ad17c53dea2fda57f4660cc36de96be57c4dbb | [] | no_license | riotgibbon/BigDataBookWorking | 816c2856fad2a26c694913df399494f4dae28ffa | 01cb7195e47c24a9984a2d2bfc84c7583924b296 | refs/heads/master | 2016-09-05T23:52:40.219474 | 2014-02-14T13:07:34 | 2014-02-14T13:07:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | true | 11,207 | java | /**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.bigdata.thrift;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PersonID extends org.apache.thrift.TUnion<PersonID, PersonID._Fields> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("PersonID");
private static final org.apache.thrift.protocol.TField COOKIE_FIELD_DESC = new org.apache.thrift.protocol.TField("cookie", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("user_id", org.apache.thrift.protocol.TType.I64, (short)2);
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
COOKIE((short)1, "cookie"),
USER_ID((short)2, "user_id");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // COOKIE
return COOKIE;
case 2: // USER_ID
return USER_ID;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.COOKIE, new org.apache.thrift.meta_data.FieldMetaData("cookie", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("user_id", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(PersonID.class, metaDataMap);
}
public PersonID() {
super();
}
public PersonID(_Fields setField, Object value) {
super(setField, value);
}
public PersonID(PersonID other) {
super(other);
}
public PersonID deepCopy() {
return new PersonID(this);
}
public static PersonID cookie(String value) {
PersonID x = new PersonID();
x.setCookie(value);
return x;
}
public static PersonID user_id(long value) {
PersonID x = new PersonID();
x.setUser_id(value);
return x;
}
@Override
protected void checkType(_Fields setField, Object value) throws ClassCastException {
switch (setField) {
case COOKIE:
if (value instanceof String) {
break;
}
throw new ClassCastException("Was expecting value of type String for field 'cookie', but got " + value.getClass().getSimpleName());
case USER_ID:
if (value instanceof Long) {
break;
}
throw new ClassCastException("Was expecting value of type Long for field 'user_id', but got " + value.getClass().getSimpleName());
default:
throw new IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected Object standardSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, org.apache.thrift.protocol.TField field) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(field.id);
if (setField != null) {
switch (setField) {
case COOKIE:
if (field.type == COOKIE_FIELD_DESC.type) {
String cookie;
cookie = iprot.readString();
return cookie;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
case USER_ID:
if (field.type == USER_ID_FIELD_DESC.type) {
Long user_id;
user_id = iprot.readI64();
return user_id;
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
default:
throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
return null;
}
}
@Override
protected void standardSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case COOKIE:
String cookie = (String)value_;
oprot.writeString(cookie);
return;
case USER_ID:
Long user_id = (Long)value_;
oprot.writeI64(user_id);
return;
default:
throw new IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected Object tupleSchemeReadValue(org.apache.thrift.protocol.TProtocol iprot, short fieldID) throws org.apache.thrift.TException {
_Fields setField = _Fields.findByThriftId(fieldID);
if (setField != null) {
switch (setField) {
case COOKIE:
String cookie;
cookie = iprot.readString();
return cookie;
case USER_ID:
Long user_id;
user_id = iprot.readI64();
return user_id;
default:
throw new IllegalStateException("setField wasn't null, but didn't match any of the case statements!");
}
} else {
throw new TProtocolException("Couldn't find a field with field id " + fieldID);
}
}
@Override
protected void tupleSchemeWriteValue(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
switch (setField_) {
case COOKIE:
String cookie = (String)value_;
oprot.writeString(cookie);
return;
case USER_ID:
Long user_id = (Long)value_;
oprot.writeI64(user_id);
return;
default:
throw new IllegalStateException("Cannot write union with unknown field " + setField_);
}
}
@Override
protected org.apache.thrift.protocol.TField getFieldDesc(_Fields setField) {
switch (setField) {
case COOKIE:
return COOKIE_FIELD_DESC;
case USER_ID:
return USER_ID_FIELD_DESC;
default:
throw new IllegalArgumentException("Unknown field id " + setField);
}
}
@Override
protected org.apache.thrift.protocol.TStruct getStructDesc() {
return STRUCT_DESC;
}
@Override
protected _Fields enumForId(short id) {
return _Fields.findByThriftIdOrThrow(id);
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public String getCookie() {
if (getSetField() == _Fields.COOKIE) {
return (String)getFieldValue();
} else {
throw new RuntimeException("Cannot get field 'cookie' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setCookie(String value) {
if (value == null) throw new NullPointerException();
setField_ = _Fields.COOKIE;
value_ = value;
}
public long getUser_id() {
if (getSetField() == _Fields.USER_ID) {
return (Long)getFieldValue();
} else {
throw new RuntimeException("Cannot get field 'user_id' because union is currently set to " + getFieldDesc(getSetField()).name);
}
}
public void setUser_id(long value) {
setField_ = _Fields.USER_ID;
value_ = value;
}
public boolean isSetCookie() {
return setField_ == _Fields.COOKIE;
}
public boolean isSetUser_id() {
return setField_ == _Fields.USER_ID;
}
public boolean equals(Object other) {
if (other instanceof PersonID) {
return equals((PersonID)other);
} else {
return false;
}
}
public boolean equals(PersonID other) {
return other != null && getSetField() == other.getSetField() && getFieldValue().equals(other.getFieldValue());
}
@Override
public int compareTo(PersonID other) {
int lastComparison = org.apache.thrift.TBaseHelper.compareTo(getSetField(), other.getSetField());
if (lastComparison == 0) {
return org.apache.thrift.TBaseHelper.compareTo(getFieldValue(), other.getFieldValue());
}
return lastComparison;
}
/**
* If you'd like this to perform more respectably, use the hashcode generator option.
*/
@Override
public int hashCode() {
return 0;
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
}
| [
"toby.evans@hibu.com"
] | toby.evans@hibu.com |
745d52aef7b8cdbd1352679377ab88ba1ae3f4f8 | 289d9bfb5a1266bd9816425911ebe7e52e92bb46 | /Roman_To_Integer.java | feaeaa4f952503d150ddf439749b3e9abee69408 | [] | no_license | suryateja008/-Algorithm-Solutions-LeetCode-Soultions | 2c96619f23656088e742ab420d80f63d69f4846f | ffa226427e038fa70b1f03f3eae1f521ad145eed | refs/heads/master | 2020-05-02T14:19:24.546638 | 2015-06-08T02:46:55 | 2015-06-08T02:46:55 | 32,287,853 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 732 | java | public class Solution {
public int romanToInt(String s) {
if(s.length()==0)
return 0;
int res=0;
for(int i=0;i<s.length();i++)
{
if(i>=1 && Rr(s.charAt(i))>Rr(s.charAt(i-1)))
{
res+=Rr(s.charAt(i))-2*Rr(s.charAt(i-1));
}
else
{
res+=Rr(s.charAt(i));
}
}
return res;
}
public static int Rr(char c)
{
switch(c)
{
case 'I': return 1;
case 'V': return 5;
case 'X': return 10;
case 'L': return 50;
case 'C': return 100;
case 'D': return 500;
case 'M': return 1000;
default: return 0;
}
}
}
| [
"suryateja008@gmail.com"
] | suryateja008@gmail.com |
6cab7fb956bb5388d2bb67e41e63af2609a91908 | e15c6801356314ebf3b001c40e33a51862814bf2 | /CloudComputing/IoT_Project/AppointmentScheduler/gen/iot/cloud/computing/BuildConfig.java | 2e2fc444a4ca8dfdad800a1b5dd6b17e7316fb9d | [] | no_license | arunrajappan/CourseWork | 41f429fa5edef1d0155cde619fb73d01b81f2c52 | bf660377a1b0f02ceaf4ea42b44d1a097bbcdc4c | refs/heads/master | 2021-01-10T13:58:02.245783 | 2016-01-05T21:12:56 | 2016-01-05T21:12:56 | 42,985,786 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 161 | java | /** Automatically generated file. DO NOT MODIFY */
package iot.cloud.computing;
public final class BuildConfig {
public final static boolean DEBUG = true;
} | [
"arunkumar.rajappan1@gmail.com"
] | arunkumar.rajappan1@gmail.com |
19efab2a878045e90c40b1704f7c687ccc56f506 | 8362ac64c38a1ec1b4a9d6a8998e6fd329a37328 | /backend/src/main/java/com/sample/vendas/controllers/SaleController.java | 4e2e53ba78c3dba8340f65fed87ca5b6e2080d1b | [] | no_license | willtet/projeto-sds3 | 0e86e4b75227d15b6de086489646b72489f4d226 | 24548b5b90a442eebcff56360974abf4c9f298a7 | refs/heads/master | 2023-05-12T12:14:02.680063 | 2021-05-09T23:30:46 | 2021-05-09T23:30:46 | 364,050,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | package com.sample.vendas.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.sample.vendas.dto.SaleDTO;
import com.sample.vendas.dto.SaleSuccessDTO;
import com.sample.vendas.dto.SaleSumDTO;
import com.sample.vendas.services.SaleService;
@RestController
@RequestMapping(value="/sales")
public class SaleController {
@Autowired
private SaleService service;
@GetMapping
public ResponseEntity<Page<SaleDTO>> findAll(Pageable pageable){
Page<SaleDTO> page= service.findAll(pageable);
return ResponseEntity.ok(page);
}
@GetMapping(value="/sum-by-seller")
public ResponseEntity<List<SaleSumDTO>> amountGrupedBySeller(){
List<SaleSumDTO> list= service.amountGrupedBySeller();
return ResponseEntity.ok(list);
}
@GetMapping(value="/success-by-seller")
public ResponseEntity<List<SaleSuccessDTO>> sucessGrupedBySeller(){
List<SaleSuccessDTO> list= service.sucessGrupedBySeller();
return ResponseEntity.ok(list);
}
}
| [
"willian0404@hotmail.co.jp"
] | willian0404@hotmail.co.jp |
e442aa1b3d2b1665c18b5c910d58d95c462e7216 | 92f75f65766402204ecbeaac6cece2a75bbf7c0d | /src/main/java/com/demotivirus/Day_115/Where.java | ca2d8750665675be7b7e309a883a6d5a9e34de17 | [] | no_license | demotivirus/365_Days_Challenge | 338139efe4f677ebb78abac4e4c674639ad78ab8 | cfc25eb921dd59f9581a39bf00fb0fc15809e4bb | refs/heads/master | 2023-07-21T19:04:26.927157 | 2021-09-07T20:25:29 | 2021-09-07T20:25:29 | 336,847,354 | 1 | 0 | null | 2021-09-07T20:20:42 | 2021-02-07T17:32:36 | Java | UTF-8 | Java | false | false | 404 | java | package com.demotivirus.Day_115;
import lombok.AllArgsConstructor;
import java.io.StringReader;
import java.util.List;
import java.util.function.Predicate;
@AllArgsConstructor
public class Where implements Expression {
private Predicate<String> filter;
@Override
public List<String> interpret(Context context) {
context.setFilter(filter);
return context.search();
}
}
| [
"demotivirus@gmail.com"
] | demotivirus@gmail.com |
8835bfb052cc5b6d3e4d0af8ae4bc688bf1ad5bf | d16c1721e057107594dea56b94833283bc91b9a5 | /videolistlibrary/src/main/java/me/zuichu/videolistlibrary/manager/player_messages/PlayerMessage.java | 16e2eb109e00cf1f01c65672837025fb883c1453 | [] | no_license | jaychou2012/VideoListManager | 0da7269b69e12f4ffb88664afc0597dc0ae06f67 | f35b2c62c5f96b859cebd1f5344949395d717f0c | refs/heads/master | 2021-09-23T07:35:07.519714 | 2021-09-23T01:38:16 | 2021-09-23T01:38:16 | 93,306,633 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,660 | java | package me.zuichu.videolistlibrary.manager.player_messages;
import me.zuichu.videolistlibrary.manager.Config;
import me.zuichu.videolistlibrary.manager.PlayerMessageState;
import me.zuichu.videolistlibrary.manager.manager.VideoPlayerManagerCallback;
import me.zuichu.videolistlibrary.manager.utils.Logger;
/**
* This is generic interface for PlayerMessage
*/
public abstract class PlayerMessage implements Message {
private static final String TAG = PlayerMessage.class.getSimpleName();
private static final boolean SHOW_LOGS = Config.SHOW_LOGS;
// private final VshowVideoPlayerView mCurrentPlayer;
private final VideoPlayerManagerCallback mCallback;
public PlayerMessage( VideoPlayerManagerCallback callback) {
// mCurrentPlayer = currentPlayer;
mCallback = callback;
}
protected final PlayerMessageState getCurrentState(){
return mCallback.getCurrentPlayerState();
}
@Override
public final void polledFromQueue() {
mCallback.setVideoPlayerState(stateBefore());
}
@Override
public final void messageFinished() {
mCallback.setVideoPlayerState(stateAfter());
}
public final void runMessage(){
if(SHOW_LOGS) Logger.v(TAG, ">> runMessage, " + getClass().getSimpleName());
performAction();
if(SHOW_LOGS) Logger.v(TAG, "<< runMessage, " + getClass().getSimpleName());
}
@Override
public String toString() {
return getClass().getSimpleName();
}
protected abstract void performAction();
protected abstract PlayerMessageState stateBefore();
protected abstract PlayerMessageState stateAfter();
}
| [
"zuichutech@126.com"
] | zuichutech@126.com |
839f29c38f97eefb0cbff2ea3823ccb127ecfcf9 | 62d04178579bbd0122d4cd3f1322b2f77d0d1609 | /TwoActivities/app/src/test/java/com/example/twoactivities/ExampleUnitTest.java | 4835d19352a6c1b4505de72e6ae1ef9e227c79be | [] | no_license | battlerhythm/Android-Java-Tutorials | 6925a2fccbfc0b536d28e8b793c56ba5c68e91b1 | 3a0657f0f9dcdc4c543dd2fc693668eeb17963dd | refs/heads/master | 2023-08-22T04:12:26.429841 | 2021-10-03T18:35:59 | 2021-10-03T18:35:59 | 401,166,716 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 377 | java | package com.example.twoactivities;
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);
}
} | [
"16344965+battlerhythm@users.noreply.github.com"
] | 16344965+battlerhythm@users.noreply.github.com |
632a7a6ea9b69467f0918a9d544f8f4c2e771e98 | 8d528d21d689df99e31a94db29c6ca7ce217a49f | /src/test/java/edu/northeastern/cs5200/Cs5200Spring2018MaApplicationTests.java | 66ff46849051124d580d53502093de67e22b5934 | [] | no_license | tesla2349/cs5200-spring2018-ma | 0838dd0f849641736e29d4d548f09a795dd16478 | 54f6f60ba963d3e19230320bc73d057c9b228d08 | refs/heads/master | 2021-09-06T09:16:20.573544 | 2018-02-04T22:25:13 | 2018-02-04T22:25:13 | 117,608,883 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 352 | java | package edu.northeastern.cs5200;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class Cs5200Spring2018MaApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"huiwang@HuimatoMacBook-Pro.local"
] | huiwang@HuimatoMacBook-Pro.local |
1e410d83d6041b0e633c9fe1a08d31239e012741 | 534577e45675dc2c7dcd5a1edd2af2bf7c79d47a | /http-training/src/com/vteamsystem/training/HelloServlet.java | 8506eb7552196a0bd929c55ebebe634f53b3dc3f | [] | no_license | yuanhs/http-training | 46f3f1281f2fd61dd9663f1cf89ca4a1dabfa53e | c40a786fdb71b8dd83b5279294ffaa2ceaa25ae5 | refs/heads/master | 2020-08-11T13:52:30.862075 | 2019-10-12T09:02:14 | 2019-10-12T09:02:14 | 214,575,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,469 | java | package com.vteamsystem.training;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* HelloServlet 只提供 GET 方法.
* @author harrison.yuan
*
*/
public class HelloServlet extends HttpServlet {
private static final long serialVersionUID = -1741316713458491781L;
/**
* Default constructor.
*/
public HelloServlet() {
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
ServletOutputStream sos = null;
try {
sos = response.getOutputStream();
System.out.println(request.getServletContext().getMajorVersion() + " " + request.getServletContext().getMinorVersion());
sos.write("hello, world.".getBytes("UTF-8"));
} finally {
try {
if (null != sos ) {
sos.close();
}
} catch (Throwable t) {
t.printStackTrace();
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
// protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// doGet(request, response);
// }
}
| [
"yuanhs@126.com"
] | yuanhs@126.com |
678c43ba352df7da868ffffb0fbf995aadc7e787 | cf2f5ba3a893a0c20d0435279221f6ead97a620d | /app/src/main/java/com/example/blackjackgame/ui/adapter/AvatarChangeAdapter.java | fd1f3f5e58d2f4c5c331241cd6917ad92894929a | [] | no_license | AndroidChill/BlackJackGame | ff34cd683cb4ff2899d24cca13613eaba2d68afe | 0f79cdf23e6ce4c43662e43906589bf01417aee1 | refs/heads/master | 2023-02-10T23:35:27.604892 | 2021-01-07T22:03:12 | 2021-01-07T22:03:12 | 291,438,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,534 | java | package com.example.blackjackgame.ui.adapter;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.databinding.DataBindingUtil;
import androidx.recyclerview.widget.RecyclerView;
import com.example.blackjackgame.R;
import com.example.blackjackgame.databinding.AvatarChangeItemBinding;
import com.example.blackjackgame.rModel.Avatar;
import com.example.blackjackgame.ui.interfaceClick.ChangeAvatarClick;
import com.example.blackjackgame.util.ConvertStringToImage;
import java.util.ArrayList;
import java.util.List;
public class AvatarChangeAdapter extends RecyclerView.Adapter<AvatarChangeAdapter.ViewHolder> {
private List<Avatar> avatars = new ArrayList<>();
private int positionSelect = 0;
private Context context;
private TextView textView;
private ChangeAvatarClick listener;
public AvatarChangeAdapter(Context context, TextView textView, ChangeAvatarClick listener) {
this.context = context;
this.textView = textView;
this.listener = listener;
}
public AvatarChangeAdapter(Context context, TextView textView){
this.context = context;
this.textView = textView;
}
public void setAvatars(List<Avatar> avatars) {
this.avatars = avatars;
notifyDataSetChanged();
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
AvatarChangeItemBinding binding = DataBindingUtil.inflate(inflater, R.layout.avatar_change_item, parent, false);
return new ViewHolder(binding);
}
@SuppressLint("UseCompatLoadingForDrawables")
@RequiresApi(api = Build.VERSION_CODES.M)
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
if(positionSelect != position){
holder.binding.layout3.setForeground(context.getDrawable(R.color.dark_back));
} else{
holder.binding.layout3.setForeground(context.getDrawable(R.color.white_back));
}
holder.binding.layout3.setOnClickListener(v -> {
if (!listener.onClick(avatars.get(position))){
Toast.makeText(context, "Недостаточно монет", Toast.LENGTH_SHORT).show();
} else {
positionSelect = position;
textView.setText(String.valueOf(avatars.get(position).getCoast()));
notifyDataSetChanged();
}
});
holder.bind(avatars.get(position));
}
@Override
public int getItemCount() {
return avatars.size();
}
class ViewHolder extends RecyclerView.ViewHolder{
private AvatarChangeItemBinding binding;
public ViewHolder(AvatarChangeItemBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
public void bind(Avatar avatar){
ConvertStringToImage.convert(binding.avatar3, avatar.getImage());
binding.coins.setText(String.valueOf(avatar.getCoast()));
}
}
}
| [
"69931259+AndroidChill@users.noreply.github.com"
] | 69931259+AndroidChill@users.noreply.github.com |
3a90aee5f24204f4bda2e5f4fd673183ff7e4c76 | edf309307b61568887de0b1bf12e21a0ce4d04d9 | /src/com/sun/corba/se/spi/activation/ServerHeldDownHolder.java | 0c81f559a8e2fd33fec16a029b5f9d06e69cd705 | [] | no_license | zhengruyi/JavaSourceCode | 5f7cb3283ff2132e4b6e7a06745179a0d1b97324 | 1204efa971349ace25ec31157e399aac9c3bae36 | refs/heads/master | 2023-03-26T05:32:55.542237 | 2021-03-20T22:51:29 | 2021-03-20T22:51:29 | 337,068,224 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,103 | java | package com.sun.corba.se.spi.activation;
/**
* com/sun/corba/se/spi/activation/ServerHeldDownHolder.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from /Users/java_re/workspace/8-2-build-macosx-x86_64/jdk8u192/11897/corba/src/share/classes/com/sun/corba/se/spi/activation/activation.idl
* Saturday, October 6, 2018 9:38:35 AM PDT
*/
public final class ServerHeldDownHolder implements org.omg.CORBA.portable.Streamable
{
public com.sun.corba.se.spi.activation.ServerHeldDown value = null;
public ServerHeldDownHolder ()
{
}
public ServerHeldDownHolder (com.sun.corba.se.spi.activation.ServerHeldDown initialValue)
{
value = initialValue;
}
public void _read (org.omg.CORBA.portable.InputStream i)
{
value = com.sun.corba.se.spi.activation.ServerHeldDownHelper.read (i);
}
public void _write (org.omg.CORBA.portable.OutputStream o)
{
com.sun.corba.se.spi.activation.ServerHeldDownHelper.write (o, value);
}
public org.omg.CORBA.TypeCode _type ()
{
return com.sun.corba.se.spi.activation.ServerHeldDownHelper.type ();
}
}
| [
"standonthpeak@gmail.com"
] | standonthpeak@gmail.com |
6cae0157e6241864227249e14b4952fb5b686b29 | 5a504a15a7b848712ce029628d68ae20949acd3a | /src/main/java/ru/itis/rabbitmq2/consumers/topic/RussianCitizenshipConsumer.java | 840fcc1f73b2aad329431a00d670e7ea1d61d3e9 | [] | no_license | ImpendingDoom28/rabbitmq2 | a8ec69dfb539c0838650de6adb473c909c3e4864 | e38da190c482d6c41a553efb7cc926504e0e382f | refs/heads/master | 2023-02-10T20:42:54.335308 | 2020-12-28T22:59:34 | 2020-12-28T22:59:34 | 325,134,839 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,974 | java | package ru.itis.rabbitmq2.consumers.topic;
import com.rabbitmq.client.CancelCallback;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;
import ru.itis.rabbitmq2.lib.ReferenceStrings;
import ru.itis.rabbitmq2.models.PassportData;
import javax.json.Json;
import javax.json.JsonObject;
import javax.json.JsonReader;
import java.io.IOException;
import java.io.StringReader;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.concurrent.TimeoutException;
public class RussianCitizenshipConsumer {
public RussianCitizenshipConsumer() {
start();
}
public void start() {
ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setHost("localhost");
try {
Connection connection = connectionFactory.newConnection();
Channel channel = connection.createChannel();
channel.basicQos(3);
String queueName = channel.queueDeclare().getQueue();
channel.queueBind(
queueName,
ReferenceStrings.TOPIC_EXCHANGE_NAME,
ReferenceStrings.RUSSIAN_CITIZENSHIP_ROUTING_KEY
);
channel.basicConsume(queueName, false, (consumerTag, message) -> {
String bodyString = new String(message.getBody());
JsonReader reader = Json.createReader(new StringReader(bodyString));
JsonObject jsonObject = reader.readObject();
JsonObject passportDataJson = jsonObject.getJsonObject("passportData");
PassportData passportData = null;
try {
passportData = PassportData.builder()
.name(passportDataJson.getString("name"))
.surname(passportDataJson.getString("surname"))
.age(passportDataJson.getInt("age"))
.passportId(passportDataJson.getString("passportId"))
.dateOfIssue(
new SimpleDateFormat("yyyy/MM/dd")
.parse(passportDataJson.getString("dateOfIssue"))
)
.scan(passportDataJson.getString("scan"))
.citizenship(passportDataJson.getString("citizenship"))
.build();
} catch (ParseException e) {
System.out.println("Reject happened with " + e.getLocalizedMessage());
channel.basicReject(message.getEnvelope().getDeliveryTag(), false);
}
System.out.println("Отображаю текст на русском");
}, (CancelCallback) null);
} catch (TimeoutException | IOException e) {
e.printStackTrace();
}
}
}
| [
"mikheevs11@gmail.com"
] | mikheevs11@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.