text
stringlengths
14
410k
label
int32
0
9
public static String simplifyText(String line) { String reformatted = line.toLowerCase().replaceAll(",", "") .replaceAll("[^A-Za-z]", " "); while (reformatted.contains(" ")) { reformatted = reformatted.replaceAll(" ", " "); } return reformatted; }
1
public void setDatetime(String datetime) { this.datetime = datetime; }
0
public static void addErrorMessages(List<String> messages) { for (String message : messages) { addErrorMessage(message); } }
1
public static Date getFirstDayOfTheMonth(Date date) { String value = date2String(date, "yyyy-MM-01 00:00:00"); return string2Date(value); }
0
public StructuredBlock[] getSubBlocks() { return (elseBlock == null) ? new StructuredBlock[] { thenBlock } : new StructuredBlock[] { thenBlock, elseBlock }; }
1
private void buildForStringFeature(TeaClassifier tc, TeaNode parent, String[] valueCombo, int level, List<Integer> usedAttributes, double sugar, String val, int index) { String[] newValueCombo = new String[2]; newValueCombo[0] = valueCombo[0]; newValueCombo[1] = valueCombo[1]; List<Integer> newUsed = new ArrayL...
9
@Override protected void onTextMessage(CharBuffer text) throws IOException { Message message = new Message(text.toString()); RoboBase robo_base = RoboBase.getInstance(); String status; switch (message.getCommand()) { case LOGIN: if (robo_base.login(message.getRobotName(), this)) { status = "ok"; ...
3
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; EquipmentType other = (EquipmentType) obj; if (compatibleEquipment == null) { ...
9
private String readURL(String descriptionAPI) { try { String urlResponse = ""; URLConnection connection = new URL(descriptionAPI).openConnection(); connection.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Ge...
2
@SuppressWarnings("serial") public SchemaEditorMenuBar(final BasicGraphEditor editor) { final mxGraphComponent graphComponent = editor.getGraphComponent(); final mxGraph graph = graphComponent.getGraph(); JMenu menu = null; JMenu submenu = null; // Creates the file menu menu = add(new JMenu(mxResources.g...
9
protected void handleGet(HttpRequest request) throws IOException { String path = request.getRelativePath(); File file = new File(wwwRoot, path); if (!file.exists()) { String data = "<html><body>Not found</body></html>"; sendResponse(HTTP_STATUS.HTTP_FILE_NOT_FOUND, MIME.H...
5
public boolean isScramble_recursive(String s1, String s2) { if (s1 == null || s2 == null) return false; if (s1.length() != s2.length()) return false; if (s1.equals(s2)) return true; int len = s1.length(); for (int i = 1; i < len; i++) { if (isS...
9
public static void main(String[] args) { if (args.length > 0) { if (args[0].equalsIgnoreCase("-nogui")) { instance = new PermWriter(false); return; } } instance = new PermWriter(true); }
2
private void processDataFrame(int channelPtr, int ctype, int flag, ByteBuffer data) { Channel channel; ByteBuffer datac; Iterator<Channel> it; int size; if (data == null || data...
5
private void crearTablero(){ Casilla c; for(int fila=0;fila<TAMANYO;fila++){ for(int columna=0;columna<TAMANYO;columna++){ if (fila %2 ==0){ if (columna %2==0){ c= new Casilla(false); casillas.add(c); panelTablero.add(c); }else{ c= new Casilla(true); casillas.add(c);// casilla ne...
5
public int checkAnswers(int week, User user, ArrayList<Integer> userAnswers) { int score = 0; PreparedStatement answerStatement = null; PreparedStatement questionStatement = null; Connection connection = null; try { try { connection = data.getConnection(); ...
6
public void guardarCompraDOM(String rutaFichero, LinkedHashMap<Integer, Compra> compras) { rutaFichero = rutaFichero + ".xml"; try { DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder...
2
double calculatescore() { total = 0; for (int i = 0; i < seedlist.size(); i++) { double score; double chance = 0.0; double totaldis = 0.0; double difdis = 0.0; for (int j = 0; j < seedlist.size(); j++) { if (j != i) { totaldis = totaldis + Math.pow( distanceseed(seedlist.g...
9
public void setComment(String comment) { this.comment = comment; }
0
@Override public void commandReceived(Object command) { Command message = (Command) command; String action = message.getCommand(); if (action.equals("clear_selection")) { selectedCard = null; } else if (action.equals("select_card")) { selectedCard = (RedCard)message.getBaggage(); } else if (action.equa...
7
public int getNeighboursNumberConnection(Node n) { int counter = 0; ArrayList<Node> n_neighbours; ArrayList<Node> t_neighbours; n_neighbours = n.getToNode(); for(Node t : n_neighbours ) { t_neighbours = t.getToNode(); for(int i=0;i<t_neighbours.size();i++) { Node current = t_neighbours...
3
private void findExactNN(Node node, ResultSet resultSet, double[] query) { // Pruning. Ignore those clusters that are too far away ----- double bsq = metric.distance(query, node.pivot); double rsq = node.radius; double wsq = resultSet.worstDistance(); double val = bsq - rsq - wsq; double val2 = val * val -...
5
public void setIndividualArgs(String[] args) { boolean startReadHypothesis = false; StringBuffer tmpGoal = new StringBuffer(); StringBuffer tmpHypothesis = new StringBuffer(); try { expressionName = args[indExpressionName]; moduleName = args[indModuleName]; modulePath = args[indModulePath]; componen...
5
public AttributeValue getValueAsObject() { try { if(this.getType().equals(StringAttribute.identifierURI.toString())) { return StringAttribute.getInstance(getValue()); } else if(this.getType().equals(IntegerAttribute.identifierURI.toString())) { return IntegerAttribute.getInstance(getValue()); } else ...
6
private static int subsequentCoins(int[][] board, int x, int y, int dx, int dy, int playerID) { int newX = x + dx; int newY = y + dy; if ((newX >= 0 && newX < board.length) && (newY >= 0 && newY < board[0].length) && board[newX][newY] == playerID) { return 1 + subsequentCoins(board, ...
5
public Block[][] SplitChanneal(byte[][] _graph, int _y, int _x) { if((_x % 8 != 0) || (_y % 8 != 0)){ System.err.println("[ERROR] Input data should begins on a multiple of 8!"); return null; } // number of blocks int _yBlock = _y/8; int _xBlock = _x/8...
4
public static Frame getTopFrame(Container c) { if (c instanceof Frame) return (Frame)c; Container theFrame = c; do { theFrame = theFrame.getParent(); } while ((theFrame != null) && !(theFrame instanceof Frame)); if (theFrame == null) ...
4
@Column(name = "PEP_MOA_CONSEC") @Id public int getPepMoaConsec() { return pepMoaConsec; }
0
private String getDescriptionFromSoundfileName(String soundfileName) { logger.logDebug("ENTERED makeDescriptionFromFilename ..."); // some self-protection if (soundfileName == null) return ""; if (soundfileName.trim().equals("")) return ""; logger.logDebug("sound filename init: " + s...
9
private void processTransaction(){ EnumAction action = mActions.get(0).action; mActions.remove(0); if (action == EnumAction.Deposit){ mPerson.addCash(mTransactionAmount); } else if (action == EnumAction.Loan){ if (mTransactionAmount == 0){ //Rejected loan //Non-normative } else{ mPerso...
6
public double standardError_of_ComplexRealParts() { boolean hold = Stat.nFactorOptionS; if (nFactorReset) { if (nFactorOptionI) { Stat.nFactorOptionS = true; } else { Stat.nFactorOptionS = false; } } double[] re = this.array_as_real_part_of_Complex(); double standardError = Stat.standardError...
2
public void tick(){ if(y + ny >= 0 && y + ny <= maxY - height){ y += ny; }else{ ny *= -1; y += ny; } if(x + nx >= 0 && x + nx <= maxX -width){ x += nx; }else{ nx *=-1; x += nx; } if(x <= 0){ x = 0; } if(x >= maxX -width){ x = maxX -width; } if(y >= maxY -height){ y = max...
8
@SuppressWarnings("deprecation") private boolean viewChestFor(Player player, String[] strings) { if (player.getTargetBlock(null, 50).getType() == Material.CHEST) { Chest chest = (Chest) player.getTargetBlock(null, 50).getState(); if (strings.length == 0) { if (methods.isSingleChest(chest) || chest instance...
8
public static void sort(int[] array, int max) { printArray(array); int n = array.length; int[] result = new int[array.length]; int[] count = new int[max + 1]; //辅助数组 count[i]存放array中小于或等于i的个数 for(int i = 0; i <= max; i++) { //辅助数组清0 count[i] = 0; } for (int i = 0; i < n; i++) { //将数值序...
4
@SuppressWarnings("deprecation") public Restriction getRestriction(ItemStack item) { int dataValue = item.getDurability(); if (shouldIgnoreDataValue(item) || item.getDurability() == 0) { dataValue = -1; } for (Restriction r : this.restrictions) { if (r.getItemID() != item.getTypeId()) continue; ...
5
public boolean viitoset(){ for(int i=0; i<5; i++){ if(nopat[i].getValue()==5){ return true; } } return false; }
2
public void testConstructor_RI_RI7() throws Throwable { DateTime dt1 = new DateTime(2005, 7, 10, 1, 1, 1, 1); DateTime dt2 = new DateTime(2004, 6, 9, 0, 0, 0, 0); try { new Interval(dt1, dt2); fail(); } catch (IllegalArgumentException ex) {} }
1
private void moveIncomingArcs( Node from, Node to ) throws MVDException { while ( !from.isIncomingEmpty() ) { Arc a = from.removeIncoming( 0 ); to.addIncoming( a ); } // check if node is now isolated if ( from.indegree()==0&&from.outdegree()==0 ) from.moveMatches( to ); }
3
public static void main(String[] args) { int BYTES_PER_LINE = 16; if (args.length == 1) { BYTES_PER_LINE = Integer.parseInt(args[0]); } int i; for (i = 0; !BinaryStdIn.isEmpty(); i++) { if (BYTES_PER_LINE == 0) { BinaryStdIn.readChar(); continue; } ...
6
private IMac getMac(char[] password) throws MalformedKeyringException { if (!properties.containsKey("salt")) { throw new MalformedKeyringException("no salt"); } byte[] salt = Util.toBytesFromString(properties.get("salt")); IMac mac = MacFactory.getInstance(properties.get("mac")); ...
6
public static void createGUI(){ gui = new GUI(); gui.setVisible(true); //check if a properties file exists and load its values if (PropertiesHandler.PropertiesFileExists()){ //read properties file Properties prop = PropertiesHandler.readPropertiesFile(); ...
2
public Key delete(int i) { if (i > heap.length - 1 || i < 1) return null; Key key = heap[i]; heap[i] = heap[N--]; if (greater(heap[i], key)) sink(i); else swim(i); return key; }
3
@Override protected void setColoredExes() { // TODO Auto-generated method stub coloredEx = ParabolaGenerator.parabola(begin, p, size); }
0
private static void createInputMonitorThread(final InputStream in,final OutputStream out) { // 消息广播线程 Runnable writeDistributeRunner = new Runnable(){ public void run(){ try{ startReceiveMessage(in); }catch(Exception e){ e.printStackTrace(); } } }; Runnable sendRunner = new Run...
2
public void onAction(String binding, boolean value, float tpf) { int relvel = this.muzzle_velocity; if (binding.equals("shoot") && !value && this.app.begin ) { Geometry bulletg = new Geometry("bullet", bullet); bulletg.setMaterial(mat2)...
9
public static String getFeature(String line) throws IOException { BufferedReader br = new BufferedReader(new FileReader( Parameters.searchQuery)); Map<String, Integer> queryVector = new HashMap<String, Integer>(); String query = ""; while ((query = br.readLine()) != null) { Matcher m = Pattern.compil...
7
public void deleteSocket(MultipleTalkServer server, String ip){ try { for (int i=0; i < server.socket.size()-1; i++){ if(ip.equals(server.socket.get(i).getName())){ server.socket.get(i).close(); server.socket.remove(i); } ...
3
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof UnaryRule)) return false; final UnaryRule unaryRule = (UnaryRule) o; if (child != null ? !child.equals(unaryRule.child) : unaryRule.child != null) return false; if (parent != null ? !parent.equals(unaryRule....
6
private boolean chevauchement(Pair<Calendar, Calendar> firstPlage, Pair<Calendar, Calendar> secondPlage) { boolean heurDebDansIntervalle= firstPlage.getFirst().before(secondPlage.getFirst()) && secondPlage.getFirst().before(firstPlage.getSecond()); boolean heureFinDansIntervalle= firstPlage.getFirst().before(seco...
5
public static void setup(Menus menu){ RiftFrame.menuControl = false; if(menu.dialog == false){ RiftFrame.menuControl = true; for(int a=0;a<menu.options[0];a++){ temp = new Sprite(ImageLibrary.voidBall, 0,0); //refreshes the variable so it does rewrite previous image textTemp = new TextPoint...
8
public void removeElement(Object obj) throws QueueClosedException { Element el, tmp_el; if(obj == null) return; synchronized(mutex) { if(closed) /*check to see if the queue is closed*/ throw new QueueClosedException(); el=head; ...
8
@Override public void execute() { try { Scanner in = new Scanner(input); while (in.hasNextLine()) { String command = in.nextLine(); Iterable<String> array = Splitter.on(';').omitEmptyStrings().split(command); Iterator itr = array.iterat...
3
public void returnOperation(final AbstractInsnNode insn, final Value value, final Value expected) throws AnalyzerException { if (!isSubTypeOf(value, expected)) { throw new AnalyzerException(insn, "Incompatible return type", expected, value); } }
1
private boolean diagonalDecrementingAttack(int[][] grid, LinkedList<Square> squareStore, boolean pickOne) { //Attack - Diagonal dec if ((grid[0][0] == 2 && grid[1][1] == 2) && grid[2][2] != 1) { BuildAndAddSquareTwoTwo(squareStore); pickOne = updateGridTwoTwo(grid); } els...
9
public void start(String[] args){ try{ if(args.length == 0){ processDirectoryTree(new File(".")); } else{ for(String arg:args){ File fileArg = new File(arg); if(fileArg.isDirectory()){ processDirectoryTree(fileArg); } else{ if(!arg.endsWith("."+ext)){ arg += "."...
5
@Override public void rodarJogo(){ if (JOptionPane.showConfirmDialog(null, "\nUsar midia física?\n","Iniciando...",JOptionPane.YES_NO_OPTION) == 0 ){ this.jogoRodando = JOptionPane.showInputDialog(null,"\nInforme qual o jogo a executar\n","Iniciando...",JOptionPane.INFORMATION_MESSAGE);...
5
protected void beAttrib(final char c) { switch(c) { case ' ': case '\t': case '\r': case '\n': bufDex++; return; case '<': piece.innerStart = bufDex; abandonTagState(State.BEFORETAG); return; case '>': changeTagState(State.START); piece.innerStart = bufDex; return; case '/': endEmptyAt...
7
public void paintIcon(Component c, Graphics g, int x, int y) { Graphics2D g2 = (Graphics2D) g.create(); g2.translate(x, y); // Draws the state. paintConfiguration(c, g2, getIconWidth(), getIconHeight()); g2.translate(-x, -y); }
0
public static void writeWaveformToFile(AudioPoint in, File out){ AudioPoint temp=in; while(temp.getNext()!=null)temp=temp.getNext(); double xscale=1.2; double yscale=0.05; int xstart=in.getX(); int imgw = 3200; imgw = (int)((temp.getX()-xstart) * xscale); System.out.print("\nExporting..."); System.out...
9
public void quoteChar(int ch) { if (ch >= 0 && ch < ctype.length) ctype[ch] = CT_QUOTE; }
2
public void executeBatch(){ LOGGER.info("executing batch"); try { LOGGER.info("executing details"); details_ps.executeBatch(); }catch(SQLException se) {printSQLError(se);} try { LOGGER.info("executing publication"); publication_ps.executeBatch(); }catch(SQLException se) {printSQLError(se);} try ...
9
public static void testValidity(Object o) throws JSONException { if (o != null) { if (o instanceof Double) { if (((Double) o).isInfinite() || ((Double) o).isNaN()) { throw new JSONException( "JSON does not allow non-finite numbers."); ...
7
private void showMatchingUpgrades(UpgradeType type){ this.upgradePanel.removeAll(); ArrayList<Upgrade> upgrades = this.game.getUpgradeManager().getUpgradesByType(type); for(Upgrade u : upgrades){ UpgradeIconPanel uip = new UpgradeIconPanel(u); uip.addMouseListener(this); upgradePanel.add(uip); } ...
1
public boolean checkValidMenu(int menuIndex) { if(isLoggedIn) if(menuIndex > 0 && menuIndex <= 7) return true; if(menuIndex > 0 && menuIndex <= 5) return true; return false; }
5
private ArrayList<Corner> landCorners() { final ArrayList<Corner> list = new ArrayList(); for (Corner c : corners) { if (!c.ocean && !c.coast) { list.add(c); } } return list; }
3
public static void main(String[] a) throws IOException { Scanner s = new Scanner(new File(a[0])); while (s.hasNext()) { String l = s.nextLine(); String[] x = l.split("\\ "); int[] y = new int[x.length]; for (int i = 0; i < x.length; i++) { y[i] = Integer.parseInt(x[i]); } boolean f = f...
8
private int doLogin () throws InterruptedException{ boolean isLogin = false; boolean first = true; int count =0; do { if (!first){ log.error("login error. retry!"); ThreadUtil.sleep( RandomUtil.getRandomInt(YueCheHel...
9
public int getPosition() { return carPhysics.getPosition(); }
0
public Phrase[] recombine(Phrase[] population, double[] fitness, double initialLength, int initialSize, int beatsPerBar) { Phrase[] returnPop = population.length - ELITISM_CONSTANT >= 0 ? new Phrase[population.length - ELITISM_CONSTANT]...
7
@BeforeClass public static void setUpBe() throws Exception { for (int i = 0; i<100 ;i++){ dequeInteger.add(i); //190 символов dequeDouble.add(1.); //300 символов dequeString.add("Hi!"); //300 символов } }
1
public boolean test(Object obj) { int[] tab = (int[]) obj; for (int i = 1; i < tab.length; i++) { if (tab[i - 1] > tab[i]) return false; } return true; }
2
private Component cycle(Component currentComponent, int delta) { int index = -1; loop : for (int i = 0; i < m_Components.length; i++) { Component component = m_Components[i]; for (Component c = currentComponent; c != null; c = c.getParent()) { if (component == c) { index = i; break loop; } ...
8
private void doProperty(Class type, PropertyDescriptor pd, Object oldInstance, Object newInstance, Encoder out) throws Exception { Method getter = pd.getReadMethod(); Method setter = pd.getWriteMethod(); if (getter != null && setter != null) { Expression oldGetExp = new Expression(o...
8
public JSONObject toJSONObject(JSONArray names) throws JSONException { if (names == null || names.length() == 0 || this.length() == 0) { return null; } JSONObject jo = new JSONObject(); for (int i = 0; i < names.length(); i += 1) { jo.put(names.getString(i), this....
4
public static void main(String[] args) throws IOException { criba(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String s; StringBuilder sb = new StringBuilder(); while ((s = br.readLine()) != null) { if (sb.length() != 0) { ...
8
static final public void Line() throws ParseException { Token t; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case UDP_BUFFER_SIZE: jj_consume_token(UDP_BUFFER_SIZE); jj_consume_token(WHITESPACE); t = jj_consume_token(VALUE); setUdpBufferSiz...
9
private void leave(String exitString) { /* look for a matching context */ int i; if (exitString.equals("")) { i = 0; } else { for (i = contexts.size() - 1; i >= 0; --i) { String context = contexts.get(i); if (context.equals(exitString)) break; } if (i < 0) { System.err.println("Warn...
6
Image imageIdToImage(int id){ switch(id + faction){ case 1: return new ImageIcon("C:\\test\\bluetestsprite.png").getImage(); case 2: return new ImageIcon("C:\\test\\redtestsprite.png").getImage(); default: System.out.println("returned null from imageIdToImage!"); return null; } }
2
public boolean checkForWinAndDrow() { if (checkForWinHorizontally() || checkForWinUpright() || checkForWinDiagonallyLeft() || checkForWinDiagonallyRight()) { System.out.println(winner + " Winner!!!"); return true; } else { if (checkForDrow()) { System.out.println("Drow !!!"); return true; } ...
5
public static boolean isHellhound (Entity entity) { if (entity instanceof Wolf) { Wolf hound = (Wolf) entity; if (hound.getEquipment().getChestplate().equals(new ItemStack(Material.LEATHER_CHESTPLATE, 1, (short) - 98789))) { return true; } } re...
2
@Override public Atom parseAtom() throws IOException { Atom atom = null; switch (curToken.type) { case NUMBER: if (curToken.c.contains(".")) { atom = new NumberAtom(Double.parseDouble(curToken.c)); } else { atom = n...
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 lo...
6
@Override public String runMacro(HTTPRequest httpReq, String parm, HTTPResponse httpResp) { final java.util.Map<String,String> parms=parseParms(parm); final String last=httpReq.getUrlParameter("POLL"); if(parms.containsKey("RESET")) { if(last!=null) httpReq.removeUrlParameter("POLL"); return ""; }...
8
public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (getScheduledtasks() != null) { for (int i=0; i<java.lang.reflect.Array.getLength(getScheduledtasks()); i+...
7
public void readFile() throws FileNotFoundException,IOException { /* lekha - generating bigrams from big.txt instead of wikipedia corpus BufferedReader br2 = new BufferedReader(new FileReader("big.txt")); System.out.println("Reading corpus..."); String line2; while((line2 = br2.readLine()) != null) { St...
7
public final JSONWriter array() throws JSONException { if (this.mode == 'i' || this.mode == 'o' || this.mode == 'a') { this.push(null); this.append("["); this.comma = false; return this; } throw new JSONException("Misplaced array."); }
3
private void clearAll() { contEntGlo.clear(); contEntLoc.clear(); contEntTmp.clear(); contEntCons.clear(); contFlotGlo.clear(); contFlotLoc.clear(); contFlotTmp.clear(); contFlotCons.clear(); contStrGlo.clear(); contStrLoc.clear(); contStrTmp.clear(); contStrCons.clear(); contBoolGlo.clear(); ...
2
private static void addKeyListener(JFrame frame) { frame.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent event) { int c = event.getKeyCode(); if (c == KeyEvent.VK_LEFT | c == KeyEvent.VK_A) { grid.moveSelectedLeft(); } else if (c == KeyEvent.VK_RIGHT | c == KeyEvent.VK_D) { ...
9
@Before public void setUp() { }
0
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PrivateCategory that = (PrivateCategory) o; if (colorCode != that.colorCode) return false; if (id != that.id) return false; if (headLin...
7
public RabinHashFunction64() { table32 = new long[256]; table40 = new long[256]; table48 = new long[256]; table54 = new long[256]; table62 = new long[256]; table70 = new long[256]; table78 = new long[256]; table84 = new long[256]; buffer = new byte[READ_BUFFER_SIZE]; long[] mods = new long[P_DEGREE]...
7
public static void updateRow(JTable source, int row) throws CannotReadException, IOException, TagException, ReadOnlyFileException, InvalidAudioFrameException { AudioFile f = null; double size = 0; if (source == LibraryPanel.table) { f = AudioFileIO.read((list.get(row))); size = (double)list.get(row).length(...
8
public final void visitLookupSwitchInsn( final Label dflt, final int[] keys, final Label[] labels) { AttributesImpl att = new AttributesImpl(); att.addAttribute("", "dflt", "dflt", "", getLabel(dflt)); String o = AbstractVisitor.OPCODES[Opcodes.LOOKUPSWITCH]; ...
1
@SuppressWarnings("unchecked") public int addPhoto(String filename, String caption, String albumName, File pic) { Photo p = new Photo(filename, GuiView.control.getCurrentUser().getID(), caption, albumName, pic); if (GuiView.control.getCurrentUser().getAlbumList().containsKey(albumName)) { Iterator it = GuiV...
8
ErosionDilatation(final boolean current_selection[], int kernel_size, int width, int height, boolean dilate) { // two different selection outputs will be generated, see below at // methods: one "final" and one with just the changed pixels this.new_selection = new boolean[current_selection.length]; for (int ...
9
public void pack () { checkWidget (); CTableItem[] items = parent.items; int index = getIndex (); int newWidth = getPreferredWidth (); for (int i = 0; i < parent.itemsCount; i++) { int width = items [i].getPreferredWidth (index); /* ensure that receiver and parent were not disposed in a callback */ if (paren...
5
private Set transitionFunction(String word, Set currentStates) { Set tmpSet = new Set(currentStates); if (word.length() == 1) { for (State state : currentStates) { tmpSet.addAll(state.transition(word)); tmpSet.remove(state); } Iterator<State> it = tmpSet.iterator(); while (it.hasNext()) tmpS...
5
private void drawNode(RBNode node, int curLevel, int leftPos, int rightPos) { if (node == null) return; // try{Thread.sleep(100);} catch(Exception e) {} if (node.getColor() == com.andreydev.rbtree.Color.BLACK) { window.setColor(black); } else { window.setColor(red...
5
public static String[] split(String toSplit, String delimiter) { if (!hasLength(toSplit) || !hasLength(delimiter)) { return null; } int offset = toSplit.indexOf(delimiter); if (offset < 0) { return null; } String beforeDelimiter = toSplit.substring(0, offset); String afterDelimiter = toSplit.substri...
3
@Override public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel) { final MOB target=this.getTarget(mob,commands,givenTarget); if(target==null) return false; if(!super.invoke(mob,commands,givenTarget,auto,asLevel)) return false; final boolean success=prof...
9