method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
d2f283eb-c8a8-4730-93fe-52bbb8447080 | 9 | public int command(int cmd) {
if (cmd_pending) // If this is the second word of a command
{
int A14_15 = (cmd & 0x0003) << 14;
rw_addr = (rw_addr & 0xffff3fff) | A14_15;
// Copy rw_addr to mirror register
rw_addr = (rw_addr & 0x0000ffff) | (rw_addr << 16)... |
f6a82a88-46e2-4e41-b049-5eb1326a48eb | 5 | final String _readComment_() throws IOException {
final Reader source = this._reader_;
final StringBuilder result = this._builder_;
result.setLength(0);
while (true) {
int symbol = source.read();
switch (symbol) {
case -1:
case '\r':
case '\n':
return result.toString();
case '\\':
... |
008a1edd-5e3b-4ee4-91da-1b10b62ee379 | 0 | public void setMaxSpyDepth(int maxSpyDepth) {
this.miningDepth = maxSpyDepth;
} |
ba01946f-2f1a-44b1-9e63-b22ce7852519 | 6 | @Override
public boolean onCommand(CommandSender sender, Command command, String label,
String[] args) {
String lbl = label.toLowerCase();
// label must be help
if(lbl.equalsIgnoreCase("help")) {
String nested;
// get first argument (could be one of the commands)
try {
nested = args[0];
... |
4c79ce15-3c1b-4f8b-9d14-3a3ce900014d | 6 | public static void call(final String mapping, final String data) throws Exception {
Iterator errors = null;
DataError dataError = null;
final Parser pzparser = DefaultParserFactory.getInstance().newFixedLengthParser(new File(mapping), new File(data));
final DataSet ds = pzparser.parse();... |
55a375c4-3f9e-4ca3-b578-fe9db9c22dbf | 1 | public static void main(String args[]) throws InvocationTargetException, InterruptedException {
new Thread() {
public void run() {
CardFrame frame = new CardFrame();
try {
Thread.sleep(200);
} catch (InterruptedException e) {
... |
efc4d7b5-8bce-49ea-944f-49ad5da0a149 | 1 | public JSONArray getJSONArray(int index) throws JSONException {
Object object = this.get(index);
if (object instanceof JSONArray) {
return (JSONArray) object;
}
throw new JSONException("JSONArray[" + index + "] is not a JSONArray.");
} |
7f75da6a-0996-4548-b0cf-4adc1580abec | 0 | public void aboutCourse() {
System.out.println("Course name: "+ name);
System.out.println("Hours: " + hours);
} |
7e457a4a-b7df-4c9b-b904-30b01e5f7f24 | 9 | public static Stella_Object justificationArgumentBoundTo(Stella_Object argument, Justification justification) {
if (Surrogate.subtypeOfP(Stella_Object.safePrimaryType(argument), Logic.SGT_LOGIC_PATTERN_VARIABLE)) {
{ PatternVariable argument000 = ((PatternVariable)(argument));
if (justification == nu... |
8f2cc80f-2f01-4673-985e-8bfdaf16b91c | 6 | @Override
public void keyPressed(KeyEvent e)
{
switch (e.getKeyCode())
{
case KeyEvent.VK_DOWN:
{
downPressed=true;
}
break;
case KeyEvent.VK_UP:
{
upPressed=true;
}
break;
case KeyEvent.VK_RIGHT:
{
rightPressed=true;
}
break;
case KeyEvent.VK_... |
da463c47-fa0a-4e7d-a24e-862df50b63d5 | 3 | public ArrayList<String> getProperties(){
ArrayList<String> commands = new ArrayList<String>();
try {
r = new BufferedReader(new FileReader(config));
} catch (IOException e) {
}
String temp;
try {
while((temp = r.readLine()) != null){
commands.add(temp.substring(temp.indexOf(": ")));
}
... |
93fdd336-f277-4c8d-9d24-5bc78fcee9a2 | 2 | @Override
public boolean contains(final String column) {
final Iterator<ColumnMetaData> cmds = ParserUtils.getColumnMetaData(row.getMdkey(), metaData).iterator();
while (cmds.hasNext()) {
final ColumnMetaData cmd = cmds.next();
if (cmd.getColName().equalsIgnoreCase(column)) {... |
29d4594c-b859-4f94-b575-4b8843109725 | 8 | Object callChunk(ScriptContext context) throws ScriptException {
try {
// Apply context
Object[] argv;
if (context != null) {
// Global bindings
Bindings bindings;
bindings = context.getBindings(ScriptContext.GLOBAL_SCOPE);
if (bindings != null) {
applyBindings(bindings);
}
// E... |
7e72f388-28b2-4b48-be9a-e5be0f85bc91 | 3 | @Override
public boolean onCommand(CommandSender sender, Command command, String label,
String[] args) {
plugin.debugMsg("PvPTime command:" + label.toString());
if(args.length > 0) {
plugin.debugMsg("Args length: " + args.length);
if(args[0].equalsIgnoreCase("relo... |
5d9f5a1a-d528-4c20-8769-5cc9d9ec241c | 4 | public static void postData(String url, JSONObject obj) throws IOException {
URL posturl = new URL(url);
HttpURLConnection con;
if (ApiProperties.get().getUrl().contains("https")) {
setupConnection();
con = (HttpsURLConnection) posturl.openConnection();
} else {
con = (HttpURLConnection) posturl.openCo... |
fb083c2d-ded4-42b7-90a4-4b6b6d2bd0d6 | 5 | @Override
public void update(Observable o, Object arg) {
if (arg instanceof SearchModel) {
this.model = (SearchModel) arg;
}
/**-50 to count for the offset of the textbox*/
show(this.textField, -50, this.textField.getHeight());
List<PictureObject> pictures = this.model.getPictures();
this.setListItem... |
ef30dbe9-691f-4180-baa0-1e2b76bfd1ba | 2 | public void setValue(int i) {
if (this.slider != null) {
this.slider.setValue(i);
}
if (this.spinner != null) {
this.spinner.setValue(new Integer(i));
}
} |
d649eab4-8707-4bc6-83e3-65ea5f746ffe | 8 | void readSessions()
{
Sheet sessions_sheet = workbook.getSheet("Sessions");
for (int si = 1; si < sessions_sheet.getRows(); si++)
{
String name = sessions_sheet.getCell(0, si).getContents();
String title = sessions_sheet.getCell(1, si).getContents();
Strin... |
fef73d34-aca5-4b38-b258-2ccb1ab987fb | 1 | private boolean inRange(Unit unit)
{
int dist = Math.abs(unit.getX() - x) + Math.abs(unit.getY() - y);
return dist >= getMinRANGE() && dist <= getMaxRANGE();
} |
8f17f7f4-36e5-41b4-93f3-bef30ad45ee7 | 9 | public void render(Graphics g){
// if(!walkable){
// g.drawImage(wall, x, y);
// return;
// }
//g.drawImage(floor, x, y);
// if(minion != null){
// g.setColor(Color.white);
// g.fillRect(x, y, width, height);
// minion.render(g,x,y);
// //return;
// }
g.setColor(Color.transparent);
if(start){
// ... |
9fe9a455-0309-4bda-9b67-46c8c4419af4 | 2 | public static Cause findCauseById(ArrayList<Cause> causes, int id) {
for(Cause cause:causes) {
if(cause.getId()==id) {
return cause;
}
}
return new Cause();
} |
e3bfffd7-8bdc-4fdf-a422-78adef3afb19 | 2 | public ErrorPanel() {
setBackground(Color.BLACK);
addMouseListener(new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
if(ar && !running) {
HavenApplet.this.remove(ErrorPanel.this);
startgame();
}
}
});
} |
82edb591-cad5-4d13-8b2b-6155e94c283d | 6 | public static void main(String[] args) throws NumberFormatException,
IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
for (int i = 0; i < n; i++) {
String[] in = br.readLine().split(" ");
String a = in[0];
String b = in[1]... |
913d0fab-c70c-4d3b-aa46-73204e31dfe3 | 5 | @Override
public String transform(String s) {
StringBuilder sb = new StringBuilder();
if (s != null){
if (this.removeMultipleWhitespaces) {
s = SqueezeWhitespaceTransformer.MULTIPLE_WHITESPACE.matcher(s).replaceAll(" ");
}
if (this.trimIt) {
s = s.trim();
}
Matcher m = regex.matcher(s);
... |
24375831-05e5-4ce4-8f51-b6df777551d3 | 5 | @Override
public void actionPerformed(ActionEvent e) {
try {
conn = DriverManager.getConnection(Utils.DB_URL);
PreparedStatement checkStat;
checkStat = conn.prepareStatement("select name from user where name = ?");
checkStat.setString(1, textField.getText());
... |
25edbe4f-e1db-47e8-9ef9-042d6a08909e | 8 | @Override
public void visitLdcInsn(final Object cst) {
Item i = cw.newConstItem(cst);
// Label currentBlock = this.currentBlock;
if (currentBlock != null) {
if (compute == FRAMES) {
currentBlock.frame.execute(Opcodes.LDC, 0, cw, i);
} else {
... |
9b99ff18-c32a-45fa-b142-22f7dea8583d | 7 | private void reactToPartChange(IWorkbenchPartReference part) {
if (!autoSync)
return;
if (!(part.getPart(false) instanceof IEditorPart))
return;
IEditorPart editorPart = (IEditorPart) part.getPart(false);
if (!getViewSite().getPage().isPartVisible(editorPart))
... |
fc5bf2c6-c8e0-46b0-ab7c-ae08834f5ab2 | 7 | protected String getBestDistance(long d)
{
String min=null;
final long sign=(long)Math.signum(d);
d=Math.abs(d);
for(SpaceObject.Distance distance : SpaceObject.DISTANCES)
{
if((distance.dm * 2) < d)
{
double val=(double)d/(double)distance.dm;
if((val<0)||(val<100))
val=Math.round(val*100.... |
20f9b511-1801-4ed8-9ea6-7b897b318e7a | 9 | public Object localise()
{
Object o = null;
try
{
Class<?> c = Class.forName(Obj_Name+"_stub");
Constructor<?> constructor = c.getConstructor(String.class, int.class);
o = constructor.newInstance(IP_adr, Port);
} catch (InstantiationException e) {
// TODO A... |
13f75bfd-a525-4841-8ae5-00841bfca1e3 | 1 | protected void btnSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSairActionPerformed
if(JOptionPane.showConfirmDialog(rootPane, "Você tem certeza que deseja sair ?","",JOptionPane.OK_CANCEL_OPTION) == 0){
this.dispose();
}
}//GEN-LAST:event_btnSairActionPerformed |
2b9aebe8-0149-498c-82f4-2a575ec3a34a | 5 | public static void elevTilFil(ArrayList<Elev> minListe)
{
Formatter output = null;
try
{
//For å skrive til fil må jeg bruke klassen FileWriter
FileWriter fileWriter = new FileWriter("elever.txt", true);
output = new Formatter (fileWriter);//åpner fila elever.txt for skriving, hvis den ikke finnes, ... |
437bba84-6461-4a1d-b4b7-156690c7785a | 7 | private void fireCellSelectionChangeNotification() {
if ( _locked) {
return;
}
Set<CellKey> changedKeys = new HashSet<CellKey>();
for(CellKey oldKey : _oldCellKeys) {
if(!isCellKeySelected(oldKey)) {
changedKeys.add(oldKey);
}
}
for(CellKey selectedKey : _selectedCellKeys) {
if ( !_oldCellKe... |
73a1476c-05c3-417b-bfb5-b13561bcd06b | 6 | @Override
public <T> T sudo(final SudoAction<T> c) throws LoginException, SudoExecutionException {
final Subject s = createSubject(c);
// save the current security context...
final SecurityContext secCtx = SecurityContext.getCurrent();
final LoginContext lc;
if(c.g... |
3f6c1a09-c1d9-4675-984b-1cf4111d0bdc | 1 | public static double meandev(double[] vals) {
double mean = mean(vals);
int size = vals.length;
double sum = 0;
for (int i = size; --i >= 0;) {
sum += Math.abs(vals[i] - mean);
}
return sum / size;
} |
d3d2430a-75a4-4110-9204-9c26190d5297 | 9 | private RenderableObject generateElipse(Scanner inFile) {
Point s = null, e = null, loc = null;
int thickness = 0;
Color c = null;
String current = inFile.next();
while (inFile.hasNext()
&& !(isCloseTag(current) && parseTag(current) == LegalTag.Object)) {
if (isOpenTag(current)) {
switch (parseTag(... |
b424dd27-e97f-41fc-be7d-b9a2455c0c20 | 9 | public void set(String in, int field,Scanner s) {
switch(field){
case 1:
number = in;
break;
case 2:
name = in;
break;
case 3:
address = in;
break;
case 4:
city = in;
break;
case 5:
while (in.length() != 2){
System.out.println("Please enter a valid state: ");
i... |
9b10d470-7987-4674-9be8-0ce2e6a91632 | 6 | private void miNewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miNewActionPerformed
if (story.isSomethingChanged()) {
// Show save confirm window
int n = JOptionPane.showConfirmDialog(null,
"You made one or several changes to the current story.\... |
60a9f12b-528c-40e9-8cc5-d5e2741c3621 | 6 | public Contenu getContenu(Agent joueur){
if (wumpus==true && !joueur.getWumpusTue()){return Contenu.WUMPUS;}
else if (pit==true){return Contenu.TROU;}
else if (gold==true){return Contenu.OR;}
else if (joueur.getPosition().getXReel()==this.coord.getX()&&joueur.getPosition().getYReel()==this.coord.getY())/*agent=... |
b4787211-a0ff-4e12-89c7-8f1483278e9b | 4 | private static byte[] appendByteArrays( byte[] arrayOne, byte[] arrayTwo,
int length )
{
byte[] newArray;
if( arrayOne == null && arrayTwo == null )
{
// no data, just return
return null;
}
else if( arrayOne ... |
757b8c16-6953-46fa-8f33-e767f4c62d39 | 0 | public void setWidth(int width)
{
marker[markers-1].setWidth(width);
} |
6cbb5bd4-e742-41d2-8328-c9218f023bcf | 7 | private JSONWriter append(String string) throws JSONException {
if (string == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write('... |
a775ec79-91ad-4b57-a641-54008866c7fc | 3 | private void setTextUnderIcons() {
//if showTextunderButtons is true, the text will
//not be shown
if(!showText)
{
startRecordButton.setText(null);
stopRecordButton.setText(null);
hearMusicButton.setText(null);
scheduleButton.setText(null);
infoButton.setText(null);
deleteButton.setText(null... |
5a3a6faa-bd15-4ebe-9a2c-bea3505ca594 | 8 | public boolean equals(Object obj){
if(obj==null){
return false;
}
if(getClass()!=obj.getClass()){
return false;
}
BloomFilter<E> o2 = (BloomFilter<E>) obj;
final BloomFilter<E> other=o2;
if(this.expectedNumOfElements!=other.expectedNumOfElements){
return false;
}
if(this.k!=other.k){
re... |
b8d37781-397d-4402-beb0-82f9404844d1 | 2 | private static String getFilenameWithoutPathOrExtension( String filename )
{
String newFilename;
// Remove the ".java" extension from the filename, if it exists
int extensionIndex = filename.lastIndexOf( ".java" );
if ( extensionIndex == -1 )
{
newFilename = filen... |
b1acc145-1b25-4461-aa88-0917a4603d53 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof DatasetType)) {
return false;
}
DatasetType other = (DatasetType) object;
if ((this.key == null && other.key !=... |
f4b9a489-7e00-4482-bedc-cc3296ec163e | 7 | public static void main(String[] args) {
int BITS_PER_LINE = 16;
if (args.length == 1) {
BITS_PER_LINE = Integer.parseInt(args[0]);
}
int count;
for (count = 0; !BinaryStdIn.isEmpty(); count++) {
if (BITS_PER_LINE == 0) { BinaryStdIn.readBoolean(); contin... |
377cfba8-c6c6-4dc0-af92-a6e0a65c4534 | 3 | public static void releaseAll() {
if (isDiagnosticsEnabled()) {
logDiagnostic("Releasing factory for all classloaders.");
}
synchronized (factories) {
Enumeration elements = factories.elements();
while (elements.hasMoreElements()) {
LogFactory... |
fb8ca2db-2761-47ba-9485-87b517181197 | 2 | private static void initGussian(Composite inComposite, int heightHint) {
final Composite toolbar = new Composite(inComposite, SWT.BORDER);
final Composite gaussion = new Composite(inComposite, SWT.BORDER);
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
gridData.grabExcessHorizontalSpace = true;
... |
8a88d101-2393-423e-8b3d-5ad6e2153fde | 1 | public void defocus(Configuration configuration) {
setNormal(configuration);
Configuration parent = configuration;
parent.setFocused(false);
while (parent.getParent() != null) {
parent = parent.getParent();
parent.setFocused(false);
}
} |
a00c9d67-d3ad-4528-a215-0dda209911e2 | 3 | @Override
public String process(String content) throws ProcessorException {
// TODO Auto-generated method stub
pipeline = new SimpleAuthenticationPipeline();
context = new AuthorizeContext();
pipeline.setBasic(new AuthEntryValve());
pipeline.addValve(new FlushValve());
pipeline.addValve(new EncodeValve())... |
5802e89e-fe7a-4185-9779-c1252c660157 | 8 | private void btnSalvarMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnSalvarMouseClicked
dao = new ProdutoDAO();
produto = new Produto();
produto.setNome(txtNome.getText());
produto.setValorcompra(Double.parseDouble(txtValorCompra.getText()));
produto.setValorve... |
fd624bd5-ef8e-4c13-b297-27b00efa2a3e | 8 | public int[] search (ASEvaluation ASEval, Instances data)
throws Exception {
m_best = null;
m_generationReports = new StringBuffer();
if (!(ASEval instanceof SubsetEvaluator)) {
throw new Exception(ASEval.getClass().getName()
+ " is not a "
... |
3bf658a0-2cfb-4814-b08f-e23928bf005d | 3 | private void disconnect(Channel channel, String message) {
if (channel.isActive() && this.currentProtocol == Protocol.PLAY || this.currentProtocol == Protocol.LOGIN) {
ByteBuf header = Unpooled.buffer();
ByteBuf data = Unpooled.buffer();
ByteBufUtils.writeVarInt(data, 0x0);... |
88622c91-a5b5-48f5-8f07-221788239e7b | 8 | double evaluateInstanceLeaveOneOut(Instance instance, double [] instA)
throws Exception {
DecisionTableHashKey thekey;
double [] tempDist;
double [] normDist;
thekey = new DecisionTableHashKey(instA);
if (m_classIsNominal) {
// if this one is not in the table
if ((tempDist = (double... |
105f2b24-9795-4865-a47d-60566f7b8c22 | 4 | public static ProjectileType parseType(String type) {
if(type.matches("PROJECTILE")) {
return PROJECTILE;
} else if(type.matches("HOMING")) {
return HOMING;
} else if(type.matches("AREA")) {
return AREA;
} else if(type.matches("ENCHANT")) {
return ENCHANT;
}
return null;
} |
6259def2-624e-440f-bc10-8ed9838a3ecb | 5 | public void addChar(char ch) {
ch = normalize(ch);
char lastchar = grams_.charAt(grams_.length() - 1);
if (lastchar == ' ') {
grams_ = new StringBuffer(" ");
capitalword_ = false;
if (ch==' ') return;
} else if (grams_.length() >= N_GRAM) {
... |
be6952d2-b5af-453a-bfbd-9a02af0791ca | 7 | public static void main(String[] args) {
Random randomGenerator = new Random();
int dice;
int[] result = new int[6];
for(int i = 0; i < 1000; i++) {
dice = randomGenerator.nextInt(6) + 1;
switch(dice) {
case 1:
result[dice - 1]++;
break;
case 2:
result[dice - 1]++;
break;
c... |
4b0183ee-eeef-4a00-a7e4-35b0195057e0 | 5 | protected void createContents()
{
shell = new Shell();
shell.setSize(640, 480);
shell.setText(title);
Label lblTaskTitle = new Label(shell, SWT.NONE);
lblTaskTitle.setBounds(10, 13, 64, 15);
lblTaskTitle.setText("Task Title *");
txtTitle = new Text(shell, SWT.BORDER);
txtTitle.setTextLimit(Task.M... |
c0956baf-d129-49b7-8eee-a91cc253104a | 0 | @Basic
@Column(name = "pass")
public String getPass() {
return pass;
} |
c496ef1d-bad9-4152-b52b-16f4fbfd8149 | 5 | public static boolean canConnect(Connector<?> c1, Connector<?> c2) {
if( c1 == null || c2 == null ) return true;
return c1.getPayloadClass() == c2.getPayloadClass() &&
c1.getConnectorType().canConnectTo(c2.getConnectorType());
} |
c363ac15-4f1a-4d4d-9abd-421595a54998 | 0 | @RequestMapping(value = "/image_src/{imageId}", method = RequestMethod.GET)
public void imageSrc(@PathVariable String imageId, HttpServletRequest request, HttpServletResponse response)
throws Exception {
Image image = imageService.getImageBytesAndContentTypeById(imageId);
response.setContentType(image.getConten... |
54461960-f068-44a6-8230-78c080d2bca1 | 1 | public static String mkString(Collection<String> c, final String sep) {
if (c.isEmpty()) {
return "";
}
String head = c.iterator().next();
Collection<String> tail = new ArrayList<String>(c);
tail.remove(head);
return reduce(tail, new Function2<String, String>() {
@Override
public String apply... |
453e6449-dbdb-48dc-927c-e8a19a95a650 | 3 | public FireBall(TileMap tileMap, boolean right) {
super(tileMap);
facingRight = right;
moveSpeed = 3.8;
if(right) dx = moveSpeed;
else dx = -moveSpeed;
sWidth = sHeight = 30;
width = height = 14;
BufferedImage spritesheet = new Texture("/textures/fireball.... |
9053fce6-9039-48af-ba37-65b17aca4015 | 6 | private int getCollidingBouncyBlockBounciness() {
if(!collidable)
return -1;
if(!crouch || !crouchable){
if(game.getCurrentLevel().getBlockAtPixel(x,y-(height/4)) instanceof BlockBouncy){
BlockBouncy bb = (BlockBouncy) game.getCurrentLevel().getBlockAtPixel(x,y-(height/4));
return bb.getBounciness();
... |
a261c5fc-1e18-4669-a12f-18f890f04d43 | 2 | public int[][] DFA(String pattern) {
int patternLength = pattern.length();
int[][] dfa = new int[alphabet][patternLength];
dfa[pattern.charAt(0)][0] = 1;
for (int X = 0, j = 1; j < patternLength; j++) {
for (int character = 0; character < alphabet; character++)
dfa[character][j] = dfa... |
a9b6253f-cea1-4a2d-83e7-92c884d6f44f | 5 | @Override
public void update(float delta) {
handleInput();
Vector2D[] vertices = this.bounds.getVertices();
Rectangle r = (Rectangle)this.bounds;
if(vertices[0].x<limits.getPosition().x){
this.setPosition(new Vector2D(limits.getPosition().x + r.getWidth()/2,this.getPositi... |
7d947835-bddb-4905-ade4-acaceb62a50d | 3 | public static boolean vectorCompare(double[] v, double[] w) {
if (v.length != w.length)
return false;
for (int i = 0; i < v.length; i++)
if (Math.abs(v[i] - w[i]) > eps)
return false;
return true;
} |
489dab0c-0f1f-432c-9b56-bbdf8809f2ab | 1 | public void showField() {
for (int i = 0; i < fieldSize; i++) {
showLine(i);
System.out.println();
}
} |
4c45c5d3-7ed5-4c2f-83fa-a196ffae0d3f | 6 | public static boolean checkSumUsingSort(int[] A, int x) { // Time complexity - O(nlog(n))
if(A == null || A.length < 2)
return false;
int i, j, flag = 0;
int left = 0, right = A.length - 1;
java.util.Arrays.sort(A);
while(left < right) {
i = A[left];
j = A[right];
if(i + j == x) {
System.out.p... |
c8ca53e1-f037-4387-8884-958710ee8100 | 3 | @Override
public int addRecipe(Recipe r) {
int recipeId = getNextIdAndIncrement();
try(Connection connection = DriverManager.getConnection(connectionString)){
PreparedStatement statement = connection.prepareStatement("insert into recipe (id, name, numPersons, cookingTime, restingTime, prepTime, steps) values (?... |
ab351407-5b07-42ba-a86e-cd35393094ed | 7 | public static OggAudioStreamHeaders create(OggPacket firstPacket) {
if (firstPacket.isBeginningOfStream() &&
firstPacket.getData() != null &&
firstPacket.getData().length > 10) {
int sid = firstPacket.getSid();
if (VorbisPacketFactory.isVorbisStream(firstP... |
4aa22512-9f77-437d-82eb-f54c7a5e8302 | 9 | private boolean r_mark_suffix_with_optional_y_consonant() {
int v_1;
int v_2;
int v_3;
int v_4;
int v_5;
int v_6;
int v_7;
// (, line 153
// or, line 155
lab0: do {
... |
a376142f-b374-4615-ab2e-68756ab36da0 | 3 | public boolean leapYear(int year){
boolean test = false;
if(year%4 != 0){
test = false;
}
else{
if(year%400 == 0){
test=true;
}
else{
if(year%100 == 0){
... |
384e403a-25d5-4a3b-9e96-a303e5ce844d | 4 | private static GridResource createGridResource(String name, double baud_rate,
double delay, int MTU, int totalPE, int totalMachine,
int rating, String sched_alg)
{
// Here are the steps needed to create a Grid resource:
// 1. We need to create an objec... |
d66570f9-24f2-4072-892a-a66b85cc0df9 | 1 | public void doCopy(InputStream is, OutputStream os) throws IOException {
byte[] bytes = new byte[64];
int numBytes;
while ((numBytes = is.read(bytes)) != -1) {
os.write(bytes, 0, numBytes);
}
os.flush();
os.close();
is.close();
} |
59aab5f1-fdb8-4fa8-b15d-66d929493ecd | 0 | public void setEvent(Event event) {
this.event = event;
event.getParticipants().add(this);
} |
b629ab2f-98ac-44df-91d3-9be924a4488b | 4 | public void mouseUp(MouseEvent e, int x, int y) {
if ( isCheckerFigure(draggedFigure) ) {
Location from = Convert.xy2Location(originalPt.x, originalPt.y);
Location to = Convert.xy2Location(e.getX(), e.getY());
draggedFigure.moveBy(originalPt.x - e.getX(), originalPt.y - e.getY());
if( ... |
7b4ec3c3-1615-4a5f-9535-797071f59dd1 | 2 | public void setIndex(int i) {
if (i < 0) {
idx = 0;
} else if (i > len) {
idx = len;
} else {
idx = i;
}
} |
0838373d-6a3b-4a17-ad92-054d17c81902 | 3 | @EventHandler
public void onTeleport(PlayerTeleportEvent e) {
Player p = e.getPlayer();
World world = e.getFrom().getWorld();
if (utils.isValidWorld(p)) {
ConfigurationSection section = plugin.getConfig().getConfigurationSection(world.getName());
if (section == null)
return;
int newHunger = p.ge... |
d5f347ab-09fb-433e-ac2f-efec11d2d6a6 | 2 | @Override
public HandshakeState acceptHandshakeAsClient( ClientHandshake request, ServerHandshake response ) {
return request.getFieldValue( "WebSocket-Origin" ).equals( response.getFieldValue( "Origin" ) ) && basicAccept( response ) ? HandshakeState.MATCHED : HandshakeState.NOT_MATCHED;
} |
71e61f56-222c-44dc-afd9-eb580c738229 | 5 | @Test public void ImageTest() {
// Test to make sure that it can't load a none existent image
boolean exceptionThrown = false;
Image img;
try {
img = new Image("not_an_image");
} catch (Exception e) {
exceptionThrown = true;
}
Assert.assertTrue(exceptionThrown);
// Test to make sure that fire.j... |
613e25ca-09b4-497d-843a-b20ea8704c16 | 0 | public void setActiveActivies(ActiveActivities activeActivies) {
this.activeActivity = activeActivies;
} |
91636346-fe19-41c1-a343-a10e4d18e547 | 4 | public boolean peutPrendreEnCharge(Navire n) {
//vérifie le type
if(prendEnCharge(n.getTypeMachandise())) {
//Vérifie qu'il y a assez de place pour le prendre
if(_naviresAQuai.isEmpty()) {
if(_longueurMetre>=n.getLongueurMetre()) {
return true;... |
6db7371e-86a6-4832-9aa0-b8e9f0daca1b | 3 | @Override
public void mouseClicked(MouseEvent e) {
if(SwingUtilities.isRightMouseButton(e))
{
if (sfap.hand == 1)
{
NewMapDialog dialog = new NewMapDialog();
int result = JOptionPane.showConfirmDialog(null, dialog, "Select", JOptionPane.OK_CANCEL_OPTION);
if (result == JOptionPane.OK_OPTION) {
... |
bea7ced4-3f23-494c-b36a-4568cba6dbaf | 3 | private Tree parameterListPro(){
Symbol identifier = null;
Tree identifiers = null;
if((identifier = accept(Symbol.Id.IDENTIFIER_NAME))!=null){
if(accept(Symbol.Id.PUNCTUATORS,",")!=null){
if((identifiers = parameterListPro())!=null){
return new ParameterList(identifier, identifiers);
}
... |
d9146d34-bd60-4987-a7d8-c6fe0b4045ea | 4 | private Boolean checkData(String name,String surname,String pass,String pass2){
/*
* elegxei an einai swsta ta dedomena pou dothikan kai epistrefei to katalilo mnm an den einai
*/
if(name.length()<3){
JOptionPane.showMessageDialog(null, "Dwste egkiro onoma!");
return false;
}else if(surname.length()<3... |
3f7e196e-259c-4de6-ad2e-1597060a87f2 | 0 | @Override
public void changedMostRecentDocumentTouched(DocumentRepositoryEvent e) {
calculateEnabledState((OutlinerDocument) e.getDocument());
} |
c959518b-c16c-4209-8124-4587df33c9e6 | 9 | public RebalanceInfo(JsonObject obj) throws RestApiException {
JsonElement e = obj.get("status");
if (e == null || e.isJsonPrimitive() == false) {
throw new RestApiException("Expected status string", obj);
}
String sStatus = e.getAsString();
if (sStatus.equals("none")) {
completed = true... |
442d955b-a9ee-49b1-9403-e4fe129db59a | 3 | @Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
User user = (User) session.get("User");
Campaign camp;
// camp=(Campaign) session.get("campa");
// Long camp1id=camp.getCampaig... |
e36d811e-9327-4a31-b8a1-4cb4fa7437b2 | 9 | @Override
public void valueUpdated(Setting s, Value v) {
try {
if (s.getName().equals(_RefVisibible)) {
if (switch_ != null)
switch_.setReferenceVisible(v.getBoolean());
} else if (s.getName().equals(_Reference)) {
if (switch_ != null)
switch_.setReference(v.getBoolean());
} else if (s.get... |
8a1b9866-c4ba-4344-919e-d26c57855c8c | 4 | public com.novativa.www.ws.streamsterapi.Bar[] getBars(java.lang.String instrument, java.lang.String period, java.lang.String options) throws java.rmi.RemoteException {
if (super.cachedEndpoint == null) {
throw new org.apache.axis.NoEndPointException();
}
org.apache.axis.client.Call ... |
a9d10ed0-1f76-40e9-ac6d-804bef769016 | 7 | private int nthPrime(int n) {
while (primes.size() <= n) {
int candidate;
if (primes.size() == 0) {
candidate = 1;
} else {
candidate = primes.get(primes.size() - 1);
}
boolean isPrime;
do {
... |
6cb78832-d7ff-41a8-bbee-932bc1798a6d | 6 | public static int[] getPixels(BufferedImage img,
int x, int y, int w, int h, int[] pixels) {
if (w == 0 || h == 0) {
return new int[0];
}
if (pixels == null) {
pixels = new int[w * h];
} else if (pixels.length < w * h) {
... |
dd3218ec-1408-44cd-829a-2b8805d281c9 | 8 | void animationMode() throws ScriptException {
float startDelay = 1, endDelay = 1;
if (statementLength < 3 || statementLength > 5)
badArgumentCount();
int animationMode = 0;
switch (statement[2].tok) {
case Token.loop:
++animationMode;
break;
case Token.identifier:
String cmd = (String) statement... |
ff2012d7-0f93-4f7e-8c4f-28f424da5992 | 6 | public static boolean considerOffense(Card card, Duelist duelist) {
int c;
if (MonsterCard.class.isInstance(card)) {
MonsterCard mc = MonsterCard.class.cast(card);
MonsterCard mc2 = null;
for (c = 0; c < duelist.opponent.field.monsterzones.length; c++) {
if (duelist.opponent.field.monsterzones[c].isOpe... |
c8374149-1503-4d0f-b2c6-a3072971975f | 6 | @Override
protected Boolean doInBackground() {
if (debugVerbose) { Logger.logInfo(debugTag + "Loading MC assets..."); }
setStatus("Downloading jars...");
if (!loadJarURLs()) {
return false;
}
if (!binDir.exists()) {
if (debugVerbose) { Logger.logWarn(debugTag + "binDir not found, creating: " + binDir.g... |
a417daf5-065a-4db3-8f49-44c7dbd1cfed | 0 | private void swapElementsByIndex(int firstIndex, int secondIndex) {
E firstKey = heap.get(firstIndex);
E secondKey = heap.get(secondIndex);
heap.set(firstIndex, secondKey);
heap.set(secondIndex, firstKey);
} |
d95e0eb6-7aa9-4889-9964-224271062be5 | 9 | @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof CategoryDataset)) {
return false;
}
CategoryDataset that = (CategoryDataset) obj;
if (!getRowKeys().equals(that.getRowKeys())) {
re... |
190cb520-1c38-4d70-b0c6-3f476b856537 | 0 | public void setAnt(Ant ant) {
// Update Ant on this cell
this.ant = ant;
} |
615aef40-ff88-452a-9144-f96f3f0473a9 | 5 | public static void puzzleReady() {
boolean isWin = true;
for (SlidingPuzzlePiece thisPiece
: SlidingPuzzlePiece.getPuzzlePiece()) {
if (thisPiece.getField().getFieldCoordX() != thisPiece.getRootX()) {
isWin = false;
}
if (thisPiece.getF... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.