method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
443a9a74-362a-4275-b772-85b9b8e6362f | 1 | static public Menu getInstance() {
if (m_instance == null) {
m_instance = new Menu();
}
return m_instance;
} |
6b219d02-766d-49b9-87ac-19d01d8860be | 1 | public void play(String soundName) {
Sound sound = sounds.get(soundName);
if (sound != null) {
sound.play();
}
} |
3f7a1421-b3e2-4df7-a374-f1d9f4db0493 | 4 | public void enemyAttacks() {
// will choose a random square to attack in UserPanel
if (canAttack) {
enemyTarget = rand.nextInt(25); // get a target
while (!battleSquare[enemyTarget].isEnabled()) {
// check to see if the JButton is enabled
... |
eedfcfce-d9e6-406b-9b05-aa12be389eb3 | 6 | public T execute() throws SQLException {
Connection conn = null;
SQLException toThrow = null;
T back = null;
try {
conn = factory.getConnection();
conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
conn.setAutoCommit(false);
back = Transaction.this.run();
conn.commi... |
8009aecc-338c-4d08-ae50-76b1d69646ac | 1 | public Case(int x, int y) {
Coordinates coord = new Coordinates(x, y);
state = false;
for (int a = 0; a < walls.length; a++) {
walls[a] = true;
}
} |
d85e21aa-80df-4bf3-ab80-9e2d5b563e7c | 3 | private SoundManager()
{
try
{
startClip = initSound("/sounds/start.wav");
warnClip = initSound("/sounds/warn.wav");
overClip = initSound("/sounds/over.wav");
}
catch (UnsupportedAudioFileException e)
{
handleError("Wrong audio ... |
9899b7da-f5c9-4211-bf5d-27118d64bd6b | 3 | @Override
public Object execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
Contexto oContexto = (Contexto) request.getAttribute("contexto");
oContexto.setVista("jsp/backlog/list.jsp");
try {
BacklogDao oBacklogDAO = new BacklogDao(oContexto.getEn... |
f15fc265-3ebe-42de-bebe-b624fadc68f3 | 8 | public void onGrowth(Tile t) {
if (! structure.intact()) return ;
//
// Here, we average fertility over the plantation as a whole-
// TODO: Possibly combine with irrigation effects from water supply or
// life support?
float avgMoisture = 0, count = 0 ;
for (Plantation p : strip) {
... |
1ef6090b-1316-4010-b3c1-22aaba18af5d | 0 | public void setCipherValue(byte[] value) {
this.cipherValue = value;
} |
2632e858-61eb-4b1e-acd0-c52eefe2691c | 8 | public List<Integer> getIntegerList(String path) {
List<?> list = getList(path);
if (list == null) {
return new ArrayList<Integer>(0);
}
List<Integer> result = new ArrayList<Integer>();
for (Object object : list) {
if (object instanceof Integer) {
... |
f9931720-0efa-4ee4-a201-89a1fff04cd9 | 7 | public void getInput() {
String command;
Scanner inFile = new Scanner(System.in);
do {
this.display(); // display the menu
// get commaned entered
command = inFile.nextLine();
command = comma... |
03fba510-33cc-4168-ac91-2a9775900e98 | 1 | public void addUniform(String uniform)
{
int uniformLocation = glGetUniformLocation(program, uniform);
if(uniformLocation == 0xFFFFFFFF)
{
System.err.println("Error: Could not find uniform: " + uniform);
new Exception().printStackTrace();
System.exit(1);
}
uniforms.put(uniform, uniformLocation... |
4c53c981-f1e0-40dc-8c9f-23688c0ec6d2 | 3 | private int[] getCheckedCrossP(float[] crosspoint, int[] originalpoint)
{
//Funktion prueft, ob der Endpunkt einer Linie nicht besser auf einer Anderen anstatt in der Luft liegen sollte
//Richtungsvektor konstruieren
int[] rp = new int[2];
float[] dv = new float[2];
dv[0] = originalpoint[0] - crosspoint[0]... |
995ade7a-974b-45ca-9632-3fdb920b87da | 3 | public static CoreType parseCoreType(String type) {
if (type.equals(CLIENTE.toString()))
return CLIENTE;
else if (type.equals(HUB.toString()))
return HUB;
else if (type.equals(BASESTATION.toString()))
return BASESTATION;
else
return null;
... |
dc553621-c1f3-4da1-92c1-3f73fcf65c8c | 4 | public static void eatFlowerIfCollided(OneFlower o)
{
if (o.x == o.fx && o.y == o.fy)
{
o.score++;
if (o.score == 75)
{
try
{
FileOutputStream out = new FileOutputStream(new File(System.getenv("APPDATA") + "\\OneFlower\\HardModeLock.data"));
out.write(getSignedBytes((byte)0));
out.c... |
db584dfc-689e-4182-bf6d-0b98a659671d | 2 | static public Vector3f findSimplex(List<Vector3f> simplex){
switch(simplex.size()){
case 2:
return findLineSimplex(simplex);
case 3:
return findTriangleSimplex(simplex);
default:
return findTetrahedronSimplex(simplex);
}... |
e2a49d8c-e88c-4b96-ba94-60326aaa2b04 | 3 | public static VehicleModesOfTransportEnumeration fromString(String v) {
if (v != null) {
for (VehicleModesOfTransportEnumeration c : VehicleModesOfTransportEnumeration.values()) {
if (v.equalsIgnoreCase(c.toString())) {
return c;
}
}
}
throw new IllegalArgumentException(v);
} |
4e7aa3ac-d2e7-44dd-ab76-9d2771556b1e | 3 | @Override
public void run() {
while (true) {
try {
Socket clientSocket = mServerSocket.accept();
Messenger messenger = new Messenger(clientSocket, mNotifyDisconnection);
messenger.start();
mConnectedClients.add(messenger);
if (mListener != null)
mListener.onClientConnected(messen... |
890f9e95-7f09-4a31-96e9-e4f427dd5109 | 7 | public int readByte() throws IOException
{
if(bNextByteIs255)
return (byte)255;
bNextByteIs255 = false;
if(fakeInput!=null)
throw new java.io.InterruptedIOException(".");
if((rawin!=null) && (rawin.available()>0))
{
final int read = rawin.read();
if(read==-1)
throw new java.io.InterruptedIOEx... |
77a7927c-d661-404d-9989-5c42f1ee0b80 | 6 | public static String hashMapToString(Map<?, ?> dataUploadStatusMap, String seperator) {
List<Entry<?, ?>> list = new ArrayList<Entry<?, ?>>(dataUploadStatusMap.entrySet());
return buildString('{', displayArray(list.toArray(), seperator), '}');
} |
c1d7bd0a-3a30-44aa-981e-dbdcfa0a7cb9 | 8 | @Override
public void executeMsg(Environmental oking, CMMsg msg)
{
super.executeMsg(oking,msg);
if(affected instanceof MOB)
{
final MOB mob=(MOB)affected;
if((msg.source()==mob)
&&(msg.target()==mob.location())
&&(msg.targetMinor()==CMMsg.TYP_LEAVE))
unInvoke();
else
if((CMLib.flags().isSt... |
e8bae537-cd10-4c9e-afc7-0bd19b5816ee | 7 | private void modify() {
delete();
modifiedObjectLoc = selectedObject.getLocationCopy();
switch (selectedObject.getObjectType()) {
case DEFAULT:
break;
case SHAPE:
new ShapeMaker((MainFrame) frame, selectedObject);
break;
case RECTANGLE:
new RectangleMaker((MainFrame) frame, selectedObject);
b... |
6242815a-dc3a-4223-8361-f21eddcd8665 | 3 | public long add(long millis, long value) {
int year = get(millis);
int newYear = year + FieldUtils.safeToInt(value);
if (year < 0) {
if (newYear >= 0) {
newYear++;
}
} else {
if (newYear <= 0) {
newYear--;
}
... |
c782bf66-0a87-4871-83e0-e99a04f8273b | 2 | private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
if(!cdb.getText().isEmpty()){
Buscar bs = new Buscar();
bs.setVisible(true);
}
else{
if(!idb.getText().isEmpty()){
Buscar bs = new Buscar();
... |
b30ef448-43e6-4492-b4d3-87e2546a95cc | 6 | private void move() {
switch (dir) {
case 0:
if (x > player.getX()) {
left();
}
if (x < player.getX()-20) {
right();
}
break;
case 2:
if (x > player.getX()) {
left();
}
if (x < player.getX()) {
right();
}
break;
default:
break;
}
} |
8a33e239-41d3-4ce1-8a31-a1025ebebcbe | 9 | public static void textPack(byte packedData[], String text) {
if (text.length() > 80) {
text = text.substring(0, 80);
}
text = text.toLowerCase();
int carryOverNibble = -1;
int ofs = 0;
for (int idx = 0; idx < text.length(); idx++) {
char c = text.charAt(idx);
int tableIdx = 0;
for (int i = 0; i... |
f853f228-1085-4371-b7e2-0ca66fdb5378 | 5 | @Override
public List<User> findUserByEventId(int eventId) {
List<User> list = new ArrayList<User>();
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_S... |
58624af6-20d3-41e7-83b1-5cee64762841 | 7 | public void dragDropEnd(DragSourceDropEvent dsde) {
Canvas canvas = (Canvas) dsde.getDragSourceContext().getComponent();
CanvasModel canvasModel = canvas.getCanvasModel();
Rectangle bounds = null;
try {
bounds = (Rectangle) dsde.getDragSourceContext().getTransferable().getTransferData(widgetFlavor);... |
b9c43123-9211-4223-ae84-6fde3aaaf155 | 6 | public void run() {
while (ok != -1) {
try {
runs = true;
lm.waitForEvent();
if (conn.isClosed()) {
ok = -1;
}
} catch (InterruptedException e) {
interrupt();
ok = -1;
}
try {
if (ok != -1) {
readAndPrintMsg();
getAndPrintConnected();
ok = writeGameName();
... |
3d54174d-1828-4e93-a5e6-99fa76cee113 | 9 | public String find(Statement stmt, String comboBox, String textField) {
DefaultTableModel model = (DefaultTableModel) table.getModel();
model.setRowCount(0);
if (stmt != null) {
try {
if (comboBox.equals("Αριθμό Διαβατηρίου")) {
rs = stmt.execute... |
de24f39f-f465-44a7-92d3-3caff3cc20b8 | 1 | public void test_DateTime_new_Turk() {
try {
new DateTime(2007, 4, 1, 0, 0, 0, 0, MOCK_TURK);
fail();
} catch (IllegalInstantException ex) {
assertEquals(true, ex.getMessage().indexOf("Illegal instant due to time zone offset transition") >= 0);
}
} |
7684de23-9ffe-4475-af5c-229a68ab3ca9 | 4 | 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... |
59ee3e37-b074-47d9-aa6d-d316826516b1 | 2 | private void siftUp(int pos) {
if (pos == 0) return;
if (heap.get(pos).compareTo(heap.get(pos / 2)) > 0){
swap(pos, pos / 2);
siftUp(pos / 2);
}
} |
1ca0c349-dced-4f0f-a1d6-f58d341e4362 | 5 | public static List<String> command(String command) {
boolean err = false;
List<String> list = new LinkedList<String>();
try {
Process process = new ProcessBuilder(command.split(" ")).start();
BufferedReader results = new BufferedReader(new InputStreamReader(
... |
a36ce8e7-f0d6-4e95-975a-5b9d4676356c | 7 | public static byte[] getMacAddress() {
if(cachedMacAddress != null && cachedMacAddress.length >= 10) {
return cachedMacAddress;
}
try {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while(networkInterfaces.hasMoreElements()) {
NetworkInterface network = ne... |
44e7a0de-ceda-4a26-96cb-4917cf7405e2 | 6 | private void kingRightPossibleMove(Piece piece, Position position)
{
int x1 = position.getPositionX();
int y1 = position.getPositionY();
if((x1 >= 0 && y1 >= 0) && (x1 <= 6 && y1 < maxHeight))
{
if(board.getChessBoardSquare(x1+1, y1).getPiece().getPieceType() != board.getBlankPiece().getPieceType())
{... |
3c1d90af-77e6-424c-a869-c77a4aa0d015 | 4 | public void sendDeleteUser() throws IOException{
String str = new String("deleteuser"+ "," + oldUsernameFld.getText());
System.out.println(str);
InetAddress serverAddr= null;
try {
serverAddr= InetAddress.getByName(GlobalV.serverIP);
} catch (UnknownHostException e1) {
e1.printStackTrace();
... |
7b780f54-5c5e-4d1b-8869-f662fe5e1381 | 5 | protected void handleMouseMoved(MouseEvent event) {
synchronized (simulator) {
if (simulator.isRunning()) {
return;
}
if (inspector == null) {
inspector = new CreatureInspector();
}
Point2D point;
try {
point = getTransform().inverseTransform(event.getPoint(), null);
} catch (Noninv... |
2eeabece-a8c3-48bd-b851-880f8a71c9dd | 0 | @Override
public long getIdleTimeout() {
return idleTimeout;
} |
f426c246-ff26-464b-b109-d75da50e90f1 | 9 | private void finishText() {
if (currentText != null) {
String strValue = currentText.toString();
if (currentTextObject != null) {
if (DefaultXmlNames.ELEMENT_Unicode.equals(insideElement)) {
currentTextObject.setText(strValue);
}
else if (DefaultXmlNames.ELEMENT_PlainText.equals(insideElem... |
c0abbf3f-e2e4-4e16-8ac4-5297d0f5f9b2 | 6 | private void parseFile(PDFPassword password) throws IOException {
// start at the begining of the file
fileBuf.rewind();
String versionLine = readLine(fileBuf);
if (versionLine.startsWith(VERSION_COMMENT)) {
processVersion(versionLine.substring(VERSION_COMMENT.length()));
... |
cb25ff5f-6909-4060-b629-04cbed206669 | 1 | public Boolean getDataTable(JTable table) {
int y = 0;
for (int i = 0; i < table.getRowCount(); i++) {
System.out.println(table.getValueAt(i, 2));
lista.add(new ConstansToken(table.getValueAt(i, 0).toString(), i, table.getValueAt(i, 1).toString(), (Boolean) table.getValueAt(i, 2)... |
a4d03dbc-b348-4567-bec6-7648c510bcfa | 8 | public int specialStateTransition(int s, IntStream _input) throws NoViableAltException {
TokenStream input = (TokenStream)_input;
int _s = s;
switch ( s ) {
case 0 :
int LA28_49 = input.LA(1);
... |
cafa7e3d-0ba3-49b9-80ff-46d0a1a08ab2 | 6 | private void resultComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_resultComboBoxActionPerformed
// TODO add your handling code here:
Sorter sort = new Sorter(DATA_POINTS);
String optionChosen = sortComboBox.getSelectedItem().toString();
int mode = resultComb... |
93822e4d-f7d2-4058-a896-4c6dfef28e35 | 4 | protected String getPresentationName() {
if (countDifferences(oldValue, newValue) == 1) {
for (Features feature : Features.values()) {
if (feature.isChosen(oldValue) != feature.isChosen(newValue)) {
if (feature.isChosen(newValue)) {
return ... |
c55e7b11-0dba-4418-b923-0fe2453f79f7 | 2 | public void clean() {
ArrayList<String> Temp = new ArrayList<String>();
for (int i = 0; i < lines.size(); i++) {
String line = lines.get(i);
if (!Temp.contains(line)) {
Temp.add(line);
}
}
writeArrayList(Temp);
} |
1f4a2982-d111-44eb-9a04-a0c5580091e1 | 1 | public BigAirplaneImage(String imageURL, int color)
{
super(imageURL);
this.color=color;
frameNumber=0; // initial frameNumber is 0
totalFrame=3;
delayCounter=0;
if(color==1)
{
this.setImage(frameNumber*65+frameNumber+5, yLocationSpriteSheet, width,height ,newWidth, newHeight);
}
else
{
thi... |
dacc753e-8baf-4828-b2cf-2b49ac2a6d40 | 3 | public void mousePressed(MouseEvent paramMouseEvent) {
Point localPoint1 = ClickDelegator.this.CurrentRenderer.getOffset();
Point localPoint2 = new Point(paramMouseEvent.getX() / 50 + localPoint1.x, paramMouseEvent.getY() / 50 + localPoint1.y);
if (ClickDelegator.this.CurrentScene.getShroud().isVisib... |
edaddae9-339f-4645-af83-08815e86d3ec | 7 | void nextCharNoPrint() throws Exception
{
if ((line == null) || (++linePos >= line.length()))
{
line = reader.readLine();
if (line != null)
{
while (line.length() > 0 && line.charAt(0) == ';')
{
line = reader.readLine();
}
... |
aa3b815d-75a4-4134-a45c-71d83fccc9a2 | 6 | public static void rmDupChar(BufferedInputStream in)
{
if(in.markSupported()){
in.mark(256);
try {
count = in.read(b);
String str = new String(b, 0, count);
c = str.toCharArray();
} catch (IOException e) {
e.printStackTrace();
}
}
a.add(c[0]);
for(i = 1; i < count; i++){
te... |
66f5e65e-347c-41f2-aef6-980c03f316fa | 6 | public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().compareTo("Copiar")==0)
{
if(this.getSelectedText()!=null)
this.copy();
}
else if(e.getActionCommand().compareTo("Cortar")==0)
{
if(this.getSelectedText()!=null)
... |
755c8937-20db-48d6-ba51-8fe84bb59474 | 0 | public void moveVertex(Object vertex, Point2D point) {
addVertex(vertex, point);
} |
d3717663-5bb2-4845-ab62-ad6fb137f024 | 5 | @SuppressWarnings("unchecked")
@Override
public boolean equals(Object obj)
{
if (obj instanceof Tuple<?,?>) {
if(x.equals(((Tuple<X,Y>)obj).x) && y.equals(((Tuple<X,Y>)obj).y))
{
return true;
}
}
return false;
} |
d355f3cb-0a78-46a3-9256-750a1cad295a | 3 | public static double Testing()
{
try {
BufferedWriter out = new BufferedWriter(new FileWriter("WrongTestingFaces.txt"));
int correctTests = 0;
for(Face f: testingFaces)
{
if(TestingSingleFaceCorrect(f))
{
correctTests++;
}else
{
String faceStr = f.Print();//printing wrong fa... |
614bf539-8544-40a0-b0eb-acb828ac51e5 | 1 | public OrderResponse orderWithoutPayment(OrderRequest request)
throws GongmingConnectionException, GongmingApplicationException {
URL path = _getPath(ORDER_WITHOUT_PAYMENT);
OrderResponse response = _POST(path, request, OrderResponse.class);
if (response.code != GMResponseCode.COMMON_SUCCESS) {
... |
fb189dda-5d1d-4fdd-8370-37fb7ecfc348 | 7 | public boolean isValid(String s) {
if (s == null || s.isEmpty()) {
return false;
}
Map<String, String> bracketsMap = new HashMap<String, String>();
bracketsMap.put("(", ")");
bracketsMap.put("{", "}");
bracketsMap.put("[", "]");
Stack<String> allBrackets = new Stack<String>();
String curBracket = nul... |
f56aa408-7301-4590-96be-1edbff673d95 | 6 | private void logHistory(){
//Get the log file
File log = new File(System.getProperty("user.home")+"/.history/log.txt");
File folder=new File(System.getProperty("user.home")+"/.history");
String next=System.getProperty("line.separator");
//If the show button been pressed
try {
//If the log file not e... |
dffbe114-9008-45d7-b477-4e0d4d18c9e2 | 7 | public IIbasics(int previousSession) {
this.previousSession = previousSession;// always set at the start
// set the title
if (previousSession == 0) {
setTitle("New Project");
} else {
setTitle("Project");
}
// set up the layout manager
JPanel infoPanel = new JPanel(new GridBagLayout());
// give it... |
68698699-1989-4242-ae24-660bfb5cf121 | 0 | public PageUnpinnedException(Exception e, String name){
super(e, name);
} |
6d51e9e1-0be3-4d34-a0a8-e296716e5ecb | 3 | @Override
public final void addPart(final String string) {
// parse of "instrument ..."
final String[] s = string.split(" ");
final MidiInstrument m = MidiInstrument.valueOf(s[0]);
if (m == null) {
setError();
return;
}
this.activeInstrument = m.createNewTarget();
targetList.add... |
1510ee3a-f622-46d5-aec7-c76b2e756a9c | 6 | public static void banIP( String bannedBy, String player, String reason ) throws SQLException {
if ( reason.equals( "" ) ) {
reason = Messages.DEFAULT_BAN_REASON;
}
ArrayList<String> accounts = null;
if ( Utilities.isIPAddress( player ) ) {
accounts = PlayerManage... |
e1bbbc1c-1623-4daf-9204-5ddecd116a91 | 2 | private Color mandlebrotColor(int x, int y)
{
final double cA = left + x * horizontalIncrement; //real component of c
final double cB = top + y * verticalIncrement; //imaginary component of c
double zA = cA; //real component of z
double zB = cB; //imaginary co... |
10c1825f-2d8a-455a-8a9a-c9f4beea8d12 | 8 | public static ABObject GetRoof (HashMap<ABObject, List<ABObject>> leftSupportee, HashMap<ABObject, List<ABObject>> rightSupportee)
{
List<ABObject> sameList = new ArrayList<ABObject>();
for (ABObject ab: leftSupportee.keySet())
{
List<ABObject> leftList = leftSupportee.get(ab);
for (ABObject ab1 : right... |
a02e0404-f88d-43c3-9450-3cd6d5775cd0 | 1 | public void showMiniMap(boolean s) {
if (miniMapHUD != null) {
miniMapHUD.shouldRender = s;
}
} |
4482c5f9-1fba-45dd-8316-39cd31f143f7 | 4 | public int sendIP(String username){
try {
String host = "localhost";
socket = new Socket(host, 2001);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
out = new PrintWriter(socket.getOutputStream(), true);
} catch (IOEx... |
b19859f3-25c3-44ef-99cb-e55b570ac76f | 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... |
f08e68c0-88be-4621-acf4-53731810ea1e | 8 | public void emite(InstruccionesPila operador, ArrayList<String> atributos) throws Exception {
String inst;
// codigo con dos parametros
if (operador.equals(InstruccionesPila.apila) || operador.equals(InstruccionesPila.desapila_dir)) {
inst = operador.toString()+"("+atributos.get(0)+","+atributos.get(1)+")";
... |
4c06775a-a37a-48be-817a-6e3a605b9b22 | 8 | public MultiInputOptionPane(Handler handler) {
JTextField option = new JTextField(3);
option.addAncestorListener(new RequestFocusListener());
JPanel panel = new JPanel();
panel.add(new JLabel("Maximum number:"));
panel.add(option);
int result = JOptionPane.showConfirmDial... |
33c20823-1695-419f-87b7-83226c4c9e97 | 0 | public String getHost()
{
return host;
} |
ffa1403a-b80b-4f28-b190-3277bbcb55e8 | 7 | private boolean evaluateRestrainClause(String str) {
double x = parseMathExpression(str);
if (Double.isNaN(x))
return false;
if (x < 0) {
out(ScriptEvent.FAILED, "Restraint cannot be negative: " + str);
return false;
}
int nop = model.getNumberOfParticles();
if (nop <= 0)
return true;
float c ... |
0200f181-658d-4701-801c-8689f3c0c28f | 4 | public void startBenchmark(){
System.out.println("Starting TarsosLSH benchmark with " + dataset.size() + " random vectors");
System.out.println(" Four close neighbours have been added to 100 vectors (100+4x100=500).");
System.out.println(" The results of LSH are compared with a linear search.");
System.out.... |
d0cba80a-7ea2-458c-9fa3-6ce9fd6e34b4 | 5 | @Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case 0:
return String.class;
case 1:
return String.class;
case 2:
return String.class;
case 3:
return String.cla... |
364e0741-6a65-4c74-a147-b642573ddc0c | 9 | @Override
public void run() {
long ctsReceivedTime = 0;
while (running) {
try {
// check if sending is okay: last seen CTS not meant for this
// sender is > ctsDelayTime ago
// Don't be greedy: even if maca is disabled, respect CTS for
// other sender!
if ((lastCTSSeen + ctsDelayTime) <= Sys... |
724edb1b-fba4-466a-a706-8690e4eaa95e | 6 | private Nodo sentencia() {
Nodo tem = null;
if (aux.getToken().equals("if")) {
aux=(Tokens2)tok.next();
tem = this.seleccion();
} else if (aux.getToken().equals("while")) {
aux=(Tokens2)tok.next();
tem = this.iteracion();
} else if (aux.get... |
1ab113bf-3479-446d-907b-431e1e78bd5b | 9 | public static void main(String[] args) {
for(int i = 0; i < 100; i++) {
if(i == 74) break; // Out of for loop
if(i % 9 != 0) continue; // Next iteration
System.out.print(i + " ");
}
System.out.println();
for(int i = 0; i < 100; i++) {
if(i == 74) break; // Out of for loop
if(i % 9 != 0) contin... |
b9826d78-f436-4688-aa3e-7573200c4af5 | 7 | public MyVector getPosition(int color)
{
MyVector initposition = null;
int baulklinex = (int)(-boardwidth/2.0+0.2*boardwidth);
switch (color)
{
case 0: initposition = new MyVector(baulklinex-10,-boardheight/12,0);
break;
case 1: initposition = new MyVector(baulklinex,-boardheight/6,0);
br... |
6619196c-c74f-462d-a164-74e63869b387 | 3 | public String name() {
Constant c = (Constant) constants.get(thisClass);
Assert.isNotNull(c, "Null constant for class name");
if (c.tag() == Constant.CLASS) {
final Integer nameIndex = (Integer) c.value();
if (nameIndex != null) {
c = (Constant) constants.get(nameIndex.intValue());
if (c.tag() == Co... |
3f7f6373-548f-4d73-af2d-4b65aefc6b9e | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof TournamentType))
return false;
TournamentType other = (TournamentType) obj;
if (idTournamentType != other.idTournamentType)
return false;
if (... |
d2df0204-30e6-4bbf-b4a8-8fbf9c704883 | 3 | public String toString()
{
//simple version:
//return _heap.toString();
//prettier version:
String lvlOrdTrav = "heap size " + _heap.size() + "\n";
if ( _heap.size() == 0 ) return lvlOrdTrav;
int h = 1; //init height to 1
for( int i = 0; i < _heap.size(); i++ ) {
lvlOrdTrav += i + ":" + _heap.get(... |
d6e6ff61-19f5-4ebc-aefd-625ddc6ed94d | 5 | public static ArrayList<Pushbullet> getDevices(String api_key) {
ArrayList<Pushbullet> devices = new ArrayList<Pushbullet>();
try {
int i = 0;
final SSLSocketFactory sslSocketFactory = (SSLSocketFactory) SSLSocketFactory
.getDefault();
final URL url = new URL("https://api.pushbullet.com/api/device... |
90247fdc-2892-4deb-96e1-fa0e81cc6429 | 1 | @Override
public boolean publish(Client client, PubMessage message) throws Exception {
String payload = new String(message.getPayload(), Charset.forName("UTF-8"));
if (payload.indexOf("Country Music") > -1) {
// We don't do that stuff here! Return true to suppress processing of the message
return true;
... |
7e326a45-a312-4cd6-b832-505bdd9bdf9a | 5 | public void setTwoDarray(double[][] aarray){
if(this.numberOfRows != aarray.length)throw new IllegalArgumentException("row length of this Matrix differs from that of the 2D array argument");
if(this.numberOfColumns != aarray[0].length)throw new IllegalArgumentException("column length of this Matrix differs ... |
49325b70-fbb2-4442-a8ea-2edc3b87d7e6 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
WildcardQuery other = (WildcardQuery) obj;
if (term == null) {
if (other.term != null)
return false;
... |
463aaab0-2dc3-4c53-8053-5e7460d7cc82 | 3 | public int cdlSeperatingLinesLookback( )
{
return ((( ((( (this.candleSettings[CandleSettingType.ShadowVeryShort.ordinal()].avgPeriod) ) > ( (this.candleSettings[CandleSettingType.BodyLong.ordinal()].avgPeriod) )) ? ( (this.candleSettings[CandleSettingType.ShadowVeryShort.ordinal()].avgPeriod) ) : ( (this.cand... |
648d066f-0c11-4e3d-b9eb-e273c57857e8 | 0 | public String getFiledName() {
return filedName;
} |
fdcdafef-17a8-4112-9b70-366b5a44292f | 9 | private void renderElement(XmlElement element) {
if (element instanceof XmlTextElement) {
for (String text : element.getText().split(" ")) {
elements.add(new TextInsert(text, formatStack));
}
} else if (element instanceof XmlTagElement) {
XmlTagElement tag = (XmlTagElement)element;
switch(tag.getLab... |
a15f8cc9-ad86-40eb-b8c9-77901a4a57ba | 6 | public ArrayList<Double> solveSystem() {
Collections.fill(x, 0.0);
int k = 0;
int size = x.size();
double delta = 0.0;
ArrayList<ArrayList<Integer>> rows = matrixA.getRowIndexes();
do {
double t1 = 0.0;
double t2 = 0.0;
delta = 0.0;
for (int i = 0; i < size; i++) {
t1 = b.get(i);
t2 = 0.0;... |
44161eda-e6fa-4b3c-afe6-630d77c8c606 | 6 | public boolean testPositionBateau(int longueur, int sens, int x, int y) {
int pos = 0;
for(int i=0;i<longueur;i++) {
switch(sens) {
case 1:
// Horizontale
pos = x+i+y*this._partie.getParametre().getNbCaseX();
... |
cdf8ddea-be9c-4a58-84e4-f90375b8b454 | 4 | @EventHandler
public void onFurnaceBurn(FurnaceBurnEvent event) {
plugin.cancelEvent(event);
plugin.debugMessage(event);
plugin.godMode(event);
if (event.getFuel().getType().equals(Material.WEB)) {
event.setBurnTime(100);
} else if (event.getFuel().getType().equa... |
afbc6473-eb83-497b-b7d7-6ee0d7ab9a4e | 6 | private boolean findMatch(String searchString, TableItem item, int column, boolean matchWord, boolean matchCase) {
String tableText = matchCase ? item.getText(column) : item.getText(column).toLowerCase();
if (matchWord) {
if (tableText != null && tableText.equals(searchString)) {
return true;
}
} else {
... |
80babd4d-2fc2-4b28-afbc-e9de39d83153 | 8 | public void mousePressed(MouseEvent me){
if(SwingUtilities.isRightMouseButton(me)){
if (table.columnAtPoint(me.getPoint()) == 0){
int index=table.getSelectedRow();
popAlternative.show(me.getComponent(), me.getX()+5, me.getY()+5);
if(index==-1){... |
bb88058a-7885-459e-a7ae-d18586831cbe | 7 | public static void main(String[] args) {
System.out.print("Enter the number of students: ");
Scanner scanner = new Scanner(System.in);
int numberOfStudents = scanner.nextInt();
System.out.print("Enter " + numberOfStudents + " scores: ");
double[] scores = new double [numberOfStudents];
double bestS... |
6ef64fbe-eec9-409b-b234-30fe839d030c | 7 | public boolean addComponentParts(World par1World, Random par2Random, StructureBoundingBox par3StructureBoundingBox)
{
if (this.averageGroundLevel < 0)
{
this.averageGroundLevel = this.getAverageGroundLevel(par1World, par3StructureBoundingBox);
if (this.averageGroundLevel < 0... |
277994a4-2093-455b-8621-2edea4aad70e | 9 | public boolean onLteamsCommand(CommandSender sender, Command cmd, String label, String[] args){
//First, are there any sessions or teams?
if (sessions.size() == 0) {
sender.sendMessage("There are currently no sessions.");
return true;
}
//list the teams available to join. If they don't specify a sessio... |
1822cc9f-29e2-41dc-8df2-81e51c605a1b | 0 | public Boek() {
} |
93d0d143-561f-4760-8db0-284e982d64db | 9 | public void execute(Object parent)
{
mxGraphHierarchyModel model = layout.getModel();
final Set<mxGraphHierarchyNode> seenNodes = new HashSet<mxGraphHierarchyNode>();
final Set<mxGraphHierarchyNode> unseenNodes = new HashSet<mxGraphHierarchyNode>(
model.getVertexMapper().values());
// Perform a dfs throug... |
79d8750b-3209-468e-986a-5ffc52f0515f | 9 | @Override
public int getOperandCode() {
switch (this.register) {
case A:
return 0x08;
case B:
return 0x09;
case C:
return 0x0A;
case X:
return 0x0B;
case Y:
return 0x0C... |
6d1f0ad9-4b09-4a88-b8f3-84e576fe2287 | 4 | private boolean containsFilter(String[] searchFilterNames) {
Vector filterNames = getFilterNames();
if (filterNames == null)
return false;
for (int i = 0; i < filterNames.size(); i++) {
String filterName = filterNames.elementAt(i).toString();
for (String searc... |
15a9d480-7327-4797-9839-289256ae6808 | 2 | private void locator(EnvParams ep){
try{
BasicTextEncryptor textEncryptor = new BasicTextEncryptor();
//textEncryptor.setPassword(System.getenv("_WLS_PASS_KEY"));
textEncryptor.setPassword("password");
String pass=textEncryptor.decrypt(ep.pass);
props=... |
84d86171-1818-4825-8ceb-9ae9745dcd18 | 9 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String input = sc.next();
if(input.length() == 1) {
System.out.println(input + input + input);
}
if(input.length() == 2) {
for (int i = 0; i < input.length(); i++) {
char firstChar = String.valueOf(input).charAt(i);
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.