method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
80c92903-438b-469e-b001-3801d5cb297b
3
public Topic getTopic(int Id) { Connection connection = ConnectionManager.getConnection(); if (connection == null) { logger.log(Level.SEVERE, "Couln't establish a connection to database"); return null; } try { PreparedStatement ps = connection....
0b5e72bf-836f-4c02-b72a-f44a26136685
5
public void update(long elapsedTime) { Creature player = (Creature)map.getPlayer(); // player is dead! start map over if (player.getState() == Creature.STATE_DEAD) { if(player.getVida()<0) { map = resourceManager.reloadMap(); player=(Creature)map.get...
7c54032f-60d3-455a-8312-9030381fc7f2
9
public final CecilParser.unaryinstruction_return unaryinstruction() throws RecognitionException { CecilParser.unaryinstruction_return retval = new CecilParser.unaryinstruction_return(); retval.start = input.LT(1); try { // C:\\Users\\Shreeprabha\\Documents\\GitHub\\CecilRPi\\src\\org\\raspberrypi\\cecil\\mode...
a549c452-348d-4784-ae1e-76dcb6ae68a7
1
public void printGlyphs(){ for (Map.Entry<Integer,Glyph> entry: glyphs.entrySet()){ System.out.println(entry.getKey() + ": " + entry.getValue().toString()); } }
8f8cd790-033f-43ba-a1f4-c2415f56c6c6
4
public void result() { System.out.println("---------------------------------------------------------------------------"); System.out.println("Nombre de changements de contexte : " + this.nombreChangementsContexte); System.out.println("---------------------------------------------------------------------------"...
88257e5a-5963-4b55-9d9a-d05fe150d7ad
8
public static void reverseLevelOrderPrint(TreeNode<Integer> root) { if(root == null) { return; } Queue<TreeNode<Integer>> queue = new LinkedList<>(); queue.offer(root); Stack<ValueAndLevel> stack = new Stack<>(); int currentLevel = 0; int currentLev...
0abdfa7f-a3f3-434c-b46c-8db518da4e53
1
public void output() { Iterator<TreeValue> step = new TreeIterator<>(root); while (step.hasNext()) { System.out.println(" " + step.next()); } }
03e8dc6f-4445-4bd8-b1bc-0f2a0ae0e27e
4
public static void main(String[] args) { // TODO Auto-generated method stub if(args.length != 2){ System.err.println("Usage: java IMClient <host ip/name> <port>"); System.exit(1); } String hostName = args[0]; int portNumber = Integer.parseInt(args[1]); try ( Socket imSocket = new Socket(hostName,po...
4e3c07a3-82f6-459a-b916-d0a7218a969f
0
public OrcHero(int room) { super(new ThunderStorm(), new SpiralPierce(), 91.0*room, 105.0*room, 70.00*room, 2.0*room, 1.0*room, 30.0*room, "Orc Hero"); } // End DVC
e4f22a02-b731-40cc-bcda-24221d0a30f5
2
public void open(float time, float delay) { if(opening || open) return; startTime = (double)Time.getTime()/(double)Time.SECOND; openTime = startTime + (double)time; startCloseTime = openTime + (double)delay; closeTime = startCloseTime + (double)time; opening = true; closing = false; AudioUtil....
6646f1ca-dca8-4f84-9155-c5909c120135
9
@SuppressWarnings("unchecked") protected T createObject(String line) { String vals[] = line.split(separator); // Create a new instance T tObj; try { tObj = (T) clazz.newInstance(); } catch (Exception e) { throw new RuntimeException(e); } // Populate values int maxFieldNum = Math.min(vals.length...
e4bf51c9-f600-456a-8d7d-bee338f74180
8
private String prepareConfigString(String configString) { int lastLine = 0; int headerLine = 0; String[] lines = configString.split("\n"); StringBuilder config = new StringBuilder(""); for(String line : lines) { if(line.startsWith(this.getPluginName() + "_COMM...
f7fbcea0-4757-4ca5-99fe-daecd802368f
2
public Location GeoCodeAddressByPpostcode(String postcode) { //System.out.println("looking for " + postcode ); for(Location loc : this.locations) { //System.out.println(loc.straatnaam+" == "+straatnaam); if ( loc.postcode.equals(postcode) ) { // System.out.println("Found " + loc.lat +","+ loc.lng ); ...
947367f1-bbf8-493f-aaff-d934388422fd
1
public java.security.cert.X509Certificate[] getAcceptedIssuers() { java.security.cert.X509Certificate[] chain = null; try { TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509"); KeyStore tks = KeyStore.getInstance("JKS"); tks.load(this.getClas...
aa35f1e9-ce8a-4255-b0b2-bd15d28a2833
5
public void openBrace() { if ((Options.outputStyle & Options.BRACE_AT_EOL) != 0) { print(currentLine.length() > 0 ? " {" : "{"); println(); } else { if (currentLine.length() > 0) println(); if ((Options.outputStyle & Options.BRACE_FLUSH_LEFT) == 0 && currentIndent > 0) tab(); println("{"...
062b80f9-bf12-42c1-b81b-9cefa35cb65e
4
private float performCalculations(List<String> parsed, String element, float result, int i) { float n1 = Float.valueOf(parsed.get(i - 2)); float n2 = Float.valueOf(parsed.get(i - 1)); if (OPERATION_PLUS.equals(element)) { result = n1 + n2; } if (OPERATION_MINUS.equal...
101c8a2a-c94d-4904-8a9f-9252927554c3
8
public Object process(Object value, ValueProcessInvocation invocation) throws BeanMappingException { BeanMappingField field = invocation.getContext().getCurrentField(); BeanMappingBehavior behavior = field.getBehavior(); // 每个属性mapping都会有一个behavior,允许覆盖上层 // 判断一下value的null 情况 if (value ...
346f557e-da95-43d7-be40-42b0905bce6c
6
private static Word removeDoubleLetter(Word word) { int currentsize; int previoussize; Word initialword = word.clone(); word = replaceCensoredWord(word); do { previoussize = word.Text.length(); for(int i = 0; i < 26; i++) { char a = 'a'; a += i; word.Text = word.Text.replace("" + a +...
49394f07-2e98-4982-8e17-2089297ecd4f
2
public static boolean isTypeNumber(Class<?> type) { return (type != null && isAssignable(type, Number.class)); }
3a6d1268-826f-419d-95f4-a259fe0dcd63
6
public void queueBytes(int len, byte buf[]) throws IOException { if (closed) { return; } if (hasIOError) { hasIOError = false; throw new IOException("Error in writer thread"); } if (buffer == null) { buffer = new byte[5000]; } synchronized (this) { for (int l = 0; l < len; l++) { buffer...
5e1fc056-a974-4a1f-8d69-53e1fd8de755
3
public EncryptedDeck encryptDeck(Deck deck) throws InvalidKeyException, IllegalBlockSizeException, BadPaddingException { if (e == null) { System.err .println("Cannot encrypt when using decrypting constructor RSAService(gp, gq, gd)"); return null; } EncryptedDeck encDeck = new EncryptedDeck(); ...
2fc62035-25ef-4f63-bd1f-92a81e0a7b7c
3
private void longStart() { // long init in background Task<Void> task = new Task<Void>() { @Override protected Void call() throws Exception { sfLd.start(); imgLd.start(); do { try { Threa...
6312d368-ab5a-489d-9376-ad72ce7cbbf2
4
public void decide(int decision) { if (index<(network.numProposers+network.numAcceptors)) throw new Error("Non-learner should not be deciding a value"); if (decision>=network.numProposers) throw new Error("The decided value was not an initial value..."); synchronized(network) { if (netwo...
6163d782-a494-4177-a09a-90f9d1d56d55
4
public static String guessFileExtensionFromFormat(String format){ switch(format.toUpperCase()){ case "TURTLE": return "ttl"; case "RDF/XML": return "rdf"; case "N-TRIPLE": return "nt"; case "N3": return "n3"; default: return "txt"; } }
083698ac-15fc-457f-91f2-b27a38f5d128
8
public boolean saveSpecificPalette(Component parentComponent, NESPaletteListener listener, int palType, int start, int dur){ if(palType != PPUConstants.IMAGE_PALETTE_TYPE && palType != PPUConstants.SPRITE_PALETTE_TYPE){ System.err.println("Invalid palType:" + palType); return false; } if(start < 0 || start ...
5e32e42c-2495-4e78-bb88-b81965e751b8
5
public boolean rookCheckVertical(int[][]board, int sx, int sy, int x, int y) { if (sy < y) { for (int i = sy + 1; i < y; i++) { if (board[i][sx] != 0) { return false; } } return true; } else { ...
8e7ce9be-c3a2-4a62-80b8-853a4387b9db
8
public int doHit(String counterID, boolean increment) { Connection conn = ConnectionManager.getConnection(); if (counterID == null || "".equals(counterID)) { return -1; } if (conn == null) { return -1; } try { if (increment) { PreparedStatement hitStatement = conn .prepareStatement("IN...
f3623162-dda6-4fbd-b4de-a4fcc0f8cd5d
5
public static int calculateNumberOfTrailingZerosInFactorial(int N){ int countTwo = 0, countFive=0; for(int i = 1; i<=N; i++){ if(i%2==0){ countTwo++; int temp = i; while((temp/2)%2 == 0){ countTwo++; temp/=2; } } if(i%5==0){ countFive++; int temp = i; while((temp/5)%5...
f5656f63-b1fc-4528-af42-3068a801f1cc
8
@Override public void run() { InetAddress group = null; MulticastSocket s = null; try { group = InetAddress.getByName(Main.MULTICAST_ADDR); s = new MulticastSocket(Main.MULTICAST_PORT); s.joinGroup(group); s.setSoTimeout(500); byte[] buf = new byte[1000]; DatagramPacket recv = new...
9b0c7ee7-7056-4969-8db1-aeee75c64b8e
8
public int characterAt(int at) throws JSONException { int c = get(at); if ((c & 0x80) == 0) { return c; } int character; int c1 = get(at + 1); if ((c1 & 0x80) == 0) { character = ((c & 0x7F) << 7) | c1; if (character > 0x7F) { ...
6d922147-6b1f-4888-9d02-33007b873108
2
@Override PreparedStatement prepare(String query) { try { connection = open(); PreparedStatement ps = connection.prepareStatement(query); return ps; } catch (SQLException e) { if (!e.toString().contains("not return ResultSet")) this.writeError("Error in SQL prepare() query: " + e.getMessage(), fals...
14b2a5e5-0512-4cb7-9f4b-10c7eb5afcee
0
public PaneGraph(String titleGraph, List<Coordinates[]> listCoordinates){ this.titleGraph = titleGraph; this.listCoordinates =(ArrayList)listCoordinates; }
83a8a24d-2aa5-44e2-a1cc-9e8a6f9d5135
7
public static List<Integer> getRandomBitonicList() { List<Integer> bitonicList = new ArrayList<>(); List<Integer> list = new ArrayList<>(); Set<Integer> set = new HashSet<>(); int n = 5000, r = 10000; while (list.size() < n) { final int uniform = StdRandom.uniform(r);...
d1c330d1-4e3d-4278-9a8c-8ec428032128
3
public boolean hasPit(int x, int y) { if (!isValidPosition(x,y)) return false; if (isUnknown(x,y)) return false; if (w[x][y].contains(PIT)) return true; else return false; }
720bd603-fcb6-4dbd-bd6d-c21715452dc1
2
public static void main(String[] args) throws Exception { String inFile = args[0]; String outFile = args[1]; boolean append = "append".equals(args[2]); // load file and instantiate class. File may use any valid // BOM marker bytes at the start. System default charset is // used if ...
fbe0672e-2373-45ac-a0f2-ccd28b9454bf
9
public static String display(Object object) { if (object == null) { return null; } try { // Invoke toString if declared in the class. If not found, the NoSuchMethodException is caught and handled object.getClass().getDeclaredMethod("toString"); retu...
4104b416-8c0e-42e5-a739-fc311dbfaaee
5
private void setInfo(InfoLevel infoLevel, String infoMessage, Object... parameters) { Logger.getLogger(InfoInterface.class.getName()).entering(InfoInterface.class.getName(), "InfoInterface", new Object[] {infoLevel, infoMessage, parameters}); switch (infoLevel.stringValue()) { case "INFO": ...
da255332-f9ff-4443-af86-aeb6eb71847f
3
public static Stack<Integer> sortStack(Stack<Integer> stack) { Stack<Integer> buffer = new Stack<Integer>(); while (!stack.isEmpty()) { int temp = stack.pop(); while (!buffer.isEmpty() && buffer.peek() >= temp) { stack.push(buffer.pop()); } buffer.push(temp); } return buffer; }
00eb5689-5da5-465c-94aa-7bb93992ec97
8
private void reload(IFile file) { setPartName(basePartName); this.providerDefinition = null; this.selectedFile = null; if (file == null || !file.exists()) return; if (viewer.getContentProvider() != null) // to avoid one provider trying to interpret an ...
ee545a0e-26a5-4fa6-8a8a-700caa702c66
6
protected boolean isValidSpot(int xStart, int yStart, int xMoved, int yMoved) { //iterated through all possible x and y positions for diagonal movement, returns true if for(int i = 0; i < 9; i++) { if(((xMoved == xStart + i) || (xMoved == xStart - i)) && ((yMoved == yStart + i) |...
8e1bc400-6408-433b-b530-61463cafec5e
8
public boolean isExpired(PlayerAccount acct, Session session, MOB mob) { if(!CMProps.getBoolVar(CMProps.Bool.ACCOUNTEXPIRATION)) return false; if((acct!=null)&&(acct.isSet(PlayerAccount.AccountFlag.NOEXPIRE))) return false; long expiration; if(mob!=null) { if((CMSecurity.isASysOp(mob)||CMSecurity.is...
bb359703-01e8-48fe-a0b1-31cbbf2d7f50
0
public SimpleStringProperty zipCodeProperty() { return zipCode; }
8cb88ccd-a7a2-455b-b8a7-3e076fcbd316
2
private void regulateFPS(final long timeStart) { long timePassed = System.nanoTime() - timeStart; if (timePassed < DELTA_TARGET_NANOS) { long sleepTime = DELTA_TARGET_NANOS - timePassed; long millis = sleepTime / (1000 * 1000); int nano = (int) (sleepTime % (1000 * 1000)); try { Thread.sleep(milli...
ebb816ea-fb1f-4de4-9380-f3c2f5472f34
9
protected Scorpion scorpionMove(short[][][] maze, Human man) {//Horizontal then vertical // This method was written using a different logic than the current one Scorpion tam = new Scorpion(this.getX(), this.getY()); if (tam.samePlace(man)) { return tam; } else { ...
b23e0e58-2a65-4fc8-823f-d5e46f0c21e0
0
public OpenURLAction(){ super("Open URL", null); }
ea38587c-b6f4-41a9-a49f-6cb01e284f73
4
public static boolean Disparo(Cancha cancha, int equipoA, int jugadorA,int equipoD,int jugadorD, Pelota pelota) { float di=cancha.getEquipoX(equipoA).getJugadorX(jugadorA).getDisparo(); di=di*Factorf.factorF(); //centro arco, hay que usar el mas cercano al jugador pero da paja int ...
d6461d8c-a64f-487d-8776-27b521c5d50a
8
public Boolean invalido(String lexema) { String estado = "q0"; char caracter = ' '; int t = lexema.length(); int p = 0; if (!token.equals("") && !token.equals("erro")) { return false; } while (p < t) { caracter = lexema.charAt(p); ...
6b231146-0418-4081-8ca3-c693c7a43daa
6
@Override public void doAction (String o) { if ("Input".equals(o)) { Out.println(Input.getText()); Input.remember(Input.getText()); Output.append(Input.getText() + "\n", Color.green.darker()); Input.setText(""); } else if (Global.resourceString("Game").equals(o)) { new GameQuestion(this); }...
0eb9f35a-7c93-4d90-a578-c0e6e60332bd
0
@Override public int hashCode() { int result = saleId; result = 31 * result + itemId; return result; }
695e73fb-a125-40dc-a6a6-de3ee3c48c2d
5
public void changeNumLayers(int newLayerNum){ // if(newWidth > 0 && newHeight > 0){ int tileSize = parent.tilePanel.getTileSize(); int[][][] temp = new int[tileID.length][tileID[0].length][tileID[0][0].length]; //do this for every layer for(int k = 0; k < tileID.length; k++){ //copy old array ...
5482b82c-ac3b-421f-9607-724956e47758
1
private int countEdges(Graph g) { int edges = 0; while (g.getEdges().get(edges) != null) { edges++; } return edges; }
ace23934-6124-43a0-8536-34a8f5bea730
7
@Override public void deleteReadyFood(ReadyFood rf) throws FoodDaoException { Element rfsElement = (Element) rfDoc.getElementsByTagName("ReadyFoods") .item(0); NodeList rfNodeList = rfsElement.getElementsByTagName("ReadyFood"); boolean deleted = false; if (rfNodeList.getLength() > 0) { for (int i = 0; i...
5366fac0-51c1-469f-a4e2-872b1b5ce1cd
8
public static void printMenu() throws IOException { Key option; do { Terminal term = new Terminal(); term.clear(); term.title("Opciones chorras"); term.out("1.- HelloWord"); term.out("2.- 2+2?"); term.out("3.- Answer to most important question"); term.out("4.- Submenu"); term.out("Q+ Quit"); I...
fb181932-5218-40c7-af48-cf5ca8881edb
4
public CycList<Object> queryVariableLow(final CycVariable queryVariable, final InferenceResultSet rs) throws UnknownHostException, IOException, CycApiException, TimeOutException { CycList result = new CycList(); try { if (rs.getCurrentRowCount() == 0) { return result; } ...
4974dd45-c9df-44ed-add2-8da70f803c7f
8
public static List<Integer> getMSTXAdsID() { List<Integer> result = new ArrayList<Integer>(); Connection con = DBUtil.getConnection(); PreparedStatement pstmt = null; ResultSet rs = null; try { pstmt = con.prepareStatement("select gid from mstx_ads;"); rs = pstmt.executeQuery(); while (rs.next()) { ...
0a55d80b-ce3a-4a81-941b-f037ad7e72e7
6
private void loadScripts() throws IOException { BufferedReader cfg = new BufferedReader(new FileReader(world.getWorkingDirectory() + "data/script_list.txt")); try { int lineNumber = 0; String line; while ((line = cfg.readLine()) != null) { if (line.startsWith("#") || line.trim().length() == 0) { c...
5625cc73-4b3c-4703-b460-67e0e4ca80ff
9
private int paintStr() { //nothing to draw if (words.size() == 0 || words.get(0).getStart() > currentTime) { System.out.println("nothing to do at " + currentTime); return 0; } //already expires if (!words.get(0).exists(currentTime)) { // System.out.println(words.get(0).getLabel().getStr() + ...
d667c0e4-e7a5-4736-8f52-d355d11165b5
4
public void moveY(int dy) { if( (dy == -1 && this.dy != -1) || (dy == 1 && this.dy != 1)){ this.dy += dy; } }
b459cdb7-4145-4787-b5f8-7ad9d7ae7445
1
public int size() { int result = super.size(); if (!isProperList()) { result++; } return result; }
6fdfed54-e326-43a1-ad24-47fab4af8a63
2
public int get(int at) throws JSONException { if (at < 0 || at > this.length) { throw new JSONException("Bad character at " + at); } return ((int) this.bytes[at]) & 0xFF; }
70582abb-f32c-4c13-953e-037cdc918d3a
1
public int get(int row, int clums) { int i = 0; File f = new File("C:/config/config.xlsx"); try { InputStream input = new FileInputStream(f); XSSFWorkbook xssfWorkbook = new XSSFWorkbook(input); XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(0); XSSFRow xssfRow = xssfSheet.getRow(row - 1); XSSFCell ...
bd24a50d-419d-4d9f-8280-b10b4bd70780
8
protected double[] makeDistribution() throws Exception { double total = 0; double[] distribution = new double[m_TrainBags.numClasses()]; boolean debug = false; total = (double)m_TrainBags.numClasses() / Math.max(1, m_TrainBags.numInstances()); for(int i = 0; i < m_TrainBags.numClasses(); i++)...
eb77b0f5-1cac-4fc8-aa5c-53af27960573
2
public boolean equals(Object obj) { if ( obj instanceof OperationResourceInfo ) { OperationResourceInfo that = (OperationResourceInfo)obj; return this.url.equals(that.url) && this.method.equals(that.method); } return false; }
8ec6a479-ee40-41be-b233-f1b51490e9bd
6
private final void setMinimumButtonBounds() { for (int i = 0; i < tButtons.size(); i++) { TButton b = tButtons.get(i); if (resizeButtonArray.get(i)) if (orientation == HORIZONTAL) { if (b.width > minButtonWidth) minButtonWidth = b.width; b.height = he...
db525fc6-be1c-4198-9460-b7dff07b92d8
2
public static final boolean isCSharp(String fileName) { for (String file : C_SHARP) { if (file.equals(fileName)) { return true; } } return false; }
354d014f-408c-4851-a8f9-d7f4c6a5a9b9
6
public boolean pickAndExecuteAnAction() { //let customer know if restaurant is full if (isRestaurantFull()){ for (SmilehamCustomer iCustomer : mWaitingCustomers){ iCustomer.msgRestaurantFull(); } } for (Table iTable : mTables) { if ((!iTable.isOccupied() && !mWaitingCustomers.isEmpty()) && (m...
e229b714-83be-4bed-9b08-3003aaef2d78
4
public static double deltaHours(int calUnit, int increments) { if (calUnit == Calendar.DATE) { return 24 * increments; } else if (calUnit == Calendar.HOUR) { return increments; } else if (calUnit == Calendar.MINUTE) { return increments / 60; } else if ...
32c5b137-827e-4e23-99da-18fe40f04c13
4
private Coordinate getCoordinate(Point point) { int xCoordinate = (int)(point.getX() - STARTING_X_INDEX)/SIZE_OF_SQUARE; int yCoordinate = (int)(Board.NUMBER_OF_ROWS - ((point.getY() - STARTING_Y_INDEX)/SIZE_OF_SQUARE)); System.out.println("getCoordinate: x:" + xCoordinate + " y: " + yCoordinate); if (xCoordina...
a8ba1730-1441-47bf-919e-f1ebd6c1efc3
1
public void mouseReleased(MouseEvent event) { // Did we even start at a state? if (first == null) return; State state = getDrawer().stateAtPoint(event.getPoint()); controller.expandState(first, event.getPoint(), state); first = null; getView().repaint(); }
3d9147d1-9b34-48ef-9458-aa31d5f7f22b
3
public Location GeoCodeAddress(String straatnaam, String plaats) { for(Location loc : this.locations) { //System.out.println(loc.straatnaam+" == "+straatnaam); if (loc.straatnaam.equals(straatnaam) && loc.plaats.equals(plaats)) { return loc; } } return new Location(); }
feedda7e-3e94-47da-ae3a-c5cb0d451bd1
1
public void testFactory_fromDateFields_null() throws Exception { try { LocalDate.fromDateFields((Date) null); fail(); } catch (IllegalArgumentException ex) {} }
1bd536a1-b699-4599-9f4c-89e832495609
1
private void onSelect(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onSelect if (jList1.getSelectedValue() != null) { onSelectionMade(jList1.getSelectedValue()); dispose(); } }//GEN-LAST:event_onSelect
53d50513-e2ce-42d8-892d-0750756524f9
8
private void kaverilleMahdollisetAvecitPisteytetyista(Sitsaaja sitsaaja, boolean onkoSukupuoliVaihdettu) { List<Sitsaaja> tmp = sitsaajatPisteytettyna; for (int i = 0; i < tmp.size(); i++) { if (tmp.get(i) == null || onkoSitsaajaJoPlassattu(tmp.get(i)) || ovatkoSitsaajatSamaaSukupuolta(sitsa...
54129a49-7736-4858-aca1-4c92f8eb6c17
4
private List<String> getJMXasList(String url) { List<String> jmx = new ArrayList<String>(2); String jmxScript = null; String jmxScriptName = null; try { HttpResponse response = getJMX(url); if (response != null) { HeaderIterator headerIterator = re...
1bcaf911-f74d-40d8-84d0-437ee8b21e79
5
@Override public void run() { try { Socket receiveSocket = serverSocket.accept(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setSelectedFile(new File(fileName)); if (fileChooser.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); pat...
71fec80d-100a-41e8-8c68-5da20ef56953
7
@Override public List<Object> call() { List<Object> output = new LinkedList<>(); for (SequenceEntry watsonEntry : watsonEntries) { if (watsonEntry != null) { Read watsonRead = map(createRead(watsonEntry, false)); Read watsonRevRead = map(createRead(watsonE...
0c2d1e38-f388-4001-874d-ce69ad602269
1
public AbilityPanel(int controlPanelHeight, ControlPanel controlPanel) { super(); this.owner = controlPanel; this.setPreferredSize(new Dimension(200, controlPanelHeight)); this.setBackground(Color.RED); this.layout = new GridLayout(size, size); this.layout.setHgap(10); this.layout.setVgap(10); this.setL...
0bc5ded7-ffce-4562-84cf-7fdd0b5bae2b
7
private void sortInputQueue() { for (int out = inputQueue.size() - 1; out >= 1; out--) { for (int in = 0; in < out; in++) { // Only sort MulticastMessage if (inputQueue.get(in) instanceof MulticastMessage) { for (int j = in + 1; j <= out; j++) { if (inputQueue.get(j) instanceof Multic...
938a27a7-cfb6-4a7a-adbb-1b2de4be0040
3
public static Model getNewInstance(ModelType type) { if (type == ModelType.leaderElection) return new LeaderElectionModel(); else if (type == ModelType.broadcast) return new BroadcastModel(); else if (type == ModelType.traversal) return new TraversalModel(); ...
7e85644f-821d-4023-bbe6-dba69c125eb1
3
public byte[] getData(){ if(blocks == null) return null; ByteBuffer ret = ByteBuffer.allocate(pieceSize); for(Block b : blocks){ if(b == null){ return null; } ret.put(b.getData()); } return null; }
f56dd6db-81a1-4cb7-b8bb-74ba284e6916
3
@Override public void run() { serverState.notifyAllListener(BTServerStateObservable.SERVER_LISTENING); try { String uri = "btspp://localhost:" + new UUID(btservice.getServiceUUID(),false).toString() + ";name=" + btservice.getServiceName()+";authenticate=false;encrypt=false;master=false"; ...
d13fa032-d868-4fd0-bca7-c4d657b11d03
5
public ArrayList<Problem> getNextProblems(Student student, ArrayList<Problem> problems) { HashMap<Integer, ArrayList<Problem>> priorityProblemMap = new HashMap<Integer, ArrayList<Problem>>(); HashMap<Skill, Integer> curStuSkillMap = student.getSkillMap(); int maxPriority = 0; for (Problem curPro : problems) ...
5c053c8b-5de8-4687-adc3-7ba274bfd47c
0
@Basic @Column(name = "SOL_POS_ID") public int getSolPosId() { return solPosId; }
9884a020-57da-4659-b6ca-bfc865deac0e
0
public VueMenu(CtrlAbstrait ctrl) { super(ctrl); initComponents(); }
92e12519-5420-4a64-ad7c-be116e09d948
3
public HashMap<String,Double> readHomologyScores(String homologyFile) { int i=0; HashMap<String,Double> mapHomology=new HashMap<String,Double>(); try { BufferedReader br=new BufferedReader(new FileReader(homologyFile)); String str=""; while((str=br.readLine())!=null) { String[] split=str.split(...
4b65546e-9280-4a41-b55c-076b94a0b179
1
public double apply(double x){ double value = 0; ListIterator lIt = polynomial.listIterator(); while(lIt.hasNext()){ Term t = (Term)lIt.next(); value += t.factor * Math.pow(x, t.power); } return value; }
f6d3c22f-31c1-411f-8ed5-fdb9e7555dfd
3
public boolean getBoolean(String key) { Object value = get(key); if (Boolean.TRUE.equals(value) || value instanceof String && "true".equalsIgnoreCase((String) value)) { //$NON-NLS-1$ return true; } return false; }
ad4a75a7-41ce-43da-9d6e-c93dcd7fef9e
8
public static boolean isInteger(String javaType) { if (javaType.endsWith("Long") || javaType.endsWith("Integer") || javaType.endsWith("Short") || javaType.endsWith("Byte")) { return true; } if (javaType.endsWith("long") || javaType.endsWith("int") || javaType.endsWith("sh...
8209f4cc-c045-493d-8074-3e3da9b2077a
7
public void update() { //Update the seperate classes for (int i = 0; i < nlakes; i++) { lakes[i].Update(); } for (int j = 0; j < ncraters; j++) { craters[j].Update(); } for (int k = 0; k < narchers; k++) { archers[k].Update(gtargets); for (int i = 0; i < archers[k].arrows.size(); i++) { if (!...
28843c39-23f6-4f82-acd6-3e6389c9edb7
4
private String parseValue(String val) throws Exception { BlankVar var; Matcher strMatcher = strIdentifier.matcher(val); Matcher paramMatcher = paramIdentifier.matcher(val); Matcher numberMatcher = numberIdentifier.matcher(val); if (strMatcher.find()) { // Se for uma string remove as aspas duplas ...
92438199-9c47-402b-abe2-9e465457b2a5
9
public String exportOutputs(Engine engine) { StringBuilder result = new StringBuilder(); for (int i = 0; i < engine.numberOfOutputVariables(); ++i) { OutputVariable outputVariable = engine.getOutputVariable(i); result.append(String.format("[Output%d]\n", (i + 1))); i...
ead7d0fa-29e9-447d-9bd5-1878f16ee4a2
5
public UndirectedGraphNode cloneGraph(UndirectedGraphNode node) { if(node == null) return null; UndirectedGraphNode newNode; if(!map.containsKey(node.label)){ newNode = new UndirectedGraphNode(node.label); map.put(node.label,newNode ); }else ...
26208e1c-898f-4d03-bb56-3bc1e24b38bb
6
private void CopyFromJarToFolder( String _FileInsideJar, String _FileOutsideJar ) { InputStream stream = Fjord.class.getResourceAsStream(_FileInsideJar); if (stream == null) { //send your exception or warning this.getLogger().log(Level.SEVERE, "Failed to open resource stream to file in .jar...
f067e511-62f9-46d4-a77e-ca8e0e887374
6
public static boolean isValid(char l) { int num = (int)l; if(num >= 65 && num <= 90) { return true; } else if(num >= 97 && num <= 122) { return true; }else if(num >= 48 && num <= 57) { return true; }else{ return false; } }
a7da3817-146e-44c2-b6d1-83c4ba78980a
0
@Test public void resolve() { long x=1; print(x); }
a989e76f-f917-4def-bef8-80ae9605cf57
2
@Override public boolean getOutput() { for (int j = 0; j < getNumInputs(); j++) if (!getInput(j)) return false; return true; }
8b8ae9f3-4d3a-47cb-8179-aafb1c7d4838
7
public Drag dinTur() { loading--; spelare.dinTur(); if(spelare.getDrag().getRedskap() == Consts.HJUL) { if(loading == 0) { loading = Consts.HJULLOADING; } return spelare.getDrag(); } if(loading != 0) ...
fded6e0b-99a4-4553-bd98-4676565d7e40
0
public StopWatch() { this.state = EnumStopWatchState.STOP; }
44e2b015-8352-4ba0-ae07-c83b6e7dd429
0
public ExecutorThread(TaskRunner<T> taskRunner, String s) { super(taskRunner, s); this.taskRunner = taskRunner; }
c9b46e6e-0103-4274-ad34-9bdcbba0eb77
5
protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String action = request.getParameter("action"); String forwardTo = ""; if (action != null) { if (action.equals("updateUtilisateur")) { ...