method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
564516a3-ca0e-47ed-94c0-b634fa82a3a0 | 0 | public long getMaxClients() {
return maxClients;
} |
6e1f72b7-d90b-46d7-a7ef-35e54c1eda1b | 7 | public static void insertInitInfectedContacts() {
int numInserts = 0;
double minContactDuration = 0.0;
try {
HashSet<Integer> sick = new HashSet<Integer>(565685);
Connection con = dbConnect();
ResultSet getSickQ = con.createStatement().executeQuery(
"SELECT victimID FROM "+dendroTbl);
while (getS... |
a09e5c35-2df5-4c15-8245-a303e30569ba | 6 | public static final Color checkColour(int red, int green, int blue)
{
if (red < 0)
red = 0;
else if (red > 255)
red = 255;
if (green < 0)
green = 0;
else if (green > 255)
green = 255;
if (blue < 0)
blue = 0;
else if (blue > 255)
blue = 255;
return new Colo... |
1fe2f7a2-eae8-43bf-bd6a-4bb3d97767ee | 1 | @Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
return false;
} |
bd4a87f8-4a72-4c2f-b243-db754356c0a6 | 1 | private void draw() {
if (this.turnNumber > 1) {
this.activePlayer.draw(1);
}
} |
6e794f6c-95b4-4c95-8092-78198640f292 | 4 | public static Map<String, Object> getHasOne(Object obj) throws Exception {
Map<String, Object> attrs = new HashMap<String, Object>();
for (Field field : obj.getClass().getDeclaredFields()) {
Class<?> fieldType = field.getType();
String fieldName = field.getName();
Annotation[] annotations = field.getDeclar... |
05070b00-4715-4e84-8e08-b99a2d0ca347 | 6 | protected void rodaMidiaVirtual(){
/*
* verificacao de seguranca.
* se nao houver nenhuma midia na memoria secundaria.
*/
if(jogos.isEmpty())
if(JOptionPane.showConfirmDialog(null, "\nSem midias virtuais no disco local.\n\nAdicionar?","Midias Virtuais",JOp... |
ab9ffbca-dc83-4e7d-b249-0761720b9136 | 6 | public void updateState(int state) {
if( isValidStateToGo(state) ) {
setState(state);
switch (state) {
case CREATED:
setCreateTime(new Date());
case RUNNING:
setStartTime(new Date());
case ENDED:
case ENDED_CANCELLED:
case ENDED_TIMEOUT:
setEndTime(new Date());
default:
}
... |
d4ba26c5-9afc-4076-874e-20feb089b71b | 4 | public void sendGlobalMessage(ChatPlayer player, String message) {
String formattedMessage = formatMessage(player, message);
for (ChatPlayer data : plugin.onlinePlayers.values()) {
if (!data.ignoringPlayer(player.getName()) || data.isChatSpying()) {
data.sendMessage(formattedMessage);
}
}
if (plugin... |
1101dd4a-f86f-49e1-aaca-59276b8bea46 | 2 | public void render()
{
for(int i = 0; i < Sidebar.MAX_ELEMS; i ++)
{
if(elements[i] != null)
{
elements[i].render(Sidebar.xPos_ + Sidebar.HORIZONTAL_SPACING, elementPos[i]);
}
}
} |
ffba4a69-6335-4ad3-8aa6-0dc02895f3f2 | 6 | public void run() {
try {
// this will handle our XML
voyageurhandler voyHandler = new voyageurhandler();
// get a parser object
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
// get an InputStream from somewhere (could be HttpConne... |
f5784d39-4edc-47ec-a18f-e5af0b776768 | 7 | private SimpleNode findNodeABR(SimpleNode node, final int value) {
SimpleNode ret = null;
if (this.root == null) {
throw new RuntimeException("Le noeud [" + this.min + "; " + this.max + "] est vide et ne contient donc pas " + value + " !");
}
if (node == null) {
... |
8b16f547-4db0-4aeb-942c-bc5b6f0b41b3 | 7 | protected void initializeCommandTypeInfo()
{
super.initializeCommandTypeInfo();
Map mm6ArgumentTypeArrayByCommandTypeMap = super.getArgumentTypeArrayByCommandTypeMap();
Map mm6ArgumentTypeDisplayInfoArrayByCommandTypeMap = super.getArgumentTypeDisplayInfoArrayByCommandTypeMap();
... |
3bf16451-96b3-4d23-a0db-83ca31c3ed43 | 6 | public static int[][] place(State[][] map, int width, int height) {
int _i = width / 2;
int _j = height / 2;
int _1strandi;
int _1strandj;
int _2ndrandi;
int _2ndrandj;
int _3rdrandi;
int _3rdrandj;
int d12;
int d13;
int d23;
do {
Random rand = new Random();
do { ... |
07ae82c3-6a23-4bcf-971f-3798484b670b | 9 | public List<String> start(String nzbPath) {
List<String> out = new LinkedList<String>();
NZB nzb = getNzb(nzbPath);
List<File> files = nzb.getFiles();
int fileCount = 1;
for (Iterator<File> i = files.iterator(); i.hasNext();) {
File file = i.next();
... |
e43880a4-60d1-4fd4-aec6-fcbbea39d923 | 9 | public <G, H> BinaryCompositeBinaryFunction(BinaryFunction<? super G, ? super H, ? extends T> f,
BinaryFunction<? super L, ? super R, ? extends G> g, BinaryFunction<? super L, ? super R, ? extends H> h) {
this.helper = new Helper<G, H, L, R, T>(
Validate.notNull(f, "final BinaryFunct... |
cb630652-8717-49fd-9be7-aa0296fad618 | 6 | private void setFilterJob(String targetColumn, String... args) {
// Mapper Class
job.setMapperClass(FilterMapper.class);
// Output Key/Value
job.setMapOutputKeyClass(NullWritable.class);
job.setMapOutputValueClass(Text.class);
// Reducer Task
job.setNumReduceTasks(0);
//Set Parameters
//value : EMP... |
f2189461-d89d-4cd5-b9c6-9b66a5cc39bb | 6 | @Override
public void paint(Graphics g, RsTransform gt){
Color fc, lc;
fc = getFillColor();
lc = getLineColor();
if(fc==null && lc==null)
return;
if(refSegment==null){
// the shape is not depicted and not interactive because
// no polygon was ever supplied
... |
75739226-a2eb-4d9c-9aa0-98213646e6ee | 2 | public void addSetMethod(Field field, Method method) {
if(field == null) {
throw new IllegalArgumentException("Field cannot be null");
}
FieldStoreItem item = store.get(FieldStoreItem.createKey(field));
if(item != null) {
item.setSetMethod(method);
} else ... |
7bc6703c-9ffa-4329-a43f-e8a6003581f3 | 4 | public boolean readFile(String filename)
{
try
{
BufferedReader reader = new BufferedReader(new FileReader(filename));
String currentLine = reader.readLine();
while(currentLine!=null)
{
switch(currentLine.charAt(0))
{
... |
9f2990d3-5e0e-4d1d-9bbf-65aaf704fd4a | 2 | @Override
public boolean hasNext()
{
if (position >= addIngredientCommands.size() || addIngredientCommands == null) {
return false;
} else {
return true;
}
} |
bbbe78dc-a1fe-46ec-914f-dc1bcb7b84ae | 2 | public List<Integer> grayCode(int n) {
List<Integer> list = new ArrayList<Integer>();
list.add(0);
for(int i =0; i < n;i++){
int base = 1 << i;
for(int j = list.size()-1;j >=0;j--){
list.add(base + list.get(j));
}
}
return list;... |
da3d6f83-a176-4b16-afaf-3d6054c59f85 | 6 | private static void performWork(String dataStructure, int nrThreads,
int nrItems, int workTime, long seed)
throws InterruptedException {
Sorted<Integer> sorted = null;
if (dataStructure.equals(CGL)) {
sorted = new CoarseGrainedList<Integer>();
} else if (dataStructure.equals(CGT)) {
sorted = new Co... |
59438859-6b82-4885-9b15-1df25fbc6cd3 | 7 | public void fall() {
for (Block b : currentTetromino.getBlocks()) {
if ((b.getMapIndexY() == boardSizeY)
|| (tetrisMap[b.getMapIndexX()][b.getMapIndexY() + 1] == 1)) {
currentTetromino.setActiveStatus(false);
for (Block blk : currentTetromino.getBlocks()) {
tetrisMap[blk.getMapIndexX()][blk.getMa... |
b8871fc3-575a-4aa6-a581-a146016018f1 | 4 | private static int getuid(String s) {
try {
File file = new File(s + "uid.dat");
if (!file.exists() || file.length() < 4L) {
DataOutputStream dataoutputstream = new DataOutputStream(
new FileOutputStream(s + "uid.dat"));
dataoutputstream.writeInt((int) (Math.random() * 99999999D));
dataoutputs... |
ac11a0c6-6c7a-4a5c-8c10-231db71ef7f5 | 7 | private void testHelper_method_nullAnchor_shouldFail(MethodToTest method)
{
final IMutableMolecule NULL_ANCHOR = null;
switch (method)
{
case changeMoleculeEnergyLevel:
moleculeMediator.changeMoleculeEnergyLevel(NULL_ANCHOR, VALID_POSITION, VALID_ENERGY_CHANGE_AMOUNT);
break;
case createMoleculeAtPosit... |
6e34e58e-4cbd-40d2-a023-8080246475b1 | 4 | public static void main(String[] args) {
List<Integer> powInts = new ArrayList<>();
int limit = 10000000;
int pow = 5;
int start = 2; //ignore 1 for sum
for (Integer i = start; i < limit; i++) {
String s = String.valueOf(i);
char[] c = new char[s.length()];
c = s.toCharArray();
int sum = 0... |
d7f2c6f3-70db-4d56-bc9a-7845a0b0467a | 2 | protected float convert(char tipo, float grados){
float aux=0;
switch(tipo){
case 'c':
aux=(float)(this.gradosK-273.15);
break;
case 'k':
aux=(float)(this.gradosC+273.15);
break;
default:
System.out.println("Error el tipo es c o k");
break;
}
return aux;
} |
e98fcf50-c27a-4427-b8b9-41af1ea0f207 | 1 | private String createImports() {
ImportGenerator imports = new ImportGenerator( filePath );
imports.addImport( "import static org.junit.Assert.*;" );
imports.addImport( "import org.junit.*;" );
if ( hasSearch ) {
imports.addImport( "import java.util.List;" );
}
... |
295c0b5c-2e99-4554-9163-06374a15b0ff | 5 | public void majResumePersos(Joueur j){
LinkedList<Personnage> persos = j.getPersonnages();
Iterator<Personnage> persosIt = persos.iterator();
Personnage p;
JPanel unPerso;
panelResumePerso.removeAll();
while(persosIt.hasNext()){
p = persosIt.next();
... |
991d91e3-0213-40be-acf7-3e3d284b6f9d | 6 | public static void saveDimension(File file, PlaneDimension pd) {
Cell[][] dim = pd.getAllSeats();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < dim[0].length; i++) {
for (int j = 0; j < dim.length; j++) {
int outputVal = 0;
Cell.CellType ... |
7ddc7413-7d4b-4c5c-ab3c-097174ba1a90 | 1 | public boolean replaceSubBlock(StructuredBlock oldBlock,
StructuredBlock newBlock) {
if (innerBlock == oldBlock)
innerBlock = newBlock;
else
return false;
return true;
} |
ccd88fa4-e894-487d-a907-166b272104f5 | 2 | private void start (Player p) {
if ( p != white_player && p != black_player ) {
// runtime error!
return;
}
curPlayer = p;
} |
f2c2039a-aa6b-4896-9be1-36f7b22dd977 | 3 | public void mouseDragged(MouseEvent e) {
if (documentViewModel.getViewToolMode() ==
DocumentViewModel.DISPLAY_TOOL_TEXT_SELECTION) {
textSelectionHandler.mouseDragged(e);
} else if (documentViewModel.getViewToolMode() ==
DocumentViewModel.DISPLAY_TOOL_SELECTIO... |
86f7ad98-dda7-473a-8b36-8eb3639bf329 | 2 | public void intersect( PhysicObject object1, PhysicObject object2 )
{
// TODO: do intersect with all colliders
IntersectData intersectData = Intersect.colliders( object1.getColliders().get( 0 ), object2.getColliders().get( 0 ) );
if ( intersectData != null && intersectData.isIntersect() )
{
Vector3f directi... |
803de6bb-768e-4349-b3d4-8d5994cfb1a5 | 8 | public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int k, m;
while ((k = sc.nextInt())!=0 && k!=0) {
m = sc.nextInt();
HashMap course = new HashMap();
boolean satisfied = true;
for (int i = 0; i < k; i++) {
... |
61d53de0-0125-45d8-bc27-096147cdb55b | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof Pair<?, ?>) {
Pair<?, ?> other = (Pair<?, ?>) obj;
return ObjectUtils.equals(first, other.first)
&& ObjectUtils.equals(second, other.second);
}
return false;
} |
a52adcbb-88d1-4014-bca6-67ba55e27c6b | 9 | @Override
public void nativeKeyPressed(NativeKeyEvent ev) {
// Copy
if (ev.getKeyCode() == NativeKeyEvent.VK_C
&& NativeInputEvent.getModifiersText(ev.getModifiers()).equals(
"Ctrl")) {
System.out.println("Ctrl+C : call");
// Clip the pop
try {
Thread.sleep(100);
} catch (InterruptedExcep... |
7a992e0d-4bc2-4705-b6fb-e83556ee2f54 | 8 | @Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
result = prime * result
+ ((orderProductId == null) ? 0 : orderProductId.hashCode());
result = prime * result
+ ((productId == null) ? 0 : productId.hashCode());
res... |
39ec01ff-94b7-4dcd-9d9a-dbcb31a858a0 | 2 | public boolean hasError() {
return isErrorProteinLength() || isErrorStartCodon() || isErrorStopCodonsInCds();
} |
4675214a-2e2a-43d5-9d4b-a290ca7a2158 | 7 | public final String relativize(final Path base) {
Path p = this;
synchronized (Path.relativizer) {
Path.relativizer.clear();
while (p.getNameCount() > base.getNameCount()) {
p = p.getParent();
}
int same = p.getNameCount();
if (p != base) {
Path q = base;
if (q.getNameCount() > p.getNameC... |
e7b9da54-2532-4c1f-aeee-09b7fd987a7c | 5 | public void setEdge ( int edge ) {
if ( edge < 8 )
throw new IllegalArgumentException ( "Parameter edge must be not less than 8 it was set to " + edge );
if ( edge > MAX_EDGE )
throw new IllegalArgumentException ( "Parameter edge must be less than " + MAX_EDGE + " it was set to ... |
cfb16774-0daf-47be-91f3-223ca088c89e | 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... |
ce5061d6-408b-4d18-afc4-f2a8093db955 | 1 | private void deactivate() {
if (!isActive())
throw new IllegalArgumentException("Forcefield was already deactivated, something went wrong");
this.active = false;
} |
7ed4b69f-0698-4134-be56-b463764b2ed6 | 4 | @Override
public void actionPerformed(ActionEvent e) {
@SuppressWarnings("rawtypes")
JComboBox cb = (JComboBox) e.getSource();
String component = (String) cb.getSelectedItem();
// Afiseaza sau ascunde imaginea de background
if (component.compareTo(ElementsVisibility.S_IMAGE.toString()) == 0) {
gui.getDra... |
11ad8bba-673a-4100-9147-1b3e15042cf7 | 4 | @Override
public boolean renomearArquivo(String caminhoOrigem, String novoNome, String nomeUsuario)
throws RemoteException, XPathExpressionException {
Document xml = pedirXML(nomeUsuario);
//Alterar XML
String expressao;
if (caminhoOrigem.endsWith(".txt")) {
... |
54129d20-66f6-49f1-924e-630a4ace383b | 1 | public void setListener(MqttListener listener) {
this.listener = listener;
if (handler != null) {
handler.setListener(listener);
}
} |
5bcf2736-1f95-4041-98e7-8a20430ccca4 | 8 | private void merge(int[] array, int start, int mid, int end){
int leftIndex = start;
int rightIndex = mid+1;
int helperIndex = start;
//Compare and add elements in sorted manner to helper array
while(leftIndex <= mid && rightIndex <= end){
if(array[leftIndex] < array[rightIndex]){
mHelperArray[helpe... |
0d414978-bdb2-4b53-b5cf-96c37796bc92 | 1 | public JPanel getOptionBarMenu() {
if (!isInitialized()) {
IllegalStateException e = new IllegalStateException("Call init first!");
throw e;
}
return this.optionsBarMenu;
} |
3bc48226-70aa-4e67-a61f-3faf404239bb | 6 | @Override
public void propertyChange(PropertyChangeEvent evt)
{
CompoundPainter<?> painter = ref.get();
if (painter == null)
{
AbstractPainter<?> src = (AbstractPainter<?>) evt.getSource();
src.removePropertyChangeListener(this);
}
else
{
String property = evt.getPropertyName();
... |
0b7876ea-f3a7-4d9b-bfb6-5d43df7ea6ee | 3 | protected void parseStormData(StormSet stormSet, String gpx)
throws Exception
{
if(gpx == null)
throw new Exception("GPX XML is null");
this.stormSet = stormSet;
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setValidating(false);
SAXParser parser = factory.newSAXPars... |
19ae3346-976f-4d02-9d73-2f9e9a64dd61 | 4 | public void refresh() {
Transform3D t3d = new Transform3D();
presentation.getTransform(t3d);
t3d.setRotation(abstraction.getOrientation());
t3d.setTranslation(abstraction.getPosition());
t3d.normalize();
if (getUsedBy().isEmpty() && presentation.isBillBoardExisting())
presentation.hideBillBoard();
else... |
e9fba82a-1e76-47b6-b7b2-df2253a5f049 | 4 | @Override
public void execute(CommandSender sender, String[] arg1) {
if (!CommandUtil.hasPermission(sender, PERMISSION_NODES)) {
sender.sendMessage(plugin.NO_PERMISSION);
return;
}
if (arg1.length < 1) {
sender.sendMessage(ChatColor.RED + "/" + plugin.mute + " (player)");
return;
}
ProxiedP... |
eca1b5ba-0f85-4dfe-98ec-a23f88e67f67 | 7 | public void layoutContainer(Container parent){
Insets insets=parent.getInsets();
synchronized(parent.getTreeLock()){
int n=parent.getComponentCount();
Dimension pd=parent.getSize(); int y=0;
//work out the total size
for(int i=0;i<n;i++){
Component c=parent.getComponent(i);
Dimension d=c.get... |
aa246697-763c-4e25-b44f-c3428d112584 | 8 | public ArrayList<String> placeDotCom(int comSize) { // line 19
ArrayList<String> alphaCells = new ArrayList<String>();
String [] alphacoords = new String [comSize]; // holds 'f6' type coords
String temp = null; // temporary String for concat
int [] coo... |
2371de2e-8302-4899-a8e9-0f342083ce86 | 9 | @SuppressWarnings("unchecked")
@Override
public void drop(DropTargetDropEvent dtde) {
Transferable trans = dtde.getTransferable();
if (isDnD(trans)) {
dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
Vector<File> fileLst = new Vector<File>();
try {
if (trans.isDataFlavorSupported... |
f21a85db-22d2-4524-b5f8-8a8ec88211ae | 0 | public static Date getStartOfTheDay(Date date) {
String value = date2String(date, "yyyy-MM-dd 00:00:00");
return string2Date(value);
} |
3c873b16-3efe-4b7f-9092-bebca06560e7 | 5 | public Boolean load() {
FileInputStream fis = null;
ObjectInputStream ois = null;
try {
File f = new File("abalone.save");
fis = new FileInputStream(f);
ois = new ObjectInputStream(fis);
Game loadedGame = (Game) ois.readObject();
this.game = new Game(loaded... |
75dc1773-82e5-41b1-afb1-6ac9e2ceb187 | 6 | @Override
public void insertUpdate(DocumentEvent de) {
//Skip to the next TextField if input is valid and complete
try {
String text = de.getDocument().getText(0, de.getDocument().getLength());
int inputNumber = Integer.parseInt(text);
if ((inputNumber... |
623bd157-d020-45c5-9128-649e4ad72289 | 7 | private static void addFiles(File file,
List<String> result,
File reference) {
if (!file.exists() || !file.isDirectory()) {
return;
}
for (File child : file.listFiles()) {
if (child.isDirectory()) {
addFiles(child, result, reference);
} else {
String path = null;
while (chil... |
aef85f18-c963-4efc-bd96-712dafa72f38 | 3 | public SimpleComputer()
{
clearAll = new JButton("Clear All");
save = new JButton("Save");
load = new JButton("Load");
step = new JButton("Step");
run = new JButton("Run");
quickRef = new JButton("Quick Reference");
memory = new RegisterBox("Memory", 100, 20, ... |
b9fe737b-e548-4729-b64d-b04352069224 | 3 | @Override
protected String toString(int indent) {
String result = toString(indent, "Procedure");
// // decl
// return toString(indent, "ProcedureDeclaration\n")
// + procHeading.toString(indent + 1) + "\n"
// + procBody.toString(indent + 1);
// // head
// String str = toString(indent, "ProcedureHeadingNod... |
448d3844-ce0f-4b34-ae98-efcd1147988c | 9 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
try {
int index = interfaceList.getSelectedIndex();
if((!model.isEmpty() || model.getElementAt(0) != "<html><i>Your order is empty</i></html>") && index >= 0) {
if(mo... |
47396e82-1f25-4e53-96f0-149993ada1a0 | 6 | static final public void valConst() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case entier:
jj_consume_token(entier);
declaration.ajoutConstanteParEntier(YakaTokenManager.entierLu);
break;
case SUBNEG:
jj_consume_token(SUBNEG);
jj_consume_token(entier);
... |
836f1d93-2d2c-4949-bfde-7f8e34bfe4b3 | 2 | public Barrillo generarGrano() {
Random rand = new Random();
int x = (int) (0.28 * getWidth()) + rand.nextInt((int) (0.42 * getWidth()));
int y = (int) (0.34 * getHeight()) + rand.nextInt((int) (0.55 * getHeight()));
int maxAncho = rand.nextInt(20);
int maxAlto = maxAncho;
... |
6210e057-239d-4c15-91ff-36ef3f4abcd8 | 1 | private int getMachineIndexBySelectedRow(JTable table){
InputTableModel model = (InputTableModel) table.getModel();
int row = table.getSelectedRow();
if(row < 0) return -1;
String machineFileName = (String)model.getValueAt(row, 0);
return getMachineIndexByName(machineFileName);
} |
6aa80ec7-0c74-4a55-9ce4-b9b2743708f1 | 9 | public void valueChanged( final ListSelectionEvent e ) {
if ( e.getSource() == _font_list ) {
if ( _font_list.getSelectedValue() != null ) {
_fonts_tf.setText( ( ( String ) ( _font_list.getSelectedValue() ) ) );
}
_type = _fonts_tf.getText();
_test... |
82426d94-1db7-4aa0-8d74-8aa0d6522e91 | 4 | public Tile getTileFromVec(Vector2f v)
{
int x = (int) (v.getX() / Tile.size);
int y = (int) (v.getY() / Tile.size);
if(x < 0 || x > world.loadedMap.tileWidth - 1 || y < 0 || y > world.loadedMap.tileHeight - 1)
return null;
return world.tileGrid[y][x];
} |
a0808ca5-dd49-4986-8de8-a904da75ca79 | 2 | public static boolean isTypePage(Class<?> type) {
return (type != null && isAssignable(type, Page.class));
} |
cb9734c4-0e6c-4427-8e1f-c7d83e514293 | 3 | @Override
public boolean equals( Object obj ) {
if( obj == this ){
return true;
}
if( obj == null || obj.getClass() != getClass() ){
return false;
}
ConnectionFlavor that = (ConnectionFlavor)obj;
return that.id.equals( id );
} |
0cfbc121-3269-4202-bd61-d70abad63bf1 | 7 | private Direction getTurnDirection(double start, double stop) {
boolean turnOverZero = false;
if (Math.abs(start - stop) > 180)
turnOverZero = true;
if (turnOverZero && start > stop)
return Direction.LEFT;
else if (turnOverZero && start < stop)
return Direction.RIGHT;
else if (!turnOverZero && start... |
80be4b36-dc82-4489-898e-0435f224ebb2 | 3 | public static void crearMusica(HashMap<Integer, Musica> tablaMusica)
{
String titulo;
String formato;
Scanner entrada = null;
do // Validacion nombre
{
entrada = new Scanner(System.in);
System.out.print("Titulo del disco: ");
titulo = entrada.nextLine();
} while(titulo.equals(""));
do //... |
d5f226de-a18c-4a04-86d0-a4437b218d85 | 8 | @Override
public String lookup(String barcode) {
String productDesc = "";
if(!(barcode == null || barcode.equals("")))
{
try
{
//Max lookups per day
// There are max lookup of 2500 requests per day //if(numberOfRequests < 2500)
String result = "";
String finalVal = "";
result = getR... |
f4b9f078-7966-4faa-aaa3-1aee916dd8b4 | 8 | public /*@non_null@*/ int [] getSelection() {
if (m_Upper == -1) {
throw new RuntimeException("No upper limit has been specified for range");
}
int [] selectIndices = new int [m_Upper + 1];
int numSelected = 0;
if (m_Invert)
{
for (int i = 0; i <= m_Upper; i++) {
if (!m_SelectFlags... |
e8693e90-646e-4731-89ed-0c506563e97d | 1 | public synchronized Image getImage() {
if (frames.size() == 0) {
return null;
} else {
return getFrame(currentFrame).image;
}
} |
6c2ea5b3-ae37-47e7-93aa-aaa349de2286 | 0 | @Override
public String getDesc() {
return "BrandishSpear";
} |
b684feb6-bdd8-4b7b-bed9-b9042ce19d1c | 4 | public String createTable(DataSetDescriptor dsd) {
String tableName = dsd.getTablename();
String nameGeomColumn = dsd.getGeoColumnName();
String pk = dsd.getNamePK();
List<Column> columns = dsd.getFields();
int srid = 4326;
String columnsToTable = "";
String sqlCreateTable = "CREATE TABLE ";
Column geoC... |
e00554f1-462d-4158-b9c0-569a72172523 | 3 | public void apply() throws XPathExpressionException {
if(!input.isEnabled()) {
return;
}
int value = Integer.parseInt(input.getText());
// sanity checks
if(value < min) {
throw new IllegalArgumentException("Value is " + value + ". Has to be > " +... |
bf2d344d-907a-442b-9a95-087a6bb7bbcf | 6 | private static Node dot(Node recieverNode, Node call)
{
Argument reciever = recieverNode.getArgument();
if (!(call instanceof Reference))
throw new EvaluationException(call, "Can not invoke " + call);
Reference ref = (Reference) call;
String name = ref.getName();
Argument[] args = ref.resolveArguments(... |
51e975af-2b58-4696-b6ca-1913aa879fe1 | 9 | public static String getFilePath(File file) {
if(file == null) { return null; }
String path;
try {
path = file.getCanonicalPath();
}
catch(IOException e) {
path = file.getAbsolutePath();
}
if(file.isFile()) {
int index = -1;
for(int i=path.length() - 1;i>=0;i--) {
if(path.charAt(i) =... |
1bb6dcad-c3ef-4ac6-950f-ba885cdf5187 | 7 | public static int partition2(int[] records, int low, int high){
if(low > records.length - 1|| high > records.length - 1) {
throw new IllegalArgumentException();
}
int pivot = records[low];
while(low < high){
while (records[high] > pivot && low < high){
... |
00c61968-4387-444d-bceb-c9a0e6a00a00 | 7 | private static void test7() throws FileNotFoundException {
//Test winning by waiting for the guard to pass
String input = "new\n" + "pick up key\n" + "wait\n"
+ "unlock door with key\n" + "go through cell door\n" + "quit\n" + "y\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean... |
5ebdc0e0-d578-45f2-84a5-d594724cabe0 | 3 | public void desconectarBaseDeDatos(){
//metodo de desconexion
try{
if(conexion !=null){
if (sentencia !=null){
//si la conexion devuelve valores nulos
sentencia.close();
}
conexion.close();
}
... |
fbd32d92-82e3-451b-9bb4-1748b6944fd3 | 9 | public static String longestCommonPrefix(String[] strs){
int i = 0;
int minLength = Integer.MAX_VALUE;
if(strs == null || strs.length == 0) return "";
for(String str : strs){
if(str.length() < minLength) minLength = str.length();
}
char[] chs = new char[minLength];
while(true) {
char c = ' ';
for... |
bcb714ad-1993-4c08-81f3-1b54df651124 | 7 | static String[] sort(String[] input){
String temp;
int left=0;
int right=0;
for(int i=1; i<input.length;i++){
left=0;
right=i-1;
while(left<right){
int mid=(left+right)/2;
if(input[mid].compareTo(input[i])>0){
right=mid-1;
}else{
left=mid +1;
}
}
t... |
447b33e4-4614-4dae-ba85-72e241b813d6 | 0 | public static void swap(List<Character> list, int i, int j) {
Character temp = list.get(i);
list.set(i, list.get(j));
list.set(j, temp);
} |
af111fb7-674d-42ff-af37-55884a443f88 | 3 | public static RunData loadFromFile(File file) throws XMLParsingExeption, ParserConfigurationException, SAXException, IOException
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder builder = factory.newDocumentBuild... |
920321a7-a544-400d-81c7-93a647f381b5 | 6 | @Override
public void mouseClicked(final MouseEvent e) {
this.e = e;
player.setActivityTimer(1000);
//if(player.getActivityTimer()==0){
new Thread(new Runnable(){
@Override
public void run() {
BarOverlay overlay = (BarOverlay)((JLabel) e.getSource()).getParent();
overlay.progress.setVisi... |
152ef5d6-87f4-4eba-a2da-6e9bda2f10d5 | 5 | public static void loadScripts() throws IOException {
System.out.println("Loading scripts...");
ScriptManager.python.cleanup();
File scriptDir = new File("./Data/scripts/");
if (scriptDir.isDirectory() && !scriptDir.getName().startsWith(".")) {
File[] children = scriptDir.listFiles();
for (File child : ch... |
894f5d26-99c0-42b4-9a2a-946494495773 | 3 | protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
/**
* Servlet näyttää käyttäjälle hänen tekemänsä tilauksen, jonka tiedot
* haetaan tietokannasta. Aluksi varmistetaan, ettei käyttäjä saa
* virheilmoitusta jos hän päivittää sivun sen jäl... |
84df2907-512a-4d84-98d1-0d0ab670d3e3 | 0 | public String toString(String input) {
return name;
} |
44d1dea9-63ee-45e6-b3e0-c628d4e4f90f | 8 | public int addRun(int start, int length, T font) {
int end = start + length - 1;
RunArrayEntry newEntry = new RunArrayEntry(start, end, font);
if (runArray.size() == 0) {
// Empty runArray
runArray.add(newEntry);
return 0;
}
// Find position of new entry
int previousEntryIdx = -1;
int nextEntry... |
7aa09273-85f5-4faf-a505-b4130e5d11ea | 4 | public static Question getQuestionData(int QDbId)
{
try
{
Question q = new Question();
String qstatement = String.format("Select * from question where questionid = %d", QDbId);
ResultSet qrs = getQueryResults(qstatement);
if (qrs.next())
{
q.questio... |
49529e43-6a2a-40cc-b715-4ee238eefc81 | 7 | private int maximalSquareLengthFromPoint(char matrix[][], int row, int column) {
String areaLookupKey = String.valueOf(row)+","+String.valueOf(column);
if (areaLookup.containsKey(areaLookupKey)) {
return areaLookup.get(areaLookupKey);
}
if (matrix[row][column] == '0') {
... |
164dee7f-2197-4c47-9d8b-ae3165941a41 | 3 | public void logisticProbabilityPlot(){
this.lastMethod = 8;
// Check for suffient data points
this.logisticNumberOfParameters = 2;
if(this.numberOfDataPoints<3)throw new IllegalArgumentException("There must be at least three data points - preferably considerably more");
... |
89cc2905-60af-4a3c-8465-985d188d50a7 | 7 | final void method737(AbstractToolkit var_ha, int i, int i_32_, int i_33_, int i_34_,
int i_35_, int i_36_) {
if (aClass105_1221 != null) {
int i_37_ = anInt1231 - i_35_ & 0x3fff;
int i_38_ = anInt1219 - i_36_ & 0x3fff;
if (i_38_ > 8192)
i_38_ -= 16384;
if (i_37_ > 8192)
i_37_ -= 16384;
... |
9b4d56cd-995b-41fd-b543-74ea84812db9 | 0 | public void setScreenX(int screenX) {
this.screenX = screenX;
} |
fb688156-f436-4769-8afb-1b9e060c400b | 6 | private void removeFoundNode(TreeNode removingNode) {
TreeNode parentNode;
if (removingNode.left == null || removingNode.right == null) {
parentNode = removingNode;
} else {
parentNode = successor(removingNode);
removingNode.key = parentNode.key;
}
TreeNode childNode;
if (parentNode.left != n... |
f4d357bc-34ed-4c19-ad23-9db00c5b04f7 | 8 | public int readBits(int numBits) {
if (numBits < 1 || numBits > 32) {
throw new IllegalArgumentException();
}
int result = 0;
// First, read remainder from current byte
if (bitOffset > 0) {
int bitsLeft = 8 - bitOffset;
int toRead = numBits < bitsLeft ? numBits : bitsLeft;
... |
6331aad0-1daf-45c5-a17c-19c3a9d34d02 | 1 | public void execute(String statement)
{
try{
Statement stat;
stat=this.conn.createStatement();
stat.execute(statement);
}catch(SQLException e)
{
e.printStackTrace();
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.