method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
1d11a1d2-ebcd-46d2-99f2-12637a8973e1
9
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((brandName == null) ? 0 : brandName.hashCode()); result = prime * result + ((originalPrice == null) ? 0 : originalPrice.hashCode()); result = prime * result + ((percentOff == nu...
c6079f16-358b-404d-8f2b-9be89bc9cd94
3
public void setValor(PValor node) { if(this._valor_ != null) { this._valor_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); ...
d31420f8-c20d-4269-bfbd-e60ac5d16ff6
7
private void exception(Throwable e) { try { _persistent=false; int error_code=HttpResponse.__500_Internal_Server_Error; if (e instanceof HttpException) { error_code=((HttpException)e).getCode(); ...
4a073f13-8094-4ae3-974c-886f108e3068
0
public static Image getSingleCardImage(int index) { String curDir = System.getProperty("user.dir"); String pathName = curDir + "/classic_cards/"; //System.out.println("Current work dir is: " + curDir); Image pic = Toolkit.getDefaultToolkit().getImage(pathName + cardImageFileNames[index])...
a9d31fa0-0b79-4e0b-9d2f-7d4a79bc2cf2
4
public static void main(String[] args) { Reta reta = new Reta(); Retangulo retan = new Retangulo(); Triangulo trian = new Triangulo(); Circulo cir = new Circulo(); //inicia scanner Scanner ler = new Scanner (System.in); //ler a linha toda String cmd = ler.nextLine(); //delimita as i...
0e8a20cf-bac1-4e23-8542-4e9ed23061d0
2
public SongEvent popBeat() { if (!measures.isEmpty()) { SongEvent beat = measures.get(0).pop(); if (measures.get(0).isEmpty()) { popMeasure(); } return beat; } else { return SongEvent.END; } }
8f58e7f6-dd17-4090-89a5-f5b137f6afbd
2
private void setButtonMode(Integer bm) { if (bm == 0) { okButton.setEnabled(false); cancelButton.setEnabled(false); deleteButton.setEnabled (true); editButton.setEnabled(true); newButton.setEnabled(true); } if (bm == 1) { okButton.setEnabled(true); cancelButton.setEnabled(true); d...
ce2c606b-4394-4632-909d-e00552315e58
7
public static void PROVJERI_naredba_grananja(){ String linija = mParser.ParsirajNovuLiniju(); // ucitaj KR_IF UniformniZnak uz_kr_if = UniformniZnak.SigurnoStvaranje(linija); linija = mParser.ParsirajNovuLiniju(); // ucitaj L_ZAGRADA UniformniZnak uz_l_zagrada = UniformniZnak.SigurnoStvaranje(linija); linija ...
713b02d7-1801-439c-acd0-3957ff244bd0
9
public String request(String request) { Response response = new Response(Status.failed, null, null); Gson gson = GsonFactory.getGsonInstance(); JsonParser parser = new JsonParser(); IHandler handler = null; try { JsonElement root = parser.parse(request); if(root.isJsonObject()) { ...
1567372b-79de-43c8-bbca-47953fc39d8c
3
private static void writeFile0(ClassFile cf, String directoryName) throws CannotCompileException, IOException { String classname = cf.getName(); String filename = directoryName + File.separatorChar + classname.replace('.', File.separatorChar) + ".class"; int pos = fil...
67f29401-a093-4b63-ab52-f34fbbb26ed1
2
public void renderHue(int xp, int yp, Sprite sprite, int color) { int w = sprite.getWidth(); int h = sprite.getHeight(); double hue = Color.getHue(color); double saturation = (color >> 24 & 0xff) / 255.0; for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { int c = sprite.getPixel(x, y); ...
c9492e0f-6ad3-4ff5-854b-a80bee2167da
5
public void ge_operation(TextArea area,String ope,String left_var,String right_var,String prefix){ if(ope.equals("+")) { String instr = prefix + "%add"+String.valueOf(add_num)+" = add nsw i32 "+left_var+", "+right_var+"\n"; area.append(instr); add_num = add_num+1; ...
49d5e35f-6cdb-47fe-b5b1-2c2417b2600a
6
@Override public boolean equals(final Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (! (obj instanceof StringMessage)) { return false; } StringMessage other = (StringMessage) obj; if (text == null) { if (other.text != null) { return false; } ...
14323601-2a3a-4712-8f3e-a290ba2300f7
2
public int compareTo(KeyRegistrationRecord o) { int thisVal = this.base64key.hashCode(); int anotherVal = o.base64key.hashCode(); return (thisVal<anotherVal ? -1 : (thisVal==anotherVal ? 0 : 1)); }
620f2f87-45b8-4995-8747-f5690aa9f7e6
2
public void move() { //class of paddle motion x += dx; //the paddle moves only in the x place with a dx change in position if (x <= 2) //sets a limit to the paddles' motion to the left of the screen (it's two because each dx change is of 2 pixles) x = 2; //if the user tries to go beyond that p...
181b918e-351f-4f7f-9332-ae39e60e4fee
9
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { Player player = null; if (sender instanceof Player) { player = (Player) sender; } if (args.length == 0) { if (player == null) { sender.sendMessage(ChatColor.RED+"This command can o...
b34191f4-40a4-4c63-ab54-e6278369b3c6
2
private static String detectWebAppDir() { String rootClassPath = PathKit.getRootClassPath(); if (rootClassPath.indexOf("\\WEB-INF\\") != -1) { String[] temp = rootClassPath.split("\\\\"); return temp[temp.length - 3]; } else if (rootClassPath.indexOf("/WEB-INF/") != -1) { String[] temp = rootClassPath....
60954e59-3138-4686-a76d-abb04154f5f9
8
public void something() { gT.populate(); lT.lookupTablepop(); l.file(); while (l.scncnt < l.temp.length()) { int nextIn = l.scan(l.temp); if (nextIn == -9999) { break; } //System.out.println(nextIn); nextState = ...
ad406685-178a-4fa8-b643-9f027f86cb00
2
public void InsertaInicio (int ElemInser) { if (VaciaLista()) { PrimerNodo = new NodosProcesos (ElemInser); PrimerNodo.siguiente = PrimerNodo; } else { NodosProcesos Nuevo = new NodosProcesos(ElemInser); NodosProcesos Aux = PrimerNodo; while (Aux.siguiente !=PrimerNodo) Aux = Aux.siguiente; ...
19ea7e48-d2b9-4716-8292-b9c7a79e1696
8
@Override public void propagate(boolean force) { if (!force && !isReady()) return; // memory logic is here int index = 0; for (int i = 0; i < in_addr.length; i++) { if (in_addr[i].out(0)) index += 1<<i; } if (in_mode.out(0)) { // write mode storage[index] = 0; for (int i = 0; i < in_data...
ca689f0a-a229-49fc-ac75-47f9dea5b319
0
public DeleteTool(AutomatonPane view, AutomatonDrawer drawer) { super(view, drawer); }
f1c72c9b-d0f8-4214-9aa9-6748a91a62bd
6
public Rectangle computeBound() { int minX = Integer.MAX_VALUE, maxX = 0; int minY = Integer.MAX_VALUE, maxY = 0; for (Level l : levels) { for (Piece p : l) { minX = Math.min(p.x, minX); minY = Math.min(p.y, minY); maxX = Math.max(p.x + p.type.width*2,...
0db1fba4-43c2-4e3f-91da-1de0b7f03df1
3
public UniversalNamespaceCache(Document document, boolean toplevelOnly) { examineNode(document.getFirstChild(), toplevelOnly); if (AzotConfig.GLOBAL.DEBUG && isDebug()) { System.out.println("The list of the cached namespaces:"); for (String key : prefix2Uri.keySet()) { ...
f68c3a52-d8ac-46d2-bad5-3ad872d4526f
2
public Point devide(double d) { if (properties != null) { for (int i = 0; i < properties.size(); i++) { set(i, get(i) / d); } } return this; }
348a7741-71e1-4d43-b5ad-2d86e376a711
9
public void act() { //Check voor victims binnen bereik. Voeg punten toe en verwijder victim wanneer gevonden. List<Actor> victims = getObjectsInRange(radius, Victim.class); for (Actor victim : victims) { HelicopterWorld world = (HelicopterWorld)getWorld(); world.addScore(...
7516cb31-bbc2-4f84-a2f5-fe58f4182186
6
public Receipt checkin(Car car, boolean isHandicapped) { if(isHandicapped) { if(!freeHandicappedParkingSpace.isEmpty()) { ParkingSpace space = freeHandicappedParkingSpace.removeFirst(); space.car = car; filledHandicappedParkingSpace.put(car.registrati...
ac4a67d2-999c-4019-a16a-dca173b312e7
7
private String[] getIndexes(final Object data) throws DataClassException { Map<Index, String> indexValuePair = new EnumMap<Index, String>(Index.class); Field[] fields = data.getClass().getDeclaredFields(); for (Field field : fields) { System.out.println(field); if (field....
c3ef32bc-870f-48bc-aa30-172fd4855038
0
public void setHeight(double height) { this.height = height; }
cf97c794-a36e-4483-8bb1-e1ad4cc70df7
3
private void testAdd(String start, DurationFieldType type, int amt, String end) { DateTime dtStart = new DateTime(start, ISOChronology.getInstanceUTC()); DateTime dtEnd = new DateTime(end, ISOChronology.getInstanceUTC()); assertEquals(dtEnd, dtStart.withFieldAdded(type, amt)); assertEqua...
1cbccbec-184b-469d-8594-d3792b46e4df
0
public void configureForOpen(String protocolName, String currentDirectory) { lazyInstantiate(); // adjust title setDialogTitle("Open: " + protocolName); // adjust approve button setApproveButtonToolTipText("Open selected file"); // Set the Accessory state. setAccessory(openAccessory); // Set the A...
ed942386-421d-40b5-aac9-acf7f17341c5
3
public void setupSlide(Slide newSlide){ currentSlide = newSlide; slideID = currentSlide.getSlideID(); slideName = currentSlide.getSlideName(); layeredPane = new JLayeredPane(); layeredPane.setBounds(0, 0, (int) (presentation.getWidth()*scalingFactorX), (int) (presentation.getHeight()*scalingFactorY)); lay...
b341baea-a07b-4e95-bdee-d0be81c4e668
6
@Override public void doing(Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException { String type = request.getParameter("type"); String phone = request.getParameter("phone"); if (phone == null || phone.equals("") || type == null || type.equals("")) return; String...
af7bf297-bf11-479e-b19b-dc43982ffb68
9
private void animate() { GreenfootImage back = new GreenfootImage(worldWidthInPixels, height); switch (direction) { case LEFT_TO_RIGHT: xPos += speed; break; case RIGHT_TO_LEFT: xPos -= speed; break; } back.drawImage(originalImage, Math.round(xPos), 0); setImage(back); time++; if (time ...
8ecab205-8861-405c-8978-94d9397e9045
0
public final void setSite(IServiceProvider value) { privateSite = value; }
26e999d2-cc9d-4fc4-8ff4-93e280ffa36d
2
public boolean setTailleLigne(int nvTaille){ if(nvTaille >= MIN_TAILLE && nvTaille <= MAX_TAILLE){ Integer taille = nvTaille; propriete.setProperty("taille", taille.toString()); return true; } else{ return false; } }
5b40e53d-2c94-4c24-97d9-dbb5aad90aa0
7
private boolean checkForWinSWT() { if (logicField.checkForWin()) { final Shell dialog = new Shell(GuiSWT.shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); Font fontForDialog = new Font(StartAllVersionHere.display, "Arial", 14, SWT.BOLD | SWT.ITALIC); RowLayout layoutForDialogWindow = new RowLayout...
939a8ccb-4aaf-407d-8c6b-7d37c839d3ab
4
public ArrayList<Usuarios> getAll(){ PreparedStatement ps; ArrayList<Usuarios> usuarios = new ArrayList<>(); try { ps = mycon.prepareStatement("SELECT * FROM Usuarios"); ResultSet rs = ps.executeQuery(); if(rs!=null){ try { ...
2b55e529-3ce9-45cc-9bc8-d6369cdf3eee
2
public ResultSet execute(String query) { try { Statement stm = this.con.createStatement(); if(stm.execute(query)){ return stm.getResultSet(); } return null; } catch (SQLException e) { LogHandler.writeStackTrace(log, e, Level.SEVERE); return null; } }
6a1e0d33-b1e1-4687-a3ba-7a4a10a07864
0
public void increment() { count.incrementAndGet(); }
cc941123-859d-46bb-b323-032d805f67d0
0
@Override public String getGUITreeComponentID() {return this.id;}
fa3148ca-4658-4fcb-a854-20e8df5f8cd9
2
public void componentRemoved(ContainerEvent e) { if (e.getChild() instanceof CPPaletteFrame) { CPPaletteFrame frame = (CPPaletteFrame) e.getChild(); for (CPPalette palette : frame.getPalettesList()) { controller.getMainGUI().setPaletteMenuItem(palette.title, false); } } }
f28109a6-6d31-4f7c-a762-8869aba87e5f
4
public AirNowData parseSiteInfo(InputStream is){ try{ AirNowData data = new AirNowData(); BufferedReader reader = new BufferedReader(new InputStreamReader(is)); String curLine; while ((curLine = reader.readLine()) != null){ String[] lineParts = curLine.split("\\|"); if (lineParts.length == 21){ ...
0e56a323-180d-48d8-98ce-b0ae52daf75f
4
@Override public boolean equals(Object obj) { if (obj instanceof Question) { Question o = (Question) obj; return o.getQuestionText().equals(getQuestionText()) && o.getAnswerText().equals(getAnswerText()) && o.getPrompt().equals(getPrompt()) ...
8b50301f-dc1f-40e2-8603-e750fb6559ed
7
public static void main(String[] args) { int[] testArray = {3, 7, 17, 25, 33, 47, 56, 62, 65, 66, 68, 70, 78, 89, 92}; ArrayList<Unit<Integer, String>> testArrayList = new ArrayList(); BinarySearch search = new BinarySearch(); for (int i : testArray) { testArrayList.add(new U...
b4f84825-7785-4e55-9028-f9af9371a845
1
public RTsemBuffer () { Buffer buff = new Buffer(); Producer p = new Producer(buff); Consumer c = new Consumer(buff); c.start(); p.start(); System.out.println("\n\n"+"RTsemBuffer: Threads are running ..."); try { p.join(); // Give consumer 10s to complete its work, then stop it. Thread.sleep(1000...
1202a03d-4435-48af-b3e7-228550a7f0a0
1
public VariableStack mapStackToLocal(VariableStack stack) { /* * There shouldn't be any JSR blocks remaining, but who knows. */ /* * The innerBlock is startet with a new stack entry (return address) It * should GOTO immediately and never complete. */ LocalInfo retAddr = new LocalInfo(); retAddr.s...
f0c42fb6-4c40-4778-af36-1468279a8e44
1
public void addEdge(int i, int j) { // System.out.println(i + " " + j); if (!adj[i].contains(j)) { adj[i].add(j); } }
a6ade0e7-840b-414f-ae74-e2c06d1bc0e8
5
@Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof Theater)) { return false; } Theater other = (Theater) object; if ((this.id == null && other.id != null) || (thi...
2872e6d6-7ab3-4066-9ba0-932ad0f1d459
8
private void resize() { width = getSkinnable().getWidth(); height = getSkinnable().getHeight(); if (getSkinnable().isKeepAspect()) { if (aspectRatio * width > height) { width = 1 / (aspectRatio / height); } else if (1 / (aspectRatio / height) > width) { ...
7c437bd1-1a56-4d88-8508-b35218791196
3
NPCHandler() { for(int i = 0; i < maxNPCs; i++) { npcs[i] = null; } for(int i = 0; i < maxListedNPCs; i++) { NpcList[i] = null; } for(int i = 0; i < maxNPCDrops; i++) { NpcDrops[i] = null; } loadNPCList("npc.cfg"); loadNPCDrops("npcdrops.cfg"); loadAutoSpawn("autospawn.cfg"); }
848a14d1-7ddf-4d7d-a902-174bf05af1f2
1
public static double[] invVector( double[] inVector ) { int m = inVector.length; double[] outVector = new double[m]; for ( int i = 0; i < m; ++i ) outVector[i] = 1 / inVector[i]; return(outVector); }
6270c00b-7c53-4cdc-8f2e-4f80cc1b965b
2
public static String concatenateStrings(String... strValues) { String retValue = null; if (null != strValues) { StringBuilder sbValue = new StringBuilder(); for (String strValue : strValues) { sbValue.append(strValue); } retValue = sbValue.toString(); } return retValue; }
8950c009-bb18-44c9-bf68-5bdcc6fe121c
7
public void doLaunch () { JavaInfo java = Settings.getSettings().getCurrentJava(); int[] minSup = ModPack.getSelectedPack().getMinJRE(); if (ModPack.getSelectedPack().getMinLaunchSpec() <= Constants.buildNumber) { if (users.getSelectedIndex() > 1 && ModPack.getSelectedPack() != null)...
303b3aed-f5e6-496c-be83-bc2d9ee22d3b
3
public static void main (String [] args) { try { Options options = new Options(); options.addOption("cp", "c_port", true, "Client port"); options.addOption("h", "host", true, "Server host"); options.addOption("p", "port", true, "Server port"); CommandL...
2b94322b-ae9f-4810-a007-04f1e034f042
6
@Override public String toString() { final StringBuilder str = new StringBuilder(); if (this.creditCardNumber != null) { str.append("CREDIT_CARD_NUMBER").append("=").append(this.creditCardNumber).append("\n"); } if (this.expiryDate != null) { str.append("EXPIR...
c78fba14-bfa5-49b3-adc0-5a020f8647fa
0
public void setContract(String contract) { Contract = contract; }
21eb9696-26b6-478f-937b-00b0e2b707d5
3
private void firstLoad() throws SQLException { if (initialLoad) { if (gui.connection != null) { int columns = rsltMetaData.getColumnCount(); for (int i = 1; i <= columns; i++) { this.tableCellRenderer.setColumn(i, rsltMetaData.isAutoIncrement(i), rsltMetaData.isNullable(i)); } in...
bb9cbc4d-4f89-4a86-92d0-3e50c2cc92a8
4
@Override public void sort(int[] array) { int i, j, b = 0; int[] c = new int[100]; for (i = 0; i < 100; i++) c[i] = 0; for (i = 0; i < array.length; i++) { c[array[i]] = c[array[i]] + 1; b = 0; } for (j = ...
7a66a311-81a9-4eb4-83b2-4e9cdb8d469f
2
public static void main(String[] args) { Communicator communicator = new Communicator(); communicator.startListening(); // if(!communicator.portsAreValid()){ // System.out.println("Invalid Ports!"); // System.exit(1); // } // // //String gridString = GridStrings.getGrid(1); // String gridString = ...
ba7cb543-b060-44a0-8c07-3aaa9d0719c4
4
private int getEnd(int offs) throws BadLocationException { int length = getLength(); for (int i=offs;i<length;i++){ char c = getText(i, 1).charAt(0); if (c == ' ' || c == '\t' || c == '\n'){ return i; } } return length; }
ffaf48b8-f5f0-4839-a8e2-dede69a59f2d
8
@Override /* * actionPerformed is used for the login button * gets the username and to fields and sets them to * username and connectedTo variables * then remoes the login panel * and refreshes the layout * then calls the initChatComponents */ ...
b618f515-2992-4a2a-bd0b-f7d8cc713f5c
1
private void bootStrap(){ try { JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(""); String[] myServices = peer.getServices(); String providerString=myServices[0]+ ";login=anis;passwd=123456"; provider = peer.getProvider(providerString); ...
ea258bdb-fc51-4c69-afa6-c8a84a2e4de9
2
public Metrics(final Plugin plugin) throws IOException { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null"); } this.plugin = plugin; // load the config configurationFile = getConfigFile(); configuration = YamlConfiguration.load...
2e0e722e-9396-48c7-bc4b-10c0d603baad
7
public ArrayList<HashMap<String, Double>> extractMostCorrelated(double cutoff){ ArrayList<HashMap<String, Double>> rt = new ArrayList<HashMap<String, Double>>(); HashMap<String, Double> mostCorrelated = new HashMap<String, Double>(); HashMap<String, Double> mostCorrelatedFDR = new HashMap<String, Double>(); Has...
5698268b-bfc5-4e9e-ac26-5a0047acd575
7
public static String extractBuiltYear(String sourceText) { String[] lines = sourceText.split("\n"); String result = ""; for (int i = 0; i < lines.length; i++) { if (lines[i].contains("Approx Yr Blt")) { try { String[] subStrings = lines[i].split(" "); for (int j = 0; j < subStrings.length; j++) {...
8540e946-19bc-46f1-9a96-5d46a300fe47
4
@Override public void run() { boolean quit = false; while (!quit) { for (int x = -tile_generate_area / 2; x < tile_generate_area / 2; x++) { for (int y = -tile_generate_area / 2; y < tile_generate_area / 2; y++) { Point playerloc = zoneHandler.getPlaye...
344de021-6f3e-4963-8c77-420627c8c1d2
0
@Override public void setValue(Object o) { // TODO support setting (by pushing properties to parent) throw new UnsupportedOperationException("Not supported yet."); /* String[] vals=o.toString().split("/"); if(vals.length>0) { this.getParent().setValue(MediaProperty.VORBISFIELD_ENCODERSOFT...
2ee3908b-d8f1-4c70-a6fa-39e3a91bbc27
5
@Override public void paintComponent(Graphics graphics) { Graphics2D graphics2D = (Graphics2D) graphics; graphics2D.translate(-camera.getLocation().getX(), -camera.getLocation().getY()); for (Tile tile : getTiles(Layer.BACK)) { tile.render(graphics, Layer.BACK); } ...
0a63dc44-9204-41d8-8893-488532bf8208
9
private static void stackOperation(IStack stack) { do { System.out.println("---------------------------------------------------------------------------------------"); System.out.println("[1] capcity / [2] clear / [3] isEmpty / [4] peek / [5] size / [6] pop / [7] push / [8] toString"); System.out.println("...
86b6c3fd-da1e-42a6-8c0e-d330257b86ac
1
public void eval(EvalContext context) { int stmtId = context.newStmtId(); context.logEntering("Evaluating Fun<" + name + ">@" + stmtId + " ctx@" + context.id); StringBuilder builder = new StringBuilder(); int len = params.length; for(int i=0; i<len; i++) { String varN...
d1dc36e6-3d68-44aa-b62b-5709727090a4
6
public void addDegreeToStudent(int studentId, int degreeId) { if(!isValidId(studentId) || !isValidId(degreeId)) { return; } Student student = studentDao.getStudent(studentId); Degree degree = degreeDao.getDegree(degreeId); if(student != null && degree != null) { for(Degree d : student.getDeg...
ec896564-70c8-4389-8da8-c0543a6d2f7f
2
@SuppressWarnings( "unchecked" ) public void load( String fn ) { try( ObjectInputStream is = new ObjectInputStream( new FileInputStream( fn ) ) ) { int n = is.readInt( ); for( int i = 0; i < n; i++ ) add( i, ( T ) is.readObject( ) ); } catch( IOException | ClassNotFoundException e )...
d3188c96-6773-4354-aafc-79cce52799ec
3
private void loadResource(File var1, String var2) { File[] var3 = var1.listFiles(); for(int var4 = 0; var4 < var3.length; ++var4) { if(var3[var4].isDirectory()) { this.loadResource(var3[var4], var2 + var3[var4].getName() + "/"); } else { try { this.m...
eac54dc4-9fa3-470f-a080-7a9aebd0d74a
7
public void load() { if( ready ) return; InputStream INP = BasicEngine2D.getResource(FileName); inner = BasicEngine2D.last; if( INP==null ) { error=1; wreck=true; return; } AudioInputStream AIS = null; try { AIS = AudioSystem.getAudioInputStream( new BufferedInputStream( INP ) ); } catch (Unsupported...
4f8d79a2-200f-4586-98e8-9619c068463e
2
public boolean isConserved(int pos) { int countNonZero = 0; for (int i = 0; i < countMatrix.length; i++) if (countMatrix[i][pos] > 0) countNonZero++; return countNonZero == 1; }
6dfde395-9331-49e0-bd0e-43e8c172cbd8
3
@Test public void ToolTest() { ArrayList<Keyword> tool = new ArrayList<Keyword>(); //tool.add(loadKeyword(171)); //oven tool.add(loadKeyword(172)); //knife //tool.add(loadKeyword(173)); //spoon try { DialogTest.currentDialog.updateState(tool, null, null); } catch (WrongStateClassException e) { //neve...
330b9f57-a55e-4755-91a9-0e2899fa1a90
8
private int getFascia( int ora){ if (ora>=7 && ora<=11) return 0; if (ora>=12 && ora<=14) return 1; if (ora>=15 && ora<=18) return 2; if (ora>=19 && ora<=23) return 3; return -1; // -1 f...
fd9b2eac-2c0c-43a7-9179-04ec84b1b5d0
3
@Override public Confirmation deliver(final Message message) { int count = 0; for (final Permissible permissible : Bukkit.getPluginManager().getPermissionSubscriptions(this.permission)) if (permissible instanceof CommandSender && permissible.hasPermission(this.permission)) { ...
e6647d3d-7804-4f2d-8e03-f5656c9815b8
0
public PieChart() { }
00b4fe32-2da6-4961-b57a-e42674f76220
8
public static BOMColumnDescription create(BOMColumn column) { switch (column) { case ID: return new BOMColumnDescription<String>(column.ordinal(), "id", "ID", 4, new TextFormat(), new CountingAggregator()); case TITLE: return new BOMColumnDescription<Strin...
ec89addb-17b1-4e9a-95a9-67f791d85232
1
public boolean addProtocol(FileProtocol protocol) { if (isNameUnique(protocol)) { protocols.add(protocol); // Also add it to the list of protocols stored in the preferences Preferences.FILE_PROTOCOLS.add(protocol.getName()); return true; } return false; }
60c1965c-eaad-418c-9806-7d7a32c04a87
9
public Record next() { Record rec = reader.next(); Leader l = rec.getLeader(); boolean is_utf_8 = false; if (l.getCharCodingScheme() == 'a') is_utf_8 = true; if (is_utf_8 && unicodeNormalize == Normalizer.NONE) return(rec); List<VariableField> fields = rec.getVariable...
1a0c322e-fa1b-4cdf-8551-044a1ebe49ee
1
private void initDBManager() throws DataBaseServerException { dbManager = new DataBaseManager(); System.out.println("Start loading data from backup..."); try { dbManager.loadDataFromBackup(); } catch (IOException e) { throw new DataBaseServerException("Unable to l...
f0ff72d2-eeb1-48dd-9e99-ba9faa56857e
1
public String toString() { if(this.link==null) { return "(deta:" + String.valueOf(data)+ ", link: null"; } else { return "(deta:" + String.valueOf(data)+ ", link: " + this.link.toString() + ")"; } }
da015140-b355-487d-8751-b7050209bc48
1
private void setEhtoY(Pelihahmo h, int y){ if (h==h1){ ehtoh1y = y; } else { ehtoh2y = y; } }
045e4d7e-4b90-4bd9-a686-1923a704b876
7
public static String toUTF8(String str){ if(str == null){ return null; } StringBuffer sb = new StringBuffer(); for (int i=0; i< str.length(); i++) { char c = str.charAt(i); if(c >= 0 && c <= 256){ sb.append(c); } else{ try{ byte[] b = Character.toString(c).getBytes("UTF-8"); for...
430c1eec-39a7-47fc-b2dc-37b37316846c
1
@Override public void addClientConnectListener(ConnectOnServerListener listener) { if (clientConnectListenerList != null) { clientConnectListenerList.add(ConnectOnServerListener.class, listener); } }
1ce88f47-588d-456f-9475-59e4b8fa447a
2
@Override public void gameRenderObjects() { if (dbImage == null) { dbImage = frame.createImage(dbWidth, dbHeight); if (dbImage == null) { return; } } dbg = dbImage.getGraphics(); dbg.setColor(Color.WHITE); // The Screen dbg.fillRect(0, 0, dbWidth, dbHeight); dbg.setColor(Color.green); // L...
80581813-8b8e-41ca-be71-d4731e0d0aa8
7
private static final byte getTypeFromString(String type) { switch (ScoreKeywords.getIDFromKeyword(type)) { case "var": return VAR_ARRAY; case "bool": return BOOL_ARRAY; case "char": return CHAR_ARRAY; case "float": return FLOAT_ARRAY; case "int": return INT_ARRAY; case "string": ...
8d8b70fb-6b52-4df1-94c7-3ffd6ac8e42c
7
private void startClustersMonitor(){ try{ // Create a new selector Selector selector = Selector.open(); // Create a new non-blocking server socket channel ServerSocketChannel serverChannel = ServerSocketChannel.open(); serverChannel.configureBlocking(false); InetSocketAddress isa = new Ine...
e9657aa6-50f6-4e25-b660-fb564dadd968
3
public static float pideFloat(String texto) { InputStreamReader flujo=new InputStreamReader(System.in); BufferedReader teclado=new BufferedReader(flujo); String cadnum; float numero=0; boolean correcto; do { try { correcto=true...
a3996c0b-a720-47c6-b52c-c7b6054fe160
9
public Dimension minimumLayoutSize(Container target) { synchronized (target.getTreeLock()) { Dimension dim = new Dimension(0, 0); if (eastComponent != null) { Dimension d = eastComponent.getMinimumSize(); dim.width += d.width + getHgap(); dim.height = Math.max(d.height, dim.height); } if (w...
8b496f57-d916-4a08-b180-831adcf3693f
0
private void foo(T internal2) { int compareTo = internal.compareTo(internal2); }
70006fe7-f921-402d-b51f-71aebebbfcc3
2
public static void close() { if (connection == null) { return; } try { connection.close(); } catch (SQLException e) { throw new RuntimeException(e); } }
80bf799d-d83c-4293-a4a1-af856f703b96
8
public LinkedList<Edge> findAugmentingPath () { //BFS Algorithm begin Queue<Vertex> queue = new LinkedList<Vertex>(); LinkedList<Edge> edges = new LinkedList<Edge>(); boolean containsSink = false; for(int i=0;i<numVertices;i++){ getVertexByIndex(i).setColor(Vertex.WHITE); getVertexByIndex(i).setPa...
8a19b6df-b8f9-49bd-9908-19eccc5b781b
7
private JSONWriter append(String string) throws JSONException { if (string == null) { throw new JSONException("Null pointer"); } if (this.mode == 'o' || this.mode == 'a') { try { if (this.comma && this.mode == 'a') { this.writer.write('...
664e6da9-fc07-420d-9843-3b6b70159831
0
public Boolean getIsBattingFirstTurn() { return isBattingFirstTurn; }
61597196-b3b1-48e4-8e8f-a4fe2adac159
9
public ArrayList<String> listarLinks() throws GlobalException, NoDataException{ try { conectar(user, pass,ip,port,db); } catch(ClassNotFoundException ex) { throw new GlobalException("No se ha localizado el Driver"); } catch (SQ...
a7b2b905-3458-441f-b96c-fd67944e34b1
3
private synchronized void seriesTableValueChanged(javax.swing.event.ListSelectionEvent evt) { Logger.getLogger(MainInterface.class.getName()).entering(MainInterface.class.getName(), "seriesTableValueChanged"); if (booksDirectory == null) { Logger.getLogger(MainInterface.class.getName()).exit...
12ddcda5-3f3b-4be2-afd1-cfd08ea50f07
8
private void computeLineClear(int linesCleared) { assert linesCleared >= 0 && linesCleared <= 4 : linesCleared; if (linesCleared == 0) { combo = 0; return; } totalLines += linesCleared; int lineScore = 0; String msg = ""; switch (linesCleared) { case 1: lineScore = 100; msg = "Singl...