method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ac803eb3-cacc-4e28-8e21-ec2b76d4f12a | 1 | public Polygon rotate(double a) {
Coordinate[] res = new Coordinate[this.corners.length];
for(int i=0; i<this.corners.length; i++)
res[i] = this.corners[i].rotate(a);
return new Polygon(res);
} |
e121d55d-7277-4a25-a5aa-2470f385d227 | 0 | public String getUrl() {
return url;
} |
1ec8e7e6-ef67-4c49-ac3e-911c75fe841b | 5 | public void checkCollisionWithPlayer() {
// check for collisions if player is not invincible
if (!skillW.isInvincible()) {
for (int i = 0; i < boardSpawn.getEnemies().size(); i++) {
if (player.getShape().intersects(boardSpawn.getEnemies().get(i).getShape())) {
boardSpawn.getEnemies().remove(i);
hea... |
b8a139bc-f33f-4a27-9744-3ce9ccb3f893 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "SignatureValue")
public JAXBElement<SignatureValueType> createSignatureValue(SignatureValueType value) {
return new JAXBElement<SignatureValueType>(_SignatureValue_QNAME, SignatureValueType.class, null, value);
} |
dc0f7c04-f286-438f-804b-0ba25d220203 | 2 | public int intronSize(int intronNum) {
if (intronNum >= (numChilds() - 1)) return -1;
ArrayList<Exon> exons = (ArrayList<Exon>) sortedStrand();
Exon exon = exons.get(intronNum);
Exon next = exons.get(intronNum + 1);
return (isStrandPlus() ? (next.getStart() - exon.getEnd()) : (exon.getStart() - next.getEnd())... |
3efc6fd7-0f59-4781-95f2-f7599b17ff6d | 3 | public String saveIncompletedSeller() {
if (StringUtils.isBlank(newSeller.getShopAddress())) {
newSeller.setShopAddress(null);
}
if (StringUtils.isBlank(newSeller.getShopPhone())) {
newSeller.setShopPhone(null);
}
if (StringUtils.isBlank(newSeller.getShopName())) {
newSeller.setShopName(null);
}
... |
a9a8b6e7-fbe8-4199-9dcf-01fa3dd72005 | 5 | public List<Integer> getResponse() {
if (result == -1 || result == JOptionPane.CANCEL_OPTION || this.options == null) {
return null;
}
List<Integer> response = new ArrayList<Integer>();
int i = 0;
for (JCheckBox cb : this.checkBoxes) {
if (cb.isSelected()) {
response.add(i);
}
++i;
... |
aea8d593-fb0e-4c7d-8280-e23055074290 | 0 | public void stop()
{
timer.stop();
} |
2ce1be76-29fc-467f-b7e0-c309cb6a1b20 | 0 | public String getNameOfParticipant(String id) {
return participants.get(id).getName();
} |
96bb896e-ad17-4ad9-b18b-de732df5b15c | 2 | protected static boolean getBoolean( String s )
{
return s.equalsIgnoreCase( "1" ) || s.equalsIgnoreCase("T")|| s.equalsIgnoreCase( "TRUE" );
} |
83a1c589-1a1f-47bb-b25e-621f67d62779 | 2 | @Override
public Implique postImplique(Implique i) throws JSONException, BadResponseException {
Representation r = new JsonRepresentation(i.toJSON());
r = serv.postResource("intervention/" + interId + "/implique", i.getUniqueID(), r);
Implique implique = null;
try {
implique = new Implique(new JsonRepresen... |
6380867f-4e45-4c19-8842-b6e6f552ef1c | 6 | public final Key unwrap(
byte[] wrappedKey,
String wrappedKeyAlgorithm,
int wrappedKeyType)
throws IllegalStateException, InvalidKeyException, NoSuchAlgorithmException
{
if ( mode != UNWRAP_MODE )
throw new IllegalStateException("Cipher is not initialised for unwra... |
e280b251-a075-4dde-93a7-03d90143941f | 5 | @Override
public List<Group> findGroupAll() {
List<Group> list = new ArrayList<Group>();
Connection cn = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
cn = ConnectionHelper.getConnection();
ps = cn.prepareStatement(QTPL_SELECT_ALL);
... |
49a0e644-2bfe-432e-b8db-9cda2e406394 | 7 | private String prepareResponse(String message) {
String result = "";
int responseNumber = message.length() %7 ;
switch (responseNumber) {
case 0: result = "No"; break;
case 1: result = "Go away"; break;
case 2: result = "\"... |
29b876a0-b428-42d4-bcea-f30af9b1be5e | 6 | @EventHandler
public void GiantWither(EntityDamageByEntityEvent event) {
Entity e = event.getEntity();
Entity damager = event.getDamager();
String world = e.getWorld().getName();
boolean dodged = false;
Random random = new Random();
double randomChance = plugin.getGiantConfig().getDouble("Giant.Wither.Dodg... |
9736fd9c-95fd-43fd-860d-ec0017cc6f7d | 8 | public static ArrayList<String> tokenizeFile(File input) throws IOException {
BufferedReader inputBR = null;
ArrayList<String> tokanizedWords = new ArrayList<String>();
ArrayList<String> tempArrList = new ArrayList<String>();
try {
String inputString = "";
// Storing all stop words in a HashSet
... |
2878903d-b448-4548-a952-ba8c67521104 | 4 | private NodeList parseXml(String fileName)
{
//check if xml file exists
FileInputStream fstream = null;
try{
// Open the xml file
fstream = new FileInputStream(fileName);
}catch (Exception e){//Catch exception if any
errorFlag = 1;
errorString = "Config file could not be loaded.";
return null;
... |
306426e3-2bc0-4ea6-8d71-2a4900108a58 | 8 | public void logoutFinal()
{
try
{
final MOB M=mob();
final PlayerAccount acct=this.acct;
final String finalMsg;
if(M!=null)
finalMsg=M.Name()+": ";
else
if(acct!=null)
finalMsg=acct.getAccountName()+": ";
else
finalMsg="";
previousCmd.clear(); // will let system know you are bac... |
7da63ca5-1016-420f-8456-f5a9295f3bff | 3 | public void saveToFile(String filePath) throws Exception {
if (filePath == null || filePath.equals("")) {
throw new NullPointerException("File path is null.");
}
DocumentBuilderFactory docFactory = DocumentBuilderFactory
.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Doc... |
618d982c-b949-40d2-afed-198714b556da | 5 | private boolean set(int i, int value)
{
X[i] = value;
int maxA = 0;
for (int j = 0; j < i; j++)
{
if (X[j] != 0)
{
maxA = Math.max(maxA, A[j]);
}
}
int maxB = 0;
for (int j = i+1; j < N; j++)
{
if (X[j] != 0)
{... |
19560e36-4353-42c0-b9ce-5ebe7b0379df | 5 | @SuppressWarnings("unused")
@Test
public void testValidate() {
//try {
// XmlInputOutput.setSchemaLocation("c:/junit/schema");
//} catch (NoSchemasException e) {
// fail(e.getMessage());
//}
XmlPageReader reader = PageXmlInputOutput.getReader();
//Valid file
Page page = null;
try {
page ... |
7ad615a2-fd7b-44fc-a2fe-bf245ae3cfaa | 8 | void menuComposeAlpha(int alpha_op) {
if (image == null) return;
animate = false; // stop any animation in progress
Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
shell.setCursor(waitCursor);
imageCanvas.setCursor(waitCursor);
try {
if (alpha_op == ALPHA_CONSTANT) {
imageData.alpha = alpha... |
5ad26dc7-22f5-4e98-a4b5-cfe77e276764 | 9 | public static String getSignature(Method method) {
StringBuilder builder = new StringBuilder(128);
int modifiers = method.getModifiers();
if (Modifier.isPublic(modifiers))
builder.append("public ");
if (Modifier.isPrivate(modifiers))
builder.append("private ");
if (Modifier.isProtected(modifiers))
... |
8ad6258b-93f7-4e07-b2a3-e6babd2ae12c | 2 | @Override
public String toString() {
switch (type) {
case MADRUGADORES:
return "Madrugadores";
case COMEDOR:
return "Comedor";
}
return "";
} |
d41980f1-ed6f-44e4-ada7-aad3f7a5428b | 7 | public boolean moveSouth(int w)
{
boolean moved = false;
if(isFighting==false && isConcious() && getEnergy()>0)
{
if(w==3 || w==4)
{
setY(getY()+1);
moved = true;
}
else if(w>=10)
{
updateL... |
939e6b2f-c53c-45eb-8950-0540e1b578a5 | 5 | public void doAction(String value) {
char choice = value.toUpperCase().charAt(0);
while (choice != 'A' && choice != 'B' && choice != 'C' && choice != 'D') {
System.out.println("Invalid selection");
choice = getInput().toUpperCase().charAt(0);
}
if (choi... |
1ee00bcd-f687-4ec3-8f25-dd2f7a8ef74a | 0 | public void stop () {
engine.stop();
} |
c9f2e2c9-8d38-4491-b233-d69b42d3573f | 4 | private ClassInfo canonizeIfaceRef(ClassInfo clazz, Reference ref) {
while (clazz != null) {
if (clazz.findMethod(ref.getName(), ref.getType()) != null)
return clazz;
ClassInfo[] ifaces = clazz.getInterfaces();
for (int i = 0; i < ifaces.length; i++) {
ClassInfo realClass = canonizeIfaceRef(ifaces[i]... |
22fc2f17-1848-47a1-845c-11714007059c | 9 | @Override
public int attack(NPC npc, Entity target) {
final NPCCombatDefinitions defs = npc.getCombatDefinitions();
int distanceX = target.getX() - npc.getX();
int distanceY = target.getY() - npc.getY();
boolean distant = false;
int size = npc.getSize();
Familiar familiar = (Familiar) npc;
boolean usingS... |
ba6786ef-efac-4ca3-bd90-ea1557b4678c | 7 | private void go() throws IOException{
Selector selector = Selector.open();
//监听三个端口
for(int i=0; i<ports.length; ++i){
//一个channel对应一个socket
ServerSocketChannel ssc = ServerSocketChannel.open();
ssc.configureBlocking(false);
ServerSocket ss = ssc.... |
0f09f357-0b9c-4c67-8eae-a90a279e2750 | 3 | public void assign(String key, String value) {
try {
try {
if (!NONASSIGN_WORDS.contains(key)) {
currentTurtle.assign(key, value);
value = currentTurtle.get(key).toString();
}
} catch (Throwable e) {
}
Renderer.CommandHandler handler = getHandler(key);
handler.handle(value);
} catc... |
2641f151-82ae-4356-83e8-2df93579797a | 9 | public static String pathMatch(String pathSpec, String path)
{
char c = pathSpec.charAt(0);
if (c=='/')
{
if (pathSpec.length()==1)
return path;
if (pathSpec.equals(path))
return path;
if (pa... |
94b42070-c5aa-4afd-9178-731b98b9a78d | 4 | private ClientApp(DataInputStream in, DataOutputStream out) {
super(new GridLayout());
this.in = in;
this.out = out;
try {
out.writeUTF("SELECT_PRODUKTY");
out.flush();
int size = in.readInt();
if (size <= 0)
data = null;
else {
int size2 = in.readInt()-1;
for (int i = 0; i < size; ... |
bf52cac7-afda-4a5b-b889-fb3fd0ae485e | 9 | public int readInt()
throws IOException {
mark(DEFAULT_READ_LIMIT);
int cfaslOpcode = read();
if (cfaslOpcode >= CFASL_IMMEDIATE_FIXNUM_OFFSET) {
return cfaslOpcode - CFASL_IMMEDIATE_FIXNUM_OFFSET;
} else {
switch (cfaslOpcode) {
case CFASL_P_8BIT_INT:
return re... |
57dd831a-9094-425c-adce-74a267bc2d61 | 1 | public void setParkTimeMillis(int parkTimeMillis) throws CarException {
if (parkTimeMillis < 0) {
throw new CarException("Park time is under zero");
}
this.parkTimeMillis = parkTimeMillis;
} |
e0482d0c-7758-45f4-9e7b-c6fdb8a7cd6a | 0 | public void setName(String name) {
this.name = name;
} |
cabc8d01-7081-492f-890d-71748897c216 | 2 | public static int contains(String text, String match) {
int matchLength = match.length();
int count = 0;
int index = 0;
while (true) {
index = text.indexOf(match,index);
if (index == -1) {break;}
index += matchLength;
count++;
}
return count;
} |
461b0c11-d982-47de-b4ed-3cd20558ada9 | 8 | private int minimax(char[][] board, int ply, boolean is_maximizer){
// Base case: out of plies!
if (ply == 0) {
return game.getFitness(board, fitness_mode, is_maximizer ? PolarTTT.PLAYER1 : PolarTTT.PLAYER2);
}
// Find available moves
Location[] options = findAvailableMoves(board);
// Base case:... |
04f58e01-8650-421f-8d03-ec8d240fe596 | 8 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
this.sender = sender;
player = sender instanceof Player ? (Player) sender : null;
if (player == null) {
// TODO: Console Stuff
} else if ((args.length == 0) || args[0].equals("help")) {
this.Print... |
ddd89312-9418-4113-a265-944a5ce83b60 | 3 | private void setHighScore(){
FileWriter output = null;
try{
File f = new File(saveDataPath, fileName);
output = new FileWriter(f);
BufferedWriter writer = new BufferedWriter(output);
writer.write("" + highScore);
writer.newLine();
if(elapsedMS <= fastestMS && won){
writer.write("" + ... |
31dc76af-0889-47be-b6de-c5265244bddc | 1 | @Override
public boolean saveFile(DocumentInfo docInfo) {
try {
FileOutputStream fileOutputStream = new FileOutputStream(PropertyContainerUtil.getPropertyAsString(docInfo, DocumentInfo.KEY_PATH));
fileOutputStream.write(docInfo.getOutputBytes());
fileOutputStream.flush();
fileOutputStream.close();
... |
62da2eea-b092-498e-88dc-d41e3f95bbac | 0 | public void setjTextFieldVilleNom(JTextField jTextFieldVilleNom) {
this.jTextFieldVilleNom = jTextFieldVilleNom;
} |
277b11c9-b96f-41e6-b85c-4321834aa957 | 6 | public static void copyFile(InputStream srcStream, String destFile){
DataInputStream dis = new DataInputStream(srcStream);
FileOutputStream fos = null;
try {
fos = new FileOutputStream(destFile);
byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead;
while ((bytesRead = dis.read(buffer)) != -1)
... |
77f0f22a-227c-48c3-b022-3a07c60dc157 | 0 | public String getId() {
return id;
} |
c1d8bb3a-9be0-4233-b47f-ba8314e48702 | 9 | public boolean canAttack(int destRow, int destCol, MovementDirection direction)
{
int distance = mPieceMovements.getDistance(direction);
if (distance == PieceMovements.UNLIMITED)
return true;
switch (direction)
{
case SOUTH:
return (destRow - mCurrentSquare.getRow()) < distance;
case NORTH:
retur... |
1ab352b5-3103-43a8-af6f-19cb264f4c23 | 2 | private boolean isCtrlShiftTabPressed(KeyEvent e) {
return e.character == SWT.TAB && ((e.stateMask & SWT.CTRL) != 0) && ((e.stateMask & SWT.SHIFT) != 0);
} |
f5e888f4-3fb7-4a11-8577-add1881a9055 | 4 | @Override
public int doEndTag() throws JspTagException {
try {
JspWriter out = pageContext.getOut();
if (pageNo != 0) {
out.write("<thead><tr><th scope='col'>");
for (int i = 1; i <= pages; i++) {
if (i != pageNo) {
... |
55985836-0438-4686-ad7d-f54be1836861 | 5 | protected static boolean isMethodMatch(Method method, String name, Type[] args) {
if (!method.getName().equals(name)) {
return false;
}
if (args == null) {
return true;
}
Type[] formals = method.getParameterTypes();
if (formals.length != args.length) {
return false;
}
for (int i = 0; i < ar... |
1a8222ac-00d9-4f51-8b16-f4724732bbae | 1 | public Reserve (Piece[] pieces, int length){
super(length*4,4);
piece=pieces;
for (int i=0; i<length; i++){
createPiece(piece[i],i);
}
} |
626ba9f6-9093-44a2-baee-5c12a1e378de | 3 | public static boolean isEmailAddress(String emailAddress) {
Boolean valid = null;
try {
Matcher matcher = _emailPattern.matcher(emailAddress);
valid = matcher.matches();
} catch (Exception e) {
if (_log.isWarnEnabled()) {
_log.warn(e);
}
}
if (valid == null) {
return false;
} else {
... |
f38db0c0-6e01-4070-bf91-c811a0de9df2 | 3 | private void startReceivingFile(String line) {
if (this.fileReceiverThread == null ||
!this.fileReceiverThread.isAlive()) {
String argument[] = null;
String fileName = null;
int packageSize = 0;
if (line.contains("\"")) {
argument = line.split("\"");
packageSize = Integer.parseInt(argument[2])... |
9f7abb99-8562-4387-8f05-a066488910c4 | 2 | public void setBounds(int x, int y, int w, int h) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
if (component != null) {
if (component instanceof GUIComponentGroup) {
component.setBounds(x, y, w, h);
}
else {
... |
c6186a74-3f71-41c5-a4f8-e7219e04bacd | 5 | private static double[] getResistPoints(int lineNumber, double[] highPrices) {
double[] rPoints = new double[lineNumber];
for(int i =0;i<lineNumber-1;i++){
double price = 0;
for(int j=-5;j<=0;j++){
if((i+j>=0) && (i+j<lineNumber-1) && highPrices[i+j]>price){
... |
01dd224a-10f6-4fd1-811c-bd23e12b94f4 | 8 | public File openFile(String currentValue, String text, String extension) {
JFileChooser chooser = null;
if (currentValue != null) {
String file = StaticValues.resourceToFile(currentValue);
if (file != null) {
File ffile = new File(file).getParentFile();
chooser = new JFileChooser(ffile);
}
}
if... |
4b4f5803-ca13-4dbe-9cee-44121d77a2d1 | 8 | @Override
public void move() {
isMoving = false;
if (keyHandler.isPressed(LEFTKEY)) {
x -= speed;
direction = LEFT;
isMoving = true;
}
if (keyHandler.isPressed(RIGHTKEY)) {
x += speed;
direction = RIGHT;
isMoving = true;
}
if (keyHandler.isPressed(UPKEY)) {
y -= speed;
direction = U... |
2533df96-3a1c-4a36-8981-b558ff165522 | 0 | public void setId(String id) {
this.id = id;
setDirty();
} |
955c87a4-2148-4620-be39-4e0e8aa36b3e | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int[] info = readInts(line);
if (info[0] == 0 && i... |
b057078d-9912-4ecc-991e-c01a90849c08 | 3 | private void close() {
try {
if (statement != null) {
statement.close();
}
if (conn != null) {
conn.close();
}
} catch (SQLException e) {
throw new RuntimeException("Erro ao fechar conexão!");
}
} |
51ea7421-d532-4cfc-93b7-e3e889324796 | 6 | @Override
public boolean execute(RuleExecutorParam param) {
Rule rule=param.getRule();
List<String> values = Util.getValue(param, rule);
if(values==null || values.isEmpty()){
return false;
}
boolean retValue=true;
for(String value:values){
String compareValue=rule.getValue();
if(rule.isIgnoreCase(... |
850e5ab6-25be-45d9-9a2d-08cbcf967a41 | 7 | @Override
public void visitLocalVariable(final String name, final String desc,
final String signature, final Label start, final Label end,
final int index) {
if (signature != null) {
if (localVarType == null) {
localVarType = new ByteVector();
... |
6d4b0546-aedc-46c8-85ed-56f901ba5a2e | 8 | public void run() {
if (compiled == false) {
Console.log("Please compile before running this program.", "error");
return;
}
cancelled = false;
short currentInst = 0x0800;
//int counter = 0;
try {
if (!running) {
PC = 0;
... |
df0325a6-9add-45db-b993-4d12dc6c2c46 | 6 | private int evaluateRecursively (AbstractPlay play, Player cpu){
Board copy = new Board (play.getBoard());
play.setBoard(copy);
int evaluation = play.eatNumber();
Piece piece = copy.getPiece(play.getStart()); //salvo il pezzo per poi controllare se è un damone
play.execute(); //sulla copia della damiera
... |
02551460-9561-4c8f-a87c-cb0b46f6b4e3 | 3 | public char nextClean() throws JSONException {
for (;;) {
char c = next();
if (c == 0 || c > ' ') {
return c;
}
}
} |
bd33d4bf-119a-40fa-8be9-6e5735d3197d | 3 | public void saveBlock(Block b, Peer p){
Piece piece = this.pieces.get(b.getIndex());
if(piece!=null)
piece.saveBlock(b);
if(piece.complete()){
this.recieved[b.getIndex()] = true;
completedPieceCount++;
if(completedPieceCount == this.torrentInfo.piece_hashes.length){
saveFile();
this.done = tr... |
7b429a27-23b0-419c-b460-2779c56d8d9e | 3 | public static void main(String[] args) {
// TODO Auto-generated method stub
int m = 2;
int n = 2;
double max = 10.0;
//double[][] A = new double[m][n];
//double[][] A = {{0.2523, 0.873}, {0.82, 0.173}};
double[][] A = {{0.2, 0.3}, {0.8,0.7}};
LPSolver sol1 = new LPSolver(A);
double value = sol1.getVa... |
2c744928-d805-4c63-a0a4-f17971451288 | 5 | public static Rules parse(HtmlElement element, String str){
switch(str){
case "none":
return NONE;
case "groups":
return GROUPS;
case "rows":
return ROWS;
case "cols":
return COLS;
case "all":
return ALL;
default:
return null;
}
} |
279feca2-f249-4b98-a4cc-5833d3229bf7 | 8 | void setPendingViewOffset(int xofs,int yofs) {
if (!pf_wrapx) {
if (xofs < 0) xofs=0;
if (xofs > tilex*(nrtilesx-viewnrtilesx))
xofs = tilex*(nrtilesx-viewnrtilesx);
}
if (!pf_wrapy) {
if (yofs < 0) yofs=0;
if (yofs > tiley*(nrtilesy-viewnrtilesy))
yofs = tiley*(nrtilesy-viewnrtilesy);
}
p... |
8a9da397-8588-457a-8a43-28524ed3a9dc | 2 | public void putMergeVar(String key, Object value) {
if (value != null) {
if (value instanceof Date) {
mergeVars.put(key, simpleDateFormat.format(value));
} else {
mergeVars.put(key, value);
}
}
} |
09165c40-b750-4450-8bd0-564bc16fa0a9 | 1 | public void setString( String s ){
if( s == null )
throw new IllegalArgumentException( "value must not be null" );
value = s;
} |
acbba965-e3f0-462a-9393-5deb87c035af | 0 | @Override
public void update() {
} |
bbed2e15-6484-4a1f-97b2-d3c5c4a763bf | 0 | private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
// TODO add your handling code here:
this.setDefaultCloseOperation(this.HIDE_ON_CLOSE);
}//GEN-LAST:event_formWindowClosing |
bb6fa81d-fcc5-440d-a444-e8b92d270fe1 | 6 | public final DccChat dccSendChatRequest(String nick, int timeout) {
DccChat chat = null;
try {
ServerSocket ss = null;
int[] ports = getDccPorts();
if (ports == null) {
// Use any fre... |
f532a8c1-3f33-4f12-ba3d-e9de135fdc43 | 8 | public void adjustColors(int redOff, int greenOff, int blueOff) {
for (int i = 0; i < pixels.length; i++) {
int color = pixels[i];
if (color != 0) {
int red = color >> 16 & 0xff;
red += redOff;
if (red < 1) {
red = 1;
} else if (red > 255) {
red = 255;
}
int green = color >> 8 ... |
318986a9-fc66-4bf9-ab20-050a5b776943 | 1 | public static void main(String[] args) {
FinalData fd1 = new FinalData("fd1");
// ! fd1.valueOne++; // Error: can't change value
fd1.v2.i++; // Object isn't constant!
fd1.v1 = new Value(9); // OK -- not final
for (int i = 0; i < fd1.a.length; i++)
fd1.a[i]++; // Object isn't constant!
// ! fd1.v2 = new V... |
11695494-5ea7-4287-8d16-50c624cd7643 | 8 | protected SoapResponse(javaxt.http.Response response, String resultsNode) throws SoapException {
int status = response.getStatus();
if (status==200 || status==202 || status==203){
body = response.getText("UTF-8");
if (body!=null){
url = response.getURL(... |
7e49799d-5384-49b4-8ec4-5956abb3d7c2 | 3 | private static void printEllipsisRow(int width, int printWidth, int startX) {
System.out.print("|");
if (startX > 0) // Print an extra column of "..."s at the beginning.
System.out.print("...,");
for (int x = 0; x < printWidth; x++)
System.out.print(" ... ");
if (printWidth < width) // Print an extra co... |
8ebed9c9-c36d-4e8c-887d-4f3b8dfabedb | 2 | public Entity(int x, int y, int id, int collisionType)
{
setX(x);setY(y);
this.id = id;
this.collisionType = collisionType;
if (collisionType == Collidable.CT_CIRCLE)
collisionRadii = new int[1];
else if (collisionType == Collidable.CT_RECTANGLE){
collisionRadii = new int[2];
}
} |
cf4284d9-6675-4d9a-9386-9ba47853d717 | 8 | public void mouseDragged( MouseEvent e ) {
double currX = e.getX();
double currY = e.getY();
double currDist = graphDist(currX,currY);
if (mouseOverN!=null)
lastAngle = getMouseAngle(mouseOverN.drawx, mouseOverN.drawy);
else
lastAngle = getMouseAngle(temp... |
b17be6dc-c74d-459d-8604-ce804169b014 | 5 | public void calculateZoomFrom(Set<GeoPosition> positions) {
// u.p("calculating a zoom based on: ");
// u.p(positions);
if (positions.size() < 2) {
return;
}
int zoom = getZoom();
Rectangle2D rect = generateBoundingRect(positions, zoom);
// Rectangle2... |
a3c8c561-88d5-4b30-a530-2e4b42590439 | 4 | private double rowScale(Double[] row, double scaleFactor)
{
for (int i = 0; i < row.length; i++)
{
// mat[rowNum][i] = mat[rowNum][i] * scaleFactor + 0.0;
futures.add(threadPool.submit(new ScaleThread(row, i, scaleFactor)));
}
try {
for (Future f : futures)
f.get();
} catch (InterruptedExcepti... |
1d2257b0-7be8-4cd3-9708-2d4795b5d297 | 8 | @Override
public void actionPerformed(ActionEvent e) {
Object chkBox = e.getSource();
if (chkBox == frame.getPanPara().getCbFireMode()) {
JCheckBox cb = (JCheckBox)chkBox;
if (cb.isSelected()) {
this.obj.setFireMode(true);
frame.getPan... |
d8404cb3-18c9-44ed-9c15-c683a0044283 | 5 | @Override
public void keyDown(int keyCode) {
// System.out.println(keyCode);
switch (keyCode) {
// w
case 87:
mapDrawer.pan(0, 20);
break;
// d
case 68:
mapDrawer.pan(-20, 0);
... |
9d4a50d7-574d-400a-84bb-44f9ebd1ed09 | 8 | @Override
public String toString() {
return "RxModeRef {"
+ (extReferences != null ? " extReferences [" + extReferences + "]" : "")
+ (cls != null ? " cls [" + cls + "]" : "")
+ (recommendedValue != null ? " recommendedValue [" + recommendedValue + "]" : "")
+ (quality != null ? " quality ... |
24f7f1af-d515-4906-9e1c-9e493edb9921 | 3 | public Map<RedisBigTableKey, byte[]> getByRow(byte[] table, byte[] row) throws RedisForemanException
{
Map<RedisBigTableKey, byte[]> all = getAll(table);
boolean rowIsWildCard = Utils.hasWildCard(row);
String keyIsLike = join(Utils.RECORD_SEPARATOR, row);
Map<RedisBigTableKey, byte[]> toReturn = new HashMap<Re... |
bc3ac8da-6fda-4ca4-b042-598c7ae64287 | 3 | private void printGridletList(GridletList list, String name,
boolean detail, double gridletLatencyTime[])
{
int size = list.size();
Gridlet gridlet = null;
String indent = " ";
System.out.println();
System.out.println("============= OUTPUT for ... |
3ebe3426-93ae-4d75-9ead-3e4656193767 | 7 | public static void radixSortLexicalFixedLsd(String words[]) {
// 256 ASCII character positions
final int numBuckets = 256;
org.sheehan.algorithm.data_structures.List<QueueInterface<String>> buckets = new ListImpl<QueueInterface<String>>();
for (int i = 0; i < numBuckets; i++){
... |
09913fa7-4628-43d1-81e3-f7875c146ddd | 4 | @Override
public FileVisitResult visitFile(Path file,
BasicFileAttributes attr) {
if (attr.isRegularFile()) {
String name = "" + file;
if (name.endsWith(".txt")) {
for (JSONArray comments : extractor.extractFromCrawler(file, related)) {
this.d... |
9dd841f0-b75a-48bc-ab48-8332208020ba | 1 | public void testFormatPrefixSimple3() {
try {
builder.appendPrefix(null);
fail();
} catch (IllegalArgumentException ex) {}
} |
b6bae675-44ec-4c59-8d42-e642e53eb2fe | 0 | public int getX(){
return ul.getX();
} |
da4b55eb-13b2-45fd-85e8-54c2cc3fc997 | 0 | public static void main(String[] args) {
System.out.println(1.0 + 2.0); // 3.0
System.out.println(2.0 - 3.0); // -1.0
System.out.println(3.0 * 4.0); // 12.0
System.out.println(16.0 / 5.0); // 3.2
System.out.println(16.0 % 5.0); // 1.0
} |
5f593a38-88b0-4e99-aa4a-fd4d5c8e505e | 0 | public Piece(boolean team, Square where)
{
this.team = team;
this.where = where;
} |
791bde9f-fd96-4718-95be-b9a3bda4c587 | 4 | public void shiftedRectangularHyperbolaFit(){
if(this.nAnalyteConcns<4)throw new IllegalArgumentException("Method shiftedRectangularHyperbolaFit requres at least 4 data points; only " + this.nAnalyteConcns + " were supplied");
this.methodUsed = 9;
this.sampleErrorFlag = true;
this.titleO... |
27e4d1d5-756b-4a83-8052-ae5b389f4305 | 2 | public void addText(Object o)
{
String s = o.toString();
int size = subObjects.size();
if(size != 0)
{
if(subObjects.get(size - 1) instanceof String)
s = (String)(subObjects.remove(size - 1)) + s;
}
subObjects.add(s);
} |
ec8b7d12-5231-462c-ad61-1b6e3cac349f | 6 | private void processQueue()
{
for (int var1 = 0; var1 < this.threadedIOQueue.size(); ++var1)
{
IThreadedFileIO var2 = (IThreadedFileIO)this.threadedIOQueue.get(var1);
boolean var3 = var2.writeNextIO();
if (!var3)
{
this.threadedIOQueue... |
f6baeb25-a00e-4eb4-b5c3-6b5d38bd7b66 | 7 | private int findSelectableComponentIndex(int index) {
int selectIndex = -1;
int k;
for (int i = 0; i < layoutOrderList.size(); i++) {
if ((findDraggableComponent((Component) layoutOrderList.get(i))).isEnabled() && i != index) {
k = selectIndex;
selectIndex = i;
if (k < index &&... |
b57cdc37-3ec4-42ed-8bdc-863af7502b7d | 9 | private AugAssign augassign() {
if (lexer.token != Symbol.ASSIGN
&& lexer.token != Symbol.PLUSASSIGN
&& lexer.token != Symbol.MINUSASSIGN
&& lexer.token != Symbol.MULTIASSIGN
&& lexer.token != Symbol.DIVASSIGN
&& lexer.token != Symb... |
50f59a18-5f09-42eb-a6d4-f79914d14ec9 | 8 | public int[] getDiffractionImage() {
if (pixels == null)
pixels = new int[width * height];
float min = Float.MAX_VALUE;
float max = -min;
int n = width * height;
for (int k = 0; k < n; k++) {
min = Math.min(min, f[k]);
max = Math.max(max, f[k]);
}
n = 0;
int c;
float delta;
switch (lod) ... |
51f9dfe4-a7ae-4340-9a53-f4be98a281fd | 1 | private boolean valid(int r1, int r2, int c1, int c2){
return c1 <= c2 && r1 <= r2;
} |
7d0fa257-8b81-4d59-b943-434e68c8ed78 | 8 | public static void makeMove(Move move, boolean alienTurn) {
// If it is the alien's turn
if (alienTurn) {
// If the alien wants to move
if (move.move) {
uigui.getGUI().drawAlien(Node.getOtherNode(move.edge, s... |
dd5d8fe3-1f4c-4a11-a6f4-d05de9b7e3b2 | 3 | private boolean jj_3R_89() {
if (jj_3R_54()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3_36()) { jj_scanpos = xsp; break; }
}
return false;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.