method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8f6b35fe-e35d-41de-a444-6ad75442f42e | 7 | public static void TH() throws IOException{
int timeblock = 5;
BufferedReader r = new BufferedReader (new InputStreamReader(System.in));
while (timeblock > 0){
System.out.println("What would you like to do right now?");
if (timeblock > 3)
{
System.out.println("1. Go to class (not likely)");
... |
0882bfee-fff5-4bbb-b0df-c9b38d1909f7 | 9 | public static CypherType arrayToType(double[] array)
{
CypherType type = null;
if (array[0] == 1 && array[1] == 0 && array[2] == 0)
type = CypherType.PLAIN_TEXT;
else if (array[0] == 0 && array[1] == 1 && array[2] == 0)
type = CypherType.MONO_ALPHABETIC;
else if (array[0] == 0 && array[1] == 0 && array... |
7ea3b35f-fa25-4cb7-a14c-8fd91ebdd9e5 | 5 | public static List<Player> getOnlinePlayers() {
List<Player> onlinePlayers = new ArrayList<Player>();
try {
Method onlinePlayersMethod = Bukkit.class.getMethod("getOnlinePlayers");
if (onlinePlayersMethod.getReturnType().equals(Collection.class)) {
Collection<Play... |
0f0aa129-7688-4ad9-92d8-f04cec4b3640 | 2 | @Override
public int getIndex(String name) {
for (int i=0;i<=attsList.size();i++)
if (name.equalsIgnoreCase(attsList.get(i).getName())) return i;
return -1;
} |
65c9b0d7-20bc-458e-9d02-7f4d67606b1b | 4 | @Override
public <T extends AggregateRoot<?>> T loadOneBy(final Class<T> aggregateRoot, final Specification<T> specification) {
@SuppressWarnings("unchecked")
final DomainRepositoryDriver<T, ?> driver = (DomainRepositoryDriver<T, ?>) drivers.get(aggregateRoot);
if (driver =... |
ff75674b-2d0e-4e17-b10f-fa3c0b771256 | 9 | public ArrayList<Integer> postorderTraversal(TreeNode root) {
// Start typing your Java solution below
// DO NOT write main() function
ArrayList<Integer> res = new ArrayList<Integer>();
if (root == null)
return res;
Stack<TreeNode> path = new Stack<TreeNode>();
TreeNode prev = null, cur;
path.push(roo... |
cc0d2809-45b5-487e-bb28-1d8617ec63d0 | 0 | public Dimension getCurrentAvailableSpace() {
return new Dimension(getParent().getWidth(), getParent().getHeight());
} |
8de06340-0d18-4631-9a22-cd0c97423be4 | 4 | @Override
protected void leave() {
// Find north most door
final GameObject door = ctx.objects.select().select(ObjectDefinition.name(ctx, "Door")).within(15).sort(new Comparator<GameObject>() {
@Override
public int compare(GameObject o1, GameObject o2) {
return Integer.valueOf(o2.tile().y()).compareTo(o1... |
711d1c6b-d9a5-4db7-a2e6-658071ebf3a3 | 1 | public static void printDocument(Document doc) {
OutputFormat format = OutputFormat.createPrettyPrint();
try {
XMLWriter writer = new XMLWriter(System.out, format);
writer.write(doc);
} catch (Exception e) {
System.err.println("Error while trying to print: " + e.getMessage());
e.printStackTrace();
}... |
ab1b9ac1-db1b-449f-b644-e7e8c4ff903d | 4 | public void saveHistogram(String path) {
try {
if(path == null)
path = "histogram.csv";
File file = new File("histogram.csv");
file.createNewFile();
FileWriter fileW = new FileWriter(file);
BufferedWriter buffW = new BufferedWriter(fileW);
buffW.write("Grayscale");
for(int i = 0; i < histogra... |
51db5433-9a34-4a9d-bd44-42bfe1c9be19 | 9 | public static void CheckServerMessages(String message){
newestreply = OtherStuff.LatestServerReply();
if(newestreply.startsWith("YouGotkickednr")){
OtherStuff.CloseAllWindows();
JOptionPane.showMessageDialog(null, "Kicked by Server");
System.exit(0);
}
else if(message.startsWith("YouGotkicked")){
... |
936b0581-0e73-428c-a6d0-142b56c56567 | 0 | public AppTest(String testName) {
super(testName);
} |
bceea19e-44a6-4e2d-96a5-32cbd71721fe | 8 | protected boolean processOtherEvent(Sim_event ev)
{
boolean result = true;
switch ( ev.get_tag() )
{
//-----------REPLICA MANAGER REQUESTS--------
case DataGridTags.CTLG_ADD_MASTER:
processAddMaster(ev);
break;
case DataGri... |
1155f916-a9d1-45ea-96b9-65fd7bae42d8 | 3 | public int getLowestY()
{
int y = a[1];
if(b[1] < y)
{
y = b[1];
}
if(c[1] < y)
{
y = c[1];
}
if(d[1] < y)
{
y = d[1];
}
return(y);
} |
29782cf6-1aff-49ad-90d6-98ad74385a9f | 5 | public void run() {
if (ItemCount > 0) {
for (int i = 0; i < ItemCount; i++) {
try {
stack.push(temp.get(i));
} catch (InterruptedException ex) {
Logger.getLogger(TestingThread.class.getName()).log(Level.SEVERE, null, ex);
... |
9c9ab1a9-6431-4f10-b647-0f39aa7382c4 | 1 | public void feedFood(int index)
{
FoodObject food = Food.getFood(index);
if (!canAfford(food.getPrice()))
return;
hunger += food.getAmount();
// money -= food.getMoney();
// "Purchased" + food.getName();
// TODO Add Food on the screen.
// TODO adding hunger is placeholder
} |
77c94dbc-7f02-4ead-86ea-2e1bcaabef34 | 2 | public int getInt(String key, int def) {
if(fconfig.contains(key)) {
return fconfig.getInt(key);
}
else {
fconfig.set(key, def);
try { fconfig.save(path); } catch (IOException e) { e.printStackTrace(); }
return def;
}
} |
70f3e95f-c7c6-4594-9972-ff10cca15866 | 7 | private boolean searchUpForNextSubsetNode( Node node, K key, Object[] ret ) {
if( node.mRight != null && mComp.compareMinToMax( node.mKey, key ) < 0 &&
mComp.compareMinToMax( key, node.mRight.mMaxStop.mKey ) < 0 )
{
// Request downard search on right subtree.
ret[0] ... |
b1c14ea1-d5ff-4e10-a78f-c4bcbfc82c7e | 2 | @Override
public void onDisable()
{
saveConfig();
if (thread != null && thread.isRunning())
{
//Disable thread
thread.setRunning(false);
}
else
{
}
} |
b6722369-978d-401b-995d-02e95ef122f7 | 5 | public static void main(String[] args) throws IOException {
AuthenticationServer server = null;
try {
Options options = new Options();
options.addOption("sp", true, "security package");
options.addOption("p", true, "server port");
options.addOption("h", f... |
e9a6eea7-7877-4ffe-8ae1-3a7d82284267 | 9 | private int findDirectionOfSquare(int x, int y, int[][] path) { // grid system
int sq2 = path[x][y] + 1;
try {
if (y > 0) if (sq2 == path[x][y - 1]) return NORTH;
if (x < getColumns() - 1) if (sq2 == path[x + 1][y]) return EAST;
if (y < getRows() - 1) if (sq2 == path[x][y + 1]) return SOUTH;
if (x > 0) ... |
99d0486f-8ff4-424d-a62a-c5351ec111ba | 6 | public void multiSpellEffectNPC(int npcId, int damage) {
switch(c.MAGIC_SPELLS[c.oldSpellId][0]) {
case 12919: // blood spells
case 12929:
int heal = (int)(damage / 4);
if(c.constitution + heal >= c.maxConstitution)
c.constitution = c.maxConstitution;
else
c.constitution += heal;
... |
83633602-7bd1-4501-8d43-91fe663eac33 | 3 | public synchronized void stop() {
if (thread == null) {
return;
}
running = false;
if (server != null) {
try {
server.close();
} catch (Exception e) { }
}
thread = null;
} |
fc9e0e3d-6225-43dc-9cf7-e0cd07215541 | 0 | @Override
public boolean supportsEditability() {return true;} |
c9349e61-cb75-4e37-8329-cd73a76c05b8 | 2 | public static boolean howHardCanItBe(){
for (final String word : words) {
if( wordValidator.wordContainsLettersInOrder(letGen, word) ) {
return true;
}
}
return false;
} |
381b3c15-524b-4857-a832-3953325cd14e | 1 | public void processRequest(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
FrontCommand command;
try {
command = getCommand(req);
command.init(getServletContext(), req, res);
command.process();
} catch (Exce... |
fd504161-8727-4cd2-961c-2fe5716dd007 | 9 | private static char ConvertToChar(int num)
{
char letter = '0';
switch(num)
{
case 1:
letter = '1';
break;
case 2:
letter = '2';
break;
case 3:
letter = '3';
break;
case 4:
letter = '4';
break;
case 5:
letter = '5';
break;
case 6:
letter = '6';
... |
965f6d18-84e8-40af-b5a8-bf4cb448bfaf | 1 | public boolean changeUserName(String oldName, String newName){
if (users.get(newName.toLowerCase())!=null) return false;
UserAccount account = users.remove(oldName.toLowerCase());
account.setName(newName);
users.put(newName.toLowerCase(), account);
return true;
} |
52d4245f-6469-486e-bfcb-c397c04bb688 | 4 | public void upload(UploadedFile uploadedFile, String fileName) throws IOException, NotCreatedDirException {
InputStream inputStream = null;
OutputStream outputStream = null;
try {
// save file on disk
inputStream = uploadedFile.getInputStream();
File newFile = new File(path + "poms/" + fileName + ".xml"... |
77a6c2ce-1622-4d6e-b132-7e2f90a2737b | 6 | public void keyTyped(KeyEvent e) {
if(open) {
switch(e.getKeyCode()) {
case KeyEvent.VK_ESCAPE:
case KeyEvent.VK_ENTER:
break;
case KeyEvent.VK_BACK_SPACE:
if(typing.length() > 0)
typing = typing.substring(0, typing.length()-1);
break;
default:
if(typing.length() < MAX_INPUT_LENGTH... |
2def5cc2-608a-4452-8419-9f602bdb5d9c | 7 | public void deleteComponent(Component com) {
if(com == null) {
return;
}
((ContactItem)com).deleteContactItem();
Component cm = hd;
while(cm != null) {
if(cm == com) {
if(com == hd) {
hd = hd.n... |
e9ac477b-a418-4d42-9eb4-ff1e41f5e4ef | 9 | private void processResp(OMMItemEvent event)
{
OMMMsg msg = event.getMsg();
Token token = (Token)event.getClosure();
// we need to set dictionary in case we reencode FieldList
Handle handle = (Handle)_reqMap.get(token);
// this can happen, when the dictionary stream is clos... |
1e439fcf-6237-4add-90e2-64f75061064d | 3 | private int[] getAround(int[][] temp, int x, int y) {
int[] around = new int[9];
int i = 0;
for(int xLoop = x-1; xLoop <= x+1; xLoop++) {
for(int yLoop = y-1; yLoop <= y+1; yLoop++) {
around[i] = validPosition(temp, xLoop, yLoop) ? temp[xLoop][yLoop] : USED;
i++;
}
}
return around;
} |
36057014-7542-4a5c-8590-c82baba2ff8a | 1 | @Test
public void testSecondUp()
{
Model model = new Model();
Time realTime, expectedTime;
realTime = new Time(0,1,53);
expectedTime = new Time(0,2,3);
model.setTime(realTime);
for (int i=0;i<10;i++)
{
model.secondUp();
... |
77b9208e-cf37-4eac-8bcc-e6d5eff4fa5b | 9 | public String toString() {
StringBuilderOutputSource sb = new StringBuilderOutputSource(new StringBuilder());
for (int i = 0; i < path.length; i+=2) {
Object key = path[i];
if (key == null) {
sb.append("[null]");
} else if (key instanceof Number) {
sb.append('[');
sb.append(key.toString... |
d36883fa-22cc-40c1-bed3-4571254d3923 | 5 | private void putRequest(HttpExchange he) throws IOException {
try {
InputStreamReader isr = new InputStreamReader(he.getRequestBody(), "UTF-8");
BufferedReader br = new BufferedReader(isr);
String jsonInput = br.readLine();
long roleId = parseRoleId(jsonInput);
... |
bdd6aa62-5a9b-49a8-bebe-2f02a5f0d329 | 2 | public void setModel(PlotModel model) {
surfacePanel.setModel(model.getModel());
setLayout(new BorderLayout());
task = model.getModel().plot();
surfacePanel.setBackground(Color.white);
surfacePanel.setConfigurationVisible(true);
add(surfacePanel, BorderLayout.CENTER);
... |
3df09aa8-cd2f-490c-b3cc-94a78685103d | 5 | @Override
public void run() {
try {
serversocket = new ServerSocket(port);
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, "Failed to run serversocket.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
while (breakflag == false) {
try {
client = serversocket.accept();
Bu... |
6002a9bd-c38a-4987-8cff-3bf16b55bc6e | 0 | public String getSno() {
return this.sno;
} |
b18ea7b0-0fb8-4b2c-b78a-4322f184ae50 | 8 | public Humain rencontre(Humain h) {
Humain b;
loterie = new Random();
if (h instanceof Homme)
return null;
if (h.age > 15 && h.age < 50 && age > 15) {
if (poids > 150 || h.poids > 150) {
return null;
} else {
int f = loterie.nextInt(100);
if (f > ((Femme) h).getFertilite())
return null... |
dbf0c133-4f3a-4d37-a335-f01513212044 | 5 | public static Iterable<Direction> solve(State state)
{
State boxToGoal;
int px = state.player.x;
int py = state.player.y;
ArrayList<Position> possiblePlayerPositions = possibleStartPositions(state);
for (Position player : possiblePlayerPositions)
{
boxToG... |
7cedb517-10ec-43ae-a329-9ffb1f6e7647 | 6 | public boolean isFinished() {
boolean retBoo = false;
for (int i = 0; i < 6; i++) {
if (board.get(i) > 0)
break;
else if (i == 5)
retBoo = true;
}
for (int x = 7; x < 13; x++) {
if (board.get(x) > 0)
break;
else if (x == 12)
retBoo = true;
}
return retBoo;
} |
e90e53c1-3d9e-49c7-9d68-96a354639fc1 | 9 | @Override public void paintComponent(Graphics g2) {
Graphics2D g = (Graphics2D) g2; // Create Graphics Object
super.paintComponent(g); // Paint Background
// Get the size of the x path vectors
int size_of_xpath = xPath.size();
// Create array of integers
int[] xPoints = new i... |
ae8d2a88-ba92-470b-8291-dac1e13fad16 | 0 | public boolean isProgressive()
{
return progressive;
} |
179f9f84-3712-48ba-8751-31d57aacea31 | 7 | private String startSetToString() {
StringBuffer FString = new StringBuffer();
boolean didPrint;
if (m_starting == null) {
return getStartSet();
}
for (int i = 0; i < m_starting.length; i++) {
didPrint = false;
if ((m_hasClass == false) ||
(m_hasClass == tru... |
7765354f-78ce-4bd9-add1-f4c8a10a1847 | 0 | public String getToolTip() {
return "Transition Creator";
} |
5802b96c-c7fe-4b0c-8a9e-9b4d380339c3 | 4 | public List<TestResultData> process() {
List<TestResultData> testResults = new ArrayList<TestResultData>();
try {
TestNgResultParser resultParser = new TestNgResultParser(resultFile);
Map<String, String> testResultMap = resultParser.getTestResultMap();
Iterator<Entry... |
7e90769e-e704-4ced-9f84-0caa1971c583 | 8 | private void drawDebug() {
debugRenderer.begin(ShapeType.Line);
for (MapLayer ml : world.getMap().getLayers()) {
for (Tile t : ml.getTiles()) {
debugRenderer.setColor(Color.WHITE);
float startX = t.getPosition().x * ppuX, startY = t
.getPosition().y * ppuY;
debugRenderer.rect(startX, startY, pp... |
b22ab1c2-46cd-4529-a08c-729799552449 | 3 | @Test
public void enqueuesAtTheEnd()
{
for (int i = 0; i < 3; i++) queue.dequeue();
queue.enqueue("nice shoes");
assertTrue(queue.dequeue().equals("tommytoes") &&
queue.dequeue().equals("nice shoes") &&
queue.dequeue() == null);
} |
0d6b9557-db93-4875-a98b-c47b4aab153b | 4 | public void fire(char tankDirection,int bulletx,int bullety){
x=bulletx;
y=bullety;
if(tankDirection=='u'){setXSpeed(0);setYSpeed(-16);}
if(tankDirection=='d'){setXSpeed(0);setYSpeed(16);}
if(tankDirection=='r'){setXSpeed(16);setYSpeed(0);}
if(tankDirection=='l'){setXSpeed(-16);setYSpeed(0);}
isF... |
96d92c1c-57df-4ba2-a177-125a74142b79 | 1 | @Override
public void mouseExited(MouseEvent event) {
//When hovering off the board, only display data for the selected tile.
if (event.getSource() instanceof Tile) {
Tile selectedTile = match.getSelectedTile();
match.getPanel().setTile(null, selectedTile, null, match.getTileOwner(selectedTile), true);
}
... |
5a1cda2c-7c3c-4ac7-983c-0ab68c93329b | 7 | private Object instantiate(Class<?> clazz) {
try {
Object instance = clazz.newInstance();
for (ExtendedField field : DaoUtils.getAllFieldsWithSuperclasses(clazz)) {
if (field.hasEntityMapping() && field.isCascadingLoad()) {
switch (field.getEntityM... |
63d40aa7-56e8-4c6d-8d87-7639d4d0c0c9 | 4 | public Connector read(int bytes, Consumer<byte[]> consumer) {
updateActionIfNotNull();
byte[] data = new byte[bytes];
if (in != null) {
try {
int r = -1;
synchronized (in) {
r = in.read(data);
}
if (r != -1) {
if (r < bytes) {
byte[] n = new byte[r];
System.arraycopy(data,... |
4a961ea1-34fe-4a56-9905-37cf4490373a | 8 | @Test
public void combine() {
SimpleMatrix A = new SimpleMatrix(6,4);
SimpleMatrix B = SimpleMatrix.random(3,4, 0, 1, rand);
SimpleMatrix C = A.combine(2,2,B);
assertEquals(6,C.numRows());
assertEquals(6,C.numCols());
for( int i = 0; i < 6; i++ ) {
for(... |
0a30a346-d34e-45a6-97aa-a716efe60358 | 9 | public boolean expandAtdl4jWidgetParentStrategyPanel( Atdl4jWidget<?> aWidget )
{
boolean tempAdjustedFlag = false;
if ( ( aWidget.getParent() != null ) && ( aWidget.getParent() instanceof Composite ) )
{
Composite tempParent = (Composite) aWidget.getParent();
while ( tempParent != null )
{
// ... |
87f88f3f-a3f7-43f7-8b26-b8fd425c7d2e | 9 | @Override
public AnnotationVisitor visitInsnAnnotation(final int typeRef,
final TypePath typePath, final String desc, final boolean visible) {
checkStartCode();
checkEndCode();
int sort = typeRef >>> 24;
if (sort != TypeReference.INSTANCEOF && sort != TypeReference.NEW
... |
b19a035f-1b80-41a1-915a-341603223160 | 5 | @Override
public void putAll(Map<? extends K, ? extends V> m) {
for (Entry<? extends K,? extends V> p : m.entrySet())
this.put(p.getKey(),p.getValue());
} |
d73ad882-13a3-4448-a8fc-9977e576dd82 | 8 | public boolean realizarTransacoesPossiveis() {
for (int indiceCompra = 0; indiceCompra < compras.getTamanhoLista(); indiceCompra++) {
for (int indiceVenda = 0; indiceVenda < vendas.getTamanhoLista(); indiceVenda++) {
Interesse compra = compras.getInteresse(indiceCompra);
... |
2c619e7a-4396-4793-a6f5-250bc87364b6 | 2 | public static OpCode parseOpCode(String op, boolean throwError) throws AssemblyException {
OpCode code = OpCode.parseOpCode(op);
if (code == null && throwError)
throw new AssemblyException(op + " is not a valid op code!");
return code;
} |
5d6c42b9-1e0e-423b-876d-a6dfa748c458 | 3 | public void run() {
try {
correct = check();
} catch (ModelingException e) {
e.printStackTrace();
}
if(correct) {
try {
simulate();
} catch (IOException e) {
e.printStackTrace();
}
}
} |
d4737413-8775-47f6-bc64-a739748b72dd | 1 | private void setLogger(ILogger logger) {
if (logger == null) {
throw new IllegalArgumentException("aLogger is null");
}
this.logger = logger;
} |
fe9b3fde-0cc7-47f3-8ca6-bfe659aad1f2 | 9 | private void copyValue(Value val) {
descriptor_ = new ValueDescriptor(val.getDescriptor());
Object obj = val.getData();
switch (getType()) {
case FLOAT:
data_ = new Float((Float) obj);
break;
case DOUBLE:
data_ = new Double((Double) obj);
break;
case INTEGER:
data_ = new Integer((Integer) obj... |
caa12338-7fa7-4b59-8012-99c545c66917 | 6 | public static Object getProperty(Object obj, String propertyName)
{
if (obj == null)
return null;
try
{
BeanInfo info = Introspector.getBeanInfo(obj.getClass());
PropertyDescriptor[] descriptors = info.getPropertyDescriptors();
for (int i = 0; ... |
9d850ca7-3f75-4056-a597-b49c1870e098 | 3 | private static void writeProperties(Properties props, XMLWriter w) throws
IOException
{
if (!props.isEmpty()) {
final SortedSet<Object> propertyKeys = new TreeSet<Object>();
propertyKeys.addAll(props.keySet());
w.startElement("properties");
for (Ob... |
4994f29f-6e08-43bc-96ff-966c471c09e4 | 7 | private void getAllActors(){
Document doc = getXmlFile();
NodeList nList = doc.getElementsByTagName("Actor");
if(debugConsole){
System.out.println("Actors in XML-File");
System.out.println("-------------------");
System.out.println("");
System.out.println("Number : "+nList.getLength());
}
Sys... |
ec108b71-72d1-4851-a2b1-3c18b582b724 | 7 | private static String createRealUser(String string) {
Connection conn = ConnectionFactory.getConnection();
PreparedStatement pst = null;
ResultSet rs = null;
User user = JsonUtils.getUserByJson(string);
String sql = null;
int i = 0;// 判断是否创建了用户信息
// 判断是否输入了info
String infoString = ",u_info";
Str... |
1e89788f-5df1-4d81-a846-db855c73665d | 7 | public String decode(String codeWord) {
if (codeWord != null) {
decode = new StringBuilder();
StringBuilder sum = new StringBuilder();
String c;
char l;
int count = 0;
for (int i = 0; i < codeWord.length()-1; i++) {
switch (... |
278a4b80-08ef-4ef7-a29e-e784a9e1584f | 5 | private Expression primary() {
Expression e = null;
// variable or function call
if (currentToken.type() == Token.Type.Identifier) {
Variable v = new Variable(currentToken.value());
match(Token.Type.Identifier);
// function call
if(currentToken.type() == Token.Type.LeftParen)
e = callStatem... |
866ca8fc-600b-4229-afa0-6f1bca3acc35 | 6 | 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... |
a3fffe73-aa98-4eb4-bd29-c30b3185a341 | 9 | private void setLookAndFeel(final String laf) {
try {
final int lafNum = Integer.parseInt(laf);
switch(lafNum){
default:
case -2: //Nimbus
boolean isLAFFound = false;
for (javax.swing.UIManager.LookAndFeelInfo info : ja... |
246e4360-dc80-4263-94fa-15d6864a3480 | 8 | private void jButtonGuardarNovaEntradaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarNovaEntradaActionPerformed
// BOTAO GUARDAR -> JANELA ENTRADAS
//FAZER AS VALIDAÇÕES, SE OS CAMPOS ESTAO TODOS PREENCHIDOS
String nomeFuncionarioResponsavelEntrada = jC... |
850c9d2e-09d9-4f63-a124-3e7ac25d200e | 2 | public static boolean userExist(String email){
SQLiteJDBC db = new SQLiteJDBC();
String sql = String.format("SELECT user_id FROM users WHERE email='%s'", email);
ResultSet resultSet = db.query(sql);
try {
if(resultSet.next())
return true;
... |
4ffa3315-05bc-4c93-b443-db4efaddc331 | 2 | private void buttonSendInfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSendInfoActionPerformed
//Создаем нового клиента по заполненным полям
Client client = new Client();
try {
client.setFio(textFieldFio.getText());
client.setAddress(textField... |
81497bce-02e2-4a88-9334-38e5d409af49 | 7 | private void setMenu() {
boolean isNumeric;
boolean hasColumns;
boolean hasRows;
boolean attSelected;
ArffSortedTableModel model;
boolean isNull;
model = (ArffSortedTableModel) m_TableArff.getModel();
isNull = (model.getInstances() == null);
hasColumns = !i... |
f6515e7d-170c-4525-b053-c64a67ea0052 | 6 | public static LinkedListNode unionLL(LinkedListNode head1,
LinkedListNode head2)
{
if (head1 == null || head2 == null)
{
return null;
}
LinkedListNode result = null;
LinkedListNode temp = head1;
LinkedListNode temp2 = head2;
... |
66f2bdbc-616c-4a1b-b1d4-04f765b57573 | 0 | public Transition(Integer n, Character c, Integer lc, Integer rc){
node = n;
character = c;
leftChildren = lc;
rightChildren = rc;
} |
a375bc1c-d86f-4f13-91c6-21e374243bfa | 9 | protected Proxy getNextProxy() {
if (this.proxies.isEmpty()) {
System.out.println(">>> GET NEW PROXIES: ");
try {
if (useLocalProxyFile) { // Local Proxy List
if (proxyFile == null)
return null;
File in = new File(proxyFile);
if (!in.isFile())
throw new IllegalArgumentExc... |
402af9ec-2136-471d-8eea-ef28bfbe982d | 7 | public mst(Graph G) {
graphSize = G.getSize();
mst1 = new Graph(graphSize); //size of graph initialized to number of Vertices
parent = new int[graphSize]; //stores the parent values corresponding to every vertice. Used to decide whic edges lie in the graph
key = new int[graphSize]; //stores t... |
9b9df9a4-32a3-4a9b-9149-f7ef7ce76fc1 | 7 | public void descend(){
eraseCenter();
for(int col = 0; col < board.getWidth(); col++){
int[] values = new int[board.getLength()];
for(int i = 0; i < values.length; i++){
values[i] = -2;
}
for(int row = board.getLength()-1; row >= 0;row--){
if(board.getValue(row, col) != -2){
if(board.isVa... |
318e593a-3cd5-4a28-885a-2712fe65a040 | 6 | @Override
public void hyperlinkUpdate(HyperlinkEvent event) {
if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
try {
String url = event.getDescription();
if (url != null) {
if (url.indexOf("jfchat;jsessionid=") != -1) {
if (url.indexOf("say=") !... |
f6d93cf5-7bc6-4e36-ae54-287099d531cb | 2 | public static SwingAppenderUI getInstance() {
if (instance == null) {
synchronized(SwingAppenderUI.class) {
if(instance == null) {
instance = new SwingAppenderUI();
}
}
}
return instance;
} |
5f5dc039-8183-4483-b776-8ac893fe9ce6 | 7 | public static void main(String[] args) {
// TODO code application logic here
ArchivoDeTexto nuevo = new ArchivoDeTexto();
int[] lista = new int[2000];
lista = nuevo.lectura();
String menu = "1. Mostrar arreglo inicial\n2. Ordenar por BubbleSort\n3. Ordena... |
09ef6941-1f4f-4579-aff2-578b34206e3a | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Period other = (Period) obj;
if (cost != other.cost)
return false;
if (date_hour == null) {
if (other.date_hour != null)
return false... |
89b7c616-2be6-46da-95d1-b6bfdccd5c52 | 3 | @Override
public void mouseDragged(MouseEvent e) {
float y = e.getY();
if(scrolling) {
scrollPerc = (y - startScrolling)/this.height + startScrollingPerc;
scroll = (int) (scrollPerc * totalHeight);
if(scrollPerc < 0)
scrollPerc = scroll = 0;
else
if(scroll > totalHeight - this.height) {
... |
3319f496-4a90-40f1-85e1-f781c7f6943d | 3 | public void draw(Graphics2D g){
switch(size){
case 0:
g.setColor(new Color(0xFF4545));
break;
case 1:
g.setColor(new Color(0xaa5555));
break;
case 2:
g.setColor(Color.red);
break;
default:
g.setColor(Color.yellow);
break;
}
int[] px = {x , x + width, x + width };
int[] py = {y ... |
26872b86-fc2f-4e10-98d8-5e04265a52f5 | 4 | private static Class findUnderlyingClass(Type t)
{
if (t instanceof Class) {
return (Class) t;
}
else if (t instanceof ParameterizedType) {
ParameterizedType paramType = (ParameterizedType) t;
return findUnderlyingClass(paramType.getRawType());
}
... |
b8366e22-26a7-464f-8a21-7b6e5d68dc4f | 5 | public static boolean estDate(String source){
if(source.length() != 10){
return false ;
}
else {
try {
int jour = Integer.parseInt(source.substring(0,2)) ;
int mois = Integer.parseInt(source.substring(3,5)) - 1 ;
int annee = Integer.parseInt(source.substring(6)) ;
if(jour >= 1 && mois >= 0 &... |
26f16d0c-406d-4fe9-b888-3898ec1c9fdd | 8 | @Override
public List<SpaceObject> getSpaceObjectsWithin(final SpaceObject ofObj, long minDistance, long maxDistance)
{
final List<SpaceObject> within=new ArrayList<SpaceObject>(1);
if(ofObj==null)
return within;
synchronized(space)
{
space.query(within, new BoundedObject.BoundedCube(ofObj.coordinates()... |
1f2dafca-f3ed-4594-8eb7-eff577a5266c | 0 | public void setEncryptionMethod(EncryptionMethodType value) {
this.encryptionMethod = value;
} |
8e9b5aac-c5d2-4b98-83d5-f7c743f5a6b7 | 4 | public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, UnknownHostException {
tempRxList = new ArrayList<Medicine>();
Date EditDate = new Date();
ArrayList<String> tempPrescriptionID;
// Prepare Morphia Framework
Mongo mongo = new Mongo("localhost... |
88548930-9ac3-446c-846b-fc0a9b491c15 | 7 | @Override
public TypeInfo TypeCheck(CompilationContext cont) throws Exception {
TypeInfo eval_leftTypeInfo = leftExpr.TypeCheck(cont);
TypeInfo eval_rightTypeInfo = rightExpr.TypeCheck(cont);
if (eval_leftTypeInfo != eval_rightTypeInfo) {
throw new Exception("Wrong Type in expre... |
b34d1e23-1301-48c8-8774-306d60cd000c | 8 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()==btnSauvegarder){
JFileChooser fileChooser = new JFileChooser();
fileChooser.setDialogTitle("Specify a file to save");
int userSelection = fileChooser.showSaveDialog(this);
if (userSelection == JFileChooser.APPROVE_OPTIO... |
9accffed-f179-414e-8a1f-67df47f99586 | 0 | public String getUserId() {
return userId;
} |
7d063e6b-d1cf-4418-ac0b-a8cd2a2c1ff7 | 3 | public void start() {
activeScreen = new CreateScreen(this);;
while (true) {
Draw();
if (gotchi != null) {
gotchi.Update();
}
try {
Thread.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
} |
cae56348-2508-4df9-9ff0-dd7f604a9303 | 6 | @Override
public Hashtable<String, LinkedList<Triple<String, String, String>>> relations_extraction() throws IOException{
// Start by building dictionaries
build_dicos();
// st is the next sentence tree to be built
Tuple<Sentence_tree,String> st = build_next_sentence_tree();
if(st == null){
st = bui... |
d81706d2-c2d0-4fab-a812-680fa27e7e58 | 5 | private Map<Integer, Integer> buildLoopIndex(List<Token> tokens) {
Map<Integer, Integer> loopIndex = new HashMap<>();
Stack<Integer> startIndices = new Stack<>();
for (int i = 0; i < tokens.size(); i++) {
switch (tokens.get(i).getType()) {
case LOOP_START:
... |
e771be98-4d04-4fca-bc9f-c4847ee15400 | 5 | @Test
public void testServerSetQueueTimeoutErrorIndividualInvalidEx() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerSetQueueTimeoutErrorIndividualInvalidEx -----");
boolean exception_other = false;
String client_hash = "";
try {
server2.setUseMessageQueues(true)... |
e1404e6c-4783-4974-bec6-271a321675a6 | 1 | public void visitExpr(final Expr expr) {
if (checkValueNumbers) {
Assert.isTrue(expr.valueNumber() != -1, expr
+ ".valueNumber() = -1");
}
visitNode(expr);
} |
6db677c6-277a-4522-bec1-3b004932e85f | 2 | public void processInput(Deque<KeyEvent> events) {
int eventNumber = events.size();
for (int i = 0; i < eventNumber; i++) {
KeyEvent event = events.pollFirst();
Point direction = keyMapping.get(event.getKeyCode());
if (direction != null) {
schlange.setDirection(direction);
}
}
} |
70bfbb42-5bb8-4fc3-9133-0d9d6f7b3970 | 9 | private boolean r_verb_suffix() {
int among_var;
int v_1;
int v_2;
int v_3;
// setlimit, line 174
v_1 = limit - cursor;
// tomark, line 174
if (cursor < I_pV)
{
return false;
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.