hexsha
stringlengths
40
40
size
int64
3
1.05M
ext
stringclasses
1 value
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
5
1.02k
max_stars_repo_name
stringlengths
4
126
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
list
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
5
1.02k
max_issues_repo_name
stringlengths
4
114
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
list
max_issues_count
float64
1
92.2k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
5
1.02k
max_forks_repo_name
stringlengths
4
136
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
list
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
avg_line_length
float64
2.55
99.9
max_line_length
int64
3
1k
alphanum_fraction
float64
0.25
1
index
int64
0
1M
content
stringlengths
3
1.05M
3e050c7bb97f197f33de4a9a15f39abfd73bc92f
4,064
java
Java
ruby-api/src/main/java/org/jetbrains/plugins/ruby/addins/rspec/run/configuration/RSpecRunConfigurationExternalizer.java
consulo/incubating-consulo-ruby
bea61f038c273eaf46a2ac35d874b00ae7bfab1a
[ "Apache-2.0" ]
null
null
null
ruby-api/src/main/java/org/jetbrains/plugins/ruby/addins/rspec/run/configuration/RSpecRunConfigurationExternalizer.java
consulo/incubating-consulo-ruby
bea61f038c273eaf46a2ac35d874b00ae7bfab1a
[ "Apache-2.0" ]
3
2021-11-01T08:26:45.000Z
2021-11-06T17:29:47.000Z
ruby-api/src/main/java/org/jetbrains/plugins/ruby/addins/rspec/run/configuration/RSpecRunConfigurationExternalizer.java
consulo/incubating-consulo-ruby
bea61f038c273eaf46a2ac35d874b00ae7bfab1a
[ "Apache-2.0" ]
null
null
null
37.981308
103
0.803642
2,113
/* * Copyright 2000-2008 JetBrains s.r.o. * * 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.jetbrains.plugins.ruby.addins.rspec.run.configuration; import java.util.Map; import org.jdom.Element; import org.jetbrains.annotations.NonNls; import org.jetbrains.plugins.ruby.ruby.run.confuguration.AbstractRubyRunConfigurationeExternalizer; import org.jetbrains.plugins.ruby.ruby.run.confuguration.tests.RTestsRunConfiguration; /** * Created by IntelliJ IDEA. * * @author: Roman Chernyatchik * @date: 18.07.2007 */ public class RSpecRunConfigurationExternalizer extends AbstractRubyRunConfigurationeExternalizer { private static RSpecRunConfigurationExternalizer myInstance = new RSpecRunConfigurationExternalizer(); @NonNls public static final String RSPEC_RUN_CONFIG_SETTINGS_ID = "RSPEC_RUN_CONFIG_SETTINGS_ID"; @NonNls private static final String SPEC_ARGS = "SPEC_ARGS"; @NonNls private static final String TESTS_FOLDER_PATH = "TESTS_FOLDER_PATH"; @NonNls private static final String TEST_SCRIPT_PATH = "TEST_SCRIPT_PATH"; @NonNls private static final String SPEC_RUNNER_PATH = "SPEC_RUNNER_PATH"; @NonNls private static final String TEST_FILE_MASK = "TEST_FILE_MASK"; @NonNls private static final String TEST_TEST_TYPE = "TEST_TEST_TYPE"; @NonNls private static final String USE_COLOURED_OUTPUT_ENABLED = "USE_COLOURED_OUTPUT_ENABLED"; @NonNls private static final String RUN_SPECS_SEPARATELY = "RUN_SPECS_SEPARATELY"; @NonNls private static final String USE_CUSTOM_SPEC_RUNNER = "USE_CUSTOM_SPEC_RUNNER"; public void writeExternal(final RSpecRunConfiguration config, final Element elem) { super.writeExternal(config, elem); writeOption(TESTS_FOLDER_PATH, config.getTestsFolderPath(), elem); writeOption(TEST_SCRIPT_PATH, config.getTestScriptPath(), elem); writeOption(SPEC_RUNNER_PATH, config.getCustomSpecsRunnerPath(), elem); writeOption(TEST_FILE_MASK, config.getTestFileMask(), elem); writeOption(TEST_TEST_TYPE, config.getTestType().toString(), elem); writeOption(SPEC_ARGS, config.getSpecArgs(), elem); writeOption(RUN_SPECS_SEPARATELY, String.valueOf(config.shouldRunSpecSeparately()), elem); writeOption(USE_COLOURED_OUTPUT_ENABLED, String.valueOf(config.shouldUseColoredOutput()), elem); writeOption(USE_CUSTOM_SPEC_RUNNER, String.valueOf(config.shouldUseCustomSpecRunner()), elem); } public void readExternal(final RSpecRunConfiguration config, final Element elem) { super.readExternal(config, elem); //noinspection unchecked Map<String, String> optionsByName = buildOptionsByElement(elem); config.setSpecArgs(optionsByName.get(SPEC_ARGS)); config.setTestsFolderPath(optionsByName.get(TESTS_FOLDER_PATH)); config.setTestScriptPath(optionsByName.get(TEST_SCRIPT_PATH)); config.setCustomSpecsRunnerPath(optionsByName.get(SPEC_RUNNER_PATH)); config.setTestFileMask(optionsByName.get(TEST_FILE_MASK)); final String type_value = optionsByName.get(TEST_TEST_TYPE); if(type_value != null) { config.setTestType(Enum.valueOf(RTestsRunConfiguration.TestType.class, type_value)); } config.setShouldRunSpecSeparately(Boolean.valueOf(optionsByName.get(RUN_SPECS_SEPARATELY))); config.setShouldUseColoredOutput(Boolean.valueOf(optionsByName.get(USE_COLOURED_OUTPUT_ENABLED))); config.setShouldUseCustomSpecRunner(Boolean.valueOf(optionsByName.get(USE_CUSTOM_SPEC_RUNNER))); } public static RSpecRunConfigurationExternalizer getInstance() { return myInstance; } @Override public String getID() { return RSPEC_RUN_CONFIG_SETTINGS_ID; } }
3e050d839a1d605f19c205bf2c66b56d389bae5f
2,184
java
Java
cockroach-gssapi-spring/spring/roach-data/roach-data-jooq/src/main/java/io/roach/data/jooq/model/Keys.java
dbist/cockroach-docker
d628b1d9d2a63d868ae17be39a7136e2e28e5598
[ "Apache-2.0" ]
2
2021-12-10T00:57:39.000Z
2022-02-28T04:36:38.000Z
cockroach-gssapi-spring/spring/roach-data/roach-data-jooq/src/main/java/io/roach/data/jooq/model/Keys.java
dbist/cockroach-docker
d628b1d9d2a63d868ae17be39a7136e2e28e5598
[ "Apache-2.0" ]
69
2020-07-20T16:00:19.000Z
2022-01-31T19:30:16.000Z
cockroach-gssapi-spring/spring/roach-data/roach-data-jooq/src/main/java/io/roach/data/jooq/model/Keys.java
dbist/cockroach-docker
d628b1d9d2a63d868ae17be39a7136e2e28e5598
[ "Apache-2.0" ]
3
2020-11-05T18:36:55.000Z
2021-12-05T06:55:46.000Z
39.709091
131
0.527015
2,114
/* * This file is generated by jOOQ. */ package io.roach.data.jooq.model; import org.jooq.TableField; import org.jooq.UniqueKey; import org.jooq.impl.Internal; import io.roach.data.jooq.model.tables.Account; import io.roach.data.jooq.model.tables.Databasechangeloglock; import io.roach.data.jooq.model.tables.records.AccountRecord; import io.roach.data.jooq.model.tables.records.DatabasechangeloglockRecord; /** * A class modelling foreign key relationships and constraints of tables of * the <code>public</code> schema. */ @SuppressWarnings({"all", "unchecked", "rawtypes"}) public class Keys { // ------------------------------------------------------------------------- // IDENTITY definitions // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // UNIQUE and PRIMARY KEY definitions // ------------------------------------------------------------------------- public static final UniqueKey<AccountRecord> PRIMARY = UniqueKeys0.PRIMARY; public static final UniqueKey<DatabasechangeloglockRecord> DATABASECHANGELOGLOCK_PKEY = UniqueKeys0.DATABASECHANGELOGLOCK_PKEY; // ------------------------------------------------------------------------- // FOREIGN KEY definitions // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- // [#1459] distribute members to avoid static initialisers > 64kb // ------------------------------------------------------------------------- private static class UniqueKeys0 { public static final UniqueKey<AccountRecord> PRIMARY = Internal .createUniqueKey(Account.ACCOUNT, "primary", new TableField[] {Account.ACCOUNT.ID}, true); public static final UniqueKey<DatabasechangeloglockRecord> DATABASECHANGELOGLOCK_PKEY = Internal .createUniqueKey(Databasechangeloglock.DATABASECHANGELOGLOCK, "databasechangeloglock_pkey", new TableField[] {Databasechangeloglock.DATABASECHANGELOGLOCK.ID}, true); } }
3e050daf5901988817886bc37718a5d3f1fcda7e
1,403
java
Java
ancba-blog/src/main/java/club/neters/blog/domain/entity/BaseEntity.java
anjoy8/ancba
b3f3b5b65d356cd50212902b2fd64a374165c1b1
[ "MIT" ]
32
2021-06-24T03:36:34.000Z
2022-02-27T13:27:29.000Z
ancba-blog/src/main/java/club/neters/blog/domain/entity/BaseEntity.java
anjoy8/ancba
b3f3b5b65d356cd50212902b2fd64a374165c1b1
[ "MIT" ]
4
2021-07-05T07:49:44.000Z
2022-03-11T11:47:43.000Z
ancba-blog/src/main/java/club/neters/blog/domain/entity/BaseEntity.java
anjoy8/ancba
b3f3b5b65d356cd50212902b2fd64a374165c1b1
[ "MIT" ]
8
2021-07-08T01:54:46.000Z
2022-03-11T04:36:11.000Z
23.779661
62
0.717748
2,115
package club.neters.blog.domain.entity; import club.neters.blog.core.annotation.EntityDoc; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.io.Serializable; import java.util.Date; /** * 基础实体类 * * @author laozhang * @date 2021/06/12 */ @Data @NoArgsConstructor @AllArgsConstructor public class BaseEntity implements Serializable { @EntityDoc(note = "Id") @TableId(value = "Id", type = IdType.AUTO) private Integer Id; @EntityDoc(note = "创建人Id") @TableField("CreateId") private Integer CreateId; @EntityDoc(note = "创建人名称") @TableField("CreateBy") private String CreateBy; @EntityDoc(note = "创建时间") @TableField(value = "CreateTime", fill = FieldFill.INSERT) protected Date CreateTime; @EntityDoc(note = "修改人Id") @TableField("ModifyId") private Integer ModifyId; @EntityDoc(note = "修改人名称") @TableField("ModifyBy") private String ModifyBy; @EntityDoc(note = "修改时间") @TableField(value = "ModifyTime", fill = FieldFill.INSERT) protected Date ModifyTime; @EntityDoc(note = "是否删除") @TableField("tdIsDelete") private Boolean IsDeleted; }
3e050dc08e1899d1f50eb2157bda31c48ca59a40
977
java
Java
testapp/src/main/java/com/nshmura/strictmodenotifier/testapp/ClassInstanceLimitActivity.java
nshmura/strictmode-notifier
e6f170fe8a311de4fcf031b44d7c86b55ad195d0
[ "Apache-2.0" ]
191
2016-03-28T13:32:55.000Z
2021-03-04T15:21:38.000Z
testapp/src/main/java/com/nshmura/strictmodenotifier/testapp/ClassInstanceLimitActivity.java
nshmura/strictmode-notifier
e6f170fe8a311de4fcf031b44d7c86b55ad195d0
[ "Apache-2.0" ]
5
2016-04-10T22:57:49.000Z
2017-10-20T15:21:52.000Z
testapp/src/main/java/com/nshmura/strictmodenotifier/testapp/ClassInstanceLimitActivity.java
nshmura/strictmode-notifier
e6f170fe8a311de4fcf031b44d7c86b55ad195d0
[ "Apache-2.0" ]
23
2016-04-11T02:05:44.000Z
2021-01-01T01:22:21.000Z
27.138889
75
0.721597
2,116
package com.nshmura.strictmodenotifier.testapp; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; public class ClassInstanceLimitActivity extends AppCompatActivity { private static final String EXTRA_COUNT = "EXTRA_COUNT"; public static void start(Context context, int count) { Intent starter = new Intent(context, ClassInstanceLimitActivity.class); starter.putExtra(EXTRA_COUNT, count); context.startActivity(starter); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Post a message and delay its execution for 10 minutes. new Handler().postDelayed(new Runnable() { @Override public void run() { } }, 1000 * 60 * 10); int count = getIntent().getIntExtra(EXTRA_COUNT, 0); if (count > 0) { start(this, --count); } finish(); } }
3e050dd64197cdc0318d8547226f37e7492b5bd2
1,291
java
Java
src/java/com/echothree/model/control/printer/common/workflow/PrinterStatusConstants.java
echothreellc/echothree
1744df7654097cc000e5eca32de127b5dc745302
[ "Apache-2.0" ]
1
2020-09-01T08:39:01.000Z
2020-09-01T08:39:01.000Z
src/java/com/echothree/model/control/printer/common/workflow/PrinterStatusConstants.java
echothreellc/echothree
1744df7654097cc000e5eca32de127b5dc745302
[ "Apache-2.0" ]
null
null
null
src/java/com/echothree/model/control/printer/common/workflow/PrinterStatusConstants.java
echothreellc/echothree
1744df7654097cc000e5eca32de127b5dc745302
[ "Apache-2.0" ]
1
2020-05-31T08:34:46.000Z
2020-05-31T08:34:46.000Z
40.34375
85
0.656855
2,117
// -------------------------------------------------------------------------------- // Copyright 2002-2021 Echo Three, LLC // // 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.echothree.model.control.printer.common.workflow; public interface PrinterStatusConstants { String Workflow_PRINTER_STATUS = "PRINTER_STATUS"; String WorkflowStep_ACCEPTING_JOBS = "ACCEPTING_JOBS"; String WorkflowStep_PAUSED = "PAUSED"; String WorkflowEntrance_NEW_PRINTER = "NEW_PRINTER"; String WorkflowDestination_ACCEPTING_JOBS_TO_PAUSED = "ACCEPTING_JOBS_TO_PAUSED"; String WorkflowDestination_PAUSED_TO_ACCEPTING_JOBS = "PAUSED_TO_ACCEPTING_JOBS"; }
3e050e320c865a6f9e0d19c6fb2fcdee66c14613
6,319
java
Java
Userandadmin/app/src/main/java/in/example/android/userandadmin/LoginActivity.java
nd2712/FirebaseStarterPack
2af772c89d2e943418e7912082980b08ee17ca43
[ "MIT" ]
null
null
null
Userandadmin/app/src/main/java/in/example/android/userandadmin/LoginActivity.java
nd2712/FirebaseStarterPack
2af772c89d2e943418e7912082980b08ee17ca43
[ "MIT" ]
1
2018-10-04T13:05:53.000Z
2018-10-05T05:38:58.000Z
Userandadmin/app/src/main/java/in/example/android/userandadmin/LoginActivity.java
nd2712/FirebaseStarterPack
2af772c89d2e943418e7912082980b08ee17ca43
[ "MIT" ]
2
2018-10-04T13:17:22.000Z
2018-10-07T07:50:34.000Z
30.23445
164
0.730495
2,118
package in.example.android.userandadmin; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.View; import com.google.android.gms.auth.api.signin.GoogleSignIn; import com.google.android.gms.auth.api.signin.GoogleSignInAccount; import com.google.android.gms.auth.api.signin.GoogleSignInClient; import com.google.android.gms.auth.api.signin.GoogleSignInOptions; import com.google.android.gms.common.SignInButton; import com.google.android.gms.common.api.ApiException; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.auth.AuthCredential; import com.google.firebase.auth.AuthResult; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.auth.FirebaseUser; import com.google.firebase.auth.GoogleAuthProvider; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; public class LoginActivity extends AppCompatActivity { private static final int RC_SIGN_IN = 9001; SignInButton signInButton; GoogleSignInClient googleSignInClient; ProgressDialog dialog; private FirebaseAuth firebaseAuth; private DatabaseReference reference; private SessionManager sessionManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); sessionManager = new SessionManager(LoginActivity.this); GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestEmail() .build(); firebaseAuth = FirebaseAuth.getInstance(); reference = FirebaseDatabase.getInstance().getReference().child("users"); dialog = new ProgressDialog(LoginActivity.this); dialog.setMessage("Signing in"); dialog.setTitle("Please Wait"); dialog.setCancelable(false); googleSignInClient = GoogleSignIn.getClient(this, gso); signInButton = findViewById(R.id.login_button); signInButton.setSize(SignInButton.SIZE_WIDE); signInButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (sessionManager.checkNet()) { signIn(); } else { Snackbar.make(findViewById(R.id.root), "Check network connectivity", Snackbar.LENGTH_SHORT); } } }); revokeAccess(); } public void signIn() { Intent intent = googleSignInClient.getSignInIntent(); startActivityForResult(intent, RC_SIGN_IN); } @Override protected void onStart() { super.onStart(); FirebaseUser mFirebaseUser = firebaseAuth.getCurrentUser(); if (mFirebaseUser != null) { startActivity(new Intent(this, HomeActivity.class)); finish(); } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); dialog.show(); // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { Task<GoogleSignInAccount> signInAccountTask = GoogleSignIn.getSignedInAccountFromIntent(data); try { // Google sign in was successful. GoogleSignInAccount googleSignInAccount = signInAccountTask.getResult(ApiException.class); // Now authenticating using firebase firebaseAuthWithGoogle(googleSignInAccount); } catch (ApiException e) { // google sign in failed dialog.dismiss(); e.printStackTrace(); } } else { dialog.dismiss(); } } private void firebaseAuthWithGoogle(final GoogleSignInAccount account) { AuthCredential credential = GoogleAuthProvider.getCredential(account.getIdToken(), null); firebaseAuth.signInWithCredential(credential).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { if (task.isSuccessful()) { // signed in successfully. Starting custom session using SessionManager and building intent to Home. // *User says i'm in in hacker style* FirebaseUser user = firebaseAuth.getCurrentUser(); final String email_chosen = account.getEmail(); final String display_name = account.getDisplayName(); reference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot snapshot : dataSnapshot.getChildren()) { Long count = dataSnapshot.getChildrenCount(); Log.v("count",count.toString()); sessionManager.setUserCount(count); Users users = snapshot.getValue(Users.class); if (email_chosen.equalsIgnoreCase(users.email)) { // user already exists sessionManager.loginUser(account.getEmail(), users.getName(), users.getRole(),display_name); startActivity(new Intent(LoginActivity.this, HomeActivity.class)); dialog.dismiss(); finish(); } } // user email has been verified but doesn't have an account if (!sessionManager.isLogin()) { startActivity(new Intent(LoginActivity.this, SignUpActivity.class).putExtra("email", account.getEmail()).putExtra("display_name",account.getDisplayName())); dialog.dismiss(); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } else { dialog.dismiss(); Snackbar.make(findViewById(R.id.root), "Something went wrong", Snackbar.LENGTH_SHORT).show(); } } }); } private void revokeAccess() { googleSignInClient.revokeAccess() .addOnCompleteListener(this, new OnCompleteListener<Void>() { @Override public void onComplete(@NonNull Task<Void> task) { new SessionManager(LoginActivity.this).accessRevoked(); } }); } }
3e050fabc53999d1bd451254305344e748e046fc
1,352
java
Java
spring-my-mvc/src/main/java/com/study/controller/controller/advice/ControllerAdviceController.java
phil-zhan/spring
74050bbad5b018036cacea57ad0002c1ffe7723a
[ "Apache-2.0" ]
null
null
null
spring-my-mvc/src/main/java/com/study/controller/controller/advice/ControllerAdviceController.java
phil-zhan/spring
74050bbad5b018036cacea57ad0002c1ffe7723a
[ "Apache-2.0" ]
null
null
null
spring-my-mvc/src/main/java/com/study/controller/controller/advice/ControllerAdviceController.java
phil-zhan/spring
74050bbad5b018036cacea57ad0002c1ffe7723a
[ "Apache-2.0" ]
null
null
null
22.915254
64
0.744083
2,119
package com.study.controller.controller.advice; import org.springframework.web.bind.WebDataBinder; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.InitBinder; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.servlet.ModelAndView; import java.util.HashMap; import java.util.Map; /** * Advice * * 1、全局异常处理 * 2、全局数据绑定 * 3、全局数据预处理 * @author phil * @date 2021-05-08 09:27:50 */ @ControllerAdvice public class ControllerAdviceController { /** * 全局异常处理 * @date 2021-05-08 09:32:22 */ @ExceptionHandler(Exception.class) public ModelAndView customException(Exception exception){ ModelAndView modelAndView = new ModelAndView(); modelAndView.addObject("message",exception.getMessage()); modelAndView.setViewName("error_page"); return modelAndView; } @ModelAttribute(name = "md") public Map<String,Object> myData(){ Map<String, Object> map = new HashMap<>(); map.put("age",10); map.put("name","li"); map.put("gender","男"); return map; } @InitBinder("a") public void initA(WebDataBinder binder){ binder.setFieldDefaultPrefix("a."); } @InitBinder("b") public void initB(WebDataBinder binder){ binder.setFieldDefaultPrefix("b."); } }
3e050ffc14040ebea7bda410e090a45b54873d98
5,069
java
Java
src/main/java/morningsage/particletitlescreen/ParticleScreenManager.java
Exploding-Creeper/ParticleTitleMenu-Forge
f5b63eb4947de3d14debb40f09b93d65efc73f18
[ "CC0-1.0" ]
null
null
null
src/main/java/morningsage/particletitlescreen/ParticleScreenManager.java
Exploding-Creeper/ParticleTitleMenu-Forge
f5b63eb4947de3d14debb40f09b93d65efc73f18
[ "CC0-1.0" ]
null
null
null
src/main/java/morningsage/particletitlescreen/ParticleScreenManager.java
Exploding-Creeper/ParticleTitleMenu-Forge
f5b63eb4947de3d14debb40f09b93d65efc73f18
[ "CC0-1.0" ]
null
null
null
35.447552
149
0.633853
2,120
package morningsage.particletitlescreen; import lombok.var; import morningsage.particletitlescreen.config.ModConfig; import morningsage.particletitlescreen.utils.RandomUtils; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.util.ActionResultType; import net.minecraft.util.math.vector.Vector2f; import net.minecraftforge.eventbus.api.SubscribeEvent; import org.lwjgl.opengl.GL11; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; import static morningsage.particletitlescreen.config.ModConfig.*; public class ParticleScreenManager { private final List<Particle> particles = new ArrayList<>(); private static final Vector2f ZERO = Vector2f.ZERO; private @Nullable Vector2f mouseLocation = null; private @Nullable Vector2f resolution = null; private @Nullable Double scale = null; private static final MainWindow window = Minecraft.getInstance().getWindow(); public ParticleScreenManager() { initParticles(); initMouseEvents(); } public void initParticles() { particles.clear(); int particleColor = Integer.decode(ModConfig.particleColor); double particleCount = window.getWidth() * window.getHeight() / window.getGuiScale() / 4000; for (int i = 0; i < particleCount; i++) { var particleBuilder = Particle.builder(); if (randomParticleRadius) { particleBuilder.radius(RandomUtils.getRandomFloat(particleMinRadius, particleMaxRadius)); } else { particleBuilder.radius(particleRadius); } if (randomParticleOpacity) { particleBuilder.opacity(RandomUtils.getRandomFloat(particleMinOpacity, particleMaxOpacity)); } else { particleBuilder.opacity(particleOpacity); } if (particleMovement) { particleBuilder.speed(particleMovementSpeed); } particleBuilder.color(particleColor); particleBuilder.locationVec(RandomUtils.getRandomLocation()); particleBuilder.baseVelocity(ZERO); particles.add(particleBuilder.build()); } } private void initMouseEvents() { if (!particleRepelledByMouse) return; } public void onMouseLeave() { mouseLocation = null; } public void onMouseMove(double x, double y) { mouseLocation = new Vector2f((float) x, (float) y); } public ActionResultType onRender() { onRenderBackground(); onRenderParticles(); if (resolution == null || resolution.x != window.getGuiScaledWidth() || resolution.y != window.getGuiScaledHeight()) { resolution = new Vector2f(window.getGuiScaledWidth(), window.getGuiScaledHeight()); } if (scale == null || scale != window.getGuiScale()) { scale = window.getGuiScale(); } return ActionResultType.CONSUME; } private static void onRenderBackground() { int backgroundColor = Integer.decode(ModConfig.backgroundColor); final float red = (float)(backgroundColor >> 16 & 255) / 255.0F; final float green = (float)(backgroundColor >> 8 & 255) / 255.0F; final float blue = (float)(backgroundColor & 255) / 255.0F; int width = Minecraft.getInstance().getWindow().getGuiScaledWidth(); int height = Minecraft.getInstance().getWindow().getGuiScaledHeight(); GL11.glColor3f(red, green, blue); GL11.glBegin(GL11.GL_QUAD_STRIP); GL11.glVertex2i(0, 0); GL11.glVertex2i(0, height); GL11.glVertex2i(width, 0); GL11.glVertex2i(width, height); GL11.glEnd(); } private void onRenderParticles() { // Determine position first to make sure all the interactions match up if (particleMovement) { Vector2f windowSize = new Vector2f(window.getGuiScaledHeight(), window.getGuiScaledWidth()); for (Particle particle : particles) { particle.move(); RandomUtils.moveParticleIfNeeded(particle, particleBounce); particle.interactWithMouse(mouseLocation, windowSize, particleBounce, particleDistanceRepelledByMouse, (float) window.getGuiScale()); } } int particleInteractionColor = particleInteractions ? Integer.decode(ModConfig.particleInteractionColor) : -1; // Then draw everything for (int i = 0; i < particles.size(); i++) { Particle particle1 = particles.get(i); particle1.draw(); if (particleInteractions) { for (int x = i + 1; x < particles.size(); x++) { particle1.interact( particles.get(x), particleInteractionDistance, particleInteractionOpacity, particleInteractionColor ); } } } } }
3e05101b8dd290842b8d5a27f9f7eda9d572c66c
1,245
java
Java
kraken-engine/src/test/java/kraken/test/domain/simple/Company.java
eisgroup/kraken-rules
920a5a23492b8bc0a1c4621f674a145c53dea5c6
[ "Apache-2.0" ]
10
2021-11-15T18:38:38.000Z
2021-12-28T11:14:03.000Z
kraken-engine/src/test/java/kraken/test/domain/simple/Company.java
eisgroup/kraken-rules
920a5a23492b8bc0a1c4621f674a145c53dea5c6
[ "Apache-2.0" ]
1
2021-11-15T20:04:16.000Z
2021-11-18T10:03:16.000Z
kraken-engine/src/test/java/kraken/test/domain/simple/Company.java
eisgroup/kraken-rules
920a5a23492b8bc0a1c4621f674a145c53dea5c6
[ "Apache-2.0" ]
null
null
null
23.490566
76
0.666667
2,121
/* * Copyright 2019 EIS Ltd and/or one of its affiliates. * * 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 kraken.test.domain.simple; /** * Created by rimas on 24/04/17. */ public class Company { private String name; private Employee employee; private Person client; public String getName() { return name; } public void setName(String name) { this.name = name; } public Employee getEmployee() { return employee; } public void setEmployee(Employee employee) { this.employee = employee; } public Person getClient() { return client; } public void setClient(Person client) { this.client = client; } }
3e05106ce10cfcda1c656b94dc6feaafd3554a37
9,117
java
Java
osdu-r2/os-workflow/workflow-core/src/test/java/org/opengroup/osdu/workflow/WorkflowMvcTest.java
google/framework-for-osdu
e0ecac0244928021df68092a720a4c5138b23f6b
[ "Apache-2.0" ]
14
2020-02-27T06:09:54.000Z
2022-03-31T14:52:49.000Z
osdu-r2/os-workflow/workflow-core/src/test/java/org/opengroup/osdu/workflow/WorkflowMvcTest.java
google/framework-for-osdu
e0ecac0244928021df68092a720a4c5138b23f6b
[ "Apache-2.0" ]
10
2021-01-07T09:55:08.000Z
2021-12-16T19:43:44.000Z
osdu-r2/os-workflow/workflow-core/src/test/java/org/opengroup/osdu/workflow/WorkflowMvcTest.java
google/framework-for-osdu
e0ecac0244928021df68092a720a4c5138b23f6b
[ "Apache-2.0" ]
5
2020-10-09T04:10:28.000Z
2021-10-22T00:52:57.000Z
40.484444
102
0.761115
2,122
/* * Copyright 2020 Google LLC * * 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.opengroup.osdu.workflow; import static org.assertj.core.api.BDDAssertions.then; import static org.mockito.AdditionalAnswers.returnsFirstArg; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.verify; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import com.fasterxml.jackson.databind.ObjectMapper; import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; import java.util.Objects; import org.junit.jupiter.api.DisplayNameGeneration; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.opengroup.osdu.core.common.model.WorkflowType; import org.opengroup.osdu.core.common.model.entitlements.AuthorizationResponse; import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.model.http.DpsHeaders; import org.opengroup.osdu.core.common.model.workflow.StartWorkflowRequest; import org.opengroup.osdu.core.common.model.workflow.StartWorkflowResponse; import org.opengroup.osdu.core.common.provider.interfaces.IAuthorizationService; import org.opengroup.osdu.workflow.model.IngestionStrategy; import org.opengroup.osdu.workflow.model.WorkflowStatus; import org.opengroup.osdu.workflow.model.WorkflowStatusType; import org.opengroup.osdu.workflow.provider.interfaces.IIngestionStrategyRepository; import org.opengroup.osdu.workflow.provider.interfaces.ISubmitIngestService; import org.opengroup.osdu.workflow.provider.interfaces.IWorkflowStatusRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; 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.test.web.servlet.request.SecurityMockMvcRequestPostProcessors; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; @ExtendWith(SpringExtension.class) @SpringBootTest @AutoConfigureMockMvc @DisplayNameGeneration(ReplaceCamelCase.class) public class WorkflowMvcTest { private static final String TEST_AUTH = "test-auth"; private static final String PARTITION = "partition"; private static final String WELL_LOG_DATA_TYPE = "WELL_LOG"; private static final String UNAUTHORIZED_MSG = "The user is not authorized to perform this action"; private static final String TEST_DAG = "test-dag"; @Autowired private MockMvc mockMvc; @Autowired private ObjectMapper mapper; @MockBean private IIngestionStrategyRepository ingestionStrategyRepository; @MockBean private ISubmitIngestService submitIngestService; @MockBean private IWorkflowStatusRepository workflowStatusRepository; @MockBean private IAuthorizationService authorizationService; @Captor private ArgumentCaptor<WorkflowStatus> workflowStatusCaptor; @Test public void shouldPassStartWorkflowEntireFlow() throws Exception { // given HttpHeaders headers = getHttpHeaders(); Map<String, Object> context = new HashMap<>(); context.put("key", "value"); StartWorkflowRequest request = StartWorkflowRequest.builder() .dataType(WELL_LOG_DATA_TYPE) .context(context) .workflowType(WorkflowType.OSDU) .build(); given(ingestionStrategyRepository .findByWorkflowTypeAndDataTypeAndUserId(eq(WorkflowType.OSDU), eq(WELL_LOG_DATA_TYPE), any())).willReturn(IngestionStrategy.builder().dagName(TEST_DAG).build()); given(submitIngestService.submitIngest(eq(TEST_DAG), eq(context))) .willReturn(Boolean.TRUE); given(workflowStatusRepository.saveWorkflowStatus(workflowStatusCaptor.capture())) .will(returnsFirstArg()); given(authorizationService.authorizeAny(any(), eq("service.storage.creator"))) .willReturn(AuthorizationResponse.builder() .user("[email protected]") .build()); // when MvcResult mvcResult = mockMvc.perform( post("/startWorkflow") .contentType(MediaType.APPLICATION_JSON) .characterEncoding(StandardCharsets.UTF_8.displayName()) .with(SecurityMockMvcRequestPostProcessors.csrf()) .headers(headers) .content(mapper.writeValueAsString(request))) .andExpect(status().isOk()) .andReturn(); // then StartWorkflowResponse startWorkflowResponse = mapper .readValue(mvcResult.getResponse().getContentAsString(), StartWorkflowResponse.class); then(startWorkflowResponse.getWorkflowId()).isNotNull(); verify(workflowStatusRepository).saveWorkflowStatus(workflowStatusCaptor.capture()); then(workflowStatusCaptor.getValue()).satisfies(status -> { then(status.getWorkflowStatusType()).isEqualTo(WorkflowStatusType.SUBMITTED); then(status.getWorkflowId()).isEqualTo(startWorkflowResponse.getWorkflowId()); then(status.getAirflowRunId()).isNotNull(); }); } @Test public void shouldFailStartWorkflowInvalidJson() throws Exception { // given HttpHeaders headers = new HttpHeaders(); given(authorizationService.authorizeAny(any(), eq("service.storage.creator"))) .willReturn(AuthorizationResponse.builder() .user("[email protected]") .build()); // when MvcResult mvcResult = mockMvc.perform( post("/startWorkflow").contentType(MediaType.APPLICATION_JSON) .characterEncoding(StandardCharsets.UTF_8.displayName()) .with(SecurityMockMvcRequestPostProcessors.csrf()) .headers(headers) .content("{\"test\";\"test\"}")) .andExpect(status().isBadRequest()) .andReturn(); // then then(Objects.requireNonNull(mvcResult.getResolvedException()).getMessage()) .contains("JSON parse error"); } @Test public void shouldFailStartWorkflowUnauthorized() throws Exception { // given HttpHeaders headers = getHttpHeaders(); StartWorkflowRequest request = StartWorkflowRequest.builder() .dataType(WELL_LOG_DATA_TYPE) .context(new HashMap<>()) .workflowType(WorkflowType.OSDU) .build(); given(authorizationService.authorizeAny(any(), eq("service.storage.creator"))) .willThrow(AppException.createUnauthorized("test: viewer")); // when mockMvc.perform( post("/startWorkflow") .contentType(MediaType.APPLICATION_JSON) .characterEncoding(StandardCharsets.UTF_8.displayName()) .with(SecurityMockMvcRequestPostProcessors.csrf()) .headers(headers) .content(mapper.writeValueAsString(request))) .andExpect(status().isUnauthorized()) .andExpect(jsonPath("$.message").value(UNAUTHORIZED_MSG)) .andReturn(); // then verify(authorizationService).authorizeAny(any(), eq("service.storage.creator")); } private HttpHeaders getHttpHeaders() { HttpHeaders headers = new HttpHeaders(); headers.add(DpsHeaders.AUTHORIZATION, TEST_AUTH); headers.add(DpsHeaders.DATA_PARTITION_ID, PARTITION); return headers; } @TestConfiguration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public static class TestSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.httpBasic().disable() .csrf().disable(); //disable default authN. AuthN handled by endpoints proxy } } }
3e05108c3440da9ad6ce54c900fb2a2cd1642530
1,050
java
Java
lumongo-cluster/src/main/java/org/lumongo/server/search/FacetCountResult.java
lumongo/lumongo
c42a8512af22a2a992bd172a9c89f1b71289fec2
[ "Apache-2.0" ]
48
2015-02-03T17:22:35.000Z
2018-07-23T12:47:24.000Z
lumongo-cluster/src/main/java/org/lumongo/server/search/FacetCountResult.java
lumongo/lumongo
c42a8512af22a2a992bd172a9c89f1b71289fec2
[ "Apache-2.0" ]
125
2015-01-02T14:33:53.000Z
2017-06-23T13:59:59.000Z
lumongo-cluster/src/main/java/org/lumongo/server/search/FacetCountResult.java
lumongo/lumongo
c42a8512af22a2a992bd172a9c89f1b71289fec2
[ "Apache-2.0" ]
9
2015-02-12T09:20:55.000Z
2020-04-06T01:51:33.000Z
21
177
0.74
2,123
package org.lumongo.server.search; import java.util.Comparator; public class FacetCountResult implements Comparable<FacetCountResult> { private String facet; private long count; public static Comparator<FacetCountResult> COUNT_THEN_FACET_COMPARE = Comparator.comparingLong(FacetCountResult::getCount).reversed().thenComparing(FacetCountResult::getFacet); public FacetCountResult(String facet, long count) { this.facet = facet; this.count = count; } public String getFacet() { return facet; } public void setFacet(String facet) { this.facet = facet; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } @Override public int compareTo(FacetCountResult o) { return COUNT_THEN_FACET_COMPARE.compare(this, o); } @Override public boolean equals(Object obj) { if (obj instanceof FacetCountResult) { return (compareTo((FacetCountResult) obj) == 0); } return false; } @Override public int hashCode() { return facet.hashCode() + Long.hashCode(count); } }
3e051214f5b53aa4cd92f5fe57fd2b1d3927449b
6,764
java
Java
org.amdatu.remote/src/org/amdatu/remote/discovery/SecureHttpEndpointDiscoveryServlet.java
INAETICS/secure-modular-services
b45894132ab6f3aca66962296f7780ed1ae6747f
[ "Apache-2.0" ]
null
null
null
org.amdatu.remote/src/org/amdatu/remote/discovery/SecureHttpEndpointDiscoveryServlet.java
INAETICS/secure-modular-services
b45894132ab6f3aca66962296f7780ed1ae6747f
[ "Apache-2.0" ]
null
null
null
org.amdatu.remote/src/org/amdatu/remote/discovery/SecureHttpEndpointDiscoveryServlet.java
INAETICS/secure-modular-services
b45894132ab6f3aca66962296f7780ed1ae6747f
[ "Apache-2.0" ]
null
null
null
36.229947
121
0.656531
2,124
/* * 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.amdatu.remote.discovery; import static org.amdatu.remote.SecureEndpointUtil.writeEndpoints; import static org.amdatu.remote.IOUtil.closeSilently; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import java.util.HashMap; import java.util.Map; import java.util.concurrent.locks.ReentrantReadWriteLock; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.osgi.service.remoteserviceadmin.EndpointDescription; /** * @author <a href="mailto:[email protected]">Amdatu Project Team</a> */ public final class SecureHttpEndpointDiscoveryServlet<T extends HttpEndpointDiscoveryConfiguration> extends HttpServlet { private static final long serialVersionUID = 1L; private final T m_configuration; private final Map<String, EndpointDescription> m_endpoints = new HashMap<String, EndpointDescription>(); private final Map<String, Long> m_modifieds = new HashMap<String, Long>(); private final ReentrantReadWriteLock m_lock = new ReentrantReadWriteLock(); private final AbstractDiscovery m_discovery; private volatile EndpointDescription[] m_endpointsArray = new EndpointDescription[0]; private volatile long m_modified = nextLastModified(-1l); public SecureHttpEndpointDiscoveryServlet(AbstractDiscovery discovery, T configuration) { m_discovery = discovery; m_configuration = configuration; } public void addEndpoint(EndpointDescription endpoint) { m_discovery.logDebug("Adding published endpoint: %s", endpoint); m_lock.writeLock().lock(); try { m_modified = nextLastModified(m_modified); m_endpoints.put(endpoint.getId(), endpoint); m_modifieds.put(endpoint.getId(), m_modified); m_endpointsArray = m_endpoints.values().toArray(new EndpointDescription[m_endpoints.size()]); } finally { m_lock.writeLock().unlock(); } } public void removeEndpoint(EndpointDescription endpoint) { m_discovery.logDebug("Removing published endpoint: %s", endpoint); m_lock.writeLock().lock(); try { m_modified = nextLastModified(m_modified); m_endpoints.remove(endpoint.getId()); m_modifieds.remove(endpoint.getId()); m_endpointsArray = m_endpoints.values().toArray(new EndpointDescription[m_endpoints.size()]); } finally { m_lock.writeLock().unlock(); } } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String path = normalizePath(req.getPathInfo()); if (!path.equals("")) { doGetEndpoint(req, resp, path); return; } doGetEndpoints(req, resp); } private void doGetEndpoints(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { long ifModifiedSince = req.getDateHeader("If-Modified-Since"); if (m_modified <= ifModifiedSince) { m_discovery.logDebug("Sending not modified for endpoints request: %s <= %s", m_modified, ifModifiedSince); resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return; } resp.setDateHeader("Last-Modified", m_modified); resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType("text/xml"); resp.setCharacterEncoding("UTF-8"); resp.setDateHeader("Last-Modified", m_modified); resp.setDateHeader("Expires", System.currentTimeMillis() + 10000); Writer out = null; try { out = new OutputStreamWriter(resp.getOutputStream()); writeEndpoints(out, m_configuration, m_endpointsArray); } finally { closeSilently(out); } } protected void doGetEndpoint(HttpServletRequest req, HttpServletResponse resp, String endpointId) throws ServletException, IOException { EndpointDescription endpoint = null; long modified = -1l; m_lock.readLock().lock(); try { endpoint = m_endpoints.get(endpointId); if (endpoint != null) { modified = m_modifieds.get(endpointId); } } finally { m_lock.readLock().unlock(); } if (endpoint == null) { m_discovery.logDebug("Sending not found for endpoint request: %s", endpointId); resp.sendError(HttpServletResponse.SC_NOT_FOUND, "No such Endpoint: " + endpointId); return; } long ifModifiedSince = req.getDateHeader("If-Modified-Since"); if (modified <= ifModifiedSince) { m_discovery.logDebug("Sending not modified for endpoint request: %s - %s <= %s", endpointId, m_modified, ifModifiedSince); resp.setStatus(HttpServletResponse.SC_NOT_MODIFIED); return; } resp.setStatus(HttpServletResponse.SC_OK); resp.setContentType("text/xml"); resp.setCharacterEncoding("UTF-8"); resp.setDateHeader("Last-Modified", modified); resp.setDateHeader("Expires", System.currentTimeMillis() + 10000); Writer out = null; try { out = new OutputStreamWriter(resp.getOutputStream()); writeEndpoints(out, m_configuration, endpoint); } finally { closeSilently(out); } } private static String normalizePath(String pathInfo) { if (pathInfo == null) { return ""; } if (pathInfo.startsWith("/")) { pathInfo = pathInfo.substring(1); } if (pathInfo.endsWith("/")) { pathInfo = pathInfo.substring(0, pathInfo.length() - 1); } return pathInfo; } private static long nextLastModified(long current) { long next = (System.currentTimeMillis() / 1000) * 1000; if (next <= current) { next = current += 1000; } return next; } }
3e0512d00f564cf33823489b77f0caabca64a9eb
1,477
java
Java
android/src/com/android/tools/idea/profiling/view/CaptureEditor.java
Ret-Mode/android
5b427d1fc6a66ff4db09a9e2f02ae61292ccd797
[ "Apache-2.0" ]
831
2016-06-09T06:55:34.000Z
2022-03-30T11:17:10.000Z
android/src/com/android/tools/idea/profiling/view/CaptureEditor.java
Ret-Mode/android
5b427d1fc6a66ff4db09a9e2f02ae61292ccd797
[ "Apache-2.0" ]
19
2017-10-27T00:36:35.000Z
2021-02-04T13:59:45.000Z
android/src/com/android/tools/idea/profiling/view/CaptureEditor.java
Ret-Mode/android
5b427d1fc6a66ff4db09a9e2f02ae61292ccd797
[ "Apache-2.0" ]
210
2016-07-05T12:22:36.000Z
2022-03-19T09:07:15.000Z
36.02439
98
0.760325
2,125
/* * Copyright (C) 2015 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.tools.idea.profiling.view; import com.android.tools.perflib.analyzer.AnalysisReport; import com.android.tools.perflib.analyzer.AnalyzerTask; import com.intellij.designer.DesignerEditorPanelFacade; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.util.UserDataHolderBase; import org.jetbrains.annotations.NotNull; import java.util.Set; public abstract class CaptureEditor extends UserDataHolderBase implements FileEditor { protected CapturePanel myPanel; @NotNull public abstract DesignerEditorPanelFacade getFacade(); @NotNull public abstract AnalysisReport performAnalysis(@NotNull Set<? extends AnalyzerTask> tasks, @NotNull Set<AnalysisReport.Listener> listeners); public final CapturePanel getCapturePanel() { return myPanel; } }
3e051329d02d80d28a01d75e155129a11e7dfce8
1,719
java
Java
PatternMiner/libraries/spmf/src/main/java/test/MainTestOPTICS_extractClusterOrdering_saveToMemory.java
landongw/disease-pattern-miner
e62d7ec76b09330cf95c8dbe9993e41e77cc6cc6
[ "MIT" ]
10
2018-12-26T13:12:53.000Z
2021-10-09T15:34:31.000Z
PatternMiner/libraries/spmf/src/main/java/test/MainTestOPTICS_extractClusterOrdering_saveToMemory.java
vitaliy-ostapchuk93/disease-pattern-miner
e62d7ec76b09330cf95c8dbe9993e41e77cc6cc6
[ "MIT" ]
2
2021-08-02T17:25:47.000Z
2021-08-02T17:25:53.000Z
PatternMiner/libraries/spmf/src/main/java/test/MainTestOPTICS_extractClusterOrdering_saveToMemory.java
landongw/disease-pattern-miner
e62d7ec76b09330cf95c8dbe9993e41e77cc6cc6
[ "MIT" ]
6
2019-04-26T13:58:36.000Z
2020-12-31T06:35:22.000Z
35.8125
114
0.713205
2,126
package test; import algorithms.clustering.optics.AlgoOPTICS; import algorithms.clustering.optics.DoubleArrayOPTICS; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URL; import java.util.List; /** * Example of how to use the OPTICS algorithm from the source code to obtain the OPTICS cluster * ordering of points and keep the result in memory. */ public class MainTestOPTICS_extractClusterOrdering_saveToMemory { public static void main(String[] args) throws NumberFormatException, IOException { String input = fileToPath("inputDBScan2.txt"); // we set the parameters of DBScan: int minPts = 2; double epsilon = 2d; // We specify that in the input file, double values on each line are separated by spaces String separator = " "; // Apply the algorithm to compute a cluster ordering AlgoOPTICS algo = new AlgoOPTICS(); List<DoubleArrayOPTICS> clusterOrdering = algo.computerClusterOrdering(input, minPts, epsilon, separator); // Print the cluster-ordering of points to the console (for debugging) System.out.println("THE CLUSTER ORDERING:"); System.out.println(" [data point] - reachability distance"); for (DoubleArrayOPTICS arrayOP : clusterOrdering) { System.out.println(arrayOP.toString() + " " + arrayOP.reachabilityDistance); } algo.printStatistics(); } public static String fileToPath(String filename) throws UnsupportedEncodingException { URL url = MainTestOPTICS_extractClusterOrdering_saveToMemory.class.getResource(filename); return java.net.URLDecoder.decode(url.getPath(), "UTF-8"); } }
3e051371d5f2fe8cecd1c6f98af31cf395536460
2,403
java
Java
src/nb/barmie/modes/attack/attacks/Java/JMXDeser.java
wdahlenburg/BaRMIe
41f2f0b587ed2fe008271e1f7b5ddec82ac0a0af
[ "MIT" ]
623
2017-09-25T00:43:30.000Z
2022-03-31T02:39:33.000Z
src/nb/barmie/modes/attack/attacks/Java/JMXDeser.java
wdahlenburg/BaRMIe
41f2f0b587ed2fe008271e1f7b5ddec82ac0a0af
[ "MIT" ]
4
2018-10-31T00:54:36.000Z
2021-11-07T18:45:21.000Z
src/nb/barmie/modes/attack/attacks/Java/JMXDeser.java
wdahlenburg/BaRMIe
41f2f0b587ed2fe008271e1f7b5ddec82ac0a0af
[ "MIT" ]
97
2017-09-25T08:34:03.000Z
2022-03-20T14:55:50.000Z
37.546875
210
0.672077
2,127
package nb.barmie.modes.attack.attacks.Java; import javax.management.remote.rmi.RMIServer; import nb.barmie.exceptions.BaRMIeException; import nb.barmie.modes.attack.DeserPayload; import nb.barmie.modes.attack.RMIDeserAttack; import nb.barmie.modes.enumeration.RMIEndpoint; /*********************************************************** * Deliver a deserialization payload to a JMX RMI service, * via the Object-type parameter to the 'newClient' * method. * * Written by Nicky Bloor (@NickstaDB). **********************************************************/ public class JMXDeser extends RMIDeserAttack { /******************* * Set attack properties. ******************/ public JMXDeser() { super(); this.setDescription("JMX Deserialization"); this.setDetailedDescription("JMX uses an RMI service which exposes an object of type RMIServerImpl_Stub. The 'newClient' method accepts an arbitrary Object as a parameter, enabling deserialization attacks."); this.setRemediationAdvice("[JMX] Update Java to the latest available version"); this.setAppSpecific(false); } /******************* * Check if the given endpoint can be attacked. * * @param ep An enumerated RMI endpoint. * @return True if we can attack it. ******************/ public boolean canAttackEndpoint(RMIEndpoint ep) { return ep.hasClass("javax.management.remote.rmi.RMIServerImpl_Stub") || ep.hasClass("javax.management.remote.rmi.RMIServer"); } /******************* * Execute the deserialization attack against the given RMI endpoint using * the given payload. * * @param ep The enumerated RMI endpoint. * @param payload The deserialization payload to deliver. * @param cmd The command to use for payload generation. ******************/ public void executeAttack(RMIEndpoint ep, DeserPayload payload, String cmd) throws BaRMIeException { RMIServer obj; //Launch the attack try { //Get the fully proxied target object System.out.println("\n[~] Getting proxied jmxrmi object..."); obj = (RMIServer)this.getProxiedObject(ep, "jmxrmi", payload.getBytes(cmd, 0)); //Call the newClient() method, passing in the default payload marker System.out.println("[+] Retrieved, invoking newClient(PAYLOAD)..."); obj.newClient(this.DEFAULT_MARKER_OBJECT); } catch(Exception ex) { //Check the exception for useful info this.checkDeserException(ex); } } }
3e0513d5d0b599a01edcd1f23c13a3837f5a512e
2,680
java
Java
src/main/java/com/seu/common/component/RedisUtils.java
qinnnn/wblog
ad272e9e9ccbcd525b4ecdd824d02dfedec82dbd
[ "Apache-2.0" ]
null
null
null
src/main/java/com/seu/common/component/RedisUtils.java
qinnnn/wblog
ad272e9e9ccbcd525b4ecdd824d02dfedec82dbd
[ "Apache-2.0" ]
null
null
null
src/main/java/com/seu/common/component/RedisUtils.java
qinnnn/wblog
ad272e9e9ccbcd525b4ecdd824d02dfedec82dbd
[ "Apache-2.0" ]
null
null
null
27.628866
100
0.637313
2,128
package com.seu.common.component; import com.google.gson.Gson; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.*; import org.springframework.stereotype.Component; import java.util.concurrent.TimeUnit; /** * Redis工具类 * * @author qinnnn * @date 2018-09-04 15:00:55 */ @Component public class RedisUtils { @Autowired private RedisTemplate<String, Object> redisTemplate; @Autowired private ValueOperations<String, String> valueOperations; @Autowired private HashOperations<String, String, Object> hashOperations; @Autowired private ListOperations<String, Object> listOperations; @Autowired private SetOperations<String, Object> setOperations; @Autowired private ZSetOperations<String, Object> zSetOperations; /** * 默认过期时长 1天,单位:秒 */ public final static long DEFAULT_EXPIRE = 60 * 60 * 24; /** * 不设置过期时长 */ public final static long NOT_EXPIRE = -1; private final static Gson gson = new Gson(); public void set(String key, Object value, long expire) { valueOperations.set(key, toJson(value)); if (expire != NOT_EXPIRE) { redisTemplate.expire(key, expire, TimeUnit.SECONDS); } } public void set(String key, Object value) { set(key, value, DEFAULT_EXPIRE); } public <T> T get(String key, Class<T> clazz, long expire) { String value = valueOperations.get(key); if (expire != NOT_EXPIRE) { redisTemplate.expire(key, expire, TimeUnit.SECONDS); } return value == null ? null : fromJson(value, clazz); } public <T> T get(String key, Class<T> clazz) { return get(key, clazz, NOT_EXPIRE); } public String get(String key, long expire) { String value = valueOperations.get(key); if (expire != NOT_EXPIRE) { redisTemplate.expire(key, expire, TimeUnit.SECONDS); } return value; } public String get(String key) { return get(key, NOT_EXPIRE); } public void delete(String key) { redisTemplate.delete(key); } /** * Object转成JSON数据 */ private String toJson(Object object) { if (object instanceof Integer || object instanceof Long || object instanceof Float || object instanceof Double || object instanceof Boolean || object instanceof String) { return String.valueOf(object); } return gson.toJson(object); } /** * JSON数据,转成Object */ private <T> T fromJson(String json, Class<T> clazz) { return gson.fromJson(json, clazz); } }
3e0514a7762d39b331815d7e5e0922699bce5fcf
358
java
Java
simpleimageloader/src/main/java/com/solarexsoft/simpleimageloader/core/ImageListener.java
flyfire/SimpleImageLoader
2cfd62dbc842e2d2b0f538d6aa886cdfa5d06f28
[ "MIT" ]
1
2017-07-06T04:50:59.000Z
2017-07-06T04:50:59.000Z
simpleimageloader/src/main/java/com/solarexsoft/simpleimageloader/core/ImageListener.java
flyfire/SimpleImageLoader
2cfd62dbc842e2d2b0f538d6aa886cdfa5d06f28
[ "MIT" ]
null
null
null
simpleimageloader/src/main/java/com/solarexsoft/simpleimageloader/core/ImageListener.java
flyfire/SimpleImageLoader
2cfd62dbc842e2d2b0f538d6aa886cdfa5d06f28
[ "MIT" ]
null
null
null
19.888889
68
0.703911
2,129
package com.solarexsoft.simpleimageloader.core; import android.graphics.Bitmap; import android.widget.ImageView; /** * <pre> * Author: houruhou * Project: https://solarex.github.io/projects * CreatAt: 12/06/2017 * Desc: * </pre> */ public interface ImageListener { void onComplete(ImageView imageView, Bitmap bitmap, String uri); }
3e0515162cc1da6e82823a8edf734ad7f4db1a96
108
java
Java
app/src/main/java/com/lanyuan/picking/pattern/Searchable.java
lanyuanxiaoyao/PicKing
afdecc62e41a674a02846b934e96342d1c138847
[ "Apache-2.0" ]
27
2017-07-30T15:35:53.000Z
2020-07-26T09:42:14.000Z
app/src/main/java/com/lanyuan/picking/pattern/Searchable.java
lanyuanxiaoyao/PicKing
afdecc62e41a674a02846b934e96342d1c138847
[ "Apache-2.0" ]
1
2017-09-02T16:05:07.000Z
2017-09-02T16:05:07.000Z
app/src/main/java/com/lanyuan/picking/pattern/Searchable.java
lanyuanxiaoyao/PicKing
afdecc62e41a674a02846b934e96342d1c138847
[ "Apache-2.0" ]
11
2017-08-31T05:56:59.000Z
2020-01-15T02:57:36.000Z
13.5
36
0.759259
2,130
package com.lanyuan.picking.pattern; public interface Searchable { String getSearch(String query); }
3e05156d01c6ee54dcf6590214d335762233fbdf
3,271
java
Java
Java tool/TIA-XML-modcheck/lib/jgrapht-1.5.0/source/jgrapht-io/src/main/java/org/jgrapht/nio/csv/DSVUtils.java
roelerps/TIA-XML-modcheck
6f43945ac437263587a15a84dad75badddd48574
[ "MIT" ]
null
null
null
Java tool/TIA-XML-modcheck/lib/jgrapht-1.5.0/source/jgrapht-io/src/main/java/org/jgrapht/nio/csv/DSVUtils.java
roelerps/TIA-XML-modcheck
6f43945ac437263587a15a84dad75badddd48574
[ "MIT" ]
null
null
null
Java tool/TIA-XML-modcheck/lib/jgrapht-1.5.0/source/jgrapht-io/src/main/java/org/jgrapht/nio/csv/DSVUtils.java
roelerps/TIA-XML-modcheck
6f43945ac437263587a15a84dad75badddd48574
[ "MIT" ]
null
null
null
31.451923
98
0.627943
2,131
/* * (C) Copyright 2016-2020, by Dimitrios Michail and Contributors. * * JGraphT : a free Java graph-theory library * * See the CONTRIBUTORS.md file distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0, or the * GNU Lesser General Public License v2.1 or later * which is available at * http://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html. * * SPDX-License-Identifier: EPL-2.0 OR LGPL-2.1-or-later */ package org.jgrapht.nio.csv; /** * Helper utilities for escaping and unescaping Delimiter-separated values. * * @author Dimitrios Michail */ class DSVUtils { private static final char DSV_QUOTE = '"'; private static final char DSV_LF = '\n'; private static final char DSV_CR = '\r'; private static final String DSV_QUOTE_AS_STRING = String.valueOf(DSV_QUOTE); /** * Test if a character can be used as a delimiter in a Delimiter-separated values file. * * @param delimiter the character to test * @return {@code true} if the character can be used as a delimiter, {@code} false otherwise */ public static boolean isValidDelimiter(char delimiter) { return delimiter != DSV_LF && delimiter != DSV_CR && delimiter != DSV_QUOTE; } /** * Escape a Delimiter-separated values string. * * @param input the input * @param delimiter the delimiter * @return the escaped output */ public static String escapeDSV(String input, char delimiter) { char[] specialChars = new char[] { delimiter, DSV_QUOTE, DSV_LF, DSV_CR }; boolean containsSpecial = false; for (int i = 0; i < specialChars.length; i++) { if (input.contains(String.valueOf(specialChars[i]))) { containsSpecial = true; break; } } if (containsSpecial) { return DSV_QUOTE_AS_STRING + input.replaceAll(DSV_QUOTE_AS_STRING, DSV_QUOTE_AS_STRING + DSV_QUOTE_AS_STRING) + DSV_QUOTE_AS_STRING; } return input; } /** * Unescape a Delimiter-separated values string. * * @param input the input * @param delimiter the delimiter * @return the unescaped output */ public static String unescapeDSV(String input, char delimiter) { char[] specialChars = new char[] { delimiter, DSV_QUOTE, DSV_LF, DSV_CR }; if (input.charAt(0) != DSV_QUOTE || input.charAt(input.length() - 1) != DSV_QUOTE) { return input; } String noQuotes = input.subSequence(1, input.length() - 1).toString(); boolean containsSpecial = false; for (int i = 0; i < specialChars.length; i++) { if (noQuotes.contains(String.valueOf(specialChars[i]))) { containsSpecial = true; break; } } if (containsSpecial) { return noQuotes .replaceAll(DSV_QUOTE_AS_STRING + DSV_QUOTE_AS_STRING, DSV_QUOTE_AS_STRING); } return input; } }
3e05158cfb51886e52e9e1ae32e2760a572f51ec
7,492
java
Java
sources/core-app/src/main/java/sanzol/se/web/controllers/SeRegistrationsController.java
sanzol-tech/core-app-v2
2f8f8f308216c45374f7cc5ffa4038e74b40e355
[ "MIT" ]
null
null
null
sources/core-app/src/main/java/sanzol/se/web/controllers/SeRegistrationsController.java
sanzol-tech/core-app-v2
2f8f8f308216c45374f7cc5ffa4038e74b40e355
[ "MIT" ]
null
null
null
sources/core-app/src/main/java/sanzol/se/web/controllers/SeRegistrationsController.java
sanzol-tech/core-app-v2
2f8f8f308216c45374f7cc5ffa4038e74b40e355
[ "MIT" ]
null
null
null
20.696133
124
0.703284
2,132
package sanzol.se.web.controllers; import static sanzol.app.config.I18nPreference.getI18nString; import java.io.Serializable; import java.util.List; import javax.inject.Named; import javax.servlet.http.HttpServletRequest; import org.omnifaces.cdi.ViewScoped; import sanzol.app.config.Permissions; import sanzol.se.audit.AuditEvents; import sanzol.se.audit.AuditService; import sanzol.se.commons.FacesUtils; import sanzol.se.commons.SecurityUtils; import sanzol.se.context.RequestContext; import sanzol.se.model.entities.SeRegistration; import sanzol.se.model.entities.SeRegistrationState; import sanzol.se.services.SeRegistrationsService; import sanzol.se.services.cache.SeRegistrationsStatesCache; import sanzol.util.PoiUtils; @Named @ViewScoped public class SeRegistrationsController implements Serializable { private static final long serialVersionUID = 1L; private static final String THIS_PAGE = "seRegistrations"; private static final String MESSAGE_NO_RECORD_SELECTED = getI18nString("message.noRecordSelected"); private List<SeRegistration> lstSeRegistrations; private SeRegistration seRegistration; private List<SeRegistrationState> lstSeRegistrationState; private Integer registrationStateId; private boolean onlyNotExpired = true; private boolean displayMode = true; private boolean editMode = false; public List<SeRegistration> getLstSeRegistrations() { return lstSeRegistrations; } public SeRegistration getSeRegistration() { return seRegistration; } public void setSeRegistration(SeRegistration seRegistration) { this.seRegistration = seRegistration; } public Integer getRegistrationStateId() { return registrationStateId; } public void setRegistrationStateId(Integer registrationStateId) { this.registrationStateId = registrationStateId; } public boolean isOnlyNotExpired() { return onlyNotExpired; } public void setOnlyNotExpired(boolean onlyNotExpired) { this.onlyNotExpired = onlyNotExpired; } public List<SeRegistrationState> getLstSeRegistrationState() { return lstSeRegistrationState; } public boolean isDisplayMode() { return displayMode; } public void setDisplayMode(boolean displayMode) { this.displayMode = displayMode; } public boolean isEditMode() { return editMode; } public void setEditMode(boolean editMode) { this.editMode = editMode; } public void pageLoad() { HttpServletRequest request = FacesUtils.getRequest(); if (!SecurityUtils.isGranted(request, Permissions.PERMISSION_SE_REGISTRATIONS, Permissions.LEVEL_READ_ONLY)) { SecurityUtils.redirectAccessDenied(request, FacesUtils.getResponse()); return; } RequestContext context = RequestContext.createContext(request); try { loadSeRegistrationsStates(); loadGrid(context); // ----- Audit ----------------------------------------------------------------------------------------- if (!context.hasErrorOrFatal()) { AuditService.auditPageLoad(context, THIS_PAGE, null); } } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } private void loadGrid(RequestContext context) { SeRegistrationsService service = new SeRegistrationsService(context); lstSeRegistrations = service.getSeRegistrations(registrationStateId, onlyNotExpired); } private void loadSeRegistrationsStates() { lstSeRegistrationState = SeRegistrationsStatesCache.getSeRegistrationsStates(); /* 1 - todo 2 - invitaciones 3 - user request 4 - pendientes de aprobacion 5 - finalizados / expirados */ } public void refresh() { RequestContext context = RequestContext.createContext(); try { loadGrid(context); } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } public void edit() { if (seRegistration == null || seRegistration.getRegistrationId() == null) { FacesUtils.addMessageFatal(MESSAGE_NO_RECORD_SELECTED); return; } RequestContext context = RequestContext.createContext(); try { SeRegistrationsService service = new SeRegistrationsService(context); seRegistration = service.getSeRegistration(seRegistration.getRegistrationId()); if (context.hasErrorOrFatal()) { return; } displayMode = false; editMode = true; // ----- Audit ----------------------------------------------------------------------------------------- AuditService.auditSelect(context, THIS_PAGE, seRegistration.getRegistrationId().toString(), null, null); } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } public void cancel() { seRegistration = null; displayMode = true; editMode = false; } public void authorize() { RequestContext context = RequestContext.createContext(); try { SeRegistrationsService service = new SeRegistrationsService(context); service.authorizationSuccessful(seRegistration); if (context.hasErrorOrFatal()) { return; } displayMode = true; editMode = false; loadGrid(context); } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } public void revoke() { RequestContext context = RequestContext.createContext(); try { SeRegistrationsService service = new SeRegistrationsService(context); service.authorizationRevoked(seRegistration); if (context.hasErrorOrFatal()) { return; } displayMode = true; editMode = false; loadGrid(context); } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } public void delete() { if (seRegistration == null) { FacesUtils.addMessageFatal(MESSAGE_NO_RECORD_SELECTED); return; } RequestContext context = RequestContext.createContext(); try { SeRegistrationsService service = new SeRegistrationsService(context); service.delSeRegistration(seRegistration); if (context.hasErrorOrFatal()) { return; } displayMode = true; editMode = false; loadGrid(context); } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } public void postProcessXLSX(Object document) { RequestContext context = RequestContext.createContext(); try { PoiUtils.postProcessXLS(document); AuditService.auditNavigation(context, AuditEvents.EXPORT_XLSX, THIS_PAGE, null, null, null); } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } public void postProcessCSV(Object document) { RequestContext context = RequestContext.createContext(); try { AuditService.auditNavigation(context, AuditEvents.EXPORT_CSV, THIS_PAGE, null, null, null); } catch (Exception e) { context.getMsgLogger().addMessage(e); } finally { context.close(); } } // ------------------------------------------------------------------------------------------------------------------------ public static String getRowStyleClass(SeRegistration seRegistration) { if (seRegistration.getRegistrationStateId().equals(SeRegistrationsStatesCache.AUTHORIZATION_PENDING)) { return "text-bold"; } if (seRegistration.getRegistrationStateId().equals(SeRegistrationsStatesCache.AUTHORIZATION_REVOKED)) { return "text-through"; } if (seRegistration.isExpired()) { return "text-through"; } return null; } }
3e0516b6f75d4b425fdf666b542945f4296d27c8
2,807
java
Java
rxretrofithttputils/src/main/java/com/abe/dwwd/rxretrofithttputils/HttpInstance/GlobalRxHttp.java
yyyAndroid/AbeRetrofitRxjava
f0bef85ad95ea30c7e3bba33000875b89917aca6
[ "Apache-2.0" ]
null
null
null
rxretrofithttputils/src/main/java/com/abe/dwwd/rxretrofithttputils/HttpInstance/GlobalRxHttp.java
yyyAndroid/AbeRetrofitRxjava
f0bef85ad95ea30c7e3bba33000875b89917aca6
[ "Apache-2.0" ]
null
null
null
rxretrofithttputils/src/main/java/com/abe/dwwd/rxretrofithttputils/HttpInstance/GlobalRxHttp.java
yyyAndroid/AbeRetrofitRxjava
f0bef85ad95ea30c7e3bba33000875b89917aca6
[ "Apache-2.0" ]
null
null
null
23.391667
120
0.605629
2,133
package com.abe.dwwd.rxretrofithttputils.HttpInstance; import android.util.Log; import com.abe.dwwd.rxretrofithttputils.Client.HttpClient; import com.abe.dwwd.rxretrofithttputils.Client.RetrofitClient; import com.abe.dwwd.rxretrofithttputils.interceptor.HeaderInterceptor; import java.util.Map; import okhttp3.OkHttpClient; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; /** * Created by abe on 2017/7/31. */ public class GlobalRxHttp { private static GlobalRxHttp instance; public static GlobalRxHttp getInstance(){ if (instance == null){ synchronized (GlobalRxHttp.class){ if (instance == null){ instance = new GlobalRxHttp(); } } } return instance; } /** * 设置 baseUrl * @param baseUrl * @return */ public GlobalRxHttp setBaseUrl(String baseUrl){ getGlobalRetrofitBuilder().baseUrl(baseUrl); return this; } /** * 设置自己的client * * @param okClient * @return */ public GlobalRxHttp setOkClient(OkHttpClient okClient) { getGlobalRetrofitBuilder().client(okClient); return this; } /** * 添加统一的请求头 * * @param headerMaps * @return */ public GlobalRxHttp setHeaders(Map<String, Object> headerMaps) { getGlobalOkHttpBuilder().addInterceptor(new HeaderInterceptor(headerMaps)); return this; } /** * 是否开启请求日志 * * @param isShowLog * @return */ public GlobalRxHttp setLog(boolean isShowLog) { if (isShowLog) { HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() { @Override public void log(String message) { Log.e("RxHttpUtils", message); } }); loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); getGlobalOkHttpBuilder().addInterceptor(loggingInterceptor); } return this; } /** * 全局的 retrofit * * @return */ public static Retrofit getGlobalRetrofit() { return RetrofitClient.getInstance().getRetrofit(); } /** * 全局的 RetrofitBuilder * * @return */ public Retrofit.Builder getGlobalRetrofitBuilder() { return RetrofitClient.getInstance().getRetrofitBuilder(); } public OkHttpClient.Builder getGlobalOkHttpBuilder() { return HttpClient.getInstance().getBuilder(); } /** * 使用全局变量的请求 * * @param cls * @param <K> * @return */ public static <K> K createGApi(final Class<K> cls) { return getGlobalRetrofit().create(cls); } }
3e05170a92059e612a800c709b1c76aea19afe2b
1,282
java
Java
src/main/java/com/rizki/mufrizal/pelayanan/labti/service/PraktikumService.java
RizkiMufrizal/Pelayanan-LabTI
f54cf70080e33d18e19e2b15cb1d4ca0eb335a9a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/rizki/mufrizal/pelayanan/labti/service/PraktikumService.java
RizkiMufrizal/Pelayanan-LabTI
f54cf70080e33d18e19e2b15cb1d4ca0eb335a9a
[ "Apache-2.0" ]
null
null
null
src/main/java/com/rizki/mufrizal/pelayanan/labti/service/PraktikumService.java
RizkiMufrizal/Pelayanan-LabTI
f54cf70080e33d18e19e2b15cb1d4ca0eb335a9a
[ "Apache-2.0" ]
2
2018-04-23T06:48:27.000Z
2018-09-07T03:56:11.000Z
30.809524
97
0.743431
2,134
/** * Copyright (C) 2016 Rizki Mufrizal (https://rizkimufrizal.github.io/) ([email protected]) * * 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.rizki.mufrizal.pelayanan.labti.service; import com.rizki.mufrizal.pelayanan.labti.domain.Praktikum; /** * @Author Rizki Mufrizal <[email protected]> * @Since May 1, 2016 * @Time 9:10:37 AM * @Encoding UTF-8 * @Project Pelayanan-LabTI * @Package com.rizki.mufrizal.pelayanan.labti.service * */ public interface PraktikumService { public void simpanPraktikum(Praktikum praktikum); public void ubahPraktikum(Praktikum praktikum); public void hapusPraktikum(String idPraktikum); public Praktikum getPraktikum(String idPraktikum); public Iterable<Praktikum> getPraktikums(); }
3e05184c9267e120b5624bd749b152a8148974d7
355
java
Java
app/src/main/java/com/cswithandroidproject/ashwani/hangman/AboutActivity.java
ashwani99/Hangman
f9562b8f85d26a915588f0928520cdcec52c251e
[ "MIT" ]
7
2018-10-09T17:54:05.000Z
2021-11-29T22:37:00.000Z
app/src/main/java/com/cswithandroidproject/ashwani/hangman/AboutActivity.java
ashwani99/Hangman
f9562b8f85d26a915588f0928520cdcec52c251e
[ "MIT" ]
null
null
null
app/src/main/java/com/cswithandroidproject/ashwani/hangman/AboutActivity.java
ashwani99/Hangman
f9562b8f85d26a915588f0928520cdcec52c251e
[ "MIT" ]
1
2020-07-11T22:47:05.000Z
2020-07-11T22:47:05.000Z
25.357143
56
0.771831
2,135
package com.cswithandroidproject.ashwani.hangman; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class AboutActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); } }
3e0519c58519ea6405dfb312e389c0a25d0a3f9a
974
java
Java
src/main/java/org/orekit/files/sp3/package-info.java
gbonnefille/Orekit
36d9d73ba458cef55a08df8ca17ff4ac598a4a34
[ "Apache-2.0" ]
null
null
null
src/main/java/org/orekit/files/sp3/package-info.java
gbonnefille/Orekit
36d9d73ba458cef55a08df8ca17ff4ac598a4a34
[ "Apache-2.0" ]
null
null
null
src/main/java/org/orekit/files/sp3/package-info.java
gbonnefille/Orekit
36d9d73ba458cef55a08df8ca17ff4ac598a4a34
[ "Apache-2.0" ]
null
null
null
38.96
75
0.749487
2,136
/* Copyright 2002-2017 CS Systèmes d'Information * Licensed to CS Systèmes d'Information (CS) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * CS 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. */ /** * *This package provides a parser for orbit data stored in SP3 format. * *@author T. Neidhart * */ package org.orekit.files.sp3;
3e051a7fdc3223e885c2f1e309fbacaf1335ada2
1,238
java
Java
ch04/Integration/test/mjg/ast/immutable/ImmutablePointFactoryTest.java
Mickelback00/Making-Java-Groovy
30222d1fa3d65d0ce1c7aa16703f043e34dcef7f
[ "Apache-2.0", "MIT" ]
83
2015-01-13T21:44:54.000Z
2021-12-24T16:39:00.000Z
ch04/Integration/test/mjg/ast/immutable/ImmutablePointFactoryTest.java
Mickelback00/Making-Java-Groovy
30222d1fa3d65d0ce1c7aa16703f043e34dcef7f
[ "Apache-2.0", "MIT" ]
2
2016-07-08T00:25:12.000Z
2021-05-24T09:12:41.000Z
ch04/Integration/test/mjg/ast/immutable/ImmutablePointFactoryTest.java
Mickelback00/Making-Java-Groovy
30222d1fa3d65d0ce1c7aa16703f043e34dcef7f
[ "Apache-2.0", "MIT" ]
60
2015-01-17T17:55:50.000Z
2022-01-18T08:15:18.000Z
34.388889
75
0.672052
2,137
/* =================================================== * Copyright 2012 Kousen IT, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ package mjg.ast.immutable; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import org.junit.Test; public class ImmutablePointFactoryTest { private ImmutablePoint p; @Test public void testNewImmutablePoint() { // p = ImmutablePointFactory.instance.newImmutablePoint(2, 3); // p = new ImmutablePointFactory().newImmutablePoint(2, 3); p = ImmutablePointFactory.newIP(2, 3); assertNotNull(p); assertEquals(2, p.getX(), 0.0001); assertEquals(3, p.getY(), 0.0001); } }
3e051b85f286b97f07ecc468608e5fea7d9b329c
1,204
java
Java
app/src/main/java/com/rdebokx/ltga/config/GeneticConfiguration.java
rdebokx/ltga-gomea-parallel
f172133a7b52d6cf00c1e3ec91b850a835e5c56f
[ "MIT" ]
null
null
null
app/src/main/java/com/rdebokx/ltga/config/GeneticConfiguration.java
rdebokx/ltga-gomea-parallel
f172133a7b52d6cf00c1e3ec91b850a835e5c56f
[ "MIT" ]
2
2021-08-19T19:58:04.000Z
2021-08-21T19:38:59.000Z
app/src/main/java/com/rdebokx/ltga/config/GeneticConfiguration.java
rdebokx/ltga-gomea-parallel
f172133a7b52d6cf00c1e3ec91b850a835e5c56f
[ "MIT" ]
null
null
null
33.444444
133
0.704319
2,138
package com.rdebokx.ltga.config; /** * * @author Rdebokx * */ public class GeneticConfiguration { public final int POPULATION_SIZE; public final int TOURNAMENT_SIZE; public final int SELECTION_SIZE; public final int NUMBER_OF_PARAMETERS; /** * Constructor, constructing a Genetic Configuration object based on the given parameters. * @param populationSize The population size for the job. * @param tournamentSize The tournament size of the job. * @param selectionSize The size of the selection of the job. * @param numberOfParameters The number of parameters for the problem of this job. */ public GeneticConfiguration(int populationSize, int tournamentSize, int selectionSize, int numberOfParameters) { POPULATION_SIZE = populationSize; TOURNAMENT_SIZE = tournamentSize; SELECTION_SIZE = selectionSize; NUMBER_OF_PARAMETERS = numberOfParameters; } @Override public String toString(){ return "PopulationSize: " + POPULATION_SIZE + "\nTournamentSize: " + TOURNAMENT_SIZE + "\nSelectionSize: " + SELECTION_SIZE + "\nNumberOfParameters: " + NUMBER_OF_PARAMETERS; } }
3e051bee6a594fa5164d53807f994c592bd45d47
5,119
java
Java
core/src/main/java/hudson/security/AuthenticationProcessingFilter2.java
sratz/jenkins
3cfb512909432ef8129233599592026336c8533d
[ "MIT" ]
1
2021-06-04T06:07:04.000Z
2021-06-04T06:07:04.000Z
core/src/main/java/hudson/security/AuthenticationProcessingFilter2.java
sratz/jenkins
3cfb512909432ef8129233599592026336c8533d
[ "MIT" ]
35
2021-03-29T08:54:30.000Z
2022-03-09T20:12:22.000Z
core/src/main/java/hudson/security/AuthenticationProcessingFilter2.java
sratz/jenkins
3cfb512909432ef8129233599592026336c8533d
[ "MIT" ]
1
2021-07-26T09:49:38.000Z
2021-07-26T09:49:38.000Z
48.752381
186
0.755421
2,139
/* * The MIT License * * Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi, Matthew R. Harrah * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package hudson.security; import hudson.model.User; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import jenkins.security.SecurityListener; import jenkins.security.seed.UserSeedProperty; import org.kohsuke.accmod.Restricted; import org.kohsuke.accmod.restrictions.NoExternalUse; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; import org.springframework.security.web.util.matcher.AntPathRequestMatcher; /** * Login filter with a change for Jenkins so that * we can pick up the hidden "from" form field defined in {@code login.jelly} * to send the user back to where he came from, after a successful authentication. * * @author Kohsuke Kawaguchi */ @Restricted(NoExternalUse.class) public final class AuthenticationProcessingFilter2 extends UsernamePasswordAuthenticationFilter { public AuthenticationProcessingFilter2(String authenticationGatewayUrl) { setRequiresAuthenticationRequestMatcher(new AntPathRequestMatcher("/" + authenticationGatewayUrl, "POST")); // Jenkins/login.jelly & SetupWizard/authenticate-security-token.jelly setUsernameParameter("j_username"); setPasswordParameter("j_password"); } @Override protected void successfulAuthentication(HttpServletRequest request, HttpServletResponse response, FilterChain chain, Authentication authResult) throws IOException, ServletException { super.successfulAuthentication(request, response, chain, authResult); // make sure we have a session to store this successful authentication, given that we no longer // let HttpSessionContextIntegrationFilter2 to create sessions. // SecurityContextPersistenceFilter stores the updated SecurityContext object into this session later // (either when a redirect is issued, via its HttpResponseWrapper, or when the execution returns to its // doFilter method. /* TODO causes an ISE on the next line: request.getSession().invalidate(); */ HttpSession newSession = request.getSession(); if (!UserSeedProperty.DISABLE_USER_SEED) { User user = User.getById(authResult.getName(), true); UserSeedProperty userSeed = user.getProperty(UserSeedProperty.class); String sessionSeed = userSeed.getSeed(); newSession.setAttribute(UserSeedProperty.USER_SESSION_SEED, sessionSeed); } // as the request comes from Spring Security redirect, that's not a Stapler one // thus it's not possible to retrieve it in the SecurityListener in that case // for that reason we need to keep the above code that apply quite the same logic as UserSeedSecurityListener SecurityListener.fireLoggedIn(authResult.getName()); } /** * Leave the information about login failure. */ @Override protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, AuthenticationException failed) throws IOException, ServletException { super.unsuccessfulAuthentication(request, response, failed); LOGGER.log(Level.FINE, "Login attempt failed", failed); /* TODO this information appears to have been deliberately removed from Spring Security: Authentication auth = failed.getAuthentication(); if (auth != null) { SecurityListener.fireFailedToLogIn(auth.getName()); } */ } private static final Logger LOGGER = Logger.getLogger(AuthenticationProcessingFilter2.class.getName()); }
3e051c0dcacc26250d59e1c04c8708b4cdc39ec9
6,361
java
Java
CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/parser/ImportFileParser.java
arcturus2/constellation
66639a4b75925758b8f25afdf590feed54cca5b9
[ "Apache-2.0" ]
348
2019-08-15T00:04:17.000Z
2022-03-31T04:51:43.000Z
CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/parser/ImportFileParser.java
arcturus2/constellation
66639a4b75925758b8f25afdf590feed54cca5b9
[ "Apache-2.0" ]
1,485
2019-08-17T11:09:38.000Z
2022-03-31T00:08:26.000Z
CoreImportExportPlugins/src/au/gov/asd/tac/constellation/plugins/importexport/delimited/parser/ImportFileParser.java
arcturus2/constellation
66639a4b75925758b8f25afdf590feed54cca5b9
[ "Apache-2.0" ]
96
2019-08-15T09:01:10.000Z
2021-12-28T01:20:12.000Z
36.142045
139
0.69989
2,140
/* * Copyright 2010-2021 Australian Signals Directorate * * 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 au.gov.asd.tac.constellation.plugins.importexport.delimited.parser; import au.gov.asd.tac.constellation.plugins.importexport.RefreshRequest; import au.gov.asd.tac.constellation.plugins.parameters.PluginParameter; import au.gov.asd.tac.constellation.plugins.parameters.PluginParameters; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import javafx.stage.FileChooser.ExtensionFilter; import org.openide.util.Lookup; import org.openide.util.lookup.ServiceProvider; /** * An ImportFileParser is responsible for converting a file into a table of * data. Current implementations include converting from CSV, TSV and SQLLite. * <p> * New parsers can be created by extending this class and registering the * subclass as a {@link ServiceProvider}. * * @author sirius */ public abstract class ImportFileParser { private static final Map<String, ImportFileParser> PARSERS = new LinkedHashMap<>(); private static final Map<String, ImportFileParser> UNMODIFIABLE_PARSERS = Collections.unmodifiableMap(PARSERS); public static final ImportFileParser DEFAULT_PARSER = getParsers().values().iterator().next(); private static synchronized void init() { if (PARSERS.isEmpty()) { final List<ImportFileParser> parsers = new ArrayList<>(Lookup.getDefault().lookupAll(ImportFileParser.class)); Collections.sort(parsers, (ImportFileParser o1, ImportFileParser o2) -> { return Integer.compare(o1.position, o2.position); }); parsers.stream().forEach(parser -> PARSERS.put(parser.label, parser)); } } /** * Returns instances of all registered ImportFileParser classes mapped by * their names. * <p> * The map returned is unmodifiable and its iterators will return the * ImportFileParser instances in order of position (highest first). * * @return Instances of all registered ImportFileParser classes mapped by * their names. */ public static Map<String, ImportFileParser> getParsers() { init(); return UNMODIFIABLE_PARSERS; } /** * Returns the ImportFileParser with the specified name or null if no * ImportFileParser has been registered with that name. * * @param label the label of a registered ImportFileParser. * * @return the ImportFileParser with the specified name. */ public static ImportFileParser getParser(final String label) { return UNMODIFIABLE_PARSERS.get(label); } private final String label; private final int position; /** * Creates a new ImportFileParser with a specified label and position. * * @param label the label of the ImportFileParser (displayed in the UI). * @param position the position of the ImportFileParser used for sorting a * list of parsers. */ public ImportFileParser(final String label, final int position) { this.label = label; this.position = position; } /** * Returns the label of this ImportFileParser. * * @return the label of this ImportFileParser. */ public final String getLabel() { return label; } /** * Returns the position of this ImportFileParser. The position is used to * sort a list of ImportFileParsers when displayed in the UI. * * @return the position of this ImportFileParser. */ public final int getPosition() { return position; } @Override public String toString() { return label; } /** * Returns a {@link PluginParameter}s that specifies all the parameters * required to configure this ImportFileParser. * * @param refreshRequest a RefreshRequest object that can be used by the * parameters to refresh the UI in response to parameter changes. * * @return a {@link PluginParameter}s that specifies all the parameters * required to configure this ImportFileParser. */ public PluginParameters getParameters(final RefreshRequest refreshRequest) { return null; } public void updateParameters(final PluginParameters parameters, final List<InputSource> inputs) { } /** * Returns the extension filter to use when browsing for files of this type. * * @return the extension filter to use when browsing for files of this type. */ public ExtensionFilter getExtensionFilter() { return null; } /** * Reads the entire file and returns a List of String arrays, each of which * represents a row in the resulting table. * * @param input Input file * @param parameters the parameters that configure the parse operation. * @return a List of String arrays, each of which represents a row in the * resulting table. * @throws IOException if an error occurred while reading the file. */ public abstract List<String[]> parse(final InputSource input, final PluginParameters parameters) throws IOException; /** * Reads only {@code limit} lines and returns a List of String arrays, each * of which represents a row in the resulting table. * * @param input Input file * @param parameters the parameters that configure the parse operation. * @param limit Row limit * @return a List of String arrays, each of which represents a row in the * resulting table. * @throws IOException if an error occurred while reading the file. */ public abstract List<String[]> preview(final InputSource input, final PluginParameters parameters, final int limit) throws IOException; }
3e051c673566941cca7d0a8004ea70b353b9ca4d
3,305
java
Java
troubleshooting-apps/apps/turbine-data-producer/src/main/java/com/redhat/energy/PowerMeasurementsEmitter.java
RedHatTraining/AD482-apps
1e9c8a118a19303af4aa6a7cf9419d3db47ace30
[ "Apache-2.0" ]
2
2021-08-10T02:15:59.000Z
2021-12-15T17:32:33.000Z
troubleshooting-apps/apps/turbine-data-producer/src/main/java/com/redhat/energy/PowerMeasurementsEmitter.java
RedHatTraining/AD482-apps
1e9c8a118a19303af4aa6a7cf9419d3db47ace30
[ "Apache-2.0" ]
12
2021-05-31T14:22:20.000Z
2021-11-02T11:21:10.000Z
troubleshooting-apps/solutions/turbine-data-producer/src/main/java/com/redhat/energy/PowerMeasurementsEmitter.java
RedHatTraining/AD482-apps
1e9c8a118a19303af4aa6a7cf9419d3db47ace30
[ "Apache-2.0" ]
23
2021-06-13T13:53:07.000Z
2022-03-09T01:46:22.000Z
29.247788
101
0.595461
2,141
package com.redhat.energy; import java.util.Properties; import java.util.concurrent.CompletableFuture; import org.apache.kafka.clients.producer.Callback; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.clients.producer.RecordMetadata; /** * Emits (produces) generated power measurements to Kafka */ public class PowerMeasurementsEmitter { private String topic; private Producer<Integer, Integer> powerProducer; private Boolean useTurbineTimestamps; public PowerMeasurementsEmitter(String topic, Properties props) { this.topic = topic; this.useTurbineTimestamps = false; powerProducer = new KafkaProducer<>(props); } /** * Emits (produces) power measurements into a Kafka topic * @param data the data object generated by the wind turbine */ public void emit(TurbineData data) { if (useTurbineTimestamps) { produceWithPotentialDelay(data); } else { produce(data); } } /** * Activates the use of turbine timestamps (included in {@link TurbineData} objects). * If active, then the Kafka producer will produce records using the turbine timestamps. * @return */ public PowerMeasurementsEmitter withTurbineTimestamps() { useTurbineTimestamps = true; return this; } private void produce(TurbineData data) { produce(data, false); } private void produce(TurbineData data, Boolean isDelayed) { ProducerRecord<Integer, Integer> record = createRecord(data); Callback callback = new Callback() { @Override public void onCompletion(RecordMetadata metadata, Exception e) { if (e != null) { System.out.println(e); } else { String delayed = isDelayed ? " - DELAYED!" : ""; String timestamp = useTurbineTimestamps ? " - Timestamp: " + data.timestamp : ""; System.out.println("Produced " + data + timestamp + delayed); } } }; powerProducer.send(record, callback); } private void produceWithPotentialDelay(TurbineData data) { CompletableFuture.supplyAsync(() -> { Boolean delayed = false; if (data.tick % 3 == 0) { simulateDelay(); delayed = true; } produce(data, delayed); return null; }); } private ProducerRecord<Integer, Integer> createRecord(TurbineData data) { ProducerRecord<Integer, Integer> record; if (useTurbineTimestamps) { record = new ProducerRecord<>( topic, null, data.timestamp, data.turbineId, data.power ); } else { record = new ProducerRecord<>(topic, data.turbineId, data.power); } return record; } private void simulateDelay() { try { Thread.sleep(11000); } catch (InterruptedException e1) { e1.printStackTrace(); } } }
3e051cf5a705ef68e0f822c086b720bc0f17391a
2,257
java
Java
Examples/Java/src/main/java/com/xci/javademo/SessionService.java
nuevollc/myzenkey
82b33af183232dec86bf587ac03c50a3868627af
[ "Apache-2.0" ]
6
2019-11-01T05:56:22.000Z
2021-12-05T16:35:32.000Z
Examples/Java/src/main/java/com/xci/javademo/SessionService.java
nuevollc/myzenkey
82b33af183232dec86bf587ac03c50a3868627af
[ "Apache-2.0" ]
3
2020-10-06T20:15:07.000Z
2021-07-26T13:14:31.000Z
Examples/Java/src/main/java/com/xci/javademo/SessionService.java
nuevollc/myzenkey
82b33af183232dec86bf587ac03c50a3868627af
[ "Apache-2.0" ]
6
2019-11-01T05:56:26.000Z
2021-06-23T17:43:30.000Z
30.917808
78
0.778024
2,142
/* * Copyright 2020 ZenKey, LLC. * * 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.xci.javademo; import javax.servlet.http.HttpSession; import com.nimbusds.oauth2.sdk.id.State; import com.nimbusds.oauth2.sdk.pkce.CodeVerifier; import com.nimbusds.openid.connect.sdk.Nonce; public class SessionService { private String stateSessionKey = "zenkey_state"; private String nonceSessionKey = "zenkey_nonce"; private String codeVerifierSessionKey = "zenkey_code_verifier"; private String mccmncSessionKey = "zenkey_mccmnc"; public SessionService() { } public void clear(HttpSession session) { session.removeAttribute(stateSessionKey); session.removeAttribute(mccmncSessionKey); session.removeAttribute(nonceSessionKey); session.removeAttribute(codeVerifierSessionKey); } public void setState(HttpSession session, State state) { session.setAttribute(stateSessionKey, state); } public State getState(HttpSession session) { return (State)session.getAttribute(stateSessionKey); } public void setNonce(HttpSession session, Nonce nonce) { session.setAttribute(nonceSessionKey, nonce); } public Nonce getNonce(HttpSession session) { return (Nonce)session.getAttribute(nonceSessionKey); } public void setCodeVerifier(HttpSession session, CodeVerifier codeVerifier) { session.setAttribute(codeVerifierSessionKey, codeVerifier); } public CodeVerifier getCodeVerifier(HttpSession session) { return (CodeVerifier)session.getAttribute(codeVerifierSessionKey); } public void setMccmnc(HttpSession session, String mccmnc) { session.setAttribute(mccmncSessionKey, mccmnc); } public String getMccmnc(HttpSession session) { return (String)session.getAttribute(mccmncSessionKey); } }
3e051d6f9e11e7c39c72e51a189b6f2275f99c57
616
java
Java
bookstore-service/src/main/java/org/people/weijuly/bookstore/converter/PurchaseConverter.java
rubal-98/spring-graphql-bookstore
9c0e06ac9ecf5b8cf30fc1ce450f4a97c7a63ce1
[ "MIT" ]
null
null
null
bookstore-service/src/main/java/org/people/weijuly/bookstore/converter/PurchaseConverter.java
rubal-98/spring-graphql-bookstore
9c0e06ac9ecf5b8cf30fc1ce450f4a97c7a63ce1
[ "MIT" ]
null
null
null
bookstore-service/src/main/java/org/people/weijuly/bookstore/converter/PurchaseConverter.java
rubal-98/spring-graphql-bookstore
9c0e06ac9ecf5b8cf30fc1ce450f4a97c7a63ce1
[ "MIT" ]
null
null
null
36.235294
95
0.774351
2,143
package org.people.weijuly.bookstore.converter; import org.people.weijuly.bookstore.data.BookEntity; import org.people.weijuly.bookstore.data.PurchaseEntity; import org.people.weijuly.bookstore.model.PurchaseModel; public class PurchaseConverter { public static PurchaseModel convert(PurchaseEntity purchaseEntity, BookEntity bookEntity) { PurchaseModel purchaseModel = new PurchaseModel(); purchaseModel.setId(purchaseEntity.getId()); purchaseModel.setBook(null); purchaseModel.setPurchasedOn(purchaseEntity.getPurchasedOn().toString()); return purchaseModel; } }
3e051d875046b44e76ade5f03830d0f83ad678c6
2,207
java
Java
MediaTest/app/src/main/java/com/example/mediatest/adapter/ListViewAdapter.java
MusicRevolution/LoushaoAndroid
e39c13fa16bed945f35460b4d4c980f4b9d3982a
[ "Apache-2.0" ]
null
null
null
MediaTest/app/src/main/java/com/example/mediatest/adapter/ListViewAdapter.java
MusicRevolution/LoushaoAndroid
e39c13fa16bed945f35460b4d4c980f4b9d3982a
[ "Apache-2.0" ]
null
null
null
MediaTest/app/src/main/java/com/example/mediatest/adapter/ListViewAdapter.java
MusicRevolution/LoushaoAndroid
e39c13fa16bed945f35460b4d4c980f4b9d3982a
[ "Apache-2.0" ]
null
null
null
25.964706
82
0.648391
2,144
package com.example.mediatest.adapter; import android.content.Context; import android.graphics.Bitmap; import android.media.ThumbnailUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import com.example.mediatest.bean.Movie; import com.example.mediatest.R; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import static android.provider.MediaStore.Video.Thumbnails.MINI_KIND; public class ListViewAdapter extends BaseAdapter { private Context context; private List<Movie> list; public ListViewAdapter(Context context, List<Movie> list) { this.context = context; this.list = list; } @Override public int getCount() { if (list != null) { return list.size(); } else { return 0; } } @Override public Object getItem(int i) { return list.get(i); } @Override public long getItemId(int i) { return i; } @Override public View getView(int i, View convertView, ViewGroup viewGroup) { View view; ViewHolder viewHolder; if (convertView == null) { view = LayoutInflater.from(context).inflate(R.layout.list_item, null); viewHolder = new ViewHolder(view); view.setTag(viewHolder); } else { view = convertView; viewHolder = (ViewHolder) view.getTag(); } viewHolder.textView.setText(list.get(i).getTitle()); String path = list.get(i).getPath(); Bitmap bitmap = ThumbnailUtils.createVideoThumbnail(path, MINI_KIND); bitmap = ThumbnailUtils.extractThumbnail(bitmap, 300, 180, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); viewHolder.imageView.setImageBitmap(bitmap); return view; } static class ViewHolder { @BindView(R.id.imageView) ImageView imageView; @BindView(R.id.textView) TextView textView; ViewHolder(View view) { ButterKnife.bind(this, view); } } }
3e051e78a94856c6fe01116255e4df6ea5b8a49b
2,828
java
Java
starter/DownloadXML/app/src/main/java/com/mpianatra/downloadxml/MainActivity.java
dragona/android-intro
37c112a981229d11580d2015ec5cf483f7f8b838
[ "MIT" ]
4
2021-03-19T02:35:46.000Z
2022-03-09T01:31:03.000Z
starter/DownloadXML/app/src/main/java/com/mpianatra/downloadxml/MainActivity.java
dragona/android-intro
37c112a981229d11580d2015ec5cf483f7f8b838
[ "MIT" ]
null
null
null
starter/DownloadXML/app/src/main/java/com/mpianatra/downloadxml/MainActivity.java
dragona/android-intro
37c112a981229d11580d2015ec5cf483f7f8b838
[ "MIT" ]
17
2020-02-25T09:26:29.000Z
2021-03-25T03:23:58.000Z
31.076923
101
0.577793
2,145
package com.mpianatra.downloadxml; import androidx.appcompat.app.AppCompatActivity; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.TextView; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void btnClick(View view) { new DownloadUpdate().execute(); } private class DownloadUpdate extends AsyncTask<String, Void, String> { @Override protected String doInBackground(String... strings) { String stringUrl = "https://studio.mg/student/Oxford-3000.xml"; HttpURLConnection urlConnection = null; BufferedReader reader; try { URL url = new URL(stringUrl); // Create the request to get the information from the server, and open the connection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.connect(); // Read the input stream into a String InputStream inputStream = urlConnection.getInputStream(); StringBuffer buffer = new StringBuffer(); if (inputStream == null) { // Nothing to do. return null; } reader = new BufferedReader(new InputStreamReader(inputStream)); String line; while ((line = reader.readLine()) != null) { // Mainly needed for debugging Log.d("TAG", line); buffer.append(line + "\n"); } if (buffer.length() == 0) { // Stream was empty. No point in parsing. return null; } //The temperature return buffer.toString(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (ProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(String temperature) { // Get the data and load it ((TextView) findViewById(R.id.data)).setText(temperature); } } }
3e051ef0352b5e397189f5e27ab007d9e1377612
2,341
java
Java
src/it/gabryca/onlyblockregen/OnlyBlockAdd.java
GABRYCA/OnlyBlockRegen
0ea329388c1ba1194f2d19b630b8e1d69d6faae0
[ "Apache-2.0" ]
2
2019-09-28T14:10:29.000Z
2019-09-28T14:12:55.000Z
src/it/gabryca/onlyblockregen/OnlyBlockAdd.java
GABRYCA/OnlyBlockRegen
0ea329388c1ba1194f2d19b630b8e1d69d6faae0
[ "Apache-2.0" ]
null
null
null
src/it/gabryca/onlyblockregen/OnlyBlockAdd.java
GABRYCA/OnlyBlockRegen
0ea329388c1ba1194f2d19b630b8e1d69d6faae0
[ "Apache-2.0" ]
null
null
null
42.563636
169
0.620675
2,146
package it.gabryca.onlyblockregen; import org.bukkit.ChatColor; import org.bukkit.Material; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.configuration.Configuration; public class OnlyBlockAdd implements CommandExecutor { @Override public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) { Configuration config = Main.getInstance().getConfig(); Configuration message = Main.getMessages(); if (!(commandSender.hasPermission(config.getString("Permissions.AddBlockPermission")))){ commandSender.sendMessage(ChatColor.RED + message.getString("Messages.Warn-NoPermission") + " [" + config.getString("Permissions.AddBlockPermission") + "]"); return true; } if (!(strings.length == 3)){ commandSender.sendMessage(ChatColor.RED + message.getString("Messages.Warn-Format")); return true; } if (Material.getMaterial(strings[0]) == null){ commandSender.sendMessage(ChatColor.RED + message.getString("Messages.Warn-NotMaterial") + " [ " + strings[0] + " ]"); return true; } if (Material.getMaterial(strings[1]) == null){ commandSender.sendMessage(ChatColor.RED + message.getString("Messages.Warn-NotMaterial") + " [ " + strings[1] + " ]"); return true; } int delay = Integer.parseInt(strings[2]); if (config.getString("blocks." + strings[0] + ".block") == null) { config.set("blocks." + strings[0] + ".block", strings[0]); config.set("blocks." + strings[0] + ".delayblock", strings[1]); config.set("blocks." + strings[0] + ".delay", delay); Main.getInstance().saveConfig(); commandSender.sendMessage("§a" + message.get("Messages.Block-Add-Success")); } else { config.set("blocks." + strings[0] + ".block", strings[0]); config.set("blocks." + strings[0] + ".delayblock", strings[1]); config.set("blocks." + strings[0] + ".delay", delay); Main.getInstance().saveConfig(); commandSender.sendMessage("§a" + message.get("Messages.Block-Changed")); } return true; } }
3e051ef0807370479c6aaf280d3e51ca66201354
25,427
java
Java
study-builder/fdahpStudyDesigner/src/main/java/com/fdahpstudydesigner/controller/UsersController.java
nobmizue-jcloudce/fda-mystudies
6b0d752eeba2c1a8b871d2dc931fdd81dbd854c9
[ "MIT" ]
1
2021-01-13T06:38:15.000Z
2021-01-13T06:38:15.000Z
study-builder/fdahpStudyDesigner/src/main/java/com/fdahpstudydesigner/controller/UsersController.java
nobmizue-jcloudce/fda-mystudies
6b0d752eeba2c1a8b871d2dc931fdd81dbd854c9
[ "MIT" ]
2
2021-01-17T11:50:01.000Z
2021-01-18T17:26:28.000Z
study-builder/fdahpStudyDesigner/src/main/java/com/fdahpstudydesigner/controller/UsersController.java
nobmizue-jcloudce/fda-mystudies
6b0d752eeba2c1a8b871d2dc931fdd81dbd854c9
[ "MIT" ]
1
2021-01-24T15:56:30.000Z
2021-01-24T15:56:30.000Z
46.063406
122
0.665906
2,147
/* * Copyright © 2017-2018 Harvard Pilgrim Health Care Institute (HPHCI) and its Contributors. * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is furnished to do so, subject to the * following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial * portions of the Software. * * Funding Source: Food and Drug Administration ("Funding Agency") effective 18 September 2014 as Contract no. * HHSF22320140030I/HHSF22301006T (the "Prime Contract"). * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ package com.fdahpstudydesigner.controller; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.ACCOUNT_DETAILS_VIEWED; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.NEW_USER_CREATION_FAILED; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.NEW_USER_INVITATION_RESENT; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.PASSWORD_CHANGE_ENFORCED_FOR_ALL_USERS; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.PASSWORD_CHANGE_ENFORCED_FOR_USER; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.PASSWORD_CHANGE_ENFORCEMENT_EMAIL_FAILED; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.PASSWORD_CHANGE_ENFORCEMENT_FOR_ALL_USERS_EMAIL_FAILED; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.PASSWORD_CHANGE_ENFORCEMENT_FOR_ALL_USERS_EMAIL_SENT; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.PASSWORD_ENFORCEMENT_EMAIL_SENT; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.PASSWORD_HELP_EMAIL_FAILED; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.USER_ACCOUNT_UPDATED_FAILED; import static com.fdahpstudydesigner.common.StudyBuilderAuditEvent.USER_RECORD_VIEWED; import com.fdahpstudydesigner.bean.AuditLogEventRequest; import com.fdahpstudydesigner.bean.StudyListBean; import com.fdahpstudydesigner.bo.RoleBO; import com.fdahpstudydesigner.bo.StudyBo; import com.fdahpstudydesigner.bo.UserBO; import com.fdahpstudydesigner.common.StudyBuilderAuditEventHelper; import com.fdahpstudydesigner.common.StudyBuilderConstants; import com.fdahpstudydesigner.mapper.AuditEventMapper; import com.fdahpstudydesigner.service.LoginService; import com.fdahpstudydesigner.service.StudyService; import com.fdahpstudydesigner.service.UsersService; import com.fdahpstudydesigner.util.FdahpStudyDesignerConstants; import com.fdahpstudydesigner.util.FdahpStudyDesignerUtil; import com.fdahpstudydesigner.util.SessionObject; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @Controller public class UsersController { private static Logger logger = Logger.getLogger(UsersController.class.getName()); @Autowired private LoginService loginService; @Autowired private StudyService studyService; @Autowired private UsersService usersService; @Autowired private StudyBuilderAuditEventHelper auditLogEventHelper; @RequestMapping("/adminUsersEdit/activateOrDeactivateUser.do") public void activateOrDeactivateUser( HttpServletRequest request, HttpServletResponse response, String userId, String userStatus) throws IOException { logger.info("UsersController - activateOrDeactivateUser() - Starts"); String msg = FdahpStudyDesignerConstants.FAILURE; JSONObject jsonobject = new JSONObject(); PrintWriter out; try { HttpSession session = request.getSession(); SessionObject userSession = (SessionObject) session.getAttribute(FdahpStudyDesignerConstants.SESSION_OBJECT); if (null != userSession) { msg = usersService.activateOrDeactivateUser( Integer.valueOf(userId), Integer.valueOf(userStatus), userSession.getUserId(), userSession, request); } } catch (Exception e) { logger.error("UsersController - activateOrDeactivateUser() - ERROR", e); } logger.info("UsersController - activateOrDeactivateUser() - Ends"); jsonobject.put("message", msg); response.setContentType("application/json"); out = response.getWriter(); out.print(jsonobject); } @RequestMapping("/adminUsersEdit/addOrEditUserDetails.do") public ModelAndView addOrEditUserDetails(HttpServletRequest request) { logger.info("UsersController - addOrEditUserDetails() - Starts"); ModelAndView mav = new ModelAndView(); ModelMap map = new ModelMap(); UserBO userBO = null; List<StudyListBean> studyBOs = null; List<RoleBO> roleBOList = null; List<StudyBo> studyBOList = null; String actionPage = ""; List<Integer> permissions = null; int usrId = 0; try { if (FdahpStudyDesignerUtil.isSession(request)) { String userId = FdahpStudyDesignerUtil.isEmpty(request.getParameter("userId")) ? "" : request.getParameter("userId"); String checkRefreshFlag = FdahpStudyDesignerUtil.isEmpty(request.getParameter("checkRefreshFlag")) ? "" : request.getParameter("checkRefreshFlag"); if (!"".equalsIgnoreCase(checkRefreshFlag)) { if (!"".equals(userId)) { usrId = Integer.valueOf(userId); actionPage = FdahpStudyDesignerConstants.EDIT_PAGE; userBO = usersService.getUserDetails(usrId); if (null != userBO) { studyBOs = studyService.getStudyListByUserId(userBO.getUserId()); permissions = usersService.getPermissionsByUserId(userBO.getUserId()); } } else { actionPage = FdahpStudyDesignerConstants.ADD_PAGE; } roleBOList = usersService.getUserRoleList(); studyBOList = studyService.getAllStudyList(); map.addAttribute("actionPage", actionPage); map.addAttribute("userBO", userBO); map.addAttribute("permissions", permissions); map.addAttribute("roleBOList", roleBOList); map.addAttribute("studyBOList", studyBOList); map.addAttribute("studyBOs", studyBOs); mav = new ModelAndView("addOrEditUserPage", map); } else { mav = new ModelAndView("redirect:/adminUsersView/getUserList.do"); } } } catch (Exception e) { logger.error("UsersController - addOrEditUserDetails() - ERROR", e); } logger.info("UsersController - addOrEditUserDetails() - Ends"); return mav; } @RequestMapping("/adminUsersEdit/addOrUpdateUserDetails.do") public ModelAndView addOrUpdateUserDetails( HttpServletRequest request, UserBO userBO, BindingResult result) { logger.info("UsersController - addOrUpdateUserDetails() - Starts"); ModelAndView mav = new ModelAndView(); String msg = ""; String permissions = ""; int count = 1; List<Integer> permissionList = new ArrayList<>(); boolean addFlag = false; Map<String, String> propMap = FdahpStudyDesignerUtil.getAppProperties(); try { HttpSession session = request.getSession(); SessionObject userSession = (SessionObject) session.getAttribute(FdahpStudyDesignerConstants.SESSION_OBJECT); if (null != userSession) { String manageUsers = FdahpStudyDesignerUtil.isEmpty(request.getParameter("manageUsers")) ? "" : request.getParameter("manageUsers"); String manageNotifications = FdahpStudyDesignerUtil.isEmpty(request.getParameter("manageNotifications")) ? "" : request.getParameter("manageNotifications"); String manageStudies = FdahpStudyDesignerUtil.isEmpty(request.getParameter("manageStudies")) ? "" : request.getParameter("manageStudies"); String addingNewStudy = FdahpStudyDesignerUtil.isEmpty(request.getParameter("addingNewStudy")) ? "" : request.getParameter("addingNewStudy"); String selectedStudies = FdahpStudyDesignerUtil.isEmpty(request.getParameter("selectedStudies")) ? "" : request.getParameter("selectedStudies"); String permissionValues = FdahpStudyDesignerUtil.isEmpty(request.getParameter("permissionValues")) ? "" : request.getParameter("permissionValues"); String ownUser = FdahpStudyDesignerUtil.isEmpty(request.getParameter("ownUser")) ? "" : request.getParameter("ownUser"); if (null == userBO.getUserId()) { addFlag = true; userBO.setCreatedBy(userSession.getUserId()); userBO.setCreatedOn(FdahpStudyDesignerUtil.getCurrentDateTime()); } else { addFlag = false; userBO.setModifiedBy(userSession.getUserId()); userBO.setModifiedOn(FdahpStudyDesignerUtil.getCurrentDateTime()); } if (!"".equals(manageUsers)) { if ("0".equals(manageUsers)) { permissions += count > 1 ? ",ROLE_MANAGE_USERS_VIEW" : "ROLE_MANAGE_USERS_VIEW"; count++; permissionList.add(FdahpStudyDesignerConstants.ROLE_MANAGE_USERS_VIEW); } else if ("1".equals(manageUsers)) { permissions += count > 1 ? ",ROLE_MANAGE_USERS_VIEW" : "ROLE_MANAGE_USERS_VIEW"; count++; permissionList.add(FdahpStudyDesignerConstants.ROLE_MANAGE_USERS_VIEW); permissions += count > 1 ? ",ROLE_MANAGE_USERS_EDIT" : "ROLE_MANAGE_USERS_EDIT"; permissionList.add(FdahpStudyDesignerConstants.ROLE_MANAGE_USERS_EDIT); } } if (!"".equals(manageNotifications)) { if ("0".equals(manageNotifications)) { permissions += count > 1 ? ",ROLE_MANAGE_APP_WIDE_NOTIFICATION_VIEW" : "ROLE_MANAGE_APP_WIDE_NOTIFICATION_VIEW"; count++; permissionList.add(FdahpStudyDesignerConstants.ROLE_MANAGE_APP_WIDE_NOTIFICATION_VIEW); } else if ("1".equals(manageNotifications)) { permissions += count > 1 ? ",ROLE_MANAGE_APP_WIDE_NOTIFICATION_VIEW" : "ROLE_MANAGE_APP_WIDE_NOTIFICATION_VIEW"; count++; permissionList.add(FdahpStudyDesignerConstants.ROLE_MANAGE_APP_WIDE_NOTIFICATION_VIEW); permissions += count > 1 ? ",ROLE_MANAGE_APP_WIDE_NOTIFICATION_EDIT" : "ROLE_MANAGE_APP_WIDE_NOTIFICATION_EDIT"; permissionList.add(FdahpStudyDesignerConstants.ROLE_MANAGE_APP_WIDE_NOTIFICATION_EDIT); } } if (!"".equals(manageStudies)) { if ("1".equals(manageStudies)) { permissions += count > 1 ? ",ROLE_MANAGE_STUDIES" : "ROLE_MANAGE_STUDIES"; count++; permissionList.add(FdahpStudyDesignerConstants.ROLE_MANAGE_STUDIES); if (!"".equals(addingNewStudy) && "1".equals(addingNewStudy)) { permissions += count > 1 ? ",ROLE_CREATE_MANAGE_STUDIES" : "ROLE_CREATE_MANAGE_STUDIES"; permissionList.add(FdahpStudyDesignerConstants.ROLE_CREATE_MANAGE_STUDIES); } } else { selectedStudies = ""; permissionValues = ""; } } else { selectedStudies = ""; permissionValues = ""; } AuditLogEventRequest auditRequest = AuditEventMapper.fromHttpServletRequest(request); msg = usersService.addOrUpdateUserDetails( request, userBO, permissions, permissionList, selectedStudies, permissionValues, userSession, auditRequest); if (FdahpStudyDesignerConstants.SUCCESS.equals(msg)) { if (addFlag) { request .getSession() .setAttribute( FdahpStudyDesignerConstants.SUC_MSG, propMap.get("add.user.success.message")); } else { request.getSession().setAttribute("ownUser", ownUser); request .getSession() .setAttribute( FdahpStudyDesignerConstants.SUC_MSG, propMap.get("update.user.success.message")); } } else { request.getSession().setAttribute(FdahpStudyDesignerConstants.ERR_MSG, msg); if (addFlag) { auditLogEventHelper.logEvent(NEW_USER_CREATION_FAILED, auditRequest); } else { auditLogEventHelper.logEvent(USER_ACCOUNT_UPDATED_FAILED, auditRequest); } } mav = new ModelAndView("redirect:/adminUsersView/getUserList.do"); } } catch (Exception e) { logger.error("UsersController - addOrUpdateUserDetails() - ERROR", e); } logger.info("UsersController - addOrUpdateUserDetails() - Ends"); return mav; } @RequestMapping("/adminUsersEdit/enforcePasswordChange.do") public ModelAndView enforcePasswordChange(HttpServletRequest request) { logger.info("UsersController - enforcePasswordChange() - Starts"); ModelAndView mav = new ModelAndView(); String msg = ""; List<String> emails = null; Map<String, String> propMap = FdahpStudyDesignerUtil.getAppProperties(); AuditLogEventRequest auditRequest = AuditEventMapper.fromHttpServletRequest(request); try { HttpSession session = request.getSession(); SessionObject userSession = (SessionObject) session.getAttribute(FdahpStudyDesignerConstants.SESSION_OBJECT); String changePassworduserId = FdahpStudyDesignerUtil.isEmpty(request.getParameter("changePassworduserId")) ? "" : request.getParameter("changePassworduserId"); String emailId = FdahpStudyDesignerUtil.isEmpty(request.getParameter("emailId")) ? "" : request.getParameter("emailId"); if (null != userSession) { if (StringUtils.isNotEmpty(emailId) && StringUtils.isNotEmpty(changePassworduserId)) { msg = usersService.enforcePasswordChange(Integer.parseInt(changePassworduserId), emailId); if (StringUtils.isNotEmpty(msg) && msg.equalsIgnoreCase(FdahpStudyDesignerConstants.SUCCESS)) { Map<String, String> values = new HashMap<>(); values.put(StudyBuilderConstants.EDITED_USER_ID, changePassworduserId); auditLogEventHelper.logEvent(PASSWORD_CHANGE_ENFORCED_FOR_USER, auditRequest, values); String sent = loginService.sendPasswordResetLinkToMail( request, emailId, "", "enforcePasswordChange", auditRequest); if (FdahpStudyDesignerConstants.SUCCESS.equals(sent)) { auditLogEventHelper.logEvent(PASSWORD_ENFORCEMENT_EMAIL_SENT, auditRequest, values); } else { auditLogEventHelper.logEvent( PASSWORD_CHANGE_ENFORCEMENT_EMAIL_FAILED, auditRequest, values); } } } else { msg = usersService.enforcePasswordChange(null, ""); if (StringUtils.isNotEmpty(msg) && msg.equalsIgnoreCase(FdahpStudyDesignerConstants.SUCCESS)) { auditLogEventHelper.logEvent(PASSWORD_CHANGE_ENFORCED_FOR_ALL_USERS, auditRequest); emails = usersService.getActiveUserEmailIds(); if ((emails != null) && !emails.isEmpty()) { boolean allSent = false; for (String email : emails) { String sent = loginService.sendPasswordResetLinkToMail( request, email, "", "enforcePasswordChange", auditRequest); if (FdahpStudyDesignerConstants.SUCCESS.equals(sent)) { allSent = true; } } if (allSent) { auditLogEventHelper.logEvent( PASSWORD_CHANGE_ENFORCEMENT_FOR_ALL_USERS_EMAIL_SENT, auditRequest); } else { auditLogEventHelper.logEvent( PASSWORD_CHANGE_ENFORCEMENT_FOR_ALL_USERS_EMAIL_FAILED, auditRequest); } } } } if (StringUtils.isNotEmpty(msg) && msg.equalsIgnoreCase(FdahpStudyDesignerConstants.SUCCESS)) { request .getSession() .setAttribute( FdahpStudyDesignerConstants.SUC_MSG, propMap.get("password.enforce.link.success.message")); } else { request .getSession() .setAttribute( FdahpStudyDesignerConstants.ERR_MSG, propMap.get("password.enforce.failure.message")); } mav = new ModelAndView("redirect:/adminUsersView/getUserList.do"); } } catch (Exception e) { logger.error("UsersController - enforcePasswordChange() - ERROR", e); } logger.info("UsersController - enforcePasswordChange() - Ends"); return mav; } @RequestMapping("/adminUsersView/getUserList.do") public ModelAndView getUserList(HttpServletRequest request) { logger.info("UsersController - getUserList() - Starts"); ModelAndView mav = new ModelAndView(); ModelMap map = new ModelMap(); List<UserBO> userList = null; String sucMsg = ""; String errMsg = ""; String ownUser = ""; List<RoleBO> roleList = null; try { if (FdahpStudyDesignerUtil.isSession(request)) { if (null != request.getSession().getAttribute(FdahpStudyDesignerConstants.SUC_MSG)) { sucMsg = (String) request.getSession().getAttribute(FdahpStudyDesignerConstants.SUC_MSG); map.addAttribute(FdahpStudyDesignerConstants.SUC_MSG, sucMsg); request.getSession().removeAttribute(FdahpStudyDesignerConstants.SUC_MSG); } if (null != request.getSession().getAttribute(FdahpStudyDesignerConstants.ERR_MSG)) { errMsg = (String) request.getSession().getAttribute(FdahpStudyDesignerConstants.ERR_MSG); map.addAttribute(FdahpStudyDesignerConstants.ERR_MSG, errMsg); request.getSession().removeAttribute(FdahpStudyDesignerConstants.ERR_MSG); } ownUser = (String) request.getSession().getAttribute("ownUser"); userList = usersService.getUserList(); roleList = usersService.getUserRoleList(); map.addAttribute("roleList", roleList); map.addAttribute("userList", userList); map.addAttribute("ownUser", ownUser); mav = new ModelAndView("userListPage", map); } } catch (Exception e) { logger.error("UsersController - getUserList() - ERROR", e); } logger.info("UsersController - getUserList() - Ends"); return mav; } @RequestMapping("/adminUsersEdit/resendActivateDetailsLink.do") public ModelAndView resendActivateDetailsLink(HttpServletRequest request) { logger.info("UsersController - resendActivateDetailsLink() - Starts"); ModelAndView mav = new ModelAndView(); String msg = ""; UserBO userBo = null; Map<String, String> propMap = FdahpStudyDesignerUtil.getAppProperties(); AuditLogEventRequest auditRequest = AuditEventMapper.fromHttpServletRequest(request); try { HttpSession session = request.getSession(); SessionObject userSession = (SessionObject) session.getAttribute(FdahpStudyDesignerConstants.SESSION_OBJECT); if (null != userSession) { String userId = FdahpStudyDesignerUtil.isEmpty(request.getParameter("userId")) ? "" : request.getParameter("userId"); if (StringUtils.isNotEmpty(userId)) { userBo = usersService.getUserDetails(Integer.parseInt(userId)); if (userBo != null) { msg = loginService.sendPasswordResetLinkToMail( request, userBo.getUserEmail(), "", "USER", auditRequest); } if (msg.equalsIgnoreCase(FdahpStudyDesignerConstants.SUCCESS)) { request .getSession() .setAttribute( FdahpStudyDesignerConstants.SUC_MSG, propMap.get("resent.link.success.message")); Map<String, String> values = new HashMap<>(); values.put(StudyBuilderConstants.USER_ID, String.valueOf(userId)); auditLogEventHelper.logEvent(NEW_USER_INVITATION_RESENT, auditRequest, values); } else { request.getSession().setAttribute(FdahpStudyDesignerConstants.ERR_MSG, msg); auditLogEventHelper.logEvent(PASSWORD_HELP_EMAIL_FAILED, auditRequest); } } mav = new ModelAndView("redirect:/adminUsersView/getUserList.do"); } } catch (Exception e) { logger.error("UsersController - resendActivateDetailsLink() - ERROR", e); } logger.info("UsersController - resendActivateDetailsLink() - Ends"); return mav; } @RequestMapping("/adminUsersView/viewUserDetails.do") public ModelAndView viewUserDetails(HttpServletRequest request) { logger.info("UsersController - viewUserDetails() - Starts"); ModelAndView mav = new ModelAndView(); ModelMap map = new ModelMap(); UserBO userBO = null; List<StudyListBean> studyBOs = null; List<RoleBO> roleBOList = null; List<StudyBo> studyBOList = null; String actionPage = FdahpStudyDesignerConstants.VIEW_PAGE; List<Integer> permissions = null; Map<String, String> values = new HashMap<>(); try { AuditLogEventRequest auditRequest = AuditEventMapper.fromHttpServletRequest(request); if (FdahpStudyDesignerUtil.isSession(request)) { String userId = FdahpStudyDesignerUtil.isEmpty(request.getParameter("userId")) ? "" : request.getParameter("userId"); String checkViewRefreshFlag = FdahpStudyDesignerUtil.isEmpty(request.getParameter("checkViewRefreshFlag")) ? "" : request.getParameter("checkViewRefreshFlag"); if (!"".equalsIgnoreCase(checkViewRefreshFlag)) { if (!"".equals(userId)) { userBO = usersService.getUserDetails(Integer.valueOf(userId)); if (null != userBO) { studyBOs = studyService.getStudyListByUserId(userBO.getUserId()); permissions = usersService.getPermissionsByUserId(userBO.getUserId()); HttpSession session = request.getSession(); SessionObject sesObj = (SessionObject) session.getAttribute(FdahpStudyDesignerConstants.SESSION_OBJECT); if (sesObj.getUserId().equals(userBO.getUserId())) { auditLogEventHelper.logEvent(ACCOUNT_DETAILS_VIEWED, auditRequest); } else { values.put("viewed_user_id", userId); auditLogEventHelper.logEvent(USER_RECORD_VIEWED, auditRequest, values); } } } roleBOList = usersService.getUserRoleList(); studyBOList = studyService.getAllStudyList(); map.addAttribute("actionPage", actionPage); map.addAttribute("userBO", userBO); map.addAttribute("permissions", permissions); map.addAttribute("roleBOList", roleBOList); map.addAttribute("studyBOList", studyBOList); map.addAttribute("studyBOs", studyBOs); mav = new ModelAndView("addOrEditUserPage", map); } else { mav = new ModelAndView("redirect:getUserList.do"); } } } catch (Exception e) { logger.error("UsersController - viewUserDetails() - ERROR", e); } logger.info("UsersController - viewUserDetails() - Ends"); return mav; } }
3e051ef9eb7f464379f1da758d3b6ca3c6ac8d1f
477
java
Java
back-end/src/main/java/com/portfolio/backend/account/dto/PasswordUpdateRequest.java
vividswan/Portfolio-For-Developers
0edbb77e4feffabb9bf7d676c02df9fafa35d50d
[ "MIT" ]
1
2021-08-29T19:08:53.000Z
2021-08-29T19:08:53.000Z
back-end/src/main/java/com/portfolio/backend/account/dto/PasswordUpdateRequest.java
vividswan/Portfolio-For-Developers
0edbb77e4feffabb9bf7d676c02df9fafa35d50d
[ "MIT" ]
null
null
null
back-end/src/main/java/com/portfolio/backend/account/dto/PasswordUpdateRequest.java
vividswan/Portfolio-For-Developers
0edbb77e4feffabb9bf7d676c02df9fafa35d50d
[ "MIT" ]
2
2021-07-19T14:09:16.000Z
2021-10-04T10:15:56.000Z
19.875
50
0.775681
2,148
package com.portfolio.backend.account.dto; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import org.hibernate.validator.constraints.Length; import javax.validation.constraints.NotBlank; @Getter @NoArgsConstructor @AllArgsConstructor public class PasswordUpdateRequest { @NotBlank @Length(min=8, max = 50) private String beforePassword; @NotBlank @Length(min=8, max = 50) private String updatePassword; }
3e051f0ea4ddbf7f0d7bd156c7f01a305704786d
24,763
java
Java
ezelastic-thrift/src/main/java/ezbake/data/elastic/thrift/FieldsNotFound.java
ezbake/ezelastic
392e3e9d606fb6b719b6a43b2841d0c36c5b7a7a
[ "Apache-2.0" ]
1
2016-02-20T14:12:20.000Z
2016-02-20T14:12:20.000Z
ezelastic-thrift/src/main/java/ezbake/data/elastic/thrift/FieldsNotFound.java
ezbake/ezelastic
392e3e9d606fb6b719b6a43b2841d0c36c5b7a7a
[ "Apache-2.0" ]
null
null
null
ezelastic-thrift/src/main/java/ezbake/data/elastic/thrift/FieldsNotFound.java
ezbake/ezelastic
392e3e9d606fb6b719b6a43b2841d0c36c5b7a7a
[ "Apache-2.0" ]
null
null
null
30.30967
184
0.648992
2,149
/* Copyright (C) 2013-2014 Computer Sciences Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Autogenerated by Thrift Compiler (0.9.1) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated */ package ezbake.data.elastic.thrift; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; import org.apache.thrift.scheme.TupleScheme; import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.protocol.TProtocolException; import org.apache.thrift.EncodingUtils; import org.apache.thrift.TException; import org.apache.thrift.async.AsyncMethodCallback; import org.apache.thrift.server.AbstractNonblockingServer.*; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.EnumMap; import java.util.Set; import java.util.HashSet; import java.util.EnumSet; import java.util.Collections; import java.util.BitSet; import java.nio.ByteBuffer; import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Exception thrown when requested field(s) could not be found in the document */ public class FieldsNotFound extends TException implements org.apache.thrift.TBase<FieldsNotFound, FieldsNotFound._Fields>, java.io.Serializable, Cloneable, Comparable<FieldsNotFound> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("FieldsNotFound"); private static final org.apache.thrift.protocol.TField _ID_FIELD_DESC = new org.apache.thrift.protocol.TField("_id", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField _TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("_type", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField FIELDS_FIELD_DESC = new org.apache.thrift.protocol.TField("fields", org.apache.thrift.protocol.TType.LIST, (short)3); private static final org.apache.thrift.protocol.TField MESSAGE_FIELD_DESC = new org.apache.thrift.protocol.TField("message", org.apache.thrift.protocol.TType.STRING, (short)4); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { schemes.put(StandardScheme.class, new FieldsNotFoundStandardSchemeFactory()); schemes.put(TupleScheme.class, new FieldsNotFoundTupleSchemeFactory()); } /** * Elastic ID for document for which field(s) were missing */ public String _id; // required /** * Elastic type field for document for which field(s) were missing */ public String _type; // required /** * The field(s)s that were missing */ public List<String> fields; // required /** * Message giving context to why and where error occurred */ public String message; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { /** * Elastic ID for document for which field(s) were missing */ _ID((short)1, "_id"), /** * Elastic type field for document for which field(s) were missing */ _TYPE((short)2, "_type"), /** * The field(s)s that were missing */ FIELDS((short)3, "fields"), /** * Message giving context to why and where error occurred */ MESSAGE((short)4, "message"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); static { for (_Fields field : EnumSet.allOf(_Fields.class)) { byName.put(field.getFieldName(), field); } } /** * Find the _Fields constant that matches fieldId, or null if its not found. */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // _ID return _ID; case 2: // _TYPE return _TYPE; case 3: // FIELDS return FIELDS; case 4: // MESSAGE return MESSAGE; default: return null; } } /** * Find the _Fields constant that matches fieldId, throwing an exception * if it is not found. */ public static _Fields findByThriftIdOrThrow(int fieldId) { _Fields fields = findByThriftId(fieldId); if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); return fields; } /** * Find the _Fields constant that matches name, or null if its not found. */ public static _Fields findByName(String name) { return byName.get(name); } private final short _thriftId; private final String _fieldName; _Fields(short thriftId, String fieldName) { _thriftId = thriftId; _fieldName = fieldName; } public short getThriftFieldId() { return _thriftId; } public String getFieldName() { return _fieldName; } } // isset id assignments private _Fields optionals[] = {_Fields.MESSAGE}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields._ID, new org.apache.thrift.meta_data.FieldMetaData("_id", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields._TYPE, new org.apache.thrift.meta_data.FieldMetaData("_type", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.FIELDS, new org.apache.thrift.meta_data.FieldMetaData("fields", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); tmpMap.put(_Fields.MESSAGE, new org.apache.thrift.meta_data.FieldMetaData("message", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(FieldsNotFound.class, metaDataMap); } public FieldsNotFound() { } public FieldsNotFound( String _id, String _type, List<String> fields) { this(); this._id = _id; this._type = _type; this.fields = fields; } /** * Performs a deep copy on <i>other</i>. */ public FieldsNotFound(FieldsNotFound other) { if (other.isSet_id()) { this._id = other._id; } if (other.isSet_type()) { this._type = other._type; } if (other.isSetFields()) { List<String> __this__fields = new ArrayList<String>(other.fields); this.fields = __this__fields; } if (other.isSetMessage()) { this.message = other.message; } } public FieldsNotFound deepCopy() { return new FieldsNotFound(this); } @Override public void clear() { this._id = null; this._type = null; this.fields = null; this.message = null; } /** * Elastic ID for document for which field(s) were missing */ public String get_id() { return this._id; } /** * Elastic ID for document for which field(s) were missing */ public FieldsNotFound set_id(String _id) { this._id = _id; return this; } public void unset_id() { this._id = null; } /** Returns true if field _id is set (has been assigned a value) and false otherwise */ public boolean isSet_id() { return this._id != null; } public void set_idIsSet(boolean value) { if (!value) { this._id = null; } } /** * Elastic type field for document for which field(s) were missing */ public String get_type() { return this._type; } /** * Elastic type field for document for which field(s) were missing */ public FieldsNotFound set_type(String _type) { this._type = _type; return this; } public void unset_type() { this._type = null; } /** Returns true if field _type is set (has been assigned a value) and false otherwise */ public boolean isSet_type() { return this._type != null; } public void set_typeIsSet(boolean value) { if (!value) { this._type = null; } } public int getFieldsSize() { return (this.fields == null) ? 0 : this.fields.size(); } public java.util.Iterator<String> getFieldsIterator() { return (this.fields == null) ? null : this.fields.iterator(); } public void addToFields(String elem) { if (this.fields == null) { this.fields = new ArrayList<String>(); } this.fields.add(elem); } /** * The field(s)s that were missing */ public List<String> getFields() { return this.fields; } /** * The field(s)s that were missing */ public FieldsNotFound setFields(List<String> fields) { this.fields = fields; return this; } public void unsetFields() { this.fields = null; } /** Returns true if field fields is set (has been assigned a value) and false otherwise */ public boolean isSetFields() { return this.fields != null; } public void setFieldsIsSet(boolean value) { if (!value) { this.fields = null; } } /** * Message giving context to why and where error occurred */ public String getMessage() { return this.message; } /** * Message giving context to why and where error occurred */ public FieldsNotFound setMessage(String message) { this.message = message; return this; } public void unsetMessage() { this.message = null; } /** Returns true if field message is set (has been assigned a value) and false otherwise */ public boolean isSetMessage() { return this.message != null; } public void setMessageIsSet(boolean value) { if (!value) { this.message = null; } } public void setFieldValue(_Fields field, Object value) { switch (field) { case _ID: if (value == null) { unset_id(); } else { set_id((String)value); } break; case _TYPE: if (value == null) { unset_type(); } else { set_type((String)value); } break; case FIELDS: if (value == null) { unsetFields(); } else { setFields((List<String>)value); } break; case MESSAGE: if (value == null) { unsetMessage(); } else { setMessage((String)value); } break; } } public Object getFieldValue(_Fields field) { switch (field) { case _ID: return get_id(); case _TYPE: return get_type(); case FIELDS: return getFields(); case MESSAGE: return getMessage(); } throw new IllegalStateException(); } /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case _ID: return isSet_id(); case _TYPE: return isSet_type(); case FIELDS: return isSetFields(); case MESSAGE: return isSetMessage(); } throw new IllegalStateException(); } @Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof FieldsNotFound) return this.equals((FieldsNotFound)that); return false; } public boolean equals(FieldsNotFound that) { if (that == null) return false; boolean this_present__id = true && this.isSet_id(); boolean that_present__id = true && that.isSet_id(); if (this_present__id || that_present__id) { if (!(this_present__id && that_present__id)) return false; if (!this._id.equals(that._id)) return false; } boolean this_present__type = true && this.isSet_type(); boolean that_present__type = true && that.isSet_type(); if (this_present__type || that_present__type) { if (!(this_present__type && that_present__type)) return false; if (!this._type.equals(that._type)) return false; } boolean this_present_fields = true && this.isSetFields(); boolean that_present_fields = true && that.isSetFields(); if (this_present_fields || that_present_fields) { if (!(this_present_fields && that_present_fields)) return false; if (!this.fields.equals(that.fields)) return false; } boolean this_present_message = true && this.isSetMessage(); boolean that_present_message = true && that.isSetMessage(); if (this_present_message || that_present_message) { if (!(this_present_message && that_present_message)) return false; if (!this.message.equals(that.message)) return false; } return true; } @Override public int hashCode() { HashCodeBuilder builder = new HashCodeBuilder(); boolean present__id = true && (isSet_id()); builder.append(present__id); if (present__id) builder.append(_id); boolean present__type = true && (isSet_type()); builder.append(present__type); if (present__type) builder.append(_type); boolean present_fields = true && (isSetFields()); builder.append(present_fields); if (present_fields) builder.append(fields); boolean present_message = true && (isSetMessage()); builder.append(present_message); if (present_message) builder.append(message); return builder.toHashCode(); } @Override public int compareTo(FieldsNotFound other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; lastComparison = Boolean.valueOf(isSet_id()).compareTo(other.isSet_id()); if (lastComparison != 0) { return lastComparison; } if (isSet_id()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._id, other._id); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSet_type()).compareTo(other.isSet_type()); if (lastComparison != 0) { return lastComparison; } if (isSet_type()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this._type, other._type); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetFields()).compareTo(other.isSetFields()); if (lastComparison != 0) { return lastComparison; } if (isSetFields()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.fields, other.fields); if (lastComparison != 0) { return lastComparison; } } lastComparison = Boolean.valueOf(isSetMessage()).compareTo(other.isSetMessage()); if (lastComparison != 0) { return lastComparison; } if (isSetMessage()) { lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.message, other.message); if (lastComparison != 0) { return lastComparison; } } return 0; } public _Fields fieldForId(int fieldId) { return _Fields.findByThriftId(fieldId); } public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { schemes.get(iprot.getScheme()).getScheme().read(iprot, this); } public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { schemes.get(oprot.getScheme()).getScheme().write(oprot, this); } @Override public String toString() { StringBuilder sb = new StringBuilder("FieldsNotFound("); boolean first = true; sb.append("_id:"); if (this._id == null) { sb.append("null"); } else { sb.append(this._id); } first = false; if (!first) sb.append(", "); sb.append("_type:"); if (this._type == null) { sb.append("null"); } else { sb.append(this._type); } first = false; if (!first) sb.append(", "); sb.append("fields:"); if (this.fields == null) { sb.append("null"); } else { sb.append(this.fields); } first = false; if (isSetMessage()) { if (!first) sb.append(", "); sb.append("message:"); if (this.message == null) { sb.append("null"); } else { sb.append(this.message); } first = false; } sb.append(")"); return sb.toString(); } public void validate() throws org.apache.thrift.TException { // check for required fields if (_id == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field '_id' was not present! Struct: " + toString()); } if (_type == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field '_type' was not present! Struct: " + toString()); } if (fields == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'fields' was not present! Struct: " + toString()); } // check for sub-struct validity } private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { try { write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } private static class FieldsNotFoundStandardSchemeFactory implements SchemeFactory { public FieldsNotFoundStandardScheme getScheme() { return new FieldsNotFoundStandardScheme(); } } private static class FieldsNotFoundStandardScheme extends StandardScheme<FieldsNotFound> { public void read(org.apache.thrift.protocol.TProtocol iprot, FieldsNotFound struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) { schemeField = iprot.readFieldBegin(); if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { break; } switch (schemeField.id) { case 1: // _ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct._id = iprot.readString(); struct.set_idIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 2: // _TYPE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct._type = iprot.readString(); struct.set_typeIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 3: // FIELDS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list120 = iprot.readListBegin(); struct.fields = new ArrayList<String>(_list120.size); for (int _i121 = 0; _i121 < _list120.size; ++_i121) { String _elem122; _elem122 = iprot.readString(); struct.fields.add(_elem122); } iprot.readListEnd(); } struct.setFieldsIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; case 4: // MESSAGE if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.message = iprot.readString(); struct.setMessageIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } iprot.readFieldEnd(); } iprot.readStructEnd(); // check for required fields of primitive type, which can't be checked in the validate method struct.validate(); } public void write(org.apache.thrift.protocol.TProtocol oprot, FieldsNotFound struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); if (struct._id != null) { oprot.writeFieldBegin(_ID_FIELD_DESC); oprot.writeString(struct._id); oprot.writeFieldEnd(); } if (struct._type != null) { oprot.writeFieldBegin(_TYPE_FIELD_DESC); oprot.writeString(struct._type); oprot.writeFieldEnd(); } if (struct.fields != null) { oprot.writeFieldBegin(FIELDS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.fields.size())); for (String _iter123 : struct.fields) { oprot.writeString(_iter123); } oprot.writeListEnd(); } oprot.writeFieldEnd(); } if (struct.message != null) { if (struct.isSetMessage()) { oprot.writeFieldBegin(MESSAGE_FIELD_DESC); oprot.writeString(struct.message); oprot.writeFieldEnd(); } } oprot.writeFieldStop(); oprot.writeStructEnd(); } } private static class FieldsNotFoundTupleSchemeFactory implements SchemeFactory { public FieldsNotFoundTupleScheme getScheme() { return new FieldsNotFoundTupleScheme(); } } private static class FieldsNotFoundTupleScheme extends TupleScheme<FieldsNotFound> { @Override public void write(org.apache.thrift.protocol.TProtocol prot, FieldsNotFound struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct._id); oprot.writeString(struct._type); { oprot.writeI32(struct.fields.size()); for (String _iter124 : struct.fields) { oprot.writeString(_iter124); } } BitSet optionals = new BitSet(); if (struct.isSetMessage()) { optionals.set(0); } oprot.writeBitSet(optionals, 1); if (struct.isSetMessage()) { oprot.writeString(struct.message); } } @Override public void read(org.apache.thrift.protocol.TProtocol prot, FieldsNotFound struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; struct._id = iprot.readString(); struct.set_idIsSet(true); struct._type = iprot.readString(); struct.set_typeIsSet(true); { org.apache.thrift.protocol.TList _list125 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); struct.fields = new ArrayList<String>(_list125.size); for (int _i126 = 0; _i126 < _list125.size; ++_i126) { String _elem127; _elem127 = iprot.readString(); struct.fields.add(_elem127); } } struct.setFieldsIsSet(true); BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { struct.message = iprot.readString(); struct.setMessageIsSet(true); } } } }
3e051f0f4e98b295111e133db762f3cf965f16c9
1,107
java
Java
library/src/main/java/com/whamu2/previewimage/Preview.java
whtchl/PreviewImage-master
692f898ac59b3e76283f229787264227ab877f56
[ "Apache-2.0" ]
2
2018-10-15T01:55:57.000Z
2022-02-14T01:01:16.000Z
library/src/main/java/com/whamu2/previewimage/Preview.java
whtchl/PreviewImage-master
692f898ac59b3e76283f229787264227ab877f56
[ "Apache-2.0" ]
1
2018-10-23T07:53:03.000Z
2018-10-23T07:53:03.000Z
library/src/main/java/com/whamu2/previewimage/Preview.java
whtchl/PreviewImage-master
692f898ac59b3e76283f229787264227ab877f56
[ "Apache-2.0" ]
1
2020-11-03T01:42:29.000Z
2020-11-03T01:42:29.000Z
19.421053
59
0.619693
2,150
package com.whamu2.previewimage; import android.content.Context; import android.support.annotation.Nullable; import com.whamu2.previewimage.core.PreviewBuilder; import java.lang.ref.WeakReference; /** * image preview tools * * @author whamu2 * @date 2018/7/12 */ public class Preview { /** * get context to {@link WeakReference} */ private WeakReference<Context> mContext; /** * initial class * * @param context {@link Context} */ private Preview(Context context) { mContext = new WeakReference<>(context); } /** * {@link Preview} start position * * @param context {@link Context} * @return {@link Preview} */ public static Preview with(Context context) { return new Preview(context); } /** * create {@link PreviewBuilder} construction parameter * * @return {@link PreviewBuilder} */ public PreviewBuilder builder() { return new PreviewBuilder(getContext()); } @Nullable private Context getContext() { return mContext.get(); } }
3e051fc54e98636e6616383db7c6013d45dced66
697
java
Java
domain/src/main/java/org/shboland/domain/entities/JsonSearchResult.java
sybrenboland/springBootTestApi
fe0974bb0487eca822c8e40a47891bdf86aefc37
[ "Apache-2.0" ]
null
null
null
domain/src/main/java/org/shboland/domain/entities/JsonSearchResult.java
sybrenboland/springBootTestApi
fe0974bb0487eca822c8e40a47891bdf86aefc37
[ "Apache-2.0" ]
null
null
null
domain/src/main/java/org/shboland/domain/entities/JsonSearchResult.java
sybrenboland/springBootTestApi
fe0974bb0487eca822c8e40a47891bdf86aefc37
[ "Apache-2.0" ]
null
null
null
23.233333
60
0.79627
2,151
package org.shboland.domain.entities; import java.util.List; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.AccessLevel; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Getter; @Getter @Builder @AllArgsConstructor(access = AccessLevel.PRIVATE) @JsonInclude(value = Include.NON_NULL) public class JsonSearchResult<T> { @JsonProperty("grandTotal") private Integer grandTotalNumberOfResults; @JsonProperty("numberOfResults") private Integer numberOfResults; @JsonProperty("results") private List<T> results; }
3e0520304e9f100e7252e160108423ed116be63a
1,086
java
Java
Java/Algorithms/Pattern Programs/PyramidPattern.java
Anil1228-AAA/hacktoberfest2021-2
d59c3c86d3e2e391720cba8c18badffd2a57b9a4
[ "MIT" ]
null
null
null
Java/Algorithms/Pattern Programs/PyramidPattern.java
Anil1228-AAA/hacktoberfest2021-2
d59c3c86d3e2e391720cba8c18badffd2a57b9a4
[ "MIT" ]
null
null
null
Java/Algorithms/Pattern Programs/PyramidPattern.java
Anil1228-AAA/hacktoberfest2021-2
d59c3c86d3e2e391720cba8c18badffd2a57b9a4
[ "MIT" ]
null
null
null
29.351351
109
0.391344
2,152
import java.util.Scanner; class PyramidPattern { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Enter heigth of pyramid. "); int rows = sc.nextInt(); int count = 1; for(int i = rows; i >= 1; i--) { // loop for rows for(int j = i; j >= 1; j--) { // loop for gap System.out.print(" "); } for(int j = 1; j <= count; j++) { // loop for print numbers if(j > count/2) { for(int k = j; k >= 1; k--) { //loop for print decreasing number after middle of pyramid System.out.print(k+" "); } break; // break after reached number 1 at last } else { System.out.print(j+" "); } } count += 2; System.out.println(); // used for new line } } }
3e0521b273d6d9c08bd4d29c0e2519542911ed3a
595
java
Java
app/merlin/src/main/java/io/stacknix/merlin/db/android/Logging.java
stacknix/merlin
f52f422f7c8a8df423ae3c2134c7fecef23024b6
[ "Apache-2.0" ]
null
null
null
app/merlin/src/main/java/io/stacknix/merlin/db/android/Logging.java
stacknix/merlin
f52f422f7c8a8df423ae3c2134c7fecef23024b6
[ "Apache-2.0" ]
null
null
null
app/merlin/src/main/java/io/stacknix/merlin/db/android/Logging.java
stacknix/merlin
f52f422f7c8a8df423ae3c2134c7fecef23024b6
[ "Apache-2.0" ]
null
null
null
22.884615
57
0.620168
2,153
package io.stacknix.merlin.db.android; import android.util.Log; import com.google.common.base.Joiner; public class Logging { public static void e(String tag, Object... messages){ Log.e(tag, Joiner.on(" ").join(messages)); } public static void w(String tag, Object... messages){ Log.w(tag, Joiner.on(" ").join(messages)); } public static void d(String tag, Object... messages){ Log.d(tag, Joiner.on(" ").join(messages)); } public static void i(String tag, Object... messages){ Log.i(tag, Joiner.on(" ").join(messages)); } }
3e0522345d32f48b347cc84d22167b31e70b7c74
1,135
java
Java
src/main/java/models/Account/Statistics.java
desabuh/OOP20-pogeshi
c7e2625537798e8cee002fa64ab0a77842873003
[ "MIT" ]
null
null
null
src/main/java/models/Account/Statistics.java
desabuh/OOP20-pogeshi
c7e2625537798e8cee002fa64ab0a77842873003
[ "MIT" ]
null
null
null
src/main/java/models/Account/Statistics.java
desabuh/OOP20-pogeshi
c7e2625537798e8cee002fa64ab0a77842873003
[ "MIT" ]
2
2021-03-06T09:28:22.000Z
2021-03-29T15:42:15.000Z
27.682927
130
0.602643
2,154
package models.Account; public interface Statistics { /** * Return the number of games won by the {@code Account}. * @return Value of {@code wins}. */ int getWins(); /** * Return the number of games lost by the {@code Account}. * @return Value of {@code loses}. */ int getLoses(); /** * Return the number of different cards unlocked by the {@code Account}. * @return Value of {@code different cards unlocked}. */ int getUnlockedCards(); /** * Update the number of {@code wins} and depending on a {@code boolean} update the number of {@code different cards unlocked}. * <p> * if {@code duplicate card} == {@code true}, * then {@code different cards unlocked} remain the same.<br> * if {@code duplicate card} == {@code false}, * then {@code different cards unlocked} get updated. * </p> * @param duplicateCard {@code boolean} representing if the {@code Card} is a duplicate. */ void updateOnWin(boolean duplicateCard); /** * Update the number of {@code loses}. */ void updateOnLose(); }
3e0523c967731efe0c649c7aa742ac1780372290
1,368
java
Java
problems/src/greedy/_53maxSubArray.java
ZhangQiHang-98/javaForLeetcode
fb2397e0243b4165ed91ee930fc0f0f01c72a065
[ "MIT" ]
null
null
null
problems/src/greedy/_53maxSubArray.java
ZhangQiHang-98/javaForLeetcode
fb2397e0243b4165ed91ee930fc0f0f01c72a065
[ "MIT" ]
null
null
null
problems/src/greedy/_53maxSubArray.java
ZhangQiHang-98/javaForLeetcode
fb2397e0243b4165ed91ee930fc0f0f01c72a065
[ "MIT" ]
null
null
null
26.307692
68
0.490497
2,155
package greedy; /** * @className: _53maxSubArray * @Description: 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 * @author: Zhang Qihang * @date: 2021/11/19 10:54 */ public class _53maxSubArray { // 暴力解法:两层循环 public int maxSubArray1(int[] nums) { int result = Integer.MIN_VALUE; int count = 0; for (int i = 0; i < nums.length; i++) { count = 0; for (int j = i; j < nums.length; j++) { count += nums[j]; if (result < count) { result = count; } } } return result; } // 贪心算法:如果-2,1在一起,计算序列头的时候,一定不会从-2计算,因为[-2,1]一定比[1]小 // 局部最优:如果当前连续和为负,那么下一个数不管正、负,加上当前连续和一定更小 // 如果count+nums[i]为负数了,那么就从nums[i+1]重新从零累计 public int maxSubArray(int[] nums) { int result = Integer.MIN_VALUE; int count = 0; for (int i = 0; i < nums.length; i++) { count += nums[i]; if (result < count) { result = count; } if (count <= 0) { count = 0; } } return result; } public static void main(String[] args) { _53maxSubArray test = new _53maxSubArray(); int[] nums = {-2, 1, -3, 4, -1, 2, 1, -5, 4}; System.out.println(test.maxSubArray1(nums)); } }
3e0523f3dcc0c0b31128292fe49daf671cbc8b7a
655
java
Java
src/main/java/com/github/iunius118/tolaserblade/client/model/LaserBladeModelHolder.java
Iunius118/ToLaserBlade
b018b3e60d8c242cfb65dc7b4aff7a38bb387393
[ "MIT" ]
3
2020-12-12T12:56:51.000Z
2021-07-22T11:37:25.000Z
src/main/java/com/github/iunius118/tolaserblade/client/model/LaserBladeModelHolder.java
Iunius118/ToLaserBlade
b018b3e60d8c242cfb65dc7b4aff7a38bb387393
[ "MIT" ]
11
2017-07-24T18:03:34.000Z
2022-01-27T09:43:43.000Z
src/main/java/com/github/iunius118/tolaserblade/client/model/LaserBladeModelHolder.java
Iunius118/ToLaserBlade
b018b3e60d8c242cfb65dc7b4aff7a38bb387393
[ "MIT" ]
null
null
null
28.478261
98
0.729771
2,156
package com.github.iunius118.tolaserblade.client.model; import com.github.iunius118.tolaserblade.api.client.model.LaserBladeModel; import net.minecraft.resources.ResourceLocation; public class LaserBladeModelHolder { private static LaserBladeModel model = null; private static ResourceLocation texture = new ResourceLocation("forge", "textures/white.png"); public static LaserBladeModel getModel() { return model; } public static void setModel(LaserBladeModel modelIn) { model = modelIn; texture = model.getTexture(); } public static ResourceLocation getTexture() { return texture; } }
3e0523f5440d569685f16f85ef0faadaad649eda
3,320
java
Java
saksbehandling/behandlingssteg/src/test/java/no/nav/foreldrepenger/behandling/steg/gjenopptagelse/AutomatiskGjenopptagelseBatchTjenesteTest.java
navikt/spsak
ede4770de33bd896d62225a9617b713878d1efa5
[ "MIT" ]
1
2019-11-15T10:37:38.000Z
2019-11-15T10:37:38.000Z
saksbehandling/behandlingssteg/src/test/java/no/nav/foreldrepenger/behandling/steg/gjenopptagelse/AutomatiskGjenopptagelseBatchTjenesteTest.java
navikt/spsak
ede4770de33bd896d62225a9617b713878d1efa5
[ "MIT" ]
null
null
null
saksbehandling/behandlingssteg/src/test/java/no/nav/foreldrepenger/behandling/steg/gjenopptagelse/AutomatiskGjenopptagelseBatchTjenesteTest.java
navikt/spsak
ede4770de33bd896d62225a9617b713878d1efa5
[ "MIT" ]
1
2019-11-15T10:37:41.000Z
2019-11-15T10:37:41.000Z
37.303371
121
0.75753
2,157
package no.nav.foreldrepenger.behandling.steg.gjenopptagelse; import static java.util.Arrays.asList; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.math.BigDecimal; import java.util.Collections; import org.junit.Before; import org.junit.Test; import no.nav.foreldrepenger.batch.BatchStatus; import no.nav.foreldrepenger.behandling.steg.gjenopptagelse.batch.AutomatiskGjenopptagelseBatchTjeneste; import no.nav.foreldrepenger.behandling.steg.gjenopptagelse.tjeneste.AutomatiskGjenopptagelseTjeneste; import no.nav.vedtak.felles.prosesstask.api.ProsessTaskStatus; import no.nav.vedtak.felles.prosesstask.api.TaskStatus; public class AutomatiskGjenopptagelseBatchTjenesteTest { private AutomatiskGjenopptagelseBatchTjeneste batchTjeneste; // objektet vi tester private AutomatiskGjenopptagelseTjeneste mockTjeneste; private static final String BATCHNAME = AutomatiskGjenopptagelseBatchTjeneste.BATCHNAME; private static final String GRUPPE = "1023"; private static final String EXECUTION_ID = BATCHNAME + "-" + GRUPPE; private static final TaskStatus FERDIG_1 = new TaskStatus(ProsessTaskStatus.FERDIG, new BigDecimal(1)); private static final TaskStatus FERDIG_2 = new TaskStatus(ProsessTaskStatus.FERDIG, new BigDecimal(1)); private static final TaskStatus FEILET_1 = new TaskStatus(ProsessTaskStatus.FEILET, new BigDecimal(1)); private static final TaskStatus KLAR_1 = new TaskStatus(ProsessTaskStatus.KLAR, new BigDecimal(1)); @Before public void setup() { mockTjeneste = mock(AutomatiskGjenopptagelseTjeneste.class); batchTjeneste = new AutomatiskGjenopptagelseBatchTjeneste(mockTjeneste); } @Test public void skal_gi_status_ok_når_alle_tasks_ferdig_uten_feil() { // Arrange when(mockTjeneste.hentStatusForGjenopptaBehandlingGruppe(GRUPPE)).thenReturn(asList(FERDIG_1, FERDIG_2)); // Act BatchStatus batchStatus = batchTjeneste.status(EXECUTION_ID); // Assert assertThat(batchStatus).isEqualTo(BatchStatus.OK); } @Test public void skal_gi_status_ok_når_ingen_tasks_funnet() { // Arrange when(mockTjeneste.hentStatusForGjenopptaBehandlingGruppe(GRUPPE)).thenReturn(Collections.emptyList()); // Act BatchStatus batchStatus = batchTjeneste.status(EXECUTION_ID); // Assert assertThat(batchStatus).isEqualTo(BatchStatus.OK); } @Test public void skal_gi_status_warning_når_minst_en_task_feilet() { // Arrange when(mockTjeneste.hentStatusForGjenopptaBehandlingGruppe(GRUPPE)).thenReturn(asList(FERDIG_1, FEILET_1)); // Act BatchStatus batchStatus = batchTjeneste.status(EXECUTION_ID); // Assert assertThat(batchStatus).isEqualTo(BatchStatus.WARNING); } @Test public void skal_gi_status_running_når_minst_en_task_ikke_er_startet() { // Arrange when(mockTjeneste.hentStatusForGjenopptaBehandlingGruppe(GRUPPE)).thenReturn(asList(FERDIG_1, FEILET_1, KLAR_1)); // Act BatchStatus batchStatus = batchTjeneste.status(EXECUTION_ID); // Assert assertThat(batchStatus).isEqualTo(BatchStatus.RUNNING); } }
3e05257bf4e0db2d62e9c1c0acee6878b15c0e69
383
java
Java
src/mediator/Lodger.java
javajavadog/javaDesignPattern
14a74f5a8b7d0b442b5658308deeb47281ea7861
[ "Unlicense" ]
null
null
null
src/mediator/Lodger.java
javajavadog/javaDesignPattern
14a74f5a8b7d0b442b5658308deeb47281ea7861
[ "Unlicense" ]
null
null
null
src/mediator/Lodger.java
javajavadog/javaDesignPattern
14a74f5a8b7d0b442b5658308deeb47281ea7861
[ "Unlicense" ]
null
null
null
19.15
57
0.600522
2,158
package mediator; public class Lodger { public String mName; public int mAimPrice; private Mediator mMediator; public Lodger(String name, Mediator m, int aimPrice){ mName = name; mMediator = m; mAimPrice = aimPrice; mMediator.addLodger(this); } public void getHouse(){ mMediator.getHouse(this); } }
3e052587b8cfc5961c5abef432bdd9e7f94fb099
1,702
java
Java
core/src/main/java/edu/zju/gis/hls/trajectory/datastore/storage/reader/pg/PgLayerReaderConfig.java
heyPIAO/gis-spark
6d46a6dcc57f1d2e385cfb72211ecfa97fd944fd
[ "Apache-2.0" ]
4
2020-07-27T10:18:53.000Z
2021-07-16T09:25:14.000Z
core/src/main/java/edu/zju/gis/hls/trajectory/datastore/storage/reader/pg/PgLayerReaderConfig.java
heyPIAO/trajectory-spark
6d46a6dcc57f1d2e385cfb72211ecfa97fd944fd
[ "Apache-2.0" ]
4
2020-07-17T07:39:33.000Z
2022-02-16T01:10:52.000Z
core/src/main/java/edu/zju/gis/hls/trajectory/datastore/storage/reader/pg/PgLayerReaderConfig.java
heyPIAO/trajectory-spark
6d46a6dcc57f1d2e385cfb72211ecfa97fd944fd
[ "Apache-2.0" ]
3
2020-10-13T05:58:31.000Z
2020-11-18T08:56:44.000Z
27.015873
97
0.683314
2,159
package edu.zju.gis.hls.trajectory.datastore.storage.reader.pg; import edu.zju.gis.hls.trajectory.analysis.rddLayer.LayerType; import edu.zju.gis.hls.trajectory.datastore.storage.reader.LayerReaderConfig; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; /** * @author Hu * @date 2020/7/1 * sourcePath === url "jdbc:postgresql:dbserver" **/ @Getter @Setter @ToString @NoArgsConstructor public class PgLayerReaderConfig extends LayerReaderConfig { private String schema; private String dbtable; private String username; private String password; private String filter = "1=1"; // 过滤条件 @Override public boolean check() { return super.check() &&(schema !=null && schema.trim().length() > 0) && (dbtable !=null && dbtable.trim().length() > 0) && (username != null && username.trim().length() > 0) && (password != null && password.trim().length() > 0); } public PgLayerReaderConfig(String layerName, String sourcePath, LayerType layerType) { super(layerName, sourcePath, layerType); } // TODO 改成用正则取出来 public String getUrl() { return this.sourcePath.split(":")[2].replace("//", ""); } // TODO 改成用正则取出来 public int getPort() { return Integer.valueOf(this.sourcePath.split(":")[3].split("/")[0]); } // TODO 改成用正则取出来 public String getDatabase() { return this.sourcePath.split(":")[3].split("/")[1]; } public String getFilterSql(String tablename) { return String.format("select * from %s where %s", tablename, this.filter); } public String getFilterSql() { return String.format("select * from %s.%s where %s", this.schema, this.dbtable, this.filter); } }
3e0526d6318a5a47fb7654fa5fe936c8ad51547f
891
java
Java
testcode/src/main/java/com/picard/protocol/packet/SendGroupMessageNotifyPacket.java
bloodycoder/netty-im-framework
bd58fd3142eabafb0dcd70c5e4ad4cb3c39e5757
[ "MIT" ]
null
null
null
testcode/src/main/java/com/picard/protocol/packet/SendGroupMessageNotifyPacket.java
bloodycoder/netty-im-framework
bd58fd3142eabafb0dcd70c5e4ad4cb3c39e5757
[ "MIT" ]
null
null
null
testcode/src/main/java/com/picard/protocol/packet/SendGroupMessageNotifyPacket.java
bloodycoder/netty-im-framework
bd58fd3142eabafb0dcd70c5e4ad4cb3c39e5757
[ "MIT" ]
null
null
null
19.369565
68
0.668911
2,160
package com.picard.protocol.packet; import com.picard.protocol.Packet; import lombok.Data; import static com.picard.protocol.Command.SEND_GROUP_MESSAGE_NOTIFY; @Data public class SendGroupMessageNotifyPacket extends Packet { private String groupId; private String userId; private String message; public SendGroupMessageNotifyPacket(){} @Override public Byte getCommand() { return SEND_GROUP_MESSAGE_NOTIFY; } public String getGroupId() { return groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } }
3e052847f6b99c12d8580992d876a3d99b9d201f
478
java
Java
EgyDriverCode/EgyDriver/src/ClientModel.java
AhmedHatem001/EgyDriver
ceb1b01007e22de3f2fc45b7410cd0b3943b462e
[ "MIT" ]
null
null
null
EgyDriverCode/EgyDriver/src/ClientModel.java
AhmedHatem001/EgyDriver
ceb1b01007e22de3f2fc45b7410cd0b3943b462e
[ "MIT" ]
null
null
null
EgyDriverCode/EgyDriver/src/ClientModel.java
AhmedHatem001/EgyDriver
ceb1b01007e22de3f2fc45b7410cd0b3943b462e
[ "MIT" ]
null
null
null
26.555556
99
0.784519
2,161
import java.util.*; public class ClientModel { private static ArrayList<ClientController> registeredClients = new ArrayList<ClientController>(); static void addRegisteredClients(ClientController clientController) { registeredClients.add(clientController); } static ArrayList<ClientController> getRegisteredClientsList() { return registeredClients; } static ClientController getRegisteredClient(int index) { return registeredClients.get(index); } }
3e0528d6ff98179a21ee1991215809d7fceac6db
498
java
Java
LP1/src/Lista7/Exercicio3.java
nathalyoliveira/LP1-IFSP
b560efefaf8552b2dcd4709c5c0db9831920e8b1
[ "MIT" ]
1
2021-05-31T17:17:25.000Z
2021-05-31T17:17:25.000Z
LP1/src/Lista7/Exercicio3.java
nathalyoliveira/LP1-IFSP
b560efefaf8552b2dcd4709c5c0db9831920e8b1
[ "MIT" ]
null
null
null
LP1/src/Lista7/Exercicio3.java
nathalyoliveira/LP1-IFSP
b560efefaf8552b2dcd4709c5c0db9831920e8b1
[ "MIT" ]
null
null
null
18.444444
55
0.604418
2,162
package Lista7; import java.util.ArrayList; import java.util.Random; public class Exercicio3 { public static void main(String[] args) { Random gerador = new Random(); ArrayList<Integer> valor = new ArrayList<Integer>(); for(int i = 1; i<=10;++i) { valor.add(gerador.nextInt(100)); } System.out.println(valor); Integer maior = 0; for(Integer v : valor) { if(v > maior) { maior = v; }} System.out.println("Maior valor: " + maior); } }
3e0528dedf44149a312d85fe6b872dcff325d68a
4,112
java
Java
src/main/java/net/mlm21/main/copper_golem/CopperGolemModel.java
Reimnop/Monument-To-Lost-Mobs-2021
7439d81d53ac20587e67b10d2e15d6c68c55a5de
[ "MIT" ]
1
2021-10-31T12:00:15.000Z
2021-10-31T12:00:15.000Z
src/main/java/net/mlm21/main/copper_golem/CopperGolemModel.java
Reimnop/Monument-To-Lost-Mobs-2021
7439d81d53ac20587e67b10d2e15d6c68c55a5de
[ "MIT" ]
null
null
null
src/main/java/net/mlm21/main/copper_golem/CopperGolemModel.java
Reimnop/Monument-To-Lost-Mobs-2021
7439d81d53ac20587e67b10d2e15d6c68c55a5de
[ "MIT" ]
null
null
null
48.376471
333
0.628405
2,163
package net.mlm21.main.copper_golem; import net.minecraft.client.model.*; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.util.math.MathHelper; public class CopperGolemModel extends EntityModel<CopperGolem> { private final ModelPart body; private final ModelPart head; private final ModelPart right_leg; private final ModelPart left_leg; private final ModelPart right_arm; private final ModelPart left_arm; public CopperGolemModel(ModelPart root) { body = root.getChild("body"); head = root.getChild("head"); right_leg = root.getChild("right_leg"); left_leg = root.getChild("left_leg"); right_arm = root.getChild("right_arm"); left_arm = root.getChild("left_arm"); } @Override public void setAngles(CopperGolem entity, float f, float g, float h, float i, float j) { boolean bl = entity.getRoll() > 4; head.yaw = i * 0.017453292F; if (bl) { head.pitch = -0.7853982F; } else { head.pitch = j * 0.017453292F; } body.yaw = 0.0F; float k = 1.0F; if (bl) { k = (float)entity.getVelocity().lengthSquared(); k /= 0.2F; k *= k * k; } if (k < 1.0F) { k = 1.0F; } right_arm.pitch = MathHelper.cos(f * 0.85f + 3.1415927F) * 2.0F * g * 0.5F / k; left_arm.pitch = MathHelper.cos(f * 0.85f) * 2.0F * g * 0.5F / k; right_arm.roll = 0.0F; left_arm.roll = 0.0F; right_leg.pitch = MathHelper.cos(f * 1.15f) * 1.4F * g / k; left_leg.pitch = MathHelper.cos(f * 1.15f + 3.1415927F) * 1.4F * g / k; right_leg.yaw = 0.0F; left_leg.yaw = 0.0F; right_leg.roll = 0.0F; left_leg.roll = 0.0F; } @Override public void render(MatrixStack matrices, VertexConsumer vertices, int light, int overlay, float red, float green, float blue, float alpha) { matrices.scale(0.5f, 0.5f, 0.5f); matrices.translate(0.0f, 1.5f, 0.0f); body.render(matrices, vertices, light, overlay, red, green, blue, alpha); head.render(matrices, vertices, light, overlay, red, green, blue, alpha); right_leg.render(matrices, vertices, light, overlay, red, green, blue, alpha); left_leg.render(matrices, vertices, light, overlay, red, green, blue, alpha); right_arm.render(matrices, vertices, light, overlay, red, green, blue, alpha); left_arm.render(matrices, vertices, light, overlay, red, green, blue, alpha); } public static TexturedModelData getTexturedModelData() { ModelData modelData = new ModelData(); ModelPartData modelPartData = modelData.getRoot(); modelPartData.addChild("body", ModelPartBuilder.create().uv(0,0).cuboid(-8.0F, -17.0F, -4.0F, 16.0F, 12.0F, 8.0F), ModelTransform.pivot(0.0F,19.0F,0.0F)); modelPartData.addChild("head", ModelPartBuilder.create().uv(48,0).cuboid(-8.0F, -12.0F, -6.0F, 16.0F, 12.0F, 12.0F).uv(92,0).cuboid(-3.0F, -6.0F, -8.0F, 6.0F, 8.0F, 2.0F).uv(108,0).cuboid(-2.0F, -18.0F, -2.0F, 4.0F, 6.0F, 4.0F).uv(104,10).cuboid(-3.0F, -24.0F, -3.0F, 6.0F, 6.0F, 6.0F), ModelTransform.pivot(0.0F,2.0F,0.0F)); modelPartData.addChild("right_leg", ModelPartBuilder.create().uv(0,20).cuboid(-4.0F, 0.0F, -4.0F, 8.0F, 10.0F, 8.0F, true), ModelTransform.pivot(-4.0F,14.0F,0.0F)); modelPartData.addChild("left_leg", ModelPartBuilder.create().uv(0,20).cuboid(-4.0F, 0.0F, -4.0F, 8.0F, 10.0F, 8.0F), ModelTransform.pivot(4.0F,14.0F,0.0F)); modelPartData.addChild("right_arm", ModelPartBuilder.create().uv(32,24).cuboid(-6.0F, -4.0F, -3.0F, 6.0F, 20.0F, 6.0F, true), ModelTransform.pivot(-8.0F,4.0F,0.0F)); modelPartData.addChild("left_arm", ModelPartBuilder.create().uv(32,24).cuboid(0.0F, -4.0F, -3.0F, 6.0F, 20.0F, 6.0F), ModelTransform.pivot(8.0F,4.0F,0.0F)); return TexturedModelData.of(modelData,128,128); } }
3e052938cb1446b37d84d23acc5aad1aa2627d1b
3,484
java
Java
src/main/java/seedu/address/model/AddressBook.java
liaujianjie/addressbook-level4
2bf5e02a433df9fc1afde92e2a35ab04cee51563
[ "MIT" ]
3
2018-09-17T14:51:06.000Z
2019-02-07T06:13:17.000Z
src/main/java/seedu/address/model/AddressBook.java
liaujianjie/addressbook-level4
2bf5e02a433df9fc1afde92e2a35ab04cee51563
[ "MIT" ]
295
2018-09-06T12:52:06.000Z
2018-11-16T08:57:57.000Z
src/main/java/seedu/address/model/AddressBook.java
liaujianjie/addressbook-level4
2bf5e02a433df9fc1afde92e2a35ab04cee51563
[ "MIT" ]
7
2018-09-16T12:42:33.000Z
2019-10-20T09:54:25.000Z
28.557377
116
0.657865
2,164
package seedu.address.model; import static java.util.Objects.requireNonNull; import java.util.List; import javafx.collections.ObservableList; import seedu.address.model.contact.Contact; import seedu.address.model.contact.UniqueContactList; /** * Wraps all data at the address-book level * Duplicates are not allowed (by .isSameContact comparison) */ public class AddressBook implements ReadOnlyAddressBook { private final UniqueContactList<Contact> contacts; /* * The 'unusual' code block below is an non-static initialization block, sometimes used to avoid duplication * between constructors. See https://docs.oracle.com/javase/tutorial/java/javaOO/initial.html * * Note that non-static init blocks are not recommended to use. There are other ways to avoid duplication * among constructors. */ { contacts = new UniqueContactList<>(); } public AddressBook() {} /** * Creates an AddressBook using the Contacts in the {@code toBeCopied} */ public AddressBook(ReadOnlyAddressBook toBeCopied) { this(); resetData(toBeCopied); } //// list overwrite operations /** * Replaces the contents of the contact list with {@code contacts}. * {@code contacts} must not contain duplicate contacts. */ private void setContacts(List<Contact> contacts) { this.contacts.setContacts(contacts); } /** * Resets the existing data of this {@code AddressBook} with {@code newData}. */ public void resetData(ReadOnlyAddressBook newData) { requireNonNull(newData); setContacts(newData.getContactList()); } //// contact-level operations /** * Returns true if a contact with the same identity as {@code contact} exists in the address book. */ public boolean hasContact(Contact contact) { requireNonNull(contact); return contacts.contains(contact); } /** * Adds a contact to the address book. * The contact must not already exist in the address book. */ public void addContact(Contact p) { contacts.add(p); } /** * Replaces the given contact {@code target} in the list with {@code editedContact}. * {@code target} must exist in the address book. * The contact identity of {@code editedContact} must not be the same as another existing contact in the address * book. */ public void updateContact(Contact target, Contact editedContact) { requireNonNull(editedContact); contacts.setContact(target, editedContact); } /** * Removes {@code key} from this {@code AddressBook}. * {@code key} must exist in the address book. */ public void removeContact(Contact key) { contacts.remove(key); } //// util methods @Override public String toString() { return contacts.asUnmodifiableObservableList().size() + " contacts"; // TODO: refine later } @Override public ObservableList<Contact> getContactList() { return contacts.asUnmodifiableObservableList(); } @Override public boolean equals(Object other) { return other == this // short circuit if same object || (other instanceof AddressBook // instanceof handles nulls && contacts.equals(((AddressBook) other).contacts)); } @Override public int hashCode() { return contacts.hashCode(); } }
3e052956d537fb678ddbd5e5e04caaec77516e5c
2,018
java
Java
vertigo-commons/src/main/java/io/vertigo/commons/transaction/VTransactionResourceId.java
KleeGroup/vertigo-extensions
55742bab5002941c43537a85bf1ee677a4a64365
[ "ECL-2.0", "Apache-2.0" ]
9
2017-04-19T19:48:13.000Z
2019-03-21T09:06:20.000Z
vertigo-commons/src/main/java/io/vertigo/commons/transaction/VTransactionResourceId.java
KleeGroup/vertigo-extensions
55742bab5002941c43537a85bf1ee677a4a64365
[ "ECL-2.0", "Apache-2.0" ]
8
2015-10-21T16:55:40.000Z
2019-03-21T16:15:53.000Z
vertigo-commons/src/main/java/io/vertigo/commons/transaction/VTransactionResourceId.java
KleeGroup/vertigo-extensions
55742bab5002941c43537a85bf1ee677a4a64365
[ "ECL-2.0", "Apache-2.0" ]
4
2016-01-05T16:58:29.000Z
2019-03-21T08:59:52.000Z
24
76
0.701389
2,165
/** * vertigo - application development platform * * Copyright (C) 2013-2020, Vertigo.io, [email protected] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.vertigo.commons.transaction; import io.vertigo.core.lang.Assertion; /** * Identification des ressources participant à la transaction. * * @author pchretien * @param <R> Ressource transactionnelle. */ public final class VTransactionResourceId<R extends VTransactionResource> { /** * Ordre dans lequel les ressources sont commitées. * @author pchretien */ public enum Priority { /** * Priorité maximale. * Doit être utilisée pour la ressource critique. */ TOP, /** * Priorité normale. */ NORMAL } private final Priority priority; private final String name; /** * Constructor. * @param priority Priorité de la ressource. * @param name Nom de code de la ressource. */ public VTransactionResourceId(final Priority priority, final String name) { Assertion.check() .isNotNull(priority) .isNotNull(name); //----- this.priority = priority; this.name = name; } /** * @return Priorité de la ressource. */ public Priority getPriority() { return priority; } /** {@inheritDoc} */ @Override public int hashCode() { return name.hashCode(); } /** {@inheritDoc} */ @Override public boolean equals(final Object object) { if (object instanceof VTransactionResourceId<?>) { return name.equals(((VTransactionResourceId<?>) object).name); } return false; } }
3e052a25580009c8b117ba7847d20dd5d5532b77
6,656
java
Java
src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessorTest.java
ashleyfrieze/htmlunit
a767f4865a24f5ecd7c02621c9eeef46b7cb85e3
[ "Apache-2.0" ]
581
2018-09-07T05:28:01.000Z
2022-03-27T02:19:44.000Z
src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessorTest.java
ashleyfrieze/htmlunit
a767f4865a24f5ecd7c02621c9eeef46b7cb85e3
[ "Apache-2.0" ]
441
2018-09-14T19:20:13.000Z
2022-03-31T22:35:39.000Z
src/test/java/com/gargoylesoftware/htmlunit/activex/javascript/msxml/XSLProcessorTest.java
ashleyfrieze/htmlunit
a767f4865a24f5ecd7c02621c9eeef46b7cb85e3
[ "Apache-2.0" ]
154
2018-09-07T11:27:47.000Z
2022-03-25T15:00:32.000Z
41.341615
123
0.561599
2,166
/* * Copyright (c) 2002-2022 Gargoyle Software Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * https://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.gargoylesoftware.htmlunit.activex.javascript.msxml; import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.ACTIVEX_CHECK; import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.callLoadXMLDOMDocumentFromURL; import static com.gargoylesoftware.htmlunit.activex.javascript.msxml.MSXMLTestHelper.createTestHTML; import static com.gargoylesoftware.htmlunit.junit.BrowserRunner.TestedBrowser.IE; import java.net.URL; import org.junit.Test; import org.junit.runner.RunWith; import com.gargoylesoftware.htmlunit.WebDriverTestCase; import com.gargoylesoftware.htmlunit.junit.BrowserRunner; import com.gargoylesoftware.htmlunit.junit.BrowserRunner.Alerts; import com.gargoylesoftware.htmlunit.junit.BrowserRunner.NotYetImplemented; import com.gargoylesoftware.htmlunit.util.MimeType; /** * Tests for {@link XSLProcessor}. * * @author Ahmed Ashour * @author Frank Danek * @author Ronald Brill */ @RunWith(BrowserRunner.class) public class XSLProcessorTest extends WebDriverTestCase { /** * @throws Exception if the test fails */ @Test @Alerts(DEFAULT = "no ActiveX", IE = {"undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "undefined", "unknown", "unknown"}) @NotYetImplemented(IE) public void methods() throws Exception { final String html = "<html><head><script>\n" + LOG_TITLE_FUNCTION + " function test() {\n" + ACTIVEX_CHECK // document must be free threaded + " var xslDoc = new ActiveXObject('Msxml2.FreeThreadedDOMDocument.3.0');\n" + " xslDoc.async = false;\n" + " xslDoc.load('" + URL_SECOND + "');\n" + " \n" + " var xslt = new ActiveXObject('Msxml2.XSLTemplate.3.0');\n" + " xslt.stylesheet = xslDoc;\n" + " var xslProc = xslt.createProcessor();\n" + " try {\n" + " log(typeof xslProc.importStylesheet);\n" + " log(typeof xslProc.transformToDocument);\n" + " log(typeof xslProc.transformToFragment);\n" + " log(typeof xslProc.setParameter);\n" + " log(typeof xslProc.getParameter);\n" + " log(typeof xslProc.input);\n" + " log(typeof xslProc.ouput);\n" + " log(typeof xslProc.addParameter);\n" + " log(typeof xslProc.transform);\n" + " } catch (e) {log(e)}\n" + " }\n" + LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION + "</script></head><body onload='test()'>\n" + "</body></html>"; final String xsl = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" + " <xsl:template match=\"/\">\n" + " </xsl:template>\n" + "</xsl:stylesheet>"; getMockWebConnection().setResponse(URL_SECOND, xsl, MimeType.TEXT_XML); loadPageVerifyTitle2(html); } /** * @throws Exception if the test fails */ @Test @Alerts(DEFAULT = "no ActiveX", IE = "97") public void transform() throws Exception { final URL urlThird = new URL(URL_FIRST, "third/"); final String html = "" + LOG_TITLE_FUNCTION + " function test() {\n" + ACTIVEX_CHECK + " var xmlDoc = " + callLoadXMLDOMDocumentFromURL("'" + URL_SECOND + "'") + ";\n" + " \n" // document must be free threaded + " var xslDoc = new ActiveXObject('Msxml2.FreeThreadedDOMDocument.3.0');\n" + " xslDoc.async = false;\n" + " xslDoc.load('" + urlThird + "');\n" + " \n" + " var xslt = new ActiveXObject('Msxml2.XSLTemplate.3.0');\n" + " xslt.stylesheet = xslDoc;\n" + " var xslProc = xslt.createProcessor();\n" + " xslProc.input = xmlDoc;\n" + " xslProc.transform();\n" + " var s = xslProc.output.replace(/\\r?\\n/g, '');\n" + " log(s.length);\n" + " xslProc.input = xmlDoc.documentElement;\n" + " xslProc.transform();\n" + " }\n" + LOAD_XMLDOMDOCUMENT_FROM_URL_FUNCTION; final String xml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + "<catalog>\n" + " <cd>\n" + " <title>Empire Burlesque</title>\n" + " <artist>Bob Dylan</artist>\n" + " <country>USA</country>\n" + " <company>Columbia</company>\n" + " <price>10.90</price>\n" + " <year>1985</year>\n" + " </cd>\n" + "</catalog>"; final String xsl = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n" + "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" + " <xsl:template match=\"/\">\n" + " <html>\n" + " <body>\n" + " <h2>My CD Collection</h2>\n" + " <ul>\n" + " <xsl:for-each select=\"catalog/cd\">\n" + " <li><xsl:value-of select='title'/> (<xsl:value-of select='artist'/>)</li>\n" + " </xsl:for-each>\n" + " </ul>\n" + " </body>\n" + " </html>\n" + " </xsl:template>\n" + "</xsl:stylesheet>"; getMockWebConnection().setResponse(URL_SECOND, xml, MimeType.TEXT_XML); getMockWebConnection().setResponse(urlThird, xsl, MimeType.TEXT_XML); loadPageVerifyTitle2(createTestHTML(html)); } }
3e052acb79971bb118703b2694159a353f8c1002
430
java
Java
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blackbox/sensors/WrappedSensor.java
tiborr/atomic_theory_19_20
aacb35879cea85a8fedb7f1cdb18b29b3f2042a9
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blackbox/sensors/WrappedSensor.java
tiborr/atomic_theory_19_20
aacb35879cea85a8fedb7f1cdb18b29b3f2042a9
[ "MIT" ]
null
null
null
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/blackbox/sensors/WrappedSensor.java
tiborr/atomic_theory_19_20
aacb35879cea85a8fedb7f1cdb18b29b3f2042a9
[ "MIT" ]
null
null
null
22.631579
77
0.702326
2,167
package org.firstinspires.ftc.teamcode.blackbox.sensors; import org.firstinspires.ftc.teamcode.blackbox.Datastreamable; public abstract class WrappedSensor<T> implements Datastreamable { String _name; T _sensor; public WrappedSensor(T sensor, String name) throws InterruptedException { _name = name; _sensor = sensor; } @Override public String getName() { return _name; } }
3e052b2ca7860a5a2ffb969f01ab22410176b46c
1,221
java
Java
src/main/java/de/wolfgang_bongartz/cellular_automaton/automaton/PaintHabitatEvent.java
wolubo/cellular-automaton
265d817bfbf05d5a0715739f2d8e9051034636ef
[ "MIT" ]
null
null
null
src/main/java/de/wolfgang_bongartz/cellular_automaton/automaton/PaintHabitatEvent.java
wolubo/cellular-automaton
265d817bfbf05d5a0715739f2d8e9051034636ef
[ "MIT" ]
null
null
null
src/main/java/de/wolfgang_bongartz/cellular_automaton/automaton/PaintHabitatEvent.java
wolubo/cellular-automaton
265d817bfbf05d5a0715739f2d8e9051034636ef
[ "MIT" ]
null
null
null
24.918367
109
0.742015
2,168
package de.wolfgang_bongartz.cellular_automaton.automaton; import java.util.ArrayList; /** * Asynchronous event that informs the receiver that a new generation of the CA is ready to be displayd. * @author Wolfgang Bongartz * */ public class PaintHabitatEvent implements Runnable { private static ArrayList<PaintHabitatEventObserver> _observers = new ArrayList<PaintHabitatEventObserver>(); private Habitat _habitat; private int _generation; /** * Add a new event-receiver. * @param o Instance of a class that implements PaintHabitatEventObserver. * @see PaintHabitatEventObserver */ public static void AddObserver(PaintHabitatEventObserver o) { _observers.add(o); } /** * Constructor * @param h Payload: Reference of the new habitat-version. * @param generation Payload: Generation-number. */ public PaintHabitatEvent(Habitat h, int generation) { _habitat = h; _generation = generation; } @Override /** * Call handleEvent() on all observers. * This method is performed automatically when the event is sent. */ public void run() { // TODO Auto-generated method stub for(PaintHabitatEventObserver o: _observers) { o.handleEvent(_habitat, _generation); } } }
3e052ba7d53ce593728d12ddc72a4c4a8da3d0ba
2,342
java
Java
src/main/java/com/twineworks/tweakflow/lang/interpreter/ops/IsOp.java
wsargent/tweakflow
78660dcb1fbcd9e908b4d602899227c4f6cbec7f
[ "MIT" ]
22
2018-06-18T17:00:09.000Z
2022-03-14T10:23:50.000Z
src/main/java/com/twineworks/tweakflow/lang/interpreter/ops/IsOp.java
wsargent/tweakflow
78660dcb1fbcd9e908b4d602899227c4f6cbec7f
[ "MIT" ]
7
2018-05-16T14:05:25.000Z
2022-01-07T18:52:05.000Z
src/main/java/com/twineworks/tweakflow/lang/interpreter/ops/IsOp.java
wsargent/tweakflow
78660dcb1fbcd9e908b4d602899227c4f6cbec7f
[ "MIT" ]
6
2019-04-16T19:12:44.000Z
2021-07-22T18:47:51.000Z
31.226667
81
0.733134
2,169
/* * The MIT License (MIT) * * Copyright (c) 2019 Twineworks GmbH * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.twineworks.tweakflow.lang.interpreter.ops; import com.twineworks.tweakflow.lang.interpreter.EvaluationContext; import com.twineworks.tweakflow.lang.interpreter.Stack; import com.twineworks.tweakflow.lang.ast.expressions.IsNode; import com.twineworks.tweakflow.lang.types.Types; import com.twineworks.tweakflow.lang.values.Value; import com.twineworks.tweakflow.lang.values.Values; final public class IsOp implements ExpressionOp { private final IsNode node; private final ExpressionOp op; public IsOp(IsNode node) { this.node = node; this.op = node.getExpression().getOp(); } @Override public Value eval(Stack stack, EvaluationContext context) { Value value = op.eval(stack, context); if (value.type() == node.getCompareType()){ return Values.TRUE; } else if (!value.isNil() && node.getCompareType() == Types.ANY){ return Values.TRUE; } else{ return Values.FALSE; } } @Override public boolean isConstant() { return op.isConstant(); } @Override public ExpressionOp specialize() { return new IsOp(node); } @Override public ExpressionOp refresh() { return new IsOp(node); } }
3e052c21e5a8bcdee5e3d13c1669032ee01572cb
1,846
java
Java
weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
jovenwang/weixin4j
c527924169e6d7eaa1ceccd4f057cfac10098ae9
[ "Apache-2.0" ]
930
2015-02-14T04:20:16.000Z
2022-03-31T06:30:07.000Z
weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
jovenwang/weixin4j
c527924169e6d7eaa1ceccd4f057cfac10098ae9
[ "Apache-2.0" ]
144
2015-01-20T02:35:39.000Z
2022-02-20T02:55:35.000Z
weixin4j-mp/src/test/java/com/foxinmy/weixin4j/mp/test/GroupTest.java
jovenwang/weixin4j
c527924169e6d7eaa1ceccd4f057cfac10098ae9
[ "Apache-2.0" ]
514
2015-02-04T08:07:36.000Z
2022-03-21T04:33:17.000Z
24.613333
71
0.708559
2,170
package com.foxinmy.weixin4j.mp.test; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import com.foxinmy.weixin4j.exception.WeixinException; import com.foxinmy.weixin4j.http.weixin.ApiResult; import com.foxinmy.weixin4j.mp.api.GroupApi; import com.foxinmy.weixin4j.mp.model.Group; /** * 用户分组测试 * * @className GroupTest * @author jinyu([email protected]) * @date 2014年4月10日 * @since JDK 1.6 */ public class GroupTest extends TokenTest { private GroupApi groupApi; @Before public void init() { groupApi = new GroupApi(tokenManager); } @Test public void create() throws WeixinException { Group group = groupApi.createGroup("my"); Assert.assertNotNull(group); } @Test public void get() throws WeixinException { List<Group> groups = groupApi.getGroups(); System.err.println(groups); Assert.assertTrue(groups.size() > 0); } @Test public void getid() throws WeixinException { int gid = groupApi.getGroupByOpenId("owGBft_vbBbOaQOmpEUE4xDLeRSU"); Assert.assertTrue(gid >= 0); } @Test public void modify() throws WeixinException { ApiResult result = groupApi.modifyGroup(100, "my1"); Assert.assertEquals("0", result.getReturnCode()); } @Test public void move() throws WeixinException { ApiResult result = groupApi.moveGroup(100, "owGBft_vbBbOaQOmpEUE4xDLeRSU"); Assert.assertEquals("0", result.getReturnCode()); } @Test public void batchMove() throws WeixinException { ApiResult result = groupApi.moveGroup(100, "owGBft_vbBbOaQOmpEUE4xDLeRSU"); Assert.assertEquals("0", result.getReturnCode()); } @Test public void delete() throws WeixinException { ApiResult result = groupApi.deleteGroup(100); Assert.assertEquals("0", result.getReturnCode()); } }
3e052cc937a039f4412b5fe11d03d846fc1db6d6
750
java
Java
src/main/java/r48/io/r2k/dm2chk/DM2LcfBoolean.java
rohkea/gabien-app-r48
890853f608134522573dca70267439033a2d1579
[ "CC0-1.0" ]
21
2017-06-08T15:51:07.000Z
2022-02-02T01:35:51.000Z
src/main/java/r48/io/r2k/dm2chk/DM2LcfBoolean.java
rohkea/gabien-app-r48
890853f608134522573dca70267439033a2d1579
[ "CC0-1.0" ]
55
2017-07-29T08:05:57.000Z
2022-02-13T16:44:28.000Z
src/main/java/r48/io/r2k/dm2chk/DM2LcfBoolean.java
rohkea/gabien-app-r48
890853f608134522573dca70267439033a2d1579
[ "CC0-1.0" ]
2
2021-06-12T13:38:56.000Z
2022-03-30T00:00:39.000Z
37.5
214
0.770667
2,171
/* * gabien-app-r48 - Editing program for various formats * Written starting in 2016 by contributors (see CREDITS.txt) * To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. * You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. */ package r48.io.r2k.dm2chk; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Created on December 05, 2018. */ @Retention(RetentionPolicy.RUNTIME) public @interface DM2LcfBoolean { boolean value(); }
3e052f40c083a04b2a7f82f7ff4d42b7901a9d15
588
java
Java
src/ctci/_28KnapSackProblem.java
darshanhs90/Java-HackerRank
da76ccd7851f102712f7d8dfa4659901c5de7a76
[ "MIT" ]
3
2017-03-04T19:21:28.000Z
2019-08-09T07:31:34.000Z
src/ctci/_28KnapSackProblem.java
darshanhs90/Java-HackerRank
da76ccd7851f102712f7d8dfa4659901c5de7a76
[ "MIT" ]
null
null
null
src/ctci/_28KnapSackProblem.java
darshanhs90/Java-HackerRank
da76ccd7851f102712f7d8dfa4659901c5de7a76
[ "MIT" ]
3
2017-12-17T10:36:07.000Z
2022-01-19T19:08:35.000Z
24.5
76
0.608844
2,172
package ctci; /*Implementation of Knap Sack Problem*/ public class _28KnapSackProblem{ public static void main(String[] args) { int val[] = {3,7,2,9};//{60, 100, 120}; int wt[] = {2,3,4,5};//{10, 20, 30}; int W = 5;//50; System.out.println(performKnapSack(W,wt,val,val.length)); } private static int performKnapSack(int W, int[] wt, int[] val, int n) { if(n==0||W==0) return 0; if (wt[n-1] > W) return performKnapSack(W, wt, val, n-1); else return Math.max( val[n-1] + performKnapSack(W-wt[n-1], wt, val, n-1), performKnapSack(W, wt, val, n-1) ); } }
3e05310558a6feb1020c4b0aaaf16a5574b83253
1,159
java
Java
Android application/app/src/main/java/in/skylinelabs/GoPay/DemoPagerAdapter.java
SkylineLabs/Kym-Credit-Score
7f00fc6af93565a0e21431dd8a9c914f09b857a8
[ "Apache-2.0" ]
15
2017-12-27T15:20:38.000Z
2021-08-10T23:18:04.000Z
Android application/app/src/main/java/in/skylinelabs/GoPay/DemoPagerAdapter.java
aubryll/Kym-Credit-Score
7f00fc6af93565a0e21431dd8a9c914f09b857a8
[ "Apache-2.0" ]
null
null
null
Android application/app/src/main/java/in/skylinelabs/GoPay/DemoPagerAdapter.java
aubryll/Kym-Credit-Score
7f00fc6af93565a0e21431dd8a9c914f09b857a8
[ "Apache-2.0" ]
8
2017-09-16T06:33:58.000Z
2020-09-03T16:52:56.000Z
23.653061
84
0.645384
2,173
package in.skylinelabs.GoPay; import android.graphics.Color; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import java.util.Random; /** * Created by Jay Lohokare on 14-01-2017. */ public class DemoPagerAdapter extends FragmentPagerAdapter { private int pagerCount = 5; private Random random = new Random(); public DemoPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int i) { if(i==0) return ColorFragment.newInstance(Color.parseColor("#0277bd"), i);//red if(i==1) return ColorFragment.newInstance(Color.parseColor("#4baf4f"), i);//pink if(i==2) return ColorFragment.newInstance(Color.parseColor("#f29d0f"), i);//green if(i==3) return ColorFragment.newInstance(Color.parseColor("#5f7d88"), i); if(i==4) return ColorFragment.newInstance(Color.parseColor("#0277bd"), i); else return null; } @Override public int getCount() { return pagerCount; } }
3e0531242a33c783094d123143245a8ad04f9c3d
2,232
java
Java
app/src/main/java/com/zyw/horrarndoo/yizhi/adapter/WangyiAdapter.java
wuwangchuzhong/loginMvp
4400b013a37fde70712996517385eb39360c65f3
[ "Apache-2.0" ]
1
2018-04-18T03:12:55.000Z
2018-04-18T03:12:55.000Z
app/src/main/java/com/zyw/horrarndoo/yizhi/adapter/WangyiAdapter.java
wuwangchuzhong/loginMvp
4400b013a37fde70712996517385eb39360c65f3
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/zyw/horrarndoo/yizhi/adapter/WangyiAdapter.java
wuwangchuzhong/loginMvp
4400b013a37fde70712996517385eb39360c65f3
[ "Apache-2.0" ]
null
null
null
32.823529
97
0.692204
2,174
package com.zyw.horrarndoo.yizhi.adapter; import android.graphics.Color; import android.support.annotation.LayoutRes; import android.support.annotation.Nullable; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.chad.library.adapter.base.BaseQuickAdapter; import com.chad.library.adapter.base.BaseViewHolder; import com.chad.library.adapter.base.animation.ScaleInAnimation; import com.zyw.horrarndoo.sdk.config.DBConfig; import com.zyw.horrarndoo.sdk.config.ItemState; import com.zyw.horrarndoo.sdk.utils.DBUtils; import com.zyw.horrarndoo.sdk.utils.SpUtils; import com.zyw.horrarndoo.yizhi.R; import com.zyw.horrarndoo.yizhi.model.bean.wangyi.WangyiNewsItemBean; import java.util.List; /** * Created by Horrarndoo on 2017/9/18. * <p> * 网易新闻Adapter */ public class WangyiAdapter extends BaseCompatAdapter<WangyiNewsItemBean, BaseViewHolder> { public WangyiAdapter(@LayoutRes int layoutResId, @Nullable List<WangyiNewsItemBean> data) { super(layoutResId, data); init(); } public WangyiAdapter(@Nullable List<WangyiNewsItemBean> data) { super(data); init(); } public WangyiAdapter(@LayoutRes int layoutResId) { super(layoutResId); init(); } @Override protected void convert(BaseViewHolder helper, WangyiNewsItemBean item) { if (DBUtils.getDB(mContext).isRead(DBConfig.TABLE_WANGYI, item.getDocid(), ItemState .STATE_IS_READ)) { helper.setTextColor(R.id.tv_item_title, Color.GRAY); } else { if (SpUtils.getNightModel(mContext)) { helper.setTextColor(R.id.tv_item_title, Color.WHITE); } else { helper.setTextColor(R.id.tv_item_title, Color.BLACK); } } helper.setText(R.id.tv_item_title, item.getTitle()); helper.setText(R.id.tv_item_who, item.getSource()); helper.setText(R.id.tv_item_time, item.getPtime()); Glide.with(mContext).load(item.getImgsrc()).crossFade().into((ImageView) helper.getView(R .id.iv_item_image)); } private void init() { // openLoadAnimation(new ScaleInAnimation(0.8f)); // isFirstOnly(false); } }
3e0531abb707afb877d59d7e3108e4427eae3eb9
298
java
Java
app/src/main/java/se/kjellstrand/tlmfruits/model/EntryFruit.java
carlemil/TMLMyFruitsDiary
a20e24b27da170c7cc6ad67afa71294f681d208a
[ "MIT" ]
1
2018-12-14T14:22:48.000Z
2018-12-14T14:22:48.000Z
app/src/main/java/se/kjellstrand/tlmfruits/model/EntryFruit.java
carlemil/TMLMyFruitsDiary
a20e24b27da170c7cc6ad67afa71294f681d208a
[ "MIT" ]
null
null
null
app/src/main/java/se/kjellstrand/tlmfruits/model/EntryFruit.java
carlemil/TMLMyFruitsDiary
a20e24b27da170c7cc6ad67afa71294f681d208a
[ "MIT" ]
null
null
null
19.866667
39
0.52349
2,175
package se.kjellstrand.tlmfruits.model; public class EntryFruit { public int fruitId; public int amount; @Override public String toString() { return "EntryFruit{" + "fruitId=" + fruitId + ", amount=" + amount + '}'; } }
3e0532b79f43c5d49a41b51328d8249bed5c5a04
840
java
Java
Tests/src/org/reldb/rel/tests/main/TestCase3.java
DaveVoorhis/Rel
c4c0fa7843747b10923d27183536641cd1fda117
[ "Apache-2.0" ]
89
2015-04-21T22:34:19.000Z
2022-02-20T06:00:26.000Z
Tests/src/org/reldb/rel/tests/main/TestCase3.java
DaveVoorhis/Rel
c4c0fa7843747b10923d27183536641cd1fda117
[ "Apache-2.0" ]
2
2018-09-21T22:27:49.000Z
2021-06-07T14:03:15.000Z
Tests/src/org/reldb/rel/tests/main/TestCase3.java
DaveVoorhis/Rel
c4c0fa7843747b10923d27183536641cd1fda117
[ "Apache-2.0" ]
9
2015-04-03T16:27:38.000Z
2021-06-07T13:52:52.000Z
23.333333
89
0.604762
2,176
package org.reldb.rel.tests.main; import org.junit.After; import org.junit.Test; import org.reldb.rel.tests.BaseOfTest; import org.reldb.rel.v0.values.*; public class TestCase3 extends BaseOfTest { @Test public void testCase3() { String src = "BEGIN;" + "OPERATOR caseTest(p integer) RETURNS integer;" + " RETURN CASE " + " WHEN p = 1 THEN 1 " + " ELSE 4" + " END CASE; " + "END OPERATOR;" + "END;" + "caseTest(1)"; assertValueEquals(ValueInteger.select(generator, 1), testEvaluate(src).getValue()); } @After public void testCase3_cleanup() { String src = "BEGIN;" + " DROP OPERATOR caseTest(integer);" + "END;" + "true"; assertValueEquals(ValueBoolean.select(generator, true), testEvaluate(src).getValue()); } }
3e0532ba7dfab6c2d5fa316670e8a405da816ed8
4,874
java
Java
api/src/main/java/org/xnio/conduits/Conduits.java
bmaxwell/xnio
575212ff8408d1c4a61b994fb0f9ed27b9cc7288
[ "Apache-2.0" ]
null
null
null
api/src/main/java/org/xnio/conduits/Conduits.java
bmaxwell/xnio
575212ff8408d1c4a61b994fb0f9ed27b9cc7288
[ "Apache-2.0" ]
null
null
null
api/src/main/java/org/xnio/conduits/Conduits.java
bmaxwell/xnio
575212ff8408d1c4a61b994fb0f9ed27b9cc7288
[ "Apache-2.0" ]
null
null
null
42.426087
168
0.623283
2,177
/* * JBoss, Home of Professional Open Source * * Copyright 2013 Red Hat, Inc. and/or its affiliates. * * 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.xnio.conduits; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.ReadableByteChannel; import java.nio.channels.WritableByteChannel; /** * General utility methods for manipulating conduits. * * @author <a href="mailto:[email protected]">David M. Lloyd</a> */ public final class Conduits { /** * Platform-independent channel-to-channel transfer method. Uses regular {@code read} and {@code write} operations * to move bytes from the {@code source} channel to the {@code sink} channel. After this call, the {@code throughBuffer} * should be checked for remaining bytes; if there are any, they should be written to the {@code sink} channel before * proceeding. This method may be used with NIO channels, XNIO channels, or a combination of the two. * <p> * If either or both of the given channels are blocking channels, then this method may block. * * @param source the source channel to read bytes from * @param count the number of bytes to transfer (must be >= {@code 0L}) * @param throughBuffer the buffer to transfer through (must not be {@code null}) * @param sink the sink channel to write bytes to * @return the number of bytes actually transferred (possibly 0) * @throws java.io.IOException if an I/O error occurs during the transfer of bytes */ public static long transfer(final StreamSourceConduit source, final long count, final ByteBuffer throughBuffer, final WritableByteChannel sink) throws IOException { long res; long total = 0L; throughBuffer.limit(0); while (total < count) { throughBuffer.compact(); try { if (count - total < (long) throughBuffer.remaining()) { throughBuffer.limit((int) (count - total)); } res = source.read(throughBuffer); if (res <= 0) { return total == 0L ? res : total; } } finally { throughBuffer.flip(); } res = sink.write(throughBuffer); if (res == 0) { return total; } total += res; } return total; } /** * Platform-independent channel-to-channel transfer method. Uses regular {@code read} and {@code write} operations * to move bytes from the {@code source} channel to the {@code sink} channel. After this call, the {@code throughBuffer} * should be checked for remaining bytes; if there are any, they should be written to the {@code sink} channel before * proceeding. This method may be used with NIO channels, XNIO channels, or a combination of the two. * <p> * If either or both of the given channels are blocking channels, then this method may block. * * @param source the source channel to read bytes from * @param count the number of bytes to transfer (must be >= {@code 0L}) * @param throughBuffer the buffer to transfer through (must not be {@code null}) * @param sink the sink channel to write bytes to * @return the number of bytes actually transferred (possibly 0) * @throws java.io.IOException if an I/O error occurs during the transfer of bytes */ public static long transfer(final ReadableByteChannel source, final long count, final ByteBuffer throughBuffer, final StreamSinkConduit sink) throws IOException { long res; long total = 0L; throughBuffer.limit(0); while (total < count) { throughBuffer.compact(); try { if (count - total < (long) throughBuffer.remaining()) { throughBuffer.limit((int) (count - total)); } res = source.read(throughBuffer); if (res <= 0) { return total == 0L ? res : total; } } finally { throughBuffer.flip(); } res = sink.write(throughBuffer); if (res == 0) { return total; } total += res; } return total; } }
3e053302f6be139440c08f12c81dad1c0fdddab9
687
java
Java
org/seltak/anubis/modules/movement/AutoWalk.java
BantorSchwanzVor/plotscanner-leak
cbf130076159711d939affb4b0343c46c3466107
[ "MIT" ]
null
null
null
org/seltak/anubis/modules/movement/AutoWalk.java
BantorSchwanzVor/plotscanner-leak
cbf130076159711d939affb4b0343c46c3466107
[ "MIT" ]
null
null
null
org/seltak/anubis/modules/movement/AutoWalk.java
BantorSchwanzVor/plotscanner-leak
cbf130076159711d939affb4b0343c46c3466107
[ "MIT" ]
null
null
null
25.444444
146
0.69869
2,178
package org.seltak.anubis.modules.movement; import org.seltak.anubis.module.Category; import org.seltak.anubis.module.Module; public class AutoWalk extends Module { int x = 1; public AutoWalk() { super("AutoWalk", Category.MOVEMENT, 0); } public void onPreUpdate() { this.mc.gameSettings.keyBindForward.setPressed(true); } public void onDisable() { super.onDisable(); this.mc.gameSettings.keyBindForward.setPressed(false); } } /* Location: C:\Users\BSV\AppData\Local\Temp\Rar$DRa6216.20396\Preview\Preview.jar!\org\seltak\anubis\modules\movement\AutoWalk.class * Java compiler version: 8 (52.0) * JD-Core Version: 1.1.3 */
3e053347c9776edde9a11809fdb78da6ea043a46
84,964
java
Java
advertising/src/test/java/org/im97mori/ble/advertising/ChannelMapUpdateIndicationTest.java
im97mori-github/JavaBLEUtil
6b3dc4c8561a1d51aec6c35c93ba5327ae66830c
[ "MIT" ]
1
2021-07-13T18:30:17.000Z
2021-07-13T18:30:17.000Z
advertising/src/test/java/org/im97mori/ble/advertising/ChannelMapUpdateIndicationTest.java
im97mori-github/JavaBLEUtil
6b3dc4c8561a1d51aec6c35c93ba5327ae66830c
[ "MIT" ]
null
null
null
advertising/src/test/java/org/im97mori/ble/advertising/ChannelMapUpdateIndicationTest.java
im97mori-github/JavaBLEUtil
6b3dc4c8561a1d51aec6c35c93ba5327ae66830c
[ "MIT" ]
1
2020-11-25T09:17:51.000Z
2020-11-25T09:17:51.000Z
41.365141
116
0.646438
2,179
package org.im97mori.ble.advertising; import static org.im97mori.ble.constants.DataType.CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import org.junit.Test; @SuppressWarnings("unused") public class ChannelMapUpdateIndicationTest { //@formatter:off private static final byte[] data_00001; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111110; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00001 = data; } private static final byte[] data_00002; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111101; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00002 = data; } private static final byte[] data_00003; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111011; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00003 = data; } private static final byte[] data_00004; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11110111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00004 = data; } private static final byte[] data_00005; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11101111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00005 = data; } private static final byte[] data_00006; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11011111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00006 = data; } private static final byte[] data_00007; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b10111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00007 = data; } private static final byte[] data_00008; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b01111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00008 = data; } private static final byte[] data_00009; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111110; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00009 = data; } private static final byte[] data_00010; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111101; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00010 = data; } private static final byte[] data_00011; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111011; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00011 = data; } private static final byte[] data_00012; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11110111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00012 = data; } private static final byte[] data_00013; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11101111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00013 = data; } private static final byte[] data_00014; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11011111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00014 = data; } private static final byte[] data_00015; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b10111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00015 = data; } private static final byte[] data_00016; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b01111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00016 = data; } private static final byte[] data_00017; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111110; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00017 = data; } private static final byte[] data_00018; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111101; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00018 = data; } private static final byte[] data_00019; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111011; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00019 = data; } private static final byte[] data_00020; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11110111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00020 = data; } private static final byte[] data_00021; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11101111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00021 = data; } private static final byte[] data_00022; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11011111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00022 = data; } private static final byte[] data_00023; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b10111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00023 = data; } private static final byte[] data_00024; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b01111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00024 = data; } private static final byte[] data_00025; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111110; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00025 = data; } private static final byte[] data_00026; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111101; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00026 = data; } private static final byte[] data_00027; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111011; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00027 = data; } private static final byte[] data_00028; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11110111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00028 = data; } private static final byte[] data_00029; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11101111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00029 = data; } private static final byte[] data_00030; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11011111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00030 = data; } private static final byte[] data_00031; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b10111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00031 = data; } private static final byte[] data_00032; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b01111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00032 = data; } private static final byte[] data_00033; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111110; data[7] = 0b00000000; data[8] = 0b00000000; data_00033 = data; } private static final byte[] data_00034; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111101; data[7] = 0b00000000; data[8] = 0b00000000; data_00034 = data; } private static final byte[] data_00035; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111011; data[7] = 0b00000000; data[8] = 0b00000000; data_00035 = data; } private static final byte[] data_00036; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11110111; data[7] = 0b00000000; data[8] = 0b00000000; data_00036 = data; } private static final byte[] data_00037; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11101111; data[7] = 0b00000000; data[8] = 0b00000000; data_00037 = data; } private static final byte[] data_00038; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11011111; data[7] = 0b00000000; data[8] = 0b00000000; data_00038 = data; } private static final byte[] data_00039; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b10111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00039 = data; } private static final byte[] data_00040; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b01111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00040 = data; } private static final byte[] data_00041; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000000; data[8] = 0b00000000; data_00041 = data; } private static final byte[] data_00042; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = 0b00000000; data[3] = 0b00000000; data[4] = 0b00000000; data[5] = 0b00000000; data[6] = 0b00000000; data[7] = 0b00000000; data[8] = 0b00000000; data_00042 = data; } private static final byte[] data_00043; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = 0b00000001; data[8] = 0b00000000; data_00043 = data; } private static final byte[] data_00044; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = (byte) 0b10000000; data[8] = 0b00000000; data_00044 = data; } private static final byte[] data_00045; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = (byte) 0b00000000; data[8] = 0b00000001; data_00045 = data; } private static final byte[] data_00046; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = (byte) 0b00000000; data[8] = (byte) 0b10000000; data_00046 = data; } private static final byte[] data_00047; static { byte[] data = new byte[9]; data[0] = 8; data[1] = CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE; data[2] = (byte) 0b11111111; data[3] = (byte) 0b11111111; data[4] = (byte) 0b11111111; data[5] = (byte) 0b11111111; data[6] = (byte) 0b11111111; data[7] = (byte) 0b11111111; data[8] = (byte) 0b11111111; data_00047 = data; } //@formatter:on private byte[] getData() { int index = -1; byte[] data = null; StackTraceElement[] stackTraceElementArray = Thread.currentThread().getStackTrace(); for (int i = 0; i < stackTraceElementArray.length; i++) { StackTraceElement stackTraceElement = stackTraceElementArray[i]; if ("getData".equals(stackTraceElement.getMethodName())) { index = i + 1; break; } } if (index >= 0 && index < stackTraceElementArray.length) { StackTraceElement stackTraceElement = stackTraceElementArray[index]; String[] splitted = stackTraceElement.getMethodName().split("_"); try { data = (byte[]) this.getClass().getDeclaredField("data_" + splitted[splitted.length - 1]).get(null); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } return data; } @Test public void test_constructor_00001() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b11111110 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(1, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2404, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00002() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b11111101 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(2, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2406, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00003() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b11111011 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(3, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2408, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00004() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b11110111 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(4, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2410, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00005() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b11101111 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(5, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2412, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00006() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b11011111 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(6, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2414, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00007() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b10111111 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(7, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2416, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00008() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b01111111 & 0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(8, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2418, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00009() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b11111110 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(9, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2420, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00010() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b11111101 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(10, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2422, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00011() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b11111011 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(11, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2424, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00012() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b11110111 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(13, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2428, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00013() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b11101111 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(14, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2430, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00014() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b11011111 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(15, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2432, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00015() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b10111111 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(16, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2434, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00016() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0b01111111 & 0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(17, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2436, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00017() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b11111110 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(18, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2438, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00018() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b11111101 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(19, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2440, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00019() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b11111011 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(20, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2442, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00020() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b11110111 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(21, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2444, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00021() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b11101111 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(22, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2446, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00022() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b11011111 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(23, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2448, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00023() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b10111111 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(24, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2450, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00024() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0b01111111 & 0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(25, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2452, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00025() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b11111110 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(26, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2454, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00026() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b11111101 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(27, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2456, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00027() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b11111011 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(28, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2458, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00028() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b11110111 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(29, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2460, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00029() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b11101111 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(30, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2462, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00030() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b11011111 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(31, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2464, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00031() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b10111111 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(32, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2466, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00032() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0b01111111 & 0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(33, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2468, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00033() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b11111110 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(34, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2470, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00034() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b11111101 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(35, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2472, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00035() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b11111011 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(36, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2474, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00036() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b11110111 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(37, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2476, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00037() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b11101111 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(38, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2478, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00038() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b11011111 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(0, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2402, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00039() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b10111111 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(12, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2426, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00040() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0b01111111 & 0xff, result1.getChmList().get(4).intValue()); assertEquals(1, result1.getUnusedPhyChannelList().size()); assertEquals(39, result1.getUnusedPhyChannelList().get(0).intValue()); assertEquals(1, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(2480, result1.getUnusedPhyChannelRfCenterFrequencyList().get(0).intValue()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00041() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(0, result1.getUnusedPhyChannelList().size()); assertEquals(0, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00042() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0b00000000, result1.getChmList().get(0).intValue()); assertEquals(0b00000000, result1.getChmList().get(1).intValue()); assertEquals(0b00000000, result1.getChmList().get(2).intValue()); assertEquals(0b00000000, result1.getChmList().get(3).intValue()); assertEquals(0b00000000, result1.getChmList().get(4).intValue()); assertEquals(40, result1.getUnusedPhyChannelList().size()); for (int i = 0; i < 40; i++) { assertEquals(i, result1.getUnusedPhyChannelList().get(i).intValue()); } assertEquals(40, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); for (int i = 0; i < 40; i++) { assertEquals(2400 + (i + 1) * 2, result1.getUnusedPhyChannelRfCenterFrequencyList().get(i).intValue()); } assertEquals(0, result1.getInstant()); } @Test public void test_constructor_00043() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(0, result1.getUnusedPhyChannelList().size()); assertEquals(0, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(0b00000000_00000001, result1.getInstant()); } @Test public void test_constructor_00044() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(0, result1.getUnusedPhyChannelList().size()); assertEquals(0, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(0b00000000_10000000, result1.getInstant()); } @Test public void test_constructor_00045() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(0, result1.getUnusedPhyChannelList().size()); assertEquals(0, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(0b00000001_00000000, result1.getInstant()); } @Test public void test_constructor_00046() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(0, result1.getUnusedPhyChannelList().size()); assertEquals(0, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(0b10000000_00000000, result1.getInstant()); } @Test public void test_constructor_00047() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertEquals(8, result1.getLength()); assertEquals(CHANNEL_MAP_UPDATE_INDICATION_DATA_TYPE, result1.getDataType()); assertEquals(5, result1.getChmList().size()); assertEquals(0xff, result1.getChmList().get(0).intValue()); assertEquals(0xff, result1.getChmList().get(1).intValue()); assertEquals(0xff, result1.getChmList().get(2).intValue()); assertEquals(0xff, result1.getChmList().get(3).intValue()); assertEquals(0xff, result1.getChmList().get(4).intValue()); assertEquals(0, result1.getUnusedPhyChannelList().size()); assertEquals(0, result1.getUnusedPhyChannelRfCenterFrequencyList().size()); assertEquals(0b11111111_11111111, result1.getInstant()); } @Test public void test_parcelable_2_00001() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00002() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00003() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00004() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00005() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00006() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00007() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00008() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00009() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00010() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00011() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00012() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00013() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00014() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00015() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00016() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00017() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00018() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00019() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00020() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00021() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00022() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00023() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00024() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00025() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00026() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00027() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00028() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00029() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00030() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00031() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00032() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00033() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00034() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00035() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00036() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00037() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00038() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00039() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00040() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00041() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00042() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00043() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00044() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00045() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00046() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } @Test public void test_parcelable_2_00047() { byte[] data = getData(); ChannelMapUpdateIndication result1 = new ChannelMapUpdateIndication(data, 0, data[0]); assertArrayEquals(data, result1.getBytes()); } }
3e05339eb1e73c26427d23ac59680e6716b77d67
148
java
Java
src/application/common/enums/EMetric.java
mortezamohaqeqi/dynfed
aceb99607eb87343aea226a85551fd5b95413ad8
[ "MIT" ]
null
null
null
src/application/common/enums/EMetric.java
mortezamohaqeqi/dynfed
aceb99607eb87343aea226a85551fd5b95413ad8
[ "MIT" ]
null
null
null
src/application/common/enums/EMetric.java
mortezamohaqeqi/dynfed
aceb99607eb87343aea226a85551fd5b95413ad8
[ "MIT" ]
null
null
null
21.142857
82
0.797297
2,180
package application.common.enums; public enum EMetric { Schedulability, JobSuccessRate, Lateness, Lateness_Overal, SchedulabilityvsTasks }
3e0533b5d0ad13ffa492a77f326379f7f5f1c67c
747
java
Java
quickstart-jafka/src/test/java/org/quickstart/mq/jafka/ConsumerTest.java
youngzil/quickstart-mq
a3568cedc9813b5fd3802898a8ec0141b406831d
[ "Apache-2.0" ]
2
2020-01-07T02:29:42.000Z
2020-07-21T07:06:30.000Z
quickstart-jafka/src/test/java/org/quickstart/mq/jafka/ConsumerTest.java
youngzil/quickstart-mq
a3568cedc9813b5fd3802898a8ec0141b406831d
[ "Apache-2.0" ]
22
2019-12-08T14:29:24.000Z
2022-01-04T16:56:21.000Z
quickstart-jafka/src/test/java/org/quickstart/mq/jafka/ConsumerTest.java
youngzil/quickstart-mq
a3568cedc9813b5fd3802898a8ec0141b406831d
[ "Apache-2.0" ]
4
2019-11-07T05:22:25.000Z
2020-06-25T02:18:36.000Z
24.9
75
0.68407
2,181
package org.quickstart.mq.jafka; import io.jafka.api.FetchRequest; import io.jafka.consumer.SimpleConsumer; import io.jafka.message.MessageAndOffset; import io.jafka.utils.Utils; import java.io.IOException; /** * @author yangzl * @description TODO * @createTime 2019/12/8 23:31 */ public class ConsumerTest { public static void main(String[] args) throws IOException { SimpleConsumer consumer = new SimpleConsumer("127.0.0.1", 9092); // long offset = 0; while (true) { FetchRequest request = new FetchRequest("test", 0, offset); for (MessageAndOffset msg : consumer.fetch(request)) { System.out.println(Utils.toString(msg.message.payload(), "UTF-8")); offset = msg.offset; } } } }
3e0533cca8076d0965e4f4296fc5e6c260b3f64a
696
java
Java
src/main/java/ai/arcblroth/fabric/hewo/api/HewoAPI.java
MaowImpl/hewo
01e276cd7b3a06b5a13c6e0b11073a59933c5a1e
[ "MIT" ]
null
null
null
src/main/java/ai/arcblroth/fabric/hewo/api/HewoAPI.java
MaowImpl/hewo
01e276cd7b3a06b5a13c6e0b11073a59933c5a1e
[ "MIT" ]
null
null
null
src/main/java/ai/arcblroth/fabric/hewo/api/HewoAPI.java
MaowImpl/hewo
01e276cd7b3a06b5a13c6e0b11073a59933c5a1e
[ "MIT" ]
null
null
null
26.769231
73
0.706897
2,182
package ai.arcblroth.fabric.hewo.api; import ai.arcblroth.fabric.hewo.HewoAPIImpl; import java.util.function.Supplier; public interface HewoAPI { static HewoAPI getInstance() { return HewoAPIImpl.HEWO; } /** * Adds a modifier that specifies the probability * that a message will be owoified. A message will * be owoified based on the highest probability * from all registered modifiers. For example, if * one modifier returns 0.4 and another returns 0.6, * than the overall probability for owofication * will be 0.6. * @param probabilityModifier */ void addOwoProbabilityModifier(Supplier<Double> probabilityModifier); }
3e0534102d6fe4a89ff2d3ebdd39e8afd95191bf
3,168
java
Java
api/src/main/java/net/kyori/adventure/translation/GlobalTranslator.java
KingOfSquares/adventure
3af760f73830902f1a546f905ef1565814d9bc50
[ "MIT" ]
null
null
null
api/src/main/java/net/kyori/adventure/translation/GlobalTranslator.java
KingOfSquares/adventure
3af760f73830902f1a546f905ef1565814d9bc50
[ "MIT" ]
2
2022-02-28T09:29:41.000Z
2022-03-01T09:25:22.000Z
api/src/main/java/net/kyori/adventure/translation/GlobalTranslator.java
KingOfSquares/adventure
3af760f73830902f1a546f905ef1565814d9bc50
[ "MIT" ]
null
null
null
32
102
0.71654
2,183
/* * This file is part of adventure, licensed under the MIT License. * * Copyright (c) 2017-2020 KyoriPowered * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package net.kyori.adventure.translation; import java.util.Locale; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.renderer.TranslatableComponentRenderer; import net.kyori.examination.Examinable; import org.checkerframework.checker.nullness.qual.NonNull; /** * A global source of translations. * * @since 4.0.0 */ public interface GlobalTranslator extends Translator, Examinable { /** * Gets the global translation source. * * @return the source * @since 4.0.0 */ static @NonNull GlobalTranslator get() { return GlobalTranslatorImpl.INSTANCE; } /** * Gets a renderer which uses the global source for translating. * * @return a renderer * @since 4.0.0 */ static @NonNull TranslatableComponentRenderer<Locale> renderer() { return GlobalTranslatorImpl.INSTANCE.renderer; } /** * Renders a component using the {@link #renderer() global renderer}. * * @param component the component to render * @param locale the locale to use when rendering * @return the rendered component * @since 4.0.0 */ static @NonNull Component render(final @NonNull Component component, final @NonNull Locale locale) { return renderer().render(component, locale); } /** * Gets the sources. * * @return the sources * @since 4.0.0 */ @NonNull Iterable<? extends Translator> sources(); /** * Adds a translation source. * * <p>Duplicate sources will be ignored.</p> * * @param source the source * @return {@code true} if registered, {@code false} otherwise * @throws IllegalArgumentException if source is {@link GlobalTranslator} * @since 4.0.0 */ boolean addSource(final @NonNull Translator source); /** * Removes a translation source. * * @param source the source to unregister * @return {@code true} if unregistered, {@code false} otherwise * @since 4.0.0 */ boolean removeSource(final @NonNull Translator source); }
3e05346ec51e5aa163d5395f901a40298c871b3b
6,417
java
Java
web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/agent/DataSourceChart.java
windy26205/pinpoint
fe99471106ba2c28cf7170e30632c95ef2644f3b
[ "Apache-2.0" ]
1,473
2020-10-14T02:18:07.000Z
2022-03-31T11:43:49.000Z
web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/agent/DataSourceChart.java
windy26205/pinpoint
fe99471106ba2c28cf7170e30632c95ef2644f3b
[ "Apache-2.0" ]
995
2020-10-14T05:09:43.000Z
2022-03-31T12:04:05.000Z
web/src/main/java/com/navercorp/pinpoint/web/vo/stat/chart/agent/DataSourceChart.java
windy26205/pinpoint
fe99471106ba2c28cf7170e30632c95ef2644f3b
[ "Apache-2.0" ]
446
2020-10-14T02:42:50.000Z
2022-03-31T03:03:53.000Z
40.10625
201
0.736637
2,184
/* * Copyright 2017 NAVER Corp. * * 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.navercorp.pinpoint.web.vo.stat.chart.agent; import com.google.common.collect.ImmutableMap; import com.navercorp.pinpoint.common.annotations.VisibleForTesting; import com.navercorp.pinpoint.loader.service.ServiceTypeRegistryService; import com.navercorp.pinpoint.rpc.util.ListUtils; import com.navercorp.pinpoint.web.util.TimeWindow; import com.navercorp.pinpoint.web.vo.chart.Chart; import com.navercorp.pinpoint.web.vo.chart.Point; import com.navercorp.pinpoint.web.vo.chart.TimeSeriesChartBuilder; import com.navercorp.pinpoint.web.vo.stat.SampledDataSource; import com.navercorp.pinpoint.web.vo.stat.chart.StatChart; import com.navercorp.pinpoint.web.vo.stat.chart.StatChartGroup; import org.apache.commons.collections4.CollectionUtils; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.function.Function; /** * @author Taejin Koo */ public class DataSourceChart implements StatChart { private final DataSourceChartGroup dataSourceChartGroup; public DataSourceChart(TimeWindow timeWindow, List<SampledDataSource> sampledDataSources, ServiceTypeRegistryService serviceTypeRegistryService) { this.dataSourceChartGroup = newDataSourceChartGroup(timeWindow, sampledDataSources, serviceTypeRegistryService); } @VisibleForTesting static DataSourceChartGroup newDataSourceChartGroup(TimeWindow timeWindow, List<SampledDataSource> sampledDataSources, ServiceTypeRegistryService serviceTypeRegistryService) { Objects.requireNonNull(timeWindow, "timeWindow"); Map<StatChartGroup.ChartType, Chart<? extends Point>> chartTypeChartMap = newDatasourceChart(timeWindow, sampledDataSources); if (CollectionUtils.isNotEmpty(sampledDataSources)) { SampledDataSource latestSampledDataSource = ListUtils.getLast(sampledDataSources); int id = latestSampledDataSource.getId(); String serviceTypeName = serviceTypeRegistryService.findServiceType(latestSampledDataSource.getServiceTypeCode()).getName(); String databaseName = latestSampledDataSource.getDatabaseName(); String jdbcUrl = latestSampledDataSource.getJdbcUrl(); return new DataSourceChartGroup(timeWindow, chartTypeChartMap, id, serviceTypeName, databaseName, jdbcUrl); } else { final Integer uncollectedValue = SampledDataSource.UNCOLLECTED_VALUE; // TODO avoid null final String uncollectedString = SampledDataSource.UNCOLLECTED_STRING; return new DataSourceChartGroup(timeWindow, chartTypeChartMap, uncollectedValue, uncollectedString, uncollectedString, uncollectedString); } } @Override public StatChartGroup getCharts() { return dataSourceChartGroup; } public int getId() { return dataSourceChartGroup.getId(); } public String getServiceType() { return dataSourceChartGroup.getServiceTypeName(); } public String getDatabaseName() { return dataSourceChartGroup.getDatabaseName(); } public String getJdbcUrl() { return dataSourceChartGroup.getJdbcUrl(); } @VisibleForTesting static Map<StatChartGroup.ChartType, Chart<? extends Point>> newDatasourceChart(TimeWindow timeWindow, List<SampledDataSource> sampledDataSourceList) { Chart<AgentStatPoint<Integer>> activeConnectionChart = newChart(timeWindow, sampledDataSourceList, SampledDataSource::getActiveConnectionSize); Chart<AgentStatPoint<Integer>> maxConnectionChart = newChart(timeWindow, sampledDataSourceList, SampledDataSource::getMaxConnectionSize); return ImmutableMap.of(DataSourceChartGroup.DataSourceChartType.ACTIVE_CONNECTION_SIZE, activeConnectionChart, DataSourceChartGroup.DataSourceChartType.MAX_CONNECTION_SIZE, maxConnectionChart); } @VisibleForTesting static Chart<AgentStatPoint<Integer>> newChart(TimeWindow timeWindow, List<SampledDataSource> sampledDataSourceList, Function<SampledDataSource, AgentStatPoint<Integer>> filter) { TimeSeriesChartBuilder<AgentStatPoint<Integer>> builder = new TimeSeriesChartBuilder<>(timeWindow, SampledDataSource.UNCOLLECTED_POINT_CREATOR); return builder.build(sampledDataSourceList, filter); } public static class DataSourceChartGroup implements StatChartGroup { private final TimeWindow timeWindow; private final Map<ChartType, Chart<? extends Point>> dataSourceCharts; private final int id; private final String serviceTypeName; private final String databaseName; private final String jdbcUrl; public enum DataSourceChartType implements AgentChartType { ACTIVE_CONNECTION_SIZE, MAX_CONNECTION_SIZE } public DataSourceChartGroup(TimeWindow timeWindow, Map<ChartType, Chart<? extends Point>> dataSourceCharts, int id, String serviceTypeName, String databaseName, String jdbcUrl) { this.timeWindow = Objects.requireNonNull(timeWindow, "timeWindow"); this.dataSourceCharts = dataSourceCharts; this.id = id; this.serviceTypeName = serviceTypeName; this.databaseName = databaseName; this.jdbcUrl = jdbcUrl; } @Override public TimeWindow getTimeWindow() { return timeWindow; } @Override public Map<ChartType, Chart<? extends Point>> getCharts() { return dataSourceCharts; } public int getId() { return id; } public String getServiceTypeName() { return serviceTypeName; } public String getDatabaseName() { return databaseName; } public String getJdbcUrl() { return jdbcUrl; } } }
3e0534a0cc0519194df23e6d11ced8c085138a31
3,847
java
Java
src/tools/LerLinhasArquivo.java
barcellosLuizFernando/DefaultTools
b033c7132c077a183013953f937fb82ebb1d043f
[ "MIT" ]
null
null
null
src/tools/LerLinhasArquivo.java
barcellosLuizFernando/DefaultTools
b033c7132c077a183013953f937fb82ebb1d043f
[ "MIT" ]
null
null
null
src/tools/LerLinhasArquivo.java
barcellosLuizFernando/DefaultTools
b033c7132c077a183013953f937fb82ebb1d043f
[ "MIT" ]
null
null
null
30.531746
147
0.553158
2,185
/* * 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 tools; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.Scanner; import javax.swing.JOptionPane; /** * * @author luiz.barcellos */ public class LerLinhasArquivo { private static final String TRES = "3"; private static final String CINCO = "5"; private String conteudo = ""; private ArrayList lista = new ArrayList(); /** * Método retorna o arquivo em String. Recebe o caminho do arquivo, abre e * converte em String. * * @param caminho * @return * @throws Exception */ public LerLinhasArquivo(String caminho) throws Exception { // método que lê o arquivo texto try { BufferedReader in = new BufferedReader(new FileReader(caminho)); String linha; while ((linha = in.readLine()) != null) { linha = linha.trim(); if (linha.length() > 3) { //System.out.println("Linha inteira " + linha); //System.out.println("Conteúdo: " + getCampo(linha, 0, 5)); //System.out.println("A ocorrencia " + TRES + " é da posição " + getPosicao(linha, TRES)); //System.out.println("A ocorrencia " + CINCO + " é da posição " + getPosicao(linha, CINCO)); conteudo += linha + "\n"; lista.add(linha); } } in.close(); System.out.println("Conteúdo do arquivo:\n" + conteudo); } catch (IOException e) { throw new IOException(e); } } public LerLinhasArquivo(String arquivo, String separador) { //abre um arquivo e cria um file File file = new File(arquivo); try { //cria um scanner para ler o arquivo Scanner leitor = new Scanner(file); //variavel que armazenara as linhas do arquivo String linhasDoArquivo = new String(); //ignora a primeira linha do arquivo leitor.nextLine(); while (leitor.hasNext()) { //recebe cada linha do arquivo linhasDoArquivo = leitor.nextLine(); System.out.println("Linhas: " + linhasDoArquivo); //separa os campos entre as virgulas de cada linha String[] valoresEntreVirgulas = linhasDoArquivo.split(separador); //imprime a coluna que quiser //System.out.println(valoresEntreVirgulas[0]); System.out.print("Registro 1: " + valoresEntreVirgulas[0]); System.out.println(". Registro 2: " + valoresEntreVirgulas[1]); } } catch (Exception e) { JOptionPane.showMessageDialog(null, "Erro ao importar arquivo:\n" + e.getMessage()); } } public static int getPosicao(String linha, String ocorrencia) { return linha.indexOf(ocorrencia) + 1; } public static String getCampo(String linha, int x, int y) { return linha.substring(x, y); } public ArrayList getLista() { return lista; } public String getConteudo() { return conteudo; } public static void main(String[] args) { LerLinhasArquivo ler = new LerLinhasArquivo("C:\\Users\\luiz.barcellos\\Google Drive\\Contabilidade\\PlanoContasAtividadeRural.txt",". "); } }
3e0536d5b785897d39ee08f364bccee587bf1c2c
2,399
java
Java
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PersonFormValidator.java
colorstheforce/uPortal
a885243f17450d401d89fd21785877cc0c8835f1
[ "Apache-2.0" ]
158
2015-01-02T22:04:11.000Z
2021-02-08T16:23:24.000Z
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PersonFormValidator.java
colorstheforce/uPortal
a885243f17450d401d89fd21785877cc0c8835f1
[ "Apache-2.0" ]
881
2015-01-02T13:21:56.000Z
2021-02-15T13:34:35.000Z
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PersonFormValidator.java
colorstheforce/uPortal
a885243f17450d401d89fd21785877cc0c8835f1
[ "Apache-2.0" ]
196
2015-01-02T09:38:24.000Z
2021-02-07T11:23:50.000Z
41.362069
99
0.63318
2,186
/** * Licensed to Apereo under one or more contributor license agreements. See the NOTICE file * distributed with this work for additional information regarding copyright ownership. Apereo * 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 the * following location: * * <p>http://www.apache.org/licenses/LICENSE-2.0 * * <p>Unless required by applicable law or agreed to in writing, software distributed under the * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing permissions and * limitations under the License. */ package org.apereo.portal.portlets.account; import org.apache.commons.lang.StringUtils; import org.apereo.portal.persondir.ILocalAccountDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.binding.message.MessageBuilder; import org.springframework.binding.message.MessageContext; public class PersonFormValidator { private ILocalAccountDao accountDao; @Autowired(required = true) public void setLocalAccountDao(ILocalAccountDao accountDao) { this.accountDao = accountDao; } public void validateEditLocalAccount(PersonForm person, MessageContext context) { // ensure that this username isn't already taken if (person.getId() < 0 && accountDao.getPerson(person.getUsername()) != null) { context.addMessage( new MessageBuilder() .error() .source("username") .code("username.in.use") .build()); } if (StringUtils.isNotBlank(person.getPassword()) || StringUtils.isNotBlank(person.getConfirmPassword())) { if (person.getPassword() == null || !person.getPassword().equals(person.getConfirmPassword())) { context.addMessage( new MessageBuilder() .error() .source("password") .code("passwords.must.match") .build()); } } } }
3e053768d625269aca6c5ab431e046b81595c054
408
java
Java
javayh-feign/src/main/java/com/javayh/JavayhFeignApplication.java
Dylan-haiji/javayh-cloud
8dc02b55e0d99fe5bbeb254a6107b3e4d94ed18d
[ "Apache-2.0" ]
17
2019-07-12T05:34:28.000Z
2020-04-20T09:04:22.000Z
javayh-feign/src/main/java/com/javayh/JavayhFeignApplication.java
Dylan-haiji/javayh-oauth2
8dc02b55e0d99fe5bbeb254a6107b3e4d94ed18d
[ "Apache-2.0" ]
2
2019-12-26T01:31:54.000Z
2020-04-27T05:38:55.000Z
javayh-feign/src/main/java/com/javayh/JavayhFeignApplication.java
Dylan-haiji/javayh-oauth2
8dc02b55e0d99fe5bbeb254a6107b3e4d94ed18d
[ "Apache-2.0" ]
9
2020-05-15T01:20:39.000Z
2021-06-26T12:42:15.000Z
25.5
68
0.813725
2,187
package com.javayh; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableFeignClients @SpringBootApplication public class JavayhFeignApplication { public static void main(String[] args) { SpringApplication.run(JavayhFeignApplication.class, args); } }
3e0537d593753418cf970fcc7784c17cb5720143
1,612
java
Java
gulimall-order/src/main/java/com/atguigu/gulimall/order/config/GuliFeignConfig.java
fangmachuan/gulimall
22b9ab6ad46ebc41db40c697e046ed13f97d9207
[ "Apache-2.0" ]
null
null
null
gulimall-order/src/main/java/com/atguigu/gulimall/order/config/GuliFeignConfig.java
fangmachuan/gulimall
22b9ab6ad46ebc41db40c697e046ed13f97d9207
[ "Apache-2.0" ]
null
null
null
gulimall-order/src/main/java/com/atguigu/gulimall/order/config/GuliFeignConfig.java
fangmachuan/gulimall
22b9ab6ad46ebc41db40c697e046ed13f97d9207
[ "Apache-2.0" ]
null
null
null
34.297872
124
0.654467
2,188
package com.atguigu.gulimall.order.config; import feign.RequestInterceptor; import feign.RequestTemplate; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; @Configuration public class GuliFeignConfig { /** * 解决Feign远程调用丢失请求体问题 * @return */ @Bean("requestInterceptor") public RequestInterceptor requestInterceptor(){ return new RequestInterceptor(){ /** * * @param template feign里面的新请求 */ @Override public void apply(RequestTemplate template) { //RequestContextHolder可以拿到刚进来的这个请求数据,也即调用我们controller下的请求方法当时的一些请求头信息 ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); if (attributes!=null){ HttpServletRequest request = attributes.getRequest();//获取到当前请求的对象,也即老请求 if (request != null){ //把获取到的请求对象的头信息都同步进来,主要同步cookie, String cookie = request.getHeader("Cookie"); ////给新请求同步了老请求的头信息,这样最终远程调用的时候, template.header("Cookie",cookie); System.out.println("feign远程之前先进行RequestInterceptor.apply()"); } } } }; } }
3e0538a1e949d56b0b024cd057e8b4ae2f6e08bf
5,756
java
Java
assertj-swing/src/main/java/org/assertj/swing/driver/JSplitPaneDriver.java
DaveBrad/assertj-swing
0d74888990c5124f6a2dee90e0d848da0125f0b2
[ "Apache-2.0" ]
70
2015-01-19T08:40:59.000Z
2020-06-20T12:59:57.000Z
assertj-swing/src/main/java/org/assertj/swing/driver/JSplitPaneDriver.java
DaveBrad/assertj-swing
0d74888990c5124f6a2dee90e0d848da0125f0b2
[ "Apache-2.0" ]
143
2015-01-04T01:43:55.000Z
2020-09-13T07:42:45.000Z
assertj-swing/src/main/java/org/assertj/swing/driver/JSplitPaneDriver.java
DaveBrad/assertj-swing
0d74888990c5124f6a2dee90e0d848da0125f0b2
[ "Apache-2.0" ]
47
2015-01-26T12:41:27.000Z
2020-08-27T13:39:13.000Z
38.891892
123
0.732453
2,189
/* * 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. * * Copyright 2012-2018 the original author or authors. */ package org.assertj.swing.driver; import static javax.swing.JSplitPane.VERTICAL_SPLIT; import static org.assertj.core.util.Preconditions.checkNotNull; import static org.assertj.swing.core.MouseButton.LEFT_BUTTON; import static org.assertj.swing.driver.ComponentPreconditions.checkEnabledAndShowing; import static org.assertj.swing.driver.JSplitPaneLocationCalculator.locationToMoveDividerTo; import static org.assertj.swing.driver.JSplitPaneSetDividerLocationTask.setDividerLocation; import static org.assertj.swing.edt.GuiActionRunner.execute; import java.awt.Point; import javax.annotation.Nonnull; import javax.swing.JSplitPane; import org.assertj.swing.annotation.RunsInCurrentThread; import org.assertj.swing.annotation.RunsInEDT; import org.assertj.swing.core.Robot; import org.assertj.swing.edt.GuiQuery; import org.assertj.swing.internal.annotation.InternalApi; import org.assertj.swing.util.GenericRange; /** * <p> * Supports functional testing of {@code JSplitPane}s. * </p> * * <p> * <b>Note:</b> This class is intended for internal use only. Please use the classes in the package * {@link org.assertj.swing.fixture} in your tests. * </p> * * @author Alex Ruiz * @author Yvonne Wang */ @InternalApi public class JSplitPaneDriver extends JComponentDriver { /** * Creates a new {@link JSplitPaneDriver}. * * @param robot the robot to use to simulate user input. */ public JSplitPaneDriver(@Nonnull Robot robot) { super(robot); } /** * Sets the divider position to an absolute position. * <p> * Since 1.2, this method respects the minimum and maximum values of the left and right components inside the given * {@code JSplitPane}. * </p> * * @param splitPane the target {@code JSplitPane}. * @param location the location to move the divider to. * @throws IllegalStateException if the {@code JSplitPane} is disabled. * @throws IllegalStateException if the {@code JSplitPane} is not showing on the screen. */ @RunsInEDT public void moveDividerTo(@Nonnull JSplitPane splitPane, int location) { int newLocation = locationToMoveDividerTo(splitPane, location); simulateMovingDivider(splitPane, newLocation); setDividerLocation(splitPane, newLocation); robot.waitForIdle(); } @RunsInEDT private void simulateMovingDivider(@Nonnull JSplitPane split, int location) { if (split.getOrientation() == VERTICAL_SPLIT) { simulateMovingDividerVertically(split, location); return; } simulateMovingDividerHorizontally(split, location); } @RunsInEDT private void simulateMovingDividerVertically(@Nonnull JSplitPane splitPane, int location) { GenericRange<Point> whereToMove = findWhereToMoveDividerVertically(splitPane, location); simulateMovingDivider(splitPane, whereToMove); } @RunsInEDT @Nonnull private static GenericRange<Point> findWhereToMoveDividerVertically(final @Nonnull JSplitPane splitPane, final int location) { GenericRange<Point> result = execute(new GuiQuery<GenericRange<Point>>() { @Override protected GenericRange<Point> executeInEDT() { checkEnabledAndShowing(splitPane); return whereToMoveDividerVertically(splitPane, location); } }); return checkNotNull(result); } @RunsInCurrentThread @Nonnull private static GenericRange<Point> whereToMoveDividerVertically(@Nonnull JSplitPane splitPane, int location) { int x = splitPane.getWidth() / 2; int dividerLocation = splitPane.getDividerLocation(); return new GenericRange<Point>(new Point(x, dividerLocation), new Point(x, location)); } private void simulateMovingDividerHorizontally(@Nonnull JSplitPane splitPane, int location) { GenericRange<Point> whereToMove = findWhereToMoveDividerHorizontally(splitPane, location); simulateMovingDivider(splitPane, whereToMove); } @RunsInEDT @Nonnull private static GenericRange<Point> findWhereToMoveDividerHorizontally(final @Nonnull JSplitPane splitPane, final int location) { GenericRange<Point> result = execute(new GuiQuery<GenericRange<Point>>() { @Override protected GenericRange<Point> executeInEDT() { checkEnabledAndShowing(splitPane); return whereToMoveDividerHorizontally(splitPane, location); } }); return checkNotNull(result); } @RunsInCurrentThread @Nonnull private static GenericRange<Point> whereToMoveDividerHorizontally(@Nonnull JSplitPane splitPane, int location) { int y = splitPane.getHeight() / 2; int dividerLocation = splitPane.getDividerLocation(); return new GenericRange<Point>(new Point(dividerLocation, y), new Point(location, y)); } @RunsInEDT private void simulateMovingDivider(@Nonnull JSplitPane splitPane, @Nonnull GenericRange<Point> range) { try { robot.moveMouse(splitPane, range.from()); robot.pressMouseWhileRunning(LEFT_BUTTON, () -> robot.moveMouse(splitPane, range.to())); } catch (RuntimeException ignored) { } } }
3e053ae839bd0552c6d2fed5e0a78a2ffe210bb0
219
java
Java
JavaBase/src/main/java/com/yjl/javabase/thinkinjava/reusing/Lisa.java
yangjunlin-const/WhileTrueCoding
db45d5739483acf664d653ca8047e33e8d012377
[ "Apache-2.0" ]
2
2015-12-18T01:56:00.000Z
2016-12-11T12:59:57.000Z
JavaBase/src/main/java/com/yjl/javabase/thinkinjava/reusing/Lisa.java
yangjunlin-const/WhileTrueCoding
db45d5739483acf664d653ca8047e33e8d012377
[ "Apache-2.0" ]
null
null
null
JavaBase/src/main/java/com/yjl/javabase/thinkinjava/reusing/Lisa.java
yangjunlin-const/WhileTrueCoding
db45d5739483acf664d653ca8047e33e8d012377
[ "Apache-2.0" ]
null
null
null
24.333333
66
0.6621
2,190
package com.yjl.javabase.thinkinjava.reusing;//: reusing/Lisa.java // {CompileTimeError} (Won't compile) class Lisa extends Homer { void doh(Milhouse m) { System.out.println("doh(Milhouse)"); } } ///:~
3e053b1c05937588fd3011e4abb875debae860f2
1,457
java
Java
src/main/java/com/readutf/mauth/bot/listeners/SyncMessageListener.java
readUTF/mAuth
1ada49c23ee0e1f950ba997c5b714a65d6b928b2
[ "MIT" ]
null
null
null
src/main/java/com/readutf/mauth/bot/listeners/SyncMessageListener.java
readUTF/mAuth
1ada49c23ee0e1f950ba997c5b714a65d6b928b2
[ "MIT" ]
null
null
null
src/main/java/com/readutf/mauth/bot/listeners/SyncMessageListener.java
readUTF/mAuth
1ada49c23ee0e1f950ba997c5b714a65d6b928b2
[ "MIT" ]
null
null
null
35.536585
97
0.697323
2,191
package com.readutf.mauth.bot.listeners; import com.cryptomorin.xseries.XSound; import com.readutf.mauth.commands.SyncCommand; import com.readutf.mauth.profile.Profile; import com.readutf.mauth.utils.SpigotUtils; import com.sun.corba.se.impl.orbutil.concurrent.Sync; import net.dv8tion.jda.api.events.message.guild.GuildMessageReceivedEvent; import net.dv8tion.jda.api.hooks.ListenerAdapter; import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.jetbrains.annotations.NotNull; public class SyncMessageListener extends ListenerAdapter { @Override public void onGuildMessageReceived(@NotNull GuildMessageReceivedEvent e) { if(!e.getChannel().getName().equalsIgnoreCase("sync-account")) { return; } e.getMessage().delete().queue(); String code = e.getMessage().getContentRaw(); if(SyncCommand.getSyncKeys().keySet().stream().anyMatch(s -> s.equalsIgnoreCase(code))) { Profile profile = SyncCommand.getSyncKeys().get(code); profile.setDiscordId(e.getMessage().getAuthor().getId()); profile.save(); Player player = profile.getPlayer(); if(player != null) { player.sendMessage(SpigotUtils.color("&aYour account was synced successfully.")); XSound.ENTITY_ARROW_HIT_PLAYER.play(player); } } } }
3e053b35642bd7d89bad6ce123651a14a0c109f0
41,932
java
Java
src/main/java/POGOProtos/Rpc/ParticipationProto.java
celandro/pogoprotos-java
af129776faf08bfbfc69b32e19e8293bff2e8991
[ "BSD-3-Clause" ]
6
2019-07-08T10:29:18.000Z
2020-10-18T20:27:03.000Z
src/main/java/POGOProtos/Rpc/ParticipationProto.java
pokemongo-dev-contrib/pogoprotos-java
af129776faf08bfbfc69b32e19e8293bff2e8991
[ "BSD-3-Clause" ]
4
2018-07-22T19:44:39.000Z
2018-11-17T14:56:13.000Z
src/main/java/POGOProtos/Rpc/ParticipationProto.java
celandro/pogoprotos-java
af129776faf08bfbfc69b32e19e8293bff2e8991
[ "BSD-3-Clause" ]
1
2017-03-29T09:34:17.000Z
2017-03-29T09:34:17.000Z
32.430008
132
0.682557
2,192
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: POGOProtos.Rpc.proto package POGOProtos.Rpc; /** * Protobuf type {@code POGOProtos.Rpc.ParticipationProto} */ public final class ParticipationProto extends com.google.protobuf.GeneratedMessageV3 implements // @@protoc_insertion_point(message_implements:POGOProtos.Rpc.ParticipationProto) ParticipationProtoOrBuilder { private static final long serialVersionUID = 0L; // Use ParticipationProto.newBuilder() to construct. private ParticipationProto(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { super(builder); } private ParticipationProto() { highestFriendshipMilestone_ = 0; } @java.lang.Override @SuppressWarnings({"unused"}) protected java.lang.Object newInstance( UnusedPrivateParameter unused) { return new ParticipationProto(); } @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ParticipationProto( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { this(); if (extensionRegistry == null) { throw new java.lang.NullPointerException(); } com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; case 8: { individualDamagePokeballs_ = input.readInt32(); break; } case 16: { teamDamagePokeballs_ = input.readInt32(); break; } case 24: { gymOwnershipPokeballs_ = input.readInt32(); break; } case 32: { basePokeballs_ = input.readInt32(); break; } case 41: { bluePercentage_ = input.readDouble(); break; } case 49: { redPercentage_ = input.readDouble(); break; } case 57: { yellowPercentage_ = input.readDouble(); break; } case 69: { bonusItemMultiplier_ = input.readFloat(); break; } case 72: { int rawValue = input.readEnum(); highestFriendshipMilestone_ = rawValue; break; } case 80: { highestFriendshipPokeballs_ = input.readInt32(); break; } case 88: { speedCompletionPokeballs_ = input.readInt32(); break; } case 96: { speedCompletionMegaResource_ = input.readInt32(); break; } case 104: { megaResourceCapped_ = input.readBool(); break; } default: { if (!parseUnknownField( input, unknownFields, extensionRegistry, tag)) { done = true; } break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_ParticipationProto_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_ParticipationProto_fieldAccessorTable .ensureFieldAccessorsInitialized( POGOProtos.Rpc.ParticipationProto.class, POGOProtos.Rpc.ParticipationProto.Builder.class); } public static final int INDIVIDUAL_DAMAGE_POKEBALLS_FIELD_NUMBER = 1; private int individualDamagePokeballs_; /** * <code>int32 individual_damage_pokeballs = 1;</code> * @return The individualDamagePokeballs. */ @java.lang.Override public int getIndividualDamagePokeballs() { return individualDamagePokeballs_; } public static final int TEAM_DAMAGE_POKEBALLS_FIELD_NUMBER = 2; private int teamDamagePokeballs_; /** * <code>int32 team_damage_pokeballs = 2;</code> * @return The teamDamagePokeballs. */ @java.lang.Override public int getTeamDamagePokeballs() { return teamDamagePokeballs_; } public static final int GYM_OWNERSHIP_POKEBALLS_FIELD_NUMBER = 3; private int gymOwnershipPokeballs_; /** * <code>int32 gym_ownership_pokeballs = 3;</code> * @return The gymOwnershipPokeballs. */ @java.lang.Override public int getGymOwnershipPokeballs() { return gymOwnershipPokeballs_; } public static final int BASE_POKEBALLS_FIELD_NUMBER = 4; private int basePokeballs_; /** * <code>int32 base_pokeballs = 4;</code> * @return The basePokeballs. */ @java.lang.Override public int getBasePokeballs() { return basePokeballs_; } public static final int BLUE_PERCENTAGE_FIELD_NUMBER = 5; private double bluePercentage_; /** * <code>double blue_percentage = 5;</code> * @return The bluePercentage. */ @java.lang.Override public double getBluePercentage() { return bluePercentage_; } public static final int RED_PERCENTAGE_FIELD_NUMBER = 6; private double redPercentage_; /** * <code>double red_percentage = 6;</code> * @return The redPercentage. */ @java.lang.Override public double getRedPercentage() { return redPercentage_; } public static final int YELLOW_PERCENTAGE_FIELD_NUMBER = 7; private double yellowPercentage_; /** * <code>double yellow_percentage = 7;</code> * @return The yellowPercentage. */ @java.lang.Override public double getYellowPercentage() { return yellowPercentage_; } public static final int BONUS_ITEM_MULTIPLIER_FIELD_NUMBER = 8; private float bonusItemMultiplier_; /** * <code>float bonus_item_multiplier = 8;</code> * @return The bonusItemMultiplier. */ @java.lang.Override public float getBonusItemMultiplier() { return bonusItemMultiplier_; } public static final int HIGHEST_FRIENDSHIP_MILESTONE_FIELD_NUMBER = 9; private int highestFriendshipMilestone_; /** * <code>.POGOProtos.Rpc.FriendshipLevelMilestone highest_friendship_milestone = 9;</code> * @return The enum numeric value on the wire for highestFriendshipMilestone. */ @java.lang.Override public int getHighestFriendshipMilestoneValue() { return highestFriendshipMilestone_; } /** * <code>.POGOProtos.Rpc.FriendshipLevelMilestone highest_friendship_milestone = 9;</code> * @return The highestFriendshipMilestone. */ @java.lang.Override public POGOProtos.Rpc.FriendshipLevelMilestone getHighestFriendshipMilestone() { @SuppressWarnings("deprecation") POGOProtos.Rpc.FriendshipLevelMilestone result = POGOProtos.Rpc.FriendshipLevelMilestone.valueOf(highestFriendshipMilestone_); return result == null ? POGOProtos.Rpc.FriendshipLevelMilestone.UNRECOGNIZED : result; } public static final int HIGHEST_FRIENDSHIP_POKEBALLS_FIELD_NUMBER = 10; private int highestFriendshipPokeballs_; /** * <code>int32 highest_friendship_pokeballs = 10;</code> * @return The highestFriendshipPokeballs. */ @java.lang.Override public int getHighestFriendshipPokeballs() { return highestFriendshipPokeballs_; } public static final int SPEED_COMPLETION_POKEBALLS_FIELD_NUMBER = 11; private int speedCompletionPokeballs_; /** * <code>int32 speed_completion_pokeballs = 11;</code> * @return The speedCompletionPokeballs. */ @java.lang.Override public int getSpeedCompletionPokeballs() { return speedCompletionPokeballs_; } public static final int SPEED_COMPLETION_MEGA_RESOURCE_FIELD_NUMBER = 12; private int speedCompletionMegaResource_; /** * <code>int32 speed_completion_mega_resource = 12;</code> * @return The speedCompletionMegaResource. */ @java.lang.Override public int getSpeedCompletionMegaResource() { return speedCompletionMegaResource_; } public static final int MEGA_RESOURCE_CAPPED_FIELD_NUMBER = 13; private boolean megaResourceCapped_; /** * <code>bool mega_resource_capped = 13;</code> * @return The megaResourceCapped. */ @java.lang.Override public boolean getMegaResourceCapped() { return megaResourceCapped_; } private byte memoizedIsInitialized = -1; @java.lang.Override public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized == 1) return true; if (isInitialized == 0) return false; memoizedIsInitialized = 1; return true; } @java.lang.Override public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { if (individualDamagePokeballs_ != 0) { output.writeInt32(1, individualDamagePokeballs_); } if (teamDamagePokeballs_ != 0) { output.writeInt32(2, teamDamagePokeballs_); } if (gymOwnershipPokeballs_ != 0) { output.writeInt32(3, gymOwnershipPokeballs_); } if (basePokeballs_ != 0) { output.writeInt32(4, basePokeballs_); } if (bluePercentage_ != 0D) { output.writeDouble(5, bluePercentage_); } if (redPercentage_ != 0D) { output.writeDouble(6, redPercentage_); } if (yellowPercentage_ != 0D) { output.writeDouble(7, yellowPercentage_); } if (bonusItemMultiplier_ != 0F) { output.writeFloat(8, bonusItemMultiplier_); } if (highestFriendshipMilestone_ != POGOProtos.Rpc.FriendshipLevelMilestone.FRIENDSHIP_LEVEL_UNSET.getNumber()) { output.writeEnum(9, highestFriendshipMilestone_); } if (highestFriendshipPokeballs_ != 0) { output.writeInt32(10, highestFriendshipPokeballs_); } if (speedCompletionPokeballs_ != 0) { output.writeInt32(11, speedCompletionPokeballs_); } if (speedCompletionMegaResource_ != 0) { output.writeInt32(12, speedCompletionMegaResource_); } if (megaResourceCapped_ != false) { output.writeBool(13, megaResourceCapped_); } unknownFields.writeTo(output); } @java.lang.Override public int getSerializedSize() { int size = memoizedSize; if (size != -1) return size; size = 0; if (individualDamagePokeballs_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, individualDamagePokeballs_); } if (teamDamagePokeballs_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, teamDamagePokeballs_); } if (gymOwnershipPokeballs_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, gymOwnershipPokeballs_); } if (basePokeballs_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, basePokeballs_); } if (bluePercentage_ != 0D) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(5, bluePercentage_); } if (redPercentage_ != 0D) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(6, redPercentage_); } if (yellowPercentage_ != 0D) { size += com.google.protobuf.CodedOutputStream .computeDoubleSize(7, yellowPercentage_); } if (bonusItemMultiplier_ != 0F) { size += com.google.protobuf.CodedOutputStream .computeFloatSize(8, bonusItemMultiplier_); } if (highestFriendshipMilestone_ != POGOProtos.Rpc.FriendshipLevelMilestone.FRIENDSHIP_LEVEL_UNSET.getNumber()) { size += com.google.protobuf.CodedOutputStream .computeEnumSize(9, highestFriendshipMilestone_); } if (highestFriendshipPokeballs_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(10, highestFriendshipPokeballs_); } if (speedCompletionPokeballs_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(11, speedCompletionPokeballs_); } if (speedCompletionMegaResource_ != 0) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(12, speedCompletionMegaResource_); } if (megaResourceCapped_ != false) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(13, megaResourceCapped_); } size += unknownFields.getSerializedSize(); memoizedSize = size; return size; } @java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof POGOProtos.Rpc.ParticipationProto)) { return super.equals(obj); } POGOProtos.Rpc.ParticipationProto other = (POGOProtos.Rpc.ParticipationProto) obj; if (getIndividualDamagePokeballs() != other.getIndividualDamagePokeballs()) return false; if (getTeamDamagePokeballs() != other.getTeamDamagePokeballs()) return false; if (getGymOwnershipPokeballs() != other.getGymOwnershipPokeballs()) return false; if (getBasePokeballs() != other.getBasePokeballs()) return false; if (java.lang.Double.doubleToLongBits(getBluePercentage()) != java.lang.Double.doubleToLongBits( other.getBluePercentage())) return false; if (java.lang.Double.doubleToLongBits(getRedPercentage()) != java.lang.Double.doubleToLongBits( other.getRedPercentage())) return false; if (java.lang.Double.doubleToLongBits(getYellowPercentage()) != java.lang.Double.doubleToLongBits( other.getYellowPercentage())) return false; if (java.lang.Float.floatToIntBits(getBonusItemMultiplier()) != java.lang.Float.floatToIntBits( other.getBonusItemMultiplier())) return false; if (highestFriendshipMilestone_ != other.highestFriendshipMilestone_) return false; if (getHighestFriendshipPokeballs() != other.getHighestFriendshipPokeballs()) return false; if (getSpeedCompletionPokeballs() != other.getSpeedCompletionPokeballs()) return false; if (getSpeedCompletionMegaResource() != other.getSpeedCompletionMegaResource()) return false; if (getMegaResourceCapped() != other.getMegaResourceCapped()) return false; if (!unknownFields.equals(other.unknownFields)) return false; return true; } @java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + INDIVIDUAL_DAMAGE_POKEBALLS_FIELD_NUMBER; hash = (53 * hash) + getIndividualDamagePokeballs(); hash = (37 * hash) + TEAM_DAMAGE_POKEBALLS_FIELD_NUMBER; hash = (53 * hash) + getTeamDamagePokeballs(); hash = (37 * hash) + GYM_OWNERSHIP_POKEBALLS_FIELD_NUMBER; hash = (53 * hash) + getGymOwnershipPokeballs(); hash = (37 * hash) + BASE_POKEBALLS_FIELD_NUMBER; hash = (53 * hash) + getBasePokeballs(); hash = (37 * hash) + BLUE_PERCENTAGE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( java.lang.Double.doubleToLongBits(getBluePercentage())); hash = (37 * hash) + RED_PERCENTAGE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( java.lang.Double.doubleToLongBits(getRedPercentage())); hash = (37 * hash) + YELLOW_PERCENTAGE_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashLong( java.lang.Double.doubleToLongBits(getYellowPercentage())); hash = (37 * hash) + BONUS_ITEM_MULTIPLIER_FIELD_NUMBER; hash = (53 * hash) + java.lang.Float.floatToIntBits( getBonusItemMultiplier()); hash = (37 * hash) + HIGHEST_FRIENDSHIP_MILESTONE_FIELD_NUMBER; hash = (53 * hash) + highestFriendshipMilestone_; hash = (37 * hash) + HIGHEST_FRIENDSHIP_POKEBALLS_FIELD_NUMBER; hash = (53 * hash) + getHighestFriendshipPokeballs(); hash = (37 * hash) + SPEED_COMPLETION_POKEBALLS_FIELD_NUMBER; hash = (53 * hash) + getSpeedCompletionPokeballs(); hash = (37 * hash) + SPEED_COMPLETION_MEGA_RESOURCE_FIELD_NUMBER; hash = (53 * hash) + getSpeedCompletionMegaResource(); hash = (37 * hash) + MEGA_RESOURCE_CAPPED_FIELD_NUMBER; hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean( getMegaResourceCapped()); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; } public static POGOProtos.Rpc.ParticipationProto parseFrom( java.nio.ByteBuffer data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static POGOProtos.Rpc.ParticipationProto parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static POGOProtos.Rpc.ParticipationProto parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static POGOProtos.Rpc.ParticipationProto parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static POGOProtos.Rpc.ParticipationProto parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static POGOProtos.Rpc.ParticipationProto parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static POGOProtos.Rpc.ParticipationProto parseFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static POGOProtos.Rpc.ParticipationProto parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } public static POGOProtos.Rpc.ParticipationProto parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input); } public static POGOProtos.Rpc.ParticipationProto parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseDelimitedWithIOException(PARSER, input, extensionRegistry); } public static POGOProtos.Rpc.ParticipationProto parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input); } public static POGOProtos.Rpc.ParticipationProto parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return com.google.protobuf.GeneratedMessageV3 .parseWithIOException(PARSER, input, extensionRegistry); } @java.lang.Override public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } public static Builder newBuilder(POGOProtos.Rpc.ParticipationProto prototype) { return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); } @java.lang.Override public Builder toBuilder() { return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code POGOProtos.Rpc.ParticipationProto} */ public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements // @@protoc_insertion_point(builder_implements:POGOProtos.Rpc.ParticipationProto) POGOProtos.Rpc.ParticipationProtoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_ParticipationProto_descriptor; } @java.lang.Override protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable() { return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_ParticipationProto_fieldAccessorTable .ensureFieldAccessorsInitialized( POGOProtos.Rpc.ParticipationProto.class, POGOProtos.Rpc.ParticipationProto.Builder.class); } // Construct using POGOProtos.Rpc.ParticipationProto.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessageV3 .alwaysUseFieldBuilders) { } } @java.lang.Override public Builder clear() { super.clear(); individualDamagePokeballs_ = 0; teamDamagePokeballs_ = 0; gymOwnershipPokeballs_ = 0; basePokeballs_ = 0; bluePercentage_ = 0D; redPercentage_ = 0D; yellowPercentage_ = 0D; bonusItemMultiplier_ = 0F; highestFriendshipMilestone_ = 0; highestFriendshipPokeballs_ = 0; speedCompletionPokeballs_ = 0; speedCompletionMegaResource_ = 0; megaResourceCapped_ = false; return this; } @java.lang.Override public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return POGOProtos.Rpc.POGOProtosRpc.internal_static_POGOProtos_Rpc_ParticipationProto_descriptor; } @java.lang.Override public POGOProtos.Rpc.ParticipationProto getDefaultInstanceForType() { return POGOProtos.Rpc.ParticipationProto.getDefaultInstance(); } @java.lang.Override public POGOProtos.Rpc.ParticipationProto build() { POGOProtos.Rpc.ParticipationProto result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } @java.lang.Override public POGOProtos.Rpc.ParticipationProto buildPartial() { POGOProtos.Rpc.ParticipationProto result = new POGOProtos.Rpc.ParticipationProto(this); result.individualDamagePokeballs_ = individualDamagePokeballs_; result.teamDamagePokeballs_ = teamDamagePokeballs_; result.gymOwnershipPokeballs_ = gymOwnershipPokeballs_; result.basePokeballs_ = basePokeballs_; result.bluePercentage_ = bluePercentage_; result.redPercentage_ = redPercentage_; result.yellowPercentage_ = yellowPercentage_; result.bonusItemMultiplier_ = bonusItemMultiplier_; result.highestFriendshipMilestone_ = highestFriendshipMilestone_; result.highestFriendshipPokeballs_ = highestFriendshipPokeballs_; result.speedCompletionPokeballs_ = speedCompletionPokeballs_; result.speedCompletionMegaResource_ = speedCompletionMegaResource_; result.megaResourceCapped_ = megaResourceCapped_; onBuilt(); return result; } @java.lang.Override public Builder clone() { return super.clone(); } @java.lang.Override public Builder setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.setField(field, value); } @java.lang.Override public Builder clearField( com.google.protobuf.Descriptors.FieldDescriptor field) { return super.clearField(field); } @java.lang.Override public Builder clearOneof( com.google.protobuf.Descriptors.OneofDescriptor oneof) { return super.clearOneof(oneof); } @java.lang.Override public Builder setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { return super.setRepeatedField(field, index, value); } @java.lang.Override public Builder addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { return super.addRepeatedField(field, value); } @java.lang.Override public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof POGOProtos.Rpc.ParticipationProto) { return mergeFrom((POGOProtos.Rpc.ParticipationProto)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(POGOProtos.Rpc.ParticipationProto other) { if (other == POGOProtos.Rpc.ParticipationProto.getDefaultInstance()) return this; if (other.getIndividualDamagePokeballs() != 0) { setIndividualDamagePokeballs(other.getIndividualDamagePokeballs()); } if (other.getTeamDamagePokeballs() != 0) { setTeamDamagePokeballs(other.getTeamDamagePokeballs()); } if (other.getGymOwnershipPokeballs() != 0) { setGymOwnershipPokeballs(other.getGymOwnershipPokeballs()); } if (other.getBasePokeballs() != 0) { setBasePokeballs(other.getBasePokeballs()); } if (other.getBluePercentage() != 0D) { setBluePercentage(other.getBluePercentage()); } if (other.getRedPercentage() != 0D) { setRedPercentage(other.getRedPercentage()); } if (other.getYellowPercentage() != 0D) { setYellowPercentage(other.getYellowPercentage()); } if (other.getBonusItemMultiplier() != 0F) { setBonusItemMultiplier(other.getBonusItemMultiplier()); } if (other.highestFriendshipMilestone_ != 0) { setHighestFriendshipMilestoneValue(other.getHighestFriendshipMilestoneValue()); } if (other.getHighestFriendshipPokeballs() != 0) { setHighestFriendshipPokeballs(other.getHighestFriendshipPokeballs()); } if (other.getSpeedCompletionPokeballs() != 0) { setSpeedCompletionPokeballs(other.getSpeedCompletionPokeballs()); } if (other.getSpeedCompletionMegaResource() != 0) { setSpeedCompletionMegaResource(other.getSpeedCompletionMegaResource()); } if (other.getMegaResourceCapped() != false) { setMegaResourceCapped(other.getMegaResourceCapped()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; } @java.lang.Override public final boolean isInitialized() { return true; } @java.lang.Override public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { POGOProtos.Rpc.ParticipationProto parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (POGOProtos.Rpc.ParticipationProto) e.getUnfinishedMessage(); throw e.unwrapIOException(); } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int individualDamagePokeballs_ ; /** * <code>int32 individual_damage_pokeballs = 1;</code> * @return The individualDamagePokeballs. */ @java.lang.Override public int getIndividualDamagePokeballs() { return individualDamagePokeballs_; } /** * <code>int32 individual_damage_pokeballs = 1;</code> * @param value The individualDamagePokeballs to set. * @return This builder for chaining. */ public Builder setIndividualDamagePokeballs(int value) { individualDamagePokeballs_ = value; onChanged(); return this; } /** * <code>int32 individual_damage_pokeballs = 1;</code> * @return This builder for chaining. */ public Builder clearIndividualDamagePokeballs() { individualDamagePokeballs_ = 0; onChanged(); return this; } private int teamDamagePokeballs_ ; /** * <code>int32 team_damage_pokeballs = 2;</code> * @return The teamDamagePokeballs. */ @java.lang.Override public int getTeamDamagePokeballs() { return teamDamagePokeballs_; } /** * <code>int32 team_damage_pokeballs = 2;</code> * @param value The teamDamagePokeballs to set. * @return This builder for chaining. */ public Builder setTeamDamagePokeballs(int value) { teamDamagePokeballs_ = value; onChanged(); return this; } /** * <code>int32 team_damage_pokeballs = 2;</code> * @return This builder for chaining. */ public Builder clearTeamDamagePokeballs() { teamDamagePokeballs_ = 0; onChanged(); return this; } private int gymOwnershipPokeballs_ ; /** * <code>int32 gym_ownership_pokeballs = 3;</code> * @return The gymOwnershipPokeballs. */ @java.lang.Override public int getGymOwnershipPokeballs() { return gymOwnershipPokeballs_; } /** * <code>int32 gym_ownership_pokeballs = 3;</code> * @param value The gymOwnershipPokeballs to set. * @return This builder for chaining. */ public Builder setGymOwnershipPokeballs(int value) { gymOwnershipPokeballs_ = value; onChanged(); return this; } /** * <code>int32 gym_ownership_pokeballs = 3;</code> * @return This builder for chaining. */ public Builder clearGymOwnershipPokeballs() { gymOwnershipPokeballs_ = 0; onChanged(); return this; } private int basePokeballs_ ; /** * <code>int32 base_pokeballs = 4;</code> * @return The basePokeballs. */ @java.lang.Override public int getBasePokeballs() { return basePokeballs_; } /** * <code>int32 base_pokeballs = 4;</code> * @param value The basePokeballs to set. * @return This builder for chaining. */ public Builder setBasePokeballs(int value) { basePokeballs_ = value; onChanged(); return this; } /** * <code>int32 base_pokeballs = 4;</code> * @return This builder for chaining. */ public Builder clearBasePokeballs() { basePokeballs_ = 0; onChanged(); return this; } private double bluePercentage_ ; /** * <code>double blue_percentage = 5;</code> * @return The bluePercentage. */ @java.lang.Override public double getBluePercentage() { return bluePercentage_; } /** * <code>double blue_percentage = 5;</code> * @param value The bluePercentage to set. * @return This builder for chaining. */ public Builder setBluePercentage(double value) { bluePercentage_ = value; onChanged(); return this; } /** * <code>double blue_percentage = 5;</code> * @return This builder for chaining. */ public Builder clearBluePercentage() { bluePercentage_ = 0D; onChanged(); return this; } private double redPercentage_ ; /** * <code>double red_percentage = 6;</code> * @return The redPercentage. */ @java.lang.Override public double getRedPercentage() { return redPercentage_; } /** * <code>double red_percentage = 6;</code> * @param value The redPercentage to set. * @return This builder for chaining. */ public Builder setRedPercentage(double value) { redPercentage_ = value; onChanged(); return this; } /** * <code>double red_percentage = 6;</code> * @return This builder for chaining. */ public Builder clearRedPercentage() { redPercentage_ = 0D; onChanged(); return this; } private double yellowPercentage_ ; /** * <code>double yellow_percentage = 7;</code> * @return The yellowPercentage. */ @java.lang.Override public double getYellowPercentage() { return yellowPercentage_; } /** * <code>double yellow_percentage = 7;</code> * @param value The yellowPercentage to set. * @return This builder for chaining. */ public Builder setYellowPercentage(double value) { yellowPercentage_ = value; onChanged(); return this; } /** * <code>double yellow_percentage = 7;</code> * @return This builder for chaining. */ public Builder clearYellowPercentage() { yellowPercentage_ = 0D; onChanged(); return this; } private float bonusItemMultiplier_ ; /** * <code>float bonus_item_multiplier = 8;</code> * @return The bonusItemMultiplier. */ @java.lang.Override public float getBonusItemMultiplier() { return bonusItemMultiplier_; } /** * <code>float bonus_item_multiplier = 8;</code> * @param value The bonusItemMultiplier to set. * @return This builder for chaining. */ public Builder setBonusItemMultiplier(float value) { bonusItemMultiplier_ = value; onChanged(); return this; } /** * <code>float bonus_item_multiplier = 8;</code> * @return This builder for chaining. */ public Builder clearBonusItemMultiplier() { bonusItemMultiplier_ = 0F; onChanged(); return this; } private int highestFriendshipMilestone_ = 0; /** * <code>.POGOProtos.Rpc.FriendshipLevelMilestone highest_friendship_milestone = 9;</code> * @return The enum numeric value on the wire for highestFriendshipMilestone. */ @java.lang.Override public int getHighestFriendshipMilestoneValue() { return highestFriendshipMilestone_; } /** * <code>.POGOProtos.Rpc.FriendshipLevelMilestone highest_friendship_milestone = 9;</code> * @param value The enum numeric value on the wire for highestFriendshipMilestone to set. * @return This builder for chaining. */ public Builder setHighestFriendshipMilestoneValue(int value) { highestFriendshipMilestone_ = value; onChanged(); return this; } /** * <code>.POGOProtos.Rpc.FriendshipLevelMilestone highest_friendship_milestone = 9;</code> * @return The highestFriendshipMilestone. */ @java.lang.Override public POGOProtos.Rpc.FriendshipLevelMilestone getHighestFriendshipMilestone() { @SuppressWarnings("deprecation") POGOProtos.Rpc.FriendshipLevelMilestone result = POGOProtos.Rpc.FriendshipLevelMilestone.valueOf(highestFriendshipMilestone_); return result == null ? POGOProtos.Rpc.FriendshipLevelMilestone.UNRECOGNIZED : result; } /** * <code>.POGOProtos.Rpc.FriendshipLevelMilestone highest_friendship_milestone = 9;</code> * @param value The highestFriendshipMilestone to set. * @return This builder for chaining. */ public Builder setHighestFriendshipMilestone(POGOProtos.Rpc.FriendshipLevelMilestone value) { if (value == null) { throw new NullPointerException(); } highestFriendshipMilestone_ = value.getNumber(); onChanged(); return this; } /** * <code>.POGOProtos.Rpc.FriendshipLevelMilestone highest_friendship_milestone = 9;</code> * @return This builder for chaining. */ public Builder clearHighestFriendshipMilestone() { highestFriendshipMilestone_ = 0; onChanged(); return this; } private int highestFriendshipPokeballs_ ; /** * <code>int32 highest_friendship_pokeballs = 10;</code> * @return The highestFriendshipPokeballs. */ @java.lang.Override public int getHighestFriendshipPokeballs() { return highestFriendshipPokeballs_; } /** * <code>int32 highest_friendship_pokeballs = 10;</code> * @param value The highestFriendshipPokeballs to set. * @return This builder for chaining. */ public Builder setHighestFriendshipPokeballs(int value) { highestFriendshipPokeballs_ = value; onChanged(); return this; } /** * <code>int32 highest_friendship_pokeballs = 10;</code> * @return This builder for chaining. */ public Builder clearHighestFriendshipPokeballs() { highestFriendshipPokeballs_ = 0; onChanged(); return this; } private int speedCompletionPokeballs_ ; /** * <code>int32 speed_completion_pokeballs = 11;</code> * @return The speedCompletionPokeballs. */ @java.lang.Override public int getSpeedCompletionPokeballs() { return speedCompletionPokeballs_; } /** * <code>int32 speed_completion_pokeballs = 11;</code> * @param value The speedCompletionPokeballs to set. * @return This builder for chaining. */ public Builder setSpeedCompletionPokeballs(int value) { speedCompletionPokeballs_ = value; onChanged(); return this; } /** * <code>int32 speed_completion_pokeballs = 11;</code> * @return This builder for chaining. */ public Builder clearSpeedCompletionPokeballs() { speedCompletionPokeballs_ = 0; onChanged(); return this; } private int speedCompletionMegaResource_ ; /** * <code>int32 speed_completion_mega_resource = 12;</code> * @return The speedCompletionMegaResource. */ @java.lang.Override public int getSpeedCompletionMegaResource() { return speedCompletionMegaResource_; } /** * <code>int32 speed_completion_mega_resource = 12;</code> * @param value The speedCompletionMegaResource to set. * @return This builder for chaining. */ public Builder setSpeedCompletionMegaResource(int value) { speedCompletionMegaResource_ = value; onChanged(); return this; } /** * <code>int32 speed_completion_mega_resource = 12;</code> * @return This builder for chaining. */ public Builder clearSpeedCompletionMegaResource() { speedCompletionMegaResource_ = 0; onChanged(); return this; } private boolean megaResourceCapped_ ; /** * <code>bool mega_resource_capped = 13;</code> * @return The megaResourceCapped. */ @java.lang.Override public boolean getMegaResourceCapped() { return megaResourceCapped_; } /** * <code>bool mega_resource_capped = 13;</code> * @param value The megaResourceCapped to set. * @return This builder for chaining. */ public Builder setMegaResourceCapped(boolean value) { megaResourceCapped_ = value; onChanged(); return this; } /** * <code>bool mega_resource_capped = 13;</code> * @return This builder for chaining. */ public Builder clearMegaResourceCapped() { megaResourceCapped_ = false; onChanged(); return this; } @java.lang.Override public final Builder setUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.setUnknownFields(unknownFields); } @java.lang.Override public final Builder mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields) { return super.mergeUnknownFields(unknownFields); } // @@protoc_insertion_point(builder_scope:POGOProtos.Rpc.ParticipationProto) } // @@protoc_insertion_point(class_scope:POGOProtos.Rpc.ParticipationProto) private static final POGOProtos.Rpc.ParticipationProto DEFAULT_INSTANCE; static { DEFAULT_INSTANCE = new POGOProtos.Rpc.ParticipationProto(); } public static POGOProtos.Rpc.ParticipationProto getDefaultInstance() { return DEFAULT_INSTANCE; } private static final com.google.protobuf.Parser<ParticipationProto> PARSER = new com.google.protobuf.AbstractParser<ParticipationProto>() { @java.lang.Override public ParticipationProto parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ParticipationProto(input, extensionRegistry); } }; public static com.google.protobuf.Parser<ParticipationProto> parser() { return PARSER; } @java.lang.Override public com.google.protobuf.Parser<ParticipationProto> getParserForType() { return PARSER; } @java.lang.Override public POGOProtos.Rpc.ParticipationProto getDefaultInstanceForType() { return DEFAULT_INSTANCE; } }
3e053b43af247d03177a6008741261473c87f627
1,457
java
Java
app/src/main/java/es/ujaen/rlc00008/gnbwallet/data/source/memory/SessionData.java
Ricardo-Lechuga/gnb-wallet
aca81db6bf4df14e603da91205c16ecee7f84900
[ "Apache-2.0" ]
2
2016-06-16T11:20:34.000Z
2016-06-23T09:32:41.000Z
app/src/main/java/es/ujaen/rlc00008/gnbwallet/data/source/memory/SessionData.java
Ricardo-Lechuga/gnb-wallet
aca81db6bf4df14e603da91205c16ecee7f84900
[ "Apache-2.0" ]
null
null
null
app/src/main/java/es/ujaen/rlc00008/gnbwallet/data/source/memory/SessionData.java
Ricardo-Lechuga/gnb-wallet
aca81db6bf4df14e603da91205c16ecee7f84900
[ "Apache-2.0" ]
null
null
null
20.236111
62
0.762526
2,193
package es.ujaen.rlc00008.gnbwallet.data.source.memory; import java.util.ArrayList; import es.ujaen.rlc00008.gnbwallet.data.entities.CardDTO; import es.ujaen.rlc00008.gnbwallet.data.entities.ChallengeDTO; import es.ujaen.rlc00008.gnbwallet.data.entities.UserDTO; /** * Created by Ricardo on 16/5/16. */ public class SessionData { private String userToken; private String userLogin; private UserDTO currentUser; private ArrayList<CardDTO> userCards; private String favoriteCard; private ChallengeDTO challengeDTO; public SessionData() { } public String getUserToken() { return userToken; } public void setUserToken(String userToken) { this.userToken = userToken; } public String getUserLogin() { return userLogin; } public void setUserLogin(String userLogin) { this.userLogin = userLogin; } public UserDTO getCurrentUser() { return currentUser; } public void setCurrentUser(UserDTO currentUser) { this.currentUser = currentUser; } public ArrayList<CardDTO> getUserCards() { return userCards; } public void setUserCards(ArrayList<CardDTO> userCards) { this.userCards = userCards; } public String getFavoriteCard() { return favoriteCard; } public void setFavoriteCard(String favoriteCard) { this.favoriteCard = favoriteCard; } public ChallengeDTO getChallengeDTO() { return challengeDTO; } public void setChallengeDTO(ChallengeDTO challengeDTO) { this.challengeDTO = challengeDTO; } }
3e053ba168339f93bdaa05c924c648e1c8e75862
9,331
java
Java
bundles/user/api/src/main/java/org/sakaiproject/nakamura/api/user/UserConstants.java
EdiaEducationTechnology/nakamura
e67f5715822a2f81275883c14e031e10dd9eefb3
[ "Apache-2.0" ]
1
2017-08-22T04:54:46.000Z
2017-08-22T04:54:46.000Z
bundles/user/api/src/main/java/org/sakaiproject/nakamura/api/user/UserConstants.java
simong/nakamura
3a577f7967d2fb7c435635d75888fcc8709e3c2b
[ "Apache-2.0" ]
null
null
null
bundles/user/api/src/main/java/org/sakaiproject/nakamura/api/user/UserConstants.java
simong/nakamura
3a577f7967d2fb7c435635d75888fcc8709e3c2b
[ "Apache-2.0" ]
null
null
null
32.740351
116
0.71375
2,194
/** * Licensed to the Sakai Foundation (SF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The SF 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.sakaiproject.nakamura.api.user; /** * */ public interface UserConstants { public static final String SYSTEM_USER_MANAGER_PATH = "/system/userManager"; public static final String SYSTEM_USER_MANAGER_USER_PATH = SYSTEM_USER_MANAGER_PATH + "/user"; public static final String SYSTEM_USER_MANAGER_GROUP_PATH = SYSTEM_USER_MANAGER_PATH + "/group"; public static final String SYSTEM_USER_MANAGER_USER_PREFIX = SYSTEM_USER_MANAGER_USER_PATH + "/"; public static final String SYSTEM_USER_MANAGER_GROUP_PREFIX = SYSTEM_USER_MANAGER_GROUP_PATH + "/"; public static final String USER_PROFILE_RESOURCE_TYPE = "sakai/user-profile"; public static final String GROUP_PROFILE_RESOURCE_TYPE = "sakai/group-profile"; public static final String USER_HOME_RESOURCE_TYPE = "sakai/user-home"; public static final String GROUP_HOME_RESOURCE_TYPE = "sakai/group-home"; /** * A list of private properties that will not be copied from the authorizable. */ public static final String PRIVATE_PROPERTIES = "sakai:privateproperties"; /** * The number of hash levels applied to user paths, this is system wide and can't be * changed once an instance has been loaded with users. 4 will give upto 2E9 users. */ public static final int DEFAULT_HASH_LEVELS = 4; /** * A node property that indicates which use the node was created by, for ownership. */ public static final String JCR_CREATED_BY = "jcr:createdBy"; /** * The ID of an anon user. */ public static final String ANON_USERID = "anonymous"; public static final String ADMIN_USERID = "admin"; /** * An array of managers of a group */ public static final String PROP_GROUP_MANAGERS = "rep:group-managers"; /** * An array of viewers of a group */ public static final String PROP_GROUP_VIEWERS = "rep:group-viewers"; public static final String PROP_JOINABLE_GROUP = "sakai:group-joinable"; public static final String PROP_PSEUDO_GROUP = "sakai:pseudoGroup"; public static final String PROP_PARENT_GROUP_ID = "sakai:parent-group-id"; public static final String PROP_PARENT_GROUP_TITLE = "sakai:parent-group-title"; public static final String PROP_ROLE_TITLE = "sakai:role-title"; public static final String PROP_ROLE_TITLE_PLURAL = "sakai:role-title-plural"; /** * Bare Authorizables have no /~ content and don't do any post processing. */ public static final String PROP_BARE_AUTHORIZABLE = "sakai:bare"; /** * The name of the property that holds the value of identifier (authorizable ID) for * this profile. */ public static final String USER_IDENTIFIER_PROPERTY = "rep:userId"; /** * The property name that holds the given name of a user. */ public static final String USER_FIRSTNAME_PROPERTY = "firstName"; /** * The property name that holds the family name of a user. */ public static final String USER_LASTNAME_PROPERTY = "lastName"; /** * The property name that holds the email of a user. */ public static final String USER_EMAIL_PROPERTY = "email"; /** * The property name that holds the picture location for a user. */ public static final String USER_PICTURE = "picture"; /** * The name of the property which holds the user's institutional role (faculty, staff, etc.) */ public static final String USER_ROLE = "role"; /** * The name of the property which holds the user's department (Chemistry, English, etc.) */ public static final String USER_DEPARTMENT = "department"; /** * The name of the property which holds the user's college (Liberal Arts, Natural Sciences, etc.) */ public static final String USER_COLLEGE = "college"; /** * The name of the property which holds the user's date of birth. */ public static final String USER_DATEOFBIRTH = "dateofbirth"; /** * The name of the property which holds the list of tag names this user is tagged with. */ public static final String USER_TAGS = "sakai:tags"; /** * The name of the property which holds the name that this user prefers to go by. */ public static final String PREFERRED_NAME = "preferredName"; /** * The property name that holds the basic nodes for a user. */ public static final String USER_BASIC = "basic"; /** * The property name that holds the access information for a user. */ public static final String USER_BASIC_ACCESS = "access"; /** * Default value for the access property. */ public static final String EVERYBODY_ACCESS_VALUE = "everybody"; public static final String USER_HOME_PATH = "homePath"; /** * Property name for the full title/name of a group. ie: Title: The 2010 Mathematics 101 * class. Authorizable id: the-2010-mathematics-101-class */ public static final String GROUP_TITLE_PROPERTY = "sakai:group-title"; /** * Property name for the description of a group. */ public static final String GROUP_DESCRIPTION_PROPERTY = "sakai:group-description"; /** * The joinable property */ public enum Joinable { /** * The group is joinable. */ yes(), /** * The group is not joinable. */ no(), /** * The group is joinable with approval. */ withauth(); } /** * The Authorizable node's subpath within the repository's user or group tree. */ public static final String PROP_AUTHORIZABLE_PATH = "path"; public static final String USER_REPO_LOCATION = "/rep:security/rep:authorizables/rep:users"; public static final String GROUP_REPO_LOCATION = "/rep:security/rep:authorizables/rep:groups"; /** * The key name for the property in the event that will hold the userid. */ public static final String EVENT_PROP_USERID = "userid"; /** * The name of the OSGi event topic for creating a user. */ public static final String TOPIC_USER_CREATED = "org/sakaiproject/nakamura/lite/user/created"; /** * The name of the OSGi event topic for updating a user. */ public static final String TOPIC_USER_UPDATE = "org/sakaiproject/nakamura/lite/user/updated"; /** * The name of the OSGi event topic for deleting a user. */ public static final String TOPIC_USER_DELETED = "org/sakaiproject/nakamura/lite/user/deleted"; /** * The name of the OSGi event topic for creating a group. */ public static final String TOPIC_GROUP_CREATED = "org/sakaiproject/nakamura/lite/group/created"; /** * The name of the OSGi event topic for updating a group. */ public static final String TOPIC_GROUP_UPDATE = "org/sakaiproject/nakamura/lite/group/updated"; /** * The name of the OSGi event topic for deleting a group. */ public static final String TOPIC_GROUP_DELETED = "org/sakaiproject/nakamura/lite/group/deleted"; /** * Property name for the parent of all counts in the profile. */ public static final String COUNTS_PROP = "counts"; /** * Property name for the number of contacts the user has. */ public static final String CONTACTS_PROP = "contactsCount"; /** * Property name for the number of groups that an authourizable is a member of. */ public static final String GROUP_MEMBERSHIPS_PROP = "membershipsCount"; // the number of groups a user belongs to /** * Property name for the number of content items that the authorizable is listed as a manager or viewer. */ public static final String CONTENT_ITEMS_PROP = "contentCount"; /** * The epoch when the counts were last updated. */ public static final String COUNTS_LAST_UPDATE_PROP = "countLastUpdate"; /** * Property name for the number of members that a group has (int) */ public static final String GROUP_MEMBERS_PROP = "membersCount"; // the number of members that a group has /** * Counts that apply to all authorizables */ public static final String[] AUTHZ_COUNTS_PROPS = new String[]{CONTENT_ITEMS_PROP, COUNTS_LAST_UPDATE_PROP}; /** * Counts that apply to users only */ public static final String[] USER_COUNTS_PROPS = new String[]{CONTACTS_PROP, GROUP_MEMBERSHIPS_PROP}; /** * Counts that apply to groups only */ public static final String[] GROUP_COUNTS_PROPS = new String[]{GROUP_MEMBERS_PROP}; /** * If present and true, the authorizable will not appear in the search index. */ public static final String SAKAI_EXCLUDE = "sakai:excludeSearch"; public static final String SAKAI_CATEGORY = "sakai:category"; public static final String USER_RESPONSE_CACHE = "userFeed"; }
3e053bbf892f93d1b99a9c1467845fd6f051f236
432
java
Java
src/test/java/one/edee/darwin/storage/oracle/DefaultDatabaseStorageCheckerOracle.java
FgForrest/Darwin
a31ee2284ff20205f738edac3ed1a11fd0d59f3f
[ "MIT" ]
3
2020-11-09T07:09:12.000Z
2020-11-09T17:03:30.000Z
src/test/java/one/edee/darwin/storage/oracle/DefaultDatabaseStorageCheckerOracle.java
FgForrest/Darwin
a31ee2284ff20205f738edac3ed1a11fd0d59f3f
[ "MIT" ]
null
null
null
src/test/java/one/edee/darwin/storage/oracle/DefaultDatabaseStorageCheckerOracle.java
FgForrest/Darwin
a31ee2284ff20205f738edac3ed1a11fd0d59f3f
[ "MIT" ]
null
null
null
27
91
0.80787
2,195
package one.edee.darwin.storage.oracle; import one.edee.darwin.storage.DefaultDatabaseStorageCheckerTest; import org.springframework.context.annotation.Profile; import org.springframework.test.context.ActiveProfiles; /** * @author Radek Salay, FG Forest a.s. 7/14/16. */ @ActiveProfiles(value = "ORACLE") @Profile(value = "ORACLE") public class DefaultDatabaseStorageCheckerOracle extends DefaultDatabaseStorageCheckerTest{ }
3e053bf1e0a5b3b3552a8990b974382ef3368361
4,584
java
Java
modules/broker-amqp/src/main/java/io/ballerina/messaging/broker/amqp/codec/frames/DtxEnd.java
a5anka/ballerina-message-broker
c4760e863bd7430d34c3746f777a8bc4429d5e12
[ "Apache-2.0" ]
8
2018-12-02T06:38:30.000Z
2019-07-07T08:18:18.000Z
modules/broker-amqp/src/main/java/io/ballerina/messaging/broker/amqp/codec/frames/DtxEnd.java
a5anka/ballerina-message-broker
c4760e863bd7430d34c3746f777a8bc4429d5e12
[ "Apache-2.0" ]
169
2018-02-18T04:33:15.000Z
2018-11-05T15:58:06.000Z
modules/broker-amqp/src/main/java/io/ballerina/messaging/broker/amqp/codec/frames/DtxEnd.java
a5anka/ballerina-message-broker
c4760e863bd7430d34c3746f777a8bc4429d5e12
[ "Apache-2.0" ]
18
2018-03-29T06:38:25.000Z
2018-10-22T09:44:40.000Z
38.521008
117
0.659468
2,196
/* * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * * WSO2 Inc. 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.ballerina.messaging.broker.amqp.codec.frames; import io.ballerina.messaging.broker.amqp.codec.AmqpChannel; import io.ballerina.messaging.broker.amqp.codec.BlockingTask; import io.ballerina.messaging.broker.amqp.codec.ChannelException; import io.ballerina.messaging.broker.amqp.codec.XaResult; import io.ballerina.messaging.broker.amqp.codec.handlers.AmqpConnectionHandler; import io.ballerina.messaging.broker.common.ValidationException; import io.ballerina.messaging.broker.common.data.types.LongString; import io.ballerina.messaging.broker.common.data.types.ShortString; import io.ballerina.messaging.broker.core.transaction.XidImpl; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.transaction.xa.Xid; /** * AMQP frame for dtx.end * Parameter Summary: * 1. format (short) - Implementation specific format code * 2. global-id (LongString) - Global transaction identifier * 3. branch-id (LongString) - Branch qualifier * 4. fail (bit) - Indicates that this portion of work has failed * 5. suspend (bit) - Indicates that the transaction branch is temporarily suspended in an incomplete state */ public class DtxEnd extends MethodFrame { private static final Logger LOGGER = LoggerFactory.getLogger(DtxEnd.class); private static final short CLASS_ID = 100; private static final short METHOD_ID = 30; private final int format; private final LongString globalId; private final LongString branchId; private final boolean fail; private final boolean suspend; public DtxEnd(int channel, int format, LongString globalId, LongString branchId, boolean fail, boolean suspend) { super(channel, CLASS_ID, METHOD_ID); this.format = format; this.globalId = globalId; this.branchId = branchId; this.fail = fail; this.suspend = suspend; } @Override protected long getMethodBodySize() { return 2L + globalId.getSize() + branchId.getSize() + 1L; } @Override protected void writeMethod(ByteBuf buf) { buf.writeShort(format); globalId.write(buf); branchId.write(buf); byte flags = 0x0; if (fail) { flags |= 0x1; } if (suspend) { flags |= 0x2; } buf.writeByte(flags); } @Override public void handle(ChannelHandlerContext ctx, AmqpConnectionHandler connectionHandler) { int channelId = getChannel(); AmqpChannel channel = connectionHandler.getChannel(channelId); ctx.fireChannelRead((BlockingTask) () -> { try { Xid xid = new XidImpl(format, branchId.getBytes(), globalId.getBytes()); channel.endDtx(xid, fail, suspend); ctx.writeAndFlush(new DtxEndOk(channelId, XaResult.XA_OK.getValue())); } catch (ValidationException e) { LOGGER.warn("User input error while ending transaction", e); ctx.writeAndFlush(new ChannelClose(channelId, ChannelException.PRECONDITION_FAILED, ShortString.parseString(e.getMessage()), CLASS_ID, METHOD_ID)); } }); } public static AmqMethodBodyFactory getFactory() { return (buf, channel, size) -> { int format = buf.readUnsignedShort(); LongString globalId = LongString.parse(buf); LongString branchId = LongString.parse(buf); byte flags = buf.readByte(); boolean fail = (flags & 0x1) == 0x1; boolean suspend = (flags & 0x2) == 0x2; return new DtxEnd(channel, format, globalId, branchId, fail, suspend); }; } }
3e053c16af78197f20a1fb0b556f64f970cc473d
801
java
Java
ch03/tony/GuessMyNumber.java
weber2am/ThinkJavaCode2
a01da759d8c411bd2a93e40c98e407dfb32107f7
[ "MIT" ]
null
null
null
ch03/tony/GuessMyNumber.java
weber2am/ThinkJavaCode2
a01da759d8c411bd2a93e40c98e407dfb32107f7
[ "MIT" ]
null
null
null
ch03/tony/GuessMyNumber.java
weber2am/ThinkJavaCode2
a01da759d8c411bd2a93e40c98e407dfb32107f7
[ "MIT" ]
null
null
null
28.607143
77
0.600499
2,197
import java.util.Random; import java.util.Scanner; /** * User guesses a random number. */ public class GuessMyNumber { public static void main(String[] args) { int number; int guess; Random random = new Random(); number = random.nextInt(100) + 1; System.out.println("I'm thinking of a number between 1 and 100"); System.out.println("(including both). Can you guess what it is?"); System.out.print("Type a number: "); Scanner in = new Scanner(System.in); guess = in.nextInt(); in.nextLine(); System.out.printf("Your guess is: %d\n", guess); System.out.printf("The number I was thinking of is: %d\n", number); System.out.printf("You were off by: %d\n", Math.abs(number - guess)); } }
3e053d9c92364709ffb0763fc81795ae4ce083a9
67
java
Java
ListAddingRemove/src/com/revature/listingaddsremove/Listing.java
1804Apr23Java/CortesL
9d0738805157f67ee3480f8758da754252f75e0e
[ "MIT" ]
null
null
null
ListAddingRemove/src/com/revature/listingaddsremove/Listing.java
1804Apr23Java/CortesL
9d0738805157f67ee3480f8758da754252f75e0e
[ "MIT" ]
null
null
null
ListAddingRemove/src/com/revature/listingaddsremove/Listing.java
1804Apr23Java/CortesL
9d0738805157f67ee3480f8758da754252f75e0e
[ "MIT" ]
null
null
null
11.166667
39
0.791045
2,198
package com.revature.listingaddsremove; public class Listing { }
3e053e3817dc9694a8cbed08d5a1ec20f676a676
1,359
java
Java
src/java/org/apache/poi/ss/usermodel/charts/ChartDataFactory.java
cmacdonald/poi
97c21e31b10a37365cf499dbe1c5345680c872df
[ "Apache-2.0" ]
1
2021-05-25T13:17:07.000Z
2021-05-25T13:17:07.000Z
src/java/org/apache/poi/ss/usermodel/charts/ChartDataFactory.java
cmacdonald/poi
97c21e31b10a37365cf499dbe1c5345680c872df
[ "Apache-2.0" ]
3
2021-02-03T19:37:08.000Z
2021-09-20T23:28:41.000Z
src/java/org/apache/poi/ss/usermodel/charts/ChartDataFactory.java
cmacdonald/poi
97c21e31b10a37365cf499dbe1c5345680c872df
[ "Apache-2.0" ]
2
2019-11-05T12:28:13.000Z
2021-05-25T13:17:09.000Z
32.357143
75
0.673289
2,199
/* ==================================================================== 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.poi.ss.usermodel.charts; import org.apache.poi.util.Removal; /** * A factory for different charts data types. * * @deprecated */ @Deprecated @Removal(version="4.2") public interface ChartDataFactory { /** * @return an appropriate ScatterChartData instance */ ScatterChartData createScatterChartData(); /** * @return a LineChartData instance */ LineChartData createLineChartData(); }
3e053f43b85ccde9676bc4d9bbc3d154d7abeb40
2,304
java
Java
src/main/java/au/net/electronichealth/ns/wsp/xsd/standarderror/_2010/StandardError.java
AuDigitalHealth/pcehr-compiled-wsdl-java
098fa9e9b0859e2785dd4ae81a60094898ecf053
[ "Apache-2.0" ]
null
null
null
src/main/java/au/net/electronichealth/ns/wsp/xsd/standarderror/_2010/StandardError.java
AuDigitalHealth/pcehr-compiled-wsdl-java
098fa9e9b0859e2785dd4ae81a60094898ecf053
[ "Apache-2.0" ]
null
null
null
src/main/java/au/net/electronichealth/ns/wsp/xsd/standarderror/_2010/StandardError.java
AuDigitalHealth/pcehr-compiled-wsdl-java
098fa9e9b0859e2785dd4ae81a60094898ecf053
[ "Apache-2.0" ]
null
null
null
24.774194
132
0.62283
2,200
package au.net.electronichealth.ns.wsp.xsd.standarderror._2010; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for StandardErrorType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="StandardErrorType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="errorCode" type="{http://ns.electronichealth.net.au/wsp/xsd/StandardError/2010}StandardErrorCodeType"/> * &lt;element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "StandardErrorType", propOrder = { "errorCode", "message" }) @XmlRootElement(name = "standardError") public class StandardError { @XmlElement(required = true) protected StandardErrorCodeType errorCode; @XmlElement(required = true) protected String message; /** * Gets the value of the errorCode property. * * @return * possible object is * {@link StandardErrorCodeType } * */ public StandardErrorCodeType getErrorCode() { return errorCode; } /** * Sets the value of the errorCode property. * * @param value * allowed object is * {@link StandardErrorCodeType } * */ public void setErrorCode(StandardErrorCodeType value) { this.errorCode = value; } /** * Gets the value of the message property. * * @return * possible object is * {@link String } * */ public String getMessage() { return message; } /** * Sets the value of the message property. * * @param value * allowed object is * {@link String } * */ public void setMessage(String value) { this.message = value; } }
3e053f52eb9d8c8d7759fce64d10640af1658bad
29,187
java
Java
one.java
Cyblanceandroid/Second_pro
6239b3ecc7b7087540d2683b42b557da68ab6bf8
[ "Apache-2.0" ]
1
2015-12-08T06:12:00.000Z
2015-12-08T06:12:00.000Z
one.java
Cyblanceandroid/Second_pro
6239b3ecc7b7087540d2683b42b557da68ab6bf8
[ "Apache-2.0" ]
null
null
null
one.java
Cyblanceandroid/Second_pro
6239b3ecc7b7087540d2683b42b557da68ab6bf8
[ "Apache-2.0" ]
null
null
null
24.609612
169
0.675266
2,201
package com.example.barometer; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import model.profilemodel; import org.apache.http.client.HttpClient; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Text; import com.androidbegin.Imageloder.ImageLoader; import adpter.profileadpter; import android.app.Activity; import android.app.ProgressDialog; import android.app.TabActivity; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.content.res.ColorStateList; import android.content.res.Configuration; import android.graphics.Color; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Bundle; import android.text.Html; import android.util.Log; import android.util.TypedValue; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.webkit.WebView.FindListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ExpandableListView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.Spinner; import android.widget.TabHost; import android.widget.TabHost.OnTabChangeListener; import android.widget.TabHost.TabSpec; import android.widget.TextView; import android.widget.Toast; public class stastictabbar extends Act_TabBar { Spinner spn; TextView textcountryname, textlongname, txtupdatetext, contentdata; Act_TabBar atb; String Url; Context mcontext; TextView dynamicText; String test, promsg, cmstxt; public static final String MY_PREFS_NAME = "MyPrefsFile"; String[] name; ProgressDialog loading; ImageView backscreen, imageview; ListView listdata, conventiondata; String oil1, oil2, oil3, oil4, oil5, oil6, oil7, oil8, oil9; String countryname, countrylongname, lastupdatedata, contentinfo, imagepath, countrynamethree, population; TextView lastupdated, countrynametrty, txtpopulation, title, countryterriory, populationtra, txtname; TextView oli_a, oli_b, oli_c, oli_d, oli_e, oli_f, oli_g, oli_h, oli_i, ilo_tra; List<String> regions; String titles = ""; String intr, edu, ear, pri, sec, ter, chi, ref, mino, aca, gen, child, footnote, trade, sel; String selectedItem; List<String> li; int len; String id2; Context context; EditText editText; TextView btnsubmit, profilesubmit; ArrayList<String> worldlist; JSONObject alldata = new JSONObject(); RelativeLayout introduction_l, texteducation_l,textearlychildhood_l, textprimary_l,textsecondary_l, texttertiary_l,textspecialneed_l, textrefugee_l,textminority_l, textacademic_l, textgender_l,textchildlabour_l,texttradeunion_l,footnote_l; TextView introduction_t,texteducation_t,textearlychildhood_t,textprimary_t,textsecondary_t,texttertiary_t,textspecialneed_t,textrefugee_t,textminority_t,textacademic_t, textgender_t,textchildlabour_t,texttradeunion_t,footnote_t; TextView last_update; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.stasticprofile); atb = new Act_TabBar(); initialize_Controls(); initialization(); mcontext=this; // Dialog=new ProgressDialog(mcontext); mcontext=this; loading=new ProgressDialog(mcontext); spn = (Spinner) findViewById(R.id.spinner1); title = (TextView) findViewById(R.id.title1); last_update= (TextView) findViewById(R.id.last_update); introduction_l= (RelativeLayout)findViewById(R.id.into_l); texteducation_l= (RelativeLayout)findViewById(R.id.education_l); textearlychildhood_l= (RelativeLayout)findViewById(R.id.early_l); textprimary_l= (RelativeLayout)findViewById(R.id.primary_l); textsecondary_l= (RelativeLayout)findViewById(R.id.secondary_l); texttertiary_l= (RelativeLayout)findViewById(R.id.higher_l); textspecialneed_l= (RelativeLayout)findViewById(R.id.childern_l); textrefugee_l= (RelativeLayout)findViewById(R.id.refugee_l); textacademic_l= (RelativeLayout)findViewById(R.id.academic_l); textgender_l= (RelativeLayout)findViewById(R.id.gender_l); textchildlabour_l= (RelativeLayout)findViewById(R.id.childla_l); texttradeunion_l= (RelativeLayout)findViewById(R.id.trade_l); footnote_l= (RelativeLayout)findViewById(R.id.footnote_l); textminority_l= (RelativeLayout)findViewById(R.id.minoriti_l); introduction_t= (TextView)findViewById(R.id.into); texteducation_t= (TextView)findViewById(R.id.education); textearlychildhood_t= (TextView)findViewById(R.id.early); textprimary_t= (TextView)findViewById(R.id.primary); textsecondary_t= (TextView)findViewById(R.id.secondary); texttertiary_t= (TextView)findViewById(R.id.higher); textspecialneed_t= (TextView)findViewById(R.id.childern); textrefugee_t= (TextView)findViewById(R.id.refugee); textacademic_t= (TextView)findViewById(R.id.acadamic); textgender_t= (TextView)findViewById(R.id.gender); textchildlabour_t= (TextView)findViewById(R.id.childla); texttradeunion_t= (TextView)findViewById(R.id.trade); footnote_t= (TextView)findViewById(R.id.footnote); textminority_t= (TextView)findViewById(R.id.minoriti); introduction_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this,profiledetail.class); startActivity(i); } }); texteducation_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, acdami.class); startActivity(i); } }); textearlychildhood_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, early.class); startActivity(i); } }); textprimary_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, primary.class); startActivity(i); } }); textsecondary_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, secondary.class); startActivity(i); } }); texttertiary_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, tertiary.class); startActivity(i); } }); textspecialneed_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this,secondarydetail.class); startActivity(i); } }); textrefugee_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this,Refugee.class); startActivity(i); } }); textacademic_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, acdfreedom.class); startActivity(i); } }); textgender_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, gendereqa.class); startActivity(i); } }); textchildlabour_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, chaildlabour.class); startActivity(i); } }); texttradeunion_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, trade.class); startActivity(i); } }); footnote_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, footnotedetail.class); startActivity(i); } }); textminority_l.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, minoritee.class); startActivity(i); } }); SharedPreferences prefs = getSharedPreferences("mytitle", MODE_PRIVATE); String s1 = prefs.getString("profile", null); title.setText(s1); countryterriory = (TextView) findViewById(R.id.textView10); populationtra = (TextView) findViewById(R.id.textView11); Typeface myTypeface1 = Typeface.createFromAsset(getAssets(), "font/RBold.ttf"); title.setTypeface(myTypeface1); SharedPreferences prefss1 = getSharedPreferences("profilefile", MODE_PRIVATE); String s1s = prefss1.getString("pdata", null); backscreen = (ImageView) findViewById(R.id.back); imageview = (ImageView) findViewById(R.id.imageView1); //listdata = (ListView) findViewById(R.id.listView1); lastupdated = (TextView) findViewById(R.id.intro); countrynametrty = (TextView) findViewById(R.id.countrynametrt); txtpopulation = (TextView) findViewById(R.id.population); txtname = (TextView) findViewById(R.id.name); SharedPreferences prefss = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE); id2 = prefss.getString("ID", "ID"); SharedPreferences.Editor editor = getSharedPreferences("pre", MODE_PRIVATE).edit(); editor.putString("ID2", id2); editor.commit(); SetLanguageToAll_teb(); GetLanguageForMsg(); try { loading.setMessage(promsg); loading.show(); loading.setCancelable(false); new LongOperation().execute(Url); } catch (Exception e) { e.printStackTrace(); } btnsubmit = (TextView) findViewById(R.id.btnsubmit); backscreen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, ProfileActivity.class); startActivity(i); } }); spn.setOnItemSelectedListener(new OnItemSelectedListener() { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { selectedItem = parent.getSelectedItem().toString(); SharedPreferences.Editor editor = getSharedPreferences( "MY_PREFS", MODE_PRIVATE).edit(); editor.putString("selectid", spn.getSelectedItem().toString()); editor.putString("selectcountry", titles); editor.commit(); if (selectedItem.equals(sel)) { } else { Intent i = new Intent(stastictabbar.this,detailactivity.class); startActivity(i); } } public void onNothingSelected(AdapterView<?> arg0) { } }); profilesubmit = (TextView) findViewById(R.id.btnsubmit1); profilesubmit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { SharedPreferences.Editor editor = getSharedPreferences( "MY_PREFS", MODE_PRIVATE).edit(); editor.putString("selectid", spn.getSelectedItem().toString()); editor.putString("selectcountry", titles); editor.commit(); if (selectedItem.equals(sel)) { if (GetUserLang(getApplicationContext()).equalsIgnoreCase("English")) { Toast.makeText(getApplicationContext(),"Please select Year", 20).show(); } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase("French")) { Toast.makeText(getApplicationContext(),"S'il vous plaît sélectionner l'année", 20).show(); } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase("Spanish")) { Toast.makeText(getApplicationContext(),"Seleccione Año", 20).show(); } } else { Intent i = new Intent(stastictabbar.this,detailactivity.class); startActivity(i); } } }); btnsubmit.setText(cmstxt); btnsubmit.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(stastictabbar.this, cmslistview.class); startActivity(i); } }); if (GetUserLang(getApplicationContext()).equalsIgnoreCase("English")) { profilesubmit.setBackgroundDrawable(getResources().getDrawable( R.drawable.submit_button)); } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase("French")) { profilesubmit.setBackgroundDrawable(getResources().getDrawable( R.drawable.fsubmit_button)); } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase("Spanish")) { profilesubmit.setBackgroundDrawable(getResources().getDrawable( R.drawable.ssubmit_button)); } introduction_t.setText(" "+intr); texteducation_t.setText(" "+edu); textearlychildhood_t.setText(" "+ear); textprimary_t.setText(" "+pri); textsecondary_t.setText(" "+sec); texttertiary_t.setText(" "+ter); textspecialneed_t.setText(" "+chi); textrefugee_t.setText(" "+ref); textacademic_t.setText(" "+aca); textgender_t.setText(" "+gen); textchildlabour_t.setText(" "+child); texttradeunion_t.setText(" "+trade); footnote_t.setText(" "+"FootNote"); textminority_t.setText(" "+mino); /*li = new ArrayList<String>(); li.add(intr); li.add(edu); li.add(ear); li.add(pri); li.add(sec); li.add(ter); li.add(chi); li.add(ref); li.add(mino); li.add(aca); li.add(gen); li.add(child); li.add(trade); li.add("Footnote"); ArrayAdapter<String> adp = new ArrayAdapter<String>(getBaseContext(), R.layout.listrow, R.id.group_title, li); listdata.setAdapter(adp); listdata.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub if (arg2 == 0) { Intent i = new Intent(stastictabbar.this, profiledetail.class); startActivity(i); } if (arg2 == 1) { Intent i = new Intent(stastictabbar.this, acdami.class); startActivity(i); } if (arg2 == 2) { Intent i = new Intent(stastictabbar.this, early.class); startActivity(i); } if (arg2 == 3) { Intent i = new Intent(stastictabbar.this, primary.class); startActivity(i); } if (arg2 == 4) { Intent i = new Intent(stastictabbar.this, secondary.class); startActivity(i); } if (arg2 == 5) { Intent i = new Intent(stastictabbar.this, tertiary.class); startActivity(i); } if (arg2 == 6) { Intent i = new Intent(stastictabbar.this, secondarydetail.class); startActivity(i); } if (arg2 == 7) { Intent i = new Intent(stastictabbar.this, Refugee.class); startActivity(i); } if (arg2 == 8) { Intent i = new Intent(stastictabbar.this, minoritee.class); startActivity(i); } if (arg2 == 9) { Intent i = new Intent(stastictabbar.this, acdfreedom.class); startActivity(i); } if (arg2 == 10) { Intent i = new Intent(stastictabbar.this, gendereqa.class); startActivity(i); } if (arg2 == 11) { Intent i = new Intent(stastictabbar.this, chaildlabour.class); startActivity(i); } if (arg2 == 12) { Intent i = new Intent(stastictabbar.this, trade.class); startActivity(i); } if (arg2 == 13) { Intent i = new Intent(stastictabbar.this, footnotedetail.class); startActivity(i); } } });*/ } private void initialize_Controls() { super.initialize_Bottombar(2); } public void initialization() { // spn=(ListView)findViewById(R.id.spinner1); textcountryname = (TextView) findViewById(R.id.countryname); textlongname = (TextView) findViewById(R.id.countrylongname); // contentdata = (TextView) findViewById(R.id.datamode); } class LongOperation extends AsyncTask<String, Void, Void> { // Required initialization private final HttpClient Client = new DefaultHttpClient(); private String Content=""; private String Error = null; String data = ""; int sizeData = 0; private Context context; protected void onPreExecute() { // NOTE: You can call UI Element here. // Start Progress Dialog (Message) //Dialog.setMessage(promsg); //Dialog.show(); } // Call after onPreExecute method protected Void doInBackground(String... urls) { /************ Make Post Call To Web Server ***********/ BufferedReader reader = null; // Send data try { // Defined URL where to send data URL url = new URL(urls[0]); // Send POST data request URLConnection conn = url.openConnection(); conn.setDoOutput(true); OutputStreamWriter wr = new OutputStreamWriter( conn.getOutputStream()); wr.write(data); wr.flush(); // Get the server response reader = new BufferedReader(new InputStreamReader( conn.getInputStream())); StringBuilder sb = new StringBuilder(); String line = null; // Read Server Response while ((line = reader.readLine()) != null) { // Append server response in string sb.append(line + "\n"); } // Append Server Response To Content String Content = sb.toString(); } catch (Exception ex) { Error = ex.getMessage(); } finally { try { reader.close(); } catch (Exception ex) { } } /*****************************************************/ return null; } protected void onPostExecute(Void unused) { if (Error != null) { } else { String subtitles = ""; String distitles = ""; String contrytrt = ""; String adata = ""; String update = ""; String t = " "; JSONObject jsonResponse; try { jsonResponse = new JSONObject(Content); JSONObject json2 = jsonResponse.getJSONObject("data"); countryname = (String) json2.get("country_name"); countrylongname = (String) json2.get("country_long_name"); JSONObject json22 = json2.getJSONObject("barometer_data"); imagepath = (String) json22.get("country_image_path"); countrynamethree = (String) json22 .get("country_territory_name"); population = (String) json22.get("population"); JSONArray subArraydetaile = json2 .getJSONArray("statistics_data"); String last_updates=(String) json22.get("last_update"); last_update.setText(Html.fromHtml(last_updates)); String introduction=(String) json22.get("introduction"); String texteducation=(String) json22.get("texteducation"); String textearlychildhood=(String) json22.get("textearlychildhood"); String textprimary=(String) json22.get("textprimary"); String textsecondary=(String) json22.get("textsecondary"); String texttertiary=(String) json22.get("texttertiary"); String textspecialneed=(String) json22.get("textspecialneed"); String textrefugee=(String) json22.get("textrefugee"); String textminority=(String) json22.get("textminority"); String textacademic=(String) json22.get("textacademic"); String textgender=(String) json22.get("textgender"); String textchildlabour=(String) json22.get("textchildlabour"); String texttradeunion=(String) json22.get("texttradeunion"); String footnote=(String) json22.get("footnote"); if(footnote.equalsIgnoreCase("")) { footnote_l.setVisibility(View.GONE); } else { footnote_l.setVisibility(View.VISIBLE); } if(texttradeunion.equalsIgnoreCase("")) { texttradeunion_l.setVisibility(View.GONE); } else { texttradeunion_l.setVisibility(View.VISIBLE); } if(textchildlabour.equalsIgnoreCase("")) { textchildlabour_l.setVisibility(View.GONE); } else { textchildlabour_l.setVisibility(View.VISIBLE); } if(textgender.equalsIgnoreCase("")) { textgender_l.setVisibility(View.GONE); } else { textgender_l.setVisibility(View.VISIBLE); } if(textacademic.equalsIgnoreCase("")) { textacademic_l.setVisibility(View.GONE); } else { textacademic_l.setVisibility(View.VISIBLE); } if(textminority.equalsIgnoreCase("")) { textminority_l.setVisibility(View.GONE); } else { textminority_l.setVisibility(View.VISIBLE); } if(textrefugee.equalsIgnoreCase("")) { textrefugee_l.setVisibility(View.GONE); } else { textrefugee_l.setVisibility(View.VISIBLE); } if(textspecialneed.equalsIgnoreCase("")) { textspecialneed_l.setVisibility(View.GONE); } else { textspecialneed_l.setVisibility(View.VISIBLE); } if(texttertiary.equalsIgnoreCase("")) { texttertiary_l.setVisibility(View.GONE); } else { texttertiary_l.setVisibility(View.VISIBLE); } if(textsecondary.equalsIgnoreCase("")) { textsecondary_l.setVisibility(View.GONE); } else { textsecondary_l.setVisibility(View.VISIBLE); } if(textprimary.equalsIgnoreCase("")) { textprimary_l.setVisibility(View.GONE); } else { textprimary_l.setVisibility(View.VISIBLE); } if(textearlychildhood.equalsIgnoreCase("")) { textearlychildhood_l.setVisibility(View.GONE); } else { textearlychildhood_l.setVisibility(View.VISIBLE); } if(texteducation.equalsIgnoreCase("")) { texteducation_l.setVisibility(View.GONE); } else { texteducation_l.setVisibility(View.VISIBLE); } if(introduction.equalsIgnoreCase("")) { introduction_l.setVisibility(View.GONE); } else { introduction_l.setVisibility(View.VISIBLE); } titles = countryname; subtitles = countrylongname; contrytrt = countrynamethree; textcountryname.setText(titles); SharedPreferences.Editor editor = getSharedPreferences( "country", MODE_PRIVATE).edit(); editor.putString("selectcountry", titles); editor.commit(); textlongname.setText(subtitles); countrynametrty.setText(contrytrt); worldlist = new ArrayList<String>(); worldlist.add(sel); int lengthJsonArr = subArraydetaile.length(); for (int i = 0; i < lengthJsonArr; i++) { JSONObject jsonChildNode = subArraydetaile .getJSONObject(i); worldlist.add(jsonChildNode.optString("year")); } spn.setAdapter(new ArrayAdapter<String>(stastictabbar.this, android.R.layout.simple_spinner_item, worldlist)); ImageLoader imgLoader = new ImageLoader( getApplicationContext()); imgLoader.DisplayImage(imagepath.toString(), R.drawable.lode, imageview); adata = population; txtpopulation.setText(Html.fromHtml(adata)); JSONArray json3 = json22.getJSONArray("ilo_convetion"); String s = json3.toString(); String s2 = s.replace("[", ""); s2 = s2.replace("]", ""); s2 = s2.replace("\"", ""); ArrayList<String> items = new ArrayList<String>( Arrays.asList(s2.split(","))); String[] stockArr = new String[items.size()]; stockArr = items.toArray(stockArr); String formatedString = items.toString() .replace(",", System.getProperty("line.separator")) .replace("[", "").replace("]", "").trim(); LinearLayout findViewById = (LinearLayout) findViewById(R.id.linear1); dynamicText = new TextView(stastictabbar.this); for (int i = 0; i < stockArr.length; i++) { dynamicText.setText(formatedString); dynamicText.setTextColor(Color.GRAY); dynamicText.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13); } findViewById.addView(dynamicText); } catch (JSONException ee) { ee.printStackTrace(); } loading.cancel(); } } } public String GetUserLang(Context c) { String s_value11 = "no"; SharedPreferences settings11 = c.getSharedPreferences("language", 0); String value1 = settings11.getString("u_lang", null); if (value1 != null) { return value1; } return s_value11; } public void SetData(JSONObject data) { try { JSONArray jsarray = new JSONArray(); jsarray = data.getJSONArray("data"); JSONObject row = jsarray.getJSONObject(0); Log.e("Tab data", "" + row); countryterriory.setText("" + row.getString("Country/Territory name")); populationtra.setText("" + row.getString("Population")); ilo_tra.setText("" + row.getString("ILO Conventions")); } catch (Exception e) { e.printStackTrace(); } } private void GetLanguageForMsg() { try { if (GetUserLang(getApplicationContext()) .equalsIgnoreCase("English")) { Url = "http://app.ei-ie.org/barometer/en/barometerapi/profile_details/" + id2; promsg = "Loading, please wait"; cmstxt = "Latest cms"; } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase( "French")) { Url = "http://app.ei-ie.org/barometer/fr/barometerapi/profile_details/" + id2; promsg = "Chargement en cours, s'il vous plaît patienter"; cmstxt = "Derniers cms"; } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase( "Spanish")) { Url = "http://app.ei-ie.org/barometer/es/barometerapi/profile_details/" + id2; promsg = "Cargando por favor espere"; cmstxt = "últimas cms"; } } catch (Exception e) { e.printStackTrace(); } } public String GetEnglish(Context c) { String s_value11 = "no"; SharedPreferences settings11 = c.getSharedPreferences("englishlang", 0); String value1 = settings11.getString("en_get", null); if (value1 != null) { return value1; } return s_value11; } public String GetSpanish(Context c) { String s_value11 = "no"; SharedPreferences settings11 = c.getSharedPreferences("spanishlang", 0); String value1 = settings11.getString("sp_get", null); if (value1 != null) { return value1; } return s_value11; } public String GetFrench(Context c) { String s_value11 = "no"; SharedPreferences settings11 = c.getSharedPreferences("frenchlang", 0); String value1 = settings11.getString("fr_get", null); if (value1 != null) { return value1; } return s_value11; } private void SetLanguageToAll_teb() { JSONObject alldata = new JSONObject(); try { Log.e("User language", ">>>>" + GetUserLang(getApplicationContext())); if (GetUserLang(getApplicationContext()) .equalsIgnoreCase("English")) { alldata = new JSONObject(GetEnglish(getApplicationContext())); } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase( "French")) { alldata = new JSONObject(GetFrench(getApplicationContext())); } else if (GetUserLang(getApplicationContext()).equalsIgnoreCase( "Spanish")) { alldata = new JSONObject(GetSpanish(getApplicationContext())); } SetData_tab(alldata); } catch (Exception e) { e.printStackTrace(); } } private void SetData_tab(JSONObject data) { try { JSONArray jsarray; jsarray = new JSONArray(); jsarray = data.getJSONArray("data"); JSONObject row = jsarray.getJSONObject(0); intr = row.getString("Introduction"); edu = row.getString("Education Rights"); ear = row.getString("Early Childhood Education (ECE)"); pri = row.getString("Primary Education"); sec = row.getString("Secondary Education"); ter = row.getString("Tertiary/Higher Education"); chi = row.getString("Children with Special Needs"); ref = row.getString("Refugee Children"); mino = row.getString("Minorities and Indigenous Peoples"); aca = row.getString("Academic Freedom"); gen = row.getString("Gender Equality"); child = row.getString("Child Labour"); trade = row.getString("Trade Union Rights"); sel = row.getString("Select Year Statistics"); countryterriory.setText("" + row.getString("Country/Territory name")); populationtra.setText("" + row.getString("Population")); txtname.setText("" + row.getString("ILO Conventions")); } catch (Exception e) { e.printStackTrace(); } } @Override public void onStop() { super.onStop(); if(loading!= null) loading.cancel(); } }
3e053fd4b1db7a2d8cab1b2e840e8aa1eeac73fc
461
java
Java
src/main/java/it/smartcommunitylab/bridge/model/TextDoc.java
smartcommunitylab/bridge.skill-engine
7212074252c33a8fa30b95409ead47296db46ed3
[ "Apache-2.0" ]
null
null
null
src/main/java/it/smartcommunitylab/bridge/model/TextDoc.java
smartcommunitylab/bridge.skill-engine
7212074252c33a8fa30b95409ead47296db46ed3
[ "Apache-2.0" ]
null
null
null
src/main/java/it/smartcommunitylab/bridge/model/TextDoc.java
smartcommunitylab/bridge.skill-engine
7212074252c33a8fa30b95409ead47296db46ed3
[ "Apache-2.0" ]
null
null
null
20.043478
68
0.715835
2,202
package it.smartcommunitylab.bridge.model; import java.util.HashMap; import java.util.Map; public class TextDoc { private Map<String, String> fields = new HashMap<String, String>(); private float score; public float getScore() { return score; } public void setScore(float score) { this.score = score; } public Map<String, String> getFields() { return fields; } public void setFields(Map<String, String> fields) { this.fields = fields; } }
3e053fee6146d7436330797480e247fbcb7e03a1
1,770
java
Java
db/src/main/java/com/psddev/dari/db/ObjectStruct.java
tankchintan/dari
7b3cd00020e9bdc12587f00fc3301bda0414589e
[ "BSD-Source-Code" ]
1
2020-06-23T17:14:32.000Z
2020-06-23T17:14:32.000Z
db/src/main/java/com/psddev/dari/db/ObjectStruct.java
tankchintan/dari
7b3cd00020e9bdc12587f00fc3301bda0414589e
[ "BSD-Source-Code" ]
null
null
null
db/src/main/java/com/psddev/dari/db/ObjectStruct.java
tankchintan/dari
7b3cd00020e9bdc12587f00fc3301bda0414589e
[ "BSD-Source-Code" ]
null
null
null
28.095238
80
0.592655
2,203
package com.psddev.dari.db; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; public interface ObjectStruct { /** Returns the environment that owns this object. */ public DatabaseEnvironment getEnvironment(); /** Returns a list of all fields. */ public List<ObjectField> getFields(); /** Returns the field with the given {@code name}. */ public ObjectField getField(String name); /** Sets the list of all the fields. */ public void setFields(List<ObjectField> fields); /** Returns a list of all indexes. */ public List<ObjectIndex> getIndexes(); /** Returns the index with the given {@code name}. */ public ObjectIndex getIndex(String name); /** Sets the list of all indexes. */ public void setIndexes(List<ObjectIndex> indexes); /** * {@link ObjectStruct} utility methods. */ public static final class Static { /** * Returns all fields that are indexed in the given {@code struct}. * * @param struct Can't be {@code null}. * @return Never {@code null}. */ public static List<ObjectField> findIndexedFields(ObjectStruct struct) { Set<String> indexed = new HashSet<String>(); for (ObjectIndex index : struct.getIndexes()) { indexed.addAll(index.getFields()); } List<ObjectField> fields = struct.getFields(); for (Iterator<ObjectField> i = fields.iterator(); i.hasNext(); ) { ObjectField field = i.next(); if (!indexed.contains(field.getInternalName())) { i.remove(); } } return fields; } } }
3e05405c2018b2683ceeea7a38f1bce0c131fde8
2,136
java
Java
src/main/java/frc/robot/subsystems/ClimberSubsystem.java
Bedford-Express-1023/1023-2022
77030ccf8a7bb511e9779a6f2886bba0e073cef4
[ "BSD-3-Clause" ]
null
null
null
src/main/java/frc/robot/subsystems/ClimberSubsystem.java
Bedford-Express-1023/1023-2022
77030ccf8a7bb511e9779a6f2886bba0e073cef4
[ "BSD-3-Clause" ]
1
2022-03-23T01:39:14.000Z
2022-03-23T01:39:14.000Z
src/main/java/frc/robot/subsystems/ClimberSubsystem.java
Bedford-Express-1023/1023-2022
77030ccf8a7bb511e9779a6f2886bba0e073cef4
[ "BSD-3-Clause" ]
null
null
null
24
89
0.7397
2,204
// Copyright (c) FIRST and other WPILib contributors. // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. package frc.robot.subsystems; import com.ctre.phoenix.motorcontrol.ControlMode; import com.ctre.phoenix.motorcontrol.can.WPI_TalonFX; import edu.wpi.first.wpilibj.DigitalInput; import edu.wpi.first.wpilibj.PneumaticsModuleType; import edu.wpi.first.wpilibj.Solenoid; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; import edu.wpi.first.wpilibj2.command.SubsystemBase; import frc.robot.RobotContainer; public class ClimberSubsystem extends SubsystemBase { private final WPI_TalonFX climberRightMotor = new WPI_TalonFX(55); private final WPI_TalonFX climberLeftMotor = new WPI_TalonFX(56); private final Solenoid climberSolenoid = new Solenoid(PneumaticsModuleType.CTREPCM, 4); private final DigitalInput MotorSwitch = new DigitalInput(0); private final RobotContainer m_robotContainer; boolean MotorSwitchState; /** Creates a new climberSubsytem. */ public ClimberSubsystem(RobotContainer robotContainer) { m_robotContainer = robotContainer; } @Override public void periodic() { if (MotorSwitch.get()){ MotorSwitchState = false; } else { MotorSwitchState = true; } SmartDashboard.putBoolean("Motor Switch", MotorSwitchState); } public void climberUnlock(){ climberSolenoid.set(true); } public void climberLock(){ climberSolenoid.set(false); } public void climbLock(){ climberSolenoid.set(true); } public void climberUp(){ climberUnlock(); climberLeftMotor.set(ControlMode.PercentOutput, -1); climberRightMotor.set(ControlMode.PercentOutput, 1); } public void climberDown(){ climberLeftMotor.set(ControlMode.PercentOutput, -0.85); climberRightMotor.set(ControlMode.PercentOutput, 0.85); } public void climberOff(){ climberLock(); climberLeftMotor.set(ControlMode.PercentOutput, 0); climberRightMotor.set(ControlMode.PercentOutput, 0); } }
3e05411e6dfd48a4602d152d8b2e76a2b70949d4
1,983
java
Java
Danmaku/src/com/elven/danmaku/core/elements/controller/path/PathController.java
AlanSchaeffer/Danmaku
5a860ae1293c07898c64281d45ed81ec0b6ff681
[ "Apache-2.0" ]
1
2015-04-06T11:30:23.000Z
2015-04-06T11:30:23.000Z
Danmaku/src/com/elven/danmaku/core/elements/controller/path/PathController.java
AlanSchaeffer/Danmaku
5a860ae1293c07898c64281d45ed81ec0b6ff681
[ "Apache-2.0" ]
null
null
null
Danmaku/src/com/elven/danmaku/core/elements/controller/path/PathController.java
AlanSchaeffer/Danmaku
5a860ae1293c07898c64281d45ed81ec0b6ff681
[ "Apache-2.0" ]
null
null
null
26.092105
97
0.704488
2,205
package com.elven.danmaku.core.elements.controller.path; import java.util.ArrayDeque; import java.util.Deque; import com.elven.danmaku.core.elements.AbstractPlaceableGameElement; import com.elven.danmaku.core.elements.controller.Controller; import com.elven.danmaku.core.system.Vector2D; public class PathController implements Controller { private Deque<WaypointNode> waypoints = new ArrayDeque<>(); public void addWaypoint(Waypoint waypoint) { Vector2D startingPoint = !waypoints.isEmpty() ? waypoints.getLast().getStartingPoint() : null; WaypointNode node = new WaypointNode(waypoint, startingPoint); waypoints.add(node); } @Override public void tick(AbstractPlaceableGameElement element) { if(!waypoints.isEmpty()) { WaypointNode node = waypoints.getFirst(); if(node.getStartingPoint() == null) { node.setStartingPoint(new Vector2D(element.getPosition())); } node.getWaypoint().tick(element, node.getStartingPoint(), node.getCurrentFrame()); node.tick(); if(node.isFinished()) { element.getPosition().set(node.getWaypoint().getDestination()); waypoints.removeFirst(); } } } private class WaypointNode { private Waypoint waypoint; private Vector2D startingPoint; private int remainingFrames; public WaypointNode(Waypoint waypoint, Vector2D startingPoint) { this.waypoint = waypoint; this.startingPoint = startingPoint; remainingFrames = waypoint.getDuration(); } public Waypoint getWaypoint() { return waypoint; } public Vector2D getStartingPoint() { return startingPoint; } public void setStartingPoint(Vector2D startingPoint) { this.startingPoint = startingPoint; } public void tick() { remainingFrames--; } public boolean isFinished() { return remainingFrames <= 0; } public int getCurrentFrame() { return waypoint.getDuration() - remainingFrames; } } }
3e054148163f18fafeafff876d6318bf4013d2a8
1,434
java
Java
Aula03-AbstractFactory/src/util/GerenciadorArquivo.java
fabiosiqueira12/programacaoAvancada
b3d211690d3729d4ed12fea0dffb313f2954f334
[ "MIT" ]
null
null
null
Aula03-AbstractFactory/src/util/GerenciadorArquivo.java
fabiosiqueira12/programacaoAvancada
b3d211690d3729d4ed12fea0dffb313f2954f334
[ "MIT" ]
null
null
null
Aula03-AbstractFactory/src/util/GerenciadorArquivo.java
fabiosiqueira12/programacaoAvancada
b3d211690d3729d4ed12fea0dffb313f2954f334
[ "MIT" ]
null
null
null
29.265306
103
0.615063
2,206
/* * 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 util; import java.io.File; /** * * @author douglasfrari */ abstract class GerenciadorArquivo { protected static final String FOLDER_NAME = "arquivos"; protected static final String NOME_ARQUIVO_SERIALIZADO = FOLDER_NAME+File.separator+"funcionario_"; protected static final String ARQUIVO_BANCO_DADOS_XML = "funcionarios.xml"; protected static final String ARQUIVO_BANCO_DADOS_CLIENTE = "clientes.xml"; protected static final String ARQUIVO_BANCO_DADOS_PRODUTO = "produtos.xml"; protected static final String ARQUIVO_BANCO_DADOS_VENDA= "vendas.xml"; protected static void checkFolder() { File theDir = new File(FOLDER_NAME); // if the directory does not exist, create it if (!theDir.exists()) { System.out.println("creating directory: " + FOLDER_NAME); boolean result = false; try{ theDir.mkdir(); result = true; } catch(SecurityException se){ //handle it System.out.println(se.getMessage()); } if(result) { System.out.println("DIR created"); } } } }
3e0542196237fc33e3fe89c3a696189532a523a2
14,008
java
Java
src/main/java/org/cobbzilla/util/system/CommandShell.java
cobbzilla/cobbzilla-utils
d47027c208639e6d4804c2f1262a0149d9d1d16c
[ "Apache-2.0" ]
13
2015-10-13T02:35:13.000Z
2020-01-16T08:11:55.000Z
src/main/java/org/cobbzilla/util/system/CommandShell.java
cobbzilla/cobbzilla-utils
d47027c208639e6d4804c2f1262a0149d9d1d16c
[ "Apache-2.0" ]
6
2016-11-21T16:53:33.000Z
2017-03-17T20:05:51.000Z
src/main/java/org/cobbzilla/util/system/CommandShell.java
cobbzilla/cobbzilla-utils
d47027c208639e6d4804c2f1262a0149d9d1d16c
[ "Apache-2.0" ]
16
2015-10-06T19:42:36.000Z
2020-09-03T13:54:39.000Z
40.022857
180
0.625
2,207
package org.cobbzilla.util.system; import lombok.Cleanup; import lombok.extern.slf4j.Slf4j; import org.apache.commons.exec.*; import org.apache.commons.io.output.TeeOutputStream; import org.apache.commons.lang3.ArrayUtils; import org.cobbzilla.util.collection.MapBuilder; import org.cobbzilla.util.io.FileUtil; import oshi.SystemInfo; import oshi.hardware.HardwareAbstractionLayer; import java.io.*; import java.util.*; import java.util.stream.Collectors; import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX; import static org.apache.commons.lang3.SystemUtils.IS_OS_MAC; import static org.cobbzilla.util.daemon.ZillaRuntime.die; import static org.cobbzilla.util.daemon.ZillaRuntime.empty; import static org.cobbzilla.util.io.FileUtil.abs; import static org.cobbzilla.util.io.FileUtil.getDefaultTempDir; import static org.cobbzilla.util.string.StringUtil.ellipsis; import static org.cobbzilla.util.string.StringUtil.trimQuotes; @Slf4j public class CommandShell { protected static final String EXPORT_PREFIX = "export "; public static final String CHMOD = "chmod"; public static final String CHGRP = "chgrp"; public static final String CHOWN = "chown"; private static final int[] DEFAULT_EXIT_VALUES = {0}; public static final SystemInfo SYSTEM_INFO = new SystemInfo(); public static final HardwareAbstractionLayer HARDWARE = SYSTEM_INFO.getHardware(); public static Map<String, String> loadShellExports (String path) throws IOException { if (!path.startsWith("/")) { final File file = userFile(path); if (file.exists()) return loadShellExports(file); } return loadShellExports(new File(path)); } public static File userFile(String path) { return new File(System.getProperty("user.home") + File.separator + path); } public static Map<String, String> loadShellExports (File f) throws IOException { try (InputStream in = new FileInputStream(f)) { return loadShellExports(in); } } public static Map<String, String> loadShellExports (InputStream in) throws IOException { final Map<String, String> map = new HashMap<>(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line, key, value; int eqPos; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.startsWith("#")) continue; if (line.startsWith(EXPORT_PREFIX)) { line = line.substring(EXPORT_PREFIX.length()).trim(); eqPos = line.indexOf('='); if (eqPos != -1) { key = line.substring(0, eqPos).trim(); value = line.substring(eqPos+1).trim(); value = trimQuotes(value); map.put(key, value); } } } } return map; } public static Map<String, String> loadShellExportsOrDie (String f) { try { return loadShellExports(f); } catch (Exception e) { return die("loadShellExportsOrDie: "+e); } } public static Map<String, String> loadShellExportsOrDie (File f) { try { return loadShellExports(f); } catch (Exception e) { return die("loadShellExportsOrDie: "+e); } } public static void replaceShellExport (String f, String name, String value) throws IOException { replaceShellExports(new File(f), MapBuilder.build(name, value)); } public static void replaceShellExport (File f, String name, String value) throws IOException { replaceShellExports(f, MapBuilder.build(name, value)); } public static void replaceShellExports (String f, Map<String, String> exports) throws IOException { replaceShellExports(new File(f), exports); } public static void replaceShellExports (File f, Map<String, String> exports) throws IOException { // validate -- no quote chars allowed for security reasons for (String key : exports.keySet()) { if (key.contains("\"") || key.contains("\'")) throw new IllegalArgumentException("replaceShellExports: name cannot contain a quote character: "+key); String value = exports.get(key); if (value.contains("\"") || value.contains("\'")) throw new IllegalArgumentException("replaceShellExports: value for "+key+" cannot contain a quote character: "+value); } // read entire file as a string final String contents = FileUtil.toString(f); // walk file line by line and look for replacements to make, overwrite file. final Set<String> replaced = new HashSet<>(exports.size()); try (Writer w = new FileWriter(f)) { for (String line : contents.split("\n")) { line = line.trim(); boolean found = false; for (String key : exports.keySet()) { if (!line.startsWith("#") && line.matches("^\\s*export\\s+" + key + "\\s*=.*")) { w.write("export " + key + "=\"" + exports.get(key) + "\""); replaced.add(key); found = true; break; } } if (!found) w.write(line); w.write("\n"); } for (String key : exports.keySet()) { if (!replaced.contains(key)) { w.write("export "+key+"=\""+exports.get(key)+"\"\n"); } } } } public static MultiCommandResult exec (Collection<String> commands) throws IOException { final MultiCommandResult result = new MultiCommandResult(); for (String c : commands) { Command command = new Command(c); result.add(command, exec(c)); if (result.hasException()) return result; } return result; } public static CommandResult exec (String command) throws IOException { return exec(CommandLine.parse(command)); } public static CommandResult exec (CommandLine command) throws IOException { return exec(new Command(command)); } public static CommandResult exec (Command command) throws IOException { final DefaultExecutor executor = new DefaultExecutor(); final ByteArrayOutputStream outBuffer = new ByteArrayOutputStream(); OutputStream out = command.hasOut() ? new TeeOutputStream(outBuffer, command.getOut()) : outBuffer; if (command.isCopyToStandard()) out = new TeeOutputStream(out, System.out); final ByteArrayOutputStream errBuffer = new ByteArrayOutputStream(); OutputStream err = command.hasErr() ? new TeeOutputStream(errBuffer, command.getErr()) : errBuffer; if (command.isCopyToStandard()) err = new TeeOutputStream(err, System.err); final ExecuteStreamHandler handler = new PumpStreamHandler(out, err, command.getInputStream()); executor.setStreamHandler(handler); if (command.hasDir()) executor.setWorkingDirectory(command.getDir()); executor.setExitValues(command.getExitValues()); try { final int exitValue = executor.execute(command.getCommandLine(), command.getEnv()); return new CommandResult(exitValue, outBuffer, errBuffer); } catch (Exception e) { final String stdout = outBuffer.toString().trim(); final String stderr = errBuffer.toString().trim(); log.error("exec("+command.getCommandLine()+"): " + e + (stdout.length() > 0 ? "\nstdout="+ellipsis(stdout, 1000) : "") + (stderr.length() > 0 ? "\nstderr="+ellipsis(stderr, 1000) : "")); return new CommandResult(e, outBuffer, errBuffer); } } public static int chmod (File file, String perms) { return chmod(abs(file), perms, false); } public static int chmod (File file, String perms, boolean recursive) { return chmod(abs(file), perms, recursive); } public static int chmod (String file, String perms) { return chmod(file, perms, false); } public static int chmod (String file, String perms, boolean recursive) { final CommandLine commandLine = new CommandLine(CHMOD); if (recursive) commandLine.addArgument("-R"); commandLine.addArgument(perms); commandLine.addArgument(abs(file), false); final Executor executor = new DefaultExecutor(); try { return executor.execute(commandLine); } catch (Exception e) { throw new CommandShellException(commandLine.toString(), e); } } public static int chgrp(String group, File path) { return chgrp(group, path, false); } public static int chgrp(String group, File path, boolean recursive) { return chgrp(group, abs(path), recursive); } public static int chgrp(String group, String path) { return chgrp(group, path, false); } public static int chgrp(String group, String path, boolean recursive) { return runChCmd(group, path, recursive, CHGRP); } private static int runChCmd(String subject, String path, boolean recursive, String cmd) { final Executor executor = new DefaultExecutor(); final CommandLine command = new CommandLine(cmd); if (recursive) command.addArgument("-R"); command.addArgument(subject).addArgument(path); try { return executor.execute(command); } catch (Exception e) { throw new CommandShellException(command.toString(), e); } } public static int chown(String owner, File path) { return chown(owner, path, false); } public static int chown(String owner, File path, boolean recursive) { return chown(owner, abs(path), recursive); } public static int chown(String owner, String path) { return chown(owner, path, false); } public static int chown(String owner, String path, boolean recursive) { return runChCmd(owner, path, recursive, CHOWN); } public static String toString(String command) { try { return exec(command).getStdout().trim(); } catch (IOException e) { throw new CommandShellException(command, e); } } public static long totalSystemMemory() { return HARDWARE.getMemory().getTotal(); } public static String hostname () { return toString("hostname"); } public static String domainname() { if (IS_OS_LINUX) { return toString("hostname -d"); } else { final String[] parts = toString("hostname").split("\\."); return String.join(".", ArrayUtils.subarray(parts, 1, parts.length)); } } public static String hostname_short() { return toString("hostname -s"); } public static String whoami() { return toString("whoami"); } public static boolean isRoot() { return "root".equals(whoami()); } public static String locale () { return execScript("locale | grep LANG= | tr '=.' ' ' | awk '{print $2}'").trim(); } public static String lang () { return execScript("locale | grep LANG= | tr '=_' ' ' | awk '{print $2}'").trim(); } public static File tempScript (String contents) { contents = "#!/bin/bash\n\n"+contents; try { final File temp = File.createTempFile("tempScript", ".sh", getDefaultTempDir()); FileUtil.toFile(temp, contents); chmod(temp, "700"); return temp; } catch (Exception e) { throw new CommandShellException(contents, e); } } public static String execScript (String contents) { return execScript(contents, null); } public static String execScript (String contents, Map<String, String> env) { return execScript(contents, env, null); } public static String execScript (String contents, Map<String, String> env, List<Integer> exitValues) { final CommandResult result = scriptResult(contents, env, null, exitValues); if (!result.isZeroExitStatus() && (exitValues == null || !exitValues.contains(result.getExitStatus()))) { throw new CommandShellException(contents, result); } return result.getStdout(); } public static CommandResult scriptResult (String contents) { return scriptResult(contents, null, null, null); } public static CommandResult scriptResult (String contents, Map<String, String> env) { return scriptResult(contents, env, null, null); } public static CommandResult scriptResult (String contents, String input) { return scriptResult(contents, null, input, null); } public static CommandResult scriptResult (String contents, Map<String, String> env, String input, List<Integer> exitValues) { try { @Cleanup("delete") final File script = tempScript(contents); final Command command = new Command(new CommandLine(script)).setEnv(env).setInput(input); if (!empty(exitValues)) command.setExitValues(exitValues); return exec(command); } catch (Exception e) { throw new CommandShellException(contents, e); } } public static CommandResult okResult(CommandResult result) { if (result == null || !result.isZeroExitStatus()) throw new CommandShellException(result); return result; } public static File home(String user) { String path = execScript("cd ~" + user + " && pwd"); if (empty(path)) die("home("+user+"): no home found for user "+user); final File f = new File(path); if (!f.exists()) die("home("+user+"): home does not exist "+path); return f; } public static File pwd () { return new File(System.getProperty("user.dir")); } }
3e05430dd71d491cdd957dc89e91f4e8fa2543ee
17,997
java
Java
dlib-face-recognition-app/demo/src/main/java/com/google/android/cameraview/demo/MainActivity.java
stefan-ilic-j/face
42d6305cbd85833f2b85bb79b70ab9ab004153c9
[ "MIT" ]
139
2018-02-23T14:03:00.000Z
2022-03-11T12:10:52.000Z
dlib-face-recognition-app/demo/src/main/java/com/google/android/cameraview/demo/MainActivity.java
stefan-ilic-j/face
42d6305cbd85833f2b85bb79b70ab9ab004153c9
[ "MIT" ]
33
2018-03-10T06:11:13.000Z
2021-10-12T07:27:42.000Z
dlib-face-recognition-app/demo/src/main/java/com/google/android/cameraview/demo/MainActivity.java
stefan-ilic-j/face
42d6305cbd85833f2b85bb79b70ab9ab004153c9
[ "MIT" ]
52
2018-03-06T11:20:59.000Z
2021-12-17T12:46:09.000Z
36.803681
158
0.593266
2,208
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ // Modified by Gaurav on Feb 23, 2018 package com.google.android.cameraview.demo; import android.Manifest; import android.app.Dialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Point; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.support.annotation.NonNull; import android.support.annotation.StringRes; import android.support.v4.app.ActivityCompat; import android.support.v4.app.DialogFragment; import android.support.v4.content.ContextCompat; import android.support.v7.app.ActionBar; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.Display; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.Toast; import com.google.android.cameraview.CameraView; import com.tzutalin.dlib.Constants; import com.tzutalin.dlib.FaceRec; import com.tzutalin.dlib.VisionDetRet; import junit.framework.Assert; import java.io.File; import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; // This demo app uses dlib face recognition based on resnet public class MainActivity extends AppCompatActivity implements ActivityCompat.OnRequestPermissionsResultCallback{ private static final String TAG = "MainActivity"; private static final int INPUT_SIZE = 500; private static final int[] FLASH_OPTIONS = { CameraView.FLASH_AUTO, CameraView.FLASH_OFF, CameraView.FLASH_ON, }; private static final int[] FLASH_ICONS = { R.drawable.ic_flash_auto, R.drawable.ic_flash_off, R.drawable.ic_flash_on, }; private static final int[] FLASH_TITLES = { R.string.flash_auto, R.string.flash_off, R.string.flash_on, }; private int mCurrentFlash; private CameraView mCameraView; private Handler mBackgroundHandler; private View.OnClickListener mOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.take_picture: if (mCameraView != null) { mCameraView.takePicture(); } break; case R.id.add_person: Intent i = new Intent(MainActivity.this, AddPerson.class); startActivity(i); finish(); break; } } }; @Override protected void onCreate(Bundle savedInstanceState) { Log.d(TAG, "onCreate called"); super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); checkPermissions(); mCameraView = (CameraView) findViewById(R.id.camera); if (mCameraView != null) { mCameraView.addCallback(mCallback); } Button fab = (Button) findViewById(R.id.take_picture); if (fab != null) { fab.setOnClickListener(mOnClickListener); } Button add_person = (Button) findViewById(R.id.add_person); if (add_person != null) { add_person.setOnClickListener(mOnClickListener); } Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayShowTitleEnabled(false); } } private FaceRec mFaceRec; private void changeProgressDialogMessage(final ProgressDialog pd, final String msg) { Runnable changeMessage = new Runnable() { @Override public void run() { pd.setMessage(msg); } }; runOnUiThread(changeMessage); } private class initRecAsync extends AsyncTask<Void, Void, Void> { ProgressDialog dialog = new ProgressDialog(MainActivity.this); @Override protected void onPreExecute() { Log.d(TAG, "initRecAsync onPreExecute called"); dialog.setMessage("Initializing..."); dialog.setCancelable(false); dialog.show(); super.onPreExecute(); } protected Void doInBackground(Void... args) { // create dlib_rec_example directory in sd card and copy model files File folder = new File(Constants.getDLibDirectoryPath()); boolean success = false; if (!folder.exists()) { success = folder.mkdirs(); } if (success) { File image_folder = new File(Constants.getDLibImageDirectoryPath()); image_folder.mkdirs(); if (!new File(Constants.getFaceShapeModelPath()).exists()) { FileUtils.copyFileFromRawToOthers(MainActivity.this, R.raw.shape_predictor_5_face_landmarks, Constants.getFaceShapeModelPath()); } if (!new File(Constants.getFaceDescriptorModelPath()).exists()) { FileUtils.copyFileFromRawToOthers(MainActivity.this, R.raw.dlib_face_recognition_resnet_model_v1, Constants.getFaceDescriptorModelPath()); } } else { //Log.d(TAG, "error in setting dlib_rec_example directory"); } mFaceRec = new FaceRec(Constants.getDLibDirectoryPath()); changeProgressDialogMessage(dialog, "Adding people..."); mFaceRec.train(); return null; } protected void onPostExecute(Void result) { if(dialog != null && dialog.isShowing()){ dialog.dismiss(); } } } String[] permissions = new String[]{ Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE, }; private boolean checkPermissions() { int result; List<String> listPermissionsNeeded = new ArrayList<>(); for (String p : permissions) { result = ContextCompat.checkSelfPermission(this, p); if (result != PackageManager.PERMISSION_GRANTED) { listPermissionsNeeded.add(p); } } if (!listPermissionsNeeded.isEmpty()) { ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), 100); return false; } return true; } @Override protected void onResume() { Log.d(TAG, "onResume called"); super.onResume(); if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED) { mCameraView.start(); } if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) { new initRecAsync().execute(); } } @Override protected void onPause() { Log.d(TAG, "onPause called"); mCameraView.stop(); super.onPause(); } @Override protected void onDestroy() { Log.d(TAG, "onDestroy called"); super.onDestroy(); if (mFaceRec != null) { mFaceRec.release(); } if (mBackgroundHandler != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { mBackgroundHandler.getLooper().quitSafely(); } else { mBackgroundHandler.getLooper().quit(); } mBackgroundHandler = null; } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { if (requestCode == 100) { if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { // do something } return; } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.switch_flash: if (mCameraView != null) { mCurrentFlash = (mCurrentFlash + 1) % FLASH_OPTIONS.length; item.setTitle(FLASH_TITLES[mCurrentFlash]); item.setIcon(FLASH_ICONS[mCurrentFlash]); mCameraView.setFlash(FLASH_OPTIONS[mCurrentFlash]); } return true; case R.id.switch_camera: if (mCameraView != null) { int facing = mCameraView.getFacing(); mCameraView.setFacing(facing == CameraView.FACING_FRONT ? CameraView.FACING_BACK : CameraView.FACING_FRONT); } return true; } return super.onOptionsItemSelected(item); } private Handler getBackgroundHandler() { if (mBackgroundHandler == null) { HandlerThread thread = new HandlerThread("background"); thread.start(); mBackgroundHandler = new Handler(thread.getLooper()); } return mBackgroundHandler; } private String getResultMessage(ArrayList<String> names) { String msg = new String(); if (names.isEmpty()) { msg = "No face detected or Unknown person"; } else { for(int i=0; i<names.size(); i++) { msg += names.get(i).split(Pattern.quote("."))[0]; if (i!=names.size()-1) msg+=", "; } msg+=" found!"; } return msg; } private class recognizeAsync extends AsyncTask<Bitmap, Void, ArrayList<String>> { ProgressDialog dialog = new ProgressDialog(MainActivity.this); private int mScreenRotation = 0; private boolean mIsComputing = false; private Bitmap mCroppedBitmap = Bitmap.createBitmap(INPUT_SIZE, INPUT_SIZE, Bitmap.Config.ARGB_8888); @Override protected void onPreExecute() { dialog.setMessage("Recognizing..."); dialog.setCancelable(false); dialog.show(); super.onPreExecute(); } protected ArrayList<String> doInBackground(Bitmap... bp) { drawResizedBitmap(bp[0], mCroppedBitmap); Log.d(TAG, "byte to bitmap"); long startTime = System.currentTimeMillis(); List<VisionDetRet> results; results = mFaceRec.recognize(mCroppedBitmap); long endTime = System.currentTimeMillis(); Log.d(TAG, "Time cost: " + String.valueOf((endTime - startTime) / 1000f) + " sec"); ArrayList<String> names = new ArrayList<>(); for(VisionDetRet n:results) { names.add(n.getLabel()); } return names; } protected void onPostExecute(ArrayList<String> names) { if(dialog != null && dialog.isShowing()){ dialog.dismiss(); AlertDialog.Builder builder1 = new AlertDialog.Builder(MainActivity.this); builder1.setMessage(getResultMessage(names)); builder1.setCancelable(true); AlertDialog alert11 = builder1.create(); alert11.show(); } } private void drawResizedBitmap(final Bitmap src, final Bitmap dst) { Display getOrient = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int orientation = Configuration.ORIENTATION_UNDEFINED; Point point = new Point(); getOrient.getSize(point); int screen_width = point.x; int screen_height = point.y; Log.d(TAG, String.format("screen size (%d,%d)", screen_width, screen_height)); if (screen_width < screen_height) { orientation = Configuration.ORIENTATION_PORTRAIT; mScreenRotation = 0; } else { orientation = Configuration.ORIENTATION_LANDSCAPE; mScreenRotation = 0; } Assert.assertEquals(dst.getWidth(), dst.getHeight()); final float minDim = Math.min(src.getWidth(), src.getHeight()); final Matrix matrix = new Matrix(); // We only want the center square out of the original rectangle. final float translateX = -Math.max(0, (src.getWidth() - minDim) / 2); final float translateY = -Math.max(0, (src.getHeight() - minDim) / 2); matrix.preTranslate(translateX, translateY); final float scaleFactor = dst.getHeight() / minDim; matrix.postScale(scaleFactor, scaleFactor); // Rotate around the center if necessary. if (mScreenRotation != 0) { matrix.postTranslate(-dst.getWidth() / 2.0f, -dst.getHeight() / 2.0f); matrix.postRotate(mScreenRotation); matrix.postTranslate(dst.getWidth() / 2.0f, dst.getHeight() / 2.0f); } final Canvas canvas = new Canvas(dst); canvas.drawBitmap(src, matrix, null); } } private CameraView.Callback mCallback = new CameraView.Callback() { @Override public void onCameraOpened(CameraView cameraView) { Log.d(TAG, "onCameraOpened"); } @Override public void onCameraClosed(CameraView cameraView) { Log.d(TAG, "onCameraClosed"); } @Override public void onPictureTaken(CameraView cameraView, final byte[] data) { Log.d(TAG, "onPictureTaken " + data.length); Toast.makeText(cameraView.getContext(), R.string.picture_taken, Toast.LENGTH_SHORT) .show(); Bitmap bp = BitmapFactory.decodeByteArray(data, 0, data.length); new recognizeAsync().execute(bp); } }; public static class ConfirmationDialogFragment extends DialogFragment { private static final String ARG_MESSAGE = "message"; private static final String ARG_PERMISSIONS = "permissions"; private static final String ARG_REQUEST_CODE = "request_code"; private static final String ARG_NOT_GRANTED_MESSAGE = "not_granted_message"; public static ConfirmationDialogFragment newInstance(@StringRes int message, String[] permissions, int requestCode, @StringRes int notGrantedMessage) { ConfirmationDialogFragment fragment = new ConfirmationDialogFragment(); Bundle args = new Bundle(); args.putInt(ARG_MESSAGE, message); args.putStringArray(ARG_PERMISSIONS, permissions); args.putInt(ARG_REQUEST_CODE, requestCode); args.putInt(ARG_NOT_GRANTED_MESSAGE, notGrantedMessage); fragment.setArguments(args); return fragment; } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { final Bundle args = getArguments(); return new AlertDialog.Builder(getActivity()) .setMessage(args.getInt(ARG_MESSAGE)) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String[] permissions = args.getStringArray(ARG_PERMISSIONS); if (permissions == null) { throw new IllegalArgumentException(); } ActivityCompat.requestPermissions(getActivity(), permissions, args.getInt(ARG_REQUEST_CODE)); } }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { Toast.makeText(getActivity(), args.getInt(ARG_NOT_GRANTED_MESSAGE), Toast.LENGTH_SHORT).show(); } }) .create(); } } }
3e05445fdb1a380fd33894ad61582f91ee943be6
1,785
java
Java
main/plugins/org.talend.cwm.management/src/main/java/org/talend/dq/analysis/memory/AnalysisThreadMemoryChangeNotifier.java
jiezhang-tlnd/tdq-studio-se
700ef9fb50a965436b686b8e81f8defac374955b
[ "Apache-2.0" ]
28
2015-07-28T13:02:41.000Z
2022-03-26T02:16:37.000Z
main/plugins/org.talend.cwm.management/src/main/java/org/talend/dq/analysis/memory/AnalysisThreadMemoryChangeNotifier.java
jiezhang-tlnd/tdq-studio-se
700ef9fb50a965436b686b8e81f8defac374955b
[ "Apache-2.0" ]
94
2015-06-30T08:44:16.000Z
2022-03-30T01:16:05.000Z
main/plugins/org.talend.cwm.management/src/main/java/org/talend/dq/analysis/memory/AnalysisThreadMemoryChangeNotifier.java
jiezhang-tlnd/tdq-studio-se
700ef9fb50a965436b686b8e81f8defac374955b
[ "Apache-2.0" ]
56
2015-03-03T09:12:36.000Z
2022-01-06T05:48:45.000Z
33.055556
120
0.597759
2,209
// ============================================================================ // // Copyright (C) 2006-2021 Talend Inc. - www.talend.com // // This source code is available under agreement available at // %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt // // You should have received a copy of the agreement // along with this program; if not, write to Talend SA // 9 rue Pages 92150 Suresnes, France // // ============================================================================ package org.talend.dq.analysis.memory; /** * Singleton class to manage memory when running analyses. */ public final class AnalysisThreadMemoryChangeNotifier extends AbstractMemoryChangeNotifier { private static AnalysisThreadMemoryChangeNotifier instance; /** * Method "getInstance". * * @return the singleton instance. */ public static synchronized AnalysisThreadMemoryChangeNotifier getInstance() { if (null == instance) { instance = new AnalysisThreadMemoryChangeNotifier(); } // MOD yyi 2012-06-19 TDQ-4916: reload for each instance to guarantee the threshold has been setted to the jvm. // MOD TDQ-7674 scorreia 2013-09-10 avoid setting these values at each call (calls happen for every analyzed // data row) // instance.reloadPerference(); return instance; } private AnalysisThreadMemoryChangeNotifier() { super(); } /** * Method "convertToMB" convert bytes to MB. * * @param numByte the number of bytes. * @return the number of MB. */ public static int convertToMB(long numByte) { return Math.round(numByte / 1024 / 1024); } }
3e054474b839c12a57ff84888956be062d07455a
3,906
java
Java
sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java
onap/aai-sparky-be
9e320c44e397071c100c5e7728a0a89ee3ebe485
[ "Apache-2.0" ]
null
null
null
sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java
onap/aai-sparky-be
9e320c44e397071c100c5e7728a0a89ee3ebe485
[ "Apache-2.0" ]
null
null
null
sparkybe-onap-service/src/test/java/org/onap/aai/sparky/viewandinspect/BaseVisualizationServiceTest.java
onap/aai-sparky-be
9e320c44e397071c100c5e7728a0a89ee3ebe485
[ "Apache-2.0" ]
null
null
null
42.456522
98
0.739119
2,210
/** * ============LICENSE_START======================================================= * org.onap.aai * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * Copyright © 2017-2018 Amdocs * ================================================================================ * 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. * ============LICENSE_END========================================================= */ package org.onap.aai.sparky.viewandinspect; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; import org.onap.aai.sparky.dal.ActiveInventoryAdapter; import org.onap.aai.sparky.dal.rest.config.RestEndpointConfig; import org.onap.aai.sparky.search.SearchServiceAdapter; import org.onap.aai.sparky.subscription.config.SubscriptionConfig; import org.onap.aai.sparky.sync.config.ElasticSearchSchemaConfig; import org.onap.aai.sparky.viewandinspect.config.VisualizationConfigs; import org.onap.aai.sparky.viewandinspect.entity.QueryRequest; import org.onap.aai.sparky.viewandinspect.services.BaseVisualizationService; import org.onap.aai.sparky.viewandinspect.util.SchemaVisualizationTestDataBuilder; public class BaseVisualizationServiceTest { private ActiveInventoryAdapter mockAaiAdapter; private SearchServiceAdapter mocksearchServiceAdapter; private VisualizationConfigs visualizationConfigs; private SubscriptionConfig subConfig; private RestEndpointConfig endpointEConfig; private ElasticSearchSchemaConfig schemaEConfig; private VisualizationContextBuilder contextBuilder; private BaseVisualizationService baseVisService; @Before public void init() throws Exception { this.mockAaiAdapter = Mockito.mock(ActiveInventoryAdapter.class); this.mocksearchServiceAdapter = Mockito.mock(SearchServiceAdapter.class); this.visualizationConfigs = new VisualizationConfigs(); this.subConfig = new SubscriptionConfig(); this.endpointEConfig = new RestEndpointConfig(); this.schemaEConfig = new ElasticSearchSchemaConfig(); this.contextBuilder = Mockito.mock(VisualizationContextBuilder.class); this.baseVisService = new BaseVisualizationService(contextBuilder, visualizationConfigs, mocksearchServiceAdapter, endpointEConfig, schemaEConfig, subConfig); } @Test public void testAnalyzeQueryRequestBody() { QueryRequest validResquest = baseVisService .analyzeQueryRequestBody(SchemaVisualizationTestDataBuilder.getQueryRequest()); assertEquals(SchemaVisualizationTestDataBuilder.ROOT_NODE_HASH_ID, validResquest.getHashId()); QueryRequest nullRequest = baseVisService .analyzeQueryRequestBody("This String should make the request return null eh!"); assertEquals(null, nullRequest); } @Test public void testBuildVisualizationUsingGenericQuery() { initializeMocksForBuildVisualizationUsingGenericQueryTest(); QueryRequest rootNodeQuery = baseVisService .analyzeQueryRequestBody(SchemaVisualizationTestDataBuilder.getQueryRequest()); } private void initializeMocksForBuildVisualizationUsingGenericQueryTest() { Mockito.when(mockAaiAdapter.queryActiveInventoryWithRetries(Mockito.anyString(), Mockito.anyString(), Mockito.anyInt(),Mockito.anyString())).thenReturn(null); } }
3e0544fa2f24ce1365eb9c89886b68bf6eeb5493
2,348
java
Java
src/main/java/am/ik/yavi/message/MessageSourceMessageFormatter.java
gakuzzzz/yavi
7cc47d1b1007723d57004dd13e1cf2e501ea8740
[ "Apache-2.0" ]
569
2018-08-21T15:55:17.000Z
2022-03-24T08:39:55.000Z
src/main/java/am/ik/yavi/message/MessageSourceMessageFormatter.java
gakuzzzz/yavi
7cc47d1b1007723d57004dd13e1cf2e501ea8740
[ "Apache-2.0" ]
135
2018-09-03T18:13:17.000Z
2022-03-17T12:22:54.000Z
src/main/java/am/ik/yavi/message/MessageSourceMessageFormatter.java
gakuzzzz/yavi
7cc47d1b1007723d57004dd13e1cf2e501ea8740
[ "Apache-2.0" ]
57
2018-08-28T12:42:07.000Z
2022-03-14T08:17:08.000Z
33.542857
105
0.716354
2,211
/* * Copyright (C) 2018-2021 Toshiaki Maki <[email protected]> * * 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 am.ik.yavi.message; import java.text.MessageFormat; import java.util.Locale; import java.util.Objects; import am.ik.yavi.jsr305.Nullable; /** * <code>MessageFormatter</code> implementation that delegates formatting to * <code>MessageSource</code>.<br> * This can adopt Spring Framework's <code>MessageSource</code> as follows: * * <pre> * <code> * org.springframework.context.MessageSource messageSource = ...; * Validator&lt;CartItem&gt; validator = ValidatorBuilder.&lt;CartItem&gt; of() * .messageFormatter(new MessageSourceMessageFormatter(messageSource::getMessage)) * .constraint(CartItem::getQuantity, "quantity", c -> c.greaterThan(0)) * .constraint(...) * .build(); * </code> * </pre> * * @author Toshiaki Maki * @since 0.5.0 */ public class MessageSourceMessageFormatter implements MessageFormatter { private final MessageSource messageSource; public MessageSourceMessageFormatter(MessageSource messageSource) { this.messageSource = messageSource; } @Override public String format(String messageKey, String defaultMessageFormat, Object[] args, Locale locale) { final String defaultMessage = new MessageFormat(defaultMessageFormat, locale) .format(args); final String message = this.messageSource.getMessage(messageKey, args, defaultMessage, locale); return Objects.requireNonNull(message, defaultMessage); } /** * A compatible interface of Spring Framework's <code>MessageSource</code>. */ @FunctionalInterface public interface MessageSource { @Nullable String getMessage(String code, Object[] args, String defaultMessage, Locale locale); } }
3e0545992dac9ec62731af9a1ca28400cb8ddc77
1,061
java
Java
niukit-bpm-parent/niukit-bpm-mgr/src/main/java/com/woshidaniu/component/bpm/management/process/instance/service/PorcessInstanceService.java
woshidaniu-com/niukit
b63ef035acc19f6868e2378a079b9c5c8d5bddc8
[ "Apache-2.0" ]
2
2020-10-16T01:08:36.000Z
2020-10-16T06:29:39.000Z
niukit-bpm-parent/niukit-bpm-mgr/src/main/java/com/woshidaniu/component/bpm/management/process/instance/service/PorcessInstanceService.java
woshidaniu-com/niukit
b63ef035acc19f6868e2378a079b9c5c8d5bddc8
[ "Apache-2.0" ]
4
2020-10-12T08:18:37.000Z
2020-10-12T08:18:37.000Z
niukit-bpm-parent/niukit-bpm-mgr/src/main/java/com/woshidaniu/component/bpm/management/process/instance/service/PorcessInstanceService.java
woshidaniu-com/niukit
b63ef035acc19f6868e2378a079b9c5c8d5bddc8
[ "Apache-2.0" ]
1
2022-02-10T03:07:03.000Z
2022-02-10T03:07:03.000Z
25.878049
99
0.763431
2,212
package com.woshidaniu.component.bpm.management.process.instance.service; import java.util.List; import java.util.Map; import org.activiti.engine.ProcessEngineConfiguration; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.woshidaniu.component.bpm.management.process.instance.dao.IProcessInstanceDao; @Service /** * * <p> * <h3>niutal框架<h3> * <br>说明:TODO * <br>class:com.woshidaniu.component.bpm.management.process.instance.service.InstanceService.java * <p> * @author <a href="#">Zhangxiaobin[1036]<a> * @version 2016年8月15日上午8:50:29 */ public class PorcessInstanceService { @Autowired protected IProcessInstanceDao dao; @Autowired protected ProcessEngineConfiguration processEnginConfiguration; /** * * <p>方法说明:获取跟踪流程信息<p> * <p>作者:a href="#">Zhangxiaobin[1036]<a><p> * <p>时间:2016年12月12日下午4:37:58<p> */ public List<Map<String,String>> traceProcessInstance(String processInstanceId){ return dao.getProcessInstanceComments(processInstanceId); } }