method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
6369af57-3b32-40dd-bfbe-07683142ada8
2
private void initializeControls(Composite parent) { setLayout(new GridLayout(3, false)); viewsList = new TabListWidget(this, "Views", views); viewsList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); if(!views.isEmpty() && !editors.isEmpty()) { LineWidget line = new LineWidget(this, LineDi...
81417af8-b22f-49fd-aa5f-5487cf2aa017
0
public void setNumero(int num) { this.numero = num ; }
7f1ae34f-b148-4541-8a61-0f529f526c55
2
public Entity getEntity(int id) { for (Entity e : entities) { if (e.getID() == id) { return e; } } return null; }
478573b7-c2ad-4842-b14b-98e90f81ec26
8
public static void insertTimeAndLocationSickContacts() { int numSickContacts = 17652991; int batchSize = 1000; System.out.println("Starting: insert location and time into sick contact table."); try { Connection con = dbConnect(); PreparedStatement update = con.prepareStatement( "UPDATE "+sickConTbl+"...
2515b9a8-29ef-4d65-9f73-04b1a8395a3b
4
private boolean compareMethod(String methodNameOfSignature, List<String> parameterTypesOfSignature) { if(!methodNameOfSignature.equalsIgnoreCase(this.methodName)) return false; if(parameterTypesOfSignature.size() != this.parameterTypes.size()) return false; for(String paramInSignature: parameterTypesOfSi...
94892f66-f0da-41e1-80db-8fbfd4bb6afd
5
private ListNode getNode(int index) { // stores current node ListNode p; // throw exception if invalid index if(index < 0 || index > size()) throw new IndexOutOfBoundsException("getNode index: " + index + "; size: " + theSize); // determine which end of this LinkedList to start traversal if(index < th...
edab15ee-cb93-4848-a5de-7d869641577d
1
public void testSetDayOfWeek_int2() { MutableDateTime test = new MutableDateTime(2002, 6, 9, 5, 6, 7, 8); try { test.setDayOfWeek(8); fail(); } catch (IllegalArgumentException ex) {} assertEquals("2002-06-09T05:06:07.008+01:00", test.toString()); }
e52e9644-8a6b-406f-b7ab-1a6ba40b0ff9
7
public void gen_orderBy(final Map<String, Object> context, final QLSelect select, final PrintWriter out) { final Class<?> clazz = (Class<?>) context.get("class"); if (clazz == null) { throw new IllegalArgumentException("context not contains 'class'"); } final QLOrderBy orde...
b4f7cc9b-c0b0-40ad-969a-80404eb19747
1
public void testGetChronology_Object_nullChronology() throws Exception { GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("Europe/Paris")); assertEquals(GJChronology.getInstance(PARIS), CalendarConverter.INSTANCE.getChronology(cal, (Chronology) null)); cal = new Gregor...
543fde01-2146-4fb5-ae88-16c7f9ea814c
9
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if(!(affected instanceof MOB)) return; final MOB mob=(MOB)affected; if((msg.amISource(mob)) &&(!CMath.bset(msg.sourceMajor(),CMMsg.MASK_CHANNEL)) &&((CMath.bset(msg.sourceMajor(),CMMsg.MASK_MO...
addd88ca-551c-4271-a2b1-759f3f2623fd
3
public static void main(String[] args) { try { BufferedReader buff = new BufferedReader(new FileReader( Global.REPLICA_INPUT_PATH)); String line; int id = 0; while ((line = buff.readLine()) != null) { StringTokenizer st; st = new StringTokenizer(line, Global.REPLICA_DELIM); String replica...
41f22c98-17ff-4340-953b-77718aea3ada
7
public boolean hasWorkAtStop(Stop stop) { List<GoodsType> stopGoods = stop.getCargo(); int cargoSize = stopGoods.size(); for (Goods goods : getGoodsList()) { GoodsType type = goods.getType(); if (stopGoods.contains(type)) { if (getLoadableAmount(type) > 0)...
70978d5f-343d-46ad-a68f-8069fd882bf2
7
public static String getGenChi1LastAtom(String resName){//Get atom name X where generalized chi1 is N-CA-CB-X if( resName.equalsIgnoreCase("val") || resName.equalsIgnoreCase("ile") ) return "CG1"; else if( resName.equalsIgnoreCase("ser") ) return "OG"; ...
c501b87b-11bc-457a-b6b4-aac08d0d65aa
7
public String doCheckin() { if (FacesContext.getCurrentInstance().getExternalContext() .getSessionMap().containsKey("Administrateur")) return type = "Administrateur"; else if (FacesContext.getCurrentInstance().getExternalContext() .getSessionMap().containsKey("Employe")) return type = "Employe"; Sys...
cee359c2-04d1-4d90-ab18-3e13d286f347
6
public void createFinalTables(){ c = new String[index.get(0)+1]; for(int i=0;i<=index.get(0);i++){ c[i] = cArray.get(i); } b = new String[index.size()-1]; Eqin = new String[index.size()-1]; for(int i=0;i<index.size()-1;i++){ b[i] = bArray.get(i); if(eqinArray.get(i).matches("\\s?<=?")) Eqin[...
d6c2add6-be07-4dc5-a30d-0630c90992b6
7
public void calculateSalary(double[] salary){ if(salary == null || salary.length <= 0 ){ return ; } double afterTaxTotal = 0 ,totalTax=0; double[] afterTaxSalary = new double[salary.length]; for(int i = 0 ; i < salary.length ; i++){ if(salary[i] < 4000 && salary[i] >= 0){ afterTaxSalary[i] = salary...
4581e464-ad9d-44a9-9267-6151cf9aea00
3
public double getItemSubTotal(int rowNumber){ if(rowNumber <= 0) throw new IllegalArgumentException("RowNumber must 1 or higher."); Product prod = productIndex.get(rowNumber - 1); Discount disc = prod.getDiscount(); if(disc == null){ return prod.getPrice() * products.get(prod); }else{ double no...
d589c028-21ea-44ed-9999-f968644ab0a0
6
public void printGraphToConsole() { System.out.println(this+":"); List<String> nodeList = this.getVertexes(); for (String node : nodeList) { System.out.println("Node:"+node); List<String> edgeList = this.getIncident(node); for (String edge : edgeList) { Edge edgeObj = this.edgeMap.get(edge); ...
539122a8-1fb7-44c5-be5a-a4a6be8a096c
0
public void setItem(Item item) { this.item = item; }
e815594e-1752-47eb-afb9-fecff223e225
0
private boolean getCellAt(int x, int y) { return currentCells[x * width + y]; }
86c67741-d828-42d0-98bb-f21cc45dc5a7
9
public void drawTapeHead(Graphics g) { int x = table.getX(); int y = table.getY(); boolean drawState = true; int tableTapeHeadColIndex = gui.getSimulator().getTape().getTapeHeadColumnIndex()-tapeBeginColumnIndex; int tableTapeHeadRowIndex = gui.getSimulator().getTape().getTapeHeadRowIndex()-tapeBeginR...
be6253f0-c23e-466d-b8b4-2ed1e4b66e9e
2
public static String joinStrings(String...strs){ if(strs!=null){ StringBuilder sb = new StringBuilder(); for(String str:strs){ sb.append(str); } return sb.toString(); }else{ return ""; } }
58ef8e94-8450-4f15-8284-8d24cdba96c1
5
@EventHandler public void onLogin(PlayerJoinEvent event){ Player Player = event.getPlayer(); if(!Player.hasPermission("NodeWhitelist.Whitelisted")){ if(!Config.GetString("General.WhitelistingWebsite").equals(null)&&(Config.GetBoolean("General.EnableWebsiteMessages"))){ Player.sendMessage(ChatColor.RED + "[I...
0b618e1d-1f6d-43f3-8bd3-d6b3973bc6eb
2
public void updateSubTypes() { if (parent != null && (GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0) GlobalOptions.err.println("local type changed in: " + parent); local.setType(type); }
884fc5f7-1004-43be-b105-fa3f71723207
9
public static BigFloat toBigFloat(final Apfloat from) throws IllegalArgumentException { if (from == null) return null; if (from.signum() == 0) return BigFloat.ZERO; if (from.equals(Apfloat.ONE)) return BigFloat.ONE; final int radix = from.radix(); final int digitBits = toDi...
4dd215fe-9ab8-46e5-b6d8-095d035d4f94
0
@Override public void openAboutView() { String aboutTxt = Constants.PROGRAM_NAME + " " + Constants.VERSION +"\n" + Constants.CREDITS + "\n\n" + settings.getLanguage().getLabel("text_used_libraries") + "\n" + Constants.USED_LIBRARIES; JOptionPane.showMessageDialog(chatGui, aboutTxt, ...
0ad81dfa-ba2e-4a1e-9a26-258bb7e886ad
7
private int binarySearch(int[] A, int target, int start, int end) { int mid = (start + end) / 2; if (target == A[mid]) { return mid; } else if (target > A[mid] && mid + 1 <= end) { if (target < A[mid + 1]) { return mid + 1; } return binarySearch(A, target, mid + 1, end); } else if (target < A[mi...
57612d0c-b25c-498c-a9cc-e81ed95e05a7
9
private void initializeInputControls(){ String useOutStr = appProp.getProperty(KEY_USE_MIDI_OUT); if(useOutStr == null){ checkMidiOut.setSelected(true); }else{ boolean useOut = Boolean.parseBoolean(useOutStr); checkMidiOut.setSelected(useOut); } String outStr = appProp.getProperty(KEY_MIDI_...
cc50d03f-1989-4802-bb91-343ad4b82b5b
0
@Basic @Column(name = "state") public String getState() { return state; }
b0d54900-2314-4f86-8119-0a8607a47d14
3
private synchronized void dequeue(Sim_event ev) { Packet np = (Packet)ev.get_data(); // process ping() packet if (np instanceof InfoPacket) { ((InfoPacket) np).addExitTime( GridSim.clock() ); } if (super.reportWriter_ != null) { super.write("dequeuin...
62b37a09-0157-41fd-82e6-ee26d76dd356
0
@Override public void startSetup(Attributes atts) { super.startSetup(atts); setEnabled(false); addActionListener(this); Outliner.documents.addDocumentListener(this); Outliner.documents.addDocumentRepositoryListener(this); }
fbf55b5b-9bed-4af1-b98f-56a2073e1d15
8
private void BtImprimirHistoricoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtImprimirHistoricoActionPerformed if(TbHistorico.getRowCount() > 0){ HashMap par = new HashMap(); String relatorio, desc = ""; if(CbPeriodo.isSelected()){ ...
86bd6d37-2f26-411d-bd14-70a4176a6843
7
private boolean solveWithHypothesys() throws SudokuException{ System.out.println(""); System.out.println("******* Nouvelle hypothèse ******"); System.out.println(""); Cell cellForHypothesys = null; int lastMinValue = matrix.getMatrixSize(); for(int rowIndex=0; rowIndex < matrix.getMatrixSize(); rowIndex++){...
1a460692-3d5a-434d-a5d9-10779ccf9492
8
protected Ast ParseInput(String code, int whichKind) { java.io.StringReader codeStream; Yylex lexerObj; Ast programElement; java_cup.runtime.Symbol parseTree = null; codeStream = new java.io.StringReader(code); lexerObj = new Yylex(codeStream); try { if(whichKind == PROCEDURE) { Procedu...
4012f55b-56c0-44fe-885c-b8e710584757
3
public void mousePressed(MouseEvent arg0) { log.logp(Level.FINER, getClass().getSimpleName(), "mousePressed(MouseEvent)", arg0.getPoint().toString()); if(model.getPortal().isVisible()) { model.getPortal().mouseClick(arg0.getPoint()); } else if(CheatManager.getInstance().isVisible()) { CheatManager...
9e5897b0-6cea-4f8c-9c92-9feaecf955dc
2
@Override public Meeting getMeeting(int id) { Iterator meetingIterator = allMeetings.iterator(); Meeting nextMeeting; int nextId; while(meetingIterator.hasNext()) { nextMeeting = (Meeting) meetingIterator.next(); nextId = nextMeeting.getId(); if(ne...
de0215ba-b132-40c3-9010-d5a64caa3b40
1
public Tetris() { this.pause = false; this.jatkuu = true; this.pisteet = 0; this.taso = 1; this.rivit = 0; this.alkutaso = 0; this.viive = 2000; this.onkoAI = false; this.pelipalikat = new Palikka[20][]; for (int i = 0; i < 20; i++) { ...
4d9da170-3e6a-4683-b214-c2f78518eec9
0
@Override public AbstractPlay getBest() { ArrayList<AbstractPlay> bestPlays = getBestPlays(); return bestPlays.get(rnd.nextInt(bestPlays.size())); }
e2ff1314-2cff-4f06-b4b9-ddb201ffd4d0
5
public static void merge_arrays(Integer[] a, Integer[] b) { Integer[] merge = new Integer[a.length + b.length]; int i = 0, j = 0, k = 0; while (k < merge.length) { if (a[i] <= b[j]) { merge[k] = a[i++]; } else { merge[k] = b[j++]; ...
bec0205d-4cdb-4406-aa59-a806e7b73a30
9
private Tuple<Vector, Matrix> doLUDecomposition(int which_matrix, Vector b) throws ArithmeticException { Double temp = 0d; Matrix U = clone(); Matrix L = identity(); // Reihenfolge der Vertauschung bei der Pivotstrategie(Permutationen) Vector lperm = new Vector(); ...
d70723fa-986c-44df-b838-c2b70cfe58e8
4
public void resizeMovingACorner(int corner, int posX, int posY){ int newWidth, newHeight; if(corner == Drawable.TOP_LEFT_HAND_CORNER){ newWidth = getWidth() + (getOriginX()-posX); newHeight = getHeight() + (getOriginY()-posY); setWidth(newWidth); setHeigth(newHeight); this.moveOrigin(posX, posY); ...
a4b9dd30-5b0b-499f-bdee-6384b8a1b6cc
6
public Player() { double n = (Math.random() * 10); switch ((int) n) { case 0: name = new String("Stallman"); break; case 1: name = new String("Chewbacca"); break; case 2: name = new String("Someone"); break;...
cff97744-b7dc-4dac-a07a-17a2a04e5b3a
2
public boolean canRollNumber(int playerIndex) { //checks to see if the game status is "Rolling" and that it is actually the players turn to roll if (serverModel.getTurnTracker().getStatus().equals("Rolling") && serverModel.getTurnTracker().getCurrentTurn() == playerIndex) { return true; } else { retur...
ed1b812c-f6d8-410b-bfde-56044066ce54
4
private void initializeReportFile() { if (!record_) { return; } // Initialize the results file FileWriter fwriter = null; try { fwriter = new FileWriter(super.get_name(), true); } catch (Exception ex) { ex.printStac...
31472880-6f9f-4030-9e87-84be981d73eb
5
public boolean equals (Mossa other) { // controlla se due mosse sono uguali if (percorso.length != other.getPercorso().length || pedineMangiabili-other.pedineMangiabili != 0) return false; for (int i=0; i<percorso.length; i++) { if (percorso[i].getX() != other.getPercorso()[i].getX() || percorso[i].ge...
5ee9658b-2195-435b-b0d2-808c1706e5b0
5
public int evalRPN(String[] tokens) { Stack<String> s = new Stack<String>(); Integer a, b; for(int i=0; i<tokens.length; i++){ s.push(tokens[i]); if(s.peek().equals("+")){ s.pop(); //symbol b = Integer.valueOf(s.pop()); a = Integ...
eb0a1dd3-8650-4504-bfaa-dc5ee284dbf3
8
public static int countNeighbours(boolean [][] world, int col, int row){ int total = 0; total = getCell(world, col-1, row-1) ? total + 1 : total; total = getCell(world, col , row-1) ? total + 1 : total; total = getCell(world, col+1, row-1) ? total + 1 : total; total = getCell(world, col-1, row ) ? total + 1...
ac7081e1-acf2-4cbb-90cd-61db8556f628
0
public void onException(Exception ex) { ex.printStackTrace(); }
9bb9265a-d11f-486c-899c-4532d44fbd8a
0
public void setContainers(VertexSet S, ArrayList<Path> P){ this.cityList = S; this.pathList = P; }
6c24b733-8ad1-4d28-9403-db786ba1f3b4
7
public String getResponseTo(String chatName, String sender, String thePhrase) { // Create new phrase for the statement uttered. Phrase phrase = new Phrase(sender, thePhrase); // Get chat object for this chat. Chat chat = getChatFromName(chatName); // Add phrase to chat. ...
b1425e8a-f02a-4261-8b9e-2b670d831554
3
public static final EuclideanNumberPair decipher(BigInteger quotient, int bits, boolean store) { boolean unsafe = false; BigInteger product = inverse(quotient, bits); BigInteger g = gcd(product, quotient); if (g.longValue() != 1) {// Double check common divisor // Make sure that "g" truly is common. l...
4a283039-665e-42b1-990e-62545c15f357
9
protected Object fillMap(Object o, TypeToken typeToken, ITestContext iTestContext) { ITestParamState iTestState = iTestContext.getCurrentParam(); Map<Object, Object> m = (Map<Object, Object>) o; if ( null != iTestContext.getCurrentParam() && null != iTestContext.getCurrentParam().getAttribute(IT...
6241b8db-3e0b-4b89-b2bc-61aea28f0aa2
7
* @throws IOException if a communication error occurs * @throws CycApiException if the api request results in a cyc server error * @throws IllegalArgumentException if the cycObject is not the correct type of thing for * making into an ELMt */ public ELMt makeELMt(Object object) throws IOExceptio...
2ead69aa-b611-4322-8a89-212bc37d5533
5
public String getQuestionText() { String temp = clientTestHandler.getActiveQuestion().getText(); StringBuilder builder = new StringBuilder(temp); boolean canDo = true; final int NEW_LINE = 70; final int RANGE = 50; for (int i = 1; i < temp.length() / NEW_LINE; i++) { ...
3958c72b-5c2a-4832-b67a-9b77c40550ff
3
private static void calcNoOfNodes(Node node) { if (node instanceof Parent) { if (((Parent) node).getChildrenUnmodifiable().size() != 0) { ObservableList<Node> tempChildren = ((Parent) node).getChildrenUnmodifiable(); noOfNodes += tempChildren.size(); f...
8b620fcd-d844-4bd8-92fd-05ca1061a3e7
7
public void render(Bitmap bitmap, int offsetX, int offsetY){ // Establish bounds int xStart = bitmap.x; int yStart = bitmap.y; int xEnd = xStart + bitmap.width; int yEnd = yStart + bitmap.height; // Bounds check if(xStart < 0) xStart = 0; if(yStart < 0) ...
10871cd1-0bb7-4cd8-bdd9-b470ff35404e
1
public void send(PlayerPawn player, int c, String msg) { int id = player.getId(); InetAddress ip= player.getIp(); System.out.println("Sending...\nPlayer: " + id + "\tCmd: " + c + "\n"); String data = String.valueOf(id)+c+msg; byte[] cmd = new byte[512]; try { ...
e4b26488-3905-4c3d-ae2b-b2e6b07c69e0
7
Double getNumber(String strName) { try { return Double.valueOf(strName); }catch(NumberFormatException e) { } if (strName.equalsIgnoreCase("global")) { try { Variable varStore = engGame.varVariables.getVariable(readScriptForCompile()); if (varStore != null && varStore.isNumber()) { r...
cd5a9a25-9e94-4c8f-9772-6dd4ef241402
6
public static void main(String[] args) throws SlickException { try { UIManager.setLookAndFeel("com.jtattoo.plaf.graphite.GraphiteLookAndFeel"); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } String ip = JOptio...
4dd97da8-8169-4e6c-8b7c-6823448090f2
9
public final CanecaSintatico.expressaoMultiplicativa_return expressaoMultiplicativa() throws RecognitionException { CanecaSintatico.expressaoMultiplicativa_return retval = new CanecaSintatico.expressaoMultiplicativa_return(); retval.start = input.LT(1); Object root_0 = null; Token set...
312f75e4-921e-4522-b558-13049bf3ce4f
6
public HTMLBox(Channel channel, List list, String filename, boolean generateJavaScript) { // Note: This code could probably be cleaned up a lot by using the // Element Construction Set from Apache // (http://jakarta.apache.org/ecs/index.html). But I didn't want the // exampl...
49f31f08-5266-4363-83f0-9c1dab647774
2
public boolean Authentification(String login,String pwd){ String requete = "select * from user where Login=? and Password=?"; try { PreparedStatement ps = MyConnection.getInstance().prepareStatement(requete); ps.setString(1,login); ps.setString(2,pwd); ...
b637ce50-ad1b-4f47-97c1-a9f956026a63
6
private double sigmaFunction2(double sigma, double psi){ // bisection method for psi(delta) double psiLow = -10*psi; double pFuncLow = this.psiFunctionQ(psiLow, psi, sigma); double psiHigh = 10*psi; double pFuncHigh = this.psiFunctionQ(psiHigh, psi, sigma); if(pFuncHigh*p...
fb21e4a1-ffd8-40d6-883e-fb6707428033
3
protected void actionPerformed(GuiButton var1) { if(var1.enabled) { if(var1.id == 5) { Sys.openURL("file://" + this.fileLocation); } else if(var1.id == 6) { this.mc.renderEngine.refreshTextures(); this.mc.displayGuiScreen(this.guiScreen); } else { ...
bfa02647-a991-4345-b87d-c4c9109ce06c
1
public Object clone() { final Expr[] p = new Expr[params.length]; for (int i = 0; i < params.length; i++) { p[i] = (Expr) params[i].clone(); } return copyInto(new CallStaticExpr(p, method, type)); }
c5b34202-6148-45d1-bf71-4736f4064b7c
4
public static boolean isValidLocation(Coordinate location){ boolean result; if(location.getX() < Defines.basicMazeSize && location.getX() >= 0 && location.getY() < Defines.basicMazeSize && location.getY() >= 0) result = true; else result = false; return result; }
9ed8319a-bf03-4199-ad50-079b1631c9ef
9
private static PecasDecorator menu_principal(Scanner input,Gabinete g) throws IOException{ int opc; imprimeOpcoes(); opc= input.nextInt(); switch(opc){ case 1: if ( !(g.getDescricao().contains(TipoPeca.PLACA_MAE.toString())) ) return new Placa_Mae(g, menu_marcas(input, Placa_Mae.getListaMarcas())); else ...
4c4c294d-568a-4f9b-8786-0d2651adaa9e
3
public List<Component> getAllComponentsOfType(String componentType, int processorType) { // If this is the first build state, we should be querying for processors, // which require a special query if(componentType.equals(Build.buildStates[0])) { return getAllProcessorsOfType(processorType); } // Not ...
17cf8992-c1d4-4a4b-80d6-c219e1e1efc6
3
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()); ...
b39fc46e-095f-493c-accd-d5090e7f5d6a
2
public static boolean isLinear(Production production) { if (isRightLinear(production) || isLeftLinear(production)) { return true; } return false; }
5f729c15-ec6f-4655-b846-f6cdb31bf313
3
private Position getNextPosition(int cardinalCount) { switch (cardinalCount){ case 'N': return new Position(myPosition.getX(), myPosition.getY()-1); case 'W': return new Position(myPosition.getX()-1, myPosition.getY()); case 'S': ...
d30e47d2-739b-4ff1-8fa4-3cba69789e8f
3
public Identificador get(String nome, int nivel) throws IdentificadorNaoDefinidoException{ for (int i = nivel; i >= 0; i--){ if(tabela.containsKey(i)) if(tabela.get(i).containsKey(nome)) return tabela.get(i).get(nome); } throw new IdentificadorNaoDefinidoException(nome, nivel); }
de1e383d-aa2b-4eb4-a89f-3c84ba32a061
5
private String getTable( String wikiText, String tableName, int fromIndex ){ int start = wikiText.indexOf( "{{" + tableName, fromIndex); if(start > 0){ final int length = wikiText.length(); int braces = 0; for(int end = start; end<length; end++){ ...
5e1a7be7-557b-419b-8de0-54ace7c5e56a
9
public static Keyword differentSpecialist(ControlFrame frame, Keyword lastmove) { { Vector arguments = frame.proposition.arguments; Cons argumentvalues = Stella.NIL; boolean unboundargsP = false; Stella_Object value = null; lastmove = lastmove; { Stella_Object arg = null; Vect...
b273818d-d7ad-406d-a202-166a68715645
2
private static byte[] getFileBytes(String fileName) throws IOException { FileInputStream fis = new FileInputStream(fileName); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buff = new byte[1024]; int i; try { i = fis.read(buff); while (i != -1) { bos.write(buff, ...
73780483-d331-4c30-be68-cc968b3931cc
1
public void testWithFieldAdded2() { DateTime test = new DateTime(2004, 6, 9, 0, 0, 0, 0); try { test.withFieldAdded(null, 0); fail(); } catch (IllegalArgumentException ex) {} }
98a85e96-4838-456f-8bdb-46bb319db844
3
private void animate(int target_x, int target_y, int duration){ float time = duration/(float) animate_timestep; int steps = (int) time; if (steps < time) steps++; float dx = (target_x - animate.x)/time, dy = (target_y - animate.y)/time; try { for (int i=0; i<steps; i++){ animate.x += d...
0aadb037-bce5-472c-8b39-bafe7f6c6ca1
7
private TermPart getTermPart(Object cl_o, String str_term) { String lstr_t = str_term.trim(); if(lstr_t.isEmpty()) { return null; } BTLog.debug(this, "getTermPart", "TERM_" + lstr_t + "_TERM"); int li_index = 0; TermPart lcl_invoke = new TermPart(cl_o); while(li_index < lstr_t.length()) { ...
968ef04e-28b5-49f8-9864-910a767f1b26
5
public void readFile(RegulationFileIterator regulationFileIterator) { String chromo = ""; int lineNum = 1; for (Regulation reg : regulationFileIterator) { // Different chromosome? flush all if (!chromo.equals(reg.getChromosomeName())) { if (verbose) Timer.showStdErr("\tChromosome '" + reg.getChromosome...
5ddfb546-1759-4f9f-9baf-d617d87ea98f
7
private static String readNextWord() { char ch = TextIO.peek(); // Look at next character in input. while (ch != TextIO.EOF && ! Character.isLetter(ch)) { TextIO.getAnyChar(); // Read the character. ch = TextIO.peek(); // Look at the next character. } ...
4ea7b8c2-8427-42b4-825c-20e1de8ec2d6
4
public static List<DisplayMode> getDisplayModes(){ List<DisplayMode> returnableModes = new ArrayList<>(); try { DisplayMode[] modes = Display.getAvailableDisplayModes(); for(DisplayMode mode :modes){ if(mode.getFrequency()==60&& mode.getBitsPerPixel()==32){ ...
615803c9-aa67-4e64-9d59-67df1845a939
5
private void deliver (Message m) { int source = m.getSource(); int destination = m.getDestination(); if (destination != -1) { unicast(m, getDelay()); } else { int delay; boolean drop = false; boolean first = true; /* Broadcast. */ for (int i = 1; i <= r.n; i++) { drop = (source == i && Uti...
175b3ec3-c5e5-4e31-9d26-d42185bde29e
5
public void setAvatar(byte[] img, int px) { switch(px) { case 16: gravatar_16px = img; break; case 32: gravatar_32px = img; break; case 64: gravatar_64px = img; break; case 128: gravatar_128px = img; break; case 256: gravatar_256px = img; break; default: gravatar_256px = img; break; } }
dc57c2a5-9313-4870-bc24-02d217d9be54
7
int test1() { for (int i = 0; i < 10; i++) { if (m2(i)) { if (m2(20)) { if (m3() > 100) for (int j = 0; j < 10; j++) { int y = i; if (y > 5) if (m3() < 100) { System.out.println("heyyy"); } ...
f71b3b0c-74ed-4ef9-9f5e-e4834b372ac2
8
@Override public void transform(double[] src, double[] dst) { // TODO Auto-generated method stub for (int i = 0; i < 3; i++) temp2[i] = src[i]; temp2[3] = 1; for (int i = 0; i < 3; i++) { dst[i] = 0; for (int j = 0; j < 4; j++) { dst[i] += matrix[i][j] * temp2[j]; } } for (int i = ...
a12aaaac-7f18-4e32-aca6-1766a542755a
8
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 http://down...
feaa3378-abbc-4795-9acc-7246c0ede167
1
public void run() { while (running) { receivePacket(); } }
236c2811-2afc-47ba-bea9-8ee9c4dd3ade
4
public void nameConfirmed(String s,boolean isAvail) { if (s.compareTo(name) == 0) { nameStatus.setText((isAvail)?"Name available!":"Name unavailable"); name = s; joinButton.setEnabled(isAvail); if (isAvail && joinChatPressed) joinChat(); else joinChatPressed = false; } else { joinButton.se...
d279e978-bd7a-459d-a7a7-0c5c1cc1f3a2
5
@Override public void mousePressed(MouseEvent e) { System.out.println("pressed"); GeoRef mp = new GeoRef(points.size(), e.getX(), e.getY()); double distance = 10; for (GeoRef p : points) { if ((p.distance(mp) < distance)) { sele...
0cfea698-c32d-420a-8c39-712449ed5eb0
4
public static ArrayList<Vector2D> getTriangleLineIntersects(Triangle A, Line2D B) { ArrayList<Vector2D> intersects = new ArrayList<Vector2D>(); ArrayList<Line2D> lines = new ArrayList<Line2D>(); lines.add(A.getAB()); lines.add(A.getAC()); lines.add(A.getBC()); for (Line...
559fcca2-6b3e-4d1c-82a9-a1c320c5c8b9
8
public void removeRule(String ruleNumber){ String[] numberSplit = ruleNumber.split("-"); Set<String> directoryKeys = directories.keySet(); int i = 0; int j; for(String key: directoryKeys){ j = 0; for(Permission permission: directories.get(key).getPermissi...
0bf5f27a-867d-4f26-9c2c-bfd32eb905eb
0
@Override public int hashCode() { return number.hashCode(); }
603c315a-3a01-4d01-81d5-fa3daa30f515
7
public void dispatch() { fillMarkerList(); for (numOfThreads = numOfChunks / 2; numOfThreads > 0; numOfThreads /= 2, numOfChunks /= 2) { if (numOfChunks % 2 == 1) { oddFlag = true; } else { oddFlag = false; } mergeThreads = ...
bcf5cda0-5e4a-4ae5-bee0-ac31634c18a0
2
private void unloadChunks() { for (CoordXZ unload : trimChunks) { if (world.isChunkLoaded(unload.x, unload.z)) world.unloadChunk(unload.x, unload.z, false, false); } counter += trimChunks.size(); }
1c33c60d-d9f6-4175-bfc0-3a902dda3d6d
3
private int updateMail() { int res = 0; lblError.setVisible(false); if (Validate.notOverSize(tfNyMail)) { if (Validate.isEmailFormat(tfNyMail.getText())) { try { DB.update("update anstalld set mail = '" + tfNyMail.getText() + "' where aid =" + sele...
001aff4f-606a-477f-8ea0-9b597acbe442
0
@Test public void testRankHappyPath() { int key = 4; int result = BinarySearch.rank(N, key); assertEquals(key, result); }
bc4ba736-bcae-4ea9-a4c7-919d692a7f51
8
@Override public void action() { ACLMessage msg = myAgent.receive(msgFilter); if (msg != null) { if(msg.getConversationId() == null) { String log = "ConversationId == null : sender: " + msg.getSender().getLocalName() + "; content: " + msg.getConten...
09a967d5-2606-4082-b825-722058f572e1
5
private void nextPlayer() { if (round == 1) { // Si l'on est dans le premier tour. activePlayer++; // On passe au joueur suivant. if (activePlayer > (nbPlayers-1)) { // Si on depasse le nombre de joueurs total (<=> tous les joueurs ont joue le tour 1). activePlayer--; // On inverse le sens de jeu (<=> le de...
1d129912-8346-48e3-b061-6112852fc18e
7
private static void addMetadata( OtuWrapper wrapper, File inFile, File outFile, boolean fromR) throws Exception { HashMap<String, Integer> caseControlMap = getCaseControlMap(); BufferedReader reader = new BufferedReader(new FileReader(inFile)); BufferedWriter writer = new BufferedWriter(new FileWriter(out...
29cbca58-4c01-4e38-91f9-525588b847fc
8
public static void main(String[] args) { Scanner console = new Scanner(System.in); Guess g = new Guess(); giveIntro(); int numGames = 0; // total number of games user play int totGuesses = 0; // total number of guesses in all games played // while or do while loop ...