method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
538d3676-a8e1-4194-9043-a00dd4f18478 | 8 | protected void clearWarrants(final MOB officer, final MOB invoker, final Room R, final Area A, final LegalBehavior B)
{
final List<LegalWarrant> warrants=B.getWarrantsOf(A, invoker);
if((warrants!=null)&&(warrants.size()>0))
{
boolean didSomething=false;
for(LegalWarrant W : warrants)
{
if((W.arrest... |
d3c3283a-9fcf-44d6-85f9-9fab7b068654 | 4 | @Override
public void setForecast(String name, int forecast) {
try {
if (!inGame) {
LOG.warn("Game has to be started before any forecasts can be set!");
playermanager.sendErrorPacket(name, "Game has not been started yet!", ErrorReason.GAME_NOT_STARTED_YET);
... |
01d11726-7689-4fb1-b045-4e03a763f981 | 6 | public List<String[]> getCSVData() {
List<String[]> data = new ArrayList<String[]>();
data.add(new String[] {
"id",
"length",
"startTime",
"target",
"targetX",
"targetY",
"targetGridX",
"targetGridY",
"userX",
"userY",
"userGridX",
"userGridY",
"gridClickCor... |
13d88127-ab66-4638-8ad9-52a352809958 | 6 | private void resize() {
size = getSkinnable().getWidth() < getSkinnable().getHeight() ? getSkinnable().getWidth() : getSkinnable().getHeight();
width = getSkinnable().getWidth();
height = getSkinnable().getHeight();
if (getSkinnable().isKeepAspect()) {
if (aspectRatio * wi... |
e2e378c3-1595-4ea0-9742-3d9b003aed21 | 2 | @Override
public void handleMessages(Inbox inbox) {
// TODO Auto-generated method stub
while (inbox.hasNext()) {
Message msg = inbox.next();
System.out.println("Dados da msg: ");
System.out.println("Time arrive: "+inbox.getArrivingTime());
System.out.println("Time send: "+inbox.getSendingTime());
... |
4e7efa18-a0d8-4131-a5ed-2ea7268c1990 | 0 | @Override
public String getPostalCode() {
return super.getPostalCode();
} |
d1ecc20a-77bb-488b-958b-13b1eecc2d03 | 4 | @RequestMapping(value = "/listActiveUsers", method = RequestMethod.GET)
public String listActiveUsers(Model model) {
Map<Object, Date> lastActivityDates = new HashMap<Object, Date>();
for (Object principal : sessionRegistry.getAllPrincipals()) {
// a principal may have multiple active se... |
b00d17be-dd4f-46bb-825f-a30cdae15e47 | 8 | public Strength checkPassword(final String password) {
int combinations = 0;
if (containsAny(password, DIGITS)) {
combinations += 10;
}
if (containsAny(password, LOWERCASE)) {
combinations += 26;
}
if (containsAny(password, UPPERCASE)) {
combinations += 26;
}
if (containsAny(password, PUNC... |
09420c67-6f47-4e9f-bad8-556c068f267c | 4 | public Object getColumn(int columnIndex) {
switch(columnIndex) {
case 0: return id;
case 1: return name;
case 2: return new Double(price);
case 3: return new Integer(quantity);
default: throw new RuntimeException("invalid column!");
}
} |
de92f6af-f1db-45c5-a0ab-a229957e005e | 2 | @Override
public void connect() {
try {
if (!new File(getFile()).exists())
new File(getFile()).createNewFile();
DriverManager.registerDriver(new org.sqlite.JDBC());
connection = DriverManager.getConnection(PATH + getFile());
} catch (Exception e) {... |
dfd888fb-2593-446c-872a-e8d79b8ef897 | 5 | protected EntityManagerFactory createEntityManagerFactory() {
/*JtdsDataSource dsMYSQL = new JtdsDataSource();
dsMYSQL.setServerName("127.0.0.1");
dsMYSQL.setDatabaseName("smartchat");
dsMYSQL.setUser("root");
dsMYSQL.setPassword("");*/
EntityManagerFactory emf = null;
DataSource ds = null... |
62f7b0b8-d75f-4b37-b311-eedd4032b067 | 0 | public void setjCheckBoxVisiteurs(JCheckBox jCheckBoxVisiteurs) {
this.jCheckBoxVisiteurs = jCheckBoxVisiteurs;
} |
644ea96d-5a4c-4d16-96f1-eb1fda96e189 | 0 | public void setNameAlgorythm(String name){
nameAlgorythm.setText(name);
} |
d588f6f6-00d1-480d-a39d-440d68488e2b | 3 | private void Adicionar_ButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Adicionar_ButtonActionPerformed
try {
if (NomeJogador_TextField.getText().equals("")) {
JOptionPane.showMessageDialog(null, "Indique o nome do jogador a adicionar!", "Alerta!", JOptionPane... |
6b309095-d5cd-428e-9db3-e283acd8befc | 9 | private static Constructor<?> findConstructor(Class<?> daoClass, Object[] params) {
for (Constructor<?> constructor : daoClass.getConstructors()) {
Class<?>[] paramsTypes = constructor.getParameterTypes();
if (paramsTypes.length == params.length) {
boolean match = true;
for (int i = 0; i < paramsTypes.l... |
381bdb06-e611-439a-9a81-77c3c0f2a56e | 1 | public SignatureVisitor visitExceptionType() {
if (exceptions == null) {
exceptions = new StringBuffer();
} else {
exceptions.append(", ");
}
// startType();
return new TraceSignatureVisitor(exceptions);
} |
40404231-9820-41b7-ac3a-ca8420cf49e5 | 2 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/mensaje.jsp");
EmpresaBean oEmpresaBean = new EmpresaBean();
EmpresaDao oEmpresaDao ... |
5abff3a5-abff-4961-8150-bd0ab82d624b | 1 | public boolean isLeap(long millis) {
int[] ymd = iChronology.gjFromMillis(millis);
return ymd[1] == 2 && iChronology.isLeapYear(ymd[0]);
} |
8f7818de-90f8-412f-ac28-d1f2505ae13e | 9 | private final String decrypt(final JSONArray slogan) throws JSONException {
final char[] letters = new char[36];
letters[6] = 'A';
letters[12] = 'B';
letters[15] = 'C';
letters[5] = 'D';
letters[34] = 'E';
letters[16] = 'F';
letters[8] = 'G';
letters[23] = 'H';
letters[9] = 'I';
letters[20] = 'J'... |
0be7df8b-5488-4b01-baa3-fb5c301581a2 | 6 | public void left1panel2() {
Component getComp = BGPane.getComponentAt(80, 170);
int x = getComp.getX();
int y = getComp.getY();
if (x < 190 && y > 110) {
new Thread(new Runnable() {
@Override
public void run() {
for (int l2x... |
258a9bac-1e35-4333-b4b3-5a4080de1bfb | 6 | public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://down... |
c9498f39-6fda-47be-9e0d-b560f1595515 | 5 | private void setService(int service_id, int service_time, int driver_id, int bus_id, Date weekStart)
{
if (weekStart == null) throw new InvalidQueryException("Date is null");
if (service_time == 0) throw new InvalidQueryException("Time is null");
if (service_id == 0) throw new InvalidQueryException("None... |
79447591-2cde-4609-8eb4-bddd65f0bee2 | 3 | public int momLookback( int optInTimePeriod )
{
if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) )
optInTimePeriod = 10;
else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) )
return -1;
return optInTimePeriod;
} |
24251503-1294-4a35-8a11-5b089185fe40 | 7 | public static void delete (int uid) throws SQLException {
PreparedStatement s = null;
try {
try {Class.forName("org.postgresql.Driver");} catch (ClassNotFoundException ignore) {}
currentCon = DriverManager.getConnection(dbName);
String query = "DELETE FROM carts WHERE uid = ?";
s = currentCon.prepareSta... |
31c20208-690f-40f6-b767-d9b298e2618b | 4 | private static short encodeSequenceNumber(int sequenceNumber) throws SequenceNumberOutOfRangeException {
if(sequenceNumber != Packet.SEQUENCE_NUMBER_NOT_APPLICABLE && (sequenceNumber < Packet.MINIMUM_SEQUENCE_NUMBER || sequenceNumber > Packet.MAXIMUM_SEQUENCE_NUMBER))
throw new SequenceNumberOutOfRangeException(se... |
de4a2eab-e384-4b30-9621-933ffc73f188 | 5 | private void autoPlay(int index) {
Hand current = this.hands[index];
Hand dealer = this.hands[dealerIndex];
// When dealer shown card is high
if (dealer.getValue(true) >= HIGH) {
if (current.getValue() >= (HIGH * 2)) {
current.state = STATE.STAND;
... |
0f0be9c6-4d91-4ad2-9dd2-60ab01453b35 | 9 | int insertKeyRehash(short val, int index, int hash, byte state) {
// compute the double hash
final int length = _set.length;
int probe = 1 + (hash % (length - 2));
final int loopIndex = index;
int firstRemoved = -1;
/**
* Look ... |
1edb775e-abc8-4563-85f7-ca17c3370886 | 3 | private void right() {
TextGrid.DataGridCel cel = grid.getCel(currentRow + rowOffset,
currentCol + colOffset + 1);
if (cel == null) {
return;
}
if (cel.getBufferIndex() != -1) {
if (currentCol < (numberOfCols - 1)) {
currentCol++;
... |
6ccb09d0-61a7-4850-9bfd-20543398533b | 8 | public static MarketTicker getTicker(String marketID, String serverID, String nymID) {
// ----------------------------------------------------------
OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.GET_MARKET_LIST, serverID, nymID);
String strResponse = OTAPI_Func.SendRequest(theRequest, "G... |
2dd3fbe8-cd80-4d85-82c6-7154c2c6e86c | 3 | public void exponentialProbabilityPlot(){
this.lastMethod = 2;
// Check for suffient data points
this.exponentialNumberOfParameters = 2;
if(this.numberOfDataPoints<3)throw new IllegalArgumentException("There must be at least three data points - preferably considerably mo... |
e790afb6-452f-41bc-a64c-e172cbb15bd1 | 6 | public boolean onCommand(CommandSender sender, Command cmd, String label, String args[]) {
if (args.length == 0) {
return false;
}
if (!(sender instanceof Player)) {
HashMap<String, String> values = new HashMap<String, String>();
Helper.sendParsedMessage(sen... |
84fbabbb-7bf0-431f-a632-e419e2d32c0a | 3 | public <T extends Value<?>> T getTypedReturnValue (String key, Class<T> type) {
Value<?> v = Bencode.copyOf(returnValues.get(key));
if (type.isInstance(v)) {
return type.cast(Bencode.copyOf(v));
} else {
return null;
}
} |
21380778-d48d-4707-b413-6b77224df1e3 | 6 | public static void startupInferenceCaches() {
{ Object old$Module$000 = Stella.$MODULE$.get();
Object old$Context$000 = Stella.$CONTEXT$.get();
try {
Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/LOGIC", Stella.$STARTUP_TIME_PHASE$ > 1));
Native.setSpecial(Stella.$CONTEXT$... |
4812deab-08f3-4915-bca1-275f210c96f4 | 6 | public void checker(){
int chekerEmptyCellNum=0;
for (int y=0; y<Drawer.DIMENSION;y++){ //Checking all rows
for (int x=0; x<Drawer.DIMENSION;x++){ //run for row rightleft
if (Drawer.field[y][x]==Drawer.CELL){
chekerEmptyCellNum++; ... |
eaa283d2-6296-4293-8f1b-fad9eb5e4849 | 6 | public void redo() {
if (operation.equals("cross") && parent1 != null && parent2 != null) {
Fractal newFractal = parent1.cross(parent2);
x = newFractal.getX();
y = newFractal.getY();
z = newFractal.getZ();
r = newFractal.getR();
g = newFra... |
f6d38a7c-ec9c-4768-b213-f89ab704dd06 | 7 | private double matchDistances(List<Distance> reference, List<Distance> probe) {
int i = 0;
int match = 0;
for(Distance d1 : reference){
for(Distance d2 : probe){
if( (((d1.getMinutia1().getType() == d2.getMinutia1().getType()) && (d1.getMinutia2().getType() == d2.getMinutia2().getType())) ||
((d1.ge... |
a79e9685-de52-449a-82a2-368280bf4c83 | 1 | public static byte[] sha256Byte(String base, String salt) {
try{
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.reset();
digest.update(salt.getBytes());
byte[] hash = digest.digest(base.getBytes("UTF-8"));
return hash;
} catch(Excep... |
7944c2f7-6d65-4707-af6e-0b3b190081df | 6 | @EventHandler
public void SpiderHunger(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSpiderConfig().getDouble("Spider.Hunger.D... |
f0b34d06-3234-4765-96a0-c42d5c30373c | 2 | @Override
public void completeADay() {
//call each phase completion. This cannot be run by the dispatch thread obviously
try {
for (DAY_PHASES phase : DAY_PHASES.values())
completeAnArbitraryPhase(phase);
}
catch (InterruptedException e) {
e.pr... |
b4a3c732-7534-44e7-bba5-084ad7f7e5f1 | 2 | private void addEventHandler(Class<? extends Event> event,
IEventHandler handler, int priority) {
TreeMap<Integer, IEventHandler> map = new TreeMap<Integer, IEventHandler>();
map.put(priority, handler);
TreeMap<Integer, IEventHandler> tmp = eventHandlers.get(event);
if (tmp == null) {
tmp = new TreeMap<In... |
b111c834-84cf-4957-a0fa-e0dadde1d93f | 5 | private void setupTerminals(HashMap<String, Object[]> terminalsMap) {
String termname = "";
String termclass = "";
Terminal term = null;
Object[] entry = null;
for (Iterator<String> iter = terminalsMap.keySet().iterator(); iter.hasNext();) {
try {
//... |
30ec1971-54ec-400b-a882-92177c987245 | 6 | private int[] generate_num_key(String k)
{
assert(k.length()==10);
String k_u=k.toUpperCase();
char[] k_array=k_u.toCharArray();
int[] result=new int[10];
int[] end_pos=new int[10];
for(int i=0;i<10;i++)
{
//result[i]=0;
end_pos[i]=i;
}
for(int i=0;i<10;i++)
{
for(int j=i+1;j... |
ec32d4b5-1a0a-40fb-acd4-7cc8995348de | 1 | public final static double[] getValues(File file)
throws JAXBException, SAXException {
double[] rhValues= null;
JAXBContext jc= JAXBContext.newInstance("songArtifacts.lowLevel");
Unmarshaller u= jc.createUnmarshaller();
SchemaFactory sf= SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI);
InputStrea... |
4d3bc13b-371c-44a2-9833-9368c40537b5 | 4 | public void run(){
//loops indefinitely
while(true){
//pauses the automaton
try{ while (pause ==true){
Thread.sleep(1);}
} catch(InterruptedException ie) {}
//main cell logic
iterate();
//timeout between grid-wide iterations
try{
Thread.sleep(ztime);
} catch(In... |
eb30caa7-0c1b-4960-ba78-2dd4f17f3c80 | 6 | public void actionPerformed(ActionEvent e) {
if(((AbstractButton) e.getSource()).isSelected()){
for(JComponent field : additionalFields)
field.setVisible(true);
}else{
for(JComponent field : additionalFields){
if(field instanceof JTextField){
((JTextField) field).setText("");
}else if(field i... |
906d7d2b-b8bf-472d-97e2-142480cbb027 | 9 | public static void bookMenu(TravelAgent agent){
//print out menu - 2 goes back to main
System.out.print("---- Travel Console - " + agent.name + " - Booking Menu ----" + "\n" +
"1) Book a customer to a flight \n" +
"2) Return to main menu \n" +
">>: ");
if (input.nextInt() == 2){
mainMenu(age... |
c6f00376-2007-4318-88e1-0ba8daab125b | 7 | public static void main(String[] args) throws Exception {
int N=6000;
if (args.length>=1) N=Integer.parseInt(args[0]);
Crb=new double[N+7]; Cib=new double[N+7];
double invN=2.0/N; for(int i=0;i<N;i++){ Cib[i]=i*invN-1.0; Crb[i]=i*invN-1.5; }
yCt=new AtomicInteger();
out=new byte[N][(N+7)/8];
Thread[] po... |
af21418c-373a-44f8-b9a9-62920e173c27 | 2 | private void playSong(String song){
// if no song has been started ie: beginning
if(this.song == null){
this.song = "tetrisb";
clip = getAudioClip(getCodeBase(), this.song);
clip.loop();
}
if(!this.song.equals(song)){
clip.stop();
clip = getAudioClip(getCodeBase(), song);
clip.loop();
t... |
d8a0dcfe-267d-45f3-9d1d-96eb06be48b6 | 8 | @Override
public int open(JoeTree tree, DocumentInfo docInfo, InputStream stream) {
int success = FAILURE;
String text = null;
try {
BufferedReader buf = new BufferedReader(new InputStreamReader(stream, PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_ENCODING_TYPE)));
StringBu... |
835f7a78-e209-4d3c-ac2b-8f5ca4067346 | 6 | @EventHandler
public void SlimeBlindness(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getSlimeConfig().getDouble("Slime.Blindnes... |
885ae699-88b0-4748-a89f-a46bb03b1ab4 | 9 | private void doSave() {
myFile = doRead();
if (myFile == null){
return;
}
String name = myFile.getName();
showMessage("compressing " + name);
String newName = JOptionPane.showInputDialog(this,
"Name of compressed file", name + HUFF_SUFF... |
45c264bc-72c8-4d4a-9690-c844fbb55770 | 4 | @Override
public void moveContact(String userId,
String categoryId) throws ProfileExceptions {
if (userId == null || userId.isEmpty())
throw new ProfileExceptions(ProfileExceptionType.EmptyString);
if (categoryId == null || categoryId.isEmpty())
throw new ProfileExcepti... |
ad5ee656-6929-4615-966a-b007131187b7 | 9 | @Override
public final FTPResult handleResponse(FTPInterface inter, FTPResponse response) {
if (response.getCode() == 150 || response.getCode() == 125) {
try {
synchronized (uploadSync) {
while (upload == null && !stopRequested) uploadSync.wait();
upload.write(getData(inter, response));
upload.... |
a52bad27-8d28-4cb7-8374-4c7ca6e3e248 | 4 | public List<String> tokenize(String toTokenize) {
toTokenize = toTokenize.replace("'", " '");
// System.out.println(toTokenize);
List<String> tokens = new ArrayList<String>();
BreakIterator bi = BreakIterator.getWordInstance();
bi.setText(toTokenize);
int begin = bi.first();
int end;
for (end = bi.next(... |
4f43e3bb-8abc-48fd-8dad-f4cea514b6a8 | 0 | @Override
public void mousePressed(MouseEvent e) {
} |
186ee82b-01e2-4730-90ec-1c6c27a4b13e | 7 | private static byte[] calculateNext2(byte[] pattern) {
int m = pattern.length;
byte[] next = new byte[m];
byte i = 1;
byte j = 0;
next[0] = -1;
boolean ok = true;
while (i < m) {
/*
* If these two match, we cannot possibly have a candidate... |
432d8240-b8fe-4984-ade6-9086ad59e126 | 6 | @Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token)
throws AuthenticationException {
logger.info("User Login to initialize authenticationToken......");
User user = null;
SimpleAuthenticationInfo info = null;
// token中储存着输入的用户名和密码
UsernamePas... |
f2a1ad1c-a488-4bc7-8668-66e4ab7d98cc | 7 | public double weightedStandardError_of_ComplexImaginaryParts() {
boolean hold = Stat.nFactorOptionS;
if (nFactorReset) {
if (nFactorOptionI) {
Stat.nFactorOptionS = true;
} else {
Stat.nFactorOptionS = false;
}
}
boolean hold2 = Stat.nEffOptionS;
if (nEffReset) {
if (nEffOptionI) {
Sta... |
3c6848a1-f734-43fc-a182-f68aaaf59aa6 | 5 | protected final void onMouseClick(int var1, int var2, int var3) {
if(var3 == 0 && this.minecraft.hud.hoveredPlayer != null) {
if(this.message.length() > 0 && !this.message.endsWith(" ")) {
this.message = this.message + " ";
}
this.message = this.message + this.minecraft.hud... |
fdf5f0e7-c9d4-4844-ba86-13416cad3c82 | 8 | public static Class<? extends StatsCollector> getNamedStatsCollector(String name){
//first a name lookup
Class<? extends StatsCollector> cls=namedClasses.get(name);
if(cls!=null)
return cls;
//now we append package info
try {
cls=(Class<? extends StatsCollector>)Class.forName(PACKAGE+"."+name... |
fd845023-972e-40c2-9293-46c4d313b50e | 3 | public CPCanvas(CPController ctrl) {
this.controller = ctrl;
artwork = ctrl.getArtwork();
buffer = artwork.getDisplayBM().getData();
int w = artwork.width;
int h = artwork.height;
imgSource = new MemoryImageSource(w, h, buffer, 0, w);
imgSource.setAnimated(true);
// imgSource.setFullBufferUpdates(fal... |
2c6076c0-0171-4a93-8a48-adff412795f0 | 0 | public static void main(String[] args) {
Interface2 iface = new ClassB();
iface.method2();
} |
66799f79-fd14-4784-85f8-4d30c6c0aacd | 2 | public int putClassType(String name) {
TypeSignature.checkTypeSig(name);
if (name.charAt(0) == 'L')
name = name.substring(1, name.length() - 1);
else if (name.charAt(0) != '[')
throw new IllegalArgumentException("wrong class type: " + name);
return putIndexed(CLASS, name, putUTF8(name), 0);
} |
17267b92-aad1-4c20-b5d5-c797a3f57412 | 5 | public void disconnect(String message){ //called when disconnecting from server
if (message == null) message = "No message given.";
System.out.println("Client "+user.getName()+ " disconnected");
if (message!=null && chatRoom!=null) chatRoom.tellEveryone(user.getName()+" (disconnecting)", message... |
b0262242-babc-470e-95cc-81b46b6bf00d | 9 | private Vector<Vector<Integer>> printNegativeVector(String type, List<String> tt,
List<Indexer> indexer_list, List<List<Integer>> negDocList, int minNegSize, String index_name, String chi) {
Vector<Vector<Integer>> tweetVectors = new Vector<Vector<Integer>>();
//String textVectorFileName = "Training_Vector_NEG/T... |
2be494b8-33d2-4fd1-9b8b-d0b5780ef023 | 9 | void clearBondLists() {
if (rbondList != null && !rbondList.isEmpty()) {
synchronized (rbondList) {
for (RBond rbond : rbondList) {
model.getRBonds().remove(rbond);
}
rbondList.clear();
}
}
if (abondList != null && !abondList.isEmpty()) {
synchronized (abondList) {
for (ABond abond :... |
9f2fea88-156f-40a7-a161-375ce4608fc0 | 1 | public boolean charger() throws IOException
{
try {
FileInputStream fichier = new FileInputStream(this.nomFichier);
propriete.load(fichier);
fichier.close();
return true;
} catch (FileNotFoundException e) {
System.out.println("Erreur " + ... |
a26d8336-7d7d-4620-9552-da656315e348 | 2 | public static int GetOnCount(int value, int length){
String binary = DecimalToBinary(value, length);
char[] binaryChar = binary.toCharArray();
int count = 0;
for(int i = 0; i < binary.length(); i++){
if(binaryChar[i] == '1'){
//return count;
//}
count+... |
94115e33-12f5-4070-a7b4-7f4a7a8a9ca2 | 9 | public DbPlusTableInfoResult service(Map<String, String[]> paraMap, Map<String, String> config) {
if(null == paraMap) {
return null;
}
String tableName; // 目标表名
String[] tableNames = paraMap.get("tableName");
if(tableNames != null && tableNames.length > 0 && tableNames[0].trim().length() > 0){
tableName... |
60f2fbc8-03fa-4696-b6d4-a8ca95aa065a | 7 | public void CorrectPosition(Figur f, List<Figur> ObjectList){
correctx(f);
correcty(f);
if(ObjectList.size() > 1){
for(int i = 0; i < (ObjectList.size() - 1); i++){
boolean collision = collision(f, ObjectList.get(i));
if(collision){
//Änderung der x und y Koordinaten zum Entgehen einer Kollision b... |
b4567990-4206-4750-b6ab-8cc67f0fe24f | 8 | private Object doProperty(boolean toLHS, Object obj, CallStack callstack, Interpreter interpreter) throws EvalError {
publishLineNumber();
if (obj == Primitive.VOID)
throw new EvalError("Attempt to access property on undefined variable or class name", this, callstack);
if (obj instanceof Primitive)
throw n... |
212432bb-b64d-48c3-a314-d5b53d8b5593 | 6 | public static void main(String args[]){
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
... |
7756e58b-7ab0-4dec-ab71-fb85076cf0f6 | 5 | @EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
Action action = event.getAction();
if (event.getItem() == null)
return;
if (((action == Action.RIGHT_CLICK_BLOCK) || (action == Action.LEFT_CLICK_BLOCK)) &&
(event.getItem().getTypeId() == this.gm.boundsSetTool))
{
... |
0d89d955-d93b-4948-9baa-1d508203808f | 6 | @Override
@SuppressWarnings({"SleepWhileInLoop", "CallToThreadYield"})
public void run() {
long b, a, beforeTime, afterTime, timeDiff, sleepTime;
long overSleepTime = 0L;
int noDelays = 0;
long excess = 0L;
beforeTime = System.nanoTime();
isRunning = true;
... |
194b5600-0631-46c3-a378-ca727c2e280e | 8 | @Override
public void update(Document document) {
DefaultTableModel voModel = voValuePanel.model;
DefaultTableModel woModel = woValuePanel.model;
DefaultTableModel valueModel = valuePanel.model;
NodeList node = null;
NodeList items = null;
Element element = null;
voValuePanel.renderer.clear();
node = ... |
acf9b0a3-2cfd-44e7-8916-e2692a97b437 | 7 | public List<String> anagrams(String[] strs) {
if (strs == null || strs.length == 0)
return new ArrayList<>();
List<String> ret = new ArrayList<>();
Map<String, List<String>> mp = new HashMap<>();
for (String s : strs) {
char[] c = s.toCharArray();
Ar... |
8fd4a83e-7167-41f4-866f-a5ea2e75fcc1 | 4 | public void insert(V val,K k,W address) {
String[] v = k.toString().split("-");
String[] u = key.toString().split("-");
if (Integer.parseInt(u[1]) == Integer.parseInt(v[1])) {
value = val;
}
else if (Integer.parseInt(u[1])< Integer.parseInt(v[1])) {... |
f9e330b4-7773-42f4-9ef3-9942d3ea62bb | 8 | public synchronized void saveDataContent(HashMap<String,String> contentInfo, Integer counter) {
//Session session = HibernateUtil.getDataSessionFactory().openSession();
// System.out.println("inside saveDataContent");
StationWeatherWithTime swtObj = new StationWeatherWithTime();
... |
cf419e6f-8e06-46ae-a8c6-a88abf0e0031 | 1 | private void load(){
try{
BufferedImage img = ImageIO.read(new File(path));
width = img.getWidth();
height = img.getHeight();
pixels = new int[height * width];
img.getRGB(0, 0, width, height, pixels, 0, width);
}catch(IOException e){
e.printStackTrace();
}
} |
61135fe3-31f6-48df-8fd1-b014bfd85f8d | 9 | public static void main(String args[]){
Scanner leitor = new Scanner(System.in);
System.out.println("Informe a idade do nadador:");
int idade = leitor.nextInt();
if(idade >= 5 && idade <= 7){
System.out.println("Categoria: INFANTIL A");
}else
if(idade >= 8... |
4438e7ab-33a2-4115-a2e6-d719dad1b831 | 9 | public void removePlayer(Player player, LeaveReason reason)
{
if (this.players.contains(player.getUniqueId())) {
this.players.remove(player.getUniqueId());
}
loadInventory(player);
if(reason == LeaveReason.QUIT){
sendAll(ChatColor.RED + player.getName() + ChatColor.GRAY + "... |
4edbf1e2-ab0d-4f7b-addb-0809bc4445c5 | 6 | public boolean checkPoints(int points, char area){
switch (area){
case 'a': if(points<90) return false; break;
case 'b': if(points<110) return false; break;
case 'c': if(points<100) return false; break;
}
return true;
} |
89f364a7-a265-4817-b68f-dfcfb740a4d6 | 4 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
String message = "";
for (String data : arg1)
message += data + " ";
message = message.substring(0, message.length() ... |
856008d0-ae29-4933-acf1-71654a59a81f | 6 | public BagType getType() {
if (this.getClass() == Sandbag.class) return BagType.SANDBAG;
if (this.getClass() == GravelBag.class) return BagType.GRAVEL_BAG;
if (this.getClass() == CementBag.class) return BagType.CEMENT_BAG;
if (this.getClass() == WoodenDivider.class) return BagType.WOODEN... |
2104ce6a-992d-435f-a209-d411893385a6 | 6 | public void keyPressed(KeyEvent kE){
int key = kE.getKeyCode();
if(key == KeyEvent.VK_UP) Player.getInstance().move(0, -speed);
if(key == KeyEvent.VK_DOWN) Player.getInstance().move(0, speed);
if(key == KeyEvent.VK_RIGHT)Player.getInstance().move(speed, 0);
if(key == KeyEvent.VK_LEFT) Player.getInst... |
20423dc5-7b8c-47f9-951a-02d5e259ac49 | 0 | public void onTick(Instrument instrument, ITick tick) throws JFException {
// 各通貨ペアのティック情報を受信した際に呼ばれます。
// LOGGER.info("onTick");
} |
c3ce99f1-3003-4f38-b973-d8cfe0be8614 | 0 | public ArrayList viewPayment() {
ArrayList al = new ArrayList();
al = shsmb.viewMyBookingPayment();
return al;
} |
ff76fd78-c477-4ae1-98a4-b5be93bace32 | 6 | public static OPCode convertStringToOPCode(String line)
{
OPCode code = null;
switch (line)
{
case "RIGHT":
code = OPCode.RIGHT;
break;
case "LEFT":
code = OPCode.LEFT;
break;
case "UP":
code = OPCode.UP;
break;
case "DOWN":
code = OPCode.DOWN;
break;
case "JOINED":
... |
145be80d-877e-40d8-9cdc-ffa58efd3829 | 0 | public JComboBox<IntegrationMethods> getIntegrationMethodsComboBox() {
return integrationMethodsComboBox;
} |
e9e1b943-bdeb-4651-abc9-7b01af3a0169 | 3 | public static Property getProperty(Class clazz, String name) {
if (name.indexOf('.') != -1) {
String key = clazz.getName() + "#" + name;
Property property = propertiesCache.get(key);
if (property == null) {
property = new CompositeProperty(clazz, name);
... |
ed7c7afb-df05-4c31-9376-e43307ae122e | 2 | public static void main(String args[]){
System.out.println("Hello World!");
try{
loadFromFile();
}catch(Exception e){
System.out.println("Error Occured!");
}
roverChange();
try{
saveToFile();
}catch(Exception e){
}
} |
8c744edd-22b2-4fac-a4a8-7ea7e70f5b34 | 9 | public int maxPoints(Point[] points) {
if (points.length == 0) {
return 0;
}
Map<Double, Integer> slopeNumMap = new HashMap<Double, Integer>();
int result = 1;
int duplicate = 0;
int curMax = 1;
for (int i = 0; i < points.length; i++) {
curMax = 1;
duplicate = 0;
slopeNumMap.clear();
for (i... |
8b52a584-48b7-4cab-933d-60f0df3166b7 | 6 | public static void main(String args[]) {
/*
* Set the Nimbus look and feel
*/
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/*
* If Nimbus (introduced in Java SE 6) is not available, stay with the
* default look and fe... |
bc37a5ad-285e-484d-8a27-12d3ba7870f8 | 9 | protected void waitUntilRoute(String site_name, boolean present,
long timeout, long interval, JChannel ch) throws Exception {
RELAY2 relay=ch.getProtocolStack().findProtocol(RELAY2.class);
if(relay == null)
throw new IllegalArgumentException("Protocol RELAY2... |
413b7020-41d0-43d3-92a2-fd4f6baec0da | 6 | public boolean readField(aos.apib.InStream in, aos.apib.Base o,int i) {
if ( i > __field_names.length )
return getBaseClassStreamer().readField( in, o, i - __field_names.length - 1 );
AuthenticationResult v = (AuthenticationResult)o;
switch (i) {
case 0:
v.authentication = in.getBool();... |
3565a03e-dc79-463c-82b9-c45c36d792f6 | 6 | public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/loo... |
1eaadeab-6d32-45e7-8b71-529c8403ad09 | 4 | public String getDescription()
{
String label = getLabel();
String output = getOutput();
if(label == null || label.length() == 0)
label = Universe.curProfile.getEmptyString();
if(output == null || output.length() == 0)
output = Universe.curProfile.getEmptyStri... |
eee33546-375c-4e83-889c-34c4cc3761b9 | 7 | @Override //formatting lineItem for receipt
public String toString() {
NumberFormat fmt = NumberFormat.getCurrencyInstance();
String string = product.getProductId() + " " + product.getName();
StringBuilder s = new StringBuilder(string);
//formatting Name
for (int ... |
c069b9b4-40b4-4fab-83bf-32e0dc5a5deb | 0 | public int getPort() {
return this.port;
} |
5da371fa-8525-4dd9-9053-afe2acd79d05 | 2 | public ItemStack[] getEnderchestContents()
{
ItemStack[] stack = new ItemStack[Enderchest.length];
for (int i = 0; i < stack.length; i++)
{
if (Enderchest[i] != null)
stack[i] = Enderchest[i].clone();
}
return stack;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.