method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
abacdfd7-bfa1-4183-ab03-0856345569ab
2
@Override public int hashCode() { int result = key != null ? key.hashCode() : 0; result = 31 * result + (value != null ? value.hashCode() : 0); return result; }
5b24fc2f-0aa0-42fc-b710-a4a8520691ff
1
public void visit_istore(final Instruction inst) { stackHeight -= 1; if (stackHeight < minStackHeight) { minStackHeight = stackHeight; } }
3ca81e22-5609-4ee3-9623-76daccfa1d56
5
@Override public void handle(KeyEvent keyEvent) { KeyCode code = keyEvent.getCode(); if (keyEvent.isShortcutDown()) { if (code.getName().equals("P")) { BoardPage bp = new BoardPage("New page", 4, 4); pagesPane.getTabs().add(bp); } else if (code.getName().equals("C")) { commandLine.requestFocus(); } else if (code.ordinal() >= 25 && code.ordinal() <= 33) { pagesPane.getSelectionModel().select(code.ordinal() - 25); } } }
41327a7b-c5a7-48b8-8979-77c3f6468445
7
public void run() { String[] args = new String[2]; if (main.list.getSelectedValues().size() > 0) { if (main.list.getPictures().length != main.list.getSelectedValues().size()) { int response = JOptionPane.showConfirmDialog(main.list, main.mes.getString("Generator.23"), main.mes.getString("Generator.24"), JOptionPane.YES_NO_CANCEL_OPTION); switch (response) { case JOptionPane.YES_OPTION: Vector<File> vf = main.list.getSelectedValues(); files = new File[vf.size()]; for (int i = 0; i < files.length; i++) { files[i] = vf.get(i); } break; // generate only the selected images case JOptionPane.NO_OPTION: files = main.list.getPictures(); break; // generate the whole directory case JOptionPane.CANCEL_OPTION: return; // do nothing case JOptionPane.CLOSED_OPTION: return; // do nothing } } args[0] = files[0].getPath(); args[1] = Options.getInstance().getOutput_dir() + "\\" + files[0].getName(); PluginUI.main(args); } else { JOptionPane.showMessageDialog(new JFrame(), "Bitte zuerst ein oder mehrere Bilder wählen"); } }
123b24a0-3253-408f-832c-752367d7bf2e
4
@Override public void deserialize(Buffer buf) { livingUID = buf.readInt(); if (livingUID < 0) throw new RuntimeException("Forbidden value on livingUID = " + livingUID + ", it doesn't respect the following condition : livingUID < 0"); livingPosition = buf.readUByte(); if (livingPosition < 0 || livingPosition > 255) throw new RuntimeException("Forbidden value on livingPosition = " + livingPosition + ", it doesn't respect the following condition : livingPosition < 0 || livingPosition > 255"); skinId = buf.readInt(); if (skinId < 0) throw new RuntimeException("Forbidden value on skinId = " + skinId + ", it doesn't respect the following condition : skinId < 0"); }
e98eb358-d0b5-4216-95fb-797f7b1519a8
9
@Override public SymbolInfo Execute(RuntimeContext cont) throws Exception { SymbolInfo m_cond = cond.Evaluate(cont); if ((m_cond == null) || (m_cond.Type != TypeInfo.TYPE_BOOL)) { return null; } SymbolInfo ret = null; if (m_cond.BoolValue == true) { for (Object s : _ifStatementsList) { Statement statement = (Statement) s; ret=statement.Execute(cont); if(ret!=null){ return ret; } } } if((m_cond.BoolValue == false)&& (_elseStatementsList != null)){ for (Object s : _elseStatementsList) { Statement statement = (Statement) s; ret=statement.Execute(cont); if(ret!=null){ return ret; } } } return null; }
59c94b2a-439b-47f8-ae8f-729743a062ac
8
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output,Reporter reporter) throws IOException { String line = value.toString(); String[] words = line.split(","); int flag = 0, i = 0; for(i=0;i<MAX_RULE && flag==0;i++) { flag = 1; for(int j=0;j<rule[i].length && flag==1;j++) { if(words[rule[i].num[j]].equals(rule[i].val[j])) flag = 1; else flag = 0; } } if(flag == 1) { if(words[0].equals(rule[i-1].class_name)) { word.set("rpos"+(i-1)); output.collect(word, one); word.set("pos"); output.collect(word, one); } else { word.set("rneg"+(i-1)); output.collect(word, one); word.set("neg"); output.collect(word, one); } } else { if(words[0].equals("e")) { word.set("pos"); output.collect(word, one); } else { word.set("neg"); output.collect(word, one); } } }
486b28e8-2d8c-4129-bb91-2119661bcca3
9
public boolean processEvent(Sim_event ev){ int src_id = -1; Message msg = null; Message respMsg = null; if (responder == null){ System.out.println("No responder to deal with auction messages!"); return false; } switch ( ev.get_tag() ){ case AuctionTags.AUCTION_INFORM_START: msg = (Message)ev.get_data(); src_id = msg.getSourceID(); synchronized(syncSteps){ respMsg = responder.onReceiveStartAuction((MessageInformStart)msg); } break; case AuctionTags.AUCTION_CFP: msg = (Message)ev.get_data(); src_id = msg.getSourceID(); synchronized(syncSteps){ respMsg = responder.onReceiveCfb((MessageCallForBids)msg); } break; case AuctionTags.AUCTION_INFORM_OUTCOME: msg = (Message)ev.get_data(); src_id = msg.getSourceID(); synchronized(syncSteps){ respMsg = responder.onReceiveInformOutcome((MessageInformOutcome)msg); } break; case AuctionTags.AUCTION_REJECT_PROPOSAL: msg = (Message)ev.get_data(); src_id = msg.getSourceID(); synchronized(syncSteps){ respMsg = responder.onReceiveRejectProposal((MessageRejectBid)msg); } break; // other unknown tags are processed by this method default: return false; } if(respMsg!=null){ respMsg.setDestinationID(src_id); int tag = - 1; if(respMsg instanceof MessageBid){ tag = AuctionTags.AUCTION_PROPOSE; ((MessageBid)respMsg).setBidder(this.bidderID); } else if(respMsg instanceof MessageRejectCallForBid){ tag = AuctionTags.AUCTION_REJECT_CALL_FOR_BID; ((MessageRejectCallForBid)respMsg).setBidder(this.bidderID); } double scheduleAt = (respMsg.getScheduleTime() > 0.0) ? respMsg.getScheduleTime() : GridSimTags.SCHEDULE_NOW; super.sim_schedule(this.outputPort, scheduleAt, tag, new IO_data(respMsg, 100, src_id)); } return true; }
231e4f70-8ecc-424a-acea-d8476f48c457
7
void createResidueHydrogenBond(int indexAminoGroup, int indexCarbonylGroup, BitSet bsA, BitSet bsB) { short order; int aminoBackboneHbondOffset = indexAminoGroup - indexCarbonylGroup; if (debugHbonds) Logger.debug("aminoBackboneHbondOffset=" + aminoBackboneHbondOffset + " amino:" + monomers[indexAminoGroup].getSeqcodeString() + " carbonyl:" + monomers[indexCarbonylGroup].getSeqcodeString()); switch (aminoBackboneHbondOffset) { case 2: order = JmolConstants.BOND_H_PLUS_2; break; case 3: order = JmolConstants.BOND_H_PLUS_3; break; case 4: order = JmolConstants.BOND_H_PLUS_4; break; case 5: order = JmolConstants.BOND_H_PLUS_5; break; case -3: order = JmolConstants.BOND_H_MINUS_3; break; case -4: order = JmolConstants.BOND_H_MINUS_4; break; default: order = JmolConstants.BOND_H_REGULAR; } AminoMonomer donor = (AminoMonomer)monomers[indexAminoGroup]; Atom nitrogen = donor.getNitrogenAtom(); AminoMonomer recipient = (AminoMonomer)monomers[indexCarbonylGroup]; Atom oxygen = recipient.getCarbonylOxygenAtom(); model.mmset.frame.addHydrogenBond(nitrogen, oxygen, order, bsA, bsB); }
af72f6f7-6120-4e39-868e-4c64f409248c
2
private void add_to_list(String ch) { for (int i = 0; i < mylist.size(); i++) { if (ch.equals(((data) mylist.get(i)).getChar())) { ((data) mylist.get(i)).increment(); return; } } mylist.add(new data(ch)); }
4fd07d19-6508-4fd0-bf60-6a90a5af64fa
4
public String getLocalTime(){ try { in=new BufferedReader(new FileReader(new File("hosts"))); String line; while((line=in.readLine())!=null){ if(line.contains(TIMEMARKLOCAL)){ localtime=line.substring(TIMEMARKLOCAL.length()+1); localtime=localtime.substring(0,localtime.indexOf(' ')); } } return localtime; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return ""; }
3498cb93-10e7-4625-964f-00e8d258dfed
7
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Venda other = (Venda) obj; if (this.codigo != other.codigo) { return false; } if (!Objects.equals(this.data, other.data)) { return false; } if (Double.doubleToLongBits(this.valorTotal) != Double.doubleToLongBits(other.valorTotal)) { return false; } if (!Objects.equals(this.itemVendas, other.itemVendas)) { return false; } if (!Objects.equals(this.pessoa, other.pessoa)) { return false; } return true; }
f50d5856-f103-4c3c-8b9a-de8d6893222b
9
private byte filterPLO(int i, int i2, int i3) { int res = 0; if ( i > 0 && i2 > 0 && i2 < biHeight - 1) { int l = getIntVal(i - 1, i2 + 1, i3); int d = getIntVal(i, i2 - 1, i3); int ld = getIntVal(i - 1, i2, i3); if (ld >= l && ld >= d) { if (l > d) { res = d; } else { res = l; } } else if (ld <= l && ld <= d) { if (l > d) { res = l; } else { res = d; } } else { res = d + l - ld; } } else { res = filterPL(i, i2, i3); } return (byte)res; }
3fc991b5-215f-402c-923a-290179170cdb
6
private List<Class<?>> getAllClassesFromClass(Class<?> cl) { List<Class<?>> list = new ArrayList<Class<?>>(); list.add(cl); if(cl.getSuperclass() != null && cl.getSuperclass().getPackage().getName().startsWith("com.paynova.api.client")) { list.addAll(getAllClassesFromClass(cl.getSuperclass())); } return list; }
7b991941-e5ed-490a-b758-d2545d8179d2
8
public static void main(String[] args) { // TODO code application logic here final JFrame frame = new JFrame("ImgPanel Test Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); SetupDialog setupDialog = new SetupDialog(frame); System.out.println("setupDialog filename " + setupDialog.getFileName()); // this is just a nominal pixel size for fake images int dim[] = { 1024, 768 }; switch (setupDialog.getPixels()) { case ACTUAL: break; case X4: dim[0] *= 4; dim[1] *= 4; break; case X16: dim[0] *= 16; dim[1] *= 16; break; case MP50: dim = new int[] { 7 * 1024, 7 * 1024 }; break; case MP100: dim = new int[] { 10 * 1024 , 10 * 1024 }; break; case MP500: dim = new int[] { 23 * 1024, 23 * 1024 }; break; case GP1: dim = new int[] { 32 * 1024, 32 * 1024 }; break; case GP4: dim = new int[] { 64 * 1024, 64 * 1024 }; break; } //TODO setting up the zoom viewer, could happen elsewhere //TODO the cache should be shared TileCache tileCache = new TileCache(setupDialog.getCacheSize()); //TODO need factory that projects ImgLib images ITileFactory factory = new MyTileFactory(new File(setupDialog.getFileName())); ZoomTileServer zoomTileServer = new ZoomTileServer(); zoomTileServer.init(tileCache, factory, dim); final ImgZoomPanel imgZoomPanel = new ImgZoomPanel(zoomTileServer); frame.setContentPane(imgZoomPanel); frame.pack(); center(frame); frame.setVisible(true); }
2699e58f-b397-492b-a20b-e3f2f81403f2
9
public boolean spawnPet(int itemId, boolean deleteItem) { Pets pets = Pets.forId(itemId); if (pets == null) { return false; } if (player.getPet() != null || player.getFamiliar() != null) { player.getPackets().sendGameMessage("You already have a follower."); return true; } if (!hasRequirements(pets)) { return true; } int baseItemId = pets.getBabyItemId(); PetDetails details = petDetails.get(baseItemId); if (details == null) { details = new PetDetails(pets.getGrowthRate() == 0.0 ? 100.0 : 0.0); petDetails.put(baseItemId, details); } int id = pets.getItemId(details.getStage()); if (itemId != id) { player.getPackets().sendGameMessage("This is not the right pet, grow the pet correctly."); return true; } int npcId = pets.getNpcId(details.getStage()); if (npcId > 0) { Pet pet = new Pet(npcId, itemId, player, player, details); this.npcId = npcId; this.itemId = itemId; pet.setGrowthRate(pets.getGrowthRate()); player.setPet(pet); if (deleteItem) { player.setNextAnimation(new Animation(827)); player.getInventory().deleteItem(itemId, 1); } return true; } return true; }
6cb9c551-1344-459a-9641-4b4991579aab
8
public static RankType parseRanking(String rankInput) { rankInput = rankInput.toLowerCase(); switch (rankInput) { case "high": case "hi": case "h": return RankType.HI; case "medium": case "med": case "m": return RankType.MED; case "low": case "l": return RankType.LO; default: return RankType.NULL; } }
b829f4f6-47ae-4c4e-bd25-aeb5fa006057
6
public static void main(String[] args) { ObjectInputStream entrada=null; ObjectOutputStream salida=null; try{ System.out.println("Iniciando Servidor..."); ServerSocket elSocket= new ServerSocket(6666); System.out.println("Escuchando en el puerto 6666"); cliente=elSocket.accept(); System.out.println("Cliente conectado "+cliente.getInetAddress().getHostAddress()); entrada=new ObjectInputStream(cliente.getInputStream()); salida=new ObjectOutputStream(cliente.getOutputStream()); System.out.println("Streams Correctos!"); String cmd="NEL",yes="Recibido"; Object in=entrada.readObject(); do{ //System.out.println(in.toString()); if(in instanceof String){ cmd=(String)in; System.out.println("Comando: "+cmd); salida.writeObject(yes); } else{ try{ File archivo= new File("Recibido.txt"); FileOutputStream fos= new FileOutputStream(archivo); fos.write((byte[])in); System.out.println((byte[])in); //archivo.renameTo((File)in); System.out.println("Archivo Recibido\n"+archivo.getAbsolutePath()+" - "+archivo.length()); }catch(EOFException ee){} cmd="NEL"; } in=entrada.readObject(); }while(cmd!=null&&!cmd.equalsIgnoreCase("NEL")); }catch(EOFException ee){ }catch(Exception e){ System.out.println("Error!! "+e); e.printStackTrace(); } System.out.println("Sesion Terminada"); // // salida.close(); // entrada.close(); // elSocket.close(); }
5a33884b-8099-40df-be22-6ba1886d9581
6
public boolean updateGameBoxscore(Sport sport, String scheduleID) { if (scheduleID==null) return false; String request = null; switch(sport) { case NBA: case NHL: request = "http://api.sportsdatallc.org/" + sport.getName() + "-" + access_level + sport.getVersion() + "/games/" + scheduleID + "/boxscore.xml?api_key=" + sport.getKey(); Element element = send(request); int home_score = -1, away_score = -1; try { Node node = null; NodeList teamNodes = element.getElementsByTagName("team"); for (int j=0;j<teamNodes.getLength();j++) { NamedNodeMap nodeMapTeamAttributes = teamNodes.item(j).getAttributes(); node = nodeMapTeamAttributes.getNamedItem("points"); if (j==0) { home_score = Integer.parseInt(node.getNodeValue()); } else { away_score = Integer.parseInt(node.getNodeValue()); } } ResultScoreModel result = new ResultScoreModel(scheduleID, home_score, away_score); DataStore.storeResult(result); DataStore.updateSchedule(scheduleID, result); } catch (Exception e) { System.out.println("@ erreur lors du parcours du fichier xml dans getGameBoxscore()"); return false; } break; // à compléter si besoin default: break; } return true; }
9d5dad7a-883f-48ff-9824-3cab3ed49299
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()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Main.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new Main().setVisible(true); } }); }
ce2879d8-3a7b-4bc4-bab1-6b058c80e187
3
public void copyDirectory(File srcDir, File dstDir) throws IOException { if (srcDir.isDirectory()) { if (!dstDir.exists()) { dstDir.mkdir(); } String[] children = srcDir.list(); for (int i=0; i<children.length; i++) { copyDirectory(new File(srcDir, children[i]), new File(dstDir, children[i])); } } else { copy(srcDir, dstDir); } }
437c15cb-edf0-4db1-8e43-192075bba14c
0
private FileUtils() { }
89eadade-510d-491b-a932-7f033ef8a934
3
public Class<?> genericsType(Class<?> superClazz) { if (genericsTypes(superClazz).length == 0) { return Object.class; } return genericsTypes(superClazz)[0]; }
854f305f-5e4f-412a-8345-236246dbc1d9
2
public static String[] allLowerCase(String... strings){ String[] tmp = new String[strings.length]; for(int idx=0;idx<strings.length;idx++){ if(strings[idx] != null){ tmp[idx] = strings[idx].toLowerCase(); } } return tmp; }
ce249690-4e9a-4b23-b2aa-1ffca9332f23
2
@Override protected Duration available() { Interval outer = new Interval(period.getEnd().minusWeeks(1), period.getEnd()); Duration aDay = new Duration(24 * hoursToMillis); int overtime = intervals.countDurationInterval(outer, aDay, max); Duration dayMax; if (overtime < 2) { dayMax = Drive.OVERTIME.getValue(); } else { dayMax = max; } if (driving.isShorterThan(dayMax)) { return dayMax.minus(driving); } else { return new Duration(0); } }
2a28a631-2c51-44d8-b9f9-f128801a0bdf
4
private void CreateRoot() { DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docBuilder; File b = new File(XMLParser.path + "/root.xml"); if (b.exists()) return; try { docBuilder = docFactory.newDocumentBuilder(); // root elements Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("databases"); doc.appendChild(rootElement); rootElement.setAttribute("name", "root"); TransformerFactory transformerFactory = TransformerFactory .newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(b); // Output to console for testing // StreamResult result = new StreamResult(System.out); transformer.transform(source, result); } catch (ParserConfigurationException e) { JOptionPane.showMessageDialog(null, "Root Not Created"); } catch (TransformerConfigurationException e) { JOptionPane.showMessageDialog(null, "Root Not Created"); } catch (Exception e) { JOptionPane.showMessageDialog(null, "Root Not Created"); } }
cb233fb4-7354-45b4-aa34-e75bc5b417cf
3
public static void main(String args[]){ int cnt = 0; Random rand = new Random(); while(cnt < 25){ int a = rand.nextInt(56); if(cnt == 0){ randlist[cnt] = a; cnt++; } else{ if(isExist(a, cnt)){ randlist[cnt] = a; cnt++; } } } printContent(); }
fd02ace2-340a-4556-828a-e1405d5d8096
1
public boolean isCurrent() { DockContainer dc = getDockContainer(); return dc != null && dc.getCurrentDockable() == mDockable; }
8d15713a-cb5f-4746-af80-c0adbea6a23c
4
public static boolean isWhitespace(int c){ return c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r'; }
9c95fc56-7f98-4d62-92de-7fafe0296531
6
public boolean validCellRef(String cellRef) { boolean valid = false; String numbers = "0123456789"; String letters = "ABCDEFGH"; if(cellRef.length() == 2) { if(letters.indexOf(cellRef.substring(0, 1)) >= 0) { if(numbers.indexOf(cellRef.substring(1, 2)) >= 0) { valid = true; } } } else if(cellRef.length() == 3 && cellRef.substring(1).equals("10")) { if(letters.indexOf(cellRef.substring(0, 1)) >= 0) { valid = true; } } return valid; }
3393ca9c-7eec-40eb-8525-884bfb90001c
7
public void append(Object parameter) { if(parameter == null) return; if(parameter instanceof byte[]) { byte byteArrarParameter[] = (byte[])parameter; for(int i = 0; i < byteArrarParameter.length; i++) { buffer[++dataSize] = byteArrarParameter[i]; size++; } } else if(parameter instanceof Number) { buffer[++dataSize] = ((Number)parameter).byteValue(); size++; } else if(parameter instanceof ByteEnum) { buffer[++dataSize] = ((ByteEnum)parameter).getByteValue(); size++; } else if(parameter instanceof Boolean) { buffer[++dataSize] = ((Boolean)parameter).booleanValue() ? (byte)0xFF : (byte)0x00; size++; } }
6758f381-8a2f-4812-b030-dc6c90a33127
4
public synchronized static void updateTaskCompleted(String taskID, String recipientID) { XStream xstream = new XStream(new DomDriver()); Task[] allTasks = new Task[0]; try { File file = new File((String) Server.prop.get("taskFilePath")); allTasks = (Task[]) xstream.fromXML(file); for (Task task : allTasks) { if (task.getId().equals(taskID)) { if (task.getRecipient().getId().equals(recipientID)) { task.getRecipient().setDidReply(true); FileOutputStream fos = new FileOutputStream(file); xstream.toXML(allTasks, fos); fos.close(); } } } } catch (Exception e) { } }
2723637c-5922-416b-a843-428fd65f6914
2
@Override public boolean onCommand(CommandSender sender, org.bukkit.command.Command cmd, String[] args) { Player p = (Player) sender; String pName = p.getName(); if(args.length != 0) return false; if(PlayerChat.plugin.getConfig().getBoolean("ModChat.Enabled", true)) { ModChat.putModChat(p, pName); return true; } else { Messenger.tell(p, Msg.MOD_CHAT_DISABLED); return true; } }
80e8dfb5-bfd4-4df1-979a-330ea555c766
7
public void RenderTile(int xp, int yp, Tile tile) { xp -= xOffset; yp -= yOffset; for (int y = 0; y < tile.sprite.SIZE; y++) { int ya = y + yp; for (int x = 0; x < tile.sprite.SIZE; x++) { int xa = x + xp; if (xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break; if (xa < 0) xa = 0; pixels[xa + ya * width] = tile.sprite.pixels[x + y * tile.sprite.SIZE]; } } }
38b87d26-2265-4dc8-af3a-dc513b4db82a
7
public final boolean isNumericType() { switch (id) { case TypeIds.T_int: case TypeIds.T_float: case TypeIds.T_double: case TypeIds.T_short: case TypeIds.T_byte: case TypeIds.T_long: case TypeIds.T_char: return true; default: return false; } }
81367b6a-74ff-480f-b204-c4ef663c0658
8
@Override public void caseAClassdecl(AClassdecl node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(ClassDeclSimpe"); inAClassdecl(node); if(node.getClasstag() != null) { node.getClasstag().apply(this); } if(node.getIdentifier() != null) { node.getIdentifier().apply(this); } if(node.getLM() != null) { node.getLM().apply(this); } { List<PVardecl> copy = new ArrayList<PVardecl>(node.getVardecl()); for(PVardecl e : copy) { e.apply(this); } } { List<PMethoddecl> copy = new ArrayList<PMethoddecl>(node.getMethoddecl()); for(PMethoddecl e : copy) { e.apply(this); } } if(node.getRM() != null) { node.getRM().apply(this); } outAClassdecl(node); indent--; for(int i=0;i<indent;i++) System.out.print(" "); System.out.println(")"); }
89f31848-38aa-470d-bb99-df765052413d
0
public void setKing(Position position, boolean color){ board[position.getY()][position.getX()]= new King(color); }
19fdb453-0607-4df4-9e1e-e0ffdbd8c296
1
public byte[] readCluster(int clusterNum) { byte[] bytesOfCluster = new byte[BPB_BytsPerSec]; int firstByteOfCluster = (clusterNum + firstDataSector - 2) * BPB_BytsPerSec; for (int i = firstByteOfCluster; i < firstByteOfCluster + BPB_BytsPerSec; i++) { bytesOfCluster[i-firstByteOfCluster] = imageBytes[i]; } return bytesOfCluster; }
e1408eae-978e-42af-8117-70b6dae1c680
1
public void testConstructor_ObjectStringEx4() throws Throwable { try { new YearMonth("10:20:30.040+14:00"); fail(); } catch (IllegalArgumentException ex) { // expected } }
03f645fc-def6-4bdc-9f6c-9c4eff845859
1
public MidiPlayer() { try { sequencer = MidiSystem.getSequencer(); sequencer.open(); sequencer.addMetaEventListener(this); } catch ( MidiUnavailableException ex) { sequencer = null; } }
0ed67375-b3f0-48ee-8d22-9eeccb5ef25d
7
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof XYBoxAndWhiskerRenderer)) { return false; } if (!super.equals(obj)) { return false; } XYBoxAndWhiskerRenderer that = (XYBoxAndWhiskerRenderer) obj; if (this.boxWidth != that.getBoxWidth()) { return false; } if (!PaintUtilities.equal(this.boxPaint, that.boxPaint)) { return false; } if (!PaintUtilities.equal(this.artifactPaint, that.artifactPaint)) { return false; } if (this.fillBox != that.fillBox) { return false; } return true; }
3ff7e9f0-b907-43c5-b5a0-9774f4b35d2d
6
public static void printTypes(Type[] types, String pre, String sep, String suf, boolean isDefinition) { if (pre.equals(" extends ") && Arrays.equals(types, new Type[] { Object.class })) { return; } if (types.length > 0) { System.out.print(pre); } for (int i = 0; i < types.length; i++) { if (i > 0) { System.out.print(sep); } printType(types[i], isDefinition); } if (types.length > 0) { System.out.print(suf); } }
70fec094-6b71-4f75-9b8e-773eac67adfd
7
public List<List<Rate>> getAllGameCombinationWithSure() { if (sourceGameList == null || sourceGameList.size() == 0) { return null; } Game gameSureGame = null; for (Game game : sourceGameList) { if (game.isSure()) { gameSureGame = game; System.out.println("breaking"); break; } System.out.println("next"); } sourceGameList.remove(gameSureGame); clear(); initChoiceCombinationAndChoices(); computeChoiceCombinationIndexSet(); List<List<Rate>> tempResult = getAllGameCombination(); if (tempResult == null) { return tempResult; } // 加上胆的赔率数据 for (List<Rate> rateList : tempResult) { for (Rate rate : gameSureGame.getRateList()) { rateList.add(rate); } } return tempResult; }
d4c42610-c5ed-4df1-94af-e70511bff016
5
private void callSmoothZoom(double mouseX, double mouseY, int wheelRotation) { final double coordX = mouseX; final double coordY = mouseY; if (wheelRotation < 0) { if (timerDoneOut != 0) { timerDoneOut = 0; timer.cancel(); timer.purge(); timer = new Timer(); } timerDoneIn = 0; TimerTask task = new TimerTask() { @Override public void run() { timerDoneIn += 0.05; drawMapComponent.zoomIn(coordX, coordY); callRepaint(); if (timerDoneIn >= 1.2) { timer.cancel(); timerDoneIn = 0; timer.purge(); timer = new Timer(); } } }; timer.scheduleAtFixedRate(task, 10, 10); } else { if (timerDoneIn != 0) { timerDoneIn = 0; timer.cancel(); timer.purge(); timer = new Timer(); } timerDoneOut = 0; TimerTask task = new TimerTask() { @Override public void run() { timerDoneOut += 0.05; drawMapComponent.zoomOut(coordX, coordY); callRepaint(); if (timerDoneOut >= 1.2) { timer.cancel(); timerDoneOut = 0; timer.purge(); timer = new Timer(); } } }; timer.scheduleAtFixedRate(task, 10, 10); } repaint(); }
b93d2317-5400-4d88-bf8c-7cb20357ae54
3
public ModelingEngine(Library library, Scheme scheme, SignalBundle signals, String diagrams, String logs) throws ModelingException { if(library == null) { throw new ModelingException(0x11); } else { this.library = library; } if(scheme == null) { throw new ModelingException(0x12); } else { this.scheme = scheme; } if(signals == null) { throw new ModelingException(0x13); } else { this.signals = signals; } this.diagrams = diagrams; this.logs = logs; }
620b7c2a-2419-45d6-9a7a-60951cf5cf10
8
private String handleCreate(String cmd) { String[] arg = cmd.split("\\s+"); if (arg.length == 1) { return " usage: new [param | dim | array]\n"; } if (arg[1].startsWith("p")) { // create param if (arg.length < 3) { return " usage: new param <name>...\n"; } for (int i = 2; i < arg.length; i++) { p.put(arg[i], ""); } } else if (arg[1].startsWith("d")) { // create dim if (arg.length != 3) { return " usage: new dim <name>\n"; } String name = arg[2]; p.put(name, ""); p.getInfo(name).put("role", "dimension"); } else if (arg[1].startsWith("a")) { // create array if (arg.length < 4) { return " usage: new array <name> <dim>\n"; } String name = arg[2]; p.put(name, ""); p.getInfo(name).put("bound", arg[3]); } else { return " usage: new [param | dim | array]\n"; } ((AbstractTableModel) table.getModel()).fireTableDataChanged(); sp.repaint(); return ""; }
349d270e-6045-4b6d-94d5-bd2c784d810e
2
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int hundredth = (orientation == SwingConstants.VERTICAL ? getParent().getHeight() : getParent().getWidth()) / 100; return (hundredth == 0 ? 1 : hundredth); }
f886b420-83fe-4f56-84ff-6fabe3d74a13
9
public String splitIndex(String s){ String x[]=s.split(","); String title=""; for(int i=0;i<x.length;i++){ //finding index of name and address if(x[i].contains("name")){ name_index=i; } if(x[i].contains("address")){ address_index=i; } } int j; for(j=0;j<name_index;j++){ title+=x[j]+","; } title+="\"first name\",\"last name\","; for(j=name_index+1;j<address_index;j++){ title+=x[j]+","; } title+="\"address line 1\",\"address line 2\",\"city\",\"pincode\""; if(j==x.length-1) { title+=";"; } else { title+=","; } if(x.length-1!=address_index){ for(j=address_index+1;j<x.length-1;j++){ title+=x[j]+","; //System.out.println("dd"); } if(j==x.length-1) { title+=x[j]; } } return title; }
10ca2045-af3a-4109-8d30-733b2590fe9d
9
public static void main (String argv[]) { // create scanner that reads from standard input Scanner scanner = new Scanner(System.in); if (argv.length > 2) { System.err.println("Usage: java Main " + "[-d]"); System.exit(1); } // if commandline option -d is provided, debug the scanner if (argv.length == 1 && argv[0].equals("-d")) { // debug scanner Token tok = scanner.getNextToken(); while (tok != null) { int tt = tok.getType(); System.out.print(TokenName[tt]); if (tt == Token.INT) System.out.println(", intVal = " + tok.getIntVal()); else if (tt == Token.STRING) System.out.println(", strVal = " + tok.getStrVal()); else if (tt == Token.IDENT) System.out.println(", name = " + tok.getName()); else System.out.println(); tok = scanner.getNextToken(); } } System.out.print("CSC 4101 Scheme> "); // Create parser Parser parser = new Parser(scanner); Interpreter interpreter= new Interpreter(); Node root; // Parse and pretty-print each input expression root = parser.parseExp(); while (root != null) { Node result = interpreter.eval(root); if (result != null) result.interprinter(); System.out.println(); System.out.print("> "); root = parser.parseExp(); } System.exit(0); }
e1ec6f28-e467-4ebd-a585-246298567c20
6
public Inicio() { //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(Inicio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> initComponents(); setLocationRelativeTo(null); setExtendedState(Inicio.MAXIMIZED_BOTH); }
d8224638-668c-42f2-91c7-e49204bc9124
9
public String getMessage() { if (!specialConstructor) { return super.getMessage(); } String expected = ""; int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < expectedTokenSequences[i].length) { maxSize = expectedTokenSequences[i].length; } for (int j = 0; j < expectedTokenSequences[i].length; j++) { expected += tokenImage[expectedTokenSequences[i][j]] + ' '; } if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) { expected += "..."; } expected += eol + " "; } String retval = "Encountered \""; Token tok = ((Token)currentToken).next; Token next = tok; for (int i = 0; i < maxSize; i++) { if (i != 0) retval += " "; if (tok.kind == 0) { retval += tokenImage[0]; break; } retval += add_escapes(tok.image); tok = tok.next; } retval += "\" at line " + next.beginLine + ", column " + next.beginColumn; retval += '.' + eol; if (expectedTokenSequences.length == 1) { retval += "Was expecting:" + eol + " "; } else { retval += "Was expecting one of:" + eol + " "; } retval += expected; return retval; }
b4712b45-ffc4-404f-96b4-6cd5ea44a7f9
7
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D) g; if(snakeGame.isStarted()) { if(snakeGame.isPause()) { drawPauseMenu(g2); } else if(snakeGame.isPause() == false) { drawCurrentGame(g2); } } else if(snakeGame.isFinishedBlink1()){ drawBlinkAnimation1(g2); } else if(snakeGame.isFinishedBlink2()) { drawBlinkAnimation2(g2); } else if(snakeGame.isFinished()) { drawGameOver(g2); } else if(snakeGame.isStartmenu()) { drawStartMenu(g2); } }
9d39edc3-c0d6-4a19-8793-1a6de7dd960c
2
public static BigDecimal String2BigDecimal(String str) { BigDecimal bigDecimal = null; if (str != null && str.trim().length() != 0) { bigDecimal = new BigDecimal(str); } return bigDecimal; }
3749ec04-0efb-40f8-b817-71465dd351d5
4
public static void order() { int[] array={3,2,4,1,5,7,6,8,9}; int length=array.length; for (int i = 0; i < length-1; i++) { for(int j=0;j<i;j++) { if(array[j+1]<array[j]) { int temp=array[j]; array[j]=array[j+1]; array[j+1]=temp; } } } for (int i = 0; i < array.length; i++) { System.out.print(array[i]); } }
2a2a6d3a-5a75-4549-9320-0032a8b4bd2f
5
private void playerChecker() { CollisionResults results = new CollisionResults(); Vector3f ppos = playerData.getPosition(); Vector3f pdir = playerData.getDirection(); Ray ray = new Ray(ppos, pdir); rootNode.collideWith(ray, results); for (int i = 0; i < results.size(); i++) { float dist = results.getCollision(i).getDistance(); if (dist < 2) { Geometry target = results.getClosestCollision().getGeometry(); if (target.getName().equals("Beam") || target.getName().equals("warzone") || target.getName().equals("shipA_OBJ-geom-0")) { break; } System.out.println(target); playerData.setPosition(new Vector3f(0, 0, 0)); } } }
39473a40-a213-4651-b26b-af2063b5eb68
9
public static boolean isValid(ArrayList<Binding> bindings) { WebServer.logDebug("Called isValid with " + bindings.toString()); HashMap<String, Integer> CompletelyReservedPorts = new HashMap<String, Integer>(); for (int i = 0; i < bindings.size(); i++) { if (bindings.get(i).domain.equals("*")) { for (int k = 0; k < i; k++) { if (bindings.get(i).protocol.equals(bindings.get(k).protocol) && bindings.get(i).port == bindings.get(k).port) { WebServer.triggerInternalError("Duplicate Bindings found: " + bindings.get(i).protocol + "://" + bindings.get(i).domain + ":" + bindings.get(i).port + " and " + bindings.get(k).protocol + "://" + bindings.get(k).domain + ":" + bindings.get(k).port); return false; } } CompletelyReservedPorts.put(bindings.get(i).protocol, bindings.get(i).port); } for (int j = i + 1; j < bindings.size(); j++) { if (bindings.get(i).protocol.equals(bindings.get(j).protocol) && bindings.get(i).domain.equals(bindings.get(j).domain) && bindings.get(i).port == bindings.get(j).port) { WebServer.triggerInternalError("Duplicate Bindings found: " + bindings.get(i).protocol + "://" + bindings.get(i).domain + ":" + bindings.get(i).port + " and " + bindings.get(j).protocol + "://" + bindings.get(j).domain + ":" + bindings.get(j).port); return false; } } } return true; }
72dd1a71-7d14-4511-ab79-4d11e752648c
2
private static void create() throws Exception { Gui.progressBar.setValue(85); FileWriter fileWriter = new FileWriter(newFile); BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); for (int i = 1; i < 141; ++i) { bufferedWriter.write(ConfigTextFilter.splitString[i]); bufferedWriter.newLine(); } bufferedWriter.close(); Gui.progressBar.setValue(100); System.out.println("File Written to " + newFile); JOptionPane.showMessageDialog(null, "Done!", null, JOptionPane.INFORMATION_MESSAGE); if (JOptionPane.OK_OPTION == 1); { Gui.progressBar.setVisible(false); } }
36df0847-8c59-4928-a41a-2ee547a0b16a
8
protected void ressource(){ // s'il n'y a plus d'arbre sur le terrain alors j'en refait ! if (this.nb_arbre < this.nb_arbre_min){ Random r = new Random(); int valeur ; int valeur2 ; for (int i = 0 ; i < this.nb_arbre_max ; i++){ valeur = r.nextInt(this.longueur); valeur2 = r.nextInt(this.largeur); if (this.carte[valeur][valeur2].objet == null){ this.carte[valeur][valeur2].add(new Bois(getCellule(valeur, valeur2))); this.nb_arbre++; } } } if (this.forum.length != 1){ int cpt = 0; for (int i = 0 ; i<this.forum.length ; i++){ if (this.forum[i].perdu){ cpt++; } } if (cpt == this.forum.length-1){ try { this.game.stop(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println("Nous avons un gagnant !"); } } }
9f780aa3-9917-4923-ab66-103b37d19091
2
public static void main(String[] args) { int i; float inputs06[] = { 20, 22, 21, 24, 24, 23, 25, 26, 20, 24, 26, 26, 25, 27, 28, 27, 29, 27, 25, 24 }; float inputs10[] = { 20, 22, 24, 25, 23, 26, 28, 26, 29, 27, 28, 30, 27, 29, 28 }; MovingAverageQueue movingAverage; System.out.println("Moving Average length 6:"); movingAverage = new MovingAverageQueue(6); for (i = 0; i < inputs06.length; ++i) { System.out.println(movingAverage.movingAverage(inputs06[i])); } System.out.println("Moving Average length 10:"); movingAverage = new MovingAverageQueue(10); for (i = 0; i < inputs10.length; ++i) { System.out.println(movingAverage.movingAverage(inputs10[i])); } }
56806b92-ad90-4d1b-9199-c45c282a9abb
7
private boolean ValidarPaciente(Paciente p) throws ObjetoNuloException, ValorInvalidoException { if (p == null) { throw new ObjetoNuloException("Paciente nulo"); } /* * if (p.getId() == null || p.getId() < 0) { throw new * ValorInvalidoException( "o identificador do paciente é invalido!"); } */ if (p.getIdTopico() == null || p.getIdTopico().equals("")) { throw new ValorInvalidoException( "o identificador do tópico é invalido!"); } if (p.getNome() == null || p.getNome().equals("")) { throw new ValorInvalidoException("o nome do paciento está vazio!"); } if (p.getDiagnostico() == null || p.getDiagnostico().equals("")) { throw new ValorInvalidoException( "o diagnóstico do paciente é vazio!"); } return true; }
c0b495d1-1237-4c46-b663-e4710d97078f
0
public String getConsumerKey() { return consumerKey; }
fed20587-3e54-48df-96d4-73fa2bbac024
1
public void accept() throws IOException { // Get a new channel for the connection request SocketChannel sChannel = _ssChannel.accept(); // If serverSocketChannel is non-blocking, sChannel may be null if (sChannel != null) { SocketAddress address = sChannel.socket().getRemoteSocketAddress(); System.out.println("Accepting connection from " + address); sChannel.configureBlocking(false); SelectionKey key = sChannel.register(_data.getSelector(), 0); //register new user default empty constructor user.User user = new User("guest", null, null, null, null); ConnectionHandler handler = ConnectionHandler.create(sChannel, _data, key, user); user.addHandler(handler); handler.sayToMe("hello guest user! welcome to the best forum system ever"); //handler.switchToReadOnlyMode(); // set the handler to read only mode } }
779df592-b13f-4068-9698-1bb84294cc96
6
public static Object[][] readXML(String path) { try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory .newDocumentBuilder(); Document doc = documentBuilder.parse(path); Element item = null; NodeList itemNodeList = doc.getElementsByTagName("item"); Object[][] data = new Object[itemNodeList.getLength()][5]; for (int i = 0; i < itemNodeList.getLength(); i++) { Node itemNode = itemNodeList.item(i); if (itemNode.getNodeType() == Node.ELEMENT_NODE) item = (Element) itemNode; data[i][0] = Integer.parseInt((item.getElementsByTagName("id") .item(0).getTextContent())); data[i][1] = ((item.getElementsByTagName("name").item(0) .getTextContent())); data[i][2] = Integer.parseInt((item.getElementsByTagName( "quantity").item(0).getTextContent())); data[i][3] = Integer.parseInt((item.getElementsByTagName( "price").item(0).getTextContent())); if (item.getElementsByTagName("description").item(0) .getTextContent().equals("null")) data[i][4] = ""; else data[i][4] = ((item.getElementsByTagName("description") .item(0).getTextContent())); } return data; } catch (ParserConfigurationException e) { Main.getFrame().showError("Sorry can't something went wrong with the parser configuration \n"+e.getMessage()); logger.error("Failed to Parse file"); } catch (SAXException e) { Main.getFrame().showError("Sorry can't parse file \n"+e.getMessage()); } catch (IOException e) { Main.getFrame().showError("Sorry can't open file \n"+e.getMessage()); logger.error("cant reach requested file: "+path); } return null; }
c0f9fe42-58aa-4b50-8257-629cdcb7dbfa
6
public static void main (String[] args){ Date[] fecha; JSONParser parser = new JSONParser(); Espectaculo espectaculo; /** * Se leen los datos del archivo JSON. El archivo contiene lo necesario para la simulación. */ try { JSONObject escenario = (JSONObject) ((JSONObject) parser.parse(new FileReader(System.getProperty("user.dir") + "\\Escenarios\\EscenarioPrueba4.json"))).get("Escenario"); //Obtengo todos los espectaculos para el escenario JSONArray jEspectaculos =(JSONArray) escenario.get("Espectaculos"); List<Espectaculo> espectaculos = new ArrayList<Espectaculo>(); for (int i = 0; i < jEspectaculos.size(); i++) { JSONObject jEspectaculo = (JSONObject) jEspectaculos.get(i); int cantidadEntradas = Integer.parseInt(jEspectaculo.get("cantidadEntradas").toString()); String localidad = (String) jEspectaculo.get("lugar"); String nombreEspectaculo = (String) jEspectaculo.get("nombre"); String[] fechasEvento = ((String)jEspectaculo.get("fecha")).split(","); JSONArray jZonas = (JSONArray)jEspectaculo.get("Zonas"); List<Zona> zonas = new ArrayList<Zona>(); for (int j = 0; j < jZonas.size(); j++) { JSONObject jZona = (JSONObject) jZonas.get(j); String nombreZona = (String)jZona.get("nombre"); int largoFilas = Integer.parseInt(jZona.get("largoFila").toString()); int cantidadFilas = Integer.parseInt(jZona.get("cantFilas").toString()); Zona nuevaZona = new Zona(nombreZona,cantidadFilas,largoFilas); zonas.add(nuevaZona); } espectaculo = new Espectaculo(localidad, cantidadEntradas, nombreEspectaculo,fechasEvento, zonas); espectaculos.add(espectaculo); } //Selecciono todos los locales para el Escenario JSONArray jLocales =(JSONArray) escenario.get("Locales"); List<Local> locales = new CopyOnWriteArrayList<Local>(); for (int i = 0; i<jLocales.size();i++){ JSONObject jLocal = (JSONObject)jLocales.get(i); String nombreLocal = (String)jLocal.get("nombre"); //Creo la lista de vendedores para este local CopyOnWriteArrayList<Vendedor> vendedores= new CopyOnWriteArrayList<Vendedor>(); //Selecciono todos los vendedores dentro del local JSONArray jVendedores = (JSONArray) jLocal.get("Vendedores"); for (int j=0; j< jVendedores.size();j++){ JSONObject jVendedor = (JSONObject) jVendedores.get(j); int id = Integer.parseInt(jVendedor.get("id").toString()); Vendedor vendedorNuevo = new Vendedor(id, espectaculos); vendedores.add(vendedorNuevo); } Local local = new Local(vendedores,nombreLocal); locales.add(local); } JSONArray jCompradores = (JSONArray) escenario.get("Compradores"); List<Comprador> compradores = new CopyOnWriteArrayList<Comprador>(); for (int i = 0; i < jCompradores.size(); i++) { JSONObject jComprador = (JSONObject) jCompradores.get(i); int idComprador = Integer.parseInt(jComprador.get("idComprador").toString()); String tipoComprador = (String) jComprador.get("tipoComprador"); String zona = (String) jComprador.get("zona"); int cantDeEntradas = Integer.parseInt( jComprador.get("cantDeEntradas").toString()); String espectaculoSeleccionado = (String) jComprador.get("espectaculo"); String nombreLocal = (String) jComprador.get("lugarDeCompra"); Double tiempoLlegada = Double.parseDouble(jComprador.get("tiempoIngreso").toString()); // //Dado el nombre del local, encuentro en la lista de locales el que le corresponde al comprador // Local local = new Local(); // for(Local l: locales) // { // if (l.nombre.equals(nombreLocal)) // { // local=l; // } // } compradores.add( new Comprador(idComprador,tipoComprador,zona,cantDeEntradas, espectaculoSeleccionado, nombreLocal,tiempoLlegada)); } Reloj reloj = new Reloj(compradores,locales); reloj.corre(); } catch (Exception e){ e.printStackTrace(); } }
8a768f47-5c35-41f4-8a2b-246bc759aa46
6
public String[] getPlayImage() { String[] r = new String[6]; switch (playFrameCounter) { case 0: r[0] = " ;~~,__ "; r[1] = ":-....,-------'`-'._.'"; r[2] = " `-,,, , ,'~~' "; r[3] = " ; ,'~.__; / "; r[4] = " :| :| "; r[5] = " `-' `-' "; break; case 1: r[0] = " ;~~,__ "; r[1] = ":-....,-------'`-'._.'"; r[2] = " `-,,, , ,'~~' "; r[3] = " ; ,'~.__; /--. "; r[4] = " :| :| :|``(; "; r[5] = " `-'`-' `-' "; break; case 2: r[0] = " ;~~,__ "; r[1] = ":-....,-------'`-'._.'"; r[2] = " `-,,, , ;'~~' "; r[3] = " ,'_,'~.__; '--. "; r[4] = " //' ````(; "; r[5] = " `-' "; break; case 3: r[0] = " .--~~,__ "; r[1] = ":-....,-------`~~'._.'"; r[2] = " `-,,, ,_ ;'~U' "; r[3] = " _,-' ,'`-__; '--. "; r[4] = " (_/'~~ ''''(; "; r[5] = " "; break; case 4: // ab hier spielt die animation rückwarts r[0] = " ;~~,__ "; r[1] = ":-....,-------'`-'._.'"; r[2] = " `-,,, , ;'~~' "; r[3] = " ,'_,'~.__; '--. "; r[4] = " //' ````(; "; r[5] = " `-' "; break; case 5: r[0] = " ;~~,__ "; r[1] = ":-....,-------'`-'._.'"; r[2] = " `-,,, , ,'~~' "; r[3] = " ; ,'~.__; /--. "; r[4] = " :| :| :|``(; "; r[5] = " `-'`-' `-' "; // wird durch das increment auf 0 erhöht playFrameCounter = -1; break; } playFrameCounter++; return r; }
33292931-39e9-4658-bb92-9dc466128829
4
public void runFileCopyClient() { long startTime = System.currentTimeMillis(); //init Socket try { socket = new DatagramSocket(); } catch (SocketException e) { System.out.println("Have Problem with init Socket"); e.printStackTrace(); } //start AckCheckerThread packetAckChecker = new PacketAckChecker(this, socket); packetAckChecker.setDaemon(true); packetAckChecker.start(); //init PacketBuffer buffer = new PacketBuffer(this, windowSize); //init file reader FileInputStream fileReader = null; try { fileReader = new FileInputStream(sourcePath); } catch (FileNotFoundException e) { System.out.println("Have Problem with SourcePath"); e.printStackTrace(); } FCpacket packetToSend; //send ControlPacket SeqNumber 0 packetToSend = makeControlPacket(); paketRTTSaver.add(System.currentTimeMillis()); buffer.ad(packetToSend); sendPacket(packetToSend); while ((packetToSend = getNextPacket(fileReader)) != null) { while (!buffer.acceptsNummber(packetToSend.getSeqNum())) { //do nothing } startTimer(packetToSend); paketRTTSaver.add(System.currentTimeMillis()); buffer.ad(packetToSend); sendPacket(packetToSend); packeteCount++; } //The End long endTime = System.currentTimeMillis(); System.out.println("Total Transfer Time: " + (endTime - startTime) + " ms"); System.out.println("Packet's: " + packeteCount + " / Ack's: " + paketRTTSaver.size() + " / Ressend: " + timeroutCount); System.out.println("Packet Transfer Time: " + (endTime - startTime) / paketRTTSaver.size()); }
7cdd9fb1-9ecb-4a70-bbbc-69aec08d42e0
0
public void teste(){ }
ac7b3750-b296-418b-8dbf-d4a870b6c7ab
7
public long skip(long amount) throws IOException { if (amount < 0) { throw new IllegalArgumentException(); } synchronized (lock) { if (isClosed()) { throw new IOException("Reader is closed"); //$NON-NLS-1$ } if (amount < 1) { return 0; } if (count - pos >= amount) { pos += amount; return amount; } long read = count - pos; pos = count; while (read < amount) { if (fillbuf() == -1) { return read; } if (count - pos >= amount - read) { pos += amount - read; return amount; } // Couldn't get all the characters, skip what we read read += (count - pos); pos = count; } return amount; } }
e75bb1be-5554-4f31-bdfe-09c4d0a446c1
3
public boolean cambiarestadoSeriales(entidadPrestamo datosPrestmo) { conectarse(); boolean retornarObj = false; String regser = "update tbl_seriales set Estado = ? where Seriales = ?"; ArrayList seriales_recorrer = datosPrestmo.getSeriales(); String estado = datosPrestmo.getEstado(); try { int cont = 0; for (int i = 0; i < seriales_recorrer.size(); i++) { Stmp(); statement = conector.prepareStatement(regser); statement.setString(1, datosPrestmo.getEstado().toString().trim()); statement.setString(2, seriales_recorrer.get(i).toString().trim()); cont = statement.executeUpdate(); } if (cont > 0) { retornarObj = true; } } catch (Exception e) { } return retornarObj; }
ebe0301f-df61-41c1-8b61-8c4436c1325b
8
public void setDireccao(char novaDireccao) { if( (this.direccao == 'u' && novaDireccao == 'd') || (this.direccao == 'd' && novaDireccao == 'u') || (this.direccao == 'l' && novaDireccao == 'r') || (this.direccao == 'r' && novaDireccao == 'l') ) { return; } this.direccao = novaDireccao; }
7c1232c3-2812-4ae7-8519-311f04dad99e
3
@Override public Class getColumnClass(int column) { Class returnValue; if ((column >= 0) && (column < getColumnCount())) { if (getValueAt(0, column) == null) { return String.class; } returnValue = getValueAt(0, column).getClass(); } else { returnValue = Object.class; } return returnValue; }
117dd660-c389-43c3-967f-7c41af40543b
8
public static void main(String[] args) throws BadStateMachineSpecification, InvalidEventException, InterruptedException { ExecutorService pool = Executors.newFixedThreadPool(4); FSMThreadPoolFacade<PerformanceEnum>[] concurrentFSM = new FSMThreadPoolFacade[FSMS]; CountDownLatch latch = new CountDownLatch(FSMS); TestThread[] testThreads = new TestThread[FSMS]; for( int i = 0 ; i < FSMS; ++i) { StateMachine<PerformanceEnum> fsm = new StateMachineBuilder<PerformanceEnum>(StateMachineBuilder.FSM_TYPES.BASIC, PerformanceEnum.class). addState(STATE_INITIAL, new EmptyState()).markStateAsInitial().addDefaultTransition(STATE_START). addState(STATE_START, new MarkState(STATE_START)).addTransition(PerformanceEnum.A, STATE_MIDDLE). addState(STATE_MIDDLE, new EmptyState()).addTransition(PerformanceEnum.A, STATE_MIDDLE). addTransition(PerformanceEnum.B, STATE_FINISH). addState(STATE_FINISH, new MarkState(STATE_FINISH)).addDefaultTransition(STATE_INITIAL).build(); concurrentFSM[i] = new FSMThreadPoolFacade<>(fsm, pool, new LinkedBlockingQueue<FSMQueueSubmittable>()); } for(int i = 0 ; i< FSMS; ++i){ testThreads[i] = new TestThread(TRANSACTIONS_PER_FSM/QUEUE_SIZE/CLIENTS_PER_FSM , QUEUE_SIZE, CLIENTS_PER_FSM, concurrentFSM[i].getProxy(), latch); testThreads[i].start(); } for(int i = 0 ; i< FSMS; ++i) testThreads[i].join(); long maxDelta =0; for(int i = 0 ; i < FSMS; ++i) { AsyncStateMachine<PerformanceEnum> proxy = concurrentFSM[i].getProxy(); long start = (Long) proxy.getProperty(STATE_START); long finish = (Long) proxy.getProperty(STATE_FINISH); if ( maxDelta < (finish - start)) maxDelta = (finish - start); } System.out.println(" FSMs="+FSMS+" senders =" +FSMS*CLIENTS_PER_FSM+" blockSize="+QUEUE_SIZE); System.out.println(" Total transitions="+TRANSACTIONS_PER_FSM *FSMS + " elapsed miliseconds="+maxDelta + " average throughput TP/miliSec "+ ((long)TRANSACTIONS_PER_FSM)*FSMS/maxDelta); pool.shutdown(); int[] FSMS_SET= {2,5,10,20}; int[] CLIENTS_SET = {2,5,10}; int[] TRANSICTIONS_PER_FSM_SET= {10000000,100000000/*,1000000000*/}; for(int fsms:FSMS_SET) for(int clients: CLIENTS_SET) for(int transitions: TRANSICTIONS_PER_FSM_SET){ runTest(fsms, clients, transitions/fsms); } }
4757376a-19af-4881-af28-89b40c5d3180
3
public static void premain( String agentArgs, Instrumentation inst ) throws Exception { InputStream input = findConfiguration( agentArgs ); if (input == null) { throw new IOException( "The specified configuration was not found on the file-system in the current-working-directory, inside any JAR loaded by this class-path, or inside the TheProf JAR." ); } Configuration config = XmlUtility.loadConfiguration( input ); Logger.log( "adding shutdown hook and agent..." ); try { Transformer transformer = new Transformer( config ); inst.addTransformer( transformer ); if (config.mode == AgentMode.CSV) { Runtime.getRuntime().addShutdownHook( new CsvWriter() ); Logger.log( "success adding agent and hook" ); } } catch (Exception e) { Logger.log( "error adding agent: %s", e.getMessage() ); } }
128f08e2-3eb6-435a-9463-bc1cc4e01471
9
public static TestCase getTestCase(HashMap<String, String> row) { TestCase tc = new TestCase(); if(row!=null && row.size() > 0) { if(row.containsKey("TESTCASE")) tc.setTestCaseNumber(row.get("TESTCASE")); if(row.containsKey("TYPE")) tc.setType(row.get("TYPE")); if(row.containsKey("SOURCEORG")) tc.setSourceOrg(row.get("SOURCEORG")); if(row.containsKey("CREATEDBY")) tc.setCreatedBy(row.get("CREATEDBY")); if(row.containsKey("PARENT")) tc.setParent(row.get("PARENT")); if(row.containsKey("MESSAGE")) tc.setMessage(row.get("MESSAGE")); if(row.containsKey("ACTION")) tc.setAction(row.get("ACTION")); } return tc; }
0bec69b7-00fd-4198-826c-ea413f5c77e5
4
public void saveValues() { FileWriter fw; try { fw = new FileWriter(configFile); } catch (IOException e) { e.printStackTrace(); System.err.println("Critical error attempting to save the server configuration. Stopping the server..."); System.exit(0); return; } PrintWriter pw = new PrintWriter(fw); pw.println("Health-cap: " + healthCap); pw.println("Password:" + (password == null || password.equals("") ? "" : " " + password)); pw.println("Player-cap: " + playerCap); pw.println("Port: " + port); pw.println("World-radius: " + worldRadius); pw.close(); try { fw.close(); } catch (IOException e) { e.printStackTrace(); } }
b92fab23-0c8b-4d0e-8736-63dbb1ce904a
8
private void checkLocation(WorldLocation l) { if (!checkedLocations.contains(l)) { if (l.getTile().canItemAlgorithmPass()) { newLocations.add(l); if (possibleItems.contains(l)) { itemLocations.add(l); } } else if (l.getMetadata() instanceof TileMetadataDoor) { if (!((TileMetadataDoor) l.getMetadata()).isLocked() || unlockedDoors.contains(((TileMetadataDoor) l.getMetadata()).getKeyId())) { newLocations.add(l); if (possibleItems.contains(l)) { itemLocations.add(l); } } else if (door == null) { door = l; } } } checkedLocations.add(l); }
3d238546-16da-4543-8547-bbd4182b9d1f
6
public void discoverChildren() { if(!this.storeFile.exists()) return; try { BufferedReader in=new BufferedReader(new FileReader(storeFile)); String line; while((line=in.readLine())!=null) { if(line.length()==0) // skip empty lines continue; if(line.charAt(0)=='#') // skip comment lines continue; String[] data=line.split(","); String type="Songs"; if(data.length>1) type=data[1]; GsSearch sobj=new GsSearch(parent,type,false); addChild(new Search(sobj,data[0])); } in.close(); } catch (Exception e) { PMS.debug("exception reading searches file "+e.toString()); return; } }
663fd3d0-918b-4078-9df9-838e5bf2f011
4
public com.novativa.www.ws.streamsterapi.Position[] getPositions() throws java.rmi.RemoteException { if (super.cachedEndpoint == null) { throw new org.apache.axis.NoEndPointException(); } org.apache.axis.client.Call _call = createCall(); _call.setOperation(_operations[1]); _call.setUseSOAPAction(true); _call.setSOAPActionURI("GetPositions"); _call.setEncodingStyle(null); _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE); _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE); _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS); _call.setOperationName(new javax.xml.namespace.QName("", "GetPositions")); setRequestHeaders(_call); setAttachments(_call); try { java.lang.Object _resp = _call.invoke(new java.lang.Object[] {}); if (_resp instanceof java.rmi.RemoteException) { throw (java.rmi.RemoteException)_resp; } else { extractAttachments(_call); try { return (com.novativa.www.ws.streamsterapi.Position[]) _resp; } catch (java.lang.Exception _exception) { return (com.novativa.www.ws.streamsterapi.Position[]) org.apache.axis.utils.JavaUtils.convert(_resp, com.novativa.www.ws.streamsterapi.Position[].class); } } } catch (org.apache.axis.AxisFault axisFaultException) { throw axisFaultException; } }
d80d272f-6760-4a16-9135-f1004d710b16
7
private static void readStuFile(String stuFileName) { try { EasyReader input = new EasyReader(stuFileName); if (input.bad()) { System.err.println("Can't open " + stuFileName); System.exit(1); } Vector lineOfWords = new Vector(); String tmpWord = ""; input.readLine(); // Gets rid of column headings! int whichStudent = 0; // String counter used for IDs int counter = 0; int prevClass = 9; while (counter <= Students.size()) { System.out.print(counter + " "); lineOfWords.clear(); while (lineOfWords.size() < 17) { tmpWord = input.readWord(); lineOfWords.add(tmpWord); } // /////////////////// DAY STUDENT? //////////////////// if (((String) lineOfWords.get(0)).charAt(0) == '*') ; //do nothing else { //////////////////////MAKE GENDER//////////////////////// String tempGender = lineOfWords.get(7).toString(); boolean gender = false; if (tempGender.equals("1")) { gender = true; } // male // System.out.println( "male" ); /////////////////////MAKE BIRTHDAY/////////////////////// String Birthday = new String(); Birthday = makeBirthday(lineOfWords); // System.out.println(Birthday); ////////////////////MAKE CLASS/////////////////////////// String classString = new String((String) lineOfWords.get(6)); Integer classNum = new Integer(classString); // if we hit a new class, we're now on the first student if (classNum.intValue() != prevClass) { whichStudent = 0; prevClass = classNum.intValue(); } //System.out.println(classString + " "); ///////////////////////INSTANTIATE STUDENT//////////////////// Integer thisStudent = new Integer(whichStudent); String thisStuNum = new String(thisStudent.toString()); // make a number (which student are we on?) String IDNum = new String(); // then make ID number based on that info // JOptionPane.showMessageDialog(null,classNum.intValue() + // " " + gender + " " + thisStuNum); IDNum = makeIDNum(classNum.intValue(), gender, thisStuNum); // table lastTable firstName lastName gender class advisor // student ID BDay assigned Student toadd = new Student(30, Integer.parseInt(lineOfWords.get(14).toString()), Integer.parseInt(lineOfWords.get(15).toString()), Integer.parseInt(lineOfWords.get(16).toString()), lineOfWords.get(1).toString(), lineOfWords.get(0) .toString(), gender, classNum.intValue(), lineOfWords.get(3).toString(), IDNum, Birthday, false); //30 is the "unassigned" table (doesn't factor into lastTable value) whichStudent++; Students.addElement(toadd); unAssignedStudents.addElement(IDNum); prevClass = toadd.getGrade(); counter++; } input.readLine(); } } catch (java.lang.NullPointerException e) { System.out.println(e.getMessage()); } }
f3af0f98-29b4-47f9-8fd7-753266262f3c
2
public void deleteByUserNameAndParticipantName(String userName, String participantName) { EntityManager em = PersistenceManager.createEntityManager(); try { em.getTransaction().begin(); List<Openchatroom> ochrs = em.createNamedQuery("Openchatroom.GetByUserAndParticipant", Openchatroom.class) .setParameter("u", userName) .setParameter("p", participantName) .getResultList(); for (Openchatroom openchatroom : ochrs) { em.remove(openchatroom); } em.getTransaction().commit(); } finally { if (em.getTransaction().isActive()) em.getTransaction().rollback(); em.close(); } }
f2f1918f-1f42-4ff2-8301-49ec23223dd6
4
private Zyg genZygote(int n) { String bin = convertBin(n,l); String[] b = new String[g.length]; //This is the symbolic binary permutation. for(int i=0;i<g.length;i++) { b[i] = bin.substring(i,i+1); } //this is going to be the list of characters that will be used to construct the new Zyg. char[] c = new char[g.length]; //This is going to go through the symbolic binary permutation and the gene list and match the two. for(int i=0; i<g.length;i++) { if (b[i].equals("0")) { c[i] = (char)(g[i].allel1); } if (b[i].equals("1")) { c[i] = (char)(g[i].allel2); } } Zyg z = new Zyg(c); return z; }
7c60f566-c3cd-4074-b45d-a6a165dd728d
5
public void jugar() { if (MiSistema.turno == 0) { if (Domino.listaTablero.size() == 0) {//De de tirar un par this.empezarDoble(); } else { this.heuristica1(); } } if (Domino.listaTablero.size() != 0) { mst.colocarFichaTablero(); } MiSistema.turno = 1; if(Domino.listaTablero.size() == 0 && MiSistema.turno == 1){ JOptionPane.showMessageDialog(null, "¿TIENES LA FICHA?", "EMPEZAR",JOptionPane.INFORMATION_MESSAGE, new ImageIcon("F:\\Domino\\Domino\\src\\Imagenes/" + MiSistema.parSalida + "-" + MiSistema.parSalida + "v.png")); } }
1c64c206-c9b0-4cf1-bf2e-354c3ac9af71
8
public static ArrayList sentenceSplit(ArrayList arraylist, String s) { ArrayList arraylist1 = new ArrayList(); int i = s.length(); if(i == 0) { arraylist1.add(""); return arraylist1; } ArrayList arraylist2 = new ArrayList(); for(Iterator iterator = arraylist.iterator(); iterator.hasNext();) { String s1 = (String)iterator.next(); for(int j = s.indexOf(s1); j != -1; j = s.indexOf(s1, j + 1)) arraylist2.add(new Integer(j)); } if(arraylist2.size() == 0) { arraylist1.add(s); return arraylist1; } Collections.sort(arraylist2); ListIterator listiterator = arraylist2.listIterator(); int l; for(int k = ((Integer)listiterator.next()).intValue(); listiterator.hasNext(); k = l) { l = ((Integer)listiterator.next()).intValue(); if(l == k + 1) { listiterator.previous(); listiterator.previous(); listiterator.remove(); } } listiterator = arraylist2.listIterator(); int i1 = 0; int j1 = i - 1; while(listiterator.hasNext()) { int k1 = ((Integer)listiterator.next()).intValue(); arraylist1.add(s.substring(i1, k1 + 1).trim()); i1 = k1 + 1; } if(i1 < i - 1) arraylist1.add(s.substring(i1).trim()); return arraylist1; }
3329e58f-5a0f-4da5-b405-171c0299ebb6
0
public void setDescription(String lastName) { this.description = lastName; }
7a5417c5-31b6-4b93-a031-37fa43676b44
4
LabFactoryProperties() { final InputStream rsFromContext = Thread.currentThread().getContextClassLoader().getResourceAsStream(RESOURCE_FACTORY); if ( rsFromContext != null ) { LOGGER.trace("Resource found in Thread Context"); } final InputStream resourceStream = (rsFromContext==null) ? ClassLoader.getSystemClassLoader().getResourceAsStream(RESOURCE_FACTORY) : rsFromContext; if (resourceStream != null) { LOGGER.trace("Resource found in System ClassLoader"); try { try { load(resourceStream); } finally { resourceStream.close(); } } catch (final IOException e) { throw new IllegalStateException("Failed to read factory properties", e); } } else { LOGGER.debug("LabFactory configuration resource is missing"); } }
d6659404-b8d7-44a1-bda0-033b9a1f36ab
9
public boolean printCheck(boolean trim, int xoldpoint, int xnewpoint, int yoldpoint, int ynewpoint){ boolean btest2=true; if(trim){ if(xoldpoint<xBot)btest2=false; if(xoldpoint>xTop)btest2=false; if(xnewpoint<xBot)btest2=false; if(xnewpoint>xTop)btest2=false; if(yoldpoint>yBot)btest2=false; if(yoldpoint<yTop)btest2=false; if(ynewpoint>yBot)btest2=false; if(ynewpoint<yTop)btest2=false; } return btest2; }
f67c8002-740d-4948-b5e2-befc598f627f
2
public static Shader buildShader(final String shaderFile, final ShaderType shaderType) { try { final ByteBuffer fileBuffer = FileReader.readFile(shaderFile); final int shaderID = glCreateShader(shaderType.getShaderTypeID()); glShaderSource(shaderID, fileBuffer); glCompileShader(shaderID); if (glGetShader(shaderID, GL_COMPILE_STATUS) == GL_FALSE) { throw new ShaderCompileException( "Error attempting to compile shader: " + shaderFile + "\nError log:\n" + glGetShaderInfoLog(shaderID, GL_INFO_LOG_LENGTH)); } return new Shader(shaderID); } catch (final IOException e) { throw new ShaderCompileException( "Error attempting to load shader file: " + shaderFile, e); } }
e4250a9f-89c8-4d64-887c-aa0a1cc9f0d5
0
public void setView(FindReplaceResultsDialog view) { this.view = view; }
b7e95605-978b-481e-92f7-3ea514f74847
2
public boolean isHidden(Component component) { if (component instanceof DockTab) { return mHidden.contains(component); } if (component == this) { return !hasHidden(); } return false; }
78b5a169-b7bf-4a8e-b213-f34d371f9f1a
4
public void removePath(final Block callerBlock, final Block returnBlock) { for (int i = 0; i < paths.size(); i++) { final Block[] path = (Block[]) paths.get(i); if ((path[0] == callerBlock) && (path[1] == returnBlock)) { if (FlowGraph.DEBUG) { System.out.println("removing path " + path[0] + " -> " + path[1]); } paths.remove(i); return; } } }
1cdc5146-03c5-497c-b285-136047cf9260
2
private static ArrayList<HashMap<String, String>> getExs(String attribute, String vk, ArrayList<HashMap<String, String>> examples) { ArrayList<HashMap<String, String>> exs = new ArrayList<HashMap<String, String>>(); for (HashMap<String, String> example : examples) { if (example.get(attribute).equals(vk)) { exs.add(example); } } return exs; }
7a5d63ae-4e52-4d1a-9d57-cf7f102f27c8
1
public void pausePaallePois() { if (this.pause) { this.pause = false; } else { this.pause = true; } }
d2df6d6e-187d-44b0-9a90-1570c1607360
2
public static void main(String args[]){ System.out.println("Input the values"); Scanner sc=new Scanner(System.in); int lowerLimit=0; int upperLimit=0; int length; int target[] = null; int dest[] = null; ArrayList arr=null; //while(sc.hasNext()){ lowerLimit=sc.nextInt(); upperLimit=sc.nextInt(); //} length=upperLimit-lowerLimit; target = new int[length]; dest = new int[length]; arr=new ArrayList(length); for(int count=0;count<length;count++){ target[count]=count+lowerLimit; //dest[count] =cycleLength(target[count]); arr.add(count, cycleLength(target[count])); } Collections.sort(arr); if(arr.size()>1) System.out.println(lowerLimit+" "+upperLimit+" "+arr.get(arr.size()-1)); else System.out.println(lowerLimit+" "+upperLimit+" "+arr.get(0)); }
f87bc6da-534b-4934-a6e2-95f021186713
1
public void deleteInformations(String[] code) { for (int i = 0; i < code.length; i++) deleteInformation(code[i]); updateSize(); notifyZElement(); }
86c50bab-02ec-450c-a4f6-e0f8ec1e35d5
1
public void update(int delta){ updateOval(delta); updateMovement(); if(seenButtonTime>0){ seenButtonTime -= delta*0.01f; }else{ seenButtonTime = 30; } }
c5d5f030-8578-4203-841b-4b68c7bdfb17
1
private static URL __getWsdlLocation() { if (AQUARIUSPUBLISHSERVICE_EXCEPTION!= null) { throw AQUARIUSPUBLISHSERVICE_EXCEPTION; } return AQUARIUSPUBLISHSERVICE_WSDL_LOCATION; }
c3ddcce5-8898-404c-b99c-3ef132ee4090
1
public String getEntityPublicId(String ename) { Object entity[] = (Object[]) entityInfo.get(ename); if (entity == null) { return null; } else { return (String) entity[1]; } }
b711e122-49eb-4fce-a78f-5563293554b4
6
public TreeMap<Integer, Integer> getPowersOfTwoDecomposition(BigInteger x) { // Special Cases if (x.compareTo(BigInteger.ZERO) == 0) { return null; } TreeMap<Integer, Integer> result = new TreeMap<Integer, Integer>(); if (x.compareTo(BigInteger.ONE) == 0) { result.put(0, 1); return result; } TreeMap<Integer, BigInteger> powersOfTwo = getPowersOfTwo(x); Integer n; BigInteger powerofTwo; BigInteger remainder = new BigInteger(x.toString()); Iterator<Integer> powersOfTwoDescendingKeySet_Iterator = powersOfTwo.descendingKeySet().iterator(); while (powersOfTwoDescendingKeySet_Iterator.hasNext()) { if (remainder.compareTo(BigInteger.ZERO) == 1) { n = powersOfTwoDescendingKeySet_Iterator.next(); powerofTwo = powersOfTwo.get(n); if (powerofTwo.compareTo(remainder) != 1) { remainder = remainder.subtract(powerofTwo); Generic_Collections.addToTreeMapIntegerInteger(result, n, 1); } } else { break; } } //System.out.println("remainder " + remainder); if (remainder.compareTo(BigInteger.ZERO) == 1) { Generic_Collections.addToTreeMapIntegerInteger( result, getPowersOfTwoDecomposition(remainder)); } return result; }
5a9f7abd-8d94-4834-a332-d4223f38168b
9
public void readFunction(Element function) throws MaltChainedException { boolean hasSubFunctions = function.getAttribute("hasSubFunctions").equalsIgnoreCase("true"); boolean hasFactory = false; if (function.getAttribute("hasFactory").length() > 0) { hasFactory = function.getAttribute("hasFactory").equalsIgnoreCase("true"); } Class<?> clazz = null; try { if (PluginLoader.instance() != null) { clazz = PluginLoader.instance().getClass(function.getAttribute("class")); } if (clazz == null) { clazz = Class.forName(function.getAttribute("class")); } } catch (ClassNotFoundException e) { throw new FeatureException("The feature system could not find the function class"+function.getAttribute("class")+".", e); } if (hasSubFunctions) { NodeList subfunctions = function.getElementsByTagName("subfunction"); for (int i = 0; i < subfunctions.getLength(); i++) { readSubFunction((Element)subfunctions.item(i), clazz, hasFactory); } } else { int i = 0; String n = null; while (true) { n = function.getAttribute("name") + "~~" + i; if (!containsKey(n)) { break; } i++; } put(n, new FunctionDescription(function.getAttribute("name"), clazz, false, hasFactory)); } }
65931f16-af63-45de-bde3-db714822ef71
7
@Override public Integer insert(TipoUsuarioBeans tipouser) throws DAOException { PreparedStatement pst = null; ResultSet generatedKeys = null; try { pst = con.prepareStatement(sql.getString("INSERT_USUARIO"), Statement.RETURN_GENERATED_KEYS); pst.setInt(1, tipouser.getId_tipo()); pst.setString(2, tipouser.getNombre()); pst.setString(3, tipouser.getDesc()); pst.setBoolean(4, tipouser.isActivo()); if (pst.executeUpdate() != 1) throw new DAOException("No se pudo insertar la solicitud"); generatedKeys = pst.getGeneratedKeys(); generatedKeys.first(); ResultSetMetaData rsmd = generatedKeys.getMetaData(); if (rsmd.getColumnCount() > 1) { throw new DAOException("Se genero mas de una llave"); } //con.commit(); return generatedKeys.getInt(1); } catch (SQLException e) { e.printStackTrace(); throw new DAOException(e.getMessage()); } catch (Exception e) { throw new DAOException(e.getMessage()); } finally { try { if (pst != null) pst.close(); if (generatedKeys != null) generatedKeys.close(); } catch (SQLException e) { e.printStackTrace(); } } }