method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
69a1798f-a86b-4e2e-bb5a-155e838028c1
3
public static String insert(String s, String insert, int offset) { if (s == null) { return null; } if (insert == null) { return s; } if (offset > s.length()) { offset = s.length(); } StringBuilder sb = new StringBuilder(s); sb.insert(offset, insert); return sb.toString(); }
ccb0e331-d791-4963-87bf-0c0d1d5bd104
3
@Override public void run() { try(DatagramSocket workerSocket = new DatagramSocket()) { Sender statusSender = new Sender(workerSocket, remotePort, remoteAddress); if(!isValid()) { statusSender.sendObject(new ERR(ERR.FILE_ALREADY_EXISTS, "The requested file" + request.fileName + " aleardy exists on ...
ed696119-8be1-40cb-8e11-56360cab6feb
5
public static void outputResults(LinkedList largest_formable_words, int formable_word_amount){ WordNode next_node; System.out.print("\nLongest Word"); if(largest_formable_words.getSize() > 1) System.out.print("s"); System.out.print(":"); if(largest_formable_words.getSize() > 0){ next_node = larges...
cf4eb7ff-f55c-44e4-a550-188c0b6332a0
1
@Override public String toString() { if (isDisposed()) { return "VCNTreeItem [Disposed; isWrap=" + isWrap + ", id=" + id + ", foregroundColor=" + foregroundColor + ", isBold=" + isBold + "]"; } return "VCNTreeItem [name = " + getText() + ", isWrap=" + isWrap + ", id=" + id + ", foregroundColo...
e0cf75ce-f325-4005-bad6-ca13c6cbb6aa
4
public void removeZone(String zoneName) { //Intermediate zone variable for use when iterating Zone currentZone; //The index of the zone to be removed. Initialised at 999 so that if //no zone match is found, there is no risk of inadvertently removing //an unintended zone (as would be the case if initialised ...
78790e4b-9cd3-4877-a5bc-1c1738db5e71
1
private static String formatLabel(String label) { return (label == null ) ? "" : label; }
08a1350b-e7b5-4550-8458-7347a5e978a8
4
private void check(int i,int j){ if(i<1|| i<1 || i>gridSize|| j>gridSize){ throw new IllegalArgumentException(); } }
78adc109-cad9-4698-b58e-cf98ce2d80d6
5
public Iterator iterateHashCode(final int hash) { // /#ifdef JDK12 cleanUp(); // /#endif return new Iterator() { private int known = modCount; private Bucket nextBucket = buckets[Math.abs(hash % buckets.length)]; private Object nextVal; { internalNext(); } private void internalNext() { ...
25ecb12d-8bb3-48c2-a1fc-8fe50c620861
8
public void Profile(){ int opt; System.out.println("Email: "+email+", Nombre: "+name+", Fecha de ingreso: "+fecha); do{ System.out.println("\t1.Cambiar mi email"); System.out.println("\t2.Cambiar mi password"); System.out.println("\t3.Cambiar mi nombre"); ...
93e668f8-def1-4a17-b89e-fa968b3dfa45
1
public Object[] getReaders() { Object[] readers = null; try { readers = PCSCManager.getTerminalsList().toArray(); } catch (CardException e) { JOptionPane.showMessageDialog(null, "Nenhuma leitora instalada", "Erro", JOptionPane.ERROR_MESSAGE); ...
554403ae-e170-4a4d-a8f3-018e8f44f112
2
private static void studyDatasetBaseLyon() throws IOException, Exception { //study network // for mac neatANN.readInputDataFromExcel(AppProperties.fileName(), AppProperties.answerColNumber()); // for pc //neatANN.readInputDataFromExcel("c:/Users/Administrateur/Desktop/these_softP...
c9a54fee-b433-4caa-9c3c-6e67ee33cb66
2
public void send() { try { Socket client = new Socket(SHOST, SPORT); ObjectOutputStream os = new ObjectOutputStream(client.getOutputStream()); Message m = new Message(this, "Client", "hello"); os.writeObject(m); os.flush(); ObjectInputStream is = ...
f071717e-fbc9-4fea-9c9b-a89006508b52
1
@Override public Class<?> getColumnClass(int i) { return Icon.class; }
b2848897-6084-4b92-97ff-f329ff8d3aa6
2
public void removeRoster (Roster roster) { if (roster == null) return; if (rosters.contains(roster.getRosterID())) { rosters.remove ((Object)roster.getRosterID()); } }
fe4ef8e2-feec-41d6-9a85-e3a7bbccfcfb
9
public void emulate() { ran = false; // tracks if the whole program ran boolean good = true; // tracks if each step was successful // Set the next piece of code to be executed. String code = (String) view.getMemoryTable().getValueAt(programCounter, 0); // Star...
117be2f8-55f7-49d3-9857-2f8114727629
7
static private final boolean cons(int i) { switch (b[i]) { case 'a': case 'e': case 'i': case 'o': case 'u': return false; case 'y': return (i==0) ? true : !cons(i-1); default: return true; } }
dcb9b075-bfc9-478f-b11f-1bd1050c0dc0
2
private void acao137() throws SemanticError { if (idAtual instanceof IdentificadorMetodo) { if (((IdentificadorMetodo) idAtual).getTipo() != null) throw new SemanticError("Método sem tipo esperado"); } else { throw new SemanticError("Identificador de método esperado"); } idMetodoChamado = (Identifi...
83c2463c-2c2a-4e8c-8154-9067ba818c8a
2
private void createBoardImage() { Graphics2D g = (Graphics2D) gameBoard.getGraphics(); g.setColor(new Color(0x999999)); g.fillRoundRect(0, 0, BOARD_WIDTH, BOARD_HEIGHT, Tile.ARC_WIDTH, Tile.ARC_HEIGHT); g.setColor(new Color(0x999999)); for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS...
aa40f77b-b945-45c5-8390-741cd219dd68
1
public CycSymbol readKeyword() throws IOException { String keywordString = (String) readObject(); if (!(keywordString.startsWith(":"))) { keywordString = ":" + keywordString; } return CycObjectFactory.makeCycSymbol(keywordString); }
66850e70-8be7-4e12-9dde-c344a84fc75e
2
public void setPlayer(int player) { if(player == 2 || player == 1) { this.player = player; } }
28946cbe-92c9-4adb-ab68-164c527381f1
3
private void doSubLWorkerTerminated(SubLWorkerEvent event) { Object[] curListeners = getInferenceListeners(); List<Exception> errors = new ArrayList<Exception>(); for (int i = curListeners.length - 1; i >= 0; i -= 1) { try { ((InferenceWorkerListener) curListeners[i]).notifyInferenceTerminated...
ce6134f0-5b90-4a4c-8a99-8151aceb470f
7
private User authenticate(Request request) { // Extract authentication credentials String authentication = ((ContainerRequest) request).getHeaderString(HttpHeaders.AUTHORIZATION); if (authentication == null) { throw new AuthenticationException("Authentication credentials are required...
bc44cf29-f0a3-4d04-a83b-d7202f5852c0
2
public void deletePerson(Person person, ArrayList<Person> list) { int answer = JOptionPane.showConfirmDialog(null, "Do you really want to delete " + person.getName() + "?", " CONFIRMATION ", JOptionPane.YES_NO_OPTION);// displaying // JOptionPane.YES_NO_OPTION // Confi...
a8d27be1-65d9-4767-9d8d-1ca029b05787
4
public void doDead() { if (!isShell) { switch (ai.getDirection()) { case LEFT: setAnimation(new String[]{"koopaDeadLeft"}); break; case RIGHT: setAnimation(new String[]{"koopaDeadRight"}); ...
5f4bed6e-54dd-46f4-90e3-7db64c1951d2
6
public Set<Map.Entry<K,Double>> entrySet() { return new AbstractSet<Map.Entry<K,Double>>() { public int size() { return _map.size(); } public boolean isEmpty() { return TObjectDoubleMapDecorator.this.isEmpty(); } publi...
d24b96da-aa6d-4d35-b018-493e5c9e0a68
9
@Override public GameState use(Game game) { List <Npc> npcs; npcs = game.getCurrentRoom().getNpcs(); Kill killablenpc = null; for(Npc creature : npcs){ if(creature instanceof Killable1){ killablenpc = (Kill) creature; } ...
3d783832-1e33-4904-9435-80ca61f1f4e9
1
public float[] decodeFloats() { float[] res = new float[decodeInt()]; for (int i = 0; i < res.length; i++) { res[i] = decodeFloat(); } return res; }
821ce4b2-e970-4ad8-ba9a-e3120b47f427
0
public ChatServer(ServerInfo serverInfo, int verbose) { this.serverInfo = serverInfo; this.clients = new HashMap<String, Socket>(); this.clientHandlerThread = new Thread[(int) serverInfo.getMaxClients()]; this.verbose = verbose; }
f59a3fea-898b-4d6f-a172-10add30410ef
1
public boolean equals( Object o ) { Tuple<T, E> tuple = ( Tuple<T, E> ) o; return tuple.getFirstElement().equals( firstElement ) && tuple.getSecondElement().equals( secondElement ); }
9db15da8-d100-457d-9a15-979f20a30ef9
3
private boolean zzRefill() throws java.io.IOException { /* first: make room (if you can) */ if (zzStartRead > 0) { System.arraycopy(zzBuffer, zzStartRead, zzBuffer, 0, zzEndRead-zzStartRead); /* translate stored positions */ zzEndRead-= zzStartRe...
9585973c-d417-4b87-ba20-38552ba803aa
9
public InputElement makeInput(WebNode node) { //TODO how to keep consistent with isInput method? Use reflection? if (SubmitButton.isSubmit(node)) return new SubmitButton(node); if (Button.isButton(node)) return new Button(node); if (Textarea.isTextarea(node)) ...
24808b64-12bb-489c-95fa-0085df208c9b
5
public void searchSolicitacoes() { facesContext = FacesContext.getCurrentInstance(); ArrayList<String> caminhos = new ArrayList<>(); ArrayList<String> colunas = new ArrayList<>(); ArrayList<String> propertyName = new ArrayList<>(); ArrayList<Object> listObjetos = new ArrayList<>(); caminhos.ad...
76c01612-f49d-4e0d-b1a9-6c21dffa3b31
9
public BorderPane bottom() { BorderPane bottom = new BorderPane(); AnchorPane slider = new AnchorPane(); Rectangle rectangle = new Rectangle(); rectangle.autosize(); rectangle.setWidth(490); rectangle.setHeight(60); rectangle.setFill(Paint.valueOf(Color.WHITE.to...
82dbb88c-46ac-4929-b157-eba1d0d66979
8
public void generateTerrain(int par1, int par2, byte[] par3ArrayOfByte) { byte var4 = 4; byte var5 = 16; byte var6 = 63; int var7 = var4 + 1; byte var8 = 17; int var9 = var4 + 1; this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGener...
875cd182-d2cd-4347-80ec-9774cb632f7c
9
public String listItem(User user) { String result = ""; result += "Music: " + super.getName() + " - " + getArtist() + "\n"; if (super.getNumberOfCopies() <= 0 && !super.isElectronicallyAvailable()) { result += "Currently unavailable.\n"; } else { result += "Availa...
3a6f1c51-d73a-43a1-a8dd-c5881e4727e2
2
public void notifyListeners() { if (!boardListener.isEmpty()) { for (int i = 0; i < boardListener.size(); i++) { boardListener.get(i).boardChanged(); } } }
9b7b7cca-9c53-47e8-abb7-1b61fa658793
8
@Test public void testBogusStream() throws IOException { final String filename = "test.wav"; final File file = File.createTempFile("testBogusFile", filename); FileOutputStream out = new FileOutputStream(file); final Random random = new Random(); for (int i=0; i<8*1024; i++) {...
92e2755f-857b-40c9-8aab-26a934c8c567
5
private int readEscapeChar() { int c = getc(); if (c == 'n') c = '\n'; else if (c == 't') c = '\t'; else if (c == 'r') c = '\r'; else if (c == 'f') c = '\f'; else if (c == '\n') ++lineNumber; return c; ...
5f5ae0c6-839b-42a1-bc5e-10f7138fefec
5
public static void main(String args[]) { /* float line[] = staggeredLine(17, 2.0f) ; I.say("Line is: ") ; for (float f : line) I.add(((int) (f * 10))+", ") ; //*/ //* final int SIZE = 16 ; List <Coord[]> regions = genRegionsFor(SIZE, 3) ; I.say(regions.size()+" regions gene...
f2397999-a8f9-4c04-8033-4c244c78de34
4
public static void checkOutputPath(File targetPath) { if(targetPath != null && targetPath.exists()) { // shows a window which asks you if the old content of the output directory should be deleted // int confirmation = JOptionPane.showConfirmDialog(null, "Output directory not empty. Delete all contents of ...
2d170035-cb60-42b9-90ef-e75913e45d53
6
private void parseClassDeclaration() throws SyntaxError { accept(Token.CLASS); parseIdentifier(); accept(Token.LCURLY); while(isStarterDeclarators(currentToken.kind)) { parseDeclarators(); parseIdentifier(); switch(currentToken.kind) { ca...
1896c843-5cc5-4219-9a2a-14640fdb704f
5
public JMenuItem createSaveItem() { save = new JMenuItem("Save"); save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, ActionEvent.CTRL_MASK)); save.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { if (...
0df47fa7-8561-48cc-a2cf-17380abbc966
6
private void emitTableConstants() throws IOException { for ( Table table : mModel.getTables() ) { writer.emitSingleLineComment( "Table " + table.name + " constants " ); writer.emitField( "String", SqlUtil.IDENTIFIER( table ), EnumSet.of( Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL ), "\"" + table.name +...
0a0c4307-4a7e-4b26-b12c-2b53191cd7af
3
public boolean exists(String value) { if (!isEmpty()) { ListElement current = head; while (current != tail.next()) { if (current.getValue().equals(value)) { return true; } current = current.next(); } ...
f357ccd7-a8f7-4aad-a7f5-6ab9491ec655
4
public boolean create(Class<?> layout) { Field[] publicFields = layout.getFields(); if (publicFields.length == 0) { Utilities.outputError("The given table layout '" + layout.getName() + "' for the table '" + m_name + "' has no public fields."); return false; } String createTable = "CREATE TABLE `...
c5775d72-f857-444d-a741-9acadf3bb9a5
6
private void bowlToHtml(StringBuffer buf) { buf.append("<div>"); // Text information about bowl id buf.append("<div style=\"width: 200px; height: 40px; text-align: center;font-size: 25px; font-weight: bold; font-family: 'Comic Sans MS', cursive, sans-serif\">" + "Bowl #" + round + "," + bowlId ...
f678cb39-2e30-48b5-bc39-8ba9fb4448ed
0
public static void RegDespesaUI(){ RegDespesaUI nome; }
2c055c1f-fc7f-4bb8-aea7-0eb46a8b2658
8
public static Object[] subtract(Object[] A, Object[] B) { // Short-circuit for empty sets (A-{} = A and {}-B = {} = A) if (A == null || A.length == 0 || B == null || B.length == 0) return A; // Clones A, so as to leave it unaffected Object[] Ac = A.clone(); /* Iterates through all the current names, ...
b17a7dfb-6bd2-4bc5-a6a8-2a588ec130ee
3
public Disciplina pesquisaDisciplina(String codigo) throws DisciplinaInexistenteException { Disciplina listaDisc = null; for (Disciplina e : disciplina) { if (e.getCodigo().equals(codigo)) { listaDisc = e; break; } } if (listaDisc == null) { throw new DisciplinaInexistenteException("Pesquisa...
c6695297-cb32-4925-bc79-d12ed5653672
9
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { if (method.equals(Connection.class.getMethod("commit"))) { throw new SQLException(); } else if (method.equals(Connection.class.getMethod("rollback"))) { ...
d7385e0d-292d-4d70-ab86-1798ab967b63
2
public double[] rawItemStandardDeviations(){ if(!this.dataPreprocessed)this.preprocessData(); if(!this.variancesCalculated)this.meansAndVariances(); return this.rawItemStandardDeviations; }
7903ae9d-dc7b-4fba-84ae-4c90bcb01281
1
public boolean onTyhja() { return suoritustasot.get(0).onTyhja() && seuraavaArvollinen == null; }
ec13eeeb-15f3-44bd-8924-d006470ee42e
7
public MonopolyResult buy (int playerID, int eventID, boolean buy) { try { if(!_gameManager.isGameExists() || !_gameManager.isGameActive()) { return new MonopolyResult("no active game"); } Event last = _gameManager.ge...
57e893e5-cf75-47e2-8322-f7f32b016c29
0
public void remove() { throw new UnsupportedOperationException(); }
be5fd5ac-3e44-42d3-a24d-99212cd3126d
4
public void indexDocument(Document doc, int docID) { HashSet<String> seenWords = new HashSet<String>(); for (int i=0 ; i<doc.terms.size() ; i++) { String term = doc.terms.get(i); // XXX: this is too simplistic. we must count multiple iterations // of the same term in a doc. if (!invIndex.containsKey(...
7d213427-7fef-489e-a346-9187642e9edf
6
private void saveShieldStorage() { if (shieldStorageConfig == null || shieldStorageConfig == null) { // Don't save if there is nothing to save return; } // Make a backup of the old storage file just in case File backupFile = new File(directory, "shields.yml.old"); try { // Create backup file i...
fe0cd8c4-3b12-434d-b5ad-3a974b97c009
4
private static void run() { long ct; ArrayList<MovingComponent> mcal = new ArrayList<MovingComponent>(10); mcal.add(ba); mcal.add(pd); while(true){ // for(int i = 0; i < breakout.sizeOf(); i++){ // breakout.returnComponent(i); // } for (int i = 0; i < mcal.size(); i ++){ mcal.get(i).upda...
7e3a55df-9655-4357-9675-d211f3cf74de
2
public static int setMax_period(int new_max_period) { if (new_max_period > 0 && new_max_period >= min_period) { max_period = new_max_period; return max_period; } else { return -1; } }
7d0d252b-d839-4faa-ab82-18c793a7067c
3
public boolean isSet(String key) { if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null"); if (!keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": unknown key: " + key); return keys.get(key).getResultCount() > 0 ? true : false; }
4daf79ea-0f10-4fb3-b501-3d2ff5a30082
0
protected AutomatonEnvironment getEnvironment() { return environment; }
524d709a-7134-472a-88a3-5db5e0f43422
2
public boolean isDebugging() { return debugging || (parent != null && parent.isDebugging()); }
da0f5bdc-f051-442c-abc7-bdc3bceaa2f1
9
@Override public boolean okMessage(Environmental oking, CMMsg msg) { if((oking==null)||(!(oking instanceof MOB))) return super.okMessage(oking,msg); final MOB mob=(MOB)oking; if(msg.amITarget(mob) &&(msg.targetMinor()==CMMsg.TYP_GIVE) &&(msg.tool() instanceof Coins)) { final String currency=CMLib....
f14d1a4c-da6b-4561-84fa-83e0e4917292
2
public boolean isPrefixOf(ArgPosition otherArgPosition) { if (otherArgPosition == null || otherArgPosition.depth() < depth()) { return false; } else { return path.equals(otherArgPosition.getPath().subList(0, path.size())); } }
ea4f9dbc-fb31-4ad5-89be-72588f251cfa
8
private void move(int i, int j) { if(i == 0 && j == 1) facingDirection = FORWARD; if(i == 1 && j == 0) facingDirection = RIGHT; if(i == 0 && j == -1) facingDirection = BACKWARD; if(i == -1 && j == 0) facingDirection = LEFT; moveAmountX += getSpeed() * i; moveAmountY += getSpeed() * j; }
2546dd27-0d63-4ed3-89fb-89f9d1b103e9
5
@Override public void putAll(Map<? extends K, ? extends V> m) { for (Entry<? extends K, ? extends V> entry : m.entrySet()) { put(entry.getKey(), entry.getValue()); } }
aaf19774-1e24-4900-b800-2e5f02eae7fe
6
@Override public void bsp( BSPPeer<NullWritable, NullWritable, NullWritable, NullWritable, NullWritable> peer) throws IOException, SyncException, InterruptedException { int nbRowsBlocks = nbRowsA / blockSize; int nbColsBlocks = nbColsB / blockSize; int nbBlocks = nbRowsBlocks * nbColsBlocks; int b...
fcdfa6af-c695-40a9-bbd2-5356f52a4052
1
private Component getHeader() { JButton jbAdd = new JButton("add"); jbAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { Vector<String> newRow = new Vector<String>(); newRow.add("AaValue" + delete_me++); ...
8c558515-a843-4b9f-9c6b-0b63f8a45d2f
3
public void setLeft(PExp node) { if(this._left_ != null) { this._left_.parent(null); } if(node != null) { if(node.parent() != null) { node.parent().removeChild(node); } node.parent(this); } ...
fb14ab31-3bc1-48a1-9062-ce4d77bc66ca
7
public static void main(String[] args) { PorterStemmer s = new PorterStemmer(); for (int i = 0; i < args.length; i++) { try { InputStream in = new FileInputStream(args[i]); byte[] buffer = new byte[1024]; int bufferLen, offset, ch; bufferLen = in.read(buffer); off...
e488f780-0f0d-478e-b804-967e2667fbc0
9
private Object number() { int length = 0; boolean isFloatingPoint = false; buf.setLength(0); if (c == '-') { add(); } length += addDigits(); if (c == '.') { add(); length += addDigits(); isFloatingPoint = tr...
cf125212-bdd7-4733-8a6c-7e21441c0c11
4
@Override protected void run() { int cycles = 20; EDA eda = (EDA) algorithms.get("EDA"); eda.setConfiguration(this); ClonAlg clonAlg = (ClonAlg) algorithms.get("ClonAlg"); clonAlg.setConfiguration(this); // Calculate max iterations for (int cycle = 0; cycle < cycles; cycle++) { maxIterations...
bc6d8e0f-29b6-4eda-a3c0-25d8bafa194d
1
private void doDeleteAll() { System.out.print("\n[Performing DELETE ALL] ... "); try { Statement st = conn.createStatement(); st.executeUpdate("TRUNCATE TABLE COFFEES"); } catch (SQLException ex) { System.err.println(ex.getMessage()); } }
53b1f7e2-13c2-4ed0-a6e2-7797fc0c97ee
0
private Document createDocument(String data) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setCoalescing(true); factory.setIgnoringComments(true); factory.setIgnoringElementContentWhitespace(true); factory.setValidating(false); Docu...
4998d1b9-0152-479d-9b6b-d0850540c1e6
1
public void felvisz(int i, int j, int k){ if(k==0){ sajat[i][j]=1; sajat[a][b]=9; a=i; b=j; } else{ sajat[i][j]=2; sajat[c][d]=9; c=i; d=j; } }
5d8f3155-146e-49e0-a249-ba86acde9393
3
public void removeProp(Entity entity) { if(props.contains(entity)) { props.remove(entity); if(!noChildren()) { for(int x = 0; x<propChildren.length; x++) { propChildren[x].removeProp(entity); } } } }
521e5c87-5e3b-4615-b6d0-19db3dc086c0
0
public JobSchedulerBuilder withJobName( String jobName ) { this.jobName = jobName; return this; }
f60bf793-dfdf-47d3-92f6-ee26be446592
2
private Node findBestNode(){ Node best = open.get (0); for (int i = 0; i < open.size(); i++){ Node temp = open.get (i); if (best.getFinalCost() > temp.getFinalCost()){ best = temp; } } return best; }
ce990e90-a2a2-4560-8c65-cd8def7ed2e2
2
private static Dimension getScaledDimension(Dimension imgSize, Dimension boundary) { int original_width = imgSize.width; int original_height = imgSize.height; int bound_width = boundary.width; int bound_height = boundary.height; int new_width = original_width; int new_height = original_height; // first check if ...
d5d38e09-ec24-4f94-bde1-745635db9cf5
3
public void calculate() throws IOException { OggStreamAudioData data; // Calculate the headers sizing OggAudioInfoHeader info = headers.getInfo(); handleHeader(info); handleHeader(headers.getTags()); handleHeader(headers.getSetup()); // Have each audio packet ha...
1ca39418-cd23-43e3-880f-6bb43e890b27
4
public static double getDouble() { double x = 0.0; while (true) { String str = readRealString(); if (str == null) { errorMessage("Floating point number not found.", "Real number in the range " + (-Double.MAX_VALUE) + " to " + Double.MAX_VALUE); } ...
2e77c64d-b4e0-4d80-b603-b6d7d9747124
2
@Override public T get(int index) { if (index <= size()) { MyList<T> node = first; for(int i = 1; i < index; i++) { node = node.right; } return node.value; } return null; }
83fa763a-4c4f-4fe4-a47d-d9673ea673cb
1
private static void calcParam() { if(!fullScreen) { height = defHeight; width = defWidth; } }
e203024d-1432-4578-8426-be54c0cee689
7
public int[] importsCount(String[] requires){ n = requires.length; graph = new boolean[n][n]; visited = new boolean[n]; graph = new boolean[n][n]; for(int i=0; i<n; i++){ for(int j=0; j<n; j++){ if(requires[i].charAt(j)=='Y') graph[i][j] = true; ...
539f17ac-5b19-4a35-823f-114aa09d4c8c
0
public int[] getPixels() { return pixels; }
f4c3dbe7-8b24-477c-8463-2f3f6f583df6
0
public Send(){ super(); }
841adc60-0494-4f3b-a52e-5ec108db534d
0
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub }
485e4a28-eee4-4d7d-9c2c-d12253b46f1c
2
private int read() throws IOException { if (reader != null) return reader.read(); else if (input != null) return input.read(); else throw new IllegalStateException(); }
b420941e-3b43-417b-b41c-ccdc085c4ba8
0
public String getCode() { return code; }
4644c69f-9a4f-46c8-a954-8f2ada4c471f
2
private void RangeCheck(int index) { if (index >= size || index < 0) { throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); } }
9ae638bc-1bab-496a-bc78-af1b33ef7e69
4
public static Matrix frustum(float left, float right, float bottom, float top, float zNear, float zFar) { if (zNear <= 0.0f || zFar < 0.0f) { throw new RuntimeException( "Frustum: zNear and zFar must be positive, and zNear>0"); } if (left == right || top == bottom) { throw new Runt...
579566ae-310e-4406-bf3c-44c0a50c9b33
6
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); Debug.print("Action performed on: " + o); if(o == okButton) { // create a new Ferm object Hop i = new Hop(); i.setName(txtName.getText()); i.setAlpha(Double.parseDouble(txtAlpha.getText())); i.setCost(txtCost.g...
3bac4a99-643b-4161-a364-9b6a83c13504
2
private void jComboBoxCommandeClientInterlocuteurItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxCommandeClientInterlocuteurItemStateChanged // si changement ou choix interlocuteur if (evt.getStateChange() == ItemEvent.SELECTED) { Interlocuteur interlocuteur ...
4b7cb537-70ec-46a5-9761-afd2e38690cc
9
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if (!validateFecha(fechaOferta)) { errors.add("fechaOferta", new ActionMessage("error.fecha.invalida")); } if (!validateTelefono(telefono)) { ...
9bf7d34b-c980-47c0-acba-c2ee4f7488bd
0
private void setResourceURL(URL url) { resource_url = url; }
40a18390-28b7-4be3-8f3a-7b812f7a1261
3
private ctrlDisco() { //Facs = new File("./Data/facturas"); //Clientes = new File("./Data/clientes"); //Coches = new File(":/Data/coches"); if (!Clientes.exists()) { Clientes.mkdirs(); } if (!Coches.exists()) { Coches.mkdirs(); } if...
59f53488-85a4-49b1-9703-548931ca7580
9
public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[29]; for (int i = 0; i < 29; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 6; i++) { ...
83b13987-d49b-44c5-996d-546c7074cfa7
0
public String getName() { return Name; }
0044d8e7-f156-42f5-9d9e-5570b58a4c79
2
public void loadProperties() { try { FileInputStream fis = new FileInputStream(new File(Main.USER_PROPS)); props.load(fis); } catch (IOException e) { initProperties(); } if (!validProperties()) initProperties(); this.setBounds(new Integer(props.getProperty("X")).intValue(), new Integer(pro...
14565e0f-eff8-4995-acf7-1450599312d8
6
public void testSaveStranogGosta() { Osoba o = new Osoba(); o.setImePrezime("Alen Kopic"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); try { o.setDatumRodjenja(sdf.parse("1992-10-21")); } catch (java.text.ParseException p) { System.out.println(p.toString()); } o.setAdresa("Vitkova...
9310d3e9-e200-42a2-b637-dc378979d4d2
4
public static String[] generateInitialData(final int accountsNumber, final int transferNumber) { List<Future<String>> futures = new ArrayList<>(); ExecutorService threadPool = Executors.newFixedThreadPool(2); futures.add(threadPool.submit(new Callable<String>() { @Ov...