blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a87a518c8ef30d5ec5a2463e3ffa7a64f0fe2a61 | bec69ad08c50d8c7f98ee2f8e5b02a9d02d76a72 | /src/com/oppahansi/ss14/woche1/AddIntegers.java | 4f2448acdf07a5b945f2a278b214691787b5a5a3 | [] | no_license | Kimmydamn/unidue-programmierung | 0f6762778a4b0c058c910f2003888348b3286ad2 | cb065779b0c5b970b9d819dc100b211718510637 | refs/heads/master | 2020-12-26T04:38:02.407174 | 2015-11-10T01:07:49 | 2015-11-10T01:07:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 562 | java | package com.oppahansi.ss14.woche1;
// Integer-Werte addieren
//
// Modifizieren Sie die Methode "add" so, dass sie die Variablen "a" und "b" addiert und das Ergebnis zur�ckgibt.
public class AddIntegers {
// ----- Modifizieren Sie diese Methode -----
public static int add(int a, int b) {
return a + b;
}
// ------------------------------------------
public static void main(String[] args) {
// Testaufruf
int x = 12;
int y = 7;
System.out.println(add(x, y));
}
}
| [
"alexander.schellenberg@mindcurv.com"
] | alexander.schellenberg@mindcurv.com |
e88ffe03ea3f8dd9a66c1c2236edaf6ae3fc013b | 02cdeed0e256dd2ac8e66b8c8d3e0e600a3b74ee | /src/Lapangan.java | 52ab5d9aebc1e687a113b9f86808adc03f67eaa5 | [] | no_license | IndahWA/Latihan-PL-Bab-2 | e0bf0ab294c625e22c081ceb4dd0dd4c2bf472fe | 5482eecf2de427ee734f2da5d2a61ed8b7324fd1 | refs/heads/master | 2021-01-15T10:41:15.792550 | 2016-03-09T16:05:37 | 2016-03-09T16:05:37 | 53,493,951 | 0 | 0 | null | 2016-03-09T11:55:07 | 2016-03-09T11:55:07 | null | UTF-8 | Java | false | false | 222 | java | package Tugas;
public class Lapangan {
double pjg;
double lebar;
public Lapangan(double pjg, double lebar){
this.pjg = pjg;
this.lebar = lebar;
}
public double kelilingLapangan(){
return 2 * (pjg + lebar);
}
}
| [
"Indah WA"
] | Indah WA |
0a1d8516ad46b4f3af55b71c19d6b13621ef24f3 | 242a82937f15d8fcdaa9b89371de0112e1c57479 | /app/src/main/java/com/rishabh/concetto2019/EventPage/MVP/EventContract.java | 313dc61269dd9872eb724ec0669a7aec069140c2 | [] | no_license | rishabh-997/Concetto2019 | 7954770f66c62a9a3f39a8e38a0bc3b5c4c2236e | 2a5f632d088b51efe63e65b556c86b0cec05e8f2 | refs/heads/master | 2021-07-12T00:22:42.907050 | 2020-10-01T04:45:30 | 2020-10-01T04:45:30 | 210,288,745 | 3 | 14 | null | 2020-10-01T04:45:31 | 2019-09-23T07:14:56 | Java | UTF-8 | Java | false | false | 141 | java | package com.rishabh.concetto2019.EventPage.MVP;
public class EventContract
{
interface view{
}
interface presenter{
}
}
| [
"rishabh.agarwal997@gmail.com"
] | rishabh.agarwal997@gmail.com |
6a6ef2782549dc687e48307a9954c1630614f5cc | 415d01811620d6e737c54c937258d7a8a5e11967 | /app/src/main/java/com/lingdongkuaichuan/note/adapter/FolderAdapter.java | 24e6ff9db25a7c110ec011f68be490ec7bc6c487 | [] | no_license | zhoubowen-sky/Note | fe354a5696899c37af34e6c6fb74f58f71953cb5 | 7a3882e1a040be3d89408783f1cec466d028d3ac | refs/heads/master | 2021-01-23T04:48:44.317324 | 2017-06-11T15:15:02 | 2017-06-11T15:15:02 | 92,936,173 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,206 | java | package com.lingdongkuaichuan.note.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.lingdongkuaichuan.note.R;
import com.lingdongkuaichuan.note.bean.Folder;
import com.lingdongkuaichuan.note.utils.DateUtil;
import java.util.ArrayList;
import java.util.List;
/**
* Created by 周博文 on 2017/6/4.
*/
public class FolderAdapter extends BaseAdapter {
private List<Folder> data = new ArrayList<Folder>();
private Context context;
private LayoutInflater layoutInflater;
public FolderAdapter(List<Folder> data, Context context){
this.data = data;
this.context = context;
this.layoutInflater = LayoutInflater.from(context);
}
private class ViewHolder{
public TextView tv_folder_item_name;
public TextView tv_folder_item_date;
}
@Override
public int getCount() {
return data.size();
}
@Override
public Object getItem(int position) {
return data.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (viewHolder == null){
viewHolder = new ViewHolder();
convertView = layoutInflater.inflate(R.layout.folder_item_layout, null);
viewHolder.tv_folder_item_name = (TextView) convertView.findViewById(R.id.tv_folder_item_name);
viewHolder.tv_folder_item_date = (TextView) convertView.findViewById(R.id.tv_folder_item_date);
convertView.setTag(viewHolder);
}else {
viewHolder = (ViewHolder) convertView.getTag();
}
// 绑定数据
viewHolder.tv_folder_item_name.setText(data.get(position).getName());
// 此处将时间戳转换为标准时间格式
String date_str = DateUtil.dateLineToString(data.get(position).getDate());
viewHolder.tv_folder_item_date.setText(date_str);
return convertView;
}
}
| [
"1784225410@qq.com"
] | 1784225410@qq.com |
9d43afd8ddd578fbf97441c7e0c22c17d46b3100 | d2eee6e9a3ad0b3fd2899c3d1cf94778615b10cb | /PROMISE/archives/poi/2.5/org/apache/poi/ddf/EscherRGBProperty.java | 91a7711d7329429334334915db7b2952814658c8 | [] | no_license | hvdthong/DEFECT_PREDICTION | 78b8e98c0be3db86ffaed432722b0b8c61523ab2 | 76a61c69be0e2082faa3f19efd76a99f56a32858 | refs/heads/master | 2021-01-20T05:19:00.927723 | 2018-07-10T03:38:14 | 2018-07-10T03:38:14 | 89,766,606 | 5 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,292 | java | Copyright 2004 Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
package org.apache.poi.ddf;
/**
* A color property.
*
* @author Glen Stampoultzis (glens at apache.org)
*/
public class EscherRGBProperty
extends EscherSimpleProperty
{
public EscherRGBProperty( short propertyNumber, int rgbColor )
{
super( propertyNumber, false, false, rgbColor );
}
public int getRgbColor()
{
return propertyValue;
}
public byte getRed()
{
return (byte) ( propertyValue & 0xFF );
}
public byte getGreen()
{
return (byte) ( (propertyValue >> 8) & 0xFF );
}
public byte getBlue()
{
return (byte) ( (propertyValue >> 16) & 0xFF );
}
}
| [
"hvdthong@github.com"
] | hvdthong@github.com |
d42df796cb89e1b5592799bf855c359eae8378db | b559c1bc31373222caa5cf14d4dc179469bbbe60 | /Swing_Practice/src/model/ClientModel.java | e2019b9e272ce04150f84ddeb1e6d48485a0a74d | [] | no_license | iambashir/NetBeans_Project | 2e48d4734fd8606471afb5cd438b67bb8a3e929a | b929d144301e56c95c5a5af9dad703b8d7a6eef7 | refs/heads/master | 2023-06-16T16:31:49.721602 | 2021-07-02T06:10:19 | 2021-07-02T06:10:19 | 337,303,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 360 | java |
package model;
public class ClientModel {
private int roll;
private String name;
public int getRoll() {
return roll;
}
public void setRoll(int roll) {
this.roll = roll;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"bashir.rasulpur@gmail.com"
] | bashir.rasulpur@gmail.com |
4aa1d38463a78d017bb6682594b14b96920a8402 | bbefc1f75a88e852336787b752bec35356f39ad0 | /src/main/java/yaroslav/model/User.java | 52360cf850c17627b4fbc84daba1e4f03de4fd48 | [
"Apache-2.0"
] | permissive | YaroslavErlikh/webSpring | 4dd4b5fc947632cc8b0665e90940eed446cf80cf | 4ffce429db3a9a7a3ae1eac5cbf75ef03f8ce846 | refs/heads/master | 2022-07-10T00:37:42.421514 | 2021-05-01T04:47:41 | 2021-05-01T04:47:41 | 246,848,996 | 0 | 0 | Apache-2.0 | 2022-06-21T02:58:29 | 2020-03-12T14:02:00 | Java | UTF-8 | Java | false | false | 2,110 | java | package yaroslav.model;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import yaroslav.model.role.Role;
import javax.persistence.*;
import java.util.Collection;
import java.util.Set;
@Entity
@Table(name = "tab_users")
public class User implements UserDetails {
@Id
@Column(name = "id", columnDefinition = "bigint")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "name", columnDefinition = "varchar(255)", unique = true, nullable = false)
private String username;
@Column(name = "password", columnDefinition = "varchar(255)", nullable = false)
private String password;
@Transient
private String passwordConfirm;
@ManyToMany(fetch = FetchType.EAGER)
private Set<Role> roles;
public User() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String getUsername() {
return username;
}
@Override
public boolean isAccountNonExpired() {
return true;
}
@Override
public boolean isAccountNonLocked() {
return true;
}
@Override
public boolean isCredentialsNonExpired() {
return true;
}
@Override
public boolean isEnabled() {
return true;
}
public void setUsername(String username) {
this.username = username;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return getRoles();
}
@Override
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getPasswordConfirm() {
return passwordConfirm;
}
public void setPasswordConfirm(String passwordConfirm) {
this.passwordConfirm = passwordConfirm;
}
public Set<Role> getRoles() {
return roles;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
} | [
"albert_22.11.86@mail.ru"
] | albert_22.11.86@mail.ru |
6cbd3abfe95f755885835bb4bf28084eb57f92cb | 43ba07b17faafdd60c7f80cd6b0dee28f8f4266d | /src/org/toni/bouncingball/game/model/GameItem.java | e437cd7779a1b2fc5e1d641230c88fbaab2e0959 | [] | no_license | tonirs/bouncing-ball | a0058a8e5a6e5ff70036a86384fc7022e5270729 | ff787431caaa31b5241d965c87e33c46f5bda81e | refs/heads/master | 2021-01-10T02:44:23.319427 | 2016-03-13T22:10:31 | 2016-03-13T22:10:31 | 53,006,571 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,466 | java | package org.toni.bouncingball.game.model;
public class GameItem {
protected double y;
protected double x;
private final int height;
private final int width;
protected final double minY;
protected final double maxY;
protected final double minX;
protected final double maxX;
public GameItem(final double Y0, final double X0,
final int height, final int width,
final double minY, final double maxY,
final double minX, final double maxX) {
this.y = Y0;
this.x = X0;
this.height = height;
this.width = width;
this.minY = minY;
this.maxY = maxY - height + 1;
this.minX = minX;
this.maxX = maxX - width + 1;
}
public double getY() {
return y;
}
public void increaseY() {
if(y < maxY) {
++y;
}
}
public void decreaseY() {
if(y > 0.0) {
--y;
}
}
public double getX() {
return x;
}
public void setX(final double x) {
this.x = x;
}
public void increaseX() {
if(x < maxX) {
++x;
}
}
public void decreaseX() {
if(x > 0.0) {
--x;
}
}
public int getHeight() {
return height;
}
public int getWidth() {
return width;
}
public void update(final double deltaInNanos) {
}
}
| [
"tonirs@gmail.com"
] | tonirs@gmail.com |
39f0b9ef0407eda4085d71ecdd7b21bcfd1b296e | 5d00b27e4022698c2dc56ebbc63263f3c44eea83 | /src/com/ah/util/bo/userprofile/selection/PortUserProfileSelectionImpl.java | ff975a190946b770f4a7f6f34df0871ca8e546d2 | [] | no_license | Aliing/WindManager | ac5b8927124f992e5736e34b1b5ebb4df566770a | f66959dcaecd74696ae8bc764371c9a2aa421f42 | refs/heads/master | 2020-12-27T23:57:43.988113 | 2014-07-28T17:58:46 | 2014-07-28T17:58:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 23,210 | java | package com.ah.util.bo.userprofile.selection;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ah.bo.HmBo;
import com.ah.bo.hiveap.ConfigTemplateMdm;
import com.ah.bo.mgmt.QueryBo;
import com.ah.bo.port.PortAccessProfile;
import com.ah.bo.useraccess.UserProfile;
import com.ah.bo.wlan.Cwp;
import com.ah.util.CheckItem2;
import com.ah.util.MgrUtil;
public class PortUserProfileSelectionImpl extends UserProfileSelectionTemplate
implements UserProfileSelection {
private static final String EMPTY_STR = "";
private static final String JOIN_SYMBOL = ": ";
private boolean supportPhone;
@SuppressWarnings("all")
private PortUserProfileSelectionImpl() {
}
public PortUserProfileSelectionImpl(Object boToDeal) {
this.setBoToDeal(boToDeal);
}
public PortUserProfileSelectionImpl(Object boToDeal, Long domainId) {
super(boToDeal, domainId, false);
this.doDataPrepare();
}
public PortUserProfileSelectionImpl(Long id, Class<? extends HmBo> c, Long domainId, boolean supportPhone) {
super(id, c, new LazyUserProfileObjLoader(), domainId, false);
this.supportPhone = supportPhone;
this.doDataPrepare();
}
private PortAccessProfile accessProfile = null;
@Override
@SuppressWarnings("unchecked")
protected PortAccessProfile getMyObject() {
if (this.accessProfile == null
&& this.getBoToDeal() instanceof PortAccessProfile) {
this.accessProfile = (PortAccessProfile)this.getBoToDeal();
}
return this.accessProfile;
}
@Override
public List<CheckItem2> getDefaultUserProfiles() {
return this.defaultUserProfiles;
}
private List<CheckItem2> prepareDefaultUserProfiles() {
if (this.getMyObject() == null) {
return null;
}
Map<Long, CheckItem2> userProfiles =
new HashMap<Long, CheckItem2>(getAvailableUserProfiles());
if (this.getUpType() == UserProfileSelection.USER_PROFILE_TYPE_DEFAULT
&& this.getNewlyAddedUserProfile() != null) {
userProfiles.put(this.getNewlyAddedUserProfile().getId(),
this.encapUpToCheckItem(this.getNewlyAddedUserProfile(), true));
} else if (this.getMyObject().getDefUserProfile() != null) {
userProfiles.put(this.getMyObject().getDefUserProfile().getId(),
this.encapUpToCheckItem(this.getMyObject().getDefUserProfile(), true));
}
List<CheckItem2> userProfileList = new ArrayList<CheckItem2>(userProfiles.values());
Collections.sort(userProfileList,
new CheckItem2ComparatorWithId());
return userProfileList;
}
@Override
public List<CheckItem2> getSelfRegUserProfiles() {
return this.selfUserProfiles;
}
private List<CheckItem2> prepareSelfRegUserProfiles() {
if (this.getMyObject() == null) {
return null;
}
Map<Long, CheckItem2> userProfiles =
new HashMap<Long, CheckItem2>(getAvailableUserProfiles());
if (this.getUpType() == UserProfileSelection.USER_PROFILE_TYPE_REGISTRATION
&& this.getNewlyAddedUserProfile() != null) {
userProfiles.put(this.getNewlyAddedUserProfile().getId(),
this.encapUpToCheckItem(this.getNewlyAddedUserProfile(), true));
} else if (this.getMyObject().getSelfRegUserProfile() != null) {
userProfiles.put(this.getMyObject().getSelfRegUserProfile().getId(),
this.encapUpToCheckItem(this.getMyObject().getSelfRegUserProfile(), true));
}
List<CheckItem2> userProfileList = new ArrayList<CheckItem2>(userProfiles.values());
Collections.sort(userProfileList,
new CheckItem2ComparatorWithId());
return userProfileList;
}
@Override
public List<CheckItem2> getAuthUserProfiles() {
return this.authUserProfiles;
}
private List<CheckItem2> prepareAuthUserProfiles() {
if (this.getMyObject() == null) {
return null;
}
Map<Long, CheckItem2> userProfiles =
new HashMap<Long, CheckItem2>(getAvailableUserProfiles());
if (this.getUpType() == UserProfileSelection.USER_PROFILE_TYPE_AUTH
&& this.getNewlyAddedUserProfile() != null) {
userProfiles.put(this.getNewlyAddedUserProfile().getId(),
this.encapUpToCheckItem(this.getNewlyAddedUserProfile(), true));
}
if (this.getMyObject().getAuthOkUserProfile() != null
&& this.getMyObject().getAuthOkUserProfile().size() > 0) {
for (UserProfile userProfile : this.getMyObject().getAuthOkUserProfile()) {
userProfiles.put(userProfile.getId(),
this.encapUpToCheckItem(userProfile, true));
}
}
List<CheckItem2> userProfileList = new ArrayList<CheckItem2>(userProfiles.values());
Collections.sort(userProfileList,
new CheckItem2ComparatorWithId());
return userProfileList;
}
@Override
public List<CheckItem2> getAuthDataUserProfiles() {
return this.authDataUserProfiles;
}
private List<CheckItem2> prepareAuthDataUserProfiles() {
if (this.getMyObject() == null || isSupport4LAN()) {
return null;
}
Map<Long, CheckItem2> userProfiles =
new HashMap<Long, CheckItem2>(getAvailableUserProfiles());
if (this.getUpType() == UserProfileSelection.USER_PROFILE_TYPE_AUTH_DATA
&& this.getNewlyAddedUserProfile() != null) {
userProfiles.put(this.getNewlyAddedUserProfile().getId(),
this.encapUpToCheckItem(this.getNewlyAddedUserProfile(), true));
}
if (this.getMyObject().getAuthOkDataUserProfile() != null
&& this.getMyObject().getAuthOkDataUserProfile().size() > 0) {
for (UserProfile userProfile : this.getMyObject().getAuthOkDataUserProfile()) {
userProfiles.put(userProfile.getId(),
this.encapUpToCheckItem(userProfile, true));
}
}
List<CheckItem2> userProfileList = new ArrayList<CheckItem2>(userProfiles.values());
Collections.sort(userProfileList,
new CheckItem2ComparatorWithId());
return userProfileList;
}
@Override
public List<CheckItem2> getAuthFailUserProfiles() {
return this.authFailUserProfiles;
}
private List<CheckItem2> prepareAuthFailUserProfiles() {
if (this.getMyObject() == null) {
return null;
}
Map<Long, CheckItem2> userProfiles =
new HashMap<Long, CheckItem2>(getAvailableUserProfiles());
if (this.getUpType() == UserProfileSelection.USER_PROFILE_TYPE_AUTH_FAIL
&& this.getNewlyAddedUserProfile() != null) {
userProfiles.put(this.getNewlyAddedUserProfile().getId(),
this.encapUpToCheckItem(this.getNewlyAddedUserProfile(), true));
}
if (this.getMyObject().getAuthFailUserProfile() != null
&& this.getMyObject().getAuthFailUserProfile().size() > 0) {
for (UserProfile userProfile : this.getMyObject().getAuthFailUserProfile()) {
userProfiles.put(userProfile.getId(),
this.encapUpToCheckItem(userProfile, true));
}
}
List<CheckItem2> userProfileList = new ArrayList<CheckItem2>(userProfiles.values());
Collections.sort(userProfileList,
new CheckItem2ComparatorWithId());
return userProfileList;
}
@Override
public void setAddedUserProfile(Long addedId, short type) {
this.addNewlyAddedUserProfile(addedId, type, true);
}
@Override
public String getUpSelectionTipOfDefault() {
return this.upSelectionTipOfDefault;
}
private String prepareUpSelectionTipOfDefault() {
if (this.getMyObject() == null) {
return null;
}
boolean isAuthEnabled = isAuthEnabled();
if (this.isDefaultUserProfileSupport()) {
if(this.getMyObject().getPortType() == PortAccessProfile.PORT_TYPE_ACCESS) {
return MgrUtil.getUserMessage("config.v2.select.user.profile.popup.tab.default")
+ JOIN_SYMBOL
+ MgrUtil.getUserMessage(isAuthEnabled ?
"config.configTemplate.wizard.step4.subtitle.access.auth.default"
: "config.configTemplate.wizard.step4.subtitle.access.default");
} else if(this.getMyObject().getPortType() == PortAccessProfile.PORT_TYPE_PHONEDATA) {
return MgrUtil.getUserMessage("config.v2.select.user.profile.popup.tab.default")
+ JOIN_SYMBOL
+ MgrUtil.getUserMessage(isAuthEnabled?
"config.configTemplate.wizard.step4.subtitle.phone.auth.default"
: "config.configTemplate.wizard.step4.subtitle.phone.default.voice");
}
}
return EMPTY_STR;
}
@Override
public String getUpSelectionTipOfReg() {
return this.upSelectionTipOfReg;
}
private String prepareUpSelectionTipOfReg() {
if (this.getMyObject() == null) {
return null;
}
return MgrUtil.getUserMessage("config.configTemplate.wizard.step4.subtitle1");
}
@Override
public String getUpSelectionTipOfAuth() {
return this.upSelectionTipOfAuth;
}
private String prepareUpSelectionTipOfAuth() {
if (this.getMyObject() == null) {
return null;
}
if (this.getMyObject().getPortType() == PortAccessProfile.PORT_TYPE_ACCESS) {
return MgrUtil.getUserMessage("config.v2.select.user.profile.popup.tab.authok")
+ JOIN_SYMBOL
+ MgrUtil.getUserMessage("config.configTemplate.wizard.step4.subtitle.access.authOk");
} else if (this.getMyObject().getPortType() == PortAccessProfile.PORT_TYPE_PHONEDATA) {
return MgrUtil.getUserMessage("config.v2.select.user.profile.popup.tab.authok")
+ " (Voice)"
+ JOIN_SYMBOL
+ MgrUtil.getUserMessage("config.configTemplate.wizard.step4.subtitle.phone.authOk.voice");
} else {
return EMPTY_STR;
}
}
@Override
public String getUpSelectionTipOfAuthData() {
return this.upSelectionTipOfAuthData;
}
private String prepareUpSelectionTipOfAuthData() {
if (this.getMyObject() == null) {
return null;
}
return MgrUtil.getUserMessage("config.v2.select.user.profile.popup.tab.authok")
+ " (Data)"
+ JOIN_SYMBOL
+ MgrUtil.getUserMessage("config.configTemplate.wizard.step4.subtitle.phone.authOk.data");
}
@Override
public String getUpSelectionTipOfAuthFail() {
return this.upSelectionTipOfAuthFail;
}
private String prepareUpSelectionTipOfAuthFail() {
if (this.getMyObject() == null) {
return null;
}
return MgrUtil.getUserMessage("config.v2.select.user.profile.popup.tab.authfail")
+ JOIN_SYMBOL
+ MgrUtil.getUserMessage("config.configTemplate.wizard.step4.subtitle.access.authFail");
}
@Override
public boolean isDefaultUserProfileSupport() {
return this.defaultUserProfileSupport;
}
private boolean prepareDefaultUserProfileSupport() {
if (this.getMyObject() == null) {
return false;
}
if (this.getMyObject().isEnabledCWP()) {
if (!this.getMyObject().isEnabledMAC()
&& this.getMyObject().getCwp() != null) {
if (this.getMyObject().getCwp().getRegistrationType() == Cwp.REGISTRATION_TYPE_REGISTERED) {
return false;
}
}
}
return true;
}
@Override
public boolean isSelfUserProfileSupport() {
return this.selfUserProfileSupport;
}
private boolean prepareSelfUserProfileSupport() {
if (this.getMyObject() == null) {
return false;
}
if (this.getMyObject().isEnabledCWP()) {
if (this.getMyObject().getCwp() != null) {
if (this.getMyObject().getCwp().getRegistrationType() == Cwp.REGISTRATION_TYPE_REGISTERED
|| this.getMyObject().getCwp().getRegistrationType() == Cwp.REGISTRATION_TYPE_BOTH) {
return true;
}
}
}
return false;
}
@Override
public boolean isAuthUserProfileSupport() {
return this.authUserProfileSupport;
}
private boolean prepareAuthUserProfileSupport() {
if (this.getMyObject() == null) {
return false;
}
if (isAuthEnabled()) {
return true;
}
return false;
}
public boolean isAuthDataUserProfileSupport() {
return this.authDataUserProfileSupport;
}
private boolean prepareAuthDataUserProfileSupport() {
if (this.getMyObject() == null
|| this.getMyObject().getPortType() != PortAccessProfile.PORT_TYPE_PHONEDATA) {
return false;
}
if (isAuthEnabled()) {
return true;
}
return false;
}
@Override
public boolean isAuthFailUserProfileSupport() {
return this.authFailUserProfileSupport;
}
private boolean prepareAuthFailUserProfileSupport() {
if (this.getMyObject() == null) {
return false;
}
if (this.getMyObject().getPortType() == PortAccessProfile.PORT_TYPE_ACCESS) {
if(this.getMyObject().isEnabledSameVlan()) {
return false;
} else if (isAuthEnabled()) {
if(this.getMyObject().isEnabledCWP()) {
return false;
} else {
return true;
}
}
}
return false;
}
@Override
public String getChkUserOnlyStyle() {
if (this.isChkUserOnlyEnabled()) {
return EMPTY_STR;
}
return "none";
}
public boolean isChkUserOnlyEnabled() {
if (this.getMyObject() != null) {
if (this.getMyObject().isEnabled8021X()) {
return true;
}
if (this.getMyObject().isEnabledMAC()) {
return true;
}
}
return false;
}
@Override
public short getAddedUserProfileType() {
return this.getUpType();
}
Map<Long, CheckItem2> availableUserProfiles = null;
private Map<Long, CheckItem2> getAvailableUserProfiles() {
if (availableUserProfiles == null) {
availableUserProfiles = getBoCheckItems("userProfileName||'('||attributeValue||')'",
UserProfile.class,
null);
}
return availableUserProfiles;
}
@Override
protected void doDataPrepare() {
this.defaultUserProfileSupport = prepareDefaultUserProfileSupport();
this.authUserProfileSupport = prepareAuthUserProfileSupport();
this.guestUserProfileSupport = prepareGuestUserProfileSupport();// AirWatch Non-Compliance
this.defaultUserProfiles = prepareDefaultUserProfiles();
this.authUserProfiles = prepareAuthUserProfiles();
this.guestUserProfiles = prepareGuestUserProfiles(); // AirWatch Non-Compliance
sortListByalpha(this.defaultUserProfiles);
sortListByalpha(this.authUserProfiles);
sortListByalpha(this.guestUserProfiles); // AirWatch Non-Compliance
this.upSelectionTipOfDefault = prepareUpSelectionTipOfDefault();
this.upSelectionTipOfAuth = prepareUpSelectionTipOfAuth();
this.upSelectionTipOfGuest = prepareUpSelectionTipOfGuest(); // AirWatch Non-Compliance
if(this.supportPhone){
this.authDataUserProfileSupport = prepareAuthDataUserProfileSupport();
this.authDataUserProfiles = prepareAuthDataUserProfiles();
sortListByalpha(this.authDataUserProfiles);
this.upSelectionTipOfAuthData = prepareUpSelectionTipOfAuthData();
} else {
this.selfUserProfileSupport = prepareSelfUserProfileSupport();
this.authFailUserProfileSupport = prepareAuthFailUserProfileSupport();
this.selfUserProfiles = prepareSelfRegUserProfiles();
this.authFailUserProfiles = prepareAuthFailUserProfiles();
sortListByalpha(this.selfUserProfiles);
sortListByalpha(this.authFailUserProfiles);
this.upSelectionTipOfReg = prepareUpSelectionTipOfReg();
this.upSelectionTipOfAuthFail = prepareUpSelectionTipOfAuthFail();
}
}
public void doUpSupportDataPrepare() {
this.defaultUserProfileSupport = prepareDefaultUserProfileSupport();
this.selfUserProfileSupport = prepareSelfUserProfileSupport();
this.authUserProfileSupport = prepareAuthUserProfileSupport();
this.authDataUserProfileSupport = prepareAuthDataUserProfileSupport();
this.authFailUserProfileSupport = prepareAuthFailUserProfileSupport();
this.guestUserProfileSupport = prepareGuestUserProfileSupport(); // AirWatch Non-Compliance
}
private boolean isSupport4LAN() {
if(this.getMyObject() != null) {
if(this.getMyObject().getProduct() != PortAccessProfile.CHESAPEAKE) {
return true;
}
}
return false;
}
public static class LazyUserProfileObjLoader implements QueryBo {
@Override
public Collection<HmBo> load(HmBo bo) {
if(bo instanceof PortAccessProfile) {
PortAccessProfile profile = (PortAccessProfile)bo;
if(null != profile.getCwp()) {
profile.getCwp().getId();
}
if(null != profile.getDefUserProfile()) {
profile.getDefUserProfile().getId();
}
if(null != profile.getSelfRegUserProfile()) {
profile.getSelfRegUserProfile().getId();
}
if(null != profile.getGuestUserProfile()) {
profile.getGuestUserProfile().getId();
}
if(!profile.getAuthOkUserProfile().isEmpty()) {
profile.getAuthOkUserProfile().size();
}
if(!profile.getAuthFailUserProfile().isEmpty()) {
profile.getAuthFailUserProfile().size();
}
if(!profile.getAuthOkDataUserProfile().isEmpty()) {
profile.getAuthOkDataUserProfile().size();
}
}
return null;
}
}
private boolean isAuthEnabled() {
return this.getMyObject().isIDMAuthEnabled() || this.getMyObject().isRadiusAuthEnable();
}
//---------------AirWatch Non-Compliance--------------------start
@Override
public List<CheckItem2> getGuestUserProfiles() {
return this.guestUserProfiles;
}
@Override
public String getUpSelectionTipOfGuest() {
return this.upSelectionTipOfGuest;
}
@Override
public boolean isGuestUserProfileSupport() {
return this.guestUserProfileSupport;
}
private String prepareUpSelectionTipOfGuest() {
if (prepareGuestUserProfileSupport()) {
return MgrUtil.getUserMessage("glasgow_10.config.v2.select.user.profile.popup.tab.guest")
+ JOIN_SYMBOL
+ MgrUtil.getUserMessage("glasgow_10.config.configTemplate.wizard.step4.subtitle.guest");
}
return null;
}
private List<CheckItem2> prepareGuestUserProfiles() {
if (prepareGuestUserProfileSupport()) {
Map<Long, CheckItem2> userProfiles =
new HashMap<Long, CheckItem2>(getAvailableUserProfiles());
if (this.getUpType() == UserProfileSelection.USER_PROFILE_TYPE_GUEST
&& this.getNewlyAddedUserProfile() != null) {
userProfiles.put(this.getNewlyAddedUserProfile().getId(),
this.encapUpToCheckItem(this.getNewlyAddedUserProfile(), true));
} else if (this.getMyObject().getGuestUserProfile() != null) {
userProfiles.put(this.getMyObject().getGuestUserProfile().getId(),
this.encapUpToCheckItem(this.getMyObject().getGuestUserProfile(), true));
}
List<CheckItem2> userProfileList = new ArrayList<CheckItem2>(userProfiles.values());
Collections.sort(userProfileList,
new CheckItem2ComparatorWithId());
return userProfileList;
}
return null;
}
private boolean prepareGuestUserProfileSupport() {
if(this.getMyObject() == null
|| !this.getMyObject().isEnableMDM()
|| null == this.getMyObject().getConfigtempleMdm()
|| !(this.getMyObject().getConfigtempleMdm().getMdmType() == ConfigTemplateMdm.MDM_ENROLL_TYPE_AIRWATCH
&& this.getMyObject().getConfigtempleMdm().getAwNonCompliance().isEnabledNonCompliance())) {
return false;
} else {
//FIXME AirWatch NonCompliance not support wired right now
//return true;
return false;
}
}
//---------------AirWatch Non-Compliance--------------------end
}
| [
"zjie@aerohive.com"
] | zjie@aerohive.com |
3429838e53cd1c449bc5c96208bb3ad33307fcb6 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /large-multiproject/project73/src/main/java/org/gradle/test/performance73_2/Production73_142.java | 94de1f2edf54ed7d02a6afc2365e09d826d6b78c | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 305 | java | package org.gradle.test.performance73_2;
public class Production73_142 extends org.gradle.test.performance16_2.Production16_142 {
private final String property;
public Production73_142() {
this.property = "foo";
}
public String getProperty() {
return property;
}
}
| [
"cedric.champeau@gmail.com"
] | cedric.champeau@gmail.com |
bba0376c9a1335b83451590746911e3fac3a11fa | 45a0427e3dd8c2e94dab79ef25fba4fde1541b07 | /patched/src/main/java/com/jodelapp/jodelandroidv3/utilities/JodelImageHelper.java | fc0a85e290c0273bd7d2e8d2ef51dad141fd7006 | [] | no_license | JodelRaccoons/JodelPatched | fe414820e2c709a0a1757764f7e112f8fbb86cb5 | 10485450b8d644ae604ee6d4dc2612da550b1384 | refs/heads/master | 2021-01-16T17:38:20.213450 | 2019-01-23T09:50:31 | 2019-01-23T09:50:31 | 100,010,421 | 19 | 1 | null | 2017-11-23T18:19:14 | 2017-08-11T08:31:06 | Java | UTF-8 | Java | false | false | 359 | java | package com.jodelapp.jodelandroidv3.utilities;
import android.graphics.Bitmap;
import lanchon.dexpatcher.annotation.DexEdit;
import lanchon.dexpatcher.annotation.DexReplace;
/**
* ? For no image blur
*/
@DexEdit(contentOnly = true)
public class JodelImageHelper {
@DexReplace
private Bitmap blur(Bitmap bitmap) {
return bitmap;
}
} | [
"krokofant@users.noreply.github.com"
] | krokofant@users.noreply.github.com |
c9e88c58aad07a86be42fc7678c2ee61f4656141 | 29f3eec6f08cf5c069d4202a93feb9b16658db53 | /app/src/main/java/com/haoyu/app/adapter/TeachingStudyLecturerAdapter.java | aa8d4af2c5422404233efe8ef9e8ed43ff89a0ed | [] | no_license | theboundaryforever/lingnan_teach | e466469bd89715e22c2ff08eea3308665852fb51 | af4ec7ea69ef0857f8cf06914f85ded570458c53 | refs/heads/master | 2021-07-01T07:50:59.986604 | 2017-09-18T06:07:05 | 2017-09-18T06:07:05 | 103,364,162 | 0 | 0 | null | 2017-09-13T06:50:21 | 2017-09-13T06:50:21 | null | UTF-8 | Java | false | false | 1,424 | java | package com.haoyu.app.adapter;
import android.view.View;
import android.widget.TextView;
import com.haoyu.app.basehelper.BaseArrayRecyclerAdapter;
import com.haoyu.app.entity.MobileUser;
import com.haoyu.app.lingnan.teacher.R;
import java.util.List;
/**
* Created by acer1 on 2017/2/16.
*/
public class TeachingStudyLecturerAdapter extends BaseArrayRecyclerAdapter<MobileUser> {
public TeachingStudyLecturerAdapter(List<MobileUser> mDatas) {
super(mDatas);
}
@Override
public int bindView(int viewtype) {
return R.layout.teaching_study_lecture_item;
}
@Override
public void onBindHoder(RecyclerHolder holder, final MobileUser mobileUser, int position) {
TextView tv_name = holder.obtainView(R.id.tv_name);
if (mobileUser != null && mobileUser.getRealName() != null) {
tv_name.setText(mobileUser.getRealName());
tv_name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
personName.setName(mobileUser);
}
});
} else {
tv_name.setText("匿名用户");
}
}
public interface PersonName {
void setName(MobileUser mobileUser);
}
public PersonName personName;
public void setPersonName(PersonName personName) {
this.personName = personName;
}
}
| [
"xiaoma920406@126.c0m"
] | xiaoma920406@126.c0m |
785c29860c687e40a65096213d99eea5ab1a471a | f2b522b214c1abd4dafb01a6f2fb13d2c8155756 | /mogu_web/src/main/java/com/moxi/mogublog/web/restapi/SortRestApi.java | db1f78b7669b85ac0ed0d0e6b74df20117a4da37 | [
"Apache-2.0"
] | permissive | superjinge/mogu_blog_v2 | 21efab237347677d310bb81dc25e35c2a9166976 | 2c6754fc983c7629a587729599f8bbb9e2b1f790 | refs/heads/master | 2020-11-26T07:56:00.443089 | 2019-12-19T04:22:11 | 2019-12-19T04:22:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,355 | java | package com.moxi.mogublog.web.restapi;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.moxi.mogublog.utils.*;
import com.moxi.mogublog.web.feign.PictureFeignClient;
import com.moxi.mogublog.web.global.SQLConf;
import com.moxi.mogublog.web.global.SysConf;
import com.moxi.mogublog.xo.entity.Admin;
import com.moxi.mogublog.xo.entity.Blog;
import com.moxi.mogublog.xo.entity.BlogSort;
import com.moxi.mogublog.xo.entity.Tag;
import com.moxi.mogublog.xo.service.*;
import com.moxi.mougblog.base.enums.EBehavior;
import com.moxi.mougblog.base.enums.EPublish;
import com.moxi.mougblog.base.enums.EStatus;
import com.moxi.mougblog.base.global.BaseSQLConf;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import sun.reflect.generics.tree.Tree;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 归档 RestApi
* @author xzx19950624@qq.com
* @date 2019年10月24日15:29:35
*/
@RestController
@RequestMapping("/sort")
@Api(value="归档 RestApi",tags={"SortRestApi"})
public class SortRestApi {
@Autowired
BlogService blogService;
@Autowired
TagService tagService;
@Autowired
BlogSortService blogSortService;
@Autowired
private StringRedisTemplate stringRedisTemplate;
@Autowired
private WebVisitService webVisitService;
private static Logger log = LogManager.getLogger(SortRestApi.class);
/**
* 获取归档的信息
* @author xzx19950624@qq.com
* @date 2018年11月6日下午8:57:48
*/
@ApiOperation(value="归档", notes="归档")
@GetMapping("/getSortList")
public String getSortList(HttpServletRequest request) {
//从Redis中获取内容
String monthResult = stringRedisTemplate.opsForValue().get("MONTH_SET");
//判断redis中时候包含归档的内容
if(StringUtils.isNotEmpty(monthResult)) {
List list = JsonUtils.jsonArrayToArrayList(monthResult);
return ResultUtil.result(SysConf.SUCCESS, list);
}
// 第一次启动的时候归档
QueryWrapper<Blog> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE);
queryWrapper.orderByDesc(SQLConf.CREATE_TIME);
queryWrapper.eq(BaseSQLConf.IS_PUBLISH, EPublish.PUBLISH);
//因为首页并不需要显示内容,所以需要排除掉内容字段
queryWrapper.select(Blog.class, i-> !i.getProperty().equals("content"));
List<Blog> list = blogService.list(queryWrapper);
//给博客增加标签和分类
list = setBlog(list);
Map<String, List<Blog>> map = new HashMap<>();
Iterator iterable = list.iterator();
Set<String> monthSet = new TreeSet<>();
while(iterable.hasNext()) {
Blog blog = (Blog)iterable.next();
Date createTime = blog.getCreateTime();
String month = new SimpleDateFormat("yyyy年MM月").format(createTime).toString();
monthSet.add(month);
if(map.get(month) == null) {
List<Blog> blogList = new ArrayList<>();
blogList.add(blog);
map.put(month, blogList);
} else {
List<Blog> blogList = map.get(month);
blogList.add(blog);
map.put(month, blogList);
}
}
// 缓存该月份下的所有文章 key: 月份 value:月份下的所有文章
map.forEach((key, value) -> {
stringRedisTemplate.opsForValue().set("BOLG_SORT_BY_MONTH:" + key, JsonUtils.objectToJson(value).toString());
});
//将从数据库查询的数据缓存到redis中
stringRedisTemplate.opsForValue().set("MONTH_SET", JsonUtils.objectToJson(monthSet).toString());
return ResultUtil.result("success", monthSet);
}
@ApiOperation(value="通过月份获取文章", notes="通过月份获取文章")
@GetMapping("/getArticleByMonth")
public String getArticleByMonth(HttpServletRequest request,
@ApiParam(name = "monthDate", value = "归档的日期",required = false) @RequestParam(name = "monthDate", required = false) String monthDate) {
if(StringUtils.isEmpty(monthDate)) {
return ResultUtil.result("error", "传入日期不能为空");
}
//增加点击记录
webVisitService.addWebVisit(null, request, EBehavior.VISIT_SORT.getBehavior(), null, monthDate);
//从Redis中获取内容
String contentResult = stringRedisTemplate.opsForValue().get("BOLG_SORT_BY_MONTH:" + monthDate);
//判断redis中时候包含该日期下的文章
if(StringUtils.isNotEmpty(contentResult)) {
List list = JsonUtils.jsonArrayToArrayList(contentResult);
return ResultUtil.result(SysConf.SUCCESS, list);
}
// 第一次启动的时候归档
QueryWrapper<Blog> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(SQLConf.STATUS, EStatus.ENABLE);
queryWrapper.orderByDesc(SQLConf.CREATE_TIME);
queryWrapper.eq(BaseSQLConf.IS_PUBLISH, EPublish.PUBLISH);
//因为首页并不需要显示内容,所以需要排除掉内容字段
queryWrapper.select(Blog.class, i-> !i.getProperty().equals("content"));
List<Blog> list = blogService.list(queryWrapper);
//给博客增加标签和分类
list = setBlog(list);
Map<String, List<Blog>> map = new HashMap<>();
Iterator iterable = list.iterator();
Set<String> monthSet = new TreeSet<>();
while(iterable.hasNext()) {
Blog blog = (Blog)iterable.next();
Date createTime = blog.getCreateTime();
String month = new SimpleDateFormat("yyyy年MM月").format(createTime).toString();
monthSet.add(month);
if(map.get(month) == null) {
List<Blog> blogList = new ArrayList<>();
blogList.add(blog);
map.put(month, blogList);
} else {
List<Blog> blogList = map.get(month);
blogList.add(blog);
map.put(month, blogList);
}
}
// 缓存该月份下的所有文章 key: 月份 value:月份下的所有文章
map.forEach((key, value) -> {
stringRedisTemplate.opsForValue().set("BOLG_SORT_BY_MONTH:" + key, JsonUtils.objectToJson(value).toString());
});
//将从数据库查询的数据缓存到redis中
stringRedisTemplate.opsForValue().set("MONTH_SET", JsonUtils.objectToJson(monthSet).toString());
return ResultUtil.result("success", map.get(monthDate));
}
/**
* 设置博客的分类标签和分类
* @param list
* @return
*/
private List<Blog> setBlog(List<Blog> list) {
final StringBuffer fileUids = new StringBuffer();
List<String> sortUids = new ArrayList<String>();
List<String> tagUids = new ArrayList<String>();
list.forEach( item -> {
if(StringUtils.isNotEmpty(item.getFileUid())) {
fileUids.append(item.getFileUid() + ",");
}
if(StringUtils.isNotEmpty(item.getBlogSortUid())) {
sortUids.add(item.getBlogSortUid());
}
if(StringUtils.isNotEmpty(item.getTagUid())) {
tagUids.add(item.getTagUid());
}
});
Collection<BlogSort> sortList = new ArrayList<>();
Collection<Tag> tagList = new ArrayList<>();
if (sortUids.size() > 0) {
sortList = blogSortService.listByIds(sortUids);
}
if (tagUids.size() > 0) {
tagList = tagService.listByIds(tagUids);
}
Map<String, BlogSort> sortMap = new HashMap<String, BlogSort> ();
Map<String, Tag> tagMap = new HashMap<String, Tag>();
Map<String, String> pictureMap = new HashMap<String, String>();
sortList.forEach(item -> {
sortMap.put(item.getUid(), item);
});
tagList.forEach(item -> {
tagMap.put(item.getUid(), item);
});
for(Blog item : list) {
//设置分类
if(StringUtils.isNotEmpty(item.getBlogSortUid())) {
item.setBlogSort(sortMap.get(item.getBlogSortUid()));
}
//获取标签
if(StringUtils.isNotEmpty(item.getTagUid())) {
List<String> tagUidsTemp = StringUtils.changeStringToString(item.getTagUid(), ",");
List<Tag> tagListTemp = new ArrayList<Tag>();
tagUidsTemp.forEach(tag -> {
tagListTemp.add(tagMap.get(tag));
});
item.setTagList(tagListTemp);
}
}
return list;
}
}
| [
"xzx19950624@qq.com"
] | xzx19950624@qq.com |
be3ee73bb285f08ba7e62bff0cb2f63746067aa8 | 815b37ba5c102f7d9d8c3441f3015be895b9f2d5 | /Jet/src/main/java/org/mitre/jet/ebts/Ebts.java | 3acdd6604f2c779106342537dd217fb0ebbfc4a6 | [
"Apache-2.0"
] | permissive | jmkeefer/jet | c3a1a69d25b0ec7ceab78a438b4abbcf8670239d | ecc7d7f10f27b8f073b220b13cdcba76d2d49987 | refs/heads/master | 2021-04-27T02:04:04.335022 | 2017-11-30T20:29:36 | 2017-11-30T20:29:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,518 | java | /*
* Copyright 2014 The MITRE Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.mitre.jet.ebts;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.ListMultimap;
import org.mitre.jet.ebts.field.Field;
import org.mitre.jet.ebts.field.Occurrence;
import org.mitre.jet.ebts.field.SubField;
import org.mitre.jet.ebts.records.LogicalRecord;
import java.util.*;
/**
* The Class Ebts.
*
* @author ADAY
*/
public class Ebts {
private final ListMultimap<Integer, LogicalRecord> records = ArrayListMultimap.create();
/**
* Create an Ebts instance to store the records for a particular file.
*/
public Ebts() {}
/**
* Add a record to the Ebts instance.
*
* @param record Record to add.
*/
public void addRecord(final LogicalRecord record) {
this.records.put(record.getRecordType(), record);
}
/**
* Remove a record from the Ebts instance.
*
* @param record Record to remove.
*/
public boolean removeRecord(final LogicalRecord record) {
return this.records.remove(record.getRecordType(), record);
}
/**
* <p>
* Gets a mapping of Record Types to the number of records of that type
* which appear in this EBTS file. This information is parsed from the
* 1.003 CNT field, so it is not affected by the {@link ParseType}.
* </p>
* @return A mapping of record types to number of records of that type appearing
* in the EBTS file. If this information cannot be collected for any reason,
* an empty map is returned.
*/
public final Map<Integer, Integer> getLogicalRecordCounts() {
final Map<Integer, Integer> logicalRecordCounts = new HashMap<Integer, Integer>();
final Field cntField = this.getRecordsByType(1).get(0).getField(3);
if (cntField == null) {
throw new IllegalStateException("Ebts does not have CNT field");
}
for (final Occurrence occurrence : cntField.getOccurrences()) {
final List<SubField> subFields = occurrence.getSubFields();
final int recordType = Integer.valueOf(subFields.get(0).toString());
if (!logicalRecordCounts.containsKey(recordType)) {
logicalRecordCounts.put(recordType, 1);
} else {
logicalRecordCounts.put(recordType, logicalRecordCounts.get(recordType) + 1);
}
}
return logicalRecordCounts;
}
/**
* Remove a record from the Ebts instance by record type.
*
* @param recordType record type to be removed.
*/
public void removeRecordsByType(final int recordType) {
this.records.removeAll(recordType);
}
/**
* Remove all data from the Ebts instance.
*/
public void clear() {
this.records.clear();
}
/**
* Return a list of all records for a given type.
* @param recordType Record type to return.
* @return List of logical records.
*/
public List<LogicalRecord> getRecordsByType(final int recordType) {
return this.records.get(recordType);
}
/**
* Return all records in the Ebts instance.
*
* @return List of all logical records.
*/
public List<LogicalRecord> getAllRecords() {
final List<LogicalRecord> recordList = new ArrayList<LogicalRecord>();
final List<Integer> keys = new ArrayList<Integer>();
keys.addAll(this.records.keySet());
Collections.sort(keys);
for (final Integer key : keys) {
recordList.addAll(getRecordsByType(key));
}
return recordList;
}
public ListMultimap<Integer, LogicalRecord> getRecords() {
return this.records;
}
public boolean containsRecord(final int recordType) {
return this.records.containsKey(recordType) && !this.records.get(recordType).isEmpty();
}
//TODO: Add methods that relate to the idc
}
| [
"wvucam71@gmail.com"
] | wvucam71@gmail.com |
008a038665ae0b9e367949119e0543a45c44124a | 42d536e4ac79da0d03bcd65092e6483eb96b1974 | /src/com/company/Main.java | 367641f4867c44742a552289f352cc230ca5fa8c | [] | no_license | thisIs-RealLife/CalculatorRomAndArabNums | 703748acfd15420dbc380b878c80f5035eebc161 | 8ac463a0d6105a8dea4cb6e67bd49bc68bc6811f | refs/heads/master | 2022-11-29T17:45:46.299156 | 2020-08-07T19:47:42 | 2020-08-07T19:47:42 | 285,911,900 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 413 | java | package com.company;
import com.company.Interface.DataEntryInterface;
import com.company.Calculator.DataValidation;
import com.company.input.InputDataClass;
public class Main {
public static void main(String[] args) {
DataEntryInterface input = new InputDataClass();
DataValidation dataValidation = new DataValidation();
dataValidation.validation(input.inputData());
}
}
| [
"sorokina_l.a_school@mail.ru"
] | sorokina_l.a_school@mail.ru |
9d2b5acabd304514a32b41f52d73028e1a86019d | e76191245215d503eaa95de47695161dc79035b6 | /src/tshirtstrategy/strategy/CashPaymentImpl.java | d26190f0fa71ba017017773bc11b3f6d7d75f2ee | [] | no_license | orestispanago/TShirtStrategy | c7e7627b2512db21da8de4ca09f7c7fd8ededce2 | d293bfecfeb0432b2089537ce185dff409471cd9 | refs/heads/master | 2022-07-08T15:53:54.802279 | 2020-05-14T20:50:43 | 2020-05-14T20:51:20 | 263,670,017 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 576 | 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 tshirtstrategy.strategy;
import tshirtstrategy.models.Color;
import tshirtstrategy.models.Fabric;
import tshirtstrategy.models.Size;
/**
*
* @author mac
*/
public class CashPaymentImpl implements IPayment {
@Override
public float pay(float basePrice, Color color, Size size, Fabric fabric) {
return(basePrice + calculatePrice(color, size, fabric));
}
}
| [
"orestispanago@gmail.om"
] | orestispanago@gmail.om |
88c9cf101667ce22e2c56e14dc3e66d3196f69f1 | ebe55ca274729f465d619568c54b3f67c96a71c0 | /LoginGMAIL/app/src/main/java/Modelo/Usuario.java | a8bc93bcf639c5d15e11563463afa773d3cf0a84 | [] | no_license | LexAdrian1/AplicacionesMobile | ec963eb4a2ce7b9f1836048a4253637833c1ee2e | 24aae30f12744a7bdf9a2006d373c6bfedae4b54 | refs/heads/master | 2020-03-17T02:46:17.853114 | 2018-07-20T19:56:02 | 2018-07-20T19:56:02 | 133,204,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 824 | java | package Modelo;
import java.io.Serializable;
public class Usuario implements Serializable {
private String nombre;
private String mail;
private String pass;
public Usuario(String nombre, String mail, String pass) {
this.nombre = nombre;
this.mail = mail;
this.pass = pass;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
@Override
public String toString() {
return this.nombre + " " + this.mail;
}
}
| [
"lexadrian1@gmail.com"
] | lexadrian1@gmail.com |
4d5bca01fcac9438f6e968829068ea9ae3663090 | c2dbcec72f90985ac799fab091431e2b33c43ef5 | /com.newsat.platform.web/src/main/java/com/newsat/platform/web/parse/WebParse.java | dbdcc206faf95e7b40827046eb1a821a136bd956 | [] | no_license | dragonflysun2019/Learning | 66721bdd9d99ef0c9e7c4ce4634522d0195dbcfe | cd4624c7bd3dc267eb136c821381294e532be881 | refs/heads/master | 2021-06-06T10:07:23.439287 | 2016-10-29T09:24:47 | 2016-10-29T09:24:47 | 72,274,825 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,721 | java | package com.newsat.platform.web.parse;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.select.Elements;
import org.jsoup.Connection.*;
public class WebParse {
public static List<File> listFile = new ArrayList<File>();
public static void ListSubFiles(File file)
{
File files[] = file.listFiles();
if(files == null)
{
return;
}
for (File f : files)
{
if (f.isDirectory())
{
ListSubFiles(f);
}
else
{
listFile.add(f);
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
try
{
//Document doc = Jsoup.connect("http://www.sciencemag.org/news/2016/10/nations-sign-major-deal-curb-warming-chemicals-used-air-conditioning").userAgent("Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.2.15)").timeout(5000).get();
File files[] = new File("D:\\news\\").listFiles();
for (int i = 0; i < files.length; ++i)
{
if (files[i].isDirectory())
{
ListSubFiles(files[i]);
}
}
for (File file: listFile)
{
String filename = file.getName();
String filepath = file.getPath();
Document doc = Jsoup.parse(file,"UTF-8","");
System.out.println(filepath);
Elements body = doc.select("div.article__body");
File newfile = new File(filepath+".txt");
FileOutputStream fop = new FileOutputStream(newfile);
fop.write(body.text().getBytes());
fop.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
}
| [
"dragonflysun1986@aliyun.com"
] | dragonflysun1986@aliyun.com |
536fbb48f6c3a1d873498b1694539883d20d1903 | ad06b05fc03b2d869128fa32009afd3e518de754 | /job.java | d8e80cc183dba6816a3a02d251c8aca7eba8bb8a | [] | no_license | ankursinghrathi/job1 | 496c197031e915edf1fd0c79595b5fe84f9a39e9 | b06df6248657a7baa8958cd5259f33f6a2072954 | refs/heads/master | 2023-04-28T21:37:15.148032 | 2021-05-20T05:38:00 | 2021-05-20T05:38:00 | 369,089,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 138 | java | // Your First Program
class job {
public static void main(String[] args) {
System.out.println("Hello, World job1!");
}
} | [
"you@example.com"
] | you@example.com |
7b8a9f7dc985204880b2c617ba0c1f2f1cf1aad1 | 181cef7f849a5b8b99aa56fc4a055755559fe0ab | /qwazr-library/src/main/java/com/qwazr/tools/XMLTool.java | d4d841974905ad68c8439f84d6ae3c12308a4c6c | [
"Apache-2.0"
] | permissive | Tetraa/QWAZR | e0ec334021ebfc9ab7ab6f12069afbcabbd66b13 | 5ec969102e94206769db9a7a4cabc180b2f71c71 | refs/heads/master | 2021-01-16T20:07:44.768269 | 2016-06-08T16:49:43 | 2016-06-08T16:49:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,316 | java | /**
* Copyright 2014-2016 Emmanuel Keller / QWAZR
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package com.qwazr.tools;
import com.jamesmurty.utils.XMLBuilder2;
import com.qwazr.utils.IOUtils;
import com.qwazr.utils.XmlMapper;
import jdk.nashorn.api.scripting.ScriptObjectMirror;
import jdk.nashorn.api.scripting.ScriptUtils;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.*;
public class XMLTool extends AbstractXmlFactoryTool {
private SAXParserFactory saxParserFactory = null;
@Override
final public void load(final File parentDir) {
super.load(parentDir);
saxParserFactory = SAXParserFactory.newInstance();
if (namespace_aware != null)
saxParserFactory.setNamespaceAware(namespace_aware);
if (x_include_aware != null)
saxParserFactory.setXIncludeAware(x_include_aware);
}
/**
* @param root the name of the root element
* @return an new XML builder instance
* {@link XMLBuilder2}
*/
public XMLBuilder2 create(String root) {
return XMLBuilder2.create(root);
}
/**
* Save the XML to the file described by the given path
*
* @param builder an XML builder
* @param path the destination path
* @throws IOException if any I/O error occurs
*/
public void saveTo(XMLBuilder2 builder, String path) throws IOException {
FileWriter writer = new FileWriter(path);
try {
builder.toWriter(true, writer, null);
} finally {
writer.close();
}
}
/**
* Parse an XML stream and call the JS functions
*
* @param jsObject any Javascript receiving the events
* @param input the stream
* @throws ParserConfigurationException if any XML error occurs
* @throws SAXException if any XML error occurs
* @throws IOException if any I/O error occurs
*/
public void parseStream(ScriptObjectMirror jsObject, InputStream input)
throws ParserConfigurationException, SAXException, IOException {
DefaultHandler defaultHandler = (DefaultHandler) ScriptUtils.convert(jsObject, DefaultHandler.class);
SAXParser saxParser = saxParserFactory.newSAXParser();
saxParser.parse(input, defaultHandler);
}
/**
* Parse an XML file
*
* @param jsObject the Javascript object receiving the events
* @param path the path to the XML file to read
* @throws IOException if any I/O error occurs
* @throws SAXException if any XML error occurs
* @throws ParserConfigurationException if any XML error occurs
*/
public void parseFile(ScriptObjectMirror jsObject, String path)
throws IOException, SAXException, ParserConfigurationException {
InputStream in = new BufferedInputStream(new FileInputStream(path));
try {
parseStream(jsObject, in);
} finally {
IOUtils.closeQuietly(in);
}
}
/**
* Parse an XML string and build a DOM object
*
* @param xmlString the XML as String
* @return a DOM document
* @throws IOException if any I/O error occurs
* @throws SAXException if any XML error occurs
* @throws ParserConfigurationException if any XML error occurs
*/
public Document domParseString(String xmlString) throws IOException, SAXException, ParserConfigurationException {
final InputSource input = new InputSource();
input.setCharacterStream(new StringReader(xmlString));
return getNewDocumentBuilder().parse(input);
}
/**
* Parse an XML file and build a DOM object
*
* @param file the file to read
* @return a new DOM document
* @throws ParserConfigurationException if any XML error occurs
* @throws IOException if any I/O error occurs
* @throws SAXException if any XML error occurs
*/
public Document domParseFile(String file) throws ParserConfigurationException, IOException, SAXException {
return getNewDocumentBuilder().parse(file);
}
/**
* Parse an XML stream and build a DOM object
*
* @param input the stream to read
* @return a new DOM document
* @throws ParserConfigurationException if any XML error occurs
* @throws IOException if any I/O error occurs
* @throws SAXException if any XML error occurs
*/
public Document domParseStream(InputStream input) throws ParserConfigurationException, IOException, SAXException {
return getNewDocumentBuilder().parse(input);
}
/**
* Parse an XML document using its URL and build a DOM object
*
* @param url
* @return
* @throws IOException
* @throws SAXException
* @throws ParserConfigurationException
*/
public Document domParseURL(String url) throws IOException, SAXException, ParserConfigurationException {
return getNewDocumentBuilder().parse(url);
}
/**
* Generate an XML string from an Object using JAXB
*
* @param object the object to serialize
* @return an XML string which represent the object
* @throws IOException if any serialisation error occurs
*/
public String printXML(Object object) throws IOException {
StringWriter sw = new StringWriter();
toXML(object, sw);
return sw.toString();
}
/**
* Write an XML representation of an object
*
* @param object the object to serialize
* @param writer the destination writer
* @throws IOException if any serialisation error occurs
*/
public void toXML(Object object, Writer writer) throws IOException {
//JAXBContext jaxbContext = JAXBContext.newInstance(object.getClass());
//Marshaller marshaller = jaxbContext.createMarshaller();
//StringWriter sw = new StringWriter();
//marshaller.marshal(object, writer);
XmlMapper.MAPPER.writeValue(writer, object);
}
} | [
"ekeller@open-search-server.com"
] | ekeller@open-search-server.com |
e63d4b797a5a61ea43bb96b19ceb841c5ff784f8 | 5bceaed6e519dee3b16cf91bf7f53b15966c5166 | /laboratorios/lab01/ejercicioEnLinea/powerN.java | 7933d7021ad9b2600ef03daaa33e343a67b71fbc | [] | no_license | mmc31-08/ST0245-001 | 8ba6ac8fb6649000ef57f2102a0e4745620080d7 | 769c0c79e93fd707d90fb9a987cebc2d566d1753 | refs/heads/master | 2023-05-06T04:01:01.472190 | 2021-05-27T15:52:45 | 2021-05-27T15:52:45 | 333,789,595 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 212 | java | public class powerN{
public int powerN(int base, int n) {
if (n==0){
return 1;
}
if(n==1){
return base;
}
return powerN(base, n-1)*base;
}
} | [
"noreply@github.com"
] | mmc31-08.noreply@github.com |
cb8c422004d07d4214a862a72342ef209de4a99f | ab3c021553d7ff524b40cffc4cb20d76a18bbf29 | /[2019년 10월 시작]/[19주차]트라이/[김재곤][19주차][프로그래머스_42861][섬 연결하기_p].java | f70ff19406b3eaf40aacc628d7bd7b2183e1a275 | [] | no_license | KangPilGyu/Algo-Study | 12cbf96fd15d7691bc655334a614216639a32954 | 0233eeb2696fee9835e9da3594a762630a5d1a2c | refs/heads/master | 2021-06-26T03:46:49.157527 | 2021-01-29T11:03:21 | 2021-01-29T11:03:21 | 204,300,543 | 5 | 12 | null | 2021-01-29T11:03:22 | 2019-08-25T13:48:52 | Java | UTF-8 | Java | false | false | 2,595 | java | package rithm_p;
import java.util.LinkedList;
import java.util.Queue;
//섬연결하기 프림
public class Pms42861_p {
static int n = 4;
static int[][] costs = {{0,1,1}, {0,2,2}, {1,2,5}, {1,3,1}, {2,3,8}};
static boolean[] A = new boolean[n];
static int total = 0;
static Queue<Integer> queue = new LinkedList<>();
static int min;
static int[] arrmin = new int[costs[0].length];
static void bfs() {
queue.add(0);
while (queue.size() != n) {
min = 2147483647;// int 최대값
int sz = queue.size();
for (int i = 0; i < sz; i++) {
int x = queue.poll();
for (int[] cs : costs) {
if((cs[0] == x || cs [1] == x) && !(A[cs[0]] && A[cs[1]])) {
if(cs[2] < min) {
min = cs[2];
arrmin = cs;
}
}
}
}
A[arrmin[0]] = true;
A[arrmin[1]] = true;
for (int i = 0; i < A.length; i++) {
if(A[i] == true) {
queue.add(i);
}
}
total += arrmin[2];
}
}
public static void main(String[] args) {
bfs();
System.out.println(total);
}
}
/*
class Solution {
static boolean[] A;
static Queue<Integer> queue = new LinkedList<>();
static int min;
static int total = 0;
static int[] arrmin;
static int bfs(int n, int[][] costs) {
queue.add(0);
while (queue.size() != n) {
min = 2147483647;
int sz = queue.size();
for (int i = 0; i < sz; i++) {
int x = queue.poll();
for (int[] cs : costs) {
if((cs[0] == x || cs [1] == x) && !(A[cs[0]] && A[cs[1]])) {
if(cs[2] < min) {
min = cs[2];
arrmin = cs;
}
}
}
}
A[arrmin[0]] = true;
A[arrmin[1]] = true;
for (int i = 0; i < A.length; i++) {
if(A[i] == true) {
queue.add(i);
}
}
total += arrmin[2];
}
return total;
}
public int solution(int n, int[][] costs) {
int answer = 0;
A = new boolean[n];
arrmin = new int[costs[0].length];
answer = bfs(n, costs);
return answer;
}
}
*/ | [
"worhs.k@gmail.com"
] | worhs.k@gmail.com |
abe191ea493e35fc229d925d6da62756b05f59ac | 1b96e0bd3f2fd554909fd87c86d4262c6310cecc | /app/src/main/java/com/faux/workshop/DBHelper.java | 6154b7914aece160e2f91418eed6c066171d86aa | [] | no_license | FriedSteel/FauxWorkshop | 9d999249d0368028e4b966459a981a682d51ec98 | 87c4290a7c66b4bf50ad2b054b2c94a8d5246f2d | refs/heads/master | 2020-11-27T02:06:13.621195 | 2019-12-20T13:16:08 | 2019-12-20T13:16:08 | 229,265,452 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,358 | java | package com.faux.workshop;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
public class DBHelper extends SQLiteOpenHelper {
private static String DB_NAME = "workshoplist.db";
private static int DB_VERSION = 1;
private static String DB_TABLE = "workshopTable";
private static String COL_ID = "id";
private static String COL_NAME = "name";
private static String COL_COMPANY = "cname";
private static String COL_DURATION = "duration";
private static String COL_LOCATION = "location";
private static String COL_FEE = "fee";
private static String COL_APPLIED = "applied";
public DBHelper(@Nullable Context context) {
super(context, DB_NAME, null, DB_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
String CREATE_TABLE = "CREATE TABLE " + DB_TABLE + "(" +
COL_ID + " INTEGER PRIMARY KEY," +
COL_NAME + " TEXT," +
COL_COMPANY + " TEXT," +
COL_DURATION + " TEXT," +
COL_LOCATION + " TEXT," +
COL_FEE + " INTEGER," +
COL_APPLIED + " TEXT )";
db.execSQL(CREATE_TABLE);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS " + DB_TABLE);
onCreate(db);
}
public void addDataModel(Model model) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL_NAME, model.getName());
contentValues.put(COL_COMPANY, model.getCompany());
contentValues.put(COL_DURATION, model.getDuration());
contentValues.put(COL_LOCATION, model.getLocation());
contentValues.put(COL_FEE, model.getFee());
contentValues.put(COL_APPLIED, model.getApplied());
if (!checkDuplicateDataModel(contentValues)) {
db.insert(DB_TABLE, null, contentValues);
}
db.close();
}
private boolean checkDuplicateDataModel(ContentValues contentValues) {
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.query(DB_TABLE, null, COL_NAME + " = ?",
new String[]{
String.valueOf(contentValues.get(COL_NAME))},
null, null, null);
if (cursor != null && cursor.getCount() > 0) {
cursor.close();
return true;
} else {
return false;
}
}
public List<Model> getSummaryDataModel(){
List<Model> modelList = new ArrayList<>();
String selectQuery = "SELECT * FROM " + DB_TABLE + " WHERE " +
COL_APPLIED + " = 'no'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
if (cursor.moveToFirst()) {
do {
Model model = new Model();
model.setId(Integer.parseInt(cursor.getString(0)));
model.setName(String.valueOf(cursor.getString(1)));
model.setCompany(String.valueOf(cursor.getString(2)));
model.setDuration(String.valueOf(cursor.getString(3)));
model.setLocation(String.valueOf(cursor.getString(4)));
model.setFee(Integer.parseInt(cursor.getString(5)));
model.setApplied(String.valueOf(cursor.getString(6)));
modelList.add(model);
} while (cursor.moveToNext());
}
cursor.close();
return modelList;
}
public List<Model> getSummaryDataModelWhere() {
List<Model> modelList = new ArrayList<>();
String selectWhereQuery = "SELECT * FROM " + DB_TABLE + " WHERE " +
COL_APPLIED + " = 'yes'";
SQLiteDatabase db = this.getReadableDatabase();
Cursor cursor = db.rawQuery(selectWhereQuery, null);
if (cursor.moveToFirst()) {
do {
Model model = new Model();
model.setId(Integer.parseInt(cursor.getString(0)));
model.setName(String.valueOf(cursor.getString(1)));
model.setCompany(String.valueOf(cursor.getString(2)));
model.setDuration(String.valueOf(cursor.getString(3)));
model.setLocation(String.valueOf(cursor.getString(4)));
model.setFee(Integer.parseInt(cursor.getString(5)));
model.setApplied(String.valueOf(cursor.getString(6)));
modelList.add(model);
} while (cursor.moveToNext());
}
cursor.close();
return modelList;
}
public void updateDataModel(Integer id) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put(COL_APPLIED, "yes");
db.update(DB_TABLE, contentValues, COL_ID + " = " + id, null);
db.close();
}
}
| [
"noreply@github.com"
] | FriedSteel.noreply@github.com |
2cf09b956c3d03b09840d87b75743ba34034d94b | cf9896e0789c16d73bd8645718b0c838f29eece0 | /src/main/java/com/manywho/services/backend/services/DataService.java | e79b39f1e4e613a3b72ea7611728c3441f285cf4 | [] | no_license | BillTheBest/service-backend | 144123a7933ae76ac1c4f2c342d97218b27c0a3d | 407a43cd0fb19423a6a8fe3f761e73abcc67c827 | refs/heads/master | 2021-01-21T21:54:56.537358 | 2015-11-15T05:42:26 | 2015-11-15T05:42:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,852 | java | package com.manywho.services.backend.services;
import com.manywho.sdk.entities.run.elements.type.ObjectCollection;
import com.manywho.sdk.entities.run.elements.type.ObjectDataRequest;
import com.manywho.sdk.entities.run.elements.type.ObjectDataResponse;
import com.manywho.sdk.entities.security.AuthenticatedWho;
import com.manywho.services.backend.configuration.Configuration;
import javax.inject.Inject;
import java.sql.Connection;
import java.sql.SQLException;
public class DataService {
@Inject
private DatabaseService databaseService;
public ObjectDataResponse load(AuthenticatedWho authenticatedWho, Configuration configuration, ObjectDataRequest objectDataRequest) throws Exception {
if (authenticatedWho == null) {
throw new Exception(("The AuthenticatedWho object cannot be null."));
}
if (configuration == null) {
throw new Exception(("The Configuration object cannot be null."));
}
if (objectDataRequest == null) {
throw new Exception("The ObjectDataRequest object cannot be null.");
}
// Construct the object data response as we should always return that unless there are errors
ObjectDataResponse objectDataResponse = new ObjectDataResponse();
objectDataResponse.setCulture(objectDataRequest.getCulture());
Connection connection = null;
try {
// Construct and execute the query on the backend
connection = this.databaseService.getConnection(configuration);
// Set the object data based on the object data request
objectDataResponse.setObjectData(this.databaseService.executeObjectLoad(authenticatedWho, connection, objectDataRequest));
} catch (SQLException e) {
throw e;
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
throw e;
}
}
return objectDataResponse;
}
public ObjectDataResponse save(AuthenticatedWho authenticatedWho, Configuration configuration, ObjectDataRequest objectDataRequest) throws Exception {
if (authenticatedWho == null) {
throw new Exception(("The AuthenticatedWho object cannot be null."));
}
if (configuration == null) {
throw new Exception(("The Configuration object cannot be null."));
}
if (objectDataRequest == null) {
throw new Exception("The ObjectDataRequest object cannot be null.");
}
if (objectDataRequest.getObjectDataType() == null) {
throw new Exception("The ObjectDataRequest.ObjectDataType information is null. As a result, the save request does not have enough information to execute.");
}
if (objectDataRequest.getObjectDataType().getDeveloperName() == null ||
objectDataRequest.getObjectDataType().getDeveloperName().isEmpty() == true) {
throw new Exception("The ObjectDataRequest.ObjectDataType.DeveloperName must be provided. This property is used to determine the type of data to be loaded.");
}
if (objectDataRequest.getObjectDataType().getProperties() == null ||
objectDataRequest.getObjectDataType().getProperties().size() == 0) {
throw new Exception("The ObjectDataRequest.ObjectDataType.Properties must be provided. This property is provides the fields that are included in the data to be loaded.");
}
// Construct the object data response as we should always return that unless there are errors
ObjectDataResponse objectDataResponse = new ObjectDataResponse();
objectDataResponse.setCulture(objectDataRequest.getCulture());
objectDataResponse.setObjectData(new ObjectCollection());
// If we don't have any object data to save, we simply return an empty response
if (objectDataRequest.getObjectData() == null ||
objectDataRequest.getObjectData().size() == 0) {
return objectDataResponse;
}
Connection connection = null;
try {
// Construct and execute the query on the backend
connection = this.databaseService.getConnection(configuration);
// Execute the save across all objects in the hierarchy
this.databaseService.executeObjectSave(authenticatedWho, connection, null, objectDataRequest.getObjectData());
} catch (SQLException e) {
throw e;
} finally {
try {
if (connection != null) {
connection.close();
}
} catch (SQLException e) {
throw e;
}
}
return objectDataResponse;
}
}
| [
"steve.wood@manywho.com"
] | steve.wood@manywho.com |
550fa53a22270cf4c04e06d897e3554d057a4cf8 | a8f0915a94de41152e02b312df1b5a8113972bcf | /Exercises/src/lab/TancSoStudentite22.java | 90b52ad13e470205a9ea56ced38c87888c9062f8 | [] | no_license | stefan-krstikj/OS2018-2019 | 03cbb6734b0508fe2847f7e7346b1a0229975759 | 2772ceb656e5fab5b34ff5659bc644f46bce13b0 | refs/heads/master | 2021-10-26T12:29:11.662481 | 2019-04-12T17:55:55 | 2019-04-12T17:55:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 50 | java | package lab;
public class TancSoStudentite22 {
}
| [
"st.krstic@gmail.com"
] | st.krstic@gmail.com |
f01570e9555a823a606a8726b4ab89c9567e6ccd | 6b43d7f3731d473591a320cee0664fc39bebe6c4 | /src/com/gravical/bwell/models/Users.java | 1c90b31fbd7eb019913616f67f2a626486c1211e | [] | no_license | energyscholar/GravicalBWell | 7ebfdc59bfe7bf759ba3580d8ae81154618fc4bc | c917e675a602647c9897ea91d982efba3dfeb4d7 | refs/heads/master | 2020-12-30T10:12:43.346157 | 2013-02-19T10:00:27 | 2013-02-19T10:00:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,989 | java | package com.gravical.bwell.models;
// Generated 12-Feb-2013 23:08:00 by Hibernate Tools 3.2.1.GA
/**
* Users generated by hbm2java
*/
public class Users implements java.io.Serializable {
private int userId;
private String firstName;
private String lastName;
private Integer roleId;
private String username;
private String passwordHashed;
public Users() {
}
public Users(int userId) {
this.userId = userId;
}
public Users(int userId, String firstName, String lastName, Integer roleId, String username, String passwordHashed) {
this.userId = userId;
this.firstName = firstName;
this.lastName = lastName;
this.roleId = roleId;
this.username = username;
this.passwordHashed = passwordHashed;
}
public int getUserId() {
return this.userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public Integer getRoleId() {
return this.roleId;
}
public void setRoleId(Integer roleId) {
this.roleId = roleId;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPasswordHashed() {
return this.passwordHashed;
}
public void setPasswordHashed(String passwordHashed) {
this.passwordHashed = passwordHashed;
}
public String toString() {
String returnValue = "[" +userId+";"+username+";"+firstName+";"+lastName+";"+passwordHashed+";"+roleId + ";]" ;
return returnValue;
}
}
| [
"energyscholar@gmail.com"
] | energyscholar@gmail.com |
2941f02d39ae50eeac332d0ea0b53e0769bbd118 | ec17c90426fb55189487eff11bde0dad0951b318 | /src/main/java/com/diez_personne/web/HomeController.java | da056baee1e4962ba89cd7b23bb171ed10321489 | [] | no_license | Z-Fantastiques/diez-personne | 022bc8c06ba07af239816d0d1e6bce18d9d56922 | d625467ac3a7b4fbb2e0cf7e7d693df45576f304 | refs/heads/master | 2021-01-10T14:42:48.557990 | 2016-02-01T04:09:29 | 2016-02-01T04:09:29 | 50,803,724 | 0 | 0 | null | 2016-02-09T04:49:17 | 2016-02-01T00:43:32 | HTML | UTF-8 | Java | false | false | 737 | java | package com.diez_personne.web;
import com.diez_personne.repository.ArticleRepository;
import com.diez_personne.repository.QuotationRepository;
import com.diez_personne.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Created by linard_f on 1/25/16.
*/
@Controller
public class HomeController {
@Autowired
private UserRepository userRepository;
@Autowired
private QuotationRepository quotationRepository;
@Autowired
private ArticleRepository articleRepository;
@RequestMapping("/")
public String index() {
return "index";
}
}
| [
"fabien.linardon@epitech.eu"
] | fabien.linardon@epitech.eu |
bfa4e62eda327a75fe27ad28e5bc807b7c43c964 | 9e1a554be71823722d2324db4544f25c7db41fc4 | /validator-io/src/test/java/name/valery1707/jcommander/validators/io/NotExistsTest.java | cc12abe0edb2d1ce3d2f9d6ab21d7db3479455c3 | [
"MIT"
] | permissive | valery1707/jcommander-ext | f9eecb89ca5e5a55d611847c0304a31dee1e47a5 | ffde013bfad45a33aa27f4125f97f8fc958361ca | refs/heads/master | 2021-01-19T12:45:35.365165 | 2019-08-15T01:04:32 | 2019-08-15T01:04:32 | 88,044,724 | 3 | 0 | MIT | 2020-10-14T00:26:53 | 2017-04-12T11:33:54 | Java | UTF-8 | Java | false | false | 728 | java | package name.valery1707.jcommander.validators.io;
import name.valery1707.jcommander.validators.ValidatorTest;
import org.junit.runners.Parameterized;
import java.io.File;
import java.util.Arrays;
import java.util.Collection;
import static name.valery1707.jcommander.validators.io.FileMock.fileMock;
public class NotExistsTest extends ValidatorTest<File, NotExists> {
public NotExistsTest(FileMock value, boolean isValid) {
super(value.getMock(), isValid);
}
@Override
protected NotExists createValidator() {
return new NotExists();
}
@Parameterized.Parameters
public static Collection<Object[]> data() {
return Arrays.asList(new Object[][]{
{fileMock(), true},
{fileMock().exists(), false},
});
}
} | [
"valery1707@gmail.com"
] | valery1707@gmail.com |
2919a1fd4fe783f17cbaa44308b2d6df5b0e4bc8 | e479461037a4dcd87e806ee5709212160b057788 | /app/src/main/java/com/br/controleBluetooth/JoystickClass.java | 1e889d0d6218427265cb075a3f981fc478116467 | [] | no_license | caiofellipe/controleBluetooth-app | 7532525cd1571684ab6f124bc8024fd8f95e7864 | 0d77b807fc03beb3eeff18453bfd51aadd5a6942 | refs/heads/master | 2020-06-12T02:10:44.889978 | 2019-07-27T16:41:17 | 2019-07-27T16:41:17 | 194,161,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,162 | java | package com.br.controleBluetooth;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
public class JoystickClass {
public static final int STICK_NONE = 0;
public static final int STICK_UP = 1;
public static final int STICK_UPRIGHT = 2;
public static final int STICK_RIGHT = 3;
public static final int STICK_DOWNRIGHT = 4;
public static final int STICK_DOWN = 5;
public static final int STICK_DOWNLEFT = 6;
public static final int STICK_LEFT = 7;
public static final int STICK_UPLEFT = 8;
private int STICK_ALPHA = 200;
private int LAYOUT_ALPHA = 200;
private int OFFSET = 0;
private Context mContext;
private ViewGroup mLayout;
private LayoutParams params;
private int stick_width, stick_height;
private int position_x = 0, position_y = 0, min_distance = 0;
private float distance = 0, angle = 0;
private DrawCanvas draw;
private Paint paint;
private Bitmap stick;
private boolean touch_state = false;
public JoystickClass (Context context, ViewGroup layout, int stick_res_id) {
mContext = context;
stick = BitmapFactory.decodeResource(mContext.getResources(), stick_res_id);
stick_width = stick.getWidth();
stick_height = stick.getHeight();
draw = new DrawCanvas(mContext);
paint = new Paint();
mLayout = layout;
params = mLayout.getLayoutParams();
}
public void drawStick(MotionEvent arg1) {
position_x = (int) (arg1.getX() - (params.width / 2));
position_y = (int) (arg1.getY() - (params.height / 2));
distance = (float) Math.sqrt(Math.pow(position_x, 2) + Math.pow(position_y, 2));
angle = (float) cal_angle(position_x, position_y);
if(arg1.getAction() == MotionEvent.ACTION_DOWN) {
if(distance <= (params.width / 2) - OFFSET) {
draw.position(arg1.getX(), arg1.getY());
draw();
touch_state = true;
}
} else if(arg1.getAction() == MotionEvent.ACTION_MOVE && touch_state) {
if(distance <= (params.width / 2) - OFFSET) {
draw.position(arg1.getX(), arg1.getY());
draw();
} else if(distance > (params.width / 2) - OFFSET){
float x = (float) (Math.cos(Math.toRadians(cal_angle(position_x, position_y)))
* ((params.width / 2) - OFFSET));
float y = (float) (Math.sin(Math.toRadians(cal_angle(position_x, position_y)))
* ((params.height / 2) - OFFSET));
x += (params.width / 2);
y += (params.height / 2);
draw.position(x, y);
draw();
} else {
mLayout.removeView(draw);
}
} else if(arg1.getAction() == MotionEvent.ACTION_UP) {
mLayout.removeView(draw);
touch_state = false;
}
}
public int[] getPosition() {
if(distance > min_distance && touch_state) {
return new int[] { position_x, position_y };
}
return new int[] { 0, 0 };
}
public int getX() {
if(distance > min_distance && touch_state) {
return position_x;
}
return 0;
}
public int getY() {
if(distance > min_distance && touch_state) {
return position_y;
}
return 0;
}
public float getAngle() {
if(distance > min_distance && touch_state) {
return angle;
}
return 0;
}
public float getDistance() {
if(distance > min_distance && touch_state) {
return distance;
}
return 0;
}
public void setMinimumDistance(int minDistance) {
min_distance = minDistance;
}
public int getMinimumDistance() {
return min_distance;
}
public int get8Direction() {
if(distance > min_distance && touch_state) {
if(angle >= 247.5 && angle < 292.5 ) {
return STICK_UP;
} else if(angle >= 292.5 && angle < 337.5 ) {
return STICK_UPRIGHT;
} else if(angle >= 337.5 || angle < 22.5 ) {
return STICK_RIGHT;
} else if(angle >= 22.5 && angle < 67.5 ) {
return STICK_DOWNRIGHT;
} else if(angle >= 67.5 && angle < 112.5 ) {
return STICK_DOWN;
} else if(angle >= 112.5 && angle < 157.5 ) {
return STICK_DOWNLEFT;
} else if(angle >= 157.5 && angle < 202.5 ) {
return STICK_LEFT;
} else if(angle >= 202.5 && angle < 247.5 ) {
return STICK_UPLEFT;
}
} else if(distance <= min_distance && touch_state) {
return STICK_NONE;
}
return 0;
}
public int get4Direction() {
if(distance > min_distance && touch_state) {
if(angle >= 225 && angle < 315 ) {
return STICK_UP;
} else if(angle >= 315 || angle < 45 ) {
return STICK_RIGHT;
} else if(angle >= 45 && angle < 135 ) {
return STICK_DOWN;
} else if(angle >= 135 && angle < 225 ) {
return STICK_LEFT;
}
} else if(distance <= min_distance && touch_state) {
return STICK_NONE;
}
return 0;
}
public void setOffset(int offset) {
OFFSET = offset;
}
public int getOffset() {
return OFFSET;
}
public void setStickAlpha(int alpha) {
STICK_ALPHA = alpha;
paint.setAlpha(alpha);
}
public int getStickAlpha() {
return STICK_ALPHA;
}
public void setLayoutAlpha(int alpha) {
LAYOUT_ALPHA = alpha;
mLayout.getBackground().setAlpha(alpha);
}
public int getLayoutAlpha() {
return LAYOUT_ALPHA;
}
public void setStickSize(int width, int height) {
stick = Bitmap.createScaledBitmap(stick, width, height, false);
stick_width = stick.getWidth();
stick_height = stick.getHeight();
}
public void setStickWidth(int width) {
stick = Bitmap.createScaledBitmap(stick, width, stick_height, false);
stick_width = stick.getWidth();
}
public void setStickHeight(int height) {
stick = Bitmap.createScaledBitmap(stick, stick_width, height, false);
stick_height = stick.getHeight();
}
public int getStickWidth() {
return stick_width;
}
public int getStickHeight() {
return stick_height;
}
public void setLayoutSize(int width, int height) {
params.width = width;
params.height = height;
}
public int getLayoutWidth() {
return params.width;
}
public int getLayoutHeight() {
return params.height;
}
private double cal_angle(float x, float y) {
if(x >= 0 && y >= 0)
return Math.toDegrees(Math.atan(y / x));
else if(x < 0 && y >= 0)
return Math.toDegrees(Math.atan(y / x)) + 180;
else if(x < 0 && y < 0)
return Math.toDegrees(Math.atan(y / x)) + 180;
else if(x >= 0 && y < 0)
return Math.toDegrees(Math.atan(y / x)) + 360;
return 0;
}
private void draw() {
try {
mLayout.removeView(draw);
} catch (Exception e) { }
mLayout.addView(draw);
}
private class DrawCanvas extends View{
float x, y;
private DrawCanvas(Context mContext) {
super(mContext);
}
public void onDraw(Canvas canvas) {
canvas.drawBitmap(stick, x, y, paint);
}
private void position(float pos_x, float pos_y) {
x = pos_x - (stick_width / 2);
y = pos_y - (stick_height / 2);
}
}
} | [
"caiofellipe80@gmail.com"
] | caiofellipe80@gmail.com |
79ba979006e3be360896db416f945fd49ba9776d | 15130db5e5358d6ca0a44d5b984fe0ad55e48afd | /src/test/java/com/makemytrip/objectrepository/FlightResults.java | ba83f22e58617b45cf8b8094e1b99b33a369e794 | [] | no_license | vinodkumar012/makemytrip-demo | 19508108c0e882ff72a3b27bd6672a557452bf38 | 8b7d6c46c6d32effeab4109d3df3f7972a89e87c | refs/heads/master | 2021-01-11T15:26:52.463536 | 2017-05-29T11:31:07 | 2017-05-29T11:31:07 | 80,344,543 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.makemytrip.objectrepository;
import io.appium.java_client.AppiumDriver;
import org.openqa.selenium.WebElement;
import com.makemytrip.element.ElementUtils;
public class FlightResults {
public static WebElement btn_Book(AppiumDriver driver) {
return ElementUtils.returnElementByName(driver, "BOOK", new Object(){}.getClass().getEnclosingMethod().getName());
}
}
| [
"b.vinodkumar012@gmail.com"
] | b.vinodkumar012@gmail.com |
d1358a895b6b5cef133548b20d8cc7ad793531d7 | 88dd0d81fc2fd508233e595e5d1dcedc0c5b46f9 | /Heapsort/src/RandomDataGenerator.java | f2c45ff85de78770b2d66236adc9dcf094d5579f | [] | no_license | TOlmsteadWSCU/Data-Structures | 51867ac83f4f8a6016634e6e3c895f5c78248787 | 3937dc300981b71c695cc894c92f6e6e3129e63b | refs/heads/master | 2020-03-08T13:24:37.628262 | 2018-10-01T14:40:55 | 2018-10-01T14:40:55 | 128,157,355 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 295 | 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.
*/
/**
*
* @author Owner
*/
public interface RandomDataGenerator
{
public RandomData generate(int n);
}
| [
"32274688+TOlmsteadWSCU@users.noreply.github.com"
] | 32274688+TOlmsteadWSCU@users.noreply.github.com |
08050c9b07a78e3c2cdb1ac4ce913dfc9ce31ee3 | 0744c9f1083dfc327eea5152ac18479c8c1de24a | /gameplayer/panel/SpecificPanel.java | 7276b7f01c1ee06edc9ec7e0bcb72c37f643f177 | [] | no_license | mtodzo/Game-Authoring-and-Playing-Environment | 5fd4adb9721925827c4423e5d6a93b3347fe788c | e15910299ac741752a0f35221c56606451a39041 | refs/heads/master | 2020-03-27T12:12:05.508335 | 2018-08-29T03:03:13 | 2018-08-29T03:03:13 | 135,588,337 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 362 | java | package gameplayer.panel;
import engine.sprites.towers.FrontEndTower;
/**
* class for panels which display/use information from a specific placed tower
* @author andrewarnold
*
*/
public abstract class SpecificPanel extends Panel {
protected final FrontEndTower TOWER;
public SpecificPanel(FrontEndTower tower) {
TOWER = tower;
}
}
| [
"noreply@github.com"
] | mtodzo.noreply@github.com |
d3e240f8d6a70858d3fa632b77b3b1e75a0aae4b | 57329aa67921bef4165e7f6146a04a580121ee4f | /app/src/main/java/p/gordenyou/elecboardapp/activity/MaterielsActivity.java | b51b244277e8b3918880faeba416da5840ea0815 | [] | no_license | GaoGorden/ElecBoardAPP | 840935b3c12841ff0da67909d6acc996c42e50ca | 0916df3d07b3e20bc576d0aeb63225334aacb4e8 | refs/heads/master | 2022-01-18T11:11:09.491901 | 2019-08-05T09:40:44 | 2019-08-05T09:40:44 | 198,332,224 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,239 | java | package p.gordenyou.elecboardapp.activity;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.design.internal.BottomNavigationMenuView;
import android.support.design.widget.BottomNavigationView;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import java.util.ArrayList;
import java.util.List;
import p.gordenyou.elecboardapp.R;
import p.gordenyou.elecboardapp.adapter.FragmentAdapter;
import p.gordenyou.elecboardapp.fragment.Material.BarFragment;
import p.gordenyou.elecboardapp.fragment.Material.PieFragment;
import p.gordenyou.elecboardapp.fragment.Material.TableFragment;
public class MaterielsActivity extends AppCompatActivity {
private ViewPager mViewpager;
private BottomNavigationView bottomNavigationView;
private static final String TAG = "MainActivity";
private MenuItem mMenuitem;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_materials);
mViewpager = findViewById(R.id.materials_viewpager);
bottomNavigationView = findViewById(R.id.materials_top);
// BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
BottomNavigationMenuView menuView = (BottomNavigationMenuView) bottomNavigationView.getChildAt(0);
for (int i = 0; i < menuView.getChildCount(); i++) {
final View iconView = menuView.getChildAt(i).findViewById(android.support.design.R.id.icon);
final ViewGroup.LayoutParams layoutParams = iconView.getLayoutParams();
final DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
layoutParams.height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, displayMetrics);
layoutParams.width = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 0, displayMetrics);
iconView.setLayoutParams(layoutParams);
}
android.support.v4.app.FragmentManager fg = getSupportFragmentManager();
List<Fragment> list = new ArrayList<>();
PieFragment pieFragment = new PieFragment();
BarFragment barFragment = new BarFragment();
TableFragment tableFragment = new TableFragment();
list.add(pieFragment);
list.add(barFragment);
list.add(tableFragment);
final FragmentAdapter fragmentAdapter = new FragmentAdapter(fg, list);
mViewpager.setAdapter(fragmentAdapter);
mViewpager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
mMenuitem = bottomNavigationView.getMenu().getItem(position);
mMenuitem.setChecked(true);
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
Log.d(TAG, "onNavigationItemSelected: " + item.getItemId());
int fragmentid = 0;
switch (item.getItemId()) {
case R.id.menu_materials_pie:
fragmentid = 0;
break;
case R.id.menu_materials_bar:
fragmentid = 1;
break;
case R.id.menu_materials_table:
fragmentid = 2;
break;
}
mViewpager.setCurrentItem(fragmentid);
return true;
}
});
}
}
| [
"1193688859@qq.com"
] | 1193688859@qq.com |
58effd0f215fb52119e77c79a21526106219b8de | 1078c7726a0ef8145d40338aca6272f29ae37470 | /iSoccer/src/Data/Resources/VehicleData/VehicleData.java | 753119cf97d3d862fe0f6c58f5911fd1955aae34 | [] | no_license | valeriojr/iSoccer3 | a1bb7cf28cf42b367b1d30c10d027c8051dc6421 | 96ab62f5fe2f7b2934d4f030a5b4b64ac5d9b0b5 | refs/heads/master | 2020-03-26T20:53:11.885625 | 2018-08-25T09:49:08 | 2018-08-25T09:49:08 | 145,352,527 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package Data.Resources.VehicleData;
import MVC.Model;
public class VehicleData implements Model {
public static final String ID = "Identificador do veículo", TYPE = "Tipo de veículo";
enum Type {ÔNIBUS, CARRO, AVIÃO}
private String id;
private Type type;
public VehicleData(){
this.id = null;
this.type = null;
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setType(Type type) {
this.type = type;
}
public Type getType() {
return type;
}
@Override
public String toString() {
return String.format("%s: %s\n%s: %s\n", ID, id, TYPE, type);
}
}
| [
"vnrj@ic.ufal.br"
] | vnrj@ic.ufal.br |
2105def93ceeb6deb0743f289d55df1bd42f5e1c | 95053809b8273b7886b75ae54b83cec4be3e483b | /User/src/main/java/com/cts/project/user/controller/UserController.java | 950e467a90711686e6d63edf06b2a949f7c98f6d | [] | no_license | udaykumar572/mt-branch | 4dd4769f4e170ea5646b9ba7c3b9601aa08a2188 | 3ff9720aeb8521b2951a79c091f6905c6771e948 | refs/heads/master | 2022-07-17T21:25:57.086763 | 2020-03-14T13:20:31 | 2020-03-14T13:20:31 | 247,278,310 | 0 | 0 | null | 2022-06-29T18:01:05 | 2020-03-14T13:07:06 | JavaScript | UTF-8 | Java | false | false | 4,186 | java | package com.cts.project.user.controller;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.cts.project.user.Email.EmailService;
import com.cts.project.user.dao.UserRepository;
import com.cts.project.user.pojo.User;
@CrossOrigin(origins="*")
@RequestMapping("/UserPortal")
@RestController
public class UserController
{
@Autowired
private UserRepository userRepository;
@Autowired
private EmailService emailService;
@PostMapping("/saveUser")
public User saveuser(@RequestBody User user) {
System.out.println(user);
userRepository.save(user);
StringBuffer mailContain= new StringBuffer();
mailContain.append("Hi "+user.getUsername()+"\n");
mailContain.append("Please Click on Below Click to Confirm Your Email With Us\n");
mailContain.append("<a href='http://localhost:8082/user/UserPortal/confirmEmail/"+user.getEmail()+">Click</a>\n");
mailContain.append("Thanks And Regards\n CTS Participant\n");
emailService.sendMail(user.getEmail(),"Email Confirmation", mailContain.toString());
//emailService.sendPreConfiguredMail("Ho ho ho");
return user;
}
@RequestMapping("/getAllUsers")
public Iterable<User> getAllUsers() {
return userRepository.findAll();
}
@PutMapping("/updateUser/{username}")
public User updateUser(@RequestBody User user, @PathVariable("username") String username)
{
user.setUsername(username);
System.out.println(user);
userRepository.save(user);
return user;
}
@DeleteMapping("/deleteUser/{username}")
public Boolean deleteCompany( @PathVariable("username") String username) {
System.out.println(username);
userRepository.deleteById(username);
return true;
}
@GetMapping("/findOneInAll6/{username}")
public User findoneinall(@PathVariable("username") String username) {
Optional<User> user = userRepository.findById(username);
return user.get();
}
@GetMapping("/confirmEmail/{email}")
public User confirmEmail(@PathVariable("email") String email) {
Optional<User> user= userRepository.findByEmail(email);
if(user!=null && user.get()!=null)
{
User u=user.get();
u.setConfirm("Yes");
userRepository.save(u);
return u;
}
return user.get();
}
@GetMapping("/findByUsernameAndPassword/{username}/{password}")
public User findByUsernameAndPassword(@PathVariable("username") String username,@PathVariable("password") String password)
{
User user= userRepository.findByUsernameAndPasswordAndConfirm(username, password, "yes");
return user;
}
@PostMapping("/uploadImage/{username}")
public int handleFileUpload(@PathVariable("username") String username , @RequestParam("file") MultipartFile file, HttpSession session) {
Path rootLocation = Paths.get(session.getServletContext().getRealPath("/resources/images"));
System.out.println("rootLocation == " + rootLocation);
String nameExtension[] = file.getContentType().split("/");
String profileimage = System.currentTimeMillis() + "." + nameExtension[1];
System.out.println("ProfileImage :: " + profileimage);
try {
Files.copy(file.getInputStream(),rootLocation.resolve(profileimage));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return 1;
}
}
| [
"60086619+udaykumar572@users.noreply.github.com"
] | 60086619+udaykumar572@users.noreply.github.com |
0c2d6be4caf9d678247103195262a66efce25077 | 9f8304a649e04670403f5dc1cb049f81266ba685 | /common/src/main/java/com/cmcc/vrp/queue/queue/busi/DeadLetterQueue.java | c4c645509c8cc9219b52a0028f2fcd9b40430163 | [] | no_license | hasone/pdata | 632d2d0df9ddd9e8c79aca61a87f52fc4aa35840 | 0a9cfd988e8a414f3bdbf82ae96b82b61d8cccc2 | refs/heads/master | 2020-03-25T04:28:17.354582 | 2018-04-09T00:13:55 | 2018-04-09T00:13:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 957 | java | package com.cmcc.vrp.queue.queue.busi;
import com.cmcc.vrp.queue.consumer.Consumer;
import com.cmcc.vrp.queue.queue.AbstractQueue;
import com.cmcc.vrp.queue.task.Worker;
import org.springframework.stereotype.Component;
/**
* 死信队列
* <p>
* Created by sunyiwei on 2016/12/13.
*/
@Component
public class DeadLetterQueue extends AbstractQueue {
@Override
public Class<? extends Worker> getWorkerClass() {
return null;
}
@Override
public String getQueueName() {
return "x.dead.letter.queue";
}
@Override
protected Consumer getConsumer() {
return null;
}
@Override
public String getFingerPrint() {
return null;
}
@Override
public int getWorkerCount() {
return 10;
}
/**
* 创建队列时是否需要配置死信队列
*
* @return
*/
@Override
public boolean needDeadLetterConfig() {
return false;
}
}
| [
"fromluozuwu@qq.com"
] | fromluozuwu@qq.com |
186312c075e1a491a698831ee2793fbe05af997d | f245776817db71fdbd7fb4c32d80d40847407a50 | /aileron-framework-webclient/src/main/java/cc/aileron/webclient/impl/WebClientImpl.java | 22a6561c12cc29f890890a4219e88b37633eac3a | [] | no_license | aileron/framework2 | 638a8e61ffc526e9f5c8ebdd357c0269c287b9ea | d9182446767310968157747b5073a73e96bc7103 | refs/heads/master | 2021-01-20T10:06:33.339771 | 2011-06-23T09:10:54 | 2011-06-23T09:10:54 | 1,945,318 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 28,903 | java | package cc.aileron.webclient.impl;
import static cc.aileron.generic.util.StringUtils.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.net.HttpCookie;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.UnknownHostException;
import java.util.HashMap;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpException;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpResponseInterceptor;
import org.apache.http.HttpVersion;
import org.apache.http.ParseException;
import org.apache.http.StatusLine;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.impl.DefaultHttpClientConnection;
import org.apache.http.message.BasicHttpEntityEnclosingRequest;
import org.apache.http.message.BasicHttpRequest;
import org.apache.http.params.BasicHttpParams;
import org.apache.http.params.HttpParams;
import org.apache.http.params.HttpProtocolParams;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.BasicHttpProcessor;
import org.apache.http.protocol.ExecutionContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.HttpRequestExecutor;
import org.apache.http.protocol.RequestConnControl;
import org.apache.http.protocol.RequestContent;
import org.apache.http.protocol.RequestExpectContinue;
import org.apache.http.protocol.RequestTargetHost;
import org.apache.http.protocol.RequestUserAgent;
import org.apache.http.util.EntityUtils;
import org.cyberneko.html.parsers.DOMParser;
import org.mozilla.intl.chardet.nsDetector;
import org.mozilla.intl.chardet.nsICharsetDetectionObserver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.html.HTMLDocument;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import cc.aileron.generic.ObjectContainer;
import cc.aileron.generic.Procedure;
import cc.aileron.generic.util.SkipList;
import cc.aileron.generic.util.StringUtils;
import cc.aileron.webclient.WebClient;
import cc.aileron.webclient.WebClientSSLSocketFactory;
import cc.aileron.webclient.WebClientSSLSocketFactoryImpl;
import cc.aileron.webclient.WebRequest;
import cc.aileron.webclient.WebRequestDefault;
import cc.aileron.webclient.WebRequestMethod;
import cc.aileron.webclient.WebRequestProxySetting;
import cc.aileron.webclient.WebResponse;
import cc.aileron.webclient.WebResponseStatus;
import cc.aileron.webclient.html.HtmlPage;
import cc.aileron.webclient.html.entity.HtmlElement;
import com.google.inject.Inject;
import com.google.inject.Singleton;
/**
* @author aileron
*/
@Singleton
public class WebClientImpl implements WebClient
{
@Override
public WebResponse<byte[]> getBytes(final WebRequest r)
throws IOException, HttpException
{
final ObjectContainer<byte[]> b = new ObjectContainer<byte[]>();
final ObjectContainer<String> c = new ObjectContainer<String>();
final WebResponse<Void> res = request(r, new Procedure<HttpEntity>()
{
@Override
public void call(final HttpEntity e)
{
try
{
b.value = EntityUtils.toByteArray(e);
c.value = EntityUtils.getContentCharSet(e);
}
catch (final ParseException e1)
{
}
catch (final IOException e1)
{
}
}
});
final WebRequest request = res.request();
return new WebResponse<byte[]>()
{
@Override
public String charset()
{
return charset;
}
@Override
public List<HttpCookie> cookies()
{
return cookies;
}
@Override
public byte[] entity()
{
return entity;
}
@Override
public WebRequest request()
{
return request;
}
@Override
public WebResponseStatus status()
{
return status;
}
final String charset = c.value;
final List<HttpCookie> cookies = res.cookies();
final byte[] entity = b.value;
final WebResponseStatus status = res.status();
};
}
@Override
public WebResponse<File> getFile(final WebRequest r)
throws IOException, HttpException
{
final ObjectContainer<File> c = new ObjectContainer<File>();
final ObjectContainer<String> d = new ObjectContainer<String>();
final WebResponse<Void> res = request(r, new Procedure<HttpEntity>()
{
@Override
public void call(final HttpEntity e)
{
try
{
final String filepath = r.url()
.getFile()
.replaceAll(".*/(.*?)$", "$1");
final File file = File.createTempFile("WebClient", filepath);
file.deleteOnExit();
final FileOutputStream out = new FileOutputStream(file);
final InputStream in = e.getContent();
int len = -1;
final byte[] b = new byte[1024 * 20];
try
{
while ((len = in.read(b, 0, b.length)) != -1)
{
out.write(b, 0, len);
}
out.flush();
}
finally
{
if (in != null)
{
try
{
in.close();
}
catch (final IOException ie)
{
}
}
}
c.value = file;
d.value = EntityUtils.getContentCharSet(e);
}
catch (final IOException e1)
{
}
}
});
return new WebResponse<File>()
{
@Override
public String charset()
{
return charset;
}
@Override
public List<HttpCookie> cookies()
{
return cookies;
}
@Override
public File entity()
{
return entity;
}
@Override
public WebRequest request()
{
return r;
}
@Override
public WebResponseStatus status()
{
return status;
}
final String charset = d.value;
final List<HttpCookie> cookies = res.cookies();
final File entity = c.value;
final WebResponseStatus status = res.status();
};
}
@Override
public WebResponse<HtmlPage> getPage(final WebRequest request)
throws IOException, HttpException, ParseException, SAXException
{
final WebClient client = this;
final WebResponse<byte[]> response = getBytes(request);
final WebResponseStatus status = response.status();
if (response.status().statusCode() == 404)
{
return new WebResponse<HtmlPage>()
{
@Override
public String charset()
{
return response.charset();
}
@Override
public List<HttpCookie> cookies()
{
return response.cookies();
}
@Override
public HtmlPage entity()
{
return null;
}
@Override
public WebRequest request()
{
return request;
}
@Override
public WebResponseStatus status()
{
return status;
}
@Override
public String toString()
{
return null;
}
};
}
final byte[] entity = response.entity();
final String convertToCharset;
if (response.charset() != null)
{
convertToCharset = response.charset();
}
else
{
final String tmpContent = new String(entity);
final Matcher matcher;
{
final Matcher em = extractEncodingPattern.matcher(tmpContent);
matcher = em != null ? em
: extractCharsetPattern.matcher(tmpContent);
}
if (matcher.find())
{
convertToCharset = matcher.group(1);
}
else
{
final nsDetector det = new nsDetector();
class WebClientCharDetectionObserver implements
nsICharsetDetectionObserver
{
public String detectedCharset()
{
return detectedCharset;
}
@Override
public void Notify(final String charset)
{
detectedCharset = charset;
}
private String detectedCharset = null;
}
final WebClientCharDetectionObserver observer = new WebClientCharDetectionObserver();
det.Init(observer);
if (det.isAscii(entity, entity.length))
{
convertToCharset = "US-ASCII";
}
else
{
det.DoIt(entity, entity.length, false);
convertToCharset = observer.detectedCharset() != null ? observer.detectedCharset()
: request.charset();
}
det.DataEnd();
}
}
final String contentString = convertToCharset == null ? new String(entity)
: new String(entity, convertToCharset);
final DOMParser parser = new DOMParser();
parser.setFeature("http://xml.org/sax/features/namespaces", false);
parser.parse(new InputSource(new StringReader(contentString)));
final HTMLDocument node = (HTMLDocument) parser.getDocument();
final String url;
try
{
url = response.request().url().toURI().toASCIIString();
}
catch (final URISyntaxException e)
{
throw new Error(e);
}
final HtmlPage page = new HtmlPage()
{
@Override
public String asText()
{
return contentString;
}
@Override
public String charset()
{
return convertToCharset;
}
@Override
public List<HttpCookie> cookies()
{
return response.cookies();
}
@Override
public WebResponse<HtmlPage> directJump(final String url)
throws ParseException, URISyntaxException, IOException,
HttpException, SAXException
{
return WebClientCommons.getPageDirect(client, response, url);
}
@Override
public <T extends HtmlElement> List<T> getByXPath(final String xpath)
{
return XPath.<T> xpath(client, response, this, node, xpath);
}
@Override
public WebResponse<HtmlPage> jump(final String url)
throws ParseException, URISyntaxException, IOException,
HttpException, SAXException
{
return WebClientCommons.getPage(client, response, url);
}
@Override
public String title()
{
return node.getTitle();
}
@Override
public String toString()
{
return contentString;
}
@Override
public String url()
{
return url;
}
};
return new WebResponse<HtmlPage>()
{
@Override
public String charset()
{
return response.charset();
}
@Override
public List<HttpCookie> cookies()
{
return response.cookies();
}
@Override
public HtmlPage entity()
{
return page;
}
@Override
public WebRequest request()
{
return request;
}
@Override
public WebResponseStatus status()
{
return status;
}
@Override
public String toString()
{
return contentString;
}
};
}
@Override
public WebResponse<String> getString(final WebRequest r)
throws IOException, HttpException
{
final WebResponse<byte[]> response = getBytes(r);
final String charset;
if (response.charset() != null)
{
charset = response.charset();
}
else if (r.charset() != null)
{
charset = r.charset();
}
else
{
charset = "ISO-8859-1"; // HTTP default charset
}
final String content = new String(response.entity(), charset);
return new WebResponse<String>()
{
@Override
public String charset()
{
return charset;
}
@Override
public List<HttpCookie> cookies()
{
return cookies;
}
@Override
public String entity()
{
return content;
}
@Override
public WebRequest request()
{
return r;
}
@Override
public WebResponseStatus status()
{
return status;
}
@Override
public String toString()
{
return content;
}
final List<HttpCookie> cookies = response.cookies();
final WebResponseStatus status = response.status();
};
}
private List<HttpCookie> mergeCookies(final List<HttpCookie> request,
final List<HttpCookie> response)
{
final HashMap<String, HttpCookie> cookieMap = new HashMap<String, HttpCookie>();
if (request != null)
{
for (final HttpCookie cookie : request)
{
cookieMap.put(cookie.getName(), cookie);
}
}
for (final HttpCookie cookie : response)
{
cookieMap.put(cookie.getName(), cookie);
}
final List<HttpCookie> cookies = new SkipList<HttpCookie>(cookieMap.values());
return cookies;
}
private WebResponse<Void> request(final WebRequest r,
final Procedure<HttpEntity> p)
throws UnknownHostException, IOException, HttpException
{
return request(r, p, 0);
}
private WebResponse<Void> request(final WebRequest r,
final Procedure<HttpEntity> p, final int deps)
throws UnknownHostException, IOException, HttpException
{
if (r.url() == null)
{
throw new Error("URLが指定されていません");
}
final HttpParams params = new BasicHttpParams();
HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
HttpProtocolParams.setContentCharset(params, r.charset());
HttpProtocolParams.setUserAgent(params, r.userAgent());
HttpProtocolParams.setUseExpectContinue(params, true);
final BasicHttpProcessor httpproc = new BasicHttpProcessor();
// Required protocol interceptors
httpproc.addInterceptor(new RequestContent());
httpproc.addInterceptor(new RequestTargetHost());
// Recommended protocol interceptors
httpproc.addInterceptor(new RequestConnControl());
httpproc.addInterceptor(new RequestUserAgent());
httpproc.addInterceptor(new RequestExpectContinue());
if (logger.isDebugEnabled())
{
httpproc.addRequestInterceptor(new HttpRequestInterceptor()
{
@Override
public void process(final HttpRequest request,
final HttpContext context)
throws HttpException, IOException
{
final StringBuilder builder = new StringBuilder();
builder.append("Request "
+ request.getRequestLine().toString() + "\n");
for (final Header header : request.getAllHeaders())
{
builder.append(header.getName() + ": "
+ header.getValue() + "\n");
}
if (request instanceof BasicHttpEntityEnclosingRequest)
{
final HttpEntity entity = ((BasicHttpEntityEnclosingRequest) request).getEntity();
builder.append(StringUtils.input2string(entity.getContent(),
(int) entity.getContentLength()));
builder.append("\n");
}
logger.debug(builder.toString());
}
});
httpproc.addResponseInterceptor(new HttpResponseInterceptor()
{
@Override
public void process(final HttpResponse response,
final HttpContext context)
throws HttpException, IOException
{
final StringBuilder builder = new StringBuilder();
builder.append("Response " + response.getStatusLine()
+ "\n");
for (final Header header : response.getAllHeaders())
{
builder.append(header.getName() + ": "
+ header.getValue() + "\n");
}
logger.debug(builder.toString());
}
});
}
final HttpRequestExecutor httpexecutor = new HttpRequestExecutor();
final DefaultHttpClientConnection conn = new DefaultHttpClientConnection();
final HttpHost host;
{
final String hostname = r.url().getHost();
final int portnumber = r.url().getPort();
final int port = portnumber == -1 ? r.url().getDefaultPort() : portnumber;
host = new HttpHost(hostname, port);
}
final HttpContext context = new BasicHttpContext(null);
if (r.proxy() != null)
{
final WebRequestProxySetting proxy = r.proxy();
context.setAttribute(ExecutionContext.HTTP_PROXY_HOST,
new HttpHost(proxy.hostname(), proxy.port()));
params.setParameter("Host", host.getHostName());
}
params.setParameter("Accept-Language", "ja,en-us;q=0.7,en;q=0.3");
params.setParameter("Accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
context.setAttribute(ExecutionContext.HTTP_CONNECTION, conn);
context.setAttribute(ExecutionContext.HTTP_TARGET_HOST, host);
try
{
if (!conn.isOpen())
{
final Socket socket;
{
if (r.proxy() != null)
{
socket = new Socket(r.proxy().hostname(), r.proxy()
.port());
}
else if (host.getPort() == 443)
{
socket = factory.get(host.getHostName(), 443);
}
else
{
socket = new Socket(host.getHostName(), host.getPort());
}
}
conn.bind(socket, params);
}
final String path = r.url().getPath() == null ? "/" : r.url()
.getPath();
final String query = r.url().getQuery() == null ? "" : r.url()
.getQuery();
final BasicHttpRequest request;
if (r.method() == WebRequestMethod.GET)
{
final String q = r.params() == null || r.params().isEmpty() ? ""
: new BufferedReader(new InputStreamReader(new UrlEncodedFormEntity(r.params(),
r.charset()).getContent())).readLine();
final String requestpath = path
+ (query.isEmpty() ? "?" : "?" + query + "&") + q;
final String requestUrl;
if (r.proxy() != null)
{
requestUrl = host.toURI().toString() + requestpath;
}
else
{
requestUrl = requestpath;
}
request = new BasicHttpRequest(r.method().name(), requestUrl);
}
else
{
final String requestUrl = path
+ (query.isEmpty() ? "" : "?" + query);
final BasicHttpEntityEnclosingRequest req = new BasicHttpEntityEnclosingRequest(r.method()
.name(),
requestUrl);
req.setEntity(new UrlEncodedFormEntity(r.params(), r.charset()));
request = req;
}
/*
* http params
*/
request.setParams(params);
/*
* Cookie
*/
if (r.cookies() != null && r.cookies().isEmpty() == false)
{
final List<String> builder = new SkipList<String>();
for (final HttpCookie cookie : r.cookies())
{
final String domain = r.url().getHost();
final String cdomain = cookie.getDomain() == null ? domain
: cookie.getDomain().indexOf('.') == 0 ? cookie.getDomain()
.substring(1)
: cookie.getDomain();
if (!domain.endsWith(cdomain))
{
continue;
}
builder.add(cookie.getName() + "=" + cookie.getValue());
}
final String cookie = join("; ", builder);
request.addHeader("Cookie", cookie);
}
/*
* Referer
*/
if (r.referer() != null)
{
request.addHeader("Referer", r.referer().toString());
}
httpexecutor.preProcess(request, httpproc, context);
final HttpResponse response = httpexecutor.execute(request,
conn,
context);
response.setParams(params);
httpexecutor.postProcess(response, httpproc, context);
final List<HttpCookie> responseCookies = new SkipList<HttpCookie>();
for (final Header h : response.getHeaders("Set-Cookie"))
{
final String cookie = h.getValue();
try
{
responseCookies.addAll(HttpCookie.parse(cookie));
}
catch (final IllegalArgumentException e)
{
}
}
final List<HttpCookie> cookies = mergeCookies(r.cookies(),
responseCookies);
/*
* リダイレクト
*/
final Header location = response.getFirstHeader("Location");
if (deps < 10 && location != null)
{
final URL locationUrl;
{
URL tmp;
try
{
tmp = new URL(location.getValue());
}
catch (final MalformedURLException e)
{
final int nport = r.url().getPort();
tmp = new URL(r.url().getProtocol() + "://"
+ r.url().getHost()
+ (nport == -1 ? "" : ":" + nport)
+ location.getValue());
}
locationUrl = tmp;
}
return request(new WebRequestDefault(r)
{
@Override
public List<HttpCookie> cookies()
{
return cookies;
}
@Override
public URL url()
{
return locationUrl;
}
}, p, deps + 1);
}
final StatusLine statusLine = response.getStatusLine();
final int statusCode = statusLine.getStatusCode();
final String protocolVersion = statusLine.getProtocolVersion()
.toString();
final String reasonPhrase = statusLine.getReasonPhrase();
p.call(response.getEntity());
return new WebResponse<Void>()
{
@Override
public String charset()
{
return null;
}
@Override
public List<HttpCookie> cookies()
{
return cookies;
}
@Override
public Void entity()
{
return null;
}
@Override
public WebRequest request()
{
return r;
}
@Override
public WebResponseStatus status()
{
return status;
}
WebResponseStatus status = new WebResponseStatus()
{
@Override
public String protocolVersion()
{
return protocolVersion;
}
@Override
public String reasonPhrase()
{
return reasonPhrase;
}
@Override
public int statusCode()
{
return statusCode;
}
};
};
}
finally
{
conn.close();
}
}
/**
* @throws Exception
*/
public WebClientImpl() throws Exception
{
this.factory = new WebClientSSLSocketFactoryImpl();
}
/**
* @param factory
* @throws Exception
*/
@Inject
public WebClientImpl(final WebClientSSLSocketFactory factory)
throws Exception
{
this.factory = factory;
}
final Pattern extractCharsetPattern = Pattern.compile("charset=(.*?)\"");
final Pattern extractEncodingPattern = Pattern.compile("encoding=['\"](.*?)['\"]");
final WebClientSSLSocketFactory factory;
final Logger logger = LoggerFactory.getLogger(this.getClass());
}
| [
"aileron@1bfad7ae-fb7a-e011-b596-0025643c020d"
] | aileron@1bfad7ae-fb7a-e011-b596-0025643c020d |
dc76df73727a74bd6ee462d8e13b5069fbe6c774 | 73029d852f37426758a4bde981713b1ab32f4785 | /springcloud-sentinel-product/src/main/java/com/learn/sentinel/product/entity/Product.java | 31529d34f4fee1688e6597776b1919c93f9c2c82 | [] | no_license | Panlf/springcloud-learn | efe739764a7088db492a7da02b46a87227a84c25 | bda2c9c83ee24a43ecba562eb569910d6a463f6b | refs/heads/master | 2022-06-30T10:32:44.244102 | 2022-06-21T02:48:37 | 2022-06-21T02:48:37 | 228,778,732 | 0 | 0 | null | 2022-06-21T02:48:38 | 2019-12-18T07:01:22 | Java | UTF-8 | Java | false | false | 217 | java | package com.learn.sentinel.product.entity;
import lombok.Data;
/**
* @author Panlf
* @date 2019/12/17
*/
@Data
public class Product {
private Integer id;
private String name;
private Double price;
}
| [
"liangfeng_pan@163.com"
] | liangfeng_pan@163.com |
360216ee691b69b6de55f425979fc2106232e1fa | 0f08a2c053613aca9721d8a74e401f3e8cb654dd | /lightssh/src/com/google/code/lightssh/project/security/dao/LoginAccountDaoJpa.java | cbc800c7542a3029873e175af918cd2cf7f29c29 | [] | no_license | aspen13/lightssh | 1c99e4221dfd2b1ba0b3fb4e55a22da15b5abbf8 | 1bc7c782ca9cf54d08a701a0e02f0d6f847272c5 | refs/heads/master | 2021-01-17T12:24:51.254187 | 2016-06-20T16:37:59 | 2016-06-20T16:37:59 | 32,906,074 | 15 | 15 | null | 2016-01-06T10:45:36 | 2015-03-26T03:44:30 | Java | UTF-8 | Java | false | false | 11,287 | java | package com.google.code.lightssh.project.security.dao;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.persistence.Query;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
import com.google.code.lightssh.common.ApplicationException;
import com.google.code.lightssh.common.dao.jpa.JpaDao;
import com.google.code.lightssh.common.model.page.ListPage;
import com.google.code.lightssh.common.util.StringUtil;
import com.google.code.lightssh.project.party.entity.Organization;
import com.google.code.lightssh.project.party.entity.Party;
import com.google.code.lightssh.project.security.entity.LoginAccount;
import com.google.code.lightssh.project.security.entity.Permission;
import com.google.code.lightssh.project.security.entity.Role;
import com.google.code.lightssh.project.util.constant.AuditStatus;
/**
* LoginAccount Dao Hibernate implement
* @author YangXiaojin
*
*/
@Repository("loginAccountDao")
public class LoginAccountDaoJpa extends JpaDao<LoginAccount>
implements LoginAccountDao{
private static final long serialVersionUID = 4617159875674281868L;
@SuppressWarnings("unchecked")
@Override
public LoginAccount get(String loginName) {
String hql = " SELECT m FROM " + entityClass.getName() + " AS m WHERE m.loginName = ?1 ";
//List<LoginAccount> results = getJpaTemplate().find(hql, loginName );
Query query = this.getEntityManager().createQuery(hql);
this.addQueryParams(query,loginName);
List<LoginAccount> results = query.getResultList();
return (results==null||results.isEmpty())?null:results.get(0);
}
/**
* 根据电子邮箱查登录帐号
*/
@SuppressWarnings("unchecked")
public LoginAccount getByEmail(String email) {
String hql = " SELECT m FROM " + entityClass.getName() + " AS m WHERE m.email = ?1 ";
//List<LoginAccount> results = getJpaTemplate().find(hql, email );
Query query = this.getEntityManager().createQuery(hql);
this.addQueryParams(query,email);
List<LoginAccount> results = query.getResultList();
return (results==null||results.isEmpty())?null:results.get(0);
}
/**
* 组装LoginAccount对象
*/
@SuppressWarnings("unused")
private LoginAccount buildObject( ResultSet rs ){
if( rs == null )
return null;
LoginAccount la = new LoginAccount();
try{
la.setId( rs.getLong("ID"));
la.setPartyId(rs.getString("PARTY_ID"));
la.setLoginName(rs.getString("LOGIN_NAME"));
la.setPassword( rs.getString("PASSWORD"));
la.setStatus(AuditStatus.valueOf( rs.getString("STATUS") ));
la.setPeriod( rs.getDate("PERIOD_START"), rs.getDate("PERIOD_END"));
Calendar cal = Calendar.getInstance();
Timestamp lockedTime = rs.getTimestamp("LAST_LOGIN_LOCK_TIME");
if( lockedTime != null ){
cal.setTime( lockedTime );
la.setLastLoginLockTime( cal );
}
//la.setUseCa( rs.getBoolean("USE_CA") );
//la.setType( LoginAccount.LoginAccountType.valueOf( rs.getString("TYPE") ));
}catch( SQLException e ){
e.printStackTrace();
}
return la;
}
public LoginAccount getWithPartyIdentity(final String loginName){
return this.get(loginName);
/*
//这种方式对连接池释放连接有用//TODO
final String sql_loginaccount = " select * from T_SECURITY_LOGINACCOUNT t where t.login_name = ? ";
LoginAccount result = null;
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
SessionImpl session = null;
try{
session = ((SessionImpl)getEntityManager().getDelegate());
conn = session.connection();
ps = conn.prepareStatement(sql_loginaccount);
ps.setString(1, loginName);
rs = ps.executeQuery();
while(rs.next()){
result = buildObject( rs );
break;
}
}catch( Exception e ){
//ignore
}finally{
session.close();
close( rs,ps,conn);
}
return result;
*/
//Query query = getEntityManager().createNativeQuery(sql_loginaccount);
//Object result = addQueryParams(query,new Object[]{loginName}).getSingleResult();
/*
//这种方式无法释放连接池连接//TODO
return getEntityManager().unwrap( org.hibernate.Session.class).doReturningWork(
new ReturningWork<LoginAccount>(){
public LoginAccount execute(Connection conn) throws SQLException {
PreparedStatement ps = conn.prepareStatement(sql_loginaccount);
ps.setString(1, loginName);
ResultSet rs = ps.executeQuery();
LoginAccount result = null;
while(rs.next()){
result = buildObject( rs );
break;
}
close( rs,ps,conn);
return result;
}
}
);
*/
}
public ListPage<LoginAccount> list(ListPage<LoginAccount> page,LoginAccount t ){
if( t == null )
return list( page );
List<Object> params = new ArrayList<Object>();
StringBuffer hql = new StringBuffer( );
hql.append( " FROM " + entityClass.getName() + " AS m " );
hql.append( " WHERE 1=1 ");
if( t.getLoginName() != null && t.getLoginName().trim() != null
&& !"".equals(t.getLoginName().trim())){
hql.append( " AND m.loginName like ? " );
params.add( "%" + t.getLoginName().trim() + "%");
}
if( t.getType() != null ){
hql.append( " AND m.type = ? " );
params.add( t.getType() );
}
if( t.getStatus() != null ){
hql.append( " AND m.status = ? " );
params.add( t.getStatus());
}
if( t.get_createDatePeriod() != null ){
Calendar cal = Calendar.getInstance();
Date start = t.get_createDatePeriod().getStart();
Date end = t.get_createDatePeriod().getEnd();
if( start != null ){
hql.append( " AND m.createDate >= ? " );
params.add( start );
}
if( end != null ){
cal.setTime(end);
cal.add(Calendar.DAY_OF_MONTH, 1);
cal.add(Calendar.SECOND, -1);
hql.append( " AND m.createDate <= ? " );
params.add( cal.getTime() );
}
}
int subquery_flag = params.size();
if(t.getParty()!=null){
String entityClass = Party.class.getName();
StringBuffer subQuery = new StringBuffer( );
if( StringUtil.clean(t.getParty().getIdentity()) != null ){
subQuery.append(" AND n.id like ?");
params.add("%"+StringUtil.clean(t.getParty().getIdentity())+"%");
}
String name=StringUtil.clean(t.getParty().getName());
if( name !=null){
subQuery.append(" AND n.name like ?");
params.add("%"+name+"%");
}
/*
if(t.getParty() instanceof Member ){
int member_flag = params.size();
Member member = (Member)t.getParty();
if( member.getPartyStatus() != null ){
subQuery.append(" AND n.partyStatus = ? " );
params.add( member.getPartyStatus() );
}
if( StringUtil.clean(member.getIdentity()) != null ){
subQuery.append(" AND n.id = ? " );
params.add( StringUtil.clean(member.getIdentity()) );
}
if( params.size() > member_flag )
entityClass = Member.class.getName();
}else */
if( t.getParty() instanceof Organization ){
int member_flag = params.size();
//Query
if( params.size() > member_flag )
entityClass = Organization.class.getName();
}
if( params.size() > subquery_flag ){
String sub_hql = " SELECT n.id FROM " + entityClass + " As n WHERE 1=1 ";
hql.append( " AND m.party.id in ( " + sub_hql + subQuery.toString() + " ) ");
}
}
return super.query(page, hql.toString(), params.toArray( ) );
}
public void updateRole( final LoginAccount account ){
throw new ApplicationException("DAO未实现!");
}
public ListPage<LoginAccount> listLight(ListPage<LoginAccount> page,LoginAccount t ){
StringBuffer hql = new StringBuffer();
List<Object> params = new ArrayList<Object>();
String select = " SELECT new " + entityClass.getName() + "(m.id,m.loginName) ";
hql.append(" FROM " + entityClass.getName() + " AS m WHERE 1=1 ");
if( t != null ){
if( t.getType() != null ){
hql.append(" AND m.type = ? " );
params.add( t.getType() );
}
}
return super.query(page,select,hql.toString(),params.toArray() );
}
@SuppressWarnings("unchecked")
public List<LoginAccount> listByPermission(final Permission p ){
if( p == null || p.getIdentity() == null )
return null;
String tokens = "select sp.token from T_SECURITY_PERMISSION sp where sp.TOKEN = ? ";
String roles = "select sr.ID from T_SECURITY_ROLE sr "
+ " left join T_REF_ROLE_PERMISSION ref_rp "
+ " on ref_rp.role_id = sr.id where ref_rp.permission_id in "
+ "( " + tokens + " ) ";
final String sql = "select distinct sla.* from T_SECURITY_LOGINACCOUNT sla "
+ " left join T_REF_LOGINACCOUNT_ROLE ref_lr on sla.id = ref_lr.loginaccount_id "
+ " where ref_lr.role_id in( " + roles + " ) order by sla.LOGIN_NAME asc ";
Query query = addQueryParams(getEntityManager().createNativeQuery(
sql.toString(), super.entityClass ), p.getToken() );
return query.getResultList();
}
/**
* 根据角色ID或角色名称查询用户
*/
@SuppressWarnings("unchecked")
public List<LoginAccount> listByRole(AuditStatus status,final Role r ){
if( r == null || (StringUtils.isEmpty(r.getIdentity())
&& StringUtils.isEmpty(r.getName()) ))
return null;
List<Object> params = new ArrayList<Object>();
StringBuffer roles = new StringBuffer(
"select sr.ID from T_SECURITY_ROLE sr where 1=1 ");
if( StringUtils.isNotEmpty(r.getIdentity()) ){
roles.append(" AND sr.ID = ?");
params.add( r.getIdentity().trim());
}
if( StringUtils.isNotEmpty(r.getName()) ){
roles.append(" AND sr.NAME = ?");
params.add( r.getName().trim());
}
String la_ids = "select distinct rlr.loginaccount_id from "
+"T_REF_LOGINACCOUNT_ROLE rlr where rlr.ROLE_ID in( "+roles+" )";
StringBuffer sql = new StringBuffer(
"select * from T_SECURITY_LOGINACCOUNT where 1=1 AND id in( "+la_ids+" )");
if( status != null ){
sql.append(" AND STATUS = ? ");
params.add( status.name() );
}
Query query = addQueryParams(getEntityManager().createNativeQuery(
sql.toString(), super.entityClass ), params);
return query.getResultList();
}
/**
* 更新登录锁定时间
*/
public int updateLockTime( Long id ,Calendar time){
if(time == null)
time = Calendar.getInstance();
String hql = "UPDATE " + this.entityClass.getName()
+ " SET lastLoginLockTime = ? WHERE id = ? ";
Query query = getEntityManager().createQuery(hql);
this.addQueryParams(query,new Object[]{time,id});
return query.executeUpdate();
}
/**
* 清除登录锁定时间
*/
public int cleanLockTime( Long id ){
String hql = "UPDATE " + this.entityClass.getName()
+ " SET lastLoginLockTime = NULL WHERE id = ? ";
Query query = getEntityManager().createQuery(hql);
this.addQueryParams(query,new Object[]{id});
return query.executeUpdate();
}
}
| [
"307526963@qq.com"
] | 307526963@qq.com |
bd4d8ed3bd482feedf6cc20b5b62bf6dac4228be | 1dffbdf459255b3f8d9eea4ef30a17df39529c12 | /Module-03 Capstone/tenmo-server/src/main/java/com/techelevator/tenmo/controller/TransferController.java | 7936aef969b3c3c26d4294f7d97dc1687d1d1f0f | [] | no_license | jeffherz/tech-elevator-capstones | 63c4d66a3527fd1244600fcf0dee3829b7b35037 | 574c2977153ded66eb098efe51a2235bae555b00 | refs/heads/main | 2023-06-17T14:13:27.964236 | 2021-07-14T16:08:22 | 2021-07-14T16:08:22 | 364,073,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,320 | java | package com.techelevator.tenmo.controller;
import java.security.Principal;
import java.util.List;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
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.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import com.techelevator.tenmo.dao.AccountsDAO;
import com.techelevator.tenmo.dao.TransferDAO;
import com.techelevator.tenmo.dao.UserDAO;
import com.techelevator.tenmo.model.Transfer;
import com.techelevator.tenmo.model.User;
@PreAuthorize("isAuthenticated()") // all methods in this class can be accessed by users that are logged in (unless a method states only an Admin can use it)
@RestController
@RequestMapping("transfer")
public class TransferController {
private AccountsDAO accountsDao;
private UserDAO userDao;
private TransferDAO transferDao;
Principal principal;
public TransferController(TransferDAO transferDao, UserDAO userDao, AccountsDAO accountsDao) {
this.transferDao = transferDao;
this.userDao = userDao;
this.accountsDao = accountsDao;
}
// POST to add a transfer to the transfer data table
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(method = RequestMethod.POST)
public Transfer addTransfer(@RequestBody Transfer transfer, Principal principal) {
return transferDao.addTransfer(transfer);
}
//path = "/{transferId}",
//@PathVariable long transferId,
// GET to get a list of transfers current user has sent or received.
// Transfers based on user ID aka the current user
@RequestMapping(method = RequestMethod.GET)
public List<Transfer> getListTransfers(Principal principal) {
long userId = userDao.findIdByUsername(principal.getName());
return transferDao.getListTransfers(userId);
}
// @RequestMapping(method = RequestMethod.GET)
// public Transfer getTransferByTransferId(@RequestParam long transferId) {
// return transferDao.getTransferByTransferId(transferId);
// }
}
| [
"jeffherz565@gmail.com"
] | jeffherz565@gmail.com |
02b788810ca00361a9387c3e83570d1d135cfdc5 | c06e55faac6c282c0b6e1ced1d35994f61a2d478 | /specialist/SKR/src/WSD_Server/src/wsd/util/IntBinSearchMap.java | a67111b39ba14f78e42e84e5d9bcfd354d8157b9 | [] | no_license | aihealthx/SemRep | 6b2562e6f08af13c269d08e61959703d80dcdcbc | dc6ed186db69c0e341151b62ebcc37079db5b2f3 | refs/heads/master | 2023-07-15T09:58:04.556179 | 2021-08-30T21:00:04 | 2021-08-30T21:00:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,264 | java |
/****************************************************************************
*
* PUBLIC DOMAIN NOTICE
* Lister Hill National Center for Biomedical Communications
* National Library of Medicine
* National Institues of Health
* United States Department of Health and Human Services
*
* This software is a United States Government Work under the terms of the
* United States Copyright Act. It was written as part of the authors'
* official duties as United States Government employees and contractors
* and thus cannot be copyrighted. This software is freely available
* to the public for use. The National Library of Medicine and the
* United States Government have not placed any restriction on its
* use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the National Library of Medicine
* and the United States Government do not and cannot warrant the performance
* or results that may be obtained by using this software or data.
* The National Library of Medicine and the U.S. Government disclaim all
* warranties, expressed or implied, including warranties of performance,
* merchantability or fitness for any particular purpose.
*
* For full details, please see the MetaMap Terms & Conditions, available at
* http://metamap.nlm.nih.gov/MMTnCs.shtml.
*
***************************************************************************/
package wsd.util;
import java.io.*;
/**
* Integer Binary Search Map
*<p>
* organization of one record:
* <pre>
* +------------------------+-------------------+
* | term | data |
* +------------------------+-------------------+
* |<---- term length ----->|<---- 4 bytes ---->|
* |<------------- record length -------------->|
* </pre>
*
* Term Length And Data Length Is The Same For All Records In Map.
* </p>
* Created: Wed Jul 25 09:09:18 2001
*
* @author <a href="mailto:wrogers@nlm.nih.gov">Willie Rogers</a>
* @version $Id: IntBinSearchMap.java,v 1.1 2006/09/20 20:47:11 wrogers Exp $
*/
public class IntBinSearchMap implements BinSearchMap, Serializable {
/** length of integer in bytes */
public static final int DATALENGTH = 4; /* is this right? */
/** data output stream for writing map. */
private transient DataOutputStream mapWriter;
/** random access file for reading map. */
private transient RandomAccessFile mapRAFile;
/** number of records in this map. */
int numberOfRecords = 0;
/** term length of all terms in this map. */
private int termLength = 0;
/** canonical name of class*/
public static final String canonicalSerializedName = "IntBinSearchMap.ser";
/** filename of map */
String filename;
/**
* Instantiate a new or existing binary search map with single integers for data.
* @param mapFilename filename of map
* @param mode file mode to use: utils.IntBinSearchMap.WRITE to open map for writing, and
* utils.IntBinSearchMap.READ to open map for reading.
*/
public IntBinSearchMap ( String mapFilename, int mode )
throws FileNotFoundException
{
if ( mode == WRITE ) {
this.mapWriter =
new DataOutputStream ( new BufferedOutputStream
( new FileOutputStream ( mapFilename )));
} else {
this.mapRAFile = new RandomAccessFile ( mapFilename, "r");
}
this.filename = mapFilename;
}
public static IntBinSearchMap getInstance(String filename)
throws FileNotFoundException, IOException, ClassNotFoundException
{
StringBuffer strbuf = new StringBuffer();
strbuf.append(filename).append("_").append(canonicalSerializedName);
String serializedInfo = strbuf.toString();
if ( new File(serializedInfo).exists() ) {
// System.out.println(" loading " + serializedInfo);
FileInputStream istream = new FileInputStream(serializedInfo);
ObjectInputStream p = new ObjectInputStream(istream);
IntBinSearchMap index = (IntBinSearchMap)p.readObject();
istream.close();
index.mapRAFile = new RandomAccessFile ( filename, "r");
index.filename = filename;
return index;
} else {
System.err.println(" " + serializedInfo);
}
return null;
}
/**
* Write an entry into map.
* @param term term
* @param data data to be assoicated with term
*/
public void writeEntry(String term, int data)
throws IOException
{
// write dictionary entry
this.mapWriter.writeBytes(term);
this.mapWriter.writeInt(data);
this.numberOfRecords++;
this.termLength = term.length();
}
/**
* get data entry for term
* @param term term
* @return int value associated with term
*/
public int get(String term)
throws IOException
{
if (this.mapRAFile == null ) {
this.mapRAFile = new RandomAccessFile ( this.filename, "r");
}
return DiskBinarySearch.intBinarySearch(this.mapRAFile,
term, term.length(), this.numberOfRecords);
}
/**
* @return get number of records in map
*/
public int getNumberOfRecords()
{
return this.numberOfRecords;
}
/**
* @return get length of data in each record
*/
public int getDataLength()
{
return this.DATALENGTH;
}
/** close resources used by this map. */
public void close()
throws IOException
{
if (this.mapRAFile != null ) {
this.mapRAFile.close();
}
if (this.mapWriter != null ) {
this.mapWriter.close();
}
}
public void serializeMapInfo()
throws FileNotFoundException, IOException
{
/* serialize info on object to indexDirectoryPath/<Canonical Serialized Name> */
FileOutputStream ostream =
new FileOutputStream(this.filename + "_" + canonicalSerializedName);
ObjectOutputStream p = new ObjectOutputStream(ostream);
p.writeObject(this);
p.flush();
p.close();
ostream.close();
}
}// IntBinSearchMap
| [
"kilicogluh@indsrv2.nlm.nih.gov"
] | kilicogluh@indsrv2.nlm.nih.gov |
87629ce3018aedb9ca639e2fcdda2715eaf84eb3 | 183d057ee3f1255551c9f2bc6080dfcc23262639 | /app/src/main/java/com/cliffex/videomaker/videoeditor/introvd/template/app/push/C4110c.java | c8e23c647937253a72d172ff8a465ba7eac14a48 | [] | no_license | datcoind/VideoMaker-1 | 5567ff713f771b19154ba463469b97d18d0164ec | bcd6697db53b1e76ee510e6e805e46b24a4834f4 | refs/heads/master | 2023-03-19T20:33:16.016544 | 2019-09-27T13:55:07 | 2019-09-27T13:55:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 44,224 | java | package com.introvd.template.app.push;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build.VERSION;
import android.support.p021v4.app.NotificationCompat.BigTextStyle;
import android.support.p021v4.app.NotificationCompat.Builder;
import android.text.TextUtils;
import com.introvd.template.R;
import com.introvd.template.app.notification.C4071a;
import com.introvd.template.app.splash.SplashActivity;
import com.introvd.template.common.LogUtilsV2;
import com.introvd.template.common.behavior.UserBehaviorUtilsV5;
import com.introvd.template.editor.p252e.C5878a;
import com.p131c.p132a.p135c.C2575a;
import com.quvideo.mobile.component.push.C4793c;
import org.json.JSONObject;
/* renamed from: com.introvd.template.app.push.c */
class C4110c implements C4793c {
C4110c() {
}
/* JADX WARNING: Removed duplicated region for block: B:34:0x00a2 */
/* JADX WARNING: Removed duplicated region for block: B:35:0x00ab */
/* JADX WARNING: Removed duplicated region for block: B:57:0x012c */
/* JADX WARNING: Removed duplicated region for block: B:59:? A[RETURN, SYNTHETIC] */
/* renamed from: Q */
/* Code decompiled incorrectly, please refer to instructions dump. */
private void m10204Q(android.content.Context r18, java.lang.String r19) {
/*
r17 = this;
r1 = r18
r2 = r19
java.lang.String r3 = ""
r4 = -1
r5 = 1
r6 = 0
r7 = 0
org.json.JSONObject r0 = new org.json.JSONObject // Catch:{ JSONException -> 0x0059 }
r0.<init>(r2) // Catch:{ JSONException -> 0x0059 }
java.lang.String r9 = "cancelReason"
int r9 = r0.optInt(r9) // Catch:{ JSONException -> 0x0059 }
java.lang.String r10 = "cancelSurveyResult"
org.json.JSONObject r10 = r0.optJSONObject(r10) // Catch:{ JSONException -> 0x0056 }
if (r10 == 0) goto L_0x0025
java.lang.String r11 = "cancelSurveyReason"
int r10 = r10.optInt(r11) // Catch:{ JSONException -> 0x0056 }
r4 = r10
L_0x0025:
java.lang.String r10 = "notificationType"
int r10 = r0.optInt(r10) // Catch:{ JSONException -> 0x0056 }
java.lang.String r11 = "expiryTimeMillis"
long r11 = r0.optLong(r11) // Catch:{ JSONException -> 0x0053 }
java.lang.String r7 = "developerPayload"
java.lang.String r7 = r0.optString(r7) // Catch:{ JSONException -> 0x0051 }
boolean r8 = android.text.TextUtils.isEmpty(r7) // Catch:{ JSONException -> 0x0051 }
if (r8 != 0) goto L_0x0048
java.lang.String r8 = "QUVIDEO"
int r8 = r7.indexOf(r8) // Catch:{ JSONException -> 0x0051 }
java.lang.String r7 = r7.substring(r6, r8) // Catch:{ JSONException -> 0x0051 }
r3 = r7
L_0x0048:
java.lang.String r7 = "paymentState"
int r0 = r0.optInt(r7) // Catch:{ JSONException -> 0x0051 }
r7 = r4
r4 = r0
goto L_0x0062
L_0x0051:
r0 = move-exception
goto L_0x005d
L_0x0053:
r0 = move-exception
r11 = r7
goto L_0x005d
L_0x0056:
r0 = move-exception
r11 = r7
goto L_0x005c
L_0x0059:
r0 = move-exception
r11 = r7
r9 = -1
L_0x005c:
r10 = 0
L_0x005d:
r0.printStackTrace()
r7 = r4
r4 = 1
L_0x0062:
r8 = 5
if (r10 == r8) goto L_0x0067
if (r10 != r5) goto L_0x0090
L_0x0067:
com.introvd.template.common.AppPreferencesSetting r0 = com.introvd.template.common.AppPreferencesSetting.getInstance()
java.lang.String r13 = "pref_iap_risk_tip_id"
r0.setAppSettingStr(r13, r3)
com.introvd.template.common.AppPreferencesSetting r0 = com.introvd.template.common.AppPreferencesSetting.getInstance()
java.lang.String r3 = "pref_iap_risk_tip_state"
r0.setAppSettingInt(r3, r4)
com.introvd.template.common.AppPreferencesSetting r0 = com.introvd.template.common.AppPreferencesSetting.getInstance()
java.lang.String r3 = "pref_iap_risk_tip_time"
long r13 = java.lang.System.currentTimeMillis()
r15 = 2592000000(0x9a7ec800, double:1.280618154E-314)
long r13 = r13 + r15
java.lang.String r13 = java.lang.String.valueOf(r13)
r0.setAppSettingStr(r3, r13)
L_0x0090:
com.introvd.template.app.notification.c$a r3 = new com.introvd.template.app.notification.c$a
r3.<init>()
int r0 = com.introvd.template.R.string.xiaoying_str_community_notification_video_title
java.lang.String r0 = r1.getString(r0)
r3.title = r0
r13 = 7
r14 = 6
r15 = 3
if (r10 != r8) goto L_0x00ab
int r5 = com.introvd.template.R.string.xiaoying_str_subscribe_message_hold
java.lang.String r5 = r1.getString(r5)
r3.content = r5
goto L_0x00fc
L_0x00ab:
if (r10 != r15) goto L_0x00be
int r15 = com.introvd.template.R.string.xiaoying_str_subscribe_message_cancel
java.lang.Object[] r5 = new java.lang.Object[r5]
java.lang.String r11 = com.introvd.template.p203b.C4584e.m11674X(r11)
r5[r6] = r11
java.lang.String r5 = r1.getString(r15, r5)
r3.content = r5
goto L_0x00fc
L_0x00be:
if (r10 != r14) goto L_0x00f2
int r15 = com.introvd.template.R.string.xiaoying_str_subscribe_message_grace_period
java.lang.Object[] r5 = new java.lang.Object[r5]
java.lang.StringBuilder r14 = new java.lang.StringBuilder
r14.<init>()
java.util.Date r8 = new java.util.Date
r8.<init>(r11)
java.util.Date r11 = new java.util.Date
long r0 = java.lang.System.currentTimeMillis()
r11.<init>(r0)
int r0 = com.introvd.template.p203b.C4584e.m11683e(r8, r11)
r14.append(r0)
java.lang.String r0 = ""
r14.append(r0)
java.lang.String r0 = r14.toString()
r5[r6] = r0
r1 = r18
java.lang.String r0 = r1.getString(r15, r5)
r3.content = r0
goto L_0x00fc
L_0x00f2:
if (r10 != r13) goto L_0x00fc
int r0 = com.introvd.template.R.string.xiaoying_str_subscribe_message_restarted
java.lang.String r0 = r1.getString(r0)
r3.content = r0
L_0x00fc:
org.json.JSONObject r5 = new org.json.JSONObject
r5.<init>()
java.lang.String r0 = "a"
r8 = 17001(0x4269, float:2.3823E-41)
r5.put(r0, r8) // Catch:{ Throwable -> 0x010e }
java.lang.String r0 = "b"
r5.put(r0, r2) // Catch:{ Throwable -> 0x010e }
goto L_0x0112
L_0x010e:
r0 = move-exception
r0.printStackTrace()
L_0x0112:
r2 = 5
if (r10 == r2) goto L_0x011f
r2 = 6
if (r10 == r2) goto L_0x011f
if (r10 == r13) goto L_0x011f
r2 = 3
if (r10 != r2) goto L_0x0126
if (r9 != 0) goto L_0x0126
L_0x011f:
java.lang.String r0 = r5.toString()
com.introvd.template.app.notification.C4074c.m10125a(r1, r0, r6, r3)
L_0x0126:
com.introvd.template.module.iap.business.p352b.C7835b.m22854ds(r10, r4)
r1 = 3
if (r10 != r1) goto L_0x012f
com.introvd.template.module.iap.business.p352b.C7835b.m22855dt(r9, r7)
L_0x012f:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.introvd.template.app.push.C4110c.m10204Q(android.content.Context, java.lang.String):void");
}
/* renamed from: a */
private void m10205a(Context context, String str, int i, String str2) {
m10206a(context, str, i, "", "", str2);
}
/* JADX WARNING: Removed duplicated region for block: B:24:0x00bc */
/* JADX WARNING: Removed duplicated region for block: B:25:0x00c3 */
/* JADX WARNING: Removed duplicated region for block: B:28:0x00c7 */
/* JADX WARNING: Removed duplicated region for block: B:31:0x00f9 */
/* renamed from: a */
/* Code decompiled incorrectly, please refer to instructions dump. */
private void m10206a(android.content.Context r17, java.lang.String r18, int r19, java.lang.String r20, java.lang.String r21, java.lang.String r22) {
/*
r16 = this;
r7 = r16
r0 = r17
r1 = r18
r2 = r19
r3 = r20
r4 = r21
r5 = r22
java.lang.StringBuilder r6 = new java.lang.StringBuilder
r6.<init>()
java.lang.String r8 = "handleExtrasCommand strExtras="
r6.append(r8)
r6.append(r1)
java.lang.String r8 = ";nEventType="
r6.append(r8)
r6.append(r2)
java.lang.String r6 = r6.toString()
com.introvd.template.common.LogUtilsV2.m14230i(r6)
java.lang.StringBuilder r6 = new java.lang.StringBuilder
r6.<init>()
java.lang.String r8 = "handleExtrasCommand strTitle="
r6.append(r8)
r6.append(r3)
java.lang.String r8 = ";strMsg="
r6.append(r8)
r6.append(r4)
java.lang.String r6 = r6.toString()
com.introvd.template.common.LogUtilsV2.m14230i(r6)
java.lang.String r6 = ""
java.lang.String r8 = ""
com.introvd.template.app.notification.c$a r15 = new com.introvd.template.app.notification.c$a
r15.<init>()
r15.title = r3
r15.content = r4
r15.bvh = r5
org.json.JSONObject r9 = new org.json.JSONObject // Catch:{ Exception -> 0x00a6 }
r9.<init>(r1) // Catch:{ Exception -> 0x00a6 }
java.lang.String r10 = "event"
java.lang.String r10 = r9.optString(r10) // Catch:{ Exception -> 0x00a6 }
boolean r6 = android.text.TextUtils.isEmpty(r10) // Catch:{ Exception -> 0x00a7 }
if (r6 == 0) goto L_0x0067
return
L_0x0067:
java.lang.String r6 = "message_type"
java.lang.String r6 = r9.optString(r6) // Catch:{ Exception -> 0x00a7 }
java.lang.String r8 = "unique_messageid"
java.lang.String r8 = r9.optString(r8) // Catch:{ Exception -> 0x00a8 }
r15.bvg = r8 // Catch:{ Exception -> 0x00a8 }
java.lang.String r8 = r15.bvg // Catch:{ Exception -> 0x00a8 }
boolean r8 = android.text.TextUtils.isEmpty(r8) // Catch:{ Exception -> 0x00a8 }
if (r8 == 0) goto L_0x0085
java.lang.String r8 = "messageId"
java.lang.String r8 = r9.optString(r8) // Catch:{ Exception -> 0x00a8 }
r15.bvg = r8 // Catch:{ Exception -> 0x00a8 }
L_0x0085:
java.lang.String r8 = "pushMsgID"
java.lang.String r8 = r9.optString(r8) // Catch:{ Exception -> 0x00a8 }
r15.bvi = r8 // Catch:{ Exception -> 0x00a8 }
java.lang.String r8 = "PUSH_TYPE"
java.lang.String r8 = r9.optString(r8) // Catch:{ Exception -> 0x00a8 }
r15.bvf = r8 // Catch:{ Exception -> 0x00a8 }
java.lang.String r8 = r15.bvc // Catch:{ Exception -> 0x00a8 }
boolean r8 = android.text.TextUtils.isEmpty(r8) // Catch:{ Exception -> 0x00a8 }
if (r8 == 0) goto L_0x00ad
java.lang.String r8 = "img_url"
java.lang.String r8 = r9.optString(r8) // Catch:{ Exception -> 0x00a8 }
r15.bvc = r8 // Catch:{ Exception -> 0x00a8 }
goto L_0x00ad
L_0x00a6:
r10 = r6
L_0x00a7:
r6 = r8
L_0x00a8:
java.lang.String r8 = "Unexpected: extras is not a valid json"
com.introvd.template.common.LogUtilsV2.m14228e(r8)
L_0x00ad:
r8 = r6
r6 = r10
java.lang.String r9 = "XiaoYingActivityWeakRef"
r10 = 0
r12 = 0
java.lang.Object r9 = com.introvd.template.common.MagicCode.getMagicParam(r10, r9, r12)
java.lang.ref.WeakReference r9 = (java.lang.ref.WeakReference) r9
if (r9 == 0) goto L_0x00c3
java.lang.Object r9 = r9.get()
android.app.Activity r9 = (android.app.Activity) r9
goto L_0x00c4
L_0x00c3:
r9 = r12
L_0x00c4:
r13 = 4
if (r2 != r13) goto L_0x00f9
if (r9 == 0) goto L_0x00d2
com.introvd.template.router.todoCode.TODOParamModel r0 = com.introvd.template.app.C4027k.m9995dj(r6)
com.introvd.template.app.C4027k.m9994a(r9, r12, r0)
goto L_0x0391
L_0x00d2:
android.content.Intent r1 = new android.content.Intent
java.lang.Class<com.introvd.template.app.splash.SplashActivity> r2 = com.introvd.template.app.splash.SplashActivity.class
r1.<init>(r0, r2)
r2 = 805306368(0x30000000, float:4.656613E-10)
r1.setFlags(r2)
java.lang.String r2 = "android.intent.action.MAIN"
r1.setAction(r2)
java.lang.String r2 = "android.intent.category.LAUNCHER"
r1.addCategory(r2)
java.lang.String r2 = "event"
r1.putExtra(r2, r6)
java.lang.String r2 = "PushService"
java.lang.String r3 = "PushService"
r1.putExtra(r2, r3)
r0.startActivity(r1)
goto L_0x0391
L_0x00f9:
r13 = 2
r14 = 1
if (r2 != r13) goto L_0x014b
r1 = 300(0x12c, float:4.2E-43)
boolean r2 = com.introvd.template.app.splash.C4370e.m10999QA()
if (r2 != 0) goto L_0x0108
r10 = 1000(0x3e8, float:1.401E-42)
goto L_0x010a
L_0x0108:
r10 = 300(0x12c, float:4.2E-43)
L_0x010a:
java.lang.Boolean r1 = java.lang.Boolean.valueOf(r14)
b.b.l r1 = p037b.p050b.C1834l.m5257ah(r1)
b.b.r r2 = p037b.p050b.p076j.C1820a.aVi()
b.b.l r1 = r1.mo10157d(r2)
b.b.r r2 = p037b.p050b.p076j.C1820a.aVi()
b.b.l r1 = r1.mo10152c(r2)
long r2 = (long) r10
java.util.concurrent.TimeUnit r4 = java.util.concurrent.TimeUnit.MILLISECONDS
b.b.l r1 = r1.mo10164f(r2, r4)
b.b.r r2 = p037b.p050b.p051a.p053b.C1487a.aUa()
b.b.l r1 = r1.mo10157d(r2)
b.b.r r2 = p037b.p050b.p051a.p053b.C1487a.aUa()
b.b.l r8 = r1.mo10152c(r2)
com.introvd.template.app.push.c$1 r9 = new com.introvd.template.app.push.c$1
r1 = r9
r2 = r16
r3 = r22
r4 = r15
r5 = r17
r1.<init>(r3, r4, r5, r6)
r8.mo10149b(r9)
goto L_0x0391
L_0x014b:
org.json.JSONObject r11 = new org.json.JSONObject // Catch:{ Throwable -> 0x0392 }
r11.<init>(r6) // Catch:{ Throwable -> 0x0392 }
int r13 = r7.m10208e(r11) // Catch:{ Throwable -> 0x0392 }
java.lang.String r10 = "b"
java.lang.String r10 = r11.optString(r10) // Catch:{ Throwable -> 0x0392 }
boolean r11 = android.text.TextUtils.isEmpty(r10) // Catch:{ Throwable -> 0x0392 }
if (r11 != 0) goto L_0x01e4
org.json.JSONObject r11 = new org.json.JSONObject // Catch:{ Throwable -> 0x0392 }
r11.<init>(r10) // Catch:{ Throwable -> 0x0392 }
java.lang.String r12 = "thumbUrl"
java.lang.String r12 = r11.optString(r12) // Catch:{ Throwable -> 0x0392 }
java.lang.StringBuilder r14 = new java.lang.StringBuilder // Catch:{ Throwable -> 0x0392 }
r14.<init>() // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = "thumbUrl is "
r14.append(r2) // Catch:{ Throwable -> 0x0392 }
r14.append(r12) // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = r14.toString() // Catch:{ Throwable -> 0x0392 }
com.introvd.template.common.LogUtilsV2.m14230i(r2) // Catch:{ Throwable -> 0x0392 }
boolean r2 = android.text.TextUtils.isEmpty(r12) // Catch:{ Throwable -> 0x0392 }
if (r2 != 0) goto L_0x0187
r15.bvc = r12 // Catch:{ Throwable -> 0x0392 }
L_0x0187:
java.lang.String r2 = "imageUrl"
java.lang.String r2 = r11.optString(r2) // Catch:{ Throwable -> 0x0392 }
r15.bvd = r2 // Catch:{ Throwable -> 0x0392 }
java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch:{ Throwable -> 0x0392 }
r2.<init>() // Catch:{ Throwable -> 0x0392 }
java.lang.String r12 = "imageUrl is "
r2.append(r12) // Catch:{ Throwable -> 0x0392 }
java.lang.String r12 = r15.bvd // Catch:{ Throwable -> 0x0392 }
r2.append(r12) // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = r2.toString() // Catch:{ Throwable -> 0x0392 }
com.introvd.template.common.LogUtilsV2.m14230i(r2) // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = "videoUrl"
java.lang.String r2 = r11.optString(r2) // Catch:{ Throwable -> 0x0392 }
r15.videoUrl = r2 // Catch:{ Throwable -> 0x0392 }
java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch:{ Throwable -> 0x0392 }
r2.<init>() // Catch:{ Throwable -> 0x0392 }
java.lang.String r12 = "videoUrl is "
r2.append(r12) // Catch:{ Throwable -> 0x0392 }
java.lang.String r12 = r15.videoUrl // Catch:{ Throwable -> 0x0392 }
r2.append(r12) // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = r2.toString() // Catch:{ Throwable -> 0x0392 }
com.introvd.template.common.LogUtilsV2.m14230i(r2) // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = "customBody"
java.lang.String r2 = r11.optString(r2) // Catch:{ Throwable -> 0x0392 }
boolean r11 = android.text.TextUtils.isEmpty(r2) // Catch:{ Throwable -> 0x0392 }
if (r11 != 0) goto L_0x020c
com.introvd.template.router.user.model.LoginUserInfo r11 = com.introvd.template.router.user.UserServiceProxy.getUserInfo() // Catch:{ Throwable -> 0x0392 }
if (r11 == 0) goto L_0x020c
java.lang.String r11 = "[nickname]"
com.introvd.template.router.user.model.LoginUserInfo r12 = com.introvd.template.router.user.UserServiceProxy.getUserInfo() // Catch:{ Throwable -> 0x0392 }
java.lang.String r12 = r12.nickname // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = r2.replace(r11, r12) // Catch:{ Throwable -> 0x0392 }
r15.content = r2 // Catch:{ Throwable -> 0x0392 }
goto L_0x020c
L_0x01e4:
java.lang.String r2 = r15.content // Catch:{ Throwable -> 0x0392 }
boolean r2 = android.text.TextUtils.isEmpty(r2) // Catch:{ Throwable -> 0x0392 }
if (r2 != 0) goto L_0x020c
java.lang.String r2 = r15.content // Catch:{ Throwable -> 0x0392 }
java.lang.String r11 = "[nickname]"
boolean r2 = r2.contains(r11) // Catch:{ Throwable -> 0x0392 }
if (r2 == 0) goto L_0x020c
com.introvd.template.router.user.model.LoginUserInfo r2 = com.introvd.template.router.user.UserServiceProxy.getUserInfo() // Catch:{ Throwable -> 0x0392 }
if (r2 == 0) goto L_0x020c
java.lang.String r2 = r15.content // Catch:{ Throwable -> 0x0392 }
java.lang.String r11 = "[nickname]"
com.introvd.template.router.user.model.LoginUserInfo r12 = com.introvd.template.router.user.UserServiceProxy.getUserInfo() // Catch:{ Throwable -> 0x0392 }
java.lang.String r12 = r12.nickname // Catch:{ Throwable -> 0x0392 }
java.lang.String r2 = r2.replace(r11, r12) // Catch:{ Throwable -> 0x0392 }
r15.content = r2 // Catch:{ Throwable -> 0x0392 }
L_0x020c:
java.lang.String r2 = "GROUP"
java.lang.String r11 = r15.bvf
boolean r2 = r2.equals(r11)
if (r2 == 0) goto L_0x022b
android.support.v4.app.NotificationManagerCompat r2 = android.support.p021v4.app.NotificationManagerCompat.from(r17)
boolean r2 = r2.areNotificationsEnabled()
if (r2 != 0) goto L_0x0225
java.lang.String r2 = r15.bvg
com.introvd.template.common.behavior.UserBehaviorUtilsV5.recordNotificationDisable(r2)
L_0x0225:
java.lang.String r2 = r15.bvg
com.introvd.template.common.behavior.UserBehaviorUtilsV5.recordPushReceived(r0, r2, r5)
goto L_0x023f
L_0x022b:
java.lang.StringBuilder r2 = new java.lang.StringBuilder
r2.<init>()
r2.append(r13)
java.lang.String r11 = ""
r2.append(r11)
java.lang.String r2 = r2.toString()
com.introvd.template.common.behavior.UserBehaviorUtilsV5.recordPushReceived(r0, r2, r5)
L_0x023f:
if (r13 != 0) goto L_0x0242
return
L_0x0242:
r2 = 17001(0x4269, float:2.3823E-41)
if (r13 != r2) goto L_0x024a
r7.m10204Q(r0, r10)
return
L_0x024a:
r2 = 10001(0x2711, float:1.4014E-41)
if (r13 != r2) goto L_0x025b
com.introvd.template.router.todoCode.TODOParamModel r0 = new com.introvd.template.router.todoCode.TODOParamModel
r0.<init>()
r0.mTODOCode = r2
r0.mJsonParam = r10
com.introvd.template.app.push.AppQATestWorker.m10165b(r0)
return
L_0x025b:
r2 = 10004(0x2714, float:1.4019E-41)
if (r13 != r2) goto L_0x02a3
java.lang.StringBuilder r0 = new java.lang.StringBuilder
r0.<init>()
java.lang.String r2 = "Jamin loadJS Push TODO 10004 strExtras = "
r0.append(r2)
r0.append(r1)
java.lang.String r0 = r0.toString()
com.introvd.template.common.LogUtilsV2.m14227d(r0)
java.lang.StringBuilder r0 = new java.lang.StringBuilder
r0.<init>()
java.lang.String r1 = "Jamin loadJS Push TODO 10004 strTODOContent = "
r0.append(r1)
r0.append(r10)
java.lang.String r0 = r0.toString()
com.introvd.template.common.LogUtilsV2.m14227d(r0)
if (r10 == 0) goto L_0x02a2
org.json.JSONObject r0 = new org.json.JSONObject // Catch:{ Exception -> 0x029e }
r0.<init>(r10) // Catch:{ Exception -> 0x029e }
java.lang.String r1 = "url"
java.lang.String r0 = r0.optString(r1) // Catch:{ Exception -> 0x029e }
com.introvd.template.common.AppPreferencesSetting r1 = com.introvd.template.common.AppPreferencesSetting.getInstance() // Catch:{ Exception -> 0x029e }
java.lang.String r2 = "pref_key_pass_through_web_url"
r1.setAppSettingStr(r2, r0) // Catch:{ Exception -> 0x029e }
goto L_0x02a2
L_0x029e:
r0 = move-exception
r0.printStackTrace()
L_0x02a2:
return
L_0x02a3:
java.lang.StringBuilder r1 = new java.lang.StringBuilder
r1.<init>()
r1.append(r13)
java.lang.String r2 = ""
r1.append(r2)
java.lang.String r1 = r1.toString()
com.introvd.template.common.behavior.UserBehaviorUtilsV5.onEventPushReceiveForeground(r0, r1)
com.introvd.template.app.p177b.C3741a.m9110IH()
r1 = 908(0x38c, float:1.272E-42)
if (r13 != r1) goto L_0x02c5
if (r9 != 0) goto L_0x0391
r7.m10207b(r0, r6, r3, r4)
goto L_0x0391
L_0x02c5:
r1 = 21001(0x5209, float:2.9429E-41)
if (r13 != r1) goto L_0x02f1
r7.m10207b(r0, r6, r3, r4)
if (r10 == 0) goto L_0x02de
org.json.JSONObject r0 = new org.json.JSONObject // Catch:{ Throwable -> 0x02da }
r0.<init>(r10) // Catch:{ Throwable -> 0x02da }
java.lang.String r1 = "id"
long r10 = r0.getLong(r1) // Catch:{ Throwable -> 0x02da }
goto L_0x02e0
L_0x02da:
r0 = move-exception
r0.printStackTrace()
L_0x02de:
r10 = 0
L_0x02e0:
com.introvd.template.component.feedback.C5349b.m14580e(r9, r10)
org.greenrobot.eventbus.c r0 = org.greenrobot.eventbus.C10021c.aZH()
com.introvd.template.common.FeedbackRefreshEvent r1 = new com.introvd.template.common.FeedbackRefreshEvent
r1.<init>()
r0.mo38492aA(r1)
goto L_0x0391
L_0x02f1:
java.lang.String r1 = "1"
boolean r1 = r1.equals(r8)
if (r1 == 0) goto L_0x037d
r1 = 2001(0x7d1, float:2.804E-42)
if (r13 == r1) goto L_0x0354
r1 = 2002(0x7d2, float:2.805E-42)
if (r13 == r1) goto L_0x0354
r1 = 2003(0x7d3, float:2.807E-42)
if (r13 == r1) goto L_0x0354
r1 = 2004(0x7d4, float:2.808E-42)
if (r13 == r1) goto L_0x0354
r1 = 2005(0x7d5, float:2.81E-42)
if (r13 != r1) goto L_0x030e
goto L_0x0354
L_0x030e:
r1 = 1201(0x4b1, float:1.683E-42)
if (r13 != r1) goto L_0x0321
r1 = 1011(0x3f3, float:1.417E-42)
r15.bve = r1
r1 = 1
com.introvd.template.app.notification.C4074c.m10125a(r0, r6, r1, r15)
java.lang.String r1 = r15.bvg
com.introvd.template.common.behavior.UserBehaviorUtilsV5.recordPushReceiveShow(r0, r1, r5)
goto L_0x0391
L_0x0321:
r1 = 10002(0x2712, float:1.4016E-41)
if (r13 != r1) goto L_0x0337
com.introvd.template.router.todoCode.TODOParamModel r1 = new com.introvd.template.router.todoCode.TODOParamModel
r1.<init>()
r1.mTODOCode = r13
r1.mJsonParam = r10
com.introvd.template.router.todoCode.BizAppTodoActionManager r2 = com.introvd.template.router.todoCode.BizAppTodoActionManager.getInstance()
r3 = 0
r2.executeQATestTodo(r0, r1, r3)
goto L_0x0391
L_0x0337:
r1 = 941(0x3ad, float:1.319E-42)
if (r13 != r1) goto L_0x0343
boolean r1 = com.introvd.template.app.notification.C4071a.m10116Nh()
com.introvd.template.app.push.C4095a.m10167b(r0, r6, r1, r15)
goto L_0x0391
L_0x0343:
r1 = 1000(0x3e8, float:1.401E-42)
r15.bve = r1
boolean r1 = com.introvd.template.app.notification.C4071a.m10116Nh()
com.introvd.template.app.notification.C4074c.m10125a(r0, r6, r1, r15)
java.lang.String r1 = r15.bvg
com.introvd.template.common.behavior.UserBehaviorUtilsV5.recordPushReceiveShow(r0, r1, r5)
goto L_0x0391
L_0x0354:
java.lang.String r1 = "GROUP"
java.lang.String r2 = r15.bvf
boolean r1 = r1.equals(r2)
if (r1 != 0) goto L_0x0368
com.introvd.template.app.b.b r1 = com.introvd.template.app.p177b.C3742b.m9111II()
boolean r1 = r1.mo23156Jc()
if (r1 == 0) goto L_0x0391
L_0x0368:
java.lang.String r11 = r15.bvc
java.lang.String r12 = r15.bvf
java.lang.String r1 = r15.bvg
java.lang.String r14 = r15.bvh
r8 = r17
r9 = r13
r13 = r1
com.introvd.template.app.push.C4103b.m10185a(r8, r9, r10, r11, r12, r13, r14)
java.lang.String r1 = r15.bvg
com.introvd.template.common.behavior.UserBehaviorUtilsV5.recordPushReceiveShow(r0, r1, r5)
goto L_0x0391
L_0x037d:
r1 = 3
r2 = r19
if (r2 != r1) goto L_0x0391
java.lang.String r1 = "MIPUSH"
boolean r1 = r5.equals(r1)
if (r1 != 0) goto L_0x0391
boolean r1 = com.introvd.template.app.notification.C4071a.m10116Nh()
com.introvd.template.app.notification.C4074c.m10125a(r0, r6, r1, r15)
L_0x0391:
return
L_0x0392:
r0 = move-exception
r0.printStackTrace()
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.introvd.template.app.push.C4110c.m10206a(android.content.Context, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String):void");
}
/* renamed from: b */
private void m10207b(Context context, String str, String str2, String str3) {
StringBuilder sb = new StringBuilder();
sb.append("showNotification strTitle=");
sb.append(str2);
sb.append(";strContent=");
sb.append(str3);
sb.append(";extraData=");
sb.append(str);
LogUtilsV2.m14230i(sb.toString());
Intent intent = new Intent(context, SplashActivity.class);
intent.setFlags(805306368);
intent.setAction("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");
intent.putExtra("PushService", "PushService");
intent.putExtra("event", str);
PendingIntent activity = PendingIntent.getActivity(context, 0, intent, 134217728);
int i = R.mipmap.ic_launcher;
if (VERSION.SDK_INT >= 21) {
i = R.drawable.push_icon_notice_logo;
}
Builder contentIntent = new Builder(context, "com.introvd.template.notification.default").setSmallIcon(i).setContentIntent(activity);
if (TextUtils.isEmpty(str2)) {
str2 = context.getResources().getString(R.string.xiaoying_str_com_app_name);
}
Builder style = contentIntent.setContentTitle(str2).setContentText(str3 == null ? "" : str3).setStyle(new BigTextStyle().bigText(str3 == null ? "" : str3));
if (str3 == null) {
str3 = "";
}
C4071a.m10118a(context, 1000, style.setTicker(str3).setAutoCancel(true).setDefaults(-1).setPriority(2).build());
}
/* renamed from: e */
private int m10208e(JSONObject jSONObject) {
int i;
try {
i = jSONObject.getInt(C5878a.TAG);
} catch (Throwable th) {
th.printStackTrace();
i = 0;
}
if (i == 0) {
try {
return C2575a.parseInt(jSONObject.getString(C5878a.TAG));
} catch (Throwable th2) {
th2.printStackTrace();
}
}
return i;
}
/* JADX WARNING: Code restructure failed: missing block: B:38:0x010a, code lost:
r0 = move-exception;
*/
/* JADX WARNING: Code restructure failed: missing block: B:40:?, code lost:
r0.printStackTrace();
*/
/* JADX WARNING: Code restructure failed: missing block: B:51:0x0145, code lost:
r0 = move-exception;
*/
/* JADX WARNING: Code restructure failed: missing block: B:55:0x014c, code lost:
r1 = (java.lang.ref.WeakReference) com.introvd.template.common.MagicCode.getMagicParam(0, "XiaoYingActivityWeakRef", null);
*/
/* JADX WARNING: Code restructure failed: missing block: B:59:0x015c, code lost:
r2 = (com.introvd.template.router.community.ICommunityAPI) com.aiii.android.arouter.p091c.C1919a.m5529sc().mo10356i(com.introvd.template.router.community.ICommunityAPI.class);
*/
/* JADX WARNING: Code restructure failed: missing block: B:60:0x0168, code lost:
if (r2 != null) goto L_0x016a;
*/
/* JADX WARNING: Code restructure failed: missing block: B:61:0x016a, code lost:
r2.refreshFollowApplyStatisticalInfo((android.content.Context) r1.get());
r2.refreshMessageStatisticalInfo((android.content.Context) r1.get());
*/
/* JADX WARNING: Code restructure failed: missing block: B:62:0x017c, code lost:
throw r0;
*/
/* JADX WARNING: Code restructure failed: missing block: B:6:0x001d, code lost:
if (r1.contains("event") == false) goto L_0x0022;
*/
/* JADX WARNING: Exception block dominator not found, dom blocks: [B:21:0x0082, B:36:0x00d6] */
/* JADX WARNING: Removed duplicated region for block: B:21:0x0082 A[SYNTHETIC, Splitter:B:21:0x0082] */
/* JADX WARNING: Removed duplicated region for block: B:23:0x0087 A[Catch:{ JSONException -> 0x010a, all -> 0x0145 }] */
/* JADX WARNING: Removed duplicated region for block: B:24:0x008c A[Catch:{ JSONException -> 0x010a, all -> 0x0145 }] */
/* JADX WARNING: Removed duplicated region for block: B:29:0x00b4 */
/* JADX WARNING: Removed duplicated region for block: B:32:0x00c3 A[Catch:{ JSONException -> 0x010a, all -> 0x0145 }] */
/* JADX WARNING: Removed duplicated region for block: B:42:0x0110 A[ADDED_TO_REGION] */
/* JADX WARNING: Removed duplicated region for block: B:64:? A[ADDED_TO_REGION, RETURN, SYNTHETIC] */
/* renamed from: a */
/* Code decompiled incorrectly, please refer to instructions dump. */
public void mo23790a(android.content.Context r17, int r18, java.lang.String r19, java.lang.String r20, java.lang.String r21, java.lang.String r22) {
/*
r16 = this;
r8 = r16
r2 = r17
r9 = r18
r7 = r22
r10 = 3
r11 = 4
if (r9 == r10) goto L_0x004d
if (r9 != r11) goto L_0x000f
goto L_0x004d
L_0x000f:
boolean r0 = android.text.TextUtils.isEmpty(r21)
if (r0 != 0) goto L_0x0020
java.lang.String r0 = "event"
r1 = r21
boolean r0 = r1.contains(r0)
if (r0 != 0) goto L_0x007a
goto L_0x0022
L_0x0020:
r1 = r21
L_0x0022:
org.json.JSONObject r0 = new org.json.JSONObject // Catch:{ Exception -> 0x0048 }
r0.<init>() // Catch:{ Exception -> 0x0048 }
java.lang.String r3 = "a"
r4 = 1002(0x3ea, float:1.404E-42)
r0.put(r3, r4) // Catch:{ Exception -> 0x0048 }
java.lang.String r3 = "b"
java.lang.String r4 = ""
r0.put(r3, r4) // Catch:{ Exception -> 0x0048 }
org.json.JSONObject r3 = new org.json.JSONObject // Catch:{ Exception -> 0x0048 }
r3.<init>() // Catch:{ Exception -> 0x0048 }
java.lang.String r4 = "event"
java.lang.String r0 = r0.toString() // Catch:{ Exception -> 0x0048 }
r3.put(r4, r0) // Catch:{ Exception -> 0x0048 }
java.lang.String r0 = r3.toString() // Catch:{ Exception -> 0x0048 }
goto L_0x0074
L_0x0048:
r0 = move-exception
r0.printStackTrace()
goto L_0x007a
L_0x004d:
r1 = r21
org.json.JSONObject r0 = new org.json.JSONObject // Catch:{ Exception -> 0x0076 }
r0.<init>() // Catch:{ Exception -> 0x0076 }
java.lang.String r3 = "a"
r4 = 1001(0x3e9, float:1.403E-42)
r0.put(r3, r4) // Catch:{ Exception -> 0x0076 }
java.lang.String r3 = "b"
java.lang.String r4 = ""
r0.put(r3, r4) // Catch:{ Exception -> 0x0076 }
org.json.JSONObject r3 = new org.json.JSONObject // Catch:{ Exception -> 0x0076 }
r3.<init>() // Catch:{ Exception -> 0x0076 }
java.lang.String r4 = "event"
java.lang.String r0 = r0.toString() // Catch:{ Exception -> 0x0076 }
r3.put(r4, r0) // Catch:{ Exception -> 0x0076 }
java.lang.String r0 = r3.toString() // Catch:{ Exception -> 0x0076 }
L_0x0074:
r3 = r0
goto L_0x007b
L_0x0076:
r0 = move-exception
r0.printStackTrace()
L_0x007a:
r3 = r1
L_0x007b:
r12 = 0
r13 = 0
r15 = 2
switch(r9) {
case 0: goto L_0x00c3;
case 1: goto L_0x00b4;
case 2: goto L_0x0082;
case 3: goto L_0x008c;
case 4: goto L_0x0087;
default: goto L_0x0082;
}
L_0x0082:
r8.m10205a(r2, r3, r15, r7) // Catch:{ all -> 0x0145 }
goto L_0x010e
L_0x0087:
r8.m10205a(r2, r3, r11, r7) // Catch:{ all -> 0x0145 }
goto L_0x010e
L_0x008c:
java.lang.String r0 = "MIPUSH"
boolean r0 = r7.equals(r0) // Catch:{ all -> 0x0145 }
if (r0 != 0) goto L_0x010e
int r0 = com.introvd.template.R.string.xiaoying_str_community_notification_video_title // Catch:{ Exception -> 0x00b2 }
java.lang.String r5 = r2.getString(r0) // Catch:{ Exception -> 0x00b2 }
org.json.JSONObject r0 = new org.json.JSONObject // Catch:{ Exception -> 0x00b2 }
r6 = r20
r0.<init>(r6) // Catch:{ Exception -> 0x00b2 }
java.lang.String r1 = "content"
java.lang.String r6 = r0.getString(r1) // Catch:{ Exception -> 0x00b2 }
r4 = 3
r1 = r16
r2 = r17
r7 = r22
r1.m10206a(r2, r3, r4, r5, r6, r7) // Catch:{ Exception -> 0x00b2 }
goto L_0x010e
L_0x00b2:
goto L_0x010e
L_0x00b4:
r6 = r20
r4 = 1
r1 = r16
r2 = r17
r5 = r19
r7 = r22
r1.m10206a(r2, r3, r4, r5, r6, r7) // Catch:{ all -> 0x0145 }
goto L_0x010e
L_0x00c3:
java.lang.String r0 = "PUSH_RECEIVE_NOTIFICATION"
com.introvd.template.common.LogUtilsV2.m14227d(r0) // Catch:{ all -> 0x0145 }
boolean r0 = android.text.TextUtils.isEmpty(r3) // Catch:{ all -> 0x0145 }
if (r0 != 0) goto L_0x010e
java.lang.String r0 = "message_type"
boolean r0 = r3.contains(r0) // Catch:{ all -> 0x0145 }
if (r0 == 0) goto L_0x010e
org.json.JSONObject r0 = new org.json.JSONObject // Catch:{ JSONException -> 0x010a }
r0.<init>(r3) // Catch:{ JSONException -> 0x010a }
java.lang.String r1 = "unique_messageid"
java.lang.String r0 = r0.optString(r1) // Catch:{ JSONException -> 0x010a }
java.util.HashMap r1 = new java.util.HashMap // Catch:{ JSONException -> 0x010a }
r1.<init>() // Catch:{ JSONException -> 0x010a }
java.lang.String r3 = "carrier"
r1.put(r3, r7) // Catch:{ JSONException -> 0x010a }
java.lang.String r3 = "type"
r1.put(r3, r0) // Catch:{ JSONException -> 0x010a }
java.lang.StringBuilder r0 = new java.lang.StringBuilder // Catch:{ JSONException -> 0x010a }
r0.<init>() // Catch:{ JSONException -> 0x010a }
java.lang.String r3 = "PUSH_RECEIVE_NOTIFICATION : "
r0.append(r3) // Catch:{ JSONException -> 0x010a }
r0.append(r7) // Catch:{ JSONException -> 0x010a }
java.lang.String r0 = r0.toString() // Catch:{ JSONException -> 0x010a }
com.introvd.template.common.LogUtilsV2.m14227d(r0) // Catch:{ JSONException -> 0x010a }
java.lang.String r0 = "Push_Receive_New"
com.introvd.template.common.UserBehaviorLog.onKVEvent(r2, r0, r1) // Catch:{ JSONException -> 0x010a }
goto L_0x010e
L_0x010a:
r0 = move-exception
r0.printStackTrace() // Catch:{ all -> 0x0145 }
L_0x010e:
if (r9 == r15) goto L_0x0144
if (r9 == r10) goto L_0x0144
if (r9 == r11) goto L_0x0144
java.lang.String r0 = "XiaoYingActivityWeakRef"
java.lang.Object r0 = com.introvd.template.common.MagicCode.getMagicParam(r13, r0, r12)
java.lang.ref.WeakReference r0 = (java.lang.ref.WeakReference) r0
if (r0 == 0) goto L_0x0144
java.lang.Object r1 = r0.get()
if (r1 == 0) goto L_0x0144
com.aiii.android.arouter.c.a r1 = com.aiii.android.arouter.p091c.C1919a.m5529sc()
java.lang.Class<com.introvd.template.router.community.ICommunityAPI> r2 = com.introvd.template.router.community.ICommunityAPI.class
java.lang.Object r1 = r1.mo10356i(r2)
com.introvd.template.router.community.ICommunityAPI r1 = (com.introvd.template.router.community.ICommunityAPI) r1
if (r1 == 0) goto L_0x0144
java.lang.Object r2 = r0.get()
android.content.Context r2 = (android.content.Context) r2
r1.refreshFollowApplyStatisticalInfo(r2)
java.lang.Object r0 = r0.get()
android.content.Context r0 = (android.content.Context) r0
r1.refreshMessageStatisticalInfo(r0)
L_0x0144:
return
L_0x0145:
r0 = move-exception
if (r9 == r15) goto L_0x017c
if (r9 == r10) goto L_0x017c
if (r9 == r11) goto L_0x017c
java.lang.String r1 = "XiaoYingActivityWeakRef"
java.lang.Object r1 = com.introvd.template.common.MagicCode.getMagicParam(r13, r1, r12)
java.lang.ref.WeakReference r1 = (java.lang.ref.WeakReference) r1
if (r1 == 0) goto L_0x017c
java.lang.Object r2 = r1.get()
if (r2 == 0) goto L_0x017c
com.aiii.android.arouter.c.a r2 = com.aiii.android.arouter.p091c.C1919a.m5529sc()
java.lang.Class<com.introvd.template.router.community.ICommunityAPI> r3 = com.introvd.template.router.community.ICommunityAPI.class
java.lang.Object r2 = r2.mo10356i(r3)
com.introvd.template.router.community.ICommunityAPI r2 = (com.introvd.template.router.community.ICommunityAPI) r2
if (r2 == 0) goto L_0x017c
java.lang.Object r3 = r1.get()
android.content.Context r3 = (android.content.Context) r3
r2.refreshFollowApplyStatisticalInfo(r3)
java.lang.Object r1 = r1.get()
android.content.Context r1 = (android.content.Context) r1
r2.refreshMessageStatisticalInfo(r1)
L_0x017c:
throw r0
*/
throw new UnsupportedOperationException("Method not decompiled: com.introvd.template.app.push.C4110c.mo23790a(android.content.Context, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String):void");
}
/* renamed from: a */
public void mo23791a(Context context, String str, String str2, String str3, String str4) {
if ("GROUP".equals(str4)) {
UserBehaviorUtilsV5.recordPushArrive(context, str, str3);
}
}
}
| [
"bhagat.singh@cliffex.com"
] | bhagat.singh@cliffex.com |
2cc991012e32a0c2637b37e5c3d6d9ac172534ae | 584fd0eb1e7c127288aedd01d83b9bf8d2d11e0b | /common/common_utils/src/main/java/com/wang/commonutils/ResultCode.java | b0909885c71176e94d6fe9b54a372c36f8518aaa | [] | no_license | iceCoder-w/Matrix_Backend | a6a4f1a98cd7cfc703dc9b559ee8182fb1938247 | 99769fa40c81ee777719ba6e28ed34847eb9b354 | refs/heads/main | 2023-05-02T03:09:38.303989 | 2021-05-20T15:58:50 | 2021-05-20T15:58:50 | 367,305,926 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 205 | java | package com.wang.commonutils;
/**
* @author 王冰炜
* @create 2021-05-15 17:43
*/
public interface ResultCode {
public static Integer SUCCESS = 20000;
public static Integer ERROR = 20001;
}
| [
"619445114@qq.com"
] | 619445114@qq.com |
fef9f81a4b9921363fe403f81008d1e70b29981a | cffbf5367ed098317689dd82e76875bc14bc615a | /3.Wrapping_ThingML_into_Kevoree/3.1_ThingML_Components_3_Kevoree_Deployments/my_proj/thingml-gen/java/src/main/java/org/thingml/generated/messages/Timer_timeoutMessageType.java | 81c5480f8568c84298d3d827b13f27c08cacf2f5 | [] | no_license | sdalgard/training | fe339c74bd2e1ed90f52791c5fd87e80e344a39e | 607c619f5ddd0ddc565d06c2d74f97ebe6c00f73 | refs/heads/master | 2020-12-26T05:01:54.604025 | 2015-02-18T15:23:15 | 2015-02-18T15:23:15 | 27,819,690 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 802 | java | /**
* File generated by the ThingML IDE
* /!\Do not edit this file/!\
* In case of a bug in the generated code,
* please submit an issue on our GitHub
**/
package org.thingml.generated.messages;
import org.thingml.java.*;
import org.thingml.java.ext.*;
import org.thingml.generated.api.*;
import org.thingml.generated.messages.*;
import java.util.*;
public class Timer_timeoutMessageType extends EventType {
public Timer_timeoutMessageType() {name = "timer_timeout";}
public Event instantiate(final Port port) { return new Timer_timeoutMessage(this, port); }
public class Timer_timeoutMessage extends Event implements java.io.Serializable {
@Override
public String toString(){
return "Timer_timeout ";}
protected Timer_timeoutMessage(EventType type, Port port) {
super(type, port);
}
}
}
| [
"etostd@vm-1204.(none)"
] | etostd@vm-1204.(none) |
e50d4a136a67ec94ad3be7323329d923f20cd78d | 278e872bf0f7ff9f7ae4e26bbd601176e968b6f8 | /app/src/main/java/com/uqtony/fantasyphoto/dropbox/PicassoClient.java | 5e6c87c9d7a560cdbc7e18e4ef4268cf47f00bec | [] | no_license | uqtony/FantasyPhoto | 66efa34dc0781a361f5c2a51031580a61b592388 | 3c94d0904a0cf206245b137014248709d6a6da88 | refs/heads/master | 2020-04-02T15:32:41.272972 | 2018-10-31T20:37:22 | 2018-10-31T20:37:22 | 154,572,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 759 | java | package com.uqtony.fantasyphoto.dropbox;
import android.content.Context;
import com.dropbox.core.v2.DbxClientV2;
import com.squareup.picasso.OkHttp3Downloader;
import com.squareup.picasso.Picasso;
/**
* Singleton instance of Picasso pre-configured
*/
public class PicassoClient {
private static Picasso sPicasso;
public static void init(Context context, DbxClientV2 dbxClient) {
// Configure picasso to know about special thumbnail requests
sPicasso = new Picasso.Builder(context)
.downloader(new OkHttp3Downloader(context))
.addRequestHandler(new FileThumbnailRequestHandler(dbxClient))
.build();
}
public static Picasso getPicasso() {
return sPicasso;
}
}
| [
"tony.shih@coretronic.com"
] | tony.shih@coretronic.com |
8de83424259b1cac1d4f36da6a27cddebc6ced64 | 965de56def155750267d01d6c242f55b60283237 | /src/main/java/cn/rfidcn/activitylog/model/ManagementEvent.java | 6593b85b34bea46ae6cd7f32edcbde35d512e66d | [] | no_license | zhangda/activitylog | 1b3cb5f679f9230c976ec178d031b8c117d39ffd | c874b7c7d77204d440f3b27fa4a42b4bb0e755ab | refs/heads/master | 2020-04-29T11:46:51.839904 | 2015-05-08T05:40:16 | 2015-05-08T05:40:16 | 28,801,793 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package cn.rfidcn.activitylog.model;
public class ManagementEvent extends AppSysLogEvent {
Integer c;
String u;
public Integer getC() {
return c;
}
public void setC(Integer c) {
this.c = c;
}
public String getU() {
return u;
}
public void setU(String u) {
this.u = u;
}
}
| [
"zhangda34ko@gmail.com"
] | zhangda34ko@gmail.com |
df00037b0e291e401d83b770ad2ce9bd5a5438b8 | 9582914549e1856d4081ecacfb94ea4e083fa41f | /app/src/main/java/com/yunbao/phonelive/dialog/LiveUserDialogFragment.java | c80c43b805cc7f70489de3c693fbd112c4bcbe5b | [] | no_license | chenlin141226/live | 691cd4963b2cc0f2ecfa85b999ded23b131b9a7d | 072888970bd679802accf2bd41fb2611f593291f | refs/heads/master | 2020-04-19T01:46:42.866479 | 2019-01-28T01:47:09 | 2019-01-28T01:47:09 | 167,881,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 20,125 | java | package com.yunbao.phonelive.dialog;
import android.app.Dialog;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yunbao.phonelive.AppConfig;
import com.yunbao.phonelive.Constants;
import com.yunbao.phonelive.R;
import com.yunbao.phonelive.activity.LiveActivity;
import com.yunbao.phonelive.activity.UserHomeActivity;
import com.yunbao.phonelive.bean.ImpressBean;
import com.yunbao.phonelive.bean.LevelBean;
import com.yunbao.phonelive.bean.UserBean;
import com.yunbao.phonelive.custom.MyTextView;
import com.yunbao.phonelive.glide.ImgLoader;
import com.yunbao.phonelive.http.HttpCallback;
import com.yunbao.phonelive.http.HttpUtil;
import com.yunbao.phonelive.im.ImMessageUtil;
import com.yunbao.phonelive.interfaces.CommonCallback;
import com.yunbao.phonelive.utils.DialogUitl;
import com.yunbao.phonelive.utils.DpUtil;
import com.yunbao.phonelive.utils.IconUtil;
import com.yunbao.phonelive.utils.TextRender;
import com.yunbao.phonelive.utils.ToastUtil;
import com.yunbao.phonelive.utils.WordUtil;
import java.util.ArrayList;
import java.util.List;
/**
* Created by cxf on 2018/10/15.
* 直播间个人资料弹窗
*/
public class LiveUserDialogFragment extends AbsDialogFragment implements View.OnClickListener {
private static final int TYPE_AUD_AUD = 1;//观众点别的观众
private static final int TYPE_ANC_AUD = 2;//主播点观众
private static final int TYPE_AUD_ANC = 3;//观众点主播
private static final int TYPE_AUD_SELF = 4;//观众点自己
private static final int TYPE_ANC_SELF = 5;//主播点自己
private static final int SETTING_ACTION_SELF = 0;//设置 自己点自己
private static final int SETTING_ACTION_AUD = 30;//设置 普通观众点普通观众 或所有人点超管
private static final int SETTING_ACTION_ADM = 40;//设置 房间管理员点普通观众
private static final int SETTING_ACTION_SUP = 60;//设置 超管点主播
private static final int SETTING_ACTION_ANC_AUD = 501;//设置 主播点普通观众
private static final int SETTING_ACTION_ANC_ADM = 502;//设置 主播点房间管理员
private LinearLayout mRootGroup;
private ImageView mAvatar;
private ImageView mLevelAnchor;
private ImageView mLevel;
private ImageView mSex;
private TextView mName;
private TextView mID;
private TextView mCity;
private LinearLayout mImpressGroup;
private TextView mFollow;
private TextView mFans;
private TextView mConsume;//消费
private TextView mVotes;//收入
private TextView mConsumeTip;
private TextView mVotesTip;
private String mLiveUid;
private String mToUid;
private TextView mBtnFollow;
private int mType;
private int mAction;
private String mToName;//对方的名字
private UserBean mUserBean;
private boolean mFollowing;
@Override
protected int getLayoutId() {
return R.layout.dialog_live_user;
}
@Override
protected int getDialogStyle() {
return R.style.dialog2;
}
@Override
protected boolean canCancel() {
return false;
}
@Override
protected void setWindowAttributes(Window window) {
WindowManager.LayoutParams params = window.getAttributes();
params.width = DpUtil.dp2px(300);
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
params.gravity = Gravity.CENTER;
window.setAttributes(params);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Bundle bundle = getArguments();
if (bundle == null) {
return;
}
mLiveUid = bundle.getString(Constants.LIVE_UID);
mToUid = bundle.getString(Constants.TO_UID);
if (TextUtils.isEmpty(mLiveUid) || TextUtils.isEmpty(mToUid)) {
return;
}
mRootGroup = (LinearLayout) mRootView;
mAvatar = (ImageView) mRootView.findViewById(R.id.avatar);
mLevelAnchor = (ImageView) mRootView.findViewById(R.id.anchor_level);
mLevel = (ImageView) mRootView.findViewById(R.id.level);
mSex = (ImageView) mRootView.findViewById(R.id.sex);
mName = (TextView) mRootView.findViewById(R.id.name);
mID = (TextView) mRootView.findViewById(R.id.id_val);
mCity = (TextView) mRootView.findViewById(R.id.city);
mImpressGroup = (LinearLayout) mRootView.findViewById(R.id.impress_group);
mFollow = (TextView) mRootView.findViewById(R.id.follow);
mFans = (TextView) mRootView.findViewById(R.id.fans);
mConsume = (TextView) mRootView.findViewById(R.id.consume);
mVotes = (TextView) mRootView.findViewById(R.id.votes);
mConsumeTip = (TextView) mRootView.findViewById(R.id.consume_tip);
mVotesTip = (TextView) mRootView.findViewById(R.id.votes_tip);
mRootView.findViewById(R.id.btn_close).setOnClickListener(this);
getType();
LayoutInflater inflater = LayoutInflater.from(mContext);
View bottomView = null;
if (mType == TYPE_AUD_ANC) {
if (mImpressGroup.getVisibility() != View.VISIBLE) {
mImpressGroup.setVisibility(View.VISIBLE);
}
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mRootGroup, true);
} else if (mType == TYPE_AUD_AUD) {
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_1, mRootGroup, true);
} else if (mType == TYPE_ANC_AUD) {
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_2, mRootGroup, true);
} else if (mType == TYPE_AUD_SELF) {
bottomView = inflater.inflate(R.layout.dialog_live_user_bottom_3, mRootGroup, true);
}
if (bottomView != null) {
mBtnFollow = (TextView) bottomView.findViewById(R.id.btn_follow);
if (mBtnFollow != null) {
mBtnFollow.setOnClickListener(this);
}
View btnPriMsg = bottomView.findViewById(R.id.btn_pri_msg);
if (btnPriMsg != null) {
btnPriMsg.setOnClickListener(this);
}
View btnHomePage = bottomView.findViewById(R.id.btn_home_page);
if (btnHomePage != null) {
btnHomePage.setOnClickListener(this);
}
}
loadData();
}
private void getType() {
String uid = AppConfig.getInstance().getUid();
if (mToUid.equals(mLiveUid)) {
if (mLiveUid.equals(uid)) {//主播点自己
mType = TYPE_ANC_SELF;
} else {//观众点主播
mType = TYPE_AUD_ANC;
}
} else {
if (mLiveUid.equals(uid)) {//主播点观众
mType = TYPE_ANC_AUD;
} else {
if (mToUid.equals(uid)) {//观众点自己
mType = TYPE_AUD_SELF;
} else {//观众点别的观众
mType = TYPE_AUD_AUD;
}
}
}
}
private void loadData() {
HttpUtil.getLiveUser(mToUid, mLiveUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
showData(info[0]);
}
}
});
}
private void showData(String data) {
JSONObject obj = JSON.parseObject(data);
mUserBean = JSON.toJavaObject(obj, UserBean.class);
AppConfig appConfig = AppConfig.getInstance();
mID.setText(mUserBean.getLiangNameTip());
mToName = obj.getString("user_nicename");
mName.setText(mToName);
mCity.setText(obj.getString("city"));
ImgLoader.displayAvatar(obj.getString("avatar"), mAvatar);
LevelBean anchorLevelBean = appConfig.getAnchorLevel(obj.getIntValue("level_anchor"));
ImgLoader.display(anchorLevelBean.getThumb(), mLevelAnchor);
LevelBean levelBean = appConfig.getLevel(obj.getIntValue("level"));
ImgLoader.display(levelBean.getThumb(), mLevel);
mSex.setImageResource(IconUtil.getSexIcon(obj.getIntValue("sex")));
mFollow.setText(TextRender.renderLiveUserDialogData(obj.getLongValue("follows")));
mFans.setText(TextRender.renderLiveUserDialogData(obj.getLongValue("fans")));
mConsume.setText(TextRender.renderLiveUserDialogData(obj.getLongValue("consumption")));
mVotes.setText(TextRender.renderLiveUserDialogData(obj.getLongValue("votestotal")));
mConsumeTip.setText(WordUtil.getString(R.string.live_user_send) + appConfig.getCoinName());
mVotesTip.setText(WordUtil.getString(R.string.live_user_get) + appConfig.getVotesName());
if (mType == TYPE_AUD_ANC) {
showImpress(obj.getString("label"));
}
mFollowing = obj.getIntValue("isattention") == 1;
if (mFollowing) {
mBtnFollow.setText(WordUtil.getString(R.string.following));
}
mAction = obj.getIntValue("action");
if (mAction == SETTING_ACTION_AUD) {//设置 普通观众点普通观众 或所有人点超管
View btnReport = mRootView.findViewById(R.id.btn_report);
btnReport.setVisibility(View.VISIBLE);
btnReport.setOnClickListener(this);
} else if (mAction == SETTING_ACTION_ADM//设置 房间管理员点普通观众
|| mAction == SETTING_ACTION_SUP//设置 超管点主播
|| mAction == SETTING_ACTION_ANC_AUD//设置 主播点普通观众
|| mAction == SETTING_ACTION_ANC_ADM) {//设置 主播点房间管理员
View btnSetting = mRootView.findViewById(R.id.btn_setting);
btnSetting.setVisibility(View.VISIBLE);
btnSetting.setOnClickListener(this);
}
}
private void showImpress(String impressJson) {
List<ImpressBean> list = JSON.parseArray(impressJson, ImpressBean.class);
if (list.size() > 2) {
list = list.subList(0, 2);
}
ImpressBean lastBean = new ImpressBean();
lastBean.setName("+ " + WordUtil.getString(R.string.impress_add));
lastBean.setColor("#ffdd00");
list.add(lastBean);
LayoutInflater inflater = LayoutInflater.from(mContext);
for (int i = 0, size = list.size(); i < size; i++) {
MyTextView myTextView = (MyTextView) inflater.inflate(R.layout.view_impress_item_2, mImpressGroup, false);
ImpressBean bean = list.get(i);
if (i == size - 1) {
myTextView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
addImpress();
}
});
} else {
bean.setCheck(1);
}
myTextView.setBean(bean);
mImpressGroup.addView(myTextView);
}
}
/**
* 添加主播印象
*/
private void addImpress() {
dismiss();
((LiveActivity) mContext).openAddImpressWindow(mLiveUid);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.btn_close:
dismiss();
break;
case R.id.btn_follow:
setAttention();
break;
case R.id.btn_pri_msg:
openChatRoomWindow();
break;
case R.id.btn_home_page:
forwardHomePage();
break;
case R.id.btn_setting:
setting();
break;
case R.id.btn_report:
report();
break;
}
}
/**
* 打开私信聊天窗口
*/
private void openChatRoomWindow() {
if (mUserBean != null) {
dismiss();
boolean res = ImMessageUtil.getInstance().markAllMessagesAsRead(mToUid);
if (res) {
ImMessageUtil.getInstance().refreshAllUnReadMsgCount();
}
((LiveActivity) mContext).openChatRoomWindow(mUserBean, mFollowing);
}
}
/**
* 关注
*/
private void setAttention() {
HttpUtil.setAttention(Constants.FOLLOW_FROM_LIVE, mToUid, mAttentionCallback);
}
private CommonCallback<Integer> mAttentionCallback = new CommonCallback<Integer>() {
@Override
public void callback(Integer isAttention) {
mFollowing = isAttention == 1;
if (mBtnFollow != null) {
mBtnFollow.setText(mFollowing ? R.string.following : R.string.follow);
}
if (isAttention == 1 && mLiveUid.equals(mToUid)) {//关注了主播
((LiveActivity) mContext).sendSystemMessage(
AppConfig.getInstance().getUserBean().getUserNiceName() + WordUtil.getString(R.string.live_follow_anchor));
}
}
};
/**
* 跳转到个人主页
*/
private void forwardHomePage() {
dismiss();
UserHomeActivity.forward(mContext, mToUid);
}
/**
* 举报
*/
private void report() {
DialogUitl.showSimpleDialog(mContext, WordUtil.getString(R.string.live_report), new DialogUitl.SimpleCallback() {
@Override
public void onConfirmClick(Dialog dialog, String content) {
HttpUtil.setReport(mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
ToastUtil.show(JSON.parseObject(info[0]).getString("msg"));
}
}
});
}
});
}
/**
* 设置
* <p>
* 某个大神说,角色是权限的集合。。
* <p>
* 理论上,角色的权限应该有服务端以数组或集合的形式返回,这样可以在后台动态配置某种角色的权限,而不是这样口头约定写死。。。
* 然而,是服务端这样做的,我也很无奈。。。也许他们不知道如何做成动态配置的吧。。
* <p>
* 我一直想通过不断重构把代码写的像艺术品,然而,最近发现,这完全是多此一举,自讨苦吃。。是我太天真了。。
* 下面是我发现的一篇文章,说的非常好,也点醒了我。。如果你们发现当前代码写的太烂,不堪入目的话,请阅读下面的文章。
* <p>
* https://www.jianshu.com/p/71521541cd25?utm_campaign=haruki&utm_content=note&utm_medium=reader_share&utm_source=weixin_timeline&from=timeline
*/
private void setting() {
List<Integer> list = new ArrayList<>();
switch (mAction) {
case SETTING_ACTION_ADM://设置 房间管理员点普通观众
list.add(R.string.live_setting_kick);
list.add(R.string.live_setting_gap);
break;
case SETTING_ACTION_SUP://设置 超管点主播
list.add(R.string.live_setting_close_live);
list.add(R.string.live_setting_forbid_account);
break;
case SETTING_ACTION_ANC_AUD://设置 主播点普通观众
list.add(R.string.live_setting_kick);
list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_admin);
list.add(R.string.live_setting_admin_list);
break;
case SETTING_ACTION_ANC_ADM://设置 主播点房间管理员
list.add(R.string.live_setting_kick);
list.add(R.string.live_setting_gap);
list.add(R.string.live_setting_admin_cancel);
list.add(R.string.live_setting_admin_list);
break;
}
DialogUitl.showStringArrayDialog(mContext, list.toArray(new Integer[list.size()]), mArrayDialogCallback);
}
private DialogUitl.StringArrayDialogCallback mArrayDialogCallback = new DialogUitl.StringArrayDialogCallback() {
@Override
public void onItemClick(String text, int tag) {
switch (tag) {
case R.string.live_setting_kick://踢人
kick();
break;
case R.string.live_setting_gap://禁言
setShutUp();
break;
case R.string.live_setting_admin://设为管理
case R.string.live_setting_admin_cancel://取消管理
setAdmin();
break;
case R.string.live_setting_admin_list://管理员列表
adminList();
break;
case R.string.live_setting_close_live://关闭直播
closeLive();
break;
case R.string.live_setting_forbid_account://禁用账户
forbidAccount();
break;
}
}
};
/**
* 查看管理员列表
*/
private void adminList() {
dismiss();
((LiveActivity) mContext).openAdminListWindow();
}
/**
* 踢人
*/
private void kick() {
HttpUtil.kicking(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).kickUser(mToUid, mToName);
} else {
ToastUtil.show(msg);
}
}
});
}
/**
* 禁言
*/
private void setShutUp() {
HttpUtil.setShutUp(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
((LiveActivity) mContext).setShutUp(mToUid, mToName);
} else {
ToastUtil.show(msg);
}
}
});
}
/**
* 设置或取消管理员
*/
private void setAdmin() {
HttpUtil.setAdmin(mLiveUid, mToUid, new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0 && info.length > 0) {
int res = JSON.parseObject(info[0]).getIntValue("isadmin");
if (res == 1) {//被设为管理员
mAction = SETTING_ACTION_ANC_ADM;
} else {//被取消管理员
mAction = SETTING_ACTION_ANC_AUD;
}
((LiveActivity) mContext).sendSetAdminMessage(res, mToUid, mToName);
}
}
});
}
/**
* 超管关闭直播间
*/
private void closeLive() {
dismiss();
HttpUtil.superCloseRoom(mLiveUid, false, mSuperCloseRoomCallback);
}
/**
* 超管关闭直播间并禁用主播账户
*/
private void forbidAccount() {
dismiss();
HttpUtil.superCloseRoom(mLiveUid, true, mSuperCloseRoomCallback);
}
private HttpCallback mSuperCloseRoomCallback = new HttpCallback() {
@Override
public void onSuccess(int code, String msg, String[] info) {
if (code == 0) {
ToastUtil.show(JSON.parseObject(info[0]).getString("msg"));
((LiveActivity) mContext).superCloseRoom();
} else {
ToastUtil.show(msg);
}
}
};
}
| [
"affa@ecoph.tk"
] | affa@ecoph.tk |
d56a40e7ed2ccc2e8d057e83fa03e9d028163872 | 69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e | /methods/Method_1015018.java | 9c7903e00f6f3c21e9da85e03da27f5591d01a52 | [] | no_license | P79N6A/icse_20_user_study | 5b9c42c6384502fdc9588430899f257761f1f506 | 8a3676bc96059ea2c4f6d209016f5088a5628f3c | refs/heads/master | 2020-06-24T08:25:22.606717 | 2019-07-25T15:31:16 | 2019-07-25T15:31:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,094 | java | public MutableLiveData<OperateResult<Integer>> forward(Conversation targetConversation,Message... messages){
MutableLiveData<OperateResult<Integer>> resultMutableLiveData=new MutableLiveData<>();
AtomicInteger count=new AtomicInteger(0);
for ( Message message : messages) {
if (message != null) {
count.addAndGet(1);
}
}
for ( Message message : messages) {
if (message == null) {
continue;
}
message.conversation=targetConversation;
ChatManager.Instance().sendMessage(message,new SendMessageCallback(){
@Override public void onSuccess( long messageUid, long timestamp){
if (count.decrementAndGet() == 0) {
resultMutableLiveData.postValue(new OperateResult<>(0));
}
}
@Override public void onFail( int errorCode){
if (count.decrementAndGet() == 0) {
resultMutableLiveData.postValue(new OperateResult<>(errorCode));
}
}
@Override public void onPrepare( long messageId, long savedTime){
}
}
);
}
return resultMutableLiveData;
}
| [
"sonnguyen@utdallas.edu"
] | sonnguyen@utdallas.edu |
1b7634efe9317256d22ce92f84fa8a99b2605ab2 | 11295034404fc9544b69272ec60509c15dfa8764 | /src/game/Util.java | 6e8fecbde9ddfd3685982baab29552d9613e4378 | [] | no_license | daniel-sarafa/BreakthroughPlayer | d2ee8d0c21a645183ab850d0847400b59f19da0f | a87766a21a07d3d72a02ba4ed32022c5e34cc7b2 | refs/heads/master | 2021-06-13T02:33:06.500130 | 2017-01-27T19:49:29 | 2017-01-27T19:49:29 | 80,238,730 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,359 | java | /* Copyright (C) Mike Zmuda - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited
* Proprietary and confidential
* Written by Mike Zmuda <zmudam@miamioh.edu>, 2010-2015
*/
package game;
import java.util.*;
public class Util {
public static class Pair {
public int row, col;
public Pair(int r, int c)
{ row = r; col = c; }
}
public static void clear(char [][] ary, char empty)
{
for (int r=0; r<ary.length; r++) {
Arrays.fill(ary[r], empty);
}
}
public static boolean inrange(int v, int lo, int hi)
{ return v >= lo && v <= hi; }
public static boolean inrange(int v, int hi)
{ return inrange(v, 0, hi); }
public static void copy(char [][] dest, char [][] src)
{
int NUM_ROWS = src.length;
int NUM_COLS = src[0].length;
for (int r=0; r<NUM_ROWS; r++) {
for (int c=0; c<NUM_COLS; c++) {
dest[r][c] = src[r][c];
}
}
}
public static char [][] clone(char [][] ary)
{
int NUM_ROWS = ary.length;
int NUM_COLS = ary[0].length;
char [][] copyAry = new char [NUM_ROWS][NUM_COLS];
copy(copyAry, ary);
return copyAry;
}
public static void parseMsgString(String s, char [][] grid, char empty)
{
int NUM_ROWS = grid.length;
int NUM_COLS = grid[0].length;
int cnt = 0;
for (int r=NUM_ROWS-1; r>=0; r--) {
for (int c=0; c<NUM_COLS; c++, cnt++) {
grid[r][c] = s.charAt(cnt);
}
}
}
public static void parseMsgString(String s, StringBuffer [][] grid)
{
int NUM_ROWS = grid.length;
int NUM_COLS = grid[0].length;
int capacity = grid[0][0].capacity();
int cnt = 0;
for (int r=NUM_ROWS-1; r>=0; r--) {
for (int c=0; c<NUM_COLS; c++, cnt+=capacity) {
grid[r][c].replace(0, capacity, s.substring(cnt, cnt+capacity));
}
}
}
public static String toString(StringBuffer [][] grid)
{
int capacity = grid[0][0].capacity();
int NUM_ROWS = grid.length;
int NUM_COLS = grid[0].length;
int NUM_SPOTS = NUM_ROWS * NUM_COLS * (capacity+1);
StringBuffer buf = new StringBuffer(NUM_SPOTS + NUM_ROWS);
for (int r=NUM_ROWS-1; r>=0; r--) {
for (int c=0; c<NUM_COLS; c++) {
buf.append(grid[r][c]);
buf.append(' ');
}
buf.append('\n');
}
return buf.toString();
}
public static String toString(char [][] grid)
{
int NUM_ROWS = grid.length;
int NUM_COLS = grid[0].length;
int NUM_SPOTS = NUM_ROWS * NUM_COLS;
StringBuffer buf = new StringBuffer(NUM_SPOTS + NUM_ROWS);
for (int r=NUM_ROWS-1; r>=0; r--) {
buf.append(grid[r]);
buf.append('\n');
}
return buf.toString();
}
public static String msgString(char [][] grid)
{
int NUM_ROWS = grid.length;
int NUM_COLS = grid[0].length;
int NUM_SPOTS = NUM_ROWS * NUM_COLS;
StringBuffer buf = new StringBuffer(NUM_SPOTS);
for (int r=NUM_ROWS-1; r>=0; r--) {
buf.append(grid[r]);
}
return buf.toString();
}
public static String msgString(StringBuffer [][] grid)
{
int capacity = grid[0][0].capacity();
int NUM_ROWS = grid.length;
int NUM_COLS = grid[0].length;
int NUM_SPOTS = NUM_ROWS * NUM_COLS * capacity;
StringBuffer buf = new StringBuffer(NUM_SPOTS);
for (int r=NUM_ROWS-1; r>=0; r--) {
for (int c=0; c<NUM_COLS; c++) {
buf.append(grid[r][c]);
}
}
return buf.toString();
}
public static int randInt(int lo, int hi)
{
int delta = hi - lo + 1;
return lo + (int)(Math.random() * delta);
}
}
| [
"sarafadj@miamioh.edu"
] | sarafadj@miamioh.edu |
7102a60fe8be994f8bc2c4665cceeb7a2fa966d0 | 7594eb9192e3f5d17614095bd8f9d7c1b698c653 | /src/main/java/com/mbancer/service/impl/TaskServiceImpl.java | 7fd11fc2ebc02f063f8584fc258cb6e66208d9e6 | [] | no_license | BulkSecurityGeneratorProject/tasker0 | 0675e9ce66f97c22d97af54c9285af26dbe0005d | 6062c485db1d14b8c65ddd12e40c8e5a822bf1bc | refs/heads/master | 2022-12-10T07:42:57.622747 | 2017-09-25T16:06:22 | 2017-09-25T16:06:22 | 296,582,853 | 0 | 0 | null | 2020-09-18T09:58:57 | 2020-09-18T09:58:56 | null | UTF-8 | Java | false | false | 7,820 | java | package com.mbancer.service.impl;
import com.mbancer.domain.*;
import com.mbancer.repository.*;
import com.mbancer.security.SecurityUtils;
import com.mbancer.service.TaskService;
import com.mbancer.repository.search.TaskSearchRepository;
import com.mbancer.service.UserStoryService;
import com.mbancer.web.rest.dto.TaskDTO;
import com.mbancer.web.rest.mapper.TaskMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
import java.time.LocalDateTime;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import static org.elasticsearch.index.query.QueryBuilders.*;
/**
* Service Implementation for managing Task.
*/
@Service
@Transactional
public class TaskServiceImpl implements TaskService{
private final Logger log = LoggerFactory.getLogger(TaskServiceImpl.class);
@Inject
private TaskRepository taskRepository;
@Inject
private CommentRepository commentRepository;
@Inject
private UserStoryRepository userStoryRepository;
@Inject
private TaskMapper taskMapper;
@Inject
private UserRepository userRepository;
@Inject
private UserStoryService userStoryService;
/**
* Save a task.
*
* @param taskDTO the entity to save
* @return the persisted entity
*/
public TaskDTO save(TaskDTO taskDTO) {
log.debug("Request to save Task : {}", taskDTO);
Task task = taskMapper.taskDTOToTask(taskDTO);
task.setNumber(getNextTaskNumber(taskDTO.getUserStoryId()));
User user = userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).get();
UserStory userStory = userStoryRepository.findOne(taskDTO.getUserStoryId());
userStory.getTasks().add(task);
task.setUser(user);
user.getTasks().add(task);
task = taskRepository.save(task);
TaskDTO result = taskMapper.taskToTaskDTO(task);
return result;
}
/**
* Get all the tasks.
*
* @param pageable the pagination information
* @return the list of entities
*/
@Transactional(readOnly = true)
public Page<Task> findAll(Pageable pageable) {
log.debug("Request to get all Tasks");
Page<Task> result = taskRepository.findAll(pageable);
return result;
}
/**
* Get one task by id.
*
* @param id the id of the entity
* @return the entity
*/
@Transactional(readOnly = true)
public TaskDTO findOne(Long id) {
log.debug("Request to get Task : {}", id);
Task task = taskRepository.findOne(id);
TaskDTO taskDTO = taskMapper.taskToTaskDTO(task);
return taskDTO;
}
/**
* Delete the task by id.
*
* @param id the id of the entity
*/
public void delete(Long id) {
log.debug("Request to delete Task : {}", id);
Task task = taskRepository.findOne(id);
UserStory userStory = task.getUserStory();
List<Task> tasks = userStory.getTasks().stream().sorted(Comparator.comparing(Task::getNumber)).collect(Collectors.toList());
int taskToDeleteIndex = tasks.indexOf(task);
if(taskToDeleteIndex != -1) {
for (int i = taskToDeleteIndex; i < tasks.size(); i++) {
tasks.get(i).setNumber(tasks.get(i).getNumber() - 1);
}
taskRepository.save(tasks);
}
userStory.getTasks().remove(task);
taskRepository.delete(id);
}
@Override
public void addCommentToTask(long taskId, long commentId) {
final Task task = taskRepository.findOne(taskId);
final Comment comment = commentRepository.findOne(commentId);
task.getComments().add(comment);
}
@Override
@Transactional(readOnly = true)
public Page<TaskDTO> getByUser(Long userId, Pageable pageable) {
final Page<Task> tasks = taskRepository.findAllByUserId(userId, pageable);
return tasks.map(taskMapper::taskToTaskDTO);
}
@Override
@Transactional(readOnly = true)
public Page<TaskDTO> getByUserStory(Long userStoryId, Pageable pageable) {
final Page<Task> tasks = taskRepository.findAllByUserStoryIdOrderByNumber(userStoryId, pageable);
return tasks.map(taskMapper::taskToTaskDTO);
}
@Override
public void moveTaskByIdUp(final Long taskId){
final Task task = taskRepository.findOne(taskId);
final Task previousTask = getPreviousTask(task);
long taskNumber = task.getNumber();
task.setNumber(previousTask.getNumber());
previousTask.setNumber(taskNumber);
}
@Override
public void moveTaskByIdDown(final Long taskId){
final Task task = taskRepository.findOne(taskId);
final Task nextTask = getNextTask(task);
long taskNumber = task.getNumber();
task.setNumber(nextTask.getNumber());
nextTask.setNumber(taskNumber);
}
public void assignTaskToCurrentUser(final Long taskId){
final Task task = taskRepository.findOne(taskId);
final User user = userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).get();
task.setAssignee(user);
task.setUpdated(LocalDateTime.now());
taskRepository.save(task);
}
@Override
public List<TaskDTO> getAssignedToCurrentUser() {
User currentUser = userRepository.findOneByLogin(SecurityUtils.getCurrentUserLogin()).get();
final List<Task> tasks = taskRepository.findAllByAssigneeId(currentUser.getId());
return tasks.stream().map(taskMapper::taskToTaskDTO).collect(Collectors.toList());
}
private Task getNextTask(Task task) {
if(task.getNumber() == task.getUserStory().getTasks().size() - 1){
UserStory userStory = userStoryRepository.findOne(task.getUserStory().getId());
UserStory nextUserStory = userStoryService.getNextUserStory(userStory);
if(null != nextUserStory && !userStory.equals(nextUserStory)) {
userStory.getTasks().remove(task);
for (Task usTask : nextUserStory.getTasks()) {
usTask.setNumber(usTask.getNumber() + 1);
}
task.setUserStory(nextUserStory);
task.setNumber(0L);
nextUserStory.getTasks().add(task);
}
return task;
}
UserStory userStory = userStoryRepository.findOne(task.getUserStory().getId());
return taskRepository.findOneByUserStoryIdAndNumber(userStory.getId(), task.getNumber() + 1);
}
private Task getPreviousTask(Task task) {
UserStory userStory = userStoryRepository.findOne(task.getUserStory().getId());
if(task.getNumber() == 0){
UserStory previousUserStory = userStoryService.getPreviousUserStory(userStory);
if(null != previousUserStory) {
task.setUserStory(previousUserStory);
task.setNumber((long) previousUserStory.getTasks().size());
userStory.getTasks().remove(task);
for (Task usTask : userStory.getTasks()) {
usTask.setNumber(usTask.getNumber() - 1);
}
previousUserStory.getTasks().add(task);
}
return task;
}
return taskRepository.findOneByUserStoryIdAndNumber(userStory.getId(), task.getNumber() - 1);
}
private Long getNextTaskNumber(Long userStoryId){
final UserStory userStory = userStoryRepository.findOne(userStoryId);
return (long) userStory.getTasks().size();
}
}
| [
"mariusz.bancer@gmail.com"
] | mariusz.bancer@gmail.com |
f3801f2becb2d0be03be40bc1a7c35b35c8101da | 107140cb85210df0abed1fb5258266c16488a467 | /1.0/CommunityPortal-domain/src/main/java/com/vnps/domain/Address.java | f14539cfa20a1909ca708c0b80d69c346f965e8e | [] | no_license | vnpssoft/community_portal | c89395f19d6c92acfd20fc26b6e0375309706e9a | 1c2210844dbcbf69f9a0a73c958d9386c2d04808 | refs/heads/master | 2021-01-10T01:32:38.813615 | 2015-11-13T08:22:50 | 2015-11-18T03:30:43 | 44,297,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 895 | java | package com.vnps.domain;
public class Address {
private String address1;
private String address2;
private String city;
private String state;
private String zip5;
private String zip4;
public String getAddress1() {
return address1;
}
public void setAddress1(String address1) {
this.address1 = address1;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getZip5() {
return zip5;
}
public void setZip5(String zip5) {
this.zip5 = zip5;
}
public String getZip4() {
return zip4;
}
public void setZip4(String zip4) {
this.zip4 = zip4;
}
}
| [
"n.sankar1973@gmail.com"
] | n.sankar1973@gmail.com |
3dc723880a66fcf4aeecd3f2f13e4377df567bd7 | a9dabf5127dabb8e97d5bf96eb2df23f1c242115 | /espresso/core/java/androidx/test/espresso/action/Tapper.java | 14ffc4e194873601d4976c0253f5a491d6d65ef2 | [
"Apache-2.0"
] | permissive | android/android-test | 0e0af555ab54a8eb58693edc5cf4cb2c486ba12f | 698e592fbd00e554d7b0b2b824151c6146097b15 | refs/heads/main | 2023-08-18T11:46:39.969874 | 2023-08-17T20:27:37 | 2023-08-17T20:28:13 | 41,148,494 | 981 | 294 | Apache-2.0 | 2023-09-12T20:13:29 | 2015-08-21T09:47:39 | Java | UTF-8 | Java | false | false | 2,287 | java | /*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package androidx.test.espresso.action;
import androidx.test.espresso.UiController;
/** Interface to implement different click types. */
public interface Tapper {
/** The result of the tap. */
enum Status {
/** The Tap action completed successfully. */
SUCCESS,
/**
* The action seemed to have completed - but may have been misinterpreted by the application.
* (For Example a TAP became a LONG PRESS by measuring its time between the down and up events).
*/
WARNING,
/** Injecting the event was a complete failure. */
FAILURE
}
/**
* Sends a MotionEvent to the given UiController.
*
* @param uiController a UiController to use to send MotionEvents to the screen.
* @param coordinates a float[] with x and y values of center of the tap.
* @param precision a float[] with x and y values of precision of the tap.
* @param inputDevice the input device of the tap, ie. InputDevice.SOURCE_MOUSE.
* @param buttonState the button the tap is received from, ie. BUTTON_PRIMARY, BUTTON_SECONDARY.
* @return The status of the tap.
*/
Status sendTap(
UiController uiController,
float[] coordinates,
float[] precision,
int inputDevice,
int buttonState);
/**
* @deprecated Use @{link #sendTap(UiController, float[], float[], int, int)} instead This will
* call the @{link #sendTap(UiController, float[], float[], int, int)} with {@link
* android.view.InputDevice#SOURCE_UNKNOWN}, {@link android.view.MotionEvent#BUTTON_PRIMARY}
* by default.
*/
@Deprecated
Status sendTap(UiController uiController, float[] coordinates, float[] precision);
}
| [
"brettchabot@google.com"
] | brettchabot@google.com |
0bee3ec076789a7221dd1b9864ad3f5440683c76 | 557183fc1238dae1e1d9b40d36b3d73be9093a7d | /ec_cart/src/main/java/change/domai/common/Property.java | c150c15f760d6a1db6564e9348927c9b4456c45c | [] | no_license | chonankazuki/ec_merchandise | ee0daeac337ca2edeca3279dc92096dc672ddb62 | 9725c8cf778762775a5aea8f5c93cbd0536fb780 | refs/heads/master | 2023-04-23T10:18:40.794050 | 2021-05-05T00:35:40 | 2021-05-05T00:35:40 | 352,013,715 | 0 | 0 | null | 2021-05-05T06:13:20 | 2021-03-27T07:49:48 | Java | UTF-8 | Java | false | false | 1,522 | java | package change.domai.common;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
import org.springframework.stereotype.Component;
import org.springframework.core.io.Resource;
import org.springframework.core.io.ResourceLoader;
@Component
public class Property {
public static String getProperty(String type,String key) throws IOException {
Properties properties = new Properties();
String file = "";
//String param_file = "/Users/chounankazuki/git/repository/change/src/setting.properties";
//String api_file = "/Users/chounankazuki/git/repository/change/src/url_list.properties";
String param_file = "static/setting.properties";
String api_file = "static/url_list.properties";
if(type == "param") {
file = param_file;
}else if(type == "api") {
file = api_file;
}
try {
//FileInputStream fis = new FileInputStream(file);
System.out.println(file);
System.out.println(ClassLoader.getSystemResourceAsStream(file));
InputStreamReader stream = new InputStreamReader(ClassLoader.getSystemResourceAsStream(file),"UTF-8");
BufferedReader buffer = new BufferedReader(stream);
try {
properties.load(buffer);
String val = properties.getProperty(key);
return val;
} catch (IOException e) {
e.printStackTrace();
throw e;
}
} catch (FileNotFoundException e) {
e.printStackTrace();
throw e;
}
}
}
| [
"isikoro_kaz@yahoo.co.jp"
] | isikoro_kaz@yahoo.co.jp |
5b4fd587460e86513107a9eb1a0ccfc3be0b9e2d | 0b81259a526ff90f99e61c7aac98e857079eb82f | /app/src/main/java/com/example/ricardolopez/dinero/partido.java | f210a121f147975216885384497abdda7de9da24 | [] | no_license | riki0737/dinero1 | 3262896a2eb8815aa3709de62b413bb5721f8c22 | 6695004e3bd603b373b6a48231faf5a213d4e620 | refs/heads/master | 2021-04-29T21:15:59.978748 | 2018-02-15T10:20:16 | 2018-02-15T10:20:16 | 121,612,045 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 625 | java | package com.example.ricardolopez.dinero;
/**
* Created by Ricardo Lopez on 15/2/2018.
*/
public class partido {
categoria tipo;
String temporada;
int mes;
int dia;
public partido(){}
public partido(String t, String temp, int m, int d){
this.tipo = new categoria(t);
this.temporada = temp;
this.mes = m;
this .dia = d;
}
public categoria getcategoria(){
return tipo;
}
public String getTemporada(){
return temporada;
}
public int getMes(){
return mes;
}
public int getDia(){
return dia;
}
}
| [
"Ricardo Lopez@est-etseib.local"
] | Ricardo Lopez@est-etseib.local |
faf0f834dbb17ae73d0b7f03b031eb4370419545 | 4fd74c3f7f8fc465df6ced6466b8dba409552f50 | /src/com/dac/dao/StudentDao.java | 7d67d6b6767dc0e4ebd7128ed7080a16ccb93b6f | [] | no_license | rahulchougule1993/myRepo | 7d128b525233547e11f17e86ba0adcd9c06b8570 | 50e21b4cf9ca92d6a28d0421409d4e30abad8b48 | refs/heads/master | 2020-03-18T05:53:50.431773 | 2018-05-22T05:30:16 | 2018-05-22T05:30:16 | 134,366,788 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 262 | java | package com.dac.dao;
import com.dac.bean.Student;
public interface StudentDao {
boolean save(Student stu);
Student getStudent(int rollNo);
void closeEntityManager();
boolean deleteStudent(int rollNo);
boolean updateStudent(Student studentUpdate);
}
| [
"rahulchougule1993@gmail.com"
] | rahulchougule1993@gmail.com |
4d019efb8e8a61249f1edac8d816a0075d1a04a7 | 25210480ad47389e2ef44cef1b9123b3d3e57054 | /JavaCodeSpace/src/cn/medemede/leecode/CountDigitOne.java | c90188801c784272b3094a8a4086b1a34227779f | [] | no_license | XuCpeng/LeetCode_PTA | 393892112766039772860ba158221fd10a1a36bd | 22602deeb4d709b702e175096f677dd18429cf19 | refs/heads/master | 2023-08-27T01:20:40.377706 | 2021-10-28T14:17:44 | 2021-10-28T14:17:44 | 164,803,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 823 | java | package cn.medemede.leecode;
/**
* 233. 数字 1 的个数
* <p>
* 思路:将各位的1相加。
*/
public class CountDigitOne {
public int countDigitOne(int n) {
// 10^k
int mulk = 1;
int res = 0;
while (n >= mulk) {
// 高位决定的本位1个数
int high = (n / (mulk * 10)) * mulk;
// 低位决定的本位1个数
int low = 0;
// 以本位为最高位的余数
int tmp = n % (mulk * 10);
if (tmp / mulk == 1) {
// 本位为 1
low = tmp % mulk + 1;
} else if (tmp / mulk > 1) {
// 本位大于1
low = mulk;
}
res += high + low;
mulk *= 10;
}
return res;
}
}
| [
"saber3555@outlook.com"
] | saber3555@outlook.com |
87ef34c3ac4a1fbbbf18fc14798b68f49e4b89ce | cb68a35c5d70c7528f6ca32e63654de4b602a421 | /test/biochemie/pcr/modules/TestGCDiff.java | 9f90a93b51ad983668b06868e41b432ea0d7e61c | [] | no_license | smee/assaydesign | 58edc96ea7f60b858fa037c885ff1fab34cb499d | 5f3071866f3733834aa22f84a9031100788ec1ae | refs/heads/master | 2016-08-03T13:59:45.119696 | 2006-04-13T11:17:06 | 2006-04-13T11:17:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,103 | java | /*
* Created on 28.08.2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package biochemie.pcr.modules;
import junit.framework.TestCase;
import biochemie.pcr.PrimerPair;
import biochemie.pcr.io.PCRConfig;
import biochemie.pcr.modules.GCDiff;
/**
* @author Steffen
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class TestGCDiff extends TestCase {
GCDiff gcd;
PrimerPair[] pps;
int[] exp= {0,100,100,50,25};
protected void setUp() throws Exception {
PCRConfig p=new PCRConfig();
gcd=new GCDiff(p,false);
pps=new PrimerPair[5];
pps[0]=new PrimerPair("","",0,1000,1,2,0,0);
pps[1]=new PrimerPair("","",0,1000,10,20,0,0);
pps[2]=new PrimerPair("","",0,1000,20,10,0,0);
pps[3]=new PrimerPair("","",0,1000,10,5,0,0);
pps[4]=new PrimerPair("","",0,500,3,10,0,0);
}
public void testGCDiff() {
gcd.calcScores(pps);
for(int i=0;i<pps.length;i++)
assertEquals(exp[i],pps[i].scores[PrimerPair.GCDIFF]);
}
}
| [
"dienst"
] | dienst |
fb442e3c92cf0dc5d085e4f15a4ace12e8db3c16 | 391ddec7c9a973126f02e959c167275b686cdee9 | /src/com/javarush/test/level04/lesson10/task03/Solution.java | ae8793c4c70af681ed510bbc98e8646f051eb028 | [] | no_license | maksimandreich/JavaRush | 6fd543492cfe4b499b7caa027cb6727c6db14a3e | e82a264fe2ce32bee8cece9b27c9d4f7ff740e4a | refs/heads/master | 2021-01-01T18:55:36.537255 | 2015-09-20T20:11:06 | 2015-09-20T20:11:06 | 42,714,613 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package com.javarush.test.level04.lesson10.task03;
import java.io.BufferedReader;
import java.io.InputStreamReader;
/* Хорошего не бывает много
Ввести с клавиатуры строку и число N.
Вывести на экран строку N раз используя цикл while.
Пример ввода:
абв
2
Пример вывода:
абв
абв
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
//Напишите тут ваш код
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
String str = bufferedReader.readLine();
int n = Integer.parseInt(bufferedReader.readLine());
int i = 1;
while (i++ <= n)
System.out.println(str);
}
}
| [
"maksimandreich@gmail.com"
] | maksimandreich@gmail.com |
f30f3053cb8b301427b43c4b423ec27e2be72100 | f7292ca77446b090ec0c3e0d5453d6923ad1ecb2 | /Projet_29001227/src/Timer.java | d50239f71cc0e314f2470eeea5026c8246a28da8 | [] | no_license | etudiant29001227/Ball-game_project | 1c80a326a1b0eef5d47fbf46032f4c01690ef8a3 | 53f4ab6b7402c1169b574918d19d725a51d84ad3 | refs/heads/master | 2020-04-06T11:50:21.699793 | 2018-11-13T21:48:55 | 2018-11-13T21:48:55 | 157,432,549 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 769 | java |
public class Timer extends Thread implements Board{
private int time = 0;
private boolean pause = false;
public Timer() {
this.setDaemon(true);
}
public void pauseTimer() {
this.pause = true;
}
public void startTimer() {
this.pause = false;
}
public String getScoreBoard() {
return "Timer : "+this.time;
}
public synchronized void timer() {
try {
while(pause) {
wait();}
} catch (InterruptedException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
time++;
}
public void run() {
while(true) {
timer();
try {
sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
| [
"noreply@github.com"
] | etudiant29001227.noreply@github.com |
8581b5b8bbdc55cc6a53f9f305c7d496d70eced5 | 01764b5a916b119b46b133e769013b56ae6c3c8b | /Chapter 5/src/Java0513.java | df712357941a6ea47b0d298931f4506bc318fa9c | [] | no_license | JacobLurv/APCS-Lurvey | d1e4e76b6fa3db32f9f5b310354d8d164bd89059 | 73fbf925ee514ed229f27f223df3f6eedddc2739 | refs/heads/master | 2020-03-29T07:09:36.338022 | 2019-03-05T19:14:51 | 2019-03-05T19:14:51 | 149,654,907 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,648 | java | // Java0513.java
// This program displays 40 identical lines very inefficiently
// with 40 separate println statements.
public class Java0513
{
public static void main(String args[])
{
System.out.println("\nJAVA0513.JAVA\n");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
System.out.println("Eat at Joe's friendly diner for the best lunch value");
}
}
| [
"jlurvey19@ssdsnassau.org"
] | jlurvey19@ssdsnassau.org |
9a2a7571503dbb9706324b8148a3e3351cd5e894 | da4e913b6948de067ff4b3396534f037a2433acc | /TeamCode/src/main/java/org/firstinspires/ftc/teamcode/BoysController.java | 301f87eae63d0087309e580b5e80e0e4b8f0b287 | [
"BSD-3-Clause"
] | permissive | BrianColburn/calallen-2018-2019-ftc | 217b83f16d9bdd4009388b4f8b0a411448655fc5 | ab93adb0f046090b111c0454f48cb39175ed1f95 | refs/heads/master | 2020-04-22T06:42:37.624596 | 2019-03-02T18:48:08 | 2019-03-02T18:48:08 | 170,199,821 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 648 | java | package org.firstinspires.ftc.teamcode;
import com.qualcomm.robotcore.hardware.Gamepad;
public class BoysController extends Controller {
public BoysController(Gamepad g1, Gamepad g2) {
super(g1, g2);
}
@Override
public double lift_power() {
return Math.abs(g1.left_stick_y) > .01 ? g1.left_stick_y : g2.left_stick_y;
}
@Override
public double servo_pos() {
return 1-Math.max(g1.right_trigger > 0 ? g1.right_trigger : g2.right_trigger, 1/180.);
}
@Override
public double servo2_pos() {
return Math.max(g1.left_trigger > 0 ? g1.left_trigger : g2.left_trigger, 0);
}
}
| [
"a@b.c"
] | a@b.c |
bc81f9dbec025ea189e3204136e2d991f4fbad58 | 60a5ad3fac842a265340b235183c92155bc67c6f | /services/CompanyService/src/com/civicxpress/companyservice/controller/CompanyController.java | a685563feb107fd06e838b62af05aeddfb103266 | [] | no_license | jsexton114/CX2 | 3891c75c4a2c8fcaae0fcb30214702684d748a0d | f82cb74b767d2547fff29624a39a2ccff2d6fd8a | refs/heads/master | 2020-12-02T06:19:44.278811 | 2017-07-14T11:10:36 | 2017-07-14T11:10:36 | 96,805,076 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,385 | java | /**This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/
package com.civicxpress.companyservice.controller;
import com.civicxpress.companyservice.CompanyService;
import org.springframework.web.multipart.MultipartFile;
import java.lang.Integer;
import java.sql.SQLException;
import java.io.IOException;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.MediaType;
import org.springframework.beans.factory.annotation.Autowired;
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wavemaker.tools.api.core.annotations.WMAccessVisibility;
import com.wavemaker.tools.api.core.models.AccessSpecifier;
@RestController
@RequestMapping(value = "/company")
public class CompanyController {
@Autowired
private CompanyService companyService;
@RequestMapping(value = "/uploadDocuments", method = RequestMethod.POST, consumes = "multipart/form-data")
public void uploadDocuments(@RequestPart(value = "files") MultipartFile[] files, @RequestParam(value = "municipalityId", required = false) Integer municipalityId, @RequestParam(value = "vendorId", required = false) Integer vendorId) throws SQLException, IOException {
companyService.uploadDocuments(files, municipalityId, vendorId);
}
}
| [
"sagar.vemala@wavemaker.com"
] | sagar.vemala@wavemaker.com |
fb27f90a5e44cadc5151782afc96fba8184b9977 | 2284f2f8ca200db347a4411737dcc6a6bfd123cc | /src/main/java/com/jiyu/v2/config/MySpringConfig.java | ab3ea8b537b860a94afe0f867bea9de96e696004 | [] | no_license | caishuxueqian/spring_analysis | 3fdd3a05abf658aa76878d1cefedaee24f8694b6 | eea9a54c700253f8b4bf64cfa2499f9c0c092075 | refs/heads/master | 2023-01-07T09:54:22.137332 | 2020-11-09T06:17:53 | 2020-11-09T06:17:53 | 310,480,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 613 | java | package com.jiyu.v2.config;
import com.jiyu.entity.UserEntity;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@ComponentScan("com.jiyu.v2")
@Configuration
public class MySpringConfig {
// @Configuration等同于spring xml
/**
* <bean id="userEntity" class="com.jiyu.entity.UserEntity">
* id: 方法名userEntity
* class:UserEntity
* @return
*/
@Bean
public UserEntity userEntity() {
return new UserEntity("jiyu", 10);
}
}
| [
"wangyiwen@csii.com.cn"
] | wangyiwen@csii.com.cn |
f94e7b93617f128f75c7ffcf0dfeaff54c6f8998 | 0e03866fa10be6853391e461ba639d0ac4bb24a5 | /src/main/java/com/keyin/algorithms/data_structures/DisjointSet.java | 020d21c7225a9c3083e5302efe79dce112a950ef | [] | no_license | echoyinke/java-algorithm-dive | 281b356416cba65a084e3b554dce888c36620390 | 785bbcca02858f4116ceb17b1ca646575301d429 | refs/heads/master | 2023-02-19T01:47:23.687752 | 2023-02-13T02:08:57 | 2023-02-13T02:08:57 | 249,880,515 | 1 | 1 | null | 2020-10-13T20:38:15 | 2020-03-25T03:43:33 | Java | UTF-8 | Java | false | false | 4,621 | java | package com.keyin.algorithms.data_structures;
/**
* In computer science, a disjoint-set data structure, also called a union–find data structure or merge–find set, is a data structure that keeps track of a set of
* elements partitioned into a number of disjoint (non-overlapping) subsets.
* <p>
* It supports two useful operations:<br>
* Find: Determine which subset a particular element is in. Find typically returns an item from this set that serves as its "representative"; by comparing the
* result of two Find operations, one can determine whether two elements are in the same subset.<br>
* Union: Join two subsets into a single subset.<br>
* <p>
* @see <a href="https://en.wikipedia.org/wiki/Disjoint-set_data_structure">Disjoint Set (Wikipedia)</a>
* <br>
* @author Justin Wetherell <phishman3579@gmail.com>
*/
@SuppressWarnings("unchecked")
public class DisjointSet<T extends Object> {
private DisjointSet() { }
/**
* Creates a set of one element.
*
* @param v Value to use when creating the set
* @return Item representing the value
*/
public static final <T extends Object> Item<T> makeSet(T v) {
final Item<T> item = new Item<T>(null,v);
item.parent = item;
return item;
}
/**
* Determine which subset a particular element is in. Find returns an item from this set that serves as its "representative"; by comparing the result
* of two Find operations, one can determine whether two elements are in the same subset. This method uses path compression which is a way of flattening
* the structure of the tree whenever Find is used on it.
*
* @param x Find the "representative" of this Item
* @return "Representative" of this Item
*/
public static final <T extends Object> Item<T> find(Item<T> x) {
if (x == null)
return null;
if ((x.parent!=null) && !(x.parent.equals(x)))
return x.parent = find(x.parent);
return x.parent;
}
/**
* Join two subsets into a single subset. This method uses 'union by rank' which always attaches the smaller tree to the root of the larger tree.
*
* @param x Subset 1 to join
* @param y Subset 2 to join
* @return Resulting Set of joining Subset 1 and Subset 2
*/
public static final <T extends Object> Item<T> union(Item<T> x, Item<T> y) {
final Item<T> xRoot = find(x);
final Item<T> yRoot = find(y);
if (xRoot==null && yRoot==null)
return null;
if (xRoot==null && yRoot!=null)
return yRoot;
if (yRoot==null && xRoot!=null)
return xRoot;
// x and y are in the same set
if (xRoot.equals(yRoot))
return xRoot;
if (xRoot.rank < yRoot.rank) {
xRoot.parent = yRoot;
return yRoot;
} else if (xRoot.rank > yRoot.rank) {
yRoot.parent = xRoot;
return xRoot;
}
// else
yRoot.parent = xRoot;
xRoot.rank = xRoot.rank + 1;
return xRoot;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "Nothing here to see, yet.";
}
public static final class Item<T> {
private Item<T> parent;
private T value;
/** Rank is not the actual depth of the tree rather it is an upper bound. As such, on a find operation, the rank is allowed to get out of sync with the depth. **/
private long rank;
public Item(Item<T> parent, T value) {
this.parent = parent;
this.value = value;
this.rank = 0;
}
public T getValue() {
return value;
}
public long getRank() {
return rank;
}
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object o) {
if (!(o instanceof Item))
return false;
final Item<T> i = (Item<T>) o;
if ((i.parent!=null && parent!=null) && !(i.parent.value.equals(parent.value)))
return false;
if ((i.value!=null && value!=null) && !(i.value.equals(value)))
return false;
return true;
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return "parent="+(parent!=null?parent.value:null)+" "+
(rank>0?"rank="+rank +" " : "") +
"value="+(value!=null?value:null);
}
}
}
| [
"keyin@ebay.com"
] | keyin@ebay.com |
6ac106f882e16fecbcb0b551da4b1f16f47067b5 | 079f27bc07e3c67fe912802044c9800dc6fad90f | /nm-subscription/nm-sub-ec-model/src/main/java/com/gcaa/nm/Application.java | 5aa22cad0ae163951c47661492e6bdf640a93c3a | [] | no_license | ahmedza/pubsubint | be74ca935bf1ba74507dd3fd2785cb5cdd5400ec | cc17df995209b156ee9244fa15650f12329e3c45 | refs/heads/master | 2021-09-15T09:30:24.453846 | 2018-05-29T21:12:10 | 2018-05-29T21:12:10 | 104,726,111 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 290 | java | package com.gcaa.nm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class);
}
} | [
"zahmed@szc.gcaa.ae"
] | zahmed@szc.gcaa.ae |
80e7a640406af628c467343e4633a8bc1e8fa1ec | 06eb59d91495a2b9568d21019e4dcb61ff236b7a | /izpack-src/tags/3.10.1/src/lib/com/izforge/izpack/panels/ShortcutPanel.java | cc9c7da4a86449315ebcddb3f1c20c9f4f43f321 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | jponge/izpack-full-svn-history-copy | 8fa773fb3f9f4004e762d29f708273533ba0ff1f | 7a521ccd6ce0dd1a0664eaae12fd5bba5571d231 | refs/heads/master | 2016-09-01T18:24:14.656773 | 2010-03-01T07:38:22 | 2010-03-01T07:38:22 | 551,191 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 76,260 | java | /*
* IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
*
* http://www.izforge.com/izpack/ http://developer.berlios.de/projects/izpack/
*
* Copyright 2002 Elmar Grom
*
* 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.izforge.izpack.panels;
import com.izforge.izpack.ExecutableFile;
import com.izforge.izpack.Pack;
import com.izforge.izpack.gui.ButtonFactory;
import com.izforge.izpack.gui.LabelFactory;
import com.izforge.izpack.installer.*;
import com.izforge.izpack.util.*;
import com.izforge.izpack.util.os.Shortcut;
import com.izforge.izpack.util.os.unix.UnixHelper;
import com.izforge.izpack.util.xml.XMLHelper;
import net.n3.nanoxml.*;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import javax.swing.border.TitledBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.FileWriter;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Vector;
//
// import com.izforge.izpack.panels.ShortcutData;
/*---------------------------------------------------------------------------*/
/**
* This class implements a panel for the creation of shortcuts. The panel prompts the user to select
* a program group for shortcuts, accept the creation of desktop shortcuts and actually creates the
* shortcuts.
*
* Use LateShortcutInstallListener to create the Shortcuts after the Files have been installed.
*
* @version $Revision$
*/
public class ShortcutPanel extends IzPanel implements ActionListener, ListSelectionListener // ,//
// ShortcutConstants
{
// ~ Static fields/initializers *********************************************************
/** serialVersionUID = 3256722870838112311L */
private static final long serialVersionUID = 3256722870838112311L;
// ~ Static fields/initializers *********************************************************
/** SPEC_ATTRIBUTE_KDE_USERNAME ="KdeUsername" */
public final static String SPEC_ATTRIBUTE_KDE_USERNAME ="KdeUsername";
/** SPEC_ATTRIBUTE_KDE_SUBST_UID = "KdeSubstUID" */
public final static String SPEC_ATTRIBUTE_KDE_SUBST_UID = "KdeSubstUID";
/** SPEC_ATTRIBUTE_URL = "url" */
public final static String SPEC_ATTRIBUTE_URL = "url";
/** SPEC_ATTRIBUTE_TYPE = "type" */
public final static String SPEC_ATTRIBUTE_TYPE = "type";
/** SPEC_ATTRIBUTE_TERMINAL_OPTIONS = "terminalOptions" */
public final static String SPEC_ATTRIBUTE_TERMINAL_OPTIONS = "terminalOptions";
/** SPEC_ATTRIBUTE_TERMINAL = "terminal" */
public final static String SPEC_ATTRIBUTE_TERMINAL = "terminal";
/** SPEC_ATTRIBUTE_MIMETYPE = "mimetype" */
public final static String SPEC_ATTRIBUTE_MIMETYPE = "mimetype";
/** SPEC_ATTRIBUTE_ENCODING = "encoding" */
public final static String SPEC_ATTRIBUTE_ENCODING = "encoding";
/** LOCATION_APPLICATIONS=applications */
private static final String LOCATION_APPLICATIONS = "applications";
/** LOCATION_START_MENU = "startMenu" */
private static final String LOCATION_START_MENU = "startMenu";
/** SPEC_CATEGORIES = "categories" */
public static final String SPEC_CATEGORIES = "categories";
/** SPEC_TRYEXEC = "tryexec" */
public static final String SPEC_TRYEXEC = "tryexec";
/**
* SEPARATOR_LINE =
* "--------------------------------------------------------------------------------";
*/
private static final String SEPARATOR_LINE = "--------------------------------------------------------------------------------";
/**
* The default file name for the text file in which the shortcut information should be stored,
* in case shortcuts can not be created on a particular target system. TEXT_FILE_NAME =
* "Shortcuts.txt"
*/
private static final String TEXT_FILE_NAME = "Shortcuts.txt";
/**
* The name of the XML file that specifies the shortcuts SPEC_FILE_NAME = "shortcutSpec.xml";
*/
private static final String SPEC_FILE_NAME = "shortcutSpec.xml";
// ------------------------------------------------------
// spec file section keys
// -----------------------------------------------------
/** SPEC_KEY_SKIP_IFNOT_SUPPORTED = "skipIfNotSupported" */
private static final String SPEC_KEY_SKIP_IFNOT_SUPPORTED = "skipIfNotSupported";
/** SPEC_KEY_NOT_SUPPORTED = "notSupported" */
private static final String SPEC_KEY_NOT_SUPPORTED = "notSupported";
/** SPEC_KEY_PROGRAM_GROUP = "programGroup" */
private static final String SPEC_KEY_PROGRAM_GROUP = "programGroup";
/** SPEC_KEY_SHORTCUT = "shortcut" */
private static final String SPEC_KEY_SHORTCUT = "shortcut";
/** SPEC_KEY_PACKS = "createForPack" */
private static final String SPEC_KEY_PACKS = "createForPack";
// ------------------------------------------------------
// spec file key attributes
// ------------------------------------------------------
/** SPEC_ATTRIBUTE_DEFAULT_GROUP = "defaultName" */
private static final String SPEC_ATTRIBUTE_DEFAULT_GROUP = "defaultName";
/** Support the InstallGroups like in Packs.
* SPEC_ATTRIBUTE_INSTALLGROUP = "installGroup" */
private static final String SPEC_ATTRIBUTE_INSTALLGROUP = "installGroup";
/** SPEC_ATTRIBUTE_LOCATION = "location" */
private static final String SPEC_ATTRIBUTE_LOCATION = "location";
/** SPEC_ATTRIBUTE_NAME = "name" */
private static final String SPEC_ATTRIBUTE_NAME = "name";
/** SPEC_ATTRIBUTE_SUBGROUP = "subgroup" */
private static final String SPEC_ATTRIBUTE_SUBGROUP = "subgroup";
/** SPEC_ATTRIBUTE_DESCRIPTION = "description" */
private static final String SPEC_ATTRIBUTE_DESCRIPTION = "description";
/** SPEC_ATTRIBUTE_TARGET = "target" */
private static final String SPEC_ATTRIBUTE_TARGET = "target";
/** SPEC_ATTRIBUTE_COMMAND = "commandLine" */
private static final String SPEC_ATTRIBUTE_COMMAND = "commandLine";
/** SPEC_ATTRIBUTE_ICON "iconFile" */
private static final String SPEC_ATTRIBUTE_ICON = "iconFile";
/** SPEC_ATTRIBUTE_ICON_INDEX "iconIndex" */
private static final String SPEC_ATTRIBUTE_ICON_INDEX = "iconIndex";
/** SPEC_ATTRIBUTE_WORKING_DIR = "workingDirectory" */
private static final String SPEC_ATTRIBUTE_WORKING_DIR = "workingDirectory";
/** SPEC_ATTRIBUTE_INITIAL_STATE = "initialState" */
private static final String SPEC_ATTRIBUTE_INITIAL_STATE = "initialState";
/** SPEC_ATTRIBUTE_DESKTOP = "desktop" */
private static final String SPEC_ATTRIBUTE_DESKTOP = "desktop";
/** SPEC_ATTRIBUTE_APPLICATIONS = "applications" */
private static final String SPEC_ATTRIBUTE_APPLICATIONS = "applications";
/** SPEC_ATTRIBUTE_START_MENU = "startMenu" */
private static final String SPEC_ATTRIBUTE_START_MENU = "startMenu";
/** SPEC_ATTRIBUTE_STARTUP = "startup" */
private static final String SPEC_ATTRIBUTE_STARTUP = "startup";
/** SPEC_ATTRIBUTE_PROGRAM_GROUP = "programGroup" */
private static final String SPEC_ATTRIBUTE_PROGRAM_GROUP = "programGroup";
// ------------------------------------------------------
// spec file attribute values
// ------------------------------------------------------
/** SPEC_VALUE_APPLICATIONS = "applications" */
private static final String SPEC_VALUE_APPLICATIONS = "applications";
/** SPEC_VALUE_START_MENU = "startMenu" */
private static final String SPEC_VALUE_START_MENU = "startMenu";
/** SPEC_VALUE_NO_SHOW = "noShow" */
private static final String SPEC_VALUE_NO_SHOW = "noShow";
/** SPEC_VALUE_NORMAL = "normal" */
private static final String SPEC_VALUE_NORMAL = "normal";
/** SPEC_VALUE_MAXIMIZED = "maximized" */
private static final String SPEC_VALUE_MAXIMIZED = "maximized";
/** SPEC_VALUE_MINIMIZED = "minimized" */
private static final String SPEC_VALUE_MINIMIZED = "minimized";
// ------------------------------------------------------
// automatic script section keys
// ------------------------------------------------------
/** AUTO_KEY_PROGRAM_GROUP = SPEC_KEY_PROGRAM_GROUP = "programGroup" */
public static final String AUTO_KEY_PROGRAM_GROUP = SPEC_KEY_PROGRAM_GROUP;
/** AUTO_KEY_SHORTCUT = SPEC_KEY_SHORTCUT = "shortcut" */
public static final String AUTO_KEY_SHORTCUT = SPEC_KEY_SHORTCUT;
// ------------------------------------------------------
// automatic script keys attributes
// ------------------------------------------------------
/** AUTO_ATTRIBUTE_NAME = "name" */
public static final String AUTO_ATTRIBUTE_NAME = "name";
/** AUTO_ATTRIBUTE_GROUP = "group" */
public static final String AUTO_ATTRIBUTE_GROUP = "group";
/** AUTO_ATTRIBUTE_TYPE "type" */
public static final String AUTO_ATTRIBUTE_TYPE = "type";
/** AUTO_ATTRIBUTE_COMMAND = "commandLine" */
public static final String AUTO_ATTRIBUTE_COMMAND = "commandLine";
/** AUTO_ATTRIBUTE_DESCRIPTION = "description" */
public static final String AUTO_ATTRIBUTE_DESCRIPTION = "description";
/** AUTO_ATTRIBUTE_ICON = "icon" */
public static final String AUTO_ATTRIBUTE_ICON = "icon";
/** AUTO_ATTRIBUTE_ICON_INDEX = "iconIndex" */
public static final String AUTO_ATTRIBUTE_ICON_INDEX = "iconIndex";
/** AUTO_ATTRIBUTE_INITIAL_STATE = "initialState" */
public static final String AUTO_ATTRIBUTE_INITIAL_STATE = "initialState";
/** AUTO_ATTRIBUTE_TARGET = "target" */
public static final String AUTO_ATTRIBUTE_TARGET = "target";
/** AUTO_ATTRIBUTE_WORKING_DIR = "workingDirectory" */
public static final String AUTO_ATTRIBUTE_WORKING_DIR = "workingDirectory";
// permission flags
/** CREATE_FOR_ALL = "createForAll" */
public static final String CREATE_FOR_ALL = "createForAll";
private static ShortcutPanel self = null;
/** internal flag: create */
static boolean create;
/**
* May be switched by an installerlistener to false.
* Installerlistener may then perform the creation of the shortcuts after the files have been installed...
* Default is true.
*/
public static boolean createImmediately = true;
/** internal flag isRootUser */
private static boolean isRootUser;
// ~ Instance fields ********************************************************************
// ~ Instance fields ********************************************************************
/** a VectorList of Files wich should be make executable */
private Vector execFiles = new Vector();
// ------------------------------------------------------------------------
// Variable Declarations
// ------------------------------------------------------------------------
/** UI element to label the list of existing program groups */
private JLabel listLabel;
/** UI element to present the list of existing program groups for selection */
private JList groupList;
/** UI element for listing the intended shortcut targets */
private JList targetList;
/**
* UI element to present the default name for the program group and to support editing of this
* name.
*/
private JTextField programGroup;
/** UI element to allow the user to revert to the default name of the program group */
private JButton defaultButton;
/** UI element to allow the user to save a text file with the shortcut information */
private JButton saveButton;
/**
* UI element to allow the user to decide if shortcuts should be placed on the desktop or not.
*/
private JCheckBox allowDesktopShortcut;
/** Checkbox to enable/disable to chreate ShortCuts */
private JCheckBox createShortcuts;
/** UI element instruct this panel to create shortcuts for the current user only */
private JRadioButton currentUser;
/** UI element instruct this panel to create shortcuts for all users */
private JRadioButton allUsers;
/** The layout for this panel */
private GridBagLayout layout;
/** The contraints object to use whan creating the layout */
private GridBagConstraints constraints;
/**
* The default name to use for the program group. This comes from the XML specification.
*/
private String suggestedProgramGroup;
/** The name chosen by the user for the program group, */
private String groupName;
/**
* The location for placign the program group. This is the same as the location (type) of a
* shortcut, only that it applies to the program group. Note that there are only two locations
* that make sense as location for a program group: <br>
* applications start menu
*/
private int groupLocation;
/** The parsed result from reading the XML specification from the file */
private XMLElement spec;
/** Set to true by analyzeShortcutSpec() if there are any desktop shortcuts to create. */
private boolean hasDesktopShortcuts = false;
/** Tells wether to skip if the platform is not supported. */
private boolean skipIfNotSupported = false;
/** the one shortcut instance for reuse in many locations */
private Shortcut shortcut;
/**
* A list of ShortcutData> objects. Each object is the complete specification for one shortcut
* that must be created.
*/
private Vector shortcuts = new Vector();
/**
* Holds a list of all the shortcut files that have been created. Note: this variable contains
* valid data only after createShortcuts() has been called. This list is created so that the
* files can be added to the uninstaller.
*/
private Vector files = new Vector();
/**
* If true it indicates that there are shortcuts to create. The value is set by
* analyzeShortcutSpec()
*/
private boolean shortcutsToCreate = false;
/** If true it indicates that the spec file is existing and could be read. */
private boolean haveShortcutSpec = false;
/**
* This is set to true if the shortcut spec instructs to simulate running on an operating system
* that is not supported.
*/
private boolean simulteNotSupported = false;
/** Avoids bogus behaviour when the user goes back then returns to this panel. */
// private boolean firstTime = true;
private File itsProgramFolder;
/** itsUserType */
private int itsUserType;
/** USER_TYPE = "usertype" to store this information in the automated.xml */
public final static String USER_TYPE = "usertype";
/** shortCuts */
private Vector shortCuts;
/** internal line counter */
int line;
/** internal column counter */
int col;
// ~ Constructors ***********************************************************************
// ~ Constructors ***********************************************************************
/*
* --------------------------------------------------------------------------
*/
/**
* Constructor.
*
* @param parent reference to the application frame
* @param installData shared information about the installation
*/
/*
* --------------------------------------------------------------------------
*/
public ShortcutPanel(InstallerFrame parent, InstallData installData)
{
super(parent, installData, "link16x16");
layout = (GridBagLayout) super.getLayout();
Object con = getLayoutHelper().getDefaultConstraints();
if( con instanceof GridBagConstraints)
constraints = (GridBagConstraints) con;
else
con = new GridBagConstraints();
setLayout(super.getLayout());
if( self != null )
throw new RuntimeException( this.getClass().getName() + " is not allowed to instantiate more than once!" );
self = this;
}
// ~ Methods ****************************************************************************
// ~ Methods ****************************************************************************
// **************************************************************************************************************************************************
/*--------------------------------------------------------------------------*/
/**
* This method represents the ActionListener interface, invoked when an action occurs.
*
* @param event the action event.
*/
/*--------------------------------------------------------------------------*/
public void actionPerformed(ActionEvent event)
{
Object eventSource = event.getSource();
/*
* if (eventSource != null) { System.out.println("Instance Of : " +
* eventSource.getClass().getName()); }
*/
// ----------------------------------------------------
// create shortcut for the current user was selected
// refresh the list of program groups accordingly and
// reset the program group to the default setting.
// ----------------------------------------------------
if (eventSource.equals(currentUser))
{
groupList.setListData(shortcut.getProgramGroups(Shortcut.CURRENT_USER));
programGroup.setText(suggestedProgramGroup);
shortcut.setUserType(itsUserType = Shortcut.CURRENT_USER);
return;
}
// ----------------------------------------------------
// create shortcut for all users was selected
// refresh the list of program groups accordingly and
// reset the program group to the default setting.
// ----------------------------------------------------
else if (eventSource.equals(allUsers))
{
groupList.setListData(shortcut.getProgramGroups(Shortcut.ALL_USERS));
programGroup.setText(suggestedProgramGroup);
shortcut.setUserType(itsUserType = Shortcut.ALL_USERS);
return;
}
// ----------------------------------------------------
// The reset button was pressed.
// - clear the selection in the list box, because the
// selection is no longer valid
// - refill the program group edit control with the
// suggested program group name
// ----------------------------------------------------
else if (eventSource.equals(defaultButton))
{
groupList.getSelectionModel().clearSelection();
programGroup.setText(suggestedProgramGroup);
return;
}
// ----------------------------------------------------
// the save button was pressed. This is a request to
// save shortcut information to a text file.
// ----------------------------------------------------
else if (eventSource.equals(saveButton))
{
saveToFile();
// add the file to the uninstaller
addToUninstaller();
return;
}
else if (eventSource.equals(createShortcuts))
{
create = createShortcuts.isSelected();
if (groupList != null)
{
groupList.setEnabled(create);
}
programGroup.setEnabled(create);
currentUser.setEnabled(create);
defaultButton.setEnabled(create);
// ** There where no Desktop Links or not allowed, this may be null: **//
if (allowDesktopShortcut != null)
{
allowDesktopShortcut.setEnabled(create);
}
if (isRootUser)
{
allUsers.setEnabled(create);
}
}
}
/*--------------------------------------------------------------------------*/
/**
* Returns true when all selections have valid settings. This indicates that it is legal to
* procede to the next panel.
*
* @return true if it is legal to procede to the next panel, otherwise false.
*/
/*--------------------------------------------------------------------------*/
public boolean isValidated()
{
try
{
groupName = programGroup.getText();
}
catch (Throwable exception)
{
groupName = "";
}
create = createShortcuts.isSelected();
if (createImmediately){
createAndRegisterShortcuts();
}
return (true);
}
/*--------------------------------------------------------------------------*/
/**
* Called when the panel is shown to the user.
*/
/*--------------------------------------------------------------------------*/
public void panelActivate()
{
try
{
readShortcutSpec();
}
catch (Throwable exception)
{
System.out.println("could not read shortcut spec!");
exception.printStackTrace();
}
// Create the UI elements
try
{
shortcut = (Shortcut) (TargetFactory.getInstance()
.makeObject("com.izforge.izpack.util.os.Shortcut"));
shortcut.initialize(Shortcut.APPLICATIONS, "-");
}
catch (Throwable exception)
{
System.out.println("could not create shortcut instance");
exception.printStackTrace();
}
analyzeShortcutSpec();
if (shortcutsToCreate && !OsVersion.IS_OSX)
{
if (shortcut.supported() && !simulteNotSupported)
{
File allUsersProgramsFolder = getProgramsFolder(Shortcut.ALL_USERS);
Debug.log("All UsersProgramsFolder: '" + allUsersProgramsFolder + "'");
File forceTest = new File(allUsersProgramsFolder + File.separator
+ System.getProperty("user.name") + System.currentTimeMillis());
try
{
isRootUser = forceTest.createNewFile();
}
catch (Exception e)
{
isRootUser = false;
Debug.log("IOException: " + "'" + e.getLocalizedMessage() + "'");
Debug.log("You cannot create '" + forceTest + "'");
}
if (forceTest.exists())
{
Debug.log("Delete temporary File: '" + forceTest + "'");
forceTest.delete();
}
String perm = isRootUser ? "can" : "cannot";
Debug.log("You " + perm + " write into '" + allUsersProgramsFolder + "'");
if (isRootUser)
{
itsUserType = Shortcut.ALL_USERS;
}
else
{
itsUserType = Shortcut.CURRENT_USER;
}
buildUI(getProgramsFolder(isRootUser ? Shortcut.ALL_USERS : Shortcut.CURRENT_USER));
// addSelectionList();
// add( shortCutsArea );
// JList shortCutList = null;
// addList( shortCuts, ListSelectionModel.SINGLE_SELECTION, shortCutList, col,
// line+6, 1, 1, GridBagConstraints.BOTH );
}
else
{
// TODO MEP: Test
buildAlternateUI();
// parent.unlockNextButton();
// parent.lockPrevButton();
}
}
else
{
// Skip on OS X
parent.skipPanel();
}
}
/**
* Returns the ProgramsFolder for the current User
*
* @param userType DOCUMENT ME!
*
* @return The Basedir
*/
private File getProgramsFolder(int userType)
{
String path = shortcut.getProgramsFolder(userType);
return (new File(path));
// }
// else
// {
// TODO
// 0ptional: Test if KDE is installed.
// boolean isKdeInstalled = UnixHelper.kdeIsInstalled();
// 1. Test if User can write into
// File kdeRootShareApplinkDir = getKDERootShareApplinkDir();
// if so: return getKDERootShareApplinkDir()
// else
// return getKDEUsersShareApplinkDir() +
// }
// return(result);
}
/**
* This method is called by the groupList when the user makes a selection. It updates the
* content of the programGroup with the result of the selection.
*
* @param event the list selection event
*/
/*--------------------------------------------------------------------------*/
public void valueChanged(ListSelectionEvent event)
{
if (programGroup == null) { return; }
String value = "";
try
{
value = (String) groupList.getSelectedValue();
}
catch (ClassCastException exception)
{}
if (value == null)
{
value = "";
}
programGroup.setText(value + File.separator + suggestedProgramGroup);
}
/*--------------------------------------------------------------------------*/
/**
* Reads the XML specification for the shortcuts to create. The result is stored in spec.
*
* @exception Exception for any problems in reading the specification
*/
/*--------------------------------------------------------------------------*/
private void readShortcutSpec() throws Exception
{
// open an input stream
InputStream input = null;
try
{
input = parent.getResource(TargetFactory.getCurrentOSPrefix() + SPEC_FILE_NAME);
}
catch (ResourceNotFoundException rnfE)
{
input = parent.getResource(SPEC_FILE_NAME);
}
if (input == null)
{
haveShortcutSpec = false;
return;
}
// if( input == null )
// {
// haveShortcutSpec = false;
// return;
// }
// initialize the parser
VariableSubstitutor substitutor = new VariableSubstitutor(idata.getVariables());
// input.
String substitutedSpec = substitutor.substitute(input, "xml");
/*
* TODO: internal flag mapped if( idata.isDebug() ) { System.out.println( "SUBSTITUDED
* SHORTCUT SPEC" ); System.out.println(
* "==================================================================" );
* System.out.println( "==================================================================" );
* System.out.println( substitutedSpec ); System.out.println(
* "==================================================================" );
* System.out.println( "==================================================================" ); }
*/
StdXMLParser parser = new StdXMLParser();
parser.setBuilder(new StdXMLBuilder());
parser.setValidator(new NonValidator());
parser.setReader(StdXMLReader.stringReader(substitutedSpec));
// get the data
spec = (XMLElement) parser.parse();
// close the stream
input.close();
haveShortcutSpec = true;
}
/*--------------------------------------------------------------------------*/
/**
* This method analyzes the specifications for creating shortcuts and builds a list of all the
* Shortcuts that need to be created.
*/
/*--------------------------------------------------------------------------*/
private void analyzeShortcutSpec()
{
if (!haveShortcutSpec)
{
shortcutsToCreate = false;
return;
}
XMLElement skipper = spec.getFirstChildNamed(SPEC_KEY_SKIP_IFNOT_SUPPORTED);
skipIfNotSupported = (skipper != null);
// ----------------------------------------------------
// find out if we should simulate a not supported
// scenario
// ----------------------------------------------------
XMLElement support = spec.getFirstChildNamed(SPEC_KEY_NOT_SUPPORTED);
if (support != null)
{
simulteNotSupported = true;
}
// ----------------------------------------------------
// find out in which program group the shortcuts should
// be placed and where this program group should be
// located
// ----------------------------------------------------
XMLElement group = null;
Vector groupSpecs = spec.getChildrenNamed(SPEC_KEY_PROGRAM_GROUP);
String selectedInstallGroup = idata.getVariable("INSTALL_GROUP");
if (selectedInstallGroup!=null){
//The user selected an InstallGroup before.
//We may have some restrictions on the Installationgroup
//search all defined ProgramGroups for the given InstallGroup
for (int i = 0; i < groupSpecs.size(); i++)
{
XMLElement g = (XMLElement)groupSpecs.get(i);
String instGrp = g.getAttribute(SPEC_ATTRIBUTE_INSTALLGROUP);
if (instGrp!=null && selectedInstallGroup.equalsIgnoreCase(instGrp)){
group = g;
break;
}
}
}
if (group==null){
//default (old) behavior
group = spec.getFirstChildNamed(SPEC_KEY_PROGRAM_GROUP);
}
String location = null;
hasDesktopShortcuts = false;
if (group != null)
{
suggestedProgramGroup = group.getAttribute(SPEC_ATTRIBUTE_DEFAULT_GROUP, "");
location = group.getAttribute(SPEC_ATTRIBUTE_LOCATION, SPEC_VALUE_APPLICATIONS);
}
else
{
suggestedProgramGroup = "";
location = SPEC_VALUE_APPLICATIONS;
}
if (location.equals(SPEC_VALUE_APPLICATIONS))
{
groupLocation = Shortcut.APPLICATIONS;
}
else if (location.equals(SPEC_VALUE_START_MENU))
{
groupLocation = Shortcut.START_MENU;
}
// ----------------------------------------------------
// create a list of all shortcuts that need to be
// created, containing all details about each shortcut
// ----------------------------------------------------
// String temp;
Vector shortcutSpecs = spec.getChildrenNamed(SPEC_KEY_SHORTCUT);
XMLElement shortcutSpec;
ShortcutData data;
shortCuts = new Vector();
for (int i = 0; i < shortcutSpecs.size(); i++)
{
// System.out.println( "Processing shortcut: " + i );
shortcutSpec = (XMLElement) shortcutSpecs.elementAt(i);
if (!OsConstraint.oneMatchesCurrentSystem(shortcutSpec))
{
continue;
}
// TODO: write log info INFO.info( "Checking Condition for " +
// shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) );
if (!checkConditions(shortcutSpec))
{
continue;
}
// TODO write log info INFO.info( "Checked Condition for " +
// shortcutSpec.getAttribute( SPEC_ATTRIBUTE_NAME ) );
data = new ShortcutData();
data.name = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_NAME);
data.subgroup = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_SUBGROUP, "");
data.description = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_DESCRIPTION, "");
// ** Linux **//
data.deskTopEntryLinux_Encoding = shortcutSpec
.getAttribute(SPEC_ATTRIBUTE_ENCODING, "");
data.deskTopEntryLinux_MimeType = shortcutSpec
.getAttribute(SPEC_ATTRIBUTE_MIMETYPE, "");
data.deskTopEntryLinux_Terminal = shortcutSpec
.getAttribute(SPEC_ATTRIBUTE_TERMINAL, "");
data.deskTopEntryLinux_TerminalOptions = shortcutSpec.getAttribute(
SPEC_ATTRIBUTE_TERMINAL_OPTIONS, "");
data.deskTopEntryLinux_Type = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TYPE, "");
data.deskTopEntryLinux_URL = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_URL, "");
data.deskTopEntryLinux_X_KDE_SubstituteUID = shortcutSpec.getAttribute(
SPEC_ATTRIBUTE_KDE_SUBST_UID, "false");
data.deskTopEntryLinux_X_KDE_UserName = shortcutSpec.getAttribute(
SPEC_ATTRIBUTE_KDE_USERNAME, "root");
data.Categories = shortcutSpec.getAttribute(
SPEC_CATEGORIES, "Application;Development");
data.TryExec = shortcutSpec.getAttribute(
SPEC_TRYEXEC, "");
data.createForAll = new Boolean(shortcutSpec.getAttribute(CREATE_FOR_ALL, "false"));
// ** EndOf LINUX **//
// temp =
data.target = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_TARGET, ""));
// temp =
data.commandLine = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_COMMAND, "");
// temp =
data.iconFile = fixSeparatorChar(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON, ""));
data.iconIndex = Integer.parseInt(shortcutSpec.getAttribute(SPEC_ATTRIBUTE_ICON_INDEX,
"0"));
// temp =
data.workingDirectory = fixSeparatorChar(shortcutSpec.getAttribute(
SPEC_ATTRIBUTE_WORKING_DIR, ""));
String initialState = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_INITIAL_STATE, "");
if (initialState.equals(SPEC_VALUE_NO_SHOW))
{
data.initialState = Shortcut.HIDE;
}
else if (initialState.equals(SPEC_VALUE_NORMAL))
{
data.initialState = Shortcut.NORMAL;
}
else if (initialState.equals(SPEC_VALUE_MAXIMIZED))
{
data.initialState = Shortcut.MAXIMIZED;
}
else if (initialState.equals(SPEC_VALUE_MINIMIZED))
{
data.initialState = Shortcut.MINIMIZED;
}
else
{
data.initialState = Shortcut.NORMAL;
}
// LOG System.out.println("data.initialState: " + data.initialState);
// --------------------------------------------------
// if the minimal data requirements are met to create
// the shortcut, create one entry each for each of
// the requested types.
// Eventually this will cause the creation of one
// shortcut in each of the associated locations.
// --------------------------------------------------
// without a name we can not create a shortcut
if (data.name == null)
{
continue;
}
// 1. Elmar: "Without a target we can not create a shortcut."
// 2. Marc: "No, Even on Linux a Link can be an URL and has no target."
if (data.target == null)
{
// TODO: write log info INFO.warn( "Shortcut: " + data + " has no target" );
data.target = "";
}
// the shortcut is not actually required for any of the selected packs
// the shortcut is not actually required for any of the selected packs // the shortcut
// is not actually required for any of the selected packs
Vector forPacks = shortcutSpec.getChildrenNamed(SPEC_KEY_PACKS);
if (!shortcutRequiredFor(forPacks))
{
continue;
}
// --------------------------------------------------
// This section is executed if we don't skip.
// --------------------------------------------------
// For each of the categories set the type and if
// the link should be placed in the program group,
// then clone the data set to obtain an independent
// instance and add this to the list of shortcuts
// to be created. In this way, we will set up an
// identical copy for each of the locations at which
// a shortcut should be placed. Therefore you must
// not use 'else if' statements!
// --------------------------------------------------
{
if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_DESKTOP))
{
hasDesktopShortcuts = true;
data.addToGroup = false;
data.type = Shortcut.DESKTOP;
shortcuts.add(data.clone());
}
if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_APPLICATIONS))
{
data.addToGroup = false;
data.type = Shortcut.APPLICATIONS;
shortcuts.add(data.clone());
}
if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_START_MENU))
{
data.addToGroup = false;
data.type = Shortcut.START_MENU;
shortcuts.add(data.clone());
}
if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_STARTUP))
{
data.addToGroup = false;
data.type = Shortcut.START_UP;
shortcuts.add(data.clone());
}
if (XMLHelper.attributeIsTrue(shortcutSpec, SPEC_ATTRIBUTE_PROGRAM_GROUP))
{
data.addToGroup = true;
data.type = Shortcut.APPLICATIONS;
shortcuts.add(data.clone());
}
// / TODO: write log INFO.info( "data.name: " + data.name );
shortCuts.add((data.name == null) ? "" : data.name); // + " -> " + data.target +
// " Type: " + data.type );
}
}
// ----------------------------------------------------
// signal if there are any shortcuts to create
// ----------------------------------------------------
if (shortcuts.size() > 0)
{
shortcutsToCreate = true;
}
}
/**
* This returns true if a Shortcut should or can be created. Returns false to suppress Creation
*
* @param shortcutSpec
*
* @return true if condtion is resolved positive - currently unimplemented: returns always true.
*/
private boolean checkConditions(XMLElement shortcutSpec)
{
/*
* Vector conditions = shortcutSpec.getChildrenNamed( Condition.CONDITION );
*
* for( int i = 0; i < conditions.size(); i++ ) { Condition condition = new Condition(
* conditions.elementAt( i ) );
*
* //System.out.println( "Readed: " + condition.toString( true ) ); boolean result =
* condition.eval();
*
* if( result == false ) { System.out.println( "Unresolved Condition: " + condition );
*
* return result; } }
*/
return true; // If there is no Condition defined, just create the shortcut.
}
/*--------------------------------------------------------------------------*/
/**
* Enables Shortcutcreation from outside, e.g. from an InstallerListener.
* The Installerlistener can switch the flag "createImmediately" to false on initialisation, and call this method when afterpacks is performed.
* This makes only sense, if the ShorcutPanel is displayed before the files are copied onto the disk.
*/
public void createAndRegisterShortcuts(){
createShortcuts();
addToUninstaller();
}
private String createGnomeMenu(Vector shortcuts, String menuName)
{
String menuConfigText = "<Menu>\n" +
"<Name>Applications</Name>\n" +
"<Menu>\n" +
"<Name>" + menuName + "</Name>\n" +
"<Include>\n";
ShortcutData data;
for (int i = 0; i < shortcuts.size(); i++)
{
data = (ShortcutData) shortcuts.elementAt(i);
menuConfigText += "<Filename>" + data.name + ".desktop</Filename>\n";
}
menuConfigText += "</Include>\n</Menu>\n</Menu>";
return menuConfigText;
}
/*--------------------------------------------------------------------------*/
/**
* Creates all shortcuts based on the information in shortcuts.
*/
/*--------------------------------------------------------------------------*/
private void createShortcuts()
{
if (!create) { Debug.log( this.getClass().getName() + "::createShortcuts():create=" + create ); return; }
ShortcutData data;
//fix: don't influence other shortcuts when altering group name...
String gn = groupName;
if(OsVersion.IS_UNIX)
{
String menuFile = createGnomeMenu(shortcuts, groupName);
String menuFolder = System.getProperty("user.home") + File.separator
+ ".config/menus/applications-merged/";
File menuConfigFolder = new File(menuFolder);
String menuFilePath = menuFolder + groupName + ".menu";
menuConfigFolder.mkdirs();
FileWriter menuFileWriter;
boolean failed = false;
try{
menuFileWriter = new FileWriter(menuFilePath);
menuFileWriter.write(menuFile);
menuFileWriter.close();
}
catch(Exception ignore)
{
failed = true;
Debug.log("Failed to create menu for gnome.");
}
if(!failed) UninstallData.getInstance().addFile(menuFilePath);
}
for (int i = 0; i < shortcuts.size(); i++)
{
data = (ShortcutData) shortcuts.elementAt(i);
try
{
gn = groupName + data.subgroup;
shortcut.setUserType(itsUserType);
shortcut.setLinkName(data.name);
shortcut.setLinkType(data.type);
shortcut.setArguments(data.commandLine);
shortcut.setDescription(data.description);
shortcut.setIconLocation(data.iconFile, data.iconIndex);
shortcut.setShowCommand(data.initialState);
shortcut.setTargetPath(data.target);
shortcut.setWorkingDirectory(data.workingDirectory);
shortcut.setEncoding(data.deskTopEntryLinux_Encoding);
shortcut.setMimetype(data.deskTopEntryLinux_MimeType);
shortcut.setTerminal(data.deskTopEntryLinux_Terminal);
shortcut.setTerminalOptions(data.deskTopEntryLinux_TerminalOptions);
shortcut.setType(data.deskTopEntryLinux_Type);
shortcut.setKdeSubstUID(data.deskTopEntryLinux_X_KDE_SubstituteUID);
shortcut.setKdeUserName(data.deskTopEntryLinux_X_KDE_UserName);
shortcut.setURL(data.deskTopEntryLinux_URL);
shortcut.setTryExec(data.TryExec);
shortcut.setCategories(data.Categories);
shortcut.setCreateForAll(data.createForAll);
shortcut.setUninstaller( UninstallData.getInstance() );
if (data.addToGroup)
{
shortcut.setProgramGroup(gn);
}
else
{
shortcut.setProgramGroup("");
}
try
{
// ----------------------------------------------
// save the shortcut only if it is either not on
// the desktop or if it is on the desktop and
// the user has signalled that it is ok to place
// shortcuts on the desktop.
// ----------------------------------------------
if ((data.type != Shortcut.DESKTOP)
|| ((data.type == Shortcut.DESKTOP) && allowDesktopShortcut
.isSelected()))
{
// save the shortcut
shortcut.save();
// add the file and directory name to the file list
String fileName = shortcut.getFileName();
files.add(0, fileName);
File file = new File(fileName);
File base = new File(shortcut.getBasePath());
Vector intermediates = new Vector();
// String directoryName = shortcut.getDirectoryCreated ();
execFiles.add(new ExecutableFile(fileName, ExecutableFile.UNINSTALL,
ExecutableFile.IGNORE, new ArrayList(), false));
files.add(fileName);
while ((file = file.getParentFile()) != null)
{
if (file.equals(base))
{
break;
}
intermediates.add(file);
}
if (file != null)
{
Enumeration filesEnum = intermediates.elements();
while (filesEnum.hasMoreElements())
{
files.add(0, filesEnum.nextElement().toString());
}
}
}
}
catch (Exception exception)
{}
}
catch (Throwable exception)
{
continue;
}
}
shortcut.execPostAction();
try
{
if (execFiles != null)
{
FileExecutor executor = new FileExecutor(execFiles);
//
// TODO: Hi Guys,
// TODO The following commented-out line sometimes produces an uncatchable
// nullpointer Exception!
// TODO evaluate for what reason the files should exec.
// TODO if there is a serious explanation, why to do that,
// TODO the code must be more robust
// evaluate executor.executeFiles( ExecutableFile.NEVER, null );
}
}
catch (NullPointerException nep)
{
nep.printStackTrace();
}
catch (RuntimeException cannot)
{
cannot.printStackTrace();
}
shortcut.cleanUp();
}
/*--------------------------------------------------------------------------*/
/**
* Verifies if the shortcut is required for any of the packs listed. The shortcut is required
* for a pack in the list if that pack is actually selected for installation. Note: If the list
* of selected packs is empty then true is always returnd. The same is true if the packs list is
* empty.
*
* @param packs a Vector of Strings. Each of the strings denotes a pack for which the schortcut
* should be created if the pack is actually installed.
*
* @return true if the shortcut is required for at least on pack in the list, otherwise returns
* false.
*/
/*--------------------------------------------------------------------------*/
/*
* $ @design
*
* The information about the installed packs comes from InstallData.selectedPacks. This assumes
* that this panel is presented to the user AFTER the PacksPanel.
* --------------------------------------------------------------------------
*/
private boolean shortcutRequiredFor(Vector packs)
{
String selected;
String required;
if (packs.size() == 0) { return (true); }
for (int i = 0; i < idata.selectedPacks.size(); i++)
{
selected = ((Pack) idata.selectedPacks.get(i)).name;
for (int k = 0; k < packs.size(); k++)
{
required = (String) ((XMLElement) packs.elementAt(k)).getAttribute(
SPEC_ATTRIBUTE_NAME, "");
if (selected.equals(required)) { return (true); }
}
}
return (false);
}
/*--------------------------------------------------------------------------*/
/**
* Replaces any ocurrence of '/' or '\' in a path string with the correct version for the
* operating system.
*
* @param path a system path
*
* @return a path string that uniformely uses the proper version of the separator character.
*/
/*--------------------------------------------------------------------------*/
private String fixSeparatorChar(String path)
{
String newPath = path.replace('/', File.separatorChar);
newPath = newPath.replace('\\', File.separatorChar);
return (newPath);
}
/*--------------------------------------------------------------------------*/
/**
* This method creates the UI for this panel.
*
* @param groups A Vector that contains Strings with all the names of the existing program
* groups. These will be placed in the groupList.
*/
/*--------------------------------------------------------------------------*/
private void buildUI(File groups)
{
constraints.insets = new Insets(10, 10, 0, 0);
// Add a CheckBox which enables the user to entirely supress shortcut creation.
String menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:Start-Menu");
if (OsVersion.IS_UNIX && UnixHelper.kdeIsInstalled())
{
menuKind = parent.langpack.getString("ShortcutPanel.regular.StartMenu:K-Menu");
}
createShortcuts = new JCheckBox(StringTool.replace(parent.langpack
.getString("ShortcutPanel.regular.create"), "StartMenu", menuKind), true);
createShortcuts.addActionListener(this);
constraints.gridx = col;
constraints.gridy = line + 1;
constraints.gridwidth = 1;
constraints.gridheight = 1;
// constraints.weightx = 0.1;
// constraints.weighty = 0.2;
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.NORTHWEST;
layout.addLayoutComponent(createShortcuts, constraints);
add(createShortcuts);
constraints.insets = new Insets(0, 10, 0, 0);
// ----------------------------------------------------
// check box to allow the user to decide if a desktop
// shortcut should be created.
// this should only be created if needed and requested
// in the definition file.
// ----------------------------------------------------
if (hasDesktopShortcuts)
{
String initialAllowedValue = idata.getVariable("DesktopShortcutCheckboxEnabled");
boolean initialAllowedFlag = false;
if (initialAllowedValue == null)
{
initialAllowedFlag = false;
}
else if (Boolean.TRUE.toString().equals(initialAllowedValue))
{
initialAllowedFlag = true;
}
allowDesktopShortcut = new JCheckBox(parent.langpack
.getString("ShortcutPanel.regular.desktop"), initialAllowedFlag);
constraints.gridx = col;
constraints.gridy = line + 2;
constraints.gridwidth = 1;
constraints.gridheight = 1;
// constraints.weighty = 0.2;
// constraints.weighty = 1.0;
// constraints.weighty = 0.5;
layout.addLayoutComponent(allowDesktopShortcut, constraints);
add(allowDesktopShortcut);
}
listLabel = LabelFactory.create(parent.langpack.getString("ShortcutPanel.regular.list"),
JLabel.LEADING);
constraints.gridx = col;
constraints.gridy = line + 3;
constraints.gridwidth = 1;
constraints.gridheight = 1;
constraints.insets = new Insets(10, 10, 0, 0);
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.NORTHWEST;
layout.addLayoutComponent(listLabel, constraints);
add(listLabel);
// ----------------------------------------------------
// list box to list all of already existing folders as program groups
// at the intended destination
// ----------------------------------------------------
Vector dirEntries = new Vector();
File[] entries = groups.listFiles();
// Quickfix prevent NullPointer on non default compliant Linux - KDEs
// i.e Mandrake 2005 LE stores from now also in "applnk" instead in prior "applnk-mdk":
if (entries != null)
{
for (int idx = 0; idx < entries.length; idx++)
{
if (entries[idx].isDirectory())
{
dirEntries.add(entries[idx].getName());
}
}
}
if (groupList == null)
{
groupList = new JList();
}
groupList = addList(dirEntries, ListSelectionModel.SINGLE_SELECTION, groupList, col,
line + 4, 1, 1, GridBagConstraints.BOTH);
// ----------------------------------------------------
// radio buttons to select current user or all users.
// ----------------------------------------------------
if (shortcut.multipleUsers())
{
JPanel usersPanel = new JPanel(new GridLayout(2, 1));
ButtonGroup usersGroup = new ButtonGroup();
currentUser = new JRadioButton(parent.langpack
.getString("ShortcutPanel.regular.currentUser"), !isRootUser);
currentUser.addActionListener(this);
usersGroup.add(currentUser);
usersPanel.add(currentUser);
allUsers = new JRadioButton(
parent.langpack.getString("ShortcutPanel.regular.allUsers"), isRootUser);
Debug.log("allUsers.setEnabled(), I'm Root: " + isRootUser);
allUsers.setEnabled(isRootUser);
allUsers.addActionListener(this);
usersGroup.add(allUsers);
usersPanel.add(allUsers);
TitledBorder border = new TitledBorder(new EmptyBorder(2, 2, 2, 2), parent.langpack
.getString("ShortcutPanel.regular.userIntro"));
usersPanel.setBorder(border);
constraints.gridx = col + 1;
constraints.gridy = line + 4;
constraints.gridwidth = 1;
constraints.gridheight = 1;
// constraints.weighty = 1.0;
// constraints.weightx = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL;
layout.addLayoutComponent(usersPanel, constraints);
add(usersPanel);
}
// ----------------------------------------------------
// edit box that contains the suggested program group
// name, which can be modfied or substituted from the
// list by the user
// ----------------------------------------------------
programGroup = new JTextField(suggestedProgramGroup, 40); // 40?
constraints.gridx = col;
constraints.gridy = line + 5;
constraints.gridwidth = 1;
constraints.gridheight = 1;
// constraints.weighty = 1.0;
// constraints.weightx = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL;
layout.addLayoutComponent(programGroup, constraints);
add(programGroup);
// ----------------------------------------------------
// reset button that allows the user to revert to the
// original suggestion for the program group
// ----------------------------------------------------
defaultButton = ButtonFactory.createButton(parent.langpack
.getString("ShortcutPanel.regular.default"), idata.buttonsHColor);
defaultButton.addActionListener(this);
constraints.gridx = col + 1;
constraints.gridy = line + 5;
constraints.gridwidth = 1;
constraints.gridheight = 1;
constraints.fill = GridBagConstraints.HORIZONTAL;
layout.addLayoutComponent(defaultButton, constraints);
add(defaultButton);
}
/**
* Adds the grouplist to the panel
*
* @param Entries the entries to display
* @param ListModel the model to use
* @param aJList the JList to use
* @param aGridx The X position in the gridbag layout.
* @param aGridy The Y position in the gridbag layout.
* @param aGridwidth the gridwith to use in the gridbag layout.
* @param aGridheight the gridheight to use in the gridbag layout.
* @param aFill the FILL to use in the gridbag layout.
*
* @return the filled JList
*/
private JList addList(Vector Entries, int ListModel, JList aJList, int aGridx, int aGridy,
int aGridwidth, int aGridheight, int aFill)
{
if (aJList == null)
{
aJList = new JList(Entries);
}
else
{
aJList.setListData(Entries);
}
aJList.setSelectionMode(ListModel);
aJList.getSelectionModel().addListSelectionListener(this);
JScrollPane scrollPane = new JScrollPane(aJList);
constraints.gridx = aGridx;
constraints.gridy = aGridy;
constraints.gridwidth = aGridwidth;
constraints.gridheight = aGridheight;
constraints.weightx = 2.0;
constraints.weighty = 1.5;
constraints.insets = new Insets(5, 5, 5, 5);
constraints.fill = aFill;
layout.addLayoutComponent(scrollPane, constraints);
add(scrollPane);
return aJList;
}
/**
* This method creates an alternative UI for this panel. This UI can be used when the creation
* of shortcuts is not supported on the target system. It displays an apology for the inability
* to create shortcuts on this system, along with information about the intended targets. In
* addition, there is a button that allows the user to save more complete information in a text
* file. Based on this information the user might be able to create the necessary shortcut him
* or herself. At least there will be information about how to launch the application.
*/
/*--------------------------------------------------------------------------*/
private void buildAlternateUI()
{
layout = new GridBagLayout();
constraints = new GridBagConstraints();
setLayout(layout);
// ----------------------------------------------------
// static text a the top of the panel, that apologizes
// about the fact that we can not create shortcuts on
// this particular target OS.
// ----------------------------------------------------
MultiLineLabel apologyLabel = new MultiLineLabel(parent.langpack
.getString("ShortcutPanel.alternate.apology"), 0, 0);
constraints.gridx = 0;
constraints.gridy = 0;
constraints.gridwidth = 1;
constraints.gridheight = 1;
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.insets = new Insets(5, 5, 5, 5);
constraints.fill = GridBagConstraints.HORIZONTAL;
constraints.anchor = GridBagConstraints.WEST;
layout.addLayoutComponent(apologyLabel, constraints);
add(apologyLabel);
// ----------------------------------------------------
// label that explains the significance ot the list box
// ----------------------------------------------------
MultiLineLabel listLabel = new MultiLineLabel(parent.langpack
.getString("ShortcutPanel.alternate.targetsLabel"), 0, 0);
constraints.gridx = 0;
constraints.gridy = 1;
constraints.gridwidth = 1;
constraints.gridheight = 1;
constraints.weightx = 1.0;
constraints.weighty = 1.0;
layout.addLayoutComponent(listLabel, constraints);
add(listLabel);
// ----------------------------------------------------
// list box to list all of the intended shortcut targets
// ----------------------------------------------------
Vector targets = new Vector();
for (int i = 0; i < shortcuts.size(); i++)
{
targets.add(((ShortcutData) shortcuts.elementAt(i)).target);
}
targetList = new JList(targets);
JScrollPane scrollPane = new JScrollPane(targetList);
constraints.gridx = 0;
constraints.gridy = 2;
constraints.fill = GridBagConstraints.BOTH;
layout.addLayoutComponent(scrollPane, constraints);
add(scrollPane);
// ----------------------------------------------------
// static text that explains about the text file
// ----------------------------------------------------
MultiLineLabel fileExplanation = new MultiLineLabel(parent.langpack
.getString("ShortcutPanel.alternate.textFileExplanation"), 0, 0);
constraints.gridx = 0;
constraints.gridy = 3;
constraints.weightx = 1.0;
constraints.weighty = 1.0;
constraints.fill = GridBagConstraints.HORIZONTAL;
layout.addLayoutComponent(fileExplanation, constraints);
add(fileExplanation);
// ----------------------------------------------------
// button to save the text file
// ----------------------------------------------------
saveButton = ButtonFactory.createButton(parent.langpack
.getString("ShortcutPanel.alternate.saveButton"), idata.buttonsHColor);
saveButton.addActionListener(this);
constraints.gridx = 0;
constraints.gridy = 4;
constraints.gridwidth = 1;
constraints.gridheight = 1;
constraints.fill = GridBagConstraints.NONE;
constraints.anchor = GridBagConstraints.CENTER;
layout.addLayoutComponent(saveButton, constraints);
add(saveButton);
}
/*--------------------------------------------------------------------------*/
/**
* Overriding the superclass implementation. This method returns the size of the container.
*
* @return the size of the container
*/
/*--------------------------------------------------------------------------*/
public Dimension getSize()
{
Dimension size = getParent().getSize();
Insets insets = getInsets();
Border border = getBorder();
Insets borderInsets = new Insets(0, 0, 0, 0);
if (border != null)
{
borderInsets = border.getBorderInsets(this);
}
size.height = size.height - insets.top - insets.bottom - borderInsets.top
- borderInsets.bottom - 50;
size.width = size.width - insets.left - insets.right - borderInsets.left
- borderInsets.right - 50;
return (size);
}
/*--------------------------------------------------------------------------*/
/**
* This method saves all shortcut information to a text file.
*/
/*--------------------------------------------------------------------------*/
private void saveToFile()
{
File file = null;
// ----------------------------------------------------
// open a file chooser dialog to get a path / file name
// ----------------------------------------------------
JFileChooser fileDialog = new JFileChooser(idata.getInstallPath());
fileDialog.setSelectedFile(new File(TEXT_FILE_NAME));
if (fileDialog.showSaveDialog(this) == JFileChooser.APPROVE_OPTION)
{
file = fileDialog.getSelectedFile();
}
else
{
return;
}
// ----------------------------------------------------
// save to the file
// ----------------------------------------------------
FileWriter output = null;
StringBuffer buffer = new StringBuffer();
String header = parent.langpack.getString("ShortcutPanel.textFile.header");
String newline = System.getProperty("line.separator", "\n");
try
{
output = new FileWriter(file);
}
catch (Throwable exception)
{
// !!! show an error dialog
return;
}
// ----------------------------------------------------
// break the header down into multiple lines based
// on '\n' line breaks.
// ----------------------------------------------------
int nextIndex = 0;
int currentIndex = 0;
do
{
nextIndex = header.indexOf("\\n", currentIndex);
if (nextIndex > -1)
{
buffer.append(header.substring(currentIndex, nextIndex));
buffer.append(newline);
currentIndex = nextIndex + 2;
}
else
{
buffer.append(header.substring(currentIndex, header.length()));
buffer.append(newline);
}
}
while (nextIndex > -1);
buffer.append(SEPARATOR_LINE);
buffer.append(newline);
buffer.append(newline);
for (int i = 0; i < shortcuts.size(); i++)
{
ShortcutData data = (ShortcutData) shortcuts.elementAt(i);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.name"));
buffer.append(data.name);
buffer.append(newline);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.location"));
switch (data.type)
{
case Shortcut.DESKTOP: {
buffer.append(parent.langpack.getString("ShortcutPanel.location.desktop"));
break;
}
case Shortcut.APPLICATIONS: {
buffer.append(parent.langpack.getString("ShortcutPanel.location.applications"));
break;
}
case Shortcut.START_MENU: {
buffer.append(parent.langpack.getString("ShortcutPanel.location.startMenu"));
break;
}
case Shortcut.START_UP: {
buffer.append(parent.langpack.getString("ShortcutPanel.location.startup"));
break;
}
}
buffer.append(newline);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.description"));
buffer.append(data.description);
buffer.append(newline);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.target"));
buffer.append(data.target);
buffer.append(newline);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.command"));
buffer.append(data.commandLine);
buffer.append(newline);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.iconName"));
buffer.append(data.iconFile);
buffer.append(newline);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.iconIndex"));
buffer.append(data.iconIndex);
buffer.append(newline);
buffer.append(parent.langpack.getString("ShortcutPanel.textFile.work"));
buffer.append(data.workingDirectory);
buffer.append(newline);
buffer.append(newline);
buffer.append(SEPARATOR_LINE);
buffer.append(newline);
buffer.append(newline);
}
try
{
output.write(buffer.toString());
}
catch (Throwable exception)
{}
finally
{
try
{
output.flush();
output.close();
files.add(file.getPath());
}
catch (Throwable exception)
{
// not really anything I can do here, maybe should show a dialog that
// tells the user that data might not have been saved completely!?
}
}
}
/*--------------------------------------------------------------------------*/
/**
* Adds all files and directories to the uninstaller.
*/
/*--------------------------------------------------------------------------*/
private void addToUninstaller()
{
UninstallData uninstallData = UninstallData.getInstance();
for (int i = 0; i < files.size(); i++)
{
uninstallData.addFile((String) files.elementAt(i));
}
}
/*--------------------------------------------------------------------------*/
/**
* Returns Instance of themself
*/
public static ShortcutPanel getInstance( )
{
return self;
}
/*--------------------------------------------------------------------------*/
/*
*
*
* The information needed to create shortcuts has been collected in the Vector 'shortcuts'. Take
* the data from there and package it in XML form for storage by the installer. The group name
* is only stored once in a separate XML element, since there is only one.
* --------------------------------------------------------------------------
*/
public void makeXMLData( XMLElement panelRoot )
{
// ----------------------------------------------------
// if there are no shortcuts to create, shortcuts are
// not supported, or we should simulate that they are
// not supported, then we have nothing to add. Just
// return
// ----------------------------------------------------
Debug.log( "entering makeXMLData" );
if (!shortcutsToCreate || !shortcut.supported() || (groupName == null)
|| simulteNotSupported || ! create ) { Debug.log( "abort makeXMLData!" ); return; }
ShortcutData data;
XMLElement dataElement;
// ----------------------------------------------------
// add the item that defines the name of the program group
// ----------------------------------------------------
dataElement = new XMLElement(AUTO_KEY_PROGRAM_GROUP);
dataElement.setAttribute(AUTO_ATTRIBUTE_NAME, groupName);
panelRoot.addChild(dataElement);
// ----------------------------------------------------
// add the details for each of the shortcuts
// ----------------------------------------------------
for (int i = 0; i < shortcuts.size(); i++)
{
Debug.log( "entering makeXMLData" );
data = (ShortcutData) shortcuts.elementAt(i);
dataElement = new XMLElement(AUTO_KEY_SHORTCUT);
dataElement.setAttribute(AUTO_ATTRIBUTE_NAME, data.name);
dataElement.setAttribute(AUTO_ATTRIBUTE_GROUP, (data.addToGroup ? Boolean.TRUE
: Boolean.FALSE).toString());
// Boolean.valueOf(data.addToGroup)
if(OsVersion.IS_WINDOWS)
dataElement.setAttribute(AUTO_ATTRIBUTE_TYPE, Integer.toString(data.type));
dataElement.setAttribute(AUTO_ATTRIBUTE_COMMAND, data.commandLine);
dataElement.setAttribute(AUTO_ATTRIBUTE_DESCRIPTION, data.description);
dataElement.setAttribute(AUTO_ATTRIBUTE_ICON, data.iconFile);
dataElement.setAttribute(AUTO_ATTRIBUTE_ICON_INDEX, Integer.toString(data.iconIndex));
dataElement.setAttribute(AUTO_ATTRIBUTE_INITIAL_STATE, Integer
.toString(data.initialState));
dataElement.setAttribute(AUTO_ATTRIBUTE_TARGET, data.target);
dataElement.setAttribute(AUTO_ATTRIBUTE_WORKING_DIR, data.workingDirectory);
dataElement.setAttribute( SPEC_ATTRIBUTE_ENCODING, data.deskTopEntryLinux_Encoding );
dataElement.setAttribute( SPEC_ATTRIBUTE_MIMETYPE, data.deskTopEntryLinux_MimeType );
dataElement.setAttribute( SPEC_ATTRIBUTE_TERMINAL, data.deskTopEntryLinux_Terminal );
dataElement.setAttribute( SPEC_ATTRIBUTE_TERMINAL_OPTIONS, data.deskTopEntryLinux_TerminalOptions );
if(! OsVersion.IS_WINDOWS )
dataElement.setAttribute( SPEC_ATTRIBUTE_TYPE, data.deskTopEntryLinux_Type );
dataElement.setAttribute( SPEC_ATTRIBUTE_URL, data.deskTopEntryLinux_URL );
dataElement.setAttribute( SPEC_ATTRIBUTE_KDE_SUBST_UID, data.deskTopEntryLinux_X_KDE_SubstituteUID );
dataElement.setAttribute( SPEC_CATEGORIES, data.Categories );
dataElement.setAttribute( SPEC_TRYEXEC, data.TryExec );
dataElement.setAttribute( CREATE_FOR_ALL, data.createForAll.toString() );// ? Boolean.TRUE : Boolean.FALSE).toString() );
dataElement.setAttribute( USER_TYPE, Integer.toString( data.userType ) );
//TODO: Add Linux.Attibutes
// ----------------------------------------------
// add the shortcut only if it is either not on
// the desktop or if it is on the desktop and
// the user has signalled that it is ok to place
// shortcuts on the desktop.
// ----------------------------------------------
if ((data.type != Shortcut.DESKTOP)
|| ((data.type == Shortcut.DESKTOP) && allowDesktopShortcut.isSelected()))
{
panelRoot.addChild(dataElement);
}
}
}
/*--------------------------------------------------------------------------*/
/**
* Creates shortcuts based on teh information in panelRoot without UI.
*
* @param panelRoot the root of the XML tree
*/
/*--------------------------------------------------------------------------*/
/*
*
*
* Reconstitute the information needed to create shortcuts from XML data that was previously
* stored by the installer through makeXMLData(). Create a new Vector containing this data and
* stroe it in 'shortcuts' for use by createShortcuts(). Once this has been completed, call
* createShortcuts() to complete the operation.
* --------------------------------------------------------------------------
*/
}
/*---------------------------------------------------------------------------*/
| [
"jponge@7d736ef5-cfd4-0310-9c9a-b52d5c14b761"
] | jponge@7d736ef5-cfd4-0310-9c9a-b52d5c14b761 |
54ab73f27272c82073d63ef468a4f01db5cc5e2a | ac3e09f364121c4e2a583d3dd03ca0fd00e7215c | /Spring-Data-Project/src/main/java/com/prshnt/springframework/Demo/SpringJdbcTemplateDaoApp.java | d495e38a305b560996bf056e80f3bb6f6d99856e | [] | no_license | prshnt007/SpringFramework | 23c77dbbd5b9be192cbed9e79b935060902ef43a | a5afdacc97e9a1cd9e7d542ddb986c06cb81676e | refs/heads/main | 2023-01-07T02:36:32.797888 | 2020-10-17T13:21:04 | 2020-10-17T13:21:04 | 304,877,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 809 | java | package com.prshnt.springframework.Demo;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.prshnt.springframework.dao.PersonSpringjdbcTemplateImpl;
import com.prshnt.springframework.model.Persons;
public class SpringJdbcTemplateDaoApp {
public static void main(String[] args) {
ApplicationContext apctxt = new ClassPathXmlApplicationContext("springApplication.xml");
PersonSpringjdbcTemplateImpl personSpringjdbcTemplateImpl = apctxt.getBean("personSpringjdbcTemplateImpl", PersonSpringjdbcTemplateImpl.class);
//System.out.println(personSpringjdbcTemplateImpl.countPersons());
Persons person =personSpringjdbcTemplateImpl.getPersonById(2);
System.out.println(person);
}
}
| [
"noreply@github.com"
] | prshnt007.noreply@github.com |
11c6d724ded7df6adffdc1ba422f480242d6ab2a | 028cbe18b4e5c347f664c592cbc7f56729b74060 | /external/modules/commons-collections/2.1.1/src/test/org/apache/commons/collections/TestFastTreeMap1.java | 159b7768063df8a1fb52342e064eaed373a8a7be | [
"Apache-2.0"
] | permissive | dmatej/Glassfish-SVN-Patched | 8d355ff753b23a9a1bd9d7475fa4b2cfd3b40f9e | 269e29ba90db6d9c38271f7acd2affcacf2416f1 | refs/heads/master | 2021-05-28T12:55:06.267463 | 2014-11-11T04:21:44 | 2014-11-11T04:21:44 | 23,610,469 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,643 | java | /*
* Copyright 1999-2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.collections;
import java.util.Map;
import java.util.TreeMap;
import junit.framework.Test;
/**
* Test FastTreeMap in <strong>fast</strong> mode.
*
* @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
* @version $Id: TestFastTreeMap1.java,v 1.5.2.1 2004/05/22 12:14:05 scolebourne Exp $
*/
public class TestFastTreeMap1 extends TestFastTreeMap
{
public TestFastTreeMap1(String testName)
{
super(testName);
}
public static Test suite()
{
return BulkTest.makeSuite(TestFastTreeMap1.class);
}
public static void main(String args[])
{
String[] testCaseName = { TestFastTreeMap1.class.getName() };
junit.textui.TestRunner.main(testCaseName);
}
public Map makeEmptyMap() {
FastTreeMap ftm = new FastTreeMap();
ftm.setFast(true);
return (ftm);
}
public void setUp()
{
map = (TreeMap) makeEmptyMap();
}
}
| [
"driscoll@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5"
] | driscoll@6f3ba3e3-413c-0410-a8aa-90bee3ab43b5 |
9c60d5460e6a04a98a1b6d295ecea47da3784bee | e95d6e836a3d0d1415e8b048149c21ba74d0cdc8 | /android/java/dataLogger/src/com/cellbots/logger/LauncherActivity.java | 1370761d8be691a119306f134053216262d5346b | [
"Apache-2.0"
] | permissive | tomzooi/cellbots | a426aff0f9e48c8da8c7602e46c14ea5697f572a | 51c5dba8bbb93db8bb9fb7c228966c41263a28bc | refs/heads/master | 2021-01-18T10:51:51.810376 | 2015-02-25T02:04:57 | 2015-02-25T02:04:57 | 31,291,667 | 0 | 1 | null | 2015-02-25T01:40:44 | 2015-02-25T01:40:43 | null | UTF-8 | Java | false | false | 4,008 | java | /*
* Copyright (C) 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.cellbots.logger;
import android.app.Activity;
import android.content.Intent;
import android.hardware.Camera;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Toast;
/**
* A simple Activity for choosing which mode to launch the data logger in.
*
* @author clchen@google.com (Charles L. Chen)
*/
public class LauncherActivity extends Activity {
private CheckBox useZipCheckbox;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
useZipCheckbox = (CheckBox) findViewById(R.id.useZip);
final Activity self = this;
Button launchVideoFrontButton = (Button) findViewById(R.id.launchVideoFront);
launchVideoFrontButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
launchLoggingActivity(LoggerActivity.MODE_VIDEO_FRONT, useZipCheckbox.isChecked());
}
});
Button launchVideoBackButton = (Button) findViewById(R.id.launchVideoBack);
launchVideoBackButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
launchLoggingActivity(LoggerActivity.MODE_VIDEO_BACK, useZipCheckbox.isChecked());
}
});
final EditText pictureDelayEditText = (EditText) findViewById(R.id.pictureDelay);
Button launchPictureButton = (Button) findViewById(R.id.launchPicture);
launchPictureButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(self, LoggerActivity.class);
i.putExtra(LoggerActivity.EXTRA_MODE, LoggerActivity.MODE_PICTURES);
i.putExtra(LoggerActivity.EXTRA_USE_ZIP, useZipCheckbox.isChecked());
int delay = 30;
try {
delay = Integer.parseInt(pictureDelayEditText.getText().toString());
} catch (Exception e) {
Toast.makeText(self,
"Error parsing picture delay time. Using default delay of 30 seconds.",
1).show();
}
i.putExtra(LoggerActivity.EXTRA_PICTURE_DELAY, delay);
startActivity(i);
finish();
}
});
// The code we are using for taking video through the front camera
// relies on APIs added in SDK 9. Don't offer the front video option to
// users on devices older than that OR to devices who have only one
// camera. Currently assume that if only one camera is present, it is
// the back camera.
if (Build.VERSION.SDK_INT < 9 || Camera.getNumberOfCameras() == 1) {
launchVideoFrontButton.setVisibility(View.GONE);
}
}
private void launchLoggingActivity(int mode, boolean useZip) {
Intent i = new Intent(LauncherActivity.this, LoggerActivity.class);
i.putExtra(LoggerActivity.EXTRA_MODE, mode);
i.putExtra(LoggerActivity.EXTRA_USE_ZIP, useZip);
startActivity(i);
finish();
}
}
| [
"rohitgeorgeandrews@gmail.com"
] | rohitgeorgeandrews@gmail.com |
0bfc60a2836e53b26d428af05172d26dfd038a73 | 7f8527d223af19b2ecd23a9f614c121993609f99 | /pageviewaspectj/src/main/java/fairy/easy/pageviewaspectj/view/ViewOnClickListenerAspectj.java | 67373c3ef2aa4e78dc23e6fa5d06a682a5c9ecad | [
"Apache-2.0"
] | permissive | guxiaonian/PageViewInfo | 5cb9b61401034c350f141accd51ca7f971b748b4 | 751645d811a4d7f7931a06df76df3b0fdbe248ac | refs/heads/master | 2020-06-03T07:07:19.505899 | 2019-07-24T11:18:14 | 2019-07-24T11:18:14 | 191,489,640 | 12 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,278 | java | package fairy.easy.pageviewaspectj.view;
import android.view.View;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import fairy.easy.pageviewaspectj.PageViewAspectjHelper;
/**
* 控件点击
*
* @author 谷闹年
* @date 2019/6/14
*/
@Aspect
public class ViewOnClickListenerAspectj extends BaseAspectj {
/**
* android.view.View.OnClickListener.onClick(android.view.View)
*
* @param joinPoint 切面
*/
@After("execution(* android.view.View.OnClickListener.onClick(android.view.View))")
public void onClickAOP(JoinPoint joinPoint) {
baseClick(joinPoint);
}
@Override
void onClick(JoinPoint joinPoint) {
try {
if (joinPoint == null || joinPoint.getArgs() == null || joinPoint.getArgs().length != 1) {
return;
}
View view = (View) joinPoint.getArgs()[0];
if (view == null) {
return;
}
//这里是所有的View都会返回 可以筛选个别ViewGroup进行单独处理
PageViewAspectjHelper.with().getBasePageViewListener().onClick(view);
} catch (Exception e) {
e.printStackTrace();
}
}
}
| [
"605865553@qq.com"
] | 605865553@qq.com |
96cc58c21865ba1766c44357ac6d18abb2aa0feb | e1e5bd6b116e71a60040ec1e1642289217d527b0 | /H5/Fandc_Ro/Fandc_Ro_2018_11_04/java/l2f/gameserver/ai/Fighter.java | 920232942b72b76f284fe25a9d553e1396fb5ea1 | [] | no_license | serk123/L2jOpenSource | 6d6e1988a421763a9467bba0e4ac1fe3796b34b3 | 603e784e5f58f7fd07b01f6282218e8492f7090b | refs/heads/master | 2023-03-18T01:51:23.867273 | 2020-04-23T10:44:41 | 2020-04-23T10:44:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 829 | java | package l2f.gameserver.ai;
import l2f.gameserver.model.instances.NpcInstance;
public class Fighter extends DefaultAI
{
public Fighter(NpcInstance actor)
{
super(actor);
}
@Override
protected boolean thinkActive()
{
return super.thinkActive() || defaultThinkBuff(10);
}
@Override
protected boolean createNewTask()
{
return defaultFightTask();
}
@Override
public int getRatePHYS()
{
return 30;
}
@Override
public int getRateDOT()
{
return 20;
}
@Override
public int getRateDEBUFF()
{
return 20;
}
@Override
public int getRateDAM()
{
return 15;
}
@Override
public int getRateSTUN()
{
return 30;
}
@Override
public int getRateBUFF()
{
return 10;
}
@Override
public int getRateHEAL()
{
return 20;
}
} | [
"64197706+L2jOpenSource@users.noreply.github.com"
] | 64197706+L2jOpenSource@users.noreply.github.com |
83a17ba1d174bfb8a473ed321a33f8f4d4c14601 | 9078268c172a0e4851cd688474d651058e2d9df4 | /src/com/hss/bean_lifecycle/ApplicationContextUtil.java | 168fb4a71c60b8e72f4ca713d0b539a611cc5b01 | [] | no_license | MiloHang/spring-demo | d4f4ab44a0bfb65303b4b113585f3681b73df37e | c57d30aad9df443ec66cbd38faa2c45ddb797ea1 | refs/heads/master | 2021-09-24T10:41:29.478901 | 2018-10-08T12:55:21 | 2018-10-08T12:55:21 | 116,625,678 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 856 | java | package com.hss.bean_lifecycle;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* 因为ApplicationContext是spring中重量级的对象,作为单例存在于内存中更好
* 避免多次实例化浪费内存
*
* 单例模式特点:
* 1.静态私有成员变量
* 2.私有构造函数
* 3.静态公共访问方法
* */
public final class ApplicationContextUtil {
//懒加载,用时加载,节省资源
private static ApplicationContext ac = null;
private ApplicationContextUtil() {
}
public static ApplicationContext getApplicationContext() {
if(ac == null) {
System.out.println(ApplicationContextUtil.class.getName());
ac = new ClassPathXmlApplicationContext("/com/hss/bean_lifecycle/beans.xml");
}
return ac;
}
}
| [
"hangshaoshi@foxmail.com"
] | hangshaoshi@foxmail.com |
809221b74d874814ba7b0e5b014f5d6c959df716 | 4fd669c57c5283dc916ba525573047f193efe213 | /JavaWorkSPace/WebScrapper/demo/src/main/java/com/mokintis/demo/model/UserRowMapper.java | 54d8e24ed6800fcc895f7c9d6590f73c921288a2 | [] | no_license | papito1992/WebScrapper | 93eaa62fe407f55649c796034d2d4aad496dbbbb | d4bd63dafe120588aef6114c5bd603ebfee09ccf | refs/heads/master | 2021-05-11T13:19:06.403607 | 2018-01-16T11:47:59 | 2018-01-16T11:47:59 | 117,673,837 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.mokintis.demo.model;
import org.springframework.jdbc.core.RowMapper;
import java.sql.ResultSet;
import java.sql.SQLException;
public class UserRowMapper implements RowMapper<User1> {
@Override
public User1 mapRow(ResultSet rs, int rowNum) throws SQLException {
User1 user1 = new User1();
user1.setUserid(rs.getInt("userid"));
user1.setName(rs.getString("name"));
user1.setPhone(rs.getString("phone"));
user1.setEmail(rs.getString("email"));
user1.setAddress(rs.getString("address"));
user1.setLoginname(rs.getString("loginname"));
user1.setRole(rs.getInt("role"));
user1.setLoginstatus(rs.getInt("loginstatus"));
return user1;
}
}
| [
"pauli@DESKTOP-B39KF4O.kuikdelivery.com"
] | pauli@DESKTOP-B39KF4O.kuikdelivery.com |
ac5eede9dbc6f16a05b1976755b0c16cc11926a0 | c62e4db74a0d85c01ab1bc3d5e5b8dee4fa5e1a1 | /implementation/ase.QueryDsl/src-gen/ase/queryDsl/impl/ModelImpl.java | 3363f1357ced90cad3aee33075a65092246f2661 | [] | no_license | coalae/telemed | 99a28bd19a1ad198a6169089d6483cf18612bd13 | cb12ea078bd984606ac0418e9148cf4f5e083ea2 | refs/heads/master | 2020-03-19T05:59:54.086472 | 2019-03-28T21:35:01 | 2019-03-28T21:35:01 | 135,981,694 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,647 | java | /**
* generated by Xtext 2.12.0.M1
*/
package ase.queryDsl.impl;
import ase.queryDsl.Model;
import ase.queryDsl.QueryDslPackage;
import ase.queryDsl.QueryType;
import java.util.Collection;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Model</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link ase.queryDsl.impl.ModelImpl#getQueryType <em>Query Type</em>}</li>
* </ul>
*
* @generated
*/
public class ModelImpl extends MinimalEObjectImpl.Container implements Model
{
/**
* The cached value of the '{@link #getQueryType() <em>Query Type</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getQueryType()
* @generated
* @ordered
*/
protected EList<QueryType> queryType;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ModelImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return QueryDslPackage.Literals.MODEL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<QueryType> getQueryType()
{
if (queryType == null)
{
queryType = new EObjectContainmentEList<QueryType>(QueryType.class, this, QueryDslPackage.MODEL__QUERY_TYPE);
}
return queryType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case QueryDslPackage.MODEL__QUERY_TYPE:
return ((InternalEList<?>)getQueryType()).basicRemove(otherEnd, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID)
{
case QueryDslPackage.MODEL__QUERY_TYPE:
return getQueryType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue)
{
switch (featureID)
{
case QueryDslPackage.MODEL__QUERY_TYPE:
getQueryType().clear();
getQueryType().addAll((Collection<? extends QueryType>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case QueryDslPackage.MODEL__QUERY_TYPE:
getQueryType().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case QueryDslPackage.MODEL__QUERY_TYPE:
return queryType != null && !queryType.isEmpty();
}
return super.eIsSet(featureID);
}
} //ModelImpl
| [
"a00750881@unet.univie.ac.at"
] | a00750881@unet.univie.ac.at |
b8c9e669a0b35616fcd91d0b5cf3894f7c64c4c9 | 5869beac5c2bc72feea76bec97fee2e9b1cce47f | /src/main/java/com/niit/daoimpl/OrdersDAOImpl.java | e5e4733b1417d1a92f97f326534c28447b609a09 | [] | no_license | mounika42/backend | 6f1df958a93d5e2c7c35a7356317ae3e9f37e99b | a12c8828c097af757a3b99bd5cce39b01bcd1161 | refs/heads/master | 2021-05-12T18:24:43.195634 | 2018-02-02T05:57:14 | 2018-02-02T05:57:14 | 117,066,464 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,927 | java | package com.niit.daoimpl;
import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import com.niit.dao.OrdersDAO;
import com.niit.model.Orders;
@Repository("orderDAO")
public class OrdersDAOImpl implements OrdersDAO {
private static Logger log = LoggerFactory.getLogger(OrdersDAOImpl.class);
@Autowired
private SessionFactory sessionFactory;
@Transactional
public boolean deleteOrderById(int orderId) {
try{
Session session = sessionFactory.getCurrentSession();
Object object = session.load(Orders.class, orderId);
if(object!=null){
session.delete(object);
log.info("OrderDaoImpl : Order Object deleted Successfully");
}
return true;
}catch(Exception e){
return false;
}
}
@Transactional
public List<Orders> getAllOrdersOfUser(int userId) {
List<Orders> orderList = sessionFactory.getCurrentSession().createQuery("from Orders where userId = :userId and orderStatus = 'PROCESSED'",Orders.class).setParameter("userId", userId).list();
return orderList;
}
@Transactional
public boolean saveOrUpdate(Orders order) {
// TODO Auto-generated method stub
try{
sessionFactory.getCurrentSession().saveOrUpdate(order);
return true;
}catch (Exception e) {
return false;
}
}
@Transactional
public Orders getOrderById(int orderId) {
// TODO Auto-generated method stub
Orders order= (Orders) sessionFactory.getCurrentSession().createQuery("from Order where id = :orderId")
.setParameter("orderId", orderId).uniqueResult();
return order;
}
} | [
"admin@hp"
] | admin@hp |
511223b4d2e7017c63abb3afd23bc34894681e16 | 55066ed78870864944b6634f88dede2d47d8de74 | /src/main/java/ru/arlen/StateApp.java | 75a547965ce85e6ac46cf4c119e41637a5bac104 | [] | no_license | arlengur/StateMashine | 40c11937c4947041c93cc282e45647764084b2cc | 4c046788da1fc7440d1b871b607f9414c6ebff5b | refs/heads/master | 2020-07-25T13:35:42.629535 | 2019-09-18T13:52:09 | 2019-09-18T13:52:09 | 208,308,740 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package ru.arlen;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import ru.arlen.config.StateMachineConfig;
public class StateApp {
public static void main(String[] args) {
ApplicationContext context = new AnnotationConfigApplicationContext(StateMachineConfig.class);
}
}
| [
"agalin@natera.com"
] | agalin@natera.com |
0f2b73b3af75342cce1d26565ccc0ff35f9e9b55 | 70f91957d10020fd61d1e05abe9bb2ee22e6b37a | /src/main/java/com/prb/erp/domain/user/log/UserLogService.java | 3227361a1835005a01c6b5de9362dca2320700bb | [] | no_license | deepstudyDev/prb_erp_api | a4e00c93eaf69ebc2b8a36f47856270d729fac81 | 42895ef14382f1c693e0b667052fef5f3e7d396f | refs/heads/master | 2020-04-12T19:15:17.805284 | 2019-03-20T00:16:33 | 2019-03-20T00:16:33 | 161,093,008 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,118 | java | package com.prb.erp.domain.user.log;
import java.util.List;
import javax.inject.Inject;
import javax.persistence.Query;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import com.chequer.axboot.core.config.AXBootContextConfig;
import com.chequer.axboot.core.parameter.RequestParams;
import com.chequer.axboot.core.utils.MDCUtil;
import com.chequer.axboot.core.utils.PhaseUtils;
import com.prb.erp.domain.BaseService;
import com.prb.erp.utils.SessionUtils;
import com.querydsl.core.BooleanBuilder;
@Service
public class UserLogService extends BaseService<UserLog, Long> {
private UserLogRepository repository;
@Inject
private AXBootContextConfig axBootContextConfig;
@Inject
public UserLogService(UserLogRepository repository) {
super(repository);
this.repository = repository;
}
@Transactional
public void deleteAllLogs() {
Query query = em.createNativeQuery("DELETE FROM TB_ERP_USERLOG");
query.executeUpdate();
}
public void deleteLog(Long id) {
delete(id);
}
@Transactional
public void saveUserLog(String programCode,String programName, String programAction) {
String userCd = SessionUtils.getCurrentLoginUserCd();
UserLog userLog = new UserLog();
userLog.setPhase(PhaseUtils.phase());
userLog.setSystem("8PM");
userLog.setUserCd(userCd);
userLog.setProgramCode(programCode);
userLog.setProgramName(programName);
userLog.setProgramAction(programAction);
userLog.setLoggerName("");
userLog.setServerName(axBootContextConfig.getServerName());
userLog.setHostName(getHostName());
userLog.setPath(MDCUtil.get(MDCUtil.REQUEST_URI_MDC));
userLog.setHeaderMap(MDCUtil.get(MDCUtil.HEADER_MAP_MDC));
userLog.setParameterMap(MDCUtil.get(MDCUtil.PARAMETER_BODY_MDC));
userLog.setUserInfo(MDCUtil.get(MDCUtil.USER_INFO_MDC));
save(userLog);
}
public String getHostName() {
HttpServletRequest req = ((ServletRequestAttributes)RequestContextHolder.currentRequestAttributes()).getRequest();
String ip = req.getHeader("X-FORWARDED-FOR");
if (ip == null)
ip = req.getRemoteAddr();
try {
return ip;
} catch (Exception e) {
}
return null;
}
public List<UserLog> get(RequestParams<UserLog> requestParams) {
String userCd = requestParams.getString("userCd" , "");
BooleanBuilder builder = new BooleanBuilder();
if (isNotEmpty(userCd)) {
builder.and(qUserLog.userCd.eq(userCd));
}
List<UserLog> list = select().from(qUserLog).where(builder).orderBy(qUserLog.errorDatetime.asc()).fetch();
return list;
}
}
| [
"admin@ideepstudy.com"
] | admin@ideepstudy.com |
aa3d2c5d3d4a0d1b0820470c857ec7dfe56bc43c | 3d0df4e5d4075bff212ac0ae803b3c99a789e03a | /HW32/LLStack.java | c86a934eb0ae45b1abaa1ea227e82d405a9323d8 | [] | no_license | nadinejackson/APCS2 | 2439e092afca4711eacd6927f1deaad662ea9629 | 64b0663e0992e33ea437e083e52d72115b9c9aa7 | refs/heads/master | 2020-03-28T12:49:05.038996 | 2018-09-11T15:19:38 | 2018-09-11T15:19:38 | 148,337,176 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,091 | java | /*****************************************************
* Nadie Jackson
* APCS2 pd2
* HW32 -- Leon Leonwood Stack
* 2018-04-11
* Implements a stack of PANCAKES using an encapsulated LinkedList
*****************************************************/
import java.util.LinkedList;
public class LLStack<PANCAKE> implements Stack<PANCAKE>
{
private LinkedList<PANCAKE> _stack;
private int _stackSize;
//constructor
public LLStack()
{
_stack = new LinkedList();
_stackSize = 0;
}
//means of insertion
public void push(PANCAKE p)
{
_stack.add(p);
_stackSize += 1;
}
//means of removal
public PANCAKE pop( )
{
_stackSize -= 1;
return _stack.removeLast();
}
//chk for emptiness
public boolean isEmpty()
{
return _stackSize == 0;
}
//chk for fullness
public boolean isFull()
{
return _stackSize == _stack.size();
}
public PANCAKE peek()
{
return (_stack.getLast());
}
//main method for testing
public static void main( String[] args )
{
}
}//end class LLStack
| [
"njackson@stuy.edu"
] | njackson@stuy.edu |
cc6174671214471c95451f4b2bc927226db3068c | 9d58c81780a5ad879090c568e473152ffa2ea837 | /PLATFORM MANAGER/DEMO_PERSISTENCIA/MC_OAUTH_SI_FUNCIONA/src/java/COM/JSF/McUsersController.java | 13f4fbd5ac6a815500c249f7fed0a2f3b898dd82 | [] | no_license | ingmanuelcespedes/ApplicationOauth | c441b41968bd6fa93a2d99d390f38aeec064007d | 6eb83078c128f3e3df4dc96cb6cec336566d3d20 | refs/heads/master | 2021-05-05T06:20:34.148689 | 2018-02-03T00:21:43 | 2018-02-03T00:21:43 | 118,794,748 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,128 | java | package COM.JSF;
import COM.ENT.McUsers;
import COM.JSF.util.JsfUtil;
import COM.JSF.util.PaginationHelper;
import COM.BEAN.McUsersFacade;
import java.io.Serializable;
import java.util.ResourceBundle;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.SessionScoped;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;
import javax.faces.model.SelectItem;
@Named("mcUsersController")
@SessionScoped
public class McUsersController implements Serializable {
private McUsers current;
private DataModel items = null;
@EJB
private COM.BEAN.McUsersFacade ejbFacade;
private PaginationHelper pagination;
private int selectedItemIndex;
public McUsersController() {
}
public McUsers getSelected() {
if (current == null) {
current = new McUsers();
selectedItemIndex = -1;
}
return current;
}
private McUsersFacade getFacade() {
return ejbFacade;
}
public PaginationHelper getPagination() {
if (pagination == null) {
pagination = new PaginationHelper(10) {
@Override
public int getItemsCount() {
return getFacade().count();
}
@Override
public DataModel createPageDataModel() {
return new ListDataModel(getFacade().findRange(new int[]{getPageFirstItem(), getPageFirstItem() + getPageSize()}));
}
};
}
return pagination;
}
public String prepareList() {
recreateModel();
return "List";
}
public String prepareView() {
current = (McUsers) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "View";
}
public String prepareCreate() {
current = new McUsers();
selectedItemIndex = -1;
return "Create";
}
public String create() {
try {
getFacade().create(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("McUsersCreated"));
return prepareCreate();
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
}
public String prepareEdit() {
current = (McUsers) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
return "Edit";
}
public String update() {
try {
getFacade().edit(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("McUsersUpdated"));
return "View";
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
return null;
}
}
public String destroy() {
current = (McUsers) getItems().getRowData();
selectedItemIndex = pagination.getPageFirstItem() + getItems().getRowIndex();
performDestroy();
recreatePagination();
recreateModel();
return "List";
}
public String destroyAndView() {
performDestroy();
recreateModel();
updateCurrentItem();
if (selectedItemIndex >= 0) {
return "View";
} else {
// all items were removed - go back to list
recreateModel();
return "List";
}
}
private void performDestroy() {
try {
getFacade().remove(current);
JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("McUsersDeleted"));
} catch (Exception e) {
JsfUtil.addErrorMessage(e, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
}
}
private void updateCurrentItem() {
int count = getFacade().count();
if (selectedItemIndex >= count) {
// selected index cannot be bigger than number of items:
selectedItemIndex = count - 1;
// go to previous page if last page disappeared:
if (pagination.getPageFirstItem() >= count) {
pagination.previousPage();
}
}
if (selectedItemIndex >= 0) {
current = getFacade().findRange(new int[]{selectedItemIndex, selectedItemIndex + 1}).get(0);
}
}
public DataModel getItems() {
if (items == null) {
items = getPagination().createPageDataModel();
}
return items;
}
private void recreateModel() {
items = null;
}
private void recreatePagination() {
pagination = null;
}
public String next() {
getPagination().nextPage();
recreateModel();
return "List";
}
public String previous() {
getPagination().previousPage();
recreateModel();
return "List";
}
public SelectItem[] getItemsAvailableSelectMany() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), false);
}
public SelectItem[] getItemsAvailableSelectOne() {
return JsfUtil.getSelectItems(ejbFacade.findAll(), true);
}
public McUsers getMcUsers(java.lang.Integer id) {
return ejbFacade.find(id);
}
@FacesConverter(forClass = McUsers.class)
public static class McUsersControllerConverter implements Converter {
@Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0) {
return null;
}
McUsersController controller = (McUsersController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "mcUsersController");
return controller.getMcUsers(getKey(value));
}
java.lang.Integer getKey(String value) {
java.lang.Integer key;
key = Integer.valueOf(value);
return key;
}
String getStringKey(java.lang.Integer value) {
StringBuilder sb = new StringBuilder();
sb.append(value);
return sb.toString();
}
@Override
public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
if (object == null) {
return null;
}
if (object instanceof McUsers) {
McUsers o = (McUsers) object;
return getStringKey(o.getMcUsersId());
} else {
throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + McUsers.class.getName());
}
}
}
}
| [
"acespedesl@atento.com.pe"
] | acespedesl@atento.com.pe |
ee311c965a1da6618091ee486ad8f4c031ab7bd9 | dca6e205c52d8ba46c0e50b4cc5824ff3248d3d6 | /src/model/cliente/ClienteJuridico.java | c4375cda652e36332338dd2a967220d56e296872 | [] | no_license | GabrielLomba/AASoftware | 6873cd365a9f94a53b7c99820dec4ebc6b04084b | 07cc563177baad36b538ccb19711a480ed2e72cf | refs/heads/master | 2021-07-08T05:47:25.398683 | 2017-10-04T13:27:02 | 2017-10-04T13:27:02 | 105,586,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 291 | java | package model.cliente;
public class ClienteJuridico extends Cliente {
ClienteJuridico(int codigo, String nome) {
super(codigo, nome);
}
ClienteJuridico(String nome) {
super(nome);
}
@Override
public String getTipo() {
return "PJ";
}
}
| [
"gabriel.costa@smarti9.com.br"
] | gabriel.costa@smarti9.com.br |
69ccff52fb4706093395b41442da26dc5f1efeb6 | d1bdcbb6261cce5f953abba5557b8ca9f9891950 | /数据结构与算法练习/test/Arrays类练习.java | 43b6fc1598e74332f18a523952dd5426bdb84e41 | [] | no_license | zoe1101/review_java_idea | 920b502e245aa7da962bb0f0cfdfa4114271edc8 | a705365d632f9a5b8fab065cd111cd7a1f8aba44 | refs/heads/master | 2020-07-11T07:44:52.045414 | 2019-09-15T14:29:58 | 2019-09-15T14:29:58 | 204,480,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,342 | java | package test;
import java.util.Arrays;
public class Arrays类练习 {
public static void main(String[] args) {
// TODO 自动生成的方法存根
int[] array=new int[5];
Arrays.fill(array,3); // 填充数组,3代表填充值
System.out.println("填充数组:Arrays.fill(array, 5):");
printArray(array);
// 将数组的第2和第3个元素赋值为8
Arrays.fill(array, 2, 4, 8);
System.out.println("将数组的第2和第3个元素赋值为8:Arrays.fill(array, 2, 4, 8):");
printArray(array);
int[] array1 = { 7, 8, 3, 2, 12, 6, 3, 5, 4 };
printArray(array1);
// 对数组的第2个到第6个进行排序进行排序
Arrays.sort(array1, 2, 7);
System.out.println("对数组的第2个到第6个元素进行排序进行排序:Arrays.sort(array,2,7):");
printArray(array1);
// 对整个数组进行排序
Arrays.sort(array1);
System.out.println("对整个数组进行排序:Arrays.sort(array1):");
printArray(array1);
// 复制数组
Arrays.copyOf(array1, 14);
System.out.println("复制数组至长度14: Arrays.copyOf(array1, 14)");
printArray(array1);
System.out.println("复制数组的[2,5)号元素到新数组");
printArray(Arrays.copyOfRange(array1, 2,5));
// 比较数组元素是否相等
System.out.println("比较数组元素是否相等:Arrays.equals(array, array1):" + "\n" + Arrays.equals(array, array1));
int[] array2 = array1.clone();
System.out.println("克隆后数组元素是否相等:Arrays.equals(array1, array2):" + "\n" + Arrays.equals(array1, array2));
// 使用二分搜索算法查找指定元素所在的下标(必须是排序好的,否则结果不正确)
Arrays.sort(array1);
System.out.println("元素3在array1中的位置:Arrays.binarySearch(array1, 3):" + "\n" + Arrays.binarySearch(array1, 3));
// 如果不存在就返回负数
System.out.println("元素9在array1中的位置:Arrays.binarySearch(array1, 9):" + "\n" + Arrays.binarySearch(array1, 9));
}
// 打印所有数组元素
public static void printArray(int[] arr) {
for(int ele:arr) {
System.out.print(ele+" ");
}
System.out.println("");
}
}
| [
"tangli.1994@163.com"
] | tangli.1994@163.com |
dd290d1df0beefa17fbedeaeea9c4055d4c2598d | 9254e7279570ac8ef687c416a79bb472146e9b35 | /edas-20170801/src/main/java/com/aliyun/edas20170801/models/UpdateRoleResponse.java | 61e0094f546598d1f1a5f49299589e77fabc851d | [
"Apache-2.0"
] | permissive | lquterqtd/alibabacloud-java-sdk | 3eaa17276dd28004dae6f87e763e13eb90c30032 | 3e5dca8c36398469e10cdaaa34c314ae0bb640b4 | refs/heads/master | 2023-08-12T13:56:26.379027 | 2021-10-19T07:22:15 | 2021-10-19T07:22:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,017 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.edas20170801.models;
import com.aliyun.tea.*;
public class UpdateRoleResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("body")
@Validation(required = true)
public UpdateRoleResponseBody body;
public static UpdateRoleResponse build(java.util.Map<String, ?> map) throws Exception {
UpdateRoleResponse self = new UpdateRoleResponse();
return TeaModel.build(map, self);
}
public UpdateRoleResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public UpdateRoleResponse setBody(UpdateRoleResponseBody body) {
this.body = body;
return this;
}
public UpdateRoleResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
1523be513d66c12f919450f81e91febefa570fbb | 07e584c79d1451f321e38e3b59220f207368b740 | /Abooji_android/src/com/android/abooji/view/PageIndicator.java | 01924d9b4629ca8fa077302a4e9dbf9f6a93a12c | [] | no_license | joneyThot/Abboji | a9ae87cac4c7f5a14e9629745092ee3fdc6b048a | acf9578216a2e91e039229cac685aaad1c1e8ae1 | refs/heads/master | 2021-09-08T13:46:56.581277 | 2018-03-10T01:37:35 | 2018-03-10T01:37:35 | 124,609,782 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,832 | java | /*
* Copyright (C) 2011 Patrik Akerfeldt
* Copyright (C) 2011 Jake Wharton
*
* 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.android.abooji.view;
import android.support.v4.view.ViewPager;
/**
* A PageIndicator is responsible to show an visual indicator on the total views
* number and the current visible view.
*/
public interface PageIndicator extends ViewPager.OnPageChangeListener {
/**
* Bind the indicator to a ViewPager.
*
* @param view
*/
void setViewPager(ViewPager view);
/**
* Bind the indicator to a ViewPager.
*
* @param view
* @param initialPosition
*/
void setViewPager(ViewPager view, int initialPosition);
/**
* <p>Set the current page of both the ViewPager and indicator.</p>
*
* <p>This <strong>must</strong> be used if you need to set the page before
* the views are drawn on screen (e.g., default start page).</p>
*
* @param item
*/
void setCurrentItem(int item);
/**
* Set a page change listener which will receive forwarded events.
*
* @param listener
*/
void setOnPageChangeListener(ViewPager.OnPageChangeListener listener);
/**
* Notify the indicator that the fragment list has changed.
*/
void notifyDataSetChanged();
}
| [
"joney143pinky@gmail.com"
] | joney143pinky@gmail.com |
1984e93950773c1f4eaa84932f42864c620094d0 | 3819b33489d7935f224f3f409787ceef6e1b791f | /src/main/java/com/pluralflights/passenger/Passenger.java | 07b851a70753a72081f415959f5654e1d3eefac9 | [] | no_license | shahrohan05/PluralFlights | 327509715253b234e6be5f90a8a6080da0259246 | 898a34730535a4624692c009692dc6ef46a9c71c | refs/heads/master | 2022-04-21T23:38:13.156115 | 2020-04-23T15:22:13 | 2020-04-23T15:22:13 | 257,562,954 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 616 | java | package com.pluralflights.passenger;
import java.util.Objects;
public class Passenger {
private String name;
private boolean vip;
public Passenger(String name, boolean vip) {
this.name = name;
this.vip = vip;
}
public String getName() {
return name;
}
public boolean isVip() {
return vip;
}
@Override
public boolean equals(Object obj) {
if(this == obj) return true;
if(obj == null || this.getClass() != obj.getClass()) return false;
Passenger p = (Passenger) obj;
return Objects.equals(name, p.getName());
}
@Override
public int hashCode() {
return Objects.hash(name);
}
}
| [
"shahrohan07@live.com"
] | shahrohan07@live.com |
40b218f0045765d63b52a7f7a737901300b31662 | d95e7888de22e990b6de83fdfbbf8bc047676126 | /Chapter06_Class/src/sec06/exam06/Car.java | 04a5fadac7795230c3a1ccab05714134defe70c7 | [] | no_license | moonhy7/Java_programing | 607752261a8669f192b82b543198fee8df833e5a | 7e5390e67416e9d5b60944c6cd82df23fbdb2c67 | refs/heads/master | 2023-07-31T18:45:10.850380 | 2021-09-15T14:08:24 | 2021-09-15T14:08:24 | 390,422,853 | 2 | 0 | null | null | null | null | UHC | Java | false | false | 563 | java | package sec06.exam06;
public class Car {
// 우클릭> Source > getter Setter 만들기 알아보기
// 필드
private int speed;
private boolean stop;
// 생성자
// 메소드
public int getSpeed() {
return speed;
}
public void setSpeed(int speed) {
//... speed 값 검증
if(speed < 0) {
this.speed = 0;
return;
} else {
this.speed = speed;
}
}
public boolean isStop() { // boolean 타입은 is..로 이름을 지을것
return stop;
}
public void setStop(boolean stop) {
this.stop = stop;
this.speed = 0;
}
}
| [
"moonhy7@naver.com"
] | moonhy7@naver.com |
f1544643f7c8fb29b8cc6dad9147b11411ba6ff1 | 8e0818bf7255ea7d334a279da9b9128394a9dc3d | /src/org/usfirst/frc/team4188/robot/commands/LiftDown.java | 8a613d9bafb94af15000abc285724e056282cc9f | [] | no_license | FaritaTasnim/FRC_2015 | 7747064c1a59b957a0263410e9299a6f2f1ee480 | e09e3f1e0afdf3e330fbda991b00a36b017b12aa | refs/heads/master | 2021-01-21T07:53:23.475997 | 2015-04-14T20:38:46 | 2015-04-14T20:38:46 | 33,955,892 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,135 | java | package org.usfirst.frc.team4188.robot.commands;
import org.usfirst.frc.team4188.robot.Robot;
import edu.wpi.first.wpilibj.command.Command;
/**
*
*/
public class LiftDown extends Command {
boolean doneYet;
public LiftDown() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
doneYet = false;
}
// Called just before this Command runs the first time
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
if(Robot.motors.isLim4Hit()) Robot.motors.runMotor1(0.75); //positive means it goes down
else {
Robot.motors.stopMotor1();
doneYet = true;
}
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return doneYet;
}
// Called once after isFinished returns true
protected void end() {
doneYet = false;
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}
| [
"farita@mit.edu"
] | farita@mit.edu |
3d1ea78de900440e6458bb0d16f41d784f1e240e | 8187e83a1cdcd292ad585e54ab8c388212ce41fd | /src/test/java/com/ederfmatos/library/service/BookServiceTest.java | 71bad3bdd8885a3e18e4a9660e3776e0b51f4057 | [] | no_license | ederfmatos/Design-de-APIs-RestFul-com-Spring-Boot-TDD-e-o-novo-JUnit5 | 3b22f454cd385b7e513209455d45c192b877c33e | 056ac67c15e3f15edf4e7c0da7863d25432b67f3 | refs/heads/master | 2022-07-29T18:16:57.206641 | 2020-05-14T18:39:59 | 2020-05-14T18:39:59 | 261,587,033 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,958 | java | package com.ederfmatos.library.service;
import com.ederfmatos.library.exception.BusinessException;
import com.ederfmatos.library.model.Book;
import com.ederfmatos.library.repository.BookRepository;
import com.ederfmatos.library.service.impl.BookServiceImpl;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.List;
import java.util.Optional;
import static com.ederfmatos.library.builder.BookBuilder.oneBook;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.*;
@ExtendWith(SpringExtension.class)
@ActiveProfiles("test")
public class BookServiceTest {
private BookService service;
@MockBean
BookRepository repository;
@BeforeEach
public void setup() {
this.service = new BookServiceImpl(repository);
}
@Test
@DisplayName("Deve salvar um livro")
public void saveBookTest() {
Book book = oneBook().build();
when(repository.save(book)).thenReturn(oneBook().withId(1).build());
Book savedBook = service.save(book);
assertThat(savedBook.getId()).isNotNull();
assertThat(savedBook.getTitle()).isEqualTo(book.getTitle());
assertThat(savedBook.getAuthor()).isEqualTo(book.getAuthor());
assertThat(savedBook.getIsbn()).isEqualTo(book.getIsbn());
}
@Test
@DisplayName("Deve lançar uma exceção ao tentar salvar livro com isbn já cadastrado por outro livro")
public void shouldNotSaveABookWithDuplicatedISBN() {
Book book = oneBook().build();
doReturn(true).when(repository).existsByIsbn(book.getIsbn());
Throwable exception = catchThrowable(() -> service.save(book));
assertThat(exception)
.isInstanceOf(BusinessException.class)
.hasMessage("Isbn já cadastrado");
verify(repository, never()).save(book);
}
@Test
@DisplayName("Deve obter um livro por id")
public void getByIdTest() {
final long id = 1;
Book book = oneBook().withId(id).build();
doReturn(Optional.of(book)).when(repository).findById(id);
Optional<Book> foundBook = service.getById(id);
assertThat(foundBook.isPresent()).isTrue();
assertThat(foundBook.get().getId()).isEqualTo(book.getId());
assertThat(foundBook.get().getTitle()).isEqualTo(book.getTitle());
assertThat(foundBook.get().getAuthor()).isEqualTo(book.getAuthor());
assertThat(foundBook.get().getIsbn()).isEqualTo(book.getIsbn());
}
@Test
@DisplayName("Deve obter vazio quando buscar um livro inexistente")
public void getEmptyBookByIdTest() {
final long id = 1;
doReturn(Optional.empty()).when(repository).findById(id);
Optional<Book> book = service.getById(id);
assertThat(book.isPresent()).isFalse();
}
@Test
@DisplayName("Deve deletar um book")
public void deleteBookTest() {
Book book = oneBook().withId(1).build();
assertDoesNotThrow(() -> doNothing().when(repository).delete(book));
service.deleteById(book);
verify(repository, times(1)).delete(book);
}
@Test
@DisplayName("Deve ocorrer um erro ao tentar deletar livro inexistente")
public void deleteInvalidBookTest() {
assertThrows(IllegalArgumentException.class, () -> service.deleteById(null));
verify(repository, never()).delete(any(Book.class));
}
@Test
@DisplayName("Deve alterar um book pelo id")
public void updateBookTest() {
Book book = oneBook().withId(1).build();
doReturn(book).when(repository).save(book);
assertDoesNotThrow(() -> service.update(book));
}
@Test
@DisplayName("Deve ocorrer erro ao tentar atualizar livro inexistente")
public void updateInvalidBookTest() {
assertThrows(IllegalArgumentException.class, () -> service.update(null));
verify(repository, never()).save(any(Book.class));
}
@Test
@DisplayName("Deve filtrar livros")
public void findBookTest() {
Book book = oneBook().build();
List<Book> books = List.of(book);
PageRequest pageRequest = PageRequest.of(0, 10);
Page<Book> page = new PageImpl<>(books, pageRequest, 1);
doReturn(page).when(repository).findAll(any(Example.class), any(PageRequest.class));
Page<Book> result = service.find(book, pageRequest);
assertThat(result.getTotalElements()).isEqualTo(1);
assertThat(result.getContent()).isEqualTo(books);
assertThat(result.getPageable().getPageNumber()).isEqualTo(0);
assertThat(result.getPageable().getPageSize()).isEqualTo(10);
}
@Test
@DisplayName("Deve obter um livro pelo isbn")
public void getBookByIsbnTest() {
final String isbn = "123123";
Book book = oneBook().withId(1).withIsbn(isbn).build();
when(service.getBookByIsbn(anyString())).thenReturn(Optional.of(book));
Optional<Book> foundBook = service.getBookByIsbn(isbn);
assertThat(foundBook.isPresent()).isTrue();
assertThat(foundBook.get().getId()).isEqualTo(book.getId());
assertThat(foundBook.get().getIsbn()).isEqualTo(isbn);
verify(repository, times(1)).findByIsbn(isbn);
}
}
| [
"ederfmatos@gmail.com"
] | ederfmatos@gmail.com |
f245f5192d28709f58cbcf6b04600a3fe68a0fd4 | 58bdf35ca315767def65d92688f65a94975ebcfd | /11App/Loopview/app/src/main/java/com/example/loopview/RecyclerStaggeredActivity.java | 968df754ddc74554cf45147d3e5a526e46112b5c | [] | no_license | ulife1779/2020homework-yml | a5e02e7eceae0b9a0796f506f00a2abdbddba3cb | 0f165ae7fb78cc3daf82e4e3d54c20a32728f7c6 | refs/heads/main | 2023-02-02T23:58:16.788577 | 2020-12-18T14:17:15 | 2020-12-18T14:17:15 | 319,596,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,943 | java | package com.example.loopview;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.DefaultItemAnimator;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import com.example.loopview.adapter.RecyclerStaggeredAdapter;
import com.example.loopview.bean.GoodsInfo;
public class RecyclerStaggeredActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recycler_staggered);
initRecyclerStaggered(); // 初始化瀑布流布局的循环视图
}
// 初始化瀑布流布局的循环视图
private void initRecyclerStaggered() {
// 从布局文件中获取名叫rv_staggered的循环视图
RecyclerView rv_staggered = findViewById(R.id.rv_staggered);
// 创建一个垂直方向的瀑布流布局管理器
StaggeredGridLayoutManager manager = new StaggeredGridLayoutManager(
3, RecyclerView.VERTICAL);
// 设置循环视图的布局管理器
rv_staggered.setLayoutManager(manager);
// 构建一个服装列表的瀑布流适配器
RecyclerStaggeredAdapter adapter = new RecyclerStaggeredAdapter(this, GoodsInfo.getDefaultStag());
// 设置瀑布流列表的点击监听器
adapter.setOnItemClickListener(adapter);
// 设置瀑布流列表的长按监听器
adapter.setOnItemLongClickListener(adapter);
// 给rv_staggered设置服装瀑布流适配器
rv_staggered.setAdapter(adapter);
// 设置rv_staggered的默认动画效果
rv_staggered.setItemAnimator(new DefaultItemAnimator());
// 给rv_staggered添加列表项之间的空白装饰
rv_staggered.addItemDecoration(new SpacesItemDecoration(3));
}
} | [
"1009669357@qq.com"
] | 1009669357@qq.com |
51de0c2f43dcb8a1739cfd91430a6b3b80f87e0b | 8d5bffe7e1492bd693c5c4d75e06fa681a3613fc | /pano-entity/src/main/java/cn/com/platform/platform/mapper/common01/PlatformMember01Mapper.java | e6b81aebf9010cb5734427c8cad5fc9cae41f17b | [] | no_license | tangyoucheng/gradle-multi-pano-git | 2c5fcb65635e1f1d9c307d76a9b97b20b8fb5114 | ad5c1bde3967d7f12d8b7adbf3dfb923e1395461 | refs/heads/master | 2020-07-09T11:04:50.575563 | 2019-12-10T03:43:50 | 2019-12-10T03:43:50 | 203,952,975 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,446 | java | package cn.com.platform.platform.mapper.common01;
import java.util.HashMap;
import java.util.List;
import cn.com.platform.platform.mapper.common.PlatformMemberMapper;
import cn.com.platform.platform.model.common.PlatformMember;
import cn.com.platform.platform.model.common.PlatformMemberQuery;
/**
* 会员用户Mapper
*
* @author 唐友成
* @date 2018-08-10
*
*/
public interface PlatformMember01Mapper extends PlatformMemberMapper {
/**
* 通过基础model删除数据
*
* @mbg.generated
*/
int deleteByBaseModel(PlatformMemberQuery example);
/**
* 通过基础model检索数据
*
* @mbg.generated
*/
List<PlatformMember> selectByBaseModel(PlatformMemberQuery example);
/**
* 检索未被删除的所有会员用户的数量
*
* @param parameter
* @return
*/
long selectMembersCount(HashMap<?, ?> parameter);
/**
* 检索未被删除的所有会员用户
*
* @param parameter
* @return
*/
List<PlatformMember> selectMembersInfo(HashMap<?, ?> parameter);
/**
* 伦理删除会员用户
*
* @param memberId 会员用户ID
*/
void deleteById(String memberId);
/**
* 更新会员用户
*
* @param PlatformMember
*/
void updateByMemberId(PlatformMember PlatformMember);
/**
* 检索拥有某一角色的所有用户
*
* @mbg.generated
*/
List<PlatformMember> selectMemberByRoleId(HashMap<?, ?> parameter);
}
| [
"tangyoucheng@gmail.com"
] | tangyoucheng@gmail.com |
bfed95a26db3073c84663cc35c156260c868c73c | 5d6979a391939a60f0756bdafe9eba0df72c37f0 | /src/models/Package.java | 5a279be5549cfbb06a6dff535ea4e505c9144a13 | [] | no_license | ggalanteCode/SmellAmongCommits | d0547eba7e3ccef46eaeec315b732e91a80e245f | 55fc28a62f380988a23e53f1e39a3031803f3263 | refs/heads/master | 2023-08-21T09:04:04.564180 | 2021-10-13T14:53:11 | 2021-10-13T14:53:11 | 400,304,206 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 991 | 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 models;
/**
*
* @author mefi
*/
public class Package {
private long id;
private String name,path;
public Package(String name) {
this.name=name;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public Package(String name, String path) {
this.name = name;
this.path = path;
}
@Override
public String toString() {
return "Package{" + "id=" + id + ", name=" + name + ", path=" + path + '}';
}
}
| [
"ggalante3@gmail.com"
] | ggalante3@gmail.com |
ee19ba5293cb9a8acf82a399167dabb91b70ea82 | 9d4e147338b58797432d32033c24d165c8d5bbad | /AAD_EX01/app/src/androidTest/java/com/example/mgota/aad_ex01/ExampleInstrumentedTest.java | aa188195ab01dddab363dfa176894e25ab1c5b59 | [] | no_license | ChapmanCPSC356Fall2017/service-tip-calculator-mgotao | fef26326d10b2cc42953de797ba1eb0b245efc9b | 8160195ae18c651e02c557880cad783ab46c772e | refs/heads/master | 2021-06-27T08:06:06.990640 | 2017-09-13T21:26:34 | 2017-09-13T21:26:34 | 103,434,819 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 756 | java | package com.example.mgota.aad_ex01;
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.*;
/**
* Instrumentation 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() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.mgota.aad_ex01", appContext.getPackageName());
}
}
| [
"m.gotao@yahoo.com"
] | m.gotao@yahoo.com |
9e9db6b9427524a4b9b7d31bfa739d3c8b160908 | 4cc3bb729aab619052595f53f333c42e8727bfe8 | /gmall-search/src/main/java/com/atguigu/gmall/search/feign/GmallWmsClient.java | 90f312bae30bd9faf8250693b29e9f2e48829f48 | [
"Apache-2.0"
] | permissive | zhukehui/gmall | 12bc934f946c1d8cb8793c71b5f8320ca597fbda | 8f6652bb4e2f2a084c293bf11225fab727ca1560 | refs/heads/master | 2022-12-27T04:14:04.246755 | 2019-11-21T02:24:18 | 2019-11-21T02:24:18 | 218,018,924 | 0 | 1 | Apache-2.0 | 2022-12-16T14:50:54 | 2019-10-28T10:13:45 | JavaScript | UTF-8 | Java | false | false | 283 | java | package com.atguigu.gmall.search.feign;
import com.atguigu.gmall.wms.api.GmallWmsApi;
import org.springframework.cloud.openfeign.FeignClient;
/**
* @author eternity
* @create 2019-11-05 0:26
*/
@FeignClient("wms-service")
public interface GmallWmsClient extends GmallWmsApi {
}
| [
"574059694@qq.com"
] | 574059694@qq.com |
9f282e3c0fc5a039f1783592bed8442ff691df89 | 82f8612f24ba932524398c79a16f6f072277ac05 | /business-modules/example-api/src/main/java/com/example/handler/GeneralExceptionHandler.java | ccadf154f8d160a792246a811c9b6607d38f1ab6 | [
"Apache-2.0"
] | permissive | lezengcai/diboot-cloud | a87a121f5dd2f3b6f23d9b7973dafcb878fb1bc1 | 24dac4a373b4828659603c22d1192ea0ba9a32ba | refs/heads/main | 2023-07-15T16:34:14.356971 | 2021-08-10T09:17:22 | 2021-08-10T09:17:22 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.example.handler;
import com.diboot.core.handler.DefaultExceptionHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
/**
* 通用异常处理类
* @author JerryMa
* @version 1.0
* @date 2021-01-21
* Copyright © www.dibo.ltd
*/
@ControllerAdvice
@Slf4j
public class GeneralExceptionHandler extends DefaultExceptionHandler{
} | [
"zhaozhaoyang123456"
] | zhaozhaoyang123456 |
aff9c4e8b72d7f2a8a5eeb6cbcdba33db041c417 | e8277961e72c67b9693058caef4c65c530bb22d3 | /src/Examples/PlayAudio.java | 4429457ce1061f5e5125e375cf7deaeca48dcee1 | [] | no_license | mrgoutam/AllJavaExamples | 4634822e7e43fec9dfb2211922e4dd1d838484de | a9ad8d8499781ee305833e2c8d49ffc844aaabed | refs/heads/master | 2021-01-21T12:30:36.714328 | 2018-06-20T05:47:21 | 2018-06-20T05:47:21 | 102,072,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 279 | 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 Examples;
/**
*
* @author Goutam
*/
public class PlayAudio {
}
| [
"mrgoutam8.3@gmail.com"
] | mrgoutam8.3@gmail.com |
6fa74ca435dc5daedee854f6d119b470a6cf99b5 | c0afd87a26ca796d38076235a4a26e688bdc24ce | /javaGoF/chap20Flyweight/hugeNumber/NumberData.java | 0a319075797a3016ab127f9576b6d0ef74d30bf3 | [] | no_license | shika-sophia/sophia2021 | 8a0d0e4896d4300b29b7242162b01b06b434cef8 | 0d6619f6f900780ebb33c5464b666eb423a8a250 | refs/heads/main | 2023-06-30T09:06:09.466747 | 2021-07-25T01:17:34 | 2021-07-25T01:17:34 | 331,533,011 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,566 | java | package javaGoF.chap20Flyweight.hugeNumber;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class NumberData {
private List<int[]> hexAryList = new ArrayList<>(Arrays.asList(
new int[] {0x0fc0, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x0fc0}, //0
new int[] {0x0300, 0x3f00, 0x0300, 0x0300, 0x0300, 0x0300, 0x3ff0}, //1
new int[] {0x0fc0, 0x3030, 0x0030, 0x03c0, 0x0c00, 0x3000, 0x3ff0}, //2
new int[] {0x0fc0, 0x3030, 0x0030, 0x03c0, 0x0030, 0x3030, 0x0fc0}, //3
new int[] {0x00c0, 0x03c0, 0x0cc0, 0x30c0, 0x3ff0, 0x00c0, 0x03f0}, //4
new int[] {0x3ff0, 0x3000, 0x3000, 0x3fc0, 0x0030, 0x3030, 0x0fc0}, //5
new int[] {0x0fc0, 0x3030, 0x3000, 0x3fc0, 0x3030, 0x3030, 0x0fc0}, //6
new int[] {0x3ff0, 0x3030, 0x0030, 0x00c0, 0x0300, 0x0300, 0x0300}, //7
new int[] {0x0fc0, 0x3030, 0x3030, 0x0fc0, 0x3030, 0x3030, 0x0fc0}, //8
new int[] {0x0fc0, 0x3030, 0x3030, 0x0ff0, 0x0030, 0x3030, 0x0fc0}, //9
new int[] {0x0000, 0x0000, 0x0000, 0x3ff0, 0x0000, 0x0000, 0x0000} //-
));
public List<int[]> getHexAryList() {
return hexAryList;
}
public String showNumber(int[] hexAry) {
final int MAX_LENGTH = 16;
var bld = new StringBuilder();
for(int row : hexAry) {
String rowStr = Integer.toBinaryString(row);
String addZero = Stream.generate(() -> "0")
.limit(MAX_LENGTH - rowStr.length())
.collect(Collectors.joining());
String str = (addZero + rowStr)
.replace("0", ".").replace("1", "#");
bld.append(str + "\n");
}//for
//System.out.println(bld.toString());
//.out.println();
return bld.toString();
}//showNumber()
// //====== Test main() ======
// public static void main(String[] args) throws ParseException {
// var here = new NumberData();
// here.hexAryList.forEach(ary -> here.showNumber(ary));
// }//main()
}//class
/*
for(int i = 0; i < 16; i++) {
String bin = Integer.toBinaryString(i);
String hex = Integer.toHexString(i);
System.out.printf("%04s: %s \n", bin, hex);
}//for
0: 0
1: 1
10: 2
11: 3
100: 4
101: 5
110: 6
111: 7
1000: 8
1001: 9
1010: a
1011: b
1100: c
1101: d
1110: e
1111: f
*/
/*
public static void main(String[] args) throws ParseException {
final int MAX_LENGTH = 16;
int[] hex0 =
{0x0fc0, 0x3030, 0x3030, 0x3030, 0x3030, 0x3030, 0x0fc0};
var bld = new StringBuilder();
for(int row : hex0) {
String rowStr = Integer.toBinaryString(row);
String addZero = Stream.generate(() -> "0")
.limit(MAX_LENGTH - rowStr.length())
.collect(Collectors.joining());
String str = (addZero + rowStr)
.replace("0", ".").replace("1", "#");
bld.append(str + "\n");
}//for
System.out.println(bld.toString());
}//main()
....######......
..##......##....
..##......##....
..##......##....
..##......##....
..##......##....
....######......
......##........
..######........
......##........
......##........
......##........
......##........
..##########....
....######......
..##......##....
..........##....
......####......
....##..........
..##............
..##########....
....######......
..##......##....
..........##....
......####......
..........##....
..##......##....
....######......
........##......
......####......
....##..##......
..##....##......
..##########....
........##......
......######....
..##########....
..##............
..##............
..########......
..........##....
..##......##....
....######......
....######......
..##......##....
..##............
..########......
..##......##....
..##......##....
....######......
..##########....
..##......##....
..........##....
........##......
......##........
......##........
......##........
....######......
..##......##....
..##......##....
....######......
..##......##....
..##......##....
....######......
....######......
..##......##....
..##......##....
....########....
..........##....
..##......##....
....######......
................
................
................
..##########....
................
................
................
*/ | [
"noreply@github.com"
] | shika-sophia.noreply@github.com |
6b6db9d1bc4d0e5b32822793fe9f6c1979e2f02a | 0a0e01baf5eccf04c9c6d710cd2de5d3a632743d | /VisualEditor/src/Counter.java | dad9932f94901baf604e085e423f6eddd72444af | [] | no_license | nberrehouma/Master-Project | fb7e5b5c6ea09f8d5525579c69cc9120bdd6c329 | 8bf88934e40445193a329dda2ffabb1990ace957 | refs/heads/master | 2020-12-29T02:39:13.035150 | 2017-02-21T20:38:30 | 2017-02-21T20:38:30 | 50,786,445 | 2 | 1 | null | 2017-02-21T20:38:31 | 2016-01-31T17:39:38 | Java | UTF-8 | Java | false | false | 250 | java | public class Counter
{
static int count =0;
public static int getCount()
{
return count;
}
public static void setCount(int count)
{
Counter.count = count;
}
public static void increment() {
Counter.count++;
}
}
| [
"mkantem@yahoo.fr"
] | mkantem@yahoo.fr |
6bc7daf6255d40bb24df63ea4fde1f97f9051c2e | 07bd89d994da04a94c84db8997a67ae118af7830 | /LightingSalesSystem/SalesSystemServer/src/rmi/dataRemoteObject/approveBillRemoteObject/ApproveReceiptBillRemoteObject.java | f1eb23dcdafdf48497a22e6da87448107e7c5429 | [] | no_license | pilibb0712/myHomework | 61e48163972b0ca0c42c736636c46b07492c40da | 5d013e35ee930f730418cad0a9af4cc3bf9ba0a2 | refs/heads/master | 2023-08-24T09:41:17.561232 | 2019-11-30T05:18:26 | 2019-11-30T05:18:26 | null | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 1,224 | java | package rmi.dataRemoteObject.approveBillRemoteObject;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.util.ArrayList;
import blImpl.bill.approveBillBl.ApproveReceiptBillBlController;
import blService.billService.approveBillBlService.ApproveReceiptBillBlService;
import vo.ReceiptBillVO;
import vo.UserInfoVO;
/**
* 单据的审批,包括得到需要审批单据列表,和pass deny单据
* @author 张傲 161250193
* @version 2017.12.3
*/
public class ApproveReceiptBillRemoteObject extends UnicastRemoteObject implements ApproveReceiptBillBlService {
/**
*
*/
private static final long serialVersionUID = 7476794552195113588L;
public ApproveReceiptBillRemoteObject() throws RemoteException {
super();
}
private ApproveReceiptBillBlService service = new ApproveReceiptBillBlController();
@Override
public ArrayList<ReceiptBillVO> getBillsList() throws RemoteException {
return service.getBillsList();
}
@Override
public boolean passBill(ReceiptBillVO billVO) throws RemoteException {
return service.passBill(billVO);
}
@Override
public boolean denyBill(ReceiptBillVO billVO) throws RemoteException {
return service.denyBill(billVO);
}
}
| [
"1292155474@qq.com"
] | 1292155474@qq.com |
1fee237749a5bfd4e00ae18535130477e5574c22 | 9eb94954fc1b1e71b40a064d65c8f9d1c3edd662 | /src/main/java/com/dragonsofmugloar/api/dto/MessageAfterSolveDTO.java | b68c1881d45c3e7d04cfb0a5b0feb22daa49a1a4 | [] | no_license | jcarlosvale/dragonsOfMugloar | a5aacfc2cd9d0b94836f0ba8e4edfbc4caa38035 | afb52329c49f06f8e0d84e15a66dab405d8b2317 | refs/heads/master | 2022-12-26T16:35:17.885685 | 2019-08-11T13:45:02 | 2019-08-11T13:45:02 | 201,759,485 | 1 | 0 | null | 2022-12-10T05:43:54 | 2019-08-11T12:04:08 | Java | UTF-8 | Java | false | false | 568 | java | package com.dragonsofmugloar.api.dto;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* Represents the Message received after try solve one of the message
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class MessageAfterSolveDTO {
private boolean success;
private int lives;
private int gold;
private int score;
private int highScore;
private int turn;
private String message;
}
| [
"joao.vale@sky.uk"
] | joao.vale@sky.uk |
f6d5f709483255632c9dfb545a4e7307ce4df6d3 | 8ea1b3ec9592e955cd70a16f45d051550efd1a23 | /customers/src/main/java/entity/EntityTested.java | 66437ff90625020917b131c663eb273ed028ad50 | [] | no_license | SoerenDue/Dat3semFlow1Week1 | 726a51b606e5d5529fad92c8b7eb6e1264c6ca16 | ff3d63ac635f4dfe7330ad07db1f0a0e18c3a889 | refs/heads/main | 2023-02-28T14:03:46.360276 | 2021-02-06T14:14:26 | 2021-02-06T14:14:26 | 309,344,496 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,261 | 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 entity;
import static com.sun.org.apache.xalan.internal.lib.ExsltDatetime.date;
import java.time.LocalDate;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
/**
*
* @author zarpy
*/
public class EntityTested {
public static void main(String[] args) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("pu");
EntityManager em = emf.createEntityManager();
Customer customer1 = new Customer("Hans","Olsen");
Customer customer2 = new Customer("Ira","Shamir");
try {
em.getTransaction().begin();
em.persist(customer1);
em.persist(customer2);
em.getTransaction().commit();
}finally{
em.close();
}
//Verify that customers are managed and has been given a database id
System.out.println("Customer 1 " + customer1.toString());
System.out.println("Customer 2 " + customer2.toString());
}
}
| [
"cph-sa343@cphbusiness.dk"
] | cph-sa343@cphbusiness.dk |
8666bfc374b7d8f89e301a19315d91ddf53a8fe0 | d71fb879713ddae2d5cb6d26e41b5f9a0a706b97 | /iTrust/src/test/java/edu/ncsu/csc/itrust/unit/flags/FlagTest.java | 3a5606ca2c52c4658779baafaf101e52d011270a | [] | no_license | wesleycoats/CSC326 | 9c0a0d6e838dbb9b037f750b3ff360fdf8c45272 | 2f55a41bdd9f61ae843e804f446a3a4245576ccc | refs/heads/master | 2020-03-16T06:11:55.720968 | 2017-04-19T23:43:34 | 2017-04-19T23:43:34 | 132,549,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 664 | java | package edu.ncsu.csc.itrust.unit.flags;
import static org.junit.Assert.*;
import org.junit.Test;
import edu.ncsu.csc.itrust.controller.flags.Flag;
public class FlagTest {
@Test
public void test() {
Flag f = new Flag(1L, 1L, 1L, "Test Flag");
assertEquals(1L, f.getFid());
assertEquals(1L, f.getMid());
assertEquals(1L, f.getPregID());
assertEquals("Test Flag", f.getFlagType());
f.setFid(27L);
assertEquals(27L, f.getFid());
f.setFlagType("New");
assertEquals("New", f.getFlagType());
f.setMid(12L);
assertEquals(12L, f.getMid());
f.setPregID(2L);
assertEquals(2L, f.getPregID());
}
}
| [
"bmhogan@ncsu.edu"
] | bmhogan@ncsu.edu |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.