method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
8eb3ec27-f366-42f2-8a39-99af05124ab0 | 1 | @Override
public void run() {
for (int i = 0; i < 1000; i++) {
uidb.occurence();
}
} |
5efadc6f-ad1f-4f53-bd60-155256db0ad7 | 4 | public void mouseClicked(MouseEvent e) {
int column = jtSaves.columnAtPoint(e.getPoint());
ArrayList <Map> unsortedList = saves;
ArrayList <Map> sortedList;
boolean sens = sortWay[column];
switch (column) {
case 0:
sortedList = Tri.sortByName(unsortedList, sens);
updateTable(sortedList);
... |
fd987754-609d-4854-8e47-d2afd38175de | 2 | private void copyEntry(final InputStream is, final OutputStream os)
throws IOException {
if (outRepresentation == SINGLE_XML) {
return;
}
byte[] buff = new byte[2048];
int i;
while ((i = is.read(buff)) != -1) {
os.write(buff, 0, i);
}
} |
f3b02fe9-c72f-48f1-8e4f-3c66b3df1cce | 4 | public JFrame getChooseFrame() {
boolean test = false;
if (test || m_test) {
System.out.println("GameSelecter :: getChooseFrame() BEGIN");
}
if (test || m_test) {
System.out.println("GameSelecter :: getChooseFrame() END");
}
return m_choose;
} |
7adf2a03-067b-498a-9a01-73dbd9d05606 | 7 | private static ValueTypePair[][] loadGrazingSubbasinData(ValueTypePair[][] vtp, Statement inA, Statement inB, String subGrz, String grzArea) {
ValueTypePair[][] vTemp = new ValueTypePair[vtp.length * 20][3];
HashSet ids = new HashSet(), subs = new HashSet();
int index = 0;
for (ValueType... |
349c99bb-c239-4c00-a58d-d5718aeb4308 | 9 | public PreferencesModel(Preferences preferencesRoot, int numberOfIpsToStore) {
_preferencesRoot = preferencesRoot;
_numberOfIpsToStore = numberOfIpsToStore;
// gibt es Einträge in den Preferences zu IP und Port ? Wenn nein -> Default-Werte localhost:8083
try {
String[] children = _preferencesRoot.childr... |
1094369e-b114-4c19-8856-c69f9c84c335 | 1 | public BufferedImage getSprite() {
if (moveX==0)
return stand;
return walk.sprite;
} |
2df7a5dd-1819-4ad2-968c-774d778d7ff0 | 7 | public void loadBlockList()
{
RegenPlugin.get().getLogger().info(RegenPlugin.get().getName() + ".LoadBlockList() fileName: " + BLOCK_LIST_FILE);
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder;
try {
docBuilder = dbfac.newDocumentBuilder();
} ... |
3e9345ce-d191-46f8-8604-de821c54a69b | 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... |
6e5206ac-8663-49f4-9750-3f65b659263e | 3 | public static void main(String[] args) {
long start = System.nanoTime();
String num = "7316717653...2963450"; // Edited out most of the number. The problem with the full number can be found here:
int max = 1, current = 1; // http://projecteuler.net/problem=8
for(int i = 0; i + 4 < num.length(); i++){... |
a1e409fc-a835-4f55-ae3d-8509be91d122 | 5 | public static String getFieldName(String _name, boolean erveryBigWord) throws Exception {
char[] nameChars = _name.toCharArray();
StringBuffer sb = new StringBuffer("");
for (int i = 0; i < nameChars.length; i++) {
if (StringUtil.isBigChr(nameChars[i])) {
if (i > 0 &&... |
caa909a9-7448-49ad-97c8-f12047c7d89f | 7 | public void run(){
if(! hasStarted()){
Property<String> outputFileProp = getFirstProperty("output-file");
if((outputFileProp == null) || (outputFileProp.getValue() == null)){
die("OutputAdapter requires an output-file property.");
}
File outputFile = new File(outputFileProp.getValue());
String ... |
78abf1b9-bc9a-4136-8e1c-9941f3fb083b | 1 | public Pet[] createArray(int size) {
Pet[] result = new Pet[size];
for(int i = 0; i < size; i++)
result[i] = randomPet();
return result;
} |
f493b2b5-7f12-48e4-b958-77ab9a782679 | 1 | public void setPasswordfieldRightshift(int shift) {
if (shift < 0) {
this.passwordfieldRightshift = UIShiftInits.PWAREA_RIGHT.getShift();
} else {
this.passwordfieldRightshift = shift;
}
} |
dda248ca-5d97-4875-a219-a69c044626c5 | 3 | private int getPort() {
int port = uri.getPort();
if( port == -1 ) {
String scheme = uri.getScheme();
if( scheme.equals( "wss" ) ) {
return WebSocket.DEFAULT_WSS_PORT;
} else if( scheme.equals( "ws" ) ) {
return WebSocket.DEFAULT_PORT;
} else {
throw new RuntimeException( "unkonow scheme" + ... |
6538d07c-df2d-413d-8602-4a304a6b7268 | 5 | public String formatMessage(ChatPlayer player, String message) {
String output = "";
String format = getFormat();
ProxiedPlayer p = player.getPlayer();
if (CommandUtil.hasPermission(p, NicknameCommand.PERMISSION_NODES)) {
output = format.replace("%player", player.getDisplayName());
} else {
output = ... |
1546e9b9-6cad-4da8-b0a9-186cc21441af | 7 | public static void start(final int i) {
new Thread() {
public void run() {
try {
clojure.lang.Compiler.load(new FileReader(
"src/Clojure_Bindings.clj"));
} catch (Exception e1) {
e1.printStackTrace();
}
while (true) {
ServerSocket serv = null;
Socket sock = null;
try... |
79cbaea6-91c0-494e-8882-05c16dc52da9 | 6 | private float getReducedDecodingHeight(int row, int col) {
ArrayList<AxisPairMetrics> amList =parameterizedDisplay.getMetricsList();
Collections.sort(amList, new SortMetrics(MetaMetrics.DistanceEntropy));
int firstQuartile = metricsList.size()/4;
int thirdQuartile= (3*metricsList.size())/4;
float newBoxHeig... |
8fcb33a7-c127-46eb-803d-e90a1551a359 | 8 | public static void main(String[] args) throws IOException {
Game.AgentsCreation();
int i;
int teams_count =0;
System.out.println("***********************************************************");
System.out.println("Battle is about to start. All agents stats: ");
for (i=0; i<Game.number_of_agen... |
aef84918-4a60-45c6-a89d-943e535d0d38 | 7 | public static void downloadOrUpdateInstaller(IMonitor monitor, String host, File dest, boolean update)
{
String fileName = "unknow";
byte[] buffer = new byte[65536];
try
{
URL url = new URL(host);
URLConnection urlconnection = url.openConnection();
... |
564516d1-bdfa-4bd1-ad9c-fb0bcb2efe72 | 4 | @Test
public void testPreAuthorization() {
Gateway beanstream = new Gateway("v1", 300200578,
"4BaD82D9197b4cc4b70a221911eE9f70");
CardPaymentRequest paymentRequest = new CardPaymentRequest();
paymentRequest.setAmount(90.00);
paymentRequest.setOrderNumber(getRandomOr... |
1bd5fafb-94de-4191-b203-07639f6f563f | 0 | public double evaluate(double x) {
return Math.pow(x, _power);
} |
e9aa9d41-db7f-4681-9756-ca8628c2d148 | 7 | public void decorateChunk(WorldChunk chunk, World w, Random rand)
{
int randInt = 0;
int theTop = 0;
for(int i = 0 ; i < 16 ; i++)
{
randInt = rand.nextInt(10);
theTop = chunk.getMaxHeight(i) + 1;
if(w.getBlockAt(16 * chunk.chunkID + i, theTop).equals("air"))
{
if(randInt == 3)
{
... |
acb5908e-b0ec-4609-81d9-5680ef99523e | 6 | protected final void writePacket(final SelectionKey key, final MMOConnection<T> con)
{
if (!prepareWriteBuffer(con))
{
key.interestOps(key.interestOps() & ~SelectionKey.OP_WRITE);
return;
}
DIRECT_WRITE_BUFFER.flip();
final int size = DIRECT_WRITE_BUFFER.remaining();
int result = -1;
tr... |
4c12ed97-de04-4c2d-a8ef-4e63e86730c1 | 9 | public Systemereignis theoriestundeEintragen(int thema, Date beginn) {
ArrayList<Fahrlehrerindaten> fahrlehrerin = ressourcenverwaltung.get_fahrlehrerin();
Date end = (Date) beginn.clone();
end.setMinutes(beginn.getMinutes()+90);
for (int i=0;i<this.theoriestunde.size();i++) {
Theoriestunde stunde = this.the... |
0df54d5e-b618-4a03-87cd-bc28bcbd3e2f | 8 | public char translateFrom (final Cell other) {
if (other.row - 1 == row && other.col == col) {
return 'D';
} else if (other.row + 1 == row && other.col == col) {
return 'U';
} else if (other.row == row && other.col - 1 == col) {
return 'L';
} else ... |
5261ff61-8825-4b89-8f1f-b5ee049aba02 | 1 | @Override
public void render(Graphics g) {
super.render(g);
if (shouldRender) {
hudManager.playerRender(g, positionX + PAPERDOLL_X, positionY + PAPERDOLL_Y, true);
}
} |
0ccb20f1-4c46-4cdd-a659-ade2538b5a39 | 2 | public void showUsage(Command command, CommandSender sender, boolean prefix) {
CommandInfo info = command.getClass().getAnnotation(CommandInfo.class);
if (!plugin.has(sender, info.permission())) return;
sender.sendMessage((prefix ? "Usage: " : "") + info.usage() + " " + ChatColor.YELLOW + info.... |
4bd46ea3-16b5-4e29-b825-0471b2de365c | 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... |
6c9f207b-1b57-4df4-98a0-1a74b3dca3c2 | 3 | public int compareTo(BitFeld b) {
/*
* liefert 1, falls |this| > |b| 0, falls |this| = |b| -1, falls |this|
* < |b|
*/
/* Arrays Bitweise vergleichen */
for (int i = this.size - 1; i >= 0; i--) {
if (this.bits[i] & !(b.bits[i]))
return 1;
if (!(this.bits[i]) & b.bits[i])
return -1;
}
... |
077619ca-91f9-435b-8aca-326e13a971a7 | 0 | public Animal getPredator(int index) {
return predators.get(index);
} |
8fb8bc47-d1ba-41e8-8239-4cbd5b5c074d | 3 | public static Object call_method(Object object, String methodName) {
Object retObj = null;
try {
Class<?> cls = object.getClass();
Class<?> partypes[] = new Class[0];
Method meth = cls.getMethod(methodName, partypes);
Object arglist[] = new Object[0];
retObj = meth.invoke(object, arglist);
} catch ... |
692d5c46-c42e-4687-a960-e87c57ea1273 | 7 | public boolean remove(Unit unit) {
int tolerance = 20;
int remaining = building.getRemainingTrainTime();
boolean buildIsDone = false;
if (remaining != 0) {
for (UnitType type : ableToBuild) {
if (type.buildTime() - tolerance <= remaining
&& remaining <= type.buildTime()) {
buildIsDone = true;
... |
2f5b3ffc-832b-4760-bc97-eb671cfe2b5e | 8 | public void update(double[] y) {
if (numPoints < N) {
// Just add this point to the end - not saturated and don't have to scroll yet!
for(int p = 0; p < numPlots; p++) {
y_vals[p][numPoints] = y[p];
}
numPoints++;
} else {
// Scroll all the points over by 1, and then add it
for(int i = ... |
14a99873-3cd3-43ed-a8ad-db2126bac27e | 4 | private void skipToEndOfLine() throws IOException {
while (pos < limit || fillBuffer(1)) {
char c = buffer[pos++];
if (c == '\n') {
lineNumber++;
lineStart = pos;
break;
} else if (c == '\r') {
break;
}
}
} |
3538c469-e896-4ad5-81ce-9c7b66b6b49c | 3 | static Method getDeclaredMethod(final Class clazz, final String name,
final Class[] types) throws NoSuchMethodException {
if (System.getSecurityManager() == null)
return clazz.getDeclaredMethod(name, types);
else {
try {
return (Method) AccessControlle... |
74481024-91fb-40a4-81cb-966eabafacca | 8 | @Override
public void spring(MOB target)
{
if((target!=invoker())&&(target.location()!=null)&&(text().length()>0))
{
if((doesSaveVsTraps(target))
||(invoker().getGroupMembers(new HashSet<MOB>()).contains(target)))
target.location().show(target,null,null,CMMsg.MASK_ALWAYS|CMMsg.MSG_NOISE,L("<S-NAME> avoi... |
9556beea-239d-4d00-a589-fb07faecbc2a | 3 | public void onStartPage(PdfWriter writer, Document document) {
if (!this.texts.isEmpty()) {
Phrase nullphrase = new Phrase(this.marginTop, "\n是\n");
try {
document.add(nullphrase);
} catch (DocumentException e) {
e.printStackTrace();
}
for (int i = 0; i < texts.size(); ++i) {
float xper = (... |
aae67607-d0e5-4ba9-8765-b55baca7e359 | 9 | private void readTotalSpend()
{
try
{
CsvReader csvReader = new CsvReader(sourceFileTotalSpend);
if(csvReader.readHeaders() == true)
{
while(csvReader.readRecord()==true)
{
//apar_id,apar_name,address,place,province,Country_code,zip_code,telephone_1,comp_reg_no,acctype
// TODO : constant... |
b7a40703-ec49-4549-ae12-dde85baef282 | 1 | void add(long n) {
if (arrIndx == len) {
arrIndx = 0;
listIndx++;
list.add(new long[len]);
}
list.get(listIndx)[arrIndx] = n;
arrIndx++;
} |
963f14cf-e1e0-426b-a849-facb7987d06e | 9 | @Override
protected void toASCII(StringBuilder ascii, int level) {
indent(ascii, level);
NSObject[] array = allObjects();
ascii.append(ASCIIPropertyListParser.ARRAY_BEGIN_TOKEN);
int indexOfLastNewLine = ascii.lastIndexOf(NEWLINE);
for (int i = 0; i < array.length; i++) {
... |
9ce42619-90b5-4901-bccc-d23453d2be95 | 3 | private void beginGame()
{
Empire.SoundsOfEmpire.playIntroMusic();
final JFrame begFrame = new JFrame();
begFrame.setSize(new Dimension (20,20));
begFrame.setIconImage(Toolkit.getDefaultToolkit().getImage(RomanLegion.class.getResource("graphics/legionist_icon.png")));
begFrame.setVisible(false);
... |
02e1bc9b-d43c-4caf-ad23-1f9bedb7f027 | 8 | public Response serve( String uri, String method, Properties header, Properties parms, String data )
{
try{
String response_string=null;
if(data!=null){
System.out.println(DateFormat.getTimeInstance(DateFormat.FULL).format(Calendar.getInstance().getTime()));
System.out.println("Command: " + data);
... |
5405cbdd-6b2c-422b-bb2c-e9de2d31a8c2 | 0 | public Dimension getPreferredSize() {
return new Dimension(22 * x, 22 * y);
} |
a3107840-4cfc-40d7-8241-d5f11e326c1b | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
final Room R=mob.location();
if((R!=null)&&(!R.getArea().getClimateObj().canSeeTheMoon(R,null)))
{
if((R.getArea().getTimeObj().getTODCode()!=TimeClock.TimeOfDay.DUSK)
&&(R.getArea().getTimeObj().getTODCode()!=TimeClo... |
9089b27c-75e2-452d-b232-80c5afa64e51 | 6 | public static boolean pnpoly(int npol, float[] xp, float[] yp, float x, float y)
{
int i, j;
boolean c = false;
for (i = 0, j = npol-1; i < npol; j = i++) {
if ((((yp[i] <= y) && (y < yp[j])) ||
((yp[j] <= y) && (y < yp[i]))) &&
(x < (xp[j] - xp[i]) * (y - yp[i]) /... |
b6dbc9f1-7a8c-4034-9bc8-0d0a1753e7a4 | 3 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((declaration == null) ? 0 : declaration.hashCode());
result = prime * result + ((ident == null) ? 0 : ident.hashCode());
result = prime
* result
+ ((statementSequence == null) ? 0 : statementSequenc... |
14584333-0be7-4d7d-9d1c-62cd252fd058 | 8 | private void ConsultaBDNaoConformidadeSelect( ){
int idNaoConformidade = 0;
int idContResultado = 0;
int idFuncionario = 0;
String dataNaoConform = "";
String ocorrencia = "";
String medidaCorrecti = "";
String resultado = "NC";
S... |
018aa222-1c4c-4814-aad2-fcbc7a2627e5 | 1 | public int getIndex() {
if (mParent != null) {
return mIndex;
}
return -1;
} |
46e285d3-e158-48dd-a5dc-e9be3d16b82c | 5 | public static void main(String[] args)
{
int x, y, r, proceso;
x = Integer.parseInt(JOptionPane.showInputDialog("Ingrese un Valor Entero para 'X':"));
y = Integer.parseInt(JOptionPane.showInputDialog("Ingrese un Valor Entero para 'Y':"));
if ((x <= 0) || (x > 255))
{
... |
3a0d1c5c-0517-4391-b9a4-677557bee27d | 1 | public void inicio(PalavraChave palavrachave) throws Exception
{
salvar = new JButton("Salvar");
id = new JTextInt(palavrachave.getId());
id.setEditable(false);
id.setEnabled(false);
palavra = new JTextField(palavrachave.getPalavra() == null ? ""
: palavrachave.getPalavra());
JPanel pp = new JPanel();... |
16b17d69-3862-493b-905a-c248b2e38ca2 | 7 | public static int getType(Neuron n){
if(n instanceof InputNeuron_Add)
return 1;
if(n instanceof OutputNeuron_Add)
return 2;
if(n instanceof Neuron_Add)
return 3;
if(n instanceof DistanceThresholdChecker)
return 4;
if(n instanceof Pi... |
790d903b-dc91-478e-a6fa-1642bfbbe89a | 5 | public static void SortOrbitals()
{
for (int x = 0; x < Ops.getOrbitalClasses().size(); x++)
{
switch (Ops.getOrbitalClasses(x).GetHZRating())
{
case 1:
HotOrbitals.add(x);
break;
case 2:
HZOrbitals.add(x);
break;
case 3:
ColdOrbitals.add(x);
break;
case 4:
... |
c25b1b49-7ef4-4c20-9ead-1765da180f98 | 5 | public int getPerceptIndex( String percept ){
if( percept.equals(SOLVED) ){
return (getPerceptsNumber() - 1);
}else{
int[] values = new int[2];
int k = 0;
try {
StreamTokenizer tokenizer = new StreamTokenizer(new StringReader(
... |
840a4a76-596f-4090-815f-72c68f9dbfaf | 0 | public int getType() {
return mType;
} |
b2f2452c-717a-4220-a4e9-55c47c493895 | 1 | @Override
public void configure(AbstractCommand command, String[] args) {
TimeBanHelpCommand helpCommand = (TimeBanHelpCommand) command;
if (args.length >= 1) {
helpCommand.setManPage(args[0]);
} else {
helpCommand.setManPage("help");
}
} |
e6899f38-d39a-4015-a65a-52c27daca233 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
1a882b5e-20e6-4607-9488-a9db226c0dcc | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof News)) return false;
News news = (News) o;
if (id != news.id) return false;
if (!annotation.equals(news.annotation)) return false;
if (!author.equals(news.author)) return false;
if (!category.equals(news.category... |
c8832986-fd7d-408c-9ae6-9984a9ac9395 | 4 | public void paint(Graphics g){
//ここに描画処理を書きます。
Color bgcol = new Color(220,220,220);
setBackground(bgcol);
g.setColor(Color.BLACK);
g.drawLine(0, (int)dmax.get(1,0) - 100, (int)dmax.get(0, 0), (int)dmax.get(1, 0) - 100); //
g.drawLine(100 , 0, 100, (int)dmax.get(1, 0)); //y軸
int zeropointx = 100;
int... |
008e324d-e81c-4981-b07b-f696f6c821f6 | 7 | public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4)
{
int var5 = par1World.getBlockId(par2, par3 - 1, par4);
return var5 == this.blockID ? true : (var5 != Block.grass.blockID && var5 != Block.dirt.blockID && var5 != Block.sand.blockID ? false : (par1World.getBlockMaterial(p... |
b26524e1-6073-49e7-b9ff-e4509571e408 | 0 | public void setDataChiusura(Date dataChiusura) {
this.dataChiusura = dataChiusura;
} |
c3f42ee0-e4e7-4cc2-9fd2-533f851e5bbb | 6 | public synchronized void gridletPause(int gridletId, int userId, boolean ack)
{
boolean status = false;
// Find in EXEC List first
int found = gridletInExecList_.indexOf(gridletId, userId);
if (found >= 0)
{
// updates all the Gridlets first before pausing... |
5f9ff6f4-383f-4431-b50a-94b103a5b572 | 1 | private void initialize(final Spel spel) throws IOException {
this.spel = spel;
// Haal informatie uit de controller
String vraag = spel.getVraagTekst();
onderdelen = spel.getOnderdelen();
// Layout instellingen
setBounds(0, 0, 1024, 768);
setLayout(new MigLayout("ins 0 10px 10px 10px", "[124][grow][]",... |
a518c3b1-6311-4165-a35f-d3989003b1e7 | 8 | private boolean renderPistonExtension(Block par1Block, int par2, int par3, int par4, boolean par5)
{
int i = blockAccess.getBlockMetadata(par2, par3, par4);
int j = BlockPistonExtension.getDirectionMeta(i);
float f = par1Block.getBlockBrightness(blockAccess, par2, par3, par4);
float ... |
60993858-ba7d-4d9b-820c-2d6d8c7b69b8 | 3 | @Override
public void setAsText(String text) throws IllegalArgumentException {
if (text == null || text.equals(""))
text = "0";
if (!StringUtils.hasText(text)) {
setValue(null);
} else {
setValue(Integer.parseInt(text));// 这句话是最重要的,他的目的是通过传入参数的类型来匹配相应的databind
}
} |
38812317-ec54-4345-9b85-848c5e59ff6d | 1 | public void dstwdg(int id, Widget w) {
if(w == chrlist) {
destroy();
succeed();
}
} |
f9e8dcf0-ea8a-407b-9d85-dafdb9606114 | 3 | public TreeMenu(){
super();
menu = new JPopupMenu();
menu.setLightWeightPopupEnabled(false);
addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
grabFocus();
}
... |
bdcc75ab-e033-48ae-93fb-0677b3ca3d5e | 4 | public synchronized int select(int interestOps, Integer timeout) {
int n;
Selector selector;
if ((interestOps & SelectionKey.OP_READ) != 0) {
selector = readSelector;
} else {
selector = writeSelector;
}
selector.selectedKeys().clear();
try {
if (timeout == null) {
... |
a89e5737-31f9-4a30-bd1a-5ac9bb4b346a | 0 | public int hashCode() {
return super.hashCode() ^ myLabel.hashCode();
} |
b75885ce-fe2d-40bd-b8d7-c29d15f72eca | 1 | private FrontCommand getCommand(HttpServletRequest req)
throws Exception {
try {
return (FrontCommand) getCommandClass(req).newInstance();
} catch (Exception e) {
throw new Exception();
}
} |
2cbbf6e1-6126-4751-aa6c-1a3a44a01bfa | 1 | public void addArc(Node elem) {
int nodeIndex = adjacentNodes.indexOf(elem);
if (nodeIndex == -1)
adjacentNodes.add(elem);
} |
7b2b224e-06c2-4b87-b688-1b816fb42334 | 9 | private Collection<T> criaInstancias(ResultSet result) throws SQLException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchFieldException {
ArrayList<T> instancias = new ArrayList<>();
result.first();
do {
Constructor constr... |
36916d0c-e3d5-4066-a59a-1355e668dc3f | 2 | public void inserir(long idPesquisa, ArrayList<Pesquisador> pesquisadores) throws Exception
{
String sql = "INSERT INTO Pesquisacolaboradores (id1,id2) VALUES(?, ?)";
PreparedStatement stmt = ConnectionFactory.getConnection().prepareStatement(sql);
for (Pesquisador pesquisador : pesquisadores)
{
stmt.set... |
28bf60bf-5043-4337-940e-6a0736e43643 | 2 | public static void listDBs() throws Exception
{
Class.forName(JDBC_DRIVER);
Connection conn = DriverManager.getConnection(DB_URL, USER_NAME, PASSWORD);
// see if a connection is established
if(conn != null)
{
System.out.println("Connection established");
}
// list all the databas... |
4fa54192-49c2-42c8-a8a6-1b8d39372411 | 7 | public static void setZeros( int[][] m ) {
// m is a two dimenstional array which represents a Matrix
int rows = m.length ;
int cols = m[0].length;
List<Integer> rIdx = new ArrayList<>();
List<Integer> cIdx = new ArrayList<>();
// 1.iterate through the matrix to find all 0
for ( int y=0; y != rows; ++... |
09137b65-cc27-4941-aa25-270f3940f8b4 | 5 | public Object invoke() throws Exception {
Method m = null;
Method[] tabm = classe.getMethods();
for (int i = 0; i < tabm.length; i++) {
if (!tabm[i].getName().equals(method))
continue;
Class[] paramTypes = tabm[i].getParameterTypes();
int param... |
ce271981-d11a-47af-989b-b972698d63f0 | 0 | public void initOnGoing() {
ScheduledThreadPoolExecutor pe = (ScheduledThreadPoolExecutor) Executors
.newScheduledThreadPool(1);
InitFetcherManager ccf = this.new InitFetcherManager();
long ongoingCycleDelay = Long.valueOf(ConfigManager.getInstance()
.getConfigItem(IautosConstant.ONGOING_CYCLE_DELAY, 8640... |
7d481c5f-c786-4c5c-974c-c6f11c43dee6 | 5 | protected void createSource() throws JavaLayerException
{
Throwable t = null;
try
{
Line line = AudioSystem.getLine(getSourceLineInfo());
if (line instanceof SourceDataLine)
{
source = (SourceDataLine)line;
//source.open(fmt, milliseconds... |
9670351d-ea60-4169-b2af-560cca9d8b48 | 9 | private String readLine(InputStream in) {
// reads a line of text from an InputStream
StringBuffer data = new StringBuffer("");
int c;
try {
// if we have nothing to read, just return null
in.mark(1);
if (in.read() == -1) {
return null... |
fbb0f594-7bde-4960-a15e-c45ecabc9119 | 8 | public void testUnique() throws Exception {
//Return if this is not Windows OS
if (!isWindows) {
return;
}
/*
* Number of timestamps to generate on each client
*/
int iterations = 11000;
/*
* Number of client threads
*/
... |
ce8c7d6b-5252-4f88-8dc6-003cf4cfd8e6 | 8 | private Entry<K,V> getPrecedingEntryInclusive(K key) {
Entry<K,V> p = root;
if (p==null)
return null;
while (true) {
int cmp = compare(key, p.key);
if (cmp > 0) {
if (p.right != null)
p = p.right;
else
... |
8df84b7b-0318-43bd-8249-32053e9e03bf | 4 | public void run() {
Fluid.log("Target: Accepting connections on port " + port);
while(isConnected()) {
try {
// accept and do as little processing as possible
if(username != null && password != null)
new Client(this, clientConnection.accept(), idleTimeout, max, ruleFile, username, password);
el... |
3327358a-19ec-4de6-8bcc-97252998a82f | 3 | public static void main(String[] args) throws UnsupportedLookAndFeelException {
final Logger l = Logger.getLogger(Load.class.getName());
Thread cleanupThread = new Thread(
new Runnable() {
@Override
public void run() {
System.out.println("Shutdow... |
f811e182-f33a-4dca-99c1-e88d388d3202 | 4 | public void calculateNumberOfBreakpoints() {
int counter = 0;
for (int i = 0; i < permutArray.length - 1; i++) {
if (permutArray[i] - permutArray[i + 1] != -1) {
counter++;
}
}
if (permutArray[0] != 1) {
counter++;
}
i... |
e76ff4e9-4efd-45bb-bbb9-fde780869966 | 4 | public Object getValueAt( int row, int col )
{
Object dummy = liste.get( row ) ;
if (dummy != null)
{
ISOLanguage data = (ISOLanguage) liste.get( row ) ;
switch (col)
{
case FULL_ENTRY:
return dummy ;
case 0:
return data.getLanguageIso() ;
case... |
4f08d8be-cb22-490f-a49d-ac045f679f8a | 5 | private void loadImages() {
try {
// Load tiles
tileMap = ImageIO.read(this.getClass().getClassLoader().getResourceAsStream("Tiles.png")); // Grab the tilemap
for (byte i = 0; i < tiles.length; i++) { // For every tile that there should be
tiles[i] = tileMap.getSubimage(i * 32, 0, 32, 32); // Create ... |
a271bcf0-4c61-4b1c-a2ca-54cc6ddd73ab | 8 | @Override
protected void buildModel() throws Exception {
for (int iter = 1; iter <= numIters; iter++) {
errs = 0;
loss = 0;
DenseMatrix PS = new DenseMatrix(numUsers, numFactors);
DenseMatrix QS = new DenseMatrix(numItems, numFactors);
DenseMatrix ZS = new DenseMatrix(numUsers, numFactors);
// ra... |
b8e7a649-bcc0-4836-9d4e-8a01ce4f64a8 | 5 | @Override
public void show()
{
stage=new Stage();
Gdx.input.setInputProcessor(stage);
// retrieve the default table actor
table = new Table( getSkin() );
final TextButton saveSpot1;
final TextButton saveSpot2;
final TextButton saveSpot3;
final TextButton saveSpot4;
final TextButton saveSpot5;
TextButton exitButton=new... |
7b2ee5df-ca2c-4c35-9dac-cebe0f322853 | 6 | public static Cons javaTranslateDefineGlobalVariableUnit(TranslationUnit unit) {
{ GlobalVariable global = ((GlobalVariable)(unit.theObject));
{ Object old$Context$000 = Stella.$CONTEXT$.get();
Object old$Module$000 = Stella.$MODULE$.get();
try {
Native.setSpecial(Stella.$CONTEXT$,... |
d85bc76e-564c-4dbc-ab8b-970039a49862 | 6 | public final Rectangle getBoundingRectangle() {
double rotmc1x = Math.cos(rotation);
double rotmc1y = Math.sin(rotation);
double rotmc2x = -rotmc1y;
double rotmc2y = rotmc1x;
double hx = width * 0.5;
double hy = height * 0.5;
double leftBound = 0;
double... |
6f097137-df1e-4f7c-8c87-bb5b2a0324bf | 2 | private static boolean chechAccess(AccessRight accessRight)
{
if(accessRight == AccessRight.MANAGER)
{
System.out.println("YOU ARE MANAGER !");
return true;
}
else if(accessRight == AccessRight.DEPARTMENT)
{
System.out.println("YOU ARE DEPARTMENT !");
return false;
}
return false;
} |
108fe0a1-4c15-450e-bd46-e2b615a54d83 | 6 | @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInventoryClick(InventoryClickEvent e) {
// Only looking for anvils
if (!(e.getInventory() instanceof AnvilInventory)) {
return;
}
ItemStack item = e.getCurrentItem();
// Only looking for kits
if (!item.hasItemMet... |
51030d0b-bf3e-446d-a227-c14a353daa86 | 4 | @Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if(columnIndex == 2) {
if((Boolean)aValue) {
super.setValueAt((!(Boolean)aValue), rowIndex, columnIndex + 1);
}
super.setValueAt(aValue, rowIndex, columnIndex);
} else if(columnIndex == 3) {
if((Boolean)aValue) {
... |
fb2194c0-d9e5-4213-8860-43a705b251a7 | 8 | public Socket connect() throws IOException {
String[] headers = makeHeaders();
s = _getSocket();
try {
oc = s.getOutputStream();
for (String header : headers) {
oc.write(header.getBytes());
oc.write("\r\n".getBytes());
}
... |
0ffa3833-ae00-4b65-aea5-7c3e4d94a2a1 | 0 | public void onDeletionNotice(StatusDeletionNotice statusDeletionNotice) {
//System.out.println("Got a status deletion notice id:" + statusDeletionNotice.getStatusId());
} |
fbbd9bb0-9e2f-4f28-8d34-4b3327f29282 | 1 | public void setExcludeFromExportColumns(final String[] excludeFromExportColumns) {
if (excludeFromExportColumns != null) {
this.excludeFromExportColumns = excludeFromExportColumns.clone();
} else {
this.excludeFromExportColumns = null;
}
} |
ea9b4cb7-2d96-448e-ba08-c8a0148fee85 | 5 | private void heapify(int i){
int vasenLapsi = vasenLapsi(i);
int oikeaLapsi = oikeaLapsi(i);
if (oikeaLapsi < this.koko){
Siirto suurempi = null;
int suurempiInd = 0;
if (keko[oikeaLapsi].suurempiKuin(keko[vasenLapsi])){
suurempi = keko[oikeaLa... |
c396aab3-dd74-4e65-932f-9f1ff60a4ae1 | 4 | protected long computeSVUID() throws IOException {
ByteArrayOutputStream bos;
DataOutputStream dos = null;
long svuid = 0;
try {
bos = new ByteArrayOutputStream();
dos = new DataOutputStream(bos);
/*
* 1. The class name written using UTF encoding.
*/
dos.writeUTF(name.replace('/', '.'));
... |
e8d5fc7e-f39d-402b-909b-de0a9501acaf | 7 | protected String getLabel(Node node) {
String prefix = " ";
String suffix = " ";
if (attribute.equalsIgnoreCase(TAXON_NAMES)) {
return prefix+tree.getTaxon(node).getName()+suffix;
}
if( tree instanceof RootedTree ) {
final RootedTree rtree = (RootedTree) ... |
f3c7fa9b-ed42-4359-966b-a530c4a14811 | 9 | @Override
public void actionPerformed(ActionEvent acc) {
try {
if (OPEN_ACTION.equals(acc.getActionCommand())) {
stateManager.openScene();
Console.println("Open Scene");
} else if (SAVE_ACTION.equals(acc.getActionCommand())) {
stateManager.saveScene(false);
} else if (SAVEAS_ACTION.equals(acc.ge... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.