blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
696f43e6d96b53f07e6e4e711b71f4e4a97fa252 | cbeb291d5973433de8697d0810a734805d380d79 | /app/src/main/java/com/persona5dex/activities/BaseActivity.java | 3c496cd70ce3578ee39472612200c925f9efe50b | [] | no_license | Wintermute21/persona-dex | 72c560c1022ec152463530cd2618ed2482a7b48b | d8fd09aca5805a3099fa62d9c101b405416c5f3b | refs/heads/master | 2022-11-26T05:46:23.135856 | 2020-04-18T02:35:18 | 2020-04-18T02:35:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,522 | java | package com.persona5dex.activities;
import android.content.SharedPreferences;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.app.AppCompatDelegate;
import com.persona5dex.Persona5Application;
import com.persona5dex.R;
import com.persona5dex.dagger.activity.ActivityComponent;
import javax.inject.Inject;
import javax.inject.Named;
import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
/**
* Created by Rechee on 7/30/2017.
*/
public class BaseActivity extends AppCompatActivity {
protected ActivityComponent component;
@Inject
@Named("defaultSharedPreferences")
protected SharedPreferences defaultSharedPreferences;
public ActivityComponent getComponent() {
return this.component;
}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActivityComponent component = buildComponent();
component.inject(this);
this.component = component;
final String nightModeValue =
defaultSharedPreferences.getString(getString(R.string.pref_key_theme), String.valueOf(MODE_NIGHT_FOLLOW_SYSTEM));
AppCompatDelegate.setDefaultNightMode(Integer.parseInt(nightModeValue));
}
protected ActivityComponent buildComponent() {
return Persona5Application.get(this).getComponent().activityComponent().activityContext(this).build();
}
}
| [
"recheejozil@hotmail.com"
] | recheejozil@hotmail.com |
a545a741216210a2b5adb26c02ad66d42346ac09 | 758e51e961680e25f2fa969994648b636ce74359 | /src/main/java/com/daniel/service/CadastroTituloService.java | 29eb2bd5f842b21179985b1c87e8be072fbe1ade | [
"Apache-2.0"
] | permissive | MLSalesSantos/daniel-api | 07a1c41caf01f52b72c8b0c209e39706ab3c7f01 | d61165c59b4c3f280bfc011b1075cf6ce000a968 | refs/heads/master | 2020-05-30T19:32:51.104808 | 2019-06-03T03:22:10 | 2019-06-03T03:22:10 | 189,923,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 897 | java | package com.daniel.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import com.daniel.model.Titulo;
import com.daniel.repository.Titulos;
import com.daniel.repository.filter.TituloFilter;
@Service
public class CadastroTituloService {
@Autowired
private Titulos titulos;
public void salvar(Titulo titulo) {
try {
titulos.save(titulo);
} catch (DataIntegrityViolationException e) {
throw new IllegalArgumentException("Formato de data inválido");
}
};
public void excluir(Long codigo) {
titulos.delete(codigo);
};
public List<Titulo> filtrar(TituloFilter filtro) {
String descricao = filtro.getDescricao() == null ? "%" : filtro.getDescricao();
return titulos.findByDescricaoContaining(descricao);
};
};
| [
"noreply@github.com"
] | noreply@github.com |
d5bfa578ee250e2ad42e7c189b3847efafbe0d71 | be09bcba95b92440790058932a3e27da25e04aaf | /Medicine Inventory System 2/src/About.java | 5eedc3eb8348c7157255bb39762d35b4ad5e2f4e | [] | no_license | mavutibenson/Medicine_Inventory_project | 6bcc6a90fbf7ee4fc4de26de19fe5066d7074f63 | 68c267d2fe285b073208f52c155aa7112496aa40 | refs/heads/master | 2020-03-18T01:39:22.564419 | 2018-05-20T13:32:12 | 2018-05-20T13:32:12 | 134,152,855 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,481 | 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 Life
*/
public class About extends javax.swing.JFrame {
/**
* Creates new form About
*/
public About() {
initComponents();
this.setLocationRelativeTo(null);
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(51, 255, 204));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("Medicine Inventory System");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel2.setText("New Version1.2.3");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel3.setText("Copyright @2018");
jLabel5.setFont(new java.awt.Font("Tahoma", 2, 14)); // NOI18N
jLabel5.setText("By Benson Mavuti");
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel6.setText("Contact-");
jLabel7.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel7.setText("Facebook");
jLabel8.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel8.setText("mavutibenson@gmail.com");
jLabel9.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel9.setText("benaa magan");
jLabel10.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel10.setText("Mobile No-");
jLabel11.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel11.setText("0718367709");
jLabel12.setIcon(new javax.swing.ImageIcon("C:\\Users\\Life\\Documents\\NetBeansProjects\\Medicine Inventory System 2\\src\\images\\bn.PNG")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(22, 22, 22)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 226, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(111, 174, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGap(77, 77, 77)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGap(39, 39, 39)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2))))
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(18, 18, 18)
.addComponent(jLabel9))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(jLabel10))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel11)
.addComponent(jLabel8))))
.addContainerGap())))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(47, 47, 47)
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(18, 18, 18)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel3)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(jLabel11))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(jLabel9))))
.addContainerGap(30, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(About.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new About().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
// End of variables declaration//GEN-END:variables
}
| [
"mavutibenson@gmail.com"
] | mavutibenson@gmail.com |
49264ed2aca8c533ad395b983a349c02d692d8c3 | 13ac75e91402706e2e45777ce963635f823d629f | /src/compile/xap/lui/compile/ca/jdt/core/dom/ArrayInitializer.java | 1b4020fae4054356eaf3569530912ac803dca661 | [] | no_license | gufanyi/wdp | 86085600062e6d42adcacaf46968854c8632ead1 | 9f69f798b799ab258ed57febad10495a65574c9a | refs/heads/master | 2021-01-10T10:59:49.283794 | 2015-12-17T15:33:23 | 2015-12-17T15:33:23 | 47,962,667 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,455 | java | /*******************************************************************************
* Copyright (c) 2000, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package xap.lui.compile.ca.jdt.core.dom;
import java.util.ArrayList;
import java.util.List;
/**
* Array initializer AST node type.
*
* <pre>
* ArrayInitializer:
* <b>{</b> [ Expression { <b>,</b> Expression} [ <b>,</b> ]] <b>}</b>
* </pre>
*
* @since 2.0
* @noinstantiate This class is not intended to be instantiated by clients.
*/
public class ArrayInitializer extends Expression {
/**
* The "expressions" structural property of this node type.
* @since 3.0
*/
public static final ChildListPropertyDescriptor EXPRESSIONS_PROPERTY =
new ChildListPropertyDescriptor(ArrayInitializer.class, "expressions", Expression.class, CYCLE_RISK); //$NON-NLS-1$
/**
* A list of property descriptors (element type:
* {@link StructuralPropertyDescriptor}),
* or null if uninitialized.
*/
private static final List PROPERTY_DESCRIPTORS;
static {
List properyList = new ArrayList(2);
createPropertyList(ArrayInitializer.class, properyList);
addProperty(EXPRESSIONS_PROPERTY, properyList);
PROPERTY_DESCRIPTORS = reapPropertyList(properyList);
}
/**
* Returns a list of structural property descriptors for this node type.
* Clients must not modify the result.
*
* @param apiLevel the API level; one of the
* <code>AST.JLS*</code> constants
* @return a list of property descriptors (element type:
* {@link StructuralPropertyDescriptor})
* @since 3.0
*/
public static List propertyDescriptors(int apiLevel) {
return PROPERTY_DESCRIPTORS;
}
/**
* The list of expressions (element type:
* <code>Expression</code>). Defaults to an empty list.
*/
private ASTNode.NodeList expressions =
new ASTNode.NodeList(EXPRESSIONS_PROPERTY);
/**
* Creates a new AST node for an array initializer owned by the
* given AST. By default, the list of expressions is empty.
*
* @param ast the AST that is to own this node
*/
ArrayInitializer(AST ast) {
super(ast);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
final List internalStructuralPropertiesForType(int apiLevel) {
return propertyDescriptors(apiLevel);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
final List internalGetChildListProperty(ChildListPropertyDescriptor property) {
if (property == EXPRESSIONS_PROPERTY) {
return expressions();
}
// allow default implementation to flag the error
return super.internalGetChildListProperty(property);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
final int getNodeType0() {
return ARRAY_INITIALIZER;
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
ASTNode clone0(AST target) {
ArrayInitializer result = new ArrayInitializer(target);
result.setSourceRange(this.getStartPosition(), this.getLength());
result.expressions().addAll(ASTNode.copySubtrees(target, expressions()));
return result;
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
final boolean subtreeMatch0(ASTMatcher matcher, Object other) {
// dispatch to correct overloaded match method
return matcher.match(this, other);
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
void accept0(ASTVisitor visitor) {
boolean visitChildren = visitor.visit(this);
if (visitChildren) {
acceptChildren(visitor, this.expressions);
}
visitor.endVisit(this);
}
/**
* Returns the live ordered list of expressions in this array initializer.
*
* @return the live list of expressions
* (element type: <code>Expression</code>)
*/
public List expressions() {
return this.expressions;
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
int memSize() {
return BASE_NODE_SIZE + 1 * 4;
}
/* (omit javadoc for this method)
* Method declared on ASTNode.
*/
int treeSize() {
return memSize() + this.expressions.listSize();
}
}
| [
"303240304@qq.com"
] | 303240304@qq.com |
2fd1e0e52a42aaabc538c785bf25f3002de4b133 | f411878b37ac675e4da77b53e41e0c93858ff124 | /app/src/main/java/org/techtown/GmanService/FirstToMain/MaintoEnd/Special/DiaryFrag.java | f60b8131593791097743dc6889b43485286cde4f | [] | no_license | qjsqjsaos/SmokeApp_PortFolio | fca4450aa58f1146f3a14999b6218a5a431b2d81 | e9ec63df6f817f90219012627e5c199fdc0748e9 | refs/heads/master | 2023-03-31T16:16:55.514333 | 2021-04-05T13:06:19 | 2021-04-05T13:06:29 | 354,696,266 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,246 | java | package org.techtown.GmanService.FirstToMain.MaintoEnd.Special;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import android.content.Intent;
import android.graphics.Outline;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import org.techtown.GmanService.FirstToMain.R;
public class DiaryFrag extends Fragment {
public static ImageView diaryImage; //일기 이미지뷰
public static TextView diaryText; //일기 제목
public static LinearLayout diaryFrag; //다이어리 프래그
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.diary_frag, container, false);
diaryImage = view.findViewById(R.id.diaryImage);
diaryText = view.findViewById(R.id.diaryText);
diaryFrag = view.findViewById(R.id.diaryFrag);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
diaryImage.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
outline.setRoundRect(0,0, view.getWidth(), view.getHeight()+200, 40);
}
});
diaryImage.setClipToOutline(true);
}
viewDiary(); //다이어리 보기
return view;
}
private void viewDiary() {
diaryFrag.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), ViewDiary.class);
intent.putExtra("title", Diary.viewtitle); //제목
intent.putExtra("mainText", Diary.viewMaintText); //본문
intent.putExtra("saveDate", Diary.dbDate); //날짜
startActivity(intent); //ViewDiary로 보내기
}
});
}
}
| [
"merrygoaround0726@gmail.com"
] | merrygoaround0726@gmail.com |
51fba1ca71066f4bd368f50077a5498c960ce146 | 758f786937a7b3f089dbdc46f8523347d45c7d91 | /baselib/src/main/java/com/chao/baselib/base/adapter/ILayoutManager.java | 4b601793b0a3c1f361a9304456ac9ad5a1c55b14 | [] | no_license | zhangzhichaolove/BaseUtil | 5dffe045470882fbb93c9d9269a697ca7980294f | 02cc5dc73dafea0a73cb765829d185de4c283f24 | refs/heads/master | 2021-01-01T20:07:59.812909 | 2017-08-07T01:25:13 | 2017-08-07T01:25:13 | 98,771,721 | 2 | 1 | null | 2017-07-31T06:54:09 | 2017-07-30T03:07:15 | Java | UTF-8 | Java | false | false | 200 | java | package com.chao.baselib.base.adapter;
import android.support.v7.widget.RecyclerView;
interface ILayoutManager {
boolean hasLayoutManager();
RecyclerView.LayoutManager getLayoutManager();
} | [
"zhangzhichaolove@vip.qq.com"
] | zhangzhichaolove@vip.qq.com |
46e7b1fa1d768df700572b8de57ff4ec211be86c | c87b8e9f35beec993d44b55358ef60332446dc69 | /app/src/main/java/com/example/safalcrm/networkResponse/RecentMemberListResponce.java | 9f492648eb68b76297b10e5ea8ab868d4df71bdd | [] | no_license | Harry7864/SafalCRMDATANOTES | 4b000484327af98d68cd7fddeb46a2348b082884 | 01ed7d8e237416131da84bbb8e67f82a59885ecb | refs/heads/master | 2023-01-06T19:57:15.165138 | 2020-11-03T08:07:12 | 2020-11-03T08:07:12 | 309,367,593 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,472 | java | package com.example.safalcrm.networkResponse;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.io.Serializable;
import java.util.List;
public class RecentMemberListResponce implements Serializable {
@SerializedName("member")
@Expose
private List<Member> member = null;
@SerializedName("message")
@Expose
private String message;
@SerializedName("status")
@Expose
private String status;
public List<Member> getMember() {
return member;
}
public void setMember(List<Member> member) {
this.member = member;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public class Member {
@SerializedName("chat_id")
@Expose
private String chatId;
@SerializedName("msg_data")
@Expose
private String msgData;
@SerializedName("msg_date")
@Expose
private String msgDate;
@SerializedName("flag")
@Expose
private String flag;
@SerializedName("member_size")
@Expose
private String memberSize;
@SerializedName("user_id")
@Expose
private String userId;
@SerializedName("user_full_name")
@Expose
private String userFullName;
@SerializedName("user_first_name")
@Expose
private String userFirstName;
@SerializedName("user_last_name")
@Expose
private String userLastName;
@SerializedName("gender")
@Expose
private String gender;
@SerializedName("user_mobile")
@Expose
private String userMobile;
@SerializedName("public_mobile")
@Expose
private String publicMobile;
@SerializedName("member_date_of_birth")
@Expose
private String memberDateOfBirth;
@SerializedName("alt_mobile")
@Expose
private String altMobile;
@SerializedName("user_profile_pic")
@Expose
private String userProfilePic;
@SerializedName("chatCount")
@Expose
private String chatCount;
private final static long serialVersionUID = 157247173676584967L;
public String getChatId() {
return chatId;
}
public void setChatId(String chatId) {
this.chatId = chatId;
}
public String getMsgData() {
return msgData;
}
public void setMsgData(String msgData) {
this.msgData = msgData;
}
public String getMsgDate() {
return msgDate;
}
public void setMsgDate(String msgDate) {
this.msgDate = msgDate;
}
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getMemberSize() {
return memberSize;
}
public void setMemberSize(String memberSize) {
this.memberSize = memberSize;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getUserFullName() {
return userFullName;
}
public void setUserFullName(String userFullName) {
this.userFullName = userFullName;
}
public String getUserFirstName() {
return userFirstName;
}
public void setUserFirstName(String userFirstName) {
this.userFirstName = userFirstName;
}
public String getUserLastName() {
return userLastName;
}
public void setUserLastName(String userLastName) {
this.userLastName = userLastName;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getUserMobile() {
return userMobile;
}
public void setUserMobile(String userMobile) {
this.userMobile = userMobile;
}
public String getPublicMobile() {
return publicMobile;
}
public void setPublicMobile(String publicMobile) {
this.publicMobile = publicMobile;
}
public String getMemberDateOfBirth() {
return memberDateOfBirth;
}
public void setMemberDateOfBirth(String memberDateOfBirth) {
this.memberDateOfBirth = memberDateOfBirth;
}
public String getAltMobile() {
return altMobile;
}
public void setAltMobile(String altMobile) {
this.altMobile = altMobile;
}
public String getUserProfilePic() {
return userProfilePic;
}
public void setUserProfilePic(String userProfilePic) {
this.userProfilePic = userProfilePic;
}
public String getChatCount() {
return chatCount;
}
public void setChatCount(String chatCount) {
this.chatCount = chatCount;
}
}
}
| [
"yharendra7864@gmail.com"
] | yharendra7864@gmail.com |
68b27489055accca84f16779a73f7ca772dc7be0 | b2392b34dbd89246960b92dc15fe96770b73df9b | /trade/src/main/java/com/jhcz/trade/account/biz/service/UserService.java | 32ee4a8c44482b903b47a07fa5e5868a3be9b2f2 | [] | no_license | 859162000/jhcztech | 6db0366592a36f8f020ff3e7c83fc939876f9b76 | 4e2c27aa8c997913d00f181818915205908a7603 | refs/heads/master | 2021-06-07T07:36:17.144596 | 2016-07-28T19:12:15 | 2016-07-28T19:12:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,423 | java | package com.jhcz.trade.account.biz.service;
import java.util.Map;
import com.jhcz.trade.account.biz.bean.UserInfo;
import com.jhcz.trade.common.base.DataRow;
/**
* 描述:用户用关
* <br/>版权: Copyright (c) 2009
* <br/>公司:
* <br/>作者:
* <br/>版本: 1.0
* <br/>日期: 2016-3-15
* <br/>时间: 上午10:14:53
*/
public interface UserService
{
/**
* 验证手机号是否注册
* @return
* @throws Exception
*/
public boolean checkMobileIsRegist(String mobile,String custNo,String custType,boolean isPeoReg,boolean isActAndNoMod) throws Exception;
/**
* 注册
* @param param
* @return
*/
public void register(Map param) throws Exception;
/**
* 保存密码
* @param param
* @throws Exception
*/
public void savePassword(Map param) throws Exception;
/**
* 重置密码
* @param param
* @throws Exception
*/
public void resetPassword(DataRow param) throws Exception;
/**
* 生成客户号
* @return
*/
public String generateCustNo() throws Exception;
/**
* 通过登录ID获取用户信息
* @param loginId
* @return
* @throws Exception
*/
public UserInfo getUserBaseInfoByLoginId(String loginId) throws Exception;
/**
* 用户登录
* @param loginId
* @param password
* @return
* @throws Exception
*/
public Map userLogin(UserInfo user,String loginId,String password,String pwdType) throws Exception;
}
| [
"285206405@qq.com"
] | 285206405@qq.com |
f2740e41ab53cee9bebfd9bdc13c417017c02c78 | c0de98f47cca84850323f058cec25ed738cf04b3 | /src/CreateDictionary.java | 6febc7115a6973e13f58d006a56dac8ef6ab03ae | [] | no_license | stani1940/Dictionary_Eng_Bg | 6c441828ef93c247a07ee49dc56b0e055b62f5b7 | 4089d1d2d7af16d4f51adda7c29703bdf0730ca6 | refs/heads/master | 2020-04-16T07:24:23.396672 | 2019-01-31T16:51:07 | 2019-01-31T16:51:07 | 165,381,531 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,699 | java | import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.Writer;
import java.util.*;
import javax.swing.Icon;
import javax.swing.ImageIcon;
public class CreateDictionary extends JFrame {
JTextField textField;
JTextArea textArea;
JButton translateButton;
JButton clearButton;
JButton addButton;
JLabel labelEng;
JLabel labelBg;
JLabel labelLeftarrow;
JLabel labelRightarrow;
JFrame frame;
JPanel panel;
Icon icon1;
Icon icon2;
Icon icon3;
Icon icon4;
public CreateDictionary() {
drawAndshowGui();
translator();
clearArea();
}
public void drawAndshowGui() {
frame = new JFrame("Eng-BG Dictionary Преводач");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
panel = new JPanel();
panel.setLayout(null);
panel.setBackground(Color.blue);
textField = new JTextField(25);
textField.setBounds(20, 20, 600, 100);
textField.setBorder(BorderFactory.createLineBorder(Color.black, 1, true));
textField.setFont(new Font("Calibri", Font.BOLD, 36));
translateButton = new JButton("Преведи ");
translateButton.setFont(new Font("Calibri", Font.BOLD, 24));
translateButton.setBounds(20, 125, 150, 100);
translateButton.setBackground(Color.gray);
clearButton = new JButton("Изчисти ");
clearButton.setFont(new Font("Calibri", Font.BOLD, 24));
clearButton.setBounds(250, 125, 150, 100);
clearButton.setBackground(Color.gray);
addButton = new JButton("Въведи ");
//UIManager.put("Button.font", "Calibri");
addButton.setFont(new Font("Calibri", Font.BOLD, 24));
addButton.setBounds(470, 125, 150, 100);
addButton.setBackground(Color.GRAY);
textArea = new JTextArea();
textArea.setRows(2);
textArea.setBounds(20, 230, 600, 100);
textArea.setFont(new Font("Serif", Font.ITALIC, 36));
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
icon1 = new ImageIcon("src/eng_flag.png");
labelEng = new JLabel(icon1);
labelEng.setBounds(0, 340, 300, 150);
icon2 = new ImageIcon("src/flag_bg.png");
labelBg = new JLabel(icon2);
labelBg.setBounds(350, 310, 300, 200);
icon3 = new ImageIcon("src/arrow_left.png");
labelLeftarrow = new JLabel(icon3);
labelLeftarrow.setBounds(240, 345, 150, 150);
icon4 = new ImageIcon("src/arrow_right.png");
labelRightarrow = new JLabel(icon4);
labelRightarrow.setBounds(240, 345, 150, 150);
panel.add(textField);
panel.add(translateButton);
panel.add(clearButton);
panel.add(addButton);
panel.add(textArea);
frame.getContentPane().add(panel);
frame.setSize(650, 650);
frame.setResizable(true);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
public void translator() {
translateButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String text = textField.getText().trim();
try {
HashMap<String, String> map = generateDict();
Set<Map.Entry<String, String>> set = map.entrySet();
if ((text != null) && (!text.isEmpty())) {
char text1 = text.charAt(0);
addLanguageoption(isCyrillic(text1));
if (!isCyrillic(text1) && !map.containsKey(text)) {
JOptionPane.showMessageDialog(frame, "" + "The word is missing Please click button add");
addWords(map);
}
if (isCyrillic(text1) && !map.containsValue(text)) {
JOptionPane.showMessageDialog(frame, "" + "Думата липсва в речника Моля натиснете бутона Въведи");
addWords(map);
}
for (String s : text.split(" ")) {
for (Map.Entry<String, String> me : set) {
if (s.equalsIgnoreCase(me.getKey())) {
text = me.getValue() + " ";
} else if (s.equalsIgnoreCase(me.getValue())) {
text = me.getKey() + " ";
}
}
}
} else {
JOptionPane.showMessageDialog(frame, "" + "Моля въведете дума");
}
} catch (Exception e1) {
e1.printStackTrace();
}
textArea.append(text);
textField.selectAll();
textArea.setCaretPosition(textArea.getDocument().getLength());
}
});
}
public void clearArea() {
clearButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
textArea.setText("");
textArea.setText(null);
panel.remove(labelBg);
panel.remove(labelEng);
panel.remove(labelLeftarrow);
panel.remove(labelRightarrow);
panel.revalidate();
panel.repaint();
}
});
}
public void addLanguageoption(boolean languageOption) {
if (languageOption) {
panel.add(labelBg);
panel.add(labelLeftarrow);
panel.add(labelEng);
} else {
panel.add(labelEng);
panel.add(labelRightarrow);
panel.add(labelBg);
}
frame.setVisible(true);
}
public void addWords(HashMap<String, String> map) {
Set<Map.Entry<String, String>> set = map.entrySet();
addButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String text = textField.getText().trim();
String text2 = textArea.getText().trim();
map.put(text, text2);
//System.out.println(Arrays.asList(map));
saveTofile();
}
public void saveTofile() {
Writer writer = null;
try {
writer = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(new File("src/test.txt"))));
} catch (FileNotFoundException e1) {
e1.printStackTrace();
}
Writer finalWriter = writer;
map.forEach((key, value) -> {
try {
finalWriter.write(key + " " + value + System.lineSeparator());
} catch (IOException e1) {
e1.printStackTrace();
}
});
try {
writer.flush();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
writer.close();
} catch (IOException e1) {
e1.printStackTrace();
}
}
});
}
static boolean isCyrillic(char text1) {
return Character.UnicodeBlock.CYRILLIC.equals(Character.UnicodeBlock.of(text1));
}
static HashMap<String, String> generateDict() throws Exception {
File file = new File("src/test.txt");
HashMap<String, String> map = new HashMap<String, String>();
String line;
BufferedReader reader = new BufferedReader(new FileReader(file));
while ((line = reader.readLine()) != null) {
String[] parts = line.split(" ", 2);
if (parts.length >= 2) {
String key = parts[0];
String value = parts[1];
map.put(key, value);
}
//reader.close();
}
return map;
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
new CreateDictionary();
}
});
}
} | [
"stanislav1940@abv.bg"
] | stanislav1940@abv.bg |
b6ed91345ce8f6fbc6a6999c831d003a1a9fd294 | c3f8c341e1eb625af7c0eeda01da5599ecf8d10a | /springboot-backend/src/main/java/com/example/springboot/dto/SeekerDTO.java | a14adaa4d248c5bd25fd20a27a420a9827462372 | [] | no_license | ArushiSoni/CurbTheVirus | a3d81e03d99030f2ab0c7028e6209fdeb354724b | 4904604c817f62fb92b3cf81107dc1dbf80c9acd | refs/heads/main | 2023-03-31T12:33:59.494955 | 2021-04-12T05:09:24 | 2021-04-12T05:09:24 | 352,272,285 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,647 | java | package com.example.springboot.dto;
import java.time.LocalDate;
import com.example.springboot.model.Person;
public class SeekerDTO {
private String firstName;
private String lastName;
private String phoneNumber;
private LocalDate registrationDate;
private String bloodGroup;
private Integer age;
private Integer labConfirmedCovid;
private LocalDate testDate;
private String stateName;
private Integer seekingRightNow;
private String email;
private String password;
private Person person;
public SeekerDTO() {
}
public SeekerDTO(String firstName, String lastName, String phoneNumber, String bloodGroup, Integer age,
Integer labConfirmedCovid, LocalDate testDate, String stateName, Integer seekingRightNow, String email,
Person person) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.phoneNumber = phoneNumber;
this.bloodGroup = bloodGroup;
this.age = age;
this.labConfirmedCovid = labConfirmedCovid;
this.testDate = testDate;
this.stateName = stateName;
this.seekingRightNow = seekingRightNow;
this.email = email;
this.person = person;
}
public SeekerDTO(String firstName, String lastName, String phoneNumber, LocalDate registrationDate,
String bloodGroup, Integer age, Integer labConfirmedCovid, LocalDate testDate, String stateName,
Integer seekingRightNow, String email, String password, Person person) {
super();
this.firstName = firstName;
this.lastName = lastName;
this.phoneNumber = phoneNumber;
this.registrationDate = registrationDate;
this.bloodGroup = bloodGroup;
this.age = age;
this.labConfirmedCovid = labConfirmedCovid;
this.testDate = testDate;
this.stateName = stateName;
this.seekingRightNow = seekingRightNow;
this.email = email;
this.password = password;
this.person = person;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public LocalDate getRegistrationDate() {
return registrationDate;
}
public void setRegistrationDate(LocalDate registrationDate) {
this.registrationDate = registrationDate;
}
public String getBloodGroup() {
return bloodGroup;
}
public void setBloodGroup(String bloodGroup) {
this.bloodGroup = bloodGroup;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
public Integer getLabConfirmedCovid() {
return labConfirmedCovid;
}
public void setLabConfirmedCovid(Integer labConfirmedCovid) {
this.labConfirmedCovid = labConfirmedCovid;
}
public LocalDate getTestDate() {
return testDate;
}
public void setTestDate(LocalDate testDate) {
this.testDate = testDate;
}
public String getStateName() {
return stateName;
}
public void setStateName(String stateName) {
this.stateName = stateName;
}
public Integer getSeekingRightNow() {
return seekingRightNow;
}
public void setSeekingRightNow(Integer seekingRightNow) {
this.seekingRightNow = seekingRightNow;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Person getPerson() {
return person;
}
public void setPerson(Person person) {
this.person = person;
}
}
| [
"arushisoni01@gmail.com"
] | arushisoni01@gmail.com |
916254bba0055a1c7f87a50122871cbe8b4b4069 | 2c69695e5ec26c1d0e31f24a60b23073de06c40c | /android/app/src/main/java/com/xnew_app_4_dev_19922/MainApplication.java | 651166b7b19fde0e09647af22f629519918a414d | [] | no_license | crowdbotics-apps/xnew-app-4-dev-19922 | 9bd199e67745c32de1963a8a5200b6c5e1a91ca8 | 888f5b9701605c1c802bd3658ed89baa99dbb825 | refs/heads/master | 2023-03-23T12:39:25.349366 | 2021-02-26T17:29:01 | 2021-02-26T17:29:01 | 342,649,270 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,697 | java | package com.xnew_app_4_dev_19922;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost =
new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages;
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}
/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.rndiffapp.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
| [
"team@crowdbotics.com"
] | team@crowdbotics.com |
9ab5bc3da502a1056350df3418ae84067fbfccbe | 176035891fc6a24f83e88ce404a42fced1bd1f72 | /src/main/java/com/shop/controller/AdminController.java | d1868994af909b240cb3c895d4783fbbb571d015 | [] | no_license | wang751757854/online_shop | 311627f3b4f95a3e559d2a185effc96651d18918 | b08e269fd8f8c196b21c25c5c6490120d0eeb85a | refs/heads/master | 2021-01-19T13:19:46.138863 | 2017-03-24T11:54:18 | 2017-03-24T11:54:18 | 82,385,096 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 6,943 | java | package com.shop.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.shop.entity.Admin;
import com.shop.entity.Order;
import com.shop.entity.Shop;
import com.shop.entity.Talk;
import com.shop.entity.User;
import com.shop.service.AdminService;
import com.shop.service.OrderService;
import com.shop.service.ShopService;
import com.shop.service.TalkService;
import com.shop.service.UserService;
@Controller
@RequestMapping("/admin")
public class AdminController {
@Autowired
private Admin admin;
@Autowired
private UserService userService;
@Autowired
private ShopService shopService;
@Autowired
private OrderService orderService;
@Autowired
private TalkService talkService;
@Autowired
private AdminService adminservice;
Logger log = Logger.getLogger(UserController.class);
// 管理员登录
@RequestMapping("alogin")
public String alogin(@RequestParam("aName") String aName,
@RequestParam("aPwd") String aPwd,
HttpSession session ){
Admin adminInfo = adminservice.alogin(aName, aPwd);
if(adminInfo!=null){
session.setAttribute("adminInfo",adminInfo);
return "admin/index";
}else{
return "404";
}
}
// 注销
@RequestMapping("alogout")
public String alogout(HttpSession session){
session.removeAttribute("adminInfo");
return "redirect:../index.jsp";
}
// 查看所有用户
@RequestMapping("orderUserInfo")
public String orderUserInfo(HttpServletRequest request){
List<User> alluser = userService.allUser();
request.setAttribute("alluser",alluser);
return "admin/lookUserInfo";
}
// 遍历所有商品
@RequestMapping("orderShopInfo")
public String orderShopInfo(HttpServletRequest request){
List<Shop> allshop = shopService.showAllShop();
request.setAttribute("allshop",allshop);
return "admin/lookShopInfo";
}
// 遍历所有订单
@RequestMapping("orderOrderInfo")
public String orderOrderInfo(HttpServletRequest request){
List<Order> allOrder = orderService.allOrder();
request.setAttribute("allorder",allOrder);
return "admin/lookOrderInfo";
}
// 遍历所有评价
@RequestMapping("orderTalkInfo")
public String orderTalkInfo(HttpServletRequest request){
List<Talk> alltalk = talkService.allTalk();
request.setAttribute("alltalk",alltalk);
return "admin/lookTalkInfo";
}
// 修改用户信息(页面)
@RequestMapping("editUserInfo")
public String editUserInfo(@RequestParam("uId") Integer uId,HttpServletRequest request){
User u = userService.userinfo(uId);
log.info("要修改的用户信息"+u);
request.setAttribute("userin",u);
return "admin/editUserInfo";
}
// 修改用户信息(Controller)
@RequestMapping("updateUserfo")
public String updateUserfo(User u,HttpServletRequest request){
this.userService.updateUser(u);
List<User> alluser = userService.allUser();
request.setAttribute("alluser",alluser);
return "admin/lookUserInfo";
}
// 修改商品信息(页面)
@RequestMapping("editShopInfo")
public String editShopInfo(@RequestParam("sId") Integer sId,HttpServletRequest request){
Shop allshop = shopService.lookShop(sId);
request.setAttribute("allshop",allshop);
return "admin/editShopInfo";
}
// 修改商品信息(Controller)
@RequestMapping("updateShopfo")
public String updateShopfo(Shop shop,HttpServletRequest request){
this.shopService.EditShop(shop);
return "admin/lookShopInfo";
}
// 删除商品
@RequestMapping("deleteShopInfo")
public String deleteShopInfo(@RequestParam("sId") Integer sId,HttpServletRequest request){
this.shopService.deleteShopInfo(sId);
return "admin/lookShopInfo";
}
// 查找商品
@RequestMapping("searchShop")
public String searchShop(@RequestParam("sName") String sName,HttpServletRequest request){
List<Shop> shop = this.shopService.searchShop(sName);
request.setAttribute("searchShop",shop);
return "admin/lookyoursearch";
}
// 查找用户
@RequestMapping("searchUser")
public String searchUser(@RequestParam("uName") String uName,HttpServletRequest request){
List<User> user = this.userService.searchUser(uName);
request.setAttribute("searchUser",user);
return "admin/looksearchuser";
}
// 删除评论
@RequestMapping("deleteTalkInfo")
public String deleteTalkInfo(@RequestParam("tId") Integer tId){
this.talkService.deleteTalkInfo(tId);
return "admin/lookTalkInfo";
}
// 查看轮播图(s_style=1)
@RequestMapping("looklunbo")
public String looklunbo(){
return "admin/looklunbo";
}
// 取消轮播图(s_style=0)
@RequestMapping("editlunboInfo")
public String editlunboInfo(@RequestParam("sId") Integer sId,HttpSession session){
this.shopService.exitlunbo(sId);
List<Shop> lunbo = shopService.lunbo();
session.setAttribute("lunbo",lunbo);
return "admin/looklunbo";
}
// 设置轮播图
@RequestMapping("usedTolunbo")
public String usedTolunbo(@RequestParam("sId") Integer sId,HttpSession session){
this.shopService.usedTolunbo(sId);
List<Shop> lunbo = shopService.lunbo();
session.setAttribute("lunbo",lunbo);
return "admin/lookShopInfo";
}
// 查看推荐
@RequestMapping("lookgiveshop")
public String lookgiveshop(){
return "admin/lookgiveshop";
}
// 取消推荐
@RequestMapping("editGiveInfo")
public String editGiveInfo(@RequestParam("sId") Integer sId,HttpSession session){
this.shopService.exitlunbo(sId);
List<Shop> giveshop = shopService.lunbo();
session.setAttribute("giveshop",giveshop);
return "admin/lookgiveshop";
}
// 设置推荐
@RequestMapping("usedTogive")
public String usedTogive(@RequestParam("sId") Integer sId,HttpSession session){
this.shopService.usedToGive(sId);
List<Shop> giveshop = shopService.giveShop();
session.setAttribute("giveshop",giveshop);
return "admin/lookgiveshop";
}
// 检查密码
@RequestMapping("checkpwd")
@ResponseBody
public Map<String,String> checkpwd(@RequestParam("aName") String aName,@RequestParam("aPwd") String aPwd){
Map<String, String> modelMap = new HashMap<String, String>();
Admin adminInfo = adminservice.alogin(aName, aPwd);
if(adminInfo!=null){
modelMap.put("msg","验证通过");
}else{
modelMap.put("msg","密码错误");
}
return modelMap;
}
// 修改密码
@RequestMapping("changepwd")
public String changepwd(Admin admin){
this.adminservice.changepwd(admin);
return "redirect:../index.jsp";
}
}
| [
"deathguidao@163.com"
] | deathguidao@163.com |
45dc4a40ebec86473e59b868628b2552f6c39882 | a94507270b06b0b2bdf99b3ca492e539d09e035f | /src/wizard/Constants.java | 9b91dfb9ed820b43c9a5f570fa6add35be197275 | [] | no_license | bornskilled200/freshlysqueezed | 395ced228fa2337b764c9152c3ab7309b513ea88 | 4d0985ab93eb6dbdf1b86d11579f76174cc6386c | refs/heads/master | 2020-04-05T22:57:01.404018 | 2013-05-16T08:18:09 | 2013-05-16T08:18:09 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package wizard;
import com.badlogic.gdx.Input;
/**
* Change this for per character and have it so it changeable
* User: David Park
* Date: 2/25/13
* Time: 10:46 PM
* To change this template use File | Settings | File Templates.
*/
public interface Constants {
public final static String ASSETS_PATH = "/data/";
float GRAVITY_Y_DEFAULT = -32f;
int CONTROL_MOVE_LEFT = Input.Keys.A;
int CONTROL_MOVE_RIGHT = Input.Keys.D;
int CONTROL_JUMP = Input.Keys.W;
int CONTROL_CROUCH = Input.Keys.S;
int COMMAND_RELOAD_PLAYER = Input.Keys.NUM_4;
int COMMAND_RESTART_LEVEL = Input.Keys.NUM_1;
int COMMAND_RELOAD_LEVEL = Input.Keys.NUM_2;
}
| [
"bornskilled200@gmail.com"
] | bornskilled200@gmail.com |
6ad4eddd9ad29b4887668999a0d4c59357cda8a4 | 9f9a1cde67e7bf02f876714b66f4a24f8bbb7d54 | /hu.bme.mit.trainbenchmark.benchmark.eclipseocl/src/main/java/hu/bme/mit/trainbenchmark/benchmark/eclipseocl/EclipseOCLBenchmarkCase.java | 807556bf4de2c633951492d6f4d23c7fb3e7642a | [] | no_license | pappist/trainbenchmark | b9e742f9b798184eeb4bbfbe55cdec5aec9d9fce | 203102f9c89ba52c1fdabc56c927aac14f2eaf3b | refs/heads/master | 2021-01-21T05:43:37.055406 | 2015-08-01T11:20:18 | 2015-08-01T11:53:39 | 38,885,380 | 0 | 0 | null | 2015-07-10T14:45:35 | 2015-07-10T14:45:34 | null | UTF-8 | Java | false | false | 1,740 | java | /*******************************************************************************
* Copyright (c) 2010-2015, Benedek Izso, Gabor Szarnyas, Istvan Rath and Daniel Varro
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Benedek Izso - initial API and implementation
* Gabor Szarnyas - initial API and implementation
*******************************************************************************/
package hu.bme.mit.trainbenchmark.benchmark.eclipseocl;
import hu.bme.mit.trainbenchmark.benchmark.checker.Checker;
import hu.bme.mit.trainbenchmark.benchmark.config.BenchmarkConfig;
import hu.bme.mit.trainbenchmark.benchmark.eclipseocl.checkers.EclipseOCLChecker;
import hu.bme.mit.trainbenchmark.constants.Scenario;
import hu.bme.mit.trainbenchmark.emf.EMFDriver;
import hu.bme.mit.trainbenchmark.emf.benchmarkcases.EMFBenchmarkCase;
import hu.bme.mit.trainbenchmark.emf.matches.EMFMatch;
import hu.bme.mit.trainbenchmark.emf.transformation.EMFTransformation;
import hu.bme.mit.trainbenchmark.railway.RailwayElement;
public class EclipseOCLBenchmarkCase<T extends RailwayElement> extends EMFBenchmarkCase {
@Override
public void benchmarkInit(final BenchmarkConfig bc) throws Exception {
super.benchmarkInit(bc);
final EMFDriver emfDriver = new EMFDriver();
driver = emfDriver;
checker = (Checker<EMFMatch>) EclipseOCLChecker.newInstance(emfDriver, bc);
if (bc.getScenario() != Scenario.BATCH) {
transformation = EMFTransformation.newInstance(emfDriver, bc.getQuery(), bc.getScenario());
}
}
}
| [
"szarnyasg@gmail.com"
] | szarnyasg@gmail.com |
1761bd2e10c6770420174808307f9f840db35334 | 48c279f9fae5b390afdf6d30c4149ef81e29ee58 | /LetterCasePermutation_Again2.java | b186e8683b063cc8598a6f24720648196dc24251 | [] | no_license | alnsantosh/LeetCode | 31a6d8923b9e2a9c214d2cf7b1ee7cff0fa648e5 | b16d2a44ca2bcd463d703bb79d174210322afec4 | refs/heads/master | 2020-03-18T13:50:15.426500 | 2019-12-28T15:04:30 | 2019-12-28T15:04:30 | 134,812,512 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,719 | java | /*
784. Letter Case Permutation
https://leetcode.com/problems/letter-case-permutation/description/
Given a string S, we can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible strings we could create.
Examples:
Input: S = "a1b2"
Output: ["a1b2", "a1B2", "A1b2", "A1B2"]
Input: S = "3z4"
Output: ["3z4", "3Z4"]
Input: S = "12345"
Output: ["12345"]
Note:
S will be a string with length between 1 and 12.
S will consist only of letters or digits.
*/
class Solution {
List<String> res=new ArrayList<>();
public List<String> letterCasePermutation(String S) {
if(S==null)
return res;
logic(S,0);
return res;
}
public void logic(String S,int pos)
{
if(pos==S.length())
{
res.add(S);
return;
}
else if(S.charAt(pos)>='0' && S.charAt(pos)<='9')
logic(S,pos+1);
else
{
StringBuffer sb=new StringBuffer(S);
if(S.charAt(pos)>='a' && S.charAt(pos)<='z')
{
sb.setCharAt(pos,Character.toUpperCase(S.charAt(pos)));
}
else
{
sb.setCharAt(pos,Character.toLowerCase(S.charAt(pos)));
}
logic(S,pos+1);
logic(sb.toString(),pos+1);
}
}
}
/*
Time Complexity - O(2^n) - Looking for all the possible cases
Space Complexity - O(n*n) - The recusive stack will go to a depth equal to the length of the string So O(n). Also inside logic() function we are creating a StringBuffer sb which is of length n
*/
/*
One of the edge case
Input - ""
Output - [""]
*/
| [
"noreply@github.com"
] | noreply@github.com |
37e4e7141ca0c52a58d068383a5d0d32f2cf9047 | 22d086425a6e6f059a4cc5028eb38697c8b7e1e6 | /src/test/java/atda/LoginTest.java | a57b7410ace078a96c3455ff0f8175d5a48ed14c | [] | no_license | dijanasazdevska/SeleniumSimple-master | aabda5772d7ff95dd977b24640c7fe069a5c014a | f691f8a0cc00503f935134283df3a1d9bd96850c | refs/heads/main | 2023-04-14T14:14:14.268445 | 2021-04-18T19:22:57 | 2021-04-18T19:22:57 | 359,233,680 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,132 | java | package atda;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import po.LoginPage;
import po.ProductPage;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
public class LoginTest {
private WebDriver driver;
@BeforeTest
public void setup() {
driver = getDriver();
}
@Test
public void shouldOpen() throws InterruptedException {
LoginPage loginPage = new LoginPage(driver);
loginPage.open();
assertTrue(loginPage.isLoaded());
}
@Test
public void shouldLogin() throws InterruptedException {
LoginPage loginPage = new LoginPage(driver);
loginPage.open();
assertTrue(loginPage.isLoaded());
loginPage.login("dijanasazdevska", "ds");
assertTrue(new ProductPage(driver).isLoaded());
}
@Test
public void canNotLoginWithInvalidCredentials() throws InterruptedException {
LoginPage loginPage = new LoginPage(driver);
loginPage.open();
assertTrue(loginPage.isLoaded());
loginPage.login("dijanasazdevska", "secret");
String errorMessage = loginPage.getErrorMessage();
assertEquals(errorMessage, "Invalid user credentials exception");
}
@Test
public void canNotLoginWithEmptyUsername() throws InterruptedException {
LoginPage loginPage=new LoginPage(driver);
loginPage.open();
assertTrue(loginPage.isLoaded());
loginPage.login("","123");
String errorMessage=loginPage.getErrorMessage();
assertEquals(errorMessage,"Invalid user credentials exception");
}
private WebDriver getDriver() {
System.setProperty("webdriver.chrome.driver", "D:\\sixth semester\\Software Quality and Testing\\Homeworks\\java\\SeleniumSimple-master\\src\\main\\resources\\drivers\\chromedriver.exe");
return new ChromeDriver();
}
@AfterTest
public void teardown() {
driver.quit();
}
}
| [
"dijana.sazdevska@students.finki.ukim.mk"
] | dijana.sazdevska@students.finki.ukim.mk |
0b026ab27ee4080595eb9b16e56019c32fb8872b | b5efa839ac1ce6ff31324238895286ec874d7e30 | /src/test/java/com/naturalprogrammer/spring/lemondemo/testutil/JsonPrefixFilter.java | 7f9c21a06ef4b68072671acd8d16601cb231fee9 | [
"Apache-2.0"
] | permissive | ikane/lemon-demo | e08d3a3a94a73a7ba844c8610b2e7ed587399de6 | f6c4f2c5ab8d4060d035f0ce9837ef15f6dbf436 | refs/heads/master | 2020-05-25T20:26:51.918587 | 2017-02-10T01:43:01 | 2017-02-10T01:43:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.naturalprogrammer.spring.lemondemo.testutil;
import com.jayway.restassured.builder.ResponseBuilder;
import com.jayway.restassured.filter.Filter;
import com.jayway.restassured.filter.FilterContext;
import com.jayway.restassured.response.Response;
import com.jayway.restassured.specification.FilterableRequestSpecification;
import com.jayway.restassured.specification.FilterableResponseSpecification;
import com.naturalprogrammer.spring.lemon.LemonConfig;
//@Component
public class JsonPrefixFilter implements Filter {
@Override
public Response filter(FilterableRequestSpecification requestSpec,
FilterableResponseSpecification responseSpec, FilterContext ctx) {
final Response response = ctx.next(requestSpec, responseSpec); // Invoke the request by delegating to the next filter in the filter chain.
String responseBody = response.asString();
if (responseBody.startsWith(LemonConfig.JSON_PREFIX)) {
String updatedResponseBody = responseBody.substring(LemonConfig.JSON_PREFIX.length());
return new ResponseBuilder().clone(response).setBody(updatedResponseBody).build();
}
return response;
}
}
| [
"skpatel20@gmail.com"
] | skpatel20@gmail.com |
6cdbd6f7ccc200b2bb825fa49461d0a270e2002b | d939f2d68d1036d76b02c6dc1b7f23a0c03d0b95 | /EventManagerBackend/EventManagerJava/src/be/afelio/eventManagerJava/teamZDRR/servlets/eventManagerServlet.java | d9488ab3b599df65f3bef87875800ade09f2d3cc | [] | no_license | delphinefranquinet/eventManager | af359307f747dc8456becd68a09ac00d0934a800 | 2270d0684bf8813ef5210e7e564ab698cfd3ad06 | refs/heads/master | 2023-01-20T14:18:35.619607 | 2019-07-29T14:45:40 | 2019-07-29T14:45:40 | 199,416,918 | 0 | 0 | null | 2023-01-07T08:13:33 | 2019-07-29T09:00:55 | Java | ISO-8859-1 | Java | false | false | 3,666 | java | package be.afelio.eventManagerJava.teamZDRR.servlets;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.fasterxml.jackson.databind.ObjectMapper;
import be.afelio.eventManagerJava.teamZDRR.beans.Event;
import be.afelio.eventManagerJava.teamZDRR.impl.implementEventMangerRepository;
@WebServlet("/*")
public class eventManagerServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
protected implementEventMangerRepository repository;
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
try {
Class.forName("org.postgresql.Driver"); // charger la class (driver) postgres
String path = getServletContext().getRealPath("/WEB-INF/database.properties"); // je demande le chemin au
// contexte / il crée le
// chemin vers le fichier
Properties properties = new Properties(); // properties clé et valeurs sont des string, il est capable de
// lire les fichier qui ont un format adapté
try ( // le fichier pourrait être absent try() = closable
java.io.InputStream in = new FileInputStream(path); // objet capable de lire le fichier
) {
properties.load(in); // va aller chercher le contenu du fichier pour remplir
}
String url = properties.getProperty("database.url");
String user = properties.getProperty("database.user");
String password = properties.getProperty("database.password");
repository = new implementEventMangerRepository(user, password, url);
} catch (Exception e) {
throw new ServletException(e);
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(true);
String path = request.getPathInfo();
ObjectMapper mapper = new ObjectMapper();
if (path.startsWith("/home")) {
List<Event> events = repository.FindAllEvents();
System.out.println(events);
String json = mapper.writeValueAsString(events); // convertir en format json
setHeaders(response);
response.setContentType("application/json"); // le type du contenu est du json
response.setCharacterEncoding("UTF-8");// ce sera écrit en utf8
response.getWriter().write(json); // on écrit le json dans la réponse
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
@Override
protected void doOptions(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException { // est ce que le client a le droit de faire un post
super.doOptions(request, response);
setHeaders(response);
}
private void setHeaders(HttpServletResponse response) {
response.addHeader("Access-Control-Allow-Origin", "http://localhost:4200");
response.addHeader("Access-Control-Allow-Methods", "*");
response.addHeader("Access-Control-Allow-Credentials", "true");
response.addHeader("Access-Control-Allow-Headers", "content-type"); // pour que ca soit accepté par tous les
// browser content-type pour le headers
}
}
| [
"franquinetdelphine@hotmail.com"
] | franquinetdelphine@hotmail.com |
202d6d8fc7e4ced603a7c8416574cdf6a8a093bd | aa9b33369458499930037d2dd03a0be1e297f4ce | /8-Spring/src/main/java/cn/imaq/order/tag/CheckSessionHandler.java | 1f2ff8b5a75b6c1ef44f043c34d0d336746145b4 | [] | no_license | DeepAQ/J2EE-Course | 85876f60b5a83ed0b5bd7deb76543b43adb5bbcc | 5e224fb48d7fdc6e59d291fd0a0b0f79132635a1 | refs/heads/master | 2021-07-09T18:01:06.587469 | 2018-03-01T04:58:31 | 2018-03-01T04:58:42 | 114,913,147 | 0 | 0 | null | 2021-06-16T17:48:49 | 2017-12-20T17:23:18 | Java | UTF-8 | Java | false | false | 605 | java | package cn.imaq.order.tag;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import java.io.IOException;
public class CheckSessionHandler extends BodyTagSupport {
@Override
public int doStartTag() {
if (pageContext.getSession().getAttribute("userid") == null) {
try {
((HttpServletResponse) pageContext.getResponse()).sendRedirect("/login");
} catch (IOException e) {
e.printStackTrace();
}
}
return SKIP_BODY;
}
}
| [
"i@aq741.com"
] | i@aq741.com |
12adf6574814eaba88f1612ca9d714ce7ea7e112 | 92e966770c47495f631a0f081bf20d7f9f93f9f9 | /src/main/java/com/andreeagrosu/Main.java | 79de775bc5177b39702abacd8cbd18320f96d09d | [] | no_license | AndreeaGrosu23/Airline | f9ca668428bec753bfdd76d7e0260d62e5f3d325 | cca530e01bf419eb7eee71e6a77d0bc4197a5c72 | refs/heads/master | 2022-11-10T06:30:00.979955 | 2020-07-03T12:05:21 | 2020-07-03T12:05:21 | 276,307,677 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,444 | java | package com.andreeagrosu;
import java.util.Date;
public class Main {
public static void main (String[] args) {
System.out.println("Modeling an Airline's internal structure.");
Flight flightOne = new Flight();
System.out.println("The flight's language is " + flightOne.language);
Pilot captainOne = Pilot.createPilot("John Doe", new Date(1987-7-3), "0724546532", 5000,PilotPosition.CAPTAIN);
Pilot copilotOne = Pilot.createPilot("Joe Doe", new Date(1986-2-13), "0729697772", 4000,PilotPosition.ALL);
flightOne.addPilot(captainOne);
flightOne.addPilot(copilotOne);
FlightAttendant flightAttendantOne = new FlightAttendant("Jane Doe", new Date(1977-5-3), "0729622232", 3000);
FlightAttendant flightAttendantTwo = new FlightAttendant("Janet Doe", new Date(1989-12-13), "0729354633", 2800);
FlightAttendant flightAttendantThree = new FlightAttendant("Joanna Doe", new Date(1992-6-23), "0729697534", 3200);
flightOne.addFlightAttendant(flightAttendantOne);
flightOne.addFlightAttendant(flightAttendantTwo);
flightOne.addFlightAttendant(flightAttendantThree);
System.out.println("First flight attendant speaks: " + flightAttendantOne.getLanguage1() + ", " + flightAttendantOne.getLanguage2() + ", " + flightAttendantOne.getLanguage3() + ".");
System.out.println("Second flight attendant speaks: " + flightAttendantTwo.getLanguage1() + ", " + flightAttendantTwo.getLanguage2() + ", " + flightAttendantTwo.getLanguage3() + ".");
System.out.println("Third flight attendant speaks: " + flightAttendantThree.getLanguage1() + ", " + flightAttendantThree.getLanguage2() + ", " + flightAttendantThree.getLanguage3() + ".");
System.out.println("Team complete for flight with id " + flightOne.id);
System.out.println(flightOne.numberPassengers + " passengers on the flight");
System.out.println("Checking if flight is ready to take off...");
if (flightOne.numberPassengers>220) {
System.out.println("Too many pessengers for this flight!");
}
if (captainOne.hasCompass() && copilotOne.hasCompass()) {
System.out.println("Both pilots have compass");
} else {
System.out.println("One or both of the pilots don't have compass");
}
if (flightOne.checkLanguage(flightAttendantOne)) {
System.out.println("First flight attendant speaks the language of the flight");
} else {
System.out.println("First flight attendant doesn't speak the language of the flight");
}
if (flightOne.checkLanguage(flightAttendantTwo)) {
System.out.println("Second flight attendant speaks the language of the flight");
} else {
System.out.println("Second flight attendant doesn't speak the language of the flight");
}
if (flightOne.checkLanguage(flightAttendantThree)) {
System.out.println("Third flight attendant speaks the language of the flight");
} else {
System.out.println("Third flight attendant doesn't speak the language of the flight");
}
if (flightOne.checkIfFlightReady(flightOne.pilotsList, flightOne.flightAttendantsList)) {
System.out.println("Flight checks passed");
} else {
System.out.println("Flight checks failed");
}
}
}
| [
"andreea.grosu87@gmail.com"
] | andreea.grosu87@gmail.com |
2b027da6597c6757925115cfa135a2674de51116 | 5a09e653dc23630f6210758a668caa7e1dcd21cb | /app/src/main/java/com/rk/rxjavasamples/operators/OperatorsActivity.java | cc48a7105833f3463df0f1c5178c42129197e652 | [] | no_license | Rajakrishnanulaganathan/RxJavaSamples | 2dbb5fa241697bb137f8bcab051b3117b31e0419 | 3a62ce2421bd7df16047cf2618205d560cf79645 | refs/heads/master | 2021-03-13T04:33:40.096844 | 2020-03-11T17:35:36 | 2020-03-11T17:35:36 | 245,798,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,249 | java | package com.rk.rxjavasamples.operators;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import com.rk.rxjavasamples.R;
public class OperatorsActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_operators);
}
public void simpleOperatorsClick(View view){
startActivity(new Intent(this,SimpleActivity.class));
}
public void createOperatorsClick(View view){
startActivity(new Intent(this,CreateActivity.class));
}
public void deferOperatorsClick(View view) {
startActivity(new Intent(this,DeferActivity.class));
}
public void fromOperatorsClick(View view) {
startActivity(new Intent(this,FromActivity.class));
}
public void intervalOperatorsClick(View view) {
startActivity(new Intent(this,IntervalActivity.class));
}
public void rangeOperatorsClick(View view) {
startActivity(new Intent(this,RangeActivity.class));
}
public void repearOperatorsClick(View view) {
startActivity(new Intent(this,RepeatActivity.class));
}
public void timerOperatorsClick(View view) {
startActivity(new Intent(this,TimerlActivity.class));
}
public void bufferOperatorsClick(View view) {
startActivity(new Intent(this,BufferActivity.class));
}
public void mapOperatorsClick(View view) {
startActivity(new Intent(this,MapActivity.class));
}
public void flatmapOperatorsClick(View view) {
startActivity(new Intent(this,FlatMapActivity.class));
}
public void concatmapOperatorsClick(View view) {
startActivity(new Intent(this,ConcatMapActivity.class));
}
public void switchmapOperatorsClick(View view) {
startActivity(new Intent(this,SwitchMapActivity.class));
}
public void groupbyOperatorsClick(View view) {
startActivity(new Intent(this,GroupByActivity.class));
}
public void scanOperatorsClick(View view) {
startActivity(new Intent(this,ScanActivity.class));
}
public void debounceOperatorsClick(View view) {
startActivity(new Intent(this,DebounceActivity.class));
}
public void distinctOperatorsClick(View view) {
startActivity(new Intent(this,DistinctActivity.class));
}
public void elementsperatorsClick(View view) {
startActivity(new Intent(this,ElementAtActivity.class));
}
public void filterOperatorsClick(View view) {
startActivity(new Intent(this,FilterActivity.class));
}
public void ignoreOperatorsClick(View view) {
startActivity(new Intent(this,IgnoreElementsActivity.class));
}
public void skipOperatorsClick(View view) {
startActivity(new Intent(this,SkipActivity.class));
}
public void takeOperatorsClick(View view) {
startActivity(new Intent(this,TakeActivity.class));
}
public void combineLatestperatorsClick(View view) {
startActivity(new Intent(this,CombineLatestActivity.class));
}
public void joinOperatorsClick(View view) {
startActivity(new Intent(this,JoinActivity.class));
}
public void mergeOperatorsClick(View view) {
startActivity(new Intent(this,MergeActivity.class));
}
public void concatOperatorsClick(View view) {
startActivity(new Intent(this,ConcatActivity.class));
}
public void zipOperatorsClick(View view) {
startActivity(new Intent(this,ZipActivity.class));
}
public void publishSubjectOperatorsClick(View view) {
startActivity(new Intent(this,PublishSubjectExampleActivity.class));
}
public void replaysubjectOperatorsClick(View view) {
startActivity(new Intent(this,ReplaySubjectExampleActivity.class));
}
public void asyncsubjectOperatorsClick(View view) {
startActivity(new Intent(this,AsyncSubjectExampleActivity.class));
}
public void behavioursubjectOperatorsClick(View view) {
startActivity(new Intent(this,BehaviourSubjectExampleActivity.class));
}
}
| [
"inforajakrishnan@gmail.com"
] | inforajakrishnan@gmail.com |
4be76057cfd629e30c034580afda04fe203d444d | d9c3332a48787191258f6b486e96414f78d1d0be | /app/src/main/java/com/example/user/newbmj/Activity/SeetranscantionActivity.java | 84533e061a052bd5c1f934db6c860a99803baed8 | [] | no_license | Thakuljay/Project4A | d465fae481644c28a778dd3e4fb521f7d082f151 | 010ff26b7bd693731230e06dfdbe7af79cde6607 | refs/heads/master | 2020-05-02T20:04:10.191803 | 2019-03-28T10:16:31 | 2019-03-28T10:16:31 | 178,178,590 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,694 | java | package com.example.user.newbmj.Activity;
import android.annotation.SuppressLint;
import android.app.ActionBar;
import android.app.ActivityOptions;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Build;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import com.example.user.newbmj.BackgroundWorker.BackgroundWorker;
import com.example.user.newbmj.R;
import com.example.user.newbmj.fragment.TransectionFragment;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
public class SeetranscantionActivity extends AppCompatActivity {
private ListView lv_transection;
private ArrayList<String> exData_towallet, exData_total, exData_name_t, exData_surname_t, exData_name_r, exData_surname_r, exData_timestamp, exData_wallet_id;
private ProgressDialog progressDialog;
String profile, wallet_id_transection, money;
Context context;
Button btn_see_more;
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@SuppressLint("StaticFieldLeak")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_seetranscantion);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolBar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Transactions");
final Drawable upArrow = getResources().getDrawable(R.drawable.ic_arrow_back_white_24dp);
upArrow.setColorFilter(getResources().getColor(R.color.white), PorterDuff.Mode.SRC_ATOP);
getSupportActionBar().setHomeAsUpIndicator(upArrow);
exData_towallet = new ArrayList<String>();
exData_wallet_id = new ArrayList<String>();
exData_name_t = new ArrayList<String>();
exData_surname_t = new ArrayList<String>();
exData_name_r = new ArrayList<String>();
exData_surname_r = new ArrayList<String>();
exData_total = new ArrayList<String>();
exData_timestamp = new ArrayList<String>();
new AsyncTask<Void, Void, Void>() {
@Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(SeetranscantionActivity.this);
progressDialog.setCancelable(false);
progressDialog.setMessage("Downloading ...");
progressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
profile = BackgroundWorker.test;
try {
JSONObject jsonObject = new JSONObject(profile);
JSONArray exArray = jsonObject.getJSONArray("main");
for (int i = 0; i < exArray.length(); i++) {
JSONObject jsonObj = exArray.getJSONObject(i);
wallet_id_transection = jsonObj.getString("wallet_id");
}
} catch (JSONException e) {
e.printStackTrace();
}
try {
String wallet_id = wallet_id_transection;
String login_url = "https://telecomt108.000webhostapp.com/transection.php";
URL url = new URL(login_url);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
OutputStream outputStream = httpURLConnection.getOutputStream();
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
String post_data = URLEncoder.encode("wallet_id", "UTF-8") + "=" + URLEncoder.encode(wallet_id, "UTF-8");
bufferedWriter.write(post_data);
bufferedWriter.flush();
bufferedWriter.close();
outputStream.close();
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "iso-8859-1"));
String result = "";
String line = "";
while ((line = bufferedReader.readLine()) != null) {
result += line;
}
bufferedReader.close();
inputStream.close();
httpURLConnection.disconnect();
Log.d("JSON Result", result.toString());
JSONObject jsonObject = new JSONObject(result.toString());
JSONArray exArray = jsonObject.getJSONArray("main");
for (int i = 0; i < exArray.length(); i++) {
JSONObject jsonObj = exArray.getJSONObject(i);
exData_name_t.add(jsonObj.getString("name_t"));
exData_surname_t.add(jsonObj.getString("surname_t"));
exData_name_r.add(jsonObj.getString("name_r"));
exData_surname_r.add(jsonObj.getString("surname_r"));
exData_towallet.add(jsonObj.getString("to_wallet"));
exData_total.add(jsonObj.getString("total"));
exData_timestamp.add(jsonObj.getString("timestamp"));
exData_wallet_id.add(jsonObj.getString("from_wallet"));
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
try {
String wallet_id = wallet_id_transection;
String login_url = "https://telecomt108.000webhostapp.com/transection2.php";
URL url = new URL(login_url);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
OutputStream outputStream = httpURLConnection.getOutputStream();
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream, "UTF-8"));
String post_data = URLEncoder.encode("wallet_id", "UTF-8") + "=" + URLEncoder.encode(wallet_id, "UTF-8");
bufferedWriter.write(post_data);
bufferedWriter.flush();
bufferedWriter.close();
outputStream.close();
InputStream inputStream = httpURLConnection.getInputStream();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "iso-8859-1"));
String result = "";
String line = "";
while ((line = bufferedReader.readLine()) != null) {
result += line;
}
bufferedReader.close();
inputStream.close();
httpURLConnection.disconnect();
Log.d("JSON Result", result.toString());
JSONObject jsonObject = new JSONObject(result.toString());
JSONArray exArray = jsonObject.getJSONArray("main");
for (int i = 0; i < exArray.length(); i++) {
JSONObject jsonObj = exArray.getJSONObject(i);
money = jsonObj.getString("money");
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
ListView listView = (ListView) findViewById(R.id.listView);
CustomAdapter customAdapter = new CustomAdapter();
listView.setAdapter(customAdapter);
progressDialog.dismiss();
}
}.execute();
}
public class CustomAdapter extends BaseAdapter {
@Override
public int getCount() {
return exData_total.size();
}
@Override
public Object getItem(int i) {
return null;
}
@Override
public long getItemId(int i) {
return 0;
}
@SuppressLint({"ResourceAsColor", "ViewHolder"})
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
view = getLayoutInflater().inflate(R.layout.customlayout, null);
TextView tv_total = (TextView) view.findViewById(R.id.tv_total);
TextView tv_name = (TextView) view.findViewById(R.id.tv_name);
TextView tv_timestamp = (TextView) view.findViewById(R.id.tv_timestamp);
if (exData_towallet.get(i).isEmpty()) {
tv_total.setTextColor(Color.GREEN);
tv_name.setText("From :" + exData_wallet_id.get(i) + " - " + exData_name_r.get(i));
tv_total.setText(exData_total.get(i));
tv_timestamp.setText("Timestamp | " + exData_timestamp.get(i));
} else {
tv_total.setTextColor(Color.RED);
tv_name.setText("To :" + exData_towallet.get(i) + " - " + exData_name_t.get(i));
tv_total.setText(exData_total.get(i));
tv_timestamp.setText("Timestamp | " + exData_timestamp.get(i));
}
return view;
}
}
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
}
if (id == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
}
| [
"41799758+thakulp@users.noreply.github.com"
] | 41799758+thakulp@users.noreply.github.com |
0e0bd79592706161a9c4f228f102369e320037fc | d725a0bb0eae9ba4be4884084e82acaeedfc324c | /web-api/src/main/java/fi/evident/blogular/core/annotations/ResourceReference.java | a165307b32394d4f3b009c2bee4c089c379c914b | [
"MIT"
] | permissive | EvidentSolutions/example-blogular | c8898ef23ed5e162ce23d0e624184f2348f48a49 | 33b084e184cc5fa5cc1ccdf11746f99b26527a4c | refs/heads/master | 2021-01-17T13:49:53.125782 | 2015-06-17T08:00:37 | 2015-06-17T16:55:20 | 84,078,457 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 174 | java | package fi.evident.blogular.core.annotations;
import org.intellij.lang.annotations.Language;
@Language("spring-resource-reference")
public @interface ResourceReference {
}
| [
"juha.komulainen@evident.fi"
] | juha.komulainen@evident.fi |
c95b004c7bfc031cb061102cf647a0f66d637d21 | 4031f6c1a3e4153472d264805fadaa735d190423 | /src/main/java/org/litespring/beans/factory/xml/XmlBeanDefinitionReader.java | b19d305369dd28398c4ebad7dbf76f9a386ff440 | [] | no_license | wangjunjie92/spring | d7daa161479c6a1d315f3b0831788c583d7e23c5 | 8e1b59c478dd64c1fcc72109730160a46879257d | refs/heads/master | 2020-03-27T08:36:42.984559 | 2018-08-27T08:44:50 | 2018-08-27T08:44:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,651 | java | package org.litespring.beans.factory.xml;
import org.apache.log4j.Logger;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.litespring.aop.config.ConfigBeanDefinitionParser;
import org.litespring.beans.BeanDefinition;
import org.litespring.beans.ConstructorArgument;
import org.litespring.beans.PropertyValue;
import org.litespring.beans.factory.BeanDefinitionStoreException;
import org.litespring.beans.factory.config.RuntimeBeanReference;
import org.litespring.beans.factory.config.TypedStringValue;
import org.litespring.beans.factory.support.BeanDefinitionRegistry;
import org.litespring.beans.factory.support.GenericBeanDefinition;
import org.litespring.context.annotation.ClassPathBeanDefinitionScanner;
import org.litespring.core.io.Resource;
import org.litespring.util.StringUtils;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
public class XmlBeanDefinitionReader {
private final Logger logger = Logger.getLogger(this.getClass());
public static final String ID_ATTRIBUTE = "id";
public static final String CLASS_ATTRIBUTE = "class";
public static final String SCOPE_ATTRIBUTE = "scope";
public static final String PROPERTY_ELEMENT = "property";
public static final String REF_ATTRIBUTE = "ref";
public static final String VALUE_ATTRIBUTE = "value";
public static final String NAME_ATTRIBUTE = "name";
public static final String CONSTRUCTOR_ARG_ELEMENT = "constructor-arg";
public static final String TYPE_ATTRIBUTE = "type";
public static final String BEANS_NAMESPACE_URI = "http://www.springframework.org/schema/beans";
public static final String CONTEXT_NAMESPACE_URI = "http://www.springframework.org/schema/context";
public static final String AOP_NAMESPACE_URI = "http://www.springframework.org/schema/aop";
private static final String BASE_PACKAGE_ATTRIBUTE = "base-package";
BeanDefinitionRegistry registry;
public XmlBeanDefinitionReader(BeanDefinitionRegistry registry) {
this.registry = registry;
}
public XmlBeanDefinitionReader() {
}
public void loadBeanDefinitions(Resource resource) {
InputStream is = null;
try {
is = resource.getInputStream();
SAXReader reader = new SAXReader();
Document doc = reader.read(is);
Element rootElement = doc.getRootElement();
Iterator iter = rootElement.elementIterator();
while (iter.hasNext()) {
Element element = (Element) iter.next();
String namespaceURI = element.getNamespaceURI();
if (this.isDefaultNamespace(namespaceURI)) {
parseDefaultElement(element);
} else if (this.isContextNamespace(namespaceURI)) {
parseComponentElement(element);
} else if (this.isAOPNamespace(namespaceURI)) {
parseAOPElement(element);
}
}
} catch (Exception e) {
throw new BeanDefinitionStoreException("IOException parsing XML document from " + resource.getDescription(), e);
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
private void parseComponentElement(Element element) {
String basePackages = element.attributeValue(BASE_PACKAGE_ATTRIBUTE);
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(registry);
scanner.doScan(basePackages);
}
private void parseDefaultElement(Element element) {
String id = element.attributeValue(ID_ATTRIBUTE);
String beanClassName = element.attributeValue(CLASS_ATTRIBUTE);
BeanDefinition bd = new GenericBeanDefinition(id, beanClassName);
if (element.attribute(SCOPE_ATTRIBUTE) != null) {
bd.setScope(element.attributeValue(SCOPE_ATTRIBUTE));
}
parsePropertyElement(element, bd);
parseConstructorArgElements(element, bd);
this.registry.registerBeanDefinition(id, bd);
}
public void parseConstructorArgElements(Element element, BeanDefinition bd) {
Iterator iter = element.elementIterator(CONSTRUCTOR_ARG_ELEMENT);
while (iter.hasNext()) {
Element ele = (Element) iter.next();
parseConstructorArgElement(ele, bd);
}
}
public void parsePropertyElement(Element element, BeanDefinition bd) {
Iterator iter = element.elementIterator(PROPERTY_ELEMENT);
while (iter.hasNext()) {
Element propElem = (Element) iter.next();
String propertyName = propElem.attributeValue(NAME_ATTRIBUTE);
if (!StringUtils.hasLength(propertyName)) {
logger.fatal("Tag 'property' must have a 'name' attribute");
return;
}
Object val = parsePropertyValue(propElem, propertyName);
PropertyValue propertyValue = new PropertyValue(propertyName, val);
bd.getPropertyValues().add(propertyValue);
}
}
public void parseConstructorArgElement(Element ele, BeanDefinition bd) {
String typeAttr = ele.attributeValue(TYPE_ATTRIBUTE);
String nameAttr = ele.attributeValue(NAME_ATTRIBUTE);
Object value = parsePropertyValue(ele, null);
ConstructorArgument.ValueHolder valueHolder = new ConstructorArgument.ValueHolder(value);
if (StringUtils.hasLength(typeAttr)) {
valueHolder.setType(typeAttr);
} else if (StringUtils.hasLength(nameAttr)) {
valueHolder.setName(nameAttr);
}
bd.getConstructorArgument().addArgumentValue(valueHolder);
}
public Object parsePropertyValue(Element ele, String propertyName) {
String elementName = (propertyName != null) ?
"<property> element for property '" + propertyName + "'" :
"<constructor-arg> element";
boolean hasRefAttribute = (ele.attributeValue(REF_ATTRIBUTE) != null);
boolean hasValueAttribute = (ele.attributeValue(VALUE_ATTRIBUTE) != null);
if (hasRefAttribute) {
String refName = ele.attributeValue(REF_ATTRIBUTE);
if (!StringUtils.hasLength(refName)) {
logger.error(elementName + " contains empty 'ref' attribute");
}
RuntimeBeanReference reference = new RuntimeBeanReference(refName);
return reference;
} else if (hasValueAttribute) {
String valueName = ele.attributeValue(VALUE_ATTRIBUTE);
TypedStringValue typedStringValue = new TypedStringValue(valueName);
return typedStringValue;
} else {
throw new RuntimeException(elementName + " must specify a ref or value");
}
}
private void parseAOPElement(Element ele){
ConfigBeanDefinitionParser parser = new ConfigBeanDefinitionParser();
parser.parse(ele, this.registry);
}
public boolean isDefaultNamespace(String namespaceUri) {
return (!StringUtils.hasLength(namespaceUri) || BEANS_NAMESPACE_URI.equals(namespaceUri));
}
public boolean isContextNamespace(String namespaceUri) {
return (!StringUtils.hasLength(namespaceUri) || CONTEXT_NAMESPACE_URI.equals(namespaceUri));
}
public boolean isAOPNamespace(String namespaceUri) {
return (!StringUtils.hasLength(namespaceUri) || AOP_NAMESPACE_URI.equals(namespaceUri));
}
}
| [
"122077774@qq.com"
] | 122077774@qq.com |
dd09c3ea9dd55426f10be6eab88c15013d42e061 | 0f84c4de5bff310c05689b851e88ae6d92cc8f4c | /src/cleanCode/chapter03/function/employee/EmployeeFactoryImplmpl.java | 4d024343fa27fd100567a9194bf6d208ec04ea73 | [] | no_license | stua1125/CleanCode | 004de7c5643f063aad3005801b039141c4208740 | 73db66a55d168219a098df8330230096ad3cb255 | refs/heads/master | 2022-06-27T10:45:06.452304 | 2020-04-18T15:32:38 | 2020-04-18T15:32:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 389 | java | package cleanCode.chapter03.function.employee;
public class EmployeeFactoryImplmpl implements EmployeeFactory{
@Override
public Employee makeEmployee(EmployeeRecode r) throws InvalidEmployeeType {
// TODO Auto-generated method stub
switch (r.type) {
case "HOURLY":
return new HourlyEmp(r);
default:
throw new InvalidEmployeeType(r.type);
}
}
}
| [
"one@DESKTOP-LTI1IM5"
] | one@DESKTOP-LTI1IM5 |
b9f3b36ee9c727657603268d26674e8f5dbc2b51 | b0c3bc0197f7a21c19493176bdcf91b9c059019f | /Java/Lab1/Queue.java | 599712de554d63474593855e1d2f08b5438d8ade | [] | no_license | levishutts/Projects | 5519fcc40d0ecf0943308673d9057f74c6c9994a | d977131a5ab70c119e4229343845c5ea6ed2913a | refs/heads/master | 2021-01-19T14:46:10.399942 | 2018-08-17T18:37:38 | 2018-08-17T18:37:38 | 86,636,578 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,413 | java | public class Queue<E> {
private Node<E> head;
private Node<E> tail;
public Queue() {
// We want to initialize our Queue to be empty
// (ie) set head and tail to be null
head = null;
tail = null;
}
public void enqueue(E newData){
// Create a new node whose data is newData and whose next node is null
// Update head and tail
// Hint: Think about what's different for the first node added to the Queue
if(head == null){
head = new Node<E>(newData, tail);
tail = head;
}
else{
Node<E> oldTail = tail;
tail = new Node<E>(newData, null);
oldTail.setNext(tail);
}
}
public Node<E> dequeue(){
// Return the head of the Queue
// Update head
// Hint: The order you implement the above 2 tasks matters, so use a temporary node to hold important information
// Hint: Return null on a empty Queue
if(head == null){
return null;
}else{
Node<E> newHead = head.getNext();
Node<E> deHead = head;
head = newHead;
return deHead;
}
}
public boolean isEmpty(){
// Check if the Queue is empty
if(head == null){
return true;
}return false;
}
public void printQueue(){
// Loop through your queue and print each Node's data
Node<E> nextN = head;
System.out.print("Queue: ");
while(nextN.getNext() != null){
System.out.print(nextN.getData());
nextN = nextN.getNext();
}
System.out.println(nextN.getData());
}
} | [
"Levi Shutts"
] | Levi Shutts |
1eba5a391dc41f943c500c30cecf94ed018303e1 | bcc0dcc53134fd450064687d2f41952356819d59 | /android/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/fragment/R.java | 008328841812f4ca1a3eb76079e3a80726fdf873 | [] | no_license | rohitshampur/RNNotification | 4750f007ddc715bf1236d1b0f37f53c38af51b61 | eeca8d91c292361511aa68927e6d132626dd06c9 | refs/heads/master | 2022-12-11T06:34:48.085210 | 2020-03-04T03:32:58 | 2020-03-04T03:32:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,390 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package androidx.fragment;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f02002a;
public static final int coordinatorLayoutStyle = 0x7f020065;
public static final int font = 0x7f02007d;
public static final int fontProviderAuthority = 0x7f02007f;
public static final int fontProviderCerts = 0x7f020080;
public static final int fontProviderFetchStrategy = 0x7f020081;
public static final int fontProviderFetchTimeout = 0x7f020082;
public static final int fontProviderPackage = 0x7f020083;
public static final int fontProviderQuery = 0x7f020084;
public static final int fontStyle = 0x7f020085;
public static final int fontVariationSettings = 0x7f020086;
public static final int fontWeight = 0x7f020087;
public static final int keylines = 0x7f020099;
public static final int layout_anchor = 0x7f02009c;
public static final int layout_anchorGravity = 0x7f02009d;
public static final int layout_behavior = 0x7f02009e;
public static final int layout_dodgeInsetEdges = 0x7f02009f;
public static final int layout_insetEdge = 0x7f0200a0;
public static final int layout_keyline = 0x7f0200a1;
public static final int statusBarBackground = 0x7f0200f4;
public static final int ttcIndex = 0x7f020127;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f040048;
public static final int notification_icon_bg_color = 0x7f040049;
public static final int ripple_material_light = 0x7f040053;
public static final int secondary_text_default_material_light = 0x7f040055;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f060069;
public static final int notification_bg = 0x7f06006a;
public static final int notification_bg_low = 0x7f06006b;
public static final int notification_bg_low_normal = 0x7f06006c;
public static final int notification_bg_low_pressed = 0x7f06006d;
public static final int notification_bg_normal = 0x7f06006e;
public static final int notification_bg_normal_pressed = 0x7f06006f;
public static final int notification_icon_background = 0x7f060070;
public static final int notification_template_icon_bg = 0x7f060071;
public static final int notification_template_icon_low_bg = 0x7f060072;
public static final int notification_tile_bg = 0x7f060073;
public static final int notify_panel_notification_icon_bg = 0x7f060074;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f070013;
public static final int action_divider = 0x7f070015;
public static final int action_image = 0x7f070016;
public static final int action_text = 0x7f07001c;
public static final int actions = 0x7f07001d;
public static final int async = 0x7f070025;
public static final int blocking = 0x7f070028;
public static final int bottom = 0x7f070029;
public static final int chronometer = 0x7f070032;
public static final int end = 0x7f07003f;
public static final int forever = 0x7f07004b;
public static final int icon = 0x7f070050;
public static final int icon_group = 0x7f070051;
public static final int info = 0x7f070055;
public static final int italic = 0x7f070056;
public static final int left = 0x7f070057;
public static final int line1 = 0x7f070059;
public static final int line3 = 0x7f07005a;
public static final int none = 0x7f070061;
public static final int normal = 0x7f070062;
public static final int notification_background = 0x7f070063;
public static final int notification_main_column = 0x7f070064;
public static final int notification_main_column_container = 0x7f070065;
public static final int right = 0x7f07006b;
public static final int right_icon = 0x7f07006c;
public static final int right_side = 0x7f07006d;
public static final int start = 0x7f070090;
public static final int tag_transition_group = 0x7f070094;
public static final int tag_unhandled_key_event_manager = 0x7f070095;
public static final int tag_unhandled_key_listeners = 0x7f070096;
public static final int text = 0x7f070097;
public static final int text2 = 0x7f070098;
public static final int time = 0x7f07009b;
public static final int title = 0x7f07009c;
public static final int top = 0x7f07009f;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080007;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09001e;
public static final int notification_action_tombstone = 0x7f09001f;
public static final int notification_template_custom_big = 0x7f090020;
public static final int notification_template_icon_group = 0x7f090021;
public static final int notification_template_part_chronometer = 0x7f090022;
public static final int notification_template_part_time = 0x7f090023;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0c0076;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0d00f7;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00f8;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00f9;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00fa;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00fb;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0d016b;
public static final int Widget_Compat_NotificationActionText = 0x7f0d016c;
public static final int Widget_Support_CoordinatorLayout = 0x7f0d016d;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f02002a };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] CoordinatorLayout = { 0x7f020099, 0x7f0200f4 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f02009c, 0x7f02009d, 0x7f02009e, 0x7f02009f, 0x7f0200a0, 0x7f0200a1 };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f02007f, 0x7f020080, 0x7f020081, 0x7f020082, 0x7f020083, 0x7f020084 };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f02007d, 0x7f020085, 0x7f020086, 0x7f020087, 0x7f020127 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"thhan1306@gmail.com"
] | thhan1306@gmail.com |
53dd17be41873eb9a4c481f7c4d4948210c95765 | cd3cf25c4cf8fe7b8fbebdb2eec00b3e47c2843e | /src/main/java/com/crm/infrastructure/configuration/parsers/BranchsParser.java | e5ea1a3ba38c71a8a5a64cde8af82c144420ca09 | [] | no_license | mmaico/ddd-bouderies-example | 78395c0efdd0d44a431e78ec856b5fbedd7a21a9 | 76f3de428c191d2c2582ee4f8c2afa2fe51591c9 | refs/heads/master | 2021-01-09T20:17:49.086305 | 2016-07-08T15:05:55 | 2016-07-08T15:05:55 | 62,310,325 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,235 | java | package com.crm.infrastructure.configuration.parsers;
import com.crm.infrastructure.entity.Branch;
import com.crm.infrastructure.exceptions.InternalArchitectureException;
import com.google.common.collect.Lists;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
public class BranchsParser {
private static final String ID = "id";
private static final String NAME="name";
private static final String FILE_NAME = "/configurations/user_branch.xml";
public static List<Branch> getBranchs() {
return loadBranchs();
}
@SuppressWarnings("unchecked")
protected static List<Branch> loadBranchs() {
SAXBuilder sab = new SAXBuilder();
try {
InputStream inputStream = findFile();
Document doc = (Document) sab.build(inputStream);
Element rootElement = (Element) doc.getRootElement();
List<Branch> listBranchs = Lists.newArrayList();
List<Element> childrenRoot = rootElement.getChildren();
for (Element el : childrenRoot) {
Branch branch = convertToBranch(el);
listBranchs.add(branch);
}
return listBranchs;
} catch (JDOMException e) {
throw new InternalArchitectureException("Erro ao obter as configuracoes.", e);
} catch (IOException e) {
throw new InternalArchitectureException("Erro ao obter o arquivos de configuracoes.", e);
}
}
@SuppressWarnings("unchecked")
private static Branch convertToBranch(Element element) {
String name = element.getAttributeValue(NAME);
String id = element.getAttributeValue(ID);
Branch branch = new Branch();
branch.setId(new Long(id));
branch.setName(name);
return branch;
}
private static InputStream findFile() {
try {
return BranchsParser.class.getResourceAsStream(FILE_NAME);
} catch (Exception e) {
throw new IllegalArgumentException("Nao foi possivel encontrar o arquivo:" + FILE_NAME);
}
}
}
| [
"mmaico@gmail.com"
] | mmaico@gmail.com |
b8a94ef232a516e0a19daa4a9acbe66a6ddb94d3 | fcee00a95ae500c7a47a11926b0f76f3d6509ce5 | /src/main/java/model/CityManager.java | 4912fc2a75c6d24a824ffdb035d37976ec352f4c | [] | no_license | KryniuPL/JavaFX-Salesman | 88166431466cfe200df587499649915c7c05b8bb | 2dbb8894a9d46daafefeeee3740544ce19dd0e2d | refs/heads/master | 2020-04-10T22:31:49.337165 | 2018-05-13T18:42:43 | 2018-05-13T18:42:43 | 124,301,077 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 735 | java | package model;
import java.util.ArrayList;
public class CityManager {
private static final CityManager instance = new CityManager();
private final ArrayList<City> cities;
public static CityManager getInstance() {
return instance;
}
public CityManager() {
cities = new ArrayList<>();
}
// Holds our cities
// Adds a destination city
public void addCity(City city) {
cities.add(city);
}
// Get a city
public City getCity(int index) {
return cities.get(index);
}
// Get the number of destination cities
public int numberOfCities() {
return cities.size();
}
public void clearCities()
{
cities.clear();
}
}
| [
"krzysztof.draganfm@gmail.com"
] | krzysztof.draganfm@gmail.com |
17fd7a63841271619f471e4b7f9520fc2371d6fb | 1908edc66b5960bb7c128b4bc5857624edc5604e | /modules/store/src/main/java/com/ciandt/netshoes/store/StoreApplication.java | cff2e350b6f6705ec6e3e91fbaf89168c81c23c0 | [] | no_license | dojo-netshoes/commerce-solution | 995b0d804236cc4cb99b065cbc9fc73c477b0d64 | 72a7e31ea8adf9e2ace4cab51eb141c0c8719b24 | refs/heads/master | 2021-01-10T13:03:51.492883 | 2016-03-14T18:16:02 | 2016-03-14T18:16:02 | 53,432,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 333 | java | package com.ciandt.netshoes.store;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class StoreApplication {
public static void main(final String[] args) {
SpringApplication.run(StoreApplication.class, args);
}
}
| [
"erickpr@ciandt.com"
] | erickpr@ciandt.com |
d6781d7386a042eb81172387724224cf4208234c | 893c7d2a51fa8aef224e0b89c47560ff653a164c | /cinema/src/main/java/ru/job4j/controllers/AccountServlet.java | 7478826e20b3fc026ce620a5d2e70a6fc97fb8e1 | [
"Apache-2.0"
] | permissive | Sir-Hedgehog/job4j | f644723c0dac5382ff53eeb5db3a7183775848fb | f26b2b3a9f51910392477c53f713df638ab398b7 | refs/heads/master | 2021-06-08T12:20:15.583865 | 2020-12-19T21:17:47 | 2020-12-19T21:17:47 | 143,559,660 | 4 | 0 | Apache-2.0 | 2020-09-05T11:55:59 | 2018-08-04T20:06:56 | Java | UTF-8 | Java | false | false | 2,096 | java | package ru.job4j.controllers;
import com.google.gson.Gson;
import ru.job4j.models.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author Sir-Hedgehog (mailto:quaresma_08@mail.ru)
* @version 3.0
* @since 09.06.2020
*/
public class AccountServlet extends HttpServlet {
private final Validation validation = ValidateService.getInstance();
/**
* Метод через ajax получает данные от пользователя с целью их проверки на корректность
* @param request - запрос серверу
* @param response - ответ сервера
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("json/application");
response.setCharacterEncoding("UTF-8");
String row = request.getParameter("row");
String place = request.getParameter("place");
String username = request.getParameter("username");
String phone = request.getParameter("phone");
List<String> values = new ArrayList<>();
if (this.writeData(row, place, username, phone)) {
values.add("true");
values.add(username);
values.add(phone);
} else {
values.add("false");
}
String json = new Gson().toJson(values);
response.getWriter().write(json);
}
/**
* Проверка корректности данных и их добавление в случае успешности
* @return - успешность операции
*/
private boolean writeData(String row, String place, String username, String phone) {
int intRow = Integer.parseInt(row);
int intPlace = Integer.parseInt(place);
return validation.validateTransaction(new Hall(intRow, intPlace), new Account(username, phone));
}
}
| [
"mailto:quaresma_08@mail.ru"
] | mailto:quaresma_08@mail.ru |
e81eb1aef41ef1da4fbd71c5bd137ac097885782 | 6dda17553cfc7201f385a612a6a491599f0ae1be | /Doan-QLBH/app/src/main/java/com/qlbh/doan/adapter/KhoHangAdapter.java | 6b2e09c776ba4fcf54509014e222893b1e43a1ae | [] | no_license | phamxuanphu278/Project-DiDong2 | e6f6b01605f493de0ecb184fb759cfb896de212e | 6da468e32fbc4a6efa973e41552f8296bbf46e12 | refs/heads/master | 2022-11-25T19:01:44.856780 | 2020-08-07T14:26:00 | 2020-08-07T14:26:00 | 277,444,178 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,360 | java | package com.qlbh.doan.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.qlbh.doan.R;
import com.qlbh.doan.model.SanPham;
import java.util.List;
public class KhoHangAdapter extends ArrayAdapter<SanPham> {
public KhoHangAdapter(@NonNull Context context, int resource, @NonNull List<SanPham> objects) {
super(context, resource, objects);
}
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
if (view==null){
LayoutInflater inflater = LayoutInflater.from(getContext());
view = inflater.inflate(R.layout.list_item_khohang, null);
}
SanPham sanpham = getItem(position);
if (sanpham!=null){
TextView txtTenSP = view.findViewById(R.id.txtTenSP);
TextView txtGiaSP = view.findViewById(R.id.txtGiaSP);
TextView txtSoluongSP = view.findViewById(R.id.txtSoluong);
txtTenSP.setText(sanpham.getmTenSP());
txtGiaSP.setText(String.valueOf(sanpham.getmGiaban()) + "$");
txtSoluongSP.setText(String.valueOf(sanpham.getmSoLuong()));
}
return view;
}
}
| [
"phuphamxuan278@gmail.com"
] | phuphamxuan278@gmail.com |
ae6965670ed498f913550c0632a4f8e92e30ea68 | bb7b91d14e5f9cbf65fe3ca86faaba1d1064bae3 | /app/src/main/java/season/nfl/nflseasoncalculatorapp/fragments/TeamFragment.java | cd2073f23aa9b5b987b61fdfe522a9ea13bda99c | [] | no_license | Romojr50/NFLSeasonCalculatorApp | 8d7c6e4c0d741c9992f447463f3adf6ab06a7d42 | 6363af1e2344c705b207c31a16232a8314c179f6 | refs/heads/develop | 2021-01-01T20:14:01.614824 | 2019-08-31T18:55:03 | 2019-08-31T18:55:03 | 98,793,947 | 0 | 0 | null | 2019-08-31T19:06:10 | 2017-07-30T11:47:16 | Java | UTF-8 | Java | false | false | 15,412 | java | package season.nfl.nflseasoncalculatorapp.fragments;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ProgressBar;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import nfl.season.league.League;
import nfl.season.league.NFLTeamEnum;
import nfl.season.league.Team;
import season.nfl.nflseasoncalculatorapp.MainActivity;
import season.nfl.nflseasoncalculatorapp.R;
import season.nfl.nflseasoncalculatorapp.input.HomeAwayWinModeSpinner;
import season.nfl.nflseasoncalculatorapp.input.NeutralWinModeSpinner;
import season.nfl.nflseasoncalculatorapp.input.WinChanceEditText;
import season.nfl.nflseasoncalculatorapp.util.InputSetter;
import season.nfl.nflseasoncalculatorapp.util.MatchupTableTask;
import season.nfl.nflseasoncalculatorapp.util.MessageDisplayer;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link TeamFragment.OnFragmentInteractionListener} interface
* to handle interaction events.
* Use the {@link TeamFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class TeamFragment extends Fragment {
private League nfl;
private String selectedTeam;
private Team team;
private MatchupTableTask matchupTableTask;
public TeamFragment() {
// Required empty public constructor
}
/**
* Use this factory method to create a new instance of
* this fragment using the provided parameters.
*
* @param nfl NFL League
* @param selectedTeam Selected Team
* @return A new instance of fragment TeamFragment.
*/
public static TeamFragment newInstance(League nfl, String selectedTeam) {
TeamFragment fragment = new TeamFragment();
Bundle args = new Bundle();
args.putSerializable(MainActivity.LEAGUE_KEY, nfl);
args.putString(TeamsFragment.SELECTED_TEAM_KEY, selectedTeam);
fragment.setArguments(args);
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (getArguments() != null) {
nfl = (League) getArguments().getSerializable(MainActivity.LEAGUE_KEY);
selectedTeam = getArguments().getString(TeamsFragment.SELECTED_TEAM_KEY);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_team, container, false);
}
@Override
public void onViewCreated(View view, @Nullable final Bundle savedInstanceState) {
Activity activity = getActivity();
team = nfl.getTeam(selectedTeam);
TextView textView = (TextView) activity.findViewById(R.id.team_name);
textView.setText(selectedTeam);
setUpInputFields(activity);
setUpButtons(activity);
ProgressBar matchupProgress = (ProgressBar) activity.findViewById(R.id.matchupProgress);
matchupTableTask = new MatchupTableTask(activity, matchupProgress);
matchupTableTask.execute(team);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (!(context instanceof OnFragmentInteractionListener)) {
throw new RuntimeException(context.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
}
@Override
public void onDestroyView() {
if (matchupTableTask != null) {
matchupTableTask.cancel(true);
}
super.onDestroyView();
}
/**
* This interface must be implemented by activities that contain this
* fragment to allow an interaction in this fragment to be communicated
* to the activity and potentially other fragments contained in that
* activity.
* <p>
* See the Android Training lesson <a href=
* "http://developer.android.com/training/basics/fragments/communicating.html"
* >Communicating with Other Fragments</a> for more information.
*/
public interface OnFragmentInteractionListener {
}
private void setUpButtons(final Activity activity) {
setUpDefaultButton(activity);
setUpSaveTeamSettingsButton(activity);
setUpPowerRankingsAllButton(activity);
setUpEloRatingsAllButton(activity);
setUpHomeFieldAllButton(activity);
setUpSaveMatchupsButton(activity);
}
private void setUpDefaultButton(final Activity activity) {
final Button defaultButton = (Button) activity.findViewById(R.id.defaultButton);
defaultButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
nfl.resetTeamToDefault(selectedTeam);
setUpInputFields(activity);
setMatchupSettingsOntoMatchups(activity);
}
});
}
private void setUpSaveTeamSettingsButton(final Activity activity) {
final Button saveTeamSettingsButton = (Button) activity.findViewById(R.id.saveTeamSettings);
saveTeamSettingsButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (validateInput(activity)) {
setTeamSettingsOntoTeam(activity);
List<View> matchupCells = getAllMatchupCells(activity);
for (View matchupCell : matchupCells) {
if (matchupCell instanceof WinChanceEditText) {
WinChanceEditText winChanceEditText = (WinChanceEditText) matchupCell;
Resources resources = activity.getResources();
winChanceEditText.setTextFromMatchup(resources);
}
}
MessageDisplayer.displayMessage(activity, "Team Settings Saved to this Session");
}
}
});
}
private void setUpPowerRankingsAllButton(final Activity activity) {
final Button powerRankingsAllButton = (Button) activity.findViewById(R.id.powerRankingsAllButton);
powerRankingsAllButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setAllNeutralSpinnersToSelection(activity, R.string.power_rankings_win_mode);
}
});
}
private void setUpEloRatingsAllButton(final Activity activity) {
final Button eloRatingsAllButton = (Button) activity.findViewById(R.id.eloRatingsAllButton);
eloRatingsAllButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setAllNeutralSpinnersToSelection(activity, R.string.elo_ratings_win_mode);
}
});
}
private void setUpHomeFieldAllButton(final Activity activity) {
final Button homeFieldAllButton = (Button) activity.findViewById(R.id.homeFieldAdvantageAllButton);
homeFieldAllButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setAllHomeAwaySpinnersToSelection(activity);
}
});
}
private void setUpSaveMatchupsButton(final Activity activity) {
final Button saveMatchupsButton = (Button) activity.findViewById(R.id.saveMatchupsButton);
saveMatchupsButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setMatchupSettingsOntoMatchups(activity);
MessageDisplayer.displayMessage(activity, "Matchups Saved to this Session");
}
});
}
private boolean validateInput(Activity activity) {
boolean isValid = true;
final EditText powerRankingsInput = (EditText) activity.findViewById(R.id.powerRankingsInput);
if (!validatePowerRanking(powerRankingsInput)) {
isValid = false;
}
return isValid;
}
private boolean validatePowerRanking(EditText powerRankingsInput) {
boolean isValid = true;
int newPowerRanking = Integer.parseInt(powerRankingsInput.getText().toString());
int maxPowerRanking = NFLTeamEnum.values().length;
if (newPowerRanking < 1 || newPowerRanking > maxPowerRanking) {
powerRankingsInput.setError("Power Ranking must be between 1 and " + maxPowerRanking);
isValid = false;
}
return isValid;
}
private void setTeamSettingsOntoTeam(Activity activity) {
final EditText powerRankingsInput = (EditText) activity.findViewById(R.id.powerRankingsInput);
int oldPowerRanking = team.getPowerRanking();
int newPowerRanking = Integer.parseInt(powerRankingsInput.getText().toString());
Team teamWithNewRanking = nfl.getTeamWithPowerRanking(newPowerRanking);
if (teamWithNewRanking != null) {
String teamWithNewRankingName = teamWithNewRanking.getName();
if (!selectedTeam.equals(teamWithNewRankingName)) {
teamWithNewRanking.setPowerRanking(oldPowerRanking);
}
}
team.setPowerRanking(newPowerRanking);
final EditText eloRatingsInput = (EditText) activity.findViewById(R.id.eloRatingInput);
int newEloRating = Integer.parseInt(eloRatingsInput.getText().toString());
team.setEloRating(newEloRating);
final EditText homeFieldInput = (EditText) activity.findViewById(R.id.homeFieldInput);
int newHomeField = Integer.parseInt(homeFieldInput.getText().toString());
team.setHomeFieldAdvantage(newHomeField);
}
private void setMatchupSettingsOntoMatchups(Activity activity) {
List<View> matchupCellList = getAllMatchupCells(activity);
for (int j = 0; j < matchupCellList.size(); j++) {
View cell = matchupCellList.get(j);
if (cell instanceof NeutralWinModeSpinner) {
NeutralWinModeSpinner winModeSpinner = (NeutralWinModeSpinner) cell;
winModeSpinner.saveNeutralWinChance();
} else if (cell instanceof HomeAwayWinModeSpinner) {
HomeAwayWinModeSpinner winModeSpinner = (HomeAwayWinModeSpinner) cell;
winModeSpinner.saveHomeAwayWinChance();
}
}
}
private void setUpInputFields(final Activity activity) {
Resources resources = activity.getResources();
setUpPowerRankingsInput(activity, resources);
final EditText eloRatingsInput = (EditText) activity.findViewById(R.id.eloRatingInput);
InputSetter.setTextToInputNumber(resources, eloRatingsInput, team.getEloRating());
final EditText homeFieldInput = (EditText) activity.findViewById(R.id.homeFieldInput);
InputSetter.setTextToInputNumber(resources, homeFieldInput, team.getHomeFieldAdvantage());
}
private void setAllNeutralSpinnersToSelection(Activity activity, int stringId) {
int selectionId = getIndexOfSelectionInArray(activity, R.array.neutral_mode_array,
stringId);
List<View> matchupCells = getAllMatchupCells(activity);
for (View matchupCell : matchupCells) {
if (matchupCell instanceof NeutralWinModeSpinner) {
NeutralWinModeSpinner neutralSpinner = (NeutralWinModeSpinner) matchupCell;
neutralSpinner.setSelection(selectionId);
}
}
}
private void setAllHomeAwaySpinnersToSelection(Activity activity) {
int selectionId = getIndexOfSelectionInArray(activity, R.array.home_mode_array,
R.string.home_field_advantage_mode);
List<View> matchupCells = getAllMatchupCells(activity);
for (View matchupCell : matchupCells) {
if (matchupCell instanceof HomeAwayWinModeSpinner) {
HomeAwayWinModeSpinner homeAwaySpinner = (HomeAwayWinModeSpinner) matchupCell;
homeAwaySpinner.setSelection(selectionId);
}
}
}
private List<View> getAllMatchupCells(Activity activity) {
List<View> cellList = new ArrayList<>();
TableLayout winChanceTable = (TableLayout) activity.findViewById(R.id.matchupTable);
int numberOfRows = winChanceTable.getChildCount();
for (int i = 0; i < numberOfRows; i++) {
TableRow tableRow = (TableRow) winChanceTable.getChildAt(i);
int numberOfCells = tableRow.getChildCount();
for (int j = 0; j < numberOfCells; j++) {
View cell = tableRow.getChildAt(j);
cellList.add(cell);
}
}
return cellList;
}
private void setUpPowerRankingsInput(final Activity activity, final Resources resources) {
final EditText powerRankingsInput = (EditText) activity.findViewById(R.id.powerRankingsInput);
InputSetter.setTextToInputNumber(resources, powerRankingsInput, team.getPowerRanking());
powerRankingsInput.setOnFocusChangeListener(new View.OnFocusChangeListener() {
public void onFocusChange(View v, boolean hasFocus) {
if (!hasFocus) {
String powerRankingText = powerRankingsInput.getText().toString();
try {
int newPowerRanking = Integer.parseInt(powerRankingText);
int oldPowerRanking = team.getPowerRanking();
if (newPowerRanking != oldPowerRanking) {
Team teamWithRanking = nfl.getTeamWithPowerRanking(newPowerRanking);
if (teamWithRanking != null) {
String teamWithRankingName = teamWithRanking.getName();
String messageToDisplay = "Will switch rankings with " +
teamWithRankingName + " upon saving";
MessageDisplayer.displayMessage(activity, messageToDisplay);
}
}
} catch (Exception e) {
MessageDisplayer.displayMessage(activity, "Error setting Power Ranking");
}
}
}
});
}
private int getIndexOfSelectionInArray(Activity activity, int arrayId, int stringId) {
int returnIndex = -1;
final Resources resources = activity.getResources();
final String[] modeSettingsArray = resources.getStringArray(arrayId);
int selectionId = 0;
String stringToFind = resources.getString(stringId);
for (String modeSetting : modeSettingsArray) {
if (modeSetting.equals(stringToFind)) {
returnIndex = selectionId;
break;
}
selectionId++;
}
return returnIndex;
}
}
| [
"romojr50@gmail.com"
] | romojr50@gmail.com |
2f0ce67c9ab0b26f0de4c0b160a117c300219976 | 883f49f83e7b8baafb80b33aa6617242118a96b1 | /InterestCastApp/src/SFE/Compiler/SFECompiler.java | 2d1e7a84f3e476a860c26d682395efadedbd66b3 | [
"MIT"
] | permissive | gianpyc/MobileFairPlay | 2638a78faebaf146c813da3cf78cd996e4994311 | 82f3be85186bb0a5bf562508970005e741700524 | refs/heads/master | 2016-09-05T17:55:41.779424 | 2015-06-18T12:30:03 | 2015-06-18T12:30:03 | 37,649,588 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 45,631 | java | // SFECompiler.java.
// Copyright (C) 2004 Naom Nisan, Ziv Balshai, Amir Levy.
// See full copyright license terms in file ../GPL.txt
package SFE.Compiler;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.util.EmptyStackException;
import java.util.Enumeration;
import java.util.Stack;
import java.util.Vector;
/**
* The SFECompiler class takes an input stream and checks if it is compatible
* with the predefined language.
* It uses the class Tokenizer that gives tokens and their values.
*/
public class SFECompiler {
//~ Instance fields --------------------------------------------------------
/*
* Gives tokens and their values
*/
private Tokenizer tokenizer;
//~ Constructors -----------------------------------------------------------
/**
* Creates a tokenizer that parses the given stream.
* @param file a FileReader object providing the input stream.
*/
public SFECompiler(FileReader file) {
tokenizer = new Tokenizer(file);
}
//~ Methods ----------------------------------------------------------------
/*
* Advances one token
* @param error error message
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void advance(String error) throws IOException, ParseException {
if (! tokenizer.hasMoreTokens()) {
throw new ParseException(error, tokenizer.lineNumber());
}
tokenizer.advance();
}
/**
* Gets the next token from the stream and checks if it is from the
* expected type.
* @param tokenType the expected type.
* @param error string of the error message which will be send with ParseException.
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void getNextToken(int tokenType, String error)
throws ParseException, IOException
{
if (tokenizer.hasMoreTokens()) {
tokenizer.advance();
//checks if its the expected type
if (tokenizer.tokenType() == tokenType) {
return;
}
}
throw new ParseException(error, tokenizer.lineNumber());
}
/**
* Gets the next token from the stream, checks first if it is a keyword and
* then if its the the expected keyword.
* @param keywordType the expected keyword type.
* @param error string of the error message which will be send with ParseException.
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void getKeyword(int keywordType, String error)
throws ParseException, IOException
{
getNextToken(Tokenizer.KEYWORD, error);
//checks if its the expected keyword
if (tokenizer.keyword() != keywordType) {
throw new ParseException(error, tokenizer.lineNumber());
}
}
/**
* Gets the next token from the stream, checks first if it is a symbol and
* then if its the the expected symbol.
* @param symbol the expected symbol.
* @param error string of the error message which will be send with ParseException.
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void getSymbol(char symbol, String error)
throws ParseException, IOException
{
getNextToken(Tokenizer.SYMBOL, error);
if (tokenizer.symbol() != symbol) {
throw new ParseException(error, tokenizer.lineNumber());
}
}
/**
* Compiles the const expression:
* (<const> | <number>) ((+ | -) (<const> | <number>))*
* @return int the const value
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private int compileConstValue() throws ParseException, IOException {
int val = 0;
int tmp;
char lastOperator = '+';
do {
switch (tokenizer.tokenType()) {
case Tokenizer.IDENTIFIER:
ConstExpression constExpr =
Consts.fromName(tokenizer.getIdentifier());
tmp = constExpr.value();
break;
case Tokenizer.INT_CONST:
tmp = tokenizer.intVal();
break;
default:
throw new ParseException("const or number is expected" +
tokenizer.symbol(),
tokenizer.lineNumber());
}
switch (lastOperator) {
case '+':
val += tmp;
break;
case '-':
val -= tmp;
break;
}
advance("program not ended");
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
((tokenizer.symbol() != '+') &&
(tokenizer.symbol() != '-'))) {
break;
}
lastOperator = tokenizer.symbol();
advance("program not ended");
} while (true);
return val;
}
/**
* Compiles the all program:
* program <program-name> {
* <type declarations>
* <function declarations>
* }
* @return Program data structure that holds all the declarations and statements
* of the program
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
public Program compileProgram() throws ParseException, IOException {
// program
getKeyword(Tokenizer.KW_PROGRAM, "program is excepted");
// <program-name>
getNextToken(Tokenizer.IDENTIFIER,
"program name is excepted after program");
Program program = new Program(tokenizer.getIdentifier());
// {
getSymbol('{',
"{ is excepted after program name " +
tokenizer.getIdentifier());
advance("program not ended");
// <type declarations>
compileTypeDeclarations(program);
// <function declarations>
compileFunctionDeclarations(program);
// }
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '}')) {
throw new ParseException("} is excepted in the end of program",
tokenizer.lineNumber());
}
return program;
}
/**
* Compiles the type declarations:
* ((const <const-name> = <const-value>;) | (type <type-name> = <data-type>;))*
* @param Program data structure that holds all the declarations and statements
* of the program
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileTypeDeclarations(Program program)
throws ParseException, IOException
{
while (tokenizer.tokenType() == Tokenizer.KEYWORD) {
// type or const
switch (tokenizer.keyword()) {
case Tokenizer.KW_TYPE:
compileType();
break;
case Tokenizer.KW_CONST:
compileConst();
break;
default:
return;
}
// ;
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != ';')) {
throw new ParseException("; is excepted", tokenizer.lineNumber());
}
advance("program not ended");
}
}
/**
* Compiles the type declaration:
* <type-name> = <data-type>;
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileType() throws ParseException, IOException {
// <type-name>
getNextToken(Tokenizer.IDENTIFIER, "type name is excepted after type");
String typeName = tokenizer.getIdentifier();
// =
getSymbol('=', "= is excepted after type name " + typeName);
advance("type name is excepted");
// <data-type>
Type.defineName(typeName, compileDataType());
}
/**
* Compiles the const declaration:
* <const-name> = <const-value>;
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileConst() throws ParseException, IOException {
// <const-name>
getNextToken(Tokenizer.IDENTIFIER, "const name is excepted after const");
String constName = tokenizer.getIdentifier();
// =
getSymbol('=',
"= is excepted after const name " +
tokenizer.getIdentifier());
advance("program not ended");
// <const-value>
Consts.defineName(constName, compileConstValue());
}
/**
* Compiles the data type:
* (Int<bits> | Boolean | <type-name>) (<array>)*
* @return Type one of the data structure types
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private Type compileDataType() throws ParseException, IOException {
Type newType;
// (Int or Boolean) or <type-name>
switch (tokenizer.tokenType()) {
case Tokenizer.KEYWORD:
newType = compileKnownType();
break;
case Tokenizer.IDENTIFIER:
newType = Type.fromName(tokenizer.getIdentifier());
if (newType == null) {
throw new ParseException("Unknown type " +
tokenizer.getIdentifier(),
tokenizer.lineNumber());
}
advance("Program not ended");
break;
default:
throw new ParseException("type name is excepted",
tokenizer.lineNumber());
}
// <array>
return compileArray(newType);
}
/**
* Compiles the known types:
* Int, Boolean, StructType, Enum
* @return Type one of the data structure types
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private Type compileKnownType() throws ParseException, IOException {
Type type;
switch (tokenizer.keyword()) {
case Tokenizer.KW_INT:
// <bits>
getSymbol('<', "< is excepted after Int");
advance("Program not ended");
int bits = compileConstValue(); //compileBits();
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '>')) {
throw new ParseException("> is excepted at the end of Int declaration",
tokenizer.lineNumber());
}
advance("Program not ended");
type = new IntType(bits);
break;
case Tokenizer.KW_BOOLEAN:
type = new BooleanType();
advance("Program not ended");
break;
case Tokenizer.KW_STRUCT:
// {
getSymbol('{', "{ is excepted after StructType");
type = new StructType();
advance("Program not ended");
// <fields>
compileStructFields((StructType) type);
// }
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '}')) {
throw new ParseException("} is excepted in the end of struct fields",
tokenizer.lineNumber());
}
advance("Program not ended");
break;
case Tokenizer.KW_ENUM:
// {
getSymbol('{', "{ is excepted after StructType");
int index = 0;
advance("Program not ended");
while ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
! ((tokenizer.symbol() == '}') && (index > 0))) {
if (tokenizer.tokenType() != Tokenizer.IDENTIFIER) {
throw new ParseException("identifier is excepted in enum",
tokenizer.lineNumber());
}
// <const-value>
Consts.defineName(tokenizer.getIdentifier(), index);
index++;
advance("Program not ended");
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
! ((tokenizer.symbol() == '}') ||
(tokenizer.symbol() == ','))) {
throw new ParseException("} or , is excepted in enum",
tokenizer.lineNumber());
}
if (tokenizer.symbol() == ',') {
advance("Program not ended");
}
}
//calculate number of bits, +1 for rounding
type = new IntType((int) (IntConstant.log2(index) + 1));
advance("Program not ended");
break;
default:
throw new ParseException(tokenizer.getKeyword() +
" is not a supported type",
tokenizer.lineNumber());
}
return type;
}
/**
* Compiles the array syntax:
* ('[' <const-value> ']')*
* @param base the base type of the array
* @return Type array type
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private Type compileArray(Type base) throws ParseException, IOException {
// [
while ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '[')) {
advance("program not ended");
int length = compileConstValue();
base = new ArrayType(base, length);
// ]
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != ']')) {
throw new ParseException("] is excepted", tokenizer.lineNumber());
}
advance("program not ended");
}
// the next token after array
return base;
}
/**
* Compiles the function declarations:
* (
* function <data-type> <function-name> ( <arguments-list> ) {
* <var declarations>
* <function body>
* }
* )*
* @param Program data structure that holds all the declarations and statements
* of the program
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileFunctionDeclarations(Program program)
throws ParseException, IOException
{
// function
while ((tokenizer.tokenType() == Tokenizer.KEYWORD) &&
(tokenizer.keyword() == Tokenizer.KW_FUNCTION)) {
advance("program not ended");
// <data-type>
Type returnType = compileDataType();
// <function-name>
if (tokenizer.tokenType() != Tokenizer.IDENTIFIER) {
throw new ParseException("function name is excepted after type",
tokenizer.lineNumber());
}
new Function(tokenizer.getIdentifier(), returnType);
// (
getSymbol('(',
"( is excepted after function name " +
tokenizer.getIdentifier());
advance("program not ended");
// <arguments-list>
compileArgumentsList();
// )
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != ')')) {
throw new ParseException(") is excepted in the end of arguments",
tokenizer.lineNumber());
}
// {
getSymbol('{', "{ is excepted after )");
advance("program not ended");
// <var declarations>
compileVarDeclarations();
// <function body>
compileFunctionBody();
// }
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '}')) {
throw new ParseException("} is excepted at end of function",
tokenizer.lineNumber());
}
advance("program not ended");
program.addFunction(Function.currentFunction);
}
}
/**
* Compiles the arguments list:
* ( <data-type> <argument-name> (,<data-type> <argument-name>)* )?
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileArgumentsList() throws ParseException, IOException {
//empty arguments list
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == ')')) {
return;
}
do {
// <data-type>
Type type = compileDataType();
// <argument-name>
if (tokenizer.tokenType() != Tokenizer.IDENTIFIER) {
throw new ParseException("argument name is excepted after type",
tokenizer.lineNumber());
}
Function.currentFunction.addParameter(tokenizer.getIdentifier(),
type);
advance("program not ended");
// ,
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != ',')) {
break;
}
advance("program not ended");
} while (true);
}
/**
* Compiles the fields in StructType:
* ( <data-type> <field-name> (,<data-type> <field-name>)* )?
* @param StructType data structure that holds fields
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileStructFields(StructType structType)
throws ParseException, IOException
{
do {
// <data-type>
Type type = compileDataType();
// <field-name>
if (tokenizer.tokenType() != Tokenizer.IDENTIFIER) {
throw new ParseException("field name is excepted after type",
tokenizer.lineNumber());
}
structType.addField(tokenizer.getIdentifier(), type);
advance("program not ended");
// ,
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != ',')) {
break;
}
advance("program not ended");
} while (true);
}
/**
* Compiles the variables declarations:
* ( var <variables-list> )*
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileVarDeclarations() throws ParseException, IOException {
//empty arguments list
while ((tokenizer.tokenType() == Tokenizer.KEYWORD) &&
(tokenizer.keyword() == Tokenizer.KW_VAR)) {
advance("program not ended");
compileVariablesList();
}
}
/**
* Compiles the variables list:
* <data-type> <variable-name> (,<variable-name>)* ;
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileVariablesList() throws ParseException, IOException {
// <data-type>
Type type = compileDataType();
do {
// <variable-name>
if (tokenizer.tokenType() != Tokenizer.IDENTIFIER) {
throw new ParseException("variable name is excepted after type",
tokenizer.lineNumber());
}
Function.addVar(tokenizer.getIdentifier(), type);
advance("program not ended");
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
! ((tokenizer.symbol() == ';') ||
(tokenizer.symbol() == ','))) {
throw new ParseException(", or ; is expected",
tokenizer.lineNumber());
}
if (tokenizer.symbol() == ';') {
break;
}
advance("program not ended");
} while (true);
advance("program not ended");
}
/**
* Compiles the function body:
* ( <statement> )*
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileFunctionBody() throws ParseException, IOException {
while ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '}'))
Function.currentFunction.addStatement(compileStatement());
}
/**
* Compiles the statement:
* <if-statement> | <for-statement> | <var-name> '=' <expression>; | <block>
* @return Statement data structure that holds statement
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private Statement compileStatement() throws ParseException, IOException {
BlockStatement statement = null;
switch (tokenizer.tokenType()) {
case Tokenizer.IDENTIFIER:
//Assignment statement
Vector expressions = new Vector();
Vector lengths = new Vector();
// <var-name>
statement = new BlockStatement();
String varName =
compileLHS(null, expressions, lengths, statement);
// =
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '=')) {
throw new ParseException("= is excepted after variable",
tokenizer.lineNumber());
}
advance("program not ended");
// <expression>
Expression expr = compileExpression(false, statement);
//must be an OperationExpression
if (! (expr instanceof OperationExpression)) {
expr =
new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP),
expr);
}
if (expressions.isEmpty()) {
statement.addStatement(new AssignmentStatement(Function.getVar(varName),
(OperationExpression) expr));
} else {
statement.addStatement(arrayStatment(varName, expressions,
lengths,
(OperationExpression) expr));
}
// ;
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != ';')) {
throw new ParseException("; is expected in end of command",
tokenizer.lineNumber());
}
advance("program not ended");
break;
case Tokenizer.KEYWORD:
//if or for
switch (tokenizer.keyword()) {
case Tokenizer.KW_IF:
statement = compileIf();
break;
case Tokenizer.KW_FOR:
statement = compileFor();
break;
default:
throw new ParseException(tokenizer.getKeyword() +
" is not a supported command",
tokenizer.lineNumber());
}
break;
case Tokenizer.SYMBOL:
if (tokenizer.symbol() != '{') {
throw new ParseException("unexpected symbol " +
tokenizer.symbol(),
tokenizer.lineNumber());
}
advance("program not ended");
// <block>
statement = new BlockStatement();
while ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '}')) {
((BlockStatement) statement).addStatement(compileStatement());
}
advance("program not ended");
break;
default:
throw new ParseException("identifier or if or for is expected",
tokenizer.lineNumber());
}
return statement;
}
/**
* Merges splitted array variable into statement(left side variable).
* @param varName variable name, $ is the splitted places
* @param expressions splitted expressions
* @param lengths limit of each index in the array
* @param rhs right side expression
* @return Statement data structure that holds statement
*/
private Statement arrayStatment(String varName, Vector expressions,
Vector lengths, OperationExpression rhs) {
int[] indexes = new int[lengths.size()];
for (int i = 0; i < lengths.size(); i++)
indexes[i] = 0;
BlockStatement statement = new BlockStatement();
String[] varNameSplited = varName.split("\\$");
int lengthOfLast =
((Integer) lengths.elementAt(lengths.size() - 1)).intValue();
do {
String str = new String();
for (int i = 0; i < indexes.length; i++)
str += (varNameSplited[i] + indexes[i]);
if (varNameSplited.length > indexes.length) {
str += varNameSplited[varNameSplited.length - 1];
}
BinaryOpExpression op =
new BinaryOpExpression(new EqualOperator(),
new IntConstant(indexes[0]),
(Expression) expressions.elementAt(0));
for (int i = 1; i < indexes.length; i++) {
BinaryOpExpression op2 =
new BinaryOpExpression(new EqualOperator(),
new IntConstant(indexes[i]),
(Expression) expressions.elementAt(i));
op = new BinaryOpExpression(new PrimitiveOperator(PrimitiveOperator.AND_OP),
op, op2);
}
statement.addStatement(new IfStatement(op,
new AssignmentStatement(Function.getVar(str),
rhs),
null));
} while (advanceIndexes(indexes, lengths));
return statement;
}
/**
* Advances the indexes of an array variable.
* @param indexes indeces of the array variable.
* @param lengths limit of each index in the array
* @return true if all indeces get to the limit.
*/
private boolean advanceIndexes(int[] indexes, Vector lengths) {
int i = indexes.length - 1;
while (i >= 0) {
indexes[i] =
(indexes[i] + 1) % ((Integer) lengths.elementAt(i)).intValue();
if (indexes[i] == 0) {
i--;
} else {
return true;
}
}
return false;
}
/**
* Compiles for statement:
* for '(' <identifier> '=' <from-value> to <to-value> ')'
* <statement>
* @return BlockStatement data structure that holds for statement
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private BlockStatement compileFor() throws ParseException, IOException {
// (
getSymbol('(', "( is excepted after for");
// <identifier>
getNextToken(Tokenizer.IDENTIFIER, "identifier is excepted after (");
// <var-name>
Vector expressions = new Vector();
Vector lengths = new Vector();
BlockStatement block = new BlockStatement();
String varName = compileLHS(null, expressions, lengths, block);
// =
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '=')) {
throw new ParseException("= is excepted after variable",
tokenizer.lineNumber());
}
advance("program not ended");
//<from-value>
int from = compileConstValue();
// to
if ((tokenizer.tokenType() != Tokenizer.KEYWORD) ||
(tokenizer.keyword() != Tokenizer.KW_TO)) {
throw new ParseException("to is expected", tokenizer.lineNumber());
}
advance("program not ended");
//<to-value>
int to = compileConstValue();
// )
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != ')')) {
throw new ParseException(") is expected", tokenizer.lineNumber());
}
advance("program not ended");
Statement forBlock = compileStatement();
//duplicating the for block to-from+1 times
for (; from <= to; from++) {
//index not array
if (expressions.isEmpty()) {
block.addStatement(new AssignmentStatement(Function.getVar(varName),
new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP),
new IntConstant(from))));
} else {
block.addStatement(arrayStatment(varName, expressions, lengths,
new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP),
new IntConstant(from))));
}
block.addStatement(forBlock.duplicate());
}
return block;
}
/**
* Compiles if statement:
* if '(' <boolean-expr> ')' <statement>
* (else <statement>)?
* @return BlockStatement data structure that holds if statement
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private BlockStatement compileIf() throws ParseException, IOException {
// (
getSymbol('(', "( is excepted after if");
BlockStatement block = new BlockStatement();
//we don't need advance, the expression need to take (
// <boolean-expr>
Expression condition = compileExpression(false, block);
Statement thenBlock = compileStatement();
Statement elseBlock = null;
// else
if ((tokenizer.tokenType() == Tokenizer.KEYWORD) &&
(tokenizer.keyword() == Tokenizer.KW_ELSE)) {
advance("program not ended");
elseBlock = compileStatement();
}
block.addStatement(new IfStatement(condition, thenBlock, elseBlock));
return block;
}
/**
* Compiles left value:
* <identifier> ( '[' <expression> ']' | '.'<var-name>)?
* @param varName variable name
* @param block holds a block of statements
* @return LvalExpression data structure of left value or null if identifier does not exists.
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private LvalExpression compileLvalExpression(String varName,
BlockStatement block)
throws ParseException, IOException
{
String fieldName = tokenizer.getIdentifier();
if (varName == null) {
varName = fieldName;
} else {
varName += ('.' + fieldName);
}
advance("program not ended");
if (tokenizer.tokenType() == Tokenizer.SYMBOL) {
switch (tokenizer.symbol()) {
case '(':
/* we have already passed a struct or an array - no '(' should be here!!! */
if (varName.equals(fieldName)) {
return null;
}
throw new ParseException("Unexpected '(' sign",
tokenizer.lineNumber());
case '[':
while ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '[')) {
advance("program not ended");
// <expression>
Expression index = compileExpression(false, block);
// ]
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == ']')) {
advance("program not ended");
} else {
throw new ParseException("] is expected",
tokenizer.lineNumber());
}
LvalExpression base = Function.getVar(varName + "[$]");
Function.addVar("tmp" + labelIndex, base.getType());
LvalExpression lval =
Function.getVar("tmp" + labelIndex);
int len =
((ArrayType) Function.getVar(varName).getType()).getLength();
for (int i = 0; i < len; i++) {
BinaryOpExpression condition =
new BinaryOpExpression(new EqualOperator(),
new IntConstant(i),
index.duplicate());
AssignmentStatement ifBody =
new AssignmentStatement(lval,
new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP),
Function.getVar(varName +
"[" +
i +
"]")));
block.addStatement(new IfStatement(condition,
ifBody, null));
}
varName = "tmp" + labelIndex;
labelIndex++;
}
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '.')) {
advance("program not ended");
return compileLvalExpression(varName, block);
}
break;
case '.':
// <identifier>
getNextToken(Tokenizer.IDENTIFIER,
" identifier is excepted after .");
// <var-name>
return compileLvalExpression(varName, block);
}
}
return Function.getVar(varName);
}
/**
* Compiles left expression:
* <identifier> ( '[' <expression> ']' | '.'<var-name>)?
* @param varName
* @param expressions splited array expressions
* @param length limit of each array index
* @param block holds statements
* @return String variable name splitted with $ instead of []
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private String compileLHS(String varName, Vector expressions,
Vector lengths, BlockStatement block)
throws ParseException, IOException
{
String fieldName = tokenizer.getIdentifier();
if (varName == null) {
varName = fieldName;
} else {
varName += ('.' + fieldName);
}
advance("program not ended");
if (tokenizer.tokenType() == Tokenizer.SYMBOL) {
switch (tokenizer.symbol()) {
case '[':
while ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '[')) {
advance("program not ended");
// <expression>
expressions.add(compileExpression(false, block));
lengths.add(new Integer(((ArrayType) (Function.getVar(varName)
.getType())).getLength()));
// ]
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == ']')) {
advance("program not ended");
} else {
throw new ParseException("] is expected",
tokenizer.lineNumber());
}
varName += "[$]";
}
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '.')) {
advance("program not ended");
return compileLHS(varName + ".", expressions, lengths,
block);
}
break;
case '.':
// <identifier>
getNextToken(Tokenizer.IDENTIFIER,
" identifier is excepted after .");
// <var-name>
return compileLHS(varName, expressions, lengths, block);
}
}
return varName;
}
/**
* Compiles the expression:
* ('~' | '-')? <term> (<operator> <expression>)?
* @param isArgument if it is an argument
* @param block holds statements
* @return Expression data structure of expression
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private Expression compileExpression(boolean isArgument,
BlockStatement block)
throws ParseException, IOException
{
Expression exp = null;
try {
Stack operators = new Stack();
Stack operands = new Stack();
do {
while (tokenizer.tokenType() == Tokenizer.SYMBOL) {
switch (tokenizer.symbol()) {
case '~':
insertNewOperator(operators, operands,
new PrimitiveOperator(PrimitiveOperator.NOT_OP));
break;
case '-':
insertNewOperator(operators, operands,
new UnaryMinusOperator());
break;
case '(':
operators.push(null);
break;
default:
throw new ParseException("~ or - or ( is expected",
tokenizer.lineNumber());
}
advance("program not ended");
}
// <term>
operands.push(compileTerm(block));
// <operator>
if (tokenizer.tokenType() != Tokenizer.SYMBOL) {
throw new ParseException("Must be ) or ; or , or operator after term",
tokenizer.lineNumber());
}
//flag for dealing with expression: ((...))
boolean stackUpdated = false;
while (tokenizer.symbol() == ')') {
//there isn't ( for the last ) in argumnet list
if (isArgument && operators.empty()) {
break;
}
if ((operators.peek() == null) && (operands.empty()) &&
! stackUpdated) {
throw new ParseException("Empty expression ()",
tokenizer.lineNumber());
}
stackUpdated = true;
//until (
while (operators.peek() != null)
updateStacks(operators, operands);
//pop (
operators.pop();
advance("program not ended");
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() == '{')) {
break;
}
}
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() == ';') ||
(tokenizer.symbol() == '{') ||
(tokenizer.symbol() == ']') ||
(isArgument &&
((tokenizer.symbol() == ',') ||
(tokenizer.symbol() == ')')))) {
break;
}
compileOperator(operators, operands);
} while (true);
while (! operators.empty())
updateStacks(operators, operands);
exp = (Expression) operands.pop();
if (! operands.empty()) {
throw new ParseException("Error in expression, not enougth operators",
tokenizer.lineNumber());
}
} catch (EmptyStackException ese) {
throw new ParseException("Error in expression",
tokenizer.lineNumber());
}
return exp;
}
/**
* Compiles the term:
* <var-name> | <number> | <identifier> '(' (<expression> (',' <expression>)*)? ')'
* @param block holds statements
* @return Expression data structure of expression
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private Expression compileTerm(BlockStatement block)
throws ParseException, IOException
{
Expression expression = null;
switch (tokenizer.tokenType()) {
case Tokenizer.IDENTIFIER:
String identifier = tokenizer.getIdentifier();
/* in case the identifier is a defined const */
expression = Consts.fromName(identifier);
if (expression != null) {
advance("program not ended");
break; // break the switch
}
/* in case expression is a variable (lvalue) */
expression = compileLvalExpression(null, block);
if (expression != null) {
break; // break the switch
}
if ((tokenizer.tokenType() != Tokenizer.SYMBOL) ||
(tokenizer.symbol() != '(')) {
throw new ParseException("error in term: no const, var, function",
tokenizer.lineNumber());
}
advance("program not ended");
Function calledFunc = Program.functionFromName(identifier);
int i = 0;
//adding arguments assigning statements
for (Enumeration e = calledFunc.getArguments().elements();
e.hasMoreElements() &&
! ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == ')')); i++) {
block.addStatement(new AssignmentStatement((LvalExpression) e.nextElement(),
new UnaryOpExpression(new PrimitiveOperator(PrimitiveOperator.ID_OP),
compileExpression(true,
block))));
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == ',')) {
advance("program not ended");
}
}
if (i != calledFunc.getArguments().size()) {
throw new ParseException("Number of argument not match",
tokenizer.lineNumber());
}
//adding function body
block.addStatements(calledFunc.getBody());
expression = calledFunc.functionResult;
advance("program not ended");
break;
case Tokenizer.INT_CONST:
expression = new IntConstant(tokenizer.intVal());
advance("program not ended");
break;
case Tokenizer.KEYWORD:
switch (tokenizer.keyword()) {
case Tokenizer.KW_TRUE:
expression = new BooleanConstant(true);
break;
case Tokenizer.KW_FALSE:
expression = new BooleanConstant(false);
break;
default:
throw new ParseException("Unexcepted keyword " +
tokenizer.getKeyword(),
tokenizer.lineNumber());
}
advance("program not ended");
break;
default:
throw new ParseException("number or identifier is excepted",
tokenizer.lineNumber());
}
return expression;
}
/**
* Pops operator and operand/s and push back a new operand which
* is the expression of them.
* @param operators stack of operators
* @param operands stack of operands
* @throws EmptyStackException if trying to pop from empty stack.
*/
private void updateStacks(Stack operators, Stack operands)
throws EmptyStackException
{
Operator operator = (Operator) operators.pop();
Expression operand = (Expression) operands.pop();
//if unary operator
if ((operator instanceof UnaryMinusOperator) ||
((operator instanceof PrimitiveOperator) &&
(((PrimitiveOperator) operator).operator == PrimitiveOperator.NOT_OP))) {
operands.push(new UnaryOpExpression(operator, operand));
} else { //pop another operand for binary operator
operands.push(new BinaryOpExpression(operator,
(Expression) operands.pop(),
operand));
}
}
/**
* Inserts a new operator to operators stack.
* If there are operators with higher priority call updateStacks
* with them.
* @param operators stack of operators
* @param operands stack of operands
* @param operator operator
* @throws EmptyStackException if trying to pop from empty stack.
*/
private void insertNewOperator(Stack operators, Stack operands,
Operator operator)
throws EmptyStackException
{
while (! operators.empty() && (operators.peek() != null) &&
(operator.priority() <= ((Operator) operators.peek()).priority()))
updateStacks(operators, operands);
operators.push(operator);
}
/**
* Compiles the binary operator.
* @param operators stack of operators
* @param operands stack of operands
* @throws IOException - if an I/O error occurs.
* @throws ParseException - if a parsing error occurs.
*/
private void compileOperator(Stack operators, Stack operands)
throws ParseException, IOException
{
boolean getNextToken = true;
switch (tokenizer.symbol()) {
case '+':
insertNewOperator(operators, operands, new PlusOperator());
break;
case '-':
insertNewOperator(operators, operands, new MinusOperator());
break;
case '|':
insertNewOperator(operators, operands,
new PrimitiveOperator(PrimitiveOperator.OR_OP));
break;
case '&':
insertNewOperator(operators, operands,
new PrimitiveOperator(PrimitiveOperator.AND_OP));
break;
case '^':
insertNewOperator(operators, operands,
new PrimitiveOperator(PrimitiveOperator.XOR_OP));
break;
case '<':
advance("program not ended");
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '=')) {
insertNewOperator(operators, operands,
new LessEqualOperator());
} else {
insertNewOperator(operators, operands, new LessOperator());
getNextToken = false;
}
break;
case '>':
advance("program not ended");
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '=')) {
insertNewOperator(operators, operands,
new GreaterEqualOperator());
} else {
insertNewOperator(operators, operands, new GreaterOperator());
getNextToken = false;
}
break;
case '=':
advance("program not ended");
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '=')) {
insertNewOperator(operators, operands, new EqualOperator());
} else {
throw new ParseException("There should be = after =",
tokenizer.lineNumber());
}
break;
case '!':
advance("program not ended");
if ((tokenizer.tokenType() == Tokenizer.SYMBOL) &&
(tokenizer.symbol() == '=')) {
insertNewOperator(operators, operands,
new NotEqualOperator());
} else {
throw new ParseException("There should be = after !",
tokenizer.lineNumber());
}
break;
default:
throw new ParseException("Must be operator or ; or , or { or ]",
tokenizer.lineNumber());
}
if (getNextToken) {
advance("program not ended");
}
}
/**
* A test program
*/
public static void compile(String fileName, boolean opt)
throws IOException
{
Program program = null;
FileReader file = new FileReader(fileName);
SFECompiler compiler = new SFECompiler(file);
try {
program = compiler.compileProgram();
} catch (ParseException pe) {
System.err.println("Error in line " + pe.getErrorOffset() + ": " +
pe.getMessage());
System.exit(1);
}
file.close();
System.out.println("Program compiled.");
// transformations
program.multi2SingleBit();
// unique vars transformations
program.uniqueVars();
//Optimization
if (opt) {
program.optimize();
}
// write circuit
PrintWriter circuit =
new PrintWriter(new FileWriter(fileName +
((opt) ? ".Opt" : ".NoOpt") +
".circuit"));
program.toCircuit(circuit, opt);
circuit.close();
// write Format file
PrintWriter fmt =
new PrintWriter(new FileWriter(fileName +
((opt) ? ".Opt" : ".NoOpt") +
".fmt"));
fmt.println(program.toFormat());
fmt.close();
}
/**
* A test program
*/
public static void main(String[] args) throws IOException {
Program program = null;
if ((args.length != 1) &&
((args.length != 2) || ! args[0].equals("-no-opt"))) {
System.err.println("Usage: java SFECompiler [-no-opt] <file>");
System.exit(1);
}
String fileName;
boolean opt = true;
if (args.length == 2) {
fileName = args[1];
opt = false;
} else {
fileName = args[0];
}
compile(fileName, opt);
}
//~ Static fields/initializers ---------------------------------------------
/*
* label for temporary variables
*/
static int labelIndex = 0;
}
| [
"gianpyc@dhcp17.iit.cnr.it"
] | gianpyc@dhcp17.iit.cnr.it |
333abc8db8b320be2fb62cb36ff578cc0c436fc4 | 61bec00833aa7827f3615dac310a607175cbd2ac | /Polimorfismo-2-Interfaces/src/com/edu/cibertec/SeleccionFutbol.java | bce33ce5d0a65ce3afca2d91f1561429adc211e1 | [] | no_license | joanleonrs/Java-for-Beginners | c56f6eb52dc594e4812af68518bbb0f2e7ebca33 | 04ae0ba1a378b2a3c5b10ae6dedcdf01cbdd0045 | refs/heads/master | 2021-07-10T12:41:37.099980 | 2017-09-29T20:33:00 | 2017-09-29T20:33:00 | 105,170,143 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,221 | java | package com.edu.cibertec;
/**
* @author jleon
*
*/
public abstract class SeleccionFutbol implements IntegranteSeleccionFutbol {
protected int id;
protected String nombre;
protected String apellidos;
protected int edad;
public SeleccionFutbol() {
}
public SeleccionFutbol(int id, String nombre, String apellidos, int edad) {
this.id = id;
this.nombre = nombre;
this.apellidos = apellidos;
this.edad = edad;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellidos() {
return apellidos;
}
public void setApellidos(String apellidos) {
this.apellidos = apellidos;
}
public int getEdad() {
return edad;
}
public void setEdad(int edad) {
this.edad = edad;
}
public void concentrarse() {
System.out.println("Concentrarse (Clase Padre)");
}
public void viajar() {
System.out.println("Viajar (Clase Padre)");
}
public void entrenar() {
System.out.println("Entrenar (Clase Padre)");
}
public void jugarPartido() {
System.out.println("Asiste al Partido de Fútbol (Clase Padre)");
}
} | [
"joanleonrs"
] | joanleonrs |
5372186f106ff9a9a0bc2f87000d177d901c204e | 66e6563e0aad516f271f29525c897325bb29ed4e | /backend/InvalidUserException.java | fceb1602d5afc21c9aeecb9435beedaaba4939f2 | [
"MIT"
] | permissive | linaizhong/transOS | 09b63a9d734c83500dea30f54deabe61bdbf70b7 | 12111894f41cdff99c6bf0d7eeb7e291cdc864bf | refs/heads/master | 2021-01-22T19:14:20.736081 | 2013-04-13T04:31:03 | 2013-04-13T04:31:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 601 | java | package backend;
public class InvalidUserException extends Exception {
private static final long serialVersionUID = 6310585172511615015L;
public InvalidUserException() {
}
public InvalidUserException(String message) {
super(message);
}
public InvalidUserException(Throwable cause) {
super(cause);
}
public InvalidUserException(String message, Throwable cause) {
super(message, cause);
}
public InvalidUserException(String message, Throwable cause,
boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
| [
"anurag_peshne@yahoo.co.in"
] | anurag_peshne@yahoo.co.in |
a86ae6cd6ebc09f0b03bbca3566d930667a950e6 | 6557af1d20c8c1ba5c23261142a423b0b196efdf | /src/br/todolist/exception/AdicionaTarefaException.java | 2f8803591e122b004023c1f83dc9fbd86baa4b22 | [] | no_license | robsonprod/actionBtodolist | b640dca5d17a1885c0438c7aad3cbe5ae4723d2c | 142bc1239b74e9a132bc0ab4fcea51bc30a446de | refs/heads/master | 2021-05-05T17:49:04.229606 | 2018-01-31T17:50:21 | 2018-01-31T17:50:21 | 103,480,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 269 | java | package br.todolist.exception;
public class AdicionaTarefaException extends Exception {
private static final long serialVersionUID = -2394754164939448367L;
public AdicionaTarefaException(String msg) {
super(msg);
}
public AdicionaTarefaException() {
}
}
| [
"rbsazevedo@gmail.com"
] | rbsazevedo@gmail.com |
fdb8b807c8a9ca5e2569599082417472e1eb206d | e7b920cce6a17677ddeee169888c4449dde042c1 | /stockindexing/src/main/java/stockindexing/config/XmlInterceptor.java | f85913b9f644ab68cfb508a1f329d07c58ca7cc6 | [] | no_license | surajtripathy07/stock | 8fdd7f0a264ebff5147344308fb8c4f9373d41d9 | 6171e649521ce5921433b582b97f145266ee0f88 | refs/heads/master | 2021-01-21T16:53:40.832163 | 2017-05-27T05:01:24 | 2017-05-27T05:01:24 | 91,916,103 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 893 | java | package stockindexing.config;
import java.io.IOException;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.client.ClientHttpRequestExecution;
import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.ClientHttpResponse;
public class XmlInterceptor implements ClientHttpRequestInterceptor {
@Override
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
throws IOException {
ClientHttpResponse response = execution.execute(request, body);
HttpHeaders headers = response.getHeaders();
// you'd want to check if the value needs to be changed
if (headers.containsKey("Content-Type")) {
headers.remove("Content-Type");
}
headers.add("Content-Type", "application/xml");
return response;
}
}
| [
"tripathy.suraj0704@gmail.com"
] | tripathy.suraj0704@gmail.com |
4790d19498711ca441ebec0d88263af765ce0675 | 1653833a936718617f7ff7ce5f64dc2024b05c79 | /app/src/test/java/com/yash/utuparentportal/ExampleUnitTest.java | 4d96fe849502094a2cbe5c4712d2deab4c1e22e0 | [] | no_license | Yashp1210/UTUParentsPortal | ca3c614af24a5d4d4299e7f23839680003097737 | 845f124d690e8782446ac3fcdb19a07eeae05c2a | refs/heads/master | 2023-06-14T01:17:54.968901 | 2021-07-11T13:13:23 | 2021-07-11T13:13:23 | 374,607,923 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 385 | java | package com.yash.utuparentportal;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"preetvasoya8@gmail.com"
] | preetvasoya8@gmail.com |
cf1eb140cb601aaf98d02f8e0ec0df28be770c36 | cae571bb7953e5946fde3934265675f7a5ca4849 | /src/ers/pre02/ejercicio07.java | 92bed79b5e1cab2fdf0ebf8b506d3e4abf33353f | [] | no_license | prosi95/TAREA-PRESENCIAL-2 | e7a49e2574646a713691a904e68355398968d1bd | eef1dddbba14debbfccac931924cf5cb61c89dc0 | refs/heads/master | 2020-04-07T14:39:48.648929 | 2018-10-30T16:46:28 | 2018-10-30T16:46:28 | 155,377,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 488 | java | package ers.pre02;
import java.util.Scanner;
public class ejercicio07
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
System.out.println("Introduzca un numero");
int numero = keyboard.nextInt();
int contador = 0;
while(numero >= 3)
{
numero -= 3;
contador ++;
}
System.out.println("Cociente = "+contador+", Resto = "+numero );
}
} | [
"acratos95@gmail.com"
] | acratos95@gmail.com |
8654d6ecfe7a78694568fe270ad05e23d9d175a5 | 9df9a71b44b81642b880cf38135be616a2b9e61c | /sampleTest_gitgit/src/main/java/com/sample/test/VO/QnaBoard.java | 42cdc55be3f17b28e77802f29089b88473afaf43 | [] | no_license | dusruf/Team_Project | 9288811f032d2b1c35af2b30dc90365976923b48 | 33673a69340718484c00d10e1f7728158b31e3e6 | refs/heads/master | 2020-04-30T04:43:38.107127 | 2019-04-22T20:45:10 | 2019-04-22T20:45:10 | 164,366,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,735 | java | package com.sample.test.VO;
public class QnaBoard {
private int qBoardSeq;
private String personId;
private String title;
private String contents;
private int hitcount;
private String indate;
private int secretFlag;
public QnaBoard(int qBoardSeq, String personId, String title, String contents, int hitcount, String indate,
int secretFlag) {
super();
this.qBoardSeq = qBoardSeq;
this.personId = personId;
this.title = title;
this.contents = contents;
this.hitcount = hitcount;
this.indate = indate;
this.secretFlag = secretFlag;
}
public QnaBoard() {
super();
}
public int getqBoardSeq() {
return qBoardSeq;
}
public void setqBoardSeq(int qBoardSeq) {
this.qBoardSeq = qBoardSeq;
}
public String getPersonId() {
return personId;
}
public void setPersonId(String personId) {
this.personId = personId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContents() {
return contents;
}
public void setContents(String contents) {
this.contents = contents;
}
public int getHitcount() {
return hitcount;
}
public void setHitcount(int hitcount) {
this.hitcount = hitcount;
}
public String getIndate() {
return indate;
}
public void setIndate(String indate) {
this.indate = indate;
}
public int getSecretFlag() {
return secretFlag;
}
public void setSecretFlag(int secretFlag) {
this.secretFlag = secretFlag;
}
@Override
public String toString() {
return "QnaBoard [qBoardSeq=" + qBoardSeq + ", personId=" + personId + ", title=" + title + ", contents="
+ contents + ", hitcount=" + hitcount + ", indate=" + indate + ", secretFlag=" + secretFlag + "]";
}
}
| [
"dusruf@daum.net"
] | dusruf@daum.net |
f8710a973681aee3860266622518e5b5d9d42ea9 | 1fdaeb1c0209dc819399f3190f5987c77447f5f9 | /taotao-search/src/main/java/com/taotao/search/controller/ItemController.java | c504ef434c6b023d102ccd03adb15797174eb693 | [] | no_license | lrsbegin/taotao | f643a2b1637d768a2ea3904c80c311bdbed23b11 | 4e50b30908c86487792f31802d10ce5cfe3e73fd | refs/heads/master | 2023-01-07T17:58:43.517710 | 2020-10-26T01:57:36 | 2020-10-26T01:57:36 | 307,033,276 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 738 | java | package com.taotao.search.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.taotao.common.pojo.TaotaoResult;
import com.taotao.search.service.ItemService;
/**
* 索引库维护
* @author Admin
*
*/
@Controller
@RequestMapping("/manager")
public class ItemController {
@Autowired
private ItemService itemService;
/**
* 导入商品数据到索引库
*/
@RequestMapping("/importall")
@ResponseBody
public TaotaoResult importAllItem() {
return itemService.importALLItem();
}
}
| [
"514042234@qq.com"
] | 514042234@qq.com |
2207a3b4ab12cbbd9561d8a0eccd8e25b6fcc524 | 6572001a1082e897f9125293746bfa8ef7fb7024 | /service-demo/src/main/java/me/liqiu/servicedemo/ServiceDemoApplication.java | ede00760aa66514ba9297e9634e86359d72244af | [] | no_license | StarOceanReimi/feign-multiple-params | fb79412daf891cf2e791b2ddfdce12d67b8aa2a2 | c1ea06c273b3a0bdbb202a3a5a272ff5763a61a6 | refs/heads/master | 2020-05-19T08:22:08.934004 | 2019-05-04T16:43:01 | 2019-05-04T16:43:01 | 184,920,295 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,677 | java | package me.liqiu.servicedemo;
import me.liqiu.feignapi.TestFeign;
import me.liqiu.feignapi.vo.TestVo;
import me.liqiu.feignapi.vo.TestVo1;
import org.aspectj.weaver.ast.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.TimeUnit;
@EnableDiscoveryClient
@EnableFeignClients({"me.liqiu.feignapi"})
@SpringBootApplication(scanBasePackages = {"me.liqiu.feignapi.config"})
@RestController
public class ServiceDemoApplication {
@Autowired
TestFeign feign;
@GetMapping("/test")
public String testService() {
TestVo vo = new TestVo();
vo.setId(1L);
vo.setName("Hi");
vo.setUnit(TimeUnit.MILLISECONDS);
String s = feign.echoTest(vo);
System.out.println(s);
return "Hi";
}
@GetMapping("/test1")
public String testService1() {
TestVo vo = new TestVo();
vo.setId(1L);
vo.setName("Hi");
vo.setUnit(TimeUnit.MILLISECONDS);
TestVo1 vo1 = new TestVo1();
vo1.setAge(10);
vo1.setName1("tetete");
String s = feign.echoTest1(vo, vo1);
System.out.println(s);
return "Hi";
}
public static void main(String[] args) {
SpringApplication.run(ServiceDemoApplication.class, args);
}
}
| [
"saiqiuli@gmail.com"
] | saiqiuli@gmail.com |
e635ea3fb221e65373be8cc3ed779453f25aebb6 | 4cac3ced2ed46eed4b240325be014e9eb62419f1 | /PrimeNumberBetweenIntervals.java | 6a4dcf31120179376bb76c170ae061b637e8c6b3 | [] | no_license | aishwarya003/aishwarya. | 0920b4c119a39b2718ccf5a5afa9cb8b53f3402b | 468b664831774ab3dea14f476944fd79c9ac66ec | refs/heads/master | 2021-01-13T03:04:31.913491 | 2017-07-17T08:39:34 | 2017-07-17T08:39:34 | 77,021,742 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 468 | java | package sample;
import java.util.*;
public class PrimeNumberBetweenIntervals {
public static void main(String[] args){
Scanner s=new Scanner(System.in);
int a=s.nextInt();
int b=s.nextInt();
s.close();
int temp=0;
//while(a<b){
//temp=0;
for(int j=a;j<=b;++j){
for(int i=2;i<=j/2;i++){
if(j%i==0){
temp=1;
break;
}
}
if(temp==0){
System.out.println(j);
}
temp=0;
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
607b803f584e31a8d4252d7fcfef2afef61be5de | ee4843956e8cb8d29ab98635c5cda745354ae7d5 | /src/main/java/com/mangopay/entities/subentities/BankAccountDetailsIBAN.java | 825a4cfe4f0b95862a410268192206b6c7fb6b35 | [
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] | permissive | tlehoux/mangopay2-java-sdk | d1619f2096ea5ba290d81ca86cb07fb347aa572f | 3973617760e524b4ec007b062eda9be4cd58e757 | refs/heads/master | 2021-05-03T16:54:50.037334 | 2016-10-21T17:15:29 | 2016-10-21T17:15:29 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 396 | java | package com.mangopay.entities.subentities;
import com.mangopay.core.Dto;
import com.mangopay.core.interfaces.IBankAccountDetails;
/**
* Class represents IBAN type of bank account.
*/
public class BankAccountDetailsIBAN extends Dto implements IBankAccountDetails {
/**
* IBAN number.
*/
public String IBAN;
/**
* BIC.
*/
public String BIC;
}
| [
"lukasz.drzewiecki@mosaic-lab.com"
] | lukasz.drzewiecki@mosaic-lab.com |
e9120632749a13f9b9be6d8c41da5af638fd0123 | ffcb90fe3fc54185a49c1a944e4f2d00974563df | /src/GreedyAlgorithms/DisjointSet.java | 1d097bafac004793d2a218457449090ddf82b6b5 | [] | no_license | gokulg201/CompetitiveProgramming | 840a59be386af798857f9763b1b5cce845d0afe5 | 9c5410e5bbe9ba6953619c82a738d9be2b63787e | refs/heads/master | 2020-04-12T01:10:23.409388 | 2018-12-18T03:25:02 | 2018-12-18T03:25:02 | 162,223,655 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,280 | java | //$Id$
package GreedyAlgorithms;
import java.util.HashMap;
/**
* Disjoint Set implementation
* https://www.youtube.com/watch?v=ID00PMy0-vE
* O(m alpha(n))
* m - no of operations
* n - no of elements
* @author gokul-4406
*
*/
public class DisjointSet {
class Node{
long data;
Node parent;
int rank;
}
private HashMap<Long, Node> nodeMap = new HashMap<Long, DisjointSet.Node>();
public void makeSet(long data){
Node node = new Node();
node.data = data;
node.rank = 0;
node.parent = node;
nodeMap.put(data, node);
}
public void union(long data1, long data2){
Node node1 = nodeMap.get(data1);
Node node2 = nodeMap.get(data2);
Node parent1 = findSet(node1);
Node parent2 = findSet(node2);
if(parent1.data == parent2.data) return; // do nothing
if(parent1.rank >= parent2.rank){
parent1.rank = parent1.rank == parent2.rank ? parent1.rank + 1 : parent1.rank; //increment rank only if both sets have same rank
parent2.parent = parent1;
}else{
parent1.parent = parent2;
}
}
private Node findSet(Node node){
Node parent = node.parent;
if(parent == node){
return parent;
}
node.parent = findSet(node.parent);
return node.parent;
}
public long findSet(long data){
return nodeMap.get(data).data;
}
}
| [
"gokul.g@zohocorp.com"
] | gokul.g@zohocorp.com |
780fe407988be7f98761f65ec39cacaf90489969 | a360d9cddc2cd1ff5ca1570ac7286bc3207d6bee | /app/src/main/java/br/com/popularmovies/connection/EndpointInterface.java | 397eb3826327676caf572510df912f87b48bbba5 | [] | no_license | natanfelipe/PopularMovies | 806bb07347456fe64ecca349a3c971518ba0a47b | 1ac546e26d82c273ee9b83390e9c0d046ed3931a | refs/heads/master | 2020-03-16T12:11:51.044153 | 2018-05-08T20:51:01 | 2018-05-08T20:51:01 | 132,661,571 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 971 | java | package br.com.popularmovies.connection;
import java.util.List;
import br.com.popularmovies.model.MoviesCatalog;
import br.com.popularmovies.model.TraillerCatalog;
import retrofit2.Call;
import retrofit2.Response;
import retrofit2.http.GET;
import retrofit2.http.Path;
import retrofit2.http.Query;
public interface EndpointInterface {
public static final String BASE_URL="https://api.themoviedb.org/3/";
@GET("discover/movie")
Call<MoviesCatalog> moviesList(@Query("api_key") String key,
@Query("language") String language,
@Query("include_video") boolean hasVideo,
@Query("page") int page);
@GET("movie/{id}/videos")
Call<TraillerCatalog> traillerCatalog(@Path("id") String id,
@Query("api_key") String key,
@Query("language") String language);
}
| [
"natanfelipe@gmail.com"
] | natanfelipe@gmail.com |
39289953a309ca5e83d90c5ae69d0b8ced542072 | 36b1133f19264691be42b507d562ffae3c13333b | /converter/schematizer/src/main/java/org/apache/felix/serializer/impl/json/JsonSerializerImpl.java | 1a3c5f66546cf8edf5ca932399caa97ae77ccee3 | [] | no_license | tobias--/felix | 9b521e7d1514aea52e1807db67da8fc0ec495790 | 7db0cbb3e92ff78530b66126d9f22d1d1bb7609b | refs/heads/trunk | 2021-01-11T17:40:23.859967 | 2017-01-23T02:41:12 | 2017-01-23T02:41:12 | 79,818,585 | 0 | 0 | null | 2017-01-23T15:43:09 | 2017-01-23T15:43:09 | null | UTF-8 | Java | false | false | 4,152 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.felix.serializer.impl.json;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.osgi.service.serializer.Serializer;
import org.osgi.service.serializer.Serializing;
import org.osgi.util.converter.Converter;
import org.osgi.util.converter.StandardConverter;
import org.osgi.util.converter.TypeReference;
public class JsonSerializerImpl implements Serializer {
private final Map<String, Object> configuration = new ConcurrentHashMap<>();
private final ThreadLocal<Boolean> threadLocal = new ThreadLocal<>();
private final Converter converter = new StandardConverter();
@Override
public <T> JsonDeserializingImpl<T> deserialize(Class<T> cls) {
return new JsonDeserializingImpl<T>(converter, cls);
}
@Override
public Serializing serialize(Object obj) {
Serializing encoding = new JsonSerializingImpl(converter, configuration, obj);
if (pretty()) {
Boolean top = threadLocal.get();
if (top == null) {
threadLocal.set(Boolean.TRUE);
// TODO implement this properly, the following it just a dev temp thing
encoding = new EncodingWrapper("{}{}{}{}{}", encoding, "{}{}{}{}{}");
}
}
return encoding;
}
private boolean pretty() {
return Boolean.TRUE.equals(Boolean.parseBoolean((String) configuration.get("pretty")));
}
private class EncodingWrapper implements Serializing {
private final Serializing delegate;
private String prefix;
private String postfix;
EncodingWrapper(String pre, Serializing encoding, String post) {
prefix = pre;
delegate = encoding;
postfix = post;
}
@Override
public void to(OutputStream os) {
try {
os.write(toString().getBytes(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
@Override
public String toString() {
try {
return prefix + delegate.toString() + postfix;
} finally {
threadLocal.set(null);
}
}
@Override
public Serializing ignoreNull() {
return this;
}
@Override
public Serializing pretty() {
return this;
}
@Override
public void to(OutputStream out, Charset charset) {
// TODO Auto-generated method stub
}
@Override
public Appendable to(Appendable out) {
// TODO Auto-generated method stub
return null;
}
@Override
public Serializing with(Converter converter) {
delegate.with(converter);
return this;
}
}
@Override
public <T> JsonDeserializingImpl<T> deserialize(TypeReference<T> ref) {
return new JsonDeserializingImpl<>(converter, ref);
}
@Override
public JsonDeserializingImpl<?> deserialize(Type type) {
return new JsonDeserializingImpl<>(converter, type);
}
}
| [
"davidb@apache.org"
] | davidb@apache.org |
ba6b5803580800ff78b44f3e7cf0e8722d3c617a | f43f09457e83ee5c7600d2e9c2f402674db3b81c | /Lesson 04 basic java/src/g/BoxHandler.java | 479f517fa48862e07d5af5d76d6599a1aeea5978 | [] | no_license | dankosorkin/822-124 | 73d05271f079df319284234aa1c8fdeb839ea4e2 | 18352dbc5d14f2c7607e37045de10f97a4c5b8b4 | refs/heads/master | 2023-03-03T13:45:18.492132 | 2021-02-15T14:04:50 | 2021-02-15T14:04:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 192 | java | package g;
public class BoxHandler {
// define a method that takes a box and make it higher
public void makeBoxHigher(Box box ) {
box.setHeight(box.getHeight() + 1);
}
}
| [
"jbt@54914_"
] | jbt@54914_ |
c142ba0fd1a7ce42418ed4eed5c0e49defd875fb | b9a2e0dc2c94149c1764f0395e6585ca768fab21 | /jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/bee/mapper/HistoryOperMapper.java | 93718b979c3b1da2ae57688374cbf726fcaa1748 | [
"Apache-2.0",
"MIT"
] | permissive | elaine140626/TYGSMTboxHK2 | 25f64364eb754ed872375a4c9764a02679e9b461 | 5b1a7832a29827a845eda419d5bb6b41c3a4b1df | refs/heads/master | 2021-03-04T15:18:10.110223 | 2020-03-09T11:34:42 | 2020-03-09T11:34:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,443 | java | package org.jeecg.modules.bee.mapper;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.bee.entity.HistoryOper;
import org.jeecg.modules.bee.entity.HistoryOperExample;
public interface HistoryOperMapper {
long countByExample(HistoryOperExample example);
int deleteByExample(HistoryOperExample example);
int deleteByPrimaryKey(Integer id);
int insert(HistoryOper record);
int insertSelective(HistoryOper record);
List<HistoryOper> selectByExample(HistoryOperExample example);
HistoryOper selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") HistoryOper record, @Param("example") HistoryOperExample example);
int updateByExample(@Param("record") HistoryOper record, @Param("example") HistoryOperExample example);
int updateByPrimaryKeySelective(HistoryOper record);
int updateByPrimaryKey(HistoryOper record);
/**
* 查询所有蜂箱最后一次喂食记录
* @return
*/
List<HistoryOper> selectEveryLastOperHistory();
/**
* 查询蜂箱历史操作记录
* @param bbid
* @param time
* @return
*/
List<HistoryOper> selectHistoryOperByBbid(String bbid, Date time);
/**
* 查询蜂箱历史操作记录
* @param uid
* @param time
* @return
*/
List<HistoryOper> selectHistoryOperByUid(String uid,Date time);
} | [
"1002066938@qq.com"
] | 1002066938@qq.com |
e8bad0a7f985154713587d493971e7d50100a301 | f93fbc53035c8096ef144cce4c04513cb26122c8 | /src/main/java/com/tarterware/tictactoe/Constants.java | 3dfae8f08216a04f6119acba721ead6a001f6f15 | [] | no_license | avitiwari008/tictactoe | ad1e96c18401bfe074e144c187c3e8d53567df2f | dd22f4eaf305d5858bf38d883f0341e82a1f0d98 | refs/heads/master | 2021-09-13T15:44:11.811539 | 2018-05-01T18:45:47 | 2018-05-01T18:45:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package com.tarterware.tictactoe;
public class Constants {
public static final String GAME_STATE = "gameState";
public static final String VIEW_START = "start";
public static final String VIEW_PLAYER_SELECT = "playerselect";
public static final String VIEW_GAME = "tictactoe";
}
| [
"noreply@github.com"
] | noreply@github.com |
d3db52e0302d129a2207a6a0004d5edf1b1bf9c2 | b1a9cdef563bf8c54ea73d03a645c77944ab274e | /kei-ba-oh/src/Beans/DAO.java | f72d8364689c590c2a3eb14259989599278ba9f0 | [] | no_license | bold6th/test | 7bb86cc6c36e4cdabc1f7fb03ecbb1c3190adfe1 | f673e44809bc781c4a187ebcbdc9b6f31c15876e | refs/heads/master | 2023-08-09T06:58:33.186390 | 2020-01-09T15:32:07 | 2020-01-09T15:32:07 | 226,678,166 | 0 | 0 | null | 2023-07-22T23:47:37 | 2019-12-08T14:13:30 | Java | UTF-8 | Java | false | false | 1,334 | java | /*
* データベースからの値の取得・データベースへの値の挿入を行う
*/
package Beans;
public class DAO {
/*
* レース一覧ページに表示する値を取得します。
* param:page 現在のページを表す。
*/
public void getPrev(int page) {
}
//レース結果から払い戻しテーブルに表示する要素を求めます。
public RaceDetailForm getReturnAndOdds(RaceDetailForm rdf) {
OddsAndReturnForm orf = new OddsAndReturnForm();
//1着から3着までの競走馬の馬番・枠番・単勝人気を取得する。
for(Racehorse rh:rdf.horses) {
if(rh.getPlace() == 1) {
orf.setFirstHorsenum(rh.getHorsenum());
orf.setFirstPopular(rh.getPopular());
orf.setFirstHorseflame(rh.getFlame());
}
if(rh.getPlace() == 2) {
orf.setSecondHorsenum(rh.getHorsenum());
orf.setSecondPopular(rh.getPopular());
orf.setSecondHorseflame(rh.getFlame());
}
if(rh.getPlace() == 3) {
orf.setThirdHorsenum(rh.getHorsenum());
orf.setThirdPopular(rh.getPopular());
orf.setThirdHorseflame(rh.getFlame());
}
}
//単勝オッズを取得する。
//オッズ情報を取得する。
//SELECTで取得した体
rdf.setOrf(orf);
return rdf;
}
}
| [
"mp5a1@192.168.1.106"
] | mp5a1@192.168.1.106 |
15f90b0fbfb2f067467325bb3552bfd31c417a2e | c08b783f1e98b368865a23ad7a033590f0591984 | /testApp/app/src/main/java/com/example/wuyunqiang/testapp/fastimage/FastImageViewConverter.java | 73ee363684452ce25d4e95291cbad651644ef332 | [] | no_license | severaldays/AndroidToRN | ac360db7e48982e39fd6c3e2927eaf16cc29c895 | 8196695e8363d4d7f30377dfa4418329a062ba60 | refs/heads/master | 2020-03-17T16:26:14.974409 | 2018-05-16T09:54:10 | 2018-05-16T09:54:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,604 | java | package com.example.wuyunqiang.testapp.fastimage;
import android.widget.ImageView.ScaleType;
import com.bumptech.glide.Priority;
import com.bumptech.glide.load.model.GlideUrl;
import com.bumptech.glide.load.model.LazyHeaders;
import com.facebook.react.bridge.NoSuchKeyException;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.ReadableMapKeySetIterator;
import java.util.HashMap;
import java.util.Map;
class FastImageViewConverter {
static GlideUrl glideUrl(ReadableMap source) {
final String uriProp = source.getString("uri");
// Get the headers prop and add to glideUrl.
GlideUrl glideUrl;
try {
final ReadableMap headersMap = source.getMap("headers");
ReadableMapKeySetIterator headersIterator = headersMap.keySetIterator();
LazyHeaders.Builder headersBuilder = new LazyHeaders.Builder();
while (headersIterator.hasNextKey()) {
String key = headersIterator.nextKey();
String value = headersMap.getString(key);
headersBuilder.addHeader(key, value);
}
LazyHeaders headers = headersBuilder.build();
glideUrl = new GlideUrl(uriProp, headers);
} catch (NoSuchKeyException e) {
// If there is no headers object.
glideUrl = new GlideUrl(uriProp);
}
return glideUrl;
}
private static Map<String, Priority> REACT_PRIORITY_MAP =
new HashMap<String, Priority>() {{
put("low", Priority.LOW);
put("normal", Priority.NORMAL);
put("high", Priority.HIGH);
}};
static Priority priority(ReadableMap source) {
// Get the priority prop.
String priorityProp = "normal";
try {
priorityProp = source.getString("priority");
} catch (Exception e) {
// Noop.
}
final Priority priority = REACT_PRIORITY_MAP.get(priorityProp);
return priority;
}
private static Map<String, ScaleType> REACT_RESIZE_MODE_MAP =
new HashMap<String, ScaleType>() {{
put("contain", ScaleType.FIT_CENTER);
put("cover", ScaleType.CENTER_CROP);
put("stretch", ScaleType.FIT_XY);
put("center", ScaleType.CENTER);
}};
public static ScaleType scaleType(String resizeMode) {
if (resizeMode == null) resizeMode = "contain";
final ScaleType scaleType = REACT_RESIZE_MODE_MAP.get(resizeMode);
return scaleType;
}
}
| [
"2801213940@qq.com"
] | 2801213940@qq.com |
cf6b21ca197c238093327c0668232cd9aebe59ff | f3331661828062975f6ef9f801713811370cb662 | /src/main/java/com/practice/concurrent/Reen.java | 2d3c310c9b44dca91037a0fe84259a9cf8d4a804 | [] | no_license | dkwx/practice | 6a98715f66dea608a6af2b7073fdebbec080f794 | 850420d9b93f6ead4886b35b0cf9ab30ab9bbd21 | refs/heads/master | 2023-02-15T01:35:31.968790 | 2020-12-31T08:01:45 | 2020-12-31T08:01:45 | 260,921,394 | 0 | 0 | null | 2020-05-23T02:58:31 | 2020-05-03T13:09:52 | Java | UTF-8 | Java | false | false | 113 | java | package com.practice.concurrent;
/**
* @author : kai.dai
* @date : 2020-05-24 17:50
*/
public class Reen {
}
| [
"kai.dai@qunar.com"
] | kai.dai@qunar.com |
573ce3e97d4d5fd51c78661c5d91ba44a587e8e2 | 96b26e027e5ca4ae9cf217afd39b17061fc23b4b | /perf-noop/src/main/java/com/xander/performance/PERF.java | 8a932d8b77c3b00772b7abbac5b933dbc52ca4e3 | [
"Apache-2.0"
] | permissive | andyzeng114/performance | e81937a9101923758cc115d38e7c2a9f2ff52b12 | 283433e330a53264f09c207a14028ea294a8750d | refs/heads/master | 2023-03-25T02:18:59.052799 | 2021-03-25T10:02:53 | 2021-03-25T10:02:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | package com.xander.performance;
import java.io.File;
public class PERF {
public static class Builder {
public Builder checkUI(boolean check) {
return this;
}
public Builder checkUI(boolean check, long blockTime) {
return this;
}
public Builder checkThread(boolean check) {
return this;
}
public Builder checkThread(boolean check, long threadBlockTime) {
return this;
}
public Builder checkFps(boolean check) {
return this;
}
public Builder checkFps(boolean check, long fpsIntervalTime) {
return this;
}
public Builder checkIPC(boolean check) {
return this;
}
public Builder globalTag(String tag) {
return this;
}
public Builder cacheDirSupplier(IssueSupplier<File> cache) {
return this;
}
public Builder maxCacheSizeSupplier(IssueSupplier<Integer> cacheSize) {
return this;
}
public Builder uploaderSupplier(IssueSupplier<LogFileUploader> uploader) {
return this;
}
public Builder logLevel(int level) {
return this;
}
public Builder build() {
return this;
}
}
public interface IssueSupplier<T> {
T get();
}
public interface LogFileUploader {
boolean upload(File logFile);
}
public static void init(Builder builder) {
}
}
| [
"420640763@qq.com"
] | 420640763@qq.com |
61b9eb7242eb19ba3150e8ce7b143967b2e9d325 | a5181cd227671eba880d613482bcef206312f730 | /core/src/test/java/io/neba/core/resourcemodels/mapping/CyclicMappingSupportTest.java | d503cbccf3d6a7b6ee621e895cf895097045734a | [
"Apache-2.0"
] | permissive | yvesKuonen/neba | 8ecd0c7163afe3a06268b844202f3626a8365edb | 0de76fd6d6c0a9deea4050d85282e462402796b2 | refs/heads/master | 2021-01-18T11:51:16.330453 | 2014-10-23T11:07:49 | 2014-10-23T11:07:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,733 | java | /**
* Copyright 2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/
package io.neba.core.resourcemodels.mapping;
import io.neba.core.resourcemodels.metadata.ResourceModelMetaData;
import io.neba.core.resourcemodels.metadata.ResourceModelStatistics;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.verification.VerificationMode;
import java.util.Set;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/**
* @author Olaf Otto
*/
@RunWith(MockitoJUnitRunner.class)
public class CyclicMappingSupportTest {
@Mock
private ResourceModelStatistics statistics;
@Mock
private ResourceModelMetaData metaData;
private Mapping mapping;
private Mapping<?> alreadyOngoingMapping;
private Set<Mapping> ongoingMappings;
@InjectMocks
private CyclicMappingSupport testee;
@Before
public void setUp() throws Exception {
withNewMapping();
}
@Test
public void testCycleDetection() throws Exception {
beginMapping();
assertMappingWasNotAlreadyStarted();
beginMapping();
assertAlreadyStartedMappingIsDetected();
}
@Test
public void testMappingCanBeginAgainAfterItHasEnded() throws Exception {
beginMapping();
assertMappingWasNotAlreadyStarted();
endMapping();
beginMapping();
assertMappingWasNotAlreadyStarted();
}
@Test
public void testOngoingMappingsAreEmptyWithoutMappings() throws Exception {
getOngoingMappings();
assertOngoingMappingsAreEmpty();
}
@Test
public void testOngoingMappingsAreEmptyAfterMappingEnds() throws Exception {
beginMapping();
endMapping();
getOngoingMappings();
assertOngoingMappingsAreEmpty();
}
@Test
public void testOngoingMappingsContainOngoingMapping() throws Exception {
beginMapping();
getOngoingMappings();
assertOngoingMappingsContainMapping();
}
@Test
public void testTrackingOfMappingDepths() throws Exception {
beginMapping();
verifyMappingIsNotTracked();
withNewMapping();
beginMapping();
verifyMappingIsTrackedWithDepth(1);
withNewMapping();
beginMapping();
verifyMappingIsTrackedWithDepth(times(2), 1);
verifyMappingIsTrackedWithDepth(2);
}
private void verifyMappingIsNotTracked() {
verify(this.statistics, never()).countMappingDuration(anyInt());
}
private void verifyMappingIsTrackedWithDepth(VerificationMode times, int depth) {
verify(this.statistics, times).countMappings(depth);
}
private void verifyMappingIsTrackedWithDepth(int depth) {
verifyMappingIsTrackedWithDepth(times(1), depth);
}
private void assertOngoingMappingsContainMapping() {
assertThat(this.ongoingMappings).contains(this.mapping);
}
private void assertOngoingMappingsAreEmpty() {
assertThat(this.ongoingMappings).isEmpty();
}
private void getOngoingMappings() {
this.ongoingMappings = this.testee.getOngoingMappings();
}
private void endMapping() {
this.testee.end(this.mapping);
}
private void assertAlreadyStartedMappingIsDetected() {
assertThat(this.alreadyOngoingMapping).isNotNull();
}
@SuppressWarnings("unchecked")
private void beginMapping() {
this.alreadyOngoingMapping = this.testee.begin(this.mapping);
}
private void assertMappingWasNotAlreadyStarted() {
assertThat(this.alreadyOngoingMapping).isNull();
}
private void withNewMapping() {
this.mapping = mock(Mapping.class);
doReturn(this.metaData).when(this.mapping).getMetadata();
doReturn(this.statistics).when(this.metaData).getStatistics();
}
}
| [
"olaf.otto@unic.com"
] | olaf.otto@unic.com |
d3f0150ecca747560d2c17624c6094dea9e111b6 | 1e3ab6ccda5725a2c50a67ba0e44ebf05d3c59be | /src/main/java/com/javaGG/springMVCBoard/command/BReplyViewCommand.java | d1870502150dfe92a9cef343b855315d82179a8c | [] | no_license | znzty15/springMVCBoard_JDBC | f020ba93a490962b3fb772a998befc0ac9b305f6 | 457fb79f32019fdce3762affd0487195b64def3f | refs/heads/master | 2023-08-27T21:02:15.139528 | 2021-11-04T05:57:59 | 2021-11-04T05:57:59 | 424,116,672 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 674 | java | package com.javaGG.springMVCBoard.command;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.ui.Model;
import com.javaGG.springMVCBoard.dao.BDao;
import com.javaGG.springMVCBoard.dto.BDto;
public class BReplyViewCommand implements BCommand {
@Override
public void excute(Model model) {
// TODO Auto-generated method stub
Map<String, Object> map = model.asMap();
HttpServletRequest request = (HttpServletRequest) map.get("request");
String bId = request.getParameter("bId");
BDao dao = new BDao();
BDto dto = dao.reply_view(bId);
model.addAttribute("reply_view", dto);
}
}
| [
"89904365+znzty15@users.noreply.github.com"
] | 89904365+znzty15@users.noreply.github.com |
a64f93081598225767941cf449c672d5e6ff842c | d00b87d74e3d96ab6b8b6ef47056719fa2841399 | /src/main/java/controller/ChatChange.java | 8ef7059e2bea6f2526fcfdccd3d8a7e52930c47e | [] | no_license | frankpolimi/Council-of-Four | 881b1855293b72dd0e965de3252846341aa7e91a | 5137a585f40c0bc03699749391462ef9ed1c0c8e | refs/heads/master | 2020-05-23T10:14:41.986625 | 2017-01-30T09:17:48 | 2017-01-30T09:17:48 | 80,407,090 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 623 | java | package controller;
public class ChatChange extends Change {
/**
*
*/
private static final long serialVersionUID = 7083922426560549897L;
private final String message;
private final String ownersName;
private final int id;
public ChatChange(String message, String string, int id) {
this.message=message;
this.ownersName=string;
this.id=id;
}
/**
* @return the message
*/
public String getMessage() {
return message;
}
/**
* @return the ownersName
*/
public String getOwnersName() {
return ownersName;
}
/**
* @return the id
*/
public int getId() {
return id;
}
}
| [
"emanuele.ricciardelli@mail.polimi.it"
] | emanuele.ricciardelli@mail.polimi.it |
19411aba50b722facf102207bd9ef4c0499256bf | 7366bb2257de76ed5ffd6ab2a086a23c1b2dfcbf | /src/clases/Ejemplo1.java | e709497bf7f0bc0713ffdf11cafeafce639aa34c | [] | no_license | Julian990/Analizador_Lexico | 18efdcc679648ad8e21a01502ce8aeb22e09abe7 | c35dbf4530ef82735e596cce944932a237a3a339 | refs/heads/master | 2022-12-14T21:20:14.773447 | 2020-09-18T02:58:28 | 2020-09-18T02:58:28 | 291,125,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 171 | java | package clases;
public class Ejemplo1{
public static void main(String [] args){
int x = 0;
try{
int y = 5;
int x = y * 3;
}catch(Exception e){
}
}
} | [
"nora.it270@gmail.com"
] | nora.it270@gmail.com |
d7aded726e978258bb1dd6dad251e422bf5aee62 | 841244d6118ec6208ca69b22e0c40df4cf4c3b5b | /code/client/src/java/com/sunzhongyang/sjd/androidmail/Controller.java | cc44797df2da8fffb627d26d26ac27333ca8a1d8 | [] | no_license | SJD095/AndroidMail | 37102f1fcfc0151e9a022a3670971551b825e89b | f11fad2e46fa5a856ec131d3f60ecc3196c21505 | refs/heads/master | 2021-01-13T03:38:19.765855 | 2017-01-20T01:29:11 | 2017-01-20T01:29:11 | 77,270,359 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 833 | java | package com.sunzhongyang.sjd.androidmail;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.Toast;
import java.util.Random;
/**
* Created by SJD on 12/17/16.
*/
public class Controller
{
public String sendMailURL = "http://sunzhongyang.com:7001/send";
public String receiveMailURL = "http://sunzhongyang.com:7001/check";
//显示一个通知
public void makeToast(Activity activity, String toastContent)
{
Toast.makeText(activity, toastContent, Toast.LENGTH_SHORT).show();
}
}
| [
"szy@sunzhongyang.com"
] | szy@sunzhongyang.com |
bb8ddaba8d8f64c90a49838da970b204c485ce48 | 647ec12ce50f06e7380fdbfb5b71e9e2d1ac03b4 | /com.tencent.mm/classes.jar/com/tencent/mm/plugin/appbrand/jsapi/JsApiLaunchApplication$LaunchApplicationTask$2.java | e9f961dc100eafbc46b6e85f8801bab87e0dd4ef | [] | no_license | tsuzcx/qq_apk | 0d5e792c3c7351ab781957bac465c55c505caf61 | afe46ef5640d0ba6850cdefd3c11badbd725a3f6 | refs/heads/main | 2022-07-02T10:32:11.651957 | 2022-02-01T12:41:38 | 2022-02-01T12:41:38 | 453,860,108 | 36 | 9 | null | 2022-01-31T09:46:26 | 2022-01-31T02:43:22 | Java | UTF-8 | Java | false | false | 467 | java | package com.tencent.mm.plugin.appbrand.jsapi;
import android.os.Parcelable.Creator;
final class JsApiLaunchApplication$LaunchApplicationTask$2
implements Parcelable.Creator<JsApiLaunchApplication.LaunchApplicationTask>
{}
/* Location: L:\local\mybackup\temp\qq_apk\com.tencent.mm\classes10.jar
* Qualified Name: com.tencent.mm.plugin.appbrand.jsapi.JsApiLaunchApplication.LaunchApplicationTask.2
* JD-Core Version: 0.7.0.1
*/ | [
"98632993+tsuzcx@users.noreply.github.com"
] | 98632993+tsuzcx@users.noreply.github.com |
ca412964951a58e5f1bde3e60c7c29b6a678493f | 587ed2f9bc8b5c12d3f5aded6650b315fc9977c9 | /patient/src/main/java/be/hogent/oefening/patient/business/repository/PatientRepository.java | 6db7fdbac5eb4f8b14929989ec777e2ba780f279 | [] | no_license | KevinVP83/HoGent_Oef_Rest | 0193445a0ce9ad0a1273433bfa2e8d8361115938 | 9099c68cb707be29f5f64813ece9741895dda46d | refs/heads/master | 2023-01-05T09:08:57.235188 | 2020-10-31T14:29:56 | 2020-10-31T14:29:56 | 308,899,977 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 320 | java | package be.hogent.oefening.patient.business.repository;
import be.hogent.oefening.patient.business.PatientEntity;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface PatientRepository extends CrudRepository<PatientEntity, Long> {
}
| [
"k.van.parys@outlook.com"
] | k.van.parys@outlook.com |
43b3e8b80c9db694352add7e89d0896e131b86ad | 99cca9660c13f4956b765c245cf0ae50d374150e | /maprfs-protolib/src/main/java/com/streamsets/pipeline/stage/origin/maprfs/ClusterMapRFSDSource.java | f8f8ac845f85c751d2953d9b06c8e70737541b15 | [
"Apache-2.0"
] | permissive | liujinliang99/datacollector | 5dc573376338fadc1d1b440dbb8170f0cb6dc45c | 51eb81bdc946e631b7e7d60f181a1c09ca5a982a | refs/heads/master | 2021-01-10T22:38:15.345025 | 2016-09-28T02:26:07 | 2016-09-28T23:02:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,376 | java | /**
* Copyright 2016 StreamSets Inc.
*
* Licensed under the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.streamsets.pipeline.stage.origin.maprfs;
import com.streamsets.pipeline.api.ExecutionMode;
import com.streamsets.pipeline.api.GenerateResourceBundle;
import com.streamsets.pipeline.api.HideConfigs;
import com.streamsets.pipeline.api.Source;
import com.streamsets.pipeline.api.StageDef;
import com.streamsets.pipeline.stage.origin.hdfs.cluster.ClusterHdfsDSource;
@StageDef(
version = 1,
label = "MapR FS",
description = "Reads from a MapR filesystem",
execution = ExecutionMode.CLUSTER_BATCH,
libJarsRegex = {"avro-\\d+.*", "avro-mapred.*"},
icon = "mapr.png",
privateClassLoader = false,
onlineHelpRefUrl = "index.html#Origin/MapRFS-origin.html"
)
@HideConfigs(value =
{
"clusterHDFSConfigBean.dataFormatConfig.schemaInMessage",
"clusterHDFSConfigBean.dataFormatConfig.compression",
"clusterHDFSConfigBean.dataFormatConfig.includeCustomDelimiterInTheText"
}
)
@GenerateResourceBundle
public class ClusterMapRFSDSource extends ClusterHdfsDSource {
private ClusterMapRFSSource clusterMapRFSSource;
@Override
protected Source createSource() {
if(clusterHDFSConfigBean.hdfsUri == null || clusterHDFSConfigBean.hdfsUri.isEmpty()) {
clusterHDFSConfigBean.hdfsUri = "maprfs:///";
}
clusterMapRFSSource = new ClusterMapRFSSource(clusterHDFSConfigBean);
return clusterMapRFSSource;
}
@Override
public Source getSource() {
return clusterMapRFSSource;
}
}
| [
"virag@streamsets.com"
] | virag@streamsets.com |
6e1495bf6bf90edd1e5fdb8c7febfbad8f090921 | 08d373f31a0d737be9e7bcfe23fb38bc56bbfae2 | /src/ua/nure/nikonova/bloodbank/logic/EventPlanner.java | e9593203c08b1c2f8ad9082e09b9b33341dff2af | [] | no_license | annnikon/BloodBank | ad00521c28a8a193f267329f6c04ce34049a9e46 | 6c5bada4de4221f98d69e7919b648d21d812c1ec | refs/heads/master | 2021-01-23T11:39:56.595153 | 2017-09-06T17:22:50 | 2017-09-06T17:22:50 | 102,633,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,309 | java | package ua.nure.nikonova.bloodbank.logic;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import ua.nure.nikonova.bloodbank.dao.PersonDAO;
import ua.nure.nikonova.bloodbank.model.Event;
import ua.nure.nikonova.bloodbank.model.Person;
public class EventPlanner {
public static int MIN_INTERVAL = 30;
public static int MONTH_COUNT = 6;
Date lastDate, goodDate;
List <Date> futureDates;
public EventPlanner(Event event) {
if (event==null) this.lastDate=null;
else {this.lastDate=event.getDate(); }
futureDates=new ArrayList<Date> ();
findDates();
}
public List<Date> getfutereDates() {
return futureDates;
}
void findDates() {
Calendar c = Calendar.getInstance();
if (lastDate==null) {
goodDate = new Date();
}
else {
c.setTime(lastDate);
c.add(Calendar.DATE, MIN_INTERVAL);
goodDate = c.getTime();
}
futureDates.add(goodDate);
c.setTime(goodDate);
for (int i=0; i<MONTH_COUNT; i++) {
c.add(Calendar.DATE, MIN_INTERVAL);
futureDates.add(c.getTime());
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
for(Date d:futureDates) {
sb.append(d.toGMTString()).append(";");
}
return sb.toString();
}
}
| [
"nikon.ann@yandex.ua"
] | nikon.ann@yandex.ua |
74df82278e868e4afe7665c6f03fb68db42c75b0 | fbcc3b4b424c9d71e076593787007f9247f463d1 | /src/main/java/com/yoyo/chunze/app/AsyncConfiguration.java | 4d56db6f28230bdb290f06b8b4ca4d1ef07c2d3e | [] | no_license | helmsli/chunze-k12 | 179ecd78816ec14ac2bacd87cee9c133e0cc3ba5 | 17fd1878b78cd3ea6f7c12667c2b05449f847d0a | refs/heads/master | 2021-06-17T18:15:20.432246 | 2019-09-30T02:14:06 | 2019-09-30T02:14:06 | 201,170,726 | 0 | 0 | null | 2021-04-26T19:36:30 | 2019-08-08T03:26:46 | TSQL | UTF-8 | Java | false | false | 1,693 | java | package com.yoyo.chunze.app;
import java.lang.reflect.Method;
import java.util.concurrent.Executor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@Configuration
@EnableAsync
public class AsyncConfiguration implements AsyncConfigurer {
private Logger logger = LoggerFactory.getLogger(getClass());
@Value("${async.corePoolSize:7}")
private int corePoolSize;
@Value("${async.maxPoolSize:42}")
private int maxPoolSize;
@Value("${async.queueCapacity:500}")
private int queueCapacity;
@Override
public Executor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setThreadNamePrefix("CounterExecutor-");
executor.initialize();
return executor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
// TODO Auto-generated method stub
return new SpringAsyncExceptionHandler();
}
class SpringAsyncExceptionHandler implements AsyncUncaughtExceptionHandler {
@Override
public void handleUncaughtException(Throwable arg0, Method arg1, Object... arg2) {
// TODO Auto-generated method stub
logger.error("Exception occurs in async method", arg0);
}
}
}
| [
"liguoqiang@bj.xinwei.com.cn"
] | liguoqiang@bj.xinwei.com.cn |
ffb0f72a3961243acd036207389ce32dc4e56344 | 6b947884a2b8eff1feeb2a70dec063ff8ee15b57 | /app/src/main/java/assistive/com/scanme/com/googlecode/eyesfree/utils/ClassLoadingManager.java | a3420e042b865dd5aa7f776f9b5b7d278deaffc8 | [] | no_license | AndreFPRodrigues/scanMe | 3fbb3f2e423c830a8c72a2c555585b15188e0bd2 | 5420f8a5544196646545c42724ae88d86839219b | refs/heads/master | 2021-01-17T06:00:37.992971 | 2015-08-11T16:38:08 | 2015-08-11T16:38:08 | 40,005,192 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,115 | java | /*
* Copyright (C) 2010 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 assistive.com.scanme.com.googlecode.eyesfree.utils;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.text.TextUtils;
import android.util.Log;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
/**
* This class manages efficient loading of classes.
*
* @author svetoslavganov@google.com (Svetoslav R. Ganov)
* @author alanv@google.com (Alan Viverette)
*/
public class ClassLoadingManager {
/**
* The singleton instance of this class.
*/
private static ClassLoadingManager sInstance;
/**
* Mapping from class names to classes form outside packages.
*/
private final HashMap<String, Class<?>> mClassNameToClassMap = new HashMap<String, Class<?>>();
/**
* A set of classes not found to be loaded. Used to avoid multiple attempts
* that will fail.
*/
private final HashMap<String, HashSet<String>> mNotFoundClassesMap =
new HashMap<String, HashSet<String>>();
/**
* Cache of installed packages to avoid class loading attempts
*/
private final HashSet<String> mInstalledPackagesSet = new HashSet<String>();
/**
* The singleton instance of this class.
*
* @return The singleton instance of this class.
*/
public static ClassLoadingManager getInstance() {
if (sInstance == null) {
sInstance = new ClassLoadingManager();
}
return sInstance;
}
/**
* Builds the package cache and registers the package monitor
*
* @param context The {@link Context} to use for monitor registration
*/
public void init(Context context) {
buildInstalledPackagesCache(context);
mPackageMonitor.register(context);
}
/**
* Clears the package cache and unregisteres the package monitor
*/
public void shutdown() {
clearInstalledPackagesCache();
mClassNameToClassMap.clear();
mPackageMonitor.unregister();
}
/**
* Builds a cache of installed packages.
*/
private void buildInstalledPackagesCache(Context context) {
final List<PackageInfo> installedPackages =
context.getPackageManager().getInstalledPackages(0);
for (PackageInfo installedPackage : installedPackages) {
addInstalledPackageToCache(installedPackage.packageName);
}
}
/**
* Adds the specified package to the installed package cache.
*
* @param packageName The package name to add.
*/
private void addInstalledPackageToCache(String packageName) {
synchronized (mInstalledPackagesSet) {
mInstalledPackagesSet.add(packageName);
mNotFoundClassesMap.remove(packageName);
}
}
/**
* Removes the specified package from the installed package cache.
*
* @param packageName The package name to remove.
*/
private void removeInstalledPackageFromCache(String packageName) {
synchronized (mInstalledPackagesSet) {
mInstalledPackagesSet.remove(packageName);
}
}
/**
* Clears the installed package cache.
*/
private void clearInstalledPackagesCache() {
synchronized (mInstalledPackagesSet) {
mInstalledPackagesSet.clear();
}
}
/**
* Returns a class by given <code>className</code>. The loading proceeds as
* follows: </br> 1. Try to load with the current context class loader (it
* caches loaded classes). </br> 2. If (1) fails try if we have loaded the
* class before and return it if that is the cases. </br> 3. If (2) failed,
* try to create a package context and load the class. </p> Note: If the
* package name is null and an attempt for loading of a package context is
* required the it is extracted from the class name.
*
* @param context The context from which to first try loading the class.
* @param className The name of the class to load.
* @param packageName The name of the package to which the class belongs.
* @return The class if loaded successfully, null otherwise.
*/
public Class<?> loadOrGetCachedClass(Context context, CharSequence className,
CharSequence packageName) {
if (TextUtils.isEmpty(className)) {
LogUtils.log(this, Log.DEBUG, "Missing class name. Failed to load class.");
return null;
}
// If we don't know the package name, get it from the class name.
if (TextUtils.isEmpty(packageName)) {
final int lastDotIndex = TextUtils.lastIndexOf(className, '.');
if (lastDotIndex < 0) {
LogUtils.log(this, Log.DEBUG, "Missing package name. Failed to load class: %s",
className);
return null;
}
packageName = TextUtils.substring(className, 0, lastDotIndex);
}
final String classNameStr = className.toString();
final String packageNameStr = packageName.toString();
// If we failed loading this class once, don't bother trying again.
HashSet<String> notFoundClassesSet = null;
synchronized (mInstalledPackagesSet) {
notFoundClassesSet = mNotFoundClassesMap.get(packageNameStr);
if ((notFoundClassesSet != null) && notFoundClassesSet.contains(classNameStr)) {
return null;
}
}
// See if we have a cached class.
final Class<?> clazz = mClassNameToClassMap.get(classNameStr);
if (clazz != null) {
return clazz;
}
// Try the current ClassLoader.
try {
final Class<?> insideClazz = getClass().getClassLoader().loadClass(classNameStr);
if (insideClazz != null) {
mClassNameToClassMap.put(classNameStr, insideClazz);
return insideClazz;
}
} catch (ClassNotFoundException e) {
// Do nothing.
}
// Context is required past this point.
if (context == null) {
return null;
}
// Attempt to load class by creating a package context.
try {
final int flags = (Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
final Context packageContext = context.createPackageContext(packageNameStr, flags);
final Class<?> outsideClazz = packageContext.getClassLoader().loadClass(classNameStr);
if (outsideClazz != null) {
mClassNameToClassMap.put(classNameStr, outsideClazz);
return outsideClazz;
}
} catch (Exception e) {
LogUtils.log(this, Log.ERROR, "Error encountered. Failed to load outside class: %s",
classNameStr);
}
if (notFoundClassesSet == null) {
notFoundClassesSet = new HashSet<String>();
mNotFoundClassesMap.put(packageNameStr, notFoundClassesSet);
}
notFoundClassesSet.add(classNameStr);
LogUtils.log(Log.DEBUG, "Failed to load class: %s", classNameStr);
return null;
}
/**
* Returns whether a target class is an instance of a reference class.
* <p>
* If a class cannot be loaded by the default {@link ClassLoader}, this
* method will attempt to use the loader for the specified app package.
* </p>
*/
public boolean checkInstanceOf(Context context, CharSequence targetClassName,
CharSequence loaderPackage, CharSequence referenceClassName) {
if ((targetClassName == null) || (referenceClassName == null)) {
return false;
}
// Try a shortcut for efficiency.
if (TextUtils.equals(targetClassName, referenceClassName)) {
return true;
}
final Class<?> referenceClass = loadOrGetCachedClass(
context, referenceClassName, loaderPackage);
if (referenceClass == null) {
return false;
}
return checkInstanceOf(context, targetClassName, loaderPackage, referenceClass);
}
/**
* Returns whether a target class is an instance of a reference class.
* <p>
* If a class cannot be loaded by the default {@link ClassLoader}, this
* method will attempt to use the loader for the specified app package.
* </p>
*/
public boolean checkInstanceOf(Context context, CharSequence targetClassName,
CharSequence loaderPackage, Class<?> referenceClass) {
if ((targetClassName == null) || (referenceClass == null)) {
return false;
}
final Class<?> targetClass = loadOrGetCachedClass(context, targetClassName, loaderPackage);
if (targetClass == null) {
return false;
}
return referenceClass.isAssignableFrom(targetClass);
}
/**
* Monitor to keep track of the installed packages.
*/
private final BasePackageMonitor mPackageMonitor = new BasePackageMonitor() {
@Override
protected void onPackageAdded(String packageName) {
addInstalledPackageToCache(packageName);
}
@Override
protected void onPackageRemoved(String packageName) {
removeInstalledPackageFromCache(packageName);
}
@Override
protected void onPackageChanged(String packageName) {
// Do nothing.
}
};
}
| [
"andrefprodrigues91@gmail.com"
] | andrefprodrigues91@gmail.com |
d95f5216a5aabdbbef6a55468208493574712990 | a2294ffd8955a18de5b805414a1f2c758fea4d51 | /src/com/project/reversepojos/TableExpense.java | 0380e19350ed0fb96efaec5ff740f7c5a4a69606 | [] | no_license | vikaspathneja/ExpenseManger | 5b3ce2e15ca10c9be06ce8821534cb7d25a7ca77 | b1db6e6f87590a05c966f832c7717de75d4ccca2 | refs/heads/master | 2022-09-09T10:44:37.558834 | 2020-09-16T14:13:38 | 2020-09-16T14:13:38 | 140,467,698 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,617 | java | package com.project.reversepojos;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@Table(name = "table_expense")
public class TableExpense implements Serializable {
private static final long serialVersionUID = 1L;
public TableExpense() {
System.out.println("0 arg ctor called");
}
@Id
@GeneratedValue
private int expenseId;
@Column(name = "user_id")
private long userId;
public TableExpense(long userid) {
this.userId = userid;
}
@Column(name = "expense_category_id")
//@OneToOne(mappedBy="TableExpenseCategory" , cascade =CascadeType.ALL)
//@JoinColumn(name = "expenseCategoryId")
private int expenseCategoryId;
@Column(name = "payment_mode_id")
private int paymentModeId;
@Column(name = "expense_description")
private String expenseDescription;
@Column(name = "expense_amount")
private int expenseAmount;
@Temporal(TemporalType.DATE)
@Column(name = "expense_date")
private Date expenseDate;
public long getUserId() {
return userId;
}
public void setUserId(long userid) {
this.userId = userid;
}
public int getExpenseCategoryId() {
return expenseCategoryId;
}
public void setExpenseCategoryId(int expenseCategoryId) {
this.expenseCategoryId = expenseCategoryId;
}
public int getPaymentModeId() {
return paymentModeId;
}
public void setPaymentModeId(int paymentModeId) {
this.paymentModeId = paymentModeId;
}
public String getExpenseDescription() {
return expenseDescription;
}
public void setExpenseDescription(String expenseDescription) {
this.expenseDescription = expenseDescription;
}
public int getExpenseAmount() {
return expenseAmount;
}
public void setExpenseAmount(int expenseAmount) {
this.expenseAmount = expenseAmount;
}
public Date getExpenseDate() {
return expenseDate;
}
public void setExpenseDate(Date expenseDate) {
this.expenseDate = expenseDate;
}
public int getExpenseId() {
return expenseId;
}
public void setExpenseId(int expenseId) {
this.expenseId = expenseId;
}
@Override
public String toString() {
return "\nTableExpense [expenseId=" + expenseId + ", userId=" + userId + ", expenseCategoryId="
+ expenseCategoryId + ", paymentModeId=" + paymentModeId + ", expenseDescription=" + expenseDescription
+ ", expenseAmount=" + expenseAmount + ", expenseDate=" + expenseDate + "]";
}
}
| [
"vikaspathneja@gmail.com"
] | vikaspathneja@gmail.com |
c061a34ec67a7ccd87e269b0e6ca226438c2bbbf | 148d1a0d665c402682cb03519cd07e2aab5d7c7e | /ApkInstallClient/app/src/test/java/io/github/cjybyjk/apkinstallclient/ExampleUnitTest.java | d64975ee6eddc999f2829f69ac68fb502d0eed2c | [
"MIT"
] | permissive | cjybyjk/Duoqin_ApkInstall | 35c1cd4d163478bd97f0922ceea90c7ec6e7fecd | 498a10058e7b74521dbaa6f50c2f7f00dcd1e27f | refs/heads/master | 2020-07-21T14:42:12.287646 | 2019-09-07T09:06:30 | 2019-09-07T09:06:30 | 206,898,484 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package io.github.cjybyjk.apkinstallclient;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"cjybyjk@gmail.com"
] | cjybyjk@gmail.com |
eb46280918f8c72bacac4d7df69fcd13daf89bed | e55ef88b983b41cdf5145fbf98a6dd5e69f4e698 | /src/ui/Main.java | c60a23b8117036f02ae6cfbc06d1a7197498bd10 | [] | no_license | DEGED/voleibal-bst-linkedList | 640fa41f418f744b61f98f392c9876904972412d | 0c97579625b129256019ed3f200d5fbc510f34ad | refs/heads/master | 2020-05-24T05:49:39.491277 | 2019-05-18T20:32:45 | 2019-05-18T20:32:45 | 187,125,602 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 514 | java | package ui;
import java.io.IOException;
import model.VoleibolEvent;
public class Main {
public Main() {
}
public static void main(String[]args) throws IOException {
Main x = new Main();
VoleibolEvent po = new VoleibolEvent();
po.loadParticipants("data//MOCK_DATA (2).csv",",");
System.out.println(po.preOrder());
try {
po.loadParticipants("data//MOCK_DATA (2).csv",",");
po.preOrder();
po.findTeamCountry("thailand");
}catch(IOException oe){
oe.printStackTrace();
}
}
}
| [
"johann0117@live.com"
] | johann0117@live.com |
47224cf4d2c390109b0c3052343da0ecb8971719 | e705ea3a001ed23604fb2b4d85da04fc1a97b81b | /Answers/_221_MaximalSquare.java | cc144987382311886ce13008339219b0e9c8daf9 | [] | no_license | shitterlmj2016/Leetcode_java | 4b8f81f0f6338751222b45fe2b711082495396e4 | 92b2d6a83a8bfb49f3ea1bae6e641912d2160873 | refs/heads/master | 2020-04-15T22:54:46.831100 | 2019-04-15T03:05:15 | 2019-04-15T03:05:15 | 165,088,940 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,592 | java | /**
* 本代码来自 Cspiration,由 @Cspiration 提供
* 题目来源:http://leetcode.com
* - Cspiration 致力于在 CS 领域内帮助中国人找到工作,让更多海外国人受益
* - 现有课程:Leetcode Java 版本视频讲解(1-900题)(上)(中)(下)三部
* - 算法基础知识(上)(下)两部;题型技巧讲解(上)(下)两部
* - 节省刷题时间,效率提高2-3倍,初学者轻松一天10题,入门者轻松一天20题
* - 讲师:Edward Shi
* - 官方网站:https://cspiration.com
* - 版权所有,转发请注明出处
*/
public class _221_MaximalSquare {
/**
* 221. Maximal Square
* Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area.
For example, given the following matrix:
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Return 4.
time : O(m * n)
space : O(m * n)
* @param matrix
* @return
*/
public int maximalSquare(char[][] matrix) {
if (matrix.length == 0) return 0;
int m = matrix.length;
int n = matrix[0].length;
int res = 0;
int[][] dp = new int[m + 1][n + 1];
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++) {
if (matrix[i - 1][j - 1] == '1') {
dp[i][j] = Math.min(Math.min(dp[i][j - 1], dp[i - 1][j - 1]), dp[i - 1][j]) + 1;
res = Math.max(res, dp[i][j]);
}
}
}
return res * res;
}
}
| [
"xchuang1995@163.com"
] | xchuang1995@163.com |
dab4881b0ef8872390faebd561b02b8fe3a1596d | 1f5504774cfe07f1afb5b13b0d0bda0ca21ff96a | /worksheet_05/src/examples/Colour.java | e7725ae6fda1d7b5af5753561943567a83bf52ae | [] | no_license | chuck47286/JavaAssignments | b69227c88a61eef00d852b20709e3267552bc3f0 | b9bebcd067b64b68385b4f148f3b6fe2760d4fd4 | refs/heads/master | 2020-08-30T14:19:15.235892 | 2020-05-23T08:37:26 | 2020-05-23T08:37:26 | 218,406,621 | 5 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,979 | java | package examples;
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.Group;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
/**
* In this class, we test predefined colours. Some are predefined by
* constants such such as BLACK, RED and so on. They can also be
* defined by Color(r,g,b) where r,g,b are values between 0 and
* 255. r=red, g=green, and b=blue. 0,0,0 stands for black, 255,0,0
* for red, 0,255,0 for green, and 0,0,255 blue with other values in
* between. Values such as 100,100,100 represent different levels of grey.
*
* The example is adapted from
* <a href="https://www.tutorialspoint.com/javafx/javafx_colors.htm">
* www.tutorialspoint.com</a>.
*
* @version 2018-08-28
* @author Manfred Kerber
*/
public class Colour extends Application{
/**
* @param stage The window to be displayed.
*/
@Override
public void start(Stage stage) throws Exception {
//Setting text colours to blue, red, and green.
Text blue = new Text(20.0,30.0, "Blue");
Text red = new Text(20.0,70.0, "Red");
Text green = new Text(20.0,110.0, "Green");
blue.setFill(Color.BLUE); blue.setFont(Font.font("verdana", 30));
red.setFill(Color.RED); red.setFont(Font.font("verdana", 30));
green.setFill(Color.GREEN); green.setFont(Font.font("verdana", 30));
// Create a Group (scene graph) with the text as single element.
Group root = new Group(blue,red,green);
int[] r = {0,255, 0, 0,255,255, 0,255,255,255,200,128, 64, 32,164};
int[] g = {0, 0,255, 0,200,175,255, 0,255,255,200,128, 64, 32,255};
int[] b = {0, 0, 0,255, 0,175,255,255, 0,255,200,128, 64, 32, 64};
boolean[] bg = {false,false,false,false,false,false,false,false,true,true,false,false,false,false,false};
for (int i = 0; i < 15; i++){
Text text = new Text(120.0,30.0+ 40*i, String.format("rgb(%d,%d,%d)", r[i], g[i], b[i]));
Color colour = Color.rgb(r[i],g[i],b[i]);
text.setFill(colour); text.setFont(Font.font("verdana", 30));
if (bg[i]) {
Rectangle rect = new Rectangle(120.0,40*i, 2000, 40);
rect.setFill(Color.BLACK);
root.getChildren().add(rect);
}
root.getChildren().add(text);
}
// The scene consists of just one group.
Scene scene = new Scene(root, 600, 700);
// Give the stage (window) a title and add the scene.
stage.setTitle("Text");
stage.setScene(scene);
stage.show();
}
/*
* main method to launch the application.
*/
public static void main(String[] args) {
launch(args);
}
}
| [
"chengyu920420@163.com"
] | chengyu920420@163.com |
55b8a6de9ce180e2f23b2a8b7259d34886439527 | 1d8bfb46d7919c70f80006e10c7dde73f6741f9c | /sim-impl/src/main/java/gov/va/sim/impl/expression/Expression.java | 0be0b1e8a64e89898f81a3a225746cda75eb9bd2 | [] | no_license | jefron-ap/SIM | 4ddafdb131a288c366bf400dd58b09be0f6e9e23 | 4e02b43f969f25bbe098690b7e29f2d86abf822d | refs/heads/master | 2016-09-06T09:06:15.315378 | 2013-11-25T19:33:04 | 2013-11-25T19:33:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,973 | java |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package gov.va.sim.impl.expression;
//~--- non-JDK imports --------------------------------------------------------
import gov.va.sim.act.expression.ExpressionBI;
import gov.va.sim.act.expression.node.ExpressionNodeBI;
//~--- JDK imports ------------------------------------------------------------
import java.beans.PropertyVetoException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;
import java.util.UUID;
import org.ihtsdo.tk.uuid.UuidT5Generator;
/**
*
* @author kec
*/
public class Expression implements ExpressionBI {
private ExpressionNodeBI<?> focus;
//~--- methods -------------------------------------------------------------
@Override
public boolean equivalent(ExpressionBI another) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean subsumedBy(ExpressionBI another) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public boolean subsumes(ExpressionBI another) {
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String toString() {
try {
return getVerboseXml();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
//~--- get methods ---------------------------------------------------------
@Override
public ExpressionNodeBI<?> getFocus() {
return focus;
}
@Override
public UUID getUuid() throws IOException, UnsupportedEncodingException, NoSuchAlgorithmException {
StringBuilder sb = new StringBuilder();
if (focus != null) {
focus.appendStringForUuidHash(sb);
} else {
return null;
}
return UuidT5Generator.get(ExpressionNodeBI.NAMESPACE_UUID, sb.toString());
}
public String getVerboseXml() throws IOException {
StringBuilder sb = new StringBuilder();
if (focus != null) {
focus.generateXml(sb, true);
} else {
sb.append("null focus");
}
return sb.toString();
}
public String getXml() throws IOException {
StringBuilder sb = new StringBuilder();
if (focus != null) {
focus.generateXml(sb, false);
} else {
sb.append("null focus");
}
return sb.toString();
}
public String getHtmlFragment(boolean verbose) throws IOException {
StringBuilder sb = new StringBuilder();
if (focus != null) {
focus.generateHtml(sb, false);
} else {
sb.append("null focus");
}
return sb.toString();
}
//~--- set methods ---------------------------------------------------------
@Override
public void setFocus(ExpressionNodeBI<?> focus) throws PropertyVetoException {
this.focus = focus;
}
}
| [
"jefron@apelon.com"
] | jefron@apelon.com |
11f54b27e0b8bdbd87bd73a47bdace8f9e882139 | 29604b5b313c6d71c855746dc16e1e742d075b7b | /OpenKM/src/main/java/com/openkm/extractor/MsOffice2007ContentHandler.java | 26cf5c0b5b87d40f8dff2448831434469a0b23d5 | [] | no_license | UniversitateaPetruMaior/pm-dms | 098269e5b8464290f775d8776d3591a43c052220 | 1aa12951586a60e7a41e8d584d8da9183d126c7d | refs/heads/master | 2021-01-10T19:27:29.786616 | 2015-02-19T12:44:41 | 2015-02-19T12:44:41 | 25,916,964 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,509 | java | /**
* OpenKM, Open Document Management System (http://www.openkm.com)
* Copyright (c) 2006-2014 Paco Avila & Josep Llort
*
* No bytes were intentionally harmed during the development of this application.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.openkm.extractor;
import org.xml.sax.helpers.DefaultHandler;
public abstract class MsOffice2007ContentHandler extends DefaultHandler {
protected StringBuffer content;
protected boolean appendChar;
public MsOffice2007ContentHandler() {
content = new StringBuffer();
appendChar = false;
}
/**
* Returns the text content extracted from parsed xml
*/
public String getContent() {
String ret = content.toString();
content.setLength(0);
return ret;
}
public abstract String getFilePattern();
}
| [
"test@test.test"
] | test@test.test |
cf2e9f73e6103ffb0e82ade4422a23282dfd1343 | 10eec5ba9e6dc59478cdc0d7522ff7fc6c94cd94 | /maind/src/main/java/com/vvt/qq/internal/MessageForPic.java | 213050638446a552bb31589498134ed04f7b5bd2 | [] | no_license | EchoAGI/Flexispy.re | a2f5fec409db083ee3fe0d664dc2cca7f9a4f234 | ba65a5b8b033b92c5867759f2727c5141b7e92fc | refs/heads/master | 2023-04-26T02:52:18.732433 | 2018-07-16T07:46:56 | 2018-07-16T07:46:56 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,638 | java | package com.vvt.qq.internal;
import com.vvt.ak.a;
import com.vvt.qq.internal.pb.PBBoolField;
import com.vvt.qq.internal.pb.PBInt32Field;
import com.vvt.qq.internal.pb.PBStringField;
import com.vvt.qq.internal.pb.PBUInt32Field;
import com.vvt.qq.internal.pb.PBUInt64Field;
public class MessageForPic
{
private static final boolean LOGE = a.e;
private static final String TAG = "MessageForPic";
public static int defaultSuMsgId;
public long DSKey;
public String SpeedInfo;
public String actMsgContentValue;
public String action;
public int aiofileType;
public boolean bEnableEnc;
public String bigMsgUrl;
public String bigThumbMsgUrl;
public int busiType;
public int fileSizeFlag;
public long groupFileID;
public long height;
public int imageType;
public boolean isMixed;
public boolean isRead;
public int isReport;
public boolean isShareAppActionMsg;
public String localUUID;
public int mCurrlength;
public int mDownloadLength;
public int mNotPredownloadReason;
public long mPresendTransferedSize;
public int mShowLength;
public String md5;
public int msgVia;
public String path;
public int picExtraFlag;
public Object picExtraObject;
public int preDownNetworkType;
public int preDownState;
public int previewed;
public String rawMsgUrl;
public ReportInfo reportInfo;
public String serverStoreSource;
public long shareAppID;
public long size;
public int subMsgId;
public int subMsgType;
public int subThumbHeight;
public int subThumbWidth;
public int subVersion;
public int thumbHeight;
public String thumbMsgUrl;
public int thumbSize;
public int thumbWidth;
public int type;
public String uuid;
public long width;
public MessageForPic()
{
int j = defaultSuMsgId;
this.subMsgId = j;
this.subVersion = 5;
this.preDownState = i;
this.preDownNetworkType = i;
this.mNotPredownloadReason = 0;
this.subThumbWidth = i;
this.subThumbHeight = i;
this.aiofileType = i;
this.subMsgType = i;
this.thumbSize = i;
}
public boolean doParse(byte[] paramArrayOfByte)
{
Object localObject1 = new com/vvt/qq/internal/PicRec;
((PicRec)localObject1).<init>();
try
{
((PicRec)localObject1).mergeFrom(paramArrayOfByte);
bool1 = true;
}
catch (Exception localException)
{
for (;;)
{
Object localObject2;
long l;
int i;
boolean bool2;
int j;
boolean bool3;
boolean bool1 = LOGE;
if (bool1) {}
bool1 = false;
}
}
if (bool1)
{
localObject2 = ((PicRec)localObject1).localPath.get();
this.path = ((String)localObject2);
l = ((PicRec)localObject1).size.get();
this.size = l;
i = ((PicRec)localObject1).type.get();
this.type = i;
bool2 = ((PicRec)localObject1).isRead.get();
this.isRead = bool2;
localObject2 = ((PicRec)localObject1).uuid.get();
this.uuid = ((String)localObject2);
l = ((PicRec)localObject1).groupFileID.get();
this.groupFileID = l;
localObject2 = ((PicRec)localObject1).md5.get();
this.md5 = ((String)localObject2);
localObject2 = ((PicRec)localObject1).serverStorageSource.get();
this.serverStoreSource = ((String)localObject2);
localObject2 = ((PicRec)localObject1).thumbMsgUrl.get();
this.thumbMsgUrl = ((String)localObject2);
localObject2 = ((PicRec)localObject1).bigthumbMsgUrl.get();
this.bigThumbMsgUrl = ((String)localObject2);
j = ((PicRec)localObject1).uint32_thumb_width.get();
this.thumbWidth = j;
j = ((PicRec)localObject1).uint32_thumb_height.get();
this.thumbHeight = j;
l = ((PicRec)localObject1).uint32_width.get();
this.width = l;
l = ((PicRec)localObject1).uint32_height.get();
this.height = l;
j = ((PicRec)localObject1).uint32_image_type.get();
this.imageType = j;
localObject2 = ((PicRec)localObject1).bigMsgUrl.get();
this.bigMsgUrl = ((String)localObject2);
localObject2 = ((PicRec)localObject1).rawMsgUrl.get();
this.rawMsgUrl = ((String)localObject2);
j = ((PicRec)localObject1).isReport.get();
this.isReport = j;
j = ((PicRec)localObject1).version.get();
this.subVersion = j;
j = ((PicRec)localObject1).uiOperatorFlag.get();
this.picExtraFlag = j;
j = ((PicRec)localObject1).fileSizeFlag.get();
this.fileSizeFlag = j;
localObject2 = ((PicRec)localObject1).localUUID.get();
this.localUUID = ((String)localObject2);
j = ((PicRec)localObject1).preDownState.get();
this.preDownState = j;
j = ((PicRec)localObject1).preDownNetwork.get();
this.preDownNetworkType = j;
j = ((PicRec)localObject1).previewed.get();
this.previewed = j;
j = ((PicRec)localObject1).uint32_show_len.get();
this.mShowLength = j;
j = ((PicRec)localObject1).uint32_download_len.get();
this.mDownloadLength = j;
j = ((PicRec)localObject1).uint32_current_len.get();
this.mCurrlength = j;
localObject2 = ((PicRec)localObject1).notPredownloadReason;
j = ((PBUInt32Field)localObject2).get();
this.mNotPredownloadReason = j;
localObject1 = ((PicRec)localObject1).enableEnc;
bool3 = ((PBBoolField)localObject1).get();
this.bEnableEnc = bool3;
}
return bool1;
}
}
/* Location: /Volumes/D1/codebase/android/POC/assets/product/maind/classes-enjarify.jar!/com/vvt/qq/internal/MessageForPic.class
* Java compiler version: 5 (49.0)
* JD-Core Version: 0.7.1
*/ | [
"52388483@qq.com"
] | 52388483@qq.com |
a4e7475e4f46d77945bda2a524133c26e68b8220 | f56ed848741c676b5f44dfeb8ee7d2bf3f81e666 | /common/src/main/java/com/tcg/rpgengine/common/data/assets/ImageAsset.java | 8025f5cba6331dce5753c26fb9cf8e0211b35927 | [] | no_license | JoseRivas1998/Tiny-Country-Games-RPG-Engine | 3343baf357d28d9becfc23390b97ceb706cdb1d0 | cee734334206c44e7add4a19f5bcde1abdcad144 | refs/heads/main | 2023-04-21T11:11:21.201593 | 2021-05-01T00:47:58 | 2021-05-01T00:47:58 | 327,133,721 | 0 | 0 | null | 2021-01-05T22:51:50 | 2021-01-05T22:19:21 | Java | UTF-8 | Java | false | false | 2,110 | java | package com.tcg.rpgengine.common.data.assets;
import com.tcg.rpgengine.common.data.BinaryDocument;
import com.tcg.rpgengine.common.utils.UuidUtils;
import org.json.JSONObject;
import java.nio.ByteBuffer;
import java.util.Objects;
import java.util.UUID;
public class ImageAsset extends Asset {
private static final String JSON_PATH_FIELD = "path";
public String path;
public ImageAsset(UUID id, String path) {
super(id);
this.path = Objects.requireNonNull(path);
}
public static ImageAsset generateNewImageAsset(String path) {
return new ImageAsset(UuidUtils.generateUuid(), path);
}
public static ImageAsset createFromJSON(String jsonString) {
final JSONObject imageJSON = new JSONObject(jsonString);
final UUID id = UuidUtils.fromString(imageJSON.getString(JSON_ID_FIELD));
final String path = imageJSON.getString(JSON_PATH_FIELD);
return new ImageAsset(id, path);
}
public static ImageAsset createFromBytes(ByteBuffer bytes) {
final UUID id = BinaryDocument.getUuid(bytes);
final String path = BinaryDocument.getUTF8String(bytes);
return new ImageAsset(id, path);
}
@Override
protected void addAdditionalJSONData(JSONObject jsonObject) {
jsonObject.put(JSON_PATH_FIELD, this.path);
}
@Override
protected int contentLength() {
return Integer.BYTES + this.path.length();
}
@Override
protected void encodeContent(ByteBuffer byteBuffer) {
BinaryDocument.putUTF8String(byteBuffer, this.path);
}
@Override
public int hashCode() {
return Objects.hash(this.id, this.path);
}
@Override
public boolean equals(Object obj) {
boolean result = this == obj;
if (!result) {
if (obj == null || this.getClass() != obj.getClass()) {
result = false;
} else {
final ImageAsset other = (ImageAsset) obj;
result = super.equals(other) && this.path.equals(other.path);
}
}
return result;
}
}
| [
"JoseRivas823@gmail.com"
] | JoseRivas823@gmail.com |
b0e29fcb9feb4a4a0a125c33555833688bdd6b77 | 366f6a465c865f6e59dc5d781db18a8403fd942c | /src/main/java/web/service/UserService.java | 32918da86d2312e81f466cdbb0e75d0e7b21a6f0 | [] | no_license | artsnopok/crud | 75f84022614b56c4e53cb767f651ce9d04b11020 | 6d9097046e8d971d06081f337c45537bc23182c7 | refs/heads/master | 2023-06-26T18:16:05.551700 | 2021-07-27T08:05:45 | 2021-07-27T08:05:45 | 386,644,980 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 232 | java | package web.service;
import web.models.User;
import java.util.List;
public interface UserService {
List<User> index();
User show(int id);
void save(User user);
void update(User user);
void delete(long id);
}
| [
"artemsnopok@yandex.ru"
] | artemsnopok@yandex.ru |
209ee50239b6dd9eb2ef66f5107987ce0fc54583 | 59512c66950a530e2192858bed15dd57d62fbeab | /src/POSPD/Sale.java | e63b781d547a557925a69bef0f4214abe6ee7928 | [] | no_license | JaredTorp/POS-system | 8d2adc48ae5e42058bf4941bc2db69835924b013 | 541e3f5ee8313afe35a4345b71f8119564c3f5d9 | refs/heads/main | 2023-01-10T05:07:50.630649 | 2020-11-06T06:15:16 | 2020-11-06T06:15:16 | 310,508,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,039 | java | package POSPD;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
/**
* Sale class represents the sale being made at the register
*/
public class Sale
{
/**
* A sale will have a Date and Time
*/
private LocalDateTime dateTime;
/**
* A Sale will know if it is tax free
*/
private Boolean taxFree;
/**
* A Sale will know the Payment of the specific sale
*/
private ArrayList<Payment> payments;
/**
* The sale knows about the array of saleLineItems
*/
private ArrayList<SaleLineItem> saleLineItems;
public LocalDateTime getDateTime()
{
return this.dateTime;
}
public void setDateTime(LocalDateTime dateTime)
{
this.dateTime = dateTime;
}
public Boolean getTaxFree()
{
return this.taxFree;
}
public void setTaxFree(Boolean taxFree)
{
this.taxFree = taxFree;
}
public ArrayList<SaleLineItem> getSaleLineItems()
{
return saleLineItems;
}
public ArrayList<Payment> getPayments()
{
return payments;
}
/**
* The default constructor for a sale
*/
public Sale()
{
this.taxFree = false;
payments = new ArrayList<Payment>();
saleLineItems = new ArrayList<SaleLineItem>();
this.dateTime = (LocalDateTime.now());
}
/**
* The constructor with parameters
* @param taxFree We pass if the sale is taxfree
*/
public Sale(String taxFree)
{
//come back to this
this();
if (taxFree.toLowerCase().equals("y"))
{
this.taxFree = true;
}
else
{
this.taxFree = false;
}
}
/**
* This method adds a payment of the sale
* @param payment We pass the payment to add it
*/
public void addPayment(Payment payment)
{
payments.add(payment);
}
/**
* This function removes the payment from the sale
* @param payment We pass the payment to be removed
*/
public void removePayment(Payment payment)
{
payments.remove(payment);
}
/**
* This function adds a saleLineItem
* @param sli We pass the SaleLineItem to be added
*/
public void addSaleLineItem(SaleLineItem sli)
{
saleLineItems.add(sli);
}
/**
* This method removed the SaleLineItem from the sale
* @param sli we pass the salelineitem to be removed
*/
public void removeSaleLineItem(SaleLineItem sli)
{
saleLineItems.remove(sli);
}
/**
* This method calculates the total of the sale
* @return This will return the total of the sale
*/
public BigDecimal calcTotal()
{
return this.calcSubTotal().add(this.calcTax());
}
/**
* This method will calculate the subtotal of the sale
* @return returns the subtotal as a BigDecimal
*/
public BigDecimal calcSubTotal()
{
BigDecimal subtotal = new BigDecimal("0.00");
for (SaleLineItem sli: this.getSaleLineItems())
{
subtotal = subtotal.add(sli.calcSubTotal());
}
return subtotal;
}
/**
* This method calculates the tax
* @return This method returns the tax
*/
public BigDecimal calcTax()
{
BigDecimal taxtotal = new BigDecimal("0.00");
if (!this.getTaxFree())
{
for (SaleLineItem sli: this.getSaleLineItems())
{
taxtotal = taxtotal.add(sli.calcTax());
}
}
return taxtotal;
}
/**
* This method calculates and returns the total payment of the sale
* @return returns the total payment
*/
public BigDecimal getTotalPayments()
{
BigDecimal total = new BigDecimal("0.00");
for (Payment payment : this.getPayments())
{
total = total.add(payment.getAmount());
}
return total;
}
/**
* This method checks to see if the payment is enough
* @return reutrns true or false if the sale is enough
*/
public Boolean isPaymentEnough()
{
boolean enough = false;
if (this.calcTotal().compareTo(this.getTotalPayments()) <= 0.00)
{
enough = true;
}
return enough;
}
/**
* This method Calculates the amount
* @param amTendered We pass the amount tendered
*/
//do this for each calc amount
public BigDecimal calcAmount(BigDecimal amTendered)
{
BigDecimal amount;
if(amTendered.compareTo(this.calcTotal().subtract(this.getTotalPayments())) <= 0.00)
{
amount = amTendered;
}
else
{
amount = this.calcTotal().subtract(this.getTotalPayments());
}
return amount;
}
/**
* This method calculates how much change to give back to the customer
* @return Returns the the change
*/
public BigDecimal calcChange()
{
return this.calcAmtTendered().subtract(this.calcTotal());
}
/**
* This method calculates the amount tendered
* @return returns the amount tendered
*/
public BigDecimal calcAmtTendered()
{
BigDecimal total = new BigDecimal("0.00");
for (Payment payment : this.getPayments())
{
total = total.add(payment.getAmtTendered());
}
return total;
}
/**
* The toString function for the Sale class
*/
public String toString()
{
return "Sale: " + "Subtotal = " + this.calcSubTotal() + " Tax = " + this.calcTax() + " Total: " + this.calcTotal() + "Payment: " + this.getTotalPayments() + "Change: " + this.calcChange();
}
public BigDecimal getTotalCash() {
BigDecimal total = new BigDecimal("0.00");
for (Payment payment : this.getPayments())
{
if (payment instanceof Cash)
{
total = total.add(payment.getAmount());
}
}
return total;
}
public BigDecimal getTotalCheck() {
BigDecimal total = new BigDecimal("0.00");
for (Payment payment : this.getPayments())
{
if (payment instanceof Check)
{
total = total.add(payment.getAmount());
}
}
return total;
}
public BigDecimal getTotalCredit() {
BigDecimal total = new BigDecimal("0.00");
for (Payment payment : this.getPayments())
{
if (payment instanceof Credit)
{
total = total.add(payment.getAmount());
}
}
return total;
}
} | [
"noreply@github.com"
] | noreply@github.com |
2acb967584e450b9903ba80c74ea0d7d49d0fcec | 25e99a0af5751865bce1702ee85cc5c080b0715c | /design_pattern/src/DPModel/src/dp/com/company/pkbehavior/command_vs_strategy/strategy/Gzip.java | e5cc41bb46054e535cb989dd31622becc219c685 | [] | no_license | jasonblog/note | 215837f6a08d07abe3e3d2be2e1f183e14aa4a30 | 4471f95736c60969a718d854cab929f06726280a | refs/heads/master | 2023-05-31T13:02:27.451743 | 2022-04-04T11:28:06 | 2022-04-04T11:28:06 | 35,311,001 | 130 | 67 | null | 2023-02-10T21:26:36 | 2015-05-09T02:04:40 | C | UTF-8 | Java | false | false | 529 | java | package com.company.pkbehavior.command_vs_strategy.strategy;
/**
* @author cbf4Life cbf4life@126.com
* I'm glad to share my knowledge with you all.
*/
public class Gzip implements Algorithm {
//gzip的压缩算法
public boolean compress(String source, String to) {
System.out.println(source + " --> " +to + " GZIP压缩成功!");
return true;
}
//gzip解压缩算法
public boolean uncompress(String source,String to){
System.out.println(source + " --> " +to + " GZIP解压缩成功!");
return true;
}
}
| [
"jason_yao"
] | jason_yao |
dbceb2edc18f6ebee65c9c08efb8623eb89df5db | 6f6159f8f2c2a7202d44044bc13091c7d1e90876 | /src/main/java/org/example/service/processors/FileDataLineCustomerProcessor.java | 9fdbc08a828c85a4e759bf297d19e969ca50af1a | [] | no_license | arduini/data-analysis | a1a9237f08a94d969df48e5761335ae0858bad7a | 3554506d552ff303efc3f96f817837678e30cbe7 | refs/heads/main | 2023-01-18T19:24:04.787138 | 2020-11-18T13:33:19 | 2020-11-18T13:33:19 | 308,498,478 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 462 | java | package org.example.service.processors;
import lombok.NonNull;
import org.example.vo.FileDataAnalysisReportVO;
import org.springframework.stereotype.Service;
@Service
public class FileDataLineCustomerProcessor implements FileDataLineProcessorInterface{
@Override
public FileDataAnalysisReportVO processLine(@NonNull final FileDataAnalysisReportVO fileReport, @NonNull final String line) {
return fileReport.incrementCustomersAmount();
}
}
| [
"s2it_aarduini@uolinc.com"
] | s2it_aarduini@uolinc.com |
f4232ae916ac90f44452c4bad8f679b8abc1d1de | 9631cba511fcdf110c91005d8ffe84911e1c50b5 | /MachineVision_Terminal/src/com/machinevision/svm/svm_scale.java | b352dda170f3b7b5660c836d2d182f80be40b774 | [] | no_license | hust-MC/Machine-Vision | 7f0481724be53da91da4102659a712b120660cea | e64c5d4f8f1506c6263e18459457309dd1feecd1 | refs/heads/master | 2020-12-03T03:31:14.486376 | 2017-10-22T13:23:11 | 2017-10-22T13:23:11 | 27,103,897 | 0 | 1 | null | 2016-03-13T11:38:46 | 2014-11-25T01:40:48 | Java | UTF-8 | Java | false | false | 8,926 | java | package com.machinevision.svm;
import java.io.*;
import java.util.*;
class svm_scale
{
private String line = null;
private double lower = -1.0;
private double upper = 1.0;
private double y_lower;
private double y_upper;
private boolean y_scaling = false;
private double[] feature_max;
private double[] feature_min;
private double y_max = -Double.MAX_VALUE;
private double y_min = Double.MAX_VALUE;
private int max_index;
private long num_nonzeros = 0;
private long new_num_nonzeros = 0;
private static void exit_with_help()
{
System.out.print(
"Usage: svm-scale [options] data_filename\n"
+"options:\n"
+"-l lower : x scaling lower limit (default -1)\n"
+"-u upper : x scaling upper limit (default +1)\n"
+"-y y_lower y_upper : y scaling limits (default: no y scaling)\n"
+"-s save_filename : save scaling parameters to save_filename\n"
+"-r restore_filename : restore scaling parameters from restore_filename\n"
);
System.exit(1);
}
private BufferedReader rewind(BufferedReader fp, String filename) throws IOException
{
fp.close();
return new BufferedReader(new FileReader(filename));
}
private void output_target(double value)
{
if(y_scaling)
{
if(value == y_min)
value = y_lower;
else if(value == y_max)
value = y_upper;
else
value = y_lower + (y_upper-y_lower) *
(value-y_min) / (y_max-y_min);
}
System.out.print(value + " ");
}
private void output(int index, double value)
{
/* skip single-valued attribute */
if(feature_max[index] == feature_min[index])
return;
if(value == feature_min[index])
value = lower;
else if(value == feature_max[index])
value = upper;
else
value = lower + (upper-lower) *
(value-feature_min[index])/
(feature_max[index]-feature_min[index]);
if(value != 0)
{
System.out.print(index + ":" + value + " ");
new_num_nonzeros++;
}
}
private String readline(BufferedReader fp) throws IOException
{
line = fp.readLine();
return line;
}
private void run(String []argv) throws IOException
{
int i,index;
BufferedReader fp = null, fp_restore = null;
String save_filename = null;
String restore_filename = null;
String data_filename = null;
for(i=0;i<argv.length;i++)
{
if (argv[i].charAt(0) != '-') break;
++i;
switch(argv[i-1].charAt(1))
{
case 'l': lower = Double.parseDouble(argv[i]); break;
case 'u': upper = Double.parseDouble(argv[i]); break;
case 'y':
y_lower = Double.parseDouble(argv[i]);
++i;
y_upper = Double.parseDouble(argv[i]);
y_scaling = true;
break;
case 's': save_filename = argv[i]; break;
case 'r': restore_filename = argv[i]; break;
default:
System.err.println("unknown option");
exit_with_help();
}
}
if(!(upper > lower) || (y_scaling && !(y_upper > y_lower)))
{
System.err.println("inconsistent lower/upper specification");
System.exit(1);
}
if(restore_filename != null && save_filename != null)
{
System.err.println("cannot use -r and -s simultaneously");
System.exit(1);
}
if(argv.length != i+1)
exit_with_help();
data_filename = argv[i];
try {
fp = new BufferedReader(new FileReader(data_filename));
} catch (Exception e) {
System.err.println("can't open file " + data_filename);
System.exit(1);
}
/* assumption: min index of attributes is 1 */
/* pass 1: find out max index of attributes */
max_index = 0;
if(restore_filename != null)
{
int idx, c;
try {
fp_restore = new BufferedReader(new FileReader(restore_filename));
}
catch (Exception e) {
System.err.println("can't open file " + restore_filename);
System.exit(1);
}
if((c = fp_restore.read()) == 'y')
{
fp_restore.readLine();
fp_restore.readLine();
fp_restore.readLine();
}
fp_restore.readLine();
fp_restore.readLine();
String restore_line = null;
while((restore_line = fp_restore.readLine())!=null)
{
StringTokenizer st2 = new StringTokenizer(restore_line);
idx = Integer.parseInt(st2.nextToken());
max_index = Math.max(max_index, idx);
}
fp_restore = rewind(fp_restore, restore_filename);
}
while (readline(fp) != null)
{
StringTokenizer st = new StringTokenizer(line," \t\n\r\f:");
st.nextToken();
while(st.hasMoreTokens())
{
index = Integer.parseInt(st.nextToken());
max_index = Math.max(max_index, index);
st.nextToken();
num_nonzeros++;
}
}
try {
feature_max = new double[(max_index+1)];
feature_min = new double[(max_index+1)];
} catch(OutOfMemoryError e) {
System.err.println("can't allocate enough memory");
System.exit(1);
}
for(i=0;i<=max_index;i++)
{
feature_max[i] = -Double.MAX_VALUE;
feature_min[i] = Double.MAX_VALUE;
}
fp = rewind(fp, data_filename);
/* pass 2: find out min/max value */
while(readline(fp) != null)
{
int next_index = 1;
double target;
double value;
StringTokenizer st = new StringTokenizer(line," \t\n\r\f:");
target = Double.parseDouble(st.nextToken());
y_max = Math.max(y_max, target);
y_min = Math.min(y_min, target);
while (st.hasMoreTokens())
{
index = Integer.parseInt(st.nextToken());
value = Double.parseDouble(st.nextToken());
for (i = next_index; i<index; i++)
{
feature_max[i] = Math.max(feature_max[i], 0);
feature_min[i] = Math.min(feature_min[i], 0);
}
feature_max[index] = Math.max(feature_max[index], value);
feature_min[index] = Math.min(feature_min[index], value);
next_index = index + 1;
}
for(i=next_index;i<=max_index;i++)
{
feature_max[i] = Math.max(feature_max[i], 0);
feature_min[i] = Math.min(feature_min[i], 0);
}
}
fp = rewind(fp, data_filename);
/* pass 2.5: save/restore feature_min/feature_max */
if(restore_filename != null)
{
// fp_restore rewinded in finding max_index
int idx, c;
double fmin, fmax;
fp_restore.mark(2); // for reset
if((c = fp_restore.read()) == 'y')
{
fp_restore.readLine(); // pass the '\n' after 'y'
StringTokenizer st = new StringTokenizer(fp_restore.readLine());
y_lower = Double.parseDouble(st.nextToken());
y_upper = Double.parseDouble(st.nextToken());
st = new StringTokenizer(fp_restore.readLine());
y_min = Double.parseDouble(st.nextToken());
y_max = Double.parseDouble(st.nextToken());
y_scaling = true;
}
else
fp_restore.reset();
if(fp_restore.read() == 'x') {
fp_restore.readLine(); // pass the '\n' after 'x'
StringTokenizer st = new StringTokenizer(fp_restore.readLine());
lower = Double.parseDouble(st.nextToken());
upper = Double.parseDouble(st.nextToken());
String restore_line = null;
while((restore_line = fp_restore.readLine())!=null)
{
StringTokenizer st2 = new StringTokenizer(restore_line);
idx = Integer.parseInt(st2.nextToken());
fmin = Double.parseDouble(st2.nextToken());
fmax = Double.parseDouble(st2.nextToken());
if (idx <= max_index)
{
feature_min[idx] = fmin;
feature_max[idx] = fmax;
}
}
}
fp_restore.close();
}
if(save_filename != null)
{
Formatter formatter = new Formatter(new StringBuilder());
BufferedWriter fp_save = null;
try {
fp_save = new BufferedWriter(new FileWriter(save_filename));
} catch(IOException e) {
System.err.println("can't open file " + save_filename);
System.exit(1);
}
if(y_scaling)
{
formatter.format("y\n");
formatter.format("%.16g %.16g\n", y_lower, y_upper);
formatter.format("%.16g %.16g\n", y_min, y_max);
}
formatter.format("x\n");
formatter.format("%.16g %.16g\n", lower, upper);
for(i=1;i<=max_index;i++)
{
if(feature_min[i] != feature_max[i])
formatter.format("%d %.16g %.16g\n", i, feature_min[i], feature_max[i]);
}
fp_save.write(formatter.toString());
fp_save.close();
}
/* pass 3: scale */
while(readline(fp) != null)
{
int next_index = 1;
double target;
double value;
StringTokenizer st = new StringTokenizer(line," \t\n\r\f:");
target = Double.parseDouble(st.nextToken());
output_target(target);
while(st.hasMoreElements())
{
index = Integer.parseInt(st.nextToken());
value = Double.parseDouble(st.nextToken());
for (i = next_index; i<index; i++)
output(i, 0);
output(index, value);
next_index = index + 1;
}
for(i=next_index;i<= max_index;i++)
output(i, 0);
System.out.print("\n");
}
if (new_num_nonzeros > num_nonzeros)
System.err.print(
"WARNING: original #nonzeros " + num_nonzeros+"\n"
+" new #nonzeros " + new_num_nonzeros+"\n"
+"Use -l 0 if many original feature values are zeros\n");
fp.close();
}
public static void main(String argv[]) throws IOException
{
svm_scale s = new svm_scale();
s.run(argv);
}
}
| [
"251887584@qq.com"
] | 251887584@qq.com |
da9a4ca7214945a0854b9e9e4144d0075efd5236 | 9a6ea6087367965359d644665b8d244982d1b8b6 | /src/main/java/X/C447621j.java | f9c79150905d57370f2cfc821f3b365400278680 | [] | no_license | technocode/com.wa_2.21.2 | a3dd842758ff54f207f1640531374d3da132b1d2 | 3c4b6f3c7bdef7c1523c06d5bd9a90b83acc80f9 | refs/heads/master | 2023-02-12T11:20:28.666116 | 2021-01-14T10:22:21 | 2021-01-14T10:22:21 | 329,578,591 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 10,377 | java | package X;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.NotificationManager;
import android.os.Build;
import com.whatsapp.jid.Jid;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
/* renamed from: X.21j reason: invalid class name and case insensitive filesystem */
public class C447621j extends AbstractC28801Vu {
public static volatile C447621j A0A;
public final AnonymousClass01I A00;
public final AnonymousClass0Z6 A01;
public final AnonymousClass01A A02;
public final C014308b A03;
public final AnonymousClass03P A04;
public final AnonymousClass00G A05;
public final C28691Vj A06;
public final C28711Vl A07;
public final AnonymousClass022 A08;
public final AnonymousClass0BB A09;
public C447621j(AnonymousClass00G r1, AnonymousClass0Z6 r2, AnonymousClass01I r3, AnonymousClass01A r4, AnonymousClass03P r5, C014308b r6, AnonymousClass0BB r7, AnonymousClass022 r8, C28691Vj r9, C28711Vl r10) {
this.A05 = r1;
this.A01 = r2;
this.A00 = r3;
this.A02 = r4;
this.A04 = r5;
this.A03 = r6;
this.A09 = r7;
this.A08 = r8;
this.A06 = r9;
this.A07 = r10;
}
public static C447621j A00() {
if (A0A == null) {
synchronized (C447621j.class) {
if (A0A == null) {
A0A = new C447621j(AnonymousClass00G.A01, AnonymousClass0Z6.A00(), AnonymousClass01I.A00(), AnonymousClass01A.A00(), AnonymousClass03P.A00(), C014308b.A00(), AnonymousClass0BB.A00(), AnonymousClass022.A00(), C28691Vj.A00(), C28711Vl.A00());
}
}
}
return A0A;
}
public C28791Vt A01(AbstractC007503q r5, C28831Vx r6) {
NotificationManager notificationManager;
NotificationChannel notificationChannel;
NotificationChannelGroup notificationChannelGroup;
AnonymousClass02N r3 = r5.A0n.A00;
if (r3 != null) {
AnonymousClass0BB r2 = this.A09;
if (r2.A08(r3).A09()) {
return null;
}
if (Build.VERSION.SDK_INT >= 26 && (notificationChannel = (notificationManager = (NotificationManager) this.A05.A00.getSystemService("notification")).getNotificationChannel(((AnonymousClass0BI) r2.A08(r3)).A0C())) != null) {
if (notificationChannel.getImportance() == 0) {
return null;
}
if (Build.VERSION.SDK_INT >= 28 && (notificationChannelGroup = notificationManager.getNotificationChannelGroup(notificationChannel.getGroup())) != null && notificationChannelGroup.isBlocked()) {
return null;
}
}
JSONObject A032 = A03(r5, r6);
if (A032 != null) {
return new C28791Vt(A00(), A032);
}
return null;
}
throw null;
}
/* JADX DEBUG: Failed to insert an additional move for type inference into block B:19:0x0057 */
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r3v0, types: [java.lang.CharSequence] */
/* JADX WARN: Type inference failed for: r3v1, types: [java.lang.CharSequence] */
/* JADX WARN: Type inference failed for: r3v3, types: [android.text.SpannableStringBuilder] */
/* JADX WARN: Type inference failed for: r0v8, types: [X.0Z6] */
/* JADX WARN: Type inference failed for: r3v5 */
/* JADX WARNING: Unknown variable types count: 1 */
/* Code decompiled incorrectly, please refer to instructions dump. */
public final java.lang.String A02(java.lang.String r5, java.util.List r6) {
/*
r4 = this;
java.lang.String r2 = X.C002001d.A1m(r5)
X.03P r1 = r4.A04
X.022 r0 = r4.A08
java.lang.CharSequence r3 = X.C002001d.A1C(r1, r0, r2)
if (r6 == 0) goto L_0x0057
boolean r0 = r6.isEmpty()
if (r0 != 0) goto L_0x0057
boolean r0 = android.text.TextUtils.isEmpty(r3)
if (r0 != 0) goto L_0x0057
boolean r0 = r3 instanceof android.text.SpannableStringBuilder
if (r0 == 0) goto L_0x0050
android.text.SpannableStringBuilder r3 = (android.text.SpannableStringBuilder) r3
L_0x0020:
java.util.ArrayList r2 = new java.util.ArrayList
r2.<init>()
X.21f r1 = new X.21f
r1.<init>(r2)
X.0Z6 r0 = r4.A01
r0.A04(r3, r6, r1)
java.util.Comparator r0 = java.util.Collections.reverseOrder()
java.util.Collections.sort(r2, r0)
java.util.Iterator r2 = r2.iterator()
L_0x003a:
boolean r0 = r2.hasNext()
if (r0 == 0) goto L_0x0057
java.lang.Object r0 = r2.next()
java.lang.Number r0 = (java.lang.Number) r0
int r1 = r0.intValue()
int r0 = r1 + 1
r3.delete(r1, r0)
goto L_0x003a
L_0x0050:
android.text.SpannableStringBuilder r0 = new android.text.SpannableStringBuilder
r0.<init>(r3)
r3 = r0
goto L_0x0020
L_0x0057:
java.lang.CharSequence r0 = X.C003701u.A00(r3)
if (r0 != 0) goto L_0x005f
r0 = 0
return r0
L_0x005f:
java.lang.String r0 = r0.toString()
return r0
*/
throw new UnsupportedOperationException("Method not decompiled: X.C447621j.A02(java.lang.String, java.util.List):java.lang.String");
}
public JSONObject A03(AbstractC007503q r10, C28831Vx r11) {
C007003k r5;
AnonymousClass01A r0;
String str;
String str2;
try {
JSONObject jSONObject = new JSONObject();
if (!(r10 instanceof C05490Ot) || r10.A0m != 0) {
if (!(r10 instanceof AnonymousClass0Z9) && !(r10 instanceof C12210hj) && !(r10 instanceof AnonymousClass0Z8)) {
if (r10 instanceof AnonymousClass0MI) {
AnonymousClass0M3 r02 = (AnonymousClass0M3) r10;
jSONObject.put("text", A02(r02.A0v(), r02.A0c));
A04(jSONObject, r10);
jSONObject.put("type", "image");
} else if (r10 instanceof AnonymousClass0MP) {
jSONObject.put("type", "audio");
} else if (r10 instanceof AnonymousClass0ZC) {
AnonymousClass0M3 r03 = (AnonymousClass0M3) r10;
jSONObject.put("text", A02(r03.A0v(), r03.A0c));
A04(jSONObject, r10);
jSONObject.put("type", "video");
} else if (r10 instanceof AnonymousClass0ZE) {
jSONObject.put("type", "sticker");
} else if (r10 instanceof AnonymousClass0ZB) {
AnonymousClass0M3 r04 = (AnonymousClass0M3) r10;
jSONObject.put("text", A02(r04.A0v(), r04.A0c));
A04(jSONObject, r10);
jSONObject.put("type", "gif");
} else if (r10 instanceof AbstractC02860Dt) {
jSONObject.put("type", "location");
} else if ((r10 instanceof C04830Lz) || (r10 instanceof AnonymousClass0M1)) {
jSONObject.put("type", "contact");
} else if (!(r10 instanceof AnonymousClass0M2)) {
return null;
} else {
jSONObject.put("type", "document");
}
}
return null;
}
AnonymousClass0MH r3 = r10.A0F;
if (r3 == null) {
str2 = "text";
} else if (r3.A02 == 5 || !this.A00.A09(r3.A09)) {
return null;
} else {
str2 = "payment";
}
jSONObject.put("text", A02(r10.A0D(), r10.A0c));
A04(jSONObject, r10);
jSONObject.put("type", str2);
AnonymousClass02N A072 = r10.A07();
C007303n r7 = r10.A0n;
AnonymousClass02N r6 = r7.A00;
boolean A0Y = AnonymousClass1VY.A0Y(r6);
if (!A0Y || A072 == null) {
r0 = this.A02;
if (r6 != null) {
r5 = r0.A0A(r6);
} else {
throw null;
}
} else {
r0 = this.A02;
r5 = r0.A0A(A072);
}
if (!A0Y) {
str = null;
} else if (r6 != null) {
str = this.A03.A08(r0.A0A(r6), false);
} else {
throw null;
}
jSONObject.putOpt("group_name", str);
jSONObject.put("author_name", this.A03.A09(r5, false));
C28691Vj r1 = this.A06;
Jid jid = r5.A09;
if (jid != null) {
C28701Vk r2 = r1.A01;
jSONObject.put("author_id", r2.A04(r11, jid.getRawString()));
if (r6 != null) {
jSONObject.put("chat_id", r2.A04(r11, r6.getRawString()));
C28711Vl r32 = this.A07;
JSONArray jSONArray = new JSONArray();
JSONArray put = jSONArray.put(1).put(r7.A01).put(r7.A02);
if (r6 != null) {
put.put(r6.getRawString());
jSONObject.put("message_id", r32.A01.A04(r11, jSONArray.toString()));
return jSONObject;
}
throw null;
}
throw null;
}
throw null;
} catch (JSONException unused) {
}
}
public final void A04(JSONObject jSONObject, AbstractC007503q r5) {
List<Jid> list = r5.A0c;
if (list != null) {
for (Jid jid : list) {
if (this.A00.A09(jid)) {
jSONObject.put("user_mentioned", true);
return;
}
}
}
}
}
| [
"madeinborneo@gmail.com"
] | madeinborneo@gmail.com |
7ac6f3e33edd93d8b438f8b391e7a80e0342fbaf | e8a8e709881730f9823b65ca3a6791b667a295fa | /Conception/src/run.java | 6c070085f2007ef9ef98313cfff9be127a43750a | [] | no_license | fabrice126/Conception_MBDS | 9963d336ba0c69bc991dd481eacb95c2f75c4c35 | a1df0169be8e79bb9d17f18816628cf851a0576e | refs/heads/master | 2021-01-09T21:47:11.775367 | 2015-11-10T14:31:10 | 2015-11-10T14:31:10 | 44,517,455 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 400 | 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 Fabrice
*/
public class run {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
}
}
| [
"fjauvat@gmail.com"
] | fjauvat@gmail.com |
a3a784575b88e1b84a3d66b3bdd0ccff6c54cf32 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/22/22_32508c0522d956f3762b48da4f93cb1ed5adcedd/KeyParserLocation/22_32508c0522d956f3762b48da4f93cb1ed5adcedd_KeyParserLocation_s.java | 1fe919d00dc8b5ded830c90814695d882a95294c | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,449 | java | package jas.common.spawner.creature.handler.parsing.keys;
import jas.common.JASLog;
import jas.common.spawner.creature.handler.parsing.ParsingHelper;
import jas.common.spawner.creature.handler.parsing.TypeValuePair;
import jas.common.spawner.creature.handler.parsing.settings.OptionalSettings.Operand;
import java.util.ArrayList;
import java.util.HashMap;
import net.minecraft.entity.EntityLiving;
import net.minecraft.world.World;
public class KeyParserLocation extends KeyParserBase {
public KeyParserLocation(Key key) {
super(key, true, KeyType.CHAINABLE);
}
@Override
public boolean parseChainable(String parseable, ArrayList<TypeValuePair> parsedChainable,
ArrayList<Operand> operandvalue) {
String[] pieces = parseable.split(",");
Operand operand = parseOperand(pieces);
if (pieces.length == 7) {
int targetX = ParsingHelper.parseFilteredInteger(pieces[1], 0, "targetX " + key.key);
int targetY = ParsingHelper.parseFilteredInteger(pieces[2], 0, "targetY " + key.key);
int targetZ = ParsingHelper.parseFilteredInteger(pieces[3], 0, "targetZ " + key.key);
int varX = ParsingHelper.parseFilteredInteger(pieces[4], 1, "varX " + key.key);
int varY = ParsingHelper.parseFilteredInteger(pieces[5], 1, "varY " + key.key);
int varZ = ParsingHelper.parseFilteredInteger(pieces[6], 1, "varZ " + key.key);
TypeValuePair typeValue = new TypeValuePair(key, new Object[] { isInverted(pieces[0]), targetX, targetY,
targetZ, varX, varY, varZ });
parsedChainable.add(typeValue);
operandvalue.add(operand);
return true;
} else {
JASLog.severe("Error Parsing %s Parameter. Invalid Argument Length.", key.key);
return false;
}
}
@Override
public boolean parseValue(String parseable, HashMap<String, Object> valueCache) {
throw new UnsupportedOperationException();
}
@Override
public boolean isValidLocation(World world, EntityLiving entity, int xCoord, int yCoord, int zCoord,
TypeValuePair typeValuePair, HashMap<String, Object> valueCache) {
Object[] values = (Object[]) typeValuePair.getValue();
boolean isInverted = (Boolean) values[0];
int targetX = (Integer) values[1];
int targetY = (Integer) values[2];
int targetZ = (Integer) values[3];
int varX = (Integer) values[4];
int varY = (Integer) values[5];
int varZ = (Integer) values[6];
boolean isValid = false;
if (isWithinTargetRange(xCoord, targetX, varX) && isWithinTargetRange(yCoord, targetY, varY)
|| isWithinTargetRange(zCoord, targetZ, varZ)) {
isValid = true;
}
return isInverted ? isValid : !isValid;
}
private boolean isWithinTargetRange(int current, int target, int targetVariance) {
int maxRange = target + targetVariance;
int minRange = target - targetVariance;
boolean isValid = !(current <= maxRange && current >= minRange);
if (minRange <= maxRange) {
isValid = (current <= maxRange && current >= minRange);
} else {
isValid = !(current < minRange && current > maxRange);
}
return isValid;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
6344ad7dcfc3bfefa8b99ab814820bdc74d86b38 | 78e0f73f95e65ec07ccabc8fd77287ec48ecf68b | /src/main/java/com/g3/spc/service/IClassDiaryService.java | 7c2ef0c710cbdccdef7106693f47ad3ebd9588fc | [] | no_license | ChinthamaniYamini/parentwithoutclassId | b2ff9e46130d1f9048eab2f63b84727c6d81eb2a | 3ccf10c9c5a3bf73b845a0553eaadb5cc33501ef | refs/heads/main | 2023-05-25T19:43:57.781981 | 2021-06-07T16:20:54 | 2021-06-07T16:20:54 | 374,728,635 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package com.g3.spc.service;
import java.time.LocalDate;
import java.util.List;
import com.g3.spc.entities.ClassDiary;
public interface IClassDiaryService {
public ClassDiary addClassDiary(ClassDiary classDiary);
public ClassDiary retrieveClassDiary(LocalDate date);
public List<ClassDiary> getAllClassDiary();
} | [
"noreply@github.com"
] | noreply@github.com |
9d15748b82ceb37494c757e27eaab181d9b9d17f | d096d0709130ef5aff3859f7df0332239adad899 | /src/main/java/com/yahoo/bullet/drpc/TupleType.java | 1e913d201814bee7c166b3a994a09efdb5955b01 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | akshaisarma/bullet-storm | 7df7d1d28d26d0b8b03468ab3d4ab44773350716 | 352b1d0ffdfe6dc1a801283f8fbe9b0495a80b3a | refs/heads/master | 2021-01-13T12:18:23.928823 | 2017-01-10T23:52:38 | 2017-01-10T23:52:38 | 78,169,936 | 0 | 0 | null | 2017-01-06T03:23:35 | 2017-01-06T03:23:35 | null | UTF-8 | Java | false | false | 2,645 | java | /*
* Copyright 2016, Yahoo Inc.
* Licensed under the terms of the Apache License, Version 2.0.
* See the LICENSE file associated with the project for terms.
*/
package com.yahoo.bullet.drpc;
import lombok.Getter;
import org.apache.storm.tuple.Tuple;
import java.util.Optional;
import java.util.stream.Stream;
import static com.yahoo.bullet.drpc.TopologyConstants.ARGS_STREAM;
import static com.yahoo.bullet.drpc.TopologyConstants.FILTER_COMPONENT;
import static com.yahoo.bullet.drpc.TopologyConstants.FILTER_STREAM;
import static com.yahoo.bullet.drpc.TopologyConstants.ID_STREAM;
import static com.yahoo.bullet.drpc.TopologyConstants.JOIN_COMPONENT;
import static com.yahoo.bullet.drpc.TopologyConstants.JOIN_STREAM;
import static com.yahoo.bullet.drpc.TopologyConstants.PREPARE_COMPONENT;
import static com.yahoo.bullet.drpc.TopologyConstants.RECORD_COMPONENT;
import static com.yahoo.bullet.drpc.TopologyConstants.RECORD_STREAM;
import static com.yahoo.bullet.drpc.TopologyConstants.RETURN_STREAM;
import static com.yahoo.bullet.drpc.TopologyConstants.TICK_COMPONENT;
import static com.yahoo.bullet.drpc.TopologyConstants.TICK_STREAM;
public class TupleType {
private static final Type[] ALL_TYPES = Type.values();
/**
* Enumerated types of tuples that are checked for in the topology.
*/
@Getter
public enum Type {
TICK_TUPLE(TICK_COMPONENT, TICK_STREAM),
RULE_TUPLE(PREPARE_COMPONENT, ARGS_STREAM),
RETURN_TUPLE(PREPARE_COMPONENT, RETURN_STREAM),
ID_TUPLE(PREPARE_COMPONENT, ID_STREAM),
FILTER_TUPLE(FILTER_COMPONENT, FILTER_STREAM),
RECORD_TUPLE(RECORD_COMPONENT, RECORD_STREAM),
JOIN_TUPLE(JOIN_COMPONENT, JOIN_STREAM);
private String stream;
private String component;
Type(String component, String stream) {
this.component = component;
this.stream = stream;
}
/**
* Returns true iff the given tuple is of this Type.
*
* @param tuple The tuple to check for.
* @return boolean denoting whether this tuple is of this Type.
*/
public boolean isMe(Tuple tuple) {
return tuple.getSourceComponent().equals(component) && tuple.getSourceStreamId().equals(stream);
}
}
/**
* Returns the {@link TupleType.Type} of this tuple.
*
* @param tuple The tuple whose type is needed.
* @return An optional {@link TupleType.Type} for the tuple.
*/
public static Optional<Type> classify(Tuple tuple) {
return Stream.of(ALL_TYPES).filter(x -> x.isMe(tuple)).findFirst();
}
}
| [
"asarma@yahoo-inc.com"
] | asarma@yahoo-inc.com |
22d572cdaa5c94262571ff57abe83d778afe2be8 | 5a24ca3c26a9e913347e0321e73155f196b14128 | /src/main/java/kr/co/sunpay/api/domain/KsnetPay.java | 62a8aea13da7be16398fb06da7a3fdb309542114 | [] | no_license | MaDam2/spapi | e0df7fb2110daed4ec2005ef503b6850ef91a816 | f30b5a2acff1e57ecfc7256932f62716242ff0c7 | refs/heads/master | 2022-01-05T09:10:27.265873 | 2019-04-16T13:29:14 | 2019-04-16T13:29:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,284 | java | package kr.co.sunpay.api.domain;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* KSNet으로 전달되는 결제데이터
* @author himeepark
*
*/
@Getter
@Setter
@Entity
@Table(name="SP_KSNET_PAY")
@Where(clause="DELETED<>1")
@SQLDelete(sql="UPDATE SP_KSNET_PAY SET DELETED=1 WHERE UID=?")
@ToString
public class KsnetPay extends BaseEntity {
// 결제수단(신용카드, 계좌이체...)
@Column(name="KSNET_PAYMETHOD_CD", length=20)
private String sndPaymethod;
@Column(name="STORE_ID", length=20)
private String sndStoreid;
@Column(name="ORDER_NO", length=40)
private String sndOrdernumber;
@Column(name="GOODS_NM", length=40)
private String sndGoodname;
@Column(name="AMOUNT")
private int sndAmount;
@Column(name="ORDER_NM", length=40)
private String sndOrdername;
@Column(name="EMAIL", length=40)
private String sndEmail;
@Column(name="MOBILE", length=20)
private String sndMobile;
@Column(name="SERVICE_PERIOD", length=40)
private String sndServicePeriod;
@Column(name="REPLY", length=200)
private String sndReply;
} | [
"hmpark0502@gmail.com"
] | hmpark0502@gmail.com |
f651ede2c874dfeda8db27bc5f860670f2272ec0 | 57784fb314e024f0a59e7c962733a37ffe81d681 | /gemfirexd/tools/src/testing/java/org/apache/derbyTesting/functionTests/tests/jdbc4/ConnectionMethodsTest.java | 10a14c4824164420c6600d56fa2970b8e288a791 | [
"LicenseRef-scancode-generic-cla",
"Apache-2.0",
"LicenseRef-scancode-generic-export-compliance",
"LGPL-2.1-only",
"JSON",
"Plexus",
"LicenseRef-scancode-other-permissive",
"MIT",
"Apache-1.1",
"GPL-2.0-only",
"BSD-2-Clause"
] | permissive | TIBCOSoftware/snappy-store | a5ea4df265acf60697a5dad3c74cc1e12e41381b | d6ef57196127f1e87cc902e1aa20055025590b2d | refs/heads/snappy/master | 2023-09-03T13:29:24.241765 | 2022-06-27T21:24:32 | 2022-06-27T21:24:32 | 48,800,286 | 3 | 4 | Apache-2.0 | 2023-04-16T22:34:56 | 2015-12-30T12:44:56 | Java | UTF-8 | Java | false | false | 11,011 | java | /*
Derby - Class org.apache.derbyTesting.functionTests.tests.jdbc4.ConnectionMethodsTest
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.apache.derbyTesting.functionTests.tests.jdbc4;
import java.util.ArrayList;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ParameterMetaData;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.SQLException;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FilePermission;
import java.io.IOException;
import java.io.OutputStream;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.Statement;
import java.sql.SQLException;
import java.sql.Blob;
import java.sql.Clob;
import javax.sql.DataSource;
import java.security.AccessController;
import java.security.*;
import org.apache.derbyTesting.junit.NetworkServerTestSetup;
import com.pivotal.gemfirexd.internal.drda.NetworkServerControl;
import org.apache.derbyTesting.junit.TestConfiguration;
import org.apache.derbyTesting.junit.BaseJDBCTestCase;
import org.apache.derbyTesting.junit.CleanDatabaseTestSetup;
import org.apache.derbyTesting.junit.JDBC;
import org.apache.derbyTesting.junit.SupportFilesSetup;
import org.apache.derbyTesting.junit.TestConfiguration;
import org.apache.derbyTesting.junit.JDBCDataSource;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* This class is used to test the implementations of the JDBC 4.0 methods
* in the Connection interface
*/
public class ConnectionMethodsTest extends BaseJDBCTestCase {
FileInputStream is;
public ConnectionMethodsTest(String name) {
super(name);
}
public static Test suite() {
TestSuite suite = new TestSuite("ConnectionMethodsTest");
suite.addTest(baseSuite("ConnectionMethodsTest:embedded"));
suite.addTest(
TestConfiguration.clientServerDecorator(
baseSuite("ConnectionMethodsTest:client")));
return suite;
}
public static Test baseSuite(String name) {
TestSuite suite = new TestSuite(ConnectionMethodsTest.class, name);
Test test = new SupportFilesSetup(suite, new String[] {"functionTests/testData/ConnectionMethods/short.txt"} );
return new CleanDatabaseTestSetup(test) {
protected void decorateSQL(Statement s) throws SQLException {
s.execute("create table clobtable2(n int,clobcol CLOB)");
s.execute("create table blobtable2(n int,blobcol BLOB)");
}
};
}
/**
* Test the createClob method implementation in the Connection interface
*
* @exception SQLException, FileNotFoundException, Exception if error occurs
*/
public void testCreateClob() throws SQLException,
FileNotFoundException, IOException,
Exception{
Connection conn = getConnection();
int b, c;
Clob clob;
Statement s = createStatement();
PreparedStatement ps =
prepareStatement("insert into clobtable2 (n, clobcol)" + " values(?,?)");
ps.setInt(1,1000);
clob = conn.createClob();
try {
is = (FileInputStream) AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream("extin/short.txt");
}
});
} catch (PrivilegedActionException e) {
// e.getException() should be an instance of FileNotFoundException,
// as only "checked" exceptions will be "wrapped" in a
// PrivilegedActionException.
throw (FileNotFoundException) e.getException();
}
OutputStream os = clob.setAsciiStream(1);
ArrayList beforeUpdateList = new ArrayList();
c = is.read();
while(c>0) {
os.write(c);
beforeUpdateList.add(c);
c = is.read();
}
ps.setClob(2, clob);
ps.executeUpdate();
Statement stmt = createStatement();
ResultSet rs =
stmt.executeQuery("select clobcol from clobtable2 where n = 1000");
assertTrue(rs.next());
clob = rs.getClob(1);
assertEquals(beforeUpdateList.size(), clob.length());
//Get the InputStream from this Clob.
InputStream in = clob.getAsciiStream();
ArrayList afterUpdateList = new ArrayList();
b = in.read();
while (b > -1) {
afterUpdateList.add(b);
b = in.read();
}
assertEquals(beforeUpdateList.size(), afterUpdateList.size());
//Now check if the two InputStreams
//match
for (int i = 0; i < clob.length(); i++) {
assertEquals(beforeUpdateList.get(i), afterUpdateList.get(i));
}
os.close();
is.close();
}
/**
* Test the createBlob method implementation in the Connection interface
*
* @exception SQLException, FileNotFoundException, Exception if error occurs
*/
public void testCreateBlob() throws SQLException,
FileNotFoundException,
IOException,
Exception{
Connection conn = getConnection();
int b, c;
Blob blob;
Statement s = createStatement();
PreparedStatement ps =
prepareStatement("insert into blobtable2 (n, blobcol)" + " values(?,?)");
ps.setInt(1,1000);
blob = conn.createBlob();
try {
is = (FileInputStream) AccessController.doPrivileged(
new PrivilegedExceptionAction() {
public Object run() throws FileNotFoundException {
return new FileInputStream("extin/short.txt");
}
});
} catch (PrivilegedActionException e) {
// e.getException() should be an instance of FileNotFoundException,
// as only "checked" exceptions will be "wrapped" in a
// PrivilegedActionException.
throw (FileNotFoundException) e.getException();
}
OutputStream os = blob.setBinaryStream(1);
ArrayList beforeUpdateList = new ArrayList();
int actualLength = 0;
c = is.read();
while(c>0) {
os.write(c);
beforeUpdateList.add(c);
c = is.read();
actualLength ++;
}
ps.setBlob(2, blob);
ps.executeUpdate();
Statement stmt = createStatement();
ResultSet rs =
stmt.executeQuery("select blobcol from blobtable2 where n = 1000");
assertTrue(rs.next());
blob = rs.getBlob(1);
assertEquals(beforeUpdateList.size(), blob.length());
//Get the InputStream from this Blob.
InputStream in = blob.getBinaryStream();
ArrayList afterUpdateList = new ArrayList();
b = in.read();
while (b > -1) {
afterUpdateList.add(b);
b = in.read();
}
assertEquals(beforeUpdateList.size(), afterUpdateList.size());
//Now check if the two InputStreams
//match
for (int i = 0; i < blob.length(); i++) {
assertEquals(beforeUpdateList.get(i), afterUpdateList.get(i));
}
os.close();
is.close();
}
/**
* Test the Connection.isValid method
*
* @exception SQLException, Exception if error occurs
*/
public void testConnectionIsValid() throws SQLException, Exception {
/*
* Test illegal parameter values
*/
Connection conn = getConnection();
try {
conn.isValid(-1); // Negative timeout
fail("FAIL: isValid(-1): Invalid argument execption not thrown");
} catch (SQLException e) {
assertSQLState("XJ081", e);
}
/*
* Test with no timeout
*/
if (!conn.isValid(0)) {
fail("FAIL: isValid(0): returned false");
}
/*
* Test with a valid timeout
*/
if (!conn.isValid(1)) {
fail("FAIL: isValid(1): returned false");
}
/*
* Test on a closed connection
*/
try {
conn.close();
} catch (SQLException e) {
assertSQLState("08003", e);
}
if (conn.isValid(0)) {
fail("FAIL: isValid(0) on closed connection: returned true");
}
/* Open a new connection and test it */
conn = getConnection();
if (!conn.isValid(0)) {
fail("FAIL: isValid(0) on open connection: returned false");
}
/*
* Test on stopped database
*/
TestConfiguration.getCurrent().shutdownDatabase();
/* Test if that connection is not valid */
if (conn.isValid(0)) {
fail("FAIL: isValid(0) on stopped database: returned true");
}
/* Start the database by getting a new connection to it */
conn = getConnection();
/* Check that a new connection to the newly started database is valid */
if (!conn.isValid(0)) {
fail("FAIL: isValid(0) on new connection: " +
"returned false");
}
/*
* Test on stopped Network Server client
*/
if ( !usingEmbedded() ) {
TestConfiguration.getCurrent().stopNetworkServer();
/* Test that the connection is not valid */
if (conn.isValid(0)) {
fail("FAIL: isValid(0) on stopped database: returned true");
}
/*
* Start the network server and get a new connection and check that
* the new connection is valid.
*/
TestConfiguration.getCurrent().startNetworkServer();
// Get a new connection to the database
conn = getConnection();
/* Check that a new connection to the newly started Derby is valid */
if (!conn.isValid(0)) {
fail("FAIL: isValid(0) on new connection: returned false");
}
}
}
}
| [
"swale@snappydata.io"
] | swale@snappydata.io |
b97fb78264ed75b0f91e033cf3fb982a224c496c | cab1cf64013821b4bee0b74cc2eb4504f4fbe76e | /src/SecondTry/Source_Code/OOD/Lessons7_Composite/try2/Tree.java | d6eeef172504a8ad59eb5c504dac6624fa14b94a | [] | no_license | alexkozlovski/firstConstructor | 7f8d6a29f510139bc0e0879ca5a6189069ed21ed | 67f63420181c3bcd2e0c7b4929805caf78707f31 | refs/heads/master | 2020-05-15T04:37:38.263546 | 2019-04-18T13:15:38 | 2019-04-18T13:15:38 | 151,950,835 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 251 | java | package SecondTry.Source_Code.OOD.Lessons7_Composite.try2;
/**
* Created by user on 13.10.2018.
*/
public class Tree implements Component {
@Override
public void show() {
System.out.println("watchImage tree".toUpperCase());
}
}
| [
"alexkozlovski@mail.ru"
] | alexkozlovski@mail.ru |
d03e6b2eceda1c87461e841310a98f7d082623fc | f5aa2a52761cdd8bce39319d79ef5a34c410b59d | /src/main/java/com/bot/elizaBot/Bot.java | 86d8840aecfca5d08655e7c3489b6228abb4a58f | [] | no_license | feemonteiro/elizaBotSE | f51855b046b6c0d44260e2e0dd4defd1bb19461c | 807f9ae02c027984b197cbdfd44eca52d0b95852 | refs/heads/master | 2021-05-02T10:42:35.725113 | 2018-02-20T19:24:22 | 2018-02-20T19:24:22 | 120,761,601 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,490 | java | package com.bot.elizaBot;
import java.io.IOException;
import java.util.Scanner;
public class Bot {
private Saudacao _saudacao;
private Despedida _despedida;
private Conversa _conversa;
private boolean _fimDialogo;
public Bot() {
//_saudacao = new Saudacao();
//_despedida = new Despedida();
//_conversa = new Conversa();
System.out.println("Olá, eu me chamo Eliza. Sou a assistente virtual da UFRN, e estou a disposição 24h para te " +
"ajudar. Clique no endereço abaixo para entender melhor como podemos nos comunicar. Ou digite \"#ajuda\". ");
// espera
// if contato recebido, inicia conversa
Scanner reader = new Scanner(System.in);
if (reader.hasNextLine()){
try {
_conversa = new Conversa(reader.nextLine());
} catch (IOException e) {
e.printStackTrace();
}
}
}
public String dialogo(String respostaAluno){
if(_conversa.getTeveSaudacao() == false){
if(_saudacao.verificaSaudacao(respostaAluno)) {
_conversa.setTeveSaudacao(true);
return _saudacao.pickASaudacao();
}else{
return "Desculpe, não consegui entender.";
}
}
_fimDialogo = true;
return "Alguma coisa muito errada aconteceu!";
}
public boolean getFimDialogo(){
return _fimDialogo;
}
}
| [
"marciojunior159@gmail.com"
] | marciojunior159@gmail.com |
4079aa96fa0ab8c2dd6fd6022d547b35eb99a409 | a3718ecf43b6a164c61dc5940583551821bfcccb | /NaiveIndex/src/naiveindex/NaiveIndex.java | e2fe16f4190f9a789ed70ec52a23011cae8fee55 | [] | no_license | jasvir99/CECS-529 | 106e6ff3b2a56d38b8a8670630988e3954c0329e | a5c7bd8c51a523a4c90778b8b10871ad07d596fd | refs/heads/master | 2021-01-22T01:37:55.071969 | 2016-09-20T21:03:19 | 2016-09-20T21:03:19 | 68,400,778 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,948 | 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 naiveindex;
import java.io.IOException;
import java.nio.file.*;
import java.nio.file.attribute.*;
import java.util.*;
/**
*
* @author jass
*/
public class NaiveIndex {
private String[] mTermArray;
private String[] mFileArray;
private boolean[][] mIndex;
/**
Indexes all .txt files in the specified directory. First builds a dictionary
of all terms in those files, then builds a boolean term-document matrix as
the index.
@param directory the Path of the directory to index.
*/
public void indexDirectory(final Path directory) {
// will need a data structure to store all the terms in the document
// HashSet: a hashtable structure with constant-time insertion; does not
// allow duplicate entries; stores entries in unsorted order.
final HashSet<String> dictionary = new HashSet<>();
final HashSet<String> files = new HashSet<>();
try {
// go through each .txt file in the working directory
System.out.println(directory.toString());
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) {
// make sure we only process the current working directory
if (directory.equals(dir)) {
return FileVisitResult.CONTINUE;
}
return FileVisitResult.SKIP_SUBTREE;
}
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) {
// only process .txt files
if (file.toString().endsWith(".txt")) {
buildDictionary(file, dictionary);
files.add(file.getFileName().toString());
}
return FileVisitResult.CONTINUE;
}
// don't throw exceptions if files are locked/other errors occur
public FileVisitResult visitFileFailed(Path file,
IOException e) {
return FileVisitResult.CONTINUE;
}
});
// convert the dictionaries to sorted arrays, so we can use binary
// search for finding indices.
mTermArray = dictionary.toArray(new String[0]);
mFileArray = files.toArray(new String[0]);
Arrays.sort(mTermArray);
Arrays.sort(mFileArray);
// construct the term-document matrix. docs are rows, terms are cols.
mIndex = new boolean[files.size()][dictionary.size()];
// walk back through the files -- a second time!!
Files.walkFileTree(directory, new SimpleFileVisitor<Path>() {
public FileVisitResult preVisitDirectory(Path dir,
BasicFileAttributes attrs) {
if (directory.equals(dir)) {
return FileVisitResult.CONTINUE;
}
return FileVisitResult.SKIP_SUBTREE;
}
public FileVisitResult visitFile(Path file,
BasicFileAttributes attrs) {
if (file.toString().endsWith(".txt")) {
// add entries to the index matrix for this file
indexFile(file, mIndex, mTermArray, mFileArray);
}
return FileVisitResult.CONTINUE;
}
public FileVisitResult visitFileFailed(Path file, IOException e) {
return FileVisitResult.CONTINUE;
}
});
}
catch (Exception ex) {
}
}
public static void main(String[] args) {
// Example use: construct a NaiveIndex object, then use it to index all
// *.txt files in a specified directory. Then print the results.
NaiveIndex index = new NaiveIndex();
// this gets the current working path.
final Path currentWorkingPath = Paths.get("").toAbsolutePath();
index.indexDirectory(currentWorkingPath);
index.printResults();
ArrayList<String> found_list = new ArrayList<>();
Scanner input = new Scanner(System.in);
while(true)
{
System.out.println("Enter a term to search for(Type 'quit' to exit):");
String word = input.next();
if(!"quit".equals(word) && !"Quit".equals(word))
{
Arrays.sort(index.mTermArray);
int word_index = Arrays.binarySearch(index.mTermArray, word);
for(int file_index = 0; file_index < index.mFileArray.length; file_index++)
{
if(index.mIndex[file_index][word_index])
found_list.add(index.mFileArray[file_index]);
}
System.out.println("These document/s contain the term:");
for(String doc : found_list)
System.out.println(doc);
}
else
{
break;
}
}
}
// reads the file given by Path; adds each term from file to the dictionary
private static void buildDictionary(Path file, HashSet<String> dictionary) {
try {
try (Scanner scan = new Scanner(file)) {
while (scan.hasNext()) {
// read one word at a time; process and add it to dictionary.
String word = processWord(scan.next());
if (word.length() > 0) {
dictionary.add(word);
}
}
}
}
catch (IOException ex) {
}
}
private static void indexFile(Path file, boolean[][] index,
String[] dictArray, String[] fileArray) {
// get the row# for this file in the index matrix.
int fileRow
= Arrays.binarySearch(fileArray, file.getFileName().toString());
try {
// read one word at a time; process and update the matrix.
try (Scanner scan = new Scanner(file)) {
while (scan.hasNext()) {
String word = processWord(scan.next());
if (word.length() > 0) {
int wordCol = Arrays.binarySearch(dictArray, word);
index[fileRow][wordCol] = true;
}
}
}
}
catch (IOException ex) {
}
}
private static String processWord(String next) {
return next.replaceAll("\\W", "").toLowerCase();
}
/**
Prints the result of the indexing, as a matrix of 0 and 1 entries. Warning:
prints a lot of text :).
*/
public void printResults() {
// find the longest file name in the index
int longestFile = 0;
for (String file : mFileArray) {
longestFile = Math.max(longestFile, file.length());
}
// find the longest word length in the index
int longestWord = 0;
for (String dict : mTermArray) {
longestWord = Math.max(longestWord, dict.length());
}
// print all the words in one row
System.out.print("TERMS:");
printSpaces(longestFile + 2 - 6);
for (String word : mTermArray) {
System.out.print(word);
printSpaces(longestWord - word.length() + 1);
}
System.out.println("");
// for each file: print file name, then a 1 or 0 in each column of each
// word in the index.
int fNdx = 0;
for (String file : mFileArray) {
System.out.print(file + ": ");
printSpaces(longestFile - file.length());
for (int i = 0; i < mIndex[fNdx].length; i++) {
System.out.print(mIndex[fNdx][i] ? "1" : "0");
printSpaces(longestWord);
}
System.out.println("");
fNdx++;
}
}
// prints a bunch of spaces
private static void printSpaces(int spaces) {
for (int i = 0; i < spaces; i++) {
System.out.print(" ");
}
}
} | [
"jassigrewal91@gmail.com"
] | jassigrewal91@gmail.com |
ee002104de602f23796a1e2cfc8ab7b83b35e6af | 5faa640463c21b7bdf57c9f6a4f3c61274fd1b6c | /Iteration05/Code/Utils/src/packet/RequestBuilder.java | 8eb1c951b3e8f840e062ddc9ad921a6681d23a26 | [] | no_license | Draktir/SYSC3303 | f7a9c7c9dea9d3c7492661eb5ef38facad4f1f06 | 0a8ac488ff5c7d1d3d85e7c0782501067b58834f | refs/heads/master | 2021-05-30T17:30:28.358897 | 2016-04-04T00:02:08 | 2016-04-04T00:02:08 | 49,902,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 891 | java | package packet;
public class RequestBuilder extends PacketBuilder<RequestBuilder> {
private String filename = "";
private String mode = "netascii";
public WriteRequest buildWriteRequest() {
return new WriteRequest(remoteHost, remotePort, filename, mode);
}
public ReadRequest buildReadRequest() {
return new ReadRequest(remoteHost, remotePort, filename, mode);
}
public String getFilename() {
return filename;
}
public RequestBuilder setFilename(String filename) {
this.filename = filename;
return this;
}
public String getMode() {
return mode;
}
public RequestBuilder setMode(String mode) {
this.mode = mode;
return this;
}
@Override
public String toString() {
return "RequestBuilder [filename=" + filename + ", mode=" + mode + ", remoteHost=" + remoteHost + ", remotePort="
+ remotePort + "]";
}
}
| [
"loktinw@hotmail.com"
] | loktinw@hotmail.com |
4ba29aff772ed9e80f98efdb5c3af62648abac95 | 33dd7ec35a0c5762631f85a5c87bcc40adcd3a54 | /framework-parent/framework-component/framework-zuul/src/main/java/com/lego/framework/zuul/filter/ErrorFilter.java | e1ac2960d2edb07d5115ad3394dd6a11a4c56d4c | [] | no_license | gaoleigreat/bigdata-perception | 4736c5fd5b28ef1788a3f507a5f23c6d8e7176c6 | c183d95230f59f18a3e63d1c926cfdaae8d9126c | refs/heads/master | 2022-12-11T16:21:34.946023 | 2019-11-06T06:15:38 | 2019-11-06T06:15:38 | 217,037,877 | 0 | 1 | null | 2022-12-06T00:44:09 | 2019-10-23T11:12:51 | Python | UTF-8 | Java | false | false | 2,132 | java | package com.lego.framework.zuul.filter;
import com.alibaba.fastjson.JSONObject;
import com.framework.common.sdto.RespVOBuilder;
import com.netflix.zuul.ZuulFilter;
import com.netflix.zuul.context.RequestContext;
import com.netflix.zuul.exception.ZuulException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter;
import static org.springframework.cloud.netflix.zuul.filters.support.FilterConstants.ERROR_TYPE;
/**
* @author : yanglf
* @version : 1.0
* @created IntelliJ IDEA.
* @date : 2019/11/2 17:08
* @desc :
*/
@Slf4j
@Component
public class ErrorFilter extends ZuulFilter {
@Override
public String filterType() {
return ERROR_TYPE;
}
@Override
public int filterOrder() {
return -1;
}
@Override
public boolean shouldFilter() {
return RequestContext.getCurrentContext().containsKey("throwable");
}
@Override
public Object run() throws ZuulException {
try {
RequestContext requestContext = RequestContext.getCurrentContext();
Object e = requestContext.get("throwable");
if (e instanceof ZuulException) {
ZuulException zuulException = (ZuulException) e;
// 删除该异常信息,不然在下一个过滤器中还会被执行处理
requestContext.remove("throwable");
// 响应给客户端信息
HttpServletResponse response = requestContext.getResponse();
response.setHeader("Content-type", "application/json;charset=UTF-8");
response.setCharacterEncoding("UTF-8");
PrintWriter pw = response.getWriter();
pw.write(JSONObject.toJSONString(RespVOBuilder.failure()));
pw.close();
}
} catch (Exception ex) {
log.error("Exception filtering in custom error filter", ex);
ReflectionUtils.rethrowRuntimeException(ex);
}
return null;
}
}
| [
"文字899117"
] | 文字899117 |
5d11ec0309e9aca91d3c17ef5652c0e969b7c919 | 6f1ad395dc2f1390e5e440bcf4043cf7bbe9ae17 | /ML-ECC/src/hr/matlazar/ecc/domains/KeyPair.java | 0735e680128272229e190513dd9a4876f2f1d4d6 | [] | no_license | matlazar/ML-ECC | 66ccac952141752dcf60d2ee5540b3e836eff55d | cc3b26f5753bd1b65318ae5ab75a924c2088bc39 | refs/heads/master | 2020-04-15T21:35:58.238690 | 2019-05-04T12:56:30 | 2019-05-04T12:56:30 | 165,039,058 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 428 | java | package hr.matlazar.ecc.domains;
import java.math.BigInteger;
public class KeyPair {
public String privateKey;
public String publicKey;
public String getPrivateKey() {
return privateKey;
}
public void setPrivateKey(String privateKey) {
this.privateKey = privateKey;
}
public String getPublicKey() {
return publicKey;
}
public void setPublicKey(String publicKey) {
this.publicKey = publicKey;
}
}
| [
"matlazar94@gmail.com"
] | matlazar94@gmail.com |
1f397d26f1f566de9f20f74b629437b0e8fbd82e | 12c85a6c3ee763dff3153a98c0549526c2cffc5a | /src/org/ironrhino/security/oauth/client/service/OAuth1Provider.java | 44e3d23f3106ee7b431b1ff30e735e490d70a5b6 | [] | no_license | kpaxer/ironrhino | 978cc8840fd054fbf325d887ef3d63402832b9f3 | fb6a9e87850a0e7a75389b0a453925b23392e283 | refs/heads/master | 2020-12-11T07:52:18.730018 | 2015-11-13T03:15:53 | 2015-11-13T03:15:53 | 46,122,649 | 1 | 0 | null | 2015-11-13T13:10:38 | 2015-11-13T13:10:35 | null | UTF-8 | Java | false | false | 12,281 | java | package org.ironrhino.security.oauth.client.service;
import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.TreeMap;
import javax.annotation.PostConstruct;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.ironrhino.core.util.CodecUtils;
import org.ironrhino.core.util.HttpClientUtils;
import org.ironrhino.security.oauth.client.model.OAuth1Token;
import org.ironrhino.security.oauth.client.model.OAuthToken;
import org.ironrhino.security.oauth.client.model.Profile;
public abstract class OAuth1Provider extends AbstractOAuthProvider {
public abstract String getRequestTokenUrl();
public abstract String getAuthorizeUrl();
public abstract String getAccessTokenUrl();
@Override
public String getVersion() {
return "v1";
}
public String getRealm() {
return null;
}
public boolean isIncludeCallbackWhenRequestToken() {
return false;
}
public String getConsumerKey() {
return settingControl.getStringValue("oauth." + getName() + ".consumerKey");
}
public String getConsumerSecret() {
return settingControl.getStringValue("oauth." + getName() + ".consumerSecret");
}
@Override
public boolean isEnabled() {
return super.isEnabled() && StringUtils.isNotBlank(getConsumerKey());
}
@PostConstruct
public void afterPropertiesSet() {
String key = getConsumerKey();
String secret = getConsumerSecret();
if (StringUtils.isEmpty(key) || StringUtils.isEmpty(secret))
logger.warn(getName() + " key or secret is empty");
}
@Override
@SuppressWarnings("unchecked")
public String getAuthRedirectURL(HttpServletRequest request, String targetUrl) throws Exception {
OAuth1Token accessToken = restoreToken(request, "access");
if (accessToken != null)
return targetUrl;
String responseBody = null;
Map<String, String> map = null;
if (isIncludeCallbackWhenRequestToken()) {
map = new HashMap<>(2, 1);
map.put("oauth_callback", targetUrl);
}
if (isUseAuthorizationHeader()) {
Map<String, String> headers = getAuthorizationHeaders("GET", getRequestTokenUrl(), map, getRealm(), "", "");
responseBody = HttpClientUtils.getResponseText(getRequestTokenUrl(), map, headers);
} else {
Map<String, String> params = getOAuthParams("GET", getRequestTokenUrl(), map, "", "");
responseBody = HttpClientUtils.getResponseText(getRequestTokenUrl(), params, Collections.EMPTY_MAP);
}
OAuth1Token requestToken = null;
try {
requestToken = new OAuth1Token(responseBody);
} catch (Exception e) {
logger.error("content is {}", responseBody);
}
if (requestToken == null)
throw new IllegalArgumentException("requestToken is null,responseBody : " + responseBody);
saveToken(request, requestToken, "request");
StringBuilder sb = new StringBuilder(getAuthorizeUrl());
sb.append(sb.indexOf("?") > 0 ? '&' : '?').append("oauth_token").append('=').append(requestToken.getToken());
if (!isIncludeCallbackWhenRequestToken())
sb.append('&').append("oauth_callback").append("=").append(URLEncoder.encode(targetUrl, "UTF-8"));
return sb.toString();
}
@Override
@SuppressWarnings("unchecked")
public OAuthToken getToken(HttpServletRequest request) throws Exception {
OAuth1Token accessToken = restoreToken(request, "access");
if (accessToken == null) {
OAuth1Token requestToken = restoreToken(request, "request");
removeToken(request, "request");
String oauth_verifier = request.getParameter("oauth_verifier");
Map<String, String> map = new HashMap<>(4, 1);
map.put("oauth_token", requestToken.getToken());
if (oauth_verifier != null)
map.put("oauth_verifier", oauth_verifier);
String responseBody = null;
if (isUseAuthorizationHeader()) {
Map<String, String> headers = getAuthorizationHeaders("GET", getAccessTokenUrl(), map, getRealm(),
requestToken.getToken(), requestToken.getSecret());
responseBody = HttpClientUtils.getResponseText(getAccessTokenUrl(), null, headers);
} else {
Map<String, String> params = getOAuthParams("GET", getAccessTokenUrl(), map, requestToken.getToken(),
requestToken.getSecret());
responseBody = HttpClientUtils.getResponseText(getAccessTokenUrl(), params, Collections.EMPTY_MAP);
}
accessToken = new OAuth1Token(responseBody);
saveToken(request, accessToken, "access");
}
return accessToken;
}
@Override
public Profile getProfile(HttpServletRequest request) throws Exception {
OAuth1Token accessToken = (OAuth1Token) getToken(request);
String content = invoke(accessToken, getProfileUrl());
try {
Profile p = getProfileFromContent(content);
postProcessProfile(p, accessToken);
return p;
} catch (Exception e) {
logger.error("content is {}", content);
logger.error(e.getMessage(), e);
return null;
}
}
protected void postProcessProfile(Profile p, OAuth1Token accessToken) throws Exception {
}
public String invoke(HttpServletRequest request, String protectedURL) throws Exception {
OAuth1Token accessToken = restoreToken(request, "access");
if (accessToken == null)
throw new IllegalAccessException("must already authorized");
return invoke(accessToken, protectedURL);
}
public String invoke(OAuth1Token accessToken, String protectedURL) throws Exception {
Map<String, String> map;
if (isUseAuthorizationHeader()) {
map = getAuthorizationHeaders("GET", protectedURL, null, getRealm(), accessToken.getToken(),
accessToken.getSecret());
} else {
map = getOAuthParams("GET", protectedURL, null, accessToken.getToken(), accessToken.getSecret());
}
return invoke(protectedURL, isUseAuthorizationHeader() ? null : map, isUseAuthorizationHeader() ? map : null);
}
protected String invoke(String protectedURL, Map<String, String> params, Map<String, String> headers)
throws IOException {
return HttpClientUtils.getResponseText(protectedURL, params, headers);
}
protected void saveToken(HttpServletRequest request, OAuth1Token token, String type) {
request.getSession().setAttribute(tokenSessionKey(type), token.getSource());
}
protected void removeToken(HttpServletRequest request, String type) {
request.getSession().removeAttribute(tokenSessionKey(type));
}
protected OAuth1Token restoreToken(HttpServletRequest request, String type) throws Exception {
if (type.equals("access")) {
String source = (String) request.getSession().getAttribute(tokenSessionKey(type));
if (StringUtils.isBlank(source))
return null;
return new OAuth1Token(source);
}
String source = (String) request.getAttribute(tokenSessionKey(type));
if (StringUtils.isBlank(source))
return null;
return new OAuth1Token(source);
}
private String tokenSessionKey(String type) {
return new StringBuffer(getName()).append('_').append(type).append("_token").toString();
}
protected Map<String, String> getAuthorizationHeaders(String method, String url, Map<String, String> params,
String realm, String token, String tokenSecret) {
Map<String, String> oauthparams = getOAuthParams(method, url, params, token, tokenSecret);
StringBuilder sb = new StringBuilder();
sb.append(getAuthorizationHeaderType());
sb.append(" realm=\"");
if (realm != null)
sb.append(realm);
sb.append("\",");
for (Map.Entry<String, String> entry : oauthparams.entrySet())
sb.append(entry.getKey()).append("=").append("\"").append(Utils.percentEncode(entry.getValue()))
.append("\",");
sb.deleteCharAt(sb.length() - 1);
Map<String, String> map = new HashMap<>(2, 1);
map.put("Authorization", sb.toString());
return map;
}
protected String addOAuthQueryString(String method, String url, Map<String, String> params, String realm,
String token, String tokenSecret) {
Map<String, String> oauthparams = getOAuthParams(method, url, params, token, tokenSecret);
StringBuilder sb = new StringBuilder();
sb.append(url).append(url.indexOf('?') > 0 ? '&' : '?');
for (Map.Entry<String, String> entry : oauthparams.entrySet())
sb.append(entry.getKey()).append("=").append(entry.getValue()).append('&');
sb.deleteCharAt(sb.length() - 1);
return sb.toString();
}
protected Map<String, String> getOAuthParams(String method, String url, Map<String, String> params, String token,
String tokenSecret) {
Map<String, String> oauthparams = new HashMap<>();
oauthparams.put("oauth_consumer_key", getConsumerKey());
oauthparams.put("oauth_timestamp", Utils.getTimestamp());
oauthparams.put("oauth_nonce", Utils.getNonce());
if (StringUtils.isNotBlank(token))
oauthparams.put("oauth_token", token);
oauthparams.put("oauth_signature_method", "HMAC-SHA1");
oauthparams.put("oauth_version", "1.0");
Map<String, String> temp = new HashMap<>();
if (params != null) {
temp.putAll(params);
for (Map.Entry<String, String> entry : params.entrySet())
if (entry.getKey().startsWith("oauth_"))
oauthparams.put(entry.getKey(), entry.getValue());
Iterator<String> iterator = params.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next();
if (key.startsWith("oauth_")) {
iterator.remove();
params.remove(key);
}
}
}
temp.putAll(oauthparams);
try {
String baseString = Utils.getBaseString(method, url, temp);
String signature = Utils.getSignature(baseString, getConsumerSecret(), tokenSecret);
oauthparams.put("oauth_signature", signature);
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return oauthparams;
}
private static class Utils {
public static String getTimestamp() {
return String.valueOf((int) (System.currentTimeMillis() / 1000));
}
public static String getNonce() {
return CodecUtils.randomString(8).toLowerCase();
}
public static String percentEncode(String string) {
try {
return URLEncoder.encode(string, "UTF-8").replaceAll("\\+", "%20").replaceAll("\\*", "%2A")
.replaceAll("%7E", "~");
} catch (Exception e) {
e.printStackTrace();
return string;
}
}
public static String getSignature(String baseString, String consumerSecret, String tokenSecret)
throws Exception {
SecretKeySpec key = new SecretKeySpec(
(percentEncode(consumerSecret) + '&' + percentEncode(tokenSecret)).getBytes("UTF-8"), "HmacSHA1");
Mac mac = Mac.getInstance("HmacSHA1");
mac.init(key);
byte[] bytes = mac.doFinal(baseString.getBytes("UTF-8"));
return new String(Base64.encodeBase64(bytes)).replace("\r\n", "");
}
public static String getBaseString(String method, String url, Map<String, String> params) throws Exception {
StringBuilder sb = new StringBuilder();
sb.append(method.toUpperCase()).append('&');
URL u = new URL(url);
StringBuilder usb = new StringBuilder();
usb.append(u.getProtocol().toLowerCase()).append("://").append(u.getHost().toLowerCase());
if (u.getPort() > 0 && u.getPort() != u.getDefaultPort())
usb.append(":").append(u.getPort());
usb.append(u.getPath());
String queryString = u.getQuery();
if (StringUtils.isNotBlank(queryString)) {
String[] arr = queryString.split("&");
for (String s : arr) {
int i = s.indexOf('=');
if (i > 0) {
params.put(s.substring(0, i), s.substring(i + 1));
} else {
params.put(s, "");
}
}
}
sb.append(percentEncode(usb.toString())).append('&');
TreeMap<String, String> map = new TreeMap<>();
map.putAll(params);
StringBuilder psb = new StringBuilder();
for (Map.Entry<String, String> entry : map.entrySet())
psb.append('&').append(percentEncode(entry.getKey())).append('=')
.append(percentEncode(entry.getValue()));
psb.deleteCharAt(0);
sb.append(percentEncode(psb.toString()));
return sb.toString();
}
}
}
| [
"zhouyanming@gmail.com"
] | zhouyanming@gmail.com |
6aa36a6f2bd0913120ef495e447a99640cd293e1 | ce1b42b30afe89dee7e22e9ad68ddb3d42aca71f | /gestioncabinet-vidal/src/fr/vidal/webservices/interactionservice/SearchInteractionCouplesForCommonNameGroupIdResponse.java | dfba9113cece1966b64398533a534dc95628ee78 | [] | no_license | youvann/JEE | b03bd1fad14b2cc96fb1b63f573a89cd49976c66 | df279b591b372b9e6223761ee3c944bfbd863683 | refs/heads/master | 2021-01-18T03:26:04.988473 | 2015-11-30T14:44:38 | 2015-11-30T14:44:38 | 45,640,103 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,932 | java |
package fr.vidal.webservices.interactionservice;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="interactionCommonNameGroupResult" type="{urn:Vidal}InteractionCommonNameGroupResult"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"interactionCommonNameGroupResult"
})
@XmlRootElement(name = "searchInteractionCouplesForCommonNameGroupIdResponse")
public class SearchInteractionCouplesForCommonNameGroupIdResponse {
@XmlElement(required = true, nillable = true)
protected InteractionCommonNameGroupResult interactionCommonNameGroupResult;
/**
* Gets the value of the interactionCommonNameGroupResult property.
*
* @return
* possible object is
* {@link InteractionCommonNameGroupResult }
*
*/
public InteractionCommonNameGroupResult getInteractionCommonNameGroupResult() {
return interactionCommonNameGroupResult;
}
/**
* Sets the value of the interactionCommonNameGroupResult property.
*
* @param value
* allowed object is
* {@link InteractionCommonNameGroupResult }
*
*/
public void setInteractionCommonNameGroupResult(InteractionCommonNameGroupResult value) {
this.interactionCommonNameGroupResult = value;
}
}
| [
"measkevin@gmail.com"
] | measkevin@gmail.com |
77d936c18d88490baf0a00cde4653e631b1c2dd3 | d55b044ce60c06d69325b4634ddb1a46eedc6e1e | /valley/src/main/java/com/hn/d/valley/main/found/FoundUIView2.java | 12403f4ba0d3036e1cee3f55e1e5e34e271b091d | [] | no_license | AppSecAI-TEST/UIView2 | dc40b8554fe130a3e08bc15a0282f3d4ae046e8a | b6e4f10e4e51206c9d76954fa27e185362738495 | refs/heads/master | 2021-01-16T11:41:44.850053 | 2017-08-11T06:13:09 | 2017-08-11T06:13:09 | 100,001,170 | 0 | 0 | null | 2017-08-11T06:53:18 | 2017-08-11T06:53:18 | null | UTF-8 | Java | false | false | 5,573 | java | package com.hn.d.valley.main.found;
import android.Manifest;
import android.graphics.Rect;
import android.support.annotation.DrawableRes;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import com.angcyo.uiview.base.Item;
import com.angcyo.uiview.base.SingleItem;
import com.angcyo.uiview.container.UIParam;
import com.angcyo.uiview.model.TitleBarPattern;
import com.angcyo.uiview.recycler.RBaseViewHolder;
import com.angcyo.uiview.utils.ScreenUtil;
import com.hn.d.valley.R;
import com.hn.d.valley.base.BaseItemUIView;
import com.hn.d.valley.main.MainUIView;
import com.hn.d.valley.main.found.sub.GameListUIView;
import com.hn.d.valley.main.found.sub.HnScanUIView;
import com.hn.d.valley.main.found.sub.HotInformationUIView;
import com.hn.d.valley.main.found.sub.SearchUIView;
import com.hn.d.valley.main.home.nearby.NearbyUIView;
import com.hn.d.valley.sub.other.ItemRecyclerUIView;
import java.util.List;
import rx.functions.Action1;
/**
* Copyright (C) 2016,深圳市红鸟网络科技股份有限公司 All rights reserved.
* 项目名称:
* 类的描述:发现
* 创建人员:Robi
* 创建时间:2016/12/16 13:58
* 修改人员:Robi
* 修改时间:2016/12/16 13:58
* 修改备注:
* Version: 1.0.0
*/
public class FoundUIView2 extends ItemRecyclerUIView<ItemRecyclerUIView.ViewItemInfo> {
public static final String GAME_URL = "http://222.189.228.182:88/webplat/";
@Override
protected int getItemLayoutId(int viewType) {
return R.layout.item_find;
}
@Override
protected TitleBarPattern getTitleBar() {
return super.getTitleBar().setTitleString(mActivity.getString(R.string.nav_found_text)).setShowBackImageView(false);
}
@Override
public void onViewCreate(View rootView, UIParam param) {
super.onViewCreate(rootView, param);
}
@Override
protected void createItems(List<ViewItemInfo> items) {
final int size = ScreenUtil.dip2px(10);
items.add(ViewItemInfo.build(new ItemOffsetCallback(size) {
@Override
public void onBindView(RBaseViewHolder holder, int posInData, ViewItemInfo dataBean) {
bindInitView(holder, getString(R.string.hot_information), "全球资讯轻松浏览", R.drawable.img_news, new View.OnClickListener() {
@Override
public void onClick(View v) {
mParentILayout.startIView(new HotInformationUIView());
}
});
}
}));
items.add(ViewItemInfo.build(new ItemOffsetCallback(size) {
@Override
public void onBindView(RBaseViewHolder holder, int posInData, ViewItemInfo dataBean) {
bindInitView(holder, getString(R.string.search_title), "全网检索,即刻呈现", R.drawable.img_search, new View.OnClickListener() {
@Override
public void onClick(View v) {
MainUIView uiView = (MainUIView) mParentILayout.getIViewWith(MainUIView.class);
mParentILayout.startIView(new SearchUIView().setJumpToDynamicListAction(uiView));
}
});
}
}));
items.add(ViewItemInfo.build(new ItemOffsetCallback(size) {
@Override
public void onBindView(RBaseViewHolder holder, int posInData, ViewItemInfo dataBean) {
bindInitView(holder, getString(R.string.scan_title), "快速读取条码内容", R.drawable.img_scan, new View.OnClickListener() {
@Override
public void onClick(View v) {
mActivity.checkPermissions(new String[]{
Manifest.permission.CAMERA
},
new Action1<Boolean>() {
@Override
public void call(Boolean aBoolean) {
if (aBoolean) {
mParentILayout.startIView(new HnScanUIView());
}
}
});
}
});
}
}));
items.add(ViewItemInfo.build(new ItemOffsetCallback(size) {
@Override
public void onBindView(RBaseViewHolder holder, int posInData, ViewItemInfo dataBean) {
bindInitView(holder, getString(R.string.game), "约上小伙伴一起边聊边玩", R.drawable.img_game, new View.OnClickListener() {
@Override
public void onClick(View v) {
mParentILayout.startIView(new GameListUIView());
}
});
}
}));
}
private void bindInitView(RBaseViewHolder holder, String title , String desc , @DrawableRes int res, View.OnClickListener listener) {
TextView tv_friend_name = holder.tv(R.id.tv_friend_name);
TextView tv_func_desc = holder.tv(R.id.tv_func_desc);
ImageView iv_find = holder.imgV(R.id.iv_find);
tv_friend_name.setText(title);
tv_func_desc.setText(desc);
iv_find.setImageResource(res);
holder.itemView.setOnClickListener(listener);
}
}
| [
"angcyo@126.com"
] | angcyo@126.com |
a519f7fee219468a09bbed73a6e52eb11e9a7890 | 9dbadd86a9c7e59d07870143762a0a83656f0325 | /src/test/java/bastion/Jump.java | ac29008e1267db65592bd49ce4510da14e5de240 | [] | no_license | BinbinGuan/rabbitMq-test | 57d18b1f200e041e6eb4dfe8b80b1bd2ba2fd2ad | 46f15373fb8743922e780efe51d40a3859c188a8 | refs/heads/master | 2022-11-27T16:51:13.819148 | 2021-05-10T03:27:20 | 2021-05-10T03:27:20 | 146,191,706 | 0 | 0 | null | 2022-11-21T22:39:51 | 2018-08-26T15:17:07 | Java | UTF-8 | Java | false | false | 1,526 | java | package bastion;
import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.common.IOUtils;
import net.schmizz.sshj.connection.channel.direct.DirectConnection;
import net.schmizz.sshj.connection.channel.direct.Session;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
/**
* @author: GuanBin
* @date: Created in 下午7:31 2021/2/3
*/
public class Jump {
public static void main(String[] args) throws IOException {
SSHClient firstHop = new SSHClient();
firstHop.loadKnownHosts();
firstHop.connect("192.168.86.69");
try {
firstHop.authPublickey("root");
DirectConnection tunnel = firstHop.newDirectConnection("192.168.86.69", 22);
SSHClient ssh = new SSHClient();
try {
ssh.loadKnownHosts();
ssh.connectVia(tunnel);
ssh.authPublickey("root");
final Session session = ssh.startSession();
try {
final Session.Command cmd = session.exec("ping -c 1 google.com");
System.out.println(IOUtils.readFully(cmd.getInputStream()).toString());
cmd.join(5, TimeUnit.SECONDS);
System.out.println("\n** exit status: " + cmd.getExitStatus());
} finally {
session.close();
}
} finally {
ssh.disconnect();
}
} finally {
firstHop.disconnect();
}
}
}
| [
"binbin.guan@cloudchef.io"
] | binbin.guan@cloudchef.io |
715906380a11f66b6d346710c44059b85fe2d0c7 | 38636c6d17275d7664d0d5fbde58212135ef8773 | /common/src/androidTest/java/com/serenegiant/common/KeyStoreUtilsTest.java | fd1fd147ad68b84b2bdcf6a0e3ae936896c6108c | [
"Apache-2.0"
] | permissive | whosmyqueen/hardware-utils | 372970ea248982bb84821ad986cfbb566e28a51e | eed6790f86c6d92ee86a902c9d2f13542c23fd96 | refs/heads/master | 2023-02-17T17:08:46.468498 | 2021-01-19T07:53:59 | 2021-01-19T07:53:59 | 306,795,085 | 2 | 0 | Apache-2.0 | 2021-01-07T06:32:36 | 2020-10-24T03:10:20 | Java | UTF-8 | Java | false | false | 1,645 | java | package com.serenegiant.common;
import android.content.Context;
import android.content.SharedPreferences;
import com.serenegiant.security.KeyStoreUtils;
import com.serenegiant.security.ObfuscatorException;
import com.serenegiant.system.EncryptedSharedPreferences;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import java.security.GeneralSecurityException;
import androidx.annotation.NonNull;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
/**
* KeyStoreUtils用のインスツルメンテーションテスト用クラス
*/
@RunWith(AndroidJUnit4.class)
public class KeyStoreUtilsTest {
private static final String TAG = KeyStoreUtilsTest.class.getSimpleName();
@Before
public void prepare() {
}
@After
public void cleanUp() {
final Context context = ApplicationProvider.getApplicationContext();
KeyStoreUtils.deleteKey(context, TAG);
}
/**
* 暗号化した文字列を復号して元の文字列に戻るかどうかを確認
*/
@Test
public void test1() {
final Context context = ApplicationProvider.getApplicationContext();
try {
final String original = context.getPackageName();
final String encrypted = KeyStoreUtils.encrypt(context, TAG, original);
final String decrypted = KeyStoreUtils.decrypt(context, TAG, encrypted);
assertEquals(original, decrypted);
} catch (final ObfuscatorException e) {
throw new AssertionError(e);
}
}
}
| [
"saki4510t@gmail.com"
] | saki4510t@gmail.com |
493bc7c2e5b560010068a5ca76708850a6b4e8b0 | 952789d549bf98b84ffc02cb895f38c95b85e12c | /V_3.x/Server/tags/SpagoBI-3.2(20111104)/SpagoBIProject/src/it/eng/spagobi/sdk/documents/stub/DocumentsServiceSoapBindingSkeleton.java | 71769e2f94796a4b4c8ea2ada9862fc9712bda66 | [] | no_license | emtee40/testingazuan | de6342378258fcd4e7cbb3133bb7eed0ebfebeee | f3bd91014e1b43f2538194a5eb4e92081d2ac3ae | refs/heads/master | 2020-03-26T08:42:50.873491 | 2015-01-09T16:17:08 | 2015-01-09T16:17:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,152 | java | /**
* DocumentsServiceSoapBindingSkeleton.java
*
* This file was auto-generated from WSDL
* by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter.
*/
package it.eng.spagobi.sdk.documents.stub;
public class DocumentsServiceSoapBindingSkeleton implements it.eng.spagobi.sdk.documents.stub.DocumentsService, org.apache.axis.wsdl.Skeleton {
private it.eng.spagobi.sdk.documents.stub.DocumentsService impl;
private static java.util.Map _myOperations = new java.util.Hashtable();
private static java.util.Collection _myOperationsList = new java.util.ArrayList();
/**
* Returns List of OperationDesc objects with this name
*/
public static java.util.List getOperationDescByName(java.lang.String methodName) {
return (java.util.List)_myOperations.get(methodName);
}
/**
* Returns Collection of OperationDescs
*/
public static java.util.Collection getOperationDescs() {
return _myOperationsList;
}
static {
org.apache.axis.description.OperationDesc _oper;
org.apache.axis.description.FaultDesc _fault;
org.apache.axis.description.ParameterDesc [] _params;
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in2"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("getDocumentsAsList", _params, new javax.xml.namespace.QName("", "getDocumentsAsListReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "ArrayOf_tns2_SDKDocument"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getDocumentsAsList"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getDocumentsAsList") == null) {
_myOperations.put("getDocumentsAsList", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getDocumentsAsList")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("getDocumentById", _params, new javax.xml.namespace.QName("", "getDocumentByIdReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKDocument"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getDocumentById"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getDocumentById") == null) {
_myOperations.put("getDocumentById", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getDocumentById")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("getDocumentByLabel", _params, new javax.xml.namespace.QName("", "getDocumentByLabelReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKDocument"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getDocumentByLabel"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getDocumentByLabel") == null) {
_myOperations.put("getDocumentByLabel", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getDocumentByLabel")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("getDocumentsAsTree", _params, new javax.xml.namespace.QName("", "getDocumentsAsTreeReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKFunctionality"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getDocumentsAsTree"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getDocumentsAsTree") == null) {
_myOperations.put("getDocumentsAsTree", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getDocumentsAsTree")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("getCorrectRolesForExecution", _params, new javax.xml.namespace.QName("", "getCorrectRolesForExecutionReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "ArrayOf_soapenc_string"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getCorrectRolesForExecution"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getCorrectRolesForExecution") == null) {
_myOperations.put("getCorrectRolesForExecution", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getCorrectRolesForExecution")).add(_oper);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NonExecutableDocumentException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NonExecutableDocumentException"));
_oper.addFault(_fault);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("getDocumentParameters", _params, new javax.xml.namespace.QName("", "getDocumentParametersReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "ArrayOf_tns2_SDKDocumentParameter"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getDocumentParameters"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getDocumentParameters") == null) {
_myOperations.put("getDocumentParameters", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getDocumentParameters")).add(_oper);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NonExecutableDocumentException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NonExecutableDocumentException"));
_oper.addFault(_fault);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("getAdmissibleValues", _params, new javax.xml.namespace.QName("", "getAdmissibleValuesReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://xml.apache.org/xml-soap", "Map"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getAdmissibleValues"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getAdmissibleValues") == null) {
_myOperations.put("getAdmissibleValues", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getAdmissibleValues")).add(_oper);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NonExecutableDocumentException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NonExecutableDocumentException"));
_oper.addFault(_fault);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("downloadTemplate", _params, new javax.xml.namespace.QName("", "downloadTemplateReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "downloadTemplate"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("downloadTemplate") == null) {
_myOperations.put("downloadTemplate", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("downloadTemplate")).add(_oper);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NotAllowedOperationException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NotAllowedOperationException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NotAllowedOperationException"));
_oper.addFault(_fault);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"), it.eng.spagobi.sdk.documents.bo.SDKTemplate.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("uploadTemplate", _params, null);
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "uploadTemplate"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("uploadTemplate") == null) {
_myOperations.put("uploadTemplate", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("uploadTemplate")).add(_oper);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NotAllowedOperationException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NotAllowedOperationException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NotAllowedOperationException"));
_oper.addFault(_fault);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKDocument"), it.eng.spagobi.sdk.documents.bo.SDKDocument.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"), it.eng.spagobi.sdk.documents.bo.SDKTemplate.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in2"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"), java.lang.Integer.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("saveNewDocument", _params, new javax.xml.namespace.QName("", "saveNewDocumentReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "int"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "saveNewDocument"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("saveNewDocument") == null) {
_myOperations.put("saveNewDocument", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("saveNewDocument")).add(_oper);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NotAllowedOperationException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NotAllowedOperationException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NotAllowedOperationException"));
_oper.addFault(_fault);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKDocument"), it.eng.spagobi.sdk.documents.bo.SDKDocument.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("urn:spagobisdkdocuments", "ArrayOf_tns2_SDKDocumentParameter"), it.eng.spagobi.sdk.documents.bo.SDKDocumentParameter[].class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in2"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in3"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("executeDocument", _params, new javax.xml.namespace.QName("", "executeDocumentReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKExecutedDocumentContent"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "executeDocument"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("executeDocument") == null) {
_myOperations.put("executeDocument", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("executeDocument")).add(_oper);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NonExecutableDocumentException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NonExecutableDocumentException"));
_oper.addFault(_fault);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("InvalidParameterValue");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.InvalidParameterValue");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "InvalidParameterValue"));
_oper.addFault(_fault);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("MissingParameterValue");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.MissingParameterValue");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "MissingParameterValue"));
_oper.addFault(_fault);
_fault = new org.apache.axis.description.FaultDesc();
_fault.setName("NotAllowedOperationException");
_fault.setQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "fault"));
_fault.setClassName("it.eng.spagobi.sdk.exceptions.NotAllowedOperationException");
_fault.setXmlType(new javax.xml.namespace.QName("http://exceptions.sdk.spagobi.eng.it", "NotAllowedOperationException"));
_oper.addFault(_fault);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"), it.eng.spagobi.sdk.documents.bo.SDKTemplate.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"), it.eng.spagobi.sdk.documents.bo.SDKTemplate.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("uploadDatamartTemplate", _params, null);
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "uploadDatamartTemplate"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("uploadDatamartTemplate") == null) {
_myOperations.put("uploadDatamartTemplate", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("uploadDatamartTemplate")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"), it.eng.spagobi.sdk.documents.bo.SDKTemplate.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("uploadDatamartModel", _params, null);
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "uploadDatamartModel"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("uploadDatamartModel") == null) {
_myOperations.put("uploadDatamartModel", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("uploadDatamartModel")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("downloadDatamartFile", _params, new javax.xml.namespace.QName("", "downloadDatamartFileReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "downloadDatamartFile"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("downloadDatamartFile") == null) {
_myOperations.put("downloadDatamartFile", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("downloadDatamartFile")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in0"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in1"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
new org.apache.axis.description.ParameterDesc(new javax.xml.namespace.QName("", "in2"), org.apache.axis.description.ParameterDesc.IN, new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"), java.lang.String.class, false, false),
};
_oper = new org.apache.axis.description.OperationDesc("downloadDatamartModelFiles", _params, new javax.xml.namespace.QName("", "downloadDatamartModelFilesReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://bo.documents.sdk.spagobi.eng.it", "SDKTemplate"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "downloadDatamartModelFiles"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("downloadDatamartModelFiles") == null) {
_myOperations.put("downloadDatamartModelFiles", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("downloadDatamartModelFiles")).add(_oper);
_params = new org.apache.axis.description.ParameterDesc [] {
};
_oper = new org.apache.axis.description.OperationDesc("getAllDatamartModels", _params, new javax.xml.namespace.QName("", "getAllDatamartModelsReturn"));
_oper.setReturnType(new javax.xml.namespace.QName("http://xml.apache.org/xml-soap", "Map"));
_oper.setElementQName(new javax.xml.namespace.QName("urn:spagobisdkdocuments", "getAllDatamartModels"));
_oper.setSoapAction("");
_myOperationsList.add(_oper);
if (_myOperations.get("getAllDatamartModels") == null) {
_myOperations.put("getAllDatamartModels", new java.util.ArrayList());
}
((java.util.List)_myOperations.get("getAllDatamartModels")).add(_oper);
}
public DocumentsServiceSoapBindingSkeleton() {
this.impl = new it.eng.spagobi.sdk.documents.stub.DocumentsServiceSoapBindingImpl();
}
public DocumentsServiceSoapBindingSkeleton(it.eng.spagobi.sdk.documents.stub.DocumentsService impl) {
this.impl = impl;
}
public it.eng.spagobi.sdk.documents.bo.SDKDocument[] getDocumentsAsList(java.lang.String in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException
{
it.eng.spagobi.sdk.documents.bo.SDKDocument[] ret = impl.getDocumentsAsList(in0, in1, in2);
return ret;
}
public it.eng.spagobi.sdk.documents.bo.SDKDocument getDocumentById(java.lang.Integer in0) throws java.rmi.RemoteException
{
it.eng.spagobi.sdk.documents.bo.SDKDocument ret = impl.getDocumentById(in0);
return ret;
}
public it.eng.spagobi.sdk.documents.bo.SDKDocument getDocumentByLabel(java.lang.String in0) throws java.rmi.RemoteException
{
it.eng.spagobi.sdk.documents.bo.SDKDocument ret = impl.getDocumentByLabel(in0);
return ret;
}
public it.eng.spagobi.sdk.documents.bo.SDKFunctionality getDocumentsAsTree(java.lang.String in0) throws java.rmi.RemoteException
{
it.eng.spagobi.sdk.documents.bo.SDKFunctionality ret = impl.getDocumentsAsTree(in0);
return ret;
}
public java.lang.String[] getCorrectRolesForExecution(java.lang.Integer in0) throws java.rmi.RemoteException, it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException
{
java.lang.String[] ret = impl.getCorrectRolesForExecution(in0);
return ret;
}
public it.eng.spagobi.sdk.documents.bo.SDKDocumentParameter[] getDocumentParameters(java.lang.Integer in0, java.lang.String in1) throws java.rmi.RemoteException, it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException
{
it.eng.spagobi.sdk.documents.bo.SDKDocumentParameter[] ret = impl.getDocumentParameters(in0, in1);
return ret;
}
public java.util.HashMap getAdmissibleValues(java.lang.Integer in0, java.lang.String in1) throws java.rmi.RemoteException, it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException
{
java.util.HashMap ret = impl.getAdmissibleValues(in0, in1);
return ret;
}
public it.eng.spagobi.sdk.documents.bo.SDKTemplate downloadTemplate(java.lang.Integer in0) throws java.rmi.RemoteException, it.eng.spagobi.sdk.exceptions.NotAllowedOperationException
{
it.eng.spagobi.sdk.documents.bo.SDKTemplate ret = impl.downloadTemplate(in0);
return ret;
}
public void uploadTemplate(java.lang.Integer in0, it.eng.spagobi.sdk.documents.bo.SDKTemplate in1) throws java.rmi.RemoteException, it.eng.spagobi.sdk.exceptions.NotAllowedOperationException
{
impl.uploadTemplate(in0, in1);
}
public java.lang.Integer saveNewDocument(it.eng.spagobi.sdk.documents.bo.SDKDocument in0, it.eng.spagobi.sdk.documents.bo.SDKTemplate in1, java.lang.Integer in2) throws java.rmi.RemoteException, it.eng.spagobi.sdk.exceptions.NotAllowedOperationException
{
java.lang.Integer ret = impl.saveNewDocument(in0, in1, in2);
return ret;
}
public it.eng.spagobi.sdk.documents.bo.SDKExecutedDocumentContent executeDocument(it.eng.spagobi.sdk.documents.bo.SDKDocument in0, it.eng.spagobi.sdk.documents.bo.SDKDocumentParameter[] in1, java.lang.String in2, java.lang.String in3) throws java.rmi.RemoteException, it.eng.spagobi.sdk.exceptions.NonExecutableDocumentException, it.eng.spagobi.sdk.exceptions.InvalidParameterValue, it.eng.spagobi.sdk.exceptions.MissingParameterValue, it.eng.spagobi.sdk.exceptions.NotAllowedOperationException
{
it.eng.spagobi.sdk.documents.bo.SDKExecutedDocumentContent ret = impl.executeDocument(in0, in1, in2, in3);
return ret;
}
public void uploadDatamartTemplate(it.eng.spagobi.sdk.documents.bo.SDKTemplate in0, it.eng.spagobi.sdk.documents.bo.SDKTemplate in1) throws java.rmi.RemoteException
{
impl.uploadDatamartTemplate(in0, in1);
}
public void uploadDatamartModel(it.eng.spagobi.sdk.documents.bo.SDKTemplate in0) throws java.rmi.RemoteException
{
impl.uploadDatamartModel(in0);
}
public it.eng.spagobi.sdk.documents.bo.SDKTemplate downloadDatamartFile(java.lang.String in0, java.lang.String in1) throws java.rmi.RemoteException
{
it.eng.spagobi.sdk.documents.bo.SDKTemplate ret = impl.downloadDatamartFile(in0, in1);
return ret;
}
public it.eng.spagobi.sdk.documents.bo.SDKTemplate downloadDatamartModelFiles(java.lang.String in0, java.lang.String in1, java.lang.String in2) throws java.rmi.RemoteException
{
it.eng.spagobi.sdk.documents.bo.SDKTemplate ret = impl.downloadDatamartModelFiles(in0, in1, in2);
return ret;
}
public java.util.HashMap getAllDatamartModels() throws java.rmi.RemoteException
{
java.util.HashMap ret = impl.getAllDatamartModels();
return ret;
}
}
| [
"franceschini@99afaf0d-6903-0410-885a-c66a8bbb5f81"
] | franceschini@99afaf0d-6903-0410-885a-c66a8bbb5f81 |
7c6f04dc6dbc98a26357954c1439bb2d16790db4 | 1c1424d5241d384025fb45f5d84f302a0fd801d4 | /UTIL/vectorcl.java | 3b125e88416aebf7499fa0599209dabd15bd1a32 | [] | no_license | sonivaibhv/Online.shop | 180ceab14b89a55c7e750d25485057d9f6de1902 | 815810afa409eacb1a458f49544951a92ae56802 | refs/heads/master | 2016-08-09T06:17:51.902827 | 2016-01-06T20:14:44 | 2016-01-06T20:14:44 | 49,195,679 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 988 | java | import java.util.*;
class vectorcl{
public static void main(String args[]){
Vector v=new Vector(3,2);
System.out.println("size:"+v.size());
System.out.println("capacity:"+v.capacity());
v.addElement(new Integer(1));
v.addElement(new Integer(2));
v.addElement(new Integer(3));
v.addElement(new Integer(4));
System.out.println("capacity after four additions:"+v.capacity());
v.addElement(new Double(3.25));
System.out.println("current capacity:"+v.capacity());
v.addElement(new Float(7.5));
v.addElement(new Integer(1));
System.out.println("current capacity:"+v.capacity());
System.out.println("Firstelement:"+(Integer)v.firstElement());
System.out.println("Lastelement:"+(Integer)v.lastElement());
if(v.contains(new Integer(1)))
System.out.println("contains 1");
Iterator it=v.iterator();
System.out.println("\n elements in vector:");
while(it.hasNext())
System.out.print(it.next()+" ");
System.out.println();
}
}
| [
"Vaibhv.soni1001@gmail.com"
] | Vaibhv.soni1001@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.