method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
c0396a03-087a-47b6-a590-d02372c0a19f | 1 | private static void db(final String s) {
if (Specialize.DEBUG) {
System.out.println(s);
}
} |
3d5fac5d-28e1-4994-a864-bf3b1ee8b761 | 9 | public void dragGestureRecognized(DragGestureEvent dge) {
JComponent c = (JComponent) dge.getComponent();
DefaultTransferHandler th = (DefaultTransferHandler) c.getTransferHandler();
Transferable t = th.createTransferable(c);
if (t != null) {
scrolls = c.... |
9026acf7-3601-462b-b7ab-99908d92ef59 | 6 | public double getSternCapacitance(){
if(!this.sternOption){
System.out.println("Class: GouyChapmanStern\nMethod: getSternCapacitance\nThe Stern modification has not been included");
System.out.println("A value of infinity has been returned");
return Double.POSITIVE_INFINITY;
... |
ec78b7de-4b9f-4211-b622-4ce75d0cd51e | 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... |
6206c051-325f-4a8c-8fcd-728587e07c97 | 9 | static int process(String line) {
int[] arr = giveArray(line.trim().split(" "));
int n = arr[0], p = arr[1];
if(n == 0 && p == 0)
return 0;
for(int i = 0; i < n; i++) {
readLine();
}
String name = null;
int met = -1;
double best = -1;
for(int i = 0; i < p; i++) {
String s = readLine().trim... |
9d71ad2f-630a-400c-902d-38e36ce9b69d | 6 | public static int dehexchar(char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - ('A' - 10);
}
if (c >= 'a' && c <= 'f') {
return c - ('a' - 10);
}
return -1;
} |
73b90fb4-2e28-46e0-839a-de748c3ab35d | 8 | void print() {
System.out.println("@RELATION Untitled");
for(int i = 0; i < m_attr_name.size(); i++) {
System.out.print("@ATTRIBUTE " + m_attr_name.get(i));
int vals = valueCount(i);
if(vals == 0)
System.out.println(" CONTINUOUS");
else
{
System.out.print(" {");
for(int j = 0; j < vals; j... |
7514f8d0-3b82-40be-a564-70b2beada51a | 3 | public void removeNode(Byte N) {
if(networkTreeMap.containsKey(N)){
for(Object nb : networkTreeMap.get(N).toArray()) {
removePath((Byte)nb, N);
}
}
networkTreeMap.remove((byte)N);
if(autoUpdate) {
update();
}
} |
e7c25140-06aa-46d8-b6b0-6bb81e405532 | 6 | @Override
public void processNPC() {
super.processNPC();
target = this.getCombat().getTarget();
if (spawnTime + 300000 < Utils.currentTimeMillis()
&& !this.getCombat().underCombat()) {
finish();
}
if (target != null) {
if (target instanceof Familiar) {
Familiar npc = (Familiar) target;
targ... |
35357066-c854-44bd-b031-d756cfb327bb | 7 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
DataStructure that = (DataStructure) o;
if (calibrationKey != that.calibrationKey) return false;
if (implementedChannels != that.implementedCha... |
59550ced-802a-4986-9a4f-f4e77379bd19 | 4 | private static String convertToHex(byte[] data) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < data.length; i++) {
int halfbyte = (data[i] >>> 4) & 0x0F;
int two_halfs = 0;
do {
if ((0 <= halfbyte) && (halfbyte <= 9))
... |
34f0025e-787e-4eb8-bf50-61505b4b3653 | 9 | public void printRowResult2(ArrayList<Row> rows, boolean headerLine) {
System.out.println("==============================================");
if (rows.size() == 0) {
System.out.println("No Result");
}
Iterator<Row> it = rows.iterator();
int c = 0;
while (it.hasNext()) {
Row r = it.next();
if (c ==... |
121255f2-f6b1-4918-a83e-fe6f0e02e5e1 | 9 | @Override
public boolean isValid(final Object value, final String type, final Dimension dimension) {
if (!(value instanceof PostilionAddAmount[])) {
return false;
}
final PostilionAddAmount[] addAmounts = (PostilionAddAmount[]) value;
if (addAmounts.length < 1 || addAmounts.length > 6) {
r... |
513bd5fb-447e-4e64-97e5-873b238e6309 | 8 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(Validate.isPlayer(sender)) {
sender.sendMessage("§6===== [§b Online Players §6] =====");
for(ServerId sid : ServerId.values()) {
if(plugin.getServerManager().ge... |
4a627949-cb7f-4fda-a3d8-d68f27dd4f08 | 1 | public void dropInfo(int howMuch) {
if ((howMuch & UNKNOWNATTRIBS) != 0)
unknownAttributes = null;
} |
ffcab11d-e370-4be5-89be-c5b8e34d0aba | 2 | public static void main(String[] args) throws IOException {
List<String> fileList = unpackTIPP(INPUT_ZIP_FILE, OUTPUT_FOLDER);
for (int x = 0; x <= fileList.size() - 1; x++) {
System.out.println("fileList" + x + "==" + fileList.get(x));
}
String fileURL = "https://raw.gi... |
572b45df-2dbc-43a3-b39b-a587663eb546 | 3 | public EntidadBancaria read(int idEntidadBancaria){
try{
String selectEntidad = "SELECT * FROM entidadbancaria where identidad = ?;";
EntidadBancaria entidadBancaria;
Connection connection = connectionFactory.getConnection();
PreparedStatement prepared = connection.prepareStateme... |
88855b23-3e15-4bfe-ba4e-d8804ff74b9b | 4 | @Override
public boolean addMod(String modName)
{
if (modName == null || modName.length() < 1) return false;
if (modName.equalsIgnoreCase("all")) return false;
if (!this.modList.contains(modName))
{
this.modList.add(modName);
this.saveConfig();
return true;
}
return false;
} |
24bfb72d-6f00-47eb-8fb6-763dbb00791b | 0 | public CeremonialSword(){
this.name = Constants.CEREMONIAL_SWORD;
this.attackScore = 8;
this.attackSpeed = 12;
this.money = 150;
} |
774ae406-8901-4b8e-9ed9-e7278174858e | 4 | public void update() {
for (int y = 0; y < ySize; y++) {
for (int x = 0; x < ySize; x++) {
Site site = scape.grid[x][y];
JLabel label = labels[x][y];
double energy = site.getFood();
double div = (255 / scape.maxFood) * energy;
int gradient = (int) (255 - div);
Color background;
backgr... |
06dd4208-43c4-4f42-9803-6d396c2b57c7 | 0 | public static String createChatLeftMessage(String myName) {
JSONObject jsonMsg = new JSONObject()
.element( "code", "5" )
.element( "name", myName );
;
return jsonMsg.toString();
} |
20ca01dd-1fe0-4a8c-b766-1ab8848ad519 | 7 | protected static void runLoop() {
if (loop) return ;
LoadService.loadPackage("src") ;
rendering() ;
if (scenario != null) {
scenario.updateGameState() ;
}
lastUpdate = lastFrame = timeMS() ;
loop = true ;
long simTime = 0, renderTime = 0, loopNum = 0 ;
while (loop) {
... |
252cb0b3-5948-4d74-93d9-91fdbc9b7d50 | 7 | private double[] logPToP(double[] llContribution, double[] pPrevious) {
double[] p = new double[llContribution.length];
double sum = 0.0;
for( int i = 0; i < llContribution.length; ++i) {
p[i] = Math.exp(llContribution[i]);
sum += p[i];
}
// Normalization
if( pPrevious != null)
if( sum != 0.0)... |
5347f9b9-e5e2-49fc-b731-5c7d09841f3e | 8 | public static LinkedList<Task> smartSearch(String searchLine,
LinkedList<Task> bufferedTaskList,
SEARCH_TYPES searchType,
SEARCH_TYPES searchAlgoType){
//Task that is collated through the searches.
LinkedList<Task> matchedTasks = new LinkedList<Task>();
switch (searchAlgoType) {
case SEARCH_... |
32a915eb-8a20-4779-a1d9-17d56eb581e3 | 8 | public static void main(final String[] args) {
//Schedule a job for the event-dispatching thread:
//creating and showing this application's GUI.
String fileToOpen = null;
boolean isOpeningClipboard = false;
try{
for(int i=0;i<args.length;++i){
String arg = args[i];
if (arg.startsWith("-"))... |
587e93f8-e2a8-4618-9690-5b5839b53815 | 2 | protected void setStringToPush(String stringToPush) {
/*
* if (!automata.StringChecker.isAlphanumeric(stringToPush)) throw new
* IllegalArgumentException("Push string must "+ "be alphanumeric!");
*/
PushdownAutomaton myPDA = (PushdownAutomaton) this.getAutomaton();
if (myPDA.singleInputPDA && stringToPus... |
f969a349-4104-4f15-abc1-a5c735a710be | 7 | public void crossReferenceImplementedInterfaces() throws CrossReferenceException
{
Set<String> unresolved = new HashSet<String>();
for (String clazz : implementsIndex.keySet())
{
Set<String> intfs = implementsIndex.get(clazz);
for (String intf : intfs)
{
if (i... |
f13ffedd-8e3f-405e-9cf1-80dcaaa06240 | 7 | public void ClearCircle(int X, int Y, int R)
{
// long time = System.nanoTime();
for (int i1 = Math.max(X-(R+1),0); i1 < Math.min(X+(R+1),w); i1 ++)
{
for (int i2 = Math.max(Y-(R+1),0); i2 < Math.min(Y+(R+1),h); i2 ++)
{
if (... |
d766b749-0da1-4eb0-8f45-9d879e858f2f | 9 | public static void main(String[] args) throws IOException {
Scanner in = new Scanner(System.in);
in.useLocale(Locale.US);
StringBuilder out = new StringBuilder();
while (in.hasNext()) {
int size = (int) in.nextDouble();
double[] d = new double[4];
int allow = 0;
for (int i = 0; i < size; i++) {
... |
02882550-d416-45a0-8a4b-acaf44f55939 | 8 | @command(
maximumArgsLength=0,
description="null command",
permissions="*")
public void Null(CommandSender sender,String[] args){
for(Field f:this.getClass().getFields()){
if(f.isAnnotationPresent(config.class)){
try{
if(f.getType()==Location.class){
if(f.get(this)!=null){
sender... |
14d13d19-2269-4c24-ad7f-9fc8c8915d31 | 2 | public E getDataIndex(String pIndex){
E resp = null;
for(Nodo<E> i = cabeza; i != null; i=i.getSiguiente()){
if(i.getIndex() == pIndex)
resp = i.getDato();
}
return resp;
} |
24fc3ca9-7be1-4181-89e4-241ea89b3c9e | 8 | @Override
public Object item(int index) {
Object value = null;
switch (BOMColumn.values()[index]) {
case ID:
value = getPart().getId();
break;
case QUANTITY:
value = getQuantity();
break;
case COST:
... |
3bb074f8-e7b8-407d-a7d0-e84c0e8eeca6 | 7 | protected static boolean isReserved(String key) {
return "highlight".equals(key)
|| "name".equals(key)
|| "resource".equals(key)
|| "thumbnail".equals(key)
|| "topic".equals(key)
|| "upper".equals(key)
|| "user".equals(key)
|| "_id".equals(key);
} |
2fb3c92d-dfa9-40ca-a246-d0b7bed27969 | 5 | static double computeArea(Circle cs[]){
double ans = 0.0;
for (int i = 0; i < cs.length; ++i){
boolean flag = false;
for (int j = i+1; j < cs.length; ++j){
if (cs[i].isIntersected(cs[j]) || cs[i].contains(cs[j])){
flag = true;
... |
7aa9d6f6-8186-42ab-b2c8-78301fb6a82e | 5 | public void start(String dest, long _maxSize){
if(_maxSize < 0)
{
maxSize = estimateMaxCapacity();
System.out.println("Maximum estimated size: " + maxSize);
}
else
{
maxSize = _maxSize;
}
try {
// send request
... |
496d156b-de5d-4f08-ab1f-213e7a85d1c3 | 4 | public void deleteLines(int[] indices) {
int j, k;
if (indices != null) {
for (int i = 0; i < indices.length; i++) {
for (k = indices[i]+i; k > 0; k--) {
for (j = 0; j < tailleY; j++) {
plateau[k][j] = plateau[k - 1][j];
... |
27560338-92a8-4c7c-bbe6-b0b493a79456 | 0 | public RoomEvent findRoomEventById(final Long id) {
return new RoomEvent();
} |
b3bf91d1-1084-43f4-a537-632790e710d6 | 1 | public boolean isBossOnStatus() {
if(frame == null) buildGUI();
return bossStatus.isSelected();
} |
2005c75f-02e2-45b1-914c-bc041cf3adea | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(activated() && (tickID==Tickable.TICKID_ELECTRONICS))
{
if(!amWearingAt(Wearable.IN_INVENTORY))
setPowerRemaining(powerRemaining()-1);
if(powerRemaining()<=0)
{
setPowerRemaining(0)... |
bf8fd91e-897b-4fbe-8696-bc7e04da7ca6 | 6 | public static void htmlWriteFindObjectResponsePage(String modulename, String objectname, String objecttype, Keyword matchtype, org.powerloom.PrintableStringWriter stream) {
{ Module module = Stella.getStellaModule(modulename, false);
if (module == null) {
OntosaurusUtil.htmlUnknownModuleResponse(Onto... |
09884d33-6682-4333-8fd1-4c55261c12b3 | 2 | public static void main(String[] args)
{
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c");
list.add("d");
for(int i = 0; i < list.size();i++){
String value = list.get(i);
System.out.println(value);
}
for(Iterator<String> iter = list.iterator();iter... |
ed33d13d-165d-4cff-bae5-16d3ac5d35ee | 3 | public static String capitalize(String s) {
if (null == s) {
return null;
}
if (s.length() == 0) {
return "";
}
char char0 = s.charAt(0);
if (Character.isUpperCase(char0)) {
return s.toString();
}
return new StringBuilder(s.length()).append(Character.toUpperCase(char0)).append(s.subSequence(1... |
86b67fd2-9552-43b2-a789-6dec09531ebe | 6 | public void connectData() {
switch (selectResult) {
case 1: // 表示连接的是mysql
url = DriverString.MYSQL_JDBC + hostName + ":" + port + "/";
ConnectDB.url = url;
ConnectDB.user = name;
ConnectDB.password = password;
if(dataField.getItemCount() != 0){
dataField.removeAllItems();
}
dataField.addI... |
6654a11f-126d-425f-9b35-bcf04d995c08 | 6 | public String inspect(Object o) {
Class c = o instanceof Class ? (Class) o : o.getClass();
StringBuilder sb = new StringBuilder();
sb.append("Class: ").append(c.getName()).append("\n");
sb.append("Methods:\n");
Method[] methods = c.getDeclaredMethods();
for (Method me... |
bd80c352-b615-421c-be25-a74f08e0786f | 1 | public SLPanel() {
addComponentListener(new ComponentAdapter() {
@Override public void componentResized(ComponentEvent e) {
if (currentCfg != null) initialize(currentCfg);
}
});
} |
6968ab86-f785-40df-be27-8f356f8e9805 | 8 | public Game getGame(String uuid) {
Game result = null;
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
try {
con = getConnection();
if (con != null) {
statement = con.prepare... |
87d8339d-eead-42e6-8dee-764f7a9e1854 | 7 | private void processSplits(JDialog parent) {
//
// Display the splits dialog
//
if (splits == null)
splits = new ArrayList<TransactionSplit>(5);
AccountRecord account = null;
int index = accountField.getSelectedIndex();
if (index >= 0)
ac... |
26bfad9d-8c23-4b6b-ab8f-b83cc46ec4a5 | 5 | private void matrixChainOrder(int p[])
{
for (int i = 1; i <= n; i++)
m[i][i] = 0;
/*
* The bottom up calculation needs to proceed only in the upper
* triangle and that too diagonal-wise as
* 1. i < j and m[i][j] for i > j does not makes sense
* 2. The diagonal represents the solution of the s... |
9731ad34-f30c-497e-901e-efbfeab861b7 | 1 | public TimelineView(Timeline timeline) {
this.timeline = timeline;
for (Timeline.TimelineItem item: timeline) {
timelineView.add(0, new TimelineItemView(item));
}
} |
ebc01912-c3a5-4d4a-9402-02fc4e1ca58d | 3 | public Graphics getOffScreenGraphics() {
Dimension d = getSize();
if (offScreen == null || offScreen.getWidth(null) != d.width || offScreen.getHeight(null) != d.height) {
offScreen = createImage(d.width, d.height);
}
return offScreen.getGraphics();
} |
52081623-9adf-41ba-bb37-6fdeddc27539 | 3 | public void addListeners() {
// Start Button Pressed
start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String input = tf.getText();
try{
int newGoal = Integer.parseInt(input);
if (worker == null) {
worker = new WorkerThread(0, newGoa... |
cca0c1c4-c80a-4b9f-92cc-ffa492ba2170 | 6 | @Override
public void update()
{
if(BulletImage.getDirection()==BulletDirection.E)
{
xLocation+=velocity;//moves bullet east
}
else if(BulletImage.getDirection()==BulletDirection.W)
{
xLocation-=velocity;
}
else if(BulletImage.getDirection()==BulletDirection.SW)
{
xLocation-=velocity;
yLo... |
28fe07cc-bc59-4533-b4d0-020240d9d83b | 7 | @Override
public void mouseReleased(MouseEvent e) {
selecting = false;
mouseEndPt = e.getPoint();
Node n1=null;
Node n2 = null;
graphPanel.add(graphLabel5,BorderLayout.PAGE_END);
graphLabel5.setVisible(false);
mouse... |
09780105-9cc3-4609-a118-398970886c4e | 7 | private void comparePasswords(JPasswordField pf1, JPasswordField pf2, JButton btn)
{
char[] p1 = pf1.getPassword();
char[] p2 = pf2.getPassword();
boolean verified = true;
if (p1.length == 0 || p2.length == 0) verified = false;
for (int i = 0; i < p1.length && i < p2.length; i++)
{
if (p1.length != ... |
8cce7b2c-3190-47bf-8b78-85cd93608483 | 4 | public Direction getOpositeDirection() {
switch (this) {
case UP:
return DOWN;
case DOWN:
return UP;
case LEFT:
return RIGHT;
case RIGHT:
return LEFT;
default:
return UP;
... |
23f375ef-2f37-42a0-855e-6daf7d6f0a98 | 4 | public static void main(String[] args) throws IOException, WrongArgumentException, JDOMException, InterruptedException {
// TODO Auto-generated method stub
int [] srcStart = {0,0,0};
int [] vsize = {900,247, 20};
int [] shape = {90,50,20};
int [] srcShape = {9,1,1};// �д洢
int [] dstShape = {9,5,4};
int []... |
fc1d01b8-7076-4693-8377-5cf2521504a1 | 6 | public static void moveRecursive(Towers towers, char from, char to, int num) {
//If we're trying to move a single disc, just move it.
if (num == 1) {
boolean status = towers.moveDisc(from, to);
if (!status) {
throw new RuntimeException("Bad move attempted from tow... |
e4b37d3e-c452-433a-b6e1-ec805b9b9f48 | 8 | public void connectOk()
{
try
{
if(chat.connected)
chat.disconnect();
userlist.reset();
// must make copies of strings here since dialog is closed afterward!
String address = new String(cd.address.getText());
String port = new String(cd.port.getText());
String nam... |
f8bc0a47-3f19-4b09-9f62-b0c575e4735e | 1 | public static S3Object uploadObject(S3Object s3object, S3Bucket s3bucket, RestS3Service s3service){
S3Object s3objectRes = null;
try {
s3objectRes = s3service.putObject(s3bucket, s3object);
} catch (S3ServiceException e) {
e.printStackTrace();
}
return s3objectRes;
} |
d24b8655-1ba8-40d4-9e23-347e23c0241b | 4 | public void insert(int value) {
Binarynode node = new Binarynode(value);
size++;
if (size == 1) {
root = node;
return;
}
Binarynode helpnode = root;
String binary = Integer.toBinaryString(size);
for (int i = 1; i < binary.length() - 1; i++)... |
c2870656-7535-444c-b378-e0bea2a141d3 | 8 | public static void main(String[] args) throws IOException {
//Get the file
BufferedReader inFile = new BufferedReader(new FileReader(System.getProperty("user.dir") + "/src/Files/prog213a.dat"));
//Define a variable to store the current line
String line;
//define week calculating pay for curent week
int week... |
b5417e7f-d2bf-4405-b159-07fc3b7441eb | 0 | public double getProgressPercentage() {
return 100 * (getProgress() / (double) getSize());
} |
200852cf-c2fc-431e-a855-8798216a9ad7 | 5 | protected void exchange(String[] argv) {
int bottom = first_nonopt;
int middle = last_nonopt;
int top = optind;
String tem;
while (top > middle && middle > bottom) {
if (top - middle > middle - bottom) {
// Bottom segment is the short one.
int len = middle - bottom;
int i;
// Swap it with... |
6ea02517-34a0-41db-8303-cb2169082cce | 9 | public void ConfirmTrade() {
if (TradeConfirmed == false) {
RemoveAllWindows();
for (int i = 0; i < playerOTItems.length; i++) {
if (playerOTItems[i] > 0) {
addItem((playerOTItems[i] - 1), playerOTItemsN[i]);
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter("logs... |
aa66e996-6030-45c0-95b0-ec00495cd83c | 5 | public String interpret(Symtab st) {
String result = "";
String typeStr = Utils.translateType(type.toString(), st);
if (st.lookup(type.toString()) != null) {
if (parlist == null)
result += type.toString() + " " + ident + " = new " + type.toString() + "();\n";
else {
result += type.toString() + " " +... |
2035b43d-fcd7-414e-9e09-58050146255c | 9 | private static int readToBufferUntil(
byte[] bytes, int from, int to, int maxOffset,
StringBuilder buffer, byte delimiter)
throws IOException {
int i = from;
while ((i < to) && (bytes[i] != delimiter)
// The reserved characters 0x00 (NUL), 0x02 (STX),
// 0x03 (ETX), 0x09 (TAB) are not allowed in any ... |
cc501ad4-7d1f-4853-8a19-e0ad43ee01a6 | 5 | @Override
public void allowAttempt(String username) throws UserLockedOutException {
if(username == null) {
logger.debug("Null username.");
return;
}
UserLockoutStatus status = lockoutMap.get(username);
if(status == null) {
logger.debug("No lockout status found for " + username);
return;
... |
64944fc0-0108-476c-a6ab-fc317ead59db | 7 | protected void drawDays() {
Calendar tmpCalendar = (Calendar) calendar.clone();
int firstDayOfWeek = tmpCalendar.getFirstDayOfWeek();
tmpCalendar.set(Calendar.DAY_OF_MONTH, 1);
int firstDay = tmpCalendar.get(Calendar.DAY_OF_WEEK) - firstDayOfWeek;
if (firstDay < 0) {
... |
bb842415-2072-40be-a791-2239574c624d | 7 | public void AVLdelete(Node poistettava) {
// Varmistetaan, ettei tyhjää koiteta poistaa
if (poistettava != null) {
Node poistettu = delete(poistettava);
// Jos poistettiin jotain
if (poistettu != null) {
Node alipuu;
Node p = poistettu.... |
6cfadbb2-b547-4e5c-811a-34afcd26de7a | 0 | public String getsuit() {
return suit;//Accesses the Card's suit and returns the Card's suit
} |
eac3bed7-b793-4207-912f-c30fd6b12f74 | 2 | @Override
public String execute(SessionRequestContent request) throws ServletLogicException{
String page = ConfigurationManager.getProperty("path.page.edituser");
resaveParamsSaveUser(request);
try {
Criteria criteria = new Criteria();
User currUser = (User) request.g... |
0123e379-a9c4-4da0-8589-8abb6c98824f | 9 | public int numeroPontos(int x) {
int nPontos = 0;
if (this.realizada == true) {
switch (x) {
case 1:
if (obtemResultado().equals(this.nomeTimeLocal)) {
nPontos = 3;
} else {
if ("Empate".e... |
2273ab84-ce5c-47b9-9049-34992df21e52 | 2 | public void go() {
setUpGui();
try {
Sequencer sequencer = MidiSystem.getSequencer();
sequencer.open();
int[] eventsIWant = {127};
sequencer.addControllerEventListener(ml, eventsIWant);
Sequence seq = new Sequence(Sequence.PPQ, 4);
Track track = seq.createTrack();
int r = 0;
f... |
309cdbff-3eb2-4bdd-86ca-68645709a387 | 8 | protected void updatePlus(Item item, Object element) {
boolean hasPlus = getItemCount(item) > 0;
boolean needsPlus = isExpandable(item, null, element);
boolean removeAll = false;
boolean addDummy = false;
Object data = item.getData();
if (data != null && equals(element, data)) {
// item shows same elemen... |
42534e10-14f3-4c70-a80b-3d0a699676d4 | 6 | @Override
public int compareTo(Interval<T> o) {
int result = low.compareTo(o.low);
if (result == 0) {
if (isClosedOnLow != o.isClosedOnLow) {
result = isClosedOnLow ? -1 : 1;
} else {
result = high.compareTo(o.high);
if (result == 0) {
if (isClosedOnHigh != o.isCl... |
671f6e6f-a270-4b65-b509-a4030f5ee92b | 3 | protected boolean checkDroppedGlList(int gl, int user)
{
int i =0;
FnbDroppedPacketInfo glID_uID;
while (i < droppedGl_user.size())
{
glID_uID = (FnbDroppedPacketInfo) droppedGl_user.get(i);
if ((glID_uID.getGridletID() == gl) && (glID_uID.getUserID() == user)... |
ad318e1c-8dce-48ef-8b22-c45b0612c0c2 | 9 | public static XPathException testConformance(
ValueRepresentation val, SequenceType requiredType, XPathContext context)
throws XPathException {
ItemType reqItemType = requiredType.getPrimaryType();
final Configuration config = context.getConfiguration();
final TypeHierarchy th = ... |
2fe5a57f-9acb-4637-83e5-707af9ae1728 | 2 | @Override
public int hashCode()
{
int result = start != null ? start.hashCode() : 0;
result = 31 * result + (finish != null ? finish.hashCode() : 0);
return result;
} |
7bce2396-ea0d-46b4-836d-f80c4cda23a1 | 3 | public static void readMemoryIn(String path) throws InvalidClassException {
try {
try (FileInputStream fileIn = new FileInputStream(("".equals(path) ? "pitmanager" : path));
ObjectInputStream in = new ObjectInputStream(fileIn)) {
Competition.setInstance((Competit... |
dec9130c-7e8d-4646-9028-24fce7e90125 | 0 | @Override
protected void generateFrameData(ResizingByteBuffer bb)
throws FileNotFoundException, IOException {
// TODO: don't always reload (but maybe this is appropriate for big images)
bb.put(this.reload());
} |
3a9e2422-a52c-4ba8-8796-7f2dd1d7aea7 | 7 | private void parseConnection(NodeList childNodes)
{
Connect connect = new Connect();
boolean flagOpen = false;
boolean flagClosed = false;
for (int count = 0; count < childNodes.getLength(); count++)
{
Node node = childNodes.item(count);
if ("from".equ... |
97161343-c2b8-40dd-af4d-4728192fd5db | 5 | @Override
protected void dataAttributeChanged(final BPKeyWords keyWord, final Object value) {
super.dataAttributeChanged(keyWord, value);
if (value != null) {
if (keyWord == BPKeyWords.ACTOR || keyWord == BPKeyWords.AUTO_ASSIGN
|| keyWord == BPKeyWords.MULTIPLE_EXECUT... |
85fbb2eb-f392-4986-be19-6ca6f4edb4ef | 6 | private static ArrayList<Item> readItemList() {
ArrayList<Item> ret = new ArrayList<Item>();
try {
BufferedReader br = new BufferedReader(new FileReader(new File("isaacitemlist.txt")));
String line = null;
while ((line = br.readLine()) != null) {
ret.add(new Item(line.split(",")[0], "passive"... |
5333059f-6c08-4487-be08-8e61e28a759e | 7 | public static void helper(List<List<Integer>> results, List<Integer> result,
int target, int index, int[] num, boolean[] visited) {
if (target == 0) {
results.add(new ArrayList<Integer>(result));
return;
}
if (index == num.length)
return;
for (int i = index; i < num.length; i++) ... |
bb516d3e-aace-4bae-8ee1-b3ab19882be0 | 3 | public Document toDOM(Serializable structure)
{
RegularPumpingLemma pl = (RegularPumpingLemma)structure;
Document doc = newEmptyDocument();
Element elem = doc.getDocumentElement();
elem.appendChild(createElement(doc, LEMMA_NAME, null, pl.getTitle()));
elem.appendC... |
9e5176ca-f3fc-43dd-9878-ec7685d8f26c | 9 | private static String getLocalServers(com.grey.logging.Logger logger) throws javax.naming.NamingException
{
javax.naming.directory.DirContext ctx = getDnsContext(null);
java.util.Hashtable<?, ?> env = ctx.getEnvironment(); //NB: Does not return same object we passed into constructor
ctx.close();
Object provide... |
e22b6ea6-0609-4f4e-a2e8-90f2687f453b | 2 | @Override
public int hashCode()
{
int result = 17;
result = 37 * result + name.hashCode();
result = 37 * result + attributes.hashCode();
result = 37 * result + (hasChildren ? 0 : 1);
if(isText())
{
result = 37 * result + text.hashCode();
}
return result;
} |
18ce4be3-44e4-4cc7-ac72-bbf6e2e2768d | 9 | @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 AyuntamientoPK)) {
return false;
}
AyuntamientoPK other = (AyuntamientoPK) object;
if ((this.localidad == null ... |
918a2bd7-f8e3-4647-aaa7-411f88bf21f7 | 1 | public BadConfigFormatException(String newMessage) {
super(newMessage);
message = newMessage;
// write to the log file
PrintWriter writer = null;
try {
writer = new PrintWriter("log.txt");
} catch (FileNotFoundException e) {
System.out.println("Writer didn't load");
}
writer.println(newMessage);
... |
d7d2a4dd-3220-42e4-97a5-b65693ebde72 | 1 | private void startMapView() {
try {
viewer = new MapView(this);
viewer.setVisible(true);
} catch (Exception ex) {
Logger.getLogger(MapModel.class.getName()).log(Level.SEVERE, null, ex);
System.exit(0);
}
} |
14274f00-56e0-4780-9e33-01a43449c1aa | 8 | public int uniquePathsWithObstacles(int[][] obstacleGrid) {
int m = obstacleGrid.length, n=obstacleGrid[0].length;
int[][] steps = new int[m][n];
steps[0][0] = (obstacleGrid[0][0]==0?1:0);
for(int i =1; i<m; i++)
steps[i][0] =(obstacleGrid[i][0]==1? 0:steps[i-1][0]);
for(int i =... |
4443e00f-f2c9-4dfe-94ff-5e1ca0c340b1 | 2 | private void saveScene(){
if(fileName.compareTo("")==0){
JFileChooser jfcSave = new JFileChooser("./");
if(jfcSave.showSaveDialog(null)==JFileChooser.APPROVE_OPTION){
drawPanel.save(jfcSave.getSelectedFile().getAbsolutePath(), true);
fileName = jfcSave.getSelectedFile().getAbsolutePath();
}
}else{
... |
52ddadbb-eff0-406f-a0dd-350a3d354a59 | 3 | @Override
public void virusAttack(int iterationNum) {
if (updateInfectionStatus && iterationNum != this.timeOfUpdate) {
this.infectionStatus = true;
} else {
if (random.getResult()) {
this.updateInfectionStatus = true;
this.timeOfUpdate = itera... |
063b080e-ff1d-44f5-a198-6295c539cad8 | 8 | public int canCombine(CombineableOperator combOp) {
// GlobalOptions.err.println("Try to combine "+e+" into "+this);
if (combOp.getLValue() instanceof LocalStoreOperator
&& ((Operator) combOp).getFreeOperandCount() == 0) {
// Special case for locals created on inlining methods, which may
// combine everyw... |
6202bcce-51c1-4fac-a4db-82d0a3d13f40 | 2 | public static void JSError(Exception e) {
if (e instanceof WrappedException) {
WrappedException ex = (WrappedException) e;
System.err.printf("[JSBot Runtime Error] %s\n", ex.getMessage());
} else if (e instanceof EcmaError) {
EcmaError ex = (EcmaError) e;
System.err.printf("[JSBot ScriptSyntax Error] %s... |
355324b9-0586-41ea-a417-e1f10026eaa2 | 7 | public static String getExtendedEntityList(boolean subtypes)
{
final int charLimit = 68;
int currentLoc = 1;
StringBuilder list = new StringBuilder();
for (ExtendedEntityType type : entityTypes.values())
{
if (subtypes && !type.hasParent() || !subtypes && type.hasParent())
continue;
Strin... |
71b0d594-f7dc-40c9-9213-8a4631bcd75e | 1 | @Test
public void testEmptyXmlFieldException() throws Exception {
try {
final PaymentResponse response = deserializeFromXml(
"src/test/java/ru/arsenalpay/api/unit/support/api_empty_field_response.xml"
);
System.out.println(response);
assert... |
5ba276f1-2c28-4409-8af8-21b3e6cbd3d7 | 6 | public DefaultNetwork(int inputs, int outputs, int hiddenLayers, int neuronsPerLayer, int maxInputThreshold, int maxOtherThreshold)
{
inputLayer = new Layer();
for(int i = 1; i <= inputs; i++)
{
Neuron neuron = new DefaultNeuron(generateThreshold(maxInputThres... |
23e3f5fc-ae67-4c3b-9429-c675dcb1f0d1 | 1 | public void addPropertyChangeListener(PropertyChangeListener listener) {
this.riverChangeSupport.addPropertyChangeListener(listener);
for (River r: rivers) {
r.addPropertyChangeListener(this);
}
} |
a060f915-1b12-4236-adaf-979165dd1a9f | 9 | public void divideProvincesHistorically() {
GameData.CURRENT_SCENARIO = "historical";
for (Province province : GameData.provinces) {
if (GameData.PLAYER_AMOUNT == 2) {
if (province.getNation() == Nationality.NEDERLANDS) {
province.setPlayer(GameData.PLAYER_ONE);
} else if (province.getNation() ==... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.