method_id
stringlengths
36
36
cyclomatic_complexity
int32
0
9
method_text
stringlengths
14
410k
be381acc-d7a9-49a4-87fd-cb710c29033e
1
public static boolean isLocked(int roomId) { if(keyRequired[roomId-1] != 0) { return true; } else { return false; } }
ee04cbc9-baf9-4fcb-9d03-7c17e77982db
7
@Override public int getMask(int plane, int localX, int localY) { int currentChunkX = localX / 8; int currentChunkY = localY / 8; int rotation = regionCoords[plane][currentChunkX][currentChunkY][3]; int realChunkX = regionCoords[plane][currentChunkX][currentChunkY][0]; int realChunkY = regionCoords[plane][cu...
8e4151c6-bd38-4750-bc5d-df94ecab1183
7
@Override public void spring(MOB target) { if(target.location()!=null) { if((!invoker().mayIFight(target)) ||(isLocalExempt(target)) ||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target)) ||(target==invoker()) ||(doesSaveVsTraps(target))) target.location().show(target,null,null,CMMs...
aabf8ed0-dd19-4654-99ac-cf76a886e4a4
7
private static List<Class<?>> classListFromJar(final String name, List<String> classpath) { final List<Class<?>> results = new ArrayList<Class<?>>(); try (final JarFile jf = new JarFile(name)) { final File jFile = new File(name); ClassLoader cl = new URLClassLoader(new URL[]{makeFileURL(jFile.getAbsolute...
14188e67-ce62-48f7-afee-fabe3cfced30
1
public static void asm_addwf(Integer akt_Befehl, Prozessor cpu) { // Komponenten auslesen Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6); Integer w = cpu.getW(); Integer result = cpu.getSpeicherzellenWert(f) + w; // Speicherort abfragen if(getOpcodeFromToBit(akt_Befehl, 7, 7) == 1) { // in f Register...
40d7b44d-6406-41ac-baa1-c3af83082620
1
public Image getImage(String key) { if(loadedImages.containsKey(key)) return loadedImages.get(key); else return null; }
2eb100ce-a36b-4b20-9e33-c80bd199e232
8
private void visitObjectLiteral(Node node, Node child) { Object[] properties = (Object[])node.getProp(Node.OBJECT_IDS_PROP); int count = properties.length; // load array with property ids addNewObjectArray(count); for (int i = 0; i != count; ++i) { cfw.add(ByteCo...
1133f0bf-5543-484e-96d6-c84989d7651d
4
private String[][] parseText(String textFile){ FileReader input = null; try { input = new FileReader(textFile); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } BufferedReader bufRead = new BufferedReader(input); String myLine = null; String[][] arra...
0a32a3bd-72e9-4499-9141-9038fb76f5c0
6
public void run() { FileInputStream fis = null; ZipInputStream zis = null; try { try { File directory = new File(this.outputParentDirectory + File.separatorChar + this.zipFilePath.substring(this.zipFilePath.lastIndexOf(File.separatorChar))); if(directory.exists())directory.delete(); directory...
28678c25-1f80-4b28-9f62-b69c32771f94
4
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); // BufferedReader br = new BufferedReader(new FileReader("input.in")); StringBuilder sb = new StringBuilder(); String line = ""; d: do { line = br.readLine(); if (line == ...
79fb80c8-f7f7-4272-b57b-891b926e156b
6
static Object[][] subtract(Object[][] x, Object[][] y) { Object[][] ret = new Object[x.length][]; for (int i = 0; i < x.length; i++) { ret[i] = new Object[x[i].length]; for (int j = 0; j < x[i].length; j++) { Object a = x[i][j]; ...
93654454-9585-454c-96b3-acce9d6d395f
9
public Value execute(Interpreter machine) throws MyException { if (_operands != null && _operands.size() >= 3 && _operands.get(0).isSymbol() && _operands.get(1).execute(machine).isNumber() && _operands.get(2).execute(machine).isNumber()) { Symbol I = (...
c3cbedb7-6937-4716-b9e9-bcb4458b9d79
2
public boolean canShoot(Placeable currentObj) { for (GameAction currentGameAction : getGameActions()) { if (currentGameAction.canShoot(currentObj)) { return true; } } return false; }
a46c7fa7-615a-4459-8282-d5d0dfc11412
9
private Point getTargetBlock(Point cur){ int cnt = 0; if (this.maze[cur.x][cur.y + 1] == false) {cnt++;} if (this.maze[cur.x][cur.y - 1] == false) {cnt++;} if (this.maze[cur.x + 1][cur.y] == false) {cnt++;} if (this.maze[cur.x - 1][cur.y] == false) {cnt++;} if (...
68d13a88-beba-47b4-8331-d8b665d71ef2
7
public void checkingDataBasedOnDateSelected() { String datafromDisplay = dataFromLabel; System.out.println("datafromDisplay: " + dataFromLabel); try { file_Grouping = new File(SelectingLogFileToReadXml.PathOfFileUsedInDateBasedGrouping, "FileWithBlockDate.txt"); fwSeek = new FileWriter...
4bd26538-d9eb-42bf-a61c-a5dd6c0c4372
7
public static Rectangle transform(Rectangle rectangle, Direction direction, boolean horizontalFlip, boolean verticalFlip, int width, int hei...
aafd874b-b5b0-4b87-9227-ae966524a134
9
public void update(long elapsedTime) { // select the correct Animation Animation newAnim = anim; if (getVelocityX() < 0) { newAnim = left; } else if (getVelocityX() > 0) { newAnim = right; } if (state == STATE_DYING && newAnim == left) { ...
0fd65131-2d6d-41aa-a1d3-900c3812d5bd
2
@Override public boolean equals(Object object){ if(this.x == ((Coordinate)object).x && this.y == ((Coordinate)object).y) return true; else return false; }
e2472b54-fabb-4d10-bce7-e8f8343ada2d
2
public boolean type(char key, java.awt.event.KeyEvent ev) { if (key == 27) { if (justclose) ui.destroy(this); else wdgmsg("close"); return (true); } return (super.type(key, ev)); }
b32988fa-5686-4e71-97d1-808a35ef6927
2
public void useSurf() { surfing=true; messageBox=new ErrorWindow(); messageBox.addMessage("You ride on your Pokemon!","Hidden Move: Surf"); messageBox.repaint(); while(messageBox.isVisible()) { try { repaint(); Thread.sleep(10); } catch(Exception ignored){} } bgm.stop(); bikeSon...
c5e4bbad-fd7e-41d5-934d-d278f6bfb941
7
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TimeSheetPK other = (TimeSheetPK) obj; if (emp_ID != other.emp_ID) return...
c777a3cf-2ae9-45b8-a9f0-3f9498b972b8
2
private void addLeavesToList(ArrayList<AreaObject> list) { for (int i = 0; i < mStorageCount; i++) { if (mLeafNode) { list.add(mStorage[i]); } else { ((AreaNode) mStorage[i]).addLeavesToList(list); } mStorage[i] = null; } mStorageCount = 0; mLeafNode = true; }
38f4bc9b-c2ea-4509-bc87-3492a0515295
4
public void paint(GC gc, int width, int height) { if (!example.checkAdvancedGraphics()) return; Device device = gc.getDevice(); // top triangle Path path = new Path(device); path.moveTo(width/2, 0); path.lineTo(width/2+100, 173); path.lineTo(width/2-100, 173); path.lineTo(width/2, 0); // bottom ...
bafce702-58f7-4a73-9c7d-bf0021331b40
2
@Around(" call(void de.codecentric.performance.Demo.method* (..)) ") public void aroundDemoMethodCall(final ProceedingJoinPoint thisJoinPoint) throws Throwable { long cpuStart = threadMXBean.getCurrentThreadCpuTime(); long start = System.nanoTime(); thisJoinPoint.proceed(); long end = System.nanoTime(); lo...
eabccba5-fe8e-4174-a082-7702d0198374
6
* @return Returns the parsed response. Index 0 is response, Index 1 is confidence score */ private void parseResponse(String rawResponse, GoogleResponse googleResponse) { if (!rawResponse.contains("utterance")) return; String array = substringBetween(rawResponse, "[", "]"); ...
2c7add49-4163-454e-ae28-e101b401910e
2
public void wiggleSort(int[] nums) { int[] sorted=Arrays.copyOfRange(nums,0,nums.length); Arrays.sort(sorted); int minEnd=(nums.length-1)/2 , maxEnd=nums.length-1; for(int i=0;i<nums.length;++i){ if(i%2==0){ nums[i]=sorted[minEnd--]; }else{ ...
119b2c60-fdad-4ef9-8152-5a6bf01fe4e7
4
public static void testStdIO(){ //Reading standard input InputStreamReader cin=null; try{ cin = new InputStreamReader(System.in); println("Enter characters. 'q' to quit"); char c; do{ c = (char) cin.read(); println(c); }while(c!='q'); } catch(IOException ioe){ println("IOException...
4532c39b-da88-4c94-afcf-567ab9b719df
2
public List<Integer> getRWinfo() { if(type.equals(Type.READ) || type.equals(Type.WRITE)) { return getNumericList(operation); } return null; }
ed572497-8d0f-498e-80c0-b33807ad54ed
7
public int getSubsampleFrequency() { String freq = (String)subsampleFreqBox.getSelectedItem(); if (freq.equals(ALL)) { return 1; } if (freq.equals(HALF)) { return 2; } if (freq.equals(THIRD)) { return 3; } if (freq.equals(QUARTER)) { return 4; } if (freq.equals(TENTH)) { return 10; ...
dd5bb6ce-05a2-4292-879d-43332ca5b2ab
4
private int readRemaining( ByteBuffer dst ) throws SSLException { if( inData.hasRemaining() ) { return transfereTo( inData, dst ); } if( !inData.hasRemaining() ) inData.clear(); // test if some bytes left from last read (e.g. BUFFER_UNDERFLOW) if( inCrypt.hasRemaining() ) { unwrap(); int amount = ...
91c8cd5d-379d-4559-b84b-7e29fe3269bc
5
private String translateIndexToQuery(String ruleSymbol, boolean translatedFlag) { if (ruleSymbol.equals("Default") || translatedFlag) return ruleSymbol; String ruleString; if (ruleSymbol.equals(".")) ruleString = "intersect"; else if (ruleSymbol.equals("+")) ruleString = "union"; else if (domconfB...
7b485a01-69c1-4516-be6c-507dad65be91
2
public static Arena getArena(int id) { for (Arena a : SuperBaseBattle.arenaList) if (a.getArenaId() == id) return a; return null; }
803dc5db-6392-4ba1-8915-65ee94218949
0
public void showSplash() { setBackground(Color.white); JLabel label = new JLabel(createImageIcon(image1)); add(label, BorderLayout.CENTER); pack(); centerScreen(); setVisible(true); }
81db96bd-d4b0-4fb6-bd97-dad4289f0bc7
4
@Override protected void paintComponent(Graphics gc) { Insets insets = getInsets(); int x = insets.left; int y = insets.top; int width = getWidth() - (insets.left + insets.right); int height = getHeight() - (insets.top + insets.bottom); if (mInMouseDown && mPressed) { gc.setColor(Colors.adjustBrightness...
e2bff03f-5082-4e97-9dad-8e42837af634
8
@Override public void actionPerformed(ActionEvent e) { String action = e.getActionCommand(); if(action.equals("Exit")){ ui.exit(); } else if(action.equals("New grid..")){ ui.kaynnista(); } else if(action.equals("About")){ u...
50f339a8-cad1-49e9-93e4-cf1cbc1611d0
7
private Tuple<Float, HeuristicData> min(LongBoard state, HeuristicData data, float alpha, float beta, int action, int depth) { statesChecked++; Tuple<Float, HeuristicData> y = new Tuple<>((float) Integer.MAX_VALUE, data); Winner win = gameFinished(sta...
1540e625-1e82-45f8-ba35-3555d2710bfc
5
public boolean setStartPosition(int length) { if (length < 5 || length > 50) return false; int row = 0; int col = 0; Color c = null; do { row = 0 + (int) (Math.random() * length); col = 0 + (int) (Math.random() * length); c = map.grid[row][col]; } while (c != Color.GREEN); start_pos = new P...
8a43a97e-2128-42df-9745-2ac08adeec5e
3
public String getLetters(String str) { int breakPos = 0; for(int i = 0; i < str.length(); i++) //get the first letters in the string { char ch = str.charAt(i); if(!Character.isLetter(ch)) { breakPos = i; break; } if(i == str.length()-1) breakPos = i+1; } return str.substring(0,...
75503f19-7546-44c3-857f-d1ce1967a894
6
@Override public void run() { if (file == null) return; try { BufferedReader br = new BufferedReader(new FileReader(file)); br.readLine(); String line; ItemCatDao icDao = new ItemCatDao(); while ((line = br.readLine()) != null) { String[] values = line.split(","); ItemCat ic = new ItemCat...
2a9729c8-2f7a-4707-b870-f651a477c7b1
6
private void loadSector(File sectorFile) { try { Scanner scanner = new Scanner(sectorFile); Sector sector = new Sector(); while (scanner.hasNext()) { String line = scanner.nextLine(); if (line.startsWith("TRIANGLE")) { Strin...
2e73b72c-b532-4d43-b949-f58e68450280
5
public void method293(int z, int x, int y) { GroundTile groundTile = groundTiles[z][x][y]; if (groundTile == null) { return; } for (int j1 = 0; j1 < groundTile.anInt1317; j1++) { InteractiveObject interactiveObject = groundTile.interactiveObjects[j1]; if ((interactiveObject.uid >> 29 & 3) == 2 && inter...
121fa8e2-456e-426c-b1ee-f4e9cf42d2fd
7
@Override public boolean test(String value) { // TODO Auto-generated method stub if (value == null || value.length() == 0) { return false; } int len = value.length(); if (!Character.isUpperCase(value.charAt(0))) { return false; } for (int i = 1; i < len; i++) { char c = value.charAt(i); if (!...
68824b84-2487-4ad7-b689-a966bc417b91
1
public void handleInteraction(Automaton automaton, AutomatonSimulator simulator, Configuration[] configurations, Object initialInput) { SimulatorPane simpane = new SimulatorPane(automaton, simulator, configurations, environment, false); if (initialInput instanceof String[]) initialInput = java.util.Arr...
42fc88cb-70d6-41d8-973e-3c256ad9d268
2
@EventHandler(priority = EventPriority.HIGH) public void EntityTargetEvent (final Entity entity, final Entity target, final TargetReason reason) { if (entity instanceof Bat) { Bat wisp = (Bat) entity; if (MMWisp.isWisp(wisp)) { plugi...
88b0af15-5933-4ba5-93dd-96374aaeff13
2
String getValue(int i, int j) { if (j >= columns.size()) return null; ArrayList<String> col = columns.get(j); if (i >= col.size()) return null; return col.get(i); }
5f6b4846-07e7-4aca-b997-d3fa9d0c2ba5
6
public static Complex[] fft(Complex[] x) { int N = x.length; // base case if (N == 1) return new Complex[] { x[0] }; // radix 2 Cooley-Tukey FFT if (N % 2 != 0) { throw new RuntimeException("N is not a power of 2"); } // fft of even terms Complex[] even = new C...
a7f5a358-1e1a-40dc-bc92-86c78cd33e75
7
public static void main(String[] args) { // Using Sieve of Eratosthenes to mark all non-primes as false boolean[] nums = new boolean[200000]; for (int i = 2; i < nums.length; i++) nums[i] = true; int nextPrime = 2; while (nextPrime < nums.length / 2) { int i = nextPrime; for (; i < nums.length; i += ...
ff34e099-a4ee-4fda-b924-9ea9a0480e66
7
private SortedSet<Schema> readSchemas() throws IOException, CubeXmlFileNotExistsException, DocumentException, CorrespondingDimensionNotExistsException { Configuration conf = CubeConfiguration.getConfiguration(); FileSystem hdfs = FileSystem.get(conf); Path schemaXmlFile =...
1c29184c-d27c-4454-9746-c7bfadfe2bcc
0
public int getScore() { return score; }
bb9766d6-e0c3-4e50-8570-ab1da6f2d4ea
7
private RequestType parseRequest(BufferedReader input, StringBuilder arg) { String query; try { query = input.readLine(); } catch (IOException e) { System.out.println("\t\tMaster.parseRequest():\tError! I/O exception happened in readLine()."); return RequestType.EXCEPTION; } if (query == null || q...
8c8d0f79-2248-4953-84f0-e1fd4297f0e0
7
@Override public void doSharpen() { if (imageManager.getBufferedImage() == null) return; WritableRaster raster = imageManager.getBufferedImage().getRaster(); double[][] newPixels = new double[raster.getWidth()][raster.getHeight()]; for (int x = 1; x < raster.getWidth() - 1; x++) { for (int y = 1; y < raster...
c9371f43-00fc-4dee-b75f-b4db7cc31487
2
private void updateMovement(double time) { if (atDestinationNode()) { location = getLocFromMapLoc(currentDestinationX, currentDestinationY); if (isFinalDestination()) { updateFinalLoc(); } else { updateNextLoc(); } } else { gunAngle = bodyAngle = getLocFromMapLoc(currentDestinationX, currentD...
077dc018-9c8d-428a-959f-241c0a815676
0
public setNow() { this.info = "adjust the server time"; this.addParamConstraint("timestamp", ApiHandler.ParamCons.INTEGER,"the new timestamp of 'now', in ms"); }
40ff790c-1b2c-4889-8ed8-1c652190122d
3
public static Item[] getSortedInventoryList() { Item[] inventoryList = Survivalist.getCurrentGame().getInventory(); Item tempItem; for (int i = 0; i < inventoryList.length - 1; i++) { for (int j = 0; j < inventoryList.length - 1 - i; j++) { if (inven...
15bdb313-d1f0-419d-ac2f-f74b914ff5d8
6
@EventHandler public void MagmaCubeWeakness(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.getMagmaCubeConfig().getDouble("MagmaCu...
74f81194-51ab-4a05-bfc5-a1624255df48
4
public void bufferMap(){ // Pre-buffer map image // System.out.println("Buffering map"); int xLoc, yLoc; mapImage = new BufferedImage(maxX, maxY, BufferedImage.TYPE_4BYTE_ABGR); Graphics g = mapImage.getGraphics(); for (int y = 0; y < maxY/TILEWIDTH; y++) { for (int x = 0; x < maxX/TILEWIDTH; x++) { ...
15bcd142-199e-4d0b-8750-f6c05c3f45ce
5
public static Transmission parse (DataInputStream dis) { Transmission trans = null; try { while (dis.available() <= 0) Thread.sleep(10); // spin waiting for data trans = new Transmission(); trans.role = PlayerRole.lookupRole(dis.readInt()); ignore(dis); trans.startingCorner = StartCorner....
f507b0b2-85ca-4619-8d2a-cc52be89714e
5
public static void GAMING() throws IOException{ int timeblock = 1; BufferedReader r = new BufferedReader (new InputStreamReader(System.in)); while (timeblock > 0){ System.out.println("What would Damon like to play right now?"); { System.out.println("1. League of Legends"); System.out.println("...
48f33e5c-bf2b-4942-98e2-3e7792e5a153
8
public void paintComponent(Graphics g) { mxGraph graph = graphComponent.getGraph(); Rectangle clip = g.getClipBounds(); updateIncrementAndUnits(); // Fills clipping area with background. if (activelength > 0 && inactiveBackground != null) { g.setColor(inactiveBackground); } else { g.setColor(g...
71b121b6-e536-4f54-b0f2-27d8c8714fa5
6
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; StudentAttendance other = (StudentAttendance) obj; if (internalID == null) { if (other.internalID != null) return false; } else if (!int...
0c73e571-d7d0-4994-8555-e596f24ba945
0
public String getQuery() { return query; }
653e4ec1-cb6a-45f0-ae53-c4129547840c
0
public String getWrong() { return wrong; }
31c90479-27d5-4ac2-8953-7eecb3e73f21
8
private void listaVariaveis(boolean varLocal) { // <lista_variaveis> ::= <variavel> <lista_variaveis> | “}” // <variavel>::= <tipo_primitivo> <id> <compl_declaracao_var>| <id><id> “;” // <compl_declaracao_var> ::= “=” <valor> “;” | <definição_matriz> // <definição_matriz> ::= “[” <inteiro> “...
5f3611cf-539c-4926-a88c-b0c7517c3186
9
public void Download10KbyCIK(String symbol, boolean isCurrent) { GetURL gURL = new GetURL(); ArrayList<String> URLs = gURL.Get10kURLwithCIK(symbol, isCurrent); Iterator<String> it = URLs.iterator(); while(it.hasNext()) { String str = it.next(); int index0 = str.indexOf("data"); ...
d2ea851b-b373-43fc-a799-0905c6b18246
3
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (this.record != null) { if (qName.equals(this.className)) { // окончание чтения записи this.records.put(this.record.getUnique(), this.record); thi...
807f6baf-4ae0-45ac-8975-713feddd9753
2
public void setSizeField() { boolean fault = true; while (fault) { System.out.print("Введите размерность игрового поля: "); Scanner scanner = new Scanner(System.in); try { this.field.sizeField = scanner.nextInt(); fault = false; ...
bdc5e868-96b7-4ed5-b8c7-12d4b3ba03f5
9
@Override public Set<AndroidMethod> parse() throws IOException { Set<AndroidMethod> methodList = new HashSet<AndroidMethod>(INITIAL_SET_SIZE); BufferedReader rdr = readFile(); String line = null; Pattern p = Pattern.compile(regex); String currentPermission = null; while ((line = rdr.readLine()) != nu...
a31ad093-9a5b-4e90-a756-3e5bfc41ea10
2
public void setExtractMode(String extractMode) { if( !extractMode.equals(EXTRACT_MODE_TRUST) && !extractMode.equals(EXTRACT_MODE_INFER) ) { throw new RuntimeException("Invalid setting " + extractMode + " for parameter extractMode"); } this.extractMode = extractMode; }
d53aaf35-0d34-4623-9a95-946f82aad600
7
public double findMedianSortedArrays(int A[], int B[]) { int m = A.length, n = B.length; assert (m + n > 0); if (m == 0) { return n % 2 == 1 ? B[n / 2] : (double) (B[n / 2 - 1] + B[n / 2]) / 2.; } if (n == 0) { return m % 2 == 1 ? A[m / 2] : (double) (A[...
c4d0649b-3768-4905-8f17-39e1ddbdbd44
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...
e9edefe3-16c6-4586-b169-635b847bf0bb
8
private HttpHandler createContext() { return new HttpHandler() { @Override public void handle(HttpExchange he) throws IOException { he.getResponseHeaders().add("Access-Control-Allow-Origin", "*"); String path = he.getRequestURI().getPath()...
6afabc95-b438-4b7a-9e0d-51816e7bc0fe
1
private void disp(int[] bowl) { String str = "|"; for (int i = 0; i < bowl.length; i++) { str += " " + bowl[i] + " |"; } str += "\n"; System.out.println(str); }
ec4dfd3a-54e1-41aa-8f6d-8902c2342b84
7
public void printReport(ArrayList<Diff> aDiffL) throws Exception { ArrayList<Diff> firstL, secondL; String report; String newL = System.getProperty("line.separator"); //separating the diffs depending on their schema firstL = new ArrayList(); secondL = new ArrayList(); ...
f0fb6a93-b6b3-4089-9185-6fd6cf63d661
4
@SuppressWarnings("unchecked") private void thursdayCheckActionPerformed(java.awt.event.ActionEvent evt) { if(this.dayChecks[4].isSelected()) { this.numSelected++; if(this.firstSelection) { stretch(); } ...
37a91c3d-71c4-437d-9faa-d3b360e07525
8
public static boolean resizeVideo(Rectangle newVideoBounds) { try { Player player = null; ServiceContext serviceContext = ServiceContextFactory.getInstance().getServiceContexts()[0]; if (serviceContext != null && serviceContext.getService() != null && serviceConte...
69ee7feb-4067-4c8c-9871-31c1ef3f2447
3
public V valAt(K key) { if (key == null) return getNullVal(); V val = map.get(key); if (val != null) return val; val = lookup.valAt(key); if (val != null) map.putIfAbsent(key, val); return val; }
3f2a4dd8-7a7d-4b86-9cf5-e4fd9f45f6b1
2
public static Vector<Caddie> getContenuCaddie () throws BDException { Vector<Caddie> res = new Vector<Caddie>(); String requete = "select idr, nomS, TO_CHAR(DATEREP, 'DD/MM/YYYY HH24:MI') AS DATEREP, lecaddie.numS, lecaddie.numZ, nomC, qt from lesspectacles, lecaddie, leszones where lesspectacles.numS=lecaddie.nums...
ca393018-cddf-4df4-b8ec-772dd5d87437
4
public int uniquePaths(int m, int n) { // Note: The Solution object is instantiated only once and is reused by // each test case. int[][] grid = new int[m][n]; for (int i = m - 1; i >= 0; --i) { grid[i][n - 1] = 1; } for (int j = n - 1; j >= 0; --j) { grid[m - 1][j] = 1; } for (int i = m - 2; i >=...
fd2d9f2e-1938-45e7-80c7-1e82b0179a98
2
public static int countPageHtmlCode(final String filePath) throws IOException{ File file = new File(filePath); FileReader leavesFileReader = new FileReader(file); BufferedReader br = new BufferedReader(leavesFileReader); int count = 0; String line; while((line = br.readLine()) != null){ if(line.contains(...
d91b1d3c-d18d-4e0e-8fcf-1ef254a13e96
6
private boolean processConjunction(List<Boolean> values, Conjunction conjuntion) { boolean retVal = true; if (conjuntion.equals(Conjunction.Or)) { retVal = false; } for (Boolean bool : values) { if (conjuntion.equals(Conjunction.And)) { retVal = retVal && bool; } if (conjuntion.equals(Conju...
6ea9844d-c3df-4b89-9819-e923069c8a9b
1
private int scoreBowl(int[] bowl) { int score = 0; for (int i = 0; i < preferences.length; i++) { score += bowl[i] * preferences[i]; } return score; }
16bd6aa1-07f6-4f07-bb1b-a4493cdf1797
4
private void refreshClassList() { selectClassContainer.clear(); // first show all classes for (Image img : selectClassImageList) { selectClassContainer.add(img); } // then set visibility of classbuttons depending on classes taken int i = 1; if (DDOCharacter.getTakenClasses().size() >= 3) { s...
e0122d8c-cb63-4d3c-bb11-645a766e57a6
8
public void testBuild00(){ TrieBuilder builder = DoubleArrayTrieImpl.createBuilder(); try { builder.build(null); fail(""); } catch (IllegalArgumentException e){ assertEquals("The list of keys is null.", e.getMessage()); } catch (Exception e){ ...
1182f6d1-64bd-42e1-8737-a1cd72a1cd0c
6
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } if (super.equals(o)) { return true; } orgataxe.entity.Vehicle vehicle = (orgataxe.en...
e77f293e-ed85-4b98-97c9-bad8086e149c
1
@Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { JLabel result = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, ...
bf828be4-1f41-4cea-b86a-caf83f88d02e
1
public TestLinkUriResolverTest(URI expectedUri, final TestLinkId<?> testLinkId) { this.testLinkId = testLinkId; this.expectedUri = expectedUri; }
ca4411b0-e695-4eb3-9953-aabfec2305f6
1
private static void printDeck(String[] bestDeck) { for (String s : bestDeck) { System.out.print(s + ", "); } }
36be4bb5-d5af-4cfd-965a-871975e6e842
8
public Point toGate(Point current){ double ox = 0, oy = 0; Point gate = new Point(dimension/2, dimension/2); // if both the x and y of the piper are farther than 1 from the gate, change both // !finishround signifies that the piper is not ready to move towards the target yet if(Math.abs(gate.x - current.x) > ...
bf20d134-04c7-4dca-8ed0-8df731a0bbc0
2
public static String[] removeSlashStrings(String[] data) { ArrayList<String> result = new ArrayList<String>(); for (int i = 0; i < data.length; i++) { if (!data[i].equals("/")) { result.add(data[i]); } } String[] res = new...
27b91400-18b0-408a-ac58-f456ddea2b22
5
public void keyReleased(KeyEvent e) { int keycode = e.getKeyCode(); System.out.println("key released: "); switch(keycode) { case KeyEvent.VK_UP: System.out.println("up"); this.upPress = false; break; case KeyEvent.VK_DOWN: System.out.println("down"); this.downPress = false; break; ...
9cef9fc8-f105-4a7e-9cc6-fbc403a8d451
9
private CommandResponse doGet(String commandName, List<Pair<String,String>> headers, Object commandParameters, Class<?> responseCastClass) //throws ClientException may need to add this in later { CommandResponse result = null; int clientVersion = 0; if(commandName.contains("game/model")) { int modelIndex = co...
45f956ef-5c21-48aa-b5f3-ad52f4422d1c
5
private InetAddress findMatch(String dest) { InetAddress realDstIP = null; int prefixLength = 0; /* Finds the best matching prefix for the destination IP */ for (String prefix : prefixes.keySet()) { String[] prefixArr = prefix.split("\\."); String[] destArr = dest.split("\\."); String p = ""...
99a8572b-6b7a-4c57-92bb-591a6d1d1ffe
3
public boolean isPrime(long num) { if (num % 2 == 0) {return false;} else { for (long x = 3l; x*x < num; x += 2) { if(num % x == 0) { return false; } } } return true; }
1e690cf9-dcad-4943-9fe5-9c68e41d5915
9
static RunnerConfig parseCommandLine( Options opts, String[] args ) throws ParseException, UnknownHostException { final CommandLine cl = new GnuParser().parse( opts, args ); if( cl.hasOption( OPT_h ) ) { // Jnetcat -l new HelpFormatter().printHelp( "Jnetcat [ -h ] [ -l listenPort [ listenAddr ] ] ", opts ); ...
8aaf9cda-10fa-41ae-8b5a-0ab899dae6ba
2
public boolean delBannedWord(String badWord) { if (badWord.indexOf(":") > 0) { String thisSplut[] = badWord.split(":",2); badWord = thisSplut[0]; } if (wordList.containsKey(badWord)) { wordList.remove(badWord); saveWordList(); return true; } else { return false; } }
60e40458-e6b1-4661-a917-8905b537b26f
1
public static DatabaseClosure createClosure(String name, File target) { if (closures.containsKey(name)) throw new RuntimeException("Closure with that name already exists."); DatabaseClosure closure = new DatabaseClosure(name, target); return closures.put(name, closure); }
60b2929d-c00c-480c-9732-2a3d6c23441c
8
private static Map<? extends Attribute, ?> fixattrs(Map<? extends Attribute, ?> attrs) { Map<Attribute, Object> ret = new HashMap<Attribute, Object>(); for(Map.Entry<? extends Attribute, ?> e : attrs.entrySet()) { if(e.getKey() == TextAttribute.SIZE) { ret.put(e.getKey(), ((Number)e.getValue()).floatValue()); ...
9cfee2ef-5161-49e8-ba78-346354557026
7
private boolean pushPrimitiveArg(Class<?> argclass, Object arg) { if (argclass.equals(Float.class)) { pushFloatArg((float) arg); } else if (argclass.equals(Integer.class)) { pushIntArg((int) arg); } else if (argclass.equals(Long.class)) { pushLongArg((long) ar...
94dbbca7-2934-4b9c-b83a-9d67011546c2
2
public double getDuration() { // Return nothing if we don't have sufficient information. if(this.dateRoundStarted == null || this.dateRoundEnded == null) return -1; // Get our round duration long diffMilliseconds = (this.dateRoundEnded.getTime() - this.dateRoundStarted.getTime()); double seconds ...
f24348e9-4621-43cb-af94-fe4fe1d08447
8
public static void main(String[] args) { if(true && true){ System.out.println(1); } if(true && false){ System.out.println(2); } if(false && true){ System.out.println(3); } if(false && false){ System.out.println(4); } }