method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
7bcc0c8c-279c-4f28-b5dc-5795a815bb6c | 7 | public static Proposition buildHoldsProposition(Cons tree) {
{ Stella_Object operatorexpression = tree.value;
boolean explicitholdsP = operatorexpression == Logic.SYM_PL_KERNEL_KB_HOLDS;
int argcount = tree.rest.length();
Proposition proposition = Logic.createProposition(Logic.SYM_STELLA_PREDICATE... |
44a62252-801a-4870-82c7-520a219e32fb | 2 | private void buildProgram(GL2 gl){
int[] success = new int[1];
programID = gl.glCreateProgram();
gl.glAttachShader(programID, vertexID);
gl.glAttachShader(programID, fragmentID);
gl.glLinkProgram(programID);
gl.glGetProgramiv(programID, GL2.GL_LINK_STATUS, success,0);
... |
3d8342cd-c586-4c7d-8861-0b987d9e0eca | 7 | public static void delete(File file)
throws IOException {
if (file.isDirectory()) {
GameApplication.engineLogger.info("Deleting directory " + file.getAbsolutePath());
//directory is empty, then delete it
if (file.list().length == 0) {
if (file.del... |
b13c939d-8a64-4368-aa19-33530e41a344 | 3 | public void write(DataOutputStream out) throws IOException {
GrowableConstantPool gcp = new GrowableConstantPool();
reserveSmallConstants(gcp);
prepareWriting(gcp);
out.writeInt(0xcafebabe);
out.writeShort(3);
out.writeShort(45);
gcp.write(out);
out.writeShort(modifiers);
out.writeShort(gcp.putClass... |
c976cf11-0554-4449-94cf-1a8da8bfea15 | 6 | public static int appenedFileCount(File file) throws FileNotFoundException {
int count = 0;
int commentLines = 0;
int lineComment = 0;
Scanner scanner = new Scanner(file);
while (scanner.hasNext()) {
String string = scanner.nextLine().trim();
if ((string.contains("/**") || string.contains("/*") || st... |
9a915592-33c0-421e-a109-23c729edc108 | 7 | public void createAperture() throws IllegalParserValueException {
/* Prendo dal file caricato la lista di stringhe corrispondenti alle aperture. */
ArrayList<String> laperture = lsf.getAperture();
/* Inizializzo i riferimenti che mi serviranno: */
String[] strA;
Through add;
Location locationA;
Locatio... |
e39404d5-a1de-47df-a430-db4547ff7652 | 2 | public List<Link<T>> getAllLinks() {
for (int i = 0; i < graph_nodes.getLength(); i++)
for (int j = 0; j < ((GraphNode) graph_nodes.get(i)).getLinks().getLength();j++)
aristas.append(((Link) ((GraphNode) graph_nodes.get(i)).getLinks().get(j)));//adds all existing links of each node to ... |
adb7cf5b-19d8-4b1c-8f98-445552650009 | 5 | public void resetWorld() {
cells = resetCells.clone();
for (int i = 0; i < resetCells.length; i++) {
cells[i] = resetCells[i].clone();
}
for (Cell[] c : cells) {
for (Cell cell : c) {
cell.setFood(0);
cell.adjacentAntsBlack = 0;
... |
009a78a0-0ab1-4c05-8c36-386757ea10d4 | 5 | public boolean sUp() {
boolean change = false;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
boolean tmp = mUp(i, j);
if (tmp)
change = true;
}
if (aUp(i)){
change = true;
}
}
if (change) {
genTile();
}
return change;
} |
1d3edcd4-0497-46f7-81d3-ed6088d4f84b | 9 | public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filter) throws IOException, ServletException {
String api = request.getParameter("api");
if (null == api) {
String queryString = ((HttpServletRequest) request)
.getQueryString()... |
0e4001d5-7ba7-42b1-b7b6-b1d9f5b3856d | 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('... |
05579eff-5e74-4f8d-a53a-a54090f3c811 | 2 | public PowerUp(int courtWidth, int courtHeight, int INIT_X) {
super(INIT_VEL_X, INIT_VEL_Y, INIT_X, INIT_Y, SIZE, SIZE, courtWidth,
courtHeight);
// Set img to the mushroom.png picture
try {
if (img == null) {
img = ImageIO.read(new File(img_file));
}
} catch (IOException e) {
System.out.printl... |
2b503612-4711-4b56-9d26-351d1773d04f | 7 | public static void main(String[] args) {
// Create .base and .test file and fill them with data
String line;
try {
File data = new File(fileDirectory + fileName + ".dat");
if (!data.exists())
data.createNewFile();
FileWriter dw = new FileWriter(data.getAbsoluteFile());
BufferedWriter dataWriter... |
6724342b-c356-4e27-82a8-f18c9b65542d | 8 | public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
ListNode root = null;
ListNode current = null;
int carry = 0;
while(l1 != null || l2 != null) {
int operand1 = (l1 != null) ? l1.val : 0;
int operand2 = (l2 != null) ? l2.val : 0;
int sum = op... |
04c3aaf0-d529-4336-8bdd-d7e9d455025f | 3 | private boolean isMouseOver() {
return (mySketch.mouseX >= myXOrigin
&& mySketch.mouseX <= myXOrigin + myWidth
&& mySketch.mouseY >= myYOrigin && mySketch.mouseY <= myYOrigin
+ myHeight);
} |
70c68500-43ea-44ac-a354-e9a960c73170 | 4 | @Override
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
GradientPaint grad;
if (selected && hovered)
{
grad = new GradientPaint(0,0, new Color(80, 80, 255),0 , getHeight()/2, new Color(200, 200, 180),true);
}
else if (selec... |
6314f41e-e15c-4021-a866-de4f7d61f25b | 3 | @Override
public void paintComponent(final Graphics g) {
// Check if we have a running game
super.paintComponent(g);
g.setColor(this.getBackground());
g.fillRect(0, 0, getWidth(), getHeight());
if (this.model != null) {
// Draw all tiles by going over them x-wise and y-wise.
for (int i = 0; i < this.... |
d4d48a8d-d8cb-40d1-8e2d-f0d38b65eb09 | 9 | private void manageGameState() {
switch (state) {
case INTRO:
if (Keyboard.isKeyDown(Keyboard.KEY_RETURN) || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
state = State.MENU;
}
break;
case GAME:
if (Keyboard... |
e70930ff-a1e8-4ba8-af80-e0fe5006d27e | 2 | @Override
public void paint(Graphics g) {
super.paint(g);
for (int i = 0; i < ar.length; i++) {
for (int j = 0; j < ar[i].length; j++) {
g.setColor(new Color(ar[i][j]));
g.fillRect(40 + j, 40 + i, 1, 1);
}
... |
1e10eb4c-a570-4cb9-b2bf-fef68041a0cb | 7 | public void processEvent(Event event)
{
_printStream.println(event);
NormalizedEvent nevent = _appContext.getNormalizedEvent(event);
int msgType = nevent.getMsgType();
switch (event.getType())
{
case Event.OMM_ITEM_EVENT:
{
if (msgType... |
89496d86-d480-4494-99e2-94d8413bd031 | 8 | public boolean replace(int pos, K pk) {
// _start = System.currentTimeMillis();
SimpleListNode<K> node = new SimpleListNode<K>(pk);
// Check valid position
if((pos < 0) || (pos > this.length)) {
// _end = System.currentTimeMillis();
// System.out.println("Insert lasted: " ... |
a5153039-1beb-4442-935a-d568d250ad07 | 4 | @Override
public Point getTarget(GameState state) {
int lowestHealth = Integer.MAX_VALUE;
Point target = null;
Unit[][] grid = state.getTheirGrid();
for(int x = 0; x < 3; x++) {
for(int y = 0; y < 5; y++) {
if(grid[x][y] != null) {
if(grid[x][y].getHealth() < lowestHealth) {
lowestHealth = gr... |
6d91325d-defc-4fe5-a899-5f3e104b8d11 | 0 | public static String convertToMac(String text) {
// Convert \r\n -> \r
text = Replace.replace(text,"\r\n","\r");
// Convert \n -> \r
text = Replace.replace(text,"\n","\r");
return text;
} |
53e66e86-d003-4d40-9231-0d6ac1845a33 | 7 | public void renderTile(int xp, int yp, Tile tile) {
xp -= xOffset;
yp -= yOffset;
for (int y = 0; y < tile.sprite.SIZE; y++) {
int ya = y + yp;
for (int x = 0; x < tile.sprite.SIZE; x++) {
int xa = x + xp;
if (xa < -tile.sprite.SIZE || xa >= width || ya < 0 || ya >= height) break;
if (xa <... |
88eede9e-cda8-48c0-85dd-2a89cf93f261 | 4 | private void sucursalFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_sucursalFieldKeyTyped
// TODO add your handling code here:
if (!Character.isLetter(evt.getKeyChar()) && !Character.isISOControl(evt.getKeyChar()) && !Character.isWhitespace(evt.getKeyChar()))
{
... |
29a1d4c7-0594-4070-bdd8-fdab90beea41 | 9 | public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan1 = new Scanner(System.in); //Scanner Constructor
int income; //define income
do { //do while loop
System.out.println("Enter an in... |
062438fe-59d0-4120-8440-00724738d748 | 3 | private static boolean isPanDigital(int n){
Set<Character> seen = new HashSet<Character>();
String ns = Integer.toString(n);
for(char c : ns.toCharArray()){
char maxC = (char) ('1' + ns.length());
if (c!='0' && c<maxC) seen.add(c);
}
return seen.size() == ns.length();
} |
8d76d552-e16b-47bb-970b-08ce139e0f25 | 5 | @Override
protected void doAction(int option)
{
switch (option)
{
case 1:
totalSchedule();
break;
case 2:
groupMatches();
break;
case 3:
teamMatches();
break;
... |
d9dd642b-e6cb-49a5-b512-27dbdcd19e9e | 2 | private double obj_func(double[] x_values) {
int nopt = x_values.length;
double d = (nopt == 2) ? 200.0 : 4000.0;
double u1 = 0.0;
double u2 = 1.0;
for (int i = 0; i < nopt; i++) {
u1 += (x_values[i] * x_values[i]) / d;
u2 *= Math.cos(x_values[i] / Math.sq... |
333a4435-ab23-4a7e-919b-b9d557758b18 | 1 | @Test
public void test() throws InterruptedException, ExecutionException {
if(!compareParallelSequential(DataSetLoader.getRegularGrid(100, 800, 40, new Model()),
DataSetLoader.getRegularGrid(100, 800, 40, new ModelParallel()))) fail("Regular Grid models were not equal after " + TEST_FRAME_LIMIT + " frames.");
... |
f5760b82-5c5e-41ec-a9a6-0501e2807de6 | 8 | @Override
protected void execute(Scanner in, PrintStream out) {
for (String line = in.nextLine(); !line.equals("0 0"); line = in.nextLine()) {
StringTokenizer tokenizer = new StringTokenizer(line);
final int m = Integer.parseInt(tokenizer.nextToken());
final int n = Inte... |
c59bbbb4-e6d2-46ce-8704-c6f63e123d07 | 8 | private void filterImage(ImgSize size){
int i;
BufferedImage[] srcs = {originalImage.fullImage,originalImage.thumbImage};
BufferedImage destination;
if(size==ImgSize.Full) i=0;
else i=1;
RenderingHints hints = null;
float offset = (filter.brightness-50f)*5.10f;
... |
eb52dddb-d3ad-4961-ab8d-245290008da2 | 1 | @Override
public void execute(DebuggerVirtualMachine dvm) {
for (String breakpointLine : breakpointLinesToClear) {
dvm.clearBreakpoint(Integer.parseInt(breakpointLine));
}
} |
66a339e6-5894-4f7f-b308-65eff3acf19c | 2 | public int removeElement(int[] A, int elem) {
int index = 0;
for(int i = 0 ;i < A.length;i++){
if(A[i] != elem){
A[index++] = A[i];
}
}
return index;
} |
0521f880-5e83-4276-8e20-2ca8fab2ac5b | 0 | public DataOut (String algoName, int maxValueLength, int numberOfPoints){
this.algoName = algoName;
this.maxValueLength = maxValueLength;
this.numberOfPoints = numberOfPoints;
time = new double[numberOfPoints];
memory = new double[numberOfPoints];
points = new int [number... |
c16a2605-d43d-45df-b22b-996ac18b2ca5 | 2 | protected void ensureRequiredFieldsAreProvided(Map<String, Object> fieldMap) {
for (Entry<String, Object> entry : fieldMap.entrySet()) {
if (entry.getValue() == null) {
throw new IllegalArgumentException("Please provide a value for " + entry.getKey() + " as it is a non-nullable field.");
}
}
} |
ae952436-681d-4d88-9e0b-3883e1ea33bf | 5 | public static void main(String[] args) {
Locale.setDefault(Locale.US);
Scanner s = new Scanner(System.in);
double salary = s.nextDouble();
double toPay = 0;
if(salary <= 2000){
System.out.println("Isento");
}else if(salary > 2000 && salary <= 3000){
... |
768899d4-10cc-4a63-b9fa-bdef5115ceeb | 6 | public static final long div(long topFlong, long bottomFlong)
throws FixedPointLongException {
int shift = OFFSET;
if (bottomFlong == 0)
throw new FixedPointLongException("Divide by zero");
if (topFlong == 0)
return 0;
while (shift > 0 && (topFlong & (1L << LENGTH - 1)) == 0) {
shift--;
topFlong ... |
b3e9d2d2-d105-41f6-baff-97b1f642188c | 4 | public void achievementUnlocked(@Named("message") String achievement, User user)
throws ServiceException {
if (user == null && !Configuration.ALLOW_UNAUTHENTICATED_CALLS) {
throw new UnauthorizedException("Only authenticated calls are allowed");
}
// The actual game backend would probably vali... |
77a8474f-1248-4d89-871d-0039134106b9 | 6 | public static boolean isLowerThan(Date inDate, Date dateToCompare){
if(inDate.getYear() < dateToCompare.getYear()){
return true;
}else if(inDate.getYear() > dateToCompare.getYear()){
return false;
}else{
if(inDate.getMonth() < dateToCompare.getMonth()){
... |
30267614-550e-4406-8ce3-48b056ee8a78 | 1 | private static String getFileContents(String filename) throws IOException,
FileNotFoundException {
File file = new File(filename);
StringBuilder contents = new StringBuilder();
BufferedReader input = new BufferedReader(new FileReader(file));
try {
String line = ... |
eeb25e8e-71d7-4a8c-b575-e2981ca3d303 | 2 | public String getProduct (int language)
{
try {
int id = getProductStringId ();
if (id > 0)
return dev.getString (id, language);
} catch (IOException e) { }
return null;
} |
3a96160e-151d-4388-ace8-640c0932dfd4 | 1 | public static void asm_btfss(Integer akt_Befehl, Prozessor cpu) {
Integer f = getOpcodeFromToBit(akt_Befehl, 0, 6);
Integer bitNr = getOpcodeFromToBit(akt_Befehl, 7, 9);
Integer k = cpu.getSpeicherzellenWert(f);
boolean bitIsSet = getBit(k, bitNr);
// Bit is set
if(bitIsSet) {
asm_nop(akt_Befehl, cpu)... |
11eb08ca-38d6-4808-b1d1-89b94e453e93 | 6 | public ModifierMatcher forbidAccess(int accessModif, boolean andAbove) {
if (andAbove) {
if (accessModif == Modifier.PRIVATE)
// This forbids all access.
return denyAll;
if (accessModif == 0)
return this.and(Modifier.PRIVATE, Modifier.PRIVATE);
if (accessModif == Modifier.PROTECTED)
return th... |
57ad45d6-2bc0-48eb-9f66-382353f971cb | 3 | public void handleBuildButton() {
aTuringMachine.getInput().clear();
aTuringMachine.getInput().add("Blank Symbol");
for(int i = 0; i < 31; i++){
if((inputView.getInputLabels(i).getText().trim().equals("")) || (inputView.getInputLabels(i).getText().trim().equals("|_|"))){
... |
7a8327fa-cd8a-4e8d-be06-ce5e9c26cabe | 3 | public int ValidarUserName(String username){
int condicion = 0;
tablaDeUsuarios();
for(Usuario Usuario:data){
if(Usuario.getUsername().equals(username)){
condicion = 1;
System.out.println(username + " No está disponible");
}
... |
536886ae-d127-4cc3-a7cf-fa7c2ebf3c23 | 0 | @Override
public String introduceYourself() {
return "OrderQuest";
} |
8f2f0bc4-1efb-4ff4-9f14-6b4960bfacc2 | 4 | private short[] findX2(short t1Index, short t2Index, short t3Index){
short t4Index = mod(t3Index - 1);
// visualizer.highlightLoose(1, path[x2.fromIndex], path[x2.toIndex]);
// visualizer.sleep();
x2Dist = dist(path[t4Index],path[t3Index]);
float possibleY2Dist = dist(path[t4Index], path[t1Index]);
boolean fo... |
0f450d78-b98f-4f60-a97b-863870e2e2bd | 6 | public void renderTiles(Screen screen, int xOffset, int yOffset) {
if (xOffset < 0)
xOffset = 0;
if (xOffset > ((Width << 3) - screen.width))
xOffset = ((Width << 3) - screen.width);
if (yOffset < 0)
yOffset = 0;
if (yOffset > ((Height << 3) - screen.height))
yOffset = ((Height << 3) - screen.height... |
af7898be-323b-4f98-8ace-2e451d993ec2 | 4 | @Action
public void function() {
error.dispose();
createS.dispose();
createF.dispose();
String f = func.getText();
String dev = den.getText();
if ((f == null ? "" == null : f.equals("")) || (dev == null ? "" == null : dev.equals(""))){
error.setVisible(tru... |
b930c033-166c-4477-b7b8-936535a33ba3 | 8 | public Image attackImage(int i)
{
Image temp = null;
switch(i)
{
case 1:
temp = new ImageIcon("src/images/north_attack.png").getImage();
break;
case 2:
temp = new ImageIcon("src/images/north_east_attack.png").getImage();
break;
cas... |
adc62ec2-3d63-46cf-9e85-99e08ff3a737 | 3 | public static int getRandomStart(int xPos, int yPos)
{
if(yPos == 0)
yPos = NORTH;
else
yPos = SOUTH;
if(xPos == 0)
xPos = EAST;
else
xPos = WEST;
return (Math.random() >= 0.5) ? xPos : yPos;
} |
3dc0ea01-25da-47ee-b7e3-8c9b81fa91f3 | 2 | private ItemTableModel(Class<T> clazz, ItemSet<T> items, ItemTablePanel<T> parent) throws Exception {
this.clazz = clazz;
this.items = items;
this.columnNames = new ArrayList<ColumnDefinition>();
this.toRemove = new ArrayList<T>();
for(Field field : this.clazz.getDeclaredFields()) {
if(field... |
5e9565ee-0249-4b4d-bfc3-b3df25101805 | 4 | public void iniciacomponentes(){
lb_login = new JLabel("Login: ");
lb_senha = new JLabel("Senha: ");
tx_login = new JTextField(10);
tx_senha = new JTextField(10);
bt_login = new JButton("Login");
bt_sair = new JButton("Sair");
pn_painelBotoes = new JPanel();
pn_organizaLogin = new JPanel(new FlowLayout(... |
a684330f-48ef-4da0-bca9-e7dbd306b9e6 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=this.getTarget(mob,commands,givenTarget);
if(target==null)
return false;
final boolean undead=CMLib.flags().isUndead(target);
if(!super.invoke(mob,commands,givenTarget,auto,a... |
269376ab-fa06-4b81-9243-3446a059e8fe | 7 | private ArrayList<int[]> histogramEqualizationLUT(BufferedImage input) {
ArrayList<int[]> imageHist = imageHistogram(input);
ArrayList<int[]> imageLUT = new ArrayList<int[]>();
int[] rhistogram = new int[256];
int[] ghistogram = new int[256];
int[] bhistogram = new int[256];
... |
ad41f06e-536e-4a31-a41a-27278ac5be10 | 7 | protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String userPath = request.getServletPath();
Stri... |
a0a809d3-b80c-4ec2-958f-38ac7a6dc389 | 0 | public Vue (){
this.setTitle("Tetris");
this.setSize(800, 700);
this.setResizable(false);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pan = new JPanel();
pan.setBackground(Color.BLACK);
this.setContentPan... |
652ba339-bf7f-4010-b712-f9e5dae1cc83 | 8 | public void set_Bit(int position, int adress) {
switch (position) {
case 0: {
setRegisterEntryOneBit(adress,
(getRegisterEntry(adress) | 0b00000001));
break;
}
case 1: {
setRegisterEntryOneBit(adress,
(getRegisterEntry(adress) | 0b00000010));
break;
}
case 2: {
setRegisterEntryOneBi... |
5f87a802-5bb7-4623-9a38-6abe5bdc43cc | 0 | public FillFilter(int amount) {
this.amount = amount;
} |
81cf01e9-9c38-4595-aeb3-cfbac4954224 | 0 | @Override
public void method1() {
System.out.println("Running: method1()");
} |
7a55141f-c45c-46e6-9aee-eea8467acdb0 | 1 | @Override
public List<Integer> sort(List<Integer> list) {
// checking input parameter for null
if (list == null) {
throw new IllegalArgumentException("ArrayList not specified!");
}
// converting to array
numbers = new Integer[list.size()];
list.toArray(n... |
a78c1707-9932-4caf-b0f7-23cea1b59591 | 3 | public static String formatUnits(String[] units, Boolean[] stresses) {
StringBuilder output = new StringBuilder();
// Divide all up to the next-to-last unit with the delimeter
int i;
for (i = 0; i < units.length - 1; i++) {
output.append(units[i] + (stresses[i] ? "(1)" : ""));
output.append(UNIT_DELIM);
... |
0a12cc9c-1460-46eb-a035-0006f5372b98 | 7 | private void addNonChordTones(int voiceIndx) {
// Get the current note, the previous note, and the interval between them.
Note currNote = chordTones[voiceIndx];
Note prevNote = prevBeat.getChordTones()[voiceIndx];
int interval = Math.abs(currNote.getInterval(prevNote));
// If you can add a passing tone, ad... |
76a9d693-70de-4671-a7de-8db1cfebe22e | 4 | public void pourInto(Bucket dest)
{
commands++;
double w1 = water, w2 = dest.water;
int temp = dest.capacity - (int)dest.water;
if(temp > (int)water)
temp = (int)water;
while(water > diff/100 && dest.water + diff/100 < dest.capacity)
{
... |
fcf00298-7bd4-4001-a00e-5b3ff6c02cdf | 0 | public static void add_user( int key, User user ) {
user_list.put(key, user);
response.put("action", "user-id");
response.put("userid", key+"");
user.out.println(yaml.dump(response));
GUI.memo.append(key+"");
} |
81225283-3a52-4583-96c5-305116d0b3a2 | 4 | public void playRunSound(boolean isRunning)
{
if (sfx)
{
File[] array = isRunning ? runArray : stepArray;
try
{
File playFile = array[rand.nextInt(array.length)];
playerStream = AudioSystem.getAudioInputStream(playFile);
playerFormat = playerStream.getFormat();
... |
a47f0d51-4317-4e1c-859d-fc830c61938d | 1 | public ClassInfo getClazz() {
return clazz != null ? clazz : ClassInfo.javaLangObject;
} |
0a9c04ce-c06b-415f-a3cb-c9c8353a9de1 | 3 | public boolean removeMusicAlbum(String title)
{
boolean deleted = false;
if (aAlbumIndex.containsKey(title)) {
Item tempAlbum = aAlbumIndex.remove(title);
bandIndex.get(((MusicAlbum)tempAlbum).getBandName()).remove(tempAlbum);
for (String s: ((MusicAlbum) tempAlbum).... |
868eb1ec-a14d-47ed-9ad2-658673c92d0f | 0 | public Author getAuthor() {
return author;
} |
62c98844-3d98-4e72-a6ce-e3280f8b4fb9 | 0 | private long sum(long n) {
return (n + 1) * n / 2;
} |
ff38630b-0514-4477-b6eb-da9ffb0cba11 | 8 | public void generateNetherTerrain(int par1, int par2, byte par3ArrayOfByte[])
{
byte byte0 = 4;
byte byte1 = 32;
int i = byte0 + 1;
byte byte2 = 17;
int j = byte0 + 1;
field_73186_p = func_73164_a(field_73186_p, par1 * byte0, 0, par2 * byte0, i, byte2, j);
fo... |
714ce1d4-63c4-4cb3-b0f5-2e8542bedbce | 8 | public State PlanIngredient(Domain domain, State startingState, IngredientRecipe ingredient)
{
State currentState = new State(startingState);
List<IngredientRecipe> contents = ingredient.getContents();
for (IngredientRecipe subIngredient : contents) {
if (!subIngredient.isSimple()) {
System.out.println... |
f0391b04-f4cf-498b-ac2e-c017e45aa344 | 9 | void doStep() {
double vd = volts[1] - volts[0];
if (Math.abs(lastvd-vd) > .1)
sim.converged = false;
else if (volts[2] > maxOut+.1 || volts[2] < minOut-.1)
sim.converged = false;
double x = 0;
int vn = sim.nodeList.size()+voltSource;
double dx = 0;
if (vd >= maxOut/gain && (lastv... |
e9a5c76d-e0f6-4f72-b5bf-48565886eb5c | 4 | @Override
public String strip(String s) throws Exception {
int length = s.length();
if (oldChars.length < length + 1) {
oldChars = new char[length + 1];
}
s.getChars(0, length, oldChars, 0);
oldChars[length] = '\0'; // avoiding explicit bound check in while
... |
92ad2ead-30af-4f79-a60e-33129c15d0bc | 9 | public boolean playTurn() {
boolean retBoo = false;
boolean repeat = true;
boolean oppRepeat = true;
int myStore = 0;
int oppStore = 0;
int choice = 0;
while (!isFinished()) {
repeat = true;
oppRepeat = true;
while (repeat) {
System.out.println("The board: ");
System.out.println( printBoard... |
fd5a1048-6e43-4193-ba7a-6be6425fff51 | 2 | @Override
public Character validate(String fieldName, String value) throws ValidationException {
if (value == null) {
return null;
}
if (value.length() != 1) {
throw new ValidationException(fieldName, value, "not a single character");
}
return value.charAt(0);
} |
65123832-00e4-4772-b599-2d6c6b3e5684 | 5 | public void step(){
try{
int idx = getProgramCounter();
String opcode = "0x" + Integer.toHexString(code.getOpcode(idx)).toUpperCase();
boolean imm = code.getImmediate(idx);
boolean ind = code.getIndirect(idx);
int arg = code.getArg(idx);
INSTRUCTION_MAP.get(opcode).execute(arg, imm, ind);
}catch(A... |
9a1ccd6f-f701-41a0-a1da-259a16cadf63 | 7 | @Override
void replaceChild(@SuppressWarnings("unused") Node oldChild, @SuppressWarnings("unused") Node newChild)
{
// Replace child
if(this._expLogica_ == oldChild)
{
setExpLogica((PExpLogica) newChild);
return;
}
for(ListIterator<PComando> i = t... |
1c9010f1-fe41-49e5-8858-13acd1e6262d | 6 | public static void setMultiMode(PlacementMode mode, SecurityLevel securityLevel, String[] args, Player player, PlayerState state) {
if (!MULTI_MODE.contains(mode)) return;
if (state.getMode() == mode && state.getSecurityLevel() == securityLevel) {
state.reset();
sendMessage(play... |
87e7fb32-bf8d-4b32-b132-4069451635cd | 2 | public int intValue() {
if (okClicked) {
try {
Integer ival = Integer.parseInt(lineEdit.text);
return ival.intValue();
} catch (NumberFormatException e) {
return 0;
}
}
return 0;
} |
856a2d4e-bfc6-4a8e-9edc-0703457c210d | 8 | public Vector<Vector<String>> getQueryTriple(String xml)
{
if(xml==null)
{
System.out.println("ERROR:SSAP_XMLTools:getQueryTriple:XML message is null");
return null;
}
Document doc=null;
try {
doc = builder.build(new ByteArrayInputStream(xml.getBytes()));
} catch (Exception e) {
// TODO Auto-g... |
bb5c9db8-29f7-4805-bf47-3da9a66b52fd | 5 | @Test
public void testServerClose() {
LOGGER.log(Level.INFO, "----- STARTING TEST testServerClose -----");
try {
server1.startThread();
} catch (IOException | ServerSocketCloseException | FeatureNotUsedException e) {
exception = true;
}
waitListenThrea... |
ef44cd97-3a28-4b23-b8ac-048471e86bbd | 5 | @Override
public String grantLogin(User user) {
String command = "SELECT * FROM secure.USER WHERE US_USERNAME='"+user.getUsername()+"'"
+ " AND US_PASSWORD_MD5='"+Util.calculateMD5(user.getPassword())+"'";
try {
Connection connection = Util.connectToMySql();
... |
dba700d9-792d-4ed7-8fc0-26fdf76cf380 | 0 | TorrentRemoveTimer(Tracker tracker, Torrent torrent) {
this.tracker = tracker;
this.torrent = torrent;
} |
509278af-10d0-4fab-a3c1-8bf85b927b38 | 2 | private void start() {
try (Scanner sc = new Scanner(System.in)) {
Thread t = new Thread(net);
t.start();
net.send(new Handshake(name));
while (true) {
// System.out.print(" ");
String line = sc.nextLine();
handleInput(line);
}
} catch (IOException e) {
e.printStackTrace();
}
} |
132a4b48-a35a-42a5-8a52-06de6363c51c | 7 | @Override
public void getInput() {
int selection = -1;
boolean isValid = false;
do {
this.displayMenu();
Scanner input = SnakeWithPartner.getInFile();
do {
try {
selection = input.nextInt();
isValid ... |
763eff13-b282-42bd-8c36-e29f221431a0 | 4 | public void showHp() {
String ene = "<><><>--ENEMY--<><><>\n"; //Enemies & HP
String pla = "<><><>--TEAM--<><><>\n"; //Team & HP
//ADD
for ( int i = 0; i < _eInPlay.size(); i++ ) {
Monster e = _eInPlay.get(i);
if ( !e.getDead() )
ene += " " + e.getName() + ": "
+ e.getHp() + "\n"; //list a... |
281a779d-e844-4134-a325-e29394589370 | 4 | @RequestMapping(value = "del", method = RequestMethod.POST)
@ResponseBody
public Map del(@RequestParam int[] id) {
Map<String, Object> map = new HashMap<>();
List<String> l1 = new ArrayList<>();
List<String> l2 = new ArrayList<>();
List<String> l3 = new ArrayList<>();
f... |
ade01b23-b90f-4cd3-a1de-4f88d7450ecc | 4 | private boolean predicateApplies(Subscriber<?> s, Object message) {
if (s instanceof PredicatedSubscriber
&& !((PredicatedSubscriber<?>) s).appliesO(message)) {
return false;
}
return true;
} |
3b9b589c-142c-4731-873a-79096426755f | 9 | static protected void htmlEncode(Writer writer, String string) throws IOException {
int n = string.length();
int writeNext = 0;
for (int i = 0; i < n; ++i) {
int ch = string.charAt(i);
String encoded;
if (ch >= 128)
encoded = "&#" + ch + ";";
else
switch (ch) {
... |
9c343a34-63bb-479c-a928-9c499c75f26a | 2 | public void sendData(Object dataObject) {
this.dataToSend = dataObject;
byte[] data = null;
byte[] lengthPacket = null;
try {
// serialize the data to be sent
data = NetworkPacketManager.serialize(dataToSend);
// compute the length of the package
lengthPacket = NetworkPacketManager.packetLength(d... |
5cf964fe-0164-4ff8-a883-b6c55e29dd2b | 1 | public void Start()
{
if (!isRunning)
Run();
} |
b3749251-4beb-4b2d-b38b-36440d5de467 | 3 | @Override
public void mousePressed(MouseEvent e) {
Object obj = e.getSource();
for(int i =0; i<row; i++){
for(int j=0; j<col; j++){
if( obj == grids[i][j]){
System.out.println(i + " "+ j );
grids[i][j].setColor(Color.BLACK);
... |
3cad3851-8340-48a4-987f-ce45e9949f36 | 8 | final void method3287() {
if (secondInt == -1) {
secondInt = 0;
if (aByteArray3899 != null && aByteArray3899.length == 1
&& aByteArray3899[0] == 10)
secondInt = 1;
for (int i_13_ = 0; i_13_ < 5; i_13_++) {
if (options[i_13_] != null) {
secondInt = 1;
break;
}
}
}
if (anInt38... |
bfa0e184-e547-43b1-8205-eefeb2766a02 | 8 | public void updatePosition(String product, Price price, BookSide side, int volume) throws Exception {
String thisClass = "client.Position#updatePosition.";
if (ExceptionHandler.checkString(product, thisClass) && ExceptionHandler.checkObject(price, thisClass)
&& ExceptionHandler.checkObje... |
d66cbdd4-9d03-4759-bdfe-716ca861ba09 | 0 | public String getAdresse() {
return adresse;
} |
3346b187-3769-479f-99d3-9ce2dce350d5 | 4 | public void thrust()
{
xVelocity += Math.cos(Math.toRadians(angle))*acce;
yVelocity += Math.sin(Math.toRadians(angle))*acce;
Velocity = getVelocity();
angle1 = Math.toDegrees(Math.atan(yVelocity / xVelocity));
if(xVelocity < 0)
angle1 += 180;
if(xVeloc... |
82163a86-20f4-457c-a4ff-feebed4fa310 | 3 | @Override
public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args) {
if (cs instanceof Player) {
final Player player = (Player) cs;
if (DatabaseHandler.isAdmin(player)) {
if (args.length == 1) {
final String mapID = args[0];
Lobby.forcedMap = mapID;
player.sendMes... |
f8f3f255-3102-4f06-b776-069aaadf0d35 | 4 | public static double findRootByBisection(double x_start, double x_end, Function func) {
double x_middle = (x_start + x_end) / 2;
double y_start = func.call(x_start);
double y_end = func.call(x_end);
double y_middle = func.call(x_middle);
if (y_middle == 0.0) {
return... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.