method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
af8a61c6-c7be-4a46-b2de-4ebb39df40dc
8
public void cluster() { _ls.log("clustering"); /* If it is the first time, create the k-means clustering points. */ if (_firstTime) generateInitialMeans(); /* Reset the associations between means and points. */ Map<NamedPoint, Set<NamedPoint>> assignments = new HashMap<NamedPoint, Set<NamedPoint>>(...
649c3847-feb1-41d2-b39e-81e440ab691d
5
@Command(command = "unfreeze", arguments = {"target player[s]"}, description = "unfreezes the target players in their place", permissions = {"unfreeze"}) public static boolean unfreeze(CommandSender sender, String targetPlayer) throws EssentialsCommandException { // get a list of all target players ArrayL...
455c2ba0-6770-4ece-87d5-8ca6579d0111
7
public void setUnit(Unit unit, Player unitOwner, ActionListener actionListener, boolean unitActive) { if (unit == null) { setUnitUIVisible(false); nameLabel.setText(""); //If the panel labelled "unit" is empty, it should be clear that no unit is selected. } else { setUnitUIVisible(true); nameLabel...
5e1e3f9e-21c3-4529-b330-666723d10da1
8
@Override public synchronized void movePlayer(SHServiceClient shServiceClientImpl, char movement) throws RemoteException { //First, we send the request to the servers linked to this one for the update if(this.getIsPrimary()){ for(SHService shServiceImpl: listServices){ if(!(shServiceImpl.getHos...
d633ec8d-2390-4d49-b83e-e61f3c0bf508
9
public static void main(String[] args) throws Exception { checkState(args.length == 2, "Expecting host and port as args"); SocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1])); try (RedisConnection conn = RedisConnection.connect(addr)) { System.o...
fe859f10-c20a-4c96-9d87-d23f8f5cadce
6
public static int countNumberOfRepairersForBuilding(Unit building) { if (building == null) { return 0; } int total = 0; for (Unit worker : repairers) { if (worker == null) { return 0; } if (repairersToBuildings.get(worker) == null) { continue; } if (repairersToBuildings.get(worker)....
eb57b103-ab1f-4451-9f1d-2606b4620230
8
@Override public int castingQuality(MOB mob, Physical target) { if(mob!=null) { if(!(target instanceof MOB)) return Ability.QUALITY_INDIFFERENT; if(((MOB)target).amDead()||(!CMLib.flags().canBeSeenBy(target,mob))) return Ability.QUALITY_INDIFFERENT; if((mob.isInCombat())&&(CMLib.flags().isAliveAw...
9d3cfb27-cbfb-4578-8714-a9304f6f0810
5
public void tryToFire(boolean isEpic) { // check that we have waiting long enough to fire if (System.currentTimeMillis() - lastFire < firingInterval) { return; } // if we waited long enough, create the shot entity, and record the time. lastFire = System.curre...
97689d37-0568-4c83-9c61-e36771585dd1
4
private static void createFactories() { if(Utilities.dbFactory == null) { Utilities.dbFactory = DocumentBuilderFactory.newInstance(); Utilities.dbFactory.setNamespaceAware(true); } if(Utilities.xpFactory == null) { Utilities.xpFactory = XPathFactory.newInstance(); } if(Utilities.trFactory == nul...
8c38b4e7-5193-49a1-8758-4ffcc2059609
8
@Override public void actionPerformed(ActionEvent evt) { String cmd = evt.getActionCommand(); switch (cmd) { case IC_ADD: addAlarm(); break; case IC_EDIT: editAlarm(); break; case IC_DELETE: deleteAlarm(); ...
1c8bb2a6-7c59-469a-8ba3-6e3e9d2d99b7
6
public static void startupXmlObjects() { { Object old$Module$000 = Stella.$MODULE$.get(); Object old$Context$000 = Stella.$CONTEXT$.get(); try { Native.setSpecial(Stella.$MODULE$, Stella.getStellaModule("/POWERLOOM-SERVER/GUI-SERVER", Stella.$STARTUP_TIME_PHASE$ > 1)); Native.setSpecial...
e89d1606-1362-4e76-86b7-700ae46e3979
9
public static void main(String[] args) throws Exception { String tmpStr; String filename; DataSource source; Instances data; int classIndex; Capabilities cap; Iterator iter; if (args.length == 0) { System.out.println( "\nUsage: " + Capabilities.class.getName() + ...
4b4abf25-94fe-42b0-b744-89ef13d9dfdb
3
public ArrayList<Nacionalidad> resultQueryNac(String sql){ ArrayList<Nacionalidad> nacList = new ArrayList<Nacionalidad>(); try { rs = stm.executeQuery(sql); try { while(rs.next()){ Nacionalidad item = new Nacionalidad(rs.getInt("idNacionalidad"), rs.getString("nacion")); nacList...
f763b64d-7171-49e0-8b89-2f0e2cda8a08
7
public static String convertToString(Car car) throws Exception { Class<?> currentCarClass = car.getClass(); Method getModel = null; Method getPower = null; Method getDateOfCreation = null; try{ getModel = currentCarClass.getDeclaredMethod("getModel"); }catch (NoSuchMethodException e){ System.out.prin...
ff7a1ef8-5f62-4c9c-bd4a-9af4aea907a0
3
private void login() { if(!loginPanel.isFillField()) { loginPanel.setErrorInfo("Fill all fields"); return; } try { session = chatRoomEntry.login(loginPanel.getLogin(), loginPanel.getPassword()); } catch(RemoteException e) { ...
badf6422-4e76-4377-b3fe-278f2c1e844d
0
public void deleteTreatmentMeta(int index){ treatmentMeta.remove(index); }
48b56b89-6bde-4fa9-af10-3785197bd764
4
public void refresh() { combo.removeAllItems(); for(Project project : projects.getBusinessObjects()) { ((DefaultComboBoxModel<Project>) combo.getModel()).addElement(project); } if (!projects.getBusinessObjects().isEmpty()) { if(project==null) project = projects.ge...
ac92f248-8d94-4ec3-bef2-340a71b65fee
3
public AbstractMatter select(Tile tile) { //check if selected is in the tile, if it is, take the index before //else take the last index List<AbstractMatter> ab = tile.getAbstractMatterList(); int index = ab.size() - 1; for(int i = ab.size() - 1; i >= 0; i--) {...
933cbf15-ab88-4056-81d2-586e144b4367
1
public static double product(double[] vals) { double prod = 1; for (double v : vals) { prod = prod * v; } return prod; }
aa4a46b3-38be-448b-91c6-30d925930eb2
4
public static boolean isText(PolyBlockType type) { return type == FLOWING_TEXT || type == HEADING_TEXT || type == PULLOUT_TEXT || type == VERTICAL_TEXT || type == CAPTION_TEXT; }
feca6933-28e1-44f5-ae63-f8da482a18b9
9
static final int get(Monster type, Token token) { switch(token) { case Toughness: switch(type) { case DarkYoung: return 3; default: return 1; } case Combat: switch(type) { case Cultist: return 1; default: return 0; } case Stamina: switch(type) { case DarkYoung: return...
17ce856e-9618-4cc2-a724-ab04880c530e
9
protected void FillBuff() throws java.io.IOException { if (maxNextCharInd == available) { if (available == bufsize) { if (tokenBegin > 2048) { bufpos = maxNextCharInd = 0; available = tokenBegin; } else if (tokenBegin < 0) bufpos = maxN...
952b20b7-2531-4f0d-8fbb-c4642c70a435
4
public boolean deletePatient(Patient newPatient) { if (newPatient == head) { head = null; return true; } Patient aux = head.getNext(); while (!aux.getName().equals(newPatient.getName()) && aux.getNext() != head) { aux = aux.getNext(); } if (aux.getNext() == head) { //patient to remove ...
7a3acd72-ba35-4208-bff7-aa8c31005de9
3
private void renderOptions(GameContainer c, Graphics g){ FontUtils.drawCenter(TowerGame.ricasso30, "Options", 165, 60, 470, Color.white); FontUtils.drawCenter(TowerGame.ricasso20, "Back", 165, 185, 470, Color.gray); switch (options){ case 1: FontUtils.drawCenter(TowerGame.ricasso20, "- Music Volume -", 16...
8b9bde92-c265-46ad-9bd8-88c1daad2457
5
private void checkShipToPlanetsCollision(ShipV2 player, ArrayList<Planet>p){ for(int i = 0; i < p.size();i++){ Planet planet = p.get(i); if(player.getPosition().x >= planet.getPosition().x && player.getPosition().x <= (planet.getPosition().x + planet.getWidth()) && player.getPosition...
55bc19e2-9184-4031-a7a9-21a0ac15f334
0
@Test public void test() { TernaryST st = new TernaryST(); st.put("three", (Object)3); st.put("four", (Object)4); System.out.println(st.contains("four")); System.out.println(st.contains("five")); }
9b95a393-90dc-413b-adbf-177e9b3474a0
7
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficiencyCheck(mob,0,auto); if(success) { invoker=mob; final CMMsg msg=CMClass.getMsg(mob...
2a973b4f-e95a-47ee-98b6-8d2cae0d4cf1
1
public void InsertaFinal(String nombreProceso) { if ( VaciaLista()) PrimerNodo = UltimoNodo = new NodosListaProceso (nombreProceso); else UltimoNodo=UltimoNodo.siguiente =new NodosListaProceso (nombreProceso); }
ee76613f-e360-4a25-8687-d8d802b735c7
1
private String getSuffix(String src, String... delimiter) { int i = Utils.findIndex(src, delimiter); if (i == -1) return src; else return src.substring(i + 1); }
d6b8bd3c-1306-41f7-8e16-6e35346b7661
0
@Override public void mouseExited(MouseEvent e) { }
4e641db2-c303-4dc9-acbc-9fff4ae0c649
9
@Override public void start(Stage primaryStage) throws Exception { final int PANEL_HEIGHT = maze.height*SQUARE_SIZE; final int PANEL_WIDTH = maze.width*SQUARE_SIZE; Group root = new Group(); primaryStage.setTitle("Bob's Maze"); primaryStage.setScene(new Scene(root)); //Draw the maze ...
1c0a9b67-ad32-457b-b3ea-231271f26f37
5
public void draw(Graphics2D g) { for (int row = rowOffset; row < rowOffset + numRowsToDraw; row++) { if (row >= numRows) { break; } for (int col = colOffset; col < colOffset + numColsToDraw; col++) { if (col >= numCols) { break; } if (map[row][col] == 0) { continue; } int rc...
a1665421-2ea6-46f9-9b9b-56b9e57e1aa9
3
private int getTextBlockHeight (Graphics2D g2d, String t) { if ((t == null) || (t.equals(""))) { return 0; } TextLayout tl = new TextLayout(t, MainWindow.setupData.getPrintElementSetupList().getPrintElementSetup (PrintElementSetupList.FONT_SUMMARY_SHEET).getPrintFont(), g2d.getFont...
1d1638ea-844e-4585-9992-4b196196db10
6
public static Collection<Temporal> consolidateTemporalSegments(Collection<Temporal> temporals) { if (null == temporals || temporals.size() < 2) return temporals; Set<Temporal> origTemporals = new TreeSet<Temporal>(temporals); temporals.clear(); if (origTemporals.contains(PERSISTENT_TEMPORAL)) { temporals.a...
72c3ff0a-446e-4820-99d2-6b119a569416
4
@Override public String execute() { try { if ((databaseContext.table != null) && databaseContext.table.getName().equals(arguments.get(1))) { databaseContext.table = null; } databaseContext.provider.removeTable(arguments.get(1)); return "dropped"...
9bd551ee-d34b-4da8-b6f4-82d44e7fb46f
0
public boolean isManaged() { return managed; }
bcaab039-ba5a-49d3-a5c4-64e336870030
5
public static BookCopy getBookCopyByBookCopyID(int copyID){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BookCopy bc = null; try { ...
c853abf5-2b64-4cf2-853d-a359e58a6a09
9
public boolean monsterAttack(int userPosition, int player) { boolean dead = false; for (int i = 0; i < numberofEnemys; i++) { if (dead == false) { if (enemyLocation.get(i) != null) { int enemyLoc = enemyLocation.get(i); int enemyLocXY[]...
0aecad5a-5bda-402a-b0c5-812a176e3c7e
2
public Administrateur ChercherAdministrateur(String login) { try { String sql = "SELECT * FROM User WHERE login='" + login + "'"; ResultSet rs = crud.exeRead(sql); Administrateur a = new Administrateur(); while (rs.next()) { a.setL...
535cc633-5b23-4217-91ef-e85016743e03
2
private static void resplit(final double a[]) { final double c = a[0] + a[1]; final double d = -(c - a[0] - a[1]); if (c < 8e298 && c > -8e298) { double z = c * HEX_40000000; a[0] = (c + z) - z; a[1] = c - a[0] + d; } else { double z = c *...
d3a034b2-3b09-4a89-a9dd-97ef10f67526
0
public void mouseReleased(MouseEvent e) { //moveCamera(e); }
f84bc76a-fd5e-46f3-9c30-6d7473958558
4
private void addHour(List<QlockWord> timeList, final int HOUR) { if (HOUR == 12) { timeList.add(QlockLanguage.EEN); } else if (HOUR == 10 || HOUR + 1 == 10) { timeList.add(QlockLanguage.TIEN1); } else if (HOUR + 1 == 5) { timeList.add(QlockLanguage.VIJF); ...
49165cc0-91e5-4d37-ad15-359343e03106
8
static char getAlarmSignal(int alarms){ switch(alarms){ case NoAlarm: return ' '; case ServerExceptionAlarm: return 'x'; case NoServerResponseAlarm: return '@'; case HeadersChangedAlarm: retur...
eda51986-a274-424a-b75c-e2390c2bb119
9
private void joinGame(String sender) { if (status == GameStatus.IDLE) { return; } if (status != GameStatus.PRE) { // if the game is already running, dont add anyone else to either list sendNotice(sender, "The game is currently underway. Please wait for " + "the current game to finish before trying a...
de02e82c-a6f7-4221-bff6-0c4f216e8eae
3
private Value[] fillParameters(BytecodeInfo code, Object cls, Object[] params) { Value[] locals = new Value[code.getMaxLocals()]; for (int i = 0; i < locals.length; i++) locals[i] = new Value(); String myType = code.getMethodInfo().getType(); String[] myParamTypes = TypeSignature.getParameterTypes(myType...
cdfc55ff-ea7e-4d32-b328-5ec0b8b268dd
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Path other = (Path) obj; if(end == other.start && start == other.end) return true; if (end != other.end) return false; if (start != oth...
237cf755-f71e-48d0-b402-549edd46a231
5
private void removeBrokenMTWCs(MTWData data) { Set<Set<Tuple<Integer, Integer>>> set; if (data.player == playerID) { set = data.mTWCFP2; } else { set = data.mTWCFP1; } Iterator<Set<Tuple<Integer, Integer>>> combinations = set.it...
0bc0f08a-5650-46f0-a263-f3e5eb9901f2
2
public void renderBlank(int xp, int yp, int w, int h, int color) { for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { paintPixel((x+xp) + (y+yp) * width, color); } } }
c3f6c946-208b-46da-9132-e3fd8fed6ce8
6
public static String longestCommonPrefix(String[] strs) { if(strs.length == 0) { return ""; } boolean wrong = false; String result = new String(); for(int m = 0; m <= strs[0].length(); m++) { result = strs[0].substring(0, m); for(int i = 0; i < strs.length; i++) { if(strs[i].length() < m) { ...
1080c002-214d-4084-9ac1-e6e3ba01a055
1
public void testMinus_Days() { Days test2 = Days.days(2); Days test3 = Days.days(3); Days result = test2.minus(test3); assertEquals(2, test2.getDays()); assertEquals(3, test3.getDays()); assertEquals(-1, result.getDays()); assertEquals(1, Days.ONE.minus(D...
09506019-2cb1-46bf-8744-64ea19a221cc
0
protected void onConnect() {}
eeb9e4e2-6254-4b30-83c2-d579360640a4
9
public static correctionx line_corrections(double sigma, double w_est, double r_est) { correctionx result_corr = new correctionx(); int i_we,i_re; //boolean is_valid; double a,b; int field; w_est = w_est/sigma; if (w_est < 2 || w_est > 6 || r_est < 0 || r_est > 1) { result_corr.w = 0; result_co...
75d0625b-4788-4c00-90e7-2ce9a02685f9
6
public static void showGUI(){ //public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. ...
0bc517a6-5694-4511-aa95-6eac94deec37
6
public void drawBackground(int i, int k) { i += anInt1454; k += anInt1455; int l = i + k * DrawingArea.width; int i1 = 0; int j1 = anInt1453; int k1 = anInt1452; int l1 = DrawingArea.width - k1; int i2 = 0; if(k < DrawingArea.topY) { int j2 = DrawingArea.topY - k; j1 -= j2; k = DrawingArea...
115a0c30-75c0-454d-bcb1-1b31d1cdcbf8
2
public Nodo<E> getNodoXpos(int x){ Nodo<E> resp = cabeza; for(int i=0 ; i < x ;i++){ if(resp != cola) resp = resp.getSiguiente(); else{ System.out.println("indice fuera de rango"); return null; } } return...
76b81e61-a243-4219-af56-d6e898bbd737
0
@Override public String toString() { return "[lines=" + lines + "]"; }
e542f672-1ba7-4f15-993b-1678b8fedb61
1
public Constant newClass(final String value) { key2.set('C', value, null, null); Constant result = get(key2); if (result == null) { newUTF8(value); result = new Constant(key2); put(result); } return result; }
3e0aa351-a532-41b5-a812-840759c04781
4
public void showLockedChildren() { if (Main.getInterface() == null || Main.getInterface().children == null) { return; } for (int index = 0; index < Main.getInterface().children.size(); index++) { RSInterface child = RSInterface.getInterface(Main.getInterface().children.get(index)); if (child.locked) { ...
a50389d2-db85-45e1-974c-cfd7e631d883
6
public static <GItem> Set<GItem> unionSet(final Set<? extends GItem> items1, final Set<? extends GItem> items2) throws NullPointerException { if (items1 == null) throw new NullPointerException("items1 = null"); if (items2 == null) throw new NullPointerException("items2 = null"); return new AbstractSet<GItem>() { ...
6bbf0039-c57e-401c-8b30-901e4b7035c3
6
public static void main(String args[]) { File f = new File("config"); FileReader fr = null; try { fr = new FileReader(f); } catch (FileNotFoundException e2) { e2.printStackTrace(); } BufferedReader br = new BufferedReader(fr); String host = ""; String port = ""; try { host = br.readLine()...
6d14688e-cc52-4dea-9309-9497122c0824
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Zeit other = (Zeit) obj; if (hour != other.hour) return false; if (minute != other.minute) return false; return true; }
2fa4369d-11db-403d-bb2d-834103469079
2
@Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals(OK)) { ok(); } else if (e.getActionCommand().equals(CANCEL)) { cancel(); } }
202d3a94-d16f-412c-99a5-76cb4438157f
1
public void draw(Graphics g, boolean fill) { g.setColor(myColor); if(fill) { g.fillRect(getUpperLeftX(), getUpperLeftY(), getWidth(), getHeight()); } else { g.drawRect(getUpperLeftX(), getUpperLeftY(), getWidth(), getHeight()); } }
54332373-7567-4dc9-a6b9-9a015ddbc17d
9
private void getContextNodeBinarySearch() { int low = MIN_CONTEXT_LENGTH; int high = _contextLength; _contextLength = MIN_CONTEXT_LENGTH-1; // not sure we need this _contextNode = null; boolean isDeterministic = false; while (high >= low) { int contextLength = (high + low)/2; PPMNode contextNode = looku...
eae39a40-2b7e-4aee-b882-2b082c6b216a
8
private static void WriteAttrisGrp(Document doc, Element attrigrpnode, GeneratorAttriGrp attrisgrp) { GeneratorAttriGrp grp; GeneratorAttri attri; List<GeneratorAttri> attrislist = attrisgrp.getAttrisList(); List<GeneratorAttriGrp> childattrislist = attrisgrp.getChildAttriGrpList(); int i; for (i = 0...
02b54f17-d2fb-444e-a8ab-e00bbc41ce46
9
public List<Client> searchClient(String usernameOrName) { Connection conn=null; try{ conn = dbConnector.getConnection(); if (conn==null) //cannot connect to DB return null; Statement st; ResultSet rs; String sql; boolean searchAll = false; if (usernameOrName==null ) searchAll=tr...
2c70a004-73ee-413c-b268-c114924d4c61
7
public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof AbstractXYItemLabelGenerator)) { return false; } AbstractXYItemLabelGenerator that = (AbstractXYItemLabelGenerator) obj; if (!this.formatString.equals(that.f...
4e48b024-43b5-4d25-b361-9954b5d433e4
4
public void addAtEndBeforeBranch(Instruction i) throws Exception { if(!instructions.isEmpty() && instructions.getLast() instanceof BranchInstruction) { ListIterator<Instruction> iter = instructions.listIterator(instructions.size() - 1); iter.next(); // r...
c3caab02-0cce-4956-b6bb-68b89bc1024e
7
public void solve(char[][] board) { m = board.length; if (m == 0) return; n = board[0].length; visited = new boolean[m + 2][n + 2]; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) if (board[i][j] == 'X') visited[...
2e964136-a648-48e7-b1c7-442ba0056ed2
5
public static void main(String[] args) { int[] num = {9,5,4,3,2,7,6,1}; for(int i = 0; i < num.length; i ++) { for(int j = i + 1; j < num.length; j ++) { for(int n : num) { System.out.print(n + ","); } System.out.println(); ...
394a8b6b-8281-477c-934c-1aa48e51390e
6
public static <GInput, GValue, GOutput> Converter<GInput, GOutput> chainedConverter(final Converter<? super GInput, ? extends GValue> converter1, final Converter<? super GValue, ? extends GOutput> converter2) throws NullPointerException { if (converter1 == null) throw new NullPointerException("converter1 = null"); ...
62a88949-9cce-4c0a-b0a9-944d8b90de6f
9
public ContainerComponent(WorkplacePanel parent, Container container) { this.container=container; this.workplacePanel=parent; preferences=workplacePanel.documentFrame.loadOrganizer.preferences; setBorder(BorderFactory.createLineBorder(Color.BLACK,1)); Dimension boxSize=container.getSize(); Dimensio...
476c208c-bf30-46a7-b623-07981cf7f666
4
private void btnModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnModificarActionPerformed try{ int numero = Integer.parseInt(txt1.getText()); if(numero>0){ Modificar modificar = new Modificar(); Statement consulta = c...
9a1b4c38-e0ec-4e86-b3a2-b6bbb6239936
9
public void reduce(Text key, Iterator<Text> values, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { // allocate and initialize 2D array of category by district int[][] crimes = new int[categories.size()][districts.size()]; for (int i = 0; i < categories.size(); i++) { for (int j...
de218ca8-bfec-4bbf-b02d-c5902d240c69
2
@Override public Cible getCible(String cId) throws InvalidJSONException, BadResponseException { Cible c = null; JsonRepresentation representation = null; Representation repr = serv.getResource("intervention/" + interId + "/cible", cId); try { representation = new JsonRepresentation(repr); } catch (I...
b39f5738-177c-4322-96ed-feedf676258a
7
public void cityCheck() { for(MyNode n : mg.getNodeArray()) { for(MyEdge e : n.getFromEdges()) { if(e.getRoadName().equals(address[0]) && e.getCity().equals(address[5])) { putEdge(e); } } for(MyEdge e : n.getToEdges()) { if(e.getRoadName().equals(address[0]) && e.getCity().equals(address[5])...
d07d8175-3c0f-4ae2-8775-05903452d87e
6
private boolean checkALError() { switch( AL10.alGetError() ) { case AL10.AL_NO_ERROR: return false; case AL10.AL_INVALID_NAME: errorMessage( "Invalid name parameter." ); return true; case AL10.AL_INVALID_ENUM: ...
222cc371-34cb-4ff0-8f9b-fd858f8a1788
1
@Override public Set<Class<?>> getClasses() { return getRestResourceClasses(); }
b5497c17-0da0-4955-9934-647848ffb2fb
9
public synchronized boolean equals(Object obj) { if (!(obj instanceof FilterRequest)) return false; FilterRequest other = (FilterRequest) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); ...
be309e7e-dbb3-49f7-ad9e-b3522541d29c
1
private int[] mergeSort(int[] a ) { if(a.length == 1) return a; int middle = a.length / 2; int[] left = new int[middle]; int[] right = new int[a.length - middle]; System.arraycopy(a, 0, left, 0, middle); System.arraycopy(a, middle, right, 0, a.length - middle); r...
01df2ac5-f8dc-4628-8ef4-995f8f976021
2
public static void moveItem(InventoryItem[] targetInventory, int targetIndex, InventoryItem[] destinationInventory) { /*Example of moving an object from your inventory to a storage chest: * moveItem(player.Inventory,3,chest.Inventory); * Where player is the instantiated player object,...
bc1752ad-6868-4521-a122-a97f6f95e4af
8
public static Password getPassword(String realm,String dft, String promptDft) { String passwd=System.getProperty(realm,dft); if (passwd==null || passwd.length()==0) { try { System.out.print(realm+ ((promptDft!=null && p...
89916c07-eb05-4250-bfe2-e1f538be9f73
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see ht...
df834edc-f52b-420d-9cd8-37e30895f4e0
6
public String get_user_courses_in_circle_by_year(int user_id, int year, int circle_id) { User user = get_user_by_id(user_id); if(user==null) return ""; ArrayList<Circle> circles=user.user_circles; ArrayList...
f1f204a1-72c8-4bf4-94dc-c68265281004
7
private HashMap<String, HashSet<String>> BFS() { HashMap<String, HashSet<String>> reverseLinks = new HashMap<String, HashSet<String>>(); if (startWord.equals(endWord)) return reverseLinks; HashSet<String> visited = new HashSet<String>(); HashSet<String> outGoing = new HashSe...
0907c9b5-3c6b-42b5-a661-964215a57d2d
9
private Node<K, V> ceilingAll( V value ) { if( value == null ) { return null; } Node<K, V> node = mAllRoot; Node<K, V> ret = null; if( mValueComparator != null ) { Comparator<? super V> comp = mValueComparator; while( node != null ) { int c = c...
91a4f699-8de9-4bd2-8a47-1261765b62a6
2
Item newMethodItem(final String owner, final String name, final String desc, final boolean itf) { int type = itf ? IMETH : METH; key3.set(type, owner, name, desc); Item result = get(key3); if (result == null) { put122(type, newClass(owner), newNameType(name, desc)); result = new Item(index++, key3); ...
00ccd48a-6e65-4c2e-b387-82abb5b15fbd
0
public void clickPlayGame(ArrayList<MainMenuHeroSlot> heroies) { state.clickPlayGame(heroies); }
3f8660ba-a37f-49e0-89d7-194b3204c3b0
3
public void WGDefaultChannel(String channel, String sender, String login, String hostname) { User user; boolean changed = false; for(Game game : games.values()) { user = getUser(game, sender, login, hostname); if(user != null) { user.defaultchannel = chann...
6feabf36-8819-4379-b668-a33d127da07c
2
public BaseReport(File file) { this.file = file; fileName = file.getName(); fileNameSections = fileName.split("\\.")[0].split("_"); try { if (checkVersion(file).equals("2003")) { InputStream in = new FileInputStream(file); hWorkbook = new HSSFWorkbook(in); } else { InputStream in = new FileIn...
0fc0ed76-090a-4ac2-b9a6-3522cc760712
7
protected static void parseSites(final Map<String,SiteConfig> map, Node root) throws Exception { NodeList children=root.getChildNodes(); if(children == null || children.getLength() == 0) return; for(int i=0; i < children.getLength(); i++) { Node node=children.item(i); ...
083aabc2-050c-485d-b58b-4c4ead2d4940
8
public static void checkAccuracyRealFFT_1D() { System.out.println("Checking accuracy of 1D real FFT..."); for (int i = 0; i < sizes1D.length; i++) { FloatFFT_1D fft = new FloatFFT_1D(sizes1D[i]); double err = 0.0; float[] a = new float[sizes1D[i]]; IOUtils...
1aedb250-f681-45de-bf9d-61b30951a7c3
0
public void sprzedawanie(){ System.out.println("Sprzedaje sprzet..."); }
49e2f10e-6cc2-4d98-8925-314821492716
8
protected void markEnclosingMemberWithLocalType() { if (this.currentElement != null) return; // this is already done in the recovery code for (int i = this.astPtr; i >= 0; i--) { ASTNode node = this.astStack[i]; if (node instanceof AbstractMethodDeclaration || node instanceof FieldDeclaration || (no...
5bb36a8a-7af9-4831-b676-42cc6c3d5d78
3
public DisplayMode findFirstCompatibleMode( DisplayMode modes[]) { DisplayMode goodModes[] = device.getDisplayModes(); for (int i = 0; i < modes.length; i++) { for (int j = 0; j < goodModes.length; j++) { if (displayModesMatch(modes[i], goodModes[j])) { ...
f7ccee19-5272-4d2e-8fd5-7a96bb288870
9
@Override public boolean exec() { //解析 this.doComm(this.line); //this.line = this.line.replaceAll(",", ""); //String 可能包含空格 int p1 = this.line.indexOf(" "); int p2 = this.line.indexOf(","); if (p1 == -1 || p2 == -1 || p2>=this.line.length()) { this.out.append("exec var error. line:").append(this.line); ...
307962ca-3d88-4bdc-b593-41ede2dfce5d
1
@Override public int getSlotSpacingY() { return isNotPlayerInventory() ? 32 : 18; }
f94a8661-8a62-4d92-9316-dacb138dee64
5
private void calcspectralDifference() { float[] spectrum = this.nextSpectrum(); float[] lastSpectrum = new float[spectrum.length]; // System.out.println("Spectrum length = " + spectrum.length); // while there are samples to read, we calculate the flux for each // window do { float flux = 0; for (in...
e17b4b5a-b762-4531-a212-4c4ce547a11d
0
public void die() { alive = false; }
ebb642bf-469d-4db8-aba1-e8a8310c9f24
5
@Override public boolean equals(Object obj) { if (obj != null && obj instanceof Node) { Node n = (Node)obj; if (n.getId() != null && this.getId() != null && n.getId().equals(this.getId())) { return true; } } return false; }