text
stringlengths
14
410k
label
int32
0
9
private void unfilterPaeth(byte[] curLine, byte[] prevLine) { final int bpp = this.bytesPerPixel; int i; for(i=1 ; i<=bpp ; ++i) { curLine[i] += prevLine[i]; } for(int n=curLine.length ; i<n ; ++i) { int a = curLine[i - bpp] & 255; int b = pre...
8
@Override public void handleMessage(String[] msg){ super.handleMessage(msg); boolean willDie = Boolean.parseBoolean(msg[3]); int playerToheal = Integer.parseInt(msg[6]); if(willDie){ if(playerToheal != 0){ Tank player = null; if(playerToheal == 1){ player = level.getPlayers().get(0); ...
5
private void checkName(final String name) { if ((name == null) || name.trim().length() == 0) { throw new IllegalArgumentException("Cannot create table! Wrong name!"); } if (name.matches("[" + '"' + "'\\/:/*/?/</>/|/.\\\\]+") || name.contains(File.separator) || name.c...
5
public String getErrorInfo() { if (!specialConstructor) { try { return super.getMessage() + " at column " + currentToken.next.beginColumn + "."; } catch (Exception e) { return super.getMessage(); } } int maxSize = 0; for (int i = 0; i < expectedTokenSequences.length; i++) { if (maxSize < ...
7
public void WriteSave() { int Year = Calendar.getInstance().get(Calendar.YEAR); int Month = Calendar.getInstance().get(Calendar.MONTH); int Day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH); int Hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); int Minute = Calendar.getInstance().get(Calendar.MI...
9
public void addItem(Item item){ try{ session.beginTransaction(); session.save(item); session.getTransaction().commit(); } catch(HibernateException e){ Main.getFrame().showError("A hozzáadás sikertelen volt: "+e.getMessage()); } }
1
private void findButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_findButtonActionPerformed String searchTerm = findField.getText().toLowerCase(); symbolDataArea.requestFocusInWindow(); if (searchTerm != null && searchTerm.length() > 0) { Document do...
6
@Override public void setValueAt(Object value, int row, int col) { switch (col) { case 0: dataSwitch[row] = (boolean) value; break; case 2: data[row].quantity = (double) value; break; case 3: data[row].price = (int) Math.round(100.0 * ((double) value)); break; } fireTableCellUpdated(ro...
3
static void swap2max(ArrayList<Integer> input, int k) { if (input.size() < 2) { System.out.println("invalid input"); } int maxNum[]; maxNum=new int[input.size()]; maxNum[0]= Integer.MIN_VALUE; ArrayList<Integer> maxVec = new ArrayList<Integer>(input.size()); //maxVec=deepCopyLi...
4
public static <T extends Comparable<? super T>> void sort(T[] array) { T saved; //Index of the element we're pulling out (as saved) int gap; //Loop over each index starting at 1 //(we can assume the first one is already inserted) for (int i = 1; i < array.length; i++) {...
4
public void open(String filename,int auIndex) { int EXTERNAL_BUFFER_SIZE = 524288; URL soundFile = this.getClass().getClassLoader() .getResource("Sound/"+filename); AudioInputStream audioInputStream = null; try { audioInputStream = AudioSystem.getAudioInputStream(soundFile); } catch ...
5
@Override public boolean isDeletable(){ return !(getName().equals(Balances.YEAR_BALANCE) || getName().equals(Balances.RESULT_BALANCE) || getName().equals(Balances.RELATIONS_BALANCE)); }
2
@Test public void testGetHight() { System.out.println("geHight"); assertEquals(1.5, new Tetrahedron(1.5,2,3.5,12).getHig(), 0.0001); }
0
protected void readAndCheckFirstByte(InputStream inputStream) throws IOException, InvalidFormatException { int firstByte = inputStream.read(); if(firstByte < 0 || firstByte != getPrefix()) { throw new InvalidFormatException(); } }
2
public String mergeFiles(String file1, String file2, String outputFile) throws IOException { DistributedInputStream is1 = new DistributedInputStream(file1, nameNode), is2 = new DistributedInputStream( file2, nameNode); DistributedOutputStream os = new DistributedOutputStream(outputFile, nameNode); ...
9
public static JSONObject toJSONObject(String string) throws JSONException { String name; JSONObject jo = new JSONObject(); Object value; JSONTokener x = new JSONTokener(string); jo.put("name", x.nextTo('=')); x.next('='); jo.put("value", x.next...
3
public TreeNode flattenRec(TreeNode root){// return the link tail if(root == null) return null; if(root.left == null && root.right == null){ return root; }else if(root.left == null){ return flattenRec(root.right); }else if(root.right == null){ TreeNode...
5
public String toString() { StringBuilder s = new StringBuilder("peer://") .append(this.ip).append(":").append(this.port) .append("/"); if (this.hasPeerId()) { //s.append(this.hexPeerId.substring(this.hexPeerId.length()-6)); s.append(this.hexPeerId); } else { s.append("?"); } return s.toString...
1
@Override public void delClasa(String clasaDeSters) { BufferedReader fisier; try { fisier = new BufferedReader(new FileReader("clase")); BufferedWriter fisier_nou; ArrayList<String> vector = new ArrayList<>(); for(String line; (line = fisier.re...
6
public boolean accept (Champion c) { if (searchPosition != null) if (c.hasPosition (searchPosition)) return true; if (c.getName().toLowerCase().contains (searchString)) return true; return false; }
3
public void setInhusa(Integer inhusa) { this.inhusa = inhusa; }
0
private void pop(char c) throws JSONException { if (this.top <= 0) { throw new JSONException("Nesting error."); } char m = this.stack[this.top - 1] == null ? 'a' : 'k'; if (m != c) { throw new JSONException("Nesting error."); } this.top -= 1; ...
5
@Override public void actionOnPChoice(int choice, int player) { switch(choice){ case PlayersChoices.REMOVE_FOOT : territories[getPlaceOnTrack(player)].getTroup().rmToop(0, 1, 0, 0); units[getPlaceOnTrack(player)]--; break; case PlayersChoices.REMOVE_KNIGHT : territories[getPlaceOnTrack(player)]...
6
public Boolean isValid() { if (this.url.length() < 5 || this.url.length() > 64) { return false; } /* * Walidacja dozwolonych GTLD */ Boolean bFound = false; for (String gtld : Link.allowedGtld) { if (this.urlObject.getHost().endsWith(gtld)) { bFound = true; break; } } if (!(bFoun...
8
public ArrayList<Collider> getColliders() { for ( Collider collider : colliders ) collider.setPos( getTransform().getPos() ); return colliders; }
1
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // OK button if (file == null){JOptionPane.showMessageDialog(null, "No file selected!"); return;} if (jCheckBox2.isSelected()){ resetList(newlist); } dispose(); Tester<Word> test = new SimpleTest<Word>(newlist)...
5
public static void kickAll( String sender, String message ) { if ( message.equals( "" ) ) { message = Messages.DEFAULT_KICK_MESSAGE; } message = Messages.KICK_PLAYER_MESSAGE.replace( "{message}", message ).replace( "{sender}", sender ); for ( ProxiedPlayer p : ProxyServer.ge...
2
long getDuration() { // TODO: how should this really be done?? if (debugFlag) debugPrintln("JSChannel:getDuration"); if (ais == null || audioFormat == null ) { if (debugFlag) debugPrintln("JSChannel: Internal Error getDuration"); retur...
9
public EquipmentType[] getEquipment(Specification specification) { List<EquipmentType> equipment = new ArrayList<EquipmentType>(); switch(role) { case PIONEER: EquipmentType tools = specification.getEquipmentType("model.equipment.tools"); for (int count = 0; count < tools...
7
private static File buscarArchivoPrj(File directorio) { File[] contenidos = directorio.listFiles(); for (File archivo: contenidos) { if (archivo.isDirectory()){ File buscado = buscarArchivoPrj(archivo); if (buscado != null) { return buscado; } } if (archivo.isFile() && archivo.getName(...
5
public static void main(String[] args) { LazyPrimMST mst = new LazyPrimMST( new EdgeWeightedGraph(new In(args[0]))); System.out.println("Minimum spanning tree of " + args[0]); for (WeightedEdge e : mst.edges()) System.out.println(e); System.out.println("Weight : " + mst.weight()); }
1
public static Stella_Object yieldTypeSpecTree(StandardObject self) { { Surrogate testValue000 = Stella_Object.safePrimaryType(self); if (Surrogate.subtypeOfSurrogateP(testValue000)) { { Surrogate self000 = ((Surrogate)(self)); return (Symbol.internSymbolInModule(self000.symbolName, ((Modul...
8
@Override public void paintComponent(Graphics g) { super.paintComponent(g); // paints background if (dFAPainter != null) dFAPainter.updateGraphics((Graphics2D)g); }
1
public void writeValue(String incoming) { writeFile(FilePaths.getValuePath(pinNumber), incoming); try { String readVal = readValue(); if (!readVal.equals(incoming)) { throw new RuntimeException("Tried to change pin " + pinNumber + " but failed to write: " +...
4
private void avaaViereiset(int x, int y) { for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { if ((i == 0 && j == 0)) { //tarkistetaan että ruutu on kentän sisällä } else if ((x + i) > -1 && (y + j) > -1 && (x + i) < this.kentta.getLevey...
8
public NodeSet() {}
0
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Segment other = (Segment) obj; if (p1 == null) { if (other.p1 != null) return false; } else if (!p1.equals(other.p1)) return false; ...
9
public void addAll(TileSet aTiles) { if (mProbability) { final byte nothing = mField.getMasks().getNothing().getId(); for (int tile : aTiles) mTiles.put(tile, mField.getMask(tile) == nothing); } else for (int tile : aTiles) mTiles.put(tile, false); }
3
public void retrieveURLfromfile(String fileLoc) throws IOException { String uRL = ""; try { File file = new File(fileLoc); Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { uRL = scanner.nextLine(); } scanner.close(); } catch (FileNotFoundException e) { e.printStackTrace()...
3
private H2Driver(Plugin p, HashMap<String, String> c) { plugin = p; this.db = c.get("database"); this.prefix = c.get("prefix"); this.user = c.get("user"); this.pass = c.get("password"); this.dbg = (c.containsKey("debug")) ? this.parseBool(c.get("debug"), false) : false; String dbPath = "jdbc:h2:" + pl...
5
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ImageAttributes other = (ImageAttributes) obj; if (imgHeight != other.imgHeight) return false; if (imgWidth != other.imgWidth) return fal...
8
public static void evaporateVirgin(Description self) { { List parentimplies = List.newList(); List childimplies = List.newList(); Description parent = null; Description child = null; Proposition bridgeprop = null; { Proposition p = null; Iterator iter000 = Logic.unfilteredDepe...
7
public int getInDocumentFrequency(String document){ for(Occurrence occ: docsList.toArray()){ if(occ.getDocName().compareTo(document) == 0){ return occ.getTermFrequency(); } } return -1; }
2
@Override public void run() { for (int count = 0; count < myUniverse.getShapeList().size(); count++) { System.out.println("Shape " + String.valueOf(count)); System.out.println(String.valueOf((myUniverse.getShapeList().get(count).getPosition().getComponent(0)))); System.out.println(String.valueOf((myUniverse...
1
private void finishParse(Vector methods, Object root, Object handler) { if (methods != null) for (int i = 0; i < methods.size(); i += 3) { Object component = methods.elementAt(i); Object[] definition = (Object[]) methods.elementAt(i + 1); String value = (String) methods.elementAt(i + 2); if ("method" ...
5
void paintImage(PaintEvent event) { GC gc = event.gc; Image paintImage = image; /* If the user wants to see the transparent pixel in its actual color, * then temporarily turn off transparency. */ int transparentPixel = imageData.transparentPixel; if (transparentPixel != -1 && !transparent) { image...
9
private void updateTabla(){ //** pido los datos a la tabla Object[][] vcta = this.getDatos(); //** se colocan los datos en la tabla DefaultTableModel datos = new DefaultTableModel(); tabla.setModel(datos); ...
5
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6) { this.bipedHead.rotateAngleY = par4 / (180F / (float)Math.PI); this.bipedHead.rotateAngleX = par5 / (180F / (float)Math.PI); this.bipedHeadwear.rotateAngleY = this.bipedHead.rotateAngleY; ...
6
public int getRsrceQuantity() { return rsrceQuantity; }
0
private void searchGuestButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchGuestButtonActionPerformed guestModel.clear(); String firstName = searchFirstNameField.getText(); String lastName = searchLastNameField.getText(); ArrayList<Guest> foundGuests = new Arr...
7
void createExampleWidgets () { /* Compute the widget style */ int style = getDefaultStyle(); if (dropDownButton.getSelection ()) style |= SWT.DROP_DOWN; if (readOnlyButton.getSelection ()) style |= SWT.READ_ONLY; if (simpleButton.getSelection ()) style |= SWT.SIMPLE; /* Create the example widgets */ ...
4
@Override public String getOne(String strTabla, String strCampo, int id) throws Exception { Statement oStatement; ResultSet oResultSet; try { oStatement = (Statement) oConexionMySQL.createStatement(); String strSQL = "SELECT " + strCampo + " FROM " + strTabla + " WHER...
2
public void criarDiretor(Usuario Diretor) throws SQLException { UsuarioDAO userDAO = new UsuarioDAO(); Usuario userExistente = userDAO.selectDiretor(); if (userExistente == null) { userDAO.criaUSER(Diretor); } }
1
public boolean ordenar() { for (int i=1; i<this.capacidade - 1; i++) { if(this.aContas[i] != null) { ContaCorrente k = this.aContas[i]; int kn = this.aContas[i].getNumero(); int j = i; while(j > 0 && this.aConta...
5
public boolean isFilled() { boolean test = false; if (test || m_test) { System.out.println("Coordinate :: isFilled() BEGIN"); } if (test || m_test) { System.out.println("Coordinate :: isFilled() END"); } return (m_Value == Game.PlayerTurn.PLAYER1 || m_Value == ...
5
@Override public int compareTo(Shape shape) { return new Integer(getCorners()).compareTo(shape.getCorners()); }
0
public void applyForceOfGravity(List<? extends SpaceObject> spaceObjects, double dt) { double fX = 0; double fY = 0; for (SpaceObject spaceObj : spaceObjects) { if (this != spaceObj) { double x2 = spaceObj.getX(); double y2 = spaceObj.getY(); double r = MathUtils.distance(x, y, x2, y2); ...
4
public void addComment(String text) { comments.add(text); }
0
public boolean execute() throws SQLException { PreparedStatement ps; if (columns != null || columns.length() != 0) { columns.setCharAt(columns.lastIndexOf(","), ')'); if (values != null || values.length() != 0) { values.setCharAt(values.lastIndexOf(","), ')'); } builder.append(columns).append(va...
4
public HoughCircleDialog(final Panel panel) { setTitle("Hough Circle"); setBounds(1, 1, 300, 200); Dimension size = getToolkit().getScreenSize(); setLocation(size.width / 3 - getWidth() / 3, size.height / 3 - getHeight() / 3); this.setResizable(false); setLayout(null); JPanel pan = new JPanel(); p...
6
public void setUrlModified(boolean urlModified) { this.urlModified = urlModified; }
0
public double[] getDoubleArrayArgument(String name, boolean required){ if(M.containsKey(name)) { String a = M.get(name).trim(); if("dD".indexOf(a.charAt(0)) == -1){illFormedArray(a," expected double array: d[a:b:c]");} if(a.charAt(1) != '[' || a.charAt(a.length()-1) !...
9
public List<SiteParser> createParsers() { List<SiteParser> result = new ArrayList<SiteParser>(); List<SiteParser> parsers; ClassLoader cl = getClass().getClassLoader(); GroovyClassLoader gcl = new GroovyClassLoader(cl); /* try { Enumeration<URL> parsersUrl = g...
8
private String readHeader() { String s = null; holdPos = pos; int i = line.indexOf( ']' ); if ( i != -1 ) { s = line.substring( pos, ( i + 1 ) ); lastPos = pos; pos = pos + ( ( i - pos ) + 1 ); checkPos(); int e = s.length() ...
5
private JMenu makeSizeMenu() { JMenu size = new JMenu("Size"); for (int i = 0; i < sizeChoices.length; i++) { final int r = sizeChoices[i][0]; final int c = sizeChoices[i][1]; JMenuItem item = new JMenuItem(r + "-by-" + c); item.addActionListener( new ActionListener() { ...
1
public static final void UseReturnScroll(final SeekableLittleEndianAccessor slea, final MapleClient c, final MapleCharacter chr) { if (!chr.isAlive()) { c.getSession().write(MaplePacketCreator.enableActions()); return; } slea.skip(4); final byte slot = (byte) slea...
6
final public void IfExp() throws ParseException {/*@bgen(jjtree) IfExp */ SimpleNode jjtn000 = (SimpleNode)SimpleNode.jjtCreate(this, JJTIFEXP); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(IF); Expression(); jj_consume_token(THEN); Expression(); ...
8
public static double ddot_j (int n, double dx[], int incx, double dy[], int incy) { double ddot; int i,ix,iy,m; ddot = 0.0; if (n <= 0) return ddot; if ((incx == 1) && (incy == 1)) { // both increments equal to 1 m = n%5; for (i = 0; i < m; ...
8
public void update() throws MaltChainedException { parentFeature.update(); FunctionValue value = parentFeature.getFeatureValue(); if (value instanceof SingleFeatureValue) { String symbol = ((SingleFeatureValue)value).getSymbol(); if (((FeatureValue)value).isNullValue()) { multipleFeatureValue.addFeature...
7
private boolean validarDatos() { //unicamente valido el numero de cuenta boolean valido = false; Validaciones val = new Validaciones(); if (jTextField1.getText().equals("") || jTextField2.getText().equals("")){ mensajeError("Ingrese un rango de Asientos (1 .. 99).");...
6
public void destroy(Integer id) throws NonexistentEntityException { EntityManager em = null; try { em = getEntityManager(); em.getTransaction().begin(); Motor motor; try { motor = em.getReference(Motor.class, id); motor.getC...
8
private static String getValidWebpage(String url) throws TvDbException { // Count the number of times we download the web page int retryCount = 0; // Is the web page valid boolean valid = false; DigestedResponse webPage; while (!valid && (retryCount < RETRY_COUNT)) { ...
6
@Override public void draw(Graphics2D graphics) { FontMetrics metrics = graphics.getFontMetrics(); Tile loc = context.players.getLocalPlayer().getLocation(); for (int x = loc.getX() - 20; x < loc.getX() + 20; x++) { for (int y = loc.getY() - 20; y < loc.getY() + 20; y++) { Tile t = new Tile(x, y); if ...
3
@Test(dataProvider = DATA_PROVIDER) public void wrongPasswordAndValidAccountEmail(DriverGenerator dg){ // boiler plate WebDriver wd = dg.generate(); ParallelPrepHelper pph = new ParallelPrepHelper(wd); // setup boolean madeItToPage = pph.goToURL(AMAZON_HOME_PAGE); boolean clickOnSignIn = pph.clickOnVisible...
5
private void writeArray(YamlFile yamlFile, String key, Class<?> parameterType) { String className = parameterType.getComponentType().getName(); if(implementsConfigurationSerializable(parameterType.getComponentType())) { ConfigurationSerializable serializable = getSerializable(parame...
4
public static void main(String args[]) { Scanner S = new Scanner(System.in); String choice; String breakf; System.out.println("User is Hungry"); System.out.println("Get in Line"); System.out.println("Buy Lunch"); System.out.println("Are You thirsty?"); System.out.print("press Y for Yes or N fo...
4
public static void printBest(){ Deck best = Zegana.currentGen[0]; float bestP = Zegana.performance[0]; for(int i=1; i<Zegana.performance.length; i++){ if(Zegana.performance[i]>bestP){ bestP = Zegana.performance[i]; best = Zegana.currentGen[i]; } } if((bestP < Zegana.elitePerf) && (Zegana.env == 'f'...
7
public boolean onPlayerRightClick(EntityPlayer par1EntityPlayer, World par2World, ItemStack par3ItemStack, int par4, int par5, int par6, int par7) { if (par3ItemStack != null && par3ItemStack.getItem() != null && par3ItemStack.getItem().onItemUseFirst(par3ItemStack, par1EntityPlaye...
6
public void performRequest(String request) { if (request.compareTo("Show preview") == 0) { showPreview(); return; } // first grab the index if any if (request.indexOf(":") < 0) { return; } String tempI = request.substring(0, request.indexOf(':')); int index = Integer.parseI...
7
Class187(GameMode class230, int i, IndexLoader class45) { do { try { aClass45_2498 = class45; if (aClass45_2498 == null) break; aClass45_2498.getAmountChildEntries(35); } catch (RuntimeException runtimeexception) { throw Class348_Sub17.method2929(runtimeexception, ("qga.<init>(" + ...
5
public void checkwildy() { if ((absY <= 10112 && absY >= 3970) || (absY <= 3672)) { inwildy = true; } else { inwildy = true; } }
3
public boolean ajouterStation(Station st) { if (st instanceof ArretDeBus && this.getNbArretDeBus() <= NOMBRE_MAX_ARRETDEBUS) { return this.stations.add((ArretDeBus) st); } else if (st instanceof StationTaxis && this.getNbStationTaxi() <= NOMBRE_MAX_STATIONTAXI) { return this.stat...
4
public static Action defaultAction(EntityType type) { Action action = null; switch (type) { case OBJ_TREE: action = Action.OPEN_CLOSE; break; case OBJ_DOOR_WOOD: action = Action.OPEN_CLOSE; break; case E...
3
public void setPrpMoaConsec(Integer prpMoaConsec) { this.prpMoaConsec = prpMoaConsec; }
0
public boolean postMortem(PostMortem pm) { Keep that = (Keep) pm; if (this.length != that.length) { JSONzip.log(this.length + " <> " + that.length); return false; } for (int i = 0; i < this.length; i += 1) { boolean b; if (this.list[i] inst...
6
public void test_getMillis_long() { assertEquals(0L, iField.getMillis(0L)); assertEquals(1234000L, iField.getMillis(1234L)); assertEquals(-1234000L, iField.getMillis(-1234L)); try { iField.getMillis(LONG_MAX); fail(); } catch (ArithmeticException ex) {} ...
1
@Override public Set<Class<?>> getClasses() { return super.getClasses(); }
1
private void processHits() { ByteBuffer pixel = ByteBuffer.allocateDirect(16); GL11.glReadPixels(Mouse.getX(), Mouse.getY(), 1, 1, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, pixel); int gotId = Utility.glColorToId(new byte[]{pixel.get(0),pixel.get(1),pixel.get(2),pixel.get(3)}, false); d2.setColor(pixel.get(0),pixel...
3
@Override public List<Person> meetCriteria(List<Person> persons) { List<Person> marriedPersons = new ArrayList<>(); for (Person person : persons) { if (person.getMaritalStatus().equalsIgnoreCase("Married")) { marriedPersons.add(person); } } return marriedPersons; }
2
@POST @Produces(MediaType.TEXT_HTML) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public void newPerson(@FormParam("uid") String id, @FormParam("summary") String summary, @FormParam("description") String description, @Context HttpServletResponse servletResponse) throws IOException, NumberFor...
2
public void print() { Nodo<?> nodo = head; do { out.println(nodo.getData()); nodo = nodo.getNext(); } while (nodo != null); }
2
@Override public void actionPerformed(ActionEvent e) { updateCollisionRange(); checkCollision(); if (!jump) { for (int i = 0; i < collisionRange.size(); i++) { if (!getRectangle().intersects(collisionRange.get(i)) && i == collisionRange.size() - 1) FallDown(); } } else { jump(); } }
4
public void init() { try { this.ButtonTitle = getParameter("ButtonTitle"); if (this.ButtonTitle == null) { this.ButtonTitle = "Start Game"; } String str1 = getParameter("BaseURL"); if (str1 != null) this.BaseURL = new URL(str1); else { this.BaseURL ...
5
public static String getName(File folder, File file) { String path = folder.getAbsolutePath(); String name = file.getAbsolutePath(); if (name.startsWith(path)) name = name.substring(path.length() + 1); if (name.endsWith(".gz")) name = name.substring(0, name.length() - 3); if (nam...
3
public static String timeIntervalToString(long millis) { StringBuffer sb = new StringBuffer(); if (millis < 10 * Constants.SECOND) { sb.append(millis); sb.append("ms"); } else { boolean force = false; String stop = null; for (int ix = 0...
7
private boolean executeSqlFile(String path){ try{ BufferedReader br = new BufferedReader(new FileReader(path)); String str; StringBuilder sb = new StringBuilder(); while ((str = br.readLine()) != null) { sb.append(str + "\n "); } ...
2
@Override public void store(final Document document, Reader reader) { final String documentId = document.getId(); LOGGER.info(String.format("store document '%s'", documentId)); KeyHolder keyHolder = new GeneratedKeyHolder(); delete(documentId); LOGGER.debug(String.format(...
7
public void randomlyInitializeParams() { //initializes the initial state parameters double dsum = 0; probinit = new double[numstates]; for (int ni = 0; ni < probinit.length; ni++) { probinit[ni] = theRandom.nextDouble(); dsum += probinit[ni]; } for (int ni = 0; ni < probinit.length; ni++) { ...
9
public static void invokeMain(String className, String[] args) { try { Class.forName(className) .getMethod("main", new Class[] {String[].class}) .invoke(null, new Object[] {args}); } catch (Exception e) { InternalError error = new InternalError("Failed to ...
1
public static ConsolidationFunctionType get(String s) { if (s.equalsIgnoreCase(STR_AVERAGE)) { return AVERAGE; } else if (s.equalsIgnoreCase(STR_MIN)) { return MIN; } else if (s.equalsIgnoreCase(STR_MAX)) { return MAX; } else if (s.equalsIgnoreCase(STR_LAST)) { return LAST; } else { throw new ...
4