blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
da3a880fc3560d4747520f6f43c5ea4a8a59f33f
58e07029e5ec0a881f7392ef5c33419aba8f9246
/src/main/java/com/cs587/icampusfood/persistence/dataObjects/FavoriteDBDO.java
8bc096be7cdd0b3e8e0dd5d57b8de5486cb20035
[]
no_license
Jlong89/icampusfood
aa3844ff962714b3f8696e3bd8e74caeb8b0bce1
5e41219cbc3963b6bde1559fd40db9dd6953efae
refs/heads/master
2021-01-10T16:33:32.119675
2016-01-09T23:09:34
2016-01-09T23:09:34
49,304,065
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.cs587.icampusfood.persistence.dataObjects; /** * Created by longpengjiao on 10/4/15. */ public class FavoriteDBDO { private int favoriteId; private int locationId; public int getLocationId() { return locationId; } public void setLocationId(int locationId) { this.locationId = locationId; } private String userName; public int getFavoriteId() { return favoriteId; } public void setFavoriteId(int favoriteId) { this.favoriteId = favoriteId; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } }
[ "jiaolong89@gmail.com" ]
jiaolong89@gmail.com
02623d668a41a56579a323eb24783c1d65ca1878
9a83466d80cbb93ea39ccee7b306d0edfe58862f
/src/test/java/guru/springframework/services/RecipeServiceImplTest.java
53af38e682fe721286583242d941b1dbf912d34c
[]
no_license
andreimoldovan23/SpringRecipeApp
badd251f4577c22c9c46bea27a9eaab36d610809
c7e7b21a8b85c14a2c9b6d741829a68eeb87281f
refs/heads/master
2023-04-10T08:00:56.543952
2021-04-17T20:54:33
2021-04-17T20:54:33
352,077,699
0
0
null
null
null
null
UTF-8
Java
false
false
1,627
java
package guru.springframework.services; import guru.springframework.domain.Entities.Recipe; import guru.springframework.repositories.RecipeRepository; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.*; import org.mockito.junit.jupiter.MockitoExtension; import java.util.Optional; import java.util.Set; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) public class RecipeServiceImplTest { @Mock RecipeRepository recipeRepository; @InjectMocks RecipeServiceImpl recipeService; @Test public void getRecipes() { Recipe recipe = new Recipe(); when(recipeService.getRecipes()).thenReturn(Set.of(recipe)); Set<Recipe> recipes = recipeService.getRecipes(); assertEquals(recipes.size(), 1); verify(recipeRepository, times(1)).findAll(); } @Test public void findById() { Recipe recipe = new Recipe(); when(recipeRepository.findById(anyLong())) .thenAnswer(invocationOnMock -> { Long argument = invocationOnMock.getArgument(0); return argument <= 5L ? Optional.of(recipe) : Optional.empty(); }); assertEquals(recipe, recipeService.findById(3L)); assertThrows(RuntimeException.class, () -> recipeService.findById(10L)); verify(recipeRepository, times(2)).findById(anyLong()); verify(recipeRepository, never()).findAll(); } }
[ "moldovanandrei2301@gmail.com" ]
moldovanandrei2301@gmail.com
a22c10958ae66365a12ffa69d1d85b7d66087f30
060946612afcec3276edf23f87e46a656e2777bc
/android/src/main/java/android/support/v4/view/GravityCompatJellybeanMr1.java
c79dff8e824a9e7be6cbb3ae7ae04d37acb89224
[]
no_license
StoneSet/furrtek_esl
b6a387132fb2b7459faab3ce00439192d457227f
565c76d1eeaea7646a84ff8a43b79a1323787d24
refs/heads/master
2020-06-02T13:37:45.677814
2019-08-08T11:58:52
2019-08-08T11:58:52
191,172,666
12
1
null
null
null
null
UTF-8
Java
false
false
728
java
package android.support.v4.view; import android.graphics.Rect; import android.view.Gravity; class GravityCompatJellybeanMr1 { GravityCompatJellybeanMr1() { } public static void apply(int i, int i2, int i3, Rect rect, int i4, int i5, Rect rect2, int i6) { Gravity.apply(i, i2, i3, rect, i4, i5, rect2, i6); } public static void apply(int i, int i2, int i3, Rect rect, Rect rect2, int i4) { Gravity.apply(i, i2, i3, rect, rect2, i4); } public static void applyDisplay(int i, Rect rect, Rect rect2, int i2) { Gravity.applyDisplay(i, rect, rect2, i2); } public static int getAbsoluteGravity(int i, int i2) { return Gravity.getAbsoluteGravity(i, i2); } }
[ "spamfree@matthieubessat.fr" ]
spamfree@matthieubessat.fr
56fc42671a877f34f625315636db06722f5cf421
e05b6d53ca8e0c3dd5e760e909a3d68f70b0fac3
/src/MenuClickables/Insert/headingClickable.java
cbe2f1b0f20700bb9a6aeadd8dd37a3eb6d93274
[]
no_license
DanudeSandstorm/SWEN262-HTMLEditor
c30d8650d45ebd00ffc559bf9a7a5ccf2cbb1e8b
d58576da37156b36263fd2c41748b73f32b8a02d
refs/heads/master
2021-01-23T07:10:06.438039
2017-09-05T16:05:05
2017-09-05T16:05:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
589
java
package MenuClickables.Insert; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.scene.control.MenuItem; import HTMLHelper.TagMatcher; import HTMLValidator.HeadingTag; /** * @author ? */ public class headingClickable { public static MenuItem setClickable(final String name, final int number) { MenuItem newItem = new MenuItem(name); newItem.setOnAction(new EventHandler<ActionEvent>() { public void handle(ActionEvent t) { TagMatcher.generateTag(new HeadingTag(number)); } }); return newItem; } }
[ "dds2130@rit.edu" ]
dds2130@rit.edu
49da1fc11895331bdd1127eee88e5fcd96a20d96
f11b5b872e815ff0f56960be62c2e6598f5ebd9b
/api/src/main/java/ntk/base/api/ticketing/model/TicketingDepartemenAddRequest.java
96ea3777df2aa57a1b1a3287f0a31070b2833c90
[]
no_license
akaravi/Ntk.Android.CpanelBase
fe973273584cfd064f77d5dfe021914e4c568573
6d12ca51ec3d0d5273824446de27ce73362542ff
refs/heads/master
2021-06-14T23:36:21.185613
2021-05-29T07:40:43
2021-05-29T07:40:43
193,188,179
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package ntk.base.api.ticketing.model; import ntk.base.api.ticketing.entity.TicketingDepartemen; public class TicketingDepartemenAddRequest extends TicketingDepartemen { }
[ "zsdg98@gmail.com" ]
zsdg98@gmail.com
3fcb0a98d4ac9f50e252741815c2c109a1613ebc
42098591721dce47d7a02cd9adf0a3d45fc5fe44
/src/main/java/ui/AppResources.java
411ed5039b2db01cba41f4aed5ef79a246209f64
[]
no_license
jorgedfbranco/aoe2tools
bcd04063db118d57dd55799cc2b55ac0d20072ef
9ab74cc0c425da6a1e612a3d116b4054e63ff3b9
refs/heads/master
2023-05-14T08:59:55.748029
2021-06-01T11:18:42
2021-06-01T11:18:42
359,213,486
0
0
null
2021-04-21T06:18:03
2021-04-18T17:44:08
Java
UTF-8
Java
false
false
1,881
java
package ui; import javafx.scene.image.Image; import java.util.Map; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; public class AppResources { public static Image FullHeart = new Image(AppResources.class.getResourceAsStream("/heart-full.png")); public static Image EmptyHeart = new Image(AppResources.class.getResourceAsStream("/heart-empty.png")); public static Image Aoe2NetIcon = new Image(AppResources.class.getResourceAsStream("/aoe2net_icon.png")); public static Image Aoe2ClubIcon = new Image(AppResources.class.getResourceAsStream("/aoe2club_icon.png")); public static Image SteamIcon = new Image(AppResources.class.getResourceAsStream("/steam.png")); public static Image Aoe2InsightsIcon = new Image(AppResources.class.getResourceAsStream("/aoe2insights.jpg")); public static Image InfoIcon = new Image(AppResources.class.getResourceAsStream("/info-32.png")); public static Image KeyIcon = new Image(AppResources.class.getResourceAsStream("/key-red.png")); public static Image NoteIcon = new Image(AppResources.class.getResourceAsStream("/note.png")); public static Image WonIcon = new Image(AppResources.class.getResourceAsStream("/winner.png")); private static Map<String, Optional<Image>> flags = new ConcurrentHashMap<>(); public static Optional<Image> getCountryFlag(String countryCode) { var flag = flags.get(countryCode); if (flag == null) { var filename = "/flags/24x24/" + countryCode.toUpperCase() + ".png"; var stream = AppResources.class.getResourceAsStream(filename); Optional<Image> image = Optional.empty(); if (stream != null) image = Optional.of(new Image(stream)); flags.put(countryCode, image); return image; } else { return flag; } } }
[ "jorge.d.f.branco@gmail.com" ]
jorge.d.f.branco@gmail.com
ce1619906a4b4fd9d4789ec30e4a624867e8c69e
04d22217dd4f4f9311e50f004e99d08bb4a0b01f
/diamond/ujia-lion/src/main/java/com/ujia/lion/service/ConstructServiceI.java
e09a99aaa01e1e53cd7ba45100ff95fe6cd29af5
[]
no_license
chendapang/diamond
5c6a17a5f584fc1d8607021e73cd55cf6a4b5688
53818ef4176eb0485a77ce26dd05920be951799b
refs/heads/master
2021-09-24T14:24:45.107544
2017-12-23T09:20:00
2017-12-23T09:20:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
672
java
package com.ujia.lion.service; import com.ujia.jo.ConstructionJo; import com.ujia.utils.PageInfo; import com.ujia.vo.ConstructionVo; /** * 活动业务 * * @author xx * */ public interface ConstructServiceI { /** * 根据类型获取活动列表 * * @param status * 活动状态 (1:最新 2精选活动 3即将开始 4已下线) * @param page * 第n页 * @param pageNum * 每页n条数据 * @return */ PageInfo<ConstructionVo> getItems(Integer pageNumber, Integer pageNum,String projectName); ConstructionVo getItemById(String id); void deleteItemById(String id); void editItem(ConstructionJo a); }
[ "yxc5201314" ]
yxc5201314
3e69d3df3d96e1dfc12533d53a8f52e9fa65eb2d
718669ae1abdc7de1e46a97e1c884aba6c8ce889
/app/src/main/java/co/kpham/ilovezappos/data/RetrofitClient.java
c9bff069507df79af8795b2ef50e9908f6e2aef2
[]
no_license
KitoPham/CryptoTracker
9d19d148db4065362245fea3a4643370837e89d0
c7457abef1b2c938a1d0cff18ee645b6a263423c
refs/heads/master
2021-09-21T18:01:07.127335
2018-08-30T02:32:25
2018-08-30T02:32:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
635
java
package co.kpham.ilovezappos.data; /** * Created by Kito Pham on 9/9/2017. */ import android.util.Log; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; public class RetrofitClient { private static Retrofit retrofit = null; public static Retrofit getClient(String baseUrl) { if (retrofit==null) { Log.d("Retrofit", "getClient:" + baseUrl); retrofit = new Retrofit.Builder() .baseUrl(baseUrl) .addConverterFactory(GsonConverterFactory.create()) .build(); } return retrofit; } }
[ "kpham97@live.com" ]
kpham97@live.com
1d8d9af5b6702ecc22ffa668a59ac968c70f5a49
bc4750719e25266004dc8533b3161f00f4c8d9e7
/springboot-a/springboot-common/src/main/java/com/xiehui/common/util/Base64Decoder.java
f30702c2ee3d801ceed724ed5657be509a1f4394
[]
no_license
xiehuilovezhenyan/springboot
5cf87177da32a43a4a3c2f0fb2af75337ec6072e
8a2f9102956dae52336300712653e31aec2bf09e
refs/heads/master
2022-07-01T23:21:47.466157
2019-12-09T08:09:19
2019-12-09T08:09:19
226,489,182
0
0
null
2022-06-17T02:46:21
2019-12-07T09:53:36
Java
UTF-8
Java
false
false
4,610
java
package com.xiehui.common.util; import java.io.*; public class Base64Decoder extends FilterInputStream { private static final char[] chars = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; // A mapping between char values and six-bit integers private static final int[] ints = new int[128]; static { for (int i = 0; i < 64; i++) { ints[chars[i]] = i; } } private int charCount; private int carryOver; /*** * Constructs a new Base64 decoder that reads input from the given InputStream. * * @param in the input stream */ public Base64Decoder(InputStream in) { super(in); } /*** * Returns the next decoded character from the stream, or -1 if end of stream * was reached. * * @return the decoded character, or -1 if the end of the input stream is * reached * @exception IOException if an I/O error occurs */ public int read() throws IOException { // Read the next non-whitespace character int x; do { x = in.read(); if (x == -1) { return -1; } } while (Character.isWhitespace((char) x)); charCount++; // The '=' sign is just padding if (x == '=') { return -1; // effective end of stream } // Convert from raw form to 6-bit form x = ints[x]; // Calculate which character we're decoding now int mode = (charCount - 1) % 4; // First char save all six bits, go for another if (mode == 0) { carryOver = x & 63; return read(); } // Second char use previous six bits and first two new bits, // save last four bits else if (mode == 1) { int decoded = ((carryOver << 2) + (x >> 4)) & 255; carryOver = x & 15; return decoded; } // Third char use previous four bits and first four new bits, // save last two bits else if (mode == 2) { int decoded = ((carryOver << 4) + (x >> 2)) & 255; carryOver = x & 3; return decoded; } // Fourth char use previous two bits and all six new bits else if (mode == 3) { int decoded = ((carryOver << 6) + x) & 255; return decoded; } return -1; // can't actually reach this line } /*** * Reads decoded data into an array of bytes and returns the actual number of * bytes read, or -1 if end of stream was reached. * * @param buf the buffer into which the data is read * @param off the start offset of the data * @param len the maximum number of bytes to read * @return the actual number of bytes read, or -1 if the end of the input stream * is reached * @exception IOException if an I/O error occurs */ public int read(byte[] buf, int off, int len) throws IOException { if (buf.length < (len + off - 1)) { throw new IOException("The input buffer is too small: " + len + " bytes requested starting at offset " + off + " while the buffer " + " is only " + buf.length + " bytes long."); } // This could of course be optimized int i; for (i = 0; i < len; i++) { int x = read(); if (x == -1 && i == 0) { // an immediate -1 returns -1 return -1; } else if (x == -1) { // a later -1 returns the chars read so far break; } buf[off + i] = (byte) x; } return i; } /*** * Returns the decoded form of the given encoded string, as a String. Note that * not all binary data can be represented as a String, so this method should * only be used for encoded String data. Use decodeToBytes() otherwise. * * @param encoded the string to decode * @return the decoded form of the encoded string */ public static String decode(String encoded) { return new String(decodeToBytes(encoded)); } /*** * Returns the decoded form of the given encoded string, as bytes. * * @param encoded the string to decode * @return the decoded form of the encoded string */ public static byte[] decodeToBytes(String encoded) { byte[] bytes = null; try { bytes = encoded.getBytes("UTF-8"); } catch (UnsupportedEncodingException ignored) { } Base64Decoder in = new Base64Decoder(new ByteArrayInputStream(bytes)); ByteArrayOutputStream out = new ByteArrayOutputStream((int) (bytes.length * 0.67)); try { byte[] buf = new byte[4 * 1024]; // 4K buffer int bytesRead; while ((bytesRead = in.read(buf)) != -1) { out.write(buf, 0, bytesRead); } out.close(); return out.toByteArray(); } catch (IOException ignored) { return null; } } }
[ "xiehui@lanjinrong.com" ]
xiehui@lanjinrong.com
1791090b6f65ef8d8f06b7e562e342de313db042
c3f4a5ff060e47fd637729b520cc0a5f20ef2af1
/app/src/main/java/com/example/myapplication/addresspicker/ConvertUtils.java
9b84e08e62d4b9af7fe854d30fd4e350eab8150a
[]
no_license
yufeilong92/MultipleOptionsDialog
ff6fc955b95b1603576a934b0dcb36fe4f85b182
1b18cd78bb59ef18f3173702e3ce074a3b1bc9bb
refs/heads/master
2022-12-30T14:53:53.624256
2020-10-20T03:19:51
2020-10-20T03:19:51
299,936,130
0
0
null
null
null
null
UTF-8
Java
false
false
22,910
java
package com.example.myapplication.addresspicker; import android.annotation.TargetApi; import android.content.ContentUris; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.NinePatchDrawable; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.DocumentsContract; import android.provider.MediaStore; import android.text.TextUtils; import android.util.TypedValue; import android.view.View; import android.widget.ListView; import android.widget.ScrollView; import androidx.annotation.ColorInt; import androidx.annotation.FloatRange; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.nio.ByteBuffer; import java.text.DecimalFormat; import java.util.Arrays; import java.util.List; import java.util.Locale; /** * 数据类型转换、单位转换 * @author matt * blog: addapp.cn */ public class ConvertUtils { public static final long GB = 1073741824; public static final long MB = 1048576; public static final long KB = 1024; public static int toInt(Object obj) { try { return Integer.parseInt(obj.toString()); } catch (NumberFormatException e) { return -1; } } public static int toInt(byte[] bytes) { int result = 0; byte abyte; for (int i = 0; i < bytes.length; i++) { abyte = bytes[i]; result += (abyte & 0xFF) << (8 * i); } return result; } public static int toShort(byte first, byte second) { return (first << 8) + (second & 0xFF); } public static long toLong(Object obj) { try { return Long.parseLong(obj.toString()); } catch (NumberFormatException e) { return -1L; } } public static float toFloat(Object obj) { try { return Float.parseFloat(obj.toString()); } catch (NumberFormatException e) { return -1f; } } /** * int占4字节 * * @param i the * @return byte [ ] */ public static byte[] toByteArray(int i) { // byte[] bytes = new byte[4]; // bytes[0] = (byte) (0xff & i); // bytes[1] = (byte) ((0xff00 & i) >> 8); // bytes[2] = (byte) ((0xff0000 & i) >> 16); // bytes[3] = (byte) ((0xff000000 & i) >> 24); // return bytes; return ByteBuffer.allocate(4).putInt(i).array(); } public static byte[] toByteArray(String hexData, boolean isHex) { if (hexData == null || hexData.equals("")) { return null; } if (!isHex) { return hexData.getBytes(); } hexData = hexData.replaceAll("\\s+", ""); String hexDigits = "0123456789ABCDEF"; ByteArrayOutputStream baos = new ByteArrayOutputStream( hexData.length() / 2); // 将每2位16进制整数组装成一个字节 for (int i = 0; i < hexData.length(); i += 2) { baos.write((hexDigits.indexOf(hexData.charAt(i)) << 4 | hexDigits .indexOf(hexData.charAt(i + 1)))); } byte[] bytes = baos.toByteArray(); try { baos.close(); } catch (IOException e) { LogUtils.warn(e); } return bytes; } public static String toHexString(String str) { if (TextUtils.isEmpty(str)) return ""; StringBuilder builder = new StringBuilder(); byte[] bytes = str.getBytes(); for (byte aByte : bytes) { builder.append(Integer.toHexString(0xFF & aByte)); builder.append(" "); } return builder.toString(); } /** * To hex string string. * * @param bytes the bytes * @return the string */ public static String toHexString(byte... bytes) { char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; // 参见:http://www.oschina.net/code/snippet_116768_9019 char[] buffer = new char[bytes.length * 2]; for (int i = 0, j = 0; i < bytes.length; ++i) { int u = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];//转无符号整型 buffer[j++] = DIGITS[u >>> 4]; buffer[j++] = DIGITS[u & 0xf]; } return new String(buffer); } /** * To hex string string. * * @param num the num * @return the string */ public static String toHexString(int num) { String hexString = Integer.toHexString(num); LogUtils.verbose(String.format(Locale.CHINA, "%d to hex string is %s", num, hexString)); return hexString; } /** * To binary string string. * * @param bytes the bytes * @return the string */ public static String toBinaryString(byte... bytes) { char[] DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; // 参见:http://www.oschina.net/code/snippet_116768_9019 char[] buffer = new char[bytes.length * 8]; for (int i = 0, j = 0; i < bytes.length; ++i) { int u = bytes[i] < 0 ? bytes[i] + 256 : bytes[i];//转无符号整型 buffer[j++] = DIGITS[(u >>> 7) & 0x1]; buffer[j++] = DIGITS[(u >>> 6) & 0x1]; buffer[j++] = DIGITS[(u >>> 5) & 0x1]; buffer[j++] = DIGITS[(u >>> 4) & 0x1]; buffer[j++] = DIGITS[(u >>> 3) & 0x1]; buffer[j++] = DIGITS[(u >>> 2) & 0x1]; buffer[j++] = DIGITS[(u >>> 1) & 0x1]; buffer[j++] = DIGITS[u & 0x1]; } return new String(buffer); } /** * To binary string string. * * @param num the num * @return the string */ public static String toBinaryString(int num) { String binaryString = Integer.toBinaryString(num); LogUtils.verbose(String.format(Locale.CHINA, "%d to binary string is %s", num, binaryString)); return binaryString; } public static String toSlashString(String str) { String result = ""; char[] chars = str.toCharArray(); for (char chr : chars) { if (chr == '"' || chr == '\'' || chr == '\\') { result += "\\";//符合“"”“'”“\”这三个符号的前面加一个“\” } result += chr; } return result; } public static <T> T[] toArray(List<T> list) { //noinspection unchecked return (T[]) list.toArray(); } public static <T> List<T> toList(T[] array) { return Arrays.asList(array); } public static String toString(Object[] objects) { return Arrays.deepToString(objects); } public static String toString(Object[] objects, String tag) { StringBuilder sb = new StringBuilder(); for (Object object : objects) { sb.append(object); sb.append(tag); } return sb.toString(); } public static byte[] toByteArray(InputStream is) { if (is == null) { return null; } try { ByteArrayOutputStream os = new ByteArrayOutputStream(); byte[] buff = new byte[100]; while (true) { int len = is.read(buff, 0, 100); if (len == -1) { break; } else { os.write(buff, 0, len); } } byte[] bytes = os.toByteArray(); os.close(); is.close(); return bytes; } catch (IOException e) { LogUtils.warn(e); } return null; } public static byte[] toByteArray(Bitmap bitmap) { if (bitmap == null) { return null; } ByteArrayOutputStream os = new ByteArrayOutputStream(); // 将Bitmap压缩成PNG编码,质量为100%存储,除了PNG还有很多常见格式,如jpeg等。 bitmap.compress(Bitmap.CompressFormat.PNG, 100, os); byte[] bytes = os.toByteArray(); try { os.close(); } catch (IOException e) { LogUtils.warn(e); } return bytes; } public static Bitmap toBitmap(byte[] bytes, int width, int height) { Bitmap bitmap = null; if (bytes.length != 0) { try { BitmapFactory.Options options = new BitmapFactory.Options(); // 不进行图片抖动处理 options.inDither = false; // 设置让解码器以最佳方式解码 options.inPreferredConfig = null; if (width > 0 && height > 0) { options.outWidth = width; options.outHeight = height; } bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); bitmap.setDensity(96);// 96 dpi } catch (Exception e) { LogUtils.error(e); } } return bitmap; } public static Bitmap toBitmap(byte[] bytes) { return toBitmap(bytes, -1, -1); } /** * 将Drawable转换为Bitmap * 参考:http://kylines.iteye.com/blog/1660184 */ public static Bitmap toBitmap(Drawable drawable) { if (drawable instanceof BitmapDrawable) { return ((BitmapDrawable) drawable).getBitmap(); } else if (drawable instanceof ColorDrawable) { //color Bitmap bitmap = Bitmap.createBitmap(32, 32, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); canvas.drawColor(((ColorDrawable) drawable).getColor()); return bitmap; } else if (drawable instanceof NinePatchDrawable) { //.9.png Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); drawable.draw(canvas); return bitmap; } return null; } /** * 从第三方文件选择器获取路径。 * 参见:http://blog.csdn.net/zbjdsbj/article/details/42387551 */ @TargetApi(Build.VERSION_CODES.KITKAT) public static String toPath(Context context, Uri uri) { if (uri == null) { LogUtils.verbose("uri is null"); return ""; } LogUtils.verbose("uri: " + uri.toString()); String path = uri.getPath(); String scheme = uri.getScheme(); String authority = uri.getAuthority(); //是否是4.4及以上版本 boolean isKitKat = Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT; // DocumentProvider if (isKitKat && DocumentsContract.isDocumentUri(context, uri)) { String docId = DocumentsContract.getDocumentId(uri); String[] split = docId.split(":"); String type = split[0]; Uri contentUri = null; switch (authority) { // ExternalStorageProvider case "com.android.externalstorage.documents": if ("primary".equalsIgnoreCase(type)) { return Environment.getExternalStorageDirectory() + "/" + split[1]; } break; // DownloadsProvider case "com.android.providers.downloads.documents": contentUri = ContentUris.withAppendedId( Uri.parse("content://downloads/public_downloads"), Long.valueOf(docId)); return _queryPathFromMediaStore(context, contentUri, null, null); // MediaProvider case "com.android.providers.media.documents": if ("image".equals(type)) { contentUri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI; } else if ("video".equals(type)) { contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI; } else if ("audio".equals(type)) { contentUri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; } String selection = "_id=?"; String[] selectionArgs = new String[]{split[1]}; return _queryPathFromMediaStore(context, contentUri, selection, selectionArgs); } } // MediaStore (and general) else { if ("content".equalsIgnoreCase(scheme)) { // Return the remote address if (authority.equals("com.google.android.apps.photos.content")) { return uri.getLastPathSegment(); } return _queryPathFromMediaStore(context, uri, null, null); } // File else if ("file".equalsIgnoreCase(scheme)) { return uri.getPath(); } } LogUtils.verbose("uri to path: " + path); return path; } private static String _queryPathFromMediaStore(Context context, Uri uri, String selection, String[] selectionArgs) { String filePath = null; try { String[] projection = {MediaStore.Images.Media.DATA}; Cursor cursor = context.getContentResolver().query(uri, projection, selection, selectionArgs, null); if (cursor != null) { int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); cursor.moveToFirst(); filePath = cursor.getString(column_index); cursor.close(); } } catch (IllegalArgumentException e) { LogUtils.error(e); } return filePath; } /** * 把view转化为bitmap(截图) * 参见:http://www.cnblogs.com/lee0oo0/p/3355468.html */ public static Bitmap toBitmap(View view) { int width = view.getWidth(); int height = view.getHeight(); if (view instanceof ListView) { height = 0; // 获取listView实际高度 ListView listView = (ListView) view; for (int i = 0; i < listView.getChildCount(); i++) { height += listView.getChildAt(i).getHeight(); } } else if (view instanceof ScrollView) { height = 0; // 获取scrollView实际高度 ScrollView scrollView = (ScrollView) view; for (int i = 0; i < scrollView.getChildCount(); i++) { height += scrollView.getChildAt(i).getHeight(); } } view.setDrawingCacheEnabled(true); view.clearFocus(); view.setPressed(false); boolean willNotCache = view.willNotCacheDrawing(); view.setWillNotCacheDrawing(false); // Reset the drawing cache background color to fully transparent for the duration of this operation int color = view.getDrawingCacheBackgroundColor(); view.setDrawingCacheBackgroundColor(Color.WHITE);//截图去黑色背景(透明像素) if (color != Color.WHITE) { view.destroyDrawingCache(); } view.buildDrawingCache(); Bitmap cacheBitmap = view.getDrawingCache(); if (cacheBitmap == null) { return null; } Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); canvas.drawBitmap(cacheBitmap, 0, 0, null); // canvas.save(Canvas.ALL_SAVE_FLAG); canvas.save(); canvas.restore(); if (!bitmap.isRecycled()) { LogUtils.verbose("recycle bitmap: " + bitmap.toString()); bitmap.recycle(); } // Restore the view view.destroyDrawingCache(); view.setWillNotCacheDrawing(willNotCache); view.setDrawingCacheBackgroundColor(color); return bitmap; } public static Drawable toDrawable(Bitmap bitmap) { return bitmap == null ? null : new BitmapDrawable(Resources.getSystem(), bitmap); } public static byte[] toByteArray(Drawable drawable) { return toByteArray(toBitmap(drawable)); } public static Drawable toDrawable(byte[] bytes) { return toDrawable(toBitmap(bytes)); } /** * dp转换为px */ public static int toPx(Context context, float dpValue) { final float scale = context.getResources().getDisplayMetrics().density; int pxValue = (int) (dpValue * scale + 0.5f); LogUtils.verbose(dpValue + " dp == " + pxValue + " px"); return pxValue; } public static int toPx(float dpValue) { Resources resources = Resources.getSystem(); float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dpValue, resources.getDisplayMetrics()); return (int) px; } /** * px转换为dp */ public static int toDp(Context context, float pxValue) { final float scale = context.getResources().getDisplayMetrics().density; int dpValue = (int) (pxValue / scale + 0.5f); LogUtils.verbose(pxValue + " px == " + dpValue + " dp"); return dpValue; } /** * px转换为sp */ public static int toSp(Context context, float pxValue) { final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; int spValue = (int) (pxValue / fontScale + 0.5f); LogUtils.verbose(pxValue + " px == " + spValue + " sp"); return spValue; } public static String toGbk(String str) { try { return new String(str.getBytes("utf-8"), "gbk"); } catch (UnsupportedEncodingException e) { LogUtils.warn(e); return str; } } public static String toFileSizeString(long fileSize) { DecimalFormat df = new DecimalFormat("0.00"); String fileSizeString; if (fileSize < KB) { fileSizeString = fileSize + "B"; } else if (fileSize < MB) { fileSizeString = df.format((double) fileSize / KB) + "K"; } else if (fileSize < GB) { fileSizeString = df.format((double) fileSize / MB) + "M"; } else { fileSizeString = df.format((double) fileSize / GB) + "G"; } return fileSizeString; } public static String toString(InputStream is, String charset) { StringBuilder sb = new StringBuilder(); try { BufferedReader reader = new BufferedReader(new InputStreamReader(is, charset)); while (true) { String line = reader.readLine(); if (line == null) { break; } else { sb.append(line).append("\n"); } } reader.close(); is.close(); } catch (IOException e) { LogUtils.error(e); } return sb.toString(); } public static String toString(InputStream is) { return toString(is, "utf-8"); } public static int toDarkenColor(@ColorInt int color) { return toDarkenColor(color, 0.8f); } public static int toDarkenColor(@ColorInt int color, @FloatRange(from = 0f, to = 1f) float value) { float[] hsv = new float[3]; Color.colorToHSV(color, hsv); hsv[2] *= value;//HSV指Hue、Saturation、Value,即色调、饱和度和亮度,此处表示修改亮度 return Color.HSVToColor(hsv); } /** * 转换为6位十六进制颜色代码,不含“#” */ public static String toColorString(@ColorInt int color) { return toColorString(color, false); } /** * 转换为6位十六进制颜色代码,不含“#” */ public static String toColorString(@ColorInt int color, boolean includeAlpha) { String alpha = Integer.toHexString(Color.alpha(color)); String red = Integer.toHexString(Color.red(color)); String green = Integer.toHexString(Color.green(color)); String blue = Integer.toHexString(Color.blue(color)); if (alpha.length() == 1) { alpha = "0" + alpha; } if (red.length() == 1) { red = "0" + red; } if (green.length() == 1) { green = "0" + green; } if (blue.length() == 1) { blue = "0" + blue; } String colorString; if (includeAlpha) { colorString = alpha + red + green + blue; LogUtils.verbose(String.format(Locale.CHINA, "%d to color string is %s", color, colorString)); } else { colorString = red + green + blue; LogUtils.verbose(String.format(Locale.CHINA, "%d to color string is %s%s%s%s, exclude alpha is %s", color, alpha, red, green, blue, colorString)); } return colorString; } /** * 对TextView、Button等设置不同状态时其文字颜色。 * 参见:http://blog.csdn.net/sodino/article/details/6797821 */ public static ColorStateList toColorStateList(@ColorInt int normalColor, @ColorInt int pressedColor, @ColorInt int focusedColor, @ColorInt int unableColor) { int[] colors = new int[]{pressedColor, focusedColor, normalColor, focusedColor, unableColor, normalColor}; int[][] states = new int[6][]; states[0] = new int[]{android.R.attr.state_pressed, android.R.attr.state_enabled}; states[1] = new int[]{android.R.attr.state_enabled, android.R.attr.state_focused}; states[2] = new int[]{android.R.attr.state_enabled}; states[3] = new int[]{android.R.attr.state_focused}; states[4] = new int[]{android.R.attr.state_window_focused}; states[5] = new int[]{}; return new ColorStateList(states, colors); } public static ColorStateList toColorStateList(@ColorInt int normalColor, @ColorInt int pressedColor) { return toColorStateList(normalColor, pressedColor, pressedColor, normalColor); } }
[ "931697478@qq.com" ]
931697478@qq.com
6e557f76242052298938e59d5ffa1a412ded5f9b
36977c836f9793e5ecc372922d2f508ee854ddad
/src/com/github/norbo11/util/Formatter.java
23514bcfa3a35258f64de48a829cfb2bf5ef3056
[]
no_license
whskydck/UltimateCards
2d4870d38c73fa2ee545531d2614d1eebeed980e
ab7ba5a0c200c0d6658eb6654d8a1d8576e5fcb0
refs/heads/master
2020-12-30T19:37:11.017153
2015-01-26T22:23:43
2015-01-26T22:23:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,015
java
package com.github.norbo11.util; import java.text.DecimalFormat; import org.bukkit.Location; public class Formatter { // Converts the given double into a percentage string public static String convertToPercentage(double value) { return Double.toString(NumberMethods.roundDouble(value * 100, 1)) + '%'; } public static String formatLocation(Location location) { if (location == null) return "Not set"; return "&6X: &f" + Math.round(location.getX()) + "&6 Z: &f" + Math.round(location.getZ()) + "&6 Y: &f" + Math.round(location.getY()) + "&6 World: &f" + location.getWorld().getName(); } // Converts things like '31982193' into '31,982,193.00' public static String formatMoney(double amount) { DecimalFormat df = new DecimalFormat("0.00#"); return "&6" + df.format(amount); } public static String formatMoneyWithoutColor(double amount) { DecimalFormat df = new DecimalFormat("0.00#"); return df.format(amount); } }
[ "norbo11@googlemail.com" ]
norbo11@googlemail.com
cbb205ab419f6d15876b6c7f274ee0e54081cb3f
07f3f543ffb469993af5c8771157a2615f3d42df
/core/src/main/java/org/hisp/dhis/android/core/arch/db/adapters/enums/internal/NoteTypeColumnAdapter.java
428c3760451951d0f2f6df65c91bcb02bb226db2
[ "BSD-3-Clause" ]
permissive
Hamza-ye/dhis2-android-sdk
28e612d0a6811595431a9555334049bd341f2e26
dfb5f2b3d656eb4494230c5f0250b46d55f64c61
refs/heads/master
2022-12-30T00:07:33.371637
2020-10-16T12:34:25
2020-10-16T12:34:25
255,740,015
0
0
BSD-3-Clause
2020-10-16T12:34:26
2020-04-14T22:17:40
null
UTF-8
Java
false
false
1,860
java
/* * Copyright (c) 2004-2019, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.hisp.dhis.android.core.arch.db.adapters.enums.internal; import org.hisp.dhis.android.core.note.Note; public class NoteTypeColumnAdapter extends EnumColumnAdapter<Note.NoteType> { @Override protected Class<Note.NoteType> getEnumClass() { return Note.NoteType.class; } }
[ "marcamsn@gmail.com" ]
marcamsn@gmail.com
fe231989c1120d59facd7c622f58bfebfaffb4de
0f2b9d4164b97e408bf494a7b4fea7995e71e290
/src/main/java/com/ericschlenz/nflscrape/Main.java
0b6e8109bcfac2d3964ced14602ba9f0fea64877
[ "Apache-2.0" ]
permissive
eschlenz/com.ericschlenz.nflscrape
c8bb4fda14449e0d16ee933232f980a8f8a8896c
288d7f6758a5728f9cb21f2544b2516b6f8f0fe6
refs/heads/master
2021-01-12T14:10:48.156801
2017-10-17T14:43:10
2017-10-17T14:43:10
69,926,460
0
0
null
null
null
null
UTF-8
Java
false
false
8,796
java
package com.ericschlenz.nflscrape; import org.apache.commons.cli.*; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import java.io.IOException; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * Created by Eric on 10/2/16. */ public class Main { private static final String SCHEDULE = "http://www.espn.com/nfl/schedule/_/week/%1$s"; private static final String OFF_PASS_RANKS = "http://www.espn.com/nfl/statistics/team/_/stat/passing"; private static final String OFF_RUSH_RANKS = "http://www.espn.com/nfl/statistics/team/_/stat/rushing"; private static final String DEF_PASS_RANKS = "http://www.espn.com/nfl/statistics/team/_/stat/passing/position/defense"; private static final String DEF_RUSH_RANKS = "http://www.espn.com/nfl/statistics/team/_/stat/rushing/position/defense"; private static final String ESPN_BYE_WEEK = ".byeweek"; private static final String ESPN_TEAM_NAME = ".team-name"; private static final String ESPN_ABBR = "abbr"; private static final String ESPN_EVEN_ODD_ELEMENTS = "tr.oddrow, tr.evenrow"; private static final String ESPN_ALIGN_LEFT = "[align=left]"; private static final String ESPN_A = "a"; private final String week; private final String scheduleUrl; private Map<String, String> schedule = new LinkedHashMap<String, String>(); private Map<String, Integer> offPassRanks = new LinkedHashMap<String, Integer>(); private Map<String, Integer> defPassRanks = new LinkedHashMap<String, Integer>(); private Map<String, Integer> offRushRanks = new LinkedHashMap<String, Integer>(); private Map<String, Integer> defRushRanks = new LinkedHashMap<String, Integer>(); private List<Differential> offPassDiff = new ArrayList<Differential>(); private List<Differential> offRushDiff = new ArrayList<Differential>(); public Main(String week, String scheduleUrl) { this.week = week; this.scheduleUrl = scheduleUrl; } public static void main(String[] args) { Options options = new Options(); options.addOption("w", true, "The NFL week"); CommandLineParser parser = new DefaultParser(); CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (ParseException e) { throw new RuntimeException("Failed to parse parameters.", e); } String week; if (cmd.hasOption("w")) { week = cmd.getOptionValue("w"); } else { week = ""; } Main main = new Main(week, String.format(SCHEDULE, week)); main.load(); System.exit(0); } private void load() { loadSchedule(); loadOffensivePassingRanks(); loadDefensivePassingRanks(); loadOffensiveRushingRanks(); loadDefensiveRushingRanks(); findBestOffensivePassingScenarios(); findBestOffensiveRushingScenarios(); } private void loadSchedule() { System.out.println("\n\n" + "Date: " + new Date() + "\n"); System.out.println("Loading schedule: " + scheduleUrl + "\n"); String weekOutput = ("".equals(week)) ? "(current)" : week; System.out.println(String.format("Games for week: %1$s\n", weekOutput)); // Get rid of bye week teams. Document doc = loadDocument(scheduleUrl); doc.select(ESPN_BYE_WEEK).remove(); Elements teams = doc.select(ESPN_TEAM_NAME).select(ESPN_ABBR); String awayTeam = null; String homeTeam = null; for (int i=0; i < teams.size(); i++) { String team = teams.get(i).html(); if ((i % 2) == 0) { awayTeam = team; System.out.print(String.format("%1$3s", team)); } else { homeTeam = team; schedule.put(awayTeam, homeTeam); schedule.put(homeTeam, awayTeam); System.out.print(" at "); System.out.println(homeTeam); } } System.out.println(); } private void loadOffensivePassingRanks() { Document doc = loadDocument(OFF_PASS_RANKS); loadMapWithEspnRanks(doc, offPassRanks, "Offensive Passing Rankings"); } private void loadDefensivePassingRanks() { Document doc = loadDocument(DEF_PASS_RANKS); loadMapWithEspnRanks(doc, defPassRanks, "Defensive Passing Rankings"); } private void loadOffensiveRushingRanks() { Document doc = loadDocument(OFF_RUSH_RANKS); loadMapWithEspnRanks(doc, offRushRanks, "Offensive Rushing Rankings"); } private void loadDefensiveRushingRanks() { Document doc = loadDocument(DEF_RUSH_RANKS); loadMapWithEspnRanks(doc, defRushRanks, "Defensive Rushing Rankings"); } private void loadMapWithEspnRanks(Document doc, Map<String, Integer> ranks, String name) { Elements allRows = doc.select(ESPN_EVEN_ODD_ELEMENTS); Elements teams = allRows.select(ESPN_ALIGN_LEFT).select(ESPN_A); Pattern pattern = Pattern.compile(".*nfl/team/\\_/name/([a-zA-Z]+).*"); for (int i=0; i < teams.size(); i++) { String teamUrl = teams.get(i).attr("href"); Matcher matcher = null; if ((matcher = pattern.matcher(teamUrl)).matches()) { String team = matcher.group(1).toUpperCase(); ranks.put(team, i + 1); } else { throw new RuntimeException("Failed to get team name from: " + teamUrl); } } System.out.println(name); System.out.println(); for (Map.Entry<String, Integer> entry : ranks.entrySet()) { System.out.println(String.format("Team: %1$ 3d, %2$s", entry.getValue(), entry.getKey())); } System.out.println(); } private void findBestOffensivePassingScenarios() { System.out.println("******************************"); System.out.println("Best Offensive Passing Scenarios"); System.out.println("******************************\n"); findBestOffensiveScenarios(offPassRanks, defPassRanks, offPassDiff); System.out.println(); } private void findBestOffensiveRushingScenarios() { System.out.println("******************************"); System.out.println("Best Offensive Rushing Scenarios"); System.out.println("******************************\n"); findBestOffensiveScenarios(offRushRanks, defRushRanks, offRushDiff); System.out.println(); } private void findBestOffensiveScenarios(Map<String, Integer> offRanks, Map<String, Integer> defRanks, List<Differential> offDiff) { for (Map.Entry<String, Integer> entry : offRanks.entrySet()) { String opponent = schedule.get(entry.getKey()); if (opponent == null) { System.out.println(String.format("%1$s appears to be on a bye.", entry.getKey())); continue; } int offRank = entry.getValue(); int defRank = defRanks.get(opponent); int differential = defRank - offRank; offDiff.add(new Differential(entry.getKey(), differential)); } Collections.sort(offDiff); System.out.println(); int i=1; for (Differential diff : offDiff) { int diffVal = diff.getDifferential(); String favoredTeam = diff.getTeamName(); String opponentTeam = schedule.get(favoredTeam); System.out.println(String.format( "%1$ 3d. Differential: %2$ 3d -> %3$3s (playing %4$s)", i, diff.getDifferential(), diff.getTeamName(), opponentTeam)); i++; } } private Document loadDocument(String url) { Document doc = null; try { doc = Jsoup.connect(url).get(); } catch (IOException e) { throw new RuntimeException("Failed to load defensive passing ranks.", e); } return doc; } private static class Differential implements Comparable<Differential> { private final String teamName; private final int differential; public Differential(String teamName, int differential) { this.teamName = teamName; this.differential = differential; } public String getTeamName() { return teamName; } public int getDifferential() { return differential; } public int compareTo(Differential o) { return Integer.valueOf(differential).compareTo(o.getDifferential()) * -1; } } }
[ "eschlenz@ibotta.com" ]
eschlenz@ibotta.com
fa2626380c400f2bbc99b93fc2a552ed469e77d3
2f5a83099710469d4792619117c8817a9635486d
/src/main/java/br/uefs/war/view/impl/cli/MenuDeslocarExercitosCLI.java
b6e7833418e5b8b22c51184dbb75ea0f83673ed6
[]
no_license
KelCarmo/War2
0fb1ddbcbed3f9ab0cfa439bb6c9ae3337fa4e02
06ee056e0889812a975407f89d70af13e380526c
refs/heads/master
2020-04-12T15:14:53.668570
2018-12-20T12:12:54
2018-12-20T12:12:54
162,574,818
0
0
null
null
null
null
UTF-8
Java
false
false
4,222
java
package br.uefs.war.view.impl.cli; import java.util.Scanner; import br.uefs.war.model.Jogador; import br.uefs.war.model.Mapa; import br.uefs.war.model.Territorio; import br.uefs.war.view.core.Menu; import br.uefs.war.view.core.Tela; public class MenuDeslocarExercitosCLI implements Menu<Void> { private Tela tela; private Mapa mapa; private Jogador jogador; public void setTela(Tela tela) { this.tela = tela; } public void setMapa(Mapa mapa) { this.mapa = mapa; } public void setJogador(Jogador jogador) { this.jogador = jogador; } @Override public Void exibir() { System.out.println("-------- Etapa: Deslocar Exércitos --------"); Scanner scanner = new Scanner(System.in); int opcao = 0; do { tela.exibirMapa(mapa); System.out.println("1 - Encerrar Jogada"); System.out.println("2 - Deslocar Exércitos"); System.out.println("9 - Sair do Jogo"); opcao = scanner.nextInt(); switch (opcao) { case 1: jogador.getTerritorios().forEach((t) -> t.confirmarMovimentacoes()); break; case 2: System.out.println(); System.out.println(); fortificarTerritorio(); tela.exibirMapa(mapa); break; case 9: System.exit(0); break; default: System.out.println("Opção Inválida!"); break; } } while (opcao != 1); return null; } private void fortificarTerritorio() { Scanner scanner = new Scanner(System.in); System.out.println("1 -Cancelar"); System.out.print("OO-DD-E - Para mover E Exércitos de OO para DD. (ex. BA-PE-5): "); String pattern = "([A-Za-z]{2})([\\-||\\s]?)([A-Za-z]{2})([\\-||\\s]?)(\\d+)"; String input = null; String siglaOrigem; String siglaDestino; Territorio origem; Territorio destino; int exercitos; boolean exercitoDeslocado = false; do { input = scanner.nextLine().toUpperCase(); if (input.equals("1")) return; if (input == null || !input.matches(pattern)) { System.out.println("Entrada Inválida."); System.out.println(); System.out.println("1 -Cancelar"); System.out.println("9 - Sair do Jogo"); System.out.print("OO-DD-E - Para mover E tropas de OO para DD. (ex. BA-PE-5): "); continue; } siglaOrigem = input.replaceFirst(pattern, "$1"); origem = jogador.getTerritorio(siglaOrigem); if (origem == null) { System.out.println("O território de origem informado não existe ou não pertence ao jogador."); System.out.println(); System.out.println("1 -Cancelar"); System.out.println("9 - Sair do Jogo"); System.out.print("OO-DD-E - Para mover E tropas de OO para DD. (ex. BA-PE-5): "); continue; } siglaDestino = input.replaceFirst(pattern, "$3"); destino = jogador.getTerritorio(siglaDestino); if (destino == null) { System.out.println("O território de destino informado não existe ou não pertence ao jogador."); System.out.println(); System.out.println("1 -Cancelar"); System.out.println("9 - Sair do Jogo"); System.out.print("OO-DD-E - Para mover E tropas de OO para DD. (ex. BA-PE-5): "); continue; } exercitos = Integer.parseInt(input.replaceFirst(pattern, "$5")); if (exercitos > origem.getExercitosDisponiveis()) { System.out.println("A quantidade de exércitos informada excede o total disponível (Exércitos do território: " + origem.getExercitosDisponiveis() + ")."); System.out.println(); System.out.println("1 -Cancelar"); System.out.println("9 - Sair do Jogo"); System.out.print("OO-DD-E - Para mover E tropas de OO para DD. (ex. BA-PE-5): "); continue; } if (!origem.ehVizinho(destino)) { System.out.println("Os territórios informados devem fazer fronteira um com o outro."); System.out.println(); System.out.println("1 -Cancelar"); System.out.println("9 - Sair do Jogo"); System.out.print("OO-DD-E - Para mover E tropas de OO para DD. (ex. BA-PE-5): "); continue; } origem.deslocarExercitos(exercitos); destino.receberExercitos(exercitos); exercitoDeslocado = true; } while (!exercitoDeslocado); } }
[ "kelvin.ocb@gmail.com" ]
kelvin.ocb@gmail.com
60d668c76919b8c9b221b9b1c22b2464afcb5413
a1841fd6d44d029289f35c1fdcd1d2033dfc0da5
/src/test/java/com/github/pagehelper/util/MybatisReasonableHelper.java
eb8288d65003dce4fbbc203c05b570f74046619a
[ "MIT" ]
permissive
chenpeng520/Mybatis-PageHelper
331cae6a5f93595e7ac8736236e5820b352497bd
bafe9d3e54b031f3afbcc1c2e37f71627daee3e5
refs/heads/master
2021-01-14T12:26:29.774285
2015-09-10T14:12:33
2015-09-10T14:12:33
44,006,207
2
0
null
2015-10-10T10:28:07
2015-10-10T10:28:07
null
UTF-8
Java
false
false
2,997
java
/* * The MIT License (MIT) * * Copyright (c) 2014 abel533@gmail.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package com.github.pagehelper.util; import org.apache.ibatis.io.Resources; import org.apache.ibatis.jdbc.ScriptRunner; import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import java.io.IOException; import java.io.Reader; import java.sql.Connection; /** * Description: MybatisHelper * Author: liuzh * Update: liuzh(2014-06-06 13:33) */ public class MybatisReasonableHelper { private static SqlSessionFactory sqlSessionFactory; static { try { //创建SqlSessionFactory Reader reader = Resources.getResourceAsReader(TestUtil.getXmlPath() + "/mybatis-config-reasonable.xml"); sqlSessionFactory = new SqlSessionFactoryBuilder().build(reader); reader.close(); if (TestUtil.getXmlPath().equalsIgnoreCase("hsqldb")) { //创建数据库 SqlSession session = null; try { session = sqlSessionFactory.openSession(); Connection conn = session.getConnection(); reader = Resources.getResourceAsReader(TestUtil.getXmlPath() + "/" + TestUtil.getXmlPath() + ".sql"); ScriptRunner runner = new ScriptRunner(conn); runner.setLogWriter(null); runner.runScript(reader); reader.close(); } finally { if (session != null) { session.close(); } } } } catch (IOException e) { e.printStackTrace(); } } /** * 获取Session * @return */ public static SqlSession getSqlSession(){ return sqlSessionFactory.openSession(); } }
[ "abel533@gmail.com" ]
abel533@gmail.com
6af348a8312d359c86371039b174f2035aea219f
42c96488d08f3b119b92f694ac6f7c86162e5b39
/clients/google-api-services-cloudasset/v1p7beta1/1.31.0/com/google/api/services/cloudasset/v1p7beta1/model/GoogleIdentityAccesscontextmanagerV1AccessPolicy.java
1aa0acc750fa7236bd13cc66b8e8b446b4d69a2c
[ "Apache-2.0" ]
permissive
renovate-bot/google-api-java-client-services
acd9b68b4ad2f82c106a05602e2436890eeb4d15
61d45dfb055add1aad92dc5b7301a0ac8d1541a6
refs/heads/master
2023-08-26T03:20:18.328707
2021-09-28T11:12:09
2021-09-28T11:12:09
189,470,528
2
0
Apache-2.0
2019-05-30T19:26:40
2019-05-30T19:26:39
null
UTF-8
Java
false
false
5,643
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /* * This code was generated by https://github.com/googleapis/google-api-java-client-services/ * Modify at your own risk. */ package com.google.api.services.cloudasset.v1p7beta1.model; /** * `AccessPolicy` is a container for `AccessLevels` (which define the necessary attributes to use * Google Cloud services) and `ServicePerimeters` (which define regions of services able to freely * pass data within a perimeter). An access policy is globally visible within an organization, and * the restrictions it specifies apply to all projects within an organization. * * <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is * transmitted over HTTP when working with the Cloud Asset API. For a detailed explanation see: * <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a> * </p> * * @author Google, Inc. */ @SuppressWarnings("javadoc") public final class GoogleIdentityAccesscontextmanagerV1AccessPolicy extends com.google.api.client.json.GenericJson { /** * Output only. An opaque identifier for the current version of the `AccessPolicy`. This will * always be a strongly validated etag, meaning that two Access Polices will be identical if and * only if their etags are identical. Clients should not expect this to be in any specific format. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String etag; /** * Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}` * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String name; /** * Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently * immutable once created. Format: `organizations/{organization_id}` * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String parent; /** * Required. Human readable title. Does not affect behavior. * The value may be {@code null}. */ @com.google.api.client.util.Key private java.lang.String title; /** * Output only. An opaque identifier for the current version of the `AccessPolicy`. This will * always be a strongly validated etag, meaning that two Access Polices will be identical if and * only if their etags are identical. Clients should not expect this to be in any specific format. * @return value or {@code null} for none */ public java.lang.String getEtag() { return etag; } /** * Output only. An opaque identifier for the current version of the `AccessPolicy`. This will * always be a strongly validated etag, meaning that two Access Polices will be identical if and * only if their etags are identical. Clients should not expect this to be in any specific format. * @param etag etag or {@code null} for none */ public GoogleIdentityAccesscontextmanagerV1AccessPolicy setEtag(java.lang.String etag) { this.etag = etag; return this; } /** * Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}` * @return value or {@code null} for none */ public java.lang.String getName() { return name; } /** * Output only. Resource name of the `AccessPolicy`. Format: `accessPolicies/{access_policy}` * @param name name or {@code null} for none */ public GoogleIdentityAccesscontextmanagerV1AccessPolicy setName(java.lang.String name) { this.name = name; return this; } /** * Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently * immutable once created. Format: `organizations/{organization_id}` * @return value or {@code null} for none */ public java.lang.String getParent() { return parent; } /** * Required. The parent of this `AccessPolicy` in the Cloud Resource Hierarchy. Currently * immutable once created. Format: `organizations/{organization_id}` * @param parent parent or {@code null} for none */ public GoogleIdentityAccesscontextmanagerV1AccessPolicy setParent(java.lang.String parent) { this.parent = parent; return this; } /** * Required. Human readable title. Does not affect behavior. * @return value or {@code null} for none */ public java.lang.String getTitle() { return title; } /** * Required. Human readable title. Does not affect behavior. * @param title title or {@code null} for none */ public GoogleIdentityAccesscontextmanagerV1AccessPolicy setTitle(java.lang.String title) { this.title = title; return this; } @Override public GoogleIdentityAccesscontextmanagerV1AccessPolicy set(String fieldName, Object value) { return (GoogleIdentityAccesscontextmanagerV1AccessPolicy) super.set(fieldName, value); } @Override public GoogleIdentityAccesscontextmanagerV1AccessPolicy clone() { return (GoogleIdentityAccesscontextmanagerV1AccessPolicy) super.clone(); } }
[ "noreply@github.com" ]
renovate-bot.noreply@github.com
fb9f8f6bfb14512e9067199f78ea9e8ad9afaf4d
5d76b555a3614ab0f156bcad357e45c94d121e2d
/src-v2/com/google/android/gms/analytics/Logger.java
c44361049adc9f9f322cc283ae6eb3a15c123467
[]
no_license
BinSlashBash/xcrumby
8e09282387e2e82d12957d22fa1bb0322f6e6227
5b8b1cc8537ae1cfb59448d37b6efca01dded347
refs/heads/master
2016-09-01T05:58:46.144411
2016-02-15T13:23:25
2016-02-15T13:23:25
51,755,603
5
1
null
null
null
null
UTF-8
Java
false
false
585
java
/* * Decompiled with CFR 0_110. */ package com.google.android.gms.analytics; public interface Logger { public void error(Exception var1); public void error(String var1); public int getLogLevel(); public void info(String var1); public void setLogLevel(int var1); public void verbose(String var1); public void warn(String var1); public static class LogLevel { public static final int ERROR = 3; public static final int INFO = 1; public static final int VERBOSE = 0; public static final int WARNING = 2; } }
[ "binslashbash@otaking.top" ]
binslashbash@otaking.top
3963f8e44955a47437bd97e7aead277c951f0818
7f3e28f5d60a3a9089f2cd9a025d2abb2943137f
/src/test/java/base/BaseTests.java
4364f4f869b8c5017ec69958cd0bd4398dd2f26a
[ "MIT" ]
permissive
IoanaAndreeaAncuta/ioanaautomationtrainig
0e2007a61cbf5018872c90d2263671c6de3261af
f8c50ca36c7a2ef00cf05827496f38041a92992f
refs/heads/master
2023-05-14T15:20:12.675524
2020-04-23T18:54:13
2020-04-23T18:54:13
252,453,378
0
0
MIT
2023-05-09T18:25:42
2020-04-02T12:48:01
Java
UTF-8
Java
false
false
1,934
java
package base; import com.google.common.io.Files; import org.openqa.selenium.*; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeOptions; import org.testng.ITestResult; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; import pages.HomePage; import utils.WindowManager; import java.io.File; import java.io.IOException; public class BaseTests { private WebDriver driver; protected HomePage homePage; @BeforeClass public void setUp() { System.setProperty("webdriver.chrome.driver", "C:\\Automation Project\\ioanaautomationtrainig\\resources\\chromedriver.exe"); driver = new ChromeDriver(); driver.get("https://the-internet.herokuapp.com/"); homePage = new HomePage(driver); } @AfterClass public void tearDown() { driver.quit(); } @AfterMethod public void recordFailure(ITestResult result) { if (ITestResult.FAILURE == result.getStatus()) { var camera = (TakesScreenshot) driver; File screenshot = camera.getScreenshotAs(OutputType.FILE); try { Files.move(screenshot, new File("resources/screenshots/" + result.getName() + ".png")); } catch (IOException e) { e.printStackTrace(); } } } public WindowManager getWindowManager() { return new WindowManager(driver); } private ChromeOptions getChromeOptions() { ChromeOptions options = new ChromeOptions(); options.addArguments("disable-infobars"); //options.setHeadless(true); return options; } private void setCookie() { Cookie cookie = new Cookie.Builder("tau", "123") .domain("the-internet.herokuapp.com") .build(); driver.manage().addCookie(cookie); } }
[ "33329050+IoanaAndreeaAncuta@users.noreply.github.com" ]
33329050+IoanaAndreeaAncuta@users.noreply.github.com
c0c6d4945810b667c7225ab5dd79f7ee0c81994b
5f945c318eaa151e24d0d6169de4d654ab626601
/nifi-ngsi-bundle/nifi-ngsi-processors/src/main/java/org/apache/nifi/processors/ngsi/ngsi/backends/ckan/vocabularies/Availability.java
cc01fc2c183cb30dea23e3c17f98e80387c1beb7
[ "Apache-2.0", "Zlib", "BSD-3-Clause", "MIT" ]
permissive
ging/fiware-draco
545955a9ffb218d6e36c86ed749358a23709b4e0
a4662f421b88e6d68b82c68c73679ad4e29540f4
refs/heads/master
2023-08-07T23:34:33.524301
2022-09-05T11:51:37
2022-09-05T11:51:37
158,748,708
18
29
Apache-2.0
2023-08-03T14:17:13
2018-11-22T20:47:12
Java
UTF-8
Java
false
false
1,151
java
package org.apache.nifi.processors.ngsi.ngsi.backends.ckan.vocabularies; import java.util.Arrays; import java.util.Set; import java.util.TreeSet; /** * DCAT-AP v2 distribution availability. * Taken from * https://raw.githubusercontent.com/SEMICeu/DCAT-AP/2.1.0-draft/releases/2.1.0/dcat-ap_2.1.0.rdf */ public class Availability { public static final String TEMPORARY = "http://data.europa.eu/r5r/availability/temporary"; public static final String EXPERIMENTAL = "http://data.europa.eu/r5r/availability/experimental"; public static final String AVAILABLE = "http://data.europa.eu/r5r/availability/available"; public static final String STABLE = "http://data.europa.eu/r5r/availability/stable"; /** * Constructor. It is private since utility classes should not have public or * default constructor */ private Availability() { } // Availability public static Set<String> getAvailaibilityNames() { Set<String> availabilityNames = new TreeSet<>(Arrays.asList(TEMPORARY, EXPERIMENTAL, AVAILABLE, STABLE)); return availabilityNames; } // getAvailabilityNames } // Availability
[ "javier.conde.diaz@upm.es" ]
javier.conde.diaz@upm.es
fc2cded80083e1705bd7a1989f6ed02e76edd4a6
961ce92e866817b2040a6981cc6f6726eef4afab
/src/main/java/sguest/millenairejei/util/UiHelper.java
0b890464644439040a101f766a843f199776c8c7
[ "MIT" ]
permissive
meespl/millenaire-jei
e63b5076220fe3e0ec2399dc8f906c355253569b
2ab2bab48d4785755aaad81ca69a1ab62f77400c
refs/heads/main
2022-12-30T15:41:51.011247
2020-10-18T23:59:39
2020-10-18T23:59:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,608
java
package sguest.millenairejei.util; import mezz.jei.api.IGuiHelper; import mezz.jei.api.gui.IDrawableAnimated; import mezz.jei.api.gui.IDrawable; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import sguest.millenairejei.jei.DrawableWithLabel; import sguest.millenairejei.recipes.IconWithLabel; public class UiHelper { public static final ResourceLocation GUI_TEXTURE = new ResourceLocation("jei", "textures/gui/gui_vanilla.png"); public static IDrawable staticArrow(IGuiHelper guiHelper) { return guiHelper.createDrawable(GUI_TEXTURE, 25, 133, 24, 17); } public static IDrawable animatedArrow(IGuiHelper guiHelper, int ticks) { return guiHelper.drawableBuilder(GUI_TEXTURE, 82, 128, 24, 17) .buildAnimated(ticks, IDrawableAnimated.StartDirection.LEFT, false); } public static DrawableWithLabel toDrawable(IconWithLabel iconWithLabel, IGuiHelper guiHelper) { ItemStack itemStack = iconWithLabel.getIcon(); IDrawable icon; if(itemStack == null) { icon = guiHelper.createBlankDrawable(16, 16); } else { icon = guiHelper.createDrawableIngredient(itemStack); } return new DrawableWithLabel(iconWithLabel.getLabel(), icon); } public static void renderIconWithLabel( Minecraft minecraft, int x, int y, DrawableWithLabel iconWithLabel) { iconWithLabel.getIcon().draw(minecraft, x, y); minecraft.fontRenderer.drawString(iconWithLabel.getLabel(), x + 20, y + 6, 0xFFFFFFFF); } }
[ "spencer.b.guest@gmail.com" ]
spencer.b.guest@gmail.com
3d446f153da67436cd92fdca515ba023eb805b61
1c8c0f69da2ad02c73056737c35c458452c30e20
/src/ga/dryco/redditjerk/controllers/RedditThread.java
4f74cb1360ba831e23342e2f569c742d4ab94aea
[]
no_license
reserad/Varys
3056a9a7178a080cf92b9e9d3a12d4726d133e4d
062a939df42bd3ad0c1b35f4c76436932f307698
refs/heads/master
2020-12-25T14:49:03.001883
2016-08-18T19:31:43
2016-08-18T19:31:43
62,254,705
0
0
null
null
null
null
UTF-8
Java
false
false
2,803
java
package ga.dryco.redditjerk.controllers; import ga.dryco.redditjerk.Reddit; import ga.dryco.redditjerk.RedditApi; import ga.dryco.redditjerk.Sorting; import ga.dryco.redditjerk.datamodels.More; import ga.dryco.redditjerk.datamodels.T1; import ga.dryco.redditjerk.datamodels.T1Listing; import ga.dryco.redditjerk.datamodels.RedditThreadData; import java.util.ArrayList; import java.util.List; public class RedditThread extends RedditThreadData { private Reddit rApi = RedditApi.getRedditInstance(); private List<Comment> flatComments; private boolean alreadyFlattened = false; private boolean moreCommentsAlreadyFetched = false; private boolean fetchMoreComments = false; public boolean isFetchMoreComments() { return fetchMoreComments; } public void fetchMoreComments(boolean fetchMoreComments) { this.fetchMoreComments = fetchMoreComments; } public List<Comment> getFlatComments() { if(!this.alreadyFlattened | this.fetchMoreComments & !this.moreCommentsAlreadyFetched){ this.flatComments = new ArrayList<>(); this.flattenComments(super.getComments()); this.alreadyFlattened = true; if(this.fetchMoreComments) this.moreCommentsAlreadyFetched = true; } return flatComments; } /** * Flatten the nested reply tree with recursion * also fetch the MoreComments * @param listing T1Listing */ private void flattenComments(T1Listing listing){ if(listing != null) { if(this.fetchMoreComments) { //this.moreObjects.addAll(listing.getData().getMoreChildrenComments()); for (More mor : listing.getData().getMoreChildren()) { Integer MAX_ITEMS_PER_QUERY = 20; List<List<String>> listOfIdLists = new ArrayList<>(); //dividing the list into lists of 20 items each for (int i = 0; i <= mor.getData().getChildren().size(); i += MAX_ITEMS_PER_QUERY) { listOfIdLists.add(mor.getData().getChildren().subList(i, Math.min(i + MAX_ITEMS_PER_QUERY, mor.getData().getChildren().size()))); } for (List<String> idLst : listOfIdLists) { this.flattenComments(rApi.getMoreChildren(idLst, super.getSubmissionPost().getData().getName(), Sorting.NEW).getMoreChildrenComments()); } } } for (T1 comm : listing.getData().getChildren()) { flatComments.add(comm.getData()); if (comm.getData().getReplies() != null) { this.flattenComments(comm.getData().getReplies()); } } } } }
[ "reser13@gmail.com" ]
reser13@gmail.com
bac7a464156b493232dc76fd1825d5899558dc52
c6401d3c7bff1e8cd831c3316e4d7fbb1c15d70d
/ArduinoSimulator/src/test/java/pt/isec/deis/mis/arduinosimulator/instructions/ELPMTest.java
edc7ee8039ae8d1754fac73536a5465c0e39d26f
[]
no_license
pafgoncalves/ArduinoSimulator
0e09b726f9cdf34b91f979cb1bd0991fce65ff20
51a11f80bf4b598464bdfda7782f24bd4f457422
refs/heads/master
2022-02-08T20:52:44.887720
2021-08-01T10:13:07
2021-08-01T10:13:07
248,605,862
1
0
null
2022-01-21T23:41:53
2020-03-19T21:11:36
Java
UTF-8
Java
false
false
3,055
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 pt.isec.deis.mis.arduinosimulator.instructions; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import static org.junit.Assert.*; import pt.isec.deis.mis.arduinosimulator.ATmega328P; import pt.isec.deis.mis.arduinosimulator.CPU; import pt.isec.deis.mis.arduinosimulator.InstructionParams; import pt.isec.deis.mis.arduinosimulator.NotSupportedInstructionException; /** * * @author pafgoncalves@ipc.pt */ public class ELPMTest { static CPU cpu = null; static ELPM instance = null; public ELPMTest() { } @BeforeClass public static void setUpClass() { cpu = new ATmega328P(); instance = new ELPM(); } @AfterClass public static void tearDownClass() { } @Before public void setUp() { cpu.reset(); } @After public void tearDown() { } /** * Test of execute method, of class LPM. */ @Test(expected = NotSupportedInstructionException.class) public void testELPM() throws Exception { cpu.getFLASH().set(0, 0x5AA5); cpu.getSRAM().setRegisterZ(0); //execute instance.execute(cpu, 0, 0); //validar o R0 assertEquals(0xA5, cpu.getSRAM().getRegister(0)); //validar se o Z ficou igual assertEquals(0, cpu.getSRAM().getRegisterZ()); } @Test(expected = NotSupportedInstructionException.class) public void testELPM2() throws Exception { cpu.getFLASH().set(0, 0x5AA5); cpu.getSRAM().setRegisterZ(1); //execute instance.execute(cpu, 0, 0); //validar o R0 assertEquals(0x5A, cpu.getSRAM().getRegister(0)); //validar se o Z ficou igual assertEquals(1, cpu.getSRAM().getRegisterZ()); } @Test(expected = NotSupportedInstructionException.class) public void testELPM3() throws Exception { int rdAddr = 1; cpu.getFLASH().set(0, 0x5AA5); cpu.getSRAM().setRegisterZ(rdAddr); //execute instance.execute(cpu, rdAddr, 0); //validar o R0 assertEquals(0x5A, cpu.getSRAM().getRegister(rdAddr)); //validar se o Z ficou igual assertEquals(rdAddr, cpu.getSRAM().getRegisterZ()); } @Test(expected = NotSupportedInstructionException.class) public void testELPM4() throws Exception { int rdAddr = 1; cpu.getFLASH().set(0, 0x5AA5); cpu.getSRAM().setRegisterZ(rdAddr); //execute instance.execute(cpu, rdAddr, 1); //validar o R0 assertEquals(0x5A, cpu.getSRAM().getRegister(rdAddr)); //validar se o Z ficou igual assertEquals(rdAddr+1, cpu.getSRAM().getRegisterZ()); } }
[ "paf.goncalves@gmail.com" ]
paf.goncalves@gmail.com
c59d82f5cd33325672d103b4eee127838ef61ca9
9163c4a8a811e86d9a946e9951a3db32f780e735
/sqaLearningMaven/src/main/java/static_example/Fruit.java
bc85843cd74ab2217ed1a6b59349dcc0bfb9216d
[]
no_license
NedimT/sqa_repo
378abc23865815197ebada3464d2ee9ee879237e
37cb35f14b384d0565a4546a97b276ad8cac12a7
refs/heads/master
2020-04-06T05:02:45.502134
2015-07-23T01:45:47
2015-07-23T01:45:47
29,897,626
0
0
null
null
null
null
UTF-8
Java
false
false
953
java
package static_example; public class Fruit { public String name; public String taste; public String color; public Fruit(){ name = "apple"; taste = "sweet"; color = "red"; } public Fruit(String name){ this(name,null,null); } public Fruit(String name, String taste){ this(name,taste,null); this.name = name; this.taste = taste; } public Fruit(String name, String taste, String color){ //this(name,taste,color); this.name = name; this.taste = taste; this.color = color; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTaste() { return taste; } public void setTaste(String taste) { this.taste = taste; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } }
[ "nedim@172.16.42.6" ]
nedim@172.16.42.6
1a727c25104b12571e3589c3c5979c7ac19eb041
f812f1c3a916d46b61fd92d39db205a6295d9c0c
/polypay-frame/polypay-view/src/main/java/com/polypay/platform/controller/MerchantAccountInfoController.java
d3b72f08a2141fc8898e01e14d2d2582e593fd9e
[]
no_license
mwjmwj/polypay
cdba43b13c90e12caab29153ee463e24195b754c
2d8c507f992fad64489d37860279d93d397eef48
refs/heads/master
2022-12-21T03:10:28.489634
2020-07-27T14:09:10
2020-07-27T14:09:10
164,193,727
1
0
null
2022-12-16T10:50:51
2019-01-05T07:47:30
JavaScript
UTF-8
Java
false
false
2,117
java
package com.polypay.platform.controller; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.polypay.platform.bean.MerchantAccountInfo; import com.polypay.platform.consts.MerchantHelpPayConsts; import com.polypay.platform.exception.ServiceException; import com.polypay.platform.service.IMerchantAccountInfoService; import com.polypay.platform.utils.MerchantUtils; import com.polypay.platform.vo.MerchantAccountInfoVO; @Controller public class MerchantAccountInfoController { @Autowired private IMerchantAccountInfoService merchantAccountInfoService; @RequestMapping("merchant/accountinfo") public String getMerchantAccountInfo(Map<String, Object> result) throws ServiceException { MerchantAccountInfo merchant = MerchantUtils.getMerchant(); MerchantAccountInfoVO param = new MerchantAccountInfoVO(); param.setUuid(merchant.getUuid()); MerchantAccountInfo merchantInfoByUUID = merchantAccountInfoService.getMerchantInfoByUUID(param); result.put("merchantAccount", merchantInfoByUUID); return "admin/merchantaccountinfo"; } @RequestMapping("merchant/accountinfo/update") @ResponseBody public String updateMerchantAccountInfo(MerchantAccountInfo uMerchant) throws ServiceException { MerchantAccountInfo merchant = MerchantUtils.getMerchant(); uMerchant.setId(merchant.getId()); if ("on".equals(uMerchant.getHelppayoff())) { uMerchant.setHelppayStatus(MerchantHelpPayConsts.OPEN_HELP_PAY); } else { uMerchant.setHelppayStatus(MerchantHelpPayConsts.CLOSE_HELP_PAY); } MerchantAccountInfo updateBean = new MerchantAccountInfo(); updateBean.setHelppayStatus(uMerchant.getHelppayStatus()); updateBean.setPassWord(uMerchant.getPassWord()); updateBean.setAccountName(uMerchant.getAccountName()); merchantAccountInfoService.updateByPrimaryKeySelective(uMerchant); return "success"; } }
[ "2640800629@qq.com" ]
2640800629@qq.com
b04f45647e70d43d338e22d80e819e736870e8e1
3b856006c726b285d4335ab70eda080b1c4ccc1a
/src/main/java/uk/gov/digital/ho/pttg/audit/AuditClient.java
177a3068ec0a14ddca28238341d1b10863bfc674
[ "MIT" ]
permissive
Supertechy/pttgdemo
0afd052d4f04afed85c8f93e2693aa606623947e
44a5aa1835f37265920422208090db479c0a9c65
refs/heads/master
2020-04-12T10:47:52.917783
2018-12-19T09:19:07
2018-12-19T09:19:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,788
java
package uk.gov.digital.ho.pttg.audit; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.retry.support.RetryTemplate; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; import uk.gov.digital.ho.pttg.api.RequestHeaderData; import uk.gov.digital.ho.pttg.application.retry.RetryTemplateBuilder; import java.time.Clock; import java.time.LocalDateTime; import java.util.UUID; import static net.logstash.logback.argument.StructuredArguments.value; import static org.springframework.http.HttpHeaders.AUTHORIZATION; import static org.springframework.http.HttpMethod.POST; import static org.springframework.http.MediaType.APPLICATION_JSON; import static uk.gov.digital.ho.pttg.application.LogEvent.*; @Component @Slf4j public class AuditClient { private final Clock clock; private final RestTemplate restTemplate; private final String auditEndpoint; private final RequestHeaderData requestHeaderData; private final ObjectMapper mapper; private final RetryTemplate retryTemplate; private final int maxCallAttempts; public AuditClient(Clock clock, @Qualifier("auditRestTemplate") RestTemplate restTemplate, RequestHeaderData requestHeaderData, @Value("${pttg.audit.endpoint}") String auditEndpoint, ObjectMapper mapper, @Value("#{${audit.service.retry.attempts}}") int maxCallAttempts, @Value("#{${audit.service.retry.delay}}") int retryDelay) { this.clock = clock; this.restTemplate = restTemplate; this.requestHeaderData = requestHeaderData; this.auditEndpoint = auditEndpoint; this.mapper = mapper; this.maxCallAttempts = maxCallAttempts; this.retryTemplate = new RetryTemplateBuilder(this.maxCallAttempts) .withBackOffPeriod(retryDelay) .retryHttpServerErrors() .build(); } public void add(AuditEventType eventType, UUID eventId, AuditIndividualData auditData) { log.debug("POST data for {} to audit service", eventId); try { AuditableData auditableData = generateAuditableData(eventType, eventId, auditData); dispatchAuditableData(auditableData); log.debug("data POSTed to audit service"); } catch (JsonProcessingException e) { log.error("Failed to create json representation of audit data", value(EVENT, HMRC_AUDIT_FAILURE)); } } void dispatchAuditableData(AuditableData auditableData) { try { retryTemplate.execute(context -> { if (context.getRetryCount() > 0) { log.info("Retrying audit attempt {} of {}", context.getRetryCount(), maxCallAttempts - 1, value(EVENT, auditableData.getEventType())); } return restTemplate.exchange(auditEndpoint, POST, toEntity(auditableData), Void.class); }); } catch (Exception e) { log.error("Failed to audit {} after retries", auditableData.getEventType(), value(EVENT, HMRC_AUDIT_FAILURE)); } } private AuditableData generateAuditableData(AuditEventType eventType, UUID eventId, AuditIndividualData auditData) throws JsonProcessingException { return new AuditableData(eventId.toString(), LocalDateTime.now(clock), requestHeaderData.sessionId(), requestHeaderData.correlationId(), requestHeaderData.userId(), requestHeaderData.deploymentName(), requestHeaderData.deploymentNamespace(), eventType, mapper.writeValueAsString(auditData)); } private HttpEntity<AuditableData> toEntity(AuditableData auditableData) { return new HttpEntity<>(auditableData, generateRestHeaders()); } private HttpHeaders generateRestHeaders() { HttpHeaders headers = new HttpHeaders(); headers.add(AUTHORIZATION, requestHeaderData.auditBasicAuth()); headers.setContentType(APPLICATION_JSON); headers.add(RequestHeaderData.SESSION_ID_HEADER, requestHeaderData.sessionId()); headers.add(RequestHeaderData.CORRELATION_ID_HEADER, requestHeaderData.correlationId()); headers.add(RequestHeaderData.USER_ID_HEADER, requestHeaderData.userId()); return headers; } }
[ "lisa.crutchley@bjss.com" ]
lisa.crutchley@bjss.com
f8abf74cec61f897424a0f331ec3ca740418a8d5
4dc7cea71a729d887cfa5f0b8272d1287f2cebab
/src/Collection/Llist1.java
27b8a64737d6b34b9def2b7d8963e6b8cfd82683
[]
no_license
Srisivasurya/Srisivasurya
cdb074e67cdc146fe78dabb176b62ed248495549
6d1c63ca9377a6244e6cd7031827fa9ce7ddb37f
refs/heads/main
2023-07-10T06:15:21.788868
2021-08-18T07:53:53
2021-08-18T07:53:53
366,100,817
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package Collection; import java.util.LinkedList; class Llist1 { public static void main(String[] args) { LinkedList<String> l_list = new LinkedList<String>(); l_list.add("Ready"); l_list.add("Steady"); l_list.add("Go"); l_list.add("Winner"); System.out.println("The linked list: " + l_list); } }
[ "srisivasurya777@gmail.com" ]
srisivasurya777@gmail.com
6ae1f47a9831b87b6e592c1acfbf559658bfd80c
ffec7bfadc64b9a51686ceeed8cc2ee5223e99f0
/expositor/src/main/java/co/com/ceiba/expositor/entity/Video.java
1e6419d58b1bcc7d1078871ad3a375e728524c5e
[]
no_license
PedroHincapie/CircuitBreaker
88698c46693b70392bac1ee3e47b987eab9440fa
058066588067ba11f732169e86456a19c3e00f84
refs/heads/master
2020-06-04T09:32:56.521141
2019-07-25T16:32:25
2019-07-25T16:32:25
191,968,102
0
0
null
null
null
null
UTF-8
Java
false
false
558
java
package co.com.ceiba.expositor.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import lombok.Data; @Entity @Data @Table(name= "video") public class Video { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String nombre; private Long usuario; public Video() { } public Video(String nombrePelicula, Long idUsuario) { this.nombre = nombrePelicula; this.usuario = idUsuario; } }
[ "pedandniv@gmail.com" ]
pedandniv@gmail.com
e04463ae24d0b8069bbe613de89882bc47f08ba4
1490157c09f9cdef8bf7abdfac10732c6178236d
/iBankRemittanceWeb/src/java/ibank/remittance/user/model/Login.java
1fb0861c78ffc50a400d8d38efc195c5f8a49a20
[]
no_license
maduranga-lka/remittance-system-for-bank
39d547f65954da4c6fc1c9e1f21276d70a2be5b5
e02a00e10dd709259098f3d300a7ec833a272dc8
refs/heads/master
2022-07-01T18:17:41.596706
2020-01-12T13:37:21
2020-01-12T13:37:21
233,396,363
0
0
null
2022-06-21T02:37:35
2020-01-12T13:24:56
Java
UTF-8
Java
false
false
1,010
java
package ibank.remittance.user.model; /** * @author Maduranga */ public class Login { public Login(String userRef, boolean valid) { this.userRef = userRef; this.valid = valid; } public Login(String userRef, String hashedPassword, boolean valid) { this.userRef = userRef; this.hashedPassword = hashedPassword; this.valid = valid; } private String userRef; private String hashedPassword; private boolean valid; public String getUserRef() { return userRef; } public void setUserRef(String userRef) { this.userRef = userRef; } public boolean isValid() { return valid; } public void setValid(boolean valid) { this.valid = valid; } public String getHashedPassword() { return hashedPassword; } public void setHashedPassword(String hashedPassword) { this.hashedPassword = hashedPassword; } }
[ "noreply@github.com" ]
maduranga-lka.noreply@github.com
09eafc4aa597137c98c5738895480d825723d4cf
8b79942370d49c63eb6cf9c50eae811f6125232f
/app/src/main/java/com/example/catatanharian/SplashActivity.java
77d84ca4baf3728d8b58bfd3bbac2aa3bf7eb6ba
[]
no_license
nevintrian/CatatanHarian
f0a3e6a0e4aa01838c321993687176b33846cb8e
17478a9873f6dfea17abe5f4faaf207ab44b739d
refs/heads/master
2023-07-15T02:31:53.684720
2021-08-19T04:23:37
2021-08-19T04:23:37
395,605,964
0
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.example.catatanharian; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; public class SplashActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); if(getSupportActionBar() != null){ getSupportActionBar().hide(); } new Handler().postDelayed(new Runnable() { @Override public void run() { startActivity(new Intent(getApplicationContext(), MainActivity.class)); finish(); } },2000); } }
[ "55471127+nevintrian@users.noreply.github.com" ]
55471127+nevintrian@users.noreply.github.com
3524608e0a73931c615afbb5acd248957871ce36
194da447ff00890561f49c1b5584d4d850d89b0b
/app/src/main/java/sds/auto/plate/App.java
a1ac10239ae05e7ba5001a2c5f9e78caaee5749f
[]
no_license
SilinDS/anp
760d4d75b327d85d1f8c4c5bcc3feff920daee7e
d1432738219de7756a5804466771d8b189effced
refs/heads/master
2021-01-11T20:51:38.715493
2017-01-17T07:37:01
2017-01-17T07:37:01
79,199,682
0
1
null
null
null
null
UTF-8
Java
false
false
8,235
java
package sds.auto.plate; import android.app.Activity; import android.app.Application; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Environment; import android.util.Base64; import android.util.Log; import org.solovyev.android.checkout.Billing; import org.solovyev.android.checkout.Cache; import org.solovyev.android.checkout.Checkout; import org.solovyev.android.checkout.Inventory; import org.solovyev.android.checkout.RobotmediaDatabase; import org.solovyev.android.checkout.RobotmediaInventory; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.Executor; import javax.annotation.Nonnull; import javax.annotation.Nullable; import retrofit2.Retrofit; import sds.auto.plate.retrofit.converter.MyJsonConverter; import sds.auto.plate.retrofit.service.UslugaInterface; import sds.auto.plate.retrofit.service.UslugaStInterface; import static android.content.Intent.ACTION_VIEW; public class App extends Application { // private static MyPlateInterface myPlateApi; private static UslugaInterface UslugaApi; private static UslugaStInterface UslugaStApi; private static Retrofit retrofit3qr; // private Retrofit retrofitLibsite, // retrofitUsluga,retrofitUslugaSt, retrofitAnpPlate, retrofitAnpImage, // retrofitGibdd; @Override public void onCreate() { super.onCreate(); File sdPath = Environment.getExternalStorageDirectory(); final File folder = new File(sdPath.getAbsolutePath() + "/" + getString(R.string.app_name)); if (!folder.exists()) { folder.mkdir(); } retrofit3qr = new Retrofit.Builder() .baseUrl("http://3qr.ru/") //Базовая часть адреса // .addConverterFactory(GsonConverterFactory.create()) //Конвертер, необходимый для преобразования JSON'а в объекты .addConverterFactory(MyJsonConverter.create()) //Конвертер, необходимый для преобразования JSON'а в объекты .build(); // myPlateApi = retrofit3qr.create(MyPlateInterface.class); //Создаем объект, при помощи которого будем выполнять запросы // retrofitUslugaSt = new Retrofit.Builder() // .baseUrl("http://avto-yslyga.ru/") //Базовая часть адреса // .addConverterFactory(WebdkConvertor.create()) //Конвертер, необходимый для преобразования JSON'а в объекты // .client(okHttpClient) // .build(); // UslugaStApi = retrofitUslugaSt.create(UslugaStInterface.class); //Создаем объект, при помощи которого будем выполнять запросы // retrofitUsluga = new Retrofit.Builder() // .baseUrl("http://avto-yslyga.ru/") //Базовая часть адреса // .addConverterFactory(UslugaConvertor.create()) //Конвертер, необходимый для преобразования JSON'а в объекты // .client(okHttpClient) // .build(); // UslugaApi = retrofitUsluga.create(UslugaInterface.class); //Создаем объект, при помощи которого будем выполнять запросы } public static Retrofit getMyApi() { return retrofit3qr; } @Nonnull public static final List<String> IN_APPS = new ArrayList<>(); @Nonnull public static final List<String> SUBSCRIPTIONS = new ArrayList<>(); @Nonnull static final String MAIL = "sds3qr@gmail.com"; @Nonnull private static Application instance; static { IN_APPS.addAll(Arrays.asList("sds.testpay", "sds.auto.vin", "sds.auto.gibdd")); SUBSCRIPTIONS.add("sub_01"); } /** * For better performance billing class should be used as singleton */ @Nonnull private final Billing billing = new Billing(this, new Billing.DefaultConfiguration() { @Nonnull @Override public String getPublicKey() { // Note that this is not plain public key but public key encoded with CheckoutApplication.x() method where // key = MAIL. As symmetric ciphering is used in CheckoutApplication.x() the same method is used for both // ciphering and deciphering. Additionally result of the ciphering is converted to Base64 string => for // deciphering with need to convert it back. Generally, x(fromBase64(toBase64(x(PK, salt))), salt) == PK // To cipher use CheckoutApplication.toX(), to decipher - CheckoutApplication.fromX(). // Note that you also can use plain public key and just write `return "Your public key"` but this // is not recommended by Google, see http://developer.android.com/google/play/billing/billing_best_practices.html#key // Also consider using your own ciphering/deciphering algorithm. final String s = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyST0bTIos6QCfPI8KPKAvd79OtF6sERZQVyINZwPjqKh2aQlAgEwk4x7xyuOOqHgfaKFjH7Erlxm/lbZJmyPPf2b7infdzJDaL8AP7KB3avdk4q3CFyMPY4ItJgg141yX5Km/mWw4JybPRVpkPC4EMm4NI56tQZbqYqpBAGKdxrk+d+ADIVyJjZuHMRLuuWbx3ZtW9itu15sFikEssCIvEs25i4nvL2BSoD1ueSYsVyDkklUuDa9W/cEJL+4A+94zgUx8zd4STmAzNqjkuz8b6UXz5uWFGSabGi+Ke6iLN/w9vSg05NLQKo0CrMb3bT3/QyHBttClXtJFwwzKbSeYQIDAQAB"; return s; //fromX(s, MAIL); } @Nullable @Override public Cache getCache() { return Billing.newCache(); } @Nullable @Override public Inventory getFallbackInventory(@Nonnull Checkout checkout, @Nonnull Executor onLoadExecutor) { if (RobotmediaDatabase.exists(billing.getContext())) { return new RobotmediaInventory(checkout, onLoadExecutor); } else { return null; } } }); public App() { instance = this; } /** * Method deciphers previously ciphered message * * @param message ciphered message * @param salt salt which was used for ciphering * @return deciphered message */ @Nonnull static String fromX(@Nonnull String message, @Nonnull String salt) { return x(new String(Base64.decode(message, 0)), salt); } /** * Method ciphers message. Later {@link #fromX} method might be used for deciphering * * @param message message to be ciphered * @param salt salt to be used for ciphering * @return ciphered message */ @Nonnull static String toX(@Nonnull String message, @Nonnull String salt) { return new String(Base64.encode(x(message, salt).getBytes(), 0)); } /** * Symmetric algorithm used for ciphering/deciphering. Note that in your application you * probably want to modify * algorithm used for ciphering/deciphering. * * @param message message * @param salt salt * @return ciphered/deciphered message */ @Nonnull static String x(@Nonnull String message, @Nonnull String salt) { final char[] m = message.toCharArray(); final char[] s = salt.toCharArray(); final int ml = m.length; final int sl = s.length; final char[] result = new char[ml]; for (int i = 0; i < ml; i++) { result[i] = (char) (m[i] ^ s[i % sl]); } return new String(result); } @Nonnull public static Application get() { return instance; } static boolean openUri(@Nonnull Activity activity, @Nonnull String uri) { try { activity.startActivity(new Intent(ACTION_VIEW, Uri.parse(uri))); return true; } catch (ActivityNotFoundException e) { Log.e("Checkout", e.getMessage(), e); } return false; } @Nonnull public Billing getBilling() { return billing; } }
[ "sds3qr@gmail.com" ]
sds3qr@gmail.com
61196cc6db4317c19f5ab7fb986b78e6a25aa436
29aa9413161fd8252c48fde027ee2b7744634f7c
/batch-app/src/main/java/k8sbook/sampleapp/LocationFileProcessor.java
994d414169c1d0e4f2b990081f45f75718af94df
[ "Apache-2.0" ]
permissive
kazusato/k8sbook
1de293014532eb74822b82f423f1136c0c07dc01
c947e35fe026106b371b4b8d450cbd5215996018
refs/heads/master
2023-07-06T02:53:55.357079
2022-11-06T22:06:37
2022-11-06T22:06:37
248,283,523
45
22
Apache-2.0
2023-06-21T23:19:35
2020-03-18T16:23:39
Java
UTF-8
Java
false
false
4,542
java
package k8sbook.sampleapp; import com.opencsv.CSVReader; import k8sbook.sampleapp.aws.S3FileHandler; import k8sbook.sampleapp.domain.model.Location; import k8sbook.sampleapp.domain.model.Region; import k8sbook.sampleapp.domain.service.LocationService; import k8sbook.sampleapp.persistence.repository.BatchProcessingFileRepository; import k8sbook.sampleapp.persistence.repository.RegionRepository; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.Resource; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; @Component public class LocationFileProcessor { private static final Logger LOGGER = LoggerFactory.getLogger(LocationFileProcessor.class); @Value("${sample.app.batch.bucket.name}") private String bucketName; private final LocationService service; private final RegionRepository regionRepository; private final BatchProcessingFileRepository batchProcessingFileRepository; private final S3FileHandler handler; public LocationFileProcessor(LocationService service, RegionRepository regionRepository, BatchProcessingFileRepository batchProcessingFileRepository, S3FileHandler handler) { this.service = service; this.regionRepository = regionRepository; this.batchProcessingFileRepository = batchProcessingFileRepository; this.handler = handler; } @Transactional(propagation = Propagation.REQUIRES_NEW) public void processFile(Resource workFile) throws IOException { LOGGER.info("Start processing file: " + workFile.getFilename()); try (var isr = new InputStreamReader(workFile.getInputStream(), StandardCharsets.UTF_8)) { var csvReader = new CSVReader(isr); String[] nextLine; var dataList = new ArrayList<String[]>(); for (int i = 0; (nextLine = csvReader.readNext()) != null; i++) { checkFormatAndAddToList(workFile, nextLine, dataList, i); } registerAndDeleteFile(workFile, dataList); } batchProcessingFileRepository.deleteByFileName(new File(workFile.getFilename()).getName()); LOGGER.info("End processing file: " + workFile.getFilename()); } private void registerAndDeleteFile(Resource file, ArrayList<String[]> dataList) { service.registerLocations(convertToLocationList(dataList)); handler.deleteFile(bucketName, file.getFilename()); LOGGER.info("File deleted: " + file.getFilename()); } private void checkFormatAndAddToList(Resource file, String[] lineData, ArrayList<String[]> dataList, int lineNumber) { if (lineData.length != 3) { LOGGER.warn("invalid format in line " + (lineNumber + 1) + " of " + file.getFilename() + ": " + Arrays.toString(lineData)); } else if (StringUtils.isEmpty(lineData[1])) { LOGGER.warn("empty string in line " + (lineNumber + 1) + " of " + file.getFilename() + ": " + Arrays.toString(lineData)); } else { dataList.add(lineData); } } private List<Location> convertToLocationList(List<String[]> dataList) { var regionMapByName = getRegionMapByName(); return dataList.stream().filter(data -> regionMapByName.get(data[0]) != null).map(data -> { var regionName = data[0]; var locationName = data[1]; var note = data[2]; return new Location(locationName, regionMapByName.get(regionName), note); }).collect(Collectors.toList()); } private Map<String, Region> getRegionMapByName() { var regionEntityList = regionRepository.findAll(); var regionList = regionEntityList.stream().map(regionEntity -> new Region(regionEntity)).collect(Collectors.toList()); return regionList.stream().collect(Collectors.toMap(Region::getRegionName, Function.identity())); } }
[ "super80@gmail.com" ]
super80@gmail.com
53bfeeff4133ee3654abda4d6ae78fe65dde4a70
ebcf227b64bbdde47e03afcc3b55e8a01e5000f1
/T_Odd_Syndrome/app/src/main/java/com/dastanapps/dastanLib/utils/ViewUtils.java
ee6a2f46d4ac9703bb251773d33c58f9622df7fb
[]
no_license
DastanIqbal/CheckTOS
b6cc50b8deb64281c805992f4b16cebfb26f3353
209726c808143e3a0e0ce4fd263e3c4adb4d2705
refs/heads/master
2020-09-22T01:04:14.823158
2016-08-26T10:55:36
2016-08-26T10:55:36
66,502,837
0
0
null
null
null
null
UTF-8
Java
false
false
8,584
java
package com.dastanapps.dastanLib.utils; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.graphics.drawable.Drawable; import android.os.Build; import android.support.design.widget.Snackbar; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.FrameLayout; import android.widget.Toast; import com.dastanapps.checktos.R; /** * * All View method should be define here * *@author : Dastan Iqbal * * @email : iqbal.ahmed@mebelkart.com */ public class ViewUtils { private static final String TAG = ViewUtils.class.getSimpleName(); private static ProgressDialog progressDialog; private static ProgressDialog progressDialogNotCancellable; private static Snackbar snack = null; private static Toast mToast = null; /** * @param ctxt */ public static void showProgressDialog(Context ctxt) { if (ctxt != null && (progressDialog == null || !progressDialog.isShowing())) { progressDialog = new ProgressDialog(ctxt); // progressDialog.setCancelable(false); progressDialog.setMessage("Loading"); progressDialog.setIndeterminateDrawable(ViewUtils.getDrawable((Activity) ctxt, R.drawable.progressbar_circle)); progressDialog.show(); progressDialog.setCanceledOnTouchOutside(true); progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { hideProgressDialog(); // progressDialog.dismiss(); } }); progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { progressDialog.dismiss(); } }); } } public static boolean isProgressDialog() { if (progressDialog != null) return progressDialog.isShowing(); return false; } public static void hideProgressDialog() { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } } // public static void showProgressDialogNotCancellable(Context ctxt) { // if (ctxt != null && (progressDialog == null || !progressDialog.isShowing())) { // progressDialog = new ProgressDialog(ctxt); // // progressDialog.setCancelable(false); // progressDialog.setMessage("Loading"); // progressDialog.setIndeterminateDrawable(ViewUtils.getDrawable((Activity) ctxt, R.drawable.progressbar_circle)); // progressDialog.show(); // progressDialog.setCanceledOnTouchOutside(false); // progressDialog.setCancelable(false); // // progressDialog.setOnDismissListener(new DialogInterface.OnDismissListener() { // @Override // public void onDismiss(DialogInterface dialog) { // hideProgressDialog(); //// progressDialog.dismiss(); // } // }); // // progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { // @Override // public void onCancel(DialogInterface dialog) { // progressDialog.dismiss(); // } // }); // } // } public static void hideProgressDialogNotCancellable() { if (progressDialog != null && progressDialog.isShowing()) { progressDialog.dismiss(); } } public static void showToast(Context ctxt, String msg) { if (mToast != null) mToast.cancel(); mToast = Toast.makeText(ctxt, msg, Toast.LENGTH_LONG); mToast.show(); } public static void showSnack(String msg, String actionStr, View snackView, View.OnClickListener listener) { //with action listener if (snack != null) snack.dismiss(); snack = Snackbar.make(snackView, msg, Snackbar.LENGTH_LONG); View view = snack.getView(); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams(); params.gravity = Gravity.TOP; view.setLayoutParams(params); snack.setAction(actionStr, listener); snack.setDuration(Snackbar.LENGTH_LONG); snack.show(); } // public static void showSnack(String msg, String actionStr, View snackView, View.OnClickListener listener, String tagValue) { // //with action listener // if (snack != null) // snack.dismiss(); // snack = Snackbar.make(snackView, msg, Snackbar.LENGTH_LONG); // Snackbar.SnackbarLayout view = (Snackbar.SnackbarLayout) snack.getView(); // FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams(); // params.gravity = Gravity.TOP; // view.setLayoutParams(params); // view.findViewById(R.id.snackbar_action).setTag(R.id.handleMultipleTap, tagValue); // snack.setAction(actionStr, listener); // snack.setDuration(Snackbar.LENGTH_LONG); // snack.show(); // } public static void showSnackDown(String msg, String actionStr, View snackView, View.OnClickListener listener) { //with action listener Snackbar snack = Snackbar.make(snackView, msg, Snackbar.LENGTH_LONG); View view = snack.getView(); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams(); params.gravity = Gravity.BOTTOM; view.setLayoutParams(params); snack.setAction(actionStr, listener); snack.setDuration(Snackbar.LENGTH_INDEFINITE); snack.show(); } public static void showSnack(String msg, View snackView) { Snackbar snack = Snackbar.make(snackView, msg, Snackbar.LENGTH_LONG); View view = snack.getView(); FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) view.getLayoutParams(); params.gravity = Gravity.TOP; view.setLayoutParams(params); snack.show(); } public static View inflateLayout(Context ctxt, int resId) { return LayoutInflater.from(ctxt).inflate(resId, null); } public static View inflateLayout(Context ctxt, int resId, ViewGroup parent) { return LayoutInflater.from(ctxt).inflate(resId,parent,false); } public static Dialog getMKDialog(Context ctxt, int reslayout) { Dialog d = new Dialog(ctxt); d.requestWindowFeature(Window.FEATURE_NO_TITLE); d.getWindow().setBackgroundDrawableResource(android.R.color.transparent); d.setContentView(reslayout); d.setCanceledOnTouchOutside(false); return d; } public static Dialog getMKDialogOK(Context ctxt, String title, String msg, String positiveText, String negativeText, DialogInterface.OnClickListener okInterface, DialogInterface.OnClickListener cancelInterface) { AlertDialog.Builder builder = new AlertDialog.Builder(ctxt); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton(positiveText, okInterface); builder.setNegativeButton(negativeText, cancelInterface); AlertDialog alertDialog = builder.create(); return alertDialog; } public static Dialog getMKDialogOK(Context ctxt, String title, String msg, String positiveText, DialogInterface.OnClickListener okInterface) { AlertDialog.Builder builder = new AlertDialog.Builder(ctxt); builder.setTitle(title); builder.setMessage(msg); builder.setPositiveButton(positiveText, okInterface); AlertDialog alertDialog = builder.create(); return alertDialog; } /** * used to support all versions of OS * * @param ctxt * @param res * @return */ public static Drawable getDrawable(Activity ctxt, int res) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return ctxt.getResources().getDrawable(res, ctxt.getTheme()); } else { return ctxt.getResources().getDrawable(res); } } }
[ "iqbal.ahmed@mebelkart.com" ]
iqbal.ahmed@mebelkart.com
eb88da9aa8cf0d63e9bbf0194ee2436bde679e34
0cd2a6cee7a6ef47c0630790abb96e929b8f2551
/app/src/main/java/wesicknessdect/example/org/wesicknessdetect/events/ShowProcessScreenEvent.java
b6daf66d51eab8ea74bee8ea8a76d84fd76bc29d
[]
no_license
kennest/ScanLeaf
b81d168bfd1674a0220e5547e30ae1f205fa7738
103eca702fe67ba168c688d75e8dd1f3a1e13ba5
refs/heads/master
2020-05-02T05:33:59.604468
2019-07-22T13:33:11
2019-07-22T13:33:11
177,774,485
1
0
null
null
null
null
UTF-8
Java
false
false
225
java
package wesicknessdect.example.org.wesicknessdetect.events; public class ShowProcessScreenEvent { public final String message; public ShowProcessScreenEvent(String message) { this.message = message; } }
[ "kennyoulay@gmail.com" ]
kennyoulay@gmail.com
c9c9e30b3fde903d79f6dfbdf6593f05b7910254
4348a752de63ef295f141136f78ae583837e4431
/src/com/unika/admin/login/AdminLoginDAO.java
99639e3ee7684b14a86304846c8e8fcaaba0827f
[]
no_license
deepakve/UnikaOnline_-_Banking_Management_System-2016-05-17
3205c2b46e3798d6be9ad381091f68e80c31f778
126609b82e11296fc4fdf54f2c62b7a1fdc3c0fe
refs/heads/master
2020-12-24T19:04:09.691132
2016-05-18T05:44:27
2016-05-18T05:44:27
59,063,149
0
0
null
null
null
null
UTF-8
Java
false
false
150
java
package com.unika.admin.login; public interface AdminLoginDAO { public int adminloginAuthentication(String adminid, String adminpassword); }
[ "deepakdev88@gmail.com" ]
deepakdev88@gmail.com
40f541f0c4021c7f102f058ddc2f7baad99c041d
56028716d60d9cbfc97789fc16767323dc04a15f
/Composite/ImageFile.java
e792d5927c86fb99a5e6e7c0a6f7ce0662017e66
[]
no_license
Bin252/task
e1654f7ea2393e991345e505cb29c7798aa522c5
0ba458026933b45969ff04edb2f28b16112b91c6
refs/heads/main
2023-06-02T06:59:59.937413
2021-06-17T17:59:13
2021-06-17T17:59:13
345,908,535
0
0
null
null
null
null
UTF-8
Java
false
false
496
java
package Composite; public class ImageFile extends AbstractFile { private String fileName; public ImageFile(String filename) { this.fileName=new String(); this.fileName=filename; } public void add(AbstractFile element) { System.out.println("ImageFile:add"); } public void remove(AbstractFile element) { System.out.println("ImageFile:remove"); } public void display() { System.out.println(fileName); System.out.println("ImageFile:display"); } }
[ "noreply@github.com" ]
Bin252.noreply@github.com
a43fdccf5e81114bb577db776bc5e31bafe19392
b121900697c551ea1b08540558508060375ca6b6
/src/de/fhdw/bfws114a/solution/Gui2.java
09eeea10b571f0f76ce2cce7bb67e23fe87509f6
[]
no_license
techcom1994/LernKartei
603df41b6c4dbe674b95ba65f9bfc6e68b6307b7
72e3a0687107df8d7fa560b425c67990a377ee4c
refs/heads/master
2021-01-18T12:40:16.795316
2015-11-30T04:42:31
2015-11-30T04:42:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,287
java
package de.fhdw.bfws114a.solution; import android.app.Activity; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; import android.widget.TextView; import de.fhdw.bfws114a.lernKartei.R; public class Gui2 { private TextView mQuestion; private TextView mUserAnswer; private TextView mCorrectAnswer; private Activity mActivity; private Button mContinue; public Gui2(Activity act) { mActivity = act; act.setContentView(R.layout.activity_challenge_text_answer); mQuestion = (TextView) act.findViewById(R.id.t_question_challenge_text_answer); mUserAnswer = (TextView) act.findViewById(R.id.t_user_answer_text_answer); mCorrectAnswer = (TextView) act.findViewById(R.id.t_correct_answer_text_answer); mContinue = (Button) act.findViewById(R.id.b_continue_challenge_text); } public void showThisGui(){ mActivity.setContentView(R.layout.activity_challenge_text_answer); } public TextView getQuestion() { return mQuestion; } public TextView getUserAnswer() { return mUserAnswer; } public TextView getCorrectAnswer() { return mCorrectAnswer; } public Activity getActivity() { return mActivity; } public Button getContinue() { return mContinue; } }
[ "Carsten.Schlender@web.de" ]
Carsten.Schlender@web.de
b481fd2e7df35cd53e328099dde18a6e427088de
b9a34c715080943dd9131d8737425c67fd479336
/src/main/java/com/example/getmesocialservice/git/Resource/ResApi.java
08cce05a99b3e1ff65b971ae4d69e4661d03782d
[]
no_license
13bhavya/getmesocial-service
045ab73457ffea5306523cd23044bb7dabf3a8ba
327a3d30ca9a5e7dd46a1bb44c072bfac71ed7ee
refs/heads/main
2023-07-10T04:10:53.509592
2021-08-13T03:37:19
2021-08-13T03:37:19
395,496,085
0
0
null
null
null
null
UTF-8
Java
false
false
591
java
package com.example.getmesocialservice.git.Resource; import com.example.getmesocialservice.git.Model.User; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api") public class ResApi { @GetMapping("/user") public User getUser(){ User user = new User("Kelly","452 Oakville Dr", 45, "https://media.vanityfair.com/photos/5c3a2d59ba532c6650deda58/master/pass/megyn-kelly-nbc.jpg"); return user; } }
[ "https://github.com/bhavyashah9612" ]
https://github.com/bhavyashah9612
ca1ff6f62eb098e176681e6df0262a2c5587ca94
be37b50cbf5811151c1fe2af166afd819b36252f
/src/ParaInteger.java
1a5750916e82a4fc142ffe88d8711a45973e0c23
[]
no_license
XHShirley/OptionPricer
af872b1a3db79e9c44c996f1fccb9cd4165f0ce1
1f3669ead3e681834b2944df2d520b2bf9a498d7
refs/heads/master
2021-01-01T05:31:10.556715
2014-03-15T04:16:29
2014-03-15T04:16:29
17,708,572
0
0
null
null
null
null
UTF-8
Java
false
false
335
java
/** * */ /** * @author Shirley Yang * */ public class ParaInteger extends Parameter { int value; /** * @param name */ public ParaInteger(String name, int value) { super(name); this.value = value; } public int getValue() { return value; } public void setValue(int value) { this.value = value; } }
[ "yangxinghui918@gmail.com" ]
yangxinghui918@gmail.com
deb1e6947c6501aca150a4171851edf7b0f7c363
cf09dc6676c6a0c0b6b369bdbf69d8892723f37d
/damoney/app/src/main/java/com/dacom/damoney/BMPProfieldMainFragment.java
14c3f70b93c6a1a25541ac3faf0965ca1a2bd727
[]
no_license
nnnyyy/damoney
a5c88373e1b97f3b735091a7bcb50fa4652e905b
84ed6fdecf103f4738c0be9fd72ed14043b1b6d9
refs/heads/master
2021-05-16T00:44:56.962452
2017-12-23T11:48:47
2017-12-23T11:48:47
106,974,836
0
0
null
null
null
null
UTF-8
Java
false
false
3,115
java
package com.dacom.damoney; import android.databinding.DataBindingUtil; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CompoundButton; import com.dacom.damoney.AlertManager.AlertManager; import com.dacom.damoney.Push.DamoneyPushManager; import com.dacom.damoney.Sign.MyPassport; import com.dacom.damoney.databinding.FragmentPprofileMainBinding; /** * A simple {@link Fragment} subclass. */ public class BMPProfieldMainFragment extends Fragment { FragmentPprofileMainBinding mBind; BMProfileFragment parent; public BMPProfieldMainFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment mBind = DataBindingUtil.inflate(inflater, R.layout.fragment_pprofile_main, container, false); DamoneyPushManager.loadPushSettings(getContext()); mBind.swtAds.setChecked(DamoneyPushManager.bEnableAdsPUsh); mBind.swtAds.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Storage.saveBoolean(getContext(), DamoneyPushManager.PK_ADS, isChecked); if(isChecked) { AlertManager.ShowOk(getContext(), "알림", "푸쉬 메시지가 설정 되었습니다.", "닫기", new AlertManager.OnClickListener() { @Override public void onClick(View v, int which) { DamoneyPushManager.Reserv(getContext(), DamoneyPushManager.FIVE_MIN); } }); } } }); return mBind.getRoot(); } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); MyPassport.getInstance().RequestInfo(new MyPassport.RequestInfoListener() { @Override public void onResult(int nRet) { if(nRet != 0) return; new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { mBind.tvNick.setText(MyPassport.getInstance().sNick); mBind.tvCoin.setText(String.valueOf(MyPassport.getInstance().nPoint)); } }); } }); mBind.btnBuyList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { parent.changeChildFragment(1); } }); } public void setPrarent(BMProfileFragment _parent) { parent = _parent; } }
[ "nnnyyy@nate.com" ]
nnnyyy@nate.com
5ab15912b61675738a972fd290976b562537b396
6aa9760f930420b489e8991a67d8831358c83621
/src/test/java/testRunner/WidgetTestRunner/Autocomplete.java
f6b919fc3dbcd914ecac019248be5e9709977a29
[]
no_license
Haritha-NavaneethaKrishnan/Test_automation_ToolsQA
b42eb76b8d546e32a3ee87be1a3245d3586a922e
44c8f7c3f1108a20c806e14f669bab0ee7bdeb11
refs/heads/master
2023-05-04T16:04:45.897540
2021-05-20T05:47:56
2021-05-20T05:47:56
369,091,634
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package testRunner.WidgetTestRunner; import io.cucumber.testng.AbstractTestNGCucumberTests; import io.cucumber.testng.CucumberOptions; @CucumberOptions(features = "src/test/resources/WidgetsFeature/autoComplete.feature",monochrome = true,glue={"stepDefinition"}) public class Autocomplete extends AbstractTestNGCucumberTests { }
[ "nkharitha.03@gmail.com" ]
nkharitha.03@gmail.com
6a5e449f4b238fd9c36574f4ecb31e7998a718b1
d1e540535c93e1d8c95de0883e1d0f5df87992c6
/src/main/java/DevelopPack/Units/Transport/Tank.java
a38b64c2ecfa9b6ffd5bb06cec37c30d87a8b1b6
[]
no_license
ilyaKhim/TestPrototype
5aff7f449ba89abb3a88ec06df3aac1e074a879f
6f18827382077798b6e8a1dc803a8bf95deb46d5
refs/heads/master
2020-07-08T08:13:21.095568
2019-08-21T15:33:03
2019-08-21T15:33:03
203,613,575
0
0
null
null
null
null
UTF-8
Java
false
false
1,400
java
package DevelopPack.Units.Transport; import DevelopPack.Field; import DevelopPack.Interfaces.ShotAble; import java.util.Arrays; public class Tank extends CommonTransport implements ShotAble { private int patrons; public Tank(int hor, int vert) { super(hor, vert); patrons = 100; if(Field.thingsOnField.contains(this)){ System.out.println("Вы создали танк."+ "\nОн расположен в квадрате "+ (getPositionX()+1)+"—"+(getPositionY()+1) +"\nЗапас патрон: " + getPatrons()+"\n------------------------"); } } @Override public int getPatrons() { return patrons; } @Override public void loadPatrons(){ this.patrons = 100; } @Override public void shot() { --patrons; System.out.println(this.getClass().getSimpleName()+ " произвел выстрел в сторону "+ getOrientation()+"\nОсталось " + getPatrons() + " патронов."+"\n------------------------"); } @Override public String toString(){ return "Танк находится на позиции: " + (getPositionX()+1)+"—"+(getPositionY()+1)+"\nНаправлен в сторону: "+ getOrientation()+"\nЗапас патронов: "+getPatrons()+"\n------------------------"; } }
[ "ilya.himchenko@yandex.ru" ]
ilya.himchenko@yandex.ru
bf293c31ffd9ee1064c277127acbf33bd8056865
0be2b844b88ebc45c4a23bb5986b5469e04f486d
/app/src/main/java/com/example/android/architecturecomponent/presentation/mvvm/viewModel/MainViewModel.java
f8051b0ff03d9341e9294fb44d0b99526fae20de
[]
no_license
StasMax/ArchitectureComponent
bd4f56162760551d99410ff70a5885b3c5da8f02
9ad1e5402645ae42badfd617c04d48b1aec44397
refs/heads/master
2020-05-16T22:56:24.634948
2019-07-24T06:39:05
2019-07-24T06:39:05
183,350,431
0
0
null
2019-07-24T06:39:06
2019-04-25T03:35:44
Java
UTF-8
Java
false
false
1,346
java
package com.example.android.architecturecomponent.presentation.mvvm.viewModel; import android.arch.lifecycle.LiveData; import android.arch.paging.LivePagedListBuilder; import android.arch.paging.PagedList; import com.example.android.architecturecomponent.data.model.PublishModel; import com.example.android.architecturecomponent.domain.iteractor.IPublishIteractor; import com.example.android.architecturecomponent.presentation.adapter.PublishSourceFactory; import static com.example.android.architecturecomponent.presentation.Constant.LOAD_FIRST_ITEM_SIZE; import static com.example.android.architecturecomponent.presentation.Constant.LOAD_ITEM_SIZE; public class MainViewModel extends BaseViewModel { private PublishSourceFactory publishSourceFactory; private PagedList.Config config; public MainViewModel(IPublishIteractor publishIteractor) { publishSourceFactory = new PublishSourceFactory(publishIteractor, compositeDisposable); config = (new PagedList.Config.Builder()) .setEnablePlaceholders(false) .setInitialLoadSizeHint(LOAD_FIRST_ITEM_SIZE) .setPageSize(LOAD_ITEM_SIZE) .build(); } public LiveData<PagedList<PublishModel>> getPagedList() { return new LivePagedListBuilder<>(publishSourceFactory, config).build(); } }
[ "maximovich@live.ru" ]
maximovich@live.ru
6d621a443a78ca6c3e31318384b21cef57ac8dd5
538210ab63e73049b3a31234fdd138ce6678a32a
/unionpay/src/main/java/com/example/demo/union/util/LogUtil.java
4fc34a5cdfefc4c85225e65a0de3ab1a93714535
[ "MIT" ]
permissive
76782875/unionpay
418f7f37c9cc9851f36a08d93443e3c02c10e786
81ca8a77e24ac26a4bbc5d4bec168b386effdd88
refs/heads/master
2022-01-09T16:44:36.452044
2019-05-09T09:17:09
2019-05-09T09:17:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,907
java
/** * * Licensed Property to China UnionPay Co., Ltd. * * (C) Copyright of China UnionPay Co., Ltd. 2010 * All Rights Reserved. * * * Modification History: * ============================================================================= * Author Date Description * ------------ ---------- --------------------------------------------------- * xshu 2014-05-28 日志打印工具类 * ============================================================================= */ package com.example.demo.union.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; /** * * @author 花花 * @Description acpsdk日志工具类 * */ public class LogUtil { private final static Logger GATELOG = LoggerFactory.getLogger("ACP_SDK_LOG"); private final static Logger GATELOG_ERROR = LoggerFactory.getLogger("SDK_ERR_LOG"); private final static Logger GATELOG_MESSAGE = LoggerFactory.getLogger("SDK_MSG_LOG"); final static String LOG_STRING_REQ_MSG_BEGIN = "============================== SDK REQ MSG BEGIN =============================="; final static String LOG_STRING_REQ_MSG_END = "============================== SDK REQ MSG END =============================="; final static String LOG_STRING_RSP_MSG_BEGIN = "============================== SDK RSP MSG BEGIN =============================="; final static String LOG_STRING_RSP_MSG_END = "============================== SDK RSP MSG END =============================="; /** * 记录普通日志 * * @param cont */ public static void writeLog(String cont) { GATELOG.info(cont); } /** * 记录ERORR日志 * * @param cont */ public static void writeErrorLog(String cont) { GATELOG_ERROR.error(cont); } /** * 记录ERROR日志 * * @param cont * @param ex */ public static void writeErrorLog(String cont, Throwable ex) { GATELOG_ERROR.error(cont, ex); } /** * 记录通信报文 * * @param msg */ public static void writeMessage(String msg) { GATELOG_MESSAGE.info(msg); } /** * 打印请求报文 * * @param reqParam */ public static void printRequestLog(Map<String, String> reqParam) { writeMessage(LOG_STRING_REQ_MSG_BEGIN); Iterator<Entry<String, String>> it = reqParam.entrySet().iterator(); while (it.hasNext()) { Entry<String, String> en = it.next(); writeMessage("[" + en.getKey() + "] = [" + en.getValue() + "]"); } writeMessage(LOG_STRING_REQ_MSG_END); } /** * 打印响应报文. * * @param res */ public static void printResponseLog(String res) { writeMessage(LOG_STRING_RSP_MSG_BEGIN); writeMessage(res); writeMessage(LOG_STRING_RSP_MSG_END); } /** * debug方法 * * @param cont */ public static void debug(String cont) { if (GATELOG.isDebugEnabled()) { GATELOG.debug(cont); } } }
[ "1154684329@qq.com" ]
1154684329@qq.com
bfdfcdc60f2df0554e753119ef8f52dc48330786
ba43102ab4a4e833f8242149e6ed398022747366
/src/main/java/com/postang/domain/VehicleDriverMapping.java
50b4765319f1121081113a6059ae54aee3166411
[]
no_license
pidaparthivijay/postang
324521ad554718ff95ee4b3ce20d5289d3a2ef62
39a48c2332b8ff28f544e9c90973e5cf78b69f92
refs/heads/master
2023-01-08T03:25:32.747133
2020-10-15T19:54:41
2020-10-15T19:54:41
228,895,907
0
0
null
null
null
null
UTF-8
Java
false
false
832
java
package com.postang.domain; import java.io.Serializable; import java.util.Date; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.SequenceGenerator; import lombok.Data; /** * @author Subrahmanya Vijay * */ @Entity @Data public class VehicleDriverMapping implements Serializable { /** * */ private static final long serialVersionUID = 504936599515799953L; @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "vdm_seq") @SequenceGenerator(name = "vdm_seq", sequenceName = "vdm_seq", allocationSize = 1) private long vdmId; private String vehicleRegNum; private Date assignedDate; private long tourPackageRequestId; private String driverLicense; private String driverContact; }
[ "pidaparthivijayaditya@gmail.com" ]
pidaparthivijayaditya@gmail.com
f20631ccececf1afbc2e267765df87f10c9651d0
d944234f35651bd5a23f8d14b77555390c729926
/java-core/src/typyinfo/FilledList.java
e63b9748df57c1c5760ed80c8cf5d2f0836085cc
[]
no_license
LJJ1994/Java-Learn
4f2d5981c291da24b4be11afa9506e3665d45d6d
1932dfc8416f7e4498c848671f59e2a816b1316b
refs/heads/master
2022-11-06T09:34:32.841582
2020-08-01T05:00:09
2020-08-01T05:00:09
247,892,292
0
0
null
2022-10-12T20:44:53
2020-03-17T06:06:00
Java
UTF-8
Java
false
false
876
java
//: typeinfo/FilledList.java package typyinfo; /* Added by Eclipse.py */ import java.util.*; class CountedInteger { private static long counter; private final long id = counter++; public String toString() { return Long.toString(id); } } public class FilledList<T> { private Class<T> type; public FilledList(Class<T> type) { this.type = type; } public List<T> create(int nElements) { List<T> result = new ArrayList<T>(); try { for(int i = 0; i < nElements; i++) result.add(type.newInstance()); } catch(Exception e) { throw new RuntimeException(e); } return result; } public static void main(String[] args) { FilledList<CountedInteger> fl = new FilledList<CountedInteger>(CountedInteger.class); System.out.println(fl.create(15)); } } /* Output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] *///:~
[ "optionsci111@gmail.com" ]
optionsci111@gmail.com
858764fd07dc7d0129826a3636b8ea80cd2104b8
b91c6d38991749b4f7d8af9d83190ca1761dfc4f
/ExceptionHandling/src/MultipleCatchDemo1.java
afeb16a0965385c5d6ceccd345038e9898b3777c
[]
no_license
rajeshsn/JavaProgrammes
c211be483424d57e15e59b3eede4426915fae080
e8af65af30af28cf4867626a6a25b484924e566e
refs/heads/master
2023-04-02T12:00:01.184017
2021-04-05T18:49:08
2021-04-05T18:49:08
354,937,388
0
0
null
null
null
null
UTF-8
Java
false
false
637
java
public class MultipleCatchDemo1 { public static void main(String[] args) { try{ int a[]= new int [5]; a[6]=30/2; String s="Rajesh"; int a1=s.length(); System.out.println(a1); }catch(ArithmeticException e){ System.out.println("Arithmatic exception has been occured"); } catch(ArrayIndexOutOfBoundsException e){ System.out.println("ArrayIndexOutofBound exception has been occured"); } catch(Exception e){ System.out.println("Rest of the exception handled here"); } // TODO Auto-generated method stub System.out.println("Rest of the code executed"); } }
[ "rajesh_negi75@yahoo.com" ]
rajesh_negi75@yahoo.com
154ff47e65c1fa1d53465d1c34d6c36c2024ba25
37e660a3897bd8835f2e091277077f3aecd98427
/java/ReplayMapSymbolPatch.java
d67686a7bbd7c424063e70c37137f75ea5692480
[]
no_license
ZerotolXD/Replay-the-Spire
b5065313dc22f9692683e275f9c3fbda4bd970b2
1d6db8267a30e1885f13fd0c965e5660042f3d97
refs/heads/master
2020-03-20T15:36:34.867401
2018-06-15T11:56:19
2018-06-15T11:56:19
137,517,207
1
0
null
2018-06-15T17:52:52
2018-06-15T17:52:52
null
UTF-8
Java
false
false
785
java
package ReplayTheSpireMod.patches; import com.megacrit.cardcrawl.cards.AbstractCard; import com.megacrit.cardcrawl.characters.AbstractPlayer; import com.megacrit.cardcrawl.dungeons.*; import com.megacrit.cardcrawl.helpers.*; import com.megacrit.cardcrawl.rooms.*; import ReplayTheSpireMod.*; import com.evacipated.cardcrawl.modthespire.lib.*; import java.util.*; @SpirePatch(cls = "com.megacrit.cardcrawl.rooms.AbstractRoom", method = "getMapSymbol") public class ReplayMapSymbolPatch { public static String Postfix(String __result, AbstractRoom __Instance) { if (AbstractDungeon.player.hasRelic("Painkiller Herb")) { if (__result == "M" || __result == "E") { return "?"; } if (__result == "$" || __result == "R") { return "T"; } } return __result; } }
[ "tobiaskipps@gmail.com" ]
tobiaskipps@gmail.com
e26c11812cccdd44265177cdd93df37ad1940932
23656d41901296b99b9172ff18e19a060172aa7f
/src/test/java/com/leninjunior/projeto/ProjetoApplicationTests.java
48326de93913a368d7a332c2250b5ced692e4560
[]
no_license
leninjunior/projetosprintboot
1ae3b59321139d3352da29f862e7a795f6acb98f
389082d9a1a8058622c130ce37678b5c037a7816
refs/heads/master
2023-02-19T07:15:35.163444
2021-01-19T21:15:28
2021-01-19T21:15:28
329,439,189
1
0
null
null
null
null
UTF-8
Java
false
false
216
java
package com.leninjunior.projeto; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class ProjetoApplicationTests { @Test void contextLoads() { } }
[ "leninbessa@gmail.com" ]
leninbessa@gmail.com
e1e9ae6b7ad5bfcbe27a898e53c1d6cfde423cf9
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/20/20_ed4ecfb7fbcb4d6747fa2a717d55b8f0c6f49934/SimpleUITest/20_ed4ecfb7fbcb4d6747fa2a717d55b8f0c6f49934_SimpleUITest_s.java
eedaf67c68cbfb77912b4c815eb5522b2660a4eb
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,106
java
package org.eclipselabs.spray.examples.one.tests; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.eclipse.draw2d.IFigure; import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.GraphicalEditPart; import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm; import org.eclipse.graphiti.mm.algorithms.RoundedRectangle; import org.eclipse.graphiti.mm.pictograms.PictogramLink; import org.eclipse.graphiti.mm.pictograms.Shape; import org.eclipse.graphiti.ui.internal.figures.GFAbstractShape; import org.eclipse.graphiti.ui.internal.figures.GFRoundedRectangle; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart; import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor; import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.junit.Test; import org.junit.runner.RunWith; import BusinessDomainDsl.BusinessClass; @SuppressWarnings("restriction") @RunWith(SWTBotJunit4ClassRunner.class) public class SimpleUITest extends AbstractGraphitiTest { final String projectName = "org.eclipselabs.spray.examples.SimpleUITest"; @Test public void testCreateNewBusinessClass() throws Exception { final String perspective = "Java"; final String diagramFolder = "src"; final String fileName = "ExampleOneTest"; final String diagramTypeName = "mod4j"; final String objectFromToolbar = "BusinessClass"; final String businessClassName = "Test"; int targetX = 50; int targetY = 60; bot.perspectiveByLabel(perspective).activate(); createNewProject(projectName); selectFolderNode(projectName, diagramFolder); createDiagramViaGraphitiExampleWizard(diagramTypeName, fileName); SWTBotEditor editor = bot.activeEditor(); editor.save(); final SWTBotGefEditor ged = bot.gefEditor(editor.getTitle()); createBusinessClass(ged, objectFromToolbar, businessClassName, targetX, targetY); assertBusinessClassRepresentationExists(ged, businessClassName, targetX, targetY); } private void createBusinessClass(final SWTBotGefEditor ged, final String objectFromToolbar, final String name, int targetX, int targetY) { ged.activateTool(objectFromToolbar); ged.drag(targetX, targetY, 55, 55); bot.text().setText(name); bot.button("OK").click(); } private void assertBusinessClassRepresentationExists(SWTBotGefEditor ged, String shapeName, int targetX, int targetY) { SWTBotGefEditPart editPart = ged.getEditPart("Class7 " + shapeName + " ;;;"); IFigure figure = assertFigure(targetX, targetY, editPart); assertRoundedRectangle(targetX, targetY, figure); assertDomainObject(shapeName, editPart); } private IFigure assertFigure(int targetX, int targetY, SWTBotGefEditPart editPart) { IFigure figure = ((GraphicalEditPart) editPart.part()).getFigure(); assertNotNull("figure not found", figure); assertEquals(targetX, figure.getBounds().x); assertEquals(targetY, figure.getBounds().y); return figure; } private void assertRoundedRectangle(int targetX, int targetY, IFigure figure) { assertTrue("rounded rectangle expected", figure instanceof GFRoundedRectangle); assertTrue( "rounded rectangle should be a specialization of abstract shape", figure instanceof GFAbstractShape); GFRoundedRectangle rectangle = (GFRoundedRectangle) figure; try { Method method = GFAbstractShape.class .getDeclaredMethod("getGraphicsAlgorithm"); method.setAccessible(true); GraphicsAlgorithm ga = (GraphicsAlgorithm) method.invoke(rectangle); assertTrue(ga instanceof RoundedRectangle); RoundedRectangle rec = (RoundedRectangle) ga; assertEquals(targetX, rec.getX()); assertEquals(targetY, rec.getY()); } catch (SecurityException e) { fail(e.getMessage()); e.printStackTrace(); } catch (NoSuchMethodException e) { fail(e.getMessage()); e.printStackTrace(); } catch (IllegalArgumentException e) { fail(e.getMessage()); e.printStackTrace(); } catch (IllegalAccessException e) { fail(e.getMessage()); e.printStackTrace(); } catch (InvocationTargetException e) { fail(e.getMessage()); e.printStackTrace(); } } private void assertDomainObject(String shapeName, SWTBotGefEditPart editPart) { Object model = ((GraphicalEditPart) editPart.part()).getModel(); assertTrue("should have been shape", model instanceof Shape); Shape shape = (Shape) model; PictogramLink link = shape.getLink(); assertNotNull("not linked with bo", link); assertEquals("not the expected bo count", 1, link.getBusinessObjects().size()); EObject bo = link.getBusinessObjects().get(0); assertTrue("should have been business class", bo instanceof BusinessClass); BusinessClass bc = (BusinessClass) bo; assertNotNull("bc name set", bc.getName()); assertEquals("not the expected bc name", shapeName, bc.getName()); } @Override protected String getProjectName() { return projectName; } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
9f7b9260f16bd37bcaeb2e37ac99c4b7af615751
0ad868264f3066cc9fbe6f7a5d40c0a1533e634b
/src/cst135n/w4/milestone4/Location.java
8dfc83a4d43c376f7ac37529f7c8a6022aba2313
[]
no_license
cwStier/ContactsMilestone4
ee1462b3fcc27ed341fa6c022e53f9d8310b8b60
7d37618b56cbea2b43683b77cadb7d2161050b62
refs/heads/master
2023-06-10T04:03:01.517319
2021-07-05T23:50:54
2021-07-05T23:50:54
382,818,326
0
0
null
null
null
null
UTF-8
Java
false
false
1,426
java
package cst135n.w4.milestone4; import java.io.Serializable; public class Location implements Serializable { private int locationId; private int streetNumber; private String streetName; private String city; private String state; @Override public String toString() { return "Location [locationId=" + locationId + ", streetNumber=" + streetNumber + ", streetName=" + streetName + ", city=" + city + ", state=" + state + "]"; } public Location(int locationId, int streetNumber, String streetName, String city, String state) { super(); this.locationId = locationId; this.streetNumber = streetNumber; this.streetName = streetName; this.city = city; this.state = state; } public int getLocationId() { return locationId; } public void setLocationId(int locationId) { this.locationId = locationId; } public String getStreetName() { return streetName; } public void setStreetName(String streetName) { this.streetName = streetName; } public int getStreetNumber() { return streetNumber; } public void setStreetNumber(int streetNumber) { this.streetNumber = streetNumber; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } }
[ "cws16@DESKTOP-0VS10DS" ]
cws16@DESKTOP-0VS10DS
ab38b9b75afc6ea26807abbde9497ad2a334b47d
f238c320a6afdb81364d7845b0981c032c83b8ae
/src/main/java/com/lisa/dorb/model/db/users/User.java
9372b4527a808b98cb2927e2c0327baff5418cb7
[]
no_license
LisavanderGoes/DORB-Logistics
267ead70b99403802d9b0cc7e326bd870deaf1de
88ee1e13deefa93bb14ae4f94b930c0804a1b112
refs/heads/master
2020-03-20T14:14:31.328927
2018-06-15T12:02:53
2018-06-15T12:02:53
137,480,393
0
0
null
null
null
null
UTF-8
Java
false
false
2,002
java
package com.lisa.dorb.model.db.users; import javax.persistence.*; import java.io.Serializable; @Entity @Table(name = "users") public class User implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long user_Id; @Column(name = "voornaam") private String voornaam; @Column(name = "tussenvoegsel") private String tussenvoegsel; @Column(name = "achternaam") private String achternaam; @Column(name = "inlognaam") private String inlognaam; @Column(name = "wachtwoord") private String wachtwoord; protected User() { } public User(long id, String voornaam, String tussenvoegsel, String achternaam, String inlognaam, String wachtwoord) { this.user_Id = id; this.voornaam = voornaam; this.tussenvoegsel = tussenvoegsel; this.achternaam = achternaam; this.inlognaam = inlognaam; this.wachtwoord = wachtwoord; } @Override public String toString() { return String.format("Customer[id=%d, firstName='%s', lastName='%s']", user_Id, voornaam, achternaam); } public String getWachtwoord(){ return wachtwoord; } public String getVoornaam(){ return voornaam; } public String getTussenvoegsel(){ return tussenvoegsel; } public String getAchternaam(){ return achternaam; } public String getInlognaam(){ return inlognaam; } public long getID() { return user_Id; } public void setVoornaam(String voornaam) { this.voornaam = voornaam; } public void setTussenvoegsel(String tussenvoegsel) { this.tussenvoegsel = tussenvoegsel; } public void setAchternaam(String achternaam) { this.achternaam = achternaam; } public void setInlognaam(String inlognaam) { this.inlognaam = inlognaam; } public void setWachtwoord(String wachtwoord) { this.wachtwoord = wachtwoord; } }
[ "jumping-amazing-super-optimistic-noodle-squad@codefest.nl" ]
jumping-amazing-super-optimistic-noodle-squad@codefest.nl
c303915df3e7cee6104d16b4c29a130df2dd8381
29f508e730f2794341593ad18cf352990888c067
/src/javax/swing/ScrollPaneLayout.java
6ffd7dceae2796a9b20f46c572d304802ce26da4
[]
no_license
nhchanh/jdk1.6.0_21
daf40144acd19d92d15561235038e6e0343f8dec
cdcaafc11122944545c51efc49bb9f884b1ad0d1
refs/heads/master
2021-01-10T19:05:13.011208
2014-01-07T23:10:19
2014-01-07T23:10:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
34,186
java
/* * @(#)ScrollPaneLayout.java 1.64 10/03/23 * * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.swing; import javax.swing.border.*; import java.awt.LayoutManager; import java.awt.Component; import java.awt.Container; import java.awt.Rectangle; import java.awt.Dimension; import java.awt.Insets; import java.io.Serializable; /** * The layout manager used by <code>JScrollPane</code>. * <code>JScrollPaneLayout</code> is * responsible for nine components: a viewport, two scrollbars, * a row header, a column header, and four "corner" components. * <p> * <strong>Warning:</strong> * Serialized objects of this class will not be compatible with * future Swing releases. The current serialization support is * appropriate for short term storage or RMI between applications running * the same version of Swing. As of 1.4, support for long term storage * of all JavaBeans<sup><font size="-2">TM</font></sup> * has been added to the <code>java.beans</code> package. * Please see {@link java.beans.XMLEncoder}. * * @see JScrollPane * @see JViewport * * @version 1.64 03/23/10 * @author Hans Muller */ public class ScrollPaneLayout implements LayoutManager, ScrollPaneConstants, Serializable { /** * The scrollpane's viewport child. * Default is an empty <code>JViewport</code>. * @see JScrollPane#setViewport */ protected JViewport viewport; /** * The scrollpane's vertical scrollbar child. * Default is a <code>JScrollBar</code>. * @see JScrollPane#setVerticalScrollBar */ protected JScrollBar vsb; /** * The scrollpane's horizontal scrollbar child. * Default is a <code>JScrollBar</code>. * @see JScrollPane#setHorizontalScrollBar */ protected JScrollBar hsb; /** * The row header child. Default is <code>null</code>. * @see JScrollPane#setRowHeader */ protected JViewport rowHead; /** * The column header child. Default is <code>null</code>. * @see JScrollPane#setColumnHeader */ protected JViewport colHead; /** * The component to display in the lower left corner. * Default is <code>null</code>. * @see JScrollPane#setCorner */ protected Component lowerLeft; /** * The component to display in the lower right corner. * Default is <code>null</code>. * @see JScrollPane#setCorner */ protected Component lowerRight; /** * The component to display in the upper left corner. * Default is <code>null</code>. * @see JScrollPane#setCorner */ protected Component upperLeft; /** * The component to display in the upper right corner. * Default is <code>null</code>. * @see JScrollPane#setCorner */ protected Component upperRight; /** * The display policy for the vertical scrollbar. * The default is <code>ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED</code>. * <p> * This field is obsolete, please use the <code>JScrollPane</code> field instead. * * @see JScrollPane#setVerticalScrollBarPolicy */ protected int vsbPolicy = VERTICAL_SCROLLBAR_AS_NEEDED; /** * The display policy for the horizontal scrollbar. * The default is <code>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED</code>. * <p> * This field is obsolete, please use the <code>JScrollPane</code> field instead. * * @see JScrollPane#setHorizontalScrollBarPolicy */ protected int hsbPolicy = HORIZONTAL_SCROLLBAR_AS_NEEDED; /** * This method is invoked after the ScrollPaneLayout is set as the * LayoutManager of a <code>JScrollPane</code>. * It initializes all of the internal fields that * are ordinarily set by <code>addLayoutComponent</code>. For example: * <pre> * ScrollPaneLayout mySPLayout = new ScrollPanelLayout() { * public void layoutContainer(Container p) { * super.layoutContainer(p); * // do some extra work here ... * } * }; * scrollpane.setLayout(mySPLayout): * </pre> */ public void syncWithScrollPane(JScrollPane sp) { viewport = sp.getViewport(); vsb = sp.getVerticalScrollBar(); hsb = sp.getHorizontalScrollBar(); rowHead = sp.getRowHeader(); colHead = sp.getColumnHeader(); lowerLeft = sp.getCorner(LOWER_LEFT_CORNER); lowerRight = sp.getCorner(LOWER_RIGHT_CORNER); upperLeft = sp.getCorner(UPPER_LEFT_CORNER); upperRight = sp.getCorner(UPPER_RIGHT_CORNER); vsbPolicy = sp.getVerticalScrollBarPolicy(); hsbPolicy = sp.getHorizontalScrollBarPolicy(); } /** * Removes an existing component. When a new component, such as * the left corner, or vertical scrollbar, is added, the old one, * if it exists, must be removed. * <p> * This method returns <code>newC</code>. If <code>oldC</code> is * not equal to <code>newC</code> and is non-<code>null</code>, * it will be removed from its parent. * * @param oldC the <code>Component</code> to replace * @param newC the <code>Component</code> to add * @return the <code>newC</code> */ protected Component addSingletonComponent(Component oldC, Component newC) { if ((oldC != null) && (oldC != newC)) { oldC.getParent().remove(oldC); } return newC; } /** * Adds the specified component to the layout. The layout is * identified using one of: * <ul> * <li>ScrollPaneConstants.VIEWPORT * <li>ScrollPaneConstants.VERTICAL_SCROLLBAR * <li>ScrollPaneConstants.HORIZONTAL_SCROLLBAR * <li>ScrollPaneConstants.ROW_HEADER * <li>ScrollPaneConstants.COLUMN_HEADER * <li>ScrollPaneConstants.LOWER_LEFT_CORNER * <li>ScrollPaneConstants.LOWER_RIGHT_CORNER * <li>ScrollPaneConstants.UPPER_LEFT_CORNER * <li>ScrollPaneConstants.UPPER_RIGHT_CORNER * </ul> * * @param s the component identifier * @param c the the component to be added * @exception IllegalArgumentException if <code>s</code> is an invalid key */ public void addLayoutComponent(String s, Component c) { if (s.equals(VIEWPORT)) { viewport = (JViewport)addSingletonComponent(viewport, c); } else if (s.equals(VERTICAL_SCROLLBAR)) { vsb = (JScrollBar)addSingletonComponent(vsb, c); } else if (s.equals(HORIZONTAL_SCROLLBAR)) { hsb = (JScrollBar)addSingletonComponent(hsb, c); } else if (s.equals(ROW_HEADER)) { rowHead = (JViewport)addSingletonComponent(rowHead, c); } else if (s.equals(COLUMN_HEADER)) { colHead = (JViewport)addSingletonComponent(colHead, c); } else if (s.equals(LOWER_LEFT_CORNER)) { lowerLeft = addSingletonComponent(lowerLeft, c); } else if (s.equals(LOWER_RIGHT_CORNER)) { lowerRight = addSingletonComponent(lowerRight, c); } else if (s.equals(UPPER_LEFT_CORNER)) { upperLeft = addSingletonComponent(upperLeft, c); } else if (s.equals(UPPER_RIGHT_CORNER)) { upperRight = addSingletonComponent(upperRight, c); } else { throw new IllegalArgumentException("invalid layout key " + s); } } /** * Removes the specified component from the layout. * * @param c the component to remove */ public void removeLayoutComponent(Component c) { if (c == viewport) { viewport = null; } else if (c == vsb) { vsb = null; } else if (c == hsb) { hsb = null; } else if (c == rowHead) { rowHead = null; } else if (c == colHead) { colHead = null; } else if (c == lowerLeft) { lowerLeft = null; } else if (c == lowerRight) { lowerRight = null; } else if (c == upperLeft) { upperLeft = null; } else if (c == upperRight) { upperRight = null; } } /** * Returns the vertical scrollbar-display policy. * * @return an integer giving the display policy * @see #setVerticalScrollBarPolicy */ public int getVerticalScrollBarPolicy() { return vsbPolicy; } /** * Sets the vertical scrollbar-display policy. The options * are: * <ul> * <li>ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED * <li>ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER * <li>ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS * </ul> * Note: Applications should use the <code>JScrollPane</code> version * of this method. It only exists for backwards compatibility * with the Swing 1.0.2 (and earlier) versions of this class. * * @param x an integer giving the display policy * @exception IllegalArgumentException if <code>x</code> is an invalid * vertical scroll bar policy, as listed above */ public void setVerticalScrollBarPolicy(int x) { switch (x) { case VERTICAL_SCROLLBAR_AS_NEEDED: case VERTICAL_SCROLLBAR_NEVER: case VERTICAL_SCROLLBAR_ALWAYS: vsbPolicy = x; break; default: throw new IllegalArgumentException("invalid verticalScrollBarPolicy"); } } /** * Returns the horizontal scrollbar-display policy. * * @return an integer giving the display policy * @see #setHorizontalScrollBarPolicy */ public int getHorizontalScrollBarPolicy() { return hsbPolicy; } /** * Sets the horizontal scrollbar-display policy. * The options are:<ul> * <li>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED * <li>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER * <li>ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS * </ul> * Note: Applications should use the <code>JScrollPane</code> version * of this method. It only exists for backwards compatibility * with the Swing 1.0.2 (and earlier) versions of this class. * * @param x an int giving the display policy * @exception IllegalArgumentException if <code>x</code> is not a valid * horizontal scrollbar policy, as listed above */ public void setHorizontalScrollBarPolicy(int x) { switch (x) { case HORIZONTAL_SCROLLBAR_AS_NEEDED: case HORIZONTAL_SCROLLBAR_NEVER: case HORIZONTAL_SCROLLBAR_ALWAYS: hsbPolicy = x; break; default: throw new IllegalArgumentException("invalid horizontalScrollBarPolicy"); } } /** * Returns the <code>JViewport</code> object that displays the * scrollable contents. * @return the <code>JViewport</code> object that displays the scrollable contents * @see JScrollPane#getViewport */ public JViewport getViewport() { return viewport; } /** * Returns the <code>JScrollBar</code> object that handles horizontal scrolling. * @return the <code>JScrollBar</code> object that handles horizontal scrolling * @see JScrollPane#getHorizontalScrollBar */ public JScrollBar getHorizontalScrollBar() { return hsb; } /** * Returns the <code>JScrollBar</code> object that handles vertical scrolling. * @return the <code>JScrollBar</code> object that handles vertical scrolling * @see JScrollPane#getVerticalScrollBar */ public JScrollBar getVerticalScrollBar() { return vsb; } /** * Returns the <code>JViewport</code> object that is the row header. * @return the <code>JViewport</code> object that is the row header * @see JScrollPane#getRowHeader */ public JViewport getRowHeader() { return rowHead; } /** * Returns the <code>JViewport</code> object that is the column header. * @return the <code>JViewport</code> object that is the column header * @see JScrollPane#getColumnHeader */ public JViewport getColumnHeader() { return colHead; } /** * Returns the <code>Component</code> at the specified corner. * @param key the <code>String</code> specifying the corner * @return the <code>Component</code> at the specified corner, as defined in * {@link ScrollPaneConstants}; if <code>key</code> is not one of the * four corners, <code>null</code> is returned * @see JScrollPane#getCorner */ public Component getCorner(String key) { if (key.equals(LOWER_LEFT_CORNER)) { return lowerLeft; } else if (key.equals(LOWER_RIGHT_CORNER)) { return lowerRight; } else if (key.equals(UPPER_LEFT_CORNER)) { return upperLeft; } else if (key.equals(UPPER_RIGHT_CORNER)) { return upperRight; } else { return null; } } /** * The preferred size of a <code>ScrollPane</code> is the size of the insets, * plus the preferred size of the viewport, plus the preferred size of * the visible headers, plus the preferred size of the scrollbars * that will appear given the current view and the current * scrollbar displayPolicies. * <p>Note that the rowHeader is calculated as part of the preferred width * and the colHeader is calculated as part of the preferred size. * * @param parent the <code>Container</code> that will be laid out * @return a <code>Dimension</code> object specifying the preferred size of the * viewport and any scrollbars * @see ViewportLayout * @see LayoutManager */ public Dimension preferredLayoutSize(Container parent) { /* Sync the (now obsolete) policy fields with the * JScrollPane. */ JScrollPane scrollPane = (JScrollPane)parent; vsbPolicy = scrollPane.getVerticalScrollBarPolicy(); hsbPolicy = scrollPane.getHorizontalScrollBarPolicy(); Insets insets = parent.getInsets(); int prefWidth = insets.left + insets.right; int prefHeight = insets.top + insets.bottom; /* Note that viewport.getViewSize() is equivalent to * viewport.getView().getPreferredSize() modulo a null * view or a view whose size was explicitly set. */ Dimension extentSize = null; Dimension viewSize = null; Component view = null; if (viewport != null) { extentSize = viewport.getPreferredSize(); viewSize = viewport.getViewSize(); view = viewport.getView(); } /* If there's a viewport add its preferredSize. */ if (extentSize != null) { prefWidth += extentSize.width; prefHeight += extentSize.height; } /* If there's a JScrollPane.viewportBorder, add its insets. */ Border viewportBorder = scrollPane.getViewportBorder(); if (viewportBorder != null) { Insets vpbInsets = viewportBorder.getBorderInsets(parent); prefWidth += vpbInsets.left + vpbInsets.right; prefHeight += vpbInsets.top + vpbInsets.bottom; } /* If a header exists and it's visible, factor its * preferred size in. */ if ((rowHead != null) && rowHead.isVisible()) { prefWidth += rowHead.getPreferredSize().width; } if ((colHead != null) && colHead.isVisible()) { prefHeight += colHead.getPreferredSize().height; } /* If a scrollbar is going to appear, factor its preferred size in. * If the scrollbars policy is AS_NEEDED, this can be a little * tricky: * * - If the view is a Scrollable then scrollableTracksViewportWidth * and scrollableTracksViewportHeight can be used to effectively * disable scrolling (if they're true) in their respective dimensions. * * - Assuming that a scrollbar hasn't been disabled by the * previous constraint, we need to decide if the scrollbar is going * to appear to correctly compute the JScrollPanes preferred size. * To do this we compare the preferredSize of the viewport (the * extentSize) to the preferredSize of the view. Although we're * not responsible for laying out the view we'll assume that the * JViewport will always give it its preferredSize. */ if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) { if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) { prefWidth += vsb.getPreferredSize().width; } else if ((viewSize != null) && (extentSize != null)) { boolean canScroll = true; if (view instanceof Scrollable) { canScroll = !((Scrollable)view).getScrollableTracksViewportHeight(); } if (canScroll && (viewSize.height > extentSize.height)) { prefWidth += vsb.getPreferredSize().width; } } } if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) { if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) { prefHeight += hsb.getPreferredSize().height; } else if ((viewSize != null) && (extentSize != null)) { boolean canScroll = true; if (view instanceof Scrollable) { canScroll = !((Scrollable)view).getScrollableTracksViewportWidth(); } if (canScroll && (viewSize.width > extentSize.width)) { prefHeight += hsb.getPreferredSize().height; } } } return new Dimension(prefWidth, prefHeight); } /** * The minimum size of a <code>ScrollPane</code> is the size of the insets * plus minimum size of the viewport, plus the scrollpane's * viewportBorder insets, plus the minimum size * of the visible headers, plus the minimum size of the * scrollbars whose displayPolicy isn't NEVER. * * @param parent the <code>Container</code> that will be laid out * @return a <code>Dimension</code> object specifying the minimum size */ public Dimension minimumLayoutSize(Container parent) { /* Sync the (now obsolete) policy fields with the * JScrollPane. */ JScrollPane scrollPane = (JScrollPane)parent; vsbPolicy = scrollPane.getVerticalScrollBarPolicy(); hsbPolicy = scrollPane.getHorizontalScrollBarPolicy(); Insets insets = parent.getInsets(); int minWidth = insets.left + insets.right; int minHeight = insets.top + insets.bottom; /* If there's a viewport add its minimumSize. */ if (viewport != null) { Dimension size = viewport.getMinimumSize(); minWidth += size.width; minHeight += size.height; } /* If there's a JScrollPane.viewportBorder, add its insets. */ Border viewportBorder = scrollPane.getViewportBorder(); if (viewportBorder != null) { Insets vpbInsets = viewportBorder.getBorderInsets(parent); minWidth += vpbInsets.left + vpbInsets.right; minHeight += vpbInsets.top + vpbInsets.bottom; } /* If a header exists and it's visible, factor its * minimum size in. */ if ((rowHead != null) && rowHead.isVisible()) { Dimension size = rowHead.getMinimumSize(); minWidth += size.width; minHeight = Math.max(minHeight, size.height); } if ((colHead != null) && colHead.isVisible()) { Dimension size = colHead.getMinimumSize(); minWidth = Math.max(minWidth, size.width); minHeight += size.height; } /* If a scrollbar might appear, factor its minimum * size in. */ if ((vsb != null) && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) { Dimension size = vsb.getMinimumSize(); minWidth += size.width; minHeight = Math.max(minHeight, size.height); } if ((hsb != null) && (hsbPolicy != HORIZONTAL_SCROLLBAR_NEVER)) { Dimension size = hsb.getMinimumSize(); minWidth = Math.max(minWidth, size.width); minHeight += size.height; } return new Dimension(minWidth, minHeight); } /** * Lays out the scrollpane. The positioning of components depends on * the following constraints: * <ul> * <li> The row header, if present and visible, gets its preferred * width and the viewport's height. * * <li> The column header, if present and visible, gets its preferred * height and the viewport's width. * * <li> If a vertical scrollbar is needed, i.e. if the viewport's extent * height is smaller than its view height or if the <code>displayPolicy</code> * is ALWAYS, it's treated like the row header with respect to its * dimensions and is made visible. * * <li> If a horizontal scrollbar is needed, it is treated like the * column header (see the paragraph above regarding the vertical scrollbar). * * <li> If the scrollpane has a non-<code>null</code> * <code>viewportBorder</code>, then space is allocated for that. * * <li> The viewport gets the space available after accounting for * the previous constraints. * * <li> The corner components, if provided, are aligned with the * ends of the scrollbars and headers. If there is a vertical * scrollbar, the right corners appear; if there is a horizontal * scrollbar, the lower corners appear; a row header gets left * corners, and a column header gets upper corners. * </ul> * * @param parent the <code>Container</code> to lay out */ public void layoutContainer(Container parent) { /* Sync the (now obsolete) policy fields with the * JScrollPane. */ JScrollPane scrollPane = (JScrollPane)parent; vsbPolicy = scrollPane.getVerticalScrollBarPolicy(); hsbPolicy = scrollPane.getHorizontalScrollBarPolicy(); Rectangle availR = scrollPane.getBounds(); availR.x = availR.y = 0; Insets insets = parent.getInsets(); availR.x = insets.left; availR.y = insets.top; availR.width -= insets.left + insets.right; availR.height -= insets.top + insets.bottom; /* Get the scrollPane's orientation. */ boolean leftToRight = SwingUtilities.isLeftToRight(scrollPane); /* If there's a visible column header remove the space it * needs from the top of availR. The column header is treated * as if it were fixed height, arbitrary width. */ Rectangle colHeadR = new Rectangle(0, availR.y, 0, 0); if ((colHead != null) && (colHead.isVisible())) { int colHeadHeight = Math.min(availR.height, colHead.getPreferredSize().height); colHeadR.height = colHeadHeight; availR.y += colHeadHeight; availR.height -= colHeadHeight; } /* If there's a visible row header remove the space it needs * from the left or right of availR. The row header is treated * as if it were fixed width, arbitrary height. */ Rectangle rowHeadR = new Rectangle(0, 0, 0, 0); if ((rowHead != null) && (rowHead.isVisible())) { int rowHeadWidth = Math.min(availR.width, rowHead.getPreferredSize().width); rowHeadR.width = rowHeadWidth; availR.width -= rowHeadWidth; if ( leftToRight ) { rowHeadR.x = availR.x; availR.x += rowHeadWidth; } else { rowHeadR.x = availR.x + availR.width; } } /* If there's a JScrollPane.viewportBorder, remove the * space it occupies for availR. */ Border viewportBorder = scrollPane.getViewportBorder(); Insets vpbInsets; if (viewportBorder != null) { vpbInsets = viewportBorder.getBorderInsets(parent); availR.x += vpbInsets.left; availR.y += vpbInsets.top; availR.width -= vpbInsets.left + vpbInsets.right; availR.height -= vpbInsets.top + vpbInsets.bottom; } else { vpbInsets = new Insets(0,0,0,0); } /* At this point availR is the space available for the viewport * and scrollbars. rowHeadR is correct except for its height and y * and colHeadR is correct except for its width and x. Once we're * through computing the dimensions of these three parts we can * go back and set the dimensions of rowHeadR.height, rowHeadR.y, * colHeadR.width, colHeadR.x and the bounds for the corners. * * We'll decide about putting up scrollbars by comparing the * viewport views preferred size with the viewports extent * size (generally just its size). Using the preferredSize is * reasonable because layout proceeds top down - so we expect * the viewport to be laid out next. And we assume that the * viewports layout manager will give the view it's preferred * size. One exception to this is when the view implements * Scrollable and Scrollable.getViewTracksViewport{Width,Height} * methods return true. If the view is tracking the viewports * width we don't bother with a horizontal scrollbar, similarly * if view.getViewTracksViewport(Height) is true we don't bother * with a vertical scrollbar. */ Component view = (viewport != null) ? viewport.getView() : null; Dimension viewPrefSize = (view != null) ? view.getPreferredSize() : new Dimension(0,0); Dimension extentSize = (viewport != null) ? viewport.toViewCoordinates(availR.getSize()) : new Dimension(0,0); boolean viewTracksViewportWidth = false; boolean viewTracksViewportHeight = false; boolean isEmpty = (availR.width < 0 || availR.height < 0); Scrollable sv; // Don't bother checking the Scrollable methods if there is no room // for the viewport, we aren't going to show any scrollbars in this // case anyway. if (!isEmpty && view instanceof Scrollable) { sv = (Scrollable)view; viewTracksViewportWidth = sv.getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv.getScrollableTracksViewportHeight(); } else { sv = null; } /* If there's a vertical scrollbar and we need one, allocate * space for it (we'll make it visible later). A vertical * scrollbar is considered to be fixed width, arbitrary height. */ Rectangle vsbR = new Rectangle(0, availR.y - vpbInsets.top, 0, 0); boolean vsbNeeded; if (isEmpty) { vsbNeeded = false; } else if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) { vsbNeeded = true; } else if (vsbPolicy == VERTICAL_SCROLLBAR_NEVER) { vsbNeeded = false; } else { // vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED vsbNeeded = !viewTracksViewportHeight && (viewPrefSize.height > extentSize.height); } if ((vsb != null) && vsbNeeded) { adjustForVSB(true, availR, vsbR, vpbInsets, leftToRight); extentSize = viewport.toViewCoordinates(availR.getSize()); } /* If there's a horizontal scrollbar and we need one, allocate * space for it (we'll make it visible later). A horizontal * scrollbar is considered to be fixed height, arbitrary width. */ Rectangle hsbR = new Rectangle(availR.x - vpbInsets.left, 0, 0, 0); boolean hsbNeeded; if (isEmpty) { hsbNeeded = false; } else if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) { hsbNeeded = true; } else if (hsbPolicy == HORIZONTAL_SCROLLBAR_NEVER) { hsbNeeded = false; } else { // hsbPolicy == HORIZONTAL_SCROLLBAR_AS_NEEDED hsbNeeded = !viewTracksViewportWidth && (viewPrefSize.width > extentSize.width); } if ((hsb != null) && hsbNeeded) { adjustForHSB(true, availR, hsbR, vpbInsets); /* If we added the horizontal scrollbar then we've implicitly * reduced the vertical space available to the viewport. * As a consequence we may have to add the vertical scrollbar, * if that hasn't been done so already. Of course we * don't bother with any of this if the vsbPolicy is NEVER. */ if ((vsb != null) && !vsbNeeded && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) { extentSize = viewport.toViewCoordinates(availR.getSize()); vsbNeeded = viewPrefSize.height > extentSize.height; if (vsbNeeded) { adjustForVSB(true, availR, vsbR, vpbInsets, leftToRight); } } } /* Set the size of the viewport first, and then recheck the Scrollable * methods. Some components base their return values for the Scrollable * methods on the size of the Viewport, so that if we don't * ask after resetting the bounds we may have gotten the wrong * answer. */ if (viewport != null) { viewport.setBounds(availR); if (sv != null) { extentSize = viewport.toViewCoordinates(availR.getSize()); boolean oldHSBNeeded = hsbNeeded; boolean oldVSBNeeded = vsbNeeded; viewTracksViewportWidth = sv. getScrollableTracksViewportWidth(); viewTracksViewportHeight = sv. getScrollableTracksViewportHeight(); if (vsb != null && vsbPolicy == VERTICAL_SCROLLBAR_AS_NEEDED) { boolean newVSBNeeded = !viewTracksViewportHeight && (viewPrefSize.height > extentSize.height); if (newVSBNeeded != vsbNeeded) { vsbNeeded = newVSBNeeded; adjustForVSB(vsbNeeded, availR, vsbR, vpbInsets, leftToRight); extentSize = viewport.toViewCoordinates (availR.getSize()); } } if (hsb != null && hsbPolicy ==HORIZONTAL_SCROLLBAR_AS_NEEDED){ boolean newHSBbNeeded = !viewTracksViewportWidth && (viewPrefSize.width > extentSize.width); if (newHSBbNeeded != hsbNeeded) { hsbNeeded = newHSBbNeeded; adjustForHSB(hsbNeeded, availR, hsbR, vpbInsets); if ((vsb != null) && !vsbNeeded && (vsbPolicy != VERTICAL_SCROLLBAR_NEVER)) { extentSize = viewport.toViewCoordinates (availR.getSize()); vsbNeeded = viewPrefSize.height > extentSize.height; if (vsbNeeded) { adjustForVSB(true, availR, vsbR, vpbInsets, leftToRight); } } } } if (oldHSBNeeded != hsbNeeded || oldVSBNeeded != vsbNeeded) { viewport.setBounds(availR); // You could argue that we should recheck the // Scrollable methods again until they stop changing, // but they might never stop changing, so we stop here // and don't do any additional checks. } } } /* We now have the final size of the viewport: availR. * Now fixup the header and scrollbar widths/heights. */ vsbR.height = availR.height + vpbInsets.top + vpbInsets.bottom; hsbR.width = availR.width + vpbInsets.left + vpbInsets.right; rowHeadR.height = availR.height + vpbInsets.top + vpbInsets.bottom; rowHeadR.y = availR.y - vpbInsets.top; colHeadR.width = availR.width + vpbInsets.left + vpbInsets.right; colHeadR.x = availR.x - vpbInsets.left; /* Set the bounds of the remaining components. The scrollbars * are made invisible if they're not needed. */ if (rowHead != null) { rowHead.setBounds(rowHeadR); } if (colHead != null) { colHead.setBounds(colHeadR); } if (vsb != null) { if (vsbNeeded) { vsb.setVisible(true); vsb.setBounds(vsbR); } else { vsb.setVisible(false); } } if (hsb != null) { if (hsbNeeded) { hsb.setVisible(true); hsb.setBounds(hsbR); } else { hsb.setVisible(false); } } if (lowerLeft != null) { lowerLeft.setBounds(leftToRight ? rowHeadR.x : vsbR.x, hsbR.y, leftToRight ? rowHeadR.width : vsbR.width, hsbR.height); } if (lowerRight != null) { lowerRight.setBounds(leftToRight ? vsbR.x : rowHeadR.x, hsbR.y, leftToRight ? vsbR.width : rowHeadR.width, hsbR.height); } if (upperLeft != null) { upperLeft.setBounds(leftToRight ? rowHeadR.x : vsbR.x, colHeadR.y, leftToRight ? rowHeadR.width : vsbR.width, colHeadR.height); } if (upperRight != null) { upperRight.setBounds(leftToRight ? vsbR.x : rowHeadR.x, colHeadR.y, leftToRight ? vsbR.width : rowHeadR.width, colHeadR.height); } } /** * Adjusts the <code>Rectangle</code> <code>available</code> based on if * the vertical scrollbar is needed (<code>wantsVSB</code>). * The location of the vsb is updated in <code>vsbR</code>, and * the viewport border insets (<code>vpbInsets</code>) are used to offset * the vsb. This is only called when <code>wantsVSB</code> has * changed, eg you shouldn't invoke adjustForVSB(true) twice. */ private void adjustForVSB(boolean wantsVSB, Rectangle available, Rectangle vsbR, Insets vpbInsets, boolean leftToRight) { int oldWidth = vsbR.width; if (wantsVSB) { int vsbWidth = Math.max(0, Math.min(vsb.getPreferredSize().width, available.width)); available.width -= vsbWidth; vsbR.width = vsbWidth; if( leftToRight ) { vsbR.x = available.x + available.width + vpbInsets.right; } else { vsbR.x = available.x - vpbInsets.left; available.x += vsbWidth; } } else { available.width += oldWidth; } } /** * Adjusts the <code>Rectangle</code> <code>available</code> based on if * the horizontal scrollbar is needed (<code>wantsHSB</code>). * The location of the hsb is updated in <code>hsbR</code>, and * the viewport border insets (<code>vpbInsets</code>) are used to offset * the hsb. This is only called when <code>wantsHSB</code> has * changed, eg you shouldn't invoked adjustForHSB(true) twice. */ private void adjustForHSB(boolean wantsHSB, Rectangle available, Rectangle hsbR, Insets vpbInsets) { int oldHeight = hsbR.height; if (wantsHSB) { int hsbHeight = Math.max(0, Math.min(available.height, hsb.getPreferredSize().height)); available.height -= hsbHeight; hsbR.y = available.y + available.height + vpbInsets.bottom; hsbR.height = hsbHeight; } else { available.height += oldHeight; } } /** * Returns the bounds of the border around the specified scroll pane's * viewport. * * @return the size and position of the viewport border * @deprecated As of JDK version Swing1.1 * replaced by <code>JScrollPane.getViewportBorderBounds()</code>. */ @Deprecated public Rectangle getViewportBorderBounds(JScrollPane scrollpane) { return scrollpane.getViewportBorderBounds(); } /** * The UI resource version of <code>ScrollPaneLayout</code>. */ public static class UIResource extends ScrollPaneLayout implements javax.swing.plaf.UIResource {} }
[ "chanh.nguyen@verint.com" ]
chanh.nguyen@verint.com
95aef87a7d54068b1589a588da726bf596b17c6e
e3d5810f8141637115e9e52fbce2c5629b67fecc
/src/main/java/org/sunnycake/aton/exec/CodigoSalida.java
1e6c25b60c74a18aed85fd6d99ec19ab872eb65a
[]
no_license
ProjectAton/Aton
81099aeaaac3aae09fd8449bdc395bb61019c9dd
d666d55937c2177b62bc03214bd03eca1a2dc87a
refs/heads/master
2016-09-10T12:11:50.477295
2016-02-27T23:05:55
2016-02-27T23:05:55
41,938,249
0
0
null
null
null
null
UTF-8
Java
false
false
995
java
package org.sunnycake.aton.exec; /** * Código de salida para la sesión SSH * @author camilo */ public enum CodigoSalida { SUCCESS("Hecho") { @Override boolean apply(int exitCode) { return exitCode == 0; } }, ERROR("Hecho con error") { @Override boolean apply(int exitCode) { return exitCode > 0; } }, NONE("Hecho con estado de salida") { @Override boolean apply(int exitCode) { return exitCode < 0; } }; private String message; CodigoSalida(String message) { this.message = message; } abstract boolean apply(int exitCode); public static CodigoSalida getFor(int exitCode) { for (CodigoSalida status : CodigoSalida.values()) { if (status.apply(exitCode)) { return status; } } return null; } public String message() { return message; } }
[ "sampedro1903@gmail.com" ]
sampedro1903@gmail.com
4a6137d489b192a00f417671b8e3e0e10baaabd0
9254e7279570ac8ef687c416a79bb472146e9b35
/sofa-20190815/src/main/java/com/aliyun/sofa20190815/models/QueryLinkeLinkaCpdResponse.java
2f7291af0e819058b1fc5eb6466184b665598509
[ "Apache-2.0" ]
permissive
lquterqtd/alibabacloud-java-sdk
3eaa17276dd28004dae6f87e763e13eb90c30032
3e5dca8c36398469e10cdaaa34c314ae0bb640b4
refs/heads/master
2023-08-12T13:56:26.379027
2021-10-19T07:22:15
2021-10-19T07:22:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
// This file is auto-generated, don't edit it. Thanks. package com.aliyun.sofa20190815.models; import com.aliyun.tea.*; public class QueryLinkeLinkaCpdResponse extends TeaModel { @NameInMap("headers") @Validation(required = true) public java.util.Map<String, String> headers; @NameInMap("body") @Validation(required = true) public QueryLinkeLinkaCpdResponseBody body; public static QueryLinkeLinkaCpdResponse build(java.util.Map<String, ?> map) throws Exception { QueryLinkeLinkaCpdResponse self = new QueryLinkeLinkaCpdResponse(); return TeaModel.build(map, self); } public QueryLinkeLinkaCpdResponse setHeaders(java.util.Map<String, String> headers) { this.headers = headers; return this; } public java.util.Map<String, String> getHeaders() { return this.headers; } public QueryLinkeLinkaCpdResponse setBody(QueryLinkeLinkaCpdResponseBody body) { this.body = body; return this; } public QueryLinkeLinkaCpdResponseBody getBody() { return this.body; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
45b71b7b1c1f07d1f53261af323eacd3aa1a0bfb
fbb6edab86a555a5508420cb825ef1fd495d0cf8
/src/Cat.java
39489b0bab071c76451b6f6b8095bbab1e54200d
[]
no_license
Marissa1999/Pet-Project-Part-1
87c9ad0b76bbcd567cac0ea3366e871c8bbda482
c54b9977a4d58d64453ae35052f663cc89297138
refs/heads/master
2023-02-16T04:27:34.938296
2021-01-05T00:01:46
2021-01-05T00:01:46
326,837,691
0
0
null
null
null
null
UTF-8
Java
false
false
2,536
java
/** * @author Marissa Gonçalves * Date: March 2, 2018 * Purpose: To extend the super class Pet and to introduce unique methods for the pet cat. */ public class Cat extends Pet { /** * Calls the super class to set the dog's name and initializes the neutered condition of the cat from the called method. * @param name The called name of the pet cat. * @param neutered The neutered condition of the pet cat. */ public Cat (String name, boolean neutered) { super(name); this.neutered = neutered; } /** * Returns true if the pet cat is neutered. * @return The neutered condition of the pet cat. */ public boolean isNeutered() { return this.neutered; } /** * Prints out a statement that the pet cat is purring. */ public void purr() { System.out.println(getName() + " is purring ..."); } /** * Prints out a statement that the pet cat is catching mice. */ public void catchMice() { System.out.println(getName() + " is catching mice ..."); } /** * Calls the toString() method from the super class Pet and completes the statement adding more information about the pet cat. * @return The completed statement, mentioning extra information about the pet cat. */ @Override public String toString() { if (isNeutered()) { return super.toString() + " cat, a neutered cat."; } else { return super.toString() + " cat, an non-neutered cat."; } } /** * Returns true if the variables name, age, gender and neutered variables are all equal to the other variables. * @param other The other Cat object. * @return True, if the super class variables and the neutered variable are all equal to the other variables. */ @Override public boolean equals (Object other) { return super.equals(other) && this.neutered == other.neutered; } /** * Completes the statement from the super class method talk(), which the pet cat speaks. */ @Override public void talk() { super.talk(); System.out.println("Meow Meow Meow!"); } /** * Allows the String result to return the pet cat's words. * @return The String result, pertaining to the cat's speech. */ @Override public String speak() { return ("Meow!"); } }
[ "marissagoncalves13@gmail.com" ]
marissagoncalves13@gmail.com
62cd97ddc82f426b4b008711400b2e54c55da075
fec4a09f54f4a1e60e565ff833523efc4cc6765a
/Dependencies/work/decompile-00fabbe5/net/minecraft/world/level/block/BlockSnow.java
d88ab0dff43db309fea0ad93496317e7059ca93b
[]
no_license
DefiantBurger/SkyblockItems
012d2082ae3ea43b104ac4f5bf9eeb509889ec47
b849b99bd4dc52ae2f7144ddee9cbe2fd1e6bf03
refs/heads/master
2023-06-23T17:08:45.610270
2021-07-27T03:27:28
2021-07-27T03:27:28
389,780,883
0
0
null
null
null
null
UTF-8
Java
false
false
5,791
java
package net.minecraft.world.level.block; import java.util.Random; import javax.annotation.Nullable; import net.minecraft.core.BlockPosition; import net.minecraft.core.EnumDirection; import net.minecraft.server.level.WorldServer; import net.minecraft.world.item.context.BlockActionContext; import net.minecraft.world.level.EnumSkyBlock; import net.minecraft.world.level.GeneratorAccess; import net.minecraft.world.level.IBlockAccess; import net.minecraft.world.level.IWorldReader; import net.minecraft.world.level.World; import net.minecraft.world.level.block.state.BlockBase; import net.minecraft.world.level.block.state.BlockStateList; import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.properties.BlockProperties; import net.minecraft.world.level.block.state.properties.BlockStateInteger; import net.minecraft.world.level.pathfinder.PathMode; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraft.world.phys.shapes.VoxelShapeCollision; import net.minecraft.world.phys.shapes.VoxelShapes; public class BlockSnow extends Block { public static final int MAX_HEIGHT = 8; public static final BlockStateInteger LAYERS = BlockProperties.LAYERS; protected static final VoxelShape[] SHAPE_BY_LAYER = new VoxelShape[]{VoxelShapes.a(), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 10.0D, 16.0D), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 12.0D, 16.0D), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 14.0D, 16.0D), Block.a(0.0D, 0.0D, 0.0D, 16.0D, 16.0D, 16.0D)}; public static final int HEIGHT_IMPASSABLE = 5; protected BlockSnow(BlockBase.Info blockbase_info) { super(blockbase_info); this.k((IBlockData) ((IBlockData) this.stateDefinition.getBlockData()).set(BlockSnow.LAYERS, 1)); } @Override public boolean a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, PathMode pathmode) { switch (pathmode) { case LAND: return (Integer) iblockdata.get(BlockSnow.LAYERS) < 5; case WATER: return false; case AIR: return false; default: return false; } } @Override public VoxelShape a(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return BlockSnow.SHAPE_BY_LAYER[(Integer) iblockdata.get(BlockSnow.LAYERS)]; } @Override public VoxelShape c(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return BlockSnow.SHAPE_BY_LAYER[(Integer) iblockdata.get(BlockSnow.LAYERS) - 1]; } @Override public VoxelShape f(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition) { return BlockSnow.SHAPE_BY_LAYER[(Integer) iblockdata.get(BlockSnow.LAYERS)]; } @Override public VoxelShape b(IBlockData iblockdata, IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return BlockSnow.SHAPE_BY_LAYER[(Integer) iblockdata.get(BlockSnow.LAYERS)]; } @Override public boolean g_(IBlockData iblockdata) { return true; } @Override public boolean canPlace(IBlockData iblockdata, IWorldReader iworldreader, BlockPosition blockposition) { IBlockData iblockdata1 = iworldreader.getType(blockposition.down()); return !iblockdata1.a(Blocks.ICE) && !iblockdata1.a(Blocks.PACKED_ICE) && !iblockdata1.a(Blocks.BARRIER) ? (!iblockdata1.a(Blocks.HONEY_BLOCK) && !iblockdata1.a(Blocks.SOUL_SAND) ? Block.a(iblockdata1.getCollisionShape(iworldreader, blockposition.down()), EnumDirection.UP) || iblockdata1.a((Block) this) && (Integer) iblockdata1.get(BlockSnow.LAYERS) == 8 : true) : false; } @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { return !iblockdata.canPlace(generatoraccess, blockposition) ? Blocks.AIR.getBlockData() : super.updateState(iblockdata, enumdirection, iblockdata1, generatoraccess, blockposition, blockposition1); } @Override public void tick(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { if (worldserver.getBrightness(EnumSkyBlock.BLOCK, blockposition) > 11) { c(iblockdata, (World) worldserver, blockposition); worldserver.a(blockposition, false); } } @Override public boolean a(IBlockData iblockdata, BlockActionContext blockactioncontext) { int i = (Integer) iblockdata.get(BlockSnow.LAYERS); return blockactioncontext.getItemStack().a(this.getItem()) && i < 8 ? (blockactioncontext.c() ? blockactioncontext.getClickedFace() == EnumDirection.UP : true) : i == 1; } @Nullable @Override public IBlockData getPlacedState(BlockActionContext blockactioncontext) { IBlockData iblockdata = blockactioncontext.getWorld().getType(blockactioncontext.getClickPosition()); if (iblockdata.a((Block) this)) { int i = (Integer) iblockdata.get(BlockSnow.LAYERS); return (IBlockData) iblockdata.set(BlockSnow.LAYERS, Math.min(8, i + 1)); } else { return super.getPlacedState(blockactioncontext); } } @Override protected void a(BlockStateList.a<Block, IBlockData> blockstatelist_a) { blockstatelist_a.a(BlockSnow.LAYERS); } }
[ "joseph.cicalese@gmail.com" ]
joseph.cicalese@gmail.com
9d246cdf8dfa79a52e09d13327d8e043e6a7b5f0
21044abbcc3c64469f9ebbb200c4685933f065b8
/Student/src/main/java/cn/gh/service/impl/IUserInfoServiceImpl.java
ed5daa31aa3c2ae05831183f44575eca03ad51fe
[]
no_license
Summergh/gittest
5fe2239e405b00614526544cb16d3cec567bb581
dca199d7f248d7100f6d1b4c27fbcc6d619db9e5
refs/heads/master
2021-03-30T21:19:55.679515
2018-03-10T12:30:13
2018-03-10T12:30:13
124,482,101
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package cn.gh.service.impl; import cn.gh.dao.IUserInfo; import cn.gh.entity.Userinfo; import cn.gh.service.IUserInfoService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** * Created by guo on 2017/9/24. */ @Service("userService") public class IUserInfoServiceImpl implements IUserInfoService{ @Resource(name = "IUserInfo") IUserInfo iUserInfo; public PageInfo<Userinfo> findByPage(Userinfo info, int pageIndex, int pageSize) { PageHelper.startPage(pageIndex, pageSize); List<Userinfo> list = iUserInfo.findByPage(info); return new PageInfo<Userinfo>(list); } }
[ "497903256@qq.com" ]
497903256@qq.com
fd237e0fe1c125ad3c115b96786aa87a09b8ab63
ba9a623e8a4a8e5e24ee1fa5240bda8c2e05e1a2
/src/main/java/com/java/modelo/Resposta.java
1865afc72cb601d9a0bb2f40373864dcc4b4df98
[]
no_license
Eneylton/GestorAvaliacao3
2493a46c1a09858059ffc159eb1c49e07a423b58
09a321696ec30edb02a21c47f213f1abbeb0c906
refs/heads/master
2021-04-15T09:25:53.633161
2018-03-24T16:02:38
2018-03-24T16:02:38
126,615,837
0
0
null
null
null
null
UTF-8
Java
false
false
1,893
java
package com.java.modelo; import java.io.Serializable; public class Resposta implements Serializable { private static final long serialVersionUID = 1L; private Long id; private String resposta; private String pergunta; private Questao questao; private int numeroQuestao; private int questaoID; private int questionario; public int getQuestaoID() { return questaoID; } public void setQuestaoID(int questaoID) { this.questaoID = questaoID; } public int getQuestionario() { return questionario; } public void setQuestionario(int questionario) { this.questionario = questionario; } private int contador; public int getNumeroQuestao() { return numeroQuestao; } public void setNumeroQuestao(int numeroQuestao) { this.numeroQuestao = numeroQuestao; } public int getContador() { return contador; } public void setContador(int contador) { this.contador = contador; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getResposta() { return resposta; } public void setResposta(String resposta) { this.resposta = resposta; } public Questao getQuestao() { return questao; } public void setQuestao(Questao questao) { this.questao = questao; } public String getPergunta() { return pergunta; } public void setPergunta(String pergunta) { this.pergunta = pergunta; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Resposta other = (Resposta) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
[ "eneylton@hotmail.com" ]
eneylton@hotmail.com
1d2be0103078b2d8ed9d0de6ebca8f403043a99f
4894e48e79f321184b12828350d261e713beac9c
/mymvp/src/main/java/mike/mymvp/model/IWeatherModel.java
9ace59e69fd60ab55e9925ad02a32b29482ed37b
[]
no_license
0xcc/android-practice
925c6dd1849d13a400cc0ac2aeb6d27b335465e4
6a5b92a00d7b5d272e2556c349ff96fe42aa4b30
refs/heads/master
2021-01-01T03:33:18.487940
2016-05-16T11:31:11
2016-05-16T11:31:11
58,925,663
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package mike.mymvp.model; import mike.mymvp.presenter.IOnWeatherListener; /** * Created by Administrator on 16-5-6. */ public interface IWeatherModel { void loadWeather(String cityNo,IOnWeatherListener listener); }
[ "bingbaoxie@126.com" ]
bingbaoxie@126.com
4b3655dec8a60fee4c4f5f4ab8388fffd05aa8f9
d8354d86dd03b0498f6a7599ccc3893548ea927f
/finalProject/src/main/java/org/kh/fin/notice/domain/Search.java
fb5a11b5b9ab9faea199136e7414e79249767ade
[]
no_license
seobkim/Final_project
4ffbea10838f6e257e743a396cba150768e00892
05abfe7f8e3d66b879315e2cc8bba1f6d574e222
refs/heads/main
2023-05-30T16:18:42.387380
2021-06-15T08:11:56
2021-06-15T08:11:56
377,006,890
0
0
null
null
null
null
UTF-8
Java
false
false
1,159
java
package org.kh.fin.notice.domain; public class Search { private String searchCondition;//jsp의 값을 담기 위해서 필요하다 ex)title,writer,all,content랑 searchValue값 private String searchValue; private String existFile;//첨부파일이 있는 게시물이 있는지 검색할때 필요 public Search() {} public Search(String searchCondition, String searchValue, String existFile) { super(); this.searchCondition = searchCondition; this.searchValue = searchValue; this.existFile = existFile; } public String getSearchCondition() { return searchCondition; } public void setSearchCondition(String searchCondition) { this.searchCondition = searchCondition; } public String getSearchValue() { return searchValue; } public void setSearchValue(String searchValue) { this.searchValue = searchValue; } public String getExistFile() { return existFile; } public void setExistFile(String existFile) { this.existFile = existFile; } @Override public String toString() { return "Search [searchCondition=" + searchCondition + ", searchValue=" + searchValue + ", existFile=" + existFile + "]"; } }
[ "negga@DESKTOP-O4FRKE2" ]
negga@DESKTOP-O4FRKE2
8702a08f8f6d1567dda56d66f0332bb2d29ccd64
e501c6804a780d52677c0fdbcd33c56b40d6a26e
/app/src/main/java/com/joinyon/houge/activity/MyQRcodeActivity.java
77d80e133c846b726b93e4c98f0cc712ad8687be
[ "Apache-2.0" ]
permissive
MrRobotter/Goreturn
25a894ac89cbd025c8f413bb3eb9017d6e6068e0
26c9b35e381ffecf5d9e18ed4b75aa4790142e6f
refs/heads/master
2020-08-10T01:24:51.381114
2019-11-24T06:42:36
2019-11-24T06:42:36
214,221,230
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
package com.joinyon.houge.activity; import android.os.Bundle; import com.joinyon.houge.R; import com.xusangbo.basemoudle.base.BaseActivity; public class MyQRcodeActivity extends BaseActivity { @Override protected void getBundleExtras(Bundle extras) { } @Override public int getLayoutId() { return R.layout.activity_my_code ; } @Override public void initPresenter() { } @Override public void initView() { } }
[ "2816886869@qq.com" ]
2816886869@qq.com
a67b8a30bd3c107c844491c8e91a4b835100d3ee
fd987e64194b33b1d3ea071d2eb7cdc3f301c209
/src/main/java/com/whd/entity/Student.java
d36720baf33abfee6a7dfaccc0335bdffd310178
[]
no_license
xiaodongdong23333/number
614261f66758c161361e0d74cd43335b6a715e74
4b22f62c1955327f1340cd6d7053acd5b29d03cc
refs/heads/master
2022-01-26T13:55:45.116577
2020-12-05T01:44:47
2020-12-05T01:44:47
183,887,686
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package com.whd.entity; public class Student { private Integer studentId; private String studentName; private String studentDepartment; public Integer getStudentId() { return studentId; } public void setStudentId(Integer studentId) { this.studentId = studentId; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName == null ? null : studentName.trim(); } public String getStudentDepartment() { return studentDepartment; } public void setStudentDepartment(String studentDepartment) { this.studentDepartment = studentDepartment == null ? null : studentDepartment.trim(); } }
[ "xiaodongdong258@outlook.com" ]
xiaodongdong258@outlook.com
b67ddbd3ad7e2148dfdebdecc7505746cbf5dedf
bceba483c2d1831f0262931b7fc72d5c75954e18
/src/qubed/corelogic/AssumabilityBase.java
1563d7f61cfb40ec75403cf1277d9a19839951f0
[]
no_license
Nigel-Qubed/credit-services
6e2acfdb936ab831a986fabeb6cefa74f03c672c
21402c6d4328c93387fd8baf0efd8972442d2174
refs/heads/master
2022-12-01T02:36:57.495363
2020-08-10T17:26:07
2020-08-10T17:26:07
285,552,565
0
1
null
null
null
null
UTF-8
Java
false
false
1,785
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2020.08.05 at 04:46:29 AM CAT // package qubed.corelogic; import javax.xml.bind.annotation.XmlEnum; import javax.xml.bind.annotation.XmlEnumValue; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for AssumabilityBase. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="AssumabilityBase"> * &lt;restriction base="{http://www.mismo.org/residential/2009/schemas}MISMOEnum_Base"> * &lt;enumeration value="AssumableAfterFirstRateChangeDate"/> * &lt;enumeration value="AssumableForLifeOfLoan"/> * &lt;enumeration value="Other"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlType(name = "AssumabilityBase") @XmlEnum public enum AssumabilityBase { @XmlEnumValue("AssumableAfterFirstRateChangeDate") ASSUMABLE_AFTER_FIRST_RATE_CHANGE_DATE("AssumableAfterFirstRateChangeDate"), @XmlEnumValue("AssumableForLifeOfLoan") ASSUMABLE_FOR_LIFE_OF_LOAN("AssumableForLifeOfLoan"), @XmlEnumValue("Other") OTHER("Other"); private final String value; AssumabilityBase(String v) { value = v; } public String value() { return value; } public static AssumabilityBase fromValue(String v) { for (AssumabilityBase c: AssumabilityBase.values()) { if (c.value.equals(v)) { return c; } } throw new IllegalArgumentException(v); } }
[ "vectorcrael@yahoo.com" ]
vectorcrael@yahoo.com
021fbbe13a87dafc502d66c7359ba7a6a7e34d23
8b30c7eb17359d9d2b434a49ab46febb1de4af64
/src/main/java/com/feng/learn/spring/service/UserService.java
97ee14b224546dc254f37205d6576798794764ca
[]
no_license
codeWorldOfFeng/learn-parent
afa15c330e1265489491c957493e7cce9227562b
529c0f430334e1c4d73900bae30403a22937a159
refs/heads/master
2021-01-11T01:31:34.302665
2016-11-24T11:13:51
2016-11-24T11:13:51
70,695,371
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
/** * */ package com.feng.learn.spring.service; import org.springframework.stereotype.Service; /** * @author feng * */ @Service public class UserService { }
[ "18439893075@163.com" ]
18439893075@163.com
251b4489aedea40f5c94d8191ae1f23bf21782a3
cfd5337aa52c90a0b051f25fff46d6a17803c895
/src/com/csei/adapter/MyexpandableListAdapter.java
328757dbadf06177bb147b62b8b20688caebb318
[]
no_license
xiaozhujun/inspect-android
f89b3aadaace638fc23e48965fb464207dd08410
217fca0a84135374ae69450a12239a5dcb049e88
refs/heads/master
2021-01-01T19:25:08.909167
2014-07-24T11:58:52
2014-07-24T11:58:52
21,230,731
1
0
null
null
null
null
UTF-8
Java
false
false
3,051
java
package com.csei.adapter; import java.util.ArrayList; import java.util.List; import org.whut.inspect.R; import android.content.Context; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseExpandableListAdapter; import android.widget.ImageView; import android.widget.TextView; public class MyexpandableListAdapter extends BaseExpandableListAdapter { @SuppressWarnings("unused") private Context context; private LayoutInflater inflater; ArrayList<String> groupList; ArrayList<List<String>> childList; public MyexpandableListAdapter(Context context,ArrayList<String>groupList,ArrayList<List<String>> childList) { this.context = context; this.groupList=groupList; this.childList=childList; inflater = LayoutInflater.from(context); } // ���ظ��б���� public int getGroupCount() { return groupList.size(); } // �������б���� public int getChildrenCount(int groupPosition) { return childList.get(groupPosition).size(); } public Object getGroup(int groupPosition) { return groupList.get(groupPosition); } public Object getChild(int groupPosition, int childPosition) { return childList.get(groupPosition).get(childPosition); } public long getGroupId(int groupPosition) { return groupPosition; } public long getChildId(int groupPosition, int childPosition) { return childPosition; } public boolean hasStableIds() { return true; } public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { GroupHolder groupHolder = null; if (convertView == null) { groupHolder = new GroupHolder(); convertView = inflater.inflate(R.layout.group, null); groupHolder.textView = (TextView) convertView .findViewById(R.id.group); groupHolder.imageView = (ImageView) convertView .findViewById(R.id.image); groupHolder.textView.setTextSize(15); convertView.setTag(groupHolder); } else { groupHolder = (GroupHolder) convertView.getTag(); } groupHolder.textView.setText(getGroup(groupPosition).toString()); if (isExpanded)// ture is Expanded or false is not isExpanded { groupHolder.imageView.setImageResource(R.drawable.expanded); convertView.setBackgroundColor(Color.GRAY); }else{ groupHolder.imageView.setImageResource(R.drawable.collapse); convertView.setBackgroundColor(Color.LTGRAY); } return convertView; } public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { if (convertView == null) { convertView = inflater.inflate(R.layout.item, null); } TextView textView = (TextView) convertView.findViewById(R.id.item); textView.setTextSize(13); textView.setText(getChild(groupPosition, childPosition).toString()); return convertView; } public boolean isChildSelectable(int groupPosition, int childPosition) { return true; } } class GroupHolder { TextView textView; ImageView imageView; }
[ "xiaozhujun520@163.com" ]
xiaozhujun520@163.com
f3842acd645674c6ac9703742623da62b664d018
d58f41b672133a2bb01fd5f72bd82c9edce8b1b8
/app/src/main/java/com/it/fan/mycall/util/SpUtil.java
eeeb4e0690751ca6f9a8eb79a66afda75c59674b
[]
no_license
mjmandroid/MyCall
b33d6ecb15ed180dfa8cbba300aa3b9ad356fd8c
cb94f0f9e7e6446161c4dc47c1b6842ed671e34a
refs/heads/master
2021-04-13T19:51:43.822015
2020-03-22T13:00:48
2020-03-22T13:00:48
249,183,426
0
0
null
null
null
null
UTF-8
Java
false
false
1,857
java
package com.it.fan.mycall.util; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; /** * Created by Administrator on 2016/12/19. */ public class SpUtil { private static final String MYPRO = "myplay"; public static void SaveString(Context context,String key,String value){ SharedPreferences sp = context.getSharedPreferences(MYPRO, Activity.MODE_PRIVATE); Editor editor = sp.edit(); editor.putString(key,value); editor.commit(); } public static String getString(Context context,String key){ SharedPreferences sp = context.getSharedPreferences(MYPRO, Activity.MODE_PRIVATE); String myContent = sp.getString(key, ""); return myContent; } public static void SaveBoolean(Context context,String key,boolean value){ SharedPreferences sp = context.getSharedPreferences(MYPRO, Activity.MODE_PRIVATE); Editor editor = sp.edit(); editor.putBoolean(key,value); editor.commit(); } public static boolean getBoolean(Context context,String key,boolean defaultValue){ SharedPreferences sp = context.getSharedPreferences(MYPRO, Activity.MODE_PRIVATE); boolean myContent = sp.getBoolean(key, defaultValue); return myContent; } public static void SaveInt(Context mcontext, String key, int value) { SharedPreferences sp = mcontext.getSharedPreferences(MYPRO, Activity.MODE_PRIVATE); Editor editor = sp.edit(); editor.putInt(key,value); editor.commit(); } public static int getInt(Context context,String key){ SharedPreferences sp = context.getSharedPreferences(MYPRO, Activity.MODE_PRIVATE); int myContent = sp.getInt(key,0); return myContent; } }
[ "mjmmast2012@163.com" ]
mjmmast2012@163.com
fe706ae1dd80da5c35c9b27e75aaf7b7ce1810f0
0583a185676490c4392ddfb849f3246c584f0249
/src/main/java/com/hbu/live/backed/controller/AnchorController.java
49f157d9b9f89dcf229b281adca185671ee52ec6
[]
no_license
CoqCow/hbu-live-backed
ed00336d618b32484225790959f9188db79b2139
4ea268b9c2a6fc640af5b9536981e413d44eb0d7
refs/heads/master
2020-03-20T19:33:39.023655
2018-07-22T10:28:19
2018-07-22T10:28:19
137,642,997
1
0
null
null
null
null
UTF-8
Java
false
false
682
java
package com.hbu.live.backed.controller; import com.hbu.live.backed.service.AnchorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("anchors") public class AnchorController { @Autowired AnchorService anchorService; @RequestMapping( method = RequestMethod.GET) public ResponseEntity testAnchor(){ return ResponseEntity.ok().body(anchorService.getAnchor()); } }
[ "1004337524@qq.com" ]
1004337524@qq.com
80d8aca9f4f8bad0392ec8aaea4de9972a124738
59a28030b9bbfce8b6c7ad51a9e5cbb7aadc36b9
/QdmKnimeTranslator/src/main/java/edu/phema/jaxb/ihe/svs/NephClinPracticeSetting.java
0e1d98e323e3303b2a80583b94fa2d8eaeec5834
[]
no_license
PheMA/qdm-knime
c3970566c7fe529eefe94a9311d7beeed6d39dc8
fb3e2925a6cd15ebba83ba5fc95bb604a54ff564
refs/heads/master
2020-12-24T14:27:42.708153
2016-05-25T21:42:57
2016-05-25T21:42:57
29,319,651
1
0
null
null
null
null
UTF-8
Java
false
false
1,060
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0.5-b02-fcs // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.12.15 at 03:09:44 PM CST // package edu.phema.jaxb.ihe.svs; import javax.xml.bind.annotation.XmlEnum; /** * <p>Java class for NephClinPracticeSetting. * * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;simpleType name="NephClinPracticeSetting"> * &lt;restriction base="{urn:ihe:iti:svs:2008}cs"> * &lt;enumeration value="NEPH"/> * &lt;enumeration value="PEDNEPH"/> * &lt;/restriction> * &lt;/simpleType> * </pre> * */ @XmlEnum public enum NephClinPracticeSetting { NEPH, PEDNEPH; public String value() { return name(); } public static NephClinPracticeSetting fromValue(String v) { return valueOf(v); } }
[ "thompsow@r1001-lt-100-f.enhnet.org" ]
thompsow@r1001-lt-100-f.enhnet.org
8a8837bf6644aa2895f7dd35704da6ea12aba046
155d7e5c1543f6d102479de8e54527f4b77a1b38
/server-core/src/main/java/io/onedev/server/web/page/admin/issuesetting/integritycheck/CheckIssueIntegrityPage.java
5f3f4acdfc3c8537f34fb964be60fcd62b998341
[ "MIT" ]
permissive
theonedev/onedev
0945cbe8c2ebeeee781ab88ea11363217bf1d0b7
1ec9918988611d5eb284a21d7e94e071c7b48aa7
refs/heads/main
2023-08-22T22:37:29.554139
2023-08-22T14:52:13
2023-08-22T14:52:13
156,317,154
12,162
880
MIT
2023-08-07T02:33:21
2018-11-06T02:57:01
Java
UTF-8
Java
false
false
1,295
java
package io.onedev.server.web.page.admin.issuesetting.integritycheck; import io.onedev.server.web.component.issue.workflowreconcile.WorkflowReconcilePanel; import io.onedev.server.web.component.modal.ModalLink; import io.onedev.server.web.component.modal.ModalPanel; import io.onedev.server.web.page.admin.issuesetting.IssueSettingPage; import org.apache.wicket.Component; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.request.mapper.parameter.PageParameters; public class CheckIssueIntegrityPage extends IssueSettingPage { public CheckIssueIntegrityPage(PageParameters params) { super(params); } @Override protected void onInitialize() { super.onInitialize(); add(new ModalLink("run") { @Override protected Component newContent(String id, ModalPanel modal) { return new WorkflowReconcilePanel(id) { @Override protected void onCancel(AjaxRequestTarget target) { modal.close(); } @Override protected void onCompleted(AjaxRequestTarget target) { setResponsePage(CheckIssueIntegrityPage.class); } }; } }); } @Override protected Component newTopbarTitle(String componentId) { return new Label(componentId, "Check Issue Integrity"); } }
[ "robin@onedev.io" ]
robin@onedev.io
3624c20f1a4f00702c91be837712ea7eb32e44fa
6567f7ac7eed8d213b4b8aa82622b8ddb2cc37eb
/src/com/ase/aseutil/index/HTMLParserConstants.java
437e672912cabcdfec7909245fe5655a04090152
[]
no_license
ttgiang/central
2a9e64244eb7341aab77ad5162fb8ba0b4888eb0
39785a654c739a1b20c87b91cc36a437241495a9
refs/heads/main
2023-02-13T08:28:33.333957
2021-01-08T04:39:52
2021-01-08T04:39:52
313,086,967
0
0
null
null
null
null
UTF-8
Java
false
false
2,980
java
/** * Copyright 2007 Applied Software Engineering, LLC. All rights reserved. You * may not modify, use, reproduce, or distribute this software except in * compliance with the terms of the License made with Applied Software * Engineernig * * @author ttgiang */ // // HTMLParserConstants.java // package com.ase.aseutil.index; /** * Token literal values and constants. * Generated by org.javacc.parser.OtherFilesGen#start() */ public interface HTMLParserConstants { /** End of File. */ int EOF = 0; /** RegularExpression Id. */ int ScriptStart = 1; /** RegularExpression Id. */ int TagName = 2; /** RegularExpression Id. */ int DeclName = 3; /** RegularExpression Id. */ int Comment1 = 4; /** RegularExpression Id. */ int Comment2 = 5; /** RegularExpression Id. */ int Word = 6; /** RegularExpression Id. */ int LET = 7; /** RegularExpression Id. */ int NUM = 8; /** RegularExpression Id. */ int HEX = 9; /** RegularExpression Id. */ int Entity = 10; /** RegularExpression Id. */ int Space = 11; /** RegularExpression Id. */ int SP = 12; /** RegularExpression Id. */ int Punct = 13; /** RegularExpression Id. */ int ScriptText = 14; /** RegularExpression Id. */ int ScriptEnd = 15; /** RegularExpression Id. */ int ArgName = 16; /** RegularExpression Id. */ int ArgEquals = 17; /** RegularExpression Id. */ int TagEnd = 18; /** RegularExpression Id. */ int ArgValue = 19; /** RegularExpression Id. */ int ArgQuote1 = 20; /** RegularExpression Id. */ int ArgQuote2 = 21; /** RegularExpression Id. */ int Quote1Text = 23; /** RegularExpression Id. */ int CloseQuote1 = 24; /** RegularExpression Id. */ int Quote2Text = 25; /** RegularExpression Id. */ int CloseQuote2 = 26; /** RegularExpression Id. */ int CommentText1 = 27; /** RegularExpression Id. */ int CommentEnd1 = 28; /** RegularExpression Id. */ int CommentText2 = 29; /** RegularExpression Id. */ int CommentEnd2 = 30; /** Lexical state. */ int DEFAULT = 0; /** Lexical state. */ int WithinScript = 1; /** Lexical state. */ int WithinTag = 2; /** Lexical state. */ int AfterEquals = 3; /** Lexical state. */ int WithinQuote1 = 4; /** Lexical state. */ int WithinQuote2 = 5; /** Lexical state. */ int WithinComment1 = 6; /** Lexical state. */ int WithinComment2 = 7; /** Literal token values. */ String[] tokenImage = { "<EOF>", "\"<script\"", "<TagName>", "<DeclName>", "\"<!--\"", "\"<!\"", "<Word>", "<LET>", "<NUM>", "<HEX>", "<Entity>", "<Space>", "<SP>", "<Punct>", "<ScriptText>", "<ScriptEnd>", "<ArgName>", "\"=\"", "<TagEnd>", "<ArgValue>", "\"\\\'\"", "\"\\\"\"", "<token of kind 22>", "<Quote1Text>", "<CloseQuote1>", "<Quote2Text>", "<CloseQuote2>", "<CommentText1>", "\"-->\"", "<CommentText2>", "\">\"", }; }
[ "ttgiang@gmail.com" ]
ttgiang@gmail.com
72db715e791f68a1e1bb21f805c72f050855273e
22c191aad32fdf720c20817f1a67744703baa500
/src/main/java/com/wddevelopment/portal/service/MailService.java
83e338d07cd889f2b588dd90caacde8a2e688ffd
[]
no_license
wdraczynski/jhipster-sample-application
e3354b53be2cfb9b8824ac0d0f6163d6b0989ce7
6fa3da10763e6b872862ee03d39cb30ba86ed2ae
refs/heads/master
2023-01-01T22:14:16.137471
2020-10-21T13:25:14
2020-10-21T13:25:14
306,032,563
0
0
null
null
null
null
UTF-8
Java
false
false
4,101
java
package com.wddevelopment.portal.service; import com.wddevelopment.portal.domain.User; import io.github.jhipster.config.JHipsterProperties; import java.nio.charset.StandardCharsets; import java.util.Locale; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.MessageSource; import org.springframework.mail.MailException; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.thymeleaf.context.Context; import org.thymeleaf.spring5.SpringTemplateEngine; /** * Service for sending emails. * <p> * We use the {@link Async} annotation to send emails asynchronously. */ @Service public class MailService { private final Logger log = LoggerFactory.getLogger(MailService.class); private static final String USER = "user"; private static final String BASE_URL = "baseUrl"; private final JHipsterProperties jHipsterProperties; private final JavaMailSender javaMailSender; private final MessageSource messageSource; private final SpringTemplateEngine templateEngine; public MailService( JHipsterProperties jHipsterProperties, JavaMailSender javaMailSender, MessageSource messageSource, SpringTemplateEngine templateEngine ) { this.jHipsterProperties = jHipsterProperties; this.javaMailSender = javaMailSender; this.messageSource = messageSource; this.templateEngine = templateEngine; } @Async public void sendEmail(String to, String subject, String content, boolean isMultipart, boolean isHtml) { log.debug( "Send email[multipart '{}' and html '{}'] to '{}' with subject '{}' and content={}", isMultipart, isHtml, to, subject, content ); // Prepare message using a Spring helper MimeMessage mimeMessage = javaMailSender.createMimeMessage(); try { MimeMessageHelper message = new MimeMessageHelper(mimeMessage, isMultipart, StandardCharsets.UTF_8.name()); message.setTo(to); message.setFrom(jHipsterProperties.getMail().getFrom()); message.setSubject(subject); message.setText(content, isHtml); javaMailSender.send(mimeMessage); log.debug("Sent email to User '{}'", to); } catch (MailException | MessagingException e) { log.warn("Email could not be sent to user '{}'", to, e); } } @Async public void sendEmailFromTemplate(User user, String templateName, String titleKey) { if (user.getEmail() == null) { log.debug("Email doesn't exist for user '{}'", user.getLogin()); return; } Locale locale = Locale.forLanguageTag(user.getLangKey()); Context context = new Context(locale); context.setVariable(USER, user); context.setVariable(BASE_URL, jHipsterProperties.getMail().getBaseUrl()); String content = templateEngine.process(templateName, context); String subject = messageSource.getMessage(titleKey, null, locale); sendEmail(user.getEmail(), subject, content, false, true); } @Async public void sendActivationEmail(User user) { log.debug("Sending activation email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "mail/activationEmail", "email.activation.title"); } @Async public void sendCreationEmail(User user) { log.debug("Sending creation email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "mail/creationEmail", "email.activation.title"); } @Async public void sendPasswordResetMail(User user) { log.debug("Sending password reset email to '{}'", user.getEmail()); sendEmailFromTemplate(user, "mail/passwordResetEmail", "email.reset.title"); } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
8a4f0b1d7aaa6b68223240d456057d9e8ce6b227
9f9624af115bbd94a759eb292fbb98c04faa957a
/QuickControlPanel/src/main/java/com/woodblockwithoutco/fragment/BackButtonPreferenceFragment.java
e8eaa1c26fd405e350176f3d53bacf841e161039
[ "Apache-2.0" ]
permissive
rui-liu/QuickControlPanel
77e8701d16924151350864d65ea581694becd14c
bb49bd588322a30b54220f456abebcdca37934c8
refs/heads/master
2020-12-14T18:49:22.366207
2015-04-14T15:40:35
2015-04-14T15:40:35
33,905,362
0
0
null
2015-04-14T02:07:36
2015-04-14T02:07:35
null
UTF-8
Java
false
false
2,059
java
/******************************************************************************* * Copyright 2014 Alexander Leontyev * * 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.woodblockwithoutco.fragment; import com.woodblockwithoutco.quickcontroldock.R; import android.preference.PreferenceActivity; import android.app.Activity; import android.preference.PreferenceFragment; import android.app.ActionBar; public class BackButtonPreferenceFragment extends PreferenceFragment { @Override public void onResume() { super.onResume(); if(shouldEnableHomeBackButton()) { setBackHomeButtonEnabled(true); } } @Override public void onPause() { super.onPause(); if(shouldEnableHomeBackButton()) { setBackHomeButtonEnabled(false); } } private void setBackHomeButtonEnabled(boolean enabled) { PreferenceActivity a = getPreferenceActivity(); if(a != null) { ActionBar ab = a.getActionBar(); if(ab != null) { ab.setDisplayHomeAsUpEnabled(enabled); ab.setHomeButtonEnabled(enabled); } } } private boolean shouldEnableHomeBackButton() { PreferenceActivity a = getPreferenceActivity(); boolean result = false; if(a != null) { result = !getActivity().getResources().getBoolean(R.bool.is_tablet); } return result; } private PreferenceActivity getPreferenceActivity() { Activity a = getActivity(); if (!(a instanceof PreferenceActivity)) { return null; } return (PreferenceActivity) a; } }
[ "aleksandr@MacBook-Pro-Aleksandr-2.local" ]
aleksandr@MacBook-Pro-Aleksandr-2.local
aa6893fd3ff7d3760aab4b9163630bf04ad1795e
852e1235262aaafeaeae8a1e4255605c3f8cfe94
/cucumber/src/test/java/continuum_automation/cucumber/stepDefinations/DashBoardStepDefinations.java
76702d2bbc623f638e4963f0f255acfc427d30c0
[]
no_license
SanjotMansukh-Continuum/BDTCucumberAutomation
396c97d6b5adc475daf884821494629dde268eb5
4b94d88d47cefa0a1ba11b7da2f6c87d215d021e
refs/heads/master
2021-06-06T10:42:33.558465
2016-08-12T13:14:35
2016-08-12T13:14:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,149
java
package continuum_automation.cucumber.stepDefinations; import continuum_automation.cucumber.Page.PageFactory; import cucumber.api.PendingException; import cucumber.api.java.en.Given; import cucumber.api.java.en.Then; import cucumber.api.java.en.When; public class DashBoardStepDefinations extends PageFactory { @Given("^User can Login to ITS portal \"([^\"]*)\" and \"([^\"]*)\"$") public void user_can_Login_to_ITS_portal(String emailId, String pwd) throws Throwable { loginPage.loginToITSPortal(emailId, pwd); } @When("^User should navigate to QuickAccess->Site -> Server$") public void user_should_navigate_to_QuickAccess_Site_Server() throws Throwable { quickAccessPage.navigatetoQuickAccess(); } @Then("^Validate details of server table from Datasheet \"([^\"]*)\"$") public void validate_details_of_server_table(String Datasheet) throws Throwable { quickAccessPage.verifyServerInformation(Datasheet); } @Then("^ Validate total server count$") public void validateServerCount() throws Throwable { // Write code here that turns the phrase above into concrete actions throw new PendingException(); } }
[ "sneha.chemburkar@continuum.net" ]
sneha.chemburkar@continuum.net
91e5b2ece6a07153e0d8f04aa636e171ad936dbc
dd4ac58d65ce75f9071dc30a449365d14d1b0d9e
/Tp SOLID/src/banco/SolicitudCreditoPersonal.java
c2964bede8e7bd8e80dc9220d5ff98e402072766
[]
no_license
BrianMCiszewskiA/unqui-po2-ciszewski
552b445da2522a8fc89c39126e67eb9705e657d9
32608d3010aa1c8c091b364723647adc2974a678
refs/heads/main
2023-06-16T12:06:10.923217
2021-07-01T17:52:38
2021-07-01T17:52:38
357,661,443
0
0
null
null
null
null
UTF-8
Java
false
false
947
java
package banco; public class SolicitudCreditoPersonal extends SolicitudCredito{ private float ingresosAnualesRequeridos = 15000; private int porcentajeIngresosMensualesRequerido = 70; public SolicitudCreditoPersonal(Cliente cliente, float monto, int meses) { super(cliente, monto, meses); } @Override public boolean realizarCheckeo() { return this.cubreIngresosAnuales() && this.noSuperaPorcentajeIngresosMensuales(); } private boolean cubreIngresosAnuales() { //devuelve si el cliente tiene al menos la cantidad necesaria de ingresos anuales return this.getCliente().getSueldoNetoAnual() >= this.ingresosAnualesRequeridos; } private boolean noSuperaPorcentajeIngresosMensuales() { //devuelve si el monto de la cuota no supera en el porcentaje dado de los ingresos mensuales del cliente return this.getCliente().getPorcentajeIngresosMensuales(this.porcentajeIngresosMensualesRequerido) >= this.getMontoMensual(); } }
[ "brianmciszewski@hotmail.com.ar" ]
brianmciszewski@hotmail.com.ar
96f09dea308491304b3970202a5962de45a578e4
8d96b9216f3f820713585253c1dadf5548ea2a10
/oneauth-server/src/main/java/io/spring2go/oneauth/dao/entity/util/JSR310PersistenceConverters.java
db3001764b2628b245357530c4f4cdf0162a9211
[ "MIT" ]
permissive
foreverget/oneauth
1bb1b511a888db24e75692530e8b16c60115873d
b949e0d37c650089ff498aa1776c2d9abb573add
refs/heads/master
2020-04-11T20:07:32.669553
2018-06-14T13:03:26
2018-06-14T13:03:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,889
java
package io.spring2go.oneauth.dao.entity.util; import javax.persistence.AttributeConverter; import javax.persistence.Converter; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZonedDateTime; import java.util.Date; public final class JSR310PersistenceConverters { private JSR310PersistenceConverters() { } @Converter(autoApply = true) public static class LocalDateConverter implements AttributeConverter<LocalDate, java.sql.Date> { @Override public java.sql.Date convertToDatabaseColumn(LocalDate date) { return date == null ? null : java.sql.Date.valueOf(date); } @Override public LocalDate convertToEntityAttribute(java.sql.Date date) { return date == null ? null : date.toLocalDate(); } } @Converter(autoApply = true) public static class ZonedDateTimeConverter implements AttributeConverter<ZonedDateTime, Date> { @Override public Date convertToDatabaseColumn(ZonedDateTime zonedDateTime) { return JSR310DateConverters.ZonedDateTimeToDateConverter.INSTANCE.convert(zonedDateTime); } @Override public ZonedDateTime convertToEntityAttribute(Date date) { return JSR310DateConverters.DateToZonedDateTimeConverter.INSTANCE.convert(date); } } @Converter(autoApply = true) public static class LocalDateTimeConverter implements AttributeConverter<LocalDateTime, Date> { @Override public Date convertToDatabaseColumn(LocalDateTime localDateTime) { return JSR310DateConverters.LocalDateTimeToDateConverter.INSTANCE.convert(localDateTime); } @Override public LocalDateTime convertToEntityAttribute(Date date) { return JSR310DateConverters.DateToLocalDateTimeConverter.INSTANCE.convert(date); } } }
[ "51startup@sina.com" ]
51startup@sina.com
81ea7f49174404453727efb881e8a715b030d403
f82d335dc890b1a342629ca6bba42e35bf89fa32
/flink/src/main/java/terasort/FlinkTeraOutputFormat.java
e840a7e179e192f281aeb376244820956087756e
[]
no_license
fagan2888/exp-bigdata16
f71316feac0e13b33f08c6bb0846bcb60f2c55d1
804378d4d7a5154c37cb4f5e8d3810d8b2a5f181
refs/heads/master
2020-12-18T19:19:40.827983
2017-09-11T12:20:26
2017-09-11T12:20:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,080
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package terasort; import java.io.IOException; import org.apache.flink.api.java.record.io.FileOutputFormat; import org.apache.flink.types.Record; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.hadoop.io.Text; /** * The class is responsible for converting a two field record back into a line which is afterward written back to disk. * Each line ends with a newline character. * */ public abstract class FlinkTeraOutputFormat extends FileOutputFormat{ private static final long serialVersionUID = 1L; /** * A buffer to store the line which is about to be written back to disk. */ private final byte[] buffer = new byte[100]; @Override public void writeRecord(Record record) throws IOException { this.stream.write(buffer, 0, buffer.length); } /* @Override */ /* public void writeRecord(Tuple2<Text, Text> record) throws IOException { */ /* byte[] keyByteArray = record.getField(0).toString().getBytes(); */ /* for(int i = 0; i < 10; ++i) this.buffer[i] = keyByteArray[i]; */ /* */ /* byte[] valueByteArray = record.getField(1).toString().getBytes(); */ /* for(int i = 0; i < 90; ++i) this.buffer[i + 10] = keyByteArray[i]; */ /* this.stream.write(buffer, 0, buffer.length); */ /* } */ }
[ "lijinf8@gmail.com" ]
lijinf8@gmail.com
9fc55e2cb84d9c8b36105651d3ac236c3c289570
d8a1ebdb1dbb0d12fcba2f6d14e08866de1295c6
/src/classes/BooleanFactor.java
50a2d12da1ba3317fa06e2defbc50bd10e1af9f8
[]
no_license
ujraaja/CS-DB-impl
587d27e6c44a44880debf63270d8cca666b128b8
100a45814d34fd2abb9d4f0a0ae33647bcb97654
refs/heads/master
2021-01-12T08:42:07.105827
2016-12-16T16:39:44
2016-12-16T16:39:44
76,669,037
1
0
null
null
null
null
UTF-8
Java
false
false
123
java
package classes; public class BooleanFactor { public Expression expression1, expression2; public char operator; }
[ "ujraaja@gmail.com" ]
ujraaja@gmail.com
77aeda318784e7c16376b65113832b00a3274d21
a5b293ec43c35ae1ecaa2c6be661fc396d2462fa
/src/main/java/com/zwl/classManager/controller/ClainfoController.java
4f7a8a61271184072b1a6c2667fb6028eeb48409
[]
no_license
lcc214321/saas-cloud-admin
a66b77ae7bc651c6cba6393244b33af414f7dcae
592ef7397b1803a8e9c30648613f222dda038253
refs/heads/master
2020-07-13T14:37:46.638948
2019-01-27T05:41:56
2019-01-27T05:41:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,694
java
package com.zwl.classManager.controller; import com.zwl.classManager.domain.ClaSetItemVo; import com.zwl.classManager.domain.ClainfoDO; import com.zwl.classManager.domain.ClassCategoryItemVo; import com.zwl.classManager.service.ClainfoService; import com.zwl.classManager.service.ClasetService; import com.zwl.classManager.service.ClassCategoryService; import com.zwl.classManager.service.GzhService; import com.zwl.common.utils.*; import lombok.extern.slf4j.Slf4j; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author ${author} * @email 382308664@qq.com * @date 2018-08-28 21:17:13 */ @Controller @RequestMapping("/classManager/claInfo") @Slf4j public class ClainfoController { @Autowired private ClainfoService clainfoService; @Autowired private ClasetService clasetService; @Autowired private GzhService gzhService; @Autowired private ClassCategoryService classCategoryService; @GetMapping() @RequiresPermissions("classInfo:classInfo") String Clainfo() { return "classManager/clainfo/clainfo"; } @ResponseBody @GetMapping("/list") @RequiresPermissions("classInfo:list") public PageUtils list(@RequestParam Map<String, Object> params) { String merchantId = ShiroUtils.getMerchantId(); params.put("merchantId", merchantId); //查询列表数据 Query query = new Query(params); List<ClainfoDO> clainfoList = clainfoService.list(query); //查询所有一级分类列表,放在classCategoryMap中 List<ClassCategoryItemVo> classCategoryList = classCategoryService.getClassCategoryItemList(merchantId); Map classCategoryMap = new HashMap(); Map setMap = new HashMap(); for (ClassCategoryItemVo classCategoryItemVo : classCategoryList) { if (null == classCategoryItemVo) continue; classCategoryMap.put("" + classCategoryItemVo.getId(), classCategoryItemVo.getTitle()); //查询每个一级分类下所有二级分类列表,放在setMap中 List<ClaSetItemVo> clasetDOList = clasetService.getClassSetItemList(classCategoryItemVo.getId(), merchantId); for (ClaSetItemVo claSetItemVo : clasetDOList) { if (claSetItemVo == null) continue; setMap.put("" + claSetItemVo.getId(), claSetItemVo.getTitle()); } } for (ClainfoDO clainfoDO : clainfoList) { Integer claSetId = clainfoDO.getClassSetId(); Integer categoryId = clainfoDO.getCategoryId(); if (categoryId != null) { //该节课的一级分类id如果在classCategoryMap这个一级分类列表中,则设置该节课的一级分类名称 clainfoDO.setCategoryName(classCategoryMap.containsKey("" + categoryId) ? classCategoryMap.get("" + categoryId).toString() : ""); } if (claSetId != null) { //该节课的二级分类id如果在setMap这个二级分类列表中,则设置该节课的二级分类名称 clainfoDO.setClaSetName(setMap.containsKey("" + claSetId) ? setMap.get("" + claSetId).toString() : ""); } } int total = clainfoService.count(query); PageUtils pageUtils = new PageUtils(clainfoList, total); return pageUtils; } @GetMapping("/add") @RequiresPermissions("classInfo:add") String add(Model model) { String merchantId = ShiroUtils.getMerchantId(); model.addAttribute("merchantId", merchantId); return "classManager/clainfo/add"; } @GetMapping("/edit/{id}") @RequiresPermissions("classInfo:edit") String edit(@PathVariable("id") Long id, Model model) { ClainfoDO clainfo = clainfoService.get(id); Integer playTime = clainfo.getPlayTime(); if (null != playTime) { Integer minute = playTime / 60; Integer second = playTime % 60; clainfo.setMinute(minute); clainfo.setSecond(second); } model.addAttribute("clainfo", clainfo); return "classManager/clainfo/edit"; } /** * 信息 */ @RequestMapping("/info/{id}") @RequiresPermissions("classInfo:info") public R info(@PathVariable("id") Long id) { ClainfoDO clainfo = clainfoService.get(id); return R.ok().put("clainfo", clainfo); } /** * 保存 */ @ResponseBody @PostMapping("/save") //@RequiresPermissions("classInfo:save") public R save(ClainfoDO clainfo) { clainfo.setMerchantId(ShiroUtils.getMerchantId()); Integer minute = clainfo.getMinute(); Integer second = clainfo.getSecond(); if (null != minute && null != second) { Integer playTime = minute * 60 + second; clainfo.setPlayTime(playTime); } if (clainfoService.save(clainfo) > 0) { String className = clainfo.getTitle(); String merchantId = clainfo.getMerchantId(); Integer classSetId = clainfo.getClassSetId(); String classType = clasetService.getClassNameByClassSet(classSetId); String teacherName = "渠道革命"; SimpleDateFormat sdf_yMdHms = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); gzhService.sendGzhMsgByAll(className, classType, teacherName, sdf_yMdHms.format(new Date()), merchantId); //同步刷新或者删除对应的rediskey getClassSetList getClassSetDetailByClassSetId RedisUtil.del("getClassSetList"); RedisUtil.del("getClassSetDetailByClassSetId"); return R.ok(); } return R.error(); } /** * 修改 */ @RequestMapping("/update") @ResponseBody //@RequiresPermissions("classInfo:update") public R update(@ModelAttribute ClainfoDO clainfo) { Integer minute = clainfo.getMinute(); Integer second = clainfo.getSecond(); if (null != minute && null != second) { Integer playTime = minute * 60 + second; clainfo.setPlayTime(playTime); } clainfoService.update(clainfo); //同步刷新或者删除对应的rediskey getClassSetList getClassSetDetailByClassSetId RedisUtil.del("getClassSetList"); RedisUtil.del("getClassSetDetailByClassSetId"); return R.ok(); } /** * 删除 */ @PostMapping("/remove") @ResponseBody @RequiresPermissions("classInfo:remove") public R remove(Long id) { if (clainfoService.remove(id) > 0) { //同步刷新或者删除对应的rediskey getClassSetList getClassSetDetailByClassSetId RedisUtil.del("getClassSetList"); RedisUtil.del("getClassSetDetailByClassSetId"); return R.ok(); } return R.error(); } /** * 删除 */ @PostMapping("/batchRemove") @ResponseBody @RequiresPermissions("classInfo:remove") public R remove(@RequestParam("ids[]") Long[] ids) { clainfoService.batchRemove(ids); //同步刷新或者删除对应的rediskey getClassSetList getClassSetDetailByClassSetId RedisUtil.del("getClassSetList"); RedisUtil.del("getClassSetDetailByClassSetId"); return R.ok(); } }
[ "382308664@qq.com" ]
382308664@qq.com
ba8e6c90cdbc8dbb1d30c59cfa8afdd127d98806
b9a48a673dab446d6661c670f2cd4688144fdf53
/project10/src/project10/Product.java
a82786a4c2b7cb867fef96cc39d0ad0eaf291d18
[]
no_license
HyeongRae/-
2436fc1224d57a7859f3f923b68d1e1a7f05209a
ae3e1f2c502d19a76289ad2d4ebe41b7346a9380
refs/heads/master
2021-01-12T22:16:24.514396
2018-05-20T08:02:34
2018-05-20T08:02:34
68,688,577
0
0
null
null
null
null
UHC
Java
false
false
268
java
package project10; public abstract class Product { String pname; int price; public void printDetail() { System.out.print("상품명: " + pname + " , "); System.out.print("가격: " + price + " , "); printExtra(); } public abstract void printExtra(); }
[ "gudfo19950@naver.com" ]
gudfo19950@naver.com
90ae80cea7cc73c413703350c2114844c683d802
f3d2a55a73dc2145c67c06995e269f5bd7692571
/src/main/java/com/company/infrastructure/config/ConfigurationManager.java
65c6c7e78ceee1eafbda5aed30ded563dbf4dd36
[]
no_license
Ivanenko16/Structure
168ed6200b7647ce5dcc7e717e2928f3ad31dc11
cfca34057530f15b0c0c98cf0f6f598d14931a1c
refs/heads/master
2020-05-02T20:38:02.899299
2019-03-28T12:13:04
2019-03-28T12:13:04
178,197,845
0
0
null
null
null
null
UTF-8
Java
false
false
927
java
package com.company.infrastructure.config; public final class ConfigurationManager { private static ConfigurationManager instance; private ConfigurationManager() { } public static synchronized ConfigurationManager getInstance() { if (instance == null) { instance = new ConfigurationManager(); } return instance; } public String getTestBrowser() { return getEnvironmentVariableOrDefault("testBrowser", "chrome"); } public String getTestEnv() { return getEnvironmentVariableOrDefault("testEnvironment", "production"); } public String getRunOn() { return getEnvironmentVariableOrDefault("runOn", "local"); } private String getEnvironmentVariableOrDefault(String envVariable, String defaultValue) { return System.getenv(envVariable) !=null ? System.getenv(envVariable) : defaultValue; } }
[ "as.ivanenko16@gmail.com" ]
as.ivanenko16@gmail.com
ec8bf212a9d4c2d1665e281436e45fd86e16a146
ebf4c6795106c4bb08c828dd0a1c7d53b82cca42
/eureka-oauth2-server/src/main/java/com/company/OAuthServer.java
5d5dab081c7e56cd68fea908385dfa9391782cd2
[]
no_license
zth390872451/example-01
d6ed9765ebc3e55e1926adfb6f0e605fda01b164
6d55e07f400d8debd0e90dcb3baf40d4cd58a896
refs/heads/master
2021-04-26T06:18:58.303849
2016-12-14T09:41:44
2016-12-14T09:41:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,033
java
package com.company; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * 认证服务器 */ @RestController //@SpringBootApplication(exclude = {SecurityAutoConfiguration.class }) @EnableAuthorizationServer @EnableDiscoveryClient @SpringBootApplication public class OAuthServer { private static Logger log = LoggerFactory.getLogger(OAuthServer.class); @RequestMapping("/home") public String home() { log.info("Handling home"); return "Hello World"; } public static void main(String[] args) { SpringApplication.run(OAuthServer.class, args); } }
[ "zth390872451@gmail.com" ]
zth390872451@gmail.com
e0675089050b99cb30fe31133199098cae92630a
475d585db25f716c433d47927df22b0680e0695b
/quackplugin/Grammar-Kit/gen/generated/psi/ClassSigBody.java
684ddc36744df95162a504b0ba6b7907d470cf33
[ "Apache-2.0" ]
permissive
mamtajakter/quack-plugin
89ffb82c3585f0c7617f81dcb48727292a72e6fb
3d9bda0ddbe8100a0d1f6af5dd583567f16484de
refs/heads/master
2020-09-06T22:22:54.677174
2019-11-09T00:34:23
2019-11-09T00:34:23
null
0
0
null
null
null
null
UTF-8
Java
false
true
326
java
// This is a generated file. Not intended for manual editing. package generated.psi; import java.util.List; import org.jetbrains.annotations.*; import com.intellij.psi.PsiElement; public interface ClassSigBody extends PsiElement { @NotNull ClassBody getClassBody(); @NotNull ClassSignature getClassSignature(); }
[ "mamtajakter@Mamtajs-MacBook-Pro.local" ]
mamtajakter@Mamtajs-MacBook-Pro.local
61b004ad74ff44a2e7f6bc629f3ce720fe6117e9
41e0f6c2c5451440aab232e389ea92a43370df91
/ChildAnimalShadow/gen/com/childanimal/BuildConfig.java
80e5239885d10f129faf6e388b384d0b481e0e3b
[]
no_license
yangjinbo2014/ChildDemo
cb1e3b7df303eb82d179b7fd74df3aec92e34b8c
114d2eaab84f982f85aebd18a63442c014fbfabd
refs/heads/master
2021-01-18T17:08:57.780120
2014-04-19T14:37:46
2014-04-19T14:37:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
157
java
/** Automatically generated file. DO NOT MODIFY */ package com.childanimal; public final class BuildConfig { public final static boolean DEBUG = true; }
[ "fuminwen@qq.com" ]
fuminwen@qq.com
fd7c1597d97744d85db39f414ca3d52fba32e793
a674537c5150a6e209e38ecf20378bcf4b658590
/JULY19/src/CCC.java
239002272062b4655035ad053c8f965d2a5a8895
[]
no_license
vatsin1810/CodeChef
92ad8e4c54a189dea6ca6b32e32bd376ede40587
766bf1120df2e054198952db940c437ba80f032c
refs/heads/master
2020-08-15T15:14:04.490442
2019-10-31T01:16:22
2019-10-31T01:16:22
215,362,105
0
0
null
null
null
null
UTF-8
Java
false
false
3,018
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.PriorityQueue; import java.util.StringTokenizer; public class CCC { static class FastReader { BufferedReader br; StringTokenizer st; public FastReader() { br = new BufferedReader(new InputStreamReader(System.in)); } String next() { while (st == null || !st.hasMoreElements()) { try { st = new StringTokenizer(br.readLine()); } catch (IOException e) { e.printStackTrace(); } } return st.nextToken(); } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { String str = ""; try { str = br.readLine(); } catch (IOException e) { e.printStackTrace(); } return str; } } static class comp implements Comparator<Integer> { @Override public int compare(Integer o1, Integer o2) { return o2 - o1; } } public static void main(String[] args) { FastReader f = new FastReader(); int t = f.nextInt(); while (t-- > 0) { int n = f.nextInt(); int z = f.nextInt(); ArrayList<Integer> a = new ArrayList<>(); for (int i = 0; i < n; i++) { a.add(f.nextInt()); } Collections.sort(a); int min = Integer.MAX_VALUE; for (int i = z - 1; i < n; i++) { int total = 0; total += (n - i) * a.get(i); for (int j = i - z + 1; j < i; j++) { total += a.get(i); } if (total < min) { min = total; } } System.out.println(min); // PriorityQueue<Integer> pq = new PriorityQueue<>(new comp()); // for (int i = 0; i < z; i++) { // pq.add(f.nextInt()); // } // for (int i = z; i < n; i++) { // int x = f.nextInt(); // if (x < pq.peek()) { // pq.poll(); // pq.add(x); // } // } // int max = pq.peek(); // int total = 0; // while (!pq.isEmpty()) { // total += pq.poll(); // } // total += max * (n - z); // System.out.println(total); } } }
[ "noreply@github.com" ]
vatsin1810.noreply@github.com
089545c08a82309f967bdb530fd299df17b42259
89b2aed0cc18acf4e99e28a618b7e7be423e43d0
/erp/erp-service-impl/src/main/java/com/kaishengit/erp/mapper/ServerService.java
c0b6ea7adf0817daf0413a7868fd490b6ddf53ad
[]
no_license
liuyan9227/idea
cdba58b5445e99f3be0c0f9b9982a06367b55f76
6b923511f1e77c400ae14a69d6f3f36236d791cd
refs/heads/master
2020-03-24T05:54:29.251528
2018-10-13T11:47:04
2018-10-13T17:30:21
142,507,677
0
0
null
null
null
null
UTF-8
Java
false
false
381
java
package com.kaishengit.erp.mapper; import com.kaishengit.erp.entity.Employee; /** * @author liuyan * @date 2018/8/7 */ public interface ServerService { /** * 添加维修人员领取表单的关联关系表 * @param orderId 领取表单ID * @param employee 当前登录员工 */ void saveOrderWithEmployee(Integer orderId, Employee employee); }
[ "liuyan9227@163.com" ]
liuyan9227@163.com
d0cd77edbbfd3166dd20a778664ae03dcda1421d
0796f45451453b977ae7e42644ec8fb8e545095f
/app/src/androidTest/java/co/smallacademy/fullauthentication/ExampleInstrumentedTest.java
b7eb7fe57055d4c3706d8456b2f8c0b05f67f1fe
[]
no_license
bikashthapa01/email-and-phone-authentication-firebase
1b8eca46588b3285f15fcfa8741837a97e01f9ad
4978c5df2ad56131dee20db528f23373bf2551a5
refs/heads/master
2022-12-17T07:48:21.018547
2020-09-18T10:10:04
2020-09-18T10:10:04
296,584,895
11
5
null
null
null
null
UTF-8
Java
false
false
782
java
package co.smallacademy.fullauthentication; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("co.smallacademy.fullauthentication", appContext.getPackageName()); } }
[ "thapabikash48@gmail.com" ]
thapabikash48@gmail.com
7044ba4b4821318f9df5afc47a6f622575303c71
c57a21b27ed2b1845f33341713c375213ac57e73
/src/main/java/com/miniapp/cardealer/models/viewModels/CustomerView.java
8d474c1f1713825c506a9cfe5497b11229c26062
[]
no_license
cologneto/CarDealer
53365d4817e3b488b44cf82cbcf5c7211d0b35e8
2e00267f5877f577deec93df0bf74baee61b793d
refs/heads/master
2021-05-12T08:00:32.339403
2018-01-15T17:06:47
2018-01-15T17:06:47
117,265,431
0
0
null
null
null
null
UTF-8
Java
false
false
790
java
package com.miniapp.cardealer.models.viewModels; import java.util.Date; public class CustomerView { private Long id; private String name; private Date birthDate; private Boolean isYoungDriver; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Date getBirthDate() { return birthDate; } public void setBirthDate(Date birthDate) { this.birthDate = birthDate; } public Boolean getIsYoungDriver() { return isYoungDriver; } public void setIsYoungDriver(Boolean youngDriver) { isYoungDriver = youngDriver; } }
[ "georgi.tsanev@dechit.it" ]
georgi.tsanev@dechit.it
9d19e5f87315c345950bc38375fbabd0dc10694f
e83a57276c4d7e7fe09a20e874ae68cbf73fb4fd
/src/br/com/fip/praticas/questao03/Anexo.java
8413c513ff309e3443c684971d69b2c51b9bb29e
[]
no_license
GustavoWanderley/Pr-ticas
169049012a9bbf9178cae57eb115cb279449ac0b
a98f5c2c3bbc208d3f01d3e5695c0669cfe38e55
refs/heads/master
2021-01-10T20:13:40.391128
2014-02-20T22:54:48
2014-02-20T22:54:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,416
java
package br.com.fip.praticas.questao03; public class Anexo { private String nome; private String textoEmail; public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public String getTextoEmail() { return textoEmail; } public void setTextoEmail(String textoEmail) { this.textoEmail = textoEmail; } public boolean contains (String parametro){ if (textoEmail.contains(parametro)) return true; else return false; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((textoEmail == null) ? 0 : textoEmail.hashCode()); result = prime * result + ((nome == null) ? 0 : nome.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Anexo other = (Anexo) obj; if (textoEmail == null) { if (other.textoEmail != null) return false; } else if (!textoEmail.equals(other.textoEmail)) return false; if (nome == null) { if (other.nome != null) return false; } else if (!nome.equals(other.nome)) return false; return true; } public String toString() { return "Anexo [nome : " + nome + ", textoEmail : " + textoEmail + "]"; } }
[ "gustavowanderley@ffm.com.br" ]
gustavowanderley@ffm.com.br
b3acbcb519131c3ff9ee88611e4620086ec6507d
332e2e231e47100ccf751ac3c242bd851e546cf8
/src/InterfaceDemoDefaultMethod.java
ac361c741b3be7819bc2e3f15d74d43282326ecd
[]
no_license
ranamislam/javaproject
de997ce9ee9647e129f81eb8d5a3240115a45a23
2713c47aa404f89487ffe29b906be7e39f7dcabe
refs/heads/master
2021-03-24T01:24:55.719196
2020-03-15T16:07:51
2020-03-15T16:07:51
247,503,133
0
0
null
null
null
null
UTF-8
Java
false
false
163
java
public class InterfaceDemoDefaultMethod { public static void main(String[] args) { Person p = new Person("Antonio"); p.display(); } }
[ "shwopnotori@gmail.com" ]
shwopnotori@gmail.com
5908d8b7c16755ae48c88408abb9d4323d9fda82
8af1164bac943cef64e41bae312223c3c0e38114
/results-java/processing--processing/c43d50eecc82e50b1f64b0fc89ba2852df725ce6/before/CreateFont.java
efd8e94997246af0357088e429b632f5dc41afc1
[]
no_license
fracz/refactor-extractor
3ae45c97cc63f26d5cb8b92003b12f74cc9973a9
dd5e82bfcc376e74a99e18c2bf54c95676914272
refs/heads/master
2021-01-19T06:50:08.211003
2018-11-30T13:00:57
2018-11-30T13:00:57
87,353,478
0
0
null
null
null
null
UTF-8
Java
false
false
10,023
java
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */ /* Part of the Processing project - http://processing.org Copyright (c) 2004-06 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package processing.app.tools; import processing.app.*; import processing.core.*; import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.border.*; import javax.swing.event.*; /** * gui interface to font creation heaven/hell. */ public class CreateFont extends JFrame { File targetFolder; Dimension windowSize; JList fontSelector; //JComboBox styleSelector; JTextField sizeSelector; JCheckBox allBox; JCheckBox smoothBox; JTextArea sample; JButton okButton; JTextField filenameField; Hashtable table; boolean smooth = true; boolean all = false; Font font; String list[]; int selection = -1; //static { //System.out.println("yep yep yep"); //} //static final String styles[] = { //"Plain", "Bold", "Italic", "Bold Italic" //}; public CreateFont(Editor editor) { super("Create Font"); targetFolder = editor.getSketch().dataFolder; Container paine = getContentPane(); paine.setLayout(new BorderLayout()); //10, 10)); JPanel pain = new JPanel(); pain.setBorder(new EmptyBorder(13, 13, 13, 13)); paine.add(pain, BorderLayout.CENTER); pain.setLayout(new BoxLayout(pain, BoxLayout.Y_AXIS)); String labelText = "Use this tool to create bitmap fonts for your program.\n" + "Select a font and size, and click 'OK' to generate the font.\n" + "It will be added to the data folder of the current sketch."; JTextArea textarea = new JTextArea(labelText); textarea.setBorder(new EmptyBorder(10, 10, 20, 10)); textarea.setBackground(null); textarea.setEditable(false); textarea.setHighlighter(null); textarea.setFont(new Font("Dialog", Font.PLAIN, 12)); pain.add(textarea); // don't care about families starting with . or # // also ignore dialog, dialoginput, monospaced, serif, sansserif // getFontList is deprecated in 1.4, so this has to be used GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); Font fonts[] = ge.getAllFonts(); String flist[] = new String[fonts.length]; table = new Hashtable(); int index = 0; for (int i = 0; i < fonts.length; i++) { //String psname = fonts[i].getPSName(); //if (psname == null) System.err.println("ps name is null"); flist[index++] = fonts[i].getPSName(); table.put(fonts[i].getPSName(), fonts[i]); } list = new String[index]; System.arraycopy(flist, 0, list, 0, index); fontSelector = new JList(list); fontSelector.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting() == false) { selection = fontSelector.getSelectedIndex(); okButton.setEnabled(true); update(); } } }); fontSelector.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); fontSelector.setVisibleRowCount(12); JScrollPane fontScroller = new JScrollPane(fontSelector); pain.add(fontScroller); Dimension d1 = new Dimension(13, 13); pain.add(new Box.Filler(d1, d1, d1)); // see http://rinkworks.com/words/pangrams.shtml sample = new JTextArea("The quick brown fox blah blah.") { // Forsaking monastic tradition, twelve jovial friars gave up their // vocation for a questionable existence on the flying trapeze. public void paintComponent(Graphics g) { //System.out.println("disabling aa"); Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, smooth ? RenderingHints.VALUE_TEXT_ANTIALIAS_ON : RenderingHints.VALUE_TEXT_ANTIALIAS_OFF); super.paintComponent(g2); } }; // Seems that in some instances, no default font is set // http://dev.processing.org/bugs/show_bug.cgi?id=777 sample.setFont(new Font("Dialog", Font.PLAIN, 12)); pain.add(sample); Dimension d2 = new Dimension(6, 6); pain.add(new Box.Filler(d2, d2, d2)); JPanel panel = new JPanel(); panel.add(new JLabel("Size:")); sizeSelector = new JTextField(" 48 "); sizeSelector.getDocument().addDocumentListener(new DocumentListener() { public void insertUpdate(DocumentEvent e) { update(); } public void removeUpdate(DocumentEvent e) { update(); } public void changedUpdate(DocumentEvent e) { } }); panel.add(sizeSelector); smoothBox = new JCheckBox("Smooth"); smoothBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { smooth = smoothBox.isSelected(); update(); } }); smoothBox.setSelected(smooth); panel.add(smoothBox); allBox = new JCheckBox("All Characters"); allBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { all = allBox.isSelected(); } }); allBox.setSelected(all); panel.add(allBox); pain.add(panel); JPanel filestuff = new JPanel(); filestuff.add(new JLabel("Filename:")); filestuff.add(filenameField = new JTextField(20)); filestuff.add(new JLabel(".vlw")); pain.add(filestuff); JPanel buttons = new JPanel(); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); } }); okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { build(); } }); okButton.setEnabled(false); buttons.add(cancelButton); buttons.add(okButton); pain.add(buttons); JRootPane root = getRootPane(); root.setDefaultButton(okButton); ActionListener disposer = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { setVisible(false); } }; Base.registerWindowCloseKeys(root, disposer); Base.setIcon(this); pack(); // do this after pack so it doesn't affect layout sample.setFont(new Font(list[0], Font.PLAIN, 48)); fontSelector.setSelectedIndex(0); Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); windowSize = getSize(); setLocation((screen.width - windowSize.width) / 2, (screen.height - windowSize.height) / 2); } /** * make the window vertically resizable */ public Dimension getMaximumSize() { return new Dimension(windowSize.width, 2000); } public Dimension getMinimumSize() { return windowSize; } /* public void show(File targetFolder) { this.targetFolder = targetFolder; show(); } */ public void update() { int fontsize = 0; try { fontsize = Integer.parseInt(sizeSelector.getText().trim()); //System.out.println("'" + sizeSelector.getText() + "'"); } catch (NumberFormatException e2) { } // if a deselect occurred, selection will be -1 if ((fontsize > 0) && (fontsize < 256) && (selection != -1)) { //font = new Font(list[selection], Font.PLAIN, fontsize); Font instance = (Font) table.get(list[selection]); font = instance.deriveFont(Font.PLAIN, fontsize); //System.out.println("setting font to " + font); sample.setFont(font); String filenameSuggestion = list[selection].replace(' ', '_'); filenameSuggestion += "-" + fontsize; filenameField.setText(filenameSuggestion); } } public void build() { int fontsize = 0; try { fontsize = Integer.parseInt(sizeSelector.getText().trim()); } catch (NumberFormatException e) { } if (fontsize <= 0) { JOptionPane.showMessageDialog(this, "Bad font size, try again.", "Badness", JOptionPane.WARNING_MESSAGE); return; } String filename = filenameField.getText(); if (filename.length() == 0) { JOptionPane.showMessageDialog(this, "Enter a file name for the font.", "Lameness", JOptionPane.WARNING_MESSAGE); return; } if (!filename.endsWith(".vlw")) { filename += ".vlw"; } try { Font instance = (Font) table.get(list[selection]); font = instance.deriveFont(Font.PLAIN, fontsize); PFont f = new PFont(font, smooth, all ? null : PFont.DEFAULT_CHARSET); // make sure the 'data' folder exists if (!targetFolder.exists()) targetFolder.mkdirs(); f.save(new FileOutputStream(new File(targetFolder, filename))); } catch (IOException e) { JOptionPane.showMessageDialog(this, "An error occurred while creating font.", "No font for you", JOptionPane.WARNING_MESSAGE); e.printStackTrace(); } setVisible(false); } }
[ "fraczwojciech@gmail.com" ]
fraczwojciech@gmail.com
e615dbb98ad60e7813b64f151d8c53f0e96ffa4d
47b6f0ef8e37aeebb8ed84d9bdc6ad14c8e06fc9
/src/main/java/com/safetynet/safetyAlerts/model/dto/url6/MedicalBackground.java
b12352e5d2d5ecdd9fc701c6d6c93288fd07f697
[]
no_license
Yvonnet-L/SafetyNet_Alerts
447bbc8e95bc33801b3c4ffc03fa09b08a9c951b
dbe6551634c6c5688450546ebf9e9ca35345102e
refs/heads/master
2023-03-30T03:42:23.487014
2021-04-08T08:58:38
2021-04-08T08:58:38
343,726,335
0
0
null
null
null
null
UTF-8
Java
false
false
675
java
package com.safetynet.safetyAlerts.model.dto.url6; import java.util.List; public class MedicalBackground { private List<String> medications; private List<String> allergies; public MedicalBackground() { super(); } public List<String> getMedications() { return medications; } public void setMedications(List<String> medications) { this.medications = medications; } public List<String> getAllergies() { return allergies; } public void setAllergies(List<String> allergies) { this.allergies = allergies; } @Override public String toString() { return "MedicalBackground [medications=" + medications + ", allergies=" + allergies + "]"; } }
[ "yvonnet_l@yahoo.fr" ]
yvonnet_l@yahoo.fr
0456ca7b8bedf1620f88512d0e19555129face6c
87b36183a614c7eec6d4baa89e7150a93edeb354
/ATConsulting/src/main/java/com/atconsulting/services/MainServiceImple.java
31d474e7935e071db924dcfec22b98bc8f6a1c8a
[]
no_license
klov/ATConsultingTest
86c9dbe6e19f7cb234db99b786a1c5b6c457c374
6fa6dc4ec777074ef7ba9f5049915612f8590f61
refs/heads/master
2021-01-22T04:34:08.716661
2017-02-19T17:18:41
2017-02-19T17:18:41
81,557,616
0
0
null
null
null
null
UTF-8
Java
false
false
3,419
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.atconsulting.services; import com.atconsulting.antity.Claim; import com.atconsulting.antity.Person; import com.atconsulting.antity.Subservice; import com.atconsulting.main.ClaimRepository; import com.atconsulting.main.DepartmentRepository; import com.atconsulting.main.PersonRepository; import com.atconsulting.main.ServiceRepository; import com.atconsulting.main.SubserviceRepository; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; /** * Обеспечивает операции для реализации которых необходимо работать с несколькими * документами одновременно. * @author vita */ @Service public class MainServiceImple implements MainService { @Autowired private DepartmentRepository departmentRepository; @Autowired private ClaimRepository claimRepository; @Autowired private SubserviceRepository subserviceRepository ; @Autowired private ServiceRepository serviceRepository; @Autowired private PersonRepository personRepository; /** * Добавляет в MongoDB новую заявку. Перед сохранением в базе : * проверяется добавлены ли объекты связи, если они не добалены то * сохраняет объекты связей. * @param claim - заявка */ public void addClaim(Claim claim) { Claim c = claimRepository.findByClaimID(claim.getClaimID()); if(c!=null){ throw new IllegalArgumentException("ClaimID must be unique"); } if(claim.getPersonID().getId()==null){ claim.setPersonID(personRepository.save(claim.getPersonID())); } if(claim.getServiceID().getId()==null){ claim.setServiceID(saveService(claim.getServiceID())); } claimRepository.save(claim); } /** * Сохраняет объект услуги в MongoDB. Сохраняет подуслуги в базе если они не сохранены, прежде чем сохранить услугу. * @param service * @return */ public com.atconsulting.antity.Service saveService(com.atconsulting.antity.Service service) { List<Subservice> list = service.getSubservices(); for(int i =0; i <list.size(); i++){ if(list.get(i).getId()==null){ list.set(i, subserviceRepository.save(list.get(i))); } } service.setSubservices(list); if(service.getDepartment().getId()==null){ service.setDepartment(departmentRepository.save(service.getDepartment())); } return serviceRepository.save(service); } @Override public void removeAll() { claimRepository.deleteAll(); serviceRepository.deleteAll(); personRepository.deleteAll(); subserviceRepository.deleteAll(); departmentRepository.deleteAll(); } @Override public Person savePerson(Person person) { return personRepository.save(person); } }
[ "klovkrol@gmail.com" ]
klovkrol@gmail.com
1458a6c7f0e9290c76cd70913beb55220f465e2a
fdce74e3dcde9f1e6d85c755e3a46d8b6717d3a2
/p6/src/test/java/es/ucm/fdi/layout/LayoutTests.java
680ad73fcd7e2526784593762a7fafe55e14ed7e
[]
no_license
alberto-maurel/Practica-TP-6
0708e6b2b8e4dcd77ea266bb22bf2716ad0a79e9
67de9dfb83ed2ff0269fca2f32f8ba60f7755052
refs/heads/master
2020-03-16T00:44:09.202684
2018-05-20T08:55:04
2018-05-20T08:55:04
132,424,167
0
0
null
2018-05-19T11:26:30
2018-05-07T07:35:21
Java
UTF-8
Java
false
false
476
java
package es.ucm.fdi.layout; import javax.swing.SwingUtilities; import es.ucm.fdi.extra.dialog.DialogWindowExample; public class LayoutTests { //Adjuntamos un main que lanza el cuadro para seleccionar de que objetos queremos generar //el output para ver como queda antes de insertarlo en el layout public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new DialogWindowExample(); } }); } }
[ "lauracastilla@users.noreply.github.com" ]
lauracastilla@users.noreply.github.com
3067393b891fda129f2055e960b728cfa238c0ba
6b34e9f52ebd095dc190ee9e89bcb5c95228aed6
/l2gw-core/highfive/commons/java/ru/l2gw/commons/network/IClientFactory.java
03950f715a1e745df2c66d8e21e0760f458d4b4d
[]
no_license
tablichka/play4
86c057ececdb81f24fc493c7557b7dbb7260218d
b0c7d142ab162b7b37fe79d203e153fcf440a8a6
refs/heads/master
2022-04-25T17:04:32.244384
2020-04-27T12:59:45
2020-04-27T12:59:45
259,319,030
0
0
null
null
null
null
UTF-8
Java
false
false
140
java
package ru.l2gw.commons.network; public interface IClientFactory<T extends MMOClient<?>> { public T create(MMOConnection<T> con); }
[ "ubuntu235@gmail.com" ]
ubuntu235@gmail.com
1c36b1f5b82f7c6896d4da0f8320e8ef1940caee
17c30fed606a8b1c8f07f3befbef6ccc78288299
/P9_8_0_0/src/main/java/com/huawei/android/telephony/MSimSmsManagerCustEx.java
070fe58b58ec06ad4a09b6366a06ff30ea55f38b
[]
no_license
EggUncle/HwFrameWorkSource
4e67f1b832a2f68f5eaae065c90215777b8633a7
162e751d0952ca13548f700aad987852b969a4ad
refs/heads/master
2020-04-06T14:29:22.781911
2018-11-09T05:05:03
2018-11-09T05:05:03
157,543,151
1
0
null
2018-11-14T12:08:01
2018-11-14T12:08:01
null
UTF-8
Java
false
false
542
java
package com.huawei.android.telephony; import com.huawei.android.util.NoExtAPIException; public class MSimSmsManagerCustEx { public static boolean isUimSupportMeid(int subscription) { throw new NoExtAPIException("method not supported."); } public static String getMeidOrPesn(int subscription) { throw new NoExtAPIException("method not supported."); } public static boolean setMeidOrPesn(String meid, String pesn, int subscription) { throw new NoExtAPIException("method not supported."); } }
[ "lygforbs0@mail.com" ]
lygforbs0@mail.com
e86c14d28abc3cb4f6d6349a3a26d50723b422f9
27a045c374d7118b8019e71c6a166ccfef66a4cc
/java/java_util_concurrent_sourcecode_analysis/AQS_sharedLock_acquire_release/AbstractQueuedSynchronizer.java
b9bd33c6d5d53570fbd7b74b419b2df9275ed469
[]
no_license
colonel8377/code
6f422c687226bae928ab6e377e321e4671d70d18
07ee8b4fc0d325341c6866395b5bda6d44271707
refs/heads/master
2022-01-04T20:09:21.777194
2018-12-26T14:15:39
2018-12-26T14:15:39
null
0
0
null
null
null
null
UTF-8
Java
false
false
20,155
java
package com.sourcecode.locks; import java.lang.reflect.Field; import java.util.concurrent.locks.LockSupport; import sun.misc.Unsafe; public class AbstractQueuedSynchronizer extends AbstractOwnableSynchronizer implements java.io.Serializable { private static final long serialVersionUID = 7373984972572414691L; protected AbstractQueuedSynchronizer() { } static final class Node { // 共享 static final Node SHARED = new Node(); // 表示独占 static final Node EXCLUSIVE = null; // 表明这个节点已经被取消 static final int CANCELLED = 1; // 表明需要唤醒下一个等待的线程 static final int SIGNAL = -1; // 后续会讨论 static final int CONDITION = -2; // 后续会讨论 static final int PROPAGATE = -3; // 当前节点的等待状态 volatile int waitStatus; // 当前节点的前一个节点 volatile Node prev; // 当前节点的下一个节点 volatile Node next; // 当前节点所表示的线程 volatile Thread thread; // 用于判断是否是独占还是共享 Node nextWaiter; //判断是独占还是共享 final boolean isShared() { return nextWaiter == SHARED; } // 取前一个节点 final Node predecessor() throws NullPointerException { Node p = prev; if (p == null) throw new NullPointerException(); else return p; } // 无参构造函数 Node() {} Node(Thread thread, Node mode) { this.nextWaiter = mode; this.thread = thread; } Node(Thread thread, int waitStatus) { this.waitStatus = waitStatus; this.thread = thread; } public String toString() { return "[" + (thread == null ? "NULL" : thread.getName()) + "," + waitStatus + "]"; } } // 同步器等待队列的头节点 private transient volatile Node head; // 同步器等待队列的尾节点 private transient volatile Node tail; // 同步器的状态值 private volatile int state; // 获取同步器状态值 protected final int getState() { return state; } // 设置同步器的状态值 protected final void setState(int newState) { state = newState; } public final boolean compareAndSetState(int expect, int update) { return unsafe.compareAndSwapInt(this, stateOffset, expect, update); } /** * 添加addWaiter方法 */ // 将node节点放到等待队列的尾部 private Node enq(final Node node) { /** * 无限循环到条件满足后退出 */ for (;;) { Node t = tail; /** * 如果队列尾部是空 表明队列还没有进行过初始化 * 如果不为空 则把节点链接到队列的尾部 */ if (t == null) { //生成一个thread为null的节点并且设置为头节点 if (compareAndSetHead(new Node())) tail = head; } else { //利用unsafe的操作把当前节点设置到尾部 node.prev = t; if (compareAndSetTail(t, node)) { t.next = node; return t; } } } } //添加一个节点到当前队列 在尾部添加 private Node addWaiter(Node mode) { // 生成一个mode类型的节点 节点的thread是当前线程 Node node = new Node(Thread.currentThread(), mode); /** * 如果等待队列尾部不为空,则直接通过unsafe操作放到队列尾部 * 如果不是则调用 enq方法把节点插入到等待队列中. */ Node pred = tail; if (pred != null) { node.prev = pred; if (compareAndSetTail(pred, node)) { pred.next = node; return node; } } enq(node); return node; } /** * 添加tryAcquire(int arg) 方法 */ protected boolean tryAcquire(int arg) { throw new UnsupportedOperationException(); } /** * 添加acquireQueued方法 */ /** * * @param node 当前节点 * @param arg acquire请求的状态参数 * @return 返回是否需要对当前运行线程进行中断 */ final boolean acquireQueued(final Node node, int arg) { boolean failed = true; try { boolean interrupted = false; for (;;) { final Node p = node.predecessor(); if (p == head && tryAcquire(arg)) { setHead(node); p.next = null; // help GC failed = false; return interrupted; } if (shouldParkAfterFailedAcquire(p, node) && parkAndCheckInterrupt()) interrupted = true; } } finally { if (failed) cancelAcquire(node); } } /** * 作用: 把node节点设置为等待队列的头节点 */ private void setHead(Node node) { /** * 1. 把当前节点设置为头节点 * 2. 把当前节点的thread设置为null,因为这个node.thread已经获得了锁 * 3. 把当前节点的前链接设置为null */ head = node; node.thread = null; node.prev = null; } /** * 这个方法必须要保证pred == node.prev * 作用: 此方法是在判断node节点是否可以进行休眠状态, 因为进行休眠状态可以节约资源利用(cpu) * 所以需要让node休眠前要确保有节点可以唤醒它,因此下面所做的事情就是检查等待队列中 * 前面的节点是否满足条件. */ private static boolean shouldParkAfterFailedAcquire(Node pred, Node node) { int ws = pred.waitStatus; if (ws == Node.SIGNAL) /** * 如果节点pred的状态是Node.SIGNAL的时候,表明pred在release的时候 * 会唤醒下一个节点,也就是node节点 * 返回true 表明node节点可以休眠 */ return true; if (ws > 0) { /** * 表明节点pred所对应的线程已经被取消了,因此需要一直往前找 * 直到前一个节点的waitStatus小于等于0,中间的那些取消的节点 * 会被删除 因为最后pred.next = node. */ do { node.prev = pred = pred.prev; } while (pred.waitStatus > 0); pred.next = node; } else { /** * 所以这个分支表示当前节点的等待状态要么是0或者PROPAGATE, * 此时直接把它设置为SIGNAL */ compareAndSetWaitStatus(pred, ws, Node.SIGNAL); } return false; } /** * 作用: 让当前线程进行休眠状态并且在唤醒或者中断后返回中断状态 * 注意: 第一句就会让当前线程进行休眠状态,只有等到当前线程被唤醒后才可以进入第二句话 * 线程被唤醒有两种情况: * 1. 被前面的(SIGNAL)节点唤醒 此时第二句话返回false * 2. 线程被中断 此时第二句话返回true (关于中断的话题会有另外专门博客介绍) */ private final boolean parkAndCheckInterrupt() { LockSupport.park(this); return Thread.interrupted(); } /** * 添加cancelAcquire方法 * 作用: 取消该节点 */ private void cancelAcquire(Node node) { // 如果节点为null 直接返回 if (node == null) return; // 设置节点所对应的thread为null node.thread = null; // 找到node的前驱节点(必须是没有被取消的节点) Node pred = node.prev; while (pred.waitStatus > 0) node.prev = pred = pred.prev; // 前驱节点的next节点 Node predNext = pred.next; // 设置当前节点为取消状态 node.waitStatus = Node.CANCELLED; /** * 如果当前节点是尾节点: (表明当前节点可以直接取消,不用管后面的节点,因为后面没有节点了) * 1. 设置前驱节点pred成为新的尾节点 * 2. 在1成功的条件下设置尾节点的next为null */ if (node == tail && compareAndSetTail(node, pred)) { //情况3 compareAndSetNext(pred, predNext, null); } else { /** * 表明node后面还有节点,因此后面的节点会需要唤醒 * 有两种情况: * 1. 前驱节点不是头节点,并且前驱节点的等待状态是SINGAL或者可以成为SINGAL状态, * 并且前驱节点的thread不能为null. 这种情况下不需要去唤醒node后面的线程,因为pred节点可以去唤醒的 * 2. 如果不符合1,就需要主动去唤醒node后面的节点线程了,因为此时不唤醒,node后面节点的线程就没办法再唤醒了 */ int ws; //情况1 if (pred != head && ((ws = pred.waitStatus) == Node.SIGNAL || (ws <= 0 && compareAndSetWaitStatus(pred, ws, Node.SIGNAL))) && pred.thread != null) { Node next = node.next; if (next != null && next.waitStatus <= 0) compareAndSetNext(pred, predNext, next); } else { //情况2 unparkSuccessor(node); } //设置node节点自旋 node.next = node; // help GC } } /** * 唤醒node的后驱节点(node后面第一个没有被取消的节点) */ private void unparkSuccessor(Node node) { /* * If status is negative (i.e., possibly needing signal) try * to clear in anticipation of signalling. It is OK if this * fails or if status is changed by waiting thread. */ int ws = node.waitStatus; if (ws < 0) compareAndSetWaitStatus(node, ws, 0); /* * 取得node的后继节点 * */ Node s = node.next; if (s == null || s.waitStatus > 0) { s = null; for (Node t = tail; t != null && t != node; t = t.prev) if (t.waitStatus <= 0) s = t; } if (s != null) LockSupport.unpark(s.thread); } static void selfInterrupt() { Thread.currentThread().interrupt(); } public final void acquire(int arg) { if (!tryAcquire(arg) && acquireQueued(addWaiter(Node.EXCLUSIVE), arg)) selfInterrupt(); } static final long spinForTimeoutThreshold = 1000L; private boolean doAcquireNanos(int arg, long nanosTimeout) throws InterruptedException { if (nanosTimeout <= 0L) return false; final long deadline = System.nanoTime() + nanosTimeout; final Node node = addWaiter(Node.EXCLUSIVE); boolean failed = true; try { for (;;) { final Node p = node.predecessor(); if (p == head && tryAcquire(arg)) { setHead(node); p.next = null; // help GC failed = false; return true; } nanosTimeout = deadline - System.nanoTime(); if (nanosTimeout <= 0L) return false; if (shouldParkAfterFailedAcquire(p, node) && nanosTimeout > spinForTimeoutThreshold) LockSupport.parkNanos(this, nanosTimeout); if (Thread.interrupted()) throw new InterruptedException(); } } finally { if (failed) cancelAcquire(node); } } public final boolean tryAcquireNanos(int arg, long nanosTimeout) throws InterruptedException { if (Thread.interrupted()) throw new InterruptedException(); return tryAcquire(arg) || doAcquireNanos(arg, nanosTimeout); } private void doAcquireInterruptibly(int arg) throws InterruptedException { final Node node = addWaiter(Node.EXCLUSIVE); boolean failed = true; try { for (;;) { final Node p = node.predecessor(); if (p == head && tryAcquire(arg)) { setHead(node); p.next = null; // help GC failed = false; return; } /** * 当判断是被中断而不是被唤醒的时候,抛出InterruptedException * */ if (shouldParkAfterFailedAcquire(p, node) && parkAndCheckInterrupt()) throw new InterruptedException(); } } finally { if (failed) cancelAcquire(node); } } public final void acquireInterruptibly(int arg) throws InterruptedException { /** * 如果当前线程已经被中断了 直接抛出InterruptedException * 注意:Thread.interrupted()会在复位当前线程的中断状态 也就是变为false */ if (Thread.interrupted()) throw new InterruptedException(); // 尝试获取锁 如果获取不到则加入到阻塞队列中 if (!tryAcquire(arg)) doAcquireInterruptibly(arg); } protected boolean tryRelease(int arg) { throw new UnsupportedOperationException(); } public final boolean release(int arg) { if (tryRelease(arg)) { Node h = head; if (h != null && h.waitStatus != 0) unparkSuccessor(h); return true; } return false; } /** * 共享锁的代码段 */ private void doReleaseShared() { for (;;) { Node h = head; if (h != null && h != tail) { /** * 进入到这里表明队列不为空并且有后继节点 */ int ws = h.waitStatus; // 只有当节点状态是SIGNAL的时候才会去唤醒后继节点 // 并且把节点状态改为0 if (ws == Node.SIGNAL) { if (!compareAndSetWaitStatus(h, Node.SIGNAL, 0)) continue; // 进入for循环重试 unparkSuccessor(h); } // 如果状态是0 则更新为PROPAGATE状态 // 因为只有状态是-1的时候才要去唤醒 else if (ws == 0 && !compareAndSetWaitStatus(h, 0, Node.PROPAGATE)) continue; // 进入for循环重试 } /** * 为什么还要判断 h == head 呢? * 就说明在执行该方法的时候, head有可能会发生改变 * 这是因为在执行上面的unparkSuccessor(h)的时候会去唤醒后驱节点 * 现在设置后驱节点对应的线程为thread-B * 此方法所在的线程是thread-A * 如果thread-A在执行完unparkSuccessor(h)失去控制权,这个时候thread-B * 刚刚好从parkAndCheckInterrupt()方法的阻塞状态中返回(因为被唤醒了)并且 * 获得了锁,此时thread-B便会执行setHeadAndPropagate方法,head就会发生改变 * */ if (h == head) break; } } private void setHeadAndPropagate(Node node, int propagate) { Node h = head; // 记录一下旧的头节点 setHead(node); // 将当前节点设置为头节点 /** * 如果propagate > 0 说明锁还没有被别的线程拿到 */ if (propagate > 0 || h == null || h.waitStatus < 0 || (h = head) == null || h.waitStatus < 0) { Node s = node.next; if (s == null || s.isShared()) doReleaseShared(); } } private void doAcquireShared(int arg) { final Node node = addWaiter(Node.SHARED); boolean failed = true; try { boolean interrupted = false; for (;;) { final Node p = node.predecessor(); if (p == head) { int r = tryAcquireShared(arg); if (r >= 0) { setHeadAndPropagate(node, r); // 区别点 1 p.next = null; // help GC if (interrupted) selfInterrupt(); failed = false; return; } } if (shouldParkAfterFailedAcquire(p, node) && parkAndCheckInterrupt()) interrupted = true; } } finally { if (failed) cancelAcquire(node); } } protected int tryAcquireShared(int arg) { throw new UnsupportedOperationException(); } public final void acquireShared(int arg) { /** * 如果没有获得锁,则放入到等待队列中 */ if (tryAcquireShared(arg) < 0) doAcquireShared(arg); } protected boolean tryReleaseShared(int arg) { throw new UnsupportedOperationException(); } public final boolean releaseShared(int arg) { if (tryReleaseShared(arg)) { doReleaseShared(); return true; } return false; } /** * 添加一个打印等待队列的方法 */ public void printQueue() { printQueueNode(tail); System.out.println(); } public void printQueueNode(Node node) { if (node == null) return; printQueueNode(node.prev); System.out.print(node + "->"); } private static final Unsafe unsafe; private static final long stateOffset; private static final long headOffset; private static final long tailOffset; private static final long waitStatusOffset; private static final long nextOffset; static { try { Field f = Unsafe.class.getDeclaredField("theUnsafe"); f.setAccessible(true); unsafe = (Unsafe)f.get(null); stateOffset = unsafe.objectFieldOffset (AbstractQueuedSynchronizer.class.getDeclaredField("state")); headOffset = unsafe.objectFieldOffset (AbstractQueuedSynchronizer.class.getDeclaredField("head")); tailOffset = unsafe.objectFieldOffset (AbstractQueuedSynchronizer.class.getDeclaredField("tail")); waitStatusOffset = unsafe.objectFieldOffset (Node.class.getDeclaredField("waitStatus")); nextOffset = unsafe.objectFieldOffset (Node.class.getDeclaredField("next")); } catch (Exception ex) { throw new Error(ex); } } private final boolean compareAndSetHead(Node update) { return unsafe.compareAndSwapObject(this, headOffset, null, update); } private final boolean compareAndSetTail(Node expect, Node update) { return unsafe.compareAndSwapObject(this, tailOffset, expect, update); } private static final boolean compareAndSetWaitStatus(Node node, int expect, int update) { return unsafe.compareAndSwapInt(node, waitStatusOffset, expect, update); } private static final boolean compareAndSetNext(Node node, Node expect, Node update) { return unsafe.compareAndSwapObject(node, nextOffset, expect, update); } }
[ "2279563278@qq.com" ]
2279563278@qq.com
0f7dd6b1e4863606f836fcf1ae5b8e9279b49c7d
823d4e967b640addbb2e4107f8c7eadf48e1807e
/kodilla-patterns/src/test/java/com/kodilla/patterns/factory/tasks/TaskFactoryTestSuite.java
9b07ba6744882cdfff3ca07bd30843a2ec092261
[]
no_license
mizaniewicz/miroslaw-zaniewicz-kodilla-java
ca42737ef85c9ff20f65415b73934bd3d7d206f9
0abd9a36d1a1528317a50b0833cd29f6d65e960f
refs/heads/master
2021-01-01T10:39:58.520931
2017-11-13T10:52:27
2017-11-13T10:52:27
95,867,540
0
0
null
null
null
null
UTF-8
Java
false
false
1,226
java
package com.kodilla.patterns.factory.tasks; import org.junit.Assert; import org.junit.Test; public class TaskFactoryTestSuite { @Test public void testShoppingTask() { //Given TaskFactory factory = new TaskFactory(); //When Task shopping = factory.makeTask(TaskFactory.APPLES); shopping.executeTask(); //Then Assert.assertTrue(shopping.isTaskExecuted()); Assert.assertEquals("buy apples", shopping.getTaskName()); } @Test public void testPaintingTask() { //Given TaskFactory factory = new TaskFactory(); //When Task painting = factory.makeTask(TaskFactory.RED); painting.executeTask(); //Then Assert.assertTrue(painting.isTaskExecuted()); Assert.assertEquals("paint the room", painting.getTaskName()); } @Test public void testDrivingTask() { //Given TaskFactory factory = new TaskFactory(); //When Task driving = factory.makeTask(TaskFactory.CAR); driving.executeTask(); //Then Assert.assertTrue(driving.isTaskExecuted()); Assert.assertEquals("drive to the airport", driving.getTaskName()); } }
[ "mizaniewicz@gmail.com" ]
mizaniewicz@gmail.com
9407228208bf3edbbaebeb02e0b759f80561595a
01ede743f4349ed960fb653ebe75b5706c099374
/src/main/java/com/mycompany/bugtracker/web/filter/SpaWebFilter.java
aa7437a516fb5c56f71128fb4bc7de6f77dd616e
[]
no_license
996loveicu/BugTrackerJHipster
7fc49a8463dd51de885b341e0d433a5e57f1f22f
3851a3abb403fcb44c4f4541e92a88e83ad94358
refs/heads/master
2023-01-12T11:09:34.887020
2020-11-06T13:42:41
2020-11-06T13:42:41
310,610,104
0
0
null
null
null
null
UTF-8
Java
false
false
1,080
java
package com.mycompany.bugtracker.web.filter; import org.springframework.stereotype.Component; import org.springframework.web.server.ServerWebExchange; import org.springframework.web.server.WebFilter; import org.springframework.web.server.WebFilterChain; import reactor.core.publisher.Mono; @Component public class SpaWebFilter implements WebFilter { /** * Forwards any unmapped paths (except those containing a period) to the client {@code index.html}. */ @Override public Mono<Void> filter(ServerWebExchange exchange, WebFilterChain chain) { String path = exchange.getRequest().getURI().getPath(); if (!path.startsWith("/api") && !path.startsWith("/management") && !path.startsWith("/services") && !path.startsWith("/swagger") && !path.startsWith("/v2/api-docs") && path.matches("[^\\\\.]*")) { return chain.filter( exchange.mutate().request(exchange.getRequest().mutate().path("/index.html").build() ).build()); } return chain.filter(exchange); } }
[ "johndoe@example.com" ]
johndoe@example.com
5bf8b6162e326bf616eae415b09e8b228979e537
83db8ba010453106e5f87f811b73c93aa28eef2c
/DynamicProgramming/LongestIncreasingSequence.java
ffa103e01c1d5670bffb7026ccf79682d0c0ec95
[]
no_license
sawandarekar/InterviewBit
a2f05082f887332b64b085e0c29370b485f946d1
25c3c0cb4f3dd6a9ff3651561fd9009bae14e62d
refs/heads/master
2022-11-24T06:50:39.506580
2020-07-09T05:49:33
2020-07-09T05:49:33
265,470,855
0
0
null
2020-05-20T06:25:26
2020-05-20T06:25:25
null
WINDOWS-1252
Java
false
false
2,971
java
/* * Find the longest increasing subsequence of a given sequence / array. * In other words, find a subsequence of array in which the subsequence’s elements are in strictly increasing order, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous, or unique. In this case, we only care about the length of the longest increasing subsequence. Example : Input : [0, 8, 4, 12, 2, 10, 6, 14, 1, 9, 5, 13, 3, 11, 7, 15] Output : 6 The sequence : [0, 2, 6, 9, 13, 15] or [0, 4, 6, 9, 11, 15] or [0, 4, 6, 9, 13, 15] http://www.geeksforgeeks.org/dynamic-programming-set-3-longest-increasing-subsequence/ */ import java.util.*; public class LongestIncreasingSequence{ public static int lis(final List<Integer> a) { if(a == null || a.size() == 0) return 0; if(a.size() == 1) return 1; int max = Integer.MIN_VALUE; max = lis(a, a.size(), max); return max; } public static int lis(List<Integer> a, int n, int max){ if(n == 1) return 1; int res = 0; int maxEndingHere = 1; /* Recursively get all LIS ending with arr[0], arr[1] ... ar[n-2]. If arr[i-1] is smaller than arr[n-1], and max ending with arr[n-1] needs to be updated, then update it */ for(int i =1; i < n; i++){ res = lis(a, i, max); if(a.get(i-1) < a.get(n-1) && res + 1 > maxEndingHere) maxEndingHere = res + 1; } max = Math.max(max, maxEndingHere); return maxEndingHere; } //Dynamic Programming public static int lisDynamic(final List<Integer> a) { if(a == null || a.size() == 0) return 0; if(a.size() == 1) return 1; int[] lis = new int[a.size()]; int n = a.size(); int max = Integer.MIN_VALUE; for(int i =0; i<n; i++) lis[i] = 1; for(int i = 1; i < n; i++){ for(int j =0; j < i; j++){ if(a.get(i) >a.get(j) && lis[i] < lis[j] + 1) lis[i] = lis[j] + 1; } for(int k = 0; k <n; k++) System.out.print(lis[k] + " "); System.out.println(); } for(int i =0; i < n; i++) max = Math.max(max, lis[i]); System.out.println(); return max; } public static void main(String[] args){ List<Integer> a = new ArrayList<Integer>(); a.add(0); a.add(8); a.add(4); a.add(12); a.add(2); a.add(10); a.add(6); a.add(14); a.add(1); a.add(9); a.add(5); a.add(13); a.add(3); a.add(11); a.add(7); a.add(15); System.out.println(lis(a)); System.out.println(lisDynamic(a)); } }
[ "nagajyothi.gunti@gmail.com" ]
nagajyothi.gunti@gmail.com
716ec69d3049abb373aa02909db9aeb15d78dcb4
434a45b826a2b46dc64ad1562c8236224c6b1884
/Primero/workspace/Herencia/src/ejercicio26/Ave.java
d777796905c3d92aa5979b61603df32d8ac82905
[]
no_license
SoulApps/CrossPlatformLearning
66c42b1cb09d69e97c3a1668502b0dd9cc139625
c80d0893621e85b426f0e17410f69e5f825dfa12
refs/heads/master
2021-04-27T06:05:36.794382
2017-12-06T18:17:26
2017-12-06T18:17:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package ejercicio26; /** * Created by Alejandro on 23/02/2016. */ public abstract class Ave extends Animal { Alimentacion alimentacion; public Ave(String nombre, double cuota, String raza, boolean enfadado, Alimentacion alimentacion) { super(nombre, cuota, raza, enfadado); this.alimentacion = alimentacion; } public boolean equals(Object o) { boolean igual = false; if (o instanceof Ave) if (nombre.equals(((Animal) o).nombre) && cuota == ((Animal) o).cuota && raza.equals(((Animal) o).raza)) igual = true; return igual; } public String toString() { return String.format("%s [Alimentación: %s]", super.toString(), alimentacion); } }
[ "alejandrosanchezgalvin@gmail.com" ]
alejandrosanchezgalvin@gmail.com