text
stringlengths
14
410k
label
int32
0
9
public List<CheckResultMessage> getMessageList() { return messageList; }
0
private void generateCheck() { int cc = this.cornerCount; float radius = (float)Math.min(this.getPixelHeight(), this.getFO().getPixelHeight())/2.0f; float s = radius <= 10?Settings.get(SetKeys.GUI_CMP_BORDER_SIZE, Integer.class)/2:Settings.get(SetKeys.GUI_CMP_BORDER_SIZE, Integer.class); float alpha = U...
5
public String largestNumber1(int[] nums) { String[] numbers = new String[nums.length]; for(int i = 0; i < nums.length; i++) { numbers[i] = String.valueOf(nums[i]); } Arrays.sort(numbers, new Comparator<String>() { public int compare(String o1, String o2) { String s1 = o2 + o1; String s2 = o1 + o2;...
6
protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String, Object> args) { try { return ctor.newInstance(args); } catch (Throwable ex) { Logger.getLogger(ConfigurationSerialization.class.getName()).log( ...
3
public int[][] getHandicap() { for (int i = 0; i < 20; i++) { for (int j = 0; j < 10; j++) { gameWorld[i][j] = 0; } } if (toggleHandicap) { switch (handicap) { case EASY: for (int i = 21; i > 19; i--) { ...
9
private int placeFinder(int ID, ArrayList<MatchObject> count) { int size = (count.size()-1); if (size == 0) { return 0; } else { try { for (int c = 0; c <= size; c++) { if ((count.get(...
4
@Override public void keyTyped(KeyEvent arg0) { switch (arg0.getKeyChar()) { case 'n': // next pressed System.out.println("Playing next move"); this.playNextMove(); break; case '+': System.out.println("Zooming in"); this.zoomIn(); this.refreshDisplay();; break; case '-': System.out.p...
7
static public void main(String args[]) { Ellipsoid earth = new Ellipsoid(6378.137, 1.0 / 298.257222101); double lata, longa, latb, longb, ds; Double d; if (args.length < 4) { System.err .println("Usage: java TestEllipsoid longa lata longb latb [ds]"); System.exit(1); } d = new Double(args[0]);...
7
public void setGenre(String genres) { genres = genres.substring(genres.indexOf("=") + 2); StringTokenizer st = new StringTokenizer(genres, ","); this.genres = new LinkedList<Genre>(); while (st.hasMoreTokens()) { try { String genre = st.nextToken(); ...
8
private int traverse(int[][] grid, int row, int col, int totalCol) { int loc = row * totalCol + col; Integer cachedSum = cache.get(loc); if (cachedSum != null) { return cachedSum; } else { int cell = grid[row][col]; if (row == grid.length - 1 && col ...
9
public String dostepnyFilm(){ Film filmDostepny = osobaWypFilm.getRowData(); ow.dostepnyFilm(pokazOsobe, filmDostepny); return null; }
0
@Override public void keyPressed(KeyEvent key) { if (key.getKeyCode() == KeyEvent.VK_ENTER) save(); }
1
public void MapSetup(int width, int height) { //Scale integrity if (width<minsize) {width=minsize;}if (width>maxsize) {width=maxsize;} if (height<minsize) {height=minsize;}if (height>maxsize) {height=maxsize;} this.width=width; this.height=height; map = new terrain.Base[height][width]; //TODO: Current way...
6
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String print = Printing_Frame.getText(); String color = Color_Frame.getText(); String black = Black_Frame.getText(); String disc = ...
8
@Test public void testConstructNimMatrix_7Sticks() { int numberOfSticks = 7; int matrixSize = numberOfSticks + 1; NimVertex[][] expectedMatrix = new NimVertex[matrixSize][matrixSize]; expectedMatrix[7][6] = new NimVertex(7,6); expectedMatrix[6][2] = new NimVertex(6,2); expectedMatrix[5][4] = new NimVert...
8
@Override public double getCost(mxCellState state) { //assumed future parameters if (state == null || state.getView() == null || state.getView().getGraph() == null) { return 1.0; } mxGraph graph = state.getView().getGraph(); Object cell = state.getCell(); Double edgeWeight = null; if(graph.g...
6
public Hand[] serveHand(int cardAmmount) { int tempCardID = 0; Card tempCard = new Card(); Hand[] hand = new Hand[1]; for (int i = cardAmmount; i < cardAmmount + 1; i++) { String suit = suits[deck[count] / 13]; String rank = ranks[deck[count] % 13]; log.debug("Card number " + deck[i] + ": " + rank + " ...
1
@Test public void insertingScoresMaintainOrder() { Random r = new Random(); for (int i = 0; i < 100; i++) high.insertScore("randomScore", r.nextInt(1000), false); int prev = Integer.MAX_VALUE; boolean isinorder = true; for (int i = 0; i < 100; i++) { ...
3
public V put(K newKey, V newValue) { if (newKey == null) return null; int index = hashFunction(newKey); if (mTable[index] != null) { // table bucket contains at least one entry already Node currentNode = mTable[index]; // check if key is already mapped while (true) { if (currentNode.mKey...
7
private long hash(String key, int M) { long h = 0; for (int j = 0; j < M; j++) h = (R * h + key.charAt(j)) % Q; return h; }
1
private void decl_var() throws StopException, SyntaxError{ token = lexer.get_token(); /* get type */ keyword type = token.key; var_type value; do { /* process comma-separated list */ var_type i = new var_type(); i.v_type = type; i.value = 0; /* init to 0 should remove this*/ token = lexer.get_token...
7
public boolean dbSchemaCreated() { boolean created = true; for (int i = 0; i < tables.length; i++) { try { PreparedStatement pSt = con .prepareStatement("SELECT count(*) FROM information_schema.system_tables WHERE table_scheme = 'public' AND table_name = ?"); pSt.setString(1, tables[i]); Result...
3
public AutomatonPane getParent() { return parent; }
0
public void run() { try { if (this.jmDNSImpl.getState() == DNSState.ANNOUNCED) { if (count++ < 3 && !info.hasData()) { long now = System.currentTimeMillis(); DNSOutgoing out = new DNSOutgoing(DNSConstants...
8
public static Stella_Object accessExplanationInfoSlotValue(ExplanationInfo self, Symbol slotname, Stella_Object value, boolean setvalueP) { if (slotname == Logic.SYM_STELLA_LABEL) { if (setvalueP) { self.label = ((StringWrapper)(value)).wrapperValue; } else { value = StringWrapper....
7
@Override public void menu(User u) throws MenuExitException{ String menuString = "Configure Notify Action:\r\n"; menuString += "(01) Configure name \r\n"; menuString += "(02) Configure prereq setting\r\n"; menuString += "(03) Configure range \r\n"; menuString += "(04) Configure success action \r\n"; men...
9
private double[][][] formErrors(final double[][][] newErrors) { int maxLayer = Integer.MIN_VALUE; for (final int[] line : myMask) { for (final int value : line) { if (value > maxLayer) { maxLayer = value; } } } ...
7
@Override public void executeMsg(final Environmental myHost, final CMMsg msg) { super.executeMsg(myHost,msg); if(affected instanceof MOB) { if((msg.amISource((MOB)affected)||msg.amISource(((MOB)affected).amFollowing())||msg.amISource(invoker)) &&(msg.sourceMinor()==CMMsg.TYP_QUIT)) { unInvoke(); ...
8
private static int partition(Comparable[] a, int lo, int hi) { // ɨָ int i = lo, j = hi + 1; // Ĭϰa[lo]ΪзԪ Comparable v = a[lo]; while (true) { // ˿ʼɨ裬ֱҵһڵԪ while (less(a[++i], v)) { if (i == hi) { break; } } // ڴҶ˿ʼɨ裬ֱҸһСڵԪ while (less(v, a[--j])) { if (j == lo) { break...
6
String getExitMessage(String groupName, String playerName) { if(groupName.equalsIgnoreCase("New")){ return null; }else if(groupName.equalsIgnoreCase("Member")){ return ChatColor.GRAY + playerName + " left!"; }else if(groupName.equalsIgnoreCase("VIP")){ return ChatColor.DARK_AQUA + playerName + ", l...
5
public boolean isFree() { int state = alGetSourcei(source, AL_SOURCE_STATE); return state != AL_PLAYING && state != AL_PAUSED; }
1
public void run() { while(true) { try { msgIN = (ChatMessage) sInput.readObject(); //on récupére le message du réseau if (msgIN.getType() == ChatMessage.MESSAGE || msgIN.getType() == ChatMessage.MP || msgIN.getType() == ChatMessage.LOGOUT){ //si on lit un message ou un MP display...
8
public void store(K key, V value) { int hash = key.hashCode(); int index = indexOf(key, hash); if (table[index] == null) { // bucket is empty -> the key does not exist -> create a new Entry Entry<K, V> newEntry = new Entry<K, V>(key, value, hash, null); ...
6
public static void main(String[] args) { final String NOMPAYS_BIDON = "Pays Bidon (sera enlevé)"; //ArrayList<String> alNomPays = new ArrayList<String>(); List<String> alNomPays = new ArrayList<String>(); // http://fr.wikipedia.org/wiki/Liste_des_pays_et_territoires_par_superficie alNomPays.add("Canada"); ...
8
@Override public Sentence_tree find_common_node(Sentence_tree keyword_tree){ Sentence_tree temp1 = this; LinkedList<Sentence_tree> tree_list1 = new LinkedList<Sentence_tree>(); Sentence_tree temp2 = keyword_tree; LinkedList<Sentence_tree> tree_list2 = new LinkedList<Sentence_tree>(); while(temp1 != null){ ...
5
private void btExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btExcluirActionPerformed int linhaSelecionada = -1; linhaSelecionada = tabela.getSelectedRow(); if(linhaSelecionada >= 0){ int i = -1; i = (JOptionPane.showConfirmDialog(null, "Tem ce...
3
private void exibirListaBlocos() { System.out.println("LISTA DE BLOCOS"); for (int i = 0; i < listaDeBlocos.size(); i++) { System.out.println(listaDeBlocos.get(i)); } for (int j = 0; j < listaVariveisRegistro.size(); j++) { System.out.println(listaVariveisRegistro...
6
public Capitulo buscarCapitulo(int numCapitulo){ Capitulo solucion = null; for (Capitulo capi : capitulos) if (capi.obtenerNumeroCapitulo() == numCapitulo) solucion = capi; return solucion; }
2
public void ARPStorm(byte[] targetIP) { //Generates a storm of poison ARPs boolean kill = true; //A kill control variable while(kill == true) { //While kill is true ARPPacket p = this.ARPGen(targetIP); //Generate a new ARP packet targeted at the targetIP parameter inject.inject(p); //Injects the poison ...
1
public void validateChangePasswordView(ChangePasswordBean changePasswordBean, ValidationContext context) { MessageContext messageContext = context.getMessageContext(); String oldPassword = changePasswordBean.getOldPassword(); String newPassword = changePasswordBean.getNewPassword(); String confirmNewPassw...
8
public static Color getColorParameter(String key) throws CorruptConfigurationEntryException { key = key.toLowerCase(); if(!parameters.containsKey(key)) { throw new CorruptConfigurationEntryException("Missing entry in the configuration file: An entry for the key '" + key + "' is missing."); } String col...
2
public void pushHand() { Platform.runLater(new Runnable() { @Override public void run() { switch (state) { case SUPER_FREE: break; case FREE: break; case ON_SUN: ...
9
public void formatCombo_actionPerformed(ActionEvent e) { int selectedIndex = formatCombo.getSelectedIndex(); switch (selectedIndex) { case HackController.DECIMAL_FORMAT: if (!decMenuItem.isSelected()) decMenuItem.setSelected(true); break; ...
6
public static void main(String[] args) { try { reading(); } catch (JAXBException e) { e.printStackTrace(); } catch (FileNotFoundException e) { e.printStackTrace(); } }
2
protected void gameOver() { for (KeyListener listener : getKeyListeners()) removeKeyListener(listener); for (MouseListener listener : getMouseListeners()) removeMouseListener(listener); new GameOverMouseListener(this); JLabel label = new JLabel("<html>You finished in # minutes!<br>Do you want to try ano...
4
public int minPathSum(int[][] grid) { int m = grid.length; int n = grid[0].length; int[][] sum = new int[m][n]; sum[0][0]=grid[0][0]; for (int i=1;i<m ;i++) { sum[i][0] =sum[i-1][0]+grid[i][0]; } for (int i=0;i<n ;i++ ) { sum[0][i] = sum[0]...
4
public void checkCollisions(int nextX, int nextY, RPG rpg, boolean setDir) { if(setDir) { //set the direction based on x and y change (x takes precedence) if(nextX - this.boundingBox.x > 0) { dir = "right"; } else if(nextX - this.boundingBox.x < 0)...
9
public void addValidColor(char c){ if(validColors.contains(c)) return; //don't want to add it again for(Clique clique : cliques) for(Cell cell : clique.getCells()) if(cell.getColor() == c) return; //illegal if another Cell in a related Clique already has it assigned //can just add it if the list is empt...
7
@Override public int compareTo(Chromosome o) { int w = this.getFitness().compareTo(o.getFitness()); return w; }
0
public void addEdges(Edge[] edges) { for (Edge edge : edges) { addEdge(edge); } }
1
public void tick() { //map.tick(); gui.tick(); paths.tick(); for(int i = 0; i < unitList.size(); i++) { unitList.get(i).tick(); } render(); }
1
@Override public void setY(double y){ for (KentallaOlija osa : osat){ osa.setY(y); } }
1
public void makeOpAssign(int operatorIndex) { setOperatorIndex(operatorIndex); if (subExpressions[1] instanceof NopOperator) subExpressions[1].type = Type.tUnknown; opAssign = true; }
1
public void printNodes() { for (Node n : nodeMap.values()) { System.out.println(n); } }
1
public void addButton(List<officeNode> _Office){ List<officeNode> offices = _Office; //количество блоков p=offices.size()/5; FirstPagePanel = new JPanel[p+1]; for(int i =0 ; i <= p;i++){ FirstPagePanel[i] = new JPanel(); FirstPagePanel[i].setLayout(new GridLayout(5, 1)); } int...
3
@SuppressWarnings("deprecation") @EventHandler public void onTeamChatEvent(AsyncPlayerChatEvent event){ if(functions.isPlayerInTC(event.getPlayer())){ if(!(teamchat.isEmpty())){ if(!(event.getMessage().startsWith(lang.TeamChatSpecialChar()))){ for(Player p : Bukkit.getServer().getOnlinePlayers()){ ...
5
public int getEndStop() { return this._endStop; }
0
private Bullet getFreeBullet() { for (int i=0; i<MAX_BULLETS; i++) { if (!bullets[i].getVisibility()) { return bullets[i]; } } return null; }
2
protected OggStreamPacket createNext(OggPacket packet) { if (type == OggStreamIdentifier.OGG_VORBIS) { return VorbisPacketFactory.create(packet); } else if (type == OggStreamIdentifier.SPEEX_AUDIO) { return SpeexPacketFactory.create(packet); } else if (type == OggStreamId...
4
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { MOB target=mob; if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB)) target=(MOB)givenTarget; if(target.fetchEffect(this.ID())!=null) { mob.tell(target,null,null,L("<S-NAME> alread...
8
private void randomizeBackground(Background background) { int j = 256; for(int k = 0; k < anIntArray1190.length; k++) anIntArray1190[k] = 0; for(int l = 0; l < 5000; l++) { int i1 = (int)(Math.random() * 128D * (double)j); anIntArray1190[i1] = (int)(Math.random() * 256D); } for(int j1 = 0; j1 < ...
9
private Boolean setSwitch() { /** * 如果是判断节点,则根据条件设置Switch的值 */ // 测试版本 if ( this.NodeStyle == IFNODE || this.NodeStyle == WHILENODE ) { if ( this.getCommandStyle( this.NodeData ) == this.SSH_COMMAND ) { String conditionCommand = this.NodeData + " &>/dev/null;echo $?"; Str...
7
private void drawPauseMenu() { GL11.glPushMatrix(); float bar = pauseTimer / 125.0f + 0.1f; GL11.glTranslatef(Game.SCREEN_WIDTH / 2.0f * bar, Game.SCREEN_HEIGHT / 2.0f * bar, 0.0f); GL11.glScaled((125.0f - pauseTimer) / 125.0f + 0.01f, (125.0f - pauseTimer) / 125.0f + 0.01f, 1.0f); boxTexture.draw(310.0f, 100...
5
private String findRoomXMPPName(String room_name) { for ( Room room : super.getRooms() ) { //TODO I don't think it can find rooms unless its the correct case, so //no reason to convert to lowercase here if ( room.getTrueName().equals(room_name) || room.getXMPPName().equals(room_name) ) { return roo...
7
@Override public ReservationReplyMessage reservationRequest(int clientID, int theaterID, int seatReservation) throws RemoteException { if(seatReservation < 0) return new ReservationReplyMessage(theaterID, null, false); //Creates a communication channel between this and the DBServer CommunicationControll...
5
@Override public boolean equals(Object object) { if (object == null) { return false; } if (getClass() != object.getClass()) { return false; } Movie movie = (Movie) object; if (this.title == null || !this.title.equals(movie.getTitle())) { ...
8
public Map<String, List<TestcaseStep>> readTestcases(Map<String, Map<String, String>> testSuiteInfo ) { EnvironmentVariables ev = EnvironmentVariables.getInstance(); //TestcaseID StepID Keyword ApplicationID FieldName TestData CheckPoint Map<String, List<TestcaseStep>> testCaseInfo = new LinkedHashMap<String, Lis...
7
public static void main(String[] args) { boolean valor=false; do{ try{ System.out.print("Introduce un DNI (12345678?)=> "); String input=stdin.readLine(); valor=Dni.correct(input.toUpperCase()); }catch(NullPointerException e){ System.out.println(e+" No se ha introducido ningun caracter por...
8
public static void main(String[] args) throws Exception { // logging Layout layout = new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN); Logger.getLogger("com.k42b3.quantum").addAppender(new WriterAppender(layout, System.out)); // options Options options = new Options(); options.addOption("p", "por...
9
@Override public boolean equals(Object object) { if (!(object instanceof Project)) { return false; } Project other = (Project) object; if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) { return false; } ...
5
@Override public void updateCart(UserModel user, int productId, int quantity) throws WebshopAppException { if (isValidUser(user, "UPDATE_CART") && isPositiveQuantity(quantity, "UPDATE_CART")) { try (Connection conn = getConnection()) { deleteProductFromShoppingCart(conn, user, productId); if (q...
4
@Override public String getDescription(Hero hero) { int time = SkillConfigManager.getUseSetting(hero, this, "ReadiedTime", 1, false); String base = String.format("Place a trip mine, armed after %s seconds.", time/1000); StringBuilder description = new StringBuilder( base )...
6
public final Configuration getParentConfig() { Configuration parentConfig = null; if(this.parent != null) { if(this.parent.getParent() != null) { if(this.parent.getParent() instanceof Configuration) { parentConfig = (Configuration)this.parent.getParent(); } } } return parentConfig; }
3
private void checkPanic(Body b) { if (b.isDead()) { return; } int minDistance; // 蜈ィ繧�▲縺上j縺ォ蟇セ縺励※繝√ぉ繝�け for (Body p:bodyList) { // 閾ェ蛻�酔螢ォ縺ョ繝√ぉ繝�け縺ッ辟。諢丞袖縺ェ縺ョ縺ァ繧ケ繧ュ繝�� if (p == b) { continue; } // 逶ク謇九→縺ョ髢薙↓螢√′縺ゅl縺ー繧ケ繧ュ繝�� if (acrossBarrier(b.getX(), b.getY(), p.getX(), p.getY(), MAP_BOD...
8
@Override public void run() { currentThread = Thread.currentThread(); for (; ; ) { if (currentThread.isInterrupted()) { System.out.println("Finished transfer thread"); return; } try { Response response = commandTasks...
5
public void run() throws IOException { FileReader fr = new FileReader("src/main/resources/part1/wk1/IntegerArray.txt"); try (BufferedReader br = new BufferedReader(fr)) { String line; List<Integer> list = new ArrayList<>(); while ((line = br.readLine()) != null) ...
1
static boolean meet(char a[], char b[], char num[]) { // a *** b ** num // vaild numbers int a_int, b_int; a_int = Integer.parseInt(new String(a)); b_int = Integer.parseInt(new String(b)); // System.out.println(num); // System.out.println(new String(a) + " " + new String(b)); if (a_int * b_i...
9
@Test public void ensureCoreBudgetItemWithNoMonetaryValueThrowsException() { List<CoreBudgetItem> coreBudgetItemList = new ArrayList<CoreBudgetItem>(); coreBudgetItemList.add(new CoreBudgetItem("Test Description", null)); when(budgetFormData.getCoreBudgetItemsList()).thenReturn(coreBudgetI...
1
@SuppressWarnings("rawtypes") public static SingleColumnComparator createDateComparator(NumberName numberName, final Locale locale, boolean ascending, String defaultString) throws Exception { final String type="date"; if (ascending) { if (defaultString.equals("")) { return new Single...
5
private static boolean canExploreFurther(Board board, Player player, int depth){ boolean res = true; if(board.CheckGameComplete() || board.CheckGameDraw(player)){ res = false; } if(depth == MAX_DEPTH){ res = false; } return res; }
3
public void testTextToTerm1() { String text = "fred(B,p(A))"; Term t = Util.textToTerm(text); assertTrue("Util.textToTerm() converts \"fred(B,p(A))\" to a corresponding Term", t.hasFunctor("fred", 2) && t.arg(1).isVariable() && t.arg(1).name().equals("B") && t.arg(2).hasFunctor("p", 1) && t.arg(2).arg(1).isVa...
5
private String getJsonString(String url, String... params ) { try { //Inject parameters into URL. url = String.format(url, params); url = url.replaceAll("\\s",""); // connecting to restAPI HttpURLConnection conn = (HttpURLConnection) new URL(url).openConnection(); conn.setRequestMethod("GET"); c...
4
public void disable() { setEnabled(false); }
0
public void dump(FileOutputStream out) throws Exception { out.write(packet_tag & 0xff); out.write(packet_length & 0xff); out.write(version & 0xff); for (int i : key_id) out.write(i & 0xff); out.write(PKA_id & 0xff); encr_key.dump(out); }
1
@Override public List<Bounty> getUnclaimedBounties(String issuer) throws DataStorageException { List<Bounty> bounties = new ArrayList<Bounty>(); Set<String> keys = this.config.getConfigurationSection("bounties").getKeys(false); for (String key : keys) { try { int...
5
public void ujKorKezdes(){ kez1.removeAll(); kez2.removeAll(); osztoPanel.removeAll(); osztoErtek.setText(""); jatekosErtek1.setText(""); jatekosErtek2.setText(""); szetvalasztas.setEnabled(false); revalidate(); repaint(); kor = new Kor(); kor.korKezdes(); for(Kartya kartya : kor.ge...
8
public int hgetbits(int N) { totbit += N; int val = 0; int pos = buf_byte_idx; if (pos+N < BUFSIZE) { while (N-- > 0) { val <<= 1; val |= ((buf[pos++]!=0) ? 1 : 0); } } else { while (N-- > 0) { val <<= 1; val |= ((buf[pos]!=0) ? 1 : 0); pos = (pos+1) & BU...
5
public static void main(String[] args) throws Throwable { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); for (String linea; (linea = in.readLine())!=null; ) { StringTokenizer st = new StringTokenizer(linea); int n = Integer.parseInt(st.nextT...
8
private static boolean isClickable(int column){ PachydermUnit[] boardArray = earBoard.getBoardArray(); int unitType = boardArray[column].getType(); int leftUnitType = -1; int rightUnitType = -1; if(column != 0){ leftUnitType = boardArray[column-1].getType(); } if(column != earBoard.getBoardSize()-1){ ...
7
public static void main(String[] args) { //首先创建自定义的executor MyExecutors myExecutors = new MyExecutors(5, 10, 100, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); //保存线程的执行结果 ArrayList<Future<String>> futures = new ArrayList<>(); //开启10个线程 for (int i = 0; i < 10;...
8
public boolean isSolved() { for (int i = 0; i < NUM_OF_COLUMNS; i++) { // get the color at (0, i) Color currentColor = grid[0][i]; if (!currentColor.equals(Color.BLACK)) { // start from position (1, i) for (int j = 1; j < getNumRows(); j++) { if (!grid[j][i].equals(Color.BLACK) && !grid...
7
public static Keyword aritySpecialist(ControlFrame frame, Keyword lastmove) { { Proposition proposition = frame.proposition; Stella_Object relationArg = (proposition.arguments.theArray)[0]; Stella_Object relationArgValue = Logic.argumentBoundTo(relationArg); Stella_Object arityArg = (proposition.a...
8
public static MultiAnswerQuestion getQuestionByQuestionID(int questionID) { try { String statement = new String("SELECT * FROM " + DBTable + " WHERE questionid = ?"); PreparedStatement stmt = DBConnection.con.prepareStatement(statement); stmt.setInt(1, questionID); ResultSet rs = stmt.executeQuery(); r...
1
public void load(){ try { BufferedReader br = new BufferedReader(new InputStreamReader(getClass().getClassLoader().getResourceAsStream("data/personal.txt"), "Shift_JIS")); ArrayList<String> array = new ArrayList<String>(); ArrayList<Integer> array_i = new ArrayList<Integer>(); String l...
5
private final ObjectId getRemoteHead(final Git gitSession) throws InvalidRemoteException, TransportException, GitAPIException, IOException, InterruptedException { if (!this.USE_SSH.getValue()) { final String refS = "refs/heads/" + this.BRANCH.value(); final FetchCommand fetch = gitSession .fetch() ...
3
private static boolean doubleIsInteger(double d) { if((int)d == d) { return true; } return false; }
1
private void updatePasswordButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_updatePasswordButtonActionPerformed // If fields are empty if (passwordText.getText().equals("") || confirmPasswordText.getText().equals("")) { JOptionPane.showMessageDialog(n...
7
public PostGeneral(String username){ this.username = username; timestamp = System.currentTimeMillis(); }
0
public void printIntoFile(String info, String fileName) throws IOException{ File newFile = new File(root + separator + fileName + ".txt"); if(!newFile.exists()){ newFile.createNewFile(); } String str = readFromFile(fileName).toString(); OutputStream out = null; try { out = new BufferedOutputStream(new...
4
Ex3() { System.out.println("E()"); }
0