method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
bba0327f-475a-4630-b1f6-d90678e3b106 | 6 | @Override
public int symlink(String from, String to) throws FuseException {
try {
if (fileSystem.isReadOnly())
return Errno.EROFS;
/*if (!from.startsWith("/"))
from = "/" + from;*/
if (!to.startsWith("/"))
to = "/" + to;
fileSystem.createSymbolicLink(to, from);
} catch (PathNotFoundExcepti... |
1d3dc967-f6b9-4822-8eb0-c20911852e9e | 6 | private void cancelKeys() {
if (cancelQueue.isEmpty()) {
return;
}
Selector selector = this.selector;
for (;;) {
CancellationRequest request = cancelQueue.poll();
if (request == null) {
break;
}
ServerSocketCh... |
481ce9fd-c192-4599-be51-6426762ffa4a | 3 | @Override
public void monsterAttackPlaceable(Monster source, Rectangle attackRect, int meleeDamage) {
int dmg = 0;
Placeable placeable = null;
try {
for (String key : placeables.keySet()) {
placeable = (Placeable) placeables.get(key);
dmg = placea... |
6d03d910-88e9-4e32-b184-015d791bd3bb | 6 | public InputFrame(String source, Point sourcePoint){
this.frame = new JFrame("");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setLocation(new Point(sourcePoint.x + 150, sourcePoint.y + 150));
this.source = source;
switch(source){
case "artist":
ArtistPanel aPanel = new ArtistPanel();... |
9f3fe295-afb5-42f8-a471-44232f0114b7 | 7 | public List getSaveList()
{
ArrayList var1 = new ArrayList();
File[] var2 = this.savesDirectory.listFiles();
File[] var3 = var2;
int var4 = var2.length;
for (int var5 = 0; var5 < var4; ++var5)
{
File var6 = var3[var5];
if (var6.isDirectory())... |
d390b7ef-4d1e-4bf1-9f26-62e47448ce14 | 4 | static final private ArrayList<ThingVNode> argument_list() throws ParseException, CompilationException {
ArrayList<ThingVNode> args = new ArrayList<ThingVNode>();
ArrayList<ThingVNode> value;
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ACCESSOP:
jj_consume_token(ACCESSOP);
t = jj_con... |
c15d541a-f945-4d68-83e2-1b875ecc8510 | 7 | private boolean shouldWait(int txnId, Set<Integer> dependetTxns) {
Set<BlockPtr> ptrList = blockPtrsInTxn.get(txnId);
Iterator<Integer> iter = blockPtrsInTxn.keySet().iterator();
while (iter.hasNext()) {
int txn = iter.next();
if (txn == txnId) {
continue;
}
Set<BlockPtr> list = blockPtrsInTxn... |
ac898179-9abe-4530-82ce-99a3ccb3fd00 | 6 | @EventHandler
public void SpiderSpeed(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.getSpiderConfig().getDouble("Spider.Speed.Dod... |
adb07a7f-87e2-4fd7-8c33-9b21397347e6 | 3 | public static String checkPosition(String username, String pass){
Employee bean = new Employee();
bean.setUsername(username);
bean = (Employee)DatabaseProcess.getRow(bean);
//if username cannot be found in the database
if(bean == null){
return "not found";
}
if(bean.getUsername().equals(username... |
0c299ee8-a3b8-46ca-8c15-f0524a5d1df6 | 5 | @Override
protected Authentication doAuthentication(Authentication authentication)
throws AuthenticationException {
if (!(authentication instanceof CustomAuthenticationToken)) {
throw new IllegalArgumentException("Only CustomAuthenticationManager is supported");
}
CustomAuthenticationToken authentic... |
a3edb745-7f7e-49b7-88f4-a010bfb02de4 | 7 | public void addToCanvas(Component comp, Integer i) {
if (comp != statusPanel && !(comp instanceof JMenuItem) && !(comp instanceof FreeColDialog<?>)
&& statusPanel.isVisible()) {
removeFromCanvas(statusPanel);
}
try {
if (i == null) {
supe... |
134f57b4-dd17-473a-9be1-25b487b373f9 | 4 | @Override
public boolean hasNext() {
if (in == null) return false; // No file? => We are done
if (binRead != null) return true;
try {
binRead = readerObject.read(in);
if (binRead == null) close();// Nothing more to read?
} catch (IOException e) {
binRead = null;
}
return (binRead != null);
} |
636187a9-f4c1-4e17-b74b-5d9dfff0f6be | 1 | @Override
public void undo(UndoQueueEvent e) {
if (e.getDocument() == Outliner.documents.getMostRecentDocumentTouched()) {
calculateEnabledState(e.getDocument());
}
} |
535779e3-cc2a-4914-9dd6-67adf744bf11 | 7 | public void GenerateIcons() {
images = new ImageIcon[2];
for (int a = 0; a < 2; a++) {
images[a] = new ImageIcon(new BufferedImage(28, 32, BufferedImage.TYPE_4BYTE_ABGR));
Graphics g;
try {
g = images[a].getImage().getGraphics();
}
... |
63f92c70-1f67-460a-a8f4-989f3d846f8f | 7 | public static String doubleToString(double d) {
if (Double.isInfinite(d) || Double.isNaN(d)) {
return "null";
}
// Shave off trailing zeros and decimal point, if possible.
String string = Double.toString(d);
if (string.indexOf('.') > 0 && string.indexOf('e') < 0 &&
... |
8f8a6f83-a17b-4433-b07d-58bc4f46eb23 | 0 | public void setContactList(ArrayList<EmailKontakt> contactList) {
this.contactList = contactList;
} |
7873b466-76e9-41f6-b001-e5d88ac3b87e | 8 | @Override
public void execute(FileSearchBean task) throws Exception {
final FileInputStream fileInputStream = new FileInputStream(task.getInputFile());
final BufferedInputStream bufferedInputStream = new BufferedInputStream(fileInputStream, bufferSize);
try {
// Naive substring ... |
85728345-7ae6-4c87-ae00-bc605018c6a1 | 2 | public static void addKampf(JSONObject fight, JSONObject data, String method) {
if (isHtmlOutput()) {
try {
// Taktik speichern
add(new TacticsLogFile(getInstance().htmlPath, data));
// Dateinamen generieren
String filename = String.valueOf(new Date().getTime())
+ fight.getJSONObject("o... |
bc2eab3d-af0e-439d-91dc-7fe25efca916 | 6 | @Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
setBackground(this.c);
try {
switch(random) {
case 0:
image = makeImageIcon("/images/Ingress_Green.png").getImage();
... |
2978fad6-7de1-4f93-a3ea-075fbd909025 | 9 | void clearLegacyEditingSetup() {
if (!getControl().isDisposed() && getCellEditors() != null) {
int count = doGetColumnCount();
for (int i = 0; i < count || i == 0; i++) {
Widget owner = getColumnViewerOwner(i);
if (owner != null && !owner.isDisposed()) {
ViewerColumn column = (ViewerColumn) owner
... |
56988462-9acc-4ae7-8d47-e5f1e779f1cd | 4 | public void draw() {
if (y > -yNull && y < yNull && x < xNull && x > -xNull) {
bits[(yNull - y) * pw + x + xNull] = GUIStandarts.figureColor;
}
} |
32c0b932-3f1e-4479-ae62-8806e6fbac99 | 8 | @Override
public List<? extends PictureI> searchfromTags(String search){
if(!(search.equals(""))){
List<Tag> tags = this.tagDao.findByLike("tag", search);
List<? extends PictureI> pictures = new ArrayList<Picture>();
if(!(tags.isEmpty())){
for(TagI t: tags){
try{
for(TagI tag: this.tagDao.get... |
6a70e093-da85-496f-bd4d-e3df2497c31a | 9 | public static void main(String[] args) {
try {
UIManager.setLookAndFeel(
UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (InstantiationException e1) {
// TODO Auto-generated catch block
... |
98740677-116e-4591-bcdc-20265a1b07a9 | 9 | @Override
public int compareTo(Object obj) {
if (!(obj instanceof TimeInteger)) {
return -1;
}
TimeInteger other = (TimeInteger) obj;
if ((this.time < other.time) || (this.time == other.time && this.isStartingTime && !other.isStartingTime)){
return -1;
} else if ((this.time > other.time)... |
2f0be8d7-8304-40b7-a6c2-50ce85b6b7d7 | 2 | public void deal(Hand[] playerHand, int numPlayer, int numCard) {
for (int i = 0; i < numCard; i++) {
for (int j = 0; j < numPlayer; j++) {
playerHand[j].add(dealCard());
}
}
} |
c5dc2089-07f4-4b01-937d-790352c651df | 1 | public void setColumns(String ... columns) {
columnNames = Arrays.asList(columns);
for (int i = 0; i < columnNames.size(); i++) {
info.put(i+1, new LinkedHashMap<String, String>(new HashMap<String, String>()));
}
} |
7872c913-35aa-48c0-b62d-6d538b217650 | 6 | public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int inputCount = 0;
Map<String, Integer> book = new HashMap<String, Integer>();
if (in.hasNext()) {
inputCount = in.nextInt();
}
for (int i = 0; i < inputCount; i++) {
String callNumOri = in.next();
String callNum = decod... |
8557b17a-77de-42e8-ac25-3a616e595f89 | 3 | @Override
public void setValueAt(Object value, int row, int col) {
Movement movement = rekening.getBusinessObjects().get(row);
if (col == 1) {
Calendar oudeDatum = movement.getDate();
Calendar nieuweDatum = Utils.toCalendar((String) value);
if (nieuweDatum != null) movement.setDate(nieuweDatum);
else s... |
25f3a2dd-ec20-4d6c-9b84-1f97d9489334 | 1 | public void visit_invokespecial(final Instruction inst) {
final MemberRef method = (MemberRef) inst.operand();
final Type type = method.nameAndType().type();
pop(type.paramTypes().length);
pop(); // Pop receiver
if (type.returnType() != Type.VOID) {
push(inst);
}
} |
6dfffc50-122a-4397-b7c5-fb6306c1ae22 | 6 | public static Stella_Object walkVerbatimTree(Cons tree, Object [] MV_returnarray) {
{ PropertyList self000 = PropertyList.newPropertyList();
self000.thePlist = tree.rest;
{ PropertyList options = self000;
Stella_Object verbatimtree = options.lookup(((Keyword)(Stella.$TRANSLATOROUTPUTLANGUAGE$.g... |
acb0068b-7eec-4d65-b519-e93055ff5013 | 9 | private void cssNthChild(boolean backwards, boolean ofType) {
String argS = tq.chompTo(")").trim().toLowerCase();
Matcher mAB = NTH_AB.matcher(argS);
Matcher mB = NTH_B.matcher(argS);
final int a, b;
if ("odd".equals(argS)) {
a = 2;
b = 1;
} else if ("even".equals(argS)) {
a = 2;
b = 0;
} else... |
affa514b-9c9e-4c4e-ba16-5209c8930f47 | 8 | public static byte[] generatePELock( int serviceID, String PEList )
{
if( PEList == null )
return null;
if( PEList.length() == 0 )
return null;
String[] pieces = PEList.split(","); //6567,451
int length = pieces.length;
if(length == 0)
return null;
if( _longArray... |
58e5accd-1486-46a7-86f9-cc52287e839c | 4 | @Override
public boolean equals(Object other)
{
if(other == null || !((other instanceof CaseInsensitiveString) || (other instanceof String)))
{
return false;
}
if(other instanceof String)
{
return value.equalsIgnoreCase((String)other);
}
else
{
return value.equalsIgnoreCase(((Cas... |
84ff64d7-acd8-4981-8743-f2b74dfc505e | 9 | private Object readResolve() throws ObjectStreamException {
RectangleAnchor result = null;
if (this.equals(RectangleAnchor.CENTER)) {
result = RectangleAnchor.CENTER;
}
else if (this.equals(RectangleAnchor.TOP)) {
result = RectangleAnchor.TOP;
}
el... |
394f69aa-600c-41a3-aad3-fc138edeb20d | 5 | public static void checkCollision(ActorSet actors, int start, int stride){
// TODO it would be nice use a single list for all our threads
List<Actor> actorsList = actors.getCopyList();
// Check our guy we stride to against all the others
for(int i = start; i < actorsList.size(); i += str... |
cce4ae3f-1ab3-493f-b853-a196029d0c8e | 9 | @Override
/**
* Verifica se o Tracker esta online
*/
public void run() {
while (true) {
if (!processo.knowTracker) {
eleicao();
}else{
try {
byte[] buf = new byte[1... |
2076f5a7-0a90-4517-b56b-df04a85b341a | 5 | public static List<String> getPluginInventory()
{
List<String> pluginList = new ArrayList<String>();
try
{
File jarLocation = new File(ControllerEngine.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
String parentDirName = jarLocation.getParent(); // to get the parent dir nam... |
fc22bb17-a97a-44d5-bd43-e4ec43715c9f | 6 | public void getListDetails(String id)
{
float total = 0;
float totalInterest = 0;
float payment1 = 0;
float payment2 = 0;
try
{
String tempQuery = "select TO_DATE(amordate, 'YYYY-MM-DD') as monthly_schedule,mon_amort as monthly_payment,mon_interest as inte... |
4e9bc08a-2614-4c72-9061-6ef28f8d93fb | 6 | public static void main(String[] args) {
InputStream r=null;
OutputStream os = null;
File file = new File("F://c.txt");
try{
r = new FileInputStream(file);
// BOMInputStream bis = new BOMInputStream(r,false);
os = new FileOutputStream("f://b.txt");
ByteArrayOut... |
f0387120-b352-4b55-957d-5c067061e556 | 5 | public static String convertTypeToLocation(ContactLocation type)
{
switch (type)
{
case DIALLED_CALLS:
return "DC";
case MISSED_CALLS:
return "MC";
case PHONE_ENTRIES:
return "ME";
case SIM_ENTRIES:
return "SM";
case ALL_ENTRIES:
return "MT";
default:
return "";
}
} |
6dfd4e33-2044-4778-af18-da54ef5abc0c | 2 | public TeleporterGridFactory(Grid grid, FullGridFactory factory) {
if (grid == null)
throw new IllegalArgumentException("Grid can't be null!");
if (factory == null)
throw new IllegalArgumentException("Factory can't be null!");
this.factory = factory;
this.grid = grid;
} |
4f4564ae-69c6-4683-9e07-c36c35ca1322 | 2 | public void generate(String fileName) {
try{
BufferedWriter bw = new BufferedWriter(new FileWriter(fileName));
bw.write("<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">");
bw.newLine();
// Write the maze
for(Edge e: svgLines){
bw.write("<line x1=\"" ... |
168a30ad-bc9a-4578-bffb-104fadae7566 | 4 | private void checkFile() throws GOLException, IOException {
if (fileTypeIsNotGol()) {
throw new GOLException("Datei muss vom Typ .gol sein.");
}
if (fileSizeTooBig()) {
throw new GOLException("Dateigröße darf maximal 250kb betragen.");
}
if (fileIsEmpty())... |
0c12f04a-ab0d-45c0-b561-a74c8507f6ef | 8 | boolean isSystemObjectDifferent(SystemObjectProperties property, SystemObject systemObject) {
final SystemObjectType propertyType = getType(property.getType());
// Typ vergleichen
if(propertyType != systemObject.getType()) {
_debug.finer("Der Typ des konkreten Objekts " + systemObject.getPidOrNameOrId() + " p... |
60052d2b-8296-4636-b1a3-e2001ba8e4b2 | 7 | public Audio(HtmlMidNode parent, HtmlAttributeToken[] attrs){
super(parent, attrs);
for(HtmlAttributeToken attr:attrs){
String v = attr.getAttrValue();
switch(attr.getAttrName()){
case "autoplay":
autoplay = Autoplay.parse(this, v);
break;
case "controls":
controls = Controls.parse(thi... |
d0c7c008-2f60-41f4-b552-683b579d19eb | 3 | @Override
public void move(Excel start, Excel finish) {
// TODO Auto-generated method stub
for(int i=0;i<allex.size();i++)
{
if (start.getX() == allex.get(i).getX() && start.getY() == allex.get(i).getY())
{
allex.remove(i);
allex.add(i, finish);
setColoredExes();
break;
}
}
} |
1423ff28-16d4-4c0a-8925-d9fab8cc040d | 8 | private void killPanda()
{
if (panda.getX()==fire.getX() && panda.getY()==fire.getY() && !fire.isHide() && !panda.isDied())
{
panda.die();
spandadie.play();
}
if (panda.getX()==arrow.getX() && panda.getY()==arrow.getY() && !arrow.isHide() && !panda... |
bba8d650-4f82-4b31-9f17-d90ef8c6ce01 | 1 | public Object arbitrary(Random random, long size)
{
int arraySize = (int) Arbitrary.random(random, 0,
Math.min(Integer.MAX_VALUE, size));
int[] dimensions = new int[dimension];
for (int i = 0; i < dimension; ++i) {
dimensions[i] = a... |
5996d2e0-3077-4cb3-a2cc-b5d0074b950f | 7 | private int partition(int[] arrayIn, int lhs, int rhs, SorterParams.SortDirection sortDir)
{
int pivot = arrayIn[lhs + (rhs - lhs) / 2];
int i = lhs;
int j = rhs;
MemoryUsage.addMem(3);
while(i <= j)
{
if(sortDir == SorterParams.SortDirec... |
33d901bf-d15f-4cdc-9f9d-68ac698dd70e | 1 | private static FrequencyTable getFrequencies(byte[] b) {
FrequencyTable freq = new SimpleFrequencyTable(new int[3]);
// InputStream input = new BufferedInputStream(new FileInputStream(file));
for (byte x : b) {
freq.increment(x & 0xFF);
}
freq.increment(2);
// try {
// while (true) {
// int b = ... |
582f9175-8c35-4112-8113-342e41c12f4b | 3 | private void relockBootloader_fastbootButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relockBootloader_fastbootButtonActionPerformed
JOptionPane.showMessageDialog(null, parser.parse("relockBootldr:msg"), parser.parse("lockBootldr:msgTitle"), JOptionPane.INFORMATION_MESSAGE);
Str... |
c0a29d77-4f69-40e5-9f29-84cdf1cfcd61 | 0 | public Set<Task> getTasks() {
return tasks;
} |
be578e97-a465-4366-a6bb-0b6908cfe47a | 0 | public void insertRandom(List<Element> items){
firstFitItems(shuffleList(items));
} |
7f7060b9-c205-476a-9b0d-748e84d27a77 | 2 | private final void parseEndTag() throws IOException {
int pos;
read(); // '<'
read(); // '/'
mName = readName();
pos = mStack.size() - 1;
if (pos < 0) {
fail("element stack empty"); //$NON-NLS-1$
}
if (mName.equals(mStack.get(pos))) {
mStack.remove(pos);
} else {
fail("expected: " + mStack.g... |
57211f59-1608-43c7-acf9-32fc4c319f75 | 1 | * The type of the LocalExpr
*/
public LocalExpr newStackLocal(final int index, final Type type) {
if (index >= nextIndex) {
nextIndex = index + 1;
}
return new LocalExpr(index, true, type);
} |
eb1fc9f6-03b6-46c9-9dfb-03bb5fa38d71 | 3 | public void setUndefinedIds(Long id,long hash)
{
for (InsertionObject i : buffer)
{
if (i.getParentId() == null && i.getParentHash()==hash)
{
i.setParentId(id);
}
}
} |
cbbe5020-3e0b-4942-bed5-62c22bd89d5d | 4 | public void spawnRateMedium()
{
if (spawnCounter > 300) {
spawnCounter = 0;
double spawnRandom = Math.random();
if (spawnRandom <= 0.33)
{
Boat b1 = new Boat(30,1,600,exit1);
addObject(b1,800,61);
} else if (spawnR... |
8182b6a8-858a-443f-b7de-98c889c07bf3 | 8 | public WorldChunk getChunkAt(int x, int y, boolean b)
{
int chunkID =(int) Math.floor(((float)x/16f));
WorldChunk chunk = this.chunksList.get(chunkID);
if(chunk == null && b)
{
chunk = new WorldServerChunk(this, chunkID);
((WorldServerChunk)chunk).stopUpdate =... |
81d4ea1a-ce23-4f7e-a641-046916282045 | 9 | private void handleKeys(ArrayList<KeyButtons> keyPressed, boolean setter)
{
if (keyPressed.contains(KeyButtons.LEFT))
{
mario.setLeft(setter);
}
if (keyPressed.contains(KeyButtons.RIGHT))
{
mario.setRight(setter);
}
if (keyPressed.conta... |
88b203c2-3d15-422e-98c4-dea0989d1663 | 0 | public FileSystemFind() {
crawler = new DirectoryCrawler();
} |
e1c7a20a-fd6a-493a-8548-7abf16bd8654 | 3 | void onArrowLeft (int stateMask) {
if (horizontalOffset == 0) return;
int newSelection = Math.max (0, horizontalOffset - SIZE_HORIZONTALSCROLL);
update ();
GC gc = new GC (this);
gc.copyArea (
0, 0,
clientArea.width, clientArea.height,
horizontalOffset - newSelection, 0);
gc.dispose ();
if (header.getVisib... |
08cf0617-35ef-4b79-8cba-3587161ac6f6 | 7 | public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
String[] queue = plugin.queue;
if (args.length == 0) {
if (sender.hasPermission("SimpleQueues.addself")) {
if (Arrays.asList(queue).contains(sender.getName())) {
sender.sendMessage("You are already in the queue.")... |
fc18a8f2-633f-48bd-87ab-401c7ffa318f | 8 | @EventHandler(priority = EventPriority.MONITOR)
public void adminJoin(PlayerJoinEvent event)
{
try
{
if(!enabled || !lock.compareAndSet(false, true))
return;
Player p = event.getPlayer();
String[] out;
if(needUpdate)
{
if(hasPermission(p, "autoupdate.announce"))
{
out = new String[] {
... |
0c86c07a-52ad-43b5-b9bf-70d13a91af02 | 8 | public static BufferedReader queryCDD (String dataType, String query) throws Exception {
URL url = new URL(CDD_BATCH_URL);
String queryString = CDD_BATCH_QUERY+"&tdata="+dataType+query;
// System.out.println("Querying "+CDD_BATCH_URL+" with query: \n-->"+queryString);
HttpURLConnection con = (HttpURLConnection)... |
40892571-f96c-4721-bc1c-fcb1d813c964 | 6 | public static void addData(float x, float y, float size, int id) {
data.put(id, new ChartItem(new PVector(x, y), size, id));
// Update MAX and MIN values
minX = (x < minX) ? x : minX;
minY = (y < minY) ? y : minY;
minSize = (size < minSize) ? size : minSize;
maxX = (x > maxX) ? x : maxX;
maxY = (y > maxY... |
ff45d33d-3498-470d-8483-d95a4a16e53e | 1 | public String[] copy(String[] board){
String[] newboard = new String[board.length];
for(int i = 0 ; i<board.length ; i++){
newboard[i] = board[i].substring(0);
}
return newboard;
} |
f9fd4216-8b11-458d-8bc2-ddcb11bbfba6 | 8 | private void ensurePossible(int x, int y) {
int newCharSize1 = charSize1;
int newCharSize2 = charSize2;
while (x >= newCharSize1) {
newCharSize1 *= 2;
}
while (y >= newCharSize2) {
newCharSize2 *= 2;
}
if (newCharSize1 != charSize1 || newCharSize2 != charSize2) {
final char newChars[][] = new cha... |
102bf14f-74ed-4a54-b0da-4d097a4c6988 | 5 | public Admin() {
// initializing components
setTitle("Conference Room Booking System");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
SpringLayout sl_contentPane ... |
7adef037-c1a1-423d-a4ae-2cfc0b2be0bf | 4 | private final void acceptConnection(final SelectionKey key, MMOConnection<T> con)
{
ServerSocketChannel ssc = (ServerSocketChannel) key.channel();
SocketChannel sc;
try
{
while ((sc = ssc.accept()) != null)
{
if ((_acceptFilter == null) || _acceptFilter.accept(sc))
{
sc.configureBlocking(... |
eadaf549-0e39-47ce-90e0-bd5b87c59d4a | 9 | public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
if (headA == null || headB == null)
return null;
ListNode tempA = headA;
while (tempA.next != null) {
tempA = tempA.next;
}
tempA.next = headB;
ListNode fast = headA;
ListNode slow = headA;
while (fast != null && fast.next != nu... |
44359e7c-fe35-45ef-93b3-8aea9ecf9507 | 5 | private CoastlineNode getNodeInformation(Attributes attributes) {
String idStr = attributes.getValue("id");
String latStr = attributes.getValue("lat");
String lonStr = attributes.getValue("lon");
// Avoid null pointer reference!
if (idStr != null && latStr != null && lonStr != nu... |
abc51bcc-c20b-4f14-ba7c-647f1a306693 | 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... |
e690d82e-f7a0-44dc-895b-22b2cc8bde0c | 6 | public void dir(){
try{
if( file.exists() && file.isDirectory() ){
File files[] = file.listFiles();
int cf = 0, cd =0;
long slengths = 0;
for( File f : files ){
Date ultima = new Date( f.lastModified... |
f4ff0979-cb9e-41d7-9554-6a0f9ac1ae84 | 6 | public void shrink(final Object o, final Method m, final Object[] args) {
try {
Object r = m.invoke(o, args);
if(r instanceof SingleTestResult) {
SingleTestResult result = (SingleTestResult)r;
if(!result.isDiscarded && (result.expect != result.ok)) {
}
}
} catch (I... |
e9ad448f-8cb5-436c-b998-a0dc54e1022f | 4 | final public void run() {
server.clientConnected(this);
// This loop reads the input stream and responds to messages
// from clients
try {
// The message from the client
Object msg;
while (!readyToStop) {
// This block waits until it reads a message from the client
// and then sends it for ha... |
2ed04b2a-9be0-4e85-a23c-073904dc89b6 | 1 | public static String dumpByteArray(byte[] bytes) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i < bytes.length; i++) {
byte b = bytes[i];
int iVal = b & 0xFF;
int byteN = Integer.parseInt(Integer.toBinaryString(iVal));
sb.append(String.format("%1$02d: %2$08d %3$1c %3$d\n" , i, byteN, iVal));... |
98e22278-435b-4083-b3ab-9eb1aa0388ba | 5 | void notifyRefreshFiles(File[] files) {
if (files != null && files.length == 0) return;
if ((deferredRefreshRequested) && (deferredRefreshFiles != null) && (files != null)) {
// merge requests
File[] newRequest = new File[deferredRefreshFiles.length + files.length];
System.arraycopy(deferredRefreshFiles, ... |
5facabd3-8cc7-4dd7-95db-9105a46c871c | 0 | public void reset() {
start();
} |
4c439391-7603-42a8-a568-3f8dce9272c7 | 8 | public void draw(Graphics2D g2) {
if (bImage == null) {
File imageFile = new File(baseDir + imageFileName);
try {
bImage = ImageIO.read(imageFile);
} catch (IOException e) {
e.printStackTrace();
}
}
if(firing)
frames = 2;
else
frames = 3;
if (xIncrement > frames) {
xIncrement ... |
5463a33b-7040-4c1d-ad9a-4d7eb39fb628 | 3 | public void saveConfig() {
if (fileConfiguration == null || configFile == null) {
return;
} else {
try {
getConfig().save(configFile);
} catch (IOException ex) {
plugin.getLogger().log(Level.SEVERE,
"Could not save config to " + configFile, ex);
}
}
} |
4b436152-9b47-4381-8c01-7e37e1a8f292 | 4 | public Location getCorner(int i) {
switch (i) {
case 1: return loc1;
case 2: return loc2;
case 3: return loc3;
case 4: return loc4;
}
return null;
} |
ca31dea0-41fe-4a7b-8843-3e69b8d6d738 | 5 | public List<String> letterCombinations(String digits) {
String[] mapping = {"abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"};
List<String> result = new ArrayList<String>();
if (digits == null || digits.length() == 0) {
return result;
}
int a = digits.charAt... |
75f305d7-976b-48dc-8eb3-f6c08406967e | 1 | private String loginUser(String name, String cmd,String pass) throws InterruptedException, IOException {
readUntil(GosLink2.prps("puser"));
write(name);
readUntil(GosLink2.prps("ppass"));
write(pass+"\r\n");
readUntil(GosLink2.prps("pmenu"));
if (ghost == 1){
write("=x\n");
ghost=0;
return "reload"... |
e96503f6-80fe-411a-8d40-cdc52c8de096 | 4 | public int removexattr(ByteBuffer path, ByteBuffer name) {
if (xattrSupport == null) {
return handleErrno(Errno.ENOTSUPP);
}
String pathStr = cs.decode(path).toString();
String nameStr = cs.decode(name).toString();
if (log != null && log.isDebugEnabled()) {
... |
42eae3e0-de57-4648-8395-2c56d6a34a09 | 2 | private void writeImage() throws IOException {
int pImage[] = new int[height * height];
for (int row = 0, count = 0; row < height; row++) {
for (int col = 0; col < width; col++) {
pImage[count] = rgbArray[row][col];
count++;
}
}
img... |
488168c6-6ac8-480a-bdf2-ce5375f34b9f | 5 | public ItemID setType(int t) throws ShellLinkException {
if (t == TYPE_CLSID) {
type = t;
clsid = mycomputer;
return this;
}
if (t == TYPE_FILE || t == TYPE_DIRECTORY || t == TYPE_DRIVE || t == TYPE_DRIVE_OLD) {
type = t;
return this;
}
throw new ShellLinkException("wrong type");
} |
ba7c37f2-3241-493d-9905-cf7cc954ee14 | 0 | public String getDescription() {
return description;
} |
dae28db7-9ffb-4251-a4f2-66a8ebb398cc | 4 | public ArrayList<Pizza> haePizzat() throws DAOPoikkeus {
ArrayList<Pizza> pizzat = new ArrayList<Pizza>();
// avataan yhteys
Connection yhteys = avaaYhteys();
try {
// Haetaan tietokannasta Pizzat ja täytteet
String pizzaSQL = "select Tuote.nimi, Tuote.numero, Tuote.hinta, Tuote.tuoteID, Tuot... |
3265798d-ee72-45d8-a10f-211ad470f228 | 1 | public boolean setShutdownButtonWidth(int width) {
boolean ret = true;
if (width < 0) {
this.buttonShutdown_Width = UISizeInits.SHD_BTN.getWidth();
ret = false;
} else {
this.buttonShutdown_Width = width;
}
somethingChanged();
return... |
b1bf677e-d219-48d3-b21c-9cc278553dec | 9 | private void visitParameterLoad(Parameter parameter) throws JavaBytecodeCompilerException {
if (parameter instanceof ObjectParameter) {
Object value = parameter.evaluate();
Integer intValue = (Integer) value;
switch (intValue) {
case 0:
met... |
ca13e7fd-1b83-4e53-bb25-a84e38308da4 | 5 | public static void main(String[] args)
{
if (System.getProperty("os.name").indexOf("Mac") == -1)
{
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
... |
a185b44e-3b94-4c57-b0ab-31c69cc76c04 | 8 | public int getBoardCommentaryCount(int idx) throws Exception{
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs =null;
int result = 0;
String sql = "";
try{
conn = getConnection();
sql = "select count(*) from foodcommentary where idx=?";
pstmt = conn.prepareStatement(sql);
pst... |
b0c1d997-cdf3-4d7c-a1b3-457c7ff7b49d | 7 | private static Set<Class<?>> getAllRelatedClassesOf(Class<?> c) {
Set<Class<?>> a = new LinkedHashSet<>();
a.add(c);
for (Class<?> class1 : c.getInterfaces())
a.addAll(getAllRelatedClassesOf(class1));
Class<?> superClass = c.getSuperclass();
if (superClass != null)
... |
d09ea5ed-2efc-41b5-bb20-9e1c573bec23 | 9 | final private boolean jj_3R_25() {
Token xsp;
xsp = jj_scanpos;
if (jj_3R_27()) {
jj_scanpos = xsp;
if (jj_3R_28()) {
jj_scanpos = xsp;
if (jj_3R_29())
return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos)
return false;
}
else if (jj_la == 0 && jj_scanpos == jj_lastpos)
re... |
692786ba-2925-4c3c-aba0-78bf56fad8fc | 8 | public static String simpleFormatted(byte[] data){
if(data == null) return null;
String simpleStr;
simpleStr = "";
String binary = getBinary(data);
String hex = getHex(data);
byte[] bytes = data;
int len = hex.length() / 2;
int step = 4;
int count = (int) Math.ceil(len / step);
for(int i = 0; i < co... |
28138e2c-e7bd-4dcb-9217-9ee1068392ed | 8 | public boolean sendMessage(String mobileNumber, String message) {
if(message.length()>140) return false;
Map params=new HashMap();
params.put("Token", this.token);
nav.setReferer(nav.getCurrentDomain().toExternalForm()+"Main.action?id="+this.token);
Response res... |
5d9c855a-25fc-479f-95f9-8a7a5346d46c | 4 | public GUI(Sprinkles s){
super("Sprinkles");
this.s = s;
this.setSize(200, 200);
this.setTitle("Sprinkles");
this.setJMenuBar(createMenubar());
this.s = s;
this.s.setGui( this );
left = new JScrollPane( new JPanel() );
right = new JScrollPane( new JPanel() );
left.setHorizontalScrollBarPoli... |
7703d366-a44c-4dce-904b-265191c543ee | 7 | @Override
public String breakOutMaskString(String s, List<String> p)
{
String mask="";
int x=s.toUpperCase().lastIndexOf("MASK=");
if(x>=0)
{
mask=s.substring(x+5).trim();
int i=0;
while((i<p.size())&&(p.get(i).toUpperCase().indexOf("MASK=")<0))
i++;
if(i<=p.size())
{
final String pp=p.... |
959eaa81-753a-493d-b1e6-7399d3b98fe7 | 0 | @Override
@RequestMapping(value = "/beers", method = RequestMethod.GET)
@ResponseBody
public BeerResponseList list() {
Collection<Beer> beers = persistenceService.list(Beer.class);
return BeerResponseList.create(beers);
} |
cfe6b00f-5c1e-4fdc-8dc4-675a3913b475 | 9 | private void matchStereochemistryToAtomsAndBonds(Element stereoChemistryEl) throws StructureBuildingException, StereochemistryException {
String stereoChemistryType =stereoChemistryEl.getAttributeValue(TYPE_ATR);
if (stereoChemistryType.equals(R_OR_S_TYPE_VAL)){
assignStereoCentre(stereoChemistryEl);
}
else ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.