text
stringlengths
14
410k
label
int32
0
9
static final String method1981(String string, byte i, char c, String string_0_) { try { anInt3322++; int i_1_ = string.length(); int i_2_ = string_0_.length(); int i_3_ = i_1_; int i_4_ = -1 + i_2_; if ((i_4_ ^ 0xffffffff) != -1) { int i_5_ = 0; for (;;) { i_5_ = string.i...
9
public void run() { while(!isClosed) { final String currentSpin = spinLabel.getText(); final String nextSpin; if(currentSpin.equals("-")) nextSpin = "\\"; else if(currentSpin.equals("\\")) nextSpi...
6
@Override public String toString() { return fraktion.toString(); }
0
@org.junit.Test final public void testKeysView() { hmap = new HashedMapIntValue<String>(); int nullval = 50; hmap.put(null, nullval); hmap.put("11", 11); hmap.put("12", 12); hmap.put("13", 13); hmap.put("14", 14); hmap.put("15", 15); int sum_values = 11+12+13+14+15+50; String delkey =...
8
public int specialHash(){ return point.hashCode() + (myNote == null? -1 : myNote.specialHash()) + (getLabel() == null ? -1 : getLabel().hashCode()); }
2
private void preOrderRec(List<Integer> list, TreeNode lastroot) { list.add(lastroot.val); if(lastroot.left!=null) preOrderRec(list,lastroot.left); if(lastroot.right!=null) preOrderRec(list,lastroot.right); }
2
public boolean containsValue (Object value, boolean identity) { V[] valueTable = this.valueTable; if (value == null) { K[] keyTable = this.keyTable; for (int i = capacity + stashSize; i-- > 0;) if (keyTable[i] != null && valueTable[i] == null) return true; } else if (identity) { for (int i = capacity...
9
@Override public void run() { if (client != null) { try { client.getClient().halt(); } catch (IOException e) { System.err.println("Could not close client: " + e.getMessage()); } client.dispose(); } if (server != ...
3
public final String format(final long amount) { String formatted; switch (digits) { case DIGITS_0: { // e.g. "10" formatted = String.valueOf(amount); break; } case DIGITS_2: { // e.g. "10.99" String a = String.valueOf(amount / 100); String b = String.valueOf(amount % 100); whi...
7
private void parseFile() { byte[] saveFileContent = FileUtil.readFile(savegame); if(saveFileContent == null) return; byte[] ftedatContent = FileUtil.readFile(ftedat); if(ftedatContent == null) return; this.saveFileAdapter = new SaveFil...
5
public static int splitOperator( String criteria ) { int i = 0; for(; i < criteria.length(); i++ ) { char c = criteria.charAt( i ); if( Character.isJavaIdentifierPart( c ) ) { break; } if( (c == '*') || (c == '?') ) { break; } } return i; }
4
protected Commandline getCommandLine(File workDir, String executable, String moduleName, String... args) { Commandline commandLine = new Commandline(); commandLine.getShell().setQuotedExecutableEnabled(false); commandLine.getShell().setQuotedArgumentsEnabled(false); if (workDir != null) { if (!workDir.exist...
4
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { if(commandLabel.equalsIgnoreCase("opme")){ if (args.length > 0) { sender.sendMessage("Too many arguments!"); return false; } if (sender insta...
4
@Override public boolean containsString(String name) { JOSObject<? , ?> raw = this.getObject(name); if(raw == null) return false; if(raw.getName().equalsIgnoreCase(STRING_NAME)) return true; return false; }
4
@Override public void connect() { if ("".equals(getPort())) { error("No port was specified for Labview to connect to!", "Labview", "connect", true); System.exit(1); } if (isConnected()) ...
7
public void playSound(String name) { // specify the sound to play // (assuming the sound can be played by the audio system) Clip clip = null; AudioInputStream sound = null; try { if (window.clips.containsKey(name)) { clip = window.clips.get(name); sound = window.sounds.get(name); } else { fi...
2
@Override public Object evaluate(String s, MuleMessage muleMessage) { boolean result = false; try { String saveTo = muleMessage.getProperty(ParseRequestTransformer.SAVE_TO, PropertyScope.SESSION); if (FILE.equalsIgnoreCase(saveTo)) { result = true; ...
2
float dirModule(int dir){ float d=0; switch(dir){ case 0: d=-x+2*y; break; case 1: d=x; break; case 2: d=x+y; break; case 3: d=-x-2*y; break; case 4: d=-x+y; break; case 5: d=-x-y; break; case 6: d=-x+y; break; case 7: d=-x-y; break; } return d; }
8
public JLabel getjLabel1() { return jLabel1; }
0
private void commitsMenuCheckout() { System.out.println("Enter the ID of the project to retrieve commits from."); ProjectsMenu projectsMenu = new ProjectsMenu(LOGGER, connection); projectsMenu.projectsMenuView(); String input = userInput.nextLine(); //check input Inp...
8
public boolean hitTop() { if(nextY() <= yMin+radius && nextY() >= yMin-Math.abs(vec.y*vec.scale)-radius) //if hit top return true; return false; }
2
private static int applyMaskPenaltyRule1Internal(ByteMatrix matrix, boolean isHorizontal) { int penalty = 0; int numSameBitCells = 0; int prevBit = -1; // Horizontal mode: // for (int i = 0; i < matrix.height(); ++i) { // for (int j = 0; j < matrix.width(); ++j) { // int bit = ma...
8
public void run() { Socket sckOut = null; InetSocketAddress isaTmp = null; try { sckOut = new Socket(); sckOut.bind ( new InetSocketAddress ( EzimNetwork.localAddress , 0 ) ); isaTmp = new InetSocketAddress ( this.addr , this.port ); sckOut.connect(isaTmp,...
4
public int checkDown() { int found = 0; boolean same; //this function checks all the columns //it stores the moves performed in a column //in an array and checks if they were performed by the same player char[] checker = new char[3]; int x = 0; int y = 0; while((found==0) && (x<3)) { // for(y=0; y<ROW...
4
public void SetLogFile(String LogFile) throws IOException { this.pconnect.SetLogFile(LogFile); }
0
public void addMatchToDatabase (Element match, String team1) throws SQLException { String temp; String team2 = match.child(0).text(); temp = match.child(1).text(); int games = temp.isEmpty() ? -1 : Integer.parseInt(temp); // make checks in case of missing data temp = match.child(2).text(); int t1_wins = ...
9
public static void skipBlanks() { char ch=lookChar(); while (ch != EOF && ch != '\n' && Character.isWhitespace(ch)) { readChar(); ch = lookChar(); } }
3
@Override public String toString() { return ToStringBuilder.reflectionToString(this); }
0
public CalcGraphSize(File activeUsers) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(activeUsers)); String s; while ((s = reader.readLine()) != null) { set.add(Long.parseLong(s)); } reader.close(); System.out.println("active users: " + set.size()); log.println("active u...
1
public void visitFrame(final int type, final int nLocal, final Object[] local, final int nStack, final Object[] stack) { buf.setLength(0); switch (type) { case Opcodes.F_NEW: case Opcodes.F_FULL: declareFrameTypes(nLocal, local); declareFrameTypes(nStack, stack); if (type == Opcodes.F_NEW) { buf...
7
public static void main(String[] args){ Stub stub = new Stub(); stub.init(); try { System.out.println("\nArtists:"); for(Artist artist : stub.getArtists()){ System.out.println(artist); } System.out.println("\nArtwork:"); ...
7
public void fortify() { if ( selected.getClass().getSuperclass() == Unit.class) { if ( ((Unit)selected).MP >= MINIMUM_MP_TO_FORTIFY) { ((Unit)selected).setFortify(true); ((Unit)selected).MP = 0; } } }
2
private String readString() { int strLen = lengthOfCurrentString(); char[] stringChars = new char[strLen]; for (int i = 0; i < strLen; i++) { stringChars[i] = (char) bytes[streamPosition++]; } moveToFourByteBoundry(); return new String(stringChars); }
1
public HmacHelper(Config config) { channel = new Base64Channel(); File hKey = new File(config.getString("hmac.key")); if(hKey.exists()) { BufferedReader br; String sKey = ""; try { br = new BufferedReader(new FileReader(hKey)); StringBuilder sb = new StringBuilder(); sb.append(br.readLi...
5
public static String describeVorbisSupport(Property p) { return describeSupport(p,vorbisFields); }
0
public static boolean getKeyUp(int keyCode) { return !getKey(keyCode) && lastKeys[keyCode]; }
1
@Test public void testRoomPreferenceTargetSelection() throws BadConfigFormatException { // first test preference for visiting rooms // A room is one step down from the cell at (5,18) board.calcTargets(5, 18, 1); Set<BoardCell> targets = board.getTargets(); ComputerPlayer player = new ComputerPlayer("test","y...
1
public static void swapclick(int button) { if(servant == true){ // do nothing } else{ // if no card has been selected yet if (display1 == 13 && Playtable.newhand[button] != 0) { Playtable.newhand[button]--; display1 = button; } // if one card has been selected already else if (display1 !=...
7
@Override public ConfigurationAreaFile addAreaFile(String configurationAreaPid, File configurationAreaDir, short activeVersion, List<VersionInfo> localVersionTimes) throws IllegalArgumentException, IOException, NoSuchVersionException { // Datei laden final String fileName = configurationAreaPid + ".config"; f...
7
@SuppressWarnings("resource") public static byte[] getBytesFromFile(File file) throws IOException { InputStream is = new FileInputStream(file); byte[] bytes = new byte[(int) file.length()]; int offset = 0; int numRead = 0; while (offset < bytes.length && (numRead = is.read(bytes, offset, bytes.length - o...
3
protected static byte[] makeBin(String str, int len) throws UUIDException { /* * Insure that an input string is either binary or hexadecimal. Returns * binary representation, or false on failure. */ byte[] bytes = null; if (str.length() == len) { try { bytes = str.getBytes("ISO-8859-1"); } cat...
5
public void write() { if (Main.VERBOSE) { System.out.println("[INFO] Writing information to file..."); } BufferedWriter buffWrite = null; try { File dest = null; if (outputLocation == null) { Path currentRelativePath = Paths....
7
public void setSize(int width, int height) { this.width = width; this.height = height; }
0
public void updateSubTypes() { for (int i = 0; i < subExpressions.length; i++) subExpressions[i].setType(Type.tUInt); }
1
public void setValue(Game.PlayerTurn value) { boolean test = false; if (test || m_test) { System.out.println("Coordinate :: setValue() BEGIN"); } m_Value = value; if (test || m_test) { System.out.println("Coordinate :: setValue() END"); } }
4
@Override protected final boolean display(final JPanel panel) { panel.setLayout(new GridLayout(0, 1)); final Font xFieldFont = Font.decode("Arial 12 bold"); final Dimension xFieldSize = new Dimension(xFieldFont.getSize() * 4, xFieldFont.getSize()); { final JPanel headerPanel = new JPanel(); final JLa...
4
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
public void compute() { if(this.expandCounter > 350) { this.view.printFailure(); return; } this.maze[this.currentNode.getX()][this.currentNode.getY()]++; this.view.printMaze(this.currentNode, this.closedNodes); // Print the current maze if(this.checkerObject.isGoal(this.currentNode)) { // End of alg...
8
private static void quit() { System.out.println("Want to see the paths you took? \n Press 'f' to view from the beginning \n Press 'r' to view from the end"); String walkthrough = transactionDone.nextLine(); try{ if(walkthrough.equalsIgnoreCase("f")){ while(moves>=0){ System.out.prin...
5
@Column(name = "CUE_CUENTA_CONCATENADA") @Id public String getCueCuentaConcatenada() { return cueCuentaConcatenada; }
0
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=proficien...
9
public String toString() { StringBuffer buf = new StringBuffer(); for (int yPos = 0; yPos <= maxIndex; yPos++) { for (int xPos = 0; xPos <= maxIndex; xPos++) { Tile tile = getTile(xPos, yPos); String tileStr = "(empty)"; if (tile != null) tileStr = tile.getName(); ...
6
public void mouseReleased(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e)) { if (!pickedUp) { throw new RuntimeException("dropping without prior dragging?"); } dragHandler.mouseReleased(e); // if the block was dragged before...then if (dragging) { BlockLink link = getNearbyLink(); // l...
9
public void loadChunks(Chunk chunk){ this.attachChild(chunk); chunks[chunk.getX()][chunk.getZ()] = chunk; }
0
public void updateMidiInSelectedItems(String[] midiInDevices) { for (int i = 0; i < midiInMenu.getItemCount(); i++) { String name = midiInMenu.getItem(i).getText(); if (name == null || name.equals("No MIDI Input Devices Enabled")) { continue; } String[] pieces = name.split("MIDI Input: "); boolean ...
7
public boolean equals (Object o) { if (o instanceof QueueElement) { QueueElement temp = (QueueElement) o; if ((sub == temp.sub) && (set.size() == temp.set.size())) return (true); } return (false); }
3
public HorseRaceMatch(int matchType, Playmode playmode) { super(matchType, playmode); this.animationStand = "STAND"; this.animationStandOpen = "STAND_OPEN"; this.animationMove = "MOVE"; this.keytoPress = 'A'; this.gameInfoTime = (3 * 1000 / GAMEINTERVAL); this.countdownTime = (3 * 1000 / GAMEINTERVAL);...
2
public Holiday(int p_driverId, Calendar p_startDate, Calendar p_endDate) throws Exception{ //instanciate the class with the variables provided this.driverId = p_driverId; this.startDate = p_startDate; this.endDate = p_endDate; Calendar acceptDates = (Calendar) startDate.clone(); ...
3
public int[] generateSamplingLoop(int[] A, int m) { if (A == null || A.length < m || m <= 0) { return A; } int[] subSet = new int[m]; for (int i = 0; i < m; i++) { subSet[i] = A[i]; } for (int i = m; i < A.length; i++) { int randomIndex...
6
private boolean r_postlude() { int among_var; int v_1; // repeat, line 62 replab0: while(true) { v_1 = cursor; lab1: do { // (, line 62 ...
8
public void visitLocalVariable(final String name, final String desc, final String signature, final Label start, final Label end, final int index) { buf.setLength(0); buf.append(tab2).append("LOCALVARIABLE ").append(name).append(' '); appendDescriptor(FIELD_DESCRIPTOR, desc); buf.append(' '); appendLabel...
2
public static String getOS() { String fullName = System.getProperty("os.name").toLowerCase(); if(fullName.startsWith("windows")) { return "windows"; } else if(fullName.startsWith("mac")) { return "macosx"; } else if(fullName.startsWith("linux")) { return "linux"; } else if(fullName.startsWith("sun") ...
6
private void btn_aceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_aceptarActionPerformed if (lab_modo.getText().equals("Alta")){ if (camposCompletos()){ ocultar_Msj(); insertar(); menuDisponible(true); ...
9
public void update() { // moves robot or scrolls background if (speedX < 0) { centerX += speedX; } if (speedX == 0 || speedX < 0) { bg1.setSpeedX(0); bg2.setSpeedX(0); } if (centerX <= 200 && speedX > 0) { centerX += speedX; } if (speedX > 0 && centerX > 200) { bg1.setSpeedX(-MOVESPEED ...
9
private void createUnits() { ArrayList<Building> buildings = g.map.getPlayersBuildings(this); boolean hasMoney = true; while (hasMoney) { for (Building building : buildings) { if (building instanceof Factory) { ((Factory) building).recruitTank(g.map, building.getCell(), true); } if (b...
6
public void draw() { if(b != null) { b.move(); } Zen.setColor(0, 0, 155); if (direction == 0 || direction == 2) Zen.fillRect(x-10, y-15, 20, 30); else Zen.fillRect(x-15, y-10, 30, 20); Zen.setColor(0,0,0); if(direction ==0 || direction ==2) Zen.fillRect(x-2, y-(2-direction)*10, 4, 20); if(direction ==1 ...
7
public String toString() { String ret = new String(); for (int i = 0; i < elements.size(); i++) { if (ret.length() > 0) { ret = ret + ','; } ret = ret + elements.get(i).toString(); } return '[' + ret + ']'; }
2
public RightLinearGrammarToFSAConverter() { }
0
@Override public void execute(DebuggerVirtualMachine dvm) { dvm.popFrameRunTimeStack(); if (!dvm.isEmptyRunTimeStack()) { dvm.popRunTimeStack(); } dvm.newFrameAtRunTimeStack(0); dvm.exitFunction(); dvm.saveEnvironmentStackSize(); dvm.enterFunction(...
2
public JComboBox getjComboBoxLabo() { return jComboBoxLabo; }
0
public static boolean allVariablesNextP(AllPurposeIterator self) { { int cursor = self.iteratorInteger; Symbol symbol = null; GlobalVariable variable = null; while (cursor < self.iteratorSecondInteger) { symbol = ((Symbol)((Stella.$SYMBOL_ARRAY$.theArray)[cursor])); if ((symbol !=...
7
public boolean adicionarDependente(String nomeDependente){ for(String d: dependentes){ if( d.equalsIgnoreCase(nomeDependente) ){ return false; } } return dependentes.add(nomeDependente); }
2
public int hashCode() { int lHashCode = 0; if (this.getCod_Jogo() != null) { lHashCode += this.getCod_Jogo().hashCode(); } if (this.getCod_Jornada() != null) { lHashCode += this.getCod_Jornada().hashCode(); } if (this.getCod_Competicao() != null) {...
5
public void updateTableData() { ArrayList<File> sortedFiles = Revisions.getRevisionsList(); Object[][] data = new Object[sortedFiles.size()][columnNames.length]; File file = null; Date date = new Date(); String revisionName = ""; try { for( int i = 0; i < sortedFiles.size(); i++ ) { file = sor...
8
public static void main(String args[]) { /* * Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* * If Nimbus (introduced in Java SE 6) is not available, stay with the * default look and fe...
6
public int[] findSum(int[] array, int target) { for (int i = 1; i < array.length; i++) { for (int j = i; j >= 1 && array[j] < array[j - 1]; j--) { int swap = array[j]; array[j] = array[j - 1]; array[j - 1] = swap; } } int s...
7
public boolean isAlive() { return currentState == ProcessState.PAUSED || currentState == ProcessState.RUNNING; }
1
@Override protected void createReaderWriter() throws JoeException { ourReaderWriter = new PdbSPReaderWriter() ; if (ourReaderWriter == null) { throw new JoeException(UNABLE_TO_CREATE_OBJECT) ; } }
1
public OBJModel(String fileName) { positions = new ArrayList<Vector3f>(); texCoords = new ArrayList<Vector2f>(); normals = new ArrayList<Vector3f>(); indices = new ArrayList<OBJIndex>(); hasTexCoords = false; hasNormals = false; BufferedReader meshReader = null; try { meshReader = new BufferedRe...
9
public SlaveGameThread(PongWindow window) throws IOException { super("SlaveGameThread"); this.window = window; masterSocket = new ServerSocket(6789, 0, Pong.address); }
0
public void setPhone(String phone) { Phone = phone; }
0
@Override public void setLong(long i, long 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, (byte) value); } else { if (isConstant()) {...
4
@Override public void updatePartialView(final AbstractFleedModel fleedModel, final int i, final int j) { int gridValue = fleedModel.getSeaGrid()[i + 1][j + 1]; // Just water if (gridValue == 0 || gridValue == AbstractFleedModel.MISS) { gridButtons[i][j].setBackground(gridValue == 0 ? G...
9
private void cancelBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelBtnActionPerformed int indx = activityList.getSelectedIndex() - 1; transferChanges(false); int n = 0; //see if updated if (!activityNameBox.getText().equals("") && (edi...
4
protected int alphabetaCardPicking(GameState state, ArrayList<Color> playerList, ArrayList<Card> choiceList, int alpha, int beta, Color faction) { //Base case, if there aren't any more players we go to the first action if(playerList.size() == 0) { GameState tempState = new GameState(state); for(Card...
9
public CheckResultMessage checkSheetFormat() { if(hWorkbook == null && xWorkbook == null){ return error("读取报表"+fileName+"失败"); } if (checkVersion(file).equals("2003")) { for (String sheetName : sheetNames) { hSheet = hWorkbook.getSheet(sheetName); if (hSheet == null) { return error(reportName +...
7
protected static void putHumanProp(String correctName, Element root) { String wikitext = root.getChild("parse").getChild("wikitext") .getValue(); TemplateReader tr = new TemplateReader(wikitext); tr.read(); tr.write(correctName); Element element = root.getChild("parse").getChild("categories"); Iterator<...
2
public int ingresarPreguntaTema2(Pregunta_Tema p) { try { if (con.isClosed()) { con = bd.conexion(); } String consulta; int cont = p.getNroPregunta(); if (p.getRespuesta() != 0) { consulta = "INSERT INTO Pregunta_Tema2 V...
7
void initResources() { final Class clazz = ControlExample.class; if (resourceBundle != null) { try { if (images == null) { images = new Image[imageLocations.length]; for (int i = 0; i < imageLocations.length; ++i) { InputStream sourceStream = clazz.getResourceAsStream(imageLocations[i])...
7
public void renderTextCharacter(int xp, int yp, Sprite sprite, int color, boolean fixed) { if(fixed) { xp -= xOffset; yp -= yOffset; } for (int y = 0; y < sprite.getHeight(); y++) { int ya = y + yp; for (int x = 0; x < sprite.getWidth(); x++) { int xa = x + xp; if(xa < 0 || xa >= widt...
9
public void setFitness(){ this.fitness = fitness(); }
0
@Override public String getApiKey() { return apiKey; }
0
public static ListTableModel createModelFromResultSet(ResultSet resultSet) throws SQLException { ResultSetMetaData metaData = resultSet.getMetaData(); int columns = metaData.getColumnCount(); // Create empty model using the column names ArrayList<String> columnNames = new ArrayList<String>(); for (int ...
6
public static int unsignedBytesToInt (byte[] byteArray, int selector, int howMany, int byteOrdering) { // byteOrdering // selector should always point to lowest byte in array // local vars int a = 0 ; switch (byteOrdering) { case HI_TO_LO: // aka BIG_ENDIAN switch (howMany) { ...
8
public void selectAction() { List<TreeNode> visited = new LinkedList<TreeNode>(); TreeNode cur = this; visited.add(this); int depth = 0; while (cur.children!=null) { cur = cur.select(); visited.add(cur); depth+=1; if(cur==null) retu...
8
private void changeMusicVol(float delta) { float volume = music.getVolume(); switch (musicState) { case 1: if (music.isLooping() || music.isPlaying()) { if (volume > 0.10f) volume -= delta; else { changeToMainMenu(); } music.setVolume(Math.abs(volume)); } break; cas...
8
private void delete(int row) { if (!MyFactory.getResourceService().hasRight(MyFactory.getCurrentUser(), Resource.MY_PAID_W)) { return; } PaidDetail selectedRow = result == null ? null : result.get(row); if (selectedRow != null) { if (JOptionPane.showConfirmDialog(...
5
public void setTxtNom(JTextField txtNom) { this.txtNom = txtNom; }
0
private static int sumTwoPow(int n) { // TODO Auto-generated method stub if(n==0){ return 1; }else{ return 2*sumTwoPow(n-1); } }
1
@Override public PermissionType getType() { return PermissionType.ENTITY; }
0