blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2
values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 9.45M | extension stringclasses 28
values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
693f9012b24f611c34280adf9d3b388252588c5d | 9837cde8400b58a0ddcd67e16ee75e05b869bb83 | /src/test/java/ua/edu/ucu/collections/immutable/ImmutableArrayListTest.java | c949da789829e6bf20044d066347b68a847c6282 | [] | no_license | Hryts/apps19hrytsay-hw2 | a447054060987ae18e6d12d7ef8155646c8dfd70 | fb189a084332065d32ac3eefdbd7cb96e3bb39cc | refs/heads/master | 2021-07-17T04:53:19.433054 | 2019-11-03T17:50:25 | 2019-11-03T17:50:25 | 219,131,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,297 | java | package ua.edu.ucu.collections.immutable;
import org.junit.Test;
import static org.junit.Assert.*;
public class ImmutableArrayListTest {
private final Object[] valuesTest = {1, 2, 3, 4, 5};
private final int bigIndex = 1000;
private final int normIndex = 3;
@Test
public void testConstructors() {
ImmutableArrayList ialEmpty = new ImmutableArrayList();
ImmutableArrayList ialWithValues = new ImmutableArrayList(valuesTest);
}
@Test
public void testCopy() {
}
@Test
public void testAdd() {
Object[] arr = new Object[] {1, 2, 3, 4, 5};
ImmutableList immArr = new ImmutableArrayList(arr);
ImmutableList finalArr = immArr.add("test");
Object[] expArr = new Object[] {1, 2, 3, 4, 5, "test"};
assertArrayEquals(finalArr.toArray(), expArr);
}
@Test(expected = IndexOutOfBoundsException.class)
public void testAddIndexException() {
Object[] arr = new Object[] {1, 2, 3, 4, 5};
ImmutableList immArr = new ImmutableArrayList(arr);
ImmutableList finalArr = immArr.add(bigIndex, "test");
}
@Test
public void testAddIndex() {
Object[] arr = new Object[] {1, 2, 3, 4, 5};
ImmutableList immArr = new ImmutableArrayList(arr);
ImmutableList finalArr = immArr.add(normIndex, "test");
Object[] expArr = new Object[] {1, 2, 3, "test", 4, 5};
assertArrayEquals(finalArr.toArray(), expArr);
}
@Test
public void testAddAll() {
Object[] arr = new Object[] {1, 2, 3, 4, 5};
ImmutableList immArr = new ImmutableArrayList(arr);
ImmutableList finalArr = immArr.addAll(valuesTest);
Object[] expArr = new Object[] {1, 2, 3, 4, 5, 1, 2, 3, 4, 5};
assertArrayEquals(finalArr.toArray(), expArr);
}
@Test(expected = IndexOutOfBoundsException.class)
public void testAddAllIndexException() {
Object[] arr = new Object[] {1, 2, 3, 4, 5};
ImmutableList immArr = new ImmutableArrayList(arr);
ImmutableList finalArr = immArr.addAll(bigIndex, valuesTest);
}
@Test
public void testAddAllIndex() {
Object[] arr = new Object[] {1, 2, 3, 4, 5};
ImmutableList immArr = new ImmutableArrayList(arr);
ImmutableList finalArr = immArr.addAll(normIndex, valuesTest);
Object[] expArr = new Object[] {1, 2, 3, 1, 2, 3, 4, 5, 4, 5};
assertArrayEquals(finalArr.toArray(), expArr);
}
@Test
public void testSize() {
ImmutableList immArr = new ImmutableArrayList(valuesTest);
int actSize = immArr.size();
int expSize = valuesTest.length;
assertEquals(actSize, expSize);
}
@Test
public void testClear() {
ImmutableList immArr = new ImmutableArrayList(valuesTest);
ImmutableList immClear = immArr.clear();
int actSize = immClear.size();
int expSize = 0;
assertEquals(actSize, expSize);
}
@Test
public void testIsEmptyNotEmpty() {
ImmutableList immArr = new ImmutableArrayList(valuesTest);
assertEquals(immArr.isEmpty(), false);
}
@Test
public void testIsEmptyEmpty() {
ImmutableList immArr = new ImmutableArrayList();
assertEquals(immArr.isEmpty(), true);
}
}
| [
"hrytsay@ucu.edu.ua"
] | hrytsay@ucu.edu.ua |
bfd553a15503c18e9e2188f141641393498c3333 | 98de4348b05ad2f928afed28c1a34926595da6a9 | /src/main/java/br/com/acaosistemas/xml/retornoloteevento/jaxb/TOcorrencias.java | 81f1b148b8ae5d5b69e2a46724263c6f18c57145 | [] | no_license | ABestteti/UBIJ8320 | 3a87cea71bd38947470918127d02247b43a0cf9f | 02f709e8961a8f52faae90f63126db8fb44adc44 | refs/heads/master | 2021-09-09T16:28:23.630436 | 2018-03-18T00:44:43 | 2018-03-18T00:44:43 | 107,994,868 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 7,402 | java | //
// Este arquivo foi gerado pela Arquitetura JavaTM para Implementação de Referência (JAXB) de Bind XML, v2.2.8-b130911.1802
// Consulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Todas as modificações neste arquivo serão perdidas após a recompilação do esquema de origem.
// Gerado em: 2018.01.19 às 11:38:24 AM BRST
//
package br.com.acaosistemas.xml.retornoloteevento.jaxb;
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.XmlSchemaType;
import javax.xml.bind.annotation.XmlType;
/**
* Define uma ocorrências encontrada no processamento de um arquivo.
*
* <p>Classe Java de TOcorrencias complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType name="TOcorrencias">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="ocorrencia" maxOccurs="unbounded">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="codigo" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="descricao">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2048"/>
* </restriction>
* </simpleType>
* </element>
* <element name="tipo" type="{http://www.w3.org/2001/XMLSchema}unsignedByte"/>
* <element name="localizacao" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2048"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "TOcorrencias", propOrder = {
"ocorrencia"
})
public class TOcorrencias {
@XmlElement(required = true)
protected List<TOcorrencias.Ocorrencia> ocorrencia;
/**
* Gets the value of the ocorrencia 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 ocorrencia property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOcorrencia().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link TOcorrencias.Ocorrencia }
*
*
*/
public List<TOcorrencias.Ocorrencia> getOcorrencia() {
if (ocorrencia == null) {
ocorrencia = new ArrayList<TOcorrencias.Ocorrencia>();
}
return this.ocorrencia;
}
/**
* <p>Classe Java de anonymous complex type.
*
* <p>O seguinte fragmento do esquema especifica o conteúdo esperado contido dentro desta classe.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="codigo" type="{http://www.w3.org/2001/XMLSchema}int"/>
* <element name="descricao">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2048"/>
* </restriction>
* </simpleType>
* </element>
* <element name="tipo" type="{http://www.w3.org/2001/XMLSchema}unsignedByte"/>
* <element name="localizacao" minOccurs="0">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="2048"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"codigo",
"descricao",
"tipo",
"localizacao"
})
public static class Ocorrencia {
protected int codigo;
@XmlElement(required = true)
protected String descricao;
@XmlSchemaType(name = "unsignedByte")
protected short tipo;
protected String localizacao;
/**
* Obtém o valor da propriedade codigo.
*
*/
public int getCodigo() {
return codigo;
}
/**
* Define o valor da propriedade codigo.
*
*/
public void setCodigo(int value) {
this.codigo = value;
}
/**
* Obtém o valor da propriedade descricao.
*
* @return
* possible object is
* {@link String }
*
*/
public String getDescricao() {
return descricao;
}
/**
* Define o valor da propriedade descricao.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescricao(String value) {
this.descricao = value;
}
/**
* Obtém o valor da propriedade tipo.
*
*/
public short getTipo() {
return tipo;
}
/**
* Define o valor da propriedade tipo.
*
*/
public void setTipo(short value) {
this.tipo = value;
}
/**
* Obtém o valor da propriedade localizacao.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLocalizacao() {
return localizacao;
}
/**
* Define o valor da propriedade localizacao.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLocalizacao(String value) {
this.localizacao = value;
}
}
}
| [
"anderson.bestteti@gmail.com"
] | anderson.bestteti@gmail.com |
51e1d573288e59e90770d076953fa27067df8f1d | 5661b6c6eb876e8b8a2701f5a75d65b1b3546eea | /app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/legacy/v4/R.java | 8774fe6404cb68bd1fe9804e5af831d0b8039a05 | [] | no_license | aarondcosta99/FoodReuseApp | c3016e701dd1e8a27071ce3093638996080d239b | f77cdc57ba1fa015ef936ad293f0f832f70abec1 | refs/heads/master | 2023-06-10T19:25:29.858164 | 2021-07-05T16:29:42 | 2021-07-05T16:29:42 | 332,863,708 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,494 | 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.legacy.v4;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f030028;
public static final int coordinatorLayoutStyle = 0x7f0300ce;
public static final int font = 0x7f03012a;
public static final int fontProviderAuthority = 0x7f03012c;
public static final int fontProviderCerts = 0x7f03012d;
public static final int fontProviderFetchStrategy = 0x7f03012e;
public static final int fontProviderFetchTimeout = 0x7f03012f;
public static final int fontProviderPackage = 0x7f030130;
public static final int fontProviderQuery = 0x7f030131;
public static final int fontStyle = 0x7f030132;
public static final int fontVariationSettings = 0x7f030133;
public static final int fontWeight = 0x7f030134;
public static final int keylines = 0x7f030174;
public static final int layout_anchor = 0x7f03017b;
public static final int layout_anchorGravity = 0x7f03017c;
public static final int layout_behavior = 0x7f03017d;
public static final int layout_dodgeInsetEdges = 0x7f0301a9;
public static final int layout_insetEdge = 0x7f0301b2;
public static final int layout_keyline = 0x7f0301b3;
public static final int statusBarBackground = 0x7f030246;
public static final int ttcIndex = 0x7f0302bc;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f0500c5;
public static final int notification_icon_bg_color = 0x7f0500c6;
public static final int notification_material_background_media_default_color = 0x7f0500c7;
public static final int primary_text_default_material_dark = 0x7f0500cd;
public static final int ripple_material_light = 0x7f0500d5;
public static final int secondary_text_default_material_dark = 0x7f0500d6;
public static final int secondary_text_default_material_light = 0x7f0500d7;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f060053;
public static final int compat_button_inset_vertical_material = 0x7f060054;
public static final int compat_button_padding_horizontal_material = 0x7f060055;
public static final int compat_button_padding_vertical_material = 0x7f060056;
public static final int compat_control_corner_material = 0x7f060057;
public static final int compat_notification_large_icon_max_height = 0x7f060058;
public static final int compat_notification_large_icon_max_width = 0x7f060059;
public static final int notification_action_icon_size = 0x7f060140;
public static final int notification_action_text_size = 0x7f060141;
public static final int notification_big_circle_margin = 0x7f060142;
public static final int notification_content_margin_start = 0x7f060143;
public static final int notification_large_icon_height = 0x7f060144;
public static final int notification_large_icon_width = 0x7f060145;
public static final int notification_main_column_padding_top = 0x7f060146;
public static final int notification_media_narrow_margin = 0x7f060147;
public static final int notification_right_icon_size = 0x7f060148;
public static final int notification_right_side_padding_top = 0x7f060149;
public static final int notification_small_icon_background_padding = 0x7f06014a;
public static final int notification_small_icon_size_as_large = 0x7f06014b;
public static final int notification_subtext_size = 0x7f06014c;
public static final int notification_top_pad = 0x7f06014d;
public static final int notification_top_pad_large_text = 0x7f06014e;
public static final int subtitle_corner_radius = 0x7f06014f;
public static final int subtitle_outline_width = 0x7f060150;
public static final int subtitle_shadow_offset = 0x7f060151;
public static final int subtitle_shadow_radius = 0x7f060152;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f0700a6;
public static final int notification_bg = 0x7f0700a7;
public static final int notification_bg_low = 0x7f0700a8;
public static final int notification_bg_low_normal = 0x7f0700a9;
public static final int notification_bg_low_pressed = 0x7f0700aa;
public static final int notification_bg_normal = 0x7f0700ab;
public static final int notification_bg_normal_pressed = 0x7f0700ac;
public static final int notification_icon_background = 0x7f0700ad;
public static final int notification_template_icon_bg = 0x7f0700ae;
public static final int notification_template_icon_low_bg = 0x7f0700af;
public static final int notification_tile_bg = 0x7f0700b0;
public static final int notify_panel_notification_icon_bg = 0x7f0700b1;
}
public static final class id {
private id() {}
public static final int action0 = 0x7f08002d;
public static final int action_container = 0x7f080035;
public static final int action_divider = 0x7f080037;
public static final int action_image = 0x7f080038;
public static final int action_text = 0x7f08003e;
public static final int actions = 0x7f08003f;
public static final int async = 0x7f080048;
public static final int blocking = 0x7f08004d;
public static final int bottom = 0x7f08004e;
public static final int cancel_action = 0x7f080053;
public static final int chronometer = 0x7f080062;
public static final int end = 0x7f080085;
public static final int end_padder = 0x7f080086;
public static final int forever = 0x7f080096;
public static final int icon = 0x7f0800a2;
public static final int icon_group = 0x7f0800a3;
public static final int info = 0x7f0800ad;
public static final int italic = 0x7f0800af;
public static final int left = 0x7f0800b4;
public static final int line1 = 0x7f0800b6;
public static final int line3 = 0x7f0800b7;
public static final int media_actions = 0x7f0800bc;
public static final int none = 0x7f0800df;
public static final int normal = 0x7f0800e0;
public static final int notification_background = 0x7f0800e1;
public static final int notification_main_column = 0x7f0800e2;
public static final int notification_main_column_container = 0x7f0800e3;
public static final int right = 0x7f0800fe;
public static final int right_icon = 0x7f0800ff;
public static final int right_side = 0x7f080100;
public static final int start = 0x7f08012d;
public static final int status_bar_latest_event_content = 0x7f08012e;
public static final int tag_transition_group = 0x7f080139;
public static final int tag_unhandled_key_event_manager = 0x7f08013a;
public static final int tag_unhandled_key_listeners = 0x7f08013b;
public static final int text = 0x7f080144;
public static final int text2 = 0x7f080145;
public static final int time = 0x7f080163;
public static final int title = 0x7f080164;
public static final int top = 0x7f08016c;
}
public static final class integer {
private integer() {}
public static final int cancel_button_image_alpha = 0x7f090004;
public static final int status_bar_notification_info_maxnum = 0x7f090015;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f0b005a;
public static final int notification_action_tombstone = 0x7f0b005b;
public static final int notification_media_action = 0x7f0b005c;
public static final int notification_media_cancel_action = 0x7f0b005d;
public static final int notification_template_big_media = 0x7f0b005e;
public static final int notification_template_big_media_custom = 0x7f0b005f;
public static final int notification_template_big_media_narrow = 0x7f0b0060;
public static final int notification_template_big_media_narrow_custom = 0x7f0b0061;
public static final int notification_template_custom_big = 0x7f0b0062;
public static final int notification_template_icon_group = 0x7f0b0063;
public static final int notification_template_lines_media = 0x7f0b0064;
public static final int notification_template_media = 0x7f0b0065;
public static final int notification_template_media_custom = 0x7f0b0066;
public static final int notification_template_part_chronometer = 0x7f0b0067;
public static final int notification_template_part_time = 0x7f0b0068;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0e0076;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0f015d;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0f015e;
public static final int TextAppearance_Compat_Notification_Info_Media = 0x7f0f015f;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0160;
public static final int TextAppearance_Compat_Notification_Line2_Media = 0x7f0f0161;
public static final int TextAppearance_Compat_Notification_Media = 0x7f0f0162;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0163;
public static final int TextAppearance_Compat_Notification_Time_Media = 0x7f0f0164;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0165;
public static final int TextAppearance_Compat_Notification_Title_Media = 0x7f0f0166;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0f024a;
public static final int Widget_Compat_NotificationActionText = 0x7f0f024b;
public static final int Widget_Support_CoordinatorLayout = 0x7f0f02b7;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f030028 };
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[] CoordinatorLayout = { 0x7f030174, 0x7f030246 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f03017b, 0x7f03017c, 0x7f03017d, 0x7f0301a9, 0x7f0301b2, 0x7f0301b3 };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f03012c, 0x7f03012d, 0x7f03012e, 0x7f03012f, 0x7f030130, 0x7f030131 };
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, 0x7f03012a, 0x7f030132, 0x7f030133, 0x7f030134, 0x7f0302bc };
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;
}
}
| [
"aarondc007@gmail.com"
] | aarondc007@gmail.com |
1904f01d6c7abf6593be29ba5f1e2c2c25696d56 | 7ac8059699c596995ab987549e5243cbbcd8b864 | /src/test/java/com/workec/ectp/components/CaseComponentTest.java | 0ca66378df82d7e6d78594e759e07ca2542fc1c3 | [] | no_license | jojoya/ectp | 2975f54f9cb0c6323246d96eb97475c76fc2b818 | 5f959afd69673d6e952fc68715351ee78e7e1a00 | refs/heads/master | 2022-06-22T21:00:39.064926 | 2019-08-27T14:10:25 | 2019-08-27T14:10:25 | 111,214,389 | 3 | 1 | null | 2022-06-21T00:41:59 | 2017-11-18T15:00:54 | Java | UTF-8 | Java | false | false | 645 | java | package com.workec.ectp.components;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.text.SimpleDateFormat;
/**
* Created by user on 2018/3/12.
*/
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CaseComponentTest {
@Autowired
CaseComponent caseComponent = new CaseComponent();
@Test
public void testExecuteByCaseId() throws Exception {
}
} | [
"cai0ling@163.com"
] | cai0ling@163.com |
865050743130835e5f186ef95e4dc4818217756a | ef38d70d9b0c20da068d967e089046e626b60dea | /jmeter/104SATDmethods/263/afterReport.java | eed9386153c928a5d38d3f392c27943f0a8cd3d1 | [] | no_license | martapanc/SATD-replication-package | 0ea0e8a27582750d39f8742b3b9b2e81bb7ec25d | e3235d25235b3b46416239ee9764bfeccd2d7433 | refs/heads/master | 2021-07-18T14:28:24.543613 | 2020-07-10T09:04:40 | 2020-07-10T09:04:40 | 94,113,844 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,966 | java | /263/report.java
Satd-method: // NOTUSED private String chosenFile;
********************************************
********************************************
/263/After/Bug 36755 6f1c66ae_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 36755 e861ae37_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 42346 ecb301a2_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 42428 93d0af85_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 43283 45a133a6_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 52097 3e87a3df_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 52997 3a2f36ba_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 52997 7c669726_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 52997 7ccb6983_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 55693 49338443_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 55693 ea6580c1_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 57061 ceaf2b7c_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 57913 46eb9d63_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 57913 75ab5a73_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 58699 eba38b51_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
/263/After/Bug 60564 c6a82dfa_diff.java
————————————————————————————————————————————————
*** Lines Changed in Satd-Method: ***
Lines added: 0. Lines removed: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls OF Satd-Method in Diff: ***
Comment:
Lines added containing method: 0. Lines removed containing method: 0. Tot = 0
————————————————————————————————————————————————
*** Changed calls of methods FROM Satd-Method in Diff: ***
Method calls found:
********************************************
********************************************
| [
"marta.pancaldi@stud-inf.unibz.it"
] | marta.pancaldi@stud-inf.unibz.it |
e5f34e705b97ada234b54597a91ad20280d13749 | c2f9d69a16986a2690e72718783472fc624ded18 | /com/whatsapp/b2.java | 18bfd2c2d9c4fc8a64752e5f56e7dbfc789fb4a1 | [] | no_license | mithileshongit/WhatsApp-Descompilado | bc973e1356eb043661a2efc30db22bcc1392d7f3 | 94a9d0b1c46bb78676ac401572aa11f60e12345e | refs/heads/master | 2021-01-16T20:56:27.864244 | 2015-02-09T04:08:40 | 2015-02-09T04:08:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package com.whatsapp;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
class b2 implements TextWatcher {
final CountryPicker a;
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
b7.a(CountryPicker.b(this.a), charSequence);
CountryPicker.a(this.a).setVisibility(TextUtils.isEmpty(charSequence) ? 8 : 0);
CountryPicker.c(this.a).getFilter().filter(charSequence);
}
b2(CountryPicker countryPicker) {
this.a = countryPicker;
}
public void afterTextChanged(Editable editable) {
}
}
| [
"hjcf@cin.ufpe.br"
] | hjcf@cin.ufpe.br |
a019431be6b380e2f11366e904acf85f91edb36e | 6e51db78a35385e60e23ce34f09d333e7f5a9758 | /src/test/java/com/rfb/web/rest/ExerciseResourceIT.java | 4f39201043f717b3fc8a118d680af1e99da942e7 | [] | no_license | fernd123/rfb-loyalty-jhipster | 45e207cd9c5c1658ba2980bffef326544aa720d0 | 2ac02362edee5a391c0f9d76276e3cf3e2964ee8 | refs/heads/master | 2023-05-14T09:47:48.057655 | 2019-06-16T20:51:47 | 2019-06-16T20:51:47 | 189,242,671 | 0 | 0 | null | 2023-05-01T05:58:29 | 2019-05-29T14:33:20 | Java | UTF-8 | Java | false | false | 11,930 | java | package com.rfb.web.rest;
import com.rfb.RfbloyaltyApp;
import com.rfb.domain.Exercise;
import com.rfb.repository.ExerciseRepository;
import com.rfb.web.rest.errors.ExceptionTranslator;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.MockitoAnnotations;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.Validator;
import javax.persistence.EntityManager;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.List;
import static com.rfb.web.rest.TestUtil.createFormattingConversionService;
import static org.assertj.core.api.Assertions.assertThat;
import static org.hamcrest.Matchers.hasItem;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
/**
* Integration tests for the {@Link ExerciseResource} REST controller.
*/
@SpringBootTest(classes = RfbloyaltyApp.class)
public class ExerciseResourceIT {
private static final Instant DEFAULT_CREATION_DATE = Instant.ofEpochMilli(0L);
private static final Instant UPDATED_CREATION_DATE = Instant.now().truncatedTo(ChronoUnit.MILLIS);
private static final String DEFAULT_NAME = "AAAAAAAAAA";
private static final String UPDATED_NAME = "BBBBBBBBBB";
private static final String DEFAULT_DESCRIPTION = "AAAAAAAAAA";
private static final String UPDATED_DESCRIPTION = "BBBBBBBBBB";
private static final String DEFAULT_URL = "AAAAAAAAAA";
private static final String UPDATED_URL = "BBBBBBBBBB";
@Autowired
private ExerciseRepository exerciseRepository;
@Autowired
private MappingJackson2HttpMessageConverter jacksonMessageConverter;
@Autowired
private PageableHandlerMethodArgumentResolver pageableArgumentResolver;
@Autowired
private ExceptionTranslator exceptionTranslator;
@Autowired
private EntityManager em;
@Autowired
private Validator validator;
private MockMvc restExerciseMockMvc;
private Exercise exercise;
@BeforeEach
public void setup() {
MockitoAnnotations.initMocks(this);
final ExerciseResource exerciseResource = new ExerciseResource(exerciseRepository);
this.restExerciseMockMvc = MockMvcBuilders.standaloneSetup(exerciseResource)
.setCustomArgumentResolvers(pageableArgumentResolver)
.setControllerAdvice(exceptionTranslator)
.setConversionService(createFormattingConversionService())
.setMessageConverters(jacksonMessageConverter)
.setValidator(validator).build();
}
/**
* Create an entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Exercise createEntity(EntityManager em) {
Exercise exercise = new Exercise()
.creationDate(DEFAULT_CREATION_DATE)
.name(DEFAULT_NAME)
.description(DEFAULT_DESCRIPTION)
.url(DEFAULT_URL);
return exercise;
}
/**
* Create an updated entity for this test.
*
* This is a static method, as tests for other entities might also need it,
* if they test an entity which requires the current entity.
*/
public static Exercise createUpdatedEntity(EntityManager em) {
Exercise exercise = new Exercise()
.creationDate(UPDATED_CREATION_DATE)
.name(UPDATED_NAME)
.description(UPDATED_DESCRIPTION)
.url(UPDATED_URL);
return exercise;
}
@BeforeEach
public void initTest() {
exercise = createEntity(em);
}
@Test
@Transactional
public void createExercise() throws Exception {
int databaseSizeBeforeCreate = exerciseRepository.findAll().size();
// Create the Exercise
restExerciseMockMvc.perform(post("/api/exercises")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(exercise)))
.andExpect(status().isCreated());
// Validate the Exercise in the database
List<Exercise> exerciseList = exerciseRepository.findAll();
assertThat(exerciseList).hasSize(databaseSizeBeforeCreate + 1);
Exercise testExercise = exerciseList.get(exerciseList.size() - 1);
assertThat(testExercise.getCreationDate()).isEqualTo(DEFAULT_CREATION_DATE);
assertThat(testExercise.getName()).isEqualTo(DEFAULT_NAME);
assertThat(testExercise.getDescription()).isEqualTo(DEFAULT_DESCRIPTION);
assertThat(testExercise.getUrl()).isEqualTo(DEFAULT_URL);
}
@Test
@Transactional
public void createExerciseWithExistingId() throws Exception {
int databaseSizeBeforeCreate = exerciseRepository.findAll().size();
// Create the Exercise with an existing ID
exercise.setId(1L);
// An entity with an existing ID cannot be created, so this API call must fail
restExerciseMockMvc.perform(post("/api/exercises")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(exercise)))
.andExpect(status().isBadRequest());
// Validate the Exercise in the database
List<Exercise> exerciseList = exerciseRepository.findAll();
assertThat(exerciseList).hasSize(databaseSizeBeforeCreate);
}
@Test
@Transactional
public void checkNameIsRequired() throws Exception {
int databaseSizeBeforeTest = exerciseRepository.findAll().size();
// set the field null
exercise.setName(null);
// Create the Exercise, which fails.
restExerciseMockMvc.perform(post("/api/exercises")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(exercise)))
.andExpect(status().isBadRequest());
List<Exercise> exerciseList = exerciseRepository.findAll();
assertThat(exerciseList).hasSize(databaseSizeBeforeTest);
}
@Test
@Transactional
public void getAllExercises() throws Exception {
// Initialize the database
exerciseRepository.saveAndFlush(exercise);
// Get all the exerciseList
restExerciseMockMvc.perform(get("/api/exercises?sort=id,desc"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.[*].id").value(hasItem(exercise.getId().intValue())))
.andExpect(jsonPath("$.[*].creationDate").value(hasItem(DEFAULT_CREATION_DATE.toString())))
.andExpect(jsonPath("$.[*].name").value(hasItem(DEFAULT_NAME.toString())))
.andExpect(jsonPath("$.[*].description").value(hasItem(DEFAULT_DESCRIPTION.toString())))
.andExpect(jsonPath("$.[*].url").value(hasItem(DEFAULT_URL.toString())));
}
@Test
@Transactional
public void getExercise() throws Exception {
// Initialize the database
exerciseRepository.saveAndFlush(exercise);
// Get the exercise
restExerciseMockMvc.perform(get("/api/exercises/{id}", exercise.getId()))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE))
.andExpect(jsonPath("$.id").value(exercise.getId().intValue()))
.andExpect(jsonPath("$.creationDate").value(DEFAULT_CREATION_DATE.toString()))
.andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
.andExpect(jsonPath("$.description").value(DEFAULT_DESCRIPTION.toString()))
.andExpect(jsonPath("$.url").value(DEFAULT_URL.toString()));
}
@Test
@Transactional
public void getNonExistingExercise() throws Exception {
// Get the exercise
restExerciseMockMvc.perform(get("/api/exercises/{id}", Long.MAX_VALUE))
.andExpect(status().isNotFound());
}
@Test
@Transactional
public void updateExercise() throws Exception {
// Initialize the database
exerciseRepository.saveAndFlush(exercise);
int databaseSizeBeforeUpdate = exerciseRepository.findAll().size();
// Update the exercise
Exercise updatedExercise = exerciseRepository.findById(exercise.getId()).get();
// Disconnect from session so that the updates on updatedExercise are not directly saved in db
em.detach(updatedExercise);
updatedExercise
.creationDate(UPDATED_CREATION_DATE)
.name(UPDATED_NAME)
.description(UPDATED_DESCRIPTION)
.url(UPDATED_URL);
restExerciseMockMvc.perform(put("/api/exercises")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(updatedExercise)))
.andExpect(status().isOk());
// Validate the Exercise in the database
List<Exercise> exerciseList = exerciseRepository.findAll();
assertThat(exerciseList).hasSize(databaseSizeBeforeUpdate);
Exercise testExercise = exerciseList.get(exerciseList.size() - 1);
assertThat(testExercise.getCreationDate()).isEqualTo(UPDATED_CREATION_DATE);
assertThat(testExercise.getName()).isEqualTo(UPDATED_NAME);
assertThat(testExercise.getDescription()).isEqualTo(UPDATED_DESCRIPTION);
assertThat(testExercise.getUrl()).isEqualTo(UPDATED_URL);
}
@Test
@Transactional
public void updateNonExistingExercise() throws Exception {
int databaseSizeBeforeUpdate = exerciseRepository.findAll().size();
// Create the Exercise
// If the entity doesn't have an ID, it will throw BadRequestAlertException
restExerciseMockMvc.perform(put("/api/exercises")
.contentType(TestUtil.APPLICATION_JSON_UTF8)
.content(TestUtil.convertObjectToJsonBytes(exercise)))
.andExpect(status().isBadRequest());
// Validate the Exercise in the database
List<Exercise> exerciseList = exerciseRepository.findAll();
assertThat(exerciseList).hasSize(databaseSizeBeforeUpdate);
}
@Test
@Transactional
public void deleteExercise() throws Exception {
// Initialize the database
exerciseRepository.saveAndFlush(exercise);
int databaseSizeBeforeDelete = exerciseRepository.findAll().size();
// Delete the exercise
restExerciseMockMvc.perform(delete("/api/exercises/{id}", exercise.getId())
.accept(TestUtil.APPLICATION_JSON_UTF8))
.andExpect(status().isNoContent());
// Validate the database is empty
List<Exercise> exerciseList = exerciseRepository.findAll();
assertThat(exerciseList).hasSize(databaseSizeBeforeDelete - 1);
}
@Test
@Transactional
public void equalsVerifier() throws Exception {
TestUtil.equalsVerifier(Exercise.class);
Exercise exercise1 = new Exercise();
exercise1.setId(1L);
Exercise exercise2 = new Exercise();
exercise2.setId(exercise1.getId());
assertThat(exercise1).isEqualTo(exercise2);
exercise2.setId(2L);
assertThat(exercise1).isNotEqualTo(exercise2);
exercise1.setId(null);
assertThat(exercise1).isNotEqualTo(exercise2);
}
}
| [
"frodriguezsidro@gmail.com"
] | frodriguezsidro@gmail.com |
858c587432e99c8730cffa53f8920c8ab29a07fc | 16784285935257ccd7bf3f347d3fcc0476f23cc9 | /spring-boot-hello/src/main/java/indi/com/SpringBootHelloApplication.java | 6e7f5de294e009b19d880def107560ef1b295070 | [] | no_license | Jrepository/spring-boot-learning-examples | 2c612687a12d3823d8b7419b0f8a0d285acb9c68 | 42d1130c68b319582693f8a2970a6efcf5b2daa2 | refs/heads/master | 2020-07-27T22:43:40.525552 | 2019-10-11T02:14:18 | 2019-10-11T02:14:18 | 208,971,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 327 | java | package indi.com;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringBootHelloApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootHelloApplication.class,args);
}
} | [
""
] | |
99f026474bab97056754f38e5f5ceb0bab3f01da | a51aab901bf75e18a4bcd6e35038d1d4536dbaec | /syGeneralFramework/src/main/java/com/sy/commons/persistence/annotation/Relation.java | c2a2bf9c84dd022b988c3db5f545b180a671b014 | [] | no_license | Darrenwdq/syGeneralFramework | 9178f11a34db4e64808dacbd3329ea56091bedd4 | 9454dc9b54aa92b8b7b280e878109c7e8782f22c | refs/heads/master | 2021-01-12T06:15:31.981595 | 2017-02-10T01:17:41 | 2017-02-10T01:17:41 | 77,332,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 436 | java | package com.sy.commons.persistence.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* 表名注解
*
* 创建日期:2012-9-19
* @author wangk
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Relation {
/** 表名 */
public String value();
}
| [
"software_wdq@163.com"
] | software_wdq@163.com |
b989240bc91454173b66fa3bab44cd95628a03f7 | b9833f6c49aceb8b92b679eb12a14589ebde9806 | /src/com/javarush/test/level24/lesson02/task02/Solution.java | 82752ab7ca18642eda27220b87c5cdb061bd6758 | [] | no_license | nakoryak/JavaRushHomeWork | 067b6ef4cbeeafa7af666a3d4b11c51c08406f8b | 169fdb796791300b76c04a5ab537a99cd58f9f49 | refs/heads/master | 2021-01-25T05:22:21.713925 | 2015-12-06T18:16:31 | 2015-12-06T18:16:31 | 32,967,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 781 | java | package com.javarush.test.level24.lesson02.task02;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.server.RemoteObject;
import java.util.ArrayDeque;
import java.util.EventListener;
/* Так-с...сопоставим
Исправьте ошибки: переместите методы clone в те классы, в которых они должны быть реализованы.
Лишние методы удалите.
*/
public class Solution {
public static class A implements Serializable {
}
public static class B implements Remote {
}
public static class C extends ArrayDeque {
public C clone() {
return (C) super.clone();
}
}
public static class D implements EventListener {
}
}
| [
"nakoryak@gmail.com"
] | nakoryak@gmail.com |
4782e8f3410f2fa7f586bffdc3c322807fba2541 | 52a6a5ec1961fab95eda7c1b5df5a35b257710b8 | /src/Add_remove.java | 86b2c3eda8be82b931d25d5463983ee3a8f5462d | [] | no_license | b5710547221/Project_Programming_1 | 2d89aec4051c8384c4608996b0948b2bf214774a | ee87e691b82bf6277f01fcef697e686364858575 | refs/heads/master | 2021-08-29T22:53:36.351738 | 2017-12-15T06:51:37 | 2017-12-15T06:51:37 | 110,816,399 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,705 | java |
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import javax.swing.JButton;
import javax.swing.JDialog;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.awt.event.ActionEvent;
import javax.swing.ImageIcon;
public class Add_remove {
public JFrame frame;
private JTextField name;
private JTextField lastName;
private JTextField age;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
Add_remove window = new Add_remove();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public Add_remove() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 559, 445);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
name = new JTextField("name");
name.setBounds(309, 47, 224, 19);
frame.getContentPane().add(name);
name.setColumns(10);
if (!Customer.getName().equals(null)) {
name.setText(Customer.getName());
} else {
name.setText("");
}
name.setEditable(false);
lastName = new JTextField("lastname");
lastName.setColumns(10);
if (!Customer.getLastName().equals(null)) {
lastName.setText(Customer.getLastName());
} else {
name.setText("");
}
lastName.setEditable(false);
lastName.setBounds(309, 77, 224, 19);
frame.getContentPane().add(lastName);
age = new JTextField();
age.setColumns(10);
age.setBounds(309, 107, 85, 19);
frame.getContentPane().add(age);
JLabel lblName = new JLabel("Name");
lblName.setBounds(247, 50, 70, 15);
frame.getContentPane().add(lblName);
JLabel lblLastName = new JLabel("Last name");
lblLastName.setBounds(229, 80, 133, 15);
frame.getContentPane().add(lblLastName);
JLabel lblAge = new JLabel("Age");
lblAge.setBounds(260, 110, 42, 15);
frame.getContentPane().add(lblAge);
JLabel lblGender = new JLabel("Gender");
lblGender.setBounds(247, 131, 70, 30);
frame.getContentPane().add(lblGender);
JRadioButton rdbtnM = new JRadioButton("M");
rdbtnM.setBackground(Color.WHITE);
rdbtnM.setBounds(309, 133, 53, 23);
frame.getContentPane().add(rdbtnM);
JRadioButton rdbtnF = new JRadioButton("F");
rdbtnF.setBackground(Color.WHITE);
rdbtnF.setBounds(374, 134, 42, 23);
frame.getContentPane().add(rdbtnF);
JButton btnAddToDatabase = new JButton("add");
btnAddToDatabase.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String gender ="";
if(rdbtnM.isSelected()){
gender = "M";
}else if(rdbtnF.isSelected()){
gender = "F";
}
addMember(name.getText(),(age.getText()),gender);
JDialog prompt = new JDialog();
JLabel msg = new JLabel("Add!");
msg.setBounds(50, 50, 80, 50);
msg.setSize(100, 30);
prompt.setVisible(true);
prompt.setContentPane(msg);
prompt.setBounds(231, 50, 149, 23);
prompt.setSize(300, 300);
}
});
btnAddToDatabase.setIcon(new ImageIcon(Add_remove.class.getResource("/image/addBtn.jpg")));
btnAddToDatabase.setBackground(Color.GREEN);
btnAddToDatabase.setBounds(40, 232, 160, 52);
frame.getContentPane().add(btnAddToDatabase);
JButton btnBack = new JButton("Back");
btnBack.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Customer mem = new Customer();
frame.setVisible(false);
mem.frame.setVisible(true);
}
});
btnBack.setBounds(10, 370, 117, 25);
frame.getContentPane().add(btnBack);
JButton btnRemoveThisMember = new JButton("");
btnRemoveThisMember.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String gender ="";
if(rdbtnM.isSelected()){
gender = "M";
}else if(rdbtnF.isSelected()){
gender = "F";
}
removeMember(name.getText(),(age.getText()),gender);
JDialog prompt2 = new JDialog();
JLabel msg2 = new JLabel("Remove!");
msg2.setBounds(50, 50, 80, 50);
msg2.setSize(100, 30);
prompt2.setVisible(true);
prompt2.setContentPane(msg2);
prompt2.setBounds(231, 50, 149, 23);
prompt2.setSize(300, 300);
}
});
btnRemoveThisMember.setIcon(new ImageIcon(Add_remove.class.getResource("/image/RemoveBtn.jpg")));
btnRemoveThisMember.setBackground(Color.RED);
btnRemoveThisMember.setBounds(296, 232, 160, 52);
frame.getContentPane().add(btnRemoveThisMember);
JButton btnSearchDatabase = new JButton("Search member");
btnSearchDatabase.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.setVisible(false);
Human_resources human = new Human_resources();
human.frame.setVisible(true);
}
});
btnSearchDatabase.setBounds(400, 370, 133, 25);
frame.getContentPane().add(btnSearchDatabase);
JLabel bg = new JLabel("");
bg.setIcon(new ImageIcon(Add_remove.class.getResource("/image/AddBg.jpg")));
bg.setBounds(0, 0, 543, 406);
frame.getContentPane().add(bg);
}
public static void addMember(String member_name,String age, String gender){
String SQL = "INSERT INTO member (member_name,age,gender) "
+ "VALUES(?,?,?);";
try (Connection conn = connect();
PreparedStatement pstmt = conn.prepareStatement(SQL)) {
pstmt.setString(1, member_name);
//pstmt.setString(2, age);
pstmt.setInt(2, Integer.parseInt(age));
pstmt.setString(3, gender);
int rs = pstmt.executeUpdate();
System.out.println("insert successful!!");
conn.close();
} catch (SQLException ex) {
System.out.println("Connection Failed! Check output console");
ex.printStackTrace();
System.out.println(ex.getMessage());
return;
}
}
public static void removeMember(String member_name,String age, String gender){
String SQL = "DELETE FROM member WHERE member_name = ? AND age = ? AND gender = ?;";
try (Connection conn = connect();
PreparedStatement pstmt = conn.prepareStatement(SQL)) {
pstmt.setString(1, member_name);
//pstmt.setString(2, age);
pstmt.setInt(2, Integer.parseInt(age));
pstmt.setString(3, gender);
int rs = pstmt.executeUpdate();
System.out.println("delete successful!!");
conn.close();
} catch (SQLException ex) {
System.out.println("Connection Failed! Check output console");
ex.printStackTrace();
System.out.println(ex.getMessage());
return;
}
}
public static Connection connect() throws SQLException {
try {
Class.forName("org.postgresql.Driver");
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
System.out.println("Where is your PostgreSQL JDBC Driver? "
+ "Include in your library path!");
e1.printStackTrace();
}
//System.out.println("Success! connection");
return DriverManager.getConnection("jdbc:postgresql:postgres", "tbap",
"ionay999");
}
}
| [
"warat.n@ku.th"
] | warat.n@ku.th |
0676e91ce09091b6a169e37d07030a6a376f50f2 | dd79cbb44c81a375c4ccbd16aa2abb13d2cf0b0e | /app/src/main/java/com/anrongtec/laucher/adapter/VisitorAdapter.java | 09afd8f3941cc056c19277729fe5103f6610332b | [] | no_license | miniPinocchio/LaucherTj | 42771a2c4194d18c15c856b665cd5babb5a68dc8 | f9a31fb0a0c40638abcad65d238524f8afa864ad | refs/heads/master | 2021-04-15T09:48:44.732905 | 2018-04-23T02:45:08 | 2018-04-23T02:45:08 | 116,204,112 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,491 | java | package com.anrongtec.laucher.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.anrongtec.laucher.R;
import com.anrongtec.laucher.bean.AppModel;
import java.util.List;
/**
* Created by huiliu on 2018/3/25.
*
* @email liu594545591@126.com
* @introduce
*/
public class VisitorAdapter extends RecyclerView.Adapter<VisitorAdapter.VisitorHolder> {
private Context mContext;
private List<AppModel> mModels;
private View.OnClickListener mListener;
public VisitorAdapter(Context context, List<AppModel> models,View.OnClickListener listener) {
mContext = context;
mModels = models;
this.mListener = listener;
}
@Override
public VisitorHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View inflate = LayoutInflater.from(mContext).inflate(R.layout.item_main_tab_app, parent, false);
return new VisitorHolder(inflate);
}
@Override
public void onBindViewHolder(VisitorHolder holder, int position) {
final AppModel appModel = mModels.get(position);
holder.iv_tab_app.setImageDrawable(appModel.getLocalIcon());
holder.tv_tab_app.setText(appModel.getAppName());
holder.cb_manager_apps.setVisibility(View.GONE);
holder.rl_main_tab_app.setOnClickListener(mListener);
holder.rl_main_tab_app.setTag(position);
if ("com.android.contacts".equals(appModel.getAppPackName())){
holder.tv_tab_app.setText("电话");
}
}
@Override
public int getItemCount() {
return mModels.size() > 0 ? mModels.size() : 0;
}
class VisitorHolder extends RecyclerView.ViewHolder {
RelativeLayout rl_main_tab_app;
TextView tv_tab_app;
ImageView iv_tab_app;
CheckBox cb_manager_apps;
public VisitorHolder(View itemView) {
super(itemView);
tv_tab_app = (TextView) itemView.findViewById(R.id.tv_main_tab_app);
iv_tab_app = (ImageView) itemView.findViewById(R.id.iv_main_tab_app);
rl_main_tab_app = (RelativeLayout) itemView.findViewById(R.id.rl_main_tab_app);
cb_manager_apps = (CheckBox) itemView.findViewById(R.id.cb_manager_apps);
}
}
}
| [
"liu594545591@126.com"
] | liu594545591@126.com |
1adf74e30dc804faff1ba3de5338b177ee4af0b4 | 1bee303695520d34f3336ddca40862ac88675618 | /app/src/main/java/com/example/splashscreen/gangtok/shopping/DirectorateofHandicraft.java | 304c50455e1f654fb833a44d9cc8e49e2eb96e06 | [] | no_license | priyangshupal/RoamIndia | 61fd4e52697f03e700e100f3bd9d8ba3f6a0274d | 0f2d705aa1468d1dd6a3bb76e27bd42e7da31546 | refs/heads/master | 2020-07-21T17:47:12.255397 | 2020-02-15T17:25:22 | 2020-02-15T17:25:22 | 206,934,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,744 | java | package com.example.splashscreen.gangtok.shopping;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import com.example.splashscreen.DownloadImageFromInternet;
import com.example.splashscreen.R;
public class DirectorateofHandicraft extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_directorateof_handicraft);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
new DownloadImageFromInternet((ImageView) findViewById(R.id.directorateof_handicraft_image))
.execute("https://www.makemytrip.com/travel-guide/media/dg_image/gangtok/Directorate-of-Handicraft-&-Handloom-Abhishek-Kumar-Flickr-Creative-commons.jpg");
FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("geo:27.338385, 88.614710?q=Directorate of Handicrafts & Handloom, NH 31 A, Sungava, Gangtok, Sikkim"));
startActivity(intent);
}
});
}
}
| [
"priyangshupal@gmail.com"
] | priyangshupal@gmail.com |
56e81f792406506aec35db4e9ed2df7e916a1a79 | 08fbaf17a3cf267ea92fc8082ac2806615fbe20c | /src/com/example/testing/Activity0.java | b844f55c4d640343fbceb7d10b81521b35fab191 | [] | no_license | hram908/VinoMosaic | f8390842f52ef47c61aa245ccc4d6a0206ba26a0 | 661048500123cdc0a2322ad7e69da2a714f822a2 | refs/heads/master | 2021-01-16T20:13:50.439523 | 2013-10-01T00:50:46 | 2013-10-01T00:50:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 381 | java | package com.example.testing;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.os.Bundle;
public class Activity0 extends Activity {
@SuppressLint ("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid_item);
}
}
| [
"rickymng@gmail.com"
] | rickymng@gmail.com |
c60a61ffe4bf4ed3fe2cb82ae7f8d7f00d92f72f | 0f53ee6ddaaab766558e3ca88f34b7278ca84992 | /Phinapahu/src/org/management/actions/GoToMealsServlet.java | 58b2363d74338760a59c54edbb0b243e59053652 | [] | no_license | LaHuBeontra/WebEngProject | b3604ff838ba9a6575dd78b51da4f1ed82bb3f54 | ccbc970676ece7cce5d86ecc9a54842126d977f6 | refs/heads/master | 2020-03-17T05:39:45.498654 | 2018-07-17T13:56:19 | 2018-07-17T13:56:19 | 133,324,573 | 0 | 2 | null | 2018-07-11T06:43:27 | 2018-05-14T07:50:14 | JavaScript | UTF-8 | Java | false | false | 1,576 | java | package org.management.actions;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.login.FileService;
/**
* Servlet implementation class GoToMealsServlet
*/
@WebServlet(urlPatterns = "/GoToMealsServlet.java")
public class GoToMealsServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public GoToMealsServlet() {
super();
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.getWriter().append("Served at: ").append(request.getContextPath());
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String userName = (String) request.getSession().getAttribute("userName");
FileService fileService = new FileService();
request.setAttribute("userName", userName);
request.setAttribute("fileService", fileService);
RequestDispatcher rd = request.getRequestDispatcher("Essen.jsp");
rd.forward(request, response);
}
}
| [
"lahr@beontra.com"
] | lahr@beontra.com |
744c1b0e4778be2f5a3936bc32c7bf9729529e5f | 4acb40e47c17d4e6e2ba438a8458059e282f8807 | /src/nl/kadaster/schemas/bag_verstrekkingen/extract_selecties/v20090901/Gebied.java | ceb836aced71cb6d1ff7482df624c7e48e6bf886 | [] | no_license | DaanMeijer/postcode | 2ef3cb1054dd4c0f3b97039b1014ce5f932cb9c4 | d2f618b58941e0ebe70b36d31368c29d7b8fd80e | refs/heads/master | 2020-04-02T05:05:54.262969 | 2018-11-07T22:08:33 | 2018-11-07T22:08:33 | 154,052,354 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,793 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.3.1
// See <a href="https://javaee.github.io/jaxb-v2/">https://javaee.github.io/jaxb-v2/</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2018.10.20 at 11:46:10 AM CEST
//
package nl.kadaster.schemas.bag_verstrekkingen.extract_selecties.v20090901;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for Gebied complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="Gebied">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{http://www.kadaster.nl/schemas/bag-verstrekkingen/extract-selecties/v20090901}GebiedIdentificatie"/>
* <element ref="{http://www.kadaster.nl/schemas/bag-verstrekkingen/extract-selecties/v20090901}GebiedNaam" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Gebied", propOrder = {
"gebiedIdentificatie",
"gebiedNaam"
})
@XmlSeeAlso({
GebiedWPL.class,
GebiedNLD.class,
GebiedGEO.class
})
public class Gebied {
@XmlElement(name = "GebiedIdentificatie", required = true)
protected String gebiedIdentificatie;
@XmlElement(name = "GebiedNaam")
protected String gebiedNaam;
/**
* Gets the value of the gebiedIdentificatie property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGebiedIdentificatie() {
return gebiedIdentificatie;
}
/**
* Sets the value of the gebiedIdentificatie property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGebiedIdentificatie(String value) {
this.gebiedIdentificatie = value;
}
/**
* Gets the value of the gebiedNaam property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getGebiedNaam() {
return gebiedNaam;
}
/**
* Sets the value of the gebiedNaam property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGebiedNaam(String value) {
this.gebiedNaam = value;
}
}
| [
"daanmeijer@MBP-van-Daan.lan"
] | daanmeijer@MBP-van-Daan.lan |
79b260757336d865d35dd12c80a9927cb60759c9 | ff55908bbbd7a92d8d717b968a4f0b8a0909d556 | /ZLYQAnalyticsSDK/src/main/java/com/zlyq/client/android/analytics/net/gson/FieldNamingStrategy.java | 3278c6d5d4cecc52fe64a14884b02cc48201c493 | [] | no_license | zlzz-rec/zlyq-android-sdk | 143d2b91267cd1aafc3a87508b7b0d5cde688512 | 0f640d16335f00d337b996c66137f79a59d272a0 | refs/heads/master | 2022-12-17T07:08:00.925880 | 2020-09-25T06:29:27 | 2020-09-25T06:29:27 | 269,549,674 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,319 | java | /*
* Copyright (C) 2008 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.zlyq.client.android.analytics.net.gson;
import java.lang.reflect.Field;
/**
* A mechanism for providing custom field naming in EGson. This allows the client code to translate
* field names into a particular convention that is not supported as a normal Java field
* declaration rules. For example, Java does not support "-" characters in a field name.
*
* @author Inderjeet Singh
* @author Joel Leitch
* @since 1.3
*/
public interface FieldNamingStrategy {
/**
* Translates the field name into its JSON field name representation.
*
* @param f the field object that we are translating
* @return the translated field name.
* @since 1.3
*/
public String translateName(Field f);
}
| [
"tanfl@missfresh.cn"
] | tanfl@missfresh.cn |
5691ce35eac042983be03fa2a80ea26a809d5b6d | a0cf34bea4ab198360cb9f39b5d754989f39108e | /src/main/java/org/upgrad/upstac/testrequests/consultation/ConsultationService.java | fb270ba6a401efe5dd329dd8c4450f0fc7cdf9e1 | [] | no_license | vkn02/UPSTAC-Week3-assignment | 8ae48d342939a122caa863c0a6c72ba87a3ec0fc | cdd5f0964520de514fbdc5c69f0f30bdb95d5680 | refs/heads/main | 2023-05-02T16:09:07.162442 | 2021-05-26T17:03:29 | 2021-05-26T17:03:29 | 371,097,193 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,551 | java | package org.upgrad.upstac.testrequests.consultation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import org.upgrad.upstac.exception.AppException;
import org.upgrad.upstac.testrequests.TestRequest;
import org.upgrad.upstac.users.User;
import javax.transaction.Transactional;
import java.time.LocalDate;
@Service
@Validated
public class ConsultationService {
private static final Logger logger = LoggerFactory.getLogger(ConsultationService.class);
@Autowired private ConsultationRepository consultationRepository;
@Transactional
public Consultation assignForConsultation(TestRequest testRequest, User doctor) {
Consultation consultation = new Consultation();
consultation.setDoctor(doctor);
consultation.setRequest(testRequest);
return consultationRepository.save(consultation);
}
public Consultation updateConsultation(
TestRequest testRequest, CreateConsultationRequest createConsultationRequest) {
Consultation consultation =
consultationRepository
.findByRequest(testRequest)
.orElseThrow(() -> new AppException("Invalid Request"));
consultation.setSuggestion(createConsultationRequest.getSuggestion());
consultation.setComments(createConsultationRequest.getComments());
consultation.setUpdatedOn(LocalDate.now());
return consultationRepository.save(consultation);
}
}
| [
"vishal.nair@delphix.com"
] | vishal.nair@delphix.com |
71ee51ed976ddab08eec27cb552579a15f0ffaed | b06f1c6284388511d4c07e441d83a5230b816364 | /Exercicio1/src/exerciciojava24/exerciciojava24.java | 0e730e501dedb58d2c31b8743645843bf1691ed2 | [] | no_license | ronanlutiane/Projetos-Eclipse | c1a2830fca10bcc83a01858c121d9b23f73fecfa | d0987b486229af325b1ceda053b5deb0c0282ffe | refs/heads/master | 2022-03-08T04:59:14.708012 | 2022-02-22T23:01:01 | 2022-02-22T23:01:01 | 177,876,363 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,220 | java | package exerciciojava24;
import java.util.Scanner;
public class exerciciojava24 {
public static void main(String[] args) {
// TODO Auto-generated method stub
String nome;
double salbase, salbruto, salhora, htrab;
int turno, codcargo;
Scanner entrada = new Scanner(System.in);
System.out.println("Informe o nome do funcionário: ");
nome = entrada.next();
System.out.println("Informe o código do cargo: ");
codcargo = entrada.nextInt();
System.out.println("Informe o turno de trabalho: ");
turno = entrada.nextInt();
System.out.println("Informe a quantidade de horas trabalhadas: ");
htrab = entrada.nextDouble();
if (codcargo == 1) {
salhora = 5.00;
salbase = salhora * htrab; }
else {
salhora = 8.00;
salbase = salhora * htrab; }
if (turno == 1) {
salbruto = salbase + (salbase * 3) / 100; }
else {
if (turno == 2) {
salbruto = salbase + (salbase * 4) / 100; }
else {
salbruto = salbase + (salbase * 5) / 100; }
System.out.println(salbruto);
}
}
}
| [
"47357259+ronanlutiane@users.noreply.github.com"
] | 47357259+ronanlutiane@users.noreply.github.com |
3fe0c177599e7e5edb6e11e542626a270f3a0d0a | d55fd3ab68565cf8818a4b29b7d4bcc46bb947c6 | /server/src/main/java/com/autonomous/pm/model/Dto/ResPoi.java | e58ee4a03becbb7e0ce6a134b5ffe8f6f3a5ba79 | [] | no_license | VAIP-foundation/autonomous-driving-control | 1ed1fe77bf4284e80a2aa0c71c054cde503ec3c3 | 7cbe5aef7fe6a5f018f4780cd6e3ccb7dd2d5006 | refs/heads/master | 2023-03-05T23:29:40.470438 | 2021-02-15T07:00:12 | 2021-02-15T07:00:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 621 | java | package com.autonomous.pm.model.Dto;
import javax.validation.constraints.NotNull;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter
@Setter
@ToString
@RequiredArgsConstructor
public class ResPoi
{
private Integer idPoi; // POI ID
private String poiCd; // POI 코드
private String poiNm; // POI 명
private Integer poiTy; // POI Type
private Double lng; // 경도
private Double lat; // 위도
private Integer ord; // 순서
private String idGop; // 권역
} | [
"richard@aivision.co.kr"
] | richard@aivision.co.kr |
771fa8c4e572a3e7e1d584f774043ba417d8b289 | 435a1f478647747b9d53247660ad1fb27b1f3d5a | /vieeo/vieeo-gen/src/main/java/com/vieeo/gen/service/support/FreemarkerTemplateService.java | c96b3700c4db0c78c87951972605924504a89cd4 | [] | no_license | happyjianguo/vieeo | 4c008fc18dfab597da4dc91303f7835420671186 | ff7e1195a5441f696a2e38dd3f55af2821a118e0 | refs/heads/master | 2020-06-20T04:22:31.065097 | 2015-04-14T03:01:14 | 2015-04-14T03:01:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,167 | java | package com.vieeo.gen.service.support;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.Map;
import com.vieeo.gen.config.TemplateConfig;
import com.vieeo.gen.service.TemplateService;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.Template;
public class FreemarkerTemplateService implements TemplateService{
private TemplateConfig config;
private Configuration cfg;
public void init(){
try {
String projectPath = config.getRootPath();
String path = config.getTemplatePath();
cfg = new Configuration();
File file = new File(projectPath+"/"+path);
cfg.setDirectoryForTemplateLoading(file);
cfg.setObjectWrapper(new DefaultObjectWrapper());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("初始化模版失败,请检查目录配置信息是否正确!");
}
}
@Override
public void process(Map<String,Object> params,String templateFile,String outputFileName) {
try {
Template template = cfg.getTemplate(templateFile, config.getEncoding());
if(template == null) throw new RuntimeException("未找到对应的模版,无法处理输出!");
File file = new File(config.getRootPath()+"/"+config.getOutputPath()+"/"+outputFileName);
System.out.println("生成文件:"+file.getPath());
if(!file.exists()) {
file.getParentFile().mkdirs();
file.createNewFile();
}else {
file.delete();
}
params.put("config", config);
OutputStream stream = new FileOutputStream(file);
Writer out = new OutputStreamWriter(stream);
template.process(params, out);
out.flush();
out.close();
stream.close();
}catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(outputFileName+"输出处理失败:"+e.getMessage());
}
}
public TemplateConfig getConfig() {
return config;
}
public void setConfig(TemplateConfig config) {
this.config = config;
}
public Configuration getCfg() {
return cfg;
}
public void setCfg(Configuration cfg) {
this.cfg = cfg;
}
}
| [
"lakerhe520@gmail.com"
] | lakerhe520@gmail.com |
c713db501b39536afef9e24d5692f34c389c8603 | 4ab508b377c4ca7f6f1c52f53a23b7e4b052a49e | /src/main/java/com/gora/ManaoServ/ManaoServApplication.java | c25a7795d1f86952d31983abca183675126b0180 | [] | no_license | Hiarpa/ManaoServSpring | f11d9d1ca209cd7f9e3cd56d9cc1ec6f36b4464f | 4b219177466ece03e81e7c65fe3143e06102fda0 | refs/heads/master | 2023-07-16T04:14:54.414842 | 2021-08-29T22:58:55 | 2021-08-29T22:58:55 | 400,957,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 317 | java | package com.gora.ManaoServ;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ManaoServApplication {
public static void main(String[] args) {
SpringApplication.run(ManaoServApplication.class, args);
}
}
| [
"hiarpanetto@gmail.com"
] | hiarpanetto@gmail.com |
ddbb9b5af3a5907fbcaea418edb77c974511fb45 | feed0d9c79600e61392f0cd75b7a4dbb22cbd70a | /tancolo-zxing-lib/ZXing-Library/zxinglibrary/src/main/java/com/google/zxing/tancolo/android/decode/DecodeHandler.java | 4ee1871bf188627169ec3538b0ebc4fd88f6fc32 | [] | no_license | tancolo/tancoloZXing | c3e24ebf6d2da97fb6b3be211995868bd8210f0d | 8c4bf67be2ebde6e011b24a0e6cc7f5d14321590 | refs/heads/master | 2022-06-16T21:47:32.132112 | 2022-05-12T08:17:31 | 2022-05-12T08:17:31 | 82,656,480 | 10 | 5 | null | null | null | null | UTF-8 | Java | false | false | 4,815 | java | /*
* Copyright (C) 2010 ZXing authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.zxing.tancolo.android.decode;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.util.Log;
import com.google.zxing.BinaryBitmap;
import com.google.zxing.DecodeHintType;
import com.google.zxing.MultiFormatReader;
import com.google.zxing.PlanarYUVLuminanceSource;
import com.google.zxing.ReaderException;
import com.google.zxing.Result;
import com.google.zxing.common.HybridBinarizer;
import com.google.zxing.tancolo.android.CaptureActivity;
import com.google.zxing.tancolo.android.R;
import java.io.ByteArrayOutputStream;
import java.util.Map;
final class DecodeHandler extends Handler {
private static final String TAG = DecodeHandler.class.getSimpleName();
private final CaptureActivity activity;
private final MultiFormatReader multiFormatReader;
private boolean running = true;
DecodeHandler(CaptureActivity activity, Map<DecodeHintType,Object> hints) {
multiFormatReader = new MultiFormatReader();
multiFormatReader.setHints(hints);
this.activity = activity;
}
@Override
public void handleMessage(Message message) {
if (!running) {
return;
}
// if(R.id.decode == message.what) {
// decode((byte[]) message.obj, message.arg1, message.arg2);
// }else if(R.id.quit == message.what) {
// running = false;
// Looper.myLooper().quit();
// }else {
//
// }
if (message.what == R.id.decode) {
decode((byte[]) message.obj, message.arg1, message.arg2);
} else if (message.what == R.id.quit) {
running = false;
Looper.myLooper().quit();
}
}
/**
* Decode the data within the viewfinder rectangle, and time how long it took. For efficiency,
* reuse the same reader objects from one decode to the next.
*
* @param data The YUV preview frame.
* @param width The width of the preview frame.
* @param height The height of the preview frame.
*/
private void decode(byte[] data, int width, int height) {
long start = System.currentTimeMillis();
//add by tancolo
if (width < height) {
// portrait
byte[] rotatedData = new byte[data.length];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++)
rotatedData[y * width + width - x - 1] = data[y + x * height];
}
data = rotatedData;
}
//end add
Result rawResult = null;
PlanarYUVLuminanceSource source = activity.getCameraManager().buildLuminanceSource(data, width, height);
if (source != null) {
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
rawResult = multiFormatReader.decodeWithState(bitmap);
} catch (ReaderException re) {
// continue
} finally {
multiFormatReader.reset();
}
}
Handler handler = activity.getHandler();
if (rawResult != null) {
// Don't log the barcode contents for security.
long end = System.currentTimeMillis();
Log.d(TAG, "Found barcode in " + (end - start) + " ms");
//Log.d(TAG, Log.getStackTraceString(new Throwable()));
if (handler != null) {
Message message = Message.obtain(handler, R.id.decode_succeeded, rawResult);
Bundle bundle = new Bundle();
bundleThumbnail(source, bundle);
message.setData(bundle);
message.sendToTarget();
}
} else {
if (handler != null) {
Message message = Message.obtain(handler, R.id.decode_failed);
message.sendToTarget();
}
}
}
private static void bundleThumbnail(PlanarYUVLuminanceSource source, Bundle bundle) {
int[] pixels = source.renderThumbnail();
int width = source.getThumbnailWidth();
int height = source.getThumbnailHeight();
Bitmap bitmap = Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.ARGB_8888);
ByteArrayOutputStream out = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 50, out);
bundle.putByteArray(DecodeThread.BARCODE_BITMAP, out.toByteArray());
bundle.putFloat(DecodeThread.BARCODE_SCALED_FACTOR, (float) width / source.getWidth());
}
}
| [
"shrimpcolo@gmail.com"
] | shrimpcolo@gmail.com |
1f2c3dcd20137214d0d380ed37750e1146d631db | 99dba576b483d5d0de3df276db3b9ebc54172583 | /anderskolsson.regserver/src/main/java/com/github/anderskolsson/regserver/RegServer.java | eaed7d6cb273540e029c32f55fccaa88db61ce4b | [] | no_license | AndersKOlsson/regserver | 1fbba3f1a30763107c1a4420f1d1b4db8ec75668 | 42deceef7b956c0d6f0517cd32f0c8fcb622e1e1 | refs/heads/master | 2021-05-02T11:21:48.999799 | 2015-11-16T05:34:54 | 2015-11-16T05:34:54 | 45,736,945 | 0 | 0 | null | 2018-06-28T11:12:59 | 2015-11-07T13:12:14 | Java | UTF-8 | Java | false | false | 2,262 | java | package com.github.anderskolsson.regserver;
import java.io.IOException;
import java.util.Arrays;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.glassfish.grizzly.http.server.HttpServer;
import com.sun.jersey.api.container.grizzly2.GrizzlyServerFactory;
import com.sun.jersey.api.core.DefaultResourceConfig;
import com.sun.jersey.api.core.ResourceConfig;
import com.github.anderskolsson.regserver.authentication.Authentication;
import com.github.anderskolsson.regserver.authentication.BcryptAuthentication;
import com.github.anderskolsson.regserver.datastore.DataStore;
import com.github.anderskolsson.regserver.datastore.DerbyDataStore;
import com.github.anderskolsson.regserver.inputvalidation.DefaultInputDataValidator;
import com.github.anderskolsson.regserver.inputvalidation.InputDataValidator;
import com.github.anderskolsson.regserver.rest.UserResource;
/**
* Handles the initiation of the Server
*
*/
public class RegServer {
private static final String API_VERSION = "v1";
private static final int PORT = 6789;
private static Logger logger;
public static void startServing(final Object ...objs) throws Exception{
logger.severe("Starting Server");
try {
final ResourceConfig resourceConfig = new DefaultResourceConfig();
resourceConfig.getSingletons().addAll(Arrays.asList(objs));
final HttpServer server = GrizzlyServerFactory.createHttpServer("http://localhost:"+PORT+"/"+API_VERSION, resourceConfig);
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
server.stop();
}
}));
server.start();
Thread.currentThread().join();
} catch (IOException | InterruptedException ex) {
logger.log(Level.SEVERE, null, ex);
}
}
public static void main(final String args[]) throws Exception {
logger = Logger.getLogger(RegServer.class.getName());
final Authentication auth = new BcryptAuthentication();
final DataStore store = new DerbyDataStore("default", auth.getHashLength());
final InputDataValidator validator = new DefaultInputDataValidator();
final UserResource res = new UserResource(store, auth, validator);
startServing(res);
}
}
| [
"anders.k.olsson@gmail.com"
] | anders.k.olsson@gmail.com |
242da3204e7aa339f465e142057dd3177a4e5fa3 | 8af1164bac943cef64e41bae312223c3c0e38114 | /results-java/stanfordnlp--CoreNLP/bfeab43e85b26199a104259ad65aa722b964dd1b/after/Execution.java | b5189372f6e2eeadf7a6a7ae85ca419a2d242f19 | [] | 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 | 20,010 | java | package edu.stanford.nlp.util;
import edu.stanford.nlp.util.logging.StanfordRedwoodConfiguration;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.lang.annotation.*;
import java.lang.reflect.Array;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.InetAddress;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import static edu.stanford.nlp.util.logging.Redwood.Util.*;
/*
* TODO(gabor) options for non-static files
*/
/**
* A class to set command line options. To use, create a static class into which you'd like
* to put your properties. Then, for each field, set the annotation:
*
* <pre>
* <code>
* import edu.stanford.nlp.util.Execution.Option
*
* class Props {
* @Option(name="anIntOption", required=false)
* public static int anIntOption = 7 // default value is 7
* @Option(name="anotherOption", required=false)
* public static File aCastableOption = new File("/foo")
* }
* </code>
* </pre>
*
* <p>
* You can then set options with {@link Execution#exec(Runnable, String[])},
* or with {@link Execution#fillOptions(java.util.Properties)}.
* </p>
*
* <p>
* If your default classpath has many classes in it, you can select a subset of them
* by using {@link Execution#fillOptions(Class[], java.util.Properties)}, or some variant.
* </p>
*/
public class Execution {
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Option {
String name() default "";
String gloss() default "";
boolean required() default false;
String alt() default "";
}
private static final String[] IGNORED_JARS = {
};
private static final Class[] BOOTSTRAP_CLASSES = {
Execution.class,
};
@Option(name = "option_classes", gloss = "Fill options from these classes")
public static Class<?>[] optionClasses = null;
@Option(name = "threads", gloss = "Number of threads on machine")
public static int threads = Runtime.getRuntime().availableProcessors();
@Option(name = "host", gloss = "Name of computer we are running on")
public static String host = "(unknown)";
static {
try {
host = InetAddress.getLocalHost().getHostName();
} catch (Exception ignored) {
}
}
/**
* A lazy iterator over files, not loading all of them into memory at once.
*/
public static class LazyFileIterator implements Iterator<File> {
private FilenameFilter filter;
private File[] dir;
private Stack<File[]> parents = new Stack<File[]>();
private Stack<Integer> indices = new Stack<Integer>();
private int toReturn = -1;
public LazyFileIterator(String path) {
this(new File(path));
}
public LazyFileIterator(File path) {
this(path, new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return true;
}
});
}
public LazyFileIterator(String path, FilenameFilter filter) {
this(new File(path), filter);
}
public LazyFileIterator(String path, final String filter) {
this(new File(path), filter);
}
public LazyFileIterator(File path, final String filter) {
this(path, new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
String path = (dir.getPath() + "/" + name);
return new File(path).isDirectory() || path.matches(filter);
}
});
}
public LazyFileIterator(File dir, FilenameFilter filter) {
if (!dir.exists()) throw new IllegalArgumentException("Could not find directory: " + dir.getPath());
if (!dir.isDirectory()) throw new IllegalArgumentException("Not a directory: " + dir.getPath());
this.filter = filter;
this.dir = dir.listFiles(filter);
enqueue();
}
private void enqueue() {
toReturn += 1;
boolean good = (toReturn < dir.length && !dir[toReturn].isDirectory());
while (!good) {
if (toReturn >= dir.length) {
//(case: pop)
if (parents.isEmpty()) {
toReturn = -1;
return; //this is where we exit
} else {
dir = parents.pop();
toReturn = indices.pop();
}
} else if (dir[toReturn].isDirectory()) {
//(case: push)
parents.push(dir);
indices.push(toReturn + 1);
dir = dir[toReturn].listFiles(filter);
toReturn = 0;
} else {
throw new IllegalStateException("File is invalid, but in range and not a directory: " + dir[toReturn]);
}
//(check if good)
good = (toReturn < dir.length && !dir[toReturn].isDirectory());
}
// if we reach here we found something
}
@Override
public boolean hasNext() {
return toReturn >= 0;
}
@Override
public File next() {
if (toReturn >= dir.length || toReturn < 0) throw new IllegalStateException("No more elements!");
File rtn = dir[toReturn];
enqueue();
return rtn;
}
@Override
public void remove() {
throw new IllegalArgumentException("NOT IMPLEMENTED");
}
}
/*
* ----------
* OPTIONS
* ----------
*/
private static void fillField(Field f, String value) {
try {
//--Permissions
boolean accessState = true;
if (Modifier.isFinal(f.getModifiers())) {
fatal("Option cannot be final: " + f);
}
if (!f.isAccessible()) {
accessState = false;
f.setAccessible(true);
}
//--Set Value
Object objVal = MetaClass.cast(value, f.getGenericType());
if (objVal != null) {
if (objVal.getClass().isArray()) {
//(case: array)
Object[] array = (Object[]) objVal;
// error check
if (!f.getType().isArray()) {
fatal("Setting an array to a non-array field. field: " + f + " value: " + Arrays.toString(array) + " src: " + value);
}
// create specific array
Object toSet = Array.newInstance(f.getType().getComponentType(), array.length);
for (int i = 0; i < array.length; i++) {
Array.set(toSet, i, array[i]);
}
// set value
f.set(null, toSet);
} else {
//case: not array
f.set(null, objVal);
}
} else {
fatal("Cannot assign option field: " + f + " value: " + value + "; invalid type");
}
//--Permissions
if (!accessState) {
f.setAccessible(false);
}
} catch (IllegalArgumentException e) {
err(e);
fatal("Cannot assign option field: " + f.getDeclaringClass().getCanonicalName() + "." + f.getName() + " value: " + value + " cause: " + e.getMessage());
} catch (IllegalAccessException e) {
err(e);
fatal("Cannot access option field: " + f.getDeclaringClass().getCanonicalName() + "." + f.getName());
} catch (Exception e) {
err(e);
fatal("Cannot assign option field: " + f.getDeclaringClass().getCanonicalName() + "." + f.getName() + " value: " + value + " cause: " + e.getMessage());
}
}
@SuppressWarnings("rawtypes")
private static final Class filePathToClass(String cpEntry, String path) {
if (path.length() <= cpEntry.length()) {
throw new IllegalArgumentException("Illegal path: cp=" + cpEntry
+ " path=" + path);
}
if (path.charAt(cpEntry.length()) != '/') {
throw new IllegalArgumentException("Illegal path: cp=" + cpEntry
+ " path=" + path);
}
path = path.substring(cpEntry.length() + 1);
path = path.replaceAll("/", ".").substring(0, path.length() - 6);
try {
return Class.forName(path,
false,
ClassLoader.getSystemClassLoader());
} catch (ClassNotFoundException e) {
throw fail("Could not load class at path: " + path);
} catch (NoClassDefFoundError ex) {
warn("Class at path " + path + " is unloadable");
return null;
}
}
private static final boolean isIgnored(String path) {
for (String ignore : IGNORED_JARS) {
if (path.endsWith(ignore)) {
return true;
}
}
return false;
}
public static final Class<?>[] getVisibleClasses() {
//--Variables
List<Class<?>> classes = new ArrayList<Class<?>>();
// (get classpath)
String pathSep = System.getProperty("path.separator");
String[] cp = System.getProperties().getProperty("java.class.path",
null).split(pathSep);
// --Fill Options
// (get classes)
for (String entry : cp) {
log("Checking cp " + entry);
//(should skip?)
if (entry.equals(".") || entry.trim().length() == 0) {
continue;
}
//(no, don't skip)
File f = new File(entry);
if (f.isDirectory()) {
// --Case: Files
LazyFileIterator iter = new LazyFileIterator(f, ".*class$");
while (iter.hasNext()) {
//(get the associated class)
Class<?> clazz = filePathToClass(entry, iter.next().getPath());
if (clazz != null) {
//(add the class if it's valid)
classes.add(clazz);
}
}
} else if (!isIgnored(entry)) {
// --Case: Jar
try {
JarFile jar = new JarFile(f);
Enumeration<JarEntry> e = jar.entries();
while (e.hasMoreElements()) {
//(for each jar file element)
JarEntry jarEntry = e.nextElement();
String clazz = jarEntry.getName();
if (clazz.matches(".*class$")) {
//(if it's a class)
clazz = clazz.substring(0, clazz.length() - 6)
.replaceAll("/", ".");
//(add it)
try {
classes.add(
Class.forName(clazz,
false,
ClassLoader.getSystemClassLoader()));
} catch (ClassNotFoundException ex) {
warn("Could not load class in jar: " + f + " at path: " + clazz);
} catch (NoClassDefFoundError ex) {
debug("Could not scan class: " + clazz + " (in jar: " + f + ")");
}
}
}
} catch (IOException e) {
warn("Could not open jar file: " + f + "(are you sure the file exists?)");
}
} else {
//case: ignored jar
}
}
return classes.toArray(new Class<?>[classes.size()]);
}
@SuppressWarnings("rawtypes")
protected static Map<String, Field> fillOptionsImpl(
Class<?>[] classes,
Properties options,
boolean ensureAllOptions) {
//--Get Fillable Options
Map<String, Field> canFill = new HashMap<String, Field>();
Map<String, Pair<Boolean, Boolean>> required = new HashMap<String, Pair<Boolean, Boolean>>(); /* <exists, is_set> */
Map<String, String> interner = new HashMap<String, String>();
for (Class c : classes) {
Field[] fields = null;
try {
fields = c.getDeclaredFields();
} catch (Throwable e) {
debug("Could not check fields for class: " + c.getName() + " (caused by " + e.getClass() + ": " + e.getMessage() + ")");
continue;
}
for (Field f : fields) {
Option o = f.getAnnotation(Option.class);
if (o != null) {
//(check if field is static)
if ((f.getModifiers() & Modifier.STATIC) == 0) {
fatal("Option can only be applied to static field: " + c + "." + f);
}
//(required marker)
Pair<Boolean, Boolean> mark = Pair.makePair(false, false);
if (o.required()) {
mark = Pair.makePair(true, false);
}
//(add main name)
String name = o.name().toLowerCase();
if (name.equals("")) {
name = f.getName().toLowerCase();
}
if (canFill.containsKey(name)) {
String name1 = canFill.get(name).getDeclaringClass().getCanonicalName() + "." + canFill.get(name).getName();
String name2 = f.getDeclaringClass().getCanonicalName() + "." + f.getName();
if (!name1.equals(name2)) {
fatal("Multiple declarations of option " + name + ": " + name1 + " and " + name2);
} else {
err("Class is in classpath multiple times: " + canFill.get(name).getDeclaringClass().getCanonicalName());
}
}
canFill.put(name, f);
required.put(name, mark);
interner.put(name, name);
//(add alternate names)
if (!o.alt().equals("")) {
for (String alt : o.alt().split(" *, *")) {
alt = alt.toLowerCase();
if (canFill.containsKey(alt) && !alt.equals(name))
throw new IllegalArgumentException("Multiple declarations of option " + alt + ": " + canFill.get(alt) + " and " + f);
canFill.put(alt, f);
if (mark.first) required.put(alt, mark);
interner.put(alt, name);
}
}
}
}
}
//--Fill Options
for (Object rawKey : options.keySet()) {
String rawKeyStr = rawKey.toString();
String key = rawKey.toString().toLowerCase();
// (get values)
String value = options.get(rawKey).toString();
assert value != null;
Field target = canFill.get(key);
// (mark required option as fulfilled)
Pair<Boolean, Boolean> mark = required.get(key);
if (mark != null && mark.first) {
required.put(key.toString(), Pair.makePair(true, true));
}
// (fill the field)
if (target != null) {
// (case: declared option)
fillField(target, value);
} else if (ensureAllOptions) {
// (case: undeclared option)
// split the key
int lastDotIndex = rawKeyStr.lastIndexOf('.');
if (lastDotIndex < 0) {
fatal("Unrecognized option: " + key);
}
String className = rawKeyStr.substring(0, lastDotIndex);
String fieldName = rawKeyStr.substring(lastDotIndex + 1);
// get the class
Class clazz = null;
try {
clazz = ClassLoader.getSystemClassLoader().loadClass(className);
} catch (Exception e) {
debug("Could not set option: " + rawKey + "; no such class: " + className);
}
// get the field
if (clazz != null) {
try {
target = clazz.getField(fieldName);
} catch (Exception e) {
debug("Could not set option: " + rawKey + "; no such field: " + fieldName + " in class: " + className);
}
fillField(target, value);
}
}
}
//--Ensure Required
boolean good = true;
for (String key : required.keySet()) {
Pair<Boolean, Boolean> mark = required.get(key);
if (mark.first && !mark.second) {
err("Missing required option: " + interner.get(key) + " <in class: " + canFill.get(key).getDeclaringClass() + ">");
required.put(key, Pair.makePair(true, true)); //don't duplicate error messages
good = false;
}
}
if (!good) {
System.exit(1);
}
return canFill;
}
protected static Map<String, Field> fillOptionsImpl(
Class<?>[] classes,
Properties options) {
return fillOptionsImpl(classes, options, false);
}
/*
* ----------
* EXECUTION
* ----------
*/
public static void fillOptions(Class<?>[] classes, Properties options) {
fillOptionsImpl(classes, options);
}
public static void fillOptions(Properties props, String[] args) {
//(convert to map)
Properties options = StringUtils.argsToProperties(args);
for (String key : props.stringPropertyNames()) {
options.put(key, props.getProperty(key));
}
//(bootstrap)
fillOptionsImpl(BOOTSTRAP_CLASSES, options, false); //bootstrap
//(fill options)
Class<?>[] visibleClasses = optionClasses;
if (visibleClasses == null) visibleClasses = getVisibleClasses(); //get classes
Map<String, Field> optionFields = fillOptionsImpl(visibleClasses, options);//fill
}
public static void fillOptions(Class<?>[] optionClasses, Properties props, String[] args) {
Execution.optionClasses = optionClasses;
fillOptions(props, args);
}
public static void fillOptions(Properties props) {
fillOptions(props, new String[0]);
}
public static void fillOptions(Class<?>[] classes,
String[] args) {
Properties options = StringUtils.argsToProperties(args); //get options
fillOptionsImpl(BOOTSTRAP_CLASSES, options, false); //bootstrap
fillOptionsImpl(classes, options);
}
public static void fillOptions(Class<?> clazz,
String[] args) {
Class<?>[] classes = new Class<?>[1];
classes[0] = clazz;
fillOptions(classes, args);
}
public static void exec(Runnable toRun) {
exec(toRun, new String[0]);
}
public static void exec(Runnable toRun, Class[] optionClasses) {
Execution.optionClasses = optionClasses;
exec(toRun, new String[0]);
}
public static void exec(Runnable toRun, String[] args) {
exec(toRun, args, false);
}
public static void exec(Runnable toRun, String[] args, Class[] optionClasses) {
Execution.optionClasses = optionClasses;
exec(toRun, args, false);
}
public static void exec(Runnable toRun, String[] args, Class[] optionClasses, boolean exit) {
Execution.optionClasses = optionClasses;
exec(toRun, StringUtils.argsToProperties(args), exit);
}
public static void exec(Runnable toRun, String[] args, boolean exit) {
exec(toRun, StringUtils.argsToProperties(args), exit);
}
public static void exec(Runnable toRun, Properties options) {
exec(toRun, options, false);
}
public static void exec(Runnable toRun, Properties options, boolean exit) {
//--Init
//(bootstrap)
fillOptionsImpl(BOOTSTRAP_CLASSES, options, false); //bootstrap
startTrack("init");
//(fill options)
Class<?>[] visibleClasses = optionClasses;
if (visibleClasses == null) visibleClasses = getVisibleClasses(); //get classes
Map<String, Field> optionFields = fillOptionsImpl(visibleClasses, options);//fill
endTrack("init");
// -- Setup Logging
StanfordRedwoodConfiguration.apply(options);
//--Run Program
int exitCode = 0;
startTrack("main");
try {
toRun.run();
} catch (Throwable t) {
log(FORCE, t);
exitCode = 1;
}
endTrack("main"); //ends main
if (exit) {
System.exit(exitCode);
}
}
private static final String threadRootClass() {
StackTraceElement[] trace = Thread.currentThread().getStackTrace();
StackTraceElement elem = trace[trace.length - 1];
String clazz = elem.getClassName();
return clazz;
}
public static final void usageAndExit(String[] expectedArgs) {
String clazz = threadRootClass();
StringBuilder b = new StringBuilder();
b.append("USAGE: ").append(clazz).append(" ");
for (String arg : expectedArgs) {
b.append(arg).append(" ");
}
System.out.println(b.toString());
System.exit(0);
}
public static final void usageAndExit(Map<String, String[]> argToFlagsMap) {
String clazz = threadRootClass();
StringBuilder b = new StringBuilder();
b.append("USAGE: ").append(clazz).append("\n\t");
for (String arg : argToFlagsMap.keySet()) {
String[] flags = argToFlagsMap.get(arg);
if (flags == null || flags.length == 0) {
throw new IllegalArgumentException(
"No flags registered for arg: " + arg);
}
b.append("{");
for (int i = 0; i < flags.length - 1; i++) {
b.append(flags[i]).append(",");
}
b.append(flags[flags.length - 1]).append("}");
}
System.out.println(b.toString());
System.exit(0);
}
} | [
"fraczwojciech@gmail.com"
] | fraczwojciech@gmail.com |
ea5ed9c11a56a0148dedbc77e4ab53f39ead24b7 | 98160708ea921854d303f6b384d79f26f9267092 | /springboot-mybatis-plus/src/main/java/top/zlcxy/mybatis/plus/MybatisPlusApplication.java | 501cc5db45afaa9c3ce73febffef9fea8af76078 | [] | no_license | zhangliang520/springboot-parent | 1895d4740978fa64f9df4557e375f354d571a07f | 17683acc6b5ed9fde1fc51031b2b66b99118a481 | refs/heads/master | 2021-05-17T19:40:39.107279 | 2020-10-14T00:10:35 | 2020-10-14T00:10:35 | 250,941,680 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 348 | java | package top.zlcxy.mybatis.plus;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MybatisPlusApplication {
public static void main(String[] args) {
SpringApplication.run(MybatisPlusApplication.class, args);
}
}
| [
"505680766@qq.com"
] | 505680766@qq.com |
a92cac1d44444de223971ac9f638964b7c914d9e | 0b5839c736c44d7fc6395bf9522f5c605222f336 | /src/trainingdiary/PanelRozbieganieRytmy.java | fe0f86f001338ed512cdf7a6eb0528f48b259dd8 | [] | no_license | Feanogoth/TrainingDiary | fa3fdb8e13fa380d2ff16cdaac8800c410a5e7dd | 91d879fea35ec5cdfccaf30e0fda7f5ee0637674 | refs/heads/master | 2021-04-06T20:18:51.068681 | 2018-03-19T12:29:05 | 2018-03-19T12:29:05 | 125,283,418 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,422 | java | package trainingdiary;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
public class PanelRozbieganieRytmy extends JFrame
{
private MyComboBox combo = new MyComboBox();
private Font font = combo.getFont();
private JLabel labelKm = new MyLabel("Km");
private JLabel labelTime = new MyLabel("Czas");
private JLabel labelMin = new MyLabel("[minuty]");
private JLabel labelS = new MyLabel("[sekundy]");
private JLabel labelSpeed = new MyLabel("Twoje tempo [min/km]");
private JLabel labelRunCount = new MyLabel("Ilość rytmów");
private JLabel labelRunDist = new MyLabel("Dystans [m]");
private JLabel labelRunDistB = new MyLabel("Dystans powrotu [m]");
private JLabel labelDescription = new MyLabel("Opis");
private JLabel labelComments = new MyLabel("Uwagi");
private JLabel labelTotalKm = new MyLabel("Suma km całego treningu");
private JLabel labelTotalRunKm = new MyLabel("Suma km rytmów");
private JSpinner spinnerKm = new JSpinner();
private JSpinner spinnerMin = new JSpinner();
private JSpinner spinnerS = new JSpinner();
private JSpinner spinnerRunCount = new JSpinner();
private JSpinner spinnerRunDist = new JSpinner();
private JSpinner spinnerRunDistB = new JSpinner();
private JTextField textFieldSpeed = new JTextField();
private JTextField textFieldRunDist = new JTextField();
private JTextArea textDescription = new JTextArea("Tutaj napisz opis treningu");
private JTextArea textComments = new JTextArea("Tutaj napisz uwagi do treningu");
private JSpinner spinnerTotalKm = new JSpinner();
private JSeparator separator1 = new MySeparator();
private JSeparator separator2 = new MySeparator();
private JSeparator separator3 = new MySeparator();
private JSeparator separator4 = new MySeparator();
private JSeparator separator5 = new MySeparator();
private JSeparator separator6 = new MySeparator();
private JSeparator separator7 = new MySeparator();
private double seconds = 0;
private double minutes = 0;
public PanelRozbieganieRytmy(JPanel panel)
{
int verticalGapAfter = 20;
int verticalGapBefore = 5;
GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
new PanelMods().modifyTCount(spinnerS);
new PanelMods().modifyTCount(spinnerKm);
new PanelMods().modifyTCount(spinnerMin);
new PanelMods().modifyTCount(spinnerTotalKm);
new PanelMods().modifyTCount(spinnerRunDist);
new PanelMods().modifyTCount(spinnerRunDistB);
new PanelMods().modifyTCount(spinnerRunCount);
new PanelMods().modifyText(textComments);
new PanelMods().modifyText(textDescription);
new PanelMods().modifyTextCampPlace(textFieldSpeed);
new PanelMods().modifyTextCampPlace(textFieldRunDist);
layout.setHorizontalGroup
(
layout.createParallelGroup()
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelKm, 350,350,350)
.addComponent(spinnerKm)
.addGap(20)
)
.addComponent(separator1)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelTime, 350,350,350)
.addComponent(labelMin).addGap(20)
.addComponent(spinnerMin)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelS).addGap(20)
.addComponent(spinnerS)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelSpeed).addGap(20)
.addComponent(textFieldSpeed)
.addGap(20)
)
)
)
.addComponent(separator2)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelRunCount, 350,350,350)
.addComponent(spinnerRunCount).addGap(20)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelRunDist).addGap(20)
.addComponent(spinnerRunDist)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelRunDistB).addGap(20)
.addComponent(spinnerRunDistB)
.addGap(20)
)
)
)
.addComponent(separator3)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelDescription, 350,350,350)
.addComponent(textDescription, 100, 150, Short.MAX_VALUE)
.addGap(20)
)
.addComponent(separator4)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelComments, 350,350,350)
.addComponent(textComments, 100, 150, Short.MAX_VALUE)
.addGap(20)
)
.addComponent(separator5)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelTotalRunKm, 350,350,350)
.addComponent(textFieldRunDist)
.addGap(20)
)
.addComponent(separator6)
.addGap(20)
.addGroup
(
layout.createSequentialGroup()
.addComponent(labelTotalKm, 350,350,350)
.addComponent(spinnerTotalKm)
.addGap(20)
)
.addComponent(separator7)
.addGap(20)
);
layout.setVerticalGroup
(
layout.createSequentialGroup()
.addGroup
(
layout.createParallelGroup()
.addComponent(labelKm)
.addComponent(spinnerKm)
)
.addGap(verticalGapBefore)
.addComponent(separator1)
.addGap(verticalGapAfter)
.addGroup
(
layout.createParallelGroup()
.addGroup
(
layout.createSequentialGroup()
.addGroup
(
layout.createParallelGroup()
.addComponent(labelTime)
.addComponent(spinnerMin)
.addComponent(labelMin)
)
.addGroup
(
layout.createParallelGroup()
.addComponent(spinnerS)
.addComponent(labelS)
)
.addGroup
(
layout.createParallelGroup()
.addComponent(labelSpeed)
.addComponent(textFieldSpeed)
)
)
)
.addGap(verticalGapBefore)
.addComponent(separator2)
.addGap(verticalGapAfter)
.addGroup
(
layout.createParallelGroup()
.addGroup
(
layout.createSequentialGroup()
.addGroup
(
layout.createParallelGroup()
.addComponent(labelRunCount)
.addComponent(spinnerRunCount)
)
.addGroup
(
layout.createParallelGroup()
.addComponent(labelRunDist)
.addComponent(spinnerRunDist)
)
.addGroup
(
layout.createParallelGroup()
.addComponent(labelRunDistB)
.addComponent(spinnerRunDistB)
)
)
)
.addGap(verticalGapBefore)
.addComponent(separator3)
.addGap(verticalGapAfter)
.addGroup
(
layout.createParallelGroup()
.addComponent(labelDescription)
.addComponent(textDescription, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE)
)
.addGap(verticalGapBefore)
.addComponent(separator4)
.addGap(verticalGapAfter)
.addGroup
(
layout.createParallelGroup()
.addComponent(labelComments)
.addComponent(textComments, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
)
.addGap(verticalGapBefore)
.addComponent(separator5)
.addGap(verticalGapAfter)
.addGroup
(
layout.createParallelGroup()
.addComponent(labelTotalRunKm)
.addComponent(textFieldRunDist)
)
.addGap(verticalGapBefore)
.addComponent(separator6)
.addGap(verticalGapAfter)
.addGroup
(
layout.createParallelGroup()
.addComponent(labelTotalKm)
.addComponent(spinnerTotalKm)
)
.addGap(verticalGapBefore)
.addComponent(separator7)
.addGap(verticalGapAfter)
.addGap(Short.MAX_VALUE)
);
spinnerMin.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent ce)
{
minutes = (int) spinnerMin.getValue();
double km = (int) spinnerKm.getValue();
double speed = minutes/km;
textFieldSpeed.setText("" + speed);
}
});
}
}
| [
"szyost95@gmail.com"
] | szyost95@gmail.com |
344664003416560aa2d28256e886380a6638d246 | 8b386427a1c0de84551b584e1016bba4f46a5ce1 | /ec_test/src/edu/xupt/entity/User.java | 2f0c7280e043fcc55b30007cae50cf2e523dc7c1 | [] | no_license | Allen-Liang/JavaWeb_EC_PMS_Homework | f078cecdc14439985f79c9496218e43088f4ccf3 | bedda55980cb0833e7891b6b7de34188b2a7ef1d | refs/heads/master | 2021-04-12T11:41:59.438497 | 2017-06-16T13:13:40 | 2017-06-16T13:13:40 | 94,545,124 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,036 | java | package edu.xupt.entity;
public class User {
private String id;
private String name;
private String password;
private String firstname;
private String lastname;
private String email;
private String phone;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
}
| [
"liangtianhua2012@gmail.com"
] | liangtianhua2012@gmail.com |
54a0f3d7be38f37a01c292b46646959de6d2d663 | 71eda871f4b75297bc821f8d76c900e47ac663d6 | /autumn2015/InspectionBoard/src/com/intellect25/controller/Dispatcher.java | bccb1ba24909c7952549c5a95f6203d0d1ba44ed | [] | no_license | Riabchenko/Progects_for_EPAM | 92dc7f2d16845a5ded56e5f589e75ae1b2a74235 | 71eba813fee36f375a465344ede017d924e0d3a8 | refs/heads/master | 2021-01-10T15:27:41.611206 | 2016-02-10T14:04:11 | 2016-02-10T14:04:11 | 51,443,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,166 | java | package com.intellect25.controller;
import com.intellect25.entity.Institute;
import com.intellect25.model.*;
import java.util.HashMap;
import java.util.Map;
/**
* Manage creation of buffer,dispatcher of consumer,dispatcher of producer
*
* @author Riabchenko Aliona
*/
public class Dispatcher implements Runnable{
/** String BIOLOGY is name of Institute*/
private static final String BIOLOGY = "BIOLOGY";
/** String MATHEMATICS is name of Institute*/
private static final String MATHEMATICS = "MATHEMATICS";
/** String ANYTHING is name of Institute*/
private static final String ANYTHING = "ANYTHING";
/** Store result */
private Map<String,Institute> result;
@Override
public void run() {
try {
start();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* Create buffer,dispatchers of consumers and producers
* Create thread to consumers and producers
* Start threaders and join to them
* Get result
*
* @throws InterruptedException
*/
private void start() throws InterruptedException {
Factory factory = Factory.getInstance();
Buffer buffer = (Buffer) factory.create(Type.BUFFER, null);
DispatcherOfConsumers consumers = (DispatcherOfConsumers) factory.create(Type.CONSUMER, buffer);
DispatcherOfProducers producers = (DispatcherOfProducers) factory.create(Type.PRODUCER, buffer);
Thread threadConsumers = new Thread(consumers);
Thread threadProducers = new Thread(producers);
threadConsumers.start();
threadProducers.start();
threadConsumers.join();
threadProducers.join();
/* Get result */
result = new HashMap<>();
result.put(MATHEMATICS, consumers.getConsumerMathematicsObject().get());
result.put(BIOLOGY, consumers.getConsumerBiologyObject().get());
result.put(ANYTHING, consumers.getConsumerAnythingObject().get());
}
/**
* Get result
*
* @return map of result
*/
public Map<String,Institute> getResult() {
return result;
}
}
| [
"platmargo@gmail.com"
] | platmargo@gmail.com |
ecc0cfb9289910aa515a599dd6c5ad9d7cc71d77 | 43af28a5ee5b6de6df711fddd14a1223b5f6206e | /src/main/java/io/rqzs/config/MybatisPlusConfig.java | c8243d148acc8b7770b41fc4b481c2b2592c72e8 | [] | no_license | tdbegin/rqzs-fast | c2d8032e3124d914266cf453619fee9e5b64436f | e1c4a8aa9e9186fab94b5b1d45b597e106966ffc | refs/heads/master | 2023-07-14T08:34:19.273960 | 2021-08-31T05:58:35 | 2021-08-31T05:58:35 | 401,589,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 622 | java | /**
* Copyright (c) 2016-2019 人人开源 All rights reserved.
*
* https://www.rqzs.io
*
* 版权所有,侵权必究!
*/
package io.rqzs.config;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* mybatis-plus配置
*
* @author Mark sunlightcs@gmail.com
*/
@Configuration
public class MybatisPlusConfig {
/**
* 分页插件
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
}
}
| [
"ftd_crazy@163.com"
] | ftd_crazy@163.com |
3639b59040264001efef1e46765b48d1ce2f97f5 | c8ba78e0ad43666490462972569f91dc0db579b2 | /cdyoue-sydb-service/src/main/java/com/cdyoue/oddJobs/dto/lgfc/UserActiveness.java | f8fff940fa99679f7b7be1daabb9317bd1400e6d | [] | no_license | tanhao619/sydb | 24175dbdf9b26c1b59c7ebe40364410d71d40411 | 21a9dd6024668babffa3c3909993199fbae23ba9 | refs/heads/master | 2020-03-09T22:07:36.034408 | 2018-04-11T07:40:08 | 2018-04-11T07:40:08 | 129,026,982 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 472 | java | package com.cdyoue.oddJobs.dto.lgfc;
/**
* Created by tr on 2017/5/27.
*/
public class UserActiveness {
private Integer result;
private UserActivenessData data;
public Integer getResult() {
return result;
}
public void setResult(Integer result) {
this.result = result;
}
public UserActivenessData getData() {
return data;
}
public void setData(UserActivenessData data) {
this.data = data;
}
}
| [
"tanhao@cdyoue.com"
] | tanhao@cdyoue.com |
86f93947ca7c200b6f96d6685c659b33d98fe493 | e0b6ad20174958527f65809f7f08c7607d057807 | /dao/src/main/java/com/cdut/common/token/RedisTokenManager.java | b152e249c815e1fe639892ec47a55316849eb8f2 | [] | no_license | cdtft/she-backend | 69f361db6cfd5836bb5c20e797bf2e100437f192 | 8e76b7b5d44367d9c4a56ed1fc0e4c90829b482b | refs/heads/master | 2021-07-11T21:32:50.260813 | 2017-09-15T16:21:51 | 2017-09-15T16:21:51 | 102,972,414 | 2 | 0 | null | 2017-09-19T02:10:29 | 2017-09-09T17:23:24 | Java | UTF-8 | Java | false | false | 2,434 | java | package com.cdut.common.token;
import com.cdut.dao.redis.ro.admin.UserToken;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.JdkSerializationRedisSerializer;
import org.springframework.stereotype.Component;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
* redis Token验证器
* Created by king on 2017/9/11.
*/
@Component
public class RedisTokenManager implements TokenManager {
private static final Logger logger = Logger.getLogger(RedisTokenManager.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
public RedisTokenManager(RedisTemplate redisTemplate) {
this.redisTemplate = redisTemplate;
redisTemplate.setKeySerializer(new JdkSerializationRedisSerializer());
}
@Override
public UserToken createTokenUser(Long userId) {
logger.info("为用户生成token信息");
//使用uuid作为源token信息
String token = UUID.randomUUID().toString().replace("-", "");
UserToken userToken = new UserToken(userId, token);
//存到redis并设置过期时间72小时过期
//todo 将时间提取出来
redisTemplate.boundValueOps(userId).set(token, 72, TimeUnit.HOURS);
return userToken;
}
@Override
public boolean checkToken(UserToken tokenUser) {
if (tokenUser == null) {
return false;
}
String token = (String) redisTemplate.boundValueOps(tokenUser.getId()).get();
if(token == null || !tokenUser.getToken().equals(token)){
return false;
}
//验证成功存重新入redis延长token信息过期时间
redisTemplate.boundValueOps(tokenUser.getId()).expire( 72, TimeUnit.HOURS);
return true;
}
@Override
public UserToken getToken(String authentication) {
if (authentication == null || authentication.length() == 0) {
return null;
}
String[] param = authentication.split("_");
if (param.length != 2) {
return null;
}
long userId = Long.parseLong(param[0]);
String token = param[1];
return new UserToken(userId, token);
}
@Override
public void deleteToken(Long userId) {
redisTemplate.delete(userId);
}
}
| [
"453451180@qq.com"
] | 453451180@qq.com |
6715e84a714281a3b45ada1ef4b8d04e95f8cef9 | f0d25d83176909b18b9989e6fe34c414590c3599 | /app/src/main/java/com/tencent/tdm/system/TXReceiver.java | 602c8969abe7b34043356bd2732d3b6a355f40c8 | [] | no_license | lycfr/lq | e8dd702263e6565486bea92f05cd93e45ef8defc | 123914e7c0d45956184dc908e87f63870e46aa2e | refs/heads/master | 2022-04-07T18:16:31.660038 | 2020-02-23T03:09:18 | 2020-02-23T03:09:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 558 | java | package com.tencent.tdm.system;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class TXReceiver extends BroadcastReceiver {
private NetworkType LastNet = NetworkType.NETWORK_UNKNOWN;
public void onReceive(Context context, Intent intent) {
NetworkType netType = TXSystem.getInstance().GetNetworkType(context);
if (netType != this.LastNet) {
this.LastNet = netType;
TX.GetInstance().OnNetworkChanged(netType.ordinal(), true);
}
}
}
| [
"quyenlm.vn@gmail.com"
] | quyenlm.vn@gmail.com |
eaa0281ec7dbd12cc54fbffe7962338aaa6bc378 | c3e52510afab4d23939e6f389c89e225e0a02d85 | /app/src/main/java/com/example/administrator/wankuoportal/beans/QuersitionBean.java | 5f971e33ce31d6f01942ec51ec607dab228892c8 | [] | no_license | flsand/WanKuoportal | ade204fe80e1081812609fdcdde05df72f96c975 | daee1c95b6e63cc6ea2fecedc228dd2d15fd4da3 | refs/heads/master | 2020-03-23T21:29:22.998318 | 2018-07-24T05:59:02 | 2018-07-24T05:59:28 | 142,110,689 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,749 | java | package com.example.administrator.wankuoportal.beans;
import java.io.Serializable;
import java.util.List;
/**
* Created by Administrator on 2017/9/10 0010.
*/
public class QuersitionBean implements Serializable {
/**
* code : 0
* datas : [{"aprizeAnswer":[{"answer":"先给嘴巴补补水","code":"A","id":893,"isRight":1,"questionId":224},{"answer":"先给眼睛补补水","code":"B","id":894,"isRight":1,"questionId":224},{"answer":"先给肌肤补补水","code":"C","id":895,"isRight":0,"questionId":224},{"answer":"先给双手补补水","code":"D","id":896,"isRight":1,"questionId":224}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"想变美,先给肌肤补补水!肌肤有多水,你就有多美!紫熙天然蚕丝深层补水面膜,深层润透干渴肌肤,提升10倍含水量。","endAge":70,"endDay":"2019-10-31","examineAccountId":0,"id":224,"img":"913e1889e2764be4a7336932c5f7e087","number":101,"ownerAccountId":222,"question":"想变美,先给哪里补补水?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-31","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5278,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":224},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"先看8道题说明和答案","code":"A","id":581,"isRight":1,"questionId":146},{"answer":"先看10道题说明和答案","code":"B","id":582,"isRight":0,"questionId":146},{"answer":"先看15道题说明和答案","code":"C","id":583,"isRight":1,"questionId":146},{"answer":"先看25道题说明和答案","code":"D","id":584,"isRight":1,"questionId":146}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"万阔记忆答题赚钱操作流程,先看10道题说明和答案,每道题限时15秒,再开始答题,答案4选1,答对获得相应金币,答错有正确答案提示。","endAge":70,"endDay":"2019-10-27","examineAccountId":0,"id":146,"img":"175f678c49c14cc9a79d804e53c63c60","number":101,"ownerAccountId":222,"question":"先看几道题说明和答案?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-27","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5279,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":146},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"限时10秒","code":"A","id":585,"isRight":1,"questionId":147},{"answer":"限时12秒","code":"B","id":586,"isRight":1,"questionId":147},{"answer":"限时15秒","code":"C","id":587,"isRight":0,"questionId":147},{"answer":"限时18秒","code":"D","id":588,"isRight":1,"questionId":147}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"万阔记忆答题赚钱操作流程,先看10道题说明和答案,每道题限时15秒,再开始答题,答案4选1,答对获得相应金币,答错有正确答案提示。","endAge":70,"endDay":"2019-10-27","examineAccountId":0,"id":147,"img":"e0d4bd032d9b4c90a299e26bffa78a77","number":101,"ownerAccountId":222,"question":"每道题限时多少秒?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-27","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5280,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":147},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"蚕丝质地薄如蝉翼","code":"A","id":897,"isRight":1,"questionId":225},{"answer":"蚕丝质地柔软","code":"B","id":898,"isRight":1,"questionId":225},{"answer":"蚕丝质地透明","code":"C","id":899,"isRight":1,"questionId":225},{"answer":"蚕丝质地轻薄软","code":"D","id":900,"isRight":0,"questionId":225}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"紫熙天然蚕丝面膜,蚕丝质地轻薄软,紧密填补皮肤沟纹,360°完美贴合脸部轮廓无气泡,宛如人体的第二层肌肤。","endAge":70,"endDay":"2019-10-31","examineAccountId":0,"id":225,"img":"c95de4028ff6445da3a136a52e15fa02","number":101,"ownerAccountId":222,"question":"蚕丝质地如何?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-31","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5281,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":225},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"2选1","code":"A","id":589,"isRight":1,"questionId":148},{"answer":"3选1","code":"B","id":590,"isRight":1,"questionId":148},{"answer":"4选1","code":"C","id":591,"isRight":0,"questionId":148},{"answer":"5选1","code":"D","id":592,"isRight":1,"questionId":148}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"万阔记忆答题赚钱操作流程,先看10道题说明和答案,每道题限时15秒,再开始答题,答案4选1,答对获得相应金币,答错有正确答案提示。","endAge":70,"endDay":"2019-10-27","examineAccountId":0,"id":148,"img":"548c9469b3db483585537ec4a44ba2d1","number":101,"ownerAccountId":222,"question":"答案几选1?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-27","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5282,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":148},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"贴合眼部轮廓无气泡","code":"A","id":901,"isRight":1,"questionId":226},{"answer":"贴合鼻部轮廓无气泡","code":"B","id":902,"isRight":1,"questionId":226},{"answer":"贴合嘴部轮廓无气泡","code":"C","id":903,"isRight":1,"questionId":226},{"answer":"贴合脸部轮廓无气泡","code":"D","id":904,"isRight":0,"questionId":226}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"紫熙天然蚕丝面膜,蚕丝质地轻薄软,紧密填补皮肤沟纹,360°完美贴合脸部轮廓无气泡,宛如人体的第二层肌肤。","endAge":70,"endDay":"2019-10-31","examineAccountId":0,"id":226,"img":"00f5db38b6a34f45890d93c97894d5c8","number":101,"ownerAccountId":222,"question":"360°完美贴合什么轮廓无气泡?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-31","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5283,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":226},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"限时10秒","code":"A","id":593,"isRight":1,"questionId":149},{"answer":"限时12秒","code":"B","id":594,"isRight":1,"questionId":149},{"answer":"限时16秒","code":"C","id":595,"isRight":1,"questionId":149},{"answer":"限时20秒","code":"D","id":596,"isRight":0,"questionId":149}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"点击进入万阔APP闲赚猜题,系统自动抽取10道题,每道题限时20秒,答案4选1,答对获得相应金币,答错满20秒才可以点击下一题。","endAge":70,"endDay":"2019-10-27","examineAccountId":0,"id":149,"img":"e80440c12a094c8abd1ef068e69e5769","number":101,"ownerAccountId":222,"question":"每道题限时多少秒?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-27","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5284,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":149},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"从紫熙面霜开始","code":"A","id":905,"isRight":1,"questionId":227},{"answer":"从紫熙面膜开始","code":"B","id":906,"isRight":0,"questionId":227},{"answer":"从紫熙精华液开始","code":"C","id":907,"isRight":1,"questionId":227},{"answer":"从紫熙乳液开始","code":"D","id":908,"isRight":1,"questionId":227}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"紫熙天然蚕丝敏感肌肤修复面膜,对红血丝、晒后修复、淡斑、痘痕等都有明显效果。焕颜修复赋活新生,从紫熙面膜开始!","endAge":70,"endDay":"2019-10-31","examineAccountId":0,"id":227,"img":"97a59f3d9ccb4868a304a057ea08261c","number":101,"ownerAccountId":222,"question":"焕颜修复赋活新生,从什么开始?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-31","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5285,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":227},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"自动抽取10道题","code":"A","id":597,"isRight":0,"questionId":150},{"answer":"自动抽取15道题","code":"B","id":598,"isRight":1,"questionId":150},{"answer":"自动抽取20道题","code":"C","id":599,"isRight":1,"questionId":150},{"answer":"自动抽取25道题","code":"D","id":600,"isRight":1,"questionId":150}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"点击进入万阔APP闲赚猜题,系统自动抽取10道题,每道题限时20秒,答案4选1,答对获得相应金币,可以点击下一题,答错有正确答案提示。","endAge":70,"endDay":"2019-10-27","examineAccountId":0,"id":150,"img":"ca48b3a947e5477792b089622a1e4527","number":101,"ownerAccountId":222,"question":"系统自动抽取几道题?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-27","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5286,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":150},"gold":2,"number":0},{"aprizeAnswer":[{"answer":"采用2层膜设计","code":"A","id":909,"isRight":1,"questionId":228},{"answer":"采用3层膜设计","code":"B","id":910,"isRight":0,"questionId":228},{"answer":"采用4层膜设计","code":"C","id":911,"isRight":1,"questionId":228},{"answer":"采用5层膜设计","code":"D","id":912,"isRight":1,"questionId":228}],"aprizeQuestion":{"cancel":1,"clickType":0,"content":"紫熙天然蚕丝补水和修复面膜,采用3层膜设计,蕴含更多精华,使蚕丝面膜灵魂得到更珍贵的阐述。","endAge":70,"endDay":"2021-10-31","examineAccountId":0,"id":228,"img":"495eaff0f1ef47fba69b55b0a90ddd31","number":101,"ownerAccountId":222,"question":"采用几层膜设计?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-31","state":0},"aprizeRecord":{"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5287,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":228},"gold":2,"number":0}]
* msg : 获取题目成功
*/
private int code;
private String msg;
private List<DatasBean> datas;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public List<DatasBean> getDatas() {
return datas;
}
public void setDatas(List<DatasBean> datas) {
this.datas = datas;
}
public static class DatasBean implements Serializable {
/**
* aprizeAnswer : [{"answer":"先给嘴巴补补水","code":"A","id":893,"isRight":1,"questionId":224},{"answer":"先给眼睛补补水","code":"B","id":894,"isRight":1,"questionId":224},{"answer":"先给肌肤补补水","code":"C","id":895,"isRight":0,"questionId":224},{"answer":"先给双手补补水","code":"D","id":896,"isRight":1,"questionId":224}]
* aprizeQuestion : {"cancel":1,"clickType":0,"content":"想变美,先给肌肤补补水!肌肤有多水,你就有多美!紫熙天然蚕丝深层补水面膜,深层润透干渴肌肤,提升10倍含水量。","endAge":70,"endDay":"2019-10-31","examineAccountId":0,"id":224,"img":"913e1889e2764be4a7336932c5f7e087","number":101,"ownerAccountId":222,"question":"想变美,先给哪里补补水?","questionType":2,"sex":"1,2","startAge":11,"startDay":"2017-10-31","state":0}
* aprizeRecord : {"accountId":206,"advertiserGold":-15,"cityGold":0,"cityInvitationGold":1,"groupId":1001,"id":5278,"isRight":1,"memberGold":0,"memberInvitationGold":0,"ownerAccountId":222,"questionTime":"2017-11-01 09:39:51","qusetionId":224}
* gold : 2
* number : 0
*/
private AprizeQuestionBean aprizeQuestion;
private AprizeRecordBean aprizeRecord;
private int gold;
private int number;
private List<AprizeAnswerBean> aprizeAnswer;
public AprizeQuestionBean getAprizeQuestion() {
return aprizeQuestion;
}
public void setAprizeQuestion(AprizeQuestionBean aprizeQuestion) {
this.aprizeQuestion = aprizeQuestion;
}
public AprizeRecordBean getAprizeRecord() {
return aprizeRecord;
}
public void setAprizeRecord(AprizeRecordBean aprizeRecord) {
this.aprizeRecord = aprizeRecord;
}
public int getGold() {
return gold;
}
public void setGold(int gold) {
this.gold = gold;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public List<AprizeAnswerBean> getAprizeAnswer() {
return aprizeAnswer;
}
public void setAprizeAnswer(List<AprizeAnswerBean> aprizeAnswer) {
this.aprizeAnswer = aprizeAnswer;
}
public static class AprizeQuestionBean implements Serializable {
/**
* cancel : 1
* clickType : 0
* content : 想变美,先给肌肤补补水!肌肤有多水,你就有多美!紫熙天然蚕丝深层补水面膜,深层润透干渴肌肤,提升10倍含水量。
* endAge : 70
* endDay : 2019-10-31
* examineAccountId : 0
* id : 224
* img : 913e1889e2764be4a7336932c5f7e087
* number : 101
* ownerAccountId : 222
* question : 想变美,先给哪里补补水?
* questionType : 2
* sex : 1,2
* startAge : 11
* startDay : 2017-10-31
* state : 0
*/
private int cancel;
private int clickType;
private String content;
private int endAge;
private String endDay;
private int examineAccountId;
private int id;
private int clickUrl;
private String img;
private int number;
private int ownerAccountId;
private String question;
private int questionType;
private String sex;
private int startAge;
private String startDay;
private int state;
public int getClickUrl() {
return clickUrl;
}
public void setClickUrl(int clickUrl) {
this.clickUrl = clickUrl;
}
public int getCancel() {
return cancel;
}
public void setCancel(int cancel) {
this.cancel = cancel;
}
public int getClickType() {
return clickType;
}
public void setClickType(int clickType) {
this.clickType = clickType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public int getEndAge() {
return endAge;
}
public void setEndAge(int endAge) {
this.endAge = endAge;
}
public String getEndDay() {
return endDay;
}
public void setEndDay(String endDay) {
this.endDay = endDay;
}
public int getExamineAccountId() {
return examineAccountId;
}
public void setExamineAccountId(int examineAccountId) {
this.examineAccountId = examineAccountId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getImg() {
return img;
}
public void setImg(String img) {
this.img = img;
}
public int getNumber() {
return number;
}
public void setNumber(int number) {
this.number = number;
}
public int getOwnerAccountId() {
return ownerAccountId;
}
public void setOwnerAccountId(int ownerAccountId) {
this.ownerAccountId = ownerAccountId;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public int getQuestionType() {
return questionType;
}
public void setQuestionType(int questionType) {
this.questionType = questionType;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public int getStartAge() {
return startAge;
}
public void setStartAge(int startAge) {
this.startAge = startAge;
}
public String getStartDay() {
return startDay;
}
public void setStartDay(String startDay) {
this.startDay = startDay;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
}
public static class AprizeRecordBean implements Serializable {
/**
* accountId : 206
* advertiserGold : -15
* cityGold : 0
* cityInvitationGold : 1
* groupId : 1001
* id : 5278
* isRight : 1
* memberGold : 0
* memberInvitationGold : 0
* ownerAccountId : 222
* questionTime : 2017-11-01 09:39:51
* qusetionId : 224
*/
private int accountId;
private int advertiserGold;
private int cityGold;
private int cityInvitationGold;
private int groupId;
private int id;
private int isRight;
private int memberGold;
private int memberInvitationGold;
private int ownerAccountId;
private String questionTime;
private int qusetionId;
public int getAccountId() {
return accountId;
}
public void setAccountId(int accountId) {
this.accountId = accountId;
}
public int getAdvertiserGold() {
return advertiserGold;
}
public void setAdvertiserGold(int advertiserGold) {
this.advertiserGold = advertiserGold;
}
public int getCityGold() {
return cityGold;
}
public void setCityGold(int cityGold) {
this.cityGold = cityGold;
}
public int getCityInvitationGold() {
return cityInvitationGold;
}
public void setCityInvitationGold(int cityInvitationGold) {
this.cityInvitationGold = cityInvitationGold;
}
public int getGroupId() {
return groupId;
}
public void setGroupId(int groupId) {
this.groupId = groupId;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getIsRight() {
return isRight;
}
public void setIsRight(int isRight) {
this.isRight = isRight;
}
public int getMemberGold() {
return memberGold;
}
public void setMemberGold(int memberGold) {
this.memberGold = memberGold;
}
public int getMemberInvitationGold() {
return memberInvitationGold;
}
public void setMemberInvitationGold(int memberInvitationGold) {
this.memberInvitationGold = memberInvitationGold;
}
public int getOwnerAccountId() {
return ownerAccountId;
}
public void setOwnerAccountId(int ownerAccountId) {
this.ownerAccountId = ownerAccountId;
}
public String getQuestionTime() {
return questionTime;
}
public void setQuestionTime(String questionTime) {
this.questionTime = questionTime;
}
public int getQusetionId() {
return qusetionId;
}
public void setQusetionId(int qusetionId) {
this.qusetionId = qusetionId;
}
}
public static class AprizeAnswerBean implements Serializable {
/**
* answer : 先给嘴巴补补水
* code : A
* id : 893
* isRight : 1
* questionId : 224
*/
private String answer;
private String code;
private int id;
private int isRight;
private int questionId;
public String getAnswer() {
return answer;
}
public void setAnswer(String answer) {
this.answer = answer;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getIsRight() {
return isRight;
}
public void setIsRight(int isRight) {
this.isRight = isRight;
}
public int getQuestionId() {
return questionId;
}
public void setQuestionId(int questionId) {
this.questionId = questionId;
}
}
}
}
| [
"1156183505@qq.com"
] | 1156183505@qq.com |
141cc928ab7a676f587ca4a1071b1727383bfe04 | 3788c706011444509013cb530f6773425d15a4ea | /Android-Eclipse/Weather/Weather/src/com/example/weather/activity/GuideActivity.java | 70190c55f522588ee8f7e6ac8e272eba74e86c9c | [] | no_license | Karthi-Mano/Android-Eclipse | ae90dfab779eb05f3ac2e0a2b83225e64d009665 | fff25120c9b7df18614ebeddae9844b6bc71aa7f | refs/heads/master | 2020-03-29T14:09:37.449918 | 2017-06-09T07:54:19 | 2017-06-09T07:54:19 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,031 | java | package com.example.weather.activity;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import cn.smssdk.EventHandler;
import cn.smssdk.SMSSDK;
import cn.smssdk.gui.RegisterPage;
import com.example.weather.R;
import com.example.weather.utils.DensityUtil;
import com.example.weather.utils.MyContainer;
import com.example.weather.utils.SpTools;
import android.widget.LinearLayout.LayoutParams;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.Window;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.Toast;
public class GuideActivity extends Activity {
private ViewPager gViewPager;
private View gRedPoint;
private LinearLayout gLlGrayPointsContainer;
private Button gButtonExp;
private VpAdapter vpAdapter;
private List<ImageView> gListDatas;
private int distance;
@Override
protected void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
initView();
initEvent();
initData();
}
private void initView() {
setContentView(R.layout.activity_guide);
// viewpager组件
gViewPager = (ViewPager) findViewById(R.id.vp_guide);
// 红点
gRedPoint = findViewById(R.id.v_guide_redPoint);
// 灰点容器
gLlGrayPointsContainer = (LinearLayout) findViewById(R.id.ll_gray_points);
gButtonExp = (Button) findViewById(R.id.bt_guide_startexp);
// 创建viewPager的适配器
vpAdapter = new VpAdapter();
gViewPager.setAdapter(vpAdapter);
}
private class VpAdapter extends PagerAdapter {
@Override
public int getCount() {
if (gListDatas != null) {
return gListDatas.size();
}
return 0;// 返回数据的个数
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object; // 缓存
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
ImageView child = gListDatas.get(position);
container.addView(child);
return child;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);// 移除view
}
}
private void initEvent() {
// 监听LinearLayout事件完成
gLlGrayPointsContainer.getViewTreeObserver().addOnGlobalLayoutListener(
new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
// 取消监听
gLlGrayPointsContainer.getViewTreeObserver()
.removeGlobalOnLayoutListener(this);
// 获得两点之间的距离
distance = gLlGrayPointsContainer.getChildAt(1)
.getLeft()
- gLlGrayPointsContainer.getChildAt(0)
.getLeft();
}
});
// 按钮点击事件,点击
gButtonExp.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// 打开注册页面
RegisterPage registerPage = new RegisterPage();
registerPage.show(GuideActivity.this);
registerPage.setRegisterCallback(new EventHandler() {
public void afterEvent(int event, int result, Object data) {
// 解析注册结果
if (result == SMSSDK.RESULT_COMPLETE) {
@SuppressWarnings("unchecked")
HashMap<String, Object> phoneMap = (HashMap<String, Object>) data;
String country = (String) phoneMap.get("country");
String phone = (String) phoneMap.get("phone");
Intent mainIntent = new Intent(GuideActivity.this,
MainActivity.class);
startActivity(mainIntent);
SpTools.setBoolean(GuideActivity.this,
MyContainer.ISSETUP, true);
finish();
}
}
});
}
});
// 监听ViewPager页码改变,当改变到最后一个是显示体验按钮
gViewPager.setOnPageChangeListener(new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// 显示当前ViewPager的页码,当显示到最后一个是显示按钮
if (position == gListDatas.size() - 1) {
gButtonExp.setVisibility(View.VISIBLE);
} else {
gButtonExp.setVisibility(View.GONE);
}
}
@Override
public void onPageScrolled(int position, float positionOffset,
int positionOffsetPixels) {
float pointsMargin = distance * (position + positionOffset);
RelativeLayout.LayoutParams marginParams = (RelativeLayout.LayoutParams) gRedPoint
.getLayoutParams();
marginParams.leftMargin = Math.round(pointsMargin);
// 重新设置布局
gRedPoint.setLayoutParams(marginParams);
}
@Override
public void onPageScrollStateChanged(int state) {
// TODO Auto-generated method stub
}
});
}
private void initData() {
SMSSDK.initSDK(this, "124e75fbb86ce",
"9a4e5ab1f8e8fd208b404fa48da5b359");
int[] pics = new int[] { R.drawable.a1231231232,
R.drawable.a1231231233, R.drawable.a1231231234 };
// 定义ViewPage的容器
gListDatas = new ArrayList<ImageView>();
for (int i = 0; i < pics.length; i++) {
ImageView iv = new ImageView(this);
iv.setBackgroundResource(pics[i]);
// 将ImageView加入集合
gListDatas.add(iv);
// 动态的给容器添加灰色的点
// 1.创建view
View gPoint = new View(this);
// 2.指定颜色
gPoint.setBackgroundResource(R.drawable.gray_point);
// 3.设置大小
int dp = 10;
LayoutParams params = new LayoutParams(
DensityUtil.dip2px(this, dp), DensityUtil.dip2px(this, dp));
if (i != 0) {
params.leftMargin = 10;
}
gPoint.setLayoutParams(params);
gLlGrayPointsContainer.addView(gPoint);
vpAdapter.notifyDataSetChanged();
}
}
} | [
"583431183@qq.com"
] | 583431183@qq.com |
bb5bd7225b8c93a33ddb6de3e35f88286ad8dbaf | 269c4d7b641cedb5abbdc954d770bef068e9bc66 | /kafka-producer/src/main/java/com/kafka/producer/config/KafkaProducerConfig.java | b6e80eb5c3e0da74bfda64ad32dfb58932fdf684 | [] | no_license | shaswat123/init-boot | 90aa9d7fce3faf0f9a39519da9ca259d1aebd1bc | 0a4cce00acb4aa5806b5cb9563de683db0653bcf | refs/heads/master | 2020-05-24T16:31:03.930292 | 2019-11-17T18:16:17 | 2019-11-17T18:16:17 | 187,359,653 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,333 | java | package com.kafka.producer.config;
import org.springframework.kafka.support.serializer.JsonSerializer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.StringSerializer;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.core.ProducerFactory;
import com.init.model.Student;
import java.util.HashMap;
import java.util.Map;
@Configuration
public class KafkaProducerConfig {
@Value("${kafka.boot.server}")
private String kafkaServer;
@Bean
public KafkaTemplate<String,Student> kafkaTemplate(){
return new KafkaTemplate<>(producerConfig());
}
public ProducerFactory<String, Student> producerConfig(){
Map<String,Object>config = new HashMap<>();
config.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,kafkaServer);
config.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
config.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, JsonSerializer.class);
return new DefaultKafkaProducerFactory<>(config);
}
}
| [
"shaswat.dasgupta@gmail.com"
] | shaswat.dasgupta@gmail.com |
89a1fedbade9fbc0d2588b9f752a4d85fe85d633 | 666bc5e9ff86ba9e9c218388a5aafa9b2b4ed2e8 | /Excript/src/com/excript/aula013/aula0013.java | 5416fa73cc06b82e5cf846e3089ab28a21c943eb | [] | no_license | Matheista/Linguagem-de-Programa-o | 83f03f859668ea12f06bf2c8af7d34fbd3601b30 | 95bb8fead94ba0dfb4fa240f0f5f7b8e92d0f93b | refs/heads/master | 2021-01-01T17:01:57.597359 | 2017-09-01T11:14:41 | 2017-09-01T11:14:41 | 97,976,989 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 881 | java | package com.excript.aula013;
import java.util.Scanner;
public class aula0013 {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("Digite 1 para somar");
System.out.println("Digite 2 para subtrair");
System.out.println("Digite 3 para multiplicar");
System.out.println("Digite 4 para dividir");
int i = in.nextInt();
System.out.println("Digite o primeiro número");
double num1 = in.nextDouble();
System.out.println("Digite o segundo número");
double num2 = in.nextDouble();
if(i==1){
System.out.println(num1+num2);
}else{
if(i==2){
System.out.println(num1-num2);
}else{
if(i==3){
System.out.println(num1*num2);
}else{
if(i==4){
System.out.println(num1/num2);
}else{
System.out.println("Operação inválida");
}
}
}
}
}
}
| [
"matheista@localhost.localdomain"
] | matheista@localhost.localdomain |
0eb1cdf0f5117c48510c97210ef0701ce142d902 | 9dab3e72da1dcc2bdfead324de914b184ebb128d | /app/src/main/java/com/example/menulab4/MyListAdapter.java | 10e945ea3d4588fb46245b89c1f7462b2e895429 | [] | no_license | leeyoonjin22/Day2 | 0196b8fb46e53fc2ea7d1dfed62cb968c9192b0d | 3d40850b4b7a5f5c25cc1323a813394fce405e35 | refs/heads/master | 2023-06-14T21:15:39.104035 | 2021-07-09T07:53:18 | 2021-07-09T07:53:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,552 | java | package com.example.menulab4;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
public class MyListAdapter extends RecyclerView.Adapter<MyListAdapter.MyListViewHolder> {
Context context;
ArrayList<String> data;
MyListAdapter(Context context,ArrayList<String> data){
this.context=context;
this.data=data;
}
@Override
public MyListViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
LayoutInflater inflater=LayoutInflater.from(context);
View view=inflater.inflate(R.layout.list_item,null);
return new MyListViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull MyListViewHolder holder, int position) {
holder.tv.setText(data.get(position).toString());
}
@Override
public int getItemCount() {
return data.size();
}
class MyListViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
TextView tv;
public MyListViewHolder(@NonNull View itemView) {
super(itemView);
tv=itemView.findViewById(R.id.tvTitle); //받아온 itemView의
tv.setOnClickListener(this);
}
@Override
public void onClick(View v) {
tv.setText("Clicked"+tv.getText().toString());
}
}
}
| [
"leeyi0190@naver.com"
] | leeyi0190@naver.com |
3fd50f9b57d6bc1ae90870bd3d4ea1e3a0c5e69a | dcac37de42f03916db747c36f9a7b373dd6a085c | /src/main/java/com/wyh/house/houseprice/crawler/execute/AJKTFXQExecute.java | b9eb9cbb97677ebf9d6783570501eb20baed1a48 | [] | no_license | LovePluto/houseprice | 0a1e8b519fe2755c5488328fc21b4ae781c4126f | f7ab3308b01a8e3473369026af72931f0f354179 | refs/heads/master | 2020-05-24T01:34:23.768617 | 2019-05-17T15:58:33 | 2019-05-17T15:58:33 | 187,037,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,289 | java | package com.wyh.house.houseprice.crawler.execute;
import com.wyh.house.houseprice.crawler.impl.AbstractCrawler;
import com.wyh.house.houseprice.po.House;
import com.wyh.house.houseprice.type.DistrictType;
import com.wyh.house.houseprice.type.SourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
/**
* 安居客天府新区的爬虫
*/
@Component
public class AJKTFXQExecute extends AbstractCrawlerExecute {
private final static String URL_PREFIX = "https://chengdu.anjuke.com/sale/tainfuxinqu/p";
private final static String URL_SUFFIX = "-t21/?from_price=80&to_price=200#filtersort";
@Autowired
@Qualifier("anjuke")
private AbstractCrawler<House> crawler;
@Override
protected AbstractCrawler getAbstractCrawler() {
return crawler;
}
@Override
protected SourceType getSourceType() {
return SourceType.ANJUKE;
}
@Override
protected DistrictType getDistrictType() {
return DistrictType.TFXQ;
}
@Override
protected String getUrlPrefix() {
return URL_PREFIX;
}
@Override
protected String getUrlSuffix() {
return URL_SUFFIX;
}
}
| [
"591712730@qq.com"
] | 591712730@qq.com |
23aa429609833d05638a3647f6a9db4bedf1b4ce | 431f8aac83f0f721f483f42f20fd02b94bbf3c6c | /src/main/java/net/krazyweb/helpers/FXHelper.java | 6859f89968bd8670ee0aa4d7d1c0cbb0f861f6a7 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | LunaTheArcticFox/Starbound-Mod-Manager | f90b0b1ca56ce79e2e170e602539023495b0e75b | c4f7e97f02f1682af754edea230c9a4a46f51dae | refs/heads/master | 2022-01-23T05:00:56.056318 | 2015-09-05T04:29:26 | 2015-09-05T04:29:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,114 | java | package net.krazyweb.helpers;
import javafx.scene.Node;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelReader;
import javafx.scene.image.PixelWriter;
import javafx.scene.image.WritableImage;
import javafx.scene.paint.Color;
public class FXHelper {
public static void setColor(final Node image, final Color color) {
FXHelper.setColor(image, color.getRed(), color.getGreen(), color.getBlue());
}
public static void setColor(final Node image, final double r, final double g, final double b) {
Image src = ((ImageView) image).getImage();
PixelReader reader = src.getPixelReader();
int width = (int) src.getWidth();
int height = (int) src.getHeight();
WritableImage dest = new WritableImage(width, height);
PixelWriter writer = dest.getPixelWriter();
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
Color c = new Color(r, g, b, reader.getColor(x, y).getOpacity());
writer.setColor(x, y, c);
}
}
((ImageView) image).setImage(dest);
}
}
| [
"traveler@krazyweb.net"
] | traveler@krazyweb.net |
380e29079e3b8dbf73cb03762b15fb8ab488ea84 | d0ab16d6fb8de62d928e33d30a2efaa1c7682207 | /hw 7/Part0/Graph.java | fc80485cdcf2375de746e0f6e4ce02061451b00a | [] | no_license | stern-shawn/CSE373_HWArchive | a6a4c3222aad6da95f23c7c6b5f8c7ccfa9f11b1 | 28cbbed599bff8ef9470d900f18f33b2209b3f00 | refs/heads/master | 2021-01-20T22:10:02.550781 | 2016-05-31T20:38:51 | 2016-05-31T20:38:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,071 | java | import java.util.Collection;
import java.util.HashMap;
// Shawn Stern - 0921475 - CSE 373, Spring 2012 - Homework 7 Step 0
public class Graph<V, E> extends AbstractGraph<V, E> {
// Add the given vertex to the graph if it doesn't already exist in the graph.
// Throws a NullPointerException if the passed object is null.
public void addVertex(V v) {
// Check if input is null, throw NullPointerException as appropriate.
checkForNull(v);
// If not already contained, put the vertex in with the addition of the
// necessary HashMap and VertexInfo. Do nothing if already contained.
if (!containsVertex(v)) {
// Put v and its info into the adjacency map and vertex info map.
adjacencyMap.put(v, new HashMap<V, EdgeInfo<E>>());
vertexInfo.put(v, new VertexInfo<V>(v));
}
}
// Return true if the vertex is in the graph, false otherwise.
public boolean containsVertex(V v) {
// If the vertex exists, it will be a key in the adjacencyMap.
return adjacencyMap.containsKey(v);
}
// Return the collection of vertices that are connected to the given vertex if it
// exists in the graph.
// Throws a NullPointerException if the given vertex is null.
// Throws an IllegalArgumentException if the given vertex does not exist in the map.
public Collection<V> neighbors(V v) {
// Check the vertex and throw the appropriate exceptions as needed.
checkVertex(v);
// Get the map of vertices connected to this node. The keyset of this map is all
// vertices its connected to, and a Set extends Collection so this shouldn't cause errors.
return adjacencyMap.get(v).keySet();
}
// Connect the two given vertices using the given edge, giving the edge a default weight of 1.
// Throws a NullPointerException if either vertex is null.
// Throws an IllegalArgumentException if either vertex is not in the graph.
public void addEdge(V v1, V v2, E e) {
// Exact same behavior as the larger add edge method, using default weight of 1.
addEdge(v1, v2, e, 1);
}
// Connect the two given vertices using the given edge and weight.
// Throws a NullPointerException if either vertex is null.
// Throws an IllegalArgumentException if either vertex is not in the graph,
// or if the weight is negative.
public void addEdge(V v1, V v2, E e, int weight) {
// Throw NullPointerException if e is null, since checkVertices only checks v1 and v2.
if (e == null) {
throw new NullPointerException();
}
// Check to make sure that the weight is valid as well.
if (weight < 0) {
throw new IllegalArgumentException();
}
// If there is already an edge connecting the two, we need to take that old edge
// out of the edge list to keep from having duplicates.
// This call to containsEdge also takes care of needing to check for exceptions,
// since the containsEdge code automatically calls checkVerticies.
if (containsEdge(v1, v2)) {
edgeList.remove(adjacencyMap.get(v1).get(v2).e);
}
// Add v2 and its edge info to v1's map, and repeat in the reverse order since the
// graph is undirected. Also add the edge to the edgeList.
// This action will always override existing mappings (behavior of put
// according to Java API).
adjacencyMap.get(v1).put(v2, new EdgeInfo<E>(e, weight));
adjacencyMap.get(v2).put(v1, new EdgeInfo<E>(e, weight));
edgeList.add(e);
}
// Returns true if there is an edge connecting the given vertices, false otherwise.
public boolean containsEdge(V v1, V v2) {
// Check vertices just to be safe even though the spec doesn't mention it.
checkVertices(v1, v2);
// If there is an edge from v1 to v2, then v2 will be contained in the mapping
// of vertices to hashtables that v1 maps to.
return adjacencyMap.get(v1).containsKey(v2);
}
// Returns the edge connecting the given vertices if they're connected, or null if not.
// Throws a NullPointerException if either vertex is null.
// Throws an IllegalArgumentException if either vertex is not in the graph.
public E edge(V v1, V v2) {
// Call to checkVerticies is accomplished by calling containsEdge,
// so no need to repeat it here!
// Pull the E object from EdgeInfo of v2.
// If they aren't connected, just return null.
return containsEdge(v1, v2) ? adjacencyMap.get(v1).get(v2).e : null;
}
// Return the weight of the edge the connects the given vertices, if they are connected.
// Throws a NullPointerException if either vertex is null.
// Throws an IllegalArgumentException if either vertex is not in the graph.
public int edgeWeight(V v1, V v2) {
// Check the vertices and throw the appropriate exceptions as needed.
checkVertices(v1, v2);
// Throw an IllegalArgumentException if the two edges aren't connected by an edge.
if (!containsEdge(v1, v2)) {
throw new IllegalArgumentException();
}
// Return the weight of the edge, even if it could hurt that edge's feelings.
return adjacencyMap.get(v1).get(v2).weight;
}
} | [
"stern.shawn@gmail.com"
] | stern.shawn@gmail.com |
5d64e910be37b9bacdd7d3306479fd9f990f082b | af4aeab035e4cc297f217653bdbce4ff9a14c400 | /app/src/main/java/com/coolweather/android/gson/AQI.java | 3942444ff43c9efb832d48bd079d8c3ad0543e06 | [
"Apache-2.0"
] | permissive | AaronChe/coolweather | 917ba43fc018955b6fb801439a133bf00b5a1285 | a94395ca75508488b576df8144e3a4b47f5ea175 | refs/heads/master | 2021-01-20T21:35:00.554446 | 2017-09-03T10:19:43 | 2017-09-03T10:19:43 | 101,770,023 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 284 | java | package com.coolweather.android.gson;
import com.google.gson.annotations.SerializedName;
/**
* Created by Administrator on 2017/9/1 0001.
*/
public class AQI {
public AQICity city;
public class AQICity {
public String aqi;
public String pm25;
}
}
| [
"tony@gmail.com"
] | tony@gmail.com |
f31a1d464e38b1ad9b0d0611e8aaabed48a20948 | a3ac2fb9bc40c9c62824ee6d86d2be4450b8e54e | /spring/spring-rest/src/main/java/service/TestService.java | 42fb6edb6e433fe7d9efe25e992e15981285863d | [] | no_license | somyungsub/study-spring | 452872ef653a742173ecf91eca6462c9759ee78a | 16877566943f11aa432a28eeb50a62890040e239 | refs/heads/master | 2023-01-08T21:26:52.610273 | 2020-12-28T06:55:57 | 2020-12-28T06:55:57 | 136,273,305 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 953 | java | package service;
import model.Test;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.List;
@Service
public class TestService {
public Test findByName(String name) {
System.out.println("findByName ");
String newName = name + "Test ~!! ";
final Test test = new Test();
test.setAge(33);
test.setName(newName);
return test;
}
public List<Test> findAll() {
System.out.println("findAll call");
return Arrays.asList(
new Test("test1", 1),
new Test("test2", 2),
new Test("test3", 3),
new Test("test4", 4)
);
}
public Long create(Test test) {
System.out.println("Create!!");
System.out.println("creaet test : " + test);
return 1L;
}
public void update(Test test) {
System.out.println("Update !!! Create");
}
public void delete(String name) {
System.out.println(" Delete !! Complete");
}
}
| [
"gkdldy5@naver.com"
] | gkdldy5@naver.com |
4791763d70c8cc8e476b79b3559a4afc5a535ae7 | 2d982a89db794554239d56adeb69274ff51da3dd | /oldCompanySystem/src/main/java/com/example/oldCompanySystem/Entity/AttendanceEntity/GroupInformationType.java | c85d8833d182a57338d5831456fac66778c979d4 | [] | no_license | FuShengming/InternetPlusPracticeCourse | 3c032523aaecc5564032414dd1c4ea3ac8f7b6b5 | b79668dfd8863b716e8ef39600fa5f7f50d67331 | refs/heads/master | 2022-12-23T14:54:00.145784 | 2020-09-25T06:48:59 | 2020-09-25T06:48:59 | 297,870,660 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,422 | java |
package com.example.oldCompanySystem.Entity.AttendanceEntity;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>GroupInformationType complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="GroupInformationType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="groupId" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="groupName" type="{http://www.w3.org/2001/XMLSchema}string"/>
* <element name="ability" type="{http://www.w3.org/2001/XMLSchema}int"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "GroupInformationType", propOrder = {
"groupId",
"groupName",
"ability"
})
public class GroupInformationType {
@XmlElement(required = true)
protected String groupId;
@XmlElement(required = true)
protected String groupName;
protected int ability;
/**
* 获取groupId属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getGroupId() {
return groupId;
}
/**
* 设置groupId属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGroupId(String value) {
this.groupId = value;
}
/**
* 获取groupName属性的值。
*
* @return
* possible object is
* {@link String }
*
*/
public String getGroupName() {
return groupName;
}
/**
* 设置groupName属性的值。
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGroupName(String value) {
this.groupName = value;
}
/**
* 获取ability属性的值。
*
*/
public int getAbility() {
return ability;
}
/**
* 设置ability属性的值。
*
*/
public void setAbility(int value) {
this.ability = value;
}
}
| [
"171250640@smail.nju.edu.cn"
] | 171250640@smail.nju.edu.cn |
c98c528ccb175dbae94de63c6c7ebbbdcc6f2cf5 | 9d964a3d542787b2da182c737a2cd26492c4b313 | /app/src/main/java/com/zhang/newapplication/presenter/BeautyPresenter.java | 966eb4070e912057cdaae5a1f7f7b4d37b1b11c5 | [] | no_license | fengyutongxing/NewApplication | f8792d14108a30afeaf19afaedfec6d63fd15ca6 | 5abcd61ef7a175a74005ef7bf6fb308b56e3cf5b | refs/heads/master | 2021-01-06T20:43:25.195810 | 2017-08-11T06:00:14 | 2017-08-11T06:00:14 | 99,546,516 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,638 | java | package com.zhang.newapplication.presenter;
import android.content.Context;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.ListView;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.zhang.newapplication.model.bean.BeautyBean;
import com.zhang.newapplication.views.adapter.ListAdapter;
import com.zhang.newapplication.views.interfaces.BeautyView;
import java.io.IOException;
import java.util.ArrayList;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
/**
* Created by zhang_shuai on 2017/7/11.
* Del:请求美女
*/
public class BeautyPresenter extends BasePresenter<BeautyView> {
//图片请求的网址和封装的不是同一服务器
private String url = "http://oatest.yuhong.com.cn/GetImages";
private ListView listView;
private Context context;
private ArrayList<BeautyBean> beanArrayList = new ArrayList<>();
//请求的数据集合
private ArrayList<BeautyBean> list;
public BeautyPresenter(Context context){
this.context = context;
}
private Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what){
case 1:
list = (ArrayList<BeautyBean>) msg.obj;
listView.setAdapter(new ListAdapter(list,context));
break;
}
}
};
public void getNetClick(final ListView listView) {
this.listView = listView;
//得到OKHttpClient对象
OkHttpClient okHttpClient = new OkHttpClient();
// 获取Request对象
Request request = new Request.Builder()
.url(url)
.build();
// 获取Call对象
Call call = okHttpClient.newCall(request);
//获取Response对象, 通过接口回调方式返回Response
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
//TODO 请求失败逻辑在这里处理
//TODO 注意:这里边都是子线程,所以要更改UI的时候需要发送到主线程才OK
}
@Override
public void onResponse(Call call, Response response) throws IOException {
//TODO 请求成功时候
//TODO 注意:这里边都是子程线,所以要更改UI的时候需要发送到主线程才OK
String result = response.body().string();
//Json的解析类对象
JsonParser parser = new JsonParser();
//将JSON的String 转成一个JsonArray对象
JsonArray jsonArray = parser.parse(result).getAsJsonArray();
Gson gson = new Gson();
//加强for循环遍历JsonArray
for (JsonElement user : jsonArray) {
//使用GSON,直接转成Bean对象
BeautyBean beautyBean = gson.fromJson(user, BeautyBean.class);
beanArrayList.add(beautyBean);
}
//在子线程中将Message对象发出去\s
Message message = new Message();
message.obj = beanArrayList;
message.what = 1;
handler.sendMessage(message);
}
});
}
public ArrayList<BeautyBean> getList(){
return list;
}
}
| [
"814011464@qq.com"
] | 814011464@qq.com |
1afbb56072b76c1874e162c2e61c863861fddf1c | 073351ab5ba8fd5e963896959beead3582559177 | /src/multithreading/l10ReentrantLocks.java | f44b0083938afe29354af1b10762e047fbaf561d | [] | no_license | sdaingade/algos-Sept2017 | d89929d7dc0b689387790ef303dd34499c61f450 | f0d430e0c1b99a6a6a44eb23abd2effec00e5db0 | refs/heads/master | 2022-12-26T06:15:44.777512 | 2020-10-07T09:39:29 | 2020-10-07T09:39:29 | 301,990,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,884 | java | package multithreading;
import java.util.Scanner;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;
public class l10ReentrantLocks {
private int count = 0;
private ReentrantLock lock = new ReentrantLock();
private Condition cond = lock.newCondition();
public void increment() {
for(int i = 0; i < 10000; i++)
count++;
}
public void method1() {
lock.lock();
System.out.println("Waiting in Thread 1...");
try {
cond.await(); //IMP!!! Not wait() as used with Condition object
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("Thread 1 woken up ...");
try {
increment();
} finally {
lock.unlock();
}
}
public void method2() {
try {
Thread.sleep(2000);
}catch (InterruptedException e) {
e.printStackTrace();
}
lock.lock();
System.out.println("Thread 2 acquired lock!");
System.out.println("Press the return key!");
new Scanner(System.in).nextLine();
System.out.println("Return key pressed!");
cond.signal();; //Lock cannot be gained by other thread before we unlock it
// After you call signal you have to call unlock(). Just calling signal is not enough
//IMP!!! signal() not notify() as used with Condition Obj
System.out.println("Thread 2 has notified one thread...");
try {
increment();
}finally {
System.out.println("Thread 2 about to unlock...");
lock.unlock();
}
}
public static void main(String[] args) {
final l10ReentrantLocks rl = new l10ReentrantLocks();
Thread t1 = new Thread(new Runnable() {
public void run() {
rl.method1();
}
});
Thread t2 = new Thread(new Runnable() {
public void run(){
rl.method2();
}
});
t1.start();
t2.start();
try {
t1.join();
t2.join();
} catch(InterruptedException e) {
e.printStackTrace();
}
}
}
| [
"swapnil.daingade@gmail.com"
] | swapnil.daingade@gmail.com |
e7a65c95697cc5ac3bfc60667fd76d26416a63cd | 22fa8e9fc974254ee1e14660d21b4254f347706b | /samples/sunflow/eco_src/org/sunflow/system/ByteUtil.java | 5c9c00149993a23f3b770ee3c71767e8400911eb | [
"BSD-3-Clause",
"MIT"
] | permissive | pl-eco/ECO | 35aa0391dcb564bd35da8d1151dbde3c3e7c03d4 | d207aa257ab02ee5b918bb4321fcac3dbd30d479 | refs/heads/master | 2016-09-03T07:25:27.488921 | 2015-03-04T16:07:40 | 2015-03-04T16:07:40 | 17,924,190 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 18,770 | java | package org.sunflow.system;
public class ByteUtil {
final public static byte[] get2Bytes(int i) { byte[] b = new byte[2];
b[0] = (byte) (i & 255);
b[1] = (byte) (i >> 8 &
255);
return b; }
final public static byte[] get4Bytes(int i) { byte[] b = new byte[4];
b[0] = (byte) (i & 255);
b[1] = (byte) (i >> 8 &
255);
b[2] = (byte) (i >> 16 &
255);
b[3] = (byte) (i >> 24 &
255);
return b; }
final public static byte[] get4BytesInv(int i) { byte[] b = new byte[4];
b[3] = (byte) (i & 255);
b[2] = (byte) (i >> 8 &
255);
b[1] = (byte) (i >> 16 &
255);
b[0] = (byte) (i >> 24 &
255);
return b; }
final public static byte[] get8Bytes(long i) { byte[] b = new byte[8];
b[0] = (byte) (i & 255);
b[1] = (byte) ((long) ((long)
i >>
(long)
8) &
(long)
255);
b[2] =
(byte)
((long)
((long)
i >>
(long)
16) &
(long)
255);
b[3] =
(byte)
((long)
((long)
i >>
(long)
24) &
(long)
255);
b[4] =
(byte)
((long)
((long)
i >>
(long)
32) &
(long)
255);
b[5] =
(byte)
((long)
((long)
i >>
(long)
40) &
(long)
255);
b[6] =
(byte)
((long)
((long)
i >>
(long)
48) &
(long)
255);
b[7] =
(byte)
((long)
((long)
i >>
(long)
56) &
(long)
255);
return b;
}
final public static long toLong(byte[] in) { return (long)
((long)
ByteUtil.
toInt(
in[0],
in[1],
in[2],
in[3]) |
(long)
ByteUtil.
toInt(
in[4],
in[5],
in[6],
in[7]) <<
(long)
32);
}
final public static int toInt(byte in0, byte in1, byte in2,
byte in3) { return in0 &
255 |
(in1 &
255) <<
8 |
(in2 &
255) <<
16 |
(in3 &
255) <<
24; }
final public static int toInt(byte[] in) { return ByteUtil.
toInt(
in[0],
in[1],
in[2],
in[3]);
}
final public static int toInt(byte[] in, int ofs) { return ByteUtil.
toInt(
in[ofs +
0],
in[ofs +
1],
in[ofs +
2],
in[ofs +
3]);
}
final public static int floatToHalf(float f) { int i =
Float.
floatToRawIntBits(
f);
int s =
i >>
16 &
32768;
int e =
(i >>
23 &
255) -
(127 -
15);
int m =
i &
8388607;
if (e <=
0) {
if (e <
-10) {
return 0;
}
m =
(m |
8388608) >>
1 -
e;
if ((m &
4096) ==
4096)
m +=
8192;
return s |
m >>
13;
}
else
if (e ==
255 -
(127 -
15)) {
if (m ==
0) {
return s |
31744;
}
else {
m >>=
13;
return s |
31744 |
m |
(m ==
0
? 0
: 1);
}
}
else {
if ((m &
4096) ==
4096) {
m +=
8192;
if ((m &
8388608) ==
8388608) {
m =
0;
e +=
1;
}
}
if (e >
30) {
return s |
31744;
}
return s |
e <<
10 |
m >>
13;
}
}
public ByteUtil() { super(); }
final public static String jlc$CompilerVersion$jl =
"2.5.0";
final public static long jlc$SourceLastModified$jl =
1159026718000L;
final public static String jlc$ClassType$jl =
("H4sIAAAAAAAAAL1Ze2wUxxkf39n4GWwMmFeCwZjwsm/9ODs2RgLHNnBwgGsD" +
"ISbEGe/NnRf2dpfd\nOXM2KCWNCjQ0behLjdRSqKgIlDRp05ZUSig0pE2K1C" +
"ap0khIeVRUfahNmygSoWr/6Dcze7d3e74L\nje1a2rnZnW++b77f95hvxhfe" +
"RwWWie6ULR8dNYjl6+rvxaZFQl0qtqzt8GlQfrmguPfsZk33oLwg\n8ighis" +
"qDsiWFMMWSEpIC3R1xE60ydHU0ourUR+LUt1dtsfltCrZkMLzv5MXKR87kV3" +
"tQQRCVY03T\nKaaKrvWoJGpRVBHci0ewFKOKKgUVi3YE0R1Ei0W7dM2iWKPW" +
"fvQw8gbRNENmPClaHEwIl0C4ZGAT\nRyUuXurlYoHDTJNQrGgk1JkUBzPr0m" +
"fCsu15fZnUwKSIDe4EdfgKQOtFSa2FthmqGt6ndrYeOnXO\ni8oHULmi9TNm" +
"MmhCQd4AKouS6BAxrc5QiIQG0AyNkFA/MRWsKmNc6gCqtJSIhmnMJFYfsXR1" +
"hBFW\nWjGDmFxm4mMQlclMJzMmU91MYhRWiBpKvBWEVRwBtasctYW669l3UL" +
"BEgYWZYSyTxJT8fYoGFq92\nz0jqWLsZCGBqYZTQYT0pKl/D8AFVCluqWItI" +
"/dRUtAiQFugxkELR/KxMGdYGlvfhCBmkaK6brlcM\nAVUxB4JNoWi2m4xzAi" +
"vNd1kpxT6rqm4ee+pbl9Zx384PEVll6y+BSQtdk/pImJhEk4mYeCvm+1rg\n" +
"/tidHoSAeLaLWNB0Lr24I/iXn1cLmgXj0Gwb2ktkOihvPVHdd3CDjrxsGUWG" +
"binM+Gma83DotUc6\n4gZEbVWSIxv0JQYv9/3y/sPnyd88qCSApsm6GouCH8" +
"2Q9aihqMTcQDRiYkpCAVRMtFAXHw+gQugH\nweXF123hsEVoAOWr/NM0nb8D" +
"RGFgwSAqhr6ihfVE38B0mPfjBkKoEB5UBo8XiT/+S5HPJ1kxLazq\nByTLlC" +
"XdjDjvoxYlUeneUUp2MG2Y3xgUbZKG9SiRsIw1RdOliAKRKuv1ITLCfv8nbn" +
"G2vsoDeXks\n4bkDVwWf36irIWIOymdv/PpQz+YvHBNOwRzZ1oyiBSDEZwvx" +
"CSG+hBCUl8d5z2LChEkA0H0QmpDE\nylb079n00LEaACJuHMgHNBhpDehgr6" +
"BH1ruc+A3wVCeDE8397u6jvltn1wonkrKn2XFnl7729LVT\nH5Wt9CDP+DmQ" +
"aQZZuISx6WWJM5nbat1RMx7/fzy25bnfX3t7uRM/FNVmhHXmTBaWNW4bmLpM" +
"QpDo\nHPZn5pV770M7T3hQPsQ65De+fkgdC90y0sKzI5HqmC6FQVQa1s0oVt" +
"lQIj+V0GFTP+B84c5RwZpZ\nwk+YIV0L5Fny1qPTGt56ofRlrnEioZanbFn9" +
"hIrwnOH4wXaTEPj+9jd7v/r194/u5k5gewGFfSw2\npCpyHKbc7UyBuFQhNz" +
"Ab1e7QonpICSt4SCXMmf5TvrTxJ3//UoVAXYUvCaPVfTID5/u8e9Hhaw9+\n" +
"vJCzyZPZvuCo4ZAJbWY6nDtNE4+ydcQfeeOuJ3+Fvw1pC1KFpYwRHv2Ia4Y4" +
"jj4O7wre1rvGGlhT\nA7zrsnj1OLvwoHzofKQmtv/Vn/FVl+LU7TzVDFuw0S" +
"GMymXPBKFVyG7SshIbnW2wtoqZYI47ejdi\naxiY+S9vfaBCvfxvEDsAYmXY" +
"Iq1tJuSLeJqlbeqCwutXXqp66HUv8qxHJaqOQ+sx939UDI5HrGFI\nNXFj7T" +
"q+jIoDRazluCBYQvX4RuyJGpTDPvb8nB+vOXvyHZYSjDhXb74NK39Zwtu7bQ" +
"dj/eUuKhPd\nlW1P5Pv50V0flh3BV/eIpFOZvs/0QC3259GXyLI1j/9hnBRZ" +
"THWjXiUjRE2RWcxEpiW7LbxccEL9\nsXPfv0hfX7VaiFyZPc+5J65cfWqsev" +
"Uzxz9Fiqt2geBmPWNkwWe8w8orHl7RiOyWUQmlT+pIhQOE\nwnpipsaAZV/K" +
"uEcuSnrkXGYOCZ4C2yML3B4pclGGVb0Uco+iYV6uLIccYvHCMu6KtrzkTjM3" +
"tcI3\nlShUCiM8V944UvPiKzu+c1TgviJHGZ86a1D+7Lvv7fN++cqQmOeull" +
"zEJxae+dNzN/pmCXcRJeWS\njKoudY4oK7n65QZz2MW5JHDqq6sWX3i47x2+" +
"IjZvLUVeqGd5f2uONLSLNRvAcSOENrHN3GK5PwUv\nnu+YmHNPdM/sa9/9KH" +
"e1YijSsbXVsTUcjVgvD+BYmh3GJLNBedmeix9cuUSW8ZRSpFhwsug0I+MU\n" +
"rClzPsTnyZa3wif5jpg/hC3hV+5KP7OQT6vPud7T7dyxzf7dToEhqG8YBpRq" +
"Qr325sYmQKMS0GDn\nPZ8S8gV1GauB7tNXSt84EWvdJOx/RwpBoPvQs5vKik" +
"4fP8LjxoalOKWwtd8LR7C51Ukd7AdThD9d\nxSfrJpFCimWoeFTaZhCtJ252" +
"i1de/a1uamura26ob29cSdHSHGWcz3EDtqJG1mwUCLWMm7Az8m9X\nZnxPt+" +
"N7+u3GN+tv5sHNmmCWwGav/ZyHnsPB97Nmr3Bwv6PZgMFHH3TZ288Hh1hDp8" +
"4azQ3tdU3N\n9S1Nt2ENv8sa+yZijSZ45tnWmDdV1jicwxqfY81BisqSmgW0" +
"kVwGaXUM8vmpM0jjPe11je31/mYw\nyPLbMkhi2dwmhyZikwZ4am2b1E6uTT" +
"IynKprEc7zRA4bfYM1XxQR0/aJEdPmGOjJKcxf/pa6pnvq\nW1tvI2LaXBHz" +
"+ESs44PHb1vHPwXWGR/VpgYH1bMU9U/ePcDqlqa65tZ6fwuFvUnjsr+Xwxcu" +
"sOYU\nlFhUD4LvsLevOMiengiyAXjabGTbJgnZfE6VzxF1NZzlT3Oo+jxrfg" +
"ilJdUDGj9T9jua/mgimtbB\ns8bWdM3/z4caHR+6Ork+1NpQ1+yHbOn40C9y" +
"APsqa17MAuyliQDbAs86G9h1kwSsh1N5cgHb5AD7\n5iQD608BliPFF/C7HO" +
"heZ81vsqD724luTN02ut1T4LYpG1MBQILFYeWPOXT9K2vepaiUk2/XN2I1\n" +
"7NL4vdvVOE5RUQJ8dsUzN+O/GeIGXg5eP/jAzeCb/xKHjsQteSlU9OGYqqYc" +
"d1OPvtMMk4QVvuhS\ncREjXOkDiiozty92hOUdvsJ/CtKPQM8UUooK7V4q0U" +
"045gER635s8IE5FFXwKxT2bwefuGNPvwBh\n2i5JO6PxfxolrgFi4t9Gg/Ku" +
"p3cvih/f/gQ/8BXIKh4bY2xK4OwirhSTVwmLs3JL8HoNPfvMzhd+\n0J44nq" +
"ZdNmY4YqMYzW5JNtBu/BfBGiinwBsAAA==");
}
| [
"anthony.canino1@gmail.com"
] | anthony.canino1@gmail.com |
f38066f86279cd4883cbc1c19798c35ff3e859c1 | f02c1af38358cd23b20ade438f1c874b4f4babf6 | /app/src/main/java/com/finalproject/youcef/youcefstoreapp/MainActivity.java | 20d1dae07eb2249060b7b89fe0c34035453dd5c8 | [] | no_license | Irish-Developer/Youcef-Store-App | 9fcb9300650dc5866ed8034ad9041a504e4bbc77 | 9230c3fd93fd23551f5ce1ded58d8579d096d884 | refs/heads/master | 2021-05-14T16:12:01.969450 | 2018-01-16T00:30:41 | 2018-01-16T00:30:41 | 116,012,695 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,224 | java | package com.finalproject.youcef.youcefstoreapp;
/*
*
* @uthor: Youcef O'Connor
* Date: 02/12/16
*/
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.firebase.ui.auth.AuthUI;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.ChildEventListener;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
public class MainActivity extends AppCompatActivity {
private static final String TAG = "MainActivity";
public static final String ANONYMOUS = "anonymous";
public static final int RC_SIGN_IN = 1; //RC stands for Request Code
private String pUsername;
////////using classes from the FirebaseDatabase API////////////////////////////////////
///////These are Firebase instance variables /////////////////////////////////////////
//entry point for the app to access the database
private FirebaseDatabase pFirebaseDatabase;
//DatabaseReference object is a class that references a spacific part of the database
private DatabaseReference pMessagesDatabaseReference; //referencing the messaging part of the database
//read from the messages node on the database
private ChildEventListener pChildEventListener;
//Authentication Instance variables
//This is where user authentication details are stored in the Firebase database
private FirebaseAuth pFirebaseAuth;
//This variable checks for updates in FirebaseAuth database
private FirebaseAuth.AuthStateListener pAuthStateListener;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//Anonymous user is used when authentication is deactivated
pUsername = ANONYMOUS;
pFirebaseDatabase = FirebaseDatabase.getInstance();
pFirebaseAuth = FirebaseAuth.getInstance();
Button next = (Button) findViewById(R.id.add_prodBtn);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), AddProductImage.class);
startActivityForResult(myIntent, 0);
}
});
//this will let system know if the user authentic or not right away
pAuthStateListener = new FirebaseAuth.AuthStateListener() {
@Override
public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
FirebaseUser user = firebaseAuth.getCurrentUser();
if (user != null) {
//user is signed in
Toast.makeText(MainActivity.this, "Signed in successful!", Toast.LENGTH_SHORT).show();
onSignedIInitialize(user.getDisplayName());
} else {
// /user is not signed in
onSignedOutCleanup();
startActivityForResult(
AuthUI.getInstance()
.createSignInIntentBuilder()
.setIsSmartLockEnabled(false)
.setProviders(
AuthUI.EMAIL_PROVIDER,
AuthUI.GOOGLE_PROVIDER)
.build(),
RC_SIGN_IN);
}
}
};
}
//Toast used to inform user of login status
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == RC_SIGN_IN){
if (requestCode == RESULT_OK){
Toast.makeText(this, "Signed in!", Toast.LENGTH_SHORT).show();
}else if (requestCode == RESULT_CANCELED){
Toast.makeText(this, "Sign in Canceled", Toast.LENGTH_SHORT).show();
}
}
}
//Displaying the main menu
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main_menu, menu);
return true;
}
//Activating Sign out option in main menu
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.sing_out_menu:
//Sign out option
AuthUI.getInstance().signOut(this);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
//this pauses the login procedure at the launch (if user is already logged in)
@Override
protected void onPause() {
super.onPause();
if (pAuthStateListener != null) {
pFirebaseAuth.removeAuthStateListener(pAuthStateListener);
}
detachDatabaseReadListener();
}
//this resumes the login procedure at the launch (if the user is not logged on)
@Override
protected void onResume() {
super.onResume();
pFirebaseAuth.addAuthStateListener(pAuthStateListener);
}
//Retrieving the username
private void onSignedIInitialize(String username) {
pUsername = username;
attachDatabaseReadListener(); // calls the attachDatabaseReadListener method
}
private void onSignedOutCleanup() {
pUsername = ANONYMOUS;
}
private void attachDatabaseReadListener() {
if (pChildEventListener == null) {
}
}
private void detachDatabaseReadListener() {
if (pChildEventListener != null) {
pMessagesDatabaseReference.removeEventListener(pChildEventListener);
pChildEventListener = null;
}
}
}
| [
"x13114557@student.ncirl.ie"
] | x13114557@student.ncirl.ie |
e38e67e3293f24ef2bcdf3da0d799e4fa8115bba | d857db18aa8643253ab7da88c4894b75deae1b78 | /app/src/main/java/com/danggui/publishsystem/ui/publish/PublishNotFragment.java | 40a9bf788adf1bd0ef2d0f0fffe3408d3756ab91 | [] | no_license | ielitf/PublishSystem | 5fec5a7737c93b2259d88886951e1f1ee7fcd815 | 50e254d191428946e4829d7d7256cc29b39bcdf8 | refs/heads/master | 2022-01-21T02:23:55.971434 | 2019-06-14T11:01:42 | 2019-06-14T11:01:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,991 | java | package com.danggui.publishsystem.ui.publish;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import com.alibaba.fastjson.JSON;
import com.danggui.publishsystem.R;
import com.danggui.publishsystem.adapter.PublishNotListAdapter;
import com.danggui.publishsystem.base.BaseFragment;
import com.danggui.publishsystem.bean.PublicListBean;
import com.danggui.publishsystem.control.CodeConstants;
import com.danggui.publishsystem.ui.me.LoginActivity;
import com.danggui.publishsystem.widget.PullToRefreshLayout;
import com.danggui.publishsystem.widget.pullableview.PullableListView;
import com.lzy.okgo.OkGo;
import com.lzy.okgo.callback.StringCallback;
import com.lzy.okgo.model.Response;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class PublishNotFragment extends BaseFragment {
private PullableListView mListView;
private PullToRefreshLayout pullToRefreshLayout;
private PublishNotListAdapter publishNotListAdapter;
private ArrayList<PublicListBean> list = new ArrayList<>();
private int curPage = 1;
private boolean isPullToRefresh = false;
public PublishNotFragment() {
// Required empty public constructor
}
@Override
protected void onCreateView(Bundle savedInstanceState) {
setContentView(R.layout.fragment_publish_not);
initViews();
loadData(curPage);
mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent = new Intent(mContext, PublishNewsDetailsActivity.class);
intent.putExtra(CodeConstants.ID, list.get(position).getId());
intent.putExtra(CodeConstants.NAME, list.get(position).getName());
intent.putExtra(CodeConstants.START_DATA, list.get(position).getStartDate());
intent.putExtra(CodeConstants.END_DATA, list.get(position).getEndDate());
startActivity(intent);
}
});
pullToRefreshLayout.setOnRefreshListener(new PullToRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh(PullToRefreshLayout pullToRefreshLayout) {
isPullToRefresh = true;
curPage = 1;
loadData(curPage);
}
@Override
public void onLoadMore(PullToRefreshLayout pullToRefreshLayout) {
isPullToRefresh = false;
loadData(curPage + 1);
}
});
}
@Override
protected boolean hasPopWindow() {
return false;
}
@Override
protected boolean isNeedInitBack() {
return false;
}
@Override
protected String getTopbarTitle() {
return null;
}
private void loadData(final int page) {
OkGo.<String>get(CodeConstants.URL_Query + "/publishs?")
.headers("Token", CodeConstants.HEADERS)
.params(CodeConstants.PAGE, page)
.params(CodeConstants.PAGE_SIZE, 5)
.params(CodeConstants.PUBLISH_STATUS, 4)
.execute(new StringCallback() {
@Override
public void onSuccess(Response<String> response) {
Log.i("test", response.body());
try {
JSONObject jsonObject = new JSONObject(response.body());
if (jsonObject.getInt("code") == 0) {
String content = jsonObject.getString("data");
JSONObject jsonObject2 = new JSONObject(content);
String content2 = jsonObject2.getString("list");
if (!TextUtils.isEmpty(content2) && !content2 .equals("[]")) {
if (page == 1) {
list.clear();
}
curPage = curPage + 1;
list.addAll(JSON.parseArray(content2, PublicListBean.class));
if (publishNotListAdapter == null) {
publishNotListAdapter = new PublishNotListAdapter(mContext, list);
mListView.setAdapter(publishNotListAdapter);
} else {
publishNotListAdapter.notifyDataSetChanged();
}
}
} else if (jsonObject.getInt("code") == 1005) {
showToast(jsonObject.getString("msg"));
startActivity(new Intent(activity, LoginActivity.class));
} else {
showToast(jsonObject.getString("msg"));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
@Override
public void onError(Response<String> response) {
super.onError(response);
pullToRefreshLayout.refreshFinish(PullToRefreshLayout.FAIL);
}
@Override
public void onFinish() {
pullToRefreshLayout.refreshFinish(PullToRefreshLayout.SUCCEED);
}
});
}
private void initViews() {
mListView = (PullableListView) findViewById(R.id.publish_not_list);
pullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.refresh_view);
}
}
| [
"893305119@qq.com"
] | 893305119@qq.com |
ced91116aadfa2e3ee5c918ac0e5a536a8880fec | 22fd8d017d42f2f656f6ba751e3ff9feda5b9796 | /game-utils/src/main/java/com/wjybxx/fastjgame/time/DailyTimeOffset.java | f7a369f1cc36c1a880bf5d9be62bf692f7752485 | [
"Apache-2.0"
] | permissive | phantacix/fastjgame | ff7eec17917a40c7e324aee503d073bcd0ec3386 | 5d02bf16943aec044bac4fd40352bde03bf4fccd | refs/heads/master | 2020-06-28T08:02:09.450914 | 2019-07-28T10:58:33 | 2019-07-28T10:58:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,239 | java | /*
* Copyright 2019 wjybxx
*
* 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.wjybxx.fastjgame.time;
import com.wjybxx.fastjgame.utils.TimeUtils;
import org.apache.commons.lang3.StringUtils;
import java.time.LocalTime;
/**
* 每日时间,一天内的时间偏移量。
*
* 时间和分钟,它是相对于00:00的一个时间偏移量。
* 表格格式 HH:mm 或 HH:mm:ss
* 它是一个不可变对象。
*
* @author wjybxx
* @version 1.0
* date - 2019/7/7 22:50
* github - https://github.com/hl845740757
*/
public class DailyTimeOffset implements TimeOffset{
private final LocalTime time;
public DailyTimeOffset(int hour, int min) {
this(hour, min, 0);
}
public DailyTimeOffset(int hour, int min, int sec) {
this(LocalTime.of(hour, min, sec));
}
public DailyTimeOffset(LocalTime time) {
this.time = time;
}
/**
* 转换为相对于00:00的偏移量
* @return offset
*/
@Override
public long toOffset() {
return time.toSecondOfDay() * TimeUtils.SEC;
}
@Override
public String toString() {
return "DailyTimeOffset{" +
"time=" + time +
'}';
}
/**
* 从配置中解析出小时和分钟
* @param confParam 表格配置,HH:mm 或 HH:mm:ss
* @return HourAndMin
*/
public static DailyTimeOffset parseFromConf(String confParam) {
int count = StringUtils.countMatches(confParam, ':');
if (count == 1) {
// count == 1 表示两段
return new DailyTimeOffset(LocalTime.parse(confParam, TimeUtils.HH_MM));
} else if (count == 2){
// count ==2 表示3段
return new DailyTimeOffset(LocalTime.parse(confParam, TimeUtils.HH_MM_SS));
} else {
throw new ConfigFormatException("Unsupported HourAndMin format " + confParam);
}
}
}
| [
"845740757@qq.com"
] | 845740757@qq.com |
fed0a3dea5c03d7b05a44fb9448ae5ffbde89375 | de7d4e575569e57548e0c5e8807e29f6e0481b53 | /src/io/github/lgxkdream/test/unit14/CountOfSmallerNumbersAfterSelf.java | c7a52c95ebe926c4235a2d7e51dfa9f5c7c358d0 | [
"Unlicense"
] | permissive | lgxkdream/algorithm-problems | 235ce3a6405b96962ecf4c08819778d771dc04d7 | 4ab84185ffc7c5613b296430623e2e1ec783399b | refs/heads/master | 2023-06-23T05:33:12.768898 | 2022-06-24T12:38:45 | 2022-06-24T12:38:45 | 160,291,182 | 0 | 0 | Unlicense | 2023-06-14T22:28:34 | 2018-12-04T03:30:43 | Java | UTF-8 | Java | false | false | 4,545 | java | package io.github.lgxkdream.test.unit14;
import java.util.ArrayList;
import java.util.List;
/**
* @author Jacky Lee
* @version 1.0.0
* @title 315. 计算右侧小于当前元素的个数
* @description
* @since 2020-07-11 12:19
*/
public class CountOfSmallerNumbersAfterSelf {
public static void main(String[] args) {
/**FF
* 输出: [2,1,1,0]
* 解释:
* 5 的右侧有 2 个更小的元素 (2 和 1).
* 2 的右侧仅有 1 个更小的元素 (1).
* 6 的右侧有 1 个更小的元素 (1).
* 1 的右侧有 0 个更小的元素.
*/
System.out.println(countSmaller(new int[]{5, 2, 6, 1}));
}
private static int[] temp;
private static int[] counter;
private static int[] indexes;
/**
* 归并排序思想 TODO
*
* @param nums
* @return
*/
public static List<Integer> countSmaller(int[] nums) {
List<Integer> res = new ArrayList<>();
int len = nums.length;
if (len == 0) {
return res;
}
temp = new int[len];
counter = new int[len];
indexes = new int[len];
for (int i = 0; i < len; i++) {
indexes[i] = i;
}
countSmaller(nums, 0, len - 1);
for (int i = 0; i < len; i++) {
res.add(counter[i]);
}
return res;
}
private static void countSmaller(int[] nums, int l, int r) {
if (l == r) {
// 数组只有一个元素的时候,没有比较,不统计
return;
}
int mid = l + (r - l) / 2;
countSmaller(nums, l, mid);
countSmaller(nums, mid + 1, r);
// 归并排序的优化,同样适用于该问题
// 如果索引数组有序,就没有必要再继续计算了
if (nums[indexes[mid]] > nums[indexes[mid + 1]]) {
countSmaller(nums, l, mid, r);
}
}
private static void countSmaller(int[] nums, int l, int mid, int r) {
// 3,4 1,2
for (int i = l; i <= r; i++) {
temp[i] = indexes[i];
}
int i = l;
int j = mid + 1;
// 左边出列的时候,计数
for (int k = l; k <= r; k++) {
if (i > mid) {
indexes[k] = temp[j];
j++;
} else if (j > r) {
indexes[k] = temp[i];
i++;
// 此时 j 用完了,[7,8,9 | 1,2,3]
// 之前的数就和后面的区间长度构成逆序
counter[indexes[k]] += (r - mid);
} else if (nums[temp[i]] <= nums[temp[j]]) {
indexes[k] = temp[i];
i++;
// 此时 [4,5, 6 | 1,2,3 10 12 13]
// mid j
counter[indexes[k]] += (j - mid - 1);
} else {
// nums[indexes[i]] > nums[indexes[j]] 构成逆序
indexes[k] = temp[j];
j++;
}
}
}
// =======================
public List<Integer> countSmaller1(int[] nums) {
if (nums.length == 0) {
return new ArrayList<>();
}
int min = Integer.MAX_VALUE; // nums数组最小值
for (int value : nums) {
if (value < min) {
min = value;
}
}
for (int i = 0; i < nums.length; i++) {
nums[i] = nums[i] - min + 1;
}
int max = Integer.MIN_VALUE;
for (int value : nums) {
if (value > max) {
max = value;
}
}
int[] BITree = new int[max + 1];
BITree[0] = 0;
int[] countArr = new int[nums.length];
for (int i = nums.length - 1; i >= 0; i--) {
int count = getSum(nums[i] - 1, BITree);
countArr[i] = count;
update(nums[i], BITree);
}
List<Integer> result = new ArrayList<>();
for (int value : countArr) {
result.add(value);
}
return result;
}
public static int getSum(int value, int[] BITree) { // 获得a[i]从1,value的和
int sum = 0;
while (value > 0) {
sum += BITree[value];
value -= (value & -value);
}
return sum;
}
public static void update(int value, int[] BITree) {
while (value <= BITree.length - 1) {
BITree[value] += 1;
value += (value & -value);
}
}
}
| [
"ligang.666@bytedance.com"
] | ligang.666@bytedance.com |
6cdc3e651184a330ae24bf808b3b014c983caf9b | 87f9053a48059aeb5753a749a33e5861ca0782d8 | /chapter_004/src/main/java/tracker/MenuTracker.java | f48f1d357b21bbd3564e40294c3fde2500060a67 | [
"Apache-2.0"
] | permissive | a11exe/job4j | 1213a7adde39f06144dd790d57da2290e8f68e5d | 45926fc0163f199388a0b381da051f1c826c394d | refs/heads/master | 2022-11-18T16:40:43.141631 | 2020-02-19T11:37:40 | 2020-02-19T11:37:40 | 164,211,899 | 35 | 60 | Apache-2.0 | 2022-11-16T12:00:08 | 2019-01-05T12:14:16 | Java | UTF-8 | Java | false | false | 7,708 | java | package tracker;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
/**
* Основное меню трекера.
*
* @author Alexander Abramov (alllexe@mail.ru)
* @version 1
* @since 06.02.2019
*/
public class MenuTracker {
private static final int ADD = 0;
private static final int SHOW_ALL = 1;
private static final int EDIT = 2;
private static final int DELETE = 3;
private static final int FIND_BY_ID = 4;
private static final int FIND_BY_NAME = 5;
private static final int EXIT = 6;
/**
* Признак выхода из меню
*/
private boolean exit = false;
/**
* хранит ссылку на объект .
*/
private final Input input;
/*
* вывод данных
*/
private final Consumer<String> output;
/**
* хранит ссылку на объект .
*/
private final Tracker tracker;
/**
* хранит ссылку на массив типа UserAction.
*/
private final List<UserAction> actions = new ArrayList<>();
/**
* Конструктор.
*
* @param input объект типа Input
* @param tracker объект типа Tracker
*/
public MenuTracker(Input input, Tracker tracker, Consumer<String> output) {
this.input = input;
this.tracker = tracker;
this.output = output;
}
public boolean isExit() {
return exit;
}
public void setExit(boolean exit) {
this.exit = exit;
}
/**
* Метод заполняет массив.
*/
public void fillActions() {
this.actions.add(new AddItem(ADD, "Add new item"));
this.actions.add(new ShowItems(SHOW_ALL, "Show all items"));
this.actions.add(new UpdateItem(EDIT, "Edit item"));
this.actions.add(new DeleteItem(DELETE, "Delete item"));
this.actions.add(new FindItemById(FIND_BY_ID, "Find item by Id"));
this.actions.add(new FindItemsByName(FIND_BY_NAME, "Find items by name"));
this.actions.add(new ExitProgram(EXIT, "Exit Program"));
}
/**
* Метод в зависимости от указанного ключа, выполняет соотвествующие действие.
*
* @param key ключ операции
*/
public void select(int key) {
this.actions.get(key).execute(this.input, this.tracker);
}
public List<Integer> range() {
return this.actions.stream().mapToInt(UserAction::key).boxed().collect(Collectors.toList());
}
/**
* Метод выводит на экран меню.
*/
public void show() {
for (UserAction action : this.actions) {
if (action != null) {
this.output.accept(action.info());
}
}
}
public class AddItem extends BaseAction {
public AddItem(int key, String name) {
super(key, name);
}
@Override
public void execute(Input input, Tracker tracker) {
output.accept("------------ Adding new item --------------");
String name = input.ask("Please, provide item name:");
String desc = input.ask("Please, provide item description:");
Item item = new Item(name, desc);
tracker.add(item);
output.accept("------------ New Item with Id : " + item.getId());
output.accept("------------ New Item with Name : " + item.getName());
output.accept("------------ New Item with Description : " + item.getDesc());
}
}
private class ShowItems extends BaseAction {
public ShowItems(int key, String name) {
super(key, name);
}
@Override
public void execute(Input input, Tracker tracker) {
output.accept("------------Список всех заявок------------");
tracker.findAll().forEach(System.out::println);
}
}
private class UpdateItem extends BaseAction {
public UpdateItem(int key, String name) {
super(key, name);
}
@Override
public void execute(Input input, Tracker tracker) {
output.accept("------------ Редактирование заявки по номеру --------------");
String id = input.ask("Введите номер заявки :");
Item item = tracker.findById(id);
if (item != null) {
output.accept(item.toString());
String name = input.ask("Введите новое имя заявки :");
String desc = input.ask("Введите новое описание заявки :");
Item itemNew = new Item(name, desc);
itemNew.setId(item.getId());
if (tracker.replace(id, itemNew)) {
output.accept(actionMsg("Изменена", id));
} else {
output.accept(actionMsg("Не удалось изменить", id));
}
} else {
output.accept(actionMsg("Не найдена", id));
}
}
}
private class DeleteItem extends BaseAction {
public DeleteItem(int key, String name) {
super(key, name);
}
@Override
public void execute(Input input, Tracker tracker) {
output.accept("------------ Удаление заявки по номеру --------------");
String id = input.ask("Введите номер заявки :");
if (tracker.delete(id)) {
output.accept(actionMsg("Удалена", id));
} else {
output.accept(actionMsg("Ошибка удаления", id));
}
}
}
private class FindItemById extends BaseAction {
public FindItemById(int key, String name) {
super(key, name);
}
@Override
public void execute(Input input, Tracker tracker) {
output.accept("------------ Поиск заявки по номеру --------------");
String id = input.ask("Введите номер заявки :");
Item item = tracker.findById(id);
output.accept((item == null ? actionMsg("Не найдена", id) : item.toString()));
}
}
private class FindItemsByName extends BaseAction {
public FindItemsByName(int key, String name) {
super(key, name);
}
@Override
public void execute(Input input, Tracker tracker) {
output.accept("------------ Поиск заявок по имени --------------");
String name = input.ask("Введите имя заявки :");
tracker.findByName(name).forEach(s->output.accept(s.toString()));
}
}
private class ExitProgram extends BaseAction {
public ExitProgram(int key, String name) {
super(key, name);
}
@Override
public void execute(Input input, Tracker tracker) {
setExit(true);
}
}
/**
* Конструктор ссобщений о результаты операции с заявкой.
* @param action результат операции с заявкой.
* @param id номер заявки.
* @return сообщение о результате операции с заявкой.
*/
private String actionMsg(String action, String id) {
return action + " заявка с id: " + id;
}
}
| [
"alllexe@mail.ru"
] | alllexe@mail.ru |
037915529d02e65a76c515366972c0afdf2cab4e | 69c5154cd8dc8deec7578970e0b597853ec5d53b | /src/main/java/com/isuper/base/server/gateway/security/AuthoritiesConstants.java | 158b3b37e9b4289c0e4a9024da3c9e79354a1f3e | [] | no_license | Jimmy3389/gateWayApplication | bc8610f11a216507b4445dbe77ee20c4ef29f1f2 | e132b7597035ba01f7a98a010cdb04df355c6c0e | refs/heads/master | 2020-03-21T15:27:06.394416 | 2018-06-26T09:09:38 | 2018-06-26T09:09:38 | 138,713,169 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java | package com.isuper.base.server.gateway.security;
/**
* Constants for Spring Security authorities.
*/
public final class AuthoritiesConstants {
public static final String ADMIN = "ROLE_ADMIN";
public static final String USER = "ROLE_USER";
public static final String ANONYMOUS = "ROLE_ANONYMOUS";
private AuthoritiesConstants() {
}
}
| [
"jhipster-bot@users.noreply.github.com"
] | jhipster-bot@users.noreply.github.com |
77fc272eb627c1ec0ccc67ec2db1cc6e485796e3 | 19cec4e46813daed035a2e62cc7d04d39636a844 | /supplier-wechat/src/main/java/me/jiangcai/user/notice/wechat/UserNoticeWechatConfig.java | 5d6d71eb6fe16c8bb885d2f703e86bb6c8777861 | [] | no_license | caijiang/user-notice | 40478a9c355b1530b31545256035bd7b1fc27a62 | 5d83bde628380e19ea0ff384fd4cb19f9a8f82bc | refs/heads/master | 2021-01-15T16:41:52.808343 | 2017-08-18T07:38:54 | 2017-08-18T07:38:54 | 99,719,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 863 | java | package me.jiangcai.user.notice.wechat;
import me.jiangcai.user.notice.differentiation.UserNoticeDifferentiationConfig;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
* 使用微信供应商则必须开通差异化
* 同时需要进行初始化
*
* @author CJ
*/
@Configuration
@Import(UserNoticeDifferentiationConfig.class)
@ComponentScan("me.jiangcai.user.notice.wechat.bean")
public class UserNoticeWechatConfig {
public static final String URLTemplateDefine = "wechat_url_template";
public static final String TemplateIdDefine = "wechat_template_id";
public static final String ParameterArrayDefine = "wechat_parameter_array";
}
| [
"luffy.ja@gmail.com"
] | luffy.ja@gmail.com |
6e54897ce60f7730a0c4c4188753b94be72284c3 | 7255fc54b663e0feeb4d6642e61987663f54ab0d | /tlslibrary/src/main/java/com/tencent/qcloud/tlslibrary/service/AccountLoginService.java | 8b18f5b4017f0abc1c890a928689355df20a2e60 | [] | no_license | dicallc/IM_Video | c49b99729c56d47c75e54c169f2b84b048d5e11d | 3449d0f26b6b68c3230127721b5edd193542b3ec | refs/heads/master | 2021-01-25T08:01:07.684836 | 2018-06-15T01:19:43 | 2018-06-15T01:19:43 | 93,698,434 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,057 | java | package com.tencent.qcloud.tlslibrary.service;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import com.tencent.qcloud.tlslibrary.activity.ImgCodeActivity;
import com.tencent.qcloud.tlslibrary.helper.Util;
import tencent.tls.platform.TLSErrInfo;
import tencent.tls.platform.TLSPwdLoginListener;
import tencent.tls.platform.TLSUserInfo;
/**
* Created by dgy on 15/8/12.
*/
public class AccountLoginService {
private final static String TAG = "AccountLoginService";
private Context context;
private EditText txt_username;
private EditText txt_password;
private String username;
private String password;
private TLSService tlsService;
public static PwdLoginListener pwdLoginListener;
public AccountLoginService(Context context,
EditText txt_username,
EditText txt_password,
Button btn_login) {
this.context = context;
this.txt_username = txt_username;
this.txt_password = txt_password;
tlsService = TLSService.getInstance();
pwdLoginListener = new PwdLoginListener();
btn_login.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
username = AccountLoginService.this.txt_username.getText().toString().trim();
password = AccountLoginService.this.txt_password.getText().toString().trim();
// 验证用户名和密码的有效性
if (username.length() == 0 || password.length() == 0) {
Util.showToast(AccountLoginService.this.context, "用户名密码不能为空");
return;
}
tlsService.TLSPwdLogin(username, password, pwdLoginListener);
}
});
}
class PwdLoginListener implements TLSPwdLoginListener {
@Override
public void OnPwdLoginSuccess(TLSUserInfo userInfo) {
Util.showToast(context, "登录成功");
TLSService.getInstance().setLastErrno(0);
AccountLoginService.this.jumpToSuccActivity();
}
@Override
public void OnPwdLoginReaskImgcodeSuccess(byte[] picData) {
ImgCodeActivity.fillImageview(picData);
}
@Override
public void OnPwdLoginNeedImgcode(byte[] picData, TLSErrInfo errInfo) {
Intent intent = new Intent(context, ImgCodeActivity.class);
intent.putExtra(Constants.EXTRA_IMG_CHECKCODE, picData);
intent.putExtra(Constants.EXTRA_LOGIN_WAY, Constants.USRPWD_LOGIN);
context.startActivity(intent);
}
@Override
public void OnPwdLoginFail(TLSErrInfo errInfo) {
TLSService.getInstance().setLastErrno(-1);
Util.notOK(context, errInfo);
}
@Override
public void OnPwdLoginTimeout(TLSErrInfo errInfo) {
TLSService.getInstance().setLastErrno(-1);
Util.notOK(context, errInfo);
}
}
void jumpToSuccActivity() {
Log.d(TAG, "jumpToSuccActivity");
String thirdappPackageNameSucc = Constants.thirdappPackageNameSucc;
String thirdappClassNameSucc = Constants.thirdappClassNameSucc;
Intent intent = new Intent();
intent.putExtra(Constants.EXTRA_LOGIN_WAY, Constants.USRPWD_LOGIN);
intent.putExtra(Constants.EXTRA_USRPWD_LOGIN, Constants.USRPWD_LOGIN_SUCCESS);
if (thirdappPackageNameSucc != null && thirdappClassNameSucc != null) {
intent.setClassName(thirdappPackageNameSucc, thirdappClassNameSucc);
context.startActivity(intent);
} else {
Log.d(TAG, "finish current activity");
((Activity) context).setResult(Activity.RESULT_OK, intent);
((Activity) context).finish();
}
}
}
| [
"jiangdk@e-lead.cn"
] | jiangdk@e-lead.cn |
5d3e6527fe9ec98293650a3738fc4257193f21b9 | dfbc216feed44aff00c6f68f68d2d090c9ec93dc | /src/main/java/com/exadel/amc/youtube/YoutubeTest.java | 064a69649b9ea895aabb36f9386a3d8f634c097a | [] | no_license | yurimix/amc-poc | 3b30ea25e56a1e69ed5ba53b494910b66aef2e2e | 63d42beb2d82ff94a7dd70a761c2b20fd728a67a | refs/heads/master | 2023-08-09T16:29:42.221675 | 2015-11-05T11:46:39 | 2015-11-05T11:46:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,327 | java | package com.exadel.amc.youtube;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.exadel.amc.youtube.data.channel.ChannelItem;
import com.exadel.amc.youtube.data.channel.ChannelSearchResult;
import com.exadel.amc.youtube.data.video.VideoItem;
import com.exadel.amc.youtube.data.video.VideoSearchResult;
/**
* Create Google account Go to https://console.developers.google.com/ Create new
* project (click "Enable and manage APIs" link) or choose the existing Go to
* "APIS & auth -> APIs" Look for "YouTube Data API" link, click it Click
* "Enable API" button Go to "APIS & auth -> Credentials" Add credentials -> API
* key -> Server key Click "Create" button, get API key from opened popup window
*/
public class YoutubeTest {
private static final String SEARCH_STRING = "tVIIgcIqoPw";
private static Logger log = LoggerFactory.getLogger(YoutubeTest.class);
public static void main(String[] args) throws Exception {
String searches[];
if (args.length == 0) {
searches = new String[] { SEARCH_STRING };
} else {
searches = args;
}
Youtube yt = new Youtube();
for (String search : searches) {
log.info(">>> {} <<<", search);
VideoSearchResult vsr = yt.getVideoById(search);
if (vsr.getPageInfo().getResultsPerPage() == 1) {
for (VideoItem vi : vsr.getItems()) {
print(vi);
log.info("");
ChannelSearchResult csr = yt.getChannelById(vi.getSnippet().getChannelId());
if (csr.getPageInfo().getTotalResults() > 0) {
log.info("Channel {} info:", vi.getSnippet().getChannelId());
for (ChannelItem ci : csr.getItems()) {
print(ci);
}
}
}
}
log.info("-----------------------");
}
}
private static void print(VideoItem vi) {
log.info("Title: {}", vi.getSnippet().getTitle());
log.info("ChannelId: {}", vi.getSnippet().getChannelId());
log.info("ChannelTitle: {}", vi.getSnippet().getChannelTitle());
log.info("PublishedAt: {}", vi.getSnippet().getPublishedAt());
log.info("ViewCount: {}", vi.getStatistics().getViewCount());
log.info("FavoriteCount: {}", vi.getStatistics().getFavoriteCount());
log.info("LikeCount: {}", vi.getStatistics().getLikeCount());
log.info("DislikeCount: {}", vi.getStatistics().getDislikeCount());
log.info("CommentCount: {}", vi.getStatistics().getCommentCount());
}
private static void print(ChannelItem ci) {
log.info("\tTitle: {}", ci.getSnippet().getTitle());
log.info("\tDescription: {}",
ci.getSnippet().getDescription() == null ? "" : ci.getSnippet().getDescription().replaceAll("\n", " "));
log.info("\tPublishedAt: {}", ci.getSnippet().getPublishedAt());
log.info("\tIsLinked: {}", ci.getStatus().getIsLinked());
log.info("\tLongUploadsStatus: {}", ci.getStatus().getLongUploadsStatus());
log.info("\tPrivacyStatus: {}", ci.getStatus().getPrivacyStatus());
log.info("\tStatistics: {}", ci.getStatistics());
}
}
| [
"yshadrin@exadel.com"
] | yshadrin@exadel.com |
175acff012ec2ae9385279838497ecc6bd6ce2fd | 517ca34076b7250ae0f3cba8825f43c387cc0518 | /JS/JQ AJAX扩展 2/01 提供给教员的内容/03 作业参考答案/作业4/Chapter11_hw04/src/hw/web/UserServlet.java | 9fb31359ad19f6c922a18acd6a04a30030325a49 | [] | no_license | largeMing/smallPage | 30a81e5f46994d44ca599c1e3ce4719aaa81dd28 | 68af3e9a207dd8d4ead69bdd2b77c200706c6dc1 | refs/heads/master | 2021-04-09T15:57:06.035866 | 2018-04-26T09:12:24 | 2018-04-26T09:12:24 | 125,785,543 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,098 | java | package hw.web;
import hw.entity.User;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
public class UserServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
User user = new User("汪洋", 21, "男", "学生", "北京市海淀区上地西里3号楼4单元5号", "13X00000000");
String userJsonStr = JSON.toJSONString(user);
PrintWriter out = response.getWriter();
out.print(userJsonStr);
out.flush();
out.close();
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
this.doGet(request, response);
}
}
| [
"jm19980318"
] | jm19980318 |
1019b8db32fef153a1564b873e9d775232ef3cc1 | 21b6afcdecaf8d8f3f04455b921af92504e08cd7 | /CookieRun/app/src/androidTest/java/kr/ac/kpu/game/s2016182019/cookierun/ExampleInstrumentedTest.java | b90d912fd939963bc4822e9a8cb66558b29c4f0b | [] | no_license | SuniAnice/SPGP_Termproject | 8c71e02c134bc11dff220d885819242610324064 | fcfeed6d86e6d03de161c1193564953c6ff992c5 | refs/heads/main | 2023-05-09T04:55:01.818565 | 2021-06-10T18:33:34 | 2021-06-10T18:33:34 | 350,339,728 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | java | package kr.ac.kpu.game.s2016182019.cookierun;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("kr.ac.kpu.game.s2016182019.cookierun", appContext.getPackageName());
}
} | [
"hgbb3210@naver.com"
] | hgbb3210@naver.com |
10a6c294c1543dfa2852f544aa98120e3c677d59 | 01ae8d7fda7bae617558f378c06061c5ae57da29 | /core/src/com/oxigenoxide/caramballs/object/floatingReward/FR_Eye.java | ece21732b11c0fc4ebd4086b5e7d33f8c4d6e07e | [] | no_license | OxigenOxide/CaramBalls | 054e6a02f61c0bf0710f382c4c575ba0ece0c0eb | 24bcb3d3bb50bdc649e0f92c7ccdacb729f9e7fc | refs/heads/master | 2022-12-18T17:08:29.885872 | 2020-08-04T12:50:45 | 2020-08-04T12:50:45 | 240,869,328 | 0 | 0 | null | 2020-02-26T20:31:40 | 2020-02-16T10:08:02 | Java | UTF-8 | Java | false | false | 623 | java | package com.oxigenoxide.caramballs.object.floatingReward;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.oxigenoxide.caramballs.Main;
import com.oxigenoxide.caramballs.Res;
public class FR_Eye extends FloatingReward{
int type;
public FR_Eye(float x, float y, int type){
super(x,y);
this.type = type;
tex= Res.tex_eye[type];
sprite=new Sprite(tex);
}
@Override
public void update() {
super.update();
}
@Override
public void render(SpriteBatch batch) {
super.render(batch);
}
}
| [
"mcf@live.nl"
] | mcf@live.nl |
e8c6e101ad186c4a1c93b99e46259b926d718659 | c5990d5c4bee69fff0fd761818bc62c2a97e35b4 | /src/main/java/cn/bdqn/tangcco/user/controller/LoginController.java | 1a8ba1d020973b6f46c66ef0b491a32ed7b0a32e | [] | no_license | kaixinshuaige/lingshan | 9e3ed87c5cf7c928e345db7c767d959d69c6a676 | d28144f8062a20cbaab2ad1f6a6a873752ecd291 | refs/heads/master | 2020-09-20T02:40:19.538997 | 2017-06-16T02:56:07 | 2017-06-16T02:56:07 | 94,499,024 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,164 | java | package cn.bdqn.tangcco.user.controller;
import cn.bdqn.tangcco.entity.Tbuser;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpSession;
/**
* Created by Administrator on 2017/6/15.
*/
@Controller
@RequestMapping(value = "/user")
public class LoginController {
@RequestMapping(value = "/doLogin",method = RequestMethod.POST)
public String doLogin(Tbuser users , HttpSession httpSession , Model model){
String forward="";
if("admin".equals(users.getUsername())&&"123".equals(users.getPassword())){
httpSession.setAttribute("我草拟大爷",new Tbuser(100,"admin","1234","01","拼刺刀"));
forward="main/main";
}else{
String msg="你知道的太多了";
model.addAttribute("msg",msg);
forward="forward:/index.jsp";
}
return forward;
}
}
| [
"1311556887@qq.com"
] | 1311556887@qq.com |
a2c01831613a3b3e61d90629b66365881579d9ae | 13b8177e4f05ff2d3f108441370591c1c4916706 | /app/src/main/java/com/myproject/demo1/utils/DBUtils.java | 015b12ea72ec38f46acc95e1f9f92d4ccd1c0d22 | [] | no_license | BeautifulMy/IM | 0ba7208dd5e2079587fe9ae32df41da567f60e89 | cc7fbc171b5cd317fc5085e04af5aa3458b4f9d9 | refs/heads/master | 2021-01-23T04:09:13.686988 | 2017-05-18T05:10:15 | 2017-05-18T05:10:15 | 86,160,172 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,036 | java | package com.myproject.demo1.utils;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import com.myproject.demo1.dao.ContactsOpenHelper;
import java.util.ArrayList;
import java.util.List;
/**
* Created by taojin on 2016/9/9.16:11
*/
public class DBUtils {
private static ContactsOpenHelper sContactsOpenHelper;
private static boolean inited = false;
public static void init(Context context){
sContactsOpenHelper = new ContactsOpenHelper(context);
inited = true;
}
public static void saveContacts(String username,List<String> contacts){
if (!inited){
throw new RuntimeException("还未初始化DBUtils,请先初始化再使用");
}
SQLiteDatabase writableDatabase = sContactsOpenHelper.getWritableDatabase();
//开启事务
writableDatabase.beginTransaction();
writableDatabase.delete("t_contact","username=?",new String[]{username});
ContentValues contentValues = new ContentValues();
contentValues.put("username",username);
for(int i =0;i<contacts.size();i++){
contentValues.put("contact",contacts.get(i));
writableDatabase.insert("t_contact",null,contentValues);
}
//提交事务
writableDatabase.setTransactionSuccessful();
writableDatabase.endTransaction();
writableDatabase.close();
}
public static List<String> getContacts(String username){
List<String> contactsList = new ArrayList<>();
SQLiteDatabase readableDatabase = sContactsOpenHelper.getReadableDatabase();
Cursor cursor = readableDatabase.query("t_contact", new String[]{"contact"}, "username=?", new String[]{username}, null, null, "contact");
while (cursor.moveToNext()){
String contact = cursor.getString(0);
contactsList.add(contact);
}
cursor.close();
return contactsList;
}
}
| [
"308497926@qq.com"
] | 308497926@qq.com |
7f410c209c445bb6571cb4526eb70b6df5457272 | 2a40f5c11dc959eabe71ed016675dab33d1dda36 | /src/main/java/com/cloudage/membercenter/service/IReview.java | 95119c0824c8e2ecddb16881c466d0ee2764528c | [] | no_license | limeng1993/particeserver_teacher_zhangqi | 8e4af117bc8e02a4be0ac4c2e07fa60ff4613c37 | 6138e8809116148e9874094441df5cb2d6f58322 | refs/heads/master | 2020-06-10T19:27:04.089551 | 2016-12-15T12:36:48 | 2016-12-15T12:36:48 | 75,897,173 | 0 | 0 | null | 2016-12-08T02:57:18 | 2016-12-08T02:57:18 | null | UTF-8 | Java | false | false | 426 | java | package com.cloudage.membercenter.service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import com.cloudage.membercenter.entity.Review;
public interface IReview {
Review save(Review review);
Page<Review>findAllOfArticleId(int article_Id,int page);
Page<Review>findAllOfReview(int authorId,int page);
Page<Review>findAllOfMyreview(String name,int page);
}
| [
"1656288531@qq.com"
] | 1656288531@qq.com |
dd80ab1a61d518b035d7918255d8ed4e4b630c18 | 87c6180e218e9830b34944f10a446bb9d7d0e1df | /Darshan H K_46131549/src/Question2/Transaction.java | 9501ebbe878c098de9af86805fcfb6fb974f0f3b | [] | no_license | Darshanhk1/Module1Exam | f8a65ac43208258f3c844fbeea3217be3ab68aac | eeb8e2aebe36e6906725a2d788a048dc02295e02 | refs/heads/master | 2023-08-11T00:19:45.840051 | 2021-09-25T09:56:10 | 2021-09-25T09:56:10 | 410,177,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | package Question2;
class Transaction
{
public static double deposit(Account account , double amount)
{
//Must add amount to account object balance and return updated balance.
account.setBalance(account.getBalance()+amount);
return account.getBalance();
}
public static double withdraw(Account account , double amount) throws InsufficientBalanceException
{
//if account object balance – amount is less than 5000 then Exception should be thrown.
if((account.getBalance()-amount)<5000)
{
throw new InsufficientBalanceException("Account balance is insufficient");
}
account.setBalance(account.getBalance()-amount);
return account.getBalance();
}
} | [
"darshandarru1@gmail.com"
] | darshandarru1@gmail.com |
2c68bcf06829f058d4e99475eda19bfba6a855f2 | 7856c24c7a7e17d99332ca96a5469ccbfcbf67ab | /finmartserviceapi/src/main/java/magicfinmart/datacomp/com/finmartserviceapi/motor/model/SummaryEntity.java | 70c06b3f7440aef6c525e7e0cb91020fec5d1915 | [] | no_license | umeshrchaurasia/finmart | 8978e61cec3f132029f196e5f120dc9efdb73906 | 68138a15cb529ed55b868a26f85486f3afb6412b | refs/heads/master | 2020-04-08T19:13:45.366875 | 2018-11-29T13:03:57 | 2018-11-29T13:03:57 | 159,645,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,592 | java | package magicfinmart.datacomp.com.finmartserviceapi.motor.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.SerializedName;
public class SummaryEntity implements Parcelable {
public static final Creator<SummaryEntity> CREATOR = new Creator<SummaryEntity>() {
@Override
public SummaryEntity createFromParcel(Parcel in) {
return new SummaryEntity(in);
}
@Override
public SummaryEntity[] newArray(int size) {
return new SummaryEntity[size];
}
};
/**
* _id : 5a0ab49b1f4d2b19e098bf79
* Request_Id : 8946
* Request_Unique_Id : SRN-XP0NTBTF-VH4C-33V4-7JVZ-Z9TCRILNPXFF
* Client_Id : 4
* PB_CRN : 103419
* Request_Core : {"product_id":1,"vehicle_id":681,"rto_id":579,"vehicle_insurance_type":"renew","vehicle_manf_date":"2016-11-01","vehicle_registration_date":"2016-11-15","policy_expiry_date":"2017-11-14","prev_insurer_id":2,"vehicle_registration_type":"individual","vehicle_ncb_current":"0","is_claim_exists":"no","method_type":"Premium","execution_async":"no","electrical_accessory":"0","non_electrical_accessory":"0","registration_no":"MH-01-AA-1234","is_llpd":"no","is_antitheft_fit":"no","voluntary_deductible":0,"is_external_bifuel":"no","is_aai_member":"no","external_bifuel_type":null,"external_bifuel_value":"0","pa_owner_driver_si":100000,"pa_named_passenger_si":"0","pa_unnamed_passenger_si":"0","pa_paid_driver_si":"0","vehicle_expected_idv":0,"first_name":"Ajit","middle_name":"U3IBBVSZDV","last_name":"Kumar","mobile":"7377319978","email":"ajit.kumar@rupeeboss.com","crn":0,"ss_id":0,"secret_key":"SECRET-ODARQ6JP-9V2Q-7BIM-0NNM-DNRTXRWMRTAL","client_key":"CLIENT-GLF2SRA5-CFIF-4X2T-HC1Z-CXV4ZWQTFQ3T","birth_date":"1992-01-01","registration_no_1":"MH","registration_no_2":"01","registration_no_3":"AA","registration_no_4":"1234","posp_posp_id":0,"posp_fba_id":0,"posp_sm_posp_id":0,"posp_sm_posp_name":0,"posp_first_name":0,"posp_middle_name":0,"posp_last_name":0,"posp_email_id":0,"posp_agent_city":0,"posp_mobile_no":0,"posp_pan_no":0,"posp_aadhar":0,"posp_sources":0,"posp_ss_id":0,"posp_erp_id":0,"posp_gender":0,"posp_posp_category":0,"posp_reporting_agent_uid":0,"posp_reporting_agent_name":0,"posp_category":"PolicyBoss","erp_source":"FRESH-MTR"}
* Request_Product : {"vehicle_insurance_type":"renew","vehicle_registration_type":"individual","vehicle_registration_date":"2016-11-15","vehicle_id":681,"rto_id":579,"prev_insurer_id":2,"is_claim_exists":"no","vehicle_ncb_current":"0","vehicle_manf_year":"2016","vehicle_ncb_next":"20","vehicle_age_year":1,"vehicle_age_month":12,"vehicle_expected_idv":0,"registration_no":"MH-01-AA-1234","registration_no_1":"MH","registration_no_2":"01","registration_no_3":"AA","registration_no_4":"1234","policy_expiry_date":"2017-11-14","policy_start_date":"2017-11-15","pre_policy_start_date":"2016-11-15","policy_end_date":"2018-11-14","vehicle_manf_date":"2016-11-01","is_financed":"","financial_institute_name":"","financial_institute_code":"","financial_institute_city":"","financial_agreement_type":"","previous_policy_number":"","is_external_bifuel":"no","external_bifuel_type":"","external_bifuel_value":"0","electrical_accessory":"0","non_electrical_accessory":"0","engine_number":"","chassis_number":"","vehicle_color":"","voluntary_deductible":"","is_antitheft_fit":"no","is_aai_member":"no","is_llpd":"no","pa_owner_driver_si":100000,"pa_named_passenger_si":"","pa_unnamed_passenger_si":"","pa_paid_driver_si":"","addon_zero_dep_cover":"","addon_road_assist_cover":"","addon_ncb_protection_cover":"","addon_engine_protector_cover":"","addon_invoice_price_cover":"","addon_key_lock_cover":"","addon_consumable_cover":"","addon_passenger_assistance_cover":"","addon_flag":"","addon_package_name":"Titanium","addon_daily_allowance_cover":"yes","addon_windshield_cover":"yes","addon_tyre_coverage_cover":"yes","addon_personal_belonging_loss_cover":"yes","addon_inconvenience_allowance_cover":"yes","addon_medical_expense_cover":"yes","addon_hospital_cash_cover":"yes","addon_ambulance_charge_cover":"yes","addon_rodent_bite_cover":"yes","addon_losstime_protection_cover":"yes","addon_hydrostatic_lock_cover":"yes"}
* Created_On : 2017-11-14T09:17:15.052Z
* Status : complete
* Total : 23
* Pending : 0
* Complete : 23
* Success : 15
* Fail : 8
* Total_Execution_Time : 88.37
* vehicle_min_idv : 319432
* vehicle_max_idv : 550820
* Actual_Time : 216.67000000000002
* Common_Addon : {"addon_road_assist_cover":{"min":350,"max":500},"addon_zero_dep_cover":{"min":1336,"max":3380},"addon_engine_protector_cover":{"min":569,"max":599},"addon_invoice_price_cover":{"min":898,"max":949},"addon_key_lock_cover":{"min":108,"max":683},"addon_consumable_cover":{"min":435,"max":1597},"addon_medical_expense_cover":{"min":375,"max":375},"addon_hospital_cash_cover":{"min":500,"max":500},"addon_ambulance_charge_cover":{"min":100,"max":100},"addon_ncb_protection_cover":{"min":639,"max":1352},"addon_windshield_cover":{"min":270,"max":270}}
*/
private String _id;
private String Request_Id;
private String Request_Unique_Id;
private String Client_Id;
private String PB_CRN;
private RequestCoreEntity Request_Core;
private RequestProductEntity Request_Product;
private String Created_On;
@SerializedName("Status")
private String StatusX;
private String Total;
private String Pending;
private String Complete;
private String Success;
private String Fail;
private double Total_Execution_Time;
private String vehicle_min_idv;
private String vehicle_max_idv;
private double Actual_Time;
private CommonAddonEntity Common_Addon;
protected SummaryEntity(Parcel in) {
Request_Core = (RequestCoreEntity) in.readParcelable(RequestCoreEntity.class.getClassLoader());
_id = in.readString();
Request_Id = in.readString();
Request_Unique_Id = in.readString();
Client_Id = in.readString();
PB_CRN = in.readString();
Created_On = in.readString();
StatusX = in.readString();
Total = in.readString();
Pending = in.readString();
Complete = in.readString();
Success = in.readString();
Fail = in.readString();
Total_Execution_Time = in.readDouble();
vehicle_min_idv = in.readString();
vehicle_max_idv = in.readString();
Actual_Time = in.readDouble();
}
public String get_id() {
return _id;
}
public void set_id(String _id) {
this._id = _id;
}
public String getRequest_Id() {
return Request_Id;
}
public void setRequest_Id(String Request_Id) {
this.Request_Id = Request_Id;
}
public String getRequest_Unique_Id() {
return Request_Unique_Id;
}
public void setRequest_Unique_Id(String Request_Unique_Id) {
this.Request_Unique_Id = Request_Unique_Id;
}
public String getClient_Id() {
return Client_Id;
}
public void setClient_Id(String Client_Id) {
this.Client_Id = Client_Id;
}
public String getPB_CRN() {
return PB_CRN;
}
public void setPB_CRN(String PB_CRN) {
this.PB_CRN = PB_CRN;
}
public RequestCoreEntity getRequest_Core() {
return Request_Core;
}
public void setRequest_Core(RequestCoreEntity Request_Core) {
this.Request_Core = Request_Core;
}
public RequestProductEntity getRequest_Product() {
return Request_Product;
}
public void setRequest_Product(RequestProductEntity Request_Product) {
this.Request_Product = Request_Product;
}
public String getCreated_On() {
return Created_On;
}
public void setCreated_On(String Created_On) {
this.Created_On = Created_On;
}
public String getStatusX() {
return StatusX;
}
public void setStatusX(String StatusX) {
this.StatusX = StatusX;
}
public String getTotal() {
return Total;
}
public void setTotal(String Total) {
this.Total = Total;
}
public String getPending() {
return Pending;
}
public void setPending(String Pending) {
this.Pending = Pending;
}
public String getComplete() {
return Complete;
}
public void setComplete(String Complete) {
this.Complete = Complete;
}
public String getSuccess() {
return Success;
}
public void setSuccess(String Success) {
this.Success = Success;
}
public String getFail() {
return Fail;
}
public void setFail(String Fail) {
this.Fail = Fail;
}
public double getTotal_Execution_Time() {
return Total_Execution_Time;
}
public void setTotal_Execution_Time(double Total_Execution_Time) {
this.Total_Execution_Time = Total_Execution_Time;
}
public String getVehicle_min_idv() {
return vehicle_min_idv;
}
public void setVehicle_min_idv(String vehicle_min_idv) {
this.vehicle_min_idv = vehicle_min_idv;
}
public String getVehicle_max_idv() {
return vehicle_max_idv;
}
public void setVehicle_max_idv(String vehicle_max_idv) {
this.vehicle_max_idv = vehicle_max_idv;
}
public double getActual_Time() {
return Actual_Time;
}
public void setActual_Time(double Actual_Time) {
this.Actual_Time = Actual_Time;
}
public CommonAddonEntity getCommon_Addon() {
return Common_Addon;
}
public void setCommon_Addon(CommonAddonEntity Common_Addon) {
this.Common_Addon = Common_Addon;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(Request_Core, flags);
dest.writeString(_id);
dest.writeString(Request_Id);
dest.writeString(Request_Unique_Id);
dest.writeString(Client_Id);
dest.writeString(PB_CRN);
dest.writeString(Created_On);
dest.writeString(StatusX);
dest.writeString(Total);
dest.writeString(Pending);
dest.writeString(Complete);
dest.writeString(Success);
dest.writeString(Fail);
dest.writeDouble(Total_Execution_Time);
dest.writeString(vehicle_min_idv);
dest.writeString(vehicle_max_idv);
dest.writeDouble(Actual_Time);
}
} | [
"rajeev15069@gmail.com"
] | rajeev15069@gmail.com |
9182f330edbdf6e84581a748cb95c0d820814c58 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.qqlite/assets/exlibs.1.jar/classes.jar/com/tencent/mobileqq/activity/NumberWheelView$ScrollStateListener.java | c2bc90266d41f92323d8b6e1216856b5fe34b5b2 | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 460 | java | package com.tencent.mobileqq.activity;
import com.tencent.widget.VerticalGallery;
public abstract interface NumberWheelView$ScrollStateListener
{
public abstract void a(VerticalGallery paramVerticalGallery);
}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.qqlite\assets\exlibs.1.jar\classes.jar
* Qualified Name: com.tencent.mobileqq.activity.NumberWheelView.ScrollStateListener
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
96c18f250ab0b4b347ec2854952bd8a66c0ea06c | 730714ed751c7adaab47b6ebdb4d00d118786659 | /demo/src/main/java/com/blog/demo/configure/WebMvcConfig.java | 20a29ee53e66d705f255cb5b25ba4363f39d062a | [] | no_license | affandi2204/MyBlog | dfa0ba7955e235718bd939b79eddccc01d1f028f | 27df2604d3d69cad2fbb05c62aff10b0301bbd92 | refs/heads/master | 2021-04-20T05:04:41.636367 | 2020-04-08T08:19:38 | 2020-04-08T08:19:38 | 249,656,652 | 0 | 0 | null | 2020-03-27T05:44:24 | 2020-03-24T08:49:21 | null | UTF-8 | Java | false | false | 1,366 | java | package com.blog.demo.configure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
* WebMvcConfig
*/
@Configuration
public class WebMvcConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpBasic()
.and()
.authorizeRequests()
.antMatchers(HttpMethod.GET, "/**").permitAll()
.antMatchers(HttpMethod.POST, "/**").permitAll()
.antMatchers(HttpMethod.PUT, "/**").permitAll()
.antMatchers(HttpMethod.PATCH, "/**").permitAll()
.antMatchers(HttpMethod.DELETE, "/**").permitAll()
.and()
.csrf().disable();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication()
.withUser("CobaDEV")
.password("{noop}CobaDEV")
.roles("USER");
}
} | [
"muhammad.affandi@indosystem.com"
] | muhammad.affandi@indosystem.com |
3a0a9fe73ae9ee0ba8a3c9cf3817bd6aca74e7ca | 88d41a18d1ad0ccc1a79b623cf4006e52f6e20ab | /mybatis-3/src/test/java/org/apache/ibatis/submitted/enum_with_method/Mapper.java | 13e35d0fa2b7ca8ced4116c8cc02302631eb3505 | [
"Apache-2.0",
"BSD-3-Clause"
] | permissive | huifer/javaBook-src | 87369e5f175197166dcae49ffde9a41ad3965bf7 | 5f319dbf46401f7f5770ed3ca80079e48392d2f8 | refs/heads/master | 2023-08-30T12:58:56.644540 | 2023-08-30T01:36:09 | 2023-08-30T01:36:09 | 173,409,096 | 57 | 19 | Apache-2.0 | 2023-02-22T08:11:26 | 2019-03-02T05:51:32 | Java | UTF-8 | Java | false | false | 777 | java | /**
* Copyright 2009-2019 the original author or authors.
* <p>
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.ibatis.submitted.enum_with_method;
public interface Mapper {
User getUser(Integer id);
void insertUser(User user);
}
| [
"huifer97@163.com"
] | huifer97@163.com |
6e933c951d2f112b8fb72c7a600d529fce8e3e68 | bd24a8bfff71437e78e2d05fc6dead86f4edd819 | /eclipse-workspace/20171025_Abstract/src/min/edu/Child_Class.java | 1943f99066ef17fb8424bc6d0857b2682a44cc2b | [] | no_license | JungYOsup/java_standard | 50b6ffe296849034299913b43b9af72b66f0fd2c | 75dd746baa1182c6931c56c22750212321204c11 | refs/heads/master | 2022-12-29T11:02:58.574835 | 2020-10-13T02:49:53 | 2020-10-13T02:49:53 | 303,567,699 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 143 | java | package min.edu;
public class Child_Class extends Super_Abstract_Class {
@Override
public void make() {
super.result = 10*30;
}
}
| [
"yosup1004@gmail.com"
] | yosup1004@gmail.com |
f821b85dba68154bae544e8f54abb70bfa51c65e | a0b83a16226addaaea27e915b1f9dc82606000cc | /12-哈希表/src/com/huan/model/Key.java | 89fec371d319967b7a074c1baf05ae83ea3a11ca | [] | no_license | HHVic/dataStruct | 459593a53544949cb40a233f62e6218cedc69583 | 4d7e9d8f6f8c22b9f8f3a85005966530c025385b | refs/heads/master | 2023-03-13T21:03:56.568515 | 2021-03-05T03:15:11 | 2021-03-05T03:15:11 | 289,641,680 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package com.huan.model;
public class Key {
protected int value;
public Key(int value) {
this.value = value;
}
@Override
public boolean equals(Object obj) {
if(this == obj) return true;
if(obj == null || this.getClass() != obj.getClass()) return false;
return this.value == ((Key)obj).value;
}
@Override
public int hashCode() {
return value / 10;
}
@Override
public String toString() {
return "V(" + value + ")";
}
}
| [
"182070022@stu.just.edu.cn"
] | 182070022@stu.just.edu.cn |
09d5cf3a40c314139e930d981aacd50cf9440120 | 59d20a13a2f011f610c324dd31d03147007dea42 | /src/com/jaminchanks/action/CommentAction.java | 037278ea6369b1e27acabed98934e267fca2b19a | [] | no_license | jaminchanks/videoComment | d52860fbd1ecc0e5ef5ed0dfa68abb7f761fff88 | 11454a938d1eade3cb693a4cf69c6087cb02770a | refs/heads/master | 2020-06-03T15:45:25.176307 | 2018-01-21T16:57:20 | 2018-01-21T16:57:20 | 37,041,363 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,664 | java | package com.jaminchanks.action;
import com.jaminchanks.pojo.Comment;
import com.jaminchanks.pojo.User;
import com.jaminchanks.service.CommentService;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Created by jamin on 6/20/15.
*/
public class CommentAction extends ActionSupport {
private CommentService commentService;
private Comment comment;
private ArrayList<Comment> commentsWatching;
private int commentId;
private static int videoId;
private String content;
//分页变量
private int pageNo = 1;
private final int pageSize = 5; //一页默认显示10条记录
private int maxPageSize;
public int getMaxPageSize() {
return maxPageSize;
}
public void setMaxPageSize(int maxPageSize) {
this.maxPageSize = maxPageSize;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public ArrayList<Comment> getCommentsWatching() {
return commentsWatching;
}
public void setCommentsWatching(ArrayList<Comment> commentsWatching) {
this.commentsWatching = commentsWatching;
}
public Comment getComment() {
return comment;
}
public void setComment(Comment comment) {
this.comment = comment;
}
public int getVideoId() {
return videoId;
}
public void setVideoId(int videoId) {
this.videoId = videoId;
}
public CommentService getCommentService() {
return commentService;
}
public void setCommentService(CommentService commentService) {
this.commentService = commentService;
}
public int getCommentId() {
return commentId;
}
public void setCommentId(int commentId) {
this.commentId = commentId;
}
//分页查询评论
public String showComments() {
List<Comment> comments = getCommentService().findCommentsByVideo(videoId, pageNo, pageSize);
if (comments != null && comments.size() != 0) {
commentsWatching = (ArrayList<Comment>) comments;
System.out.println("userName[0]==" + commentsWatching.get(0).getUser().getUserName());
//告知最后一页是多少
maxPageSize = getCommentService().getPagesOfCommentsByVideo(videoId, pageSize);
return SUCCESS;
} else {
return ERROR;
}
}
public String addComment(){
//需要内容,用户id,视频id
Comment comment1 = new Comment();
comment1.setVideoId(videoId);
comment1.setCommentTime(new Timestamp(System.currentTimeMillis()));
//获取正在登陆的用户
User user1= (User)ActionContext.getContext().getSession().get("logonUser");
if (user1 == null) {
return LOGIN;
}
comment1.setUser(user1);
comment1.setContent(content);
System.out.println("userId&& content" + user1.getId() + "//" + videoId + "//" + comment1.getContent());
getCommentService().addComment(comment1);
return SUCCESS;
}
//删除评论,将其内容设置为“评论已被删除”
public String deleteComment(){
Comment comment1 = getCommentService().findCommentById(commentId);
getCommentService().deleteComment(comment1);
return SUCCESS;
}
}
| [
"jamin.k.chan@gmail.com"
] | jamin.k.chan@gmail.com |
2d0248809d7c5c229868f583260728479270a28a | 60760bfad28fa6a840844ba0057a77a1e39e2088 | /mssm-other-boot/src/main/java/com/mssm/other/service/impl/ColorServiceImpl.java | 718ade6b9d15eef6e29ac6a27384edf2106fc28b | [] | no_license | kimyundung/mssm-cloud | f2c65b724e6368134f8984f62affa256d88ba2b1 | a23cf678aab73d6428da792b50e9ac053e3a804e | refs/heads/master | 2023-07-28T00:24:51.539746 | 2021-09-13T13:08:30 | 2021-09-13T13:08:30 | 403,593,687 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,474 | java | package com.mssm.other.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mssm.common.domain.Color;
import com.mssm.other.mapper.ColorMapper;
import com.mssm.other.service.ColorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class ColorServiceImpl implements ColorService {
@Autowired
private ColorMapper colorMapper;
// 1.查询所有
@Override
public List<Color> queryAll() {
List<Color> colorList = colorMapper.queryAll();
return colorList;
}
// 2.删除根据ID
@Override
public int deleteById(Integer id) {
// 1:success 8:外键
int i = 0;
try {
colorMapper.deleteById(id);
i=1;
} catch (Exception e) {
e.printStackTrace();
i=8;
}
return i;
}
// 3.添加
@Override
public int addColor(String name) {
int result = 0;
// 添加
try {
colorMapper.addColor(name);
result = 1;
} catch (Exception e) {
result = 8;
e.printStackTrace();
}
return result;
}
// 4.修改批量颜色
@Override
public void updateBatch(List<Color> colorList) {
for(Color color: colorList){
colorMapper.updateColor(color);
}
}
}
| [
"kimyundung@naver.com"
] | kimyundung@naver.com |
d4e82c4da7046318f4c8f172774b7d441b7b77d5 | c8e8e740e00320e0a1be0d40dad5263471bdda3d | /src/leetcode/L2017051304_441_Arranging_Coins.java | 8eb9355be7b66fc0d398c0e8ab8a38d7fb194357 | [] | no_license | zhangruimin/leetcode | 7fdf4d64be48711ffc5579b673a1df2d4c68da96 | 3299b40534050caa7575e47ba8cf6514df98b844 | refs/heads/master | 2021-01-23T04:39:18.326871 | 2018-05-20T12:22:44 | 2018-05-20T12:22:44 | 86,231,072 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 403 | java | package leetcode;
/**
*/
public class L2017051304_441_Arranging_Coins {
public int arrangeCoins(int n) {
return (int) ((Math.sqrt(8.0 * n + 1) - 1) / 2);
}
public int arrangeCoins_mine(int n) {
int coins = 0;
int k = 0;
while (coins <= n && coins + k > coins) {
k++;
coins = coins + k;
}
return k - 1;
}
}
| [
"zrruimin@amazon.com"
] | zrruimin@amazon.com |
e40619258f46a3ed4d0a48db0229cfee30d41c74 | eb20d23b9841fb5a3261a393196a715ee6f75be6 | /src/com/sunx/rmi/service/RmiRequest.java | 1d84e1af684e118397ca71ed9bfa32846a7e6605 | [
"Apache-2.0"
] | permissive | Sunature/restmi | 90e3f85f5dff09c1687402331f3b2b3aafbd35e5 | 8669bb43ba53abc83e7b87bac576f01d9fc8a5e1 | refs/heads/master | 2021-01-23T04:39:19.552607 | 2017-07-05T08:19:37 | 2017-07-05T08:19:37 | 86,232,201 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,949 | java | package com.sunx.rmi.service;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import com.sunx.util.JsonUtil;
import com.sunx.util.external.StringUtil;
/**
* @author Sun
* @version
* @since JDK 1.7
*/
public class RmiRequest implements Serializable {
private static final long serialVersionUID = -7283399293301418888L;
private String key;
private String secret;
private String nonce;
private long timestamp;
private String method;
private Map<String, Object> params;
private String ps;
public RmiRequest(String key, String secret, String method) {
this(method);
this.setKey(key);
this.setSecret(secret);
}
public RmiRequest(String method) {
this.nonce = StringUtil.createRandomNum(6);
this.timestamp = System.currentTimeMillis();
this.method = method;
this.params = new HashMap<String, Object>();
}
public void addParam(String name, Object value) {
this.params.put(name, value);
this.ps = JsonUtil.toJsonStr(this.params);
}
public void addParams(Map<String, Object> params) {
this.params.putAll(params);
this.ps = JsonUtil.toJsonStr(this.params);
}
public String getPs() {
return ps;
}
public void setPs(String ps) {
this.ps = ps;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
public String getNonce() {
return nonce;
}
public void setNonce(String nonce) {
this.nonce = nonce;
}
public long getTimestamp() {
return timestamp;
}
public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public Map<String, Object> getParams() {
return params;
}
public void setParams(Map<String, Object> params) {
this.params = params;
}
}
| [
"sun@haicoo.com"
] | sun@haicoo.com |
338b38df0fa8bc806a347a1444be8569dd2f1deb | f12b7fd30bd3ba07bf12746515a33cc13309d711 | /src/com/core/mySuite/One.java | 15e4e25b70ecbd7984b2a799c940b01c2b9087a0 | [] | no_license | sdharmik/MySharedRepository | dd72dc7d4b34ebce745cf1a343490320f46ceedc | a92b44e97e3762ac1d88642b688d64b28ce41881 | refs/heads/master | 2021-01-12T06:08:24.734390 | 2016-12-25T05:42:43 | 2016-12-25T05:42:43 | 77,312,278 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,330 | java | package com.core.mySuite;
import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import com.core.util.TestUtil;
public class One extends MyInitializations{
@BeforeClass
public void verifyExecutionState(){
if(!TestUtil.verifyTCMode(readExcel, this.getClass().getSimpleName())){
AppLogs.debug(this.getClass().getSimpleName()+" :execution skipped as test execution mode set to No");
throw new SkipException("execution skipped as test execution mode set to No");
}
}
/*
@Test(dataProvider="getData")
public void One(String user, String password, String mode){
//System.out.println("User: "+user+" Password: "+password+" Mode: "+mode);
//System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
launchBrowser();
enterText("id", "email", "dharmiksameer");
enterText("id", "pass", "xyz");
clickButton("id", "u_0_l");
}
@DataProvider
public Object[][] getData(){
Object[][] myData=TestUtil.getData(readExcel,this.getClass().getSimpleName());
return myData;
}
*/
@Test
public void fbTest(){
launchBrowser();
enterText("id", "email", "dharmiksameer");
enterText("id", "pass", "xyz");
clickButton("id", "u_0_l");
}
}
| [
"sameer"
] | sameer |
f635a65fb776e2d0fde03412334463089a4f11eb | 4454b9454430d5e753ed7857986e28074ca25ba8 | /src/main/java/com/ccjjltx/format/dateformat/DateFormatTest.java | 322fbb6f9069b38c60db36c7c58054c8f1487f29 | [] | no_license | 783081406/basejava | 714e3a3b412d3e1f4a0b4f7ab1f949672c4ec767 | 7f096ca02c0170cc16b77951b74b9f325c7c762f | refs/heads/master | 2021-01-22T05:24:06.489537 | 2017-04-24T03:38:27 | 2017-04-24T03:38:27 | 81,708,425 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,269 | java | package com.ccjjltx.format.dateformat;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.util.Date;
import java.util.Locale;
/**
* Created by ccjjltx on 2017/3/8.
*
* @author ccj
* @version 1.0
*/
public class DateFormatTest {
public static void main(String[] args) {
// 只显示“时间”:调用getTimeInstance()函数
testGetTimeInstance();
// 只显示“日期”:调用getDateInstance()函数
testGetDateInstance();
// 显示“日期”+“时间”:调用getDateTimeInstance()函数
testGetDateTimeInstance();
// 测试format()函数
testFormat();
}
/**
* 只显示“时间”:调用getTimeInstance()函数
*/
private static void testGetTimeInstance() {
Date date = new Date();
Locale locale = new Locale("en", "US");
DateFormat short0 = DateFormat.getTimeInstance();
//参数是:“时间的显示样式”
DateFormat short1 = DateFormat.getTimeInstance(DateFormat.SHORT);
DateFormat medium1 = DateFormat.getTimeInstance(DateFormat.MEDIUM);
DateFormat long1 = DateFormat.getTimeInstance(DateFormat.LONG);
DateFormat full1 = DateFormat.getTimeInstance(DateFormat.FULL);
//参数是:“时间的显示样式” 和 “地区”
DateFormat short2 = DateFormat.getTimeInstance(DateFormat.SHORT, locale);
DateFormat medium2 = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale);
DateFormat long2 = DateFormat.getTimeInstance(DateFormat.LONG, locale);
DateFormat full2 = DateFormat.getTimeInstance(DateFormat.FULL, locale);
System.out.println("默认\t" + "SHORT\t" + "MEDIUM\t" + "LONG\t" + "FULL\t");
//23:35:24 下午11:35 23:35:24 下午11时35分24秒 下午11时35分24秒 CST
System.out.println(short0.format(date) + "\t" + short1.format(date) + "\t" + medium1.format(date) + "\t"
+ long1.format(date) + "\t" + full1.format(date));
//23:35:24 11:35 PM 11:35:24 PM 11:35:24 PM CST 11:35:24 PM CST
System.out.println(short0.format(date) + "\t" + short2.format(date) + "\t" + medium2.format(date) + "\t"
+ long2.format(date) + "\t" + full2.format(date));
}
/**
* 只显示“日期”:调用getDateInstance()函数
*/
private static void testGetDateInstance() {
System.out.println("======================================");
Date date = new Date();
Locale locale = new Locale("en", "US");
DateFormat short0 = DateFormat.getDateInstance();
DateFormat short1 = DateFormat.getDateInstance(DateFormat.SHORT);
DateFormat medium1 = DateFormat.getDateInstance(DateFormat.MEDIUM);
DateFormat long1 = DateFormat.getDateInstance(DateFormat.LONG);
DateFormat full1 = DateFormat.getDateInstance(DateFormat.FULL);
DateFormat short2 = DateFormat.getDateInstance(DateFormat.SHORT, locale);
DateFormat medium2 = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
DateFormat long2 = DateFormat.getDateInstance(DateFormat.LONG, locale);
DateFormat full2 = DateFormat.getDateInstance(DateFormat.FULL, locale);
System.out.println("默认\t" + "SHORT\t" + "MEDIUM\t" + "LONG\t" + "FULL\t");
//2017-3-8 17-3-8 2017-3-8 2017年3月8日 2017年3月8日 星期三
System.out.println(short0.format(date) + "\t" + short1.format(date) + "\t" + medium1.format(date) + "\t"
+ long1.format(date) + "\t" + full1.format(date));
//2017-3-8 3/8/17 Mar 8, 2017 March 8, 2017 Wednesday, March 8, 2017
System.out.println(short0.format(date) + "\t" + short2.format(date) + "\t" + medium2.format(date) + "\t"
+ long2.format(date) + "\t" + full2.format(date));
}
/**
* 显示“日期”+“时间”:调用getDateTimeInstance()函数
*/
private static void testGetDateTimeInstance() {
System.out.println("======================================");
Date date = new Date();
Locale locale = new Locale("en", "US");
DateFormat short0 = DateFormat.getDateTimeInstance();
DateFormat short1 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT);
DateFormat medium1 = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM);
DateFormat long1 = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);
DateFormat full1 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
DateFormat short2 = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, locale);
DateFormat medium2 = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale);
DateFormat long2 = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
DateFormat full2 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL, locale);
System.out.println("默认\t" + "SHORT\t" + "MEDIUM\t" + "LONG\t" + "FULL\t");
//2017-3-8 23:40:56 17-3-8 下午11:40 2017-3-8 23:40:56 2017年3月8日 下午11时40分56秒 2017年3月8日 星期三 下午11时40分56秒 CST
System.out.println(short0.format(date) + "\t" + short1.format(date) + "\t" + medium1.format(date) + "\t"
+ long1.format(date) + "\t" + full1.format(date));
//2017-3-8 23:40:56 3/8/17 11:40 PM Mar 8, 2017 11:40:56 PM March 8, 2017 11:40:56 PM CST Wednesday, March 8, 2017 11:40:56 PM CST
System.out.println(short0.format(date) + "\t" + short2.format(date) + "\t" + medium2.format(date) + "\t"
+ long2.format(date) + "\t" + full2.format(date));
}
/**
* 测试format()函数
*/
private static void testFormat() {
System.out.println("======================================");
Date date = new Date();
StringBuffer sb = new StringBuffer();
FieldPosition field = new FieldPosition(DateFormat.YEAR_FIELD);
DateFormat format = DateFormat.getDateTimeInstance();
sb = format.format(date, sb, field);
System.out.println("\ntestFormat");
System.out.println("sb=" + sb);//sb=2017-3-8 23:48:13
}
}
| [
"783081406ccj@gmail.com"
] | 783081406ccj@gmail.com |
f18315f730bcc58e50f16af9cdef6cc2af661272 | 78479864badf6f2bc7c5abeb2412c73b7113bda2 | /plugin/topologychannels/resource/utility/JComboBoxPattern.java | 171d36ca1ed30fa08b99fa04d5142d08469a2248 | [] | no_license | remenska/Charmy | 8784bb2101a12badb25b44cddc0b9cb11769ec6d | d77092c6637127166a2eecab13b6430316cc89e7 | refs/heads/master | 2020-06-04T11:34:18.392901 | 2013-07-18T19:21:48 | 2013-07-18T19:21:48 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,233 | java | /* Charmy (CHecking Architectural Model consistencY)
* Copyright (C) 2004 Patrizio Pelliccione <pellicci@di.univaq.it>,
* Henry Muccini <muccini@di.univaq.it>, Paola Inverardi <inverard@di.univaq.it>.
* Computer Science Department, University of L'Aquila. SEA Group.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package plugin.topologychannels.resource.utility;
import javax.swing.JComboBox;
import plugin.topologychannels.resource.graph.GraficoLink;
/** La classe specializza JComboBox introducendo l'inizializzazione con i pattern
disponibili nella classe 'GraficoLink' per il tracciamento di una linea. */
public class JComboBoxPattern extends JComboBox
{
/** Vettore dei pattern disponibili per il tracciamento di una linea. */
static final int[] patterndisponibili = {GraficoLink.SIMPLE_PATTERN,
GraficoLink.TYPE1_PATTERN, GraficoLink.TYPE2_PATTERN};
/* Costruttore_ Prende in ingresso l'elemento da selezionare nella 'ComboBox'. */
public JComboBoxPattern(int pattern)
{
super();
int index = 0;
addItem("Simple");
addItem("Type 1");
addItem("Type 2");
for (int i=0; i < patterndisponibili.length; i++)
{
if (pattern == patterndisponibili[i])
{
index = i;
}
}
setSelectedIndex(index);
}
/** Restituisce il pattern selezionato. */
public int getSelectedPattern()
{
return(patterndisponibili[getSelectedIndex()]);
}
} | [
"remenska@gmail.com"
] | remenska@gmail.com |
b9f07919eccac22fd2bcb943877b5f95450727bb | 071a9fa7cfee0d1bf784f6591cd8d07c6b2a2495 | /corpus/norm-class/log4j/105.java | 942f885545538f2c595e64a4eb07779b450e2306 | [
"MIT"
] | permissive | masud-technope/ACER-Replication-Package-ASE2017 | 41a7603117f01382e7e16f2f6ae899e6ff3ad6bb | cb7318a729eb1403004d451a164c851af2d81f7a | refs/heads/master | 2021-06-21T02:19:43.602864 | 2021-02-13T20:44:09 | 2021-02-13T20:44:09 | 187,748,164 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,196 | java | licensed apache software foundation asf contributor license agreements notice file distributed work additional copyright ownership asf licenses file apache license version license file compliance license copy license http apache org licenses license required applicable law agreed writing software distributed license distributed basis warranties conditions kind express implied license specific language governing permissions limitations license org apache log net junit framework test case testcase org apache log appender skeleton appenderskeleton org apache log logger org apache log spi logging event loggingevent org apache log xml dom configurator domconfigurator socket appender test socketappendertest test case testcase create instance socket appender test socketappendertest string test name testname test name testname j unit junit set up setup tear down teardown set up setup dom configurator domconfigurator configure input xml socket appender test config socketappendertestconfig xml logger logger get logger getlogger socket appender test socketappendertest secondary last only appender lastonlyappender logger get logger getlogger org apache log net socket appender test dummy socketappendertestdummy get appender getappender last only lastonly tear down teardown tests test fallback error handler when starting testfallbackerrorhandlerwhenstarting string msg test fallback error handler when starting testfallbackerrorhandlerwhenstarting logger debug msg debug log fail shoul redirected secondary appender assert equals assertequals socket appender socketappender fallback error handler fallbackerrorhandler msg secondary get last message getlastmessage fields logger logger last only appender lastonlyappender secondary debug ging debugging purposes saves logger event loggerevent last only appender lastonlyappender appender skeleton appenderskeleton append logging event loggingevent event last event lastevent event requires layout requireslayout close closed appended logging event loggingevent message string get last message getlastmessage last event lastevent last event lastevent get message getmessage to string tostring logging event loggingevent last event lastevent | [
"masudcseku@gmail.com"
] | masudcseku@gmail.com |
3ed353b1283c8898086f045eccda34da098e016e | 474162239a2d2eebfc0648ffb907e5ad8fa7de71 | /SpringBootJQueryAjax/src/main/java/com/lanshiqin/dao/GroupDao.java | e2a4e36cf88736fc21fa29dc2d8e4e3a6dcd4f82 | [] | no_license | SunMuxin/gm | 844e86ad736aaf3ebb9450c242c4acb3f53367ff | 0654f866f420b13b41c3e3ae03c4f9b5f85164dc | refs/heads/master | 2021-01-01T20:07:34.565010 | 2017-07-30T02:19:06 | 2017-07-30T02:19:06 | 98,769,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,238 | java | package com.lanshiqin.dao;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;
import com.lanshiqin.entity.Group;
@Mapper
public interface GroupDao {
@Insert("insert into group_n(t_name, group_s) value(#{arg0}, #{arg1});")
int insert(String name, int group_s);
@Results({
@Result(property = "name", column = "t_name", javaType = String.class, jdbcType = JdbcType.VARCHAR),
@Result(property = "group_s", column = "group_s", javaType = int.class, jdbcType = JdbcType.INTEGER)})
@Select("select * from group_n;")
List<Group> queryAll();
@Results({
@Result(property = "name", column = "t_name", javaType = String.class, jdbcType = JdbcType.VARCHAR),
@Result(property = "group_s", column = "group_s", javaType = int.class, jdbcType = JdbcType.INTEGER)})
@Select("select * from group_n where t_name=#{arg0};")
List<Group> query(String name);
@Delete("delete from group_n;")
void delete();
}
| [
"sspa@foxmail.com"
] | sspa@foxmail.com |
6e22837762001a226f5fb3e6189a84c698c56545 | bb85d57e450f6056537c216182340b0ef711ef67 | /Sample/app/src/main/java/com/microsoft/projectoxford/face/samples/helper/LogHelper.java | 8a75bd7653c77beb37c16be3659814c3fea28451 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | Mirofq/AM-I-DEPRESSED-AID-FYP | aecf25f8024d3c1be36e062174a977874ea50f6f | 634f1bcdf1815735b4ff1ef1fdeb48a23adc9de6 | refs/heads/master | 2023-03-28T04:46:22.827457 | 2021-04-05T07:56:38 | 2021-04-05T07:56:38 | 334,923,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,220 | java | package com.microsoft.projectoxford.face.samples.helper;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Locale;
/**
* Defined several functions to log service calls.
*/
public class LogHelper {
// Get all the detection log items.
public static List<String> getDetectionLog() {
return mDetectionLog;
}
// Add a new detection log item.
public static void addDetectionLog(String log) {
mDetectionLog.add(LogHelper.getLogHeader() + log);
}
// Clear all detection log items.
public static void clearDetectionLog() {
mDetectionLog.clear();
}
// Get all the verification log items.
public static List<String> getVerificationLog() {
return mVerificationLog;
}
// Add a new verification log item.
public static void addVerificationLog(String log) {
mVerificationLog.add(LogHelper.getLogHeader() + log);
}
// Clear all verification log items.
public static void clearVerificationLog() {
mVerificationLog.clear();
}
// Get all the grouping log items.
public static List<String> getGroupingLog() {
return mGroupingLog;
}
// Add a new grouping log item.
public static void addGroupingLog(String log) {
mGroupingLog.add(LogHelper.getLogHeader() + log);
}
// Clear all grouping log items.
public static void clearGroupingLog() {
mGroupingLog.clear();
}
// Get all the find similar face log items.
public static List<String> getFindSimilarFaceLog() {
return mFindSimilarFaceLog;
}
// Add a new find similar face log item.
public static void addFindSimilarFaceLog(String log) {
mFindSimilarFaceLog.add(LogHelper.getLogHeader() + log);
}
// Clear all find similar face log items.
public static void clearFindSimilarFaceLog() {
mFindSimilarFaceLog.clear();
}
// Get all the identification log items.
public static List<String> getIdentificationLog() {
return mIdentificationLog;
}
// Add a new identification log item.
public static void addIdentificationLog(String log) {
mIdentificationLog.add(LogHelper.getLogHeader() + log);
}
// Clear all identification log items.
public static void clearIdentificationLog() {
mIdentificationLog.clear();
}
// Detection log items.
private static List<String> mDetectionLog = new ArrayList<>();
// Verification log items.
private static List<String> mVerificationLog = new ArrayList<>();
// Grouping log items.
private static List<String> mGroupingLog = new ArrayList<>();
// Find Similar face log items.
private static List<String> mFindSimilarFaceLog = new ArrayList<>();
// Identification log items.
private static List<String> mIdentificationLog = new ArrayList<>();
// Get the current time and add to log.
private static String getLogHeader() {
DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss", Locale.US);
return "[" + dateFormat.format(Calendar.getInstance().getTime()) + "] ";
}
}
| [
"miraafq@gmail.com"
] | miraafq@gmail.com |
7d0be34f25016efa79ef180884cfe7eef253a240 | aaed025826f844a38cb9965669303715a936a41f | /src/boxOffice.java | dc90de3ec67d7b921c25de94ad032621dce48d80 | [] | no_license | abieleyassu/theather-kiosk- | 8bdd1f36d9f6e6226885e45bb03b33d9fdd3d06e | ed1a4d2d23dae62ea75fbf99aa01965508632671 | refs/heads/master | 2022-08-16T21:38:35.651199 | 2020-05-28T20:15:56 | 2020-05-28T20:15:56 | 267,685,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,869 | java | import java.util.*;
import java.io.*;
import java.math.*;
public class boxOffice {
File showing = new File("/Users/abiel/Desktop/JavaReferecedFiles/showTime.txt");
File movies = new File("/Users/abiel/Desktop/JavaReferecedFiles/movies.txt");
File seating = new File("/Users/abiel/Desktop/JavaReferecedFiles/seatingChart.txt");
File seatingSelect = new File("/Users/abiel/Desktop/JavaReferecedFiles/seatingSelections.txt");
File seatingRecord = new File("/Users/abiel/Desktop/JavaReferecedFiles/seatingSelection.txt");
File paymentInformation = new File("/Users/abiel/Desktop/JavaReferecedFiles/paymentInformation.txt");
ArrayList<String> showTime = new ArrayList();
//Holds all of the show times to select from when read from the local file database
//Helps make the selection easier to make and helps return the user selection quicker
String[] movie = new String[14];
//Holds the movies that are stored in the local movies.txt database
String[] menu = new String[14];
ArrayList<String> promotion = new ArrayList();
double[] concessionCost = {5.20, 8.30, 11.45, 4.15, 3.45, 2.20, 4.50, 6.12, 2.17, 3.99, 1.99, 3.99};
ArrayList<String> seats= new ArrayList();
double pastMemberSaving = .20;
double newMemberSaving = .15;
int adult = 0;
//Number of adult tickets
int kid = 0;
//Number of tickets for children
double adultTicket = 11.30;
double kidTicket = 8.45;
int showTimeSelection = 0;
double finalTicket = 0;
int choice = 0;
String name = "";
String memberStatus = "";
String phoneNumber;
boolean membership;
String promoCode = "";
String paymentMethod = "";
BigInteger cardNumber;
int ccv = 0;
String expirationDate = "";
int securityCodes = 0;
String seater = "";
public static final String ANSI_RED = "\u001B[31m";
public void theaterEnterance() throws IOException {
Scanner enterance = new Scanner(System.in);
System.out.println("Welcome to Dreamland Theater!");
System.out.println("\n" + "Would you like to buy a ticket?(yes/no): ");
String answer = enterance.nextLine();
if(answer.equalsIgnoreCase("yes") || answer.equalsIgnoreCase("y")) {
showTime();
}
else {
System.out.println("Thank you for visiting The Dream Land Theaters");
System.exit(1);
}
}
public void showTime() throws IOException {
Scanner show = new Scanner (showing); //Scanner used to scan line by line through local file
Scanner selectShowTime = new Scanner(System.in);
Scanner find = new Scanner(showing);
//Scanner used to take in user input regarding their show time choice
while(show.hasNext()) { //Loops through the file until there isn't a line
showTime.add(show.nextLine());
// Adds each line of the file to the showTime ArrayList
}
for(int z = 0; z < showTime.size(); z++) {
System.out.println("\n" + find.nextLine());
//Loops through the local file to print out the contents of the file
}
System.out.println("Please select a show time (Select the number): \n");
//System.out.println();
showTimeSelection = selectShowTime.nextInt();
//User input prompt
movies();
}
public void movies() throws IOException{
Scanner scan = new Scanner (movies);
Scanner screening = new Scanner(movies);
int r = 0;
while(scan.hasNext()) {
movie[r] = scan.nextLine();
r++;
}
while(screening.hasNext()) {
System.out.println("\n" + screening.nextLine());
}
Scanner movieChoice = new Scanner(System.in);
System.out.println("Please select the movie you want to watch (Input #): ");
choice = movieChoice.nextInt();
guestInfo();
}
public void guestInfo() throws IOException {
Scanner nameEntery = new Scanner(System.in);
System.out.println("Please enter in your name: ");
name = nameEntery.nextLine();
Scanner adults = new Scanner(System.in);
System.out.println("How many adult guest(s) are attending today?: ");
adult = adults.nextInt();
Scanner kids = new Scanner(System.in);
System.out.println("How many children guest(s) are attending today?");
kid = kids.nextInt();
System.out.println("\n");
seatingChart();
}
public void seatingChart() throws IOException {
PrintWriter print = new PrintWriter(new FileWriter(seatingRecord,true));
Scanner seaters = new Scanner(seating);
while(seaters.hasNext()) {
System.out.println(seaters.nextLine());
}
Scanner seat = new Scanner(seatingSelect);
while(seat.hasNext()) {
seats.add(seat.nextLine());
}
Scanner sit = new Scanner(System.in);
for(int m = 0; m < adult; m++) {
System.out.println("Please select a seating option: ");
seater = sit.nextLine();
print.println(seater);
}
for(int z = 0; z < kid; z++) {
System.out.println("Please select a seating option: ");
seater = sit.nextLine();
print.println(seater);
}
print.close();
}
}
| [
"abiel@Abiels-MacBook.local"
] | abiel@Abiels-MacBook.local |
f0acbe08b3e576953629037c3ff178153463275a | bac292bf0e14ad7d004d1033bd6e4d5c6ee0e9fa | /fcat-springcloud/fcat-gate/src/main/java/com/xfdmao/fcat/gate/config/WebSecurityConfig.java | 9dad9892db45a8f878944fd5eecadeae546ec10c | [
"Apache-2.0"
] | permissive | HK4U/FCat | cbe5e98473f5104efa64f487cf946add347b5f04 | 78392334dcd66f4e347a25d22a3958f70a917f56 | refs/heads/master | 2021-09-01T05:57:12.121507 | 2017-12-25T07:11:51 | 2017-12-25T07:11:51 | 115,315,538 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,037 | java | package com.xfdmao.fcat.gate.config;
import com.alibaba.fastjson.JSON;
import com.xfdmao.fcat.common.enumtype.ResultCodeEnum;
import com.xfdmao.fcat.common.util.HttpHelper;
import com.xfdmao.fcat.common.util.JsonUtil;
import com.xfdmao.fcat.gate.filter.CodeUsernamePasswordAuthenticationFilter;
import com.xfdmao.fcat.gate.filter.CorsFilter;
import com.xfdmao.fcat.gate.service.GateUserDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties;
import org.springframework.boot.autoconfigure.security.oauth2.resource.UserInfoTokenServices;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.NestedConfigurationProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.RememberMeAuthenticationProvider;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.oauth2.client.OAuth2ClientContext;
import org.springframework.security.oauth2.client.OAuth2RestTemplate;
import org.springframework.security.oauth2.client.filter.OAuth2ClientAuthenticationProcessingFilter;
import org.springframework.security.oauth2.client.token.grant.code.AuthorizationCodeResourceDetails;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableAuthorizationServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableOAuth2Client;
import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
import org.springframework.security.oauth2.config.annotation.web.configuration.ResourceServerConfigurerAdapter;
import org.springframework.security.web.authentication.*;
import org.springframework.security.web.authentication.logout.LogoutFilter;
import org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter;
import org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices;
import org.springframework.security.web.authentication.www.BasicAuthenticationFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import javax.servlet.Filter;
/**
* Created by xiangfei on 2017/10/16.
*/
@Configuration
@EnableOAuth2Client
@EnableAuthorizationServer
@Order(6)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
private GateUserDetailsService detailsService;
@Autowired
OAuth2ClientContext oauth2ClientContext;
@Autowired
private CorsFilter corsFilter;
@Override
public void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.userDetailsService(detailsService).and()
.authenticationProvider(rememberMeAuthenticationProvider()) /*.passwordEncoder(new BCryptPasswordEncoder())*/;
}
@Override
@Bean
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
/**
* 忽略静态文件
*/
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/js/**", "/img/**", "/css/**", "/images/**","fav.ico");
}
@Override
protected void configure(HttpSecurity http) throws Exception {
//解决Refused to display 'http://......' in a frame because it set 'X-Frame-Options' to 'DENY'. "错误
http.headers().frameOptions().disable();
http.authorizeRequests().antMatchers("/", "/login/**").permitAll()
// user权限可以访问的请求
.antMatchers("/security/user").hasRole("user")
// admin权限可以访问的请求
.antMatchers("/security/admin").hasRole("admin")
// SpEL表达式:需要拥有user权限,且进行了完全认证
.antMatchers("/user/account").access("hasRole('user') and isFullyAuthenticated()")
// 其他地址的访问均需验证权限(需要登录)
.anyRequest().authenticated().and()
.addFilterBefore(corsFilter,UsernamePasswordAuthenticationFilter.class)
.addFilterAt(codeUsernamePasswordAuthenticationFilter(), UsernamePasswordAuthenticationFilter.class).exceptionHandling()
.authenticationEntryPoint((request, response, authException) -> {
String result = JSON.toJSONString(JsonUtil.getResultJson(ResultCodeEnum.NOLOGIN));
HttpHelper.setResponseJsonData(response,result);
}).and()
.addFilterBefore(corsFilter,LogoutFilter.class)
.addFilterAt(rememberMeAuthenticationFilter(), LogoutFilter.class)
.formLogin().loginPage("/login_page")
.loginProcessingUrl("/login").permitAll().and()
.logout().deleteCookies("remember-me").logoutSuccessHandler(new CustomLogoutSuccessHandler()).permitAll();
http.csrf().disable();
}
@Bean
public CodeUsernamePasswordAuthenticationFilter codeUsernamePasswordAuthenticationFilter() throws Exception {
CodeUsernamePasswordAuthenticationFilter codeUsernamePasswordAuthenticationFilter = new CodeUsernamePasswordAuthenticationFilter();
codeUsernamePasswordAuthenticationFilter.setAuthenticationManager(authenticationManagerBean());
codeUsernamePasswordAuthenticationFilter.setAuthenticationSuccessHandler(authenticationSuccessHandler());
codeUsernamePasswordAuthenticationFilter.setAuthenticationFailureHandler(authenticationFailureHandler());
codeUsernamePasswordAuthenticationFilter.setRememberMeServices(tokenBasedRememberMeServices());
return codeUsernamePasswordAuthenticationFilter;
}
@Bean
public AuthenticationSuccessHandler authenticationSuccessHandler() {
return new CustomAuthenticationSuccessHandler();
}
@Bean
public AuthenticationFailureHandler authenticationFailureHandler() {
return new CustomAuthenticationFailureHandler();
}
@Bean
public RememberMeAuthenticationProvider rememberMeAuthenticationProvider() {
RememberMeAuthenticationProvider rmap = new RememberMeAuthenticationProvider("testallKey");
return rmap;
}
@Bean
public TokenBasedRememberMeServices tokenBasedRememberMeServices() {
TokenBasedRememberMeServices tbrms = new TokenBasedRememberMeServices("testallKey", detailsService);
// 设置cookie过期时间为2天
tbrms.setTokenValiditySeconds(60 * 60 * 24 * 2);
// 设置checkbox的参数名为rememberMe(默认为remember-me),注意如果是ajax请求,参数名不是checkbox的name而是在ajax的data里
tbrms.setParameter("rememberMe");
tbrms.setAlwaysRemember(false);
return tbrms;
}
@Bean
public RememberMeAuthenticationFilter rememberMeAuthenticationFilter() throws Exception {
RememberMeAuthenticationFilter myFilter = new RememberMeAuthenticationFilter(authenticationManagerBean(), tokenBasedRememberMeServices());
return myFilter;
}
private Filter githubFilter() {
OAuth2ClientAuthenticationProcessingFilter githubFilter = new OAuth2ClientAuthenticationProcessingFilter("/login/github");
OAuth2RestTemplate githubTemplate = new OAuth2RestTemplate(githubClient().getClient(), oauth2ClientContext);
githubFilter.setRestTemplate(githubTemplate);
githubFilter.setTokenServices(new UserInfoTokenServices(githubClient().getResource().getUserInfoUri(), githubClient().getClient().getClientId()));
return githubFilter;
}
@Bean
@ConfigurationProperties("github")
public ClientResources githubClient() {
return new ClientResources();
}
@Configuration
@EnableResourceServer
protected static class ResourceServerConfiguration extends ResourceServerConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.antMatcher("/v1/**").authorizeRequests().anyRequest().authenticated()
;
}
}
}
class ClientResources {
@NestedConfigurationProperty
private AuthorizationCodeResourceDetails client = new AuthorizationCodeResourceDetails();
@NestedConfigurationProperty
private ResourceServerProperties resource = new ResourceServerProperties();
public AuthorizationCodeResourceDetails getClient() {
return client;
}
public ResourceServerProperties getResource() {
return resource;
}
}
| [
"18811582182@163.com"
] | 18811582182@163.com |
4b77d742b3bfbea5f59418cef287d058705a9869 | ab86ceb4d27da601cec504c523de56206517e3f9 | /lmblelibrary/src/main/java/com/lesports/geneliveman/ble/CmdCallback.java | 2b72e479b31b701df4efb5bf6fb165755aee0d36 | [] | no_license | p0sitive/MyAndroidApplication | 9e42c857cf146c4600ac09ce384d71485940ebc8 | 1344eb712e6d59ed2e09a330496885f078a37088 | refs/heads/master | 2021-01-23T05:10:22.108420 | 2017-03-27T02:57:00 | 2017-03-27T02:57:00 | 86,283,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package com.lesports.geneliveman.ble;
/**
* Created by chenshang on 16/3/18.
*/
public class CmdCallback extends Callback{
public final String cmd;
public final boolean isWaitResponse;
private final Callback callback;
public CmdCallback(String cmd,Callback callback) {
this(cmd,callback,false);
}
public CmdCallback(String cmd,Callback callback,boolean isWaitResponse){
this.cmd = cmd;
this.callback = callback;
this.isWaitResponse = isWaitResponse;
}
@Override
public void onPrepareSend() {
callback.onPrepareSend();
}
@Override
public void onSended() {
this.callback.onSended();
}
@Override
public void onResponse(String response) {
this.callback.onResponse(response);
}
@Override
public void onError(Exception e) {
this.callback.onError(e);
}
}
| [
"lihe6@le.com"
] | lihe6@le.com |
35464e21f281e19e6aa56f16dcb54f189f7a546b | f1353fe3d4d8c7ff0e75aa5b5339d4deebc68084 | /src/main/java/pt/com/primeit/poc/jobrunnr/jobs/EmailJob.java | 2b545052ba02deaaf64ed68da5bd5e1b2405717b | [] | no_license | marcelosrodrigues/poc-jobrunnr | 10a4adf145ceeffbc2b81bacbea2c098e85edbb3 | 8e3065059f1455fbbb8dbe41bb211185df1086c9 | refs/heads/main | 2023-08-23T21:06:13.037822 | 2021-10-26T13:02:24 | 2021-10-26T13:02:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 344 | java | package pt.com.primeit.poc.jobrunnr.jobs;
import org.springframework.stereotype.Component;
@Component
public class EmailJob implements Job {
@Override
@org.jobrunr.jobs.annotations.Job( name = "EmailJob", retries = 5)
public void execute() {
System.out.println("send email " + Thread.currentThread().getName() );
}
}
| [
"marcelo.rodrigues_ext@michelin.com"
] | marcelo.rodrigues_ext@michelin.com |
75f603ebe23adcf7d5c4ebf02b99b67aa432b53c | 6c1cebbde04102e9a1f214509f210ae3c511233d | /lnk-api/src/main/java/io/lnk/api/port/package-info.java | 73bf6da817f8a5a8b10d92658116898fd1f325e1 | [] | no_license | twjitm/lnk | bdc6a90a127b267a4f1057a5b08b964b7c39a2c8 | cf7221855e1c24df0810d999c7affc5cd93afd05 | refs/heads/master | 2020-12-02T06:34:09.109336 | 2017-07-11T03:22:26 | 2017-07-11T03:22:26 | 96,854,599 | 1 | 1 | null | 2017-07-11T05:35:00 | 2017-07-11T05:35:00 | null | UTF-8 | Java | false | false | 138 | java | /**
* @author 刘飞 E-mail:liufei_it@126.com
*
* @version 1.0.0
* @since 2017年5月22日 下午4:14:56
*/
package io.lnk.api.port;
| [
"liufei_it@126.com"
] | liufei_it@126.com |
4f2a506e765699bc135462d13f612b1fe945473b | 1aa9425728e116ff1ae6477a73983c495685563b | /FxUser/src/sub1/Main.java | d24298f795bcec69d2ca352ed44049d0d5b8d066 | [] | no_license | enti3237/java | fb5e529a9d3fa317e9960c5dbba3e49d4bc0bf7e | 4238b86d137bc780a60f3151b8ae3d7d5115d5f6 | refs/heads/master | 2020-08-23T01:36:46.770018 | 2020-02-07T02:11:18 | 2020-02-07T02:11:18 | 216,516,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 708 | java | package sub1;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.fxml.FXMLLoader;
public class Main extends Application {
@Override
public void start(Stage primaryStage) {
try {
AnchorPane root = (AnchorPane)FXMLLoader.load(getClass().getResource("User.fxml"));
Scene scene = new Scene(root);
scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm());
primaryStage.setScene(scene);
primaryStage.setResizable(false);
primaryStage.show();
} catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
launch(args);
}
}
| [
"seireid@gmail.com"
] | seireid@gmail.com |
3ff6bd1340a2fdecef0901653e2632fc5419ae7b | 959841fc101462be149b7300ead0cf60c551105a | /musicLesson-project/musicLesson/src/test/java/com/mike/musicLesson/MusicLessonApplicationTests.java | 708d37400745c80c1f3645686a2a716c15edabb3 | [] | no_license | October2020PandA/MikeY-Assignments | 511c685895f19bae09c75cd96f65b31d014d9ded | 0e163451244bca1d6dc3a655aaba0e1939739cf3 | refs/heads/master | 2022-12-29T19:24:28.264428 | 2020-10-12T03:04:02 | 2020-10-12T03:04:02 | 299,469,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package com.mike.musicLesson;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class MusicLessonApplicationTests {
@Test
void contextLoads() {
}
}
| [
"mike.young@salesforce.com"
] | mike.young@salesforce.com |
34cbf59fb638d773d6fd1b409f60ba8a1a495570 | 6d7f9a22232372727d163a02a9308fe4066ee75f | /src/main/java/wcadapter/clases/Billing.java | 3facf6fabc2a10e5ff363b24eb94c8a7df5f3803 | [] | no_license | ylz201/WCAdapterA | 4947543ad09323f379850fa82820e313debb85d6 | 26bf9643048bb8ef77925d8c6eb4f3c0f7ee1b47 | refs/heads/master | 2020-09-12T00:42:25.446479 | 2019-04-12T15:57:46 | 2019-04-12T15:57:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,721 | java | package wcadapter.clases;
public class Billing {
private String first_name;
private String last_name;
private String company;
private String address_1;
private String address_2;
private String city;
private String state;
private String postcode;
private String country;
private String email;
private String phone;
/*"last_name": "rodriguez",
"company": "",
"address_1": "416 w. San Ysidro Blvd.",
"address_2": "ste. L - 1",
"city": "san ysidro",
"state": "CA",
"postcode": "92173",
"country": "US",
"email": "huertag@globalhitss.com",
"phone": "6197049434"
* */
public Billing(String first_name, String last_name, String company, String address_1, String address_2, String city,
String state, String postcode, String country, String email, String phone) {
super();
this.first_name = first_name;
this.last_name = last_name;
this.company = company;
this.address_1 = address_1;
this.address_2 = address_2;
this.city = city;
this.state = state;
this.postcode = postcode;
this.country = country;
this.email = email;
this.phone = phone;
}
public Billing() {
super();
// TODO Auto-generated constructor stub
}
public String getCompany() {
return company;
}
public void setFirst_name(String first_name) {
this.first_name = first_name;
}
public void setLast_name(String last_name) {
this.last_name = last_name;
}
public void setCompany(String company) {
this.company = company;
}
public void setAddress_1(String address_1) {
this.address_1 = address_1;
}
public void setAddress_2(String address_2) {
this.address_2 = address_2;
}
public void setCity(String city) {
this.city = city;
}
public void setState(String state) {
this.state = state;
}
public void setPostcode(String postcode) {
this.postcode = postcode;
}
public void setCountry(String country) {
this.country = country;
}
public void setEmail(String email) {
this.email = email;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getFirst_name() {
return first_name;
}
public String getLast_name() {
return last_name;
}
public String getAddress_1() {
return address_1;
}
public String getAddress_2() {
return address_2;
}
public String getCity() {
return city;
}
public String getState() {
return state;
}
public String getPostcode() {
return postcode;
}
public String getCountry() {
return country;
}
public String getEmail() {
return email;
}
public String getPhone() {
return phone;
}
}
| [
"ra_mo116@hotmail.com"
] | ra_mo116@hotmail.com |
cf1dfe5a3e0a59750a4a6c4ed852f479698abad8 | b35fadf8d375525e320751e25893f6f69a04e37d | /leimingtech-admin/src/main/java/com/leimingtech/platform/service/impl/doc/DocServiceImpl.java | 7d301d5f0e802b9da908deb3cbd2c6772f39d9ba | [] | no_license | dockercms/cms-4.0 | 8e41fca1142e121861a86006afaf378327f1917b | 8f390cc00848124daeb997b8c09aefa0f465572c | refs/heads/master | 2021-05-19T03:38:03.644558 | 2019-12-06T02:10:27 | 2019-12-06T02:10:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,903 | java | package com.leimingtech.platform.service.impl.doc;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.leimingtech.core.base.SortDirection;
import com.leimingtech.core.base.ContextHolderUtils;
import com.leimingtech.core.hibernate.qbc.CriteriaQuery;
import com.leimingtech.core.hibernate.qbc.PageList;
import com.leimingtech.core.service.CommonService;
import com.leimingtech.platform.entity.doc.DocEnRefEntity;
import com.leimingtech.platform.entity.doc.DocEntity;
import com.leimingtech.platform.entity.doc.DocParamEntity;
import com.leimingtech.platform.entity.doc.DocReturnValueEntity;
import com.leimingtech.platform.entity.doc.DocTypeEntity;
import com.leimingtech.platform.service.doc.DocServiceI;
/**
* 文档管理接口实现
*
* @author liuzhen 2014年6月11日 16:53:11
*
*/
@Service("docService")
@Transactional
public class DocServiceImpl implements DocServiceI {
/**公共dao接口*/
@Autowired
private CommonService commonService;
/**
* 删除文档(级联删除子集)
*
* @param doc
*/
@Override
public void delete(DocEntity doc) {
HttpServletRequest request = ContextHolderUtils.getRequest();
String id = request.getParameter("id");
List<DocParamEntity> docparamList = commonService.findByProperty(DocParamEntity.class, "docid", id);
commonService.deleteAllEntitie(docparamList); //删除标签及api输入参数
List<DocReturnValueEntity> docreturnList = commonService.findByProperty(DocReturnValueEntity.class, "docid", id);
commonService.deleteAllEntitie(docreturnList); //删除返回结果
List<DocEntity> docList = commonService.findByProperty(DocEntity.class, "pid", id);
commonService.deleteAllEntitie(docList); //删除api列表
commonService.delete(doc); //删除文档
}
/**
* 获取文档列表(标签调用)
*
* @param params
* @return
*/
@Override
public Object getDocListByTag(Map params) {
if (MapUtils.isEmpty(params)) {
return null;
}
String typeid = (String) params.get("typeid");
if (StringUtils.isNotEmpty(typeid)) {
String platform = (String) params.get("platform");
CriteriaQuery cq = new CriteriaQuery(DocEntity.class);
cq.eq("status", 1);
cq.eq("typeid", typeid);
cq.eq("pid", "0");
if(StringUtils.isNotEmpty(platform)){
cq.eq("platform", platform);
}
cq.addOrder("sort", SortDirection.desc);
cq.addOrder("createdtime", SortDirection.desc);
cq.add();
List<DocEntity> docList = commonService.getListByCriteriaQuery(cq, false);
if (docList != null && docList.size() > 0) {
for (int i = 0; i < docList.size(); i++) {
DocTypeEntity doctype = commonService.getEntity(DocTypeEntity.class, docList.get(i).getTypeid());
docList.get(i).setType(doctype.getName());
}
}
return docList;
}
return null;
}
@Override
public Map<String, Object> getPageList(String name, String typeid, String pid,String platform ,int pageSize, int pageNo) {
CriteriaQuery cq = new CriteriaQuery(DocEntity.class, pageSize, pageNo, "", "");
// 排序条件
// 查询条件组装器
cq.addOrder("createdtime",SortDirection.desc);
cq.addOrder("sort", SortDirection.desc);
if (StringUtils.isNotEmpty(name)) {
cq.like("name", "%" + name + "%");
}
if (StringUtils.isNotEmpty(pid)) {
cq.eq("pid", pid);
}else{
if(StringUtils.isEmpty(pid)){
cq.eq("pid", "0");
pid="0";
}
}
if (StringUtils.isNotEmpty(typeid)) {
cq.eq("typeid", typeid);
}
if (StringUtils.isNotEmpty(platform)) {
cq.eq("platform", platform);
}
cq.add();
PageList pageList = commonService.getPageList(cq, true);
List<DocEntity> resultList = pageList.getResultList();
if (resultList != null && resultList.size() > 0) {
// 文档类型赋值
for (DocEntity docEntity : resultList) {
DocTypeEntity doctype = commonService.getEntity(DocTypeEntity.class, docEntity.getTypeid());
if (doctype != null) {
docEntity.setType(doctype.getName());
}
}
}
int pageCount = (int) Math.ceil((double) pageList.getCount() / (double) pageSize);
if (pageCount <= 0) {
pageCount = 1;
}
Map<String, Object> m = new HashMap<String, Object>();
if (StringUtils.isEmpty(pid) || pid.equals("0")) {
// 查询文档类型,添加文档类型查询条件
CriteriaQuery cqDocType = new CriteriaQuery(DocTypeEntity.class);
cqDocType.eq("status", 1);
cqDocType.addOrder("sort", SortDirection.desc);
cqDocType.add();
List<DocTypeEntity> docTypeList = commonService.getListByCriteriaQuery(cqDocType, false);
m.put("docTypeList", docTypeList);
}
m.put("pageList", resultList);
m.put("pageNo", pageList.getCurPageNO());
m.put("pageCount", pageCount);
m.put("actionUrl", "docController.do?doc&pid=" + pid);
return m;
}
@Override
public void saveOrUpdate(DocEntity doc) {
commonService.saveOrUpdate(doc);
}
@Override
public String save(DocEntity doc) {
return (String) commonService.save(doc);
}
@Override
public DocEntity getDoc(String id) {
DocEntity doc=commonService.getEntity(DocEntity.class, id);
return doc;
}
@Override
public List<DocEntity> getListRedDoc(String id) {
HttpServletRequest request = ContextHolderUtils.getRequest();
String platform = request.getParameter("platform");
CriteriaQuery cq = new CriteriaQuery(DocEntity.class);
cq.eq("status", 1);
cq.eq("typeid", id);
if (StringUtils.isNotEmpty(platform)) {
cq.eq("platform", platform);
}
cq.eq("pid", "0");
cq.addOrder("sort", SortDirection.desc);
cq.add();
List<DocEntity> docList = commonService.getListByCriteriaQuery(cq, false);
return docList;
}
@Override
public List<DocEntity> getListRedDocTag(String id) {
HttpServletRequest request = ContextHolderUtils.getRequest();
String platform = request.getParameter("platform");
DocEntity doc = getDoc(id);
CriteriaQuery cq = new CriteriaQuery(DocEntity.class);
cq.eq("status", 1);
cq.eq("typeid", doc.getTypeid());
if (StringUtils.isNotEmpty(platform)) {
cq.eq("platform", platform);
}
cq.addOrder("sort", SortDirection.desc);
cq.add();
List<DocEntity> docList = commonService.getListByCriteriaQuery(cq, false);
return docList;
}
@Override
public List<DocEntity> getListRedDocApiList(String id) {
HttpServletRequest request = ContextHolderUtils.getRequest();
String platform = request.getParameter("platform");
DocEntity doc = getDoc(id);
CriteriaQuery cq = new CriteriaQuery(DocEntity.class);
cq.eq("status", 1);
cq.eq("pid", id);
if (StringUtils.isNotEmpty(platform)) {
cq.eq("platform", platform);
}
cq.addOrder("sort", SortDirection.desc);
cq.add();
List<DocEntity> docList = commonService.getListByCriteriaQuery(cq, false);
return docList;
}
@Override
public List<DocEnRefEntity> findByProperty(String id) {
List<DocEnRefEntity> docEnRefList = commonService.findByProperty(DocEnRefEntity.class, "doc.id", id);
return docEnRefList;
}
@Override
public List<DocEntity> getListRedDocApi(String id) {
HttpServletRequest request = ContextHolderUtils.getRequest();
String platform = request.getParameter("platform");
DocEntity doc =getDoc(id);
CriteriaQuery cq = new CriteriaQuery(DocEntity.class);
cq.eq("status", 1);
cq.eq("typeid", doc.getTypeid());
if (StringUtils.isNotEmpty(platform)) {
cq.eq("platform", platform);
}
cq.eq("pid", doc.getPid());
cq.addOrder("sort", SortDirection.desc);
cq.add();
List<DocEntity> docList = commonService.getListByCriteriaQuery(cq, false);
return docList;
}
} | [
"pixiaoyong@leimingtech.com"
] | pixiaoyong@leimingtech.com |
363cc4af79d9061d576bfb72f6fc60818a4c3b6d | 31f66aa7e95c34e8e5fec64eaaed59d8e1a04c8d | /G52/SWM/bike/src/bike/Main.java | 5aabe1f5e5f2916306ff1f192934d3d7c394d78b | [] | no_license | GingertronMk1/Time | 825b33b58642678a21e719e050d790dc9e1a49e1 | 9bcae8730fa9d9d1d47f87b6e9194e9794e8968a | refs/heads/master | 2021-03-19T11:45:41.020764 | 2019-11-08T13:21:32 | 2019-11-08T13:21:32 | 44,057,258 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 329 | java | package bike;
public class Main {
public static void main(String[] args){
Bicycle bike = new Bicycle(3, 5);
bike.speedUp(5);
bike.switchLight();
//bike.printInfo();
MountainBike mb1 = new MountainBike(3,5,true,true);
MountainBike mb2 = new MountainBike(3,5,true,false);
mb1.printMtn();
mb2.printMtn();
}
}
| [
"jackellis1504@me.com"
] | jackellis1504@me.com |
8b823c75739c17e2524de1b9916097d0911c80ea | ecd9fc2a3860cb09cc11c0035c5bf0bd35f6b6fd | /tags/gmaven-1.0-rc-1/gmaven-runtime/gmaven-runtime-1.5/src/test/java/org/codehaus/groovy/maven/runtime/v15/stubgen/ModelFactoryImplTest.java | b34f48be680d4dcfee2b5eca7f2d9782260c2985 | [
"Apache-2.0"
] | permissive | codehaus/gmaven | 4a8272d6f8383835ca40eaebe94ca3916a9257f6 | bbf0a1af2878c3a92f6748cd4931acd11c12423c | refs/heads/master | 2023-07-20T00:30:16.338925 | 2012-08-02T20:46:04 | 2012-08-02T20:46:04 | 36,226,741 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,559 | java | /*
* Copyright (C) 2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.codehaus.groovy.maven.runtime.v15.stubgen;
import junit.framework.TestCase;
import org.codehaus.groovy.maven.runtime.support.stubgen.model.SourceDef;
import org.codehaus.groovy.maven.runtime.support.stubgen.model.ModelFactory;
import java.net.URL;
/**
* Tests for the {@link ModelFactoryImpl} class.
*
* @version $Id$
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
*/
public class ModelFactoryImplTest
extends TestCase
{
private ModelFactory factory;
protected void setUp() throws Exception {
factory = new ModelFactoryImpl();
}
public void testSimple() throws Exception {
URL input = getClass().getResource("SimpleTest.groovy");
assertNotNull(input);
System.out.println(input);
SourceDef model = factory.create(input);
assertNotNull(model);
System.out.println(model);
//
// TODO: Verify
//
}
} | [
"user57@ab791694-f663-0410-bfd7-aac5750c40bb"
] | user57@ab791694-f663-0410-bfd7-aac5750c40bb |
1738ffb0cdcb3d8707f773b7c0c8b825cd56aa63 | 470638d559d0e626ea6cff28462e8d0ec97f11f3 | /java/代码/Java-Base/src/base/N.java | 8518871a1b8d4c306571ef1540ad3b5880e0cfa1 | [] | no_license | LiShuxue/BackEnd-Base | 40069d6cc88501f170a0b30969b8bb978e453d31 | 5ab9d1e16b9924fe252933342fdb8c57f86631cd | refs/heads/master | 2023-08-31T02:12:27.381616 | 2023-08-30T02:11:02 | 2023-08-30T02:11:02 | 93,992,632 | 0 | 0 | null | 2022-07-13T18:28:38 | 2017-06-11T08:49:05 | HTML | GB18030 | Java | false | false | 1,875 | java | package base;
import java.util.Scanner;
public class N {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("请输入消费金额:");
double cost = input.nextInt();
System.out.print("是否参加优惠换购活动(y/n):");
String isChoice = input.next();
if(isChoice.equals("y")) {
if(cost>=50) {
System.out.println("1:满50元,加2元换购百事可乐饮料一瓶");
System.out.println("2:满100元,加3元换购500ml可乐一瓶");
System.out.println("3:满100元,加10元换购5公斤面粉");
System.out.println("4:满200元,加10元换购一个苏泊尔炒菜锅");
System.out.println("5:满200元,加20元换购欧莱雅爽肤水一瓶");
System.out.println("0:不换购");
System.out.print("请选择:");
int choice = input.nextInt();
switch(choice){
case 1:
System.out.println("本次消费金额:" + (cost+2));
System.out.println("成功换购:百事可乐饮料一瓶");
break;
case 2:
System.out.println("本次消费金额:" + (cost+3));
System.out.println("成功换购:500ml可乐一瓶");
break;
case 3:
System.out.println("本次消费金额:" + (cost+10));
System.out.println("成功换购:5公斤面粉");
break;
case 4:
System.out.println("本次消费金额:" + (cost+10));
System.out.println("成功换购:一个苏泊尔炒锅");
break;
case 5:
System.out.println("本次消费金额:" + (cost+20));
System.out.println("成功换购:欧莱雅爽肤水一瓶");
break;
case 0:
System.out.println("您未选择换购");
}
}
else {
System.out.println("您的消费不满足换购条件,再见。");
}
}
else {
System.out.println("感谢您的使用。");
}
}
}
| [
"1149926505@qq.com"
] | 1149926505@qq.com |
71dcedd1c670612326676eede1e6d3b1254760af | b26d857db2565be2310703f40d49743c21983c2b | /src/functions/GriewankEvaluation.java | a901cdf5e5689e2458e8d5ce12c5733668096104 | [] | no_license | alponomar/ECSuccess | abed4ad1ea8847773280c5bd02b4a802435a7abf | 67ac1c5f5bf32b9b2837d993d670d0562760ecc3 | refs/heads/master | 2021-01-11T03:19:58.243234 | 2016-10-19T11:10:19 | 2016-10-19T11:10:19 | 71,022,846 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,467 | java | package functions;
import java.util.Properties;
import org.vu.contest.ContestEvaluation;
/**
* Created by Frederik on 16.10.2016.
*/
public class GriewankEvaluation implements ContestEvaluation{
// Evaluations budget
private final static int EVALS_LIMIT_ = 100000;
// The base performance. It is derived by doing random search on the F&P function (see function method) with the same
// amount of evaluations
private final static double BASE_ = 100.0;
// The minimum of the sphere function
private final static double ftarget_=0;
// Best fitness so far
private double best_;
// Evaluations used so far
private int evaluations_;
// Properties of the evaluation
private String multimodal_ = "true";
private String regular_ = "true";
private String separable_ = "false";
private String evals_ = Integer.toString(EVALS_LIMIT_);
private static double ALPHA_ = 10;
public GriewankEvaluation()
{
best_ = 0;
evaluations_ = 0;
}
private double function(double[] x)
{
int dim = 10;
double zoom = 10;
double sum = 0;
double prod = 1;
for(int i=0; i<dim; i++){
double x_i = x[i]*zoom;
sum += x_i*x_i;
prod *= Math.cos(x_i/Math.sqrt((double)i + 1));
}
sum /= 4000;
return sum - prod + 1;
}
@Override
public Object evaluate(Object result)
{
// Check argument
if(!(result instanceof double[])) throw new IllegalArgumentException();
double ind[] = (double[]) result;
if(ind.length!=10) throw new IllegalArgumentException();
if(evaluations_>EVALS_LIMIT_) return null;
// Transform function value (F&P is minimization).
// Normalize using the base performance
double f = 10 - 10*( (function(ind)-ftarget_) / BASE_ ) ;
if(f>best_) best_ = f;
evaluations_++;
return new Double(f);
}
@Override
public Object getData(Object arg0)
{
return null;
}
@Override
public double getFinalResult()
{
return best_;
}
@Override
public Properties getProperties()
{
Properties props = new Properties();
props.put("Multimodal", multimodal_);
props.put("Regular", regular_);
props.put("Separable", separable_);
props.put("Evaluations", evals_);
return props;
}
}
| [
"alen.ponomareva@gmail.com"
] | alen.ponomareva@gmail.com |
acd676143fbd9c9e61449589453387fe6e4fe101 | a8c54d0d64433e150f37f41232cb99aaa72e1936 | /BaiduOCR/src/main/java/BaiduAi.java | 4ea9346adcdd870773a6a3fbf5c34fe6984ed155 | [] | no_license | qxwei/MultiThread | 030aa621ae464f1125a3ac52e9918df6a57c333b | 013565dad79dc1c95cbde492447577c98e6ad46a | refs/heads/master | 2021-09-08T01:28:56.124308 | 2018-03-05T06:50:06 | 2018-03-05T06:50:06 | 106,645,297 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,457 | java | import com.baidu.aip.ocr.AipOcr;
import org.apache.commons.io.FileUtils;
import org.json.JSONObject;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.function.Function;
/**
* @author Damon
* @create 2017-12-27 15:27
**/
public class BaiduAi {
//设置APPID/AK/SK
public static final String APP_ID = "10591185";
public static final String API_KEY = "GV19Pd1zsiqBQFeGbxd0VBZW";
public static final String SECRET_KEY = "ctGOuNDvs6UexWEbaCYQEFG6XOVu1IDT";
private static AipOcr client = null;
public BaiduAi(){
client = new AipOcr(APP_ID, API_KEY, SECRET_KEY);
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
// 可选:设置代理服务器地址, http和socket二选一,或者均不设置
//client.setHttpProxy("proxy_host", proxy_port); // 设置http代理
//client.setSocketProxy("proxy_host", proxy_port); // 设置socket代理
}
public void txtTrans(String url,String type,String ext) throws Exception {
HashMap<String, String> options = new HashMap<>();
options.put("detect_direction", "true");
options.put("detect_risk", "false");
options.put("recognize_granularity", "big");
options.put("probability", "false");
options.put("language_type", "CHN_ENG");
options.put("probability", "true");
options.put("vertexes_location", "false");
URL httpUrl = new URL(url);
File directory = new File( "OCR_IMG");
if (!directory.exists()) directory.mkdirs();
File file = new File(String.format("OCR_IMG%s%s",File.separator,System.currentTimeMillis()));
FileUtils.copyURLToFile(httpUrl,file);
byte[] byteArr = FileUtils.readFileToByteArray(file);
JSONObject res = null;
if(type.equals("businessLicense")) {
res = client.businessLicense(byteArr, options);
}else if(type.equals("idCard")) {
String idCardSide = ext;
res = client.idcard(byteArr, idCardSide, options);
IdCard card = new IdCard();
JSONObject result = (JSONObject)res.get("words_result");
Function<String,String> f = x->((JSONObject)result.get(x)).get("words").toString();
card.setName(f.apply("姓名"));
card.setEthnic(f.apply("民族"));
card.setAddress(f.apply("住址"));
card.setNum(f.apply("公民身份号码"));
card.setBirthday(f.apply("出生"));
card.setGender(f.apply("性别"));
if(res!=null)System.out.println(card.toString());
}else if(type.equals("receipt")){
res = client.receipt(byteArr, options);
}
if(res!=null)System.out.println(res.toString(2));
else System.out.println("识别失败!");
}
public static void main(String[] args) {
BaiduAi ai = new BaiduAi();
// 调用接口
String path = "http://lifts.img-cn-shenzhen.aliyuncs.com/profile/img/6189/1504575516737.jpg@!800w";
String idCardUrl = "http://lifts.img-cn-shenzhen.aliyuncs.com/user/15578/001c9837f8ecfecc5870f53b826df073.jpg@!800w";
try {
// ai.txtTrans(path,"businessLicense",null);
ai.txtTrans(idCardUrl,"idCard","front");
} catch (Exception e) {
e.printStackTrace();
}
}
} | [
"121440270@qq.com"
] | 121440270@qq.com |
44f46f4dec099780e14055778748c2e3b05bf1d4 | 564e96ad794624b2c029b933ad6f55e708b80d08 | /COSC_1337/Assignment12/ComboBoxesTester.java | 58892eb65f5de2a7af68fc49604092ce5899069d | [] | no_license | harrystaley/Homework | b0745ab7eacecfa74e06ac494a9648f65c33182e | 5fc3b1b682091c0f074321156500dd764e64ae0a | refs/heads/master | 2022-07-15T12:22:50.889154 | 2022-06-29T07:12:22 | 2022-06-29T07:12:22 | 25,446,565 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 755 | java | //----------------------------------------------------
// Programmer: Harry Staley
// Course: COSC 1337 Section 0005
// Semester: Fall 2014
// Assignment #: 12
// Due Date: October 15 2014
//----------------------------------------------------
import javax.swing.JFrame;
public class ComboBoxesTester {
/**
* @param args
*/
public static void main(String[] args) {
// instantiate a frame
// from the class JFrame
JFrame frame = new JFrame("Fun with combo boxes");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// the primary panel is added
// to the frame and made visible
frame.getContentPane().add(new ComboBoxesGUI());
frame.pack();
frame.setVisible(true);
} // end method main
} // end class ComboBoxesTester
| [
"staleyh@gmail.com"
] | staleyh@gmail.com |
d35aae791ef5a2332327e171f9aaaab4b0e75814 | 077397a819bd4c8ad4ce129c54b01d22305739b1 | /chordest/src/main/java/chordest/util/DataUtil.java | bb5ce6a9b46352b2c60c3c1bb3d33339747cd51d | [] | no_license | nglazyrin/chordest | 04e921a99e911979cafaeba616f08861810b9506 | 63f9c842911cefb0200081eb300bccb23b69a4d1 | refs/heads/master | 2016-09-06T13:23:58.160830 | 2015-04-12T17:57:01 | 2015-04-12T17:57:01 | 4,773,209 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 28,732 | java | package chordest.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import chordest.util.metric.EuclideanMetric;
import chordest.wave.Buffer;
import chordest.wave.WaveFileInfo;
public class DataUtil {
private static final Logger LOG = LoggerFactory.getLogger(DataUtil.class);
/**
* Fits all the array values to [0, 1] range.
* @param data 2D array
*/
public static void scaleTo01(double[][] data) {
LOG.debug("Performing scaling to [0, 1] ...");
double max = Double.MIN_VALUE;
double min = Double.MAX_VALUE;
for (double[] array : data) {
for (double value : array) {
if (value > max) { max = value; }
if (value < min) { min = value; }
}
}
double d = max - min;
for (double[] array : data) {
for (int i = 0; i < array.length; i++) {
array[i] = (array[i] - min) / d;
}
}
}
/**
* Fits each column separately to [0, 1] range.
* @param data 2D array
*/
public static void scaleEachTo01(double[][] data) {
for (double[] array : data) {
scaleTo01(array);
}
}
/**
* Fits all the array values to [0, 1] range.
* @param data 1D array
*/
public static void scaleTo01(double[] data) {
double max = Double.MIN_VALUE;
double min = Double.MAX_VALUE;
for (double value : data) {
if (value > max) { max = value; }
if (value < min) { min = value; }
}
double d = max - min;
for (int i = 0; i < data.length; i++) {
data[i] = (data[i] - min) / d;
}
}
/**
* Sorts the List of Buffers by buffer timestamp
* @param buffers
*/
public static void sortByTimestamp(List<Buffer> buffers) {
Collections.sort(buffers, new Comparator<Buffer>() {
public int compare(Buffer o1, Buffer o2) {
double t1 = o1.getTimeStamp();
double t2 = o2.getTimeStamp();
if (Math.abs(t2 - t1) < 1) {
return t1 < t2 ? -1 : 1;
}
return (int) (t1 - t2);
} });
}
/**
* Performs horizontal smoothing of the array: replaces each value with
* an arithmetic mean of the value and its <code>window/2</code> left and
* its <code>window/2</code> right successive neighbors.
* @param data Array of columns
* @param window Size of smoothing window
* @return
*/
public static double[][] smoothHorizontally(final double[][] data, final int window) {
if (data == null) {
throw new NullPointerException("data is null");
}
if (window < 0 || window > data.length) {
throw new IllegalArgumentException("bad window size: " + window);
}
LOG.debug("Performing horizontal smooth with window size: " + window);
double[][] result = new double[data.length][];
int halfWindow = window / 2;
for (int col = 0; col < halfWindow; col++) {
result[col] = data[col];
}
for (int col = halfWindow; col < data.length - halfWindow - 1; col++) {
result[col] = new double[data[col].length];
for (int row = 0; row < data[col].length; row++) {
double sum = 0;
for (int i = -halfWindow; i <= halfWindow; i++) {
sum += data[col + i][row];
}
result[col][row] = sum / (2 * halfWindow + 1);
}
}
for (int col = data.length - halfWindow - 1; col < data.length; col++) {
result[col] = data[col];
}
return result;
}
/**
* Performs horizontal smoothing of the array: replaces each value with
* the median of the value and its <code>window/2</code> left and
* its <code>window/2</code> right successive neighbors.
* @param data Array of columns
* @param window Size of smoothing window
* @return
*/
public static double[][] smoothHorizontallyMedian(final double[][] data, final int window) {
if (data == null) {
throw new NullPointerException("data is null");
}
if (window < 0) {
throw new IllegalArgumentException("Window size must be >= 0 but was: " + window);
} else if (window > data.length) {
LOG.warn("Window is too large: " + window + ", only " + data.length + " values are available. Skip smoothing.");
return data;
}
LOG.debug("Performing horizontal smooth with window size: " + window);
int cols = data.length;
double[][] result = new double[cols][];
int halfWindow = window / 2;
for (int col = 0; col < halfWindow; col++) {
result[col] = data[col];
result[cols - col - 1] = data[cols - col - 1];
}
for (int col = halfWindow; col < cols - halfWindow; col++) {
result[col] = new double[data[col].length];
for (int row = 0; row < data[col].length; row++) {
double[] array = new double[2 * halfWindow + 1];
for (int i = -halfWindow; i <= halfWindow; i++) {
array[i + halfWindow] = data[col + i][row];
}
result[col][row] = findKthSmallest(array, 0, array.length, halfWindow + 1);
}
}
return result;
}
/**
* Performs horizontal smoothing of the array: replaces each value with
* the median of the value and its <code>window/2</code> left and
* its <code>window/2</code> right successive neighbors.
* @param data Array of columns
* @param window Size of smoothing window
* @return
*/
public static double[][] smoothHorizontallyMedianAndShrink(final double[][] data, final int window, int step) {
if (data == null) {
throw new NullPointerException("data is null");
}
if (window < 0) {
throw new IllegalArgumentException("Window size must be >= 0 but was: " + window);
} else if (window > data.length) {
LOG.warn("Window is too large: " + window + ", only " + data.length + " values are available. Skip smoothing.");
return data;
}
LOG.debug("Performing horizontal smooth with window size: " + window);
int cols = data.length;
int resultLength = data.length / step;
if (data.length % step != 0) {
resultLength++;
}
double[][] result = new double[resultLength][];
int halfWindow = window / 2;
for (int col = 0; col < data.length; col += step) {
if (col < halfWindow || col >= cols - halfWindow) {
result[col / step] = data[col];
} else {
result[col / step] = new double[data[col].length];
for (int row = 0; row < data[col].length; row++) {
double[] array = new double[2 * halfWindow + 1];
for (int i = -halfWindow; i <= halfWindow; i++) {
array[i + halfWindow] = data[col + i][row];
}
result[col / step][row] = findKthSmallest(array, 0, array.length, halfWindow + 1);
}
}
}
return result;
}
/**
* A variant of Prewitt operator for horizontal edge detection. Tries to
* detect the lines of width <= 3 points.
* Following matrix is used:
* <table>
* <tr><td>-1</td> <td>-1</td> <td>-1</td></tr>
* <tr><td>-1</td> <td>-1</td> <td>-1</td></tr>
* <tr><td>-1</td> <td>-1</td> <td>-1</td></tr>
* <tr><td>2</td> <td>2</td> <td>2</td></tr>
* <tr><td>2</td> <td>2</td> <td>2</td></tr>
* <tr><td>2</td> <td>2</td> <td>2</td></tr>
* <tr><td>-1</td> <td>-1</td> <td>-1<td/><tr/>
* <tr><td>-1</td> <td>-1</td> <td>-1<td/><tr/>
* <tr><td>-1</td> <td>-1</td> <td>-1<td/><tr/>
* </table>
*
* @param data
* @return
*/
public static double[][] filterHorizontal3(final double[][] data) {
if (data == null) {
throw new NullPointerException("data is null");
}
LOG.debug("Performing horizontal lines recognition...");
double[][] result = new double[data.length][];
result[0] = data[0];
result[1] = data[1];
result[2] = data[2];
result[3] = data[3];
for (int col = 1; col < data.length - 1; col++) {
result[col] = new double[data[col].length];
for (int row = 4; row < data[col].length - 4; row++) {
double y_4 = data[col-1][row-4] + data[col][row-4] + data[col+1][row-4];
double y_3 = data[col-1][row-3] + data[col][row-3] + data[col+1][row-3];
double y_2 = data[col-1][row-2] + data[col][row-2] + data[col+1][row-2];
double y_1 = data[col-1][row-1] + data[col][row-1] + data[col+1][row-1];
double y = data[col-1][row] + data[col][row] + data[col+1][row];
double y1 = data[col-1][row+1] + data[col][row+1] + data[col+1][row+1];
double y2 = data[col-1][row+2] + data[col][row+2] + data[col+1][row+2];
double y3 = data[col-1][row+3] + data[col][row+3] + data[col+1][row+3];
double y4 = data[col-1][row+4] + data[col][row+4] + data[col+1][row+4];
double dy = -y_4 - y_3 - y_2 + 2*y_1 + 2*y + 2*y1 - y2 - y3 - y4;
if (dy > 0) {
result[col][row] = data[col][row];
} else {
result[col][row] = 0;
}
}
}
result[data.length - 4] = data[data.length - 4];
result[data.length - 3] = data[data.length - 3];
result[data.length - 2] = data[data.length - 2];
result[data.length - 1] = data[data.length - 1];
return result;
}
/**
* Removes the horizontal segments of non-zero values from 2D array
* which have length less or equal to <code>tooShort</code> value.
* @param data
* @param tooShort Threshold value for the segment length
* @return
*/
public static double[][] removeShortLines(final double[][] data, final int tooShort) {
if (data == null) {
throw new NullPointerException("data is null");
}
LOG.debug("Removing short lines...");
double[][] result = new double[data.length][];
double limit = 1e-5;
result[0] = data[0];
for (int col = 1; col < data.length; col++) {
result[col] = new double[data[col].length];
for (int row = 0; row < data[col].length; row++) {
double v = data[col][row];
if (v > limit && result[col-1][row] > limit) {
result[col][row] = v;
} else if (v > limit) {
int i = col;
boolean ok = true;
int maxI = Math.min(data.length, col + tooShort);
while (i < maxI && ok) {
ok = data[i][row] > limit;
i++;
}
result[col][row] = ok ? v : 0;
} else {
result[col][row] = 0;
}
}
}
return result;
}
/**
* Collapses the spectrum bin that occupies multiple octaves into a
* single octave by simple summing the values that belong to the same
* pitch class over all octaves.
* @param cqtSpectrum One spectrum bin
* @param notesInOctave Number of spectral components per one octave
* @return
*/
public static double[] toSingleOctave(final double[] cqtSpectrum, final int notesInOctave) {
if (cqtSpectrum == null || cqtSpectrum.length == 0) {
throw new NullPointerException("cqtSpectrum is null or empty");
}
if (notesInOctave <= 0 || (cqtSpectrum.length % notesInOctave) != 0) {
throw new IllegalArgumentException("Incorrect value of notesInOctave: " + notesInOctave);
}
if (cqtSpectrum.length == notesInOctave) {
return Arrays.copyOf(cqtSpectrum, cqtSpectrum.length);
} else {
// double[] deg = new double[] { 1.0, 0.9, 0.8, 0.7, 0.6, 0.5 };
double[] deg = new double[] { 1.0, 1.0, 1.0, 1.0, 0.6, 0.5 };
double [] result = new double[notesInOctave];
for (int index = 0; index < cqtSpectrum.length; index++) {
double coeff = deg[index / notesInOctave];
double value = coeff * cqtSpectrum[index];
int noteNumber = index % notesInOctave;
result[noteNumber] += value;
}
return result;
}
}
/**
* For the array of spectrum vectors returns the array of PCP vectors
* obtained by applying {@link DataUtil.toPitchClassProfiles(double[])}
* to each spectrum vector.
* @param cqtSpectrum the spectrum
* @param notesInOctave Number of spectral components per one octave
* @return array of PCP vectors
*/
public static double[][] toSingleOctave(final double[][] cqtSpectrum, final int notesInOctave) {
if (cqtSpectrum == null) {
throw new NullPointerException("data is null");
}
if (notesInOctave <= 0) {
throw new IllegalArgumentException("Incorrect value of notesInOctave: " + notesInOctave);
}
LOG.debug("Converting to Pitch Class Profiles ...");
double[][] result = new double[cqtSpectrum.length][];
for (int i = 0; i < cqtSpectrum.length; i++) {
result[i] = DataUtil.toSingleOctave(cqtSpectrum[i], notesInOctave);
}
return result;
}
/**
* Reduces a given spectrum bin having 12*n components per octave to a
* spectrum bin having 12 components per octave.
* @param data 12*n*octaves-dimensional vector - spectrum bin
* @param octaves Number of octaves in the given bin
* @return
*/
public static double[] reduce(final double[] data, int octaves) {
if (data.length % 12 != 0) {
throw new IllegalArgumentException("There must be 12 * N components. "
+ data.length + " is not multiple of 12");
}
int resultComponents = 12 * octaves;
int subnotes = data.length / resultComponents;
if (subnotes > 1) {
// Reduce pcp array size to 12 if we have more than 12 "notes" in octave
// by summing the values of the "subnotes" nearest to each note with weights
double [] result = new double[resultComponents];
int totalNotes = data.length;
// int delta = subnotes / 2 - 1; // TODO
// if ((subnotes & 1) == 0) { // if subnotesCount is even
// delta--; // to exclude the subnotes that are in the "middle" between 2 real notes
// }
//int delta = subnotes > 2 ? 1 : 0;
// delta = Math.max(delta, 0);
int delta = 0; //TODO
for (int i = 0; i < resultComponents; i++) {
double temp = 0;
for (int j = -delta; j <= delta; j++) {
// account neighbors with lower weights
temp += data[(totalNotes + i * subnotes + j) % totalNotes];// * Math.pow(0.6, Math.abs(j));
// temp = Math.max(temp, data[(totalNotes + i * subnotes + j) % totalNotes]);
}
result[i] = temp;
}
return result;
} else {
return Arrays.copyOf(data, data.length);
}
}
/**
* Reduces the given spectrum having 12*n components per octave to a
* spectrum having 12 components per octave.
* @param data array of 12*n*octaves-dimensional vectors - spectrum
* @param octaves Number of octaves in the given spectrum
* @return
*/
public static double[][] reduce(final double[][] data, int octaves) {
if (data == null) {
throw new NullPointerException("data is null");
}
LOG.debug("Reducing to 12 notes per octave ...");
double[][] result = new double[data.length][];
for (int i = 0; i < data.length; i++) {
result[i] = reduce(data[i], octaves);
}
return result;
}
/**
* Folds the full-sized PCP vector (containing 12 * N components, where
* N is the count of "sub-notes" for each pitch class) into the
* "standard-sized" 12-dimensional vector by combining the components
* nearest to "base" components (corresponding to frequencies equal to
* real note frequencies) into a single component.
* @param pcp 12*N-dimensional vector
* @return 12-dimensional vector
*/
public static double[] reduceTo12Notes(final double[] pcp) {
if (pcp.length % 12 != 0) {
throw new IllegalArgumentException("There must be 12 * N subnotes. "
+ pcp.length + " is not multiple of 12");
}
int subnotesCount = pcp.length / 12;
if (subnotesCount > 1) {
// Reduce pcp array size to 12 if we have more than 12 "notes" in octave
// by summing the values of the "subnotes" nearest to each note with weights
double [] pcp12 = new double[12];
int totalNotes = pcp.length;
//int delta = subnotesCount / 2 - 1; // TODO
int delta = subnotesCount > 2 ? 1 : 0;
if ((subnotesCount & 1) == 0) { // if subnotesCount is even
delta--; // to exclude the subnotes that are in the "middle" between 2 real notes
}
delta = Math.max(delta, 0);
for (int i = 0; i < 12; i++) {
double temp = 0;
for (int j = -delta; j <= delta; j++) {
// account neighbors with lower weights
temp += pcp[(totalNotes + i * subnotesCount + j) % totalNotes];// * Math.pow(0.6, Math.abs(j));
}
pcp12[i] = temp;
}
return pcp12;
} else {
return Arrays.copyOf(pcp, pcp.length);
}
}
/**
* For the array of PCP vectors returns the array of 12-dimensional
* vectors obtained by applying {@link DataUtil.reduceTo12Notes(double[])}
* to each PCP vector
* @param data array of PCP vectors
* @return array of 12-dimensional vectors
*/
public static double[][] reduceTo12Notes(final double[][] data) {
if (data == null) {
throw new NullPointerException("data is null");
}
LOG.debug("Reducing to 12-dimensional vectors ...");
double[][] result = new double[data.length][];
for (int i = 0; i < data.length; i++) {
result[i] = reduceTo12Notes(data[i]);
}
return result;
}
/**
* Divides the input array sequentially into a set of regions, each
* consisting of <code>step</code> successive columns. Last region will
* consist of not much than <code>step</code> successive columns. Each
* column in resulting array is an arithmetic mean of the columns from
* the corresponding region.
* @param data An array of columns
* @param step Region size
* @return An array of columns
*/
public static double[][] shrink(final double[][] data, final int step) {
if (data == null) {
throw new NullPointerException("data is null");
}
LOG.debug("Shrinking the spectrum ...");
int resultLength = data.length / step;
if (data.length % step != 0) {
resultLength++;
}
double[][] result = new double[resultLength][];
for (int i = 0; i < data.length; i += step) {
int left = i;
// int right = Math.min(i + step / 2, data.length);
double[] temp = data[left];
// for (int col = left + 1; col < right; col++) {
// double c = (right - col) * 1.0 / (right - left);
// temp = add(temp, multiply(data[col], c));
// }
// temp = multiply(temp, 1.0 / (right - left));
result[i / step] = temp;
}
return result;
}
public static double[] toAllBeatTimes(final double[] framePositions, final int framesPerBeat) {
int resultLength = framePositions.length / framesPerBeat;
if (framePositions.length % framesPerBeat != 0) {
resultLength++;
}
double[] result = new double[resultLength + 1]; // for trailing timestamp
for (int i = 0; i < resultLength; i++) {
result[i] = framePositions[framesPerBeat * i];
}
double beatLength = result[1] - result[0];
double lastSound = result[result.length - 2] + beatLength;
result[result.length - 1] = lastSound;
return result;
}
/**
* For each pair of successive elements in an array inserts intermediate
* values evenly between them. The resulting array has length times * L - 1
* where L is the length of the array.
* @param array
* @param times
* @return
*/
public static double[] makeMoreFrequent(final double[] array, final int times) {
if (array == null) {
throw new NullPointerException("beatTimes is null");
}
LOG.debug("Creating the more frequent beat sequence ...");
int lastIndex = array.length - 1;
double[] result = new double[times * lastIndex + 1];
for (int i = 0; i < lastIndex; i++) {
double value = array[i];
double d = (array[i + 1] - array[i]) / times;
for (int j = 0; j < times; j++) {
result[times * i + j] = value;
value += d;
}
}
result[times * lastIndex] = array[lastIndex];
return result;
}
public static double[][] toLogSpectrum(final double[][] data, int eta) {
if (data == null) {
throw new NullPointerException("data is null");
}
LOG.debug("Calculating the log spectrum ...");
double[][] result = new double[data.length][];
for (int i = 0; i < data.length; i++) {
result[i] = new double[data[i].length];
for (int j = 0; j < data[i].length; j++) {
result[i][j] = Math.log10(1 + data[i][j] * eta);
}
}
return result;
}
public static double[][] whitenSpectrum(final double[][] data, final int octaveSize) {
if (data == null) {
throw new NullPointerException("data is null");
}
LOG.debug("Performing spectrum whitening ...");
double[][] result = new double[data.length][];
for (int i = 0; i < data.length; i++) {
result[i] = new double[data[i].length];
for (int j = 0; j < data[i].length; j++) {
int left = Math.max(0, j - octaveSize);
int right = Math.min(data[i].length - 1, j + octaveSize);
double sum = 0;
for (int k = left; k <= right; k++) {
sum += data[i][k];
}
double mean = sum / (right - left + 1);
double std = 0;
for (int k = left; k <= right; k++) {
std += (data[i][k] - mean) * (data[i][k] - mean);
}
std = Math.sqrt(std / (right - left));
result[i][j] = Math.max((data[i][j] - mean) / std, 0);
}
}
return result;
}
public static double[][] getSelfSimilarity(final double[][] spectrum) {
if (spectrum == null) {
throw new NullPointerException("spectrum is null");
}
LOG.debug("Calculating the self-similarity matrix ...");
int size = spectrum.length;
double[][] result = new double[size][];
for (int i = 0; i < size; i++) {
result[i] = new double[size];
}
EuclideanMetric metric = new EuclideanMetric();
for (int i = 0; i < size; i++) {
double[] v1 = spectrum[i];
for (int j = i; j < size; j++) {
double[] v2 = spectrum[j];
double d = metric.distance(v1, v2);
result[i][j] = d;
result[j][i] = d;
}
}
DataUtil.scaleTo01(result);
return result;
}
public static double[][] removeDissimilar(final double[][] selfSim, final double theta) {
if (selfSim == null) {
throw new NullPointerException("self similarity matrix is null");
}
LOG.debug("Removing similarity information for dissimilar elements ...");
int size = selfSim.length;
int preserved = (int) (size * theta);
double[][] result = new double[size][];
for (int i = 0; i < size; i++) {
result[i] = new double[size];
}
for (int i = 0; i < size; i++) {
double eps = findKthSmallest(selfSim[i], 0, size, preserved);
for (int j = 0; j < size; j++) {
double value = selfSim[i][j] < eps ? selfSim[i][j] : 1;
result[i][j] = value;
}
}
// if i similar to j, but j is not similar to j then they are dissimilar
for (int i = 0; i < size; i++) {
for (int j = i + 1; j < size; j++) {
if (result[i][j] == 1 && result[j][i] < 1) {
result[j][i] = 1;
} else if (result[i][j] < 1 && result[j][i] == 1) {
result[i][j] = 1;
}
}
}
return result;
}
public static double[][] smoothWithSelfSimilarity(final double[][] spectrum, final double[][] selfSimilarity) {
if (spectrum == null) {
throw new NullPointerException("spectrum is null");
}
if (selfSimilarity == null) {
throw new NullPointerException("Self-similarity matrix is null");
}
LOG.debug("Smoothing the spectrum with diagonal self-similarity matrix ...");
int size = spectrum.length;
double[][] result = new double[size][];
for (int i = 0; i < size; i++) {
double[] temp = new double[spectrum[i].length];
double sumOfWeights = 0;
for (int j = 0; j < size; j++) {
double weight = 1 - selfSimilarity[i][j];
// weight = weight * weight * weight;
temp = add(temp, multiply(spectrum[j], weight));
sumOfWeights += weight;
}
result[i] = multiply(temp, 1.0 / sumOfWeights);
}
scaleTo01(result);
return result;
}
private static double[][] getCheckerboard(final int size) {
double[][] result = new double[2 * size][2 * size];
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
result[i][j] = result[i + size][j + size] = -1;
result[i + size][j] = result[i][j + size] = 1;
}
}
double step = 2.0 / (2 * size - 1);
double part1 = Math.sqrt(1.0 / (2 * Math.PI));
for (int i = 0; i < 2 * size; i++) {
double xval = step * i - 1;
for (int j = 0; j < 2 * size; j++) {
double yval = step * j - 1;
double part2 = -0.5 * (xval * xval + yval * yval);
double gaussian = part1 * Math.exp(part2);
result[i][j] *= gaussian;
}
}
return result;
}
public static int[] getSelfSimBorders(double[][] selfsim) {
int size = 4;
double[][] cb = getCheckerboard(size);
List<Integer> resultList = new ArrayList<Integer>();
double[] temp = new double[selfsim.length];
for (int i = 0; i < selfsim.length; i++) {
int start = i - size;
int stop = i + size;
int cbStart = 0;
int cbStop = 2 * size;
if (i < size) {
cbStart = size - i;
cbStop = 2 * size;
start = 0;
stop = cbStop - cbStart;
} else if (i > selfsim.length - size) {
int d = selfsim.length - i;
cbStart = 0;
cbStop = size + d;
start = selfsim.length - cbStop;
stop = selfsim.length;
}
for (int j = 0; j < cbStop - cbStart; j++) {
for (int k = 0; k < cbStop - cbStart; k++) {
temp[i] += (selfsim[start + j][start + k] * cb[cbStart + j][cbStart + k]);
}
}
}
resultList.add(0);
for (int i = 1; i < temp.length; i++) {
if (i < temp.length - 1 && temp[i] >= temp[i - 1] && temp[i] > temp[i + 1]) {
resultList.add(i);
}
}
resultList.add(selfsim.length);
int[] result = new int[resultList.size()];
for (int i = 0; i < resultList.size(); i++) {
result[i] = resultList.get(i);
}
return result;
}
public static double[] getNochordness(final double[][] spectrum, int octaves) {
if (spectrum == null) {
throw new NullPointerException("spectrum is null");
}
double[] result = new double[spectrum.length];
int subnotes = spectrum[0].length / octaves / 12;
for (int i = 0; i < result.length; i++) {
double[] col = spectrum[i];
double max = 0;
double sum = 0;
double tonal = 0;
for (int j = 0; j < col.length; j++) {
if (Math.abs(col[j]) > max) { max = Math.abs(col[j]); }
sum += Math.abs(col[j]);
if (j % subnotes == 0) {
tonal += Math.abs(col[j]);
}
}
result[i] = (max / sum) * (tonal / sum);
}
double[] reResult = Arrays.copyOf(result, result.length);
int w = 2;
for (int i = w; i < result.length - w; i++) {
reResult[i] = findKthSmallest(result, i - w, i + w, w + 1);
}
return reResult;
}
public static double[] add(final double[] a1, final double[] a2) {
if (a1.length != a2.length) {
throw new IllegalArgumentException("Arrays have different lengths");
}
double[] result = new double[a1.length];
for (int i = 0; i < a1.length; i++) {
result[i] = a1[i] + a2[i];
}
return result;
}
public static double[] multiply(final double[] a, final double c) {
double[] result = new double[a.length];
if (c != 0) {
for (int i = 0; i < a.length; i++) {
result[i] = a[i] * c;
}
}
return result;
}
public static double[] sumVectors(final double[][] vectors, final int from, final int to) {
if (vectors == null) {
throw new NullPointerException("vectors is null");
}
if (from < 0 || to < 0 || from > to || to > vectors.length) {
throw new IllegalArgumentException("from = " + from + ", to = " + to);
}
double[] result = new double[vectors[0].length];
for (int i = from; i < to; i++) {
result = DataUtil.add(result, vectors[i]);
}
return result;
}
/**
* Modification of QSort
* @param a - array
* @param start - index of 1st element in the array (inclusive)
* @param end - index of last element in the array (exclusive)
* @param k - the order of value
* @return k-th smallest element in the given array
*/
public static double findKthSmallest(final double[] a, final int start, final int end, int k) {
int size = end - start;
double[] left = new double[size], right = new double[size];
int l = 0, r = 0;
double d = a[start + size / 2];
for (int i = start; i < end; i++) {
double v = a[i];
if (v < d) { left[l++] = v; }
else if (v > d) { right[r++] = v; }
}
if (k <= l && l > 0) {
return findKthSmallest(left, 0, l, k);
} else if (k > size - r && r > 0) {
return findKthSmallest(right, 0, r, k - (size - r));
} else {
return d;
}
}
public static double[] generateDefaultBeats(final String wavFilePath, double step) {
WaveFileInfo wfi = new WaveFileInfo(wavFilePath);
double totalSeconds = wfi.seconds;
int length = (int) (Math.floor(totalSeconds) / step);
double[] result = new double[length];
for (int i = 0; i < length; i++) {
result[i] = step * i;
}
return result;
}
}
| [
"nglazyrin@gmail.com"
] | nglazyrin@gmail.com |
18649045a76e378d94535d80f6cbab1ff89fd7c5 | 1ada7da2592298540261438d4a79702508eeedd0 | /surittec-desafio-back/src/main/java/com/surittec/desafio/repositoties/UserRepository.java | 0939c1f69e0afe4d6f4b4590f58398dbf6380260 | [] | no_license | ycc-blue/surittec-desafio | c2bed7f292ad8586131990469d89f0f05a1f6da7 | 1381c0f7d0aa9385ca8667b8d13e68b86ac374cf | refs/heads/main | 2023-01-03T00:12:52.160267 | 2020-10-24T00:27:12 | 2020-10-24T00:27:12 | 306,767,279 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.surittec.desafio.repositoties;
import com.surittec.desafio.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface UserRepository extends JpaRepository<User, Integer> {
User findByUsuarioContaining(String text);
}
| [
"yasmin_nim@hotmail.com"
] | yasmin_nim@hotmail.com |
05a14541615aa2c087d10edf26371cf7cb9903cc | 6dc5682bcd9572ceee8e4d56ad648cb7d8bd51ba | /문서/Thread/5/Family.java | 03c55146aaa684ac92d6371fce3a42f19480ec64 | [] | no_license | go88hoontops/Java-and-sql | 692e3b387f86987fd72ac99be36fe1d36d880d5f | 80b4f467d5dfd5b8372704a41c553fb56fbda6a5 | refs/heads/master | 2023-04-04T03:02:26.106709 | 2021-04-06T07:06:40 | 2021-04-06T07:06:40 | 355,087,149 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | // Thread 클래스를 상속받아 Thread를 정의함.
public class Family extends Thread {
Toilet toilet;
String who;
boolean key; // 초기값: false
// 생성자
public Family( String name, Toilet t ) {
who = name;
toilet = t;
}
public void run() {
toilet.openDoor( who, key );
}
} | [
"go88.hoon@gmail.com"
] | go88.hoon@gmail.com |
74058674c943e03a3e709eb9fac793d5dd12dffc | 4ff2bb025717c4c6dd766e789aa8211f54cb2ef1 | /MIPS/src/Simulator.java | c3c50ee6e77ec4c0ff25f121e7409df4a1c5c2bc | [] | no_license | MennaNader/MIPS | 53e652098b32f99a962dd68aadaa03357c639ccc | 5078a6a12b93666c671ab36780c24cc528f68810 | refs/heads/master | 2020-04-06T03:40:28.803510 | 2015-04-19T14:40:03 | 2015-04-19T14:40:03 | 34,209,308 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 139 | java |
public class Simulator {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"menna@192.168.1.5"
] | menna@192.168.1.5 |
df5ffae47d44d79b4f5f1ec635d86ae7a7dfe741 | bfb6a5acf730838bb22bd827928055763d350263 | /app/src/main/java/com/iris/cada/adapter/ReportShangPaiAdapter.java | 3fac68227520103504ba2ba016bb825e93d07097 | [] | no_license | sunshaochi/Aodi | cb497b5c80596f7c084a51fc6cb2b0dd3ddaecf9 | 1bfaa160413b56a6dec22696d9fb44a612ca4899 | refs/heads/master | 2020-03-17T16:52:38.196952 | 2018-05-17T06:10:09 | 2018-05-17T06:10:09 | 133,765,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,446 | java | package com.iris.cada.adapter;
import java.util.List;
import com.iris.cada.ProfitApplication;
import com.iris.cada.entity.IViewProfitReport;
import com.iris.cada.utils.CommonAdapter;
import com.iris.cada.utils.StringUtils;
import com.iris.cada.R;
import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
public class ReportShangPaiAdapter extends CommonAdapter<IViewProfitReport>{
private Context context;
private List<IViewProfitReport> datas;
public ReportShangPaiAdapter(Context context, List<IViewProfitReport> datas) {
super(context, datas);
this.context = context;
this.datas = datas;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (convertView == null) {
viewHolder = new ViewHolder();
convertView = LayoutInflater.from(context).inflate(R.layout.item_report_shang_pai, null);
viewHolder.salesconsultant = (TextView) convertView.findViewById(R.id.item_shang_pai_name);
viewHolder.Turnover = (TextView) convertView.findViewById(R.id.item_shang_pai_name1);
viewHolder.shangPaiCount = (TextView) convertView.findViewById(R.id.item_shang_pai_name2);//上牌数
viewHolder.shangPaiShenTouRate = (TextView) convertView.findViewById(R.id.item_shang_pai_name3);//渗透率
viewHolder.shangPaiTotalMaoLi = (TextView) convertView.findViewById(R.id.item_shang_pai_name4);//总毛利
viewHolder.shangPaiMaoLiRate = (TextView) convertView.findViewById(R.id.item_shang_pai_name5);//毛利率
viewHolder.oneShangPaiMaoLi = (TextView) convertView.findViewById(R.id.item_shang_pai_name6);//单车上牌毛利
viewHolder.ll_item=(LinearLayout) convertView.findViewById(R.id.item_shang_pai_linner);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
if (!ProfitApplication.isConsultantMode) {
viewHolder.salesconsultant.setText(datas.get(position).getModels());
}else {
viewHolder.salesconsultant.setText(datas.get(position).getSalesconsultant());
}
viewHolder.Turnover.setText(datas.get(position).getTurnover());
viewHolder.shangPaiCount.setText(datas.get(position).getOnCardSaleNum());
viewHolder.shangPaiShenTouRate.setText(datas.get(position).getOnCardPermeaterate()+"%");
viewHolder.shangPaiTotalMaoLi.setText(StringUtils.intDivTo0(datas.get(position).getOnCardTotalProfit()));
viewHolder.shangPaiMaoLiRate.setText(StringUtils.nullTo0(datas.get(position).getOnCardGrossrate())+"%");
viewHolder.oneShangPaiMaoLi.setText(StringUtils.intDivTo0(datas.get(position).getAvgOnCardGross()));
if(position%2==0){
viewHolder.ll_item.setBackgroundColor(Color.parseColor("#ffffff"));
}else {
viewHolder.ll_item.setBackgroundColor(Color.parseColor("#ebebeb"));
}
return convertView;
}
private static class ViewHolder {
// 销售顾问
private TextView salesconsultant;
// 车系
private TextView models;
// 总交车数
private TextView Turnover;
//上牌数
private TextView shangPaiCount;
//上牌渗透率
private TextView shangPaiShenTouRate;
//上牌总毛利
private TextView shangPaiTotalMaoLi;
//上牌毛利率
private TextView shangPaiMaoLiRate;
//单车上牌毛利
private TextView oneShangPaiMaoLi;
private LinearLayout ll_item;
}
}
| [
"673132032@qq.com"
] | 673132032@qq.com |
d75c897f9786a29a5e5e155694b9bbef2233c885 | c5e29e350dd2f380c3e77d81bb422dd8009bf71b | /src/util/Utils.java | 39cc515849fa5095b540b3e728e51956dbb6aab9 | [] | no_license | Paketche/File-system | e34673cb69dfa5c30ca4e5167d512dc3aac39daa | 24c0a84ca150c31ffa6025e220e099964e9f2f4f | refs/heads/master | 2021-03-27T19:54:27.098134 | 2018-05-22T23:47:12 | 2018-05-22T23:47:12 | 111,545,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,720 | java | package util;
public class Utils {
/**
*
* @param hex
* @return
*/
public static byte[] HexStringTobyteArray(String hex) {
byte[] byteArray = new byte[hex.length() - 2];
for (int i = 2; i < hex.length(); i++) {
byteArray[i - 2] = HexCharTobyte(hex.charAt(i));
}
return byteArray;
}
public static String byteArrayToHexString(byte[] num) {
String hex = "";
for (int i = 0; i < num.length; i++) {
hex = hex + byteToHexChar(num[i]);
}
return hex;
}
public static String byteArrayToASCIIString(byte[] num) {
String string = "";
for (int i = 0; i < num.length; i++) {
string += (char) (num[i] & 0xff);
}
return string;
}
public static byte HexCharTobyte(char hex) {
if (hex >= '0' && hex <= '9') {
return (byte) (hex - '0');
}
else if (hex >= 'A' && hex <= 'F') {
return (byte) (hex - 'A' + 10);
}
else {
return -1;
}
}
public static char byteToHexChar(byte _byte) {
if (_byte >= 0 && _byte <= 9) {
return (char) ('0' + _byte);
}
else if (_byte >= 10 && _byte <= 15) {
return (char) ('A' + _byte - 10);
}
return ' ';
}
public static int byteArrayToInt(byte[] num) {
int number = num[0] & 0xff;
for (int i = 1; i < num.length; i++) {
number += (int) ((num[i] & 0xff) * Math.pow(2, 4 * (i + 1)));
}
return number;
}
public static byte[] intToByteArray(int num) {
String hex = "0x" + Integer.toHexString(num);
return HexStringTobyteArray(hex);
}
public static int ComparebyteArrays(byte[] num, byte[] num2) {
byte[] bigger = (Math.max(num.length, num2.length) == num.length) ? num.clone() : num2.clone();
byte[] smaller = (Math.max(num.length, num2.length) == num.length) ? num2.clone() : num.clone();
for (int big = bigger.length - 1, small = smaller.length - 1; small >= 0; big--, small--) {
byte temp = (byte) (bigger[big] - smaller[small]);
if (temp != 0) {
return temp / Math.abs(temp);
}
}
return 0;
}
public static byte[] RigthLogicalShift(byte[] num, int shifts) {
if (shifts == 0)
return num;
else {
byte shifted = 0;
for (int i = 0; i < num.length; i++) {
byte toBeshifted = (byte) (num[i] & 0x1);
num[i] = (byte) ((num[i] >> 1) + shifted * 8);
shifted = toBeshifted;
}
return RigthLogicalShift(num, shifts - 1);
}
}
public static byte[] LeftLogicalShift(byte[] num, int shifts) {
if (shifts == 0)
return num;
else {
byte shifted = 0;
for (int i = num.length - 1; i >= 0; i--) {
byte toBeshifted = (byte) (num[i] & 0x8);
num[i] = (byte) ((num[i] << 1) + shifted);
shifted = toBeshifted;
}
return LeftLogicalShift(num, shifts - 1);
}
}
public static byte[] LogicalAND(byte[] num, byte[] num2) {
byte[] bigger = (Math.max(num.length, num2.length) == num.length) ? num.clone() : num2.clone();
byte[] smaller = (Math.max(num.length, num2.length) == num.length) ? num2.clone() : num.clone();
for (int big = bigger.length - 1, small = smaller.length - 1; small >= 0; big--, small--) {
bigger[big] = (byte) (bigger[big] & smaller[small]);
}
return bigger;
}
public static byte[] LogicalOR(byte[] num, byte[] num2) {
byte[] bigger = (Math.max(num.length, num2.length) == num.length) ? num.clone() : num2.clone();
byte[] smaller = (Math.max(num.length, num2.length) == num.length) ? num2.clone() : num.clone();
for (int big = bigger.length - 1, small = smaller.length - 1; small >= 0; big--, small--) {
bigger[big] = (byte) (bigger[big] | smaller[small]);
}
return bigger;
}
public static boolean isPowerOf(int a, int b) {
while (a % b == 0) {
a /= b;
}
return a == 1;
}
/**
* Prints out a byte array in a readable hexadecimal format
* @param data to be printed
*/
public static void dumpHexRepresnetation(byte[] data) {
for (int i = 0; i < data.length; i += 16) {
int j;
for (j = 0; j < 16 && i + j < data.length; j++) {
System.out.format("%02x %s", data[j + i], (j + 1) % 8 == 0 ? "| " : " ");
}
while (j < 16) {
System.out.print("XX " + ((j + 1) % 8 == 0 ? "| " : " "));
j++;
}
for (j = 0; j < 16 && i + j < data.length; j++) {
if (data[j + i] > 32 && data[j + i] < 127)
System.out.format("%c%s", (char) data[j + i], (j + 1) % 8 == 0 ? "| " : "");
else
System.out.print("_" + ((j + 1) % 8 == 0 ? "| " : ""));
}
while (j < 16) {
System.out.print("X"+((j + 1) % 8 == 0 ? "| " : ""));
j++;
}
System.out.println();
}
System.out.println("---------------------------------------------------");
}
public static void main(String[] args) {
System.out.println(Integer.toHexString(1000));
System.out.println(RigthLogicalShift(HexStringTobyteArray("0x1F"), 1));
}
}
| [
"g.valchanov@lancaster.ac.uk"
] | g.valchanov@lancaster.ac.uk |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.