text
stringlengths
14
410k
label
int32
0
9
public static void main(String[] args) throws Throwable{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); boolean[] p=new boolean[1120];primos=new int[187]; p[0]=p[1]=true;int c=0;mem=new int[1121][187][15]; for(int [][]m:mem)for(int []r:m)Arrays.fill(r,-1); for(int i=0;i<p.length;i++)...
8
@Test(expected=TestException.class) public void testInvokeZeroArgMethod_exception() { ReflectUtils.invokeZeroArgMethod(new Bean(), "exceptionalMethod"); }
0
public boolean run() { tokenList = new ArrayList<Token>(); char[] input=fileContent.toCharArray(); int st=0,end; while(st<input.length) { int mark=st+1; if(__isBlock(input[st])) while(mark<input.length&&__isBlock(input[mark])) ++mark; else while(mark<input.length&&!__isBlock(input[mark])) ++...
9
private static void convert() { // create DBManagers for input and output inputDBM = new DBManager(inputdbPath); outputDBM = new DBManager(outputdbPath); // get regests from database List<classtypes.Regest> regestListOld = inputDBM.getResultList( "SELECT r FROM Regest r", classtypes.Regest.class); // ...
8
@EventHandler public void onInventoryClick(InventoryClickEvent e) { if (!(e.getWhoClicked() instanceof Player)) return; Player p = (Player) e.getWhoClicked(); int packs = 0; for (ItemStack i : e.getWhoClicked().getInventory().getContents()) { if (i == null || !i.hasItemMeta()) continu...
7
@Override public int hashCode() { int hash = 3; hash = 97 * hash + this.x; hash = 97 * hash + this.y; return hash; }
0
@Override public void simpleUpdate(float tpf) { }
0
public void loadResources(InputStream is) throws SlickException { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = null; try { docBuilder = docBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new SlickExce...
3
public static boolean deleteDirectory(File directory) { if (directory.exists()) { File[] files = directory.listFiles(); for (int i = 0; i < files.length; i++) { if (files[i].isDirectory()) { deleteDirectory(files[i]); } else { files[i].delete(); } } } return (directory.delete()); }
3
@Override public void run() { try { for (;;) { byte b = in.readByte(); switch (b) { case 'J': String playerName = in.readUTF(); viewListener.join(ViewProxy.this, playerName); break; case 'H': int playerNum = in.readInt(); int leftHand = in.readInt(); int ...
8
public int findNextLeafMaxVersion() { if (pos < 0) { throw new RuntimeException("findNext called after exploration is finished"); } int node = indices[pos]; if (ddmanager.isleaf(node)) { throw new RuntimeException("findNext went too far"); } int curValue = values[pos]; MDDVariable var = ddmanage...
8
public Spolka getActiveCompany(){ for(Spolka s : this.getSpolki()) { System.out.println("active Company1" + " s.getSymbol(): " + s.getSymbol() + " this.getActiveCompanySymbol() " + this.getActiveCompanySymbol()); if(s.getSymbol().equals(this.getActiveCompanySymbol())) { ...
2
@Override public ArrayList<Delta> apply(Color c, int x, int y, Color[][] colorArr) { int count = 0; int r = 0; int g = 0; int b = 0; for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (x+i >= 0 && x+i < colorArr.len...
7
public void setOption(DHCPOption opt) { if (opt != null) { if (opt.getValueFast() == null) { this.removeOption(opt.getCode()); } else { this.options.put(opt.getCode(), opt); } } }
2
public static void editMedia(Media m){ try { if(conn == null || conn.isClosed()){ conn = DatabaseConnection.getConnection(); } } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ conn.setAutoCommit(false); PreparedStatement stmnt = co...
4
private void searchForAssocs(ClassSubInstance c, ModelSubInstance m) throws RestrictionException{ Iterator<Map.Entry<Integer, AssociationSubInstance>> it = m.assocs.entrySet().iterator(); boolean found_source = false; boolean found_target = false; while(it.hasNext()) { AssociationSubInstance a = it.next().ge...
7
public final void method43(AbstractToolkit var_ha, int i) { if (i != -14218) aClass30_10082 = null; anInt10068++; Object object = null; r var_r; if (aR10094 == null && aBoolean10064) { Class2 class2 = method2481(true, 262144, -4, var_ha); var_r = class2 == null ? null : ((Class2) class2).aR118; } e...
5
private List<Map<String, String>> getResults(int timeout) throws MikrotikApiException { try { synchronized (this) { // don't wait if we already have a result. int waitTime = timeout; while (!complete && (waitTime > 0)) { long st...
6
private void testAdd() { boolean answer = true; thePuzzle.addPosition(0, 0, 1); if (thePuzzle.getValueAtPosition(0, 0) != 1) { System.out.println("Adding tests failed"); answer = false; } thePuzzle.addPosition(0, 0, 0); if (thePuzzle.getValueAtPosition(0, 0) != 1) { System.out.println("...
9
@Override public void actionPerformed(ActionEvent e) { if (e.getSource() == timer) { if (comboState) { comboState = false; curCombo = 0; if (playerID == Player.PLAYER1) { fish.setMessage("PLAYER1"); ...
8
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; tache other = (tache) obj; if (id != other.id) return false; if (priorite == null) { if (other.priorite != null) return false; } else if (!priori...
7
private Tile unmarshalTile(TileSet set, Node t, String baseDir) throws Exception { Tile tile = null; NodeList children = t.getChildNodes(); boolean isAnimated = false; for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if ...
7
public void uninitializeServices() throws Exception { for (int i = this._list.size() - 1; i >= 0; i--) { Object o = this._list.get(i); if (o instanceof IService) { ((IService) o).uninitializeService(); } } }
2
public void swapButton(Bloque bloque1, Bloque bloque2) { int auxX, auxY; boardGrid[bloque1.y][bloque1.x] = bloque2; boardGrid[bloque2.y][bloque2.x] = bloque1; auxX = bloque1.x; auxY = bloque1.y; bloque1.setCoords(bloque2.x, bloque2.y); bloque2.setCoords(auxX, auxY); BlockButton button1 = bloque1.getB...
9
@Override public void mouseMoved(MouseEvent event) { try { Game game = Game.getInstance(); RealPlayer realPlayer = (RealPlayer)game.getPlayerManager().getRealPlayer(); if (realPlayer.isBuildingTower()) { boolean acceptBuildTower = false; int numArea = game.getMapManager().getNumAreaAtPositi...
8
public void onDisable() { sendtoserver(" v" + getDescription().getVersion() + " by:" + getDescription().getAuthors() + " ѽ!"); }
0
@Override protected void onSubmitAction(ActionRequest request, ActionResponse response, Object command, BindException errors) throws Exception { final String targetParentPath = StringUtils.defaultIfEmpty(request.getParameter("folderPath"), null); final String targetEntryPath = StringUtils.defaultIfE...
6
@Override public Complex getPixel(Complex pixel) { /* LEFT */ if(parser[0].foundZ()) { parser[0].setZvalue(pixel); } /* RIGHT */ if(parser[1].foundZ()) { parser[1].setZvalue(pixel); } int result = expr[0].getValue().compare(e...
8
public static void draw(int scene_number) { if (SceneDivider.getTexture(scene_number) != null) { SceneDivider.getTexture(scene_number).bind(); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(0,1); GL11.glVertex2f(0,0); GL11.glTexCoord2f(1,1...
1
private void setUrlYahoo (String path) { //try (final Reader symbolList = new FilterNasdaq (new BufferedReader (new InputStreamReader (new URL (url).openStream())))) try (Reader symbolList = new FilterNasdaq (new BufferedReader (new FileReader (new File (path))))) { String symbolLine = ""; int urlLimit = 0...
5
public int length() { if (n >= 0xFFFF_FFFFL || n < 0) { return 9; } else if (n >= 0xFFFF) { return 5; } else if (n >= 0xFD) { return 3; } else { return 1; } }
4
public static Map getAssetList(String serverID, String nymID, List existingAssets) { Map basketList = new HashMap(); /* TODO: This loop will be replaced by server call which returns only those assets registered at the server */ List registeredAssets = getRegisteredAssets(serverID, nym...
8
public Double getValorNeto() { if (valorNeto==null) { return 0.00; } return valorNeto; }
1
public static void takeTest(Document doc){ TestAttempt attempt = new TestAttempt(doc, InputHandler.getString("What is your name?")); for (int i=0; i<doc.getQuestionCount(); i++){ Question question = doc.getQuestion(i); question.display(false); Object answer = question.promptForAnswer(); if ( doc.docType...
5
@Override public void setAIChoices(String[] value) { java.util.List<String> choiceList = new ArrayList<String>(); for (String v : value) { choiceList.add(v); } aiModel.setList(choiceList); if (value.length > 0) { aiChoices.setValue(value[0]); } }
2
RoomsPanel(ResultsDisplay x){ rd = x; setLayout(null); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(214, 5, 21, 21); add(tabbedPane); JButton btnQuery = new JButton("# of P"); btnQuery.setBounds(22, 52, 117, 29); add(btnQuery); btnQuery.addActionList...
7
@BeforeClass public static void initPop(){ Properties prop = new Properties(); String filename = "config.properties"; try(InputStream input = TestPopulation.class.getClassLoader().getResourceAsStream(filename);) { if (input == null){ System.out.println("File not found"); assert...
2
private static String getFileContents(String filename) throws IOException, FileNotFoundException { File file = new File(filename); StringBuilder contents = new StringBuilder(); BufferedReader input = new BufferedReader(new FileReader(file)); try { String line = ...
1
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { MenuBar = new javax.swing.JMenu(); combo_persons = new javax.swing.JComboBox(); jLabel1 = new javax.swing.JLabel(); label_prof...
0
@Override public void paintLayer(Graphics g, GameState state, InputManager input) { if(letters == null || home && state.getHomeTurn() != teamTurn || !home && state.getAwayTurn() != teamTurn || lastStage != state.getGameStage()){ lastStage = state.getGameStage(); initLetters(state); if ...
9
private static void pGetBucketVersions() throws IOException { System.out.println("basic get bucket versions"); String bucketName="chttest1"; AmazonS3 s3 = new AmazonS3Client(new PropertiesCredentials(putBucket.class.getResourceAsStream("AwsCredentials.properties"))); try { //list all verisons ...
8
@EventHandler public void onLogin(PlayerJoinEvent event) { final Player p = event.getPlayer(); if (p.hasPermission("modreq.check")) { Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable() { @Override public void run() { ...
7
public double ana(){ int i = 0; int nbarg = 0; for(Operation op : this.operation){ nbarg = nbarg + op.getArg().size(); i++; } if(i == 0)return 0.0; return ((double)nbarg/i); }
2
private void buttonSubmitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSubmitActionPerformed // flag to add item boolean added = false; try { if (filedNumber.getText().isEmpty() && filedManufacture.getText().isEmpty() && filedModel.getText...
8
public static void main(String args[]) { try { loc = System.getProperty("java.class.path"); } catch(Exception e){} try { loc = loc.substring(0, loc.lastIndexOf(".jar")); loc = loc + "/"; } catch(Exception e){} try { if(loc.endsWith("bin")) { loc = loc.substring(0, loc.last...
4
static private byte a2b(byte c){ if('0'<=c&&c<='9') return (byte)(c-'0'); return (byte)(c-'a'+10); }
2
@Override public String prepareLogMessage(int type, String msg, Throwable throwable) { StringWriter stackTrace = new StringWriter(); if (throwable != null) { throwable.printStackTrace(new PrintWriter(stackTrace)); } return (getDate() + "\t" + Logger.MSG_TYPE_STRING[type] + ": " + msg + stackTrace.toString(...
1
public static void main(String args[]){ int resp; Transito tran = new Transito(); Scanner lea = new Scanner(System.in); do{ System.out.println("1- Agregar Esquela"); System.out.println("2- Pagar Esquela"); System.out.println("3- Listar Esquela...
7
* @return Returns true if the cell is editable. */ public boolean isCellEditable(Object cell) { mxCellState state = view.getState(cell); Map<String, Object> style = (state != null) ? state.getStyle() : getCellStyle(cell); return isCellsEditable() && !isCellLocked(cell) && mxUtils.isTrue(style, mxCons...
3
private boolean isAttackPlaceRightNotHarming(int position, char[] boardElements, int dimension) { if (isPossibleToPlaceRight(position, dimension)) { if (isPossibleToPlaceOnNextLine(boardElements, position + dimension) && isBoardElementAnotherFigure(boardElements[positionRightBelo...
5
@Override public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((deviceIdentifier == null) ? 0 : deviceIdentifier.hashCode()); result = PRIME * result + ((objectIdentifier == null) ? 0 : objectIdentifier.hashCode()); result = PRIME * result ...
9
public static void renameFolder(String srcPath, String aimPath) throws UtilException { File srcFile = new File(srcPath); if (!(srcFile.exists())) throw new UtilException("原始文件夹不存在:" + srcPath); File aimFile = new File(aimPath); if (aimFile.exists()) throw new UtilException("目标文件夹已存在:" + aimPath); srcF...
2
public boolean isValid() { if (type == PropertyType.KEY) { return Keyboard.getKeyName((int) num) != null; } if (type == PropertyType.STRING) { return str != null; } if (type == PropertyType.BOOLEAN || type == PropertyType.INT || type == PropertyType.DOUBLE) { return true; } return false...
5
public void setUserId(String userId) { this.userId = userId; }
0
public void onBlockRemoval(World var1, int var2, int var3, int var4) { byte var5 = 4; int var6 = var5 + 1; if(var1.checkChunksExist(var2 - var6, var3 - var6, var4 - var6, var2 + var6, var3 + var6, var4 + var6)) { for(int var7 = -var5; var7 <= var5; ++var7) { for(int var8 = -var5; ...
6
public boolean EmptyNewGenerators(Set<Element> table) { List<Element> list = new ArrayList<Element>(table); List<Set<Item>> newGenerators = new ArrayList<Set<Item>>(); //Création des nouveaux générateurs possibles for (Element e : list) { for (int i = list.indexOf(e) + 1; i < list.size()...
6
public String getMethodrefName(int index) { MethodrefInfo minfo = (MethodrefInfo)getItem(index); if (minfo == null) return null; else { NameAndTypeInfo n = (NameAndTypeInfo)getItem(minfo.nameAndTypeIndex); if(n == null) return n...
2
@Override public String execute() throws Exception { try { Map session = ActionContext.getContext().getSession(); Campaign camp = (Campaign) session.get("campa"); CampaignDevice campdev = new CampaignDevice(camp, getPlatform()); getMyDao().getDbsession().sa...
3
public void calcular() { Calculo cal = new Calculo(this); try { tIrpf = Double.parseDouble(txtIrpf.getText()); if (chkJefeEquipo.isSelected()) { JefeEquipo = salarioBase / 10; } else { JefeEquipo = 0; } if (chk...
8
public void toggleQ2() { if (Q2Associated.equals(true)) { pulseOximetryQuicImage.updateImage("src/com/anakena/freePcaInterlock/Q2InactiveQUIC.png"); o2Panel.updateValue("X"); pulseRatePanel.updateValue("X"); plethPanel.updateValue("X"); Q2Associated = false; } else if (Q2Associated.equals(false)...
2
public static byte [] extractHeader(int offset, int headerLen, byte [] bytes) { // null in = null out ? if( bytes == null ) return null; // negative in, empty array out if( ( offset < 0 ) || ( headerLen < 0 ) ) return EMPTY_BYTE_ARRAY; // verify that reque...
5
void run(){ Scanner sc = new Scanner(System.in); while(true){ int n = sc.nextInt(); if(n==0)break; int m = sc.nextInt(); char[][] s = new char[n][8]; int[] p = new int[n]; for(int i=0;i<n;i++){ s[i]=sc.next().toCharArray(); p[i] = sc.nextInt(); } int x = 0; while(m--!=0){ char...
9
@Override public void unInvoke() { if(canBeUninvoked()) { if(affected instanceof MOB) { final MOB mob=(MOB)affected; if((buildingI!=null)&&(!aborted)) { if(messedUp) { if(activity == CraftingActivity.LEARNING) commonEmote(mob,L("<S-NAME> fail(s) to learn how to make @x1.",...
8
public void newBuffer() throws FileNotFoundException, UnsupportedEncodingException{ // 追記モード csv = new FileOutputStream("logs/" + Calender.yyyymmdd_hh() + ".csv"); // CSVデータファイル bufferedWriter = new BufferedWriter(new OutputStreamWriter(csv, "UTF-8")); }
0
@Override public void swap(List<Integer> list, int left, int right) { // checking input parameter for null if (list == null) { throw new IllegalArgumentException("swap error: disallowed value"); } int temp = list.get(left); list.set(left, list.get(right)); ...
1
private void visitObjectLiteral(Node node, Node child) { Object[] properties = (Object[])node.getProp(Node.OBJECT_IDS_PROP); int count = properties.length; // load array with property ids addNewObjectArray(count); for (int i = 0; i != count; ++i) { cfw.add(ByteCo...
8
protected final Object computeRange() { final List<Double[]> raRange = new ArrayList<Double[]>(); final double[] decRange = new double[2]; if (this.isPolesCollision()) { decRange[MIN] = SimpleSpectralAccessProtocolLibrary.MIN_VALUE_FOR_DECLINATION; decRange[MAX] = SimpleSpectralAccessProtocolLib...
6
public ResultSet sqlQuery(String sql) { Statement stat = null; try { stat = (Statement) conn.createStatement(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } ResultSet rs = null; try { rs = stat.executeQuery(sql); } catch (SQLException e) { // TODO Au...
2
public void snapToGrid(JGPoint p,int gridsnapx,int gridsnapy) { if (gridsnapx==0 && gridsnapy==0) return; int xaligned = tilex*(int) Math.floor(((p.x + tilex/2.0) / (double)tilex)); int yaligned = tiley*(int) Math.floor(((p.y + tiley/2.0) / (double)tiley)); int gridofsx = Math.abs(p.x - xaligned); int g...
4
public final static void deregisterAll( MListener ... listeners ){ try{ for( MListener listener : listeners ){ Thread.sleep( 10 ); ELIST.remove( listener ); LOGGER.debug("Deregistered message listener [{}].", listener.getName() ); } }catch( Exception e){ LOGGER.warn("Exception while de...
2
public int[] area(int n) { return new int []{x + 4 + (Game.TILESIZE + 2) * n, x + 4 + (Game.TILESIZE + 2) * n + Game.TILESIZE, y + 4, y + 4 + Game.TILESIZE}; }
0
public static void main(String[] args) { Stack stack = new Stack(); char[] name = { 'a', 'r', 'v', 'i', 'n' }; for (Character c : name) { stack.push(c); } Object top = stack.peek(); System.out.println(top); }
1
private void loadTiles(){ int[] tileColors = this.image.getRGB(0,0,width,height,null,0,width); for(int y = 0; y < height; y++){ for(int x = 0; x < width; x++){ tileCheck: for(Tile t : Tile.tiles){ if(t != null && t.getLevelColor() == tileColors[x+y*width]){ this.tiles[x+y*width]=t.getId(); b...
5
public static PtgArea getRange( Ptg p ) throws IllegalArgumentException { if( p instanceof PtgArea ) { return (PtgArea) p; } if( p instanceof PtgName ) { // get source range Ptg[] pr = null; try { pr = ((PtgName) p).getName().getCellRangePtgs(); return (PtgArea) pr[0]; } catch( E...
6
public String getChannelsAsSingleText() { String text = "None"; if (channels.size() > 1) { text = "More channels"; } else if (channels.size() == 1) { text = channels.get(0); } return text; }
2
public EmptyMenu() { stateLabels = new JCheckBoxMenuItem("Display State Labels"); stateLabels.addActionListener(this); this.add(stateLabels); layoutGraph = new JMenuItem("Layout Graph"); if (!(ArrowTool.this instanceof ArrowDisplayOnlyTool)) { layoutGraph.addActionListener(this); this.add(layoutG...
4
private void startReaderTimer() { new Thread(threadGroup, new Runnable() { @Override public void run() { try { while (true) { Message msg = readQueue.poll(4 * 3, TimeUnit.SECONDS); if (msg == null) { ...
3
public Lab6() { selectMode(); loadDriver(); try { setProperties(); createDB(); createTable(); setTools(); operation(); } catch (SQLException sqle) { printSQLException(sqle); } finally { try { if (rs != null) { rs.close(); rs = null; } } catch (SQLException sqle) { ...
8
public static HashMap<String, TreeMap<Double, String>> eParamsCalculator( String fileName) throws IOException { HashMap<String, TreeMap<Double, String>> emissionParams = new HashMap<String, TreeMap<Double, String>>(); FileReader in = new FileReader(fileName); BufferedReader br = new BufferedReader(in); Has...
9
public Expr Equ_Expr() throws ParseException { Expr e, et; Token tok; e = Rel_Expr(); label_21: while (true) { switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) { case EQUAL: case NOTEQUAL: break; default: ...
7
@EventHandler public void PlayerStrength(EntityDamageByEntityEvent event) { Entity e = event.getEntity(); Entity damager = event.getDamager(); String world = e.getWorld().getName(); boolean dodged = false; Random random = new Random(); double randomChance = plugin.getPlayerConfig().getDouble("Player.Streng...
6
public void paint(Graphics g) { super.paintComponent(g); g.drawImage(backgroundPic, 0, 0, width, depth, null); Graphics2D g2d = (Graphics2D) g; synchronized (ocean.getOceanObjects()) { if (ocean.getOceanObjects().size() > 0) { for (int i = 0; i < ocean.getOceanObjects().size(); i++){ ...
2
private void checkScrollBar(AdjustmentEvent e) { // The scroll bar listModel contains information needed to determine // whether the viewport should be repositioned or not. JScrollBar scrollBar = (JScrollBar)e.getSource(); BoundedRangeModel listModel = scrollBar.getModel(); ...
7
private String plainToHTML(String source) { String strResult = ""; String sourceText = ""; Integer srcLen = source.length(); // Cycle through each input character. if (srcLen > 0) { for (int i = 0; i < srcLen; i++) { sourceText = source.substring(i,...
7
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
public static NormalDistributedStochasticLotsizingProblem generate( int T, AbstractRealDistribution meanDistribution, double cv, long seed, double setupCost, double inventoryHoldingCost, float alpha, AbstractNormalLikeOrdersGenerator orderGenerator){ meanDistribution.reseedRandomGenerator(seed); Norm...
1
@Test(expected = UnmatchingParenthesisException.class) public void testInfixToPostfix9() throws BadNextValueException, DAIllegalArgumentException, DAIndexOutOfBoundsException, ShouldNotBeHereException, UnmatchingParenthesisException { try { infix.addLast("("); QueueInterface<String> postFix = calc.infixT...
5
public static String getTypeByPath (String path) { if (path == null) { return "text/html"; } final String ext = path.substring(path.lastIndexOf(".") + 1, path.length()).toLowerCase(); String extType = null; if (ext.equals("html")) { extType = "text/html";...
9
private static <T extends Comparable<? super T>> void insertionSort(T[] a, int low, int high) { for (int i = low + 1; i <= high; i++) { T temp = a[i]; int j = i; while (j > 0 && compare(temp, a[j - 1]) < 0) { a[j] = a[j - 1]; j--; }...
4
private playObject nextCard(playObject playData, int[][] actionCards, Random random) { int[]cardData=playData.getCardData(); int[][]shuffledActionCards=playData.getShuffledActionCards(); int currentCard=cardData[0]; boo...
5
public void setBook(String book) { this.book = book; }
0
private static int parseTime(String timeString) { String[] parts = timeString.split(":"); if (parts.length != 2) return -1; int time = 0; try { time = Integer.parseInt(parts[0].trim()) * 10000; if (time < 0 || time > 24000) return -1; } catch (Exception e) { return -1; } try ...
7
static int[] mergeArrays(int[] a, int[] b) { int[] helperArr = new int[a.length + b.length]; int helperArrIndex = 0; int aIndex = 0; int bIndex = 0; while(aIndex < a.length && bIndex < b.length){ if(a[aIndex] < b[bIndex]){ helperArr[helperArrIndex++] = a[aIndex++]; } else if(b[bIndex] < a[aIndex...
7
public void mousePressed(MouseEvent event) { if (getDrawer().getAutomaton().getEnvironmentFrame() !=null) ((AutomatonEnvironment)getDrawer().getAutomaton().getEnvironmentFrame().getEnvironment()).saveStatus(); first = getDrawer().stateAtPoint(event.getPoint()); if (first == null) return; hover = first....
2
public static String deCapitalize(String input) { String words[] = input.split(" "); if (words.length > 0) { int count = 0; for (String word : words) { if (count == 0) { words[count] = WordUtils.capitalizeFully(word); count++; } else { if (word.length() > 2) { words[count] = word....
9
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onPlayerPortal(PlayerPortalEvent event) { // if knockback is set to 0, or portal redirection is disabled, simply return if (Config.KnockBack() == 0.0 || !Config.portalRedirection()) return; Location newLoc = BorderCheckTask.c...
3
public String toString() { String parameters = ":"; parameters += getStateParametersValueKeyPair(); String stateString = ""; try { stateString = this.getClass().getTypeName() .split("\\$ModelStates\\$")[1]; } catch (Exception e) {} return stateString + parameters; }
1
@Override protected int runTest() { // TODO Auto-generated method stub byte[] packet; String testmessage = "Hello World!"; EncryptionHandler EH1 = new EncryptionHandler(); EncryptionHandler EH2 = new EncryptionHandler(); EncryptionHandler EH3 = new EncryptionHandler(); EH2.addPubKey((byte)1, EH1.ge...
4
private static String jsonp2json (String jsonp) { String json = null; String regex = "^loaded\\((.*)\\)$"; //"loaded¥((.*)¥)$"; ^loaded.(.*).$ Pattern p = Pattern.compile(regex); Matcher m = p.matcher(jsonp); if (m.find()){ json = m.group(1); } return json; }
1
private static int findminimumgreedyscorefortailvertex(int tailvertex) { // TODO Auto-generated method stub int temp = 0; for(int j = 0 ; j<graph.get(tailvertex).size();j++){ if(!(exploredarray.contains(graph.get(tailvertex).get(j)))){ temp = pathlength[tailvertex] + edgewieght[tailvertex][graph.get(tail...
3