text stringlengths 14 410k | label int32 0 9 |
|---|---|
@Override
public boolean check() {
// use super.check() to check the executor, then to check the distributor.
if ( super.check() ) {
try {
this.distributor = Class.forName(this.dis);
} catch (ClassNotFoundException e) {
System.out.println("InnerNode " + this.name + " : " + " Distributor " + this.dis ... | 5 |
public static void main(String[] args) throws IOException, ClassNotFoundException {
FileOutputStream fos = new FileOutputStream("/tmp/fooobject.data");
ObjectOutputStream os = new ObjectOutputStream(fos);
FooObject foo = new FooObject("foo1", 10, 12, new FooObject("test", 1, 2, null));
os.writeObject(foo)... | 0 |
public static void editRate(Rate r){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement s... | 4 |
private static void testCpus(int cpuCount, char[] ram) {
DCPU[] cpus = new DCPU[cpuCount];
for (int i = 0; i < cpuCount; i++) {
cpus[i] = new DCPU();
for (int j = 0; j < 65536; j++) {
cpus[i].ram[j] = ram[j];
}
}
long ops = 0L;
int hz = khz * 1000;
int cyclesPerFrame =... | 7 |
public static void splitPivotLast(int low, int high) {
int i = low;
for (int j = low; j < high; j++) {
countLast++;
if (result[j] < result[high]) {
exchange(j, i);
i++;
}
}
exchange(high, i);
if (low < i - 1)
... | 4 |
public void checkConsistent() {
super.checkConsistent();
if (subBlocks[0].jump != null
|| subBlocks[0] instanceof SequentialBlock || jump != null)
throw new jode.AssertError("Inconsistency");
} | 3 |
public void setRecursiveNotDirty()
{
super.setRecursiveNotDirty();
this.isTargetHrefDirty = false;
if(this.create!=null && this.create.isDirty())
{
this.create.setRecursiveNotDirty();
}
if(this.delete!=null && this.delete.isDirty())
{
t... | 7 |
@Override
public boolean equals(Object o)
{
if (o == null)
{
return false;
}
if (!(o instanceof Vector3))
{
return false;
}
Vector3 other = (Vector3)o;
return (this.x == other.x && this.y == other.y && this.z == other.z);
... | 4 |
@Override
public void run() {
FileProxy proxy = AppWindow.findFileProxy(mFile);
if (proxy != null) {
PrintCommand.print(proxy.getPrintProxy());
} else if (System.currentTimeMillis() - mStart < TimeUnit.MILLISECONDS.convert(2, TimeUnit.MINUTES)) {
EventQueue.invokeLater(this);
}
} | 2 |
private Response requestHelper(String requestUrl, String requestBody)
{
Response response = backdoorRequest(requestUrl);
if(response != null && response.getValue() != null)
{
try
{
response.value = JsonParser.parse((String)response.getValue());
return response;
}
catch(JsonParseException e)
... | 8 |
@Override
public String toString(){
return "\nRECARGO "+super.toString();
} | 0 |
public List<VariableAppearance> getAppearances(ParsingContext context) {
List<VariableAppearance> result = new ArrayList<VariableAppearance>();
for (PatternGroupStructure pattern : patterns) {
Matcher matcher = pattern.getPattern().matcher(context.getContent());
while (matcher.find()) {
String variableNam... | 4 |
public void thaw() {
Configuration[] configs = configurations.getSelected();
if (configs.length == 0) {
JOptionPane.showMessageDialog(configurations,
NO_CONFIGURATION_ERROR, NO_CONFIGURATION_ERROR_TITLE,
JOptionPane.ERROR_MESSAGE);
return;
}
for (int i = 0; i < configs.length; i++) {
configur... | 2 |
public void drawTile(int xi,int yi,int tileid) {
if (background == null) return;
// determine position within bg
int x = el.moduloFloor(xi+1,el.viewnrtilesx+3) * el.scaledtilex;
int y = el.moduloFloor(yi+1,el.viewnrtilesy+3) * el.scaledtiley;
// draw
if (bgg==null) bgg = background.getGraphics();
Integer ... | 6 |
private boolean sudoku(char[][] board, int pos) {
int n = board.length;
if(pos == n*n)
return true;
int x = pos/n;
int y = pos%n;
if(board[x][y] == '.'){
for(char c= '1'; c <= '9'; c++){
board[x][y] = c;
if(isValidSudoku(bo... | 5 |
short[] findY2(short t1Index, short t2Index, short t3Index, short t4Index){
short stopBefore = mod(t1Index - 1);
short pathT4Index = path[t4Index];
short start = mod(t3Index + 2);
int numLoops = Math.min(mod(stopBefore - start), LIMIT);
if(numLoops == 0){
return null;
}
short t5Index = mod(start + r... | 5 |
@Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} | 0 |
public static void zmq_ctx_set (Ctx ctx_, int option_, int optval_)
{
if (ctx_ == null || !ctx_.check_tag ()) {
throw new IllegalStateException();
}
ctx_.set (option_, optval_);
} | 2 |
private void initier_table()
{
Vector<String> contraintes = new Vector();
for(int i=1;i<fields.size();i++)
contraintes.add(fields.get(i).getText().replaceAll(" ", ""));
jPanel2.removeAll();
tables = new Vector();
btn_tables = new Vector();
... | 9 |
public StochasticKMeansPredictor(List<Instance> instances) {
num_clusters = 3;
if (CommandLineUtilities.hasArg("num_clusters")) {
num_clusters = CommandLineUtilities.getOptionValueAsInt("num_clusters");
}
// init clusters
for (int i = 0 ; i < num_clusters ; i++) {
clusters.add(new Cluster(instance... | 3 |
public boolean isSelectedNumberCandidate(int x, int y) {
return game[y][x] == 0 && isPossibleX(game, y, selectedNumber)
&& isPossibleY(game, x, selectedNumber) && isPossibleBlock(game, x, y, selectedNumber);
} | 3 |
@Override
public void actionPerformed(GuiButton button)
{
if(button.id == 0)
{
GameStatistics.lives--;
MapGenerator gen = new MapGeneratorSimple();
Remote2D.guiList.pop();
Remote2D.guiList.push(new GuiLoadMap(gen, 40, 40, 1337));
} else if(button.id == 1)
{
while(!(Remote2D.guiList.peek() insta... | 3 |
public String readDword(Key key, String valueName) throws RegistryErrorException
{
if(key == null)
throw new NullPointerException("Registry key cannot be null");
if(valueName == null)
throw new NullPointerException("Valuename cannot be null, because the default value is always a STRING! If you wan... | 4 |
public double distanceFromLine(double testAngle)
{
if (leftDist <= 0 && rightDist <= 0) return 0;
double x1 = leftDist * Math.cos(leftAngle);
double y1 = leftDist * Math.sin(leftAngle);
double x2 = rightDist * Math.cos(rightAngle);
double y2 = right... | 3 |
Client() throws IOException {
String s;
System.out.println(getCurrentTime() + "::" +"Starting Client ..");
clientSocket = new Socket("localhost", 38000);
serverIn=new DataInputStream(clientSocket.getInputStream());
serverOut=new DataOutputStream(clientSocket.getOutputStream());
/*--------Reading file from T... | 3 |
private void bubbleUp(int pos) {
int last = heap[pos];
Integer parentPos = parent(pos);
if(parentPos != null) {
if(heap[parentPos] < last) {
swap(pos, parentPos);
bubbleUp(parentPos);
}
}
} | 2 |
public void zetJokerIn(Timer timer) throws LogicException {
int jokers = getMaxJokers(timer);
if (jokers <= 0) throw new LogicException("Jokers zijn op!");
jokersGebruikt++;
timer.addJoker();
} | 1 |
private void stepEntities(Graphics2D graphics) {
Iterator<Entity> it = entities.iterator();
while (it.hasNext()) {
Entity entity = it.next();
if (paused || quitRequested) {
entity.draw(graphics);
continue;
}
entity.step();
... | 8 |
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Effect other = (Effect) obj;
if (Float.floatToIntBits(effectDuration) != Float
.floatToIntBits(other.effectDuration))
return false;
if (... | 6 |
public Items getNext() {
return next;
} | 0 |
Node<Move, GS> selectChild() {
if (unexpanded() || terminated()) {
// Leaf node or node of a terminated state, nothing to select.
return null;
}
if (gameState.currentPlayer() == GameState.PLAYER_CHANCE_NODE) {
assert chanceNodeChildren != null;
return chanceNodeChildren.get();
} else {
if (visitC... | 9 |
private void fillLevel() {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
walkways[i][j] = false;
}
}
} | 2 |
@Test
public void TestSort() {
MyList<Integer> list = new MyList<Integer>();
list.add(5);
list.add(3);
list.add(8);
list.add(13);
list.add(8);
list.mergeSort();
Boolean res = (list.get(1) == 3 && list.get(2) == 5 && list.get(3) == 8 && list.get(4) == 8... | 4 |
public void modeAuto(Loan loan) {
if (user.isAllowedToBorrow(loan, this.getStockController())) {
if (CalendarController.checkCalendars(loan.getStart(),
loan.getEnd())) {
if (this.getStockController().isAvailable(loan)
&& CalendarControll... | 5 |
private static Outline createTestPanel(boolean wrapped) {
Outline outline = new Outline();
OutlineModel model = outline.getModel();
outline.setDynamicRowHeight(wrapped);
Column column = new Column(0, "Testy Goop", new TextCell(SwingConstants.LEFT, wrapped)); //$NON-NLS-1$
model.addColumn(column);
for (int i... | 2 |
public RangeType(ReferenceType bottomType, ReferenceType topType) {
super(TC_RANGE);
if (bottomType == tNull)
throw new alterrs.jode.AssertError("bottom is NULL");
this.bottomType = bottomType;
this.topType = topType;
} | 1 |
public int maximumGap_bucket(int[] num) {
if (num.length < 2) return 0;
int max = findMinMax(num, 1);
int min = findMinMax(num, -1);
int buckets = num.length - 1;
double step = (max - min + 0.0) / buckets;
// bucketize
Map<Integer, List<Integer>> bucketMinMax =... | 6 |
public Insanity[] check(CacheEntry... cacheEntries) {
if (null == cacheEntries || 0 == cacheEntries.length)
return new Insanity[0];
if (null != ramCalc) {
for (int i = 0; i < cacheEntries.length; i++) {
cacheEntries[i].estimateSize(ramCalc);
}
}
// the indirect mapping lets ... | 7 |
public final static String date(long millis) {
long secs = millis / 1000;
long mins = secs / 60;
long hours = mins / 60;
long days = hours / 24;
final long years = days / 365;
long year = 1970 + years;
days -= getDays(year);
if (days < 0) {
if (isLeap(--year)) {
days += 366;
} else {
days ... | 6 |
@Override
public void destroy() {
synchronized (this) {
doDestroy();
}
} | 0 |
public void paivita(Object uusi, int rivi, int sarake) {
Henkilo henkilo = henkilot.get(rivi);
if (sarake == 0) henkilo.setId(((Integer) uusi).intValue());
else if (sarake == 1) henkilo.setEtunimi((String) uusi);
else if (sarake == 2) henkilo.setSukunimi((String) uusi);
else if (... | 6 |
public Column getColumnWithID(int id) {
int count = getColumnCount();
for (int i = 0; i < count; i++) {
Column column = getColumnAtIndex(i);
if (column.getID() == id) {
return column;
}
}
return null;
} | 2 |
private String findChromosomeName( BPTreeNode thisNode, int chromID){
String chromKey = null; // mark unfound condition as an empty string
// search down the tree recursively starting with the root node
if(thisNode.isLeaf())
{
int nLeaves = thisNode.getItemCount();
... | 7 |
private void mergePhrasemes(List<Homonym> result, List<List<Phraseme>> phrasemes) {
for (Homonym homonym : result) {
//System.out.println(homonym.getOrig());
for (List<Phraseme> phs: phrasemes) {
if (phs != null) {
if (homonym.getOrig().equals(phs.get(... | 8 |
@Basic
@Column(name = "POP_TERMINAL")
public String getPopTerminal() {
return popTerminal;
} | 0 |
public static void listarVenta(HashMap<Integer, Ventas> tablaVentas)
{
int codigoCliente;
int codigoMusica;
int codigoVenta;
if (tablaVentas.isEmpty()) // No hay ventas en el sistema
{
System.out.println("No hay ventas en el registro.");
}
else
{
Set<Entry<Integer,Ventas>> s = tablaVentas.ent... | 2 |
public List<T> find(T start, T goal, StopDemander stop) {
Node<T> startNode = new Node<T>(start, null);
if (start.equals(goal)) {
return startNode.getPathElements();
}
List<Node<T>> queue = new LinkedList<Node<T>>();
Set<T> visited = new HashSet<T>();
queue.add(startNode);
visited.add(start);
whil... | 5 |
public boolean equals(Object object) {
Pair pair = (Pair) object;
return from.equals(pair.from) && to.equals(pair.to);
} | 1 |
public static String toProperCase(String s) {
if (s.isEmpty())
return "";
String[] unimportant = new String[] { "a", "an", "and", "but", "is",
"are", "for", "nor", "of", "or", "so", "the", "to", "yet" };
String[] split = s.split("\\s+");
String result = "";
for (int i = 0; i < split.length; i++) {
S... | 7 |
@Override
public void paintComponent(final Graphics g) {
// Check if we have a running game
super.paintComponent(g);
g.setColor(this.getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
if (this.model != null) {
// Draw all tiles by going over them x-wise and y-wise.
for (int i = 0; i < this.... | 3 |
private void initTools() {
JToolBar toolBar = new JToolBar();
toolBar.setFloatable(false);
toolBar.setPreferredSize(new Dimension(30, 28));
toolBar.add(new JLabel("Mode "));
final JComboBox<EditorMode> modeBox = new JComboBox<EditorMode>();
modeBox.addItem(EditorMode.GUI);
modeBox.addItem(EditorMode.NO... | 9 |
public static void addToTable(Item item,int quantity) throws NullPointerException {
if (item.getQuantity() >= quantity) {
total = (getTotal() + item.getPrice() * quantity);
item.changeQuantity(-quantity);
modifyItem(item);
int datalength = (tableData == null ? 0 : tableData.length);
Object[][] temp = new O... | 5 |
private static void secondStrategy()
{
Semaphore MReading = new Semaphore(1);
Semaphore MWriting = new Semaphore(1);
Semaphore MPrio = new Semaphore(1);
int counter = 0;
Random r = new Random();
while(true)
{
if(r.nextDouble() > 0.5)
new Lecteur(MReading,MWriting, counter).run();
else
n... | 2 |
private Iterable<Position<T>> positions() throws InvalidPositionException,
BoundaryViolationException, EmptyTreeException {
ArrayList<Position<T>> ps = new ArrayList<Position<T>>();
if (size != 0) {
preOrderPositions(root(), ps);
// inOrderPositions(root(), ps);
// postOrderPositions(root(), ps);
}
... | 1 |
public synchronized void samplesUpload(List<JSONObject> samples, String callBackUrl) {
try {
JSONObject data = new JSONObject();
data.put(Constants.SAMPLES, new JSONArray(samples));
getJson(Methods.POST, callBackUrl, data);
} catch (JSONException e) {
BmLo... | 1 |
public void removeEdge(Collection<Edge> e_list){
NodeFunction f;// = e.getSource();
NodeVariable x;// = e.getDest();
FunctionEvaluator fe;// = f.getFunction();
HashMap<NodeFunction, LinkedList<NodeVariable>> f_xs = new HashMap<NodeFunction, LinkedList<NodeVariable>>();
H... | 5 |
public void notifySpritePaletteChanged() {
if (paletteRegion != null) {
paletteRegion.resetPalette();
}
for (int i = 0; i < patternTableRegions.length; i++) {
if (patternTableRegions[i] != null) {
patternTableRegions[i].updatePatternTable();
}
... | 7 |
public static int loadShaderPair(String vertexShaderLocation, String fragmentShaderLocation) {
int shaderProgram = glCreateProgram();
int vertexShader = glCreateShader(GL_VERTEX_SHADER);
int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
StringBuilder vertexShaderSource = new StringBuilder();
StringBuil... | 6 |
public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int caso = 1;
for(String line; (line = in.readLine())!=null; caso++){
StringTokenizer st = new StringTokenizer(line);
N = Integer.parse... | 8 |
public CtrlComptesRendus getCtrlCR() {
return ctrlCR;
} | 0 |
@SuppressWarnings("unchecked")
private void mondayCheckActionPerformed(java.awt.event.ActionEvent evt) {
if(this.dayChecks[1].isSelected()) {
this.numSelected++;
if(this.firstSelection) {
stretch();
}
th... | 4 |
public static PrototypeManager getManager() {
if (pm == null) {
pm = new PrototypeManager();
}
return pm;
} | 1 |
public Method findMethod(String prefix, String methodName, Class<?> ... paramType) {
if(methodName == null || methodName.isEmpty())
return null;
methodName = createMethodName(prefix, methodName);
try {
return getInspectedClass().getDeclaredMethod(methodName, paramType);
} catch (SecurityException e) {
... | 5 |
public ChestKitsConfiguration(Configuration config, Logger log) {
kits = new HashMap<String, ChestKitsKit>();
List<String> listOfKits = config.getStringList("kits");
if (listOfKits != null) {
for (String kitName : listOfKits) {
log.info("Loading kit " + kitName);
List<?> items = config.getList("kitite... | 6 |
public Operation sendUnconnectedOperation(final Operation operation) throws ConnectionException, TimeoutException {
try {
if (OperationType.isADisconnectedOperation(operation.getOperationType())) {
createSocket();
MessageUtils.sendOperation(sock, operation);
int retry = 0;
Operation response;
s... | 9 |
public static Map<String, String> simpleCommandLineParser(String[] args) {
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i <= args.length; i++) {
String key = (i > 0 ? args[i-1] : null);
String value = (i < args.length ? args[i] : null);
if (key == null || key.starts... | 9 |
private void RemoveArestas() {
LinkedList<Aresta> arestasPesoMinimo = new LinkedList<Aresta>();
ArrayList<Aresta> arestasAGM = (ArrayList<Aresta>) grafoDePalavrasAGM.Arestas();
Aresta[] arestasGrafoAGM = new Aresta[arestasAGM.size()];
for (int i = 0; i < arestasGrafoAGM.length; i++)
arestasGrafoAGM[i] = ... | 9 |
@Override
public void addWord(String word) {
if (Math.random() <= Math.pow(2., -h)) {
MyString str = new MyString(word);
Integer i = sample.get(str);
if (i == null) sample.put(str, 1);
else sample.put(str, 1 + i.intValue());
sumK++;
}
if(sumK == Math.pow(2., b)){
h++;
Random... | 5 |
@org.junit.Test
public void multipleDragons() {
Logic game1 = new Logic(10, 1, 1);
char[][] maze=game1.getMaze();
int count=0;
for(int i=0; i<10; i++) {
for(int j=0; j<10; j++) {
if(maze[i][j]=='D')
count++;
}
}
assertSame(count, 1);
Logic game2 = new Logic(40, 2, 1);
maze=game2.getM... | 9 |
public Gap insertGapAt(int pos, int length, boolean exclusive)
throws BadBytecode
{
/**
* cursorPos indicates the next bytecode whichever exclusive is
* true or false.
*/
Gap gap = new Gap();
if (length <= 0) {
gap.position = pos;
ga... | 6 |
@Override
public void tableChanged(TableModelEvent arg0)
{
if(ignoreNext)
{
ignoreNext = false;
return;
}
//System.out.println(""+arg0.getColumn()+" "+arg0.getFirstRow()+" "+arg0.getLastRow()+" "+arg0.getType());
int col = arg0.getColumn();
int row = arg0.getFirstRow();
int regvalue = 0;
try
... | 7 |
public static void onIntentFinished(Activity sourceActivity, int requestCode, int resultCode, Intent data, String devPayload) {
InAppPurchaseExtension.logToAS("Intent finished");
sourceActivity.finish();
sourceActivity = null;
if(requestCode == BUY_REQUEST_CODE) {
if(resultCode == Activity.RESULT_CAN... | 7 |
public void put_branch(String roll, BasicDBObject document, DB_Init db_table,
ArrayList<String> branchArray, ArrayList<String> rollStartArray,
ArrayList<String> rollEndArray) {
String first_char = roll.substring(0, 1);
System.out.println("Outside branch insertion module ");
for (int i = 0; i < branchArray.s... | 5 |
public synchronized void waitForNextDealConfirmation() {
dealLatch = new CountDownLatch(1);
KeyEventDispatcher dispatcher = new KeyEventDispatcher() {
// Anonymous class invoked from EDT
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.... | 2 |
public String getLyrics(String artistName, String songName) throws UnexpectedDataException {
String lyrics = "";
// TODO: Sanitize string
try {
URI xmlURI = new URI("http", "lyrics.wikia.com", "/api.php",
"artist="+ artistName +"&song="+ songName +"&fmt=xml", null);
InputStream xmlStream = this.getIn... | 2 |
public void setPort(int port) {
clientPort = port;
} | 0 |
public static boolean deleteFolderContents(File folder) {
File[] files = folder.listFiles();
for (File file : files) {
if (file.isFile()) {
if (!file.delete()) {
return false;
}
} else {
if (!deleteFolder(file)) {
return false;
}
}
}
return true;
} | 4 |
public boolean equals(Object that) {
if (!(that instanceof MockMessage))
return false;
String thatMessage = ((MockMessage) that).getMessage();
if (this.message == null)
return thatMessage == null;
return (this.message == thatMessage)
|| this.message.equals(thatMessage);
} | 3 |
private boolean dadosValidos() {
return !StringHelper.estaNulaOuVazia(txtCnpj.getText())
&& !StringHelper.estaNulaOuVazia(txtEndereco.getText())
&& !StringHelper.estaNulaOuVazia(txtNomeresponsavel.getText())
&& !StringHelper.estaNulaOuVazia(txtRazaosocial.getText(... | 4 |
public Node getFirstNodeAtPosition(int x, int y) {
Enumeration<Node> nodeEnumer = Runtime.nodes.getSortedNodeEnumeration(false);
while(nodeEnumer.hasMoreElements()){
Node node = nodeEnumer.nextElement();
if(node.isInside(x, y, pt)) {
return node;
}
}
return null;
} | 2 |
public TrackedPeer(Torrent torrent, String ip, int port,
ByteBuffer peerId) {
super(ip, port, peerId);
this.torrent = torrent;
// Instanciated peers start in the UNKNOWN state.
this.state = PeerState.UNKNOWN;
this.lastAnnounce = null;
} | 0 |
boolean printHeaders(File targ, PrintStream ps) throws IOException {
boolean ret = false;
int rCode = 0;
if (!targ.exists() || targ.getName().indexOf("..")>0) {
rCode = HTTP_NOT_FOUND;
ps.print("HTTP/1.0 " + HTTP_NOT_FOUND + " Not Found");
ps.write(EOL);
... | 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 |
public void startGUI() {
/* 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 htt... | 6 |
public void checkCherries(ArrayList<EntityCherry> ch){
for(int i = 0; i < ch.size(); i++){
EntityCherry c = ch.get(i);
if(sliding){
if(
c.getx() > x &&
c.getx() < x + (cwidth / 2) &&
c.gety() > y - height / 2 &&
c.gety() < y + height / 2
){
c.hit(1);
}
}
if(int... | 7 |
public void run() {
String csvFile = "USData.csv";
BufferedReader br = null;
String line = "";
String cvsSplitBy = ",";
int count = 0;
try {
br = new BufferedReader(new FileReader(csvFile));
//reads file line by line
while ((line = br.readLine()) != nul... | 5 |
public List<String> calculateMotifEnumeration() {
List<String> kMers;
List<String> resultList = new ArrayList<String>();
kMers = getAllKMers();
for (String s : kMers) {
List<String> mismatchList = createMismatches(s);
for (String string : mismatchList) {
... | 5 |
private ArrayList<Integer> straightLinePostProcessing(ArrayList<Integer> corners, double[] distApart) {
ArrayList<Integer> filteredCorners = new ArrayList<Integer>(corners);
boolean allLines = false;
while (!allLines) {
allLines = true;
for (int i = 1; i < filteredCorn... | 8 |
public boolean setValue(String key, String value)
{
for(int i = 0; i < MAX_PROPS; i++)
{
if(keys_[i].equals(UNDEFINED))
{
keys_[i] = key;
values_[i] = value;
return true;
}
}
return false;
} | 2 |
private boolean jj_3_31() {
if (jj_3R_48()) return true;
return false;
} | 1 |
public static List<Pregunta> buscaTemaGlobal(int numPreguntas) {
/*
* Habría que hacer una consulta aleatoria que sólo devuelva n líneas
*/
List<Pregunta> c = null;
if (openConexion() != null) {
try {
String qry = "SELECT * FROM preguntas";
... | 5 |
private void kingLeftPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 1 && y1 >= 0) && (x1 < maxWidth && y1 < maxHeight))
{
if(board.getChessBoardSquare(x1-1, y1).getPiece().getPieceType() != board.getBlankPiece().getPieceType())... | 6 |
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 |
@Override
public String call() throws Exception {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < 10; i++) {
sb.append(para);
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return sb.toString();
} | 2 |
protected void handleCommand(Player sender, String[] names)
{
Zone zone = executor.plugin.getSelectedZone(sender);
if (zone == null)
{
sender.sendMessage("[InvisibleWalls] Please select an zone first. (Use: /iw select <zoneId>)");
return;
}
StringBuilder str = new StringBuilder();
for (String s : ... | 6 |
@Override
public int compareTo(VectorTimeStamp ts) {
boolean beforeFlag = false;
boolean afterFlag = false;
// For vector time stamp, we need to compare corresponding value one by one
for(Entry<String, AtomicInteger> e : localTS.entrySet()) {
int local = e.getValue().get... | 7 |
private synchronized void receiveAd(Sim_event ev)
{
if (super.reportWriter_ != null) {
super.write("receive router ad from, " +
GridSim.getEntityName(ev.get_src()) );
}
// what to do when an ad is received
FloodAdPack ad = (FloodAdPack)ev.get_... | 7 |
public List<Object> getContent() {
if (content == null) {
content = new ArrayList<Object>();
}
return this.content;
} | 1 |
private boolean conditionL0(String value, int index) {
if (index == value.length() - 3 &&
contains(value, index - 1, 4, "ILLO", "ILLA", "ALLE")) {
return true;
} else if ((contains(value, index - 1, 2, "AS", "OS") ||
contains(value, value.length() - 1, 1, "A... | 5 |
public void undo() {
if (prevSpeed == CeilingFan.HIGH) {
ceilingFan.high();
}
if (prevSpeed == CeilingFan.MEDIUM) {
ceilingFan.medium();
}
if (prevSpeed == CeilingFan.LOW) {
ceilingFan.low();
}
if (prevSpeed == CeilingFan.OFF) {... | 4 |
Subsets and Splits
SQL Console for giganticode/java-cmpx-v1
The query retrieves a limited number of text entries within a specific length range, providing basic filtering but minimal analytical insight.