method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
78b793ed-500f-42c5-bf5a-2a73337b1ef9
3
@Override public ParseResult<T, Tuple3<A, B, C>> parse(LList<T> tokens) { ParseResult<T,A> r1 = this.left.parse(tokens); if(!r1.isSuccess()) { return ParseResult.failure(r1.getErrorMessage(), r1.getRestTokens()); } ParseResult<T,B> r2 = this.middle.parse(r1.getRestTokens()); if(!r2.isSuccess()) { retur...
69c45a1e-87c3-40c6-a35d-8c6da215d03a
7
@Override public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc) { boolean itf = opcode == Opcodes.INVOKEINTERFACE; Item i = cw.newMethodItem(owner, name, desc, itf); int argSize = i.intVal; // Label currentBlock = this.cur...
3a8b4241-0828-49e4-89c1-2a5beacff046
2
public static void main(String[] args) { // All code that accesses the simple GUI must run in the AWT event // handling thread. // A simple way to achieve this is to run the entire application in the // AWT event handling thread. // This is done by simply wrapping the body of the main method in a call // of...
b4c0c31a-99fa-489e-9e57-0c626726af0b
1
private void initScan() { if (theWorker == null) { state = UIState.UPDATEPAGES; lblStatus.setText("Scanning"); theWorker = new MyWorker(rootPage, JobType.UPDATEPAGES, false); theWorker.execute(); } }
0e4cb266-55c7-4e3a-b03d-9c3d5db11464
6
public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://down...
57b112bd-e49a-425d-8163-bf9c3d35840c
9
public static long rankHand(ArrayList<Card> hand){ if (hand.size() != HAND_SIZE){ throw new GameException("Hand should be 5 cards : " + hand); } long rank = -1; long[] pairSet; long highCard; ArrayList<Long> excludes = new ArrayList<Long>(); sortHand(hand); if ( isStraightFlush(hand) ){ highCar...
98fcb395-f236-48fd-8f9a-deb861746ae9
8
public int getMinLabel(int h,int w){ int label = Integer.MAX_VALUE; int min = 0; /* check OOO * OX get minimum value for labeling * also check if there is smaller value for equalTable */ for(int i = -1; i<2; i++){ if(labeledImage[h-1][w+i] > 0){ ...
9a1908b5-a6dd-4c5f-9710-bbd13c581039
2
public void insertData(int data) { MergeLinkedList temp = this; if(temp==null) { temp = new MergeLinkedList(data); return; } while(temp.getNext()!=null) temp = temp.getNext(); temp.setNext(new MergeLinkedList(data)); }
7de459c8-1289-4115-bc8f-3deaa8cfa808
9
public void putAll(Map<? extends K, ? extends V> map) { int size = map.size(); if (size == 0) return; if (size > threshold) { if (size > MAXIMUM_CAPACITY) size = MAXIMUM_CAPACITY; int length = table.length; for (; length < size; length <<= 1) ...
c739f91b-f945-4adc-8dfb-f0e685f83b97
0
@Test public void compareHands_StraightFlushBeatsEverythingElse() { Hand p1 = Hand.StraightFlush(Rank.King, Suit.Clubs); Hand p2 = Hand.FullHouse(Rank.Four, Rank.Nine); assertTrue(p1.compareTo(p2) > 0); }
0e0e1b6b-3a9d-4ad6-b4ee-d83111037f2d
1
public ArithmeticCompress (byte[][] b, String outputFileName, boolean codeCbCr) throws IOException { arithmeticCompressProcess(b[0], outputFileName+"Y.bin"); if (codeCbCr) { arithmeticCompressProcess(b[1], outputFileName+"Cb.bin"); arithmeticCompressProcess(b[2], outputFileName+"Cr.bin"); } }
8cb7ff0e-d3d9-4550-a3bf-eda35435e9be
3
private int goTo(int index) { int state = state(); int low = 1; int high = gotoTable[index].length - 1; int value = gotoTable[index][0][1]; while(low <= high) { int middle = (low + high) / 2; if(state < gotoTable[index][middle][0]) ...
0e6cb389-7873-45c6-90f2-9166061e5c8b
0
public void setName(String name) { this.username = name; }
90a59e13-3c4d-41dc-91d2-468567990af3
9
public HashMap<Integer, Edge> constructEdgeTable(Point[] vertices) { HashMap<Integer, Edge> EdgeTable = new HashMap<Integer, Edge>(); int ymin, ymax, x; float m; for (int i = 1; i < vertices.length; i++) { if (vertices[i - 1].y < vertices[i].y) { ymin = vertices[i - 1].y; x = vertices[i - 1].x; y...
68bdf7de-502c-4ef4-be9a-aeafa7ac704d
0
public void execute() { this.from.removePiece(this.piece); this.to.removePiece(this.capturedPiece); this.to.addPiece(this.piece); this.piece.increaseMoveCount(); }
3fd51b20-7fa9-457c-a83b-89de27e30a7f
5
private Vector2f lineIntersect(Vector2f lineStart1, Vector2f lineEnd1, Vector2f lineStart2, Vector2f lineEnd2) { Vector2f line1 = lineEnd1.sub(lineStart1); Vector2f line2 = lineEnd2.sub(lineStart2); float cross = cross(line1, line2); if(cross == 0) return null; ...
8fcb3a55-7dc3-404b-9f8d-48d37d7ca87b
1
public Double increase(K key, Double increaseBy){ if (map.containsKey(key)){ map.put(key, map.get(key)+increaseBy); } else { map.put(key, increaseBy); } return map.get(key); }
c8769f98-ee26-491c-87f7-74bb5df58fca
1
private static String getAPIString(Object param) { return (param instanceof AsIsTerm) ? ((AsIsTerm) param).toString() : DefaultCycObject.stringApiValue(param); }
0c5c455e-0319-4ae5-b909-f1d5e824db02
0
public static void main(String[] args) { Mediator mediator = new ConcreteMediator(); Colleague cA = new ConcreteColleagueA("ColleagueA"); mediator.addColleague(cA); Colleague cB = new ConcreteColleagueB("ColleagueB"); mediator.addColleague(cB); Colleague cC = new ConcreteColleagueC("ColleagueC"); media...
9d1a2533-cc5a-4252-a4b0-c935d338dd4a
3
@Override public Object clone() throws CloneNotSupportedException { TileLayer clone = (TileLayer) super.clone(); // Clone the layer data clone.map = new Tile[map.length][]; clone.tileInstanceProperties = new HashMap<Object, Properties>(); for (int i = 0; i < map.length; i++...
83fb5f56-f9ab-4cb0-a203-3727176feb74
7
public void remove(int index) { if(first == -1 || last == -1 || index > size) { return; } if( first == last) { if(first != index ) { return; // actually an error } else { first = -1; last = -1; } } else if( first == index) { first = ((Node)v.get(index)).next; } else { NodeAndPlac...
ec566002-82b8-4649-beb7-a505a6036281
5
public int numTrees(int n) { // Start typing your Java solution below // DO NOT write main() function if (n == 0) return 0; int[] res = new int[n + 1]; res[0] = 1; res[1] = 1; for (int i = 2; i <= n; i++) { res[i] = 0; } for (int i = 2; i <= n; i++) { for (int j = 0; j < i / 2; j++) { // 枚举根节...
4fa36266-b1ac-4489-a296-75bacb8956ff
8
@Override public String getMessage() { switch( error ) { case NULL: return "a range intersection returned no cells"; case DIV0: return "attempted to divide by zero"; case VALUE: return "operand type mismatch"; case REF: return "reference to a cell that doesn't exist"; case NAME: ...
72119d8c-dc26-4263-a8dc-918fa3e4aee8
7
private boolean readObject() throws IOException, JSONSyntaxException { // Mind the case of an empty object: {} if( this.currentChar == '}' ) { this.fireObjectEnd(); return true; } while( this.readObjectMember() && this.currentChar != '}' ) { // object members are separated by ',' ...
4ea8c3e9-7e27-4877-bb3a-3af21757664e
1
public static void main(String[] args) throws Exception { Format format = Format.parseFormatFile(new File("EBNF.txt")); Compiler c = new Compiler(format); if (verbose()) format.printDefinitons(); File file = new File(args[0]); c.createCompilationUnit(file); }
820a2afe-dd0d-4d5d-a20f-03a4cbeb20e8
4
@Override public boolean traverse(EnumSet<TraversalOption> opt) { if (!init()) return false; if (cur != null && cur.ready() && cur.validate()) { cur.traverse(); return true; } return false; }
fde84f19-cd12-4375-a1f2-00cd942dcc0e
2
public boolean wasChanged(Stat previous) { if (previous == null) return true; return previous.isNormalState() != isNormalState() || !previous.getStateDescription().equals(stateDescription); }
d0d6a290-5801-42e4-a777-497262ba8998
0
private void warn(final String msg) { logger.warn(msg); }
85265275-3056-4f99-9078-b9380716cc28
6
public static String changeCodonRandomly(String inCodon) throws Exception { if ( inCodon.length() != 3) throw new Exception("Invalid codon"); int randomPos = random.nextInt(3); if ( randomPos < 0 || randomPos > 2) throw new Exception("Logic error"); StringBuffer buff = new StringBuffer(); ...
f9521823-c61f-4d3b-b149-7649928dcf0d
0
public ReferenceResource(int id) { this.referenceID = id; }
1bd56c8c-e707-4fc4-963e-5d3b7a5f3124
9
public static void setZeros(int[][] matrix) { int m = matrix.length; int n = matrix[0].length; int[] rows = new int[m]; int[] cols = new int[n]; for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (matrix[i][j] == 0) { r...
975c74e7-90b9-4a10-8045-1c558031ff94
3
public boolean acquireRemoteLock(String source){ boolean success = false; if(!isLOcked){ synchronized (this) { if(!isLOcked){ isLOcked = true; lockedBy = source; success = true; } } } else if(lockedBy.equalsIgnoreCase(source)){ success = true; } return success; }
461d7c7a-c607-4cbf-ab7c-3b66c5f97737
6
public void solve() { Class<Double> type = Double.class; try { if (A != null) { int size = A.getSize(); createRandomVector(size); ArrayList<ArrayList<Double>> vAsRowMatrix = VectorBuildUtils.getRowMatrixFromArrayVector(v, type); ArrayList<ArrayList<Double>> vAsColMatrix = MatrixBuildUtils.getTranspose(vA...
db741b7d-9115-4da0-a0cd-00f2801677ea
0
public CheckResultMessage check25(int day) { return checkReport.check25(day); }
9bf17fcc-9607-46ca-af20-73c47857ca3d
7
private static void colorButtonByOverallChange(CustomButton a, String ticker) { Float overallChange = Database.INDIVIDUAL_OVERALL_CHANGES.get(ticker); if (overallChange == null) return; float marketChange = Database.calculateMarketChange(0, Float.MAX_VALUE); // System.out.println("ticker calc: (" + ticker ...
0de341e8-b345-462e-b3eb-b9d0c64e0b8a
2
public static BackpackConfiguration getBackpackConfigurationFrom(ItemStack itemStack) { if (!isBackpack(itemStack)) return null; BackpackData data = BackpackData.read(itemStack); BackpackConfiguration configuration = BackpacksPlugin.getInstance().getBackpackRegistry().getBackPackTyp...
278b1268-b3db-486e-9f9c-db0827448fa0
6
public void addLastWeek(FacWarStat stat) { if (stat instanceof CharacterKills) { characterKillsLastWeek.add((CharacterKills) stat); } else if (stat instanceof CharacterVictoryPoints) { characterVictoryPointsLastWeek.add((CharacterVictoryPoints) stat); } else if (stat instanceof CorporationKills) { corpor...
d79e07a6-febf-446c-bff5-999de5b9afd8
1
private void initComboForGameMode() { EnumSet<ModeEnum> modes = EnumSet.allOf(ModeEnum.class); comboMode = new Combo(compOptions, SWT.READ_ONLY); availableModes = modes.toArray(new ModeEnum[modes.size()]); String[] modesString = new String[modes.size()]; int i = 0; for (...
6a9e3074-51d3-46dc-bae3-dee2f083b55c
6
@EventHandler public void PigZombieSpeed(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getPigZombieConfig().getDouble("PigZombie....
5e3b95cd-da19-476b-8c4a-a1de3a625563
6
private void recursivePrint(int arrayIndex, int i, Node parentNode, int parentPosition, int depthLeft, int depthRight) { int newLeftPosition = 2 * i + 1; Pair left = null; Node nodeLeft = null; int parentLeftPosition = parentPosition; if (newLeftPosition < nodes.length) { ...
057a57c0-aa6b-433d-a780-54ce2fadda70
4
@Override public <T> T getProxy(final Invoker<T> invoker, final Class<?> service) { factory.setSuperclass(service); Class<?> proxyClass = factory.createClass(); MethodHandler mi = new MethodHandler() { public Object invoke(Object self, Method m, Method proceed, Object[] params) throws Throwable { /*Strin...
252a43d6-2a93-4866-8861-b33265c987f4
0
public void setSize(int width, int height) { this.width = width; this.height = height; }
bd3029d9-a22c-497f-81b5-49fde418bfba
7
private void feed() { Turn turn = connection.getCurrentTurn(); teamId = turn.getId(); for (de.nismeinert.net.Team tpack : turn.getTeams()) { Team t = null; if (teams.containsKey(tpack.getId())) { t = teams.get(tpack.getId()); t.setAntCount(tpack.getAnts()); t.setName(tpack.getName()); t.s...
a07f70a9-d35a-4946-9b25-7c8e78ee01d4
4
@Override public char getGrade() { char grade; if (score >= 80) { grade = 'A'; } else if (score >= 70) { grade = 'B'; } else if (score >= 60) { grade = 'C'; } else if (score >= 50) { grade = 'D'; } else { gra...
d146c047-bd38-45a8-83bc-230b311b2d6f
4
public void check() throws InvalidGameStateException { if (displayName == null) throw new InvalidGameStateException("category has no displayable name"); if (fields == null) throw new InvalidGameStateException("category '"+displayName+"' has fields null"); if (fields.isEmpty()) throw new InvalidGameStateException(...
3cb5f966-f618-4d11-bd41-f110ad4d5fbf
3
public void run() { try { if( m_remoteSocket != null ) { PrintWriter writer = new PrintWriter( m_remoteSocket.getOutputStream() ); writer.println("password:"+password); writer.println("command:"+command); writer.println("CN:"+commonName); writer.flush(); } // now read back any resp...
a60b7250-c3dd-4cde-a924-2581f1ea4963
7
public static Object parseArg(Class<?> c, String arg, Map<String, InspectedObject> savedObjects) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException, InstantiationException { if (isChar(arg)) { if (isPrimitive(c) && arg.length() ...
37743a4d-2d7b-46e3-8714-c2c35c0d498e
4
public static void editBanReason(String name, String reason) { path = name; File f = new File(plugin.getDataFolder() + File.separator + "Players" + File.separator + name + ".data"); try { if (!f.exists()) { saveDataFirst(name); } BufferedReader br = new BufferedReader(new FileReader(f)); FileWr...
2448c685-d4df-43cd-b612-c10aa794ccd9
1
private void login() throws IOException { client.login(username, password); if (workingDirectory != null) { client.changeWorkingDirectory(workingDirectory); } }
e7064d0d-731d-4b9d-a2c7-42d0d5bf4bdf
8
private void YposTFKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_YposTFKeyTyped boolean OK = false; if((evt.getKeyChar()=='-')&&(YposTF.getText().equals("")))OK = true; if((evt.getKeyChar()=='.')&&(!YposTF.getText().equals("")&&!YposTF.getText().equals("-")))OK = true; ...
55ea17ec-37d0-4290-8994-6ae7bb61615f
5
public Path getPath(float[] position) { Path P = new Path(); boolean found = false; //Pruefen ob ein Wegpunkt von einem Weg ohne Hindernis erreichbar ist for(int i=0; i<Paths.size(); i++) { for(int u=0; u<Paths.elementAt(i).getNumberOfPoints(); u++) { //Pruefen ob ein Wegpunkt ohne Hindernis err...
db03eed4-fe6b-420b-a030-298eb005fafa
0
public void addBlackMarker(int markerNum) { // As red this.markersBlack[markerNum] = true; }
c69b1b59-aeb4-4c65-81d1-acf7d985c5e4
6
@Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_UP) { gui.getPhysics().getShip().setAccelerating(true); } if (e.getKeyCode() == KeyEvent.VK_DOWN) { gui.getPhysics().getShip().setDecelerating(true); } if (e.getKeyCode() ...
d16a69cd-0c6d-4a4d-8e8b-eb95efd2c50b
4
public static void main(String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can...
86d1d800-f893-43b6-905c-eee6ecfd256b
4
public static BufferedImage gaussBlur(BufferedImage input) { BufferedImage result = new BufferedImage(input.getWidth(), input.getHeight(), input.getType()); for (int i = 0; i < result.getWidth(); i++) for (int j = 0; j < result.getHeight(); j++) { double newRed = 0; ...
69c98378-fa55-435b-a261-3f32bc6f0421
4
@Override public void create(Despesa e, Connection conn) throws Exception { String sql = "INSERT INTO despesa(viagem_fk, categoria_despesa_fk, comprovante, valor, nome_estabelecimento, data_compra, hora_compra, cnpj, descritivo, valor_real_autorizado) VALUES(?,?,?,?,?,?,?,?,?,?) RETURNING id"; Prepa...
839b8381-68bb-4350-9cdd-f544a24a0a22
7
public static int solve(int[][] solution, int i, int j, int path) { if (j == 0) return path + (i + 1) * (int) Math.pow(10, solution.length - (i + 1)); // find best of up, mid, and down int up; int upIndex; if (i - 1 >= 0) { up = solution[i - 1][j - 1]; upIndex = i...
33692522-da86-474a-8622-58d6a274e39b
7
public void getServer(int host) throws RemoteException { Registry registry = LocateRegistry.getRegistry(host); String backupName = null; for(String name : registry.list()) { try { currentServer = (ICoreServer)registry.lookup(name); if (currentServer.inService()) { //If we've found the primar...
0571ab55-49ee-4eba-a533-2dcfd2a60240
4
public boolean inRange(int screenWidth,int screenHeight){ //жӵǷĻΧ if(this.x<screenWidth && this.y<screenHeight && this.x>0 && this.y>0 ){ return true; } else{ return false; } }
6874f32e-cf39-4466-baff-7fe0fe41d644
1
@Override public void update(Graphics g) { if(offScreenImage == null){ offScreenImage = this.createImage(GAME_WIDTH,GAME_HEIGHT); } Graphics gOffScreen = offScreenImage.getGraphics(); Color c = gOffScreen.getColor(); gOffScreen.setColor(Color.BLACK); gOffScreen.fillRect(0, 0, GAME_WIDTH,GAME_HEIGHT)...
4390cca1-e95e-4f21-ba90-07d7fa169a9f
8
@Override public List<T> search(final T source, final T target) { checkNotNull(source, "Source is null."); checkNotNull(target, "Target is null."); parentMapA.clear(); parentMapB.clear(); parentMapA.put(source, null); parentMapB.put(target, null); ...
83ca43ee-4c61-4a2d-95b5-5eff2d8fdd3a
6
protected void heapifyDown(int loc) { int max = loc; int leftChild = leftChild(loc); if (leftChild < size()) { double priority = priorities[loc]; double leftChildPriority = priorities[leftChild]; if (leftChildPriority > priority) max = leftChild; int rightChild = rightChild(l...
45cb072d-5470-4872-ac33-b5e4b3461b08
9
public static void tecmo_draw_sprites(osd_bitmap bitmap, int priority) { int offs; /* draw all visible sprites of specified priority */ for (offs = 0; offs < spriteram_size[0]; offs += 8) { int flags = spriteram.read(offs + 3); if ((flags >> 6) == priority) { ...
cc738b4c-e868-48dd-a06d-f2fba5f22528
5
@SuppressWarnings({"rawtypes", "unchecked"}) @Override public int compareTo(QualifiedValue<?> other) { if (orderIndex < other.orderIndex) { return -1; } if (orderIndex > other.orderIndex) { return 1; } if (value ...
ac9857f6-7424-4b6d-8c7d-d7f1c85d2ae2
1
public void reset() { for (int i=0; i<filters.length; i++) { filters[i].reset(); } }
1bc16ad0-3236-4f38-900a-f1b3992e18d7
2
public boolean isFeasiblePositionAvailable(Geometry avoids) { for (Label candidate : candidates) { if (!candidate.getGeometry().intersects(avoids)) { return true; } } return false; }
6fbbb1d7-ca7d-4521-a45e-6a0abd4f8184
9
private static Alignment traceback(Sequence s1, Sequence s2, Matrix m, byte[] pointers, Cell cell, short[] sizesOfVerticalGaps, short[] sizesOfHorizontalGaps) { logger.info("Started..."); long start = System.currentTimeMillis(); char[] a1 = s1.toArray(); char[] a2 = s2.toArray(); float[][] scores = m....
abc4d73d-48bd-4100-b376-16b8d5affee8
9
public void setView(int view){ if(view==MENU){ MainMenuView menu = new MainMenuView(mainWindow,resume); this.view = menu; } else if(view==RESUME){ this.view = gameView; gameView.resume(); } else if(view==GAME){ gameView = new GameView(mainWindow); if(time>0){ gameView.act.setTime(time); ...
31c7e480-87ac-4784-95a7-53289b1a3188
2
@Override public boolean accept(File f) { return (f.isDirectory()) || (f.getAbsolutePath().toLowerCase().endsWith(".ab") && f.getAbsolutePath().toLowerCase().contains(device.getSerial().toLowerCase())); }
1bb8f1b4-720e-4711-9f5b-94a17eb106fc
8
public static Highscore [] load(InputStream in) throws IOException { Vector highscores=new Vector(20,40); InputStreamReader inr = new InputStreamReader(in); String line; while ( (line=jgame.impl.EngineLogic.readline(inr)) != null ) { Vector fields = new Vector(5,10); // XXX we use "`" to represent empty ...
c9d82736-8887-40d9-baf3-18ac60744d9f
9
private void parseInput(String input) { Matcher matcher = inputPattern.matcher(input); if (matcher.matches()) { long versionMajor, versionMinor, versionRev; try { versionMajor = Long.parseLong(matcher.group(1).replace("\"", "")); // DIGIT for MAJOR, remove any qu...
1bd9631c-1d85-43a9-b049-b4f173854e10
5
public void addTile(int ID, int _x, int _y) { boolean found=false; int x=0; int y=0; // System.out.println(tiles.size()); if(!tileSelected && tiles.size()<maxTiles) { for(int i=0;i<tiles.size();i++) { if(tiles.get(i).getY()>y && !found) { y=(int)tiles.get(i).getY(); x=(int)tiles.get...
4efb55bb-88e6-49bf-869d-511147c6ee3c
1
public void surrender() { log.emit("Gracz "+currentUnit.getOwner().getColor().name+" poddał się"); for (GroupOfUnits u: currentUnit.getOwner().getUnits()) { units.remove(u); } currentUnit = units.peek(); finishBattle(); }
ea763efb-5f5e-4ca0-bd08-db614dab732d
9
public static void printLongestPalindromicSubstr(char[] str) { int len = str.length; int j = 0, start = -1; int maxLen = 0; boolean[][] p = new boolean[len][len]; // for all substr of length 1. for (int i = 0; i < len; i++) { p[i][i] = true; } // for all substr of length 2. for (int i = 0; i < len ...
ae789809-5ccd-48a1-8a3e-7159e29cc260
7
public void loadPalette() { // load Histograms for (int i = 0; i < 4; i++) { try (BufferedReader br = new BufferedReader(new FileReader( "src\\palette\\LCC" + (i + 2) + ".pheno"))) { String sCurrentLine; int j = 0; while ((sCurrentLine = br.readLine()) != null) { try { LCC[i][j] = Do...
7a84e4ef-1902-4880-8f8b-19093b9df5c3
9
public Format(String formatString) { _staticParts = new Vector(); Vector formatElements = new Vector(); StringBuffer part = new StringBuffer(); boolean insideFormatElement = false; boolean atPercentSymbol = false; for (int i = 0, n = formatString.length(); i < n; i++) { char c = formatStri...
cde7a5c5-9f67-4144-9ccb-916150f45a77
1
public static void calcUnitValue(double unitValue[], double itemArray[][]){ System.out.println(); for(int i=0; i<4; i++) unitValue[i] = ((itemArray[0][i]) / itemArray[1][i]); }
7ac6b4a3-6c89-487f-baaa-bc7fb082de17
3
public int cciLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 2) || ((int)optInTimePeriod > 100000) ) return -1; return (optInTimePeriod-1); }
b9fb6b38-22fb-4719-b5a7-162dc2714653
8
public Integer[][] cheminDijstra() { Integer dijkstra[][] = null; Point pMin = new Point(); int min = Integer.MAX_VALUE; for(int j = 0; j < taille_envi;j++){ for(int i = 0; i < taille_envi; i++){ if(grille[i][j] instanceof Explorateur){ dijkstra= goDijkstra(i, j); } } } for(int j = 0; ...
992aff36-9b12-4b0d-afdd-915def8422cc
6
public void generateMipMaps(ByteBuffer data, int width, int height, boolean test) { ByteBuffer mipData = data; for (int level = test ? 0 : 1; level <= 4; level++) { int parWidth = width >> level - 1; int mipWidth = width >> level; int mipHeight = height >> level; if(mipWidth <= 0 || mipHeight <= 0)...
0a40d713-b847-4581-9fff-99a697555112
6
public static int GetItemID(String oldItem) { // Search for item name from item list for(int i=0; i<Items.listItems.length; i++) { if(Items.listItems[i].equalsIgnoreCase(oldItem)) { return Items.listItemsID[i]; } } // If the item hasn't been found, look for a book with the item name for(int i=300...
020a8697-7ab5-4782-8c52-f108c50c3560
3
public String execute() throws Exception { if(addCateName == null || addCateName.isEmpty()) return "inputError" ; if(!add()) return "inputError" ; return SUCCESS; }
d6d39161-4b06-4be1-97b6-1da5e02dc61f
8
@Deprecated public static List<Integer> indexCombinations(double x, int size, int elements) { if (size < 0 || size > elements) { return null; } if (size == 0) { return x == 0 ? new ArrayList<Integer>(size) : null; } if (size == elements) { List<Integer> a = new ArrayList<Integer>(size); for (i...
b7eaad99-e81d-420f-9923-379d0646a7f5
3
public int count(String word) { int c = 0; for (List<String> line : words) { for (String w : line) { if (w.equals(word)) ++c; } } return c; }
d91ca9d4-2464-4e85-b19a-1921651f2d55
4
boolean validLocation(float newX, float newY) { if(world.blocked((newX - width), (newY - height))) { return false; } if(world.blocked((newX + width), (newY - height))) { return false; } if(world.blocked((newX - width), (newY + height))) { return false; } if(world.blocked((newX + width), (newY + h...
4900386d-0544-425c-b8de-9d772b6789a3
7
@Override public String execute(HttpServletRequest request, HttpServletResponse response) throws Exception { String data; try { ArrayList<FilterBean> alFilter = new ArrayList<>(); if (request.getParameter("filter") != null) { if (request.getParameter("filterop...
1b778376-c84f-4abb-a9da-9d31ea8f29bd
2
public void DisplayBlock(Block _r, Block _g, Block _b, BufferedImage _buffImage, int _y, int _x) { for(int i=0;i< Block.N;i++){ for(int j=0;j<Block.N;j++) { int pix = (((int)(_r.block[i][j]) & 0xff) << 16) | (((int)_g.block[i][j] & 0xff) << 8) ...
2b183f72-10b1-4dc2-89b0-f9451ca6b71c
7
public static boolean isPlate(String plate) { if (plate.length() == 7) { char[] charPlate = plate.toCharArray(); for (int i = 0; i < charPlate.length; i++) { if (i < 3) { if (!Character.isLetter(charPlate[i])) { return false; } } else { if (i == 3) { if (charPlate[i] != '-')...
6c5e7ccc-09ec-4fa4-ad32-ee1a3ee1c37e
4
public void send(final int n) { ActiveMQConnection connection = null; try { ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory(Sender.BROKER_URL); connection = (ActiveMQConnection) cf.createConnection(); connection.start(); QueueSession session = ...
d3958e29-604b-4475-a241-9917221f38a3
8
public String toString(){ ArrayList<Integer> copy = new ArrayList<Integer>(ranges); Collections.sort(copy); String returnString = ""; Iterator<Integer> iter; iter = copy.iterator(); int firstNumber = 0; int followingNumber = 0; boolean ifWasLast = false; boolean dontPrintLast = true; if(iter.hasNext...
c451e551-bf71-47f9-b0d9-58b3334371c7
9
public void drawIcon(final Graphics g) { final int width = getSize().width; final int height = getSize().height; if( (width < (2 * (1 + getBorderX()))) || (height < (2 * (1 + getBorderY())))) { return; } Color c = g.getColor(); switch(getBorderType()) { case...
f1273637-d711-4618-929a-d011a4aec0af
1
private void assign_belief_of_initial_distribution(double[] dist) { for ( int i = 0; i < dist.length ; i++ ) { dist[i] = belief[i]*nfruits; } }
08d7e446-cb6f-490c-9f9f-a9278e70aeb3
0
public boolean isValid() { return this.valid; }
606da54f-0e92-4a79-995f-4ad5419b732a
7
private static Date parseDateFromString(String string) { // events boolean dayEnded = false; boolean monthEnded = false; StringBuilder day = new StringBuilder(); StringBuilder month = new StringBuilder(); StringBuilder year = new StringBuilder(); for (int i...
ca44e61f-a83d-4f14-9578-58cf0065f2ba
7
@Override public Success<Type[]> parse(String s, int p) { // Parse the '['. if (s.charAt(p++) != '[') return null; p = optWS(s, p); if (s.charAt(p) == ']') throw new NiftyException("Empty type lists are not accepted; try removing the '[]'."); // Parse...
91010a22-ad5e-4036-9434-e7e147bf9fd9
2
@Override public boolean equals(Object obj) { if (this == obj) return true; if (!(obj instanceof ServerConnectionType)) return false; ServerConnectionType other = (ServerConnectionType)obj; return this.type.equalsIgnoreCase(other.toString()); }
ef8bd5ce-c26b-42b1-b433-78f98ef1ef93
6
public synchronized Bestandteil getBestandteil(String bestandteilname) { synchronized(this){ if(bestandteilname.equalsIgnoreCase("Arm")){ File f=new File(lagerVerzeichnis+File.separator+"arme.csv"); return getBestandTeilvonFile(f); } if(bestandteilname.equalsIgnoreCase("Rumpf")){ File f=new File(lagerV...
76febcba-05de-43e4-879a-c9e671f79d0e
1
public void waitForCommand() { System.out.print("Command: "); try { processCommand(in.readLine().toLowerCase()); } catch (Exception e) { System.err.println(e); } System.out.println(); }
659cbf4d-0640-452b-94da-d738e54e1c8c
9
private static boolean updateHashEquiJoinCardinality(HashEquiJoin j, Map<String, Integer> tableAliasToId, Map<String, TableStats> tableStats) { DbIterator[] children = j.getChildren(); DbIterator child1 = children[0]; DbIterator child2 = children[1]; int child1Card = 1; int child2Card = 1; ...
1eaf4b52-94c1-4baa-a626-bf69cfd251f1
7
public synchronized int logUpload(String userKey, String testId, String logName, String buff, String dataType) { if (userKey == null || userKey.trim().isEmpty()) { BmLog.debug("Log cannot be uploaded, userKey is empty"); return -1; } if (testId == null || testId.trim()....