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
e5e10644d801c09c58149cba5810d324ff0abafa
36d436f95581dc12767d8f9e41b9a9fe40e3b186
/Aula002/src/aula002/Caneta.java
1e3945d64c3cf8ef0eccf791c1986185aa43b787
[]
no_license
DenesCamilo/Jornada_Java_Orientado_A_Objeto
b3c0d5072e19720af86503528c61c0a3e5cb03ea
0894996da2689d482eb15427abe08d3ab910cd21
refs/heads/main
2023-09-04T21:02:02.070959
2021-10-27T18:22:13
2021-10-27T18:22:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
817
java
package aula002; public class Caneta { public String modelo; public String cor; float ponta; int carga; boolean tampada; void status(){ System.out.println("Modelo "+ this.modelo); System.out.println("Ponta "+this.ponta); System.out.println("Carga "+this.carga); System.out.println("Uma caneta " + this.cor); System.out.println("Esta tampada ? " + this.tampada );} void rabiscar(){ if(this.tampada == true){ System.out.println("ERRO! Caneta tampada!!"); } else{ System.out.println(" Rabiscando ---------***-* "); } } void tampar(){ this.tampada = true; } void destampar(){ this.tampada = false; } }
[ "noreply@github.com" ]
noreply@github.com
53e4d58bc0ceef6627b3ead5cfa4842694c60f0f
2f7f0d084b65372c22ad8af9d2a747698a1fd5b2
/src/main/java/com/api/market/api/persistence/mapper/ProductMapper.java
75fdf86725aa968815611e1c44555228194b2f45
[]
no_license
diegoburland/springbootapi
527e9b0e042b15bcf702b022e43cea7329ae388a
814b205277f17e551b009a907d5055f3389593e7
refs/heads/main
2023-01-02T15:23:30.341747
2020-11-02T01:18:31
2020-11-02T01:18:31
308,724,396
0
0
null
null
null
null
UTF-8
Java
false
false
1,082
java
package com.api.market.api.persistence.mapper; import com.api.market.api.domain.Product; import com.api.market.api.persistence.entity.Producto; import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; import java.util.List; @Mapper(componentModel = "spring", uses = {CategoryMapper.class}) public interface ProductMapper { @Mappings({ @Mapping(source = "idProducto", target = "productId"), @Mapping(source = "nombre", target = "name"), @Mapping(source = "idCategoria", target = "categoryId"), @Mapping(source = "precioVenta", target = "price"), @Mapping(source = "cantidadStock", target = "stock"), @Mapping(source = "estado", target = "active"), @Mapping(source = "categoria", target = "category") }) Product toProduct(Producto producto); List<Product> toProducts(List<Producto> productos); @InheritInverseConfiguration @Mapping(target = "codigoBarras", ignore = true) Producto toProducto(Product product); }
[ "diegoburlando@gmail.com" ]
diegoburlando@gmail.com
12f6091d266fdd19a4b761333749577d15bf51cf
18606c6b3f164a935e571932b3356260b493e543
/benchmarks/org.htmlparser 1.6/src/org/htmlparser/tags/Span.java
4cbc21350baa5af76947c6af2ad200127c4afd1e
[]
no_license
jackyhaoli/abc
d9a3bd2d4140dd92b9f9d0814eeafa16ea7163c4
42071b0dcb91db28d7b7fdcffd062f567a5a1e6c
refs/heads/master
2020-04-03T09:34:47.612136
2019-01-11T07:16:04
2019-01-11T07:16:04
155,169,244
0
0
null
null
null
null
UTF-8
Java
false
false
1,639
java
// HTMLParser Library $Name: $ - A java-based parser for HTML // http://sourceforge.org/projects/htmlparser // Copyright (C) 2004 Somik Raha // // Revision Control Information // // $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/tags/Span.java,v $ // $Author: derrickoswald $ // $Date: 2004/01/02 16:24:55 $ // $Revision: 1.35 $ // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library 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 // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // package org.htmlparser.tags; /** * A span tag. */ public class Span extends CompositeTag { /** * The set of names handled by this tag. */ private static final String[] mIds = new String[] {"SPAN"}; /** * Create a new span tag. */ public Span () { } /** * Return the set of names handled by this tag. * @return The names to be matched that create tags of this type. */ public String[] getIds () { return (mIds); } }
[ "xiemaisi@40514614-586c-40e6-bf05-bf7e477dc3e6" ]
xiemaisi@40514614-586c-40e6-bf05-bf7e477dc3e6
07efaea47757483c5fb90b07e506a9d753a73aaa
c751386b8f72d16f70046db5df195dfcc30ba4ac
/ParentingBook/app/src/main/java/com/example/parentingbook/SpacesItemDecoration.java
0559ecaf1bbb1ed27d40083f5f6d9ecfb7a070d5
[]
no_license
android-app-development-course/2019_a8_poem
a7f14ca8dbe31d3c037c065bcd636bfd95910e59
606547eaee7f4a56ab803ce1bcc53a4d2b37b420
refs/heads/master
2020-08-08T21:05:00.098457
2020-01-05T11:51:16
2020-01-05T11:51:16
213,917,421
0
1
null
null
null
null
UTF-8
Java
false
false
707
java
package com.example.parentingbook; import android.graphics.Rect; import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; public class SpacesItemDecoration extends RecyclerView.ItemDecoration { private int space; public SpacesItemDecoration(int space) { this.space = space; } @Override public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) { outRect.left=space; outRect.right=space; outRect.bottom=space; if (parent.getChildAdapterPosition(view) == 0) { outRect.top = space; } } }
[ "1499405446@qq.com" ]
1499405446@qq.com
a239e7dda6e19edaddd1c645597975e1e5e6cde9
4491a0aa328c4dbf42b0bcbb2b961d24a70f66b6
/Battleship/src/main/java/com/talentpath/Battleship/security/JwtAuthEntryPoint.java
4d25fdf4f9fe71c7197f65a4f7485af1ce5e3dd9
[]
no_license
Cwiesen/Battleship
dbe79e31c49cd780c035f66790ae9c0ce5e14f26
640dc3ae62d565d198ae4226b0fdc2f9c0146f82
refs/heads/main
2023-01-30T16:22:38.105546
2020-12-08T22:41:18
2020-12-08T22:41:18
314,047,311
0
0
null
null
null
null
UTF-8
Java
false
false
936
java
package com.talentpath.Battleship.security; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; import org.springframework.stereotype.Component; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Component public class JwtAuthEntryPoint implements AuthenticationEntryPoint { @Override public void commence( HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException, ServletException { //in this method login has failed //we need to use the response to indicate an error //TODO: add logger httpServletResponse.sendError( HttpServletResponse.SC_UNAUTHORIZED, "Error: unauthorized user"); } }
[ "cwiesen@talentpath.com" ]
cwiesen@talentpath.com
9d1ba7f90ff754a56ed7776462c38c492125683d
deea7954f5292f444d3560b41ab2ff2b33d4e579
/back-test/domain/src/main/java/com/qajungle/talks/integratedandisolated/backtest/domain/model/nobelprize/entity/NobelPrizeLaureateName.java
ca24f45a437743fdeee5f0c9bd31b8e50e70b354
[]
no_license
sarajcarbajal/isolated-test-examples
2c2d593935adda097ffd4cb1c90a73b37424ee75
31b9937306618b2b13771bbaf42f3182079d132c
refs/heads/master
2022-06-02T17:53:35.570120
2020-04-29T05:24:17
2020-04-29T05:24:17
null
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package com.qajungle.talks.integratedandisolated.backtest.domain.model.nobelprize.entity; import lombok.AllArgsConstructor; import lombok.Data; @Data @AllArgsConstructor public class NobelPrizeLaureateName { private final String name; }
[ "aaguila@lookiero.com" ]
aaguila@lookiero.com
128337597045bfd6da2b240dc4aa0f68afd00f44
780dd70ab21650d3fa23f365426a1d11a6e0da9b
/app/src/main/java/panic/com/panicbuttonalpha/PanicActivity.java
a699eb9d35860904ea4a90b06ff385e3f68af736
[]
no_license
josuageovanipinem/PanicButtonAlpha
12798b857a501871111b424f8c42262228ba92af
ee12f99fd5117e50060f58f40b714443a89754cf
refs/heads/master
2020-04-08T14:30:23.642921
2019-12-10T07:28:23
2019-12-10T07:28:23
159,439,789
0
0
null
null
null
null
UTF-8
Java
false
false
4,334
java
//todo tiap variable yang ada harus di pass ke jsonackage panic.com.panicbuttonalpha; package panic.com.panicbuttonalpha; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import panic.com.panicbuttonalpha.R; public class PanicActivity extends AppCompatActivity { SharedPreferences sharedPreferences; private Spinner spinner1; private Spinner spinner2; TextView namaIsian; TextView nipIsian; TextView emailIsian; TextView noTelpIsian; public static final String mypreference = "mypref"; public static final String Nama = "nama"; public static final String NIP = "nip"; public static final String Telp = "telp"; public static final String Email = "email"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_panic); namaIsian = (TextView) findViewById(R.id.namaIsian); nipIsian = (TextView) findViewById(R.id.nipIsian); noTelpIsian = (TextView) findViewById(R.id.noTelpIsian); emailIsian = (TextView) findViewById(R.id.emailIsian); spinner1 = (Spinner) findViewById(R.id.spinner); spinner1.setOnItemSelectedListener(new CustomOnItemSelectedListener()); spinner2 = (Spinner) findViewById(R.id.spinner2); spinner2.setOnItemSelectedListener(new CustomOnItemSelectedListener2()); sharedPreferences = getSharedPreferences(mypreference, Context.MODE_PRIVATE); if (sharedPreferences.contains(Nama)){ namaIsian.setText(sharedPreferences.getString(Nama, "")); } if (sharedPreferences.contains(Email)){ emailIsian.setText(sharedPreferences.getString(Email,"")); } if (sharedPreferences.contains(NIP)){ nipIsian.setText(sharedPreferences.getString(NIP,"")); } if (sharedPreferences.contains(Telp)){ noTelpIsian.setText(sharedPreferences.getString(Telp,"")); } } public class CustomOnItemSelectedListener implements AdapterView.OnItemSelectedListener { String firstItem = String.valueOf(spinner1.getSelectedItem()); public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { if (firstItem.equals(String.valueOf(spinner1.getSelectedItem()))) { // ToDo when first item is selected } else { Toast.makeText(parent.getContext(), "You have selected : " + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show(); } } @Override public void onNothingSelected(AdapterView<?> arg) { } } public class CustomOnItemSelectedListener2 implements AdapterView.OnItemSelectedListener { String firstItem = String.valueOf(spinner2.getSelectedItem()); public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { if (firstItem.equals(String.valueOf(spinner2.getSelectedItem()))) { // ToDo when first item is selected } else { Toast.makeText(parent.getContext(), "You have selected : " + parent.getItemAtPosition(pos).toString(), Toast.LENGTH_LONG).show(); } } @Override public void onNothingSelected(AdapterView<?> arg) { } } //updated simpan data public void firstLogin(View view){ String n = namaIsian.getText().toString(); String e = emailIsian.getText().toString(); String t = noTelpIsian.getText().toString(); String ni = nipIsian.getText().toString(); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString(Nama,n); editor.putString(NIP,ni); editor.putString(Email,e); editor.putString(Telp,t); editor.apply(); Intent intent = new Intent(this, MainActivity.class); startActivity(intent); } }
[ "josuageopinem@gmail.com" ]
josuageopinem@gmail.com
aaf71a54fa8d5c6a531d1ee194236174cfca2a4e
63b8f78137bf0b95f55ca9c8d4df2a209471e67a
/javaEx/src/com/java/oop/staticmembers/Singleton.java
8fb1a5835cc8009a6ea7bfadca6bdd3892d6d2fd
[]
no_license
sandee-han/bit-java
508d41c65ae8965419deb2960ea72308b18e122e
7b5a268bb16c2ed81bc2a0a4ab04990ae67539f3
refs/heads/master
2022-12-04T08:59:42.118868
2020-08-27T02:49:06
2020-08-27T02:49:06
284,865,249
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package com.java.oop.staticmembers; // Singleton Pattern // 어떤 상황에서도 반드시 1개의 인스턴스를 유지해야 하는 경우 public class Singleton { // 인스턴스를 static으로 선언 private static Singleton instance = new Singleton(); // 생성자 private Singleton() { // 절대 두 번 호출되면 안된다 } // 일종의 Getter를 만들어서 우회 접근 public static Singleton getInstance() { return instance; } }
[ "iwmism1938@naver.com" ]
iwmism1938@naver.com
6f7c420983d87796bd9504d7a6580f9dcb35d635
980bed4b6ecb6f5dab7be3abb3d4cac3ceb99aac
/tajrobi2.java
ab954b4d65f55c4e3b2c525c0b20d4af229265a0
[]
no_license
davoudi-mansour/HR-managementSoftware
b46f4ce7d83c1d82100ee18f0123dcead3e961c4
32f92477b2f9adb99a7fe3f6b058a0cda71bafce
refs/heads/main
2023-08-24T06:33:01.298583
2021-10-21T09:03:31
2021-10-21T09:03:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,414
java
import java.awt.*; import java.awt.event.ActionEvent; import javax.swing.*; import javax.swing.GroupLayout; /* * Created by JFormDesigner on Sun Jul 30 06:17:04 PDT 2017 */ /** * @author mansour davoudi */ public class tajrobi2 extends JFrame { public tajrobi2() { initComponents(); } private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - ali mohseni panel1 = new JPanel(); label121 = new JLabel(); textField3 = new JTextField(); button6 = new JButton(); label1 = new JLabel(); //======== this ======== Container contentPane = getContentPane(); //======== panel1 ======== { panel1.setBackground(new Color(255, 204, 204)); // JFormDesigner evaluation mark //---- label121 ---- label121.setText("\u0634\u0646\u0627\u0633\u0647 :"); label121.setForeground(Color.black); label121.setFont(new Font("B Zar", Font.PLAIN, 20)); //---- textField3 ---- textField3.setHorizontalAlignment(SwingConstants.CENTER); textField3.setFont(new Font("Segoe UI", Font.PLAIN, 16)); //---- button6 ---- button6.setText("\u062d\u0630\u0641"); button6.setFont(new Font("Segoe UI", Font.PLAIN, 16)); button6.setBackground(Color.black); button6.setForeground(new Color(255, 153, 153)); button6.addActionListener(e-> actionPerformed(e)); //---- label1 ---- label1.setText("\u0627\u0646\u062c\u0627\u0645 \u0634\u062f!!"); label1.setFont(new Font("Segoe UI", Font.PLAIN, 16)); label1.setForeground(new Color(255, 51, 51)); label1.setVisible(false); GroupLayout panel1Layout = new GroupLayout(panel1); panel1.setLayout(panel1Layout); panel1Layout.setHorizontalGroup( panel1Layout.createParallelGroup() .addGroup(GroupLayout.Alignment.TRAILING, panel1Layout.createSequentialGroup() .addContainerGap(263, Short.MAX_VALUE) .addGroup(panel1Layout.createParallelGroup() .addGroup(GroupLayout.Alignment.TRAILING, panel1Layout.createSequentialGroup() .addComponent(textField3, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(label121) .addGap(85, 85, 85)) .addGroup(GroupLayout.Alignment.TRAILING, panel1Layout.createSequentialGroup() .addComponent(button6, GroupLayout.PREFERRED_SIZE, 129, GroupLayout.PREFERRED_SIZE) .addGap(261, 261, 261)))) .addGroup(panel1Layout.createSequentialGroup() .addGap(289, 289, 289) .addComponent(label1) .addGap(0, 364, Short.MAX_VALUE)) ); panel1Layout.setVerticalGroup( panel1Layout.createParallelGroup() .addGroup(panel1Layout.createSequentialGroup() .addGap(127, 127, 127) .addGroup(panel1Layout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(label121) .addComponent(textField3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 172, Short.MAX_VALUE) .addComponent(button6) .addGap(50, 50, 50) .addComponent(label1) .addGap(30, 30, 30)) ); } GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup( contentPaneLayout.createParallelGroup() .addComponent(panel1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); contentPaneLayout.setVerticalGroup( contentPaneLayout.createParallelGroup() .addComponent(panel1, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); setLocationRelativeTo(getOwner()); // JFormDesigner - End of component initialization //GEN-END:initComponents } // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables // Generated using JFormDesigner Evaluation license - ali mohsenih public JPanel panel1; public JLabel label121; public JTextField textField3; public JButton button6; public JLabel label1; // JFormDesigner - End of variables declaration //GEN-END:variables private void actionPerformed(ActionEvent e) { manageEng MG=new manageEng(); MG.removeTajrobi(this); } }
[ "noreply@github.com" ]
noreply@github.com
3092570a06f8d7c82b8f57b00c4b0017a01c6fc8
7dc6bf17c5acc4a5755063a3ffc0c86f4b6ad8c3
/java_decompiled_from_smali/com/google/android/gms/internal/bx.java
3d9fbc554620b9e8a2558f591e84138460ffd7d9
[]
no_license
alecsandrudaj/mobileapp
183dd6dc5c2fe8ab3aa1f21495d4221e6f304965
b1b4ad337ec36ffb125df8aa1d04c759c33c418a
refs/heads/master
2023-02-19T18:07:50.922596
2021-01-07T15:30:44
2021-01-07T15:30:44
300,325,195
0
0
null
2020-11-19T13:26:25
2020-10-01T15:18:57
Smali
UTF-8
Java
false
false
16,615
java
package com.google.android.gms.internal; import android.os.Parcel; import com.google.ads.AdSize; import com.google.android.gms.common.internal.safeparcel.SafeParcelable; import com.google.android.gms.e; import com.google.android.gms.plus.a.a.a; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public final class bx extends ae implements SafeParcelable, a { public static final bh CREATOR = new bh(); private static final HashMap a = new HashMap(); private String A; private String B; private String C; private String D; private bx E; private String F; private String G; private String H; private String I; private bx J; private double K; private bx L; private double M; private String N; private bx O; private List P; private String Q; private String R; private String S; private String T; private bx U; private String V; private String W; private String X; private bx Y; private String Z; private String aa; private String ab; private String ac; private String ad; private String ae; private final Set b; private final int c; private bx d; private List e; private bx f; private String g; private String h; private String i; private List j; private int k; private List l; private bx m; private List n; private String o; private String p; private bx q; private String r; private String s; private String t; private List u; private String v; private String w; private String x; private String y; private String z; static { a.put("about", ae.a.a("about", 2, bx.class)); a.put("additionalName", ae.a.e("additionalName", 3)); a.put("address", ae.a.a("address", 4, bx.class)); a.put("addressCountry", ae.a.d("addressCountry", 5)); a.put("addressLocality", ae.a.d("addressLocality", 6)); a.put("addressRegion", ae.a.d("addressRegion", 7)); a.put("associated_media", ae.a.b("associated_media", 8, bx.class)); a.put("attendeeCount", ae.a.a("attendeeCount", 9)); a.put("attendees", ae.a.b("attendees", 10, bx.class)); a.put("audio", ae.a.a("audio", 11, bx.class)); a.put("author", ae.a.b("author", 12, bx.class)); a.put("bestRating", ae.a.d("bestRating", 13)); a.put("birthDate", ae.a.d("birthDate", 14)); a.put("byArtist", ae.a.a("byArtist", 15, bx.class)); a.put("caption", ae.a.d("caption", 16)); a.put("contentSize", ae.a.d("contentSize", 17)); a.put("contentUrl", ae.a.d("contentUrl", 18)); a.put("contributor", ae.a.b("contributor", 19, bx.class)); a.put("dateCreated", ae.a.d("dateCreated", 20)); a.put("dateModified", ae.a.d("dateModified", 21)); a.put("datePublished", ae.a.d("datePublished", 22)); a.put("description", ae.a.d("description", 23)); a.put("duration", ae.a.d("duration", 24)); a.put("embedUrl", ae.a.d("embedUrl", 25)); a.put("endDate", ae.a.d("endDate", 26)); a.put("familyName", ae.a.d("familyName", 27)); a.put("gender", ae.a.d("gender", 28)); a.put("geo", ae.a.a("geo", 29, bx.class)); a.put("givenName", ae.a.d("givenName", 30)); a.put("height", ae.a.d("height", 31)); a.put("id", ae.a.d("id", 32)); a.put("image", ae.a.d("image", 33)); a.put("inAlbum", ae.a.a("inAlbum", 34, bx.class)); a.put("latitude", ae.a.b("latitude", 36)); a.put("location", ae.a.a("location", 37, bx.class)); a.put("longitude", ae.a.b("longitude", 38)); a.put("name", ae.a.d("name", 39)); a.put("partOfTVSeries", ae.a.a("partOfTVSeries", 40, bx.class)); a.put("performers", ae.a.b("performers", 41, bx.class)); a.put("playerType", ae.a.d("playerType", 42)); a.put("postOfficeBoxNumber", ae.a.d("postOfficeBoxNumber", 43)); a.put("postalCode", ae.a.d("postalCode", 44)); a.put("ratingValue", ae.a.d("ratingValue", 45)); a.put("reviewRating", ae.a.a("reviewRating", 46, bx.class)); a.put("startDate", ae.a.d("startDate", 47)); a.put("streetAddress", ae.a.d("streetAddress", 48)); a.put("text", ae.a.d("text", 49)); a.put("thumbnail", ae.a.a("thumbnail", 50, bx.class)); a.put("thumbnailUrl", ae.a.d("thumbnailUrl", 51)); a.put("tickerSymbol", ae.a.d("tickerSymbol", 52)); a.put("type", ae.a.d("type", 53)); a.put("url", ae.a.d("url", 54)); a.put("width", ae.a.d("width", 55)); a.put("worstRating", ae.a.d("worstRating", 56)); } public bx() { this.c = 1; this.b = new HashSet(); } bx(Set set, int i, bx bxVar, List list, bx bxVar2, String str, String str2, String str3, List list2, int i2, List list3, bx bxVar3, List list4, String str4, String str5, bx bxVar4, String str6, String str7, String str8, List list5, String str9, String str10, String str11, String str12, String str13, String str14, String str15, String str16, String str17, bx bxVar5, String str18, String str19, String str20, String str21, bx bxVar6, double d, bx bxVar7, double d2, String str22, bx bxVar8, List list6, String str23, String str24, String str25, String str26, bx bxVar9, String str27, String str28, String str29, bx bxVar10, String str30, String str31, String str32, String str33, String str34, String str35) { this.b = set; this.c = i; this.d = bxVar; this.e = list; this.f = bxVar2; this.g = str; this.h = str2; this.i = str3; this.j = list2; this.k = i2; this.l = list3; this.m = bxVar3; this.n = list4; this.o = str4; this.p = str5; this.q = bxVar4; this.r = str6; this.s = str7; this.t = str8; this.u = list5; this.v = str9; this.w = str10; this.x = str11; this.y = str12; this.z = str13; this.A = str14; this.B = str15; this.C = str16; this.D = str17; this.E = bxVar5; this.F = str18; this.G = str19; this.H = str20; this.I = str21; this.J = bxVar6; this.K = d; this.L = bxVar7; this.M = d2; this.N = str22; this.O = bxVar8; this.P = list6; this.Q = str23; this.R = str24; this.S = str25; this.T = str26; this.U = bxVar9; this.V = str27; this.W = str28; this.X = str29; this.Y = bxVar10; this.Z = str30; this.aa = str31; this.ab = str32; this.ac = str33; this.ad = str34; this.ae = str35; } public String A() { return this.x; } public String B() { return this.y; } public String C() { return this.z; } public String D() { return this.A; } public String E() { return this.B; } public String F() { return this.C; } public String G() { return this.D; } /* Access modifiers changed, original: 0000 */ public bx H() { return this.E; } public String I() { return this.F; } public String J() { return this.G; } public String K() { return this.H; } public String L() { return this.I; } /* Access modifiers changed, original: 0000 */ public bx M() { return this.J; } public double N() { return this.K; } /* Access modifiers changed, original: 0000 */ public bx O() { return this.L; } public double P() { return this.M; } public String Q() { return this.N; } /* Access modifiers changed, original: 0000 */ public bx R() { return this.O; } /* Access modifiers changed, original: 0000 */ public List S() { return this.P; } public String T() { return this.Q; } public String U() { return this.R; } public String V() { return this.S; } public String W() { return this.T; } /* Access modifiers changed, original: 0000 */ public bx X() { return this.U; } public String Y() { return this.V; } public String Z() { return this.W; } /* Access modifiers changed, original: protected */ public Object a(String str) { return null; } /* Access modifiers changed, original: protected */ public boolean a(ae.a aVar) { return this.b.contains(Integer.valueOf(aVar.g())); } public String aa() { return this.X; } /* Access modifiers changed, original: 0000 */ public bx ab() { return this.Y; } public String ac() { return this.Z; } public String ad() { return this.aa; } public String ae() { return this.ab; } public String af() { return this.ac; } public String ag() { return this.ad; } public String ah() { return this.ae; } /* renamed from: ai */ public bx a() { return this; } /* Access modifiers changed, original: protected */ public Object b(ae.a aVar) { switch (aVar.g()) { case e.MapAttrs_cameraTargetLat /*2*/: return this.d; case e.MapAttrs_cameraTargetLng /*3*/: return this.e; case e.MapAttrs_cameraTilt /*4*/: return this.f; case e.MapAttrs_cameraZoom /*5*/: return this.g; case e.MapAttrs_uiCompass /*6*/: return this.h; case e.MapAttrs_uiRotateGestures /*7*/: return this.i; case e.MapAttrs_uiScrollGestures /*8*/: return this.j; case e.MapAttrs_uiTiltGestures /*9*/: return Integer.valueOf(this.k); case e.MapAttrs_uiZoomControls /*10*/: return this.l; case e.MapAttrs_uiZoomGestures /*11*/: return this.m; case e.MapAttrs_useViewLifecycle /*12*/: return this.n; case e.MapAttrs_zOrderOnTop /*13*/: return this.o; case 14: return this.p; case 15: return this.q; case 16: return this.r; case 17: return this.s; case 18: return this.t; case 19: return this.u; case 20: return this.v; case 21: return this.w; case 22: return this.x; case 23: return this.y; case 24: return this.z; case 25: return this.A; case 26: return this.B; case 27: return this.C; case 28: return this.D; case 29: return this.E; case 30: return this.F; case 31: return this.G; case AdSize.LANDSCAPE_AD_HEIGHT /*32*/: return this.H; case 33: return this.I; case 34: return this.J; case 36: return Double.valueOf(this.K); case 37: return this.L; case 38: return Double.valueOf(this.M); case 39: return this.N; case 40: return this.O; case 41: return this.P; case 42: return this.Q; case 43: return this.R; case 44: return this.S; case 45: return this.T; case 46: return this.U; case 47: return this.V; case 48: return this.W; case 49: return this.X; case AdSize.PORTRAIT_AD_HEIGHT /*50*/: return this.Y; case 51: return this.Z; case 52: return this.aa; case 53: return this.ab; case 54: return this.ac; case 55: return this.ad; case 56: return this.ae; default: throw new IllegalStateException("Unknown safe parcelable id=" + aVar.g()); } } public HashMap b() { return a; } /* Access modifiers changed, original: protected */ public boolean b(String str) { return false; } public int describeContents() { bh bhVar = CREATOR; return 0; } /* Access modifiers changed, original: 0000 */ public Set e() { return this.b; } public boolean equals(Object obj) { if (!(obj instanceof bx)) { return false; } if (this == obj) { return true; } bx bxVar = (bx) obj; for (ae.a aVar : a.values()) { if (a(aVar)) { if (!bxVar.a(aVar)) { return false; } if (!b(aVar).equals(bxVar.b(aVar))) { return false; } } else if (bxVar.a(aVar)) { return false; } } return true; } /* Access modifiers changed, original: 0000 */ public int f() { return this.c; } /* Access modifiers changed, original: 0000 */ public bx g() { return this.d; } public List h() { return this.e; } public int hashCode() { int i = 0; Iterator it = a.values().iterator(); while (true) { int i2 = i; if (!it.hasNext()) { return i2; } ae.a aVar = (ae.a) it.next(); if (a(aVar)) { i = b(aVar).hashCode() + (i2 + aVar.g()); } else { i = i2; } } } /* Access modifiers changed, original: 0000 */ public bx i() { return this.f; } public String j() { return this.g; } public String k() { return this.h; } public String l() { return this.i; } /* Access modifiers changed, original: 0000 */ public List m() { return this.j; } public int n() { return this.k; } /* Access modifiers changed, original: 0000 */ public List o() { return this.l; } /* Access modifiers changed, original: 0000 */ public bx p() { return this.m; } /* Access modifiers changed, original: 0000 */ public List q() { return this.n; } public String r() { return this.o; } public String s() { return this.p; } /* Access modifiers changed, original: 0000 */ public bx t() { return this.q; } public String u() { return this.r; } public String v() { return this.s; } public String w() { return this.t; } public void writeToParcel(Parcel parcel, int i) { bh bhVar = CREATOR; bh.a(this, parcel, i); } /* Access modifiers changed, original: 0000 */ public List x() { return this.u; } public String y() { return this.v; } public String z() { return this.w; } }
[ "rgosa@bitdefender.com" ]
rgosa@bitdefender.com
ad59b5ecb7c18a343cca1398de8e1b435d6efd22
2b579dac00e21c1d47880067cd8d984e227f63e1
/src/main/java/fi/academy/oppimispaivakirja/Topic.java
b8129121259888d61845177f607b51e37ed9775e
[]
no_license
alihokka/oppimispaivakirjafullstackback
6b8d200fb37c2e90e3890d3c29766ebcb54a5881
87d0e8e37dc24c5c1ca79afaf21dc25320631c8e
refs/heads/master
2022-04-09T22:12:45.496276
2020-03-05T11:44:44
2020-03-05T11:44:44
245,142,818
0
0
null
null
null
null
UTF-8
Java
false
false
1,830
java
package fi.academy.oppimispaivakirja; import javax.persistence.*; import java.sql.Date; import static javax.persistence.GenerationType.SEQUENCE; @Entity public class Topic { @Id @GeneratedValue(strategy = SEQUENCE, generator = "topic_topic_id_seq") @SequenceGenerator(name = "topic_topic_id_seq",sequenceName = "topic_topic_id_seq",allocationSize = 1) @Column(unique = true, nullable = false) private Integer id; @Column(nullable = false) private String title; private String description; private String additionalSource; private boolean complete; private Date creationDate; private Date completionDate; public Topic(){ } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public String getAdditionalSource() { return additionalSource; } public void setAdditionalSource(String additionalSource) { this.additionalSource = additionalSource; } public boolean isComplete() { return complete; } public void setComplete(boolean complete) { this.complete = complete; } public Date getCreationDate() { return creationDate; } public void setCreationDate(Date creationDate) { this.creationDate = creationDate; } public Date getCompletionDate() { return completionDate; } public void setCompletionDate(Date completionDate) { this.completionDate = completionDate; } }
[ "laurialihokka@gmail.com" ]
laurialihokka@gmail.com
5a1044a43c493a0afc998bb9ee6c986bdfa57ff7
78e0d86cbf5ffa2fda02a0839c3437b983b78a6a
/doubleupex/src/com/turpgames/doubleupex/view/AuthScreen.java
a44ea17f3699e1e010b90315fec8f62710a1dc4e
[]
no_license
turpgames/doubleup
91b0c2aaaf228d3727ad16ae8c133532895fc75a
cff1fca224a70be84844bdadd64ebe8f26160a06
refs/heads/master
2021-01-13T01:54:26.379339
2014-12-14T21:50:07
2014-12-14T21:50:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,803
java
package com.turpgames.doubleupex.view; import com.turpgames.doubleup.components.DoubleUpLogo; import com.turpgames.doubleup.utils.DoubleUpAuth; import com.turpgames.doubleup.utils.R; import com.turpgames.doubleupex.utils.StatActions; import com.turpgames.framework.v0.client.TurpClient; import com.turpgames.framework.v0.component.IButtonListener; import com.turpgames.framework.v0.component.TextButton; import com.turpgames.framework.v0.impl.Screen; import com.turpgames.framework.v0.impl.ScreenManager; import com.turpgames.framework.v0.impl.Settings; import com.turpgames.framework.v0.util.Color; import com.turpgames.framework.v0.util.Game; public class AuthScreen extends Screen { private TextButton facebookButton; private TextButton anonymousButton; private TextButton offlineButton; private boolean isFirstActivate; @Override public void init() { super.init(); facebookButton = initButton("Login With Facebook", 450, new IButtonListener() { @Override public void onButtonTapped() { loginWithFacebook(); } }); anonymousButton = initButton("Play As Guest", 350, new IButtonListener() { @Override public void onButtonTapped() { playAsGuest(); } }); offlineButton = initButton("Play Offline", 250, new IButtonListener() { @Override public void onButtonTapped() { ScreenManager.instance.switchTo(R.screens.menu, false); } }); registerDrawable(new DoubleUpLogo(), Game.LAYER_GAME); if (Settings.getInteger("game-installed", 0) == 0) { TurpClient.sendStat(StatActions.GameInstalled, Game.getPhysicalScreenSize().toString()); Settings.putInteger("game-installed", 1); } TurpClient.sendStat(StatActions.StartGame); isFirstActivate = true; } private void initAuth() { DoubleUpAuth.init(); } private void loginWithFacebook() { DoubleUpAuth.doFacebookLogin(); } private void playAsGuest() { DoubleUpAuth.doGuestLogin(); } private TextButton initButton(String text, float y, IButtonListener listener) { TextButton btn = new TextButton(Color.white(), R.colors.yellow); btn.setText(text); btn.getLocation().set((Game.getVirtualWidth() - btn.getWidth()) / 2, y); btn.setListener(listener); registerDrawable(btn, Game.LAYER_GAME); return btn; } @Override protected void onAfterActivate() { if (isFirstActivate) { isFirstActivate = false; initAuth(); } facebookButton.activate(); anonymousButton.activate(); offlineButton.activate(); } @Override protected boolean onBeforeDeactivate() { facebookButton.deactivate(); anonymousButton.deactivate(); offlineButton.deactivate(); return super.onBeforeDeactivate(); } @Override protected boolean onBack() { TurpClient.sendStat(StatActions.ExitGame); Game.exit(); return true; } }
[ "mehmet@mehmetatas.net" ]
mehmet@mehmetatas.net
75593ff3fd680a5b39257158e21c6fe24c348e86
dd047fba9360ae4a66e969350d37df809b1255ca
/github.com/AshishR99/FinalDomainApp.git/MySpringBootDomainApp-master/src/main/java/net/codejava/repositories/ContentUserloginSubdomainDomainRepository.java
415f3490c77b5f827f20a8f0e5d8381056e5143e
[]
no_license
AshishR99/FinalDomainApp
6727a821efdae050ee4e45e537026f43413ef58d
9b7683e849706be9ecaf90a0cd4951ae91fcdb55
refs/heads/master
2021-07-06T08:14:22.917132
2020-03-30T07:58:55
2020-03-30T07:58:55
242,662,918
0
0
null
2020-10-13T19:47:24
2020-02-24T06:27:35
Java
UTF-8
Java
false
false
2,115
java
package net.codejava.repositories; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import net.codejava.entities.Content; import net.codejava.payload.ContentUserloginSubdomainDomainPayload; public interface ContentUserloginSubdomainDomainRepository extends JpaRepository<ContentUserloginSubdomainDomainPayload, Integer>{ @Query(value = "select content.*,userlogin.user_name,subdomain.subdomain_name,domain.name from content left join userlogin on userlogin.user_id = content.fk_user_id left join subdomain on subdomain.subdomain_id = content.fk_subdomain_id left join domain on domain.id = content.fk_domain_id where content.fk_domain_id = ?1",nativeQuery = true) public List<ContentUserloginSubdomainDomainPayload> getContentsByDomainId(int fk_domain_id); @Query(value = "select content.*,userlogin.user_name,subdomain.subdomain_name,domain.name from content left join userlogin on userlogin.user_id = content.fk_user_id left join subdomain on subdomain.subdomain_id = content.fk_subdomain_id left join domain on domain.id = content.fk_domain_id where content.content_id = ?1",nativeQuery = true) public ContentUserloginSubdomainDomainPayload getContentsByContentId(int content_id); @Query(value = "select content.*,userlogin.user_name,subdomain.subdomain_name,domain.name from content left join userlogin on userlogin.user_id = content.fk_user_id left join subdomain on subdomain.subdomain_id = content.fk_subdomain_id left join domain on domain.id = content.fk_domain_id where content.fk_user_id = ?1",nativeQuery = true) public List<ContentUserloginSubdomainDomainPayload> getContentsByUserId(int fk_user_id); @Query(value="select content.*,userlogin.user_name,subdomain.subdomain_name,domain.name from content left join userlogin on userlogin.user_id = content.fk_user_id left join subdomain on subdomain.subdomain_id = content.fk_subdomain_id left join domain on domain.id = content.fk_domain_id",nativeQuery = true) public List<ContentUserloginSubdomainDomainPayload> getAllContentsOfUsers(); }
[ "ashishraj8899@gmail.com" ]
ashishraj8899@gmail.com
f2282e286300c6c240bfc49483588fe5b6414cdd
3388e79a0fa3cfc32531ba603689c97ba9e2c89f
/src/main/java/Main/Service/UsersService.java
4e042abbd4428e95a9239cec6ab50077c6bcc9bc
[]
no_license
RJashari/vleresimiKampanjave
92406a316a931503adf4f388807137fb64f5fbfc
e504b6f6a8c6613e23209b0fef17261bf755b186
refs/heads/master
2021-09-07T01:46:07.502319
2018-02-15T11:27:54
2018-02-15T11:27:54
110,243,178
0
0
null
null
null
null
UTF-8
Java
false
false
864
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 Main.Service; import Main.BL.Users; import Main.Dao.KampanjaException; import java.util.List; import org.springframework.security.core.userdetails.UserDetailsService; /** * * @author rinor.jashari */ public interface UsersService extends UserDetailsService { void create(Users users) throws KampanjaException; void edit (Users users) throws KampanjaException; Users findUserByUsername(String username); void remove(Users users) throws KampanjaException; void removeByUsername(String username) throws KampanjaException; void resetUserPassword(int id) throws KampanjaException; List<Users> findAll(); Users findById(int id); }
[ "rinorjashari2@gmail.com" ]
rinorjashari2@gmail.com
3383a103ea8913f0edb50252273df5e540d418a5
76cc4e1e03a8b88fa48d4be50f3a8a7bd227ad01
/qrcode-library/src/main/java/org/yndongyong/qrcode/decode/DecodeThread.java
bcff4288ae17f3a367cc63a1f0ce881611face44
[]
no_license
yndongyong/qrcode
ac8bc624fa2d89b244677fc4d8e0699232902eb9
1cf59268099583a3ea33c8f477f214a4002c4646
refs/heads/master
2020-12-25T14:34:19.798168
2016-07-03T16:18:36
2016-07-03T16:18:36
62,501,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,840
java
/* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.yndongyong.qrcode.decode; import android.os.Handler; import android.os.Looper; import org.yndongyong.fastandroid.component.qrcode.CaptureActivity; import java.util.concurrent.CountDownLatch; /** * This thread does all the heavy lifting of decoding the images. * * @author dswitkin@google.com (Daniel Switkin) */ public class DecodeThread extends Thread { public static final String BARCODE_BITMAP = "BARCODE_BITMAP"; public static final String DECODE_MODE = "DECODE_MODE"; public static final String DECODE_TIME = "DECODE_TIME"; private final CaptureActivity activity; private Handler handler; private final CountDownLatch handlerInitLatch; public DecodeThread(CaptureActivity activity) { this.activity = activity; this.handlerInitLatch = new CountDownLatch(1); } public Handler getHandler() { try { this.handlerInitLatch.await(); } catch (InterruptedException localInterruptedException) { } return this.handler; } public void run() { Looper.prepare(); this.handler = new DecodeHandler(this.activity); this.handlerInitLatch.countDown(); Looper.loop(); } }
[ "yndongyong@gmail.com" ]
yndongyong@gmail.com
57e1bba030147499be515cc111d4ca9024b0749b
55756ed172bcc0717b18af705ab98073da8e9234
/src/main/java/com/life/design/pattern/flyweight/BlackGoChessman.java
c6803b1df42b79bfabe938275290e9ffb4e52e26
[]
no_license
YL10000/design-pattern
70afaf8d379a510684a613fcaffcf62a31a93495
555146f94d9ec2703a02630321aba89b399b516b
refs/heads/master
2020-03-26T16:19:51.122745
2018-09-07T10:40:23
2018-09-07T10:40:23
145,094,441
0
0
null
null
null
null
UTF-8
Java
false
false
916
java
/** * Copyright © 2017, Beijing XitianQujing Technology Co., Ltd. * @Title: BlackGoChessman.java * @Package com.life.design.pattern.flyweight * @Description: 黑子--具体享元类 * @Author: ViaX-yanglin * @Date: 2018年8月21日 下午3:29:13 * @Version V1.0 * @Copyright: 2018 All Rights Reserved.北京西天取经科技有限公司 */ package com.life.design.pattern.flyweight; /** * @Title: BlackGoChessman * @Description: 黑子--具体享元类 * @Author: ViaX-yanglin * @Date: 2018年8月21日 下午3:29:13 * * @Copyright: 2018 All Rights Reserved.北京西天取经科技有限公司 */ public class BlackGoChessman extends GoChessman { public BlackGoChessman() { super(); this.setColor("黑子"); } @Override public void display(Coordinate coordinate) { System.out.println(getColor()+" x="+coordinate.getX()+",y="+coordinate.getY()); } }
[ "18001296930@163.com" ]
18001296930@163.com
3eb39be256a47117d03443db2e571f89931395fd
2d598ea79321a36562bee496cae21779bfe6dc29
/FourSCreenapp/app/src/main/java/com/example/fourscreenapp/Second.java
57a15a4057e5861ad40bdaf0b476b65c84ba593b
[]
no_license
OyugiTolbert/Converter
2a0c5d31ae9c4b404d9aacec50dbd9c53f12fe42
5ed70459760989bed7b51a5865309cc2ec7f3d99
refs/heads/master
2020-06-12T11:17:35.638873
2019-06-29T01:28:50
2019-06-29T01:28:50
194,282,146
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
package com.example.fourscreenapp; import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Second extends AppCompatActivity { Button Secondone; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second); Secondone = (Button)findViewById(R.id.back2); Secondone.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(Second.this, MainActivity.class); startActivity(intent); } }); } }
[ "Oyugitolbert@gmail.com" ]
Oyugitolbert@gmail.com
5b1e42c59ea66bf728e0bef11338e5dc5294584e
2198d5064789a9e938cad714ee9b421255b6dea5
/springboot-conditional/src/test/java/com/leilei/SpringbootConditionalApplicationTests.java
6e64ab22b44f538a0887bee8b14e997e3b0d6b72
[]
no_license
leilei0220/springboot-learn
018315b5f1a3663b08cf8a8d748020ecd92c3e90
910b48774ffbe530da887fbfc26ba9e79257584b
refs/heads/master
2023-08-31T17:43:22.368236
2023-08-21T01:20:09
2023-08-21T01:20:09
241,584,825
78
62
null
2023-01-09T10:23:40
2020-02-19T09:44:28
Java
UTF-8
Java
false
false
226
java
package com.leilei; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class SpringbootConditionalApplicationTests { @Test void contextLoads() { } }
[ "leileideve@163.com" ]
leileideve@163.com
d599c209fc46e76bf03cd89a2a6fc86a6b368ae7
287ef514c20219559b002c34230791fbd9cbb954
/src/main/java/br/com/resultatec/sagflix/domain/model/Video.java
ac706e3969fc2ea7ca08919674d7707148f3bbb0
[ "MIT" ]
permissive
andrejvelho/sagflix-api
c9f73cfa41e7cf20da3b94dd8795bc4abb9720fd
cfecff8d692af28011931cd5127776c5e1f6cc90
refs/heads/master
2023-06-02T14:32:12.661566
2021-06-25T06:34:37
2021-06-25T06:34:37
369,871,085
0
0
null
2021-05-22T18:19:51
2021-05-22T17:42:52
Java
UTF-8
Java
false
false
1,769
java
package br.com.resultatec.sagflix.domain.model; import java.time.OffsetDateTime; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.validation.Valid; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import javax.validation.groups.ConvertGroup; import javax.validation.groups.Default; import br.com.resultatec.sagflix.domain.validation.ValidationGroups; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @EqualsAndHashCode(onlyExplicitlyIncluded = true) @Getter @Setter @Entity public class Video { @EqualsAndHashCode.Include @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @Size(max = 255) private String titulo; @NotBlank @Size(max = 255) private String url; @NotNull @ConvertGroup(from = Default.class, to = ValidationGroups.ClienteId.class) @Valid @ManyToOne private Categoria categoria; @OneToMany(mappedBy = "video", cascade = CascadeType.ALL) List<ComentarioVideo> comentarios = new ArrayList<>(); public ComentarioVideo adicionarNovoComentario(String comentario) { ComentarioVideo comentarioVideo = new ComentarioVideo(); comentarioVideo.setComentario(comentario); comentarioVideo.setVideo(this); comentarioVideo.setDataRegistro(OffsetDateTime.now()); this.getComentarios().add(comentarioVideo); return comentarioVideo; } }
[ "andre@resultatec.com.br" ]
andre@resultatec.com.br
cfceb1c14b57365618a0e26413b0994854d4d1be
b682833bb042295ac0550b71c35c9e2af413dc00
/testDB/src/testDBServlets/onRegServlet.java
47d0ea5457c08785476e58ebaa28025bebdf7adc
[]
no_license
Tiyasa2000/testprojects
d4eaf9b049c689cebcaafbc0ac33571cd1088e97
646532c2c482d7412912ac4639b79e40fac9e7ea
refs/heads/master
2023-05-14T01:59:59.691623
2021-06-05T13:31:35
2021-06-05T13:31:35
374,115,177
0
0
null
null
null
null
UTF-8
Java
false
false
1,421
java
package testDBServlets; import testDBServices.insertDBdata; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/onRegServletURL") public class onRegServlet extends HttpServlet { private static final long serialVersionUID = 1L; public onRegServlet() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("Welcome to registration"); String rnum=request.getParameter("rollnum"); String name=request.getParameter("name"); System.out.println(rnum); System.out.println(name); insertDBdata obj=new insertDBdata(); boolean reg_done=obj.insertName(name,rnum); if(reg_done==true && obj.flagReg==0 ) response.getWriter().print("<html><body>Your name is successfully registered.</body></html>"); else if(reg_done==false && obj.flagReg==0 ) response.getWriter().print("<html><body>Sorry, Your name could not be registered!! Please try again.</body></html>"); else if(reg_done==false && obj.flagReg==1) response.getWriter().print("<html><body>Sorry, You are already registered.</body></html>"); } }
[ "Tiyasa@Tiyasa-PC" ]
Tiyasa@Tiyasa-PC
75f1487af54af3dd3bf856782ad2529aef3bb071
32a4b7211145f4f50f9ac8e39221b4388198f746
/Kornislav/src/Kornislav.java
14d859def1df886e4516a5cc7c51090f7af744e0
[]
no_license
iti5806021410011/OOP1
08c4b3a9ac4d05496b1d1ebc61d7bca9160d0d84
f924a429c97781201cba394c75a30d0bbadd8130
refs/heads/master
2021-01-10T10:24:52.084618
2016-03-03T12:20:28
2016-03-03T12:20:28
51,387,734
0
0
null
null
null
null
UTF-8
Java
false
false
898
java
import java.util.Scanner; public class Kornislav { public static void main(String[] args) { int sq1,sq2,sq3,sq4,temp; Scanner scan = new Scanner(System.in); System.out.print("Input sq_1 : "); sq1=scan.nextInt(); System.out.print("Input sq_2 : "); sq2=scan.nextInt(); System.out.print("Input sq_3 : "); sq3=scan.nextInt(); System.out.print("Input sq_4 : "); sq4=scan.nextInt(); if(sq1>sq2){ temp=sq1; sq1=sq2; sq2=temp; } if(sq1>sq3){ temp=sq1; sq1=sq3; sq3=temp; } if(sq1>sq4){ temp=sq1; sq1=sq4; sq4=temp; } if(sq2>sq3){ temp=sq2; sq2=sq3; sq3=temp; } if(sq2>sq4){ temp=sq2; sq2=sq4; sq4=temp; } if(sq3>sq4){ temp=sq3; sq3=sq4; sq4=temp; } System.out.print("\nRectangle Area = : "+""+sq3+""+" * "+sq1+" = "+sq3*sq1); } }
[ "Ninew@DESKTOP-9J1VTUR" ]
Ninew@DESKTOP-9J1VTUR
f244caf856e6649321aa7115ee897ef2154c8e76
1b1b9c0a01f75824119ce36e10189bfeb493db14
/app/src/main/java/com/firatg/tdkdictionary/adapter/shuffleAdapter.java
1e7e40b9ee7aab9e8bf93142c1fc2d5ee51aa8f6
[]
no_license
FiratGURGUR/TdkDictionary
77e0542d84d21ebb295ea5f7be0ea4a5c9e08b97
01989c3620a2f2423a2d1c978f4b3695579e3d6a
refs/heads/master
2022-11-14T11:26:53.416186
2020-07-06T19:14:43
2020-07-06T19:14:43
277,627,920
0
0
null
null
null
null
UTF-8
Java
false
false
2,698
java
package com.firatg.tdkdictionary.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.databinding.DataBindingUtil; import androidx.recyclerview.widget.RecyclerView; import com.firatg.tdkdictionary.R; import com.firatg.tdkdictionary.databinding.KaristirmaBinding; import com.firatg.tdkdictionary.model.homepage.KaristirmaItem; import com.firatg.tdkdictionary.utils.WordClickDetail; import java.util.List; public class shuffleAdapter extends RecyclerView.Adapter<shuffleAdapter.ShuffleViewHolder> { private List<KaristirmaItem> list; private Context context; private LayoutInflater layoutInflater; private WordClickDetail clickListener; public shuffleAdapter(List<KaristirmaItem> list, Context context) { this.list = list; this.context = context; } @NonNull @Override public ShuffleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { if (layoutInflater==null){ layoutInflater=LayoutInflater.from(parent.getContext()); } KaristirmaBinding karistirmaBinding = DataBindingUtil.inflate(layoutInflater, R.layout.item_karistirma,parent,false); return new ShuffleViewHolder(karistirmaBinding); } @Override public void onBindViewHolder(@NonNull ShuffleViewHolder holder, int position) { KaristirmaItem karistirmaItem = list.get(position); holder.setKaristirma(karistirmaItem); } @Override public int getItemCount() { return list.size(); } public class ShuffleViewHolder extends RecyclerView.ViewHolder { KaristirmaBinding karistirmaBinding; public ShuffleViewHolder(@NonNull KaristirmaBinding karistirmaBinding) { super(karistirmaBinding.getRoot()); this.karistirmaBinding = karistirmaBinding; itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int position = getAdapterPosition(); if (clickListener != null && position != RecyclerView.NO_POSITION) { clickListener.openDetail(list.get(position).getDogru()); } } }); } public void setKaristirma(KaristirmaItem karistirmaItem){ this.karistirmaBinding.setContent(karistirmaItem); karistirmaBinding.executePendingBindings(); } } public void setOnItemClickListener(WordClickDetail clickListener) { this.clickListener = clickListener; } }
[ "frtgurgur@gmail.com" ]
frtgurgur@gmail.com
e4f165e02726813bbcf2a6e88342c865a67f54cf
e87b448dc05eb23b78937e502512bca5ccde7510
/src/fr/bendjebbourNaim/entityExerciceTree/TreeNode.java
18227817c31592215c369d28ec1ade091fa147a6
[]
no_license
NaimBendjebbour/DesignPattern-M1APP
30bc745cf2bb0a501457d005f696a682b82d1841
33696f316a8928f42904ae0b7f4e52625383452b
refs/heads/master
2021-09-05T15:52:29.302563
2018-01-29T12:59:06
2018-01-29T12:59:06
119,382,632
0
0
null
null
null
null
UTF-8
Java
false
false
1,778
java
package fr.bendjebbourNaim.entityExerciceTree; import java.util.Iterator; import java.util.LinkedList; import java.util.List; public class TreeNode<T> implements Iterable<TreeNode<T>> { public T data; public TreeNode<T> parent; public List<TreeNode<T>> children; public boolean isRoot() { return parent == null; } public boolean isLeaf() { return children.size() == 0; } private List<TreeNode<T>> elementsIndex; public TreeNode(T data) { this.data = data; this.children = new LinkedList<TreeNode<T>>(); this.elementsIndex = new LinkedList<TreeNode<T>>(); this.elementsIndex.add(this); } public TreeNode<T> addChild(T child) { TreeNode<T> childNode = new TreeNode<T>(child); childNode.parent = this; this.children.add(childNode); this.registerChildForSearch(childNode); return childNode; } public int getLevel() { if (this.isRoot()) return 0; else return parent.getLevel() + 1; } private void registerChildForSearch(TreeNode<T> node) { elementsIndex.add(node); if (parent != null) parent.registerChildForSearch(node); } public TreeNode<T> findTreeNode(Comparable<T> cmp) { for (TreeNode<T> element : this.elementsIndex) { T elData = element.data; if (cmp.compareTo(elData) == 0) return element; } return null; } @Override public String toString() { return data != null ? data.toString() : "[data null]"; } @Override public Iterator<TreeNode<T>> iterator() { TreeNodeIter<T> iter = new TreeNodeIter<T>(this); return iter; } }
[ "36009917@u-paris10.fr" ]
36009917@u-paris10.fr
af2b57ab2669e7cabcfe24a91cdadd1db7363c19
bb55fcf8783ae0bf6c651f6904cfd19ccebbfd41
/android/app/src/main/java/com/reactnativecreate/MainApplication.java
aebb8078499ee8e6f5de9d1a25eb6f726c789f66
[]
no_license
huker/react-native-create
335cf154949818d42051d4c9b9e17cd31334d1ea
301dada07caf3fd630c0f0453fa4ee284a055151
refs/heads/master
2020-03-26T11:11:31.371643
2019-05-17T03:08:39
2019-05-17T03:08:39
144,832,389
1
0
null
null
null
null
UTF-8
Java
false
false
1,203
java
package com.glowworm; import android.app.Application; import com.facebook.react.ReactApplication; import org.reactnative.camera.RNCameraPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.react.shell.MainReactPackage; import com.facebook.soloader.SoLoader; import com.reactnativenavigation.NavigationApplication; import org.reactnative.camera.RNCameraPackage; import java.util.Arrays; import java.util.List; public class MainApplication extends NavigationApplication { @Override public boolean isDebug() { // Make sure you are using BuildConfig from your own application return BuildConfig.DEBUG; } protected List<ReactPackage> getPackages() { // Add additional packages you require here // No need to add RnnPackage and MainReactPackage return Arrays.<ReactPackage>asList( // eg. new VectorIconsPackage() new RNCameraPackage() ); } @Override public List<ReactPackage> createAdditionalReactPackages() { return getPackages(); } @Override public String getJSMainModuleName() { return "index"; } }
[ "huaolie@sina.com" ]
huaolie@sina.com
064c8eeca905a2f491141a80e4d501d25d2277a8
4724878ebf500d1d3936b7bc773d60eaf7a7de54
/src/main/java/com/antocecere77/redisspring/city/dto/City.java
96b27f41b1297680bfd35cb5e17113c5eb456dce
[]
no_license
antocecere77/redis-spring
96153330974d9afe96923c2b97260cc33055413e
c5cec095eaf31c5bf2aa819e7faabdc0bb493302
refs/heads/master
2023-07-24T10:48:06.982164
2021-08-30T05:12:13
2021-08-30T05:12:13
392,555,565
0
0
null
null
null
null
UTF-8
Java
false
false
270
java
package com.antocecere77.redisspring.city.dto; import lombok.*; @Data @With @Builder @ToString @AllArgsConstructor @NoArgsConstructor public class City { private String zip; private String city; private String stateName; private int temperature; }
[ "antocecere77@gmail.com" ]
antocecere77@gmail.com
4c50d3fcbcb8cd7d4534d5686029d6b2816afc43
8dc84558f0058d90dfc4955e905dab1b22d12c08
/third_party/android_tools/sdk/sources/android-25/javax/security/cert/CertificateParsingException.java
d935e12c2e1104988e292fff55b49e88d438d961
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause", "Apache-2.0", "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
Java
false
false
2,413
java
/* * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code 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 * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package javax.security.cert; /** * Certificate Parsing Exception. This is thrown whenever * invalid DER encoded certificate is parsed or unsupported DER features * are found in the Certificate. * * <p><em>Note: The classes in the package <code>javax.security.cert</code> * exist for compatibility with earlier versions of the * Java Secure Sockets Extension (JSSE). New applications should instead * use the standard Java SE certificate classes located in * <code>java.security.cert</code>.</em></p> * * @since 1.4 * @author Hemma Prafullchandra */ public class CertificateParsingException extends CertificateException { /** * Constructs a CertificateParsingException with no detail message. A * detail message is a String that describes this particular * exception. */ public CertificateParsingException() { super(); } /** * Constructs a CertificateParsingException with the specified detail * message. A detail message is a String that describes this * particular exception. * * @param message the detail message. */ public CertificateParsingException(String message) { super(message); } }
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
8085ee50a0d934666c746c532a1e9a9094c3ac4c
aaaee86c434f9460f397e61e356d3eb086775f16
/src/main/java/com/delivery/entity/City.java
232b18dfdaeb9a1c7cdf8d447ba5ed1c63794337
[]
no_license
VitalikTsarik/delivery-automation-platform
d15911e2c20d05889ddd346ae6627c53e1c9c748
ef1600cca8784a058fa76dcd3838b8fbc5ae655c
refs/heads/master
2022-09-19T13:25:05.391208
2020-06-05T15:35:12
2020-06-05T15:35:12
267,623,495
0
0
null
2020-06-01T21:44:45
2020-05-28T15:15:39
Java
UTF-8
Java
false
false
679
java
package com.delivery.entity; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.UniqueConstraint; @Entity @Table( name = "cities", uniqueConstraints = { @UniqueConstraint(columnNames = "name") }) public class City { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; public Long getId() { return id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "nikitakholdobin@yandex.ru" ]
nikitakholdobin@yandex.ru
ad6858d52019078b17c8c89f33cde975b763e3de
80a9a3d33e40174d95caa4ed91461eb9211a6bdf
/src/main/java/acmachine/AcNode.java
5694f63233cb9b52d71c92dc8c3ced0f7e57fe22
[]
no_license
qilinxiaoxiang/java_exercise
0578bf3a5261f12c77d2e7a27babb155e282b94d
2434f2d1bbfbac77682cbc650604d7056753fb3d
refs/heads/master
2023-06-20T23:59:37.310595
2021-07-27T12:56:28
2021-07-27T12:56:28
200,868,226
0
0
null
null
null
null
UTF-8
Java
false
false
45
java
package acmachine; public class AcNode { }
[ "wq5513031@126.com" ]
wq5513031@126.com
39896dc26cff14fd1c65704a6521a5f0932f8e38
71a3d4639e4920b784e404d97279130ec7a03651
/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/fragment/R.java
cd020f3993f4d982512ab9053f3374df1c498a87
[]
no_license
Inefable-Jazb/Inefable-APP
2ffe327227a4ef916cea43ffdda7c43ebfe3d1c3
925cc7ae1400f75e3b0c3826e0502460defbef79
refs/heads/master
2020-04-09T04:03:34.770903
2018-12-16T21:30:33
2018-12-16T21:30:33
160,008,675
0
0
null
2018-12-04T02:10:00
2018-12-02T03:06:44
Java
UTF-8
Java
false
false
12,397
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 android.support.fragment; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f03002c; public static final int coordinatorLayoutStyle = 0x7f0300b4; public static final int font = 0x7f0300e7; public static final int fontProviderAuthority = 0x7f0300e9; public static final int fontProviderCerts = 0x7f0300ea; public static final int fontProviderFetchStrategy = 0x7f0300eb; public static final int fontProviderFetchTimeout = 0x7f0300ec; public static final int fontProviderPackage = 0x7f0300ed; public static final int fontProviderQuery = 0x7f0300ee; public static final int fontStyle = 0x7f0300ef; public static final int fontVariationSettings = 0x7f0300f0; public static final int fontWeight = 0x7f0300f1; public static final int keylines = 0x7f03011f; public static final int layout_anchor = 0x7f030128; public static final int layout_anchorGravity = 0x7f030129; public static final int layout_behavior = 0x7f03012a; public static final int layout_dodgeInsetEdges = 0x7f030156; public static final int layout_insetEdge = 0x7f03015f; public static final int layout_keyline = 0x7f030160; public static final int statusBarBackground = 0x7f0301bf; public static final int ttcIndex = 0x7f030221; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f05007d; public static final int notification_icon_bg_color = 0x7f05007e; public static final int ripple_material_light = 0x7f05008d; public static final int secondary_text_default_material_light = 0x7f05008f; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f06005d; public static final int compat_button_inset_vertical_material = 0x7f06005e; public static final int compat_button_padding_horizontal_material = 0x7f06005f; public static final int compat_button_padding_vertical_material = 0x7f060060; public static final int compat_control_corner_material = 0x7f060061; public static final int compat_notification_large_icon_max_height = 0x7f060062; public static final int compat_notification_large_icon_max_width = 0x7f060063; public static final int notification_action_icon_size = 0x7f0600d0; public static final int notification_action_text_size = 0x7f0600d1; public static final int notification_big_circle_margin = 0x7f0600d2; public static final int notification_content_margin_start = 0x7f0600d3; public static final int notification_large_icon_height = 0x7f0600d4; public static final int notification_large_icon_width = 0x7f0600d5; public static final int notification_main_column_padding_top = 0x7f0600d6; public static final int notification_media_narrow_margin = 0x7f0600d7; public static final int notification_right_icon_size = 0x7f0600d8; public static final int notification_right_side_padding_top = 0x7f0600d9; public static final int notification_small_icon_background_padding = 0x7f0600da; public static final int notification_small_icon_size_as_large = 0x7f0600db; public static final int notification_subtext_size = 0x7f0600dc; public static final int notification_top_pad = 0x7f0600dd; public static final int notification_top_pad_large_text = 0x7f0600de; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f07008f; public static final int notification_bg = 0x7f070090; public static final int notification_bg_low = 0x7f070091; public static final int notification_bg_low_normal = 0x7f070092; public static final int notification_bg_low_pressed = 0x7f070093; public static final int notification_bg_normal = 0x7f070094; public static final int notification_bg_normal_pressed = 0x7f070095; public static final int notification_icon_background = 0x7f070096; public static final int notification_template_icon_bg = 0x7f070097; public static final int notification_template_icon_low_bg = 0x7f070098; public static final int notification_tile_bg = 0x7f070099; public static final int notify_panel_notification_icon_bg = 0x7f07009a; } public static final class id { private id() {} public static final int action_container = 0x7f08000e; public static final int action_divider = 0x7f080010; public static final int action_image = 0x7f080011; public static final int action_text = 0x7f080017; public static final int actions = 0x7f080018; public static final int async = 0x7f080021; public static final int blocking = 0x7f080025; public static final int bottom = 0x7f080026; public static final int chronometer = 0x7f080037; public static final int end = 0x7f080051; public static final int forever = 0x7f080061; public static final int icon = 0x7f08006a; public static final int icon_group = 0x7f08006b; public static final int info = 0x7f080070; public static final int italic = 0x7f080072; public static final int left = 0x7f08007a; public static final int line1 = 0x7f08007c; public static final int line3 = 0x7f08007d; public static final int none = 0x7f080091; public static final int normal = 0x7f080092; public static final int notification_background = 0x7f080093; public static final int notification_main_column = 0x7f080094; public static final int notification_main_column_container = 0x7f080095; public static final int right = 0x7f0800a7; public static final int right_icon = 0x7f0800a8; public static final int right_side = 0x7f0800a9; public static final int start = 0x7f0800d7; public static final int tag_transition_group = 0x7f0800de; public static final int tag_unhandled_key_event_manager = 0x7f0800df; public static final int tag_unhandled_key_listeners = 0x7f0800e0; public static final int text = 0x7f0800e2; public static final int text2 = 0x7f0800e3; public static final int time = 0x7f080103; public static final int title = 0x7f080104; public static final int top = 0x7f080107; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f09000f; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0b003b; public static final int notification_action_tombstone = 0x7f0b003c; public static final int notification_template_custom_big = 0x7f0b0043; public static final int notification_template_icon_group = 0x7f0b0044; public static final int notification_template_part_chronometer = 0x7f0b0048; public static final int notification_template_part_time = 0x7f0b0049; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0e004c; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0f011e; public static final int TextAppearance_Compat_Notification_Info = 0x7f0f011f; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0f0121; public static final int TextAppearance_Compat_Notification_Time = 0x7f0f0124; public static final int TextAppearance_Compat_Notification_Title = 0x7f0f0126; public static final int Widget_Compat_NotificationActionContainer = 0x7f0f01d1; public static final int Widget_Compat_NotificationActionText = 0x7f0f01d2; public static final int Widget_Support_CoordinatorLayout = 0x7f0f0201; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f03002c }; 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 = { 0x7f03011f, 0x7f0301bf }; public static final int CoordinatorLayout_keylines = 0; public static final int CoordinatorLayout_statusBarBackground = 1; public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f030128, 0x7f030129, 0x7f03012a, 0x7f030156, 0x7f03015f, 0x7f030160 }; 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 = { 0x7f0300e9, 0x7f0300ea, 0x7f0300eb, 0x7f0300ec, 0x7f0300ed, 0x7f0300ee }; 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, 0x7f0300e7, 0x7f0300ef, 0x7f0300f0, 0x7f0300f1, 0x7f030221 }; 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; } }
[ "johan@inefable.cl" ]
johan@inefable.cl
bab65396d8b027fffcfd926b8da0d73377cb688b
a441b9908411aba03261d7ae3298136c619e26b3
/src/main/java/com/keji/washer/model/po/WasherPo.java
1b55f5f30dbd1ee387c9984fae5e4a90c77467eb
[]
no_license
zzxtz007/rubbish
659d2cc60d5db09a01f7575ae04be9757df68407
cf7c282eb7a4f00127d77450f873f8c53cc82b81
refs/heads/master
2021-04-09T13:46:41.850308
2018-04-22T08:46:25
2018-04-22T08:46:25
125,489,333
0
0
null
null
null
null
UTF-8
Java
false
false
1,880
java
package com.keji.washer.model.po; import java.sql.Date; /** * 洗衣机 * * @author ICE_DOG */ public class WasherPo { private Integer id; private String name; private Integer storiedId; private Integer status; private String insertUser; private Date insertTime; private String updateUser; private Date updateTime; private Boolean isDeleted; @Override public String toString() { return "WasherPo{" + "id=" + id + ", name='" + name + '\'' + ", storiedId=" + storiedId + ", status=" + status + ", insertUser='" + insertUser + '\'' + ", insertTime=" + insertTime + ", updateUser='" + updateUser + '\'' + ", updateTime=" + updateTime + ", isDeleted=" + isDeleted + '}'; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getStoriedId() { return storiedId; } public void setStoriedId(Integer storiedId) { this.storiedId = storiedId; } public Integer getStatus() { return status; } public void setStatus(Integer status) { this.status = status; } public String getInsertUser() { return insertUser; } public void setInsertUser(String insertUser) { this.insertUser = insertUser; } public Date getInsertTime() { return insertTime; } public void setInsertTime(Date insertTime) { this.insertTime = insertTime; } public String getUpdateUser() { return updateUser; } public void setUpdateUser(String updateUser) { this.updateUser = updateUser; } public Date getUpdateTime() { return updateTime; } public void setUpdateTime(Date updateTime) { this.updateTime = updateTime; } public Boolean getIsDeleted() { return isDeleted; } public void setIsDeleted(Boolean deleted) { isDeleted = deleted; } }
[ "zzxtz007@gmail.com" ]
zzxtz007@gmail.com
a387f6ac9269a0305ca49bd5613b04d0d43c254d
ae7be969919dc2217aa6b18910ce8e72424f5ec6
/transport/src/main/java/io/netty/channel/nio/AbstractNioByteChannel.java
c3f6e3ecc60d312b3cdb1ade1236cb156d5ab101
[ "BSD-3-Clause", "Apache-2.0", "CC-PDDC", "LicenseRef-scancode-public-domain", "MIT" ]
permissive
llx1993/netty4.1.38
7f4295a7be9d0fb36e533597454e6302920e190a
7ee692366c9a29f7c267fe5e12b3c024d24ded09
refs/heads/master
2023-08-25T06:28:48.535896
2021-10-13T03:16:51
2021-10-13T03:16:51
307,879,671
0
0
null
null
null
null
UTF-8
Java
false
false
13,246
java
/* * Copyright 2012 The Netty Project * * The Netty Project 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 io.netty.channel.nio; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.channel.Channel; import io.netty.channel.ChannelConfig; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelMetadata; import io.netty.channel.ChannelOutboundBuffer; import io.netty.channel.ChannelPipeline; import io.netty.channel.FileRegion; import io.netty.channel.RecvByteBufAllocator; import io.netty.channel.internal.ChannelUtils; import io.netty.channel.socket.ChannelInputShutdownEvent; import io.netty.channel.socket.ChannelInputShutdownReadComplete; import io.netty.channel.socket.SocketChannelConfig; import io.netty.util.internal.StringUtil; import java.io.IOException; import java.nio.channels.SelectableChannel; import java.nio.channels.SelectionKey; import static io.netty.channel.internal.ChannelUtils.WRITE_STATUS_SNDBUF_FULL; /** * {@link AbstractNioChannel} base class for {@link Channel}s that operate on bytes. */ public abstract class AbstractNioByteChannel extends AbstractNioChannel { private static final ChannelMetadata METADATA = new ChannelMetadata(false, 16); private static final String EXPECTED_TYPES = " (expected: " + StringUtil.simpleClassName(ByteBuf.class) + ", " + StringUtil.simpleClassName(FileRegion.class) + ')'; private final Runnable flushTask = new Runnable() { @Override public void run() { // Calling flush0 directly to ensure we not try to flush messages that were added via write(...) in the // meantime. ((AbstractNioUnsafe) unsafe()).flush0(); } }; private boolean inputClosedSeenErrorOnRead; /** * Create a new instance * * @param parent the parent {@link Channel} by which this instance was created. May be {@code null} * @param ch the underlying {@link SelectableChannel} on which it operates */ protected AbstractNioByteChannel(Channel parent, SelectableChannel ch) { super(parent, ch, SelectionKey.OP_READ); } /** * Shutdown the input side of the channel. */ protected abstract ChannelFuture shutdownInput(); protected boolean isInputShutdown0() { return false; } @Override protected AbstractNioUnsafe newUnsafe() { return new NioByteUnsafe(); } @Override public ChannelMetadata metadata() { return METADATA; } final boolean shouldBreakReadReady(ChannelConfig config) { return isInputShutdown0() && (inputClosedSeenErrorOnRead || !isAllowHalfClosure(config)); } private static boolean isAllowHalfClosure(ChannelConfig config) { return config instanceof SocketChannelConfig && ((SocketChannelConfig) config).isAllowHalfClosure(); } protected class NioByteUnsafe extends AbstractNioUnsafe { private void closeOnRead(ChannelPipeline pipeline) { if (!isInputShutdown0()) { if (isAllowHalfClosure(config())) { shutdownInput(); pipeline.fireUserEventTriggered(ChannelInputShutdownEvent.INSTANCE); } else { close(voidPromise()); } } else { inputClosedSeenErrorOnRead = true; pipeline.fireUserEventTriggered(ChannelInputShutdownReadComplete.INSTANCE); } } private void handleReadException(ChannelPipeline pipeline, ByteBuf byteBuf, Throwable cause, boolean close, RecvByteBufAllocator.Handle allocHandle) { if (byteBuf != null) { if (byteBuf.isReadable()) { readPending = false; pipeline.fireChannelRead(byteBuf); } else { byteBuf.release(); } } allocHandle.readComplete(); pipeline.fireChannelReadComplete(); pipeline.fireExceptionCaught(cause); if (close || cause instanceof IOException) { closeOnRead(pipeline); } } @Override public final void read() { final ChannelConfig config = config(); if (shouldBreakReadReady(config)) { clearReadPending(); return; } final ChannelPipeline pipeline = pipeline(); final ByteBufAllocator allocator = config.getAllocator(); final RecvByteBufAllocator.Handle allocHandle = recvBufAllocHandle(); allocHandle.reset(config); ByteBuf byteBuf = null; boolean close = false; try { do { byteBuf = allocHandle.allocate(allocator); allocHandle.lastBytesRead(doReadBytes(byteBuf)); if (allocHandle.lastBytesRead() <= 0) { // nothing was read. release the buffer. byteBuf.release(); byteBuf = null; close = allocHandle.lastBytesRead() < 0; if (close) { // There is nothing left to read as we received an EOF. readPending = false; } break; } allocHandle.incMessagesRead(1); readPending = false; //在pipeline上执行,业务逻辑的处理就在这个地方 pipeline.fireChannelRead(byteBuf); byteBuf = null; } while (allocHandle.continueReading()); allocHandle.readComplete(); pipeline.fireChannelReadComplete(); if (close) { closeOnRead(pipeline); } } catch (Throwable t) { handleReadException(pipeline, byteBuf, t, close, allocHandle); } finally { // Check if there is a readPending which was not processed yet. // This could be for two reasons: // * The user called Channel.read() or ChannelHandlerContext.read() in channelRead(...) method // * The user called Channel.read() or ChannelHandlerContext.read() in channelReadComplete(...) method // // See https://github.com/netty/netty/issues/2254 if (!readPending && !config.isAutoRead()) { removeReadOp(); } } } } /** * Write objects to the OS. * @param in the collection which contains objects to write. * @return The value that should be decremented from the write quantum which starts at * {@link ChannelConfig#getWriteSpinCount()}. The typical use cases are as follows: * <ul> * <li>0 - if no write was attempted. This is appropriate if an empty {@link ByteBuf} (or other empty content) * is encountered</li> * <li>1 - if a single call to write data was made to the OS</li> * <li>{@link ChannelUtils#WRITE_STATUS_SNDBUF_FULL} - if an attempt to write data was made to the OS, but no * data was accepted</li> * </ul> * @throws Exception if an I/O exception occurs during write. */ protected final int doWrite0(ChannelOutboundBuffer in) throws Exception { Object msg = in.current(); if (msg == null) { // Directly return here so incompleteWrite(...) is not called. return 0; } return doWriteInternal(in, in.current()); } private int doWriteInternal(ChannelOutboundBuffer in, Object msg) throws Exception { if (msg instanceof ByteBuf) { ByteBuf buf = (ByteBuf) msg; if (!buf.isReadable()) { in.remove(); return 0; } final int localFlushedAmount = doWriteBytes(buf); if (localFlushedAmount > 0) { in.progress(localFlushedAmount); if (!buf.isReadable()) { in.remove(); } return 1; } } else if (msg instanceof FileRegion) { FileRegion region = (FileRegion) msg; if (region.transferred() >= region.count()) { in.remove(); return 0; } long localFlushedAmount = doWriteFileRegion(region); if (localFlushedAmount > 0) { in.progress(localFlushedAmount); if (region.transferred() >= region.count()) { in.remove(); } return 1; } } else { // Should not reach here. throw new Error(); } return WRITE_STATUS_SNDBUF_FULL; } @Override protected void doWrite(ChannelOutboundBuffer in) throws Exception { int writeSpinCount = config().getWriteSpinCount(); do { Object msg = in.current(); if (msg == null) { // Wrote all messages. clearOpWrite(); // Directly return here so incompleteWrite(...) is not called. return; } writeSpinCount -= doWriteInternal(in, msg); } while (writeSpinCount > 0); incompleteWrite(writeSpinCount < 0); } @Override protected final Object filterOutboundMessage(Object msg) { if (msg instanceof ByteBuf) { ByteBuf buf = (ByteBuf) msg; if (buf.isDirect()) { return msg; } return newDirectBuffer(buf); } if (msg instanceof FileRegion) { return msg; } throw new UnsupportedOperationException( "unsupported message type: " + StringUtil.simpleClassName(msg) + EXPECTED_TYPES); } protected final void incompleteWrite(boolean setOpWrite) { // Did not write completely. if (setOpWrite) { setOpWrite(); } else { // It is possible that we have set the write OP, woken up by NIO because the socket is writable, and then // use our write quantum. In this case we no longer want to set the write OP because the socket is still // writable (as far as we know). We will find out next time we attempt to write if the socket is writable // and set the write OP if necessary. clearOpWrite(); // Schedule flush again later so other tasks can be picked up in the meantime eventLoop().execute(flushTask); } } /** * Write a {@link FileRegion} * * @param region the {@link FileRegion} from which the bytes should be written * @return amount the amount of written bytes */ protected abstract long doWriteFileRegion(FileRegion region) throws Exception; /** * Read bytes into the given {@link ByteBuf} and return the amount. */ protected abstract int doReadBytes(ByteBuf buf) throws Exception; /** * Write bytes form the given {@link ByteBuf} to the underlying {@link java.nio.channels.Channel}. * @param buf the {@link ByteBuf} from which the bytes should be written * @return amount the amount of written bytes */ protected abstract int doWriteBytes(ByteBuf buf) throws Exception; protected final void setOpWrite() { final SelectionKey key = selectionKey(); // Check first if the key is still valid as it may be canceled as part of the deregistration // from the EventLoop // See https://github.com/netty/netty/issues/2104 if (!key.isValid()) { return; } final int interestOps = key.interestOps(); if ((interestOps & SelectionKey.OP_WRITE) == 0) { key.interestOps(interestOps | SelectionKey.OP_WRITE); } } protected final void clearOpWrite() { final SelectionKey key = selectionKey(); // Check first if the key is still valid as it may be canceled as part of the deregistration // from the EventLoop // See https://github.com/netty/netty/issues/2104 if (!key.isValid()) { return; } final int interestOps = key.interestOps(); if ((interestOps & SelectionKey.OP_WRITE) != 0) { key.interestOps(interestOps & ~SelectionKey.OP_WRITE); } } }
[ "lilixia@bjca.org.cn" ]
lilixia@bjca.org.cn
7821152e5268ed449f3e37f4d76610a8643ba6f2
49834b6eb58faf75e0bb479b822763120e9084aa
/port/rsatooland/src/com/iteye/weimingtom/bouncycastle/util/StringList.java
178412fc10c04d4ca7c881b60a5d9de1ba454b13
[]
no_license
weimingtom/rsatool
cad0b8097747052354be9afcccb9eec7ebb078e4
46487738cf48198295fbbe9d278304dba2bedea1
refs/heads/master
2021-01-12T15:11:00.335448
2016-10-25T05:34:15
2016-10-25T05:34:15
71,717,008
0
0
null
null
null
null
UTF-8
Java
false
false
1,027
java
package com.iteye.weimingtom.bouncycastle.util; /** * An interface defining a list of strings. */ public interface StringList extends Iterable<String> { /** * Add a String to the list. * * @param s the String to add. * @return true */ boolean add(String s); /** * Get the string at index index. * * @param index the index position of the String of interest. * @return the String at position index. */ String get(int index); int size(); /** * Return the contents of the list as an array. * * @return an array of String. */ String[] toStringArray(); /** * Return a section of the contents of the list. If the list is too short the array is filled with nulls. * * @param from the initial index of the range to be copied, inclusive * @param to the final index of the range to be copied, exclusive. * @return an array of length to - from */ String[] toStringArray(int from, int to); }
[ "weimingtom@qq.com" ]
weimingtom@qq.com
2b5d50b75f49dd53e03d1164bd0bc6c095073a70
8603bbd7f9ea04b1b342c013cacdc104e5e78c7c
/RenoReferral/src/com/tlite/controller/setting/Setting.java
37b6a9040fcf063795f6289447f810d6840888f6
[]
no_license
akash-technolite/reno_technolite
6293d8aae1c66fc32fd65560ffcc78ccf64187f3
509cb54b5cfcbd699c28270ac1f349c19bfec03c
refs/heads/master
2020-03-07T20:53:46.484887
2018-09-06T14:04:08
2018-09-06T14:04:08
127,710,293
0
0
null
null
null
null
UTF-8
Java
false
false
7,541
java
package com.tlite.controller.setting; import java.io.IOException; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import com.dao.setting.ISetting; import com.dao.setting.ISettingImpl; import com.tlite.dao.lead.ILead; import com.tlite.dao.lead.ILeadImpl; import com.tlite.pojo.BudgetRanges; import com.tlite.pojo.Taxation; @WebServlet("/Setting") public class Setting extends HttpServlet { private static final long serialVersionUID = 1L; ISetting settingDao=new ISettingImpl(); ILead leaddao=new ILeadImpl(); RequestDispatcher rd=null; int res=0; public Setting() { super(); // TODO Auto-generated constructor stub } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { /*HttpSession session=request.getSession(false); int contractorId=(int) session.getAttribute("userId");*/ String action=request.getParameter("action"); String result=request.getParameter("result"); if(action!=null){ if(result!=null){ if(result.equals("serviceAdded")){ request.setAttribute("SuccessMessage", "Service Added"); }else if(result.equals("serviceNotAdded")){ request.setAttribute("ErrorMessage", "Service Not Added"); }else if(result.equals("serviceAvailable")){ request.setAttribute("ErrorMessage", "Service Already Exists"); }else if(result.equals("rangeAdded")){ request.setAttribute("SuccessMessage", "Budget Range Added"); }else if(result.equals("rangeNotAdded")){ request.setAttribute("ErrorMessage", "Budget Range Added"); }else if(result.equals("rangeAvailable")){ request.setAttribute("ErrorMessage", "Budget Range Already Exists"); }else if(result.equals("serviceDeleted")){ request.setAttribute("SuccessMessage", "Service Deleted"); }else if(result.equals("serviceNotDeleted")){ request.setAttribute("ErrorMessage", "Service Not Deleted"); }else if(result.equals("rangeDeleted")){ request.setAttribute("SuccessMessage", "Budget Range Deleted"); }else if(result.equals("rangeNotDeleted")){ request.setAttribute("ErrorMessage", "Budget Range Not Deleted"); }else if(result.equals("priceUpdated")){ request.setAttribute("SuccessMessage", "Lead Price Updated"); }else if(result.equals("priceNotUpdated")){ request.setAttribute("ErrorMessage", "Lead Price Not Updated"); }else if(result.equals("taxUpdated")){ request.setAttribute("SuccessMessage", "Tax Updated"); }else if(result.equals("taxNotUpdated")){ request.setAttribute("ErrorMessage", "Tax Not Updated"); } } if(action.equalsIgnoreCase("showSetting")){ request.setAttribute("serviceList", leaddao.getAllServices()); request.setAttribute("budgetRanges", leaddao.getBudgetRanges()); request.setAttribute("leadPrice", leaddao.getDefaultLeadPrice()); request.setAttribute("taxation", leaddao.getTaxation()); rd=request.getRequestDispatcher("adminSetting.jsp"); rd.forward(request, response); } } } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action=request.getParameter("action"); if(action.equalsIgnoreCase("addService")){ String service_name=request.getParameter("service_name"); service_name=service_name.trim(); service_name=service_name.substring(0,1).toUpperCase() + service_name.substring(1).toLowerCase(); res=settingDao.addService(service_name); if(res==1){ response.sendRedirect("Setting?action=showSetting&result=serviceAdded"); }else if(res==2){ response.sendRedirect("Setting?action=showSetting&result=serviceAvailable"); }else{ response.sendRedirect("Setting?action=showSetting&result=serviceNotAdded"); } }else if(action.equalsIgnoreCase("addBudgetRange")){ int min_value=Integer.parseInt(request.getParameter("min_value")); int max_value=Integer.parseInt(request.getParameter("max_value")); BudgetRanges range=new BudgetRanges(); range.setMin_value(min_value); range.setMax_value(max_value); res=settingDao.addBudgetRange(range); if(res==1){ response.sendRedirect("Setting?action=showSetting&result=rangeAdded"); }else if(res==2){ response.sendRedirect("Setting?action=showSetting&result=rangeAvailable"); }else{ response.sendRedirect("Setting?action=showSetting&result=rangeNotAdded"); } }else if(action.equalsIgnoreCase("deleteService")){ int service_id=Integer.parseInt(request.getParameter("service_id")); res=settingDao.deleteService(service_id); if(res>0){ response.sendRedirect("Setting?action=showSetting&result=serviceDeleted"); }else{ response.sendRedirect("Setting?action=showSetting&result=serviceNotDeleted"); } }else if(action.equalsIgnoreCase("deleteRange")){ int ranges_id=Integer.parseInt(request.getParameter("ranges_id")); System.out.println("Range Id="+ranges_id); res=settingDao.deleteBudgetRange(ranges_id); if(res>0){ response.sendRedirect("Setting?action=showSetting&result=rangeDeleted"); }else{ response.sendRedirect("Setting?action=showSetting&result=rangeNotDeleted"); } }else if(action.equalsIgnoreCase("newleadPrice")){ double priceDollar=Double.parseDouble(request.getParameter("price")); double priceCents=priceDollar*100; res=settingDao.updateLeadPrice(priceCents); if(res>0){ response.sendRedirect("Setting?action=showSetting&result=priceUpdated"); }else{ response.sendRedirect("Setting?action=showSetting&result=priceNotUpdated"); } }else if(action.equalsIgnoreCase("updateTaxation")){ /*tProvince*/ Taxation tax =new Taxation(); tax.setTax_id(Integer.parseInt(request.getParameter("tTax_id"))); tax.setGst(Double.parseDouble(request.getParameter("tGst"))); tax.setHst(Double.parseDouble(request.getParameter("tHst"))); tax.setPst(Double.parseDouble(request.getParameter("tPst"))); tax.setQst(Double.parseDouble(request.getParameter("tQst"))); res=leaddao.updateTaxation(tax); if(res>0){ response.sendRedirect("Setting?action=showSetting&result=taxUpdated"); }else{ response.sendRedirect("Setting?action=showSetting&result=taxNotUpdated"); } } } }
[ "AakashTechnolite@192.168.0.10" ]
AakashTechnolite@192.168.0.10
2f6cd46a4178cfbbe2f367c4698993a9b14f4a62
2573af7ff4b22e93d45269618271ef9fd0b24132
/src/com/automation/platform/TableTest.java
d64e128982aa816661b1636a2ffc54e036d43e5d
[]
no_license
AkshathaBShetty/PracticeGithub
aa1edd8f1f02c5fba168025885299380a115c158
16c5db5a1ac632e9e6f9af1d3dcfb692d5bf24a3
refs/heads/master
2020-08-11T17:30:22.548594
2019-10-12T08:36:07
2019-10-12T08:36:07
214,602,226
0
0
null
null
null
null
UTF-8
Java
false
false
2,212
java
package com.automation.platform; import static com.automation.common.Utilities.driver; import static com.automation.common.Utilities.pauseForTime; import static com.automation.common.Utilities.waitForElement; import org.apache.log4j.Logger; import org.openqa.selenium.By; import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; public class TableTest { public class Approval { Logger log=Logger.getLogger(Approval.class); Login login = new Login(driver); @FindBy(xpath="/html[1]/body[1]/div[11]/div[2]/div[3]/div[4]/table[1]/tbody[1]/tr[1]/td[2]/a[4]") WebElement SurveyList; @FindBy(id="listTable") WebElement tablelist; @FindBy(xpath="/html[1]/body[1]/div[18]/div[2]/div[4]/div[3]/div[2]/div[1]/div[1]/div[4]/div[1]") WebElement PlusIcon; public WebDriver Identifysurvey() { try { pauseForTime(5000); if(waitForElement(SurveyList,80).isDisplayed()) { waitForElement(SurveyList,80).click(); } } catch(NoSuchElementException ex) { log.error("SurveyList close button is not found on the page"); } try { if(waitForElement(tablelist, 60).isDisplayed()){ log.info("identified table"); int rows=tablelist.findElements(By.cssSelector("tr[class='list_separator listHighlight-inactive']")).size(); log.info(rows); int name=tablelist.findElements(By.cssSelector("tr[class='list_separator listHighlight-inactive'] td:nth-child(7)")).size(); log.info(name); /*for(int i=3;i<name;i++) { String textPath = "/html[1]/body[1]/div[11]/div[2]/div[3]/table[2]/tbody[1]/tr[" + String.valueOf(i) + "]/td[1]"; String s=driver.findElement(By.xpath(textPath)).getText(); if(s.contains(prop.getProperty("AllProcessReport"))) { log.info("process is searched from All process report"); break; }*/ } } catch(Exception ex) { log.error("process is not searched from all process list"); } return driver; } } }
[ "akshatha.shetty@wooqer.com" ]
akshatha.shetty@wooqer.com
6ccb02b1ebe65123d2cafecf8ce635aed344e8b6
e4a501ac69c5fca26d1a9c7ee78b045205129178
/src/ccImport/ConnexionCrew.java
87da1aada2f1f6d76aecc56d75c3d15b8d95062c
[]
no_license
cyrilreal/ChopeCREW
3e790dfa4e24657e36e7b3b1b7da160cf8508723
3cf88d02c692ddc8d11ff39e819c1325c6ca3a9e
refs/heads/master
2021-05-05T09:10:01.907265
2020-09-08T04:42:44
2020-09-08T04:42:44
38,562,990
0
0
null
null
null
null
UTF-8
Java
false
false
45,420
java
package ccImport; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.InputStream; import java.net.URI; import java.util.ArrayList; import java.util.Observable; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.ZipInputStream; import javax.swing.JOptionPane; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.conn.ConnectionKeepAliveStrategy; import org.apache.http.entity.ContentType; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.HttpContext; import org.jsoup.Jsoup; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import ccUtils.Utils; import chopeCrew.ChopeCrew; public class ConnexionCrew extends Observable { public static final int OK = 1; public static final int EXCEPTION = 0; public static final int ID_FIC_INVALIDE = -1; private String login; private String password; private String urlCrew; private String urlIpn; private int deltaMois; private Scanner scan; private String pageIntroPlanning; private String pageMensuelle; private String pageImpression; private String exportPda; private String exportPdaIcs; private ArrayList<String> pagesStage; private ArrayList<String> pagesRotation; private ArrayList<String> listUrlRotations; private ArrayList<String> listUrlStage; public ConnexionCrew() { this.pagesRotation = new ArrayList<String>(); this.listUrlRotations = new ArrayList<String>(); this.pagesStage = new ArrayList<String>(); this.listUrlStage = new ArrayList<String>(); } private int connectOFF(final String chemin_fichier) { System.out.println("Ouverture du fichier ..."); this.setChanged(); this.notifyObservers("Ouverture du fichier ..."); try { this.scan = new Scanner(new File(chemin_fichier), "UTF-8"); } catch (Exception e) { e.printStackTrace(); System.out.println("Echec ouverture du fichier"); this.setChanged(); this.notifyObservers("Echec ouverture du fichier"); return 0; } if (this.scan.findWithinHorizon("--- ChopeCrew ", 0) != null) { this.deltaMois = this.scan.nextInt(); System.out.println("Fichier reconnu !"); this.setChanged(); this.notifyObservers("Fichier reconnu !"); return 1; } System.out.println("Fichier invalide !"); this.setChanged(); this.notifyObservers("Fichier invalide !"); return -1; } private void importPageIntroPlanningOFF() { final String nl = System.getProperty("line.separator"); final String debut = "--- Page IntroPlanning ---"; final String fin = "--- Fin Page IntroPlanning ---"; if (this.scan.findWithinHorizon(debut, 0) == null) { return; } final StringBuilder sb = new StringBuilder(); String tmp; while (this.scan.hasNextLine() && !(tmp = this.scan.nextLine()).equals(fin)) { sb.append(tmp).append(nl); } System.out.println("Page intro planning obtenue"); this.setChanged(); this.notifyObservers("Type PN obtenu !"); this.pageIntroPlanning = sb.toString(); } private void importPageMensuelleOFF() { final String nl = System.getProperty("line.separator"); final String debut = "--- Page Mensuelle ---"; final String fin = "--- Fin Page Mensuelle ---"; if (this.scan.findWithinHorizon(debut, 0) == null) { return; } final StringBuilder sb = new StringBuilder(); String tmp; while (this.scan.hasNextLine() && !(tmp = this.scan.nextLine()).equals(fin)) { sb.append(tmp).append(nl); } System.out.println("Page mensuelle obtenue"); this.setChanged(); this.notifyObservers("Activit\u00e9s sol obtenues !"); this.pageMensuelle = sb.toString(); } private void importPageImpressionOFF() { final String nl = System.getProperty("line.separator"); final String debut = "--- Page Impression ---"; final String fin = "--- Fin Page Impression ---"; if (this.scan.findWithinHorizon(debut, 0) == null) { return; } final StringBuilder sb = new StringBuilder(); String tmp; while (this.scan.hasNextLine() && !(tmp = this.scan.nextLine()).equals(fin)) { sb.append(tmp).append(nl); } System.out.println("Page impression obtenue"); this.setChanged(); this.notifyObservers("Rotations obtenues !"); this.pageImpression = sb.toString(); } private void importExportPdaOFF() { final String nl = System.getProperty("line.separator"); final String debut = "--- Export Pda ---"; final String fin = "--- Fin Export Pda ---"; if (this.scan.findWithinHorizon(debut, 0) == null) { return; } final StringBuilder sb = new StringBuilder(); String tmp; while (this.scan.hasNextLine() && !(tmp = this.scan.nextLine()).equals(fin)) { sb.append(tmp).append(nl); } System.out.println("Export Pda obtenu"); this.setChanged(); this.notifyObservers("Infos obtenues !"); this.exportPda = sb.toString(); } private void importExportPdaIcsOFF() { final String nl = System.getProperty("line.separator"); final String debut = "--- Export PdaIcs ---"; final String fin = "--- Fin Export PdaIcs ---"; if (this.scan.findWithinHorizon(debut, 0) == null) { return; } final StringBuilder sb = new StringBuilder(); String tmp; while (this.scan.hasNextLine() && !(tmp = this.scan.nextLine()).equals(fin)) { sb.append(tmp).append(nl); } System.out.println("Export PdaIcs obtenu"); this.setChanged(); this.notifyObservers("Infos obtenues !"); this.exportPdaIcs = sb.toString(); } private void importPagesStageOFF() { final String nl = System.getProperty("line.separator"); final String debut = "--- Stage ---"; final String fin = "--- Fin Stage ---"; if (this.scan.findWithinHorizon("--- Pages Stages ---", 0) == null) { return; } while (this.scan.findWithinHorizon(debut, 0) != null) { final StringBuilder sb = new StringBuilder(); String tmp; while (!(tmp = this.scan.nextLine()).equals(fin)) { sb.append(tmp).append(nl); } this.pagesStage.add(sb.toString()); } System.out.println("Pages stages obtenues"); this.setChanged(); this.notifyObservers("Stages obtenus !"); } private void keepAlive() { final HttpGet get = new HttpGet(); int i = 0; try { while (ChopeCrew.isKeepAliving) { final URI url = new URI("https://" + this.urlIpn); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); if (response.getFirstHeader("Location") != null && response.getFirstHeader("Location").getValue().contains("siteminderagent")) { System.out.println("Redirection Habile ..."); } get.releaseConnection(); ++i; System.out.println("Alive " + i); Thread.sleep(300000L); } } catch (Exception e) { e.printStackTrace(); } } private int connectON(int deltamois) { System.out.println("Connexion Crew en cours ..."); setChanged(); this.notifyObservers("Connexion Crew en cours ..."); HttpGet get = new HttpGet(); HttpPost post = new HttpPost(); CloseableHttpResponse response; ArrayList<NameValuePair> formParams; URI url; String urlRedirection; try { // Requête Ipn url = new URI("https://" + urlIpn + "/IPn"); get.setURI(url); response = ChopeCrew.httpClient.execute(get); get.releaseConnection(); // Si on est redirigé vers "HBLSP", on s'identifie sinon on est deja logué if ((response.getFirstHeader("Location") != null) && (response.getFirstHeader("Location").getValue().contains("hblsp"))) { urlRedirection = response.getFirstHeader("Location").getValue(); // System.out.println(urlRedirection); System.out.println("Authentification Habile ..."); setChanged(); this.notifyObservers("Authentification Habile ..."); url = new URI(urlRedirection); get.setURI(url); response = ChopeCrew.httpClient.execute(get); // GET sur hblsp get.releaseConnection(); urlRedirection = response.getFirstHeader("Location").getValue(); // System.out.println(urlRedirection); url = new URI(urlRedirection); get.setURI(url); response = ChopeCrew.httpClient.execute(get); // GET sur fedhub String charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); InputStream is = response.getEntity().getContent(); String s = Utils.streamToString(is, charset); get.releaseConnection(); url = new URI("https://fedidp.airfrance.fr/idp/SSO.saml2"); post.setURI(url); formParams = fetchParamsDom(s, null); post.setEntity(new UrlEncodedFormEntity(formParams)); // POST sur fedidp response = ChopeCrew.httpClient.execute(post); charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); is = response.getEntity().getContent(); s = Utils.streamToString(is, charset); post.releaseConnection(); // post login formParams = fetchParamsDom(s, "nuxForm"); replaceArrayListItem(formParams, "ok", "IDENTIFICATION"); formParams.add(new BasicNameValuePair("username", login)); formParams.add(new BasicNameValuePair("userIdInMemory", "")); url = new URI("https://fedidp.airfrance.fr" + fetchFormUrl(s, null)); post.setURI(url); post.setEntity(new UrlEncodedFormEntity(formParams)); response = ChopeCrew.httpClient.execute(post); charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); is = response.getEntity().getContent(); s = Utils.streamToString(is, charset); post.releaseConnection(); // send token formParams = fetchParamsDom(s, null); replaceArrayListItem(formParams, "ok", "TOK"); replaceArrayListItem(formParams, "displayFullUserName", login); replaceArrayListItem(formParams, "currentAuthMethod", "TOK"); formParams.add(new BasicNameValuePair("inputTokName", password)); formParams.add(new BasicNameValuePair("otpAuth", "")); post.setURI(url); post.setEntity(new UrlEncodedFormEntity(formParams)); response = ChopeCrew.httpClient.execute(post); charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); is = response.getEntity().getContent(); s = Utils.streamToString(is, charset); post.releaseConnection(); // redirect formParams = fetchParamsDom(s, null); url = new URI(fetchFormUrl(s, null)); post.setURI(url); post.setEntity(new UrlEncodedFormEntity(formParams)); // POST sur fedHub response = ChopeCrew.httpClient.execute(post); charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); is = response.getEntity().getContent(); s = Utils.streamToString(is, charset); post.releaseConnection(); // Redirect 2; formParams = fetchParamsDom(s, null); url = new URI(fetchFormUrl(s, null)); post.setURI(url); post.setEntity(new UrlEncodedFormEntity(formParams)); // POST sur fedHub response = ChopeCrew.httpClient.execute(post); charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); post.releaseConnection(); } // Requête CREW // Cookie cookie = new Cookie(this.urlCrew, "crewid", // "kty4r5dy46yk4jtry5tf", "/", null, false); // ChopeCrew.httpClient.getState().addCookie(cookie); url = new URI("https://" + urlCrew + "/crew/main"); post.setURI(url); ArrayList<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("origine", "https://" + urlIpn)); post.setEntity(new UrlEncodedFormEntity(nvps)); ChopeCrew.httpClient.execute(post); post.releaseConnection(); deltaMois = deltamois; System.out.println("Connecté à Crew !"); setChanged(); this.notifyObservers("Connecté à Crew !"); return 1; } catch (Exception e) { e.printStackTrace(); System.out.println("Echec de la connexion"); setChanged(); this.notifyObservers("Echec de la connexion"); get.releaseConnection(); post.releaseConnection(); return 0; } } private int connectON_BAK(final int deltamois) { System.out.println("Connexion Crew en cours ..."); this.setChanged(); this.notifyObservers("Connexion Crew en cours ..."); final HttpGet get = new HttpGet(); final HttpPost post = new HttpPost(); try { URI url = new URI("https://" + this.urlIpn); get.setURI(url); CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); get.releaseConnection(); if (response.getFirstHeader("Location") != null && response.getFirstHeader("Location").getValue().contains("siteminderagent")) { final String urlRedirection = response.getFirstHeader("Location").getValue(); System.out.println("Authentification Habile ..."); this.setChanged(); this.notifyObservers("Authentification Habile ..."); url = new URI(urlRedirection); post.setURI(url); final ArrayList<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("USERNAME", this.login)); nvps.add(new BasicNameValuePair("PASSWORD", this.password)); nvps.add(new BasicNameValuePair("target", "https://" + this.urlIpn)); nvps.add(new BasicNameValuePair("smagentname", "agt_" + this.urlIpn + "_dmz-internet")); post.setEntity(new UrlEncodedFormEntity(nvps)); response = ChopeCrew.httpClient.execute((HttpUriRequest)post); post.releaseConnection(); if (response.getFirstHeader("Location") == null || response.getFirstHeader("Location").getValue().contains("siteminderagent")) { System.out.println("Acc\u00e8s refus\u00e9 !"); this.setChanged(); this.notifyObservers("Acc\u00e8s refus\u00e9 !"); return -1; } System.out.println("Acc\u00e8s accord\u00e9 !"); this.setChanged(); this.notifyObservers("Acc\u00e8s accord\u00e9 !"); } url = new URI("https://" + this.urlCrew + "/crew/main"); post.setURI(url); final ArrayList<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("origine", "https://" + this.urlIpn)); post.setEntity(new UrlEncodedFormEntity(nvps)); ChopeCrew.httpClient.execute((HttpUriRequest)post); post.releaseConnection(); this.deltaMois = deltamois; System.out.println("Connect\u00e9 \u00e0 Crew !"); this.setChanged(); this.notifyObservers("Connect\u00e9 \u00e0 Crew !"); return 1; } catch (Exception e) { e.printStackTrace(); System.out.println("Echec de la connexion"); this.setChanged(); this.notifyObservers("Echec de la connexion"); get.releaseConnection(); post.releaseConnection(); return 0; } } private void importPageIntroPlanningON() { final HttpGet get = new HttpGet(); try { System.out.println("Requ\u00eate menu pour type PN"); this.setChanged(); this.notifyObservers("Requ\u00eate type PN ..."); final URI url = new URI("https://" + this.urlCrew + "/crew/main?event=IntroPlanning"); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); final String charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); final InputStream is = response.getEntity().getContent(); this.pageIntroPlanning = Utils.streamToString(is, charset); get.releaseConnection(); System.out.println("Page intro planning obtenue"); this.setChanged(); this.notifyObservers("Type PN obtenu !"); } catch (Exception e) { e.printStackTrace(); System.out.println("Echec requ\u00eate page intro planning"); this.setChanged(); this.notifyObservers("Echec requ\u00eate type PN"); get.releaseConnection(); } } private void importPageMensuelleON() { final HttpGet get = new HttpGet(); try { System.out.println("Requ\u00eate page mensuelle"); this.setChanged(); this.notifyObservers("Requ\u00eate activit\u00e9s sol ..."); final URI url = new URI("https://" + this.urlCrew + "/crew/main?event=planning&deltaMois=" + String.valueOf(this.deltaMois)); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); final String charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); final InputStream is = response.getEntity().getContent(); this.pageMensuelle = Utils.streamToString(is, charset); get.releaseConnection(); System.out.println("Page mensuelle obtenue"); this.setChanged(); this.notifyObservers("Activit\u00e9s sol obtenues !"); } catch (Exception e) { e.printStackTrace(); System.out.println("Echec requ\u00eate page mensuelle"); this.setChanged(); this.notifyObservers("Echec requ\u00eate activit\u00e9s sol"); get.releaseConnection(); } } private void importPageImpressionON() { final HttpGet get = new HttpGet(); try { System.out.println("Requ\u00eate page impression"); this.setChanged(); this.notifyObservers("Requ\u00eate rotations ..."); URI url = new URI("https://" + this.urlCrew + "/crew/main?event=printRotations"); get.setURI(url); ChopeCrew.httpClient.execute((HttpUriRequest)get); get.releaseConnection(); url = new URI("https://" + this.urlCrew + "/crew/main?event=impressionRotations&deltaMois=" + String.valueOf(this.deltaMois)); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); final String charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); final InputStream is = response.getEntity().getContent(); this.pageImpression = Utils.streamToString(is, charset); get.releaseConnection(); System.out.println("Page impression obtenue"); this.setChanged(); this.notifyObservers("Rotations obtenues !"); } catch (Exception e) { e.printStackTrace(); System.out.println("Echec requ\u00eate page impression"); this.setChanged(); this.notifyObservers("Echec requ\u00eate rotations"); get.releaseConnection(); } } private void importExportPdaON() { final String nl = System.getProperty("line.separator"); String str_deltaMois = ""; switch (this.deltaMois) { case 0: { str_deltaMois = "moisM"; break; } case 1: { str_deltaMois = "moisM1"; break; } case 2: { str_deltaMois = "moisM2"; break; } } final ArrayList<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("typeFichier", "csv")); nvps.add(new BasicNameValuePair("couperEvenementChevauchement", "false")); nvps.add(new BasicNameValuePair(str_deltaMois, String.valueOf(this.deltaMois))); nvps.add(new BasicNameValuePair("zoneTemps", "Europe/Paris")); nvps.add(new BasicNameValuePair("voirVol", "true")); nvps.add(new BasicNameValuePair("rotVoirTerrain", "true")); nvps.add(new BasicNameValuePair("volVoirTerrain", "true")); nvps.add(new BasicNameValuePair("volVoirEquip", "true")); nvps.add(new BasicNameValuePair("rotVoirEquip", "true")); nvps.add(new BasicNameValuePair("voirIdem", "true")); nvps.add(new BasicNameValuePair("voirPresta", "true")); nvps.add(new BasicNameValuePair("voirSol", "true")); nvps.add(new BasicNameValuePair("voirConge", "true")); nvps.add(new BasicNameValuePair("voirReserve", "true")); nvps.add(new BasicNameValuePair("voirRepos", "true")); nvps.add(new BasicNameValuePair("voirStage", "true")); nvps.add(new BasicNameValuePair("voirInstruct", "true")); final HttpGet get = new HttpGet(); final HttpPost post = new HttpPost(); try { System.out.println("Requ\u00eate export Pda"); this.setChanged(); this.notifyObservers("Requ\u00eate infos ..."); URI url = new URI("https://" + this.urlCrew + "/crew/main?event=exportPDA"); get.setURI(url); ChopeCrew.httpClient.execute((HttpUriRequest)get); get.releaseConnection(); this.setChanged(); this.notifyObservers("En attente des infos ..."); url = new URI("https://" + this.urlCrew + "/crew/main?event=exportPDAcsv"); post.setURI(url); post.setEntity(new UrlEncodedFormEntity(nvps)); ChopeCrew.httpClient.execute((HttpUriRequest)post); post.releaseConnection(); url = new URI("https://" + this.urlCrew + "/crew/main?event=exportPDAzip"); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); final InputStream is = response.getEntity().getContent(); final BufferedInputStream bis = new BufferedInputStream(is); final ZipInputStream zis = new ZipInputStream(bis); zis.getNextEntry(); final int BUFFER = 1000; final byte[] data = new byte[BUFFER]; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final BufferedOutputStream bos = new BufferedOutputStream(baos, BUFFER); int count; while ((count = zis.read(data, 0, BUFFER)) != -1) { bos.write(data, 0, count); } bos.close(); baos.close(); zis.close(); bis.close(); is.close(); get.releaseConnection(); System.out.println("Export Pda obtenu"); this.setChanged(); this.notifyObservers("Infos obtenues !"); this.exportPda = baos.toString("ISO-8859-1").replaceAll("\r\n?|\n", nl); } catch (Exception e) { e.printStackTrace(); System.out.println("Echec requ\u00eate export Pda"); this.setChanged(); this.notifyObservers("Echec requ\u00eate infos compl\u00e9mentaires"); get.releaseConnection(); post.releaseConnection(); } } private void importExportPdaIcsON() { final String nl = System.getProperty("line.separator"); String str_deltaMois = ""; switch (this.deltaMois) { case 0: { str_deltaMois = "moisM"; break; } case 1: { str_deltaMois = "moisM1"; break; } case 2: { str_deltaMois = "moisM2"; break; } } final ArrayList<NameValuePair> nvps = new ArrayList<NameValuePair>(); nvps.add(new BasicNameValuePair("typeFichier", "ics")); nvps.add(new BasicNameValuePair("couperEvenementJourEntier", "false")); nvps.add(new BasicNameValuePair("couperEvenementChevauchement", "false")); nvps.add(new BasicNameValuePair(str_deltaMois, String.valueOf(this.deltaMois))); nvps.add(new BasicNameValuePair("zoneTemps", "UTC")); nvps.add(new BasicNameValuePair("voirVol", "true")); nvps.add(new BasicNameValuePair("rotVoirTerrain", "true")); nvps.add(new BasicNameValuePair("volVoirTerrain", "true")); nvps.add(new BasicNameValuePair("volVoirEquip", "true")); nvps.add(new BasicNameValuePair("rotVoirEquip", "true")); nvps.add(new BasicNameValuePair("voirIdem", "true")); nvps.add(new BasicNameValuePair("voirPresta", "true")); nvps.add(new BasicNameValuePair("voirSol", "false")); nvps.add(new BasicNameValuePair("voirConge", "false")); nvps.add(new BasicNameValuePair("voirReserve", "false")); nvps.add(new BasicNameValuePair("voirRepos", "false")); nvps.add(new BasicNameValuePair("voirStage", "false")); nvps.add(new BasicNameValuePair("voirInstruct", "false")); final HttpGet get = new HttpGet(); final HttpPost post = new HttpPost(); try { System.out.println("Requ\u00eate export PdaIcs"); this.setChanged(); this.notifyObservers("Requ\u00eate infos ..."); URI url = new URI("https://" + this.urlCrew + "/crew/main?event=exportPDA"); get.setURI(url); ChopeCrew.httpClient.execute((HttpUriRequest)get); get.releaseConnection(); this.setChanged(); this.notifyObservers("En attente des infos ..."); url = new URI("https://" + this.urlCrew + "/crew/main?event=exportPDAics"); post.setURI(url); post.setEntity(new UrlEncodedFormEntity(nvps)); ChopeCrew.httpClient.execute((HttpUriRequest)post); post.releaseConnection(); url = new URI("https://" + this.urlCrew + "/crew/main?event=exportPDAzip"); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); final InputStream is = response.getEntity().getContent(); final BufferedInputStream bis = new BufferedInputStream(is); final ZipInputStream zis = new ZipInputStream(bis); zis.getNextEntry(); final int BUFFER = 1000; final byte[] data = new byte[BUFFER]; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final BufferedOutputStream bos = new BufferedOutputStream(baos, BUFFER); int count; while ((count = zis.read(data, 0, BUFFER)) != -1) { bos.write(data, 0, count); } bos.close(); baos.close(); zis.close(); bis.close(); is.close(); get.releaseConnection(); System.out.println("Export PdaIcs obtenu"); this.setChanged(); this.notifyObservers("Infos obtenues !"); this.exportPdaIcs = baos.toString("UTF-8").replaceAll("\r\n?|\n", nl); System.out.println(this.exportPdaIcs); } catch (Exception e) { e.printStackTrace(); System.out.println("Echec requ\u00eate export PdaIcs"); this.setChanged(); this.notifyObservers("Echec requ\u00eate infos compl\u00e9mentaires"); get.releaseConnection(); post.releaseConnection(); } } private void importPagesRotationON() { final HttpGet get = new HttpGet(); try { for (int i = 0; i < this.listUrlRotations.size(); ++i) { System.out.println("Requ\u00eate rotation"); this.setChanged(); this.notifyObservers("D\u00e9tails rotation " + Integer.toString(i + 1) + " sur " + Integer.toString(this.listUrlRotations.size()) + " ..."); final String urlRotation = this.listUrlRotations.get(i); String s = "https://" + this.urlCrew + urlRotation; URI url = new URI(s.replaceAll(" ", "%20")); get.setURI(url); ChopeCrew.httpClient.execute((HttpUriRequest)get); get.releaseConnection(); s = "https://crew.airfrance.fr/crew/main?event=impressionRotation"; url = new URI(s.replaceAll(" ", "%20")); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); final String charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); final InputStream is = response.getEntity().getContent(); this.pagesRotation.add(Utils.streamToString(is, charset)); get.releaseConnection(); System.out.println("D\u00e9tails rotation obtenus"); this.setChanged(); this.notifyObservers("D\u00e9tails rotation " + Integer.toString(i + 1) + " sur " + Integer.toString(this.listUrlRotations.size()) + " obtenus !"); } } catch (Exception e) { e.printStackTrace(); System.out.println("Echec requ\u00eate d\u00e9tails des rotations"); this.setChanged(); this.notifyObservers("Echec requ\u00eate d\u00e9tails des rotations"); get.releaseConnection(); } } private void importPagesStageON() { final HttpGet get = new HttpGet(); try { for (int i = 0; i < this.listUrlStage.size(); ++i) { System.out.println("Requ\u00eate d\u00e9tails stage"); this.setChanged(); this.notifyObservers("D\u00e9tails du stage " + Integer.toString(i + 1) + " sur " + Integer.toString(this.listUrlStage.size()) + " ..."); final String urlStage = this.listUrlStage.get(i); String s = "https://" + this.urlCrew + urlStage; URI url = new URI(s.replaceAll(" ", "%20")); get.setURI(url); ChopeCrew.httpClient.execute((HttpUriRequest)get); get.releaseConnection(); final int index = urlStage.indexOf("stage") + "stage".length(); s = "https://" + this.urlCrew + urlStage.substring(0, index) + "Retour" + urlStage.substring(index); url = new URI(s.replaceAll(" ", "%20")); get.setURI(url); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); final String charset = ContentType.getOrDefault(response.getEntity()).getCharset().name(); final InputStream is = response.getEntity().getContent(); this.pagesStage.add(Utils.streamToString(is, charset)); get.releaseConnection(); System.out.println("D\u00e9tails stage obtenus"); this.setChanged(); this.notifyObservers("D\u00e9tails du stage " + Integer.toString(i + 1) + " sur " + Integer.toString(this.listUrlStage.size()) + " obtenus !"); } } catch (Exception e) { e.printStackTrace(); System.out.println("Echec requ\u00eate d\u00e9tails des stages"); this.setChanged(); this.notifyObservers("Echec requ\u00eate d\u00e9tails des stages"); get.releaseConnection(); } } private void checkVersion() { final Thread thrCon = new Thread() { @Override public void run() { final HttpGet get = new HttpGet(); try { System.out.println("V\u00e9rification de la version"); get.setURI(new URI("http://chopecrew.free.fr/telecharger/build_number.txt")); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); if (response.getStatusLine().getStatusCode() == 200) { final InputStream is = response.getEntity().getContent(); final int build = Integer.parseInt(Utils.streamToString(is, "ISO-8859-1").trim()); if (ChopeCrew.buildNumber < build) { System.out.println("Nouvelle version disponible"); JOptionPane.showMessageDialog(ChopeCrew.mf, "Une nouvelle version de ChopeCREW est disponible !\n Rendez-vous sur http://chopecrew.free.fr", "ChopeCREW vous informe", -1); } } else { System.out.println("Probl\u00e8me r\u00e9cup\u00e9ration version"); } get.releaseConnection(); } catch (Exception e) { System.out.println("Probl\u00e8me version"); e.printStackTrace(); get.releaseConnection(); } } }; thrCon.start(); } private void checkCompteurs() { final Thread thrCon = new Thread() { @Override public void run() { final HttpGet get = new HttpGet(); try { if (ChopeCrew.premiereUtilisationVersion) { System.out.println("Compteur utilisateurs..."); get.setURI(new URI("http://chopecrew.free.fr/compteur_jws/compteur_utilisateur.php")); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); if (response.getStatusLine().getStatusCode() == 200) { System.out.println("Compteur utilisateurs +1"); ChopeCrew.premiereUtilisationVersion = false; } else { System.out.println("Probl\u00e8me compteur utilisateurs"); } get.releaseConnection(); } System.out.println("Compteur plannings..."); get.setURI(new URI("http://chopecrew.free.fr/compteur_jws/compteur_planning.php")); final CloseableHttpResponse response = ChopeCrew.httpClient.execute((HttpUriRequest)get); if (response.getStatusLine().getStatusCode() == 200) { System.out.println("Compteur plannings +1"); } else { System.out.println("Probl\u00e8me compteur plannings"); } get.releaseConnection(); } catch (Exception e) { System.out.println("Probl\u00e8me compteur (exception)"); get.releaseConnection(); } } }; thrCon.start(); } public int chope(final String chemin_fichier, final boolean isFlash, final String login, final String password, final String urlIpn) { this.login = login; this.password = password; this.urlIpn = urlIpn; this.urlCrew = urlIpn.replaceAll("ipn", "crew"); final int z = this.connectOFF(chemin_fichier); if (z == 0) { System.out.println("->Erreur...(echec ouverture du fichier)"); this.setChanged(); this.notifyObservers(0); return 0; } if (z == -1) { System.out.println("->Erreur...(fichier invalide)"); this.setChanged(); this.notifyObservers(-1); return -1; } this.clear(); this.importPageIntroPlanningOFF(); this.importPageMensuelleOFF(); this.importPageImpressionOFF(); if (!isFlash) { this.importExportPdaIcsOFF(); this.importPagesStageOFF(); } this.scan.close(); this.scan = null; System.out.println("->Planning import\u00e9 !"); this.setChanged(); this.notifyObservers("Planning import\u00e9 !"); this.setChanged(); this.notifyObservers(1); return 1; } public int chope(final int dMois, final boolean isFlash, final String login, final String password, final String urlIpn) { this.login = login; this.password = password; this.urlIpn = urlIpn; this.urlCrew = urlIpn.replaceAll("ipn", "crew"); if (ChopeCrew.httpClient == null) { final PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); final ConnectionKeepAliveStrategy myStrategy = new ConnectionKeepAliveStrategy() { @Override public long getKeepAliveDuration(final HttpResponse response, final HttpContext context) { return 10800000L; } }; ChopeCrew.httpClient = HttpClients.custom().setConnectionManager(cm).setKeepAliveStrategy(myStrategy).disableRedirectHandling().build(); } this.checkVersion(); final int z = this.connectON(dMois); if (z == 0) { System.out.println("->Erreur...(impr\u00e9vue)"); this.setChanged(); this.notifyObservers(0); return 0; } if (z == -1) { System.out.println("->Erreur...(identifiants)"); this.setChanged(); this.notifyObservers(-1); return -1; } this.checkCompteurs(); this.clear(); this.importPageIntroPlanningON(); this.importPageMensuelleON(); this.importPageImpressionON(); if (!isFlash) { this.importExportPdaIcsON(); this.chopeListUrlStage(); this.importPagesStageON(); } System.out.println("->Planning import\u00e9 !"); this.setChanged(); this.notifyObservers("Planning import\u00e9 !"); this.setChanged(); this.notifyObservers(1); ChopeCrew.isKeepAliving = true; this.keepAlive(); return 1; } public String getPageIntroPlanning() { return this.pageIntroPlanning; } public String getPageMensuelle() { return this.pageMensuelle; } public String getPageImpression() { return this.pageImpression; } public String getExportPda() { return this.exportPda; } public String getExportPdaIcs() { return this.exportPdaIcs; } public ArrayList<String> getPagesStage() { return this.pagesStage; } public int getDeltaMois() { return this.deltaMois; } public String getSourceAsString() { final String nl = System.getProperty("line.separator"); final StringBuilder sb = new StringBuilder(); sb.append("--- ChopeCrew ").append(this.deltaMois).append(" ---").append(nl); if (this.pageIntroPlanning != null) { sb.append("--- Page IntroPlanning ---").append(nl).append(this.pageIntroPlanning).append(nl).append("--- Fin Page IntroPlanning ---").append(nl); } if (this.pageMensuelle != null) { sb.append("--- Page Mensuelle ---").append(nl).append(this.pageMensuelle).append(nl).append("--- Fin Page Mensuelle ---").append(nl); } if (this.pageImpression != null) { sb.append("--- Page Impression ---").append(nl).append(this.pageImpression).append(nl).append("--- Fin Page Impression ---").append(nl); } if (this.exportPda != null) { sb.append("--- Export Pda ---").append(nl).append(this.exportPda).append(nl).append("--- Fin Export Pda ---").append(nl); } if (this.exportPdaIcs != null) { sb.append("--- Export PdaIcs ---").append(nl).append(this.exportPdaIcs).append(nl).append("--- Fin Export PdaIcs ---").append(nl); } if (this.pagesStage.size() > 0) { sb.append("--- Pages Stages ---").append(nl); for (final String pageStage : this.pagesStage) { sb.append("--- Stage ---").append(nl); sb.append(pageStage).append(nl); sb.append("--- Fin Stage ---").append(nl); } sb.append("--- Fin Pages Stages ---").append(nl); } sb.append("--- Fin ChopeCrew ---"); return sb.toString(); } private void chopeListUrlRotations() { final String cible = "event=navigationActivite.*?(&numrot.*?)\""; final Pattern regex = Pattern.compile(cible); final Matcher result = regex.matcher(this.pageMensuelle); while (result.find()) { final String urlRotation = "/crew/main?event=rotation" + result.group(1); if (!this.listUrlRotations.contains(urlRotation)) { this.listUrlRotations.add(urlRotation); } } } private void chopeListUrlStage() { final String cible = "event=navigationActivite.*?(&dateBlocDeb.*?codestage.*?)\""; final Pattern regex = Pattern.compile(cible); final Matcher result = regex.matcher(this.pageMensuelle); while (result.find()) { final String urlStage = "/crew/main?event=stage" + result.group(1); if (!this.listUrlStage.contains(urlStage)) { this.listUrlStage.add(urlStage); } } } private void clear() { this.pageIntroPlanning = null; this.pageMensuelle = null; this.pageImpression = null; this.exportPda = null; this.exportPdaIcs = null; this.listUrlStage.clear(); this.pagesStage.clear(); } private ArrayList<NameValuePair> fetchParamsDom(String src, String formName) { ArrayList<NameValuePair> alParams = new ArrayList<NameValuePair>(); org.jsoup.nodes.Document doc = Jsoup.parse(src); if (formName != null) { Elements elements = doc.select("form[id=nuxForm] > input[type=hidden]"); for (Element elem : elements) { alParams.add(new BasicNameValuePair(elem.attr("name"), elem.attr("value"))); } return alParams; } Elements elements = doc.select("input[type=hidden]"); for (Element elem : elements) { alParams.add(new BasicNameValuePair(elem.attr("name"), elem.attr("value"))); } return alParams; } private String fetchFedIdp(String src) { org.jsoup.nodes.Document doc = Jsoup.parse(src); Element element = doc.select("form[id=nuxForm]").first(); Pattern pattern; Matcher result; pattern = Pattern.compile("/idp/(.*)/resumeSAML20/idp/SSO.ping"); result = pattern.matcher(element.attr("action")); if (result.find()) { return result.group(1); } return null; } private String fetchFormUrl(String src, String formName) { org.jsoup.nodes.Document doc = Jsoup.parse(src); Element element; if (formName != null) { element = doc.select("form[id=" + formName + "]").first(); } else { element = doc.select("form").first(); } return element.attr("action"); } private void replaceArrayListItem(ArrayList<NameValuePair> list, String itemName, String itemValue) { BasicNameValuePair nvp; // get item index int index = -1; for (int i = 0; i < list.size(); i++) { nvp = (BasicNameValuePair) list.get(i); if (nvp.getName().equals(itemName)) { index = i; break; } } if (index != -1) { list.set(index, new BasicNameValuePair(itemName, itemValue)); } } private int findMfaAuthOtpType(ArrayList<NameValuePair> list) { BasicNameValuePair nvp; for (int i = 0; i < list.size(); i++) { nvp = (BasicNameValuePair) list.get(i); if (nvp.getName().equals("mfaAuthOtpType")) { return i; } } return -1; } }
[ "noreply@github.com" ]
noreply@github.com
e39bafcb74a8a1660843a0eb6dce2ce372b1c277
6da8a6c7fe0979eea516cc7555da02752e191d3b
/app/src/main/java/com/romero/curso32/MainActivity.java
838e1a9be07af5a615e604651c1391dbed555c6b
[]
no_license
Rafarh46/Informacion
165adfb217223815b411d84c43b1a8e176ce8347
a60fe9d255003e4c1c17f064c5d0dfcf5bba0738
refs/heads/master
2020-05-27T21:38:17.504951
2019-05-27T06:27:27
2019-05-27T06:27:27
188,795,520
0
0
null
null
null
null
UTF-8
Java
false
false
3,254
java
package com.romero.curso32; import android.app.DatePickerDialog; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.text.Layout; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.TextView; import java.util.Calendar; public class MainActivity extends AppCompatActivity { private static final String TAG = "MainActivity"; private EditText miFecha; private DatePickerDialog.OnDateSetListener miFechaSetListener; private EditText tvNombre; private EditText tvFecha; private EditText tvTelefono; private EditText tvEmail; private EditText tvDescripcion; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tvNombre = (EditText) findViewById(R.id.nombre); tvFecha = (EditText) findViewById(R.id.fecha); tvTelefono = (EditText) findViewById(R.id.telefono); tvEmail = (EditText) findViewById(R.id.email); tvDescripcion = (EditText) findViewById(R.id.descripcion); miFecha = (EditText) findViewById(R.id.fecha); miFecha.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Calendar cal = Calendar.getInstance(); int year = cal.get(Calendar.YEAR); int month = cal.get(Calendar.MONTH); int day = cal.get(Calendar.DAY_OF_MONTH); DatePickerDialog dialog = new DatePickerDialog( MainActivity.this, android.R.style.Theme_Holo_Light_Dialog_MinWidth, miFechaSetListener, year,month,day); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); dialog.show(); } }); miFechaSetListener = new DatePickerDialog.OnDateSetListener() { @Override public void onDateSet(DatePicker datePicker, int year, int month, int day) { month = month + 1; Log.d(TAG, "onDateSet: mm/dd/yyy: " + month + "/" + day + "/" + year); String date = month + "/" + day + "/" + year; miFecha.setText(date); } }; Button btn = (Button) findViewById(R.id.btn); btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(MainActivity.this, Informacion.class); i.putExtra("nombre", tvNombre.getText().toString()); i.putExtra("fecha", tvFecha.getText().toString()); i.putExtra("telefono", tvTelefono.getText().toString()); i.putExtra("email", tvEmail.getText().toString()); i.putExtra("descripcion", tvDescripcion.getText().toString()); startActivity(i); } }); } }
[ "romerorh46@gmail.com" ]
romerorh46@gmail.com
06c920c2bd0337b7bbe4c838c3bd6334178daffe
010b0b5bec2d66215c65ced8db5a661df3811a79
/app/src/main/java/link/mgiannone/musixmatchapp/data/PreferenceInfo.java
c5effb6a7c28165efaa625995eb845e26faf762c
[]
no_license
mickgian/MusixMatchApp
4ded7191c63f596dee5587a132a5f6c4e687bc61
8349cd7a42dea1f88699bdfbbe595b02a701c42f
refs/heads/master
2020-04-16T20:01:31.974979
2019-01-17T16:32:30
2019-01-17T16:32:30
165,879,978
0
0
null
null
null
null
UTF-8
Java
false
false
245
java
package link.mgiannone.musixmatchapp.data; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import javax.inject.Qualifier; @Qualifier @Retention(RetentionPolicy.RUNTIME) public @interface PreferenceInfo { }
[ "michele.giannone@gmail.com" ]
michele.giannone@gmail.com
94216462a56370e680665c404385f711cfbdad01
9b70c74d4633a127787df1a101e72da886a9fe4c
/test/diego/wotlas/src/wotlas/server/message/chat/ChatRoomCreationMsgBehaviour.java
49f31300f4e10aaf9f5c995f2f05546f634ffd07
[]
no_license
wotlas/sourceforge-cvs
032d221b5f740f9c33915ff88f72019b966b080d
2064a5bab42218b5fd3898061700ebabb6a412f9
refs/heads/master
2020-05-23T16:18:13.359826
2010-08-18T20:42:39
2010-08-18T20:42:39
186,845,340
0
0
null
null
null
null
UTF-8
Java
false
false
5,558
java
/* * Light And Shadow. A Persistent Universe based on Robert Jordan's Wheel of Time Books. * Copyright (C) 2001-2002 WOTLAS Team * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package wotlas.server.message.chat; import java.io.IOException; import java.util.*; import wotlas.libs.net.NetMessageBehaviour; import wotlas.common.message.chat.*; import wotlas.common.chat.*; import wotlas.common.Player; import wotlas.common.router.MessageRouter; import wotlas.common.universe.*; import wotlas.common.message.account.*; import wotlas.server.*; import wotlas.utils.Debug; /** * Associated behaviour to the ChatRoomCreationMessage... * * @author Petrus */ public class ChatRoomCreationMsgBehaviour extends ChatRoomCreationMessage implements NetMessageBehaviour { /*------------------------------------------------------------------------------------*/ /** Is it a bot's default chat room we want to create ? */ private boolean isBotChatRoom; /*------------------------------------------------------------------------------------*/ /** Constructor. */ public ChatRoomCreationMsgBehaviour() { super(); } /*------------------------------------------------------------------------------------*/ /** Constructor with parameters for bots. The isBotChatRoom parameter tells if this * chat room is the default chat room of a bot. */ public ChatRoomCreationMsgBehaviour( String name, String creatorPrimaryKey, boolean isBotChatRoom ) { super( name, creatorPrimaryKey ); this.isBotChatRoom = isBotChatRoom; } /*------------------------------------------------------------------------------------*/ /** Associated code to this Message... * * @param sessionContext an object giving specific access to other objects needed to process * this message. */ public void doBehaviour( Object sessionContext ) { // The sessionContext is here a PlayerImpl. PlayerImpl player = (PlayerImpl) sessionContext; WotlasLocation location = player.getLocation(); // 0 - We check the length of the chat room name if( name.length() > ChatRoom.MAXIMUM_NAME_SIZE ) name = name.substring(0,ChatRoom.MAXIMUM_NAME_SIZE-1); // 1 - We get the message router MessageRouter mRouter = player.getMessageRouter(); if( mRouter==null ) { Debug.signal( Debug.ERROR, this, "No Message Router !" ); player.sendMessage( new WarningMessage("Error #ChCreMsgRtr while performing creation !\nPlease report the bug !") ); return; // rare internal error occured ! } // 2 - Do we have to delete the previous chatroom ? if( !player.getCurrentChatPrimaryKey().equals(ChatRoom.DEFAULT_CHAT) ) { // The following message behaviour does this job... RemPlayerFromChatRoomMsgBehaviour remPlayerFromChat = new RemPlayerFromChatRoomMsgBehaviour( player.getPrimaryKey(), player.getCurrentChatPrimaryKey() ); try{ remPlayerFromChat.doBehaviour( player ); }catch( Exception e ) { Debug.signal( Debug.ERROR, this, e ); player.setCurrentChatPrimaryKey(ChatRoom.DEFAULT_CHAT); } } // 3 - We try to create the new chatroom ChatRoom chatRoom = new ChatRoom(); chatRoom.setPrimaryKey( ChatRoom.getNewChatPrimaryKey() ); chatRoom.setName(name); chatRoom.setCreatorPrimaryKey(creatorPrimaryKey); chatRoom.addPlayer(player); synchronized( mRouter.getPlayers() ) { ChatList chatList = player.getChatList(); if(chatList==null) { chatList = (ChatList) new ChatListImpl(); // We set the chatList to all the players in the chat room... Iterator it = mRouter.getPlayers().values().iterator(); while( it.hasNext() ) { PlayerImpl p = (PlayerImpl) it.next(); p.setChatList( chatList ); } } if( chatList.getNumberOfChatRooms() > ChatRoom.MAXIMUM_CHATROOMS_PER_ROOM && !isBotChatRoom ) return; // can't add ChatRoom : too many already ! chatList.addChatRoom( chatRoom ); } player.setCurrentChatPrimaryKey( chatRoom.getPrimaryKey() ); player.setIsChatMember(true); // 4 - We advertise the newly created chatroom // We send the information to all players of the same room or town or world mRouter.sendMessage( new ChatRoomCreatedMessage( chatRoom.getPrimaryKey(), name, creatorPrimaryKey ) ); } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ }
[ "diego_zanga@users.sourceforge.net" ]
diego_zanga@users.sourceforge.net
4d1f2181ae1e30c9f331d4cfb263040d3dabe505
b9536a191739385b0c5c0bbac12c0b4dfdea501b
/src/main/java/com/bigdata/content/controller/solution/SolutionTypeController.java
7f5977fa5f05c2545143a7c2d0c1cc0dec83baf0
[]
no_license
mengboy/graduationproject
c04914c03c112e35f0ab8c8cda38fc33d8039136
c1aac5dae6d43d3b1abfb7542837a8989420763d
refs/heads/master
2021-01-25T11:15:32.361698
2018-06-23T12:02:32
2018-06-23T12:02:32
123,386,466
0
0
null
null
null
null
UTF-8
Java
false
false
2,730
java
package com.bigdata.content.controller.solution; import com.bigdata.common.utils.PageUtils; import com.bigdata.common.utils.Query; import com.bigdata.common.utils.R; import com.bigdata.content.domain.SolutionType; import com.bigdata.content.service.SolutionTypeService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; @Controller @RequestMapping("/content/solution") public class SolutionTypeController { @Autowired SolutionTypeService solutionTypeService; @GetMapping("") @RequiresPermissions("content:solution:solution") String solution(){ return "content/solution/solution"; } /** * 添加solutionType * @param solutionType * @return */ @PostMapping("/addSolutionType") @ResponseBody Object addSolutionType(@RequestParam String solutionType){ SolutionType s = new SolutionType(); s.setSolutionType(solutionType); try{ solutionTypeService.insert(s); }catch (Exception e){ e.printStackTrace(); return R.error(); } return R.ok(); } @GetMapping("/listSolutionType") @ResponseBody Object listSolutionType(@RequestParam Map<String, Object> map){ Query query = new Query(map); List<SolutionType> solutionTypes = null; try{ solutionTypes = solutionTypeService.list(query); int i = 1; for(SolutionType solutionType : solutionTypes){ solutionType.setSn(i); i++; } }catch (Exception e){ e.printStackTrace(); return R.error(); } int total = solutionTypeService.count(); return new PageUtils(solutionTypes, total); } @GetMapping("/solutionTypes") @ResponseBody Object solutionTypes(){ List<SolutionType> solutionTypes = null; try{ solutionTypes = solutionTypeService.list(); }catch (Exception e){ e.printStackTrace(); return R.error(); } Map<String, Object> map = new HashMap<>(); map.put("results", solutionTypes); return R.ok(map); } @PostMapping("/delSolutionType") @ResponseBody Object delSolutionType(@RequestParam Integer id){ try { solutionTypeService.del(id); }catch (Exception e){ e.printStackTrace(); return R.error(); } return R.ok(); } }
[ "bai.white86@gmail.com" ]
bai.white86@gmail.com
036d683b51e58f7b63e0036b5b0809647b90d0e6
935a29bc886a33a70358023b0de9d6a817a90faa
/Auth/src/main/java/com/auth/entity/Permission.java
77b95b0abb8f91f42d8069a2ea2f7acabb3cef19
[ "MIT" ]
permissive
EtachGu/rays-auth
36c514063d700b4ecf2d0fac033535e1f20dba29
521eeebcf0f638383d90020e95821be26dacff4b
refs/heads/master
2022-07-19T00:37:41.920242
2019-08-19T13:38:36
2019-08-19T13:38:36
160,063,758
2
0
MIT
2022-06-21T00:54:26
2018-12-02T15:54:21
Java
UTF-8
Java
false
false
519
java
package com.auth.entity; import javax.persistence.*; public class Permission { @Id private Long id; private String name; /** * @return id */ public Long getId() { return id; } /** * @param id */ public void setId(Long id) { this.id = id; } /** * @return name */ public String getName() { return name; } /** * @param name */ public void setName(String name) { this.name = name; } }
[ "detached_gu@163.com" ]
detached_gu@163.com
986eadd987aecf96840f1f344200a164ad8fcf39
ff846fac5e1cd9ab8cff81eaa274b971e73091cc
/src/main/java/com/yhz/com/model/ClassInfo.java
efda4d94411039fd69d18846725d61163c7aff4e
[]
no_license
jzmzpn/yhz
be8aba248425c70bbab377aefdb65f55e30e4af8
815ca2bd2c389cf5771623271c1e8daa34368809
refs/heads/master
2020-03-27T06:35:07.238016
2018-08-25T18:14:47
2018-08-25T18:14:47
145,184,087
0
0
null
null
null
null
UTF-8
Java
false
false
2,154
java
package com.yhz.com.model; import java.util.Date; public class ClassInfo { private Integer id; private Integer kindergartenId; private String className; private Integer teacherId; private Integer studentNum; private Date openDate; private String remark; private Date createDate; private Date updateDate; private int maleNum; private int femaleNum; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getKindergartenId() { return kindergartenId; } public void setKindergartenId(Integer kindergartenId) { this.kindergartenId = kindergartenId; } public String getClassName() { return className; } public void setClassName(String className) { this.className = className == null ? null : className.trim(); } public Integer getTeacherId() { return teacherId; } public void setTeacherId(Integer teacherId) { this.teacherId = teacherId; } public Integer getStudentNum() { return studentNum; } public void setStudentNum(Integer studentNum) { this.studentNum = studentNum; } public Date getOpenDate() { return openDate; } public void setOpenDate(Date openDate) { this.openDate = openDate; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark == null ? null : remark.trim(); } public Date getCreateDate() { return createDate; } public void setCreateDate(Date createDate) { this.createDate = createDate; } public Date getUpdateDate() { return updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } public int getMaleNum() { return maleNum; } public void setMaleNum(int maleNum) { this.maleNum = maleNum; } public int getFemaleNum() { return femaleNum; } public void setFemaleNum(int femaleNum) { this.femaleNum = femaleNum; } }
[ "287672545@qq.com" ]
287672545@qq.com
c1c19494699ea586b1c016eec81f68c1c012d796
f89f9da573772160ad096cfb3de9ff7ad33c159b
/src/main/java/br/com/igti/LeilaoApplication.java
f764010d4d1a3aaf593a6c15c72019e828f73d55
[]
no_license
robsongomes/leilao-service
e67524b6ebe65180201c79ae680f77fe2f78132b
0f4ef33f02d72637721138da3dc124ec9f63a04c
refs/heads/main
2023-04-18T06:54:30.813633
2021-04-18T18:42:43
2021-04-18T18:42:43
359,225,610
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package br.com.igti; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import springfox.documentation.swagger2.annotations.EnableSwagger2; @SpringBootApplication @EnableSwagger2 public class LeilaoApplication { public static void main(String[] args) { SpringApplication.run(LeilaoApplication.class, args); } }
[ "nosbor84@gmail.com" ]
nosbor84@gmail.com
d9dfe185cc029882794fc07c17a96f992352949c
19384c145f8542c9fff1723ad5d3c949bc5b6f90
/Lab04/com/unicamp/mc322/lab04/Posicao.java
e12e1926321f2c95b9853aa32eb6a9b17161a187
[]
no_license
Necctares/MC322
e75b225cc5bb19ad1eac824875e8578b24f4fd3f
25f408ab06b5a1d7ffcb18351791bd664ef2b798
refs/heads/main
2023-07-17T03:45:51.452462
2021-08-04T21:09:14
2021-08-04T21:09:14
392,819,344
0
0
null
null
null
null
UTF-8
Java
false
false
259
java
package com.unicamp.mc322.lab04; public class Posicao { private int x; private int y; /** * Cria um novo vetor Posicao * * @param x coordenada * @param y coordenada */ Posicao(int x, int y) { this.x = x; this.y = y; } }
[ "noreply@github.com" ]
noreply@github.com
4f72b6d717d0cdfac44698ea557bd6f072afbf48
52ff0ee3517616a03af7d39683de71b735e1b056
/app/src/test/java/com/alifproduction/ypttegal/ExampleUnitTest.java
c2fccfd3f0347325e7e890575db86d249f99b530
[]
no_license
Fafaiya/YPTTegal
9cf15b1d18afea1b6bd0879e3beab3d9dcde7786
3caee89b7d5a49eed5a274d8ca7247484df29d6d
refs/heads/master
2023-02-21T14:00:54.823516
2021-01-28T22:37:30
2021-01-28T22:37:30
327,459,994
0
0
null
null
null
null
UTF-8
Java
false
false
388
java
package com.alifproduction.ypttegal; 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); } }
[ "wanipiro1986@gmail.com" ]
wanipiro1986@gmail.com
4903d9be78c2d0d8c406c9d7257768959821a4b3
e23522ca832999435947be216c7297edb112d07c
/src/main/java/com/dreamchaser3/sample/WebConfiguration.java
127c2681d427d2383d2e4e242f09ef76507e6b51
[]
no_license
dreamchaser3/spring-security-sample
bcd0435c54a4f09e0db15e9502d2cbe1545aa8be
63fef1b05a40028664ab73c8fde9b9392e79c181
refs/heads/master
2020-05-24T19:55:53.903551
2019-05-19T07:32:35
2019-05-19T07:32:35
187,445,638
0
0
null
null
null
null
UTF-8
Java
false
false
1,527
java
package com.dreamchaser3.sample; import com.dreamchaser3.sample.resolver.UserArgumentResolver; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.web.client.RestTemplate; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import java.util.List; @Configuration public class WebConfiguration implements WebMvcConfigurer { @Override public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { resolvers.add(new UserArgumentResolver()); } @Bean public RestTemplate restTemplate() { RestTemplate restTemplate = new RestTemplate(); MappingJackson2HttpMessageConverter messageConverter = new MappingJackson2HttpMessageConverter(); ObjectMapper objectMapper = new ObjectMapper(); objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE); objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); messageConverter.setObjectMapper(objectMapper); restTemplate.setMessageConverters(List.of(messageConverter)); return restTemplate; } }
[ "dreamchaser3@naver.com" ]
dreamchaser3@naver.com
dbd08404d7328ea361e58ac7b4ed5756c0f2eb6d
2a1ec378180a9c4a998083f5ce36572829fd0258
/test/src/test16/Exec.java
347a2620aea3f253bf15f2e3f7eb4fb422945f0e
[]
no_license
Runtym/java
8b21f6a3431fad51dcea6b666414ce2345184f92
2ff3232f4326e03b239338b11a987c5af1273712
refs/heads/master
2020-03-22T17:31:08.027602
2018-07-24T08:44:23
2018-07-24T08:44:23
140,399,802
1
1
null
null
null
null
UTF-8
Java
false
false
135
java
package test16; public class Exec { public static void main(String[] args) { Father f = new Father("나나나"); } }
[ "koitt03-A@koitt03-A-PC" ]
koitt03-A@koitt03-A-PC
5972bed13daea6d96f1607e680dc848ca5f677b5
d7d6402d0605b11949cd25458480819dd34bb962
/com/company/TypeCoffee/Espresso.java
149853d805d0db1291b44c49306698349dd384a9
[]
no_license
zhdaurenkyzy/CoffeeShop
a0c9ca64f6dbb3323b33e18a4a3e8db61ec86ce2
472d4fded524eb46f48d645e1e16103a57852d25
refs/heads/master
2020-06-21T13:11:12.847299
2019-07-17T21:09:24
2019-07-17T21:09:24
197,461,335
0
0
null
null
null
null
UTF-8
Java
false
false
584
java
package com.company.TypeCoffee; import com.company.Arabica; import com.company.Water; public class Espresso extends Coffee { private String name = "Espresso"; public Espresso(Arabica arabica, Water water) { super(arabica, water); } @Override public String getName() { return name; } @Override public double getStandartSizeCoffee() { return super.getStandartSizeCoffee(); } public void setStandartSizeCoffee() { getArabica().setAmountOfArabica_gram(20); getWater().setAmountOfWater_ml(100); } }
[ "noreply@github.com" ]
noreply@github.com
f70b7ff48104ed8fa712b74cfd2272a3577d8f56
8c9e56076ec59a8d1fbca733410b974ea2c41bb9
/nifi-commons/nifi-record-path/src/main/java/org/apache/nifi/record/path/RecordPathResult.java
42d99d249b58e72875439b3a6c283bfb5ae20ae7
[ "CC0-1.0", "Apache-2.0", "MIT", "LicenseRef-scancode-unknown" ]
permissive
apache/nifi
70329dca21ce61a643d5fac263ab101ae9313f5a
2b330d9feea82764721e6190f7320d49c73986b0
refs/heads/main
2023-09-04T00:50:15.639598
2023-08-31T16:41:08
2023-08-31T16:41:08
27,911,088
4,182
3,345
Apache-2.0
2023-09-14T20:56:07
2014-12-12T08:00:05
Java
UTF-8
Java
false
false
979
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.nifi.record.path; import java.util.stream.Stream; public interface RecordPathResult { String getPath(); Stream<FieldValue> getSelectedFields(); }
[ "mattyb149@apache.org" ]
mattyb149@apache.org
15c268e9165d687be53cbafb718f24c05bc853fd
42d7df6349ae0654c072dfa97cceac60c8df4074
/Main.java
32b46baad251e36392b2eef0f52a67dfd293781e
[]
no_license
kadumkomutdev/ColumnarTranspositionCipher
f984feee922764b2a75e5b30a0f9f4153579adc4
619fe1c6a0ec1503d58b7c192488406c2d1f1a37
refs/heads/master
2022-09-06T18:46:55.336469
2019-11-12T02:57:08
2019-11-12T02:57:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
771
java
import java.util.Scanner; public class Main { private static String plainText,key; public static void main(String[] args) { //encryption part Encryption encryption = new Encryption(key,plainText); System.out.println("The Encrypted Text for '"+plainText+"' : "+encryption.getEncryptedText()); //decryption part Decryption decryption = new Decryption(key,encryption.getEncryptedText()); decryption.getText(); } static { Scanner scanner = new Scanner(System.in); System.out.println("Enter the plaintext"); plainText = scanner.nextLine(); System.out.println("Enter the keyword to be used"); key = scanner.next(); scanner.nextLine(); } }
[ "noreply@github.com" ]
noreply@github.com
f8ced2b1128f8c854386bd6db4b3b81092d3276b
5ee8b5417cb898d33cc525a107daf970afab76af
/src/wuhen/spring/beans/first/Car.java
db8b3bb787de84b47f25fcdd3ff0c0222c142ac5
[ "Apache-2.0" ]
permissive
291663174/Base-Spring
62abd323b1f446b40e6daa92ff570570daa7da70
c7f9a39c0c1d6c8311caadec06a35e3d0fa91a36
refs/heads/master
2023-01-23T01:13:39.957264
2020-12-09T04:45:17
2020-12-09T04:45:17
319,816,282
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package wuhen.spring.beans.first; // TODO: 2020/7/15 车辆信息 public class Car { private String brand; private String corp; private double price; private int maxSpeed; public Car(String brand, String corp, double price) { this.brand = brand; this.corp = corp; this.price = price; } public Car(String brand, String corp, int maxSpeed) { this.brand = brand; this.corp = corp; this.maxSpeed = maxSpeed; } @Override public String toString() { return "Car[" + "brand='" + brand + '\'' + ", corp='" + corp + '\'' + ", price=" + price + ", maxSpeed=" + maxSpeed + ']'; } }
[ "291663174@qq.com" ]
291663174@qq.com
73d460d5f6714958d15a8dde714637c3b3ebad18
c6422e4e568c356ad5dab2b7d9eff25efe4dfc31
/app/build/generated/not_namespaced_r_class_sources/debug/r/androidx/drawerlayout/R.java
30ee0a4ce967fc874b3ca1eba2aea68a19a9b169
[]
no_license
mhmtkcmn10/CoronaVirusAndroid
3aa2318bc8ad588aa73fdbd42f42cc29e1226196
3983fafa3e14f1cb7d2b1bbecf5b31fc8b9453c0
refs/heads/master
2023-01-19T09:25:30.834856
2020-11-18T11:36:14
2020-11-18T11:36:14
256,017,775
1
0
null
null
null
null
UTF-8
Java
false
false
10,452
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.drawerlayout; public final class R { private R() {} public static final class attr { private attr() {} public static final int alpha = 0x7f020027; public static final int font = 0x7f020093; public static final int fontProviderAuthority = 0x7f020095; public static final int fontProviderCerts = 0x7f020096; public static final int fontProviderFetchStrategy = 0x7f020097; public static final int fontProviderFetchTimeout = 0x7f020098; public static final int fontProviderPackage = 0x7f020099; public static final int fontProviderQuery = 0x7f02009a; public static final int fontStyle = 0x7f02009b; public static final int fontVariationSettings = 0x7f02009c; public static final int fontWeight = 0x7f02009d; public static final int ttcIndex = 0x7f020158; } public static final class color { private color() {} public static final int notification_action_color_filter = 0x7f04004a; public static final int notification_icon_bg_color = 0x7f04004b; public static final int ripple_material_light = 0x7f040057; public static final int secondary_text_default_material_light = 0x7f040059; } public static final class dimen { private dimen() {} public static final int compat_button_inset_horizontal_material = 0x7f050051; public static final int compat_button_inset_vertical_material = 0x7f050052; public static final int compat_button_padding_horizontal_material = 0x7f050053; public static final int compat_button_padding_vertical_material = 0x7f050054; public static final int compat_control_corner_material = 0x7f050055; public static final int compat_notification_large_icon_max_height = 0x7f050056; public static final int compat_notification_large_icon_max_width = 0x7f050057; public static final int notification_action_icon_size = 0x7f050067; public static final int notification_action_text_size = 0x7f050068; public static final int notification_big_circle_margin = 0x7f050069; public static final int notification_content_margin_start = 0x7f05006a; public static final int notification_large_icon_height = 0x7f05006b; public static final int notification_large_icon_width = 0x7f05006c; public static final int notification_main_column_padding_top = 0x7f05006d; public static final int notification_media_narrow_margin = 0x7f05006e; public static final int notification_right_icon_size = 0x7f05006f; public static final int notification_right_side_padding_top = 0x7f050070; public static final int notification_small_icon_background_padding = 0x7f050071; public static final int notification_small_icon_size_as_large = 0x7f050072; public static final int notification_subtext_size = 0x7f050073; public static final int notification_top_pad = 0x7f050074; public static final int notification_top_pad_large_text = 0x7f050075; } public static final class drawable { private drawable() {} public static final int notification_action_background = 0x7f060066; public static final int notification_bg = 0x7f060067; public static final int notification_bg_low = 0x7f060068; public static final int notification_bg_low_normal = 0x7f060069; public static final int notification_bg_low_pressed = 0x7f06006a; public static final int notification_bg_normal = 0x7f06006b; public static final int notification_bg_normal_pressed = 0x7f06006c; public static final int notification_icon_background = 0x7f06006d; public static final int notification_template_icon_bg = 0x7f06006e; public static final int notification_template_icon_low_bg = 0x7f06006f; public static final int notification_tile_bg = 0x7f060070; public static final int notify_panel_notification_icon_bg = 0x7f060071; } public static final class id { private id() {} public static final int action_container = 0x7f07002e; public static final int action_divider = 0x7f070030; public static final int action_image = 0x7f070031; public static final int action_text = 0x7f070037; public static final int actions = 0x7f070038; public static final int async = 0x7f07003d; public static final int blocking = 0x7f070041; public static final int chronometer = 0x7f070049; public static final int forever = 0x7f070059; public static final int icon = 0x7f07005f; public static final int icon_group = 0x7f070060; public static final int info = 0x7f070064; public static final int italic = 0x7f070066; public static final int line1 = 0x7f07006f; public static final int line3 = 0x7f070070; public static final int normal = 0x7f070080; public static final int notification_background = 0x7f070081; public static final int notification_main_column = 0x7f070082; public static final int notification_main_column_container = 0x7f070083; public static final int right_icon = 0x7f07008e; public static final int right_side = 0x7f07008f; public static final int tag_transition_group = 0x7f0700b4; public static final int tag_unhandled_key_event_manager = 0x7f0700b5; public static final int tag_unhandled_key_listeners = 0x7f0700b6; public static final int text = 0x7f0700b7; public static final int text2 = 0x7f0700b8; public static final int time = 0x7f0700bb; public static final int title = 0x7f0700bc; } public static final class integer { private integer() {} public static final int status_bar_notification_info_maxnum = 0x7f080004; } public static final class layout { private layout() {} public static final int notification_action = 0x7f0a0022; public static final int notification_action_tombstone = 0x7f0a0023; public static final int notification_template_custom_big = 0x7f0a0024; public static final int notification_template_icon_group = 0x7f0a0025; public static final int notification_template_part_chronometer = 0x7f0a0026; public static final int notification_template_part_time = 0x7f0a0027; } public static final class string { private string() {} public static final int status_bar_notification_info_overflow = 0x7f0c001d; } public static final class style { private style() {} public static final int TextAppearance_Compat_Notification = 0x7f0d00f1; public static final int TextAppearance_Compat_Notification_Info = 0x7f0d00f2; public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0d00f3; public static final int TextAppearance_Compat_Notification_Time = 0x7f0d00f4; public static final int TextAppearance_Compat_Notification_Title = 0x7f0d00f5; public static final int Widget_Compat_NotificationActionContainer = 0x7f0d0160; public static final int Widget_Compat_NotificationActionText = 0x7f0d0161; } public static final class styleable { private styleable() {} public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 }; 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[] FontFamily = { 0x7f020095, 0x7f020096, 0x7f020097, 0x7f020098, 0x7f020099, 0x7f02009a }; 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, 0x7f020093, 0x7f02009b, 0x7f02009c, 0x7f02009d, 0x7f020158 }; 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; } }
[ "mehmetkocaman6@hotmail.com" ]
mehmetkocaman6@hotmail.com
02731d08d01d36f6aaf448e56fdf37390399a6d1
c3e449dfc2cf74e14c4c75de90f534bec5208276
/weixin-mybatis-generated/src/main/java/org/mybatis/generator/ant/GeneratorAntTask.java
bfe01144ca7a7f28cefc1788bd28936b5a0469f7
[]
no_license
figo050518/weixin_alc
9482290a8273e00b82a032fb0deb0ad94ab6174c
bb671a91a97746440091167f5a25cb01a9251263
refs/heads/master
2022-12-24T20:22:34.457488
2020-09-14T03:23:29
2020-09-14T03:23:29
239,704,349
0
0
null
2022-12-16T11:55:03
2020-02-11T07:43:01
Java
UTF-8
Java
false
false
7,648
java
/* * Copyright 2005 The Apache Software Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, * either express or implied. See the License for the specific language governing permissions and limitations under the * License. */ package org.mybatis.generator.ant; import static org.mybatis.generator.internal.util.StringUtility.stringHasValue; import static org.mybatis.generator.internal.util.messages.Messages.getString; import java.io.File; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Properties; import java.util.Set; import java.util.StringTokenizer; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.PropertySet; import org.mybatis.generator.api.MyBatisGenerator; import org.mybatis.generator.config.Configuration; import org.mybatis.generator.config.xml.ConfigurationParser; import org.mybatis.generator.exception.InvalidConfigurationException; import org.mybatis.generator.exception.XMLParserException; import org.mybatis.generator.internal.DefaultShellCallback; /** * This is an Ant task that will run the generator. The following is a sample Ant script that shows how to run the * generator from Ant: * * <pre> * &lt;project default="genfiles" basedir="."&gt; * &lt;property name="generated.source.dir" value="${basedir}" /&gt; * &lt;target name="genfiles" description="Generate the files"&gt; * &lt;taskdef name="mbgenerator" * classname="org.mybatis.generator.ant.GeneratorAntTask" * classpath="mybatis-generator-core-x.x.x.jar" /&gt; * &lt;mbgenerator overwrite="true" configfile="generatorConfig.xml" verbose="false" &gt; * &lt;propertyset&gt; * &lt;propertyref name="generated.source.dir"/&gt; * &lt;/propertyset&gt; * &lt;/mbgenerator&gt; * &lt;/target&gt; * &lt;/project&gt; * </pre> * * The task requires that the attribute "configFile" be set to an existing XML configuration file. * <p> * The task supports these optional attributes: * <ul> * <li>"overwrite" - if true, then existing Java files will be overwritten. if false (default), then existing Java files * will be untouched and the generator will write new Java files with a unique name</li> * <li>"verbose" - if true, then the generator will log progress messages to the Ant log. Default is false</li> * <li>"contextIds" - a comma delimited list of contaxtIds to use for this run</li> * <li>"fullyQualifiedTableNames" - a comma delimited list of fully qualified table names to use for this run</li> * </ul> * * @author Jeff Butler */ public class GeneratorAntTask extends Task { private String configfile; private boolean overwrite; private PropertySet propertyset; private boolean verbose; private String contextIds; private String fullyQualifiedTableNames; /** * */ public GeneratorAntTask() { super(); } /* * (non-Javadoc) * @see org.apache.tools.ant.Task#execute() */ @Override public void execute() throws BuildException { if (!stringHasValue(configfile)) { throw new BuildException(getString("RuntimeError.0")); //$NON-NLS-1$ } List<String> warnings = new ArrayList<String>(); File configurationFile = new File(configfile); if (!configurationFile.exists()) { throw new BuildException(getString("RuntimeError.1", configfile)); //$NON-NLS-1$ } Set<String> fullyqualifiedTables = new HashSet<String>(); if (stringHasValue(fullyQualifiedTableNames)) { StringTokenizer st = new StringTokenizer(fullyQualifiedTableNames, ","); //$NON-NLS-1$ while (st.hasMoreTokens()) { String s = st.nextToken().trim(); if (s.length() > 0) { fullyqualifiedTables.add(s); } } } Set<String> contexts = new HashSet<String>(); if (stringHasValue(contextIds)) { StringTokenizer st = new StringTokenizer(contextIds, ","); //$NON-NLS-1$ while (st.hasMoreTokens()) { String s = st.nextToken().trim(); if (s.length() > 0) { contexts.add(s); } } } try { Properties p = propertyset == null ? null : propertyset.getProperties(); ConfigurationParser cp = new ConfigurationParser(p, warnings); Configuration config = cp.parseConfiguration(configurationFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(new AntProgressCallback(this, verbose), contexts, fullyqualifiedTables); } catch (XMLParserException e) { for (String error : e.getErrors()) { log(error, Project.MSG_ERR); } throw new BuildException(e.getMessage()); } catch (SQLException e) { throw new BuildException(e.getMessage()); } catch (IOException e) { throw new BuildException(e.getMessage()); } catch (InvalidConfigurationException e) { for (String error : e.getErrors()) { log(error, Project.MSG_ERR); } throw new BuildException(e.getMessage()); } catch (InterruptedException e) { // ignore (will never happen with the DefaultShellCallback) ; } catch (Exception e) { e.printStackTrace(); throw new BuildException(e.getMessage()); } for (String error : warnings) { log(error, Project.MSG_WARN); } } /** * @return Returns the configfile. */ public String getConfigfile() { return configfile; } /** * @param configfile The configfile to set. */ public void setConfigfile(String configfile) { this.configfile = configfile; } /** * @return Returns the overwrite. */ public boolean isOverwrite() { return overwrite; } /** * @param overwrite The overwrite to set. */ public void setOverwrite(boolean overwrite) { this.overwrite = overwrite; } public PropertySet createPropertyset() { if (propertyset == null) { propertyset = new PropertySet(); } return propertyset; } public boolean isVerbose() { return verbose; } public void setVerbose(boolean verbose) { this.verbose = verbose; } public String getContextIds() { return contextIds; } public void setContextIds(String contextIds) { this.contextIds = contextIds; } public String getFullyQualifiedTableNames() { return fullyQualifiedTableNames; } public void setFullyQualifiedTableNames(String fullyQualifiedTableNames) { this.fullyQualifiedTableNames = fullyQualifiedTableNames; } }
[ "39601808@qq.com" ]
39601808@qq.com
1803cdefef237107b63cddbc1d6383dc9f3eab6a
3240347837b586b85306cdb61d46c2aac4781dcd
/2.JavaCore/src/com/javarush/task/task14/task1408/Solution.java
bc992cc4a213c9b4950fed4152d4c4e683318918
[]
no_license
TjavaistT/JavaRushTasks
0ad6e37b7bde4e69c19e53ca90128ad533158e07
af02c24fa548b12fca2af3bae67341e75f2c7075
refs/heads/master
2020-06-04T14:03:12.773981
2019-09-30T09:18:44
2019-09-30T09:18:44
192,051,471
0
0
null
null
null
null
UTF-8
Java
false
false
816
java
package com.javarush.task.task14.task1408; /* Куриная фабрика */ public class Solution { public static void main(String[] args) { Hen hen = HenFactory.getHen(Country.BELARUS); if(hen != null) { hen.getCountOfEggsPerMonth(); } } static class HenFactory { static Hen getHen(String country) { Hen hen = null; if(country == Country.RUSSIA) { hen = new RussianHen(); } else if (country == Country.UKRAINE){ hen = new UkrainianHen(); } else if (country == Country.MOLDOVA){ hen = new MoldovanHen(); } else if (country == Country.BELARUS){ hen = new BelarusianHen(); } return hen; } } }
[ "TjavaistT@gmail.com" ]
TjavaistT@gmail.com
0bc2908841854ddd17becc8e48dd32a8cf34567c
f5f510662b21a09928cdb28cd7d937d3d803f181
/src/gamepack/AudioPlayer.java
8db107e8291f8530949aade27e772f6dc9d8ff86
[]
no_license
JoseUTorres/Wave
e24c34bc0817d7bdc4d209e7b9f815a5afdb36eb
5f7b5f9da8ec6cfce6b6c29aeeb092704fca2e9d
refs/heads/main
2023-06-19T16:10:12.043747
2021-07-07T05:36:24
2021-07-07T05:36:24
383,684,195
0
0
null
null
null
null
UTF-8
Java
false
false
756
java
package gamepack; import java.util.HashMap; import java.util.Map; import org.newdawn.slick.Music; import org.newdawn.slick.SlickException; import org.newdawn.slick.Sound; public class AudioPlayer { public static Map<String, Sound> soundMap = new HashMap<String, Sound>(); public static Map<String, Music> musicMap = new HashMap<String, Music>(); public static void load() { try { soundMap.put("menu_sound", new Sound("res/click sound.wav")); musicMap.put("music", new Music("res/SMW Background Music.ogg")); } catch (SlickException e) { e.printStackTrace(); } } public static Music getMusic(String key) { return musicMap.get(key); } public static Sound getSound(String key) { return soundMap.get(key); } }
[ "73760867+JoseUTorres@users.noreply.github.com" ]
73760867+JoseUTorres@users.noreply.github.com
eeba2d53681fb6cc96bc1a359263518c22d824ee
a9b77c888bbec0bb4da733e5322562ac6a61bbf3
/src/Problems51_60/Problem59.java
d313f28ac41cb7571538c6263dbb96fb2c6f3057
[]
no_license
M4thG33k/ProjectEuler
9cb5326e2700e43323a90b2c4c2655d13035a8ca
0e1a9d7e38e395c678a3b517a0e6efac6247c389
refs/heads/master
2021-01-01T19:47:47.612822
2018-05-08T21:19:47
2018-05-08T21:19:47
98,684,070
0
0
null
null
null
null
UTF-8
Java
false
false
3,367
java
package Problems51_60; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class Problem59 { private static int m1 = (int)'a'; private static int M1 = (int)'z'; private static int m2 = (int)'A'; private static int M2 = (int)'Z'; private static Set<Integer> allowed_punctuation = new HashSet<>(); private static long total; public static void main(String[] args) { for (char c : new char[]{' ', ',', '.', '\'', '"', '(', ')', '?', '!', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';'}) { allowed_punctuation.add((int)c); } try { List<Integer> values = new ArrayList<>(); BufferedReader reader = new BufferedReader(new FileReader("p059_cipher.txt")); for (String val : reader.readLine().split(",")) { values.add(Integer.parseInt(val)); } for (int a : getValid(values.get(0))) { for (int b : getValid(values.get(1))) { for (int c : getValid(values.get(2))) { StringBuilder builder = new StringBuilder(); builder.append((char)a); builder.append((char)b); builder.append((char)c); String message = decrypt(new int[]{a, b, c}, values); if (!message.equals("")) { System.out.println("Password: " + builder.toString()); System.out.println(total); System.out.println(message); } } } } reader.close(); } catch (Exception e) { e.printStackTrace(); } } private static String decrypt(int[] password, List<Integer> code) { int index = 0; total = 0; StringBuilder builder = new StringBuilder(); int eCount = 0; for (int c : code) { int val = c ^ password[index]; total += val; if (isValidChar(val)) { if (val == (int)'e') { eCount += 1; } builder.append((char) val); index = (index + 1) % 3; } } String s = builder.toString(); // Is is the most commonly used letter in the English language. This parameter was changed until // only one result was found. if (((double)eCount) / s.length() < 0.099) { return ""; } return s; } private static List<Integer> getValid(int value) { List<Integer> valids= new ArrayList<>(); for (int i=m1; i<=M1; i++) { int temp = value^i; if (isValidChar(temp)) { valids.add(i); } } return valids; } private static boolean isValidChar(int val) { return allowed_punctuation.contains(val) || (((m1 <= val) && (val <= M1)) || ((m2 <= val) && (val <= M2))); } }
[ "pepethemathgeek@gmail.com" ]
pepethemathgeek@gmail.com
7547e2497019016c48349c6b7d11517f92a8357a
c827bfebbde82906e6b14a3f77d8f17830ea35da
/Development3.0/TeevraServer/platform/businessobject/src/main/java/com/headstrong/teevra_fixml_1_0/DiscretionInstructionsBlockT.java
52417bd67b0f5180769b603e8810a05599caae0d
[]
no_license
GiovanniPucariello/TeevraCore
13ccf7995c116267de5c403b962f1dc524ac1af7
9d755cc9ca91fb3ebc5b227d9de6bcf98a02c7b7
refs/heads/master
2021-05-29T18:12:29.174279
2013-04-22T07:44:28
2013-04-22T07:44:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,913
java
package com.headstrong.teevra_fixml_1_0; import java.math.BigDecimal; import java.math.BigInteger; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for DiscretionInstructions_Block_t complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="DiscretionInstructions_Block_t"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;group ref="{http://www.headstrong.com/TEEVRA-FIXML-1-0}DiscretionInstructionsElements"/> * &lt;/sequence> * &lt;attGroup ref="{http://www.headstrong.com/TEEVRA-FIXML-1-0}DiscretionInstructionsAttributes"/> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DiscretionInstructions_Block_t") public class DiscretionInstructionsBlockT { @XmlAttribute(name = "DsctnInst") protected String dsctnInst; @XmlAttribute(name = "OfstValu") protected BigDecimal ofstValu; @XmlAttribute(name = "MoveTyp") protected BigInteger moveTyp; @XmlAttribute(name = "OfstTyp") protected BigInteger ofstTyp; @XmlAttribute(name = "LimitTyp") protected BigInteger limitTyp; @XmlAttribute(name = "RndDir") protected BigInteger rndDir; @XmlAttribute(name = "Scope") protected BigInteger scope; /** * Gets the value of the dsctnInst property. * * @return * possible object is * {@link String } * */ public String getDsctnInst() { return dsctnInst; } /** * Sets the value of the dsctnInst property. * * @param value * allowed object is * {@link String } * */ public void setDsctnInst(String value) { this.dsctnInst = value; } /** * Gets the value of the ofstValu property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getOfstValu() { return ofstValu; } /** * Sets the value of the ofstValu property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setOfstValu(BigDecimal value) { this.ofstValu = value; } /** * Gets the value of the moveTyp property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getMoveTyp() { return moveTyp; } /** * Sets the value of the moveTyp property. * * @param value * allowed object is * {@link BigInteger } * */ public void setMoveTyp(BigInteger value) { this.moveTyp = value; } /** * Gets the value of the ofstTyp property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getOfstTyp() { return ofstTyp; } /** * Sets the value of the ofstTyp property. * * @param value * allowed object is * {@link BigInteger } * */ public void setOfstTyp(BigInteger value) { this.ofstTyp = value; } /** * Gets the value of the limitTyp property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getLimitTyp() { return limitTyp; } /** * Sets the value of the limitTyp property. * * @param value * allowed object is * {@link BigInteger } * */ public void setLimitTyp(BigInteger value) { this.limitTyp = value; } /** * Gets the value of the rndDir property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getRndDir() { return rndDir; } /** * Sets the value of the rndDir property. * * @param value * allowed object is * {@link BigInteger } * */ public void setRndDir(BigInteger value) { this.rndDir = value; } /** * Gets the value of the scope property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getScope() { return scope; } /** * Sets the value of the scope property. * * @param value * allowed object is * {@link BigInteger } * */ public void setScope(BigInteger value) { this.scope = value; } }
[ "ritwik.bose@headstrong.com" ]
ritwik.bose@headstrong.com
9c2b3d4c077730dabf7ec3dcb720c401d7ab2974
b1de410e4e83a7b80f9ef51fc0fe4abda913c550
/src/main/java/me/draimlib/updater/VersionType.java
261fd30b9cc2e8974182da6947e5716db338cbdb
[ "Apache-2.0" ]
permissive
DraimCiDo/DraimLib
5292115cdbd6b20ece238de37797cab4519f18e4
747c8a0614247ca4bf462c43c1aa17034e74ee64
refs/heads/master
2023-06-30T02:00:45.007421
2021-08-04T20:24:48
2021-08-04T20:24:48
386,016,971
0
0
null
null
null
null
UTF-8
Java
false
false
656
java
package me.draimlib.updater; public enum VersionType { PREALPHA("pre-alpha", 0, false), ALPHA("alpha", 1, false), BETA("beta", 2, false), RC("rc", 3, false), STABLE("stable", 4, true), RELEASE("release", 5, true), SNAPSHOT("snapshot", 6, false); String name; int level; boolean stable; VersionType(String name, int level, boolean stable) { this.name = name; this.level = level; this.stable = stable; } public String getName() { return name; } public int getLevel() { return level; } public boolean isStable() { return stable; } }
[ "danilaorlov4@gmail.com" ]
danilaorlov4@gmail.com
68821fef74f4ca3dd6131fb7535701f59ae3861c
759030c78763943495f0bb5b82c8f157aea03571
/FundamentosJava/CreacionClasesObjetos/src/PersonaPrueba.java
17a33c3df5aadb665fdc93d65e26cb1d3b28ded5
[]
no_license
Arielgmv/universidad_java
9c1019d29bf33434fe22741c2611509cb2a447ea
2612e933d185dc486389da1d86224d179ebc3da3
refs/heads/master
2020-07-21T11:25:42.064025
2020-02-13T00:41:19
2020-02-13T00:41:19
206,848,571
0
0
null
null
null
null
UTF-8
Java
false
false
769
java
public class PersonaPrueba { public static void main(String[] args) { //Creación de un objeto Persona persona1 = new Persona(); //Llamando a un método del objeto creado System.out.println("Valores por default del objeto persona"); persona1.desplegarNombre(); //Modificar valores del objeto creado persona1.nombre = "Ariel"; persona1.apellidoPaterno = "Muñoz"; persona1.apellidoMaterno = "Villegas"; persona1.desplegarNombre(); //Creación de un segundo objeto Persona persona2 = new Persona(); persona2.nombre = "Oswaldo"; persona2.apellidoPaterno = "Soliz"; persona2.apellidoMaterno = "Villegas"; persona2.desplegarNombre(); } }
[ "ariel.munoz.villegas@gmail.com" ]
ariel.munoz.villegas@gmail.com
7eb2873083e0b20188549e343818d3021faa00df
47404b0fe883db0f7a3725ebf9121978531b3e91
/src/main/java/ca/uwaterloo/cs/bigdata2016w/xeniaqian94/assignment4/SequentialPageRank.java
bdaa1a6904bbcf7a7627faee8bad0c95eadfd3c7
[]
no_license
rosequ/bigdata2016w
606e341d80bd231c7608a712985f20a5e755b790
f2b4b03e9802aa4e23fbf9547459fad01cab5514
refs/heads/master
2021-01-11T17:27:26.899301
2016-04-05T18:09:13
2016-04-05T18:09:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,602
java
package ca.uwaterloo.cs.bigdata2016w.xeniaqian94.assignment4; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.PriorityQueue; import java.util.Set; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.GnuParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.Options; import org.apache.commons.cli.ParseException; import org.apache.hadoop.util.ToolRunner; import edu.uci.ics.jung.algorithms.cluster.WeakComponentClusterer; import edu.uci.ics.jung.algorithms.importance.Ranking; import edu.uci.ics.jung.algorithms.scoring.PageRank; import edu.uci.ics.jung.graph.DirectedSparseGraph; /** * <p> * Program that computes PageRank for a graph using the <a * href="http://jung.sourceforge.net/">JUNG</a> package (2.0 alpha1). Program takes two command-line * arguments: the first is a file containing the graph data, and the second is the random jump * factor (a typical setting is 0.15). * </p> * * <p> * The graph should be represented as an adjacency list. Each line should have at least one token; * tokens should be tab delimited. The first token represents the unique id of the source node; * subsequent tokens represent its link targets (i.e., outlinks from the source node). For * completeness, there should be a line representing all nodes, even nodes without outlinks (those * lines will simply contain one token, the source node id). * </p> * * @author Jimmy Lin */ public class SequentialPageRank { private SequentialPageRank() {} private static final String INPUT = "input"; private static final String JUMP = "jump"; @SuppressWarnings({ "static-access" }) public static void main(String[] args) throws IOException { Options options = new Options(); options.addOption(OptionBuilder.withArgName("path").hasArg() .withDescription("input path").create(INPUT)); options.addOption(OptionBuilder.withArgName("val").hasArg() .withDescription("random jump factor").create(JUMP)); CommandLine cmdline = null; CommandLineParser parser = new GnuParser(); try { cmdline = parser.parse(options, args); } catch (ParseException exp) { System.err.println("Error parsing command line: " + exp.getMessage()); System.exit(-1); } if (!cmdline.hasOption(INPUT)) { System.out.println("args: " + Arrays.toString(args)); HelpFormatter formatter = new HelpFormatter(); formatter.setWidth(120); formatter.printHelp(SequentialPageRank.class.getName(), options); ToolRunner.printGenericCommandUsage(System.out); System.exit(-1); } String infile = cmdline.getOptionValue(INPUT); float alpha = cmdline.hasOption(JUMP) ? Float.parseFloat(cmdline.getOptionValue(JUMP)) : 0.15f; int edgeCnt = 0; DirectedSparseGraph<String, Integer> graph = new DirectedSparseGraph<String, Integer>(); BufferedReader data = new BufferedReader(new InputStreamReader(new FileInputStream(infile))); String line; while ((line = data.readLine()) != null) { line.trim(); String[] arr = line.split("\\t"); for (int i = 1; i < arr.length; i++) { graph.addEdge(new Integer(edgeCnt++), arr[0], arr[i]); } } data.close(); WeakComponentClusterer<String, Integer> clusterer = new WeakComponentClusterer<String, Integer>(); Set<Set<String>> components = clusterer.transform(graph); int numComponents = components.size(); System.out.println("Number of components: " + numComponents); System.out.println("Number of edges: " + graph.getEdgeCount()); System.out.println("Number of nodes: " + graph.getVertexCount()); System.out.println("Random jump factor: " + alpha); // Compute PageRank. PageRank<String, Integer> ranker = new PageRank<String, Integer>(graph, alpha); ranker.evaluate(); // Use priority queue to sort vertices by PageRank values. PriorityQueue<Ranking<String>> q = new PriorityQueue<Ranking<String>>(); int i = 0; for (String pmid : graph.getVertices()) { q.add(new Ranking<String>(i++, ranker.getVertexScore(pmid), pmid)); } // Print PageRank values. System.out.println("\nPageRank of nodes, in descending order:"); Ranking<String> r = null; while ((r = q.poll()) != null) { System.out.println(String.format("%.5f %s", Math.log(r.rankScore), r.getRanked())); } } }
[ "xeniaqian94@gmail.com" ]
xeniaqian94@gmail.com
a82827782da957d8f9caec59e2a25bcd0738c70d
a44c679d69949df20f87cf6dd96994446830f897
/src/main/java/org/iff/infra/util/ScrollableByteArrayOutputStream.java
09d708ac12073c687e37637b24b318247ebfcf6d
[ "MIT" ]
permissive
huansinho/tc-util-project
3e13405625ed2cfad7f13381e119400ff7ad707f
ca7296dd326e312c7761b2f055f0e32f66a80847
refs/heads/master
2020-12-03T10:38:25.505317
2015-04-24T07:56:46
2015-04-24T07:56:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,132
java
/******************************************************************************* * Copyright (c) 2015-2-17 @author <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a>. * All rights reserved. * * Contributors: * <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a> - initial API and implementation ******************************************************************************/ package org.iff.infra.util; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.util.Arrays; /** * A scroll-able byte array output stream for holding the recently content, specially for console output. * double buffer design to reduce the array copy times. * @author <a href="mailto:iffiff1@hotmail.com">Tyler Chen</a> * @since 2015-2-17 */ public class ScrollableByteArrayOutputStream extends ByteArrayOutputStream { public ScrollableByteArrayOutputStream() { this(1024 * 1024 * 10 * 2);//10Mbytes // * 2 for double buffer } public ScrollableByteArrayOutputStream(int size) { super(size * 2);// * 2 for double buffer } public synchronized void write(byte[] b, int off, int len) { if (len > super.buf.length) {// input length more than buf length super.count = 0; super.write(b, off + (len - super.buf.length), super.buf.length); } else if (super.count + len > super.buf.length) {// content length and input length more than buf length, remove old data byte[] bs = Arrays.copyOfRange(super.buf, super.count - (super.buf.length - len), super.count); System.arraycopy(bs, 0, super.buf, 0, bs.length); super.count = bs.length; super.write(b, off, len); } else { super.write(b, off, len); } } public synchronized void write(int b) { if (super.count + 1 > super.buf.length) { byte[] bs = Arrays.copyOfRange(super.buf, super.count - (super.buf.length - 1), super.count); System.arraycopy(bs, 0, super.buf, 0, bs.length); super.count = bs.length; super.write(b); } else { super.write(b); } } public synchronized int size() { return super.count > super.buf.length / 2 ? super.buf.length / 2 : super.count; } public synchronized byte[] toByteArray() { return Arrays.copyOfRange(super.buf, super.count > super.buf.length / 2 ? super.count - super.buf.length / 2 : 0, super.count); } public synchronized String toString() { return new String(super.buf, super.count > super.buf.length / 2 ? super.count - super.buf.length / 2 : 0, super.count > super.buf.length / 2 ? super.buf.length / 2 : super.count); } @Deprecated public synchronized String toString(int hibyte) { return new String(super.buf, hibyte, super.count > super.buf.length / 2 ? super.count - super.buf.length / 2 : 0, super.count > super.buf.length / 2 ? super.buf.length / 2 : super.count); } public synchronized String toString(String charsetName) throws UnsupportedEncodingException { return new String(super.buf, super.count > super.buf.length / 2 ? super.count - super.buf.length / 2 : 0, super.count > super.buf.length / 2 ? super.buf.length / 2 : super.count, charsetName); } public synchronized void writeTo(OutputStream out) throws IOException { out.write(super.buf, super.count > super.buf.length / 2 ? super.count - super.buf.length / 2 : 0, super.count > super.buf.length / 2 ? super.buf.length / 2 : super.count); } public static void main(String[] args) { ScrollableByteArrayOutputStream baos = new ScrollableByteArrayOutputStream(3); baos.write(new byte[] { 'a', 'b' }, 0, 2); System.out.println(baos.toString() + ", size:" + baos.size() + "----->expect: ab"); baos.write(new byte[] { 'a', 'b' }, 0, 2); System.out.println(baos.toString() + ", size:" + baos.size() + "----->expect: bab"); baos.write('c'); System.out.println(baos.toString() + ", size:" + baos.size() + "----->expect: abc"); baos.write(new byte[] { 'a', 'b', 'c', 'd' }, 0, 4); System.out.println(baos.toString() + ", size:" + baos.size() + "----->expect: bcd"); } }
[ "iffiff1@gmail.com" ]
iffiff1@gmail.com
803d11032ea66cd15de628c5288fe6666aea075c
6253283b67c01a0d7395e38aeeea65e06f62504b
/decompile/app/Contacts/src/main/java/com/android/contacts/hap/rcs/activities/RcsContactMultiSelectionActivityHelp.java
0465beaf5c00abca5572f19dfaf075359d32aec0
[]
no_license
sufadi/decompile-hw
2e0457a0a7ade103908a6a41757923a791248215
4c3efd95f3e997b44dd4ceec506de6164192eca3
refs/heads/master
2023-03-15T15:56:03.968086
2017-11-08T03:29:10
2017-11-08T03:29:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,530
java
package com.android.contacts.hap.rcs.activities; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.telephony.PhoneNumberUtils; import com.android.contacts.hap.EmuiFeatureManager; import com.android.contacts.hap.activities.ContactMultiSelectionActivity; import com.android.contacts.hap.list.ContactDataMultiSelectFragment; import com.android.contacts.hap.rcs.RcsContactsUtils; import com.google.android.gms.location.places.Place; import java.util.ArrayList; import java.util.HashMap; public class RcsContactMultiSelectionActivityHelp { private boolean isRcsOn = EmuiFeatureManager.isRcsFeatureEnable(); private int mExsitingGroupSize; private int mFromActivity; private ArrayList<String> mMemberListFromForward; private Object mSelectedDataUriLock = new Object(); private HashMap<String, String> mSelectedPersonMap = new HashMap(); public HashMap<String, String> getSelectedPersonMap() { return this.isRcsOn ? this.mSelectedPersonMap : null; } public void setSelectedPersonMap(HashMap<String, String> map) { if (this.isRcsOn) { this.mSelectedPersonMap = map; } } public void clearSelectedPersonMap() { if (this.isRcsOn && this.mSelectedPersonMap != null) { this.mSelectedPersonMap.clear(); this.mSelectedPersonMap = null; } } public boolean configureListFragment(Activity activity, int actionCode) { if (!this.isRcsOn) { return false; } switch (actionCode) { case Place.TYPE_MEAL_DELIVERY /*60*/: ((ContactMultiSelectionActivity) activity).mMultiSelectFragment = (ContactDataMultiSelectFragment) ((ContactMultiSelectionActivity) activity).getFragmentToLoad(); return true; default: return false; } } public void addUserToMemberList(Context context, Intent intent) { if (this.isRcsOn) { this.mFromActivity = intent.getIntExtra("from_activity_key", -1); if (RcsContactsUtils.isValidFromActivity(this.mFromActivity)) { this.mExsitingGroupSize = intent.getIntExtra("member_size_of_exsiting_group", 0); this.mMemberListFromForward = intent.getStringArrayListExtra("list_phonenumber_from_forward"); if (this.mMemberListFromForward == null) { this.mMemberListFromForward = new ArrayList(); } String curLoginUserNumber = RcsContactsUtils.getCurrentUserNumber(); if (curLoginUserNumber != null) { this.mMemberListFromForward.add(PhoneNumberUtils.normalizeNumber(curLoginUserNumber)); } } } } public int getFromActivity() { if (this.isRcsOn) { return this.mFromActivity; } return -1; } public ArrayList<String> getMemberListFromForward() { if (this.isRcsOn) { return this.mMemberListFromForward; } return null; } public int getExsitedCallLogCount(ContactMultiSelectionActivity activity) { if (!this.isRcsOn || activity == null) { return 0; } int count = 0; for (Uri uri : activity.mSelectedDataUris) { if (uri.toString().startsWith("content://call_log/calls")) { count++; } } return count; } }
[ "liming@droi.com" ]
liming@droi.com
01008924eefec0909bf4c68b22084c4fdd03ad84
134a79ebfa13324b1f4d8af022ab5cde743a58c3
/AoC2020_12/src/net/j7k/aoc2020/Ship.java
f0e669fa39b2d7416936838a2f1e0121f9e39577
[]
no_license
J7K/AoC2020
9164ece264d45592f303e18d9177f6e664798625
921447eea3110d258a8c7a189a6a5a2b1a0536ec
refs/heads/master
2023-01-29T13:07:56.361210
2020-12-12T13:37:04
2020-12-12T13:37:04
317,838,358
0
0
null
null
null
null
UTF-8
Java
false
false
1,059
java
package net.j7k.aoc2020; public class Ship { public int heading=0; int x=0; int y=0; void execute(Order order) { switch (order.inst) { case Order.NORTH: y -= order.operand; break; case Order.EAST: x += order.operand; break; case Order.SOUTH: y += order.operand; break; case Order.WEST: x -= order.operand; break; case Order.RIGHT: heading = (heading - order.operand + 360) % 360; break; case Order.LEFT: heading += order.operand; heading %= 360; break; case Order.FORWARD: switch (heading) { case 0 : execute(new Order(Order.EAST, order.operand)); break; case 90 : execute(new Order(Order.NORTH, order.operand)); break; case 180 : execute(new Order(Order.WEST, order.operand)); break; case 270 : execute(new Order(Order.SOUTH, order.operand)); break; } break; } } public int L1DistToOrigin() { return Math.abs(x)+Math.abs(y); } }
[ "do.not@use.net" ]
do.not@use.net
378b4ac67ba042a6043b89757246893966bb0598
a2b99010213035cab937e2bd73b1a15f8cb0cef7
/src/main/java/optimistic/controller/PersonController.java
08656f91cb28ffb6d01058ec0a8b8e42a6c48504
[]
no_license
maciejgawlowski/optimistic-locking-spring-boot-example
7fadbb913f24fc8f9ce57c48bbd3326711b7bfc1
0e5d7aa07990dfb572e6f8fc3d4a76a8a5e94324
refs/heads/master
2020-12-20T06:43:55.794191
2020-01-24T12:37:19
2020-01-24T12:37:19
235,991,677
0
0
null
null
null
null
UTF-8
Java
false
false
1,766
java
package optimistic.controller; import lombok.*; import optimistic.domain.*; import optimistic.dto.*; import optimistic.service.*; import org.springframework.http.*; import org.springframework.web.bind.annotation.*; import java.util.*; import static org.springframework.http.HttpStatus.*; import static org.springframework.http.MediaType.*; @RestController @RequiredArgsConstructor @RequestMapping("/persons") public class PersonController { private final PersonService service; @GetMapping(produces = APPLICATION_JSON_VALUE) public ResponseEntity<List<Person>> getPersons() { return ResponseEntity.ok(service.getAll()); } @GetMapping(value = "/{id}", produces = APPLICATION_JSON_VALUE) public ResponseEntity<Person> getPerson(@PathVariable("id") Long id) { Person person = service.get(id); return ResponseEntity.ok() .eTag(person.getVersion().toString()) .body(person); } @ResponseStatus(CREATED) @PostMapping(consumes = APPLICATION_JSON_VALUE, produces = APPLICATION_JSON_VALUE) public ResponseEntity<Person> createPerson(@RequestBody PersonDTO dto) { return ResponseEntity.ok(service.create(dto)); } @ResponseStatus(OK) @PutMapping(value = "/{id}", produces = APPLICATION_JSON_VALUE, consumes = APPLICATION_JSON_VALUE) public ResponseEntity<Person> updatePerson(@RequestHeader("If-Match") String eTag, @PathVariable("id") Long id, @RequestBody PersonDTO dto) { return ResponseEntity.ok(service.update(id, dto, eTag)); } @ResponseStatus(NO_CONTENT) @DeleteMapping("/{id}") public void deletePerson(@RequestHeader("If-Match") String eTag, @PathVariable("id") Long id) { service.delete(id, eTag); } }
[ "maciej.gawlowski@pansa.pl" ]
maciej.gawlowski@pansa.pl
e87e7bb661c3ba84ca4d34c0cbc62629da7d6da3
2cc1d946a622fbf687aae6c3b7993bd8f82b7812
/src/main/java/com/zjzyc/httpRange/HttpDownloadSplitterImpl.java
6fa29379e3aeb2e13973b6f206d9b6c45e8ed4ef
[]
no_license
tamerEle/springbootdemo
b6eb4c4f0fa3f2699f03180c2cbbc9c512500f4e
8ecc442f409783a148b5926bcbcadf2ec383c0a1
refs/heads/master
2021-06-12T15:43:27.667652
2020-01-17T03:55:47
2020-01-17T03:55:47
128,748,717
0
0
null
2020-10-12T22:03:02
2018-04-09T09:38:11
Java
UTF-8
Java
false
false
1,728
java
package com.zjzyc.httprange; public class HttpDownloadSplitterImpl implements com.zjzyc.httpRange.HttpDownloadSplitter { private String localFilePath; private String downloadFileUrl; private int threadNum; private int beginIndex; private int length; /** * * @param localFilePath the position that the file need download to * @param downloadFileUrl need to download file's URL * @param threadNum use how many thread to download the online file * @param length the length that every packet to download * @param beginIndex the begin index in the file that we need to start download * for the @localFilePath and @downloadFileUrl if in the methods we not supply, the program will use the member * offer by the object. for the @thread and @length ,if we just offered the length or thread ,the program will splitter * the file to download by the single parameter,else if we offer the parameter both ,the wo just start the a few threads that * the number offered by threadNum(ps. the number of threads is meaning to the size of thread pool). * */ @Override public void download(String localFilePath, String downloadFileUrl, int threadNum, int length, int beginIndex) { } @Override public void download(String localFilePath, String downloadFileUrl, int threadNum, int beginIndex) { } @Override public void download(String localFilePath, String downloadFileUrl) { } @Override public void download(String localFilePath, String downloadFileUrl, int threadNum) { } @Override public void download(int threadNum, int length, int beginIndex) { } }
[ "610415868@qq.com" ]
610415868@qq.com
8ca5c60eca9258d61c9efeafdb7c1741fac64309
436c061840f70282c16479cfa49497bfd5cc1606
/tools/io/BitMatrixNetworkFile.java
69eee03a991156a0845f52cea19437b01f867928
[]
no_license
sahoo00/BooleanNet
c5fec21ba65b93547c845e395be5b7a4eb05ccf7
d4edfe89c862ecc2764d2cb501167a58b544c1de
refs/heads/master
2021-06-09T01:59:06.783873
2018-11-30T05:23:49
2018-11-30T05:23:49
159,763,385
4
0
null
null
null
null
UTF-8
Java
false
false
6,631
java
/* Copyright (c) 2006, the Board of Trustees of Leland Stanford Junior University. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Stanford University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* Author: Debashis Sahoo <sahoo@stanford.edu> */ package tools.io; import java.io.*; import java.util.*; public class BitMatrixNetworkFile implements NetworkFile { static byte VERSION_MAJOR = 1; static byte VERSION_MINOR = 0; static byte MAJIC = 0x55; BitMatrixFile file_; long offset_; byte magic_; byte major_; byte minor_; long startPtr_; int num_; int numBits_; Vector<String> low_; Vector<String> high_; Vector<String> balanced_; public BitMatrixNetworkFile(String filename, int mode) throws IOException { file_ = new BitMatrixFile(filename, mode); offset_ = 0; } public BitMatrixNetworkFile(String filename) throws IOException { file_ = new BitMatrixFile(filename); offset_ = 0; } public int getType() { return NetworkFile.FILE_1_0; } public void writeHeader() throws IOException { file_.writeByte(MAJIC); file_.writeByte(VERSION_MAJOR); file_.writeByte(VERSION_MINOR); offset_ = file_.getFilePointer(); // Index to low, high, balanced and matrix for (int i =0; i < 10; i++) { file_.writeInt(0); } } public void writeList(String name, Vector<String> list) throws IOException { long ptr = file_.getFilePointer(); file_.writeIntAt(offset_, (int)ptr); offset_ = file_.getFilePointer(); file_.seek(ptr); file_.writeLengthPrefixString(name); file_.writeInt(list.size()); Enumeration<String> e = list.elements(); while (e.hasMoreElements()) { file_.writeLengthPrefixString(e.nextElement()); } } public void startMatrix(int num, int numbits) throws IOException { if (file_.getMode() != BitMatrixFile.READMODE) { long ptr = file_.getFilePointer(); file_.writeIntAt(offset_, (int)ptr); file_.writeInt(num); file_.writeInt(numbits); offset_ = file_.getFilePointer(); file_.seek(ptr); } file_.startMatrix(num, numbits); } public void setBitMatrix(int a, int b, int code) throws IOException { file_.setBitMatrix(a, b, code); } public int readCode(int i, int j) throws IOException { return file_.readCode(i, j); } public static int contraPositive(int code) { switch(code) { case 2: return 3; case 3: return 2; default: return code; } } public void fillLowerTriangle() throws IOException { if (file_.getMode() == BitMatrixFile.WRITEMODE) { System.out.println("Finishing lower triangular matrix"); for (int i =0; i < file_.getNum(); i++) { for (int j = i+1; j < file_.getNum(); j++) { int code = readCode(i, j); setBitMatrix(j, i, contraPositive(code)); } } } } public void close() throws IOException { file_.finishMatrix(); file_.close(); } public void print(String a) { System.out.print(a); } public void println(String a) { System.out.println(a); } public Vector<String> readList(int num) throws IOException { Vector<String> res = new Vector<String>(); long ptr = file_.readIntAt(3 + num * 4); file_.seek(ptr); String name = file_.readLengthPrefixString(); int size = file_.readInt(); for (int i =0; i < size; i++) { String l = file_.readLengthPrefixString(); res.add(l); } return res; } public void printList(String name, Vector<String> list) throws IOException { int size = list.size(); println(name + " (" + size + "):"); for (int i =0; i < size; i++) { String l = list.get(i); print(l + ", "); if ((i % 5) == 0) { println(""); } } println(""); } public void readMatrix(Vector<String> balanced) throws IOException { for (int i =0; i < num_; i++) { for (int j = 0; j < num_; j++) { int code = readCode(i, j); if (code > 0) { print("Found : " + code + "\t" + i + "\t" + j); println("\t" + balanced.get(i) + "\t" + balanced.get(j)); } } } } public void readMatrixHeader() throws IOException { file_.seek(0); magic_ = file_.readByte(); major_ = file_.readByte(); minor_ = file_.readByte(); low_ = readList(0); high_ = readList(1); balanced_ = readList(2); startPtr_ = file_.readIntAt(3 + 3 * 4); num_ = file_.readInt(); numBits_ = file_.readInt(); file_.seek(startPtr_); file_.startMatrix(num_, numBits_); } public void readMatrixFile() throws IOException { readMatrixHeader(); println("Magic : " + magic_); println("Major : " + major_); println("Minor : " + minor_); printList("low", low_); printList("high", high_); printList("balanced", balanced_); readMatrix(balanced_); } public void writePair(int a, int b, int code, double val, String pair) throws IOException { } public static void main(String args[]) throws Exception { if (args.length < 1) { System.out.println("Arguments: <file>"); System.exit(1); } BitMatrixNetworkFile file = new BitMatrixNetworkFile(args[0], BitMatrixFile.READMODE); file.readMatrixFile(); } }
[ "dsahoo@ucsd.edu" ]
dsahoo@ucsd.edu
b854f148d8ff447a02cc68789a48c16fe483c3fa
5c1a9d4ae1715ce4bf07e7381f1c4af1ad89ee8e
/src/BlockList.java
aea095aa30bdab34b81c530c0b9c80851163d50c
[]
no_license
MatWhiteside/SpaceInvaders
bc2b423b1107aaf44efdb19a371d138359d98426
671d6e0db88a18e82b02fb70641b0951bb1bac4f
refs/heads/master
2020-03-18T14:06:24.911953
2018-05-25T09:24:19
2018-05-25T09:24:19
134,829,684
0
0
null
null
null
null
UTF-8
Java
false
false
1,015
java
import java.util.ArrayList; /** * @author Matthew */ /** * Contains a list of all blocks on the board. */ public class BlockList { ArrayList<Block> blocks; /** * Initialise an empty list of blocks. */ public BlockList() { blocks = new ArrayList<>(); } /** * Adds a {@link Block} to the block list. * @param b {@link Block} to add */ public void add(Block b) { blocks.add(b); } /** * Removes a {@link Block} from the blocklist. * @param b {@link Block} to remove. */ public void remove(Block b) { blocks.remove(b); } /** * Returns an {@link Block} which is an element of the blocks on the board. * @param i Index of the block to return * @return i'th block of the block list. */ public Block get(int i) { return blocks.get(i); } /** * * @return ArrayList of blocks. */ public ArrayList<Block> getBlocks() { return blocks; } }
[ "matwhiteside1@gmail.com" ]
matwhiteside1@gmail.com
faed05eea14789f584b6dbcafa8a5c65faedf5ab
f159aeec3408fe36a9376c50ebb42a9174d89959
/993.Cousins-in-Binary-Tree.java
b6325704ddeedaa32bfae714939dc1ab38c1d98a
[ "MIT" ]
permissive
mickey0524/leetcode
83b2d11ab226fad5da7198bb37eeedcd8d17635a
fc5b1744af7be93f4dd01d6ad58d2bd12f7ed33f
refs/heads/master
2023-09-04T00:01:13.138858
2023-08-27T07:43:53
2023-08-27T07:43:53
140,945,128
27
9
null
null
null
null
UTF-8
Java
false
false
1,300
java
// https://leetcode.com/problems/cousins-in-binary-tree/ // // algorithms // Medium (51.97%) // Total Accepted: 33,322 // Total Submissions: 64,113 // beats 100.0% of java submissions /** * Definition for a binary tree node. public class TreeNode { int val; TreeNode * left; TreeNode right; TreeNode(int x) { val = x; } } */ class Solution { private static TreeNode parentX; private static TreeNode parentY; private static int levelX; private static int levelY; public boolean isCousins(TreeNode root, int x, int y) { parentX = null; parentY = null; levelX = -1; levelY = -1; recursive(root, null, x, y, 0); if (levelX != levelY) { return false; } if (parentX == parentY) { return false; } return true; } private void recursive(TreeNode root, TreeNode parent, int x, int y, int level) { if (root == null) { return; } if (root.val == x) { parentX = parent; levelX = level; } if (root.val == y) { parentY = parent; levelY = level; } recursive(root.left, root, x, y, level + 1); recursive(root.right, root, x, y, level + 1); } }
[ "buptbh@163.com" ]
buptbh@163.com
d0fa927a108d54fa3402aee15f08857bd908e7ab
3bb2f8a5aaed035d818b9298cb3e9c320a20efe3
/musicplayer/app/src/main/java/com/example/musicplayer/MainActivity.java
cc941b06031c470a2fa80b5a692c7f183dbdda25
[]
no_license
s2454399599/experiment4
96730d6227308794a5d7f317305116ac577ae2fd
a4aa4678672e2b327857aec1bd4ae3cf1703df8d
refs/heads/master
2023-01-24T06:02:06.064526
2020-12-01T02:37:10
2020-12-01T02:37:10
317,403,308
0
0
null
null
null
null
UTF-8
Java
false
false
7,437
java
package com.example.musicplayer; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.ActivityCompat; import androidx.core.content.ContextCompat; import android.Manifest; import android.content.DialogInterface; import android.content.pm.PackageManager; import android.content.res.AssetFileDescriptor; import android.content.res.AssetManager; import android.media.MediaPlayer; import android.os.Bundle; import android.os.Environment; import android.util.Log; import android.view.View; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.SeekBar; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; import java.io.File; import java.io.IOException; public class MainActivity extends AppCompatActivity { private MediaPlayer mediaPlayer; int []song_id={R.raw.song1,R.raw.song2,R.raw.song3,R.raw.song4,R.raw.song5,R.raw.song6}; String[]song_name={"无地自容 - 黑豹乐队","听妈妈的话 - 周杰伦","笑忘书 - 王菲","小幸运 - 田馥甄","知足 - 五月天","晴天 - 周杰伦"}; int songs=0; TextView curTime,totalTime,theSong; Button play,pause,stop,next,previous; static int num=0; SeekBar seekBar; int p=0; Spinner spinner; ListView listView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mediaPlayer=new MediaPlayer(); play=findViewById(R.id.play); pause=findViewById(R.id.pause); stop=findViewById(R.id.stop); next=findViewById(R.id.next); previous=findViewById(R.id.previous); seekBar=findViewById(R.id.mSeekbar); curTime=findViewById(R.id.curTime); totalTime=findViewById(R.id.totalTime); theSong=findViewById(R.id.songname); test(num); initview(); initSong(); play.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mediaPlayer.start(); } }); pause.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mediaPlayer.pause(); } }); stop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { mediaPlayer.stop(); test(num); } }); next.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(num==5)num=0; else num++; test(num); int total=mediaPlayer.getDuration()/1000; int curl=mediaPlayer.getCurrentPosition()/1000; curTime.setText(calculateTime(curl)); totalTime.setText(calculateTime(total)); mediaPlayer.start(); } }); previous.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(num==0)num=5; else num--; test(num); int total=mediaPlayer.getDuration()/1000; int curl=mediaPlayer.getCurrentPosition()/1000; curTime.setText(calculateTime(curl)); totalTime.setText(calculateTime(total)); mediaPlayer.start(); } }); mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() { @Override public boolean onError(MediaPlayer mp, int what, int extra) { return true; } }); new Thread(new Runnable() { @Override public void run() { int total = mediaPlayer.getDuration() / 1000; int curl = mediaPlayer.getCurrentPosition(); while(true){ total = mediaPlayer.getDuration() / 1000; curl = mediaPlayer.getCurrentPosition() / 10; curTime.setText(calculateTime(curl/100)); try { Thread.sleep(1000); } catch (Exception e) { e.printStackTrace(); } } } }).start(); } public void initSong(){ ArrayAdapter<String> adapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1,song_name); ListView lv_1 = findViewById(R.id.listview); lv_1.setAdapter(adapter); } public void test(int i){ theSong = findViewById(R.id.songname); theSong.setText(song_name[i]); if(mediaPlayer != null){ mediaPlayer.stop(); } mediaPlayer = MediaPlayer.create(this, song_id[i]); mediaPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { option(); } }); } public void option(){ /*Toast.makeText(MainActivity.this, "播放完成", Toast.LENGTH_SHORT).show();*/ } public void initview(){ int total = mediaPlayer.getDuration() / 1000; int curl = mediaPlayer.getCurrentPosition() / 1000; curTime.setText(calculateTime(curl)); totalTime.setText(calculateTime(total)); seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { int total = mediaPlayer.getDuration() / 1000;//获取音乐总时长 int curl = mediaPlayer.getCurrentPosition() / 1000;//获取当前播放的位置 curTime.setText(calculateTime(curl));//开始时间 totalTime.setText(calculateTime(total));//总时长 } @Override public void onStartTrackingTouch(SeekBar seekBar) { } @Override public void onStopTrackingTouch(SeekBar seekBar) { mediaPlayer.seekTo(mediaPlayer.getDuration()*seekBar.getProgress()/100);//在当前位置播放 curTime.setText(calculateTime(mediaPlayer.getCurrentPosition() / 1000)); } }); } public String calculateTime(int time){ int minute; int second; if(time > 60){ minute = time / 60; second = time % 60; //判断秒 if(second >= 0 && second < 10){ return "0"+minute+":"+"0"+second; }else { return "0"+minute+":"+second; } }else if(time < 60){ second = time; if(second >= 0 && second < 10){ return "00:"+"0"+second; }else { return "00:"+ second; } }else{ return "01:00"; } } @Override protected void onDestroy(){ super.onDestroy(); if (mediaPlayer!=null) { mediaPlayer.stop(); mediaPlayer.release(); } } }
[ "2454399599@qq.com" ]
2454399599@qq.com
c5e9c075e4580d4339771b71d5174cca158ac0b7
e9232a8af759b8b6f3cf6fec024ab617e83e3945
/MyApplication/app/src/test/java/com/scottlindley/myapplication/ExampleUnitTest.java
321daf15dbf82a83d6099768c9d10ed013d9b12b
[]
no_license
ScottLindley/listview-and-listadapter-hw
28b868604f4dc31b752a3110807ab23f7333eb58
3e736c40b6e2dd83f0e83d427935e246770719b2
refs/heads/master
2021-01-11T04:19:33.830929
2016-10-18T03:20:18
2016-10-18T03:20:18
71,180,388
0
0
null
2016-10-17T20:54:31
2016-10-17T20:54:31
null
UTF-8
Java
false
false
408
java
package com.scottlindley.myapplication; 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() throws Exception { assertEquals(4, 2 + 2); } }
[ "scottdlindley@gmail.com" ]
scottdlindley@gmail.com
46f3ced30a1ccd4c3828a31f77f5c56231bcc499
d9772f15df68a41e5d44c470f8415e953a9a2c5e
/coffeeShopInterfaceAbstractDemo/src/coffeeShopInterfaceAbstractDemo/Entities/Customer.java
a547aaa4e8cfecd28a6e1f4f3875a22c3345a511
[]
no_license
serterozbek/javacampHomework
95c1e5b1ae5c2697811f614d7908e765d275dbfe
42ff0d4f400ace62ca1f9bded2c6720069383a39
refs/heads/main
2023-05-29T03:24:46.809263
2021-06-16T20:46:30
2021-06-16T20:46:30
369,218,353
2
0
null
null
null
null
UTF-8
Java
false
false
1,032
java
package coffeeShopInterfaceAbstractDemo.Entities; import java.time.LocalDate; import java.time.LocalTime; import coffeeShopInterfaceAbstractDemo.Abstract.ICustomerService; import coffeeShopInterfaceAbstractDemo.Abstract.IEntity; public class Customer implements IEntity { int id; String firstName; String lastName; LocalDate dateOfBirth; String nationalityId; public int getId() { return id; } public void setId(int id) { this.id = id; } 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 LocalDate getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(LocalDate dateOfBirth) { this.dateOfBirth = dateOfBirth; } public String getNationalityId() { return nationalityId; } public void setNationalityId(String nationalityId) { this.nationalityId = nationalityId; } }
[ "serter.ozbek@hotmail.com" ]
serter.ozbek@hotmail.com
10dc2aff05a85f2030261a88326ba6779bbd5946
b1f51f8ba05ad83ecfbd80e6e7f140e70850bf01
/ACE_ERP/src/Account/a090001_s98.java
711238761c83a239b2ce630c37b863c0156c4496
[]
no_license
hyundaimovex-asanwas/asanwas-homepage
27e0ba1ed7b41313069e732f3dc9df20053caddd
75e30546f11258d8b70159cfbe8ee36b18371bd0
refs/heads/master
2023-06-07T03:41:10.170367
2021-07-01T10:23:54
2021-07-01T10:23:54
376,739,168
1
1
null
null
null
null
UHC
Java
false
false
3,190
java
package Account; import com.gauce.*; import com.gauce.io.*; import com.gauce.common.*; import com.gauce.log.*; import com.gauce.db.*; import javax.servlet.*; import javax.servlet.http.*; import java.sql.*; // class 이름은 화일명과 항상 동일해야 함. public class a090001_s98 extends HttpServlet { /** * */ private static final long serialVersionUID = 1L; // 웹페이지의 폼의 전송방식이 Post 타입일 경우 public void doGet(HttpServletRequest req, HttpServletResponse res) { res.setContentType("text/html;charset=ksc5601"); ServiceLoader loader = new ServiceLoader(req, res); GauceService service = null; GauceContext context = null; Logger logger = null; GauceDBConnection conn = null; GauceStatement stmt =null; GauceDataSet dSet = null; try { service = loader.newService(); context = service.getContext(); logger = context.getLogger(); GauceRequest GauceReq = service.getGauceRequest(); GauceResponse GauceRes = service.getGauceResponse(); try { conn = service.getDBConnection(); dSet = new GauceDataSet(); /********************************************************************************************** 실제 업무에서 적용하실 부분 **********************************************************************************************/ // 웹페이지에서 조건값을 넘겨받음 String str1 = req.getParameter("v_str1"); String str2 = req.getParameter("v_str2"); if (str1 == null) str1 = ""; if (str2 == null) str2 = ""; GauceRes.enableFirstRow(dSet); String[] strArrCN = new String[]{ "EMPNO","EMPNMK" }; int[] intArrCN = new int[] { 7, 20 }; int[] intArrCN2 = new int[]{ -1, -1 }; for (int i=0; i<strArrCN.length; i++) { // set column column switch ( intArrCN2[i] ) { case -1 : dSet.addDataColumn(new GauceDataColumn(strArrCN[i], GauceDataColumn.TB_STRING, intArrCN[i])); break; default : dSet.addDataColumn( new GauceDataColumn( strArrCN[i], GauceDataColumn.TB_DECIMAL, intArrCN[i], intArrCN2[i] ) ); break; } } if (!GauceReq.isBuilderRequest()) { StringBuffer sql = new StringBuffer(); sql.append(" SELECT EMPNO, EMPNMK "); sql.append(" FROM PAYROLL.HIPERSON A WHERE EMPNO IS NOT NULL "); if (!str1.equals("")) sql.append( " AND EMPNO ='" + str1+ "' "); if (!str2.equals("")) sql.append( " AND EMPNMK LIKE '%" + str2 + "%' "); //logger.dbg.println(this,sql.toString()); /*********************************************************************************************/ stmt = conn.getGauceStatement(sql.toString()); stmt.executeQuery(dSet); } } catch(Exception e) { logger.err.println(this,e); } finally { if (stmt != null) try { stmt.close(); } catch (Exception e) {} if (conn != null) try {conn.close(true);} catch (Exception e) {} } dSet.flush(); GauceRes.commit(); GauceRes.close(); } catch (Exception e) { logger.err.println(this,e); logger.dbg.println(this,e.toString()); } finally { loader.restoreService(service); } } }
[ "86274611+evnmoon@users.noreply.github.com" ]
86274611+evnmoon@users.noreply.github.com
968cedfc8f3bb68b480c5dcb4322fbfb39a772a5
bad49b9638625446752e88dd73323bcc36cb6d8e
/Finance/src/org/weixvn/finance/webpages/GetUserName.java
c82b5330f63aa4c42318f9232d7b977f78acde2c
[]
no_license
ljyao/Finance
0251eadd77dec74c1055bea86f5fd9106f0cbd94
3b1e6f8ea3ee84358f25fdf4d6a028ba20f0600c
refs/heads/master
2021-01-19T18:08:33.731880
2015-08-23T09:51:49
2015-08-23T09:51:49
41,244,233
0
0
null
null
null
null
UTF-8
Java
false
false
941
java
package org.weixvn.finance.webpages; import org.apache.http.Header; import org.jsoup.nodes.Document; import org.jsoup.select.Elements; import org.weixvn.http.AsyncWaeHttpRequest; import org.weixvn.http.AsyncWaeHttpRequest.RequestType; import org.weixvn.http.JsoupHttpRequestResponse; public class GetUserName extends JsoupHttpRequestResponse{ String URI="http://cw.swust.edu.cn/baobiao/Queue/QueueController.aspx"; @Override public void onRequest(AsyncWaeHttpRequest request) { request.setRequestURI(URI); request.setRequestType(RequestType.GET); setCharset("gb2312"); } @Override public void doResponse(int arg0, Header[] arg1, Document doc) { } public String analyse(Document doc) { Elements elements = doc.getElementsByTag("span"); String name = elements.get(0).getElementsByTag("span").text(); if (name.equals("用户:/")) return "请登陆"; else return name; } }
[ "Yann-LJY@Yann-Li" ]
Yann-LJY@Yann-Li
6d9e0693f2ab50b7292122aa4926a908bef4363e
5e5341282494e7d8bf316f69ef3c6120284d34a0
/src/main/java/io/github/manuelernesto/controller/page/PageWrapper.java
635aeef5ded4308baf06ced45b81b8883e0b5d0f
[]
no_license
manuelernesto/brewer-spring-mvc
30226af755267ee863441a06593f1d5bd1c7dd13
fae1abf7ef9c052faaf75bce5d0871f3c071de2a
refs/heads/master
2022-12-31T13:18:56.088239
2020-10-24T18:47:14
2020-10-24T18:47:14
290,449,540
2
0
null
2020-09-06T15:22:17
2020-08-26T09:10:23
JavaScript
UTF-8
Java
false
false
2,678
java
package io.github.manuelernesto.controller.page; import org.springframework.data.domain.Page; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Order; import org.springframework.web.util.UriComponentsBuilder; import javax.servlet.http.HttpServletRequest; import java.util.List; public class PageWrapper<T> { private final Page<T> page; private final UriComponentsBuilder uriBuilder; public PageWrapper(Page<T> page, HttpServletRequest httpServletRequest) { super(); this.page = page; String httpUrl = httpServletRequest.getRequestURL().append( httpServletRequest.getQueryString() != null ? "?" + httpServletRequest.getQueryString() : "" ).toString().replaceAll("\\+", "%20"); this.uriBuilder = UriComponentsBuilder.fromHttpUrl(httpUrl); } public List<T> getContent() { return page.getContent(); } public int getCurrent() { return page.getNumber(); } public boolean isEmpty() { return page.getContent().isEmpty(); } public int getNumber() { return page.getNumber(); } public int getTotalPages() { return page.getTotalPages(); } public boolean isLast() { return page.isLast(); } public boolean isFirst() { return page.isFirst(); } public String urlToPage(int page) { return uriBuilder.replaceQueryParam("page", page) .build(true) .encode() .toUriString(); } public String orderUrl(String field) { UriComponentsBuilder uriBuilderOrder = UriComponentsBuilder .fromUriString(uriBuilder.build(true).encode().toUriString()); String valueSorted = String.format("%s,%s", field, invertOrder(field)); return uriBuilderOrder.replaceQueryParam("sort", valueSorted).build(true).encode().toUriString(); } private String invertOrder(String field) { String direction = "asc"; Order order = page.getSort() != null ? page.getSort().getOrderFor(field) : null; if (order != null) direction = Sort.Direction.ASC.equals(order.getDirection()) ? "desc" : "asc"; return direction; } public boolean descendent(String field) { return invertOrder(field).equals("asc"); } public boolean ordered(String field) { Order order = page.getSort() != null ? page.getSort().getOrderFor(field) : null; if (order == null) return false; return page.getSort().getOrderFor(field) != null ? true : false; } }
[ "manuelernesto@outlook.com" ]
manuelernesto@outlook.com
478a36647b02a57c5a45fa612abc900f1d0a5dc0
e4913659988a184ba2a87685afd34be14da34cd5
/DFS/src/by/bsu/algorithms/dfs/Sort.java
1b70ef0f5014d10b8855de6cdf753805514f17a1
[]
no_license
angfedosik/Algorithms
2c90fa99bbd7fdc6e6ebebe0639330268b88b680
9ab0fcf83c69f481f3fa433c3254f23b95a7b3c3
refs/heads/master
2020-07-31T01:26:25.350789
2019-12-13T12:56:21
2019-12-13T12:56:21
210,433,256
0
0
null
null
null
null
UTF-8
Java
false
false
1,132
java
package by.bsu.algorithms.dfs; import java.util.Stack; public class Sort { public static int[] topologicalSearch(Graph G) { int n=G.getVertices(); int[] isVertexVisited=new int[n]; int[][]adjacency=G.getAdjacency(); Stack<Integer> S=new Stack<>(); Stack<Integer>sortResult=new Stack<>(); topologicalSearch(G, adjacency, 0, S, isVertexVisited, sortResult); int[] sortedTree=new int[n]; for (int i=0; i<n; i++) sortedTree[i]=sortResult.pop(); return sortedTree; } private static void topologicalSearch(Graph G, int[][]adjacency, int startVertex, Stack<Integer> S, int[]isVertexVisited, Stack<Integer>sortResult) { int n=G.getVertices(); if(isVertexVisited[startVertex]!=1) { S.push(startVertex); isVertexVisited[startVertex]=1; } for(int i=0; i<n; i++){ if(adjacency[startVertex][i]==1 && isVertexVisited[i]!=1){ topologicalSearch(G, adjacency, i, S, isVertexVisited, sortResult); } } sortResult.push(startVertex); } }
[ "angfedosik@gmail.com" ]
angfedosik@gmail.com
c0e0fb34dc291f6df4fa4a9a220f7c083cc31452
deb8c98ab157771f67c1a60e80ae986e8bf3ed92
/doggame1.11/src/登录界面/Denglu.java
9ff2238b1b13e9a82040a251540723c55d5a9dd3
[]
no_license
xiantang/java_learn
e474680924abf9d347da1b6f06cfcf75ac950f8d
2ef9e21943b73f986512295604db2de8bd4c2a90
refs/heads/master
2021-04-27T11:56:42.956344
2018-04-21T13:55:42
2018-04-21T13:55:42
122,570,523
0
0
null
null
null
null
UTF-8
Java
false
false
4,740
java
package 登录界面; import db.Sqlserver; import 首页.First; import javax.swing.*; import java.awt.*; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; public class Denglu extends JFrame{ public static int fwhite = 1003;//宽度 public static int fheight = 600;//高度 public JLabel id; private static final String a = "请输入用户名"; public TextField beitai; public Sqlserver dataBase; public Denglu(){ dataBase=new Sqlserver(); JLabel bg=new JLabel(); Icon iconbg=new ImageIcon("src/登录界面/image/首页的副本.png"); //在此直接创建对象 bg.setIcon(iconbg); bg.setBounds(0, 0, 1003,600); id = new JLabel("用户名:"); id.setFont(new Font("微软雅黑",Font.BOLD,60)); id.setBounds(180,258,240,150); final JTextField sr = new JTextField(a); sr.setFont(new Font("微软雅黑",Font.BOLD,64)); sr.setBounds(400,268,400,130); sr.setForeground(Color.gray); sr.setPreferredSize(new Dimension(150, 28)); sr.setBorder(new MyTextFieldBorder()); sr.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { if(sr.getText().equals(a)){ sr.setText(""); sr.setForeground(Color.black); } } @Override public void focusLost(FocusEvent e) { if (sr.getText().equals("")){ sr.setText(a); sr.setForeground(Color.gray); } } }); beitai = new TextField(null,16); beitai.setFont(new Font("微软雅黑",Font.BOLD,64)); beitai.setBounds(400,0,400,130); beitai.setForeground(Color.gray); JLabel tuijian = new JLabel(); ImageIcon icontuijian = new ImageIcon("src/登录界面/image/开始的副本.png"); icontuijian.setImage(icontuijian.getImage().getScaledInstance(125,125,Image.SCALE_DEFAULT)); tuijian.setIcon(icontuijian); tuijian.setSize(125,125); tuijian.setLocation(427,424); tuijian.requestFocus(); // tuijian.setVisible(false); // ImageIcon icontuijian = new ImageIcon("src/登录界面/image/开始的副本.png"); // icontuijian.setImage(icontuijian.getImage().getScaledInstance(125,125,Image.SCALE_DEFAULT)); // tuijian.setIcon(icontuijian); // tuijian.setSize(125,125); // tuijian.setLocation(427,424); // tuijian.setBorder(BorderFactory.createTitledBorder("你好")); 边框线条可以添加文字 tuijian.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { String s = sr.getText(); if(!s.equals("")&&!s.equals("请输入用户名")&&!dataBase.InDb(s)){//并且不在数据库 try { new First(sr.getText()); } catch (InterruptedException e1) { e1.printStackTrace(); } dispose(); } } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { tuijian.setSize(150,150); icontuijian.setImage(icontuijian.getImage().getScaledInstance(150,150,Image.SCALE_DEFAULT)); tuijian.setLocation(415,410); setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));//鼠标变成手形状 } @Override public void mouseExited(MouseEvent e) { tuijian.setSize(125,125); icontuijian.setImage(icontuijian.getImage().getScaledInstance(125,125,Image.SCALE_DEFAULT)); tuijian.setLocation(427,424); setCursor(Cursor.getDefaultCursor());//鼠标原始 } }); add(tuijian); add(sr); add(id); add(bg); add(beitai); Dimension screenSize =Toolkit.getDefaultToolkit().getScreenSize();//计算电脑尺寸居中 setBounds(((int)screenSize.getWidth() - fwhite) / 2, 0, fwhite, fheight);//计算电脑尺寸居中 setTitle("小狗抢红包"); setLayout(null); setVisible(true); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }
[ "34479567+xiantang@users.noreply.github.com" ]
34479567+xiantang@users.noreply.github.com
9202aa7be73156f2373d7984bbcade3e0ab0db6d
e84d6af23dbd82132eb3bec88b81da347196930a
/Losange.java
523a4351fd570333dadd32efe1111885179b4836
[]
no_license
Duvalceline/geometrie
00af534a4c8632a7daa4b5f5cb7d28bd90003221
532ec2f565e683d9b5d100a6f5672eefcbafdfd4
refs/heads/master
2020-05-24T02:44:36.888626
2017-03-13T10:50:32
2017-03-13T10:50:32
84,815,437
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package geometrie; class Losange extends Figure{ private double cote; //constructeur Losange() { cote = 0; } Losange(double cote){ this.cote = cote; } Losange(Losange l) { this.cote = l.cote; } // get set (encapsuleur) double Cote() { return cote; } void setCote(double cote){ this.cote = cote; } public String toString(){ return "côté : " + cote; } double calculerLongueur() { return 4 * cote; } public void zoomer(double coefficient) { super.zoomer(coefficient); cote = coefficient * cote; } public Rectangle pivoter(){ return new Rectangle(cote, cote); } }
[ "duval.celine@hotmail.com" ]
duval.celine@hotmail.com
b3aae4bde4bf5386e71384523ce3f131c1f3b5fc
b98bd36967425002aec95b12843aa4d5f901622b
/src/main/java/com/jhipsterpress/web/service/dto/CmessageCriteria.java
0c8a1348e55c09c7a583d038b9bacd2927b2b005
[]
no_license
Tonterias2/jhipsterpress09
f14f2cf8b6b760b55eb4459a0b3446bedd939225
06b74c477a1e24a50c5dd37929ef76079e28cea8
refs/heads/master
2021-10-14T11:11:56.511162
2019-02-04T23:04:44
2019-02-04T23:04:44
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,829
java
package com.jhipsterpress.web.service.dto; import java.io.Serializable; import java.util.Objects; import io.github.jhipster.service.filter.BooleanFilter; import io.github.jhipster.service.filter.DoubleFilter; import io.github.jhipster.service.filter.Filter; import io.github.jhipster.service.filter.FloatFilter; import io.github.jhipster.service.filter.IntegerFilter; import io.github.jhipster.service.filter.LongFilter; import io.github.jhipster.service.filter.StringFilter; import io.github.jhipster.service.filter.InstantFilter; /** * Criteria class for the Cmessage entity. This class is used in CmessageResource to * receive all the possible filtering options from the Http GET request parameters. * For example the following could be a valid requests: * <code> /cmessages?id.greaterThan=5&amp;attr1.contains=something&amp;attr2.specified=false</code> * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use * fix type specific filters. */ public class CmessageCriteria implements Serializable { private static final long serialVersionUID = 1L; private LongFilter id; private InstantFilter creationDate; private StringFilter messageText; private BooleanFilter isDelivered; private LongFilter csenderId; private LongFilter creceiverId; public CmessageCriteria() { } public LongFilter getId() { return id; } public void setId(LongFilter id) { this.id = id; } public InstantFilter getCreationDate() { return creationDate; } public void setCreationDate(InstantFilter creationDate) { this.creationDate = creationDate; } public StringFilter getMessageText() { return messageText; } public void setMessageText(StringFilter messageText) { this.messageText = messageText; } public BooleanFilter getIsDelivered() { return isDelivered; } public void setIsDelivered(BooleanFilter isDelivered) { this.isDelivered = isDelivered; } public LongFilter getCsenderId() { return csenderId; } public void setCsenderId(LongFilter csenderId) { this.csenderId = csenderId; } public LongFilter getCreceiverId() { return creceiverId; } public void setCreceiverId(LongFilter creceiverId) { this.creceiverId = creceiverId; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final CmessageCriteria that = (CmessageCriteria) o; return Objects.equals(id, that.id) && Objects.equals(creationDate, that.creationDate) && Objects.equals(messageText, that.messageText) && Objects.equals(isDelivered, that.isDelivered) && Objects.equals(csenderId, that.csenderId) && Objects.equals(creceiverId, that.creceiverId); } @Override public int hashCode() { return Objects.hash( id, creationDate, messageText, isDelivered, csenderId, creceiverId ); } @Override public String toString() { return "CmessageCriteria{" + (id != null ? "id=" + id + ", " : "") + (creationDate != null ? "creationDate=" + creationDate + ", " : "") + (messageText != null ? "messageText=" + messageText + ", " : "") + (isDelivered != null ? "isDelivered=" + isDelivered + ", " : "") + (csenderId != null ? "csenderId=" + csenderId + ", " : "") + (creceiverId != null ? "creceiverId=" + creceiverId + ", " : "") + "}"; } }
[ "ecorreos@htomail.com" ]
ecorreos@htomail.com
d8f1dee7959978a1252ed95723fd971da8673ea5
5715caf1d0ea1d8821035c24816703c84f8414c3
/app/src/main/java/com/example/hp1/finalproject/Ask.java
bfeca1e8a4506d9cc30df92229402a4566077d1b
[]
no_license
hbhusam/SchoolProject
b6859b140083103124682e3c959d588461fea669
c08e7dce8fea415cd40b322514fce882f30b97ec
refs/heads/master
2021-05-16T06:47:20.912306
2017-09-14T10:14:11
2017-09-14T10:14:11
103,503,621
0
0
null
null
null
null
UTF-8
Java
false
false
2,121
java
package com.example.hp1.finalproject; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import java.util.ArrayList; public class Ask extends AppCompatActivity implements View.OnClickListener,AdapterView.OnItemLongClickListener { Button btadd,btclear; EditText et1; ListView mails; ArrayList<String> emails = new ArrayList<>(); ArrayAdapter<String> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ask); btadd=(Button)findViewById(R.id.bt1); btclear=(Button)findViewById(R.id.bt2); mails=(ListView)findViewById(R.id.emails); et1=(EditText)findViewById(R.id.EMail); btadd.setOnClickListener(this); btclear.setOnClickListener(this); emails.add("How To Get A girlFriend?"); emails.add("Is My Mind Big?"); adapter = new ArrayAdapter<String>(getApplicationContext(), android.R.layout.simple_list_item_1, emails); mails.setAdapter(adapter); mails.setOnItemLongClickListener(this); } @Override public void onClick(View v) { if(v==btadd){ emails.add(et1.getText().toString()); adapter.notifyDataSetChanged(); } if(v==btclear){ et1.setText(""); } } @Override public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) { Intent email = new Intent(Intent.ACTION_SEND); email.putExtra(Intent.EXTRA_EMAIL, new String[]{emails.get(position).toString()}); email.putExtra(Intent.EXTRA_SUBJECT,"Hello" ); email.putExtra(Intent.EXTRA_TEXT,"Byee"); email.setType("message/rfc822"); startActivity(Intent.createChooser(email, "Choose an Email client :")); return false; } }
[ "hu_sam_2000@hotmail.com" ]
hu_sam_2000@hotmail.com
ffd40bdcada0cfd25f1748f894e3ca6dc77df0e1
b880d8b75e3d982699e615c25454dd92355a44b9
/app/src/androidTest/java/fi/tuni/BMICounter/ExampleInstrumentedTest.java
e5b22142e1e73488055a34819a838fa8aa8320e1
[]
no_license
liukaslattia/Android-BMI-Counter
36f6a81e8b73920b10ded4aa2eb60bb61ba65218
f35c6282ea5603730c3511139cfdab01ed800c0d
refs/heads/master
2020-12-21T15:12:46.987238
2020-01-27T10:58:37
2020-01-27T10:58:37
236,470,632
0
0
null
null
null
null
UTF-8
Java
false
false
719
java
package fi.tuni.BMICounter; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("fi.tuni.exercise2", appContext.getPackageName()); } }
[ "luukas.anttila@tuni.fi" ]
luukas.anttila@tuni.fi
78bacde14b3677004c696c4e6c0fe662b48a73ca
2d15d7ddbddcab0f720ba27cfa29993dbea36366
/CloseBy/src/main/java/com/closeby/web/config/AppConfig.java
cc428f1cb4791d46044a3a622211d244483c2651
[]
no_license
anshit-sobti/Smart-Connected-Neighborhood-Platform
7273c68ead33be7527d0814dc5ba4c15fb9e2851
9163c447a604da6d1527ce2149932c7ac36fad24
refs/heads/master
2020-03-20T00:50:02.044577
2018-06-12T10:49:31
2018-06-12T10:49:31
137,057,181
0
0
null
null
null
null
UTF-8
Java
false
false
3,549
java
package com.closeby.web.config; import java.io.IOException; import java.util.Properties; import org.apache.log4j.Logger; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.web.multipart.commons.CommonsMultipartResolver; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.view.velocity.VelocityConfigurer; import org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver; import com.closeby.web.controller.HomeController; @SuppressWarnings("deprecation") @Configuration @ComponentScan("com.closeby.*") public class AppConfig { private static final String VELOCITY_PATH_PREFIX="/WEB-INF/views/ftl/"; private static final String VELOCITY_PATH_SUFFIX=".vm"; private static final String MESSAGE_PATH_SOURCE_NAME="classpath:message"; private static final Logger logger = Logger.getLogger(AppConfig.class); private static Resource resource; public static Resource getResource() { return resource; } public void setResource(Resource resource) { AppConfig.resource = resource; } @Bean public ViewResolver viewResolver() { VelocityLayoutViewResolver bean = new VelocityLayoutViewResolver(); bean.setCache(false); bean.setPrefix(""); bean.setSuffix(VELOCITY_PATH_SUFFIX); bean.setRequestContextAttribute("rc"); return bean; } @Bean public VelocityConfigurer velocityConfig() { VelocityConfigurer velocityConfigurer = new VelocityConfigurer(); velocityConfigurer.setResourceLoaderPath(VELOCITY_PATH_PREFIX); return velocityConfigurer; } @Bean(name="messageSource") public ReloadableResourceBundleMessageSource getReloadableResourceBundleMessageSource() { logger.debug("creating messageSource bean with message path source name : "+MESSAGE_PATH_SOURCE_NAME); ReloadableResourceBundleMessageSource messageSource=new ReloadableResourceBundleMessageSource(); messageSource.setBasename(MESSAGE_PATH_SOURCE_NAME); return messageSource; } @Bean(name="multipartResolver") public CommonsMultipartResolver getCommonsMultipartResolver() { logger.info("creating common multipart resolver bean"); return new CommonsMultipartResolver(); } @Bean public PropertySourcesPlaceholderConfigurer propertyConfigurer1() { String activeProfile; PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer(); Properties properties = new Properties(); try { properties.load(this.getClass().getClassLoader().getResourceAsStream("META-INF/env.property")); } catch (IOException e) { logger.error("Error in reading env property file.Adding default property"+e); properties.put("profile", "dev"); } activeProfile = (String) properties.get("profile"); if ("prod".equals(activeProfile)) { resource = new ClassPathResource("/META-INF/prod.properties"); } else if ("staging".equals(activeProfile)) { resource = new ClassPathResource("/META-INF/staging.properties"); } else { resource = new ClassPathResource("/META-INF/dev.properties"); } propertySourcesPlaceholderConfigurer.setLocation(resource); return propertySourcesPlaceholderConfigurer; } }
[ "anshit@github.com" ]
anshit@github.com
967392ef47d205a08d75dbce5840545e882027c8
325cc28f4b608e4bd33070992995d3cb61eb6c00
/android_demo/android/src/main/java/com/openlocationcode/android/current/GoogleApiModule.java
79e3c93e46088f8581032cd866e0dbd16392ddef
[ "Apache-2.0" ]
permissive
yuparach99/open-location-code
1f510fa5e06db79277ddd0683e3403910d333dec
28260020b4d1fa16fb41a09102badd2c139d0968
refs/heads/master
2022-07-19T02:34:24.580208
2020-05-26T13:08:51
2020-05-26T13:08:51
266,894,658
2
0
Apache-2.0
2020-05-25T22:45:37
2020-05-25T22:45:37
null
UTF-8
Java
false
false
2,405
java
/* * Copyright 2016 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.openlocationcode.android.current; import com.google.android.gms.common.GoogleApiAvailability; import com.google.android.gms.common.api.GoogleApiClient; import com.google.android.gms.location.FusedLocationProviderApi; import com.google.android.gms.location.LocationServices; import android.content.Context; import android.hardware.SensorManager; import android.location.LocationManager; import android.view.Display; import android.view.WindowManager; import dagger.Module; import dagger.Provides; import javax.inject.Singleton; @Module public class GoogleApiModule { private final Context mContext; public GoogleApiModule(Context context) { this.mContext = context; } @Provides @Singleton public GoogleApiClient provideGoogleApiClient() { return new GoogleApiClient.Builder(mContext).addApi(LocationServices.API).build(); } @Provides @Singleton public GoogleApiAvailability provideGoogleApiAvailability() { return GoogleApiAvailability.getInstance(); } @SuppressWarnings("SameReturnValue") @Provides @Singleton public FusedLocationProviderApi provideFusedLocationProviderApi() { return LocationServices.FusedLocationApi; } @Provides @Singleton public LocationManager provideLocationManager() { return (LocationManager) mContext.getSystemService(Context.LOCATION_SERVICE); } @Provides @Singleton public SensorManager provideSensorManager() { return (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE); } @Provides @Singleton public Display provideDisplayManager() { return ((WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE)) .getDefaultDisplay(); } }
[ "drinckes@google.com" ]
drinckes@google.com
57f113a2f806f237bf65575de5b48a99abe28f28
3074a48bdf5820e308397f2fda9e97b279bacae8
/class21AsyncTaskFileDownload/app/src/test/java/com/example/karthik/class21asynctaskfiledownload/ExampleUnitTest.java
4b90e76411d10f3bdaec2f4698f671104eb8c919
[]
no_license
karthikmohan14/Android-Playground
5a332026b06c666218ad1bae289866f1723dc019
570b693c26b32b95db9ffe276eb5c9bc35499a8f
refs/heads/master
2021-07-16T23:09:36.783388
2019-01-03T09:35:22
2019-01-03T09:35:22
139,961,181
0
0
null
null
null
null
UTF-8
Java
false
false
409
java
package com.example.karthik.class21asynctaskfiledownload; 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); } }
[ "karthikmkochi@gmail.com" ]
karthikmkochi@gmail.com
9b7b10abf8d37c38747e0a21508a70f47631fa84
4312a71c36d8a233de2741f51a2a9d28443cd95b
/RawExperiments/Math/math97/1/AstorMain-math_97/src/variant-241/org/apache/commons/math/analysis/BrentSolver.java
9ff497eea9809f7e2ce3be4c838e9fb40d00f93d
[]
no_license
SajjadZaidi/AutoRepair
5c7aa7a689747c143cafd267db64f1e365de4d98
e21eb9384197bae4d9b23af93df73b6e46bb749a
refs/heads/master
2021-05-07T00:07:06.345617
2017-12-02T18:48:14
2017-12-02T18:48:14
112,858,432
0
0
null
null
null
null
UTF-8
Java
false
false
5,252
java
package org.apache.commons.math.analysis; public class BrentSolver extends org.apache.commons.math.analysis.UnivariateRealSolverImpl { private static final long serialVersionUID = -2136672307739067002L; public BrentSolver(org.apache.commons.math.analysis.UnivariateRealFunction f) { super(f, 100, 1.0E-6); } public double solve(double min, double max, double initial) throws org.apache.commons.math.FunctionEvaluationException, org.apache.commons.math.MaxIterationsExceededException { if (((initial - min) * (max - initial)) < 0) { throw new java.lang.IllegalArgumentException(((((((("Initial guess is not in search" + (" interval." + " Initial: ")) + initial) + " Endpoints: [") + min) + ",") + max) + "]")); } double yInitial = f.value(initial); if ((java.lang.Math.abs(yInitial)) <= (functionValueAccuracy)) { setResult(initial, 0); return result; } double yMin = f.value(min); if ((java.lang.Math.abs(yMin)) <= (functionValueAccuracy)) { setResult(yMin, 0); return result; } if ((yInitial * yMin) < 0) { return solve(min, yMin, initial, yInitial, min, yMin); } double yMax = f.value(max); if ((java.lang.Math.abs(yMax)) <= (functionValueAccuracy)) { setResult(yMax, 0); return result; } if ((yInitial * yMax) < 0) { return solve(initial, yInitial, max, yMax, initial, yInitial); } return solve(min, yMin, max, yMax, initial, yInitial); } public double solve(double min, double max) throws org.apache.commons.math.FunctionEvaluationException, org.apache.commons.math.MaxIterationsExceededException { clearResult(); verifyInterval(min, max); double olds; double yMin = f.value(min); double yMax = f.value(max); double sign = yMin * yMax; if (sign >= 0) { throw new java.lang.IllegalArgumentException((((((((((("Function values at endpoints do not have different signs." + " Endpoints: [") + min) + ",") + max) + "]") + " Values: [") + yMin) + ",") + yMax) + "]")); } else { ret = solve(min, yMin, max, yMax, min, yMin); } return ret; } private double solve(double x0, double y0, double x1, double y1, double x2, double y2) throws org.apache.commons.math.FunctionEvaluationException, org.apache.commons.math.MaxIterationsExceededException { double delta = x1 - x0; double oldDelta = delta; int i = 0; while (i < (maximalIterationCount)) { if ((java.lang.Math.abs(y2)) < (java.lang.Math.abs(y1))) { x0 = x1; x1 = x2; x2 = x0; y0 = y1; y1 = y2; y2 = y0; } if ((java.lang.Math.abs(y1)) <= (functionValueAccuracy)) { setResult(x1, i); return result; } double dx = x2 - x1; double tolerance = java.lang.Math.max(((relativeAccuracy) * (java.lang.Math.abs(x1))), absoluteAccuracy); if ((java.lang.Math.abs(dx)) <= tolerance) { setResult(x1, i); return result; } if (((java.lang.Math.abs(oldDelta)) < tolerance) || ((java.lang.Math.abs(y0)) <= (java.lang.Math.abs(y1)))) { delta = 0.5 * dx; oldDelta = delta; } else { double r3 = y1 / y0; double p; double p1; if (x0 == x2) { p = dx * r3; p1 = 1.0 - r3; } else { double r1 = y0 / y2; double r2 = y1 / y2; p = r3 * (((dx * r1) * (r1 - r2)) - ((x1 - x0) * (r2 - 1.0))); p1 = ((r1 - 1.0) * (r2 - 1.0)) * (r3 - 1.0); } if (p > 0.0) { p1 = -p1; } else { p = -p; } if (((2.0 * p) >= (((1.5 * dx) * p1) - (java.lang.Math.abs((tolerance * p1))))) || (p >= (java.lang.Math.abs(((0.5 * oldDelta) * p1))))) { delta = 0.5 * dx; oldDelta = delta; } else { oldDelta = delta; delta = p / p1; } } x0 = x1; y0 = y1; if ((java.lang.Math.abs(delta)) > tolerance) { x1 = x1 + delta; } else { if (dx > 0.0) { x1 = x1 + (0.5 * tolerance); } else { if (dx <= 0.0) { x1 = x1 - (0.5 * tolerance); } } } y1 = f.value(x1); if ((y1 > 0) == (y2 > 0)) { x2 = x0; y2 = y0; delta = x1 - x0; oldDelta = delta; } i++; } throw new org.apache.commons.math.MaxIterationsExceededException(maximalIterationCount); } }
[ "sajjad.syed@ucalgary.ca" ]
sajjad.syed@ucalgary.ca
b9ba034dc5fb6e6b02b79a26e123d127daadb248
2c496aeb1a55d40eb0ceb75e610af7ef3584cd77
/src/main/java/WeeklyMeals.java
e8e62da7e2264c1114e638be22dbb57fbe136990
[ "MIT" ]
permissive
PaulHooley/Foodie
e92d92527b2e5f2278712966e1ad69437b44640a
07614f4e7bb17fe7225689dcbee0537a4233a3da
refs/heads/master
2020-04-26T15:00:10.312401
2019-06-19T03:15:55
2019-06-19T03:15:55
173,633,493
0
0
null
null
null
null
UTF-8
Java
false
false
2,383
java
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; class WeeklyMeals { public static StringBuilder weeklyMeals = new StringBuilder(); public static ArrayList<String> mealList = new ArrayList<>(); public static int lines = 0; public static void generateMeals(int numOfMeals) throws IOException { BufferedReader br = new BufferedReader(new FileReader("ingredients.txt")); // Gets total number of lines in the text while (br.readLine() != null) { lines++; } br.close(); for (int i = 0; i < numOfMeals; i++) { getMeal(); } BufferedWriter writer = new BufferedWriter(new FileWriter("ingredientsWeekly.txt")); writer.append(weeklyMeals.toString()); writer.close(); } public static void getMeal() throws FileNotFoundException, IOException { BufferedReader reader = new BufferedReader(new FileReader("ingredients.txt")); StringBuilder curMeal = new StringBuilder(); String line = null; int i = 0; int choice = (int) (Math.random() * lines); try { // Gets us to the right line we want while (i != choice) { line = reader.readLine(); i++; } // Finds the next Title while (!line.contains("Tags")) { line = reader.readLine(); } while (!line.equals(":end")) { // Checking for duplicates if (line.contains("Title:")) { for (String title : mealList) { if (line.contains(title)) { getMeal(); return; } } mealList.add(line.toString()); } curMeal.append(line.toString() + "\n"); line = reader.readLine(); } curMeal.append(":end\n\n"); weeklyMeals.append(curMeal); } catch (NullPointerException e) { //If it reaches the end without finding a Tags: line it will retry getMeal(); } reader.close(); } }
[ "paul.hooley@mail.mcgill.ca" ]
paul.hooley@mail.mcgill.ca
4580a45aad548baf8d62f6fba91eaf7dc7a462c2
51c1ff6b216e50a25c63f547b7920293b3f14ea0
/WizardChess/core/src/com/capstone/project/states/GameOverState.java
6cd2a68e438bd1c282bf62d1b8a569b569883fcb
[]
no_license
0shine0/MultiplayerChess
dce7111b0fb94309fb2c846de9a138f0edd63496
a53287552edea06fbcd49a7df9d34e9c6cc06f8d
refs/heads/master
2020-03-22T12:52:23.870339
2018-07-07T09:07:57
2018-07-07T09:07:57
140,067,840
2
2
null
null
null
null
UTF-8
Java
false
false
3,681
java
package com.capstone.project.states; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.graphics.g2d.TextureRegion; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; import com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle; import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable; import com.capstone.project.Assets; import com.capstone.project.ChessMain; public class GameOverState extends State{ private boolean won; private String resultString; private TextureRegion background; private TextButton resultButton; private TextButton mainMenuButton; private TextButtonStyle buttonStyle; private TextButtonStyle textStyle; public GameOverState(GameStateManager gsm) { this(gsm, true); // TODO Auto-generated constructor stub } public GameOverState(GameStateManager gsm, boolean result) { super(gsm); // TODO Auto-generated constructor stub won = result; if(won){ resultString = new String("WON"); } else{ resultString = new String("LOST"); } cam = new OrthographicCamera(ChessMain.WIDTH, ChessMain.HEIGHT); cam.position.set(ChessMain.WIDTH/2, ChessMain.HEIGHT/2, 0); background = Assets.background1; textStyle = new TextButtonStyle(); textStyle.font = Assets.futureFont; textStyle.downFontColor = Color.YELLOW; textStyle.fontColor = Color.BLACK; buttonStyle = new TextButtonStyle(textStyle); buttonStyle.up = new TextureRegionDrawable(Assets.buttonUp); buttonStyle.down = new TextureRegionDrawable(Assets.buttonDown); resultButton = new TextButton("YOU "+resultString, textStyle); resultButton.setPosition(ChessMain.WIDTH/2-resultButton.getWidth()/2, ChessMain.HEIGHT/2-resultButton.getHeight()/2+(100.0f/800.0f)*ChessMain.HEIGHT); mainMenuButton = new TextButton("MAIN MENU", buttonStyle); mainMenuButton.setPosition(ChessMain.WIDTH/2-mainMenuButton.getWidth()/2, ChessMain.HEIGHT/2-mainMenuButton.getHeight()/2-(100.0f/800.0f)*ChessMain.HEIGHT); } @Override public void handleInput() { // TODO Auto-generated method stub if(Gdx.input.isTouched()){ touching = true; mouse.set(Gdx.input.getX(), Gdx.input.getY(), 0); cam.unproject(mouse); } else{ touching = false; } if(Gdx.input.isKeyPressed(Keys.BACK)){ State.backPressed = true; gsm.pop(); } } @Override public void update(float deltaTime) { // TODO Auto-generated method stub handleInput(); //main menu if(mouse.x>=mainMenuButton.getX() && mouse.x<=(mainMenuButton.getX()+mainMenuButton.getWidth()) && mouse.y>=mainMenuButton.getY() && mouse.y<=(mainMenuButton.getY()+mainMenuButton.getHeight()) && Gdx.input.justTouched()){ gsm.set(new PlayChooseState(gsm)); } } @Override public void render(SpriteBatch batch) { // TODO Auto-generated method stub cam.update(); batch.setProjectionMatrix(cam.combined); batch.begin(); batch.draw(background, 0, 0, ChessMain.WIDTH, ChessMain.HEIGHT); mainMenuButton.draw(batch, 1); resultButton.draw(batch, 1); batch.end(); } }
[ "swastik.garg.97@gmail.com" ]
swastik.garg.97@gmail.com
65e999dc99847d3ee4a2ce5ea51892dd9108d419
252517fe9658de5e093f60f2fb990f713f0cee58
/layout/src/com/fionchou/layout/MainActivity.java
a30196385fc9666217718d0c629f3bfca40902af
[]
no_license
fionchou/eclipse4android
0aefc34c803125644040fcb10eb94214bf73fc2b
44e4880b8778215a9a7a9eda0428f24e8f893aa2
refs/heads/master
2021-01-20T21:29:38.720726
2013-11-04T14:58:00
2013-11-04T14:58:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,012
java
package com.fionchou.layout; import java.util.ArrayList; import android.app.Activity; import android.os.Bundle; import android.telephony.SmsManager; import android.view.Menu; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity { private EditText phone_number; private EditText sms_content; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); phone_number = (EditText) this.findViewById(R.id.phone_number); sms_content = (EditText) this.findViewById(R.id.sms_content); Button sendsms_button =(Button) this.findViewById(R.id.sendsms_button); if(sendsms_button != null){ sendsms_button.setOnClickListener(new ButtonClickListener()); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } private final class ButtonClickListener implements View.OnClickListener{ @Override public void onClick(View sendsms_button) { String phoneNumber = phone_number.getText().toString(); String smsContent = sms_content.getText().toString(); SmsManager smsManager = SmsManager.getDefault(); ArrayList<String> smsContents = smsManager.divideMessage(smsContent); for(String smsContentText: smsContents){ smsManager.sendTextMessage(phoneNumber, null, smsContentText, null, null); } Toast.makeText(getApplicationContext(), R.string.sendsms_success_toast, Toast.LENGTH_LONG).show(); } } public EditText getPhone_number() { return phone_number; } public void setPhone_number(EditText phone_number) { this.phone_number = phone_number; } public EditText getSms_content() { return sms_content; } public void setSms_content(EditText sms_content) { this.sms_content = sms_content; } }
[ "fionchou@163.com" ]
fionchou@163.com
fe4868e6edb38bbfe531372728cae9076da25f80
0eaa8d021f6574d44292c7dde497d3ba8e095950
/Assignment2/MyHashMap.java
5d096cc020262cc31533bf12e8873b62a0d2305c
[]
no_license
magnusfinvik/Oblig3Prog2
82f156b51681a3bb8b7cb89ee8705b06dad8ac14
0f091a024f4c0c9637505e415123904077b324f7
refs/heads/master
2021-01-10T07:49:15.617239
2015-11-06T08:16:28
2015-11-06T08:16:28
45,424,727
0
0
null
null
null
null
UTF-8
Java
false
false
6,563
java
import java.util.LinkedList; import java.util.Set; public class MyHashMap<K, V> implements MyMap<K, V> { private static int DEFAULT_INITIAL_CAPACITY = 4; private static int MAXIMUM_CAPACITY = 1 << 30; private int capacity; private static float DEFAULT_MAX_LOAD_FACTOR = 0.75f; private float loadFactorThreshold; private int size = 0; LinkedList<MyMap.Entry<K,V>>[] table; public MyHashMap() { this(DEFAULT_INITIAL_CAPACITY, DEFAULT_MAX_LOAD_FACTOR); } public MyHashMap(int initialCapacity) { this(initialCapacity, DEFAULT_MAX_LOAD_FACTOR); } public MyHashMap(int initialCapacity, float loadFactorThreshold) { if (initialCapacity > MAXIMUM_CAPACITY) this.capacity = MAXIMUM_CAPACITY; else this.capacity = trimToPowerOf2(initialCapacity); this.loadFactorThreshold = loadFactorThreshold; table = new LinkedList[capacity]; } @Override public void clear() { size = 0; removeEntries(); } @Override public boolean containsKey(K key) { if (get(key) != null) return true; else return false; } @Override public boolean containsValue(V value) { for (int i = 0; i < capacity; i++) { if (table[i] != null) { LinkedList<Entry<K, V>> bucket = table[i]; for (Entry<K, V> entry: bucket) if (entry.getValue().contains(value)) return true; } } return false; } @Override public java.util.Set<MyMap.Entry<K,V>> entrySet() { java.util.Set<MyMap.Entry<K, V>> set = new java.util.HashSet<>(); for (int i = 0; i < capacity; i++) { if (table[i] != null) { LinkedList<Entry<K, V>> bucket = table[i]; for (Entry<K, V> entry: bucket) set.add(entry); } } return set; } @Override public V get(K key) { int bucketIndex = hash(key.hashCode()); if (table[bucketIndex] != null) { LinkedList<Entry<K, V>> bucket = table[bucketIndex]; for (Entry<K, V> entry: bucket) { if (entry.getKey().equals(key)) return entry.getValue().getFirst(); } } return null; } public Set<V> getAll(K key) { java.util.Set<V> set = new java.util.HashSet<>(); int bucketIndex = hash(key.hashCode()); if(table[bucketIndex] != null) { LinkedList<Entry<K, V>> bucket = table[bucketIndex]; for(Entry<K, V> entry : bucket) { if(entry.getKey().equals(key)){ for(V value : entry.valueList) set.add(value); return set; } } } return null; } @Override public boolean isEmpty() { return size == 0; } @Override public java.util.Set<K> keySet() { java.util.Set<K> set = new java.util.HashSet<K>(); for (int i = 0; i < capacity; i++) { if (table[i] != null) { LinkedList<Entry<K, V>> bucket = table[i]; for (Entry<K, V> entry: bucket) set.add(entry.getKey()); } } return set; } @Override public V put(K key, V value) { if (get(key) != null) { int bucketIndex = hash(key.hashCode()); LinkedList<Entry<K, V>> bucket = table[bucketIndex]; for (Entry<K, V> entry: bucket) if (entry.getKey().equals(key)) { entry.valueList.addLast(value); return value; } } if (size >= capacity * loadFactorThreshold) { if (capacity == MAXIMUM_CAPACITY) throw new RuntimeException("Exceeding maximum capacity"); rehash(); } int bucketIndex = hash(key.hashCode()); if (table[bucketIndex] == null) { table[bucketIndex] = new LinkedList<Entry<K, V>>(); } table[bucketIndex].add(new MyMap.Entry<K, V>(key, value)); size++; return value; } @Override public void remove(K key) { int bucketIndex = hash(key.hashCode()); if (table[bucketIndex] != null) { LinkedList<Entry<K, V>> bucket = table[bucketIndex]; for (Entry<K, V> entry: bucket) if (entry.getKey().equals(key)) { bucket.remove(entry); size--; break; } } } @Override public int size() { return size; } @Override public java.util.Set<V> values() { java.util.Set<V> set = new java.util.HashSet<>(); for (int i = 0; i < capacity; i++) { if (table[i] != null) { LinkedList<Entry<K, V>> bucket = table[i]; for (Entry<K, V> entry: bucket) for(V value : entry.valueList) set.add(value); } } return set; } private int hash(int hashCode) { return supplementalHash(hashCode) & (capacity - 1); } private static int supplementalHash(int h) { h ^= (h >>> 20) ^ (h >>> 12); return h ^ (h >>> 7) ^ (h >>> 4); } private int trimToPowerOf2(int initialCapacity) { int capacity = 1; while (capacity < initialCapacity) { capacity <<= 1; } return capacity; } private void removeEntries() { for (int i = 0; i < capacity; i++) { if (table[i] != null) { table[i].clear(); } } } private void rehash() { java.util.Set<Entry<K, V>> set = entrySet(); capacity <<= 1; table = new LinkedList[capacity]; size = 0; for (Entry<K, V> entry: set) { for(V value : entry.valueList) put(entry.getKey(), value); } } @Override public String toString() { StringBuilder builder = new StringBuilder("["); for (int i = 0; i < capacity; i++) { if (table[i] != null && table[i].size() > 0) for (Entry<K, V> entry: table[i]) builder.append(entry); } builder.append("]"); return builder.toString(); } }
[ "magnusfinvik@hotmail.com" ]
magnusfinvik@hotmail.com
e91ab3f4ea3c73a629e224b46810246477beeade
07215147824aa1adcc19028833becdbb700297c0
/src/main/java/com/microservices/review/config/ApplicationProperties.java
559808152ec0b801bbd35dc0d7e81237e17c5dfe
[]
no_license
ahammedfabeelm/Review-Microservice
f2dda05d944542ef011caea9722a0c72afe97938
26b3ffaae14309b03ad77f8227cfaa4f69b8ec9b
refs/heads/master
2023-02-14T13:58:19.219793
2021-01-08T07:50:46
2021-01-08T07:50:46
327,859,228
0
0
null
null
null
null
UTF-8
Java
false
false
439
java
package com.microservices.review.config; import org.springframework.boot.context.properties.ConfigurationProperties; /** * Properties specific to Product Review. * <p> * Properties are configured in the {@code application.yml} file. * See {@link io.github.jhipster.config.JHipsterProperties} for a good example. */ @ConfigurationProperties(prefix = "application", ignoreUnknownFields = false) public class ApplicationProperties { }
[ "aleenach92@gmail.com" ]
aleenach92@gmail.com
529b943ef090c1cc4311d60218e2deb75c42e67c
71071f98d05549b67d4d6741e8202afdf6c87d45
/files/Spring_AMQP/AMQP-406/spring-rabbit/src/test/java/org/springframework/amqp/rabbit/config/TemplateParserTests.java
7f7ff9bb87b191aa545b3d490d300614b4a10a5a
[]
no_license
Sun940201/SpringSpider
0adcdff1ccfe9ce37ba27e31b22ca438f08937ad
ff2fc7cea41e8707389cb62eae33439ba033282d
refs/heads/master
2022-12-22T09:01:54.550976
2018-06-01T06:31:03
2018-06-01T06:31:03
128,649,779
1
0
null
2022-12-16T00:51:27
2018-04-08T14:30:30
Java
UTF-8
Java
false
false
4,847
java
/* * Copyright 2010-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. */ package org.springframework.amqp.rabbit.config; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertTrue; import java.util.Collection; import org.junit.Before; import org.junit.Test; import org.springframework.amqp.core.AmqpTemplate; import org.springframework.amqp.core.Queue; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; import org.springframework.amqp.support.converter.SerializerMessageConverter; import org.springframework.amqp.utils.test.TestUtils; import org.springframework.beans.DirectFieldAccessor; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.core.io.ClassPathResource; import org.springframework.retry.support.RetryTemplate; /** * * @author Dave Syer * @author Gary Russell * @author Artem Bilan */ public final class TemplateParserTests { private DefaultListableBeanFactory beanFactory; @Before public void setUpDefaultBeanFactory() throws Exception { beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory); reader.loadBeanDefinitions(new ClassPathResource(getClass().getSimpleName() + "-context.xml", getClass())); } @Test public void testTemplate() throws Exception { AmqpTemplate template = beanFactory.getBean("template", AmqpTemplate.class); assertNotNull(template); assertEquals(Boolean.FALSE, TestUtils.getPropertyValue(template, "mandatoryExpression.value")); assertNull(TestUtils.getPropertyValue(template, "returnCallback")); assertNull(TestUtils.getPropertyValue(template, "confirmCallback")); } @Test public void testTemplateWithCallbacks() throws Exception { AmqpTemplate template = beanFactory.getBean("withCallbacks", AmqpTemplate.class); assertNotNull(template); assertEquals("true", TestUtils.getPropertyValue(template, "mandatoryExpression.literalValue")); assertNotNull(TestUtils.getPropertyValue(template, "returnCallback")); assertNotNull(TestUtils.getPropertyValue(template, "confirmCallback")); } @Test public void testTemplateWithMandatoryExpression() throws Exception { AmqpTemplate template = beanFactory.getBean("withMandatoryExpression", AmqpTemplate.class); assertNotNull(template); assertEquals("'true'", TestUtils.getPropertyValue(template, "mandatoryExpression.expression")); } @Test public void testKitchenSink() throws Exception { RabbitTemplate template = beanFactory.getBean("kitchenSink", RabbitTemplate.class); assertNotNull(template); assertTrue(template.getMessageConverter() instanceof SerializerMessageConverter); DirectFieldAccessor accessor = new DirectFieldAccessor(template); assertEquals("foo", accessor.getPropertyValue("correlationKey")); assertSame(beanFactory.getBean(RetryTemplate.class), accessor.getPropertyValue("retryTemplate")); } @Test public void testWithReplyQ() throws Exception { RabbitTemplate template = beanFactory.getBean("withReplyQ", RabbitTemplate.class); assertNotNull(template); DirectFieldAccessor dfa = new DirectFieldAccessor(template); assertNull(dfa.getPropertyValue("correlationKey")); Queue queue = (Queue) dfa.getPropertyValue("replyQueue"); assertNotNull(queue); Queue queueBean = beanFactory.getBean("reply.queue", Queue.class); assertSame(queueBean, queue); SimpleMessageListenerContainer container = beanFactory.getBean("withReplyQ.replyListener", SimpleMessageListenerContainer.class); assertNotNull(container); dfa = new DirectFieldAccessor(container); assertSame(template, dfa.getPropertyValue("messageListener")); SimpleMessageListenerContainer messageListenerContainer = beanFactory.getBean(SimpleMessageListenerContainer.class); dfa = new DirectFieldAccessor(messageListenerContainer); Collection<?> queueNames = (Collection<?>) dfa.getPropertyValue("queueNames"); assertEquals(1, queueNames.size()); assertEquals(queueBean.getName(), queueNames.iterator().next()); } }
[ "527474541@qq.com" ]
527474541@qq.com
2aad8c462f068efcd003dc080d89d5e36653c250
15fabe6c9857d68f446164c48c4bab6f58add7ed
/app/src/main/java/com/android/chengshijian/searchplus/activity/OneKeyAssessActivity.java
f85a84d366e1886ea9495603266bea6ae5e8c239
[ "Apache-2.0" ]
permissive
Chengshijian/SearchPlus
524e23d4245a2d89c4df25bc9d99ac638cd0b09b
f33ddd8164550daeb4963fb340e15d1f4ab8c380
refs/heads/master
2021-09-04T16:05:35.364380
2018-01-20T05:43:52
2018-01-20T05:43:52
117,981,739
6
0
null
null
null
null
UTF-8
Java
false
false
6,868
java
package com.android.chengshijian.searchplus.activity; import android.os.Build; import android.support.annotation.NonNull; import android.support.design.widget.FloatingActionButton; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import com.android.chengshijian.searchplus.R; import com.android.chengshijian.searchplus.listener.OnAssessListener; import com.android.chengshijian.searchplus.model.Assess; import com.android.chengshijian.searchplus.util.DataUtil; import com.android.chengshijian.searchplus.util.LnpuAssessUtil; import com.android.chengshijian.searchplus.util.ToastUtil; import com.github.lzyzsd.circleprogress.DonutProgress; import java.util.List; /** * * 一键评教类 * * Created by ChengShiJian on 2018/1/11. */ public class OneKeyAssessActivity extends BaseActivity implements OnClickListener, OnAssessListener { private DonutProgress mProgress; private TextView mContentTv; private FloatingActionButton mOneKeyAssessFb; private StringBuffer mAssessContent = new StringBuffer(); private int mNowTeacherNum = 0; private int mTotalTeacherNum = 0; @Override public void initListener() { mOneKeyAssessFb.setOnClickListener(this); } @Override public int getLayoutResId() { return R.layout.activity_one_key_assess; } @Override public void initView() { mProgress = findViewById(R.id.progress); mContentTv = findViewById(R.id.content); mOneKeyAssessFb = findViewById(R.id.one_key); } @Override public void initData() { mProgress.setMax(100); setActionBarTitle(R.string.one_key_assess); setDisplayHomeAsUpEnabled(true); transparentNavigationBar(); removeElevation(); } /** * 去除ActionBar的阴影 * */ private void removeElevation() { if (Build.VERSION.SDK_INT >= 21) { getSupportActionBar().setElevation(0); } } @Override public void onClick(View view) { switch (view.getId()) { case R.id.one_key: oneKeyAssess(); break; } } private void oneKeyAssess() { /** * * 开启一个线程开始评教 * */ new Thread(new Runnable() { @Override public void run() { LnpuAssessUtil.oneKeyAsess(OneKeyAssessActivity.this); } }).start(); } @Override public void onLoginDataOutOfTime() { /** * * 调用runOnUiThread方法,在UI线程(主线程上)更新UI * */ runOnUiThread(new Runnable() { @Override public void run() { ToastUtil.showShortToast("超时!"); } }); } @Override public void onAssessTeacherDataReceived(final List<Assess> infos) { if (infos.size() != 0) { mNowTeacherNum = infos.size(); mTotalTeacherNum = mNowTeacherNum; final StringBuilder builder = getReceivedTeacherDataMsg(infos); runOnUiThread(new Runnable() { @Override public void run() { mAssessContent .append("共获得") .append(infos.size()) .append("位教师信息...\n") .append("分别为:") .append(builder) .append("\n") .append("系统将会为上述教师自动评分...\n") .append("-------------------------------------------------------\n"); mContentTv.setText(mAssessContent.toString()); } }); } else { DataUtil.addOneKeyAssessInfoToHistory("对不起系统暂未开放,请等到开放时再试,谢谢配合!"); runOnUiThread(new Runnable() { @Override public void run() { mContentTv.setText("对不起系统暂未开放,请等到开放时再试,谢谢配合!"); } }); } } @NonNull private StringBuilder getReceivedTeacherDataMsg(List<Assess> infos) { final StringBuilder builder = new StringBuilder(); for (Assess assess : infos) { builder.append(assess.getName()).append(" "); } return builder; } @Override public void onAssessTeacherDataError(Class volleyErrorClass) { runOnUiThread(new Runnable() { @Override public void run() { mAssessContent.append("获取教师数据时出错!\n"); mContentTv.setText(mAssessContent.toString()); } }); DataUtil.addOneKeyAssessInfoToHistory("获取评教基础数据时出错!"); } @Override public void onAssessSuccess() { runOnUiThread(new Runnable() { @Override public void run() { mProgress.setProgress(100); mAssessContent.append("恭喜您,评教完成!\n"); mContentTv.setText(mAssessContent.toString()); } }); DataUtil.addOneKeyAssessInfoToHistory("获取评教基础数据时出错!"); } @Override public void onAssessBaseDataError(Class volleyErrorClass) { runOnUiThread(new Runnable() { @Override public void run() { mAssessContent.append("获取评教基础数据时出错!\n"); mContentTv.setText(mAssessContent.toString()); } }); DataUtil.addOneKeyAssessInfoToHistory("获取评教基础数据时出错!"); } @Override public void onStartAssessForTeacher(final Assess assess) { runOnUiThread(new Runnable() { @Override public void run() { mAssessContent.append("正在给").append(assess.getName()).append("老师评分...\n"); mContentTv.setText(mAssessContent.toString()); } }); DataUtil.addOneKeyAssessInfoToHistory("正在给"+assess.getName()+"老师评分..."); } @Override public void onAssessForTeacherFinished(String resultHtml, final Assess assess) { mNowTeacherNum--; runOnUiThread(new Runnable() { @Override public void run() { mProgress.setProgress((int) (100 - ((float) mNowTeacherNum / mTotalTeacherNum) * 100)); mAssessContent.append("给" + assess.getName() + "老师评分完成!\n"); mContentTv.setText(mAssessContent.toString()); } }); } }
[ "790210145@qq.com" ]
790210145@qq.com
04c6b7719bf9f4fca2372df806f84cb22aba9551
45b557c70b2966689c532ec2847875fb760af7d7
/IRIS/OpenflowJ-IRIS/src/org/openflow/util/HexString.java
f5732259ded5347346737407eba7d8f078cfe49f
[]
no_license
Hyunjeong/IRIS_ARPManger
e5d4021b5abe6e7aad90b6b5b34d7730b2256040
818e0824ecd8b34d5a7b5c06b86974042713db25
refs/heads/master
2016-09-05T22:49:57.394235
2014-03-25T01:47:04
2014-03-25T01:47:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,344
java
package org.openflow.util; import java.math.BigInteger; public class HexString { /** * Convert a string of bytes to a ':' separated hex string * @param bytes * @return "0f:ca:fe:de:ad:be:ef" */ public static String toHexString(byte[] bytes) { int i; String ret = ""; String tmp; for(i=0; i< bytes.length; i++) { if(i> 0) ret += ":"; tmp = Integer.toHexString(U8.f(bytes[i])); if (tmp.length() == 1) ret += "0"; ret += tmp; } return ret; } public static String toHexString(long val, int padTo) { char arr[] = Long.toHexString(val).toCharArray(); String ret = ""; // prepend the right number of leading zeros int i = 0; for (; i < (padTo * 2 - arr.length); i++) { ret += "0"; if ((i % 2) == 1) ret += ":"; } for (int j = 0; j < arr.length; j++) { ret += arr[j]; if ((((i + j) % 2) == 1) && (j < (arr.length - 1))) ret += ":"; } return ret; } public static String toHexString(long val) { return toHexString(val, 8); } /** * Convert a string of hex values into a string of bytes * @param values "0f:ca:fe:de:ad:be:ef" * @return [15, 5 ,2, 5, 17] * @throws NumberFormatException If the string can not be parsed */ public static byte[] fromHexString(String values) throws NumberFormatException { String[] octets = values.split(":"); byte[] ret = new byte[octets.length]; for(int i = 0; i < octets.length; i++) { if (octets[i].length() > 2) throw new NumberFormatException("Invalid octet length"); ret[i] = Integer.valueOf(octets[i], 16).byteValue(); } return ret; } public static long toLong(String values) throws NumberFormatException { // Long.parseLong() can't handle HexStrings with MSB set. Sigh. BigInteger bi = new BigInteger(values.replaceAll(":", ""),16); if (bi.bitLength() > 64) throw new NumberFormatException("Input string too big to fit in long: " + values); return bi.longValue(); } }
[ "hoonai14@kaist.ac.kr" ]
hoonai14@kaist.ac.kr
fde5089f809476ce353b0b6402ad6ed7800e1696
4114e7371af1da819a1c7a11ccc63a7961fd3c11
/kb/src/main/java/com/bbn/akbc/evaluation/tac/io/DocTheoryLoader.java
a4c88b412cb41bd88dd79f590f26719ae63ec924
[ "Apache-2.0" ]
permissive
BBN-E/LearnIt
dad4e71da2e2028875807545ce75801067a7dd37
4f602f113cac9f4a7213b348a42c0fef23e2739c
refs/heads/master
2022-12-18T22:15:11.877626
2021-09-09T04:28:31
2021-09-09T04:28:31
193,987,875
8
2
Apache-2.0
2022-12-10T21:02:36
2019-06-26T22:53:56
Java
UTF-8
Java
false
false
3,370
java
package com.bbn.akbc.evaluation.tac.io; import com.bbn.akbc.resource.Resources; import com.bbn.serif.io.SerifXMLLoader; import com.bbn.serif.theories.DocTheory; import com.google.common.base.Optional; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; public class DocTheoryLoader { static Map<String, DocTheory> docId2docTheory = new HashMap<String, DocTheory>(); public static Optional<DocTheory> getDocTheory(String docid) { if (docId2docTheory.containsKey(docid)) { return Optional.of(docId2docTheory.get(docid)); } String strPathSerifXml = Resources.getPathSerifXml() + docid; File fileSerifXml = new File(strPathSerifXml); if (!fileSerifXml.exists()) { strPathSerifXml = Resources.getPathSerifXml() + docid + ".xml"; fileSerifXml = new File(strPathSerifXml); if (!fileSerifXml.exists()) { strPathSerifXml = Resources.getPathSerifXml() + docid + ".sgm.xml"; fileSerifXml = new File(strPathSerifXml); } if (!fileSerifXml.exists()) { strPathSerifXml = Resources.getPathSerifXml() + docid + ".serifxml.xml"; fileSerifXml = new File(strPathSerifXml); } if (!fileSerifXml.exists()) { strPathSerifXml = Resources.getPathSerifXml() + docid + ".mpdf.serifxml.xml"; fileSerifXml = new File(strPathSerifXml); } } try { SerifXMLLoader fromXML = SerifXMLLoader.fromStandardACETypes(); // File fileSerifXml = new File(strPathSerifXml); if (!fileSerifXml.exists()) { System.err.println("File NOT found: " + strPathSerifXml); return Optional.absent(); } DocTheory dt = fromXML.loadFrom(fileSerifXml); docId2docTheory.put(docid, dt); return Optional.of(dt); } catch (IOException e) { e.printStackTrace(); //code to handle an IOException here System.err.println("Exception in reading: " + strPathSerifXml); } return Optional.absent(); } public static Optional<DocTheory> getDocTheoryFromFile(String strPathSerifXml) { File fileSerifXml = new File(strPathSerifXml); try { // SerifXMLLoader fromXML = SerifXMLLoader.fromStandardACETypes(); SerifXMLLoader fromXML = SerifXMLLoader.fromStandardACETypes(true); if (!fileSerifXml.exists()) { System.err.println("File NOT found: " + strPathSerifXml); return Optional.absent(); } DocTheory dt = fromXML.loadFrom(fileSerifXml); return Optional.of(dt); } catch (IOException e) { e.printStackTrace(); //code to handle an IOException here System.err.println("Exception in reading: " + strPathSerifXml); } return Optional.absent(); } public static String getTextTagsEscaped(String docText) { return docText.replace("<", "_").replace(">", "_").replace("/", "_").replace("\\", "_"); } public static Optional<DocTheory> readDocTheory(String strFileDocTheory) { try { SerifXMLLoader fromXML = SerifXMLLoader.fromStandardACETypes(); DocTheory dt = fromXML.loadFrom(new File(strFileDocTheory)); return Optional.of(dt); } catch (IOException e) { e.printStackTrace(); //code to handle an IOException here System.err.println("Exception in reading: " + strFileDocTheory); } return Optional.absent(); } }
[ "hqiu@bbn.com" ]
hqiu@bbn.com
7c15075d9c1ea8ed433cf6b3fe941d79378d5aa6
2eb2eaa0c9fb8b73017750271e08f384b78f8d18
/src/com/wzy/tfidf/LastReducer.java
e39d2125ea238544b3e611ad4d0d4874b23b179e
[]
no_license
financo/BigData
1e8bcdf9287aae317f98f21f8d3c0a1d5ce8f55d
e2eea63cf39c3674675a503b5458053b1386f90a
refs/heads/master
2021-05-12T00:36:02.482553
2018-01-15T11:50:38
2018-01-15T11:50:38
117,538,632
1
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.wzy.tfidf; import java.io.IOException; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Reducer; public class LastReducer extends Reducer<Text, Text, Text, Text>{ @Override protected void reduce(Text text, Iterable<Text> iterable, Context context) throws IOException, InterruptedException { StringBuffer sb = new StringBuffer(); for (Text i : iterable) { sb.append(i.toString() + "\t"); } context.write(text, new Text(sb.toString())); } }
[ "121260020@qq.com" ]
121260020@qq.com
d9a311bf1530b0903a73e1ff5ad34e59cde46cc9
b2890f4e3aee5d7e7ec2fdeb53b6cbaf9efb9e24
/src/main/java/PageObjects/WishListsPage.java
a05a72b8a2a361099561e67d7b8600b1c1b81201
[]
no_license
igorchupin/Final-Task
0cae8eea3e9ea2ec2d18bc11dea2bbf9eb73dd09
2ebaa485734b4c96d5650b875fd1c3ac51a76d2d
refs/heads/master
2023-08-18T05:40:19.523013
2021-09-07T07:23:38
2021-09-07T07:23:38
400,069,323
0
0
null
2021-09-07T07:23:38
2021-08-26T06:48:48
null
UTF-8
Java
false
false
3,274
java
package PageObjects; import DriverTools.SingleDriver; import org.openqa.selenium.*; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.io.IOException; import java.util.List; import java.util.Random; public class WishListsPage { private final WebDriver driver; private final By saveButton = By.id("submitWishlist"); private final By wishListsTable = By.id("block-history"); private final By products = By.xpath("//a[@class=\"product-name\"]"); private final By wishListLink = By.xpath("//tr[contains(@id, 'wishlist_')]/td[1]/a"); private final By productTitle = By.id("s_title"); private final By deleteListLink = By.xpath("//td[@class='wishlist_delete']/a"); private final By wishListNameField = By.id("name"); private final By openCartLink = By.xpath("//a[@title='View my shopping cart']"); private List<WebElement> productsList; public WishListsPage() throws IOException { driver = SingleDriver.getSingleDriverInstance().getDriver(); WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.visibilityOfElementLocated(saveButton)); } public boolean getWishListsTable() throws NoSuchElementException { boolean result; try { driver.findElement(wishListsTable); result = true; } catch (NoSuchElementException e) { result = false; } return result; } private int random () { productsList = driver.findElements(products); int rndItem = new Random().nextInt(productsList.size()); return rndItem; } public ProductPage getProduct () throws IOException { productsList = driver.findElements(products); WebElement product = productsList.get(random()); product.click(); return new ProductPage(); } public WishListsPage openWishList () { driver.findElement(wishListLink).click(); WebDriverWait wait = new WebDriverWait(driver, 10); wait.until(ExpectedConditions.visibilityOfElementLocated(productTitle)); return this; } public String getProductNameFromList () { return driver.findElement(productTitle).getText(); } public WishListsPage deleteWishList () { driver.findElement(deleteListLink).click(); WebDriverWait wait = new WebDriverWait(driver, 10); Alert alert = wait.until(ExpectedConditions.alertIsPresent()); alert.accept(); return this; } public String generateListName () { String tempName = ""; for (int i = 0; i <= 10 ; i++) { int rndChar = 97 + (new Random().nextInt(122 - 97)); Character tempChar = (char) rndChar; tempName = tempName + tempChar; } return tempName; } public WishListsPage createWishList () { driver.findElement(wishListNameField).sendKeys(generateListName()); driver.findElement(saveButton).click(); return this; } public CartPage openCart () throws IOException { driver.findElement(openCartLink).click(); return new CartPage(); } }
[ "ghostey1989@gmail.com" ]
ghostey1989@gmail.com
c094509be79f7610a8fc7613e3f9be2e8eabe112
c174bf98b0e24c34d96d90d7a00fa0a8c647d89d
/Android App/app/src/main/java/com/example/boshen/ghost_gear/server.java
2bc0bb5ca218907fc9b164a59313bb7460011884
[]
no_license
Broshen/ghostgear
0ad4722466bdc3647021763265c555047cd3827b
4e15d4b4a75e9ed6de961842159292805bac1708
refs/heads/master
2021-01-17T10:33:16.808899
2016-07-01T22:41:03
2016-07-01T22:41:03
56,897,298
0
0
null
null
null
null
UTF-8
Java
false
false
8,744
java
package com.example.boshen.ghost_gear; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; import android.os.AsyncTask; import android.os.Parcel; import android.os.Parcelable; import android.support.v7.app.AlertDialog; import android.util.Log; import com.google.android.gms.maps.model.LatLng; import org.json.JSONArray; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; import java.util.ArrayList; import java.util.List; /** * Created by Boshen on 4/23/2016. */ public class server extends Activity { String url_post = "http://boshencui.com/postTrap.php"; String url_get ="http://boshencui.com/getTrap.php"; String url_getall = "http://boshencui.com/getAllTraps.php"; String user, Id, latitute, longitute; String [] ids; double [] lats; double [] longs; boolean [] publics; List <String> displaylist; String [] times; int arrlen; int ispublic; public void logTrap(String id, double lat, double longit, boolean ispub){ Id=id; latitute=Double.toString(lat); longitute=Double.toString(longit); if(ispub) ispublic = 1; else ispublic = 0; postTrap pt = new postTrap(); pt.execute(); } public void getAllTraps(){ getAllTraps gat = new getAllTraps(); try{ gat.execute().get(); } catch(Exception e){ Log.d("trap", e.getMessage()); } } public void getMyTraps(String id){ user=id; getMyTraps gmt = new getMyTraps(); try{ gmt.execute().get(); } catch(Exception e){ Log.d("trap", e.getMessage()); } } class postTrap extends AsyncTask<String, Void, String> { protected String doInBackground(String... args){ try { URL url = new URL(url_post); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); urlConnection.setDoOutput(true); OutputStream os = urlConnection.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); Log.d("posttrap async", ispublic+""); writer.write("user="+user+"&id="+Id+"&lat="+latitute+"&long="+longitute+"&ispub="+ispublic); writer.flush(); writer.close(); os.close(); InputStream is = urlConnection.getInputStream(); BufferedReader r = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = r.readLine()) != null) { total.append(line); } line = total.toString(); Log.d("posttrap", line); return line; } catch(Exception e){ Log.d("posttrap err", e.getMessage()); } return null; } protected void onPostExecute(String s) { try { JSONObject result = new JSONObject(s); if(result.getInt("success") == 1) { Log.d("posttrap", "success!!"); } else { Log.d("posttrap", "not posted!"); } } catch(Exception e){ Log.d("posttrap err1", e.getMessage()); } } } class getAllTraps extends AsyncTask<String, Void, String> { protected String doInBackground(String... args){ try { URL url = new URL(url_getall); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); urlConnection.setDoOutput(true); InputStream is = urlConnection.getInputStream(); BufferedReader r = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = r.readLine()) != null) { total.append(line); } line = total.toString(); Log.d("posttrap", line); Log.d("trap", "duringexecute"); try { JSONArray result = new JSONArray(line); arrlen = result.length(); lats = new double[arrlen]; longs = new double[arrlen]; times = new String[arrlen]; Log.d("trap", "arrlength" + arrlen); for(int i=0; i< result.length(); i++) { lats[i]= result.getJSONArray(i).getDouble(0); longs[i]= result.getJSONArray(i).getDouble(1); times[i]= result.getJSONArray(i).getString(2); } } catch(Exception e){ Log.d("posttrap err1", e.getMessage()); } return line; } catch(Exception e){ Log.d("posttrap err", e.getMessage()); } return null; } } class getMyTraps extends AsyncTask<String, Void, String>{ protected String doInBackground(String... args){ try { URL url = new URL(url_get); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(); urlConnection.setDoOutput(true); OutputStream os = urlConnection.getOutputStream(); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(os, "UTF-8")); writer.write("user="+user); writer.flush(); writer.close(); os.close(); InputStream is = urlConnection.getInputStream(); BufferedReader r = new BufferedReader(new InputStreamReader(is)); StringBuilder total = new StringBuilder(); String line; while ((line = r.readLine()) != null) { total.append(line); } line = total.toString(); Log.d("posttrap", line); try { JSONArray result = new JSONArray(line); arrlen = result.length(); displaylist=new ArrayList<String>(); for(int i=0; i< result.length(); i++) { String row = "Trap ID: " + result.getJSONArray(i).getString(0) + "\nLatitute: " + result.getJSONArray(i).getDouble(1) + "\nLongitute: " + result.getJSONArray(i).getDouble(2) +"\n Open to public? " + result.getJSONArray(i).getString(3) +"\n Time posted: " + result.getJSONArray(i).getString(4) +"\n Delete"; displaylist.add(row); } } catch(Exception e){ Log.d("posttrap err1", e.getMessage()); } return line; } catch(Exception e){ Log.d("posttrap err", e.getMessage()); } return null; } protected void onPostExecute(String s) { try { JSONArray result = new JSONArray(s); arrlen = result.length(); displaylist=new ArrayList<String>(); for(int i=0; i< result.length(); i++) { String row = "Trap ID: " + result.getJSONArray(i).getString(0) + "\nLatitute: " + result.getJSONArray(i).getDouble(1) + "\nLongitute: " + result.getJSONArray(i).getDouble(2) +"\nOpen to public? " + result.getJSONArray(i).getString(3) +"\nTime posted: " + result.getJSONArray(i).getString(4) +"\nDelete"; displaylist.add(row); } } catch(Exception e){ Log.d("posttrap err1", e.getMessage()); } } } }
[ "boshen.cui@gmail.com" ]
boshen.cui@gmail.com
c3d646ba0c703589c7dc7616764eaf1e6b07311d
7e16d7f4d1906af3fa5bd3683fe72c8b304945c8
/salary-calculator-impl/src/test/java/org/fluidity/wages/impl/SalaryCalculatorIntegrationTest.java
d3373dbb712a35fa4e8e226820b080080ad70afb
[ "Apache-2.0" ]
permissive
aqueance/salary-calculator
f6cf5c3358916318f7c2b4af5f30cd973d2eead5
b07244f69840276a9371a4c267961ce6fff0b937
refs/heads/master
2020-04-17T20:43:21.406019
2016-08-24T21:19:42
2016-08-24T21:20:32
66,145,219
0
0
null
null
null
null
UTF-8
Java
false
false
31,463
java
/* * Copyright (c) 2016 Tibor Adam Varga (tibor.adam.varga on gmail) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.fluidity.wages.impl; import java.time.LocalDate; import java.time.LocalTime; import java.time.Month; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.function.Consumer; import org.fluidity.wages.BatchProcessor; import org.fluidity.wages.SalaryDetails; import org.fluidity.wages.ShiftDetails; import org.testng.Assert; import org.testng.annotations.Test; public final class SalaryCalculatorIntegrationTest extends SalaryCalculatorAbstractTest { /** * Creates a new subject to test. * * @param settings the settings to use. * @param consumer the consumer to use. * * @return a new subject; never <code>null</code>. */ private SalaryCalculatorPipeline createPipeline(final SalaryCalculatorSettings settings, final Consumer<SalaryDetails> consumer) { return new SalaryCalculatorPipeline(createStageFactory(settings), settings, consumer); } @Test @SuppressWarnings({ "EmptyTryBlock", "unused" }) public void acceptsEmptyList() throws Exception { final SalaryCalculatorSettings settings = settings("Europe/Helsinki", 100, Collections.singletonList(regularRate(0, LocalTime.MIDNIGHT, LocalTime.MIDNIGHT)), Collections.emptyList()); final List<SalaryDetails> salary = new ArrayList<>(); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { // empty } Assert.assertTrue(salary.isEmpty()); }); } @Test public void computesSalaryForOneHourShift() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 all day Collections.singletonList(regularRate(0, LocalTime.MIDNIGHT, LocalTime.MIDNIGHT)), // no overtime Collections.emptyList() ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId = "1"; final List<ShiftDetails> shifts = Collections.singletonList( new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(12, 0), LocalTime.of(13, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 1); final SalaryDetails details = salary.get(0); Assert.assertEquals(details.personId, personId); Assert.assertEquals(details.amountBy100, baseRate); // 1 hour on regular rate // verify the month Assert.assertEquals(details.month.getYear(), year); Assert.assertEquals(details.month.getMonth(), month); Assert.assertEquals(details.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoOneHourShifts() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 all day Collections.singletonList(regularRate(0, LocalTime.MIDNIGHT, LocalTime.MIDNIGHT)), // no overtime Collections.emptyList() ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId = "1"; final List<ShiftDetails> shifts = Arrays.asList( new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(12, 0), LocalTime.of(13, 0)), new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(14, 0), LocalTime.of(15, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 1); final SalaryDetails details = salary.get(0); Assert.assertEquals(details.personId, personId); Assert.assertEquals(details.amountBy100, 2 * baseRate); // 2 hours on regular rate // verify the month Assert.assertEquals(details.month.getYear(), year); Assert.assertEquals(details.month.getMonth(), month); Assert.assertEquals(details.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForOneHourShiftsInTwoDays() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 all day Collections.singletonList(regularRate(0, LocalTime.MIDNIGHT, LocalTime.MIDNIGHT)), // no overtime Collections.emptyList() ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId = "1"; final List<ShiftDetails> shifts = Arrays.asList( new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(12, 0), LocalTime.of(13, 0)), new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 2), LocalTime.of(14, 0), LocalTime.of(15, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 1); final SalaryDetails details = salary.get(0); Assert.assertEquals(details.personId, personId); Assert.assertEquals(details.amountBy100, 2 * baseRate); // 2 hours on regular rate // verify the month Assert.assertEquals(details.month.getYear(), year); Assert.assertEquals(details.month.getMonth(), month); Assert.assertEquals(details.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoOvertimeLevelsWithinOneShift() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final int eveningRate = 50; final int overtimeLevel1Percent = 20; final int overtimeLevel2Percent = 30; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 from 10:00 to 15:00 // evening hours $1.50 from 15:00 to 10:00 Arrays.asList(regularRate(eveningRate, LocalTime.MIDNIGHT, LocalTime.of(10, 0)), regularRate(0, LocalTime.of(10, 0), LocalTime.of(15, 0)), regularRate(eveningRate, LocalTime.of(15, 0), LocalTime.MIDNIGHT)), // overtime compensation: // +20% from 4 hours // +30% from 6 hours Arrays.asList(overtimeRate(overtimeLevel1Percent, 4, 0), overtimeRate(overtimeLevel2Percent, 6, 0)) ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId = "1"; final List<ShiftDetails> shifts = Collections.singletonList( // 3 hours on regular shift = 3 hours regular rate // 4 hours on evening shift = 1 hour evening rate + 2 hours overtime level 1 + 1 hour overtime level 2 new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(12, 0), LocalTime.of(19, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 1); final SalaryDetails details = salary.get(0); Assert.assertEquals(details.personId, personId); Assert.assertEquals(details.amountBy100, Math.round(3 * baseRate + (baseRate + eveningRate) + 2 * ((float) (baseRate + eveningRate) + (float) baseRate * (float) overtimeLevel1Percent / (float) 100) + (float) (baseRate + eveningRate) + (float) baseRate * (float) overtimeLevel2Percent / (float) 100)); // verify the month Assert.assertEquals(details.month.getYear(), year); Assert.assertEquals(details.month.getMonth(), month); Assert.assertEquals(details.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoShiftsOnDifferentRegularRates() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final int eveningRate = 50; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 from 10:00 to 15:00 // evening hours $1.50 from 15:00 to 10:00 Arrays.asList(regularRate(eveningRate, LocalTime.MIDNIGHT, LocalTime.of(10, 0)), regularRate(0, LocalTime.of(10, 0), LocalTime.of(15, 0)), regularRate(eveningRate, LocalTime.of(15, 0), LocalTime.MIDNIGHT)), // no overtime Collections.emptyList() ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId = "1"; final List<ShiftDetails> shifts = Arrays.asList( new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(10, 0), LocalTime.of(11, 0)), new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 2), LocalTime.of(15, 0), LocalTime.of(16, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 1); final SalaryDetails details = salary.get(0); Assert.assertEquals(details.personId, personId); Assert.assertEquals(details.amountBy100, baseRate + baseRate + eveningRate); // 1 hour on each rate // verify the month Assert.assertEquals(details.month.getYear(), year); Assert.assertEquals(details.month.getMonth(), month); Assert.assertEquals(details.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoShiftsOnDifferentOvertimeRates() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final int eveningRate = 50; final int overtimeLevel1Percent = 20; final int overtimeLevel2Percent = 30; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 from 10:00 to 15:00 // evening hours $1.50 from 15:00 to 10:00 Arrays.asList(regularRate(eveningRate, LocalTime.MIDNIGHT, LocalTime.of(10, 0)), regularRate(0, LocalTime.of(10, 0), LocalTime.of(15, 0)), regularRate(eveningRate, LocalTime.of(15, 0), LocalTime.MIDNIGHT)), // overtime compensation: // +20% from 4 hours // +30% from 6 hours Arrays.asList(overtimeRate(overtimeLevel1Percent, 4, 0), overtimeRate(overtimeLevel2Percent, 6, 0)) ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId = "1"; final List<ShiftDetails> shifts = Arrays.asList( // 3 hours on regular rate + 1 hour evening rate + 2 hours overtime level 1 new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(12, 0), LocalTime.of(18, 0)), // 1 hour overtime level 2 new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(18, 0), LocalTime.of(19, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 1); final SalaryDetails details = salary.get(0); Assert.assertEquals(details.personId, personId); Assert.assertEquals(details.amountBy100, Math.round(3 * baseRate + (baseRate + eveningRate) + 2 * ((float) (baseRate + eveningRate) + (float) baseRate * (float) overtimeLevel1Percent / (float) 100) + (float) (baseRate + eveningRate) + (float) baseRate * (float) overtimeLevel2Percent / (float) 100)); // verify the month Assert.assertEquals(details.month.getYear(), year); Assert.assertEquals(details.month.getMonth(), month); Assert.assertEquals(details.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoShiftsOnDifferentOvertimeRatesSkippingOneRegularLevel() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final int eveningRate = 50; final int overtimeLevel1Percent = 20; final int overtimeLevel2Percent = 30; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 from 10:00 to 15:00 // evening hours $1.50 from 15:00 to 10:00 Arrays.asList(regularRate(eveningRate, LocalTime.MIDNIGHT, LocalTime.of(10, 0)), regularRate(0, LocalTime.of(10, 0), LocalTime.of(15, 0)), regularRate(eveningRate, LocalTime.of(15, 0), LocalTime.MIDNIGHT)), // overtime compensation: // +20% from 4 hours // +30% from 6 hours Arrays.asList(overtimeRate(overtimeLevel1Percent, 4, 0), overtimeRate(overtimeLevel2Percent, 6, 0)) ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId = "1"; final List<ShiftDetails> shifts = Arrays.asList( // 4 hours on regular rate + 0 hour evening rate + 2 hours overtime level 1 new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(11, 0), LocalTime.of(17, 0)), // 1 hour overtime level 2 new ShiftDetails(personId, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(18, 0), LocalTime.of(19, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 1); final SalaryDetails details = salary.get(0); Assert.assertEquals(details.personId, personId); Assert.assertEquals(details.amountBy100, Math.round(4 * baseRate + 2 * ((float) (baseRate + eveningRate) + (float) baseRate * (float) overtimeLevel1Percent / (float) 100) + (float) (baseRate + eveningRate) + (float) baseRate * (float) overtimeLevel2Percent / (float) 100)); // verify the month Assert.assertEquals(details.month.getYear(), year); Assert.assertEquals(details.month.getMonth(), month); Assert.assertEquals(details.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoPeople() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final int eveningRate = 50; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 from 10:00 to 15:00 // evening hours $1.50 from 15:00 to 10:00 Arrays.asList(regularRate(eveningRate, LocalTime.MIDNIGHT, LocalTime.of(10, 0)), regularRate(0, LocalTime.of(10, 0), LocalTime.of(15, 0)), regularRate(eveningRate, LocalTime.of(15, 0), LocalTime.MIDNIGHT)), // no overtime Collections.emptyList() ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month = Month.JANUARY; final String personId1 = "1"; final String personId2 = "2"; final List<ShiftDetails> shifts = Arrays.asList( new ShiftDetails(personId1, "John Doe", LocalDate.of(year, month, 1), LocalTime.of(12, 0), LocalTime.of(13, 0)), new ShiftDetails(personId2, "Jane Doe", LocalDate.of(year, month, 2), LocalTime.of(16, 0), LocalTime.of(17, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 2); final SalaryDetails details1 = salary.get(1); // salary records are sorted by person name Assert.assertEquals(details1.personId, personId1); Assert.assertEquals(details1.amountBy100, baseRate); // 1 hour on regular rate // verify the month Assert.assertEquals(details1.month.getYear(), year); Assert.assertEquals(details1.month.getMonth(), month); Assert.assertEquals(details1.month.getDayOfMonth(), 1); final SalaryDetails details2 = salary.get(0); // salary records are sorted by person name Assert.assertEquals(details2.personId, personId2); Assert.assertEquals(details2.amountBy100, baseRate + eveningRate); // 1 hour on the evening rate // verify the month Assert.assertEquals(details2.month.getYear(), year); Assert.assertEquals(details2.month.getMonth(), month); Assert.assertEquals(details2.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoMonths() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 all day Collections.singletonList(regularRate(0, LocalTime.MIDNIGHT, LocalTime.MIDNIGHT)), // no overtime Collections.emptyList() ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month1 = Month.JANUARY; final Month month2 = Month.FEBRUARY; final String personId = "1"; final List<ShiftDetails> shifts = Arrays.asList( new ShiftDetails(personId, "John Doe", LocalDate.of(year, month1, 1), LocalTime.of(12, 0), LocalTime.of(13, 0)), new ShiftDetails(personId, "John Doe", LocalDate.of(year, month2, 1), LocalTime.of(14, 0), LocalTime.of(15, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { shifts.forEach(subject); } Assert.assertEquals(salary.size(), 2); final SalaryDetails details1 = salary.get(0); Assert.assertEquals(details1.personId, personId); Assert.assertEquals(details1.amountBy100, baseRate); // 1 hour on base rate // verify the month Assert.assertEquals(details1.month.getYear(), year); Assert.assertEquals(details1.month.getMonth(), month1); Assert.assertEquals(details1.month.getDayOfMonth(), 1); final SalaryDetails details2 = salary.get(1); Assert.assertEquals(details2.personId, personId); Assert.assertEquals(details2.amountBy100, baseRate); // 1 hour on base rate // verify the month Assert.assertEquals(details2.month.getYear(), year); Assert.assertEquals(details2.month.getMonth(), month2); Assert.assertEquals(details2.month.getDayOfMonth(), 1); }); } @Test public void computesSalaryForTwoMonthsWithFlushing() throws Exception { final String zoneName = "Europe/Helsinki"; final int baseRate = 100; final SalaryCalculatorSettings settings = settings(zoneName, baseRate, // regular hours $1.00 all day Collections.singletonList(regularRate(0, LocalTime.MIDNIGHT, LocalTime.MIDNIGHT)), // no overtime Collections.emptyList() ); final List<SalaryDetails> salary = new ArrayList<>(); final int year = 2000; final Month month1 = Month.JANUARY; final Month month2 = Month.FEBRUARY; final String personId = "1"; final List<ShiftDetails> shifts1 = Arrays.asList( new ShiftDetails(personId, "John Doe", LocalDate.of(year, month1, 1), LocalTime.of(12, 0), LocalTime.of(13, 0)), new ShiftDetails(personId, "John Doe", LocalDate.of(year, month1, 2), LocalTime.of(14, 0), LocalTime.of(15, 0)) ); final List<ShiftDetails> shifts2 = Arrays.asList( new ShiftDetails(personId, "John Doe", LocalDate.of(year, month2, 1), LocalTime.of(12, 0), LocalTime.of(13, 0)), new ShiftDetails(personId, "John Doe", LocalDate.of(year, month2, 2), LocalTime.of(14, 0), LocalTime.of(15, 0)) ); verify(() -> { try (final BatchProcessor<ShiftDetails> subject = createPipeline(settings, salary::add)) { // send the second month shifts1.forEach(subject); // get the results subject.flush(); // test the results Assert.assertEquals(salary.size(), 1); final SalaryDetails details1 = salary.get(0); Assert.assertEquals(details1.personId, personId); Assert.assertEquals(details1.amountBy100, 2 * baseRate); // 2 hour on base rate // verify the month Assert.assertEquals(details1.month.getYear(), year); Assert.assertEquals(details1.month.getMonth(), month1); Assert.assertEquals(details1.month.getDayOfMonth(), 1); salary.clear(); // send the second month shifts2.forEach(subject); // get the results subject.flush(); // test the results Assert.assertEquals(salary.size(), 1); final SalaryDetails details2 = salary.get(0); Assert.assertEquals(details2.personId, personId); Assert.assertEquals(details2.amountBy100, 2 * baseRate); // 2 hour on base rate // verify the month Assert.assertEquals(details2.month.getYear(), year); Assert.assertEquals(details2.month.getMonth(), month2); Assert.assertEquals(details2.month.getDayOfMonth(), 1); salary.clear(); } // should not have any more results Assert.assertTrue(salary.isEmpty()); }); } }
[ "tibor.adam.varga@gmail.com" ]
tibor.adam.varga@gmail.com
9fb74ae394b98938426ca2f6a7a6704cdf15de2c
17ecbe782e4bb465ee70f4a43c6d774ab62953e3
/source/ocotillo/graph/layout/fdl/defragmenter/Defragmenter.java
8275628280512aaa7696895cfe3ab53bd3a41182
[ "Apache-2.0" ]
permissive
EngAAlex/MultiDynNos
fbde77ccb837abdbe6bffb765bb7ca33748c2c04
068aa79680b7d670d2338493bc9c88f4ffbd3db6
refs/heads/master
2022-11-22T10:54:50.625173
2022-10-03T10:11:11
2022-10-03T10:11:11
355,105,161
0
0
null
null
null
null
UTF-8
Java
false
false
10,443
java
/** * Copyright © 2014-2016 Paolo Simonetto * * 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 ocotillo.graph.layout.fdl.defragmenter; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Set; import ocotillo.geometry.Coordinates; import ocotillo.graph.Edge; import ocotillo.graph.EdgeAttribute; import ocotillo.graph.Graph; import ocotillo.graph.Node; import ocotillo.graph.NodeAttribute; import ocotillo.graph.StdAttribute; import ocotillo.graph.StdAttribute.ControlPoints; import ocotillo.graph.layout.fdl.modular.ModularConstraint; import ocotillo.graph.layout.fdl.modular.ModularFdl; import ocotillo.graph.layout.fdl.modular.ModularForce; import ocotillo.graph.layout.fdl.modular.ModularPostProcessing; /** * Compacts the cluster nodes of a graph in a contiguous region. */ public class Defragmenter { private final ClusterPlacer clusterPlacer; private final NodePlacer nodePlacer; /** * Builder for Defragmenter. */ public static class DefragmenterBuilder { private ClusterPlacer clusterPlacer; private NodePlacer nodePlacer; /** * Indicates the cluster placer to use in the defragmentation process. * * @param clusterPlacer the cluster placer. * @return the builder. */ public DefragmenterBuilder withClusterPlacer(ClusterPlacer clusterPlacer) { this.clusterPlacer = clusterPlacer; return this; } /** * Indicates the node placer to use in the defragmentation process. * * @param nodePlacer the cluster node placer. * @return the builder. */ public DefragmenterBuilder withNodePlacer(NodePlacer nodePlacer) { this.nodePlacer = nodePlacer; return this; } /** * Builds a defragmenter. * * @return the defragmenter. */ public Defragmenter build() { clusterPlacer = clusterPlacer != null ? clusterPlacer : new ClusterPlacer.OriginalLayoutClusterPlacer(5.0); nodePlacer = nodePlacer != null ? nodePlacer : new NodePlacer.OriginalLayoutNodePlacer(); return new Defragmenter(clusterPlacer, nodePlacer); } } /** * Constructor for a defragmenter. * * @param clusterPlacer the cluster placer to be used. */ private Defragmenter(ClusterPlacer clusterPlacer, NodePlacer nodePlacer) { this.clusterPlacer = clusterPlacer; this.nodePlacer = nodePlacer; } /** * Performs the defragmentation of a graph. * * @param graph the graph. * @param elemDistance the desired element distance. * @param iterations the number of iterations to perform. */ public void defragment(Graph graph, double elemDistance, int iterations) { Graph clusterPlacement = clusterPlacer.computePlacing(graph); NodeAttribute<Coordinates> initialNodePlacement = nodePlacer.computePlacing(graph, clusterPlacement); NodeAttribute<Coordinates> positions = graph.nodeAttribute(StdAttribute.nodePosition); NodeAttribute<Coordinates> originalPositions = new NodeAttribute<>(new Coordinates(0, 0)); originalPositions.copy(positions); for (Node node : graph.nodes()) { positions.set(node, initialNodePlacement.get(node)); } Boundaries boundaries = buildBoundaries(graph, clusterPlacement); ModularFdl modular = new ModularFdl.ModularFdlBuilder(graph) //.withForce(new ModularForce.EdgeAttraction(20)) .withForce(new SetElementsRepulsion(elemDistance, boundaries)) .withForce(new BoundaryEdgeAttraction(elemDistance / 2, boundaries)) .withForce(new ModularForce.SelectedEdgeNodeRepulsion2D(elemDistance / 2, boundaries.edges)) .withConstraint(new ModularConstraint.DecreasingMaxMovement(elemDistance)) .withConstraint(new ModularConstraint.SurroundingEdges(boundaries.surroundingEdges)) .withPostProcessing(new ModularPostProcessing.FlexibleEdges(boundaries.edges, elemDistance, 5 * elemDistance)) .build(); modular.iterate(iterations); modular.close(); removeBoundaries(graph, boundaries); } /** * Builds the cluster boundaries. * * @param graph the graph. * @param clusterPlacement the graph indicating the cluster placement. * @return the boundaries. */ private Boundaries buildBoundaries(Graph graph, Graph clusterPlacement) { Boundaries boundaries = new Boundaries(); NodeAttribute<Coordinates> clusterPositions = clusterPlacement.nodeAttribute(StdAttribute.nodePosition); NodeAttribute<Coordinates> clusterSizes = clusterPlacement.nodeAttribute(StdAttribute.nodeSize); NodeAttribute<Coordinates> positions = graph.nodeAttribute(StdAttribute.nodePosition); EdgeAttribute<ControlPoints> edgePoints = graph.edgeAttribute(StdAttribute.edgePoints); for (Graph cluster : graph.subGraphs()) { String clusterLabel = cluster.<String>graphAttribute(StdAttribute.label).get(); Node clusterPlaceholder = clusterPlacement.getNode(clusterLabel); Coordinates clusterCenter = clusterPositions.get(clusterPlaceholder); Coordinates clusterSize = clusterSizes.get(clusterPlaceholder); Coordinates clusterBottomLeft = clusterCenter.minus(clusterSize.divide(2)); Node boundaryNode = graph.newNode(); Edge boundaryEdge = graph.newEdge(boundaryNode, boundaryNode); positions.set(boundaryNode, clusterBottomLeft); ControlPoints edgeBends = new ControlPoints(); edgeBends.add(clusterBottomLeft.plus(new Coordinates(clusterSize.x(), 0))); edgeBends.add(clusterBottomLeft.plus(clusterSize)); edgeBends.add(clusterBottomLeft.plus(new Coordinates(0, clusterSize.y()))); edgePoints.set(boundaryEdge, edgeBends); boundaries.nodes.add(boundaryNode); boundaries.edges.add(boundaryEdge); Collection<Edge> surroundingEdge = new HashSet<>(); surroundingEdge.add(boundaryEdge); for (Node node : cluster.nodes()) { boundaries.surroundingEdges.set(node, surroundingEdge); } } boundaries.surroundingEdges.setDefault(boundaries.edges); return boundaries; } /** * Removes the cluster boundaries. * * @param graph the graph. * @param boundaries the boundaries. */ private void removeBoundaries(Graph graph, Boundaries boundaries) { for (Edge boundaryEdge : boundaries.edges) { graph.remove(boundaryEdge); } for (Node boundaryNode : boundaries.nodes) { graph.remove(boundaryNode); } } /** * Data structures containing the information about the boundaries. */ private static class Boundaries { Set<Node> nodes = new HashSet<>(); Set<Edge> edges = new HashSet<>(); NodeAttribute<Collection<Edge>> surroundingEdges = new NodeAttribute<>((Collection<Edge>) new HashSet<Edge>()); } /** * Repulsion force acting only on set elements. */ private static class SetElementsRepulsion extends ModularForce.NodeNodeRepulsion2D { private final Boundaries boundaries; /** * Constructs a set element repulsion force. * * @param nodeNodeDistance the desired node-node distance. * @param boundaries the boundaries in the defragmenter. */ public SetElementsRepulsion(double nodeNodeDistance, Boundaries boundaries) { super(nodeNodeDistance); this.boundaries = boundaries; } @Override protected Collection<Node> firstLevelNodes() { return keepOnlySetElement(super.firstLevelNodes()); } @Override protected Collection<Node> secondLevelNodes(Node node) { return keepOnlySetElement(super.secondLevelNodes(node)); } /** * Filters nodes that are not set elements from the force computation. * * @param nodes the nodes normally taken into consideration. * @return the set elements contained in the given parameter. */ private Collection<Node> keepOnlySetElement(Collection<Node> nodes) { Set<Node> elements = new HashSet<>(); for (Node node : nodes) { Edge originalEdge = synchronizer().getOriginalEdge(node); if ((originalEdge != null && !boundaries.edges.contains(originalEdge)) || !boundaries.nodes.contains(node)) { elements.add(node); } } return elements; } } /** * Force that attracts the extremities of the boundary segments. */ private static class BoundaryEdgeAttraction extends ModularForce.EdgeAttraction2D { private final Boundaries boundaries; /** * Constructs a boundary edge attraction force. * * @param edgeLength the desired edge length. * @param boundaries the boundaries in the defragmenter. */ public BoundaryEdgeAttraction(double edgeLength, Boundaries boundaries) { super(edgeLength); this.boundaries = boundaries; } @Override protected Collection<Edge> edges() { List<Edge> boundaryEdges = new ArrayList<>(); for (Edge edge : boundaries.edges) { boundaryEdges.addAll(synchronizer().getMirrorEdge(edge).segments()); } return boundaryEdges; } } }
[ "Alessio@wien" ]
Alessio@wien
d82b824fe2dcb61d44648e70d7833ecd354e92fa
169dd7b2c99f3e6c6ab4849f646248dd302da78b
/spring3/src/com/xupt/annotationIoc/UserService.java
c218416cc40620ff4f333ffca2ce22402e765407
[]
no_license
yunchenhui1998/Study_Spring_2
89c4298aedb2987b86df5ef461e7f75f3cfd797e
37724d922dbdd347d7f1abdc8b7bdd5d43eff40d
refs/heads/master
2020-11-30T00:42:43.416965
2020-01-05T15:18:50
2020-01-05T15:18:50
230,253,652
0
0
null
null
null
null
UTF-8
Java
false
false
90
java
package com.xupt.annotationIoc; public interface UserService { public void addUser(); }
[ "yunchenhui1998@163.com" ]
yunchenhui1998@163.com
f190d373631c1188d71d883cae3e4b8e2abe8abc
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/test/tech/tablesaw/table/TableSliceGroupTest.java
4d692fca7462a4f54f9cc3a0bbb34d9d28fe04c4
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
2,593
java
/** * 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 tech.tablesaw.table; import java.util.List; import org.apache.commons.math3.stat.StatUtils; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import tech.tablesaw.aggregate.NumericAggregateFunction; import tech.tablesaw.api.NumericColumn; import tech.tablesaw.api.StringColumn; import tech.tablesaw.api.Table; public class TableSliceGroupTest { private static NumericAggregateFunction exaggerate = new NumericAggregateFunction("exageration") { @Override public Double summarize(NumericColumn<?> data) { return (StatUtils.max(data.asDoubleArray())) + 1000; } }; private Table table; @Test public void testViewGroupCreation() { TableSliceGroup group = StandardTableSliceGroup.create(table, table.categoricalColumn("who")); Assertions.assertEquals(6, group.size()); List<TableSlice> viewList = group.getSlices(); int count = 0; for (TableSlice view : viewList) { count += view.rowCount(); } Assertions.assertEquals(table.rowCount(), count); } @Test public void testViewTwoColumn() { TableSliceGroup group = StandardTableSliceGroup.create(table, table.categoricalColumn("who"), table.categoricalColumn("approval")); List<TableSlice> viewList = group.getSlices(); int count = 0; for (TableSlice view : viewList) { count += view.rowCount(); } Assertions.assertEquals(table.rowCount(), count); } @Test public void testCustomFunction() { Table exaggeration = table.summarize("approval", TableSliceGroupTest.exaggerate).by("who"); StringColumn group = exaggeration.stringColumn(0); Assertions.assertTrue(group.contains("fox")); } @Test public void asTableList() { TableSliceGroup group = StandardTableSliceGroup.create(table, "who"); List<Table> tables = group.asTableList(); Assertions.assertEquals(6, tables.size()); } }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
205b4f0bad4ffffb83cc2e76ea0e1a0f8041f720
3bacd08fd862914f70f8a85c2a990247d5c9d2d5
/ads-les/noite-aula12-parte1/alunos-backend/src/main/java/edu/fatec/SecurityConfig.java
b155321be9b2cd5b665e830bf78ec53000e601f3
[]
no_license
pc097/fatec-2021-1s
fe433dc933696ff83c48583842e34b6a4b58304e
ff8359f8d135e21988ece63b6e131746f1b7821e
refs/heads/main
2023-05-12T12:45:03.576524
2021-06-04T01:38:20
2021-06-04T01:38:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,731
java
package edu.fatec; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.CommandLineRunner; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.security.crypto.password.NoOpPasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private UsuarioService usuarioService; @Autowired private JWTFiltro jwtFiltro; @Override public void configure(AuthenticationManagerBuilder auth) { try { auth.userDetailsService(usuarioService) .passwordEncoder(getPasswordEncoder()); } catch (Exception e) { e.printStackTrace(); } } @Override public void configure(HttpSecurity http) throws Exception { http.httpBasic() .and() .authorizeRequests() .antMatchers("/senha/**").anonymous() .antMatchers("/login/**").anonymous() .antMatchers("/alunos/**").hasAnyAuthority("USER", "ADMIN") .antMatchers("/aluno/add/**").hasAuthority("ADMIN") .antMatchers("/**").denyAll() .and() .addFilterBefore(jwtFiltro, UsernamePasswordAuthenticationFilter.class) .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .csrf().disable() .cors().and() .formLogin().disable(); } @Bean public PasswordEncoder getPasswordEncoder() { //return NoOpPasswordEncoder.getInstance(); return new BCryptPasswordEncoder(); } @Override @Bean public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } }
[ "antoniorcn@hotmail.com" ]
antoniorcn@hotmail.com