method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
92828a6c-a60b-4de3-b711-f861260e4b95 | 5 | public static ArrayList<ArrayList<Integer>> carryDisks(ArrayList<ArrayList<Integer>> a, int base, int to) {
int from = getDiskLocation(a,base);
if(from == to) return a;
for(int i = 0; a.get(from).size() > i; i++) if(a.get(from).get(i) <= base) a.get(to).add(a.get(from).get(i));
for(int i... |
4f21b6f6-8325-433f-8dfc-103cf87dec12 | 5 | public DirtTunnel() {
Random random = new Random(1000);
int w = 6;
int h = 8;
double ws = 1.0 / (w);
double hs = 1.0 / (h);
for (int x = 0; x < w; x++) {
for (int z = 0; z < w; z++) {
for (int y = 0; y < h; y++) {
double xx ... |
3e7698f7-e1dc-475a-a101-0d3106f2a221 | 8 | private final int closestIndex(final int key){
// TODO: implement fastest algorithm
// Here some binary search
if (size == 0) return -1;
int min = 0;
int max = size-1;
int n = 0;
while ( true){
int i = (max+min)/2;
n++;// TODO: REMOVE DEBUG CODE
if (n > size*2) throw new RuntimeException("Too man... |
65610c88-c927-4260-8116-f62ff244dd2b | 2 | int other(int vertex) {
if (vertex == v) return w;
else if (vertex == w) return v;
else throw new RuntimeException("Illegal endpoint");
} |
b1bd9140-70cc-4f97-ad12-b2cd37ed9b11 | 6 | public static Stella_Object access_PLObjectUnion_Slot_Value(PLObjectUnion self, Symbol slotname, Stella_Object value, boolean setvalueP) {
if (slotname == GuiServer.SYM_GUI_SERVER_Type) {
if (setvalueP) {
self.Type = ((StringWrapper)(value)).wrapperValue;
}
else {
value = StringWra... |
6ef171e9-bdeb-4fe2-aa10-6f513e17558e | 6 | private boolean edgeAndScheduleSelection(EvolvingGraph graph, Vector<Integer> tLBD){
Vector<Integer> arrivalTime = new Vector<Integer>();
boolean improved = false;
eMin = new Vector<Edge>(graph.getNumOfNodes());
tMin = new Vector<Integer>(graph.getNumOfNodes());
for (int i = 0; i < graph.getNumOfNodes()... |
e2db9cf2-0d39-4ba5-9fab-28d9a08a0b12 | 1 | public static void render(int width, int height) {
if (GlobalGame.game.dungeonHandler.player_active) {
Point player_position = GlobalGame.game.dungeonHandler.getActiveDungeon().getActiveFloor().getPlayerPosition();
Point top_left = Point.add(player_position, new Point(width / -2, height ... |
eb37969a-1f30-4958-9366-f558892fdbfa | 7 | public void run() {
final String methodName = "run";
MqttWireMessage message = null;
while (running && (out != null)) {
try {
message = clientState.get();
if (message != null) {
// @TRACE 802=network send key={0} msg={1}
log.fine(className, methodName, "802", new Object[] { message.getKey(), ... |
7aa3f360-b4e1-45ae-a508-d684465dbb5b | 1 | public String getValueString1(int row, int clums, int sheetat) {
String s = null;
try {
XSSFSheet xSheet = xWorkbook.getSheetAt(sheetat);
XSSFRow xRow = xSheet.getRow(row - 1);
XSSFCell xCell = xRow.getCell(clums - 1);
xCell.setCellType(Cell.CELL_TYPE_STRING);
s = xCell.getStringCellValue();
} catc... |
8ec3be2c-2950-400d-9d31-f48e95a3047b | 1 | public void visit_if_icmpne(final Instruction inst) {
if (longBranch) {
final Label tmp = method.newLabel();
addOpcode(Opcode.opc_if_icmpeq);
addBranch(tmp);
addOpcode(Opcode.opc_goto_w);
addLongBranch((Label) inst.operand());
addLabel(tmp);
} else {
addOpcode(Opcode.opc_if_icmpne);
addBranc... |
a6479ffe-4e08-4a70-9450-e7fedfc74f67 | 1 | private void addTextFieldsListener() {
//Создаем слушателя
KeyListener keyListener = new KeyAdapter() {
public void keyPressed(KeyEvent evt) {
//Вход по нажатию на Enter
if (evt.getKeyCode() == KeyEvent.VK_ENTER)
{
btnLog.d... |
dfb8b9b5-7cd7-4b79-be60-d3fc80d1267e | 2 | public static void main(String[] args) throws IOException
{
decode74 decoder = new decode74();
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(args[0])));
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(args[1])));
String recieved;
while... |
b619adcd-c1dc-4e3b-b509-cee3a07f0d19 | 1 | public Integer getState(long time) {
Long key = (Long) time;
key = (signal.floorKey((Long) key));
return key == null ? -1 : signal.get(key);
} |
365b8069-de4b-41aa-9f2d-76b77579070b | 4 | public static String getSWmeaning(byte[] data) {
byte SW[] = new byte[2];
SW[0] = data[data.length - 2];
SW[1] = data[data.length - 1];
if (Arrays.equals(SW, new byte[]{(byte) 0x90, (byte) 0x00})) {
return "Command successfully executed";
}
if (SW[0] == (byte... |
f219d96a-bbea-4503-8946-9dd43e6e2d2a | 0 | public void setName(String a) {
this.name = a;
} |
b1fd33c0-2065-4828-b446-75052799d303 | 1 | public RuteadorWindow(String hostAddress) {
super();
this.hostAddress = hostAddress;
try {
// set look and feel
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
// set icon image
Image image = ImageIO.read(ClassLoader.getSyst... |
f8f2a876-187a-4c68-98f0-d76674d81f53 | 5 | ArrayList<Point> possibleMoves() {
// TODO Auto-generated method stub
ArrayList<Point> answer = new ArrayList<Point>();
for(Point p : possibleDirections)
{
Point thisMightWork = new Point(myLocation.x+p.x,myLocation.y+p.y);
while(myBoard.isOnBoard(thisMightWork)&&myBoard.isEmpty(thisMightWork))//if th... |
6360ffb1-fa14-4035-88e6-35cd06d374eb | 8 | public void run(){
requestFocus();
screenImage = new BufferedImage(getWidth() / SCALE, getHeight() / SCALE, BufferedImage.TYPE_INT_RGB);
long startTime = System.nanoTime();
long totalTime = startTime;
double tickTime = 0;
int numTicks = 0, numFrames = 0;
if(Options.startFullScreen) fullScreenM... |
04920a59-dfe5-462d-ac00-eb5b99016aed | 1 | private static Grammar getGrammarWithNoVariablesThatCantDeriveStrings(
Set usefulProductionSet) {
Grammar g = new ContextFreeGrammar();
Iterator it = usefulProductionSet.iterator();
while (it.hasNext()) {
Production p = (Production) it.next();
g.addProduction(p);
}
return g;
} |
2a69d70c-bf54-4d73-883c-dc021b1f0f0b | 4 | @Override
public void onDraw(Graphics G, int viewX, int viewY) {
if (X>viewX&&X<viewX+300&&Y>viewY&&Y<viewY+300)
{
Graphics2D g2d = (Graphics2D)G;
G.setColor(Color.cyan);
G.drawLine((int)previousX-viewX, (int)previousY-viewY, (int)X-viewX,(int)Y-viewY);
... |
4d34026a-32be-4051-beed-b2f1eb88077a | 3 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand().equals("SetDefault")) {
MainWindow.setupData.getPrintElementSetupList().setDefaultPrintElementConfiguration ((Font) UIManager.getDefaults().get("TextField.font"));
for (Component c: componentPanel.getComponents()) {
if (c in... |
37368d6d-261f-426b-b342-87fbf9ff1e05 | 5 | public boolean isYourMove() {
boolean test = false;
if (test || m_test) {
System.out.println("Human :: isYourMove() BEGIN");
}
boolean m_Trace = false;
setYourTurn(true);
if (m_Trace) System.out.println
("Human::IsYourMove() - player's move");
if (test || m_test) {
... |
a94cfe38-1efb-407f-8b77-4ac9e5ff2f06 | 5 | @Test
public void sizeIsCorrect()
{
boolean test = true;
for (int i = 0; i < 1000; i++)
{
tree.clear();
Random rand = new Random();
int r = rand.nextInt(1000);
for (int j = 0; j < r; j++) tree.add(j);
int b = (r <= 0) ? 0 : rand... |
577dcc5a-abe0-4826-8e82-ab2fb7c5d671 | 7 | private int skipSuperConstructor0(int skipThis) throws BadBytecode {
begin();
ConstPool cp = codeAttr.getConstPool();
String thisClassName = codeAttr.getDeclaringClass();
int nested = 0;
while (hasNext()) {
int index = next();
int c = byteAt(index);
... |
d17819ee-a2f8-438a-871c-365071f9c8b9 | 8 | private String specifyCard(int num, char colour)
{
String type;
String col;
switch (num)
{
case 14: type = "Ace";
break;
case 13: type = "King";
break;
case 12: type = "Queen";
break;
case 11... |
0344e9a8-770d-4905-8f08-17172240de01 | 8 | public static boolean disconnectSelectedAgent(int preSelectedIndex)
{
try
{
if (Drivers.alTerminals.size() < 1)
{
Drivers.jop_Error("There are no implants to remove at this time. ", "Cannot Disconnect Implant - No Implants Populated");
return false;
}
... |
d3fa5214-2706-4d4b-bbb6-220e60645cc6 | 2 | private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addButtonActionPerformed
try {
BigDecimal value;
try{
value = new BigDecimal(addField.getText());
value.setScale(2, RoundingMode.FLOOR);
}catch(NumberForma... |
359c3a11-459a-427c-8da0-c60e75177ba3 | 0 | public static Praticien selectOneByNomPrenom(EntityManager em, String nom, String prenom) throws PersistenceException {
Praticien praticien = null;
Query query = em.createQuery("select pra from Praticien pra where pra.nom = :nom and pra.prenom = :prenom");
query.setParameter("nom", nom);
... |
70151700-144b-4cda-8a8f-5826628dfafa | 3 | public void onAdd(Player senderPlayer, String[] args) {
Block targetBlock = senderPlayer.getTargetBlock(null, 100);
if(targetBlock == null) {
senderPlayer.sendMessage(ChatColor.DARK_RED + "You must be looking at a block while using this command!");
return;
}
if(args.length < 2) {
senderPlayer.sendMess... |
23f3742e-2fdf-4002-9543-7c291531746b | 4 | private void ufotAlemmasVasReunassa(Ufo ufo, int x) {
if (ufo.isVisible()) {
if (x <= RuudunVasenReuna && suunta != 1) {
suunta = 1;
Iterator i2 = ufot.iterator();
while (i2.hasNext()) {
ufo = (Ufo) i2.next();
uf... |
9b7185cd-35d0-4245-93e5-78a116f7f3d8 | 5 | @Override
public void visitMethod(ClassNode c, MethodNode m) {
if(!m.name().equals("<init>")) {
return;
}
FlowGraph fg = m.graph();
Block block = (Block) fg.trace().get(1);
Stmt stmt = (Stmt) block.tree().stmts().get(1);
if(stmt instanceof ExprStmt) {
ExprStmt exprStmt = (ExprStmt) stmt;
Expr ... |
1c28ae06-0938-4384-b7cd-313fecfe99c6 | 3 | @Override
public void setValue (final Map<String,Value<?>> value) {
if (value == null) {
throw new NullPointerException();
}
this.value = new TreeMap<String,Value<?>>(value);
} |
80e07579-8bfd-4701-ab34-1fbe708679ad | 2 | @Test
public void insertTest(){
long start = System.currentTimeMillis();
for (int i = 0; i < 100000; i++){
binaryheap.insert(i);
}
long end = System.currentTimeMillis();
System.out.println("Time spent adding 100 000: " + (end-start)*1.0 + "ms.");
... |
8a586e77-e1c5-4e71-86bf-a10e0878f5c1 | 2 | private Double SaturatedIdentity(Double input) {
if (input > upperBound)
return upperBound;
if (input < lowerBound)
return lowerBound;
return input;
} |
e011298c-7ec5-4c3a-be06-ec78038ee9d5 | 2 | @Override
public String toString() {
StringBuilder sb = new StringBuilder();
for( int i = 0; i < count.length; i++ )
if( count[i] != 0 ) sb.append(i + "\t" + count[i] + "\n");
return sb.toString();
} |
791adf11-3bc8-4314-b883-1c2831f07ce7 | 8 | public void render() {
counter++;
if (counter % 50 == 0) xtime--;
if (counter % 50 == 0) ytime--;
for (int y = 0; y < height; y++) {
if (ytime < 0 ||ytime >= height) break;
for (int x = 0; x < width; x++) {
if (xtime < 0 || xtime >= width) break;
pixels[xtime + ytime * width] = 0xff00ff;
}
... |
2d45c477-e35f-444a-9d9a-7d8c48f49d15 | 8 | @Override
public void init() {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
bre... |
ba4e19a9-7670-4e88-9642-1fce501f6fd3 | 2 | public WebDriver getWebDriver(String type)
{
for (LocalWebDriver localWebDriver : registerLocalWebDrivers.get())
{
if (localWebDriver.isWebDriverType(type))
return localWebDriver.getWebDriver();
}
return getLocalDefaultWebDriver();
} |
3884566a-0b44-45bd-a5c9-b801e73cbffd | 9 | @Deprecated
public void run(){
Microphone microphone = liveRecognizer.getMicrophone();
Recognizer recognizer = liveRecognizer.getRecognizer();
int readingPosition = 0;
int recognizedPosition;
while (microphone.hasMoreData()) {
// Just sleep for 500ms so that it w... |
7184efbc-6b97-4a51-88a3-7427ae10fb7a | 5 | public void solve() {
BoardState cState = sState;
visitedList = new HashSet<BoardState>();
frontierList = new ArrayDeque<BoardState>();
long startTime, endTime, totalTime; //for time keeping
startTime = System.nanoTime();
while (cState != null && !cState.equals(eState)){ //keep going if not done
if (!vis... |
14b0f1d4-dd50-4c8e-b5ca-06410234a18c | 4 | public <T extends IMessage> void send(final T message) {
List<IMessageHandler<? extends IMessage>> handlers = handlersByMessage.get(message.getClass());
if (handlers != null) {
for (IMessageHandler<? extends IMessage> handler : handlers) {
((IMessageHandler<T>) handl... |
593d7692-4bd7-4722-921c-b07f4defc14b | 5 | public int nextClearBit(int fromIndex)
{
// Neither spec nor implementation handle bitsets of maximal length.
// See 4816253.
if (fromIndex < 0)
throw new IndexOutOfBoundsException("fromIndex < 0: " + fromIndex);
checkInvariants();
int u = wordIn... |
972462cc-8d40-4930-a8aa-e5a1991e0660 | 6 | public MultiEditorPanel() {
super();
setLayout(new BorderLayout());
contents = createData();
JPanel pnlLevelSelect = new JPanel(new BorderLayout());
add(pnlLevelSelect, BorderLayout.WEST);
model = new SimpleListModel<>();
final JList<U> list = new JList<U>(model);
list.setCellRenderer(createCellRende... |
d413c0c0-c9a7-4fd9-b675-82d933a757f0 | 6 | public void body()
{
// Process events
Object obj = null;
while ( Sim_system.running() )
{
Sim_event ev = new Sim_event();
super.sim_get_next(ev); // get the next event in the queue
obj = ev.get_data(); // get the incoming data
... |
03a2a8af-ab67-4bf9-b346-b216b346c9c9 | 8 | public void drawU(UGraphic ug, double x, double y, HtmlColor borderColor, DotData dotData) {
if (hasEntryOrExitPoint()) {
manageEntryExitPoint(dotData, ug.getStringBounder());
}
if (skinParam.useSwimlanes()) {
drawSwinLinesState(ug, x, y, borderColor, dotData);
return;
}
final boolean isState = dotDa... |
f9e105af-a9e4-40a2-8d0c-6c090f9a1134 | 5 | public boolean matches(RedisBigTableKey k)
{
byte[] otherRow = k.getRow();
byte[] otherFamily = k.getColumnFamily();
byte[] otherQualifier = k.getColumnQualifier();
boolean rowMatches = Utils.hasWildCard(otherRow) || Utils.byteArraysEqual(this.row, otherRow);
boolean famMatches = Utils.hasWildCard(otherFamil... |
b2e6ef17-386d-42ee-b912-dcda85f2ffde | 2 | public static Record getRecord(String baseformat) throws SQLException
{
List<Record> records = getRecords(baseformat, 1);
if (records != null && records.size() > 0)
return records.get(0);
return null;
} |
13d1570e-37ca-45b0-8817-4ff89636bbec | 2 | public void paint(Graphics g)
{
Graphics2D g2d = (Graphics2D) g;
g2d.setFont(font);
updateSize();
RoundRectangle2D r = new RoundRectangle2D.Double(getX(), getY(),
getWidth(), getHeight(), 1, 1);
Line2D l = new Line2D.Double(getX(), 25 + getY(), getWidth() + ge... |
db893cde-660a-4b9d-b93f-77b1767213fb | 3 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
Transferable clipboardContent = getToolkit().getSystemClipboard().getContents(this);
if ((clipboardContent != null)
&& (clipboardContent.isDataFlavorSupported(DataFlavor.stri... |
b75aef20-3400-442e-9945-d2f62e1984d7 | 0 | public void actualiser() {
// récupération des rapports visites
// lesRapportsVisites = DaoRapportVisiteJPA.selectOneByVisiteur(em, leVisiteur);
lesRapportsVisites = DaoRapportVisiteJPA.selectAll(em);
indiceRapportVisiteCourant = 0;
leRapportViste = lesRapportsVisites.ge... |
59d843f4-a820-46f7-b326-b6ad8e08c683 | 5 | public void removeWordsBeginningWithConsonant(int length){
for(int i = 0; i < text.numberOfParagraphs(); i++){
Paragraph currParagraph = text.getParagraph(i);
for(int j = 0; j < currParagraph.numberOfSentences(); j++){
Sentence currSentence = currParagraph.getSentence(j);... |
5302298f-16cc-4123-a4fd-b5e587b00e94 | 4 | private void setUpNextAndPreviousButtons() {
// create the image icons for the buttons
Icon prevIcon = new ImageIcon(
SoundExplorer.class.getResource("leftArrow.gif"),
"previous index");
Icon nextIcon = new ImageIcon(
SoundExplorer.class.getResource("rightArrow.gif"), "next index");
// create the ar... |
46116570-c8be-4f2d-9798-86c90cc147f3 | 5 | private void createHelp(){
// ---- set up the choices on the help menu ----
menuHelp = new JMenu("Help");
menuHelp.setMnemonic('H');
menuBar.add(menuHelp);
//this is is really important. it fixes a bug.
//when in full screen mode on 2nd monitor the JMenu appears on the wrong
//monitor if the x location ... |
ec17f8f2-1a76-4d74-868f-a28b56459db4 | 8 | private static InvocationExprent isAssertionError(Statement stat) {
if (stat == null || stat.getExprents() == null || stat.getExprents().size() != 1) {
return null;
}
Exprent expr = stat.getExprents().get(0);
if (expr.type == Exprent.EXPRENT_EXIT) {
ExitExprent exexpr = (ExitExprent)expr;... |
0edbca32-9070-408f-974f-eef6ac54fbd8 | 1 | public void printDevilFruits(Player p)
{
p.sendMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Devil Fruits");
for(int i = 0; i < Fruits.values().length; i++)
{
p.sendMessage(ChatColor.GREEN + "" + i + ". " + Fruits.values()[i].getFruit().getName());
}
} |
1885483c-4a34-409f-911a-b16992e80eb8 | 6 | public final void gen_attack_wknight(Board board, int square) {
int mobility_all = 0;
int mobility_safe = 0;
int mobility_total = 0;
int attackedSquare;
// Loop through the 8 different deltas
for(int i = 0; i < 8; i++)
{
attackedSquare = square + knight_delta[i];
if((attackedSquare & 0x88) ==0)
... |
5e22c8b1-0432-43ff-9716-c8298142d01a | 9 | public void run() {
try{
// Keep trying to connect
while(true){
_cn.connect();
if(_cn.getSocket().isConnected())
{
_sw = new SyncStreamWriter(_fm.getHome(),new DataOutputStream(_cn.getSocket().getOutputStream()),_debug);
_sp = new SyncStreamParser(_fm.getHome(),new ... |
38202db9-1f5f-48bf-8bab-b3298c1b2c39 | 4 | public static void main(String args[]) {
Inventory inventory = new Inventory();
String outputString = ""; //To hold the String returned by the Inventory readFile method
//If a file was passed by command-line, use it to populate data
if (args.length != 0) {
outputString = ... |
a015d5b1-d6ad-49cd-a8e9-211c0a874322 | 3 | public void update(long currentTime) {
if (Display.isCloseRequested()) {
game.quit();
}
handleInputEvents();
staticComponents.update(currentTime);
dynamicComponents.update(currentTime);
if (staticComponents.hasNewData()) {
bufferData(vboStaticHa... |
cbab6e63-208f-4972-881a-0599e49bf28f | 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... |
a8a7a062-b1bb-4fb6-ba47-e7bb22d56e48 | 5 | private void bAddAtributoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bAddAtributoActionPerformed
// TODO add your handling code here:
if( !tNAtributo.getText().equals("") ){
String nombre=tNAtributo.getText();
String tipo=cbTipoAtributo.getSelectedItem().to... |
a2926789-f890-428c-9a98-89ab9858364a | 6 | private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
if ("".equals(fldDescripcion.getText()) || ("".equals(fldCantidad.getText()))
|| ("".equals(fldCosto.getText())) || "".equals(fldNombre.getText())
|| "".equals(fldPrecio.... |
bd587ab2-9036-4ac7-aa44-6caa92dc5ca6 | 6 | public void compile() {
if (none())
return;
if (compileCommand == null || compileCommand.equals(""))
return;
compiling = true;
try {
System.out.println("Compiling: " + compileCommand);
Process p = Runtime.getRuntime().exec(compileCommand);
... |
839ead8c-461e-4bfd-a789-be5a7902d550 | 6 | public static void main(String[] args) {
int n = Main.determineVertices(args);
double p = Main.determineProbability(args);
int total = 0;
long start = System.currentTimeMillis();
for(int i = 0; i < NUM_TRIALS; i++) {
UndirectedGraph<Vertex> g = Main.createGraph(n, p);
GreedyColoring.color(g, 3);
Sea... |
8cf11387-abe9-489f-b8ef-a243454785ec | 6 | @Override
public V remove(K key) {
int hash = hash(key, this.array);
Entry<K, V> entry = this.array[hash];
V value = null;
if (entry == null) {
return value;
}
if (entry.next == null) {
if (entry.key.equals(key)) {
value = entry... |
789452c4-706a-4fe3-9cfe-afc41e134844 | 7 | public Object nextContent() throws JSONException {
char c;
StringBuffer sb;
do {
c = next();
} while (Character.isWhitespace(c));
if (c == 0) {
return null;
}
if (c == '<') {
return XML.LT;
}
sb = new Str... |
a8820635-b3fb-447f-b68b-0577ae98ad76 | 2 | public static double[] sweep(double[] d, double a, double b, double c) {
int n = d.length;
double[] cc = new double[n];
double[] dd = new double[n];
double[] x = new double[n];
cc[0] = c / b;
dd[0] = d[0] / b;
for (int i = 1; i < n; ++i) {
cc[i] = c / ... |
5dc873a9-0784-40cb-af9b-f8a220eec44e | 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... |
93595389-9272-4885-b5e6-3e3683d4b09d | 4 | public static void loadDir(File file){
File[] children = file.listFiles();
if (children != null) {
for (File child : children) {
if(child.isDirectory()){
loadDir(child);
continue;
}
String fileName = child.getName();
String ... |
acd7d382-89a4-4d1c-992c-be39888e6f6b | 9 | private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okActionPerformed
try {
messageLabel.setText("");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "oracle");
Statement s = con.createStatement();
... |
89d4ff68-4185-402b-8765-3477416e2e7f | 4 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!(obj instanceof EasyDate))
return false;
EasyDate other = (EasyDate) obj;
if (calendar == null) {
if (other.calendar != null)
return false;
}
return calendar.equals(other.calendar);
} |
5e6f7dcd-c233-4f58-99bc-6963e33a2fb5 | 4 | private void txtVertexNameKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtVertexNameKeyPressed
if (evt.getKeyCode() == 10) {
String vname = txtVertexName.getText();
if (vname.isEmpty()) {
drawing.addVertexRandName();
} else {
draw... |
7d563ad9-d19f-4a96-a9b3-6ad78e936334 | 7 | public void setOptions(String[] options) throws Exception {
m_bGenerateNet = Utils.getFlag('B', options);
String sNrOfNodes = Utils.getOption('N', options);
if (sNrOfNodes.length() != 0) {
setNrOfNodes(Integer.parseInt(sNrOfNodes));
} else {
setNrOfNodes(10);
}
String sNrOfArcs = Utils.getOption('... |
9ee7bb93-7a84-4bfa-b25c-744b33ed6579 | 6 | void parsePEReference(boolean isEntityValue) throws java.lang.Exception
{
String name;
name = "%" + readNmtoken(true);
require(';');
switch (getEntityType(name)) {
case ENTITY_UNDECLARED:
error("reference to undeclared parameter entity", name, null);
... |
59674d43-0e76-44c8-8b3f-9aeba24ccad5 | 6 | protected void discard(int card){
assert(in_play[card-1] && action);
action = false;
in_play[card-1] = false;
//Reshuffle, if no cards in draw pile
if (draw_count == 0){
has_shuffled = true;
shuffle(false);
}
//Push to stack
discard[discard_count++] = card;
//Remove old reference to this card in... |
ddc6f302-eff2-4f1d-9049-d04df13ca7db | 7 | private void clearSizeForNewFile() {
long fsSize = getFilesSumSize();
long filesCount = files.size();
Set<Integer> toRemoveFileNumbers = new HashSet<>();
Set<FsCacheFile> toRemoveFiles = new HashSet<>();
for (Map.Entry<Integer, FsCacheFile> entry : files.entrySet()) {
if (fsSize + fsCacheFileM... |
b555fc4f-c30d-4b05-9007-73b422d39c53 | 0 | public static senseDir dirFromString(String name) {
return getEnumFromString(senseDir.class, name);
} |
fad6d03f-29f8-4c33-82cf-a5baa9727fe7 | 3 | public Persistent SaveObject(Persistent obj) throws IllegalAccessException
{
NodeReference node = null;
try
{
String globalName = obj.GetStorageGlobalName();
node = connection.createNodeReference(globalName);
}
catch (Exception ex)
{
... |
5e6c0d9c-4742-4332-b02a-0e0e5350d7f6 | 5 | private boolean checkJikesSuper(Expression expr) {
if (expr instanceof LocalStoreOperator || expr instanceof IIncOperator)
return false;
if (expr instanceof Operator) {
Expression subExpr[] = ((Operator) expr).getSubExpressions();
for (int i = 0; i < subExpr.length; i++) {
if (!checkJikesSuper(subExpr[... |
3e9505b0-a75a-4543-ab1c-8707e9f069ca | 4 | /* */ public void update(Graphics g)
/* */ {
/* 176 */ if (image == null) {
/* 177 */ image = createImage(getWidth(), getHeight());
/* 178 */ this.second = ((Graphics2D)image.getGraphics());
/* */ }
/* 180 */ if ((state == Core.State.Pause) && (unitsDeployed)) {
/* 181 */ s... |
45689cb3-1603-494b-914f-8e7c04bd628f | 2 | public E elementAt(int index) throws ArrayIndexOutOfBoundsException {
for(E e : this) {
if(index == 0) {
return e;
}
index--;
}
throw new ArrayIndexOutOfBoundsException(Logging.getCodePosition() + " Invalid index: index=" + index + " size of list=" + size);
} |
e71f40dd-58ef-42ca-961d-9e01bdfe1ded | 9 | public boolean bankTransaction(String bank, double amount) {
if (bank != null || bank.length() == 0 || vaultEcon == null) {
return false;
} else if (vaultEcon != null && !vaultEcon.hasBankSupport()) {
return false;
}
double preAmt = 0;
EconomyResponse balance = vaultEcon.bankBalance(bank);
if (balanc... |
aa8623c6-31ec-4c68-801a-5753bf2a25d9 | 5 | public static JPanel CreateFlightObjectCard (){
System.out.println("CreateFlightObjectCard - flag");
JPanel card = new JPanel();
JPanel part0 = new JPanel(); // Details about page.
JPanel partA = new JPanel(); // Date.
JPanel partB = new JPanel(); // origin.
JPanel partC = new JPanel(... |
d2bb6037-53d7-4f60-8d7a-b36546a4b0f3 | 5 | @Override
public Object solve() {
for (int a = 1; a < 998; a++) {
for (int b = a + 1; b < 998; b++) {
for (int c = b + 1; c < 998; c++) {
if (a + b + c == 1000 && a * a + b * b == c * c) {
return a * b * c;
}
... |
c4ea2925-ddd1-48d7-abb6-40451ff2cafa | 8 | @Override
public boolean isValidClassDivider(MOB killer, MOB killed, MOB mob, Set<MOB> followers)
{
if((mob!=null)
&&(mob!=killed)
&&(!mob.amDead())
&&((!mob.isMonster())||(!CMLib.flags().isAnimalIntelligence(mob)))
&&((mob.getVictim()==killed)
||(followers.contains(mob))
||(mob==killer)))
return t... |
eeed777e-e9d1-49ee-ab88-5670311fc0ff | 8 | private void compareToLink() {
Section linkSection = this.getLinkedSection();
for (int i = propertyCount() - 1; i >= 0; i--) {
Property mine = this.getProperty(i);
Property his = linkSection.getProperty(mine.getName());
if (his != null) {
for (int j = mine.valueCount()... |
782cb47e-9ca0-4e79-9d19-4407d43d57b3 | 3 | public List<ChunkCoordinates> chunks() {
if (!this.isDefined()) return Collections.<ChunkCoordinates>emptyList();
final List<ChunkCoordinates> coords = new ArrayList<ChunkCoordinates>();
for (int x = this.minChunkX; x <= this.maxChunkX; x++)
for (int z = this.minChunkZ; z <= this.ma... |
6da7ee5f-7910-46be-9bf9-5d85117417de | 9 | static void printSeesTag(SeeTag tag, PackageDoc relativeTo) {
String memName = "";
String memText = "";
if (tag.referencedMember() != null) {
if (tag.referencedMember() instanceof ExecutableMemberDoc) {
ExecutableMemberDoc m = (ExecutableMemberDoc) tag
.referencedMember();
memName = m.qualifiedNa... |
dc23c688-0766-4fb2-9c8f-a9a20a1a1676 | 0 | public Bag() {
first = null;
N = 0;
} |
db270f77-2e2d-42f1-9fec-76ee6395c05d | 8 | public void putAll( Map<? extends K, ? extends Integer> map ) {
Iterator<? extends Entry<? extends K,? extends Integer>> it = map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends K,? extends Integer> e = it.next();
this.put( e.getKey(), e.getValue() ... |
b5fecd0f-b0a8-4487-af8d-adfe86b44223 | 5 | public static void setTilesForTestWorld() {
RandomEngine rand = new RandomEngine();
ArrayList<Quadrant> quads = Dystopia.getGame().getCurrentWorld().getGrid().QUADRANTS;
ArrayList<ArrayList<Chunk>> chunks;
for (int i = 0; i < quads.size(); i++) {
chunks = quads.get(i).getChunks();
for (int y = 0; y ... |
9c973fdc-73c7-48e9-83ed-bd833296cbf0 | 0 | public int GetTimeCreated()
{
return timeCreated;
} |
af702950-7264-455e-80e7-9527e0e30c67 | 9 | public int nstStraight(Block set, Material m, BlockFace bf){
int x = 1;
int a = (int) (Math.random() * 40);
if (a < 12){
a = 12;
}
while (x < a) {
int newx = x-1;
// if (x == 1){
// Material m1 = Material.IRON_FENCE;
// Block otherset = set.getRelative(bf, newx);
// Block set1 = otherset.getR... |
8cd5f1f9-0000-4ed4-810b-e5ed2e840781 | 3 | @Override
protected SamEntry readNext() {
try {
while((line = reader.readLine()) != null) {
lineNum++;
if( line.startsWith("@") ) headers.addHeaderRecord(line);
else return new SamEntry(line);
}
} catch(IOException e) {
return null;
}
return null;
} |
84e0d58c-26eb-4aec-b5cf-c58b5ad40159 | 8 | int readCorner1(int numRows, int numColumns) {
int currentByte = 0;
if (readModule(numRows - 1, 0, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRows - 1, 1, numRows, numColumns)) {
currentByte |= 1;
}
currentByte <<= 1;
if (readModule(numRo... |
a1b3a2f2-4eba-485c-b7e3-2ce5ce63e97a | 1 | public static Session currentSession() throws HibernateException {
// Open a new Session, if this thread has none yet
if (session == null) {
session = sessionFactory.openSession();
}
return session;
} |
bd8146ad-7646-4a87-a08b-260b6afd2ded | 9 | public void run(){
Microphone microphone = liveRecognizer.getMicrophone();
Recognizer recognizer = liveRecognizer.getRecognizer();
// Retrieve the time to wait in MilliSeconds
int delayTimeInMilliSeconds = ConfigurationWindow.getInstance().getDelayTimeInMilliSeconds();
try{
... |
13394776-04a2-4367-a176-6e20557a51b7 | 5 | public ThresholdMenu() {
super("Threshold");
setEnabled(true);
JMenuItem threshold = new JMenuItem("Threshold");
threshold.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
Panel panel = (((Window) getTopLevelAncestor()).getPanel());
if (panel.getImage() == null... |
ba559301-4558-4999-9c9b-a34c651ef6ad | 8 | @Override
public boolean equals(Object obj)
{
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Phone other = (Phone) obj;
if (id != other.id)
return false;
if (phoneNumber == null)
{
if (other.phoneNumber != null)
return fals... |
a00ffe6e-a882-474c-adf3-6fb7b2a49743 | 3 | public static double binomialCoeff(int n, int k) {
if (k < 0 || n < 0) throw new IllegalArgumentException("\nn and k must be greater than or equal to zero");
if (k > n) throw new IllegalArgumentException("\nk is greater than n");
return Math.floor(0.5D + Math.exp(Stat.logFactorial(n) - Stat.logFactorial(k) - Stat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.