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
9238824be8c48180fd2a3d9719a26b4ae42217cf
2,092
java
Java
MSc Final Project/java/com/example/marthakat/sirarthurconandoyleinportsmouth/MapsActivity.java
katsikimartha/MSc-final-project
e131322de5aab78a06bdde10e538d40ee2c54050
[ "MIT" ]
null
null
null
MSc Final Project/java/com/example/marthakat/sirarthurconandoyleinportsmouth/MapsActivity.java
katsikimartha/MSc-final-project
e131322de5aab78a06bdde10e538d40ee2c54050
[ "MIT" ]
null
null
null
MSc Final Project/java/com/example/marthakat/sirarthurconandoyleinportsmouth/MapsActivity.java
katsikimartha/MSc-final-project
e131322de5aab78a06bdde10e538d40ee2c54050
[ "MIT" ]
null
null
null
40.230769
99
0.736138
998,459
package com.example.marthakat.sirarthurconandoyleinportsmouth; import android.support.v4.app.FragmentActivity; import android.os.Bundle; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.OnMapReadyCallback; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; public class MapsActivity extends FragmentActivity implements OnMapReadyCallback { private GoogleMap mMap; /*This activity is not being used anymore It is not part of the development process anymore but its layout is used as part of MainMenu's layout*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_maps); // Obtain the SupportMapFragment and get notified when the map is ready to be used. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used. * This is where we can add markers or lines, add listeners or move the camera. In this case, * we just add a marker near Sydney, Australia. * If Google Play services is not installed on the device, the user will be prompted to install * it inside the SupportMapFragment. This method will only be triggered once the user has * installed Google Play services and returned to the app. */ @Override public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Add a marker in Portsmouth and move the camera LatLng portsmouth = new LatLng(-1.092499, 50.797193); mMap.addMarker(new MarkerOptions().position(portsmouth).title("Marker in Portsmouth")); mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(portsmouth, 14)); } }
9238827150a4816ba092bb0e46c8ac7ee7adfe41
571
java
Java
app/src/main/java/com/epicodus/talkaboutit/models/Comment.java
annarbecker/TalkAboutIt
5deec5cc28f48d861d9a3cca2b2efb005f754aae
[ "Unlicense", "MIT" ]
19
2017-11-16T08:53:39.000Z
2022-02-26T08:05:36.000Z
app/src/main/java/com/epicodus/talkaboutit/models/Comment.java
annarbecker/TalkAboutIt
5deec5cc28f48d861d9a3cca2b2efb005f754aae
[ "Unlicense", "MIT" ]
2
2018-02-04T09:12:32.000Z
2020-10-28T03:16:56.000Z
app/src/main/java/com/epicodus/talkaboutit/models/Comment.java
annarbecker/TalkAboutIt
5deec5cc28f48d861d9a3cca2b2efb005f754aae
[ "Unlicense", "MIT" ]
12
2017-08-22T16:27:00.000Z
2021-12-29T12:03:05.000Z
16.794118
61
0.597198
998,460
package com.epicodus.talkaboutit.models; import org.parceler.Parcel; /** * Created by Guest on 5/2/16. */ @Parcel public class Comment { public String author; public String body; public String post; public Comment(String author, String body, String post) { this.author = author; this.body = body; this.post = post; } public Comment() {} public String getBody() { return body; } public String getAuthor() { return author; } public String getPost() { return post; } }
923882aeb37cbc9dd8b94040340d1168a87a5acc
1,867
java
Java
AvroImporter/src/main/java/aksw/org/sdw/importer/avro/annotations/Provenance.java
AKSW/SmartDataWeb
cd2a48c86f66bc59841805406bcb3e8168038859
[ "Apache-2.0" ]
2
2016-04-13T12:46:31.000Z
2018-02-07T18:16:01.000Z
AvroImporter/src/main/java/aksw/org/sdw/importer/avro/annotations/Provenance.java
AKSW/SmartDataWeb
cd2a48c86f66bc59841805406bcb3e8168038859
[ "Apache-2.0" ]
4
2017-08-08T14:36:57.000Z
2021-05-12T00:18:18.000Z
AvroImporter/src/main/java/aksw/org/sdw/importer/avro/annotations/Provenance.java
AKSW/SmartDataWeb
cd2a48c86f66bc59841805406bcb3e8168038859
[ "Apache-2.0" ]
1
2020-01-03T06:44:54.000Z
2020-01-03T06:44:54.000Z
23.3375
77
0.645956
998,461
package aksw.org.sdw.importer.avro.annotations; import java.util.Date; import com.google.gson.Gson; /** * Class which can be used to store provenance information * * @author kay * */ public class Provenance { public String source; public String annotator; public String license; public float score = 0f; public Date date; @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((annotator == null) ? 0 : annotator.hashCode()); result = prime * result + ((date == null) ? 0 : date.hashCode()); result = prime * result + ((license == null) ? 0 : license.hashCode()); result = prime * result + Float.floatToIntBits(score); result = prime * result + ((source == null) ? 0 : source.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Provenance other = (Provenance) obj; if (annotator == null) { if (other.annotator != null) return false; } else if (!annotator.equals(other.annotator)) return false; if (date == null) { if (other.date != null) return false; } else if (!date.equals(other.date)) return false; if (license == null) { if (other.license != null) return false; } else if (!license.equals(other.license)) return false; if (Float.floatToIntBits(score) != Float.floatToIntBits(other.score)) return false; if (source == null) { if (other.source != null) return false; } else if (!source.equals(other.source)) return false; return true; } public String toJson() { Gson gson = new Gson(); String json = gson.toJson(this); return json; } @Override public String toString() { Gson gson = new Gson(); String json = gson.toJson(this); return json; } }
9238834f1879f4190197fe27ebdee4c366c78d5c
741
java
Java
blog-20200526/src/main/java/cn/shrmus/blog/service/AlbumService.java
ShrMus/ShrMus-Blog
da414a853c8fdad9ddc9683746e3a63e9b6ac171
[ "Apache-2.0" ]
null
null
null
blog-20200526/src/main/java/cn/shrmus/blog/service/AlbumService.java
ShrMus/ShrMus-Blog
da414a853c8fdad9ddc9683746e3a63e9b6ac171
[ "Apache-2.0" ]
null
null
null
blog-20200526/src/main/java/cn/shrmus/blog/service/AlbumService.java
ShrMus/ShrMus-Blog
da414a853c8fdad9ddc9683746e3a63e9b6ac171
[ "Apache-2.0" ]
null
null
null
26.464286
72
0.817814
998,462
package cn.shrmus.blog.service; import cn.shrmus.blog.pojo.BlogAlbum; import cn.shrmus.blog.pojo.BlogPicture; import org.springframework.web.multipart.MultipartFile; import java.util.List; public interface AlbumService { public List<BlogAlbum> getListByUserId(Integer userId); public void addAlbum(BlogAlbum blogAlbum); public List<BlogPicture> getPicturesByAlbumId(Integer albumId); public BlogAlbum getAlbumById(Integer albumId); public List<BlogAlbum> getAlbumListByUserId(Integer userId); public void uploadPicture(MultipartFile[] uploadFile, Integer albumId); public void deletePicture(List<BlogPicture> blogPictureList); public void updateAlbum(BlogAlbum blogAlbum); public void deleteAlbum(BlogAlbum blogAlbum); }
923883c87a24458368f3abc07196e66e00044c4d
1,441
java
Java
experiments/storm/src/main/java/org/apache/gearpump/experiments/storm/util/TimeCacheMapWrapper.java
fossabot/gearpump
5f77fc830ddcdc3ccb8fe966b3489d0dfad0008c
[ "Apache-2.0" ]
null
null
null
experiments/storm/src/main/java/org/apache/gearpump/experiments/storm/util/TimeCacheMapWrapper.java
fossabot/gearpump
5f77fc830ddcdc3ccb8fe966b3489d0dfad0008c
[ "Apache-2.0" ]
1
2021-11-04T12:32:26.000Z
2021-11-04T12:32:26.000Z
experiments/storm/src/main/java/org/apache/gearpump/experiments/storm/util/TimeCacheMapWrapper.java
isabella232/incubator-retired-gearpump
7bc1a506ae0dfbe9359952d3fc96a49d3035cf75
[ "Apache-2.0" ]
null
null
null
34.309524
93
0.726579
998,463
/* * 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.gearpump.experiments.storm.util; import backtype.storm.utils.TimeCacheMap; /** * Wrapper class to suppress "deprecation" warning, as scala doesn't support the suppression. */ @SuppressWarnings("deprecation") public class TimeCacheMapWrapper<K, V> extends TimeCacheMap<K, V> { public TimeCacheMapWrapper (int expirationSecs, Callback<K, V> callback) { super(expirationSecs, new ExpiredCallback<K, V>() { @Override public void expire(K key, V val) { callback.expire(key, val); } }); } public static interface Callback<K, V> { public void expire(K key, V val); } }
9238841da0bc320e1d4366690f5f8d1404c425ea
848
java
Java
chapter_011/IoC/src/main/java/ru/evgenyhodz/MemoryStorage.java
m1ndcoderr/learning_java
e9977f7ea647eac9164042ecc95a218b1afb800e
[ "Apache-2.0" ]
null
null
null
chapter_011/IoC/src/main/java/ru/evgenyhodz/MemoryStorage.java
m1ndcoderr/learning_java
e9977f7ea647eac9164042ecc95a218b1afb800e
[ "Apache-2.0" ]
null
null
null
chapter_011/IoC/src/main/java/ru/evgenyhodz/MemoryStorage.java
m1ndcoderr/learning_java
e9977f7ea647eac9164042ecc95a218b1afb800e
[ "Apache-2.0" ]
null
null
null
19.363636
79
0.564554
998,464
package ru.evgenyhodz; import org.apache.log4j.Logger; import java.util.ArrayList; /** * @author Evgeny Khodzitskiy (nnheo@example.com) * @since 17.08.2017 */ public class MemoryStorage implements Storage { /** * Logger. */ private static final Logger LOGGER = Logger.getLogger(MemoryStorage.class); /** * User storage. */ private ArrayList<User> storage = new ArrayList<>(); /** * Getter. * * @return ArrayList. */ public ArrayList<User> getStorage() { return storage; } /** * Adds user to storage. * * @param user user. */ @Override public void add(User user) { try { this.storage.add(user); } catch (Exception e) { LOGGER.error("MemoryStorage add user exception: " + e); } } }
9238842bc8d2ba2238256887415602a49f575090
13,184
java
Java
src/metabot/MetaBot.java
andertavares/sarsabot
b831edf07ce4cae90beca01f09f58f53bb6a11bf
[ "MIT" ]
null
null
null
src/metabot/MetaBot.java
andertavares/sarsabot
b831edf07ce4cae90beca01f09f58f53bb6a11bf
[ "MIT" ]
null
null
null
src/metabot/MetaBot.java
andertavares/sarsabot
b831edf07ce4cae90beca01f09f58f53bb6a11bf
[ "MIT" ]
3
2019-05-15T14:16:58.000Z
2021-08-19T15:42:53.000Z
32.79602
138
0.596936
998,465
package metabot; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import ai.PassiveAI; import ai.abstraction.HeavyRush; import ai.abstraction.LightRush; import ai.abstraction.RangedRush; import ai.abstraction.WorkerRush; import ai.core.AI; import ai.core.ParameterSpecification; import config.ConfigManager; import metabot.portfolio.BuildBarracks; import metabot.portfolio.Expand; import rl.Sarsa; import rts.GameState; import rts.PlayerAction; import rts.units.UnitTypeTable; import utils.FileNameUtil; public class MetaBot extends AI { UnitTypeTable myUnitTypeTable = null; Logger logger; /** * Stores MetaBot-related configurations loaded from a .property file */ private Properties config; /** * An array of AI's, which are used as 'sub-bots' to play the game. * In our academic wording, this is the portfolio of algorithms that play the game. */ private Map<String,AI> portfolio; private Sarsa learningAgent; /** * Stores the choices made for debugging purposes */ private List<String> choices; /** * Stores the player number to retrieve actions and determine match outcome */ int myPlayerNumber; // BEGIN -- variables to feed the learning agent private GameState previousState; private GameState currentState; private AI choice; double reward; // END-- variables to feed the learning agent /** * Initializes MetaBot with default configurations * @param utt */ public MetaBot(UnitTypeTable utt) { // calls the other constructor, specifying the default config file this(utt, "metabot.properties"); } /** * Initializes MetaBot, loading the configurations from properties * @param utt * @param metaBotConfig */ public MetaBot(UnitTypeTable utt, Properties metaBotConfig) { myUnitTypeTable = utt; config = metaBotConfig; logger = LogManager.getLogger(MetaBot.class); // Loads the configuration String members = config.getProperty("portfolio.members"); if (members == null) { // logger.error("Error while loading configuration from '" + configPath+ "'. Using defaults.", e); members = "WorkerRush, LightRush, RangedRush, HeavyRush, Expand, BuildBarracks"; } setupPortifolio(members); // Creates the learning agent with the specified portfolio and loaded parameters learningAgent = new Sarsa(portfolio, config); if (config.containsKey("rl.bin_input")) { try { learningAgent.loadBin(config.getProperty("rl.bin_input")); } catch (IOException e) { logger.error("Error while loading weights from " + config.getProperty("rl.input"), e); logger.error("Weights initialized randomly."); e.printStackTrace(); } } reset(); } /** * Initializes MetaBot, loading the configurations from the specified file * @param utt * @param configPath */ public MetaBot(UnitTypeTable utt, String configPath){ myUnitTypeTable = utt; logger = LogManager.getLogger(MetaBot.class); // loads the configuration String members; try { config = ConfigManager.loadConfig(configPath); members = config.getProperty("portfolio.members"); } catch (IOException e) { logger.error("Error while loading configuration from '" + configPath+ "'. Using defaults.", e); members = "WorkerRush, LightRush, RangedRush, HeavyRush, Expand, BuildBarracks"; } setupPortifolio(members); // creates the learning agent with the specified portfolio and loaded parameters learningAgent = new Sarsa(portfolio, config); if (config.containsKey("rl.bin_input")) { try { learningAgent.loadBin(config.getProperty("rl.bin_input")); } catch (IOException e) { logger.error("Error while loading weights from " + config.getProperty("rl.input"), e); logger.error("Weights initialized randomly."); e.printStackTrace(); } } // else if (config.containsKey("rl.workingdir")) { // String dir = config.getProperty("rl.workingdir"); // if (dir.charAt(dir.length()-1) != '/') { // dir = dir + "/"; // } // try { // learningAgent.loadBin(dir + "weights_" + myPlayerNumber + ".bin"); // } catch (IOException e) { // logger.error("Error while loading weights from " + dir + "weights_" + myPlayerNumber + ".bin", e); // logger.error("Weights initialized randomly."); // e.printStackTrace(); // } // } reset(); } /** * Saves the weight 'vector' to a file in the specified path * by serializing the weights HashMap. * The file is overridden if already exists. * @param path * @throws IOException */ // public void saveBin(String path) throws IOException { // learningAgent.saveBin(path); // } /** * Saves the weights in human-readable (csv) format. Creates one file * for each portfolio member and appends a line with the weights separated by comma. * The order of weights is as given by weights.get(portfolioMember).values() * * @param prefix * @throws IOException */ // public void saveHuman(String prefix) throws IOException { // learningAgent.saveHuman(prefix); // } /** * Loads the weight 'vector' from a file in the specified path * by de-serializing the weights HashMap * @param path * @throws IOException */ // public void loadBin(String path) throws IOException { // learningAgent.loadBin(path); // } private void setupPortifolio(String members) { String[] memberNames = members.split(","); logger.trace("Portfolio members: ", String.join(",", memberNames)); //loads the portfolio according to the file specification portfolio = new HashMap<>(); //TODO get rid of this for-switch and do something like https://stackoverflow.com/a/6094609/1251716 for(String name : memberNames ){ name = name.trim(); if(name.equalsIgnoreCase("WorkerRush")){ portfolio.put("WorkerRush", new WorkerRush (myUnitTypeTable)); } else if(name.equalsIgnoreCase("LightRush")){ portfolio.put("LightRush", new LightRush (myUnitTypeTable)); } else if(name.equalsIgnoreCase("RangedRush")){ portfolio.put("RangedRush", new RangedRush (myUnitTypeTable)); } else if(name.equalsIgnoreCase("HeavyRush")){ portfolio.put("HeavyRush", new HeavyRush (myUnitTypeTable)); } else if(name.equalsIgnoreCase("Expand")){ portfolio.put("Expand", new Expand (myUnitTypeTable)); } else if(name.equalsIgnoreCase("BuildBarracks")){ portfolio.put("BuildBarracks", new BuildBarracks (myUnitTypeTable)); } else if(name.equalsIgnoreCase("PassiveAI")) { portfolio.put("PassiveAI", new PassiveAI(myUnitTypeTable)); } else throw new RuntimeException("Unknown portfolio member '" + name +"'"); } } public void preGameAnalysis(GameState gs, long milliseconds) throws Exception { } public void preGameAnalysis(GameState gs, long milliseconds, String readWriteFolder) throws Exception { } /** * Resets the portfolio with the new unit type table */ public void reset(UnitTypeTable utt) { myUnitTypeTable = utt; for(AI ai : portfolio.values()){ ai.reset(utt); } reset(); } /** * Is called at the beginning of every game. Resets all AIs in the portfolio * and my internal variables. It does not reset the weight vector */ public void reset() { for(AI ai : portfolio.values()){ ai.reset(); } choice = null; previousState = null; currentState = null; myPlayerNumber = -1; learningAgent.resetChoice(); choices = new ArrayList<>(3000); } public PlayerAction getAction(int player, GameState state) { // sets to a valid number on the first call if(myPlayerNumber == -1){ myPlayerNumber = player; } // verifies if the number I set previously holds if(myPlayerNumber != player){ throw new RuntimeException( "Called with wrong player number " + player + ". Was expecting: " + myPlayerNumber ); } if(!state.canExecuteAnyAction(player)) { PlayerAction pa = new PlayerAction(); pa.fillWithNones(state, player, 1); return pa; } // makes the learning agent learn previousState = currentState; currentState = state.clone(); if (previousState != null) reward = 0; if (state.gameover()){ if(state.winner() == player) reward = 1; if(state.winner() == 1-player) reward = -1; else reward = 0; } learningAgent.learn(previousState, choice, reward, currentState, currentState.gameover(), player); // selected is the AI that will perform our action, let's try it: choice = learningAgent.act(state, player); choices.add(choice.getClass().getSimpleName()); try { return choice.getAction(player, state); } catch (Exception e) { logger.error("Exception while getting action in frame #" + state.getTime() + " from " + choice.getClass().getSimpleName(), e); logger.error("Defaulting to empty action"); e.printStackTrace(); PlayerAction pa = new PlayerAction(); pa.fillWithNones(state, player, 1); return pa; } } public void gameOver(int winner) throws Exception { if (winner == -1) reward = 0; //game not finished (timeout) or draw else if (winner == myPlayerNumber) reward = 1; //I won else reward = -1; //I lost learningAgent.learn(currentState, choice, reward, null, true, myPlayerNumber); // tests whether the output prefix has been specified to save the weights (binary) // if (config.containsKey("rl.output.binprefix")) { // String filename = FileNameUtil.nextAvailableFileName( // config.getProperty("rl.output.binprefix"), "weights" // ); // learningAgent.saveBin(filename); // } // tests whether the output prefix has been specified to save the weights (human-readable) // if (config.containsKey("rl.output.humanprefix")) { // learningAgent.saveHuman(config.getProperty("rl.output.humanprefix")); // } if (config.containsKey("rl.save_weights_bin")) { if (config.getProperty("rl.save_weights_bin").equalsIgnoreCase("True")) { String dir = config.getProperty("rl.workingdir","weights/"); if (dir.charAt(dir.length()-1) != '/') { dir = dir + "/"; } learningAgent.saveBin(dir + "weights_" + myPlayerNumber + ".bin"); } } if (config.containsKey("rl.save_weights_human")) { if (config.getProperty("rl.save_weights_human").equalsIgnoreCase("True")) { String dir = config.getProperty("rl.workingdir","weights/"); if (dir.charAt(dir.length()-1) != '/') { dir = dir + "/"; } learningAgent.saveHuman(dir + "weights_" + myPlayerNumber); } } // check if it needs to save the choices if (config.containsKey("output.choices_prefix")){ // finds the file name String filename = FileNameUtil.nextAvailableFileName( config.getProperty("output.choices_prefix"), "choices" ); // saves the weights FileWriter writer = new FileWriter(filename); writer.write(String.join("\n", choices)); writer.close(); } } public AI clone() { //FIXME copy features, weights and other attributes! return new MetaBot(myUnitTypeTable); } // This will be called by the microRTS GUI to get the // list of parameters that this bot wants exposed // in the GUI. public List<ParameterSpecification> getParameters() { return new ArrayList<>(); } }
923885691a0636699ae49a919f613cc0a8e09d36
400
java
Java
src/main/java/com/kmalysiak/propcopiersbench/PersonDto/Person.java
kmalysiak/PropCopiersBench
6c207061925da7a40cc2986e1697f5f5073d71f7
[ "Apache-2.0" ]
1
2020-02-02T09:02:50.000Z
2020-02-02T09:02:50.000Z
src/main/java/com/kmalysiak/propcopiersbench/PersonDto/Person.java
kmalysiak/PropCopiersBench
6c207061925da7a40cc2986e1697f5f5073d71f7
[ "Apache-2.0" ]
null
null
null
src/main/java/com/kmalysiak/propcopiersbench/PersonDto/Person.java
kmalysiak/PropCopiersBench
6c207061925da7a40cc2986e1697f5f5073d71f7
[ "Apache-2.0" ]
null
null
null
19.047619
49
0.755
998,466
package com.kmalysiak.propcopiersbench.PersonDto; import lombok.Getter; import lombok.Setter; import java.time.LocalDate; @Setter @Getter public class Person { private String firstName; private String secondName; private String lastName; private Integer age; private LocalDate birth; private String nationality; private String idNumber; private Address address; }
9238856f90f3c4f78e71408fc3879e968c063d2f
1,583
java
Java
Eager/roots/core/src/test/java/edu/ucsb/cs/roots/anomaly/TestAnomalyDetector.java
UCSB-CS-RACELab/eager-appscale
d58fe64bb867ef58af19c1d84a5e1ec68ecddd3d
[ "Apache-2.0" ]
3
2016-06-12T01:18:49.000Z
2018-07-16T18:20:23.000Z
Eager/roots/core/src/test/java/edu/ucsb/cs/roots/anomaly/TestAnomalyDetector.java
UCSB-CS-RACELab/eager-appscale
d58fe64bb867ef58af19c1d84a5e1ec68ecddd3d
[ "Apache-2.0" ]
null
null
null
Eager/roots/core/src/test/java/edu/ucsb/cs/roots/anomaly/TestAnomalyDetector.java
UCSB-CS-RACELab/eager-appscale
d58fe64bb867ef58af19c1d84a5e1ec68ecddd3d
[ "Apache-2.0" ]
1
2020-05-25T02:59:15.000Z
2020-05-25T02:59:15.000Z
26.383333
93
0.633607
998,467
package edu.ucsb.cs.roots.anomaly; import edu.ucsb.cs.roots.RootsEnvironment; public final class TestAnomalyDetector extends AnomalyDetector { private final AnomalyDetectorFunction function; private final long waitDuration; private TestAnomalyDetector(RootsEnvironment environment, Builder builder) { super(environment, builder); this.function = builder.function; this.waitDuration = builder.waitDuration; } @Override public void run(long now) { if (function != null) { function.run(now, this); } } public static Builder newBuilder() { return new Builder(); } public static class Builder extends AnomalyDetectorBuilder<TestAnomalyDetector,Builder> { private AnomalyDetectorFunction function; private long waitDuration = -1L; private Builder() { } public Builder setFunction(AnomalyDetectorFunction function) { this.function = function; return this; } public Builder setWaitDuration(long waitDuration) { this.waitDuration = waitDuration; return this; } @Override public TestAnomalyDetector build(RootsEnvironment environment) { return new TestAnomalyDetector(environment, this); } @Override protected Builder getThisObj() { return this; } } public interface AnomalyDetectorFunction { void run(long now, TestAnomalyDetector detector); } }
9238862384f88cc6a9a9c7f575fce9e1b832be39
3,357
java
Java
src/main/java/org/openxmlformats/schemas/wordprocessingml/x2006/main/STHeightRule.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
src/main/java/org/openxmlformats/schemas/wordprocessingml/x2006/main/STHeightRule.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
src/main/java/org/openxmlformats/schemas/wordprocessingml/x2006/main/STHeightRule.java
pjfanning/poi-ooxml-lite-build
34af44251cb99fcdf8de2f844af686da8870e7db
[ "Apache-2.0" ]
null
null
null
38.586207
220
0.685433
998,468
/* * XML Type: ST_HeightRule * Namespace: http://schemas.openxmlformats.org/wordprocessingml/2006/main * Java type: org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule * * Automatically generated - do not modify. */ package org.openxmlformats.schemas.wordprocessingml.x2006.main; import org.apache.xmlbeans.impl.schema.ElementFactory; import org.apache.xmlbeans.impl.schema.AbstractDocumentFactory; import org.apache.xmlbeans.impl.schema.DocumentFactory; import org.apache.xmlbeans.impl.schema.SimpleTypeFactory; /** * An XML ST_HeightRule(@http://schemas.openxmlformats.org/wordprocessingml/2006/main). * * This is an atomic type that is a restriction of org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule. */ public interface STHeightRule extends org.apache.xmlbeans.XmlString { SimpleTypeFactory<org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule> Factory = new SimpleTypeFactory<>(org.apache.poi.schemas.ooxml.system.ooxml.TypeSystemHolder.typeSystem, "stheightrulea535type"); org.apache.xmlbeans.SchemaType type = Factory.getType(); org.apache.xmlbeans.StringEnumAbstractBase getEnumValue(); void setEnumValue(org.apache.xmlbeans.StringEnumAbstractBase e); Enum AUTO = Enum.forString("auto"); Enum EXACT = Enum.forString("exact"); Enum AT_LEAST = Enum.forString("atLeast"); int INT_AUTO = Enum.INT_AUTO; int INT_EXACT = Enum.INT_EXACT; int INT_AT_LEAST = Enum.INT_AT_LEAST; /** * Enumeration value class for org.openxmlformats.schemas.wordprocessingml.x2006.main.STHeightRule. * These enum values can be used as follows: * <pre> * enum.toString(); // returns the string value of the enum * enum.intValue(); // returns an int value, useful for switches * // e.g., case Enum.INT_AUTO * Enum.forString(s); // returns the enum value for a string * Enum.forInt(i); // returns the enum value for an int * </pre> * Enumeration objects are immutable singleton objects that * can be compared using == object equality. They have no * public constructor. See the constants defined within this * class for all the valid values. */ final class Enum extends org.apache.xmlbeans.StringEnumAbstractBase { /** * Returns the enum value for a string, or null if none. */ public static Enum forString(java.lang.String s) { return (Enum)table.forString(s); } /** * Returns the enum value corresponding to an int, or null if none. */ public static Enum forInt(int i) { return (Enum)table.forInt(i); } private Enum(java.lang.String s, int i) { super(s, i); } static final int INT_AUTO = 1; static final int INT_EXACT = 2; static final int INT_AT_LEAST = 3; public static final org.apache.xmlbeans.StringEnumAbstractBase.Table table = new org.apache.xmlbeans.StringEnumAbstractBase.Table(new Enum[] { new Enum("auto", INT_AUTO), new Enum("exact", INT_EXACT), new Enum("atLeast", INT_AT_LEAST), }); private static final long serialVersionUID = 1L; private java.lang.Object readResolve() { return forInt(intValue()); } } }
9238865d4b195a55170e0d127b220ec457979b99
818
java
Java
src/test/java/org/apache/ibatis/submitted/deferload_common_property/ChildMapper.java
donaldLiuLiu/mybatis-3-mybatis-3.5.4
3409008f0bb53ff8210f6f0eaaa5fe0caf66407c
[ "ECL-2.0", "Apache-2.0" ]
29
2020-05-06T05:25:54.000Z
2022-02-27T16:33:47.000Z
src/test/java/org/apache/ibatis/submitted/deferload_common_property/ChildMapper.java
donaldLiuLiu/mybatis-3-mybatis-3.5.4
3409008f0bb53ff8210f6f0eaaa5fe0caf66407c
[ "ECL-2.0", "Apache-2.0" ]
95
2020-12-21T01:48:43.000Z
2022-03-09T14:06:00.000Z
src/test/java/org/apache/ibatis/submitted/deferload_common_property/ChildMapper.java
345402403/mybaitis_source
b00e1c45862ae1c3a7f5850acd1dff428fcd1176
[ "ECL-2.0", "Apache-2.0" ]
7
2020-05-06T04:09:12.000Z
2022-02-27T16:33:42.000Z
35.565217
78
0.724939
998,469
/** * Copyright ${license.git.copyrightYears} the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.submitted.deferload_common_property; import java.util.List; public interface ChildMapper { List<Child> selectAll(); }
9238866e5f1944b3913dc3f05297a55d2da70943
1,866
java
Java
Examples/src/main/java/com/aspose/ocr/examples/OcrFeatures/OCROperationWithLanguageSelection.java
aspose-ocr/Aspose.OCR-for-Java
8e7e0fbf2c4c6cc5a9454030af798a0b15b7c92d
[ "MIT" ]
22
2016-06-19T17:34:38.000Z
2021-12-28T01:14:41.000Z
Examples/src/main/java/com/aspose/ocr/examples/OcrFeatures/OCROperationWithLanguageSelection.java
aspose-ocr/Aspose.OCR-for-Java
8e7e0fbf2c4c6cc5a9454030af798a0b15b7c92d
[ "MIT" ]
3
2016-08-30T15:48:38.000Z
2021-11-29T15:21:09.000Z
Examples/src/main/java/com/aspose/ocr/examples/OcrFeatures/OCROperationWithLanguageSelection.java
aspose-ocr/Aspose.OCR-for-Java
8e7e0fbf2c4c6cc5a9454030af798a0b15b7c92d
[ "MIT" ]
24
2016-04-09T07:29:18.000Z
2021-11-01T15:57:21.000Z
29.619048
84
0.707395
998,470
package com.aspose.ocr.examples.OcrFeatures; import com.aspose.ocr.AsposeOCR; import com.aspose.ocr.Language; import com.aspose.ocr.License; import com.aspose.ocr.RecognitionResult; import com.aspose.ocr.RecognitionSettings; import com.aspose.ocr.examples.License.SetLicense; import com.aspose.ocr.examples.Utils; import java.awt.*; import java.io.IOException; import java.util.ArrayList; public class OCROperationWithLanguageSelection { public static void main(String[] args) { // ExStart:1 // The path to the documents directory. String dataDir = Utils.getSharedDataDir(OCROperationWithLanguageSelection.class); // The image path String file = dataDir + "p3.png"; //Create api instance AsposeOCR api = new AsposeOCR(); // set recognition options RecognitionSettings settings = new RecognitionSettings(); settings.setAutoSkew(false); ArrayList<Rectangle> rectangles = new ArrayList<Rectangle>(); rectangles.add(new Rectangle(90,186,775,95)); settings.setRecognitionAreas(rectangles); settings.setSkew(0.5); settings.setLanguage(Language.Eng); // get result object RecognitionResult result = null; try { result = api.RecognizePage(file, settings); } catch (IOException e) { e.printStackTrace(); } // print result System.out.println("Result: \n" + result.recognitionText+"\n\n"); for(String n: result.recognitionAreasText) { System.out.println ( n ); } for(Rectangle n: result.recognitionAreasRectangles) { System.out.println(n.height+":"+n.width+":"+n.x+":"+n.y); } System.out.println("\nJSON:" + result.GetJson()); System.out.println("angle:" + result.skew); for(String n: result.warnings) { System.out.println ( n ); } // ExEnd:1 System.out.println("OCROperationWithLanguageSelection: execution complete"); } }
923886fdcd338bd9df047f2cc26d96b17a54db4c
4,145
java
Java
app/src/main/java/com/example/android/newsapp/ArticleAdapter.java
najens/NewsApp
387cc49e08fb6f288bd8bc686cd744ea2ee9ec52
[ "MIT" ]
null
null
null
app/src/main/java/com/example/android/newsapp/ArticleAdapter.java
najens/NewsApp
387cc49e08fb6f288bd8bc686cd744ea2ee9ec52
[ "MIT" ]
null
null
null
app/src/main/java/com/example/android/newsapp/ArticleAdapter.java
najens/NewsApp
387cc49e08fb6f288bd8bc686cd744ea2ee9ec52
[ "MIT" ]
null
null
null
37.681818
95
0.638601
998,471
package com.example.android.newsapp; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import com.example.android.newsapp.image.DownloadImageTask; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; /** * Created by Nate on 10/20/2017. */ public class ArticleAdapter extends ArrayAdapter<Article> { private long timeInMilliseconds; public ArticleAdapter(Context context, List<Article> articles) { super(context, 0, articles); } @Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate( R.layout.list_item, parent, false); } Article currentArticle = getItem(position); TextView titleTextView = (TextView) convertView.findViewById(R.id.title_text_view); titleTextView.setText(currentArticle.getTitle()); TextView subjectTextView = (TextView) convertView.findViewById(R.id.subject_text_view); subjectTextView.setText(currentArticle.getSubject()); TextView authorTextView = (TextView) convertView.findViewById(R.id.author_text_view); authorTextView.setText(currentArticle.getAuthor()); String date = (currentArticle.getDate()); SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX"); try { Date dateObject = dateFormatter.parse(date); timeInMilliseconds = dateObject.getTime(); } catch (ParseException e) { e.printStackTrace(); } long currentTime = System.currentTimeMillis(); long timeElapsed = currentTime - timeInMilliseconds; long timeSeconds = timeElapsed / 1000; String time = getTimeAsString(timeSeconds); TextView dateTextView = (TextView) convertView.findViewById(R.id.date_text_view); dateTextView.setText(time); String thumbnail = currentArticle.getThumbnail(); ImageView thumbnailImageView = (ImageView) convertView .findViewById(R.id.thumbnail_image_view); if (thumbnail == "No Image") { thumbnailImageView.setImageResource(R.drawable.no_image); } else { new DownloadImageTask(thumbnailImageView) .execute(currentArticle.getThumbnail()); } return convertView; } // Method to to display time elapsed in seconds, minutes, hours, days, etc. private String getTimeAsString(long seconds) { if (seconds < 60) { // rule 1 return String.format("%s seconds ago", seconds); } else if (seconds < 120) { return String.format("%s minute ago", seconds / 60); } else if (seconds < 3600) { // rule 2 return String.format("%s minutes ago", seconds / 60); } else if (seconds < 7200) { return String.format("%s hour ago", seconds / 3600); } else if (seconds < 86400) { return String.format("%s hours ago", seconds / 3600); } else if (seconds < 172800) { return String.format("%s day ago", seconds / 86400); } else if (seconds < 604800) { return String.format("%s days ago", seconds / 86400); } else if (seconds < 1209600) { return String.format("%s week ago", seconds / 604800); } else if (seconds < 2629800) { return String.format("%s weeks ago", seconds / 604800); } else if (seconds < 5259600) { return String.format("%s month ago", seconds / 2629800); } else if (seconds < 31557600) { return String.format("%s months ago", seconds / 2629800); } else if (seconds < 63115200) { return String.format("%s year ago", seconds / 31557600); } else { return String.format("%s years ago", seconds / 31557600); } } }
9238876656868f9018581bc6d07969626e864660
2,128
java
Java
arms/src/main/java/com/jess/arms/mvp/IView.java
coypanglei/zongzhi
bc31d496533a342f0b6804ad6f7dc81c7314690b
[ "Apache-2.0" ]
null
null
null
arms/src/main/java/com/jess/arms/mvp/IView.java
coypanglei/zongzhi
bc31d496533a342f0b6804ad6f7dc81c7314690b
[ "Apache-2.0" ]
null
null
null
arms/src/main/java/com/jess/arms/mvp/IView.java
coypanglei/zongzhi
bc31d496533a342f0b6804ad6f7dc81c7314690b
[ "Apache-2.0" ]
1
2021-02-05T05:14:05.000Z
2021-02-05T05:14:05.000Z
21.494949
88
0.600564
998,472
/* * Copyright 2017 JessYan * * 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.jess.arms.mvp; import android.app.Activity; import android.content.Intent; import androidx.annotation.NonNull; import com.jess.arms.utils.ArmsUtils; import static com.jess.arms.utils.Preconditions.checkNotNull; /** * ================================================ * 框架要求框架中的每个 View 都需要实现此类, 以满足规范 * <p> * 为了满足部分人的诉求以及向下兼容, {@link IView} 中的部分方法使用 JAVA 1.8 的默认方法实现, 这样实现类可以按实际需求选择是否实现某些方法 * 不实现则使用默认方法中的逻辑, 不清楚默认方法的请自行学习 * * @see <a href="https://github.com/JessYanCoding/MVPArms/wiki#2.4.2">View wiki 官方文档</a> * Created by JessYan on 4/22/2016 * <p> * <p> * ================================================ */ public interface IView { /** * 显示加载 */ default void showLoading() { } /** * 隐藏加载 */ default void hideLoading() { } /** * 隐藏或结束加载更多 * true 结束 false 隐藏 * * @param b b 是否隐藏 */ default void LoadingMore(boolean b) { } /** * 显示信息 * * @param message 消息内容, 不能为 {@code null} */ void showMessage(@NonNull String message); /** * 跳转 {@link Activity} * * @param intent {@code intent} 不能为 {@code null} */ default void launchActivity(@NonNull Intent intent) { checkNotNull(intent); ArmsUtils.startActivity(intent); } /** * 挑战界面通过 路由 * * @param path */ default void launchActivityByRouter(@NonNull String path) { checkNotNull(path); } /** * 杀死自己 */ default void killMyself() { } }
92388961b9c029df49ac486fe3b3abec379fb6ca
3,281
java
Java
client/src/test/java/com/humanharvest/organz/controller/client/ViewProceduresControllerClientTest.java
tomkearsley/OrgaNZ
38bbc4f0d19bc4aa2cfd7a9f5923e7edd910414d
[ "Apache-2.0" ]
null
null
null
client/src/test/java/com/humanharvest/organz/controller/client/ViewProceduresControllerClientTest.java
tomkearsley/OrgaNZ
38bbc4f0d19bc4aa2cfd7a9f5923e7edd910414d
[ "Apache-2.0" ]
null
null
null
client/src/test/java/com/humanharvest/organz/controller/client/ViewProceduresControllerClientTest.java
tomkearsley/OrgaNZ
38bbc4f0d19bc4aa2cfd7a9f5923e7edd910414d
[ "Apache-2.0" ]
null
null
null
34.904255
102
0.670832
998,473
package com.humanharvest.organz.controller.client; import static org.testfx.api.FxAssert.verifyThat; import static org.testfx.matcher.control.TableViewMatchers.containsRow; import static org.testfx.util.NodeQueryUtils.isVisible; import java.time.LocalDate; import java.util.ArrayList; import java.util.Collection; import com.humanharvest.organz.Client; import com.humanharvest.organz.ProcedureRecord; import com.humanharvest.organz.controller.ControllerTest; import com.humanharvest.organz.state.State; import com.humanharvest.organz.utilities.view.Page; import com.humanharvest.organz.utilities.view.WindowContext; import org.junit.Test; public class ViewProceduresControllerClientTest extends ControllerTest { private final Client testClient = new Client(1); private final Collection<ProcedureRecord> pastRecords = new ArrayList<>(); private final Collection<ProcedureRecord> pendingRecords = new ArrayList<>(); @Override protected Page getPage() { return Page.VIEW_PROCEDURES; } @Override protected void initState() { State.reset(); resetRecords(); State.getClientManager().addClient(testClient); State.login(testClient); mainController.setWindowContext(WindowContext.defaultContext()); } private void resetRecords() { for (ProcedureRecord record : testClient.getPastProcedures()) { testClient.deleteProcedureRecord(record); } for (ProcedureRecord record : testClient.getPendingProcedures()) { testClient.deleteProcedureRecord(record); } pastRecords.add(new ProcedureRecord("Summary1", "Description1", LocalDate.of(2000, 1, 1))); pastRecords.add(new ProcedureRecord("Summary2", "Description2", LocalDate.of(2000, 2, 1))); pastRecords.add(new ProcedureRecord("A Summary 3", "Description3", LocalDate.of(2000, 3, 1))); pendingRecords.add(new ProcedureRecord("Summary4", "Description4", LocalDate.of(2045, 1, 1))); for (ProcedureRecord record : pastRecords) { testClient.addProcedureRecord(record); } for (ProcedureRecord record : pendingRecords) { testClient.addProcedureRecord(record); } } @Test public void bothListViewsVisibleTest() { verifyThat("#pendingProcedureView", isVisible()); verifyThat("#pastProcedureView", isVisible()); } @Test public void addAreaNotVisibleTest() { verifyThat("#newProcedurePane", isVisible().negate()); } @Test public void pastMedicationsContainsRecordsTest() { for (ProcedureRecord record : pastRecords) { verifyThat("#pastProcedureView", containsRow( record.getSummary(), record.getDate(), record.getAffectedOrgans(), record.getDescription())); } } @Test public void currentMedicationsContainsRecordsTest() { for (ProcedureRecord record : pendingRecords) { verifyThat("#pendingProcedureView", containsRow( record.getSummary(), record.getDate(), record.getAffectedOrgans(), record.getDescription())); } } }
92388ae67bebdb519283754e17bcf73b269b22bb
6,049
java
Java
src/main/java/com/chaseste/csv/core/model/types/clinical/Immunization.java
chaseste/csv-transform
e7b6ede499ede6ecd67b2f47b4e3385225e0e011
[ "MIT" ]
null
null
null
src/main/java/com/chaseste/csv/core/model/types/clinical/Immunization.java
chaseste/csv-transform
e7b6ede499ede6ecd67b2f47b4e3385225e0e011
[ "MIT" ]
null
null
null
src/main/java/com/chaseste/csv/core/model/types/clinical/Immunization.java
chaseste/csv-transform
e7b6ede499ede6ecd67b2f47b4e3385225e0e011
[ "MIT" ]
null
null
null
28.668246
110
0.684741
998,474
package com.chaseste.csv.core.model.types.clinical; import static com.chaseste.csv.core.model.types.common.Code.optionalCode; import static com.chaseste.csv.core.model.types.common.Code.requiredCode; import static com.chaseste.csv.core.model.types.common.Note.optionalNotes; import static com.chaseste.csv.core.model.types.common.Physician.optionalPhysicians; import java.util.Arrays; import java.util.List; import com.chaseste.csv.core.model.types.common.Code; import com.chaseste.csv.core.model.types.common.Note; import com.chaseste.csv.core.model.types.common.Physician; import com.chaseste.csv.core.reader.Fields; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @JsonPropertyOrder({ "unique_id", "physicians", "route", "site", "admin_dt_tm", "vaccine_code", "admin_units", "lot_number", "lot_expire_dt_tm", "manufacturer", "substance_refusal_reason", "completion_status", "admin_amount", "vis_dt_tm", "vfc_status", "notes", "historical_source" }) public class Immunization { public static List<Immunization> requiredImmunizations(Fields fields) { Immunization i = new Immunization(); i.uniqueId = fields.requiredString(6); i.physicians = optionalPhysicians(fields.optionalRepeatField(7)); i.route = optionalCode(fields.optionalField(8)); i.site = optionalCode(fields.optionalField(9)); i.adminDate = fields.requiredString(10); i.vaccineCode = requiredCode(fields.requiredField(11)); i.adminUnits = requiredCode(fields.requiredField(12)); i.lotNumber = fields.optionalString(13); i.lotExpireDate = fields.optionalString(14); i.manufacturer = optionalCode(fields.optionalField(15)); i.substanceRefusalReason = optionalCode(fields.optionalField(16)); i.completionStatus = requiredCode(fields.requiredField(17)); i.adminAmount = fields.requiredString(18); i.visDate = fields.optionalString(19); i.vfcStatus = optionalCode(fields.optionalField(20)); i.notes = optionalNotes(fields.optionalRepeatField(21)); i.historicalSource = optionalCode(fields.optionalField(22)); return Arrays.asList(i); } private String uniqueId; private List<Physician> physicians; private Code route; private Code site; private String adminDate; private Code vaccineCode; private Code adminUnits; private String lotNumber; private String lotExpireDate; private Code manufacturer; private Code substanceRefusalReason; private Code completionStatus; private String adminAmount; private String visDate; private Code vfcStatus; private List<Note> notes; private Code historicalSource; @JsonProperty("unique_id") public String getUniqueId() { return uniqueId; } public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; } public List<Physician> getPhysicians() { return physicians; } public void setPhysicians(List<Physician> physicians) { this.physicians = physicians; } public Code getRoute() { return route; } public void setRoute(Code route) { this.route = route; } public Code getSite() { return site; } public void setSite(Code site) { this.site = site; } @JsonProperty("admin_dt_tm") public String getAdminDate() { return adminDate; } public void setAdminDate(String adminDate) { this.adminDate = adminDate; } @JsonProperty("vaccine_code") public Code getVaccineCode() { return vaccineCode; } public void setVaccineCode(Code vaccineCode) { this.vaccineCode = vaccineCode; } @JsonProperty("admin_units") public Code getAdminUnits() { return adminUnits; } public void setAdminUnits(Code adminUnits) { this.adminUnits = adminUnits; } @JsonProperty("lot_number") public String getLotNumber() { return lotNumber; } public void setLotNumber(String lotNumber) { this.lotNumber = lotNumber; } @JsonProperty("lot_expire_dt_tm") public String getLotExpireDate() { return lotExpireDate; } public void setLotExpireDate(String lotExpireDate) { this.lotExpireDate = lotExpireDate; } public Code getManufacturer() { return manufacturer; } public void setManufacturer(Code manufacturer) { this.manufacturer = manufacturer; } @JsonProperty("substance_refusal_reason") public Code getSubstanceRefusalReason() { return substanceRefusalReason; } public void setSubstanceRefusalReason(Code substanceRefusalReason) { this.substanceRefusalReason = substanceRefusalReason; } @JsonProperty("completion_status") public Code getCompletionStatus() { return completionStatus; } public void setCompletionStatus(Code completionStatus) { this.completionStatus = completionStatus; } @JsonProperty("admin_amount") public String getAdminAmount() { return adminAmount; } public void setAdminAmount(String adminAmount) { this.adminAmount = adminAmount; } @JsonProperty("vis_dt_tm") public String getVisDate() { return visDate; } public void setVisDate(String visDate) { this.visDate = visDate; } @JsonProperty("vfc_status") public Code getVfcStatus() { return vfcStatus; } public void setVfcStatus(Code vfcStatus) { this.vfcStatus = vfcStatus; } public List<Note> getNotes() { return notes; } public void setNotes(List<Note> notes) { this.notes = notes; } @JsonProperty("historical_source") public Code getHistoricalSource() { return historicalSource; } public void setHistoricalSource(Code historicalSource) { this.historicalSource = historicalSource; } }
92388b97ae78d4bbe8eab079e4c922cf5d9188ba
5,192
java
Java
src/main/java/com/github/braully/business/GenericBC.java
braully/prototyping-base-udm
c265311749725dadad5677fc7239ddbae931125d
[ "Apache-2.0" ]
null
null
null
src/main/java/com/github/braully/business/GenericBC.java
braully/prototyping-base-udm
c265311749725dadad5677fc7239ddbae931125d
[ "Apache-2.0" ]
null
null
null
src/main/java/com/github/braully/business/GenericBC.java
braully/prototyping-base-udm
c265311749725dadad5677fc7239ddbae931125d
[ "Apache-2.0" ]
null
null
null
32.049383
148
0.700501
998,475
package com.github.braully.business; import com.github.braully.persistence.GenericDAO; import com.github.braully.persistence.ICrudEntity; import com.github.braully.persistence.IEntity; import com.github.braully.persistence.ILightRemoveEntity; import com.github.braully.persistence.PagedQueryResult; import java.io.Serializable; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @SuppressWarnings("rawtypes") @Service("genericoBC") public class GenericBC implements Serializable, ICrudEntity { private static final long serialVersionUID = 1L; /* */ @Autowired protected GenericDAO genericDAO; public <T extends Comparable<? super T>> List<T> carregarColecaoOrdenada(Class<T> classe) { List<T> lista = null; if (classe != null) { lista = (List<T>) this.getGenericDAO().loadCollection(classe); if (lista != null) { Collections.sort(lista); } } return lista; } @Override public <T> List<T> loadCollectionSorted(Class<T> classe, String... nomePropriedade) { return this.getGenericDAO().loadCollectionSorted(classe, nomePropriedade); } @Override public <T> List<T> loadCollection(Class<T> classe) { return this.getGenericDAO().loadCollection(classe); } @Override public <T> List<T> loadCollectionWhere(Class<T> classe, Object... args) { return this.getGenericDAO().loadCollectionWhere(classe, args); } @Override public <T> List<T> loadCollectionFetch(Class<T> classe, String... propriedades) { return this.getGenericDAO().loadCollectionFetch(classe, propriedades); } @Override public <T> T loadEntity(T entidade) { return this.getGenericDAO().loadEntity(entidade); } @Override public <T> T loadEntityFetch(IEntity e, String... propriedades) { return this.getGenericDAO().loadEntityFetch(e, propriedades); } @Override public void delete(Object entidade) { this.getGenericDAO().delete(entidade); } @Override public void deleteSoft(ILightRemoveEntity entity) { this.getGenericDAO().delete(entity); } @Override public void saveEntityCascade(IEntity e, Collection<? extends IEntity>... relacoes) { this.getGenericDAO().saveEntityCascade(e, relacoes); } @Override public void saveEntityFlyWeigth(IEntity entidade, String... nomePropriedades) { this.getGenericDAO().saveEntityFlyWeigth(entidade, nomePropriedades); } @Override public void saveEntity(IEntity... args) { this.getGenericDAO().saveEntity(args); } protected ICrudEntity getGenericDAO() { return genericDAO; } @Override public List loadCollection(String nomeClasse) { return this.getGenericDAO().loadCollection(nomeClasse); } @Override public <T> T loadEntityFetch(String nomeEntidade, Object id, String... propriedades) { return this.getGenericDAO().loadEntityFetch(nomeEntidade, id, propriedades); } @Override public Object queryObject(Object... args) { return this.getGenericDAO().queryObject(args); } @Override public List queryList(Object... args) { return this.queryList(args); } @Override public <T> List<T> genericFulltTextSearch(Class<T> cls, String searchString, Map<String, Object> extraSearchParams) { return this.getGenericDAO().genericFulltTextSearch(cls, searchString, extraSearchParams); } @Override public <T> PagedQueryResult loadCollectionPagedQuery(Class<T> entityClass) { return this.getGenericDAO().loadCollectionPagedQuery(entityClass); } @Override public <T> PagedQueryResult loadCollectionWherePagedQuery(Class<T> entityClass, Object... args) { return this.getGenericDAO().loadCollectionWherePagedQuery(entityClass, args); } @Override public <T> PagedQueryResult loadCollectionSortedPagedQuery(Class<T> entityClass, String... asc) { return this.getGenericDAO().loadCollectionSortedPagedQuery(entityClass, asc); } @Override public <T> PagedQueryResult loadCollectionFetchPagedQuery(Class<T> entityClass, String... props) { return this.getGenericDAO().loadCollectionFetchPagedQuery(entityClass, props); } @Override public PagedQueryResult queryListPagedQuery(Object... args) { return this.getGenericDAO().queryListPagedQuery(args); } @Override public <T> PagedQueryResult genericFulltTextSearchPagedQuery(Class<T> entityClass, String searchString, Map<String, Object> extraSearchParams) { return this.getGenericDAO().genericFulltTextSearchPagedQuery(entityClass, searchString, extraSearchParams); } @Override public void paginate(PagedQueryResult queryResult) { this.getGenericDAO().paginate(queryResult); } @Override public <T> T loadEntity(Class<T> clz, Object id) { return this.getGenericDAO().loadEntity(clz, id); } }
92388c0d99c36c6e22bdf84fd439a4d85808a2c2
434
java
Java
Magic/src/main/java/com/elmakers/mine/bukkit/tasks/MageLoadTask.java
Codemagix07/MagicPlugin
398071f0ae157f23cfe080e4b6f77009de83a8b0
[ "MIT" ]
203
2015-03-11T17:28:57.000Z
2022-03-31T09:26:43.000Z
Magic/src/main/java/com/elmakers/mine/bukkit/tasks/MageLoadTask.java
Codemagix07/MagicPlugin
398071f0ae157f23cfe080e4b6f77009de83a8b0
[ "MIT" ]
991
2015-01-15T18:46:19.000Z
2022-03-29T21:49:30.000Z
Magic/src/main/java/com/elmakers/mine/bukkit/tasks/MageLoadTask.java
Codemagix07/MagicPlugin
398071f0ae157f23cfe080e4b6f77009de83a8b0
[ "MIT" ]
249
2015-01-15T17:52:04.000Z
2022-03-28T11:50:31.000Z
21.7
51
0.677419
998,476
package com.elmakers.mine.bukkit.tasks; import com.elmakers.mine.bukkit.api.data.MageData; import com.elmakers.mine.bukkit.api.magic.Mage; public class MageLoadTask implements Runnable { private final Mage mage; private final MageData data; public MageLoadTask(Mage mage, MageData data) { this.mage = mage; this.data = data; } @Override public void run() { mage.load(data); } }
92388e38b41abb614a2935820350a7ad17c1c676
735
java
Java
gulimall-product/src/main/java/com/atguigu/gulimall/product/service/SkuSaleAttrValueService.java
ivanfanfan/gulimall
e4e88bf9df84aecb0eca6b2ee587486096f1635f
[ "Apache-2.0" ]
null
null
null
gulimall-product/src/main/java/com/atguigu/gulimall/product/service/SkuSaleAttrValueService.java
ivanfanfan/gulimall
e4e88bf9df84aecb0eca6b2ee587486096f1635f
[ "Apache-2.0" ]
null
null
null
gulimall-product/src/main/java/com/atguigu/gulimall/product/service/SkuSaleAttrValueService.java
ivanfanfan/gulimall
e4e88bf9df84aecb0eca6b2ee587486096f1635f
[ "Apache-2.0" ]
null
null
null
26.214286
83
0.792916
998,477
package com.atguigu.gulimall.product.service; import com.atguigu.gulimall.product.vo.SkuItemSaleAttrVo; import com.baomidou.mybatisplus.extension.service.IService; import com.atguigu.common.utils.PageUtils; import com.atguigu.gulimall.product.entity.SkuSaleAttrValueEntity; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * sku销售属性&值 * * @author wangerfan * @email nnheo@example.com * @date 2020-08-20 05:12:31 */ public interface SkuSaleAttrValueService extends IService<SkuSaleAttrValueEntity> { PageUtils queryPage(Map<String, Object> params); List<SkuItemSaleAttrVo> getSaleAttrsBySpuId(Long spuId); List<String> getSkuSaleAttrValuesAsStringList(Long skuId); }
92388e444b037300d8ea44c1a6c676ce521df73d
3,907
java
Java
QuanLySinhVien/src/qlysinhvien/QLyMonHoc.java
IMD246/StudentManagement
3c9d33bda97e8a0cf94cc1ca4b7026b0427f802f
[ "Apache-2.0" ]
null
null
null
QuanLySinhVien/src/qlysinhvien/QLyMonHoc.java
IMD246/StudentManagement
3c9d33bda97e8a0cf94cc1ca4b7026b0427f802f
[ "Apache-2.0" ]
null
null
null
QuanLySinhVien/src/qlysinhvien/QLyMonHoc.java
IMD246/StudentManagement
3c9d33bda97e8a0cf94cc1ca4b7026b0427f802f
[ "Apache-2.0" ]
null
null
null
33.681034
79
0.520604
998,478
/* * 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 qlysinhvien; import qlysinhvien.MonHoc; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.util.ArrayList; import javax.swing.JOptionPane; /** * * @author Administrator */ public class QLyMonHoc { ArrayList<MonHoc>listMh = new ArrayList<>(); public java.sql.PreparedStatement ps; public Connection con; public ResultSet rs; public void themMonHoc(MonHoc mh) { try { con = ConnectDB.getConnect(); String sql = "INSERT INTO monhoc VALUES (?,?,?)"; ps = con.prepareStatement(sql); ps.setString(1, mh.getMaMonHoc()); ps.setString(2, mh.getTenMonHoc()); ps.setInt(3,mh.getSoTiet()); ps.execute(); JOptionPane.showMessageDialog(null,"Đã thêm"); } catch (Exception e) { JOptionPane.showMessageDialog(null,"Thêm Không Thành Công !!" + e); } } public void suaMonHoc(MonHoc mh) { try { con = ConnectDB.getConnect(); String sql = "UPDATE monhoc set TenMonHoc = ? , SoTiet = ? " +"WHERE MaMonHoc = ?"; ps = con.prepareStatement(sql); ps.setString(1, mh.getTenMonHoc()); ps.setInt(2, mh.getSoTiet()); ps.setString(3,mh.getMaMonHoc()); ps.execute(); JOptionPane.showMessageDialog(null,"Đã sửa"); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Sửa Không Thành Công !!" + e); } } public void xoaMonHoc(MonHoc mh) { try { Connection con = ConnectDB.getConnect(); String sql = "DELETE FROM monhoc WHERE MaMonHoc = ?"; ps = con.prepareStatement(sql); ps.setString(1, mh.getMaMonHoc()); ps.execute(); JOptionPane.showMessageDialog(null,"Đã xoá"); } catch (Exception e) { System.out.println("Xóa Không Thành Công !!" + e); } } public ArrayList<MonHoc> hienThiList() { listMh.clear(); Connection conn = ConnectDB.getConnect(); Statement st = null; ResultSet rs = null; try { String sql = "SELECT * FROM monhoc"; st = conn.createStatement(); rs = st.executeQuery(sql); while (rs.next()) { MonHoc mh = new MonHoc(); mh.setMaMonHoc(rs.getString("MaMonHoc")); mh.setTenMonHoc(rs.getString("TenMonHoc")); mh.setSoTiet(rs.getInt("SoTiet")); listMh.add(mh); } } catch (Exception e) { e.printStackTrace(); } return listMh; } public boolean timKiem(String maMonHoc){ listMh.clear(); Connection conn = ConnectDB.getConnect(); ResultSet rs = null; try { String sql = "SELECT * FROM monhoc WHERE MaMonHoc = ?"; ps = conn.prepareStatement(sql); ps.setString(1,maMonHoc); rs = ps.executeQuery(); while (rs.next()) { MonHoc mh = new MonHoc(); mh.setMaMonHoc(rs.getString("MaMonHoc")); mh.setTenMonHoc(rs.getString("TenMonHoc")); mh.setSoTiet(rs.getInt("SoTiet")); listMh.add(mh); return true; } } catch (Exception e) { JOptionPane.showMessageDialog(null,"Không tìm thấy !"+e); } return false; } }
92388e460000924035d400212437de161dd81114
4,092
java
Java
openjdk.test.modularity/src/tests/com.test.serviceloaders/adoptopenjdk/test/modularity/serviceloaders/TestServiceLoaders.java
ben-walsh/openjdk-systemtest
bfd31dc0509b41b45e5a00ba84a888ebb1d44186
[ "Apache-2.0" ]
15
2017-12-12T07:44:39.000Z
2020-10-23T21:23:58.000Z
openjdk.test.modularity/src/tests/com.test.serviceloaders/adoptopenjdk/test/modularity/serviceloaders/TestServiceLoaders.java
ben-walsh/openjdk-systemtest
bfd31dc0509b41b45e5a00ba84a888ebb1d44186
[ "Apache-2.0" ]
334
2017-09-20T18:18:16.000Z
2021-03-16T14:27:04.000Z
openjdk.test.modularity/src/tests/com.test.serviceloaders/adoptopenjdk/test/modularity/serviceloaders/TestServiceLoaders.java
ben-walsh/openjdk-systemtest
bfd31dc0509b41b45e5a00ba84a888ebb1d44186
[ "Apache-2.0" ]
48
2017-09-11T12:52:11.000Z
2021-03-05T09:09:21.000Z
37.2
106
0.685728
998,479
/******************************************************************************* * 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 adoptopenjdk.test.modularity.serviceloaders; import adoptopenjdk.test.modularity.display.*; import static org.junit.Assert.*; import org.junit.Test; import java.lang.Module; import java.util.ServiceLoader; import java.util.ArrayList; import java.util.Iterator; import java.lang.module.ModuleDescriptor; /* User Story : 1) As a developer I can enable my application to make use of different service implementations/providers using the same service interface APIs 2) As a developer, I can use the service interface in my application module to resolve to the correct service provider when there are multiple service provider jars specified on the module path (service provider jars should be converted to automatic modules when specified on the modulepath) 3) As a developer, I can use the service interface in my application module to resolve to the correct service provider when there are multiple service provider jars specified on the module path (provider1 - as exploded modules, provider2 - as modular jar, provider3 - regular jar with META_INF/services on modulepath) and classpath (provider 4 - regular jar with META_INF/services) */ public class TestServiceLoaders { @Test public void testServiceLoader () throws java.lang.ClassNotFoundException { ArrayList<String> list = new ArrayList<String>(); for(int i = 1 ; i <= 4; i++) { list.add("DisplayServiceImpl" + i); } ServiceLoader<Display> sl = ServiceLoader.load(Display.class); Iterator<Display> iter = sl.iterator(); if (!iter.hasNext()) { throw new RuntimeException("No service providers found!"); } Display provider = null; for(Display h : sl){ provider = h; if (h.display().equals("DisplayServiceImpl1")) { Module m = Class.forName(h.getClass().getName()).getModule(); assertEquals("displayServiceImpl1",m.getName()); ModuleDescriptor desc = m.getDescriptor(); // Verify if DisplayServiceImpl1 module is not an automatic module assertFalse(desc.isAutomatic()); } else if (h.display().equals("DisplayServiceImpl2")) { Module m = Class.forName(h.getClass().getName()).getModule(); assertEquals("displayServiceImpl2",m.getName()); ModuleDescriptor desc = m.getDescriptor(); // Verify if DisplayServiceImpl2 module is not an automatic module assertFalse(desc.isAutomatic()); } else if (h.display().equals("DisplayServiceImpl3")) { Module m = Class.forName(h.getClass().getName()).getModule(); assertEquals("displayServiceImpl3",m.getName()); ModuleDescriptor desc = m.getDescriptor(); // Verify if DisplayServiceImpl3 module is an automatic module assertTrue(desc.isAutomatic()); } else if (h.display().equals("DisplayServiceImpl4")) { Module m = Class.forName(h.getClass().getName()).getModule(); assertNull(m.getName()); ModuleDescriptor desc = m.getDescriptor(); // Verify if DisplayServiceImpl4 module is an unnamed module assertNull(desc); } } // Verify if all the service providers are loaded ArrayList<String> actual = new ArrayList<String>(); for(Display h : sl){ provider = h; String name = provider.display(); actual.add(name); System.out.println(name); } for(String str : list) { assertTrue(actual.contains(str)); } } }
92388e7c5fbdd982807b96aa8dc3cc514222bf4d
3,707
java
Java
src/kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/pickr/entities/album/AlbumBi_M_1_1_M.java
sjvs/Kundera
2d9644587a9ee0ab31fbba5a08c3481032d4db4e
[ "Apache-2.0" ]
377
2015-01-02T07:59:37.000Z
2018-01-27T12:13:16.000Z
src/kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/pickr/entities/album/AlbumBi_M_1_1_M.java
sjvs/Kundera
2d9644587a9ee0ab31fbba5a08c3481032d4db4e
[ "Apache-2.0" ]
332
2015-01-02T10:14:23.000Z
2018-01-29T14:22:24.000Z
src/kundera-tests/src/test/java/com/impetus/kundera/tests/crossdatastore/pickr/entities/album/AlbumBi_M_1_1_M.java
sjvs/Kundera
2d9644587a9ee0ab31fbba5a08c3481032d4db4e
[ "Apache-2.0" ]
135
2015-01-02T07:59:42.000Z
2018-01-25T19:22:13.000Z
23.462025
99
0.652279
998,480
/** * Copyright 2012 Impetus Infotech. * 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.impetus.kundera.tests.crossdatastore.pickr.entities.album; import java.util.ArrayList; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import com.impetus.kundera.tests.crossdatastore.pickr.entities.photo.PhotoBi_M_1_1_M; import com.impetus.kundera.tests.crossdatastore.pickr.entities.photographer.PhotographerBi_M_1_1_M; /** * Entity Class for album * * @author amresh.singh */ @Entity @Table(name = "ALBUM", schema = "Pickr@piccandra") public class AlbumBi_M_1_1_M { @Id @Column(name = "ALBUM_ID") private String albumId; @Column(name = "ALBUM_NAME") private String albumName; @Column(name = "ALBUM_DESC") private String albumDescription; // One to many, will be persisted separately @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "album") private List<PhotoBi_M_1_1_M> photos; @OneToMany(mappedBy = "album", fetch = FetchType.LAZY) private List<PhotographerBi_M_1_1_M> photographers; public AlbumBi_M_1_1_M() { } public AlbumBi_M_1_1_M(String albumId, String name, String description) { this.albumId = albumId; this.albumName = name; this.albumDescription = description; } public String getAlbumId() { return albumId; } public void setAlbumId(String albumId) { this.albumId = albumId; } /** * @return the albumName */ public String getAlbumName() { return albumName; } /** * @param albumName * the albumName to set */ public void setAlbumName(String albumName) { this.albumName = albumName; } /** * @return the albumDescription */ public String getAlbumDescription() { return albumDescription; } /** * @param albumDescription * the albumDescription to set */ public void setAlbumDescription(String albumDescription) { this.albumDescription = albumDescription; } /** * @return the photos */ public List<PhotoBi_M_1_1_M> getPhotos() { if (photos == null) { photos = new ArrayList<PhotoBi_M_1_1_M>(); } return photos; } /** * @param photos * the photos to set */ public void setPhotos(List<PhotoBi_M_1_1_M> photos) { this.photos = photos; } public void addPhoto(PhotoBi_M_1_1_M photo) { getPhotos().add(photo); } /** * @return the photographers */ public List<PhotographerBi_M_1_1_M> getPhotographers() { return photographers; } /** * @param photographers * the photographers to set */ public void setPhotographers(List<PhotographerBi_M_1_1_M> photographers) { this.photographers = photographers; } }
92388eed8a3b40a2079d83e2d1e7403bed9eb77b
972
java
Java
jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/examples/MyAuthedSocket.java
tet-lenovo/jetty.project
0a3632cdda0e4a12229dadd77112f95c57431cba
[ "Apache-2.0" ]
3,353
2015-01-06T13:30:21.000Z
2022-03-31T08:33:56.000Z
jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/examples/MyAuthedSocket.java
stoty/jetty.project
1223bb50ec91fd3387ee7b7983c8e79c5c975318
[ "Apache-2.0" ]
6,018
2015-01-30T17:42:33.000Z
2022-03-31T22:37:40.000Z
jetty-websocket/websocket-javax-tests/src/test/java/org/eclipse/jetty/websocket/javax/tests/server/examples/MyAuthedSocket.java
stoty/jetty.project
1223bb50ec91fd3387ee7b7983c8e79c5c975318
[ "Apache-2.0" ]
1,997
2015-01-05T03:35:02.000Z
2022-03-29T02:47:56.000Z
33.517241
85
0.618313
998,481
// // ======================================================================== // Copyright (c) 1995-2021 Mort Bay Consulting Pty Ltd and others. // // This program and the accompanying materials are made available under the // terms of the Eclipse Public License v. 2.0 which is available at // https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 // which is available at https://www.apache.org/licenses/LICENSE-2.0. // // SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 // ======================================================================== // package org.eclipse.jetty.websocket.javax.tests.server.examples; import javax.websocket.OnMessage; import javax.websocket.server.ServerEndpoint; @ServerEndpoint(value = "/secured/socket", configurator = MyAuthedConfigurator.class) public class MyAuthedSocket { @OnMessage public String onMessage(String msg) { // echo the message back to the remote return msg; } }
92388f410fd65e2ff5dd90dafb78f8d0e7c6c85a
5,366
java
Java
src/de/uni_passau/fim/esl/crn_toolbox_center/tools/FileSystemBrowserJson.java
lbishal/CRNTCplus
ed510b5394326d9047c2fff20f49c2f0fc1af9be
[ "BSD-4-Clause-UC" ]
1
2019-05-10T10:31:28.000Z
2019-05-10T10:31:28.000Z
src/de/uni_passau/fim/esl/crn_toolbox_center/tools/FileSystemBrowserJson.java
lbishal/CRNTCplus
ed510b5394326d9047c2fff20f49c2f0fc1af9be
[ "BSD-4-Clause-UC" ]
null
null
null
src/de/uni_passau/fim/esl/crn_toolbox_center/tools/FileSystemBrowserJson.java
lbishal/CRNTCplus
ed510b5394326d9047c2fff20f49c2f0fc1af9be
[ "BSD-4-Clause-UC" ]
null
null
null
35.355263
95
0.602159
998,482
/* * This file is part of the CRN Toolbox Center. * Copyright 2010-2011 Jakob Weigert, University of Passau */ package de.uni_passau.fim.esl.crn_toolbox_center.tools; import java.io.File; import java.util.Arrays; import java.util.Stack; import android.app.ListActivity; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import de.uni_passau.fim.esl.crn_toolbox_center.R; /** * Represents a file system browser to let the user choose a file of the * desired type. * * @author Jakob Weigert <efpyi@example.com> (University of Passau) * */ public class FileSystemBrowserJson extends ListActivity { // Set here the desired file extension for filtering or "" for no filtering: private static final String FILE_EXTENSION_FILTER = ".json"; private static final String LIST_DIR_EXCEPTION = "Unable to read directory content"; private static final String PREFS_NAME = "Preferences"; private static final String PREF_KEY_CUR_DIR = "currentDirectory"; private static final String PARENT_DIR = "../"; private static final String SLASH = "/"; private static final String DEFAULT_DIR = "/mnt/sdcard"; private static final int RESULT_CODE_FILE_SELECTED = 42; ArrayAdapter<String> mArrayAdapter; Stack<String> mPathStack = new Stack<String>(); /** * Creates a file system browser, which lets the user * select a file of the given type. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.filelistview); mArrayAdapter = new ArrayAdapter<String>(this, R.layout.simplerow); setListAdapter(mArrayAdapter); // Restore preferences (last directory) SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); String lastDirectory = settings.getString(PREF_KEY_CUR_DIR, DEFAULT_DIR); mPathStack.push(SLASH); if (lastDirectory != "") { String[] pieces = lastDirectory.split(SLASH); for (int i = 1; i < pieces.length; i++) { mPathStack.push(mPathStack.peek() + pieces[i] + SLASH); } } listDirectoryContent(mPathStack.peek()); } /** * Changes the directory or returns a selected file to the * activity which created this file system browser. */ @Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); if (v instanceof TextView) { TextView textView = (TextView) v; String entry = textView.getText().toString(); if (entry.endsWith(PARENT_DIR)) { mPathStack.pop(); listDirectoryContent(mPathStack.peek()); } else if (entry.endsWith(SLASH)) { mPathStack.push(mPathStack.peek() + entry); listDirectoryContent(mPathStack.peek()); } else { // File selected. At first save current directory for next // use of file system browser. SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); SharedPreferences.Editor editor = settings.edit(); editor.putString(PREF_KEY_CUR_DIR, mPathStack.peek()); editor.commit(); // Set path as result and finish. Intent data = new Intent(); Uri.Builder builder = new Uri.Builder(); builder.path(mPathStack.peek() + entry); data.setData(builder.build()); setResult(RESULT_CODE_FILE_SELECTED, data); finish(); } } } /** * Lists the contents of a directory and displays it. * * @param directory The directory path. */ @SuppressWarnings("unused") // Unreachable code depending on filter constant private void listDirectoryContent(String directory) { try { mArrayAdapter.clear(); if (!directory.equals(SLASH)) { mArrayAdapter.add(PARENT_DIR); } File path = new File(directory); File[] files = path.listFiles(); Arrays.sort(files); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { mArrayAdapter.add(files[i].getName() + SLASH); } } for (int i = 0; i < files.length; i++) { if (!files[i].isDirectory()) { if (FILE_EXTENSION_FILTER != "") { if (files[i].getName().toLowerCase().endsWith(FILE_EXTENSION_FILTER)) { mArrayAdapter.add(files[i].getName()); } } else { // If no filtering is desired mArrayAdapter.add(files[i].getName()); } } } } catch (Exception e) { Toast.makeText(this, LIST_DIR_EXCEPTION, Toast.LENGTH_LONG).show(); } setTitle(directory); } }
92388fc8741f0fb5b9e8ff029d73d8569faf79cf
3,615
java
Java
weixin-java-profitsharing/src/test/java/com/github/binarywang/profitsharing/service/impl/BaseWxProfitSharingServiceImplTest.java
duffiye/weixin-java-tools
2f536c96b0d36cf88913f7e6175efd0de34ea532
[ "Apache-2.0" ]
null
null
null
weixin-java-profitsharing/src/test/java/com/github/binarywang/profitsharing/service/impl/BaseWxProfitSharingServiceImplTest.java
duffiye/weixin-java-tools
2f536c96b0d36cf88913f7e6175efd0de34ea532
[ "Apache-2.0" ]
null
null
null
weixin-java-profitsharing/src/test/java/com/github/binarywang/profitsharing/service/impl/BaseWxProfitSharingServiceImplTest.java
duffiye/weixin-java-tools
2f536c96b0d36cf88913f7e6175efd0de34ea532
[ "Apache-2.0" ]
1
2018-09-20T03:30:34.000Z
2018-09-20T03:30:34.000Z
31.99115
94
0.782019
998,483
package com.github.binarywang.profitsharing.service.impl; import com.github.binarywang.profitsharing.bean.order.ProfitSharingReceiver; import com.github.binarywang.profitsharing.bean.request.WxProfitSharingAddReceiverRequest; import com.github.binarywang.profitsharing.bean.request.WxProfitSharingRequest; import com.github.binarywang.profitsharing.bean.result.WxProfitSharingAddReceiverResult; import com.github.binarywang.profitsharing.bean.result.WxProfitSharingResult; import com.github.binarywang.profitsharing.constant.WxProfitSharingConstants.SignType; import com.github.binarywang.profitsharing.exception.WxProfitSharingException; import com.github.binarywang.profitsharing.service.WxProfitSharingService; import com.github.binarywang.profitsharing.testbase.ApiTestModule; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.inject.Inject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.Guice; import org.testng.annotations.Test; import java.util.ArrayList; import java.util.List; /** * 测试支付相关接口 * Created by Binary Wang on 2016/7/28. * * @author <a href="https://github.com/binarywang">Binary Wang</a> */ @Test @Guice(modules = ApiTestModule.class) public class BaseWxProfitSharingServiceImplTest { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Inject private WxProfitSharingService wxProfitSharingService; @Test public void testWxProfitSharingPayApply() throws WxProfitSharingException { List<ProfitSharingReceiver> list = new ArrayList<ProfitSharingReceiver>(); ProfitSharingReceiver profitSharingReceiver = new ProfitSharingReceiver(); profitSharingReceiver.setType("PERSONAL_WECHATID"); profitSharingReceiver.setAccount("jian706532704"); profitSharingReceiver.setAmount(1); profitSharingReceiver.setDescription("test"); list.add(profitSharingReceiver); Gson gson = new GsonBuilder().create(); String json = gson.toJson(list); this.logger.info(json); WxProfitSharingRequest request = WxProfitSharingRequest.newBuilder() .outOrderNo("4200000181201809199126163052") .transactionId("4200000181201809199126163052") .receivers(json) .build(); request.setSignType(SignType.HMAC_SHA256); WxProfitSharingResult result = this.wxProfitSharingService.profitSharing(request); this.logger.info(result.toString()); this.logger.warn(this.wxProfitSharingService.getWxApiData().toString()); } @Test public void testWxProfitSharingAdd() throws WxProfitSharingException { ProfitSharingReceiver profitSharingReceiver = new ProfitSharingReceiver(); profitSharingReceiver.setType("PERSONAL_WECHATID"); profitSharingReceiver.setAccount("jian706532704"); profitSharingReceiver.setName("张剑"); Gson gson = new GsonBuilder().create(); String json = gson.toJson(profitSharingReceiver); this.logger.info(json); WxProfitSharingAddReceiverRequest request = WxProfitSharingAddReceiverRequest.newBuilder() .receiver(json) .build(); request.setSignType(SignType.HMAC_SHA256); WxProfitSharingAddReceiverResult result = this.wxProfitSharingService.add(request); this.logger.info(result.toString()); this.logger.warn(this.wxProfitSharingService.getWxApiData().toString()); } @Test public void testGetConfig() throws Exception { // no need to test } @Test public void testSetConfig() throws Exception { // no need to test } @Test public void testGetWxApiData() throws Exception { //see test in testUnifiedOrder() } }
9238900e901eb4a7d666555eab00650459bfdc28
2,071
java
Java
src/main/java/net/accelbyte/sdk/api/legal/models/CreateBasePolicyResponse.java
AccelByte/accelbyte-java-sdk
35086513f8f2acaa9b15a78730498fa5e19769ef
[ "MIT" ]
1
2022-02-26T12:15:52.000Z
2022-02-26T12:15:52.000Z
src/main/java/net/accelbyte/sdk/api/legal/models/CreateBasePolicyResponse.java
AccelByte/accelbyte-java-sdk
35086513f8f2acaa9b15a78730498fa5e19769ef
[ "MIT" ]
null
null
null
src/main/java/net/accelbyte/sdk/api/legal/models/CreateBasePolicyResponse.java
AccelByte/accelbyte-java-sdk
35086513f8f2acaa9b15a78730498fa5e19769ef
[ "MIT" ]
1
2021-12-29T04:01:20.000Z
2021-12-29T04:01:20.000Z
26.21519
106
0.758571
998,484
/* * Copyright (c) 2022 AccelByte Inc. All Rights Reserved * This is licensed software from AccelByte Inc, for limitations * and restrictions contact your company contract manager. * * Code generated. DO NOT EDIT. */ package net.accelbyte.sdk.api.legal.models; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.*; import net.accelbyte.sdk.core.Model; import java.util.HashMap; import java.util.ArrayList; import java.util.List; import java.util.Map; @JsonIgnoreProperties(ignoreUnknown = true) @Builder @Getter @Setter @AllArgsConstructor @NoArgsConstructor public class CreateBasePolicyResponse extends Model { @JsonProperty("affectedClientIds") private List<String> affectedClientIds; @JsonProperty("affectedCountries") private List<String> affectedCountries; @JsonProperty("createdAt") private String createdAt; @JsonProperty("description") private String description; @JsonProperty("globalPolicyName") private String globalPolicyName; @JsonProperty("id") private String id; @JsonProperty("namespace") private String namespace; @JsonProperty("policyId") private String policyId; @JsonProperty("tags") private List<String> tags; @JsonProperty("typeId") private String typeId; @JsonProperty("updatedAt") private String updatedAt; @JsonIgnore public CreateBasePolicyResponse createFromJson(String json) throws JsonProcessingException { return new ObjectMapper().readValue(json, this.getClass()); } @JsonIgnore public List<CreateBasePolicyResponse> createFromJsonList(String json) throws JsonProcessingException { return new ObjectMapper().readValue(json, new TypeReference<List<CreateBasePolicyResponse>>() {}); } }
9238906003d11f4c1aa9eba464732082b70551e1
1,590
java
Java
lang/src/main/java/gyro/lang/GyroErrorListener.java
alexkarezin/gyro
f4bb573ce4ef8c6c7079114031a6273d18cb09ab
[ "Apache-2.0" ]
136
2019-10-07T19:40:32.000Z
2022-03-17T23:34:35.000Z
lang/src/main/java/gyro/lang/GyroErrorListener.java
alexkarezin/gyro
f4bb573ce4ef8c6c7079114031a6273d18cb09ab
[ "Apache-2.0" ]
127
2019-10-09T17:42:22.000Z
2022-03-02T19:50:11.000Z
lang/src/main/java/gyro/lang/GyroErrorListener.java
alexkarezin/gyro
f4bb573ce4ef8c6c7079114031a6273d18cb09ab
[ "Apache-2.0" ]
6
2019-12-08T07:56:50.000Z
2020-05-21T23:41:09.000Z
28.909091
75
0.703774
998,485
/* * Copyright 2019, Perfect Sense, 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 gyro.lang; import java.util.ArrayList; import java.util.List; import org.antlr.v4.runtime.BaseErrorListener; import org.antlr.v4.runtime.RecognitionException; import org.antlr.v4.runtime.Recognizer; import org.antlr.v4.runtime.Token; public class GyroErrorListener extends BaseErrorListener { private final GyroCharStream stream; private final List<SyntaxError> syntaxErrors = new ArrayList<>(); public GyroErrorListener(GyroCharStream stream) { this.stream = stream; } public List<SyntaxError> getSyntaxErrors() { return syntaxErrors; } @Override public void syntaxError( Recognizer<?, ?> recognizer, Object symbol, int line, int column, String message, RecognitionException error) { syntaxErrors.add(symbol instanceof Token ? new SyntaxError(stream, message, (Token) symbol) : new SyntaxError(stream, message, line - 1, column)); } }
92389168557749e10b61747fbd71f4b0fffd98f1
2,986
java
Java
src/main/java/com/greennit/CS3141/entities/Thread.java
tjbecker101/Greennit
be25e46e59e5a43c9d04f68d905c76d700396fba
[ "MIT" ]
null
null
null
src/main/java/com/greennit/CS3141/entities/Thread.java
tjbecker101/Greennit
be25e46e59e5a43c9d04f68d905c76d700396fba
[ "MIT" ]
null
null
null
src/main/java/com/greennit/CS3141/entities/Thread.java
tjbecker101/Greennit
be25e46e59e5a43c9d04f68d905c76d700396fba
[ "MIT" ]
1
2021-04-23T00:28:02.000Z
2021-04-23T00:28:02.000Z
24.677686
94
0.588078
998,486
package com.greennit.CS3141.entities; import javax.persistence.*; import java.io.Serializable; import java.sql.Timestamp; @Entity @Table(name = "threads") /* * This thread class is used for inserting and retrieving data from a thread such as: * The subgreennit the thread is on, the id of the thread, the title and author of the thread, * the content of the thread, and the time the thread was created. */ public class Thread implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id") private int id; private int host; private String title; private String author; private String content; private Timestamp creation_date; private int likes; public Thread() { } // region getters and setters public int getHost() { return host; } public void setHost(int host_subgreennit) { this.host = host_subgreennit; } public int getId() { return id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public void setAuthor(String author) { this.author = author; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public Timestamp getCreation_date() { return creation_date; } public void setCreation_date(Timestamp creation_date) { this.creation_date = creation_date; } public int getLikes(){ return likes;} public void setLikes(int likes){ this.likes = likes;} public String getTimeAgo(){ long difference = System.currentTimeMillis() - this.creation_date.getTime(); String unit; //holds units of time long diffResult = 0; //holds final result if (difference >= 86400000) { //larger than a day diffResult = difference / 86400000; //Converts to days unit = "Day"; if (diffResult >= 365) { //larger than a year diffResult = diffResult / 365; unit = "Year"; } else if (diffResult >= 30){ //larger than a month diffResult = diffResult / 30; unit = "Month"; } else if (diffResult >= 7){ //larger than a week diffResult = diffResult / 7; unit = "Week"; } } else if (difference >= 3600000){ //larger than an hour diffResult = difference / 3600000; //Converts to hours unit = "Hour"; } else { //display in minutes diffResult = difference / 60000; //Converts to minutes unit = "Minute"; } if (diffResult > 1){ //make plural if need be unit = unit + "s"; } return diffResult + " " + unit + " Ago"; } // endregion }
9238917ffab65836ba440404fd2fa88635148142
2,021
java
Java
src/main/java/com/techshard/graphql/service/VehicleService.java
lawrencegrey/GraphQLCRUDImplementation
081ebb9c2e6d0277d2e94da09662d9f1e3d3a5ce
[ "MIT" ]
null
null
null
src/main/java/com/techshard/graphql/service/VehicleService.java
lawrencegrey/GraphQLCRUDImplementation
081ebb9c2e6d0277d2e94da09662d9f1e3d3a5ce
[ "MIT" ]
null
null
null
src/main/java/com/techshard/graphql/service/VehicleService.java
lawrencegrey/GraphQLCRUDImplementation
081ebb9c2e6d0277d2e94da09662d9f1e3d3a5ce
[ "MIT" ]
null
null
null
27.310811
125
0.714993
998,487
package com.techshard.graphql.service; import com.techshard.graphql.dao.entity.Vehicle; import com.techshard.graphql.dao.repository.VehicleRepository; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.time.LocalDate; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @Service public class VehicleService { private final VehicleRepository vehicleRepository ; public VehicleService(final VehicleRepository vehicleRepository) { this.vehicleRepository = vehicleRepository ; } @Transactional public Vehicle createVehicle(final String type,final String modelCode, final String brandName, final String launchDate) { final Vehicle vehicle = new Vehicle(); vehicle.setType(type); vehicle.setModelCode(modelCode); vehicle.setBrandName(brandName); vehicle.setLaunchDate(LocalDate.parse(launchDate)); return this.vehicleRepository.save(vehicle); } @Transactional public Vehicle updateVehicle(Vehicle info) { Vehicle vehicle = this.vehicleRepository.findVehicleById((info.getId())); vehicle.setType(info.getType()); vehicle.setModelCode(info.getModelCode()); vehicle.setBrandName(info.getBrandName()); vehicle.setLaunchDate(info.getLaunchDate()); return this.vehicleRepository.save(vehicle); } @Transactional public Vehicle deleteVehicle(final int id) { Vehicle vehicle = this.vehicleRepository.findVehicleById(id); this.vehicleRepository.delete(vehicle); return vehicle; } @Transactional(readOnly = true) public List<Vehicle> getAllVehicles() { return this.vehicleRepository.findAll().stream().collect(Collectors.toList()); } @Transactional(readOnly = true) public Optional<Vehicle> getVehicle(final int id) { return this.vehicleRepository.findById(id); } }
9238918cb8d93006c65200cf051bfda181c05f21
1,276
java
Java
Ver.2/2.00/source/JavaModel/web/StructSdtB706_SD01_CRF_REG_RTN.java
epoc-software-open/SEDC
6327165f63e448af1b0460f7071d62b5c12c9f09
[ "BSD-2-Clause" ]
2
2020-07-28T03:24:29.000Z
2021-03-20T16:44:55.000Z
Ver.2/2.00/source/JavaModel/web/StructSdtB706_SD01_CRF_REG_RTN.java
epoc-software-open/SEDC
6327165f63e448af1b0460f7071d62b5c12c9f09
[ "BSD-2-Clause" ]
3
2021-03-20T16:11:08.000Z
2021-08-19T14:15:26.000Z
Ver.2/2.00/source/JavaModel/web/StructSdtB706_SD01_CRF_REG_RTN.java
epoc-software-open/SEDC
6327165f63e448af1b0460f7071d62b5c12c9f09
[ "BSD-2-Clause" ]
1
2020-07-28T05:38:36.000Z
2020-07-28T05:38:36.000Z
24.075472
93
0.684169
998,488
/* File: StructSdtB706_SD01_CRF_REG_RTN Description: B706_SD01_CRF_REG_RTN Author: GeneXus Java Generator version 10_3_3-92797 Generated on: July 3, 2017 17:20:58.2 Program type: Callable routine Main DBMS: mysql */ import com.genexus.*; public final class StructSdtB706_SD01_CRF_REG_RTN implements Cloneable, java.io.Serializable { public StructSdtB706_SD01_CRF_REG_RTN( ) { gxTv_SdtB706_SD01_CRF_REG_RTN_Result_cd = "" ; gxTv_SdtB706_SD01_CRF_REG_RTN_Err_msg = "" ; } public Object clone() { Object cloned = null; try { cloned = super.clone(); }catch (CloneNotSupportedException e){ ; } return cloned; } public String getResult_cd( ) { return gxTv_SdtB706_SD01_CRF_REG_RTN_Result_cd ; } public void setResult_cd( String value ) { gxTv_SdtB706_SD01_CRF_REG_RTN_Result_cd = value ; } public String getErr_msg( ) { return gxTv_SdtB706_SD01_CRF_REG_RTN_Err_msg ; } public void setErr_msg( String value ) { gxTv_SdtB706_SD01_CRF_REG_RTN_Err_msg = value ; } protected String gxTv_SdtB706_SD01_CRF_REG_RTN_Result_cd ; protected String gxTv_SdtB706_SD01_CRF_REG_RTN_Err_msg ; }
923891db7f4a32b7bf8801984c9d6b5a7ee5310f
1,227
java
Java
core/src/main/java/com/aspectran/core/scheduler/adapter/QuartzJobResponseAdapter.java
aspectran-projects/aspectran
5cd8e146a2eb0c07f2911476ca949163827faedb
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/aspectran/core/scheduler/adapter/QuartzJobResponseAdapter.java
aspectran-projects/aspectran
5cd8e146a2eb0c07f2911476ca949163827faedb
[ "Apache-2.0" ]
null
null
null
core/src/main/java/com/aspectran/core/scheduler/adapter/QuartzJobResponseAdapter.java
aspectran-projects/aspectran
5cd8e146a2eb0c07f2911476ca949163827faedb
[ "Apache-2.0" ]
null
null
null
32.289474
75
0.748166
998,489
/* * Copyright (c) 2008-2022 The Aspectran 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.aspectran.core.scheduler.adapter; import com.aspectran.core.adapter.DefaultResponseAdapter; import com.aspectran.core.adapter.ResponseAdapter; import com.aspectran.core.context.rule.type.ContentType; import com.aspectran.core.util.OutputStringWriter; /** * Adapt Quartz Job Response to Core {@link ResponseAdapter}. * * @since 2013. 11. 20. */ public class QuartzJobResponseAdapter extends DefaultResponseAdapter { public QuartzJobResponseAdapter() { super(null); setContentType(ContentType.TEXT_PLAIN.toString()); setWriter(new OutputStringWriter(768)); } }
9238928de9e225dcad96faba598e8a2cb64e9770
2,929
java
Java
third_party/android_tools/sdk/sources/android-25/com/android/systemui/EventLogConstants.java
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
third_party/android_tools/sdk/sources/android-25/com/android/systemui/EventLogConstants.java
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
third_party/android_tools/sdk/sources/android-25/com/android/systemui/EventLogConstants.java
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
53.254545
83
0.749744
998,490
/* * Copyright (C) 2014 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ package com.android.systemui; /** * Constants to be passed as sysui_* eventlog parameters. */ public class EventLogConstants { /** The user swiped up on the lockscreen, unlocking the device. */ public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_UP_UNLOCK = 1; /** The user swiped down on the lockscreen, going to the full shade. */ public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_FULL_SHADE = 2; /** The user tapped in an empty area, causing the unlock hint to be shown. */ public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_UNLOCK_HINT = 3; /** The user swiped inward on the camera icon, launching the camera. */ public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_CAMERA = 4; /** The user swiped inward on the dialer icon, launching the dialer. */ public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_DIALER = 5; /** The user tapped the lock, locking the device. */ public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_LOCK = 6; /** The user tapped a notification, needs to tap again to launch. */ public static final int SYSUI_LOCKSCREEN_GESTURE_TAP_NOTIFICATION_ACTIVATE = 7; /** The user swiped down to open quick settings, from keyguard. */ public static final int SYSUI_LOCKSCREEN_GESTURE_SWIPE_DOWN_QS = 8; /** The user swiped down to open quick settings, from shade. */ public static final int SYSUI_SHADE_GESTURE_SWIPE_DOWN_QS = 9; /** The user tapped on the status bar to open quick settings, from shade. */ public static final int SYSUI_TAP_TO_OPEN_QS = 10; /** Secondary user tries binding to the system sysui service */ public static final int SYSUI_RECENTS_CONNECTION_USER_BIND_SERVICE = 1; /** Secondary user is bound to the system sysui service */ public static final int SYSUI_RECENTS_CONNECTION_USER_SYSTEM_BOUND = 2; /** Secondary user loses connection after system sysui has died */ public static final int SYSUI_RECENTS_CONNECTION_USER_SYSTEM_UNBOUND = 3; /** System sysui registers secondary user's callbacks */ public static final int SYSUI_RECENTS_CONNECTION_SYSTEM_REGISTER_USER = 4; /** System sysui unregisters secondary user's callbacks (after death) */ public static final int SYSUI_RECENTS_CONNECTION_SYSTEM_UNREGISTER_USER = 5; }
923892acad05755c18058c9834e27d2bdafc0f47
856
java
Java
src/main/java/br/com/zupacademy/hugo/proposta/model/cartao/Renegociacao.java
HugoOliveiraSoares/orange-talents-06-template-proposta
abdeac9e5a91947845fc03ce4767b318c077f10a
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zupacademy/hugo/proposta/model/cartao/Renegociacao.java
HugoOliveiraSoares/orange-talents-06-template-proposta
abdeac9e5a91947845fc03ce4767b318c077f10a
[ "Apache-2.0" ]
null
null
null
src/main/java/br/com/zupacademy/hugo/proposta/model/cartao/Renegociacao.java
HugoOliveiraSoares/orange-talents-06-template-proposta
abdeac9e5a91947845fc03ce4767b318c077f10a
[ "Apache-2.0" ]
null
null
null
19.906977
92
0.654206
998,491
package br.com.zupacademy.hugo.proposta.model.cartao; import javax.persistence.Entity; import javax.persistence.Id; import java.time.LocalDateTime; @Entity public class Renegociacao { @Id private String id; private int quantidade; private int valor; private LocalDateTime dataDeCriacao; @Deprecated public Renegociacao() { } public Renegociacao(String id, int quantidade, int valor, LocalDateTime dataDeCriacao) { this.id = id; this.quantidade = quantidade; this.valor = valor; this.dataDeCriacao = dataDeCriacao; } public String getId() { return id; } public int getQuantidade() { return quantidade; } public int getValor() { return valor; } public LocalDateTime getDataDeCriacao() { return dataDeCriacao; } }
923893d61710619fd617a7cff227a6bb88245e2b
1,718
java
Java
src/main/java/dev/majek/pc/util/Logging.java
MajekDev/PartyChat
199866393df84ef4bb1d1d7c641e3e17cbd989af
[ "MIT" ]
1
2021-10-31T18:38:54.000Z
2021-10-31T18:38:54.000Z
src/main/java/dev/majek/pc/util/Logging.java
MajekDev/PartyChat
199866393df84ef4bb1d1d7c641e3e17cbd989af
[ "MIT" ]
14
2021-11-24T10:28:39.000Z
2022-03-17T10:27:00.000Z
src/main/java/dev/majek/pc/util/Logging.java
MajekDev/PartyChat
199866393df84ef4bb1d1d7c641e3e17cbd989af
[ "MIT" ]
1
2021-11-15T03:50:50.000Z
2021-11-15T03:50:50.000Z
34.36
113
0.75553
998,492
/* * This file is part of PartyChat, licensed under the MIT License. * * Copyright (c) 2020-2022 Majekdor * * 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 dev.majek.pc.util; import dev.majek.pc.PartyChat; import org.jetbrains.annotations.NotNull; import java.util.Locale; import java.util.logging.Handler; import java.util.logging.LogRecord; public class Logging extends Handler { @Override public void publish(@NotNull LogRecord record) { PartyChat.dataHandler().logToFile(record.getMessage(), record.getLevel().getName().toUpperCase(Locale.ROOT)); } @Override public void flush() { } @Override public void close() throws SecurityException { } }
923893e422ef6dbd5160255c56aca73be3a8d791
496
java
Java
src/main/java/org/svenson/reflectasm/reflectasm/MethodUtil.java
fforw/svenson
55912b8d2d60f141a52f85cf4c0b0391f97d9dca
[ "BSD-3-Clause" ]
11
2015-04-25T12:26:44.000Z
2020-04-28T01:13:51.000Z
src/main/java/org/svenson/reflectasm/reflectasm/MethodUtil.java
fforw/svenson
55912b8d2d60f141a52f85cf4c0b0391f97d9dca
[ "BSD-3-Clause" ]
6
2015-07-23T20:53:48.000Z
2021-12-18T18:02:27.000Z
src/main/java/org/svenson/reflectasm/reflectasm/MethodUtil.java
fforw/svenson
55912b8d2d60f141a52f85cf4c0b0391f97d9dca
[ "BSD-3-Clause" ]
4
2017-04-22T20:50:53.000Z
2019-11-26T13:50:14.000Z
23.619048
89
0.584677
998,493
package org.svenson.reflectasm.reflectasm; import java.lang.annotation.Annotation; import java.lang.reflect.Method; class MethodUtil { public static <T extends Annotation> T getAnnotation(Class<T> cls, Method... methods) { T annotation = null; for (Method method : methods) { if (method != null && (annotation = method.getAnnotation(cls)) != null) { return annotation; } } return null; } }
9238968fd482262502bbaaa503df7142abff1e60
1,397
java
Java
src/test/java/com/jeactor/concurrent/EventTest.java
tomershafir/jeactor
66eb68854d4c1ab9641dba21f77797b6d871a607
[ "Apache-2.0" ]
null
null
null
src/test/java/com/jeactor/concurrent/EventTest.java
tomershafir/jeactor
66eb68854d4c1ab9641dba21f77797b6d871a607
[ "Apache-2.0" ]
null
null
null
src/test/java/com/jeactor/concurrent/EventTest.java
tomershafir/jeactor
66eb68854d4c1ab9641dba21f77797b6d871a607
[ "Apache-2.0" ]
null
null
null
43.65625
171
0.72083
998,494
package com.jeactor.concurrent; import static org.junit.jupiter.api.Assertions.*; import java.util.UUID; import com.jeactor.AbstractJeactorUnitTest; import com.jeactor.Priority; import org.junit.jupiter.api.Test; /** Unit test of Event. */ public class EventTest extends AbstractJeactorUnitTest { /** Creates default instance. */ public EventTest() {} /** Tests that compareTo() with lower priority input object returns positive integer. */ @Test public void testCompareToLowerPriorityObjectReturnsPositiveInt() { assertTrue(0 < new Event("dummy", Priority.NORMAL, null, null, UUID.randomUUID()).compareTo(new Event("dummy", Priority.LOW, null, null, UUID.randomUUID()))); } /** Tests that compareTo() with higher priority input object returns negative integer. */ @Test public void testCompareToHigherPriorityObjectReturnsNegativeInt() { assertTrue(0 > new Event("dummy", Priority.NORMAL, null, null, UUID.randomUUID()).compareTo(new Event("dummy", Priority.CRITICAL, null, null, UUID.randomUUID()))); } /** Tests that compareTo() with equal priority input object returns 0. */ @Test public void testCompareToEqualPriorityObjectReturns0() { assertEquals(0, new Event("dummy", Priority.NORMAL, null, null, UUID.randomUUID()).compareTo(new Event("dummy", Priority.NORMAL, null, null, UUID.randomUUID()))); } }
923896da74ed45961a998285faf97de9b18d9cfe
4,600
java
Java
src/main/java/com/thinkgem/jeesite/modules/process/web/ApproachExaminationController.java
tunnyblock/tunnyblock
07391dd195321d1efc93264e6976b9e2b96deaee
[ "Apache-2.0" ]
null
null
null
src/main/java/com/thinkgem/jeesite/modules/process/web/ApproachExaminationController.java
tunnyblock/tunnyblock
07391dd195321d1efc93264e6976b9e2b96deaee
[ "Apache-2.0" ]
null
null
null
src/main/java/com/thinkgem/jeesite/modules/process/web/ApproachExaminationController.java
tunnyblock/tunnyblock
07391dd195321d1efc93264e6976b9e2b96deaee
[ "Apache-2.0" ]
null
null
null
40.707965
145
0.811087
998,495
package com.thinkgem.jeesite.modules.process.web; import java.util.Date; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.mvc.support.RedirectAttributes; import com.thinkgem.jeesite.common.config.Global; import com.thinkgem.jeesite.common.mapper.JsonMapper; import com.thinkgem.jeesite.common.persistence.Page; import com.thinkgem.jeesite.common.utils.StringUtils; import com.thinkgem.jeesite.common.web.BaseController; import com.thinkgem.jeesite.modules.client.service.ClientService; import com.thinkgem.jeesite.modules.process.entity.ApproachExamination; import com.thinkgem.jeesite.modules.process.entity.Preorder; import com.thinkgem.jeesite.modules.process.entity.Tank; import com.thinkgem.jeesite.modules.process.service.ApproachExaminationService; import com.thinkgem.jeesite.modules.process.service.PreorderService; import com.thinkgem.jeesite.modules.process.service.TankService; /** * 进场箱检Controller * @author 俞超 * @version 2014-12-17 */ @Controller @RequestMapping(value = "${adminPath}/process/approachExamination") public class ApproachExaminationController extends BaseController { @Autowired private ApproachExaminationService approachExaminationService; @Autowired private PreorderService preorderService; @Resource private TankService tankService; @Resource private ClientService clientService; @ModelAttribute public ApproachExamination get(@RequestParam(required=false) String id) { if (StringUtils.isNotBlank(id)){ return approachExaminationService.get(id); }else{ return new ApproachExamination(); } } @RequestMapping(value = {"list", ""}) public String list(ApproachExamination approachExamination, HttpServletRequest request, HttpServletResponse response, Model model) { Page<ApproachExamination> page = approachExaminationService.find(new Page<ApproachExamination>(request, response), approachExamination); model.addAttribute("page", page); return "modules/" + "process/approachExaminationList"; } @RequestMapping(value="examine/{preorderId}") public String examine(@PathVariable String preorderId,Model model){ ApproachExamination approachExamination = new ApproachExamination(); approachExamination.setCreatedTime(new Date()); Preorder preorder = preorderService.get(preorderId); approachExamination.setPreorder(preorder); approachExamination.setTank(preorder.getTank()); model.addAttribute("clientList", JsonMapper.toJsonString(clientService.listAllClients())); model.addAttribute("approachExamination", approachExamination); return "modules/" + "process/approachExaminiationForm"; } @RequestMapping(value = "form") public String form(ApproachExamination approachExamination, Model model) { model.addAttribute("approachExamination", approachExamination); return "modules/" + "process/approachExaminationForm"; } @RequestMapping(value = "save") public String save(ApproachExamination approachExamination, Model model, RedirectAttributes redirectAttributes) { String tankCode = approachExamination.getTank().getTankCode(); String preorderId = approachExamination.getPreorder().getId(); Preorder preorder = preorderService.get(preorderId); preorderService.updateAppraochTime(preorder); Tank tank = tankService.findTankByCode(tankCode); BeanUtils.copyProperties(approachExamination.getTank(), tank, new String[]{"id"}); tankService.save(tank); if(!StringUtils.isEmpty(approachExamination.getDamagePicturePackage())){ approachExamination.setIsDamaged(ApproachExamination.YES); } approachExamination.setTank(tank); approachExamination.setCreateUser(getCurrentUser()); approachExaminationService.save(approachExamination); return "redirect:"+Global.getAdminPath()+"/process/approachExamination/?repage"; } @RequestMapping(value = "delete") public String delete(String id, RedirectAttributes redirectAttributes) { approachExaminationService.delete(id); addMessage(redirectAttributes, "删除进场箱检成功"); return "redirect:"+Global.getAdminPath()+"/process/approachExamination/?repage"; } }
92389719482bffae6c3b1057c67513c5b9539b30
552
java
Java
spring-shadow/src/main/java/com/spring/BeanPostPorcessor/aspect/MyAspect.java
likanglong555/spring-framework-5.2.8
f301ef8435cf9809e30aaa051cd07fc9a816ec92
[ "Apache-2.0" ]
null
null
null
spring-shadow/src/main/java/com/spring/BeanPostPorcessor/aspect/MyAspect.java
likanglong555/spring-framework-5.2.8
f301ef8435cf9809e30aaa051cd07fc9a816ec92
[ "Apache-2.0" ]
null
null
null
spring-shadow/src/main/java/com/spring/BeanPostPorcessor/aspect/MyAspect.java
likanglong555/spring-framework-5.2.8
f301ef8435cf9809e30aaa051cd07fc9a816ec92
[ "Apache-2.0" ]
null
null
null
21.230769
60
0.780797
998,496
package com.spring.BeanPostPorcessor.aspect; import lombok.extern.log4j.Log4j2; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.annotation.After; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; import org.aspectj.lang.annotation.Pointcut; import org.springframework.stereotype.Component; @Component @Aspect @Log4j2 public class MyAspect { @Pointcut("within(com.spring.BeanPostPorcessor.MyService)") public void pinotCut(){ } @After("pinotCut()") public void ad(){ log.info("aop proxy"); } }
923897284d7c504d7adf97834a967a0dc1255a85
234
java
Java
android-navigator-compiler/src/test/resources/android/content/Context.java
kostasdrakonakis/android_navigator
c39b98a7c45a43f81c13d802143ea732ed080582
[ "Apache-2.0" ]
13
2018-02-15T20:42:42.000Z
2021-12-30T18:00:27.000Z
randomizer-compiler/src/test/resources/android/content/Context.java
kostasdrakonakis/randomizer
6d74794c13ea347c30b96d6362901add74dcef42
[ "Apache-2.0" ]
null
null
null
randomizer-compiler/src/test/resources/android/content/Context.java
kostasdrakonakis/randomizer
6d74794c13ea347c30b96d6362901add74dcef42
[ "Apache-2.0" ]
3
2019-05-17T11:22:55.000Z
2021-12-30T18:01:19.000Z
21.272727
83
0.722222
998,497
package android.content; /** * Dummy Context class used only for unit tests as 'java-library' modules cannot be * dependent on android dependencies. */ public class Context { public void startActivity(Intent intent) { } }
9238975a13655d2b851efc2eba1f85e7bb47bb55
2,096
java
Java
qpid-proton4j-transport/src/main/java/org/apache/qpid/proton4j/transport/sasl/SaslClientListener.java
clebertsuconic/hacking
0b1130accc18c3d52e62e90ff8146acc42a7c0ad
[ "Apache-2.0" ]
null
null
null
qpid-proton4j-transport/src/main/java/org/apache/qpid/proton4j/transport/sasl/SaslClientListener.java
clebertsuconic/hacking
0b1130accc18c3d52e62e90ff8146acc42a7c0ad
[ "Apache-2.0" ]
null
null
null
qpid-proton4j-transport/src/main/java/org/apache/qpid/proton4j/transport/sasl/SaslClientListener.java
clebertsuconic/hacking
0b1130accc18c3d52e62e90ff8146acc42a7c0ad
[ "Apache-2.0" ]
null
null
null
38.109091
103
0.725191
998,498
/* * 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.qpid.proton4j.transport.sasl; /** * Listener for SASL frame arrival to facilitate relevant handling for the SASL * negotiation of the client side of the SASL exchange. * * See the AMQP specification * <a href="http://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-security-v1.0-os.html#doc-idp51040"> * SASL negotiation process</a> overview for related detail. */ public interface SaslClientListener { /** * Called when a sasl-mechanisms frame has arrived and its effect * applied, indicating the offered mechanisms sent by the 'server' peer. * * @param context the SaslClientContext object */ void onSaslMechanisms(SaslClientContext context, String[] mechanisms); /** * Called when a sasl-challenge frame has arrived and its effect * applied, indicating the challenge sent by the 'server' peer. * * @param context the SaslClientContext object */ void onSaslChallenge(SaslClientContext context); /** * Called when a sasl-outcome frame has arrived and its effect * applied, indicating the outcome and any success additional-data * sent by the 'server' peer. * * @param context the SaslClientContext object */ void onSaslOutcome(SaslClientContext context); }
9238976f337245e913c2d85457b78de1974bbd11
775
java
Java
ProblemSolving/src/solution/JavaSubarray.java
MohamedMetwalli5/HackerRank_solutions
be13ba740214a966d41e6be1d643297c75499e24
[ "Apache-2.0" ]
37
2021-04-04T20:08:00.000Z
2022-01-05T19:42:42.000Z
ProblemSolving/src/solution/JavaSubarray.java
ahmedsaleh1998/HackerRank_solutions
be13ba740214a966d41e6be1d643297c75499e24
[ "Apache-2.0" ]
null
null
null
ProblemSolving/src/solution/JavaSubarray.java
ahmedsaleh1998/HackerRank_solutions
be13ba740214a966d41e6be1d643297c75499e24
[ "Apache-2.0" ]
15
2021-04-04T20:12:47.000Z
2022-01-08T23:34:16.000Z
25.833333
119
0.450323
998,499
import java.io.*; import java.util.*; public class JavaSubarray { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ Scanner input = new Scanner(System.in); int n = input.nextInt(); int[] arr = new int[n]; for(int i=0;i<n;i++){ arr[i] = input.nextInt(); } int counter = 0; // Arrays.sort(arr); for(int i=0;i<n;i++){ int sum = 0; for(int j=i;j<n;j++){ sum += arr[j]; if(sum < 0){ counter++; } } sum = 0; } System.out.println(counter); } }
923898d28c6dff69cbbf68daaaf6a250fe107bd4
4,210
java
Java
server/src/test/java/com/linecorp/centraldogma/server/internal/storage/PurgeSchedulingServiceTest.java
geminiKim/centraldogma
d8e49f2775c1c694c96373473e5238210cb91c74
[ "Apache-2.0" ]
1
2020-11-11T05:10:52.000Z
2020-11-11T05:10:52.000Z
server/src/test/java/com/linecorp/centraldogma/server/internal/storage/PurgeSchedulingServiceTest.java
geminiKim/centraldogma
d8e49f2775c1c694c96373473e5238210cb91c74
[ "Apache-2.0" ]
null
null
null
server/src/test/java/com/linecorp/centraldogma/server/internal/storage/PurgeSchedulingServiceTest.java
geminiKim/centraldogma
d8e49f2775c1c694c96373473e5238210cb91c74
[ "Apache-2.0" ]
null
null
null
41.683168
102
0.72209
998,500
/* * Copyright 2019 LINE Corporation * * LINE Corporation 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: * * 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.linecorp.centraldogma.server.internal.storage; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import java.util.concurrent.Executor; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import com.linecorp.centraldogma.common.Author; import com.linecorp.centraldogma.server.command.Command; import com.linecorp.centraldogma.server.command.CommandExecutor; import com.linecorp.centraldogma.server.command.PurgeProjectCommand; import com.linecorp.centraldogma.server.command.PurgeRepositoryCommand; import com.linecorp.centraldogma.server.metadata.MetadataService; import com.linecorp.centraldogma.server.storage.project.ProjectManager; import com.linecorp.centraldogma.testing.internal.ProjectManagerRule; public class PurgeSchedulingServiceTest { private static final String PROJA_ACTIVE = "proja"; private static final String REPOA_REMOVED = "repoa"; private static final String PROJB_REMOVED = "projb"; private static final Author AUTHOR = Author.SYSTEM; private static final long MAX_REMOVED_REPOSITORY_AGE_MILLIS = 1; private PurgeSchedulingService service; private MetadataService metadataService; @Rule public final ProjectManagerRule rule = new ProjectManagerRule() { @Override protected ProjectManager newProjectManager(Executor repositoryWorker, Executor purgeWorker) { return spy(super.newProjectManager(repositoryWorker, unused -> { /* noop for test */})); } @Override protected CommandExecutor newCommandExecutor(ProjectManager projectManager, Executor worker) { return spy(super.newCommandExecutor(projectManager, worker)); } @Override protected void afterExecutorStarted() { metadataService = new MetadataService(projectManager(), executor()); executor().execute(Command.createProject(AUTHOR, PROJA_ACTIVE)).join(); executor().execute(Command.createRepository(AUTHOR, PROJA_ACTIVE, REPOA_REMOVED)).join(); metadataService.addRepo(AUTHOR, PROJA_ACTIVE, REPOA_REMOVED).join(); executor().execute(Command.removeRepository(AUTHOR, PROJA_ACTIVE, REPOA_REMOVED)).join(); metadataService.removeRepo(AUTHOR, PROJA_ACTIVE, REPOA_REMOVED).join(); executor().execute(Command.createProject(AUTHOR, PROJB_REMOVED)).join(); executor().execute(Command.removeProject(AUTHOR, PROJB_REMOVED)).join(); } }; @Before public void init() { service = new PurgeSchedulingService(rule.projectManager(), rule.purgeWorker(), MAX_REMOVED_REPOSITORY_AGE_MILLIS); } @Test public void testClear() throws InterruptedException { rule.executor().execute(Command.purgeRepository(AUTHOR, PROJA_ACTIVE, REPOA_REMOVED)).join(); rule.executor().execute(Command.purgeProject(AUTHOR, PROJB_REMOVED)).join(); service.start(rule.executor(), metadataService); verify(rule.projectManager()).purgeMarked(); service.stop(); } @Test public void testSchedule() throws InterruptedException { Thread.sleep(10); // let removed files be purged service.purgeProjectAndRepository(rule.executor(), metadataService); verify(rule.executor()).execute(isA(PurgeProjectCommand.class)); verify(rule.executor()).execute(isA(PurgeRepositoryCommand.class)); } }
92389a30e79b6549d9647f6b6dd6d4c7f2d65f7c
20,549
java
Java
lb/src/main/java/com/jdcloud/sdk/service/lb/model/Backend.java
jdcloud-apigateway/jdcloud-sdk-java
62e0924aa4b7f51fc8d73404bdc7aa38d820732e
[ "Apache-2.0" ]
38
2018-04-19T09:53:59.000Z
2021-11-08T12:52:15.000Z
lb/src/main/java/com/jdcloud/sdk/service/lb/model/Backend.java
jdcloud-apigateway/jdcloud-sdk-java
62e0924aa4b7f51fc8d73404bdc7aa38d820732e
[ "Apache-2.0" ]
22
2018-04-24T12:17:20.000Z
2022-03-31T10:39:18.000Z
lb/src/main/java/com/jdcloud/sdk/service/lb/model/Backend.java
jdcloud-apigateway/jdcloud-sdk-java
62e0924aa4b7f51fc8d73404bdc7aa38d820732e
[ "Apache-2.0" ]
53
2018-04-19T10:48:05.000Z
2022-03-16T09:15:16.000Z
27.14531
850
0.636868
998,501
/* * Copyright 2018 JDCLOUD.COM * * 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. * * * * * * Contact: * * NOTE: This class is auto generated by the jdcloud code generator program. */ package com.jdcloud.sdk.service.lb.model; import java.util.List; import java.util.ArrayList; /** * backend */ public class Backend implements java.io.Serializable { private static final long serialVersionUID = 1L; /** * 后端服务的Id */ private String backendId; /** * 后端服务的名字 */ private String backendName; /** * 后端服务所属loadBalancer的Id */ private String loadBalancerId; /** * 后端服务所属负载均衡类型,取值为:alb、nlb、dnlb */ private String loadBalancerType; /** * 后端服务的协议 &lt;br&gt;【alb】包括Http,Tcp &lt;br&gt;【nlb】包括Tcp &lt;br&gt;【dnlb】包括Tcp */ private String protocol; /** * 后端服务的端口,取值范围为[1, 65535] */ private Integer port; /** * 调度算法 &lt;br&gt;【alb,nlb】取值范围为[IpHash, RoundRobin, LeastConn](取值范围的含义:加权源Ip哈希,加权轮询和加权最小连接) &lt;br&gt;【dnlb】取值范围为[IpHash, QuintupleHash](取值范围的含义分别为:加权源Ip哈希和加权五元组哈希) */ private String algorithm; /** * 虚拟服务器组的Id列表,目前只支持一个,且与agIds不能同时存在 */ private List<String> targetGroupIds; /** * 高可用组的Id列表,目前只支持一个,且与targetGroupIds不能同时存在 */ private List<String> agIds; /** * 【alb tcp协议】通过Proxy Protocol协议获取真实ip, 取值为False(不获取)或者True(获取,支持v1版本) */ private Boolean proxyProtocol; /** * 后端服务的描述信息 */ private String description; /** * 【nlb】连接耗尽超时,移除target前连接的最大保持时间,范围[0,3600] */ private Integer connectionDrainingSeconds; /** * 会话保持, 取值为false(不开启)或者true(开启) &lt;br&gt;【alb Http协议,RoundRobin算法】支持基于cookie的会话保持 &lt;br&gt;【nlb】支持基于报文源目的IP的会话保持 */ private Boolean sessionStickiness; /** * 【nlb】会话保持超时时间,sessionStickiness开启时生效,默认300s, 范围[1-3600] */ private Integer sessionStickyTimeout; /** * 【alb Http协议】cookie的过期时间,sessionStickiness开启时生效,取值范围为[0,86400], 0表示cookie与浏览器同生命周期 */ private Integer httpCookieExpireSeconds; /** * 【alb http协议】获取负载均衡的协议, 取值为False(不获取)或True(获取) */ private Boolean httpForwardedProtocol; /** * 【alb http协议】获取负载均衡的端口, 取值为False(不获取)或True(获取) */ private Boolean httpForwardedPort; /** * 【alb http协议】获取负载均衡的host信息, 取值为False(不获取)或True(获取) */ private Boolean httpForwardedHost; /** * 【alb http协议】获取负载均衡的vip, 取值为False(不获取)或True(获取) */ private Boolean httpForwardedVip; /** * 健康检查,数据结构:&lt;br&gt;protocol(string)健康检查协议,【ALB、NLB】取值为Http, Tcp,【DNLB】取值为Tcp;&lt;br&gt;healthyThresholdCount(integer)健康阀值,取值范围为[1,5],默认为3;&lt;br&gt;unhealthyThresholdCount(integer)不健康阀值,取值范围为[1,5], 默认为3;&lt;br&gt;checkTimeoutSeconds(integer)响应超时时间, 取值范围为[2,60],默认为3s;&lt;br&gt;intervalSeconds(integer)健康检查间隔, 范围为[5,300], 默认为5s;&lt;br&gt;port(integer)检查端口, 取值范围为[0,65535], 默认为0,默认端口为每个后端服务器接收负载均衡流量的端口;&lt;br&gt;httpDomain(string)【Http协议】检查域名;&lt;br&gt;httpPath(string)【Http协议】检查路径, 健康检查的目标路径,必须以&quot;/&quot;开头,允许输入具体的文件路径,默认为根目录;&lt;br&gt;httpCode([]string)【Http协议】检查来自后端服务器的成功响应时,要使用的HTTP状态码。您可以指定:单个数值(例如:&quot;200&quot;,取值范围200-499)、一段连续数值(例如:&quot;201-205&quot;,取值范围范围200-499,且前面的参数小于后面)和一类连续数值缩写(例如:&quot;3xx&quot;,等价于&quot;300-399&quot;,取值范围2xx、3xx和4xx)。多个数值之间通过&quot;,&quot;分割(例如:&quot;200,202-207,302,4xx&quot;)。目前仅支持2xx、3xx、4xx。 */ private Object healthCheck; /** * 后端服务的创建时间 */ private String createdTime; /** * get 后端服务的Id * * @return */ public String getBackendId() { return backendId; } /** * set 后端服务的Id * * @param backendId */ public void setBackendId(String backendId) { this.backendId = backendId; } /** * get 后端服务的名字 * * @return */ public String getBackendName() { return backendName; } /** * set 后端服务的名字 * * @param backendName */ public void setBackendName(String backendName) { this.backendName = backendName; } /** * get 后端服务所属loadBalancer的Id * * @return */ public String getLoadBalancerId() { return loadBalancerId; } /** * set 后端服务所属loadBalancer的Id * * @param loadBalancerId */ public void setLoadBalancerId(String loadBalancerId) { this.loadBalancerId = loadBalancerId; } /** * get 后端服务所属负载均衡类型,取值为:alb、nlb、dnlb * * @return */ public String getLoadBalancerType() { return loadBalancerType; } /** * set 后端服务所属负载均衡类型,取值为:alb、nlb、dnlb * * @param loadBalancerType */ public void setLoadBalancerType(String loadBalancerType) { this.loadBalancerType = loadBalancerType; } /** * get 后端服务的协议 &lt;br&gt;【alb】包括Http,Tcp &lt;br&gt;【nlb】包括Tcp &lt;br&gt;【dnlb】包括Tcp * * @return */ public String getProtocol() { return protocol; } /** * set 后端服务的协议 &lt;br&gt;【alb】包括Http,Tcp &lt;br&gt;【nlb】包括Tcp &lt;br&gt;【dnlb】包括Tcp * * @param protocol */ public void setProtocol(String protocol) { this.protocol = protocol; } /** * get 后端服务的端口,取值范围为[1, 65535] * * @return */ public Integer getPort() { return port; } /** * set 后端服务的端口,取值范围为[1, 65535] * * @param port */ public void setPort(Integer port) { this.port = port; } /** * get 调度算法 &lt;br&gt;【alb,nlb】取值范围为[IpHash, RoundRobin, LeastConn](取值范围的含义:加权源Ip哈希,加权轮询和加权最小连接) &lt;br&gt;【dnlb】取值范围为[IpHash, QuintupleHash](取值范围的含义分别为:加权源Ip哈希和加权五元组哈希) * * @return */ public String getAlgorithm() { return algorithm; } /** * set 调度算法 &lt;br&gt;【alb,nlb】取值范围为[IpHash, RoundRobin, LeastConn](取值范围的含义:加权源Ip哈希,加权轮询和加权最小连接) &lt;br&gt;【dnlb】取值范围为[IpHash, QuintupleHash](取值范围的含义分别为:加权源Ip哈希和加权五元组哈希) * * @param algorithm */ public void setAlgorithm(String algorithm) { this.algorithm = algorithm; } /** * get 虚拟服务器组的Id列表,目前只支持一个,且与agIds不能同时存在 * * @return */ public List<String> getTargetGroupIds() { return targetGroupIds; } /** * set 虚拟服务器组的Id列表,目前只支持一个,且与agIds不能同时存在 * * @param targetGroupIds */ public void setTargetGroupIds(List<String> targetGroupIds) { this.targetGroupIds = targetGroupIds; } /** * get 高可用组的Id列表,目前只支持一个,且与targetGroupIds不能同时存在 * * @return */ public List<String> getAgIds() { return agIds; } /** * set 高可用组的Id列表,目前只支持一个,且与targetGroupIds不能同时存在 * * @param agIds */ public void setAgIds(List<String> agIds) { this.agIds = agIds; } /** * get 【alb tcp协议】通过Proxy Protocol协议获取真实ip, 取值为False(不获取)或者True(获取,支持v1版本) * * @return */ public Boolean getProxyProtocol() { return proxyProtocol; } /** * set 【alb tcp协议】通过Proxy Protocol协议获取真实ip, 取值为False(不获取)或者True(获取,支持v1版本) * * @param proxyProtocol */ public void setProxyProtocol(Boolean proxyProtocol) { this.proxyProtocol = proxyProtocol; } /** * get 后端服务的描述信息 * * @return */ public String getDescription() { return description; } /** * set 后端服务的描述信息 * * @param description */ public void setDescription(String description) { this.description = description; } /** * get 【nlb】连接耗尽超时,移除target前连接的最大保持时间,范围[0,3600] * * @return */ public Integer getConnectionDrainingSeconds() { return connectionDrainingSeconds; } /** * set 【nlb】连接耗尽超时,移除target前连接的最大保持时间,范围[0,3600] * * @param connectionDrainingSeconds */ public void setConnectionDrainingSeconds(Integer connectionDrainingSeconds) { this.connectionDrainingSeconds = connectionDrainingSeconds; } /** * get 会话保持, 取值为false(不开启)或者true(开启) &lt;br&gt;【alb Http协议,RoundRobin算法】支持基于cookie的会话保持 &lt;br&gt;【nlb】支持基于报文源目的IP的会话保持 * * @return */ public Boolean getSessionStickiness() { return sessionStickiness; } /** * set 会话保持, 取值为false(不开启)或者true(开启) &lt;br&gt;【alb Http协议,RoundRobin算法】支持基于cookie的会话保持 &lt;br&gt;【nlb】支持基于报文源目的IP的会话保持 * * @param sessionStickiness */ public void setSessionStickiness(Boolean sessionStickiness) { this.sessionStickiness = sessionStickiness; } /** * get 【nlb】会话保持超时时间,sessionStickiness开启时生效,默认300s, 范围[1-3600] * * @return */ public Integer getSessionStickyTimeout() { return sessionStickyTimeout; } /** * set 【nlb】会话保持超时时间,sessionStickiness开启时生效,默认300s, 范围[1-3600] * * @param sessionStickyTimeout */ public void setSessionStickyTimeout(Integer sessionStickyTimeout) { this.sessionStickyTimeout = sessionStickyTimeout; } /** * get 【alb Http协议】cookie的过期时间,sessionStickiness开启时生效,取值范围为[0,86400], 0表示cookie与浏览器同生命周期 * * @return */ public Integer getHttpCookieExpireSeconds() { return httpCookieExpireSeconds; } /** * set 【alb Http协议】cookie的过期时间,sessionStickiness开启时生效,取值范围为[0,86400], 0表示cookie与浏览器同生命周期 * * @param httpCookieExpireSeconds */ public void setHttpCookieExpireSeconds(Integer httpCookieExpireSeconds) { this.httpCookieExpireSeconds = httpCookieExpireSeconds; } /** * get 【alb http协议】获取负载均衡的协议, 取值为False(不获取)或True(获取) * * @return */ public Boolean getHttpForwardedProtocol() { return httpForwardedProtocol; } /** * set 【alb http协议】获取负载均衡的协议, 取值为False(不获取)或True(获取) * * @param httpForwardedProtocol */ public void setHttpForwardedProtocol(Boolean httpForwardedProtocol) { this.httpForwardedProtocol = httpForwardedProtocol; } /** * get 【alb http协议】获取负载均衡的端口, 取值为False(不获取)或True(获取) * * @return */ public Boolean getHttpForwardedPort() { return httpForwardedPort; } /** * set 【alb http协议】获取负载均衡的端口, 取值为False(不获取)或True(获取) * * @param httpForwardedPort */ public void setHttpForwardedPort(Boolean httpForwardedPort) { this.httpForwardedPort = httpForwardedPort; } /** * get 【alb http协议】获取负载均衡的host信息, 取值为False(不获取)或True(获取) * * @return */ public Boolean getHttpForwardedHost() { return httpForwardedHost; } /** * set 【alb http协议】获取负载均衡的host信息, 取值为False(不获取)或True(获取) * * @param httpForwardedHost */ public void setHttpForwardedHost(Boolean httpForwardedHost) { this.httpForwardedHost = httpForwardedHost; } /** * get 【alb http协议】获取负载均衡的vip, 取值为False(不获取)或True(获取) * * @return */ public Boolean getHttpForwardedVip() { return httpForwardedVip; } /** * set 【alb http协议】获取负载均衡的vip, 取值为False(不获取)或True(获取) * * @param httpForwardedVip */ public void setHttpForwardedVip(Boolean httpForwardedVip) { this.httpForwardedVip = httpForwardedVip; } /** * get 健康检查,数据结构:&lt;br&gt;protocol(string)健康检查协议,【ALB、NLB】取值为Http, Tcp,【DNLB】取值为Tcp;&lt;br&gt;healthyThresholdCount(integer)健康阀值,取值范围为[1,5],默认为3;&lt;br&gt;unhealthyThresholdCount(integer)不健康阀值,取值范围为[1,5], 默认为3;&lt;br&gt;checkTimeoutSeconds(integer)响应超时时间, 取值范围为[2,60],默认为3s;&lt;br&gt;intervalSeconds(integer)健康检查间隔, 范围为[5,300], 默认为5s;&lt;br&gt;port(integer)检查端口, 取值范围为[0,65535], 默认为0,默认端口为每个后端服务器接收负载均衡流量的端口;&lt;br&gt;httpDomain(string)【Http协议】检查域名;&lt;br&gt;httpPath(string)【Http协议】检查路径, 健康检查的目标路径,必须以&quot;/&quot;开头,允许输入具体的文件路径,默认为根目录;&lt;br&gt;httpCode([]string)【Http协议】检查来自后端服务器的成功响应时,要使用的HTTP状态码。您可以指定:单个数值(例如:&quot;200&quot;,取值范围200-499)、一段连续数值(例如:&quot;201-205&quot;,取值范围范围200-499,且前面的参数小于后面)和一类连续数值缩写(例如:&quot;3xx&quot;,等价于&quot;300-399&quot;,取值范围2xx、3xx和4xx)。多个数值之间通过&quot;,&quot;分割(例如:&quot;200,202-207,302,4xx&quot;)。目前仅支持2xx、3xx、4xx。 * * @return */ public Object getHealthCheck() { return healthCheck; } /** * set 健康检查,数据结构:&lt;br&gt;protocol(string)健康检查协议,【ALB、NLB】取值为Http, Tcp,【DNLB】取值为Tcp;&lt;br&gt;healthyThresholdCount(integer)健康阀值,取值范围为[1,5],默认为3;&lt;br&gt;unhealthyThresholdCount(integer)不健康阀值,取值范围为[1,5], 默认为3;&lt;br&gt;checkTimeoutSeconds(integer)响应超时时间, 取值范围为[2,60],默认为3s;&lt;br&gt;intervalSeconds(integer)健康检查间隔, 范围为[5,300], 默认为5s;&lt;br&gt;port(integer)检查端口, 取值范围为[0,65535], 默认为0,默认端口为每个后端服务器接收负载均衡流量的端口;&lt;br&gt;httpDomain(string)【Http协议】检查域名;&lt;br&gt;httpPath(string)【Http协议】检查路径, 健康检查的目标路径,必须以&quot;/&quot;开头,允许输入具体的文件路径,默认为根目录;&lt;br&gt;httpCode([]string)【Http协议】检查来自后端服务器的成功响应时,要使用的HTTP状态码。您可以指定:单个数值(例如:&quot;200&quot;,取值范围200-499)、一段连续数值(例如:&quot;201-205&quot;,取值范围范围200-499,且前面的参数小于后面)和一类连续数值缩写(例如:&quot;3xx&quot;,等价于&quot;300-399&quot;,取值范围2xx、3xx和4xx)。多个数值之间通过&quot;,&quot;分割(例如:&quot;200,202-207,302,4xx&quot;)。目前仅支持2xx、3xx、4xx。 * * @param healthCheck */ public void setHealthCheck(Object healthCheck) { this.healthCheck = healthCheck; } /** * get 后端服务的创建时间 * * @return */ public String getCreatedTime() { return createdTime; } /** * set 后端服务的创建时间 * * @param createdTime */ public void setCreatedTime(String createdTime) { this.createdTime = createdTime; } /** * set 后端服务的Id * * @param backendId */ public Backend backendId(String backendId) { this.backendId = backendId; return this; } /** * set 后端服务的名字 * * @param backendName */ public Backend backendName(String backendName) { this.backendName = backendName; return this; } /** * set 后端服务所属loadBalancer的Id * * @param loadBalancerId */ public Backend loadBalancerId(String loadBalancerId) { this.loadBalancerId = loadBalancerId; return this; } /** * set 后端服务所属负载均衡类型,取值为:alb、nlb、dnlb * * @param loadBalancerType */ public Backend loadBalancerType(String loadBalancerType) { this.loadBalancerType = loadBalancerType; return this; } /** * set 后端服务的协议 &lt;br&gt;【alb】包括Http,Tcp &lt;br&gt;【nlb】包括Tcp &lt;br&gt;【dnlb】包括Tcp * * @param protocol */ public Backend protocol(String protocol) { this.protocol = protocol; return this; } /** * set 后端服务的端口,取值范围为[1, 65535] * * @param port */ public Backend port(Integer port) { this.port = port; return this; } /** * set 调度算法 &lt;br&gt;【alb,nlb】取值范围为[IpHash, RoundRobin, LeastConn](取值范围的含义:加权源Ip哈希,加权轮询和加权最小连接) &lt;br&gt;【dnlb】取值范围为[IpHash, QuintupleHash](取值范围的含义分别为:加权源Ip哈希和加权五元组哈希) * * @param algorithm */ public Backend algorithm(String algorithm) { this.algorithm = algorithm; return this; } /** * set 虚拟服务器组的Id列表,目前只支持一个,且与agIds不能同时存在 * * @param targetGroupIds */ public Backend targetGroupIds(List<String> targetGroupIds) { this.targetGroupIds = targetGroupIds; return this; } /** * set 高可用组的Id列表,目前只支持一个,且与targetGroupIds不能同时存在 * * @param agIds */ public Backend agIds(List<String> agIds) { this.agIds = agIds; return this; } /** * set 【alb tcp协议】通过Proxy Protocol协议获取真实ip, 取值为False(不获取)或者True(获取,支持v1版本) * * @param proxyProtocol */ public Backend proxyProtocol(Boolean proxyProtocol) { this.proxyProtocol = proxyProtocol; return this; } /** * set 后端服务的描述信息 * * @param description */ public Backend description(String description) { this.description = description; return this; } /** * set 【nlb】连接耗尽超时,移除target前连接的最大保持时间,范围[0,3600] * * @param connectionDrainingSeconds */ public Backend connectionDrainingSeconds(Integer connectionDrainingSeconds) { this.connectionDrainingSeconds = connectionDrainingSeconds; return this; } /** * set 会话保持, 取值为false(不开启)或者true(开启) &lt;br&gt;【alb Http协议,RoundRobin算法】支持基于cookie的会话保持 &lt;br&gt;【nlb】支持基于报文源目的IP的会话保持 * * @param sessionStickiness */ public Backend sessionStickiness(Boolean sessionStickiness) { this.sessionStickiness = sessionStickiness; return this; } /** * set 【nlb】会话保持超时时间,sessionStickiness开启时生效,默认300s, 范围[1-3600] * * @param sessionStickyTimeout */ public Backend sessionStickyTimeout(Integer sessionStickyTimeout) { this.sessionStickyTimeout = sessionStickyTimeout; return this; } /** * set 【alb Http协议】cookie的过期时间,sessionStickiness开启时生效,取值范围为[0,86400], 0表示cookie与浏览器同生命周期 * * @param httpCookieExpireSeconds */ public Backend httpCookieExpireSeconds(Integer httpCookieExpireSeconds) { this.httpCookieExpireSeconds = httpCookieExpireSeconds; return this; } /** * set 【alb http协议】获取负载均衡的协议, 取值为False(不获取)或True(获取) * * @param httpForwardedProtocol */ public Backend httpForwardedProtocol(Boolean httpForwardedProtocol) { this.httpForwardedProtocol = httpForwardedProtocol; return this; } /** * set 【alb http协议】获取负载均衡的端口, 取值为False(不获取)或True(获取) * * @param httpForwardedPort */ public Backend httpForwardedPort(Boolean httpForwardedPort) { this.httpForwardedPort = httpForwardedPort; return this; } /** * set 【alb http协议】获取负载均衡的host信息, 取值为False(不获取)或True(获取) * * @param httpForwardedHost */ public Backend httpForwardedHost(Boolean httpForwardedHost) { this.httpForwardedHost = httpForwardedHost; return this; } /** * set 【alb http协议】获取负载均衡的vip, 取值为False(不获取)或True(获取) * * @param httpForwardedVip */ public Backend httpForwardedVip(Boolean httpForwardedVip) { this.httpForwardedVip = httpForwardedVip; return this; } /** * set 健康检查,数据结构:&lt;br&gt;protocol(string)健康检查协议,【ALB、NLB】取值为Http, Tcp,【DNLB】取值为Tcp;&lt;br&gt;healthyThresholdCount(integer)健康阀值,取值范围为[1,5],默认为3;&lt;br&gt;unhealthyThresholdCount(integer)不健康阀值,取值范围为[1,5], 默认为3;&lt;br&gt;checkTimeoutSeconds(integer)响应超时时间, 取值范围为[2,60],默认为3s;&lt;br&gt;intervalSeconds(integer)健康检查间隔, 范围为[5,300], 默认为5s;&lt;br&gt;port(integer)检查端口, 取值范围为[0,65535], 默认为0,默认端口为每个后端服务器接收负载均衡流量的端口;&lt;br&gt;httpDomain(string)【Http协议】检查域名;&lt;br&gt;httpPath(string)【Http协议】检查路径, 健康检查的目标路径,必须以&quot;/&quot;开头,允许输入具体的文件路径,默认为根目录;&lt;br&gt;httpCode([]string)【Http协议】检查来自后端服务器的成功响应时,要使用的HTTP状态码。您可以指定:单个数值(例如:&quot;200&quot;,取值范围200-499)、一段连续数值(例如:&quot;201-205&quot;,取值范围范围200-499,且前面的参数小于后面)和一类连续数值缩写(例如:&quot;3xx&quot;,等价于&quot;300-399&quot;,取值范围2xx、3xx和4xx)。多个数值之间通过&quot;,&quot;分割(例如:&quot;200,202-207,302,4xx&quot;)。目前仅支持2xx、3xx、4xx。 * * @param healthCheck */ public Backend healthCheck(Object healthCheck) { this.healthCheck = healthCheck; return this; } /** * set 后端服务的创建时间 * * @param createdTime */ public Backend createdTime(String createdTime) { this.createdTime = createdTime; return this; } /** * add item to 虚拟服务器组的Id列表,目前只支持一个,且与agIds不能同时存在 * * @param targetGroupId */ public void addTargetGroupId(String targetGroupId) { if (this.targetGroupIds == null) { this.targetGroupIds = new ArrayList<>(); } this.targetGroupIds.add(targetGroupId); } /** * add item to 高可用组的Id列表,目前只支持一个,且与targetGroupIds不能同时存在 * * @param agId */ public void addAgId(String agId) { if (this.agIds == null) { this.agIds = new ArrayList<>(); } this.agIds.add(agId); } }
92389a719140d3959311d12d88f730b56e091129
1,721
java
Java
api/src/main/java/javax/jdo/annotations/Inheritance.java
tobous/db-jdo
7913371a10da6e9bc7d33079ace023f0d37897d4
[ "Apache-2.0" ]
9
2019-02-06T18:31:12.000Z
2021-11-06T22:49:11.000Z
submissions/available/CPC/CPC-what-property/data/source/apacheDB-trunk/api/src/main/java/javax/jdo/annotations/Inheritance.java
XZ-X/CPC-artifact-release
5710dc0e39509f79e42535e0b5ca5e41cbd90fc2
[ "Unlicense" ]
10
2019-02-22T18:04:24.000Z
2022-02-23T09:13:26.000Z
submissions/available/CPC/CPC-what-property/data/source/apacheDB-trunk/api/src/main/java/javax/jdo/annotations/Inheritance.java
XZ-X/CPC-artifact-release
5710dc0e39509f79e42535e0b5ca5e41cbd90fc2
[ "Unlicense" ]
10
2019-02-22T11:24:08.000Z
2022-02-02T21:29:26.000Z
35.854167
75
0.743754
998,502
/* * 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 javax.jdo.annotations; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotation for the inheritance of the class. * Corresponds to the xml element "inheritance" of the "class" * and "interface" elements. * * @version 2.1 * @since 2.1 */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) public @interface Inheritance { /** Strategy to use for inheritance. Specifies in which table(s) * the members for the class are stored. * @return the inheritance strategy */ InheritanceStrategy strategy() default InheritanceStrategy.UNSPECIFIED; /** Custom inheritance strategy. If customStrategy is non-empty, then * strategy must be UNSPECIFIED. * @return the custom inheritance strategy */ String customStrategy() default ""; }
92389b8370530d52f71257cffda2973a0bf8e2bd
1,724
java
Java
notification-hubs-sample-app-java/src/fcm/java/com/example/notification_hubs_sample_app_java/ui/main/NotificationListViewModel.java
sethmanheim/azure-notificationhubs-android
62aaf0bb5860d8d5e58d25edd9bbdf13814f6f25
[ "Apache-2.0" ]
1
2021-05-17T14:48:35.000Z
2021-05-17T14:48:35.000Z
notification-hubs-sample-app-java/src/fcm/java/com/example/notification_hubs_sample_app_java/ui/main/NotificationListViewModel.java
sethmanheim/azure-notificationhubs-android
62aaf0bb5860d8d5e58d25edd9bbdf13814f6f25
[ "Apache-2.0" ]
null
null
null
notification-hubs-sample-app-java/src/fcm/java/com/example/notification_hubs_sample_app_java/ui/main/NotificationListViewModel.java
sethmanheim/azure-notificationhubs-android
62aaf0bb5860d8d5e58d25edd9bbdf13814f6f25
[ "Apache-2.0" ]
null
null
null
32.528302
84
0.721578
998,503
package com.example.notification_hubs_sample_app_java.ui.main; import android.app.Notification; import androidx.lifecycle.LiveData; import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.ViewModel; import com.example.notification_hubs_sample_app_java.cookbook.NotificationDisplayer; import com.google.firebase.messaging.RemoteMessage; import com.microsoft.windowsazure.messaging.notificationhubs.NotificationHub; import com.microsoft.windowsazure.messaging.notificationhubs.NotificationListener; import java.util.ArrayList; import java.util.List; public class NotificationListViewModel extends ViewModel { private final MutableLiveData<List<RemoteMessage>> mNotifications; private final NotificationListener mListener; public NotificationListViewModel() { mNotifications = new MutableLiveData<List<RemoteMessage>>(); mListener = (context, message) -> { addNotification(message); }; NotificationHub.setListener(mListener); } public void addNotification(RemoteMessage notification) { List<RemoteMessage> toUpdate = mNotifications.getValue(); if(toUpdate == null) { toUpdate = new ArrayList<RemoteMessage>(); } toUpdate.add(0, notification); mNotifications.postValue(toUpdate); } public void clearNotifications() { List<RemoteMessage> toUpdate = mNotifications.getValue(); if (toUpdate == null) { toUpdate = new ArrayList<RemoteMessage>(); } else { toUpdate.clear(); } mNotifications.postValue(toUpdate); } public LiveData<List<RemoteMessage>> getNotificationList() { return mNotifications; } }
92389bf62cf49b61cbdc570f4e65bf839e6b09d3
1,295
java
Java
src/main/java/support/ActionSupportHandler.java
tropo/tropo-webapi-java
96af1fa292c1d4b6321d85a559d9718d33eec7e0
[ "MIT" ]
18
2015-02-02T19:40:53.000Z
2022-02-22T06:40:31.000Z
src/main/java/support/ActionSupportHandler.java
so1us2/tropo-webapi-java
96af1fa292c1d4b6321d85a559d9718d33eec7e0
[ "MIT" ]
16
2015-04-09T20:17:38.000Z
2018-08-14T20:36:49.000Z
src/main/java/support/ActionSupportHandler.java
so1us2/tropo-webapi-java
96af1fa292c1d4b6321d85a559d9718d33eec7e0
[ "MIT" ]
28
2015-04-03T22:27:03.000Z
2020-05-13T12:25:23.000Z
26.428571
80
0.720463
998,504
package support; import java.lang.reflect.Constructor; import com.voxeo.tropo.Key; import com.voxeo.tropo.TropoException; import com.voxeo.tropo.actions.Action; import com.voxeo.tropo.actions.ArrayBackedJsonAction; import com.voxeo.tropo.actions.JsonAction; public class ActionSupportHandler<E extends Action> { private Class<E> clazz; public ActionSupportHandler(Class<E> clazz) { this.clazz = clazz; } public E build(Action action, Key... keys) throws TropoException { return build(action, null, keys); } public E build(Action action, String name, Key... keys) throws TropoException { try { Constructor<E> c = clazz.getConstructor(Key[].class); E instanceAction = c.newInstance(new Object[]{keys}); if (action instanceof ArrayBackedJsonAction) { action.addToArray(name, instanceAction.getName(), instanceAction); } else if (action instanceof JsonAction) { action.put(instanceAction.getName(),instanceAction); } else { action.put(instanceAction.getName(),instanceAction); } return instanceAction; } catch (TropoException te) { throw te; } catch (Exception e) { if (e.getCause() != null && e.getCause() instanceof TropoException) { throw (TropoException)e.getCause(); } e.printStackTrace(); } return null; } }
92389c6ff646e6490dbbec6ff30fb764825c45df
1,499
java
Java
AndroidNanoDegreeProjectCapstone/Phase2/app/src/main/java/io/github/marcelbraghetto/dailydeviations/framework/foundation/device/DefaultDeviceProvider.java
MarcelBraghetto/AndroidNanoDegree2016
2c41d2ee749bf09403a8b2ac2fd8a30d2ad75c59
[ "Apache-2.0" ]
null
null
null
AndroidNanoDegreeProjectCapstone/Phase2/app/src/main/java/io/github/marcelbraghetto/dailydeviations/framework/foundation/device/DefaultDeviceProvider.java
MarcelBraghetto/AndroidNanoDegree2016
2c41d2ee749bf09403a8b2ac2fd8a30d2ad75c59
[ "Apache-2.0" ]
null
null
null
AndroidNanoDegreeProjectCapstone/Phase2/app/src/main/java/io/github/marcelbraghetto/dailydeviations/framework/foundation/device/DefaultDeviceProvider.java
MarcelBraghetto/AndroidNanoDegree2016
2c41d2ee749bf09403a8b2ac2fd8a30d2ad75c59
[ "Apache-2.0" ]
null
null
null
34.068182
104
0.762508
998,505
package io.github.marcelbraghetto.dailydeviations.framework.foundation.device; import android.content.Context; import android.os.Build; import android.support.annotation.NonNull; import android.util.DisplayMetrics; import android.view.WindowManager; import io.github.marcelbraghetto.dailydeviations.framework.foundation.device.contracts.DeviceProvider; /** * Created by Marcel Braghetto on 02/12/15. * * Implementation of the device utils provider contract. */ public class DefaultDeviceProvider implements DeviceProvider { private Context mApplicationContext; public DefaultDeviceProvider(@NonNull Context applicationContext) { mApplicationContext = applicationContext; } @Override public boolean isAtLeastLollipop() { return Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP; } @Override public int getCurrentWindowWidth() { DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager wm = (WindowManager) mApplicationContext.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.widthPixels; } @Override public int getCurrentWindowHeight() { DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager wm = (WindowManager) mApplicationContext.getSystemService(Context.WINDOW_SERVICE); wm.getDefaultDisplay().getMetrics(displayMetrics); return displayMetrics.heightPixels; } }
92389d10e28797ef1f202a77fc9b556300fc11f0
3,792
java
Java
latte_core/src/main/java/com/jqhee/latte/core/delegates/web/WebDelegate.java
JQHee/BFastEC
7c078095eff6419c30211b88aca7f0175a27568d
[ "MIT" ]
null
null
null
latte_core/src/main/java/com/jqhee/latte/core/delegates/web/WebDelegate.java
JQHee/BFastEC
7c078095eff6419c30211b88aca7f0175a27568d
[ "MIT" ]
null
null
null
latte_core/src/main/java/com/jqhee/latte/core/delegates/web/WebDelegate.java
JQHee/BFastEC
7c078095eff6419c30211b88aca7f0175a27568d
[ "MIT" ]
3
2019-09-25T02:10:56.000Z
2021-05-19T07:35:34.000Z
28.088889
88
0.617352
998,506
package com.jqhee.latte.core.delegates.web; import android.annotation.SuppressLint; import android.os.Bundle; import android.support.annotation.Nullable; import android.webkit.WebView; import com.jqhee.latte.core.app.ConfigKeys; import com.jqhee.latte.core.app.Latte; import com.jqhee.latte.core.delegates.LatteDelegate; import com.jqhee.latte.core.delegates.web.route.RouteKeys; import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; /** * @author: wuchao * @date: 2017/11/28 22:45 * @desciption: */ public abstract class WebDelegate extends LatteDelegate implements IWebViewInitializer { private ReferenceQueue<WebView> WEB_VIEW_QUEUE = new ReferenceQueue<>(); private String mUrl = null; private String mHtmlText = null; private WebView mWebView = null; private boolean mIsWebViewAvailable; private LatteDelegate mTopDelegate = null; public WebDelegate() { } protected abstract IWebViewInitializer setInitializer(); @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Bundle args = getArguments(); mHtmlText = args.getString(RouteKeys.HTML_TEXT.name()); if (mHtmlText == null) { mUrl = args.getString(RouteKeys.URL.name()); } initWebView(); } @SuppressLint({"JavascriptInterface", "AddJavascriptInterface"}) private void initWebView() { if (mWebView != null) { mWebView.removeAllViews(); mWebView.destroy(); } else { final IWebViewInitializer initializer = setInitializer(); if (initializer != null) { final WeakReference<WebView> webViewWeakReference = new WeakReference<>(new WebView(getContext()), WEB_VIEW_QUEUE); // 基本配置 mWebView = webViewWeakReference.get(); // IWebViewInitializer接口提供给外部调用 mWebView = initializer.initWebView(mWebView); mWebView.setWebViewClient(initializer.initWebViewClient()); mWebView.setWebChromeClient(initializer.initWebChromeClient()); // 配置js对象的名称 和 delegate String name = Latte.getConfiguration(ConfigKeys.JAVASCRIPT_INTERFACE); mWebView.addJavascriptInterface(LatteWebInterface.create(this), name); mIsWebViewAvailable = true; } else { throw new NullPointerException("Web Initializer is null"); } } } public void setTopDelegate(LatteDelegate delegate) { mTopDelegate = delegate; } public LatteDelegate getTopDelegate() { if (mTopDelegate == null) { mTopDelegate = this; } return mTopDelegate; } public WebView getWebView() { if (mWebView == null) { throw new NullPointerException("WebView IS NULL!"); } return mIsWebViewAvailable ? mWebView : null; } public String getUrl() { return mUrl; } public String getmHtmlText() { return mHtmlText; } @Override public void onPause() { super.onPause(); if (mWebView != null) { mWebView.onPause(); } } @Override public void onResume() { super.onResume(); if (mWebView != null) { mWebView.onResume(); } } @Override public void onDestroyView() { super.onDestroyView(); mIsWebViewAvailable = false; } @Override public void onDestroy() { super.onDestroy(); if (mWebView != null) { mWebView.removeAllViews(); mWebView.destroy(); mWebView = null; } } }
92389d95730483cdab04a9965f1bded0ac8fa180
435
java
Java
java-review/src/test/modules/main/TryTest.java
fat4eyes-mwo/learning
8fb999c503886926253da048a771438a72a65a47
[ "MIT" ]
null
null
null
java-review/src/test/modules/main/TryTest.java
fat4eyes-mwo/learning
8fb999c503886926253da048a771438a72a65a47
[ "MIT" ]
null
null
null
java-review/src/test/modules/main/TryTest.java
fat4eyes-mwo/learning
8fb999c503886926253da048a771438a72a65a47
[ "MIT" ]
null
null
null
16.111111
51
0.613793
998,507
package test.modules.main; import java.io.IOException; public class TryTest { public static void main(String[] args) { try { f(); g(); } catch(IOException | NumberFormatException e) { System.out.println(e.getClass()); } } static void f() throws IOException { } static void g() throws NumberFormatException { } } class TryA { public void a() {} } class TryB { public void b() {} }
92389eb812e5e253202b005fb47416fa2d58d6cb
2,646
java
Java
src/main/java/org/odpi/openmetadata/connector/sas/repository/connector/mapping/MappingFromFile.java
jim-holmes/egeria-connector-sas-viya
7d6f49e92a63bcc588de7d68de0a18f5b287ca8b
[ "Apache-2.0" ]
8
2021-02-02T14:59:50.000Z
2022-03-29T18:18:05.000Z
src/main/java/org/odpi/openmetadata/connector/sas/repository/connector/mapping/MappingFromFile.java
jim-holmes/egeria-connector-sas-viya
7d6f49e92a63bcc588de7d68de0a18f5b287ca8b
[ "Apache-2.0" ]
38
2021-05-04T07:37:08.000Z
2022-03-08T17:42:04.000Z
src/main/java/org/odpi/openmetadata/connector/sas/repository/connector/mapping/MappingFromFile.java
jim-holmes/egeria-connector-sas-viya
7d6f49e92a63bcc588de7d68de0a18f5b287ca8b
[ "Apache-2.0" ]
10
2020-11-17T19:45:02.000Z
2022-02-17T09:47:55.000Z
38.911765
155
0.694633
998,508
//--------------------------------------------------------------------------- // Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //--------------------------------------------------------------------------- package org.odpi.openmetadata.connector.sas.repository.connector.mapping; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonTypeName; import java.util.List; /** * Represents a single TypeDef mapping, to safely parse TypeDefMappings.json resource. */ @JsonIgnoreProperties(ignoreUnknown=true) @JsonTypeName("TypeDefMapping") public class MappingFromFile { /** * The name of the TypeDef within Catalog. */ private String catalog; /** * The name of the TypeDef within OMRS. */ private String omrs; /** * The prefix to use for any generated OMRS TypeDefs based on a singular SAS Catalog type. */ private String prefix; /** * An array of mappings between Catalog and OMRS property names for the TypeDef. */ private List<MappingFromFile> propertyMappings; /** * An array of mappings between Catalog endpoint property names and OMRS endpoing property names, * for any relationship TypeDefs */ private List<MappingFromFile> endpointMappings; @JsonProperty("sasCat") public String getCatalogName() { return this.catalog; } @JsonProperty("sasCat") public void setCatalogName(String catalog) { this.catalog = catalog; } @JsonProperty("omrs") public String getOMRSName() { return this.omrs; } @JsonProperty("omrs") public void setOMRSName(String omrs) { this.omrs = omrs; } @JsonProperty("prefix") public String getPrefix() { return this.prefix; } @JsonProperty("prefix") public void setPrefix(String prefix) { this.prefix = prefix; } @JsonProperty("propertyMappings") public List<MappingFromFile> getPropertyMappings() { return this.propertyMappings; } @JsonProperty("propertyMappings") public void setPropertyMappings(List<MappingFromFile> propertyMappings) { this.propertyMappings = propertyMappings; } @JsonProperty("endpointMappings") public List<MappingFromFile> getEndpointMappings() { return this.endpointMappings; } @JsonProperty("endpointMappings") public void setEndpointMappings(List<MappingFromFile> endpointMappings) { this.endpointMappings = endpointMappings; } @JsonIgnore public boolean isGeneratedType() { return this.prefix != null; } }
92389f1abcdd8a63e928b9c3a16dd03a4e9a624a
1,403
java
Java
nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_3DataSourceFactory.java
s9514171/nifi
d6805abf9bc9d32c138f12fdc33e39da8e1c5fff
[ "Apache-2.0" ]
3,212
2015-07-18T01:39:17.000Z
2022-03-31T04:10:07.000Z
nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_3DataSourceFactory.java
s9514171/nifi
d6805abf9bc9d32c138f12fdc33e39da8e1c5fff
[ "Apache-2.0" ]
4,786
2015-07-24T18:57:19.000Z
2022-03-31T22:21:57.000Z
nifi-registry/nifi-registry-core/nifi-registry-test/src/main/java/org/apache/nifi/registry/db/MariaDB10_3DataSourceFactory.java
s9514171/nifi
d6805abf9bc9d32c138f12fdc33e39da8e1c5fff
[ "Apache-2.0" ]
2,715
2015-07-20T11:26:22.000Z
2022-03-31T13:42:28.000Z
36.921053
106
0.767641
998,509
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.nifi.registry.db; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; import org.testcontainers.containers.MariaDBContainer; @Configuration @Profile("mariadb-10-3") public class MariaDB10_3DataSourceFactory extends MariaDBDataSourceFactory { private static final MariaDBContainer MARIA_DB_CONTAINER = new MariaDBCustomContainer("mariadb:10.3"); static { MARIA_DB_CONTAINER.start(); } @Override protected MariaDBContainer mariaDBContainer() { return MARIA_DB_CONTAINER; } }
92389f51308d8b6d9802ed1fcd83c50955129152
8,448
java
Java
common/src/main/java/org/sonatype/goodies/common/ByteSize.java
sonatype/goodies
e4d2f477410dbc90f8202fcbb1eee4a976d2ee93
[ "Apache-2.0" ]
4
2015-11-11T19:21:48.000Z
2020-06-23T10:45:29.000Z
common/src/main/java/org/sonatype/goodies/common/ByteSize.java
sonatype/goodies
e4d2f477410dbc90f8202fcbb1eee4a976d2ee93
[ "Apache-2.0" ]
21
2015-09-20T21:35:37.000Z
2021-02-17T16:36:11.000Z
common/src/main/java/org/sonatype/goodies/common/ByteSize.java
sonatype/goodies
e4d2f477410dbc90f8202fcbb1eee4a976d2ee93
[ "Apache-2.0" ]
4
2016-05-30T13:40:07.000Z
2020-05-26T06:34:43.000Z
23.597765
114
0.604403
998,510
/* * Copyright (c) 2010-present Sonatype, Inc. All rights reserved. * * This program is licensed to you under the Apache License Version 2.0, * and you may not use this file except in compliance with the Apache License Version 2.0. * You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0. * * Unless required by applicable law or agreed to in writing, * software distributed under the Apache License Version 2.0 is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Apache License Version 2.0 for the specific language governing permissions and limitations there under. */ package org.sonatype.goodies.common; import static com.google.common.base.Preconditions.checkNotNull; import static org.sonatype.goodies.common.ByteSize.ByteUnit.BYTES; import static org.sonatype.goodies.common.ByteSize.ByteUnit.GIGABYTES; import static org.sonatype.goodies.common.ByteSize.ByteUnit.KILOBYTES; import static org.sonatype.goodies.common.ByteSize.ByteUnit.MEGABYTES; import static org.sonatype.goodies.common.ByteSize.ByteUnit.TERABYTES; /** * Representation of a byte size. * * Supports: * * <ul> * <li>BYTES</li> * <li>KILOBYTES</li> * <li>MEGABYTES</li> * <li>GIGABYTES</li> * <li>TERABYTES</li> * </ul> * * @since 1.1 */ public final class ByteSize { public static enum ByteUnit { BYTES, KILOBYTES, MEGABYTES, GIGABYTES, TERABYTES; public long asBytes(final long value) { switch (this) { case BYTES: return value; case KILOBYTES: return value * 1024; case MEGABYTES: return value * 1024 * 1024; case GIGABYTES: return value * 1024 * 1024 * 1024; case TERABYTES: return value * 1024 * 1024 * 1024 * 1024; default: throw new Error(); } } public long asKiloBytes(final long value) { switch (this) { case BYTES: return value / 1024; case KILOBYTES: return value; case MEGABYTES: return value * 1024; case GIGABYTES: return value * 1024 * 1024; case TERABYTES: return value * 1024 * 1024 * 1024; default: throw new Error(); } } public long asMegaBytes(final long value) { switch (this) { case BYTES: return value / 1024 * 1024; case KILOBYTES: return value / 1024; case MEGABYTES: return value; case GIGABYTES: return value * 1024; case TERABYTES: return value * 1024 * 1024; default: throw new Error(); } } public long asGigaBytes(final long value) { switch (this) { case BYTES: return value / 1024 * 1024 * 1024; case KILOBYTES: return value / 1024 * 1024; case MEGABYTES: return value / 1024; case GIGABYTES: return value; case TERABYTES: return value * 1024; default: throw new Error(); } } public long asTeraBytes(final long value) { switch (this) { case BYTES: return value / 1024 * 1024 * 1024 * 1024; case KILOBYTES: return value / 1024 * 1024 * 1024; case MEGABYTES: return value / 1024 * 1024; case GIGABYTES: return value / 1024; case TERABYTES: return value; default: throw new Error(); } } } private final long value; private final ByteUnit unit; public ByteSize(final long value, final ByteUnit unit) { this.value = value; this.unit = checkNotNull(unit); } public long value() { return value; } /** * @since 1.2 */ public int valueI() { return (int) value(); } public ByteUnit unit() { return unit; } public long toBytes() { return unit.asBytes(value); } /** * @since 1.2 */ public int toBytesI() { return (int) toBytes(); } public ByteSize asBytes() { return bytes(toBytes()); } public long toKiloBytes() { return unit.asKiloBytes(value); } /** * @since 1.2 */ public int toKiloBytesI() { return (int) toKiloBytes(); } public ByteSize asKiloBytes() { return kiloBytes(toKiloBytes()); } public long toMegaBytes() { return unit.asMegaBytes(value); } /** * @since 1.2 */ public int toMegaBytesI() { return (int) toMegaBytes(); } public ByteSize asMegaBytes() { return megaBytes(toMegaBytes()); } public long toGigaBytes() { return unit.asGigaBytes(value); } /** * @since 1.2 */ public int toGigaBytesI() { return (int) toGigaBytes(); } public ByteSize asGigaBytes() { return gigaBytes(toGigaBytes()); } public long toTeraBytes() { return unit.asTeraBytes(value); } /** * @since 1.2 */ public int toTeraBytesI() { return (int) toTeraBytes(); } public ByteSize asTeraBytes() { return teraBytes(toTeraBytes()); } @Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } ByteSize that = (ByteSize) obj; return value == that.value && unit == that.unit; } @Override public int hashCode() { int result = (int) (value ^ (value >>> 32)); result = 31 * result + (unit != null ? unit.hashCode() : 0); return result; } private String unitName() { // TODO: i18n support? String name = unit.name().toLowerCase(); if (value == 1) { name = name.substring(0, name.length() - 1); } return name; } @Override public String toString() { return String.format("%d %s", value, unitName()); } public static ByteSize size(final long value, final ByteUnit unit) { return new ByteSize(value, unit); } public static ByteSize bytes(final long value) { return new ByteSize(value, BYTES); } public static ByteSize kiloBytes(final long value) { return new ByteSize(value, KILOBYTES); } public static ByteSize megaBytes(final long value) { return new ByteSize(value, MEGABYTES); } public static ByteSize gigaBytes(final long value) { return new ByteSize(value, GIGABYTES); } public static ByteSize teraBytes(final long value) { return new ByteSize(value, TERABYTES); } // // Parsing // public static ByteSize parse(final String value) { if (value != null) { return doParse(value.trim().toLowerCase()); } return null; } private static class ParseConfig { final ByteUnit unit; final String[] suffixes; private ParseConfig(final ByteUnit unit, final String... suffixes) { this.unit = unit; this.suffixes = suffixes; } } private static final ParseConfig[] PARSE_CONFIGS = { new ParseConfig(BYTES, "bytes", "byte", "b"), new ParseConfig(KILOBYTES, "kilobytes", "kilobyte", "kib", "kb", "k"), new ParseConfig(MEGABYTES, "megabytes", "megabyte", "mib", "mb", "m"), new ParseConfig(GIGABYTES, "gigabytes", "gigabyte", "gib", "gb", "g"), new ParseConfig(TERABYTES, "terabytes", "terabyte", "tib", "tb", "t"), }; private static ByteSize doParse(final String value) { for (ParseConfig config : PARSE_CONFIGS) { ByteSize t = extract(value, config.unit, config.suffixes); if (t != null) { return t; } } throw new RuntimeException("Unable to parse: " + value); } private static ByteSize extract(final String value, final ByteUnit unit, final String... suffixes) { String number=null, units=null; for (int p=0; p<value.length(); p++) { // skip until we find a non-digit if (Character.isDigit(value.charAt(p))) { continue; } // split number and units suffix string number = value.substring(0, p); units = value.substring(p, value.length()).trim(); break; } // if decoded units, check if its one of the supported suffixes if (units != null) { for (String suffix : suffixes) { if (suffix.equals(units)) { long n = Long.parseLong(number.trim()); return new ByteSize(n, unit); } } } // else can not extract return null; } }
9238a451d52758baa805ae9d2899c60a4389fdeb
14,409
java
Java
src/test/java/org/elasticsearch/test/integration/indices/state/OpenCloseIndexTests.java
robinhughes/elasticsearch
933fd504665c0368fc966bf2364cd9b431b7368f
[ "Apache-2.0" ]
1
2021-03-25T10:29:27.000Z
2021-03-25T10:29:27.000Z
src/test/java/org/elasticsearch/test/integration/indices/state/OpenCloseIndexTests.java
robinhughes/elasticsearch
933fd504665c0368fc966bf2364cd9b431b7368f
[ "Apache-2.0" ]
null
null
null
src/test/java/org/elasticsearch/test/integration/indices/state/OpenCloseIndexTests.java
robinhughes/elasticsearch
933fd504665c0368fc966bf2364cd9b431b7368f
[ "Apache-2.0" ]
1
2019-03-12T07:10:52.000Z
2019-03-12T07:10:52.000Z
49.34589
146
0.709279
998,511
/* * Licensed to ElasticSearch and Shay Banon under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. ElasticSearch 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.elasticsearch.test.integration.indices.state; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; import org.elasticsearch.action.support.IgnoreIndices; import org.elasticsearch.client.Client; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.indices.IndexMissingException; import org.elasticsearch.test.integration.AbstractSharedClusterTest; import org.testng.annotations.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.notNullValue; public class OpenCloseIndexTests extends AbstractSharedClusterTest { @Test public void testSimpleCloseOpen() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test1").execute().actionGet(); assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1"); } @Test(expectedExceptions = IndexMissingException.class) public void testSimpleCloseMissingIndex() { Client client = client(); client.admin().indices().prepareClose("test1").execute().actionGet(); } @Test(expectedExceptions = IndexMissingException.class) public void testSimpleOpenMissingIndex() { Client client = client(); client.admin().indices().prepareOpen("test1").execute().actionGet(); } @Test(expectedExceptions = IndexMissingException.class) public void testCloseOneMissingIndex() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); client.admin().indices().prepareClose("test1", "test2").execute().actionGet(); } @Test public void testCloseOneMissingIndexIgnoreMissing() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1", "test2") .setIgnoreIndices(IgnoreIndices.MISSING).execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); } @Test(expectedExceptions = IndexMissingException.class) public void testOpenOneMissingIndex() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); client.admin().indices().prepareOpen("test1", "test2").execute().actionGet(); } @Test public void testOpenOneMissingIndexIgnoreMissing() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test1", "test2") .setIgnoreIndices(IgnoreIndices.MISSING).execute().actionGet(); assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1"); } @Test public void testCloseOpenMultipleIndices() { Client client = client(); createIndex("test1", "test2", "test3"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); CloseIndexResponse closeIndexResponse1 = client.admin().indices().prepareClose("test1").execute().actionGet(); assertThat(closeIndexResponse1.isAcknowledged(), equalTo(true)); CloseIndexResponse closeIndexResponse2 = client.admin().indices().prepareClose("test2").execute().actionGet(); assertThat(closeIndexResponse2.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2"); assertIndexIsOpened("test3"); OpenIndexResponse openIndexResponse1 = client.admin().indices().prepareOpen("test1").execute().actionGet(); assertThat(openIndexResponse1.isAcknowledged(), equalTo(true)); OpenIndexResponse openIndexResponse2 = client.admin().indices().prepareOpen("test2").execute().actionGet(); assertThat(openIndexResponse2.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1", "test2", "test3"); } @Test public void testCloseOpenWildcard() { Client client = client(); createIndex("test1", "test2", "a"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test*").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2"); assertIndexIsOpened("a"); OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test*").execute().actionGet(); assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1", "test2", "a"); } @Test public void testCloseOpenAll() { Client client = client(); createIndex("test1", "test2", "test3"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("_all").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2", "test3"); OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("_all").execute().actionGet(); assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1", "test2", "test3"); } @Test public void testCloseOpenAllWildcard() { Client client = client(); createIndex("test1", "test2", "test3"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("*").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2", "test3"); OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("*").execute().actionGet(); assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1", "test2", "test3"); } @Test(expectedExceptions = ActionRequestValidationException.class) public void testCloseNoIndex() { Client client = client(); client.admin().indices().prepareClose().execute().actionGet(); } @Test(expectedExceptions = ActionRequestValidationException.class) public void testCloseNullIndex() { Client client = client(); client.admin().indices().prepareClose(null).execute().actionGet(); } @Test(expectedExceptions = ActionRequestValidationException.class) public void testOpenNoIndex() { Client client = client(); client.admin().indices().prepareOpen().execute().actionGet(); } @Test(expectedExceptions = ActionRequestValidationException.class) public void testOpenNullIndex() { Client client = client(); client.admin().indices().prepareOpen(null).execute().actionGet(); } @Test public void testOpenAlreadyOpenedIndex() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); //no problem if we try to open an index that's already in open state OpenIndexResponse openIndexResponse1 = client.admin().indices().prepareOpen("test1").execute().actionGet(); assertThat(openIndexResponse1.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1"); } @Test public void testCloseAlreadyClosedIndex() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); //closing the index CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); //no problem if we try to close an index that's already in close state OpenIndexResponse openIndexResponse1 = client.admin().indices().prepareOpen("test1").execute().actionGet(); assertThat(openIndexResponse1.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1"); } @Test public void testSimpleCloseOpenAlias() { Client client = client(); createIndex("test1"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); IndicesAliasesResponse aliasesResponse = client.admin().indices().prepareAliases().addAlias("test1", "test1-alias").execute().actionGet(); assertThat(aliasesResponse.isAcknowledged(), equalTo(true)); CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test1-alias").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1"); OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test1-alias").execute().actionGet(); assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1"); } @Test public void testCloseOpenAliasMultipleIndices() { Client client = client(); createIndex("test1", "test2"); ClusterHealthResponse healthResponse = client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet(); assertThat(healthResponse.isTimedOut(), equalTo(false)); IndicesAliasesResponse aliasesResponse1 = client.admin().indices().prepareAliases().addAlias("test1", "test-alias").execute().actionGet(); assertThat(aliasesResponse1.isAcknowledged(), equalTo(true)); IndicesAliasesResponse aliasesResponse2 = client.admin().indices().prepareAliases().addAlias("test2", "test-alias").execute().actionGet(); assertThat(aliasesResponse2.isAcknowledged(), equalTo(true)); CloseIndexResponse closeIndexResponse = client.admin().indices().prepareClose("test-alias").execute().actionGet(); assertThat(closeIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsClosed("test1", "test2"); OpenIndexResponse openIndexResponse = client.admin().indices().prepareOpen("test-alias").execute().actionGet(); assertThat(openIndexResponse.isAcknowledged(), equalTo(true)); assertIndexIsOpened("test1", "test2"); } private void assertIndexIsOpened(String... indices) { checkIndexState(IndexMetaData.State.OPEN, indices); } private void assertIndexIsClosed(String... indices) { checkIndexState(IndexMetaData.State.CLOSE, indices); } private void checkIndexState(IndexMetaData.State state, String... indices) { ClusterStateResponse clusterStateResponse = client().admin().cluster().prepareState().execute().actionGet(); for (String index : indices) { IndexMetaData indexMetaData = clusterStateResponse.getState().metaData().indices().get(index); assertThat(indexMetaData, notNullValue()); assertThat(indexMetaData.getState(), equalTo(state)); } } }
9238a52b3232872cdd86680847bf7ecad2e8422f
11,248
java
Java
src/minecraft/net/minecraft/block/BlockDispenser.java
SolarEntropy/Minecraft
2de569a3a13c0cce48404bca09bde425d8bde4a8
[ "Apache-2.0" ]
8
2016-03-11T08:37:03.000Z
2021-07-09T14:13:05.000Z
src/minecraft/net/minecraft/block/BlockDispenser.java
SolarEntropy/Minecraft
2de569a3a13c0cce48404bca09bde425d8bde4a8
[ "Apache-2.0" ]
7
2016-03-24T19:12:58.000Z
2016-06-05T07:05:06.000Z
src/minecraft/net/minecraft/block/BlockDispenser.java
SolarEntropy/Minecraft
2de569a3a13c0cce48404bca09bde425d8bde4a8
[ "Apache-2.0" ]
19
2016-03-06T21:44:04.000Z
2021-09-26T15:06:19.000Z
35.371069
205
0.657539
998,512
package net.minecraft.block; import java.util.Random; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.dispenser.IBehaviorDispenseItem; import net.minecraft.dispenser.IBlockSource; import net.minecraft.dispenser.IPosition; import net.minecraft.dispenser.PositionImpl; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; import net.minecraft.inventory.InventoryHelper; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.StatList; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityDispenser; import net.minecraft.tileentity.TileEntityDropper; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; import net.minecraft.util.Mirror; import net.minecraft.util.Rotation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.RegistryDefaulted; import net.minecraft.world.World; public class BlockDispenser extends BlockContainer { public static final PropertyDirection FACING = BlockDirectional.FACING; public static final PropertyBool TRIGGERED = PropertyBool.create("triggered"); public static final RegistryDefaulted<Item, IBehaviorDispenseItem> dispenseBehaviorRegistry = new RegistryDefaulted(new BehaviorDefaultDispenseItem()); protected Random rand = new Random(); protected BlockDispenser() { super(Material.rock); this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(TRIGGERED, Boolean.valueOf(false))); this.setCreativeTab(CreativeTabs.tabRedstone); } /** * How many world ticks before ticking */ public int tickRate(World worldIn) { return 4; } public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { super.onBlockAdded(worldIn, pos, state); this.setDefaultDirection(worldIn, pos, state); } private void setDefaultDirection(World worldIn, BlockPos pos, IBlockState state) { if (!worldIn.isRemote) { EnumFacing enumfacing = (EnumFacing)state.getValue(FACING); boolean flag = worldIn.getBlockState(pos.north()).isFullBlock(); boolean flag1 = worldIn.getBlockState(pos.south()).isFullBlock(); if (enumfacing == EnumFacing.NORTH && flag && !flag1) { enumfacing = EnumFacing.SOUTH; } else if (enumfacing == EnumFacing.SOUTH && flag1 && !flag) { enumfacing = EnumFacing.NORTH; } else { boolean flag2 = worldIn.getBlockState(pos.west()).isFullBlock(); boolean flag3 = worldIn.getBlockState(pos.east()).isFullBlock(); if (enumfacing == EnumFacing.WEST && flag2 && !flag3) { enumfacing = EnumFacing.EAST; } else if (enumfacing == EnumFacing.EAST && flag3 && !flag2) { enumfacing = EnumFacing.WEST; } } worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing).withProperty(TRIGGERED, Boolean.valueOf(false)), 2); } } public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand side, ItemStack hitX, EnumFacing hitY, float hitZ, float p_180639_9_, float p_180639_10_) { if (worldIn.isRemote) { return true; } else { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityDispenser) { playerIn.displayGUIChest((TileEntityDispenser)tileentity); if (tileentity instanceof TileEntityDropper) { playerIn.triggerAchievement(StatList.field_188083_Q); } else { playerIn.triggerAchievement(StatList.field_188085_S); } } return true; } } protected void dispense(World worldIn, BlockPos pos) { BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos); TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity(); if (tileentitydispenser != null) { int i = tileentitydispenser.getDispenseSlot(); if (i < 0) { worldIn.playAuxSFX(1001, pos, 0); } else { ItemStack itemstack = tileentitydispenser.getStackInSlot(i); IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack); if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider) { ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack); tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize <= 0 ? null : itemstack1); } } } } protected IBehaviorDispenseItem getBehavior(ItemStack stack) { return (IBehaviorDispenseItem)dispenseBehaviorRegistry.getObject(stack == null ? null : stack.getItem()); } /** * Called when a neighboring block changes. */ public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock) { boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(pos.up()); boolean flag1 = ((Boolean)state.getValue(TRIGGERED)).booleanValue(); if (flag && !flag1) { worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn)); worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(true)), 4); } else if (!flag && flag1) { worldIn.setBlockState(pos, state.withProperty(TRIGGERED, Boolean.valueOf(false)), 4); } } public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { if (!worldIn.isRemote) { this.dispense(worldIn, pos); } } /** * Returns a new instance of a block's tile entity class. Called on placing the block. */ public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityDispenser(); } /** * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the * IBlockstate */ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { return this.getDefaultState().withProperty(FACING, BlockPistonBase.func_185647_a(pos, placer)).withProperty(TRIGGERED, Boolean.valueOf(false)); } /** * Called by ItemBlocks after a block is set in the world, to allow post-place logic */ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { worldIn.setBlockState(pos, state.withProperty(FACING, BlockPistonBase.func_185647_a(pos, placer)), 2); if (stack.hasDisplayName()) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityDispenser) { ((TileEntityDispenser)tileentity).setCustomName(stack.getDisplayName()); } } } public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityDispenser) { InventoryHelper.dropInventoryItems(worldIn, pos, (TileEntityDispenser)tileentity); worldIn.updateComparatorOutputLevel(pos, this); } super.breakBlock(worldIn, pos, state); } /** * Get the position where the dispenser at the given Coordinates should dispense to. */ public static IPosition getDispensePosition(IBlockSource coords) { EnumFacing enumfacing = getFacing(coords.getBlockMetadata()); double d0 = coords.getX() + 0.7D * (double)enumfacing.getFrontOffsetX(); double d1 = coords.getY() + 0.7D * (double)enumfacing.getFrontOffsetY(); double d2 = coords.getZ() + 0.7D * (double)enumfacing.getFrontOffsetZ(); return new PositionImpl(d0, d1, d2); } /** * Get the facing of a dispenser with the given metadata */ public static EnumFacing getFacing(int meta) { return EnumFacing.getFront(meta & 7); } public boolean hasComparatorInputOverride(IBlockState state) { return true; } public int getComparatorInputOverride(IBlockState worldIn, World pos, BlockPos p_180641_3_) { return Container.calcRedstone(pos.getTileEntity(p_180641_3_)); } /** * The type of render function called. 3 for standard block models, 2 for TESR's, 1 for liquids, -1 is no render */ public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; } /** * Convert the given metadata into a BlockState for this Block */ public IBlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(TRIGGERED, Boolean.valueOf((meta & 8) > 0)); } /** * Convert the BlockState into the correct metadata value */ public int getMetaFromState(IBlockState state) { int i = 0; i = i | ((EnumFacing)state.getValue(FACING)).getIndex(); if (((Boolean)state.getValue(TRIGGERED)).booleanValue()) { i |= 8; } return i; } /** * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed * blockstate. */ public IBlockState withRotation(IBlockState state, Rotation rot) { return state.withProperty(FACING, rot.func_185831_a((EnumFacing)state.getValue(FACING))); } /** * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed * blockstate. */ public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.func_185800_a((EnumFacing)state.getValue(FACING))); } protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, new IProperty[] {FACING, TRIGGERED}); } }
9238a57143b63025368fa348dbe544c24bb9ff42
3,129
java
Java
soar-netty/src/main/java/soar/netty/client/NettyClient.java
carryxyh/soar
e74a794eb7a6f5baafab7a3ccd2afd2fdc503b77
[ "Apache-2.0" ]
5
2018-04-19T12:59:06.000Z
2018-09-14T10:38:32.000Z
soar-netty/src/main/java/soar/netty/client/NettyClient.java
carryxyh/soar
e74a794eb7a6f5baafab7a3ccd2afd2fdc503b77
[ "Apache-2.0" ]
null
null
null
soar-netty/src/main/java/soar/netty/client/NettyClient.java
carryxyh/soar
e74a794eb7a6f5baafab7a3ccd2afd2fdc503b77
[ "Apache-2.0" ]
1
2018-08-23T07:58:30.000Z
2018-08-23T07:58:30.000Z
29.242991
148
0.64078
998,513
package soar.netty.client; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.PooledByteBufAllocator; import io.netty.channel.*; import io.netty.util.concurrent.DefaultThreadFactory; import soar.common.exception.SoarException; import soar.common.exception.SoarExceptionCode; import soar.netty.ClientConfig; import java.util.concurrent.TimeUnit; /** * NettyClient * * @author xiuyuhang [xiuyuhang] * @since 2018-03-14 */ public class NettyClient extends AbstractNettyClient { /** * client bootstrap */ private Bootstrap bootstrap; /** * client loop group */ private EventLoopGroup eventLoopGroup; private volatile Channel channel; public NettyClient(ClientConfig clientConfig) { super(clientConfig); } public void doOpen() { eventLoopGroup = initEventLoopGroup(Runtime.getRuntime().availableProcessors(), new DefaultThreadFactory("soar-client", true)); bootstrap = new Bootstrap(); bootstrap.group(eventLoopGroup) .option(ChannelOption.SO_KEEPALIVE, Boolean.TRUE) .option(ChannelOption.TCP_NODELAY, Boolean.TRUE) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, clientConfig.getTimeout()) .channelFactory(initChannelFactory()); if (clientConfig.getTimeout() < 3000) { bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, clientConfig.getTimeout()); } else { bootstrap.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 3000); } bootstrap.handler(new ChannelInitializer() { @Override protected void initChannel(Channel ch) throws Exception { //TODO } }); } public void doClose() { if (eventLoopGroup != null) { eventLoopGroup.shutdownGracefully(); } } @Override public void doConnect() { ChannelFuture future = bootstrap.connect(getConnectAddress()); boolean ret = future.awaitUninterruptibly(3000, TimeUnit.MILLISECONDS); if (ret && future.isSuccess()) { Channel newChannel = future.channel(); Channel oldChannel = this.channel; // copy reference if (oldChannel != null) { oldChannel.close(); } this.channel = newChannel; } else if (future.cause() != null) { throw new SoarException(SoarExceptionCode.CONNECT_REMOTE_SERVER_FAIL.getCode(), future.cause().getMessage(), future.cause()); } else { throw new SoarException(SoarExceptionCode.CONNECT_REMOTE_SERVER_FAIL.getCode(), SoarExceptionCode.CONNECT_REMOTE_SERVER_FAIL.getDesc()); } } @Override public void doDisConnect() { Channel channel = this.channel; if (channel != null) { channel.close(); } } @Override public void send(Object message) { } @Override public boolean isConnect() { return !closed && channel.isActive(); } }
9238a59f520abf82f7504a4484d307f6c324a658
5,641
java
Java
melete/melete-hbm/src/java/org/etudes/component/app/melete/MeleteResource.java
sadupally/Dev
ead9de3993b7a805199ac254c6fa99d3dda48adf
[ "ECL-2.0" ]
null
null
null
melete/melete-hbm/src/java/org/etudes/component/app/melete/MeleteResource.java
sadupally/Dev
ead9de3993b7a805199ac254c6fa99d3dda48adf
[ "ECL-2.0" ]
null
null
null
melete/melete-hbm/src/java/org/etudes/component/app/melete/MeleteResource.java
sadupally/Dev
ead9de3993b7a805199ac254c6fa99d3dda48adf
[ "ECL-2.0" ]
null
null
null
20.815498
147
0.661939
998,514
/********************************************************************************** * * $URL: https://source.sakaiproject.org/contrib/etudes/melete/tags/2.9.1/melete-hbm/src/java/org/etudes/component/app/melete/MeleteResource.java $ * $Id: MeleteResource.java 78260 2012-01-24 21:26:42Z upchh@example.com $ *********************************************************************************** * * Copyright (c) 2008, 2009, 2010, 2011, 2012 Etudes, Inc. * * Portions completed before September 1, 2008 Copyright (c) 2004, 2005, 2006, 2007, 2008 Foothill College, ETUDES 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 org.etudes.component.app.melete; import org.apache.commons.lang.builder.ToStringBuilder; import org.etudes.api.app.melete.MeleteResourceService; public class MeleteResource implements MeleteResourceService { /** persistent field */ private String resourceId; /** nullable persistent field */ private int licenseCode; /** nullable persistent field */ private String ccLicenseUrl; /** nullable persistent field */ private boolean reqAttr; /** nullable persistent field */ private boolean allowCmrcl; /** nullable persistent field */ private int allowMod; /** nullable persistent field */ private int version; private String copyrightOwner; private String copyrightYear; /** full constructor */ public MeleteResource(String resourceId, int licenseCode, String ccLicenseUrl, boolean reqAttr, boolean allowCmrcl, int allowMod, int version, org.etudes.component.app.melete.Section section, String copyrightOwner, String copyrightYear) { this.resourceId = resourceId; this.licenseCode = licenseCode; this.ccLicenseUrl = ccLicenseUrl; this.reqAttr = reqAttr; this.allowCmrcl = allowCmrcl; this.allowMod = allowMod; this.version = version; this.copyrightOwner = copyrightOwner; this.copyrightYear = copyrightYear; } /** default constructor */ public MeleteResource() { } /** copy constructor */ public MeleteResource(MeleteResource s1) { // this.resourceId = s1.resourceId; this.licenseCode = s1.licenseCode; this.ccLicenseUrl = s1.ccLicenseUrl; this.reqAttr = s1.reqAttr; this.allowCmrcl = s1.allowCmrcl; this.allowMod = s1.allowMod; this.copyrightOwner = s1.copyrightOwner; this.copyrightYear = s1.copyrightYear; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((resourceId == null) ? 0 : resourceId.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; MeleteResource other = (MeleteResource) obj; if (resourceId == null) { if (other.resourceId != null) return false; } else if (!resourceId.equals(other.resourceId)) return false; return true; } /** * @return Returns the copyrightOwner. */ public String getCopyrightOwner() { return copyrightOwner; } /** * @param copyrightOwner * The copyrightOwner to set. */ public void setCopyrightOwner(String copyrightOwner) { this.copyrightOwner = copyrightOwner; } /** * @return Returns the copyrightYear. */ public String getCopyrightYear() { return copyrightYear; } /** * @param copyrightYear * The copyrightYear to set. */ public void setCopyrightYear(String copyrightYear) { this.copyrightYear = copyrightYear; } /** * @return Returns the resourceId. */ public String getResourceId() { return resourceId; } /** * @param resourceId * The resourceId to set. */ public void setResourceId(String resourceId) { this.resourceId = resourceId; } /** * {@inheritDoc} */ public int getLicenseCode() { return this.licenseCode; } /** * {@inheritDoc} */ public void setLicenseCode(int licenseCode) { this.licenseCode = licenseCode; } /** * {@inheritDoc} */ public String getCcLicenseUrl() { return this.ccLicenseUrl; } /** * {@inheritDoc} */ public void setCcLicenseUrl(String ccLicenseUrl) { this.ccLicenseUrl = ccLicenseUrl; } /** * {@inheritDoc} */ public boolean isReqAttr() { return this.reqAttr; } /** * {@inheritDoc} */ public void setReqAttr(boolean reqAttr) { this.reqAttr = reqAttr; } /** * {@inheritDoc} */ public boolean isAllowCmrcl() { return this.allowCmrcl; } /** * {@inheritDoc} */ public void setAllowCmrcl(boolean allowCmrcl) { this.allowCmrcl = allowCmrcl; } /** * {@inheritDoc} */ public int getAllowMod() { return this.allowMod; } /** * {@inheritDoc} */ public void setAllowMod(int allowMod) { this.allowMod = allowMod; } /** * {@inheritDoc} */ public int getVersion() { return this.version; } /** * {@inheritDoc} */ public void setVersion(int version) { this.version = version; } /** * {@inheritDoc} */ public String toString() { return new ToStringBuilder(this).append("resourceId", getResourceId()).toString(); } }
9238a64d0a746dee14ad204579403a7bb187c4b5
5,475
java
Java
src/main/java/havis/middleware/reader/rf_r/RFCUtils.java
menucha-de/Middleware.Reader.RF-R
9020dcc4f6b47339446a36f236d44b6dd45d6095
[ "Apache-2.0" ]
null
null
null
src/main/java/havis/middleware/reader/rf_r/RFCUtils.java
menucha-de/Middleware.Reader.RF-R
9020dcc4f6b47339446a36f236d44b6dd45d6095
[ "Apache-2.0" ]
null
null
null
src/main/java/havis/middleware/reader/rf_r/RFCUtils.java
menucha-de/Middleware.Reader.RF-R
9020dcc4f6b47339446a36f236d44b6dd45d6095
[ "Apache-2.0" ]
null
null
null
28.367876
113
0.608584
998,515
package havis.middleware.reader.rf_r; public class RFCUtils { /** * Converts a byte array to a hexadecimal string. * * @param bytes * any array of bytes * @return a hexadecimal string */ public static String bytesToHex(byte[] bytes) { if (bytes == null) return null; char[] hexChars = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; char[] resChars = new char[bytes.length * 2]; for (int iByte = 0; iByte < bytes.length; iByte++) { byte b = bytes[iByte]; int b0 = (b & 0xf0) >> 4; int b1 = b & 0x0f; resChars[2 * iByte] = hexChars[b0]; resChars[2 * iByte + 1] = hexChars[b1]; } return new String(resChars); } /** * Writes the bits of the given byte array to std. out in 4-bit clusters. * * @param bytes * an array of bytes * @return a string showing the specified bytes as bits in well-readable * 4-bit-clusters */ public static String bytesToBin(byte[] bytes) { if (bytes == null) return null; String[] binStrings = { "0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111" }; StringBuffer resultBuffer = new StringBuffer(bytes.length * 8 + 16); for (int iByte = 0; iByte < bytes.length; iByte++) { byte b = bytes[iByte]; int b0 = (b & 0xf0) >> 4; int b1 = b & 0x0f; resultBuffer.append(binStrings[b0]); resultBuffer.append(" "); resultBuffer.append(binStrings[b1]); resultBuffer.append(" "); } return resultBuffer.toString().trim(); } /** * Converts the given hexadecimal string to a byte array. * * @param hexStr * a hexadecimal string * @return an array of bytes * @throws IllegalArgumentException * if the hex string specified has an odd number of characters. */ public static byte[] hexToBytes(String hexStr) throws IllegalArgumentException { hexStr = hexStr.replaceAll("\\s|_", ""); if (hexStr.length() % 2 != 0) throw new IllegalArgumentException("Hex string must have an even number of characters."); byte[] result = new byte[hexStr.length() / 2]; for (int i = 0; i < hexStr.length(); i += 2) result[i / 2] = Integer.decode("0x" + hexStr.charAt(i) + hexStr.charAt(i + 1)).byteValue(); return result; } /** * Converts an array of bytes to an integer. This array must not contain * more that 4 bytes (32 bits), to make sure the result can be stored in an * integer. * * @param maxFourBytes * 4 bytes of data * @return the bytes of data as one integer * @throws IllegalArgumentException * if the byte array contains more than 4 bytes. */ public static int bytesToInt(byte[] maxFourBytes) throws IllegalArgumentException { if (maxFourBytes.length > 4) throw new IllegalArgumentException("Byte array must not contain more than 4 bytes."); int ret = 0; for (int i = 0; i < maxFourBytes.length; i++) { ret |= maxFourBytes[i] & 0xff; if (i + 1 < maxFourBytes.length) ret <<= 8; } return ret; } /** * Converts an array of bytes to a short. This array must not contain more * that 2 bytes (16 bits), to make sure the result can be stored in a short. * * @param maxTwoBytes * 2 bytes of data * @return the bytes of data as one short * @throws IllegalArgumentException * if the byte array contains more than 2 bytes. */ public static short bytesToShort(byte[] maxTwoBytes) throws IllegalArgumentException { if (maxTwoBytes.length > 2) throw new IllegalArgumentException("Byte array must not contain more than 2 bytes."); short ret = 0; for (int i = 0; i < maxTwoBytes.length; i++) { ret |= maxTwoBytes[i] & 0xff; if (i + 1 < maxTwoBytes.length) ret <<= 8; } return ret; } /** * Converts an integer to a byte array (of 4 bytes). * * @param num * an integer * @return 4 bytes of data representing the integer <code>num</code> */ public static byte[] intToBytes(int num) { byte[] arr = new byte[4]; byte b = 0; for (int i = 4; i > 0; i--) { b = (byte) (num & 0xff); num >>= 8; arr[i - 1] = b; } return arr; } /** * Converts a short to a byte array (of 2 bytes). * * @param num * a short * @return 2 bytes of data representing the short <code>num</code> */ public static byte[] shortToBytes(short num) { byte[] arr = new byte[2]; byte b = 0; for (int i = 2; i > 0; i--) { b = (byte) (num & 0xff); num >>= 8; arr[i - 1] = b; } return arr; } /** * Reverses the order of the elements in the given array. * * @param array * an array of bytes */ public static void reverseByteArray(byte[] array) { reverseByteArray(array, 0, array.length); } /** * Reverses the order of the elements in the given array starting at * <code>startIndex</code> applying to <code>count</code> number of items. * * @param array * an array of bytes * @param startIndex * the index of the element to start to reverse the order * @param count * the number of elements starting from <code>startIndex</code> * to apply this method to. */ public static void reverseByteArray(byte[] array, int startIndex, int count) { for (int l = startIndex, r = startIndex + count - 1; l < r; l++, r--) { byte item = array[l]; array[l] = array[r]; array[r] = item; } } }
9238a69e4bf3395f589ae30b289cfaac19865c71
1,484
java
Java
src/jzOffer/offer11_20/Offer12.java
czgggggggg/Leetcode
618b337faf8dc46b5fc78d7f64350a493bccdb5d
[ "MIT" ]
null
null
null
src/jzOffer/offer11_20/Offer12.java
czgggggggg/Leetcode
618b337faf8dc46b5fc78d7f64350a493bccdb5d
[ "MIT" ]
null
null
null
src/jzOffer/offer11_20/Offer12.java
czgggggggg/Leetcode
618b337faf8dc46b5fc78d7f64350a493bccdb5d
[ "MIT" ]
null
null
null
32.26087
92
0.398248
998,516
package jzOffer.offer11_20; /** * @Author czgggggggg * @Date 2021/2/9 * @Description 矩阵中的路径 * @Since version-1.0 */ public class Offer12 { // public static void main(String[] args) { // char[][] board = {{'A', 'B', 'C', 'E'},{'S', 'F', 'C', 'S'},{'A', 'D', 'E', 'E'}}; // String word = "ABCCED"; // System.out.println(exist(board, word)); // } // //分析: // //board = [["A","B","C","E"], // // ["S","F","C","S"], // // ["A","D","E","E"]], word = "ABCCED" // //board = [["a","b"], // // ["c","d"]], word = "abcd" // //采用DFS // //按照右下左上的顺序依次查找 // public static boolean exist(char[][] board, String word) { // int n = board.length; // int m = board[0].length; // char start_char = word.charAt(0);//获取word的起始字符 // boolean tag[][] = new boolean[n][m];//标记数组,标记board中的每个元素是否已经包含在当前的路径中 // for(int i = 0; i < n; i++){//标记数组的初始化 // for(int j = 0; j < m; j++){ // tag[i][j] = false; // } // } // for(int i = 0; i < n; i++){ // for(int j = 0; j < m; j++){ // if(board[i][j] == start_char){//在board中找到起始点(要遍历所有的起始点,直到找到存在指定路径的起始点为止) // tag[i][j] = true; // board[i][j + 1] // board[i + 1][j] // board[i ][j - 1] // board[i - 1][j] // } // } // } // return true; // } }
9238a6d70d95816662c3bbcd3bd6de79f5f06e10
2,871
java
Java
src/main/java/com/ibm/g11n/pipeline/client/TranslationRequestStatus.java
sid41/gp-java-client
342152cec4f87259c242f362c9e4df5efc1f4399
[ "Apache-2.0" ]
1
2018-04-19T06:09:19.000Z
2018-04-19T06:09:19.000Z
src/main/java/com/ibm/g11n/pipeline/client/TranslationRequestStatus.java
sid41/gp-java-client
342152cec4f87259c242f362c9e4df5efc1f4399
[ "Apache-2.0" ]
10
2018-03-22T14:44:17.000Z
2021-03-16T23:14:30.000Z
src/main/java/com/ibm/g11n/pipeline/client/TranslationRequestStatus.java
sid41/gp-java-client
342152cec4f87259c242f362c9e4df5efc1f4399
[ "Apache-2.0" ]
7
2018-02-27T22:22:38.000Z
2022-03-06T10:32:59.000Z
39.875
85
0.720655
998,517
/* * Copyright IBM Corp. 2017 * * 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.ibm.g11n.pipeline.client; /** * Translation request status enum. * * @author yoshito_umaoka */ public enum TranslationRequestStatus { /** * Draft status. The translation request is not yet submitted for * professional translation post editing service. Globalization Pipeline * user can edit the contents of the translation request or delete the * request in this state. */ DRAFT, /** * Submitted status. The translation request is submitted by user * for professional translation post editing service. Globalization Pipeline * user cannot modify the contents of the translation request in this state. */ SUBMITTED, /** * Started status. The professional translation post editing service * provider acknowledged the translation request and started working on * the request. Globalization Pipeline user cannot modify the contents * of the translation request in this state. */ STARTED, /** * Translated status. The professional translation post editing service * provider finished editing the translation. Globalization Pipeline user * cannot modify the contents of the translation request in this state. */ TRANSLATED, /** * Merged status. The final translation results from the professional translation * post editing provider were merged to the original Globalization Pipeline * bundle. Globalization Pipeline user can modify only specific field(s) such * as metadata field in this state. */ MERGED, /** * Cancelled status. The translation request is cancelled. Globalization Pipeline * service or assigned professional translation post editing service provider may * cancel a translation request when the service or the provider cannot handle * the request for some reasons. Globalization Pipeline user cannot modify * the contents of the translation request in this state, but can delete it. */ CANCELLED, /** * Unknown status. This is a special status only used when Globalization Pipeline * service returns a status not supported by this SDK. This status should not be * used for updating an existing translation request. */ UNKNOWN; }
9238a70fa765d89d3b87eefe1c31dd03032b04f3
321
java
Java
src/main/java/com/bennyfranco/weather/api/rest/services/exceptions/StationException.java
BennyFranco/weather-api-rest
8ea5d51b04718603e8a0a8bfacadad191585e787
[ "MIT" ]
null
null
null
src/main/java/com/bennyfranco/weather/api/rest/services/exceptions/StationException.java
BennyFranco/weather-api-rest
8ea5d51b04718603e8a0a8bfacadad191585e787
[ "MIT" ]
null
null
null
src/main/java/com/bennyfranco/weather/api/rest/services/exceptions/StationException.java
BennyFranco/weather-api-rest
8ea5d51b04718603e8a0a8bfacadad191585e787
[ "MIT" ]
null
null
null
21.4
63
0.719626
998,518
package com.bennyfranco.weather.api.rest.services.exceptions; /** * This exceptions is created when something unexpected occurs. * * @author Benny Franco * @version 0.0.1 29 ene 2017 */ public class StationException extends Exception { public StationException(String message) { super(message); } }
9238a835b0769bfd39eb8f5e8ea51aa443b0dd79
1,098
java
Java
chronix-plugin-api/src/main/java/org/oxymores/chronix/exceptions/ChronixNoLocalNode.java
marcanpilami/jChronix
ed1c1f099b440027c431beee2f76665bf59b578d
[ "Apache-2.0" ]
1
2018-02-27T09:24:53.000Z
2018-02-27T09:24:53.000Z
chronix-plugin-api/src/main/java/org/oxymores/chronix/exceptions/ChronixNoLocalNode.java
marcanpilami/jChronix
ed1c1f099b440027c431beee2f76665bf59b578d
[ "Apache-2.0" ]
11
2020-09-09T19:00:50.000Z
2022-02-27T14:31:24.000Z
chronix-plugin-api/src/main/java/org/oxymores/chronix/exceptions/ChronixNoLocalNode.java
marcanpilami/jChronix
ed1c1f099b440027c431beee2f76665bf59b578d
[ "Apache-2.0" ]
1
2018-02-27T09:30:29.000Z
2018-02-27T09:30:29.000Z
34.3125
137
0.746812
998,519
/** * By Marc-Antoine Gouillart, 2012 * * See the NOTICE file distributed with this work for * information regarding copyright ownership. * This file is licensed 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.oxymores.chronix.exceptions; public class ChronixNoLocalNode extends ChronixException { private static final long serialVersionUID = 1L; public ChronixNoLocalNode(String localElementDescription) { super(String.format("Local node could not be found in metadata with request %s. Check your metadata.", localElementDescription)); } }
9238a861523ec6f5608a27fbe77781cbf6f823bc
4,136
java
Java
services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/ZooKeeperClusterActionHandler.java
cloudera/whirr
c946a349a06f318cff24d5ef12d9eec3e97e1dc8
[ "Apache-2.0" ]
2
2015-02-25T00:50:28.000Z
2018-03-14T22:25:45.000Z
services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/ZooKeeperClusterActionHandler.java
cloudera/whirr
c946a349a06f318cff24d5ef12d9eec3e97e1dc8
[ "Apache-2.0" ]
null
null
null
services/zookeeper/src/main/java/org/apache/whirr/service/zookeeper/ZooKeeperClusterActionHandler.java
cloudera/whirr
c946a349a06f318cff24d5ef12d9eec3e97e1dc8
[ "Apache-2.0" ]
2
2017-09-30T02:40:38.000Z
2020-12-12T10:10:17.000Z
37.6
101
0.749275
998,520
package org.apache.whirr.service.zookeeper; /** * 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. */ import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.collect.Lists; import java.io.IOException; import java.util.List; import java.util.Set; import org.apache.whirr.service.Cluster; import org.apache.whirr.service.Cluster.Instance; import org.apache.whirr.service.ClusterActionEvent; import org.apache.whirr.service.ClusterActionHandlerSupport; import org.apache.whirr.service.ClusterSpec; import org.apache.whirr.service.ComputeServiceContextBuilder; import org.apache.whirr.service.RolePredicates; import org.apache.whirr.service.jclouds.FirewallSettings; import org.jclouds.compute.ComputeServiceContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ZooKeeperClusterActionHandler extends ClusterActionHandlerSupport { private static final Logger LOG = LoggerFactory.getLogger(ZooKeeperClusterActionHandler.class); public static final String ZOOKEEPER_ROLE = "zookeeper"; private static final int CLIENT_PORT = 2181; @Override public String getRole() { return ZOOKEEPER_ROLE; } @Override protected void beforeBootstrap(ClusterActionEvent event) throws IOException { addRunUrl(event, "sun/java/install"); addRunUrl(event, "apache/zookeeper/install"); } @Override protected void beforeConfigure(ClusterActionEvent event) throws IOException, InterruptedException { ClusterSpec clusterSpec = event.getClusterSpec(); Cluster cluster = event.getCluster(); LOG.info("Authorizing firewall"); ComputeServiceContext computeServiceContext = ComputeServiceContextBuilder.build(clusterSpec); FirewallSettings.authorizeIngress(computeServiceContext, cluster.getInstances(), clusterSpec, CLIENT_PORT); // Pass list of all servers in ensemble to configure script. // Position is significant: i-th server has id i. String servers = Joiner.on(' ').join(getPrivateIps(cluster.getInstancesMatching( RolePredicates.role(ZooKeeperClusterActionHandler.ZOOKEEPER_ROLE)))); addRunUrl(event, "apache/zookeeper/post-configure", "-c", clusterSpec.getProvider(), servers); } @Override protected void afterConfigure(ClusterActionEvent event) { ClusterSpec clusterSpec = event.getClusterSpec(); Cluster cluster = event.getCluster(); LOG.info("Completed configuration of {}", clusterSpec.getClusterName()); String hosts = Joiner.on(',').join(getHosts(cluster.getInstancesMatching( RolePredicates.role(ZooKeeperClusterActionHandler.ZOOKEEPER_ROLE)))); LOG.info("Hosts: {}", hosts); } private List<String> getPrivateIps(Set<Instance> instances) { return Lists.transform(Lists.newArrayList(instances), new Function<Instance, String>() { @Override public String apply(Instance instance) { return instance.getPrivateAddress().getHostAddress(); } }); } static List<String> getHosts(Set<Instance> instances) { return Lists.transform(Lists.newArrayList(instances), new Function<Instance, String>() { @Override public String apply(Instance instance) { String publicIp = instance.getPublicAddress().getHostName(); return String.format("%s:%d", publicIp, CLIENT_PORT); } }); } }
9238a8934d71a6c3b47ae7abe3acb8a3b7c0ceae
9,206
java
Java
src/web/com/joymain/jecs/bd/webapp/action/JbdMonthBonusSortReportController.java
lshowbiz/agnt_ht
fd549de35cb12a2e3db1cd9750caf9ce6e93e057
[ "Apache-2.0" ]
null
null
null
src/web/com/joymain/jecs/bd/webapp/action/JbdMonthBonusSortReportController.java
lshowbiz/agnt_ht
fd549de35cb12a2e3db1cd9750caf9ce6e93e057
[ "Apache-2.0" ]
null
null
null
src/web/com/joymain/jecs/bd/webapp/action/JbdMonthBonusSortReportController.java
lshowbiz/agnt_ht
fd549de35cb12a2e3db1cd9750caf9ce6e93e057
[ "Apache-2.0" ]
null
null
null
36.677291
185
0.739626
998,521
package com.joymain.jecs.bd.webapp.action; import java.io.OutputStream; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import jxl.Workbook; import jxl.write.WritableSheet; import jxl.write.WritableWorkbook; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.ResultSetExtractor; import org.springframework.jdbc.support.JdbcUtils; import org.springframework.validation.BindException; import org.springframework.web.servlet.ModelAndView; import com.joymain.jecs.al.model.AlCompany; import com.joymain.jecs.al.model.AlCountry; import com.joymain.jecs.al.model.AlStateProvince; import com.joymain.jecs.al.service.AlCompanyManager; import com.joymain.jecs.al.service.AlCountryManager; import com.joymain.jecs.bd.model.BdPeriod; import com.joymain.jecs.bd.model.JbdMemberLinkCalcHist; import com.joymain.jecs.bd.service.BdPeriodManager; import com.joymain.jecs.util.bean.WeekFormatUtil; import com.joymain.jecs.util.io.ExcelUtil; import com.joymain.jecs.util.string.StringUtil; import com.joymain.jecs.webapp.action.BaseFormController; import com.joymain.jecs.webapp.util.ListUtil; import com.joymain.jecs.webapp.util.LocaleUtil; import com.joymain.jecs.webapp.util.SessionLogin; /** * 奖金报表B * * */ public class JbdMonthBonusSortReportController extends BaseFormController { private transient final Log log = LogFactory.getLog(JbdMemberLinkCalcHist.class); private AlCompanyManager alCompanyManager = null; private BdPeriodManager bdPeriodManager=null; private AlCountryManager alCountryManager; public void setAlCountryManager(AlCountryManager alCountryManager) { this.alCountryManager = alCountryManager; } public void setBdPeriodManager(BdPeriodManager bdPeriodManager) { this.bdPeriodManager = bdPeriodManager; } private JdbcTemplate jdbcTemplate = null; private ExcelUtil eu = null; private WritableSheet wsheet = null; private Double franchisePvTotal = null; private Double franchiseMoneyTotal = null; private Double consumerAmountTotal = null; private Double ventureSalesPvTotal = null; private Double ventureLeaderPvTotal = null; private Double successSalesPvTotal = null; private Double successLeaderPvTotal = null; private Double deductMoneyTotal = null; private Double deductTaxTotal = null; private Double bounsPvTotal = null; private Double bounsMoneyTotal = null; private Double sendMoneyTotal = null; private Double recommendBonusPvTotal=null; private Double ventureFundPvTotal=null; private Double storeExpandPvTotal = null; private Double storeServePvTotal = null; private Double storeRecommendPvTotal =null; private Double amountDouble =null; private int progressCurrentCount; private String company=null; private HttpServletRequest innerRequest; private AlCountry alCountry = new AlCountry(); private Map memberTypeMap=null; private Map storeTypeMap=null; private Map identityTypeMap=null; private Map freezeStatusMap=null; private Map passStarMap=null; private Map cardTypeMap=null; public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } public void setAlCompanyManager(AlCompanyManager alCompanyManager) { this.alCompanyManager = alCompanyManager; } public JbdMonthBonusSortReportController() { setCommandName("bdPeriod"); setCommandClass(BdPeriod.class); } protected Object formBackingObject(HttpServletRequest request) throws Exception { List alCompanys = this.alCompanyManager.getAlCompanysExceptAA(); request.setAttribute("alCompanys", alCompanys); return new BdPeriod(); } public ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { if (log.isDebugEnabled()) { log.debug("entering 'onSubmit' method..."); } if ("post".equalsIgnoreCase(request.getMethod()) && "jbdMonthBonusSortReport".equalsIgnoreCase(request.getParameter("strAction"))) { this.innerRequest=request; String companyCode = SessionLogin.getLoginUser(request).getCompanyCode(); if (SessionLogin.getLoginUser(request).getIsManager()) { companyCode = request.getParameter("companyCode"); } company=companyCode; String formatedWeekStart = request.getParameter("formatedWeekStart"); String formatedWeekEnd = request.getParameter("formatedWeekEnd"); final String amount = request.getParameter("amount"); //生成excel文件 response.setContentType("application/vnd.ms-excel"); response.addHeader("Content-Disposition", "attachment; filename=PassStarReport_"+formatedWeekStart+"~"+formatedWeekEnd+".xls"); response.setHeader("Pragma", "public"); response.setHeader("Cache-Control", "max-age=30" ); OutputStream os = response.getOutputStream(); eu = new ExcelUtil(); WritableWorkbook wwb = Workbook.createWorkbook(os); //在此创建的新excel文件创建一工作表 wsheet = wwb.createSheet("Sheet1", 0); //加入期别时间段显示 formatedWeekStart=WeekFormatUtil.getFormatWeek("f",formatedWeekStart); formatedWeekEnd=WeekFormatUtil.getFormatWeek("f",formatedWeekEnd); BdPeriod bdPeriodStart=bdPeriodManager.getBdPeriodByFormatedWeek(formatedWeekStart); BdPeriod bdPeriodEnd=bdPeriodManager.getBdPeriodByFormatedWeek(formatedWeekEnd); eu.addString(wsheet, 0, 0, WeekFormatUtil.getFormatWeek("w",formatedWeekStart)+"~"+WeekFormatUtil.getFormatWeek("w",formatedWeekEnd)); //标题 int i=0; eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("miMember.memberNo")); eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("label.month")); eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("bdCalculatingSubDetail.name")); eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("busi.finance.amount")); eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("member.memberType")); eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("miMember.mobiletele")); eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("sysUser.address")); if("AA".equals(company)){ eu.addString(wsheet, i++, 1, LocaleUtil.getLocalText("busi.poMemberOrder.company")); } amountDouble=new Double(amount); memberTypeMap=ListUtil.getListOptions(companyCode, "membertype"); passStarMap=ListUtil.getListOptions(companyCode, "pass.star.zero"); String sql = "Select a.User_Code,a.month,a.Send_Money,b.Mi_User_Name, b.Mobiletele,b.Member_Type," + "c.state_province_name || d.city_name || w.district_name as address,b.Company_Code From (Select User_Code, w_Year || Lpad(w_Month, 2, 0) As Month, Sum(Send_Money) As Send_Money " + "From Jbd_Send_Record_Hist Where Send_Money > 0 "; if(!StringUtil.isEmpty(formatedWeekStart)){ sql+=" and w_week>= " +formatedWeekStart ; } if(!StringUtil.isEmpty(formatedWeekEnd)){ sql+=" and w_week<= " +formatedWeekEnd ; } sql+= " Group By User_Code, w_Year || Lpad(w_Month, 2, 0)) a,Jmi_Member b,jal_state_province c,jal_city d, jal_district w " + " Where a.User_Code = b.User_Code And b.province = c.state_province_id(+) And b.city = d.city_id(+) And b.district = w.district_id(+) " + " And a.Send_Money >= "+amountDouble; if(!"AA".equals(company)){ sql+=" and b.company_code='"+company+"'"; } sql += " Order By a.Send_Money Desc "; this.jdbcTemplate.query(sql, new ResultSetExtractor() { public Object extractData(ResultSet rs) throws SQLException { try { int kk = 2; while (rs.next()) { String user_code = rs.getString("user_code"); String name = rs.getString("Mi_User_Name"); String month = rs.getString("month"); Double send_money = rs.getDouble("Send_Money"); String Mobiletele = rs.getString("Mobiletele"); String address = rs.getString("address"); String member_type = rs.getString("member_type"); if(!StringUtil.isEmpty(member_type)){ member_type=member_type.trim(); } String company_code = rs.getString("company_code"); int index=0; eu.addString(wsheet, index++, kk, user_code); eu.addString(wsheet, index++, kk, WeekFormatUtil.getFormatMonth("w",month)); eu.addString(wsheet, index++, kk, name); eu.addNumber(wsheet, index++, kk, send_money); eu.addString(wsheet, index++, kk, memberTypeMap.get(member_type)==null?"":LocaleUtil.getLocalText(memberTypeMap.get(member_type).toString())); eu.addString(wsheet, index++, kk, Mobiletele); eu.addString(wsheet, index++, kk, address); if("AA".equals(company)){ eu.addString(wsheet, index++, kk, company_code); } kk++; } } catch (Exception e) { e.printStackTrace(); }finally { JdbcUtils.closeResultSet(rs); } return null; } }); eu.writeExcel(wwb); eu.closeWritableWorkbook(wwb); os.close(); return null; } return new ModelAndView(getSuccessView()); } }
9238a8969acb4ec13df1dcd52e51ce3c5e984c0d
2,899
java
Java
spring-boot-websocket-test/src/main/java/com/example/springbootwebsockettest/InterfaceHandler.java
guoshucan/mpaas
8949c0c484987d9c030595b24d62a10585a814ce
[ "Apache-2.0" ]
1
2020-09-29T10:24:03.000Z
2020-09-29T10:24:03.000Z
spring-boot-websocket-test/src/main/java/com/example/springbootwebsockettest/InterfaceHandler.java
guoshucan/mpaas
8949c0c484987d9c030595b24d62a10585a814ce
[ "Apache-2.0" ]
null
null
null
spring-boot-websocket-test/src/main/java/com/example/springbootwebsockettest/InterfaceHandler.java
guoshucan/mpaas
8949c0c484987d9c030595b24d62a10585a814ce
[ "Apache-2.0" ]
3
2020-11-05T15:52:17.000Z
2021-07-27T04:37:00.000Z
37.166667
104
0.618144
998,522
package com.example.springbootwebsockettest; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import java.io.FileOutputStream; import java.lang.reflect.Method; /** * package: com.example.springbootwebsockettest * * @Author: 郭树灿{gsc-e590} * @link: 手机:13715848993, QQ 27048384 * @Description: * @Date: 2020/5/16:11:25 */ public class InterfaceHandler extends ClassLoader implements Opcodes { public static Object MakeClass(Class<?> clazz) throws Exception { String name = clazz.getSimpleName(); String className = name + "$imp"; String Iter = clazz.getName().replaceAll("\\.", "/"); ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); cw.visit(V1_7, ACC_PUBLIC + ACC_SUPER, className, null, "java/lang/Object", new String[]{Iter}); // 空构造 MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null); mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitInsn(RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); // 实现接口中所有方法 Method[] methods = clazz.getMethods(); for (Method method : methods) { MakeMethod(cw, method.getName(), className); } cw.visitEnd(); //写入文件 byte[] code = cw.toByteArray(); FileOutputStream fos = new FileOutputStream("d:/com/" + className + ".class"); fos.write(code); fos.close(); //从文件加载类 InterfaceHandler loader = new InterfaceHandler(); Class<?> exampleClass = loader.defineClass(className, code, 0, code.length); Object obj = exampleClass.getConstructor().newInstance(); return obj; } private static void MakeMethod(ClassWriter cw, String MethodName, String className) { MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, MethodName, "()V", null, null); //mv.visitCode(); //Label l0 = new Label(); //mv.visitLabel(l0); //mv.visitLineNumber(8, l0); mv.visitFieldInsn(GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); mv.visitLdcInsn("调用方法 [" + MethodName + "]"); mv.visitMethodInsn(INVOKEVIRTUAL, "java/io/PrintStream", "println", "(Ljava/lang/String;)V"); //Label l1 = new Label(); //mv.visitLabel(l1); //mv.visitLineNumber(9, l1); mv.visitInsn(RETURN); //Label l2 = new Label(); //mv.visitLabel(l2); //mv.visitLocalVariable("this", "L" + className + ";", null, l0, l2, 0); mv.visitMaxs(2, 1); mv.visitEnd(); } public static void main(final String args[]) throws Exception { ISayHello iSayHello = (ISayHello) MakeClass(ISayHello.class); iSayHello.MethodA(); iSayHello.MethodB(); iSayHello.Abs(); } }
9238a97d880503257c02cb971c2e71dac8dab77e
13,048
java
Java
MFPAnLib/src/main/coresrc/com/cyzapps/Jfcalc/DataClassSingleNum.java
woshiwpa/MFPAndroLib
6bce0f519dcf5cdb8f65e6bf82377e11d3bc16ca
[ "Apache-2.0" ]
4
2021-12-26T02:37:11.000Z
2022-03-26T13:39:15.000Z
coresrc/com/cyzapps/Jfcalc/DataClassSingleNum.java
woshiwpa/MFPLang4JVM
8e6e2d9ccf5ace940879d3a3639ad1dc4fd47790
[ "Apache-2.0" ]
null
null
null
coresrc/com/cyzapps/Jfcalc/DataClassSingleNum.java
woshiwpa/MFPLang4JVM
8e6e2d9ccf5ace940879d3a3639ad1dc4fd47790
[ "Apache-2.0" ]
null
null
null
40.521739
137
0.629598
998,523
// MFP project, DataClassSingleNum.java : Designed and developed by Tony Cui in 2021 package com.cyzapps.Jfcalc; import com.cyzapps.Jfcalc.DCHelper.DATATYPES; import com.cyzapps.Jfcalc.ErrProcessor.ERRORTYPES; import com.cyzapps.Jfcalc.ErrProcessor.JFCALCExpErrException; import com.cyzapps.Jsma.AEConst; import com.cyzapps.Jsma.AEInvalid; import com.cyzapps.Jsma.AbstractExpr; /** * This class caters reference of boolean, integer and double, and of course null. * Note that the reference is immutable. * A design standard is, for extended class type, it is treated as double if DATATYPE * is unknown. * @author tony * */ public final class DataClassSingleNum extends DataClass { private static final long serialVersionUID = 1L; private DATATYPES menumDataType = DATATYPES.DATUM_NULL; private MFPNumeric mmfpNumDataValue = DCHelper.THE_NULL_DATA_VALUE; // this is for non-exist, double, integer and boolean, nan, inf @Override public String getTypeName() { if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return "null"; } else { return "numeric"; } } @Override public String getTypeFullName() { if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return "::mfp::lang::null"; } else { return "::mfp::lang::numeric"; // should not be here } } public DataClassSingleNum() { super(); } public DataClassSingleNum(DATATYPES enumDataType, MFPNumeric mfpNumDataValue) throws JFCALCExpErrException { super(); // initialize numerical data class if (!DCHelper.isDataClassType(enumDataType, /*DATATYPES.DATUM_NULL,*/ // DATUM_NULL shouldn't be initialized by this constructor. DATATYPES.DATUM_MFPBOOL, DATATYPES.DATUM_MFPINT, DATATYPES.DATUM_MFPDEC)) { throw new JFCALCExpErrException(ERRORTYPES.ERROR_WRONG_DATATYPE); } setDataValue(enumDataType, mfpNumDataValue); } /** * This function is only used in constructor. * @param enumDataType * @param mfpNumDataValue * @throws JFCALCExpErrException */ private void setDataValue(DATATYPES enumDataType, MFPNumeric mfpNumDataValue) throws JFCALCExpErrException { menumDataType = enumDataType; mmfpNumDataValue = (mfpNumDataValue == null)?MFPNumeric.ZERO:mfpNumDataValue; validateDataClass(); } public boolean isSingleBoolean() { try { if (!DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL) && (getDataValue().isEqual(MFPNumeric.ONE) || getDataValue().isEqual(MFPNumeric.ZERO))) { return true; } } catch (JFCALCExpErrException e) { e.printStackTrace(); } return false; } public boolean isSingleInteger() { try { if (!DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL) && getDataValue().isActuallyInteger()) { return true; } } catch (JFCALCExpErrException e) { e.printStackTrace(); } return false; } public boolean isSingleDouble() { if (!DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return true; } return false; } public boolean isNumericalData(boolean bLookOnNullAsZero) { if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return bLookOnNullAsZero; } else { return true; } } @Override public void validateDataClass_Step1() throws JFCALCExpErrException { super.validateDataClass_Step1(); switch(menumDataType) { case DATUM_NULL: mmfpNumDataValue = DCHelper.THE_NULL_DATA_VALUE; case DATUM_MFPBOOL: if (mmfpNumDataValue.isActuallyTrue()) { mmfpNumDataValue = MFPNumeric.TRUE; } else if (mmfpNumDataValue.isActuallyFalse()) { mmfpNumDataValue = MFPNumeric.FALSE; } else { throw new JFCALCExpErrException(ERRORTYPES.ERROR_CAN_NOT_CONVERT_NAN_VALUE_TO_BOOLEAN); } break; case DATUM_MFPINT: mmfpNumDataValue = mmfpNumDataValue.toIntOrNanInfMFPNum(); break; default: break; } } @Override public DATATYPES getDataClassType() { return menumDataType; } /** * This function will be overridden by sub class. * @return * @throws JFCALCExpErrException */ public MFPNumeric getDataValue() throws JFCALCExpErrException { switch(menumDataType) { case DATUM_NULL: throw new JFCALCExpErrException(ERRORTYPES.ERROR_INVALID_DATA_VALUE); default: return mmfpNumDataValue; // we have validated the class when initializing it, no need to do it again. } } /** * Note that this function always return a new reference. Note that if there is a copy, use light copy. */ @Override public DataClass convertData2NewType(DATATYPES enumNewDataType) throws JFCALCExpErrException { if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_BASE_OBJECT)) { return copySelf(); // if change to a base data type, we just return a light copy of itself. } else if (DCHelper.isDataClassType(this, enumNewDataType)) { // src data type is the same as dest return copySelf(); // if change to a base data type, we just return a light copy of itself. } else if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_NULL)) { // source data type must be different from null, so throw exception. throw new JFCALCExpErrException(ERRORTYPES.ERROR_CAN_NOT_CHANGE_ANY_OTHER_DATATYPE_TO_NONEXIST); } else if (!DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { // it is boolean, integer or double. if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_MFPBOOL)) { try { return new DataClassSingleNum(DATATYPES.DATUM_MFPBOOL, getDataValue().toBoolMFPNum()); } catch (ArithmeticException e) { throw new JFCALCExpErrException(ERRORTYPES.ERROR_CAN_NOT_CONVERT_NAN_VALUE_TO_BOOLEAN); } } else if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_MFPINT)) { return new DataClassSingleNum(DATATYPES.DATUM_MFPINT, getDataValue().toIntOrNanInfMFPNum()); } else if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_MFPDEC)) { return new DataClassSingleNum(DATATYPES.DATUM_MFPDEC, getDataValue().toDblOrNanInfMFPNum()); } else if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_COMPLEX)) { return new DataClassComplex(getDataValue().toDblOrNanInfMFPNum(), MFPNumeric.ZERO); } else if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_REF_DATA)) { // light copy itself to array's first element. return new DataClassArray(new DataClass[] {copySelf()}); } else if (DCHelper.isDataClassType(enumNewDataType, DATATYPES.DATUM_ABSTRACT_EXPR)) { // change to an aexpr. AbstractExpr aexpr = AEInvalid.AEINVALID; try { aexpr = new AEConst(copySelf()); //light copy or deep copy?, think about it. TODO } catch (Exception e) { // will not arrive here. throw new JFCALCExpErrException(ERRORTYPES.ERROR_CANNOT_CHANGE_DATATYPE); } return new DataClassAExpr(aexpr); } else { // cannot convert to string or func reference. if (DCHelper.isDataClassType(this, DATATYPES.DATUM_MFPBOOL)) { throw new JFCALCExpErrException(ERRORTYPES.ERROR_CANNOT_CHANGE_DATATYPE_FROM_BOOLEAN); } else if (DCHelper.isDataClassType(this, DATATYPES.DATUM_MFPINT)) { throw new JFCALCExpErrException(ERRORTYPES.ERROR_CANNOT_CHANGE_DATATYPE_FROM_INTEGER); } else if (DCHelper.isDataClassType(this, DATATYPES.DATUM_MFPDEC)) { throw new JFCALCExpErrException(ERRORTYPES.ERROR_CANNOT_CHANGE_DATATYPE_FROM_DOUBLE); } else { throw new JFCALCExpErrException(ERRORTYPES.ERROR_CANNOT_CHANGE_DATATYPE); // will not be here. } } } else { throw new JFCALCExpErrException(ERRORTYPES.ERROR_CAN_NOT_CHANGE_A_NULL_DATUM_TO_ANY_OTHER_DATATYPE); } } public boolean isEqual(DataClass datum, double errorScale) throws JFCALCExpErrException { if (errorScale < 0) { errorScale = 0; // ensure that error scale is always non-negative } if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { if (DCHelper.isDataClassType(datum, DATATYPES.DATUM_NULL)) { return true; } } else if (!DCHelper.isDataClassType(datum, DATATYPES.DATUM_NULL)) { // I am boolean, integer or double or an extended class type. datum's type should not be // limited to boolean, integer, double or complex either because it can also be a extended // class type. if (datum instanceof DataClassSingleNum && MFPNumeric.isEqual(getDataValue(), ((DataClassSingleNum)datum).getDataValue(), errorScale)) { return true; } else if (datum instanceof DataClassComplex && MFPNumeric.isEqual(((DataClassComplex)datum).getImage(), MFPNumeric.ZERO, errorScale) && MFPNumeric.isEqual(((DataClassComplex)datum).getReal(), getDataValue(), errorScale)) { return true; } } return false; } @Override public boolean isEqual(DataClass datum) throws JFCALCExpErrException { return isEqual(datum, 1); } /** * This function identify if a data value is zero (false is zero) * or a data array is full-of-zero array * @param bExplicitNullIsZero : look on null as zero * @return true or false * @throws JFCALCExpErrException */ public boolean isZeros(boolean bExplicitNullIsZero) throws JFCALCExpErrException { if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return bExplicitNullIsZero; } else { DataClassSingleNum datum = new DataClassSingleNum(DATATYPES.DATUM_MFPINT, MFPNumeric.ZERO); return isEqual(datum); } } /** * This function identify if a data value is I or 1 or [1]. * @param bExplicitNullIsZero : look on null as zero * @return true or false * @throws JFCALCExpErrException */ public boolean isEye(boolean bExplicitNullIsZero) throws JFCALCExpErrException { DataClassSingleNum datumOne = new DataClassSingleNum(DATATYPES.DATUM_MFPINT, MFPNumeric.ONE); return isEqual(datumOne); } /** * copy itself (light copy) and return a new reference. */ @Override public DataClass copySelf() throws JFCALCExpErrException { if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return new DataClassSingleNum(); } else { DataClassSingleNum datumReturn = new DataClassSingleNum(menumDataType, mmfpNumDataValue); return datumReturn; } } /** * copy itself (deep copy) and return a new reference. */ @Override public DataClass cloneSelf() throws JFCALCExpErrException { if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return new DataClassSingleNum(); } else { DataClassSingleNum datumReturn = new DataClassSingleNum(menumDataType, mmfpNumDataValue); return datumReturn; } } @Override public String toString() { String strReturn = ""; try { strReturn = output(); } catch (JFCALCExpErrException e) { strReturn = e.toString(); e.printStackTrace(); } return strReturn; } @Override public String output() throws JFCALCExpErrException { String strOutput = ""; if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { strOutput = "NULL"; } else { strOutput = getDataValue().toString(); } return strOutput; } @Override public int getHashCode() throws JFCALCExpErrException { if (DCHelper.isDataClassType(this, DATATYPES.DATUM_NULL)) { return 0; } return mmfpNumDataValue.hashCode(); } }
9238a9da1c4e7b3061c3ccce89ba090564558e6b
425
java
Java
aulas-exercicios/src/aula11/Aluno.java
gugamacedodev/orientacao-a-objetos
d6a094a04acec411c2a3644f6309d9d16ee4a4ed
[ "MIT" ]
null
null
null
aulas-exercicios/src/aula11/Aluno.java
gugamacedodev/orientacao-a-objetos
d6a094a04acec411c2a3644f6309d9d16ee4a4ed
[ "MIT" ]
null
null
null
aulas-exercicios/src/aula11/Aluno.java
gugamacedodev/orientacao-a-objetos
d6a094a04acec411c2a3644f6309d9d16ee4a4ed
[ "MIT" ]
null
null
null
18.478261
80
0.687059
998,524
package aula11; public class Aluno extends Pessoa { private int matr; private String curso; public int getMatr() { return matr; } public void setMatr(int matr) { this.matr = matr; } public String getCurso() { return curso; } public void setCurso(String curso) { this.curso = curso; } public void pagarMensalidade() { System.out.println(this.getNome() + this.getIdade() + " pagou a mensalidade"); } }
9238aaaebdf1c1a947d5773ce8e21f1861527586
1,059
java
Java
src/main/java/com/beust/jcommander/internal/Maps.java
jhulick/jcommander
8a3f5625ab132ff8f5d62650cc58455628e51038
[ "Apache-2.0" ]
1
2016-11-07T04:37:23.000Z
2016-11-07T04:37:23.000Z
src/main/java/com/beust/jcommander/internal/Maps.java
jhulick/jcommander
8a3f5625ab132ff8f5d62650cc58455628e51038
[ "Apache-2.0" ]
null
null
null
src/main/java/com/beust/jcommander/internal/Maps.java
jhulick/jcommander
8a3f5625ab132ff8f5d62650cc58455628e51038
[ "Apache-2.0" ]
null
null
null
29.416667
75
0.724268
998,525
/** * Copyright (C) 2010 the original author or authors. * See the notice.md file distributed with this work for additional * information regarding copyright ownership. * * 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.beust.jcommander.internal; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; public class Maps { public static <K, V> Map<K,V> newHashMap() { return new HashMap<K, V>(); } public static <K, V> Map<K,V> newLinkedHashMap() { return new LinkedHashMap<K, V>(); } }
9238aae2b26bb0076a4dc7c759451feb6bdbf067
247
java
Java
poker-server/src/main/java/es/msanchez/poker/server/config/Properties.java
ruanzhijun/online-poker-texas-hold-em
ada0080b38b07c8d02362f3cdf7d15d1047d0d23
[ "Apache-2.0" ]
1
2020-06-05T09:12:10.000Z
2020-06-05T09:12:10.000Z
poker-server/src/main/java/es/msanchez/poker/server/config/Properties.java
ruanzhijun/online-poker-texas-hold-em
ada0080b38b07c8d02362f3cdf7d15d1047d0d23
[ "Apache-2.0" ]
null
null
null
poker-server/src/main/java/es/msanchez/poker/server/config/Properties.java
ruanzhijun/online-poker-texas-hold-em
ada0080b38b07c8d02362f3cdf7d15d1047d0d23
[ "Apache-2.0" ]
1
2020-06-05T09:16:42.000Z
2020-06-05T09:16:42.000Z
14.529412
50
0.704453
998,526
package es.msanchez.poker.server.config; import lombok.Getter; /** * TODO: move to external configurable properties. * * @author msanchez * @since 21.03.2019 */ @Getter public class Properties { public static final int PORT = 8143; }
9238aae3a8454768ecb47267066ddc181225f1cc
13,946
java
Java
platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java
liveqmock/platform-tools-idea
1c4b76108add6110898a7e3f8f70b970e352d3d4
[ "Apache-2.0" ]
2
2015-05-08T15:07:10.000Z
2022-03-09T05:47:53.000Z
platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java
lshain-android-source/tools-idea
b37108d841684bcc2af45a2539b75dd62c4e283c
[ "Apache-2.0" ]
null
null
null
platform/lang-api/src/com/intellij/codeInsight/lookup/LookupElementBuilder.java
lshain-android-source/tools-idea
b37108d841684bcc2af45a2539b75dd62c4e283c
[ "Apache-2.0" ]
2
2017-04-24T15:48:40.000Z
2022-03-09T05:48:05.000Z
37.489247
139
0.732325
998,527
/* * Copyright 2000-2009 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 com.intellij.codeInsight.lookup; import com.intellij.codeInsight.completion.InsertHandler; import com.intellij.codeInsight.completion.InsertionContext; import com.intellij.psi.PsiNamedElement; import com.intellij.util.ObjectUtils; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.*; import java.util.Collections; import java.util.Set; /** * @author peter */ public final class LookupElementBuilder extends LookupElement { @NotNull private final String myLookupString; @NotNull private final Object myObject; private final boolean myCaseSensitive; @Nullable private final InsertHandler<LookupElement> myInsertHandler; @Nullable private final LookupElementRenderer<LookupElement> myRenderer; @Nullable private final LookupElementPresentation myHardcodedPresentation; @NotNull private final Set<String> myAllLookupStrings; private LookupElementBuilder(@NotNull String lookupString, @NotNull Object object, @Nullable InsertHandler<LookupElement> insertHandler, @Nullable LookupElementRenderer<LookupElement> renderer, @Nullable LookupElementPresentation hardcodedPresentation, @NotNull Set<String> allLookupStrings, boolean caseSensitive) { myLookupString = lookupString; myObject = object; myInsertHandler = insertHandler; myRenderer = renderer; myHardcodedPresentation = hardcodedPresentation; myAllLookupStrings = allLookupStrings; myCaseSensitive = caseSensitive; } private LookupElementBuilder(@NotNull String lookupString, @NotNull Object object) { this(lookupString, object, null, null, null, Collections.singleton(lookupString), true); } public static LookupElementBuilder create(@NotNull String lookupString) { return new LookupElementBuilder(lookupString, lookupString); } public static LookupElementBuilder create(@NotNull PsiNamedElement element) { return new LookupElementBuilder(ObjectUtils.assertNotNull(element.getName()), element); } public static LookupElementBuilder createWithIcon(@NotNull PsiNamedElement element) { return create(element).withIcon(element.getIcon(0)); } public static LookupElementBuilder create(@NotNull Object lookupObject, @NotNull String lookupString) { return new LookupElementBuilder(lookupString, lookupObject); } /** * @deprecated use {@link #withInsertHandler(com.intellij.codeInsight.completion.InsertHandler)} */ public LookupElementBuilder setInsertHandler(@Nullable InsertHandler<LookupElement> insertHandler) { return withInsertHandler(insertHandler); } public LookupElementBuilder withInsertHandler(@Nullable InsertHandler<LookupElement> insertHandler) { return new LookupElementBuilder(myLookupString, myObject, insertHandler, myRenderer, myHardcodedPresentation, myAllLookupStrings, myCaseSensitive); } /** * @deprecated use {@link #withRenderer(LookupElementRenderer)} */ public LookupElementBuilder setRenderer(@Nullable LookupElementRenderer<LookupElement> renderer) { return withRenderer(renderer); } public LookupElementBuilder withRenderer(@Nullable LookupElementRenderer<LookupElement> renderer) { return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, renderer, myHardcodedPresentation, myAllLookupStrings, myCaseSensitive); } @Override @NotNull public Set<String> getAllLookupStrings() { return myAllLookupStrings; } /** * @deprecated use {@link #withIcon(javax.swing.Icon)} */ public LookupElementBuilder setIcon(@Nullable Icon icon) { return withIcon(icon); } public LookupElementBuilder withIcon(@Nullable Icon icon) { final LookupElementPresentation presentation = copyPresentation(); presentation.setIcon(icon); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } @NotNull private LookupElementPresentation copyPresentation() { final LookupElementPresentation presentation = new LookupElementPresentation(); if (myHardcodedPresentation != null) { presentation.copyFrom(myHardcodedPresentation); } else { presentation.setItemText(myLookupString); } return presentation; } /** * @deprecated use {@link #withLookupString(String)} */ public LookupElementBuilder addLookupString(@NotNull String another) { return withLookupString(another); } public LookupElementBuilder withLookupString(@NotNull String another) { final THashSet<String> set = new THashSet<String>(myAllLookupStrings); set.add(another); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, myRenderer, myHardcodedPresentation, Collections.unmodifiableSet(set), myCaseSensitive); } @Override public boolean isCaseSensitive() { return myCaseSensitive; } /** * @deprecated use {@link #withCaseSensitivity(boolean)} */ public LookupElementBuilder setCaseSensitive(boolean caseSensitive) { return withCaseSensitivity(caseSensitive); } /** * @param caseSensitive if this lookup item should be completed in the same letter case as prefix * @return modified builder * @see com.intellij.codeInsight.completion.CompletionResultSet#caseInsensitive() */ public LookupElementBuilder withCaseSensitivity(boolean caseSensitive) { return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, myRenderer, myHardcodedPresentation, myAllLookupStrings, caseSensitive); } /** * @deprecated use {@link #withItemTextForeground(java.awt.Color)} */ public LookupElementBuilder setItemTextForeground(@NotNull Color itemTextForeground) { return withItemTextForeground(itemTextForeground); } public LookupElementBuilder withItemTextForeground(@NotNull Color itemTextForeground) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemTextForeground(itemTextForeground); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } /** * @deprecated use {@link #withItemTextUnderlined(boolean)} */ public LookupElementBuilder setItemTextUnderlined(boolean underlined) { return withItemTextUnderlined(underlined); } public LookupElementBuilder withItemTextUnderlined(boolean underlined) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemTextUnderlined(underlined); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } /** * @deprecated use {@link #withTypeText(String)} */ public LookupElementBuilder setTypeText(@Nullable String typeText) { return withTypeText(typeText); } public LookupElementBuilder withTypeText(@Nullable String typeText) { return withTypeText(typeText, false); } /** * @deprecated use {@link #withTypeText(String, boolean)} */ public LookupElementBuilder setTypeText(@Nullable String typeText, boolean grayed) { return withTypeText(typeText, grayed); } public LookupElementBuilder withTypeText(@Nullable String typeText, boolean grayed) { final LookupElementPresentation presentation = copyPresentation(); presentation.setTypeText(typeText); presentation.setTypeGrayed(grayed); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } /** * @deprecated use {@link #withPresentableText(String)} */ public LookupElementBuilder setPresentableText(@NotNull String presentableText) { return withPresentableText(presentableText); } public LookupElementBuilder withPresentableText(@NotNull String presentableText) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemText(presentableText); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } /** * @deprecated use {@link #bold()} */ public LookupElementBuilder setBold() { return bold(); } public LookupElementBuilder bold() { return withBoldness(true); } /** * @deprecated use {@link #withBoldness(boolean)} */ public LookupElementBuilder setBold(boolean bold) { return withBoldness(bold); } public LookupElementBuilder withBoldness(boolean bold) { final LookupElementPresentation presentation = copyPresentation(); presentation.setItemTextBold(bold); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } /** * @deprecated use {@link #strikeout()} */ public LookupElementBuilder setStrikeout() { return strikeout(); } public LookupElementBuilder strikeout() { return withStrikeoutness(true); } /** * @deprecated use {@link #withStrikeoutness(boolean)} */ public LookupElementBuilder setStrikeout(boolean strikeout) { return withStrikeoutness(strikeout); } public LookupElementBuilder withStrikeoutness(boolean strikeout) { final LookupElementPresentation presentation = copyPresentation(); presentation.setStrikeout(strikeout); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } /** * @deprecated use {@link #withTailText(String)} */ public LookupElementBuilder setTailText(@Nullable String tailText) { return withTailText(tailText); } public LookupElementBuilder withTailText(@Nullable String tailText) { return withTailText(tailText, false); } /** * @deprecated use {@link #withTailText(String, boolean)} */ public LookupElementBuilder setTailText(@Nullable String tailText, boolean grayed) { return withTailText(tailText, grayed); } public LookupElementBuilder withTailText(@Nullable String tailText, boolean grayed) { final LookupElementPresentation presentation = copyPresentation(); presentation.setTailText(tailText, grayed); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } public LookupElementBuilder appendTailText(@NotNull String tailText, boolean grayed) { final LookupElementPresentation presentation = copyPresentation(); presentation.appendTailText(tailText, grayed); return new LookupElementBuilder(myLookupString, myObject, myInsertHandler, null, presentation, myAllLookupStrings, myCaseSensitive); } public LookupElement withAutoCompletionPolicy(AutoCompletionPolicy policy) { return policy.applyPolicy(this); } @NotNull @Override public String getLookupString() { return myLookupString; } @NotNull @Override public Object getObject() { return myObject; } @Override public void handleInsert(InsertionContext context) { if (myInsertHandler != null) { myInsertHandler.handleInsert(context, this); } } @Override public void renderElement(LookupElementPresentation presentation) { if (myRenderer != null) { myRenderer.renderElement(this, presentation); } else if (myHardcodedPresentation != null) { presentation.copyFrom(myHardcodedPresentation); } else { presentation.setItemText(myLookupString); } } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; LookupElementBuilder that = (LookupElementBuilder)o; final InsertHandler<LookupElement> insertHandler = that.myInsertHandler; if (myInsertHandler != null && insertHandler != null ? !myInsertHandler.getClass().equals(insertHandler.getClass()) : myInsertHandler != insertHandler) return false; if (!myLookupString.equals(that.myLookupString)) return false; if (!myObject.equals(that.myObject)) return false; final LookupElementRenderer<LookupElement> renderer = that.myRenderer; if (myRenderer != null && renderer != null ? !myRenderer.getClass().equals(renderer.getClass()) : myRenderer != renderer) return false; return true; } @Override public String toString() { return "LookupElementBuilder: string=" + getLookupString() + "; handler=" + myInsertHandler; } @Override public int hashCode() { int result = 0; result = 31 * result + (myInsertHandler != null ? myInsertHandler.getClass().hashCode() : 0); result = 31 * result + (myLookupString.hashCode()); result = 31 * result + (myObject.hashCode()); result = 31 * result + (myRenderer != null ? myRenderer.getClass().hashCode() : 0); return result; } }
9238aae95f0dce3191ae9222febfd4fcba398ee2
2,552
java
Java
core/src/test/java/com/predic8/membrane/core/interceptor/DispatchingInterceptorTest.java
LarsP8/service-proxy
d893246177eec8c3133bcc5bbdcd173d118ecf9c
[ "Apache-2.0" ]
363
2015-01-08T20:23:26.000Z
2022-03-31T23:14:56.000Z
core/src/test/java/com/predic8/membrane/core/interceptor/DispatchingInterceptorTest.java
LarsP8/service-proxy
d893246177eec8c3133bcc5bbdcd173d118ecf9c
[ "Apache-2.0" ]
224
2015-01-24T09:17:51.000Z
2022-03-31T20:24:02.000Z
core/src/test/java/com/predic8/membrane/core/interceptor/DispatchingInterceptorTest.java
LarsP8/service-proxy
d893246177eec8c3133bcc5bbdcd173d118ecf9c
[ "Apache-2.0" ]
143
2015-01-23T10:59:28.000Z
2022-03-23T08:20:34.000Z
31.9
109
0.759796
998,528
/* Copyright 2009, 2012 predic8 GmbH, www.predic8.com 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.predic8.membrane.core.interceptor; import static org.junit.Assert.assertEquals; import java.net.URL; import org.junit.Before; import org.junit.Test; import com.predic8.membrane.core.exchange.Exchange; import com.predic8.membrane.core.rules.ServiceProxy; import com.predic8.membrane.core.rules.ServiceProxyKey; import com.predic8.membrane.core.rules.ProxyRule; import com.predic8.membrane.core.rules.ProxyRuleKey; import com.predic8.membrane.core.util.MessageUtil; public class DispatchingInterceptorTest { private DispatchingInterceptor dispatcher; private Exchange exc; @Before public void setUp() throws Exception { dispatcher = new DispatchingInterceptor(); exc = new Exchange(null); } @Test public void testServiceProxy() throws Exception { exc.setRequest(MessageUtil.getGetRequest("/axis2/services/BLZService?wsdl")); exc.setRule(getServiceProxy()); assertEquals(Outcome.CONTINUE, dispatcher.handleRequest(exc)); URL url = new URL(exc.getDestinations().get(0)); assertEquals(80, url.getPort()); assertEquals("thomas-bayer.com", url.getHost()); assertEquals("/axis2/services/BLZService?wsdl", url.getFile()); } @Test public void testProxyRuleHttp() throws Exception { exc.setRequest(MessageUtil.getGetRequest("http://www.thomas-bayer.com:80/axis2/services/BLZService?wsdl")); exc.setRule(getProxyrRule()); assertEquals(Outcome.CONTINUE, dispatcher.handleRequest(exc)); URL url = new URL(exc.getDestinations().get(0)); assertEquals(80, url.getPort()); assertEquals("www.thomas-bayer.com", url.getHost()); assertEquals("/axis2/services/BLZService?wsdl", url.getFile()); } @Test public void testProxyRuleHttps() throws Exception { } private ServiceProxy getServiceProxy() { return new ServiceProxy(new ServiceProxyKey("localhost", ".*", ".*", 3011), "thomas-bayer.com", 80); } private ProxyRule getProxyrRule() { return new ProxyRule(new ProxyRuleKey(3090)); } }
9238aaea627ef43b49c83d07b0047ef4259a44e2
1,689
java
Java
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/RepeatOnErrorUntilTrueParser.java
dracoon/citrus
24a8c379976903c902ee70924401cbc37ffa85ce
[ "Apache-2.0" ]
2
2019-11-11T01:00:45.000Z
2020-03-01T15:08:16.000Z
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/RepeatOnErrorUntilTrueParser.java
sgbeal/citrus
da4fcc5d8f4696c108142abeda29f00e8cf62f74
[ "Apache-2.0" ]
1
2016-06-30T07:34:52.000Z
2016-06-30T07:34:52.000Z
modules/citrus-core/src/main/java/com/consol/citrus/config/xml/RepeatOnErrorUntilTrueParser.java
sgbeal/citrus
da4fcc5d8f4696c108142abeda29f00e8cf62f74
[ "Apache-2.0" ]
1
2021-03-25T17:39:49.000Z
2021-03-25T17:39:49.000Z
37.533333
154
0.775607
998,529
/* * Copyright 2006-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.consol.citrus.config.xml; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.xml.ParserContext; import org.w3c.dom.Element; import com.consol.citrus.config.util.BeanDefinitionParserUtils; import com.consol.citrus.container.RepeatOnErrorUntilTrue; /** * Bean definition parser for repeat-on-error-until-true container in test case. * * @author Christoph Deppisch */ public class RepeatOnErrorUntilTrueParser extends AbstractIterationTestActionParser { /** * @see com.consol.citrus.config.xml.AbstractIterationTestActionParser#parse(org.w3c.dom.Element, org.springframework.beans.factory.xml.ParserContext) */ @Override public BeanDefinitionBuilder parseComponent(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(RepeatOnErrorUntilTrue.class); BeanDefinitionParserUtils.setPropertyValue(builder, element.getAttribute("auto-sleep"), "autoSleep"); return builder; } }
9238ad30c3a4d3614618a1b5eb7e8463338cdb8f
1,118
java
Java
app/src/main/java/com/scj/beilu/app/ui/home/adapter/seller/HomeFacilityAdapter.java
CharlesMing/beilu-android-open-project
20b148189d05639c85842fb78895bef64276a9b0
[ "Apache-2.0" ]
13
2019-11-22T02:14:45.000Z
2021-06-11T05:52:09.000Z
app/src/main/java/com/scj/beilu/app/ui/home/adapter/seller/HomeFacilityAdapter.java
CharlesMing/beilu-android-open-project
20b148189d05639c85842fb78895bef64276a9b0
[ "Apache-2.0" ]
null
null
null
app/src/main/java/com/scj/beilu/app/ui/home/adapter/seller/HomeFacilityAdapter.java
CharlesMing/beilu-android-open-project
20b148189d05639c85842fb78895bef64276a9b0
[ "Apache-2.0" ]
7
2019-12-17T10:53:55.000Z
2021-04-11T03:27:02.000Z
26.619048
112
0.733453
998,530
package com.scj.beilu.app.ui.home.adapter.seller; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.scj.beilu.app.R; import com.scj.beilu.app.base.BaseViewHolder; /** * author:SunGuiLan * date:2019/2/16 * descriptin: */ public class HomeFacilityAdapter extends RecyclerView.Adapter<HomeFacilityAdapter.HomeFacilityViewHolder> { @NonNull @Override public HomeFacilityViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_seller_facility, parent, false); return new HomeFacilityViewHolder(v); } @Override public void onBindViewHolder(@NonNull HomeFacilityViewHolder holder, int position) { } @Override public int getItemCount() { return 8; } public class HomeFacilityViewHolder extends BaseViewHolder { public HomeFacilityViewHolder(View itemView) { super(itemView); } } }
9238ae534d4715815ed2b8d86e2ec433c01989e5
3,925
java
Java
azure-mgmt-containerregistry/src/main/java/com/microsoft/azure/management/containerregistry/implementation/RegistryFileTaskRunRequestImpl.java
Flanker32/azure-libraries-for-java
dea658743df837f3f6f92bd79f5619ca41a4af80
[ "MIT" ]
100
2017-11-10T02:19:58.000Z
2022-03-27T10:24:07.000Z
azure-mgmt-containerregistry/src/main/java/com/microsoft/azure/management/containerregistry/implementation/RegistryFileTaskRunRequestImpl.java
Flanker32/azure-libraries-for-java
dea658743df837f3f6f92bd79f5619ca41a4af80
[ "MIT" ]
657
2017-10-24T16:39:52.000Z
2022-03-31T03:12:57.000Z
azure-mgmt-containerregistry/src/main/java/com/microsoft/azure/management/containerregistry/implementation/RegistryFileTaskRunRequestImpl.java
Flanker32/azure-libraries-for-java
dea658743df837f3f6f92bd79f5619ca41a4af80
[ "MIT" ]
122
2017-10-23T23:14:15.000Z
2021-12-22T08:27:13.000Z
31.910569
111
0.705223
998,531
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for * license information. */ package com.microsoft.azure.management.containerregistry.implementation; import com.microsoft.azure.management.apigeneration.LangDefinition; import com.microsoft.azure.management.containerregistry.FileTaskRunRequest; import com.microsoft.azure.management.containerregistry.OverridingValue; import com.microsoft.azure.management.containerregistry.PlatformProperties; import com.microsoft.azure.management.containerregistry.RegistryFileTaskRunRequest; import com.microsoft.azure.management.containerregistry.SetValue; import com.microsoft.azure.management.resources.fluentcore.model.HasInner; import com.microsoft.azure.management.resources.fluentcore.utils.Utils; import java.util.ArrayList; import java.util.List; import java.util.Map; @LangDefinition class RegistryFileTaskRunRequestImpl implements RegistryFileTaskRunRequest, RegistryFileTaskRunRequest.Definition, HasInner<FileTaskRunRequest> { private FileTaskRunRequest inner; private RegistryTaskRunImpl registryTaskRunImpl; @Override public int timeout() { return Utils.toPrimitiveInt(this.inner.timeout()); } @Override public PlatformProperties platform() { return this.inner.platform(); } @Override public int cpuCount() { if (this.inner.agentConfiguration() == null) { return 0; } return Utils.toPrimitiveInt(this.inner.agentConfiguration().cpu()); } @Override public String sourceLocation() { return this.inner.sourceLocation(); } @Override public boolean isArchiveEnabled() { return Utils.toPrimitiveBoolean(this.inner.isArchiveEnabled()); } RegistryFileTaskRunRequestImpl(RegistryTaskRunImpl registryTaskRunImpl) { this.inner = new FileTaskRunRequest(); this.registryTaskRunImpl = registryTaskRunImpl; } @Override public RegistryFileTaskRunRequestImpl defineFileTaskStep() { return this; } @Override public RegistryFileTaskRunRequestImpl withTaskPath(String taskPath) { this.inner.withTaskFilePath(taskPath); return this; } @Override public RegistryFileTaskRunRequestImpl withValuesPath(String valuesPath) { this.inner.withValuesFilePath(valuesPath); return this; } @Override public RegistryFileTaskRunRequestImpl withOverridingValues(Map<String, OverridingValue> overridingValues) { if (overridingValues.size() == 0) { return this; } List<SetValue> overridingValuesList = new ArrayList<SetValue>(); for (Map.Entry<String, OverridingValue> entry : overridingValues.entrySet()) { SetValue value = new SetValue(); value.withName(entry.getKey()); value.withValue(entry.getValue().value()); value.withIsSecret(entry.getValue().isSecret()); overridingValuesList.add(value); } this.inner.withValues(overridingValuesList); return this; } @Override public RegistryFileTaskRunRequestImpl withOverridingValue(String name, OverridingValue overridingValue) { if (this.inner.values() == null) { this.inner.withValues(new ArrayList<SetValue>()); } SetValue value = new SetValue(); value.withName(name); value.withValue(overridingValue.value()); value.withIsSecret(overridingValue.isSecret()); this.inner.values().add(value); return this; } @Override public RegistryTaskRunImpl attach() { this.registryTaskRunImpl.withFileTaskRunRequest(this.inner); return this.registryTaskRunImpl; } @Override public FileTaskRunRequest inner() { return this.inner; } }
9238ae536b68e0d8b92551270cc8f8ae36c49e2e
383
java
Java
core/src/main/java/org/infinispan/util/logging/LogSupplier.java
clara0/infinispan
f2cb717bbd51dd8e3e4265679585cd637a55bed5
[ "Apache-2.0" ]
713
2015-01-06T02:14:17.000Z
2022-03-29T10:22:07.000Z
core/src/main/java/org/infinispan/util/logging/LogSupplier.java
clara0/infinispan
f2cb717bbd51dd8e3e4265679585cd637a55bed5
[ "Apache-2.0" ]
5,732
2015-01-01T19:13:35.000Z
2022-03-31T16:31:11.000Z
core/src/main/java/org/infinispan/util/logging/LogSupplier.java
clara0/infinispan
f2cb717bbd51dd8e3e4265679585cd637a55bed5
[ "Apache-2.0" ]
402
2015-01-05T23:23:42.000Z
2022-03-25T08:14:32.000Z
18.238095
103
0.608355
998,532
package org.infinispan.util.logging; /** * Provides a {@link Log} instance to use. * * @author Pedro Ruivo * @since 12.0 */ public interface LogSupplier { /** * @return {@code true} if "TRACE" is enabled in this {@link Log} instance, {@code false} otherwise. */ boolean isTraceEnabled(); /** * @return The {@link Log} instance. */ Log getLog(); }
9238afd0816cc6ab702255d50615a6fb11a2bb26
26,688
java
Java
aliyun-java-sdk-ess/src/main/java/com/aliyuncs/ess/model/v20140828/CreateScalingConfigurationRequest.java
carldea/aliyun-openapi-java-sdk
2d7c54d31cfb41af85a3f110c85f1b28ea1edf47
[ "Apache-2.0" ]
1
2022-02-12T06:01:36.000Z
2022-02-12T06:01:36.000Z
aliyun-java-sdk-ess/src/main/java/com/aliyuncs/ess/model/v20140828/CreateScalingConfigurationRequest.java
carldea/aliyun-openapi-java-sdk
2d7c54d31cfb41af85a3f110c85f1b28ea1edf47
[ "Apache-2.0" ]
27
2021-06-11T21:08:40.000Z
2022-03-11T21:25:09.000Z
aliyun-java-sdk-ess/src/main/java/com/aliyuncs/ess/model/v20140828/CreateScalingConfigurationRequest.java
carldea/aliyun-openapi-java-sdk
2d7c54d31cfb41af85a3f110c85f1b28ea1edf47
[ "Apache-2.0" ]
1
2020-03-05T07:30:16.000Z
2020-03-05T07:30:16.000Z
26.190383
147
0.720511
998,533
/* * 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.aliyuncs.ess.model.v20140828; import com.aliyuncs.RpcAcsRequest; import java.util.List; import java.util.Map; import com.google.gson.Gson; import com.aliyuncs.http.MethodType; import com.aliyuncs.ess.Endpoint; /** * @author auto create * @version */ public class CreateScalingConfigurationRequest extends RpcAcsRequest<CreateScalingConfigurationResponse> { private String hpcClusterId; private String securityEnhancementStrategy; private String keyPairName; private List<SpotPriceLimit> spotPriceLimits; private String resourceGroupId; private String privatePoolOptionsMatchCriteria; private String hostName; private String password; private List<String> systemDiskCategorys; private String instanceDescription; private String systemDiskAutoSnapshotPolicyId; private String privatePoolOptionsId; private Integer ipv6AddressCount; private Integer cpu; private Long ownerId; private String scalingConfigurationName; private String tags; private String spotStrategy; private String instanceName; private String internetChargeType; private String zoneId; private Integer internetMaxBandwidthIn; private List<InstancePatternInfo> instancePatternInfos; private String affinity; private String imageId; private Integer memory; private String clientToken; private String spotInterruptionBehavior; private String scalingGroupId; private List<String> instanceTypes; private String ioOptimized; private String securityGroupId; private Integer internetMaxBandwidthOut; private String systemDiskCategory; private String systemDiskPerformanceLevel; private String userData; private Boolean passwordInherit; private String imageName; private String instanceType; private Map<Object,Object> schedulerOptions; private String deploymentSetId; private String resourceOwnerAccount; private String ownerAccount; private String tenancy; private String systemDiskDiskName; private String ramRoleName; private String dedicatedHostId; private String creditSpecification; private List<String> securityGroupIds; private Integer spotDuration; private List<DataDisk> dataDisks; private List<InstanceTypeOverride> instanceTypeOverrides; private Integer loadBalancerWeight; private Integer systemDiskSize; private String imageFamily; private String systemDiskDescription; public CreateScalingConfigurationRequest() { super("Ess", "2014-08-28", "CreateScalingConfiguration", "ess"); setMethod(MethodType.POST); try { com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointMap").set(this, Endpoint.endpointMap); com.aliyuncs.AcsRequest.class.getDeclaredField("productEndpointRegional").set(this, Endpoint.endpointRegionalType); } catch (Exception e) {} } public String getHpcClusterId() { return this.hpcClusterId; } public void setHpcClusterId(String hpcClusterId) { this.hpcClusterId = hpcClusterId; if(hpcClusterId != null){ putQueryParameter("HpcClusterId", hpcClusterId); } } public String getSecurityEnhancementStrategy() { return this.securityEnhancementStrategy; } public void setSecurityEnhancementStrategy(String securityEnhancementStrategy) { this.securityEnhancementStrategy = securityEnhancementStrategy; if(securityEnhancementStrategy != null){ putQueryParameter("SecurityEnhancementStrategy", securityEnhancementStrategy); } } public String getKeyPairName() { return this.keyPairName; } public void setKeyPairName(String keyPairName) { this.keyPairName = keyPairName; if(keyPairName != null){ putQueryParameter("KeyPairName", keyPairName); } } public List<SpotPriceLimit> getSpotPriceLimits() { return this.spotPriceLimits; } public void setSpotPriceLimits(List<SpotPriceLimit> spotPriceLimits) { this.spotPriceLimits = spotPriceLimits; if (spotPriceLimits != null) { for (int depth1 = 0; depth1 < spotPriceLimits.size(); depth1++) { putQueryParameter("SpotPriceLimit." + (depth1 + 1) + ".InstanceType" , spotPriceLimits.get(depth1).getInstanceType()); putQueryParameter("SpotPriceLimit." + (depth1 + 1) + ".PriceLimit" , spotPriceLimits.get(depth1).getPriceLimit()); } } } public String getResourceGroupId() { return this.resourceGroupId; } public void setResourceGroupId(String resourceGroupId) { this.resourceGroupId = resourceGroupId; if(resourceGroupId != null){ putQueryParameter("ResourceGroupId", resourceGroupId); } } public String getPrivatePoolOptionsMatchCriteria() { return this.privatePoolOptionsMatchCriteria; } public void setPrivatePoolOptionsMatchCriteria(String privatePoolOptionsMatchCriteria) { this.privatePoolOptionsMatchCriteria = privatePoolOptionsMatchCriteria; if(privatePoolOptionsMatchCriteria != null){ putQueryParameter("PrivatePoolOptions.MatchCriteria", privatePoolOptionsMatchCriteria); } } public String getHostName() { return this.hostName; } public void setHostName(String hostName) { this.hostName = hostName; if(hostName != null){ putQueryParameter("HostName", hostName); } } public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; if(password != null){ putQueryParameter("Password", password); } } public List<String> getSystemDiskCategorys() { return this.systemDiskCategorys; } public void setSystemDiskCategorys(List<String> systemDiskCategorys) { this.systemDiskCategorys = systemDiskCategorys; if (systemDiskCategorys != null) { for (int i = 0; i < systemDiskCategorys.size(); i++) { putQueryParameter("SystemDiskCategory." + (i + 1) , systemDiskCategorys.get(i)); } } } public String getInstanceDescription() { return this.instanceDescription; } public void setInstanceDescription(String instanceDescription) { this.instanceDescription = instanceDescription; if(instanceDescription != null){ putQueryParameter("InstanceDescription", instanceDescription); } } public String getSystemDiskAutoSnapshotPolicyId() { return this.systemDiskAutoSnapshotPolicyId; } public void setSystemDiskAutoSnapshotPolicyId(String systemDiskAutoSnapshotPolicyId) { this.systemDiskAutoSnapshotPolicyId = systemDiskAutoSnapshotPolicyId; if(systemDiskAutoSnapshotPolicyId != null){ putQueryParameter("SystemDisk.AutoSnapshotPolicyId", systemDiskAutoSnapshotPolicyId); } } public String getPrivatePoolOptionsId() { return this.privatePoolOptionsId; } public void setPrivatePoolOptionsId(String privatePoolOptionsId) { this.privatePoolOptionsId = privatePoolOptionsId; if(privatePoolOptionsId != null){ putQueryParameter("PrivatePoolOptions.Id", privatePoolOptionsId); } } public Integer getIpv6AddressCount() { return this.ipv6AddressCount; } public void setIpv6AddressCount(Integer ipv6AddressCount) { this.ipv6AddressCount = ipv6AddressCount; if(ipv6AddressCount != null){ putQueryParameter("Ipv6AddressCount", ipv6AddressCount.toString()); } } public Integer getCpu() { return this.cpu; } public void setCpu(Integer cpu) { this.cpu = cpu; if(cpu != null){ putQueryParameter("Cpu", cpu.toString()); } } public Long getOwnerId() { return this.ownerId; } public void setOwnerId(Long ownerId) { this.ownerId = ownerId; if(ownerId != null){ putQueryParameter("OwnerId", ownerId.toString()); } } public String getScalingConfigurationName() { return this.scalingConfigurationName; } public void setScalingConfigurationName(String scalingConfigurationName) { this.scalingConfigurationName = scalingConfigurationName; if(scalingConfigurationName != null){ putQueryParameter("ScalingConfigurationName", scalingConfigurationName); } } public String getTags() { return this.tags; } public void setTags(String tags) { this.tags = tags; if(tags != null){ putQueryParameter("Tags", tags); } } public String getSpotStrategy() { return this.spotStrategy; } public void setSpotStrategy(String spotStrategy) { this.spotStrategy = spotStrategy; if(spotStrategy != null){ putQueryParameter("SpotStrategy", spotStrategy); } } public String getInstanceName() { return this.instanceName; } public void setInstanceName(String instanceName) { this.instanceName = instanceName; if(instanceName != null){ putQueryParameter("InstanceName", instanceName); } } public String getInternetChargeType() { return this.internetChargeType; } public void setInternetChargeType(String internetChargeType) { this.internetChargeType = internetChargeType; if(internetChargeType != null){ putQueryParameter("InternetChargeType", internetChargeType); } } public String getZoneId() { return this.zoneId; } public void setZoneId(String zoneId) { this.zoneId = zoneId; if(zoneId != null){ putQueryParameter("ZoneId", zoneId); } } public Integer getInternetMaxBandwidthIn() { return this.internetMaxBandwidthIn; } public void setInternetMaxBandwidthIn(Integer internetMaxBandwidthIn) { this.internetMaxBandwidthIn = internetMaxBandwidthIn; if(internetMaxBandwidthIn != null){ putQueryParameter("InternetMaxBandwidthIn", internetMaxBandwidthIn.toString()); } } public List<InstancePatternInfo> getInstancePatternInfos() { return this.instancePatternInfos; } public void setInstancePatternInfos(List<InstancePatternInfo> instancePatternInfos) { this.instancePatternInfos = instancePatternInfos; if (instancePatternInfos != null) { for (int depth1 = 0; depth1 < instancePatternInfos.size(); depth1++) { putQueryParameter("InstancePatternInfo." + (depth1 + 1) + ".Cores" , instancePatternInfos.get(depth1).getCores()); putQueryParameter("InstancePatternInfo." + (depth1 + 1) + ".Memory" , instancePatternInfos.get(depth1).getMemory()); putQueryParameter("InstancePatternInfo." + (depth1 + 1) + ".InstanceFamilyLevel" , instancePatternInfos.get(depth1).getInstanceFamilyLevel()); putQueryParameter("InstancePatternInfo." + (depth1 + 1) + ".MaxPrice" , instancePatternInfos.get(depth1).getMaxPrice()); } } } public String getAffinity() { return this.affinity; } public void setAffinity(String affinity) { this.affinity = affinity; if(affinity != null){ putQueryParameter("Affinity", affinity); } } public String getImageId() { return this.imageId; } public void setImageId(String imageId) { this.imageId = imageId; if(imageId != null){ putQueryParameter("ImageId", imageId); } } public Integer getMemory() { return this.memory; } public void setMemory(Integer memory) { this.memory = memory; if(memory != null){ putQueryParameter("Memory", memory.toString()); } } public String getClientToken() { return this.clientToken; } public void setClientToken(String clientToken) { this.clientToken = clientToken; if(clientToken != null){ putQueryParameter("ClientToken", clientToken); } } public String getSpotInterruptionBehavior() { return this.spotInterruptionBehavior; } public void setSpotInterruptionBehavior(String spotInterruptionBehavior) { this.spotInterruptionBehavior = spotInterruptionBehavior; if(spotInterruptionBehavior != null){ putQueryParameter("SpotInterruptionBehavior", spotInterruptionBehavior); } } public String getScalingGroupId() { return this.scalingGroupId; } public void setScalingGroupId(String scalingGroupId) { this.scalingGroupId = scalingGroupId; if(scalingGroupId != null){ putQueryParameter("ScalingGroupId", scalingGroupId); } } public List<String> getInstanceTypes() { return this.instanceTypes; } public void setInstanceTypes(List<String> instanceTypes) { this.instanceTypes = instanceTypes; if (instanceTypes != null) { for (int i = 0; i < instanceTypes.size(); i++) { putQueryParameter("InstanceTypes." + (i + 1) , instanceTypes.get(i)); } } } public String getIoOptimized() { return this.ioOptimized; } public void setIoOptimized(String ioOptimized) { this.ioOptimized = ioOptimized; if(ioOptimized != null){ putQueryParameter("IoOptimized", ioOptimized); } } public String getSecurityGroupId() { return this.securityGroupId; } public void setSecurityGroupId(String securityGroupId) { this.securityGroupId = securityGroupId; if(securityGroupId != null){ putQueryParameter("SecurityGroupId", securityGroupId); } } public Integer getInternetMaxBandwidthOut() { return this.internetMaxBandwidthOut; } public void setInternetMaxBandwidthOut(Integer internetMaxBandwidthOut) { this.internetMaxBandwidthOut = internetMaxBandwidthOut; if(internetMaxBandwidthOut != null){ putQueryParameter("InternetMaxBandwidthOut", internetMaxBandwidthOut.toString()); } } public String getSystemDiskCategory() { return this.systemDiskCategory; } public void setSystemDiskCategory(String systemDiskCategory) { this.systemDiskCategory = systemDiskCategory; if(systemDiskCategory != null){ putQueryParameter("SystemDisk.Category", systemDiskCategory); } } public String getSystemDiskPerformanceLevel() { return this.systemDiskPerformanceLevel; } public void setSystemDiskPerformanceLevel(String systemDiskPerformanceLevel) { this.systemDiskPerformanceLevel = systemDiskPerformanceLevel; if(systemDiskPerformanceLevel != null){ putQueryParameter("SystemDisk.PerformanceLevel", systemDiskPerformanceLevel); } } public String getUserData() { return this.userData; } public void setUserData(String userData) { this.userData = userData; if(userData != null){ putQueryParameter("UserData", userData); } } public Boolean getPasswordInherit() { return this.passwordInherit; } public void setPasswordInherit(Boolean passwordInherit) { this.passwordInherit = passwordInherit; if(passwordInherit != null){ putQueryParameter("PasswordInherit", passwordInherit.toString()); } } public String getImageName() { return this.imageName; } public void setImageName(String imageName) { this.imageName = imageName; if(imageName != null){ putQueryParameter("ImageName", imageName); } } public String getInstanceType() { return this.instanceType; } public void setInstanceType(String instanceType) { this.instanceType = instanceType; if(instanceType != null){ putQueryParameter("InstanceType", instanceType); } } public Map<Object,Object> getSchedulerOptions() { return this.schedulerOptions; } public void setSchedulerOptions(Map<Object,Object> schedulerOptions) { this.schedulerOptions = schedulerOptions; if(schedulerOptions != null){ putQueryParameter("SchedulerOptions", new Gson().toJson(schedulerOptions)); } } public String getDeploymentSetId() { return this.deploymentSetId; } public void setDeploymentSetId(String deploymentSetId) { this.deploymentSetId = deploymentSetId; if(deploymentSetId != null){ putQueryParameter("DeploymentSetId", deploymentSetId); } } public String getResourceOwnerAccount() { return this.resourceOwnerAccount; } public void setResourceOwnerAccount(String resourceOwnerAccount) { this.resourceOwnerAccount = resourceOwnerAccount; if(resourceOwnerAccount != null){ putQueryParameter("ResourceOwnerAccount", resourceOwnerAccount); } } public String getOwnerAccount() { return this.ownerAccount; } public void setOwnerAccount(String ownerAccount) { this.ownerAccount = ownerAccount; if(ownerAccount != null){ putQueryParameter("OwnerAccount", ownerAccount); } } public String getTenancy() { return this.tenancy; } public void setTenancy(String tenancy) { this.tenancy = tenancy; if(tenancy != null){ putQueryParameter("Tenancy", tenancy); } } public String getSystemDiskDiskName() { return this.systemDiskDiskName; } public void setSystemDiskDiskName(String systemDiskDiskName) { this.systemDiskDiskName = systemDiskDiskName; if(systemDiskDiskName != null){ putQueryParameter("SystemDisk.DiskName", systemDiskDiskName); } } public String getRamRoleName() { return this.ramRoleName; } public void setRamRoleName(String ramRoleName) { this.ramRoleName = ramRoleName; if(ramRoleName != null){ putQueryParameter("RamRoleName", ramRoleName); } } public String getDedicatedHostId() { return this.dedicatedHostId; } public void setDedicatedHostId(String dedicatedHostId) { this.dedicatedHostId = dedicatedHostId; if(dedicatedHostId != null){ putQueryParameter("DedicatedHostId", dedicatedHostId); } } public String getCreditSpecification() { return this.creditSpecification; } public void setCreditSpecification(String creditSpecification) { this.creditSpecification = creditSpecification; if(creditSpecification != null){ putQueryParameter("CreditSpecification", creditSpecification); } } public List<String> getSecurityGroupIds() { return this.securityGroupIds; } public void setSecurityGroupIds(List<String> securityGroupIds) { this.securityGroupIds = securityGroupIds; if (securityGroupIds != null) { for (int i = 0; i < securityGroupIds.size(); i++) { putQueryParameter("SecurityGroupIds." + (i + 1) , securityGroupIds.get(i)); } } } public Integer getSpotDuration() { return this.spotDuration; } public void setSpotDuration(Integer spotDuration) { this.spotDuration = spotDuration; if(spotDuration != null){ putQueryParameter("SpotDuration", spotDuration.toString()); } } public List<DataDisk> getDataDisks() { return this.dataDisks; } public void setDataDisks(List<DataDisk> dataDisks) { this.dataDisks = dataDisks; if (dataDisks != null) { for (int depth1 = 0; depth1 < dataDisks.size(); depth1++) { putQueryParameter("DataDisk." + (depth1 + 1) + ".DiskName" , dataDisks.get(depth1).getDiskName()); if (dataDisks.get(depth1).getCategoryss() != null) { for (int i = 0; i < dataDisks.get(depth1).getCategoryss().size(); i++) { putQueryParameter("DataDisk." + (depth1 + 1) + ".Categorys." + (i + 1) , dataDisks.get(depth1).getCategoryss().get(i)); } } putQueryParameter("DataDisk." + (depth1 + 1) + ".SnapshotId" , dataDisks.get(depth1).getSnapshotId()); putQueryParameter("DataDisk." + (depth1 + 1) + ".Size" , dataDisks.get(depth1).getSize()); putQueryParameter("DataDisk." + (depth1 + 1) + ".Encrypted" , dataDisks.get(depth1).getEncrypted()); putQueryParameter("DataDisk." + (depth1 + 1) + ".PerformanceLevel" , dataDisks.get(depth1).getPerformanceLevel()); putQueryParameter("DataDisk." + (depth1 + 1) + ".AutoSnapshotPolicyId" , dataDisks.get(depth1).getAutoSnapshotPolicyId()); putQueryParameter("DataDisk." + (depth1 + 1) + ".Description" , dataDisks.get(depth1).getDescription()); putQueryParameter("DataDisk." + (depth1 + 1) + ".Category" , dataDisks.get(depth1).getCategory()); putQueryParameter("DataDisk." + (depth1 + 1) + ".KMSKeyId" , dataDisks.get(depth1).getKMSKeyId()); putQueryParameter("DataDisk." + (depth1 + 1) + ".Device" , dataDisks.get(depth1).getDevice()); putQueryParameter("DataDisk." + (depth1 + 1) + ".DeleteWithInstance" , dataDisks.get(depth1).getDeleteWithInstance()); } } } public List<InstanceTypeOverride> getInstanceTypeOverrides() { return this.instanceTypeOverrides; } public void setInstanceTypeOverrides(List<InstanceTypeOverride> instanceTypeOverrides) { this.instanceTypeOverrides = instanceTypeOverrides; if (instanceTypeOverrides != null) { for (int depth1 = 0; depth1 < instanceTypeOverrides.size(); depth1++) { putQueryParameter("InstanceTypeOverride." + (depth1 + 1) + ".WeightedCapacity" , instanceTypeOverrides.get(depth1).getWeightedCapacity()); putQueryParameter("InstanceTypeOverride." + (depth1 + 1) + ".InstanceType" , instanceTypeOverrides.get(depth1).getInstanceType()); } } } public Integer getLoadBalancerWeight() { return this.loadBalancerWeight; } public void setLoadBalancerWeight(Integer loadBalancerWeight) { this.loadBalancerWeight = loadBalancerWeight; if(loadBalancerWeight != null){ putQueryParameter("LoadBalancerWeight", loadBalancerWeight.toString()); } } public Integer getSystemDiskSize() { return this.systemDiskSize; } public void setSystemDiskSize(Integer systemDiskSize) { this.systemDiskSize = systemDiskSize; if(systemDiskSize != null){ putQueryParameter("SystemDisk.Size", systemDiskSize.toString()); } } public String getImageFamily() { return this.imageFamily; } public void setImageFamily(String imageFamily) { this.imageFamily = imageFamily; if(imageFamily != null){ putQueryParameter("ImageFamily", imageFamily); } } public String getSystemDiskDescription() { return this.systemDiskDescription; } public void setSystemDiskDescription(String systemDiskDescription) { this.systemDiskDescription = systemDiskDescription; if(systemDiskDescription != null){ putQueryParameter("SystemDisk.Description", systemDiskDescription); } } public static class SpotPriceLimit { private String instanceType; private Float priceLimit; public String getInstanceType() { return this.instanceType; } public void setInstanceType(String instanceType) { this.instanceType = instanceType; } public Float getPriceLimit() { return this.priceLimit; } public void setPriceLimit(Float priceLimit) { this.priceLimit = priceLimit; } } public static class InstancePatternInfo { private Integer cores; private Float memory; private String instanceFamilyLevel; private Float maxPrice; public Integer getCores() { return this.cores; } public void setCores(Integer cores) { this.cores = cores; } public Float getMemory() { return this.memory; } public void setMemory(Float memory) { this.memory = memory; } public String getInstanceFamilyLevel() { return this.instanceFamilyLevel; } public void setInstanceFamilyLevel(String instanceFamilyLevel) { this.instanceFamilyLevel = instanceFamilyLevel; } public Float getMaxPrice() { return this.maxPrice; } public void setMaxPrice(Float maxPrice) { this.maxPrice = maxPrice; } } public static class DataDisk { private String diskName; private List<String> categoryss; private String snapshotId; private Integer size; private String encrypted; private String performanceLevel; private String autoSnapshotPolicyId; private String description; private String category; private String kMSKeyId; private String device; private Boolean deleteWithInstance; public String getDiskName() { return this.diskName; } public void setDiskName(String diskName) { this.diskName = diskName; } public List<String> getCategoryss() { return this.categoryss; } public void setCategoryss(List<String> categoryss) { this.categoryss = categoryss; } public String getSnapshotId() { return this.snapshotId; } public void setSnapshotId(String snapshotId) { this.snapshotId = snapshotId; } public Integer getSize() { return this.size; } public void setSize(Integer size) { this.size = size; } public String getEncrypted() { return this.encrypted; } public void setEncrypted(String encrypted) { this.encrypted = encrypted; } public String getPerformanceLevel() { return this.performanceLevel; } public void setPerformanceLevel(String performanceLevel) { this.performanceLevel = performanceLevel; } public String getAutoSnapshotPolicyId() { return this.autoSnapshotPolicyId; } public void setAutoSnapshotPolicyId(String autoSnapshotPolicyId) { this.autoSnapshotPolicyId = autoSnapshotPolicyId; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public String getCategory() { return this.category; } public void setCategory(String category) { this.category = category; } public String getKMSKeyId() { return this.kMSKeyId; } public void setKMSKeyId(String kMSKeyId) { this.kMSKeyId = kMSKeyId; } public String getDevice() { return this.device; } public void setDevice(String device) { this.device = device; } public Boolean getDeleteWithInstance() { return this.deleteWithInstance; } public void setDeleteWithInstance(Boolean deleteWithInstance) { this.deleteWithInstance = deleteWithInstance; } } public static class InstanceTypeOverride { private Integer weightedCapacity; private String instanceType; public Integer getWeightedCapacity() { return this.weightedCapacity; } public void setWeightedCapacity(Integer weightedCapacity) { this.weightedCapacity = weightedCapacity; } public String getInstanceType() { return this.instanceType; } public void setInstanceType(String instanceType) { this.instanceType = instanceType; } } @Override public Class<CreateScalingConfigurationResponse> getResponseClass() { return CreateScalingConfigurationResponse.class; } }
9238afed40cb5d6a3d25d9dc286989326d8f6cfc
337
java
Java
src/main/java/dev/gigaherz/elementsofpower/essentializer/menu/IMagicAmountHolder.java
gigaherz/ElementsOfPower
4393ac1c77483ca26bbd07d64c27a273bdbcff11
[ "BSD-3-Clause" ]
13
2015-07-01T18:16:37.000Z
2021-01-02T02:31:11.000Z
src/main/java/dev/gigaherz/elementsofpower/essentializer/menu/IMagicAmountHolder.java
gigaherz/ElementsOfPower
4393ac1c77483ca26bbd07d64c27a273bdbcff11
[ "BSD-3-Clause" ]
29
2015-01-06T20:57:56.000Z
2021-04-07T11:04:00.000Z
src/main/java/dev/gigaherz/elementsofpower/essentializer/menu/IMagicAmountHolder.java
gigaherz/ElementsOfPower
4393ac1c77483ca26bbd07d64c27a273bdbcff11
[ "BSD-3-Clause" ]
10
2015-01-06T12:50:03.000Z
2021-01-01T20:40:25.000Z
25.923077
65
0.833828
998,534
package dev.gigaherz.elementsofpower.essentializer.menu; import dev.gigaherz.elementsofpower.magic.MagicAmounts; public interface IMagicAmountHolder extends IMagicAmountContainer { MagicAmounts getRemainingToConvert(); void setContainedMagic(MagicAmounts contained); void setRemainingToConvert(MagicAmounts remaining); }
9238b127ea9f7c7e18a928daab8d7a5385de4545
3,648
java
Java
kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-api/src/main/java/org/kie/workbench/common/stunner/bpmn/definition/property/event/signal/InterruptingSignalEventExecutionSet.java
mareknovotny/kie-wb-common
295b0027b2464c1399ef44ec879ac7dd2c9d7508
[ "Apache-2.0" ]
null
null
null
kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-api/src/main/java/org/kie/workbench/common/stunner/bpmn/definition/property/event/signal/InterruptingSignalEventExecutionSet.java
mareknovotny/kie-wb-common
295b0027b2464c1399ef44ec879ac7dd2c9d7508
[ "Apache-2.0" ]
null
null
null
kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-api/src/main/java/org/kie/workbench/common/stunner/bpmn/definition/property/event/signal/InterruptingSignalEventExecutionSet.java
mareknovotny/kie-wb-common
295b0027b2464c1399ef44ec879ac7dd2c9d7508
[ "Apache-2.0" ]
null
null
null
36.118812
109
0.731908
998,535
/* * Copyright 2017 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.kie.workbench.common.stunner.bpmn.definition.property.event.signal; import javax.validation.Valid; import org.jboss.errai.common.client.api.annotations.MapsTo; import org.jboss.errai.common.client.api.annotations.Portable; import org.jboss.errai.databinding.client.api.Bindable; import org.kie.workbench.common.forms.adf.definitions.annotations.FormDefinition; import org.kie.workbench.common.forms.adf.definitions.annotations.FormField; import org.kie.workbench.common.forms.adf.definitions.annotations.metaModel.FieldLabel; import org.kie.workbench.common.forms.fields.shared.fieldTypes.basic.checkBox.type.CheckBoxFieldType; import org.kie.workbench.common.stunner.bpmn.definition.BPMNPropertySet; import org.kie.workbench.common.stunner.bpmn.definition.property.event.IsInterrupting; import org.kie.workbench.common.stunner.core.definition.annotation.Name; import org.kie.workbench.common.stunner.core.definition.annotation.Property; import org.kie.workbench.common.stunner.core.definition.annotation.PropertySet; import org.kie.workbench.common.stunner.core.util.HashUtil; @Portable @Bindable @PropertySet @FormDefinition(startElement = "isInterrupting") public class InterruptingSignalEventExecutionSet implements BPMNPropertySet { @Name @FieldLabel public static final transient String propertySetName = "Implementation/Execution"; @Property @FormField(type = CheckBoxFieldType.class) @Valid private IsInterrupting isInterrupting; @Property @FormField(afterElement = "isInterrupting") @Valid private SignalRef signalRef; public InterruptingSignalEventExecutionSet() { this(new IsInterrupting(true), new SignalRef()); } public InterruptingSignalEventExecutionSet(final @MapsTo("isInterrupting") IsInterrupting isInterrupting, final @MapsTo("signalRef") SignalRef signalRef) { this.isInterrupting = isInterrupting; this.signalRef = signalRef; } public String getPropertySetName() { return propertySetName; } public IsInterrupting getIsInterrupting() { return isInterrupting; } public void setIsInterrupting(IsInterrupting isInterrupting) { this.isInterrupting = isInterrupting; } public SignalRef getSignalRef() { return signalRef; } public void setSignalRef(final SignalRef signalRef) { this.signalRef = signalRef; } @Override public int hashCode() { return HashUtil.combineHashCodes(isInterrupting.hashCode(), signalRef.hashCode()); } @Override public boolean equals(Object o) { if (o instanceof InterruptingSignalEventExecutionSet) { InterruptingSignalEventExecutionSet other = (InterruptingSignalEventExecutionSet) o; return isInterrupting.equals(other.isInterrupting) && signalRef.equals(other.signalRef); } return false; } }
9238b2b12fd37a52258499ee24c13dcf6ba69315
3,333
java
Java
664-GameCli/src/main/java/com/gamecli/util/GameUtil.java
heheiscool/23designpattern
1ae1e26fbae3b5e779461bbe5061a3345ded5cea
[ "Apache-2.0" ]
null
null
null
664-GameCli/src/main/java/com/gamecli/util/GameUtil.java
heheiscool/23designpattern
1ae1e26fbae3b5e779461bbe5061a3345ded5cea
[ "Apache-2.0" ]
null
null
null
664-GameCli/src/main/java/com/gamecli/util/GameUtil.java
heheiscool/23designpattern
1ae1e26fbae3b5e779461bbe5061a3345ded5cea
[ "Apache-2.0" ]
null
null
null
26.452381
98
0.516952
998,536
package main.java.com.gamecli.util; import main.java.com.gamecli.config.Constants; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URL; import java.util.Timer; import java.util.TimerTask; /** * @ProjectName: 23designpattern_java * @Package: game.tetris * @ClassName: GameUtil * @Author: chenyang * @Description: 游戏工具类 * @Date: 2021/7/15 11:15 下午 * @Version: 1.0 */ public class GameUtil { private GameUtil() { } /** * 获取图片资源 * @param path * @return */ public static Image getImages(String path){ BufferedImage bufferedImage = null; try { URL url = GameUtil.class.getClassLoader().getResource(path); bufferedImage = ImageIO.read(url); } catch (IOException e) { e.printStackTrace(); } return bufferedImage; } /** * 获取去掉元素背景的图 * @param path * @return */ public static Image getToTransparentImages(String path){ BufferedImage bufferedImage = null; try { URL url = GameUtil.class.getClassLoader().getResource(path); bufferedImage = ImageIO.read(url); } catch (IOException e) { e.printStackTrace(); } //获取源图像的宽高 int width = bufferedImage.getWidth(); int height = bufferedImage.getHeight(); System.out.println(width+" "+height); //实例化一个同样大小的图片,并将type设为 BufferedImage.TYPE_4BYTE_ABGR,支持alpha通道的rgb图像 BufferedImage resImage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR); double grayMean = 0; for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { int rgb = bufferedImage.getRGB(i,j); int r = (0xff&rgb); int g = (0xff&(rgb>>8)); int b = (0xff&(rgb>>16)); //这是灰度值的计算公式 grayMean += (r*0.299+g*0.587+b*0.114); } } //计算平均灰度 grayMean = grayMean/(width*height); for (int i = 0; i < width; i++) { for (int j = 0; j < height; j++) { int rgb = bufferedImage.getRGB(i,j); //一个int是32位,java中按abgr的顺序存储,即前8位是alpha,最后8位是r,所以可以通过下面的方式获取到rgb的值 int r = (0xff&rgb); int g = (0xff&(rgb>>8)); int b = (0xff&(rgb>>16)); double gray = (r*0.299+g*0.587+b*0.114); //如果灰度值大于之前求的平均灰度值,则将其alpha设为0,下面准确写应该是rgb = r + (g << 8) + (b << 16) + (0 << 24); if (gray>grayMean){ rgb = r + (g << 8) + (b << 16); } resImage.setRGB(i,j,rgb); } } return resImage; } /** * 开启一个 指定频率的定时器 * * @param period * @param t */ public static void task(long period,ITime t){ Timer timer = new Timer(); TimerTask timerTask = new TimerTask() { @Override public void run() { if(Constants.TIMER_STOP_ON_OFF){ timer.cancel(); return; } t.run(); } }; timer.schedule(timerTask,0,period); } }
9238b3158d71fb1b03fa612026152b6ff2dcaca5
7,103
java
Java
ActivityLauncher/src/main/java/com/knziha/polymer/webfeature/WebAnnotationPanel.java
simonbellu/PolymPic
6e809d98b9a571b1833e55dfa5e9e4c34d7a727b
[ "Apache-2.0" ]
23
2020-11-24T08:05:36.000Z
2022-03-25T07:46:40.000Z
ActivityLauncher/src/main/java/com/knziha/polymer/webfeature/WebAnnotationPanel.java
simonbellu/PolymPic
6e809d98b9a571b1833e55dfa5e9e4c34d7a727b
[ "Apache-2.0" ]
4
2020-12-04T09:24:46.000Z
2022-02-17T12:13:50.000Z
ActivityLauncher/src/main/java/com/knziha/polymer/webfeature/WebAnnotationPanel.java
simonbellu/PolymPic
6e809d98b9a571b1833e55dfa5e9e4c34d7a727b
[ "Apache-2.0" ]
8
2020-11-11T12:08:43.000Z
2022-03-11T13:37:36.000Z
34.149038
138
0.764747
998,537
package com.knziha.polymer.webfeature; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.knziha.polymer.BrowserActivity; import com.knziha.polymer.R; import com.knziha.polymer.Utils.CMN; import com.knziha.polymer.database.LexicalDBHelper; import com.knziha.polymer.databinding.HistoryItemBinding; import com.knziha.polymer.databinding.WebAnnotationTextBinding; import com.knziha.polymer.paging.CursorAdapter; import com.knziha.polymer.paging.CursorReader; import com.knziha.polymer.paging.PagingAdapterInterface; import com.knziha.polymer.paging.PagingCursorAdapter; import com.knziha.polymer.paging.PagingRecyclerView; import com.knziha.polymer.paging.SimpleClassConstructor; import com.knziha.polymer.webslideshow.ViewUtils; import com.knziha.polymer.widgets.Utils; import java.util.Date; import static com.knziha.polymer.widgets.Utils.EmptyCursor; public class WebAnnotationPanel extends BrowserAppPanel { static long last_visible_entry_time = 0; WebAnnotationTextBinding UIData; PagingAdapterInterface<WebAnnotationCursorReader> dataAdapter; ImageView pageAsyncLoader; PagingRecyclerView mAnnotsListView; Date date = new Date(); public static class WebAnnotationCursorReader implements CursorReader { long row_id; long sort_number; long tab_id; String title; String time_text; @Override public void ReadCursor(Cursor cursor, long rowID, long sortNum) { title = cursor.getString(2); tab_id = cursor.getLong(3); if (row_id!=-1) { row_id = rowID; sort_number = sortNum; } else { row_id = cursor.getLong(0); sort_number = cursor.getLong(1); } } @Override public String toString() { return "WebAnnotationCursorReader{" + "title='" + title + '\'' + '}'; } } public WebAnnotationPanel(BrowserActivity a) { super(a); } protected class AppDataTimeRenownedBaseAdapter extends RecyclerView.Adapter<ViewUtils.ViewDataHolder<HistoryItemBinding>> { final LayoutInflater inflater; AppDataTimeRenownedBaseAdapter(LayoutInflater inflater) { this.inflater = inflater; } @NonNull @Override public ViewUtils.ViewDataHolder<HistoryItemBinding> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { ViewUtils.ViewDataHolder<HistoryItemBinding> ret = new ViewUtils.ViewDataHolder<>(HistoryItemBinding.inflate(inflater, parent, false)); ret.data.title.setSingleLine(); ret.data.icon.setOnClickListener(WebAnnotationPanel.this); return ret; } @Override public void onBindViewHolder(@NonNull ViewUtils.ViewDataHolder<HistoryItemBinding> holder, int position) { WebAnnotationCursorReader reader = dataAdapter.getReaderAt(position); holder.tag = reader; HistoryItemBinding viewData = holder.data; viewData.title.setTextSize(16.5f); if (reader==null) { viewData.title.setText("加载中 ……"); viewData.icon.setVisibility(View.INVISIBLE); } else { viewData.title.setText(reader.title); if (reader.time_text == null) { date.setTime(reader.sort_number); reader.time_text = date.toLocaleString(); } viewData.subtitle.setText(reader.time_text); viewData.icon.setVisibility(reader.tab_id>0?View.VISIBLE:View.INVISIBLE); } } @Override public int getItemCount() { return dataAdapter.getCount(); } } @Override public void init(Context context, ViewGroup root) { dataAdapter = new CursorAdapter<>(EmptyCursor, new WebAnnotationCursorReader()); a=(BrowserActivity) context; showInPopWindow = true; showPopOnAppbar = true; UIData = WebAnnotationTextBinding.inflate(a.getLayoutInflater()); settingsLayout = (ViewGroup) UIData.getRoot(); pageAsyncLoader = new ImageView(a); //settingsLayout.setLayerType(View.LAYER_TYPE_HARDWARE, null); mBackgroundColor = Color.WHITE; PagingRecyclerView recyclerView = UIData.annotsRv; recyclerView.setNestedScrollingEnabled(false); recyclerView.setLayoutManager(new LinearLayoutManager(a.getLayoutInflater().getContext())); recyclerView.setItemAnimator(null); recyclerView.setRecycledViewPool(Utils.MaxRecyclerPool(35)); recyclerView.setHasFixedSize(true); AppDataTimeRenownedBaseAdapter ada = new AppDataTimeRenownedBaseAdapter(a.getLayoutInflater()); ada.setHasStableIds(false); recyclerView.setAdapter(ada); recyclerView.setRecycledViewPool(Utils.MaxRecyclerPool(35)); this.mAnnotsListView = recyclerView; SQLiteDatabase db = LexicalDBHelper.getInstancedDb(); if (db!=null) { boolean bSingleThreadLoading = false; if (bSingleThreadLoading) { Cursor cursor = db.rawQuery("SELECT id,creation_time,text,tab_id FROM annott ORDER BY creation_time desc", null); CMN.Log("查询个数::"+cursor.getCount()); dataAdapter = new CursorAdapter<>(cursor, new WebAnnotationCursorReader()); ada.notifyDataSetChanged(); } else { PagingCursorAdapter<WebAnnotationCursorReader> dataAdapter = new PagingCursorAdapter<>(db , new SimpleClassConstructor<>(WebAnnotationCursorReader.class) , WebAnnotationCursorReader[]::new); this.dataAdapter = dataAdapter; dataAdapter.bindTo(recyclerView) .setAsyncLoader(a, pageAsyncLoader) .sortBy(LexicalDBHelper.TABLE_ANNOTS_TEXT, LexicalDBHelper.FIELD_CREATE_TIME, true, "text,tab_id") .startPaging(last_visible_entry_time, 20, 15); } } } @Override public void onClick(View v) { if (v.getId()==R.id.root) { ViewUtils.ViewDataHolder<HistoryItemBinding> vh = (ViewUtils.ViewDataHolder<HistoryItemBinding>) Utils.getViewHolderInParents(v); WebAnnotationCursorReader reader = (WebAnnotationCursorReader) vh.tag; if (reader!=null) { a.NavigateToTab(reader.tab_id); //a.showT(reader.tab_id); } } } // @Override // public boolean toggle(ViewGroup root) { // boolean ret = super.toggle(root); //// if(!ret) { //// a.currentViewImpl.setVisibility(View.VISIBLE); //// } // return ret; // } @Override protected void onDismiss() { super.onDismiss(); View ca = mAnnotsListView.getChildAt(0); if (ca!=null) { ViewUtils.ViewDataHolder<HistoryItemBinding> holder = (ViewUtils.ViewDataHolder<HistoryItemBinding>) ca.getTag(); WebAnnotationCursorReader reader = (WebAnnotationCursorReader) holder.tag; last_visible_entry_time = reader.sort_number; // a.showT(new Date(last_visible_entry_time).toLocaleString()); } } @Override protected void decorateInterceptorListener(boolean install) { if (install) { a.UIData.browserWidget7.setImageResource(R.drawable.chevron_recess_ic_back); a.UIData.browserWidget8.setImageResource(R.drawable.ic_baseline_book_24); } else { a.UIData.browserWidget7.setImageResource(R.drawable.chevron_recess); a.UIData.browserWidget8.setImageResource(R.drawable.chevron_forward); } } }
9238b3d6a7ee343c7f323a280c4cd3a53edf3fc7
2,044
java
Java
generated-sources/java-vertx/mojang-sessions/src/main/java/com/github/asyncmc/mojang/sessions/java/vertx/model/PlayerTexture.java
AsyncMC/Mojang-API-Libs
b01bbd2bce44bfa2b9ed705a128cf4ecda077916
[ "Apache-2.0" ]
null
null
null
generated-sources/java-vertx/mojang-sessions/src/main/java/com/github/asyncmc/mojang/sessions/java/vertx/model/PlayerTexture.java
AsyncMC/Mojang-API-Libs
b01bbd2bce44bfa2b9ed705a128cf4ecda077916
[ "Apache-2.0" ]
null
null
null
generated-sources/java-vertx/mojang-sessions/src/main/java/com/github/asyncmc/mojang/sessions/java/vertx/model/PlayerTexture.java
AsyncMC/Mojang-API-Libs
b01bbd2bce44bfa2b9ed705a128cf4ecda077916
[ "Apache-2.0" ]
null
null
null
23.767442
76
0.662916
998,538
package com.github.asyncmc.mojang.sessions.java.vertx.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.github.asyncmc.mojang.sessions.java.vertx.model.PlayerSkinURL; import com.github.asyncmc.mojang.sessions.java.vertx.model.PlayerTextureURL; /** * Provide links to the player&#39;s skin and cape **/ @JsonInclude(JsonInclude.Include.NON_NULL) public class PlayerTexture { private PlayerSkinURL SKIN = null; private PlayerTextureURL CAPE = null; public PlayerTexture () { } public PlayerTexture (PlayerSkinURL SKIN, PlayerTextureURL CAPE) { this.SKIN = SKIN; this.CAPE = CAPE; } @JsonProperty("SKIN") public PlayerSkinURL getSKIN() { return SKIN; } public void setSKIN(PlayerSkinURL SKIN) { this.SKIN = SKIN; } @JsonProperty("CAPE") public PlayerTextureURL getCAPE() { return CAPE; } public void setCAPE(PlayerTextureURL CAPE) { this.CAPE = CAPE; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } PlayerTexture playerTexture = (PlayerTexture) o; return Objects.equals(SKIN, playerTexture.SKIN) && Objects.equals(CAPE, playerTexture.CAPE); } @Override public int hashCode() { return Objects.hash(SKIN, CAPE); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class PlayerTexture {\n"); sb.append(" SKIN: ").append(toIndentedString(SKIN)).append("\n"); sb.append(" CAPE: ").append(toIndentedString(CAPE)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
9238b4e8deedb18c699c643bdb7a0b0e1be4ea48
5,824
java
Java
jeecg-cloud-module/jeecg-cloud-system-running/src/main/java/org/jeecg/modules/task/vo/RunningCaseManageVO.java
zhanglailong/stcp
2209f2f7c81a01da948e5c6c050d215d656a77de
[ "MIT" ]
null
null
null
jeecg-cloud-module/jeecg-cloud-system-running/src/main/java/org/jeecg/modules/task/vo/RunningCaseManageVO.java
zhanglailong/stcp
2209f2f7c81a01da948e5c6c050d215d656a77de
[ "MIT" ]
null
null
null
jeecg-cloud-module/jeecg-cloud-system-running/src/main/java/org/jeecg/modules/task/vo/RunningCaseManageVO.java
zhanglailong/stcp
2209f2f7c81a01da948e5c6c050d215d656a77de
[ "MIT" ]
null
null
null
30.333333
103
0.662431
998,539
package org.jeecg.modules.task.vo; import java.io.Serializable; import java.util.List; import com.baomidou.mybatisplus.annotation.TableField; import org.jeecg.common.aspect.annotation.Dict; import org.jeecg.modules.task.entity.RunningCaseStep; import org.jeecgframework.poi.excel.annotation.Excel; import org.springframework.format.annotation.DateTimeFormat; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @Data /** * @Author: test * */ public class RunningCaseManageVO implements Serializable { private static final long serialVersionUID = 1L; /**主键*/ @TableId(type = IdType.ASSIGN_ID) @ApiModelProperty(value = "主键") private String id; /**任务id*/ @Excel(name = "任务id", width = 15) @ApiModelProperty(value = "任务id") private String testTaskId; /**任务名称*/ @Excel(name = "任务名称", width = 15) @ApiModelProperty(value = "任务名称") private String taskName; @Excel(name = "被测对象名称", width = 15) @TableField(exist = false) private String uutName; @Excel(name = "被测对象标识", width = 15) @TableField(exist = false) private String uutCode; @Excel(name = "被测对象类型", width = 15) @TableField(exist = false) private String uutType; @Excel(name = "被测对象版本", width = 15) @TableField(exist = false) private String uutVersion; /**所属项目名称*/ @Excel(name = "所属项目名称", width = 15) @ApiModelProperty(value = "所属项目名称") private String projectInfo; /**测试用例名称*/ @Excel(name = "测试用例名称", width = 15) @ApiModelProperty(value = "测试用例名称") private String testName; /**测试用例标识*/ @Excel(name = "测试用例标识", width = 15) @ApiModelProperty(value = "测试用例标识") private String testCode; /**追踪关系*/ @Excel(name = "追踪关系" , width = 20) @ApiModelProperty(value = "追踪关系") private String testRelationship; /**测试用例类型*/ @Excel(name = "测试用例类型", width = 15) @ApiModelProperty(value = "测试用例类型") private String testType; /**测试说明*/ @Excel(name = "测试说明", width = 15) @ApiModelProperty(value = "测试说明") private String testInstructions; /**测试用例初始化*/ @Excel(name = "测试用例初始化", width = 15) @ApiModelProperty(value = "测试用例初始化") private String testInit; /**前提与约束*/ @Excel(name = "前提与约束", width = 15) @ApiModelProperty(value = "前提与约束") private String testConstraint; /**终止过程*/ @Excel(name = "终止过程", width = 15) @ApiModelProperty(value = "终止过程") private String testProcess; /**测试步骤*/ @Excel(name = "序号" , width = 10) @ApiModelProperty(value = "序号") private String stepId; /**输入及操作说明*/ @Excel(name = "输入及操作说明", width = 40) @ApiModelProperty(value = "输入及操作说明") private String operatingInstructions; /**期望测试结果*/ @Excel(name = "期望测试结果", width = 40) @ApiModelProperty(value = "期望测试结果") private String expectResult; /**终止条件*/ @Excel(name = "测试用例终止条件", width = 15) @ApiModelProperty(value = "测试用例终止条件") private String testOver; /**测试用例通过准则*/ @Excel(name = "评估准则", width = 15) @ApiModelProperty(value = "评估准则") private String testCriterion; /**测试人员*/ @Excel(name = "测试人员", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "id") @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "id") @ApiModelProperty(value = "测试人员") private String testPerson; /**执行日期*/ @Excel(name = "执行日期", width = 15, format = "yyyy-MM-dd") @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "执行日期") private java.util.Date testDate; /**执行情况*/ @Excel(name = "执行情况", width = 15) @ApiModelProperty(value = "执行情况") private String testSituation; /**执行结果*/ @Excel(name = "执行结果", width = 15) @ApiModelProperty(value = "执行结果") private String testResult; /**测试监督人*/ @Excel(name = "测试监督人", width = 15, dictTable = "sys_user", dicText = "realname", dicCode = "username") @Dict(dictTable = "sys_user", dicText = "realname", dicCode = "username") @ApiModelProperty(value = "测试监督人") private String testSupervisor; /**被测软件版本*/ @Excel(name = "被测软件版本", width = 15) @ApiModelProperty(value = "被测软件版本") private String testVersion; /**问题标识*/ @Excel(name = "问题标识", width = 15) @ApiModelProperty(value = "问题标识") private String testQuestionCode; /**用例属性*/ @Excel(name = "用例属性", width = 15) @ApiModelProperty(value = "用例属性") private String testAttributes; /**实际测试结果*/ @Excel(name = "实际测试结果", width = 15) @ApiModelProperty(value = "实际测试结果") private String actualResult; /**用例属性*/ @Excel(name = "用例属性", width = 15) @ApiModelProperty(value = "用例属性") private String testSx; /**测试问题单*/ @Excel(name = "测试问题单", width = 15) @ApiModelProperty(value = "测试问题单") private String userOrder; /**测试结果 0为通过,1为不通过、2为无法测试*/ @Excel(name = "测试结果 0为通过,1为不通过、2为无法测试", width = 15) @ApiModelProperty(value = "测试结果 0为通过,1为不通过、2为无法测试") private String testRealResult; @ApiModelProperty(value = "删除标记") private Integer delFlag; /**创建人*/ @ApiModelProperty(value = "创建人") private String createBy; /**创建日期*/ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "创建日期") private java.util.Date createTime; /**更新人*/ @ApiModelProperty(value = "更新人") private String updateBy; /**更新日期*/ @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "更新日期") private java.util.Date updateTime; /**所属部门*/ @ApiModelProperty(value = "所属部门") private String sysOrgCode; @TableField(exist = false) private List<RunningCaseStep> stepList; }
9238b51d03e96596ec726ec9c9147fa3a1947097
1,087
java
Java
src/main/java/com/hermestechnologies/service/Supplier/SupplierDaoImp.java
Troll173/gamotko
08b839f41cda3613ab1ddc14ea79ea4a3f0762aa
[ "MIT" ]
null
null
null
src/main/java/com/hermestechnologies/service/Supplier/SupplierDaoImp.java
Troll173/gamotko
08b839f41cda3613ab1ddc14ea79ea4a3f0762aa
[ "MIT" ]
null
null
null
src/main/java/com/hermestechnologies/service/Supplier/SupplierDaoImp.java
Troll173/gamotko
08b839f41cda3613ab1ddc14ea79ea4a3f0762aa
[ "MIT" ]
null
null
null
29.378378
111
0.736891
998,540
package com.hermestechnologies.service.Supplier; import com.hermestechnologies.domain.Supplier; import org.hibernate.SessionFactory; import org.hibernate.query.Query; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import java.util.List; @Repository public class SupplierDaoImp implements SupplierDao{ @Autowired private SessionFactory sessionFactory; public Supplier getSupplier(Integer id) { @SuppressWarnings("unchecked") Query<Supplier> query = sessionFactory.getCurrentSession().createQuery("from Supplier WHERE id = :id"); query.setParameter("id", id); return query.getSingleResult(); } public List<Supplier> getSupplierList() { @SuppressWarnings("unchecked") Query<Supplier> query = sessionFactory.getCurrentSession().createQuery("from Supplier"); return query.getResultList(); } public Supplier saveSupplier(Supplier supplier) { sessionFactory.getCurrentSession().save(supplier); return supplier; } }
9238b531454da6a404ac41617d1c888dc8e70c13
4,185
java
Java
ScaleScanUtils/src/main/java/com/moyansz/common/IdCardUtil.java
ynztlxdeai/ScaleScanWeb
cc3a63d4110e8418b6b7c814fb2b080267afd5f3
[ "Apache-2.0" ]
1
2018-02-26T02:14:37.000Z
2018-02-26T02:14:37.000Z
ScaleScanUtils/src/main/java/com/moyansz/common/IdCardUtil.java
ynztlxdeai/ScaleScanWeb
cc3a63d4110e8418b6b7c814fb2b080267afd5f3
[ "Apache-2.0" ]
null
null
null
ScaleScanUtils/src/main/java/com/moyansz/common/IdCardUtil.java
ynztlxdeai/ScaleScanWeb
cc3a63d4110e8418b6b7c814fb2b080267afd5f3
[ "Apache-2.0" ]
null
null
null
25.833333
80
0.585902
998,541
/** * @projectName:hxbCommon * @packageName:com.hx.hxb.common.util * @className:IdCardUtil.java * * @createTime:2015年9月1日-下午10:26:56 * * */ package com.moyansz.common; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.Map; /** * 身份证验证的工具(支持15位或18位身份证) * 身份证号码结构: * 17位数字和1位校验码:6位地址码数字,8位生日数字,3位出生时间顺序号,1位校验码。 * 地址码(前6位):表示对象常住户口所在县(市、镇、区)的行政区划代码,按GB/T2260的规定执行。 * 出生日期码,(第七位 至十四位):表示编码对象出生年、月、日,按GB按GB/T7408的规定执行,年、月、日代码之间不用分隔符。 * 顺序码(第十五位至十七位):表示在同一地址码所标示的区域范围内,对同年、同月、同日出生的人编订的顺序号, * 顺序码的奇数分配给男性,偶数分配给女性。 * 校验码(第十八位数): * 十七位数字本体码加权求和公式 s = sum(Ai*Wi), i = 0,,16,先对前17位数字的权求和; * Ai:表示第i位置上的身份证号码数字值.Wi:表示第i位置上的加权因.Wi: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2; * 计算模 Y = mod(S, 11) * 通过模得到对应的校验码 Y: 0 1 2 3 4 5 6 7 8 9 10 校验码: 1 0 X 9 8 7 6 5 4 3 2 * @description: * @fileName:IdCardUtil.java * @createTime:2015年9月1日 下午10:31:41 * @author:net * @version 1.0.0 * */ public class IdCardUtil { final static Map<Integer, String> zoneNum = new HashMap<Integer, String>(); static { zoneNum.put(11, "北京"); zoneNum.put(12, "天津"); zoneNum.put(13, "河北"); zoneNum.put(14, "山西"); zoneNum.put(15, "内蒙古"); zoneNum.put(21, "辽宁"); zoneNum.put(22, "吉林"); zoneNum.put(23, "黑龙江"); zoneNum.put(31, "上海"); zoneNum.put(32, "江苏"); zoneNum.put(33, "浙江"); zoneNum.put(34, "安徽"); zoneNum.put(35, "福建"); zoneNum.put(36, "江西"); zoneNum.put(37, "山东"); zoneNum.put(41, "河南"); zoneNum.put(42, "湖北"); zoneNum.put(43, "湖南"); zoneNum.put(44, "广东"); zoneNum.put(45, "广西"); zoneNum.put(46, "海南"); zoneNum.put(50, "重庆"); zoneNum.put(51, "四川"); zoneNum.put(52, "贵州"); zoneNum.put(53, "云南"); zoneNum.put(54, "西藏"); zoneNum.put(61, "陕西"); zoneNum.put(62, "甘肃"); zoneNum.put(63, "青海"); zoneNum.put(64, "宁夏"); zoneNum.put(65, "新疆"); zoneNum.put(71, "台湾"); zoneNum.put(81, "香港"); zoneNum.put(82, "澳门"); zoneNum.put(91, "外国"); } final static int[] PARITYBIT = { '1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2' }; final static int[] POWER_LIST = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }; /** * 身份证验证 * * @param s 号码内容 * @return 是否有效 null和"" 都是false */ public static boolean isIDCard(String certNo) { if (certNo == null || (certNo.length() != 15 && certNo.length() != 18)) return false; final char[] cs = certNo.toUpperCase().toCharArray(); // 校验位数 int power = 0; for (int i = 0; i < cs.length; i++) { if (i == cs.length - 1 && cs[i] == 'X') break;// 最后一位可以 是X或x if (cs[i] < '0' || cs[i] > '9') return false; if (i < cs.length - 1) { power += (cs[i] - '0') * POWER_LIST[i]; } } // 校验区位码 if (!zoneNum.containsKey(Integer.valueOf(certNo.substring(0, 2)))) { return false; } // 校验年份 String year = certNo.length() == 15 ? getIdcardCalendar() + certNo.substring(6, 8) : certNo.substring(6, 10); final int iyear = Integer.parseInt(year); if (iyear < 1900 || iyear > Calendar.getInstance().get(Calendar.YEAR)) return false;// 1900年的PASS,超过今年的PASS // 校验月份 String month = certNo.length() == 15 ? certNo.substring(8, 10) : certNo .substring(10, 12); final int imonth = Integer.parseInt(month); if (imonth < 1 || imonth > 12) { return false; } // 校验天数 String day = certNo.length() == 15 ? certNo.substring(10, 12) : certNo .substring(12, 14); final int iday = Integer.parseInt(day); if (iday < 1 || iday > 31) return false; // 校验"校验码" if (certNo.length() == 15) return true; return cs[cs.length - 1] == PARITYBIT[power % 11]; } private static int getIdcardCalendar() { GregorianCalendar curDay = new GregorianCalendar(); int curYear = curDay.get(Calendar.YEAR); int year2bit = Integer.parseInt(String.valueOf(curYear).substring(2)); return year2bit; } public static void main(String[] args) { System.out.println(isIDCard("500234198509034457")); System.out.println(isIDCard("653130199203162527")); } }
9238b53f21815cf48cb71dedd7367b864736229b
12,701
java
Java
server/src/test/java/org/elasticsearch/transport/OutboundHandlerTests.java
Wiewiogr/crate
5651d8d4f6d149c496e329751af3e1fd28f8a5a8
[ "Apache-2.0" ]
3,066
2015-01-01T05:44:20.000Z
2022-03-31T19:33:32.000Z
server/src/test/java/org/elasticsearch/transport/OutboundHandlerTests.java
Wiewiogr/crate
5651d8d4f6d149c496e329751af3e1fd28f8a5a8
[ "Apache-2.0" ]
7,255
2015-01-02T08:25:25.000Z
2022-03-31T21:05:43.000Z
server/src/test/java/org/elasticsearch/transport/OutboundHandlerTests.java
Wiewiogr/crate
5651d8d4f6d149c496e329751af3e1fd28f8a5a8
[ "Apache-2.0" ]
563
2015-01-06T19:07:27.000Z
2022-03-25T03:03:36.000Z
43.20068
138
0.677821
998,542
/* * Licensed to Elasticsearch under one or more contributor * license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright * ownership. Elasticsearch 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.elasticsearch.transport; import io.crate.common.collections.Tuple; import io.crate.common.unit.TimeValue; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.Version; import org.elasticsearch.action.ActionListener; import org.elasticsearch.cluster.node.DiscoveryNode; import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.breaker.NoopCircuitBreaker; import org.elasticsearch.common.bytes.BytesArray; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.bytes.ReleasableBytesReference; import org.elasticsearch.common.io.Streams; import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.transport.TransportAddress; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.PageCacheRecycler; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.TestThreadPool; import org.elasticsearch.threadpool.ThreadPool; import org.junit.After; import org.junit.Before; import org.junit.Test; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.LongSupplier; import java.util.function.Predicate; import java.util.function.Supplier; import static org.hamcrest.CoreMatchers.instanceOf; public class OutboundHandlerTests extends ESTestCase { private final TestThreadPool threadPool = new TestThreadPool(getClass().getName()); private final TransportRequestOptions options = TransportRequestOptions.EMPTY; private final AtomicReference<Tuple<Header, BytesReference>> message = new AtomicReference<>(); private InboundPipeline pipeline; private OutboundHandler handler; private FakeTcpChannel channel; private DiscoveryNode node; @Before public void setUp() throws Exception { super.setUp(); channel = new FakeTcpChannel(randomBoolean(), buildNewFakeTransportAddress().address(), buildNewFakeTransportAddress().address()); TransportAddress transportAddress = buildNewFakeTransportAddress(); node = new DiscoveryNode("", transportAddress, Version.CURRENT); StatsTracker statsTracker = new StatsTracker(); handler = new OutboundHandler("node", Version.CURRENT, statsTracker, threadPool, BigArrays.NON_RECYCLING_INSTANCE); final LongSupplier millisSupplier = () -> TimeValue.nsecToMSec(System.nanoTime()); final InboundDecoder decoder = new InboundDecoder(Version.CURRENT, PageCacheRecycler.NON_RECYCLING_INSTANCE); final Supplier<CircuitBreaker> breaker = () -> new NoopCircuitBreaker("test"); final InboundAggregator aggregator = new InboundAggregator(breaker, (Predicate<String>) action -> true); pipeline = new InboundPipeline(statsTracker, millisSupplier, decoder, aggregator, (c, m) -> { try (BytesStreamOutput streamOutput = new BytesStreamOutput()) { Streams.copy(m.openOrGetStreamInput(), streamOutput); message.set(new Tuple<>(m.getHeader(), streamOutput.bytes())); } catch (IOException e) { throw new AssertionError(e); } }); } @After public void tearDown() throws Exception { ThreadPool.terminate(threadPool, 10, TimeUnit.SECONDS); super.tearDown(); } public void testSendRawBytes() { BytesArray bytesArray = new BytesArray("message".getBytes(StandardCharsets.UTF_8)); AtomicBoolean isSuccess = new AtomicBoolean(false); AtomicReference<Exception> exception = new AtomicReference<>(); ActionListener<Void> listener = ActionListener.wrap((v) -> isSuccess.set(true), exception::set); handler.sendBytes(channel, bytesArray, listener); BytesReference reference = channel.getMessageCaptor().get(); ActionListener<Void> sendListener = channel.getListenerCaptor().get(); if (randomBoolean()) { sendListener.onResponse(null); assertTrue(isSuccess.get()); assertNull(exception.get()); } else { IOException e = new IOException("failed"); sendListener.onFailure(e); assertFalse(isSuccess.get()); assertSame(e, exception.get()); } assertEquals(bytesArray, reference); } @Test public void testSendRequest() throws IOException { Version version = randomFrom(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion()); String action = "handshake"; long requestId = randomLongBetween(0, 300); boolean isHandshake = randomBoolean(); boolean compress = randomBoolean(); String value = "message"; TestRequest request = new TestRequest(value); AtomicReference<DiscoveryNode> nodeRef = new AtomicReference<>(); AtomicLong requestIdRef = new AtomicLong(); AtomicReference<String> actionRef = new AtomicReference<>(); AtomicReference<TransportRequest> requestRef = new AtomicReference<>(); handler.setMessageListener(new TransportMessageListener() { @Override public void onRequestSent(DiscoveryNode node, long requestId, String action, TransportRequest request, TransportRequestOptions options) { nodeRef.set(node); requestIdRef.set(requestId); actionRef.set(action); requestRef.set(request); } }); handler.sendRequest(node, channel, requestId, action, request, options, version, compress, isHandshake); BytesReference reference = channel.getMessageCaptor().get(); ActionListener<Void> sendListener = channel.getListenerCaptor().get(); if (randomBoolean()) { sendListener.onResponse(null); } else { sendListener.onFailure(new IOException("failed")); } assertEquals(node, nodeRef.get()); assertEquals(requestId, requestIdRef.get()); assertEquals(action, actionRef.get()); assertEquals(request, requestRef.get()); pipeline.handleBytes(channel, new ReleasableBytesReference(reference, () -> { })); final Tuple<Header, BytesReference> tuple = message.get(); final Header header = tuple.v1(); final TestRequest message = new TestRequest(tuple.v2().streamInput()); assertEquals(version, header.getVersion()); assertEquals(requestId, header.getRequestId()); assertTrue(header.isRequest()); assertFalse(header.isResponse()); if (isHandshake) { assertTrue(header.isHandshake()); } else { assertFalse(header.isHandshake()); } if (compress) { assertTrue(header.isCompressed()); } else { assertFalse(header.isCompressed()); } assertEquals(value, message.value); } @Test public void testSendResponse() throws IOException { Version version = randomFrom(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion()); String action = "handshake"; long requestId = randomLongBetween(0, 300); boolean isHandshake = randomBoolean(); boolean compress = randomBoolean(); String value = "message"; TestResponse response = new TestResponse(value); AtomicLong requestIdRef = new AtomicLong(); AtomicReference<String> actionRef = new AtomicReference<>(); AtomicReference<TransportResponse> responseRef = new AtomicReference<>(); handler.setMessageListener(new TransportMessageListener() { @Override public void onResponseSent(long requestId, String action, TransportResponse response) { requestIdRef.set(requestId); actionRef.set(action); responseRef.set(response); } }); handler.sendResponse(version, channel, requestId, action, response, compress, isHandshake); BytesReference reference = channel.getMessageCaptor().get(); ActionListener<Void> sendListener = channel.getListenerCaptor().get(); if (randomBoolean()) { sendListener.onResponse(null); } else { sendListener.onFailure(new IOException("failed")); } assertEquals(requestId, requestIdRef.get()); assertEquals(action, actionRef.get()); assertEquals(response, responseRef.get()); pipeline.handleBytes(channel, new ReleasableBytesReference(reference, () -> { })); final Tuple<Header, BytesReference> tuple = message.get(); final Header header = tuple.v1(); final TestResponse message = new TestResponse(tuple.v2().streamInput()); assertEquals(version, header.getVersion()); assertEquals(requestId, header.getRequestId()); assertFalse(header.isRequest()); assertTrue(header.isResponse()); if (isHandshake) { assertTrue(header.isHandshake()); } else { assertFalse(header.isHandshake()); } if (compress) { assertTrue(header.isCompressed()); } else { assertFalse(header.isCompressed()); } assertFalse(header.isError()); assertEquals(value, message.value); } @Test public void testErrorResponse() throws IOException { Version version = randomFrom(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion()); String action = "handshake"; long requestId = randomLongBetween(0, 300); ElasticsearchException error = new ElasticsearchException("boom"); AtomicLong requestIdRef = new AtomicLong(); AtomicReference<String> actionRef = new AtomicReference<>(); AtomicReference<Exception> responseRef = new AtomicReference<>(); handler.setMessageListener(new TransportMessageListener() { @Override public void onResponseSent(long requestId, String action, Exception error) { requestIdRef.set(requestId); actionRef.set(action); responseRef.set(error); } }); handler.sendErrorResponse(version, channel, requestId, action, error); BytesReference reference = channel.getMessageCaptor().get(); ActionListener<Void> sendListener = channel.getListenerCaptor().get(); if (randomBoolean()) { sendListener.onResponse(null); } else { sendListener.onFailure(new IOException("failed")); } assertEquals(requestId, requestIdRef.get()); assertEquals(action, actionRef.get()); assertEquals(error, responseRef.get()); pipeline.handleBytes(channel, new ReleasableBytesReference(reference, () -> { })); final Tuple<Header, BytesReference> tuple = message.get(); final Header header = tuple.v1(); assertEquals(version, header.getVersion()); assertEquals(requestId, header.getRequestId()); assertFalse(header.isRequest()); assertTrue(header.isResponse()); assertFalse(header.isCompressed()); assertFalse(header.isHandshake()); assertTrue(header.isError()); RemoteTransportException remoteException = tuple.v2().streamInput().readException(); assertThat(remoteException.getCause(), instanceOf(ElasticsearchException.class)); assertEquals(remoteException.getCause().getMessage(), "boom"); assertEquals(action, remoteException.action()); assertEquals(channel.getLocalAddress(), remoteException.address().address()); } }
9238b54b1e4cc1c64fff20270f67a1d573f6852e
96
java
Java
src/main/java/com/zendesk/maxwell/monitoring/package-info.java
isabella232/maxwell
c584bb2b6e8c2b3b0a1288ec1f44d8d1bf3b71e0
[ "Apache-2.0" ]
null
null
null
src/main/java/com/zendesk/maxwell/monitoring/package-info.java
isabella232/maxwell
c584bb2b6e8c2b3b0a1288ec1f44d8d1bf3b71e0
[ "Apache-2.0" ]
1
2022-02-23T11:00:25.000Z
2022-02-23T11:00:25.000Z
src/main/java/com/zendesk/maxwell/monitoring/package-info.java
isabella232/maxwell
c584bb2b6e8c2b3b0a1288ec1f44d8d1bf3b71e0
[ "Apache-2.0" ]
null
null
null
19.2
47
0.739583
998,543
/** * monitoring, diagnostics, and the HTTP server */ package com.zendesk.maxwell.monitoring;
9238b6b3e7711146aef3555f06a46c371433ecdd
744
java
Java
vertx-verticle/src/main/java/com/vertxinaction/chapter2/SomeVerticle.java
gingerkirsch/vertx-in-action
24d7c47ecc775b6171f344eedea090d5bc652722
[ "MIT" ]
null
null
null
vertx-verticle/src/main/java/com/vertxinaction/chapter2/SomeVerticle.java
gingerkirsch/vertx-in-action
24d7c47ecc775b6171f344eedea090d5bc652722
[ "MIT" ]
null
null
null
vertx-verticle/src/main/java/com/vertxinaction/chapter2/SomeVerticle.java
gingerkirsch/vertx-in-action
24d7c47ecc775b6171f344eedea090d5bc652722
[ "MIT" ]
null
null
null
27.555556
66
0.548387
998,544
package com.vertxinaction.chapter2; import io.vertx.core.AbstractVerticle; import io.vertx.core.Future; import io.vertx.core.Vertx; public class SomeVerticle extends AbstractVerticle { @Override public void start(Future<Void> startFuture) { vertx.createHttpServer() .requestHandler(req -> req.response().end("Ok\n")) .listen(8080, ar -> { if (ar.succeeded()) { startFuture.complete(); } else { startFuture.fail(ar.cause()); } }); } public static void main(String[] args) { Vertx vertx = Vertx.vertx(); vertx.deployVerticle(new SomeVerticle()); } }
9238b7fc693b63ec29455d17ccbd72902c2ef7ae
6,420
java
Java
resteasy-core/src/main/java/org/jboss/resteasy/plugins/providers/DocumentProvider.java
iweiss/Resteasy
254e74f84806534f8a2b57cc73693428a2a9fcca
[ "Apache-2.0" ]
841
2015-01-01T10:13:52.000Z
2021-09-17T03:41:49.000Z
resteasy-core/src/main/java/org/jboss/resteasy/plugins/providers/DocumentProvider.java
iweiss/Resteasy
254e74f84806534f8a2b57cc73693428a2a9fcca
[ "Apache-2.0" ]
974
2015-01-23T02:42:23.000Z
2021-09-17T03:35:22.000Z
resteasy-core/src/main/java/org/jboss/resteasy/plugins/providers/DocumentProvider.java
iweiss/Resteasy
254e74f84806534f8a2b57cc73693428a2a9fcca
[ "Apache-2.0" ]
747
2015-01-08T22:48:05.000Z
2021-09-02T15:56:08.000Z
38.909091
123
0.669159
998,545
package org.jboss.resteasy.plugins.providers; import org.jboss.resteasy.core.ResteasyContext; import org.jboss.resteasy.core.messagebody.AsyncBufferedMessageBodyWriter; import org.jboss.resteasy.plugins.server.servlet.ResteasyContextParameters; import org.jboss.resteasy.resteasy_jaxrs.i18n.LogMessages; import org.jboss.resteasy.spi.ReaderException; import org.jboss.resteasy.spi.ResteasyConfiguration; import org.jboss.resteasy.spi.WriterException; import org.w3c.dom.Document; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.Produces; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Context; import jakarta.ws.rs.core.MediaType; import jakarta.ws.rs.core.MultivaluedMap; import jakarta.ws.rs.ext.Provider; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; /** * Provider that reads and writes org.w3c.dom.Document. * * @author <a href="upchh@example.com">Solomon Duskis</a> * @version $Revision: $ */ @Provider @Produces({"text/xml", "text/*+xml", "application/xml", "application/*+xml"}) @Consumes({"text/xml", "text/*+xml", "application/xml", "application/*+xml"}) public class DocumentProvider extends AbstractEntityProvider<Document> implements AsyncBufferedMessageBodyWriter<Document> { private TransformerFactory transformerFactory; private DocumentBuilderFactory documentBuilder; private boolean expandEntityReferences = false; private boolean enableSecureProcessingFeature = true; private boolean disableDTDs = true; private volatile boolean init; public DocumentProvider() { // nullary constructor so that GraalVM's native-image is able to process this file this(ResteasyContext.getContextData(ResteasyConfiguration.class)); } private void lazyInit() { if (!init) { synchronized (this) { if (!init) { this.documentBuilder = DocumentBuilderFactory.newInstance(); this.transformerFactory = TransformerFactory.newInstance(); this.init = true; } } } } public DocumentProvider(final @Context ResteasyConfiguration config) { LogMessages.LOGGER.debugf("Provider : %s, Method : DocumentProvider", getClass().getName()); try { String s = config.getParameter(ResteasyContextParameters.RESTEASY_EXPAND_ENTITY_REFERENCES); expandEntityReferences = (s == null ? false : Boolean.parseBoolean(s)); } catch (Exception e) { LogMessages.LOGGER.unableToRetrieveConfigExpand(); } try { String s = config.getParameter(ResteasyContextParameters.RESTEASY_SECURE_PROCESSING_FEATURE); enableSecureProcessingFeature = (s == null ? true : Boolean.parseBoolean(s)); } catch (Exception e) { LogMessages.LOGGER.unableToRetrieveConfigSecure(); } try { String s = config.getParameter(ResteasyContextParameters.RESTEASY_DISABLE_DTDS); disableDTDs = (s == null ? true : Boolean.parseBoolean(s)); } catch (Exception e) { LogMessages.LOGGER.unableToRetrieveConfigDTDs(); } } public boolean isReadable(Class<?> clazz, Type type, Annotation[] annotation, MediaType mediaType) { return Document.class.isAssignableFrom(clazz); } public Document readFrom(Class<Document> clazz, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> headers, InputStream input) throws IOException, WebApplicationException { LogMessages.LOGGER.debugf("Provider : %s, Method : readFrom", getClass().getName()); lazyInit(); try { documentBuilder.setExpandEntityReferences(expandEntityReferences); documentBuilder.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, enableSecureProcessingFeature); documentBuilder.setFeature("http://apache.org/xml/features/disallow-doctype-decl", disableDTDs); documentBuilder.setFeature("http://xml.org/sax/features/external-general-entities", expandEntityReferences); documentBuilder.setFeature("http://xml.org/sax/features/external-parameter-entities", expandEntityReferences); if (expandEntityReferences) { try { // documentBuilder.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "all"); // backward compatibility for jdk 1.6 // we can't directly use XMLConstants.ACCESS_EXTERNAL_DTD here // because it doesn't exist in jdk 1.6 documentBuilder.setAttribute("http://javax.xml.XMLConstants/property/accessExternalDTD", "all"); } catch (IllegalArgumentException e) { //jaxp 1.5 feature not supported } } return documentBuilder.newDocumentBuilder().parse(input); } catch (Exception e) { throw new ReaderException(e); } } public boolean isWriteable(Class<?> clazz, Type type, Annotation[] annotation, MediaType mediaType) { return Document.class.isAssignableFrom(clazz); } public void writeTo(Document document, Class<?> clazz, Type type, Annotation[] annotation, MediaType mediaType, MultivaluedMap<String, Object> headers, OutputStream output) throws IOException, WebApplicationException { LogMessages.LOGGER.debugf("Provider : %s, Method : writeTo", getClass().getName()); lazyInit(); try { DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(output); transformerFactory.newTransformer().transform(source, result); } catch (TransformerException te) { throw new WriterException(te); } } }
9238b82eada7517ee6b57481f89dc1de87cbc1de
102
java
Java
src/main/java/com/octo/dao/package-info.java
SmartJog/octo-spy
205ddfe8bc021d97a40254aafbf357aad749edcc
[ "MIT" ]
null
null
null
src/main/java/com/octo/dao/package-info.java
SmartJog/octo-spy
205ddfe8bc021d97a40254aafbf357aad749edcc
[ "MIT" ]
null
null
null
src/main/java/com/octo/dao/package-info.java
SmartJog/octo-spy
205ddfe8bc021d97a40254aafbf357aad749edcc
[ "MIT" ]
1
2021-07-26T14:18:33.000Z
2021-07-26T14:18:33.000Z
12.75
45
0.656863
998,546
/** * Package that contains all database access. * * @author vmoittie * */ package com.octo.dao;
9238b98417222dcd8bc43cede9eda38bef20c60b
2,799
java
Java
enioka_scan/src/main/java/com/enioka/scanner/sdk/zebraoss/ssi/SsiParser.java
enioka/enioka_scan
d553429710a12af2905b3d78b814ffe83ed01792
[ "Apache-2.0" ]
1
2022-03-16T12:23:14.000Z
2022-03-16T12:23:14.000Z
enioka_scan/src/main/java/com/enioka/scanner/sdk/zebraoss/ssi/SsiParser.java
enioka/enioka_scan
d553429710a12af2905b3d78b814ffe83ed01792
[ "Apache-2.0" ]
7
2022-02-11T13:32:38.000Z
2022-03-30T13:03:13.000Z
enioka_scan/src/main/java/com/enioka/scanner/sdk/zebraoss/ssi/SsiParser.java
enioka/enioka_scan
d553429710a12af2905b3d78b814ffe83ed01792
[ "Apache-2.0" ]
2
2022-03-16T12:32:32.000Z
2022-03-16T14:11:45.000Z
39.422535
165
0.63094
998,547
package com.enioka.scanner.sdk.zebraoss.ssi; import android.util.Log; import com.enioka.scanner.bt.api.MessageRejectionReason; import com.enioka.scanner.bt.api.ParsingResult; import com.enioka.scanner.bt.api.ScannerDataParser; import com.enioka.scanner.sdk.zebraoss.commands.Ack; import com.enioka.scanner.sdk.zebraoss.commands.MultipacketAck; import com.enioka.scanner.sdk.zebraoss.commands.Nack; import java.util.Arrays; public class SsiParser implements ScannerDataParser { private static final String LOG_TAG = "SsiParser"; private SsiMultiPacket multiPacketBuffer = null; @Override public ParsingResult parse(byte[] buffer, int offset, int dataLength) { ParsingResult res = new ParsingResult(); res.read = dataLength; if (buffer[offset + 1] == SsiCommand.MULTIPACKET_SEGMENT.getOpCode()) { // Multipacket if (multiPacketBuffer == null) multiPacketBuffer = new SsiMultiPacket(); multiPacketBuffer.readPacket(buffer, offset, dataLength); if (!multiPacketBuffer.expectingMoreData()) { res.expectingMoreData = false; res.data = multiPacketBuffer.toBarcode(); multiPacketBuffer = null; res.acknowledger = new Ack(); } else { res.acknowledger = new MultipacketAck(); // FIXME: not quite understood how ACKs work yet or when to send these, scanner seems to work fine eiter way } return res; } // Monopacket SsiMonoPacketWrapper ssiPacket; try { ssiPacket = new SsiMonoPacketWrapper(buffer[offset], buffer[offset + 1], buffer[offset + 3], Arrays.copyOfRange(buffer, offset + 4, offset + dataLength - 2), buffer[offset + dataLength - 2], buffer[offset + dataLength - 1]); } catch (final IllegalStateException e) { Log.e(LOG_TAG, e.getMessage(), e); res.acknowledger = new Nack(MessageRejectionReason.CHECKSUM_FAILURE); return res; } SsiCommand meta = SsiCommand.getCommand(ssiPacket.getOpCode()); if (meta == SsiCommand.NONE) { Log.e(LOG_TAG, "Unsupported op code received: " + ssiPacket.getOpCode() + ". Message is ignored."); return new ParsingResult(MessageRejectionReason.INVALID_OPERATION); } if (meta.needsAck()) res.acknowledger = new Ack(); if (meta.getSource() == SsiSource.HOST) throw new IllegalStateException("Should not receive host-sent messages"); res.data = meta.getParser().parseData(ssiPacket.getData()); res.expectingMoreData = false; return res; } }
9238bab6db764f9deb32575dc903ec41e56cabbe
6,137
java
Java
backend/de.metas.acct.base/src/main/java-legacy/org/compiere/acct/Doc_Payment.java
dram/metasfresh
a1b881a5b7df8b108d4c4ac03082b72c323873eb
[ "RSA-MD" ]
1,144
2016-02-14T10:29:35.000Z
2022-03-30T09:50:41.000Z
backend/de.metas.acct.base/src/main/java-legacy/org/compiere/acct/Doc_Payment.java
dram/metasfresh
a1b881a5b7df8b108d4c4ac03082b72c323873eb
[ "RSA-MD" ]
8,283
2016-04-28T17:41:34.000Z
2022-03-30T13:30:12.000Z
backend/de.metas.acct.base/src/main/java-legacy/org/compiere/acct/Doc_Payment.java
dram/metasfresh
a1b881a5b7df8b108d4c4ac03082b72c323873eb
[ "RSA-MD" ]
441
2016-04-29T08:06:07.000Z
2022-03-28T06:09:56.000Z
25.570833
85
0.699853
998,548
package org.compiere.acct; import com.google.common.collect.ImmutableList; import de.metas.acct.api.AcctSchema; import de.metas.acct.api.PostingType; import de.metas.acct.doc.AcctDocContext; import de.metas.banking.BankAccount; import de.metas.banking.BankAccountId; import de.metas.currency.CurrencyConversionContext; import de.metas.organization.OrgId; import de.metas.payment.TenderType; import de.metas.payment.api.IPaymentBL; import de.metas.util.Services; import org.adempiere.service.ISysConfigBL; import org.compiere.model.I_C_Payment; import org.compiere.model.MAccount; import org.compiere.model.MCharge; import javax.annotation.Nullable; import java.math.BigDecimal; import java.util.List; /** * Post Payment Documents. * * <pre> * Table: C_Payment (335) * Document Types ARP, APP * </pre> * * @author Jorg Janke * @version $Id: Doc_Payment.java,v 1.3 2006/07/30 00:53:33 jjanke Exp $ */ public class Doc_Payment extends Doc<DocLine<Doc_Payment>> { // services private final transient ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class); private final IPaymentBL paymentBL = Services.get(IPaymentBL.class); private TenderType _tenderType; private boolean m_Prepayment = false; @Nullable private CurrencyConversionContext _currencyConversionContext; // lazy public Doc_Payment(final AcctDocContext ctx) { super(ctx); } @Override protected void loadDocumentDetails() { final I_C_Payment payment = getModel(I_C_Payment.class); setDateDoc(payment.getDateTrx()); setBPBankAccountId(BankAccountId.ofRepoIdOrNull(payment.getC_BP_BankAccount_ID())); _tenderType = TenderType.ofCode(payment.getTenderType()); m_Prepayment = payment.isPrepayment(); // Amount setAmount(Doc.AMTTYPE_Gross, payment.getPayAmt()); } @Override public CurrencyConversionContext getCurrencyConversionContext() { if(_currencyConversionContext == null) { final I_C_Payment payment = getModel(I_C_Payment.class); _currencyConversionContext = paymentBL.extractCurrencyConversionContext(payment); } return _currencyConversionContext; } /** * @return Zero (always balanced) */ @Override public BigDecimal getBalance() { return BigDecimal.ZERO; } // getBalance /** * Create Facts (the accounting logic) for * ARP, APP. * * <pre> * ARP * BankInTransit DR * UnallocatedCash CR * or Charge/C_Prepayment * APP * PaymentSelect DR * or Charge/V_Prepayment * BankInTransit CR * CashBankTransfer * - * </pre> * * @param as accounting schema * @return Fact */ @Override public List<Fact> createFacts(final AcctSchema as) { // create Fact Header final Fact fact = new Fact(this, as, PostingType.Actual); final OrgId AD_Org_ID = getBankOrgId(); // Bank Account Org // Cash Transfer if (getTenderType().isCash() && !isCashAsPayment()) { return ImmutableList.of(fact); } final String documentType = getDocumentType(); if (DOCTYPE_ARReceipt.equals(documentType)) { // Asset (DR) final FactLine fl_DR = fact.createLine() .setAccount(getBankAccount(as)) .setAmtSource(getCurrencyId(), getAmount(), null) .setCurrencyConversionCtx(getCurrencyConversionContext()) .buildAndAdd(); if (fl_DR != null && AD_Org_ID.isRegular()) { fl_DR.setAD_Org_ID(AD_Org_ID); } // Prepayment/UnallocatedCash (CR) final MAccount acct; if (getC_Charge_ID() > 0) { acct = MCharge.getAccount(getC_Charge_ID(), as.getId(), getAmount()); } else if (isPrepayment()) { acct = getAccount(AccountType.C_Prepayment, as); } else { acct = getAccount(AccountType.UnallocatedCash, as); } final FactLine fl_CR = fact.createLine() .setAccount(acct) .setAmtSource(getCurrencyId(), null, getAmount()) .setCurrencyConversionCtx(getCurrencyConversionContext()) .buildAndAdd(); if (fl_CR != null && AD_Org_ID.isRegular() && getC_Charge_ID() <= 0) { fl_CR.setAD_Org_ID(AD_Org_ID); } } // APP else if (DOCTYPE_APPayment.equals(documentType)) { // Prepayment/PaymentSelect (DR) final MAccount acct; if (getC_Charge_ID() > 0) { acct = MCharge.getAccount(getC_Charge_ID(), as.getId(), getAmount()); } else if (isPrepayment()) { acct = getAccount(AccountType.V_Prepayment, as); } else { acct = getAccount(AccountType.PaymentSelect, as); } final FactLine fl_DR = fact.createLine() .setAccount(acct) .setAmtSource(getCurrencyId(), getAmount(), null) .setCurrencyConversionCtx(getCurrencyConversionContext()) .buildAndAdd(); if (fl_DR != null && AD_Org_ID.isRegular() && getC_Charge_ID() <= 0) { fl_DR.setAD_Org_ID(AD_Org_ID); } // Asset (CR) final FactLine fl_CR = fact.createLine() .setAccount(getBankAccount(as)) .setAmtSource(getCurrencyId(), null, getAmount()) .setCurrencyConversionCtx(getCurrencyConversionContext()) .buildAndAdd(); if (fl_CR != null && AD_Org_ID.isRegular()) { fl_CR.setAD_Org_ID(AD_Org_ID); } } else { throw newPostingException() .setAcctSchema(as) .setFact(fact) .setPostingStatus(PostingStatus.Error) .setDetailMessage("DocumentType unknown: " + documentType); } return ImmutableList.of(fact); } /** * @return bank account's Org or {@link OrgId#ANY} */ private OrgId getBankOrgId() { final BankAccount bankAccount = getBankAccount(); return bankAccount != null ? bankAccount.getOrgId() : OrgId.ANY; } private boolean isCashAsPayment() { final boolean defaultValue = true; return sysConfigBL.getBooleanValue("CASH_AS_PAYMENT", defaultValue); } private TenderType getTenderType() { return _tenderType; } private boolean isPrepayment() { return m_Prepayment; } /** * Gets the Bank Account to be used. * * @param as accounting schema * @return bank in transit account ({@link AccountType#BankInTransit}) */ private MAccount getBankAccount(final AcctSchema as) { return getAccount(AccountType.BankInTransit, as); } } // Doc_Payment
9238bb00633ad1f89ea79f42c60e3eebc17616f6
5,918
java
Java
control-sdk/src/main/java/tv/accedo/one/sdk/implementation/utils/Response.java
Accedo-Products/accedo-one-sdk-android
731040950087569a70fb3478abd7b457452935fc
[ "Apache-2.0" ]
5
2018-05-30T06:57:02.000Z
2020-07-30T00:04:23.000Z
control-sdk/src/main/java/tv/accedo/one/sdk/implementation/utils/Response.java
Accedo-Products/accedo-control-sdk-android
731040950087569a70fb3478abd7b457452935fc
[ "Apache-2.0" ]
1
2020-04-30T08:38:00.000Z
2020-04-30T08:38:00.000Z
control-sdk/src/main/java/tv/accedo/one/sdk/implementation/utils/Response.java
Accedo-Products/accedo-control-sdk-android
731040950087569a70fb3478abd7b457452935fc
[ "Apache-2.0" ]
3
2017-12-21T14:24:39.000Z
2020-03-20T04:58:59.000Z
30.071066
150
0.624916
998,549
/* * Copyright (c) 2016 - present Accedo Broadband AB. All Rights Reserved * Unauthorized copying of this file, via any medium is strictly prohibited * Proprietary and confidential */ package tv.accedo.one.sdk.implementation.utils; import android.util.Log; import java.io.InputStream; import java.net.HttpURLConnection; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.TimeZone; /** * @author Pásztor Tibor Viktor <envkt@example.com> */ public class Response { public static final DateFormat DATE_HEADER_FORMAT = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz", Locale.US); static { DATE_HEADER_FORMAT.setTimeZone(TimeZone.getTimeZone("GMT")); } private int code = -1; private byte[] response; private HttpURLConnection httpUrlConnection; private String charset; private String url; private Map<String, List<String>> headers = new HashMap<>(); private Exception caughtException; /** * @return the response code, or -1 if no connection was made */ public int getCode() { return code; } /** * @return the response body, string encoded with the charset of the RestClient instance, that created this Response */ public String getText() { byte[] output = response; try { return new String(output, charset); } catch (Exception e) { return null; } } /** * @return the raw response body */ public byte[] getRawResponse() { return response; } /** * @return true, if the response code is 200 or 204 */ public boolean isSuccess() { return code == 200 || code == 204; } /** * @return the url fetched */ public String getUrl() { return url; } /** * @return a map of response headers, or an empty map if no connection was established (never null) */ public Map<String, List<String>> getHeaders() { return headers; } /** * @param name the name of the header to find * @return the first value for that header or an empty string */ public String getFirstHeader(String name) { List<String> values = headers.get(name); if (values != null && !values.isEmpty()) { return values.get(0); } return ""; } /** * @return the parsed UTC server time from the "Date" header. If there's no Date header, or its malformed, System.currentTimeMillis() is returned. */ public long getServerTime() { try { String dateHeader = getFirstHeader("Date"); return DATE_HEADER_FORMAT.parse(dateHeader).getTime(); } catch (ParseException e) { Utils.log(Log.WARN, "Failed to parse server time from Date header, returning device time."); Utils.log(e); return System.currentTimeMillis(); } } /** * @return the HttpURLConnection behind the RestClient instance, that created this Response */ public HttpURLConnection getUrlConnection() { return httpUrlConnection; } /** * @return The exception caught during the creation of the urlConnection used, or during connection, or during the parsing of the response. */ public Exception getCaughtException() { return caughtException; } /** * The constructor to use when the connection was successful. * * @param httpUrlConnection the underlying httpUrlConnection used. * @param url the url we were connecting to. * @param charset the charset used, the default being {@link Request.charset}. * @param logLevel the logLevel used by this restClient instance, the default being {@link LogLevel.NORMAL} */ public Response(HttpURLConnection httpUrlConnection, String url, String charset) { this.httpUrlConnection = httpUrlConnection; this.url = url; this.charset = charset; //Code & Body InputStream inputStream = null; try { code = httpUrlConnection.getResponseCode(); inputStream = code < 400? httpUrlConnection.getInputStream() : httpUrlConnection.getErrorStream(); response = Utils.toByteArray(inputStream); } catch (Exception e) { this.caughtException = e; } finally { Utils.closeQuietly(inputStream); } //Headers if (httpUrlConnection != null && httpUrlConnection.getHeaderFields() != null) { headers.putAll(httpUrlConnection.getHeaderFields()); } //Logging Utils.log(Log.DEBUG, "Response " + code + " for: " + getUrl() + "\n" + getText()); } /** * The constructor to use when connection has failed. * * @param url the url we wanted to connect to. * @param reason the reason why we couldn't connect. */ public Response(String url, Exception reason) { this.url = url; this.caughtException = reason; } /** * Domain-parses this response with the supplied parser, or throws an exception on failure * * @param parser * @return The domain parsed variant of this Response's body * @throws Exceptions, thrown by the parser. */ public <T, E extends Exception> T getParsedText(ThrowingParser<Response, T, E> parser) throws E { return parser.parse(this); } public interface ThrowingParser<I, O, E extends Exception> { /** * Parses <I>, into <O>, or throws an <E> exception if any error occures * * @param <I> The input type * @param <O> The output type * @throws <E> The error type */ O parse(I input) throws E; } }
9238bb15929ca6ddfd1d28d4ec331ec6ead05919
1,199
java
Java
lite/src/main/java/net/luminis/tls/alert/BadCertificateAlert.java
IshJ/Thor--Side-Channel-Integration
fbc892835557f42486fe2b817d57af530925a949
[ "Apache-2.0" ]
null
null
null
lite/src/main/java/net/luminis/tls/alert/BadCertificateAlert.java
IshJ/Thor--Side-Channel-Integration
fbc892835557f42486fe2b817d57af530925a949
[ "Apache-2.0" ]
null
null
null
lite/src/main/java/net/luminis/tls/alert/BadCertificateAlert.java
IshJ/Thor--Side-Channel-Integration
fbc892835557f42486fe2b817d57af530925a949
[ "Apache-2.0" ]
null
null
null
38.677419
106
0.75146
998,550
/* * Copyright © 2019, 2020, 2021 Peter Doornbosch * * This file is part of Agent15, an implementation of TLS 1.3 in Java. * * Agent15 is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your option) * any later version. * * Agent15 is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for * more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package net.luminis.tls.alert; import net.luminis.tls.TlsConstants; // https://tools.ietf.org/html/rfc8446#section-6.2 // "bad_certificate: A certificate was corrupt, contained signatures that did not verify correctly, etc." public class BadCertificateAlert extends ErrorAlert { public BadCertificateAlert(String message) { super(message, TlsConstants.AlertDescription.bad_certificate); } }
9238bb22e727092a577598f98c223c173dc7a491
8,296
java
Java
src/main/java/kemet/model/action/VetoAction.java
dd00f/Kemet
cfb6ac3a786ceb974e749db0ebb705b4d7428014
[ "Apache-2.0" ]
null
null
null
src/main/java/kemet/model/action/VetoAction.java
dd00f/Kemet
cfb6ac3a786ceb974e749db0ebb705b4d7428014
[ "Apache-2.0" ]
2
2022-01-04T16:32:39.000Z
2022-01-04T16:33:38.000Z
src/main/java/kemet/model/action/VetoAction.java
dd00f/Kemet
cfb6ac3a786ceb974e749db0ebb705b4d7428014
[ "Apache-2.0" ]
null
null
null
25.063444
108
0.687681
998,551
package kemet.model.action; import java.util.Arrays; import kemet.model.BoardInventory; import kemet.model.DiCardList; import kemet.model.KemetGame; import kemet.model.Player; import kemet.model.Validation; import kemet.model.action.choice.ChoiceInventory; import kemet.model.action.choice.PlayerChoice; import kemet.util.ByteCanonicalForm; import kemet.util.Cache; public class VetoAction extends EndableAction { /** * */ private static final long serialVersionUID = 16471122266807602L; private KemetGame game; private Player diCardPlayer; private Action parent; public int cardToVetoIndex; // by player index, check who has already passed on the veto public boolean[] playerVetoDone; public boolean isVetoed = false; private Player playerDoingVeto; @Override public void fillCanonicalForm(ByteCanonicalForm cannonicalForm, int playerIndex) { diCardPlayer.setCanonicalState(cannonicalForm, BoardInventory.STATE_VETO_PLAYER, playerIndex); cannonicalForm.set(DiCardList.CARDS[cardToVetoIndex].getVetoIndex(), (byte) 1); // cannonicalForm.set(DiCardList.CARDS[cardToVetoIndex].getVetoIndex(), // diCardPlayer.getState(playerIndex)); for (int i = 0; i < playerVetoDone.length; i++) { if (playerVetoDone[i]) { int vetoDonePlayerIndex = game.getPlayerByIndex(i).getCanonicalPlayerIndex(playerIndex); cannonicalForm.set(BoardInventory.STATE_PLAYER_VETO_DONE + vetoDonePlayerIndex, (byte) 1); } } if (playerDoingVeto != null) { playerDoingVeto.setCanonicalState(cannonicalForm, BoardInventory.STATE_PLAYER_DOING_VETO_ON_VETO, playerIndex); } } public static Cache<VetoAction> CACHE = new Cache<VetoAction>(() -> new VetoAction()); @Override public void internalInitialize() { game = null; diCardPlayer = null; playerDoingVeto = null; parent = null; cardToVetoIndex = -1; playerVetoDone = null; isVetoed = false; } @Override public void validate(Action expectedParent, KemetGame currentGame) { currentGame.validate(game); currentGame.validate(diCardPlayer); currentGame.validate(playerDoingVeto); if (expectedParent != parent) { Validation.validationFailed("Action parent isn't as expected."); } } private VetoAction() { } @Override public void relink(KemetGame clone) { this.game = clone; diCardPlayer = clone.getPlayerByCopy(diCardPlayer); playerDoingVeto = clone.getPlayerByCopy(playerDoingVeto); super.relink(clone); } @Override public VetoAction deepCacheClone() { VetoAction clone = CACHE.create(); copy(clone); return clone; } private void copy(VetoAction clone) { clone.game = game; clone.diCardPlayer = diCardPlayer; clone.parent = parent; clone.playerDoingVeto = playerDoingVeto; clone.cardToVetoIndex = cardToVetoIndex; clone.playerVetoDone = Arrays.copyOf(playerVetoDone, playerVetoDone.length); clone.isVetoed = isVetoed; super.copy(clone); } @Override public void release() { clear(); CACHE.release(this); } @Override public void clear() { game = null; diCardPlayer = null; parent = null; playerDoingVeto = null; super.clear(); } public static VetoAction create(KemetGame game, Player player, Action parent, int cardToVetoIndex) { VetoAction create = CACHE.create(); create.initialize(); create.game = game; create.diCardPlayer = player; create.parent = parent; create.cardToVetoIndex = cardToVetoIndex; return create; } @Override public void setParent(Action parent) { this.parent = parent; } public class ApplyVetoChoice extends PlayerChoice { public boolean applyVeto; public ApplyVetoChoice(KemetGame game, Player player, boolean applyVeto) { super(game, player); this.applyVeto = applyVeto; } @Override public String describe() { if (applyVeto) { return "Apply Veto to " + DiCardList.CARDS[cardToVetoIndex].name + " from player " + player.name; } return "Do not apply Veto to " + DiCardList.CARDS[cardToVetoIndex].name + " from player " + player.name; } @Override public void choiceActivate() { if (applyVeto) { useDiVetoCard(player); isVetoed = true; playerDoingVeto = player; } playerVetoDone[player.getIndex()] = true; // trigger next veto step parent.getNextPlayerChoicePick(); } @Override public int getIndex() { if (applyVeto) { return ChoiceInventory.ACTIVATE_DI_CARD + DiCardList.VETO.index; } return ChoiceInventory.SKIP_DI_VETO; } } public class ApplyVetoToVetoChoice extends PlayerChoice { public boolean applyVeto; public ApplyVetoToVetoChoice(KemetGame game, Player player, boolean applyVeto) { super(game, player); this.applyVeto = applyVeto; } @Override public String describe() { if (applyVeto) { return "Apply veto to the veto of player " + playerDoingVeto.name + " on top of " + DiCardList.CARDS[cardToVetoIndex].name + " from player " + player.name; } return "Do not apply Veto to the veto of player " + playerDoingVeto.name + " on top of " + DiCardList.CARDS[cardToVetoIndex].name + " from player " + player.name; } @Override public void choiceActivate() { if (applyVeto) { useDiVetoCard(player); isVetoed = false; } // trigger DI card activation parent.getNextPlayerChoicePick(); end(); } @Override public int getIndex() { if (applyVeto) { return ChoiceInventory.ACTIVATE_DI_CARD + DiCardList.VETO.index; } return ChoiceInventory.SKIP_DI_VETO; } } public void useDiVetoCard(Player currentPlayer) { DiCardList.moveDiCard(currentPlayer.diCards, game.discardedDiCardList, DiCardList.VETO.index, currentPlayer.name, KemetGame.DISCARDED_DI_CARDS, "used DI card.", game); } public void applyDiCard(DiCardExecutor action) { getNextPlayerChoicePick(); if (isEnded()) { if (!isVetoed) { action.applyDiCard(cardToVetoIndex); } } } @Override public PlayerChoicePick getNextPlayerChoicePick() { if (isEnded()) { return null; } if (isVetoed) { // veto the veto for (Player currentPlayer : game.playerByInitiativeList) { if (currentPlayer.getIndex() != playerDoingVeto.getIndex()) { if (currentPlayer.diCards[DiCardList.VETO.index] > 0) { // give player a choice to veto the veto // pick tile PlayerChoicePick pick = new PlayerChoicePick(game, currentPlayer, this); pick.choiceList.add(new ApplyVetoToVetoChoice(game, currentPlayer, true)); pick.choiceList.add(new ApplyVetoToVetoChoice(game, currentPlayer, false)); return pick; } } } } else { if (playerVetoDone == null) { playerVetoDone = new boolean[game.playerByInitiativeList.size()]; for (Player currentPlayer : game.playerByInitiativeList) { if (currentPlayer.getIndex() == diCardPlayer.getIndex()) { playerVetoDone[currentPlayer.getIndex()] = true; } else if (currentPlayer.diCards[DiCardList.VETO.index] == 0) { playerVetoDone[currentPlayer.getIndex()] = true; } } } for (Player currentPlayer : game.playerByInitiativeList) { if (currentPlayer.getIndex() != diCardPlayer.getIndex()) { if (currentPlayer.diCards[DiCardList.VETO.index] > 0 && playerVetoDone[currentPlayer.getIndex()] == false) { // give player a choice to veto the veto PlayerChoicePick pick = new PlayerChoicePick(game, currentPlayer, this); pick.choiceList.add(new ApplyVetoChoice(game, currentPlayer, true)); pick.choiceList.add(new ApplyVetoChoice(game, currentPlayer, false)); return pick; } playerVetoDone[currentPlayer.getIndex()] = true; } } } end(); return null; } @Override public Action getParent() { return parent; } @Override public void enterSimulationMode(int playerIndex) { super.enterSimulationMode(playerIndex); } @Override public void stackPendingActionOnParent(Action pendingAction) { parent.stackPendingActionOnParent(pendingAction); } }
9238bcc6b012829e5ea3d12a57d7ee3e6237fcfc
180
java
Java
src/main/java/com/techtong/solid/srp/refactored/logger/FileLogger.java
tech-tong/solid-principles
13ddf6a20c92ef7cf4d2e2dd9a1782a4ec735921
[ "MIT" ]
8
2020-12-17T06:18:30.000Z
2022-02-02T16:50:18.000Z
src/main/java/com/techtong/solid/srp/refactored/logger/FileLogger.java
tech-tong/solid-principles
13ddf6a20c92ef7cf4d2e2dd9a1782a4ec735921
[ "MIT" ]
2
2020-11-24T16:23:04.000Z
2020-12-08T13:17:02.000Z
src/main/java/com/techtong/solid/srp/refactored/logger/FileLogger.java
tech-tong/solid-principles
13ddf6a20c92ef7cf4d2e2dd9a1782a4ec735921
[ "MIT" ]
2
2021-08-06T12:58:22.000Z
2021-08-13T05:41:17.000Z
25.714286
51
0.694444
998,552
package com.techtong.solid.srp.refactored.logger; public class FileLogger { public void logInFile(String message) { System.out.println("File Log: " + message); } }
9238bda6710f97419a6432dda3642d2c75c022b5
1,000
java
Java
com/intkr/saas/engine/proxy/RpcBeInvocationHandler.java
Beiden/Intkr_SAAS_BEIDEN
fb2b68f2e04a891523e3589dd3abebd2fcd5828d
[ "Apache-2.0" ]
null
null
null
com/intkr/saas/engine/proxy/RpcBeInvocationHandler.java
Beiden/Intkr_SAAS_BEIDEN
fb2b68f2e04a891523e3589dd3abebd2fcd5828d
[ "Apache-2.0" ]
null
null
null
com/intkr/saas/engine/proxy/RpcBeInvocationHandler.java
Beiden/Intkr_SAAS_BEIDEN
fb2b68f2e04a891523e3589dd3abebd2fcd5828d
[ "Apache-2.0" ]
1
2022-03-16T15:04:17.000Z
2022-03-16T15:04:17.000Z
26.315789
92
0.697
998,553
package com.intkr.saas.engine.proxy; import java.lang.reflect.Method; import com.intkr.saas.util.claz.ClassUtil; import com.intkr.saas.util.claz.IOC; /** * * @author Beiden * @date 2018-4-1 * @version 1.0 */ public class RpcBeInvocationHandler { public Object invoke(String clsName, String methodString, Object[] args) throws Throwable { Class<?> clas = Class.forName(clsName); Object invokerObject = IOC.get(clas); Method method = null; if (args != null) { Class<?>[] argsClas = new Class<?>[args.length]; for (int i = 0; i < args.length; i++) { argsClas[i] = args[i].getClass(); } method = ClassUtil.getMethod(clas, methodString, argsClas); } else { method = ClassUtil.getMethod(clas, methodString); } Object returnObject = method.invoke(invokerObject, args); return returnObject; } public Object invoke(Object object, Method method, Object[] args) throws Throwable { Object returnObject = method.invoke(object, args); return returnObject; } }
9238bdb880766f55a7b30b898234db1c9cf37a67
4,079
java
Java
simple-haskell-marker/src/main/java/alabno/simple_haskell_marker/HaskellSplitter.java
giuliojiang/alabno
a6e604034731e2e94cea4e0c59422d6d35aea789
[ "MIT" ]
null
null
null
simple-haskell-marker/src/main/java/alabno/simple_haskell_marker/HaskellSplitter.java
giuliojiang/alabno
a6e604034731e2e94cea4e0c59422d6d35aea789
[ "MIT" ]
null
null
null
simple-haskell-marker/src/main/java/alabno/simple_haskell_marker/HaskellSplitter.java
giuliojiang/alabno
a6e604034731e2e94cea4e0c59422d6d35aea789
[ "MIT" ]
null
null
null
28.929078
104
0.57318
998,554
package alabno.simple_haskell_marker; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.List; import java.util.Scanner; /** * Splits an input Haskell file into smaller subsections * Splitting is based on the amount of empty lines, * and beginning of function definitions * */ public class HaskellSplitter { static final int MAX_BLOCK_LENGTH = 10; String inputPath; File inputFile; Scanner scanner; /** * @param inputPath the input path of the file to be read * * Creates a new HaskellSplitter. */ public HaskellSplitter(String inputPath) { this.inputPath = inputPath; init(); } /** * Reads the input file and creates the Scanner for reading */ private void init() { this.inputFile = new File(inputPath); try { this.scanner = new Scanner(inputFile); } catch (FileNotFoundException e) { e.printStackTrace(); } } /** * This class contains variables used to * determine whether to split or not * */ class SplitConditions { boolean lastLineWasEmpty = false; int currentBlockLength = 0; } /** * @return the list of strings, split according Haskell heuristics */ public List<HaskellBlock> split() { // Create the variables used to store the current state, // used to determine whether to split or not SplitConditions conditions = new SplitConditions(); List<HaskellBlock> haskellBlocks = new ArrayList<>(); StringBuilder currentBlock = new StringBuilder(); String currentLine = null; int currentLineNumber = 0; int blockStartLineNumber = 1; while (scanner.hasNextLine()) { currentLine = scanner.nextLine() + "\n"; currentLineNumber++; if (splitCondition(currentLine, conditions)) { HaskellBlock newBlock = new HaskellBlock(blockStartLineNumber, currentBlock.toString()); haskellBlocks.add(newBlock); // append the analyzed line to the new block conditions.currentBlockLength = 0; currentBlock = new StringBuilder(); currentBlock.append(currentLine); conditions.currentBlockLength++; blockStartLineNumber = currentLineNumber; } else { // append the analyzed line to the current block currentBlock.append(currentLine); conditions.currentBlockLength++; } } // add pending last block if (currentBlock.length() > 0) { HaskellBlock newBlock = new HaskellBlock(blockStartLineNumber, currentBlock.toString()); haskellBlocks.add(newBlock); } // Reformats special characters, empty lines and tabs // into a single line in the output return haskellBlocks; } private boolean splitCondition(String currentLine, SplitConditions conditions) { if (!isEmpty(currentLine) && conditions.currentBlockLength > MAX_BLOCK_LENGTH) { conditions.lastLineWasEmpty = false; return true; } if (conditions.lastLineWasEmpty && !isEmpty(currentLine)) { conditions.lastLineWasEmpty = false; return true; } if (currentLine.contains("::")) { conditions.lastLineWasEmpty = false; return true; } conditions.lastLineWasEmpty = isEmpty(currentLine); return false; } boolean isEmpty(String line) { if (line.isEmpty()) { return true; } for (char c : line.toCharArray()) { if (!"\n\t\r ".contains("" + c)) { return false; } } return true; } }
9238be364a1a897346ec72f399b358f4a244ca3e
1,575
java
Java
jetbrick-webmvc/src/main/java/jetbrick/web/mvc/results/ObjectResultHandler.java
subchen/jetbrick-all-1x
abe54629a508592287afe5ca4ffc93bf8bf4940c
[ "Apache-2.0" ]
3
2015-11-18T01:37:08.000Z
2018-07-20T13:51:17.000Z
jetbrick-webmvc/src/main/java/jetbrick/web/mvc/results/ObjectResultHandler.java
subchen/jetbrick-all-1x
abe54629a508592287afe5ca4ffc93bf8bf4940c
[ "Apache-2.0" ]
null
null
null
jetbrick-webmvc/src/main/java/jetbrick/web/mvc/results/ObjectResultHandler.java
subchen/jetbrick-all-1x
abe54629a508592287afe5ca4ffc93bf8bf4940c
[ "Apache-2.0" ]
null
null
null
32.8125
76
0.691429
998,555
/** * Copyright 2013-2014 Guoqiang Chen, Shanghai, China. All rights reserved. * * Email: nnheo@example.com * URL: http://subchen.github.io/ * * 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 jetbrick.web.mvc.results; import jetbrick.ioc.annotations.Managed; import jetbrick.web.mvc.RequestContext; import jetbrick.web.mvc.ResultHandlerResolver; @Managed public class ObjectResultHandler implements ResultHandler<Object> { // 没有直接注入,否则会产生循环注入失败 private ResultHandlerResolver resolver; @Override public void handle(RequestContext ctx, Object result) throws Exception { if (resolver == null) { resolver = ctx.getWebConfig().getResultHandlerResolver(); } if (result != null) { Class<?> resultClass = result.getClass(); if (resultClass == Object.class) { throw new IllegalStateException("Invalid result class."); } ResultHandler<Object> handler = resolver.lookup(resultClass); handler.handle(ctx, result); } } }
9238be993747b93898cf82f55d2f002275b9b051
1,496
java
Java
forker/src/main/java/com/redshape/forker/protocol/queue/IProtocolQueue.java
nikelin/Redshape-AS
252d10988daadb9ca5972b61da2ef9d84eedafac
[ "Apache-2.0" ]
null
null
null
forker/src/main/java/com/redshape/forker/protocol/queue/IProtocolQueue.java
nikelin/Redshape-AS
252d10988daadb9ca5972b61da2ef9d84eedafac
[ "Apache-2.0" ]
7
2016-03-23T03:59:15.000Z
2022-02-01T00:57:54.000Z
forker/src/main/java/com/redshape/forker/protocol/queue/IProtocolQueue.java
Redshape/Redshape-AS
252d10988daadb9ca5972b61da2ef9d84eedafac
[ "Apache-2.0" ]
1
2016-03-09T21:29:53.000Z
2016-03-09T21:29:53.000Z
28.226415
85
0.745989
998,556
/* * Copyright 2012 Cyril A. Karpenko * * 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.redshape.forker.protocol.queue; import com.redshape.forker.IForkCommand; import com.redshape.forker.IForkCommandResponse; import com.redshape.utils.IFilter; /** * Created with IntelliJ IDEA. * User: cyril * Date: 8/29/12 * Time: 3:11 PM * To change this template use File | Settings | File Templates. */ public interface IProtocolQueue { public boolean hasRequest(); public boolean hasResponse(); public void collectRequest( IForkCommand command ); public IForkCommand pollRequest(); public IForkCommand peekRequest(); public IForkCommand peekRequest( IFilter<IForkCommand> filter ); public void collectResponse( IForkCommandResponse response ); public IForkCommandResponse pollResponse(); public IForkCommandResponse peekResponse(); public IForkCommandResponse peekResponse( IFilter<IForkCommandResponse> filter ); }
9238be9c5f28c0eb8b01da8653d4260a6e38d012
4,168
java
Java
projects/project_moyi/cla/edg/project/moyi/gen/graphquery/InkCoinIncentiveRule.java
Clariones/event-driven-generation
f5525f5af980807a6c9983065b465f19ad6bab31
[ "BSD-2-Clause" ]
2
2019-10-31T06:00:48.000Z
2019-10-31T06:01:43.000Z
projects/project_moyi/cla/edg/project/moyi/gen/graphquery/InkCoinIncentiveRule.java
Clariones/event-driven-generation
f5525f5af980807a6c9983065b465f19ad6bab31
[ "BSD-2-Clause" ]
null
null
null
projects/project_moyi/cla/edg/project/moyi/gen/graphquery/InkCoinIncentiveRule.java
Clariones/event-driven-generation
f5525f5af980807a6c9983065b465f19ad6bab31
[ "BSD-2-Clause" ]
1
2020-11-25T10:51:53.000Z
2020-11-25T10:51:53.000Z
31.816794
99
0.713772
998,557
package cla.edg.project.moyi.gen.graphquery; import java.util.Map; import cla.edg.modelbean.*; public class InkCoinIncentiveRule extends BaseModelBean { public String getFullClassName() { return "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule"; } // 枚举对象 public static EnumAttribute REGISTRATION = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "REGISTRATION"); public static EnumAttribute INVITATION = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "INVITATION"); public static EnumAttribute CHECK_IN = new EnumAttribute("com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "CHECK_IN"); public static EnumAttribute POST_ARTICLE = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "POST_ARTICLE"); public static EnumAttribute POST_ARTWORK = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "POST_ARTWORK"); public static EnumAttribute POST_ARTWORK_REVIEW = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "POST_ARTWORK_REVIEW"); public static EnumAttribute POST_REVIEW = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "POST_REVIEW"); public static EnumAttribute POST_LIKED = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "POST_LIKED"); public static EnumAttribute SHARE_CONTENT = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "SHARE_CONTENT"); public static EnumAttribute ARTWORK_REVIEWED = new EnumAttribute( "com.terapico.moyi.inkcoinincentiverule.InkCoinIncentiveRule", "ARTWORK_REVIEWED"); // 引用的对象 public Moyi moyi() { Moyi member = new Moyi(); member.setModelTypeName("moyi"); member.setName("moyi"); member.setMemberName("moyi"); member.setReferDirection(true); member.setRelationName("moyi"); append(member); return member; } // 被引用的对象 // 普通属性 public StringAttribute id() { StringAttribute member = new StringAttribute(); member.setModelTypeName("string"); // member.setName("id"); member.setName("id"); useMember(member); return member; } public StringAttribute name() { StringAttribute member = new StringAttribute(); member.setModelTypeName("string"); // member.setName("name"); member.setName("name"); useMember(member); return member; } public StringAttribute description() { StringAttribute member = new StringAttribute(); member.setModelTypeName("string"); // member.setName("description"); member.setName("description"); useMember(member); return member; } public StringAttribute code() { StringAttribute member = new StringAttribute(); member.setModelTypeName("string"); // member.setName("code"); member.setName("code"); useMember(member); return member; } public NumberAttribute settlementDurationHour() { NumberAttribute member = new NumberAttribute(); member.setModelTypeName("int"); // member.setName("settlementDurationHour"); member.setName("settlement_duration_hour"); useMember(member); return member; } public NumberAttribute ruleValue() { NumberAttribute member = new NumberAttribute(); member.setModelTypeName("double"); // member.setName("ruleValue"); member.setName("rule_value"); useMember(member); return member; } public DateTimeAttribute lastUpdateTime() { DateTimeAttribute member = new DateTimeAttribute(); member.setModelTypeName("date_time_update"); // member.setName("lastUpdateTime"); member.setName("last_update_time"); useMember(member); return member; } public NumberAttribute version() { NumberAttribute member = new NumberAttribute(); member.setModelTypeName("int"); // member.setName("version"); member.setName("version"); useMember(member); return member; } }
9238bf84f94c8f56f82147c2c26840d9aa06c276
1,189
java
Java
lib/jif-3.5.0/src/jif/types/JifLocalInstance_c.java
GustavHenning/SoftwareSafetySecurity18
3142f9182639af69d0ef42060d98f25d6ee7f398
[ "MIT" ]
null
null
null
lib/jif-3.5.0/src/jif/types/JifLocalInstance_c.java
GustavHenning/SoftwareSafetySecurity18
3142f9182639af69d0ef42060d98f25d6ee7f398
[ "MIT" ]
1
2018-04-24T12:01:51.000Z
2018-04-24T12:01:51.000Z
lib/jif-3.5.0/src/jif/types/JifLocalInstance_c.java
GustavHenning/SoftwareSafetySecurity18
3142f9182639af69d0ef42060d98f25d6ee7f398
[ "MIT" ]
null
null
null
23.78
77
0.667788
998,558
package jif.types; import jif.types.label.Label; import polyglot.types.Flags; import polyglot.types.LocalInstance_c; import polyglot.types.Type; import polyglot.util.Position; import polyglot.util.SerialVersionUID; /** An implementation of the <code>JifLocalInstance</code> interface. */ public class JifLocalInstance_c extends LocalInstance_c implements JifLocalInstance { private static final long serialVersionUID = SerialVersionUID.generate(); protected Label label; public JifLocalInstance_c(JifTypeSystem ts, Position pos, Flags flags, Type type, String name) { super(ts, pos, flags, type, name); } @Override public void subst(VarMap bounds) { this.setLabel(bounds.applyTo(label)); this.setType(bounds.applyTo(type)); } @Override public boolean isCanonical() { return label != null && label.isCanonical() && super.isCanonical(); } @Override public Label label() { return label; } @Override public void setLabel(Label L) { this.label = L; } @Override public String toString() { return super.toString() + " " + label; } }