blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
42d9a2b060bacafffe587c6cc85627208c24673b | 8a562f84ab27d847d89841851d3f904f2e684f35 | /app/src/main/java/com/example/androidui/viewholder/ViewHolder.java | 70764ded6b5eb8c1ac3c3e6ed5526a50d09aeca7 | [] | no_license | OMP1024/AndroidUI | 1f98c64a9f23dda0453dcd27bdea65d6592fde9c | 60b3406407cc456a3fa81f1326323c40e6d84dda | refs/heads/master | 2020-09-26T00:07:18.678383 | 2020-02-17T12:11:56 | 2020-02-17T12:11:56 | 226,118,638 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,748 | java | package com.example.androidui.viewholder;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.androidui.R;
import com.example.androidui.activity.AnimationActivity;
import com.example.androidui.activity.BroadcastActivity;
import com.example.androidui.activity.DrawLayoutActivity;
import com.example.androidui.activity.FileActivity;
import com.example.androidui.activity.FragmentActivity;
import com.example.androidui.activity.IncludeMergeViewStubActivity;
import com.example.androidui.activity.KitkatActivity;
import com.example.androidui.activity.LifeCycleActivity;
import com.example.androidui.activity.TextViewActivity;
import com.example.androidui.activity.ViewPagerActivity;
import com.example.androidui.activity.WebViewActivity;
import com.example.androidui.info.ItemInfo;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class ViewHolder extends RecyclerView.ViewHolder {
private Activity mActivity;
@BindView(R.id.title_tv)
TextView titleTv;
private ItemInfo mItemInfo;
public static ViewHolder createViewHolder(Activity activity, ViewGroup parent) {
return new ViewHolder(activity,
LayoutInflater.from(activity).inflate(R.layout.item_view_holder, parent, false));
}
private ViewHolder(Activity activity, @NonNull View itemView) {
super(itemView);
mActivity = activity;
ButterKnife.bind(this, itemView);
}
public void bindData(ItemInfo info) {
mItemInfo = info;
titleTv.setText(info.getTitle());
}
@OnClick(R.id.title_tv)
public void onViewClicked() {
switch (mItemInfo.getType()) {
case VIEW:
break;
case WEBVIEW:
break;
case ACTIVITY:
break;
case FRAGMENT:
FragmentActivity.launchFragmentActivity(mActivity);
break;
case VIEWPAGE:
mActivity.startActivity(new Intent(mActivity, ViewPagerActivity.class));
break;
case TABLAYOUT:
break;
case TEXT_VIEW:
TextViewActivity.launchActivity(mActivity);
break;
case VIDEOVIEW:
break;
case BOTTOMSHEET:
break;
case PROGRESS_BAR:
break;
case RECYCLERVIEW:
break;
case DIALOGFRAGMENT:
break;
case LifeCycle:
LifeCycleActivity.launchLifeCycleActivity(mActivity);
break;
case ViewAnimation:
mActivity.startActivity(new Intent(mActivity, AnimationActivity.class));
break;
case KitKat:
mActivity.startActivity(new Intent(mActivity, KitkatActivity.class));
break;
case WebView:
mActivity.startActivity(new Intent(mActivity, WebViewActivity.class));
break;
case Intent_FIlter:
Intent intent = new Intent();
intent.setAction("my_action");
intent.addCategory("my_category");
mActivity.startActivity(intent);
break;
case PackageName: {
PackageManager packageManager = mActivity.getPackageManager();
Intent intent1 = packageManager.getLaunchIntentForPackage("com.cari.promo.diskon");
if (intent1 != null && packageManager.resolveActivity(intent1, PackageManager.MATCH_DEFAULT_ONLY) != null) {
try {
mActivity.startActivity(intent1);
} catch (Exception e) {
e.printStackTrace();
}
}
}
break;
case Broadcast: {
mActivity.startActivity(new Intent(mActivity, BroadcastActivity.class));
}
break;
case FILE:
mActivity.startActivity(new Intent(mActivity, FileActivity.class));
break;
case DrawLayout:
mActivity.startActivity(new Intent(mActivity, DrawLayoutActivity.class));
break;
case INCLUDEMERGEVIEWSTUB:
mActivity.startActivity(new Intent(mActivity, IncludeMergeViewStubActivity.class));
break;
}
}
} | [
"[email protected]"
] | |
2555796136c5ad995574c4318f3ee1ff6998c64b | d8a24c4ee1406b4eef85c33ec852e133c51809c2 | /mifuns-facade-system/src/main/java/com/mifuns/system/facade/entity/Role.java | 05dca3bd2887c7a8d78299c2c5b1731df1b9864d | [] | no_license | cancheung/mifuns-project | 71626b8be76552bfca47c511872116e82f89c4eb | d27e64f8b00d6102b0c9dfa6873fd75bad893de8 | refs/heads/master | 2021-01-18T17:53:58.147052 | 2017-03-13T03:17:52 | 2017-03-13T03:17:52 | 86,821,972 | 1 | 0 | null | 2017-03-31T13:27:12 | 2017-03-31T13:27:12 | null | UTF-8 | Java | false | false | 3,994 | java | package com.mifuns.system.facade.entity;
import com.mifuns.common.page.PageBean;
import java.util.Date;
public class Role extends PageBean {
/**
*
* sys_role.role_id
*
* @mbggenerated
*/
private Long roleId;
/**
* 角色
* sys_role.role_name
*
* @mbggenerated
*/
private String roleName;
/**
* 角色描述
* sys_role.description
*
* @mbggenerated
*/
private String description;
/**
* 1 有效
* sys_role.status
*
* @mbggenerated
*/
private Integer status;
/**
* 插入时间
* sys_role.insert_date
*
* @mbggenerated
*/
private Date insertDate;
/**
* 更新时间
* sys_role.update_date
*
* @mbggenerated
*/
private Date updateDate;
public Role() {
}
public Role(Long roleId, Integer status, Date updateDate) {
this.roleId = roleId;
this.status = status;
this.updateDate = updateDate;
}
/**
*
* sys_role.role_id
*
* @return sys_role.role_id
*
* @mbggenerated
*/
public Long getRoleId() {
return roleId;
}
/**
*
* sys_role.role_id
*
* @param roleId sys_role.role_id
*
* @mbggenerated
*/
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
/**
* 角色
* sys_role.role_name
*
* @return sys_role.role_name
*
* @mbggenerated
*/
public String getRoleName() {
return roleName;
}
/**
* 角色
* sys_role.role_name
*
* @param roleName sys_role.role_name
*
* @mbggenerated
*/
public void setRoleName(String roleName) {
this.roleName = roleName == null ? null : roleName.trim();
}
/**
* 角色描述
* sys_role.description
*
* @return sys_role.description
*
* @mbggenerated
*/
public String getDescription() {
return description;
}
/**
* 角色描述
* sys_role.description
*
* @param description sys_role.description
*
* @mbggenerated
*/
public void setDescription(String description) {
this.description = description == null ? null : description.trim();
}
/**
* 1 有效
* sys_role.status
*
* @return sys_role.status
*
* @mbggenerated
*/
public Integer getStatus() {
return status;
}
/**
* 1 有效
* sys_role.status
*
* @param status sys_role.status
*
* @mbggenerated
*/
public void setStatus(Integer status) {
this.status = status;
}
/**
* 插入时间
* sys_role.insert_date
*
* @return sys_role.insert_date
*
* @mbggenerated
*/
public Date getInsertDate() {
return insertDate;
}
/**
* 插入时间
* sys_role.insert_date
*
* @param insertDate sys_role.insert_date
*
* @mbggenerated
*/
public void setInsertDate(Date insertDate) {
this.insertDate = insertDate;
}
/**
* 更新时间
* sys_role.update_date
*
* @return sys_role.update_date
*
* @mbggenerated
*/
public Date getUpdateDate() {
return updateDate;
}
/**
* 更新时间
* sys_role.update_date
*
* @param updateDate sys_role.update_date
*
* @mbggenerated
*/
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
@Override
public String toString() {
return "Role{" +
"roleId=" + roleId +
", roleName='" + roleName + '\'' +
", description='" + description + '\'' +
", status=" + status +
", insertDate=" + insertDate +
", updateDate=" + updateDate +
'}';
}
} | [
"[email protected]"
] | |
04c3ac77551ad3a54a85c88531ff0303ed4a17dd | e27942cce249f7d62b7dc8c9b86cd40391c1ddd4 | /modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201702/mcm/AccountLabelServiceInterfacemutate.java | 871d10b63295e44b7ea07805d0ddd508212eebe3 | [
"Apache-2.0"
] | permissive | mo4ss/googleads-java-lib | b4b6178747d25d16ae6aa0c80d80ee18a2dfe01a | efaa9c3bd8a46a3ed4b00963dc9760c6dd8bd641 | refs/heads/master | 2022-12-05T00:30:56.740813 | 2022-11-16T10:47:15 | 2022-11-16T10:47:15 | 108,132,394 | 0 | 0 | Apache-2.0 | 2022-11-16T10:47:16 | 2017-10-24T13:41:43 | Java | UTF-8 | Java | false | false | 3,453 | java | // Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.api.ads.adwords.jaxws.v201702.mcm;
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.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
*
* Possible actions:
* <ul>
* <li> Create a new label - create a new {@link Label} and call mutate with ADD operator
* <li> Edit the label name - set the appropriate fields in your {@linkplain Label} and call
* mutate with the SET operator. Null fields will be interpreted to mean "no change"
* <li> Delete the label - call mutate with REMOVE operator
* </ul>
*
* @param operations list of unique operations to be executed in a single transaction, in the
* order specified.
* @return the mutated labels, in the same order that they were in as the parameter
* @throws ApiException if problems occurs while modifying label information
*
*
* <p>Java class for mutate element declaration.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <element name="mutate">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="operations" type="{https://adwords.google.com/api/adwords/mcm/v201702}AccountLabelOperation" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"operations"
})
@XmlRootElement(name = "mutate")
public class AccountLabelServiceInterfacemutate {
protected List<AccountLabelOperation> operations;
/**
* Gets the value of the operations 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 operations property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOperations().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link AccountLabelOperation }
*
*
*/
public List<AccountLabelOperation> getOperations() {
if (operations == null) {
operations = new ArrayList<AccountLabelOperation>();
}
return this.operations;
}
}
| [
"[email protected]"
] | |
e54aa3fa7eb7a548ad6272156c82654d932d1ab7 | eb5f5353f49ee558e497e5caded1f60f32f536b5 | /org/omg/CORBA/UShortSeqHelper.java | 2a423d8b9904c6dc3b96d0cc2f9350e8216ad7e7 | [] | no_license | mohitrajvardhan17/java1.8.0_151 | 6fc53e15354d88b53bd248c260c954807d612118 | 6eeab0c0fd20be34db653f4778f8828068c50c92 | refs/heads/master | 2020-03-18T09:44:14.769133 | 2018-05-23T14:28:24 | 2018-05-23T14:28:24 | 134,578,186 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,783 | java | package org.omg.CORBA;
import org.omg.CORBA.portable.InputStream;
import org.omg.CORBA.portable.OutputStream;
public abstract class UShortSeqHelper
{
private static String _id = "IDL:omg.org/CORBA/UShortSeq:1.0";
private static TypeCode __typeCode = null;
public UShortSeqHelper() {}
public static void insert(Any paramAny, short[] paramArrayOfShort)
{
OutputStream localOutputStream = paramAny.create_output_stream();
paramAny.type(type());
write(localOutputStream, paramArrayOfShort);
paramAny.read_value(localOutputStream.create_input_stream(), type());
}
public static short[] extract(Any paramAny)
{
return read(paramAny.create_input_stream());
}
public static synchronized TypeCode type()
{
if (__typeCode == null)
{
__typeCode = ORB.init().get_primitive_tc(TCKind.tk_ushort);
__typeCode = ORB.init().create_sequence_tc(0, __typeCode);
__typeCode = ORB.init().create_alias_tc(id(), "UShortSeq", __typeCode);
}
return __typeCode;
}
public static String id()
{
return _id;
}
public static short[] read(InputStream paramInputStream)
{
short[] arrayOfShort = null;
int i = paramInputStream.read_long();
arrayOfShort = new short[i];
paramInputStream.read_ushort_array(arrayOfShort, 0, i);
return arrayOfShort;
}
public static void write(OutputStream paramOutputStream, short[] paramArrayOfShort)
{
paramOutputStream.write_long(paramArrayOfShort.length);
paramOutputStream.write_ushort_array(paramArrayOfShort, 0, paramArrayOfShort.length);
}
}
/* Location: C:\Program Files (x86)\Java\jre1.8.0_151\lib\rt.jar!\org\omg\CORBA\UShortSeqHelper.class
* Java compiler version: 8 (52.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
a7885bc87e9296d6c372c570762d0f6f35e2ba0c | 43e53df958e4eae4c1af68845afad4111947479b | /app/src/androidTest/java/com/example/sehernurese/gezginapp/ExampleInstrumentedTest.java | 08b774d9b64cfd9a5edb2deb8d056d17cc46133b | [] | no_license | ZuleyhaSehernurEse/GezginApp | 45260501d5fb04c75a03ab135996f5e1f17c292a | a348b8de764f8f2c319101e9a4c004d456956e54 | refs/heads/master | 2020-05-16T05:43:17.407899 | 2019-04-22T16:19:19 | 2019-04-22T16:19:19 | 182,824,202 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 750 | java | package com.example.sehernurese.gezginapp;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.sehernurese.gezginapp", appContext.getPackageName());
}
}
| [
"[email protected]"
] | |
4dc41787c1f780a6a24e9f9382db634a6e3de715 | 859f4ac4af996bfe2bb803d68fe72668d8c0d84e | /src/main/java/com/msp/givn/entity/PostType.java | 55373baa06bf5c2a37ad2af92d60644178cfb6b4 | [] | no_license | chaulong78/givn | 467187cdae19e97cf271f5d81d62d64cb271cb04 | 22666ab92173e4102f8bc60fe615d97d92109ae7 | refs/heads/master | 2020-04-26T09:47:24.647473 | 2019-03-13T07:15:25 | 2019-03-13T07:15:25 | 171,267,346 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 437 | java | package com.msp.givn.entity;
import lombok.Data;
import javax.persistence.*;
@Entity
@Table(name = "post_type")
@Data
public class PostType {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "name")
private String name;
@Column(name = "url_name")
private String urlName;
@Column(name = "description")
private String description;
}
| [
"[email protected]"
] | |
134afb042d284b1eeac22b9514c61fba46bc0957 | d28a6288bc313b8f0459fceba2ec6e5a9bbec752 | /zsgc-parent/zsgc-core/src/main/java/com/zsgc/core/model/Bank.java | 01362e8f4252c77d8dc63086eb8ab25006c986da | [] | no_license | WalkingSouls/zsgc | 2db9fa2a08339c56a61854b7e6474a36f0e7b080 | 203ce8dcb1bee1d3859cf9e670c74d858f46bbd6 | refs/heads/master | 2020-05-20T03:54:25.273039 | 2019-05-07T09:34:02 | 2019-05-07T09:34:02 | 185,370,071 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,792 | java | package com.zsgc.core.model;
import com.calanger.common.dao.AbstractPO;
public class Bank extends AbstractPO {
private static final long serialVersionUID = 1L;
private java.lang.Integer id;
private java.lang.String name;
private java.lang.String code;
private java.lang.String icon;
private java.lang.String pcIcon;
private java.lang.String backgroundImage;
private java.lang.String pcBackgroundImage;
private java.lang.Integer status;
private java.lang.String singleLimit;
private java.lang.String dailyAccumulativeLimit;
private java.lang.String monthlyAccumulativeLimit;
private java.lang.String conditionsOfUsage;
private java.lang.String llpayCode;
private java.lang.String bankNo;
private java.lang.String issInsCd;
public java.lang.Integer getId() {
return id;
}
public void setId(java.lang.Integer id) {
this.id = id;
}
public void setId(java.lang.Integer id, boolean forceUpdate) {
setId(id);
if (forceUpdate) {
addForceUpdateProperty("id");
}
}
public java.lang.String getName() {
return name;
}
public void setName(java.lang.String name) {
this.name = name;
}
public void setName(java.lang.String name, boolean forceUpdate) {
setName(name);
if (forceUpdate) {
addForceUpdateProperty("name");
}
}
public java.lang.String getCode() {
return code;
}
public void setCode(java.lang.String code) {
this.code = code;
}
public void setCode(java.lang.String code, boolean forceUpdate) {
setCode(code);
if (forceUpdate) {
addForceUpdateProperty("code");
}
}
public java.lang.String getIcon() {
return icon;
}
public void setIcon(java.lang.String icon) {
this.icon = icon;
}
public void setIcon(java.lang.String icon, boolean forceUpdate) {
setIcon(icon);
if (forceUpdate) {
addForceUpdateProperty("icon");
}
}
public java.lang.String getPcIcon() {
return pcIcon;
}
public void setPcIcon(java.lang.String pcIcon) {
this.pcIcon = pcIcon;
}
public void setPcIcon(java.lang.String pcIcon, boolean forceUpdate) {
setPcIcon(pcIcon);
if (forceUpdate) {
addForceUpdateProperty("pcIcon");
}
}
public java.lang.String getBackgroundImage() {
return backgroundImage;
}
public void setBackgroundImage(java.lang.String backgroundImage) {
this.backgroundImage = backgroundImage;
}
public void setBackgroundImage(java.lang.String backgroundImage, boolean forceUpdate) {
setBackgroundImage(backgroundImage);
if (forceUpdate) {
addForceUpdateProperty("backgroundImage");
}
}
public java.lang.String getPcBackgroundImage() {
return pcBackgroundImage;
}
public void setPcBackgroundImage(java.lang.String pcBackgroundImage) {
this.pcBackgroundImage = pcBackgroundImage;
}
public void setPcBackgroundImage(java.lang.String pcBackgroundImage, boolean forceUpdate) {
setPcBackgroundImage(pcBackgroundImage);
if (forceUpdate) {
addForceUpdateProperty("pcBackgroundImage");
}
}
public java.lang.Integer getStatus() {
return status;
}
public void setStatus(java.lang.Integer status) {
this.status = status;
}
public void setStatus(java.lang.Integer status, boolean forceUpdate) {
setStatus(status);
if (forceUpdate) {
addForceUpdateProperty("status");
}
}
public java.lang.String getSingleLimit() {
return singleLimit;
}
public void setSingleLimit(java.lang.String singleLimit) {
this.singleLimit = singleLimit;
}
public void setSingleLimit(java.lang.String singleLimit, boolean forceUpdate) {
setSingleLimit(singleLimit);
if (forceUpdate) {
addForceUpdateProperty("singleLimit");
}
}
public java.lang.String getDailyAccumulativeLimit() {
return dailyAccumulativeLimit;
}
public void setDailyAccumulativeLimit(java.lang.String dailyAccumulativeLimit) {
this.dailyAccumulativeLimit = dailyAccumulativeLimit;
}
public void setDailyAccumulativeLimit(java.lang.String dailyAccumulativeLimit, boolean forceUpdate) {
setDailyAccumulativeLimit(dailyAccumulativeLimit);
if (forceUpdate) {
addForceUpdateProperty("dailyAccumulativeLimit");
}
}
public java.lang.String getMonthlyAccumulativeLimit() {
return monthlyAccumulativeLimit;
}
public void setMonthlyAccumulativeLimit(java.lang.String monthlyAccumulativeLimit) {
this.monthlyAccumulativeLimit = monthlyAccumulativeLimit;
}
public void setMonthlyAccumulativeLimit(java.lang.String monthlyAccumulativeLimit, boolean forceUpdate) {
setMonthlyAccumulativeLimit(monthlyAccumulativeLimit);
if (forceUpdate) {
addForceUpdateProperty("monthlyAccumulativeLimit");
}
}
public java.lang.String getConditionsOfUsage() {
return conditionsOfUsage;
}
public void setConditionsOfUsage(java.lang.String conditionsOfUsage) {
this.conditionsOfUsage = conditionsOfUsage;
}
public void setConditionsOfUsage(java.lang.String conditionsOfUsage, boolean forceUpdate) {
setConditionsOfUsage(conditionsOfUsage);
if (forceUpdate) {
addForceUpdateProperty("conditionsOfUsage");
}
}
public java.lang.String getLlpayCode() {
return llpayCode;
}
public void setLlpayCode(java.lang.String llpayCode) {
this.llpayCode = llpayCode;
}
public void setLlpayCode(java.lang.String llpayCode, boolean forceUpdate) {
setLlpayCode(llpayCode);
if (forceUpdate) {
addForceUpdateProperty("llpayCode");
}
}
public java.lang.String getBankNo() {
return bankNo;
}
public void setBankNo(java.lang.String bankNo) {
this.bankNo = bankNo;
}
public void setBankNo(java.lang.String bankNo, boolean forceUpdate) {
setBankNo(bankNo);
if (forceUpdate) {
addForceUpdateProperty("bankNo");
}
}
public java.lang.String getIssInsCd() {
return issInsCd;
}
public void setIssInsCd(java.lang.String issInsCd) {
this.issInsCd = issInsCd;
}
public void setIssInsCd(java.lang.String issInsCd, boolean forceUpdate) {
setIssInsCd(issInsCd);
if (forceUpdate) {
addForceUpdateProperty("issInsCd");
}
}
}
| [
"[email protected]"
] | |
8a05cbb299d054947900824366c5a9f1a1549c34 | 95e944448000c08dd3d6915abb468767c9f29d3c | /sources/com/p280ss/android/ugc/aweme/challenge/p1084c/C23678f.java | ff9fa9abe89c19c5078978a353b5a998e03e7106 | [] | no_license | xrealm/tiktok-src | 261b1faaf7b39d64bb7cb4106dc1a35963bd6868 | 90f305b5f981d39cfb313d75ab231326c9fca597 | refs/heads/master | 2022-11-12T06:43:07.401661 | 2020-07-04T20:21:12 | 2020-07-04T20:21:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,713 | java | package com.p280ss.android.ugc.aweme.challenge.p1084c;
import android.os.Message;
import android.text.TextUtils;
import android.util.Log;
import com.google.common.collect.C17777bq;
import com.p280ss.android.ugc.aweme.base.C23397p;
import com.p280ss.android.ugc.aweme.challenge.api.ChallengeApi;
import com.p280ss.android.ugc.aweme.challenge.model.SearchChallenge;
import com.p280ss.android.ugc.aweme.challenge.model.SearchChallengeList;
import com.p280ss.android.ugc.aweme.common.C25640a;
import com.p280ss.android.ugc.aweme.discover.model.Challenge;
import com.p280ss.android.ugc.aweme.shortvideo.util.C41530am;
import java.util.ArrayList;
import java.util.concurrent.Callable;
/* renamed from: com.ss.android.ugc.aweme.challenge.c.f */
public final class C23678f extends C25640a<SearchChallengeList> {
public final boolean checkParams(Object... objArr) {
if (objArr == null || objArr.length != 2) {
return false;
}
return true;
}
/* access modifiers changed from: 0000 */
/* renamed from: a */
public final /* synthetic */ boolean mo61608a(SearchChallenge searchChallenge) {
String str;
if (searchChallenge.challenge == null) {
str = null;
} else {
str = searchChallenge.challenge.getChallengeName();
}
return TextUtils.equals(str, ((SearchChallengeList) this.mData).keyword);
}
public final boolean sendRequest(final Object... objArr) {
if (!super.sendRequest(objArr)) {
return false;
}
C23397p.m76735a().mo60807a(this.mHandler, new Callable() {
public final Object call() throws Exception {
C23678f.this.mIsLoading = false;
return ChallengeApi.m77600a((String) objArr[0], 20, (String) objArr[1]);
}
}, 0);
return true;
}
public final void handleMsg(Message message) {
if (message.obj instanceof Exception) {
Exception exc = (Exception) message.obj;
if (exc.getMessage() != null) {
StringBuilder sb = new StringBuilder("challenge search failed, message:");
sb.append(exc.getMessage());
C41530am.m132283b(sb.toString());
}
StringBuilder sb2 = new StringBuilder("challenge search failed, stack trace:");
sb2.append(Log.getStackTraceString(exc));
C41530am.m132283b(sb2.toString());
}
super.handleMsg(message);
}
/* access modifiers changed from: private */
/* renamed from: a */
public void handleData(SearchChallengeList searchChallengeList) {
if (searchChallengeList != null) {
this.mData = searchChallengeList;
if (((SearchChallengeList) this.mData).items == null) {
((SearchChallengeList) this.mData).items = new ArrayList();
}
if (!searchChallengeList.isMatch) {
boolean isEmpty = ((SearchChallengeList) this.mData).items.isEmpty();
if (!isEmpty) {
isEmpty = !C17777bq.m59104e(((SearchChallengeList) this.mData).items, new C23680g(this)).isPresent();
}
if (isEmpty) {
Challenge challenge = new Challenge();
challenge.setChallengeName(((SearchChallengeList) this.mData).keyword);
SearchChallenge searchChallenge = new SearchChallenge();
searchChallenge.challenge = challenge;
searchChallenge.isFake = true;
((SearchChallengeList) this.mData).items.add(0, searchChallenge);
}
}
}
}
}
| [
"[email protected]"
] | |
6502308533663c3e963055591309334672104f43 | ee565366a225df85ebdf322370a8dd7fcbf0e111 | /gmall-base/src/main/java/cn/chinatax/josewu/base/bean/Zsxx.java | 920a56996bd98fefc80c3c3d3e70180605a3c758 | [] | no_license | chinatax/gmall | fdcdc822b9c3977daaca7b3395e3e855900784a4 | d34bc4fd1a0c48d1ded8703e67b26291c80eb288 | refs/heads/master | 2022-06-22T20:41:31.613002 | 2019-08-24T03:50:07 | 2019-08-24T03:50:07 | 200,834,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,111 | java | package cn.chinatax.josewu.base.bean;
import java.io.Serializable;
import java.math.BigDecimal;
public class Zsxx implements Serializable {
private Long id;
private Short xh;
private String dq;
private BigDecimal jfrsSntq;
private BigDecimal jfjsSntq;
private BigDecimal jfjeSntq;
private BigDecimal jfrsBq;
private BigDecimal jfjsBq;
private BigDecimal jfjeBq;
private BigDecimal xj;
private BigDecimal jvjf;
private BigDecimal spgzkjjfe;
private BigDecimal xsjfzchs;
public Zsxx(Long id, Short xh, String dq, BigDecimal jfrsSntq, BigDecimal jfjsSntq, BigDecimal jfjeSntq, BigDecimal jfrsBq, BigDecimal jfjsBq, BigDecimal jfjeBq, BigDecimal xj, BigDecimal jvjf, BigDecimal spgzkjjfe, BigDecimal xsjfzchs) {
this.id = id;
this.xh = xh;
this.dq = dq;
this.jfrsSntq = jfrsSntq;
this.jfjsSntq = jfjsSntq;
this.jfjeSntq = jfjeSntq;
this.jfrsBq = jfrsBq;
this.jfjsBq = jfjsBq;
this.jfjeBq = jfjeBq;
this.xj = xj;
this.jvjf = jvjf;
this.spgzkjjfe = spgzkjjfe;
this.xsjfzchs = xsjfzchs;
}
public Zsxx() {
super();
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Short getXh() {
return xh;
}
public void setXh(Short xh) {
this.xh = xh;
}
public String getDq() {
return dq;
}
public void setDq(String dq) {
this.dq = dq == null ? null : dq.trim();
}
public BigDecimal getJfrsSntq() {
return jfrsSntq;
}
public void setJfrsSntq(BigDecimal jfrsSntq) {
this.jfrsSntq = jfrsSntq;
}
public BigDecimal getJfjsSntq() {
return jfjsSntq;
}
public void setJfjsSntq(BigDecimal jfjsSntq) {
this.jfjsSntq = jfjsSntq;
}
public BigDecimal getJfjeSntq() {
return jfjeSntq;
}
public void setJfjeSntq(BigDecimal jfjeSntq) {
this.jfjeSntq = jfjeSntq;
}
public BigDecimal getJfrsBq() {
return jfrsBq;
}
public void setJfrsBq(BigDecimal jfrsBq) {
this.jfrsBq = jfrsBq;
}
public BigDecimal getJfjsBq() {
return jfjsBq;
}
public void setJfjsBq(BigDecimal jfjsBq) {
this.jfjsBq = jfjsBq;
}
public BigDecimal getJfjeBq() {
return jfjeBq;
}
public void setJfjeBq(BigDecimal jfjeBq) {
this.jfjeBq = jfjeBq;
}
public BigDecimal getXj() {
return xj;
}
public void setXj(BigDecimal xj) {
this.xj = xj;
}
public BigDecimal getJvjf() {
return jvjf;
}
public void setJvjf(BigDecimal jvjf) {
this.jvjf = jvjf;
}
public BigDecimal getSpgzkjjfe() {
return spgzkjjfe;
}
public void setSpgzkjjfe(BigDecimal spgzkjjfe) {
this.spgzkjjfe = spgzkjjfe;
}
public BigDecimal getXsjfzchs() {
return xsjfzchs;
}
public void setXsjfzchs(BigDecimal xsjfzchs) {
this.xsjfzchs = xsjfzchs;
}
} | [
"[email protected]"
] | |
5a92423acf846f09dedbed3022d012f6c9c918d5 | fb12d15af0214af5532d58faba92480522569aac | /src/main/java/com/redhat/training/ad364/model/Student.java | 386383d2be2ba9fdc9b75e519773ab2b4283f8ae | [] | no_license | finmahon/rules364-5.4-opt | f23d26489e2a13462eb0feec7172cd047f1b4bf4 | 74461071f53b5dd1e27bbaefcdc8b4554d2301e6 | refs/heads/master | 2023-07-03T20:45:46.520982 | 2021-08-10T23:12:20 | 2021-08-10T23:12:20 | 394,797,982 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,525 | java | package com.redhat.training.ad364.model;
import java.util.List;
import java.util.Objects;
public class Student {
private String name;
private Boolean eligibleForFinanceAid;
private Boolean appliedForFinanceAid;
private List<Grade> grades;
public Student() {}
public Student(String name, List<Grade> grades) {
this.name = name;
this.grades = grades;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getEligibleForFinanceAid() {
return eligibleForFinanceAid;
}
public void setEligibleForFinanceAid(Boolean eligibleForFinanceAid) {
this.eligibleForFinanceAid = eligibleForFinanceAid;
}
public Boolean getAppliedForFinanceAid() {
return appliedForFinanceAid;
}
public void setAppliedForFinanceAid(Boolean appliedForFinanceAid) {
this.appliedForFinanceAid = appliedForFinanceAid;
}
public List<Grade> getGrades() {
return grades;
}
public void setGrades(List<Grade> grades) {
this.grades = grades;
}
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// Student student = (Student) o;
// return Objects.equals(name, student.name);
// }
// @Override
// public int hashCode() {
// return Objects.hash(name);
// }
}
| [
"[email protected]"
] | |
2db4df00a76c59e5060c4123f5429927bac962db | 26ea60ddcf4f3f682025ba5a1120c0cc269c8d6e | /app/src/main/java/my/zzm/minan/model/Call.java | df3e204a895abf39e538a9e0a0833a63d29b4e0d | [] | no_license | alexandaking/MinAn | dec8f146b044563b0f0cd61da4ad475a7f1bb8ac | 4ecdb6bd4de633d90cd9eeb5704a881810f97666 | refs/heads/master | 2021-09-03T01:31:59.744829 | 2018-01-04T15:51:35 | 2018-01-04T15:51:35 | 116,269,564 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package my.zzm.minan.model;
/**
* Created by AlexanDaking on 17/7/3.
*/
public class Call {
public String title;
public String desc;
public String imgurl;
public String href;
public String mask;
@Override
public String toString() {
return "Call [title=" + title + ", desc=" + desc +", imgurl=" + imgurl + ", href="
+ href + ", mask=" + mask + "]";
}
}
| [
"[email protected]"
] | |
479b887b3642e7bf2c94fae5819bf3482f8217c3 | 96263713168150f58c3fe5b508570cd05ce4a70d | /src/com/cook/www/demo2.java | a7ff72ebfc9c513c8ec948c85887ed0a59b1a50c | [] | no_license | juejueisgood/test | 40018f34764c085e3d3c8a3d854a9f7732227424 | cd7cb5f6f07f0eee1fb4fcfc32ba77eb1c6c31bc | refs/heads/master | 2021-01-21T23:20:16.735810 | 2017-06-24T04:25:54 | 2017-06-24T05:16:30 | 95,226,860 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,308 | java | package com.cook.www;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class demo2 extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
//得到响应输入流
PrintWriter out = response.getWriter();
//获取Cookie中用户最后一次访问时间
Cookie[] cookies = request.getCookies();//获取客户端所有Cookie保存在数组中
//判断当前cookies中的name是否是想要的cookies
for (int i = 0;cookies!=null && i < cookies.length; i++) {
//如果是想要的cookies
if ("lastAccessTime".equals(cookies[i].getName())) {
//则吧cookies中的value取出
Long l = Long.parseLong(cookies[i].getValue());
//yyyy-MM-dd
out.write("最后一次登陆时间为:"+ new Date(l).toLocaleString());
}
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
}
} | [
"[email protected]"
] | |
2a7b1e9266892bdc9ceaa4fb2279433667e3c11a | 986905768e2b11f431fdc895488a8e27b098d14d | /src/main/java/com/defysope/controller/DashboardController.java | 6bd74be5876cc1b867ab6149ecd45f18ee93bf72 | [] | no_license | bangalore-geek/myprj | 2e2b80329535f5df680fdeaabb6376effa2f3f6c | 5f99150e3f016cc2198af62e783fda34d994f1c1 | refs/heads/master | 2021-01-17T05:25:28.783390 | 2015-09-20T08:30:52 | 2015-09-20T08:30:52 | 33,488,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,552 | java | package com.defysope.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import net.sf.json.JSONObject;
import org.apache.commons.lang.BooleanUtils;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.defysope.model.User;
import com.defysope.model.dashboard.DashboardItem;
import com.defysope.model.dashboard.DashboardType;
import com.defysope.model.dashboard.DashboardView;
import com.defysope.providers.DashboardViewContext;
import com.defysope.providers.DashboardViewProvider;
import com.defysope.service.ApplicationUtils;
import com.defysope.service.DashboardManager;
import com.defysope.utils.NumberUtils;
public class DashboardController {
private static org.slf4j.Logger log = LoggerFactory
.getLogger(DashboardController.class);
@Autowired
private DashboardManager dashboardManager;
@Autowired
private ApplicationUtils utils;
@Autowired
private ApplicationContext applicationContext;
private Map<String, DashboardViewProvider> viewProviders;
private Map<String, DashboardViewProvider> viewProviderMap = new HashMap<String, DashboardViewProvider>();
@RequestMapping("/v2/dashboard/dashlet-views/load")
@Secured("ROLE_HOME_TAB")
@ResponseBody
public Object loadDashletViews(HttpServletRequest request,
HttpServletResponse response, @RequestParam String type) {
Map<String, Object> model = new HashMap<String, Object>();
try {
User user = utils.getLoggedInUser();
List<DashboardView> items = dashboardManager.getViewableItems(user,
type);
model.put("views", items);
model.put("success", true);
} catch (RuntimeException e) {
log.error(e.toString(), e);
} catch (Exception e) {
log.error(e.toString(), e);
}
return model;
}
@RequestMapping("/v2/dashboard/dashlet-view/view")
@Secured("ROLE_HOME_TAB")
public ModelAndView viewDashletView(HttpServletRequest request,
HttpServletResponse response, @RequestParam("view") int viewId) {
DashboardView view = dashboardManager.getObjectOrNull(
DashboardView.class, viewId);
/*
* if (view == null) { throw new
* Exception("Unable to find the requested resource."); }
*/
User user = utils.getLoggedInUser();
DashboardItem item = view.getItem();
/*
* if (item == null || !user.hasRightToFeature(item.getFeatureCode())) {
* throw new AccessDeniedException(
* "Access to the specified resource is denied."); }
*/
DashboardViewProvider provider = getViewProvider(item);
/*
* if (provider == null) { throw new ResourceNotFoundException(
* "Unable to find the requested resource."); }
*/
int height = NumberUtils.toInt(request.getParameter("height"));
if (height != 0 && height >= view.getItem().getHeight()) {
view.setHeight(height);
dashboardManager.saveObject(view);
}
DashboardViewContext context = new DashboardViewContext(user, view,
request);
return provider.getModelAndView(context);
}
private DashboardViewProvider getViewProvider(DashboardItem item) {
DashboardViewProvider provider = viewProviderMap.get(item.getName());
if (provider == null) {
synchronized (this) {
if (provider == null) {
Map<String, DashboardViewProvider> viewProviders = getViewProviders();
for (DashboardViewProvider pv : viewProviders.values()) {
if (pv.supports(item.getName())) {
provider = pv;
break;
}
}
viewProviderMap.put(item.getName(), provider);
}
}
}
return provider;
}
private Map<String, DashboardViewProvider> getViewProviders() {
if (viewProviders == null) {
synchronized (this) {
if (viewProviders == null) {
viewProviders = applicationContext
.getBeansOfType(DashboardViewProvider.class);
}
}
}
return viewProviders;
}
@RequestMapping("/v2/dashboard/dashlet-view/update")
@Secured("ROLE_HOME_TAB")
@ResponseBody
public Object saveDashletView(HttpServletRequest request,
HttpServletResponse response, @RequestParam("view") int viewId,
@RequestParam int row, @RequestParam int column,
@RequestParam int height) {
Map<String, Object> model = new HashMap<String, Object>();
try {
User user = utils.getLoggedInUser();
log.info("Updating dashlet {} to row {} column {} for user {}.",
new Object[] { viewId, row, column, user.getUserName() });
DashboardView view = dashboardManager.getView(user, viewId);
dashboardManager.updateView(user, viewId, row, column, height,
BooleanUtils.toBoolean(request.getParameter("newRow")),
NumberUtils.toInt(request.getParameter("deleteRow"), -1));
model.put("success", true);
} catch (RuntimeException e) {
log.error(e.toString(), e);
} catch (Exception e) {
log.error(e.toString(), e);
}
return model;
}
@RequestMapping(value = "/v2/dashboard/dashlet-view/add", method = RequestMethod.GET)
@Secured("ROLE_HOME_TAB")
public ModelAndView addDashlet(HttpServletRequest request,
HttpServletResponse response, @RequestParam String type) {
User user = utils.getLoggedInUser();
Map<String, Object> model = new HashMap<String, Object>();
List<DashboardItem> items = dashboardManager.getItems(user, type);
model.put("items", items);
return new ModelAndView("WEB-INF/freemarker/dashboard/add", model);
}
@RequestMapping(value = "/v2/dashboard/dashlet-view/add", method = RequestMethod.POST)
@Secured("ROLE_HOME_TAB")
@ResponseBody
public Object addDashletView(HttpServletRequest request,
HttpServletResponse response, @RequestParam String type,
@RequestParam String item, @RequestParam int row,
@RequestParam int column, @RequestParam boolean newRow) {
Map<String, Object> model = new HashMap<String, Object>();
try {
User user = utils.getLoggedInUser();
log.info("Creating view {} at row {} column {} for user {}.",
new Object[] { item, row, column, user.getUserName() });
DashboardView view = new DashboardView();
view.setUserId(user == null ? 0 : user.getId());
view.setItem(dashboardManager.getItem(user, type, item));
view.setType(dashboardManager.getObjectOrNull(DashboardType.class,
type));
view.setColumn(column);
view.setRow(row);
view.setHeight(NumberUtils.toInt(request.getParameter("height")));
dashboardManager.addView(user, view, newRow);
DashboardItem dashletItem = view.getItem();
model.put("success", true);
model.put("view", view);
} catch (RuntimeException e) {
log.error(e.toString(), e);
} catch (Exception e) {
log.error(e.toString(), e);
}
return model;
}
@RequestMapping("/v2/dashboard/dashlet-view/delete")
@Secured("ROLE_HOME_TAB")
@ResponseBody
public Object deleteDashletView(HttpServletRequest request,
HttpServletResponse response, @RequestParam("view") int viewId) {
Map<String, Object> model = new HashMap<String, Object>();
try {
User user = utils.getLoggedInUser();
log.info("Deleting dashlet {} for user {}.", new Object[] { viewId,
user.getUserName() });
DashboardView view = dashboardManager.getObjectOrNull(
DashboardView.class, viewId);
if (view != null) {
dashboardManager
.removeObject(DashboardView.class, view.getId());
int deleteRow = NumberUtils.toInt(
request.getParameter("deleteRow"), -1);
if (deleteRow != -1) {
dashboardManager.deleteRow(user, view.getType().getName(),
deleteRow, -1);
}
}
model.put("success", true);
} catch (RuntimeException e) {
log.error(e.toString(), e);
} catch (Exception e) {
log.error(e.toString(), e);
}
return model;
}
@RequestMapping(value = "/v2/dashboard/dashlet-view/options", method = RequestMethod.GET)
@Secured("ROLE_HOME_TAB")
public ModelAndView dashletOptions(HttpServletRequest request,
HttpServletResponse response, @RequestParam("view") int viewId) {
User user = utils.getLoggedInUser();
DashboardView view = dashboardManager.getView(user, viewId);
/*
* if (view == null || !view.getItem().isOptionsEnabled()) { throw new
* ResourceNotFoundException( "Unable to find the requested resource.");
* }
*/
DashboardViewProvider provider = getViewProvider(view.getItem());
/*
* if (provider == null) { throw new ResourceNotFoundException(
* "Unable to find the requested resource."); }
*
* saveStats(user, "dashlet-option-view", view.getItem().getName(),
* "Viewed dashlet options for " + view.getItem().getCaption() + ".");
*/
DashboardViewContext context = new DashboardViewContext(user, view,
request);
return provider.getOptionModelAndView(context);
}
@RequestMapping(value = "/v2/dashboard/dashlet-view/options", method = RequestMethod.POST)
@Secured("ROLE_HOME_TAB")
@ResponseBody
public Object dashletOptionsSave(HttpServletRequest request,
HttpServletResponse response, @RequestParam("view") int viewId) {
Map<String, Object> model = new HashMap<String, Object>();
try {
User user = utils.getLoggedInUser();
DashboardView view = dashboardManager.getView(user, viewId);
/*
* if (view == null || !view.getItem().isOptionsEnabled()) { throw
* new ResourceNotFoundException(
* "Unable to find the requested resource."); }
*/
Map<String, String> params = new HashMap<String, String>();
@SuppressWarnings("unchecked")
Map<String, String[]> parameterMap = request.getParameterMap();
for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
String[] value = entry.getValue();
params.put(entry.getKey(),
value != null && value.length > 0 ? value[0] : null);
}
view.setOptions(JSONObject.fromObject(params).toString());
dashboardManager.saveObject(view);
/*
* saveStats(user, "dashlet-option", view.getItem().getName(),
* "Saved dashlet options for " + view.getItem().getCaption() +
* ".");
*/
model.put("success", true);
} catch (RuntimeException e) {
log.error(e.toString(), e);
} catch (Exception e) {
log.error(e.toString(), e);
}
return model;
}
}
| [
"[email protected]"
] | |
9304bc36c140c0dd7e21488e746d1f0723110990 | 0b627ad6d2575c6d54ff4cda086dd8e01aa700fc | /encryption-decription/src/main/java/com/verinite/filegenerator/controller/GenerateTokenController.java | 774c990dca540aeb40b78ea90bdfaf59d5fbf7be | [] | no_license | Indrajeetsingh-Verinite/HistoryEncryptionTokenModule | 8b6345bdde07896e7c86cfcc383387db73d34bfb | e3be412e155145abd3bbd769bd8cb99ebd055843 | refs/heads/master | 2023-04-05T08:28:18.371522 | 2021-04-09T06:18:36 | 2021-04-09T06:18:36 | 356,155,665 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,209 | java | package com.verinite.filegenerator.controller;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import com.nimbusds.jose.JOSEException;
import com.verinite.filegenerator.authentication.ConvertKeys;
import com.verinite.filegenerator.authentication.GenerateToken;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
@RestController
public class GenerateTokenController {
@Value("${authtoken.privatekey}")
private String privateKey ;
ConvertKeys convertKeys = new ConvertKeys();
@Autowired
private WebClient.Builder webClientBuilder;
@PostMapping("/generate")
public String generate(@RequestBody String signedData) throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException{
GenerateToken tokenObject = new GenerateToken();
return tokenObject.getToken(signedData, 30000,convertKeys.stringToPrivateKey(privateKey));
}
@PostMapping("/saveHistory")
public Object saveHistory(@RequestBody String signedData) throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException{
GenerateToken tokenObject = new GenerateToken();
String token = tokenObject.getToken(signedData, 30000,convertKeys.stringToPrivateKey(privateKey));
return webClientBuilder.build()
.post()
.uri("http://localhost:8086/history")
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.body(Mono.just(token), String.class)
.retrieve()
.bodyToMono(Object.class)
.block();
}
@PatchMapping("/updateHistory/{historyId}")
public Object updateHistory(@RequestBody String signedData,@RequestParam Integer historyId) throws NoSuchAlgorithmException, InvalidKeySpecException, JOSEException{
GenerateToken tokenObject = new GenerateToken();
String token = tokenObject.getToken(signedData, 30000,convertKeys.stringToPrivateKey(privateKey));
return webClientBuilder.build()
.patch()
.uri("http://localhost:8086/history/"+historyId)
.header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE)
.body(Mono.just(token), String.class)
.retrieve()
.bodyToMono(Object.class)
.block();
}
} | [
"[email protected]"
] | |
4e93313644d4c687fc1f4b9b55d3ff79b0813d0f | 8e77ed1d11d3ee6486976bdc6b7c5c1043c4d6df | /src/cn/com/oims/service/IEyelxdzxService.java | d92e5498c5955fc196783f3e960f3b7dc5234a20 | [] | no_license | 498473645/OIMS | e553f266629b7baf0e0dc31bd50edcd534c83c21 | 4477b5882e6478c3cac44c83a2d2539eb98e887a | refs/heads/main | 2023-08-07T04:41:21.592563 | 2021-09-23T03:10:21 | 2021-09-23T03:10:21 | 409,429,603 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 409 | java | package cn.com.oims.service;
import cn.com.oims.dao.pojo.Eyelxdzx;
import java.io.Serializable;
import org.springframework.stereotype.Service;
@Service
public interface IEyelxdzxService {
void updateEyelxdzx(Eyelxdzx paramEyelxdzx);
Serializable saveEyelxdzx(Eyelxdzx paramEyelxdzx);
Eyelxdzx selectEyelxdzxByEyelxdzx(Eyelxdzx paramEyelxdzx);
void deleteEyelxdzx(Eyelxdzx paramEyelxdzx);
}
| [
"[email protected]"
] | |
795bbea092cf9b34e0eeffd9b8fb32622721746b | 48fd0b689f9cdb660ad06a191107e14d47542fd8 | /Ada55/src/MinimumLogicStep.java | d1b1ccfa2bd459e215633a8565d881cbc0199ba5 | [
"MIT"
] | permissive | chiendarrendor/AlbertsAdalogicalAenigmas | 3dfc6616d47c361ad6911e2ee4e3a3ec24bb6b75 | c6f91d4718999089686f3034a75a11b312fa1458 | refs/heads/master | 2022-08-28T11:34:02.261386 | 2022-07-08T22:45:24 | 2022-07-08T22:45:24 | 115,220,665 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,134 | java | import grid.graph.GridGraph;
import grid.logic.LogicStatus;
import grid.puzzlebits.Direction;
import java.awt.*;
import java.util.Set;
// this class explores the behavior of the regions of the grid that we
// know are connected by paths.
public class MinimumLogicStep extends CommonLogicStep {
public MinimumLogicStep() { super(true); }
@Override
public LogicStatus applyToGroup(Board thing, Set<Point> cells, Set<Point> numbers,GridGraph gg) {
LogicStatus result = LogicStatus.STYMIED;
if (numbers.size() > 2) return LogicStatus.CONTRADICTION;
// all cells of a group must be connected to each other.
for (Point p : cells) {
for (Direction d: Utility.OPDIRS) {
Point np = d.delta(p,1);
if (!cells.contains(np)) continue;
EdgeState es = thing.getEdge(p.x,p.y,d);
if (es == EdgeState.WALL) return LogicStatus.CONTRADICTION;
if (es == EdgeState.UNKNOWN) {
result = LogicStatus.LOGICED;
thing.setEdge(p.x,p.y,d,EdgeState.PATH);
}
}
}
int maxsize;
if (numbers.size() < 2) maxsize = thing.getMax() - 1;
else {
int pairmax = numbers.stream().mapToInt(it->thing.getNumber(it.x,it.y)).max().getAsInt();
int pairmin = numbers.stream().mapToInt(it->thing.getNumber(it.x,it.y)).min().getAsInt();
if ((pairmax - pairmin) < 2) return LogicStatus.CONTRADICTION;
maxsize = pairmax - 1;
}
if (cells.size() > maxsize) return LogicStatus.CONTRADICTION;
/* BlastOut is breathtakingly expensive!
if (numbers.size() > 0) {
BlastOut bo = new BlastOut(thing,gg,cells,numbers);
if (numbers.size() == 1) {
LogicStatus bostat = bo.singleNumberExtend(thing);
if (bostat == LogicStatus.CONTRADICTION) return LogicStatus.CONTRADICTION;
if (bostat == LogicStatus.LOGICED) result = LogicStatus.LOGICED;
}
}
*/
return result;
}
}
| [
"[email protected]"
] | |
942069aef56bd7fcdf586b8f5fd58601f8f39843 | 1ecae42ff90c437ce67b217b66856fee393e013f | /.JETEmitters/src/org/talend/designer/codegen/translators/business/marketo/TMarketoListOperationBeginJava.java | 9ae02b2e3eaca6ac82b573a01bce53f27e4cbf8b | [] | no_license | dariofabbri/etl | e66233c970ab95a191816afe8c2ef64a8819562a | cb700ac6375ad57e5b78b8ab82958e4a3f9a09a7 | refs/heads/master | 2021-01-19T07:41:08.260696 | 2013-02-09T11:57:12 | 2013-02-09T11:57:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,651 | java | package org.talend.designer.codegen.translators.business.marketo;
import org.talend.core.model.process.INode;
import org.talend.core.model.process.ElementParameterParser;
import org.talend.core.model.metadata.IMetadataTable;
import org.talend.core.model.process.IConnection;
import org.talend.core.model.process.IConnectionCategory;
import org.talend.designer.codegen.config.CodeGeneratorArgument;
import java.util.List;
public class TMarketoListOperationBeginJava
{
protected static String nl;
public static synchronized TMarketoListOperationBeginJava create(String lineSeparator)
{
nl = lineSeparator;
TMarketoListOperationBeginJava result = new TMarketoListOperationBeginJava();
nl = null;
return result;
}
public final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "int nb_call_";
protected final String TEXT_2 = " = 0;" + NL + "globalMap.put(\"";
protected final String TEXT_3 = "_NB_CALL\",0); ";
protected final String TEXT_4 = NL + "\t\t\t\t\tboolean firstList_";
protected final String TEXT_5 = " = true;" + NL + "\t\t\t\t\tString listTypeFlag_";
protected final String TEXT_6 = "=\"\";" + NL + "\t\t\t\t\tString listValueFlag_";
protected final String TEXT_7 = "=\"\";";
protected final String TEXT_8 = NL + "\t\t\t\torg.talend.marketo.Client client_";
protected final String TEXT_9 = " = new org.talend.marketo.Client(";
protected final String TEXT_10 = ",";
protected final String TEXT_11 = ",";
protected final String TEXT_12 = ");" + NL + "\t\t\t\tclient_";
protected final String TEXT_13 = ".setTimeout(";
protected final String TEXT_14 = ");" + NL + "\t\t\t\tjava.util.List<com.marketo.www.mktows.LeadKey> leadKeyList_";
protected final String TEXT_15 = " = new java.util.ArrayList<com.marketo.www.mktows.LeadKey>();" + NL + "\t\t\t\tcom.marketo.www.mktows.ResultListOperation resultListOperation_";
protected final String TEXT_16 = " = null;" + NL + "\t\t\t\t" + NL + "\t\t\t\tboolean whetherReject_";
protected final String TEXT_17 = " = false;";
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String endpoint = ElementParameterParser.getValue(node, "__ENDPOINT__");
String secretKey = ElementParameterParser.getValue(node, "__SECRET_KEY__");
String clientAccessID = ElementParameterParser.getValue(node, "__CLIENT_ACCESSID__");
String operation = ElementParameterParser.getValue(node, "__OPERATION__");
boolean mutipleOperation = ("true").equals(ElementParameterParser.getValue(node,"__MUTIPLE_OPERATION__"));
boolean isMutiple = false;
if(mutipleOperation&&!operation.equals("ISMEMBEROFLIST")){
isMutiple = true;
}
String timeout = ElementParameterParser.getValue(node, "__TIMEOUT__");
List<IMetadataTable> metadatas = node.getMetadataList();
stringBuffer.append(TEXT_1);
stringBuffer.append(cid);
stringBuffer.append(TEXT_2);
stringBuffer.append(cid );
stringBuffer.append(TEXT_3);
if ((metadatas!=null)&&(metadatas.size()>0)) {//1
IMetadataTable metadata = metadatas.get(0);
if (metadata!=null) {//2
List< ? extends IConnection> conns = node.getIncomingConnections();
for (IConnection conn : conns) {//3
if (conn.getLineStyle().hasConnectionCategory(IConnectionCategory.DATA)) {//4
if(isMutiple){
stringBuffer.append(TEXT_4);
stringBuffer.append(cid);
stringBuffer.append(TEXT_5);
stringBuffer.append(cid);
stringBuffer.append(TEXT_6);
stringBuffer.append(cid);
stringBuffer.append(TEXT_7);
}
stringBuffer.append(TEXT_8);
stringBuffer.append(cid);
stringBuffer.append(TEXT_9);
stringBuffer.append(endpoint);
stringBuffer.append(TEXT_10);
stringBuffer.append(secretKey);
stringBuffer.append(TEXT_11);
stringBuffer.append(clientAccessID);
stringBuffer.append(TEXT_12);
stringBuffer.append(cid);
stringBuffer.append(TEXT_13);
stringBuffer.append(timeout);
stringBuffer.append(TEXT_14);
stringBuffer.append(cid);
stringBuffer.append(TEXT_15);
stringBuffer.append(cid);
stringBuffer.append(TEXT_16);
stringBuffer.append(cid);
stringBuffer.append(TEXT_17);
}
}
}
}
return stringBuffer.toString();
}
}
| [
"[email protected]"
] | |
97b7eff3d24d508b12d9bafbe6ddd154bb0f0514 | 4d4fb4b025e6a096db15a5bac50f76eb8a1e7fd9 | /app/src/main/java/com/zhaopf/createvcf/MainActivity.java | 10d39f9d736ea3e2c8647c1620824a4e32be2541 | [] | no_license | zhao-pf/VcfCreate | 348a92f0d57e890b28fd47f37f9a0cf243a1a2be | 1a9649abdaa2ef435b2084e93c8db153cdc7b0bf | refs/heads/master | 2020-09-13T13:57:09.132226 | 2020-02-27T06:27:21 | 2020-02-27T06:27:21 | 222,808,053 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,199 | java | package com.zhaopf.createvcf;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.text.Editable;
import android.text.InputFilter;
import android.text.TextWatcher;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import a_vcard.android.provider.Contacts;
import a_vcard.android.syncml.pim.vcard.ContactStruct;
import a_vcard.android.syncml.pim.vcard.VCardComposer;
import a_vcard.android.syncml.pim.vcard.VCardException;
/**
* 根据规则批量创建Vcf联系人文件
*
* @author zhao-pf 2019/11/19
* Github:https://github.com/zhao-pf/VcfCreate
*/
public class MainActivity extends AppCompatActivity {
public static final String VCARD_FILE_PATH = Environment.getExternalStorageDirectory() + "/Download";
//读写权限
private static String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE};
//请求状态码
private static int REQUEST_PERMISSION_CODE = 1;
EditText startNumber1;
EditText startNumber2;
EditText startNumber3;
EditText number;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = findViewById(R.id.createVcard);
number = findViewById(R.id.et_number);//生成数量
startNumber1 = findViewById(R.id.et_startNumber1);//字段 1
startNumber2 = findViewById(R.id.et_startNumber2);//字段 2
startNumber3 = findViewById(R.id.et_startNumber3);//字段 3
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
number = findViewById(R.id.et_number);//生成数量
startNumber1 = findViewById(R.id.et_startNumber1);//字段 1
startNumber2 = findViewById(R.id.et_startNumber2);//字段 2
startNumber3 = findViewById(R.id.et_startNumber3);//字段 3
if (startNumber1.getText().toString().trim().equals("")) {
Toast.makeText(MainActivity.this, "号码为空", Toast.LENGTH_SHORT).show();
} else {
if (number.getText().toString().trim().equals("")) {
Toast.makeText(MainActivity.this, "数量为空", Toast.LENGTH_SHORT).show();
} else {
long start_number1 = Long.parseLong(String.valueOf(startNumber1.getText()));
long start_number2 = Long.parseLong(String.valueOf(startNumber2.getText()));
long start_number3 = Long.parseLong(String.valueOf(startNumber3.getText()));
long create_number = Integer.parseInt(String.valueOf(number.getText()));
int x = (int) Math.pow(10, number.length()) - 1;
long maxnumber = (int) Math.pow(10, startNumber2.length()) - 1;
Log.e("x", String.valueOf(x));
Log.e("start_number", String.valueOf(start_number2));
long max = maxnumber - start_number2;
if (create_number > max) {
Log.e("max", String.valueOf(max));
Toast.makeText(MainActivity.this, "最大生成数量为" + max, Toast.LENGTH_SHORT).show();
number.setText(max + "");
} else {
Toast.makeText(MainActivity.this, "生成成功", Toast.LENGTH_SHORT).show();
generatorVCard(start_number1, start_number2, start_number3, create_number);//生成函数,判断循环某项就可以
}
}
}
}
});
startNumber1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (startNumber1.length() == 3) {
startNumber2.requestFocus();
}
}
});
startNumber2.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
startNumber3.setFilters(new InputFilter[]{new InputFilter.LengthFilter(8 - startNumber2.length())});
if (startNumber2.length() == 7) {
startNumber3.requestFocus();
}
}
});
}
/**
* 获取存储权限
*/
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == REQUEST_PERMISSION_CODE) {
for (int i = 0; i < permissions.length; i++) {
if (grantResults[i] == -1) {
this.finish();
Toast.makeText(this, "未获取存储权限", Toast.LENGTH_SHORT).show();
}
}
}
}
// 生成vcard文件
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@SuppressLint("SimpleDateFormat")
public void generatorVCard(long number1, long number2, long number3, long creatNumber) {
//获取存储权限
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(this, PERMISSIONS_STORAGE, REQUEST_PERMISSION_CODE);
}
}
String fileName = "数量" + creatNumber + ".vcf";
OutputStreamWriter writer;
File file = new File(VCARD_FILE_PATH, fileName);
//得到存储卡的根路径,将fileName的文件写入到根目录下
try {
writer = new OutputStreamWriter(new FileOutputStream(file), StandardCharsets.UTF_8);
//通过循环遍历生成联系人,可以通过随机生成名字
for (int i = 0; i <= creatNumber; i++) {
number2++;
// Log.e("number1", String.valueOf(number1));
// Log.e("number2", String.valueOf(number2));
// Log.e("number3", String.valueOf(number3));
//创建一个联系人
VCardComposer composer = new VCardComposer();
ContactStruct contact1 = new ContactStruct();
contact1.name = number + "";//名字
contact1.addPhone(Contacts.Phones.TYPE_MOBILE, number1+String.valueOf(number2)+number3, null, true);
String vcardString;
vcardString = composer.createVCard(contact1, VCardComposer.VERSION_VCARD30_INT);
//将vcardString写入
writer.write(vcardString);
writer.write("\n");
}
writer.close();
Toast.makeText(MainActivity.this, "已成功导出到Download/" + fileName + "文件", Toast.LENGTH_SHORT).show();
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (VCardException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//跳转到GitHub
public void goToGitHub(View view) {
Uri uri = Uri.parse("https://github.com/zhao-pf/VcfCreate");
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(uri);
startActivity(intent);
}
}
| [
"[email protected]"
] | |
5269df4c52f5de01cea33e811d5f30a19f886f98 | baa08c46ff681b957217b0f8c06434986fbeb8e9 | /Java OOP/b_Inheritance/person/Person.java | fbea39d2a9f35c1251c031037a8d3128a4ce35ea | [] | no_license | anayankova/SoftUni-Software-Engineering | c4b06034995e4da28f2ce7550b5d9a87fd0c59b6 | 377063b55a5a044f9f4954108366fa3989abdd2d | refs/heads/master | 2022-06-24T17:58:58.121622 | 2020-04-05T09:30:38 | 2020-04-05T09:30:38 | 186,245,186 | 1 | 0 | null | 2022-06-21T03:04:59 | 2019-05-12T11:16:44 | Java | UTF-8 | Java | false | false | 321 | java | package b_Inheritance.person;
public class Person {
private String name;
private int age;
public Person(String name, int age) {
this.name = name;
this.age = age;
}
public String getName() {
return this.name;
}
public int getAge() {
return this.age;
}
}
| [
"[email protected]"
] | |
b24c20dc5776b78b8f7461f451481d33f6833658 | ce44e9fec5f4ee3eff79c3e6fbb0064fbb94753d | /main/geo/test/boofcv/alg/distort/TestAddRadialNtoN_F64.java | 39b4e086370c5266320b00b67859c810e323e159 | [
"Apache-2.0"
] | permissive | wsjhnsn/BoofCV | 74fc0687e29c45df1d2fc125b28d777cd91a8158 | bdae47003090c03386b6b23e2a884bceba242241 | refs/heads/master | 2020-12-24T12:34:02.996379 | 2014-06-27T21:15:21 | 2014-06-27T21:15:21 | 21,334,100 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,544 | java | /*
* Copyright (c) 2011-2013, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* 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 boofcv.alg.distort;
import georegression.struct.point.Point2D_F64;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
/**
* @author Peter Abeles
*/
public class TestAddRadialNtoN_F64 {
/**
* Manually compute the distorted coordinate for a point and see if it matches
*/
@Test
public void againstManual() {
double radial[]= new double[]{0.01,-0.03};
Point2D_F64 orig = new Point2D_F64(0.1,-0.2);
// manually compute the distortion
double r2 = orig.x*orig.x + orig.y*orig.y;
double mag = radial[0]*r2 + radial[1]*r2*r2;
double distX = orig.x*(1+mag);
double distY = orig.y*(1+mag);
AddRadialNtoN_F64 alg = new AddRadialNtoN_F64();
alg.set(radial);
Point2D_F64 found = new Point2D_F64();
alg.compute(orig.x,orig.y,found);
assertEquals(distX,found.x,1e-4);
assertEquals(distY,found.y,1e-4);
}
}
| [
"[email protected]"
] | |
0fdad9f539c80a680a5f13b33b4fd5e3fa510abc | bf8d8b0032982cbac8879691697c5361cf6f2e9a | /src/ZuoShen/Basic_class8/Code_04_Print_All_Permutations.java | 8e1b6e447603f3ba0b669656b67d36fc8c589f56 | [] | no_license | ddisacoder/ForBishi | 41b2819708c798f61c41ef9629582053eb3c1c80 | 63d8770deb754ee7585b64503d98c4418159c6d3 | refs/heads/master | 2020-07-15T19:53:20.015429 | 2019-10-06T11:17:56 | 2019-10-06T11:17:56 | 205,637,373 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | package ZuoShen.Basic_class8;
import java.util.HashSet;
public class Code_04_Print_All_Permutations {
public static void printAllPermutations1(String str) {
char[] chs = str.toCharArray();
process1(chs, 0);
}
public static void process1(char[] chs, int i) {
if (i == chs.length) {
System.out.println(String.valueOf(chs));
}
for (int j = i; j < chs.length; j++) {
swap(chs, i, j);
process1(chs, i + 1);
swap(chs, i, j);
}
}
public static void printAllPermutations2(String str) {
char[] chs = str.toCharArray();
process2(chs, 0);
}
public static void process2(char[] chs, int i) {
if (i == chs.length) {
System.out.println(String.valueOf(chs));
}
HashSet<Character> set = new HashSet<Character>();
for (int j = i; j < chs.length; j++) {
if (!set.contains(chs[j])) {
set.add(chs[j]);
swap(chs, i, j);
process2(chs, i + 1);
swap(chs, i, j);
}
}
}
public static void swap(char[] chs, int i, int j) {
char tmp = chs[i];
chs[i] = chs[j];
chs[j] = tmp;
}
public static void main(String[] args) {
String test1 = "abc";
printAllPermutations1(test1);
System.out.println("======");
printAllPermutations2(test1);
System.out.println("======");
String test2 = "acc";
printAllPermutations1(test2);
System.out.println("======");
printAllPermutations2(test2);
System.out.println("======");
}
}
| [
"[email protected]"
] | |
2cfd4c85199e63fe10fecf16e1c82ebff011eda0 | 66cf615e7f9f7255d0934535184a08794208f5ad | /mf-predictor/mf_predictor/trunk/mf_predictor/src/test/java/jp/ndca/test/MovieLensDataHandler.java | 327004354908d0ec53582677fdcfbe130e93a83c | [] | no_license | igara432/mf-predictor | 91d8589c539c1a85605be3746dc57d63a3114ef7 | d91d605d217160750af5aa198ce161a4a2b7ae4c | refs/heads/master | 2021-01-10T10:18:07.963473 | 2011-08-10T05:56:49 | 2011-08-10T05:56:49 | 55,459,083 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,616 | java | package jp.ndca.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import jp.ndca.recommend.common.data.RatingDataset;
import jp.ndca.recommend.common.util.RatingDatasetMaker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MovieLensDataHandler {
private static Logger log = LoggerFactory.getLogger(MovieLensDataHandler.class);
private static String encode = "utf-8";
public static RatingDataset[] get5FolodTrainingData() throws IOException{
int foldNum = 5;
RatingDataset[] trainingDataset = new RatingDataset[foldNum];
RatingDatasetMaker datasetMaker = new RatingDatasetMaker();
for( int i = 0 ; i < foldNum ; i++ ){
String learningPath = "u" + (i+1) + ".base";
log.info(learningPath);
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( learningPath );
BufferedReader br = new BufferedReader ( new InputStreamReader(is, encode) );
while( br.ready() ){
String line = br.readLine();
String[] splits = line.split("\t");
if( splits.length != 4 )
throw new IllegalArgumentException("data format error");
int userID = Integer.parseInt( splits[0] ) - 1;
int itemID = Integer.parseInt( splits[1] );
int rating = Integer.parseInt( splits[2] );
datasetMaker.add(userID, itemID, rating);
}
br.close();
trainingDataset[i] = datasetMaker.create();
datasetMaker.refresh();
}
return trainingDataset;
}
public static RatingDataset[] get5FolodTestData() throws IOException{
int foldNum = 5;
RatingDataset[] trainingDataset = new RatingDataset[foldNum];
RatingDatasetMaker datasetMaker = new RatingDatasetMaker();
for( int i = 0 ; i < foldNum ; i++ ){
String learningPath = "u" + (i+1) + ".test";
log.info(learningPath);
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream( learningPath );
BufferedReader br = new BufferedReader ( new InputStreamReader(is, encode) );
while( br.ready() ){
String line = br.readLine();
String[] splits = line.split("\t");
if( splits.length != 4 )
throw new IllegalArgumentException("data format error");
int userID = Integer.parseInt( splits[0] ) - 1;
int itemID = Integer.parseInt( splits[1] );
int rating = Integer.parseInt( splits[2] );
datasetMaker.add(userID, itemID, rating);
}
br.close();
trainingDataset[i] = datasetMaker.create();
datasetMaker.refresh();
}
return trainingDataset;
}
}
| [
"[email protected]"
] | |
bf1926eb163f2403c967feaa339f0f77fab281b4 | 1374237fa0c18f6896c81fb331bcc96a558c37f4 | /java/com/winnertel/ems/epon/iad/bbs4000/gui/r400/DeviceBaseQosMapTablePanel.java | d8f5c3c44c7952efb86a8d9606d5bf8d693abcc2 | [] | no_license | fangniude/lct | 0ae5bc550820676f05d03f19f7570dc2f442313e | adb490fb8d0c379a8b991c1a22684e910b950796 | refs/heads/master | 2020-12-02T16:37:32.690589 | 2017-12-25T01:56:32 | 2017-12-25T01:56:32 | 96,560,039 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,070 | java | /**
* Created by Zhou Chao, 2010/5/26
*/
package com.winnertel.ems.epon.iad.bbs4000.gui.r400;
import com.winnertel.ems.epon.iad.bbs4000.mib.r400.DeviceBaseQosMapTable;
import com.winnertel.em.framework.IApplication;
import com.winnertel.em.framework.gui.swing.UPanel;
import com.winnertel.em.standard.util.gui.layout.HSpacer;
import com.winnertel.em.standard.util.gui.layout.NTLayout;
import com.winnertel.em.standard.util.gui.layout.VSpacer;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class DeviceBaseQosMapTablePanel extends UPanel {
private int[] baseQosMapRuleIndexVList = new int[]{1, 2, 3,};
private String[] baseQosMapRuleIndexTList = new String[]{
fStringMap.getString("cos"), //1
fStringMap.getString("tos"), //2
fStringMap.getString("diffserv"), //3
};
private JComboBox tfBaseQosMapRuleIndex = new JComboBox(baseQosMapRuleIndexTList);
private String[] baseQosMapOctet8VList = null;
private String[] baseQosMapOctet16VList = null;
private String[] baseQosMapOctet64VList = null;
private JComboBox[] tfBaseQosMapOctet = null;
private final String baseQosMapRuleIndex = fStringMap.getString("deviceBaseQosMapRuleIndex") + " : ";
private final String baseQosMapOctet = fStringMap.getString("deviceBaseQosMapOctet") + " : ";
public DeviceBaseQosMapTablePanel(IApplication app) {
super(app);
init();
}
public void initGui() {
JPanel baseInfoPanel = new JPanel();
NTLayout layout = new NTLayout(1, 3, NTLayout.FILL, NTLayout.CENTER, 5, 5);
layout.setMargins(6, 10, 6, 10);
baseInfoPanel.setLayout(layout);
baseInfoPanel.setBorder(BorderFactory.createEtchedBorder());
baseInfoPanel.add(new JLabel(baseQosMapRuleIndex));
baseInfoPanel.add(tfBaseQosMapRuleIndex);
baseInfoPanel.add(new HSpacer());
tfBaseQosMapRuleIndex.setEnabled(false);
//BaseQosMapOctet panel
JPanel baseQosMapOctetPanel = new JPanel();
NTLayout layout1 = new NTLayout(16, 8, NTLayout.FILL, NTLayout.CENTER, 5, 5);
layout1.setMargins(6, 10, 6, 10);
baseQosMapOctetPanel.setLayout(layout1);
baseQosMapOctetPanel.setBorder(BorderFactory.createTitledBorder(fStringMap.getString(baseQosMapOctet)));
baseQosMapOctet8VList = new String[8];
for (int i = 0; i < baseQosMapOctet8VList.length; i++) {
baseQosMapOctet8VList[i] = String.valueOf(i);
}
baseQosMapOctet16VList = new String[16];
for (int i = 0; i < baseQosMapOctet16VList.length; i++) {
baseQosMapOctet16VList[i] = String.valueOf(i);
}
baseQosMapOctet64VList = new String[64];
for (int i = 0; i < baseQosMapOctet64VList.length; i++) {
baseQosMapOctet64VList[i] = String.valueOf(i);
}
tfBaseQosMapOctet = new JComboBox[64];
for (int i = 0; i < tfBaseQosMapOctet.length; i++) {
tfBaseQosMapOctet[i] = new JComboBox();
tfBaseQosMapOctet[i].setEnabled(false);
baseQosMapOctetPanel.add(new JLabel(fStringMap.getString("priority") + i));
baseQosMapOctetPanel.add(tfBaseQosMapOctet[i]);
}
tfBaseQosMapRuleIndex.setSelectedItem(null);
tfBaseQosMapRuleIndex.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
int rule = tfBaseQosMapRuleIndex.getSelectedIndex() + 1;
selectBaseQosMaoOctetPanel(rule);
}
});
JPanel allPanel = new JPanel();
layout = new NTLayout(3, 1, NTLayout.FILL, NTLayout.FILL, 5, 3);
layout.setMargins(6, 10, 6, 10);
allPanel.setLayout(layout);
allPanel.add(baseInfoPanel);
allPanel.add(baseQosMapOctetPanel);
allPanel.add(new VSpacer());
setLayout(new BorderLayout());
add(new JScrollPane(allPanel), BorderLayout.CENTER);
setPreferredSize(new Dimension(500, 400));
}
protected void initForm() {
}
public void selectBaseQosMaoOctetPanel(int rule) {
switch (rule) {
case 1: //cos
for (int i = 0; i < tfBaseQosMapOctet.length; i++) {
tfBaseQosMapOctet[i].setModel(new DefaultComboBoxModel(baseQosMapOctet8VList));
tfBaseQosMapOctet[i].setEnabled(i < 8);
}
break;
case 2: //tos
for (int i = 0; i < tfBaseQosMapOctet.length; i++) {
tfBaseQosMapOctet[i].setModel(new DefaultComboBoxModel(baseQosMapOctet16VList));
tfBaseQosMapOctet[i].setEnabled(i < 16);
}
break;
default: //diffserv
for (int i = 0; i < tfBaseQosMapOctet.length; i++) {
tfBaseQosMapOctet[i].setModel(new DefaultComboBoxModel(baseQosMapOctet64VList));
tfBaseQosMapOctet[i].setEnabled(i < 64);
}
break;
}
}
public void refresh() {
DeviceBaseQosMapTable mbean = (DeviceBaseQosMapTable) getModel();
if (mbean == null)
return;
tfBaseQosMapRuleIndex.setSelectedIndex(getIndexFromValue(baseQosMapRuleIndexVList, mbean.getDeviceBaseQosMapRuleIndex()));
//selectBaseQosMaoOctetPanel(mbean.getDeviceBaseQosMapRuleIndex()); //manually trigger 'addItemListener'
setBaseQosMapOctet(mbean.getDeviceBaseQosMapRuleIndex(), mbean.getDeviceBaseQosMapOctet());
}
public void updateModel() {
DeviceBaseQosMapTable mbean = (DeviceBaseQosMapTable) getModel();
if (mbean == null)
return;
mbean.setDeviceBaseQosMapOctet(getBaseQosMapOctet(mbean.getDeviceBaseQosMapRuleIndex()));
}
private byte[] getBaseQosMapOctet(int rule) {
int validLength = (rule == 1 ? 8 : rule == 2 ? 16 : 64);
return getByteMap(tfBaseQosMapOctet, validLength);
}
private void setBaseQosMapOctet(int rule, byte[] queueMap) {
int validLength = (rule == 1 ? 8 : rule == 2 ? 16 : 64);
setByteMap(tfBaseQosMapOctet, validLength, queueMap);
}
private byte[] getByteMap(JComboBox[] boxes, int validLength) {
byte[] b = new byte[validLength];
for (int i = 0; (i < validLength) && (i <= boxes.length); i++)
b[i] = (byte) Integer.parseInt((String) boxes[i].getSelectedItem());
return b;
}
private void setByteMap(JComboBox[] boxes, int validLength, byte[] mibValue) {
//for (int i = 0; i < boxes.length; i++)
// boxes[i].setSelectedItem(-1);
for (int i = 0; (i < validLength) && (i < mibValue.length); i++)
boxes[i].setSelectedItem(Byte.toString(mibValue[i]));
}
public int getIndexFromValue(int[] list, int v) {
for (int i = 0; i != list.length; i++) {
if (list[i] == v)
return i;
}
return 0;
}
} | [
"[email protected]"
] | |
f90eefbda453e7cc79960eb136e664559bb91bf1 | 79be286d62804776986eb65c541e08618e41abe9 | /app/src/main/java/com/mirkowu/baselibrarysample/api/TestService.java | 7f4faa4517c07280ed400b76d3b883c8c019709d | [] | no_license | phpzysw/BaseLibrary | 6f6772da5d5222f32a7ed147abb9538ce8d295ab | a64f614d6867ff5a6081fda26c823b071ded3a84 | refs/heads/master | 2020-04-28T04:03:39.201713 | 2019-03-08T04:23:00 | 2019-03-08T04:23:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 654 | java | package com.mirkowu.baselibrarysample.api;
import com.mirkowu.baselibrarysample.bean.GoodsBean;
import com.softgarden.baselibrary.network.BaseBean;
import java.util.List;
import io.reactivex.Observable;
import retrofit2.http.POST;
import retrofit2.http.Url;
public interface TestService {
/**
* 测试接口
*
* @return
*/
//接口有参数时 要写上该注解
// @FormUrlEncoded
@POST(HostUrl.HOST_GOODSLIST)
Observable<BaseBean<List<GoodsBean>>> getData(/*@Field("is_new") int is_new*/);
@POST
Observable<BaseBean<List<GoodsBean>>> getData(@Url String url/*@Field("is_new") int is_new*/);
}
| [
"[email protected]"
] | |
027c01eebd67fccc618480180513b3630f97fbbd | 5493ddc87a45e52cf5c290f7acfc0ce72439ec15 | /app/src/main/java/com/mondyxue/xrouter/demo/interceptor/LoginInterceptor.java | f59111e70495bb9c950b2b956570ef6977109045 | [] | no_license | mapleskip/XRouter | aa32d5dbc0bcf466bce1e79a9e44cf7e7c174ce5 | 912d80cb9e1b123de58936f925393dbe846266f9 | refs/heads/master | 2021-01-01T18:36:23.328860 | 2017-07-25T11:39:05 | 2017-07-25T11:39:05 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,925 | java | package com.mondyxue.xrouter.demo.interceptor;
import android.support.annotation.NonNull;
import com.alibaba.android.arouter.facade.Postcard;
import com.alibaba.android.arouter.facade.annotation.Interceptor;
import com.alibaba.android.arouter.facade.callback.InterceptorCallback;
import com.alibaba.android.arouter.facade.template.IInterceptor;
import com.mondyxue.xrouter.XRouter;
import com.mondyxue.xrouter.demo.callback.UserInfoCallback;
import com.mondyxue.xrouter.demo.constant.Extras;
import com.mondyxue.xrouter.demo.data.UserInfo;
import com.mondyxue.xrouter.demo.navigator.DemoNavigator;
import com.mondyxue.xrouter.navigator.Navigator;
/**
* <br>Created by MondyXue
* <br>E-MAIL: [email protected]
*/
@Interceptor(priority = 4, name = "LoginInterceptor")
public class LoginInterceptor extends com.mondyxue.xrouter.interceptor.LoginInterceptor implements IInterceptor{
@Override public boolean isLogin(){
return XRouter.getRouter()
.create(DemoNavigator.class)
.getUserService()
.isLogin();
}
@Override protected void onInterrupt(final Postcard postcard, final InterceptorCallback callback){
XRouter.getRouter()
.create(DemoNavigator.class)
.toLoginFragment()
.startActivityForResult(new UserInfoCallback(){
@Override public void onResponse(@NonNull UserInfo data){
postcard.withSerializable(Extras.UserInfo, data);
callback.onContinue(postcard);
}
@Override public void onError(Throwable throwable){
callback.onInterrupt(throwable);
}
@Override public void onCancel(){
callback.onInterrupt(new RuntimeException("login cancel!"));
}
});
}
}
| [
"[email protected]"
] | |
ebeb489d9ec3024ec5cd166f2975970d5fb35369 | f31040c83d613f3672b55bbb7ef6d2f026b5d087 | /app/src/main/java/com/example/samjingwen/androidbookstore/EditActivity.java | 2c1bdaf470c12e6a1b3535778cdae9cda7c11d04 | [] | no_license | samjingwen/AndroidBookstore | 68076a6d74f7e1790739e811c033c390d88dbce5 | 162e4e266c8dcc0439d56e4622b4934642f286ee | refs/heads/master | 2021-10-09T15:08:24.259350 | 2018-12-30T06:06:06 | 2018-12-30T06:06:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,000 | java | package com.example.samjingwen.androidbookstore;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.StrictMode;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import java.util.List;
public class EditActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_edit);
Intent intent = getIntent();
int id = Integer.parseInt(intent.getExtras().getString("BookID"));
new AsyncTask<Integer, Void, Book>(){
@Override
protected Book doInBackground(Integer...id){
return Book.ReadBook(id[0]);
}
@Override
protected void onPostExecute(Book book) {
show(book);
}
}.execute(id);
}
void show(Book book) {
int []dest = new int[]{R.id.editText1, R.id.editText2, R.id.editText3, R.id.editText4, R.id.editText5, R.id.editText6};
String []src = new String[]{"BookID", "Title", "Category", "Author", "Stock", "Price"};
for (int n=0; n<dest.length; n++) {
EditText txt = findViewById(dest[n]);
txt.setText(book.get(src[n]));
}
int id = Integer.parseInt(book.get("BookID"));
new AsyncTask<Integer, Void, Bitmap>(){
@Override
protected Bitmap doInBackground(Integer...id){
return Book.getPhoto(id[0]);
}
@Override
protected void onPostExecute(Bitmap bitmap) {
ImageView image = findViewById(R.id.imageView);
image.setImageBitmap(bitmap);
}
}.execute(id);
}
public void save(View v){
AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
builder1.setMessage("Confirm update?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
int []src = new int[]{R.id.editText1, R.id.editText2, R.id.editText3, R.id.editText4, R.id.editText5, R.id.editText6};
String []dest = new String[6];
for (int n=0; n<dest.length; n++) {
EditText txt = findViewById(src[n]);
dest[n] = txt.getText().toString();
}
Book book = new Book(dest[0], dest[1], dest[2], dest[3],dest[4],dest[5],"");
new AsyncTask<Book, Void, Void>() {
@Override
protected Void doInBackground(Book... params) {
Book.saveBook(params[0]);
return null;
}
}.execute(book);
Toast.makeText(getApplicationContext(), "Book updated", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
}
});
builder1.setNegativeButton(
"No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
}
}
| [
"[email protected]"
] | |
19af8085180925ee8cbb7b0bb928451f21b98a65 | 60466de9cedb17661d691069b1486d11f139b8dd | /KevinA-Assignments/03-java-spring/01-spring-fundamentals/03-hello-human/src/test/java/com/kevin/hello/ApplicationTests.java | 91c287a165e5a0f701f16649db816c0efd2f5245 | [] | no_license | Kevin-Anderson13/java-bootcamp | babc91cafbb2b2237d416ce039708758371866f6 | 31676760b0459d488852fc7b24ff923540fddc38 | refs/heads/main | 2023-06-27T13:23:34.875456 | 2021-08-03T07:09:31 | 2021-08-03T07:09:31 | 392,224,185 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 201 | java | package com.kevin.hello;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ApplicationTests {
@Test
void contextLoads() {
}
}
| [
"[email protected]"
] | |
cc35abde965f91159205e4a47896a0113c4eff19 | 149e03af23cb885844f2fe768b44096ea3adf9e9 | /src/main/java/lv/javaguru/java2/config/SpringConfig.java | 88caa2716292c024ee7679344b0a545d53b83d73 | [] | no_license | profaust93/MyTi | 213a8ca6157ca9128eb60b255e8cf507f9f43631 | 704a09c16e6000d7429343646b4ec7779339fc63 | refs/heads/master | 2021-01-21T04:50:54.287060 | 2016-06-08T10:01:19 | 2016-06-08T10:01:19 | 53,520,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,650 | java | package lv.javaguru.java2.config;
import org.apache.commons.dbcp.BasicDataSource;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.orm.hibernate4.HibernateTransactionManager;
import org.springframework.orm.hibernate4.LocalSessionFactoryBean;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.sql.DataSource;
import java.beans.PropertyVetoException;
import java.util.Properties;
@Configuration
@ComponentScan(basePackages = "lv.javaguru.java2")
@EnableTransactionManagement
public class SpringConfig {
private static final String DATABASE_PROPERTIES_FILE = "database.properties";
@Bean
public static PropertySourcesPlaceholderConfigurer prodPropertiesPlaceholderConfigurer() {
PropertySourcesPlaceholderConfigurer p = new PropertySourcesPlaceholderConfigurer();
Resource[] resourceLocations = new Resource[] {
new ClassPathResource(DATABASE_PROPERTIES_FILE)
};
p.setLocations(resourceLocations);
return p;
}
@Bean
public Properties hibernateProperties(
@Value("${hibernate.dialect}") String dialect,
@Value("${hibernate.show_sql}") boolean showSql,
@Value("${hibernate.format_sql}") boolean formatSql,
@Value("${hibernate.hbm2ddl.auto}") String hbm2ddl) {
Properties properties = new Properties();
properties.put("hibernate.dialect", dialect);
properties.put("hibernate.show_sql", showSql);
properties.put("hibernate.format_sql", formatSql);
properties.put("hibernate.hbm2ddl.auto", hbm2ddl);
return properties;
}
@Bean(destroyMethod = "close")
public DataSource dataSource(
@Value("${driverClass}") String driver,
@Value("${dbUrl}") String url,
@Value("${database.userName}") String user,
@Value("${password}") String password) throws PropertyVetoException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName(driver);
dataSource.setUrl(url);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.setDefaultAutoCommit(false);
return dataSource;
}
@Bean
public SessionFactory sessionFactory(DataSource dataSource,
@Value("${hibernate.packagesToScan}") String packagesToScan,
@Qualifier("hibernateProperties") Properties properties) throws Exception {
LocalSessionFactoryBean sessionFactoryBean = new LocalSessionFactoryBean();
sessionFactoryBean.setDataSource(dataSource);
sessionFactoryBean.setPackagesToScan(packagesToScan.split(";"));
sessionFactoryBean.setHibernateProperties(properties);
sessionFactoryBean.afterPropertiesSet();
return sessionFactoryBean.getObject();
}
@Bean
public PlatformTransactionManager transactionManager(SessionFactory sessionFactory) {
return new HibernateTransactionManager(sessionFactory);
}
}
| [
"[email protected]"
] | |
00dec428858a36942f11dec7eef5c02369a80d50 | ee4c29dcea9ebc488db5a6104dd5a743659db170 | /java/src/main/java/edu/dair/sgdb/gserver/giga/GIGASrv.java | d852eaab1d89e3bfb7195a51750b36eb6a439552 | [] | no_license | anirudhnarayanan/sirius | b711907c5c4d9a5bcf861d5be560f2a39eff60aa | 485eaec7bb330fc2ea01d043271f71b0c546e3ca | refs/heads/master | 2020-04-16T09:11:24.141417 | 2018-10-20T07:24:31 | 2018-10-20T07:24:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,663 | java | package edu.dair.sgdb.gserver.giga;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.server.TServer;
import org.apache.thrift.server.TThreadedSelectorServer;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TNonblockingServerSocket;
import edu.dair.sgdb.gserver.AbstractSrv;
import edu.dair.sgdb.partitioner.GigaIndex;
import edu.dair.sgdb.sengine.DBKey;
import edu.dair.sgdb.thrift.KeyValue;
import edu.dair.sgdb.thrift.TGraphFSServer;
import edu.dair.sgdb.utils.Constants;
import edu.dair.sgdb.utils.GLogger;
import edu.dair.sgdb.utils.JenkinsHash;
public class GIGASrv extends AbstractSrv {
public ConcurrentHashMap<ByteBuffer, GigaIndex> gigaMaps;
public GigaSplitWorker worker;
public GIGASrv() {
super();
this.gigaMaps = new ConcurrentHashMap<>();
//GigaHandler handler = new GigaHandler(this);
AsyncGigaHandler handler = new AsyncGigaHandler(this);
this.handler = handler;
this.processor = new TGraphFSServer.Processor(this.handler);
//this.worker = new GigaSplitWorker(this);
//this.workerPool.execute(worker);
}
protected GigaIndex surelyGetGigaMap(byte[] bsrc) {
ByteBuffer src = ByteBuffer.wrap(bsrc);
int startIdx = getHashLocation(bsrc, Constants.MAX_VIRTUAL_NODE);
GigaIndex t = this.gigaMaps.putIfAbsent(src, new GigaIndex(startIdx, this.serverNum));
if (t == null) {
return this.gigaMaps.get(src);
}
return t;
}
@Override
public Set<Integer> getEdgeLocs(byte[] src, int type) {
GigaIndex gi = surelyGetGigaMap(src);
Set<Integer> locs = gi.giga_get_all_servers();
return locs;
}
@Override
public Set<Integer> getEdgeLocs(byte[] src) {
return getEdgeLocs(src, 0);
}
@Override
public Set<Integer> getVertexLoc(byte[] src) {
Set<Integer> locs = new HashSet<>();
int startIdx = getHashLocation(src, Constants.MAX_VIRTUAL_NODE);
int physicalIdx = startIdx % this.serverNum;
locs.add(physicalIdx);
return locs;
}
private void initGigaSrvFromDBFile() {
// Build this.gigaMaps from DB.
DBKey minDBMeta = DBKey.MinDBKey(Constants.DB_META.getBytes(), 0);
DBKey maxDBMeta = DBKey.MaxDBKey(Constants.DB_META.getBytes(), 0);
List<KeyValue> r = this.localStore.scanKV(minDBMeta.toKey(), maxDBMeta.toKey());
for (KeyValue kv : r) {
byte[] key = kv.getKey();
DBKey dbKey = new DBKey(key);
byte[] bsrc = dbKey.dst; //dst is the real key;
byte[] gigaIndexArray = kv.getValue();
ByteBuffer src = ByteBuffer.wrap(bsrc);
GigaIndex t = new GigaIndex(gigaIndexArray);
this.gigaMaps.putIfAbsent(src, t);
}
// Build VirtualNodeStatus from DB for each GigaIndex
DBKey minDBKey = DBKey.MinDBKey();
DBKey maxDBKey = DBKey.MaxDBKey();
ArrayList<KeyValue> vals = new ArrayList<KeyValue>();
byte[] cur = this.localStore.scanLimitedRes(minDBKey.toKey(), maxDBKey.toKey(), Constants.LIMITS, vals);
while (cur != null) {
for (KeyValue kv : vals) {
DBKey dbKey = new DBKey(kv.getKey());
byte[] src = dbKey.src;
byte[] dst = dbKey.dst;
//Let's get ride of src == Constants.DB_META
if (Arrays.equals(src, Constants.DB_META.getBytes())) {
//GLogger.info("[%d] Scan %s:%s", this.localIdx, new String(src), new String(dst));
continue;
}
JenkinsHash jh = new JenkinsHash();
int dstHash = Math.abs(jh.hash32(dst));
GigaIndex gi = surelyGetGigaMap(src);;
int vid = gi.giga_get_vid_from_hash(dstHash);
gi.add_vid_count(vid);
}
vals.clear();
cur = this.localStore.scanLimitedRes(cur, maxDBKey.toKey(), Constants.LIMITS, vals);
}
}
@Override
public void start() {
try {
initGigaSrvFromDBFile();
/*
TServerTransport serverTransport = new TServerSocket(this.port);
Factory proFactory = new Factory();
TThreadPoolServer.Args args = new TThreadPoolServer.Args(serverTransport).processor(processor).protocolFactory(proFactory);
//NOTE: TThreadPoolServer could be the best option for concurrent client less than 10,000, check: https://github.com/m1ch1/mapkeeper/wiki/Thrift-Java-Servers-Compared
args.maxWorkerThreads(this.serverNum * 200);
TServer server = new TThreadPoolServer(args);
*/
TNonblockingServerSocket serverTransport = new TNonblockingServerSocket(this.port);
TThreadedSelectorServer.Args tArgs = new TThreadedSelectorServer.Args(serverTransport);
tArgs.processor(processor);
tArgs.transportFactory(new TFramedTransport.Factory());
tArgs.protocolFactory(new TBinaryProtocol.Factory());
TServer server = new TThreadedSelectorServer(tArgs);
GLogger.info("[%d] start GigaSrv at %s:%d", this.getLocalIdx(), this.localAddr, this.port);
server.serve();
} catch (TException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
86cf19b6287a16e3508e353050ee67e298960574 | 9410ef0fbb317ace552b6f0a91e0b847a9a841da | /src/main/java/com/tencentcloudapi/tdid/v20210519/models/DownCptResponse.java | ff8a06fe60b73fba1a6ee8a1c522f312d95b1b00 | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-java-intl-en | 274de822748bdb9b4077e3b796413834b05f1713 | 6ca868a8de6803a6c9f51af7293d5e6dad575db6 | refs/heads/master | 2023-09-04T05:18:35.048202 | 2023-09-01T04:04:14 | 2023-09-01T04:04:14 | 230,567,388 | 7 | 4 | Apache-2.0 | 2022-05-25T06:54:45 | 2019-12-28T06:13:51 | Java | UTF-8 | Java | false | false | 2,445 | java | /*
* Copyright (c) 2017-2018 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.tencentcloudapi.tdid.v20210519.models;
import com.tencentcloudapi.common.AbstractModel;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
import java.util.HashMap;
public class DownCptResponse extends AbstractModel{
/**
* The unique request ID, which is returned for each request. RequestId is required for locating a problem.
*/
@SerializedName("RequestId")
@Expose
private String RequestId;
/**
* Get The unique request ID, which is returned for each request. RequestId is required for locating a problem.
* @return RequestId The unique request ID, which is returned for each request. RequestId is required for locating a problem.
*/
public String getRequestId() {
return this.RequestId;
}
/**
* Set The unique request ID, which is returned for each request. RequestId is required for locating a problem.
* @param RequestId The unique request ID, which is returned for each request. RequestId is required for locating a problem.
*/
public void setRequestId(String RequestId) {
this.RequestId = RequestId;
}
public DownCptResponse() {
}
/**
* NOTE: Any ambiguous key set via .set("AnyKey", "value") will be a shallow copy,
* and any explicit key, i.e Foo, set via .setFoo("value") will be a deep copy.
*/
public DownCptResponse(DownCptResponse source) {
if (source.RequestId != null) {
this.RequestId = new String(source.RequestId);
}
}
/**
* Internal implementation, normal users should not use it.
*/
public void toMap(HashMap<String, String> map, String prefix) {
this.setParamSimple(map, prefix + "RequestId", this.RequestId);
}
}
| [
"[email protected]"
] | |
9a384e7e729e51c6421c2498dcdb4b9c449d05ae | 18599504244240b2b0e70bc1648b72ce9235c513 | /WS/DogusAtolye/src/BilgisayarCikartmaYapamazken.java | 1eb64f7b936ca9ae3f1c4675b36335f76494f179 | [] | no_license | javaci-net/dogus_atolye | 25694f03cc8934e855690627226d3edef9218c8a | 50e073fdac55c056ae3b7b09a17ceb427fc1c42b | refs/heads/master | 2022-04-25T18:54:25.162069 | 2020-04-26T16:45:48 | 2020-04-26T16:45:48 | 259,068,817 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 127 | java |
public class BilgisayarCikartmaYapamazken {
public static void main(String[] args) {
System.out.println(1 - 0.9F);
}
}
| [
"[email protected]"
] | |
c4cd9ed91b273e998078e33d2e65ad0eb58448ee | 72473952759db71520c3271e63be29160dce0d57 | /src/main/java/com/flamingo/controller/GirlController.java | 9900fdaea488bec66b7c2818e4799237dc5b1270 | [] | no_license | BingYuQHS/girl_SpringBoot_2 | 6f372288c1691154d2b9953fc0e38c1cfce47c96 | ea53820bffe1cd71dcda65b6c9bd7401910d1418 | refs/heads/master | 2020-03-22T14:26:40.330830 | 2018-07-08T15:34:16 | 2018-07-08T15:34:16 | 140,180,314 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,089 | java | package com.flamingo.controller;
import com.flamingo.aspect.HttpAspect;
import com.flamingo.domain.Result;
import com.flamingo.repository.GirlRepository;
import com.flamingo.domain.Girl;
import com.flamingo.service.GirlService;
import com.flamingo.utils.ResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
public class GirlController {
private final static Logger logger = LoggerFactory.getLogger(GirlController.class);
@Autowired
private GirlRepository girlRepository;
@Autowired
private GirlService girlService;
/**
* 查询所有女生列表
* @return
*/
@GetMapping(value = "/girls")
public List<Girl> girlList(){
logger.info("执行girlList方法");
return girlRepository.findAll();
}
/**
* 添加一条记录
* @param girl
* @return
*/
@PostMapping(value = "/girls")
public Result<Girl> girlAdd(@Valid Girl girl, BindingResult bindingResult){
if (bindingResult.hasErrors()){
return ResultUtil.error(1,bindingResult.getFieldError().getDefaultMessage());
}
girl.setName(girl.getName());
girl.setAge(girl.getAge());
return ResultUtil.success(girlRepository.save(girl));
}
/**
* 根据id查询一条记录
* @param id
* @return
*/
@GetMapping(value = "/girls/{id}")
public Girl girlFindOne(@PathVariable("id") Integer id) {
return girlRepository.getOne(id);
}
/**
* 更新一条记录
* @param id
* @param name
* @param age
* @return
*/
@PutMapping(value = "/girls/{id}")
public Girl girlUpdate(@PathVariable("id") Integer id,
@RequestParam("name") String name,
@RequestParam("age") Integer age){
Girl girl = new Girl();
girl.setId(id);
girl.setName(name);
girl.setAge(age);
return girlRepository.save(girl);
}
/**
* 删除一条记录
* @param id
*/
@DeleteMapping(value = "/girls/{id}")
public void girlDelete(@PathVariable("id") Integer id){
girlRepository.deleteById(id);
}
/**
* 根据年龄查询
* @param age
* @return
*/
@GetMapping(value = "/girls/age/{age}")
public List<Girl> girlListByAge(@PathVariable("age") Integer age){
return girlRepository.findByAge(age);
}
/**
* 插入两条记录
*/
@PostMapping(value = "/girls/two")
public void girlTwo(){
girlService.insertTwo();
}
@GetMapping(value = "girls/getAge/{id}")
public void getAge(@PathVariable("id") Integer id) throws Exception{
girlService.getAge(id);
}
}
| [
"[email protected]"
] | |
ce1f61f70d557b217c43cf9944a2cce7226ffd44 | ceef55f93a25ea3a5a9be2132e11508d035f7132 | /java-qi4j/marc-grue/dcisample_b/src/test/java/com/marcgrue/dcisample_b/context/test/booking/BookNewCargoTest.java | de36bc59fdb05f68aec02bf9b3696427c5478c6a | [
"Apache-2.0"
] | permissive | zeng910910903/dci-sample | 72032b40a243290228ea43b7d8c13c5f31d5118e | 780a8bf0f969163941e5e48d2a200314e883bd42 | refs/heads/master | 2020-05-17T23:56:30.912327 | 2011-11-27T16:51:31 | 2011-11-27T16:51:31 | null | 0 | 0 | null | null | null | null | WINDOWS-1250 | Java | false | false | 6,119 | java | package com.marcgrue.dcisample_b.context.test.booking;
import com.marcgrue.dcisample_b.bootstrap.test.TestApplication;
import com.marcgrue.dcisample_b.context.interaction.booking.BookNewCargo;
import com.marcgrue.dcisample_b.data.entity.CargoEntity;
import com.marcgrue.dcisample_b.data.factory.exception.CannotCreateCargoException;
import com.marcgrue.dcisample_b.data.factory.exception.CannotCreateRouteSpecificationException;
import org.junit.Test;
import org.qi4j.api.constraint.ConstraintViolationException;
import static com.marcgrue.dcisample_b.data.structure.delivery.RoutingStatus.NOT_ROUTED;
import static com.marcgrue.dcisample_b.data.structure.delivery.TransportStatus.NOT_RECEIVED;
import static com.marcgrue.dcisample_b.data.structure.handling.HandlingEventType.RECEIVE;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
/**
* {@link BookNewCargo} tests
*/
public class BookNewCargoTest extends TestApplication
{
@Test
public void deviation_2a_OriginAndDestinationSame() throws Exception
{
thrown.expect( CannotCreateRouteSpecificationException.class, "Origin location can't be same as destination location." );
new BookNewCargo( CARGOS, HONGKONG, HONGKONG, DAY24 ).getTrackingId();
}
@Test
public void deviation_2b_DeadlineInThePastNotAccepted() throws Exception
{
thrown.expect( CannotCreateRouteSpecificationException.class, "Arrival deadline is in the past or Today." );
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( -1 ) ).getTrackingId();
}
@Test
public void deviation_2b_DeadlineTodayIsTooEarly() throws Exception
{
thrown.expect( CannotCreateRouteSpecificationException.class, "Arrival deadline is in the past or Today." );
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 0 ) ).getTrackingId();
}
@Test
public void deviation_2b_DeadlineTomorrowIsOkay() throws Exception
{
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY1 ).getTrackingId();
}
@Test
public void step_2_CanCreateRouteSpecification() throws Exception
{
trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).getTrackingId();
cargo = uow.get( CargoEntity.class, trackingId.id().get() );
assertThat( cargo.routeSpecification().get().origin().get(), is( equalTo( HONGKONG ) ) );
assertThat( cargo.routeSpecification().get().destination().get(), is( equalTo( STOCKHOLM ) ) );
assertThat( cargo.routeSpecification().get().arrivalDeadline().get(), is( equalTo( DAY24 ) ) );
}
@Test
public void step_3_CanDeriveInitialDeliveryData() throws Exception
{
trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).getTrackingId();
cargo = uow.get( CargoEntity.class, trackingId.id().get() );
assertDelivery( null, null, null, null,
NOT_RECEIVED, notArrived,
NOT_ROUTED, directed, unknownETA, unknownLeg,
RECEIVE, HONGKONG, noSpecificDate, noVoyage );
}
@Test
public void deviation_4a_TrackingIdTooShort() throws Exception
{
thrown.expect( ConstraintViolationException.class, "for value 'no'" );
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "no" );
}
@Test
public void deviation_4a_TrackingIdNotTooShort() throws Exception
{
trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "yes" );
cargo = uow.get( CargoEntity.class, trackingId.id().get() );
assertThat( cargo.trackingId().get().id().get(), is( equalTo( "yes" ) ) );
}
@Test
public void deviation_4a_TrackingIdTooLong() throws Exception
{
thrown.expect( ConstraintViolationException.class, "for value '1234567890123456789012345678901'" );
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "1234567890123456789012345678901" );
}
@Test
public void deviation_4a_TrackingIdNotTooLong() throws Exception
{
trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "123456789012345678901234567890" );
cargo = uow.get( CargoEntity.class, trackingId.id().get() );
assertThat( cargo.trackingId().get().id().get(), is( equalTo( "123456789012345678901234567890" ) ) );
}
@Test
public void deviation_4a_TrackingIdWithWrongCharacter() throws Exception
{
thrown.expect( ConstraintViolationException.class, "for value 'Gšteborg1234'" );
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "Gšteborg1234" );
}
@Test
public void deviation_4b_TrackingIdNotUnique() throws Exception
{
thrown.expect( CannotCreateCargoException.class, "Tracking id 'yes' is not unique." );
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "yes" );
}
@Test
public void step_4_CanAutoCreateTrackingIdFromEmptyString() throws Exception
{
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "" );
}
@Test
public void step_4_CanAutoCreateTrackingIdFromNull() throws Exception
{
new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( null );
}
@Test
public void success_BookNewCargo() throws Exception
{
trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, DAY24 ).withTrackingId( "ABC" );
cargo = uow.get( CargoEntity.class, trackingId.id().get() );
assertThat( cargo.trackingId().get(), is( equalTo( trackingId ) ) );
assertThat( cargo.trackingId().get().id().get(), is( equalTo( "ABC" ) ) );
assertThat( cargo.origin().get(), is( equalTo( HONGKONG ) ) );
assertDelivery( null, null, null, null,
NOT_RECEIVED, notArrived,
NOT_ROUTED, directed, unknownETA, unknownLeg,
RECEIVE, HONGKONG, noSpecificDate, noVoyage );
}
}
| [
"[email protected]"
] | |
5c40ac0831aa79313f8cbeb575ff68989ef7b427 | 8e381c005e7e80e4f85e7a3ea40f301a60099de2 | /app/src/main/java/com/library/circularprofileupload/circularprofileupload/MainActivity.java | 5eec01d944f2c30655ad424244ffc8a9595f7d7c | [] | no_license | joyshah/CircularProfilePic | cfbec65af0768ae526fdb6c16a5a1f3364debf6c | 2989ea076b5020aa76d06adee50c40641ca83845 | refs/heads/master | 2021-05-08T02:35:00.252244 | 2018-08-17T12:28:47 | 2018-08-17T12:28:47 | 108,017,183 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,714 | java | package com.library.circularprofileupload.circularprofileupload;
import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import com.library.circularprofileupload.circularprofilepiclibrary.CircularProfile;
import com.library.circularprofileupload.circularprofilepiclibrary.CircularProfileClickListener;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final CircularProfile ap = (CircularProfile) findViewById(R.id.img1);
ap.setCircularProfileClickListener(new CircularProfileClickListener() {
@Override
public void onConcentricCircleClick() {
Log.i("MAinActivity", "onclick");
}
@Override
public void onClick() {
Log.i("MAinActivity", "noty");
}
});
findViewById(R.id.btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ap.setConcentricCircleRadius(60);
ap.setCircularBorderWidth(60);
ap.setCircularBorderRadius(150);
ap.setCircularBorderColor(Color.parseColor("#FF2CD90E"));
ap.setConcentricCircleColor(Color.parseColor("#FF2CD90E"));
ap.setConcentricCircleDegree(135);
ap.setConcentricCircleImage(R.drawable.ic_person_add_black_24dp);
//ap.setHideConcentricCircle(true);
}
});
}
}
| [
"[email protected]"
] | |
380a9d774b71bb7c3efb57b77f7730ba3cec5f56 | 94b6aaf872dd881c4fee93018b2c5c0d4f1134c9 | /modules/CoreSets/src/edu/uncc/genosets/core/api/OrthoMcl.java | 3b9b61206cc2a815672001c09dedc32d71f47e5f | [
"BSD-3-Clause"
] | permissive | aacain/genosets | 6978f00729bcda179890e2a6e2ef361689a6edbf | 96f7a161b35f79c1e87aa88be93666adaeaf2f56 | refs/heads/master | 2020-04-06T07:00:33.820564 | 2015-02-16T17:15:43 | 2015-02-16T17:15:43 | 26,338,552 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,092 | java | /*
*
*
*/
package edu.uncc.genosets.core.api;
import edu.uncc.genosets.datamanager.entity.AnnotationMethod;
import edu.uncc.genosets.datamanager.entity.FeatureCluster;
import edu.uncc.genosets.taskmanager.api.ProgramStep;
import java.io.File;
import java.util.List;
import org.openide.filesystems.FileObject;
/**
*
* @author aacain
*/
public interface OrthoMcl {
public static final String METHOD_ENTITY_NAME = AnnotationMethod.DEFAULT_NAME;
public static final String CLUSTER_ENTITY_NAME = FeatureCluster.DEFAULT_NAME;
public static final String FACT_LOCATION_ENTITY_NAME = "OrthoFact";
public static final String CLUSTER_CATEGORY = "Ortholog";
public static final String CLUSTER_TYPE = "OrthoMCL";
public static final String METHOD_SOURCE_TYPE = "OrthoMCL";
public OrthoMcl getDefault();
public List<? extends ProgramStep> getSteps();
public void run(FileObject folder);
public void load(File file, AnnotationMethod method);
public void load(File file, String methodName, String methodDescription);
public String getVersion();
}
| [
"[email protected]"
] | |
144795189b00ec2e9e3a3d486dbf2a6dbb53b41b | 9b15ca35add3763427813837008e5a259403211b | /android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java | 79a7be2f4165dd3d8b74a7cc6ee53e4857f0c602 | [] | no_license | Milimeter/aewebshop_employee | 2b554d3e13cb0d65fc18fddc29585f46b6202321 | 8781dbb1762039b10093b515034f73ae572d868e | refs/heads/main | 2023-06-07T14:18:23.199477 | 2021-07-02T14:38:39 | 2021-07-02T14:38:39 | 381,045,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,224 | java | package io.flutter.plugins;
import androidx.annotation.Keep;
import androidx.annotation.NonNull;
import io.flutter.Log;
import io.flutter.embedding.engine.FlutterEngine;
/**
* Generated file. Do not edit.
* This file is generated by the Flutter tool based on the
* plugins that support the Android platform.
*/
@Keep
public final class GeneratedPluginRegistrant {
private static final String TAG = "GeneratedPluginRegistrant";
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestorePlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin cloud_firestore, io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestorePlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.auth.FlutterFirebaseAuthPlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin firebase_auth, io.flutter.plugins.firebase.auth.FlutterFirebaseAuthPlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin firebase_core, io.flutter.plugins.firebase.core.FlutterFirebaseCorePlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.firebase.storage.FlutterFirebaseStoragePlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin firebase_storage, io.flutter.plugins.firebase.storage.FlutterFirebaseStoragePlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin flutter_plugin_android_lifecycle, io.flutter.plugins.flutter_plugin_android_lifecycle.FlutterAndroidLifecyclePlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.imagepicker.ImagePickerPlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin image_picker, io.flutter.plugins.imagepicker.ImagePickerPlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin path_provider, io.flutter.plugins.pathprovider.PathProviderPlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.baseflow.permissionhandler.PermissionHandlerPlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin permission_handler, com.baseflow.permissionhandler.PermissionHandlerPlugin", e);
}
try {
flutterEngine.getPlugins().add(new bsi.iceman.searchable_dropdown.SearchableDropdownPlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin searchable_dropdown, bsi.iceman.searchable_dropdown.SearchableDropdownPlugin", e);
}
try {
flutterEngine.getPlugins().add(new com.tekartik.sqflite.SqflitePlugin());
} catch(Exception e) {
Log.e(TAG, "Error registering plugin sqflite, com.tekartik.sqflite.SqflitePlugin", e);
}
}
}
| [
"[email protected]"
] | |
65e90233f6db8a2f9d6e505b4d00b7971c7c68ff | 846a3695e2c5257b6b812e3d389caf94eca82b47 | /app/src/main/java/com/weima/aishangyi/jiaoshi/activity/UserClassroomOrderActivity.java | b5f3f04ae703c68553512b8282cd54d6f41dc813 | [] | no_license | cgy529387306/AiShangYiTeacher | 2482759cb8540cf4c30b02bc1a62a1146de2e5d2 | 6129f6aa5396a95bb9a9ebb73873b30cd359f4be | refs/heads/master | 2020-04-26T03:21:41.866430 | 2019-03-01T08:32:27 | 2019-03-01T08:32:27 | 173,264,544 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,754 | java | package com.weima.aishangyi.jiaoshi.activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.util.DisplayMetrics;
import com.weima.aishangyi.jiaoshi.R;
import com.weima.aishangyi.jiaoshi.base.BaseActivity;
import com.weima.aishangyi.jiaoshi.fragment.ClassroomOrderFragment;
import com.weima.aishangyi.jiaoshi.tabstrip.PagerSlidingTabStrip;
/**
* 课程/课室订单
*/
public class UserClassroomOrderActivity extends BaseActivity {
private PagerSlidingTabStrip tabstrip;
private ViewPager viewpager;
private int status = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.common_trip_viewpager);
setCustomTitle("课程/课室订单");
initUI();
}
private void initUI() {
status = getIntent().getIntExtra("status",0);
tabstrip = (PagerSlidingTabStrip) findViewById(R.id.tabstrip);
viewpager = (ViewPager) findViewById(R.id.viewpager);
viewpager.setAdapter(new MyAdapter(getSupportFragmentManager()));
tabstrip.setViewPager(viewpager);
viewpager.setCurrentItem(status); //初始化显示0
tabstrip.setTextColor(getResources().getColor(R.color.text_color));//未选中字体的颜色
tabstrip.setSelectedTextColor(getResources().getColor(R.color.base_orange));//选中选项中字体的颜色
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);//获取屏幕宽度
int width = dm.widthPixels;//宽度
tabstrip.setTextSize(width / 28);//字体的大小
}
public class MyAdapter extends FragmentStatePagerAdapter {
private final String[] titles = {"全部", "待确认", "待授课","待评价"};
public MyAdapter(FragmentManager fm) {
super(fm);
}
@Override
public CharSequence getPageTitle(int position) {
return titles[position];
}
@Override
public int getCount() {
return titles.length;
}
@Override
public Fragment getItem(int position) {
if (position == 1) {
return ClassroomOrderFragment.newInstance(0);
} else if (position == 2) {
return ClassroomOrderFragment.newInstance(1);
} else if (position == 3) {
return ClassroomOrderFragment.newInstance(2);
}else{
return ClassroomOrderFragment.newInstance(-1);
}
}
}
}
| [
"[email protected]"
] | |
1ddc505d60930171608f390a8f9f0ad62b173d82 | 0c66d0562f1aa58af7f6379ff031220234a4816a | /src/Samepackage/Same.java | 7dfb3abae1afef40f46a8d52d87f0bf9cb06a5df | [] | no_license | parkchangju12/java_work | 2ec23634b61b26d1a9c06573f8605cdfaf46e878 | 95a8f496575b359c657a97e38737c0f42337bc01 | refs/heads/master | 2023-06-07T11:19:30.607942 | 2021-07-06T02:22:34 | 2021-07-06T02:22:34 | 363,104,738 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package Samepackage;
public class Same {
private void _private() {
System.out.println("private");
}
void _default() {
System.out.println("default");
}
protected void _protected() {
System.out.println("protected");
}
public void _public() {
System.out.println("public");
}
}
| [
"[email protected]"
] | |
8f72eb54963bbc823fc70e6b37786d9ca0e3ce78 | 541d32ad782cb551c7c4aa689008023fc4b9cc7f | /app/src/main/java/my/edu/tarc/madassignment/QRCodeActivity.java | 5c5e78548863443465790cc61c9f4821250665af | [] | no_license | LeeMunKit/MADassignment | fd2e5878f554bf1dad89915514c19fb00a4b080e | dae1c47d071bd17b2d2a12cb5b28704ef398112e | refs/heads/master | 2021-05-05T22:16:17.232631 | 2018-01-05T07:11:13 | 2018-01-05T07:11:13 | 116,116,966 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 652 | java | package my.edu.tarc.madassignment;
/**
* Created by ASUS on 19/11/2017.
*/
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class QRCodeActivity extends Fragment{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_join_code, container, false);
return rootView;
//return null;
}
}
| [
"[email protected]"
] | |
7fd4f931ca1e830d617db801aeb59d9c6f0831cc | df71f195c8d6e84f2f4c485569c3be4b5fea5836 | /src/main/java/com/cloud/distribution/web/rest/ProductTypeResource.java | be586b4338c6813c0297f5dff15111454e9a6573 | [] | no_license | bobying/distribution | 1366e6bdfb99ce27ce4f1356d4e5f3d8e08f8258 | 2c0225010276f20d6f407da9f916a5f4d97b331a | refs/heads/master | 2021-05-06T15:08:26.984615 | 2017-12-07T04:24:44 | 2017-12-07T04:24:44 | 113,430,964 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,800 | java | package com.cloud.distribution.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.cloud.distribution.service.ProductTypeService;
import com.cloud.distribution.web.rest.errors.BadRequestAlertException;
import com.cloud.distribution.web.rest.util.HeaderUtil;
import com.cloud.distribution.web.rest.util.PaginationUtil;
import com.cloud.distribution.service.dto.ProductTypeDTO;
import com.cloud.distribution.service.dto.ProductTypeCriteria;
import com.cloud.distribution.service.ProductTypeQueryService;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
import java.util.stream.StreamSupport;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* REST controller for managing ProductType.
*/
@RestController
@RequestMapping("/api")
public class ProductTypeResource {
private final Logger log = LoggerFactory.getLogger(ProductTypeResource.class);
private static final String ENTITY_NAME = "productType";
private final ProductTypeService productTypeService;
private final ProductTypeQueryService productTypeQueryService;
public ProductTypeResource(ProductTypeService productTypeService, ProductTypeQueryService productTypeQueryService) {
this.productTypeService = productTypeService;
this.productTypeQueryService = productTypeQueryService;
}
/**
* POST /product-types : Create a new productType.
*
* @param productTypeDTO the productTypeDTO to create
* @return the ResponseEntity with status 201 (Created) and with body the new productTypeDTO, or with status 400 (Bad Request) if the productType has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/product-types")
@Timed
public ResponseEntity<ProductTypeDTO> createProductType(@RequestBody ProductTypeDTO productTypeDTO) throws URISyntaxException {
log.debug("REST request to save ProductType : {}", productTypeDTO);
if (productTypeDTO.getId() != null) {
throw new BadRequestAlertException("A new productType cannot already have an ID", ENTITY_NAME, "idexists");
}
ProductTypeDTO result = productTypeService.save(productTypeDTO);
return ResponseEntity.created(new URI("/api/product-types/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /product-types : Updates an existing productType.
*
* @param productTypeDTO the productTypeDTO to update
* @return the ResponseEntity with status 200 (OK) and with body the updated productTypeDTO,
* or with status 400 (Bad Request) if the productTypeDTO is not valid,
* or with status 500 (Internal Server Error) if the productTypeDTO couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/product-types")
@Timed
public ResponseEntity<ProductTypeDTO> updateProductType(@RequestBody ProductTypeDTO productTypeDTO) throws URISyntaxException {
log.debug("REST request to update ProductType : {}", productTypeDTO);
if (productTypeDTO.getId() == null) {
return createProductType(productTypeDTO);
}
ProductTypeDTO result = productTypeService.save(productTypeDTO);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, productTypeDTO.getId().toString()))
.body(result);
}
/**
* GET /product-types : get all the productTypes.
*
* @param pageable the pagination information
* @param criteria the criterias which the requested entities should match
* @return the ResponseEntity with status 200 (OK) and the list of productTypes in body
*/
@GetMapping("/product-types")
@Timed
public ResponseEntity<List<ProductTypeDTO>> getAllProductTypes(ProductTypeCriteria criteria, Pageable pageable) {
log.debug("REST request to get ProductTypes by criteria: {}", criteria);
Page<ProductTypeDTO> page = productTypeQueryService.findByCriteria(criteria, pageable);
HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/product-types");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
/**
* GET /product-types/:id : get the "id" productType.
*
* @param id the id of the productTypeDTO to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the productTypeDTO, or with status 404 (Not Found)
*/
@GetMapping("/product-types/{id}")
@Timed
public ResponseEntity<ProductTypeDTO> getProductType(@PathVariable Long id) {
log.debug("REST request to get ProductType : {}", id);
ProductTypeDTO productTypeDTO = productTypeService.findOne(id);
return ResponseUtil.wrapOrNotFound(Optional.ofNullable(productTypeDTO));
}
/**
* DELETE /product-types/:id : delete the "id" productType.
*
* @param id the id of the productTypeDTO to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/product-types/{id}")
@Timed
public ResponseEntity<Void> deleteProductType(@PathVariable Long id) {
log.debug("REST request to delete ProductType : {}", id);
productTypeService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
/**
* SEARCH /_search/product-types?query=:query : search for the productType corresponding
* to the query.
*
* @param query the query of the productType search
* @param pageable the pagination information
* @return the result of the search
*/
@GetMapping("/_search/product-types")
@Timed
public ResponseEntity<List<ProductTypeDTO>> searchProductTypes(@RequestParam String query, Pageable pageable) {
log.debug("REST request to search for a page of ProductTypes for query {}", query);
Page<ProductTypeDTO> page = productTypeService.search(query, pageable);
HttpHeaders headers = PaginationUtil.generateSearchPaginationHttpHeaders(query, page, "/api/_search/product-types");
return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
}
| [
"[email protected]"
] | |
32d0ad309a23d6592e7d0e61128681598796a8e1 | dc2abd1a2d7153f429e909355b8e40d03531eb7a | /src/com/primeresponse/testcases/Accounts/Send_SocialIntegrationEmail.java | d0c77043c6fe705fa5594a46b782b13cfacb0a2a | [] | no_license | rajkrsingh/Prime-Project | acdf4bb466f9a821fffe2d96031af06b6257cd21 | 60e0250cafcd93a7d58ea98fa30d1550b4028a5d | refs/heads/master | 2020-03-19T02:53:49.344714 | 2018-06-01T05:47:00 | 2018-06-01T05:47:00 | 135,672,472 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,331 | java | package com.primeresponse.testcases.Accounts;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import com.primeresponse.pagehelper.AccountsHelper;
import com.primeresponse.pagehelper.HeaderHelper;
import com.primeresponse.pagehelper.LoginHelper;
import com.primeresponse.util.DriverTestCase;
import com.primeresponse.util.ExecutionLog;
public class Send_SocialIntegrationEmail extends DriverTestCase {
@Test
public void testSend_SocialIntegrationEmail() throws Exception {
// Initialize objects
loginHelper = new LoginHelper(getWebDriver());
headerHelper = new HeaderHelper(getWebDriver());
AccountsHelper accountsHelper = new AccountsHelper(getWebDriver());
ExecutionLog.LogAddClass(this.getClass().getName()
+ " and Test method "
+ Thread.currentThread().getStackTrace()[1].getMethodName());
try {
// Open application
getWebDriver().navigate().to(applicationUrl);
ExecutionLog.Log("open application giturl");
// login to the application
login("Admin");
ExecutionLog.Log("log-in into application");
// Select "Selenium Test" Account if not selected
selectAccount();
ExecutionLog.Log("Select Selenium Test Account if not selected");
//Click on logged in account edit icon
headerHelper.clickOnEditIconOfLoggedAccount();
ExecutionLog.Log("Click on logged in account edit icon");
//Click on Accounts->Users
getWebDriver().navigate().to("https://app.prime-response.com/accounts/13594/accounts_users");
//headerHelper.clickOnUsers();
//ExecutionLog.Log("Click on Accounts->Users");
//Method to Send Social Integration
accountsHelper.sendSocialIntegration(userEmail);
ExecutionLog.Log("Method to Send Social Integration");
//verify the success notification
headerHelper.checkSuccessMessage("Email successfully sent to "+userEmail+" for social integration.");
ExecutionLog.Log("success message");
}
catch (Error e) {
captureScreenshot("testSend_SocialIntegrationEmail");
ExecutionLog.LogErrorMessage(e);
throw e;
} catch (Exception e) {
captureScreenshot("testSend_SocialIntegrationEmail");
ExecutionLog.LogExceptionMessage(e);
throw e;
}
}
@AfterMethod
public void endMethods() throws Exception {
ExecutionLog.LogEndClass(this.getClass().getName());
}
}
| [
"[email protected]"
] | |
17e84516b11d4bc940419296308c7b701682f238 | 0d8e13b07067b93a7bf807d53a8921e3e307ad46 | /src/house/ImpHouseBuilder.java | 746850b6614cb5ce30b14697a8511957c966694b | [
"Apache-2.0"
] | permissive | Saio88/java-bootcamp-bahia | 1ba9383e52747bbffd5946fccd74909a2a702327 | 922faab97b8082cecc15e23ef1997b2aa8814345 | refs/heads/master | 2021-01-18T06:35:33.650830 | 2015-02-18T14:00:28 | 2015-02-18T14:00:28 | 30,596,276 | 0 | 0 | null | 2015-03-10T00:41:30 | 2015-02-10T14:38:31 | Java | UTF-8 | Java | false | false | 507 | java | package house;
import house.Partes.*;
public class ImpHouseBuilder implements HouseBuilder {
private House house;
public ImpHouseBuilder() {
this.house = new House();
}
public void buildWalls() {
for (int i = 0; i < 4; i++)
this.house.addWall(new Wall());
}
public void buildRoof() {
this.house.setRoot(new Roof());
}
public void buildFloor() {
this.house.setFloor(new Floor());
}
public House getHouse() {
return this.house;
}
}
| [
"[email protected]"
] | |
a33eecf3a1049bcd3234158062dc4a673907c984 | 13b48e6194328829a1eae8b70b383b31ca6f6341 | /src/main/java/com/ecs/measure/GUI/Screen.java | adc146eacb2ae6555ed13b092766e24ab16b3259 | [
"MIT"
] | permissive | IgorTimofeev/Measure | f036114d1e145064bd564547bd17c53b66f7efc1 | fbf3e973252bc1b5a0d663bf5dd21657ed480017 | refs/heads/master | 2020-03-21T12:40:53.168404 | 2018-06-25T23:42:33 | 2018-06-25T23:42:33 | 138,566,216 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,572 | java | package com.ecs.measure.GUI;
import com.ecs.measure.Measure;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import org.lwjgl.input.Mouse;
public class Screen extends GuiScreen {
public MainContainer container;
public class MainContainer extends Container {
MainContainer(int x, int y, int width, int height) {
super(x, y, width, height);
}
@Override
public void update() {
ScaledResolution scaledResolution = new ScaledResolution(Measure.minecraft);
width = scaledResolution.getScaledWidth();
height = scaledResolution.getScaledHeight();
super.update();
}
}
public Screen() {
this.container = new MainContainer(0, 0, Measure.minecraft.displayWidth, Measure.minecraft.displayHeight);
}
private void handleMouse(Container container, int mouseX, int mouseY, boolean objectFound) {
Object child;
for (int i = container.children.size() - 1; i >= 0; i--) {
child = container.children.get(i);
if (child instanceof Container) {
handleMouse((Container) child, mouseX, mouseY, objectFound);
}
else {
if (!child.hidden && !child.disabled) {
if (objectFound) {
child.hovered = false;
}
else {
child.hovered = child.isPointInside(mouseX, mouseY);
if (child.hovered)
objectFound = true;
}
if (child.onMouseEvent != null)
child.onMouseEvent.run(mouseX, mouseY);
}
else {
child.hovered = false;
}
}
}
}
@Override
public boolean doesGuiPauseGame() {
return false;
}
@Override
public void handleMouseInput() {
int scaleFactor = new ScaledResolution(Measure.minecraft).getScaleFactor();
handleMouse(
container,
Mouse.getEventX() / scaleFactor,
(Measure.minecraft.displayHeight - Mouse.getEventY() - 3) / scaleFactor,
false
);
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
container.update();
container.draw();
}
}
| [
"[email protected]"
] | |
43291f6fd1f3880960b055cbea5c8f11234d23b6 | 7efbd298b931bdd1234f067b8d2aaecd5277d97e | /src/com/company/Driver.java | 253ff6f57757c75134f3fec9cfa0ec7b35c0b6a5 | [] | no_license | AdamJamil/PottsModel | 819f8965dd6fb6b68876d7a4e0c909a715be5f34 | 0f750fd1fbf8cc4da11d88eb058f2e5d58452e5a | refs/heads/master | 2020-06-02T17:18:29.424512 | 2019-06-26T06:47:03 | 2019-06-26T06:47:03 | 191,245,428 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 19,893 | java | package com.company;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import static com.company.Main.*;
class Driver
{
TransitionMatrix tm;
static ArrayList<State> states;
ArrayList<boolean[]> upsets = new ArrayList<>();
private static ArrayList<Arrow> arrows = new ArrayList<>();
private static int[][] neighbors;
//stores all the information regarding "bad cases" (ie the upset criteria doesn't work)
ArrayList<State> bs1, bs2;
ArrayList<RESum> p1, p2;
ArrayList<boolean[]> bu;
private boolean[][] partialOrder, temp;
private boolean[][] minUpset;
private boolean[][] blacklist;
private boolean[][] minRel;
ArrayList<boolean[][]> partialOrders = new ArrayList<>();
private ArrayList<Integer>[] checklist;
private static final double err = 0.00000000001;
private long time;
Driver()
{
arrows.add(new Arrow(" does (*→B)", new int[]{1, -1, 0}));
arrows.add(new Arrow(" does (*→†)", new int[]{0, -1, 1}));
arrows.add(new Arrow(" does (B→†)", new int[]{-1, 0, 1}));
arrows.add(new Arrow(" does (B→*)", new int[]{-1, 1, 0}));
arrows.add(new Arrow(" does (†→*)", new int[]{0, 1, -1}));
arrows.add(new Arrow(" does (†→B)", new int[]{1, 0, -1}));
arrows.add(new Arrow(" does (nothing)", new int[]{0, 0, 0}));
tm = new TransitionMatrix();
initializeNeighbors();
initializePow();
initializeProbArr();
partialOrder = guessAndInitPartialOrder();
fixPartialOrder();
System.out.println(new DecimalFormat("#.000").format(((double) (System.nanoTime() - time)) / 1000000000) + "s");
partialOrders.add(partialOrder);
checkTransitivity();
printMinPartialOrder(partialOrder);
}
private void fixPartialOrder()
{
boolean good = false;
while (!good)
{
partialOrders.add(copy(partialOrder));
initializeMinUpset(partialOrder);
initalizeOtherCrapTemp(partialOrder); //TODO: REMOVE THIS LATER OR NOT //DEPENDS ON MEMORY
getUpset(partialOrder);
//oneStepCoupling(partialOrder);
good = true;
for (int i = 1; i < blacklist.length; i++)
{
int idx = -1;
for (int j = 0; j < blacklist.length; j++)
if (blacklist[i][j])
partialOrder[i][idx = j] = (blacklist[i][j] = false);
good &= idx == -1;
}
if (good)
{
boolean actuallyGood = true;
for (boolean bArr[] : blacklist)
for (boolean b : bArr)
actuallyGood &= !b;
if (!actuallyGood)
System.out.println("shippaishita :(");
else
System.out.println("sakusen kanryo!!!");
}
}
}
private boolean[][] guessAndInitPartialOrder()
{
boolean[][] geq = new boolean[states.size()][states.size()];
for (int i = 0; i < geq.length; i++)
for (int j = 0; j < geq.length; j++)
{
State s1 = states.get(i), s2 = states.get(j);
int[] o1 = s1.order, o2 = s2.order;
geq[i][j] = (i == j) || (i == 0) || (o1[0] >= k && o2[0] >= k && s1.geq(s2)) || (o2[2] == 0 && o1[0] == o2[0]) || (o2[2] == 0 && s1.geq(s2));
}
for (double lambda = 1.01; lambda < 100; lambda *= 1.01)
{
double[][] arr = tm.evaluate(lambda), temp = new double[arr.length][arr.length];
for (int i = 0; i < arr.length; i++)
System.arraycopy(arr[i], 0, temp[i], 0, arr[i].length);
for (int pow = 0; pow < 100; pow++)
{
arr = multiply(arr, temp);
for (int i = 0; i < geq.length; i++)
for (int j = 0; j < geq.length; j++)
geq[i][j] &= arr[i][0] + err >= arr[j][0];
}
}
return geq;
}
//maps from pair of (state|neighbors) (format 32-7|7) to result of comparison
private HashMap<Integer, Boolean> result = new HashMap<>();
//maps from (state|neighbors) to RESum of probability of going into upset
private HashMap<Integer, RESum> probability = new HashMap<>();
// @SuppressWarnings("Duplicates")
// void oneStepCoupling(boolean[][] partialOrder)
// {
// blacklist = new boolean[partialOrder.length][partialOrder.length];
// boolean[][] minRel = copy(minUpset);
//
// //init minRel
// for (int i = 0; i < partialOrder.length; i++)
// {
// boolean[] set = minRel[i];
// set[i] = false;
//
// outer:
// for (int j = 0; j < minUpset.length; j++)
// {
// if (!set[j])
// continue;
//
// for (int k = 0; k < minUpset.length; k++)
// {
// if (!set[k])
// continue;
//
// if (j == k)
// continue;
//
// if (minRel[k][j])
// {
// set[j] = false;
// continue outer;
// }
// }
// }
// }
//
// long time = System.nanoTime();
// System.out.println("sakusen kaishi!");
//
// ArrayList<Integer>[] checklist = new ArrayList[states.size()];
//
// for (int i = 0; i < partialOrder.length; i++)
// {
// checklist[i] = new ArrayList<>(partialOrder.length);
// for (int j = 0; j < partialOrder.length; j++)
// if (i != j && partialOrder[i][j] && minRel[j][i])
// checklist[i].add(j);
// }
//
// for (boolean[] upset : upsets)
// {
// for (int i = 0; i < partialOrder.length; i++)
// {
// int key1 = i << 7;
// for (int j = 0; j < neighbors[i].length; j++)
// if (upset[neighbors[i][j]])
// key1 += (1 << j);
//
// outer:
// for (int w = checklist[i].size() - 1; w >= 0; w--)
// {
// int j = checklist[i].get(w);
//
// int key2 = j << 7;
// for (int k = 0; k < neighbors[j].length; k++)
// if (upset[neighbors[j][k]])
// key2 += (1 << k);
//
// boolean temp;
// int key = (key1 << 16) + key2;
//
// if (result.containsKey(key))
// temp = result.get(key);
// else
// {
// RESum p1, p2;
//
// if (probability.containsKey(key1))
// p1 = probability.get(key1);
// else
// {
// p1 = new RESum();
// for (int k = 0; k < 7; k++)
// if ((key1 & (1 << k)) != 0)
// p1.add(tm.arr[i][neighbors[i][k]]);
// probability.put(key1, p1);
// }
//
// if (probability.containsKey(key2))
// p2 = probability.get(key2);
// else
// {
// p2 = new RESum();
// for (int k = 0; k < 7; k++)
// if ((key2 & (1 << k)) != 0)
// p2.add(tm.arr[j][neighbors[j][k]]);
// probability.put(key2, p2);
// }
//
// result.put(key, temp = p1.geq(p2));
// }
//
// if (!temp)
// {
// blacklist[i][j] = true;
// checklist[i].remove(w);
// }
// }
// }
// }
//
// System.out.println(((double) (System.nanoTime() - time)) / 1000000000 + "s");
// }
// void twoStepCoupling()
// {
// HashMap<RESum, HashMap<RESum, Integer>> map = new HashMap<>();
//
// long time = System.nanoTime();
// System.out.println("sakusen kaishi! dainimaku!!!");
//
// for (int i = 0; i < bs1.size(); i++)
// {
// State s1 = bs1.get(i), s2 = bs2.get(i);
// boolean[] upset = bu.get(i);
//
// RESum p1 = sumZero.copy();
// RESum p2 = sumZero.copy();
//
// for (State target : upset)
// {
// p1.add(tm.map2.get(s1).get(target));
// p2.add(tm.map2.get(s2).get(target));
// }
//
// int temp;
//
// if (map.containsKey(p1) && map.get(p1).containsKey(p2))
// temp = map.get(p1).get(p2);
// else
// {
// //System.out.println(p1 + " " + p2);
// temp = p1.compare(p2);
// if (!map.containsKey(p1))
// map.put(p1, new HashMap<>());
// map.get(p1).put(p2, temp);
// }
//
// if (temp == 2 || temp == 1)
// {
// System.out.println("yikes!");
// System.out.println(p1);
// System.out.println(p2);
//// bs1.add(s1);
//// bs2.add(s2);
//// bu.add(upset);
//// p1.add(p1);
//// p2.add(p2);
// }
// }
//
// System.out.println(((double) (System.nanoTime() - time)) / 1000000000 + "s");
// }
private void initializeMinUpset(boolean[][] partialOrder)
{
minUpset = new boolean[partialOrder.length][partialOrder.length];
for (int i = 0; i < partialOrder.length; i++)
for (int j = 0; j < partialOrder.length; j++)
minUpset[j][i] = partialOrder[i][j];
}
private double[][] multiply(double[][] arr1, double[][] arr2)
{
double[][] out = new double[arr1.length][arr2[0].length];
for (int i = 0; i < out.length; i++)
for (int j = 0; j < out[0].length; j++)
for (int k = 0; k < arr1.length; k++)
out[i][j] += arr1[i][k] * arr2[k][j];
return out;
}
static ArrayList<int[]> partitions()
{
ArrayList<int[]> start = new ArrayList<>(), good = new ArrayList<>();
for (int i = 0; i <= Main.n; i++)
{
int[] temp = new int[3];
temp[0]= i;
start.add(temp);
}
start = partitions(start, 1);
for (int[] ints : start)
{
int a = ints[0], b = ints[1], c = ints[2];
if (a + b + c == n && a >= b && b >= c)
good.add(ints);
}
return good;
}
private static ArrayList<int[]> partitions(ArrayList<int[]> list, int pos)
{
if (pos == 3)
return list;
ArrayList<int[]> out = new ArrayList<>();
for (int[] ints : list)
{
for (int i = 0; i <= n; i++)
{
int[] temp = new int[3];
System.arraycopy(ints, 0, temp, 0, pos);
temp[pos] = i;
out.add(temp);
}
}
return partitions(out, pos + 1);
}
private void initializePow()
{
Polynomial.pow = new ArrayList<>();
Polynomial.pow.add(Main.one.copy());
for (int i = 1; i <= 100; i++)
{
Polynomial temp = Polynomial.pow.get(i - 1).copy();
temp.multiply(Main.x);
Polynomial.pow.add(temp);
}
}
private void initializeNeighbors()
{
neighbors = new int[states.size()][];
for (int i = 0; i < states.size(); i++)
{
ArrayList<Integer> temp = new ArrayList<>();
for (int j = 0; j < arrows.size(); j++)
if (arrows.get(j).valid(states.get(i)))
temp.add(j);
neighbors[i] = new int[temp.size()];
for (int j = 0; j < neighbors[i].length; j++)
neighbors[i][j] = states.indexOf(arrows.get(temp.get(j)).map(states.get(i)));
}
}
private void initializeProbArr()
{
tm.arr = new RESum[states.size()][states.size()];
for (int i = 0; i < states.size(); i++)
{
State s1 = states.get(i);
for (Arrow arrow : arrows)
if (arrow.valid(s1))
tm.arr[i][states.indexOf(arrow.map(s1))] = tm.map.get(states.get(i)).get(arrow.map(s1)).copy();
}
for (RESum[] reSums : tm.arr)
for (RESum reSum : reSums)
if (reSum != null)
reSum.simplify();
}
private void checkTransitivity()
{
for (int i = 0; i < states.size(); i++)
for (int j = 0; j < states.size(); j++)
for (int k = 0; k < states.size(); k++)
if (partialOrder[i][j] && partialOrder[j][k] && !partialOrder[i][k])
System.out.println("not transitive :(");
}
private void printMinPartialOrder(boolean[][] partialOrder)
{
partialOrder = copy(partialOrder);
for (int i = 0; i < partialOrder.length; i++)
{
boolean[] set = minUpset[i];
set[i] = false;
outer: for (int j = 0; j < minUpset.length; j++)
{
if (!set[j])
continue;
for (int k = 0; k < minUpset.length; k++)
{
if (!set[k])
continue;
if (j == k)
continue;
if (minUpset[k][j])
{
set[j] = false;
continue outer;
}
}
}
System.out.print(states.get(i) + ": ");
for (int j = 0; j < minUpset[i].length; j++)
if (minUpset[i][j])
System.out.print(states.get(j) + " ");
System.out.println();
}
}
boolean[][] copy(boolean[][] arr)
{
boolean[][] out = new boolean[arr.length][arr[0].length];
for (int i = 0; i < arr.length; i++)
System.arraycopy(arr[i], 0, out[i], 0, arr[i].length);
return out;
}
private void getUpset(boolean[][] partialOrder)
{
//upsets = new ArrayList<>();
temp = partialOrder;
boolean[] allowed = new boolean[partialOrder.length];
for (int i = 0; i < partialOrder.length; i++)
allowed[i] = true;
generateAntichains(new boolean[partialOrder.length], allowed);
//System.out.println(upsets.size());
}
private void generateAntichains(boolean[] curr, boolean[] allowed)
{
int idx = -1;
for (int i = 0; i < allowed.length; i++)
if (allowed[i])
{
idx = i;
break;
}
if (idx == -1)
{
boolean[] upset = new boolean[partialOrder.length], cp = new boolean[partialOrder.length];
for (int i = 0; i < curr.length; i++)
if (curr[i])
for (int j = 0; j < minUpset.length; j++)
upset[j] |= minUpset[i][j];
System.arraycopy(upset, 0, cp, 0, upset.length);
upsets.add(cp);
for (int i = 0; i < partialOrder.length; i++)
{
int key1 = i << 7;
for (int j = 0; j < neighbors[i].length; j++)
if (upset[neighbors[i][j]])
key1 += (1 << j);
for (int w = checklist[i].size() - 1; w >= 0; w--)
{
int j = checklist[i].get(w);
int key2 = j << 7;
for (int k = 0; k < neighbors[j].length; k++)
if (upset[neighbors[j][k]])
key2 += (1 << k);
boolean temp;
int key = (key1 << 16) + key2;
if (result.containsKey(key))
temp = result.get(key);
else
{
RESum p1, p2;
if (probability.containsKey(key1))
p1 = probability.get(key1);
else
{
p1 = new RESum();
for (int k = 0; k < 7; k++)
if ((key1 & (1 << k)) != 0)
p1.add(tm.arr[i][neighbors[i][k]]);
probability.put(key1, p1);
}
if (probability.containsKey(key2))
p2 = probability.get(key2);
else
{
p2 = new RESum();
for (int k = 0; k < 7; k++)
if ((key2 & (1 << k)) != 0)
p2.add(tm.arr[j][neighbors[j][k]]);
probability.put(key2, p2);
}
result.put(key, temp = p1.geq(p2));
}
if (!temp)
{
blacklist[i][j] = true;
checklist[i].remove(w);
}
}
}
return;
}
allowed[idx] = false;
boolean[] other = new boolean[curr.length], otherAllowed = new boolean[allowed.length];
System.arraycopy(curr, 0, other, 0, curr.length);
System.arraycopy(allowed, 0, otherAllowed, 0, allowed.length);
generateAntichains(curr, allowed);
other[idx] = true;
for (int i = 0; i < otherAllowed.length; i++)
if (minUpset[idx][i] || temp[idx][i])
otherAllowed[i] = false;
generateAntichains(other, otherAllowed);
}
private void initalizeOtherCrapTemp(boolean[][] partialOrder)
{
blacklist = new boolean[partialOrder.length][partialOrder.length];
minRel = copy(minUpset);
//init minRel
for (int i = 0; i < partialOrder.length; i++)
{
boolean[] set = minRel[i];
set[i] = false;
outer:
for (int j = 0; j < minUpset.length; j++)
{
if (!set[j])
continue;
for (int k = 0; k < minUpset.length; k++)
{
if (!set[k])
continue;
if (j == k)
continue;
if (minRel[k][j])
{
set[j] = false;
continue outer;
}
}
}
}
time = System.nanoTime();
System.out.println("sakusen kaishi!");
checklist = new ArrayList[states.size()];
for (int i = 0; i < partialOrder.length; i++)
{
checklist[i] = new ArrayList<>(partialOrder.length);
for (int j = 0; j < partialOrder.length; j++)
if (i != j && partialOrder[i][j])// && minRel[j][i])
checklist[i].add(j);
}
}
} | [
"[email protected]"
] | |
77d4ef72b26d50fe1e3e96869cf5a2deee4d933f | 02127aef528ff9ba18ae478f481ab37cf3c2fb4c | /src/main/java/com/wanliang/small/service/CartItemService.java | be07ec838e318df2d27c891134820b1ca4075d49 | [] | no_license | pf5512/small | 2f2c78a9fcc7f0fc9df56fb4d251df49ea037ae8 | 923eda30e9c85214a9efb78fc3750b7fc3e572d4 | refs/heads/master | 2021-01-01T06:53:32.059039 | 2015-04-13T01:15:50 | 2015-04-13T01:15:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java |
package com.wanliang.small.service;
import com.wanliang.small.entity.CartItem;
import com.wanliang.small.entity.CartItem;
/**
* Service - 购物车项
*
* @author [email protected] Team
* @version 3.0
*/
public interface CartItemService extends BaseService<CartItem, Long> {
} | [
"[email protected]"
] | |
64da83401995f8aef3bc86137570fd70fc3063d5 | 5ecd15baa833422572480fad3946e0e16a389000 | /framework/MCS-Open/subsystems/runtime/main/api/java/com/volantis/mcs/runtime/policies/PolicyReferenceResolver.java | cec4edcb48173dfd591b6faac17caed263c7e08c | [] | no_license | jabley/volmobserverce | 4c5db36ef72c3bb7ef20fb81855e18e9b53823b9 | 6d760f27ac5917533eca6708f389ed9347c7016d | refs/heads/master | 2021-01-01T05:31:21.902535 | 2009-02-04T02:29:06 | 2009-02-04T02:29:06 | 38,675,289 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,451 | java | /*
This file is part of Volantis Mobility Server.
Volantis Mobility Server is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Volantis Mobility Server is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Volantis Mobility Server. If not, see <http://www.gnu.org/licenses/>.
*/
/* ----------------------------------------------------------------------------
* (c) Volantis Systems Ltd 2005.
* ----------------------------------------------------------------------------
*/
package com.volantis.mcs.runtime.policies;
import com.volantis.mcs.expression.PolicyExpression;
import com.volantis.mcs.policies.PolicyType;
import com.volantis.mcs.protocols.assets.LinkAssetReference;
import com.volantis.mcs.protocols.assets.ScriptAssetReference;
import com.volantis.mcs.protocols.assets.TextAssetReference;
import com.volantis.mcs.integration.PageURLType;
import com.volantis.mcs.themes.StyleValue;
import com.volantis.mcs.themes.StyleString;
import com.volantis.mcs.themes.StyleComponentURI;
/**
* @mock.generate
*/
public interface PolicyReferenceResolver {
/**
* @param policyExpression
* @return
*/
RuntimePolicyReference resolvePolicyExpression(
PolicyExpression policyExpression);
RuntimePolicyReference resolveUnquotedPolicyExpression(
String expressionAsString, PolicyType policyType);
LinkAssetReference resolveQuotedLinkExpression(
String expression, PageURLType urlType);
ScriptAssetReference resolveQuotedScriptExpression(
String expression);
TextAssetReference resolveQuotedTextExpression(String expression);
TextAssetReference resolveUnquotedTextExpression(String name);
/**
* Resolve the possibly quoted text expression as a style value.
*
* @param expression The possibly quoted text expression.
* @return The style value, may be a {@link StyleString}, or a {@link
* StyleComponentURI}.
*/
StyleValue resolveQuotedTextExpressionAsStyleValue(String expression);
}
| [
"iwilloug@b642a0b7-b348-0410-9912-e4a34d632523"
] | iwilloug@b642a0b7-b348-0410-9912-e4a34d632523 |
a02b5b156042899e65b5708527795b62b010b313 | 366a05b3253bba82fb5b783512022ccc17cf7683 | /RightBigSpikedTreeMiddleRight.java | 605af28a23ede079d7558b10a97cfdec552c0d83 | [] | no_license | Pasterian/Dead-Pixels | 13367884a5b773746bb9fac0a28ebec70ca1f319 | dbc8a340038a5c9d2e2cd774b27cd42a53d3358a | refs/heads/master | 2023-03-09T22:18:53.867394 | 2021-02-24T01:11:43 | 2021-02-24T01:11:43 | 341,737,440 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 548 | java | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class RightBigSpikedTreeMiddleRight here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class RightBigSpikedTreeMiddleRight extends Tile
{
/**
* Act - do whatever the RightBigSpikedTreeMiddleRight wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| [
"[email protected]"
] | |
34707e90e2e1baad34812d07dc4c1c39115fde9a | 24cc25194f81803501694288e84aae2e1482b62a | /java/core/src/main/java/com/greenscriptool/ResourceType.java | 2d7d173072180196d1e4c6111ea0693473a5c201 | [
"MIT",
"Apache-2.0"
] | permissive | novadata/greenscript | 40096bf9984186ed9c81a4465d4b8a66420add84 | 26ae7fb9d07a0d81005d66beaba0cfcec126f969 | refs/heads/master | 2021-01-18T15:09:11.447600 | 2015-07-21T08:31:42 | 2015-07-21T08:31:42 | 39,362,281 | 1 | 0 | null | 2015-07-20T03:55:41 | 2015-07-20T03:55:41 | null | UTF-8 | Java | false | false | 665 | java | package com.greenscriptool;
import java.util.Arrays;
import java.util.List;
/**
* Resource type enumeration
*
* @author [email protected]
* @version 1.0, 2010-10-13
* @since 1.0
*/
public enum ResourceType {
JS(".js", ".coffee"), CSS(".css", ".less");
private ResourceType(String... extension) {
if (extension.length == 0) throw new IllegalArgumentException("needs at least one extension");
exts_ = extension;
}
private String[] exts_;
public String getExtension() {
return exts_[0];
}
public List<String> getAllExtensions() {
return Arrays.asList(exts_);
}
}
| [
"[email protected]"
] | |
d82aaf45fd9944ebc3e15c17828cde080c843fbe | c9221ebd6b1261227b0f7b75f71634fe3fe55b7d | /patient-module-api/src/main/java/com/patient/module/api/patientmoduleapi/dto/VitalSignsDto.java | bd54f4fa407c9739cfeeaf3a9f509eef57a80637 | [] | no_license | sasiprabu/HealthManagement | 07349a1c16d65dc9802caded56057bababdc65a6 | aa967f48f3c1a015a5cd447c015aba30ab5bcd83 | refs/heads/main | 2023-01-22T22:50:43.764545 | 2020-11-25T11:46:03 | 2020-11-25T11:46:03 | 314,010,780 | 0 | 0 | null | 2020-11-25T11:35:48 | 2020-11-18T17:39:18 | Java | UTF-8 | Java | false | false | 941 | java | package com.patient.module.api.patientmoduleapi.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.sql.Date;
import java.time.LocalDateTime;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class VitalSignsDto {
private int consultingId;
private int respirationRate;
private int bloodPressure;
private float bodyTemperature;
private int pulseRate;
private int sugarLevel;
private float weight;
private float height;
private float spo2_sat;
private float pt_inr;
private int scanId;
private String scanName;
private String scanReportDetails;
private Date patientConsultingDate;
private int patientId;
private String createdUser;
private LocalDateTime createdDate;
private String lastUpdatedUser;
private LocalDateTime lastUpdateDate;
}
| [
"[email protected]"
] | |
67d80258dd08438a6a8c05615ab9e10c475f61bc | 1d9492a95cfcd1120b3c886cbfc12b609f3f313d | /springhub-web/src/main/java/com/mjeanroy/springhub/exceptions/UploadException.java | 1942b2e80b0545819d2431e3f41e1e68ce7271c1 | [] | no_license | mjeanroy/springhub | 59a4273f3079b1ffdc61fe99e878645762e738a9 | 5dbfe89fb8e8b2ba40731383cac625a452534880 | refs/heads/master | 2021-05-15T02:02:38.685508 | 2020-02-12T08:02:55 | 2020-02-12T08:02:55 | 9,960,985 | 0 | 2 | null | 2020-02-12T08:02:56 | 2013-05-09T14:35:08 | Java | UTF-8 | Java | false | false | 437 | java | package com.mjeanroy.springhub.exceptions;
public class UploadException extends ApplicationException {
private UploadExceptionType type;
public UploadException(UploadExceptionType type, String msg) {
super(msg);
this.type = type;
}
@Override
public String getType() {
return "UPLOAD_" + this.type.toString();
}
public static enum UploadExceptionType {
MULTIPART_HTTP,
FILE_NOT_FOUND,
FILE_EMPTY,
FILE_TYPE
}
}
| [
"[email protected]"
] | |
e9d1ad46a9eb291dc58a6bfef28f995da81dfd31 | 47119d527d55e9adcb08a3a5834afe9a82dd2254 | /exportLibraries/vnxe/src/main/java/com/emc/storageos/vnxe/models/BlockHostAccess.java | a1f542d680477a1061aefd137b1ef982b461397f | [] | no_license | chrisdail/coprhd-controller | 1c3ddf91bb840c66e4ece3d4b336a6df421b43e4 | 38a063c5620135a49013aae5e078aeb6534a5480 | refs/heads/master | 2020-12-03T10:42:22.520837 | 2015-06-08T15:24:36 | 2015-06-08T15:24:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,220 | java | /**
* Copyright 2015 EMC Corporation
* All Rights Reserved
*/
/**
* Copyright (c) 2014 EMC Corporation
* All Rights Reserved
*
* This software contains the intellectual property of EMC Corporation
* or is licensed to EMC Corporation from third parties. Use of this
* software and the intellectual property contained therein is expressly
* limited to the terms and conditions of the License Agreement under which
* it is provided by or on behalf of EMC.
*/
package com.emc.storageos.vnxe.models;
public class BlockHostAccess {
private VNXeBase host;
private int accessMask;
public VNXeBase getHost() {
return host;
}
public void setHost(VNXeBase host) {
this.host = host;
}
public int getAccessMask() {
return accessMask;
}
public void setAccessMask(int accessMask) {
this.accessMask = accessMask;
}
public static enum HostLUNAccessEnum {
NOACCESS(0),
PRODUCTION(1),
SNAPSHOT(2),
BOTH(3);
private int value;
private HostLUNAccessEnum(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
}
| [
"[email protected]"
] | |
c6321439ff3fe48b9ad1f0f2b3c3281d53af7169 | ddad23a68826adeac942917a5fd91ccef240963f | /AutotestsWebim/src/test/java/ru/webim/demo/AutotestsWebim.java | ad8da01273ad786c0614cd09ba341c549837a220 | [] | no_license | dmitriilysenko/AutotestsWebim | 8218cb79e74741c31afe73203af462efa7eb9269 | 76541d7ea30187b864cd51dc6b081003ea9b5293 | refs/heads/master | 2020-04-05T16:34:35.977261 | 2018-11-10T21:01:25 | 2018-11-10T21:01:25 | 157,018,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,061 | java | package ru.webim.demo;
import Helpers.Tabs;
import org.junit.Assert;
import org.junit.Test;
import ru.webim.demo.POM.Driver;
import ru.webim.demo.POM.Pages.MainPage;
import ru.webim.demo.POM.Pages.OperatorPage;
import ru.webim.demo.POM.Windows.ChatWindow;
public class AutotestsWebim extends Base {
@Test
public void userLogin() throws InterruptedException {
String VisitorMessage = "Hello world!";
String OperatorMessage = "Hello darling";
String name = "[email protected]";
String password = "password";
String operatorLoginUrl = "https://login.webim.ru/operator";
String operatorWorkplaceUrl = "https://demo.webim.ru/operator/track.php";
Tabs.OpenNewTab();
Tabs.SwitchToSecondTab();
Driver.GetDriver().get(operatorLoginUrl);
OperatorPage.Login(name, password);
Driver.GetDriver().get(operatorWorkplaceUrl);
Tabs.SwitchToFirstTab();
MainPage.ChatOpen();
Assert.assertTrue(MainPage.IsChatOpen());
MainPage.ChatClose();
Assert.assertFalse(MainPage.IsChatOpen());
MainPage.ChatOpen();
ChatWindow.SendMessage(VisitorMessage);
String ActualMessage = ChatWindow.GetUserMessage();
Assert.assertEquals(VisitorMessage, ActualMessage);
ChatWindow.UploadFile();
ChatWindow.WaitDownload();
Assert.assertTrue(ChatWindow.CheckPicture());
Tabs.SwitchToSecondTab();
OperatorPage.VisitorSectionOpen();
OperatorPage.SendOperatorMessage(OperatorMessage);
OperatorPage.WaitMessage();
String ActualOperatorMessage = OperatorPage.GetOperatorMessage();
Assert.assertEquals(OperatorMessage,ActualOperatorMessage);
OperatorPage.WaitDownload();
Assert.assertTrue(OperatorPage.CheckPicture());
Tabs.SwitchToFirstTab();
ChatWindow.WaitOperator();
ChatWindow.RateOperator(5);
Assert.assertTrue(ChatWindow.CheckRating());
}
}
| [
"[email protected]"
] | |
7c8d15cb3f348ef89151d34632c30abf18db39fa | 084b48c094b15a3a9434b80c7145f58f6388cf90 | /org.eclipse.emf.emfstore.client.ui/src/org/eclipse/emf/emfstore/client/ui/epackages/RegisterEPackageHandler.java | 1f78e989d409a9d55b25a6cecd07367d2702d994 | [] | no_license | aumann/emfstore.core | f179021da999c60893754acfab21b7c0b8aa1327 | da7c216c1a8b3c612306b14d3a568750d46690ee | refs/heads/master | 2016-09-06T03:55:13.533823 | 2012-07-27T05:12:07 | 2012-07-27T05:12:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,151 | java | /*******************************************************************************
* Copyright (c) 2008-2012 Chair for Applied Software Engineering,
* Technische Universitaet Muenchen.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
******************************************************************************/
package org.eclipse.emf.emfstore.client.ui.epackages;
import org.eclipse.emf.emfstore.client.model.ServerInfo;
import org.eclipse.emf.emfstore.client.ui.handlers.AbstractEMFStoreHandler;
/**
* RegisterEPackageHandler.
*
* @author Tobias Verhoeven
*/
public class RegisterEPackageHandler extends AbstractEMFStoreHandler {
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.emfstore.client.ui.handlers.AbstractEMFStoreHandler#handle()
*/
@Override
public void handle() {
ServerInfo serverInfo = requireSelection(ServerInfo.class);
new UIRegisterEPackageController(getShell(),serverInfo).execute();
}
}
| [
"[email protected]"
] | |
213bb79ad0b863f8ce574e1445d295ba8ea28125 | 36a80ecec12da8bf43980768a920c28842d2763b | /src/main/java/com/tools20022/repository/entity/SettlementTimeRequest.java | d0921adfae8d86a7dcd51b6f786805082ee06125 | [] | no_license | bukodi/test02 | e9045f6f88d44a5833b1cf32b15a3d7b9a64aa83 | 30990a093e1239b4244c2a64191b6fe1eacf3b00 | refs/heads/master | 2021-05-08T03:22:32.792980 | 2017-10-24T23:00:52 | 2017-10-24T23:00:52 | 108,186,993 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,513 | java | package com.tools20022.repository.entity;
import com.tools20022.metamodel.MMBusinessAssociationEnd;
import com.tools20022.metamodel.MMBusinessAttribute;
import com.tools20022.metamodel.MMBusinessComponent;
import com.tools20022.repository.datatype.ISODateTime;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReference;
/**
* Provides information on the requested settlement time(s) of the payment
* instruction.
*/
public class SettlementTimeRequest {
final static private AtomicReference<MMBusinessComponent> mmObject_lazy = new AtomicReference<>();
/**
* Payment for which settlement times are specified.
*/
public static final MMBusinessAssociationEnd Payment = new MMBusinessAssociationEnd() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "Payment";
definition = "Payment for which settlement times are specified.";
maxOccurs = 1;
minOccurs = 0;
opposite_lazy = () -> com.tools20022.repository.entity.Payment.SettlementTimeRequest;
aggregation = com.tools20022.metamodel.MMAggregation.NONE;
type_lazy = () -> com.tools20022.repository.entity.Payment.mmObject();
}
};
/**
* Time by which the amount of money must be credited, with confirmation, to
* the CLS Bank's account at the central bank.<br>
* Usage: Time must be expressed in Central European Time (CET).
*/
public static final MMBusinessAttribute CLSTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "CLSTime";
definition = "Time by which the amount of money must be credited, with confirmation, to the CLS Bank's account at the central bank.\r\nUsage: Time must be expressed in Central European Time (CET).";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
/**
* Time until when the payment may be settled.
*/
public static final MMBusinessAttribute TillTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "TillTime";
definition = "Time until when the payment may be settled.";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
/**
* Time as from when the payment may be settled.
*/
public static final MMBusinessAttribute FromTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "FromTime";
definition = "Time as from when the payment may be settled.";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
/**
* Time by when the payment must be settled to avoid rejection.
*/
public static final MMBusinessAttribute RejectTime = new MMBusinessAttribute() {
{
isDerived = false;
elementContext_lazy = () -> SettlementTimeRequest.mmObject();
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "RejectTime";
definition = "Time by when the payment must be settled to avoid rejection.";
maxOccurs = 1;
minOccurs = 1;
simpleType_lazy = () -> ISODateTime.mmObject();
}
};
static public MMBusinessComponent mmObject() {
mmObject_lazy.compareAndSet(null, new MMBusinessComponent() {
{
dataDictionary_lazy = () -> com.tools20022.repository.GeneratedRepository.dataDict;
registrationStatus = com.tools20022.metamodel.MMRegistrationStatus.REGISTERED;
name = "SettlementTimeRequest";
definition = "Provides information on the requested settlement time(s) of the payment instruction.";
associationDomain_lazy = () -> Arrays.asList(com.tools20022.repository.entity.Payment.SettlementTimeRequest);
element_lazy = () -> Arrays.asList(com.tools20022.repository.entity.SettlementTimeRequest.Payment, com.tools20022.repository.entity.SettlementTimeRequest.CLSTime,
com.tools20022.repository.entity.SettlementTimeRequest.TillTime, com.tools20022.repository.entity.SettlementTimeRequest.FromTime, com.tools20022.repository.entity.SettlementTimeRequest.RejectTime);
}
});
return mmObject_lazy.get();
}
} | [
"[email protected]"
] | |
f0072f1dd562bb7c494313d558aab84dd149c5ec | 3af8218a7f821c4d63b2e0ae929a29d3761a53a7 | /src/main/java/com/goufaning/bysj/utils/maths/InfiniteSeries.java | 974ca13db462e48bed43b1bc7b80a9f2b31dde42 | [] | no_license | goufaning/bysj | 18bed4729d5be0293fcf103c30ced99248303b14 | 1b54dfe3afa3e69a6938f3bdd5e62c283494ebe0 | refs/heads/master | 2020-03-09T09:06:38.384484 | 2018-06-05T10:07:06 | 2018-06-05T10:07:06 | 128,704,585 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | /*
* InfiniteSeries.java
*
* Created on August 19, 2005, 11:24 AM
*
* author: Stephen A. Smith
*/
package com.goufaning.bysj.utils.maths;
/**
*
* @author stephensmith
*/
public abstract class InfiniteSeries extends IterativeProcess{
/** Creates a new instance of InfiniteSeries */
public InfiniteSeries() {
}
protected abstract void computeTermAt(int n);
public double evaluateIteration(){
computeTermAt(getIterations());
result+=lastTerm;
return relativePrecision(Math.abs(lastTerm), Math.abs(result));
}
public double getResult(){
return result;
}
public void initializeIterations(){
result = initialValue();
}
protected abstract double initialValue();
public void setArgument(double r){
x = r;
return;
}
private double result;
protected double x;
protected double lastTerm;
}
| [
"[email protected]"
] | |
51619e664278958f76b599ce3602900c8a621349 | 386fdd75f3adf70ed42654948f5f40f763e377bf | /desafioSprint5TESTE/src/model/Cliente.java | 05082406b9b210544c2500e5da1a40058f793aed | [] | no_license | DouglasKuhn/Compasso | 6a93ffc28777e90cc47646626fe82e10deb19a14 | b0f0d5a8a88d9375387b868ba9f3e18b5257a5ba | refs/heads/master | 2020-12-10T19:15:31.947393 | 2020-02-10T17:45:20 | 2020-02-10T17:45:20 | 233,683,322 | 0 | 0 | null | 2020-10-13T18:52:18 | 2020-01-13T20:08:54 | Java | ISO-8859-1 | Java | false | false | 1,253 | java | package model;
public class Cliente implements Converter {
private Integer codigo;
private String nome;
private String endereco;
public Integer getCodigo() {
return codigo;
}
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getEndereco() {
return endereco;
}
public void setEndereco(String endereco) {
this.endereco = endereco;
}
@Override
public Object converterLinhaDoArquivo(String linha) {
if (linha == null || linha.length() == 0) {
return null;
}
String[] props = linha.split(DELIMITADOR);
this.setCodigo(Integer.parseInt(props[0]));
this.setNome(props[1]);
this.setEndereco(props[2]);
return this;
}
@Override
public String converterParaLinhaDoArquivo() {
StringBuffer lineStr = new StringBuffer();
lineStr.append(this.getCodigo());
lineStr.append(DELIMITADOR);
lineStr.append(this.getNome());
lineStr.append(DELIMITADOR);
lineStr.append(this.getEndereco());
return lineStr.toString();
}
@Override
public String toString() {
return "Código: " + codigo + "" + "\n" + "Nome: " + nome + "" + "\n" + "Endereço: " + endereco + "" + "\n";
}
}
| [
"[email protected]"
] | |
c061c0a727b5f11ae425192b0079dcc9a18731eb | 74d82ec1ec7455b23e0e5ec7198932e4b14201cf | /src/main/java/cn/edu/hust/utils/RowKeyUtil.java | bc86ecacd32200f1a204acd88ea194bb2fbb415a | [
"Apache-2.0"
] | permissive | oeljeklaus-you/iNote | 39371812d75c6c96224a420d0b66b8ec1d2f4dbf | 2d865c3f71704e4d8c1038976a123f817fc08182 | refs/heads/master | 2020-03-21T03:07:40.940537 | 2018-06-20T13:39:33 | 2018-06-20T13:39:33 | 138,037,471 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 557 | java | package cn.edu.hust.utils;
import cn.edu.hust.utils.constants.Constants;
public class RowKeyUtil {
public static String getRowKeyUserName(String rowKey) {
String[] split = rowKey.split(Constants.ROWKEY_SEPARATOR);
String name = "";
for (int i = 0; i < split.length - 1; i++) {
name = name + split[i] + Constants.ROWKEY_SEPARATOR;
}
return name.substring(0, name.length() - 1);
}
public static String getRowKeyCreateTime(String rowKey) {
String[] split = rowKey.split(Constants.ROWKEY_SEPARATOR);
return split[split.length - 1];
}
}
| [
"[email protected]"
] | |
b53b05c54f147e263d9e5d88594a9f9dd03d18b3 | 05116b1ebda3311f50858630fbfd143d5fcecdf1 | /RestApiAutomation/src/main/java/com/qa/base/TestBase.java | b443614c47fa7795e445daff26279aa235f8cd24 | [] | no_license | charitra-qait/Test1 | 12ca36e4e8c0c13971ef400804503cd1f726f605 | 98f69cbab1c2330a708bd1da2925d61f7de94ed5 | refs/heads/master | 2021-01-20T15:09:49.750315 | 2018-09-25T08:49:48 | 2018-09-25T08:49:48 | 82,798,628 | 0 | 0 | null | 2018-09-25T08:49:50 | 2017-02-22T11:51:28 | HTML | UTF-8 | Java | false | false | 789 | java | package com.qa.base;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
public class TestBase {
public Properties prop;
public int RESPONSE_STATUS_CODE_200 = 200;
public int RESPONSE_STATUS_CODE_201 = 201;
public int RESPONSE_STATUS_CODE_500 = 500;
public int RESPONSE_STATUS_CODE_404 = 404;
public int RESPONSE_STATUS_CODE_401 = 401;
public TestBase() {
try {
prop = new Properties();
FileInputStream ip = new FileInputStream(
System.getProperty("user.dir") + "/src/main/java/com/qa/configuration/config.properties");
prop.load(ip);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| [
"[email protected]"
] | |
8deaabc0e90e7283dda7c89e1647b85f20b65f8e | f22016e5670e437bd7c1338f28aedfe7871580f9 | /axl/src/main/java/ru/cg/cda/axl/generated/ListImeRouteFilterElementRes.java | ca36a3e117126bc706237580ad2c66199c244624 | [] | no_license | ilgiz-badamshin/cda | 4e3c75407a0b2edbb7321b83b66e4cf455157eae | 0a16d90fc9be74932ef3df682013b444d425741e | refs/heads/master | 2020-05-17T05:34:17.707445 | 2015-12-18T13:38:49 | 2015-12-18T13:38:49 | 39,076,024 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,094 | java |
package ru.cg.cda.axl.generated;
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;
/**
* <p>Java class for ListImeRouteFilterElementRes complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="ListImeRouteFilterElementRes">
* <complexContent>
* <extension base="{http://www.cisco.com/AXL/API/10.0}APIResponse">
* <sequence>
* <element name="return">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="imeRouteFilterElement" type="{http://www.cisco.com/AXL/API/10.0}LImeRouteFilterElement" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ListImeRouteFilterElementRes", propOrder = {
"_return"
})
public class ListImeRouteFilterElementRes
extends APIResponse
{
@XmlElement(name = "return", required = true)
protected ListImeRouteFilterElementRes.Return _return;
/**
* Gets the value of the return property.
*
* @return
* possible object is
* {@link ListImeRouteFilterElementRes.Return }
*
*/
public ListImeRouteFilterElementRes.Return getReturn() {
return _return;
}
/**
* Sets the value of the return property.
*
* @param value
* allowed object is
* {@link ListImeRouteFilterElementRes.Return }
*
*/
public void setReturn(ListImeRouteFilterElementRes.Return value) {
this._return = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="imeRouteFilterElement" type="{http://www.cisco.com/AXL/API/10.0}LImeRouteFilterElement" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"imeRouteFilterElement"
})
public static class Return {
protected List<LImeRouteFilterElement> imeRouteFilterElement;
/**
* Gets the value of the imeRouteFilterElement 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 imeRouteFilterElement property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getImeRouteFilterElement().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link LImeRouteFilterElement }
*
*
*/
public List<LImeRouteFilterElement> getImeRouteFilterElement() {
if (imeRouteFilterElement == null) {
imeRouteFilterElement = new ArrayList<LImeRouteFilterElement>();
}
return this.imeRouteFilterElement;
}
}
}
| [
"[email protected]"
] | |
8c906e0ca19167635895bfff482a34b8475accd2 | 9078461df0cc6bb4d8c6cf4613c71a8834bd33a8 | /src/bbcar/persistence/dao/JPAValoracionDAO.java | afa790e8e0abb8b6d6eb36d5e2304b9db82a1f86 | [] | no_license | Etaira/AADD | 8d9553fc89c0aeada528f64bd24b59a06d044e0f | 13cc3929256309f84ce42cc8d3a630c02622d596 | refs/heads/master | 2020-08-22T13:57:28.013950 | 2019-10-25T13:22:24 | 2019-10-25T13:22:24 | 216,397,028 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,433 | java | package bbcar.persistence.dao;
import javax.persistence.EntityManager;
import bbcar.persistence.bean.EntityManagerHelper;
import bbcar.persistence.bean.Reserva;
import bbcar.persistence.bean.Usuario;
import bbcar.persistence.bean.Valoracion;
public class JPAValoracionDAO implements ValoracionDAO {
@Override
public Valoracion createValoracion(String comentario, Integer puntuacion, Integer reserva, Integer usuarioEmisor, Integer usuarioReceptor) {
EntityManager em = EntityManagerHelper.getEntityManager();
em.getTransaction().begin();
Valoracion valoracion = new Valoracion();
valoracion.setComentario(comentario);
valoracion.setPuntuacion(puntuacion);
Reserva res = em.find(Reserva.class, reserva);
Usuario ureceptor = em.find(Usuario.class, usuarioReceptor);
Usuario uemisor = em.find(Usuario.class, usuarioEmisor);
valoracion.setReserva(res);
valoracion.setUsuarioEmisor(uemisor);
valoracion.setUsuarioReceptor(ureceptor);
res.getValoraciones().add(valoracion);
uemisor.getValoracionesEmitidas().add(valoracion);
ureceptor.getValoracionesRecibidas().add(valoracion);
em.persist(valoracion);
em.getTransaction().commit();
em.close();
return valoracion;
}
@Override
public void update(Valoracion v) throws DAOException {
EntityManager em = EntityManagerHelper.getEntityManager();
em.getTransaction().begin();
em.merge(v);
em.getTransaction().commit();
em.close();
}
}
| [
"[email protected]"
] | |
ab9ee8a94d0b6b63cede7c73460eb5660c4a7b0c | c03abda7e9996afacc8dcd9529f1e38b8db9a845 | /Coursera/Princeton/unionAndFind/TestAlgs4.java | 3e53b1131c4767456ae368c482d55b80ae60fcfa | [] | no_license | dufufeisdu/algorithms | 335c4e820bebec4ba14a412017458e084c2fa5b1 | c3619c1253e2432403a77e62b3fbb8566cce4d2e | refs/heads/master | 2021-01-22T06:24:02.235262 | 2019-07-17T00:27:40 | 2019-07-17T00:27:40 | 92,550,641 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,006 | java | import edu.princeton.cs.algs4.StdDraw;
public class TestAlgs4 {
public static void main (String[] args) {
StdDraw.setScale(-1, 1);
StdDraw.clear(StdDraw.BLACK);
StdDraw.setPenColor(StdDraw.WHITE);
StdDraw.square(0, 0, 1);
// write some text
StdDraw.setPenColor(StdDraw.WHITE);
StdDraw.text(0, +0.95, "Hello, world! This is a test Java program.");
StdDraw.text(0, -0.95, "Close this window to finish the installation.");
// draw the bullseye
StdDraw.setPenColor(StdDraw.BOOK_BLUE);
StdDraw.filledCircle(0, 0, 0.9);
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledCircle(0, 0, 0.8);
StdDraw.setPenColor(StdDraw.BOOK_BLUE);
StdDraw.filledCircle(0, 0, 0.7);
StdDraw.setPenColor(StdDraw.BLACK);
StdDraw.filledCircle(0, 0, 0.6);
// draw a picture of the textbook
StdDraw.picture(0, 0, "cover.jpg", 0.65, 0.80);
}
} | [
"[email protected]"
] | |
03be3a719f76680d7fcbb97d9c470136a820a65c | 9dfb07095844525a9d1b5a3e5de3cb840486c12b | /MinecraftServer/src/net/minecraft/network/play/server/SPacketUnloadChunk.java | e31021b2921160d1ff5a66fdc354535fc5051797 | [] | no_license | ilYYYa/ModdedMinecraftServer | 0ae1870e6ba9d388afb8fd6e866ca6a62f96a628 | 7b8143a11f848bf6411917e3d9c60b0289234a3f | refs/heads/master | 2020-12-24T20:10:30.533606 | 2017-04-03T15:32:15 | 2017-04-03T15:32:15 | 86,241,373 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,146 | java | package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class SPacketUnloadChunk implements Packet<INetHandlerPlayClient>
{
private int x;
private int z;
public SPacketUnloadChunk()
{
}
public SPacketUnloadChunk(int xIn, int zIn)
{
this.x = xIn;
this.z = zIn;
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.x = buf.readInt();
this.z = buf.readInt();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeInt(this.x);
buf.writeInt(this.z);
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient handler)
{
handler.processChunkUnload(this);
}
}
| [
"[email protected]"
] | |
c43f76a47de38594be7c3fac3279c7f66e39e743 | d249c4bb104384abc51558b45ebc4b7aca7f9e2b | /src/main/java/com/ib/webapp/jsp/EscapeXml.java | e72a19bdb67630a63c2c64311c660a2b9e9d26db | [] | no_license | siwiwit/appfuse-refresh | e7a347007ac01aa75ad4ff9c76817ac4f9d6b321 | 94f6ae97e5035851a5a66a656edf7a7e879ac573 | refs/heads/master | 2021-01-17T05:21:53.080856 | 2015-02-04T23:45:00 | 2015-02-04T23:45:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,118 | 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 com.ib.webapp.jsp;
/**
* Handles escaping of characters that could be interpreted as XML markup.
* <p>The specification for <code><c:out></code> defines the following
* character conversions to be applied:
* <table rules="all" frame="border">
* <tr><th>Character</th><th>Character Entity Code</th></tr>
* <tr><td><</td><td>&lt;</td></tr>
* <tr><td>></td><td>&gt;</td></tr>
* <tr><td>&</td><td>&amp;</td></tr>
* <tr><td>'</td><td>&#039;</td></tr>
* <tr><td>"</td><td>&#034;</td></tr>
* </table>
*/
public class EscapeXml {
private static final String[] ESCAPES;
static {
int size = '>' + 1; // '>' is the largest escaped value
ESCAPES = new String[size];
ESCAPES['<'] = "<";
ESCAPES['>'] = ">";
ESCAPES['&'] = "&";
ESCAPES['\''] = "'";
ESCAPES['"'] = """;
}
private static String getEscape(char c) {
if (c < ESCAPES.length) {
return ESCAPES[c];
} else {
return null;
}
}
/**
* Escape a string.
*
* @param src
* the string to escape; must not be null
* @return the escaped string
*/
public static String escape(String src) {
// first pass to determine the length of the buffer so we only allocate once
int length = 0;
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
length += escape.length();
} else {
length += 1;
}
}
// skip copy if no escaping is needed
if (length == src.length()) {
return src;
}
// second pass to build the escaped string
StringBuilder buf = new StringBuilder(length);
for (int i = 0; i < src.length(); i++) {
char c = src.charAt(i);
String escape = getEscape(c);
if (escape != null) {
buf.append(escape);
} else {
buf.append(c);
}
}
return buf.toString();
}
}
| [
"[email protected]@016012ff-7e1c-b358-0303-e04b5bdd684d"
] | [email protected]@016012ff-7e1c-b358-0303-e04b5bdd684d |
daa695a104c6e3c5e2a4a381a3ed4da10fbf4dab | beb2fbdd8e5343fe76c998824c7228a546884c5e | /com.kabam.marvelbattle/src/com/google/android/gms/drive/realtime/internal/BeginCompoundOperationRequest.java | 4c3b4df3c852ee12cb129e744d9f07324ce1e82f | [] | no_license | alamom/mcoc_11.2.1_store_apk | 4a988ab22d6c7ad0ca5740866045083ec396841b | b43c41d3e8a43f63863d710dad812774cd14ace0 | refs/heads/master | 2021-01-11T17:13:02.358134 | 2017-01-22T19:51:35 | 2017-01-22T19:51:35 | 79,740,812 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,080 | java | package com.google.android.gms.drive.realtime.internal;
import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.google.android.gms.common.internal.safeparcel.SafeParcelable;
public class BeginCompoundOperationRequest
implements SafeParcelable
{
public static final Parcelable.Creator<BeginCompoundOperationRequest> CREATOR = new a();
final int BR;
final boolean Ri;
final boolean Rj;
final String mName;
BeginCompoundOperationRequest(int paramInt, boolean paramBoolean1, String paramString, boolean paramBoolean2)
{
this.BR = paramInt;
this.Ri = paramBoolean1;
this.mName = paramString;
this.Rj = paramBoolean2;
}
public int describeContents()
{
return 0;
}
public void writeToParcel(Parcel paramParcel, int paramInt)
{
a.a(this, paramParcel, paramInt);
}
}
/* Location: C:\tools\androidhack\com.kabam.marvelbattle\classes.jar!\com\google\android\gms\drive\realtime\internal\BeginCompoundOperationRequest.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"[email protected]"
] | |
9db5d297e0f66fe094db6942cf162783f4a042f5 | 4e223c4d4c89621d28185521703c849fc100fbcc | /src/main/java/com/parkit/parkingsystem/constants/DBConstants.java | cd8ee7e980a2a8bfce7dc800ae78681557b6f79a | [] | no_license | Ludo76190/ParkingSystem | 7e78672f52993f184f3948d66aedd19645de27d4 | 387b636237dbc807a74c0414af05c9e6e81d036b | refs/heads/master | 2023-03-06T07:06:26.618783 | 2021-02-12T21:22:10 | 2021-02-12T21:22:10 | 337,445,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 959 | java | package com.parkit.parkingsystem.constants;
public class DBConstants {
public static final String GET_NEXT_PARKING_SPOT = "select min(PARKING_NUMBER) from parking where AVAILABLE = true and TYPE = ?";
public static final String UPDATE_PARKING_SPOT = "update parking set available = ? where PARKING_NUMBER = ?";
public static final String SAVE_TICKET = "insert into ticket(PARKING_NUMBER, VEHICLE_REG_NUMBER, PRICE, IN_TIME, OUT_TIME) values(?,?,?,?,?)";
public static final String UPDATE_TICKET = "update ticket set PRICE=?, OUT_TIME=? where ID=?";
public static final String GET_TICKET = "select t.PARKING_NUMBER, t.ID, t.PRICE, t.IN_TIME, t.OUT_TIME, p.TYPE from ticket t,parking p where p.parking_number = t.parking_number and t.VEHICLE_REG_NUMBER=? order by t.ID DESC limit 1";
public static final String IS_RECURRENT_USER ="SELECT VEHICLE_REG_NUMBER FROM ticket where VEHICLE_REG_NUMBER=? and OUT_TIME is not null limit 1;";
}
| [
"[email protected]"
] | |
5897dfe94dcc60159cf0ea902b7d7235ae40ef8c | ce691e18f1314f6e279b568c50f40ecd6c60ba0f | /Encryption.java | d2b4b351416bf02dc6d07d2ffe70e9ca73bbadd2 | [] | no_license | nedunurimadhu/Steganography | 296972932ed7e04e9d8c386259726024ff41700b | 5000c04a49a6c269b1f3bde49293acb7f4a14b4b | refs/heads/master | 2022-12-12T07:53:20.616716 | 2020-09-17T07:11:19 | 2020-09-17T07:11:19 | 296,243,769 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,998 | java | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.math.*;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import javax.swing.event.*;
import javax.swing.filechooser.*;
import java.beans.*;
import java.awt.event.ActionListener;
import java.sql.*;
import java.lang.*;
import java.awt.event.ActionEvent;
import java.awt.font.*;
import java.lang.String;
import java.awt.Component;
import java.awt.geom.*;
import javax.swing.text.EditorKit;
import javax.swing.event.MouseInputAdapter;
import java.awt.image.BufferedImage;
import javax.swing.text.*;
import javax.crypto.Cipher;
import java.security.*;
import java.lang.Exception;
import java.io.DataOutputStream;
import java.io.DataInputStream;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Random;
//import javax.crypto.BadPaddingException;
//import javax.crypto.IllegalBlockSizeException;
//import javax.crypto.NoSuchPaddingException;
import java.io.FilterInputStream;
import javax.crypto.*;
//import java.security.AlgorithmParameters;
import java.math.BigInteger;
//import java.security.interfaces.*;
//import java.security.KeyException;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStream;
import java.io.OutputStream;
import javax.crypto.spec.*;
import java.security.spec.*;
import java.applet.*;
import java.net.*;
import java.net.SocketException;
import java.net.BindException;
import java.net.URL;
import javax.swing.Timer;
import javax.swing.TransferHandler;
public class Encryption extends JFrame implements ActionListener,Serializable{
JLabel label1;
JLabel label2;
JLabel label3;
JButton button1;
JButton button2;
JTextField textfield1;
JTextArea textarea2;
JScrollPane sp_textarea2;
JPasswordField passwordfield3;
JButton button3;
JButton button4;
JButton button5;
JButton button6;
JFileChooser filechooser;
File f,tempfilename,Ofilename,Sfilename;
int Copened,Cencrypt,Csave;
InetAddress ipaddress;
String name,Ekey,address;
String chosenFile;
InputStream ins;
OutputStream outs;
Thread t;
public Encryption()
{
EncryptionLayout customLayout = new EncryptionLayout();
getContentPane().setFont(new Font("Helvetica", Font.PLAIN, 12));
getContentPane().setLayout(customLayout);
getContentPane().setBackground(new Color(255,160,122));
label1 = new JLabel("SOURCE");
getContentPane().add(label1);
label1.setFont(new Font("Garamond", Font.BOLD, 16));
label1.setForeground(Color.blue);
label2 = new JLabel("MESSAGE");
getContentPane().add(label2);
label2.setFont(new Font("Garamond", Font.BOLD, 16));
label2.setForeground(Color.blue);
label3 = new JLabel("KEY");
label3.setVisible(false);
getContentPane().add(label3);
label3.setFont(new Font("Garamond", Font.BOLD, 16));
label3.setForeground(Color.blue);
button1 = new JButton("BACK");
getContentPane().add(button1);
button1.addActionListener(this);
button1.setFocusable(true);
button1.setRolloverEnabled(true);
button1.setContentAreaFilled(true);
button1.setBorderPainted(true);
button1.setVerifyInputWhenFocusTarget(true);
button1.setFont(new Font("Garamond", Font.BOLD, 16));
button1.setForeground(Color.black);
button1.setBackground( Color.blue);
button2 = new JButton("NEXT");
getContentPane().add(button2);
button2.setFocusable(true);
button2.setContentAreaFilled(true);
button2.setBorderPainted(true);
button2.setRolloverEnabled(true);
button2.setVerifyInputWhenFocusTarget(true);
button2.addActionListener(this);
button2.setFont(new Font("Garamond", Font.BOLD, 16));
button2.setForeground(Color.black);
button2.setBackground( Color.blue);
textfield1 = new JTextField("");
getContentPane().add(textfield1);
textfield1.setEditable(false);
textfield1.setBackground(Color.white);
textfield1.setToolTipText("Choose the image file to be encrypted");
textarea2 = new JTextArea("");
getContentPane().add(textarea2);
textarea2.setFocusable(true);
GraphicsEnvironment.getLocalGraphicsEnvironment();
textarea2.setAutoscrolls(true);
textarea2.setWrapStyleWord(true);
textarea2.setBackground(Color.white);
textarea2.setToolTipText("Enter the message to be embedded with image");
sp_textarea2 = new JScrollPane(textarea2);
getContentPane().add(sp_textarea2);
passwordfield3 = new JPasswordField("");
getContentPane().add(passwordfield3);
passwordfield3.setVisible(false);
passwordfield3.setToolTipText("Enter a 6 digit KEY");
button3 = new JButton("BROWSE");
getContentPane().add(button3);
button3.addActionListener(this);
button3.setFocusable(true);
button3.setContentAreaFilled(true);
button3.setBorderPainted(true);
button3.setRolloverEnabled(true);
button3.setVerifyInputWhenFocusTarget(true);
button3.setFont(new Font("Garamond", Font.BOLD, 16));
button3.setForeground(Color.black);
button3.setBackground( Color.blue);
button4 = new JButton("CLEAR");
getContentPane().add(button4);
button4.setFocusable(true);
button4.setContentAreaFilled(true);
button4.setBorderPainted(true);
button4.setToolTipText("Clears the Textarea");
button4.setRolloverEnabled(true);
button4.setVerifyInputWhenFocusTarget(true);
button4.addActionListener(this);
button4.setFont(new Font("Garamond", Font.BOLD, 16));
button4.setForeground(Color.black);
button4.setBackground( Color.blue);
button5 = new JButton("SAVE");
getContentPane().add(button5);
button5.setFocusable(true);
button5.setContentAreaFilled(true);
button5.setBorderPainted(true);
button5.setToolTipText("Saves the Encrypted image file");
button5.setRolloverEnabled(true);
button5.setVerifyInputWhenFocusTarget(true);
button5.addActionListener(this);
button5.setFont(new Font("Garamond", Font.BOLD, 16));
button5.setForeground(Color.black);
button5.setBackground( Color.blue);
button6 = new JButton("SEND");
getContentPane().add(button6);
button6.setFocusable(true);
button6.setContentAreaFilled(true);
button6.setBorderPainted(true);
button6.setToolTipText("Sends the Encrypted image file to the remote machine");
button6.setRolloverEnabled(true);
button6.setVerifyInputWhenFocusTarget(true);
button6.addActionListener(this);
button6.setFont(new Font("Garamond", Font.BOLD, 16));
button6.setVisible(false);
button6.setForeground(Color.black);
button6.setBackground( Color.blue);
Copened=0;
Cencrypt=0;
Csave=0;
filechooser=new JFileChooser();
filechooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
setSize(getPreferredSize());
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public static void main(String args[]) {
Encryption en = new Encryption();
en.setTitle("Encryption");
en.show();
en.pack();
JFrame.setDefaultLookAndFeelDecorated(true);
JDialog.setDefaultLookAndFeelDecorated(true);
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
//javax.swing.UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
}
catch (Exception ex)
{
System.out.println("Failed loading L&F: ");
System.out.println(ex);
}
}
public void Imageencrypt(String message,File file,int key) throws java.io.IOException
{
byte b[]=new byte[2];
BigInteger Abi,Mbi;
int k,k1;
DataInputStream ins=new DataInputStream(new FileInputStream(file));
DataOutputStream outs=new DataOutputStream(new FileOutputStream(new File("1.jpg")));
for(int c=0;c<key;c++)
{
int ch=ins.read();
outs.write(ch);
}
int len=message.length();
byte mess[]=new byte[2];
char chmess[]=new char[len+1];
k=k1=0;
for(int i=0;i<=len;i++)
{
message.getChars(0,len,chmess,0);
if(i==0)
{
BigDecimal bd=new BigDecimal(len);
BigInteger Blen=bd.toBigInteger();
String Slen=Blen.toString(2);
char Clen[]=new char[Blen.bitLength()];
Slen.getChars(0,Blen.bitLength(),Clen,0);
for(int j=0;j<=7;j++)
{
if(j==0)
{
for(k=0;k<8-Blen.bitLength();k++)
{
int n=ins.read(b);
Abi=new BigInteger(b);
String Aby=Abi.toString(2);
int Alen=Abi.bitLength();
if(b[0]<0)
Alen++;
char Ach[]=new char[Alen+1];
Aby.getChars(0,Alen,Ach,0);
if(b[0]==0)
{
}
else
{
if(Ach[Alen-1]=='1')
{
if(Alen==Abi.bitLength())
{
BigInteger bi=new BigInteger("1111111111111110",2);
BigInteger big=Abi.and(bi);
b=big.toByteArray();
}
else
{
BigInteger bi=new BigInteger("-1",2);
BigInteger big=Abi.subtract(bi);
b=big.toByteArray();
}
}
outs.write(b);
}
} //for loop k
j=j+k-1;
} // if of j
else
{
int n=ins.read(b);
Abi=new BigInteger(b);
String Aby=Abi.toString(2);
int Alen=Abi.bitLength();
if(b[0]<0)
Alen++;
char Ach[]=new char[Alen+1];
Aby.getChars(0,Alen,Ach,0);
if(b[0]==0)
{
Alen=1;
}
if(Clen[j-k]=='0' && Ach[Alen-1]=='1')
{
if(Alen==Abi.bitLength())
{
BigInteger bi=new BigInteger("1111111111111110",2);
BigInteger big=Abi.and(bi);
b=big.toByteArray();
}
else
{
BigInteger bi=new BigInteger("-1",2);
BigInteger big=Abi.subtract(bi);
b=big.toByteArray();
}
}
else if(Clen[j-k]=='1' && Ach[Alen-1]=='0')
{
if(Alen==Abi.bitLength())
{
BigInteger bi=new BigInteger("1",2);
BigInteger big=Abi.add(bi);
b=big.toByteArray();
}
else
{
BigInteger bi=new BigInteger("-1",2);
BigInteger big=Abi.add(bi);
b=big.toByteArray();
}
}
outs.write(b);
} // end else
} // for loop j
} // end of if
else
{
String slen=String.valueOf(chmess[i-1]);
byte blen[]=slen.getBytes();
BigInteger Blen=new BigInteger(blen);
String Slen=Blen.toString(2);
char Clen[]=new char[Blen.bitLength()];
Slen.getChars(0,Blen.bitLength(),Clen,0);
for(int j=0;j<=7;j++)
{
if(j==0)
{
for(k1=0;k1<8-Blen.bitLength();k1++)
{
int n=ins.read(b);
Abi=new BigInteger(b);
String Aby=Abi.toString(2);
int Alen=Abi.bitLength();
if(b[0]<0)
Alen++;
char Ach[]=new char[Alen+1];
Aby.getChars(0,Alen,Ach,0);
if(b[0]==0)
{
}
else
{
if(Ach[Alen-1]=='1')
{
if(Alen==Abi.bitLength())
{
BigInteger bi=new BigInteger("1111111111111110",2);
BigInteger big=Abi.and(bi);
b=big.toByteArray();
}
else
{
BigInteger bi=new BigInteger("-1",2);
BigInteger big=Abi.subtract(bi);
b=big.toByteArray();
}
}
}
outs.write(b);
} //for loop k
j=j+k1-1;
} // if of j
else
{
int n=ins.read(b);
Abi=new BigInteger(b);
String Aby=Abi.toString(2);
int Alen=Abi.bitLength();
if(b[0]<0)
Alen++;
char Ach[]=new char[Alen+1];
Aby.getChars(0,Alen,Ach,0);
if(b[0]==0)
{
Alen=1;
}
if(Clen[j-k1]=='0' && Ach[Alen-1]=='1')
{
if(Alen==Abi.bitLength())
{
BigInteger bi=new BigInteger("1111111111111110",2);
BigInteger big=Abi.and(bi);
b=big.toByteArray();
}
else
{
BigInteger bi=new BigInteger("-1",2);
BigInteger big=Abi.subtract(bi);
b=big.toByteArray();
}
}
else if(Clen[j-k1]=='1' && Ach[Alen-1]=='0')
{
if(Alen==Abi.bitLength())
{
BigInteger bi=new BigInteger("1",2);
BigInteger big=Abi.add(bi);
b=big.toByteArray();
}
else
{
BigInteger bi=new BigInteger("-1",2);
BigInteger big=Abi.add(bi);
b=big.toByteArray();
}
}
outs.write(b);
} // end else
} // for loop j
} // end of else
} // for loop i
while(true)
{
int i=ins.read();
if(i==-1) break;
outs.write(i);
}
ins.close();
outs.close();
}
public void actionPerformed(ActionEvent e)
{
try
{
String cmd;
cmd=e.getActionCommand();
if(cmd.equals("BACK"))
{
dispose();
Stegno s = new Stegno();
s.show();
s.pack();
s.setTitle("Main Menu - Implementation of Steganography");
}
if(cmd.equals("CLEAR"))
{
textarea2.setText("");
}
if(cmd.equals("SAVE"))
{
if(Copened==1 && Cencrypt==1)
{
int r=filechooser.showSaveDialog(this);
Sfilename=filechooser.getSelectedFile();
FileInputStream in=new FileInputStream("1.jpg");
FileOutputStream out=new FileOutputStream(Sfilename);
Ofilename=Sfilename;
textfield1.setEditable(true);
textfield1.setText(Sfilename.getPath());
textfield1.setEditable(false);
while(true)
{
int i=in.read();
if(i==-1) break;
out.write(i);
}
in.close();
out.close();
JOptionPane.showMessageDialog(null,"\nYour image file has been encrypted and saved successfully\n","message",JOptionPane.INFORMATION_MESSAGE);
}
else
{
String m;
if(Copened==0)
m="File not Opened";
else if(Cencrypt==0)
m="Not Encrypted";
else
m="Not Decrypted";
JOptionPane.showMessageDialog(this,m,"Error",JOptionPane.ERROR_MESSAGE);
}
}
if(cmd.equals("NEXT"))
{
if(Copened==1)
{
Ekey=JOptionPane.showInputDialog("Enter 4 digit Key For Encryption");
//String type
if(Ekey==null)
{
JOptionPane.showMessageDialog(this,"Enter only 4 Digit key","Error",JOptionPane.ERROR_MESSAGE);
}
if(Ekey.trim().length()<4)
{
JOptionPane.showMessageDialog(this,"Enter only 4 Digit key","Error",JOptionPane.ERROR_MESSAGE);
}
if(Ekey.trim().length()>4)
JOptionPane.showMessageDialog(this,"Enter only 4 Digit key","Error",JOptionPane.ERROR_MESSAGE);
else
{
// encrypt the message
int key=Integer.parseInt(Ekey);
Imageencrypt(textarea2.getText(),Ofilename,key);
Cencrypt=1;
}
}
else
{
JOptionPane.showMessageDialog(this,"File NotOpened","Error",JOptionPane.ERROR_MESSAGE);
}
}
if(cmd.equals("BROWSE"))
{
int r=filechooser.showOpenDialog(this);
tempfilename=filechooser.getSelectedFile(); //File type
if(r==JFileChooser.CANCEL_OPTION)
JOptionPane.showMessageDialog(this,"FileNotSelected","Error",JOptionPane.ERROR_MESSAGE);
else
{
String name=tempfilename.getName();
if((!name.endsWith(".jpg")) && !name.endsWith(".gif") && !name.endsWith(".bmp")&& !name.endsWith(".jpeg")&& !name.endsWith(".png"))
JOptionPane.showMessageDialog(this,"Select Only Image file","Error",JOptionPane.ERROR_MESSAGE);
else
{
Copened=1;
Ofilename=tempfilename;
textfield1.setText(name);
textfield1.setText(tempfilename.getPath());
textfield1.setFont(new Font("Century",Font.PLAIN,15));
textfield1.setBackground(Color.LIGHT_GRAY);
textfield1.setEditable(false);
}
}
}
} // end try
catch(Exception xe)
{
//xe.printStackTrace();
JOptionPane.showMessageDialog(this,xe,"Error",JOptionPane.ERROR_MESSAGE);
}
} // end of actionperformed
} // End of class
class EncryptionLayout implements LayoutManager {
public EncryptionLayout() {
}
public void addLayoutComponent(String name, Component comp) {
}
public void removeLayoutComponent(Component comp) {
}
public Dimension preferredLayoutSize(Container parent) {
Dimension dim = new Dimension(0, 0);
Insets insets = parent.getInsets();
dim.width = 2000 + insets.left + insets.right;
dim.height = 1000 + insets.top + insets.bottom;
return dim;
}
public Dimension minimumLayoutSize(Container parent) {
Dimension dim = new Dimension(0, 0);
return dim;
}
public void layoutContainer(Container parent) {
Insets insets = parent.getInsets();
Component c;
c = parent.getComponent(0);
if (c.isVisible()) {c.setBounds(insets.left+360,insets.top+230,112,32);}
c = parent.getComponent(1);
if (c.isVisible()) {c.setBounds(insets.left+360,insets.top+300,112,32);}
c = parent.getComponent(2);
if (c.isVisible()) {c.setBounds(insets.left+88,insets.top+160,112,32);}
c = parent.getComponent(3);//back
if (c.isVisible()) {c.setBounds(insets.left+445,insets.top+500,104,32);}
c = parent.getComponent(4);//next
if (c.isVisible()) {c.setBounds(insets.left+600,insets.top+500,104,32);}
c = parent.getComponent(5);//sourse textarea
if (c.isVisible()) {c.setBounds(insets.left+470,insets.top+230,390,32);}
c = parent.getComponent(6);//message textbox
if (c.isVisible()) {c.setBounds(insets.left+470,insets.top+300,390,150);}
c = parent.getComponent(7);
if (c.isVisible()) {c.setBounds(insets.left+200,insets.top+160,284,52);}
c = parent.getComponent(8);//browse
if (c.isVisible()) {c.setBounds(insets.left+920,insets.top+230,104,32);}
c = parent.getComponent(9);//clear
if (c.isVisible()) {c.setBounds(insets.left+920,insets.top+300,104,32);}
c = parent.getComponent(10);//save
if (c.isVisible()) {c.setBounds(insets.left+755,insets.top+500,104,32);}
c = parent.getComponent(11);
if (c.isVisible()) {c.setBounds(insets.left+559,insets.top+204,114,35);}
}
}
| [
"[email protected]"
] | |
4a11f7f1e39d3ae828da92971028f05e58bbad0a | 270d84ff244d9870e484cd61c630721829616588 | /gmall-api/src/main/java/org/lf/gmall/api/model/PmsBrand.java | fe6af83ba7c2106be903edd62924dc0a064d9f0d | [] | no_license | Jvinhao/gmall | 46fd1ca9df1acd83dbff5e42ec507d3ddfe44441 | 8fe36c5fdca35c56f246c17d95d9041a07802b61 | refs/heads/master | 2022-09-13T13:22:47.396587 | 2019-11-27T14:53:16 | 2019-11-27T14:53:16 | 221,921,626 | 0 | 0 | null | 2022-09-01T23:16:02 | 2019-11-15T12:40:11 | CSS | UTF-8 | Java | false | false | 2,217 | java | package org.lf.gmall.api.model;
import javax.persistence.Id;
import java.io.Serializable;
public class PmsBrand implements Serializable {
@Id
private String id;
private String name;
private String firstLetter;
private int sort;
private int factoryStatus;
private int showStatus;
private int productCount;
private String productCommentCount;
private String logo;
private String bigPic;
private String brandStory;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFirstLetter() {
return firstLetter;
}
public void setFirstLetter(String firstLetter) {
this.firstLetter = firstLetter;
}
public int getSort() {
return sort;
}
public void setSort(int sort) {
this.sort = sort;
}
public int getFactoryStatus() {
return factoryStatus;
}
public void setFactoryStatus(int factoryStatus) {
this.factoryStatus = factoryStatus;
}
public int getShowStatus() {
return showStatus;
}
public void setShowStatus(int showStatus) {
this.showStatus = showStatus;
}
public int getProductCount() {
return productCount;
}
public void setProductCount(int productCount) {
this.productCount = productCount;
}
public String getProductCommentCount() {
return productCommentCount;
}
public void setProductCommentCount(String productCommentCount) {
this.productCommentCount = productCommentCount;
}
public String getLogo() {
return logo;
}
public void setLogo(String logo) {
this.logo = logo;
}
public String getBigPic() {
return bigPic;
}
public void setBigPic(String bigPic) {
this.bigPic = bigPic;
}
public String getBrandStory() {
return brandStory;
}
public void setBrandStory(String brandStory) {
this.brandStory = brandStory;
}
}
| [
"[email protected]"
] | |
fa5e41b3ad680f4ca1cff38102265ccaa70c33f7 | 3ac4ee50b0f871e0da47c9b9aa982c0231aa0470 | /spring-application-core/src/test/java/com/custodio/spring/application/core/service/CsvFileServiceTest.java | 7cff4ab2ac88ce9cc57e5ccdec9a60a7372bdbb4 | [] | no_license | williampedrini/spring-application | 3c8f368d6ebbd2d94be58e3d66f439df6b605c35 | 8b91a7a987e52360ff45f1222181e795c28627cc | refs/heads/master | 2020-05-21T13:09:30.630225 | 2019-05-10T22:47:47 | 2019-05-10T22:47:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,349 | java | package com.custodio.spring.application.core.service;
import com.custodio.spring.application.core.bean.AirportCsvBean;
import com.custodio.spring.application.core.configuration.root.BaseTestRunner;
import org.hamcrest.core.StringContains;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* Class responsible for executing unit tests for {@link CsvFileService}.
*
* @author wcustodio.
*/
public class CsvFileServiceTest extends BaseTestRunner {
/**
* Expected results used by the unit tests.
*/
private static final int EXPECTED_AIRPORTS = 46505;
private static final String EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_MAPPED_HEADER_FIELD = "Unrecognized field \"line_number\"";
private static final String EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_HEADER = "Unrecognized field \"6523\"";
/**
* Files used by the unit tests.
*/
private static final String VALID_FILE = "/csv/valid_file.csv";
private static final String FILE_WITHOUT_HEADER = "/csv/file_without_header.csv";
private static final String FILE_WITHOUT_CONTENT = "/csv/file_without_content.csv";
private static final String FILE_WITHOUT_MAPPED_HEADER_FIELD = "/csv/file_without_mapped_header_field.csv";
@Autowired
private CsvFileService csvFileService;
@Rule
public ExpectedException expected = ExpectedException.none();
@Test
public void readValidFile() {
try {
final List<AirportCsvBean> beans = csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(VALID_FILE).getPath()));
Assert.assertNotNull(beans);
Assert.assertFalse(beans.isEmpty());
Assert.assertEquals(EXPECTED_AIRPORTS, beans.size());
for (final AirportCsvBean bean : beans) {
Assert.assertNotNull(bean.getId());
}
} catch (final IOException ioException) {
Assert.fail(ioException.getMessage());
}
}
@Test
public void readFileWithoutHeader() throws IOException {
expected.expect(IOException.class);
expected.expectMessage(StringContains.containsString(EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_HEADER));
csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(FILE_WITHOUT_HEADER).getPath()));
}
@Test
public void readFileWithoutContent() throws IOException {
try {
final List<AirportCsvBean> beans = csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(FILE_WITHOUT_CONTENT).getPath()));
Assert.assertNotNull(beans);
Assert.assertTrue(beans.isEmpty());
} catch (final IOException ioException) {
Assert.fail(ioException.getMessage());
}
}
@Test
public void readFileWithoutMappedHeaderField() throws IOException {
expected.expect(IOException.class);
expected.expectMessage(StringContains.containsString(EXPECTED_ERROR_MESSAGE_FILE_WITHOUT_MAPPED_HEADER_FIELD));
csvFileService.read(AirportCsvBean.class, new File(this.getClass().getResource(FILE_WITHOUT_MAPPED_HEADER_FIELD).getPath()));
}
} | [
"[email protected]"
] | |
7b7f2d0b83f5b59a82f0c18880996462c706a242 | e8fe1ad1386db55324e86a1ebccc45f565f129a4 | /src/mobi/hsz/idea/gitignore/actions/IgnoreFileGroupAction.java | 4717986a6df03bd11a3960bccac87de6707a49a9 | [
"MIT",
"LicenseRef-scancode-free-unknown"
] | permissive | Deckhandfirststar01/idea-gitignore | 232202f593c64d6df0616a837a876383439cc2a4 | aae29d82fadfe37ac85c681de2d76d6819e8187c | refs/heads/master | 2023-06-26T18:36:37.802008 | 2018-01-30T07:05:22 | 2018-01-30T07:05:22 | 117,659,536 | 0 | 0 | MIT | 2022-09-08T18:59:03 | 2018-01-16T09:01:33 | Java | UTF-8 | Java | false | false | 7,375 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2017 hsz Jakub Chrzanowski <[email protected]>
*
* 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 mobi.hsz.idea.gitignore.actions;
import com.intellij.openapi.actionSystem.ActionGroup;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.ContainerUtil;
import mobi.hsz.idea.gitignore.IgnoreBundle;
import mobi.hsz.idea.gitignore.file.type.IgnoreFileType;
import mobi.hsz.idea.gitignore.lang.IgnoreLanguage;
import mobi.hsz.idea.gitignore.util.CommonDataKeys;
import mobi.hsz.idea.gitignore.util.ExternalFileException;
import mobi.hsz.idea.gitignore.util.Utils;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.PropertyKey;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import static mobi.hsz.idea.gitignore.IgnoreBundle.BUNDLE_NAME;
/**
* Group action that ignores specified file or directory.
* {@link ActionGroup} expands single action into a more child options to allow user specify
* the IgnoreFile that will be used for file's path storage.
*
* @author Jakub Chrzanowski <[email protected]>
* @since 0.5
*/
public class IgnoreFileGroupAction extends ActionGroup {
/** Maximum filename length for the action name. */
private static final int FILENAME_MAX_LENGTH = 30;
/** List of suitable Gitignore {@link VirtualFile}s that can be presented in an IgnoreFile action. */
@NotNull
private final Map<IgnoreFileType, List<VirtualFile>> files = ContainerUtil.newHashMap();
/** Action presentation's text for single element. */
@PropertyKey(resourceBundle = BUNDLE_NAME)
private final String presentationTextSingleKey;
/** {@link Project}'s base directory. */
@Nullable
private VirtualFile baseDir;
/**
* Builds a new instance of {@link IgnoreFileGroupAction}.
* Describes action's presentation.
*/
public IgnoreFileGroupAction() {
this("action.addToIgnore.group", "action.addToIgnore.group.description", "action.addToIgnore.group.noPopup");
}
/**
* Builds a new instance of {@link IgnoreFileGroupAction}.
* Describes action's presentation.
*
* @param textKey Action presentation's text key
* @param descriptionKey Action presentation's description key
*/
public IgnoreFileGroupAction(@PropertyKey(resourceBundle = BUNDLE_NAME) String textKey,
@PropertyKey(resourceBundle = BUNDLE_NAME) String descriptionKey,
@PropertyKey(resourceBundle = BUNDLE_NAME) String textSingleKey) {
final Presentation p = getTemplatePresentation();
p.setText(IgnoreBundle.message(textKey));
p.setDescription(IgnoreBundle.message(descriptionKey));
this.presentationTextSingleKey = textSingleKey;
}
/**
* Presents a list of suitable Gitignore files that can cover currently selected {@link VirtualFile}.
* Shows a subgroup with available files or one option if only one Gitignore file is available.
*
* @param e action event
*/
@Override
public void update(AnActionEvent e) {
final VirtualFile file = e.getData(CommonDataKeys.VIRTUAL_FILE);
final Project project = e.getData(CommonDataKeys.PROJECT);
final Presentation presentation = e.getPresentation();
files.clear();
if (project != null && file != null) {
try {
presentation.setVisible(true);
baseDir = project.getBaseDir();
for (IgnoreLanguage language : IgnoreBundle.LANGUAGES) {
final IgnoreFileType fileType = language.getFileType();
List<VirtualFile> list = Utils.getSuitableIgnoreFiles(project, fileType, file);
Collections.reverse(list);
files.put(fileType, list);
}
} catch (ExternalFileException e1) {
presentation.setVisible(false);
}
}
setPopup(countFiles() > 1);
}
/**
* Creates subactions bound to the specified Gitignore {@link VirtualFile}s using {@link IgnoreFileAction}.
*
* @param e action event
* @return actions list
*/
@NotNull
@Override
public AnAction[] getChildren(@Nullable AnActionEvent e) {
AnAction[] actions;
int count = countFiles();
if (count == 0 || baseDir == null) {
actions = new AnAction[0];
} else {
actions = new AnAction[count];
int i = 0;
for (Map.Entry<IgnoreFileType, List<VirtualFile>> entry : files.entrySet()) {
for (VirtualFile file : entry.getValue()) {
IgnoreFileAction action = createAction(file);
actions[i++] = action;
String name = Utils.getRelativePath(baseDir, file);
if (StringUtil.isNotEmpty(name)) {
name = StringUtil.shortenPathWithEllipsis(name, FILENAME_MAX_LENGTH);
}
if (count == 1) {
name = IgnoreBundle.message(presentationTextSingleKey, name);
}
Presentation presentation = action.getTemplatePresentation();
presentation.setIcon(entry.getKey().getIcon());
presentation.setText(name);
}
}
}
return actions;
}
/**
* Creates new {@link IgnoreFileAction} action instance.
*
* @param file current file
* @return action instance
*/
protected IgnoreFileAction createAction(@NotNull VirtualFile file) {
return new IgnoreFileAction(file);
}
/**
* Counts items in {@link #files} map.
*
* @return files amount
*/
private int countFiles() {
int size = 0;
for (List value : files.values()) {
size += value.size();
}
return size;
}
}
| [
"[email protected]"
] | |
4337e79c3f7a1b639b84428f80283598a4c7c3ee | 01a0c2148e07ad08fb7c4fa7d08c1caddd095e6a | /src/com/tz/act/observer/observe/Observe2.java | 482d4d0aa7963dc3c3e51f9ae7929e17a3464f71 | [] | no_license | tz1992/designModel | 18168c8879c8e640936f4e77c74cbaa33ba5d6f3 | 87f9abe927ef3473af1c5befb8aa41122613996d | refs/heads/master | 2020-03-13T03:23:16.578421 | 2018-05-15T02:15:05 | 2018-05-15T02:15:05 | 130,943,133 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 332 | java | package com.tz.act.observer.observe;
import com.tz.act.observer.observed.Subject;
public class Observe2 extends Observer {
public Observe2(Subject subject) {
this.subject=subject;
subject.attach(this);
}
@Override
public void update() {
System.out.println("观察者2"+this.subject.getState());
}
}
| [
"[email protected]"
] | |
76c03da9e282eeb22af1cc05093eb6fb16d53d77 | 5194d8757a49139f0174a8932125aaffb293ca60 | /org.opentravel/_2014B/opentravel-schema/golf/src/main/java/org/jibx/schema/org/opentravel/_2014B/golf/ws/GolfService.java | bb335ba57038048c220e71e21aec00bb0d0e5393 | [] | no_license | mrshishirr/schema-library | ad18c208cc321c91fef483d1dca36dbd39581b3f | 37e3432665aaa10544c0491dc550c3c5ca293641 | refs/heads/master | 2022-03-31T23:19:13.476699 | 2020-01-27T05:04:54 | 2020-01-27T05:04:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 256 | java | package org.jibx.schema.org.opentravel._2014B.golf.ws;
import org.jibx.schema.org.opentravel._2014B.golf.*;
public interface GolfService {
/**
* Service the xyz request.
* @param request
* @return
*/
// TODO public XyzRS xyz(XyzRQ request);
}
| [
"[email protected]"
] | |
2b9bc2180fba8e7fb12ddb632a28beee5a06acbc | e8f171ddb3c8fb54fcecaff0a84648e76681f982 | /community/logicaldoc/tags/logicaldoc-7.4.3/logicaldoc-webapp/src/main/java/com/logicaldoc/web/service/DocumentServiceImpl.java | 3ea0bf901cae85d99b19d589cd43ffacb1a69cb3 | [] | no_license | zhunengfei/logicaldoc | f12114ef72935e683af4b50f30a88fbd5df9bfde | 9d432d29a9b43ebd2b13a1933a50add3f4784815 | refs/heads/master | 2021-01-20T01:05:48.499693 | 2017-01-13T16:24:16 | 2017-01-13T16:24:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 65,149 | java | package com.logicaldoc.web.service;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.security.AccessControlException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.logicaldoc.core.ExtendedAttribute;
import com.logicaldoc.core.communication.EMail;
import com.logicaldoc.core.communication.EMailAttachment;
import com.logicaldoc.core.communication.EMailSender;
import com.logicaldoc.core.communication.Recipient;
import com.logicaldoc.core.contact.Contact;
import com.logicaldoc.core.contact.ContactDAO;
import com.logicaldoc.core.document.AbstractDocument;
import com.logicaldoc.core.document.Bookmark;
import com.logicaldoc.core.document.Document;
import com.logicaldoc.core.document.DocumentEvent;
import com.logicaldoc.core.document.DocumentLink;
import com.logicaldoc.core.document.DocumentManager;
import com.logicaldoc.core.document.DocumentNote;
import com.logicaldoc.core.document.DocumentTemplate;
import com.logicaldoc.core.document.History;
import com.logicaldoc.core.document.Rating;
import com.logicaldoc.core.document.Version;
import com.logicaldoc.core.document.dao.BookmarkDAO;
import com.logicaldoc.core.document.dao.DocumentDAO;
import com.logicaldoc.core.document.dao.DocumentLinkDAO;
import com.logicaldoc.core.document.dao.DocumentNoteDAO;
import com.logicaldoc.core.document.dao.DocumentTemplateDAO;
import com.logicaldoc.core.document.dao.HistoryDAO;
import com.logicaldoc.core.document.dao.RatingDAO;
import com.logicaldoc.core.document.dao.VersionDAO;
import com.logicaldoc.core.document.pdf.PdfConverterManager;
import com.logicaldoc.core.document.thumbnail.ThumbnailManager;
import com.logicaldoc.core.security.Folder;
import com.logicaldoc.core.security.Permission;
import com.logicaldoc.core.security.User;
import com.logicaldoc.core.security.UserSession;
import com.logicaldoc.core.security.dao.FolderDAO;
import com.logicaldoc.core.security.dao.UserDAO;
import com.logicaldoc.core.store.Storer;
import com.logicaldoc.core.ticket.Ticket;
import com.logicaldoc.core.ticket.TicketDAO;
import com.logicaldoc.core.transfer.InMemoryZipImport;
import com.logicaldoc.core.transfer.ZipExport;
import com.logicaldoc.core.util.IconSelector;
import com.logicaldoc.core.util.UserUtil;
import com.logicaldoc.gui.common.client.ServerException;
import com.logicaldoc.gui.common.client.beans.GUIBookmark;
import com.logicaldoc.gui.common.client.beans.GUIDocument;
import com.logicaldoc.gui.common.client.beans.GUIEmail;
import com.logicaldoc.gui.common.client.beans.GUIExtendedAttribute;
import com.logicaldoc.gui.common.client.beans.GUIFolder;
import com.logicaldoc.gui.common.client.beans.GUIRating;
import com.logicaldoc.gui.common.client.beans.GUIVersion;
import com.logicaldoc.gui.frontend.client.services.DocumentService;
import com.logicaldoc.i18n.I18N;
import com.logicaldoc.util.Context;
import com.logicaldoc.util.LocaleUtil;
import com.logicaldoc.util.MimeType;
import com.logicaldoc.util.crypt.CryptUtil;
import com.logicaldoc.util.io.FileUtil;
import com.logicaldoc.web.UploadServlet;
import com.logicaldoc.web.util.ServiceUtil;
/**
* Implementation of the DocumentService
*
* @author Matteo Caruso - Logical Objects
* @since 6.0
*/
public class DocumentServiceImpl extends RemoteServiceServlet implements DocumentService {
private static final long serialVersionUID = 1L;
private static Logger log = LoggerFactory.getLogger(DocumentServiceImpl.class);
@Override
public void addBookmarks(String sid, long[] ids, int type) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
BookmarkDAO bookmarkDao = (BookmarkDAO) Context.getInstance().getBean(BookmarkDAO.class);
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
int added = 0;
int alreadyAdded = 0;
for (long id : ids) {
try {
Bookmark bookmark = null;
if (bookmarkDao.findByUserIdAndDocId(ServiceUtil.getSessionUser(sid).getId(), id).size() > 0) {
// The bookmark already exists
alreadyAdded++;
} else {
bookmark = new Bookmark();
bookmark.setTenantId(session.getTenantId());
bookmark.setType(type);
bookmark.setTargetId(id);
bookmark.setUserId(ServiceUtil.getSessionUser(sid).getId());
if (type == Bookmark.TYPE_DOCUMENT) {
Document doc = dao.findById(id);
bookmark.setTitle(doc.getTitle());
bookmark.setFileType(doc.getType());
} else {
Folder f = fdao.findById(id);
bookmark.setTitle(f.getName());
}
bookmarkDao.store(bookmark);
added++;
}
} catch (AccessControlException e) {
ServiceUtil.throwServerException(session, log, e);
} catch (Exception e) {
ServiceUtil.throwServerException(session, log, e);
}
}
}
@Override
public void indexDocuments(String sid, Long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (Long id : docIds) {
if (id != null)
try {
documentManager.reindex(id, null);
} catch (Throwable e) {
ServiceUtil.throwServerException(session, log, e);
}
}
}
@Override
public GUIDocument[] addDocuments(String sid, boolean importZip, boolean immediateIndexing,
final GUIDocument metadata) throws ServerException {
final UserSession session = ServiceUtil.validateSession(sid);
List<GUIDocument> createdDocs = new ArrayList<GUIDocument>();
Map<String, File> uploadedFilesMap = UploadServlet.getReceivedFiles(getThreadLocalRequest(), sid);
log.debug("Uploading " + uploadedFilesMap.size() + " files");
Map<String, String> uploadedFileNames = UploadServlet.getReceivedFileNames(getThreadLocalRequest(), sid);
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
FolderDAO folderDao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
final Folder parent = folderDao.findById(metadata.getFolder().getId());
if (uploadedFilesMap.isEmpty())
ServiceUtil.throwServerException(session, log, new Exception("No file uploaded"));
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (!fdao.isWriteEnabled(metadata.getFolder().getId(), session.getUserId()))
ServiceUtil.throwServerException(session, log, new Exception(
"The user doesn't have the write permission on the current folder"));
List<Long> docsToIndex = new ArrayList<Long>();
try {
for (String fileId : uploadedFilesMap.keySet()) {
final File file = uploadedFilesMap.get(fileId);
final String filename = uploadedFileNames.get(fileId);
if (filename.endsWith(".zip") && importZip) {
log.debug("file = " + file);
// copy the file into the user folder
final File destFile = new File(UserUtil.getUserResource(ServiceUtil.getSessionUser(sid).getId(),
"zip"), filename);
FileUtils.copyFile(file, destFile);
final long userId = ServiceUtil.getSessionUser(sid).getId();
final String sessionId = sid;
// Prepare the import thread
Thread zipImporter = new Thread(new Runnable() {
public void run() {
/*
* Prepare the Master document used to create the
* new one
*/
Document doc = toDocument(metadata);
doc.setTenantId(session.getTenantId());
doc.setCreation(new Date());
InMemoryZipImport importer = new InMemoryZipImport(doc);
importer.process(destFile, parent, userId, sessionId);
try {
FileUtils.forceDelete(destFile);
} catch (IOException e) {
log.error("Unable to delete " + destFile, e);
}
}
});
// And launch it
zipImporter.start();
} else {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.STORED.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(metadata.getComment());
/*
* Prepare the Master document used to create the new one
*/
Document doc = toDocument(metadata);
doc.setTenantId(session.getTenantId());
doc.setCreation(new Date());
doc.setFileName(filename);
doc.setTitle(FilenameUtils.getBaseName(filename));
// Create the new document
doc = documentManager.create(file, doc, transaction);
if (immediateIndexing && doc.getIndexed() == Document.INDEX_TO_INDEX)
docsToIndex.add(doc.getId());
createdDocs.add(fromDocument(doc, metadata.getFolder()));
}
}
UploadServlet.cleanReceivedFiles(getThreadLocalRequest().getSession());
if (!docsToIndex.isEmpty())
indexDocuments(sid, docsToIndex.toArray(new Long[0]));
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
return createdDocs.toArray(new GUIDocument[0]);
}
@Override
public GUIDocument[] addDocuments(String sid, String language, long folderId, boolean importZip,
boolean immediateIndexing, final Long templateId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (folderId == fdao.findRoot(session.getTenantId()).getId())
throw new RuntimeException("Cannot add documents in the root");
GUIDocument metadata = new GUIDocument();
metadata.setLanguage(language);
metadata.setFolder(new GUIFolder(folderId));
metadata.setTemplateId(templateId);
return addDocuments(sid, importZip, immediateIndexing, metadata);
}
@Override
public GUIDocument checkin(String sid, GUIDocument document, boolean major) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
Map<String, File> uploadedFilesMap = UploadServlet.getReceivedFiles(getThreadLocalRequest(), sid);
File file = uploadedFilesMap.values().iterator().next();
if (file != null) {
// check that we have a valid file for storing as new version
Map<String, String> uploadedFileNames = UploadServlet.getReceivedFileNames(getThreadLocalRequest(), sid);
String fileName = uploadedFileNames.values().iterator().next();
log.debug("Checking in file " + fileName);
try {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.CHECKEDIN.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(document.getComment());
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Document doc = dao.findById(document.getId());
if (doc.getDocRef() != null)
doc = dao.findById(doc.getDocRef().longValue());
// checkin the document; throws an exception if
// something goes wrong
DocumentManager documentManager = (DocumentManager) Context.getInstance()
.getBean(DocumentManager.class);
documentManager.checkin(doc.getId(), new FileInputStream(file), fileName, major, toDocument(document),
transaction);
UploadServlet.cleanReceivedFiles(getThreadLocalRequest().getSession());
return getById(sid, doc.getId());
} catch (Throwable t) {
return (GUIDocument) ServiceUtil.throwServerException(session, log, t);
}
} else
return null;
}
@Override
public void checkout(String sid, long docId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.CHECKEDOUT.toString());
transaction.setComment("");
transaction.setUser(ServiceUtil.getSessionUser(sid));
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Document doc = dao.findById(docId);
if (doc.getDocRef() != null)
docId = doc.getDocRef().longValue();
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
try {
documentManager.checkout(docId, transaction);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void delete(String sid, long[] ids) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
if (ids.length > 0) {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long id : ids) {
try {
Document doc = dao.findById(id);
if (doc == null)
continue;
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.DELETED.toString());
transaction.setComment("");
transaction.setUser(ServiceUtil.getSessionUser(sid));
// If it is a shortcut, we delete only the shortcut
if (doc.getDocRef() != null) {
transaction.setEvent(DocumentEvent.SHORTCUT_DELETED.toString());
dao.delete(doc.getId(), transaction);
continue;
}
// The document of the selected documentRecord must be
// not immutable
if (doc.getImmutable() == 1 && !transaction.getUser().isInGroup("admin")) {
log.debug("Document " + id + " was not deleted because immutable");
continue;
}
// The document must be not locked
if (doc.getStatus() == Document.DOC_LOCKED) {
log.debug("Document " + id + " was not deleted because locked");
continue;
}
// Check if there are some shortcuts associated to the
// deleting document. All the shortcuts must be deleted.
if (dao.findAliasIds(doc.getId()).size() > 0)
for (Long shortcutId : dao.findAliasIds(doc.getId())) {
dao.delete(shortcutId);
}
dao.delete(doc.getId(), transaction);
} catch (Throwable t) {
t.printStackTrace();
ServiceUtil.throwServerException(session, log, t);
}
}
}
}
@Override
public void deleteBookmarks(String sid, long[] bookmarkIds) throws ServerException {
ServiceUtil.validateSession(sid);
BookmarkDAO dao = (BookmarkDAO) Context.getInstance().getBean(BookmarkDAO.class);
for (long id : bookmarkIds) {
dao.delete(id);
}
}
@Override
public void deleteLinks(String sid, long[] ids) throws ServerException {
ServiceUtil.validateSession(sid);
DocumentLinkDAO dao = (DocumentLinkDAO) Context.getInstance().getBean(DocumentLinkDAO.class);
for (long id : ids) {
dao.delete(id);
}
}
@Override
public GUIExtendedAttribute[] getAttributes(String sid, long templateId) throws ServerException {
ServiceUtil.validateSession(sid);
DocumentTemplateDAO templateDao = (DocumentTemplateDAO) Context.getInstance()
.getBean(DocumentTemplateDAO.class);
DocumentTemplate template = templateDao.findById(templateId);
GUIExtendedAttribute[] attributes = prepareGUIAttributes(template, null);
return attributes;
}
private static GUIExtendedAttribute[] prepareGUIAttributes(DocumentTemplate template, Document doc) {
try {
if (template != null) {
GUIExtendedAttribute[] attributes = new GUIExtendedAttribute[template.getAttributeNames().size()];
int i = 0;
for (String attrName : template.getAttributeNames()) {
ExtendedAttribute extAttr = template.getAttributes().get(attrName);
GUIExtendedAttribute att = new GUIExtendedAttribute();
att.setName(attrName);
att.setPosition(extAttr.getPosition());
att.setLabel(extAttr.getLabel());
att.setMandatory(extAttr.getMandatory() == 1);
att.setEditor(extAttr.getEditor());
att.setStringValue(extAttr.getStringValue());
att.setOptions(new String[] { extAttr.getStringValue() });
if (doc != null) {
if (doc.getValue(attrName) != null)
att.setValue(doc.getValue(attrName));
} else
att.setValue(extAttr.getValue());
att.setType(extAttr.getType());
attributes[i] = att;
i++;
}
return attributes;
} else {
List<GUIExtendedAttribute> list = new ArrayList<GUIExtendedAttribute>();
for (String name : doc.getAttributeNames()) {
ExtendedAttribute e = doc.getAttributes().get(name);
GUIExtendedAttribute ext = new GUIExtendedAttribute();
ext.setName(name);
ext.setDateValue(e.getDateValue());
ext.setStringValue(e.getStringValue());
ext.setIntValue(e.getIntValue());
ext.setDoubleValue(e.getDoubleValue());
ext.setBooleanValue(e.getBooleanValue());
ext.setType(e.getType());
list.add(ext);
}
return list.toArray(new GUIExtendedAttribute[0]);
}
} catch (Throwable t) {
log.error(t.getMessage(), t);
return null;
}
}
@Override
public GUIDocument getById(String sid, long docId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Document doc = docDao.findById(docId);
GUIDocument document = null;
GUIFolder folder = null;
if (doc != null) {
folder = FolderServiceImpl.getFolder(sid, doc.getFolder().getId());
Long aliasId = null;
// Check if it is an alias
if (doc.getDocRef() != null) {
long id = doc.getDocRef();
doc = docDao.findById(id);
aliasId = docId;
}
try {
User user = ServiceUtil.getSessionUser(sid);
checkPublished(user, doc);
docDao.initialize(doc);
document = fromDocument(doc, folder);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
document.setPathExtended(fdao.computePathExtended(folder.getId()));
if (aliasId != null)
document.setDocRef(aliasId);
Set<Permission> permissions = fdao.getEnabledPermissions(doc.getFolder().getId(), session.getUserId());
List<String> permissionsList = new ArrayList<String>();
for (Permission permission : permissions)
permissionsList.add(permission.toString());
folder.setPermissions(permissionsList.toArray(new String[permissionsList.size()]));
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
return document;
}
public static GUIDocument fromDocument(Document doc, GUIFolder folder) {
GUIDocument document = new GUIDocument();
document.setId(doc.getId());
if (doc.getDocRef() != null && doc.getDocRef().longValue() != 0) {
document.setDocRef(doc.getDocRef());
document.setDocRefType(doc.getDocRefType());
}
document.setTitle(doc.getTitle());
document.setCustomId(doc.getCustomId());
if (doc.getTags().size() > 0)
document.setTags(doc.getTagsAsWords().toArray(new String[doc.getTags().size()]));
else
document.setTags(new String[0]);
document.setType(doc.getType());
document.setFileName(doc.getFileName());
document.setVersion(doc.getVersion());
document.setCreation(doc.getCreation());
document.setCreator(doc.getCreator());
document.setDate(doc.getDate());
document.setPublisher(doc.getPublisher());
document.setFileVersion(doc.getFileVersion());
document.setLanguage(doc.getLanguage());
document.setSource(doc.getSource());
document.setRecipient(doc.getRecipient());
document.setTemplateId(doc.getTemplateId());
document.setSourceType(doc.getSourceType());
document.setObject(doc.getObject());
document.setCoverage(doc.getCoverage());
document.setSourceAuthor(doc.getSourceAuthor());
document.setSourceDate(doc.getSourceDate());
document.setSourceId(doc.getSourceId());
document.setLastModified(doc.getLastModified());
document.setLockUserId(doc.getLockUserId());
document.setLockUser(doc.getLockUser());
document.setComment(doc.getComment());
document.setStatus(doc.getStatus());
document.setWorkflowStatus(doc.getWorkflowStatus());
document.setImmutable(doc.getImmutable());
document.setFileSize(new Long(doc.getFileSize()).floatValue());
document.setStartPublishing(doc.getStartPublishing());
document.setStopPublishing(doc.getStopPublishing());
document.setPublished(doc.getPublished());
document.setSigned(doc.getSigned());
document.setStamped(doc.getStamped());
document.setBarcoded(doc.getBarcoded());
document.setIndexed(doc.getIndexed());
document.setExtResId(doc.getExtResId());
document.setPages(doc.getPages());
document.setNature(doc.getNature());
document.setFormId(doc.getFormId());
document.setIcon(FilenameUtils.getBaseName(IconSelector.selectIcon(FilenameUtils.getExtension(document
.getFileName()))));
if (doc.getRating() != null)
document.setRating(doc.getRating());
if (doc.getCustomId() != null)
document.setCustomId(doc.getCustomId());
else
document.setCustomId("");
if (doc.getTemplate() != null) {
document.setTemplate(doc.getTemplate().getName());
document.setTemplateId(doc.getTemplate().getId());
}
if (doc.getAttributes() != null && !doc.getAttributes().isEmpty()) {
GUIExtendedAttribute[] attributes = prepareGUIAttributes(doc.getTemplate(), doc);
document.setAttributes(attributes);
}
if (folder != null) {
document.setFolder(folder);
} else {
GUIFolder f = new GUIFolder(doc.getFolder().getId());
f.setName(doc.getFolder().getName());
document.setFolder(f);
}
return document;
}
@Override
public GUIVersion[] getVersionsById(String sid, long id1, long id2) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
VersionDAO versDao = (VersionDAO) Context.getInstance().getBean(VersionDAO.class);
Version docVersion = versDao.findById(id1);
versDao.initialize(docVersion);
GUIVersion version1 = null;
if (docVersion != null) {
version1 = new GUIVersion();
version1.setDocId(docVersion.getDocId());
version1.setUsername(docVersion.getUsername());
version1.setComment(docVersion.getComment());
version1.setId(id1);
version1.setTitle(docVersion.getTitle());
version1.setCustomId(docVersion.getCustomId());
version1.setTagsString(docVersion.getTgs());
version1.setType(docVersion.getType());
version1.setFileName(docVersion.getFileName());
version1.setVersion(docVersion.getVersion());
version1.setCreation(docVersion.getCreation());
version1.setCreator(docVersion.getCreator());
version1.setDate(docVersion.getDate());
version1.setPublisher(docVersion.getPublisher());
version1.setFileVersion(docVersion.getFileVersion());
version1.setLanguage(docVersion.getLanguage());
version1.setTemplateId(docVersion.getTemplateId());
version1.setFileSize(new Float(docVersion.getFileSize()));
version1.setSource(docVersion.getSource());
version1.setCoverage(docVersion.getCoverage());
version1.setRecipient(docVersion.getRecipient());
version1.setObject(docVersion.getObject());
version1.setWorkflowStatus(docVersion.getWorkflowStatus());
if (docVersion.getRating() != null)
version1.setRating(docVersion.getRating());
version1.setSourceType(docVersion.getSourceType());
version1.setSourceAuthor(docVersion.getSourceAuthor());
version1.setSourceId(docVersion.getSourceId());
version1.setSourceDate(docVersion.getSourceDate());
version1.setStartPublishing(docVersion.getStartPublishing());
version1.setStopPublishing(docVersion.getStopPublishing());
version1.setPublished(docVersion.getPublished());
version1.setPages(docVersion.getPages());
version1.setTemplate(docVersion.getTemplateName());
versDao.initialize(docVersion);
for (String attrName : docVersion.getAttributeNames()) {
ExtendedAttribute extAttr = docVersion.getAttributes().get(attrName);
version1.setValue(attrName, extAttr.getValue());
}
GUIFolder folder1 = new GUIFolder();
folder1.setName(docVersion.getFolderName());
folder1.setId(docVersion.getFolderId());
version1.setFolder(folder1);
}
docVersion = versDao.findById(id2);
versDao.initialize(docVersion);
GUIVersion version2 = null;
if (docVersion != null) {
version2 = new GUIVersion();
version2.setDocId(docVersion.getDocId());
version2.setUsername(docVersion.getUsername());
version2.setComment(docVersion.getComment());
version2.setId(id1);
version2.setTitle(docVersion.getTitle());
version2.setCustomId(docVersion.getCustomId());
version2.setTagsString(docVersion.getTgs());
version2.setType(docVersion.getType());
version2.setFileName(docVersion.getFileName());
version2.setVersion(docVersion.getVersion());
version2.setCreation(docVersion.getCreation());
version2.setCreator(docVersion.getCreator());
version2.setDate(docVersion.getDate());
version2.setPublisher(docVersion.getPublisher());
version2.setFileVersion(docVersion.getFileVersion());
version2.setLanguage(docVersion.getLanguage());
version2.setFileSize(new Float(docVersion.getFileSize()));
version2.setSource(docVersion.getSource());
version2.setCoverage(docVersion.getCoverage());
version2.setRecipient(docVersion.getRecipient());
version2.setObject(docVersion.getObject());
if (docVersion.getRating() != null)
version2.setRating(docVersion.getRating());
version2.setSourceType(docVersion.getSourceType());
version2.setSourceAuthor(docVersion.getSourceAuthor());
version2.setSourceId(docVersion.getSourceId());
version2.setSourceDate(docVersion.getSourceDate());
version2.setWorkflowStatus(docVersion.getWorkflowStatus());
version2.setStartPublishing(docVersion.getStartPublishing());
version2.setStopPublishing(docVersion.getStopPublishing());
version2.setPublished(docVersion.getPublished());
version2.setPages(docVersion.getPages());
version2.setTemplateId(docVersion.getTemplateId());
version2.setTemplate(docVersion.getTemplateName());
versDao.initialize(docVersion);
for (String attrName : docVersion.getAttributeNames()) {
ExtendedAttribute extAttr = docVersion.getAttributes().get(attrName);
version2.setValue(attrName, extAttr.getValue());
}
GUIFolder folder2 = new GUIFolder();
folder2.setName(docVersion.getFolderName());
folder2.setId(docVersion.getFolderId());
version2.setFolder(folder2);
}
GUIVersion[] versions = null;
if (version1 != null && version2 != null) {
versions = new GUIVersion[2];
versions[0] = version1;
versions[1] = version2;
} else if (version1 != null && version2 == null) {
versions = new GUIVersion[1];
versions[0] = version1;
} else if (version1 == null && version2 != null) {
versions = new GUIVersion[1];
versions[0] = version2;
} else
return null;
return versions;
} catch (Throwable t) {
log.error("Exception linking documents: " + t.getMessage(), t);
return (GUIVersion[]) ServiceUtil.throwServerException(session, null, t);
}
}
@Override
public void linkDocuments(String sid, long[] inDocIds, long[] outDocIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentLinkDAO linkDao = (DocumentLinkDAO) Context.getInstance().getBean(DocumentLinkDAO.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
if (outDocIds.length > 0) {
try {
for (int i = 0; i < inDocIds.length; i++) {
for (int j = 0; j < outDocIds.length; j++) {
DocumentLink link = linkDao.findByDocIdsAndType(inDocIds[i], outDocIds[j], "default");
if (link == null) {
// The link doesn't exist and must be created
link = new DocumentLink();
link.setTenantId(session.getTenantId());
link.setDocument1(docDao.findById(inDocIds[i]));
link.setDocument2(docDao.findById(outDocIds[j]));
link.setType("default");
linkDao.store(link);
}
}
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
}
@Override
public void lock(String sid, long[] docIds, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
// Unlock the document; throws an exception if something
// goes wrong
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
try {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.LOCKED.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(comment);
for (long id : docIds) {
documentManager.lock(id, Document.DOC_LOCKED, transaction);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void makeImmutable(String sid, long[] docIds, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (long id : docIds) {
Document doc = docDao.findById(id);
if (doc.getImmutable() == 0) {
// The document of the selected documentRecord must be
// not locked
if (doc.getStatus() != Document.DOC_UNLOCKED) {
continue;
}
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setComment(comment);
transaction.setUser(ServiceUtil.getSessionUser(sid));
manager.makeImmutable(id, transaction);
}
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void markHistoryAsRead(String sid, String event) throws ServerException {
ServiceUtil.validateSession(sid);
HistoryDAO dao = (HistoryDAO) Context.getInstance().getBean(HistoryDAO.class);
for (History history : dao.findByUserIdAndEvent(ServiceUtil.getSessionUser(sid).getId(), event, null)) {
dao.initialize(history);
history.setNew(0);
dao.store(history);
}
}
@Override
public void markIndexable(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long id : docIds) {
manager.changeIndexingStatus(docDao.findById(id), AbstractDocument.INDEX_TO_INDEX);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void markUnindexable(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long id : docIds) {
manager.changeIndexingStatus(docDao.findById(id), AbstractDocument.INDEX_SKIP);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void restore(String sid, long[] docIds, long folderId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
for (long docId : docIds) {
History transaction = new History();
transaction.setUser(ServiceUtil.getSessionUser(session.getId()));
transaction.setSessionId(session.getId());
docDao.restore(docId, folderId, transaction);
}
}
@Override
public GUIDocument save(String sid, GUIDocument document) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
if (document.getId() != 0) {
Document doc = docDao.findById(document.getId());
docDao.initialize(doc);
doc.setCustomId(document.getCustomId());
doc.setComment(document.getComment());
try {
Document docVO = toDocument(document);
docVO.setBarcoded(doc.getBarcoded());
docVO.setTenantId(session.getTenantId());
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.CHANGED.toString());
transaction.setComment(document.getComment());
transaction.setUser(ServiceUtil.getSessionUser(sid));
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(
DocumentManager.class);
documentManager.update(doc, docVO, transaction);
return getById(sid, doc.getId());
} catch (Throwable t) {
log.error(t.getMessage(), t);
throw new RuntimeException(t.getMessage(), t);
}
} else
return null;
} catch (Throwable t) {
return (GUIDocument) ServiceUtil.throwServerException(session, log, t);
}
}
/**
* Produces a plain new Document from a GUIDocument
*/
protected Document toDocument(GUIDocument document) {
Document docVO = new Document();
if (document.getTags() != null && document.getTags().length > 0)
docVO.setTagsFromWords(new HashSet<String>(Arrays.asList(document.getTags())));
docVO.setTitle(document.getTitle());
docVO.setCustomId(document.getCustomId());
docVO.setSourceType(document.getSourceType());
docVO.setFileName(document.getFileName());
docVO.setVersion(document.getVersion());
docVO.setCreation(document.getCreation());
docVO.setCreator(document.getCreator());
docVO.setDate(document.getDate());
docVO.setPublisher(document.getPublisher());
docVO.setFileVersion(document.getFileVersion());
docVO.setLanguage(document.getLanguage());
if (document.getFileSize() != null)
docVO.setFileSize(document.getFileSize().longValue());
docVO.setSource(document.getSource());
docVO.setRecipient(document.getRecipient());
docVO.setObject(document.getObject());
docVO.setCoverage(document.getCoverage());
docVO.setSourceAuthor(document.getSourceAuthor());
docVO.setSourceDate(document.getSourceDate());
docVO.setSourceId(document.getSourceId());
docVO.setRating(document.getRating());
docVO.setComment(document.getComment());
docVO.setWorkflowStatus(document.getWorkflowStatus());
docVO.setStartPublishing(document.getStartPublishing());
docVO.setStopPublishing(document.getStopPublishing());
docVO.setPublished(document.getPublished());
docVO.setBarcoded(document.getBarcoded());
docVO.setExtResId(document.getExtResId());
docVO.setPages(document.getPages());
docVO.setNature(document.getNature());
docVO.setFormId(document.getFormId());
if (document.getTemplateId() != null) {
docVO.setTemplateId(document.getTemplateId());
DocumentTemplateDAO templateDao = (DocumentTemplateDAO) Context.getInstance().getBean(
DocumentTemplateDAO.class);
DocumentTemplate template = templateDao.findById(document.getTemplateId());
docVO.setTemplate(template);
if (document.getAttributes().length > 0) {
for (GUIExtendedAttribute attr : document.getAttributes()) {
ExtendedAttribute templateAttribute = template.getAttributes().get(attr.getName());
// This control is necessary because, changing
// the template, the values of the old template
// attributes keys remains on the form value
// manager,
// so the GUIDocument contains also the old
// template attributes keys that must be
// skipped.
if (templateAttribute == null)
continue;
ExtendedAttribute extAttr = new ExtendedAttribute();
int templateType = templateAttribute.getType();
int extAttrType = attr.getType();
if (templateType != extAttrType) {
// This check is useful to avoid errors
// related to the old template
// attributes keys that remains on the form
// value manager
if (attr.getValue().toString().trim().isEmpty() && templateType != 0) {
if (templateType == ExtendedAttribute.TYPE_INT
|| templateType == ExtendedAttribute.TYPE_BOOLEAN) {
extAttr.setIntValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DOUBLE) {
extAttr.setDoubleValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DATE) {
extAttr.setDateValue(null);
}
} else if (templateType == GUIExtendedAttribute.TYPE_DOUBLE) {
extAttr.setValue(Double.parseDouble(attr.getValue().toString()));
} else if (templateType == GUIExtendedAttribute.TYPE_INT) {
extAttr.setValue(Long.parseLong(attr.getValue().toString()));
} else if (templateType == GUIExtendedAttribute.TYPE_BOOLEAN) {
extAttr.setValue(attr.getBooleanValue());
extAttr.setType(ExtendedAttribute.TYPE_BOOLEAN);
} else if (templateType == GUIExtendedAttribute.TYPE_USER) {
extAttr.setIntValue(attr.getIntValue());
extAttr.setStringValue(attr.getStringValue());
extAttr.setType(templateType);
}
} else {
if (templateType == ExtendedAttribute.TYPE_INT) {
if (attr.getValue() != null)
extAttr.setIntValue((Long) attr.getValue());
else
extAttr.setIntValue(null);
} else if (templateType == ExtendedAttribute.TYPE_BOOLEAN) {
if (attr.getBooleanValue() != null)
extAttr.setValue(attr.getBooleanValue());
else
extAttr.setBooleanValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DOUBLE) {
if (attr.getValue() != null)
extAttr.setDoubleValue((Double) attr.getValue());
else
extAttr.setDoubleValue(null);
} else if (templateType == ExtendedAttribute.TYPE_DATE) {
if (attr.getValue() != null)
extAttr.setDateValue((Date) attr.getValue());
else
extAttr.setDateValue(null);
} else if (templateType == ExtendedAttribute.TYPE_STRING) {
if (attr.getValue() != null)
extAttr.setStringValue((String) attr.getValue());
else
extAttr.setStringValue(null);
} else if (templateType == ExtendedAttribute.TYPE_USER) {
if (attr.getValue() != null) {
extAttr.setIntValue(attr.getIntValue());
extAttr.setStringValue(attr.getStringValue());
} else {
extAttr.setIntValue(null);
extAttr.setStringValue(null);
}
extAttr.setType(templateType);
}
}
extAttr.setLabel(attr.getLabel());
extAttr.setType(templateType);
extAttr.setPosition(attr.getPosition());
extAttr.setMandatory(attr.isMandatory() ? 1 : 0);
docVO.getAttributes().put(attr.getName(), extAttr);
}
}
}
docVO.setStatus(document.getStatus());
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (document.getFolder() != null)
docVO.setFolder(fdao.findById(document.getFolder().getId()));
return docVO;
}
@Override
public String sendAsEmail(String sid, GUIEmail email, String locale) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
UserDAO userDao = (UserDAO) Context.getInstance().getBean(UserDAO.class);
DocumentDAO documentDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
User user = userDao.findById(session.getUserId());
EMail mail;
try {
mail = new EMail();
mail.setHtml(1);
mail.setTenantId(session.getTenantId());
mail.setAccountId(-1);
mail.setAuthor(user.getUserName());
mail.setAuthorAddress(user.getEmail());
if (StringUtils.isNotEmpty(email.getRecipients()))
mail.parseRecipients(email.getRecipients());
if (StringUtils.isNotEmpty(email.getCc()))
mail.parseRecipientsCC(email.getCc());
mail.setFolder("outbox");
String message = email.getMessage();
mail.setSentDate(new Date());
mail.setSubject(email.getSubject());
mail.setUserName(user.getUserName());
// Needed in case the zip compression was requested by the user
File zipFile = null;
if (email.isSendAsTicket()) {
// Prepare a new download ticket
Ticket ticket = prepareTicket(email.getDocIds()[0], user);
History transaction = new History();
transaction.setSessionId(session.getId());
transaction.setUser(user);
storeTicket(ticket, transaction);
Document doc = documentDao.findById(ticket.getDocId());
String ticketUrl = composeTicketUrl(ticket);
message = email.getMessage()
+ "<div style='margin-top:10px; border-top:1px solid black; background-color:#CCCCCC;'><b> "
+ I18N.message("clicktodownload", LocaleUtil.toLocale(locale)) + ": <a href='" + ticketUrl
+ "'>" + doc.getFileName() + "</a></b></div>";
if (doc.getDocRef() != null)
doc = documentDao.findById(doc.getDocRef());
String thumb = createPreview(doc, user.getId(), sid);
if (thumb != null) {
mail.getImages().add(thumb);
message += "<p><img src='cid:image_1'/></p>";
}
mail.setMessageText("<html><body>" + message + "</body></html>");
} else {
if (email.isZipCompression()) {
/*
* Create a temporary archive for sending it as unique
* attachment
*/
zipFile = File.createTempFile("email", "zip");
OutputStream out = null;
try {
out = new FileOutputStream(zipFile);
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setEvent(DocumentEvent.DOWNLOADED.toString());
transaction.setUser(ServiceUtil.getSessionUser(sid));
ZipExport export = new ZipExport();
export.process(email.getDocIds(), out, email.isPdfConversion(), transaction);
createAttachment(mail, zipFile);
} catch (Throwable t) {
log.error(t.getMessage(), t);
try {
if (out != null)
out.close();
} catch (Throwable q) {
}
}
} else {
for (long id : email.getDocIds())
createAttachment(mail, id, email.isPdfConversion(), sid);
}
}
try {
message = "<html><body>" + message + "</body></html>";
// message =
// "<html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\"></head><body>"
// + message + "</body></html>";
mail.setMessageText(message);
// Send the message
EMailSender sender = new EMailSender(session.getTenantName());
sender.send(mail);
if (zipFile != null)
FileUtils.forceDelete(zipFile);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
FolderDAO fDao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
for (long id : email.getDocIds()) {
Document doc = docDao.findById(id);
if (doc.getDocRef() != null)
doc = documentDao.findById(doc.getDocRef());
// Create the document history event
HistoryDAO dao = (HistoryDAO) Context.getInstance().getBean(HistoryDAO.class);
History history = new History();
history.setSessionId(sid);
history.setDocId(id);
history.setEvent(DocumentEvent.SENT.toString());
history.setUser(ServiceUtil.getSessionUser(sid));
history.setComment(StringUtils.abbreviate(email.getRecipients(), 4000));
history.setTitle(doc.getTitle());
history.setVersion(doc.getVersion());
history.setPath(fDao.computePathExtended(doc.getFolder().getId()));
dao.store(history);
}
/*
* Save the recipients in the user's contacts
*/
ContactDAO cdao = (ContactDAO) Context.getInstance().getBean(ContactDAO.class);
for (Recipient recipient : mail.getRecipients()) {
List<Contact> contacts = cdao.findByUser(user.getId(), recipient.getAddress());
if (contacts.isEmpty()) {
Contact cont = new Contact();
cont.setUserId(user.getId());
cont.setEmail(recipient.getAddress().trim());
cdao.store(cont);
}
}
return "ok";
} catch (Exception ex) {
log.warn(ex.getMessage(), ex);
return "error";
}
} catch (Exception e) {
log.warn(e.getMessage(), e);
return "error";
}
}
private String composeTicketUrl(Ticket ticket) {
HttpServletRequest request = this.getThreadLocalRequest();
String urlPrefix = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
+ request.getContextPath();
String address = urlPrefix + "/download-ticket?ticketId=" + ticket.getTicketId();
return address;
}
private void storeTicket(Ticket ticket, History transaction) {
// Store the ticket
TicketDAO ticketDao = (TicketDAO) Context.getInstance().getBean(TicketDAO.class);
ticketDao.store(ticket, transaction);
// Try to clean the DB from old tickets
ticketDao.deleteExpired();
}
private Ticket prepareTicket(long docId, User user) {
String temp = new Date().toString() + user.getId();
String ticketid = CryptUtil.cryptString(temp);
Ticket ticket = new Ticket();
ticket.setTicketId(ticketid);
ticket.setDocId(docId);
ticket.setUserId(user.getId());
return ticket;
}
private String createPreview(Document doc, long userId, String sid) {
Storer storer = (Storer) Context.getInstance().getBean(Storer.class);
String thumbResource = storer.getResourceName(doc, doc.getFileVersion(), "thumb.jpg");
// In any case try to produce the thumbnail
if (!storer.exists(doc.getId(), thumbResource)) {
ThumbnailManager thumbManager = (ThumbnailManager) Context.getInstance().getBean(ThumbnailManager.class);
try {
thumbManager.createTumbnail(doc, doc.getFileVersion(), sid);
} catch (Throwable t) {
log.error(t.getMessage(), t);
}
}
if (storer.exists(doc.getId(), thumbResource)) {
File file = UserUtil.getUserResource(userId, "/tmp/thumb.jpg");
file.getParentFile().mkdirs();
storer.writeToFile(doc.getId(), thumbResource, file);
try {
return file.toURI().toURL().toString();
} catch (MalformedURLException e) {
}
}
return null;
}
private void createAttachment(EMail email, long docId, boolean pdfConversion, String sid) throws IOException {
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
Storer storer = (Storer) Context.getInstance().getBean(Storer.class);
Document doc = docDao.findById(docId);
String resource = storer.getResourceName(doc, null, null);
boolean convertToPdf = pdfConversion;
if (doc.getDocRef() != null) {
// this is an alias
if ("pdf".equals(doc.getDocRefType())) {
doc = docDao.findById(doc.getDocRef());
convertToPdf = true;
}
}
EMailAttachment att = new EMailAttachment();
att.setIcon(doc.getIcon());
att.setFileName(doc.getFileName());
String extension = doc.getFileExtension();
att.setMimeType(MimeType.get(extension));
if (convertToPdf) {
if (!"pdf".equals(FilenameUtils.getExtension(doc.getFileName().toLowerCase()))) {
PdfConverterManager manager = (PdfConverterManager) Context.getInstance().getBean(
PdfConverterManager.class);
manager.createPdf(doc, sid);
resource = storer.getResourceName(doc, null, "conversion.pdf");
}
att.setMimeType(MimeType.get("pdf"));
att.setFileName(FilenameUtils.getBaseName(doc.getFileName()) + ".pdf");
}
att.setData(storer.getBytes(doc.getId(), resource));
if (att != null) {
email.addAttachment(2 + email.getAttachments().size(), att);
}
}
private void createAttachment(EMail email, File zipFile) throws IOException {
EMailAttachment att = new EMailAttachment();
att.setData(FileUtil.toByteArray(zipFile));
att.setFileName("doc.zip");
String extension = "zip";
att.setMimeType(MimeType.get(extension));
if (att != null) {
email.addAttachment(2 + email.getAttachments().size(), att);
}
}
@Override
public void unlock(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(ServiceUtil.getSessionUser(sid));
// Unlock the document; throws an exception if something
// goes wrong
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (long id : docIds) {
documentManager.unlock(id, transaction);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void updateBookmark(String sid, GUIBookmark bookmark) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
BookmarkDAO bookmarkDao = (BookmarkDAO) Context.getInstance().getBean(BookmarkDAO.class);
try {
Bookmark bk;
if (bookmark.getId() != 0) {
bk = bookmarkDao.findById(bookmark.getId());
bookmarkDao.initialize(bk);
} else
return;
bk.setTitle(bookmark.getName());
bk.setDescription(bookmark.getDescription());
bookmarkDao.store(bk);
bookmark.setId(bk.getId());
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void updateLink(String sid, long id, String type) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentLinkDAO dao = (DocumentLinkDAO) Context.getInstance().getBean(DocumentLinkDAO.class);
DocumentLink link = dao.findById(id);
dao.initialize(link);
link.setType(type);
dao.store(link);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void cleanUploadedFileFolder(String sid) throws ServerException {
ServiceUtil.validateSession(sid);
UploadServlet.cleanReceivedFiles(sid);
}
@Override
public GUIRating getRating(String sid, long docId) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
RatingDAO ratingDao = (RatingDAO) Context.getInstance().getBean(RatingDAO.class);
try {
GUIRating rating = new GUIRating();
Rating rat = ratingDao.findVotesByDocId(docId);
if (rat != null) {
ratingDao.initialize(rat);
rating.setId(rat.getId());
rating.setDocId(docId);
// We use the rating userId value to know in the GUI if the user
// has already vote this document.
if (ratingDao.findByDocIdAndUserId(docId, session.getUserId()))
rating.setUserId(session.getUserId());
rating.setCount(rat.getCount());
rating.setAverage(rat.getAverage());
} else {
rating.setDocId(docId);
rating.setCount(0);
rating.setAverage(0F);
}
return rating;
} catch (Throwable t) {
return (GUIRating) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public int saveRating(String sid, GUIRating rating) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
RatingDAO ratingDao = (RatingDAO) Context.getInstance().getBean(RatingDAO.class);
DocumentDAO docDao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
try {
Rating rat = new Rating();
rat.setTenantId(session.getTenantId());
rat.setDocId(rating.getDocId());
rat.setUserId(rating.getUserId());
rat.setVote(rating.getVote());
ratingDao.store(rat);
Rating votesDoc = ratingDao.findVotesByDocId(rating.getDocId());
Document doc = docDao.findById(rating.getDocId());
docDao.initialize(doc);
int average = 0;
if (votesDoc != null && votesDoc.getAverage() != null)
average = votesDoc.getAverage().intValue();
doc.setRating(average);
docDao.store(doc);
return average;
} catch (Throwable t) {
return (Integer) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public long addNote(String sid, long docId, String message) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User sessionUser = ServiceUtil.getSessionUser(sid);
DocumentNote note = new DocumentNote();
note.setTenantId(session.getTenantId());
note.setDocId(docId);
note.setUserId(sessionUser.getId());
note.setUsername(sessionUser.getFullName());
note.setDate(new Date());
note.setMessage(message);
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(sessionUser);
DocumentNoteDAO dao = (DocumentNoteDAO) Context.getInstance().getBean(DocumentNoteDAO.class);
dao.store(note, transaction);
return note.getId();
} catch (Throwable t) {
return (Integer) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void deleteNotes(String sid, long[] ids) throws ServerException {
ServiceUtil.validateSession(sid);
DocumentNoteDAO dao = (DocumentNoteDAO) Context.getInstance().getBean(DocumentNoteDAO.class);
for (long id : ids)
dao.delete(id);
}
@Override
public void bulkUpdate(String sid, long[] ids, GUIDocument vo) throws ServerException {
for (long id : ids) {
try {
GUIDocument buf = getById(sid, id);
if (buf.getImmutable() == 1 || buf.getStatus() != Document.DOC_UNLOCKED)
continue;
buf.setComment(vo.getComment() != null ? vo.getComment() : "");
if (StringUtils.isNotEmpty(vo.getLanguage()))
buf.setLanguage(vo.getLanguage());
if (vo.getTags() != null && vo.getTags().length > 0)
buf.setTags(vo.getTags());
if (StringUtils.isNotEmpty(vo.getCoverage()))
buf.setCoverage(vo.getCoverage());
if (StringUtils.isNotEmpty(vo.getObject()))
buf.setObject(vo.getObject());
if (StringUtils.isNotEmpty(vo.getRecipient()))
buf.setRecipient(vo.getRecipient());
if (StringUtils.isNotEmpty(vo.getSource()))
buf.setSource(vo.getSource());
if (StringUtils.isNotEmpty(vo.getSourceAuthor()))
buf.setSourceAuthor(vo.getSourceAuthor());
if (StringUtils.isNotEmpty(vo.getSourceId()))
buf.setSourceId(vo.getSourceId());
if (StringUtils.isNotEmpty(vo.getSourceType()))
buf.setSourceType(vo.getSourceType());
if (vo.getTemplateId() != null)
buf.setTemplateId(vo.getTemplateId());
if (vo.getAttributes() != null && vo.getAttributes().length > 0)
buf.setAttributes(vo.getAttributes());
if (vo.getSourceDate() != null)
buf.setSourceDate(vo.getSourceDate());
if (StringUtils.isNotEmpty(vo.getWorkflowStatus()))
buf.setSource(vo.getWorkflowStatus());
if (vo.getPublished() > -1)
buf.setPublished(vo.getPublished());
if (vo.getStartPublishing() != null)
buf.setStartPublishing(vo.getStartPublishing());
if (vo.getStopPublishing() != null)
buf.setStopPublishing(vo.getStopPublishing());
save(sid, buf);
} catch (Throwable e) {
log.error(e.getMessage(), e);
}
}
}
protected void checkPublished(User user, Document doc) throws Exception {
if (!user.isInGroup("admin") && !user.isInGroup("publisher") && !doc.isPublishing())
throw new FileNotFoundException("Document not published");
}
@Override
public void updateNote(String sid, long docId, long noteId, String message) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
DocumentNoteDAO dao = (DocumentNoteDAO) Context.getInstance().getBean(DocumentNoteDAO.class);
DocumentNote note = dao.findById(noteId);
note.setUserId(user.getId());
note.setUsername(user.getFullName());
note.setMessage(message);
dao.store(note);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public GUIDocument deleteVersions(String sid, long[] ids) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
for (long id : ids) {
History transaction = new History();
transaction.setUser(user);
Version version = manager.deleteVersion(id, transaction);
return getById(sid, version.getDocId());
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
return null;
}
@Override
public GUIDocument createEmpty(String sid, GUIDocument vo) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
DocumentManager documentManager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (!fdao.isWriteEnabled(vo.getFolder().getId(), session.getUserId())) {
throw new RuntimeException("The user doesn't have the write permission on the current folder");
}
Document doc = toDocument(vo);
doc.setId(0L);
History transaction = new History();
transaction.setUser(user);
transaction.setEvent(DocumentEvent.STORED.toString());
Document document = documentManager.create(IOUtils.toInputStream(""), doc, transaction);
// If that VO is in checkout, perform a checkout also
if (vo.getStatus() == Document.DOC_CHECKED_OUT) {
transaction = new History();
transaction.setUser(user);
documentManager.checkout(document.getId(), transaction);
}
return fromDocument(document, vo.getFolder());
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
return null;
}
@Override
public void deleteFromTrash(String sid, Long[] ids) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
if (ids == null || ids.length < 1)
return;
try {
String idsStr = Arrays.asList(ids).toString().replace('[', '(').replace(']', ')');
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
dao.bulkUpdate("set ld_deleted=2 where ld_id in " + idsStr, null);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void emptyTrash(String sid) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
dao.bulkUpdate("set ld_deleted=2 where ld_deleted=1 and ld_deleteuserid=" + session.getUserId(), null);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
fdao.bulkUpdate("set ld_deleted=2 where ld_deleted=1 and ld_deleteuserid=" + session.getUserId(), null);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void archiveDocuments(String sid, long[] docIds, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(comment);
manager.archiveDocuments(docIds, transaction);
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public long archiveFolder(String sid, long folderId, String comment) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentManager manager = (DocumentManager) Context.getInstance().getBean(DocumentManager.class);
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(ServiceUtil.getSessionUser(sid));
transaction.setComment(comment);
return manager.archiveFolder(folderId, transaction);
} catch (Throwable t) {
return (Long) ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public void unarchiveDocuments(String sid, long[] docIds) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
User user = ServiceUtil.getSessionUser(sid);
for (long id : docIds) {
// Create the document history event
History transaction = new History();
transaction.setSessionId(sid);
transaction.setUser(user);
dao.unarchive(id, transaction);
}
} catch (Throwable t) {
ServiceUtil.throwServerException(session, log, t);
}
}
@Override
public long countDocuments(String sid, long[] folderIds, int status) throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
User user = ServiceUtil.getSessionUser(sid);
long count = 0;
try {
for (int i = 0; i < folderIds.length; i++) {
count += countDocuments(sid, user, folderIds[i], status);
}
} catch (Throwable t) {
return (Long) ServiceUtil.throwServerException(session, log, t);
}
return count;
}
private long countDocuments(String sid, User user, long folderId, int status) throws ServerException {
DocumentDAO dao = (DocumentDAO) Context.getInstance().getBean(DocumentDAO.class);
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
List<Long> childrenFolderIds = fdao.findIdsByParentId(folderId);
childrenFolderIds.add(folderId);
StringBuffer query = new StringBuffer("select count(ld_id) from ld_document where ld_deleted=0 and ld_status="
+ status);
query.append(" and ld_folderid in " + childrenFolderIds.toString().replace("[", "(").replace("]", ")"));
return dao.queryForLong(query.toString());
}
@Override
public String createDownloadTicket(String sid, long docId, String suffix, Integer expireHours, Date expireDate)
throws ServerException {
UserSession session = ServiceUtil.validateSession(sid);
try {
User user = ServiceUtil.getSessionUser(session.getId());
FolderDAO fdao = (FolderDAO) Context.getInstance().getBean(FolderDAO.class);
if (!fdao.isWriteEnabled(getById(sid, docId).getFolder().getId(), user.getId())) {
throw new RuntimeException("You don't have the download permission");
}
Ticket ticket = prepareTicket(docId, ServiceUtil.getSessionUser(sid));
ticket.setSuffix(suffix);
Calendar cal = GregorianCalendar.getInstance();
if (expireDate != null) {
cal.setTime(expireDate);
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
cal.set(Calendar.MILLISECOND, 999);
ticket.setExpired(cal.getTime());
} else if (expireHours != null) {
cal.add(Calendar.HOUR_OF_DAY, expireHours.intValue());
ticket.setExpired(cal.getTime());
}
History transaction = new History();
transaction.setSessionId(session.getId());
transaction.setUser(user);
storeTicket(ticket, transaction);
return composeTicketUrl(ticket);
} catch (Throwable t) {
return (String) ServiceUtil.throwServerException(session, log, t);
}
}
} | [
"car031@bae09422-6297-422f-b3ee-419521344c47"
] | car031@bae09422-6297-422f-b3ee-419521344c47 |
d57be715a2048b9a8d1d632019c56a2cab2aceda | e24ccd143be2142d8a27285836ebc2497ed39bc2 | /Homework531/src/Test3/SimpleDateFormatDemo.java | 027928f0aa73259308eea759cb42aee82df6e507 | [] | no_license | SweetCukes/BookDinner_demo | 867c464ba53ced3d45ef178724cd01cb9d534613 | 4693c0dc92eb830b7d7e67b083f4ae37152b228f | refs/heads/master | 2020-07-19T14:25:00.321881 | 2019-09-05T03:00:22 | 2019-09-05T03:00:22 | 206,464,437 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 598 | java | package Test3;
import java.text.SimpleDateFormat;
import java.util.Date;
public class SimpleDateFormatDemo {
public static void main(String[] args) throws Exception{
String oldDate = "1999-1-24 12:52:37.900";
String newDate = null;
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy年MM月dd日HH时mm分ss秒sss毫秒");
Date date = sdf1.parse(oldDate);
newDate = sdf2.format(date);
System.out.println("格式化后日期:" + newDate);
}
}
| [
"[email protected]"
] | |
e25113d19354d3233b955c8333c0de94fca01b59 | d931eae55c638dc24565cb7e8e4b7569f0c178d4 | /bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/template/TemplateContainer.java | e978ac25c96087beb1187d3f1616d5c12d242479 | [
"Apache-2.0"
] | permissive | qll3609120/bboss-elasticsearch | af93d350e50cc22e0f1debdc7a1781dc7e492f4e | d112946dbeb8183e06086dec40bb83569f9c1c56 | refs/heads/master | 2021-04-23T06:20:06.750481 | 2020-03-20T15:38:07 | 2020-03-20T15:38:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,847 | java | package org.frameworkset.elasticsearch.template;
/**
* Copyright 2008 biaoping.yin
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.frameworkset.util.DaemonThread;
import com.frameworkset.util.ResourceInitial;
import java.util.Set;
/**
* <p>Description: </p>
* <p></p>
* <p>Copyright (c) 2018</p>
* @Date 2020/1/17 14:36
* @author biaoping.yin
* @version 1.0
*/
public interface TemplateContainer {
public final String NAME_perKeyDSLStructionCacheSize = "perKeyDSLStructionCacheSize";
public final String NAME_alwaysCacheDslStruction = "alwaysCacheDslStruction";
public final String NAME_templateFile = "templateFile";
public final String NAME_templateName = "templateName";
public final String NAME_istpl = "istpl";
public final String NAME_multiparser = "multiparser";
String getNamespace();
Set getTempalteNames();
TemplateMeta getProBean(String key);
void destroy(boolean b);
void reinit(ESUtil esUtil);
/**
* 命名空间对应的全局每一个template对应的dsl语法缓冲区大小
* @return
*/
int getPerKeyDSLStructionCacheSize();
/**
* 命名空间对应的全局是否开启每一个template对应的dsl语法缓冲机制
* @return
*/
boolean isAlwaysCacheDslStruction();
void monitor(DaemonThread daemonThread, ResourceInitial resourceTempateRefresh);
}
| [
"[email protected]"
] | |
d5ccedd7163a3df6a2d0c8db392757f33281f5f2 | 4398b91a930c1a998583b9fa666242fc1eaf7594 | /A2_Queues/RandomizedQueue.java | 4ea961ff9f57658f590c36bbe7351a8fa1db1e50 | [
"MIT"
] | permissive | zhiqiyu/Algorithms_P1_Coursera | 4d5b81fa4892512a275b56798cdafd37645df76e | 42dd3c9352c69601a34dc22ae7f38f4cb6193ef5 | refs/heads/master | 2020-06-09T08:13:08.936312 | 2019-07-15T14:50:01 | 2019-07-15T14:50:01 | 193,407,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,366 | java | import java.util.Iterator;
import edu.princeton.cs.algs4.StdRandom;
public class RandomizedQueue<Item> implements Iterable<Item> {
private Item[] arr;
private int n;
// construct an empty randomized queue
public RandomizedQueue() {
arr = (Item[]) new Object[2];
n = 0;
}
// is the randomized queue empty?
public boolean isEmpty() {
return n == 0;
}
private void resize(int capacity) {
Item[] new_arr = (Item[]) new Object[capacity];
for (int i = 0; i < n; i ++) {
new_arr[i] = arr[i]; // straighten warpped around array
}
arr = new_arr;
}
// return the number of items on the randomized queue
public int size() {
return n;
}
// add the item
public void enqueue(Item item) {
if (item == null) {
throw new IllegalArgumentException();
}
if (n == arr.length) {
resize(2*n);
}
arr[n++] = item;
}
// remove and return a random item
public Item dequeue() {
if (isEmpty()) {
throw new java.util.NoSuchElementException("Queue underflow");
}
int rand = StdRandom.uniform(n);
Item out = arr[rand];
if (rand == n-1) {
arr[rand] = null;
}
else {
Item tail = arr[n-1];
arr[n-1] = null;
arr[rand] = tail;
}
n--;
if (n <= arr.length/4.0 && n > 0) {
resize(n/2);
}
return out;
}
// return a random item (but do not remove it)
public Item sample() {
if (isEmpty()) {
throw new java.util.NoSuchElementException("Queue underflow");
}
int rand = StdRandom.uniform(n);
return arr[rand];
}
// return an independent iterator over items in random order
public Iterator<Item> iterator() {
return new RandomIterator();
}
private class RandomIterator implements Iterator<Item> {
private final int[] perm;
private int cur_ind = 0;
public RandomIterator() {
perm = StdRandom.permutation(n);
}
public boolean hasNext() {
return cur_ind < n;
}
public void remove() {
throw new UnsupportedOperationException();
}
public Item next() {
if (!hasNext()) {
throw new java.util.NoSuchElementException();
}
return arr[perm[cur_ind++]];
}
}
// unit testing (required)
public static void main(String[] args) {
RandomizedQueue<String> rq = new RandomizedQueue<>();
rq.enqueue("a");
rq.enqueue("b");
rq.enqueue("c");
rq.enqueue("d");
rq.enqueue("e");
System.out.println(rq.size());
for (String i : rq) {
System.out.print(i + " ");
}
System.out.println();
for (String i : rq) {
System.out.print(i + " ");
}
System.out.println();
System.out.println("first sample: " + rq.sample());
System.out.println("second sample: " + rq.sample());
rq.dequeue();
rq.dequeue();
System.out.println(rq.size());
for (String i : rq) {
System.out.print(i + " ");
}
}
} | [
"[email protected]"
] | |
4e43004c0d23b91fd32355941a39be7d38f95b0d | 842f2fb7ddb5b21569291567056edb16ea54e71f | /Practice/src/in/second/Question.java | 10519af6bee86449909ba2c6fb0164831bf4e1d8 | [] | no_license | adatapost/krunal | 4ce7dfcc38f714c6f46101c9bfe700c60bfde2d3 | 5f31df4e959f6af6635f9421c0a5f8332bb05f09 | refs/heads/master | 2020-06-04T17:33:42.808840 | 2014-11-11T03:05:29 | 2014-11-11T03:05:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,286 | 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 in.second;
/**
*
* @author admin
*/
public abstract class Question {
private String question;
private String answer1, answer2, answer3;
public abstract boolean isCorrect();
public abstract void display();
public Question() {
}
public Question(String question, String answer1, String answer2, String answer3) {
this.question = question;
this.answer1 = answer1;
this.answer2 = answer2;
this.answer3 = answer3;
}
public String getQuestion() {
return question;
}
public void setQuestion(String question) {
this.question = question;
}
public String getAnswer1() {
return answer1;
}
public void setAnswer1(String answer1) {
this.answer1 = answer1;
}
public String getAnswer2() {
return answer2;
}
public void setAnswer2(String answer2) {
this.answer2 = answer2;
}
public String getAnswer3() {
return answer3;
}
public void setAnswer3(String answer3) {
this.answer3 = answer3;
}
}
| [
"[email protected]"
] | |
204134cbcee4d45457fe823b15aaa481a2786104 | c8c47d4ac12b169a943c76a85818455da153dcb7 | /src/Decorator/ToppingGiftBox.java | f4c664fc6467d11201b50816cb21ef534f23dee0 | [] | no_license | K-O-G/AAD_LabWork3 | 73f83bbe07791b545582bef6a21b2edb99a3bf7b | 7d7c66fbb7821af8992aadb8e287f38e6fe4f887 | refs/heads/master | 2020-05-21T08:19:57.367061 | 2017-03-11T06:57:25 | 2017-03-11T06:57:25 | 84,602,681 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 264 | java | package Decorator;
public class ToppingGiftBox extends ToppingAdditions{
private Chocolate_cake cake;
public ToppingGiftBox(Chocolate_cake cake)
{
this.cake=cake;
topping();
}
void topping() {
cake.giftbox=cake.giftbox+"Happy Birthday GiftBox";
}
}
| [
"[email protected]"
] | |
1378a5790c92b17e85968acb3c1fa48d34abc424 | 6fbe208c51bd5779ff0f185599e807684cf2c13c | /src/main/java/com/plasticon/erp/service/ManagePaymentGateWayService.java | 4baac09820ec7be75a4651e86dc7aeca6e6f4e97 | [] | no_license | saishanker41/erpProject | 5e405e4f27b6af99b343ab34a9ac8b2a0589d907 | 23423248384fa9f4c82a70d9132e4df53a54ca71 | refs/heads/master | 2023-06-09T07:20:41.658421 | 2021-06-16T07:02:40 | 2021-06-16T07:02:40 | 377,395,357 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 848 | java | package com.plasticon.erp.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.plasticon.erp.model.ManagePaymentGateWay;
import com.plasticon.erp.repository.ManagePaymentGateWayRepository;
@Service
public class ManagePaymentGateWayService {
@Autowired
ManagePaymentGateWayRepository managePaymentGateWayRepository;
public List<ManagePaymentGateWay> getManagePaymentGateWayDetails(){
return managePaymentGateWayRepository.findAll();
}
public void saveManagePaymentGateWayDetails(ManagePaymentGateWay managePaymentGateWay) {
managePaymentGateWayRepository.save(managePaymentGateWay);
}
public void deleteManagePaymentGateWayDetails(int managePaymentGateWayId) {
managePaymentGateWayRepository.deleteById(managePaymentGateWayId);
}
}
| [
"[email protected]"
] | |
38ef01e577d09039bde7f2776f549824ca9c8a49 | c992cc664787167313fb4d317f172e8b057b1f5b | /modules/ui-widgets/src/main/java/io/jmix/ui/widgets/client/Tools.java | 8badee91c4c583d8e66bca24d3617c89cbb81c72 | [
"Apache-2.0"
] | permissive | alexbudarov/jmix | 42628ce00a2a67bac7f4113a7e642d5a67c38197 | 23272dc3d6cb1f1a9826edbe888b3c993ab22d85 | refs/heads/master | 2020-12-19T15:57:38.886284 | 2020-01-23T10:06:16 | 2020-01-23T10:06:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,058 | java | /*
* Copyright (c) 2008-2016 Haulmont.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package io.jmix.ui.widgets.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusWidget;
import com.google.gwt.user.client.ui.Widget;
import io.jmix.ui.widgets.client.jqueryfileupload.CubaFileUploadWidget;
import io.jmix.ui.widgets.client.sys.ToolsImpl;
import com.vaadin.client.BrowserInfo;
import com.vaadin.client.WidgetUtil;
import com.vaadin.client.ui.VButton;
import com.vaadin.client.ui.VOverlay;
import com.vaadin.client.ui.VUpload;
import com.vaadin.client.ui.VVerticalLayout;
import com.vaadin.client.ui.orderedlayout.Slot;
import com.vaadin.client.ui.orderedlayout.VAbstractOrderedLayout;
public class Tools {
public static final String SELECTED_ITEM_STYLE = "c-cm-button-selected";
public static final String CUBA_CONTEXT_MENU_CONTAINER = "c-cm-container";
private static ToolsImpl impl;
static {
impl = GWT.create(ToolsImpl.class);
}
public static void textSelectionEnable(Element el, boolean b) {
impl.textSelectionEnable(el, b);
}
public static void replaceClassNames(Element element, String from, String to) {
String className = element.getClassName();
String newClassName = "";
String[] classNames = className.split(" ");
for (String classNamePart : classNames) {
if (classNamePart.startsWith(from + "-")) {
classNamePart = classNamePart.replace(from + "-", to + "-");
} else if (classNamePart.equals(from)) {
classNamePart = to;
}
newClassName = newClassName + " " + classNamePart;
}
element.setClassName(newClassName.trim());
}
public static VOverlay createCubaTablePopup(boolean autoClose) {
VOverlay tableCustomPopup = autoClose ? createTableContextMenu() : new VOverlay();
tableCustomPopup.setStyleName("c-table-popup");
return tableCustomPopup;
}
public static VOverlay createCubaTableContextMenu() {
VOverlay tableContextMenu = createTableContextMenu();
tableContextMenu.setStyleName("c-context-menu");
return tableContextMenu;
}
protected static VOverlay createTableContextMenu() {
return new TableOverlay();
}
public static boolean isLayoutChild(VAbstractOrderedLayout layout, Widget child) {
for (Widget widget : layout) {
Slot slot = (Slot) widget;
Widget slotWidget = slot.getWidget();
if (slotWidget.equals(child)) {
return true;
}
}
return false;
}
public static void focusSelectedItem(Widget parentWidget, Widget target) {
resetItemSelection(parentWidget);
target.addStyleName(SELECTED_ITEM_STYLE);
}
public static void resetItemSelection(Widget popup) {
if (popup instanceof VAbstractOrderedLayout) {
VAbstractOrderedLayout content = (VAbstractOrderedLayout) popup;
if (content.getStyleName().contains(CUBA_CONTEXT_MENU_CONTAINER)) {
for (Widget slot : content) {
VButton button = (VButton) ((Slot) slot).getWidget();
if (button != null && button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
button.removeStyleName(SELECTED_ITEM_STYLE);
}
}
}
}
}
public static void showPopup(VOverlay overlay, int left, int top) {
overlay.setAutoHideEnabled(true);
overlay.setVisible(false);
overlay.show();
Widget widget = overlay.getWidget();
if (widget instanceof VVerticalLayout) {
resetItemSelection(widget);
VVerticalLayout verticalLayout = (VVerticalLayout) widget;
if (verticalLayout.getStyleName().contains(CUBA_CONTEXT_MENU_CONTAINER)) {
int widgetCount = verticalLayout.getWidgetCount();
if (widgetCount > 1) {
Widget verticalSlot = verticalLayout.getWidget(0);
Widget buttonWidget = ((Slot) verticalSlot).getWidget();
buttonWidget.addStyleName(SELECTED_ITEM_STYLE);
if (buttonWidget instanceof FocusWidget) {
((FocusWidget) buttonWidget).setFocus(true);
}
}
}
}
// mac FF gets bad width due GWT popups overflow hacks,
// re-determine width
int offsetWidth = overlay.getOffsetWidth();
int offsetHeight = overlay.getOffsetHeight();
if (offsetWidth + left > Window.getClientWidth()) {
left = left - offsetWidth;
if (left < 0) {
left = 0;
}
}
if (offsetHeight + top > Window.getClientHeight()) {
top = top - offsetHeight;
if (top < 0) {
top = 0;
}
}
overlay.setPopupPosition(left, top);
overlay.setVisible(true);
}
public static boolean isAnyModifierKeyPressed(Event event) {
return (event.getShiftKey()
|| event.getAltKey()
|| event.getCtrlKey()
|| event.getMetaKey());
}
public static Element findCurrentOrParentTd(Element target) {
if (target == null) {
return null;
}
// Iterate upwards until we find the TR element
Element element = target;
while (element != null
&& !"td".equalsIgnoreCase(element.getTagName())) {
element = element.getParentElement();
}
return element;
}
public static Widget findPrevWidget(FlowPanel layout, int widgetIndex) {
for (int i = widgetIndex - 1; i >= 0; i--) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
// try to find button from last
for (int i = layout.getWidgetCount() - 1; i > widgetIndex; i--) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
return null;
}
public static Widget findNextWidget(FlowPanel layout, int widgetIndex) {
for (int i = widgetIndex + 1; i < layout.getWidgetCount(); i++) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
// try to find button from first
for (int i = 0; i < widgetIndex; i++) {
Widget widget = layout.getWidget(i);
if (widget instanceof Slot) {
widget = ((Slot) widget).getWidget();
}
if (isSuitableWidget(widget)) {
return widget;
}
}
return null;
}
public static boolean isSuitableWidget(Widget slotWidget) {
if (slotWidget instanceof VButton) {
VButton button = (VButton) slotWidget;
if (button.isEnabled()) {
return true;
}
} else if (slotWidget instanceof CubaFileUploadWidget) {
return true;
} else if (slotWidget instanceof VUpload) {
return true;
}
return false;
}
// CAUTION Do not use multiselect mode SIMPLE for touch devices, it may be laptop with touch screen
public static boolean isUseSimpleMultiselectForTouchDevice() {
return BrowserInfo.get().isAndroid()
|| BrowserInfo.get().isIOS();
}
public static class TableOverlay extends VOverlay {
@Override
protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
super.onPreviewNativeEvent(event);
NativeEvent nativeEvent = event.getNativeEvent();
Element target = Element.as(nativeEvent.getEventTarget());
if (Event.ONCLICK == event.getTypeInt()) {
if (getElement().isOrHasChild(target)) {
Scheduler.get().scheduleDeferred(this::hide);
}
}
previewTableContextMenuEvent(event);
}
protected void previewTableContextMenuEvent(Event.NativePreviewEvent event) {
NativeEvent nativeEvent = event.getNativeEvent();
Element target = Element.as(nativeEvent.getEventTarget());
if (Event.ONKEYDOWN == event.getTypeInt()) {
int keyCode = event.getNativeEvent().getKeyCode();
if (KeyCodes.KEY_ESCAPE == keyCode) {
event.cancel();
event.getNativeEvent().stopPropagation();
event.getNativeEvent().preventDefault();
hide();
} else {
VAbstractOrderedLayout verticalLayout = ((VAbstractOrderedLayout) getWidget());
Widget widget = WidgetUtil.findWidget(target, null);
if (isLayoutChild(verticalLayout, widget)) {
Widget widgetParent = widget.getParent();
VAbstractOrderedLayout layout = (VAbstractOrderedLayout) widgetParent.getParent();
Widget focusWidget = null;
int widgetIndex = layout.getWidgetIndex(widgetParent);
if (keyCode == KeyCodes.KEY_DOWN) {
focusWidget = Tools.findNextWidget(layout, widgetIndex);
} else if (keyCode == KeyCodes.KEY_UP) {
focusWidget = Tools.findPrevWidget(layout, widgetIndex);
}
if (focusWidget instanceof VButton) {
VButton button = (VButton) focusWidget;
focusSelectedItem(widgetParent.getParent(), button);
button.setFocus(true);
}
}
}
} else if (Event.ONMOUSEOVER == event.getTypeInt()) {
VAbstractOrderedLayout verticalLayout = ((VAbstractOrderedLayout) getWidget());
Widget widget = WidgetUtil.findWidget(target, null);
if (isLayoutChild(verticalLayout, widget)) {
if (widget instanceof VButton) {
VButton button = (VButton) widget;
Widget widgetParent = button.getParent();
if (!button.getStyleName().contains(SELECTED_ITEM_STYLE)) {
focusSelectedItem(widgetParent.getParent(), button);
button.setFocus(true);
}
}
}
}
}
}
}
| [
"[email protected]"
] | |
c0c7fdcd915d25aee919c142275cb148329976cf | cce0978d570fd5ba02f6278c6d17a9d7d066795a | /test/integration-tests/src/test/java/org/springframework/ldap/itest/manager/hibernate/ContextSourceAndHibernateTransactionManagerNamespaceITest.java | acd8173cba2df34fa54742631eccb468aaaff387 | [
"Apache-2.0"
] | permissive | conquer/spring-ldap | 07d06ee41c27d95d0783d7b86f3c3b4cd375d3b2 | 86da41fe3da72815e386a2797d27ccc125d5bb3b | refs/heads/master | 2021-01-16T22:51:14.818159 | 2015-08-04T15:56:05 | 2015-08-04T15:56:05 | 40,586,791 | 1 | 0 | null | 2015-08-12T07:33:50 | 2015-08-12T07:33:50 | null | UTF-8 | Java | false | false | 12,232 | java | /*
* Copyright 2005-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.ldap.itest.manager.hibernate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.ldap.NameNotFoundException;
import org.springframework.ldap.core.AttributesMapper;
import org.springframework.ldap.core.LdapTemplate;
import org.springframework.ldap.itest.AbstractLdapTemplateIntegrationTest;
import org.springframework.ldap.itest.transaction.compensating.manager.DummyException;
import org.springframework.ldap.itest.transaction.compensating.manager.hibernate.OrgPerson;
import org.springframework.ldap.itest.transaction.compensating.manager.hibernate.OrgPersonDao;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import java.util.List;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static junit.framework.Assert.assertTrue;
import static junit.framework.Assert.fail;
/**
* Integration tests for {@link org.springframework.ldap.transaction.compensating.manager.ContextSourceAndHibernateTransactionManager}
* with namespace configuration.
*
* @author Hans Westerbeek
*/
@ContextConfiguration(locations = {"/conf/ldapAndHibernateTransactionNamespaceTestContext.xml"})
public class ContextSourceAndHibernateTransactionManagerNamespaceITest extends AbstractLdapTemplateIntegrationTest {
private static Logger log = LoggerFactory.getLogger(ContextSourceAndHibernateTransactionManagerNamespaceITest.class);
@Autowired
@Qualifier("dummyDao")
private OrgPersonDao dummyDao;
@Autowired
private LdapTemplate ldapTemplate;
@Autowired
private HibernateTemplate hibernateTemplate;
@Autowired
private SessionFactory sessionFactory;
@Before
public void prepareTest() throws Exception {
if (TransactionSynchronizationManager.isSynchronizationActive()) {
TransactionSynchronizationManager.clearSynchronization();
}
OrgPerson person = new OrgPerson();
person.setId(new Integer(1));
person.setLastname("Person");
person.setFullname("Some Person");
person.setDescription("Sweden, Company1, Some Person");
person.setCountry("Sweden");
person.setCompany("Company1");
// "Some Person", "Person", "Sweden, Company1, Some Person"
// avoid the transaction manager we have configured, do it manually
Session session = this.sessionFactory.openSession();
Transaction tx = session.beginTransaction();
session.saveOrUpdate(person);
tx.commit();
session.close();
}
@After
public void cleanup() throws Exception {
// probably the wrong idea, this will use the thing i am trying to
// test..
Session session = this.sessionFactory.openSession();
Transaction tx = session.beginTransaction();
Query query = session.createQuery("delete from OrgPerson");
query.executeUpdate();
tx.commit();
session.close();
}
@Test
public void testCreateWithException() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
person.setCountry("Sweden");
person.setCompany("company1");
try {
dummyDao.createWithException(person);
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
log.debug("Verifying result");
// Verify that no entry was created in ldap or hibernate db
try {
ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
assertTrue(true);
}
List result = hibernateTemplate.findByNamedParam("from OrgPerson person where person.lastname = :lastname",
"lastname", person.getLastname());
assertTrue(result.size() == 0);
}
@Test
public void testCreate() {
OrgPerson person = new OrgPerson();
person.setId(new Integer(2));
person.setDescription("some description");
person.setFullname("Some testperson");
person.setLastname("testperson");
person.setCountry("Sweden");
person.setCompany("company1");
// dummyDao.create("Sweden", "company1", "some testperson",
// "testperson", "some description");
this.dummyDao.create(person);
person = null;
log.debug("Verifying result");
Object ldapResult = ldapTemplate.lookup("cn=some testperson, ou=company1, ou=Sweden");
OrgPerson fromDb = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(2));
assertNotNull(ldapResult);
assertNotNull(fromDb);
}
@Test
public void testUpdateWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson originalPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
originalPerson.setLastname("fooo");
try {
dummyDao.updateWithException(originalPerson);
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
log.debug("Verifying result");
Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertNotNull("Person", attributes.get("sn").get());
assertEquals("Sweden, Company1, Some Person", attributes.get("description").get());
return new Object();
}
});
OrgPerson notUpdatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
assertEquals("Person", notUpdatedPerson.getLastname());
assertEquals("Sweden, Company1, Some Person", notUpdatedPerson.getDescription());
assertNotNull(ldapResult);
// no need to assert if notUpdatedPerson exists
}
@Test
public void testUpdate() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
person.setLastname("Updated Person");
person.setDescription("Updated description");
dummyDao.update(person);
log.debug("Verifying result");
Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Updated Person", attributes.get("sn").get());
assertEquals("Updated description", attributes.get("description").get());
return new Object();
}
});
OrgPerson updatedPerson = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
assertEquals("Updated Person", updatedPerson.getLastname());
assertEquals("Updated description", updatedPerson.getDescription());
assertNotNull(ldapResult);
}
@Test
public void testUpdateAndRenameWithException() {
String dn = "cn=Some Person2,ou=company1,ou=Sweden";
String newDn = "cn=Some Person2,ou=company2,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
person.setLastname("Updated Person");
person.setDescription("Updated description");
try {
// Perform test
dummyDao.updateAndRenameWithException(dn, newDn, "Updated description");
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
// Verify that entry was not moved.
try {
ldapTemplate.lookup(newDn);
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
assertTrue(true);
}
// Verify that original entry was not updated.
Object object = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Sweden, Company1, Some Person2", attributes.get("description").get());
return new Object();
}
});
assertNotNull(object);
}
@Test
public void testUpdateAndRename() {
String dn = "cn=Some Person2,ou=company1,ou=Sweden";
String newDn = "cn=Some Person2,ou=company2,ou=Sweden";
// Perform test
dummyDao.updateAndRename(dn, newDn, "Updated description");
// Verify that entry was moved and updated.
Object object = ldapTemplate.lookup(newDn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Updated description", attributes.get("description").get());
return new Object();
}
});
assertNotNull(object);
}
@Test
public void testModifyAttributesWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
try {
// Perform test
dummyDao.modifyAttributesWithException(dn, "Updated lastname", "Updated description");
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
// Verify result - check that the operation was properly rolled back
Object result = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Person", attributes.get("sn").get());
assertEquals("Sweden, Company1, Some Person", attributes.get("description").get());
return new Object();
}
});
assertNotNull(result);
}
@Test
public void testModifyAttributes() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
// Perform test
dummyDao.modifyAttributes(dn, "Updated lastname", "Updated description");
// Verify result - check that the operation was not rolled back
Object result = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
assertEquals("Updated lastname", attributes.get("sn").get());
assertEquals("Updated description", attributes.get("description").get());
return new Object();
}
});
assertNotNull(result);
}
@Test
public void testUnbindWithException() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
try {
// Perform test
dummyDao.unbindWithException(person);
fail("DummyException expected");
}
catch (DummyException expected) {
assertTrue(true);
}
person = null;
// Verify result - check that the operation was properly rolled back
Object ldapResult = ldapTemplate.lookup(dn, new AttributesMapper() {
public Object mapFromAttributes(Attributes attributes) throws NamingException {
// Just verify that the entry still exists.
return new Object();
}
});
person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1)); // will
// throw
// exception
// of
// person
// does
// not
// exist
assertNotNull(ldapResult);
}
@Test
public void testUnbind() {
String dn = "cn=Some Person,ou=company1,ou=Sweden";
// Perform test
OrgPerson person = (OrgPerson) this.hibernateTemplate.load(OrgPerson.class, new Integer(1));
dummyDao.unbind(person);
try {
// Verify result - check that the operation was not rolled back
ldapTemplate.lookup(dn);
fail("NameNotFoundException expected");
}
catch (NameNotFoundException expected) {
assertTrue(true);
}
person = (OrgPerson) this.hibernateTemplate.get(OrgPerson.class, new Integer(1));
assertNull(person);
}
}
| [
"[email protected]"
] | |
52b6bcf17e1adf9327066a334da065e014c06842 | d31bd08e2a54249b41df4245b9719e08e2df6be0 | /src/com/moayad/oop/interface_example/CreditCard.java | 76a8189ec798be7fe3eb4309df74409c0fbe8093 | [] | no_license | Moayadooh/Java | 3a395a1ae185c483fdbc99b86810820c9c91b323 | 45e40307af5054fe32e5ea11c6c4d8e754f33686 | refs/heads/master | 2023-05-05T09:12:50.551488 | 2021-05-26T10:54:43 | 2021-05-26T10:54:43 | 286,448,215 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 383 | java | package com.moayad.oop.interface_example;
//Interface
//Object oriented design
public interface CreditCard {
int num = 0;
void Score(int age);
/*default void Score(int age) {
//Implementation
}*/
}
class MasterCard implements CreditCard {
@Override
public void Score(int age) {
if(age>40)
System.out.println("Negative");
else
System.out.println("Positive");
}
}
| [
"[email protected]"
] | |
d2171b47ddbca73807bbdda72138bae74bc2b698 | 794aa335f0499bb36465e3eae5693fa4300be819 | /IGTI/DesafioModulo3/src/entidades/Pessoa.java | ff3c0cf04d9cc2e5429bd8151fb6c1281f5ccfe8 | [
"MIT"
] | permissive | larissaloureiro/java-exercises | af2364f53aff4eab857a6a2c9685458d1199d98c | 4d48a7d666ccf674875bfefa45ff97672ab83741 | refs/heads/main | 2023-05-07T21:28:40.225679 | 2021-05-28T02:04:50 | 2021-05-28T02:04:50 | 369,244,383 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 314 | java | package entidades;
public abstract class Pessoa {
protected String nome;
protected String cpf;
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
}
| [
"[email protected]"
] | |
b16ffe918af0317f619b67a9388c69278b6c75d5 | b2bfac7b91b2542228931c10c668ca2f67e86b51 | /fba/app/src/main/java/com/ppu/fba/ui/dy.java | 79e21470938225998d695b9ccf0625d92c48f08f | [] | no_license | abozanona/fbaAndroid | b58be90fc94ceec5170d84133c1e8c4e2be8806f | f058eb0317df3e76fd283e285c4dd3dbc354aef5 | refs/heads/master | 2021-09-26T22:05:31.517265 | 2018-11-03T07:21:17 | 2018-11-03T07:21:17 | 108,681,428 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 506 | java | package com.ppu.fba.ui;
import com.ppu.fba.p009d.C0309f;
import java.util.Comparator;
public class dy implements Comparator {
final /* synthetic */ bg f1790a;
dy(bg bgVar) {
this.f1790a = bgVar;
}
public int m2130a(String str, String str2) {
return (str == null || str2 == null) ? -1 : C0309f.m1980c(str).compareTo(C0309f.m1980c(str2));
}
public /* synthetic */ int compare(Object obj, Object obj2) {
return m2130a((String) obj, (String) obj2);
}
}
| [
"[email protected]"
] | |
e716fc740e95eb0ccfc1dfbdaec36a05d1f16e49 | 74d4626d88eb55e320146c59f45a38597861c1c7 | /Chapter 9 - Iterator and Composite Patterns/PancakeHouseMerge/src/IteratorWayImprovedMergedCafe/CafeMenu.java | 953dcf0a7951a76e286ede4ae74b703b73b1bd00 | [] | no_license | ioanzicu/design-patterns-java | 95a0d746e3c342a2bda2d5e6a5269009cab3584a | 9acb70ca1e64039070f3bed6f352777176aa911a | refs/heads/main | 2023-07-25T12:05:24.609472 | 2021-09-08T09:10:56 | 2021-09-08T09:10:56 | 404,259,865 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,050 | java | package IteratorWayImprovedMergedCafe;
import java.util.Hashtable;
import java.util.Iterator;
public class CafeMenu implements Menu {
Hashtable<String, Object> menuItems = new Hashtable<>();
public CafeMenu() {
addItem("Veggie Pierogi",
"Veggie Pierogi with potatos and tomatoes",
true,
3.99);
addItem("Soup of the day",
"A cup of the soup of the day, with a side salad",
false,
3.69);
addItem("Burrito",
"A large burrito, with whole pinto beans, salsa, guacamole",
true,
4.29);
}
public void addItem(String name, String description,
boolean vegetarian, double price) {
MenuItem menuItem = new MenuItem(name, description, vegetarian, price);
menuItems.put(menuItem.getName(), menuItem);
}
@Override
public Iterator<Object> createIterator() {
return menuItems.values().iterator();
}
}
| [
"[email protected]"
] | |
7dc9735427dfa4d5a8d734963d18807735324f57 | 413590c0d8aa7f59860124cc79310d57217f2a17 | /Functional Programming And Lambda Expressions/ExerciseStream/src/entities/Product.java | 817ddfd5dc8105cf53fc8515e36c6602a6e02c21 | [] | no_license | enzofalvo/estudies-java | 3c2b6bc4f818fd634bacbfabd615bd7dc11345b6 | e5ad69eb6e3fc16a1c4ac77b27becbbe1ea7b0ce | refs/heads/master | 2022-11-14T16:43:53.912764 | 2020-06-26T19:01:58 | 2020-06-26T19:01:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 605 | java |
package entities;
public class Product {
private String name;
private Double price;
public Product(String name, Double price) {
this.name = name;
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Double getPrice() {
return price;
}
public void setPrice(Double price) {
this.price = price;
}
@Override
public String toString() {
return "Product{" + "name=" + name + ", price=" + price + '}';
}
}
| [
"[email protected]"
] | |
acbea6f256805893bf548c0ac821411c2455bd90 | b3cc0a05955c6b6682281924369719f095dcac04 | /splitwise/src/main/java/com/lld/splitwise/splitwise/models/split/PercentSplit.java | 9608eb0ebd4f60ea477dfbcbfe467c9b4585231f | [] | no_license | Akash1304/LLD | 63f28bd017be43dffb728d287b37adb78023482c | 1a610b6ed8ba2971657a20fe0448bbaf68397779 | refs/heads/main | 2023-07-05T12:15:04.877144 | 2021-08-11T14:38:23 | 2021-08-11T14:38:23 | 393,258,278 | 0 | 0 | null | 2021-08-11T14:33:24 | 2021-08-06T05:12:34 | Java | UTF-8 | Java | false | false | 357 | java | package com.lld.splitwise.splitwise.models.split;
import com.lld.splitwise.splitwise.models.User;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PercentSplit extends Split {
private double percentage;
public PercentSplit(User user, double percentage) {
super(user);
this.percentage = percentage;
}
}
| [
"[email protected]"
] | |
a6975b8569307135f02b57d66b145fdf3ed49ad2 | 8217a23d88d4c230a3ace95c722c2c752713b8ec | /app/src/main/java/com/cds/iot/util/DimenUtils.java | b7d300053c1c0997ce9378787f88b8d453fffb18 | [
"Apache-2.0"
] | permissive | TonyJava/Iot_Project | b1d370c9c0c76713adf2b471c5aab6f9ed857850 | 68ab418cb934c267897a166b39e2ee3f0c0f3caf | refs/heads/master | 2022-02-22T08:44:51.481730 | 2019-07-02T09:33:25 | 2019-07-02T09:33:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,976 | java | package com.cds.iot.util;
import android.content.Context;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by Michael Smith on 2016/8/2.
*/
public class DimenUtils {
/**
* dp转px
*/
public static int dp2px(Context context, float dpValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dpValue * scale + 0.5f);
}
/**
* px转dp
*/
public static int px2dp(Context context, float pxValue) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (pxValue / scale + 0.5f);
}
/**
* sp转px
*/
public static int sp2px(Context context, float spValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (spValue * fontScale + 0.5f);
}
/**
* px转sp
*/
public static int px2sp(Context context, float pxValue) {
final float fontScale = context.getResources().getDisplayMetrics().scaledDensity;
return (int) (pxValue / fontScale + 0.5f);
}
/**
* 各种单位转换
* 该方法存在于TypedValue
*/
public static float applyDimension(int unit, float value, DisplayMetrics metrics) {
switch (unit) {
case TypedValue.COMPLEX_UNIT_PX:
return value;
case TypedValue.COMPLEX_UNIT_DIP:
return value * metrics.density;
case TypedValue.COMPLEX_UNIT_SP:
return value * metrics.scaledDensity;
case TypedValue.COMPLEX_UNIT_PT:
return value * metrics.xdpi * (1.0f / 72);
case TypedValue.COMPLEX_UNIT_IN:
return value * metrics.xdpi;
case TypedValue.COMPLEX_UNIT_MM:
return value * metrics.xdpi * (1.0f / 25.4f);
}
return 0;
}
/**
* 在onCreate()即可强行获取View的尺寸
*/
public static int[] forceGetViewSize(View view) {
int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(widthMeasureSpec, heightMeasureSpec);
return new int[]{view.getMeasuredWidth(), view.getMeasuredHeight()};
}
/**
* ListView中提前测量View尺寸
* 如headerView,用的时候拷贝到ListView中
*/
private void measureView(View view) {
ViewGroup.LayoutParams p = view.getLayoutParams();
if (p == null) {
p = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
}
int width = ViewGroup.getChildMeasureSpec(0, 0, p.width);
int height;
int tempHeight = p.height;
if (tempHeight > 0) {
height = View.MeasureSpec.makeMeasureSpec(tempHeight,
View.MeasureSpec.EXACTLY);
} else {
height = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
}
view.measure(width, height);
}
}
| [
"[email protected]"
] | |
f10676eb554eaa7007062712ab9d5541ec8b0c0b | 8d9899bb30f5c30ad5942f8b92999739668c061b | /src/main/java/me/uquark/barrymore/internal/DatabaseProvider.java | 84af808be084c5b56195f65e3599f946d4488da5 | [] | no_license | UQuark/Barrymore | 8ba7dabe7b6dd1a855b504fb2751c02c4d27a8ae | bfe0b7523c30f3323c11a663ed996e2068722cd6 | refs/heads/master | 2023-07-08T21:56:01.308826 | 2020-03-05T12:33:51 | 2020-03-05T12:33:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,221 | java | package me.uquark.barrymore.internal;
import me.uquark.barrymore.Application;
import org.h2.tools.Server;
import javax.sql.rowset.CachedRowSet;
import javax.sql.rowset.RowSetProvider;
import java.net.MalformedURLException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class DatabaseProvider {
private static Server server = null;
private static String url = "";
public static void startServer() throws SQLException, MalformedURLException {
url = "jdbc:h2:" + Application.BARRYMORE_HOME + "database";
if (server != null && server.isRunning(false))
return;
server = Server.createTcpServer("-tcpPort", "0");
}
public static void stopServer() {
server.stop();
}
public static CachedRowSet query(String query) throws SQLException {
Connection connection = DriverManager.getConnection(url, "barrymore", "");
Statement statement = connection.createStatement();
CachedRowSet result = RowSetProvider.newFactory().createCachedRowSet();
result.populate(statement.executeQuery(query));
connection.close();
return result;
}
}
| [
"[email protected]"
] | |
95d76675ebd944407f32ff453cba6337e4b58a37 | dab84f47bda8ec2588ac0acf1de0c79a47d55a29 | /java/src/headfirst/iterator/dinermerger/DinerMenu.java | bbf96ed87bb29e80b1c771097de15f889f8b452d | [] | no_license | RobinNunkesser/HeadFirstDesignPatterns | ecd1ebb970b6b67641df43fb259f8ee20c4b2f18 | 2b3d9c5d8c4d498cc5008991e4ac4796583f7492 | refs/heads/master | 2022-07-17T19:44:49.383898 | 2020-05-19T20:48:37 | 2020-05-19T20:48:37 | 263,099,648 | 2 | 0 | null | 2020-05-11T16:37:32 | 2020-05-11T16:37:32 | null | UTF-8 | Java | false | false | 1,602 | java | package headfirst.iterator.dinermerger;
public class DinerMenu implements Menu {
static final int MAX_ITEMS = 6;
int numberOfItems = 0;
MenuItem[] menuItems;
public DinerMenu() {
menuItems = new MenuItem[MAX_ITEMS];
addItem("Vegetarian BLT",
"(Fakin') Bacon with lettuce & tomato on whole wheat", true, 2.99);
addItem("BLT",
"Bacon with lettuce & tomato on whole wheat", false, 2.99);
addItem("Soup of the day",
"Soup of the day, with a side of potato salad", false, 3.29);
addItem("Hotdog",
"A hot dog, with saurkraut, relish, onions, topped with cheese",
false, 3.05);
addItem("Steamed Veggies and Brown Rice",
"Steamed vegetables over brown rice", true, 3.99);
addItem("Pasta",
"Spaghetti with Marinara Sauce, and a slice of sourdough bread",
true, 3.89);
}
public void addItem(String name, String description,
boolean vegetarian, double price)
{
MenuItem menuItem = new MenuItem(name, description, vegetarian, price);
if (numberOfItems >= MAX_ITEMS) {
System.err.println("Sorry, menu is full! Can't add item to menu");
} else {
menuItems[numberOfItems] = menuItem;
numberOfItems = numberOfItems + 1;
}
}
public MenuItem[] getMenuItems() {
return menuItems;
}
public Iterator createIterator() {
return new DinerMenuIterator(menuItems);
}
// other menu methods here
}
| [
"[email protected]"
] | |
3aed11e15e13feac2ce3a469f8dff778de4ee3f1 | c4d170c50fb270b22c127c7e77efdcb48a07b080 | /src/main/java/com/jack/tmall/dao/PropertyDAO.java | 5013e1950954285bb4155578bfeb999c4da4588f | [] | no_license | Jack-RSW/springboot_tmall | 0e9747973aac75f497b85fa1ea12b03a4fd08e39 | 7b6259333ceb51fd6da03e530b6a2f84e0096435 | refs/heads/master | 2022-06-27T15:04:12.893618 | 2019-08-12T02:21:47 | 2019-08-12T02:21:47 | 201,842,311 | 0 | 0 | null | 2022-06-21T01:38:51 | 2019-08-12T02:20:13 | JavaScript | UTF-8 | Java | false | false | 524 | java | package com.jack.tmall.dao;
import com.jack.tmall.pojo.Category;
import com.jack.tmall.pojo.Product;
import com.jack.tmall.pojo.Property;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface PropertyDAO extends JpaRepository<Property,Integer> {
Page<Property> findByCategory(Category category, Pageable pageable);
List<Property> findByCategory(Category category);
}
| [
"[email protected]"
] | |
9ad6b12594b70a799d9e6f255852e64973f58d0f | 98f56dc73b28e9df61bf573c872f3d7d4dfd2e6a | /classlib/java.xml/src/main/resources/META-INF/modules/java.xml/classes/com/sun/org/apache/bcel/internal/generic/DUP.java | 22dcebfa689fd40dd8d87bf373ed661423bdb9b7 | [
"Apache-2.0"
] | permissive | seanmcox/Bytecoder | 8b136029bdcad23b244099b95da70d5cd8b9b259 | 98a5c8e376225a9be6293bd10bf186d415e0d716 | refs/heads/master | 2020-12-02T09:16:13.129224 | 2020-01-04T10:19:39 | 2020-01-04T10:19:39 | 230,958,751 | 0 | 0 | Apache-2.0 | 2019-12-30T18:04:29 | 2019-12-30T18:04:29 | null | UTF-8 | Java | false | false | 1,761 | java | /*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* 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 com.sun.org.apache.bcel.internal.generic;
/**
* DUP - Duplicate top operand stack word
* <PRE>Stack: ..., word -> ..., word, word</PRE>
*
* @version $Id: DUP.java 1747278 2016-06-07 17:28:43Z britter $
*/
public class DUP extends StackInstruction implements PushInstruction {
public DUP() {
super(com.sun.org.apache.bcel.internal.Const.DUP);
}
/**
* Call corresponding visitor method(s). The order is:
* Call visitor methods of implemented interfaces first, then
* call methods according to the class hierarchy in descending order,
* i.e., the most specific visitXXX() call comes last.
*
* @param v Visitor object
*/
@Override
public void accept( final Visitor v ) {
v.visitStackProducer(this);
v.visitPushInstruction(this);
v.visitStackInstruction(this);
v.visitDUP(this);
}
}
| [
"[email protected]"
] | |
94a14bba86d77aca62b72388030075c8f604fa6a | 3b14f2674d39ec729b3ac41628a2920eef45ee1d | /src/main/java/com/baomidou/springboot/entity/Users.java | 4d08e8c3170a68e439d66d8ae1a9f253588c2a1c | [] | no_license | sparkvip/Sharing-SpringBoot | edbc37c19ebd8fe3cc5eef042569dca33a44b4cb | e1736901853bd8fdeb39c336a44c9b244864b2e4 | refs/heads/master | 2022-01-08T17:57:45.529809 | 2019-05-16T05:22:07 | 2019-05-16T05:22:07 | 180,062,913 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 966 | java | package com.baomidou.springboot.entity;
import java.beans.Transient;
import java.util.Date;
import lombok.Data;
/**
* 用户表
*/
@SuppressWarnings("serial")
@Data
public class Users extends SuperEntity<Users> {
/**
* 名称
*/
private String name;
/**
* 学院
*/
private String insititute;
/**
* 密码
*/
private String password;
/**
* 头像
*/
private String portrait;
/**
* 权限
*/
private String privilege;
/**
* 电话
*/
private String phone;
@Override
public String toString() {
return "Users{" +
"name='" + name + '\'' +
", insititute='" + insititute + '\'' +
", password='" + password + '\'' +
", portrait='" + portrait + '\'' +
", privilege='" + privilege + '\'' +
", phone='" + phone + '\'' +
'}';
}
}
| [
"[email protected]"
] | |
b0759288f3fb3d663d51e5ad1f3b66c79591432a | 48849d2ddaf3b9ad355b63d241bbcf8fd65f7a23 | /the_4_musketeers_source_code/src/pk6/CarFactory.java | a4e55768cd2698d98934aa36e682e9c7e0639570 | [] | no_license | tech-magic/oop-concepts | 7fd3f6ad2d5faa53ed6be2dd9a5ada009f274b55 | a0e1fd7f4f3afb4701406ab283926ee37468db51 | refs/heads/master | 2021-01-10T22:57:52.564289 | 2016-10-13T10:05:31 | 2016-10-13T10:05:31 | 69,718,349 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 512 | java | package pk6;
public class CarFactory implements AbstractProductFactory {
public IProduct createProductByModel(String model) {
if(model.equals("civic")) { return new CivicCar(); }
else if(model.equals("vitz")) { return new VitzCar(); }
else { throw new IllegalArgumentException("Invalid Model ...");
}
}
public SalesCenter[] getAllSalesCenters() {
return new SalesCenter[] {
new CarSalesCenter("malabe", "malabe"),
new CarSalesCenter("wattala", "wattala")
};
}
}
| [
"[email protected]"
] | |
6a31b29a1b5ce9ace651c555e7f9aab3e3d95895 | 9bc72ca5c7cb823b207ee250c0f0fa9c2426a510 | /src/org/mybatis/page/MySQLServerDialect.java | fd24953268f6572ec42995b72317445b5440a3b6 | [] | no_license | fnet123/mybatispage | 5fe8bb1525bbd86eb2d981a42a5d2985c24471d1 | 46a7d2a4be60cc4ad797ed36d94893590bb1e794 | refs/heads/master | 2021-01-18T10:14:11.813611 | 2014-05-21T02:29:29 | 2014-05-21T02:29:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 762 | java | package org.mybatis.page;
public class MySQLServerDialect extends Dialect {
public boolean supportsLimitOffset() {
return true;
}
public boolean supportsLimit() {
return true;
}
static int getAfterSelectInsertPoint(String sql) {
int selectIndex = sql.toLowerCase().indexOf("select");
final int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
}
public String getLimitString(String sql, int offset, int limit) {
sql = sql.trim();
StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);
pagingSelect.append(sql);
pagingSelect.append(" limit " + offset + "," + limit);
return pagingSelect.toString();
}
} | [
"meiwenhui@ThinkPad-Edge-E431"
] | meiwenhui@ThinkPad-Edge-E431 |
1d23c65320466521080287be1c0db981a84348eb | 1b1eabbc2784c1cc9268ec952f0e363b9dc0270e | /src/main/java/tv/floe/metronome/deeplearning/datasets/MnistManager.java | 8c45ea7cbd836ee62445747d0be5b2e8bc35b3dd | [
"Apache-2.0"
] | permissive | jibaro/Metronome | 35606dc7f9dbc8d32458205e0eb48ab20d808844 | c9889484eb081329f185dea416779cfeef3bf402 | refs/heads/master | 2021-01-18T00:42:28.280366 | 2014-06-24T22:45:31 | 2014-06-24T22:45:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,902 | java | package tv.floe.metronome.deeplearning.datasets;
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
/**
* <p>
* Utility class for working with the MNIST database.
* <p>
* Provides methods for traversing the images and labels data files separately,
* as well as simultaneously.
* <p>
* Provides also method for exporting an image by writing it as a PPM file.
* <p>
* Example usage:
* <pre>
* MnistManager m = new MnistManager("t10k-images.idx3-ubyte", "t10k-labels.idx1-ubyte");
* m.setCurrent(10); //index of the image that we are interested in
* int[][] image = m.readImage();
* System.out.println("Label:" + m.readLabel());
* MnistManager.writeImageToPpm(image, "10.ppm");
* </pre>
*
*
* @author Adam Gibson
*/
public class MnistManager {
private MnistImageFile images;
private MnistLabelFile labels;
/**
* Writes the given image in the given file using the PPM data format.
*
* @param image
* @param ppmFileName
* @throws IOException
*/
public static void writeImageToPpm(int[][] image, String ppmFileName) throws IOException {
BufferedWriter ppmOut = null;
try {
ppmOut = new BufferedWriter(new FileWriter(ppmFileName));
int rows = image.length;
int cols = image[0].length;
ppmOut.write("P3\n");
ppmOut.write("" + rows + " " + cols + " 255\n");
for (int i = 0; i < rows; i++) {
StringBuffer s = new StringBuffer();
for (int j = 0; j < cols; j++) {
s.append(image[i][j] + " " + image[i][j] + " " + image[i][j] + " ");
}
ppmOut.write(s.toString());
}
} finally {
ppmOut.close();
}
}
/**
* Constructs an instance managing the two given data files. Supports
* <code>NULL</code> value for one of the arguments in case reading only one
* of the files (images and labels) is required.
*
* @param imagesFile
* Can be <code>NULL</code>. In that case all future operations
* using that file will fail.
* @param labelsFile
* Can be <code>NULL</code>. In that case all future operations
* using that file will fail.
* @throws IOException
*/
public MnistManager(String imagesFile, String labelsFile) throws IOException {
if (imagesFile != null) {
images = new MnistImageFile(imagesFile, "r");
}
if (labelsFile != null) {
labels = new MnistLabelFile(labelsFile, "r");
}
}
/**
* Reads the current image.
*
* @return matrix
* @throws IOException
*/
public int[][] readImage() throws IOException {
if (images == null) {
throw new IllegalStateException("Images file not initialized.");
}
return images.readImage();
}
/**
* Set the position to be read.
*
* @param index
*/
public void setCurrent(int index) {
images.setCurrentIndex(index);
labels.setCurrentIndex(index);
}
/**
* Reads the current label.
*
* @return int
* @throws IOException
*/
public int readLabel() throws IOException {
if (labels == null) {
throw new IllegalStateException("labels file not initialized.");
}
return labels.readLabel();
}
/**
* Get the underlying images file as {@link MnistImageFile}.
*
* @return {@link MnistImageFile}.
*/
public MnistImageFile getImages() {
return images;
}
/**
* Get the underlying labels file as {@link MnistLabelFile}.
*
* @return {@link MnistLabelFile}.
*/
public MnistLabelFile getLabels() {
return labels;
}
} | [
"[email protected]"
] | |
c1f8c10cd4248f71f40057d66044472d784e1db9 | 169b065939fd42c2561261eb5ae5c772da73af0e | /calculadora/Calculadora.java | e940cc6f232e339a4e601548f07d48680eb2776c | [] | no_license | VianeyCA/E1U1Calculadora | 1264a06e2c529752821b44b93aeb20f8ade3b124 | dc6d960a9a194b327fa42615b4dcd1dc527e159f | refs/heads/master | 2022-12-17T22:31:09.300013 | 2020-09-24T13:50:50 | 2020-09-24T13:50:50 | 298,164,545 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,013 | java | package calculadora;
import java.util.Scanner;
import Logica.Operaciones;
public class Calculadora {
public static void main(String[] args) {
Scanner leer=new Scanner(System.in);
Operaciones opera= new Operaciones();
int opc,op;
String resp="si";
System.out.println("Ingrese el numero de la operacion a realizar: ");
System.out.println("1.-Suma");
System.out.println("2.-Resta");
System.out.println("3.-Multiplicacion");
System.out.println("4.-Division");
System.out.println("5.-Salir");
opc=leer.nextInt();
switch (opc){
case 1:
opera.DatosSuma();
// op();
break;
case 2:
opera.DatosResta();
//op();
break;
case 3:
opera.DatosMultiplicación();
// op();
break;
case 4:
opera.DatosDivision();
//op();
break;
case 5:
//5 default:
System.out.println("Programa Terminado");
System.exit(0);
// op();
break;
default:
System.out.println("Valor no encontrado");
}
System.out.println("\" Deseas continuar con las operaciones 1.-Si / 2.- No \"");
op=leer.nextInt();
if(op==1){
Calculadora.main(args);
} else{
System.out.println("Programa Terminado");
System.exit(0);
}
}
private static void main() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
| [
"[email protected]"
] | |
d97ed33c1b4c011248aaa28ea8172309d77d0060 | 2bef59efd6fbf74a0168debfe4b5c3eaf5616a08 | /src/main/java/net/fabricmc/loader/transformer/EnvironmentStrippingData.java | cdd7c295b94a7b28d687bfd70ca85f79768877b2 | [
"Apache-2.0"
] | permissive | modmuss50/fabric-loader | 07476f6570c563c1fb9d8cb91c8fd56494851527 | c46087e6bc8265fa7781bc861a6a5c02f4d0fc23 | refs/heads/master | 2023-07-06T21:42:20.226007 | 2019-09-18T21:41:21 | 2019-09-18T21:41:21 | 211,907,484 | 4 | 1 | Apache-2.0 | 2021-06-24T06:50:57 | 2019-09-30T16:43:35 | null | UTF-8 | Java | false | false | 5,052 | java | /*
* Copyright 2016 FabricMC
*
* 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 net.fabricmc.loader.transformer;
import net.fabricmc.api.Environment;
import net.fabricmc.api.EnvironmentInterface;
import net.fabricmc.api.EnvironmentInterfaces;
import org.objectweb.asm.*;
import java.util.Collection;
import java.util.HashSet;
/**
* Scans a class for Environment and EnvironmentInterface annotations to figure out what needs to be stripped.
*/
public class EnvironmentStrippingData extends ClassVisitor {
private static final String ENVIRONMENT_DESCRIPTOR = Type.getDescriptor(Environment.class);
private static final String ENVIRONMENT_INTERFACE_DESCRIPTOR = Type.getDescriptor(EnvironmentInterface.class);
private static final String ENVIRONMENT_INTERFACES_DESCRIPTOR = Type.getDescriptor(EnvironmentInterfaces.class);
private final String envType;
private boolean stripEntireClass = false;
private final Collection<String> stripInterfaces = new HashSet<>();
private final Collection<String> stripFields = new HashSet<>();
private final Collection<String> stripMethods = new HashSet<>();
private class EnvironmentAnnotationVisitor extends AnnotationVisitor {
private final Runnable onEnvMismatch;
private EnvironmentAnnotationVisitor(int api, Runnable onEnvMismatch) {
super(api);
this.onEnvMismatch = onEnvMismatch;
}
@Override
public void visitEnum(String name, String descriptor, String value) {
if ("value".equals(name) && !envType.equals(value)) {
onEnvMismatch.run();
}
}
}
private class EnvironmentInterfaceAnnotationVisitor extends AnnotationVisitor {
private boolean envMismatch;
private Type itf;
private EnvironmentInterfaceAnnotationVisitor(int api) {
super(api);
}
@Override
public void visitEnum(String name, String descriptor, String value) {
if ("value".equals(name) && !envType.equals(value)) {
envMismatch = true;
}
}
@Override
public void visit(String name, Object value) {
if ("itf".equals(name)) {
itf = (Type) value;
}
}
@Override
public void visitEnd() {
if (envMismatch) {
stripInterfaces.add(itf.getInternalName());
}
}
}
private AnnotationVisitor visitMemberAnnotation(String descriptor, boolean visible, Runnable onEnvMismatch) {
if (ENVIRONMENT_DESCRIPTOR.equals(descriptor)) {
return new EnvironmentAnnotationVisitor(api, onEnvMismatch);
}
return null;
}
public EnvironmentStrippingData(int api, String envType) {
super(api);
this.envType = envType;
}
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
if (ENVIRONMENT_DESCRIPTOR.equals(descriptor)) {
return new EnvironmentAnnotationVisitor(api, () -> stripEntireClass = true);
} else if (ENVIRONMENT_INTERFACE_DESCRIPTOR.equals(descriptor)) {
return new EnvironmentInterfaceAnnotationVisitor(api);
} else if (ENVIRONMENT_INTERFACES_DESCRIPTOR.equals(descriptor)) {
return new AnnotationVisitor(api) {
@Override
public AnnotationVisitor visitArray(String name) {
if ("value".equals(name)) {
return new AnnotationVisitor(api) {
@Override
public AnnotationVisitor visitAnnotation(String name, String descriptor) {
return new EnvironmentInterfaceAnnotationVisitor(api);
}
};
}
return null;
}
};
}
return null;
}
@Override
public FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
return new FieldVisitor(api) {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return visitMemberAnnotation(descriptor, visible, () -> stripFields.add(name + descriptor));
}
};
}
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
String methodId = name + descriptor;
return new MethodVisitor(api) {
@Override
public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
return visitMemberAnnotation(descriptor, visible, () -> stripMethods.add(methodId));
}
};
}
public boolean stripEntireClass() {
return stripEntireClass;
}
public Collection<String> getStripInterfaces() {
return stripInterfaces;
}
public Collection<String> getStripFields() {
return stripFields;
}
public Collection<String> getStripMethods() {
return stripMethods;
}
public boolean isEmpty() {
return stripInterfaces.isEmpty() && stripFields.isEmpty() && stripMethods.isEmpty();
}
}
| [
"[email protected]"
] | |
20122434af1ad34e5165a365a53e26a4425ca81a | 08760a7c942d7b8fc2cafaab3c429983e755dce2 | /src/helimy/project/model/PaymentListDTO.java | dff9cf318fad9605c0fe68b227d027e069e8934b | [] | no_license | JYoung-lee/Helimy | e195d64ec0b51f245838e6e363602d6e5087c3ea | d183b3136c27f91fdb3e8d4d5c2ab262351a2ee6 | refs/heads/master | 2023-04-01T08:37:39.444022 | 2021-04-13T05:51:01 | 2021-04-13T05:51:01 | 357,436,243 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,773 | java | package helimy.project.model;
import java.sql.Timestamp;
public class PaymentListDTO {
private Integer paymentcode; // 결제코드
private Timestamp reg; // 결제 시간
private String shopname; // 매장명
private String productname; // 상품명
private Integer price; // 가격
private String state; //결제상태
private String id; // 아이디
private Integer productcode; // 상품코드
private Integer francode; // 매장코드
public Integer getPaymentcode() {
return paymentcode;
}
public void setPaymentcode(Integer paymentcode) {
this.paymentcode = paymentcode;
}
public Timestamp getReg() {
return reg;
}
public void setReg(Timestamp reg) {
this.reg = reg;
}
public String getShopname() {
return shopname;
}
public void setShopname(String shopname) {
this.shopname = shopname;
}
public String getProductname() {
return productname;
}
public void setProductname(String productname) {
this.productname = productname;
}
public Integer getPrice() {
return price;
}
public void setPrice(Integer price) {
this.price = price;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Integer getProductcode() {
return productcode;
}
public void setProductcode(Integer productcode) {
this.productcode = productcode;
}
public Integer getFrancode() {
return francode;
}
public void setFrancode(Integer francode) {
this.francode = francode;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
} | [
"[email protected]"
] | |
5233d4c3aa9a1fbc042048cad838b6c548933ba0 | a8a89f61d0c462b1b334f69ca742e6c70b6b60a0 | /SpringBoot/src/main/java/com/example/test/comm/base/BaseTools.java | 7fe4bea646940a8a879d1cde79222efc99e5f3fc | [] | no_license | xiaohe-2020/manager | d52171bc00a5b26399e8f4c8a054afa49f951b56 | 2c4eaeb1bd3e581f6a37dacaaf42c2a33dd1df28 | refs/heads/main | 2023-05-11T03:00:25.367552 | 2021-06-03T09:35:37 | 2021-06-03T09:35:37 | 311,593,676 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package com.example.test.comm.base;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
import java.util.UUID;
import org.springframework.util.StringUtils;
public class BaseTools {
public boolean _isNum(String str) {
return str.matches("^[-+]?(([0-9]+)([.]([0-9]+))?|(([0-9]+))?)$");
}
}
| [
"[email protected]"
] | |
b05856e954c8675498f75b256aff602ef5834d60 | 21870efa56b3e4f4337f40cc059aee11e3e42fc5 | /core/management/src/main/java/uk/ac/ebi/interpro/scan/management/model/implementations/superfamily/RunSuperFamilyAss3Step.java | 5512844615eedd3e0832254e92d628b5df827c13 | [
"Apache-2.0"
] | permissive | Shicheng-Guo/interproscan | f15b73ec6be64203b554ef34b5cde6c3bcbcf92b | 25feb0729c9ba81b58ae6c748b528ea169f9475f | refs/heads/master | 2022-04-26T22:33:19.735644 | 2020-03-10T15:10:00 | 2020-03-10T15:10:00 | 261,788,293 | 0 | 1 | Apache-2.0 | 2020-05-06T14:42:39 | 2020-05-06T14:42:37 | null | UTF-8 | Java | false | false | 4,691 | java | package uk.ac.ebi.interpro.scan.management.model.implementations.superfamily;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Required;
import uk.ac.ebi.interpro.scan.management.model.StepInstance;
import uk.ac.ebi.interpro.scan.management.model.implementations.RunBinaryStep;
import java.util.ArrayList;
import java.util.List;
/**
* This step defines running the SuperFamily Perl script.
*
* @author Matthew Fraser
* @version $Id$
* @since 1.0-SNAPSHOT
*/
public class RunSuperFamilyAss3Step extends RunBinaryStep {
private static final Logger LOGGER = Logger.getLogger(RunSuperFamilyAss3Step.class.getName());
private String perlCommand;
private String fullPathToSuperFamilyAss3PerlScript;
private String fullPathToSelfHitsFile;
private String fullPathToClaFile;
private String fullPathToModelTabFile;
private String fullPathToPDBJ95DFile;
private String fastaFileNameTemplate;
private String hmmer3ResultsFileNameTemplate;
private String binaryOutputFileNameTemplate;
@Required
public void setPerlCommand(String perlCommand) {
this.perlCommand = perlCommand;
}
@Required
public void setFullPathToSuperFamilyAss3PerlScript(String fullPathToSuperFamilyAss3PerlScript) {
this.fullPathToSuperFamilyAss3PerlScript = fullPathToSuperFamilyAss3PerlScript;
}
@Required
public void setFullPathToSelfHitsFile(String fullPathToSelfHitsFile) {
this.fullPathToSelfHitsFile = fullPathToSelfHitsFile;
}
@Required
public void setFullPathToClaFile(String fullPathToClaFile) {
this.fullPathToClaFile = fullPathToClaFile;
}
@Required
public void setFullPathToModelTabFile(String fullPathToModelTabFile) {
this.fullPathToModelTabFile = fullPathToModelTabFile;
}
@Required
public void setFullPathToPDBJ95DFile(String fullPathToPDBJ95DFile) {
this.fullPathToPDBJ95DFile = fullPathToPDBJ95DFile;
}
@Required
public void setFastaFileNameTemplate(String fastaFileNameTemplate) {
this.fastaFileNameTemplate = fastaFileNameTemplate;
}
@Required
public void setHmmer3ResultsFileNameTemplate(String hmmer3ResultsFileNameTemplate) {
this.hmmer3ResultsFileNameTemplate = hmmer3ResultsFileNameTemplate;
}
@Required
public void setBinaryOutputFileNameTemplate(String binaryOutputFileNameTemplate) {
this.binaryOutputFileNameTemplate = binaryOutputFileNameTemplate;
}
/**
* Create the command ready to run the binary.
* <p/>
* Example:
* <p/>
* perl ass3.pl -e 0.0001 -s data/superfamily/1.75/self_hits.tab -r data/superfamily/1.75/dir.cla.scop.txt_1.75 -m data/superfamily/1.75/model.tab -p data/superfamily/1.75/pdbj95d -t n -f 1 INPUT_SEQUENCE_FILE HMMER3_OUTPUT_FILE PP_OUTPUT_FILE
*
* @param stepInstance containing the parameters for executing.
* @param temporaryFileDirectory is the relative path in which files are stored.
* @return The command
*/
@Override
protected List<String> createCommand(StepInstance stepInstance, String temporaryFileDirectory) {
final String fastaFilePathName = stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory, this.fastaFileNameTemplate);
final String hmmer3ResultsFilePathName = stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory, this.hmmer3ResultsFileNameTemplate);
final String binaryOutputFilePathName = stepInstance.buildFullyQualifiedFilePath(temporaryFileDirectory, this.binaryOutputFileNameTemplate);
List<String> command = new ArrayList<String>();
command.add(this.perlCommand); // Run the perl script using installed version of Perl
command.add(this.fullPathToSuperFamilyAss3PerlScript);
command.addAll(this.getBinarySwitchesAsList());
command.add("-s");
command.add(this.fullPathToSelfHitsFile);
command.add("-r");
command.add(this.fullPathToClaFile);
command.add("-m");
command.add(this.fullPathToModelTabFile);
command.add("-p");
command.add(this.fullPathToPDBJ95DFile);
command.add(fastaFilePathName); // Input sequences
command.add(hmmer3ResultsFilePathName); // Hmmer3 output from previous step
command.add(binaryOutputFilePathName); // Output file for this binary run
// Note: Superclasses getOutputFileNameTemplate() contains STDOUT from the binary - keep for logging purposes but will probably be empty!
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(command.toString());
}
return command;
}
}
| [
"mr.matthew.fraser@ea5da8b0-6d6b-11de-9de6-4d42d2ab87c0"
] | mr.matthew.fraser@ea5da8b0-6d6b-11de-9de6-4d42d2ab87c0 |
Subsets and Splits