text
stringlengths
14
410k
label
int32
0
9
private DefaultMutableTreeNode createNodes(FAT32Directory rootElement) { DefaultMutableTreeNode node = new DefaultMutableTreeNode(rootElement); DefaultMutableTreeNode childNode; int i = 0; FAT32Directory[] childs = new FAT32Directory[rootElement.getChildDirectories().size()]; ...
2
public boolean isYCollision(int y) { Point midpoint = getMidPoint(x, y, BOAT_WIDTH, BOAT_HEIGHT, rotation); int centreX = (int) midpoint.getX(); int centreY = (int) midpoint.getY(); if (centreX > 150 && centreX < 1050 && centreY > 0 && centreY < map.grass.getHeight()) { Color c = new Color(map.grass.getRG...
7
public Object getResponseResult(HttpResponse response, String produces, Type returnType) throws Exception { if (response == null || produces == null || returnType == null) { throw new IllegalArgumentException("Response, produces and returnType cannot be null"); } if (isResponseSuccessful(response.getStatus()...
9
public static TVFFile read(DataInputStream stream) throws IOException { TVFFile tvf = new TVFFile(); tvf.magic = new byte[themagic.length]; for (int i = 0; i < tvf.magic.length; i++) { tvf.magic[i] = stream.readByte(); } tvf.turremVersion = new byte[3]; for (int i = 0; i < tvf.turremVersion.length...
9
public BaseExtractor createExtractor(int countOfClusters) { if (countOfClusters < COUNT_OF_CLUSTERS_FAT12) { System.out.println("FAT12Extractor do not implemented yet!"); throw new RuntimeException("FAT12Extractor do not implemented yet!"); } else if (countOfClusters < COUNT_OF_C...
2
public boolean isMultiPlayerJoinOpen() { HUD hud = null; for (int i = (huds.size() - 1); i >= 0; i--) { hud = huds.get(i); if (hud.getName().equals("ScreenMultiPlayerJoin")) { return hud.getShouldRender(); } } return false; }
2
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Book other = (Book) obj; if (!Objects.equals(this.isbn, other.isbn)) { return false; ...
6
@EventHandler(priority = EventPriority.HIGHEST) public void onCraft(CraftItemEvent event) { try { if (!BackpackUtil.isBackpack(event.getRecipe().getResult())) return; final HumanEntity entity = event.getWhoClicked(); final ItemStack result = event.getRe...
9
public void drawBlocks(Graphics g){ for( int i = 0; i<Constant.MAP_Array_SIZE; i++){ for( int j = 0; j <80; j++){ switch(this.array[i][j]){ case 1: g.drawImage(grass, j * 10 + 50, i * 10 + 50, 10, 10, this); break ; case 2: g.drawImage(this.wall, j * 10 + 50, i * 10 + 50, 10, 10, this); ...
6
public Projeto selectTodosProjetos() throws SQLException { Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; Projeto projet = null; try { conexao = BancoDadosUtil.getConnection(); comando = conexao.prepareStatement...
7
public synchronized void removeClassPath(ClassPath cp) { ClassPathList list = pathList; if (list != null) if (list.path == cp) pathList = list.next; else { while (list.next != null) if (list.next.path == cp) ...
4
@Override public Hashtable<Short, Integer> getDistribution() { Hashtable<Short, Integer> dist = new Hashtable<Short, Integer>(); for (Short i : filter) { Integer freq = dist.get(i); if (freq==null) { dist.put(i, 1); } else dist.put(i, ++freq); } return dist; }
2
public void setLowThreshold(float threshold) { if (threshold < 0) throw new IllegalArgumentException(); lowThreshold = threshold; }
1
private void searchLastNameFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_searchLastNameFieldKeyTyped int strLength = searchLastNameField.getText().length(); // Vi checker længden på vores String så vi kan begrænse dens max længde i vores IF-statement nedenfor. char c = evt.getKeyCha...
4
private static void getFromHDFS(String hdfsFilePath, String localFilePath) { try { Registry nameNodeRegistry = LocateRegistry.getRegistry(Hdfs.Core.NAME_NODE_IP, Hdfs.Core.NAME_NODE_REGISTRY_PORT); NameNodeRemoteInterface nameNodeStub = (NameNodeRemoteInterface) nameNodeRegistry.lookup("NameNode"); HDFSF...
7
public boolean Auth(String username, String password, final boolean isOk) { driver.get("http://localhost:8090/auth"); final String elementToFind = (isOk) ? "userId" : "error"; WebElement element = driver.findElement(By.name("username")); element.sendKeys(username); element = driv...
4
public static List<Fonction> selectFonction() throws SQLException { String query =""; List<Fonction> fonctions = new ArrayList<Fonction>(); ResultSet resultat; try { query = "SELECT * from FONCTION "; PreparedStatement pStatement = (PreparedStatement) Connection...
2
public static void main(String[] args){ Scanner in = new Scanner(System.in); int n = in.nextInt(); int m = in.nextInt(); ArrayList<ArrayList<Integer>> g = new ArrayList<ArrayList<Integer>>(); boolean[] visited = new boolean[n+1]; for(int i=0;i<=n;i++){ visited[i]=false; g.add(new ArrayList<Integer>...
3
public String raise(int minRaise, int maxRaise){ double avrgOppAPW = getAvrgOppAPW(match.holeCards.size()); if (avrgOppAPW != 0.0) { double avrgOppWin = getAvrgOppWin(match.holeCards.size()); if (avrgOppAPW <= 0.35) { if (avrgOppWin >= (match.stackSize / 4)) { weight *= 1.5; } } if (avr...
9
public String GetImage() { if (bufpos >= tokenBegin) return new String(buffer, tokenBegin, bufpos - tokenBegin + 1); else return new String(buffer, tokenBegin, bufsize - tokenBegin) + new String(buffer, 0, bufpos + 1); }
1
public Inches(float i) { this.quantity = i; }
0
public void sendMessage(String receiver, String message) { try { mServerInt.sendMessage(mUserName, receiver, message, ServerInterface.CLIENT); } catch (RemoteException e) { if(connect()) { sendMessage(receiver, message); return; } System.out.println("Error while sending message"); } }
2
public void readData(String trainingFileName) { try { FileReader fr = new FileReader(trainingFileName); BufferedReader br = new BufferedReader(fr); // 存放数据的临时变量 String lineData = null; String[] splitData = null; int line = 0; // 按行读取 while (br.ready()) { // 得到原始的字符串 lineData = br.readL...
7
private static BitSet readVersionSet( int versionSetSize, byte[] data, int p ) { BitSet versions = new BitSet( versionSetSize*8 ); p += versionSetSize-1; for ( int j=0;j<versionSetSize;j++,p-- ) { byte mask = (byte)1; for ( int k=0;k<8;k++ ) { if ( (mask & data[p]) != 0 ) versions.set( k+(...
3
static void setClock(int clock, boolean oTime) { if (oTime) { if ("black".equals(Engine.color)) { whiteClock = clock; } else { blackClock = clock; } } else if ("black".equals(Engine.color)) { blackClock = clock; } el...
3
@Override public void getAll() throws SQLException { Connection dbConnection = null; java.sql.Statement statement = null; String selectCourses = "SELECT id_person, name, surname, date_of_birth, pin, phone_number, position_id FROM person"; try { dbConnection = PSQL.getConnection(); statement = dbConnectio...
4
@Override public String print() { String print = ""; for (int i = 0; i < expressionList.size(); i++) { print += expressionList.get(i).print(); if (i != expressionList.size() - 1) { print += " " + arithmeticParameter.getSymbol() + " "; } } ...
2
private Map<Position, Tile> createTileMapFromStrings(String[] tileStringArray){ Map<Position, Tile> tileMap = new HashMap<Position, Tile>(); for(int i = 0; i < 16; i++){ String line = tileStringArray[i]; for(int j = 0; j < 16; j++){ char c = line.charAt(j); String type = "error"; if(c == '.'){ type...
7
private boolean setPrecisionArgPosition() { boolean ret=false; int xPos; for (xPos=pos; xPos<fmt.length(); xPos++) { if (!Character.isDigit(fmt.charAt(xPos))) break; } if (xPos>pos && xPos<fmt.length()) { if (fmt.charAt(xPos)=='$') { positionalPrecision ...
5
public ArrayList<Cidade> consultar(String id){ ArrayList<Cidade> cidades = new ArrayList<>(); try { if(id.equals("")){ sql = "SELECT * FROM tb_cidade"; }else{ sql = "SELECT * FROM tb_cidade WHERE id='"+id+"'"; } ...
3
public void listDirectory() throws IOException { String directory = ""; for(int i = 0; i < 3; i++){ // 3 is to iterate through all the directories if(oft.readDiskToBuffer(0, i) == -1) break; byte[] memory = oft.getBuffer(0); for(int j = 0; j < memory.length; j = j + DIRECTORY_ENTRY_SIZE_IN_...
8
private static void drawBio (Display d) { int max = 50; int max_iter = 50; Complex t = new Complex(0,0); int X = WIDTH/2; int Y = HEIGHT/2; for (int y = -Y; y < Y; ++y) { for (int x = -X; x < X; ++x) { Complex z = new Complex (x*0.01,y*0.01); Complex c = new Complex(1.00003,1.01828); i...
7
@Override public void actionPerformed(ActionEvent event) { Component comp = getFocusOwner(); if (comp instanceof JTextComponent) { ((JTextComponent) comp).selectAll(); } else { SelectAllCapable selectable = getTarget(SelectAllCapable.class); if (selectable != null && selectable.canSelectAll()) { sel...
3
public static void setObject(Item i, String readerName) { ObjectInfo oi = new ObjectInfo(); oi.setType(i.getSym()); i = Scanner.get(); oi.setName(String.valueOf(i.getVal())); if(oi.getType() == Constants.STRING) { if(Scanner.get().getSym() == Constants.BECOMES) { Item val = Scanner.get(); ...
4
public void keyTyped(KeyEvent e) { }
0
private void cleanUpOldAndTemporaryfiles(String newDir, String tempDir){ System.err.println("deleting unneeded temporary files"); System.gc(); for(int entry=0;entry<writeInvFile.length;entry++){ File pl_f=new File(newDir+"/pl_e"+entry+".dat"); File ospl_f=new File(tempDir...
9
public ArrayList<String> topClassesExtractor(SimpleGraph openGraph, SimpleGraph closeGraph) throws IconvisOntoDataRetrieveException { log.debug("[OntologyParser::topClassesExtractor] BEGIN"); ArrayList<String> topClasses = new ArrayList<String>(); try { ArrayList<String> downClasses ...
8
public static void main (String args[]) throws InterruptedException{ System.out.println("Starting"); ExecutorService exec = Executors.newCachedThreadPool(); Future<?> fu = exec.submit(new Callable<Void>(){ @Override public Void call() throws Exception { Random r = new Random(); for(int...
3
@Override public double getAmount() { double result = 0.0; if(positive.isDown()) { result += 1.0; } if(negative.isDown()) { result -= 1.0; } return result; }
2
public static void main(String[] args) { Scanner scanner=new Scanner(System.in); int cases=scanner.nextInt(); while (cases-->0){ int n=scanner.nextInt(); List<Point> pointList=new ArrayList<>(); while (n-->0){ pointList.add(new Point(scanner.ne...
2
public int plusDMLookback( int optInTimePeriod ) { if( (int)optInTimePeriod == ( Integer.MIN_VALUE ) ) optInTimePeriod = 14; else if( ((int)optInTimePeriod < 1) || ((int)optInTimePeriod > 100000) ) return -1; if( optInTimePeriod > 1 ) return optInTimePeriod + (this.unstab...
4
private void updateWaypoints(String wps){ LinkedList<Position> points = new LinkedList<Position>(); wps.replace("set waypoints ", ""); //remove beginning of the message String[] tokens = wps.split(" "); System.out.println("Received " + tokens.length + " wayponts!"); for(String token : tokens){ String[] way...
3
public void testMinYear() { final ISOChronology chrono = ISOChronology.getInstanceUTC(); final int minYear = chrono.year().getMinimumValue(); DateTime start = new DateTime(minYear, 1, 1, 0, 0, 0, 0, chrono); DateTime end = new DateTime(minYear, 12, 31, 23, 59, 59, 999, chrono); ...
3
*/ @Override public void mouseWheelMoved(MouseWheelEvent e) { double scaleFactorMultiplier; double x = e.getX(), y = e.getY(); int wheelDirection = e.getWheelRotation(); if(wheelDebouncerOn == true) { if(wheelDirection < 0) { i...
9
public static String urlDecode(String string) { if (string == null) { return null; } try { return URLDecoder.decode(string, "UTF-8"); } catch (Exception e) { return string; } }
2
public JSONArray toJSONArray(JSONArray names) throws JSONException { if (names == null || names.length() == 0) { return null; } JSONArray ja = new JSONArray(); for (int i = 0; i < names.length(); i += 1) { ja.put(this.opt(names.getString(i))); } re...
3
public Pair<Item, Item> getStartAndEndItem(NonTerminal nt) { if (nt == grammar.startSymbol) { return new Pair<Item, Item>(startItem, endItem); } Item start = new StartItem(0, nt); Item end = new EndItem(1); start.shift = new Transition(start, nt, end); for (Item i : items) { if (i.atBegin() && i...
7
@Override public void actionPerformed(ActionEvent ae) { if (ae.getActionCommand().equals("/exit")) { gameLogic.exit(); System.exit(0); } else if (ae.getActionCommand().equals("/cheat")) { gameLogic._sideBar.addCard(BoardObject.type.DEV); gameLogic._sideBar.addCard(BoardObject.type.WHEAT); gameLogic._si...
6
private boolean _jspx_meth_html_html_0(PageContext _jspx_page_context) throws Throwable { PageContext pageContext = _jspx_page_context; JspWriter out = _jspx_page_context.getOut(); // html:html org.apache.struts.taglib.html.HtmlTag _jspx_th_html_html_0 = (org.apache.struts.taglib.html.HtmlTag...
6
private void checkConnect(String[] tokens) { final String IPADDRESS_PATTERN = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])$"; if(tokens.length > 2) { Pattern pattern = Pattern...
6
public void method212(boolean flag, int xSize, int ySize, int x, int y, int rotation) { int k1 = 256; if (flag) { k1 += 0x20000; } x -= offsetX; y -= offsetY; if (rotation == 1 || rotation == 3) { int srcX = xSize; xSize = ySize; ySize = srcX; } for (int i2 = x; i2 < x + xSize; i2++) { if...
9
public static void doChanges(LauncherAPI api, Class<?> clazz) { try { final Class<?> c = api.getLauncher().getClassLoader() .loadClass("net.minecraft.client.Minecraft"); for (final Field field : c.getDeclaredFields()) { ...
7
KMPSearchState remove( KMPSearchState item ) throws MVDException { KMPSearchState previous,list,temp; previous = temp = list = this; while ( temp != null && temp != item ) { previous = temp; temp = temp.following; } if ( previous == temp ) // it matched immediately { list = temp.following; // co...
4
public void onStart(IContext context) throws JFException { engine = context.getEngine(); console = context.getConsole(); indicators = context.getIndicators(); console.getOut().println("---Auto Trader ON---"); }
0
@Override public void receive(IPInterfaceAdapter src, Datagram datagram) throws Exception { // hello message received from one of our neibourg (maybe not) if (datagram.getPayload() instanceof HelloMessage) { HelloMessage hello = (HelloMessage) datagram.getPayload(); // Check...
8
public List<Download> getDownloadsListFiltered() { ArrayList<Download> list = new ArrayList<Download>(); for (Download download : downloads.values()) { if (stateFilter.contains(download.getStatus())) { list.add(download); } } return list; }
2
private List<Section> parseFile(final File file) throws FileNotFoundException, IOException { listOfSections = new LinkedList<Section>(); final BufferedReader input = new BufferedReader(new FileReader(file)); final StringBuilder docsText = new StringBuilder(); final StringBui...
4
public static int getInt(String prompt, int low, int high) { final int ALLOWABLE_INPUT_FAILURES = 3; // Avoid leaving a user stuck in here infinitely. If they fail to enter an int after 3 tries, bail out anyway. String response; int inputFailureCount = 0; while (true) { // use an infinite loop. Exit will occur ...
6
public void setType(EComponentType type) throws ComponentException { if (type == null) { throw new ComponentException("Type is null"); } if (this.type != null) { throw new ComponentException("Type has already been set"); } this.type = type; }
2
public void testGet() { YearMonth test = new YearMonth(); assertEquals(1970, test.get(DateTimeFieldType.year())); assertEquals(6, test.get(DateTimeFieldType.monthOfYear())); try { test.get(null); fail(); } catch (IllegalArgumentException ex) {} try...
2
public void hyperlinkUpdate(HyperlinkEvent e) { if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane pane = (JEditorPane) e.getSource(); if (e instanceof HTMLFrameHyperlinkEvent) { HTMLFrameHyperlinkEvent evt = (HTMLFrameHyperlinkEvent) e; HTMLDocument doc = (HTMLDocument) pane...
3
public int getFirmwareVer() { return lastFirmwareVer; }
0
public static String underscoreFromCamel(String str) { if (str == null) { return null; } StringBuilder sb = new StringBuilder(); char[] a = str.toCharArray(); for (char element : a) { char c = element; if (c >= 'A' && c <= 'Z') { ...
9
public String getMessage() { String message = this.content + " - by: " + this.user.getName() + "\n"; return message; }
0
private void isLessThanInteger(Integer param, Object value) { if (value instanceof Integer) { if (!(param < (Integer) value)) { throw new IllegalStateException("Integer is not greater than supplied value."); } } else { throw new IllegalArgumentException(); } }
2
public static Stack<String> getNames(CommandDescriptor descriptor) { Stack<String> commands = new Stack<>(); commands.push(descriptor.getName()); Dispatcher dispatcher = descriptor.getDispatcher(); while (dispatcher != null && dispatcher.getDescriptor() != null) { ...
3
public static boolean kifVariableDeclarationP(Stella_Object tree) { { Surrogate testValue000 = Stella_Object.safePrimaryType(tree); if (testValue000 == Logic.SGT_STELLA_CONS) { { Cons tree000 = ((Cons)(tree)); switch (tree000.length()) { case 1: return (Logic.que...
7
private boolean mouseOver() { if (window.mouse.width>x && window.mouse.height>y && window.mouse.width<x+w && window.mouse.height<y+h ) return true; return false; }
4
public String receiveMessage() { byte[] data = new byte[1024]; DatagramPacket packet = new DatagramPacket(data, data.length); try { connectionSocket.receive(packet); } catch (Exception e) { e.printStackTrace(); } return new String(packet.getData())...
1
public void processUpdateOrder(String orderId, String orderSz, String orderPr, String QteTime) { System.out.println("Received Update call back with follg. values"); System.out.print("OrderId: " + orderId); System.out.print(" orderSz: " + orderSz); System.out.print(" orderPr: " + ord...
8
public ResultSet getList(String whereString) { StringBuffer sql = new StringBuffer(""); sql.append("SELECT Question_ID,QType_ID,noofwords,instructions"); sql.append(" FROM `Essay`"); if (whereString.trim() != "") { sql.append(" where " + whereString); } SQLHe...
1
private void fillbuf(byte[] buf, int off, int len) { double[] val = new double[nch]; double[] sm = new double[nch]; while(len > 0) { for(int i = 0; i < nch; i++) val[i] = 0; for(Iterator<CS> i = clips.iterator(); i.hasNext();) { CS cs = i.next(); if(!cs.get(sm)) { i.remove(); ...
9
public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); String[] coins = br.readLine().split(" "); int num_coin = coins.length; int[][] result = new int[n + 1][num_coin]; for (int i = 0; i ...
5
@Override public void setByte(long i, byte value) { if (value < 0 || value > 1) { throw new IllegalArgumentException("The value has to be 0 or 1."); } if (ptr != 0) { Utilities.UNSAFE.putByte(ptr + i, value); } else { if (isConstant()) { ...
4
public boolean actionChats(Actor actor, Actor other) { // Base on comparison of recent activities and associated traits, skills // or actors involved. float success = talkResult(SUASION, SUASION, TRUTH_SENSE, other) ; other.mind.incRelation(actor, success / 10) ; switch (Rand.index(3)) { ...
4
public static void main(String[] args) { Scanner scan = new Scanner(System.in); System.out.print("Please enter the number of games to run: "); int numGames = scan.nextInt(); RPSScoreKeeper keeperRock = new RPSScoreKeeper(); RPSScoreKeeper keeperPaper = new RPSScoreKeeper(); RPSScoreKeeper keeper...
9
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (!(obj instanceof InstanceAce)) return false; InstanceAce other = (InstanceAce) obj; if (objectHashCode == null) { if (other.objectHashCode != null) return false; } else if (!object...
9
public int getData( ) { return data; }
0
private void parseAreYouSure(String input) { Scanner scanner = new Scanner(input); if (scanner.hasNext()) { String next = scanner.next(); if( (next.equals("yes") || next.equals("y")) && !scanner.hasNext()) { state = State.Normal; if (caller == AreYouSureCaller.Newgame) doNewGame(); else if (c...
8
private ByteMatcher createRandomByteMatcher() { int matcherType = random.nextInt(9); boolean inverted = random.nextBoolean(); switch (matcherType) { case 0: return AnyByteMatcher.ANY_BYTE_MATCHER; case 1: return OneByteMatcher.valueOf((byte) random.nextInt(256)); case 2: return new InvertedBy...
9
private HeaderContext getParsedHeaders(String headerPart) { final int len = headerPart.length(); HeaderContext headers = new HeaderContext(); int start = 0; for (;;) { int end = parseEndOfLine(headerPart, start); if (start == end) { break; ...
7
private void startCollectionEditing() { // Work on shiet // Drawing Text field for collection name cp5.getController("enter collection name").setPosition(posX + 36, posY + 100); cp5.getController("enter collection name").setVisible(true); // Add buttons for set key, loadFile, delete and save collection ...
1
public void mouseMoved(MouseEvent me) { int toolMode = documentViewModel.getViewToolMode(); if (toolMode == DocumentViewModel.DISPLAY_TOOL_SELECTION && !(annotation.getFlagLocked() || annotation.getFlagReadOnly())) { ResizableBorder border = (ResizableBorder) getBorder(); ...
4
private String parseTextElement(String name) throws ParserException, XMLStreamException { StringBuilder text = new StringBuilder(); startElement(name); while (is(CHARACTERS) || is(COMMENT)) { if (is(CHARACTERS)) { text.append(look().toString()); } next(); } endElement(name); return replaceEscap...
3
public static ArrayList<Class<?>> getDetectedMouseClasses() { if (detected == null) { detected = new ArrayList<Class<?>>(); } return detected; }
3
private void showTrack() { int counter = 0; while(counter < tracksize) { if (posFido == counter) { System.out.print('F'); } else { System.out.print('o'); } counter++; } System.out.println(); counter = 0; while(counter < tracksize) { if (posSpot == counter) { System.out.print('S...
7
@Test public void testGetLocationsByDeployment() throws IOException { List<Location> remoteLocations = dexmaRestFacade.getLocationsByDeployment(265L); assertEquals(3,remoteLocations.size()); Iterator<Location> itRemote = remoteLocations.iterator(); while (itRemote.hasNext()) { Location loc =...
3
public ArrayList<Molecule> selectRandMols(int n){ ArrayList<Molecule> randMols = new ArrayList<Molecule>(); int max = bucket.size(); int prevRand = 0; //System.out.printf("Max: %d\n", max); int rand; for(int i=0; i<n; i++){ rand = (int) (Math.random()*(double)max); while(rand==0 || ...
3
@Override public void startBackgroundMusic() { System.out.println("*** startBackgroundMusic ***"); musicVolume = Options.getAsFloat(Options.MUSIC, "1.0f"); if (!isMuted() && hasOggPlaybackSupport()) { if (isPlaying(BACKGROUND_TRACK)) stopBackgroundMusic(); nextSong++; if (nextSong>4) nextSo...
6
public static void redistributeWorker(long time, Peer peer, String workerId, OurSim ourSim) { Allocation workerAllocation = peer.getAllocation(workerId); if (workerAllocation == null) { return; } PeerRequest request = workerAllocation.getRequest(); if (request != null) { request.removeAllocated...
6
private int getBombCount() { ArrayList<Spot> neighbors = grid.getNeighbors(loc); int count = 0; for(Spot s : neighbors) if (s.isBomb()) count++; return count; }
2
public boolean move(Direction dir) throws GameException { int length = getMaximumFreeDistance(dir, (int)speed); switch(dir) { case TOP: setLocation(getX(), getY()-length); break; case BOTTOM: setLocation(getX(), getY()+length); break; case LEFT: setLocation(getX()-length, getY()); break;...
5
@Override public String toString() { switch(this) { case uneEtoile: return "★"; case deuxEtoiles: return "★★"; case troisEtoiles: return "★★★"; case quatreEtoiles: return "★★★★"; case cinqEtoiles: return "★★★★★"; } return null; }
5
public FileExtensionFilter(String extension) { this.extension = extension; }
0
private static void execDir( File f ) { if( f.isDirectory() ) { String[] children = f.list(); for( int i = 0; i < children.length; i++ ) { execDir( new File( f, children[i] ) ); } } else if( f.getName().indexOf( "RunSamples" ) == -1 ) { String fn = f.getName(); String packagename = f.ge...
8
@RequestMapping(value="/student.do", method=RequestMethod.POST) public String doActions(@ModelAttribute Student student, BindingResult result, @RequestParam String action, Map<String, Object> map){ Student studentResult = new Student(); switch(action.toLowerCase()){ case "add": studentService.add(student); ...
5
@Override public ResultSet query(String query) throws MalformedURLException, InstantiationException, IllegalAccessException { //Connection connection = null; Statement statement = null; ResultSet result = null; try { //connection = getConnection(); ...
2
public Object nextValue() throws JSONException { char c = this.nextClean(); String string; switch (c) { case '"': case '\'': return this.nextString(c); case '{': this.back(); return new JSONObject(this); ...
7
private void recieveMessage(){ try { BufferedReader in = null; //PrintWriter out = null; //out = new PrintWriter(clientSocket.getOutputStream(), true); in = new BufferedReader(new InputStreamReader( clientSocket.getInputStream())); String line = in.readLine(); logger.logMessage(line);...
3
public void setValue(String value) { this.value = value; }
0