method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0bf035f0-9ee9-4183-b3b6-51bd2a626ab2 | 9 | private static void createConfigs()
{
for(int z = 0; z < fileList.size(); z++)
{
String filePath = CONFIG_FOLDER + fileList.get(z);
File conf = new File(filePath);
if(!conf.exists())
{
try
{
String[] folders = filePath.split("/");
for(int i = 0; i < folders.length - 1; i++)
{
... |
f667330b-e2e4-41fe-aea4-002a17875550 | 4 | public static void UpperPlaceOfPublication(){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedSt... |
9261a462-e66f-438e-8efc-4276e72747b8 | 7 | public String simplifyPath(String path) {
String[] paths = path.split("/+");
Deque<String> deque = new LinkedList<String>();
for (String dir : paths) {
if (dir.equals(".") || dir.equals("")) {
continue;
}
else if (dir.equals("..")) {
... |
479c9281-2b34-4254-b599-7e71ba61b183 | 4 | public static boolean isPrime_v1 (int num) {
if ( num == 1) {
return true;
}
if ( num % 2 == 0 ){
return false;
}
for ( int i = 3 ; i <= Math.sqrt(num); i += 2 ) {
if ( num % i == 0 ) {
return false;
}
}
return true;
} |
94fd8b08-32ad-4838-817e-ea461841f9b6 | 3 | public final char skipTo(char to) throws JSONException {
char c;
try {
int startIndex = this.index;
reader.mark(Integer.MAX_VALUE);
do {
c = next();
if (c == 0) {
reader.reset();
this.index = star... |
bad55364-b72c-4989-a6fa-925b47dc7609 | 2 | public void keyPressed(KeyEvent k) {
if (k.getKeyCode() == KeyEvent.VK_RIGHT) {
myPaddle.moveRight();
padq.offer(new Position(myPaddle.getPosition()));
} else if (k.getKeyCode() == KeyEvent.VK_LEFT) {
myPaddle.moveLeft();
padq.offer(new Position(myPaddle.getPosition()));
}
} |
95d8edb2-6273-4d0b-865e-afeb3ce9c101 | 7 | public void run() {
// get line and buffer from ThreadLocals
SourceDataLine line = (SourceDataLine)localLine.get();
byte[] buffer = (byte[])localBuffer.get();
if (line == null || buffer == null) {
// the line is unavailable
return;
... |
3f583413-ef34-4017-9a43-c0738871047c | 4 | @Override
public Object evaluate(Context context) {
Iterator<Term> i = terms.iterator();
Object value = i.next().operand.evaluate(context);
while (i.hasNext()){
Term next = i.next();
switch (next.operator){
case AND: value = Operations.and(value, next.operand.evaluate(context)); break;
case ... |
112771eb-a3b3-4b1f-9f7a-fa7b6303ec7c | 4 | public static void main(String[] args) throws UnknownHostException
{
//Initialize Logger
Logger.initialize("thralld_server started at:"+(new Date()).toString(),Level.SEVERE);
System.out.println("thralld_server started at:"+(new Date()).toString());
//Setup available commands
setupAvailableCommands();
... |
c8074437-2eec-44c4-aea8-463b4f53f570 | 7 | @Override
public void trainOnInstanceImpl(Instance inst) {
this.iterationControl++;
double costNow;
if (this.iterationControl <= this.numInstancesInitOption.getValue()) {
costNow = 0;
} else {
costNow = (this.costLabeling - this.numInstancesInitOption.getVa... |
febdd57f-45b2-4a69-a9fa-856bb99c232c | 1 | public void output() {
ListElement current = head;
while (current != tail.next) {
System.out.print(Integer.toString(current.value) + " ");
current = current.next;
}
System.out.println();
} |
306dc2a1-3fcb-4971-bc26-6f498b333024 | 7 | @Override
public void saveMarks(List<Student> students,int courseId) throws SQLException {
Connection connect = null;
PreparedStatement statement = null;
try {
Class.forName(Params.bundle.getString("urlDriver"));
connect = DriverManager.getConnection(Params.bundle.get... |
b474447b-c127-421c-957c-f35c471afd93 | 5 | final int method1859(int i, long l) {
if (i != 71)
method1859(41, -7L);
if (aLong6161 < aLong6160) {
aLong6162 += aLong6160 + -aLong6161;
aLong6161 += -aLong6161 + aLong6160;
aLong6160 += l;
return 1;
}
int i_3_ = 0;
do {
i_3_++;
aLong6160 += l;
} while (i_3_ < 10 && aLong6161 >... |
fddb44b5-95b1-4e16-b9fc-6f8e363b92c1 | 5 | public void run()
{ try
{ String prevChecksum = "";
while(true)
{ String currentChecksum = getFileChecksum();
if(currentChecksum.equals(prevChecksum))
{ Thread.sleep(1000);
continue;
}
BufferedReader fileReader = new BufferedReader(new FileReader(file));
String loop;
pw.println(Con... |
a0019bd1-b31e-4f87-86d9-1b4000fa00d0 | 4 | public String reactionToString(Reaction R){
String str = "";
for(int i=0; i<R.getReactants().length; i++){
str = str+R.getMolReactants().get(i).toStringf()+" ";
if(i!=R.getReactants().length-1){
str = str+"+ ";
}
}
str=str+"---> ";
for(int i=0; i<R.getProducts().l... |
73d7a6a8-89fe-4c33-aeb3-6f8564b6ad9f | 7 | static void checkDependencyReferencesPresent(List<AccessibleObject> objects, Map<String, AccessibleObject> props) {
// iterate overall properties marked by @Property
for(int i = 0; i < objects.size(); i++) {
// get the Property annotation
AccessibleObject ao = objects.get(i) ;
P... |
fcb8dc74-bb7f-40fe-9d41-07dc5bd01438 | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {
String alias = request.getRequestURI().replace(request.getContextPath() + "/", "");
ISimpleDatasetConfiguration dataset = Dataset... |
8034f509-a0ff-4084-a2f0-825c67478e0e | 1 | public boolean isRowFiltered(Row row) {
if (mRowFilter != null) {
return mRowFilter.isRowFiltered(row);
}
return false;
} |
1d4010d3-a862-4aba-9766-323b2440eaf1 | 4 | private static void record(Record record, ItemStack stack, int score) {
ItemMeta meta = stack.getItemMeta();
List<String> lore = meta.getLore();
boolean set = false;
final String loreLine = record.getLoreLine();
for (int i = 0; i < lore.size(); i++) {
String string = ... |
084e60e7-3d53-4d02-b1ca-159db141af22 | 7 | @SuppressWarnings("unchecked")
public PairList<Integer, Double> getValueSortedBucket(int material)
{
material = (material & RawMaterial.MATERIAL_MASK) >> 8;
final int numMaterials = Material.values().length;
if ((material < 0) || (material >= numMaterials))
return null;
if (buckets == null)
{
... |
9fb56ed3-acbd-4f99-9bf9-b86f601116be | 4 | @Override
public void stateChanged(ChangeEvent event) {
if (event.getSource().equals(startDatePicker.getModel())) {
eventStart.set( startDatePicker.getModel().getYear(),
startDatePicker.getModel().getMonth(),
startDatePicker.getModel().getDay());
if (eventStart.after(eventEnd)) {
eventE... |
fb6be465-8216-4808-ba4e-fbbd69d309c2 | 6 | private static Method getMethod(Object o, Object[] args, String methodName, Class<?>[] argsArray){
Method method = null;
try {
method = o.getClass().getMethod(methodName, argsArray);
} catch (NoSuchMethodException e) {
try{
method = o.getClass().getDeclaredMethod(methodName, argsArray);
}catch (NoSuc... |
bdfb8616-0dd4-4e37-95fc-e35001727b01 | 6 | public void ToolsHouseInputValidated(){
try{
this.SetInput(ReadInput.readLine().trim().toUpperCase());
}
catch(IOException e){
SetValidatedInput(false);
return;
}
if(this.Input != EXIT){
try{
int i = Integer.parseInt(Input);
if(i == THIRD || i == SECOND || i == FIRST)
SetValidatedInpu... |
b9709545-44fa-4b8d-9fbf-13918b6540b2 | 2 | public WrapperMoney sellItemBucket(int idx, int count, WrapperMoney in) throws Exception {
isValidItem(idx);
Bucket b = cache[idx];
int diff = b.value * count - in.sum();
if (diff < 0 ) {
return null;
}
if ( diff ==0 ){
return new WrapperMoney(Arrays.asList(Money.zero));
}
return getChange(dif... |
2ee74dc9-925f-49a6-999d-4438630dc2d0 | 8 | public ArrayList<BooksDTO> selectBook(BooksDTO booksDTO, int option,
String keyword) {
conn = JDBCUtil.getInstance().getConnection();
// 결과 마인드맵 리스트를 담을 객체
ArrayList<BooksDTO> list = new ArrayList<BooksDTO>();
try {
System.out.println("나와랏");
if (option == StatusUtil.bookOptionRegistNumber) {
pst... |
bb164e85-91b2-4ab2-8c15-b4cf41b8b5ed | 7 | @Override
public void run() {
String status = Thread.currentThread().getName();
if(status.equals(Message.send_status)){
this.serialize_send();
}
else if(status.equals(Message.receive_status)){
try {
this.serialize_receive();
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch ... |
da892e83-942d-4992-825c-9f79937778e1 | 0 | public static <T> Query<T> flatternAncestors(T child, Selector<T, T> selector)
{
return new Query<T>(new AncestorIterable<T>(child, selector ));
} |
5dbef50d-ddce-42e5-8e0c-7155e813f7cb | 2 | public void sendCommand(String sql, String date, String task, String subtask){
try{
// Execute SQL query
PreparedStatement ps = connection.prepareStatement(sql);
ps.setString(1,date);
ps.setString(2,task);
if (subtask != ""){
ps.setStri... |
45acd4ff-4635-4cc4-b85b-8b202c0dec2d | 0 | public CommingRequesFileTransferHandler(ServerSocket socket, String name) {
serverSocket = socket;
fileName = name;
receiveListInBytes = new ArrayList<byte[]>();
} |
1b16be35-ca3e-4485-8c8d-c08f4cf54970 | 8 | public static void main(String[] args)
{
//process the input first
//if the input is from the console
Scanner in = null;
if (args.length == 0)
{
in = new Scanner(System.in);
}
else if (args.length == 1)
{
File file = new File(args[0]);
if (!file.exists() || !file.canRead()) {
System.err.pr... |
13ddec03-c373-4aaf-a061-e3ce384a90f5 | 2 | @Override
public ParseResult<T, List<A>> parse(LList<T> tokens) {
ParseResult<T, List<A>> r = this.parser.parse(tokens);
if(!r.isSuccess()) {
assert false; // many0 should *always* succeed
}
// have to match parser at least one time
if(r.getValue().size() >= 1) {
return r;
}
return ParseResult.fail... |
fdae9ea4-985d-46b1-a076-5dd0a968d581 | 9 | @SuppressWarnings("unchecked")
public <P> P as(Class<P> proxyType) {
final boolean isMap = (object instanceof Map);
final InvocationHandler handler = new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args)
throws Throwable {
String name = method.getName()... |
356a639a-aa0a-4a70-8fbb-b703e8d05fee | 9 | public static void main(String[] args) throws IOException {
while (true) {
String[] input = READER.readLine().split(" ");
int height = Integer.parseInt(input[0]);
int width = Integer.parseInt(input[1]);
if (height == 0 && width == 0) {
return;
}
for (int i = 0; i < height; ++i) {
char[] line... |
f914855d-ef38-42aa-9d95-cc59f96ace30 | 7 | public String formatLiteralVariableString(final String str) throws InvalidArgumentException {
if (null == str || "".equals(str.trim())) throw new InvalidArgumentException(
ErrorMessage.LITERAL_VARIABLE_DEFINITION_NOT_FOUND);
if (str.charAt(0) == DomConst.Literal.LITERAL_VARIABLE_PREFIX
|| str.charAt(0) == D... |
b013e08b-b312-41d5-a133-c8d80407b27b | 3 | private int getNextCellIndex () {
int selectedCellIndex = -1;
double minF = Double.MAX_VALUE;
for (int i = 0; i < openedCells.size(); i++) {
Point currentOpenCell = openedCells.get(i);
double localF = 0;
if (field[currentOpenCell.x][currentOpenCell.y] instan... |
450cde50-7efb-4187-9b9f-5c4e4a6a0671 | 1 | public static void printClockLn(String string, int l) {
if (check(l)) {
toTerminal(getTime() + " " + string + "\n", l);
}
} |
db5a430a-5f5a-4da9-bf99-8752f3faeab3 | 4 | private int objectState( char next ) {
if ( next == ',' ) {
buffer.pop();
next = nextValue();
}
switch (next) {
case END_OBJECT: {
popState();
return returnValue( END_OBJECT, state );
}
case '"': {
... |
604c840e-4a36-42b2-bc59-4415d132966d | 9 | protected void draw_symbol(Graphics2D g, float xpos, float ypos, Object symbol, int size1) {
if (symbol == null)
return;
int size2 = size1 / 2;
g.setStroke(symbolStroke);
if (symbol instanceof Ellipse2D.Float) {
Ellipse2D.Float circle = (Ellipse2D.Float) symbol;
circle.setFrame(xpos - size2, ypos - ... |
b27e43df-524c-4e7d-bcb8-8f48ce8358fc | 1 | public char[] GetSuffix(int len)
{
char[] ret = new char[len];
if ((bufpos + 1) >= len)
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
else
{
System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
len - bufpos - 1);... |
73fb12f4-c686-4a97-ba35-ae6563d14840 | 6 | public static void addArticlesIntoDatabase(List<Article> alist) {
StringBuffer sb = new StringBuffer("INSERT INTO soc.articles VALUES");
StringBuffer sb2 = new StringBuffer("INSERT INTO soc.coauthors VALUES");
try {
if (conn == null || conn.isClosed()) {
init();
}
if (statement == null || statement.i... |
3bf217a0-ce4a-4389-af83-7199071f28d8 | 8 | public boolean stem() {
int v_1;
int v_2;
int v_3;
int v_4;
// (, line 133
// do, line 134
v_1 = cursor;
lab0: do {
// call prelude, line 134
if... |
b110081a-b30e-4454-86e1-4ea330ae16b6 | 7 | private URL addDownloadKey(URL url, String downloadHost, String downloadKey, String clientId) {
if (downloadHost != null && !downloadHost.isEmpty()) {
try {
url = new URI(url.getProtocol(), url.getUserInfo(), downloadHost, url.getPort(), url.getPath(), url.getQuery(), null).toURL();
... |
f144d663-da4a-48d4-a3bf-6604936778b7 | 4 | public static void Adjust(int[] a, int i, int n)
{
int j = 0;
int temp = 0;
temp = a[i];
j = 2 * i + 1;
while(j <= n-1)
{
if(j < n-1 && a[j] < a[j+1])
j++;
if(temp >= a[j])
break;
a[(j-1)/2] = a[j];
j = 2 * j + 1;
}
a[(j-1)/2] = temp;
} |
2911bea6-70b7-4910-a5fc-799a44565e0f | 8 | private void repondreRequete (HttpServletRequest requete, HttpServletResponse reponse, Map<String, Action> routes)
throws ServletException, IOException {
requete.setCharacterEncoding("utf-8");
reponse.setCharacterEncoding("utf-8");
/*
for (Object k : requete.getParameterMap()... |
4ade3a77-d158-40b9-b000-f8f6b126cacd | 8 | public static final Color checkAlphaColour(int red, int green, int blue, int alpha)
{
if (red < 0)
red = 0;
else if (red > 255)
red = 255;
if (green < 0)
green = 0;
else if (green > 255)
green = 255;
if (blue < 0)
blue = 0;
else if (blue > 255)
blue = 255;
... |
e6125c0f-81bb-4255-a82d-65472af63b1d | 3 | private static int getValueOf(TokenType type, String s) {
switch (type){
case DIGIT:
case NTY:
case TEEN:
int toReturn = type.getValue(s);
assert (toReturn >= 0) : "No value found for token type " + type;
return toReturn;
... |
1e154c4f-f817-43f5-9ae7-b4cdaa1676b4 | 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... |
07c15b72-9b6c-4fbd-845d-ade62fe9a875 | 1 | @Override
public Auction bid(String username, int itemId) {
// searches.get(itemId));
Auction a = searches.get(itemId);
if(a != null){
a.setCurrentBid(a.getCurrentBid()+1);
a.setNumerOfBidsRemaining(a.getNumberOfBidsRemaining()-1);
a.setOwner(username);
// return a;
}
System.out.println("The... |
38f528c7-b6b0-4879-a9fb-ab0af2c6e231 | 6 | public Format setOutputFormat(Format output) {
if (output == null || matches(output, outputFormats) == null)
return null;
RGBFormat incoming = (RGBFormat) output;
Dimension size = incoming.getSize();
int maxDataLength = incoming.getMaxDataLength();
int lineStride = ... |
d4781d78-ae3e-4a25-80c6-2353b674d280 | 6 | @Override
public void run() {
for(int i = 0; i < gots.size(); i++){
if(!gots.get(i).sendInit(seed, nbrOfPlayers, i)){
System.out.println("SENDING INIT FAILED");
}
}
long desiredSleep = Constants.GAME_SPEED;
long diff = 0;
while(true) {
Byte[] commands = new Byte[nbrOfPlayers];
for(int i = 0; ... |
d09f6dcf-1830-4d07-bbf1-61e504fb5910 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final DataMessage other = (DataMessage) obj;
if (this.sequenceNumber != other.sequenceNumber ||
... |
d975f641-c5fc-4728-a883-d5bd88457e43 | 3 | @Override
public void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
p.addLast("httpcodec", new HttpServerCodec(8192, 8192 * 2, maxChunkSize));
if (blackList != null && blackList.length > 0) {
p.addLast("filter", new InboundFilterHandler(bla... |
6893047f-3250-4bcd-bcef-4cad408034d6 | 1 | @Test
public void transferInstructionOpcodeTest() { //To test instruction is not created with illegal opcode for format
try {
instr = new TransferInstr(Opcode.ADD, 0, 0);
}
catch (IllegalStateException e) {
System.out.println(e.getMessage());
}
assertNull(instr);//instr should be null if creation has ... |
c9e54a4e-94f5-40df-92a1-f9f073aed2b0 | 1 | public boolean estEnAttente(){
if(this.etat == EN_ATTENTE){
return true ;
}
else {
return false ;
}
} |
39bec502-1604-4693-8924-8c5c5c2389c7 | 9 | public double distance(double x, double y) {
if (x >= left && x <= right) {
if (y >= top) {
if (y <= bottom) {
return 0;
}
else {
return y - bottom;
}
}
else {
return top - y;
}
}
else if (y >= top && y <= bottom) {
if (x < left) {
return left - x;
}
else {
... |
fd8abc6b-0ada-4887-9f38-04e81a04d994 | 8 | public void keyPressed(KeyEvent e){
int keyCode = e.getKeyCode();
//if you press up, move up
if(keyCode == KeyEvent.VK_UP){
//if you touch a "w" or wall, the move does not occur
if(!m.getMap(p.getTileX(), p.getTileY() - 1).equals("w") )
p.move(0, -1);
}
//if you press down, move down
if(... |
e889ae2b-2201-4d91-86f8-fa60e9e58974 | 9 | @Override
public void mouseDragged(MouseEvent e) {
if (e.getSource().equals(this.pnLeftImage) ||
e.getSource().equals(this.pnRightImage)) {
JPanelPicture currentPanel = null;
Point currentAnchor = null;
JSpinner currentSpinerX = null;
JSpinner currentSpinerY = null;
if (e.getSource().equals(this.... |
9785678e-b431-41b2-8948-bc7a8a96cf37 | 2 | @Override
public int hashCode() {
int result = rWord != null ? rWord.hashCode() : 0;
result = 31 * result + (eWord != null ? eWord.hashCode() : 0);
return result;
} |
e78f7f7f-8a9d-4cb9-877d-a1ff0711750d | 1 | private final String getLabel(final Label label) {
String name = (String) labelNames.get(label);
if (name == null) {
name = Integer.toString(labelNames.size());
labelNames.put(label, name);
}
return name;
} |
22ea404a-6d8e-4bd8-9029-c76280f53537 | 3 | private void tblListagemFuncionarioMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tblListagemFuncionarioMouseClicked
Object valor = tblListagemFuncionario.getValueAt( tblListagemFuncionario.getSelectedRow(), 0);
Funcionario funci = null;
try {
funci = dao.Abrir((int)v... |
c3bc9909-bbe9-4920-a218-3e895bb7feda | 2 | private boolean jj_3R_57() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_54()) jj_scanpos = xsp;
if (jj_3R_87()) return true;
return false;
} |
8ef61793-265c-4d79-983d-b01517e1be0d | 7 | public CantroserverView(SingleFrameApplication app) {
super(app);
initComponents();
owner = (CantroserverApp)app;
jList1.addListSelectionListener(this);
// status bar initialization - message timeout, idle icon and busy animation, etc
ResourceMap resourceMap = getRes... |
9ad8a8ae-6235-44db-9354-63124793f2a3 | 5 | @Override
public void packetIncoming(Packet packet) {
if(packet.channel.equals(References.CHANNEL_PLAYER_DC)){
this.playerDC(packet);
}else if(packet.channel.equals(References.CHANNEL_JOIN)){
this.join(packet);
}else if(packet.channel.equals(References.CHANNEL_STARTGAME)) {
this.startGame(packet);
}el... |
06c929a0-0bb7-4cec-8d40-79ae8be1f1d3 | 6 | @EventHandler
public void WitchResistance(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getWitchConfig().getDouble("Witch.Resista... |
5b15edd9-b5db-41aa-8221-255ef88eec7a | 6 | public static String unescape(String s) {
int len = s.length();
StringBuffer b = new StringBuffer();
for (int i = 0; i < len; ++i) {
char c = s.charAt(i);
if (c == '+') {
c = ' ';
} else if (c == '%' && i + 2 < len) {
int d = JS... |
d0026726-6863-4823-955f-a3345385c4f0 | 9 | protected AttributeClassObserver newNumericClassObserver() {
switch (this.numericEstimatorOption.getChosenIndex()) {
case 0:
return new GaussianNumericAttributeClassObserver(10);
case 1:
return new GaussianNumericAttributeClassObserver(100);
ca... |
0754c139-d5d5-42a0-8c22-583e4eaa2a74 | 1 | public static void left() {
if(GraphicsMain.viewX - 100 > 0) {
viewX -= 1;
}
} |
cfe6993f-6de9-458b-89fc-b726f197e0a5 | 4 | @Override
public boolean keyDown(int keycode) {
switch(keycode) {
case Keys.W:
direction.y = speed;
animationTime = 0;
break;
case Keys.A:
direction.x = -speed;
animationTime = 0;
break;
case Keys.S:
direction.y = -speed;
animationTime = 0;
break;
case Keys.D:
direction.x = spee... |
fe28ac52-21d2-4cfe-bdee-04d5fdd0245c | 9 | public void canvasMouseReleased(MouseEvent e)
{
actObjectleft = null;
actObjectright = null;
if(mytabbedpane.getSelectedIndex()==0)
{
for(GeometricObject go : geomListleft)
{
if(go.isInside(e.getX(), e.getY()) != -1)
{
actObjectleft = go;
if(isActive == fals... |
5719a8f4-80f3-4a06-a6e1-5cfcb8c275f9 | 4 | private void listFiles() {
FTPClient client = new FTPClient();
try {
client.connect("ftp.site.com");
client.login("username", "password");
FTPFile[] files = client.listFiles();
for (FTPFile ftpFile : files) {
if (ftpFile.getType() == FTPFil... |
768921a2-616c-4f89-89a0-65191bd7dabe | 6 | public static final boolean contentEquals( Object c1, Object c2 ) {
if( c1 == null && c2 == null ) return true;
if( c1 == null || c2 == null ) return false;
if( c1 instanceof byte[] && c2 instanceof byte[] ) {
return equals( (byte[])c1, (byte[])c2 );
}
return c1.equals(c2);
} |
424f6db0-b3d0-4df1-8373-d9185e61493e | 7 | private void getAllInterface(Class<?> clazz, Set<String> interfacesSet) {
Class<?>[] interfaces = clazz.getInterfaces();
Class<?> c = clazz;
while (null != c) {
interfacesSet.add(c.getName());
c = c.getSuperclass();
}
for (Class<?> inte : interfaces) {
interfacesSet.add(inte.getName());
}
if (!cl... |
a753a376-d4c7-40d5-8de2-e9e6605bd0ce | 0 | public boolean isBetter(Object other) {
double otherValue = ((Quantity) other).convertTo(this.unit);
return this.value > otherValue;
} |
6da462ff-92df-4da0-a61b-862b95ddf5eb | 7 | public static int fillTableVerbose(int rows, int cols,int colStart,int colEnd){
int cri=1;//current row index. begin calc at table [1][1]
int cci=1;//current col. index
int up,left,caddy,bestChoice=0,val=0;//the ones to look at and the one to choose.
char let1,let2;//left and top seq letters. gene left genome t... |
cf848bbe-c40e-4f8e-89ff-1014225daf0d | 8 | public void run()
{
final double S = 1; // Units to move
try
{
GameObject ball = pongModel.getBall();
GameObject bats[] = pongModel.getBats();
while ( true )
{
double x = ball.getX(); double y = ball.getY();
// Deal with possible edge of board hit
... |
880d702d-6608-4e17-aeb8-c63ea94cfa63 | 2 | public void moveJump(Jump jump) {
if (this.jump != null)
throw new AssertError("overriding with moveJump()");
this.jump = jump;
if (jump != null) {
jump.prev.jump = null;
jump.prev = this;
}
} |
ca91ebc9-b349-4f51-afda-4ca2dfedb961 | 9 | public static void main(String[] args) {
class Point {
double x;
double y;
}
Scanner s = new Scanner(System.in);
String input;
Point point1 = new Point();
Point point2 = new Point();
Point point3 = new Point();
... |
8325eb55-630f-44ed-82eb-228b673aafac | 9 | public void reorderList(ListNode head) {
if(head == null || head.next ==null) return;
ListNode curr1 = head;
int count = 0;
while(curr1 != null)
{
curr1=curr1.next;
count ++;
}
//split after count/2
ListNode second = null;
curr1 = head;
int i = 1... |
3acad4d3-c460-4a30-b8ad-b1d0a99da7c3 | 1 | private void connect_db(){
if(!secondary)
db = new Database("jdbc:postgresql://localhost/vsy","vsy","vsy");
else
db = new Database("jdbc:postgresql://localhost/vsy2","vsy2","vsy2");
} |
9103508e-ec82-48aa-b1ed-c012bed27d25 | 7 | public void setFeature (String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
if (name.equals(NAMESPACES)) {
checkNotParsing("feature", name);
namespaces = value;
if (!namespaces && !prefixes) {
prefixes = true;
}
} else if (name.equals(NAMESPACE_PREFIXES)... |
1a8260f1-3ef2-4be9-8e3e-9b2707a408a0 | 3 | protected void addImage(String relURL) {
this.imageURL = relURL;
this.imageConstraints = new GridBagConstraints();
imageConstraints.gridx = 1;
imageConstraints.gridy = 0;
imageConstraints.gridheight = 4;
this.imageIndex = 0;
try {
imageIcon = new ImageIcon(ImageIO.read(getClas... |
b0a55366-797c-4f7a-98ac-65dc0f10ad8f | 3 | public void drawTo(PPMEC PPM) {
int c = (int) (xRatio * PPM.getWidth());
int r = (int) (yRatio * PPM.getHeight());
int hLengthB = (int) (baseR * PPM.getWidth() / 2);
double angleR = Math.toRadians(ANGLE);
double angleHR = Math.toRadians(ANGLEH);
double h = (int) (Math.tan(angleR) * hLengthB);
PPM.setPixel... |
e8431dc9-8770-4ebf-a77c-243f6a086ea5 | 2 | @Override
public boolean delete(Object item) {
conn = new SQLconnect().getConnection();
String sqlcommand = "UPDATE `Timeline_Database`.`Timenodes` SET `display`='false' WHERE `id`='%s';";
if(item instanceof Timenode)
{
Timenode newitem = new Timenode();
newitem = (Timenode)item;
try {
String s... |
e22ea571-a38c-493a-8559-5773fc10a09d | 6 | public static List<String> GetMissingDependencies(File f, String delimeter) throws IOException{
HashMap<Integer,Set<String>> columnData = new HashMap<Integer,Set<String>>();
List<String> missingValues = new ArrayList<String>();
FileReader file_reader = new FileReader(f);
BufferedReader reader = new BufferedR... |
a3df49a7-da63-44cd-90de-f0f1aaca9a14 | 8 | float calcSurfacePoint(float cutoff, float valueA, float valueB, Point3f surfacePoint) {
float fraction;
if (isJvxl && jvxlEdgeDataCount > 0) {
fraction = jvxlGetNextFraction(edgeFractionBase, edgeFractionRange, 0.5f);
thisValue = fraction;
}
else {
float diff = valueB - valueA;
fraction = (cutoff -... |
15548575-2eaa-478f-ba60-d553910e2c79 | 7 | private void createNewUser(String username, String newUserName, String newUserPid, String newUserPassword, boolean admin, String configurationArea, Collection<DataAndATGUsageInformation> data)
throws ConfigurationTaskException, RequestException {
if(isAdmin(username)) {
// Es werden 4 Fälle betrachtet
// Fa... |
030dc7bf-2cae-40db-b845-0e095b5007ab | 7 | 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.");
... |
83859f74-c0db-45b6-9496-36d2ffe55d2f | 3 | public void displayLogs(ArrayList<TimeStampedMessage> sortedLogs) {
System.out.println("LOG FILE WITH ORDER AND CONCURRENT FLAG");
if (sortedLogs.size() == 0) {
System.out.println("LOGFILE IS EMPTY");
return;
}
System.out.println(sortedLogs.get(0).toString() + " ConCurrent:"
+ sortedLogs.get(0).getCo... |
d91fc446-5675-49a0-850b-325b64ecde33 | 0 | public Timer(int granularity) {
this.granularity=granularity;
} |
1bbf8aa7-f8d0-4fb9-9b5a-2f19a87cf388 | 7 | @Override
public Double draw(String id, Double out) {
if(id == null || "".equals(id.trim()) || out < 0) {
return -1.0;
}
for(Account a : accounts) {
if(id.equals(a.getId())) {
if(a.getBalance() < 0 || a.getBalance() < out) {
return ... |
53f4a2a3-0aae-4457-bef1-ada178631a8d | 8 | public static ListNode merge(ListNode l1, ListNode l2) {
/* If any of the two lists is empty, return the other one */
if (l1 == null) {
return l2;
}
if (l2 == null) {
return l1;
}
/*
* Keep two pointers:
* (1) results (HEAD) of merged list,
* (2) tail (TAIL) of merged list
*/
... |
c591a642-8cc6-41f7-94ef-6f07d29b4a72 | 9 | public boolean isPalindrome2(String s) {
if (s == null || s.length() == 0) {
return true;
}
int front = 0;
int end = s.length() - 1;
while (front < end) {
while (front < s.length() && !isValid(s.charAt(front))) {
front++;
}
// for empty string
if (front == s.length()) {
return true;
... |
d82e5b0c-a069-4ca4-986b-28f557ce8b6d | 6 | protected void animateModel() {
_rootMatrix.getIdentityMatrix();
if (_xRotationAngle != 0) {
tempMtx.getArbitraryAxisRotationMatrix(_xRotationAngle, 1, 0, 0);
// tempMtx.getXAxisRotationMatrix(_xRotationAngle);
_rootMatrix.multiply(tempMtx);
}
if (_yRotationAngle != 0) {
tempMtx.getArbitraryAxisRotat... |
20d30170-38f3-4407-8e8d-07be92045baf | 5 | public FieldDescriptor findExtensionByName(String name) {
if (name.indexOf('.') != -1) {
return null;
}
if (getPackage().length() > 0) {
name = getPackage() + '.' + name;
}
final GenericDescriptor result = pool.findSymbol(name);
if (result != null && result instanceof... |
1e142c76-0057-49c7-92f6-285661b7dc94 | 6 | public void rebond(Projectiles projectile, char orientation) {
if (orientation == 'y') {
projectile.getVitesse().setY(-projectile.getVitesse().getY() * projectile.getFacRebond());
projectile.getVitesse().setX(projectile.getVitesse().getX() * projectile.getFacRebond());
if (projectile.getVitesse().getY()... |
69cca228-0857-4cb6-8299-689ffb6c0c0d | 0 | public MemoryLeak() {
elements = new Object[DEFAULT_INITIAL_CAPACITY];
} |
89b3404b-ca07-49e0-9f30-f1728e77626e | 2 | public int genererNumeroClient(){
System.out.println("ModeleLocations::genererNumeroClient()") ;
int numMax = 0 ;
for(Client client : this.clients){
if(client.getNumero() > numMax){
numMax = client.getNumero() ;
}
}
return numMax + 1 ;
} |
b14c1d11-52df-456d-adcf-69d20a4bda50 | 2 | public void update(long deltaMs) {
Iterator<IntBuffer> it = sources.iterator();
while(it.hasNext()) {
IntBuffer source = it.next();
if(AL10.alGetSourcei(source.get(0), AL10.AL_SOURCE_STATE) == AL10.AL_STOPPED) {
AL10.alDeleteSources(source.get(0));
... |
39c5521c-9ede-438f-89fc-c7845e915a4f | 7 | static public void start() {
CallableStatement callableStatement = null;
Connection con = null;
Connection mscon = null;
ArrayList<StrongmailMailing> smlist = new ArrayList<StrongmailMailing>();
try {
Class.forName("org.postgresql.Driver");
String jdbcF... |
826d41cd-02fa-4393-94ac-dcf989754101 | 2 | public Object clone() {
try {
SlotSet other = (SlotSet) super.clone();
if (count > 0) {
other.locals = new LocalInfo[count];
System.arraycopy(locals, 0, other.locals, 0, count);
}
return other;
} catch (CloneNotSupportedException ex) {
throw new alterrs.jode.AssertError("Clone?");
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.