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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
788fa3b4c372e22ce98ad96421d0d8f2a7c03bcc | e31678c5125454e82ad7b4bcb6f36495ceb38fa4 | /Downloads/fxrates/fxrates/src/main/java/com/viseo/fx/exception/InvalidUserRequestException.java | 5597c1b109c1208c9f0cba39376143a49a7ace93 | [] | no_license | ramureddymca/fxrates | f029fb62f2f1904f658a8e494e770909c2ea89ab | f551e4d4f71aa446a1433ce3f7bf24d4104df593 | refs/heads/master | 2022-12-26T01:46:57.096854 | 2020-03-29T12:26:12 | 2020-03-29T12:26:12 | 251,025,164 | 0 | 0 | null | 2022-12-16T08:45:41 | 2020-03-29T12:20:16 | Java | UTF-8 | Java | false | false | 175 | java | package com.viseo.fx.exception;
public class InvalidUserRequestException extends RuntimeException {
private static final long serialVersionUID = 2468434988680850339L;
}
| [
"naveen.balamuri@gmail.com"
] | naveen.balamuri@gmail.com |
25bfca37c87d196dcf0f388be8bee5d7044b1600 | 6ab5e9878a25bffb9b2b621e18f433baeb1f69f9 | /app/src/main/java/com/mr2/mvvm_test/sample/dagger_and_view_model/Repository.java | 776564dcb3594b3891df54328138cef95f49e130 | [] | no_license | TakeruTajima/MVVM_Test | fcc10759b8063a5d48fca484f498e5a28e346ce7 | 36dade57c7ad7e1797bbd2343b14d1e0a93757e7 | refs/heads/master | 2022-09-28T23:33:24.755319 | 2020-06-04T18:10:35 | 2020-06-04T18:10:35 | 257,815,211 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 148 | java | package com.mr2.mvvm_test.sample.dagger_and_view_model;
interface Repository {
void set(String data);
String get();
void delete();
}
| [
"mr2o527@gmail.com"
] | mr2o527@gmail.com |
e7c5441330d2689c68f0ec8ae44dfa10a85e1c36 | f31a04b5fd65fa4d2697e4cb5092ec039514854c | /gui/inventory-app/app/src/main/java/org/moserp/inventory/InventoryTransferViewModel.java | ec97c1f9e4cb63f279d0f634848c57ff66731ad7 | [
"Apache-2.0"
] | permissive | akondasif/moserp | aad41ceac8c59e63e3815d9868c0aae3b01c6aca | 38f8ed8550e1c1586887889a0e83bb23de70b886 | refs/heads/master | 2022-11-13T08:47:28.141833 | 2020-07-08T03:22:52 | 2020-07-08T03:22:52 | 277,979,030 | 0 | 0 | Apache-2.0 | 2020-07-08T03:21:27 | 2020-07-08T03:21:26 | null | UTF-8 | Java | false | false | 3,505 | java | package org.moserp.inventory;
import android.databinding.BaseObservable;
import android.text.TextWatcher;
import org.moserp.common.databinding.BaseTextWatcher;
import org.moserp.common.databinding.SpinnerValueBinding;
import org.moserp.common.domain.Quantity;
import org.moserp.environment.Facility;
import org.moserp.product.Product;
public class InventoryTransferViewModel extends BaseObservable {
private Product product;
private Facility fromFacility;
private Facility toFacility;
private Quantity quantity;
public InventoryTransferViewModel() {
}
public Facility getFromFacility() {
return fromFacility;
}
public void setFromFacility(Facility fromFacility) {
this.fromFacility = fromFacility;
notifyPropertyChanged(BR.inventoryTransferViewModel);
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
notifyPropertyChanged(BR.inventoryTransferViewModel);
}
public Facility getToFacility() {
return toFacility;
}
public void setToFacility(Facility toFacility) {
this.toFacility = toFacility;
notifyPropertyChanged(BR.inventoryTransferViewModel);
}
public void setQuantity(Quantity quantity) {
this.quantity = quantity;
}
public Quantity getQuantity() {
return quantity;
}
public TextWatcher getQuantityWatcher() {
return new BaseTextWatcher() {
public void onTextChanged(String text) {
quantity = Quantity.convertStringToQuantity(text);
}
};
}
@Override
public String toString() {
return "InventoryTransferViewModel{" +
"product=" + product +
", fromFacility=" + fromFacility +
", toFacility=" + toFacility +
", quantity=" + quantity +
'}';
}
public InventoryTransfer toInventoryTransfer() {
InventoryTransfer inventoryTransfer = new InventoryTransfer();
inventoryTransfer.setFromFacility(fromFacility);
inventoryTransfer.setToFacility(toFacility);
inventoryTransfer.getProductInstance().setProduct(product);
inventoryTransfer.setQuantity(quantity);
return inventoryTransfer;
}
public SpinnerValueBinding<Facility> getToFacilityBinding() {
return new SpinnerValueBinding<Facility>() {
@Override
public void setValue(Facility facility) {
setToFacility(facility);
}
@Override
public Facility getValue() {
return getToFacility();
}
};
}
public SpinnerValueBinding<Facility> getFromFacilityBinding() {
return new SpinnerValueBinding<Facility>() {
@Override
public void setValue(Facility facility) {
setFromFacility(facility);
}
@Override
public Facility getValue() {
return getFromFacility();
}
};
}
public SpinnerValueBinding<Product> getProductBinding() {
return new SpinnerValueBinding<Product>() {
@Override
public void setValue(Product product) {
setProduct(product);
}
@Override
public Product getValue() {
return getProduct();
}
};
}
}
| [
"contact@thomas-letsch.de"
] | contact@thomas-letsch.de |
72940cef151173a14f7fd4544d6fabbe89290304 | 18d504c690ca616dba03b99ca3b2b91d41ab4931 | /src/test/java/pages/CustomerAccountLookUpPage.java | 942a5d4aa473c3edf11950a6ed25352645e6662e | [] | no_license | manasrana/LegacyQA_Automation-sprint-4-mrai | d8e26cb096d943d211c318dd876ff5a74422b1b4 | 8e6655dd9f4c1eaa56422d0f7bc0364a5739cf3c | refs/heads/master | 2020-12-30T11:15:31.978729 | 2015-08-24T11:16:15 | 2015-08-24T11:16:15 | 41,258,151 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 58 | java | package pages;
public class CustomerAccountLookUpPage {
} | [
"manas.rana@gmail.com"
] | manas.rana@gmail.com |
38517d0ad23c88deaf11da7ad28db33513294d86 | d94941a830f7fa053fb91a90d4842f4dd191757b | /SimpleGlide/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/core/R.java | a728f356e8c50fe6ef4391be863e9efad7d2fb9a | [] | no_license | wanlapa1999/AndroidLibarary | a71625b1a709a626e1aeda43d7a25926ae1a7162 | 437b97d283271ce83f23bceca5d8f843aa0a00fa | refs/heads/master | 2020-09-12T01:50:54.495193 | 2019-11-17T16:22:51 | 2019-11-17T16:22:51 | 222,260,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,696 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.core;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int font = 0x7f020082;
public static final int fontProviderAuthority = 0x7f020084;
public static final int fontProviderCerts = 0x7f020085;
public static final int fontProviderFetchStrategy = 0x7f020086;
public static final int fontProviderFetchTimeout = 0x7f020087;
public static final int fontProviderPackage = 0x7f020088;
public static final int fontProviderQuery = 0x7f020089;
public static final int fontStyle = 0x7f02008a;
public static final int fontVariationSettings = 0x7f02008b;
public static final int fontWeight = 0x7f02008c;
public static final int ttcIndex = 0x7f020142;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f04003f;
public static final int notification_icon_bg_color = 0x7f040040;
public static final int ripple_material_light = 0x7f04004a;
public static final int secondary_text_default_material_light = 0x7f04004c;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004e;
public static final int compat_button_inset_vertical_material = 0x7f05004f;
public static final int compat_button_padding_horizontal_material = 0x7f050050;
public static final int compat_button_padding_vertical_material = 0x7f050051;
public static final int compat_control_corner_material = 0x7f050052;
public static final int compat_notification_large_icon_max_height = 0x7f050053;
public static final int compat_notification_large_icon_max_width = 0x7f050054;
public static final int notification_action_icon_size = 0x7f05005e;
public static final int notification_action_text_size = 0x7f05005f;
public static final int notification_big_circle_margin = 0x7f050060;
public static final int notification_content_margin_start = 0x7f050061;
public static final int notification_large_icon_height = 0x7f050062;
public static final int notification_large_icon_width = 0x7f050063;
public static final int notification_main_column_padding_top = 0x7f050064;
public static final int notification_media_narrow_margin = 0x7f050065;
public static final int notification_right_icon_size = 0x7f050066;
public static final int notification_right_side_padding_top = 0x7f050067;
public static final int notification_small_icon_background_padding = 0x7f050068;
public static final int notification_small_icon_size_as_large = 0x7f050069;
public static final int notification_subtext_size = 0x7f05006a;
public static final int notification_top_pad = 0x7f05006b;
public static final int notification_top_pad_large_text = 0x7f05006c;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060061;
public static final int notification_bg = 0x7f060062;
public static final int notification_bg_low = 0x7f060063;
public static final int notification_bg_low_normal = 0x7f060064;
public static final int notification_bg_low_pressed = 0x7f060065;
public static final int notification_bg_normal = 0x7f060066;
public static final int notification_bg_normal_pressed = 0x7f060067;
public static final int notification_icon_background = 0x7f060068;
public static final int notification_template_icon_bg = 0x7f060069;
public static final int notification_template_icon_low_bg = 0x7f06006a;
public static final int notification_tile_bg = 0x7f06006b;
public static final int notify_panel_notification_icon_bg = 0x7f06006c;
}
public static final class id {
private id() {}
public static final int accessibility_action_clickable_span = 0x7f070006;
public static final int accessibility_custom_action_0 = 0x7f070007;
public static final int accessibility_custom_action_1 = 0x7f070008;
public static final int accessibility_custom_action_10 = 0x7f070009;
public static final int accessibility_custom_action_11 = 0x7f07000a;
public static final int accessibility_custom_action_12 = 0x7f07000b;
public static final int accessibility_custom_action_13 = 0x7f07000c;
public static final int accessibility_custom_action_14 = 0x7f07000d;
public static final int accessibility_custom_action_15 = 0x7f07000e;
public static final int accessibility_custom_action_16 = 0x7f07000f;
public static final int accessibility_custom_action_17 = 0x7f070010;
public static final int accessibility_custom_action_18 = 0x7f070011;
public static final int accessibility_custom_action_19 = 0x7f070012;
public static final int accessibility_custom_action_2 = 0x7f070013;
public static final int accessibility_custom_action_20 = 0x7f070014;
public static final int accessibility_custom_action_21 = 0x7f070015;
public static final int accessibility_custom_action_22 = 0x7f070016;
public static final int accessibility_custom_action_23 = 0x7f070017;
public static final int accessibility_custom_action_24 = 0x7f070018;
public static final int accessibility_custom_action_25 = 0x7f070019;
public static final int accessibility_custom_action_26 = 0x7f07001a;
public static final int accessibility_custom_action_27 = 0x7f07001b;
public static final int accessibility_custom_action_28 = 0x7f07001c;
public static final int accessibility_custom_action_29 = 0x7f07001d;
public static final int accessibility_custom_action_3 = 0x7f07001e;
public static final int accessibility_custom_action_30 = 0x7f07001f;
public static final int accessibility_custom_action_31 = 0x7f070020;
public static final int accessibility_custom_action_4 = 0x7f070021;
public static final int accessibility_custom_action_5 = 0x7f070022;
public static final int accessibility_custom_action_6 = 0x7f070023;
public static final int accessibility_custom_action_7 = 0x7f070024;
public static final int accessibility_custom_action_8 = 0x7f070025;
public static final int accessibility_custom_action_9 = 0x7f070026;
public static final int action_container = 0x7f07002e;
public static final int action_divider = 0x7f070030;
public static final int action_image = 0x7f070031;
public static final int action_text = 0x7f070037;
public static final int actions = 0x7f070038;
public static final int async = 0x7f07003d;
public static final int blocking = 0x7f070040;
public static final int chronometer = 0x7f070048;
public static final int dialog_button = 0x7f070050;
public static final int forever = 0x7f070058;
public static final int icon = 0x7f07005f;
public static final int icon_group = 0x7f070060;
public static final int info = 0x7f070064;
public static final int italic = 0x7f070066;
public static final int line1 = 0x7f070068;
public static final int line3 = 0x7f070069;
public static final int normal = 0x7f070071;
public static final int notification_background = 0x7f070072;
public static final int notification_main_column = 0x7f070073;
public static final int notification_main_column_container = 0x7f070074;
public static final int right_icon = 0x7f07007f;
public static final int right_side = 0x7f070080;
public static final int tag_accessibility_actions = 0x7f0700a0;
public static final int tag_accessibility_clickable_spans = 0x7f0700a1;
public static final int tag_accessibility_heading = 0x7f0700a2;
public static final int tag_accessibility_pane_title = 0x7f0700a3;
public static final int tag_screen_reader_focusable = 0x7f0700a4;
public static final int tag_transition_group = 0x7f0700a5;
public static final int tag_unhandled_key_event_manager = 0x7f0700a6;
public static final int tag_unhandled_key_listeners = 0x7f0700a7;
public static final int text = 0x7f0700a8;
public static final int text2 = 0x7f0700a9;
public static final int time = 0x7f0700ac;
public static final int title = 0x7f0700ad;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
private layout() {}
public static final int custom_dialog = 0x7f0a001d;
public static final int notification_action = 0x7f0a001e;
public static final int notification_action_tombstone = 0x7f0a001f;
public static final int notification_template_custom_big = 0x7f0a0020;
public static final int notification_template_icon_group = 0x7f0a0021;
public static final int notification_template_part_chronometer = 0x7f0a0022;
public static final int notification_template_part_time = 0x7f0a0023;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c001d;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00ed;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00ee;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00ef;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00f0;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f1;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d015c;
public static final int Widget_Compat_NotificationActionText = 0x7f0d015d;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] FontFamily = { 0x7f020084, 0x7f020085, 0x7f020086, 0x7f020087, 0x7f020088, 0x7f020089 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020082, 0x7f02008a, 0x7f02008b, 0x7f02008c, 0x7f020142 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"noreply@github.com"
] | wanlapa1999.noreply@github.com |
0d84d38610c7ae87026125deba848a95fa9cb436 | ae463fd9dec11bbe0d2fe39882b11d2f2358d9f1 | /mywuwu-visual/mywuwu-shop/src/main/java/com/mywuwu/pigx/shop/controller/CollectController.java | 255ab7e5cf8fee93472c00072116b41bca31ae83 | [] | no_license | soon14/mywuwu-new | 232278894bc896210e1bc99e3a9166063d021461 | 8f0b6377c30b32ee8405de39637f4f3204991028 | refs/heads/master | 2022-06-25T16:50:03.374484 | 2020-05-11T13:15:41 | 2020-05-11T13:15:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,251 | java | /*
* Copyright (c) 2018-2025, lianglele 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 ywuwu.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lianglele (liangle1986@126.com)
*/
package com.mywuwu.pigx.shop.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mywuwu.pigx.common.core.util.R;
import com.mywuwu.pigx.common.log.annotation.SysLog;
import com.mywuwu.pigx.common.security.util.SecurityUtils;
import com.mywuwu.pigx.shop.entity.Collect;
import com.mywuwu.pigx.shop.service.CollectService;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* @author ไธชไบบๆถ่
* @date 2019-08-26 22:23:55
*/
@RestController
@AllArgsConstructor
@RequestMapping("/collect")
@Api(value = "collect", tags = "ๆถ่")
public class CollectController {
private final CollectService collectService;
/**
* ๅ้กตๆฅ่ฏข
*
* @param page ๅ้กตๅฏน่ฑก
* @param collect
* @return
*/
@ApiOperation(value = "ๅ้กตๆฅ่ฏข", notes = "ๅ้กตๆฅ่ฏข")
@GetMapping("/page")
public R getNideshopCollectPage(Page page, Collect collect) {
return R.ok(collectService.page(page, Wrappers.query(collect)));
}
/**
* ้่ฟidๆฅ่ฏข
*
* @param id id
* @return R
*/
@ApiOperation(value = "้่ฟidๆฅ่ฏข", notes = "้่ฟidๆฅ่ฏข")
@GetMapping("/{id}")
public R getById(@PathVariable("id") Integer id) {
return R.ok(collectService.getById(id));
}
/**
* ๆฐๅข
*
* @param collect
* @return R
*/
@ApiOperation(value = "ๆฐๅข", notes = "ๆฐๅข")
@SysLog("ๆฐๅข")
@PostMapping
@PreAuthorize("@pms.hasPermission('nideshopcollect_add')")
public R save(@RequestBody Collect collect) {
return R.ok(collectService.save(collect));
}
/**
* ไฟฎๆน
*
* @param collect
* @return R
*/
@ApiOperation(value = "ไฟฎๆน", notes = "ไฟฎๆน")
@SysLog("ไฟฎๆน")
@PutMapping
@PreAuthorize("@pms.hasPermission('nideshopcollect_edit')")
public R updateById(@RequestBody Collect collect) {
return R.ok(collectService.updateById(collect));
}
/**
* ้่ฟidๅ ้ค
*
* @param id id
* @return R
*/
@ApiOperation(value = "้่ฟidๅ ้ค", notes = "้่ฟidๅ ้ค")
@SysLog("้่ฟidๅ ้ค")
@DeleteMapping("/{id}")
@PreAuthorize("@pms.hasPermission('nideshopcollect_del')")
public R removeById(@PathVariable Integer id) {
return R.ok(collectService.removeById(id));
}
/**
* ๆฅ่ฏขๆถ่ๅคนๅๅ
*
* @param collect id
* @return R
*/
@ApiOperation(value = " ๆฅ่ฏขๆถ่ๅคนๅๅ", notes = " ๆฅ่ฏขๆถ่ๅคนๅๅ")
@GetMapping("/index")
public R getById(Collect collect) {
return collectService.selectCollectGoods(collect);
}
/**
* ๆทปๅ ๆถ่ๆ่
ๅๆถๆถ่
*
* @param collect
* @return R
*/
@ApiOperation(value = "ๆทปๅ ๆถ่ๆ่
ๅๆถๆถ่", notes = "ๆทปๅ ๆถ่ๆ่
ๅๆถๆถ่")
@SysLog("ๆทปๅ ๆถ่ๆ่
ๅๆถๆถ่")
@PostMapping("addordelete")
public R addordelete(@RequestBody Collect collect) {
// collect.setUserId(SecurityUtils.getUser().getId());
Collect showCollect = collectService.getOne(Wrappers.query(collect));
//ๅๆถ
if (showCollect != null) {
return R.ok(collectService.removeById(showCollect.getId()), " ๅๆถๆถ่ๆๅ");
} else {
collect.setAddTime((int) (new Date().getTime() / 1000));
return R.ok(collectService.save(collect), "ๆถ่ๆๅ");
}
}
}
| [
"liangle1986@126.com"
] | liangle1986@126.com |
f99c3bf11774e771d0cb366699c02ece0278c3e7 | 29eaf00d1307ab56304b9edd3d44e31e962476d5 | /relationships/src/main/java/dev/johnmedeiros/relationships/controllers/MainController.java | e188687fb5b5ee5c57ab8a5e08be74f4c494e6b2 | [] | no_license | JMedeiros-dev/Coding-Dojo-Java | 0cd4e0708f6cd3db067147f947528e1336b95bb0 | b72e0f28d6cffecb17fccc71e5126dca56a7905b | refs/heads/main | 2023-04-15T04:33:10.003712 | 2021-05-02T15:57:55 | 2021-05-02T15:57:55 | 358,977,032 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,500 | java | package dev.johnmedeiros.relationships.controllers;
import java.util.List;
import javax.validation.Valid;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import dev.johnmedeiros.relationships.models.License;
import dev.johnmedeiros.relationships.models.Person;
import dev.johnmedeiros.relationships.services.LicenseService;
import dev.johnmedeiros.relationships.services.PersonService;
@Controller
public class MainController {
private final PersonService personService;
private final LicenseService licenseService;
public MainController(PersonService personService, LicenseService licenseService) {
this.personService = personService;
this.licenseService = licenseService;
}
Integer count = 000000;
// New Person Page
@RequestMapping("/persons/new")
public String newPerson(@ModelAttribute("person") Person person, Model model) {
return "persons.jsp";
}
//Person Show Page
@RequestMapping("/persons/{id}")
public String personShow(@PathVariable("id") Long id, Model model) {
Person person = personService.findPerson(id);
model.addAttribute("person", person);
return "show.jsp";
}
// New License Page
@RequestMapping("/licenses/new")
public String newLicense(@ModelAttribute("license") License license, Model model) {
List<Person> persons = personService.allPersons();
model.addAttribute("persons", persons);
return "license.jsp";
}
// New Person Route
@RequestMapping(value="/persons/new", method=RequestMethod.POST)
public String create(@ModelAttribute("person") Person person, BindingResult result) {
personService.createPerson(person);
return "redirect:/licenses/new";
}
// New License Route
@RequestMapping(value="/license", method=RequestMethod.POST)
public String create(@Valid @ModelAttribute("license") License license, BindingResult result, Model model) {
List<Person> persons = personService.allPersons();
model.addAttribute("persons", persons);
count = count +1;
String number = String.valueOf(count);
license.setNumber(number);
licenseService.createLicense(license);
return "redirect:/persons/new";
}
}
| [
"noreply@github.com"
] | JMedeiros-dev.noreply@github.com |
bc9b32651ee7d001a3497e57be15fb47836b8d4e | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/actorapp--actor-platform/0ad0b3c8a0d03fabf0eacb249260e6f9b979ce06/after/RequestSubscribeToOnline.java | 3d322b52d886916d6ec4ef75e0a16ed74664576a | [] | 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 | 1,791 | java | package im.actor.core.api.rpc;
/*
* Generated by the Actor API Scheme generator. DO NOT EDIT!
*/
import im.actor.runtime.bser.*;
import im.actor.runtime.collections.*;
import static im.actor.runtime.bser.Utils.*;
import im.actor.core.network.parser.*;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import com.google.j2objc.annotations.ObjectiveCName;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import im.actor.core.api.*;
public class RequestSubscribeToOnline extends Request<ResponseVoid> {
public static final int HEADER = 0x20;
public static RequestSubscribeToOnline fromBytes(byte[] data) throws IOException {
return Bser.parse(new RequestSubscribeToOnline(), data);
}
private List<ApiUserOutPeer> users;
public RequestSubscribeToOnline(@NotNull List<ApiUserOutPeer> users) {
this.users = users;
}
public RequestSubscribeToOnline() {
}
@NotNull
public List<ApiUserOutPeer> getUsers() {
return this.users;
}
@Override
public void parse(BserValues values) throws IOException {
List<ApiUserOutPeer> _users = new ArrayList<ApiUserOutPeer>();
for (int i = 0; i < values.getRepeatedCount(1); i ++) {
_users.add(new ApiUserOutPeer());
}
this.users = values.getRepeatedObj(1, _users);
}
@Override
public void serialize(BserWriter writer) throws IOException {
writer.writeRepeatedObj(1, this.users);
}
@Override
public String toString() {
String res = "rpc SubscribeToOnline{";
res += "users=" + this.users.size();
res += "}";
return res;
}
@Override
public int getHeaderKey() {
return HEADER;
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
fab60386397e17fc2e8bc17483ce34d1ad8c5e44 | 66a3e0a8366bbb0baefc59029b145c2cbbcb9a95 | /src/main/java/piechart/PercentagePieChart.java | cbc2f0c82d042111acf78485f24f487a27161ffe | [] | no_license | bastide/PieChart | 9d2e4512ea4c9b0f344cde7bc7944e4446e38638 | f3a0f66b93ddd7ca59a8790215e4d981a5d49adb | refs/heads/master | 2023-01-11T13:35:03.743714 | 2020-11-11T18:11:33 | 2020-11-11T18:11:33 | 313,650,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,726 | java | package piechart;
import java.awt.*;
import java.awt.event.MouseEvent;
import javax.swing.JComponent;
import javax.swing.event.MouseInputAdapter;
import javax.swing.event.MouseInputListener;
/**
* A PercentagePieChart acts boths as a MVC View and Controller of a Percentage It maintains a reference to its model in order to
* update it.
*
*/
public class PercentagePieChart extends JComponent implements PercentageView {
// Predefined cursors
private static final Cursor HAND = Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
private static final Cursor CROSS = Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR);
private static final Cursor ARROW = Cursor.getDefaultCursor();
/**
* Hold a reference to the model
*/
private final PercentageModel myModel;
// Implementation of the PieChart's StateChart
private enum PieState {
INIT, IN_PIN, ADJUSTING
};
private PieState myState = PieState.INIT;
public PercentagePieChart(PercentageModel model) {
super();
// "Controller" behaviour : handle mouse input and update the percentage accordingly
MouseInputListener l = new MouseInputAdapter() {
public void mousePressed(MouseEvent e) {
switch (myState) {
case INIT:
break;
case IN_PIN:
myState = PieState.ADJUSTING;
setCursor(CROSS);
//repaint();
break;
case ADJUSTING:
break;
}
}
public void mouseReleased(MouseEvent e) {
switch (myState) {
case INIT:
break;
case IN_PIN:
break;
case ADJUSTING:
if (inPin(e)) {
myState = PieState.IN_PIN;
setCursor(CROSS);
} else {
myState = PieState.INIT;
setCursor(ARROW);
}
repaint();
break;
}
}
;
public void mouseDragged(MouseEvent e) {
switch (myState) {
case INIT:
break;
case IN_PIN:
break;
case ADJUSTING:
myModel.setValue(pointToPercentage(e));
break;
}
}
public void mouseMoved(MouseEvent e) {
switch (myState) {
case INIT:
if (inPin(e)) {
setCursor(HAND);
myState = PieState.IN_PIN;
}
break;
case IN_PIN:
if (!inPin(e)) {
setCursor(ARROW);
myState = PieState.INIT;
}
break;
case ADJUSTING:
break;
}
}
};
addMouseListener(l);
addMouseMotionListener(l);
myModel = model;
}
// "View" behaviour : when the percentage changes, the piechart must be repainted
public void notify(PercentageModel model) {
repaint();
}
public void paintComponent(Graphics g) {
super.paintComponent(g);
int centerX = this.getWidth() / 2;
int centerY = this.getHeight() / 2;
int radius = Math.min(getWidth() - 4, getHeight() - 4) / 2;
double angle = myModel.getValue() * 2 * Math.PI;
g.fillOval(centerX - radius, centerY - radius, radius * 2,
radius * 2);
g.setColor(Color.yellow);
g.fillArc(centerX - radius, centerY - radius, radius * 2,
radius * 2, 0, (int) Math.toDegrees(angle));
int pinX = centerX + (int) (Math.cos(angle) * radius);
int pinY = centerY - (int) (Math.sin(angle) * radius);
g.setColor(Color.gray.brighter());
g.fill3DRect(pinX - 4, pinY - 4, 8, 8, myState != PieState.ADJUSTING);
}
/**
* Test if a mouse event is inside the "Pin" that allows to change the percentage
*/
private boolean inPin(MouseEvent ev) {
int mouseX = ev.getX();
int mouseY = ev.getY();
int centerX = this.getWidth() / 2;
int centerY = this.getHeight() / 2;
int radius = Math.min(getWidth() - 4, getHeight() - 4) / 2;
double angle = myModel.getValue() * 2 * Math.PI;
int pinX = centerX + (int) (Math.cos(angle) * radius);
int pinY = centerY - (int) (Math.sin(angle) * radius);
Rectangle r = new Rectangle();
r.setBounds(pinX - 4, pinY - 4, 8, 8);
return r.contains(mouseX, mouseY);
}
/**
* Converts a mouse position to a Percentage value
*/
private float pointToPercentage(MouseEvent e) {
int centerX = this.getWidth() / 2;
int centerY = this.getHeight() / 2;
int mouseX = e.getX() - centerX;
int mouseY = e.getY() - centerY;
double l = Math.sqrt(mouseX * mouseX + mouseY * mouseY);
double lx = mouseX / l;
double ly = mouseY / l;
double theta;
if (lx > 0) {
theta = Math.atan(ly / lx);
} else if (lx < 0) {
theta = -1 * Math.atan(ly / lx);
} else {
theta = 0;
}
if ((mouseX > 0) && (mouseY < 0)) {
theta = -1 * theta;
} else if (mouseX < 0) {
theta += Math.PI;
} else {
theta = 2 * Math.PI - theta;
}
return (float) (theta / (2 * Math.PI));
}
}
| [
"Remi.Bastide@gmail.com"
] | Remi.Bastide@gmail.com |
65db3244da5fb6f22059bc2ddd19e43ed4c2bfba | 1c6be6c34e7081fca23495380489c7fd1a38ded3 | /src/main/java/com/stackoverflow/qanda/service/PostService.java | 92a9e82080798363ebfece073af8377035a71517 | [] | no_license | prahalladrao/qandaComplete | 6503e673a747d943abc71cc62fd04d056b860733 | 8409fb147a9f8bef05435598408106d18465e272 | refs/heads/master | 2020-08-31T06:45:51.481352 | 2019-10-30T20:58:28 | 2019-10-30T20:58:28 | 217,389,598 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,112 | java | package com.stackoverflow.qanda.service;
import com.stackoverflow.qanda.model.PageResponseModel;
import com.stackoverflow.qanda.model.Post;
import com.stackoverflow.qanda.model.User;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public interface PostService
{
Post postQuestion(Post post);
PageResponseModel getAllPosts(int page, int size);
boolean postAnswer(Post post);
boolean postAnswerComment(Post post);
Post getPostById(long id);
boolean updateQuestionVotes(long questionId, String voteType);
boolean updateAnswerVotes(long postId, long answerId, String voteType);
List<Post> getNewestPosts();
List<Post> getOldestPosts();
List<Post> getUnanswered();
boolean updateAnswerComment(Post post);
boolean updateAnswer(Post post);
boolean updateQuestion(Post post);
boolean deleteQuestion(long postId);
boolean deleteAnswer(Post post);
PageResponseModel getTaggedPosts(String tag, int page, int size);
boolean deleteAnswerComment(Post post);
}
| [
"gprahalladrao@gmail.com"
] | gprahalladrao@gmail.com |
6f68a5e740703654898dec480f8a060dd11ac633 | 58142f69f732bbe8054bc7b4105488d9db4f4ffb | /dynamicprogramming/BB_008_Target_Sum.java | f7c04f36cf3c48c52a3d9e3d601f13655d9b7562 | [] | no_license | philips-ni/javacode | e8d75c705728342932852f906a7e3ac03118d212 | 8aa6772b9b0bfd5523b3d611a687e1efebb680bb | refs/heads/master | 2020-03-21T19:47:33.052505 | 2018-06-27T21:17:35 | 2018-06-27T21:17:35 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 958 | java | package dynamicprogramming;
/**
* BB.DP.008 Target sum
*
* Question : Given an array of integers, nums and a target value T, find the
* number of ways that you can add and subtract the values in nums to add up to
* T.
*
* eg.
*
* input : nums = {1, 1, 1, 1, 1}, T = 3.
*
* output : targetSum(nums, T) = 5
*
*/
public class BB_008_Target_Sum {
public static int targetSum(int[] nums, int T) {
// brute force
return targetSum(nums, T, 0, 0);
}
private static int targetSum(int[] nums, int T, int i, int sum) {
// check if reaching the target once all numbers are gone through
if (i == nums.length) {
return sum == T ? 1 : 0;
}
// check all possibilities by adding and subtracting current number
return targetSum(nums, T, i + 1, sum + nums[i]) + targetSum(nums, T, i + 1, sum - nums[i]);
}
public static void main(String[] args) {
int[] nums={1,1,1,1,1};
int T=3;
System.out.println(targetSum(nums,T));
}
}
| [
"liw0118@gmail.com"
] | liw0118@gmail.com |
acc6cc0fd44b92879078a62e375f4c551e81ed15 | 23df5ca0b30a8b65e2f611106550434ede92dd9e | /structural-bridge/src/main/java/com/qiaomu/example/device/Radio.java | 44cf1e498b6883c6b575dfd91861993c9ef9eda6 | [] | no_license | 964097833/design | 5a987e56cf10366a2d64886516721a3d19454f9b | 12826a474fef05fdb555db057b2879fbf15d23b5 | refs/heads/master | 2023-06-06T04:45:25.960198 | 2021-07-01T05:47:56 | 2021-07-01T05:47:56 | 379,821,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,296 | java | package com.qiaomu.example.device;
public class Radio implements Device {
private boolean on = false;
private int volume = 30;
private int channel = 1;
@Override
public boolean isEnabled() {
return on;
}
@Override
public void enable() {
on = true;
}
@Override
public void disable() {
on = false;
}
@Override
public int getVolume() {
return volume;
}
@Override
public void setVolume(int volume) {
if (volume > 100) {
this.volume = 100;
} else if (volume < 0) {
this.volume = 0;
} else {
this.volume = volume;
}
}
@Override
public int getChannel() {
return channel;
}
@Override
public void setChannel(int channel) {
this.channel = channel;
}
@Override
public void printStatus() {
System.out.println("------------------------------------");
System.out.println("| I'm radio.");
System.out.println("| I'm " + (on ? "enabled" : "disabled"));
System.out.println("| Current volume is " + volume + "%");
System.out.println("| Current channel is " + channel);
System.out.println("------------------------------------\n");
}
} | [
"964097833@qq.com"
] | 964097833@qq.com |
831c2aedb220be1bddc0a17f1d60d61f8c11e89f | 436ba3c9280015b6473f6e78766a0bb9cfd21998 | /parent/dao/src/main/java/by/itacademy/keikom/taxi/dao/filter/BrandFilter.java | f542f404ca1f54261586659a1c3f1235790f94f7 | [] | no_license | KeMihail/parent | 4ba61debc5581f29a6cabfe2a767dbdeaed57eb6 | 398a7617d7a4c94703e3d85daca1e3b22d8920fa | refs/heads/master | 2022-12-24T09:31:34.156316 | 2019-06-13T20:29:10 | 2019-06-13T20:29:10 | 191,828,552 | 0 | 0 | null | 2022-12-15T23:25:17 | 2019-06-13T20:26:20 | Java | UTF-8 | Java | false | false | 99 | java | package by.itacademy.keikom.taxi.dao.filter;
public class BrandFilter extends AbstractFilter {
}
| [
"mihaila4038@gmail.com"
] | mihaila4038@gmail.com |
ead4c231802d7bdd395c2404610c664dd6b915e5 | 652f9cbd003cba19e6b2d9127dab9cb62cdcab11 | /SmartServices/app/src/main/java/com/example/smartservices/Orders.java | 9570b3a8a3208ec7e49dd895a4eb624664458ebe | [] | no_license | MeghanaAnkam/SmartServices | 119b17606d985a11c3a6ee0591701fca859c6e1d | eccd75f6d0deb0b655fc733fb0047ec3e289421e | refs/heads/main | 2023-05-02T17:01:24.255035 | 2021-05-28T09:09:49 | 2021-05-28T09:09:49 | 371,641,139 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 335 | java | package com.example.smartservices;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class Orders extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_orders);
}
}
| [
"meghana.ankams@gmail.com"
] | meghana.ankams@gmail.com |
80b70565dedec34ffa1a034ce91515bc5a3fba9d | 0a2b71692687712ce986223d7b8d3248f9340d3a | /app/src/main/java/com/fanfan/robot/activity/InstagramPhotoActivity.java | c3b7ed7d05ed7be6b7c8f21f8e0cfac80dc5e2c0 | [] | no_license | LuoCang/FANFAN | f1772149f61e63a90ea4439a1a2e43731a59cee7 | cec925840aca0fe30cfdf18de7c51411a696e4a2 | refs/heads/master | 2021-05-02T07:07:47.210977 | 2018-02-07T09:46:32 | 2018-02-07T09:46:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,322 | java | package com.fanfan.robot.activity;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.hardware.Camera;
import android.view.Menu;
import android.view.MenuItem;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.fanfan.novel.common.activity.BarBaseActivity;
import com.fanfan.novel.common.enums.SpecialType;
import com.fanfan.novel.model.SerialBean;
import com.fanfan.novel.presenter.CameraPresenter;
import com.fanfan.novel.presenter.LocalSoundPresenter;
import com.fanfan.novel.presenter.SerialPresenter;
import com.fanfan.novel.presenter.ipresenter.ICameraPresenter;
import com.fanfan.novel.presenter.ipresenter.ILocalSoundPresenter;
import com.fanfan.novel.presenter.ipresenter.ISerialPresenter;
import com.fanfan.novel.service.SerialService;
import com.fanfan.novel.service.event.ReceiveEvent;
import com.fanfan.novel.service.event.ServiceToActivityEvent;
import com.fanfan.novel.service.udp.SocketManager;
import com.fanfan.robot.R;
import com.fanfan.robot.presenter.TakePresenter;
import com.fanfan.robot.presenter.ipersenter.ITakePresenter;
import com.seabreeze.log.Print;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.net.DatagramPacket;
import butterknife.BindView;
import butterknife.OnClick;
/**
* Created by android on 2018/1/9.
*/
public class InstagramPhotoActivity extends BarBaseActivity implements
SurfaceHolder.Callback,
ICameraPresenter.ICameraView,
ITakePresenter.ITakeView,
ILocalSoundPresenter.ILocalSoundView,
ISerialPresenter.ISerialView {
@BindView(R.id.camera_surfaceview)
SurfaceView cameraSurfaceView;
@BindView(R.id.tv_countTime)
TextView tvCountTime;
@BindView(R.id.time_layout)
RelativeLayout timeLayout;
@BindView(R.id.take_layout)
RelativeLayout takeLayout;
@BindView(R.id.choose_layout)
LinearLayout chooseLayout;
@BindView(R.id.share_layout)
RelativeLayout shareLayout;
@BindView(R.id.tv_back)
TextView tvBack;
@BindView(R.id.tv_share)
TextView tvShare;
@BindView(R.id.tv_next)
TextView tvNext;
@BindView(R.id.iv_take_photo)
ImageView ivTakePhoto;
@BindView(R.id.iv_or_code)
ImageView ivOrCode;
public static void newInstance(Activity context) {
Intent intent = new Intent(context, InstagramPhotoActivity.class);
context.startActivity(intent);
context.overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
}
private CameraPresenter mCameraPresenter;
private TakePresenter mTakePresenter;
private LocalSoundPresenter mSoundPresenter;
private SerialPresenter mSerialPresenter;
private String mSavePath;
@Override
protected int getLayoutId() {
return R.layout.activity_instagram_photo;
}
@Override
protected void initView() {
super.initView();
SurfaceHolder holder = cameraSurfaceView.getHolder(); // ่ทๅพSurfaceHolderๅฏน่ฑก
holder.addCallback(this); // ไธบSurfaceViewๆทปๅ ็ถๆ็ๅฌ
holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
mCameraPresenter = new CameraPresenter(this, holder);
mTakePresenter = new TakePresenter(this);
mSoundPresenter = new LocalSoundPresenter(this);
mSoundPresenter.start();
mSerialPresenter = new SerialPresenter(this);
mSerialPresenter.start();
timeLayout.setVisibility(View.VISIBLE);
}
@Override
protected void initData() {
}
@Override
protected void onStart() {
super.onStart();
EventBus.getDefault().register(this);
mSoundPresenter.startRecognizerListener();
mTakePresenter.start();
}
@Override
protected void onResume() {
super.onResume();
mSoundPresenter.buildTts();
mSoundPresenter.buildIat();
}
@Override
protected void onPause() {
super.onPause();
mCameraPresenter.closeCamera();
}
@Override
protected void onStop() {
super.onStop();
EventBus.getDefault().unregister(this);
mTakePresenter.finish();
mSoundPresenter.stopTts();
mSoundPresenter.stopRecognizerListener();
mSoundPresenter.stopHandler();
}
@Override
protected void onDestroy() {
super.onDestroy();
mTakePresenter.stopCountDownTimer();
mSoundPresenter.finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.home_white, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.home:
break;
}
return super.onOptionsItemSelected(item);
}
@OnClick({R.id.tv_back, R.id.tv_share, R.id.tv_next, R.id.iv_take_photo})
public void onClick(View view) {
switch (view.getId()) {
case R.id.tv_back:
mCameraPresenter.pictureTakenFinsih();
chooseLayout.setVisibility(View.GONE);
takeLayout.setVisibility(View.VISIBLE);
break;
case R.id.tv_share:
mCameraPresenter.pictureTakenFinsih();
chooseLayout.setVisibility(View.GONE);
mTakePresenter.sharePhoto(mSavePath);
break;
case R.id.tv_next:
shareLayout.setVisibility(View.GONE);
takeLayout.setVisibility(View.VISIBLE);
mCameraPresenter.pictureTakenFinsih();
break;
case R.id.iv_take_photo:
mCameraPresenter.cameraTakePicture();
break;
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onResultEvent(ServiceToActivityEvent event) {
if (event.isOk()) {
SerialBean serialBean = event.getBean();
mSerialPresenter.onDataReceiverd(serialBean);
} else {
Print.e("ReceiveEvent error");
}
}
@Subscribe(threadMode = ThreadMode.BACKGROUND)
public void onResultEvent(ReceiveEvent event) {
if (event.isOk()) {
DatagramPacket packet = event.getBean();
if (!SocketManager.getInstance().isGetTcpIp) {
SocketManager.getInstance().setUdpIp(packet.getAddress().getHostAddress(), packet.getPort());
}
String recvStr = new String(packet.getData(), 0, packet.getLength());
mSerialPresenter.receiveMotion(SerialService.DEV_BAUDRATE, recvStr);
Print.e(recvStr);
} else {
Print.e("ReceiveEvent error");
}
}
private void addSpeakAnswer(String messageContent) {
mSoundPresenter.doAnswer(messageContent);
}
private void addSpeakAnswer(int res) {
mSoundPresenter.doAnswer(getResources().getString(res));
}
@Override
public void surfaceCreated(SurfaceHolder surfaceHolder) {
mCameraPresenter.openCamera();
mCameraPresenter.doStartPreview();
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
mCameraPresenter.setMatrix(width, height);
}
@Override
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
mCameraPresenter.closeCamera();
}
@Override
public void showLoading() {
}
@Override
public void dismissLoading() {
}
@Override
public void showMsg(String msg) {
showToast(msg);
}
@Override
public void showMsg(int msg) {
showToast(msg);
}
@Override
public Context getContext() {
return this;
}
@Override
public void previewFinish() {
mTakePresenter.startCountDownTimer();
}
@Override
public void pictureTakenSuccess(String savePath) {
showToast("ๆ็
งๅฎๆ");
takeLayout.setVisibility(View.GONE);
timeLayout.setVisibility(View.GONE);
chooseLayout.setVisibility(View.VISIBLE);
mSavePath = savePath;
}
@Override
public void pictureTakenFail() {
mCameraPresenter.pictureTakenFinsih();
}
@Override
public void autoFocusSuccess() {
}
@Override
public void noFace() {
}
@Override
public void tranBitmap(Bitmap bitmap, int num) {
}
@Override
public void setCameraFaces(Camera.Face[] faces) {
}
@Override
public void onTick(String l) {
tvCountTime.setText(l);
}
@Override
public void onFinish() {
tvCountTime.setText("0");
mCameraPresenter.cameraTakePicture();
}
@Override
public void uploadSuccess(String url) {
shareLayout.setVisibility(View.VISIBLE);
Bitmap codeBitmap = mTakePresenter.generatingCode(url, 480, 480,
BitmapFactory.decodeResource(getResources(), R.mipmap.ic_logo));
ivOrCode.setImageBitmap(codeBitmap);
}
//**********************************************************************************************
@Override
public void spakeMove(SpecialType type, String result) {
mSoundPresenter.onCompleted();
switch (type) {
case Forward:
mSerialPresenter.receiveMotion(SerialService.DEV_BAUDRATE, "A5038002AA");
break;
case Backoff:
mSerialPresenter.receiveMotion(SerialService.DEV_BAUDRATE, "A5038008AA");
break;
case Turnleft:
mSerialPresenter.receiveMotion(SerialService.DEV_BAUDRATE, "A5038004AA");
break;
case Turnright:
mSerialPresenter.receiveMotion(SerialService.DEV_BAUDRATE, "A5038006AA");
break;
}
}
@Override
public void openMap() {
addSpeakAnswer(R.string.open_map);
}
@Override
public void stopListener() {
mSoundPresenter.stopTts();
mSoundPresenter.stopRecognizerListener();
mSoundPresenter.stopHandler();
}
@Override
public void back() {
finish();
}
@Override
public void artificial() {
addSpeakAnswer(R.string.open_artificial);
}
@Override
public void face(SpecialType type, String result) {
addSpeakAnswer(R.string.open_face);
}
@Override
public void control(SpecialType type, String result) {
addSpeakAnswer(R.string.open_control);
}
@Override
public void refLocalPage(String result) {
addSpeakAnswer(R.string.open_local);
}
@Override
public void stopAll() {
super.stopAll();
mSoundPresenter.stopTts();
mSoundPresenter.stopRecognizerListener();
mSoundPresenter.stopHandler();
mSoundPresenter.doAnswer(resFoFinal(R.array.wake_up));
}
@Override
public void onMoveStop() {
}
}
| [
"765151629@qq.com"
] | 765151629@qq.com |
701e26bf970929199732bf5a02050038c686ea44 | 1f35414cb7a9a74d2bb7b45ed669da0a5be5bba1 | /src/main/java/com.github.astarte25/serviceImpl/TicketServiceImpl.java | f6cb7cef6fe45adfae33e649fcf14b62219b3222 | [] | no_license | astarte25/ParkingApp | f118a9b5054af2fa4b4630d85a7dfb0ff19ad58d | 5b4f4278e2c51e76464c005816513912f3f69ce9 | refs/heads/master | 2020-03-21T08:14:52.540825 | 2018-06-26T21:46:16 | 2018-06-26T21:46:16 | 138,330,330 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 531 | java | package com.github.astarte25.serviceImpl;
import com.github.astarte25.model.Ticket;
import com.github.astarte25.service.TicketService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class TicketServiceImpl implements TicketService {
@Override
public Ticket saveTicket(Ticket ticket) {
return null;
}
@Override
public Ticket getOneById(long id) {
return null;
}
@Override
public List<Ticket> getAllTickets() {
return null;
}
}
| [
"astarte2525@interia.pl"
] | astarte2525@interia.pl |
3aec8bd60af3dd44d858a58087b6e56185c25bde | 7aca72c272a2dbd7e1fc1b9723a19c9eda24817b | /app/src/main/java/ru/icqparty/moneytracker/activities/RemoveDialogListener.java | ceea4c1599756fb4dd679cac8d06ea0bf626da49 | [] | no_license | icqparty/MoneyTracker | 4863ed07770ea9ae62e3b05b474666b7cca11834 | d131ad0f9c8f5c6526aa3d0f14e0809381c202e6 | refs/heads/master | 2021-09-11T01:32:49.919502 | 2018-04-05T18:58:05 | 2018-04-05T18:58:05 | 125,364,739 | 0 | 0 | null | 2018-04-05T18:58:06 | 2018-03-15T12:34:43 | Java | UTF-8 | Java | false | false | 201 | java | package ru.icqparty.moneytracker.activities;
/**
* Created by icqparty on 27.03.2018.
*/
public interface RemoveDialogListener {
void onPositiveBtnClicked();
void onNegativeBtnClicked();
} | [
"icqparty@gmail.com"
] | icqparty@gmail.com |
52acec75ecc22a7b42991e2ede87c22200475129 | 22bee32fa6de509bcd5cd50f21055488a882ae72 | /src/main/java/model/facebook/graph/request/PhotoProfilePostGraphSearchRequest.java | 8ebdcf3107df22215d4cf39968d47f38a5c2b371 | [] | no_license | vkamran7/osint-java-lib | 88ecca342e663869137b4455c483aec40e7bf2b1 | 013affc6f440c840ceab41c69bae3e6fd02598b0 | refs/heads/main | 2023-03-16T01:36:28.197251 | 2021-03-04T18:59:04 | 2021-03-04T18:59:04 | 336,939,414 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,763 | java | package model.facebook.graph.request;
public class PhotoProfilePostGraphSearchRequest {
private String query;
private Integer limit;
private String type;
private Integer timeout;
public String getQuery() {
return query;
}
public Integer getLimit() {
return limit;
}
public String getType() {
return type;
}
public Integer getTimeout() {
return timeout;
}
public static final class Builder {
private String query;
private Integer limit;
private String type;
private Integer timeout;
public Builder() {
}
public static Builder aPhotoProfilePostGraphSearchRequest() {
return new Builder();
}
public Builder withQuery(String query) {
this.query = query;
return this;
}
public Builder withLimit(Integer limit) {
this.limit = limit;
return this;
}
public Builder withType(String type) {
this.type = type;
return this;
}
public Builder withTimeout(Integer timeout) {
this.timeout = timeout;
return this;
}
public PhotoProfilePostGraphSearchRequest build() {
PhotoProfilePostGraphSearchRequest photoProfilePostGraphSearchRequest = new PhotoProfilePostGraphSearchRequest();
photoProfilePostGraphSearchRequest.query = this.query;
photoProfilePostGraphSearchRequest.limit = this.limit;
photoProfilePostGraphSearchRequest.timeout = this.timeout;
photoProfilePostGraphSearchRequest.type = this.type;
return photoProfilePostGraphSearchRequest;
}
}
}
| [
"vkamran7@gmail.com"
] | vkamran7@gmail.com |
ea9280926bd15cce64f88c4dc5749d86f2cee6a0 | 23c5822405a68d2e70d0c723a3d1dad55f98e338 | /app/src/main/java-gen/cn/zhoujia/haowanapp/greendao/Notepad.java | 314b07e79a7057fef3e21039ed49bde19a61972c | [] | no_license | zhoujia456888/HaoWanAPP | f3e0065ae25b1696c858bad2600ab3293407f78a | 67ca72dd09667a3ebcb6bce780b4360706ed1a52 | refs/heads/master | 2021-01-21T12:58:24.796257 | 2016-05-30T07:54:53 | 2016-05-30T07:54:54 | 53,710,058 | 7 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package cn.zhoujia.haowanapp.greendao;
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
* Entity mapped to table "NOTEPAD".
*/
public class Notepad {
private Long id;
private String notepadcontent;
private String notepaddate;
public Notepad() {
}
public Notepad(Long id) {
this.id = id;
}
public Notepad(Long id, String notepadcontent, String notepaddate) {
this.id = id;
this.notepadcontent = notepadcontent;
this.notepaddate = notepaddate;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNotepadcontent() {
return notepadcontent;
}
public void setNotepadcontent(String notepadcontent) {
this.notepadcontent = notepadcontent;
}
public String getNotepaddate() {
return notepaddate;
}
public void setNotepaddate(String notepaddate) {
this.notepaddate = notepaddate;
}
}
| [
"1442274053@qq.com"
] | 1442274053@qq.com |
34da9e58852c0bdcdbc5bb6af8ff9f3a6cdd3de0 | aef300dcd276b03d46676a6d2dc759756dd8f93b | /app/src/main/java/com/kampuskoding/kampusmaterialdesign/components/navigation/BasicNavigationDrawerActivity.java | fffbd2501be921ed77cb3acde764c41facd4025d | [] | no_license | wahyouwebid/kk-material-design | 795321e714bd1df068c20dd1a7351a84edc105fb | 942d90e2326e49506a0fbc31e2f23266de3a8a86 | refs/heads/master | 2021-09-23T09:45:52.081583 | 2018-09-21T07:44:45 | 2018-09-21T07:44:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,036 | java | package com.kampuskoding.kampusmaterialdesign.components.navigation;
import android.os.Build;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.kampuskoding.kampusmaterialdesign.R;
public class BasicNavigationDrawerActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_basic_navigation_drawer);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setTitle("Basic Drawer");
if (Build.VERSION.SDK_INT >= 21) {
getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.orange_400)); // Navigation bar the soft bottom of some phones like nexus and some Samsung note series
getWindow().setStatusBarColor(ContextCompat.getColor(this,R.color.orange_400)); //status bar or the time bar at the top
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show();
}
});
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
super.onBackPressed();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.basic_navigation_drawer, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_camera) {
// Handle the camera action
} else if (id == R.id.nav_gallery) {
} else if (id == R.id.nav_slideshow) {
} else if (id == R.id.nav_manage) {
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
}
| [
"ujangwahyusst@gmail.com"
] | ujangwahyusst@gmail.com |
273d207d7b957808eb0157b0876711a1bb747439 | d88c0412d657b5dbacda3ed2fafce6f258f755ff | /src/main/java/com/example/autocinfigure/ExampleService.java | b99c388767c98c71760edb5aedb5aac81c409c7f | [] | no_license | CielChen/spring-boot-starter-example | f807c9dbecdf49bcc05edf46e3bcb6f0db651a6e | c23c002e5f40a78f3b6347331ecf7a6bc8160047 | refs/heads/master | 2022-06-21T03:05:12.995972 | 2020-05-08T08:34:00 | 2020-05-08T08:34:00 | 262,262,850 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.example.autocinfigure;
public class ExampleService {
private String prefix;
private String suffix;
public ExampleService(String prefix, String suffix) {
this.prefix = prefix;
this.suffix = suffix;
}
public String wrap(String word) {
return prefix + word + suffix;
}
}
| [
"cielucas@163.com"
] | cielucas@163.com |
12901163d27378602e8429b2980e5f212c02e3bb | a80157f28449e49b9df865bbbe22190e1fe9e6b6 | /app/src/main/java/com/niketgoel/niketexpensemanager/utils/Strings.java | e99f2479bb3d93c2c4e72573a010d7dd7195b990 | [] | no_license | ayasyadigital/niketexpensemanager_2 | e5e6c07e6c1919572246c353be149eb3994e4ab8 | 9110473c71d80d4d43887c88451f42b85cd2edc2 | refs/heads/master | 2021-08-24T11:51:58.971909 | 2017-12-09T16:13:38 | 2017-12-09T16:13:39 | 113,684,575 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,303 | java | package com.niketgoel.niketexpensemanager.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class Strings {
public static final String EMPTY = "";
public static String InputStreamToString(InputStream inputStream){
InputStreamReader isr = new InputStreamReader(inputStream); // Input stream that translates bytes to characters
BufferedReader br = new BufferedReader(isr); // Buffered input character stream
String str;
StringBuilder output = new StringBuilder();
try {
while((str = br.readLine())!= null){ output.append(str); }
} catch (IOException e) {
e.printStackTrace();
}
return output.toString();
}
public static String toString( final Object o ) {
return toString(o,"");
}
public static String toString( final Object o, final String def ) {
return o==null ? def : o.toString();
}
public static boolean isEmpty( final String s ) {
return s==null || s.length()==0;
}
public static boolean notEmpty( final String s ) {
return s!=null && s.length()!=0;
}
public static boolean equal( final String a, final String b ) {
return a==b || ( a!=null && b!=null && a.equals(b) );
}
}
| [
"niket03@gmail.com"
] | niket03@gmail.com |
8f407c1ee36cac04efad755daf48d5e1f51448bb | c314325a88074867d1058c78d69f9ca50156d0bb | /src/com/jeecms/cms/entity/main/Channel.java | a06df972e57fbd39f9cc9b3a4d3e08640cba2c40 | [] | no_license | zhaoshunxin/jeecmsv8 | 88bd5995c87475f568544bb131280550bf323714 | 0df764a90f4dcf54e9b23854e988b8a78a7d0bda | refs/heads/master | 2020-03-27T22:18:42.905602 | 2017-03-29T16:14:44 | 2017-03-29T16:14:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 29,241 | java | package com.jeecms.cms.entity.main;
import static com.jeecms.common.web.Constants.INDEX;
import static com.jeecms.common.web.Constants.SPT;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import org.apache.commons.lang.StringUtils;
import com.jeecms.cms.entity.main.base.BaseChannel;
import com.jeecms.cms.staticpage.StaticPageUtils;
import com.jeecms.common.hibernate4.HibernateTree;
import com.jeecms.common.hibernate4.PriorityComparator;
import com.jeecms.common.hibernate4.PriorityInterface;
import com.jeecms.core.entity.CmsGroup;
import com.jeecms.core.entity.CmsSite;
import com.jeecms.core.entity.CmsUser;
/**
* ๆ ็ฎๅฎไฝ็ฑป
*/
public class Channel extends BaseChannel implements HibernateTree<Integer>,
PriorityInterface {
private static final long serialVersionUID = 1L;
/**
* ๅฎกๆ ธๅๅ
ๅฎนไฟฎๆนๆนๅผ
*/
public static enum AfterCheckEnum {
/**
* ไธ่ฝไฟฎๆน๏ผไธ่ฝๅ ้คใ
*/
CANNOT_UPDATE,
/**
* ๅฏไปฅไฟฎๆน๏ผๅฏไปฅๅ ้คใ ไฟฎๆนๅๆ็ซ ็ๅฎกๆ ธ็บงๅซๅฐ้ๅๅฐไฟฎๆนไบบ็บงๅซ็็ถๆใๅฆๆไฟฎๆนไบบ็็บงๅซ้ซไบๅฝๅๆ็ซ ็ๅฎกๆ ธ็บงๅซ๏ผ้ฃไนๆ็ซ ๅฎกๆ ธ็บงๅซๅฐไฟๆไธๅใ
*/
BACK_UPDATE,
/**
* ๅฏไปฅไฟฎๆน๏ผๅฏไปฅๅ ้คใ ไฟฎๆนๅๆ็ซ ไฟๆๅ็ถๆใ
*/
KEEP_UPDATE
}
/**
* ่ทๅพURLๅฐๅ
*
* @return
*/
public String getUrl() {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
if (getStaticChannel()) {
return getUrlStatic(false, 1);
} else if(!StringUtils.isBlank(getSite().getDomainAlias())){
return getUrlDynamic(null);
}else {
return getUrlDynamic(true);
}
}
public String getHttpsUrl() {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
if (getStaticChannel()) {
return getHttpsUrlStatic(false, 1);
} else if(!StringUtils.isBlank(getSite().getDomainAlias())){
return getHttpsUrlDynamic(null);
}else {
return getHttpsUrlDynamic(true);
}
}
public String getMobileUrl() {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
if (getStaticChannel()) {
return getMobileUrlStatic(false, 1);
}else {
// return getUrlDynamic(null);
//ๆญคๅคๅ
ฑไบซไบๅซ็ซไฟกๆฏ้่ฆ็ปๅฅ่ทฏๅพ๏ผๅไบๆดๆน ไบ2012-7-26ไฟฎๆน
return getUrlDynamic(true);
}
}
public String getUrlWhole() {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
if (getStaticChannel()) {
return getUrlStatic(true, 1);
} else {
return getUrlDynamic(true);
}
}
/**
* ่ทๅพ้ๆURLๅฐๅ
*
* @return
*/
public String getUrlStatic() {
return getUrlStatic(null, 1);
}
public String getUrlStatic(int pageNo) {
return getUrlStatic(null, pageNo);
}
public String getUrlStatic(Boolean whole, int pageNo) {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
CmsSite site = getSite();
StringBuilder url = site.getUrlBuffer(false, whole, false);
String filename = getStaticFilenameByRule();
if (!StringUtils.isBlank(filename)) {
if (pageNo > 1) {
int index = filename.indexOf(".", filename.lastIndexOf("/"));
if (index != -1) {
url.append(filename.substring(0, index));
url.append("_").append(pageNo);
url.append(filename.substring(index));
} else {
url.append("_").append(pageNo);
}
} else {
if (getAccessByDir()) {
url.append(filename.substring(0,
filename.lastIndexOf("/") + 1));
} else {
url.append(filename);
}
}
} else {
// ้ป่ฎค้ๆ้กต้ข่ฎฟ้ฎ่ทฏๅพ
url.append(SPT).append(getPath());
if (pageNo > 1) {
url.append("_").append(pageNo);
url.append(site.getStaticSuffix());
} else {
if (getHasContent()) {
url.append(SPT);
} else {
url.append(site.getStaticSuffix());
}
}
}
return url.toString();
}
public String getHttpsUrlStatic(Boolean whole, int pageNo) {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
CmsSite site = getSite();
StringBuilder url = site.getHttpsUrlBuffer(false, whole, false);
String filename = getStaticFilenameByRule();
if (!StringUtils.isBlank(filename)) {
if (pageNo > 1) {
int index = filename.indexOf(".", filename.lastIndexOf("/"));
if (index != -1) {
url.append(filename.substring(0, index));
url.append("_").append(pageNo);
url.append(filename.substring(index));
} else {
url.append("_").append(pageNo);
}
} else {
if (getAccessByDir()) {
url.append(filename.substring(0,
filename.lastIndexOf("/") + 1));
} else {
url.append(filename);
}
}
} else {
// ้ป่ฎค้ๆ้กต้ข่ฎฟ้ฎ่ทฏๅพ
url.append(SPT).append(getPath());
if (pageNo > 1) {
url.append("_").append(pageNo);
url.append(site.getStaticSuffix());
} else {
if (getHasContent()) {
url.append(SPT);
} else {
url.append(site.getStaticSuffix());
}
}
}
return url.toString();
}
public String getMobileUrlStatic(Boolean whole, int pageNo) {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
CmsSite site = getSite();
StringBuilder url = site.getMobileUrlBuffer(false, whole, false);
String filename = getStaticFilenameByRule();
if (!StringUtils.isBlank(filename)) {
if (pageNo > 1) {
int index = filename.indexOf(".", filename.lastIndexOf("/"));
if (index != -1) {
url.append(filename.substring(0, index));
url.append("_").append(pageNo);
url.append(filename.substring(index));
} else {
url.append("_").append(pageNo);
}
} else {
if (getAccessByDir()) {
url.append(filename.substring(0,
filename.lastIndexOf("/") + 1));
} else {
url.append(filename);
}
}
} else {
// ้ป่ฎค้ๆ้กต้ข่ฎฟ้ฎ่ทฏๅพ
url.append(SPT).append(getPath());
if (pageNo > 1) {
url.append("_").append(pageNo);
url.append(site.getStaticSuffix());
} else {
if (getHasContent()) {
url.append(SPT);
} else {
url.append(site.getStaticSuffix());
}
}
}
return url.toString();
}
public String getStaticFilename(int pageNo) {
CmsSite site = getSite();
StringBuilder url = new StringBuilder();
String staticDir = site.getStaticDir();
if (!StringUtils.isBlank(staticDir)) {
url.append(staticDir);
}
String filename = getStaticFilenameByRule();
if (!StringUtils.isBlank(filename)) {
int index = filename.indexOf(".", filename.lastIndexOf("/"));
if (pageNo > 1) {
if (index != -1) {
url.append(filename.substring(0, index)).append("_")
.append(pageNo).append(filename.substring(index));
} else {
url.append(filename).append("_").append(pageNo);
}
} else {
url.append(filename);
}
} else {
// ้ป่ฎค้ๆ้กต้ข่ฎฟ้ฎ่ทฏๅพ
url.append(SPT).append(getPath());
String suffix = site.getStaticSuffix();
if (getHasContent()) {
url.append(SPT).append(INDEX);
if (pageNo > 1) {
url.append("_").append(pageNo);
}
url.append(suffix);
} else {
if (pageNo > 1) {
url.append("_").append(pageNo);
}
url.append(suffix);
}
}
return url.toString();
}
public String getMobileStaticFilename(int pageNo) {
CmsSite site = getSite();
StringBuilder url = new StringBuilder();
String staticDir = site.getStaticMobileDir();
if (!StringUtils.isBlank(staticDir)) {
url.append(staticDir);
}
String filename = getStaticFilenameByRule();
if (!StringUtils.isBlank(filename)) {
int index = filename.indexOf(".", filename.lastIndexOf("/"));
if (pageNo > 1) {
if (index != -1) {
url.append(filename.substring(0, index)).append("_")
.append(pageNo).append(filename.substring(index));
} else {
url.append(filename).append("_").append(pageNo);
}
} else {
url.append(filename);
}
} else {
// ้ป่ฎค้ๆ้กต้ข่ฎฟ้ฎ่ทฏๅพ
url.append(SPT).append(getPath());
String suffix = site.getStaticSuffix();
if (getHasContent()) {
url.append(SPT).append(INDEX);
if (pageNo > 1) {
url.append("_").append(pageNo);
}
url.append(suffix);
} else {
if (pageNo > 1) {
url.append("_").append(pageNo);
}
url.append(suffix);
}
}
return url.toString();
}
public String getStaticFilenameByRule() {
String rule = getChannelRule();
if (StringUtils.isBlank(rule)) {
return null;
}
CmsModel model = getModel();
String url = StaticPageUtils.staticUrlRule(rule, model.getId(), model
.getPath(), getId(), getPath(), null, null);
return url;
}
/**
* ่ทๅพๅจๆURLๅฐๅ
*
* @return
*/
public String getUrlDynamic() {
return getUrlDynamic(null);
}
public String getUrlDynamic(Boolean whole) {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
CmsSite site = getSite();
StringBuilder url = site.getUrlBuffer(true, whole, false);
url.append(SPT).append(getPath());
if (getHasContent()) {
url.append(SPT).append(INDEX);
}
url.append(site.getDynamicSuffix());
return url.toString();
}
public String getHttpsUrlDynamic(Boolean whole) {
if (!StringUtils.isBlank(getLink())) {
return getLink();
}
CmsSite site = getSite();
StringBuilder url = site.getHttpsUrlBuffer(true, whole, false);
url.append(SPT).append(getPath());
if (getHasContent()) {
url.append(SPT).append(INDEX);
}
url.append(site.getDynamicSuffix());
return url.toString();
}
/**
* ่ทๅพ่็นๅ่กจใไป็ถ่็นๅฐ่ช่บซใ
*
* @return
*/
public List<Channel> getNodeList() {
LinkedList<Channel> list = new LinkedList<Channel>();
Channel node = this;
while (node != null) {
list.addFirst(node);
node = node.getParent();
}
return list;
}
/**
* ่ทๅพ่็นๅ่กจIDใไป็ถ่็นๅฐ่ช่บซใ
*
* @return
*/
public Integer[] getNodeIds() {
List<Channel> channels = getNodeList();
Integer[] ids = new Integer[channels.size()];
int i = 0;
for (Channel c : channels) {
ids[i++] = c.getId();
}
return ids;
}
/**
* ่ทๅพๆทฑๅบฆ
*
* @return ็ฌฌไธๅฑไธบ0๏ผ็ฌฌไบๅฑไธบ1๏ผไปฅๆญค็ฑปๆจใ
*/
public int getDeep() {
int deep = 0;
Channel parent = getParent();
while (parent != null) {
deep++;
parent = parent.getParent();
}
return deep;
}
public Channel getTopChannel() {
Channel parent = getParent();
while (parent != null) {
if(parent.getParent()!=null){
parent = parent.getParent();
}else{
break;
}
}
return parent;
}
/**
* ่ทๅๆ ็ฎไธๆปๆต่ง้
* @return
*/
public int getViewTotal() {
Integer totalView=0;
List<Channel> list = new ArrayList<Channel>();
addChildToList(list, this, true);
for(Channel c:list){
totalView+=c.getChannelCount().getViews();
}
return totalView;
}
/**
*
* @return
*/
public int getViewsDayTotal() {
Integer totalView=0;
List<Channel> list = new ArrayList<Channel>();
addChildToList(list, this, true);
for(Channel c:list){
totalView+=c.getChannelCount().getViewsDay();
}
return totalView;
}
public int getViewsMonthTotal() {
Integer totalView=0;
List<Channel> list = new ArrayList<Channel>();
addChildToList(list, this, true);
for(Channel c:list){
totalView+=c.getChannelCount().getViewsMonth();
}
return totalView;
}
public int getViewsWeekTotal() {
Integer totalView=0;
List<Channel> list = new ArrayList<Channel>();
addChildToList(list, this, true);
for(Channel c:list){
totalView+=c.getChannelCount().getViewsWeek();
}
return totalView;
}
public int getContentTotal() {
ChannelCount c=getChannelCount();
return c.getContentTotal();
}
public int getContentDay() {
ChannelCount c=getChannelCount();
return c.getContentDay();
}
public int getContentMonth() {
ChannelCount c=getChannelCount();
return c.getContentMonth();
}
public int getContentWeek() {
ChannelCount c=getChannelCount();
return c.getContentWeek();
}
public int getContentYear() {
ChannelCount c=getChannelCount();
return c.getContentYear();
}
private static void addChildToList(List<Channel> list, Channel channel, boolean hasContentOnly) {
list.add(channel);
Set<Channel> child = channel.getChild();
for (Channel c : child) {
if (hasContentOnly) {
if (c.getHasContent()) {
addChildToList(list, c, hasContentOnly);
}
} else {
addChildToList(list, c, hasContentOnly);
}
}
}
/**
* ่ทๅพๆ ็ฎ็ปๅฎก็บงๅซ
*
* @return
*/
public Byte getFinalStepExtends() {
Byte step = getFinalStep();
if (step == null) {
Channel parent = getParent();
if (parent == null) {
return getSite().getFinalStep();
} else {
return parent.getFinalStepExtends();
}
} else {
return step;
}
}
public Byte getAfterCheck() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getAfterCheck();
} else {
return null;
}
}
/**
* ่ทๅพๅฎกๆ ธๅไฟฎๆนๆนๅผ็ๆไธพๅผใๅฆๆ่ฏฅๅผไธบnullๅๅ็ถ็บงๆ ็ฎ๏ผ็ถๆ ็ฎไธบnullๅๅ็ซ็น็ธๅ
ณ่ฎพ็ฝฎใ
*
* @return
*/
public AfterCheckEnum getAfterCheckEnum() {
Byte after = getChannelExt().getAfterCheck();
Channel channel = getParent();
// ๅฆๆไธบnull๏ผๅๆฅๆพ็ถๆ ็ฎใ
while (after == null && channel != null) {
after = channel.getAfterCheck();
channel = channel.getParent();
}
// ๅฆๆไพ็ถไธบnull๏ผๅๆฅๆพ็ซ็น่ฎพ็ฝฎ
if (after == null) {
after = getSite().getAfterCheck();
}
if (after == 1) {
return AfterCheckEnum.CANNOT_UPDATE;
} else if (after == 2) {
return AfterCheckEnum.BACK_UPDATE;
} else if (after == 3) {
return AfterCheckEnum.KEEP_UPDATE;
} else {
// ้ป่ฎคไธบไธๅฏๆนใไธๅฏๅ
return AfterCheckEnum.CANNOT_UPDATE;
}
}
/**
* ่ทๅพๅ่กจ็จไบไธๆ้ๆฉใๆกไปถ๏ผๆๅ
ๅฎน็ๆ ็ฎใ
*
* @return
*/
public List<Channel> getListForSelect(Set<Channel> rights,
boolean hasContentOnly) {
return getListForSelect(rights, null, hasContentOnly);
}
public List<Channel> getListForSelect(Set<Channel> rights, Channel exclude,
boolean hasContentOnly) {
List<Channel> list = new ArrayList<Channel>((getRgt() - getLft()) / 2);
addChildToList(list, this, rights, exclude, hasContentOnly);
return list;
}
/**
* ่ทๅพๅ่กจ็จไบไธๆ้ๆฉใๆกไปถ๏ผๆๅ
ๅฎน็ๆ ็ฎใ
*
* @param topList
* ้กถ็บงๆ ็ฎ
* @return
*/
public static List<Channel> getListForSelect(List<Channel> topList,
Set<Channel> rights, boolean hasContentOnly) {
return getListForSelect(topList, rights, null, hasContentOnly);
}
public static List<Channel> getListForSelect(List<Channel> topList,
Set<Channel> rights, Channel exclude, boolean hasContentOnly) {
List<Channel> list = new ArrayList<Channel>();
for (Channel c : topList) {
addChildToList(list, c, rights, exclude, hasContentOnly);
}
return list;
}
/**
* ้ๅฝๅฐๅญๆ ็ฎๅ ๅ
ฅๅ่กจใๆกไปถ๏ผๆๅ
ๅฎน็ๆ ็ฎใ
*
* @param list
* ๆ ็ฎๅฎนๅจ
* @param channel
* ๅพ
ๆทปๅ ็ๆ ็ฎ๏ผไธ้ๅฝๆทปๅ ๅญๆ ็ฎ
* @param rights
* ๆๆ้็ๆ ็ฎ๏ผไธบnullไธๆงๅถๆ้ใ
*/
private static void addChildToList(List<Channel> list, Channel channel,
Set<Channel> rights, Channel exclude, boolean hasContentOnly) {
if ((rights != null && !rights.contains(channel))
|| (exclude != null && exclude.equals(channel))) {
return;
}
list.add(channel);
Set<Channel> child = channel.getChild();
for (Channel c : child) {
if (hasContentOnly) {
if (c.getHasContent()) {
addChildToList(list, c, rights, exclude, hasContentOnly);
}
} else {
addChildToList(list, c, rights, exclude, hasContentOnly);
}
}
}
public String getTplChannelOrDef() {
String tpl = getTplChannel();
if (!StringUtils.isBlank(tpl)) {
return tpl;
} else {
String sol = getSite().getSolutionPath();
return getModel().getTplChannel(sol, true);
}
}
public String getMobileTplChannelOrDef() {
String tpl = getMobileTplChannel();
if (!StringUtils.isBlank(tpl)) {
return tpl;
} else {
String sol = getSite().getMobileSolutionPath();
return getModel().getTplChannel(sol, true);
}
}
public String getTplContentOrDef(CmsModel contentModel) {
String tpl = getModelTpl(contentModel);
if (!StringUtils.isBlank(tpl)) {
return tpl;
} else {
String sol = getSite().getSolutionPath();
return contentModel.getTplContent(sol, true);
}
}
public String getMobileTplContentOrDef(CmsModel contentModel) {
String tpl = getModelMobileTpl(contentModel);
if (!StringUtils.isBlank(tpl)) {
return tpl;
} else {
String sol = getSite().getMobileSolutionPath();
return contentModel.getTplContent(sol, true);
}
}
public Integer[] getUserIds() {
Set<CmsUser> users = getUsers();
return CmsUser.fetchIds(users);
}
public void addToViewGroups(CmsGroup group) {
Set<CmsGroup> groups = getViewGroups();
if (groups == null) {
groups = new TreeSet<CmsGroup>(new PriorityComparator());
setViewGroups(groups);
}
groups.add(group);
group.getViewChannels().add(this);
}
public void addToContriGroups(CmsGroup group) {
Set<CmsGroup> groups = getContriGroups();
if (groups == null) {
groups = new TreeSet<CmsGroup>(new PriorityComparator());
setContriGroups(groups);
}
groups.add(group);
group.getContriChannels().add(this);
}
public void addToUsers(CmsUser user) {
Set<CmsUser> set = getUsers();
if (set == null) {
set = new TreeSet<CmsUser>(new PriorityComparator());
setUsers(set);
}
set.add(user);
user.addToChannels(this);
}
public void addToChannelModels(CmsModel model,String tpl,String mtpl) {
List<ChannelModel> list = getChannelModels();
if (list == null) {
list = new ArrayList<ChannelModel>();
setChannelModels(list);
}
ChannelModel cm = new ChannelModel();
cm.setTplContent(tpl);
cm.setTplMoibleContent(mtpl);
cm.setModel(model);
list.add(cm);
}
public List<ChannelModel> getChannelModelsExtend() {
List<ChannelModel>list=getChannelModels();
//ๆฒกๆ้
็ฝฎๆ ็ฎๆจกๅ้ป่ฎค็ถๆ ็ฎ้
็ฝฎ
if (list == null||list.size()<=0) {
Channel parent = getParent();
if (parent == null) {
return null;
} else {
return parent.getChannelModelsExtend();
}
} else {
return list;
}
}
public List<CmsModel>getModels(){
List<ChannelModel>list=getChannelModelsExtend();
if (list == null) {
return null;
}
List<CmsModel>models=new ArrayList<CmsModel>();
for(ChannelModel cm:list){
models.add(cm.getModel());
}
return models;
}
public List<CmsModel>getModels(List<CmsModel>allModels){
List<ChannelModel>list=getChannelModelsExtend();
//้กถๅฑๆ ็ฎๆฒกๆ้
็ฝฎ้ป่ฎคๆๆๅฏ็จๆจกๅ
if (list == null) {
return allModels;
}
List<CmsModel>models=new ArrayList<CmsModel>();
for(ChannelModel cm:list){
models.add(cm.getModel());
}
return models;
}
public List<String>getModelIds(){
List<String>ids=new ArrayList<String>();
List<CmsModel>models=getModels();
if(models!=null){
for(CmsModel model:models){
ids.add(model.getId().toString());
}
}
return ids;
}
public List<String>getModelTpls(){
List<ChannelModel>list=getChannelModelsExtend();
List<String>tpls=new ArrayList<String>();
// ๅฝๅๆจกๆฟ๏ผๅป้คๅบๆฌ่ทฏๅพ
int tplPathLength = getSite().getTplPath().length();
if(list!=null){
for(ChannelModel cm:list){
String tpl=cm.getTplContent();
if(StringUtils.isNotBlank(tpl)){
tpls.add(tpl.substring(tplPathLength));
}
}
}
return tpls;
}
public List<String>getMobileModelTpls(){
List<ChannelModel>list=getChannelModelsExtend();
List<String>tpls=new ArrayList<String>();
// ๅฝๅๆจกๆฟ๏ผๅป้คๅบๆฌ่ทฏๅพ
int tplPathLength = getSite().getTplPath().length();
if(list!=null){
for(ChannelModel cm:list){
String tpl=cm.getTplMoibleContent();
if(StringUtils.isNotBlank(tpl)){
tpls.add(tpl.substring(tplPathLength));
}
}
}
return tpls;
}
public String getModelTpl(CmsModel model){
List<ChannelModel>list=getChannelModelsExtend();
if(list!=null){
for(ChannelModel cm:list){
if(cm.getModel().equals(model)){
return cm.getTplContent();
}
}
}
return null;
}
public String getModelMobileTpl(CmsModel model){
List<ChannelModel>list=getChannelModelsExtend();
if(list!=null){
for(ChannelModel cm:list){
if(cm.getModel().equals(model)){
return cm.getTplMoibleContent();
}
}
}
return null;
}
public void init() {
if (getPriority() == null) {
setPriority(10);
}
if (getDisplay() == null) {
setDisplay(true);
}
}
public String getName() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getName();
} else {
return null;
}
}
public Boolean getStaticChannel() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getStaticChannel();
} else {
return null;
}
}
public Boolean getStaticContent() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getStaticContent();
} else {
return null;
}
}
public Boolean getAccessByDir() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getAccessByDir();
} else {
return null;
}
}
public Boolean getListChild() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getListChild();
} else {
return null;
}
}
public Integer getPageSize() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getPageSize();
} else {
return null;
}
}
public String getChannelRule() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getChannelRule();
} else {
return null;
}
}
public String getContentRule() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getContentRule();
} else {
return null;
}
}
public Byte getFinalStep() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getFinalStep();
} else {
return null;
}
}
public String getLink() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getLink();
} else {
return null;
}
}
public String getTplChannel() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getTplChannel();
} else {
return null;
}
}
public String getMobileTplChannel() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getTplMobileChannel();
} else {
return null;
}
}
public String getTplContent() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getTplContent();
} else {
return null;
}
}
public Boolean getHasTitleImg() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getHasTitleImg();
} else {
return null;
}
}
public Boolean getHasContentImg() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getHasContentImg();
} else {
return null;
}
}
public Integer getTitleImgWidth() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getTitleImgWidth();
} else {
return null;
}
}
public Integer getTitleImgHeight() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getTitleImgHeight();
} else {
return null;
}
}
public Integer getContentImgWidth() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getContentImgWidth();
} else {
return null;
}
}
public Integer getContentImgHeight() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getContentImgHeight();
} else {
return null;
}
}
public String getTitleImg() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getTitleImg();
} else {
return null;
}
}
public String getContentImg() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getContentImg();
} else {
return null;
}
}
public String getTitle() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getTitle();
} else {
return null;
}
}
public String getKeywords() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getKeywords();
} else {
return null;
}
}
public String getDescription() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getDescription();
} else {
return null;
}
}
public Integer getCommentControl() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getCommentControl();
} else {
return null;
}
}
public Boolean getAllowUpdown() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getAllowUpdown();
} else {
return null;
}
}
public Boolean getAllowShare() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getAllowShare();
} else {
return null;
}
}
public Boolean getAllowScore() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getAllowScore();
} else {
return null;
}
}
public Boolean getBlank() {
ChannelExt ext = getChannelExt();
if (ext != null) {
return ext.getBlank();
} else {
return null;
}
}
/**
* ่ทๅพๆ ็ฎๅ
ๅฎน
*
* @return
*/
public String getTxt() {
ChannelTxt txt = getChannelTxt();
if (txt != null) {
return txt.getTxt();
} else {
return null;
}
}
/**
* ่ทๅพๆ ็ฎๅ
ๅฎน1
*
* @return
*/
public String getTxt1() {
ChannelTxt txt = getChannelTxt();
if (txt != null) {
return txt.getTxt1();
} else {
return null;
}
}
/**
* ่ทๅพๆ ็ฎๅ
ๅฎน2
*
* @return
*/
public String getTxt2() {
ChannelTxt txt = getChannelTxt();
if (txt != null) {
return txt.getTxt2();
} else {
return null;
}
}
/**
* ่ทๅพๆ ็ฎๅ
ๅฎน3
*
* @return
*/
public String getTxt3() {
ChannelTxt txt = getChannelTxt();
if (txt != null) {
return txt.getTxt3();
} else {
return null;
}
}
public ChannelTxt getChannelTxt() {
Set<ChannelTxt> set = getChannelTxtSet();
if (set != null && set.size() > 0) {
return set.iterator().next();
} else {
return null;
}
}
/**
* ๆฏไธช็ซ็นๅ่ช็ปดๆค็ฌ็ซ็ๆ ็ปๆ
*
* @see HibernateTree#getTreeCondition()
*/
public String getTreeCondition() {
return "bean.site.id=" + getSite().getId();
}
/**
* @see HibernateTree#getParentId()
*/
public Integer getParentId() {
Channel parent = getParent();
if (parent != null) {
return parent.getId();
} else {
return null;
}
}
/**
* @see HibernateTree#getLftName()
*/
public String getLftName() {
return DEF_LEFT_NAME;
}
/**
* @see HibernateTree#getParentName()
*/
public String getParentName() {
return DEF_PARENT_NAME;
}
/**
* @see HibernateTree#getRgtName()
*/
public String getRgtName() {
return DEF_RIGHT_NAME;
}
public static Integer[] fetchIds(Collection<Channel> channels) {
if (channels == null) {
return null;
}
Integer[] ids = new Integer[channels.size()];
int i = 0;
for (Channel c : channels) {
ids[i++] = c.getId();
}
return ids;
}
public void removeViewGroup(CmsGroup group) {
Set<CmsGroup>viewGroups=getViewGroups();
viewGroups.remove(group);
}
public void removeContriGroup(CmsGroup group) {
Set<CmsGroup>contriGroups=getContriGroups();
contriGroups.remove(group);
}
/* [CONSTRUCTOR MARKER BEGIN] */
public Channel() {
super();
}
/**
* Constructor for primary key
*/
public Channel(Integer id) {
super(id);
}
/**
* Constructor for required fields
*/
public Channel(Integer id,
com.jeecms.core.entity.CmsSite site,
com.jeecms.cms.entity.main.CmsModel model, Integer lft,
Integer rgt, Integer priority,
Boolean hasContent, Boolean display) {
super(id, site, model, lft, rgt, priority, hasContent, display);
}
/* [CONSTRUCTOR MARKER END] */
} | [
"hanebert@HanEbertdeMacBook-Pro.local"
] | hanebert@HanEbertdeMacBook-Pro.local |
10efa7d2478c839259fbbdbf46522b7026145c66 | 1c69882e2d0b6adb9e0a820221de056560f48370 | /app/src/main/java/com/spideriot/kkt/PointsExchangeActivity.java | 573b4082d5ca2488b380ff49569f1e8131408382 | [] | no_license | liudong1991/kkt | 3aa804957eef3458570b06fc341c72c46f28e8f7 | 788951bf5a6ae0907b3b3ab0453bbe6d1c4bd5b1 | refs/heads/master | 2020-03-20T04:00:26.596639 | 2018-06-14T03:49:41 | 2018-06-14T03:49:41 | 137,167,438 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,065 | java | package com.spideriot.kkt;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.spideriot.kkt.common.Constants;
import com.spideriot.kkt.utils.DensityUtil;
public class PointsExchangeActivity extends AppCompatActivity {
private ImageView adImg;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.point_exchange_layout);
adImg = findViewById(R.id.icbc_ad_btn);
findViewById(R.id.back_btn).setOnClickListener(clickListener);
findViewById(R.id.icbc_ad_btn).setOnClickListener(clickListener);
handleView();
}
private void handleView() {
BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.mipmap.point_exchange_ad_icbc, options);
int imgWidth = options.outWidth;
int imgHeight = options.outHeight;
int rImgHeight = (int) ((Constants.SCREEN_WIDTH- DensityUtil.dp2px(20)) * 1.0 / imgWidth * imgHeight);
ViewGroup.LayoutParams lp = adImg.getLayoutParams();
lp.width = Constants.SCREEN_WIDTH;
lp.height = rImgHeight;
adImg.setLayoutParams(lp);
}
private View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.back_btn:
finish();
break;
case R.id.icbc_ad_btn:
Intent intent = new Intent(PointsExchangeActivity.this, PointsExchangeDetailActivity.class);
startActivity(intent);
break;
}
}
};
}
| [
"412242918@qq.com"
] | 412242918@qq.com |
b88f1cb64bf12951691c5073475e01d1613ad5a2 | d699d1b1efad07236be780774edef79d966c84aa | /travel-hunter-lib/src/main/java/org/mk/travelhunter/voyagerabais/VoyageRabaisDateParser.java | e55295567927ff247686d64c0c3170c5198505df | [] | no_license | mkirouac/travel-hunter | 291ad88f0192957ab179fbc6c1e9825132a92a4b | d6e8a4dacbf43d0788022aaca95871d4d5ab36cf | refs/heads/master | 2022-09-28T07:33:39.034784 | 2020-02-26T20:37:59 | 2020-02-26T20:37:59 | 233,446,113 | 0 | 0 | null | 2022-09-01T23:18:41 | 2020-01-12T19:26:30 | Java | UTF-8 | Java | false | false | 1,389 | java | package org.mk.travelhunter.voyagerabais;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;
import java.util.Locale;
import org.springframework.stereotype.Component;
@Component
public class VoyageRabaisDateParser {
private static final String[] REAL_MONTHS = { "janv.", "fรฉvr.", "mars", "avr.", "mai", "juin", "juil.", "aoรปt", "sept.", "oct.",
"nov.", "dรฉc." };
private static final String[] GIVEN_MONTHS = { "jan", "fรฉv", "mar", "avr", "mai", "jun", "juil", "aoรป", "sep", "oct", "nov", "dรฉc" };
private final DateTimeFormatter dateTimeFormatter;
public VoyageRabaisDateParser() {
this(new DateTimeFormatterBuilder().parseCaseInsensitive().appendPattern("d MMM uuuu").toFormatter()
.withLocale(Locale.FRENCH));
}
public VoyageRabaisDateParser(DateTimeFormatter formatter) {
this.dateTimeFormatter = formatter;
}
public LocalDate parseDate(String dateText) {
return LocalDate.parse(replaceMonth(dateText), dateTimeFormatter);
}
// TODO Document
private String replaceMonth(String dateText) {
// Thanks to StackOverflow for this workaround. Ugly but works.
String original = dateText;
for (int i = 0; i < GIVEN_MONTHS.length; i++) {
original = original.replaceAll(GIVEN_MONTHS[i], REAL_MONTHS[i]);
}
return original;
}
}
| [
"micaelkirouac@gmail.com"
] | micaelkirouac@gmail.com |
bdc4299d1b3d24d67e92fe07164cc28f24b7b2af | 6bc5caa6f1fec4d44525cd17419a6c16bca43a49 | /springboot-jpa/src/main/java/com/github/springboot/repository/UserRepository.java | 0c78d2a60ae46aa41035329b27f63a90ee3f421b | [] | no_license | baxiang/SpringBoot-Note | 8a038a70f2301333e33a7388780b3babff20972b | fa144b855d608c491c6b9ef48c45a7f3a0e247de | refs/heads/master | 2022-05-26T23:38:43.436367 | 2019-12-20T10:24:32 | 2019-12-20T10:24:32 | 228,788,729 | 0 | 0 | null | 2022-05-20T21:20:16 | 2019-12-18T08:01:35 | Java | UTF-8 | Java | false | false | 291 | java | package com.github.springboot.repository;
import com.github.springboot.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface UserRepository extends JpaRepository<User,Integer> {
public List<User>findByName(String name);
}
| [
"baxiang@roobo.com"
] | baxiang@roobo.com |
7c95f2800630666b66dd8d73edb0c2830cd5def0 | 48453fe8ad9f339daeb4815901e41d0bf88fa931 | /src/main/java/Exercise4/countAllVowels.java | 70ce14cf7cadc1e800954b741365128c51f11414 | [] | no_license | weihongchen1005/Day4 | 951421eafb760ce9f84cc35b17ca99a76b29ccb4 | de8b7ea4e5010274d7fbee3a09d32f08be446402 | refs/heads/main | 2023-06-10T12:39:42.689554 | 2021-07-02T16:59:03 | 2021-07-02T16:59:03 | 382,378,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 573 | java | package Exercise4;
import java.util.Scanner;
public class countAllVowels {
public static int countVowels(String input) {
int count = 0;
for (int i = 0; i < input.length(); i++) {
if (input.charAt(i) == 'a' || input.charAt(i) == 'e' || input.charAt(i) == 'i' || input.charAt(i) == 'o'
|| input.charAt(i) == 'u') {
count++;
}
}
return count;
}
public static void main(String[] args) {
System.out.println("Enter String: ");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
System.out.println(countVowels(input));
}
}
| [
"weihong_chen@hcl.com"
] | weihong_chen@hcl.com |
09b8964d062990efbdbe7e735060ec1fa8656942 | 2075234a974dea7683ed24dd45836d5ac26bb93a | /sabot/kernel/src/main/java/com/dremio/exec/planner/logical/DremioProjectJoinTransposeRule.java | cbcbfb5b2656f01a838e7e2964ad5aee5a204820 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | superbstreak/dremio-oss | 30c131f0e285466575134d3189760c63ca71fbdb | 31bc9b7ce0aa88ac2ab8ebcbc9fb69fb0d2744a8 | refs/heads/master | 2022-05-01T11:21:53.621052 | 2022-02-06T19:01:17 | 2022-02-06T19:01:17 | 97,759,386 | 0 | 0 | null | 2017-07-19T20:42:17 | 2017-07-19T20:42:17 | null | UTF-8 | Java | false | false | 4,579 | java | /*
* Copyright (C) 2017-2019 Dremio Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dremio.exec.planner.logical;
import java.util.ArrayList;
import java.util.List;
import org.apache.calcite.plan.RelOptRule;
import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.plan.RelOptRuleOperand;
import org.apache.calcite.plan.RelOptUtil;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.core.Join;
import org.apache.calcite.rel.core.Project;
import org.apache.calcite.rel.logical.LogicalJoin;
import org.apache.calcite.rel.logical.LogicalProject;
import org.apache.calcite.rel.rules.PushProjector;
import org.apache.calcite.rel.rules.PushProjector.ExprCondition;
import org.apache.calcite.rel.type.RelDataTypeField;
import org.apache.calcite.rex.RexCall;
import org.apache.calcite.rex.RexNode;
import org.apache.calcite.rex.RexShuttle;
import org.apache.calcite.runtime.PredicateImpl;
import org.apache.calcite.sql.SqlKind;
import org.apache.calcite.tools.RelBuilderFactory;
import com.dremio.exec.planner.sql.handlers.RexFieldAccessUtils;
public class DremioProjectJoinTransposeRule extends RelOptRule {
public static final DremioProjectJoinTransposeRule INSTANCE;
private final ExprCondition preserveExprCondition;
private DremioProjectJoinTransposeRule(Class<? extends Project> projectClass, Class<? extends Join> joinClass, ExprCondition preserveExprCondition, RelBuilderFactory relFactory) {
super(operand(projectClass, operand(joinClass, any()), new RelOptRuleOperand[0]), relFactory, (String)null);
this.preserveExprCondition = preserveExprCondition;
}
public void onMatch(final RelOptRuleCall call) {
Project origProj = (Project)call.rel(0);
Join join = (Join)call.rel(1);
Project wrappedProj = RexFieldAccessUtils.wrapProject(origProj, join, true);
if (!join.isSemiJoin()) {
RexNode joinFilter = (RexNode)join.getCondition().accept(new RexShuttle() {
public RexNode visitCall(RexCall rexCall) {
RexNode node = super.visitCall(rexCall);
return (RexNode)(!(node instanceof RexCall) ? node : RelOptUtil.collapseExpandedIsNotDistinctFromExpr((RexCall)node, call.builder().getRexBuilder()));
}
});
PushProjector pushProject = new PushProjector(wrappedProj, joinFilter, join, this.preserveExprCondition, call.builder());
if (!pushProject.locateAllRefs()) {
RelNode leftProjRel = pushProject.createProjectRefsAndExprs(join.getLeft(), true, false);
RelNode rightProjRel = pushProject.createProjectRefsAndExprs(join.getRight(), true, true);
RexNode newJoinFilter = null;
int[] adjustments = pushProject.getAdjustments();
if (joinFilter != null) {
List<RelDataTypeField> projJoinFieldList = new ArrayList();
projJoinFieldList.addAll(join.getSystemFieldList());
projJoinFieldList.addAll(leftProjRel.getRowType().getFieldList());
projJoinFieldList.addAll(rightProjRel.getRowType().getFieldList());
newJoinFilter = pushProject.convertRefsAndExprs(joinFilter, projJoinFieldList, adjustments);
}
Join newJoinRel = join.copy(join.getTraitSet(), newJoinFilter, leftProjRel, rightProjRel, join.getJoinType(), join.isSemiJoinDone());
RelNode topProject = pushProject.createNewProject(newJoinRel, adjustments);
call.transformTo(RexFieldAccessUtils.unwrap(topProject));
}
}
}
static {
INSTANCE = new DremioProjectJoinTransposeRule(
LogicalProject.class,
LogicalJoin.class,
new ProjectJoinExprCondition(),
DremioRelFactories.CALCITE_LOGICAL_BUILDER);
}
private static class ProjectJoinExprCondition extends PredicateImpl<RexNode>
implements PushProjector.ExprCondition {
@Override
public boolean test(RexNode expr) {
if (expr instanceof RexCall) {
RexCall call = (RexCall)expr;
return call.getKind() != SqlKind.DIVIDE || call.getOperands().get(1).getKind() == SqlKind.LITERAL;
}
return true;
}
};
}
| [
"yongyan@dremio.com"
] | yongyan@dremio.com |
5bd4bc1cdcd93a30d6be9b2eccc2af5472a17862 | 9aed83daa4fa967878edc54e64ceb40b68c7f60c | /classic_shop/src/com/classic/order/daoImp/OrderDaoImp.java | 291d8c08b5c986c2a5c65e7971414318060df25d | [] | no_license | kkkkk1544/classic_ | 96323ec6b98913485ed09b50a76ba36633f65e69 | 85490c8b6d1d269d92e9db772ea7499a0cea3ef6 | refs/heads/master | 2021-05-11T09:44:14.477614 | 2018-01-19T04:57:53 | 2018-01-19T04:57:53 | 118,085,288 | 0 | 0 | null | 2018-01-19T06:15:38 | 2018-01-19T06:15:38 | null | UTF-8 | Java | false | false | 2,833 | java | package com.classic.order.daoImp;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import com.classic.order.dao.OrderDAO;
import com.classic.order.dto.PaidDTO;
import com.classic.util.ClassicDBConnection;
public class OrderDaoImp implements OrderDAO{
private Connection conn;
public OrderDaoImp(Connection conn) {
this.conn = conn;
}
@Override
public List<PaidDTO> ListSelect(int mem_num) throws Exception {
List<PaidDTO> orderList = new ArrayList<PaidDTO>();
String sql ="select p.num, p.order_num, p.payment, p.order_state, p.mem_num, " +
"g.num as g_num, g.name as g_name, d.state as deliv_state, d.deliv_num, "+
"g.num as product_num, s.sizu as g_size, c.name as g_color " +
"from paid p, member m, product g, delivery d, sizu s, colour c " +
"where p.product_num=g.num " +
"and p.mem_num=m.num " +
"and p.num=d.paid_num(+) " +
"and p.sizu_num=s.num "+
"and p.colour_num=c.num "+
"and mem_num=?";
PreparedStatement pstmt = null;
ResultSet rs = null;
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, mem_num);
rs=pstmt.executeQuery();
while(rs.next()) {
PaidDTO order = new PaidDTO();
order.setNum(rs.getInt("num"));
order.setOrder_num(rs.getString("order_num"));
order.setPayment(rs.getInt("payment"));
order.setOrder_state(rs.getInt("order_state"));
order.setMem_num(rs.getInt("mem_num"));
order.setG_num(rs.getInt("g_num"));
order.setG_name(rs.getString("g_name"));
order.setDeliv_state(rs.getInt("deliv_state"));
order.setDeliv_num(rs.getString("deliv_num"));
order.setProduct_num(rs.getInt("product_num"));
order.setG_size(rs.getString("g_size"));
order.setG_color(rs.getString("g_color"));
orderList.add(order);
}
/*System.out.println("DaoImp_orderList: "+orderList);*/
return orderList;
}
@Override
public int cancelUpdate(PaidDTO paidDto) throws Exception {
//์ฃผ๋ฌธ์ทจ์
int update=0;
String sql="UPDATE paid SET order_state=-2 " +
"WHERE order_num=?";
PreparedStatement pstmt = conn.prepareStatement(sql);
pstmt.setString(1, paidDto.getOrder_num());
update=pstmt.executeUpdate();
return update;
}
@Override
public int shippingUpdate(String order_num) throws Exception {
int update=0;
return update;
}
//โผ ์ด๊ฑฐ ๋์ค์ ๊ฐ๋ฐ ๋ค ๋๋ฌ์ ๋ ์ง์ฐ์
์ผ ๋ผ์(๋ค๋ฅธ ๊ณณ์ ์๋ syso ํฌํจ!)
/*public static void main(String[] args) {
Connection conn=null;
try {
conn=ClassicDBConnection.getConnection();
OrderDAO dao = new OrderDaoImp(conn);
System.out.println(dao.ListSelect(1));
//System.out.println(dao.DetailSelect(1, 43));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}*/
}
| [
"da5870@nate.com"
] | da5870@nate.com |
c3d64c91fe671344f3cd521951ae48c9fefe3967 | 42c9e35543a88ac921bfc86f895dce2fe229ed1c | /app/src/main/java/com/prateek/isafeassist/model/service.java | 8312a7a5934538e3510d333807803ca3b6956e91 | [] | no_license | ambivan/iSafeAssist-1 | c64f1391b020644f2e75edccf6288b30204d8be6 | 7a8c95dc5ad728d56856094ec947d7b62a498dc1 | refs/heads/master | 2020-06-18T16:37:30.407529 | 2019-07-11T07:02:25 | 2019-07-11T07:02:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | java | package com.prateek.isafeassist.model;
public class service {
String servicename;
String price;
public service(){
}
public service(String servicename, String price) {
this.servicename = servicename;
this.price = price;
}
public String getServicename() {
return servicename;
}
public void setServicename(String servicename) {
this.servicename = servicename;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
}
| [
"aggarwalprateek72@gmail.com"
] | aggarwalprateek72@gmail.com |
544d396cc60a633d3b8a79c43cc8df97bfe22af7 | 77e1403d26732646d81604a3b7efd2213a1fe15d | /P3_2.0/iterativeSolver.java | 2096bbca95e17de08f336a12c7deaa28caf2aa92 | [] | no_license | yuanhe772/Homework-Version-Control | 0c962498628d8eae1ff1eab6ac0995cc5139905c | a78d9b8ce3a9b078d8ca68102bbc47ab444f7e6a | refs/heads/master | 2021-04-29T23:58:25.353756 | 2018-08-06T06:31:06 | 2018-08-06T06:31:06 | 121,567,018 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,531 | java | import java.util.ArrayList;
import java.util.Arrays;
/**
* nonlinearSolver.java, ECE4960-P3
* Created by Yuan He(yh772) on 2018/04/05
* Platform: Java 8, Eclipse, MacOS
* Copyright ยฉ 2018 Yuan He. All rights reserved.
*
* Project 3, task 4 and 5, parameter extraction with least-square fitting:
* The parameter extraction could be implemented with either Quasi-Newton
* nonlinear matrix solver, or Secant nonlinear matrix solver, which are
* implemented below, with QN being 1 and SC being 2.
*/
public class iterativeSolver {
/* Class Variants: The file inputs, and DEFINE values*/
// Define QN = 1, SC = 2, NORMALIZED Y = 1, UNNORMALIZED Y = 0
static final int QN = 1;
static final int SC = 2;
static final int NORM = 1;
static final int UNNORM = 0;
// The measured data from outputNMOS.txt, and the constant VT
static final ArrayList<ArrayList<Double>> measure = fileIO.readMeasure("outputNMOS.txt");
static final int dataSize = measure.get(0).size();
static final double VT = 0.026;
/* Class methods: Implement the iterative solver for parameter extraction*/
/**Function: the Loss Function(the objective function), V = sum (YModel - YMeasure)^2
* Where the Y_model is the predicted Ids (calculated from the given parameters and measured Vgs, Vds)
* Y_measure is the measured Ids
* Parameters: Vector para = [Is, kapa, Vth]
* Return: double */
public static double V(Vector para) {
// The structures for calculating the loss function
double YModel = 0;
double YMeas = 0;
double V = 0;
// Iteratively calculate V = sum (YModel - YMeasure)^2
for(int i=0; i<dataSize; i++) {
YModel = yEKVModel(para, measure.get(0).get(i), measure.get(1).get(i));
YMeas = measure.get(2).get(i);
V += Math.pow(YModel - YMeas,2);
}
return V;
}
/**Function: the normalized Loss Function(the objective function), V = sum (YModel - YMeasure)^2
* Where the Y_model is the predicted Ids (calculated from the given parameters and measured Vgs, Vds)
* Y_measure is the measured Ids
* Parameters: Vector para = [Is, kapa, Vth]
* Return: double */
public static double normalV(Vector para) {
// The structures for calculating the loss function
double YModel = 0;
double YMeas = 0;
double normalV = 0;
// Iteratively calculate V = sum (YModel - YMeasure)^2
for(int i=0; i<dataSize; i++) {
YModel = yEKVModel(para, measure.get(0).get(i), measure.get(1).get(i));
YMeas = measure.get(2).get(i);
normalV += Math.pow((YModel - YMeas)/YMeas,2);
}
return normalV;
}
/**Function: calculate a single Y_model, with given parameters, and a pair of measured Vgs and Vds
* Parameters: Vector para = [Is, kapa, Vth], double Vgs, double Vds
* Return: double res, ekvModel's output*/
public static double yEKVModel(Vector para, double Vgs, double Vds) {
double expo1 = Math.exp((para.v[1]*(Vgs - para.v[2])) / (2*VT));
double expo2 = Math.exp((para.v[1]*(Vgs - para.v[2]) - Vds) / (2*VT));
return para.v[0] * (Math.log(1+expo1) * Math.log(1+expo1) - Math.log(1+expo2) * Math.log(1+expo2));
}
/**Function: the core function of this script, an iterative solver with line search to solve a
* nonlinear matrix (in this case, to extract parameters)
* Parameters: int type of QN or SC, Vector paraGuess[]
* Return: None
* @throws Exception */
public static void iterSolver(int estType, int norm, Vector paraGuess, double tolerance) throws Exception {
// Create delta V vector, Hessian V matrix, and the inversed Hessian V matrix
Vector delV = new Vector(paraGuess.len);
FullMatrix hessV = new FullMatrix(paraGuess.len);
FullMatrix hessInverse = new FullMatrix(paraGuess.len);
// Create structures for initial guessed parameter, delta parameter, previous parameter, previous loss function's value, and iteration count
Vector currPara = paraGuess;
Vector prevPara = paraGuess;
Vector deltaPara = paraGuess;
double prevV = V(paraGuess);
int count = 0;
// Create the scalar, and the two norms for line search's comparison
double t = 1;
double norm1 = 0;
double norm2 = 0;
// Iterative solver, two tolerances: 1. the loss function's value; 2. || deltaPara / para ||
while(V(currPara) > Math.pow(10, -7) && increMag(deltaPara, currPara) > tolerance) {
count += 1;
// Assign delV and hessV according to different gradient estimation type
if(estType == QN) {
delV = gradientEsti.delQN(currPara);
hessV = gradientEsti.hessianQN(currPara);
}
else if(estType == SC) {
delV = gradientEsti.delSC(currPara);
hessV = gradientEsti.hessianSC(currPara);
}
else throw new Exception("\nWrong gradient estimation type!!! Please input: QN or SC.");
// Calculate the Hessian matrix's inverse, and the delta parameter
hessInverse = hessV.inverseRank3();
deltaPara = (hessInverse.product(delV)).scale(-1);
// Line search to determine the scalar t
t = 1;
norm1 = V(currPara.add(deltaPara, t));
norm2 = V(currPara.add(deltaPara, t/2));
while(norm1 > norm2) {
norm1 = norm2;
t/=2;
norm2 = V(currPara.add(deltaPara, t/2));
}
// Update parameters by para = para + t*deltaPara, and update sensitivity Vector
currPara = currPara.add(deltaPara, t);
// Quadratic convergence's:
System.out.println(count + "th iteration:\n [Is, Kapa, Vth] = " + Arrays.toString(currPara.v) +
", || relative delta || = "+increMag(deltaPara, prevPara) +
"\n sensitivity of [Is, Kapa, Vth] = " + Arrays.toString(paraSensi(deltaPara, currPara).v) +
"\n || V || = " + V(currPara) +
"; Quadratic convergence's (V(k) - V(0)) / V(k-1)^2 = "+ ((V(currPara) - V(paraGuess))/(prevV*prevV))+"\n");
// update the previous V and parameters
prevV = V(currPara);
prevPara = currPara;
}
}
/* Calculation of increment vector magnitude, and parameter sensitivity*/
/**Function: Increment Vector magnitude || delta || = sum (delta para / para)^2
* Parameters: Vector deltaPara = [delta Is, delta kapa, delta Vth], Vector oldPara = [Is, kapa, vth]
* Return: double magnitude*/
public static double increMag(Vector deltaPara, Vector oldPara) {
double mag=0;
for(int i=0; i<oldPara.len; i++) {
mag += Math.pow((deltaPara.v[i]/oldPara.v[i]),2);
}
return mag;
}
/**Function: Parameter sensitivity paraSensi = ((perturbedV - originalV)/originalV) / (deltaPara/para),
* with the numerator being the difference of V, and the denominator being the difference of parameter,
* reflecting how much perturbation is caused to the loss function's value V with one little change of each
* parameter
* Parameters: Vector deltaPara = [delta Is, delta kapa, delta Vth], Vector para = [Is, kapa, vth]
* Return: Vector paraSensitivity = [Is sensitivity, kapa sensitivity, Vth sensitivity]*/
public static Vector paraSensi(Vector deltaPara, Vector para) {
// Structure for storing sensitivity vector
double sens[] = new double[para.len];
// Calculating the sensitivity,
Vector perturbed = new Vector(para.len);
double numerator = 0;
double denominator = 0;
for(int i=0; i<para.len; i++) {
// The parameter vector that being perturbed once with the deltaPara
perturbed.v = para.v.clone();
perturbed.v[i] += deltaPara.v[i];
// The calculation of sensitivity
numerator = iterativeSolver.V(perturbed) - iterativeSolver.V(para) / iterativeSolver.V(para);
denominator = deltaPara.v[i] / para.v[i];
sens[i] = numerator / denominator;
}
return new Vector(sens);
}
}
| [
"noreply@github.com"
] | yuanhe772.noreply@github.com |
5922fd25dbf122fca5d623bee12f348c6a72d4ec | 6d13a1ab358cf76dbd3fa2d9116c37f7887b1366 | /src/main/java/teamfour/tasc/model/task/exceptions/TaskAlreadyCompletedException.java | 9fec97c4741a3ade88359415c6e3542fcd2a8f9d | [
"MIT"
] | permissive | CS2103AUG2016-W11-C4/main | 1591debd0e803343449618d82716755c731021db | 413614ddcc82520ecfad0ada1eaec24ab45271cc | refs/heads/master | 2021-01-17T08:58:21.957922 | 2016-11-06T06:08:15 | 2016-11-06T06:08:15 | 69,664,411 | 2 | 3 | null | 2016-11-06T05:59:51 | 2016-09-30T12:20:06 | Java | UTF-8 | Java | false | false | 259 | java | //@@author A0140011L
package teamfour.tasc.model.task.exceptions;
/**
* Represents an error whereby we try to mark a completed task
* as complete again (which is an unnecessary action).
*/
public class TaskAlreadyCompletedException extends Exception {
}
| [
"tanwangleng@outlook.com"
] | tanwangleng@outlook.com |
54ea2e297eed154ffcd3680ba5df4dc017760797 | f933d6ca8f67421eac08c28ecfcf6828012163c3 | /Collect_WebBase/src/main/java/_a14_springMVC/_1_ๅบๆฌMVC้
็ฝฎ/po/Commodity.java | bdd4e3584a1c53e1ea5846681c408d1842e40338 | [] | no_license | qq178327552/ecplipse-web | 68615da7f13a775a264d4d6cff6a4767005ef125 | d82ea33b6b4fe4622b3d640189a412fc85b3ec97 | refs/heads/master | 2022-12-22T21:53:31.155887 | 2019-10-09T03:00:04 | 2019-10-09T03:00:04 | 213,807,431 | 0 | 0 | null | 2022-12-16T04:46:27 | 2019-10-09T02:59:10 | Java | UTF-8 | Java | false | false | 498 | java | package _a14_springMVC._1_ๅบๆฌMVC้
็ฝฎ.po;
public class Commodity {
private String name;
private String price;
private String detail;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
public String getDetail() {
return detail;
}
public void setDetail(String detail) {
this.detail = detail;
}
}
| [
"178327552@qq.com"
] | 178327552@qq.com |
36ce20267fda93846925beb23e41640c9aacc449 | bcbd853f93d6f22f6323504b8f8d5a3fabf8950e | /consumer-src/src/main/java/com/gsshop/kafka/consumer/repository/entity/PrdDescdHtmlD.java | a8c5746f6d6b6c73161ea8dc38407d4ffda2367f | [] | no_license | jkimpro/rooting-kafka | 43a813351ce75058f64ba5eadcbe8b7974fb6639 | 746b395d1107604be60b9fb593e1bea5a19487d9 | refs/heads/master | 2022-10-16T19:07:43.180830 | 2020-06-14T08:54:34 | 2020-06-14T08:54:34 | 264,624,060 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,069 | java | package com.gsshop.kafka.consumer.repository.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import com.gsshop.kafka.consumer.repository.prkey.PrdDescdHtmlDPK;
import lombok.Data;
import lombok.ToString;
@Data
@Entity
@ToString
@IdClass(PrdDescdHtmlDPK.class)
@Table(name = "PRD_DESCD_HTML_D")
public class PrdDescdHtmlD implements Serializable{
@Column(name = "PRD_CD") //PK
@NotNull
@Id
private BigDecimal prdCd; // (PRD_CD)
@Column(name = "CHANL_CD", length = 2) //PK
@NotNull
@Id
private String chanlCd; // ์ฑ๋์ฝ๋(CHANL_CD)
@Column(name = "REG_GBN_CD", length = 1) //PK
@NotNull
@Id
private String regGbnCd; // ๋ฑ๋ก๊ตฌ๋ถ์ฝ๋(REG_GBN_CD)
@Column(name = "REG_DTM", updatable = false)
@NotNull
private Date regDtm; // ๋ฑ๋ก์ผ์(REG_DTM)
@Column(name = "REGR_ID", length = 10, updatable = false)
@NotNull
private String regrId; // ๋ฑ๋ก์ID(REGR_ID)
@Column(name = "MOD_DTM")
@NotNull
private Date modDtm; // ์์ ์ผ์(MOD_DTM)
@Column(name = "MODR_ID", length = 10)
@NotNull
private String modrId; // ์์ ์ID(MODR_ID)
@Column(name = "DESCD_EXPLN_CNTNT",length = 4000)
private String descdExplnCntnt; // ๊ธฐ์ ์์ค๋ช
๋ด์ฉ(DESCD_EXPLN_CNTNT)
@Column(name = "RCMD_SNTNC_CNTNT", length = 4000)
private String rcmdSntncCntnt; // ์ถ์ฒ๋ฌธ๊ตฌ๋ด์ฉ(RCMD_SNTNC_CNTNT)
@Column(name = "WRITE_PREVNT_YN", length = 1)
@NotNull
private String writePrevntYn; // ์ฐ๊ธฐ๋ฐฉ์ง์ฌ๋ถ(WRITE_PREVNT_YN)
// @Column(name = "WRITE_PREVNT_CNF_DT")
private Date writePrevntCnfDt; // ์ฐ๊ธฐ๋ฐฉ์งํ์ธ์ผ์(WRITE_PREVNT_CNF_DT)
@Column(name = "EC_EXPOS_YN", length = 1)
@NotNull
private String ecExposYn; // EC๋
ธ์ถ์ฌ๋ถ(EC_EXPOS_YN)
@Column(name = "IMG_EXPLN_CNTNT", length = 1333)
private String imgExplnCntnt; // ์ด๋ฏธ์ง์ค๋ช
๋ด์ฉ(IMG_EXPLN_CNTNT)
}
| [
"jkimpro10@gmail.com"
] | jkimpro10@gmail.com |
273f39b2151aac88a775913534d2708de8de55ba | 795c4636e97fbbd46b9ecb0f290e3d004b8a3cda | /src/main/java/com/occamsrazor/web/controllers/PlayerController.java | 190cc282491fa22bc6eb4ced7072336d22f95a6f | [] | no_license | wj1089/woojun-web | 1577fc05bafa88de19bedad30ebc41afd71ea617 | 1f62665203f45f6676321ae5d92a79ea2a43522d | refs/heads/master | 2022-07-23T00:05:14.985710 | 2020-05-15T09:13:47 | 2020-05-15T09:13:47 | 263,775,521 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 642 | java | package com.occamsrazor.web.controllers;
import com.occamsrazor.web.domains.PlayerDto;
import com.occamsrazor.web.services.PlayerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/players")
public class PlayerController {
@Autowired PlayerService playerService;
@GetMapping("")
public List<PlayerDto> getList(){
return playerService.retrieveAll();
}
}
| [
"wj1089@naver.com"
] | wj1089@naver.com |
6d60cdd1765dfb21940441a4674cc94fa36a384f | 8cde2269c37cf0f383f841fe8fde4ea4760eedea | /src/Week1/Homework/Task23.java | d80fa0251c8701dbab83684fb525186882320021 | [] | no_license | Vikkistav/HomeworkWeek1 | de24bcc18db6651b0f6ccca6976b4d587a7f72dd | fd7e9bb52c0a17e81eff61786096dc4f07811c5f | refs/heads/master | 2020-04-02T17:03:16.456061 | 2018-10-25T10:08:11 | 2018-10-25T10:08:11 | 153,439,871 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package Week1.Homework;
//ะะทะฒะตััะฝั ะฟะปะพัะฐะดะธ ะบััะณะฐ ะธ ะบะฒะฐะดัะฐัะฐ. ะพะฟัะตะดะตะปะธัั:
//ะฐ) ะฟะพะผะตััะธััั ะบััะณะฐ ะฒ ะบะฒะฐะดัะฐั
//ะฑ) ะฟะพะผะตััะธััั ะบะฒะดัะฐั ะฒ ะบััะณะฐ
import java.util.Scanner;
public class Task23 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("ะะฒะตะดััั ะฟะปะพัั ะบะฒะฐะดัะฐัะฐ");
int square = sc.nextInt();
System.out.println("ะะฒะตะดััั ะฟะปะพัั ะบััะณะฐ");
int circle = sc.nextInt();
if (square < circle){
System.out.println("ะะฒะฐะดัะฐั ะฟะพะผัััะธัััั ะฒ ะบััะณ");
} else if (circle < square){
System.out.println("ะััะณ ะฟะพะผัััะธัััั ะฒ ะบะฒะฐะดัะฐั");
}
}
}
| [
"stavickaya2002@gmail.com"
] | stavickaya2002@gmail.com |
1786ca69b9970d928bfab84c4f79df28e50af073 | 858aa1c302a84aa916a4b2f9511662d746c04947 | /conexiona_cuatro/src/main/java/com/practicas/conexiona/exception/ResourceNotFoundException.java | 27dfd65704a71092e89d2c4654ac6024652d1eea | [] | no_license | crmiguez/conexiona_springboot_angular_project | d056fb725ee0d77a01891c27039f86c95a3352b7 | 757a56bec8aae42feb8f114738838c83438a482f | refs/heads/master | 2023-01-31T14:34:48.901132 | 2020-12-10T12:38:32 | 2020-12-10T12:38:32 | 320,262,404 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 397 | java | package com.practicas.conexiona.exception;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ResponseStatus;
@ResponseStatus(value = HttpStatus.NOT_FOUND)
public class ResourceNotFoundException extends Exception {
private static final long serialVersionUID = 1L;
public ResourceNotFoundException(String message){
super(message);
}
} | [
"crmiguez@esei.uvigo.es"
] | crmiguez@esei.uvigo.es |
c1a1c1ecd88d2500c70faa8f2db50d02362b75bf | 161a17337513004b6997523193e7b29e0c3667fe | /src/de/tub/citydb/config/ConfigUtil.java | acfd5c9e166588d8bd05200b550614e422959e92 | [] | no_license | shahinsharifi/CityGMLConverter | 58f9b1ba0d4fe6c3069de73d65b854b120ea77b4 | 2012c776ad0275e465bf5ad6ddf52bad1484749a | refs/heads/master | 2021-01-25T10:34:28.198410 | 2015-03-24T16:47:28 | 2015-03-24T16:47:28 | 19,509,944 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 4,386 | java | /*
* This file is part of the 3D City Database Importer/Exporter.
* Copyright (c) 2007 - 2013
* Institute for Geodesy and Geoinformation Science
* Technische Universitaet Berlin, Germany
* http://www.gis.tu-berlin.de/
*
* The 3D City Database Importer/Exporter program is free software:
* you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*
* The development of the 3D City Database Importer/Exporter has
* been financially supported by the following cooperation partners:
*
* Business Location Center, Berlin <http://www.businesslocationcenter.de/>
* virtualcitySYSTEMS GmbH, Berlin <http://www.virtualcitysystems.de/>
* Berlin Senate of Business, Technology and Women <http://www.berlin.de/sen/wtf/>
*/
package de.tub.citydb.config;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.UnmarshallerHandler;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.XMLFilterImpl;
import de.tub.citydb.config.project.ProjectSchemaWriter;
public class ConfigUtil {
public static String createConfigPath(String configPath) {
File createPath = new File(configPath);
boolean success = true;
if (!createPath.exists())
success = createPath.mkdirs();
return success ? createPath.getAbsolutePath() : null;
}
public static void marshal(Object object, File file, JAXBContext ctx) throws JAXBException {
Marshaller m = ctx.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,Boolean.TRUE);
m.setProperty("com.sun.xml.bind.indentString", " ");
m.marshal(object, file);
}
public static Object unmarshal(File file, JAXBContext ctx) throws JAXBException, IOException {
Unmarshaller um = ctx.createUnmarshaller();
UnmarshallerHandler handler = um.getUnmarshallerHandler();
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware(true);
XMLReader reader = null;
try {
reader = factory.newSAXParser().getXMLReader();
// the namespace mapper ensures that we can also
// read project files not declaring proper namespaces
Mapper mapper = new Mapper(reader);
mapper.setContentHandler(handler);
mapper.parse(new InputSource(new FileInputStream(file)));
} catch (SAXException e) {
throw new JAXBException(e.getMessage());
} catch (ParserConfigurationException e) {
throw new IOException(e.getMessage());
}
return handler.getResult();
}
public static void generateSchema(JAXBContext ctx, File file) throws IOException {
ctx.generateSchema(new ProjectSchemaWriter(file));
}
private static class Mapper extends XMLFilterImpl {
Mapper(XMLReader reader) {
super(reader);
}
@Override
public void startPrefixMapping(String prefix, String uri) throws SAXException {
if (uri == null || uri.length() == 0)
uri = "http://www.gis.tu-berlin.de/3dcitydb-impexp/config";
super.startPrefixMapping(prefix, uri);
}
@Override
public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
if (uri == null || uri.length() == 0)
uri = "http://www.gis.tu-berlin.de/3dcitydb-impexp/config";
super.startElement(uri, localName, qName, atts);
}
@Override
public void endElement(String uri, String localName, String qName) throws SAXException {
if (uri == null || uri.length() == 0)
uri = "http://www.gis.tu-berlin.de/3dcitydb-impexp/config";
super.endElement(uri, localName, qName);
}
}
}
| [
"shahin.sharifi@hotmail.com"
] | shahin.sharifi@hotmail.com |
1ca7ac223ebe60fe2502cc4f64211345957c3432 | 8346253b9702790421fa1b247520f94ad278310a | /src/eight/demo09/Consumer.java | dcc01a3cc92ee00cd25dbd932575aeaa7f6bc476 | [] | no_license | 1793523411/java-review | 62f55da1d57c40dfdf8b4951b2e9d0efcbebdff0 | c8bb9c03ad1fbf5221bc9cbf1bcfb0eaf914cdb2 | refs/heads/master | 2022-10-31T21:35:19.821311 | 2020-06-21T04:27:24 | 2020-06-21T04:27:24 | 273,833,583 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 726 | java | package eight.demo09;
public class Consumer extends Thread {
Tickets t = null;
int i = 0;
public Consumer(Tickets t) {
this.t = t;
}
public void run() {
// while(i<t.size) {
// synchronized(t) { //็ณ่ฏทๅฏน่ฑกt็้ๆๆ
// if(t.available==true && i<=t.number)
// System.out.println("Consumer buys ticket "+(++i)); if(i==t.number) {
// try{Thread.sleep(1);}catch(Exception e){}
// t.available=false;
// }
// } //้ๆพๅฏน่ฑกt็้ๆๆ
// }
while (i < t.size) {
t.sell();
}
System.out.println("Consumer ends");
}
}
| [
"1793523411@qq.com"
] | 1793523411@qq.com |
2d10db0d9caa51afdf91cdcfc30c53c8ffbaba60 | 91cde8a3db0df5001a27c204ae848a7c987c2f73 | /src/main/java/com/bhavya/App.java | 562725c6d859e23c741345adcf47aab9659d7069 | [] | no_license | bhavyasachdeva63/test-new1 | 8ad8a655e9aab5ae703200b211485d91bc138bff | 90472ea64f4aba540341636da22740a2f09885b0 | refs/heads/master | 2020-03-18T13:55:04.140469 | 2018-05-25T06:24:39 | 2018-05-25T06:24:39 | 134,817,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 425 | java | package com.bhavya;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class App
{
public static void main( String[] args )
{
ApplicationContext context = new ClassPathXmlApplicationContext("Module.xml");
HelloWorld obj = (HelloWorld) context.getBean("helloBean");
obj.printHello();
}
}
| [
"bsachdeva@expedia.com"
] | bsachdeva@expedia.com |
35a747672a277c8373ce6e7842da5540b9b126cf | 5b57c7277320f45b9ca684c2d572cd99234b221f | /src/main/java/com/baulsupp/oksocial/services/google/DiscoveryRegistry.java | f83b3615010121d174f96693516ea50f6f176cb8 | [
"Apache-2.0"
] | permissive | fcjjcf/oksocial | 676948724c4331e8d38f5fa4b69557417b3b03fe | 254cc75eefd2b0d54b59a5519d2cfb670e112300 | refs/heads/master | 2021-01-21T14:53:09.344220 | 2017-06-25T09:10:55 | 2017-06-25T09:10:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,129 | java | package com.baulsupp.oksocial.services.google;
import com.baulsupp.oksocial.authenticator.AuthUtil;
import com.baulsupp.oksocial.output.util.JsonUtil;
import java.io.File;
import java.io.IOException;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
import okhttp3.Cache;
import okhttp3.CacheControl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import static com.jakewharton.byteunits.BinaryByteUnit.MEBIBYTES;
public class DiscoveryRegistry {
private static final Cache cache =
new Cache(new File(System.getProperty("user.home"), ".oksocial/google-cache"),
MEBIBYTES.toBytes(20));
private static final CacheControl cacheControl =
new CacheControl.Builder().maxStale(1, TimeUnit.DAYS).build();
private final OkHttpClient client;
private final Map<String, Object> map;
public DiscoveryRegistry(OkHttpClient client, Map<String, Object> map) {
this.client = client;
this.map = map;
}
// TODO make non synchronous
public static synchronized DiscoveryRegistry instance(OkHttpClient client) throws IOException {
client = client.newBuilder().cache(cache).build();
String url = "https://www.googleapis.com/discovery/v1/apis";
Request request = new Request.Builder().cacheControl(cacheControl).url(url).build();
Response response = client.newCall(request).execute();
try {
return new DiscoveryRegistry(client, JsonUtil.map(response.body().string()));
} finally {
if (response != null) {
response.close();
}
}
}
private Map<String, Map<String, Object>> getItems() {
//noinspection unchecked
return (Map<String, Map<String, Object>>) map.get("items");
}
public CompletableFuture<DiscoveryDocument> load(String discoveryDocPath) {
Request request =
new Request.Builder().url(discoveryDocPath).cacheControl(cacheControl).build();
CompletableFuture<Map<String, Object>> mapFuture =
AuthUtil.enqueueJsonMapRequest(client, request);
return mapFuture.thenApply(s -> new DiscoveryDocument(s));
}
}
| [
"noreply@github.com"
] | fcjjcf.noreply@github.com |
6de9416b8acfa8c0ca39cb8085695449e0a5bfba | 7373a2c189edfb56ad5c88abc02a3bbe274b8dc4 | /SSAFY Almond/SWEA/Solution_D4_7733_์น์ฆ๋๋_์ด๋ณํ.java | 8e68d970a6cd377231cdc20f8e4cb790df5e305e | [] | no_license | kingjky/StudyDiary | 7b8fdd6c70cdcd4b2049965c5cb3b47c756b42be | 81f2c509ef6beeb5ef655b52bd36bc68bc16d5f4 | refs/heads/master | 2022-12-13T16:28:40.458297 | 2020-12-21T05:23:28 | 2020-12-21T05:23:28 | 244,577,592 | 2 | 0 | null | 2022-12-08T03:55:39 | 2020-03-03T08:09:47 | Java | UTF-8 | Java | false | false | 2,087 | java | package algorithm;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class Solution_D4_7733_์น์ฆ๋๋_์ด๋ณํ {
static int T, N, round, day, max;
static int[][] arr;
static StringTokenizer st;
static int[][] dir = { { 1, 0 }, { -1, 0 }, { 0, 1 }, { 0, -1 } };
static Queue<Node> q = new LinkedList<Node>();
static boolean[][] visited;
public static class Node {
int x, y;
public Node(int x, int y) {
this.x = x;
this.y = y;
}
}
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
T = Integer.parseInt(br.readLine());
for (int t = 1; t <= T; ++t) {
N = Integer.parseInt(br.readLine());
arr = new int[N][N];
for (int i = 0; i < N; i++) {
st = new StringTokenizer(br.readLine());
for (int j = 0; j < N; j++) {
arr[i][j] = Integer.parseInt(st.nextToken());
}
}
max = 1;
for (day = 1; day <= 100; day++) {
visited = new boolean[N][N];
round = 0;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (arr[i][j] <= day) {
visited[i][j] = true;
continue;
}
if (arr[i][j]>day&&!visited[i][j]) {
q.add(new Node(i, j));
visited[i][j] = true;
bfs();
}
}
}
if (round >= max) {
max = round;
}
}
System.out.println("#"+t+" "+max);
}
// for (int i = 0; i < N; i++) {
// for (int j = 0; j < N; j++) {
// System.out.print(arr[i][j] + " ");
// }
// System.out.println();
// }
}
public static void bfs() {
while (!q.isEmpty()) {
Node n = q.poll();
int dx, dy;
for (int i = 0, len = dir.length; i < len; ++i) {
dx = n.x + dir[i][0];
dy = n.y + dir[i][1];
if (dx >= 0 && dx < N && dy >= 0 && dy < N &&
arr[dx][dy]>day&&!visited[dx][dy]) {
q.add(new Node(dx, dy));
visited[dx][dy] = true;
}
}
}
round++;
}
}
| [
"kingjky@gmail.com"
] | kingjky@gmail.com |
55f03cdd43169abd3eaa88175ce7ef4d21780f2f | c6b7e5f87960ba224e0154b43fe2191bead28f68 | /SOLID-live/src/solid/live_refactored/isp/Door.java | 1a92418989b98ef06493a5a5b3f4569b632ade50 | [] | no_license | ks1988/TrainingProjects | 6a50510be692d3373a74a6aadfac58b04144d892 | 20b9e3830ba4f1494f1615dddfa895fb553ecc21 | refs/heads/master | 2021-01-19T01:03:04.442436 | 2016-07-25T07:51:01 | 2016-07-25T07:51:01 | 64,113,947 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 296 | java | package solid.live_refactored.isp;
/**
* Created by IntelliJ IDEA.
* User: goyalamit
* Date: Jul 11, 2011
* Time: 10:26:10 AM
* To change this template use File | Settings | File Templates.
*/
public interface Door{
void lock();
void unlock();
void open();
void close();
}
| [
"kushagra.s@bdvmackushagras.local"
] | kushagra.s@bdvmackushagras.local |
54ea91669e1b1c03384ed50008c9672b4c117e1b | e72e916cd46b82362bdef7ca158fdf2fea83b9b9 | /car/app/app/src/main/java/androidx/car/app/model/PaneTemplate.java | c2e8a4bad3e8f3c08a016068fc4c5feddd700f90 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | Mu-L/androidx | 753c553ea8f2535f0552d54042c0188b9dd07581 | f42c5f033a9e71bbaf580392cebaa6b274f2aca0 | refs/heads/androidx-master-dev | 2023-01-24T12:32:04.462078 | 2020-12-09T01:52:38 | 2020-12-09T01:52:38 | 284,848,408 | 0 | 0 | Apache-2.0 | 2020-12-09T01:59:54 | 2020-08-04T01:40:25 | Java | UTF-8 | Java | false | false | 8,179 | java | /*
* Copyright 2020 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.car.app.model;
import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import static androidx.car.app.model.constraints.ActionsConstraints.ACTIONS_CONSTRAINTS_HEADER;
import static androidx.car.app.model.constraints.ActionsConstraints.ACTIONS_CONSTRAINTS_SIMPLE;
import static androidx.car.app.model.constraints.RowListConstraints.ROW_LIST_CONSTRAINTS_PANE;
import static java.util.Objects.requireNonNull;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import java.util.Collections;
import java.util.Objects;
/**
* A template that displays a {@link Pane}.
*
* <h4>Template Restrictions</h4>
*
* In regards to template refreshes, as described in
* {@link androidx.car.app.Screen#onGetTemplate()}, this template is considered a refresh of a
* previous one if:
*
* <ul>
* <li>The template title has not changed, and
* <li>The previous template is in a loading state (see {@link Pane.Builder#setLoading}, or the
* number of rows and the string contents (title, texts, not counting spans) of each row
* between the previous and new {@link Pane}s have not changed.
* </ul>
*/
public final class PaneTemplate implements Template {
@Keep
@Nullable
private final CarText mTitle;
@Keep
@Nullable
private final Pane mPane;
@Keep
@Nullable
private final Action mHeaderAction;
@Keep
@Nullable
private final ActionStrip mActionStrip;
/**
* Constructs a new builder of {@link PaneTemplate}.
*
* @throws NullPointerException if {@code pane} is {@code null}
*/
@NonNull
public static Builder builder(@NonNull Pane pane) {
return new Builder(requireNonNull(pane));
}
@Nullable
public CarText getTitle() {
return mTitle;
}
@Nullable
public Action getHeaderAction() {
return mHeaderAction;
}
@NonNull
public Pane getPane() {
return requireNonNull(mPane);
}
@Nullable
public ActionStrip getActionStrip() {
return mActionStrip;
}
@NonNull
@Override
public String toString() {
return "PaneTemplate";
}
@Override
public int hashCode() {
return Objects.hash(mTitle, mPane, mHeaderAction, mActionStrip);
}
@Override
public boolean equals(@Nullable Object other) {
if (this == other) {
return true;
}
if (!(other instanceof PaneTemplate)) {
return false;
}
PaneTemplate otherTemplate = (PaneTemplate) other;
return Objects.equals(mTitle, otherTemplate.mTitle)
&& Objects.equals(mPane, otherTemplate.mPane)
&& Objects.equals(mHeaderAction, otherTemplate.mHeaderAction)
&& Objects.equals(mActionStrip, otherTemplate.mActionStrip);
}
private PaneTemplate(Builder builder) {
mTitle = builder.mTitle;
mPane = builder.mPane;
mHeaderAction = builder.mHeaderAction;
mActionStrip = builder.mActionStrip;
}
/** Constructs an empty instance, used by serialization code. */
private PaneTemplate() {
mTitle = null;
mPane = null;
mHeaderAction = null;
mActionStrip = null;
}
/** A builder of {@link PaneTemplate}. */
public static final class Builder {
@Nullable
private CarText mTitle;
private Pane mPane;
@Nullable
private Action mHeaderAction;
@Nullable
private ActionStrip mActionStrip;
private Builder(Pane pane) {
this.mPane = pane;
}
/**
* Sets the {@link CharSequence} to show as the template's title, or {@code null} to not
* show a
* title.
*/
@NonNull
public Builder setTitle(@Nullable CharSequence title) {
this.mTitle = title == null ? null : CarText.create(title);
return this;
}
/**
* Sets the {@link Action} that will be displayed in the header of the template, or
* {@code null}
* to not display an action.
*
* <h4>Requirements</h4>
*
* This template only supports either either one of {@link Action#APP_ICON} and {@link
* Action#BACK} as a header {@link Action}.
*
* @throws IllegalArgumentException if {@code headerAction} does not meet the template's
* requirements.
*/
@NonNull
public Builder setHeaderAction(@Nullable Action headerAction) {
ACTIONS_CONSTRAINTS_HEADER.validateOrThrow(
headerAction == null ? Collections.emptyList()
: Collections.singletonList(headerAction));
this.mHeaderAction = headerAction;
return this;
}
/**
* Sets the {@link Pane} to display in the template.
*
* @throws NullPointerException if {@code pane} is {@code null}.
*/
@NonNull
public Builder setPane(@NonNull Pane pane) {
this.mPane = requireNonNull(pane);
return this;
}
/**
* Sets the {@link ActionStrip} for this template.
*
* <h4>Requirements</h4>
*
* This template allows up to 2 {@link Action}s in its {@link ActionStrip}. Of the 2 allowed
* {@link Action}s, one of them can contain a title as set via
* {@link Action.Builder#setTitle}.
* Otherwise, only {@link Action}s with icons are allowed.
*
* @throws IllegalArgumentException if {@code actionStrip} does not meet the requirements.
*/
@NonNull
public Builder setActionStrip(@Nullable ActionStrip actionStrip) {
ACTIONS_CONSTRAINTS_SIMPLE.validateOrThrow(
actionStrip == null ? Collections.emptyList() : actionStrip.getActions());
this.mActionStrip = actionStrip;
return this;
}
/**
* Constructs the template defined by this builder.
*
* <h4>Requirements</h4>
*
* This template allows up to 2 {@link Row}s and 2 {@link Action}s in the {@link Pane}.
* The host
* will ignore any rows over that limit. Each {@link Row}s can add up to 2 lines of texts
* via
* {@link Row.Builder#addText} and cannot contain either a {@link Toggle} or a {@link
* OnClickListener}.
*
* <p>Either a header {@link Action} or title must be set on the template.
*
* @throws IllegalArgumentException if the {@link Pane} does not meet the requirements.
* @throws IllegalStateException if the template does not have either a title or header
* {@link
* Action} set.
*/
@NonNull
public PaneTemplate build() {
ROW_LIST_CONSTRAINTS_PANE.validateOrThrow(mPane);
if (CarText.isNullOrEmpty(mTitle) && mHeaderAction == null) {
throw new IllegalStateException("Either the title or header action must be set");
}
return new PaneTemplate(this);
}
/** @hide */
@RestrictTo(LIBRARY)
@NonNull
public PaneTemplate buildForTesting() {
return new PaneTemplate(this);
}
}
}
| [
"shiufai@google.com"
] | shiufai@google.com |
1091a7e684cbdbe4501249c44fcc4322237a2164 | aa57765c84e5713cdead663bf54fa3680159f12a | /src/main/java/beelivery/restaurant/dto/RestaurantRequest.java | 681ba7f4a80ecfecdcb13b981c37692309b73fec | [] | no_license | p-anja/beelivery | 6a53fb792207a58833abb0886079db5c76e02a9c | 70d6b06e27a1db82555a83070efb3844673d9300 | refs/heads/main | 2023-06-23T04:19:52.184385 | 2021-07-10T14:17:14 | 2021-07-10T14:17:14 | 379,579,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,117 | java | package beelivery.restaurant.dto;
import beelivery.misc.Address;
import beelivery.restaurant.model.ERestType;
public class RestaurantRequest {
private String name;
private ERestType type;
private String managerUsername;
private Address address;
public RestaurantRequest(String name, ERestType type, String managerUsername, Address address) {
this.name = name;
this.type = type;
this.managerUsername = managerUsername;
this.address = address;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public ERestType getType() {
return type;
}
public void setType(ERestType type) {
this.type = type;
}
public String getManagerUsername() {
return managerUsername;
}
public void setManagerUsername(String managerUsername) {
this.managerUsername = managerUsername;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
}
| [
"tanjaney0502@gmail.com"
] | tanjaney0502@gmail.com |
2c46a49a82c8604328e1e072bdbc78b12b1a454a | 59e6dc1030446132fb451bd711d51afe0c222210 | /dependencies/andes/0.13.0-wso2v10/java/broker/src/main/java/org/wso2/andes/server/cassandra/QueueSubscriptionAcknowledgementHandler.java | 0f3eb46b19623b68c2018e5bfaaf153a204954d3 | [] | no_license | Alsan/turing-chunk07 | 2f7470b72cc50a567241252e0bd4f27adc987d6e | e9e947718e3844c07361797bd52d3d1391d9fb5e | refs/heads/master | 2020-05-26T06:20:24.554039 | 2014-02-07T12:02:53 | 2014-02-07T12:02:53 | 38,284,349 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 7,275 | java | /*
* Copyright (c) 2005-2010, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.andes.server.cassandra;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.andes.AMQException;
import org.wso2.andes.AMQStoreException;
import org.wso2.andes.server.AMQChannel;
import org.wso2.andes.server.ClusterResourceHolder;
import org.wso2.andes.server.cassandra.OnflightMessageTracker.MsgData;
import org.wso2.andes.server.queue.QueueEntry;
import org.wso2.andes.server.stats.PerformanceCounter;
import org.wso2.andes.server.store.CassandraMessageStore;
import org.wso2.andes.server.util.AndesUtils;
import java.util.Map;
import java.util.SortedMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentSkipListMap;
/**
* TODO handle message timeouts
*/
public class QueueSubscriptionAcknowledgementHandler {
private CassandraMessageStore cassandraMessageStore;
private Map<Long, QueueMessageTag> deliveryTagMessageMap = new ConcurrentHashMap<Long, QueueMessageTag>();
private Map<Long, QueueMessageTag> sentMessagesMap = new ConcurrentHashMap<Long, QueueMessageTag>();
private SortedMap<Long, Long> timeStampAckedMessageIdMap = new ConcurrentSkipListMap<Long, Long>();
private SortedMap<Long, Long> timeStampMessageIdMap = new ConcurrentSkipListMap<Long, Long>();
private QueueMessageTagCleanupJob cleanupJob;
private Map<Long, Long> messageDeliveryTimeRecorderMap = new ConcurrentHashMap<Long, Long>();
private long timeOutInMills = 10000;
private long ackedMessageTimeOut = 3 * timeOutInMills;
private static Log log = LogFactory.getLog(QueueSubscriptionAcknowledgementHandler.class);
private OnflightMessageTracker messageTracker = OnflightMessageTracker.getInstance();
public QueueSubscriptionAcknowledgementHandler(CassandraMessageStore cassandraMessageStore, String queue) {
this.cassandraMessageStore = cassandraMessageStore;
}
/**
* Check the eligibility of message to be sent to the client
* @param queueEntry
* @param deliveryTag
* @param channel
* @return boolean eligible to be sent
* @throws AMQException
*/
public boolean checkAndRegisterSent(QueueEntry queueEntry, long deliveryTag, AMQChannel channel) throws AMQException {
return messageTracker.testAndAddMessage(queueEntry, deliveryTag, channel);
}
public void handleAcknowledgement(AMQChannel channel, long messageID) {
try {
try {
// We first delete the message so even this fails in tracker, no harm done. Also decrement message count.
messageTracker.ackReceived(channel, messageID);
} catch (AMQStoreException e) {
log.error("Error while handling the ack for " + messageID, e);
}
} catch (Exception e) {
log.error(e);
}
}
private class QueueMessageTag {
private long deliveryTag;
private long messageId;
private String queue;
public QueueMessageTag(String queue, long deliveryTag, long msgId) {
this.queue = queue;
this.deliveryTag = deliveryTag;
this.messageId = msgId;
}
public long getDeliveryTag() {
return deliveryTag;
}
public long getMessageId() {
return messageId;
}
public String getQueue() {
return queue;
}
}
/**
* This will clean up TimedOut QueueMessageTags from the Maps
*/
private class QueueMessageTagCleanupJob implements Runnable {
private boolean running = true;
@Override
public void run() {
long currentTime = System.currentTimeMillis();
while (running) {
try {
synchronized (cassandraMessageStore) {
// Here timeStampMessageIdMap.firstKey() is the oldest
if (timeStampMessageIdMap.firstKey() + timeOutInMills <= currentTime) {
// we should handle timeout
SortedMap<Long, Long> headMap = timeStampMessageIdMap.headMap(currentTime - timeOutInMills);
if (headMap.size() > 0) {
for (Long l : headMap.keySet()) {
long mid = headMap.get(l);
QueueMessageTag mtag = sentMessagesMap.get(mid);
if (mtag != null) {
long deliveryTag = mtag.getDeliveryTag();
if (deliveryTagMessageMap.containsKey(deliveryTag)) {
QueueMessageTag tag = deliveryTagMessageMap.get(deliveryTag);
if (tag != null) {
if (sentMessagesMap.containsKey(tag.getMessageId())) {
sentMessagesMap.remove(tag.getMessageId());
}
deliveryTagMessageMap.remove(deliveryTag);
}
}
}
}
for (Long key : headMap.keySet()) {
timeStampMessageIdMap.remove(key);
}
}
if (timeStampAckedMessageIdMap.firstKey() + ackedMessageTimeOut < currentTime) {
SortedMap<Long, Long> headAckedMessagesMap = timeStampAckedMessageIdMap
.headMap(currentTime - ackedMessageTimeOut);
for (long key : headAckedMessagesMap.keySet()) {
timeStampAckedMessageIdMap.remove(key);
}
}
}
}
} catch (Exception e) {
log.error("Error while running Queue Message Tag Cleanup Task", e);
} finally {
try {
Thread.sleep(60 * 1000);
} catch (InterruptedException e) {
// Ignore
}
}
}
}
public void stop() {
}
}
}
| [
"malaka@wso2.com"
] | malaka@wso2.com |
2fb142788f0aef55368417432963bbb7014d757e | a046f2fabf08f55cc727dd752021a9abf0a49a74 | /ArtTherapy/app/src/androidTest/java/keegancampbell/arttherapy/ApplicationTest.java | 62bbc0451a2e1d53529c5b8b7300fd986b755cf9 | [] | no_license | kfcampbell/schoolprojects | 42e5fab45b8e683c3f91795557d7ac516ef13357 | a6968eedf6483b7992f9ed5fc0528b1bcee5f135 | refs/heads/master | 2021-01-10T08:18:58.450249 | 2016-03-11T01:44:48 | 2016-03-11T01:44:48 | 53,630,493 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 356 | java | package keegancampbell.arttherapy;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"kfcampbell@scu.edu"
] | kfcampbell@scu.edu |
717bd1e3425a65a3dd69fbf50d7236d9a4145f9b | 97d748f3b74945fe9852c327e01c02f86cf008fb | /LinkedList/DoubleLLAdd.java | 25842c8ebad4231dbd3b42c279bb0ae7b6ecfb33 | [] | no_license | SRELETI/AlgosAndDS | 929ac8619307cae5a809fde1731787cd5a11f212 | 299001f6344feeaae309c94def2122e195435766 | refs/heads/master | 2021-01-20T22:10:42.148411 | 2016-07-11T00:26:44 | 2016-07-11T00:26:44 | 63,024,640 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,252 | java | class DoubleLL {
int data;
DoubleLL next;
DoubleLL prev;
public DoubleLL(int val) {
data = val;
next = null;
prev = null;
}
public void display() {
System.out.print(data+" ");
}
}
public class DoubleLLAdd {
private DoubleLL head;
public DoubleLLAdd() {
head = null;
}
public void add(int val) {
DoubleLL newNode = new DoubleLL(val);
if(head == null)
head = newNode;
else
{
newNode.next = head;
head.prev = newNode;
head = newNode;
}
}
public void addAfter(int val, int after) {
if(head==null)
return;
DoubleLL temp = head;
while(temp!=null)
{
if(temp.data == after)
{
DoubleLL newNode = new DoubleLL(val);
DoubleLL temp_node = temp.next;
temp.next = newNode;
newNode.prev = temp;
newNode.next = temp_node;
temp_node.prev = newNode;
return;
}
temp = temp.next;
}
}
public void addEnd(int val) {
DoubleLL newNode = new DoubleLL(val);
if(head==null)
head = newNode;
else
{
DoubleLL temp = head;
while(temp.next!=null)
temp = temp.next;
temp.next = newNode;
newNode.prev = temp;
}
}
public void addBefore(int val, int before)
{
if(head == null)
return;
DoubleLL newNode = new DoubleLL(val);
DoubleLL temp = head;
DoubleLL prev = null;
while(temp!=null)
{
if(temp.data == before)
{
if(prev == null)
{
newNode.next = head;
head.prev = newNode;
head = newNode;
}
else
{
newNode.next = temp;
temp.prev = newNode;
prev.next = newNode;
newNode.prev = prev;
}
break;
}
prev = temp;
temp = temp.next;
}
}
public void display()
{
DoubleLL temp = head;
DoubleLL last= null;
while(temp!=null)
{
temp.display();
last = temp;
temp = temp.next;
}
System.out.println();
while(last!=null)
{
last.display();
last = last.prev;
}
System.out.println();
}
public static void main(String args[])
{
DoubleLLAdd d = new DoubleLLAdd();
d.add(6);
d.add(7);
// d.add(1);
d.addEnd(4);
d.addAfter(8, 7);
d.addBefore(1, 7);
d.display();
}
}
| [
"sudeepreddyeleti@gmail.com"
] | sudeepreddyeleti@gmail.com |
58c8fd867ae0d77c3f452f090338b0a086bb5889 | 49078150a31581c7c9f0efd44b86b78acfed00c0 | /xiayu/src/main/java/com/xiayu/JavaDemo/xiayu/java/designpatterns/singleton/Singleton.java | 0d2be40e860a0c4b44e60e4a95266f6792acef0f | [] | no_license | oooblack/JavaDemo | 0bd77eba210b2a6356c79d7b3e8597380c93b82f | 6c1d6115788b4b951b2e0d4a81cbd07f8777350b | refs/heads/master | 2021-07-11T08:09:24.324516 | 2019-12-24T14:40:23 | 2019-12-24T14:40:23 | 204,868,413 | 0 | 0 | null | 2019-12-24T14:40:24 | 2019-08-28T06:59:01 | Java | UTF-8 | Java | false | false | 716 | java | package com.xiayu.JavaDemo.xiayu.java.designpatterns.singleton;
/**
* @author: starc
* @date: 2019/1/27
*/
public class Singleton {
//ไฝฟ็จๅปถ่ฟๅฎไพๅ็ดๅฐgetInstance็ฌฌไธๆฌก่ขซ่ฐ็จๆๅๅงๅsingleton๏ผๅฆๆไธ่ขซ่ฐ็จๅฐฑไธ็ดไธๅๅงๅ๏ผ่็่ตๆบใ
private static Singleton singleton = null;
private Singleton() {
//ๅฎไน็ๆ้ ๅฝๆฐๆฏ็งๆ็๏ผๅค้ขๆ ๆณ้่ฟnewๆฅๅพๅฐ่ฟไธช็ฑป็ๅฎไพใ
}
/**
* ๅพๅฐ่ฟไธช็ฑปๅฎไพ็ๅฏไธ้ๅพใ
*
* @return ็ฑปๅฎไพ
*/
public static Singleton getInstance() {
if (singleton == null) {
singleton = new Singleton();
}
return singleton;
}
}
| [
"1546080420@qq.com"
] | 1546080420@qq.com |
c7510abc9d26627db756dfe1a052a825733190be | 8731feb34f8ae09e3e7d718be0c1f73e4c7fa1b0 | /src/main/java/com/zj/community/provider/GithubProvider.java | 4d960a4138612832b2f5e3969db9ebe1e735d707 | [] | no_license | GalaxyCoderZJ/community | 0a9a5944f9bd180dc6106ad70d38078b7d06ef02 | f618a10d53a21530ea6c1446451e93441af58d8b | refs/heads/master | 2022-07-16T06:52:13.400266 | 2019-11-26T13:06:43 | 2019-11-26T13:06:43 | 222,948,909 | 0 | 0 | null | 2022-06-21T02:18:13 | 2019-11-20T13:54:32 | Java | UTF-8 | Java | false | false | 1,757 | java | package com.zj.community.provider;
import com.alibaba.fastjson.JSON;
import com.zj.community.dto.AccessTokenDTO;
import com.zj.community.dto.GithubUser;
import okhttp3.*;
import org.springframework.stereotype.Component;
import java.io.IOException;
@Component
public class GithubProvider {
public String getAccessToken(AccessTokenDTO accessTokenDTO) {
MediaType mediaType = MediaType.get("application/json; charset=utf-8");
OkHttpClient client = new OkHttpClient();
RequestBody body = RequestBody.create(mediaType, JSON.toJSONString(accessTokenDTO));
Request request = new Request.Builder()
.url("https://github.com/login/oauth/access_token")
.post(body)
.build();
try (Response response = client.newCall(request).execute()) {
String string= response.body().string();
String token=string.split("&")[0].split("=")[1];
return token;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public GithubUser getUser(String accessToken){
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://api.github.com/user?access_token="+accessToken)
.build();
try {
Response response = client.newCall(request).execute();
String string = response.body().string();
GithubUser githubUser = JSON.parseObject(string,GithubUser.class);
return githubUser;
} catch (IOException e) {
return null;
}
}
}
| [
"610787215@qq.com"
] | 610787215@qq.com |
9036b137b0f19c183398e9a8f476444308998eb5 | a52f4244e037c79a42bb4c4e8cf3d63966faf6af | /test/transform/resource/after-ecj/GetterTypeAnnosCopy.java | 1b4f03c55ce911d2ada64ae3158cc8f511576b35 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | wmdietl/lombok | fecb1f6208166dffd5b5bbf2e32ade7821312bb5 | 47ea7b182e90d2c7a26e548e6defd93b305d5ada | refs/heads/master | 2020-03-18T20:00:30.273864 | 2018-08-31T03:18:33 | 2018-08-31T03:18:33 | 135,190,723 | 0 | 0 | null | 2018-05-28T17:28:54 | 2018-05-28T17:28:54 | null | UTF-8 | Java | false | false | 398 | java | import lombok.Getter;
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
import java.util.List;
@Target({ElementType.TYPE_USE, ElementType.TYPE_PARAMETER}) @interface TA {
}
class GetterTypeAnnos {
@Getter @TA List<@TA String> foo;
GetterTypeAnnos() {
super();
}
public @TA @java.lang.SuppressWarnings("all") List<String> getFoo() {
return this.foo;
}
}
| [
"wdietl@gmail.com"
] | wdietl@gmail.com |
98f1848108e0c44be7dc5e4b37c6682321b729c6 | e7305ae2001bb83e1e9012801df70e25565e0661 | /Software-Testing/Trabalho3/TesteAgencia.java | 197dfa3d18177b3ee5b990bf06a3778698ba7377 | [] | no_license | FabioMoreiraFM/UFSC | 19c2cdc633fe1d396e2cdba00b11c07aa4ecb1cb | 81493b30e2055e22a700e4a6b6eae9e5dbd9dfd0 | refs/heads/master | 2021-05-12T00:43:27.886026 | 2018-06-12T02:54:39 | 2018-06-12T02:54:39 | 117,543,484 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 911 | java | package testes;
import static org.hamcrest.MatcherAssert.*;
import static org.hamcrest.core.IsEqual.*;
import static org.junit.Assert.assertEquals;
import org.junit.*;
import br.ufsc.ine.leb.projetos.estoria.*;
import br.ufsc.ine.leb.sistemaBancario.*;
@FixtureSetup(TesteBancario.class)
public class TesteAgencia {
@Fixture private Banco bb;
@Fixture SistemaBancario sisbb;
private Agencia centro;
@Before
public void setupAgencia() {
centro = bb.criarAgencia("Centro");
}
@Test
public void criacaoBemSucedidaAgencia() {
assertEquals("001", centro.obterIdentificador());
assertEquals("Centro", centro.obterNome());
assertEquals(bb, centro.obterBanco());
}
@Test
public void criacaoBemSucedidaAgenciaHamcrest() {
assertThat("001", equalTo(centro.obterIdentificador()));
assertThat("Centro", equalTo(centro.obterNome()));
assertThat(bb, equalTo(centro.obterBanco()));
}
}
| [
"fabiomoreira.mf@gmail.com"
] | fabiomoreira.mf@gmail.com |
3ad36619c588057bdd98d4c5a359d70eb714433a | a019327b1cffa7519cadf03fbbae1c8a638c0983 | /src/main/java/com/techno/chess/move/HorseMovementDirection.java | 7e17b6065aa3a3708f35d520215d1de063d4e647 | [] | no_license | ashishnandan/chessboard | 48e4f2ace6d7a4bae2fe390d983be9117d05156a | aa8554c93f55975dd1b2e6c0ecc95e577d319749 | refs/heads/master | 2022-09-06T19:45:22.528042 | 2020-05-26T19:47:42 | 2020-05-26T19:47:42 | 265,933,559 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,109 | java | package com.techno.chess.move;
import com.techno.chess.Cell;
public enum HorseMovementDirection {
TOP_RIGHT{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveUp();
newCell = newCell.moveUp();
return newCell.moveRight();
}
}, SIDE_RIGHT_TOP{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveRight();
newCell = newCell.moveRight();
return newCell.moveUp();
}
}, SIDE_RIGHT_BOTTOM{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveRight();
newCell = newCell.moveRight();
return newCell.moveDown();
}
}, BOTTOM_RIGHT{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveDown();
newCell = newCell.moveDown();
return newCell.moveRight();
}
}, BOTTOM_LEFT{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveDown();
newCell = newCell.moveDown();
return newCell.moveLeft();
}
}, SIDE_LEFT_BOTTOM{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveLeft();
newCell = newCell.moveLeft();
return newCell.moveDown();
}
}, SIDE_LEFT_TOP{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveLeft();
newCell = newCell.moveLeft();
return newCell.moveUp();
}
}, TOP_LEFT{
@Override
public Cell move(Cell start) {
Cell newCell = start;
newCell = newCell.moveUp();
newCell = newCell.moveUp();
return newCell.moveLeft();
}
};
public abstract Cell move(Cell start);
}
| [
"ashishnandan@gmail.com"
] | ashishnandan@gmail.com |
e0b4799fc7b4d0517974faa251eb468fdf24437a | d15803d5b16adab18b0aa43d7dca0531703bac4a | /com/whatsapp/gdrive/d2.java | 522ed65d8c855c7b2c057a8eafcc4dac5cbf4e82 | [] | no_license | kenuosec/Decompiled-Whatsapp | 375c249abdf90241be3352aea38eb32a9ca513ba | 652bec1376e6cd201d54262cc1d4e7637c6334ed | refs/heads/master | 2021-12-08T15:09:13.929944 | 2016-03-23T06:04:08 | 2016-03-23T06:04:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,176 | java | package com.whatsapp.gdrive;
import com.whatsapp.util.Log;
import org.apache.http.HttpEntity;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.impl.client.EntityEnclosingRequestWrapper;
import org.apache.http.impl.client.RequestWrapper;
import org.apache.http.protocol.HttpContext;
import org.v;
import org.whispersystems.at;
class d2 implements HttpRequestInterceptor {
private static final String[] z;
private final int a;
private int b;
static {
String[] strArr = new String[2];
String str = "W(3. Ua 7?\u001f>$6#U?5j?^8$55U<5($\u001f<3(5U?2h:U\"&3>\u001f";
Object obj = -1;
String[] strArr2 = strArr;
String[] strArr3 = strArr;
int i = 0;
while (true) {
char[] toCharArray = str.toCharArray();
int length = toCharArray.length;
char[] cArr = toCharArray;
for (int i2 = 0; length > i2; i2++) {
int i3;
char c = cArr[i2];
switch (i2 % 5) {
case v.m /*0*/:
i3 = 48;
break;
case at.g /*1*/:
i3 = 76;
break;
case at.i /*2*/:
i3 = 65;
break;
case at.o /*3*/:
i3 = 71;
break;
default:
i3 = 86;
break;
}
cArr[i2] = (char) (i3 ^ c);
}
str = new String(cArr).intern();
switch (obj) {
case v.m /*0*/:
strArr2[i] = str;
z = strArr3;
return;
default:
strArr2[i] = str;
i = 1;
strArr2 = strArr3;
str = "W(3. Ua3\"'E)23{Y\"5\"$S)139Bc159S)24yB)023C8l.%\u001d\".3{Qa657@<$5v";
obj = null;
}
}
}
public d2(int i) {
this.a = i;
}
public void b() {
this.b = 0;
}
public int a() {
return this.b;
}
static int a(d2 d2Var) {
return d2Var.a;
}
public void process(HttpRequest httpRequest, HttpContext httpContext) {
this.b++;
if (httpRequest instanceof EntityEnclosingRequestWrapper) {
HttpEntity entity = ((EntityEnclosingRequestWrapper) httpRequest).getEntity();
if (entity != null) {
long contentLength = entity.getContentLength();
if (contentLength <= 0) {
Log.e(z[0] + contentLength);
return;
}
((EntityEnclosingRequestWrapper) httpRequest).setEntity(new c6(this, entity));
if (!GoogleDriveService.c) {
return;
}
}
return;
}
if (!(httpRequest instanceof RequestWrapper)) {
Log.e(z[1] + httpRequest);
}
}
}
| [
"gigalitelk@gmail.com"
] | gigalitelk@gmail.com |
f5a1d9b60cfa78bbfe37bdfc012228ca98e29cc8 | 96cae70cdf6fab4bfe7658481f0e2894d4cd5ce4 | /src/Product/ProductK.java | c2698491c99cdd39b7d9ed819d415226ce221723 | [] | no_license | takhir-nafikov/solid_task | 8c839b0784ec0b2a2b49fdc24d2d553090eb8795 | 8519756d63a9020a840b64dd1c76bbdda41d8d51 | refs/heads/master | 2020-04-22T17:04:18.857520 | 2019-02-13T15:48:33 | 2019-02-13T15:48:33 | 170,528,536 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 257 | java | package Product;
public class ProductK extends Product {
public ProductK(float price, int id, String name) {
setPrice(Math.abs(price));
setId(id);
setName(name);
setProductType(ProductType.ProductK);
}
}
| [
"noreply@github.com"
] | takhir-nafikov.noreply@github.com |
c3e8692c9a013b7632bc1009cc974d14c2c4c5eb | 8e69c3cef8c7132a3452693d84639512e4526a2f | /src/main/java/eu/hansolo/fx/numberpad/Fonts.java | 7e794b609c2aeb193104102e0ce09f9c3c107b0c | [
"Apache-2.0"
] | permissive | codedMachines/numberpad | 2936a5f1fe864389e4dbd4e980964b250266b3e9 | c70221a55a3d1e47d91d1b43f3497d0ae2187e0d | refs/heads/master | 2022-11-07T19:45:14.042743 | 2020-06-20T05:01:24 | 2020-06-20T05:01:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,294 | java | /*
* Copyright (c) 2020 by Gerrit Grunwald
*
* 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 eu.hansolo.fx.numberpad;
import javafx.scene.text.Font;
public class Fonts {
private static final String ROBOTO_MONO_REGULAR_NAME;
private static String robotoMonoRegularName;
static {
try {
robotoMonoRegularName = Font.loadFont(Fonts.class.getResourceAsStream("/eu/hansolo/fx/numberpad/RobotoMono-Regular.ttf"), 10).getName();
} catch (Exception exception) { }
ROBOTO_MONO_REGULAR_NAME = robotoMonoRegularName;
}
// ******************** Methods *******************************************
public static Font robotoMonoRegular(final double SIZE) { return new Font(ROBOTO_MONO_REGULAR_NAME, SIZE); }
}
| [
"han.solo@mac.com"
] | han.solo@mac.com |
fc9797a6d33a68b276dfad43c0536a3ac613100e | 0f1d2eb3a1c42d2f74b3a9281f47ecbd89f4ce54 | /starter/src/main/java/cn/wufa995/common/util/CheckParam.java | d3fd1d637e7244f25b374e9d848a24930e1931b3 | [] | no_license | wufa995/automobile-service | 8092012f191cc61828baa4de70d4f2fecc255d30 | 2a6daf5e69d3e6f6ad79ed6b452085511bfcfb84 | refs/heads/master | 2021-07-15T19:34:31.419520 | 2020-06-22T05:00:32 | 2020-06-22T05:00:38 | 177,575,501 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 790 | java | /**
* @author: wufa995[wufa995@qq.com]
* @date: 2019ๅนด03ๆ27ๆฅ 15ๆถ42ๅ
*/
package cn.wufa995.common.util;
import java.util.List;
public class CheckParam {
/**
* ๅคๆญๆฏๅฆไธบ็ฉบๆ็ฉบๅญ็ฌฆไธฒ
* @param o ไปปๆ็ๅๆฐ
* @return ็ๆๅ
*/
public static Boolean notEmpty(Object o) {
return o != null && !"".equals(o.toString().trim());
}
/**
* ๅคๆญๆฏๅฆไธบ็ฉบๆ็ฉบ้ๅ
* @param list ้ๅ
* @return ็ๆๅ
*/
public static Boolean notEmpty(List<Object> list) {
return list != null && list.size() != 0;
}
public static Boolean isEmpty(Object o) {
return !notEmpty(o);
}
public static Boolean isEmpty(List<Process> list) {
return !notEmpty(list);
}
} | [
"qin_bo@suixingpay.com"
] | qin_bo@suixingpay.com |
c3226bbcd0f0a31f12adcb9f27c86fa4daafbd0b | d1ffc9dc5d52b51517ba5d52da9181ecc4195c5a | /app/src/main/java/com/kay/duitang/adapter/StaggerItemAdapter.java | 10cfa19ddb3606023b9349d1f187ab642194ee34 | [] | no_license | duyouhua/Duitang | 29f1a9c33b55bdbfb24768453a3f76d8616a834a | e84815ab6fa17e6dce19fe9ee4867183afa4c71a | refs/heads/master | 2021-01-20T16:35:56.028735 | 2015-05-02T09:46:18 | 2015-05-02T09:46:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,644 | java | package com.kay.duitang.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import com.etsy.android.grid.util.DynamicHeightImageView;
import com.kay.duitang.R;
import com.kay.duitang.bean.StaggerItem;
import com.kay.duitang.utils.BitmapUtils;
import com.squareup.picasso.Picasso;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import butterknife.ButterKnife;
import butterknife.InjectView;
/**
* Created by Kay on 15/4/19.
*/
public class StaggerItemAdapter extends BaseAdapter {
private List<StaggerItem> itemList;
private Context mContext;
private boolean isReverse = false;
public StaggerItemAdapter(Context context) {
mContext = context;
initData();
}
public StaggerItemAdapter(Context context, boolean isReverse) {
mContext = context;
this.isReverse = isReverse;
initData();
}
private void initData() {
int[] imageSource = {R.drawable.pic0, R.drawable.pic1, R.drawable.pic2, R.drawable.pic3,
R.drawable.pic4, R.drawable.pic5, R.drawable.pic6, R.drawable.pic7,
R.drawable.pic8, R.drawable.pic9};
String[] descriptionArray = {"่ค็ซไนๆฃฎ", "้พๆ--ๆไปฌ้ฝๆฏๅฐๆชๅ
ฝ๏ผ็ปๆไธๅคฉไผ่ขซๆญฃไน็ๅฅฅ็นๆผๆๆญป", "ๅบ็ฉๅฉ็จ", "ไธไธๆ ท็ๅช็บธ", "ๅพฎๅไผๆฉ็ฉบ้ด",
"#ๅฃ็บธ#", "็ฎ็ฌ็ปๅไบซ", "ๅๆ็ๆดป", "่ฑไผฆ้ฃ", "ๆบๆบ็็ซๅคๅจๅญฆไน ่นญWiFi"};
int[] thumbImageArray = {R.drawable.thumb0, R.drawable.thumb1, R.drawable.thumb2, R.drawable.thumb3, R.drawable.thumb4};
String[] userNameArray = {"้ปๅฟต้ฃๆพๆถ", "ๆฅ่ชๅๅงๆฃฎๆ็ๅธไผ้น
", "ๅนดๅ้ๆฐด", "่ๅนดไฟกๅพ", "็บข็ง",
"ๆฐด่ฅๅฐๅฟ", "ๅ็ฆป", "ไนๅ
ฝ", "ๆไธๆฏCandy", "ๅๅนด่ๅฆ"};
String[] collectPlace = {"่ถ
่ฝป็ฒๅ", "้พๆ", "ๅคง็ฝ", "ๆๅญๆง", "่ซไธ็ฅ",
"ๅธ็บธๅๆฌขไฝ ", "็พๅณ็พ้ฃๅ ", "ๅคๅฟๅฝ็็งๅฏ", "ๅๅๅ", "ๆ็ป้ฃไบไบ"};
itemList = new ArrayList<StaggerItem>();
Random random = new Random();
for (int i = 0; i < 10; i++) {
StaggerItem item = new StaggerItem();
item.setImageSource(imageSource[i]);
item.setDestription(descriptionArray[i]);
item.setCollectNum(random.nextInt(500));
item.setThumbImage(thumbImageArray[i % 5]);
item.setUserName(userNameArray[i]);
item.setCollectPlace(collectPlace[i]);
itemList.add(item);
}
if (isReverse) Collections.reverse(itemList);
}
@Override
public int getCount() {
return itemList.size();
}
@Override
public Object getItem(int position) {
return itemList.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder vh;
if (convertView == null) {
convertView = LayoutInflater.from(mContext).inflate(R.layout.stagger_item, parent, false);
vh = new ViewHolder(convertView);
convertView.setTag(vh);
} else {
vh = (ViewHolder) convertView.getTag();
}
StaggerItem item = itemList.get(position);
vh.imageView.setHeightRatio(BitmapUtils.getBitmapRatio(mContext, item.getImageSource()));
Picasso.with(mContext).load(item.getImageSource()).into(vh.imageView);
vh.description.setText(item.getDestription());
vh.collectNum.setText(item.getCollectNum() + "");
Picasso.with(mContext).load(item.getThumbImage()).into(vh.thumbImage);
vh.userName.setText(item.getUserName());
vh.collectPlace.setText("ๆถ้ๅฐ "+item.getCollectPlace());
return convertView;
}
static class ViewHolder {
@InjectView(R.id.stagger_image)
DynamicHeightImageView imageView;
@InjectView(R.id.thumb)
ImageView thumbImage;
@InjectView(R.id.description)
TextView description;
@InjectView(R.id.collect_number)
Button collectNum;
@InjectView(R.id.collect_place)
TextView collectPlace;
@InjectView(R.id.user_name)
TextView userName;
public ViewHolder(View view) {
ButterKnife.inject(this, view);
}
}
}
| [
"wuyingying.kay@gmail.com"
] | wuyingying.kay@gmail.com |
04ef745331a944c9422d8340698b80baf65f0eca | 0baf9b43aa50d7ec32e13fc932604a8a8c0613ec | /lib/slack/src/main/java/moe/pine/izetta/slack/Slack.java | 0b8b5eab02380c9cca8890b1eb5bf2b472cbaea3 | [
"MIT"
] | permissive | pine/izetta-v2 | 540458da619c3a2284ee7d2cac4608be74dc6312 | 523ae9a439a143fb6b4a177b5ed999204fd8ac32 | refs/heads/master | 2022-12-04T06:10:21.353377 | 2019-10-19T07:16:24 | 2019-10-19T07:16:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,950 | java | package moe.pine.izetta.slack;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.util.Objects;
public class Slack {
@SuppressWarnings("WeakerAccess")
public static final String SLACK_CHAT_POST_MESSAGE = "https://slack.com/api/chat.postMessage";
private final RestTemplate restTemplate;
public Slack(final RestTemplateBuilder restTemplateBuilder) {
restTemplate = restTemplateBuilder.build();
}
public void postMessage(final Message message) {
Objects.requireNonNull(message);
final var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.add(HttpHeaders.AUTHORIZATION, "Bearer " + message.getToken());
final MultiValueMap<String, String> values = new LinkedMultiValueMap<>();
values.add("channel", message.getChannel());
values.add("username", message.getUsername());
values.add("icon_url", message.getIconUrl());
values.add("text", message.getText());
final HttpEntity<?> request = new HttpEntity<>(values, headers);
final Status status = restTemplate.postForObject(SLACK_CHAT_POST_MESSAGE, request, Status.class);
if (status == null) {
throw new RuntimeException("Failed to call `chat.postMessage` API. An empty response received.");
}
if (!status.isOk()) {
throw new RuntimeException(
String.format(
"Failed to call `chat.postMessage` API :: ok=%s, error=\"%s\"",
String.valueOf(status.isOk()),
status.getError()));
}
}
}
| [
"pinemz@gmail.com"
] | pinemz@gmail.com |
6d49eed6e0489b2c3ac94bb7b519d0d5b4f10b1a | 23b9cf65e3377c2e91445503a9f2bbfd1c93be22 | /Java/workspace/Java1-Chapter11/solutions/Rectangle2.java | f75806ad2d894b161030d047243e2d3903baaf59 | [] | no_license | TravisWay/Skill-Distillery | 6d596529664e9e492d40d0e92f081fe6e32cf473 | 153ae2cbb070761e7accc0ca291f41c608ecefb1 | refs/heads/master | 2021-01-23T10:43:27.491949 | 2017-07-14T01:03:29 | 2017-07-14T01:03:29 | 93,082,758 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | package solutions;
public class Rectangle2 extends Shape2 {
private int width;
private int height;
public Rectangle2(int w, int h) {
this(Color.WHITE,w, h);
}
public Rectangle2(Color c, int w, int h) {
super(c);
width = w;
height = h;
}
public void draw() {
System.out.println("Draw rectangle in " + getColor());
}
@Override
public double getArea() {
return width * height;
}
public int getWidthd() {
return width;
}
public void setWidth(int w) {
width = w;
}
public int getHeight() {
return height;
}
public void setHeight(int h) {
height = h;
}
}
| [
"travis_sti@yahoo.com"
] | travis_sti@yahoo.com |
3daddbc92fe08b603543bf4a6a6515897b281b4c | 1eb1c244d087a5052919fbb558e05fb0bac91d01 | /provider/provider-service/src/main/java/com/hamlt/demo/controller/ProviderTestController.java | c70b174c53f7db9ee83ba308236dcc7f67228d2e | [] | no_license | ZHANGHAISHENG/hamlt_springcloud | 634df04abc9cbfd980dad3755733bbca90428584 | 8dd85a6e67ea618f07b21c35e1be9d04abc5ccb1 | refs/heads/master | 2023-06-15T02:57:51.496901 | 2021-07-12T09:29:40 | 2021-07-12T09:29:40 | 385,191,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,283 | java | package com.hamlt.demo.controller;
import com.hamlt.demo.api.pojo.EchoReq;
import com.hamlt.demo.api.pojo.EchoResp;
import com.hamlt.demo.api.service.ProviderRemoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
@Api(tags = "ๆต่ฏๆฅๅฃ")
@RestController
public class ProviderTestController implements ProviderRemoteService {
@Value("${defaultUserName:zhs}")
private String defaultUserName;
@ApiOperation(value = "็ฎๅ่พๅบไฟกๆฏ")
@Override
public EchoResp echo(@RequestBody EchoReq request) {
return new EchoResp("hello! thanks for your request: " + request.getContent() + ", default userName:" + defaultUserName);
}
@PostMapping("/test/reqTest")
public String reqTest(HttpServletRequest request) {
Object userName = request.getHeader("userName");
return userName == null ? "empty userName" : userName.toString();
}
}
| [
"332627460@qq.com"
] | 332627460@qq.com |
28948b21603afe5f2ec0c7140263322f9cbefe7e | 557ec5f2b4991b537d8a3313bfb2aa8417d31f78 | /src/main/java/week1/day1/ContractStudent.java | 9e8fe2a50e9c3750fb92eaf270f31a5d8abfac9c | [] | no_license | papikAlexander/ACO16 | 7750018b256ec3fba0f71efaa21c2bdf85647d6b | 69aac980ca47d041436c9a4c2fbbad80b93edaad | refs/heads/master | 2021-01-10T23:23:46.404865 | 2016-11-18T18:33:01 | 2016-11-18T18:33:01 | 70,589,443 | 0 | 2 | null | 2016-10-11T21:30:01 | 2016-10-11T12:08:34 | Java | UTF-8 | Java | false | false | 751 | java | package week1.day1;
/**
* Created by Alexander on 09.10.2016.
*/
public class ContractStudent extends Student{
private int period;
public int getPeriod() {
return period;
}
public void setPeriod(int period) {
this.period = period;
}
public ContractStudent(String name, String surname, int age, double averageMark, int period) {
super(name, surname, age, averageMark);
this.period = period;
}
@Override
public String toString() {
return super.toString() + " ContractStudent{" +
"period=" + period +
'}';
}
public ContractStudent clone() throws CloneNotSupportedException{
return (ContractStudent)super.clone();
}
}
| [
"alexanderpapusha@gmail.com"
] | alexanderpapusha@gmail.com |
f4ef2fdefdfe01c0e6bb19be4aa33980de034621 | 07ad5a047562e1762d08bf35e28a8cff3d9fe497 | /LocationLab/gen/course/labs/locationlab/R.java | 96071ced97fbcf25eb6c15234bf4522379f52a92 | [] | no_license | edwalpca/Curso-1-Android | 96da1b6cfb52cc287716fb009e8f5fb6483342d3 | c1bff2e201d8e49d04aa45dcfa7d2f84cfbc7d4d | refs/heads/master | 2016-08-04T19:41:30.004367 | 2014-08-14T19:47:10 | 2014-08-14T19:47:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,693 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package course.labs.locationlab;
public final class R {
public static final class attr {
}
public static final class dimen {
/** Default screen margins, per the Android Design guidelines.
*/
public static final int activity_horizontal_margin=0x7f040000;
public static final int activity_vertical_margin=0x7f040001;
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
public static final int stub=0x7f020001;
}
public static final class id {
public static final int country_name=0x7f080004;
public static final int delete_badges=0x7f080005;
public static final int flag=0x7f080001;
public static final int footer=0x7f080000;
public static final int place_invalid=0x7f080008;
public static final int place_name=0x7f080003;
public static final int place_one=0x7f080007;
public static final int place_two=0x7f080009;
public static final int print_badges=0x7f080006;
public static final int text_desc=0x7f080002;
}
public static final class layout {
public static final int footer_view=0x7f030000;
public static final int place_badge_view=0x7f030001;
}
public static final class menu {
public static final int main=0x7f070000;
}
public static final class string {
public static final int action_settings=0x7f050001;
public static final int app_name=0x7f050000;
public static final int delete=0x7f050003;
public static final int footer_text=0x7f050002;
public static final int place_invalid=0x7f050006;
public static final int place_one=0x7f050005;
public static final int place_two=0x7f050007;
public static final int print=0x7f050004;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
*/
public static final int AppBaseTheme=0x7f060000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f060001;
}
}
| [
"ealpizar@ticosoftweb.com"
] | ealpizar@ticosoftweb.com |
98748013c4586e4e0567025543ba731fb001c8de | de9e97f822818e4b28bb1b73f77ecaa6a754ca10 | /src/test/java/com/lmeng/LmengApplicationTests.java | 6d11497cd065cdcd54f8ffa0180767184d4954fd | [] | no_license | lmengi/lmeng | 82b5ad53e31280572baad8bc1d9e280eb0eb1048 | 22d46deda82b96bccc70e12540da41961e9143d1 | refs/heads/master | 2020-03-25T02:18:44.971015 | 2018-12-05T07:37:17 | 2018-12-05T07:37:17 | 143,283,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 334 | java | package com.lmeng;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class LmengApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"508816@nd.com"
] | 508816@nd.com |
ac626d7e4736d0f4b67b9bb13b8952159df21137 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/14/14_f07830d42628f93bc41271d38935ec89248ac729/SimpleJDTParser/14_f07830d42628f93bc41271d38935ec89248ac729_SimpleJDTParser_s.java | 9fed4f7518fa6ced4cc4726813880b02a060622f | [] | 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 | 2,867 | java | /*******************************************************************************
* Copyright (c) 2012 Jens von Pilgrim
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU General Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/gpl.html
*
* Contributors:
* Jens von Pilgrim - initial API and implementation
******************************************************************************/
package de.jevopi.j2og.simpleParser;
import java.util.ArrayList;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
import de.jevopi.j2og.model.Type;
import de.jevopi.j2og.model.Model;
/**
* @author Jens von Pilgrim (developer@jevopi.de)
*/
public class SimpleJDTParser {
IPackageFragment packageFragment;
Visitor v;
private ICompilationUnit compilationUnit;
/**
* @param i_packageFragment
*/
public SimpleJDTParser() {
v = new Visitor();
}
/**
* @param i_packageFragment the packageFragment to set
*/
public void setPackageFragment(IPackageFragment i_packageFragment) {
packageFragment = i_packageFragment;
compilationUnit = null;
}
/**
* @param i_compilationUnit
* @since Nov 1, 2011
*/
public void setCompilationUnit(ICompilationUnit i_compilationUnit) {
compilationUnit = i_compilationUnit;
packageFragment = null;
};
/**
*
* @since Aug 18, 2011
*/
public void run() throws Exception {
// IJavaProject javaProject = null;
// if (packageFragment != null)
// javaProject = packageFragment.getJavaProject();
// else
// javaProject = compilationUnit.getJavaProject();
IProgressMonitor monitor = new NullProgressMonitor();
Collection<CompilationUnit> compilationUnits =
new ArrayList<CompilationUnit>();
ICompilationUnit[] cus =
(packageFragment != null) ? packageFragment.getCompilationUnits()
: new ICompilationUnit[] {
compilationUnit
};
for (ICompilationUnit icu : cus) {
final ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setResolveBindings(true);
parser.setSource(icu);
CompilationUnit cu = (CompilationUnit) parser.createAST(monitor);
compilationUnits.add(cu);
}
for (CompilationUnit cu : compilationUnits) {
cu.accept(v);
}
}
/**
* @return the classifiers
*/
public Collection<Type> getClassifiers() {
return v.getModel().allTypes();
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
0f578555e46c3fc740d024eca0466f80cb70c6fa | eee33c6eb827d673ba527732cf50ad9fe8eea3c8 | /Lab7_Multimedia/Vd2/app/src/test/java/com/example/vd2/ExampleUnitTest.java | 26a96b4d1816a91bc6d34fa23f7f6f63a559d859 | [] | no_license | Lanh2208/android | 7c2dff339732ced479081865bd64135778bed353 | 8797396715c4961dc90d59eb79a7375cff37ff4b | refs/heads/main | 2023-09-05T07:42:01.896423 | 2021-11-23T15:24:13 | 2021-11-23T15:24:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 376 | java | package com.example.vd2;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"tuan.pv.782@aptechlearning.edu.vn"
] | tuan.pv.782@aptechlearning.edu.vn |
4e9e9e889a15add8f9efc467cb0d3d3b0c4d31ab | b8839faed2569190b57e72acaecc6ce2a6d50b91 | /remp/src/main/java/com/remp/work/model/service/CustomerService.java | 577c54d8264341cca962735cb0da771f35a6afa9 | [] | no_license | mingjeeong/remp | 5e6eca784d7081c631f9981f73fa2f806316724b | 41066711a5cb2a542d68725a8f221c7d87f78c59 | refs/heads/master | 2021-08-28T21:53:37.453052 | 2017-12-13T07:16:37 | 2017-12-13T07:16:37 | 111,904,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,621 | java | package com.remp.work.model.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface CustomerService {
/* ======================================== by ์ด๋ํ ================================================= */
/**
* ํ์์ ๋น๋ฐ๋ฒํธ๋ฅผ ์ฐพ๋ ๋ฉ์๋
* @param id ํ์์ ์์ด๋
* @param name ํ์์ ์ด๋ฆ
* @param birth ํ์์ ์๋
์์ผ
* @param mobile ํ์์ ํด๋์ ํ๋ฒํธ
* @return String ์์๋น๋ฐ๋ฒํธ๋ฅผ ์ ์กํ๊ธฐ ์ํด ํ์์ ์์ด๋(์ด๋ฉ์ผ)๋ฅผ ๋ฐํ
*/
public String getPw(String id, String name, String birth, String mobile);
/**
* ํ์์ ๋น๋ฐ๋ฒํธ๋ฅผ ๋์ถ๋ ์์๋น๋ฐ๋ฒํธ๋ก ๋ฐ๊ฟ์ฃผ๋ ๋ฉ์๋
* @param id ๋น๋ฐ๋ฒํธ๋ฅผ ๋ณ๊ฒฝ ํ ํ์์ ์๋ณํ๋ ์์ด๋
* @param tmpPW ๋น๋ฐ๋ฒํธ ์ฐพ๊ธฐ๋ฅผ ํตํด ๋์ถ๋ ์์๋น๋ฐ๋ฒํธ
* @return int ๋ณ๊ฒฝ ์ฑ๊ณต ์ 1, ์คํจ ์ 0 ๋ฐํ
*/
public int setTmpPw(String id, String tmpPW);
public List<Map<String,String>> getItemInfo(String customerId); // ์๋ดํ
์ด๋ธ ์์ฐ๊ฐ์ ธ์ค๊ธฐ
public Map<String,String> getChangeInfo(String sbValue); // ์๋ดํ
์ด๋ธ ์์ฐ์ ๊ธฐ๊ฐ๊ฐ์ ธ์ค๊ธฐ
/* ======================================== by ์ด์ํธ ================================================= */
public Map<String, String> getCustomerInfo(String customerId); // ์๋ดํ
์ด๋ธ ๊ฐ์
์ฌ๋ถ ํ์ธํ๊ธฐ
public HashMap<String, String> getLogin(String id, String pw);
public boolean addJoin(Map<String, String> customerJoin);
public boolean getIdCheck(String customerId);
public List<Map<String, String>> getCustomerList(String searchId);
public boolean setCustomerInfo(Map<String, String> customerInfo);
public boolean setCustomerInfoDetail(Map<String, String> customerInfo);
public String addTempCustomer(Map<String, String> tempInfo);
/* ======================================== by ์ด๋ฏผ์ ================================================= */
public Boolean setPassword(String id, String pw, String newPw);
/* ======================================== by ๊น์ฌ๋ฆผ ================================================= */
public String getCustomerId(HashMap<String, String> memberinfo);
public int setNewPassword(Map<String, String> jsonToMap);
public int setNewMobile(Map<String, String> jsonToMap);
public int setNewAddress(Map<String, String> jsonToMap);
public int setNewCard(Map<String, String> jsonToMap);
public int setNewAccount(Map<String, String> jsonToMap);
public Map<String, String> getUserInfo(String id);
}
| [
"ohyes0204@naver.com"
] | ohyes0204@naver.com |
41e6a5102f77fc382a0228450a64248fa64d6002 | d469656ef264835ae671b5f168b66e4fc87bab95 | /library/src/main/java/com/weslide/lovesmallscreen/utils/NetworkUtils.java | 59c2931073affcd594becd82c8985b26f72a4323 | [] | no_license | Fast0n/AixiaopingProjects | 3e79a5a95c3b00dc12848916515a8a019e4bfa81 | 42f75795c8551e6aa3f1e552f97aa96f8aa38dee | refs/heads/master | 2022-03-19T17:19:48.956737 | 2018-01-26T04:02:37 | 2018-01-26T04:02:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,907 | java | package com.weslide.lovesmallscreen.utils;
import android.app.Activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* Created by xu on 2016/5/6.
* ็ฝ็ป็ธๅ
ณ็ๅฐ่ฃ
็ฑป
*/
public class NetworkUtils {
private NetworkUtils() {
/** cannot be instantiated **/
throw new UnsupportedOperationException("cannot be instantiated");
}
/**
* ๅคๆญ็ฝ็ปๆฏๅฆ่ฟๆฅ
*
* @param context
* @return
*/
public static boolean isConnected(Context context) {
ConnectivityManager connectivity = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (null != connectivity) {
NetworkInfo info = connectivity.getActiveNetworkInfo();
if (null != info && info.isConnected()) {
if (info.getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
return false;
}
/**
* ๅคๆญๆฏๅฆๆฏwifi่ฟๆฅ
*/
public static boolean isWifi(Context context) {
ConnectivityManager cm = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
if (cm == null)
return false;
return cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI;
}
/**
* ๆๅผ็ฝ็ป่ฎพ็ฝฎ็้ข
*/
public static void openSetting(Activity activity) {
Intent intent = new Intent("/");
ComponentName cm = new ComponentName("com.android.settings",
"com.android.settings.WirelessSettings");
intent.setComponent(cm);
intent.setAction("android.intent.action.VIEW");
activity.startActivityForResult(intent, 0);
}
}
| [
"276235876@qq.com"
] | 276235876@qq.com |
d217f1c37d0dce8aae4952d69aa98cf6497f59f9 | 4536078b4070fc3143086ff48f088e2bc4b4c681 | /v1.1.2/decompiled/j/a/b/k/a.java | 9b084ef93105198bfbfe71c6bbae29c17640e4ba | [] | no_license | olealgoritme/smittestopp_src | 485b81422752c3d1e7980fbc9301f4f0e0030d16 | 52080d5b7613cb9279bc6cda5b469a5c84e34f6a | refs/heads/master | 2023-05-27T21:25:17.564334 | 2023-05-02T14:24:31 | 2023-05-02T14:24:31 | 262,846,147 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 519 | java | package j.a.b.k;
import java.lang.annotation.Annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD})
public @interface a
{
boolean value() default true;
}
/* Location:
* Qualified Name: j.a.b.k.a
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"olealgoritme@gmail.com"
] | olealgoritme@gmail.com |
8974d11cfe2d61618ef2ca62d01e27ef784d6eee | 0fb318afff1384b58bc166882efdaeddb52e3427 | /labs/2/Lab2_prob5.java | d7bbd1d483e5ff1ffb86a86193bfab3e1a657b80 | [] | no_license | samanthadimaio/cmpt220dimaio | d530dc0a61672a8bd75b5d87c003249ad396148d | b14bbad6a99069c9eddb36f7a27b795d408274be | refs/heads/master | 2021-01-13T04:30:36.939539 | 2017-05-16T00:24:11 | 2017-05-16T00:24:11 | 79,726,555 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | /**
* file: Lab2_prob5
* author: Samantha DiMaio
* course: CMPT 220
* assignment: Lab 2: Problem 4.1
* due date: February 9, 2017
* version: 1.8
*
* This file contains the program for Lab 2 - Problem 4.1: Calculate area of a pentagon
*/
import java.util.Scanner;
public class Lab2_prob5 {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter the length from the center to a vertex: ");
double radius = input.nextDouble();
double side = 2 * radius * Math.sin(Math.PI / 5);
double area = 5 * Math.pow(side, 2) / (4 * Math.tan(Math.PI / 5));
area = Math.round(area * 100) / 100.0;
System.out.println("The area of the pentagon is: " + area);
}
}
| [
"Samantha.DiMaio1@marist.edu"
] | Samantha.DiMaio1@marist.edu |
c72cf25f371215c12a4052366f074675dbb3dc79 | 651a07b4f0603c7e912d0c0954fb3f50f6350ab2 | /kodilla-hibernate/src/main/java/com/kodilla/hibernate/manytomany/Employee.java | dba343829be83d447f39e9e8f6c40106d39b5e17 | [] | no_license | adam-stan/kodilla-course | 9ad975a1c126ac9d1586ccf66e62ae6817f77edd | a15620d9022ee4a743c79af185f2bf5e2351ed6f | refs/heads/master | 2023-04-20T07:35:26.863211 | 2021-05-16T19:47:58 | 2021-05-16T19:47:58 | 299,648,285 | 0 | 1 | null | 2020-12-08T20:00:15 | 2020-09-29T14:48:16 | Java | UTF-8 | Java | false | false | 1,931 | java | package com.kodilla.hibernate.manytomany;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;
@NamedQueries({
@NamedQuery(
name = "Employee.findByLastname",
query = "FROM Employee WHERE lastname = :LASTNAME"
),
@NamedQuery(
name = "Employee.findByPartLastname",
query = "FROM Employee WHERE lastname LIKE CONCAT('%',:LASTNAME, '%')"
)
})
@Entity
@Table(name = "EMPLOYEES")
public class Employee {
private int id;
private String firstname;
private String lastname;
private List<Company> companies = new ArrayList<>();
public Employee() {
}
public Employee(String firstname, String lastname) {
this.firstname = firstname;
this.lastname = lastname;
}
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(
name = "JOIN_COMPANY_EMPLOYEE",
joinColumns = {@JoinColumn(name = "EMPLOYEE_ID", referencedColumnName = "ID")},
inverseJoinColumns = {@JoinColumn(name = "COMPANY_ID", referencedColumnName = "ID")}
)
public List<Company> getCompanies() {
return companies;
}
private void setCompanies(List<Company> companies) {
this.companies = companies;
}
@Id
@NotNull
@GeneratedValue
@Column(name = "ID", unique = true)
public int getId() {
return id;
}
private void setId(int id) {
this.id = id;
}
@NotNull
@Column(name = "FIRSTNAME")
public String getFirstname() {
return firstname;
}
private void setFirstname(String firstname) {
this.firstname = firstname;
}
@NotNull
@Column(name = "LASTNAME")
public String getLastname() {
return lastname;
}
private void setLastname(String lastname) {
this.lastname = lastname;
}
}
| [
"as1993@o2.pl"
] | as1993@o2.pl |
d122c4e0ba3fb1c94d946b9c6b6feffc1e350f1e | b6128bab2f36a008afc97520888d8f6fac2de866 | /src/test/java/com/ilidan/decorator/ComponentDecoratorTest.java | bd71685254c58f2a7e9da7f86275fc20def1122b | [] | no_license | NeverFeel/design-pattern | 5e28f3b90a840c76b40601a4d89c6de37c425b08 | d2ec9666a4d5d1acb0dea825a5981117e24019da | refs/heads/master | 2021-07-02T07:10:34.905751 | 2020-08-30T10:45:01 | 2020-08-30T10:45:01 | 154,164,888 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 568 | java | package com.ilidan.decorator;
import com.ilidan.decorator.pattern.Component;
import com.ilidan.decorator.pattern.ConcreteComponent;
import com.ilidan.decorator.pattern.ConcreteDecoratorA;
import com.ilidan.decorator.pattern.ConcreteDecoratorB;
/**
* ็ปไปถ่ฃ
้ฅฐ็ฑปๆต่ฏ
*/
public class ComponentDecoratorTest {
public static void main(String[] args) {
Component component = new ConcreteComponent();
component = new ConcreteDecoratorA(component);
component = new ConcreteDecoratorB(component);
component.operate();
}
}
| [
"smile_yangy@163.com"
] | smile_yangy@163.com |
84a37ea87d6e629f81b2ebc3c766bb823b1d3bc4 | 139960e2d7d55e71c15e6a63acb6609e142a2ace | /mobile_app1/module116/src/main/java/module116packageJava0/Foo232.java | f3a94857a6925a301dc25830e1cbaa5337469930 | [
"Apache-2.0"
] | permissive | uber-common/android-build-eval | 448bfe141b6911ad8a99268378c75217d431766f | 7723bfd0b9b1056892cef1fef02314b435b086f2 | refs/heads/master | 2023-02-18T22:25:15.121902 | 2023-02-06T19:35:34 | 2023-02-06T19:35:34 | 294,831,672 | 83 | 7 | Apache-2.0 | 2021-09-24T08:55:30 | 2020-09-11T23:27:37 | Java | UTF-8 | Java | false | false | 946 | java | package module116packageJava0;
import java.lang.Integer;
public class Foo232 {
Integer int0;
Integer int1;
Integer int2;
public void foo0() {
new module116packageJava0.Foo231().foo18();
}
public void foo1() {
foo0();
}
public void foo2() {
foo1();
}
public void foo3() {
foo2();
}
public void foo4() {
foo3();
}
public void foo5() {
foo4();
}
public void foo6() {
foo5();
}
public void foo7() {
foo6();
}
public void foo8() {
foo7();
}
public void foo9() {
foo8();
}
public void foo10() {
foo9();
}
public void foo11() {
foo10();
}
public void foo12() {
foo11();
}
public void foo13() {
foo12();
}
public void foo14() {
foo13();
}
public void foo15() {
foo14();
}
public void foo16() {
foo15();
}
public void foo17() {
foo16();
}
public void foo18() {
foo17();
}
}
| [
"oliviern@uber.com"
] | oliviern@uber.com |
a44da4ec25f958c77c5086a4a41b471296feeef7 | 01def71b7bc4173360c0a88d6afac3f70e479f33 | /campusmind/src/main/java/com/mindtree/campusmind/repository/CampusmindRepository.java | 2b1212d849f1f055e0862cb196aecdd5e996bc8d | [] | no_license | NiharSibu/javaprogram | 30f91b18db85d897c42226a63dd569560eb5c405 | 72d205451e0c61022b41c739f6ac1ffc36ce6d47 | refs/heads/master | 2022-06-28T10:57:22.353707 | 2020-01-03T04:09:08 | 2020-01-03T04:09:08 | 227,573,331 | 0 | 1 | null | 2022-06-21T02:28:57 | 2019-12-12T09:52:51 | Java | UTF-8 | Java | false | false | 457 | java | package com.mindtree.campusmind.repository;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.mindtree.campusmind.entity.CampusMind;
@Repository
public interface CampusmindRepository extends JpaRepository<CampusMind, Integer>{
@Query("from CampusMind")
List<CampusMind> getMinds();
}
| [
"M1056124@G1C2ML34691.mindtree.com"
] | M1056124@G1C2ML34691.mindtree.com |
7d182020ee4ec3e90e3e5e498728f15fd840cdf4 | 43b71c160b5891d27a1f917fb60f778fd656e228 | /systests/ws-security/src/test/java/org/apache/cxf/systest/ws/parts/Server.java | 9fd6be1569112a5acd7f2ee6e9268626e08ed62a | [
"LicenseRef-scancode-unknown",
"Apache-2.0"
] | permissive | apache/cxf | b512f24f94d3cce2c90774698240568d609c040d | 66368976c7260eefd734dd0416b00f077176459e | refs/heads/main | 2023-09-03T13:02:40.099263 | 2023-09-01T11:54:27 | 2023-09-01T11:54:27 | 16,977,479 | 923 | 1,708 | Apache-2.0 | 2023-09-14T13:16:19 | 2014-02-19T08:00:08 | Java | UTF-8 | Java | false | false | 1,483 | java | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cxf.systest.ws.parts;
import java.net.URL;
import org.apache.cxf.Bus;
import org.apache.cxf.BusFactory;
import org.apache.cxf.bus.spring.SpringBusFactory;
import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
public class Server extends AbstractBusTestServerBase {
public Server() {
}
protected void run() {
URL busFile = Server.class.getResource("server.xml");
Bus busLocal = new SpringBusFactory().createBus(busFile);
BusFactory.setDefaultBus(busLocal);
setBus(busLocal);
try {
new Server();
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"coheigea@apache.org"
] | coheigea@apache.org |
9a6a1b888a5b2056105f85d68cd4e3290177a549 | 442fe77a45b8be0740ceae4ab0eeb12ebfd34f37 | /src/main/java/HttpUtilities.java | c84859ab71656de0cab32e54a4210200809465f2 | [] | no_license | Algalu/Testid | 97e644bcf0d7fa177d5e17ab1a1222e7bb184219 | b64386ac0c1515b2c0853907a4398b99a644c28c | refs/heads/master | 2021-07-03T02:51:35.535303 | 2017-09-24T22:50:16 | 2017-09-24T22:50:16 | 104,681,645 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | import java.net.HttpURLConnection;
public class HttpUtilities {
public static HttpURLConnection makeHttpGetRequest(String requestUrl) {
return null;
}
}
| [
"noreply@github.com"
] | Algalu.noreply@github.com |
bb4dcac32d1ac0ef5da1606fc5f10847e41bc643 | 72aa1ae1f5ccb4ddcadd047c53c12610a38c1f2d | /app/src/main/java/com/peixing/carryout/ui/fragment/JudgeFragment.java | 7b453dacef818f3820def14610f4887d2240f1e4 | [] | no_license | didiaodazhong/Carryout | 2334719121518089f3f4bf6b14bbe32853eaebad | 561b6d48e0078f89b5de9aeda3be422774769330 | refs/heads/master | 2021-01-22T06:43:58.954795 | 2017-02-13T05:36:51 | 2017-02-13T05:36:51 | 81,780,406 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package com.peixing.carryout.ui.fragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.peixing.carryout.R;
/**
* A simple {@link Fragment} subclass.
*/
public class JudgeFragment extends BaseFragment {
public JudgeFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_judge, container, false);
}
}
| [
"906982564@qq.com"
] | 906982564@qq.com |
e7d055205c18114ca21934463c17bc03e4a4caec | fd02b314c1b5923c626368f772a5249a694245e9 | /src/main/java/proxy/jdk/MyInvocationHandler.java | 3167d72a87b3dd1b3b6636f214d0322ffb988117 | [] | no_license | Janche/Algorithm | 8e4d5c6155e0b0c4266ac22d007cd163cbc2f7af | 4955bb49332f3973d7048b1d5ce1287e3a590655 | refs/heads/master | 2021-11-30T09:24:37.137155 | 2021-10-07T14:54:39 | 2021-10-07T14:54:39 | 192,445,020 | 0 | 0 | null | 2021-05-22T15:48:50 | 2019-06-18T01:44:17 | Java | UTF-8 | Java | false | false | 600 | java | package proxy.jdk;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
public class MyInvocationHandler implements InvocationHandler {
private final Object target;
public MyInvocationHandler(Object target){
this.target = target;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
System.out.println("Before method :" + method.getName());
Object result = method.invoke(this.target, args);
System.out.println("After method :" + method.getName());
return result;
}
}
| [
"201215+*"
] | 201215+* |
acce1b52a8a65bd3455e578e35abd4f74d30afc7 | b31e190e7a10785243b899df76c076514b2bcfdd | /src/main/java/edu/sms/model/AdmissionStagesConfigurationForm.java | aaeaf57fac982a79f61aac5e3910cdd26900d0b4 | [] | no_license | skfbd/gyan | f97e6282109eb28c7e57a2a985f941fa681f218e | 6bdba561023030f1c8de3e367282cfefe29456bb | refs/heads/master | 2021-01-21T20:39:19.204959 | 2017-05-24T09:18:36 | 2017-05-24T09:18:36 | 92,267,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,895 | java | package edu.sms.model;
import java.util.List;
public class AdmissionStagesConfigurationForm {
Integer admissionStageId;
Integer schoolId;
String stageName;
Integer priority;
Double prospectFee;
Double testFeeForAdmission;
Boolean prospectusRequired;
Boolean smsRequired;
String smsFormat;
Boolean emailRequired;
String emailFormat;
List<String> formNames;
Boolean examApplicable;
Boolean confirmStudent;
Boolean activateFee;
Boolean admissionCriteriaApplicable;
public Integer getSchoolId() {
return schoolId;
}
public void setSchoolId(Integer schoolId) {
this.schoolId = schoolId;
}
public String getStageName() {
return stageName;
}
public void setStageName(String stageName) {
this.stageName = stageName;
}
public Integer getPriority() {
return priority;
}
public void setPriority(Integer priority) {
this.priority = priority;
}
public Double getProspectFee() {
return prospectFee;
}
public void setProspectFee(Double prospectFee) {
this.prospectFee = prospectFee;
}
public Double getTestFeeForAdmission() {
return testFeeForAdmission;
}
public void setTestFeeForAdmission(Double testFeeForAdmission) {
this.testFeeForAdmission = testFeeForAdmission;
}
public Boolean getProspectusRequired() {
return prospectusRequired;
}
public void setProspectusRequired(Boolean prospectusRequired) {
this.prospectusRequired = prospectusRequired;
}
public Boolean getSmsRequired() {
return smsRequired;
}
public void setSmsRequired(Boolean smsRequired) {
this.smsRequired = smsRequired;
}
public String getSmsFormat() {
return smsFormat;
}
public void setSmsFormat(String smsFormat) {
this.smsFormat = smsFormat;
}
public Boolean getEmailRequired() {
return emailRequired;
}
public void setEmailRequired(Boolean emailRequired) {
this.emailRequired = emailRequired;
}
public String getEmailFormat() {
return emailFormat;
}
public void setEmailFormat(String emailFormat) {
this.emailFormat = emailFormat;
}
public List<String> getFormNames() {
return formNames;
}
public void setFormNames(List<String> formNames) {
this.formNames = formNames;
}
public Boolean getExamApplicable() {
return examApplicable;
}
public void setExamApplicable(Boolean examApplicable) {
this.examApplicable = examApplicable;
}
public Boolean getConfirmStudent() {
return confirmStudent;
}
public void setConfirmStudent(Boolean confirmStudent) {
this.confirmStudent = confirmStudent;
}
public Boolean getActivateFee() {
return activateFee;
}
public void setActivateFee(Boolean activateFee) {
this.activateFee = activateFee;
}
public Boolean getAdmissionCriteriaApplicable() {
return admissionCriteriaApplicable;
}
public void setAdmissionCriteriaApplicable(Boolean admissionCriteriaApplicable) {
this.admissionCriteriaApplicable = admissionCriteriaApplicable;
}
}
| [
"Suchendra.Kumar@bcone.com"
] | Suchendra.Kumar@bcone.com |
5e7a66fb799aa36770d2dd7510cd8078166d532f | 25a0c294b506f28df95140f2855d8a79381a3137 | /src/main/java/com/trendyol/bootcamp/users/UserPool.java | d5d0ea25a61bb9cda108aad2e671c85ce8620b81 | [] | no_license | onurbalci1/seleniumTest | 8ec558b271aea68875478196c778270e5edf0210 | 58c7bea27c53394f7b6ae117b1e25d8efa3932fe | refs/heads/main | 2023-03-27T20:09:15.735943 | 2021-03-28T13:48:00 | 2021-03-28T13:48:00 | 352,341,323 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 388 | java | package com.trendyol.bootcamp.users;
public class UserPool {
public static User getUser1() {
return new User("uatbuyer23@mailinator.com", "1234qwe");
}
public static User getUser2() {
return new User("uatbuyer24@mailinator.com", "1234qwe");
}
public static User getUser3() {
return new User("uatbuyer25@mailinator.com", "1234qwe");
}
}
| [
"75702017+onurbalci1@users.noreply.github.com"
] | 75702017+onurbalci1@users.noreply.github.com |
faccb7cb5bf2e22da71be93dd1271eb19ce6d26b | 5a0021063bd564f7263bba4752ebb920f2784d26 | /src/com/iisc/year2015/Message.java | 7912b12683a1008ed5cc15c5b3c33450fcc446d3 | [] | no_license | SnapSuzun/ATConsulting | 3bc06ed0aa4028cccabb0d9e0f1cd1f1d766acb9 | 5cc40b2ef6515feba37659e7c2d115aef945918b | refs/heads/master | 2021-01-10T15:42:58.677760 | 2016-01-10T11:21:39 | 2016-01-10T11:21:39 | 45,835,034 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,884 | java | package com.iisc.year2015;
import org.dom4j.Element;
import java.util.Date;
/**
* Created by Snap on 23.11.2015.
*/
public class Message {
String sName;
String sCode;
Date currentDate;
public Message(String senderName, String senderCode){
sName = senderName;
sCode = senderCode;
currentDate = new Date();
}
public void generateMessage(Element getDictionary){
Element message = getDictionary.addElement("smev:Message");
Element sender = message.addElement("smev:Sender");
Element code = sender.addElement("smev:Code")
.addText("IPGU01541");
Element name = sender.addElement("smev:Name")
.addText("EPGU");
Element recipient = message.addElement("smev:Recipient");
code = recipient.addElement("smev:Code")
.addText("000000541");
name = recipient.addElement("smev:Name")
.addText("ATC System");
Element originator = message.addElement("smev:Originator");
code = originator.addElement("smev:Code")
.addText("IPGU01541");
name = originator.addElement("smev:Name")
.addText("EPGU");
Element typeCode = message.addElement("smev:TypeCode")
.addText("GSRV");
Element status = message.addElement("smev:Status")
.addText("REQUEST");
Element date = message.addElement("smev:Date")
.addText("2000-01-01T00:00:00");
Element exchangeType = message.addElement("smev:ExchangeType")
.addText("1");
Element serviceCode = message.addElement("smev:ServiceCode")
.addText("5440100010000545045");
Element caseNumber = message.addElement("smev:CaseNumber")
.addText("70263950");
}
}
| [
"nevzorovgosha@mail.ru"
] | nevzorovgosha@mail.ru |
f1841cecda89dd7b6650090a700b894190614bba | 98d313cf373073d65f14b4870032e16e7d5466f0 | /gradle-open-labs/example/src/main/java/se/molybden/Class12812.java | a86f4c057ccdaa0b32b0b90776252b7d9e297cd9 | [] | no_license | Molybden/gradle-in-practice | 30ac1477cc248a90c50949791028bc1cb7104b28 | d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3 | refs/heads/master | 2021-06-26T16:45:54.018388 | 2016-03-06T20:19:43 | 2016-03-06T20:19:43 | 24,554,562 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 110 | java |
public class Class12812{
public void callMe(){
System.out.println("called");
}
}
| [
"jocce.nilsson@gmail.com"
] | jocce.nilsson@gmail.com |
b56c099c32070bbe3e420487ca2b8795f154e6ad | 57df8d9994e2e054ebcd0d84e82831c2494928ea | /microbat_instrumentator/src/main/microbat/instrumentation/output/OutputReader.java | 62b1f69b78da4df0bb092e6034337190f5934979 | [] | no_license | llmhyy/microbat | 10a3a08e624e88b19ce38f752528c0f775f97f0a | 59f305f72978b31dc04a89f5a30d63e4603ff411 | refs/heads/master | 2023-09-04T08:16:40.701802 | 2023-06-18T12:07:22 | 2023-06-18T12:07:22 | 59,279,848 | 51 | 10 | null | 2023-09-02T07:51:24 | 2016-05-20T08:55:07 | Java | UTF-8 | Java | false | false | 2,866 | java | package microbat.instrumentation.output;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class OutputReader extends DataInputStream {
public OutputReader(InputStream in) {
super(in);
}
public String readString() throws IOException {
int len = readVarInt();
if (len == -1) {
return null;
} else if (len == 0) {
return "";
} else {
byte[] bytes = new byte[len];
readFully(bytes);
return new String(bytes);
}
}
public byte[] readByteArray() throws IOException {
int len = readVarInt();
if (len == -1) {
return null;
} else if (len == 0) {
return new byte[0];
} else {
byte[] bytes = new byte[len];
readFully(bytes);
return bytes;
}
}
public int readVarInt() throws IOException {
final int value = 0xFF & readByte();
if ((value & 0x80) == 0) {
return value;
}
return (value & 0x7F) | (readVarInt() << 7);
}
public List<Integer> readListInt() throws IOException {
int size = readVarInt();
if (size == -1) {
return null;
}
List<Integer> list = new ArrayList<Integer>(size);
for (int i = 0; i < size; i++) {
list.add(readVarInt());
}
return list;
}
public List<String> readListString() throws IOException {
int size = readVarInt();
if (size == -1) {
return null;
}
List<String> list = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
list.add(readString());
}
return list;
}
@SuppressWarnings("unchecked")
protected <T> T readSerializableObj() throws IOException {
byte[] bytes = readByteArray();
if (bytes == null || bytes.length == 0) {
return null;
}
try {
return (T) ByteConverter.convertFromBytes(bytes);
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
}
@SuppressWarnings("unchecked")
protected <T>List<T> readSerializableList() throws IOException {
int size = readVarInt();
if (size == 0) {
return new ArrayList<>(0);
}
byte[] bytes = readByteArray();
if (bytes == null || bytes.length == 0) {
return new ArrayList<>(0);
}
List<T> list;
try {
list = (List<T>) ByteConverter.convertFromBytes(bytes);
} catch (ClassNotFoundException e) {
e.printStackTrace();
throw new IOException(e);
}
return list;
}
@SuppressWarnings("unchecked")
protected <K, V>Map<K, V> readSerializableMap() throws IOException {
int size = readVarInt();
if (size == 0) {
return new HashMap<>();
}
byte[] bytes = readByteArray();
if (bytes == null || bytes.length == 0) {
return new HashMap<>();
}
Map<K, V> map;
try {
map = (Map<K, V>) ByteConverter.convertFromBytes(bytes);
} catch (ClassNotFoundException e) {
e.printStackTrace();
throw new IOException(e);
}
return map;
}
}
| [
"lylypp6987@gmail.com"
] | lylypp6987@gmail.com |
79c0cd4d910237d52e62e413d02153fbe2213e56 | 0c797931a761dc9dbd474d3bc5b337a856dca39e | /turnserver/org/jitsi/turnserver/stack/TurnClientTransaction.java | ba41e8200794340fe4f0ab25122ee132d0a5e754 | [] | no_license | groupsell/nat_turnserver_ice4j | e35db15747532a3a7c5f921459b1454668a02a7d | 7ccb8e0d24e41a0a60b789ebf3167454d4d6fa52 | refs/heads/master | 2020-05-10T00:01:24.073257 | 2019-04-15T16:04:26 | 2019-04-15T16:04:26 | 181,518,073 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,246 | java | /*
* TurnServer, the OpenSource Java Solution for TURN protocol. Maintained by the
* Jitsi community (http://jitsi.org).
*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jitsi.turnserver.stack;
import org.ice4j.ResponseCollector;
import org.ice4j.StunMessageEvent;
import org.ice4j.TransportAddress;
import org.ice4j.message.Request;
import org.ice4j.stack.*;
/**
* {@inheritDoc}
*/
public class TurnClientTransaction
extends StunClientTransaction
{
/**
* {@inheritDoc}
*/
public TurnClientTransaction( StunStack stackCallback,
Request request,
TransportAddress requestDestination,
TransportAddress localAddress,
ResponseCollector responseCollector,
TransactionID transactionID)
{
super(stackCallback, request, requestDestination, localAddress,
responseCollector, transactionID);
}
/**
* /** {@inheritDoc}
*/
public TurnClientTransaction( StunStack stackCallback,
Request request,
TransportAddress requestDestination,
TransportAddress localAddress,
ResponseCollector responseCollector)
{
super(stackCallback, request, requestDestination, localAddress,
responseCollector);
}
/**
* {@inheritDoc}
*/
@Override
public synchronized void handleResponse(StunMessageEvent evt)
{
super.handleResponse(evt);
}
}
| [
"174662266@anyec"
] | 174662266@anyec |
106a3397271a3ee928bb3277cfff1c89b42bc44d | e26ba1044e2596837d0590bef86a6c8c95099ae8 | /Day.java | e413a0745b7c538d236da18772f09dd98e8170fe | [] | no_license | GitHubForRichard/ElCalendar | 1a23dc8b622b38f791f2d2248361b763078ccb0e | 49800d9f2bb3095173d887a2bfc0e53bbfb51190 | refs/heads/master | 2021-01-23T05:51:04.413552 | 2018-04-30T03:06:29 | 2018-04-30T03:06:29 | 92,995,898 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,921 | java |
import java.awt.Component;
import java.awt.Graphics;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import javax.swing.Icon;
/**
*
* @author aldonut
* class makes day obj which holds day
* and events within the day
*
*/
public class Day implements Comparable<Day>
{
private String date;
private ArrayList<Event> events;
private int eventCount = 0;
private int[] arrDate = new int[3];
private int[] timeConflict = new int[96];
/**
*
* @param day string representation of current day
*/
public Day(String date)
{
events = new ArrayList<>();
this.date = date;
setArrDate();
}
/**
*
* @return string rep of this day
*/
public String getDate()
{
return date;
}
/**
*
* @param day to compare
* @return true/false depending on if they're equal
*/
public boolean equals(Day day)
{
if(this.getDate().equals(day.getDate()))
return true;
return false;
}
/**
*
* @param event event to be added to arraylist
*/
public void addEvent(Event event)
{
events.add(event);
eventCount++;
}
/**
*
* @return int rep of month of date
*/
public int getMonth()
{
return arrDate[0];
}
/**
*
* @return in rep of day of date
*/
public int getDay()
{
return arrDate[1];
}
/**
*
* @return int rep of year of date
*/
public int getYear()
{
return arrDate[2];
}
/**
*
* @return returns amount of events in current day
*/
public int getEventCount()
{
return eventCount;
}
/**
* prints out all the events in this day
*/
public void returnEventList()
{
Collections.sort(events);
for(Event current: events)
{
System.out.println(current.toString());
}
}
/**
* turns a strings rep into arr rep of date
* in order to compare
*/
public void setArrDate()
{
String strMonth = date.substring(0, 2);
String strDay = date.substring(3, 5);
String strYear = date.substring(6, 10);
int intMonth = Integer.parseInt(strMonth);
int intDay = Integer.parseInt(strDay);
int intYear = Integer.parseInt(strYear);
arrDate[0] = intMonth;
arrDate[1] = intDay;
arrDate[2] = intYear;
}
/**
* @return returns negative num is o is after
* @param o the day being compared
* returns positive num if o is before
* returns zero if they're equal
*/
public int compareTo(Day o)
{
if(this.getYear() == o.getYear())
{
if(this.getMonth() == o.getMonth())
{
return this.getDay() - o.getDay();
}
else
{
return this.getMonth() - o.getMonth();
}
}
else
{
return this.getYear() - o.getYear();
}
}
/**
* @return string rep of date
*/
public String toString()
{
return date;
}
/**
* sorts the events within day
*/
public void sort()
{
Collections.sort(events);
}
public ArrayList<Event> getEventsArr()
{
return events;
}
}
| [
"richard14942003@gmail.com"
] | richard14942003@gmail.com |
7c5531df0f4f906e7ed1a006dd7b8f3116fe31f8 | cf44a08e214f92ef0ee12249ad199cf79cefaed5 | /helloworld/src/Day08/Demo01/Demo01String.java | 2a00fdb2990f7847c3cea02be07f893442a59cb1 | [] | no_license | xwhsb/repo2 | 5f3d30287d823ad415ea5983e9009b45e031966c | 2f2f1b129a1acc0a63614c5a4478a54557118c80 | refs/heads/master | 2021-04-13T09:48:19.811835 | 2020-03-22T09:49:03 | 2020-03-22T09:49:03 | 249,153,115 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 928 | java | package Day08.Demo01;
/*
ๅญ็ฌฆไธฒๆฏๅธธ้๏ผ็จไธๅฏๅ๏ผ
ๅญ็ฌฆไธฒๅฏไปฅๅ
ฑไบซไฝฟ็จ๏ผ
ๅญ็ฌฆไธฒๆๆไธ็ธๅฝไบchar[]ๅญ็ฌฆๆฐ็ป๏ผๅบๅฑๅ็ๆฏbyte[]ๅญ่ๆฐ็ป
ๅๅปบๅญ็ฌฆไธฒ็3+1็งๆนๅผ๏ผ
ไธ็งๆ้ ๆนๆณ๏ผ
public String() // ๅๅปบ็ฉบ็ฝๅญ็ฌฆไธฒ๏ผไธไผๆไปปไฝๅ
ๅฎน
public String(char[] array) //ๆ นๆฎๅญ็ฌฆๆฐ็ปๅ
ๅฎน๏ผๆฅๅๅปบๅฏนๅบ็ๅญ็ฌฆไธฒ
public String(byte[] array) //ๆ นๆฎๅญ่ๆฐ็ปๅ
ๅฎน๏ผๆฅๅๅปบๅฏนๅบ็ๅญ็ฌฆไธฒ
ไธ็ง็ดๆฅๅๅปบ
*/
public class Demo01String {
public static void main(String[] args) {
String str1 = new String(); //ๅฐๆฌๅท็็ฉบ๏ผ่ฏดๆไปไนๅ
ๅฎน้ฝๆฒกๆ
System.out.println(str1);
char[] charArray = {'A', 'B', 'C'};
String str2 = new String(charArray);
System.out.println(str2);
byte[] byteArray = {};
String str3 = new String(byteArray);
System.out.println(str3);
}
}
| [
"xwhsb@126.com"
] | xwhsb@126.com |
fdff74dd099695f068700800208046bf33b0bffa | 4698c948350845646d79b755f0e415e609fb7d6c | /videotest/src/main/java/html5/StartUp.java | 5488ec1c5e6e5b458ab427f6fc0ce3f9ffb68673 | [] | no_license | linsonzhao/2015S1-ForTest | b8d29abc432c79eddf6cdc2ab6f99bce146b6b4f | 86bd23c0a1189da9dad1a5b263afae48c7fa0d8a | refs/heads/master | 2022-07-12T13:22:42.716712 | 2015-04-03T08:02:17 | 2015-04-03T08:02:17 | 33,272,920 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,356 | java | package html5;
import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class StartUp
*/
public class StartUp extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public StartUp() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see Servlet#init(ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
// System.out.println("starting up....");
// ClientServiceThread service = new ClientServiceThread();
// service.run();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
| [
"linson.zhao@hotmail.com"
] | linson.zhao@hotmail.com |
c7cf10da14ef9a5ce2dbd4441838f6c1d04eaac5 | 21e8bc5d698a7ae48bf74f2e49fcdcbb79635893 | /src/am/ik/aws/apa/jaxws/SimilarityLookupResponse.java | 1a61e5d833d7629cf0577b25048ca6e929951387 | [] | no_license | data-enrcihment-project/data_enrichment_final | 5f621417aef14f7c04a949fa6318ec5dd9ef1d97 | 99babaf45d9f63586c822cb1940f4550ed6a2419 | refs/heads/master | 2020-03-22T03:50:07.588178 | 2018-08-03T12:06:18 | 2018-08-03T12:06:18 | 133,977,187 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,276 | java | /*
* Copyright (C) 2011 Toshiaki Maki <makingx@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package am.ik.aws.apa.jaxws;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>
* Java class for anonymous complex type.
*
* <p>
* The following schema fragment specifies the expected content contained within
* this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://webservices.amazon.com/AWSECommerceService/2011-08-01}OperationRequest" minOccurs="0"/>
* <element ref="{http://webservices.amazon.com/AWSECommerceService/2011-08-01}Items" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = { "operationRequest", "items" })
@XmlRootElement(name = "SimilarityLookupResponse")
public class SimilarityLookupResponse {
@XmlElement(name = "OperationRequest")
protected OperationRequest operationRequest;
@XmlElement(name = "Items")
protected List<Items> items;
/**
* Gets the value of the operationRequest property.
*
* @return possible object is {@link OperationRequest }
*
*/
public OperationRequest getOperationRequest() {
return operationRequest;
}
/**
* Sets the value of the operationRequest property.
*
* @param value
* allowed object is {@link OperationRequest }
*
*/
public void setOperationRequest(OperationRequest value) {
this.operationRequest = value;
}
/**
* Gets the value of the items property.
*
* <p>
* This accessor method returns a reference to the live list, not a
* snapshot. Therefore any modification you make to the returned list will
* be present inside the JAXB object. This is why there is not a
* <CODE>set</CODE> method for the items property.
*
* <p>
* For example, to add a new item, do as follows:
*
* <pre>
* getItems().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list {@link Items }
*
*
*/
public List<Items> getItems() {
if (items == null) {
items = new ArrayList<Items>();
}
return this.items;
}
}
| [
"virgo@Aamir-TIGER"
] | virgo@Aamir-TIGER |
160e60a9916948568dbc730b35af7005d992665f | 819ebd7c46638fc0c97d25bd4b25f8d3e8727f07 | /src/test/java/org/fxmisc/cssfx/test/ui/UILauncher.java | cf4cd3d4374e861e4080e2de81763dba0798b234 | [
"Apache-2.0"
] | permissive | FlorianKirmaier/cssfx | 9209805bfbd6f03fdf8217fb194d2b114d628ea8 | d60f4ece4082868b5ef5ecc7ec0d79380c149c31 | refs/heads/master | 2023-01-27T14:49:28.108847 | 2019-04-17T16:19:50 | 2019-04-17T16:19:50 | 181,869,298 | 0 | 0 | Apache-2.0 | 2019-04-17T10:30:29 | 2019-04-17T10:30:29 | null | UTF-8 | Java | false | false | 2,939 | java | package org.fxmisc.cssfx.test.ui;
/*
* #%L
* CSSFX
* %%
* Copyright (C) 2014 CSSFX by Matthieu Brouillard
* %%
* 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.
* #L%
*/
import java.lang.reflect.Method;
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.ObjectBinding;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.stage.Stage;
public class UILauncher extends Application {
@Override
public void start(Stage stage) throws Exception {
Parent p = buildPane();
Scene s = new Scene(p, 800, 600);
stage.setScene(s);
stage.show();
}
private Parent buildPane() {
BorderPane bp = new BorderPane();
HBox toolbar = new HBox(10.0);
TextField tfTestClass = new TextField();
Button btnLoad = new Button("Load");
toolbar.getChildren().addAll(tfTestClass, btnLoad);
HBox.setHgrow(tfTestClass, Priority.ALWAYS);
// org.fxmisc.cssfx.test.ui.BasicUI
ObjectBinding<Class<TestableUI>> tfClass = Bindings.createObjectBinding(() -> {
String tfClassName = tfTestClass.getText();
try {
@SuppressWarnings("unchecked")
Class<TestableUI> cl = (Class<TestableUI>) Class.forName(tfClassName);
return cl;
} catch(ClassNotFoundException ignore) {
} catch (Exception ignore) {
ignore.printStackTrace();
}
return null;
}, tfTestClass.textProperty());
btnLoad.disableProperty().bind(tfClass.isNull());
btnLoad.setOnAction(ae -> {
try {
TestableUI guiTest = tfClass.get().newInstance();
Method m = guiTest.getClass().getMethod("getRootNode");
m.setAccessible(true);
Parent guiTestNode = (Parent) m.invoke(guiTest);
bp.setCenter(guiTestNode);
} catch (Exception e) {
e.printStackTrace();
}
});
bp.setTop(toolbar);
return bp;
}
public static void main(String[] args) {
launch(args);
}
}
| [
"matthieu@brouillard.fr"
] | matthieu@brouillard.fr |
cb1034c5f1b25ad5b9f997775960d11f4c4b5b03 | ee85791b982814c24f294b1cac57b77bf3efdba1 | /src/test/java/com/codingcuriosity/project/simplehomeiot/logs/repository/ControllerLogRepositoryImplTest.java | 1a565f2cecf930c4ffd323f25835b6a38d3d552e | [
"MIT"
] | permissive | lcabahug/simplehomeiot | c9718241b5045d42db5e7e26c3a62dbebd012371 | 06faedcb61fe47aae5fdaa45e58e2fa3541f2878 | refs/heads/main | 2023-01-09T13:23:44.223720 | 2020-11-16T15:53:13 | 2020-11-16T15:53:13 | 302,362,107 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,837 | java | package com.codingcuriosity.project.simplehomeiot.logs.repository;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.codingcuriosity.project.simplehomeiot.common.repository.RepoKey;
import com.codingcuriosity.project.simplehomeiot.logs.model.ControllerLogInfo;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
@SpringBootTest
public class ControllerLogRepositoryImplTest {
RedisTemplate<String, ControllerLogInfo> redisTemplate;
HashOperations<String, UUID, ControllerLogInfo> hashOperationsMock;
ControllerLogRepository logRepository;
RepoKey expectedKey = RepoKey.LOGS_CONTROLLER;
private Map<UUID, ControllerLogInfo> createObjMap(ControllerLogInfo... logInfos) {
Map<UUID, ControllerLogInfo> logMap = new HashMap<>();
for (ControllerLogInfo logInfo : logInfos) {
logMap.put(logInfo.getLogId(), logInfo);
}
return logMap;
}
@SuppressWarnings("unchecked")
@BeforeEach
void setMocksAndInitRepo() {
this.redisTemplate = mock(RedisTemplate.class);
this.hashOperationsMock = mock(HashOperations.class);
doReturn(this.hashOperationsMock).when(this.redisTemplate).opsForHash();
this.logRepository = new ControllerLogRepositoryImpl(this.redisTemplate);
}
@Test
@DisplayName("TEST getKey")
void testGetKey() {
// Call method
RepoKey key = this.logRepository.getKey();
// Validate
assertEquals(this.expectedKey, key, "Repo Key must match");
}
@Test
@DisplayName("TEST findAll")
void testFindAll() {
UUID log1id = UUID.fromString("4f895f64-0314-0111-032c-2b963f789af1");
UUID log2id = UUID.fromString("5b895f64-5147-4222-b3fc-48963f50ace2");
ControllerLogInfo log1 = new ControllerLogInfo().logId(log1id);
ControllerLogInfo log2 = new ControllerLogInfo().logId(log2id);
Map<UUID, ControllerLogInfo> logMap = createObjMap(log1, log2);
// Mock(s)
when(this.hashOperationsMock.entries(eq(this.expectedKey.name()))).thenReturn(logMap);
// Argument Captors
ArgumentCaptor<String> arg1 = ArgumentCaptor.forClass(String.class);
// Call method
Map<UUID, ControllerLogInfo> resp = this.logRepository.findAll();
// Verify that appropriate Redis' method was called
verify(this.hashOperationsMock, times(1)).entries(arg1.capture());
// Assertions
assertEquals(this.expectedKey.name(), arg1.getValue(), "Argument must match.");
assertNotNull(resp, "Return object is not null.");
assertEquals(logMap, resp, "Returned object must match.");
}
@Test
@DisplayName("TEST findById")
void testFindById() {
UUID log1id = UUID.fromString("4f895f64-0314-0111-032c-2b963f789af1");
UUID log2id = UUID.fromString("5b895f64-5147-4222-b3fc-48963f50ace2");
UUID log3id = UUID.fromString("2a895f64-842b-3333-9990-6c963f1b3bd3");
ControllerLogInfo log1 = new ControllerLogInfo().logId(log1id);
ControllerLogInfo log2 = new ControllerLogInfo().logId(log2id);
ControllerLogInfo log3 = new ControllerLogInfo().logId(log3id);
// Mock(s)
when(this.hashOperationsMock.get(eq(this.expectedKey.name()), eq(log1id))).thenReturn(log1);
when(this.hashOperationsMock.get(eq(this.expectedKey.name()), eq(log2id))).thenReturn(log2);
when(this.hashOperationsMock.get(eq(this.expectedKey.name()), eq(log3id))).thenReturn(log3);
// Argument Captors
ArgumentCaptor<String> arg1 = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<UUID> arg2 = ArgumentCaptor.forClass(UUID.class);
// Call method (round 1)
ControllerLogInfo retObj = this.logRepository.findById(log1id);
// Verify that appropriate Redis' method was called
verify(this.hashOperationsMock, times(1)).get(arg1.capture(), arg2.capture());
// Assertions (round 1)
assertEquals(this.expectedKey.name(), arg1.getValue(), "Argument must match.");
assertEquals(log1id, arg2.getValue(), "Argument must match.");
assertNotNull(retObj, "Response must not be null.");
assertEquals(log1, retObj, "Returned object must match.");
// Call method (round 2)
retObj = this.logRepository.findById(log2id);
// Assertions (round 2)
assertNotNull(retObj, "Response must not be null.");
assertEquals(log2, retObj, "Returned object must match.");
// Call method (round 3)
retObj = this.logRepository.findById(log3id);
// Assertions (round 3)
assertNotNull(retObj, "Response must not be null.");
assertEquals(log3, retObj, "Returned object must match.");
}
@Test
@DisplayName("TEST add")
void testAdd() {
UUID log1id = UUID.fromString("4f895f64-0314-0111-032c-2b963f789af1");
ControllerLogInfo log1 = new ControllerLogInfo().logId(log1id);
// Argument Captors
ArgumentCaptor<String> arg1 = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<UUID> arg2 = ArgumentCaptor.forClass(UUID.class);
ArgumentCaptor<ControllerLogInfo> arg3 = ArgumentCaptor.forClass(ControllerLogInfo.class);
// Call method
this.logRepository.add(log1);
// Verify that appropriate Redis' method was called
verify(this.hashOperationsMock, times(1)).put(arg1.capture(), arg2.capture(), arg3.capture());
// Assertions
assertEquals(this.expectedKey.name(), arg1.getValue(), "Argument must match.");
assertEquals(log1id, arg2.getValue(), "Argument must match.");
assertEquals(log1, arg3.getValue(), "Argument must match.");
}
@Test
@DisplayName("TEST update")
void testUpdate() {
UUID log1id = UUID.fromString("4f895f64-0314-0111-032c-2b963f789af1");
UUID log2id = UUID.fromString("5b895f64-5147-4222-b3fc-48963f50ace2");
ControllerLogInfo log1 = new ControllerLogInfo().logId(log1id);
// Argument Captors
ArgumentCaptor<String> arg1 = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<UUID> arg2 = ArgumentCaptor.forClass(UUID.class);
ArgumentCaptor<ControllerLogInfo> arg3 = ArgumentCaptor.forClass(ControllerLogInfo.class);
// Call method
this.logRepository.update(log2id, log1);
// Verify that appropriate Redis' method was called
verify(this.hashOperationsMock, times(1)).put(arg1.capture(), arg2.capture(), arg3.capture());
// Assertions
assertEquals(this.expectedKey.name(), arg1.getValue(), "Argument must match.");
assertEquals(log2id, arg2.getValue(), "Argument must match.");
assertEquals(log1, arg3.getValue(), "Argument must match.");
}
@Test
@DisplayName("TEST delete")
void testDelete() {
UUID log1id = UUID.fromString("4f895f64-0314-0111-032c-2b963f789af1");
// Argument Captors
ArgumentCaptor<String> arg1 = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<UUID> arg2 = ArgumentCaptor.forClass(UUID.class);
ArgumentCaptor<String> arg3 = ArgumentCaptor.forClass(String.class);
// Call method
this.logRepository.delete(log1id);
// Verify that appropriate Redis' method was called
verify(this.hashOperationsMock, times(1)).delete(arg1.capture(), arg2.capture());
// Verify that appropriate Redis' method was NOT called
verify(this.redisTemplate, times(0)).delete(arg3.capture());
// Assertions
assertEquals(this.expectedKey.name(), arg1.getValue(), "Argument must match.");
assertEquals(log1id, arg2.getValue(), "Argument must match.");
}
@Test
@DisplayName("TEST deleteAll")
void testDeleteAll() {
// Argument Captors
ArgumentCaptor<String> arg1 = ArgumentCaptor.forClass(String.class);
ArgumentCaptor<UUID> arg2 = ArgumentCaptor.forClass(UUID.class);
ArgumentCaptor<String> arg3 = ArgumentCaptor.forClass(String.class);
// Call method
this.logRepository.deleteAll();
// Verify that appropriate Redis' method was NOT called
verify(this.hashOperationsMock, times(0)).delete(arg1.capture(), arg2.capture());
// Verify that appropriate Redis' method was called
verify(this.redisTemplate, times(1)).delete(arg3.capture());
// Assertions
assertEquals(this.expectedKey.name(), arg3.getValue(), "Argument must match.");
}
}
| [
"leil.jan@gmail.com"
] | leil.jan@gmail.com |
96b404406286702033c31d5cb913d51b4d75f2b0 | 6ae47e53ba9043cd177982be0e38604491665667 | /src/main/java/PDP/SimpleRepair.java | f257e1ce7f6625f69ea96e14a0415c826c8b8831 | [] | no_license | vidalfontoura/hypdp | 562f8a53ab57a5927a36a1943ceed7e3f427c10a | 2be9b8e523f7b12f768b7c8d6ee26e2fea39fe64 | refs/heads/master | 2021-01-17T02:48:44.868835 | 2016-08-30T18:16:56 | 2016-08-30T18:16:56 | 57,252,233 | 2 | 0 | null | 2016-09-19T20:23:15 | 2016-04-27T22:11:18 | Java | UTF-8 | Java | false | false | 4,066 | java | /*
* Copyright 2016, Charter Communications, All rights reserved.
*/
package PDP;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import PDP.fitness.Residue.Point;
/**
*
*
* @author vfontoura
*/
public class SimpleRepair {
private int upperBound;
private Random rng;
public SimpleRepair(int upperBound, Random rng) {
this.upperBound = upperBound;
this.rng = rng;
}
public int[] repairSolution(String chain, int[] solution) {
int[] repairedSolution = Arrays.copyOf(solution, solution.length);
Set<Point> points = new HashSet<>();
int x = 0, y = 0;
int direction = 1;
Point firstPoint = new Point(x, y);
setNewPoint(points, firstPoint);
if (chain.length() >= 2 && repairedSolution.length == chain.length() - 2) {
x++;
Point secondPoint = new Point(x, y);
setNewPoint(points, secondPoint);
for (int i = 0; i < repairedSolution.length; i++) {
int step = repairedSolution[i];
int[] directions = getDirections(direction, step, x, y);
Point newPoint = new Point(directions[1], directions[2]);
boolean added = setNewPoint(points, newPoint);
List<Integer> movesUnvisited = new ArrayList<>();
movesUnvisited.add(0);
movesUnvisited.add(1);
movesUnvisited.add(2);
while (!added) {
// TODO: CHeck this code
if (movesUnvisited.size() == 0) {
break;
}
do {
step = this.rng.nextInt(this.upperBound);
} while (!movesUnvisited.contains(step));
movesUnvisited.remove(movesUnvisited.indexOf(step));
directions = getDirections(direction, step, x, y);
newPoint = new Point(directions[1], directions[2]);
added = setNewPoint(points, newPoint);
if (added) {
repairedSolution[i] = step;
break;
}
}
x = directions[1];
y = directions[2];
direction = directions[0];
}
}
return repairedSolution;
}
private boolean setNewPoint(Set<Point> points, Point newPoint) {
boolean ret = points.add(newPoint);
if (ret) {
points.add(newPoint);
}
return ret;
}
private int[] getDirections(int direction, int step, int x, int y) {
switch (direction) {
case 0:// LOOKING UP
switch (step) {
case 0:
x--;
direction = 3;
break;
case 1:
y++;
direction = 0;
break;
case 2:
x++;
direction = 1;
break;
default:
System.err.println("A invalid movement was provided: " + step);
System.exit(1);
}
break;
case 1:// LOOKING FORWARD
switch (step) {
case 0:
y++;
direction = 0;
break;
case 1:
x++;
direction = 1;
break;
case 2:
y--;
direction = 2;
break;
default:
System.err.println("A invalid movement was provided: " + step);
System.exit(1);
}
break;
case 2:// LOOKING DOWN
switch (step) {
case 0:
x++;
direction = 1;
break;
case 1:
y--;
direction = 2;
break;
case 2:
x--;
direction = 3;
break;
default:
System.err.println("A invalid movement was provided: " + step);
System.exit(1);
}
break;
case 3:// LOOKING BACK
switch (step) {
case 0:
y--;
direction = 2;
break;
case 1:
x--;
direction = 3;
break;
case 2:
y++;
direction = 0;
break;
default:
System.err.println("A invalid movement was provided: " + step);
System.exit(1);
}
break;
default:
break;
}
return new int[] { direction, x, y };
}
public static void main(String[] args) {
String aminoAcidSequence = "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH";
int[] solution = new int[] { 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 1, 0, 1, 0, 0, 1, 0, 1, 1, 2, 2, 2, 1, 2,
2 };
System.out.println(Arrays.toString(solution).replace(" ", ""));
SimpleRepair simpleRepair = new SimpleRepair(3, new Random());
int[] repairedSolution = simpleRepair.repairSolution(aminoAcidSequence, solution);
System.out.println(Arrays.toString(repairedSolution).replace(" ", ""));
}
}
| [
"vfontoura@kenzan.com"
] | vfontoura@kenzan.com |
e3a479272b5a7934ebb1d3efffa3fc3c35f0ffc5 | f253632c5424df7a0aa105256db6fca040e79d62 | /test-client/src/main/java/com/vmware/vchs/test/client/db/MsSqlDaoFactory.java | ca0c44713da10bc54dca411a7fce7a9ae5c2edf2 | [] | no_license | sripadapavan/cloud-testing | 6315bbdd3e79972fb5330200b08310a4438e7af2 | 275e6c15b764b477ad3b7e0adee8c1206a2250cc | refs/heads/master | 2021-01-24T04:54:54.931358 | 2015-10-23T06:32:50 | 2015-10-23T06:32:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 394 | java | /*
* ******************************************************
* Copyright VMware, Inc. 2014. All Rights Reserved.
* ******************************************************
*/
package com.vmware.vchs.test.client.db;
/**
* @author liuda
*/
public interface MsSqlDaoFactory {
EmployeeDao createEmployeeDao();
SysDao createSysDao();
MsSqlDataLoader createMsSqlDataLoader();
}
| [
"georgeliu@vmware.com"
] | georgeliu@vmware.com |
979e31f37e847f1af771b1367d843f87a9c47da8 | b03145d5d9844f9d85d2864213b1d2ec7a10ded5 | /src/main/java/com/buta/totalusers/service/count/universities/UniversityCountService.java | f23cd610f50c52b8599b3923b99b3192fcf3f534 | [] | no_license | GShahrza/vtpBack | 1a8c20e93db01d31e8fa53786b9fe143dc84885b | d627e51717247a2eb5dda1c9aa7bcf39159393e5 | refs/heads/master | 2023-06-02T20:17:42.203818 | 2021-06-16T09:57:59 | 2021-06-16T09:57:59 | 377,234,004 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,759 | java | package com.buta.totalusers.service.count.universities;
import com.buta.totalusers.data.countData.universitites.UniversityCount;
import com.buta.totalusers.repository.count.universities.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class UniversityCountService {
@Autowired
private UnecCountRepository unecCountRepository;
@Autowired
private BduCountRepository bduCountRepository;
@Autowired
private BmuCountRepository bmuCountRepository;
@Autowired
private AdaCountRepository adaCountRepository;
@Autowired
private AdnsuCountRepository adnsuCountRepository;
@Autowired
private KhazarCountRepository khazarCountRepository;
@Autowired
private UfazCountRepository ufazCountRepository;
@Autowired
private UniversityCount count;
public UniversityCount getUniversityCount(){
changeObject(
unecCountRepository.findUnecCount(),
bduCountRepository.findBduCount(),
bmuCountRepository.findBmuCount(),
adaCountRepository.findAdaCount(),
adnsuCountRepository.findAdnsuCount(),
khazarCountRepository.findKhazarCount(),
ufazCountRepository.findUfazCount()
);
return count;
}
private void changeObject(Integer unec,Integer bdu,Integer bmu,Integer ada,Integer adnsu,Integer khazar,Integer ufaz){
count = UniversityCount.builder()
.ada(ada)
.adnsu(adnsu)
.bdu(bdu)
.bmu(bmu)
.unec(unec)
.khazar(khazar)
.ufaz(ufaz)
.build();
}
}
| [
"gshahrza@gmail.com"
] | gshahrza@gmail.com |
87484c11fc119fbcb75eaa83893c95297156ea0a | a4608f3539829907cc0292171d7bec49138954f9 | /src/main/java/com/example/techassessment/service/ArticleServiceImpl.java | 1481d20c53159e17aeb0e0aa0002c87a63e45739 | [] | no_license | nateha1984/vds-tech-assessment | 1b850abd223b52f63c9176bfdab419f4360ed22e | 9d2b7a4feff624406b18f812f094cf90de91ffe1 | refs/heads/master | 2022-05-09T21:36:48.823074 | 2020-04-21T21:39:26 | 2020-04-21T21:39:26 | 257,428,680 | 0 | 1 | null | 2020-04-21T00:01:37 | 2020-04-20T23:31:41 | Java | UTF-8 | Java | false | false | 2,599 | java | package com.example.techassessment.service;
import java.util.List;
import java.util.stream.Collectors;
import com.example.techassessment.exception.NotFoundException;
import com.example.techassessment.model.Article;
import com.example.techassessment.model.Section;
import com.example.techassessment.repository.ArticlesRepository;
import org.springframework.stereotype.Service;
import lombok.RequiredArgsConstructor;
@Service
@RequiredArgsConstructor
public class ArticleServiceImpl implements ArticleService {
private final ArticlesRepository articlesRepository;
@Override
public void addArticle(final Article article) {
articlesRepository.save(article);
}
@Override
public List<Article> getArticles() {
return articlesRepository.findAll();
}
@Override
public Article findArticleById(final Integer id) {
return articlesRepository.findOneByArticleId(id).orElseThrow(() -> new NotFoundException());
}
@Override
public List<Section> getArticleSections(final Integer articleId) {
final Article article = findArticleById(articleId);
return article.getSections();
}
@Override
public Section getArticleSectionBySectionId(final Integer articleId, final String sectionId) {
final List<Section> section = findArticleById(articleId).getSections().stream()
.filter(sec -> sec.getSectionId().equals(sectionId)).collect(Collectors.toList());
if (section.isEmpty()) {
throw new NotFoundException();
} else {
return section.get(0);
}
}
@Override
public List<Section> findSectionsContaining(final Integer articleId, final String searchTerm) {
final Article article = findArticleById(articleId);
return article.getSections().parallelStream()
.filter(section -> {
return sectionContains(section, searchTerm);
})
.collect(Collectors.toList());
}
@Override
public List<Article> findArticlesContaining(String content) {
return articlesRepository.findAll().stream()
.filter(article -> {
return article.getSummary().toLowerCase().contains(content) || article.getSections().stream().anyMatch(section -> sectionContains(section, content));
})
.collect(Collectors.toList());
}
private boolean sectionContains(final Section section, final String searchTerm) {
return (section.getSectionName().toLowerCase().contains(searchTerm) || section.getContent().toLowerCase().contains(searchTerm));
}
} | [
"natehall@Nathans-MBP.nc.rr.com"
] | natehall@Nathans-MBP.nc.rr.com |
8f9d108108de8c161d33b34d97852e9f2cd9f7bf | 4e6d650d851e86d0f821b3cc59f34947fef416d6 | /app/src/main/java/com/hansheng/studynote/contentprovider/ContentProvider/StudentProvider.java | 4d0eb324787d1cdd4d7522f0c5e5f3cfb5cb3a89 | [
"Apache-2.0"
] | permissive | will007008/StudyNote | c4d774a64412f1ac2c282e54fa3478c95892178e | 880931973b4c84768d56ac39381d5cbfddd9def3 | refs/heads/master | 2021-01-18T17:25:26.137705 | 2017-03-27T16:21:21 | 2017-03-27T16:21:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,960 | java | package com.hansheng.studynote.contentprovider.ContentProvider;
import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.UriMatcher;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
/**
* Created by hansheng on 17-2-15.
* ContentProvider๏ผๅ
ๅฎนๆไพ่
๏ผ็schemeๅทฒ็ป็ฑAndroidๆ่งๅฎ๏ผ schemeไธบ๏ผcontent://
* ไธปๆบๅ๏ผๆๅซAuthority๏ผ็จไบๅฏไธๆ ่ฏ่ฟไธชContentProvider๏ผๅค้จ่ฐ็จ่
ๅฏไปฅๆ นๆฎ่ฟไธชๆ ่ฏๆฅๆพๅฐๅฎใ
* ่ทฏๅพ๏ผpath๏ผๅฏไปฅ็จๆฅ่กจ็คบๆไปฌ่ฆๆไฝ็ๆฐๆฎ๏ผ่ทฏๅพ็ๆๅปบๅบๆ นๆฎไธๅก่ๅฎ๏ผๅฆไธ:
* ่ฆๆไฝperson่กจไธญidไธบ10็่ฎฐๅฝ๏ผๅฏไปฅๆๅปบ่ฟๆ ท็่ทฏๅพ:/person/10
* ่ฆๆไฝperson่กจไธญidไธบ10็่ฎฐๅฝ็nameๅญๆฎต๏ผ person/10/name
* ่ฆๆไฝperson่กจไธญ็ๆๆ่ฎฐๅฝ๏ผๅฏไปฅๆๅปบ่ฟๆ ท็่ทฏๅพ:/person
* ่ฆๆไฝxxx่กจไธญ็่ฎฐๅฝ๏ผๅฏไปฅๆๅปบ่ฟๆ ท็่ทฏๅพ:/xxx
* ๅฝ็ถ่ฆๆไฝ็ๆฐๆฎไธไธๅฎๆฅ่ชๆฐๆฎๅบ๏ผไนๅฏไปฅๆฏๆไปถใxmlๆ็ฝ็ป็ญๅ
ถไปๅญๅจๆนๅผ๏ผๅฆไธ:
* ่ฆๆไฝxmlๆไปถไธญperson่็นไธ็name่็น๏ผๅฏไปฅๆๅปบ่ฟๆ ท็่ทฏๅพ๏ผ/person/name
* ๅฆๆ่ฆๆไธไธชๅญ็ฌฆไธฒ่ฝฌๆขๆUri๏ผๅฏไปฅไฝฟ็จUri็ฑปไธญ็parse()ๆนๆณ๏ผๅฆไธ๏ผ
* Uri uri = Uri.parse("content://com.ljq.provider.personprovider/person")
* <p>
* <p>
* UriMatcher็ฑปไฝฟ็จไป็ป
* <p>
* ๅ ไธบUriไปฃ่กจไบ่ฆๆไฝ็ๆฐๆฎ๏ผๆไปฅๆไปฌ็ปๅธธ้่ฆ่งฃๆUri๏ผๅนถไปUriไธญ่ทๅๆฐๆฎใAndroid็ณป็ปๆไพไบไธคไธช็จไบๆไฝUri็ๅทฅๅ
ท็ฑป๏ผๅๅซไธบUriMatcherๅContentUris ใๆๆกๅฎไปฌ็ไฝฟ็จ๏ผไผไพฟไบๆไปฌ็ๅผๅๅทฅไฝใ
* UriMatcher็ฑป็จไบๅน้
Uri๏ผๅฎ็็จๆณๅฆไธ๏ผ
* ้ฆๅ
็ฌฌไธๆญฅๆไฝ ้่ฆๅน้
Uri่ทฏๅพๅ
จ้จ็ปๆณจๅไธ๏ผๅฆไธ๏ผ
* <p>
* ๅคๅถไปฃ็
* //ๅธธ้UriMatcher.NO_MATCH่กจ็คบไธๅน้
ไปปไฝ่ทฏๅพ็่ฟๅ็
* UriMatcher sMatcher = new UriMatcher(UriMatcher.NO_MATCH);
* //ๅฆๆmatch()ๆนๆณๅน้
content://com.ljq.provider.personprovider/person่ทฏๅพ๏ผ่ฟๅๅน้
็ ไธบ1
* sMatcher.addURI("com.ljq.provider.personprovider", "person", 1);//ๆทปๅ ้่ฆๅน้
uri๏ผๅฆๆๅน้
ๅฐฑไผ่ฟๅๅน้
็
* //ๅฆๆmatch()ๆนๆณๅน้
content://com.ljq.provider.personprovider/person/230่ทฏๅพ๏ผ่ฟๅๅน้
็ ไธบ2
* sMatcher.addURI("com.ljq.provider.personprovider", "person/#", 2);//#ๅทไธบ้้
็ฌฆ
* switch (sMatcher.match(Uri.parse("content://com.ljq.provider.personprovider/person/10"))) {
* case 1
* break;
* case 2
* break;
* default://ไธๅน้
* break;
* }
* <p>
* <p>
* ContentUris็ฑปไฝฟ็จไป็ป
* <p>
* ContentUris็ฑป็จไบๆไฝUri่ทฏๅพๅ้ข็ID้จๅ๏ผๅฎๆไธคไธชๆฏ่พๅฎ็จ็ๆนๆณ๏ผ
* withAppendedId(uri, id)็จไบไธบ่ทฏๅพๅ ไธID้จๅ๏ผ
* <p>
* Uri uri = Uri.parse("content://com.ljq.provider.personprovider/person")
* Uri resultUri = ContentUris.withAppendedId(uri, 10);
* //็ๆๅ็Uriไธบ๏ผcontent://com.ljq.provider.personprovider/person/10
* parseId(uri)ๆนๆณ็จไบไป่ทฏๅพไธญ่ทๅID้จๅ๏ผ
* <p>
* Uri uri = Uri.parse("content://com.ljq.provider.personprovider/person/10")
* long personid = ContentUris.parseId(uri);//่ทๅ็็ปๆไธบ:10
*/
public class StudentProvider extends ContentProvider {
// ๆฐๆฎ้็MIME็ฑปๅๅญ็ฌฆไธฒๅๅบ่ฏฅไปฅvnd.android.cursor.dir/ๅผๅคด
public static final String STUDENTS_TYPE = "vnd.android.cursor.dir/student";
// ๅไธๆฐๆฎ็MIME็ฑปๅๅญ็ฌฆไธฒๅบ่ฏฅไปฅvnd.android.cursor.item/ๅผๅคด
public static final String STUDENTS_ITEM_TYPE = "vnd.android.cursor.item/student";
public static final String AUTHORITY = "com.android.contentproviderdemo.StudentProvider";// ไธปๆบๅ
private final String TAG = "DBOpenHelper";
private DBOpenHelper helper = null;
private static final UriMatcher URIMATCHER = new UriMatcher(UriMatcher.NO_MATCH);
/**
* ่ฟ้ไธบไฝ่ฆๅ่ฟ็ง ๆไฝๅๆก่ฎฐๅฝ ๆ่
ๆไฝๅคๆก่ฎฐๅฝ็ๆ ๅฟไฝๅข?
* ๅๅ ๆฏๅ ไธบ ๅค้จ็จๅบ ๆไฝ ContentProvider ็ๆนๆณ๏ผไป
ไป
ๅช่ฝ้่ฟไธไธช URI ๆฅ่ฎฟ้ฎ๏ผ
* ๆไปฅ่ฆๅฎไนไธคไธชๆ ๅฟไฝๆฅ่ฏๅซๅค้จ้่ฆๆไฝ็ๆฏๅๆก่ฎฐๅฝ่ฟๆฏๅคๆก่ฎฐๅฝ (ๆฏๅฆๅ ้คๅๆก่ฎฐๅฝๆ่
ๅ ้คๅคๆก่ฎฐๅฝ)
*/
/* ่ชๅฎไนๅน้
็ */
private static final int STUDENT = 1; // ๆไฝๅๆก่ฎฐๅฝ
/* ่ชๅฎไนๅน้
็ */
private static final int STUDENTS = 2; // ๆไฝๅคๆก่ฎฐๅฝ
// ๆทปๅ ๅฏนๅค้จ็ๅน้
่งๅ
static {
URIMATCHER.addURI(AUTHORITY,
"student", STUDENTS);
URIMATCHER.addURI(AUTHORITY,
"student/#", STUDENT);
}
public StudentProvider() {
// TODO Auto-generated constructor stub
}
/**
* ๅฎ็ไฝ็จๆฏๆ นๆฎURI่ฟๅ่ฏฅURIๆๅฏนๅบ็ๆฐๆฎ็MIME็ฑปๅๅญ็ฌฆไธฒใ
* ่ฟไธชMIME็ฑปๅๅญ็ฌฆไธฒ็ไฝ็จๆฏ่ฆๅน้
AndroidManifest.xmlๆไปถ
* <activity>ๆ ็ญพไธ<intent-filter>ๆ ็ญพ็ๅญๆ ็ญพ<data>็ๅฑๆง android:mimeTypeใ
* ๅฆๆไธไธ่ด๏ผๅไผๅฏผ่ดๅฏนๅบ็Activityๆ ๆณๅฏๅจใ
*/
@Override
public String getType(Uri uri) {
int flag = URIMATCHER.match(uri);
switch (flag) {
case STUDENT:
return STUDENTS_ITEM_TYPE;
case STUDENTS:
return STUDENTS_TYPE;
}
return null;
}
@Override
public boolean onCreate() {
// ๅๅงๅ็ๆถๅๅฎไพๅ helper ๅฏน่ฑก
helper = new DBOpenHelper(getContext());
return true;
}
// query() ๆนๆณ่ฟๅ็ๆฏไธไธช Cursor ็ๆธธๆ ,่ฏฆ็ปๆนๆณๅ่ Android APIๆๆกฃ
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
Cursor cursor = null;
try {
SQLiteDatabase databse = helper.getReadableDatabase();
int flag = URIMATCHER.match(uri);
switch (flag) {
case STUDENT:
long id = ContentUris.parseId(uri);
String where_value = " id = " + id;
if (selection != null && !selection.equals("")) {
where_value += " and " + selection;
}
// ่ฟ่พนๅ
ทไฝๆฅ่ฏขๆนๅผๅฆๆๆไธๆ๏ผๅฏไปฅๅ่ๅ้ขๅณๅฐ SQLite็ๆฅ่ฏขใ
cursor = databse.query("student", null, where_value, selectionArgs, null, null,
null, null);
break;
case STUDENTS:
cursor = databse.query("student", null, selection, selectionArgs, null, null,
null, null);
break;
}
} catch (Exception e) {
// TODO: handle exception
}
return cursor;
}
@Override
public Uri insert(Uri uri, ContentValues values) {
Uri resultUri = null;
/**
* URI_MATCHER.match(uri) ไธ้ขๅทฒ็ปๅจๅฎไนไบๅน้
่งๅ๏ผๆไปฅ่ฟ้ๆฏ็จๅค้จไผ ่ฟๆฅ็URIๅน้
ๅ
้จๅฎไนๅฅฝ็่งๅ๏ผ
* ๅฆๆๅน้
ๆๅๅ่ฟ่กๆไฝ,ๅไนไธ่ฟ่กๆไฝใ
*/
int flag = URIMATCHER.match(uri);
switch (flag) {
case STUDENTS:
SQLiteDatabase database = helper.getWritableDatabase();
// ๆณจๆ่ฟ่พนๆไปฌไฝฟ็จ็ๆฏๆฐๆฎๅบ็ database.insert()ๆนๆณ๏ผๆไปฅ่ฆ็จ withAppendedId()
// ่ฟ็งๆนๅผๆฅ่ฟๅURI
long id = database.insert("student", null, values); // ๆๅ
ฅๅฝๅ่ก็่กๅท
resultUri = ContentUris.withAppendedId(uri, id);
break;
}
// getetContext().getContentResolver().notifyChange(uri, null);
Log.i(TAG, "ahuier----->" + resultUri.toString());
// ่ฟๅๆฐๆๅ
ฅ้้กน็URI๏ผๅฏไปฅ็ปๅ
ถไป็จๆทๅปไฝฟ็จ
return resultUri;
}
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
int count = -1; // countไฝไธบๅฝฑๅๆฐๆฎๅบ็่กๆฐ
try {
int flag = URIMATCHER.match(uri);
SQLiteDatabase database = helper.getWritableDatabase();
switch (flag) {
case STUDENT:
/**
* ไผ ้่ฟๆฅ็URI็ๆ ผๅผ๏ผcontent://com.android.contentproviderdemo.StudentProvider/student/1
* ไปฅไธไปฃ็ ๅ
ถๅฎๅฐฑๆฏ็จๆฅๆๅปบ SQL ไธญๅ ้คๅๆ่ฎฐๅฝ็่ฏญๅฅ
* delete from student where id = ? // id ้่ฟๅฎขๆท็ซฏไผ ้่ฟๆฅ็ใ
*/
long id = ContentUris.parseId(uri); // ่งฃๆๅบ URI ๆซๅฐพ็IDๅท
String whereValue = " id = " + id;
// if (selection != null && !selection.equals("")) {
// where_value += " and " + selection;
// }
whereValue += !TextUtils.isEmpty(selection) ? " and (" + selection + ")" : "";// ๆๅ
ถๅฎๆกไปถ้ๅ ไธ
// ๆณจๆ่ฟ่พน็count็ๆฏSQLiteไธญ็delete()ๆนๆณ,่ฟๅ็ๆฏไธไธชๅฝฑๅๆฐๆฎๅบ็ๆฐ็ฎ
count = database.delete("student", whereValue, selectionArgs);
break;
case STUDENTS:
// ไผ ้่ฟๆฅ็ URIๆ ผๅผ๏ผcontent://com.android.contentproviderdemo.StudentProvider/student
// ๅ ้คๅคๆก่ฎฐๅฝ
count = database.delete("studuent", selection, selectionArgs);
break;
}
} catch (Exception e) {
// TODO: handle exception
}
return count;
}
// ๆดๆฐ็ๆนๆณไธๅ ้คๆนๆณ็ฑปไผผ๏ผ่ฏป่
ๅฏไปฅ่ชๅทฑๅปๆฅ Androidๅฎๆนๆๆกฃ
@Override
public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
int count = -1;
try {
// ๆดๆฐๆฐๆฎๅบ็่ฏญๅฅ ๏ผ update table set name = ?, address = ? where id = ?
SQLiteDatabase database = helper.getWritableDatabase();
long id = ContentUris.parseId(uri);
int flag = URIMATCHER.match(uri);
switch (flag) {
case STUDENT:
String where_value = " id = " + id;
if (selection != null && !selection.equals("")) {
where_value += " and " + selection;
}
count = database.update("student", values, where_value, selectionArgs);
break;
case STUDENTS:
// TODO ่ฟ้ไธ่ฌๆ
ๅตไธ, ไธไผๅปๆดๆฐๅ
จ้จ่กจๆ ผ
break;
}
} catch (Exception e) {
// TODO: handle exception
}
return count;
}
}
| [
"shenghanming@gmail.com"
] | shenghanming@gmail.com |
81374393a9c08f6ad3ca23687bebbbbf6b8d4589 | a1ff36ba3de0f06bb64905e96074f2e73ccd2d74 | /src/main/java/com/blog/tutorial/Document.java | dbf903e727513fe2fe38a404fa265fced95e33c2 | [] | no_license | rajan-startup/blog | d0ecf6be23de5f0df57019cb3807619925d93078 | 2fc0a6c710842547eda89361d3d513eca0bfe21b | refs/heads/master | 2021-01-17T11:07:11.628171 | 2017-05-22T04:53:55 | 2017-05-22T04:53:55 | 16,676,374 | 0 | 1 | null | 2015-12-20T08:40:28 | 2014-02-09T21:38:25 | CSS | UTF-8 | Java | false | false | 55 | java | package com.blog.tutorial;
public class Document {
}
| [
"rdhabalia@ebay.com"
] | rdhabalia@ebay.com |
e5efe5b4b65a2e67de5cf9f7a6c61ab5e154e07c | 447520f40e82a060368a0802a391697bc00be96f | /apks/playstore_apps/com_idamob_tinkoff_android/source/com/google/android/exoplayer2/c.java | 87e2ec849c6fed3ecab43eb1fd1cbc505ec5367d | [
"Apache-2.0"
] | permissive | iantal/AndroidPermissions | 7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465 | d623b732734243590b5f004d167e542e2e2ae249 | refs/heads/master | 2023-07-19T01:29:26.689186 | 2019-09-30T19:01:42 | 2019-09-30T19:01:42 | 107,239,248 | 0 | 0 | Apache-2.0 | 2023-07-16T07:41:38 | 2017-10-17T08:22:57 | null | UTF-8 | Java | false | false | 3,410 | java | package com.google.android.exoplayer2;
import com.google.android.exoplayer2.b.g;
import com.google.android.exoplayer2.c.w;
import com.google.android.exoplayer2.upstream.b;
import com.google.android.exoplayer2.upstream.h;
import java.util.PriorityQueue;
public final class c
implements k
{
private final h a;
private final long b;
private final long c;
private final long d;
private final long e;
private final int f;
private final boolean g;
private final com.google.android.exoplayer2.c.p h;
private int i;
private boolean j;
public c()
{
this(new h());
}
private c(h paramH)
{
this(paramH, (byte)0);
}
private c(h paramH, byte paramByte)
{
this(paramH, '\000');
}
private c(h paramH, char paramChar)
{
this.a = paramH;
this.b = 15000000L;
this.c = 30000000L;
this.f = -1;
this.d = 5000000L;
this.e = 2500000L;
this.g = true;
this.h = null;
}
private void a(boolean paramBoolean)
{
this.i = 0;
if ((this.h != null) && (this.j)) {
this.h.a();
}
this.j = false;
if (paramBoolean) {
this.a.d();
}
}
public final void a()
{
a(false);
}
public final void a(p[] paramArrayOfP, g paramG)
{
int m = 0;
if (this.f == -1) {
for (int k = 0;; k = n)
{
n = k;
if (m >= paramArrayOfP.length) {
break;
}
n = k;
if (paramG.b[m] != null) {
n = k + w.d(paramArrayOfP[m].a());
}
m += 1;
}
}
int n = this.f;
this.i = n;
this.a.a(this.i);
}
public final boolean a(long paramLong)
{
boolean bool2 = true;
boolean bool3 = false;
int k;
boolean bool1;
label85:
com.google.android.exoplayer2.c.p localP;
if (this.a.e() >= this.i)
{
k = 1;
boolean bool4 = this.j;
if (!this.g) {
break label164;
}
if (paramLong >= this.b)
{
bool1 = bool3;
if (paramLong <= this.c)
{
bool1 = bool3;
if (this.j)
{
bool1 = bool3;
if (k != 0) {}
}
}
}
else
{
bool1 = true;
}
this.j = bool1;
if ((this.h != null) && (this.j != bool4))
{
if (!this.j) {
break label224;
}
localP = this.h;
}
}
for (;;)
{
synchronized (localP.a)
{
localP.b.add(Integer.valueOf(0));
localP.c = Math.max(localP.c, 0);
return this.j;
k = 0;
break;
label164:
if (k == 0)
{
bool1 = bool2;
if (paramLong >= this.b)
{
if ((paramLong <= this.c) && (this.j)) {
bool1 = bool2;
}
}
else
{
this.j = bool1;
break label85;
}
}
bool1 = false;
}
label224:
this.h.a();
}
}
public final boolean a(long paramLong, boolean paramBoolean)
{
if (paramBoolean) {}
for (long l = this.e; (l <= 0L) || (paramLong >= l) || ((!this.g) && (this.a.e() >= this.i)); l = this.d) {
return true;
}
return false;
}
public final void b()
{
a(true);
}
public final void c()
{
a(true);
}
public final b d()
{
return this.a;
}
}
| [
"antal.micky@yahoo.com"
] | antal.micky@yahoo.com |
5d0d1e88e5e9e0033ad5a0a21997a98878bf2b90 | b3cf6efcfc3bfd03873d9eb71de2ddeeecbc5b51 | /src/benchmarks/detinfer/pj/edu/rit/smp/network/FloydRandom.java | 5240c94a823fa1e92ad177849461167818345e65 | [] | no_license | weilinfox/origin_calfuzzer | 12d9635098f66ca3e1c5ebf24eb058854da90f80 | f44d25a40701d23474724c59a13888b0c2469891 | refs/heads/master | 2023-03-02T04:37:37.273348 | 2021-01-31T08:41:58 | 2021-01-31T08:41:58 | 301,637,748 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,530 | java | //******************************************************************************
//
// File: FloydRandom.java
// Package: benchmarks.detinfer.pj.edu.ritsmp.network
// Unit: Class benchmarks.detinfer.pj.edu.ritsmp.network.FloydRandom
//
// This Java source file is copyright (C) 2008 by Alan Kaminsky. All rights
// reserved. For further information, contact the author, Alan Kaminsky, at
// ark@cs.rit.edu.
//
// This Java source file is part of the Parallel Java Library ("PJ"). PJ 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 3 of the License, or (at your option) any later version.
//
// PJ 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.
//
// A copy of the GNU General Public License is provided in the file gpl.txt. You
// may also obtain a copy of the GNU General Public License on the World Wide
// Web at http://www.gnu.org/licenses/gpl.html.
//
//******************************************************************************
package benchmarks.detinfer.pj.edu.ritsmp.network;
import benchmarks.detinfer.pj.edu.ritio.DoubleMatrixFile;
import benchmarks.detinfer.pj.edu.ritutil.Random;
import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
/**
* Class FloydRandom is a main program that creates a distance matrix input file
* for the {@linkplain FloydSeq}, {@linkplain FloydSmpRow}, and {@linkplain
* FloydSmpCol} programs.
* <P>
* Usage: java benchmarks.detinfer.pj.edu.ritsmp.network.FloydRandom <I>seed</I> <I>radius</I>
* <I>N</I> <I>matrixfile</I>
* <BR><I>seed</I> = Random seed
* <BR><I>radius</I> = Node adjacency radius
* <BR><I>N</I> = Number of nodes
* <BR><I>matrixfile</I> = Distance matrix file
* <P>
* The program:
* <OL TYPE=1>
* <LI>
* Initializes a pseudorandom number generator with <I>seed</I>.
* <LI>
* Generates <I>N</I> nodes located at random positions in the unit square.
* <LI>
* Sets up the distance matrix <I>D</I>. If two nodes are within a Euclidean
* distance <I>radius</I> of each other, the nodes are adjacent, otherwise the
* nodes are not adjacent. <I>radius</I> = 0.25 works well.
* <LI>
* Stores the distance matrix in the <I>matrixfile</I>.
* </OL>
* <P>
* The distance matrix file is a binary file written in the format required by
* class {@linkplain benchmarks.detinfer.pj.edu.ritio.DoubleMatrixFile}.
*
* @author Alan Kaminsky
* @version 09-Jan-2008
*/
public class FloydRandom
{
// Prevent construction.
private FloydRandom()
{
}
// Main program.
/**
* Main program.
*/
public static void main
(String[] args)
throws Exception
{
// Parse command line arguments.
if (args.length != 4) usage();
long seed = Long.parseLong (args[0]);
double radius = Double.parseDouble (args[1]);
int n = Integer.parseInt (args[2]);
String matrixfile = args[3];
// Set up pseudorandom number generator.
Random prng = Random.getInstance (seed);
// Generate random node locations in the unit square.
double[] x = new double [n];
double[] y = new double [n];
for (int i = 0; i < n; ++ i)
{
x[i] = prng.nextDouble();
y[i] = prng.nextDouble();
}
// Compute distance matrix elements.
double[][] d = new double [n] [n];
for (int r = 0; r < n; ++ r)
{
double[] d_r = d[r];
for (int c = 0; c < n; ++ c)
{
double dx = x[r] - x[c];
double dy = y[r] - y[c];
double distance = Math.sqrt (dx*dx + dy*dy);
d_r[c] =
(distance <= radius ?
distance :
Double.POSITIVE_INFINITY);
}
}
// Write distance matrix to output file.
DoubleMatrixFile dmf = new DoubleMatrixFile (n, n, d);
DoubleMatrixFile.Writer writer =
dmf.prepareToWrite
(new BufferedOutputStream
(new FileOutputStream (matrixfile)));
writer.write();
writer.close();
}
// Hidden operations.
/**
* Print a usage message and exit.
*/
private static void usage()
{
System.err.println ("Usage: java benchmarks.detinfer.pj.edu.ritsmp.network.FloydRandom <seed> <radius> <N> <matrixfile>");
System.err.println ("<seed> = Random seed");
System.err.println ("<radius> = Node adjacency radius");
System.err.println ("<N> = Number of nodes");
System.err.println ("<matrixfile> = Distance matrix file");
System.exit (1);
}
}
| [
"ksen@cs.berkeley.edu"
] | ksen@cs.berkeley.edu |
afddb93dbe363ce19e2680a893aee599d46acd3a | 19a9e71fe22b09c3fccc0a4b4661d03626b141de | /src/main/java/com/interntraining/admin/adminBoard/controller/AdminBoardController.java | 4cf82f892e1b604438676d1b3e422a7a16566c9b | [] | no_license | kimheewon/project | f3367420ec9c05018bfece4111df49fd1c6bd97a | 5162b2a0be8b58f496cf6fbd3a72884044ef32e3 | refs/heads/master | 2020-04-08T18:50:08.711835 | 2018-11-28T00:10:56 | 2018-11-28T00:10:56 | 159,627,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,190 | java | package com.interntraining.admin.adminBoard.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
import com.interntraining.admin.adminBoard.domain.AdminBoardInfo;
import com.interntraining.admin.adminBoard.service.AdminBoardService;
import com.interntraining.admin.authority.domain.AuthMapp;
import com.interntraining.member.board.domain.Comment;
/*
* ๊ฒ์ํ ๊ด๋ฆฌ
* - ๋ชฉ๋ก
* - ๋ฑ๋ก
* - ์์
* - ์ญ์
*/
@Controller
@RequestMapping(value= "/AdminBoard")
public class AdminBoardController {
@Autowired
private AdminBoardService adminBoardService;
//๊ฒ์ํ ๋ชฉ๋ก ํ์ด์ง๋ก ์ด๋
@RequestMapping(value="/AdminBoardList")
public ModelAndView AdminBoardList(int boardCateNo, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
/*
* ๊ถํ ์ ์ด
* - ๋ก๊ทธ์ธํ ๊ด๋ฆฌ์๊ฐ ํด๋น ๊ถํ ๊ฐ์ง๊ณ ์๋์ง ํ์ธ
*
*/
@SuppressWarnings("unchecked")
List<AuthMapp> authItem = (List<AuthMapp>) session.getAttribute("items");
int authCheck=0; //๊ถํ ๊ฐ์ง๊ณ ์๋ ์ฒดํฌ
for(int i=0; i<authItem.size(); i++) {
if(authItem.get(i).getIntAuthItemNo() == 5) {
authCheck=1; //๊ถํ ๊ฐ์ง๊ณ ์์
}
}
if(authCheck == 1) { //๊ถํ ๊ฐ์ง๊ณ ์์ผ๋ฉด
List<AdminBoardInfo> Board = adminBoardService.selectAllBoard(boardCateNo); //๊ฒ์ํ ๊ธ ๋ชจ๋ ๊ฐ์ ธ์ค๊ธฐ
String BoardName = adminBoardService.selectBoardName(boardCateNo); //๊ฒ์ํ ๋ช
๋ถ๋ฌ์ค๊ธฐ
AdminBoardInfo Parent = adminBoardService.selectCategoryParentName(boardCateNo); //๋ถ๋ชจ๊ฒ์ํ ๋ช
๋ถ๋ฌ์ค๊ธฐ
//๋ ์ง ๋ณํ
Date dateB = new Date();
String boardDate;
Date today = new Date();
SimpleDateFormat date = new SimpleDateFormat("yyy/MM/dd");
SimpleDateFormat dateTime = new SimpleDateFormat("hh:mm a",Locale.US);
int check;
for(int j=0; j<Board.size();j++) {
dateB = Board.get(j).getDateBoardDate();
check=0;
String adminId = adminBoardService.selectAdminId(Board.get(j).getIntAdminNo()); //๊ด๋ฆฌ์ id ์ฐพ๊ธฐ
Board.get(j).setStrAdminId(adminId);
if(! date.format(today).equals(date.format(dateB))) { //์ค๋ ์ด ๊ธ์ด ์๋๋ฉด
boardDate = date.format(dateB);
Board.get(j).setStrBoardDate(boardDate);
}
else { //์ค๋ ์ด ๊ธ์ด๋ฉด
check=1;
boardDate=dateTime.format(dateB);
Board.get(j).setStrBoardDate(boardDate);
Board.get(j).setIntNewCheck(check); //์ค๋ ๊ธ์ธ์ง ํ์ธ new
}
}
mav.addObject("board", Board);
mav.addObject("boardName", BoardName);
mav.addObject("Parent", Parent);
mav.addObject("boardCateNo", boardCateNo);
mav.setViewName("/admin/board/BoardList");
}
else { //๊ถํ ์์ผ๋ฉด ํ์ผ๋ก
mav.setViewName("/admin/login/AdminHome_No");
}
return mav;
}
//๊ฒ์๊ธ ๋ฑ๋ก ํ์ด์ง๋ก ์ด๋
@RequestMapping(value="/AdminBoardEnrollForm")
public ModelAndView AdminBoardEnrollForm(int boardCateNo, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
String BoardName = adminBoardService.selectBoardName(boardCateNo); //๊ฒ์ํ ๋ช
๋ถ๋ฌ์ค๊ธฐ
mav.addObject("boardCateNo", boardCateNo); //๊ฒ์ํ ์นดํ
๊ณ ๋ฆฌ ๋ฒํธ
mav.addObject("boardName", BoardName); //๊ฒ์ํ๋ช
mav.setViewName("/admin/board/BoardEnroll");
return mav;
}
//๊ฒ์๊ธ ๋ฑ๋ก
@RequestMapping(value="/AdminBoardEnroll")
public ModelAndView AdminBoardEnroll(int boardCateNo, AdminBoardInfo adminBoardInfo, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
int AdminNo = (int) session.getAttribute("AdminNo");
adminBoardInfo.setIntBoardCateNo(boardCateNo); //์นดํ
๊ณ ๋ฆฌ ๋ฒํธ
adminBoardInfo.setStrUserId("๊ด๋ฆฌ์");//์์ฑ์(๋ก๊ทธ์ธ ์์ด๋)
adminBoardInfo.setIntAdmincheck(1);//๊ด๋ฆฌ์๊ฐ ์์ฑ
adminBoardInfo.setIntAdminNo(AdminNo);//๊ด๋ฆฌ์๋ฒํธ
//adminBoardInfo.setIntBoardNotice(1);//๊ณต์งํ๊ธฐ
adminBoardService.insertBoardInfo(adminBoardInfo); //์
๋ ฅํ ์ ๋ณด DB์ ์ ์ฅ
mav.setViewName("redirect:/AdminBoard/AdminBoardList?boardCateNo="+boardCateNo);
return mav;
}
//๊ฒ์๊ธ ์ฝ๊ธฐ
@RequestMapping(value="/AdminBoardRead")
public ModelAndView AdminBoardRead(int boardCateNo, int BoardNo, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
String BoardName = adminBoardService.selectBoardName(boardCateNo); //๊ฒ์ํ ๋ช
๋ถ๋ฌ์ค๊ธฐ
AdminBoardInfo board = adminBoardService.selectBoardInfo(BoardNo); //๊ฒ์๊ธ ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ(์ ๋ชฉ, ์์ฑ์, adminId, ๊ธ๋ด์ฉ) ์กฐํ์ ์ฆ๊ฐ
List<Comment> cmmtlist = adminBoardService.selectCommentList(BoardNo); //๋๊ธ ๋ด์ฉ ๊ฐ์ ธ์ค๊ธฐ
int adminNo = board.getIntAdminNo();
if(adminNo != 0) { //์์ฑ์๊ฐ ADMIN์ด๋ฉด ID๊ฐ์ ธ์ค๊ธฐ
String adminId = adminBoardService.selectAdminId(adminNo); //๊ด๋ฆฌ์ id
board.setStrAdminId(adminId);
}
mav.addObject("board", board); //๊ฒ์๊ธ
mav.addObject("commentlist", cmmtlist); //๋๊ธ ๋ฆฌ์คํธ
mav.addObject("boardCateNo", boardCateNo); //๊ฒ์ํ ์นดํ
๊ณ ๋ฆฌ ๋ฒํธ
mav.addObject("boardName", BoardName); //๊ฒ์ํ๋ช
mav.setViewName("/admin/board/BoardRead");
return mav;
}
//๊ฒ์๊ธ ์ญ์
@RequestMapping("/AdminBoardDelete")
public ModelAndView boardDelete(HttpServletRequest request, HttpServletResponse response, HttpSession session,int BoardNo, int CategoryNo) throws Exception {
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
adminBoardService.deleteboard(BoardNo); //๊ธ ์ญ์
mav.setViewName("redirect:/AdminBoard/AdminBoardList?boardCateNo="+CategoryNo);
return mav;
}
//๊ฒ์๊ธ ์์ ํ์ด์ง๋ก ์ด๋
@RequestMapping("AdminBoardUpdateForm")
public ModelAndView AdminBoardUpdateForm(int BoardNo) {
ModelAndView mav = new ModelAndView(new MappingJackson2JsonView());
AdminBoardInfo board = adminBoardService.selectBoard(BoardNo); //๊ธ๋ฒํธ๋ก ๊ฒ์๊ธ ๋ด์ฉ ๊ฐ์ ธ์ค๊ธฐ
mav.addObject("board", board);
mav.setViewName("/admin/board/BoardUpdate");
return mav;
}
}
| [
"hwkim@payletter.com"
] | hwkim@payletter.com |
c529cdf33e8b5270891eff4fb9ae993ee4871c85 | 1ce8cd9f22e96998cc034860b160b4cc8212e6f5 | /src/main/java/com/ontime/origin/OriginDelayMapper.java | e03220ac2a4b6aca086cba74cea53995a98af393 | [] | no_license | jeehyunmin/airline | dc59166e424b850d13c0302f8a793fa4c131ce85 | 88c37a691d7b1053bd35c24d2f6572f0bf80c994 | refs/heads/master | 2021-07-21T23:17:11.966190 | 2017-11-01T10:40:24 | 2017-11-01T10:40:24 | 108,236,605 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,406 | java | package com.ontime.origin;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import com.ontime.common.DelayCounters;
import com.ontime.common.AirlineParser;
import lombok.extern.java.Log;
@Log
public class OriginDelayMapper extends Mapper<LongWritable, Text, Text, IntWritable> {
private Text outputKey = new Text();
private IntWritable outputValue = new IntWritable(1);
@Override
protected void setup(Context context) throws IOException, InterruptedException {
log.info("origin mapper started");
}
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
AirlineParser parser = new AirlineParser(value);
// ์ถ๋ฐ ์ง์ฐ์ธ ๊ฒฝ์ฐ
if(parser.isDepDelayAvailable()){
if(parser.getDepDelay() > 0){
outputKey.set(parser.getOrigin());
context.write(outputKey, outputValue);
} else if(parser.getDepDelay() ==0) {
context.getCounter(DelayCounters.scheduled_departure).increment(1);
} else if(parser.getDepDelay() < 0){
context.getCounter(DelayCounters.early_departure).increment(1);
}
} else {
context.getCounter(DelayCounters.not_available_departure).increment(1);
}
context.getCounter(DelayCounters.not_available_arrival).increment(1);
}
}
| [
"jeehyun.rek@gmail.com"
] | jeehyun.rek@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.