method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
58154394-6d77-43cf-b7a4-e13b45150712
9
public void scrollCellToView(JTable table, int rowIndex, int vColIndex) { if (!(table.getParent() instanceof JViewport)) { return; } JViewport viewport = (JViewport) table.getParent(); Rectangle rect = table.getCellRect(rowIndex, vColIndex, true); Rectangle viewRect =...
cdf1015b-0e5e-4fa5-91f4-da5a6e460407
4
@Override public void run(){ ImageIcon iconLogo = new ImageIcon(IMG.getImage(this.mainImg)); this.refLabel.setIcon(iconLogo); while(!super.detener){ try{ if(!this.defensaColaAtaques.isEmpty()&&this.getOcupado()) recibirdaño(); ...
0f05ad8c-ee06-46e3-b35c-a93d940e3958
9
public String scrambleAll(String language, String str, int numToMess) { final StringBuffer newStr=new StringBuffer(""); int start=0; int end=0; int state=-1; while(start<=str.length()) { char c='\0'; if(end>=str.length()) c=' '; else c=str.charAt(end); switch(state) { case -1: ...
dec1a674-7921-46d0-bfbc-5abac439fea1
8
private void parseXmlEvent() throws XMLStreamException { if(xmlEvent.getEventType() == START_ELEMENT) { String tagLocalName = xmlEvent.asStartElement().getName().getLocalPart(); if( tagLocalName.equals("item") ) { if(atHeader) ...
e027d398-158e-4ea6-9e29-a60f7594f67a
4
public static SSLContext getInstance(boolean server) throws GeneralSecurityException { SSLContext retInstance = null; if (server) { synchronized(BogusSslContextFactory.class) { if (serverInstance == null) { try { serverI...
83b24a14-ed60-486c-bd7f-634335147583
1
public void acquirePacketsTimed(final List<Packet> buffer, final int count, long milliseconds) { Thread sniffer = acquirePackets(buffer, count); try { Thread.sleep(milliseconds); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } done = true; }
104379bc-5974-41ac-9479-3813b250b5eb
5
public static Resting nextRestingFor(Actor actor) { final Boardable home = actor.mind.home(), work = actor.mind.work() ; if (home != null && ratePoint(actor, home, 0) > 0) { return new Resting(actor, home) ; } if (work != null && ratePoint(actor, work, 0) > 0) { return new Resting(actor, wor...
ae9b57e4-5de2-4cef-9932-e0d6cc2953a6
2
void addResidualFlowTo(int vertex, double delta) { if (vertex == v) flow -= delta; // backward edge else if (vertex == w) flow += delta; // forward edge else throw new IllegalArgumentException(); }
b5887f84-dc6e-4488-8fc8-e851296e9f56
7
protected void handleKeyTyped(char keyChar) { if (keyChar == 8) { // backspace if (cursorIndex > 0) { moveCursor(-1); enteredText.deleteCharAt(cursorIndex); refreshEndOfString(); } } else if (keyChar == 27) // escape ...
f2920c4b-056a-4c73-942b-f25f968f345e
6
public static void encode (String paraFile) throws IOException { // timing long startMili = System.currentTimeMillis(); // read paras DomXmlDocument paraXml = new DomXmlDocument(); HashMap<String, String> paraMap = paraXml.parseXml(paraFile); int width = Integer.parseInt(...
9cc81692-1473-47bf-ae5a-6f434e3a710d
1
public Quaternion GetTransformedRot() { Quaternion parentRotation = new Quaternion(0,0,0,1); if(m_parent != null) parentRotation = m_parent.GetTransformedRot(); return parentRotation.Mul(m_rot); }
8c045959-3f36-4381-8475-777cd6bb79a8
0
public void setVidas(int v){ this.vidas = v; }
c0056b15-fa3d-4be9-94fe-44b9cde75673
6
public Object tooltip(Coord c, boolean again) { long now = System.currentTimeMillis(); if (!again) hoverstart = now; if ((now - hoverstart) < 1000) { if (shorttip == null) { String tip = shrtTip(); if (tip == null) return null; shortti...
77ab4fe8-7017-4d1a-af4f-7a849271f291
9
public void onPlayerDamageBlock(int par1, int par2, int par3, int par4) { this.syncCurrentPlayItem(); if (this.blockHitDelay > 0) { --this.blockHitDelay; } else if (this.creativeMode) { this.blockHitDelay = 5; this.netClientHandler...
73f99e92-f8ef-4178-8f29-f43aebed5a23
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Employe other = (Employe) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; ...
d9f20a59-a961-4fb1-a3d2-3ca48717dad2
3
public static void main(String[] args) { // TODO Auto-generated method stub Logger logger = Logger.getLogger(ListTest.class); logger.info("---- List Adventure starts ----"); List<Student> stdList = new ArrayList<Student>(); stdList.add(new Student(1, "Z", "M")); stdList.add(new Student(2, "M", "A")...
06c16ce0-fb39-43b4-87da-7741ea185f99
5
private void rotateUp(int index) { PQElement<T> x = heap.get(index); while (index > 0) { int parentIndex = (index - 1) / 2; PQElement<T> y = heap.get(parentIndex); if (orientation && x.priority >= y.priority) ...
f8113ff5-3f9d-4b07-a2fe-752c042f64b7
6
public boolean GenericCreate(Player player, String boxelName, String seed, String generator) { MVWorldManager mvWorldManager = master.getMVCore().getMVWorldManager(); // check if boxelName is empty and create the boxelName from the player name then if (boxelName.isEmpty()) boxelName = GenUtils.boxelizeNam...
91d22790-39b8-4bcb-b404-88bdcb3b4407
6
public static void main(String[] args) { if (args.length != 1) throw new IllegalArgumentException("Incorect parameters count. Expected count is 1 that is assumed as threads count," + "but current is " + args.length); threadsCount = Integer.parseInt(args[0]); //--...
895a8e41-d9f2-48a6-8b48-256af943c353
1
public boolean isRowOrAncestorSelected(TreeRow row) { return mSelectedRows.contains(row) || isAncestorSelected(row); }
8be4bc3b-60b8-4948-a6a2-bf637505bcf0
2
public ArrayList getProductionsForPushLambdaTransition( Transition transition, Automaton automaton) { ArrayList list = new ArrayList(); String fromState = transition.getFromState().getName(); String toState = transition.getToState().getName(); PDATransition trans = (PDATransition) transition; String toPop ...
439c3b52-008f-4260-a7e3-ea4c365bfe83
1
public void run() { try { exit = process.waitFor(); } catch (InterruptedException ignore) { return; } }
2f891cec-7887-41db-8f34-dadbd49b3628
7
private void ensureCapacity(int minimalCapacity) { int required = minimalCapacity - FIELDS_STORE_SIZE; if (required <= 0) throw new IllegalArgumentException(); if (data == null) { int alloc = FIELDS_STORE_SIZE * 2; if (alloc < required) { alloc = requi...
8afa2ca0-119e-472d-88a9-604c36ac027d
7
public void run() { BufferedReader br = null; try { InputStreamReader isr = new InputStreamReader(this.inputStream); br = new BufferedReader(isr); String temp = null; synchronized (this) { while ((temp = br.readLin...
98250c97-514a-4622-b594-95c5e3e6e81e
9
public boolean validaDataInicialDigitada(String dataInicial, String dataFinal) { if (dataInicial.equals(" / / ") || dataInicial.trim().equals("/ /")) { JOptionPane.showMessageDialog(null, "Informar a data inicial!"); jFTInicioLote.grabFocus(); return false; } e...
04fbe281-6885-4361-8725-db36b136565e
7
public static URLClassLoader newClassLoader(String modPath) { File dirLibs = new File("libs"); dirLibs.mkdirs(); List<URL> list = new ArrayList<URL>(); List<File> lookIn = new ArrayList<File>(); lookIn.add(dirLibs); while (!lookIn.isEmpty()) { File check = lookIn.remove(0); if (check.isDirectory...
7471c28d-c3f6-41a6-8747-d73c5f85d3da
5
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final HelpMenu other = (HelpMenu) obj; if (this.enabled != other.enabled) { return false; }...
a202759b-7460-4306-82c6-4129c910e116
8
public void setBorderArea(char dir, Area anArea) { switch(dir) { case 'a': above = anArea; anArea.setId(idX, idY-1); break; case 'b': below = anArea; anArea.setId(idX, idY+1); break; case 'l': left = anArea; anArea.setId(idX-1, idY); break; case ...
e0822110-1dc9-4f24-a890-563bff19d09e
8
private boolean sequals(Node n) { Parser.condense(this); Parser.condense(n); if( !data.equals( n.data )) return false; if(child.size() == 0) return true; boolean[] found = new boolean[n.child.size()]; for(int i = 0; i<child.size(); ++i) { for(int j = 0; j<n.child.size(); ++j) { ...
b845d1af-107b-4911-8d8b-e989b7c07ba6
0
public QuestPoint getQuest() { return quest; }
a2ba946d-9ae1-494d-85da-ed85acc8d4b7
8
public static void main(String[] args) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); String line = ""; StringBuilder out = new StringBuilder(); int times = 0; while ((line = in.readLine()) != null) { if (times++ != 0) line = in.readLine(); int inter =...
69f8966e-371c-4c66-a7bd-e99f98e6b777
7
private static void dealLinkList(List<String> linkList) { // TODO Auto-generated method stub if(null == linkList || linkList.size() != 3) return; String subjectOne = extract(linkList.get(0),subjectOneStart,subjectOneEnd); String subjectTwo = extract(linkList.get(1),subjectTwoStart,subjectTwoEnd); String...
e0926a9d-eb8d-4b64-b836-c4d2b09374ec
6
public IJavaVersion getBest64BitVersion() { IJavaVersion bestVersion = null; for (IJavaVersion version : loadedVersions.values()) { if (version.is64Bit()) { if (bestVersion == null || bestVersion.getVersionNumber() == null) { bestVersion = version; ...
aa160ea1-492b-4d75-ab79-b8a52871561f
3
public void drawcmd(GOut g, Coord c) { if(cmdline != null) { if((cmdtext == null) || (cmdtext.text != cmdline.line)) cmdtext = cmdfoundry.render(":" + cmdline.line); g.image(cmdtext.tex(), c); int lx = cmdtext.advance(cmdline.point + 1); g.line(c.add(lx + 1, 2), c.add(lx + 1, 14), 1); } }
40b8271b-2945-4daa-93b4-2bb662d43821
3
public boolean isNextVADriveable() { Drivability d = this.getCurrentRoad().getNextSeg(this).isDriveable(this); //if its not driveable return false if (d == Drivability.NotDriveable) { return false; } else if (d == Drivability.Caution && (this.getCurrentRoad().getLength() - this.getPosition()) <= this.getB...
b010f51f-ab72-41c6-ae7c-286e86f82600
5
private void setupPicker() { picker = new WeaponPicker(this) { @Override protected void onPlayerHit(String playerName, String triggerKey) { System.out.println("PLAYER " + playerName); if (gameData.isPlayer(playerName)) { if (networkC...
f5c621bf-49ea-4341-8a83-ac6ea1433086
8
private boolean search_helper(int[] A, int start, int end, int target) { if (start > end) return false; if (start == end) return A[start] == target; int mid = (start + end) / 2; if (A[mid] == target) return true; else if (target < A[mid]) { boolean right = false; if (A[mid] >= A[end]) ...
7f2aa16e-fdfd-4be8-9333-579d4574e9ab
2
public void mineClicked(int x, int y) { // Fail the grid. hasEnded = true; hasSucceeded = false; // Reveal any mines. for (int i = 0; i < gridSize; i++) { for (int j = 0; j < gridSize; j++) { squares[i][j].revealIfMine(); } ...
10bd3edf-3e1f-4113-98de-89de5aee5eac
7
public void addListener(Object id, Object l, int validOps) { //cannot do instanceof here as clients may use one object as two instances and it //could be set wrong or twice.....ie. we can't tell. instead use validOps switch(validOps) { case SelectionKey.OP_ACCEPT: if(acceptCallback != null) throw new Ru...
6fd0e878-1f84-48ff-8518-787016c56169
0
public String getMatch() {return this.match;}
206519df-2397-4411-abc9-92a8e6e5f281
2
protected JSONObject _parseJSONObjectFromFile() throws ReaderException { JSONParser parser = new JSONParser(); try { _readFile(); return (JSONObject) parser.parse(new FileReader(getConfigFile())); } catch (IOException e) { ConfigurationManager.logger.log(e.toString(), 1); } catch (ParseException e) {...
e35bb6eb-7c4a-4b74-8e79-4e392879d0f9
9
private void createAdditionalCustomers(int seatsRemaining, int numberOfSeats, Customer customer, String travellerNames, String nameOfSeats, int flightID, String flight) { JPanel cusInputWest = new JPanel(new GridLayout(0,1)); JPanel cusInputEast = new JPanel(new GridLayout(0,1)); ...
f94237fe-36b0-4e41-8149-1f974265dee4
8
protected void moveAtmosphereOut(Set<Room> doneRooms, Room startRoom, int atmo) { final LinkedList<Room> toDoRooms=new LinkedList<Room>(); toDoRooms.add(startRoom); while(toDoRooms.size()>0) { final Room R=toDoRooms.removeFirst(); doneRooms.add(R); staleAirList.remove(R.roomID()); if(changeRoomAir(...
d7eea4aa-30c4-42e6-bb35-924394e7e409
5
private static boolean compareParticles(Particle p1, Particle p2){ if(p1.mass != p2.mass) return false; if(p1.speedX != p2.speedX) return false; if(p1.speedY != p2.speedY) return false; if(p1.x != p2.x) return false; if(p1.y != p2.y) return false; return true; }
cf4343d5-1b9d-49f7-93bc-7632b406a0ed
7
public int[] getInts(int par1, int par2, int par3, int par4) { int i = par1 - 1; int j = par2 - 1; int k = par3 + 2; int l = par4 + 2; int ai[] = parent.getInts(i, j, k, l); int ai1[] = IntCache.getIntCache(par3 * par4); for (int i1 = 0; i1 < par4; i1++) ...
c974aad1-8164-4e5f-9688-b157b63d89a1
0
@Override public void fireTableDataChanged() { super.fireTableDataChanged(); view.updateTotalMatches(); }
6bf41579-fb7b-4f23-95d4-531a2ceaf476
3
public static void main(String[] args) { String host = "localhost"; int port = 8092; int num = 100; Socket[] socket = new Socket[num]; for(int i=0;i<num;i++){ try { socket[i] = new Socket(host, port); System.out.println("第"+(i+1)+"个socket 创建成功"); } catch (UnknownHostException e) { e.printSta...
2f72be78-6d8f-480d-91ac-1bafb3ac8a89
5
private void bbox(final Rectangle2D r, final AffineTransform af, final double length, final double rot) { double pos = 0.0; final double end = Math.max(length - segLen * 0.5, 0.0); while(pos <= end) { final AffineTransform at = new AffineTransform(af); final Shape s; if...
25b6d2f7-7e84-48ae-8056-84ed0ba4717e
7
@Override public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if(src == JButton_Console){ if(getSize().getWidth() >= 750){ /** If True (Retirer) */ for(int i=1090; i > 689; i--){ setSize(i, 490); } }else{ /** If False (Etirer) */ for(int i=689; i < 1090; i++){ ...
03cd63e2-b606-4518-8e37-b59805a2cfeb
3
public void setSubmissionTime(double clockTime) { if (clockTime < 0.0 || index_ < 0) { return; } Resource res = resList_.get(index_); res.submissionTime = clockTime; if (record_) { write( "Sets the submission time to " + num_.format(clockTime) ); ...
09b1ce04-7d85-4116-a930-cab2f756f17c
3
private static void applyNiSetting(String strLclNi) { for(NetworkInterface niTmp: EzimNetwork.nifs.keySet()) if (strLclNi.equals(niTmp.getName())) EzimNetwork.localNI = niTmp; if (null == EzimNetwork.localNI) { EzimLogger.getInstance().warning ( "Invalid network interface setti...
250460f0-a1d2-41ce-82d8-1c489a6d59d7
7
protected List<ListItemT> getListItems() { if ( control instanceof DropDownListT ) { return ( (DropDownListT) control ).getListItem(); } else if ( control instanceof EditableDropDownListT ) { return ( (EditableDropDownListT) control ).getListItem(); } else if ( control instanceof RadioButtonListT )...
27165780-16a6-4582-9106-d905e2812142
0
public void setPhone(String phone) { Phone = phone; }
e21bfe94-122c-42d0-abfc-50cf2b672034
0
public void setName(String name) { Name = name; }
bc8f17fc-c7e7-438e-80cb-4b5ba7c59e4b
5
@SuppressWarnings("unchecked") public static <T> T getField(Object from, String name) { Class<?> checkClass = from.getClass(); do { try { Field field = checkClass.getDeclaredField(name); field.setAccessible(true); return (T) field.get(from)...
5eaabe71-9bed-4e13-8670-9e8a3830f9c3
9
public static void main(String[] args) { ProcessManager manager = new ProcessManager(); try { ServerSocket master = new ServerSocket(SERVER_PORT); outer: while (true) { /* * The process managers is polling for connections */ Socket connection = master.accept(); System.out.println("con...
643bcf85-5134-4fb0-a6fd-e4f8e89cf71a
3
private void readFile(String fileName) throws IOException{ String line; this.data = new ArrayList<String>(); FileReader fr = null; BufferedReader br = null; try { fr = new FileReader(fileName); br = new BufferedReader(fr); while((line = br.readLine()) != null) this.data.add(line); } fin...
8090607a-d791-4029-bc18-249d043e6799
2
public SubCategory getSubCategory(String naam, int datatype, float weight){ for (SubCategory sc : subcategories) { if ( sc.naam.equals(naam) ){ return sc; } } SubCategory returnScat = new SubCategory(naam, datatype, weight); subcategories.add(returnScat); return returnScat; }
12f0e88d-4058-4414-b974-a84ba441f7ac
7
@Override public List findRecords(String sqlString, boolean closeConnection) throws SQLException, Exception { Statement stmt = null; ResultSet rs = null; ResultSetMetaData metaData = null; final List list=new ArrayList(); Map record = null; // do this in an excpetion handler so that we can depend on ...
b56bc218-5d07-41ed-9e71-183f1aa32f67
6
@Override public void actionPerformed(ActionEvent event) { if (obj.getStep().getRemainingTime() != 0) { if (obj.getStep().getActualStepNumber() != 0) { obj.getStep().setRemainingTime(obj.getStep().getRemainingTime() - 1); } if (!(obj.getTab().getX() > 49 &...
f90cadc1-ad8d-4ac3-8e17-7e53df47be67
6
public void horizontalFill() { int assignTileInt = 0; switch (tileSet) { case INDOORS: assignTileInt = assignTileIntIndoors; break; case OUTDOORS: assignTileInt = assignTileIntOutdoors; break; } int tileNum = currentArea[location.x][location.y]; for (int i = location.x; i<=getAreaWidt...
6168370d-57df-462a-ad61-52ab5a8baf1a
3
public void exec() { if (WindowStack.getLastInstance() != null) { setParent(WindowStack.getLastInstance()); } move(300, 300); show(); wait = true; while (wait) { QApplication.processEvents(); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } }
ff90950f-d8e7-40ec-8b6f-b5eae7a6e05e
2
public static Connection creerConnexion() { if (connexion == null) { try { Properties props = new Properties(); FileInputStream fichier = new FileInputStream("build/classes/connexion/connexion.properties"); props.load(fichier); OracleDa...
bb6f6b3c-7168-4e09-b991-afb5adae38dd
8
public void navigate(String destination) { configuration.getView().dispose(); switch (destination) { case "root-menu": configuration.removeEntity("airplane"); configuration.removeQueryString("airplane-consult"); configuration.removeQueryStr...
702ee44d-eec8-4d1c-a692-419755b3b74b
4
public void generateDotFile(String filename) { try { PrintWriter out = new PrintWriter(filename); out.println("digraph Heap {\n\tnode [shape=record]\n"); for(int i = 0; i < currentSize; i++) { out.println("\tnode" + i + " [label = \"<f0> |<f1> " + array[i] + "|<f2> \"]"); if(((i*2) + 1) < curre...
65554697-9316-4810-8fa4-8b1091603e6d
2
private void finalize(final ExprInfo exprInfo) { final Iterator uses = exprInfo.def().uses().iterator(); while (uses.hasNext()) { final LocalExpr use = (LocalExpr) uses.next(); if (use.parent() instanceof PhiCatchStmt) { exprInfo.setSave(true); break; } } finalizeVisit(exprInfo, cfg.source()...
217c1f17-c314-446b-827c-d2bd318082ab
0
protected void setInputToRead(String inputToRead) { /* * if (!automata.StringChecker.isAlphanumeric(inputToRead)) throw new * IllegalArgumentException("Label must be alphanumeric!"); */ myInputToRead = inputToRead; }
5b61c561-c019-4b76-8bce-9e3181ac1fd0
4
public static void arc(double x, double y, double r, double angle1, double angle2) { if (r < 0) throw new IllegalArgumentException("arc radius must be nonnegative"); while (angle2 < angle1) angle2 += 360; double xs = scaleX(x); double ys = scaleY(y); double ws = factorX(2*r); ...
bab59eab-f214-4da2-b1f3-b86be2fcc934
8
private Boolean playTurn(Player M,Player N) { if(M.isWhite()) printer.printBoardState(B,M,1); else if(!(M.isWhite())) printer.printBoardState(B,M,2); askNMoveCoord(M); printer.printBoard(B); printer.printCaptures(wcaptures,bcaptures); printer.printPlayersPiecesOnBoard(M,N); //M.printPossibleMoves()...
c9c7a153-72df-4cb1-b934-80f314c9590c
5
private void ConnectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ConnectActionPerformed try { if (cardIsConnected) { JOptionPane.showMessageDialog(null, "Already connected to: " + CardManager.getTerminal(), "Connection info", JOptionPane.WARNING_MESSAGE); ...
743fddfc-a264-4e92-a893-238cad58b413
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()); ...
1739488f-2b23-4990-9c2f-af4c9770e5e7
0
public GameMap() { games = new HashMap<UUID, Game>(); gameGenerator = new GameGenerator(); }
bfb573a4-b6a5-4aad-a1c4-0ae1d2ebe038
1
public ExchangeHandle getRemoteHandle(Host host) throws CommunicationException { String[] exchangeHandleID = ExchangeHandleHelper.id().split(":"); String corbaloc = "corbaloc:iiop:[" + host.getAddress().getHostAddress() + "]:" + host.getPort() + "/" + exchangeHandleID[1];...
bf255e92-c38e-4fc2-855f-eead8228565b
5
public void initialize() { // the next line is for Raspberry Pi and // gets us into the while loop and was suggested here was suggested // http://www.raspberrypi.org/phpBB3/viewtopic.php?f=81&t=32186 System.setProperty("gnu.io.rxtx.SerialPorts", "/dev/ttyACM0"); CommPortIdentifier portId = null; Enumeratio...
005f2a3e-db4a-4bbc-a81a-ce0022f19d2e
5
private static void handleAssembly() { String keys = AssemblyFrame.getInstance().textAreaKeys.getText(); if (keys.split("\n").length<2) { JOptionPane.showMessageDialog(SharingFrame.getInstance(), "Liste cles/valeurs incorrect!","Erreur!",JOptionPane.ERROR_MESSAGE); return; } BigInteger primeNumber = null...
219a92dc-e326-4442-90e9-57a42759fc6c
2
protected void save(Type entity) throws NotUpdatedException { try { if (entity.getId()== null){ entityManager.persist(entity); }else { entityManager.merge(entity); } } catch (Exception exception) { th...
c356e11b-741d-44dd-946d-64c986653de7
4
public synchronized SlaveVM requestVM() { if (vmsInUse.size() >= maxVMs) return null; if (vmsAvailable.size() > 0) { return getAvailableVM(); } else { try { addVM(); synchronized (vmsAvailable) { while (availableVMCount() < 1) { } // wait for VM to become available return getAvaila...
75b57443-afc0-4ad4-bc0f-5b4f815982f5
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Commande other = (Commande) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false;...
1e04a1a1-dffa-433c-aa88-34b8fbb1e086
3
private void notifyGameOver(){ List<Player> winners = game.getWinner(); StringBuffer sb = new StringBuffer(); sb.append("Game over! "); sb.append(winners.size()>1? "The winners are " : "The winner is "); for(Player p : winners){ sb.append(p.getName()+" "); } JOptionPane.showMessageDialog(null, sb...
afd06d70-c0e9-4f8e-b712-905a63cea10f
3
@Override public void caseATrueHexp(ATrueHexp node) { for(int i=0;i<indent;i++) System.out.print(" "); indent++; System.out.println("(TrueLiteral"); inATrueHexp(node); if(node.getTrue() != null) { node.getTrue().apply(this); } outATrueHexp...
ed7816cd-2f1f-487b-b831-e4448afbd9e8
7
private boolean r_case_other() { int among_var; // (, line 123 // [, line 124 ket = cursor; // substring, line 124 among_var = find_among_b(a_6, 6); if (among_var == 0) ...
a424c28f-0ee9-4037-8eb0-a58985b8594e
3
public static void main(String[] args) { Scanner scan = new Scanner(System.in); HashMap<Integer, Integer> hm = new HashMap<Integer, Integer>(); LinkedList<Integer> ll = new LinkedList<Integer>(); while (scan.hasNextInt()){ int aux = scan.nextInt(); if (!...
a3f44bc0-bdad-4fff-908c-378155279089
2
public void show() { for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) System.out.printf("%9.4f ", data[i][j]); System.out.println(); } }
e7845a05-3c62-43f6-88df-7b5c524ca141
7
public static void makeCompactGrid(Container parent, int rows, int padding) { SpringLayout layout; try { layout = (SpringLayout)parent.getLayout(); } catch (ClassCastException exc) { System.err.println("The first argument to makeCompactGrid must use SpringLayout."); ...
fc61c0c4-35ae-46a3-bc32-ac4f14a5f147
6
public void deal() throws XmlTypeErrorException, CubeNotExistsException, SchemaNotExistsException, AggregationTypeInvalidException, CorrespondingDimensionNotExistsException, CorrespondingLevelNotExistsException, SizeNotEqualException, DocumentException, IOException, Inval...
eae79482-2469-40b9-9e96-24da66d4f99b
3
public void setCellValue(Object value, HSSFWorkbook workbook, int nIndex, HSSFRow row, HSSFCellStyle style) throws Exception { HSSFCell cell = row.createCell(nIndex);// 创建单元格 if (value instanceof String) { cell.setCellValue((String) value); } else if (value instanceof Number) {// 单元格为数值时,格式化数值保留两位小数 cell.se...
cc652d4c-6503-495d-93a2-eb0d9575bf2d
1
public void testWithDate_int_int_int() { DateTime test = new DateTime(2002, 4, 5, 1, 2, 3, 4, ISO_UTC); DateTime result = test.withDate(2003, 5, 6); DateTime expected = new DateTime(2003, 5, 6, 1, 2, 3, 4, ISO_UTC); assertEquals(expected, result); test = new DateTime(TES...
491d0fe3-fc2b-4e8d-b384-705f68a31506
2
@Override public void addNewSound(String soundName, int ID, SoundType type) { if(type == SoundType.OGG) { onSoundLoaded(ID,loadSoundOGG(soundName), type); } if(type == SoundType.WAV) { onSoundLoaded(ID, loadSoundWAV(soundName), type); } }
2c34a591-123e-499c-89d0-fd8e3a75a52d
7
protected boolean isMaximal() { int prevCharIndex = pos.edgePos-(pathLen+1); if ( prevCharIndex >= 0 ) { char dataPrevChar = mum.arc.getData()[prevCharIndex]; if ( prevCharIndex >= 0 ) { BitSet pathVersions = new BitSet(); if ( versions != null ) pathVersions.or( versions ); pathVersion...
18e8241a-7fa5-4d48-835b-976c936f6e5b
6
public void ProcessViaKeywords(String path){ try { in=new BufferedReader(new FileReader(new File(path))); out=new BufferedWriter(new FileWriter(new File("hosts"),true)); out.write("\n#keywords hosts\n\n"); while((line=in.readLine())!=null){ for(int i=0;i<KEYWORDS.length;i++)if(line.contains(KEYWORDS[i...
a8be4abf-3294-4639-8f10-050d2cb4d8a4
4
@Override public int loop() { if(startscript) { if(task == null || !task.hasNext()) { task = container.iterator(); } else { final Node curr = task.next(); if(curr.activate()) { curr.execute(); } } } return stop; }
6b581f96-3ea4-478c-9ca7-d2ea314d03aa
2
public Object getMessage(String json, Class<?> clazz) { Object object = null; try { object = mapper.readValue(json, clazz); } catch (Exception e) { e.printStackTrace(); } return object; }
82300d35-135f-4c25-a7ed-bea611354ee4
8
static private int jjMoveStringLiteralDfa5_0(long old0, long active0) { if (((active0 &= old0)) == 0L) return jjStartNfa_0(3, old0); try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { jjStopStringLiteralDfa_0(4, active0); return 5; } switch(curChar) { cas...
a506a566-3266-49a1-81b0-bbfe59df42d0
8
public void setCam(int xCam, int yCam) { xCam /= distance; yCam /= distance; int xCamD = this.xCam - xCam; int yCamD = this.yCam - yCam; this.xCam = xCam; this.yCam = yCam; g.setComposite(AlphaComposite.Src); g.copyArea(0, 0, width, height, xCamD, yCa...
74a0c3dd-c4d5-4c08-901e-dd7b81ddbbc2
4
private void addForceFieldConnection(ForceFieldConnection forceFieldConnection) { if (forceFieldConnection == null) throw new IllegalArgumentException("forceFieldConnection can't be null!"); if (!forceFieldConnection.getForceFieldGenerators().contains(this)) throw new IllegalArgumentException("The forcefieldC...
267b6994-06cc-4bc1-971c-06beb20ceb8d
9
public List<State> solve(State state) { if (state.isGoal()) { return Collections.emptyList(); } List<AStarState> closed = new ArrayList<>(); PriorityQueue<AStarState> prioQueue = new PriorityQueue<AStarState>(); AStarState startState = new AStarState(state); star...
07fbac24-c15a-4941-9576-d932ae659f0f
0
public String getDateCreated() {return this.dateCreated;}
43fa177f-dc2f-4560-b4aa-d7fb6c56f0f7
4
public void renderModel(TextureManager var1, float var2, float var3, float var4, float var5, float var6, float var7) { super.renderModel(var1, var2, var3, var4, var5, var6, var7); Model var9 = modelCache.getModel(this.modelName); GL11.glEnable(3008); if(this.allowAlpha) { GL11.glEnable(...
e8168e22-8264-40bc-9497-4635168976e8
8
@Override public int compareTo( node o ) { if ( index == 0 || o.index == 0 ) return 0; if ( arr.size( ) < o.arr.size( ) ) { return -1; } else if ( arr.size( ) > o.arr.size( ) ) { return 1; } for ( int i = 0; i < arr.size( ); i++ ) { if ( arr.get( i ) != o.arr.get( i ) ) { if ( arr....
c5b812de-89f5-4fe5-8277-35368ae1b6cd
2
public void writeSystem( OutputStream out, SystemState system ) throws IOException { writeInt( out, system.getCapacity() ); if ( system.getCapacity() > 0 ) { writeInt( out, system.getPower() ); writeInt( out, system.getDamagedBars() ); writeInt( out, system.getIonizedBars() ); if ( system.getDeionizati...