text
stringlengths
14
410k
label
int32
0
9
public int hashCode() { return myRHS.hashCode() ^ myLHS.hashCode(); }
0
private String generateString(String symbol, int lenght){ char[] word = new char[lenght]; for(int i=0; i<lenght; i++){ word[i] = symbol.charAt(random.nextInt(symbol.length())); } return new String(word); }
1
public void createShowTimes() { int cineplexCode; String cinemaCode; int movieCode; String showTimeDate; String showTimesString; System.out.println("Create ShowTimes"); System.out.println("================"); System.out.println("CINEPLEX CODE\tCINEPLEX NAME"); System.out.println(".......................
8
public void clearBreakpoint(int lineNumber) { sourceLines.get(lineNumber).clearBreakpoint(); }
0
public void buildARFF(String filename) { try { ARFFWriter writer = new ARFFWriter(filename, "index"); String docClasses = "{"; boolean first = true; for (String className : classes) { if (first) { docClasses += className; first = false; } else { docClasses += ", " + className; ...
7
public boolean canAccess(String key) { if (permissions.containsKey(key) && permissions.get(key).equals(true)) { return true; } return false; }
2
private static String getSuppressedString(Exception e) { String str = ""; Throwable[] suppressed = e.getSuppressed(); if (suppressed.length == 0) return null; else if (suppressed.length == 1) { return suppressed[0].toString(); } else { str = suppressed[0].toString(); for (int i = 1; i < suppres...
3
@Test public void test() { //Output file File outputFile = new File("e:\\temp\\debug\\XmlVariableFileTest.xml"); if (outputFile.exists()) assertTrue(outputFile.delete()); //Create variables // V1 StringVariable v1 = new StringVariable("v1"); v1.setCaption("c1"); v1.setDescription("v1"); v1.s...
5
@Override public boolean checkGrammarTree(GrammarTree grammarTree, SyntaxAnalyser syntaxAnalyser) throws GrammarCheckException { GrammarTree tree = grammarTree.getSubNode(0); if (tree == null || tree.getSiblingAmount() < 5) { this.throwExceptionAndAddErrorMsg("step", syntaxAnalyser, null); } syntaxAnalys...
4
public static XMLReader getXMLReader(Source inputSource, SourceLocator locator) throws TransformerException { try { XMLReader reader = (inputSource instanceof SAXSource) ? ((SAXSource) inputSource).getXMLReader() : null; if (null == rea...
9
public void drawText(Graphics g){ g.setFont(font); // draw lives g.setColor(Color.WHITE); g.drawImage(CharacterManager.boyStandFront, WindowManager.width - 100, WindowManager.height - 90, this); g.drawString("x", WindowManager.width - 65, WindowManager.height - 50); g.drawString(Integer.toString(Character...
3
@Override public int hashCode() { int hash = 0; hash += (inhusa != null ? inhusa.hashCode() : 0); return hash; }
1
private static void read() { String temp = null; try { File file = new File(SavePath.getSettingsPath()); if(file.exists()) { FileReader fileReader = new FileReader(file.getAbsoluteFile()); BufferedReader bufferedReader = new BufferedReader(fileReader); temp=bufferedReader.readLine(); b...
3
public void dumpExpression(TabbedPrintWriter writer) throws java.io.IOException { if (!postfix) writer.print(getOperatorString()); writer.startOp(writer.NO_PAREN, 2); subExpressions[0].dumpExpression(writer); writer.endOp(); if (postfix) writer.print(getOperatorString()); }
2
@SuppressWarnings("unchecked") private static void loader(){ for(String name : typeNames){ try { types.add((Class<? extends Pet>) Class.forName(name)); } catch (ClassNotFoundException e) { e.printStackTrace(); } } }
3
public void visitDefExpr(final DefExpr expr) { if (expr instanceof MemExpr) { visitMemExpr((MemExpr) expr); } }
1
public PRectangle createCartesianIntersection(PRectangle src2) { PRectangle rec = new PRectangle(src2.x, src2.y, src2.width, src2.height); float xLeft = (x > rec.x) ? x : rec.x; float xRight = ((x + width) > (rec.x + rec.width)) ? (rec.x + rec.width) : (x + width); float...
6
public String getDifficultyString() { switch (difficulty){ case 0: return "Human"; case 1: return "Random"; case 2: return "Moderate"; case 3: return "Hard"; case 4: return "Extreme"; default: return "Unknown difficulty"; } }
5
public void beginTurn() { for (Unit unit : units) { unit.beginTurn(); } }
1
public static Reminder findByApptAndUser(long apptId, long userId) throws SQLException { PreparedStatement statement = connect.prepareStatement( "select * from Reminder where appointmentId = ? and userId = ?"); statement.setLong(1, apptId); statement.setLong(2, userId); statement.executeQuery(); ResultSe...
1
public boolean hasCycle(ListNode head) { ListNode slow = head; ListNode fast = head; while( slow != null &&fast!= null && fast.next!= null){ slow = slow.next; fast = fast.next.next; if(slow == fast) return true; } return false; ...
4
@Override public void doAlgorithm() { GraphModel g = graphData.getGraph(); boolean cont = true; int fillin = 0; while(cont) { Vertex v1 = requestVertex(g, "select a vertex"); Vector<Vertex> InV = new Vector<>(); Vector<Vertex> OutV = new Vector<>()...
8
@SuppressWarnings("unchecked") @Override public <T> TypeAdapter<T> create (Gson gson, TypeToken<T> type) { if (!type.getRawType().isEnum()) return null; final Map<String, T> map = Maps.newHashMap(); for (T c : (T[]) type.getRawType().getEnumConstants()) { map.put(...
5
public LearningEvaluation evalModel (InstanceStream trainStream, InstanceStream testStream, AbstractClassifier model) { ClassificationPerformanceEvaluator evaluator = new BasicClassificationPerformanceEvaluator(); evaluator.reset(); long instancesProcessed = 0; System.out.println("Evalua...
7
public IndexResolution resolveIndex(final int index, final boolean fallLeftOnBoundaries) { checkIndex(index, "Index"); if (fallLeftOnBoundaries && index==0) { /* If falling to left at index 0, then we miss the first component completely. This is * not useful in practice! ...
9
private static boolean readFully(InputStream in, byte[] buf) throws IOException { int len = buf.length; int pos = 0; while (pos < len) { int read = in.read(buf, pos, len - pos); if (read == -1) { return true; } pos += read; } return false; }
2
private void doAction(final Pair<String> action) { switch(action.one) { case "add_user": final String[] temp = action.two.split(" "); if( temp.length == 2 ) { if( addUser(temp[0], temp[1]) ) { writeToScreen("ADDUSER: Added user '" + temp[0] + "' with password '" + temp[1] + "'."); } else ...
9
public boolean setWindow(GameWindow window) { boolean test = false; if (test || m_test) { System.out.println("Game :: setWindow() BEGIN"); } m_gameWindow = window; if (test || m_test) { System.out.println("Game :: setWindow() END"); } ...
4
public static void main(String[] args) { System.out.println(getPinyin("你你好吗")); }
0
public static String getDisplayString(Object obj) { if (obj == null) { return EMPTY_STRING; } return nullSafeToString(obj); }
1
private boolean setFrameworkFieldsAndValidate(Framework f) { if (f == null) { f = new Framework(); } String name = txtName.getText(); String currentVersion = txtCurrentVersion.getText(); String homePage = txtHomePage.getText(); String creator = txtCreator.getText(); String lastReleaseDate = txtReleaseD...
9
public int getTextHeight(boolean shadowed) { int height = 10; if (name.equalsIgnoreCase("p11_full")) { height = 11; } if (name.equalsIgnoreCase("p12_full")) { height = 14; } if (name.equalsIgnoreCase("b12_full")) { height = 14; } if (name.equalsIgnoreCase("q8_full")) { height = 16; } ret...
4
public void test_16_indels() { String vcfFile = "tests/1kg.indels.vcf"; VcfFileIterator vcf = new VcfFileIterator(vcfFile); for (VcfEntry ve : vcf) { StringBuilder seqChangeResult = new StringBuilder(); for (Variant sc : ve.variants()) { if (seqChangeResult.length() > 0) seqChangeResult.append(","); ...
3
public int[] Sort(int data[], int n){ // pre: 0 <= n <= data.length // post: values in data[0..n-1] in ascending order int numSorted = 0; // number of values in order int index; // general index while (numSorted < n){ // bubble a large element to higher array index for (ind...
3
@Override @EventHandler public void handleTeamPlayerDeath(PlayerDeathEvent e) { if (inTeam( CTFPlugin.getTeamPlayer(e.getEntity()) )) { System.out.println("Played died"); //set the respawn point e.getEntity().setBedSpawnLocation(spawnLocations.get(rand.nextInt(spawnLocations.size()))); ...
4
@Override protected String createResourceString(ArrayList<StringResource> resource, String locale) { StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sb.append("\n\n"); sb.append(getAutoGeneratedText()); sb.append("\n"); sb.append("<resources>"); sb.append(...
5
private void initialize() { File f = new File("etc/map.html"); brw.setUrl(f.toURI().toString()); // brw.addProgressListener(new ProgressListener() { @Override public void completed(ProgressEvent arg0) { for(Runnable r : enqueuedMarkers) execute(r); enqueuedMarkers.clear(); synchroniz...
3
@Override public boolean importData( TransferSupport support ) { if( !canImport(support) ) return false; JTabbedPaneTransferable d = null; try { d = (JTabbedPaneTransferable)support.getTransferable().getTransferData( draggab...
8
@Override public void setWorkingDay(String workingDay) { super.setWorkingDay(workingDay); }
0
protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) { if (value != null) { if (keyWord == BPKeyWords.UNIQUE_NAME) { setValue(value); textChanged(); } else if (keyWord == BPKeyWords.NAME || keyWord == BPKeyWords.DESCRIPTION || ...
5
public ArrayList<String> CMBProjetos(String CodDepartamento) throws SQLException { ArrayList<String> Projeto = new ArrayList<>(); Connection conexao = null; PreparedStatement comando = null; ResultSet resultado = null; try { conexao = BancoDadosUtil.getConnection()...
7
public byte[] crypt(byte[] data) { int remaining = data.length; int llength = 0x5B0; int start = 0; while (remaining > 0) { byte[] myIv = BitTools.multiplyBytes(this.iv, 4, 4); if (remaining < llength) { llength = remaining; } for (int x = start; x < (start + llength); x++) { if ((x - start)...
7
public int GetNpcKiller(int NPCID) { int Killer = 0; int Count = 0; for (int i = 1; i < server.playerHandler.maxPlayers; i++) { if (Killer == 0) { Killer = i; Count = 1; } else { if (npcs[NPCID].Killing[i] > npcs[NPCID].Killing[Killer]) { Killer = i; Count = 1; } else if (npcs[NPCI...
6
@Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if(!sender.hasPermission(pluginMain.pluginManager.getPermission("thf.mute"))){ sender.sendMessage(ChatColor.DARK_RED + "You do not have permission! I am going to haunt you from " + "beyond the grave!")...
6
@Override public void mouseClick(int X, int Y) { Rectangle TopRect = new Rectangle(this.getSize().getWidth() -10, 0, 10, 10); Rectangle BottomRect = new Rectangle(this.getSize().getWidth() -10, this.getSize().getHeight() - 10, 10, 10); if(TopRect.contains(X,Y) && this.ScrollYValue > 0) ...
7
public LLParsePane(GrammarEnvironment environment, Grammar grammar, LLParseTable table) { super(environment, grammar); this.table = new LLParseTable(table) { public boolean isCellEditable(int r, int c) { return false; } }; initView(); }
0
public static void main(String[] args) { if (args.length == 0) { solveRandomPuzzle(); } else { if (args[0].equals("a")) { new IdaVSAstarComparison().run(esim1); } if (args[0].equals("b")) { new AverageRunTime(new Ma...
5
public static void main(String[] args) throws IOException, ParseException { int classNumber = 5; //Define the number of classes in this Naive Bayes. int Ngram = 1; //The default value is unigram. // The way of calculating the feature value, which can also be "TFIDF", // "BM25" String featureValue = "BM25"; ...
7
public void travel() { while(this.isLiving == true) { if(settlementList.size() > 1) { Settlement from; Settlement to; for(int i=0; i<settlementList.size() -1; i++) { from = settlementList.get(i); to = settlementList.get(i+1); if(to.getPopulation() >0) { this.move(fro...
4
public OutputStream getOutputStream() throws IOException { if (output==null) { throw new IOException("headers already sent"); } final Charset ascii = StandardCharsets.US_ASCII; final byte[] separ = ": ".getBytes(ascii); final byte[] comma = ", ".getBytes(ascii); final byte[] endl = "\n".getBytes(ascii); ...
7
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
@SuppressWarnings("unchecked") public void listen() { try { SSLContext sc = SSLContext.getInstance("TLS"); sc.init(null, null, null); SSLServerSocketFactory ssf = sc.getServerSocketFactory(); SSLServerSocket socketS = (SSLServerSocket) ssf.createServerSocket(port); bb.net.util.Socket.enableAnonConn...
6
private double[] calculateCognitiveVelocity(int particle){ double[] cognitiveVelocity = new double[position[particle].length]; for(int k = 0; k < cognitiveVelocity.length; k++){ cognitiveVelocity[k] = cognitiveConstant * (personalBest[particle][k] - position[particle][k]); } return cognitiveVelocity; ...
1
protected int insertWithReturn(String sql) { try { // createConnection(); createPreparedStatement(sql); int affectedRows = pstmt.executeUpdate(); if (affectedRows == 0) { throw new SQLException("Creating failed, no rows affected."); } try (ResultSet generatedKeys = pstmt.ge...
4
public int mergeAdjacentFace (HalfEdge hedgeAdj, Face[] discarded) { Face oppFace = hedgeAdj.oppositeFace(); int numDiscarded = 0; discarded[numDiscarded++] = oppFace; oppFace.mark = DELETED; HalfEdge hedgeOpp = hedgeAdj.getOpposite(); HalfEdge hedgeAdjPrev = hedgeAdj.prev; Ha...
6
private void findRecord(String[] data) { String option = null; String prefix = null; GregorianCalendar fromGc = null; GregorianCalendar toGc = null; long id = 0; try { option = data[1].toLowerCase(); MyArrayList<Employee> findResult = new MyArrayList<>(); switch (option) { case "id": findRes...
8
private void addDoorSprite( int centerX, int centerY, int level, ShipLayout.DoorCoordinate doorCoord, SavedGameParser.DoorState doorState ) { int offsetX = 0, offsetY = 0, w = 35, h = 35; int levelCount = 3; // Dom't scale the image, but pass negative size to define the fallback dummy image. BufferedImage bigI...
2
public static byte[] ElgamalDecrypt(String key, String base, BigInteger x, BigInteger p) throws Exception { BigInteger c = new BigInteger(key, 16); BigInteger a = new BigInteger(base, 16); //decrypt m = (c - a^x)(mod p) BigInteger m = c.subtract(a.modPow(x, p)).mod(p); return Ut...
0
public static void enemyturn() { int enemyHitChance; //enemies Hit Chance int enemyAttack; //enemies Attack Random rnd = new Random(); EnemyRat RatTurn = new EnemyRat(); if (enemyHealth > 0 && Statistics.Health > 0) { enemyHitChance = rnd.nextInt(20) + 3; if (enemyHitChance > 12) { enemyAttack =...
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Fragestellung other = (Fragestellung) obj; if (frageStellung == null) { if (other.frageStellung != null) return false; } else if (!frage...
6
public int dimensions() { for (int i = 0; i < desc.length(); i++) { if (desc.charAt(i) != Type.ARRAY_CHAR) { return i; } } throw new IllegalArgumentException(desc + " does not have an element type."); }
2
@Override public ArrayList<BoardPosition> getPossibleMoves(Board board, BoardPosition startingPosition) { //replace with enpassant - b/c pawn cannot capture when going forward ArrayList<BoardPosition> possibleMoves = new ArrayList<BoardPosition>(); PawnStraightMove forward = new PawnStraight...
8
public static void toggleCommentAndClearText(Node currentNode, JoeTree tree, OutlineLayoutManager layout) { CompoundUndoablePropertyChange undoable = new CompoundUndoablePropertyChange(tree); toggleCommentAndClearForSingleNode(currentNode, undoable); if (!undoable.isEmpty()) { undoable.setName("Toggle Comment...
1
public void initLoadNetFile() { isRun = true; urlPath = ""; savePath = ""; fileName = ""; speedKB = 0; }
0
public static void printType(Node node) { System.out.print(node.getNodeName() + " type="); int type = node.getNodeType(); switch (type) { case Node.COMMENT_NODE: System.out.println("COMMENT_NODE"); break; case Node.DOCUMENT_FRAGMENT_NODE: System.out.println("DOCUMENT_FRAGMENT_NODE"); break; c...
9
private static boolean isPrime(int n) { if (n < 10) { return n == 2 || n == 3 || n == 5 || n == 7; } int end = (int) Math.ceil(Math.sqrt(n)); for (int i = 2; i <= end; i++) if (n % i == 0) return false; return true; }
6
int readPartition(ByteSequencesReader reader) throws IOException { long start = System.currentTimeMillis(); if (valueLength != -1) { int limit = ramBufferSize.bytes / valueLength; for(int i=0;i<limit;i++) { BytesRef item = null; try { item = reader.next(); } catch (...
8
@Override public VirtualMachineStatus status(VirtualMachine virtualMachine) throws Exception { boolean vmExists = checkWhetherMachineExists(virtualMachine); if (!vmExists) { return VirtualMachineStatus.NOT_CREATED; } ProcessBuilder statusProcess = getVMProcessBuilder(virtualMachine, "status"); E...
5
private static int[] createMask(Text[] tt) { int[] mask = new int[9]; try { for (int i = 0; i < tt.length; i++) { mask[i] = Integer.parseInt(tt[i].getText()); } } catch (Exception e) { e.printStackTrace(); } return mask; }
2
public static void main(String[] args) { // cr�ation et ouverture du fichier en lecture Fichier fichierR = new Fichier(); fichierR.ouvrir(args[0], 'R'); String ligneInput = null; Map<String, Vertex<String>> vertices = new HashMap<String, Vertex<String>>(); Graph<String, Integer> graph = new AdjacencyMapGrap...
6
private void indirectSort(T[] a, int[] perm, int[] aux, int lo, int hi) { // Sort perm[lo..hi]. if (hi <= lo) return; int mid = lo + (hi - lo) / 2; indirectSort(a, perm, aux, lo, mid); // Sort left half. indirectSort(a, perm, aux, mid + 1, hi); // Sort right half. mergeIndirect(a, perm, aux, lo, mid, h...
1
@Override public void Undo() { Rectangle obr = getObjectRectangle(); for (LevelItem obj : objs) { Rectangle r = obj.getRect(); r.x -= XDelta; r.y -= YDelta; r.width -= XSDelta; r.height -= YSDelta; obj.setRect(r); ...
4
public void setPoints(Vecteur<Integer>[] value) { etat = value; }
0
public void restart() { for(Tile t : gameBoard) { t.updateState(TileState.BLANK); } player = 1; gameWon = false; }
1
public static void main(String[] artgs) { long startTime = System.nanoTime(); //the first and last digits must be 2, 3, 5, 7 // System.out.print("Primes under 10: "); // for (int i = 2; i < 10; i++) { // if (p7primefinder.isPrime(i)) { // System.out.print(i + ", "...
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 feel. * For details see http://down...
6
private void button8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button8MouseClicked if(numberofpins < 4) { if(numberofpins == 0) { Login_form.setString1("7"); } if(numberofpins == 1) { Login_form.setString2("7"); } if(numberofpins == 2) { Login_...
5
public ArrayList<Trade> newRound(int round, ArrayList<EconomicIndicator> indicators, ArrayList<Stock> stocks) { HashMap<String, Stock> stockMap = mapPrices(stocks); ArrayList<Trade> allTrades = new ArrayList<Trade>(); for (Player player : players){ ArrayList<Trade> trades = player.placeTrade(round, ...
6
@Override public void deserialize(Buffer buf) { reportedId = buf.readUInt(); if (reportedId < 0 || reportedId > 4294967295L) throw new RuntimeException("Forbidden value on reportedId = " + reportedId + ", it doesn't respect the following condition : reportedId < 0 || reportedId > 4294967...
3
/* */ @EventHandler /* */ public void onPlayerInteractEntity(PlayerInteractEntityEvent event) /* */ { /* 225 */ if (Main.getAPI().isSpectating(event.getPlayer())) /* */ { /* 227 */ if (Main.getAPI().isReadyForNextScroll(event.getPlayer())) /* */ { /* 229 */ if (Main...
4
public boolean start() { if (socketExchanger == null) { log.error("A socket-exchanger is required."); } if (serverSocket == null && !openSocketServer()) { return false; } int initWorkers = socketExchanger.minWorkers; if (initWorkers < 1) initWorkers = 1; boolean initError = false; try { for (i...
8
public static void removeStateChange(int objectType, int objectX, int objectY, int objectHeight) { for (int index = 0; index < stateChanges.size(); index++) { StateObject so = stateChanges.get(index); if(so == null) continue; if((so.getX() == objectX && so.getY() == objectY && so.getHeight() == object...
7
@Override public void keyReleased(KeyEvent e) { // if we're waiting for an "any key" typed then we don't // want to do anything with just a "released" if (waitingForKeyPress) { return; } if (e.getKeyCode() == KeyEvent.VK_L...
6
public void logMessage(int level, String message) { if (this.level <= level) { writeMessage(message); } if (nextLogger != null) { nextLogger.logMessage(level, message); } }
2
@Points(value = 5) @Test public void dutchTwoHundredFrameBallAndScoreTest() { int[] pinsKnockedDownArray = new int[] { 1, 9, 10, 2, 8, 10, 3, 7, 10, 4, 6, 10, 5, 5, 10, 6, 4 }; for (int frameNumber = 1; frameNumber <= 9; frameNumber++) { assertEquals(frameNumber, singlePlayerBowlingScoreboard_STUDENT.getCu...
4
public CubeColor[][] getColorMapByFace(Face face) { CubeColor[][] colorMap = new CubeColor[getCubeComplexity()][]; for (int i=0; i<getCubeComplexity(); i++) { colorMap[i] = new CubeColor[getCubeComplexity()]; for (int j=0; j<getCubeComplexity(); j++) { CubeColor c...
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 feel. * For details see http://down...
6
private void plotOverlay( Graphics2D g ) { // If overlay drawing fails, just ignore it try { File overlayImg = graphDef.getOverlay(); if ( overlayImg != null ) { BufferedImage img = ImageIO.read(overlayImg); int w = img.getWidth(); int h = img.getHeight(); int rgbWhite = ...
5
public void showAutoComplete(InterfaceController controller, ConstructEditor editor, IAutoCompleteListener listener, EInterfaceAction binding) { if(mAutoCompleteDialog != null && mAutoCompleteEditor != editor) { hideAutoComplete(true); } // Figure out top left position of dialog Component editorComp...
4
private JLabel getJLabel1() { if (jLabel1 == null) { jLabel1 = new JLabel(); jLabel1.setText("SQL:"); } return jLabel1; }
1
private String getExceptParams(ArrayList<String> alExcept) { String resultado = ""; for (Map.Entry<String, String> entry : this.parameters.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (!value.equalsIgnoreCase("")) { St...
5
private double calcWeightsLL(int a, int b) { double sum=0; int ri=trainSet.getRi(a); int rii=trainSet.getRi(b); for (int j = 0; j < trainSet.getRi(b); j++) { for (int k = 0; k < trainSet.getRi(a); k++) { for (int c = 0; c < trainSet.getS(); c++) { int Nijkc = 0; int NJikc = 0; ...
9
@Test public void testDisconnectDueToMin() throws Exception { final Properties config = new Properties(); final int min_uptime = 20; final int max_uptime = 2000; config.setProperty("min_uptime", "" + min_uptime); config.setProperty("max_uptime", "" + max_uptime); f...
1
public static int getLogLevel() { for (Map.Entry<Integer, Integer> entry : logLevelEquivalents.entrySet()) { if (entry.getValue().equals(org.apache.log4j.Logger.getRootLogger().getLevel().toInt())) { return entry.getKey(); } } return 0; }
2
private void mouseAction(int idx) { /* Spurious entry into cell (Random mouse movement) */ if (m_dragFlag == false || State.gameOverFlag) { return; } boolean adjacent = checkAdjacentCell(idx); if (m_Button[idx].isSelected() == false) { if (adjacent || m_...
8
public Object getChild(Object parent, int index) { if (parent instanceof Page) { Page p = (Page) parent; if (index >= p.subPages.size()) { int j = index - p.subPages.size(); return p.names.get(j); } else { return p.subPages.get(...
2
public void visitMultiANewArrayInsn(final String desc, final int dims) { mv.visitMultiANewArrayInsn(desc, dims); if (constructor) { for (int i = 0; i < dims; i++) { popValue(); } pushValue(OTHER); } }
2
protected void write(final byte[] message) throws SyslogRuntimeException { if (this.socket == null) { createDatagramSocket(false); } final InetAddress hostAddress = getHostAddress(); final DatagramPacket packet = new DatagramPacket( message, message.length, hostAddress, this.syslogConfig.ge...
5
public void removeProduction(Production production) { myProductions.remove(production); GrammarChecker gc = new GrammarChecker(); /** * Remove any variables that existed only in the production being * removed. */ String[] variablesInProduction = production.getVariables(); for (int k = 0; k < variable...
4
private void cleaningText() { int latinCount = 0, nonLatinCount = 0; for(int i = 0; i < text.length(); ++i) { char c = text.charAt(i); if (c <= 'z' && c >= 'A') { ++latinCount; } else if (c >= '\u0300' && UnicodeBlock.of(c) != UnicodeBlock.LATIN_EXTEND...
9