blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f80ceb94793f257425130411992e939ba16978b7 | fb3b083a2fdb401a3feebf8b4ad673ccdc76d07b | /clever-canal-dbsync/src/main/java/org/clever/canal/parse/dbsync/binlog/JsonConversion.java | c1e0484804c6bfe32e78a522e44e194d53b076e3 | [
"MIT"
] | permissive | Lzw2016/clever-canal | 85ce0d25b550e112475de1bc9966490407e7be79 | a6a317abeb7792a4fb5fc56bcbcd61ee19b80441 | refs/heads/master | 2022-10-09T22:07:23.136857 | 2021-05-27T02:35:40 | 2021-05-27T02:35:40 | 217,486,047 | 0 | 0 | MIT | 2022-10-04T23:55:08 | 2019-10-25T08:17:19 | Java | UTF-8 | Java | false | false | 19,767 | java | package org.clever.canal.parse.dbsync.binlog;
import static org.clever.canal.parse.dbsync.binlog.event.RowsLogBuffer.*;
/**
* 处理下MySQL json二进制转化为可读的字符串
*/
@SuppressWarnings({"WeakerAccess", "unused", "DuplicatedCode"})
public class JsonConversion {
// JSON TYPE
public static final int JSONB_TYPE_SMALL_OBJECT = 0x0;
public static final int JSONB_TYPE_LARGE_OBJECT = 0x1;
public static final int JSONB_TYPE_SMALL_ARRAY = 0x2;
public static final int JSONB_TYPE_LARGE_ARRAY = 0x3;
public static final int JSONB_TYPE_LITERAL = 0x4;
public static final int JSONB_TYPE_INT16 = 0x5;
public static final int JSONB_TYPE_UINT16 = 0x6;
public static final int JSONB_TYPE_INT32 = 0x7;
public static final int JSONB_TYPE_UINT32 = 0x8;
public static final int JSONB_TYPE_INT64 = 0x9;
public static final int JSONB_TYPE_UINT64 = 0xA;
public static final int JSONB_TYPE_DOUBLE = 0xB;
public static final int JSONB_TYPE_STRING = 0xC;
public static final int JSONB_TYPE_OPAQUE = 0xF;
public static final char JSONB_NULL_LITERAL = '\0';
public static final char JSONB_TRUE_LITERAL = '\1';
public static final char JSONB_FALSE_LITERAL = '\2';
/*
* The size of offset or size fields in the small and the large storage
* format for JSON objects and JSON arrays.
*/
public static final int SMALL_OFFSET_SIZE = 2;
public static final int LARGE_OFFSET_SIZE = 4;
/*
* The size of key entries for objects when using the small storage format
* or the large storage format. In the small format it is 4 bytes (2 bytes
* for key length and 2 bytes for key offset). In the large format it is 6
* (2 bytes for length, 4 bytes for offset).
*/
public static final int KEY_ENTRY_SIZE_SMALL = (2 + SMALL_OFFSET_SIZE);
public static final int KEY_ENTRY_SIZE_LARGE = (2 + LARGE_OFFSET_SIZE);
/*
* The size of value entries for objects or arrays. When using the small
* storage format, the entry size is 3 (1 byte for type, 2 bytes for
* offset). When using the large storage format, it is 5 (1 byte for type, 4
* bytes for offset).
*/
public static final int VALUE_ENTRY_SIZE_SMALL = (1 + SMALL_OFFSET_SIZE);
public static final int VALUE_ENTRY_SIZE_LARGE = (1 + LARGE_OFFSET_SIZE);
public static Json_Value parse_value(int type, LogBuffer buffer, long len, String charsetName) {
buffer = buffer.duplicate(buffer.position(), (int) len);
switch (type) {
case JSONB_TYPE_SMALL_OBJECT:
return parse_array_or_object(Json_enum_type.OBJECT, buffer, len, false, charsetName);
case JSONB_TYPE_LARGE_OBJECT:
return parse_array_or_object(Json_enum_type.OBJECT, buffer, len, true, charsetName);
case JSONB_TYPE_SMALL_ARRAY:
return parse_array_or_object(Json_enum_type.ARRAY, buffer, len, false, charsetName);
case JSONB_TYPE_LARGE_ARRAY:
return parse_array_or_object(Json_enum_type.ARRAY, buffer, len, true, charsetName);
default:
return parse_scalar(type, buffer, len, charsetName);
}
}
private static Json_Value parse_array_or_object(Json_enum_type type, LogBuffer buffer, long len, boolean large, String charsetName) {
long offset_size = large ? LARGE_OFFSET_SIZE : SMALL_OFFSET_SIZE;
if (len < 2 * offset_size) {
throw new IllegalArgumentException("illegal json data");
}
long element_count = read_offset_or_size(buffer, large);
long bytes = read_offset_or_size(buffer, large);
if (bytes > len) {
throw new IllegalArgumentException("illegal json data");
}
long header_size = 2 * offset_size;
if (type == Json_enum_type.OBJECT) {
header_size += element_count * (large ? KEY_ENTRY_SIZE_LARGE : KEY_ENTRY_SIZE_SMALL);
}
header_size += element_count * (large ? VALUE_ENTRY_SIZE_LARGE : VALUE_ENTRY_SIZE_SMALL);
if (header_size > bytes) {
throw new IllegalArgumentException("illegal json data");
}
return new Json_Value(type, buffer.rewind(), element_count, bytes, large);
}
private static long read_offset_or_size(LogBuffer buffer, boolean large) {
return large ? buffer.getUint32() : buffer.getUint16();
}
private static Json_Value parse_scalar(int type, LogBuffer buffer, long len, String charsetName) {
switch (type) {
case JSONB_TYPE_LITERAL:
/* purecov: inspected */
int data = buffer.getUint8();
switch (data) {
case JSONB_NULL_LITERAL:
return new Json_Value(Json_enum_type.LITERAL_NULL);
case JSONB_TRUE_LITERAL:
return new Json_Value(Json_enum_type.LITERAL_TRUE);
case JSONB_FALSE_LITERAL:
return new Json_Value(Json_enum_type.LITERAL_FALSE);
default:
throw new IllegalArgumentException("illegal json data");
}
case JSONB_TYPE_INT16:
return new Json_Value(Json_enum_type.INT, buffer.getInt16());
case JSONB_TYPE_INT32:
return new Json_Value(Json_enum_type.INT, buffer.getInt32());
case JSONB_TYPE_INT64:
return new Json_Value(Json_enum_type.INT, buffer.getLong64());
case JSONB_TYPE_UINT16:
return new Json_Value(Json_enum_type.UINT, buffer.getUint16());
case JSONB_TYPE_UINT32:
return new Json_Value(Json_enum_type.UINT, buffer.getUint32());
case JSONB_TYPE_UINT64:
return new Json_Value(Json_enum_type.UINT, buffer.getUlong64());
case JSONB_TYPE_DOUBLE:
return new Json_Value(Json_enum_type.DOUBLE, buffer.getDouble64());
case JSONB_TYPE_STRING:
int max_bytes = (int) Math.min(len, 5);
long tlen = 0;
long str_len = 0;
long n = 0;
byte[] datas = buffer.getData(max_bytes);
for (int i = 0; i < max_bytes; i++) {
// Get the next 7 bits of the length.
tlen |= (datas[i] & 0x7f) << (7 * i);
if ((datas[i] & 0x80) == 0) {
// The length shouldn't exceed 32 bits.
if (tlen > 4294967296L) {
throw new IllegalArgumentException("illegal json data");
}
// This was the last byte. Return successfully.
n = i + 1;
str_len = tlen;
break;
}
}
if (len < n + str_len) {
throw new IllegalArgumentException("illegal json data");
}
return new Json_Value(Json_enum_type.STRING, buffer.rewind()
.forward((int) n)
.getFixString((int) str_len, charsetName));
case JSONB_TYPE_OPAQUE:
/*
* There should always be at least one byte, which tells the
* field type of the opaque value.
*/
// The type is encoded as a uint8 that maps to an
// enum_field_types.
int type_byte = buffer.getUint8();
int position = buffer.position();
// Then there's the length of the value.
int q_max_bytes = (int) Math.min(len, 5);
long q_tlen = 0;
long q_str_len = 0;
long q_n = 0;
byte[] q_datas = buffer.getData(q_max_bytes);
for (int i = 0; i < q_max_bytes; i++) {
// Get the next 7 bits of the length.
q_tlen |= (q_datas[i] & 0x7f) << (7 * i);
if ((q_datas[i] & 0x80) == 0) {
// The length shouldn't exceed 32 bits.
if (q_tlen > 4294967296L) {
throw new IllegalArgumentException("illegal json data");
}
// This was the last byte. Return successfully.
q_n = i + 1;
q_str_len = q_tlen;
break;
}
}
if (q_str_len == 0 || len < q_n + q_str_len) {
throw new IllegalArgumentException("illegal json data");
}
return new Json_Value(type_byte, buffer.position(position).forward((int) q_n), q_str_len);
default:
throw new IllegalArgumentException("illegal json data");
}
}
@SuppressWarnings("UnusedReturnValue")
public static class Json_Value {
Json_enum_type m_type;
int m_field_type;
LogBuffer m_data;
long m_element_count;
long m_length;
String m_string_value;
Number m_int_value;
double m_double_value;
boolean m_large;
public Json_Value(Json_enum_type t) {
this.m_type = t;
}
public Json_Value(Json_enum_type t, Number val) {
this.m_type = t;
if (t == Json_enum_type.DOUBLE) {
this.m_double_value = val.doubleValue();
} else {
this.m_int_value = val;
}
}
public Json_Value(Json_enum_type t, String value) {
this.m_type = t;
this.m_string_value = value;
}
public Json_Value(int field_type, LogBuffer data, long bytes) {
this.m_type = Json_enum_type.OPAQUE; // 不确定类型
this.m_field_type = field_type;
this.m_data = data;
this.m_length = bytes;
}
public Json_Value(Json_enum_type t, LogBuffer data, long element_count, long bytes, boolean large) {
this.m_type = t;
this.m_data = data;
this.m_element_count = element_count;
this.m_length = bytes;
this.m_large = large;
}
public String key(int i, String charsetName) {
m_data.rewind();
int offset_size = m_large ? LARGE_OFFSET_SIZE : SMALL_OFFSET_SIZE;
int key_entry_size = m_large ? KEY_ENTRY_SIZE_LARGE : KEY_ENTRY_SIZE_SMALL;
int entry_offset = 2 * offset_size + key_entry_size * i;
// The offset of the key is the first part of the key
// entry.
m_data.forward(entry_offset);
long key_offset = read_offset_or_size(m_data, m_large);
// The length of the key is the second part of the
// entry, always two
// bytes.
long key_length = m_data.getUint16();
return m_data.rewind().forward((int) key_offset).getFixString((int) key_length, charsetName);
}
public Json_Value element(int i, String charsetName) {
m_data.rewind();
int offset_size = m_large ? LARGE_OFFSET_SIZE : SMALL_OFFSET_SIZE;
int key_entry_size = m_large ? KEY_ENTRY_SIZE_LARGE : KEY_ENTRY_SIZE_SMALL;
int value_entry_size = m_large ? VALUE_ENTRY_SIZE_LARGE : VALUE_ENTRY_SIZE_SMALL;
int first_entry_offset = 2 * offset_size;
if (m_type == Json_enum_type.OBJECT) {
first_entry_offset += m_element_count * key_entry_size;
}
int entry_offset = first_entry_offset + value_entry_size * i;
int type = m_data.forward(entry_offset).getUint8();
if (type == JSONB_TYPE_INT16 || type == JSONB_TYPE_UINT16 || type == JSONB_TYPE_LITERAL || (m_large && (type == JSONB_TYPE_INT32 || type == JSONB_TYPE_UINT32))) {
return parse_scalar(type, m_data, value_entry_size - 1, charsetName);
}
int value_offset = (int) read_offset_or_size(m_data, m_large);
return parse_value(type, m_data.rewind().forward(value_offset), (int) m_length - value_offset, charsetName);
}
@SuppressWarnings("DuplicateBranchesInSwitch")
public StringBuilder toJsonString(StringBuilder buf, String charsetName) {
switch (m_type) {
case OBJECT:
buf.append("{");
for (int i = 0; i < m_element_count; ++i) {
if (i > 0) {
buf.append(", ");
}
buf.append('"').append(key(i, charsetName)).append('"');
buf.append(": ");
element(i, charsetName).toJsonString(buf, charsetName);
}
buf.append("}");
break;
case ARRAY:
buf.append("[");
for (int i = 0; i < m_element_count; ++i) {
if (i > 0) {
buf.append(", ");
}
element(i, charsetName).toJsonString(buf, charsetName);
}
buf.append("]");
break;
case DOUBLE:
buf.append(Double.valueOf(m_double_value).toString());
break;
case INT:
buf.append(m_int_value.toString());
break;
case UINT:
buf.append(m_int_value.toString());
break;
case LITERAL_FALSE:
buf.append("false");
break;
case LITERAL_TRUE:
buf.append("true");
break;
case LITERAL_NULL:
buf.append("null");
break;
case OPAQUE:
String text;
if (m_field_type == LogEvent.MYSQL_TYPE_NEWDECIMAL) {
int precision = m_data.getInt8();
int scale = m_data.getInt8();
text = m_data.getDecimal(precision, scale).toPlainString();
buf.append(text);
} else if (m_field_type == LogEvent.MYSQL_TYPE_TIME) {
long packed_value = m_data.getLong64();
if (packed_value == 0) {
text = "00:00:00";
} else {
long ultime = Math.abs(packed_value);
long intpart = ultime >> 24;
int frac = (int) (ultime % (1L << 24));
// text = String.format("%s%02d:%02d:%02d",
// packed_value >= 0 ? "" : "-",
// (int) ((intpart >> 12) % (1 << 10)),
// (int) ((intpart >> 6) % (1 << 6)),
// (int) (intpart % (1 << 6)));
// text = text + "." + usecondsToStr(frac, 6);
StringBuilder builder = new StringBuilder(17);
if (packed_value < 0) {
builder.append('-');
}
int d = (int) ((intpart >> 12) % (1 << 10));
if (d > 100) {
builder.append(d);
} else {
appendNumber2(builder, d);
}
builder.append(':');
appendNumber2(builder, (int) ((intpart >> 6) % (1 << 6)));
builder.append(':');
appendNumber2(builder, (int) (intpart % (1 << 6)));
builder.append('.').append(usecondsToStr(frac, 6));
text = builder.toString();
}
buf.append('"').append(text).append('"');
} else if (m_field_type == LogEvent.MYSQL_TYPE_DATE || m_field_type == LogEvent.MYSQL_TYPE_DATETIME
|| m_field_type == LogEvent.MYSQL_TYPE_TIMESTAMP) {
long packed_value = m_data.getLong64();
if (packed_value == 0) {
text = "0000-00-00 00:00:00";
} else {
// 构造TimeStamp只处理到秒
long ultime = Math.abs(packed_value);
long intpart = ultime >> 24;
int frac = (int) (ultime % (1L << 24));
long ymd = intpart >> 17;
long ym = ymd >> 5;
long hms = intpart % (1 << 17);
// text =
// String.format("%04d-%02d-%02d %02d:%02d:%02d",
// (int) (ym / 13),
// (int) (ym % 13),
// (int) (ymd % (1 << 5)),
// (int) (hms >> 12),
// (int) ((hms >> 6) % (1 << 6)),
// (int) (hms % (1 << 6)));
StringBuilder builder = new StringBuilder(26);
appendNumber4(builder, (int) (ym / 13));
builder.append('-');
appendNumber2(builder, (int) (ym % 13));
builder.append('-');
appendNumber2(builder, (int) (ymd % (1 << 5)));
builder.append(' ');
appendNumber2(builder, (int) (hms >> 12));
builder.append(':');
appendNumber2(builder, (int) ((hms >> 6) % (1 << 6)));
builder.append(':');
appendNumber2(builder, (int) (hms % (1 << 6)));
builder.append('.').append(usecondsToStr(frac, 6));
text = builder.toString();
}
buf.append('"').append(text).append('"');
} else {
text = m_data.getFixString((int) m_length, charsetName);
buf.append('"').append(escapse(text)).append('"');
}
break;
case STRING:
buf.append('"').append(escapse(m_string_value)).append('"');
break;
case ERROR:
throw new IllegalArgumentException("illegal json data");
}
return buf;
}
}
private static StringBuilder escapse(String data) {
StringBuilder sb = new StringBuilder(data.length());
int endIndex = data.length();
for (int i = 0; i < endIndex; ++i) {
char c = data.charAt(i);
if (c == '"') {
sb.append('\\');
} else if (c == '\\') {
sb.append("\\");
}
sb.append(c);
}
return sb;
}
@SuppressWarnings("UnnecessaryEnumModifier")
public static enum Json_enum_type {
OBJECT, ARRAY, STRING, INT, UINT, DOUBLE, LITERAL_NULL, LITERAL_TRUE, LITERAL_FALSE, OPAQUE, ERROR
}
}
| [
"lzw1000000@163.com"
] | lzw1000000@163.com |
3c4aeca8b85617a5b7a28c6187985098ce3ab148 | b773b58ec793790f9a548ddf2000202dfcf83097 | /app/src/main/java/com/example/saifullah_albasrie/pnm/model/ProspekKontakModel.java | 269937780a0e5d580a5c85fa14e5ac5d686835a9 | [] | no_license | poonix/pnm-src | de446683853a5ab83566c8530ff2a8e922ba062a | 5ea07a25981d2dc884637e3654fc23d184cab6ab | refs/heads/master | 2021-05-11T12:19:02.376258 | 2018-01-24T16:46:27 | 2018-01-24T16:46:27 | 117,210,397 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,904 | java | package com.example.saifullah_albasrie.pnm.model;
import android.os.Parcel;
import android.os.Parcelable;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
/**
* Created by saifullahalbasrie on 4/2/17.
*/
public class ProspekKontakModel implements Parcelable{
/*
"kontak": [
{
"id": 1,
"nomor_telp": "0218441437",
"jenis_telp": null
}
*/
@SerializedName("id")
@Expose
private int id;
@SerializedName("nomor_telp")
@Expose
private String nomorTelp;
@SerializedName("jenis_telp")
@Expose
private String jenisTelp;
public ProspekKontakModel() {
}
protected ProspekKontakModel(Parcel in) {
id = in.readInt();
nomorTelp = in.readString();
jenisTelp = in.readString();
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeInt(id);
dest.writeString(nomorTelp);
dest.writeString(jenisTelp);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<ProspekKontakModel> CREATOR = new Creator<ProspekKontakModel>() {
@Override
public ProspekKontakModel createFromParcel(Parcel in) {
return new ProspekKontakModel(in);
}
@Override
public ProspekKontakModel[] newArray(int size) {
return new ProspekKontakModel[size];
}
};
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNomorTelp() {
return nomorTelp;
}
public void setNomorTelp(String nomorTelp) {
this.nomorTelp = nomorTelp;
}
public String getJenisTelp() {
return jenisTelp;
}
public void setJenisTelp(String jenisTelp) {
this.jenisTelp = jenisTelp;
}
}
| [
"poonix27@gmail.com"
] | poonix27@gmail.com |
ce4e66d63e5fd76c266598a81dd25bb4e611f79c | 23c8758e6e1222a47fb7bf39f0f6e068d174127b | /src/main/dataset/serializer/SequenceSerializer.java | f13caf408f3e568ba570eca86cbca5aca900eebd | [] | no_license | FrLdy/SPADE | 4fd7bc7a4551ee6c06bd3abcce110fbe0d2e1ee6 | 5b079bc8bda52fe587abcb67ce066994200ccba1 | refs/heads/master | 2023-03-12T15:59:02.440921 | 2021-02-28T18:27:28 | 2021-02-28T18:27:28 | 292,837,117 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 479 | java | package main.dataset.serializer;
import main.dataset.Dataset;
import main.pattern.Itemset;
import main.pattern.Sequence;
public abstract class SequenceSerializer<S extends Sequence, T extends Comparable<? super T>> extends Serializer<S>{
/**
* General constructor.
*
* @param path the path of the data file.
*/
protected SequenceSerializer(String path) {
super(path);
}
public abstract String itemsetToString(Itemset<T> itemset);
}
| [
"ledoyenfrancois@gmail.com"
] | ledoyenfrancois@gmail.com |
ac3a50be173afebf77e1954140c59bb9f6c2cde3 | 7ec8785adaf59223e63166ee3c3c89ed189d42df | /src/main/java/com/example/demo/frontend/backend/impl/FrontendChannels.java | 07812c2c3b21f3059e7d5b28b970d973d847cb03 | [] | no_license | jdutreve/integrated-microservices | 20758d33bfcd87b35fbedf4d066402ab3e877ff1 | b40ea3fcec563b147ee7c761c4b4268b3e3fb7f5 | refs/heads/master | 2023-06-22T00:54:01.112878 | 2021-07-23T10:48:06 | 2021-07-23T10:48:06 | 388,456,364 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.example.demo.frontend.backend.impl;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.SubscribableChannel;
@SuppressWarnings("ALL")
public interface FrontendChannels {
String FRONTEND_IN = "frontendIn";
@Input
SubscribableChannel frontendIn();
@Output
MessageChannel frontendOut();
} | [
"jduSRV2502"
] | jduSRV2502 |
2dc2ec71f44cd9e21689139d2bb877808080792b | c88a58be36db45faa3fe5f7a11ef3dbcf58c1c5c | /src/main/java/com/zdevzone/tools/rankings/RedisRankings.java | 73295318cbc0c437384cec35bfe9ae5a0fa15da0 | [] | no_license | zhengweibao/dev-tools | da98483b494f1acba943a01851adf4bfb4984980 | cf3c88a87f99244d493bcbcd53a817bb7669a763 | refs/heads/master | 2021-09-09T19:52:30.304325 | 2018-03-19T10:16:56 | 2018-03-19T10:16:56 | 125,365,960 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,263 | java | package com.zdevzone.tools.rankings;
import org.springframework.util.Assert;
import java.time.Instant;
/**
* 榜单
*
* @author zhengcanlai
*/
public class RedisRankings implements Rankings{
private static final String HASH_TAG_PREFIX_FORMAT = "{%s}:";
/**
* 榜单名
*/
private String name;
/**
* 榜单过期时间
*/
private Instant expTime;
/**
* 关联Id,归类标识,非空
*/
private String relatedId;
public RedisRankings() {
}
public RedisRankings(String name, Instant expTime, String relatedId) {
Assert.hasText(name, "The name cannot be empty!");
Assert.hasText(relatedId, "The relatedId cannot be empty!");
this.name = name;
this.expTime = expTime;
this.relatedId = relatedId;
}
@Override
public String getName() {
Assert.hasText(relatedId, "The relatedId cannot be empty!");
return String.format(HASH_TAG_PREFIX_FORMAT, relatedId) + name;
}
public void setName(String name) {
this.name = name;
}
@Override
public Instant getExpTime() {
return expTime;
}
public void setExpTime(Instant expTime) {
this.expTime = expTime;
}
@Override
public String getRelatedId() {
return relatedId;
}
public void setRelatedId(String relatedId) {
this.relatedId = relatedId;
}
}
| [
"zhengweibao@gomo.com"
] | zhengweibao@gomo.com |
c9acae0c23bc8e869d7f0f0660bfa4b6e77f3258 | e004af47f33cde6aade42e94699076b673c80ede | /src/main/java/com/osf/trans/service/impl/CodeServiceImpl.java | 0f2e2509f17753e58fe72eff60672efdca9d5fcf | [] | no_license | jkj113/translateAPI | 77baef0cde16504a0d829ced5a2a825464a06bb4 | 4d79b877d4cbc7d639b49850c1d258c8a31bca83 | refs/heads/master | 2022-12-22T08:59:51.502597 | 2019-07-26T01:12:03 | 2019-07-26T01:12:03 | 198,667,046 | 0 | 0 | null | 2022-12-16T08:32:11 | 2019-07-24T15:56:21 | Java | UTF-8 | Java | false | false | 604 | java | package com.osf.trans.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.osf.trans.mapper.CodeMapper;
import com.osf.trans.service.CodeService;
import com.osf.trans.vo.CodeVO;
@Service
public class CodeServiceImpl implements CodeService {
@Resource
private CodeMapper cm;
@Override
public List<CodeVO> getCodeList() {
return cm.getCodeList();
}
@Override
public String getCodeByCode(Integer codeNum) {
CodeVO cvo = cm.getCodeByCode(codeNum);
return cvo.getCodeCode();
}
}
| [
"kumjoo_92@naver.com"
] | kumjoo_92@naver.com |
fa2864d0a029704d8c5f1fbfb7301f1ff6947fab | 2a4747e573b0bccf5e0b28042e20435d3647064d | /src/main/java/com/manish/config/model/Menu.java | fbf358f6ec007ea75172acf2e169edd6f9ed0a19 | [] | no_license | manishganta/Task-02012019 | 6894b6e5e2432eebf156a62e30dc8be922b795cd | 5de09422e7cf446f898fdd2f4dbb751e10e6b232 | refs/heads/master | 2022-01-21T18:42:46.070129 | 2019-07-22T03:03:28 | 2019-07-22T03:03:28 | 198,136,528 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.manish.config.model;
public class Menu {
private String name;
private String path;
private String title;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "Menu{" +
"name='" + name + '\'' +
", path='" + path + '\'' +
", title='" + title + '\'' +
'}';
}
}
| [
"noreply@github.com"
] | manishganta.noreply@github.com |
9a43286d2fab74ae9a0d534f93af4871f93f521b | b4c6a6e5ba3d362262709c2b6b16aab07bf3f53f | /manager-portal/src/main/java/com/mctpay/manager/model/entity/template/ShowPictureEntity.java | 6bf7f95a991db42155194ad5237c32003cb74e39 | [] | no_license | lrlfriend1975/mctpay | 794c464e2ef8f4a60520476ccd09891a7b3384cf | 69933a4f6f46c07f7554802076975af3725bae0c | refs/heads/master | 2022-11-18T23:46:09.573866 | 2020-07-13T00:31:27 | 2020-07-13T00:31:27 | 295,123,117 | 0 | 1 | null | 2020-09-13T09:59:00 | 2020-09-13T09:59:00 | null | UTF-8 | Java | false | false | 939 | java | package com.mctpay.manager.model.entity.template;
import com.mctpay.common.base.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author dongwei_guo
* @date 2020-02-23 18:23:00
*/
@Data
@ApiModel(value = "图片展示")
public class ShowPictureEntity extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "")
private Long id;
/**
* 图片用途类型码
*/
@ApiModelProperty(value = "图片用途类型码")
private String useTypeCode;
/**
* 图片用户态名称
*/
@ApiModelProperty(value = "图片用户态名称")
private String useTypeName;
/**
* 图片地址
*/
@ApiModelProperty(value = "图片地址")
private String address;
/**
* sdk类型
*/
@ApiModelProperty(value = "sdk类型")
private Integer sdkType;
}
| [
"1486733900@qq.com"
] | 1486733900@qq.com |
f6ab61c119788e4eb69042404d68b30d79c80827 | 5871f6a69c44a642825283e7a51fbe49becb1ba1 | /spring/apps/netflix-zuul/src/main/java/com/bluesky/technologies/springboot/netflix/zuul/LogFilter.java | 7f8d74c122d4b2711385154cd425d0148a2a9af2 | [] | no_license | andres-farias/technologies | 0a07cc030a8801383c45c61dd4cba2c050a6ca59 | 6b8eb131e9ccef1ec318d057346073a9f5698814 | refs/heads/master | 2022-11-20T06:48:36.040882 | 2020-06-15T14:26:41 | 2020-06-15T14:26:41 | 263,661,958 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | package com.bluesky.technologies.springboot.netflix.zuul;
import javax.servlet.http.HttpServletRequest;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.ZuulFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
public class LogFilter extends ZuulFilter {
private static Logger log = LoggerFactory.getLogger(LogFilter.class);
@Override
public String filterType() {
return "pre";
}
@Override
public int filterOrder() {
return 1;
}
@Override
public boolean shouldFilter() {
return true;
}
@Override
public Object run() {
RequestContext ctx = RequestContext.getCurrentContext();
HttpServletRequest request = ctx.getRequest();
log.info(String.format("%s request to %s", request.getMethod(), request.getRequestURL().toString()));
return null;
}
} | [
"andres.farias@gmail.com"
] | andres.farias@gmail.com |
0f3635b9b41dc01021ae18a878c843565914de9a | c03b39cc7367f1030bc4c6c1fda7bf537025afce | /src/com/aaw/bean/MainCommande.java | d23f0b7498b47284615452d2a3cd7f6467a63012 | [] | no_license | aaa85053657/aaw | 088f48bfbf998e262356261217a68029240ca4c7 | beba610bdf1e3f2a0c17dd8067b9d41e7a33e630 | refs/heads/master | 2021-05-06T17:41:37.720864 | 2017-11-24T09:50:42 | 2017-11-24T09:50:42 | 111,902,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,681 | java | package com.aaw.bean;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import cn.molos.timer.impl.DateTimeSerl;
import com.aaw.bean.base.BaseBean;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
* @author
*
*/
@Entity
@Table(name = "main_commande")
public class MainCommande extends BaseBean {
/**
*
*/
@OneToOne
@JoinColumn(name = "commande_priority_id")
private CommandePriority priority;
/**
*
*/
@OneToOne
@JoinColumn(name = "commande_type_id")
private CommandeType type;
/**
* 邮寄地址,需要根据选择的客户来确定
*/
@OneToOne
@JoinColumn(name = "delivery_address_id")
private DeliveryAddress address;
/**
*
*/
@Column(name = "code_id", updatable = false)
private String codeId;
/**
* 第三ID
*/
@Column(name = "external_code")
private String externalCode;
/**
*
*/
@Column(name = "time_creation")
private Date timeCreation;
/**
*
*/
@Column(name = "time_modification")
private Date timeModification;
/**
*
*/
@Column(name = "time_delete")
private Date timeDelete;
/**
*
*/
@OneToOne
@JoinColumn(name = "customer_info_id")
private CustomerInfo customer;
/**
*
*/
@OneToOne
@JoinColumn(name = "employee_id")
private Employee seller;
/**
* 型号
*/
@Transient
private String col1;
/**
* 进度
*/
@Transient
private String col2;
/**
* 生产线
*/
@Transient
private String col3;
/**
* 工序状态
*/
@Transient
private Integer col4;
/**
* 订单状态(1.信息不全 2默认状态 3状态变更 4发往工厂 )
*/
@Column(name = "order_status")
private Integer orderStatus;
/**
* 加工单状态
*/
@Transient
private Integer col6;
/**
* 当前阶段
*/
@Transient
private String col7;
@Transient
private String col8;
/**
* 加盟商id
*/
@Transient
private Franchises fid;
public String getCol1() {
return col1;
}
public void setCol1(String col1) {
this.col1 = col1;
}
public String getCol2() {
return col2;
}
public void setCol2(String col2) {
this.col2 = col2;
}
public String getCol3() {
return col3;
}
public void setCol3(String col3) {
this.col3 = col3;
}
public String getExternalCode() {
return externalCode;
}
public void setExternalCode(String externalCode) {
this.externalCode = externalCode;
}
public DeliveryAddress getAddress() {
return address;
}
public void setAddress(DeliveryAddress address) {
this.address = address;
}
public CommandePriority getPriority() {
return priority;
}
public void setPriority(CommandePriority priority) {
this.priority = priority;
}
public CommandeType getType() {
return type;
}
public void setType(CommandeType type) {
this.type = type;
}
public String getCodeId() {
return codeId;
}
public void setCodeId(String codeId) {
this.codeId = codeId;
}
@JsonSerialize(using = DateTimeSerl.class)
public Date getTimeCreation() {
return timeCreation;
}
public void setTimeCreation(Date timeCreation) {
this.timeCreation = timeCreation;
}
@JsonSerialize(using = DateTimeSerl.class)
public Date getTimeModification() {
return timeModification;
}
public void setTimeModification(Date timeModification) {
this.timeModification = timeModification;
}
@JsonSerialize(using = DateTimeSerl.class)
public Date getTimeDelete() {
return timeDelete;
}
public void setTimeDelete(Date timeDelete) {
this.timeDelete = timeDelete;
}
public CustomerInfo getCustomer() {
return customer;
}
public void setCustomer(CustomerInfo customer) {
this.customer = customer;
}
public Employee getSeller() {
return seller;
}
public void setSeller(Employee seller) {
this.seller = seller;
}
public MainCommande() {
}
public MainCommande(int id) {
super(id);
}
public Integer getCol4() {
return col4;
}
public void setCol4(Integer col4) {
this.col4 = col4;
}
public Integer getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(Integer orderStatus) {
this.orderStatus = orderStatus;
}
public Integer getCol6() {
return col6;
}
public void setCol6(Integer col6) {
this.col6 = col6;
}
public String getCol7() {
return col7;
}
public void setCol7(String col7) {
this.col7 = col7;
}
public String getCol8() {
return col8;
}
public void setCol8(String col8) {
this.col8 = col8;
}
public Franchises getFid() {
return fid;
}
public void setFid(Franchises fid) {
this.fid = fid;
}
} | [
"769979684@qq.com"
] | 769979684@qq.com |
16042670f1d59b6465c6ebf5aeb9db2806a1688c | dc1dbb7e5a4b95bf44170d2f51fd08b3814f2ac9 | /data_defect4j/preprossed_method_corpus/Math/90/org/apache/commons/math/MathRuntimeException_getLocalizedMessage_160.java | 113bef807fbc30f9b509acce9acebb7cce7d3c15 | [] | no_license | hvdthong/NetML | dca6cf4d34c5799b400d718e0a6cd2e0b167297d | 9bb103da21327912e5a29cbf9be9ff4d058731a5 | refs/heads/master | 2021-06-30T15:03:52.618255 | 2020-10-07T01:58:48 | 2020-10-07T01:58:48 | 150,383,588 | 1 | 1 | null | 2018-09-26T07:08:45 | 2018-09-26T07:08:44 | null | UTF-8 | Java | false | false | 656 | java |
org apach common math
base common math uncheck except
version revis date
math runtim except mathruntimeexcept runtim except runtimeexcept
inherit doc inheritdoc
overrid
string local messag getlocalizedmessag
messag getmessag local default getdefault
| [
"hvdthong@gmail.com"
] | hvdthong@gmail.com |
930b10fcdb394b1add0401477a8b79c704ffddda | 71ec3c641b3d4bd400039a03ee4929f8cec5100f | /scorm/scorm-api/src/java/org/sakaiproject/scorm/model/api/Attempt.java | f43630d291bda60eababc629fce2fd96669369a1 | [
"LicenseRef-scancode-generic-cla",
"ECL-2.0",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | NYUeServ/sakai11 | f03020a82c8979e35c161e6c1273e95041f4a10e | 35f04da43be735853fac37e0098e111e616f7618 | refs/heads/master | 2023-05-11T16:54:37.240151 | 2021-12-21T19:53:08 | 2021-12-21T19:53:08 | 57,332,925 | 3 | 5 | ECL-2.0 | 2023-04-18T12:41:11 | 2016-04-28T20:50:33 | Java | UTF-8 | Java | false | false | 3,366 | java | package org.sakaiproject.scorm.model.api;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class Attempt implements Serializable {
private static final long serialVersionUID = 1L;
private Long id;
private long contentPackageId;
private String courseId;
private String learnerId;
private String learnerName;
private long attemptNumber;
private Date beginDate;
private Date lastModifiedDate;
private Map<String, Long> scoDataManagerMap;
private boolean isNotExited;
private boolean isSuspended;
public Attempt() {
this.isNotExited = true;
this.isSuspended = false;
this.scoDataManagerMap = new HashMap<String, Long>();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Attempt other = (Attempt) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
public long getAttemptNumber() {
return attemptNumber;
}
public Date getBeginDate() {
return beginDate;
}
public long getContentPackageId() {
return contentPackageId;
}
public String getCourseId() {
return courseId;
}
public Long getDataManagerId(String scoId) {
return scoDataManagerMap.get(scoId);
}
public Long getId() {
return id;
}
public Date getLastModifiedDate() {
return lastModifiedDate;
}
public String getLearnerId() {
return learnerId;
}
public String getLearnerName() {
return learnerName;
}
public boolean getNotExited() {
return isNotExited;
}
public Map<String, Long> getScoDataManagerMap() {
return scoDataManagerMap;
}
public boolean getSuspended() {
return isSuspended;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
/*public long getDataManagerId() {
return dataManagerId;
}
public void setDataManagerId(long dataManagerId) {
this.dataManagerId = dataManagerId;
}*/
public boolean isNotExited() {
return isNotExited;
}
public boolean isSuspended() {
return isSuspended;
}
public void setAttemptNumber(long attemptNumber) {
this.attemptNumber = attemptNumber;
}
public void setBeginDate(Date beginDate) {
this.beginDate = beginDate;
}
public void setContentPackageId(long contentPackageId) {
this.contentPackageId = contentPackageId;
}
public void setCourseId(String courseId) {
this.courseId = courseId;
}
public void setDataManagerId(String scoId, Long dataManagerId) {
if (scoId != null) {
scoDataManagerMap.put(scoId, dataManagerId);
}
}
public void setId(Long id) {
this.id = id;
}
public void setLastModifiedDate(Date lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public void setLearnerId(String learnerId) {
this.learnerId = learnerId;
}
public void setLearnerName(String learnerName) {
this.learnerName = learnerName;
}
public void setNotExited(boolean isNotExited) {
this.isNotExited = isNotExited;
}
public void setScoDataManagerMap(Map<String, Long> scoDataManagerMap) {
this.scoDataManagerMap = scoDataManagerMap;
}
public void setSuspended(boolean isSuspended) {
this.isSuspended = isSuspended;
}
}
| [
"mark@dishevelled.net"
] | mark@dishevelled.net |
e1039e9d2be87303a071fda154066930b46c2412 | 80b1692d2b80765db9b6584bbab187f93a1d6f33 | /Introduction to Computer Science 2017-18/Practice2Day2.java | 96e65243a1c8e6a4d0e8069f521a68263256208f | [] | no_license | AdityaaMK/High-School-CS | fdcbdcc4838939e2a741b476f64a55d7a5ff7843 | fd1c17cb2c55b4f771b753698b3da27c3ae88b74 | refs/heads/master | 2023-01-02T23:37:01.373615 | 2020-11-02T14:42:45 | 2020-11-02T14:42:45 | 236,189,783 | 0 | 0 | null | 2020-04-08T22:24:26 | 2020-01-25T15:40:34 | Java | UTF-8 | Java | false | false | 659 | java | public class Practice2Day2{
public static void main(String[] args){
int x = 0;
System.out.println("number\tsquare\tcube");
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
x++;
System.out.println(x+"\t"+x*x+"\t"+x*x*x);
}
} | [
"noreply@github.com"
] | AdityaaMK.noreply@github.com |
083e96bc23cc856eceaeced73d2aea7386cb5090 | 216f34d1d346b7363d5c1e98c5eab46f1cf17de8 | /src/som/primitives/SystemPrimitives.java | d0649093a2e08de1e3ab2461c2962b069e729f7c | [
"MIT"
] | permissive | mhaupt/som-java | ee83947eb51516cbdd77d24f7834e85ce2762dbf | f5b61446ec319ec90811276006a11df4ad295b35 | refs/heads/master | 2021-01-01T06:08:25.690140 | 2017-07-22T13:48:30 | 2017-07-22T13:48:30 | 71,713,909 | 0 | 0 | null | 2016-10-23T16:07:20 | 2016-10-23T16:07:20 | null | UTF-8 | Java | false | false | 4,530 | java | /**
* Copyright (c) 2009 Michael Haupt, michael.haupt@hpi.uni-potsdam.de
* Software Architecture Group, Hasso Plattner Institute, Potsdam, Germany
* http://www.hpi.uni-potsdam.de/swa/
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package som.primitives;
import som.interpreter.Interpreter;
import som.interpreter.Frame;
import som.vm.Universe;
import som.vmobjects.SClass;
import som.vmobjects.SInteger;
import som.vmobjects.SAbstractObject;
import som.vmobjects.SPrimitive;
import som.vmobjects.SString;
import som.vmobjects.SSymbol;
public class SystemPrimitives extends Primitives {
public SystemPrimitives(final Universe universe) {
super(universe);
}
public void installPrimitives() {
installInstancePrimitive(new SPrimitive("load:", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
SSymbol argument = (SSymbol) frame.pop();
frame.pop(); // not required
SClass result = universe.loadClass(argument);
frame.push(result != null ? result : universe.nilObject);
}
});
installInstancePrimitive(new SPrimitive("exit:", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
SInteger error = (SInteger) frame.pop();
universe.exit(error.getEmbeddedInteger());
}
});
installInstancePrimitive(new SPrimitive("global:", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
SSymbol argument = (SSymbol) frame.pop();
frame.pop(); // not required
SAbstractObject result = universe.getGlobal(argument);
frame.push(result != null ? result : universe.nilObject);
}
});
installInstancePrimitive(new SPrimitive("global:put:", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
SAbstractObject value = frame.pop();
SSymbol argument = (SSymbol) frame.pop();
universe.setGlobal(argument, value);
}
});
installInstancePrimitive(new SPrimitive("printString:", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
SString argument = (SString) frame.pop();
Universe.print(argument.getEmbeddedString());
}
});
installInstancePrimitive(new SPrimitive("printNewline", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
Universe.println("");
}
});
startMicroTime = System.nanoTime() / 1000L;
startTime = startMicroTime / 1000L;
installInstancePrimitive(new SPrimitive("time", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
frame.pop(); // ignore
int time = (int) (System.currentTimeMillis() - startTime);
frame.push(universe.newInteger(time));
}
});
installInstancePrimitive(new SPrimitive("ticks", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
frame.pop(); // ignore
int time = (int) (System.nanoTime() / 1000L - startMicroTime);
frame.push(universe.newInteger(time));
}
});
installInstancePrimitive(new SPrimitive("fullGC", universe) {
public void invoke(final Frame frame, final Interpreter interpreter) {
frame.pop();
System.gc();
frame.push(universe.trueObject);
}
});
}
private long startTime;
private long startMicroTime;
}
| [
"git@stefan-marr.de"
] | git@stefan-marr.de |
b0fc6471aa09f0ec9739132d457b51bda8a0f179 | 4e724688198646a64a6e4abbf73bf5e45c12e382 | /projet-RaphaelMikati-JulesYates/src/cipher/Cipher.java | 3228d0b134e9381bf796ee2aeea88f6af2864128 | [] | no_license | RaphMkt/Cryptography_Project_Java | 467e778fb71307add2f4156d059fbb4d9b0d6804 | 194cd8cb9d1f4eac747cd381819ecd214c5a8832 | refs/heads/master | 2020-04-13T20:49:59.572853 | 2018-12-28T18:57:07 | 2018-12-28T18:57:07 | 163,440,682 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 612 | java | package cipher;
/**
* The Cipher interface
*
* @author : Raphael Mikati
* @author : Jules Yates
*/
public interface Cipher {
/**
* The method to encrypt a given text
*
* @param text
* the String to encrypt
*
* @return the text encrypted with a specific encryption method
*/
public String Encrypt(String text);
/**
* The method to decrypt a given encrypted text
*
* @param cryptext
* the String to decrypt
*
* @return the text decrypted with a specific decryption method
*/
public String Decrypt(String cryptext);
}
| [
"noreply@github.com"
] | RaphMkt.noreply@github.com |
aacd012413601736adb0fe67b305e30d8aa2200d | 3310a378d895b9ad6af57c670801889146132963 | /app/src/main/java/com/example/chatapp/ContactsFragment.java | 81fcb689c86dc7e87f9fa31035789e2b06d702a9 | [] | no_license | danuka98/MAD-ChatApp | 07ba1535517ac52a8060d85fbdc9894cbef12bf6 | 82c14889cab1567ade3a2fee0689b36622e35b0c | refs/heads/master | 2023-06-13T01:53:18.486695 | 2021-07-07T17:01:18 | 2021-07-07T17:01:18 | 293,814,663 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,644 | java | package com.example.chatapp;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.firebase.ui.database.FirebaseRecyclerAdapter;
import com.firebase.ui.database.FirebaseRecyclerOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.DataSnapshot;
import com.google.firebase.database.DatabaseError;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.database.ValueEventListener;
import com.squareup.picasso.Picasso;
import de.hdodenhof.circleimageview.CircleImageView;
public class ContactsFragment extends Fragment {
private View contactView;
private RecyclerView viewContactList;
private DatabaseReference contactReference , userReference;
private FirebaseAuth mAuth;
private String currentUserId;
public ContactsFragment() {
// Required empty public constructor
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
contactView = inflater.inflate(R.layout.fragment_contacts, container, false);
//initializing fields
viewContactList = (RecyclerView) contactView.findViewById(R.id.contactList);
viewContactList.setLayoutManager(new LinearLayoutManager(getContext()));
//Firebase connection
mAuth = FirebaseAuth.getInstance();
currentUserId = mAuth.getCurrentUser().getUid();
contactReference = FirebaseDatabase.getInstance().getReference().child("Contact").child(currentUserId);
userReference = FirebaseDatabase.getInstance().getReference().child("Users");
return contactView;
}
@Override
public void onStart() {
super.onStart();
FirebaseRecyclerOptions recyclerOptions = new FirebaseRecyclerOptions.Builder<Contacts>()
.setQuery(contactReference,Contacts.class)
.build();
FirebaseRecyclerAdapter<Contacts,contactListHolder> recyclerAdapter = new FirebaseRecyclerAdapter<Contacts, contactListHolder>(recyclerOptions) {
@Override
protected void onBindViewHolder(@NonNull final contactListHolder holder, int position, @NonNull Contacts model) {
final String userId = getRef(position).getKey();
userReference.child(userId).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
if (snapshot.exists()){
if (snapshot.child("onlineStatus").hasChild("status")){
String status = snapshot.child("onlineStatus").child("status").getValue().toString();
String date = snapshot.child("onlineStatus").child("date").getValue().toString();
String time = snapshot.child("onlineStatus").child("time").getValue().toString();
if (status.equals("online")){
holder.onlineIcon.setVisibility(View.VISIBLE);
}
else if (status.equals("offline")){
holder.onlineIcon.setVisibility(View.INVISIBLE);
}
}
else {
holder.onlineIcon.setVisibility(View.INVISIBLE);
}
if (snapshot.hasChild("image")){
String userProfileImage = snapshot.child("image").getValue().toString();
String userProfileDescription = snapshot.child("description").getValue().toString();
String userProfileName = snapshot.child("name").getValue().toString();
holder.username.setText(userProfileName);
holder.userDescription.setText(userProfileDescription);
Picasso.get().load(userProfileImage).placeholder(R.drawable.profile_image).into(holder.profileImage);
}
else{
String userProfileDescription = snapshot.child("description").getValue().toString();
String userProfileName = snapshot.child("name").getValue().toString();
holder.username.setText(userProfileName);
holder.userDescription.setText(userProfileDescription);
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
}
//display the user profile
@NonNull
@Override
public contactListHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.display_user_layout, parent, false);
contactListHolder viewHolder = new contactListHolder(view);
return viewHolder;
}
};
viewContactList.setAdapter(recyclerAdapter);
recyclerAdapter.startListening();
}
public static class contactListHolder extends RecyclerView.ViewHolder{
TextView username, userDescription;
CircleImageView profileImage;
ImageView onlineIcon;
public contactListHolder(@NonNull View itemView) {
super(itemView);
//initializing fields
username = itemView.findViewById(R.id.userName);
userDescription = itemView.findViewById(R.id.userDescription);
profileImage = itemView.findViewById(R.id.user_profile_image);
onlineIcon = (ImageView) itemView.findViewById(R.id.online);
}
}
} | [
"dnkdilshan@gmail.com"
] | dnkdilshan@gmail.com |
e1c4534cd26c17b58770f564bd4b980a70d54f24 | 6ac6dc3324a03363adca2af2a50971d95c039afd | /Polinomio.java | 02e4e9061de5e3f4b642b5d81f387dcd6caff4a3 | [] | no_license | DuvanCorrea/Polinomios-JAVA | b7cf948aa3916e06edcdca64a5b4b106029c26b0 | 160eb8f76455878923a9db34d665f46485ead062 | refs/heads/master | 2022-11-25T00:32:30.814890 | 2020-07-15T22:06:01 | 2020-07-15T22:06:01 | 279,973,887 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 33,606 | java | package trabajoa.p;
import java.util.Scanner;
public class Polinomio {
private int grado;
private int[] polinomio = null;
private int[] polinomioF2 = null;
public Polinomio(int grado, int[] polinomio) {
this.grado = grado;
this.polinomio = polinomio;
}
public int getGrado() {
return grado;
}
public void setGrado(int grado) {
this.grado = grado;
}
public int[] getPolinomio() {
return polinomio;
}
public void setPolinomio(int[] polinomio) {
this.polinomio = polinomio;
}
public int[] getPolinomioF2() {
return polinomioF2;
}
public void setPolinomioF2(int[] polinomioF2) {
this.polinomioF2 = polinomioF2;
}
public void mostrar(int[] polinomio) {
for (int i = 0; i < polinomio.length; i++) {
System.out.print(" " + polinomio[i]);
}
}
public void reconstruirPolinomio() { // para recontruir el polinomio interno
int grado = polinomio[0];
for (int i = 1; i < polinomio.length; i++) {
if (i != 1) {
if (polinomio[i] == 0) { // cuando no hay coheficiente
grado--;
} else if (polinomio[i] > 1) { // cuando el coheficiente es mayor que 1
if (grado > 1) {
System.out.print("+" + polinomio[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("+" + polinomio[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print("+" + polinomio[i]);
}
}
} else if (polinomio[i] == 1) { // cuando el coheficiente es 1
if (grado > 1) {
System.out.print("+x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("+x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print("+" + polinomio[i]);
}
}
} else if (polinomio[i] < -1) { // cuando el coheficiente es menor que -1
if (grado > 1) {
System.out.print(polinomio[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print(polinomio[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print(polinomio[i]);
}
}
} else {
if (grado > 1) {
System.out.print("-x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("-x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print(polinomio[i]);
}
}
}
} else { // aqui sigue cuando es el primero
if (polinomio[i] == 0) {
grado--;
} else if (polinomio[i] > 1) {
if (grado > 1) {
System.out.print(polinomio[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print(polinomio[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print(polinomio[i]);
}
}
} else if (polinomio[i] == 1) {
if (grado > 1) {
System.out.print("x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print(polinomio[i]);
}
}
} else if (polinomio[i] < -1) { // cuando el coheficiente es menor que -1
if (grado > 1) {
System.out.print(polinomio[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print(polinomio[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print(polinomio[i]);
}
}
} else {
if (grado > 1) {
System.out.print("-x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("-x");
grado--;
} else if (grado == 0) {
if (polinomio[i] == 0) {
grado--;
} else {
System.out.print("-" + polinomio[i]);
}
}
}
}
}
}
public void reconstruirPolinomio(int[] polinomioVector) { // para uno externo
int grado = polinomioVector[0];
if (polinomio != null) {
for (int i = 1; i < polinomioVector.length; i++) {
if (i != 1) {
if (polinomioVector[i] == 0) { // cuando no hay coheficiente
grado--;
} else if (polinomioVector[i] > 1) { // cuando el coheficiente es mayor que 1
if (grado > 1) {
System.out.print("+" + polinomioVector[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("+" + polinomioVector[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println("+" + polinomioVector[i]);
}
}
} else if (polinomioVector[i] == 1) { // cuando el coheficiente es 1
if (grado > 1) {
System.out.print("+x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("+x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println("+" + polinomioVector[i]);
}
}
} else if (polinomioVector[i] < -1) { // cuando el coheficiente es menor que -1
if (grado > 1) {
System.out.print(polinomioVector[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print(polinomioVector[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println(polinomioVector[i]);
}
}
} else {
if (grado > 1) {
System.out.print("-x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("-x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println(polinomioVector[i]);
}
}
}
} else { // aqui sigue cuando es el primero
if (polinomioVector[i] == 0) {
grado--;
} else if (polinomioVector[i] > 1) {
if (grado > 1) {
System.out.print(polinomioVector[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print(polinomioVector[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println(polinomioVector[i]);
}
}
} else if (polinomioVector[i] == 1) {
if (grado > 1) {
System.out.print("x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println(polinomioVector[i]);
}
}
} else if (polinomioVector[i] < -1) { // cuando el coheficiente es menor que -1
if (grado > 1) {
System.out.print(polinomioVector[i] + "x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print(polinomioVector[i] + "x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println(polinomioVector[i]);
}
}
} else {
if (grado > 1) {
System.out.print("-x^" + grado);
grado--;
} else if (grado == 1) {
System.out.print("-x");
grado--;
} else if (grado == 0) {
if (polinomioVector[i] == 0) {
grado--;
} else {
System.out.println("-" + polinomioVector[i]);
}
}
}
}
}
} else {
System.out.println("Polinomio vacio...");
}
}
public boolean bucarporCoheficiente(int coheficiente) {
int grado = polinomio[0];
boolean encontro = false;
for (int i = 1; i < polinomio.length; i++) {
if (polinomio[i] == coheficiente) {
if (polinomio[i] != 1 && polinomio[i] != -1) {
if (grado > 1) {
System.out.println("Coheficiente encontrado... ");
System.out.println(polinomio[i] + "x^" + grado);
} else if (grado == 1) {
System.out.println("Coheficiente encontrado... ");
System.out.println(polinomio[i] + "x");
} else if (grado == 0) {
System.out.println("Coheficiente encontrado... ");
System.out.println(polinomio[i]);
}
} else if (polinomio[i] == 1) {
if (grado > 1) {
System.out.println("Coheficiente encontrado... ");
System.out.println("x^" + grado);
} else if (grado == 1) {
System.out.println("Coheficiente encontrado... ");
System.out.println("x");
} else if (grado == 0) {
System.out.println("Coheficiente encontrado... ");
System.out.println(polinomio[i]);
}
} else {
if (grado > 1) {
System.out.println("Coheficiente encontrado... ");
System.out.println("-x^" + grado);
} else if (grado == 1) {
System.out.println("Coheficiente encontrado... ");
System.out.println("-x");
} else if (grado == 0) {
System.out.println("Coheficiente encontrado... ");
System.out.println(polinomio[i]);
}
}
encontro = true;
return true;
}
grado--;
}
if (encontro == false) {
System.out.println("Coheficiente NO encontrado... ");
}
return false;
}
public boolean buscarporExponente(int exponente) {
int grado = polinomio[0];
boolean encontro = false;
if (exponente > grado) {
System.out.println("El grado ingresado es mayor que el del "
+ "polinomio");
return false;
} else {
for (int i = 1; i < polinomio.length; i++) {
if (grado == exponente && polinomio[i] != 0) {
if (grado > 1) {
if (polinomio[i] != 1 && polinomio[i] != -1) {
System.out.println("Termino encontrado... ");
System.out.println(polinomio[i] + "x^" + grado);
} else if (polinomio[i] == 1) {
System.out.println("Termino encontrado... ");
System.out.println("x^" + grado);
} else if (polinomio[i] == -1) {
System.out.println("Termino encontrado... ");
System.out.println("-x^" + grado);
}
} else if (grado == 1) {
if (polinomio[i] != 1 && polinomio[i] != -1) {
System.out.println("Termino encontrado... ");
System.out.println(" " + polinomio[i] + "x");
} else if (polinomio[i] == 1) {
System.out.println("Termino encontrado... ");
System.out.println("x");
} else if (polinomio[i] == -1) {
System.out.println("Termino encontrado... ");
System.out.println("-x");
}
} else if (grado == 0) {
System.out.println(" Termino encontrado... ");
System.out.println(polinomio[i]);
}
encontro = true;
return true;
}
grado--;
}
if (encontro == false) {
System.out.println("Exponente NO encontrado... ");
}
return false;
}
}
public void ingresarTermino(int[] termino) {
int[] nuevoPolinomio = new int[termino[1] + 2];
if (termino[1] <= polinomio[0]) {
int posicion = (polinomio[0] - termino[1]) + 1;
polinomio[posicion] = polinomio[posicion] + termino[0];
nuevoPolinomio = polinomio;
} else {
nuevoPolinomio[0] = termino[1];
int grado = polinomio[0];
nuevoPolinomio[(nuevoPolinomio[0] - termino[1]) + 1] = termino[0];
for (int i = 1; i < polinomio.length; i++) {
int posicion = (nuevoPolinomio[0] - grado) + 1;
nuevoPolinomio[posicion] = polinomio[i] + nuevoPolinomio[posicion];
grado--;
}
polinomio = nuevoPolinomio;
}
System.out.println("\n Nuevo polinomio: ");
reconstruirPolinomio(nuevoPolinomio);
System.out.println("");
}
public void eliminarTermino(String termino) {
// pasar string a vector
int[] terminoVector = pasarTerminoAvector(termino);
// fin pasar string a vector
//
boolean elimino = false;
// Buscar exponente y eliminar
if (terminoVector[1] < polinomio[0]) {
int posicion = (polinomio[0] - terminoVector[1]) + 1;
if (terminoVector[0] == polinomio[posicion]) {
polinomio[posicion] = 0;
System.out.println("Termino eliminado...\n"
+ "Nuevo termino:");
reconstruirPolinomio(polinomio);
elimino = true;
}
} else if (terminoVector[1] == polinomio[0]) {
if (terminoVector[0] == polinomio[1]) {
polinomio[1] = 0;
int contador = polinomio[0];
for (int i = 1; i < polinomio.length; i++) {
if (polinomio[i] != 0) {
int[] nuevoPolinomio = new int[contador + 2];
nuevoPolinomio[0] = contador;
int nuevoGrado = contador;
for (int j = i; j < polinomio.length; j++) {
int pocision = (nuevoGrado - contador) + 1;
nuevoPolinomio[pocision] = polinomio[i];
i++;
contador--;
System.out.println("");
}
System.out.println("Termino eliminado...\n"
+ "Nuevo termino:");
polinomio = nuevoPolinomio;
reconstruirPolinomio(polinomio);
break;
}
contador--;
}
}
elimino = true;
}
if (elimino == false) {
System.out.println("\n Termino NO encontrado... \n");
}
// Fin buscar exponente y eliminar
}
public int[] pasarTerminoAvector(String termino) {
int[] terminoEnVectorRetornar = new int[2];
char[] terminoEnVector = termino.toCharArray();
int coheficiente = 0, exponente = 0;
boolean encontroX = false;
for (int i = 0; i < terminoEnVector.length; i++) {
if (terminoEnVector[i] == 'x') {
// SACANDO COHEFICIENTE DEL TERMINO
if (i + 1 != terminoEnVector.length) {
if (terminoEnVector[i + 1] == '^') {
String concatenar = "";
for (int j = i + 2; j < terminoEnVector.length; j++) {
concatenar = concatenar + terminoEnVector[j];
}
terminoEnVectorRetornar[1] = Integer.parseInt(concatenar);
}
} else {
terminoEnVectorRetornar[1] = 1;
}
// SACANDO COHEFICIENTE
if (i == 0) {
terminoEnVectorRetornar[0] = 1;
} else {
int contador = 0;
String concatenar = "";
while (contador != i) {
concatenar = concatenar + terminoEnVector[contador];
contador++;
}
terminoEnVectorRetornar[0] = Integer.parseInt(concatenar);
}
encontroX = true;
}
// CONDICION PARA CUANDO NO HAY X
if (encontroX == false && i == terminoEnVector.length - 1) {
int contador = 0;
String concatenar = "";
while (contador != terminoEnVector.length) {
concatenar = concatenar + terminoEnVector[contador];
contador++;
}
terminoEnVectorRetornar[0] = Integer.parseInt(concatenar);
terminoEnVectorRetornar[1] = 0;
}
}
System.out.println("");
return terminoEnVectorRetornar;
}
public void sumarPolinomios(String polinomio2) {
// Pasar polinomio en string a vector
int[] polinomio2Vector = pasarStringAvector(polinomio2);
// FIN Pasar polinomio en string a vector
//
// Sumando polinomio
if (polinomio2Vector.length <= polinomio.length) {
int contador = (polinomio.length - polinomio2Vector.length) + 1;
int contador2 = 1;
for (int i = contador; i < polinomio.length; i++) {
if (polinomio2Vector[contador2] != 0) {
polinomio[contador] += polinomio2Vector[contador2];
}
contador++;
contador2++;
}
} else {
int contador = (polinomio2Vector.length - polinomio.length) + 1;
int contador2 = 1;
for (int i = contador; i < polinomio2Vector.length; i++) {
if (polinomio[contador2] != 0) {
polinomio2Vector[contador] += polinomio[contador2];
}
contador++;
contador2++;
}
polinomio = polinomio2Vector;
}
// FIN sumando polinomios
System.out.println("\n Resultante de la suma:");
reconstruirPolinomio(polinomio);
System.out.println("");
}
public int[] pasarStringAvector(String polinomio) {
char[] polinomioVector = polinomio.toCharArray();
int[] polinomioFinal;
String[] polinomioConcatenado = new String[polinomioVector.length];
int contadorConcatenar = 0;
int coheficiente = 0;
int exponente = 0;
int grado = 0;
if (polinomioVector.length == 1) {
polinomio = polinomio + "+0";
polinomioVector = polinomio.toCharArray();
} else if (polinomioVector[polinomioVector.length - 1] == '^'
|| polinomioVector[polinomioVector.length - 2] == '^') {
polinomio = polinomio + "+0";
polinomioVector = polinomio.toCharArray();
}
grado = sacarGradoMayor(polinomioVector);
polinomioFinal = new int[grado + 2];
polinomioFinal[0] = grado;
for (int i = 0; i < polinomioVector.length; i++) {
// SACANDO COHEFICIENTE
if (polinomioVector[i] == 'x'
|| i == polinomioVector.length - 1 && polinomioVector[i] != 'x') {
if (i == 0) {
coheficiente = 1;
} else if (i == 0 && polinomioVector[0] == '-'
&& polinomioVector[1] == 'x') {
coheficiente = -1;
} else {
if (polinomioVector[i] == 'x') {
if (polinomioVector[i - 1] == '+'
|| polinomioVector[i - 1] == '-') {
if (polinomioVector[i - 1] == '-') {
coheficiente = -1;
} else {
coheficiente = 1;
}
} else {
int contador = i;
String concatenar = "";
while (polinomioVector[contador] != '+'
&& polinomioVector[contador] != '-'
&& polinomioVector[contador] != '^'
&& contador != 0) {
contador--;
}
while (contador != i) {
if (polinomioVector[contador] == '+') {
contador++;
} else {
concatenar = concatenar + polinomioVector[contador];
contador++;
}
}
coheficiente = Integer.parseInt(concatenar);
}
}
}
// SACANDO EXPONENTES
if (polinomioVector[i] == 'x') {
if (i != polinomioVector.length - 1) {
if (polinomioVector[i + 1] == '^') {
int contador = i + 2;
String concatenar = "";
while (polinomioVector[contador] != '+'
&& polinomioVector[contador] != '-'
&& polinomioVector[contador + 1] != '^'
&& contador != polinomioVector.length) {
concatenar = concatenar + polinomioVector[contador];
contador++;
}
exponente = Integer.parseInt(concatenar);
} else {
exponente = 1;
}
} else {
exponente = 1;
}
}
// EVALUANDO SI HAY ULTIMO TERMINO
if (i == polinomioVector.length - 1 && polinomioVector[i] != 'x') {
int contador = i;
String concatenar = "";
while (polinomioVector[contador] != '+'
&& polinomioVector[contador] != '-'
&& polinomioVector[contador] != '^'
&& contador != -1) {
contador--;
}
while (contador != i + 1) {
if (polinomioVector[contador] == '+') {
contador++;
} else {
concatenar = concatenar + polinomioVector[contador];
contador++;
}
}
coheficiente = Integer.parseInt(concatenar);
exponente = 0;
}
int posicion = (grado - exponente) + 1;
polinomioFinal[posicion] = coheficiente + polinomioFinal[posicion];
}
}
// FIN DE PASAR POLINOMIO A VECTOR
return polinomioFinal;
}
public int sacarGradoMayor(char[] polinomio) {
int grado = 0;
int exponente = 0;
for (int i = 0; i < polinomio.length; i++) {
if (polinomio[i] == 'x') {
if (i != polinomio.length - 1) {
if (polinomio[i + 1] == '^') {
int contador = i + 2;
String concatenar = "";
while (polinomio[contador] != '+'
&& polinomio[contador] != '-'
&& polinomio[contador + 1] != '^'
&& contador != polinomio.length) {
concatenar = concatenar + polinomio[contador];
contador++;
}
exponente = Integer.parseInt(concatenar);
if (grado < exponente) {
grado = exponente;
}
} else {
exponente = 1;
if (grado < exponente) {
grado = exponente;
}
}
} else {
exponente = 1;
if (grado < exponente) {
grado = exponente;
}
}
}
}
return grado;
}
public void multiplicarPolinomios(String Polinomio) {
//pasar string a vector
int[] nuevoPolinomio = pasarStringAvector(Polinomio);
// Fin pasar string a vector
//
// multiplicacion
int grado1 = nuevoPolinomio[0];
int grado2 = polinomio[0];
///System.out.println("Grado 1: "+grado1);
//System.out.println("Grado 2: "+grado2);
int[] polinomioFinal = new int[grado1 + grado2 + 2];
polinomioFinal[0] = grado1 + grado2;
//System.out.println("Grado nuevo polinomio: "+polinomioFinal[0]);
if (polinomio.length >= nuevoPolinomio.length) {
for (int i = 1; i < polinomio.length; i++) {
for (int j = 1; j < nuevoPolinomio.length; j++) {
int posicion = (polinomioFinal[0] - (grado1 + grado2)) + 1;
polinomioFinal[posicion] += polinomio[i] * nuevoPolinomio[j];
grado2--;
}
grado2 = polinomio[0];
grado1--;
}
} else {
for (int i = 1; i < nuevoPolinomio.length; i++) {
for (int j = 1; j < polinomio.length; j++) {
int posicion = (polinomioFinal[0] - (grado1 + grado2)) + 1;
polinomioFinal[posicion] += nuevoPolinomio[i] * polinomio[j];
grado2--;
}
grado2 = polinomio[0];
grado1--;
}
}
polinomio = polinomioFinal;
System.out.println("");
reconstruirPolinomio(polinomio);
System.out.println("");
// fin multiplicacion
}
public void reemplazarCoheficiente(String nuevo) {
// pasar a vector
int[] termino = pasarTerminoAvector(nuevo);
// Fin pasar a avector
if (buscarporExponente(termino[0]) == true) {
Scanner entrada = new Scanner(System.in);
System.out.print("\nNuevo Coheficiente: ");
int coheficienteNuevo = entrada.nextInt();
termino[0] = coheficienteNuevo;
int[] nuevoPolinomio = new int[termino[1] + 2];
if (termino[1] <= polinomio[0]) {
int posicion = (polinomio[0] - termino[1]) + 1;
polinomio[posicion] = termino[0];
nuevoPolinomio = polinomio;
} else {
System.out.println("\nTermino no encontrado...");
}
System.out.println("\nNuevo polinomio: ");
reconstruirPolinomio(nuevoPolinomio);
System.out.println("");
} else {
System.out.println("\nTermino no encontrado...");
}
}
public void mostrarVector() {
for (int i = 0; i < polinomio.length; i++) {
System.out.print(polinomio[i] + " ");
}
}
public void polinomioF2(int[] polinomioF2) {
int tamVec = 0;
int posNuevo = 1;
int[] polF2;
for (int i = 1; i < polinomioF2.length; i++) {
if (polinomioF2[i] != 0) {
tamVec++;
}
}
polF2 = new int[(tamVec * 2) + 1];
polF2[0] = polinomioF2[0];
//System.out.println(polinomioF2.length);
for (int i = 1; i < polinomioF2.length; i++) {
if (polinomioF2[i] != 0) {
//System.out.println(polinomioF2.length-(i+1));
polF2[posNuevo] = polinomioF2.length - (i + 1);
polF2[posNuevo + 1] = polinomioF2[i];
posNuevo += 2;
}
}
this.polinomioF2 = polF2;
}
public void mostrarF2(int[] polinomioF2) {
for (int i : polinomioF2) {
System.out.print(i + " ");
}
}
}
| [
"duvancorrea96@gmail.com"
] | duvancorrea96@gmail.com |
f1a9a1d88b7471f2e799b93cb291eee28efb26e1 | 85058918deb76f830b171b777017c53b2b69236a | /service/src/main/java/com/edwinshaircuts/service/services/BookingLogService.java | 846b08645845e7c11d79333041c36b24b66b4692 | [] | no_license | yugoja/haircuts-by-edwin | 0ded4451fb5767407b0efead0c2446c8c3e7ca76 | 06d8b07e47b8a5a31ae41bfd9eb9c54d1af1defa | refs/heads/master | 2022-11-15T18:58:47.805499 | 2020-07-17T06:33:44 | 2020-07-17T06:33:44 | 279,905,036 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 292 | java | package com.edwinshaircuts.service.services;
import com.edwinshaircuts.service.vo.BookingLog;
import com.edwinshaircuts.service.vo.NewBooking;
public interface BookingLogService {
BookingLog getBookingLog(String businessDate);
BookingLog upsertBookingLog(NewBooking newBooking);
}
| [
"yjadha14@in.ibm.com"
] | yjadha14@in.ibm.com |
06814a3ee0d201d1c547b9d7c67f4fafd02fbb04 | b81826a4b4215940bcdf89f57b6149d7954300ec | /src/com/expensessender/AddCategoryActivity.java | 173f9143af8c9369df18ce771284c1b7deb98f35 | [] | no_license | nodesman/Android-Intuit-Money-Manager-Expenses-Sender | 3e5164a979fb24b320371794f746b6d5ffeb06f0 | c71cd7c0d20fd18dbb06e685b484c79bd264f1dc | refs/heads/master | 2021-05-28T02:23:14.536297 | 2014-11-29T20:43:41 | 2014-11-29T20:43:41 | 2,127,583 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,032 | java | package com.expensessender;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class AddCategoryActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.add_category_activity);
EditText view = (EditText) findViewById(R.id.category_field);
view.requestFocus();
AddCategoryButtonListener listener = new AddCategoryButtonListener(view);
Button addCategory = (Button) findViewById(R.id.add_category_button);
addCategory.setOnClickListener(listener);
Button cancelCat = (Button) findViewById(R.id.cancel_button);
cancelCat.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent move = new Intent(AddCategoryActivity.this, MainActivity.class);
startActivity(move);
}
});
}
class AddCategoryButtonListener implements OnClickListener {
private TextView category_name_field = null;
AddCategoryButtonListener(TextView view) {
this.category_name_field = view;
}
@Override
public void onClick(View v) {
String categoryName = (String) category_name_field.getText().toString();
if (categoryName.trim().length() == 0) {
AlertDialog alertDialog;
alertDialog = new AlertDialog.Builder(v.getContext()).create();
alertDialog.setTitle("Empty Category Name");
alertDialog.setMessage("Please enter a category name. Category name is empty.");
alertDialog.show();
alertDialog.setCanceledOnTouchOutside(true);
return;
}
CategoryManager manager = new CategoryManager(v.getContext());
manager.open();
manager.addCategory(categoryName);
Intent move = new Intent(AddCategoryActivity.this, MainActivity.class);
startActivity(move);
}
}
}
| [
"raj@nodesman.com"
] | raj@nodesman.com |
e5ab2d58d883482593e142af4a9c9fc1032a06a7 | 7104e3796f575b8063f2233a8099fae7fc572d18 | /app/src/main/java/com/sizhuo/ydxf/Module04.java | 047d4290f5a395078d80f80ab5e4ac345b1b058f | [] | no_license | myxiao7/YDXF | d6789b57e6dfdcd44d939bf0b9e1164f3c718fdb | dcf80dd506b809d35443adec5327e9ab36599825 | refs/heads/master | 2021-01-10T06:58:12.653397 | 2016-02-25T09:18:22 | 2016-02-25T09:18:22 | 48,032,308 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 18,576 | java | package com.sizhuo.ydxf;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.Toast;
import com.alibaba.fastjson.JSON;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.daimajia.slider.library.Animations.DescriptionAnimation;
import com.daimajia.slider.library.SliderLayout;
import com.daimajia.slider.library.SliderTypes.BaseSliderView;
import com.daimajia.slider.library.SliderTypes.TextSliderView;
import com.sizhuo.ydxf.adapter.MyModule01Adapter;
import com.sizhuo.ydxf.application.MyApplication;
import com.sizhuo.ydxf.entity._NewsData;
import com.sizhuo.ydxf.entity._SliderData;
import com.sizhuo.ydxf.util.ACache;
import com.sizhuo.ydxf.util.Const;
import com.sizhuo.ydxf.util.StatusBar;
import com.sizhuo.ydxf.view.zrclistview.SimpleFooter;
import com.sizhuo.ydxf.view.zrclistview.SimpleHeader;
import com.sizhuo.ydxf.view.zrclistview.ZrcListView;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.DbManager;
import org.xutils.db.sqlite.WhereBuilder;
import org.xutils.ex.DbException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
/**
* 项目名称: YDXF
* 类描述: 第一个功能模块
* Created by My灬xiao7
* date: 2015/12/18
*
* @version 1.0
*/
public class Module04 extends AppCompatActivity implements BaseSliderView.OnSliderClickListener {
private Toolbar toolbar;//标题栏
private SliderLayout sliderLayout;//轮播
private LinearLayout loading;
private ZrcListView listView;
private View headView;
private List<_NewsData> list = new LinkedList<_NewsData>();//数据列表
private HashMap<String,String> url_maps = new LinkedHashMap<String, String>();//幻灯片数据
private MyModule01Adapter myModule01Adapter;
private final int REFRESH_COMPLETE = 0X100;//刷新完成
private final int LOADMORE_COMPLETE = 0X101;//加载完成
private int index = 1;
private RequestQueue queue;
private JsonObjectRequest jsonObjectRequest;
private final String TAG01 = "jsonObjectRequest";//请求数据TAG
long time,time02 = 0;
private ACache aCache;//数据缓存
private DbManager dbManager;//数据库操作
private List<_NewsData> newsCache = new ArrayList<>();
private List<_SliderData> sliderCache = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_module01);
time = System.currentTimeMillis();
//初始化
initViews();
queue = Volley.newRequestQueue(this);
loadData();
// listView.refresh();
listView.setOnItemClickListener(new ZrcListView.OnItemClickListener() {
@Override
public void onItemClick(ZrcListView parent, View view, int position, long id) {
Intent intent = new Intent(Module04.this, NewsDetails.class);
// Toast.makeText(Module01.this, "" + position + "----" + list.get(position - 1).getDigest(), Toast.LENGTH_SHORT).show();
intent.putExtra("data", (_NewsData) parent.getAdapter().getItem(position));
startActivity(intent);
}
});
}
/**
* 获取数据
*/
private void loadData() {
jsonObjectRequest = new JsonObjectRequest(Const.M04 + 1, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
// Log.d("xinwen", jsonObject.toString()+"");
try {
//获取服务器code
int code = jsonObject.getInt("code");
if(code == 200){
//获取数据成功
Log.d("xinwen", "data:------" + jsonObject.getString("data"));
//获取data所有数据
com.alibaba.fastjson.JSONObject data = JSON.parseObject(jsonObject.getString("data"));
if(TextUtils.isEmpty(data.getString("carousel"))){
listView.removeHeaderView(headView);
}else{
//获取轮播图数据
List<_SliderData> sliderDatas = JSON.parseArray(data.getString("carousel").toString(), _SliderData.class);
Log.d("xinwen", "sliderDatas:------" + sliderDatas.size());
//先清除缓存数据
dbManager.delete(_SliderData.class, WhereBuilder.b("moduleType", "=", "m04"));
if(sliderDatas==null){
listView.removeHeaderView(headView);
}else{
if(sliderDatas.size()==0){
listView.removeHeaderView(headView);
}else{
for (_SliderData cache: sliderDatas) {
cache.setModuleType("m04");
dbManager.save(cache);
}
loadSlider(sliderDatas);
}
}
}
//获取新闻
list = JSON.parseArray(data.getString("news").toString(), _NewsData.class);
new Thread(new Runnable() {
@Override
public void run() {
//先清除缓存数据
try {
dbManager.delete(_NewsData.class, WhereBuilder.b("moduleType", "=", "m04"));
//缓存
for (_NewsData cache:list ) {
cache.setModuleType("m04");
dbManager.save(cache);
}
} catch (DbException e) {
e.printStackTrace();
}
}
}).start();
/* Log.d("xinwen", list.size()+"-----111");
Log.d("xinwen", list.get(3).getImgextra().toString()+"-----22222");
Log.d("xinwen", list.get(0).getTitle()+"------3333");*/
time02 = System.currentTimeMillis();
Log.d("xinwen", time02 - time + "s");
myModule01Adapter.notifyDataSetChanged(list);
listView.setRefreshSuccess("更新完成"); // 通知加载成功
if(list.size()==20){
listView.startLoadMore();
}
index = 1;
}else if(code == 400){
listView.setRefreshFail("没有数据");
Toast.makeText(Module04.this,"没有数据",Toast.LENGTH_SHORT).show();
}else{
listView.setRefreshFail("加载错误");
Toast.makeText(Module04.this,"加载错误",Toast.LENGTH_SHORT).show();
}
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
loading.setVisibility(View.GONE);
}
},800);
} catch (JSONException e) {
e.printStackTrace();
} catch (DbException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
// Log.d("xinwen",volleyError.toString()+volleyError);
listView.setRefreshFail("网络不给力");
loading.setVisibility(View.GONE);
Toast.makeText(Module04.this, "网络不给力",Toast.LENGTH_SHORT).show();
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
queue.add(jsonObjectRequest);
jsonObjectRequest.setTag(TAG01);
}
}, 500);
}
/**
* 加载幻灯片数据
* @param sliderDatas
*/
private void loadSlider(List<_SliderData> sliderDatas) {
sliderLayout.removeAllSliders();
for (int i = 0; i <sliderDatas.size() ; i++) {
url_maps.put(sliderDatas.get(i).getTitle(),sliderDatas.get(i).getImgsrc());
Log.d("xinwen", sliderDatas.get(i).getTitle());
TextSliderView textSliderView = new TextSliderView(Module04.this);
// initialize a SliderLayout
textSliderView
.description(sliderDatas.get(i).getTitle())
.image(sliderDatas.get(i).getImgsrc())
.setScaleType(BaseSliderView.ScaleType.Fit)
.setOnSliderClickListener(Module04.this);
//add your extra information`
_NewsData slidNews = new _NewsData();
slidNews.setDocid(sliderDatas.get(i).getDocid());
slidNews.setDigest(sliderDatas.get(i).getDigest());
slidNews.setUrl(sliderDatas.get(i).getUrl());
slidNews.setTitle(sliderDatas.get(i).getTitle());
slidNews.setImgsrc(sliderDatas.get(i).getImgsrc());
textSliderView.bundle(new Bundle());
textSliderView.getBundle()
.putSerializable("extra", slidNews);
sliderLayout.addSlider(textSliderView);
}
}
/**
* 获取更多数据
*/
private void loadMoreData(int index) {
jsonObjectRequest = new JsonObjectRequest(Const.M04 + index, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
Log.d("xinwen", jsonObject.toString()+"");
try {
//获取服务器code
int code = jsonObject.getInt("code");
if(code == 200){
//获取数据成功
Log.d("xinwen", "data:------" + jsonObject.getString("data"));
//获取data所有数据
com.alibaba.fastjson.JSONObject data = JSON.parseObject(jsonObject.getString("data"));
//获取新闻
List<_NewsData> list2 = JSON.parseArray(data.getString("news").toString(), _NewsData.class);
for (_NewsData newdata: list2) {
list.add(newdata);
//缓存
newdata.setModuleType("m04");
dbManager.save(newdata);
}
myModule01Adapter.notifyDataSetChanged(list);
listView.setLoadMoreSuccess();
}else if(code == 400){
Toast.makeText(Module04.this,"没有更多了",Toast.LENGTH_SHORT).show();
listView.stopLoadMore();
}else{
Toast.makeText(Module04.this,"加载错误",Toast.LENGTH_SHORT).show();
listView.stopLoadMore();
}
} catch (JSONException e) {
e.printStackTrace();
} catch (DbException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
// Log.d("xinwen",volleyError.toString()+volleyError);
Toast.makeText(Module04.this,"网络不给力",Toast.LENGTH_SHORT).show();
listView.stopLoadMore();
}
});
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
queue.add(jsonObjectRequest);
jsonObjectRequest.setTag(TAG01);
}
}, 1000);
}
private void initViews() {
new StatusBar(this).initStatusBar();
toolbar = (Toolbar) findViewById(R.id.module01_toolbar);
toolbar.setTitle("党建研究");
setSupportActionBar(toolbar);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Module04.this.finish();
}
});
headView = LayoutInflater.from(this).inflate(R.layout.module01_list_header,null);
sliderLayout = (SliderLayout) headView.findViewById(R.id.module01_list_item01_slider);
sliderLayout.setPresetTransformer(SliderLayout.Transformer.Default);
sliderLayout.setPresetIndicator(SliderLayout.PresetIndicators.Right_Bottom);
sliderLayout.setCustomAnimation(new DescriptionAnimation());
sliderLayout.startAutoCycle(2500, 4000, true);
listView = (ZrcListView) findViewById(R.id.module01_list);
loading = (LinearLayout) findViewById(R.id.module01_loading);
// 设置下拉刷新的样式(可选,但如果没有Header则无法下拉刷新)
SimpleHeader header = new SimpleHeader(this);
header.setTextColor(0xff0066aa);
header.setCircleColor(0xff33bbee);
listView.setHeadable(header);
// 设置加载更多的样式(可选)
SimpleFooter footer = new SimpleFooter(this);
footer.setCircleColor(0xff33bbee);
listView.setFootable(footer);
// 设置列表项出现动画(可选)
listView.setItemAnimForTopIn(R.anim.topitem_in);
listView.setItemAnimForBottomIn(R.anim.bottomitem_in);
listView.setFootable(footer);
myModule01Adapter = new MyModule01Adapter(list, this);
listView.addHeaderView(headView);
listView.setAdapter(myModule01Adapter);
//加载本地缓存
dbManager = new MyApplication().getDbManager();
try {
if(dbManager.selector(_SliderData.class).where("moduleType","=","m04").findAll()!=null) {
if (dbManager.selector(_SliderData.class).where("moduleType", "=", "m04").findAll().size() > 0) {
List<_SliderData> sliderDatas = dbManager.selector(_SliderData.class).where("moduleType", "=", "m04").findAll();
loadSlider(sliderDatas);
// Toast.makeText(Module01.this, "加载了" + sliderDatas.size() + "条幻灯片缓存", Toast.LENGTH_SHORT).show();
} else {
// Toast.makeText(Module01.this, "没有幻灯片缓存数据", Toast.LENGTH_SHORT).show();
listView.removeHeaderView(headView);
}
}/*else{
listView.removeHeaderView(headView);
}*/
if(dbManager.selector(_NewsData.class).where("moduleType","=","m04").findAll()!=null) {
if (dbManager.selector(_NewsData.class).where("moduleType", "=", "m04").findAll().size() > 0) {
list = dbManager.selector(_NewsData.class).where("moduleType", "=", "m04").findAll();
myModule01Adapter.notifyDataSetChanged(list);
// Toast.makeText(Module01.this, "加载了" + list.size() + "条缓存", Toast.LENGTH_SHORT).show();
} else {
// Toast.makeText(Module01.this, "没有缓存数据", Toast.LENGTH_SHORT).show();
}
}
} catch (DbException e) {
e.printStackTrace();
}
listView.setOnRefreshStartListener(new ZrcListView.OnStartListener() {
@Override
public void onStart() {
/*Message message = handler.obtainMessage();
message.what = REFRESH_COMPLETE;
handler.sendMessageDelayed(message, 2500);//2.5秒后通知停止刷新*/
loadData();
}
});
// 加载更多事件回调(可选)
listView.setOnLoadMoreStartListener(new ZrcListView.OnStartListener() {
@Override
public void onStart() {
/*Message message = handler.obtainMessage();
message.what = LOADMORE_COMPLETE;
handler.sendMessageDelayed(message, 2500);//2.5秒后通知停止刷新*/
index++;
loadMoreData(index);
}
});
// vRefresh.autoRefresh();//自动刷新一次
// vRefresh.setLoading(false);//停止刷新
// vRefresh.setRefreshing(false);//让刷新消失
}
/* Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
switch (msg.what){
case LOADMORE_COMPLETE:
myModule01Adapter.notifyDataSetChanged(list);
listView.setLoadMoreSuccess();
listView.stopLoadMore();
break;
case REFRESH_COMPLETE:
list.clear();
sliderLayout.removeAllSliders();
loadData();
listView.startLoadMore(); // 开启LoadingMore功能
break;
}
}
};*/
@Override
protected void onStop() {
super.onStop();
queue.cancelAll(TAG01);
}
@Override
public void onSliderClick(BaseSliderView slider) {
//传递轮播数据
Intent intent = new Intent(Module04.this, NewsDetails.class);
intent.putExtra("data", slider.getBundle().getSerializable("extra"));
startActivity(intent);
}
}
| [
"494643819@qq.com"
] | 494643819@qq.com |
6efda397ee89f9506d413ebe704cbde0239bb2f9 | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/88/1278.java | 3e3d3b2e265b6119bf4a4def9f1a27cb115f1275 | [
"MIT"
] | permissive | qiuchili/ggnn_graph_classification | c2090fefe11f8bf650e734442eb96996a54dc112 | 291ff02404555511b94a4f477c6974ebd62dcf44 | refs/heads/master | 2021-10-18T14:54:26.154367 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,170 | java | import java.util.*;
package <missing>;
public class GlobalMembers
{
public static int Main()
{
int i;
int len = 0;
String str = new String(new char[32]);
String temp = new String(new char[32]);
//C++ TO JAVA CONVERTER TODO TASK: Pointer arithmetic is detected on this variable, so pointers on this variable are left unchanged:
char * ptr;
str = new Scanner(System.in).nextLine();
ptr = str;
for (; * ptr != '\0';++ptr)
{
if (Character.isDigit(*ptr))
{
len++;
}
else
{
//C++ TO JAVA CONVERTER TODO TASK: The memory management function 'memset' has no equivalent in Java:
memset(temp,0,(Character.SIZE / Byte.SIZE));
if (len == 0)
{
continue;
}
for (i = 0;i < len;++i)
{
temp = tangible.StringFunctions.changeCharacter(temp, len - i - 1, *(ptr - i - 1));
}
len = 0;
System.out.print(Integer.parseInt(temp));
System.out.print("\n");
}
}
if (len != 0)
{
for (i = 0;i < len;++i)
{
temp = tangible.StringFunctions.changeCharacter(temp, len - i - 1, *(ptr - i - 1));
}
System.out.print(Integer.parseInt(temp));
System.out.print("\n");
}
return 0;
}
}
| [
"y.yu@open.ac.uk"
] | y.yu@open.ac.uk |
df64310a282139fcd812d2131cb5d2b116f4a6a1 | 45787cf768bbe50c023ecbad92e49f41aa027191 | /2020.3.20/src/Main.java | d84c47ed44834fd4254d0677d92e505a626e2ddb | [] | no_license | qm1194688500/javatest | 93a85185eb312e64022b45d7c809c12a5e8d7355 | d7cf98dff4af926efdebb9a561bd469997dd6000 | refs/heads/master | 2021-07-02T04:25:54.170697 | 2021-01-31T10:13:19 | 2021-01-31T10:13:19 | 217,237,869 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNextLine()){
int n = sc.nextInt();
if (n==0){
return;
}
int[] arr = new int[n];
for (int i = 0; i <n ; i++) {
arr[i] = sc.nextInt();
}
int x = sc.nextInt();
int count = 0;
for (int i = 0; i <arr.length ; i++) {
if (arr[i]==x){
count++;
}
}
System.out.println(count);
}
}
}
| [
"1194688500@qq.com"
] | 1194688500@qq.com |
b9fdc335ac02d44170687556f8dc2db57e095a20 | 35857c6fd49b4f90a4043a4ad87ae379fd511650 | /TicTacToe/src/main/java/data/Game.java | 0c46cb34b3fd2fcdaf48af5ad717c2013a80787e | [] | no_license | Eliassoren/tictactoe_ai | 5c393caf75618eec3fa9c404a6625c2eeaa384ef | efcc02c72aaf0f2ed6a2a5bb67e91bf20968dd42 | refs/heads/master | 2021-05-16T11:27:26.666583 | 2017-09-28T12:24:51 | 2017-09-28T12:24:51 | 105,003,824 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,222 | java | package data;
import java.io.Serializable;
import java.util.Date;
/**
* @author nilstes
*/
public class Game implements Serializable {
private String gameId;
private Date startedAt;
private Date lastMoveAt;
private int numMoves = 0;
private String inviter;
private String invitee;
private boolean inviteAccepted = false;
private String turn;
private String winner;
private Square[][] board;
private int squares;
public Game() {
}
public Game(String gameId, String inviter, String invitee, int squares) {
board = new Square[squares][];
for(int x=0; x<squares; x++) {
board[x] = new Square[squares];
for(int y=0; y<squares; y++) {
board[x][y] = Square.e;
}
}
this.gameId = gameId;
this.inviter = inviter;
this.invitee = invitee;
this.squares = squares;
this.startedAt = new Date();
}
public String getGameId() {
return gameId;
}
public void setGameId(String gameId) {
this.gameId = gameId;
}
public boolean isInviteAccepted() {
return inviteAccepted;
}
public void setInviteAccepted(boolean inviteAccepted) {
this.inviteAccepted = inviteAccepted;
}
public int getSquares() {
return squares;
}
public void setSquares(int squares) {
this.squares = squares;
}
public Date getStartedAt() {
return startedAt;
}
public void setStartedAt(Date startedAt) {
this.startedAt = startedAt;
}
public Date getLastMoveAt() {
return lastMoveAt;
}
public void setLastMoveAt(Date lastMoveAt) {
this.lastMoveAt = lastMoveAt;
}
public String getTurn() {
return turn;
}
public void setTurn(String lastMoveBy) {
this.turn = lastMoveBy;
}
public String getInviter() {
return inviter;
}
public void setInviter(String inviter) {
this.inviter = inviter;
}
public String getInvitee() {
return invitee;
}
public void setInvitee(String invitee) {
this.invitee = invitee;
}
public String getWinner() {
return winner;
}
public void setWinner(String winner) {
this.winner = winner;
}
public Square[][] getBoard() {
return board;
}
public void setBoard(Square[][] board) {
this.board = board;
}
public int getNumMoves() {
return numMoves;
}
public void setNumMoves(int numMoves) {
this.numMoves = numMoves;
}
public void addMove(int x, int y, String player) {
board[y][x] = inviter.equals(player) ? Square.X : Square.O;
turn = inviter.equals(player) ? invitee : inviter;
lastMoveAt = new Date();
numMoves++;
}
@Override
public String toString() {
return "Game{" + "gameId=" + gameId + ", startedAt=" + startedAt + ", lastMoveAt=" + lastMoveAt + ", numMoves=" + numMoves + ", inviter=" + inviter + ", invitee=" + invitee + ", turn=" + turn + ", winner=" + winner + ", board=" + board + ", squares=" + squares + '}';
}
}
| [
"eliassorr@gmail.com"
] | eliassorr@gmail.com |
b46c06f0dd73170e3d53f1fdfc9d20ef8c680ace | 561792a13784c07f6bfef2d2370709de0f27e447 | /wtshop-dao/src/main/java/com/wtshop/dao/RaffleDao.java | 6e5f4ec7b9dabab05a55ad2968310893fab79909 | [] | no_license | 523570822/wtshop | a0b1d7390a6377af2307871ae20d8e669a8c4f4b | 6cfcf659babde3449df82ac57ce3b4bba5925ec4 | refs/heads/master | 2022-12-09T10:42:14.245989 | 2019-10-09T06:30:15 | 2019-10-09T06:30:15 | 139,920,178 | 0 | 1 | null | 2022-12-06T00:39:24 | 2018-07-06T01:52:39 | Java | UTF-8 | Java | false | false | 255 | java |
package com.wtshop.dao;
import com.wtshop.model.Activity;
import com.wtshop.model.Raffle;
/**
* Dao - 货品
*
*
*/
public class RaffleDao extends BaseDao<Raffle> {
/**
* 构造方法
*/
public RaffleDao() {
super(Raffle.class);
}
} | [
"523570822@qq.com"
] | 523570822@qq.com |
29685ee32cf699fc6da7395c4bd4267da39d570a | 19d6d820b7ce0941ebca65be7c19ecac702264a9 | /lib_volley/src/main/java/com/sinieco/lib_volley/volley/inter/IHttpListener.java | 11824f730876361b66d58aae996bd239f8a8bc2d | [] | no_license | JingMeng/ModuleDemo | e19dbe73c1847f3cae69da836bdc0c038aca07b7 | 4bc2667aa532bc6354b1bbb2a15e27c9b71822f8 | refs/heads/master | 2020-04-20T20:00:37.479494 | 2018-02-01T09:18:16 | 2018-02-01T09:18:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package com.sinieco.lib_volley.volley.inter;
import org.apache.http.HttpEntity;
import java.util.Map;
/**
* Created by BaiMeng on 2017/11/3.
* 联网的操作,成功后会放回HttpEntity
*/
public interface IHttpListener<M> {
void onSuccess(HttpEntity entity);
void onFail();
void addHeader(Map<String,String> headerMap);
}
| [
"baimeng1991@163.com"
] | baimeng1991@163.com |
f64fb2bd24511bb53046f8ccbd25f08573616f37 | 0d163ba4f4d770784c9ff5336cedf54f0dbee619 | /cubic training/src/com/files/files.java | ba7d4128e91deed9fd475a5b27277c9967b0fe9c | [] | no_license | PrashanthNagula/prashanth | 3b89e1315ee417a0a1c94c8e202511b2d1312f0e | d09c43a3a6e8a19a81b7b9124a167e330318abd2 | refs/heads/master | 2020-04-10T20:50:27.314982 | 2018-12-12T07:32:23 | 2018-12-12T07:32:23 | 161,279,904 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 368 | java | package com.files;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
public class files {
public static void main(String[] args) throws IOException {
FileInputStream fis=new FileInputStream("D:\\files\\dos.txt");
int i;
while((i=fis.read())!=-1){
System.out.print((char)i);
}
}
}
| [
"SRIKANTH@DESKTOP-R1D1J12"
] | SRIKANTH@DESKTOP-R1D1J12 |
b7033c796d5b009debdaa57cdc63a9fd5676e838 | 8559f66a27768632623a788f8d182b700b523010 | /SSM商场/SSM/src/main/java/com/songtian/entity/User.java | cb0e00807c5b684db7c420d7881935eb6e667220 | [] | no_license | Jinnnyoo/MyProject | 12e77b09a9b39cfc3de4ae0f38701564583b651f | 49ecc5c63d6d304f1789dc4fbf7c22a47a5e85d3 | refs/heads/master | 2022-12-14T03:57:11.073078 | 2019-06-05T03:43:12 | 2019-06-05T03:43:12 | 190,321,023 | 3 | 0 | null | 2022-11-16T05:20:39 | 2019-06-05T03:39:58 | Java | UTF-8 | Java | false | false | 647 | java | package com.songtian.entity;
public class User {
private int id;
private String name;
private String pwd;
private int sex;
private int phone;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public int getPhone() {
return phone;
}
public void setPhone(int phone) {
this.phone = phone;
}
}
| [
"’1693637327@qq.com’"
] | ’1693637327@qq.com’ |
2541e9af9d6534b6560af5b3509ad3ee5d7195a9 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/6/6_2a44611a5e35ab980d575913d0cf76b5245744e1/ServerHandler/6_2a44611a5e35ab980d575913d0cf76b5245744e1_ServerHandler_s.java | 489fd9b1c922bd0a92eda89958760beddb19a2c8 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 12,285 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.axis2.transport.nhttp;
import edu.emory.mathcs.backport.java.util.concurrent.Executor;
import edu.emory.mathcs.backport.java.util.concurrent.LinkedBlockingQueue;
import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor;
import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.util.threadpool.DefaultThreadFactory;
import org.apache.http.*;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.entity.ByteArrayEntity;
import org.apache.http.impl.DefaultConnectionReuseStrategy;
import org.apache.http.impl.DefaultHttpResponseFactory;
import org.apache.http.nio.ContentDecoder;
import org.apache.http.nio.ContentEncoder;
import org.apache.http.nio.NHttpServerConnection;
import org.apache.http.nio.NHttpServiceHandler;
import org.apache.http.params.HttpParams;
import org.apache.http.protocol.*;
import org.apache.http.util.EncodingUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.channels.Channels;
import java.nio.channels.Pipe;
/**
* The server connection handler. An instance of this class is used by each IOReactor, to
* process every connection. Hence this class should not store any data related to a single
* connection - as this is being shared.
*/
public class ServerHandler implements NHttpServiceHandler {
private static final Log log = LogFactory.getLog(ServerHandler.class);
/** the HTTP protocol parameters to adhere to */
private final HttpParams params;
/** the factory to create HTTP responses */
private final HttpResponseFactory responseFactory;
/** the HTTP response processor */
private final HttpProcessor httpProcessor;
/** the strategy to re-use connections */
private final ConnectionReuseStrategy connStrategy;
/** the Axis2 configuration context */
ConfigurationContext cfgCtx = null;
/** the thread pool to process requests */
private Executor workerPool = null;
private static final int WORKERS_MAX_THREADS = 40;
private static final long WORKER_KEEP_ALIVE = 100L;
private static final String REQUEST_SINK_CHANNEL = "request-sink-channel";
private static final String RESPONSE_SOURCE_CHANNEL = "response-source-channel";
private static final String REQUEST_BUFFER = "request-buffer";
private static final String RESPONSE_BUFFER = "response-buffer";
public ServerHandler(final ConfigurationContext cfgCtx, final HttpParams params) {
super();
this.cfgCtx = cfgCtx;
this.params = params;
this.responseFactory = new DefaultHttpResponseFactory();
this.httpProcessor = getHttpProcessor();
this.connStrategy = new DefaultConnectionReuseStrategy();
this.workerPool = new ThreadPoolExecutor(
1, WORKERS_MAX_THREADS, WORKER_KEEP_ALIVE, TimeUnit.SECONDS,
new LinkedBlockingQueue(),
new DefaultThreadFactory(new ThreadGroup("Server Worker thread group"), "HttpServerWorker"));
}
/**
* Process a new incoming request
* @param conn the connection
*/
public void requestReceived(final NHttpServerConnection conn) {
HttpContext context = conn.getContext();
HttpRequest request = conn.getHttpRequest();
context.setAttribute(HttpContext.HTTP_REQUEST, request);
// allocate temporary buffers to process this request
context.setAttribute(REQUEST_BUFFER, ByteBuffer.allocate(2048));
context.setAttribute(RESPONSE_BUFFER, ByteBuffer.allocate(2048));
try {
Pipe requestPipe = Pipe.open(); // the pipe used to process the request
Pipe responsePipe = Pipe.open(); // the pipe used to process the response
context.setAttribute(REQUEST_SINK_CHANNEL, requestPipe.sink());
context.setAttribute(RESPONSE_SOURCE_CHANNEL, responsePipe.source());
// create the default response to this request
HttpVersion httpVersion = request.getRequestLine().getHttpVersion();
HttpResponse response = responseFactory.newHttpResponse(
httpVersion, HttpStatus.SC_OK, context);
response.setParams(this.params);
// create a basic HttpEntity using the source channel of the response pipe
BasicHttpEntity entity = new BasicHttpEntity();
entity.setContent(Channels.newInputStream(responsePipe.source()));
if (httpVersion.greaterEquals(HttpVersion.HTTP_1_1)) {
entity.setChunked(true);
}
response.setEntity(entity);
// hand off processing of the request to a thread off the pool
workerPool.execute(
new ServerWorker(cfgCtx, conn, this,
request, Channels.newInputStream(requestPipe.source()),
response, Channels.newOutputStream(responsePipe.sink())));
} catch (IOException e) {
handleException("Error processing request received for : " +
request.getRequestLine().getUri(), e, conn);
}
}
/**
* Process ready input by writing it into the Pipe
* @param conn the connection being processed
* @param decoder the content decoder in use
*/
public void inputReady(final NHttpServerConnection conn, final ContentDecoder decoder) {
HttpContext context = conn.getContext();
Pipe.SinkChannel sink = (Pipe.SinkChannel) context.getAttribute(REQUEST_SINK_CHANNEL);
ByteBuffer inbuf = (ByteBuffer) context.getAttribute(REQUEST_BUFFER);
try {
while (decoder.read(inbuf) > 0) {
inbuf.flip();
sink.write(inbuf);
inbuf.compact();
}
if (decoder.isCompleted()) {
sink.close();
}
} catch (IOException e) {
handleException("I/O Error : " + e.getMessage(), e, conn);
}
}
public void responseReady(NHttpServerConnection conn) {
// New API method - should not require
}
/**
* Process ready output by writing into the channel
* @param conn the connection being processed
* @param encoder the content encoder in use
*/
public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder) {
HttpContext context = conn.getContext();
HttpResponse response = conn.getHttpResponse();
Pipe.SourceChannel source = (Pipe.SourceChannel) context.getAttribute(RESPONSE_SOURCE_CHANNEL);
ByteBuffer outbuf = (ByteBuffer) context.getAttribute(RESPONSE_BUFFER);
try {
int bytesRead = source.read(outbuf);
if (bytesRead == -1) {
encoder.complete();
} else {
outbuf.flip();
encoder.write(outbuf);
outbuf.compact();
}
if (encoder.isCompleted()) {
source.close();
if (!connStrategy.keepAlive(response, context)) {
conn.close();
}
}
} catch (IOException e) {
handleException("I/O Error : " + e.getMessage(), e, conn);
}
}
/**
* Commit the response to the connection. Processes the response through the configured
* HttpProcessor and submits it to be sent out
* @param conn the connection being processed
* @param response the response to commit over the connection
*/
public void commitResponse(final NHttpServerConnection conn, final HttpResponse response) {
try {
httpProcessor.process(response, conn.getContext());
conn.submitResponse(response);
} catch (HttpException e) {
handleException("Unexpected HTTP protocol error : " + e.getMessage(), e, conn);
} catch (IOException e) {
handleException("IO error submiting response : " + e.getMessage(), e, conn);
}
}
/**
* Handle connection timeouts by shutting down the connections
* @param conn the connection being processed
*/
public void timeout(final NHttpServerConnection conn) {
HttpRequest req = (HttpRequest) conn.getContext().getAttribute(HttpContext.HTTP_REQUEST);
log.warn("Connection Timeout for request to : " + req.getRequestLine().getUri());
shutdownConnection(conn);
}
public void connected(final NHttpServerConnection conn) {
log.trace("New incoming connection");
}
public void closed(final NHttpServerConnection conn) {
log.trace("Connection closed");
}
/**
* Handle HTTP Protocol violations with an error response
* @param conn the connection being processed
* @param e the exception encountered
*/
public void exception(final NHttpServerConnection conn, final HttpException e) {
HttpContext context = conn.getContext();
HttpRequest request = conn.getHttpRequest();
HttpVersion ver = request.getRequestLine().getHttpVersion();
HttpResponse response = responseFactory.newHttpResponse(
ver, HttpStatus.SC_BAD_REQUEST, context);
byte[] msg = EncodingUtils.getAsciiBytes("Malformed HTTP request: " + e.getMessage());
ByteArrayEntity entity = new ByteArrayEntity(msg);
entity.setContentType("text/plain; charset=US-ASCII");
response.setEntity(entity);
commitResponse(conn, response);
}
/**
* Handle IO errors while reading or writing to underlying channels
* @param conn the connection being processed
* @param e the exception encountered
*/
public void exception(NHttpServerConnection conn, IOException e) {
if (e instanceof ConnectionClosedException) {
log.debug("I/O error: " + e.getMessage());
} else {
log.error("I/O error: " + e.getMessage());
}
shutdownConnection(conn);
}
// ----------- utility methods -----------
private void handleException(String msg, Exception e, NHttpServerConnection conn) {
log.error(msg, e);
if (conn != null) {
shutdownConnection(conn);
}
}
/**
* Shutdown the connection ignoring any IO errors during the process
* @param conn the connection to be shutdown
*/
private void shutdownConnection(final HttpConnection conn) {
try {
conn.shutdown();
} catch (IOException ignore) {}
}
/**
* Return the HttpProcessor for responses
* @return the HttpProcessor that processes HttpResponses of this server
*/
private HttpProcessor getHttpProcessor() {
BasicHttpProcessor httpProcessor = new BasicHttpProcessor();
httpProcessor.addInterceptor(new ResponseDate());
httpProcessor.addInterceptor(new ResponseServer());
httpProcessor.addInterceptor(new ResponseContent());
httpProcessor.addInterceptor(new ResponseConnControl());
return httpProcessor;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
ac37c34e0e871e01e115b937b13d0f9cabeac966 | a74d5512a22da389e3d5eb8dfb2d0cb014000cdd | /src/pt/alexobjets/formes/Forme.java | 5df5c73d01184e63a4b5ee928edef12f31fb8659 | [] | no_license | AlexandreLourencinho/JavaExos | 056c960c46bd3af0124824b3c0f30555bcf89143 | 1d53ff048852cc76e97f2e0dd580aa03959723dd | refs/heads/master | 2023-06-19T07:01:57.528053 | 2021-07-19T10:18:31 | 2021-07-19T10:18:31 | 383,176,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 213 | java | package pt.alexobjets.formes;
public abstract class Forme
{
private String nom = "forme";
public float Aire()
{
return 0;
}
public String getNom()
{
return nom;
}
}
| [
"alexandre.lourencinho@gmail.com"
] | alexandre.lourencinho@gmail.com |
038c1395f4fc4c6ad3eef0f3fd2f10a059a00ef8 | 88f0846d9832c187a7ed1223281d2b7fd7cf2d4a | /src/main/java/se/lexicon/JPAAssignment/data/RecipeIngredientRepository.java | 357220ab8751414632196b8f4c274deafe809360 | [] | no_license | PatrikJohansson05/JPAAssignment | 264638397435f04a60b23865481ff2eea4f06e44 | fa71522b169e8a5b543aa80d9f5c44558f106318 | refs/heads/master | 2022-12-06T19:00:53.680862 | 2020-08-23T16:33:29 | 2020-08-23T16:33:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package se.lexicon.jpa_assignment.data;
import org.springframework.data.repository.CrudRepository;
import se.lexicon.jpa_assignment.entity.RecipeIngredient;
public interface RecipeIngredientRepository extends CrudRepository<RecipeIngredient, Integer> {
RecipeIngredient save(RecipeIngredient recipeIngredient);
}
| [
"patrik.vislanda@gmail.com"
] | patrik.vislanda@gmail.com |
0032269a4f4e4493d44182da66fc2d4b67a2b456 | 5728563b4c50c4c445d8f108bd7f32d31bdd44e5 | /giphy-cms/src/main/java/com/bloomreach/cms/openui/rest/giphy/model/GiphyItem.java | 3cf2feb1b2ed881b1d939c5ecfb8c2587ecb53c6 | [] | no_license | ksalic/brxm-open-ui-external-document-picker | c581bf0de3ad58893a66b83f6619b856138799be | a58960c8e23a015136808a9d20492ddae3ddc4dd | refs/heads/master | 2023-01-10T01:36:06.151714 | 2020-05-25T10:53:46 | 2020-05-25T10:53:46 | 200,209,846 | 2 | 5 | null | 2023-01-04T21:57:26 | 2019-08-02T09:46:33 | Java | UTF-8 | Java | false | false | 3,981 | java | package com.bloomreach.cms.openui.rest.giphy.model;
import java.util.*;
import com.fasterxml.jackson.annotation.*;
@JsonIgnoreProperties(ignoreUnknown = true)
public class GiphyItem {
private Type type;
private String id;
private String slug;
private String url;
private String bitlyGIFURL;
private String bitlyURL;
private String embedURL;
private String username;
private String source;
private String contentURL;
private String sourceTLD;
private String sourcePostURL;
private Long isSticker;
private String importDatetime;
private String trendingDatetime;
private Images images;
private String title;
private User user;
@JsonProperty("type")
public Type getType() { return type; }
@JsonProperty("type")
public void setType(Type value) { this.type = value; }
@JsonProperty("id")
public String getID() { return id; }
@JsonProperty("id")
public void setID(String value) { this.id = value; }
@JsonProperty("slug")
public String getSlug() { return slug; }
@JsonProperty("slug")
public void setSlug(String value) { this.slug = value; }
@JsonProperty("url")
public String getURL() { return url; }
@JsonProperty("url")
public void setURL(String value) { this.url = value; }
@JsonProperty("bitly_gif_url")
public String getBitlyGIFURL() { return bitlyGIFURL; }
@JsonProperty("bitly_gif_url")
public void setBitlyGIFURL(String value) { this.bitlyGIFURL = value; }
@JsonProperty("bitly_url")
public String getBitlyURL() { return bitlyURL; }
@JsonProperty("bitly_url")
public void setBitlyURL(String value) { this.bitlyURL = value; }
@JsonProperty("embed_url")
public String getEmbedURL() { return embedURL; }
@JsonProperty("embed_url")
public void setEmbedURL(String value) { this.embedURL = value; }
@JsonProperty("username")
public String getUsername() { return username; }
@JsonProperty("username")
public void setUsername(String value) { this.username = value; }
@JsonProperty("source")
public String getSource() { return source; }
@JsonProperty("source")
public void setSource(String value) { this.source = value; }
@JsonProperty("content_url")
public String getContentURL() { return contentURL; }
@JsonProperty("content_url")
public void setContentURL(String value) { this.contentURL = value; }
@JsonProperty("source_tld")
public String getSourceTLD() { return sourceTLD; }
@JsonProperty("source_tld")
public void setSourceTLD(String value) { this.sourceTLD = value; }
@JsonProperty("source_post_url")
public String getSourcePostURL() { return sourcePostURL; }
@JsonProperty("source_post_url")
public void setSourcePostURL(String value) { this.sourcePostURL = value; }
@JsonProperty("is_sticker")
public Long getIsSticker() { return isSticker; }
@JsonProperty("is_sticker")
public void setIsSticker(Long value) { this.isSticker = value; }
@JsonProperty("import_datetime")
public String getImportDatetime() { return importDatetime; }
@JsonProperty("import_datetime")
public void setImportDatetime(String value) { this.importDatetime = value; }
@JsonProperty("trending_datetime")
public String getTrendingDatetime() { return trendingDatetime; }
@JsonProperty("trending_datetime")
public void setTrendingDatetime(String value) { this.trendingDatetime = value; }
@JsonProperty("images")
public Images getImages() { return images; }
@JsonProperty("images")
public void setImages(Images value) { this.images = value; }
@JsonProperty("title")
public String getTitle() { return title; }
@JsonProperty("title")
public void setTitle(String value) { this.title = value; }
@JsonProperty("user")
public User getUser() { return user; }
@JsonProperty("user")
public void setUser(User value) { this.user = value; }
}
| [
"kenan.salic@bloomreach.com"
] | kenan.salic@bloomreach.com |
c10be27599314b1aaa5f1ccbbad6cc5cf52c4b82 | 77d4f9e18ea7b1aa7f46ad57a9dea2c89f9ba816 | /demo/src/main/java/top/tocome/io/File.java | 8c6d30a498c5f5b73c17627b99469f5c44997349 | [] | no_license | EmiliaSagiri/Htmlutil | afa4639ca231df8971891dcf7aed2622dc23c5f3 | 77c50d1350917c089a5591e6c1f30a0222d924f5 | refs/heads/master | 2023-08-17T10:22:28.831780 | 2021-09-16T10:03:10 | 2021-09-16T10:03:10 | 404,996,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,422 | java | package top.tocome.io;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class File {
/**
* 读取文件
*
* @param filePath 源文件路径
* @return 文件内容
*/
public static String read(String filePath) {
try {
return Stream.readString(new FileInputStream(filePath));
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 写入文件
*
* @param filePath 源文件路径
* @param contents 写入的内容
* @param append 添加或覆盖
* @return 执行结果
*/
public static boolean write(String filePath, byte[] contents, boolean append) {
try {
return Stream.write(new FileOutputStream(filePath, append), contents);
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
/**
* 复制文件
*
* @param filePath 源文件路径
* @param savePath 保存的路径
* @param append 添加或覆盖
* @return 执行结果
*/
public static boolean copy(String filePath, String savePath, boolean append) {
try {
return Stream.copy(new FileInputStream(filePath), new FileOutputStream(savePath, append));
} catch (Exception e) {
e.printStackTrace();
}
return false;
}
}
| [
"uidq3372@v01.net"
] | uidq3372@v01.net |
df43bcdfea21d745d91c3aeab025bcb2fefe45b7 | fa1408365e2e3f372aa61e7d1e5ea5afcd652199 | /src/testcases/CWE191_Integer_Underflow/s01/CWE191_Integer_Underflow__byte_min_multiply_53a.java | 594feab5dd0f9fc3afcaea0c50d68e7c5c9f5e12 | [] | no_license | bqcuong/Juliet-Test-Case | 31e9c89c27bf54a07b7ba547eddd029287b2e191 | e770f1c3969be76fdba5d7760e036f9ba060957d | refs/heads/master | 2020-07-17T14:51:49.610703 | 2019-09-03T16:22:58 | 2019-09-03T16:22:58 | 206,039,578 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 2,463 | java | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE191_Integer_Underflow__byte_min_multiply_53a.java
Label Definition File: CWE191_Integer_Underflow.label.xml
Template File: sources-sinks-53a.tmpl.java
*/
/*
* @description
* CWE: 191 Integer Underflow
* BadSource: min Set data to the max value for byte
* GoodSource: A hardcoded non-zero, non-min, non-max, even number
* Sinks: multiply
* GoodSink: Ensure there will not be an underflow before multiplying data by 2
* BadSink : If data is negative, multiply by 2, which can cause an underflow
* Flow Variant: 53 Data flow: data passed as an argument from one method through two others to a fourth; all four functions are in different classes in the same package
*
* */
package testcases.CWE191_Integer_Underflow.s01;
import testcasesupport.*;
public class CWE191_Integer_Underflow__byte_min_multiply_53a extends AbstractTestCase
{
public void bad() throws Throwable
{
byte data;
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = Byte.MIN_VALUE;
(new CWE191_Integer_Underflow__byte_min_multiply_53b()).badSink(data );
}
public void good() throws Throwable
{
goodG2B();
goodB2G();
}
/* goodG2B() - use goodsource and badsink */
private void goodG2B() throws Throwable
{
byte data;
/* FIX: Use a hardcoded number that won't cause underflow, overflow, divide by zero, or loss-of-precision issues */
data = 2;
(new CWE191_Integer_Underflow__byte_min_multiply_53b()).goodG2BSink(data );
}
/* goodB2G() - use badsource and goodsink */
private void goodB2G() throws Throwable
{
byte data;
/* POTENTIAL FLAW: Use the maximum size of the data type */
data = Byte.MIN_VALUE;
(new CWE191_Integer_Underflow__byte_min_multiply_53b()).goodB2GSink(data );
}
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
public static void main(String[] args) throws ClassNotFoundException,
InstantiationException, IllegalAccessException
{
mainFromParent(args);
}
}
| [
"bqcuong2212@gmail.com"
] | bqcuong2212@gmail.com |
f093602b8105e6ddf25d0a5966005bca46efe749 | cd23b382a14399d01a13ad8d427ce03dc7bb6e50 | /src/comparators/AidLoadPriorityComparator.java | 062a524a6941302530cedb1540051faf0fe907f7 | [
"MIT"
] | permissive | kjgarbutt/EngD_Final_Model | 5e720685c659c6a1c445adc16321ead9b3e6eda2 | eb5aa40172f434ea54cd629d5b8c2671cac8a1aa | refs/heads/master | 2020-04-28T15:33:21.952772 | 2019-03-13T08:50:15 | 2019-03-13T08:50:15 | 175,378,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package comparators;
import java.util.Comparator;
import objects.AidLoad;
/**
* Orders in terms of decreasing priority
*
* @author KJGarbutt
*
*/
public class AidLoadPriorityComparator implements Comparator<AidLoad> {
@Override
public int compare(AidLoad o1, AidLoad o2) {
int o1_priority = o1.getTargetCommunity().getIntegerAttribute("NPRIO");
int o2_priority = o2.getTargetCommunity().getIntegerAttribute("NPRIO");
if (o1_priority == o2_priority)
return 0;
else if (o1_priority < o2_priority)
return 1;
else
return -1;
}
} | [
"kurtis.garbutt@gmail.com"
] | kurtis.garbutt@gmail.com |
4c548b601fa3465ba3dae8f6c8a6c33705674c3b | 7130641f4aa2570609f2b27e6baaac8a23f050d8 | /csx-bsf-core/src/main/java/com/yh/csx/bsf/core/http/HttpClient.java | 3f8fc030b7eedd3d9143ccbbce6117993064a458 | [
"Apache-2.0"
] | permissive | lixj2009/csx-bsf-all | 36856e23ff4296a4439da6a70203d368bd8c3c3b | 1d8497022b60a0be78e8fdf7b371f727c52baf4b | refs/heads/master | 2022-11-28T02:30:15.732681 | 2020-01-14T06:32:14 | 2020-01-14T06:32:14 | 233,546,095 | 0 | 2 | Apache-2.0 | 2022-11-21T22:38:15 | 2020-01-13T08:23:58 | Java | UTF-8 | Java | false | false | 8,820 | java | package com.yh.csx.bsf.core.http;
import com.fasterxml.jackson.core.type.TypeReference;
import com.yh.csx.bsf.core.serialize.JsonSerializer;
import com.yh.csx.bsf.core.util.ConvertUtils;
import lombok.val;
import org.apache.commons.codec.Charsets;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.EntityBuilder;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.ContentBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.util.StringUtils;
import java.io.Closeable;
import java.lang.reflect.Field;
import java.util.*;
/**
* Created by yanglikai on 2019/5/23.
* by chejiangyi
*/
public interface HttpClient extends Closeable {
String get(String var1);
String get(String var1, HttpClient.Params var2);
<T> T get(String var1, TypeReference<T> var2);
<T> T get(String var1, HttpClient.Params var2, TypeReference<T> var3);
String post(String var1, HttpClient.Params var2);
<T> T post(String var1, HttpClient.Params var2, TypeReference<T> var3);
String put(String var1, HttpClient.Params var2);
<T> T put(String var1, HttpClient.Params var2, TypeReference<T> var3);
String delete(String var1);
<T> T delete(String var1, TypeReference<T> var2);
String delete(String var1, HttpClient.Params var2);
<T> T delete(String var1, HttpClient.Params var2, TypeReference<T> var3);
public static enum EnumHttpConnectParam
{
//Tcp是否粘包(批量封包发送)
TcpNoDelay(true),
//总连接池大小
MaxTotal(500),
//单个host连接池大小
DefaultMaxPerRoute(500),
//连接是否需要验证有效时间
ValidateAfterInactivity(10000),
//连接超时时间 【常用】
ConnectTimeout(10000),
//socket通讯超时时间 【常用】
SocketTimeout(15000),
//请求从连接池获取超时时间
ConnectionRequestTimeout(2000),
//连接池共享
ConnectionManagerShared(true),
//回收时间间隔 s
EvictIdleConnectionsTime(60),
//是否回收
IsEvictExpiredConnections(true),
//长连接保持时间 s
ConnectionTimeToLive(-1),
//重试次数 【常用】
RetryCount(-1);
private Object defaultvalue;
public Object getDefaultValue() {
return defaultvalue;
}
EnumHttpConnectParam(Object defaultvalue) {
this.defaultvalue=defaultvalue;
}
public static EnumHttpConnectParam get(String value) {
for (val v : EnumHttpConnectParam.values()) {
if (v.name().equalsIgnoreCase(value)) {
return v;
}
}
return null;
}
}
/**
* 初始化参数
*/
public static class InitMap extends HashMap<EnumHttpConnectParam,Object>
{
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
for(Entry entry : this.entrySet()) {
stringBuilder.append(entry.getKey()+":"+entry.getValue()+",");
}
return StringUtils.trimTrailingCharacter(stringBuilder.toString(),',');
}
public void trySetDefaultParams(EnumHttpConnectParam key,Object defaultValue)
{
if(this.containsKey(key))
{
return;
}
this.put(key,defaultValue);
}
public void trySetDefaultParams(String key,Object defaultValue)
{
this.trySetDefaultParams(EnumHttpConnectParam.valueOf(key),defaultValue);
}
public <T> T getParams(EnumHttpConnectParam key,Class<T> type)
{
Object value = this.get(key);
if(value ==null)
{ return null;}
return ConvertUtils.convert(value,type);
}
public <T> T getParams(String key,Class<T> type)
{
return getParams(EnumHttpConnectParam.valueOf(key),type);
}
}
/**
* 请求参数
*/
public static class Params {
private List<Header> headers;
private Map<String, Object> data;
private Map<String, Collection<ContentBody>> bodyMultimap;
private ContentType contentType;
private Params() {
this.headers = new ArrayList<>();
this.contentType = ContentType.DEFAULT_TEXT;
}
public static HttpClient.Params.Builder custom() {
return new HttpClient.Params.Builder();
}
public List<Header> getHeaders() {
return this.headers;
}
public void setHeaders(List<Header> headers) {
this.headers = headers;
}
public ContentType getContentType() {
return this.contentType;
}
public void setContentType(ContentType contentType) {
this.contentType = contentType;
}
@Override
public String toString() {
if (this.contentType == ContentType.APPLICATION_JSON) {
return new JsonSerializer().serialize(this.data);
} else {
List<NameValuePair> tmp = new ArrayList<>();
Iterator var2 = this.data.entrySet().iterator();
while (var2.hasNext()) {
Map.Entry<String, Object> entry = (Map.Entry) var2.next();
tmp.add(new BasicNameValuePair((String) entry.getKey(), entry.getValue().toString()));
}
return URLEncodedUtils.format(tmp, Charsets.UTF_8);
}
}
public HttpEntity toEntity() {
if (!this.contentType.equals(ContentType.MULTIPART_FORM_DATA)) {
return EntityBuilder.create().setContentType(this.contentType).setContentEncoding("utf-8").setText(this.toString()).build();
} else {
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
Iterator var2 = this.data.keySet().iterator();
while (var2.hasNext()) {
String key = (String) var2.next();
Object value = this.data.get(key);
try {
builder.addPart(key, new StringBody(value.toString(), ContentType.APPLICATION_FORM_URLENCODED));
} catch (Exception var8) {
throw new HttpException(var8);
}
}
Map<String, Collection<ContentBody>> items = this.bodyMultimap;
Iterator var10 = items.keySet().iterator();
while (var10.hasNext()) {
String key = (String) var10.next();
Collection<ContentBody> value = (Collection) items.get(key);
Iterator var6 = value.iterator();
while (var6.hasNext()) {
ContentBody contentBody = (ContentBody) var6.next();
builder.addPart(key, contentBody);
}
}
return builder.build();
}
}
public static class Builder {
private Map<String, Object> data = new HashMap<>();
private Map<String, Collection<ContentBody>> bodyMultimap = new HashMap<>();
private List<Header> headers = new ArrayList<>();
private ContentType contentType;
public Builder() {
}
public HttpClient.Params.Builder header(String k, String v) {
this.headers.add(new BasicHeader(k, v));
return this;
}
public HttpClient.Params.Builder add(Object object) {
try {
for (Field field : object.getClass().getDeclaredFields()) {
if(!field.isAccessible())
{field.setAccessible(true);}
this.data.put(field.getName(), field.get(object));
}
}
catch (Exception e)
{
throw new HttpException(e);
}
return this;
}
public HttpClient.Params.Builder add(Map<String, Object> params) {
this.data.putAll(params);
return this;
}
public HttpClient.Params.Builder add(String k, Object v) {
if (k != null && v != null) {
this.data.put(k, v);
return this;
}
throw new IllegalArgumentException("The specified k or v cannot be null");
}
public HttpClient.Params.Builder addContentBody(String k, ContentBody contentBody) {
if (contentBody == null) {
throw new IllegalArgumentException("The specified content body cannot be null");
}
if(!this.bodyMultimap.containsKey(k))
{ this.bodyMultimap.put(k,new ArrayList<>());}
this.bodyMultimap.get(k).add(contentBody);
return this;
}
public HttpClient.Params.Builder setContentType(ContentType contentType) {
this.contentType = contentType;
return this;
}
public HttpClient.Params build() {
HttpClient.Params params = new HttpClient.Params();
params.headers = this.headers;
params.contentType = this.contentType;
params.data = this.data;
params.bodyMultimap = this.bodyMultimap;
return params;
}
}
}
}
| [
"lixj.lixj123@aliyun.com"
] | lixj.lixj123@aliyun.com |
69eb5ab93106901996ccd668b62d159728d2a06e | b979284c043455f41387a21786b33b2376a5c040 | /src/com/mihaelacosovan/springMvc/User.java | ffab7b12d4cf6c4ff3a3d5666d7c5319f4c18826 | [] | no_license | MihaelaCosovan/Assignment6 | 7bab733527a41c38fe3f2d7a95fe7b1a9eb80a1a | c449418a3302399eccf4f9b91b79b89f09ea9cfd | refs/heads/master | 2020-04-27T17:31:53.248514 | 2019-03-08T11:21:38 | 2019-03-08T11:21:38 | 174,520,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 219 | java | package com.mihaelacosovan.springMvc;
public class User {
private String userName;
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
}
| [
"Mihaela.Macovei@hartehanks.com"
] | Mihaela.Macovei@hartehanks.com |
b235371a9e2fb326d8378929f7122252a465d94b | 92dd6bc0a9435c359593a1f9b309bb58d3e3f103 | /src/geeksforgeeks/_01DataStructures_BinaryTree_21.java | cda2abdcab63688790f465b60c6b899a122f4c9d | [
"MIT"
] | permissive | darshanhs90/Java-Coding | bfb2eb84153a8a8a9429efc2833c47f6680f03f4 | da76ccd7851f102712f7d8dfa4659901c5de7a76 | refs/heads/master | 2023-05-27T03:17:45.055811 | 2021-06-16T06:18:08 | 2021-06-16T06:18:08 | 36,981,580 | 3 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,754 | java | package geeksforgeeks;
import geeksforgeeks._01DataStructures_BinaryTree_00.Node;
/*
* http://www.geeksforgeeks.org/maximum-width-of-a-binary-tree/
* Maximum width of a binary tree
*/;
public class _01DataStructures_BinaryTree_21 {
static _01DataStructures_BinaryTree_00 tree=new _01DataStructures_BinaryTree_00();
public static void main(String[] args) {
_01DataStructures_BinaryTree_00 binaryTree1=new _01DataStructures_BinaryTree_00();
binaryTree1.insert(null,null,1);
binaryTree1.insert(1,"left",2);
binaryTree1.insert(1,"right",3);
binaryTree1.insert(2,"left",4);
binaryTree1.insert(2,"right",5);
binaryTree1.insert(3,"right",8);
binaryTree1.insert(8,"left",6);
binaryTree1.insert(8,"right",7);
binaryTree1.preOrder();
System.out.println(getMaxWidthLevelOrder(binaryTree1));
}
private static int getHeight(Node node) {
if(node==null)
return 0;
else
{
int leftHeight=getHeight(node.left);
int rightHeight=getHeight(node.right);
return 1+((leftHeight>rightHeight)?leftHeight:rightHeight);
}
}
private static int getMaxWidthLevelOrder(_01DataStructures_BinaryTree_00 binaryTree1) {
return getMaxWidthLevelOrder(binaryTree1.rootNode);
}
private static int getMaxWidthLevelOrder(Node node) {
int maxWidth=0;
for (int i = 1; i <= getHeight(node); i++) {
int width=getWidth(node,i);
if(width>maxWidth)
maxWidth=width;
}
return maxWidth;
}
private static int getWidth(Node node, int level) {
if(node==null)
return 0;
if(level==1)
return 1;
else if(level>1)
return getWidth(node.left,level-1)+getWidth(node.right,level-1);
else
return 0;
}
}
| [
"hsdars@gmail.com"
] | hsdars@gmail.com |
3f7607636287fce96c2633d74bc099286c62bd0d | 1c18616fb66d5d0316beb2df68676029b405c3dd | /src/main/java/students/vija_m/lesson_11/level_2/task_7/BookRepository.java | 0389c962dd4aa87aca7ce0f4898aba448e3984c6 | [] | no_license | Vija-M/jg-java-1-online-spring-april-tuesday-2021 | edb4c73cc4a13bdaa132bccca6a1c6d0088b2d5d | 49817deb3052f24332442d2454932714915b50ad | refs/heads/main | 2023-07-14T03:16:12.145252 | 2021-08-24T16:20:50 | 2021-08-24T16:20:50 | 399,513,003 | 2 | 0 | null | 2021-08-24T15:17:35 | 2021-08-24T15:17:34 | null | UTF-8 | Java | false | false | 140 | java | package students.vija_m.lesson_11.level_2.task_7;
interface BookRepository {
Long save(Book book);
boolean delete(Long bookId);
}
| [
"vija.riga@gmailcom"
] | vija.riga@gmailcom |
473f810d715a535392a228691bc14fdcf87c2835 | 768074be4d83d803ef1ee6658f2db4767164bd29 | /src/main/java/com/imooc/pojo/ItemsComments.java | 10ddc794b83b4749aca066e5d864501598dcb0d1 | [] | no_license | skydavidshen/mybatis-generator-tools | cd05a8c441d2e4e6cf94ca9019cf562df3830b18 | d25189aefbeb531cb4deba1752da69218d059c81 | refs/heads/master | 2023-09-04T00:58:58.568354 | 2021-11-09T10:03:49 | 2021-11-09T10:03:49 | 426,177,219 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,334 | java | package com.imooc.pojo;
import java.util.Date;
import javax.persistence.*;
@Table(name = "items_comments")
public class ItemsComments {
/**
* id主键
*/
@Id
private String id;
/**
* 用户id 用户名须脱敏
*/
@Column(name = "user_id")
private String userId;
@Column(name = "user_fake_nickname")
private String userFakeNickname;
@Column(name = "user_face")
private String userFace;
/**
* 商品id
*/
@Column(name = "item_id")
private String itemId;
/**
* 商品名称
*/
@Column(name = "item_name")
private String itemName;
/**
* 商品规格id 可为空
*/
@Column(name = "item_spec_id")
private String itemSpecId;
/**
* 规格名称 可为空
*/
@Column(name = "sepc_name")
private String sepcName;
/**
* 评价等级 1:好评 2:中评 3:差评
*/
@Column(name = "comment_level")
private Integer commentLevel;
/**
* 评价内容
*/
private String content;
/**
* 创建时间
*/
@Column(name = "created_time")
private Date createdTime;
/**
* 更新时间
*/
@Column(name = "updated_time")
private Date updatedTime;
/**
* 获取id主键
*
* @return id - id主键
*/
public String getId() {
return id;
}
/**
* 设置id主键
*
* @param id id主键
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取用户id 用户名须脱敏
*
* @return user_id - 用户id 用户名须脱敏
*/
public String getUserId() {
return userId;
}
/**
* 设置用户id 用户名须脱敏
*
* @param userId 用户id 用户名须脱敏
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* @return user_fake_nickname
*/
public String getUserFakeNickname() {
return userFakeNickname;
}
/**
* @param userFakeNickname
*/
public void setUserFakeNickname(String userFakeNickname) {
this.userFakeNickname = userFakeNickname;
}
/**
* @return user_face
*/
public String getUserFace() {
return userFace;
}
/**
* @param userFace
*/
public void setUserFace(String userFace) {
this.userFace = userFace;
}
/**
* 获取商品id
*
* @return item_id - 商品id
*/
public String getItemId() {
return itemId;
}
/**
* 设置商品id
*
* @param itemId 商品id
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* 获取商品名称
*
* @return item_name - 商品名称
*/
public String getItemName() {
return itemName;
}
/**
* 设置商品名称
*
* @param itemName 商品名称
*/
public void setItemName(String itemName) {
this.itemName = itemName;
}
/**
* 获取商品规格id 可为空
*
* @return item_spec_id - 商品规格id 可为空
*/
public String getItemSpecId() {
return itemSpecId;
}
/**
* 设置商品规格id 可为空
*
* @param itemSpecId 商品规格id 可为空
*/
public void setItemSpecId(String itemSpecId) {
this.itemSpecId = itemSpecId;
}
/**
* 获取规格名称 可为空
*
* @return sepc_name - 规格名称 可为空
*/
public String getSepcName() {
return sepcName;
}
/**
* 设置规格名称 可为空
*
* @param sepcName 规格名称 可为空
*/
public void setSepcName(String sepcName) {
this.sepcName = sepcName;
}
/**
* 获取评价等级 1:好评 2:中评 3:差评
*
* @return comment_level - 评价等级 1:好评 2:中评 3:差评
*/
public Integer getCommentLevel() {
return commentLevel;
}
/**
* 设置评价等级 1:好评 2:中评 3:差评
*
* @param commentLevel 评价等级 1:好评 2:中评 3:差评
*/
public void setCommentLevel(Integer commentLevel) {
this.commentLevel = commentLevel;
}
/**
* 获取评价内容
*
* @return content - 评价内容
*/
public String getContent() {
return content;
}
/**
* 设置评价内容
*
* @param content 评价内容
*/
public void setContent(String content) {
this.content = content;
}
/**
* 获取创建时间
*
* @return created_time - 创建时间
*/
public Date getCreatedTime() {
return createdTime;
}
/**
* 设置创建时间
*
* @param createdTime 创建时间
*/
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
/**
* 获取更新时间
*
* @return updated_time - 更新时间
*/
public Date getUpdatedTime() {
return updatedTime;
}
/**
* 设置更新时间
*
* @param updatedTime 更新时间
*/
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
} | [
"david.shen@heavengifts.com"
] | david.shen@heavengifts.com |
13cbfc43f6d4f33715463eb9ee6b2d2d97a5d9ad | 208ba847cec642cdf7b77cff26bdc4f30a97e795 | /fg/fe/src/androidTest/java/org.wp.fe/models/CategoryNodeInstrumentationTest.java | 78b95946f349172f90d664d085961c10fe5dd0d1 | [] | no_license | kageiit/perf-android-large | ec7c291de9cde2f813ed6573f706a8593be7ac88 | 2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8 | refs/heads/master | 2021-01-12T14:00:19.468063 | 2016-09-27T13:10:42 | 2016-09-27T13:10:42 | 69,685,305 | 0 | 0 | null | 2016-09-30T16:59:49 | 2016-09-30T16:59:48 | null | UTF-8 | Java | false | false | 1,093 | java | package org.wp.fe.models;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.test.InstrumentationTestCase;
import android.test.RenamingDelegatingContext;
import org.wp.fe.TestUtils;
public class CategoryNodeInstrumentationTest extends InstrumentationTestCase {
protected Context testContext;
protected Context targetContext;
@Override
protected void setUp() {
// Run tests in an isolated context
targetContext = new RenamingDelegatingContext(getInstrumentation().getTargetContext(), "test_");
testContext = getInstrumentation().getContext();
}
public void testLoadDB_MalformedCategoryParentId() {
SQLiteDatabase db = TestUtils.loadDBFromDump(targetContext, testContext,
"malformed_category_parent_id.sql");
// This line failed before #36 was solved
CategoryNode node = CategoryNode.createCategoryTreeFromDB(1);
}
public void tearDown() throws Exception {
targetContext = null;
testContext = null;
super.tearDown();
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
af54859eee4b53c063d2e1b79435c889316f7bcd | 4389cc8a1eb14a1673a157313288f57e4a623064 | /app/src/main/java/tonghai/com/checkrankdotaautochess/utils/Constants.java | 4c0897dd579571383cf950189e4c690c984df789 | [] | no_license | haitongbg/CheckRankDotaAutoChess | 3e47f9681481d80c1f96af280a8cb7422b67c484 | d1d0f4566953d04c3709df8136bf442e9d247310 | refs/heads/master | 2020-04-27T12:38:30.016114 | 2019-03-07T12:19:24 | 2019-03-07T12:19:24 | 174,338,717 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,348 | java | package tonghai.com.checkrankdotaautochess.utils;
public class Constants {
public static class Url {
// DOMAIN
public static final String DOMAIN = "http://www.autochess-stats.com/backend/api/dacprofiles/";
public static final String GET_PROFILE = "{steamId64}";
public static final String REQUEST_FETCH = "{steamId64}/requestfetch/";
public static final String GET_FRIENDS = "{steamId64}/friends";
public static final String LOOKUP_STEAMID = "https://steamid.xyz/q";
}
public static class Key {
public static final String STEAM_ID_64 = "steamId64";
public static final String DEVICE_ID = "deviceId";
public static final String DEVICE_TOKEN = "deviceToken";
public static final String CACHED_PROFILE = "cachedProfile";
public static final String ID = "id";
}
public static class Rank {
public static final String RANK_UNRANK = "unrank";
public static final String RANK_PAWN = "pawn";
public static final String RANK_KNIGHT = "knight";
public static final String RANK_BISHOP = "bishop";
public static final String RANK_ROCK = "rock";
public static final String RANK_KING = "king";
public static final String RANK_QUEEN = "queen";
}
public static class DataNotify {
}
}
| [
"haitongbg@gmail.com"
] | haitongbg@gmail.com |
4933389403f4c96d10b42f77e4501bd56ee4a320 | df0ce6508d1bdedaf24a0286b8879f1e3f52c845 | /复习/_19_Strategy/SelectionSort.java | 47da193f249eb2d76f0d006ff80bdcf7e9bfe84a | [] | no_license | myeva00/test | 207240b42c8a20938bc132e76116ad63c9a4a289 | df417b08e4d560f943cceb6abae07ed8ee009192 | refs/heads/main | 2023-05-15T10:21:20.419882 | 2021-06-19T14:47:53 | 2021-06-19T14:47:53 | 346,330,925 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 486 | java | public class SelectionSort implements Sort {
@Override
public int[] sort(int[] arr) {
int len = arr.length;
int temp;
for (int i = 0;i<len;i++) {
temp = arr[i];
int j;
int samllestLocation = i;
for (j = i+1;j<len;j++) {
if (arr[j]<temp){
temp = arr[j];
samllestLocation=j;
}
}
arr[samllestLocation] = arr[i];
arr[i] = temp;
}
System.out.println("选择排序");
return arr;
}
}
| [
"1138252245@qq.com"
] | 1138252245@qq.com |
c773cb5358d01bb02b8021e058b02e1dfc71132c | 56f7650386eee7a31c84e78fcc5fe204a744eff0 | /main/einvoice-commons/oasis/src/main/java/oasis/names/specification/ubl/schema/xsd/commonaggregatecomponents_2/CorporateRegistrationSchemeType.java | 0e883fc13ac2b25baf32207350568e49aa0039b9 | [] | no_license | egcarlos/einvoice | 968153d4b96fa51823c734ef0136141dd7166078 | 42edf502a265462686cdd36512b3396ecd31b07a | refs/heads/master | 2021-05-01T13:48:30.674282 | 2015-11-25T15:16:04 | 2015-11-25T15:16:04 | 26,558,590 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,628 | java |
package oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_2;
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.XmlType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.CorporateRegistrationTypeCodeType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.IDType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.NameType;
/**
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>ABIE</ccts:ComponentType><ccts:DictionaryEntryName>Corporate Registration Scheme. Details</ccts:DictionaryEntryName><ccts:Definition>Information directly relating a scheme for corporate registration of businesses.</ccts:Definition><ccts:ObjectClass>Corporate Registration Scheme</ccts:ObjectClass></ccts:Component>
* </pre>
*
*
* <p>Clase Java para CorporateRegistrationSchemeType complex type.
*
* <p>El siguiente fragmento de esquema especifica el contenido que se espera que haya en esta clase.
*
* <pre>
* <complexType name="CorporateRegistrationSchemeType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}ID" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}Name" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}CorporateRegistrationTypeCode" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2}JurisdictionRegionAddress" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CorporateRegistrationSchemeType", propOrder = {
"id",
"name",
"corporateRegistrationTypeCode",
"jurisdictionRegionAddress"
})
public class CorporateRegistrationSchemeType {
@XmlElement(name = "ID", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected IDType id;
@XmlElement(name = "Name", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected NameType name;
@XmlElement(name = "CorporateRegistrationTypeCode", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected CorporateRegistrationTypeCodeType corporateRegistrationTypeCode;
@XmlElement(name = "JurisdictionRegionAddress")
protected List<AddressType> jurisdictionRegionAddress;
/**
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Corporate Registration Scheme. Identifier</ccts:DictionaryEntryName><ccts:Definition>Identifies the scheme.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Corporate Registration Scheme</ccts:ObjectClass><ccts:PropertyTerm>Identifier</ccts:PropertyTerm><ccts:RepresentationTerm>Identifier</ccts:RepresentationTerm><ccts:DataType>Identifier. Type</ccts:DataType><ccts:Examples>"ASIC" in Australia</ccts:Examples></ccts:Component>
* </pre>
*
*
* @return
* possible object is
* {@link IDType }
*
*/
public IDType getID() {
return id;
}
/**
* Define el valor de la propiedad id.
*
* @param value
* allowed object is
* {@link IDType }
*
*/
public void setID(IDType value) {
this.id = value;
}
/**
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Corporate Registration Scheme. Name</ccts:DictionaryEntryName><ccts:Definition>Identifies the scheme by name.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Corporate Registration Scheme</ccts:ObjectClass><ccts:PropertyTerm>Name</ccts:PropertyTerm><ccts:RepresentationTerm>Name</ccts:RepresentationTerm><ccts:DataType>Name. Type</ccts:DataType><ccts:Examples>"Australian Securities and Investment Commission" in Australia</ccts:Examples></ccts:Component>
* </pre>
*
*
* @return
* possible object is
* {@link NameType }
*
*/
public NameType getName() {
return name;
}
/**
* Define el valor de la propiedad name.
*
* @param value
* allowed object is
* {@link NameType }
*
*/
public void setName(NameType value) {
this.name = value;
}
/**
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Corporate Registration Scheme. Corporate Registration Type Code. Code</ccts:DictionaryEntryName><ccts:Definition>Identifies the type of scheme.</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Corporate Registration Scheme</ccts:ObjectClass><ccts:PropertyTerm>Corporate Registration Type Code</ccts:PropertyTerm><ccts:RepresentationTerm>Code</ccts:RepresentationTerm><ccts:DataType>Code. Type</ccts:DataType><ccts:Examples>"ACN"</ccts:Examples></ccts:Component>
* </pre>
*
*
* @return
* possible object is
* {@link CorporateRegistrationTypeCodeType }
*
*/
public CorporateRegistrationTypeCodeType getCorporateRegistrationTypeCode() {
return corporateRegistrationTypeCode;
}
/**
* Define el valor de la propiedad corporateRegistrationTypeCode.
*
* @param value
* allowed object is
* {@link CorporateRegistrationTypeCodeType }
*
*/
public void setCorporateRegistrationTypeCode(CorporateRegistrationTypeCodeType value) {
this.corporateRegistrationTypeCode = value;
}
/**
*
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:qdt="urn:oasis:names:specification:ubl:schema:xsd:QualifiedDatatypes-2" xmlns:udt="urn:un:unece:uncefact:data:specification:UnqualifiedDataTypesSchemaModule:2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>ASBIE</ccts:ComponentType><ccts:DictionaryEntryName>Corporate Registration Scheme. Jurisdiction Region_ Address. Address</ccts:DictionaryEntryName><ccts:Definition>Associates the registration scheme with particulars that identify and locate the geographic area to which the scheme applies.</ccts:Definition><ccts:Cardinality>0..n</ccts:Cardinality><ccts:ObjectClass>Corporate Registration Scheme</ccts:ObjectClass><ccts:PropertyTermQualifier>Jurisdiction Region</ccts:PropertyTermQualifier><ccts:PropertyTerm>Address</ccts:PropertyTerm><ccts:AssociatedObjectClass>Address</ccts:AssociatedObjectClass></ccts:Component>
* </pre>
* Gets the value of the jurisdictionRegionAddress 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 jurisdictionRegionAddress property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getJurisdictionRegionAddress().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AddressType }
*
*
*/
public List<AddressType> getJurisdictionRegionAddress() {
if (jurisdictionRegionAddress == null) {
jurisdictionRegionAddress = new ArrayList<AddressType>();
}
return this.jurisdictionRegionAddress;
}
}
| [
"carlos.echeverria@labtech.pe"
] | carlos.echeverria@labtech.pe |
f0d4b31ae4a9f2eeb18509b42a431462ecb03073 | 72e8e3f11f221d2089e98ece5a41b7d1223c11e2 | /textFiles/src/textFiles/readFile.java | c21fe4effd8037f52adb99e2a6a163157a7dc81d | [] | no_license | Laladread/eclipse-java-practice | d5dc42ecfb6b87b3e45fa6284fdf02e23ee587a6 | d087e13c194b1eec8f41d1e8eb2875ff9dc196f6 | refs/heads/master | 2020-03-11T11:27:39.054133 | 2018-04-17T22:11:15 | 2018-04-17T22:11:15 | 129,970,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,025 | java | package textFiles;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.Scanner;
public class readFile {
public static void main(String[] args) {
ArrayList list = new ArrayList();
Scanner input = new Scanner(System.in);
System.out.println("Enter file name: ");
String fileName = input.next();
try {
//Scanner fileIn = new Scanner(new File("text.rtf"));
FileReader inputFile = new FileReader("source.txt");
BufferedReader bufferReader = new BufferedReader(inputFile);
String line;
while((line = bufferReader.readLine()) !=null) {
String[] numbers = line.split(" ");
for (int i =0; i<numbers.length;i++)
{
int nextNumber = Integer.parseInt(numbers[i]);
list.add(nextNumber);
}
}
}catch (Exception e)
{
System.out.println("File was not found" + e.getMessage() + e.getStackTrace());
}
for (int i =0; i<list.size();i++)
{
System.out.println(list.get(i));
}
}
}
| [
"lking37@student.gsu.edu"
] | lking37@student.gsu.edu |
f8ab26b44b56e6ea5bf46b011b3eefb96e647a39 | 7f91fdc0ab52e058ef8aa2f28b2d6ca02fa80606 | /praktikum11/predefinedclasses/TestMath.java | 4c906ebef2856fa3259713474290f67a3811717b | [] | no_license | IrfanChairurrachman/Java-OOP | ad0aec5080655fc87fdca41db328c86c5788202b | 9d110057cf2c982ea08cbb4094884c015681b297 | refs/heads/master | 2023-02-22T07:57:03.861688 | 2021-01-17T14:23:27 | 2021-01-17T14:23:27 | 326,415,312 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,111 | java | package predefinedclasses;
public class TestMath {
public static void main(String[] args) {
System.out.println("PI = "+Math.PI);
System.out.println("E = "+Math.E);
System.out.println("Sinus 45 = "+Math.sin(45.0));
System.out.println("Cosinus 45 = "+Math.cos(45.0));
System.out.println("Tangen 45 = "+Math.tan(45.0));
System.out.println("Asin() 1 = "+Math.asin(1.0));
System.out.println("Acos() 1 = "+Math.acos(1.0));
System.out.println("Atan() 1 = "+Math.atan(1.0));
System.out.println("log() 1 = "+Math.log(1.0));
System.out.println("3 pangkat 4 = "+Math.pow(3, 4));
System.out.println("Akar kuadrat dari 4 = "+Math.sqrt(4));
System.out.println("Absolut -10 = "+Math.abs(-10));
System.out.println("Max(4,5) = "+Math.max(4,5));
System.out.println("Min(4,5) = "+Math.min(4,5));
System.out.println("Round 1.567674 = "+Math.round(1.567674));
System.out.println("Ceil 1.567674 = "+Math.ceil(1.567674));
System.out.println("Floor 1.567674 = "+Math.floor(1.567674));
}
}
| [
"irfanchairurrachman@gmail.com"
] | irfanchairurrachman@gmail.com |
14fdeab685cc25dacdb8a704a18bdae9bf9ab0e0 | 0867ee048c2acce065a7b21d2f04b61ace79389b | /TestToolWorkspace/JDKNewClass/src/com/lambda.java | 8c33d1af4b14b414a487f606cd46eb90502077eb | [] | no_license | HSZJS/ideaWorkspace | a3bff8fa706d366200790f5bfb0695c7f7fb99cf | e77ee2cdcb3de94bc33db76184706d0ba2d9deb0 | refs/heads/master | 2021-01-18T07:55:56.555803 | 2017-03-11T12:40:36 | 2017-03-11T12:40:36 | 84,296,860 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 208 | java | package com;
/**
* Created by heshuzhan on 2017/3/8.
*/
public class lambda {
public lambda(){}
public int add(int a,int b){
System.out.println("ok hello!");
return a+b;
}
}
| [
"xhdhjava@foxmail.com"
] | xhdhjava@foxmail.com |
7297f5422af2c1f361f2195f81a261be86b1c6f2 | 01b1bf2b8e98f67d7d391e0181b155b0105564b0 | /tests/empty_method_param_pick/src/Super.java | b523a0201c602dccafbfa99e4b1cedb5cd4900c3 | [
"MIT"
] | permissive | nimakarimipour/AnnotationInjector | fd906f7a9ec86fcf21be676fbca5e37eb15c59c6 | 048f6cf61f40223affb5c1af89a468b153486a2b | refs/heads/master | 2023-08-17T13:26:04.338040 | 2021-10-13T00:06:41 | 2021-10-13T00:06:41 | 277,684,566 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 228 | java | package com.uber;
import javax.annotation.Nullable;
public class Super {
Object test() {
return new Object();
}
class SuperInner {
Object bar(@Nullable Object foo) {
return foo;
}
}
}
| [
"karimipour.nima@gmail.com"
] | karimipour.nima@gmail.com |
73f17474f51600bb4b3dfec4d2c089fe66fb3d86 | cf78072cb671d9683052f3de69526ad643b65009 | /NTAJ410 WS/NTAJ410 Final/JDBCProj1/src/com/nt/jdbc/CLOBRetrieve.java | f4af073326f670d6f599593467045bafc69ee181 | [] | no_license | ochhaneji/Servlet-Practice | 236a92b6117d03fe7a1c39237e15d5e2428b94ab | 56a41fd13c93e7137e4d69a37e017cb816f4759e | refs/heads/master | 2020-05-05T07:54:37.667994 | 2019-04-10T03:10:24 | 2019-04-10T03:10:24 | 179,842,429 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 137 | java | package com.nt.jdbc;
public class CLOBRetrieve {
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
| [
"omochhane@gmail.com"
] | omochhane@gmail.com |
62ebb137888bab7cb81d7c1f3188c949d4af919e | 53bccff5365ed674c9c9107f3feb3580979149f4 | /app/src/main/java/com/example/finalyearproject/fragments/ReauthenticateDialogFragment.java | f477ce7e78795be334c0859ca0de59a9548e43d0 | [] | no_license | AdamClayton98/FinalYearProject | 009b4b692230dfd748ee0833cc776366c45b85fd | b6b98e1d4d68194767425e2967e8d88e80ae69c0 | refs/heads/master | 2023-04-19T01:22:00.326922 | 2021-05-03T23:10:59 | 2021-05-03T23:10:59 | 348,438,745 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,447 | java | package com.example.finalyearproject.fragments;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.DialogFragment;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import com.example.finalyearproject.DatabaseMethods;
import com.example.finalyearproject.LoginActivity;
import com.example.finalyearproject.MainActivity;
import com.example.finalyearproject.R;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.OnSuccessListener;
import com.google.firebase.auth.AuthCredential;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.EmailAuthProvider;
import com.google.firebase.auth.FirebaseAuth;
public class ReauthenticateDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState){
Context context = getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = requireActivity().getLayoutInflater();
DatabaseMethods databaseMethods=new DatabaseMethods(getContext());
View view = inflater.inflate(R.layout.reauthenticate_dialog, null);
EditText passwordInput = view.findViewById(R.id.reauthDialogInput);
builder.setView(view).setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
String passwordText = passwordInput.getText().toString();
if(passwordText.isEmpty()){
Toast.makeText(context, "Password cannot be empty", Toast.LENGTH_SHORT).show();
dialog.dismiss();
return;
}
AuthCredential credential = EmailAuthProvider.getCredential(FirebaseAuth.getInstance().getCurrentUser().getEmail(), passwordText);
FirebaseAuth.getInstance().getCurrentUser().reauthenticate(credential).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
String newEmail = getArguments().getString("email");
String newPassword=getArguments().getString("password");
String name=getArguments().getString("name");
String username=getArguments().getString("username");
if(!newEmail.isEmpty()){
FirebaseAuth.getInstance().getCurrentUser().updateEmail(newEmail).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(context,"E-Mail Updated",Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(context,"Email update failed",Toast.LENGTH_SHORT).show();
}
});
}
if(!newPassword.isEmpty()){
FirebaseAuth.getInstance().getCurrentUser().updatePassword(newPassword).addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
Toast.makeText(context, "Password updated", Toast.LENGTH_SHORT).show();
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Toast.makeText(context, "Password failed to update", Toast.LENGTH_SHORT).show();
}
});
}
if(!name.isEmpty()){
databaseMethods.updateUserInfo(name, "NAME");
}
if(!username.isEmpty()){
databaseMethods.updateUserInfo(username, "USERNAME");
}
}
}).addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
dialog.dismiss();
Toast.makeText(context, "Password incorrect, could not re-authenticate", Toast.LENGTH_SHORT).show();
}
});
}
}).setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
return builder.create();
}
}
| [
"u1764481@unimail.hud.ac.uk"
] | u1764481@unimail.hud.ac.uk |
6ab347ac6c188a7525765e0a24caa35e93bc8318 | cca64dea7bb01183c34a18b136c8be016d98c347 | /interactive_engine/groot-client/src/main/java/com/alibaba/graphscope/groot/sdk/schema/EdgeLabel.java | 3d57141d96e8a397937224dfb9b62ccb6e14ede8 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license",
"FSFAP",
"BSD-3-Clause-Clear",
"GPL-1.0-or-later",
"BSD-2-Clause-Views",
"Bitstream-Vera",
"MPL-2.0",
"LicenseRef-scancode-warranty-disclaimer",
"OFL-1.1",
"BSD-3-Clause",
"APAFML",
"0BSD",
"LicenseRef-scancode-free-unknown",
"CC-B... | permissive | alibaba/GraphScope | 857b6a87215913267f8c27ff8a6cedee9649ee24 | 8695655bc2f47113dc4d8aa6bd9532a92273e6d8 | refs/heads/main | 2023-09-01T18:20:57.592936 | 2023-09-01T09:06:55 | 2023-09-01T09:06:55 | 307,894,865 | 2,931 | 456 | Apache-2.0 | 2023-09-14T11:34:10 | 2020-10-28T03:19:33 | Rust | UTF-8 | Java | false | false | 2,581 | java | package com.alibaba.graphscope.groot.sdk.schema;
import com.alibaba.graphscope.proto.groot.TypeEnumPb;
import java.util.ArrayList;
import java.util.List;
public class EdgeLabel extends Label {
private List<EdgeRelation> relations;
private EdgeLabel(
String label, List<Property> properties, List<EdgeRelation> relations, String comment) {
this.label = label;
this.properties = properties;
this.relations = relations;
this.comment = comment;
this.type = TypeEnumPb.EDGE;
}
public List<EdgeRelation> getRelations() {
return relations;
}
public static Builder newBuilder() {
return new Builder();
}
public static class Builder {
private String label;
private List<Property> properties;
private List<EdgeRelation> relations;
private String comment;
public Builder() {
this.properties = new ArrayList<>();
this.relations = new ArrayList<>();
}
public Builder setLabel(String label) {
this.label = label;
return this;
}
public Builder setComment(String comment) {
this.comment = comment;
return this;
}
public Builder addRelation(String srcLabel, String dstLabel) {
relations.add(new EdgeRelation(label, srcLabel, dstLabel));
return this;
}
public Builder addProperty(Property property) {
properties.add(property);
return this;
}
public Builder addProperty(Property.Builder property) {
properties.add(property.build());
return this;
}
public Builder addAllProperties(List<Property> properties) {
properties.addAll(properties);
return this;
}
public EdgeLabel build() {
return new EdgeLabel(label, properties, relations, comment);
}
}
public static class EdgeRelation {
private String edgeLabel;
private String srcLabel;
private String dstLabel;
public String getEdgeLabel() {
return edgeLabel;
}
public String getSrcLabel() {
return srcLabel;
}
public String getDstLabel() {
return dstLabel;
}
public EdgeRelation(String edgeLabel, String srcLabel, String dstLabel) {
this.edgeLabel = edgeLabel;
this.srcLabel = srcLabel;
this.dstLabel = dstLabel;
}
}
}
| [
"noreply@github.com"
] | alibaba.noreply@github.com |
d635ea2dc986092b764ae3f845c68b116d8cd867 | 08d6334cc0c811a14081e36f16bba5b1b1dfe1da | /src/et3/threes/Tile_2D.java | 47e56f8274e23e377b29ed5dbf162003c5e1ffcd | [] | no_license | OlivierNappert/Game-Threes | 3c9ec2fd3e2efd733047084b5a7813f152380805 | 249170a06519a83090a8e1ca5bd719b088b45378 | refs/heads/master | 2021-01-23T02:05:37.501767 | 2017-03-23T15:22:43 | 2017-03-23T15:22:43 | 85,963,779 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,447 | java | package et3.threes;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.RoundRectangle2D;
public class Tile_2D {
public final static int TILES_SIZE = 100;
public final static int TILES_ROUND = 20;
public final static int TILES_MARGIN = 10;
public final static int TEXT_HEIGHT = 60;
private final static Font TILES_FONT = new Font("Arial", Font.PLAIN, 32);
private final static Color TILES_1_BACKGROUNDCOLOR = new Color(0x11c7f5);
private final static Color TILES_1_FOREGROUNDCOLOR = new Color(0xffffff);
private final static Color TILES_2_BACKGROUNDCOLOR = new Color(0xf5116c);
private final static Color TILES_2_FOREGROUNDCOLOR = new Color(0xffffff);
private final static Color OTHER_TILES_BACKGROUNDCOLOR = new Color(0xffffff);
private final static Color OTHER_TILES_FOREGROUNDCOLOR = new Color(0x000000);
private final static Color EMPTY_TILES_COLOR = new Color(0x038787);
private int val;
private int x;
private int y;
protected RoundRectangle2D geom;
// Constructeur
public Tile_2D(int x_pos, int y_pos) {
val = 0;
x = x_pos;
y = y_pos;
geom = new RoundRectangle2D.Double(x, y, TILES_SIZE, TILES_SIZE, TILES_ROUND, TILES_ROUND);
}
// Renvoi la valeur de la tuile appelante
public int getVal() {
return val;
}
// Donne une valeur a la tuile appelante
public void setVal(int value) {
val = value;
}
// Donne la couleur de fond des tuiles
public Color getBackground(int value) {
switch (value) {
case 0:
return EMPTY_TILES_COLOR;
case 1:
return TILES_1_BACKGROUNDCOLOR;
case 2:
return TILES_2_BACKGROUNDCOLOR;
default:
return OTHER_TILES_BACKGROUNDCOLOR;
}
}
// Donne la couleur des nombres des tuiles
public Color getForeground(int value) {
switch (value) {
case 0:
return EMPTY_TILES_COLOR;
case 1:
return TILES_1_FOREGROUNDCOLOR;
case 2:
return TILES_2_FOREGROUNDCOLOR;
default:
return OTHER_TILES_FOREGROUNDCOLOR;
}
}
// Fonction qui trace la tuile avec les fonctions du contexte graphique 2D
public void draw(Graphics2D g) {
g.setColor(getBackground(this.val));
g.fill(geom);
g.setFont(TILES_FONT);
g.setColor(getForeground(this.val));
String s = Integer.toString(val);
int textWidth = (int) g.getFontMetrics(TILES_FONT).stringWidth(s);
g.drawString(s, (int) (geom.getX() + (TILES_SIZE - textWidth)/2), (int) (geom.getY() + TEXT_HEIGHT));
}
}
| [
"olivier.sportif@free.fr"
] | olivier.sportif@free.fr |
5e0815d5359a2254b907f58abc369256e1c9a594 | 6491c3a11f29a4fd36bd19561f8d5acae3ad981d | /module-template/module-produce/src/main/java/com/wjs/produce/executor/BeatService.java | 6f6c69141a82fcaee39ceb3198a2a0088d6edc94 | [] | no_license | wjs1989/spring-cloud-template | 89c7c760b178e2005f41801479c89081ded0a1a7 | 2f967c15d392d9def8732154480545fc070d8294 | refs/heads/master | 2023-06-18T18:02:09.066094 | 2021-07-13T10:32:27 | 2021-07-13T10:32:27 | 289,705,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,548 | java | package com.wjs.produce.executor;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.concurrent.*;
public class BeatService {
ScheduledExecutorService es = null;
public BeatService(){
es = new ScheduledThreadPoolExecutor(1, new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
Thread thread = new Thread(r);
thread.setDaemon(true);
thread.setName("com.wjs.produce.executor.BateService.sender");
return thread;
}
});
}
public void bate(BeatInfo info){
es.schedule(new BeatTask(info),5000,TimeUnit.MILLISECONDS);
}
class BeatTask implements Runnable{
BeatInfo beatInfo;
public BeatTask(BeatInfo beatInfo) {
this.beatInfo = beatInfo;
}
@Override
public void run() {
System.out.println(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))+
"->"+ Thread.currentThread().getName()+":"+beatInfo.getName());
BeatService.this.es.schedule(BeatService.this.new BeatTask(this.beatInfo),5000,TimeUnit.MILLISECONDS);
}
}
public static void main(String[] args) throws InterruptedException {
BeatService beatService = new BeatService();
BeatInfo beatInfo = new BeatInfo();
beatInfo.setName("module-kafka");
beatService.bate(beatInfo);
Thread.sleep(100000);
}
}
| [
"wenjs001@163.com"
] | wenjs001@163.com |
108d3e9e2b8f8f57da3fcc9cd628403de2fb7f0f | ddba9a7881c00ef091d6ad34690cfdfe0df6b579 | /src/main/java/com/example/demo/DataApplication.java | 84ae6d9b35d80db2a0316d8c21b254406062703a | [] | no_license | KisLupin/spring-connect-mysql | 5ca8651cb90093686cde2d13fd94ccbc021f759b | a6eeb6364c85faabddc099dbe6fbf7e69651b5f7 | refs/heads/master | 2022-10-16T13:30:32.968005 | 2020-06-15T16:52:07 | 2020-06-15T16:52:07 | 272,494,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 304 | java | package com.example.demo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DataApplication {
public static void main(String[] args) {
SpringApplication.run(DataApplication.class, args);
}
}
| [
"linh.nt.iot@gmail.com"
] | linh.nt.iot@gmail.com |
3546b66329d3ab9c5f916a737ab18d2508564ed0 | 9aea646d1fbd5328d89ceedfbdceb8cb5e19a8d7 | /Hospital Appointment System/app/src/main/java/com/example/hastanerandevusistemi/bolum.java | ac8f63f1fa36ba99865118acc75bde3444d457c4 | [] | no_license | iremaslandogan/Hospital-Appointment-System | b5859c19101eab443c6cfca26c6d0a67c7ec9af8 | a65b0ef367ccf0a2a314cc9e23d645c30976b024 | refs/heads/master | 2020-09-04T21:00:02.895134 | 2019-11-06T02:03:17 | 2019-11-06T02:03:17 | 219,890,829 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 832 | java | package com.example.hastanerandevusistemi;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
public class bolum extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bolumduzen);
}
public void bolumguncelle(View view) {
Intent intocan = new Intent( bolum.this, bolumguncelle.class);
startActivity(intocan);
}
public void bolumekle(View view) {
Intent intocan = new Intent(bolum.this, bolumekle.class);
startActivity(intocan);
}
public void bolumsil(View view) {
Intent intocan = new Intent(bolum.this, bolumsil.class);
startActivity(intocan);
}
}
| [
"iremaslandogan@gmail.com"
] | iremaslandogan@gmail.com |
d54c906e08bd86e01949a3f653a9137db9fab0c6 | 15222e0cc8e243aa1e2b85a1293080500a35dfb1 | /app/src/test/java/com/example/pas_10rpl1_08/ExampleUnitTest.java | 7e6c5f86133d76b3574cd97b3f351c54172c2260 | [] | no_license | DaffaAhmadSM/PAS_10RPL1_8 | c7c6cb9c886ceb883f7d6d95cfc90f37007675eb | ceb95ba64ce41857672a34c577bc63b8ecf2f770 | refs/heads/master | 2023-05-20T05:24:43.275844 | 2021-06-10T04:22:22 | 2021-06-10T04:22:22 | 375,567,662 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 386 | java | package com.example.pas_10rpl1_08;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"daffamubaroqi321@gmail.com"
] | daffamubaroqi321@gmail.com |
9a3d93cd6e979c2f9aecde584bbe338a5cc8f801 | e7cb38a15026d156a11e4cf0ea61bed00b837abe | /groundwork-gw-vijava/vijava/src/main/java/com/doublecloud/vim25/ArrayOfClusterRuleSpec.java | e173a9f6236fe2ccc4e3d05263000bdae5be8143 | [
"BSD-3-Clause"
] | permissive | wang-shun/groundwork-trunk | 5e0ce72c739fc07f634aeefc8f4beb1c89f128af | ea1ca766fd690e75c3ee1ebe0ec17411bc651a76 | refs/heads/master | 2020-04-01T08:50:03.249587 | 2018-08-20T21:21:57 | 2018-08-20T21:21:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,139 | java | /*================================================================================
Copyright (c) 2013 Steve Jin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of copyright holders nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
================================================================================*/
package com.doublecloud.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
public class ArrayOfClusterRuleSpec {
public ClusterRuleSpec[] ClusterRuleSpec;
public ClusterRuleSpec[] getClusterRuleSpec() {
return this.ClusterRuleSpec;
}
public ClusterRuleSpec getClusterRuleSpec(int i) {
return this.ClusterRuleSpec[i];
}
public void setClusterRuleSpec(ClusterRuleSpec[] ClusterRuleSpec) {
this.ClusterRuleSpec=ClusterRuleSpec;
}
} | [
"gibaless@gmail.com"
] | gibaless@gmail.com |
2a11ead55b93133df64c5606da9170d62edd04b6 | c041b467d370288b305e230baee50a855eab726a | /design/TimeBasedKeyValue.java | ebd54092af37cadc9407df0732a6fa5395f4509c | [] | no_license | maskaravivek/leetcode | bd5a2ad08f283e991e89e62bcabba6ee8a462e87 | f7308d0aab685fc62a5758c2e6ea8f1ca86a5bcb | refs/heads/master | 2023-02-28T21:18:29.027847 | 2021-02-10T17:47:44 | 2021-02-10T17:47:44 | 255,443,743 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,627 | java | package design;
import java.util.Hashtable;
import java.util.TreeMap;
class TimeBasedKey {
TreeMap<Integer, Integer> treeMap;
public TimeBasedKey() {
treeMap = new TreeMap<Integer, Integer>();
}
public void add(int time, int value) {
treeMap.put(time, value);
}
public int get(int time) {
return treeMap.get(treeMap.floorKey(time));
}
}
public class TimeBasedKeyValue {
static Hashtable<String, TimeBasedKey> map = new Hashtable<>();
public TimeBasedKeyValue() {
map = new Hashtable<>();
}
public static void main(String[] args) {
TimeBasedKeyValue timeBasedKeyValue = new TimeBasedKeyValue();
timeBasedKeyValue.add("a", 0, 1);
timeBasedKeyValue.add("a", 2, 2);
timeBasedKeyValue.add("b", 2, 25);
timeBasedKeyValue.add("b", 40, 10);
System.out.println(timeBasedKeyValue.get("a", 1));
System.out.println(timeBasedKeyValue.get("a", 2));
System.out.println(timeBasedKeyValue.get("a", 3));
System.out.println(timeBasedKeyValue.get("a", 10));
System.out.println(timeBasedKeyValue.get("b", 2));
System.out.println(timeBasedKeyValue.get("b", 3));
System.out.println(timeBasedKeyValue.get("b", 10));
System.out.println(timeBasedKeyValue.get("b", 50));
}
public void add(String key, int time, int value) {
if (!map.containsKey(key)) {
map.put(key, new TimeBasedKey());
}
map.get(key).add(time, value);
}
public int get(String key, int time) {
return map.get(key).get(time);
}
} | [
"maskaravivek@gmail.com"
] | maskaravivek@gmail.com |
d2030d6a701f3d87996676da90b92655b4aeeca3 | 19314640a5cc12c8748d70423904921dad81cefa | /open-metadata-implementation/adapters/open-connectors/repository-services-connectors/open-metadata-collection-store-connectors/igc-rest-client-library/src/main/java/org/odpi/openmetadata/adapters/repositoryservices/igc/clientlibrary/model/generated/v117/JobStageRecord.java | e709fb0a5471b631b2008e52270542013a3c2b9f | [
"Apache-2.0",
"CC-BY-4.0"
] | permissive | feng-tao/egeria | 4bbd6f9b319d25495675384ee516823cb11cb07f | 9d83d2e2a5bb53c7d2a8afd8652cbb594611ff35 | refs/heads/master | 2020-04-11T09:24:48.550291 | 2018-12-13T15:58:01 | 2018-12-13T15:58:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,588 | java | /* SPDX-License-Identifier: Apache-2.0 */
/* Copyright Contributors to the ODPi Egeria project. */
package org.odpi.openmetadata.adapters.repositoryservices.igc.clientlibrary.model.generated.v117;
import org.odpi.openmetadata.adapters.repositoryservices.igc.clientlibrary.model.common.*;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
import java.util.ArrayList;
/**
* POJO for the 'job_stage_record' asset type in IGC, displayed as 'Job Stage Record' in the IGC UI.
* <br><br>
* (this code has been generated based on out-of-the-box IGC metadata types;
* if modifications are needed, eg. to handle custom attributes,
* extending from this class in your own custom class is the best approach.)
*/
@JsonIgnoreProperties(ignoreUnknown=true)
public class JobStageRecord extends MainObject {
public static final String IGC_TYPE_ID = "job_stage_record";
/**
* The 'record_id_name' property, displayed as 'Record ID Name' in the IGC UI.
*/
protected String record_id_name;
/**
* The 'a_xmeta_locking_root' property, displayed as 'A XMeta Locking Root' in the IGC UI.
*/
protected String a_xmeta_locking_root;
/**
* The 'other_records_initialization_flag' property, displayed as 'Other Records Initialization Flag' in the IGC UI.
*/
protected Number other_records_initialization_flag;
/**
* The 'of_ds_stage' property, displayed as 'Of DS Stage' in the IGC UI.
* <br><br>
* Will be a single {@link Reference} to a {@link Stage} object.
*/
protected Reference of_ds_stage;
/**
* The 'has_ds_flow_variable' property, displayed as 'Has DS Flow Variable' in the IGC UI.
* <br><br>
* Will be a {@link ReferenceList} of {@link DataItem} objects.
*/
protected ReferenceList has_ds_flow_variable;
/**
* The 'record_id_value' property, displayed as 'Record ID Value' in the IGC UI.
*/
protected String record_id_value;
/**
* The 'internal_id' property, displayed as 'Internal ID' in the IGC UI.
*/
protected String internal_id;
/**
* The 'record_name' property, displayed as 'Record Name' in the IGC UI.
*/
protected String record_name;
/**
* The 'record_id_name_value_relation' property, displayed as 'Record ID Name Value Relation' in the IGC UI.
*/
protected String record_id_name_value_relation;
/** @see #record_id_name */ @JsonProperty("record_id_name") public String getRecordIdName() { return this.record_id_name; }
/** @see #record_id_name */ @JsonProperty("record_id_name") public void setRecordIdName(String record_id_name) { this.record_id_name = record_id_name; }
/** @see #a_xmeta_locking_root */ @JsonProperty("a_xmeta_locking_root") public String getAXmetaLockingRoot() { return this.a_xmeta_locking_root; }
/** @see #a_xmeta_locking_root */ @JsonProperty("a_xmeta_locking_root") public void setAXmetaLockingRoot(String a_xmeta_locking_root) { this.a_xmeta_locking_root = a_xmeta_locking_root; }
/** @see #other_records_initialization_flag */ @JsonProperty("other_records_initialization_flag") public Number getOtherRecordsInitializationFlag() { return this.other_records_initialization_flag; }
/** @see #other_records_initialization_flag */ @JsonProperty("other_records_initialization_flag") public void setOtherRecordsInitializationFlag(Number other_records_initialization_flag) { this.other_records_initialization_flag = other_records_initialization_flag; }
/** @see #of_ds_stage */ @JsonProperty("of_ds_stage") public Reference getOfDsStage() { return this.of_ds_stage; }
/** @see #of_ds_stage */ @JsonProperty("of_ds_stage") public void setOfDsStage(Reference of_ds_stage) { this.of_ds_stage = of_ds_stage; }
/** @see #has_ds_flow_variable */ @JsonProperty("has_ds_flow_variable") public ReferenceList getHasDsFlowVariable() { return this.has_ds_flow_variable; }
/** @see #has_ds_flow_variable */ @JsonProperty("has_ds_flow_variable") public void setHasDsFlowVariable(ReferenceList has_ds_flow_variable) { this.has_ds_flow_variable = has_ds_flow_variable; }
/** @see #record_id_value */ @JsonProperty("record_id_value") public String getRecordIdValue() { return this.record_id_value; }
/** @see #record_id_value */ @JsonProperty("record_id_value") public void setRecordIdValue(String record_id_value) { this.record_id_value = record_id_value; }
/** @see #internal_id */ @JsonProperty("internal_id") public String getInternalId() { return this.internal_id; }
/** @see #internal_id */ @JsonProperty("internal_id") public void setInternalId(String internal_id) { this.internal_id = internal_id; }
/** @see #record_name */ @JsonProperty("record_name") public String getRecordName() { return this.record_name; }
/** @see #record_name */ @JsonProperty("record_name") public void setRecordName(String record_name) { this.record_name = record_name; }
/** @see #record_id_name_value_relation */ @JsonProperty("record_id_name_value_relation") public String getRecordIdNameValueRelation() { return this.record_id_name_value_relation; }
/** @see #record_id_name_value_relation */ @JsonProperty("record_id_name_value_relation") public void setRecordIdNameValueRelation(String record_id_name_value_relation) { this.record_id_name_value_relation = record_id_name_value_relation; }
public static final Boolean isJobStageRecord(Object obj) { return (obj.getClass() == JobStageRecord.class); }
}
| [
"chris@thegrotes.net"
] | chris@thegrotes.net |
4be03aa6cb9d5d1eee6458b2d42657eb596fb407 | f157ecb6b5f5dc59504babd1ba87f0e46a5c0667 | /Week_02/G20200343030017/n_ary_tree_preorder_traversal/Solution.java | 7922da22cf33697c04074ab00c41535882d0abb2 | [] | no_license | algorithm006-class01/algorithm006-class01 | 891da256a54640cf1820db93380f4253f6aacecd | 7ad9b948f8deecf35dced38a62913e462e699b1c | refs/heads/master | 2020-12-27T14:43:13.449713 | 2020-04-20T06:56:33 | 2020-04-20T06:56:33 | 237,936,958 | 19 | 140 | null | 2020-04-20T06:56:34 | 2020-02-03T10:13:53 | Java | UTF-8 | Java | false | false | 1,293 | java | package week2.n_ary_tree_preorder_traversal;
import java.util.ArrayList;
import java.util.List;
public class Solution {
public List<Integer> preorder(Node root) {
List<Integer> list = new ArrayList<>();
if (root == null){
return list;
}
recursion(root,list);
return list;
}
public void recursion(Node root, List<Integer> list){
list.add(root.val);
if (root.children == null || root.children.isEmpty()){
//list.add(root.val);
}else{
for (int n=0;n<root.children.size();n++){
recursion(root.children.get(n),list);
}
}
}
public static void main(String[] args) {
List<Node> list1 = new ArrayList<>();
List<Node> list3 = new ArrayList<>();
Node node1 = new Node(1,list1);
Node node2 = new Node(2);
Node node3 = new Node(3,list3);
Node node4 = new Node(4);
Node node5 = new Node(5);
Node node6 = new Node(6);
node3.children.add(node5);
node3.children.add(node6);
node1.children.add(node3);
node1.children.add(node2);
node1.children.add(node4);
Solution s = new Solution();
System.out.println(s.preorder(node1));
}
}
| [
"code8807@163.com"
] | code8807@163.com |
51ad254eb886204c8d89fcadb6b9cff68d7ac62d | 1a7cd920a208f8864d7d002cd2d752fff1e16746 | /app/src/main/java/android/app/docrom/com/petagram/AcercaDeActivity.java | b504f1b97d260085db1c1172e6b6031e40672035 | [] | no_license | juvesys/tarea_menus_y_frags | fc523652ab4735613d9e84dc59a3fe1d43b1efea | fceb1c62d90e6d62dba2d7e1ca3ae47619e2a39e | refs/heads/master | 2021-01-17T17:04:12.159151 | 2016-06-22T04:14:58 | 2016-06-22T04:14:58 | 61,685,686 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 801 | java | package android.app.docrom.com.petagram;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
public class AcercaDeActivity extends AppCompatActivity {
private ImageView cincoEstrellas;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_acerca_de);
Toolbar miActionbar = (Toolbar) findViewById(R.id.miActionBar);
setSupportActionBar(miActionbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
cincoEstrellas = (ImageView) findViewById(R.id.ivCincoEstrellas);
cincoEstrellas.setVisibility(View.INVISIBLE);
}
}
| [
"juvesys@gmail.com"
] | juvesys@gmail.com |
cc5001f0c121a0dd6ff44d6d2ec689d37d13f960 | 8a524ea050bf239ac869ba1f62fb256870bf3c47 | /app/src/main/java/com/globant/samples/volley/injection/module/NetworkModule.java | 24ee6689392a9fdff7070571ab29be5fa8546934 | [] | no_license | MitchDroid/RxAndroidSampleApp | 8a0ebd4d6498052f25da8419485eef93a8ae2a12 | 6cd9da8fed5bc1bac750bc18912f165587459879 | refs/heads/master | 2021-06-20T13:16:31.493031 | 2017-06-12T17:30:34 | 2017-06-12T17:30:34 | 93,451,465 | 1 | 0 | null | 2017-07-10T17:51:00 | 2017-06-05T22:08:40 | Java | UTF-8 | Java | false | false | 800 | java | package com.globant.samples.volley.injection.module;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import com.globant.samples.volley.data.remote.UserApiService;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
/**
* Created by miller.barrera.
*/
@Module
public class NetworkModule {
protected final String PREF_NAME = "preferences";
public NetworkModule() {
}
@Singleton
@Provides
public SharedPreferences provideSharedPreferences(Application application) {
return application.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE);
}
@Singleton
@Provides
public UserApiService userApiService() {
return UserApiService.Factory.create();
}
}
| [
"miller.barrera@globant.com"
] | miller.barrera@globant.com |
f4ce6b63739d7aac88d758f6e322c374422c716e | ba33fac42fc674c56fddf07a13914b2bf9e9b0c3 | /tensquare-06-qa/src/main/java/com/tensquare/qa/service/ProblemService.java | e6e7c986aa64b916c6714308681f0a612864aa58 | [] | no_license | saberBenhui/tensquare | 94b13a8a88f921a33922ee8bd907e5c779d7d9da | 86ee60956d2cd8aedca1cd34812214bc414843d7 | refs/heads/master | 2020-07-15T23:49:11.351553 | 2019-09-04T02:27:29 | 2019-09-04T02:27:29 | 205,674,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,164 | java | package com.tensquare.qa.service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Selection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import util.IdWorker;
import com.tensquare.qa.dao.ProblemDao;
import com.tensquare.qa.pojo.Problem;
/**
* problem服务层
*
* @author Administrator
*
*/
@Service
public class ProblemService {
@Autowired
private ProblemDao problemDao;
@Autowired
private IdWorker idWorker;
//热门问答
public Page<Problem> hotlist(Long labelid, int page, int size) {
return problemDao.hotlist(labelid,PageRequest.of(page-1, size));
}
//等待问答
public Page<Problem> waitlist(Long labelid, int page, int size) {
return problemDao.waitlist(labelid,PageRequest.of(page-1, size));
}
/**
* 最新问答列表
* @param labelid
* @param page
* @param size
* @return
*/
public Page<Problem> newlist(Long labelid, int page, int size) {
//jpql或者是sql查询的分页:把分页对象放到方法最后一个参数即可;返回值是Page
return problemDao.newlist(labelid,PageRequest.of(page-1, size));
}
/**
* 查询全部列表
* @return
*/
public List<Problem> findAll() {
return problemDao.findAll();
}
/**
* 条件查询+分页
* @param whereMap
* @param page
* @param size
* @return
*/
public Page<Problem> findSearch(Map whereMap, int page, int size) {
Specification<Problem> specification = createSpecification(whereMap);
PageRequest pageRequest = PageRequest.of(page-1, size);
return problemDao.findAll(specification, pageRequest);
}
/**
* 条件查询
* @param whereMap
* @return
*/
public List<Problem> findSearch(Map whereMap) {
Specification<Problem> specification = createSpecification(whereMap);
return problemDao.findAll(specification);
}
/**
* 根据ID查询实体
* @param id
* @return
*/
public Problem findById(String id) {
return problemDao.findById(id).get();
}
/**
* 增加
* @param problem
*/
public void add(Problem problem) {
problem.setId( idWorker.nextId()+"" );
problemDao.save(problem);
}
/**
* 修改
* @param problem
*/
public void update(Problem problem) {
problemDao.save(problem);
}
/**
* 删除
* @param id
*/
public void deleteById(String id) {
problemDao.deleteById(id);
}
/**
* 动态条件构建
* @param searchMap
* @return
*/
private Specification<Problem> createSpecification(Map searchMap) {
return new Specification<Problem>() {
@Override
public Predicate toPredicate(Root<Problem> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
List<Predicate> predicateList = new ArrayList<Predicate>();
// ID
if (searchMap.get("id")!=null && !"".equals(searchMap.get("id"))) {
predicateList.add(cb.like(root.get("id").as(String.class), "%"+(String)searchMap.get("id")+"%"));
}
// 标题
if (searchMap.get("title")!=null && !"".equals(searchMap.get("title"))) {
predicateList.add(cb.like(root.get("title").as(String.class), "%"+(String)searchMap.get("title")+"%"));
}
// 内容
if (searchMap.get("content")!=null && !"".equals(searchMap.get("content"))) {
predicateList.add(cb.like(root.get("content").as(String.class), "%"+(String)searchMap.get("content")+"%"));
}
// 用户ID
if (searchMap.get("userid")!=null && !"".equals(searchMap.get("userid"))) {
predicateList.add(cb.like(root.get("userid").as(String.class), "%"+(String)searchMap.get("userid")+"%"));
}
// 昵称
if (searchMap.get("nickname")!=null && !"".equals(searchMap.get("nickname"))) {
predicateList.add(cb.like(root.get("nickname").as(String.class), "%"+(String)searchMap.get("nickname")+"%"));
}
// 是否解决
if (searchMap.get("solve")!=null && !"".equals(searchMap.get("solve"))) {
predicateList.add(cb.like(root.get("solve").as(String.class), "%"+(String)searchMap.get("solve")+"%"));
}
// 回复人昵称
if (searchMap.get("replyname")!=null && !"".equals(searchMap.get("replyname"))) {
predicateList.add(cb.like(root.get("replyname").as(String.class), "%"+(String)searchMap.get("replyname")+"%"));
}
return cb.and( predicateList.toArray(new Predicate[predicateList.size()]));
}
};
}
}
| [
"q1308218583@163.com"
] | q1308218583@163.com |
b9bae2cedc9e32bec58603373e7e03b140f0f89a | 5f316d1f8031b843ea40deacbff55c24f57243d6 | /src/summaryRanges228/test.java | 16e4dc9155b2602294b8dae146774005d4b15dc3 | [] | no_license | wengeyiming/LeetCode | 7f073d42f86da19185c1655b8337f30f583c67de | f060b696f324bf4f40998ad412ef193c31a6c272 | refs/heads/master | 2020-03-22T01:08:08.882512 | 2018-08-02T10:56:29 | 2018-08-02T10:56:29 | 139,285,177 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 996 | java | package summaryRanges228;
import java.util.*;
public class test {
public static void main(String[] args) {
int[] nums = new int[]{0,1};
List<String> list = summaryRanges(nums);
for(String s : list) {
System.out.print(s + " ");
}
System.out.println("");
}
public static List<String> summaryRanges(int[] nums) {
List<String> list = new ArrayList<>();
if(nums == null || nums.length == 0) {
return list;
}
int start = 0;
for(int i=0; i<nums.length-1; i++) {
if(nums[i+1] == nums[i]+1) {
continue;
} else {
if(start != i) {
list.add(new String(nums[start]+"->"+nums[i]));
} else {
list.add(new String(nums[start]+""));
}
start = i+1;
}
}
if(start != nums.length-1) {
list.add(new String(nums[start]+"->"+nums[nums.length-1]));
} else {
list.add(new String(nums[start]+""));
}
return list;
}
}
| [
"wengeyiming@gmail.com"
] | wengeyiming@gmail.com |
03e9f76b7ecbcf3cae0b315785ded7af77d3b42f | 83541a3d59523dc8d42882ac2af443454c9ea1f9 | /Exam3FreeResponse/Parser.java | 94299a8159fd3dd1f632e98b95beaaa1b01db88a | [] | no_license | rberkel00/EdXTests | 503afa58daee247296cde6fe2a38180c8277827f | 2fa8d78dbf195d4dc11d9aac9de1db92bc12f478 | refs/heads/master | 2021-09-11T21:57:54.213876 | 2018-04-12T17:47:30 | 2018-04-12T17:47:30 | 107,154,612 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 16,910 | java | /**
* @author Robyn Berkel
* @verison 1.0
*/
import com.github.javaparser.*;
import com.github.javaparser.ast.*;
import com.github.javaparser.ast.comments.*;
import com.github.javaparser.ast.body.*;
import java.io.*;
import java.util.*;
import java.nio.file.Files;
import java.nio.charset.StandardCharsets;
import com.github.javaparser.ast.expr.*;
import com.github.javaparser.metamodel.*;
import com.github.javaparser.ast.stmt.*;
import com.github.javaparser.ast.type.*;
public class Parser {
/**
* All comments found in file parsed by parse method
*/
public List<Comment> comments;
/**
* All constructors found in file parsed by parse method
*/
public List<ConstructorDeclaration> constructors;
/**
* All methods found in file parsed by parse method
*/
public List<MethodDeclaration> methods;
/**
* All fields found in file parsed by parse method
*/
public List<FieldDeclaration> fields;
/**
* All problems (compile-time errors) found in file parsed by parse method
*/
public List<Problem> problems;
/*
* Initializes list fields
*/
public Parser() {
comments = new ArrayList<Comment>();
constructors = new ArrayList<ConstructorDeclaration>();
methods = new ArrayList<MethodDeclaration>();
fields = new ArrayList<FieldDeclaration>();
problems = new ArrayList<Problem>();
}
/**
* Parses the file given and adds file data to the class fields to be used with other Parser methods.
* <p>
* Not static to avoid needing to parse file data multiple times
* @param file the file to parse, data from file will be added to class fields
* @return true if at least partial parse was successful
* @throws Exception any exception
*/
public boolean parse(String file) throws Exception {
File f = new File(file);
JavaParser parser = new JavaParser();
ParseResult<CompilationUnit> result = parser.parse(ParseStart.COMPILATION_UNIT, Providers.provider(f));
//to get beginning of problem: p.getLocation().get().toRange().begin
problems = result.getProblems();
//try to retrieve nodes
if (!result.getResult().isPresent()) return false;
CompilationUnit cu = result.getResult().get();
//get comments, methods, fields, and constructors
comments = cu.getComments();
Optional<ClassOrInterfaceDeclaration> child = cu.getClassByName(file.substring(0, file.length()-5));
if (!child.isPresent()) {
return false;
}
ClassOrInterfaceDeclaration childNodes = child.get();
for (Node n : childNodes.getChildNodes()) {
if (n instanceof ConstructorDeclaration) constructors.add((ConstructorDeclaration)n);
else if (n instanceof MethodDeclaration) {
methods.add((MethodDeclaration)n);
}
else if (n instanceof FieldDeclaration) fields.add((FieldDeclaration)n);
}
return true;
}
/**
* Returns a String reporting compile-time errors found.
* <p>
* These "problems" include problems that make code ungradable and problems that can be worked around.
* @return Returns a String starting with "Compile-time errors were found at these locations: " then lists problem locations by (line, column)
*/
public String reportProblems() {
System.out.println("check3");
String result = "Compile-time errors were found at these locations:";
for (Problem p : problems) {
if (p.getLocation().isPresent()) {
result += "\n" + p.getLocation().get().toRange().begin;
}
}
return result;
}
/**
* Checks if given method exists in the parsed file. Only checks return type, name, and parameter list
* @param signature method signature to look for. Should be in format returnType MethodName (paramType, paramType, paramType, ... )
* @return true if signature is found, false if signature not found
*/
public boolean checkMethodSignature(String signature) {
for (MethodDeclaration m : methods) {
if (m.toString().equals(signature)) {
return true;
}
}
return false;
}
/**
* Calls replaceMethod for each signature listed in sigs
* @param sigs array of method signatures each in the format returnType MethodName (paramType, paramType, paramType, ... )
* @param work path of file to replace with
* @return array of new files with replacements, possibly contains null values
* @throws Exception any exception
*/
public File[] replace(String[] sigs, String work) throws Exception {
File[] files = new File[sigs.length];
for (int i = 0; i < sigs.length; i++) {
files[i] = replaceMethod(sigs[i], work);
}
return files;
}
/**
* Looks for method signature in "methods" class field. If found, then looks for method signature in "file" (String parameter).
* If found, it takes the method body of method in "methods" class field and replaces method body in "file" with it.
* <p>
* Ending result is a new file with the contents of "file", except now the matching method body is the body from the original parsed file (student submission)
* @param signature method signature each in the format returnType MethodName (paramType, paramType, paramType, ... )
* @param file path of file to replace with
* @return array of new files with replacements, possibly contains null values
*/
public File replaceMethod(String signature, String file) {
try {
File f = new File(file);
JavaParser parser = new JavaParser();
ParseResult<CompilationUnit> result = parser.parse(ParseStart.COMPILATION_UNIT, Providers.provider(f));
//try to retrieve nodes
if (!result.getResult().isPresent()) return null;
CompilationUnit cu = result.getResult().get();
//get methods
int start = file.lastIndexOf("/") + 1;
if (start == -1) start = 0;
ClassOrInterfaceDeclaration childNodes = cu.getClassByName(file.substring(start, file.length()-5)).get();
for (Node n : childNodes.getChildNodes()) {
if (n instanceof MethodDeclaration) {
MethodDeclaration toSet = (MethodDeclaration)n;
if (toSet.getDeclarationAsString(false, false, false).equals(signature)) {
for (MethodDeclaration m : methods) {
if (m.getDeclarationAsString(false, false, false).equals(signature)) {
//make modification
toSet.setBody(m.getBody().get());
toSet.setParameters(m.getParameters());
Random r = new Random();
String temp = "temp" + r.nextInt(10000);
File directory = new File(temp);
directory.mkdir();
File newfile = new File(temp + "/" + f.getName());
PrintWriter pw = new PrintWriter(newfile);
pw.write(cu.toString());
pw.close();
return newfile;
}
}
}
} else if (n instanceof ConstructorDeclaration) {
ConstructorDeclaration toSet = (ConstructorDeclaration)n;
if (toSet.getDeclarationAsString(false, false, false).equals(signature)) {
for (ConstructorDeclaration m : constructors) {
if (m.getDeclarationAsString(false, false, false).equals(signature)) {
//make modification
toSet.setBody(m.getBody());
toSet.setParameters(m.getParameters());
Random r = new Random();
String temp = "temp" + r.nextInt(10000);
File directory = new File(temp);
directory.mkdir();
File newfile = new File(temp + "/" + f.getName());
PrintWriter pw = new PrintWriter(newfile);
pw.write(cu.toString());
pw.close();
return newfile;
}
}
}
}
}
return null;
} catch (Exception e) {
return null;
}
}
/**
* Returns list of small expressions or statements extracted from all statements found in the method corresponding to "method" parameter.
* <p>
* Expression types are defined in JavaParser project: com.github.javaparser.ast.expr.*
* Statement types are definded in JavaParser project: com.github.javaparser.ast.stmt.*
* @param method method signature to find statements from, matches format returnType MethodName (paramType, paramType, paramType, ... )
* @return list of nodes (expressions or statements) that are instances of the class defined by exprclass found in the indicated method
* @throws Exception any exception
*/
public List<Node> findPieces(String method) throws Exception {
List<Node> expressions = new ArrayList<Node>();
for (MethodDeclaration m : methods) {
if (m.getDeclarationAsString(false, false, false).equals(method)) {
NodeList<Statement> statements = m.getBody().get().getStatements();
for (Statement s : statements) {
expressions.addAll(getAllPieces(s));
}
}
}
for (ConstructorDeclaration m : constructors) {
if (m.getDeclarationAsString(false, false, false).equals(method)) {
NodeList<Statement> statements = m.getBody().getStatements();
for (Statement s : statements) {
expressions.addAll(getAllPieces(s));
}
}
}
return expressions;
}
/**
* Helper method (made public for possible future cases) for findPieces. Recursive method to find all pieces of an expression or statement.
* @param ex root node from which to derive all smaller expressions or statements. Node should be an expression or statement
* @return list of all found expressions and statements, including all nodes not just leaf nodes
* @throws Exception any exception
*/
public List<Node> getAllPieces(Node ex) throws Exception {
List<Node> e = new ArrayList<Node>();
e.add(ex);
if (ex instanceof ArrayAccessExpr) {
ArrayAccessExpr ae = (ArrayAccessExpr)ex;
e.addAll(getAllPieces(ae.getName()));
e.addAll(getAllPieces(ae.getIndex()));
}
else if (ex instanceof ArrayInitializerExpr) {
ArrayInitializerExpr ae = (ArrayInitializerExpr)ex;
NodeList<Expression> exs = ae.getValues();
for (Expression s : exs) {
e.addAll(getAllPieces(s));
}
}
else if (ex instanceof AssignExpr) {
AssignExpr ae = (AssignExpr)ex;
e.addAll(getAllPieces(ae.getTarget()));
e.addAll(getAllPieces(ae.getValue()));
}
else if (ex instanceof BinaryExpr) {
BinaryExpr be = (BinaryExpr)ex;
e.addAll(getAllPieces(be.getLeft()));
e.addAll(getAllPieces(be.getRight()));
}
else if (ex instanceof CastExpr) {
CastExpr be = (CastExpr)ex;
e.addAll(getAllPieces(be.getExpression()));
}
else if (ex instanceof ConditionalExpr) {
ConditionalExpr be = (ConditionalExpr)ex;
e.addAll(getAllPieces(be.getCondition()));
e.addAll(getAllPieces(be.getElseExpr()));
e.addAll(getAllPieces(be.getThenExpr()));
}
else if (ex instanceof EnclosedExpr) {
EnclosedExpr be = (EnclosedExpr)ex;
if (be.getInner().isPresent()) {
e.addAll(getAllPieces(be.getInner().get()));
}
}
else if (ex instanceof FieldAccessExpr) {
FieldAccessExpr be = (FieldAccessExpr)ex;
e.addAll(getAllPieces(be.getScope()));
}
else if (ex instanceof InstanceOfExpr) {
InstanceOfExpr be = (InstanceOfExpr)ex;
e.addAll(getAllPieces(be.getExpression()));
}
else if (ex instanceof InstanceOfExpr) {
InstanceOfExpr be = (InstanceOfExpr)ex;
e.addAll(getAllPieces(be.getExpression()));
}
else if (ex instanceof LambdaExpr) {
LambdaExpr ae = (LambdaExpr)ex;
if (ae.getExpressionBody().isPresent()) {
e.addAll(getAllPieces(ae.getExpressionBody().get()));
}
e.addAll(getAllPieces(ae.getBody()));
}
else if (ex instanceof MethodCallExpr) {
MethodCallExpr ae = (MethodCallExpr)ex;
NodeList<Expression> exs = ae.getArguments();
for (Expression s : exs) {
e.addAll(getAllPieces(s));
}
if (ae.getScope().isPresent()) {
e.addAll(getAllPieces(ae.getScope().get()));
}
}
else if (ex instanceof MethodReferenceExpr) {
MethodReferenceExpr be = (MethodReferenceExpr)ex;
e.addAll(getAllPieces(be.getScope()));
}
else if (ex instanceof ObjectCreationExpr) {
ObjectCreationExpr ae = (ObjectCreationExpr)ex;
NodeList<Expression> exs = ae.getArguments();
for (Expression s : exs) {
e.addAll(getAllPieces(s));
}
if (ae.getScope().isPresent()) {
e.addAll(getAllPieces(ae.getScope().get()));
}
}
else if (ex instanceof SuperExpr) {
SuperExpr ae = (SuperExpr)ex;
if (ae.getClassExpr().isPresent()) {
e.addAll(getAllPieces(ae.getClassExpr().get()));
}
}
else if (ex instanceof ThisExpr) {
ThisExpr ae = (ThisExpr)ex;
if (ae.getClassExpr().isPresent()) {
e.addAll(getAllPieces(ae.getClassExpr().get()));
}
}
else if (ex instanceof UnaryExpr) {
UnaryExpr be = (UnaryExpr)ex;
e.addAll(getAllPieces(be.getExpression()));
}
else if (ex instanceof VariableDeclarationExpr) {
VariableDeclarationExpr ae = (VariableDeclarationExpr)ex;
List<NodeList<?>> node = ae.getNodeLists();
for (NodeList<?> n : node) {
if (n.size() > 0) {
if (n.get(0) instanceof VariableDeclarator) {
VariableDeclarator vd = (VariableDeclarator)n.get(0);
if (vd.getInitializer().isPresent()) {
e.addAll(getAllPieces(vd.getInitializer().get()));
}
}
}
}
NodeList<AnnotationExpr> exs = ae.getAnnotations();
for (AnnotationExpr s : exs) {
e.addAll(getAllPieces(s));
}
}
else if (ex instanceof AssertStmt) {
AssertStmt as = (AssertStmt)ex;
e.addAll(getAllPieces(as.getCheck()));
if (as.getMessage().isPresent()) {
e.addAll(getAllPieces(as.getMessage().get()));
}
}
else if (ex instanceof BlockStmt) {
BlockStmt bs = (BlockStmt)ex;
for (Statement s : bs.getStatements()) {
e.addAll(getAllPieces(s));
}
}
else if (ex instanceof BreakStmt) {
BreakStmt bs = (BreakStmt)ex;
}
else if (ex instanceof ContinueStmt) {
ContinueStmt cs = (ContinueStmt)ex;
}
else if (ex instanceof DoStmt) {
DoStmt ds = (DoStmt)ex;
e.addAll(getAllPieces(ds.getBody()));
e.addAll(getAllPieces(ds.getCondition()));
}
else if (ex instanceof EmptyStmt) {
EmptyStmt es = (EmptyStmt)ex;
}
else if (ex instanceof ExplicitConstructorInvocationStmt) {
ExplicitConstructorInvocationStmt es = (ExplicitConstructorInvocationStmt)ex;
for (Expression ee : es.getArguments()) {
e.addAll(getAllPieces(ee));
}
if (es.getExpression().isPresent()) {
e.addAll(getAllPieces(es.getExpression().get()));
}
}
else if (ex instanceof ExpressionStmt) {
ExpressionStmt es = (ExpressionStmt)ex;
e.addAll(getAllPieces(es.getExpression()));
}
else if (ex instanceof ForeachStmt) {
ForeachStmt fs = (ForeachStmt)ex;
e.addAll(getAllPieces(fs.getBody()));
e.addAll(getAllPieces(fs.getIterable()));
e.addAll(getAllPieces(fs.getVariable()));
}
else if (ex instanceof ForStmt) {
ForStmt fs = (ForStmt)ex;
e.addAll(getAllPieces(fs.getBody()));
if (fs.getCompare().isPresent()) {
e.addAll(getAllPieces(fs.getCompare().get()));
}
for (Expression ee : fs.getInitialization()) {
e.addAll(getAllPieces(ee));
}
for (Expression ee : fs.getUpdate()) {
e.addAll(getAllPieces(ee));
}
}
else if (ex instanceof IfStmt) {
IfStmt is = (IfStmt)ex;
e.addAll(getAllPieces(is.getCondition()));
if (is.getElseStmt().isPresent()) {
e.addAll(getAllPieces(is.getElseStmt().get()));
}
e.addAll(getAllPieces(is.getThenStmt()));
}
else if (ex instanceof LabeledStmt) {
LabeledStmt ls = (LabeledStmt)ex;
e.addAll(getAllPieces(ls.getStatement()));
}
else if (ex instanceof LocalClassDeclarationStmt) {
LocalClassDeclarationStmt ls = (LocalClassDeclarationStmt)ex;
}
else if (ex instanceof ReturnStmt) {
ReturnStmt rs = (ReturnStmt)ex;
if (rs.getExpression().isPresent()) {
e.addAll(getAllPieces(rs.getExpression().get()));
}
}
else if (ex instanceof SwitchEntryStmt) {
SwitchEntryStmt ss = (SwitchEntryStmt)ex;
if (ss.getLabel().isPresent()) {
e.addAll(getAllPieces(ss.getLabel().get()));
}
for (Statement s : ss.getStatements()) {
e.addAll(getAllPieces(s));
}
}
else if (ex instanceof SwitchStmt) {
SwitchStmt ss = (SwitchStmt)ex;
for (Statement s : ss.getEntries()) {
e.addAll(getAllPieces(s));
}
e.addAll(getAllPieces(ss.getSelector()));
}
else if (ex instanceof SynchronizedStmt) {
SynchronizedStmt ss = (SynchronizedStmt)ex;
e.addAll(getAllPieces(ss.getBody()));
e.addAll(getAllPieces(ss.getExpression()));
}
else if (ex instanceof ThrowStmt) {
ThrowStmt ts = (ThrowStmt)ex;
e.addAll(getAllPieces(ts.getExpression()));
}
else if (ex instanceof TryStmt) {
TryStmt ts = (TryStmt)ex;
for (CatchClause cc : ts.getCatchClauses()) {
e.addAll(getAllPieces(cc.getBody()));
}
if (ts.getFinallyBlock().isPresent()) {
e.addAll(getAllPieces(ts.getFinallyBlock().get()));
}
for (Expression ee : ts.getResources()) {
e.addAll(getAllPieces(ee));
}
if (ts.getTryBlock().isPresent()) {
e.addAll(getAllPieces(ts.getTryBlock().get()));
}
}
else if (ex instanceof UnparsableStmt) {
UnparsableStmt us = (UnparsableStmt)ex;
}
else if (ex instanceof WhileStmt) {
WhileStmt ws = (WhileStmt)ex;
e.addAll(getAllPieces(ws.getBody()));
e.addAll(getAllPieces(ws.getCondition()));
}
return e;
}
}
| [
"rberkel@purdue.edu"
] | rberkel@purdue.edu |
9f1e920314b8eff400cd8c0051ec1c923c63f6fc | 27e15b1dfec0fb52956c49655b4bb0461faa9900 | /Final/puntos/GraphGenerator.java | af92a257b35a1f76a38663cc0e4ac00c76200cc0 | [] | no_license | sguzmanm/ProyectosDALGORuizGuzman | 21e0e432df061f7b0aea8e7a935117fbb37a0f85 | d35438ec3c5658abe3aac462c15e33c0fd3ce854 | refs/heads/master | 2021-03-22T02:12:54.246184 | 2017-12-11T02:46:20 | 2017-12-11T02:46:20 | 104,401,785 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,576 | java | package puntos;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
public class GraphGenerator {
public static void main(String[] args) throws Exception {
GraphGenerator g = new GraphGenerator();
/*for(int i=1;i<=3;i++)
{
g.diez(i);
g.cien(i);
g.mil(i);
}
g.dificil();
g.dificil2();
g.distribuido();*/
g.megaFile();
}
public void diez(int num) throws Exception
{
FileWriter fw = new FileWriter("./data/ProblemaB/diez"+num+".txt");
fw.write("100\n");
String msj="";
int lim=0;
for(int k=0;k<100;k++)
{
lim=(int)(Math.random()*10);
if(lim==0) lim++;
int[]v=new int[lim];
msj=lim+" "+(lim-1);
for(int i=1;i<v.length;i++)
{
msj+=" "+(int)(Math.random()*(i-1))+" "+i;
}
fw.write(msj+"\n");
}
fw.close();
}
public void cien(int num) throws Exception
{
FileWriter fw = new FileWriter("./data/ProblemaB/cien"+num+".txt");
fw.write("100\n");
String msj="";
int lim=0;
for(int k=0;k<100;k++)
{
lim=(int)(Math.random()*100);
if(lim==0) lim++;
int[]v=new int[lim];
msj=lim+" "+(lim-1);
for(int i=1;i<v.length;i++)
{
msj+=" "+(int)(Math.random()*(i-1))+" "+i;
}
fw.write(msj+"\n");
}
fw.close();
}
public void mil(int num) throws Exception
{
FileWriter fw = new FileWriter("./data/ProblemaB/mil"+num+".txt");
fw.write("100\n");
String msj="";
int lim=0;
for(int k=0;k<100;k++)
{
lim=(int)(Math.random()*1000);
if(lim==0) lim++;
int[]v=new int[lim];
msj=lim+" "+(lim-1);
for(int i=1;i<v.length;i++)
{
msj+=" "+(int)(Math.random()*(i-1))+" "+i;
}
fw.write(msj+"\n");
}
fw.close();
}
public void dificil() throws Exception
{
FileWriter fw = new FileWriter("./data/ProblemaB/dificil.txt");
fw.write("100\n");
String msj="";
int lim=1000;
for(int k=0;k<100;k++)
{
int[]v=new int[1000];
msj=lim+" "+(lim-1);
for(int i=1;i<v.length;i++)
{
msj+=" "+0+" "+i;
}
fw.write(msj+"\n");
}
fw.close();
}
public void dificil2() throws Exception
{
FileWriter fw = new FileWriter("./data/ProblemaB/dificil2.txt");
fw.write("99\n");
String msj="";
int lim=1000;
for(int k=0;k<99;k++)
{
int[]v=new int[1000];
msj=lim+" "+(lim-1);
for(int i=1;i<v.length;i++)
{
msj+=" "+0+" "+i;
}
fw.write(msj+"\n");
}
fw.close();
}
public void distribuido() throws Exception
{
FileWriter fw = new FileWriter("./data/ProblemaB/distribuido.txt");
fw.write("100\n");
String msj="";
for(int k=0;k<100;k++)
{
int[]v=new int[k+1];
msj=(k+1)+" "+(k);
for(int i=1;i<v.length;i++)
{
msj+=" "+0+" "+i;
}
fw.write(msj+"\n");
}
fw.close();
}
public void megaFile() throws Exception
{
String s="";
final File f =new File("./data/ProblemaB/");
InputStream in=null;
File d = new File("./data/ProblemaB/completo.txt");
int i=0;
String line="";
for(File f1:f.listFiles())
{
System.out.println(f1.getAbsolutePath());
FileReader fr = new FileReader(f1);
BufferedReader br = new BufferedReader(fr);
line=br.readLine();
while(line!=null && line.length()>0)
{
s+=line+"\n";
line=br.readLine();
}
br.close();
System.out.println("ACABE "+i);
i++;
}
FileWriter fw = new FileWriter(d);
fw.write(s);
fw.close();
/* You can get Path from file also: file.toPath() */
}
}
| [
"supersergio.sgm@gmail.com"
] | supersergio.sgm@gmail.com |
8bc3b616be77e8141a7dc340940400e1a819984e | 1bdd1c2e01d9daf889296e071b323ceb55450054 | /java/src/main/java/a3/model/Envelope.java | ddf9a38e34759e6f06d2ff4500d084a0dd69816e | [
"MIT"
] | permissive | brijeshsharmas/a3 | e2de9861f88d0bbe10d6bda2b3603ca7bd2215f4 | bfb887ef64d1dfd717a904604c061cf488607988 | refs/heads/main | 2022-12-28T06:01:43.176342 | 2020-10-13T07:36:01 | 2020-10-13T07:36:01 | 303,593,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,659 | java | /**
* @author Brijesh Sharma
* Copyright (c) 2020, Brijesh Sharma
* All rights reserved.
* This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
*/
package a3.model;
import java.util.List;
public class Envelope {
private String from;
private List<String> toList;
private String subject;
private String txtBody;
private String htmlBody;
private boolean success = true;
private String errCode, errMsg;
public Envelope() { }
public Envelope(String from, List<String> toList, String subject, String txtBody, String htmlBody) {
this.from = from;
this.toList = toList;
this.subject = subject;
this.txtBody = txtBody;
this.htmlBody = htmlBody;
}
public String getFrom() {return from;}
public String getSubject() { return subject; }
public String getTxtBody() { return txtBody; }
public String getHtmlBody() { return htmlBody; }
public List<String> getToList() { return toList; }
public boolean isSuccess() { return success; }
public String getErrCode() { return errCode; }
public String getErrMsg() { return errMsg; }
public void setFrom(String from) { this.from = from; }
public void setToList(List<String> toList) { this.toList = toList;}
public void setSubject(String subject) { this.subject = subject; }
public void setTxtBody(String txtBody) { this.txtBody = txtBody; }
public void setSuccess(boolean success) { this.success = success; }
public void setErrCode(String errCode) { this.errCode = errCode; }
public void setErrMsg(String errMsg) { this.errMsg = errMsg; }
public void setHtmlBody(String htmlBody) { this.htmlBody = htmlBody; }
}
| [
"brijesh.sharma1@publicissapient.com"
] | brijesh.sharma1@publicissapient.com |
b707191a7d13d2a9a30135969a949df319d19c1f | c9cda16865f34a909166ad8d6282b2fe023ee500 | /zzq/src/main/java/com/zzq/draw/utils/TDevice.java | dfefec44254eed8248c2eef4f7417698450e4449 | [] | no_license | miagosen/Android-Zzq | 3acfa1090430b379f4dee97779090ee15b278bfd | f9c8200e6fbf55099d3765ca3e130f6c9e6d0d2a | refs/heads/master | 2021-01-02T08:45:30.005011 | 2015-01-08T01:49:42 | 2015-01-08T01:49:42 | 28,329,979 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,391 | java | package com.zzq.draw.utils;
import java.io.File;
import java.lang.reflect.Field;
import java.text.NumberFormat;
import java.util.List;
import java.util.UUID;
import com.zzq.draw.KeTuKeLeApplication;
import com.zzq.draw.R;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningAppProcessInfo;
import android.app.Dialog;
import android.content.ActivityNotFoundException;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Point;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.PowerManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.Display;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
public class TDevice {
public static boolean GTE_HC;
public static boolean GTE_ICS;
public static boolean PRE_HC;
private static Boolean _hasBigScreen = null;
private static Boolean _hasCamera = null;
private static Boolean _isTablet = null;
private static Integer _loadFactor = null;
private static int _pageSize = -1;
public static float displayDensity = 0.0F;
static {
GTE_ICS = Build.VERSION.SDK_INT >= 14;
GTE_HC = Build.VERSION.SDK_INT >= 11;
PRE_HC = Build.VERSION.SDK_INT >= 11 ? false : true;
}
public TDevice() {
}
public static float dpToPixel(float dp) {
return dp * (getDisplayMetrics().densityDpi / 160F);
}
public static int getDefaultLoadFactor() {
if (_loadFactor == null) {
Integer integer = Integer.valueOf(0xf & KeTuKeLeApplication.mContext
.getResources().getConfiguration().screenLayout);
_loadFactor = integer;
_loadFactor = Integer.valueOf(Math.max(integer.intValue(), 1));
}
return _loadFactor.intValue();
}
public static float getDensity() {
if (displayDensity == 0.0)
displayDensity = getDisplayMetrics().density;
return displayDensity;
}
public static DisplayMetrics getDisplayMetrics() {
DisplayMetrics displaymetrics = new DisplayMetrics();
((WindowManager) KeTuKeLeApplication.mContext.getSystemService(
Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(
displaymetrics);
return displaymetrics;
}
public static float getScreenHeight() {
return getDisplayMetrics().heightPixels;
}
public static float getScreenWidth() {
return getDisplayMetrics().widthPixels;
}
public static int[] getRealScreenSize(Activity activity) {
int[] size = new int[2];
int screenWidth = 0, screenHeight = 0;
WindowManager w = activity.getWindowManager();
Display d = w.getDefaultDisplay();
DisplayMetrics metrics = new DisplayMetrics();
d.getMetrics(metrics);
// since SDK_INT = 1;
screenWidth = metrics.widthPixels;
screenHeight = metrics.heightPixels;
// includes window decorations (statusbar bar/menu bar)
if (Build.VERSION.SDK_INT >= 14 && Build.VERSION.SDK_INT < 17)
try {
screenWidth = (Integer) Display.class.getMethod("getRawWidth")
.invoke(d);
screenHeight = (Integer) Display.class
.getMethod("getRawHeight").invoke(d);
} catch (Exception ignored) {
}
// includes window decorations (statusbar bar/menu bar)
if (Build.VERSION.SDK_INT >= 17)
try {
Point realSize = new Point();
Display.class.getMethod("getRealSize", Point.class).invoke(d,
realSize);
screenWidth = realSize.x;
screenHeight = realSize.y;
} catch (Exception ignored) {
}
size[0] = screenWidth;
size[1] = screenHeight;
return size;
}
public static int getStatusBarHeight() {
Class<?> c = null;
Object obj = null;
Field field = null;
int x = 0;
try {
c = Class.forName("com.android.internal.R$dimen");
obj = c.newInstance();
field = c.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
return KeTuKeLeApplication.mContext.getResources()
.getDimensionPixelSize(x);
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
public static int getPageSize() {
if (_pageSize == -1)
if (TDevice.isTablet())
_pageSize = 50;
else if (TDevice.hasBigScreen())
_pageSize = 20;
else
_pageSize = 10;
return _pageSize;
}
public static boolean hasBigScreen() {
boolean flag = true;
if (_hasBigScreen == null) {
boolean flag1;
if ((0xf & KeTuKeLeApplication.mContext.getResources()
.getConfiguration().screenLayout) >= 3)
flag1 = flag;
else
flag1 = false;
Boolean boolean1 = Boolean.valueOf(flag1);
_hasBigScreen = boolean1;
if (!boolean1.booleanValue()) {
if (getDensity() <= 1.5F)
flag = false;
_hasBigScreen = Boolean.valueOf(flag);
}
}
return _hasBigScreen.booleanValue();
}
public static final boolean hasCamera() {
if (_hasCamera == null) {
PackageManager pckMgr = KeTuKeLeApplication.mContext
.getPackageManager();
boolean flag = pckMgr
.hasSystemFeature("android.hardware.camera.front");
boolean flag1 = pckMgr.hasSystemFeature("android.hardware.camera");
boolean flag2;
if (flag || flag1)
flag2 = true;
else
flag2 = false;
_hasCamera = Boolean.valueOf(flag2);
}
return _hasCamera.booleanValue();
}
public static boolean hasHardwareMenuKey(Context context) {
boolean flag = false;
if (PRE_HC)
flag = true;
else if (GTE_ICS) {
flag = ViewConfiguration.get(context).hasPermanentMenuKey();
} else
flag = false;
return flag;
}
public static boolean hasInternet() {
boolean flag;
if (((ConnectivityManager) KeTuKeLeApplication.mContext.getSystemService(
"connectivity")).getActiveNetworkInfo() != null)
flag = true;
else
flag = false;
return flag;
}
public static boolean gotoGoogleMarket(Activity activity, String pck) {
try {
Intent intent = new Intent();
intent.setPackage("com.android.vending");
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + pck));
activity.startActivity(intent);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static boolean isPackageExist(String pckName) {
try {
PackageInfo pckInfo = KeTuKeLeApplication.mContext.getPackageManager()
.getPackageInfo(pckName, 0);
if (pckInfo != null)
return true;
} catch (NameNotFoundException e) {
TLog.error(e.getMessage());
}
return false;
}
public static void hideAnimatedView(View view) {
if (PRE_HC && view != null)
view.setPadding(view.getWidth(), 0, 0, 0);
}
public static void hideSoftKeyboard(View view) {
if (view == null)
return;
((InputMethodManager) KeTuKeLeApplication.mContext.getSystemService(
Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(
view.getWindowToken(), 0);
}
public static boolean isLandscape() {
boolean flag;
if (KeTuKeLeApplication.mContext.getResources().getConfiguration().orientation == 2)
flag = true;
else
flag = false;
return flag;
}
public static boolean isPortrait() {
boolean flag = true;
if (KeTuKeLeApplication.mContext.getResources().getConfiguration().orientation != 1)
flag = false;
return flag;
}
public static boolean isTablet() {
if (_isTablet == null) {
boolean flag;
if ((0xf & KeTuKeLeApplication.mContext.getResources()
.getConfiguration().screenLayout) >= 3)
flag = true;
else
flag = false;
_isTablet = Boolean.valueOf(flag);
}
return _isTablet.booleanValue();
}
public static float pixelsToDp(float f) {
return f / (getDisplayMetrics().densityDpi / 160F);
}
public static void showAnimatedView(View view) {
if (PRE_HC && view != null)
view.setPadding(0, 0, 0, 0);
}
public static void showSoftKeyboard(Dialog dialog) {
dialog.getWindow().setSoftInputMode(4);
}
public static void showSoftKeyboard(View view) {
((InputMethodManager) KeTuKeLeApplication.mContext.getSystemService(
Context.INPUT_METHOD_SERVICE)).showSoftInput(view,
InputMethodManager.SHOW_FORCED);
}
public static void toogleSoftKeyboard(View view) {
((InputMethodManager) KeTuKeLeApplication.mContext.getSystemService(
Context.INPUT_METHOD_SERVICE)).toggleSoftInput(0,
InputMethodManager.HIDE_NOT_ALWAYS);
}
public static boolean isSdcardReady() {
return Environment.MEDIA_MOUNTED.equals(Environment
.getExternalStorageState());
}
public static String getCurCountryLan() {
return KeTuKeLeApplication.mContext.getResources().getConfiguration().locale
.getLanguage()
+ "-"
+ KeTuKeLeApplication.mContext.getResources().getConfiguration().locale
.getCountry();
}
public static boolean isZhCN() {
String lang = KeTuKeLeApplication.mContext.getResources()
.getConfiguration().locale.getCountry();
if (lang.equalsIgnoreCase("CN")) {
return true;
}
return false;
}
public static String percent(double p1, double p2) {
String str;
double p3 = p1 / p2;
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMinimumFractionDigits(2);
str = nf.format(p3);
return str;
}
public static String percent2(double p1, double p2) {
String str;
double p3 = p1 / p2;
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMinimumFractionDigits(0);
str = nf.format(p3);
return str;
}
public static void gotoMarket(Context context, String pck) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(Uri.parse("market://details?id=" + pck));
context.startActivity(intent);
}
public static void openAppInMarket(Context context) {
if (context != null) {
String pckName = context.getPackageName();
try {
gotoMarket(context, pckName);
} catch (Exception ex) {
try {
String otherMarketUri = "http://market.android.com/details?id="
+ pckName;
Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(otherMarketUri));
context.startActivity(intent);
} catch (Exception e) {
}
}
}
}
public static void setFullScreen(Activity activity) {
WindowManager.LayoutParams params = activity.getWindow()
.getAttributes();
params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
activity.getWindow().setAttributes(params);
activity.getWindow().addFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
public static void cancelFullScreen(Activity activity) {
WindowManager.LayoutParams params = activity.getWindow()
.getAttributes();
params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN);
activity.getWindow().setAttributes(params);
activity.getWindow().clearFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
public static PackageInfo getPackageInfo(String pckName) {
try {
return KeTuKeLeApplication.mContext.getPackageManager()
.getPackageInfo(pckName, 0);
} catch (NameNotFoundException e) {
TLog.error(e.getMessage());
}
return null;
}
public static int getVersionCode() {
int versionCode = 0;
try {
versionCode = KeTuKeLeApplication
.mContext
.getPackageManager()
.getPackageInfo(KeTuKeLeApplication.mContext.getPackageName(),
0).versionCode;
} catch (PackageManager.NameNotFoundException ex) {
versionCode = 0;
}
return versionCode;
}
public static int getVersionCode(String packageName) {
int versionCode = 0;
try {
versionCode = KeTuKeLeApplication.mContext.getPackageManager()
.getPackageInfo(packageName, 0).versionCode;
} catch (PackageManager.NameNotFoundException ex) {
versionCode = 0;
}
return versionCode;
}
public static String getVersionName() {
String name = "";
try {
name = KeTuKeLeApplication
.mContext
.getPackageManager()
.getPackageInfo(KeTuKeLeApplication.mContext.getPackageName(),
0).versionName;
} catch (PackageManager.NameNotFoundException ex) {
name = "";
}
return name;
}
public static boolean isScreenOn() {
PowerManager pm = (PowerManager) KeTuKeLeApplication.mContext
.getSystemService(Context.POWER_SERVICE);
return pm.isScreenOn();
}
public static void installAPK(Context context, File file) {
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),
"application/vnd.android.package-archive");
context.startActivity(intent);
}
public static Intent getInstallApkIntent(File file) {
Intent intent = new Intent();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(file),
"application/vnd.android.package-archive");
return intent;
}
public static void openDial(Context context, String number) {
Uri uri = Uri.parse("tel:" + number);
Intent it = new Intent(Intent.ACTION_DIAL, uri);
context.startActivity(it);
}
public static void openSMS(Context context, String smsBody, String tel) {
Uri uri = Uri.parse("smsto:" + tel);
Intent it = new Intent(Intent.ACTION_SENDTO, uri);
it.putExtra("sms_body", smsBody);
context.startActivity(it);
}
public static void openDail(Context context) {
Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
public static void openSendMsg(Context context) {
Uri uri = Uri.parse("smsto:");
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
public static void openCamera(Context context) {
Intent intent = new Intent(); // 调用照相机
intent.setAction("android.media.action.STILL_IMAGE_CAMERA");
intent.setFlags(0x34c40000);
context.startActivity(intent);
}
public static String getIMEI() {
TelephonyManager tel = (TelephonyManager) KeTuKeLeApplication.mContext
.getSystemService(Context.TELEPHONY_SERVICE);
return tel.getDeviceId();
}
public static String getPhoneType() {
return android.os.Build.MODEL;
}
public static void openApp(Context context, String packageName) {
Intent mainIntent = KeTuKeLeApplication.mContext.getPackageManager()
.getLaunchIntentForPackage(packageName);
// mainIntent.setAction(packageName);
if (mainIntent == null) {
mainIntent = new Intent(packageName);
} else {
TLog.log("Action:" + mainIntent.getAction());
}
context.startActivity(mainIntent);
}
public static boolean isWifiOpen() {
boolean isWifiConnect = false;
ConnectivityManager cm = (ConnectivityManager) KeTuKeLeApplication
.mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
// check the networkInfos numbers
NetworkInfo[] networkInfos = cm.getAllNetworkInfo();
for (int i = 0; i < networkInfos.length; i++) {
if (networkInfos[i].getState() == NetworkInfo.State.CONNECTED) {
if (networkInfos[i].getType() == ConnectivityManager.TYPE_MOBILE) {
isWifiConnect = false;
}
if (networkInfos[i].getType() == ConnectivityManager.TYPE_WIFI) {
isWifiConnect = true;
}
}
}
return isWifiConnect;
}
public static void uninstallApk(Context context, String packageName) {
if (isPackageExist(packageName)) {
Uri packageURI = Uri.parse("package:" + packageName);
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE,
packageURI);
context.startActivity(uninstallIntent);
}
}
@SuppressWarnings("deprecation")
public static void copyTextToBoard(String string) {
if (TextUtils.isEmpty(string))
return;
ClipboardManager clip = (ClipboardManager) KeTuKeLeApplication.mContext
.getSystemService(Context.CLIPBOARD_SERVICE);
clip.setText(string);
}
public static void sendEmail(Context context, String email, String content) {
try {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("text/plain");
intent.putExtra(android.content.Intent.EXTRA_EMAIL,
new String[] { email });
context.startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
public static int getStatuBarHeight() {
Class<?> c = null;
Object obj = null;
Field field = null;
int x = 0, sbar = 38;// 默认为38,貌似大部分是这样的
try {
c = Class.forName("com.android.internal.R$dimen");
obj = c.newInstance();
field = c.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
sbar = KeTuKeLeApplication.mContext.getResources()
.getDimensionPixelSize(x);
} catch (Exception e1) {
e1.printStackTrace();
}
return sbar;
}
public static int getActionBarHeight(Context context) {
int actionBarHeight = 0;
TypedValue tv = new TypedValue();
if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize,
tv, true))
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,
context.getResources().getDisplayMetrics());
if (actionBarHeight == 0
&& context.getTheme().resolveAttribute(R.attr.actionBarSize,
tv, true)) {
actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data,
context.getResources().getDisplayMetrics());
}
// OR as stated by @Marina.Eariel
// TypedValue tv = new TypedValue();
// if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.HONEYCOMB){
// if
// (KeTuKeLeApplication.mContext.getTheme().resolveAttribute(android.R.attr.actionBarSize,
// tv, true))
// actionBarHeight =
// TypedValue.complexToDimensionPixelSize(tv.data,context.getResources().getDisplayMetrics());
// }else if(context.getTheme().resolveAttribute(R.attr.actionBarSize,
// tv, true){
// actionBarHeight =
// TypedValue.complexToDimensionPixelSize(tv.data,context.getResources().getDisplayMetrics());
// }
return actionBarHeight;
}
public static boolean hasStatusBar(Activity activity) {
WindowManager.LayoutParams attrs = activity.getWindow().getAttributes();
if ((attrs.flags & WindowManager.LayoutParams.FLAG_FULLSCREEN) == WindowManager.LayoutParams.FLAG_FULLSCREEN) {
return false;
} else {
return true;
}
}
/**
* 判断指定包名的进程是否运行
*
* @param context
* @param packageName
* 指定包名
* @return 是否运行
*/
public static boolean isRunning(Context context, String packageName) {
ActivityManager am = (ActivityManager) context
.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningAppProcessInfo> infos = am.getRunningAppProcesses();
for (RunningAppProcessInfo rapi : infos) {
if (rapi.processName.equals(packageName))
return true;
}
return false;
}
/**
* 用来判断服务是否运行.
*
* @param context
* @param className
* 判断的服务名字
* @return true 在运行 false 不在运行
*/
public static boolean isServiceRunning(Context mContext, String className) {
boolean isRunning = false;
ActivityManager activityManager = (ActivityManager) mContext
.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningServiceInfo> serviceList = activityManager
.getRunningServices(300);
if (!(serviceList.size() > 0)) {
return false;
}
for (int i = 0; i < serviceList.size(); i++) {
if (serviceList.get(i).service.getClassName().equals(className)) {
return true;
}
}
return isRunning;
}
}
| [
"miagosen@gmail.com"
] | miagosen@gmail.com |
0d7736805f439c1176a14868ca918ce3204b8be1 | 5abd100de1557591ee16e830f0ae4e6908413d58 | /JavaFX/LudoTheque/src/ludotheque/modele/ModeleLivre.java | e376f239306e9903ac741a33b78fdd85250b0d3d | [] | no_license | AlexCardosoR/ProjetAlternatif | aa623baa0ac0774ece6bc371e04c88cc0f781dc3 | 3f5f4e985adbf6cdad881cb7c46bfffea02350d6 | refs/heads/master | 2021-08-30T01:37:02.950705 | 2017-12-15T15:21:24 | 2017-12-15T15:21:24 | 111,423,409 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,995 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ludotheque.modele;
import java.time.LocalDate;
import java.util.Random;
import javafx.beans.property.ListProperty;
import javafx.beans.property.ReadOnlyListProperty;
import javafx.beans.property.SimpleListProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import ludotheque.metier.Livre;
/**
*
* @author tosanchez
*/
public class ModeleLivre {
private final Random rdn = new Random();
private final int maxNombreLivres = 500;
private ObservableList<Livre> lesLivresObs = FXCollections.observableArrayList();
private final ListProperty<Livre> lesLivres = new SimpleListProperty<>(lesLivresObs);
public ObservableList<Livre> getLesLivres() {return lesLivres.get();}
public ReadOnlyListProperty<Livre> lesLivresProperty() {return lesLivres;}
public ModeleLivre() {
lesLivresObs.add(new Livre(rdn.nextInt(maxNombreLivres),"Tintin au Tibet", LocalDate.of(1988, 11, 9),"Hergé","BD Tintin au Tibet","/ludotheque/ressources/TintinAuTibet.jpg"));
lesLivresObs.add(new Livre(rdn.nextInt(maxNombreLivres),"Tintin au Congo", LocalDate.of(1945, 12, 7),"Hergé","BD Tintin au Congo","/ludotheque/ressources/TintinAuCongo.jpg"));
lesLivresObs.add(new Livre(rdn.nextInt(maxNombreLivres),"Tintin au Pérou", LocalDate.of(1998, 10, 3),"Hergé","BD Tintin au Pérou","/ludotheque/ressources/TintinAuPérou.jpg"));
lesLivresObs.add(new Livre(rdn.nextInt(maxNombreLivres),"Martine n'a pas de culotte", LocalDate.of(1995, 02, 3),"Marlier","BD Martine","/ludotheque/ressources/Martinesansculotte.jpg"));
lesLivresObs.add(new Livre(rdn.nextInt(maxNombreLivres),"Martine tente un low-kick", LocalDate.of(1994, 02, 3),"Marlier","BD Martine","/ludotheque/ressources/Martinelowkick.jpg"));
}
}
| [
"33517600+AlexCardosoR@users.noreply.github.com"
] | 33517600+AlexCardosoR@users.noreply.github.com |
990384eb67810f3ea69fce1d8fbca405c1676c6c | 20a39f491ccdfa3162177d2016e9f95990784dda | /app/src/main/java/hfad/com/toddycustomer2/ui/dashboard/DashboardViewModel.java | 46f1be5cf805729e02449aac734213b36180354a | [] | no_license | surainfernando/ToddyCustomer2 | 3c8cb70b010064e9941eb3c4e3a6f9e682d51c3b | 1f660f9b057dd9564e235624f2978f21da543bdd | refs/heads/main | 2023-01-12T17:40:55.520767 | 2020-11-18T12:24:10 | 2020-11-18T12:24:10 | 313,926,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 466 | java | package hfad.com.toddycustomer2.ui.dashboard;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class DashboardViewModel extends ViewModel {
private MutableLiveData<String> mText;
public DashboardViewModel() {
mText = new MutableLiveData<>();
mText.setValue("This is dashboard fragment");
}
public LiveData<String> getText() {
return mText;
}
} | [
"59121315+surainfernando@users.noreply.github.com"
] | 59121315+surainfernando@users.noreply.github.com |
8fa532db839bd7c8742c87618a016409ce991eb0 | 1b64eec5e0db5a209bf3a4055cac6651af8b8f31 | /app/src/main/java/com/ms/gmpis/models/Album.java | ce79e5f4151d75b1f69e687d1e04e1771d39e7a8 | [] | no_license | shofikul1992/GalleryApp | dfb4242e985fdf03fd39109d7c603331562f311a | 055ae2947cafe370e648dba1f26d41c0a343b9f1 | refs/heads/master | 2021-07-21T23:15:43.832473 | 2017-11-01T06:06:38 | 2017-11-01T06:06:38 | 109,093,535 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 253 | java | package com.ms.gmpis.models;
/**
* Created by Darshan on 4/14/2015.
*/
public class Album {
public String name;
public String cover;
public Album(String name, String cover) {
this.name = name;
this.cover = cover;
}
}
| [
"shofikul19922@gmail.com"
] | shofikul19922@gmail.com |
8bef17f6605b9176ae660f81a80c816d22d9d678 | 6a73b02b6ae0b1f57b997bf9ed6987c064fa2903 | /src/main/java/banking/banking/utils/CompteNotFoundException.java | 88aadc8439aff74b46ede62630cf1919e341b6f4 | [] | no_license | caninaam/banque | c330b0d10a73f5388391ef0d3ffb6b43020599c1 | f252e9849fce385fbaa13cf21d894e768537f993 | refs/heads/master | 2022-01-22T12:03:46.935375 | 2020-03-09T12:23:54 | 2020-03-09T12:23:54 | 244,188,392 | 0 | 0 | null | 2022-01-21T23:38:44 | 2020-03-01T16:59:27 | Java | UTF-8 | Java | false | false | 787 | java | package banking.banking.utils;
public class CompteNotFoundException extends Exception {
public CompteNotFoundException() {
super();
// TODO Auto-generated constructor stub
}
public CompteNotFoundException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
// TODO Auto-generated constructor stub
}
public CompteNotFoundException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public CompteNotFoundException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public CompteNotFoundException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
}
| [
"macanina@sibille.lan"
] | macanina@sibille.lan |
38f8a2d22104fab9dc85bb27101f0598323aa573 | cf5833f56e85854b9487349cd2f9ddffc9c6a098 | /src/test/java/de/gzockoll/prototype/camel/encashment/service/ThroughputMeasurmentProcessorTest.java | 0baf6f2ce5cb63cfec86217502ce1673651423ee | [] | no_license | MehrCurry/camel-test | bbfd5fa5acb55537d2a2f114cfa8d643f91302f7 | 6fbc484bfdcdc63f1e50069cb86cec1e56233221 | refs/heads/master | 2020-05-17T15:49:42.613634 | 2012-03-24T05:56:24 | 2012-03-24T05:56:24 | 2,353,400 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 862 | java | package de.gzockoll.prototype.camel.encashment.service;
import static org.hamcrest.core.Is.*;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
public class ThroughputMeasurmentProcessorTest {
private ThroughputMeasurmentProcessor bus;
@Before
public void setUp() {
bus = new ThroughputMeasurmentProcessor(1000);
}
@Test
public void testAdd() {
assertThat(bus.getQueueSize(), is(0));
bus.add(null);
assertThat(bus.getQueueSize(), is(1));
}
@Test
public void testGetQueueSize() throws InterruptedException {
for (int i = 0; i < 5; i++) {
bus.add(null);
}
Thread.sleep(500);
for (int i = 0; i < 5; i++) {
bus.add(null);
}
assertThat(bus.getQueueSize(), is(10));
Thread.sleep(600);
assertThat(bus.getQueueSize(), is(5));
Thread.sleep(500);
assertThat(bus.getQueueSize(), is(0));
}
}
| [
"gzockoll@gmail.com"
] | gzockoll@gmail.com |
90f880fb645123beebb26cba1ef260e67ce4fe15 | 7a9e67d0c6d4336056b31ea7e35aa55eebcb6d3f | /app/src/main/java/com/example/dimaculangan/progressapp/CustomDialog.java | 6d6c9aeeb3d21d57ee1792aa0ad114c18379bcb2 | [] | no_license | aldrindims/ProgressApp | db7897508fc616c9625ef600bc4b4b1864f8c3ee | 6955209363d5c8f51cf17145e54227213be8c3cd | refs/heads/master | 2021-08-24T02:03:04.228031 | 2017-12-07T15:21:00 | 2017-12-07T15:21:00 | 112,350,511 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,997 | java | package com.example.dimaculangan.progressapp;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.content.DialogInterface;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class CustomDialog extends DialogFragment {
LayoutInflater inflater;
View view;
EditText et_User, et_Password;
int CATEGORY_SCORE, CATEGORY_TOTAL;
DatabaseHelper myDatabaseHelper;
SQLiteDatabase dbase;
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
inflater = getActivity().getLayoutInflater();
view = inflater.inflate(R.layout.activity_custom_dialog, null);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle("Score");
builder.setView(view);
builder.setPositiveButton("Save", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
et_User = ((EditText)view.findViewById(R.id.score));
et_Password = ((EditText)view.findViewById(R.id.total_score));
CATEGORY_SCORE = Integer.parseInt(et_User.getText().toString());
CATEGORY_TOTAL = Integer.parseInt(et_Password.getText().toString());
myDatabaseHelper.insertAdd(CATEGORY_SCORE, CATEGORY_TOTAL);
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel();
}
});
Dialog dialog = builder.create();
return dialog;
}
}
| [
"aldrindims@gmail.com"
] | aldrindims@gmail.com |
eb23dc892d6e1a92d224ce58721a8ad1db08c62d | 13071775cfc00e6159aa882d12f8310a8c5babb3 | /app/src/main/java/cn/leo/fivechess/AI/Constant.java | afc3f83d4692e567eadd7f050281c4e6231744b2 | [] | no_license | zkyq05/FiveChess | 7573673836615bee8b6f3c7bbf86109b8743fb4c | 831ef307715ecca7713bc3c84d978783c8a2be8a | refs/heads/master | 2020-04-13T22:59:31.466119 | 2018-12-29T08:49:10 | 2018-12-29T08:49:10 | 163,494,217 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,582 | java | package cn.leo.fivechess.AI;
/**
* Created by lsw on 2017/9/20.
*/
class Constant {
/**
* 各情况定义的权重
*/
//已落子
static final int HAD_CHESS = -10;
//棋盘中间点
static final int MID_POINT = 1;
//所在区域无生存空间
static final int NOT_ENOUGH_SPACE = -1;
//将死
static final int CHECKMATE = 20;
//对方_将死
static final int RIVAL_CHECKMATE = 19;
//让0缓1
static final int R_0_D_1 = 18;
//对方_让0缓1
static final int RIVAL_R_0_D_1 = 17;
//让0缓2
static final int R_0_D_2 = 16;
//对方_让0缓2
static final int RIVAL_R_0_D_2 = 15;
//让1缓1_冲四
static final int R_1_D_1_R4 = 14;
//让1缓1_跳四
static final int R_1_D_1_J4 = 13;
//让1缓2_活三
static final int R_1_D_2_L3 = 12;
//让1缓2_跳三
static final int R_1_D_2_J3 = 11;
//对方_让1缓1_冲四
static final int RIVAL_R_1_D_1_R4 = 10;
//对方_让1缓1_跳四
static final int RIVAL_R_1_D_1_J4 = 9;
//对方_让1缓2_活三
static final int RIVAL_R_1_D_2_L3 = 8;
//对方_让1缓2_跳三
static final int RIVAL_R_1_D_2_J3 = 7;
//让2缓2_眠三
static final int R_2_D_2 = 6;
//让2缓3_活二
static final int R_2_D_3_L2 = 5;
//让2缓3_跳二
static final int R_2_D_3_J2 = 4;
//对方_让2缓2_眠三
static final int RIVAL_R_2_D_2 = 3;
//对方_让2缓3_活二
static final int RIVAL_R_2_D_3_L2 = 2;
//对方_让2缓3_跳二
static final int RIVAL_R_2_D_3_J2 = 1;
}
| [
"18833196975@qq.com"
] | 18833196975@qq.com |
aa83c7f5d27132be46c34a01315adb45e995b0da | 4aefd110bd3fbaa59e3cbc9f6375007f12519cfb | /breeze/src/main/java/com/yliec/breeze/HttpStackFactory.java | 0f8b71f81e12e7a634e6fe931d03023185b1a630 | [] | no_license | lecion/AndroidStudioGitTestDemo | 2f984097161c762a2dab26ac78951a6dffa1c434 | ee4e626dd3efb6b469cad47804576b4da69f2427 | refs/heads/master | 2021-01-20T07:02:30.254962 | 2015-06-20T12:52:23 | 2015-06-20T12:52:23 | 25,023,044 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 374 | java | package com.yliec.breeze;
import android.os.Build;
/**
* @Author Lecion
* @Date 6/16/15
* @Email lecion@icloud.com
*/
public class HttpStackFactory {
public static HttpStack createHttpStack() {
int sdk = Build.VERSION.SDK_INT;
if (sdk >= 9) {
return new HttpUrlConnectionStack();
}
return new HttpClientStack();
}
}
| [
"ylc931116@gmail.com"
] | ylc931116@gmail.com |
eba507107b5cc7290ab1166b7720f8832fcdaa60 | c0e2faa36bdf3822b39333a6fe6965bc261ee67a | /CleanSweep/src/com/blackdroidstudios/cleansweep/map/FloorMap.java | 412a912c75e499e720b0bf2a519768bc4975b73a | [] | no_license | rooneybb/VacuumSimulator | ceccbf609c977d5bc1f7c19eac6da4887de34584 | 2dcdf177a11bea43048783e8b74b9ed2da840a43 | refs/heads/master | 2021-01-11T17:57:23.216069 | 2017-01-24T04:42:36 | 2017-01-24T04:42:36 | 79,879,159 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 602 | java | package com.blackdroidstudios.cleansweep.map;
/**
*
* @author Armando Garcin
*
*<p>This class is the Main controller for the entire Map!</p>
*/
public class FloorMap
{
//Statics
public static final int FLOOR_SIZE_X = 15;
public static final int FLOOR_SIZE_Y = 15;
//Variables
private FloorGenerator floorGen;
private Tile[][] map;
//Constructor
public FloorMap()
{
floorGen = new FloorGenerator();
map = floorGen.generateEmptyMap();
}
public Tile[][] generateMap()
{
map = floorGen.generateMap();
return map;
}
public Tile[][] getMap()
{
return map;
}
}
| [
"rooneybb2@gmail.com"
] | rooneybb2@gmail.com |
56e8cca218a2c8fe3b07f6e46637fb15b06f47c6 | 53d677a55e4ece8883526738f1c9d00fa6560ff7 | /com/google/android/gms/tasks/zzl.java | 65561c0c523e8b51f8fc3a16ff51eb95c6cf6c48 | [] | no_license | 0jinxing/wechat-apk-source | 544c2d79bfc10261eb36389c1edfdf553d8f312a | f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d | refs/heads/master | 2020-06-07T20:06:03.580028 | 2019-06-21T09:17:26 | 2019-06-21T09:17:26 | 193,069,132 | 9 | 4 | null | null | null | null | UTF-8 | Java | false | false | 669 | java | package com.google.android.gms.tasks;
import com.tencent.matrix.trace.core.AppMethodBeat;
final class zzl
implements Runnable
{
zzl(zzk paramzzk, Task paramTask)
{
}
public final void run()
{
AppMethodBeat.i(57398);
synchronized (zzk.zza(this.zzafv))
{
if (zzk.zzb(this.zzafv) != null)
zzk.zzb(this.zzafv).onFailure(this.zzafn.getException());
AppMethodBeat.o(57398);
return;
}
}
}
/* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes-dex2jar.jar
* Qualified Name: com.google.android.gms.tasks.zzl
* JD-Core Version: 0.6.2
*/ | [
"172601673@qq.com"
] | 172601673@qq.com |
68f9da7b2a49143d5b4e2dd283aeb2b04c908be9 | 40e4ce9d3ab15fa3a1eb2698a82b86552adb7eb1 | /src/controller/ExchangeCtrl.java | 3695cfc3b1bb4f9d92c894104d2b3907c42655f4 | [] | no_license | Taeila92/fourplay | 2c90417ca8d3619cbd8a7f06588a2844521d5ff7 | 164c0e93dc230f44c26d6dfdbd7fd9b19d4699d6 | refs/heads/master | 2023-03-23T20:15:12.879175 | 2021-03-17T04:05:57 | 2021-03-17T04:05:57 | 326,875,116 | 0 | 1 | null | 2021-01-07T13:51:45 | 2021-01-05T03:28:14 | Java | UHC | Java | false | false | 2,030 | java | package controller;
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 action.Action;
import action.PdtListAction;
import action.PdtViewAction;
import vo.ActionForward;
@WebServlet("*.exc")
public class ExchangeCtrl extends HttpServlet {
private static final long serialVersionUID = 1L;
public ExchangeCtrl() {
super();
}
protected void doProcess(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// 사용자의 요청이 get이든 post이든 모두 처리하는 메소드
request.setCharacterEncoding("utf-8");
String requestUri = request.getRequestURI();
String contextPath = request.getContextPath();
String command = requestUri.substring(contextPath.length());
ActionForward forward = null;
Action action = null;
// 사용자의 요청 종류에 따라 각각 다른 action을 취함
switch (command) {
case "/exc_inform.exc" : // 상품 등록 폼
action = new PdtListAction(); break;
}
try {
forward = action.execute(request, response);
} catch (Exception e) {
e.printStackTrace();
}
if (forward != null) {
if (forward.isRedirect()) {
response.sendRedirect(forward.getPath());
} else {
RequestDispatcher dispatcher =
request.getRequestDispatcher(forward.getPath());
dispatcher.forward(request, response);
}
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doProcess(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doProcess(request, response);
}
}
| [
"kim920125@naver.com"
] | kim920125@naver.com |
84d47c3c4db0fb55bfd6627ac298a367e46c5f8a | 59a983893b916343a30bb1c6354f51eea16c3254 | /acceptance-tests/src/test/java/org/educama/acceptancetests/steps/ShipmentsListSteps.java | 3bd45d548d9a174a3b8978af9f777c9c571cd21a | [
"Apache-2.0"
] | permissive | tobiasschaefer/Showcase | 7b7917b2fbfde1e608223fd04ef2150a10317632 | 9c924050a96821e9a0f49f52edd8766f63b82f27 | refs/heads/master | 2020-04-05T11:21:12.811301 | 2016-12-21T11:40:53 | 2016-12-21T11:40:53 | 67,069,154 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package org.educama.acceptancetests.steps;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.List;
import org.educama.acceptancetests.pages.ShipmentsListPage;
import net.thucydides.core.annotations.Step;
public class ShipmentsListSteps {
ShipmentsListPage shipmentsListPage;
@Step
public void opensThePage() {
shipmentsListPage.open();
shipmentsListPage.openShipments();
}
@Step
public void openShipmentsListPage() {
shipmentsListPage.openShipments();
}
@Step
public void checksTheShipmentsList() {
assertThat("There are cases in the case list.", shipmentsListPage.getShipmentsList().size() == 0, is(true));
}
@Step
public void checksTheShipmentListForOneShipment() {
List<String> shipmentsList = shipmentsListPage.getShipmentsList();
int size = shipmentsList.size();
assertThat("There are" + size + " shipment/s in the shipment list", size == 1, is(true));
}
@Step
public void addOneShipment() {
shipmentsListPage.addShipment();
}
@Step
public void openAddShipmentModal() {
shipmentsListPage.openAddShipmentModal();
}
@Step
public void closeAddShipmentModal() {
shipmentsListPage.closeAddShipmentModal();
}
}
| [
"noreply@github.com"
] | tobiasschaefer.noreply@github.com |
f5118882d64af209bba3cae82d223a7959cfa296 | 9681f1c86e198f21751979bac00f9d34ea8977e0 | /WMAD202Structure/wmad202-exampleAli2/src/ca/ciccc/wmad202/assignment7/tests/ProductEvaluator.java | ce5912cb7c0c7c51e436ef07fe17df6f29cb70bd | [] | no_license | andresfelipear/javaCiccc | d12a432773fa7b0b22cbcfd7f666b92be282a181 | 949882166d493b04b6f4576b9e600cd3956f0999 | refs/heads/master | 2023-07-08T02:38:13.044491 | 2021-08-08T04:45:02 | 2021-08-08T04:45:02 | 380,083,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 318 | java | package ca.ciccc.wmad202.assignment7.tests;
import ca.ciccc.wmad202.assignment7.generic1.Condition;
public class ProductEvaluator implements Condition<Product> {
@Override
public boolean evaluate(Product item) {
if(item.getPrice()<3){
return true;
}
return false;
}
}
| [
"andresfelipear@gmail.com"
] | andresfelipear@gmail.com |
ab553d75b5a2001578037e3ee82d3dbb9333148f | 7569f9a68ea0ad651b39086ee549119de6d8af36 | /cocoon-2.1.9/src/blocks/portal/java/org/apache/cocoon/portal/tools/PortalToolBuilder.java | b02983857008d65b86ca13f0f4b61c9969656f2b | [
"Apache-2.0"
] | permissive | tpso-src/cocoon | 844357890f8565c4e7852d2459668ab875c3be39 | f590cca695fd9930fbb98d86ae5f40afe399c6c2 | refs/heads/master | 2021-01-10T02:45:37.533684 | 2015-07-29T18:47:11 | 2015-07-29T18:47:11 | 44,549,791 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,732 | java | /*
* Copyright 1999-2005 The Apache Software Foundation.
*
* 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.apache.cocoon.portal.tools;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
import org.xml.sax.SAXException;
/**
*
* @version CVS $Id: PortalToolBuilder.java 149055 2005-01-29 18:21:34Z cziegeler $
*/
public class PortalToolBuilder {
public PortalTool buildTool(File confFile, String rootDir, String pluginDir, String i18nDir) {
PortalTool pTool = null;
try {
DefaultConfigurationBuilder dcb = new DefaultConfigurationBuilder();
Configuration conf = dcb.buildFromFile(confFile);
String toolName = conf.getAttribute("name");
String toolId = conf.getAttribute("id");
HashMap functions = new HashMap();
ArrayList i18n = new ArrayList();
Configuration[] funcs = conf.getChild("functions").getChildren();
for(int i = 0; i < funcs.length; i++) {
PortalToolFunction ptf = new PortalToolFunction();
ptf.setName(funcs[i].getAttribute("name"));
ptf.setFunction(funcs[i].getAttribute("pipeline"));
ptf.setId(funcs[i].getAttribute("id"));
ptf.setInternal(new Boolean(funcs[i].getAttribute("internal", "false")).booleanValue());
functions.put(ptf.getName(), ptf);
}
Configuration[] i18ns = conf.getChild("i18n").getChildren();
for(int i = 0; i < i18ns.length; i++) {
PortalToolCatalogue ptc = new PortalToolCatalogue();
ptc.setId(i18ns[i].getAttribute("id"));
ptc.setLocation(rootDir + pluginDir + toolId + "/" + i18nDir);
ptc.setName(i18ns[i].getAttribute("name"));
i18n.add(ptc);
}
pTool = new PortalTool(toolName, toolId, functions, i18n);
} catch (ConfigurationException ece) {
// TODO
} catch (SAXException esax) {
// TODO
} catch (IOException eio) {
// TODO
}
return pTool;
}
}
| [
"ms@tpso.com"
] | ms@tpso.com |
7b50f9c8f0fafa58860a8c55996b1474c436fa2b | 8aa2400ec6c4acd3d99d1e86f9ecf3447d526bf0 | /src/com/jxau/service/impl/EmployeeServiceImpl.java | dde1029b5c1dc283c8ad44d3d7a79429e11769bc | [] | no_license | Youzhihui/HospitalHR | ef30bcf72465653be492d77b24c3e75bd38932ee | 808d2d0fad53ef2e3263ef0610e6b9aa872144a9 | refs/heads/master | 2022-09-20T17:57:20.391373 | 2020-06-02T00:51:48 | 2020-06-02T00:51:48 | 268,664,374 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 5,924 | java | package com.jxau.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jxau.mapper.DepartmentMapper;
import com.jxau.mapper.EmployeeMapper;
import com.jxau.mapper.HistoryMapper;
import com.jxau.mapper.MoveMapper;
import com.jxau.mapper.PositionMapper;
import com.jxau.pojo.Department;
import com.jxau.pojo.Employee;
import com.jxau.pojo.History;
import com.jxau.pojo.Move;
import com.jxau.pojo.Position;
import com.jxau.service.EmployeeService;
@Service("employeeService")
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee>
implements EmployeeService{
@Autowired
private HistoryMapper historyMapper;
@Autowired
private DepartmentMapper departmentMapper;
@Autowired
private PositionMapper positionMapper;
@Autowired
private MoveMapper moveMapper;
/**
* 为employee对象setDepartment setPosition
* @param employee
* @return
*/
public Employee setObject(Employee employee){
Integer departmentNumber = employee.getDepartmentNumber();
Department department = departmentMapper.selectByNumber(departmentNumber);
employee.setDepartment(department);
Integer positionNumber = employee.getPositionNumber();
Position position = positionMapper.selectByNumber(positionNumber);
employee.setPosition(position);
return employee;
}
@Override
public Employee checkLogin(Integer employeeNumber, String password) {
Employee employee = baseMapper.checkLogin(employeeNumber, password);
if (employee != null) {
//为employee对象中setDepartment setPosition
setObject(employee);
}
return employee;
}
@Override
public List<Employee> select(Integer employeeNumber, String password){
List<Employee> eList = baseMapper.selectList(new EntityWrapper<Employee>()
.eq("employee_number", employeeNumber)
.eq("password", password));
return eList;
}
@Override
public Page<Employee> selectListByPage(int pageNo) {
Page<Employee> page = new Page<Employee>(pageNo, 10,"id");
//是否为升序 ASC( 默认: true )
page.setAsc(false);
List<Employee> eList = baseMapper.selectPage(page, null);
for(Employee e : eList){
//为employee对象中setDepartment setPosition
setObject(e);
}
page.setRecords(eList);
return page;
}
@Transactional
@Override
public void addEmployee(Employee employee) {
//向employee中插入记录
employee.setInTime(new Date());
baseMapper.insert(employee);
//同时向history中插入记录
History history = new History();
history.setEmployeeNumber(employee.getEmployeeNumber());
history.setName(employee.getName());
history.setGender(employee.getGender());
history.setBirthday(employee.getBirthday());
history.setTelephone(employee.getTelephone());
history.setEmail(employee.getEmail());
history.setAddress(employee.getAddress());
history.setPhoto(employee.getPhoto());
history.setEducation(employee.getEducation());
history.setInTime(employee.getInTime());
history.setDepartmentNumber(employee.getDepartmentNumber());
history.setPositionNumber(employee.getPositionNumber());
history.setStatus("在职");
history.setNotes(employee.getNotes());
historyMapper.insert(history);
}
@Override
public Employee selectEmployee(Integer id) {
Employee employee = baseMapper.selectById(id);
//向employee对象中setDepartment setPosition
setObject(employee);
return employee;
}
@Transactional
@Override
public void updateEmployee(Employee employee, String status, String manager) {
//判断员工的在职状态是否改变
if (status.equals("在职")) {
//状态未改变,更新员工信息
//获取员工原始信息,用于判断部门或职称是否改变
Employee employee2 = baseMapper.selectById(employee.getId());
Move move = new Move();
move.setEmployeeNumber(employee.getEmployeeNumber());
move.setTime(new Date());
move.setManager(manager);
//判断员工的部门是否改变,若改变向change中插入一条员工变动记录
if(!employee.getDepartmentNumber().equals(employee2.getDepartmentNumber())){
move.setBefore(employee2.getDepartmentNumber());
move.setAfter(employee.getDepartmentNumber());
moveMapper.insert(move);
}
baseMapper.updateById(employee);
}else{
//状态变为离职或退休
//删除在职员工记录
baseMapper.deleteById(employee.getId());
//更新员工档案的状态
History history = historyMapper.selectByNumber(employee.getEmployeeNumber());
history.setStatus(status);
history.setOutTime(new Date());
historyMapper.updateById(history);
}
}
@Override
public Employee selectByNumber(Integer employeeNumber) {
return baseMapper.selectByNumber(employeeNumber);
}
@Transactional
@Override
public void deleteEmployee(Integer id) {
//先查询再删除,否则NullPointerException
Employee employee = baseMapper.selectById(id);
//删除在职员工记录
baseMapper.deleteById(id);
//将员工档案表中的状态改为离职
History history = historyMapper.selectByNumber(employee.getEmployeeNumber());
history.setStatus("离职");
historyMapper.updateById(history);
}
@Override
public Page<Employee> search(String input, int pageNo) {
Page<Employee> page = new Page<Employee>(pageNo, 10, "id");
//是否为升序 ASC( 默认: true )
page.setAsc(false);
List<Employee> eList = baseMapper.selectPage(page, new EntityWrapper<Employee>()
.like("name", input));
for(Employee e : eList){
//为employee对象中setDepartment setPosition
setObject(e);
}
page.setRecords(eList);
return page;
}
}
| [
"1574583514@qq.com"
] | 1574583514@qq.com |
9917a85184399c7feac47c7f4d4c84aa7e8a23bf | 52ff6eee9f674e91e6ca5bb96064c485a88e4904 | /java/Login.java | b8d9cc04d928384c0d931158bdc883da5284cc0f | [] | no_license | JooyeonJung/WIC-Hackathon | 9f22879edac423f283b275eded15437ed4788e24 | 26429808d0ae87b7ff7da9ee8a81bbd69844e4dc | refs/heads/master | 2022-11-28T20:47:49.349085 | 2020-08-13T04:43:38 | 2020-08-13T04:43:38 | 204,832,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 817 | java | package com.example.sally.mapproj;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import androidx.appcompat.app.AppCompatActivity;
public class Login extends AppCompatActivity {
ImageButton btn_kakao;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
btn_kakao = (ImageButton) findViewById(R.id.btn_kakao);
btn_kakao.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(Login.this, MainActivity2.class);
startActivity(intent);
}
});
}
}
| [
"noreply@github.com"
] | JooyeonJung.noreply@github.com |
ba90acedd1b023e13d2b164e52bc4b72baa2b354 | 9d142380c8da32d21fad260b7ecf7c8ae320ab13 | /src/test/java/com/k15t/pat/UserRegistrationControllerTest.java | 85d96444ea3e11d078c3131181e373db6460eb27 | [] | no_license | julianvasa/user-registration-boot-meetup | 9eb98d8e2041290467e28c705911f51bc44d38b6 | 70d5029095524ce477157fad859d66232fbbddbf | refs/heads/master | 2020-09-09T02:14:24.496044 | 2019-11-13T21:47:16 | 2019-11-13T21:47:16 | 221,314,924 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,741 | java | package com.k15t.pat;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.k15t.pat.model.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertNotNull;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.model;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringRunner.class)
@SpringBootTest
@AutoConfigureMockMvc
public class UserRegistrationControllerTest {
@Autowired
private MockMvc mockMvc;
@Autowired
private ObjectMapper mapper;
private final String payload = "{\"name\":\"name\",\"password\":\"password\",\"email\":\"test@test.com\",\"address\":\"address\"}";
private final String incorrectData = "{\"name\":\"name1\",\"password\":\"password\",\"email\":\"test@test.com\",\"address\":\"address\"}";
private final String success = "{\"name\":\"juli\",\"password\":\"password\",\"email\":\"test@test.com\",\"address\":\"address\"}";
private final String already_exists = "{\"name\":\"duplicate\",\"password\":\"password\",\"email\":\"test@test.com\",\"address\":\"address\"}";
private final String already_exists_api = "{\"name\":\"api\",\"password\":\"password\",\"email\":\"test@test.com\",\"address\":\"address\"}";
@Test
public void testRegistrationFrontend() throws Exception {
User user = mapper.readValue(success, User.class);
mockMvc.perform(post("/rest/registration")
.flashAttr("user", user))
.andExpect(status().isOk())
.andExpect(model().attribute("success", equalTo(true)))
.andExpect(model().attribute("newUser", equalTo(user)));
}
@Test
public void testRegistrationFrontendWithIncorrectData() throws Exception {
User user = mapper.readValue(incorrectData, User.class);
mockMvc.perform(post("/rest/registration")
.flashAttr("user", user))
.andExpect(status().isOk())
.andExpect(model().attribute("success", equalTo(null)))
.andExpect(model().attribute("newUser", equalTo(null)));
}
@Test
public void testRegistrationApi() throws Exception {
MvcResult response = mockMvc.perform(post("/api/registration")
.content(payload)
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated())
.andReturn();
User userResponse = mapper.readValue(response.getResponse().getContentAsString(), User.class);
assertNotNull(userResponse);
assertNotNull(userResponse.getId());
}
@Test
public void testRegistrationApiWithIncorrectInputData() throws Exception {
mockMvc.perform(post("/api/registration")
.content(incorrectData)
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest())
.andReturn();
}
@Test
public void whenNameAlreadyExists_thenUserIsNotCreated() throws Exception {
User user_already_exists = mapper.readValue(already_exists, User.class);
mockMvc.perform(post("/rest/registration")
.flashAttr("user", user_already_exists))
.andExpect(status().isOk())
.andReturn();
mockMvc.perform(post("/rest/registration")
.flashAttr("user", user_already_exists))
.andExpect(status().isOk())
.andReturn();
}
@Test
public void whenNameAlreadyExists_thenUserIsNotCreatedThroughApi() throws Exception {
mockMvc.perform(post("/api/registration")
.content(already_exists_api)
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated())
.andReturn();
mockMvc.perform(post("/api/registration")
.content(already_exists_api)
.accept(MediaType.APPLICATION_JSON)
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isConflict())
.andReturn();
}
}
| [
"vasa.julian@gmail.com"
] | vasa.julian@gmail.com |
83655093535dbe43b2d17ffaeb7a1475becdce30 | f0cf47fdd2477516556c2b3d8bf3398be7c43f1f | /src/main/java/tacos/User.java | e4860d61aae8e801b5e6c2bde9e5213d708e410e | [] | no_license | wfatec/taco-cloud | 1a01ef398056f11212f8397df3f9fb1356e743cd | b99292a9beba0ac0ec5c3ac3ca292c1280f5647f | refs/heads/master | 2020-05-18T04:28:42.766872 | 2019-05-15T12:14:40 | 2019-05-15T12:14:40 | 184,070,787 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,473 | java | package tacos;
import java.util.Arrays;
import java.util.Collection;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import lombok.AccessLevel;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.RequiredArgsConstructor;
@Entity
@Data
@NoArgsConstructor(access = AccessLevel.PRIVATE, force = true)
@RequiredArgsConstructor
public class User implements UserDetails {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private final String username;
private final String password;
private final String fullname;
private final String street;
private final String city;
private final String state;
private final String zip;
private final String phoneNumber;
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return Arrays.asList(new SimpleGrantedAuthority("ROLE_USER"));
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
}
| [
"wangchao28@vipkid.com.cn"
] | wangchao28@vipkid.com.cn |
86370cf097ad01be7b7ee48e3e067ff4fec63be1 | 783903324b6fddd51af63eb76a5d122abb46b4a8 | /app/src/main/java/com/policia/codigopolicia/adapter/Busqueda_Adapter.java | 77f688603006f1243b442b071ebb809675705259 | [] | no_license | jodiazsbt/CodigoPolicia | cfd0e2c01ec4c136e24f40b03add9e53457832af | 5b9bf60bd63365f109c14b050ad19bba85ba80bb | refs/heads/master | 2021-09-10T08:27:26.878490 | 2018-03-22T21:37:19 | 2018-03-22T21:37:19 | 113,607,384 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,321 | java | package com.policia.codigopolicia.adapter;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.policia.codigopolicia.R;
import com.policia.negocio.modelo.Modelo_Busqueda_Articulo;
import java.util.ArrayList;
/**
* Created by JORGE on 3/12/2017.
*/
public class Busqueda_Adapter extends BaseAdapter {
public Fragment_METEDATA context;
public ArrayList<Modelo_Busqueda_Articulo> busquedaArticulos;
public Busqueda_Adapter(Fragment_METEDATA context, ArrayList<Modelo_Busqueda_Articulo> articulos) {
this.context = context;
this.busquedaArticulos = articulos;
}
@Override
public int getCount() {
return this.busquedaArticulos.size();
}
@Override
public Object getItem(int position) {
return this.busquedaArticulos.get(position);
}
@Override
public long getItemId(int position) {
return Long.parseLong(busquedaArticulos.get(position).CapituloID);
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View rowView = convertView;
ViewHolder viewHolder;
if (rowView == null) {
LayoutInflater inflater = context.getLayoutInflater();
rowView = inflater.inflate(R.layout.busqueda_capitulo, null);
// configure view holder
viewHolder = new ViewHolder();
viewHolder.textLIBRO = (TextView) rowView.findViewById(R.id.textLIBRO);
viewHolder.textTITULO = (TextView) rowView.findViewById(R.id.textTITULO);
viewHolder.textCAPITULO = (TextView) rowView.findViewById(R.id.textCAPITULO);
viewHolder.textARTICULO = (TextView) rowView.findViewById(R.id.textARTICULO);
rowView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.textLIBRO.setText(busquedaArticulos.get(position).Libro);
viewHolder.textTITULO.setText(busquedaArticulos.get(position).Titulo);
viewHolder.textCAPITULO.setText(busquedaArticulos.get(position).Capitulo);
viewHolder.textARTICULO.setText(busquedaArticulos.get(position).Articulo);
return rowView;
}
}
| [
"jodiazsbt@gmail.com"
] | jodiazsbt@gmail.com |
8f29621c0f7366b3883359d32563f5d95ebe40f4 | 20eb62855cb3962c2d36fda4377dfd47d82eb777 | /newEvaluatedBugs/Jsoup_43_buggy/mutated/1611/HtmlTreeBuilderState.java | 5ff58cc2c28f34bcbc47125cd458ee96a54a26fc | [] | no_license | ozzydong/CapGen | 356746618848065cce4e253e5d3c381baa85044a | 0ba0321b6b1191443276021f1997833342f02515 | refs/heads/master | 2023-03-18T20:12:02.923428 | 2020-08-21T03:08:28 | 2020-08-21T03:08:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 68,223 | java | package org.jsoup.parser;
import org.jsoup.helper.DescendableLinkedList;
import org.jsoup.helper.StringUtil;
import org.jsoup.nodes.*;
import java.util.Iterator;
import java.util.LinkedList;
/**
* The Tree Builder's current state. Each state embodies the processing for the state, and transitions to other states.
*/
enum HtmlTreeBuilderState {
Initial {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
return true; // ignore whitespace
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
// todo: parse error check on expected doctypes
// todo: quirk state check on doctype ids
Token.Doctype d = t.asDoctype();
DocumentType doctype = new DocumentType(d.getName(), d.getPublicIdentifier(), d.getSystemIdentifier(), tb.getBaseUri());
tb.getDocument().appendChild(doctype);
if (d.isForceQuirks())
tb.getDocument().quirksMode(Document.QuirksMode.quirks);
tb.transition(BeforeHtml);
} else {
// todo: check not iframe srcdoc
tb.transition(BeforeHtml);
return tb.process(t); // re-process token
}
return true;
}
},
BeforeHtml {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (isWhitespace(t)) {
return true; // ignore whitespace
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
tb.insert(t.asStartTag());
tb.transition(BeforeHead);
} else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) {
return anythingElse(t, tb);
} else if (t.isEndTag()) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.insert("html");
tb.transition(BeforeHead);
return tb.process(t);
}
},
BeforeHead {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
return true;
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return InBody.process(t, tb); // does not transition
} else if (t.isStartTag() && t.asStartTag().name().equals("head")) {
Element head = tb.insert(t.asStartTag());
tb.setHeadElement(head);
tb.transition(InHead);
} else if (t.isEndTag() && (StringUtil.in(t.asEndTag().name(), "head", "body", "html", "br"))) {
tb.process(new Token.StartTag("head"));
return tb.process(t);
} else if (t.isEndTag()) {
tb.error(this);
return false;
} else {
tb.process(new Token.StartTag("head"));
return tb.process(t);
}
return true;
}
},
InHead {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
return true;
}
switch (t.type) {
case Comment:
tb.insert(t.asComment());
break;
case Doctype:
tb.error(this);
return false;
case StartTag:
Token.StartTag start = t.asStartTag();
String name = start.name();
if (name.equals("html")) {
return InBody.process(t, tb);
} else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link")) {
Element el = tb.insertEmpty(start);
// jsoup special: update base the frist time it is seen
if (name.equals("base") && el.hasAttr("href"))
tb.maybeSetBaseUri(el);
} else if (name.equals("meta")) {
Element meta = tb.insertEmpty(start);
// todo: charset switches
} else if (name.equals("title")) {
handleRcData(start, tb);
} else if (StringUtil.in(name, "noframes", "style")) {
handleRawtext(start, tb);
} else if (name.equals("noscript")) {
// else if noscript && scripting flag = true: rawtext (jsoup doesn't run script, to handle as noscript)
tb.insert(start);
tb.transition(InHeadNoscript);
} else if (name.equals("script")) {
// skips some script rules as won't execute them
tb.insert(start);
tb.tokeniser.transition(TokeniserState.ScriptData);
tb.markInsertionMode();
tb.transition(Text);
} else if (name.equals("head")) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
break;
case EndTag:
Token.EndTag end = t.asEndTag();
name = end.name();
if (name.equals("head")) {
tb.pop();
tb.transition(AfterHead);
} else if (StringUtil.in(name, "body", "html", "br")) {
return anythingElse(t, tb);
} else {
tb.error(this);
return false;
}
break;
default:
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, TreeBuilder tb) {
tb.process(new Token.EndTag("head"));
return tb.process(t);
}
},
InHeadNoscript {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isDoctype()) {
tb.error(this);
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return tb.process(t, InBody);
} else if (t.isEndTag() && t.asEndTag().name().equals("noscript")) {
tb.pop();
tb.transition(InHead);
} else if (isWhitespace(t) || t.isComment() || (t.isStartTag() && StringUtil.in(t.asStartTag().name(),
"basefont", "bgsound", "link", "meta", "noframes", "style"))) {
return tb.process(t, InHead);
} else if (t.isEndTag() && t.asEndTag().name().equals("br")) {
return anythingElse(t, tb);
} else if ((t.isStartTag() && StringUtil.in(t.asStartTag().name(), "head", "noscript")) || t.isEndTag()) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.error(this);
tb.process(new Token.EndTag("noscript"));
return tb.process(t);
}
},
AfterHead {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
} else if (t.isStartTag()) {
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("html")) {
return tb.process(t, InBody);
} else if (name.equals("body")) {
tb.insert(startTag);
tb.framesetOk(false);
tb.transition(InBody);
} else if (name.equals("frameset")) {
tb.insert(startTag);
tb.transition(InFrameset);
} else if (StringUtil.in(name, "base", "basefont", "bgsound", "link", "meta", "noframes", "script", "style", "title")) {
tb.error(this);
Element head = tb.getHeadElement();
tb.push(head);
tb.process(t, InHead);
tb.removeFromStack(head);
} else if (name.equals("head")) {
tb.error(this);
return false;
} else {
anythingElse(t, tb);
}
} else if (t.isEndTag()) {
if (StringUtil.in(t.asEndTag().name(), "body", "html")) {
anythingElse(t, tb);
} else {
tb.error(this);
return false;
}
} else {
anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.process(new Token.StartTag("body"));
tb.framesetOk(true);
return tb.process(t);
}
},
InBody {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case Character: {
Token.Character c = t.asCharacter();
if (c.getData().equals(nullString)) {
// todo confirm that check
tb.error(this);
return false;
} else if (isWhitespace(c)) {
tb.reconstructFormattingElements();
tb.insert(c);
} else {
tb.reconstructFormattingElements();
tb.insert(c);
tb.framesetOk(false);
}
break;
}
case Comment: {
tb.insert(t.asComment());
break;
}
case Doctype: {
tb.error(this);
return false;
}
case StartTag:
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("html")) {
tb.error(this);
// merge attributes onto real html
Element html = tb.getStack().getFirst();
for (Attribute attribute : startTag.getAttributes()) {
if (!html.hasAttr(attribute.getKey()))
html.attributes().put(attribute);
}
} else if (StringUtil.in(name, "base", "basefont", "bgsound", "command", "link", "meta", "noframes", "script", "style", "title")) {
return tb.process(t, InHead);
} else if (name.equals("body")) {
tb.error(this);
LinkedList<Element> stack = tb.getStack();
if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) {
// only in fragment case
return false; // ignore
} else {
tb.framesetOk(false);
Element body = stack.get(1);
for (Attribute attribute : startTag.getAttributes()) {
if (!body.hasAttr(attribute.getKey()))
body.attributes().put(attribute);
}
}
} else if (name.equals("frameset")) {
tb.error(this);
LinkedList<Element> stack = tb.getStack();
if (stack.size() == 1 || (stack.size() > 2 && !stack.get(1).nodeName().equals("body"))) {
// only in fragment case
return false; // ignore
} else if (!tb.framesetOk()) {
return false; // ignore frameset
} else {
Element second = stack.get(1);
if (second.parent() != null)
second.remove();
// pop up to html element
while (stack.size() > 1)
stack.removeLast();
tb.insert(startTag);
tb.transition(InFrameset);
}
} else if (StringUtil.in(name,
"address", "article", "aside", "blockquote", "center", "details", "dir", "div", "dl",
"fieldset", "figcaption", "figure", "footer", "header", "hgroup", "menu", "nav", "ol",
"p", "section", "summary", "ul")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
} else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
if (StringUtil.in(tb.currentElement().nodeName(), "h1", "h2", "h3", "h4", "h5", "h6")) {
tb.error(this);
tb.pop();
}
tb.insert(startTag);
} else if (StringUtil.in(name, "pre", "listing")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
// todo: ignore LF if next token
tb.framesetOk(false);
} else if (name.equals("form")) {
if (tb.getFormElement() != null) {
tb.error(this);
return false;
}
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
Element form = tb.insert(startTag);
tb.setFormElement(form);
} else if (name.equals("li")) {
tb.framesetOk(false);
LinkedList<Element> stack = tb.getStack();
for (int i = stack.size() - 1; i > 0; i--) {
Element el = stack.get(i);
if (el.nodeName().equals("li")) {
tb.process(new Token.EndTag("li"));
break;
}
if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p"))
break;
}
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
} else if (StringUtil.in(name, "dd", "dt")) {
tb.framesetOk(false);
LinkedList<Element> stack = tb.getStack();
for (int i = stack.size() - 1; i > 0; i--) {
Element el = stack.get(i);
if (StringUtil.in(el.nodeName(), "dd", "dt")) {
tb.process(new Token.EndTag(el.nodeName()));
break;
}
if (tb.isSpecial(el) && !StringUtil.in(el.nodeName(), "address", "div", "p"))
break;
}
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
} else if (name.equals("plaintext")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
tb.tokeniser.transition(TokeniserState.PLAINTEXT); // once in, never gets out
} else if (name.equals("button")) {
if (tb.inButtonScope("button")) {
// close and reprocess
tb.error(this);
tb.process(new Token.EndTag("button"));
tb.process(startTag);
} else {
tb.reconstructFormattingElements();
tb.insert(startTag);
tb.framesetOk(false);
}
} else if (name.equals("a")) {
if (tb.getActiveFormattingElement("a") != null) {
tb.error(this);
tb.process(new Token.EndTag("a"));
// still on stack?
Element remainingA = tb.getFromStack("a");
if (remainingA != null) {
tb.removeFromActiveFormattingElements(remainingA);
tb.removeFromStack(remainingA);
}
}
tb.reconstructFormattingElements();
Element a = tb.insert(startTag);
tb.pushActiveFormattingElements(a);
} else if (StringUtil.in(name,
"b", "big", "code", "em", "font", "i", "s", "small", "strike", "strong", "tt", "u")) {
tb.reconstructFormattingElements();
Element el = tb.insert(startTag);
tb.pushActiveFormattingElements(el);
} else if (name.equals("nobr")) {
tb.reconstructFormattingElements();
if (tb.inScope("nobr")) {
tb.error(this);
tb.process(new Token.EndTag("nobr"));
tb.reconstructFormattingElements();
}
Element el = tb.insert(startTag);
tb.pushActiveFormattingElements(el);
} else if (StringUtil.in(name, "applet", "marquee", "object")) {
tb.reconstructFormattingElements();
tb.insert(startTag);
tb.insertMarkerToFormattingElements();
tb.framesetOk(false);
} else if (name.equals("table")) {
if (tb.getDocument().quirksMode() != Document.QuirksMode.quirks && tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insert(startTag);
tb.framesetOk(false);
tb.transition(InTable);
} else if (StringUtil.in(name, "area", "br", "embed", "img", "keygen", "wbr")) {
tb.reconstructFormattingElements();
tb.insertEmpty(startTag);
tb.framesetOk(false);
} else if (name.equals("input")) {
tb.reconstructFormattingElements();
Element el = tb.insertEmpty(startTag);
if (!el.attr("type").equalsIgnoreCase("hidden"))
tb.framesetOk(false);
} else if (StringUtil.in(name, "param", "source", "track")) {
tb.insertEmpty(startTag);
} else if (name.equals("hr")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.insertEmpty(startTag);
tb.framesetOk(false);
} else if (name.equals("image")) {
// we're not supposed to ask.
startTag.name("img");
return tb.process(startTag);
} else if (name.equals("isindex")) {
// how much do we care about the early 90s?
tb.error(this);
if (tb.getFormElement() != null)
return false;
tb.tokeniser.acknowledgeSelfClosingFlag();
tb.process(new Token.StartTag("form"));
if (startTag.attributes.hasKey("action")) {
Element form = tb.getFormElement();
form.attr("action", startTag.attributes.get("action"));
}
tb.process(new Token.StartTag("hr"));
tb.process(new Token.StartTag("label"));
// hope you like english.
String prompt = startTag.attributes.hasKey("prompt") ?
startTag.attributes.get("prompt") :
"This is a searchable index. Enter search keywords: ";
tb.process(new Token.Character(prompt));
// input
Attributes inputAttribs = new Attributes();
for (Attribute attr : startTag.attributes) {
if (!StringUtil.in(attr.getKey(), "name", "action", "prompt"))
inputAttribs.put(attr);
}
inputAttribs.put("name", "isindex");
tb.process(new Token.StartTag("input", inputAttribs));
tb.process(new Token.EndTag("label"));
tb.process(new Token.StartTag("hr"));
tb.process(new Token.EndTag("form"));
} else if (name.equals("textarea")) {
tb.insert(startTag);
// todo: If the next token is a U+000A LINE FEED (LF) character token, then ignore that token and move on to the next one. (Newlines at the start of textarea elements are ignored as an authoring convenience.)
tb.tokeniser.transition(TokeniserState.Rcdata);
tb.markInsertionMode();
tb.framesetOk(false);
tb.transition(Text);
} else if (name.equals("xmp")) {
if (tb.inButtonScope("p")) {
tb.process(new Token.EndTag("p"));
}
tb.reconstructFormattingElements();
tb.framesetOk(false);
handleRawtext(startTag, tb);
} else if (name.equals("iframe")) {
tb.framesetOk(false);
handleRawtext(startTag, tb);
} else if (name.equals("noembed")) {
// also handle noscript if script enabled
handleRawtext(startTag, tb);
} else if (name.equals("select")) {
tb.reconstructFormattingElements();
tb.insert(startTag);
tb.framesetOk(false);
HtmlTreeBuilderState state = tb.state();
if (state.equals(InTable) || state.equals(InCaption) || state.equals(InTableBody) || state.equals(InRow) || state.equals(InCell))
tb.transition(InSelectInTable);
else
tb.transition(InSelect);
} else if (StringUtil.in("optgroup", "option")) {
if (tb.currentElement().nodeName().equals("option"))
tb.process(new Token.EndTag("option"));
tb.reconstructFormattingElements();
tb.insert(startTag);
} else if (StringUtil.in("rp", "rt")) {
if (tb.inScope("ruby")) {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals("ruby")) {
tb.error(this);
tb.popStackToBefore("ruby"); // i.e. close up to but not include name
}
tb.insert(startTag);
}
} else if (name.equals("math")) {
tb.reconstructFormattingElements();
// todo: handle A start tag whose tag name is "math" (i.e. foreign, mathml)
tb.insert(startTag);
tb.tokeniser.acknowledgeSelfClosingFlag();
} else if (name.equals("svg")) {
tb.reconstructFormattingElements();
// todo: handle A start tag whose tag name is "svg" (xlink, svg)
tb.insert(startTag);
tb.tokeniser.acknowledgeSelfClosingFlag();
} else if (StringUtil.in(name,
"caption", "col", "colgroup", "frame", "head", "tbody", "td", "tfoot", "th", "thead", "tr")) {
tb.error(this);
return false;
} else {
tb.reconstructFormattingElements();
tb.insert(startTag);
}
break;
case EndTag:
Token.EndTag endTag = t.asEndTag();
name = endTag.name();
if (name.equals("body")) {
if (!tb.inScope("body")) {
tb.error(this);
return false;
} else {
// todo: error if stack contains something not dd, dt, li, optgroup, option, p, rp, rt, tbody, td, tfoot, th, thead, tr, body, html
tb.transition(AfterBody);
}
} else if (anythingElse(t, tb);
name.equals("html")) {
boolean notIgnored = tb.process(new Token.EndTag("body"));
if (notIgnored)
return tb.process(endTag);
} else if (StringUtil.in(name,
"address", "article", "aside", "blockquote", "button", "center", "details", "dir", "div",
"dl", "fieldset", "figcaption", "figure", "footer", "header", "hgroup", "listing", "menu",
"nav", "ol", "pre", "section", "summary", "ul")) {
// todo: refactor these lookups
if (!tb.inScope(name)) {
// nothing to close
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (name.equals("form")) {
Element currentForm = tb.getFormElement();
tb.setFormElement(null);
if (currentForm == null || !tb.inScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
// remove currentForm from stack. will shift anything under up.
tb.removeFromStack(currentForm);
}
} else if (name.equals("p")) {
if (!tb.inButtonScope(name)) {
tb.error(this);
tb.process(new Token.StartTag(name)); // if no p to close, creates an empty <p></p>
return tb.process(endTag);
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (name.equals("li")) {
if (!tb.inListItemScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (StringUtil.in(name, "dd", "dt")) {
if (!tb.inScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
}
} else if (StringUtil.in(name, "h1", "h2", "h3", "h4", "h5", "h6")) {
if (!tb.inScope(new String[]{"h1", "h2", "h3", "h4", "h5", "h6"})) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags(name);
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose("h1", "h2", "h3", "h4", "h5", "h6");
}
} else if (name.equals("sarcasm")) {
// *sigh*
return anyOtherEndTag(t, tb);
} else if (StringUtil.in(name,
"a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", "strike", "strong", "tt", "u")) {
// Adoption Agency Algorithm.
OUTER:
for (int i = 0; i < 8; i++) {
Element formatEl = tb.getActiveFormattingElement(name);
if (formatEl == null)
return anyOtherEndTag(t, tb);
else if (!tb.onStack(formatEl)) {
tb.error(this);
tb.removeFromActiveFormattingElements(formatEl);
return true;
} else if (!tb.inScope(formatEl.nodeName())) {
tb.error(this);
return false;
} else if (tb.currentElement() != formatEl)
tb.error(this);
Element furthestBlock = null;
Element commonAncestor = null;
boolean seenFormattingElement = false;
LinkedList<Element> stack = tb.getStack();
for (int si = 0; si < stack.size(); si++) {
Element el = stack.get(si);
if (el == formatEl) {
commonAncestor = stack.get(si - 1);
seenFormattingElement = true;
} else if (seenFormattingElement && tb.isSpecial(el)) {
furthestBlock = el;
break;
}
}
if (furthestBlock == null) {
tb.popStackToClose(formatEl.nodeName());
tb.removeFromActiveFormattingElements(formatEl);
return true;
}
// todo: Let a bookmark note the position of the formatting element in the list of active formatting elements relative to the elements on either side of it in the list.
// does that mean: int pos of format el in list?
Element node = furthestBlock;
Element lastNode = furthestBlock;
INNER:
for (int j = 0; j < 3; j++) {
if (tb.onStack(node))
node = tb.aboveOnStack(node);
if (!tb.isInActiveFormattingElements(node)) { // note no bookmark check
tb.removeFromStack(node);
continue INNER;
} else if (node == formatEl)
break INNER;
Element replacement = new Element(Tag.valueOf(node.nodeName()), tb.getBaseUri());
tb.replaceActiveFormattingElement(node, replacement);
tb.replaceOnStack(node, replacement);
node = replacement;
if (lastNode == furthestBlock) {
// todo: move the aforementioned bookmark to be immediately after the new node in the list of active formatting elements.
// not getting how this bookmark both straddles the element above, but is inbetween here...
}
if (lastNode.parent() != null)
lastNode.remove();
node.appendChild(lastNode);
lastNode = node;
}
if (StringUtil.in(commonAncestor.nodeName(), "table", "tbody", "tfoot", "thead", "tr")) {
if (lastNode.parent() != null)
lastNode.remove();
tb.insertInFosterParent(lastNode);
} else {
if (lastNode.parent() != null)
lastNode.remove();
commonAncestor.appendChild(lastNode);
}
Element adopter = new Element(Tag.valueOf(name), tb.getBaseUri());
Node[] childNodes = furthestBlock.childNodes().toArray(new Node[furthestBlock.childNodes().size()]);
for (Node childNode : childNodes) {
adopter.appendChild(childNode); // append will reparent. thus the clone to avvoid concurrent mod.
}
furthestBlock.appendChild(adopter);
tb.removeFromActiveFormattingElements(formatEl);
// todo: insert the new element into the list of active formatting elements at the position of the aforementioned bookmark.
tb.removeFromStack(formatEl);
tb.insertOnStackAfter(furthestBlock, adopter);
}
} else if (StringUtil.in(name, "applet", "marquee", "object")) {
if (!tb.inScope("name")) {
if (!tb.inScope(name)) {
tb.error(this);
return false;
}
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
tb.clearFormattingElementsToLastMarker();
}
} else if (name.equals("br")) {
tb.error(this);
tb.process(new Token.StartTag("br"));
return false;
} else {
return anyOtherEndTag(t, tb);
}
break;
case EOF:
// todo: error if stack contains something not dd, dt, li, p, tbody, td, tfoot, th, thead, tr, body, html
// stop parsing
break;
}
return true;
}
boolean anyOtherEndTag(Token t, HtmlTreeBuilder tb) {
String name = t.asEndTag().name();
DescendableLinkedList<Element> stack = tb.getStack();
Iterator<Element> it = stack.descendingIterator();
while (it.hasNext()) {
Element node = it.next();
if (node.nodeName().equals(name)) {
tb.generateImpliedEndTags(name);
if (!name.equals(tb.currentElement().nodeName()))
tb.error(this);
tb.popStackToClose(name);
break;
} else {
if (tb.isSpecial(node)) {
tb.error(this);
return false;
}
}
}
return true;
}
},
Text {
// in script, style etc. normally treated as data tags
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isCharacter()) {
tb.insert(t.asCharacter());
} else if (t.isEOF()) {
tb.error(this);
// if current node is script: already started
tb.pop();
tb.transition(tb.originalState());
return tb.process(t);
} else if (t.isEndTag()) {
// if: An end tag whose tag name is "script" -- scripting nesting level, if evaluating scripts
tb.pop();
tb.transition(tb.originalState());
}
return true;
}
},
InTable {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isCharacter()) {
tb.newPendingTableCharacters();
tb.markInsertionMode();
tb.transition(InTableText);
return tb.process(t);
} else if (t.isComment()) {
tb.insert(t.asComment());
return true;
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag()) {
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("caption")) {
tb.clearStackToTableContext();
tb.insertMarkerToFormattingElements();
tb.insert(startTag);
tb.transition(InCaption);
} else if (name.equals("colgroup")) {
tb.clearStackToTableContext();
tb.insert(startTag);
tb.transition(InColumnGroup);
} else if (name.equals("col")) {
tb.process(new Token.StartTag("colgroup"));
return tb.process(t);
} else if (StringUtil.in(name, "tbody", "tfoot", "thead")) {
tb.clearStackToTableContext();
tb.insert(startTag);
tb.transition(InTableBody);
} else if (StringUtil.in(name, "td", "th", "tr")) {
tb.process(new Token.StartTag("tbody"));
return tb.process(t);
} else if (name.equals("table")) {
tb.error(this);
boolean processed = tb.process(new Token.EndTag("table"));
if (processed) // only ignored if in fragment
return tb.process(t);
} else if (StringUtil.in(name, "style", "script")) {
return tb.process(t, InHead);
} else if (name.equals("input")) {
if (!startTag.attributes.get("type").equalsIgnoreCase("hidden")) {
return anythingElse(t, tb);
} else {
tb.insertEmpty(startTag);
}
} else if (name.equals("form")) {
tb.error(this);
if (tb.getFormElement() != null)
return false;
else {
Element form = tb.insertEmpty(startTag);
tb.setFormElement(form);
}
} else {
return anythingElse(t, tb);
}
} else if (t.isEndTag()) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (name.equals("table")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
} else {
tb.popStackToClose("table");
}
tb.resetInsertionMode();
} else if (StringUtil.in(name,
"body", "caption", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
} else if (t.isEOF()) {
if (tb.currentElement().nodeName().equals("html"))
tb.error(this);
return true; // stops parsing
}
return anythingElse(t, tb);
}
boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.error(this);
boolean processed = true;
if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) {
tb.setFosterInserts(true);
processed = tb.process(t, InBody);
tb.setFosterInserts(false);
} else {
processed = tb.process(t, InBody);
}
return processed;
}
},
InTableText {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case Character:
Token.Character c = t.asCharacter();
if (c.getData().equals(nullString)) {
tb.error(this);
return false;
} else {
tb.getPendingTableCharacters().add(c);
}
break;
default:
if (tb.getPendingTableCharacters().size() > 0) {
for (Token.Character character : tb.getPendingTableCharacters()) {
if (!isWhitespace(character)) {
// InTable anything else section:
tb.error(this);
if (StringUtil.in(tb.currentElement().nodeName(), "table", "tbody", "tfoot", "thead", "tr")) {
tb.setFosterInserts(true);
tb.process(character, InBody);
tb.setFosterInserts(false);
} else {
tb.process(character, InBody);
}
} else
tb.insert(character);
}
tb.newPendingTableCharacters();
}
tb.transition(tb.originalState());
return tb.process(t);
}
return true;
}
},
InCaption {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isEndTag() && t.asEndTag().name().equals("caption")) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
} else {
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals("caption"))
tb.error(this);
tb.popStackToClose("caption");
tb.clearFormattingElementsToLastMarker();
tb.transition(InTable);
}
} else if ((
t.isStartTag() && StringUtil.in(t.asStartTag().name(),
"caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr") ||
t.isEndTag() && t.asEndTag().name().equals("table"))
) {
tb.error(this);
boolean processed = tb.process(new Token.EndTag("caption"));
if (processed)
return tb.process(t);
} else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(),
"body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", "thead", "tr")) {
tb.error(this);
return false;
} else {
return tb.process(t, InBody);
}
return true;
}
},
InColumnGroup {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
return true;
}
switch (t.type) {
case Comment:
tb.insert(t.asComment());
break;
case Doctype:
tb.error(this);
break;
case StartTag:
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("html"))
return tb.process(t, InBody);
else if (name.equals("col"))
tb.insertEmpty(startTag);
else
return anythingElse(t, tb);
break;
case EndTag:
Token.EndTag endTag = t.asEndTag();
name = endTag.name();
if (name.equals("colgroup")) {
if (tb.currentElement().nodeName().equals("html")) { // frag case
tb.error(this);
return false;
} else {
tb.pop();
tb.transition(InTable);
}
} else
return anythingElse(t, tb);
break;
case EOF:
if (tb.currentElement().nodeName().equals("html"))
return true; // stop parsing; frag case
else
return anythingElse(t, tb);
default:
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, TreeBuilder tb) {
boolean processed = tb.process(new Token.EndTag("colgroup"));
if (processed) // only ignored in frag case
return tb.process(t);
return true;
}
},
InTableBody {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case StartTag:
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (name.equals("tr")) {
tb.clearStackToTableBodyContext();
tb.insert(startTag);
tb.transition(InRow);
} else if (StringUtil.in(name, "th", "td")) {
tb.error(this);
tb.process(new Token.StartTag("tr"));
return tb.process(startTag);
} else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead")) {
return exitTableBody(t, tb);
} else
return anythingElse(t, tb);
break;
case EndTag:
Token.EndTag endTag = t.asEndTag();
name = endTag.name();
if (StringUtil.in(name, "tbody", "tfoot", "thead")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
} else {
tb.clearStackToTableBodyContext();
tb.pop();
tb.transition(InTable);
}
} else if (name.equals("table")) {
return exitTableBody(t, tb);
} else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th", "tr")) {
tb.error(this);
return false;
} else
return anythingElse(t, tb);
break;
default:
return anythingElse(t, tb);
}
return true;
}
private boolean exitTableBody(Token t, HtmlTreeBuilder tb) {
if (!(tb.inTableScope("tbody") || tb.inTableScope("thead") || tb.inScope("tfoot"))) {
// frag case
tb.error(this);
return false;
}
tb.clearStackToTableBodyContext();
tb.process(new Token.EndTag(tb.currentElement().nodeName())); // tbody, tfoot, thead
return tb.process(t);
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
return tb.process(t, InTable);
}
},
InRow {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isStartTag()) {
Token.StartTag startTag = t.asStartTag();
String name = startTag.name();
if (StringUtil.in(name, "th", "td")) {
tb.clearStackToTableRowContext();
tb.insert(startTag);
tb.transition(InCell);
tb.insertMarkerToFormattingElements();
} else if (StringUtil.in(name, "caption", "col", "colgroup", "tbody", "tfoot", "thead", "tr")) {
return handleMissingTr(t, tb);
} else {
return anythingElse(t, tb);
}
} else if (t.isEndTag()) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (name.equals("tr")) {
if (!tb.inTableScope(name)) {
tb.error(this); // frag
return false;
}
tb.clearStackToTableRowContext();
tb.pop(); // tr
tb.transition(InTableBody);
} else if (name.equals("table")) {
return handleMissingTr(t, tb);
} else if (StringUtil.in(name, "tbody", "tfoot", "thead")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
}
tb.process(new Token.EndTag("tr"));
return tb.process(t);
} else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html", "td", "th")) {
tb.error(this);
return false;
} else {
return anythingElse(t, tb);
}
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
return tb.process(t, InTable);
}
private boolean handleMissingTr(Token t, TreeBuilder tb) {
boolean processed = tb.process(new Token.EndTag("tr"));
if (processed)
return tb.process(t);
else
return false;
}
},
InCell {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isEndTag()) {
Token.EndTag endTag = t.asEndTag();
String name = endTag.name();
if (StringUtil.in(name, "td", "th")) {
if (!tb.inTableScope(name)) {
tb.error(this);
tb.transition(InRow); // might not be in scope if empty: <td /> and processing fake end tag
return false;
}
tb.generateImpliedEndTags();
if (!tb.currentElement().nodeName().equals(name))
tb.error(this);
tb.popStackToClose(name);
tb.clearFormattingElementsToLastMarker();
tb.transition(InRow);
} else if (StringUtil.in(name, "body", "caption", "col", "colgroup", "html")) {
tb.error(this);
return false;
} else if (StringUtil.in(name, "table", "tbody", "tfoot", "thead", "tr")) {
if (!tb.inTableScope(name)) {
tb.error(this);
return false;
}
closeCell(tb);
return tb.process(t);
} else {
return anythingElse(t, tb);
}
} else if (t.isStartTag() &&
StringUtil.in(t.asStartTag().name(),
"caption", "col", "colgroup", "tbody", "td", "tfoot", "th", "thead", "tr")) {
if (!(tb.inTableScope("td") || tb.inTableScope("th"))) {
tb.error(this);
return false;
}
closeCell(tb);
return tb.process(t);
} else {
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
return tb.process(t, InBody);
}
private void closeCell(HtmlTreeBuilder tb) {
if (tb.inTableScope("td"))
tb.process(new Token.EndTag("td"));
else
tb.process(new Token.EndTag("th")); // only here if th or td in scope
}
},
InSelect {
boolean process(Token t, HtmlTreeBuilder tb) {
switch (t.type) {
case Character:
Token.Character c = t.asCharacter();
if (c.getData().equals(nullString)) {
tb.error(this);
return false;
} else {
tb.insert(c);
}
break;
case Comment:
tb.insert(t.asComment());
break;
case Doctype:
tb.error(this);
return false;
case StartTag:
Token.StartTag start = t.asStartTag();
String name = start.name();
if (name.equals("html"))
return tb.process(start, InBody);
else if (name.equals("option")) {
tb.process(new Token.EndTag("option"));
tb.insert(start);
} else if (name.equals("optgroup")) {
if (tb.currentElement().nodeName().equals("option"))
tb.process(new Token.EndTag("option"));
else if (tb.currentElement().nodeName().equals("optgroup"))
tb.process(new Token.EndTag("optgroup"));
tb.insert(start);
} else if (name.equals("select")) {
tb.error(this);
return tb.process(new Token.EndTag("select"));
} else if (StringUtil.in(name, "input", "keygen", "textarea")) {
tb.error(this);
if (!tb.inSelectScope("select"))
return false; // frag
tb.process(new Token.EndTag("select"));
return tb.process(start);
} else if (name.equals("script")) {
return tb.process(t, InHead);
} else {
return anythingElse(t, tb);
}
break;
case EndTag:
Token.EndTag end = t.asEndTag();
name = end.name();
if (name.equals("optgroup")) {
if (tb.currentElement().nodeName().equals("option") && tb.aboveOnStack(tb.currentElement()) != null && tb.aboveOnStack(tb.currentElement()).nodeName().equals("optgroup"))
tb.process(new Token.EndTag("option"));
if (tb.currentElement().nodeName().equals("optgroup"))
tb.pop();
else
tb.error(this);
} else if (name.equals("option")) {
if (tb.currentElement().nodeName().equals("option"))
tb.pop();
else
tb.error(this);
} else if (name.equals("select")) {
if (!tb.inSelectScope(name)) {
tb.error(this);
return false;
} else {
tb.popStackToClose(name);
tb.resetInsertionMode();
}
} else
return anythingElse(t, tb);
break;
case EOF:
if (!tb.currentElement().nodeName().equals("html"))
tb.error(this);
break;
default:
return anythingElse(t, tb);
}
return true;
}
private boolean anythingElse(Token t, HtmlTreeBuilder tb) {
tb.error(this);
return false;
}
},
InSelectInTable {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isStartTag() && StringUtil.in(t.asStartTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) {
tb.error(this);
tb.process(new Token.EndTag("select"));
return tb.process(t);
} else if (t.isEndTag() && StringUtil.in(t.asEndTag().name(), "caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th")) {
tb.error(this);
if (tb.inTableScope(t.asEndTag().name())) {
tb.process(new Token.EndTag("select"));
return (tb.process(t));
} else
return false;
} else {
return tb.process(t, InSelect);
}
}
},
AfterBody {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
return tb.process(t, InBody);
} else if (t.isComment()) {
tb.insert(t.asComment()); // into html node
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return tb.process(t, InBody);
} else if (t.isEndTag() && t.asEndTag().name().equals("html")) {
if (tb.isFragmentParsing()) {
tb.error(this);
return false;
} else {
tb.transition(AfterAfterBody);
}
} else if (t.isEOF()) {
// chillax! we're done
} else {
tb.error(this);
tb.transition(InBody);
return tb.process(t);
}
return true;
}
},
InFrameset {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag()) {
Token.StartTag start = t.asStartTag();
String name = start.name();
if (name.equals("html")) {
return tb.process(start, InBody);
} else if (name.equals("frameset")) {
tb.insert(start);
} else if (name.equals("frame")) {
tb.insertEmpty(start);
} else if (name.equals("noframes")) {
return tb.process(start, InHead);
} else {
tb.error(this);
return false;
}
} else if (t.isEndTag() && t.asEndTag().name().equals("frameset")) {
if (tb.currentElement().nodeName().equals("html")) { // frag
tb.error(this);
return false;
} else {
tb.pop();
if (!tb.isFragmentParsing() && !tb.currentElement().nodeName().equals("frameset")) {
tb.transition(AfterFrameset);
}
}
} else if (t.isEOF()) {
if (!tb.currentElement().nodeName().equals("html")) {
tb.error(this);
return true;
}
} else {
tb.error(this);
return false;
}
return true;
}
},
AfterFrameset {
boolean process(Token t, HtmlTreeBuilder tb) {
if (isWhitespace(t)) {
tb.insert(t.asCharacter());
} else if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype()) {
tb.error(this);
return false;
} else if (t.isStartTag() && t.asStartTag().name().equals("html")) {
return tb.process(t, InBody);
} else if (t.isEndTag() && t.asEndTag().name().equals("html")) {
tb.transition(AfterAfterFrameset);
} else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) {
return tb.process(t, InHead);
} else if (t.isEOF()) {
// cool your heels, we're complete
} else {
tb.error(this);
return false;
}
return true;
}
},
AfterAfterBody {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) {
return tb.process(t, InBody);
} else if (t.isEOF()) {
// nice work chuck
} else {
tb.error(this);
tb.transition(InBody);
return tb.process(t);
}
return true;
}
},
AfterAfterFrameset {
boolean process(Token t, HtmlTreeBuilder tb) {
if (t.isComment()) {
tb.insert(t.asComment());
} else if (t.isDoctype() || isWhitespace(t) || (t.isStartTag() && t.asStartTag().name().equals("html"))) {
return tb.process(t, InBody);
} else if (t.isEOF()) {
// nice work chuck
} else if (t.isStartTag() && t.asStartTag().name().equals("noframes")) {
return tb.process(t, InHead);
} else {
tb.error(this);
return false;
}
return true;
}
},
ForeignContent {
boolean process(Token t, HtmlTreeBuilder tb) {
return true;
// todo: implement. Also; how do we get here?
}
};
private static String nullString = String.valueOf('\u0000');
abstract boolean process(Token t, HtmlTreeBuilder tb);
private static boolean isWhitespace(Token t) {
if (t.isCharacter()) {
String data = t.asCharacter().getData();
// todo: this checks more than spec - "\t", "\n", "\f", "\r", " "
for (int i = 0; i < data.length(); i++) {
char c = data.charAt(i);
if (!StringUtil.isWhitespace(c))
return false;
}
return true;
}
return false;
}
private static void handleRcData(Token.StartTag startTag, HtmlTreeBuilder tb) {
tb.insert(startTag);
tb.tokeniser.transition(TokeniserState.Rcdata);
tb.markInsertionMode();
tb.transition(Text);
}
private static void handleRawtext(Token.StartTag startTag, HtmlTreeBuilder tb) {
tb.insert(startTag);
tb.tokeniser.transition(TokeniserState.Rawtext);
tb.markInsertionMode();
tb.transition(Text);
}
}
| [
"justinwm@163.com"
] | justinwm@163.com |
85dc5408e3c3c614b5a9092bebd276101bbbcf07 | 10565b103276e12b2087c25748cd812ce254f782 | /module_my/src/main/java/debug/MyAssetsActivity.java | d6aea96afde40859340b87e4858c5135d0a90748 | [] | no_license | LHZ0316/MvpFrame | 64fef81160cc5495e8567e5e5ced9efe3760c59a | ffaecbcae5a3af18d4559620fc3932c8866ec42f | refs/heads/master | 2020-07-11T04:59:36.384831 | 2019-12-03T02:37:35 | 2019-12-03T02:37:35 | 204,451,031 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 566 | java | package debug;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.xiaodou.common.MainApplication;
import com.xiaodou.module_my.R;
public class MyAssetsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_assets);
MainApplication instance = MainApplication.getInstance();
Toast.makeText(instance,"wode",Toast.LENGTH_SHORT).show();
}
}
| [
"huyuegit@51xiaodou.com"
] | huyuegit@51xiaodou.com |
66347a23f976cafe43cb3db9682872621da3ef6b | b3d0ef59b896abf385c28d943ebdf45258124c4d | /src/main/java/org/example/app/config/AppSecurityConfig.java | 9c47198b34f53e25204537900f4cf68f15f2efe8 | [] | no_license | m1khey/mod1_lesson6 | c6ea379dc4db8dfb702131952d93f201b1bee0b4 | 2b2c7c5e69c2b777e21995033b4ddcf9020f78a1 | refs/heads/master | 2023-06-16T17:26:43.385218 | 2021-07-01T22:59:27 | 2021-07-01T22:59:27 | 338,116,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,590 | java | package org.example.app.config;
import org.apache.log4j.Logger;
import org.example.app.services.ProjectStoreUsersRepository;
import org.example.web.dto.LoginForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
@Configuration
@EnableWebSecurity
public class AppSecurityConfig extends WebSecurityConfigurerAdapter {
Logger logger = Logger.getLogger(AppSecurityConfig.class);
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
logger.info("populate inmemory auth user");
auth
.inMemoryAuthentication()
.withUser("root") //Подумай и реализуй как поставить сюда пользователя из списка
.password(passwordEncoder().encode("123"))
.roles("USER");
}
@Bean
public PasswordEncoder passwordEncoder(){
return new BCryptPasswordEncoder();
}
@Override
protected void configure(HttpSecurity http) throws Exception {
logger.info("config http security");
http.headers().frameOptions().disable(); //позволяет интерфейсу базы данны рендиться корректно
http.
csrf().disable()
.authorizeRequests()
.antMatchers("/login*").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.loginProcessingUrl("/login/auth")
.defaultSuccessUrl("/books/shelf", true)
.failureUrl("/login");
}
@Override
public void configure(WebSecurity web) throws Exception {
logger.info("config web serurity");
web
.ignoring()
.antMatchers("/images/**");
}
}
| [
"ermo1ov@yandex.ru"
] | ermo1ov@yandex.ru |
c82766302e07d0f9765af9ca4cf5e03c39a4355c | f4b8c3c126eb89b72c09d25355a1c19b4d5a37b7 | /src/kata4/view/HistogramDisplay.java | a8efa3f35272fad105ed3927eaa798b8f44bba36 | [] | no_license | carlosgomezfalcon/Kata4 | 901610ff0cfd4254afcf407bec3f3cbfe8659273 | e0eda117ebf3435e6fe5c622da07c238679b5231 | refs/heads/master | 2023-01-24T08:47:43.539457 | 2020-11-18T12:51:50 | 2020-11-18T12:51:50 | 311,991,554 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,531 | java | package kata4.view;
import java.awt.Dimension;
import javax.swing.JPanel;
import kata4.model.Histogram;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.ApplicationFrame;
public class HistogramDisplay extends ApplicationFrame {
private final Histogram<String> histogram;
public HistogramDisplay(Histogram<String> histogram) {
super("HISTOGRAMA");
this.histogram = histogram;
setContentPane(createPanel());
pack();
}
private JPanel createPanel() {
ChartPanel chartPanel = new ChartPanel(createChart(createDataset()));
setPreferredSize(new Dimension(500,400));
return chartPanel;
}
private JFreeChart createChart(DefaultCategoryDataset dataSet) {
JFreeChart chart = ChartFactory.createBarChart("Histograma JFreeChart", "Dominios email", "Nº de emails", dataSet, PlotOrientation.VERTICAL, false, false, rootPaneCheckingEnabled);
return chart;
}
private DefaultCategoryDataset createDataset() {
DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
for (String key : histogram.keySet()) {
dataSet.addValue(histogram.get(key), "", key);
}
return dataSet;
}
public void execute() {
setVisible(true);
}
}
| [
"Carlos@Carlos-Gómez-OMEN"
] | Carlos@Carlos-Gómez-OMEN |
3a5f6d10a8222c3d8744a61fe7ea081bdacb313b | 4070dda221602dbcb1ca907141a39a50379749df | /Listas_Sala/ObserverPattern/ObserverPattern/src/obs/Assinante1.java | 8651e9c5953f3ab08d030b78c3f2c610df640b8e | [] | no_license | xyzAndReM/ces28_2017_Andre.Figueira | 3dd93c738d94d7aa653c83612b5dc9e2e6de1c18 | f1d04bdeae8b566dee34567dc4b3fe61d329a86c | refs/heads/master | 2021-08-20T00:38:44.836724 | 2017-11-27T20:31:14 | 2017-11-27T20:31:14 | 100,322,997 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 751 | java | package obs;
import java.util.Observable;
import java.util.Observer;
class Assinante1 implements Observer {
Observable revistaInformatica;
int edicaoNovaRevista;
public Assinante1(Observable revistaInformatica) {
this.revistaInformatica = revistaInformatica;
revistaInformatica.addObserver(this);
}
@Override
public void update(Observable revistaInfSubject, Object arg1) {
if (revistaInfSubject instanceof RevistaInformatica) {
RevistaInformatica revistaInformatica = (RevistaInformatica) revistaInfSubject;
edicaoNovaRevista = revistaInformatica.getEdicao();
System.out.println("Atenção, já chegou a mais uma edição da Revista Informatica. " +
"Esta é a sua edição número: " + edicaoNovaRevista);
}
}
}
| [
"a.marcello92@gmail.com"
] | a.marcello92@gmail.com |
a08c9bf795de2b357f34a0d038a4db173f3ef43a | 126f6fc731391220ee440b59866d5d4fd15c3d8f | /app/src/main/java/com/example/alphonso/alphonso2017summer/adapter/ScalePagerAdapter.java | aee0a57bb29169c852a08bf1da860f2c70a58131 | [] | no_license | alphonsowisseh/SummerAlphonso2017 | dbcbe86831b8868f55bf78637d8d233c816e84c5 | 76e6d6b4a1bbaa5c4e89513976183968f8b39391 | refs/heads/master | 2021-01-01T06:35:34.417309 | 2017-07-17T09:48:51 | 2017-07-17T09:48:51 | 97,460,882 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 942 | java | package com.example.alphonso.alphonso2017summer.adapter;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
/**
* Created by Alphonso on 6/12/2017.
*/
public class ScalePagerAdapter extends PagerAdapter {
private final ArrayList<View> list;
public ScalePagerAdapter(ArrayList<View> list) {
this.list = list;
}
@Override
public int getCount() {
return list.size();
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
container.addView(list.get(position),0);
return list.get(position);
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView(list.get(position));
}
}
| [
"alphonso.wissehjr@gmail.com"
] | alphonso.wissehjr@gmail.com |
46571bfa7649675398eedf34c7f32f89ee99ba16 | 0ce176ca3a951885a7250b7b134457cf86373e5a | /src/main/java/StructuralPattern/BridgePattern/Circle.java | c3e816ca60d2d8b19fc0bdda705d6fc38379452e | [] | no_license | tianhong92/designPatternStudy | eb7cadf19d44a44251bbafd83132dd5e10d59ae2 | 2cd6b533ba23ea16a62ab724326d119c7d6e2dec | refs/heads/master | 2020-03-31T20:30:00.156453 | 2018-10-24T03:51:36 | 2018-10-24T03:51:36 | 152,543,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package StructuralPattern.BridgePattern;
public class Circle extends Shape {
private int x, y, radius;
public Circle(int x, int y, int radius, DrawAPI drawAPI) {
super(drawAPI);
this.x = x;
this.y = y;
this.radius = radius;
}
public void draw() {
drawAPI.drawCircle(radius,x,y);
}
} | [
"tianhong229@gmail.com"
] | tianhong229@gmail.com |
cbbdea7d4c530dc597774185b98051a9c3e32189 | ca6aa4f7007c71fbd7d62deb61d33dc6d9085fcf | /Game of Sorts/src/Logic/Main.java | 0258ea26bbb343eca5b77601a46029ad9000e442 | [] | no_license | AdrChacon/Game-of-Sorts-----Proyecto-2 | fe6d77bd7ca7772221bc2246eca439fbd33daf85 | 7644246334e3de525eb33a80dbbcb08e68304eb5 | refs/heads/master | 2020-03-30T21:49:22.971995 | 2018-10-29T05:47:18 | 2018-10-29T05:47:18 | 151,643,420 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 684 | java | // Parte de este código se tomó de http://zetcode.com/tutorials/javagamestutorial/
package Logic;
import java.awt.EventQueue;
import javax.swing.JFrame;
/**
*
* @author Chacón Campos
*/
public class Main extends JFrame{
public Main(){
initUI();
}
private void initUI(){
add(new Board());
setTitle("Game of Sorts");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(800,600);
setLocationRelativeTo(null);
setResizable(false);
}
public static void main(String[] args) {
EventQueue.invokeLater(() -> {
Main ex = new Main();
ex.setVisible(true);
});
}
}
| [
"36579925+AdrChacon@users.noreply.github.com"
] | 36579925+AdrChacon@users.noreply.github.com |
e40ad46ed11b812eec54a47b6a4c7fb050cc39f9 | cf58ffbd9a3f1f2689d4e223ccc29348585263c1 | /src/main/java/com/vo/tag/PersonalTagVO.java | e90e46e0f91bc404c676b36516124fcb06c642c2 | [] | no_license | cwzz/PictureTag_Phase_III | 461a21096c0625c958603a51ef77234a1926afb8 | f564e508ec5d836832b98111d508c5f803e2f8ce | refs/heads/master | 2020-03-21T04:44:19.979853 | 2018-06-22T08:03:52 | 2018-06-22T08:03:52 | 138,124,795 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | package com.vo.tag;
import com.enums.ProjectState;
import com.model.PersonalTag;
import lombok.Data;
import java.util.ArrayList;
import java.util.Date;
@Data
public class PersonalTagVO {
private long ptid;
private String pid;
private String uid;
private Date startTime;
private Date submitTime;
private ProjectState state;
private ArrayList<PictureVO> pictures;
private double quality;//贡献率
private double points;//最终得到的积分
private int rank;
public PersonalTagVO(){}
public PersonalTagVO(PersonalTag personalTag){
// this.pk=personalTagMultiKeysClass;
this.ptid=personalTag.getPtid();
this.pid=personalTag.getPid();
this.uid=personalTag.getUid();
this.startTime=personalTag.getStartTime();
this.submitTime=personalTag.getSubmitTime();
this.state=personalTag.getState();
this.quality=personalTag.getQuality();
this.points=personalTag.getPoints();
this.rank=personalTag.getRank();
}
}
| [
"1046277348@qq.com"
] | 1046277348@qq.com |
5ff7f4af920dc24f3f243fc5673b6d4f83674d3a | f68ed10011bc653f7f8565a19919f2634f454ab1 | /src/backgrounds/DesertRoad.java | f9d34dbd6cb47d301ebfcd0c0a6af0e9898ac846 | [] | no_license | HHSAPCompSci2020/capstone-project-traffic-invaders | 6f1847b758bf7e2645a7b6afc158dbeb358ba3f6 | 0c37d1c4d4c95b432c3927843f725bc9d91374e7 | refs/heads/main | 2023-04-20T14:40:29.336064 | 2021-05-25T18:19:36 | 2021-05-25T18:19:36 | 364,137,281 | 0 | 0 | null | 2021-05-04T04:18:54 | 2021-05-04T04:18:50 | null | UTF-8 | Java | false | false | 932 | java | package backgrounds;
import processing.core.PApplet;
/**
* Normal Road, except with two lane dividers
* @author Vikram
* @version 1.0
*/
public class DesertRoad extends Background
{
/**
* Passes the rgb color value to the superclass constructor
*/
public DesertRoad()
{
super(194, 178, 128);
}
/**
* Draws the double road
* @param s PApplet object
*/
public void draw(PApplet s)
{
super.draw(s);
}
/**
* Scrolls the screen down
* @param s PApplet object
*/
public void scroll(PApplet s)
{
super.scroll(s);
for(int i = 0; i <= 6; i++)
{
if(time >= s.height)
{
time -= 3 * s.height/20;
}
s.fill(255,255,255);
s.rect(2 * s.width/5 - s.width/40, -i * 3 * s.height/20 + time, s.width/40, s.height/20);
s.rect(3 * s.width/5 - s.width/40, -i * 3 * s.height/20 + time, s.width/40, s.height/20);
}
if(runs % 1800 == 0)
{
difficulty++;
}
}
}
| [
"70039401+vpenumarti@users.noreply.github.com"
] | 70039401+vpenumarti@users.noreply.github.com |
79919d35b9a543076b3f1dea798af57046899840 | 89ded77cda7c13a15e7268cedb1f1fde2b0d78a8 | /domain-layer/src/main/java/org/yndongyong/mvp/sample/domain/interactor/DefaultSubscriber.java | bf9177bb1543cb94735fdd7789a213c8582831af | [] | no_license | yndongyong/MVP_Rxjava | c610e88eed20ed53396e065486eba4f40150ca91 | fc83b41ae83ba13f8b223457313724c07c568042 | refs/heads/master | 2021-01-01T04:29:29.306877 | 2016-04-28T01:52:13 | 2016-04-28T01:52:13 | 57,261,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 351 | java | package org.yndongyong.mvp.sample.domain.interactor;
import rx.Subscriber;
/**
* Created by Dong on 2016/1/5.
*/
public class DefaultSubscriber<T> extends Subscriber<T> {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
}
@Override
public void onNext(T t) {
}
}
| [
"yndongyong@gmail.com"
] | yndongyong@gmail.com |
09c50124e7773f86f1f6b54c9121b23d6f4d543a | c0271592152d4a6a54a7a13767b690c2e9be5349 | /src/main/java/com/wealthy/machine/bovespa/dataaccess/BovespaDailyQuoteDataAccess.java | 2629a98ebfeccbdd07839a252b1ac64616db722e | [] | no_license | LuizGC/wealthymachine | e0af150375de95c46628f5f1e3d345328ddc7395 | 939d4b2f3fd537741d2edf50f72b3e74f5ae9073 | refs/heads/master | 2020-12-29T08:59:54.308595 | 2020-09-06T19:33:11 | 2020-09-06T19:33:11 | 238,544,049 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,571 | java | package com.wealthy.machine.bovespa.dataaccess;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.wealthy.machine.bovespa.quote.BovespaDailyQuote;
import com.wealthy.machine.bovespa.quote.BovespaDailyQuoteDeserializer;
import com.wealthy.machine.bovespa.sharecode.BovespaShareCode;
import com.wealthy.machine.core.util.data.JsonDataFileHandler;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Collectors;
public class BovespaDailyQuoteDataAccess {
private final JsonDataFileHandler jsonDataFileHandler;
private final Set<BovespaShareCode> shareCodeDownloaded;
public BovespaDailyQuoteDataAccess(JsonDataFileHandler jsonDataFileHandler) {
this.jsonDataFileHandler = jsonDataFileHandler;
this.shareCodeDownloaded = new TreeSet<>();
}
public synchronized void save(Set<BovespaDailyQuote> dailyQuoteSet) {
dailyQuoteSet
.stream()
.collect(Collectors.groupingBy(BovespaDailyQuote::getShareCode))
.forEach(this::saveBovespaDailyQuote);
}
private void saveBovespaDailyQuote(BovespaShareCode shareCode, List<BovespaDailyQuote> dailyQuotes) {
var module = new SimpleModule();
module.addDeserializer(BovespaDailyQuote.class, new BovespaDailyQuoteDeserializer(shareCode));
this.jsonDataFileHandler.append(shareCode.getCode(), dailyQuotes, BovespaDailyQuote.class, module);
this.shareCodeDownloaded.add(shareCode);
}
public Set<BovespaShareCode> listDownloadedShareCode() {
return Collections.unmodifiableSet(shareCodeDownloaded);
}
} | [
"luizaugusto3b@gmail.com"
] | luizaugusto3b@gmail.com |
0f5c94120a9102127042463afc443ca1be16529b | fa3d48d28e5087073729986047ec0946c7bf0ee0 | /Pract3. - Oslavskaya/src/ru/mirea/pract3/n1/Shape.java | 23b524bace61980d1adf357fe4f9ae24b3fd719a | [] | no_license | VishLi777/ikbo-01-19 | 83b77636f5cd5feb79f9345d1cd73db7b4ce3d75 | 0f81735f7e123d6e3641244d0e1fbc1368cfbbe9 | refs/heads/ikbo-01-19 | 2023-01-02T13:33:58.743571 | 2020-10-27T04:20:44 | 2020-10-27T04:20:44 | 291,930,487 | 0 | 0 | null | 2020-09-01T07:40:25 | 2020-09-01T07:40:24 | null | UTF-8 | Java | false | false | 94 | java | package ru.mirea.pract3.n1;
public abstract class Shape{
abstract void getType();
}
| [
"lidaoslavskaya@gmail.com"
] | lidaoslavskaya@gmail.com |
8043d26b0ee2cf4b25dd101ae3ee11428bd021b5 | 297d94988a89455f9a9f113bfa107f3314d21f51 | /trade-biz/src/main/java/com/hbc/api/trade/order/service/deliver/conf/ConflictFlag.java | 41234c7f831a399e018acb035d4f20b6be97e1f0 | [] | no_license | whyoyyx/trade | 408e86aba9a0d09aa5397eef194d346169ff15cc | 9d3f30fafca42036385280541e31eb38d2145e03 | refs/heads/master | 2020-12-28T19:11:46.342249 | 2016-01-15T03:29:44 | 2016-01-15T03:29:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 582 | java | /**
* @Author lukangle
* @2015年11月10日@下午2:04:17
*/
package com.hbc.api.trade.order.service.deliver.conf;
public enum ConflictFlag {
/** 1: 接机 */
OPEN(1, "开启"),
/** 3: 日租 */
CLOSED(2, "关闭"),
;
public int value;
public String name;
ConflictFlag(int value, String name) {
this.value = value;
this.name = name;
}
public static ConflictFlag getType(int value) {
ConflictFlag[] otypes = ConflictFlag.values();
for (ConflictFlag orderType : otypes) {
if (orderType.value == value) {
return orderType;
}
}
throw null;
}
}
| [
"fuyongtian@huangbaoche.com"
] | fuyongtian@huangbaoche.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.