method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
663a3834-3969-431b-b13d-cd8a469fb614 | 8 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
MOB target=mob;
if((auto)&&(givenTarget!=null)&&(givenTarget instanceof MOB))
target=(MOB)givenTarget;
if(target.fetchEffect(this.ID())!=null)
{
mob.tell(target,null,null,L("<S-NAME> <S-IS... |
7d6ce601-b514-4cf7-9c08-c8633b5cd224 | 5 | private void skipQuotedValue(char quote) throws IOException {
// Like nextNonWhitespace, this uses locals 'p' and 'l' to save inner-loop field access.
char[] buffer = this.buffer;
do {
int p = pos;
int l = limit;
/* the index of the first character not yet appended to the builder. */
... |
6cf0a820-9157-4957-a2bf-0496070a40b7 | 6 | public static void setPlayerTurn() {
updateCurrentPlayers();
// @@@ Mangler indblik i hvordan denne metode virker - Hvorfor players array og ikke currentplayers array - Muligvis lav metode om
Player currentPlayersTurn = getCurrentPlayersTurn();
int index = 0;
for (int i = 0; i < ... |
d676e17d-114c-47fa-83f5-3ddf13af277b | 8 | public static void printSubmatrix(int[][] input){
int[][] sum = new int[input.length][input[0].length];
int maxSum = Integer.MIN_VALUE;
//copy base case first row and first column as is
for(int i=0;i<input.length; i++){
sum[i][0] = input[i][0];
}
for(int i=0; ... |
3edea068-aa18-4c34-8be0-5f95c343418f | 7 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long a = sc.nextInt();
long b = sc.nextInt();
boolean found = false;
for (int x1 = 1; x1 < a; x1++) {
int y1 = sqrtInt(a*a - x1*x1);
if (y1 == -1) continue;
if ((b*b*... |
3f802aef-6f45-4feb-aa32-c0147cb31c37 | 5 | @SuppressWarnings("unchecked")
public static void readPostTagsFile() throws IOException {
String[] reader = pApplet.loadStrings(POST_TAGS_FILE);
int question, tag;
ArrayList<Integer> tmpList;
// Reads the file header
for (int i = 1;i<reader.length;i++) {
String[] nextLine = reader[i].replace("\"", "").s... |
95fea42c-de69-48da-a819-a79cc30927ff | 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 UserAccessRequest)) {
return false;
}
UserAccessRequest other = (UserAccessRequest) object;
if ((this.filterID ... |
9af9908b-6466-4a9b-a16e-33946b09344d | 1 | public void arrangeWhitePieces() {
this.addPieceOnField('a', '1', new Rook(true, this.whiteRookImage));
this.addPieceOnField('b', '1', new Knight(true, this.whiteKnightImage));
this.addPieceOnField('c', '1', new Bishop(true, this.whiteBishopImage));
this.addPieceOnField('d', '1', new Queen(true, this.whiteQueen... |
8f57b297-0c69-4dda-8155-2d34f4ba5205 | 4 | public LifelineElement getLifelineElement(String id) {
for (Component component : components)
if (component.getIdProfile().equals(id))
return component;
for (Stakeholder stakeholder : stakeholders)
if (stakeholder.getIdProfile().equals(id))
return stakeholder;
return null;
} |
61d77fbc-effd-4f00-a966-82bd2d5b1efa | 0 | public Integer save(Task task) {
return (Integer) sessionFactory.getCurrentSession().save(task);
} |
a872accf-3c4b-4558-be44-cbba784e8341 | 3 | public void setRequestType(int type) {
switch (type) {
case REQUEST_TYPE_ANY:
RequestType = "Any";
break;
case REQUEST_TYPE_COMPANY:
RequestType = "Company";
break;
case REQUEST_TYPE_PERSON:
RequestType = "Person";
break;
}
} |
2144e7d2-499c-491b-bb7f-27f482aafd20 | 9 | @Override
public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
{
final MOB target=getTarget(mob,commands,givenTarget);
if(target==null)
return false;
if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
return false;
final boolean success=proficien... |
cdc82243-348d-4140-a8a6-39c604b56a9f | 0 | public static String byteArrayToHexString(byte[] bytes) {
BigInteger bi = new BigInteger(1, bytes);
return String.format("%0" + (bytes.length << 1) + "X", bi);
} |
6543bc2d-74d6-471f-8f20-f961b2bdec43 | 3 | public MyProperties(ImageBrowser imageBrowser, String propertiesFile, boolean create) {
this.imageBrowser = imageBrowser;
this.propertiesFile = propertiesFile;
properties = new Properties();
// if(create) {
// File f = new File(propertiesFile);
// if(!f.exists()) {
// try {
// f.createNewFile();
... |
85c98771-ed25-467b-bb83-79b05fe0e5f7 | 1 | protected DLLResource modifyUIFile(SkinPropertiesVO properties, UIFileTextVO uifile) throws IOException, InterruptedException {
assert (properties != null) && (uifile != null);
this.props = properties;
applyBranding();
applyBackground();
applyImages();
applyLayout(uifile... |
a116969a-c73c-4b95-b985-325dcdb96862 | 2 | public boolean valid() {
int tmp = current;
while (tmp > 0) {
int ttmp = tmp % 10;
if(ttmp == broken)
return false;
tmp = tmp / 10;
}
return true;
} |
605699f0-60c0-476f-8153-3e60eb6b9bda | 8 | private FulfillTrade canTradeFor(SpendType t) {
Map<Resource, Integer> res = neededResources(t);
if (res == null) return null;
FulfillTrade ret = null, tr;
int suited = 999999, st;
List<Resource> to, from;
int to_i, from_i, needed, net_gain;
l0: for (int id : _trades.keySet()) {
tr = _trades.get(id);
... |
2aa5abfc-b595-45f4-9d0c-9289bba64411 | 4 | @Test
public void testBFS() {
for (int i = 500; i < 10000; i += 500) {
Graph g = RandomGraph.quick(i);
System.out.print("|V| = " + g.getVertices().getSize() + " |E| = " + g.getEdges().getSize() + ": ");
double startTime;
double endTime;
double... |
a475b2fb-5b9c-4efb-aabf-9cab322f4630 | 5 | private void clearClosedConnections() {
new Thread() {
@Override
public void run() {
while(true) {
synchronized(connections) {
Iterator<ConnectionData> it = connections.iterator();
while(it.hasNext()) {
... |
fa36026e-f0b6-42c4-8fa1-bb236205171d | 2 | @Override
public void onEnable(){
instance = this;
TreasureManager thm = new TreasureManager();
try {
TreasureManager.getInstance().loadPossibleTreasure();
} catch (ClassNotFoundException | IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
Tre... |
cea75586-1efd-45af-8fda-13d22f15a1ba | 3 | public void update(float delta) {
if (collisionLayer == null) {
System.out.println("It's fucking null.");
}
float oldX = getX(), oldY = getY(), tileWidth = getLayer().getTileWidth(), tileHeight = getLayer().getTileHeight();
try {
tileWidth = collisionLayer.getTileWidth();
tileHeight = coll... |
d9135c16-fcce-467e-afe7-d21b19df6e2c | 9 | public static Integer parseFirstInt(String str) {
char[] divs = {' ', ':'};
StringBuilder intStr = new StringBuilder();
if (null != str) {
str = str.trim();
boolean match = false;
for (int i = 0; i < str.length(); i++) {
match = false;
char c = s... |
c7c62375-848a-4d36-86a6-04e82a3524a7 | 5 | public Map<String, Acronym> acronymsArrayToMap(Collection<Acronym> pairs){
Map<String, Acronym> out = new HashMap<String, Acronym>();
for (Acronym acronymPair : pairs) {
if(out.containsKey(acronymPair._shortForm)){
Acronym prevAcronym = out.get(acronymPair._shortForm);
if(acronymPair._probability != nul... |
c42b145e-7a17-4b30-81a6-817908e809b7 | 7 | public Usuario selectTodosEncarregado() throws SQLException {
Connection conexao = null;
PreparedStatement comando = null;
ResultSet resultado = null;
Usuario user = null;
try {
conexao = BancoDadosUtil.getConnection();
comando = conexao.prepareStatemen... |
350c5ade-1798-415f-a813-61014bf98edf | 0 | @Override
public void documentAdded(DocumentRepositoryEvent e) {} |
e8cc00f2-a919-403b-be32-42ef8e1a14c6 | 5 | static final void method1014(int i) {
anInt1660++;
for (Class348_Sub42_Sub6 class348_sub42_sub6
= (Class348_Sub42_Sub6) r_Sub2.aClass262_10492.getFirst(4);
class348_sub42_sub6 != null;
class348_sub42_sub6
= ((Class348_Sub42_Sub6)
r_Sub2.aClass262_10492.nextForward((byte) 55))) {
Class318_... |
c9ef302b-7973-44da-a8ee-44c1f1ec221f | 2 | public Polylinje[] generatePolylinjer()
{
int antalVPolylinjer = new Random().nextInt(10) + 1;
int antalNPolylinjer = new Random().nextInt(10) + 1;
Polylinje[] vektor = new Polylinje[antalVPolylinjer + antalNPolylinjer];
for(int i = 0; i < antalVPolylinjer; i++)
{
vektor[i] = new VPolylinje();
}
for... |
76819d52-714e-4670-ba72-b5940ce73144 | 5 | public void vlistPlugins(CommandSender sender, String[] args) {
if (args.length > 1) {
sender.sendMessage(pre + red + tooMany);
return;
}
StringBuilder list = new StringBuilder();
List<String> pluginList = new ArrayList<String>();
for (Plugin pl : Bukki... |
327ddf41-e860-4cd9-933d-5aa757a22a7c | 8 | @Override
public void run() {
inProcess = true;
while (true) {
Calendar stopTime = Calendar.getInstance();
long delay = stopTime.getTimeInMillis() - startTime.getTimeInMillis();
startTime = stopTime;
double delta = 0.2;
double deltaX, delt... |
f2bc69eb-9e97-4f5d-b034-f356ba291045 | 8 | @command
public void Null(CommandSender sender, String[] args) {
if (sender instanceof Player) {
if (sender.hasPermission("modreq.update")) {
if (plugin.getConfig().getBoolean("check-updates", true)) {
File Jar = new File(plugin.getDataFolder()
... |
977cdbcf-d7b0-4223-96fd-b03939c02ddc | 2 | public RoomRandomizer(final HashMap <String,Room> pListRoom)
{
if (seed == null)
this.aRandom = new Random();
else
this.aRandom = new Random(seed);
this.aTabRoom = new Room [pListRoom.size()];
int vI = 0;
for (String vS : pListRoom.keySet ())
{
this.... |
2c3b65db-b950-4a3a-b0bd-1415f7d165db | 1 | @Override
public int compareTo(Object o) {
Double particle = fitness;
Double other = (((ParticleFitness)o).getFitness());
int result = particle.compareTo(other);
if(result != 0){
return result;
}else{
Integer particleIndex = index;
Integer otherIndex = ((ParticleFitness)o).getIndex();
return part... |
2a7cf302-8681-4269-86e9-60089b00abea | 5 | void clearAtomsInView()
{
int eye_x = 0;
int eye_y = 0;
if(this.eye != null)
{
eye_x = eye.getX();
eye_y = eye.getY();
}
// Scan over all the atoms and see if they're outdated
for(int x=eye_x - view_range; x<=eye_x + view_range; x++)
{
for(int y=eye_y - view_range; y<=eye_y + view_range;... |
47042c50-9ae0-4d5d-8779-012b9bf6ead9 | 8 | private String [] parseCSV (String line) {
ArrayList <String> tempList= new ArrayList <> ();
StringBuilder temp = new StringBuilder ();
boolean stringFlag = false;
for (int i = 0; i < line.length (); i++) {
if (line.charAt(i) == '\"') {
if (stringFla... |
c448744c-b5c3-4bfc-903d-469534bb10ae | 3 | public boolean validate() {
if (!Util.inLobby())
return false;
if (dominionTower.getBoss() == null)
return true;
if (dominionTower.getBoss().resetProgress())
return false;
return true;
} |
fbd408a9-b75a-4892-8443-ced87d3aa7d1 | 7 | public void line(String[] words,int length, int L,List<String> list){
int n = words.length;
if(n==1){
String str = words[0];
for(int i=words[0].length(); i< L ;i++)
str += " ";
list.add(str);
return;
}
int sp = (L - length+... |
002afeef-32ff-4ca1-8260-5779697d69e8 | 6 | public 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://download.or... |
31389104-d2a0-4aeb-99b1-c44eca4a9885 | 6 | @Override
public DataTable generateDataTable (Query query, HttpServletRequest request) throws DataSourceException
{
DataTable dataTable = null;
try (final Reader reader = new FilterCsv (new BufferedReader (new InputStreamReader (new URL (this.urlYahoo).openStream()))))
{
TableRow row = new TableRow ();
... |
fb405de0-ca35-4fa2-a83d-27c8109d1f2e | 3 | public void stopPlaying() {
this.objectTimer.stop();
for(Component component: layeredPane.getComponents()){
if(component instanceof VideoPlayer){
VideoPlayer videoPlayer = (VideoPlayer) component;
videoPlayer.stopMedia();
}
}
clearSlide();
if(audioPlayer != null)
{
this.audioPlayer.stopMedi... |
2456498e-b76f-4630-876e-37b05c4ed3b8 | 2 | public VueEdition(String nom) {
super("Editer metadonnes");
setLayout(new GridLayout(5, 2, 5, 5));
String titre = null, auteur = null;
int note = -1;
this.nom = nom;
ResultSet md = BDApplication.listeMetaDonneesParTitre(nom);
try {
if (md.next()) {
titre = md.getString("nom");
auteur = md.getS... |
8faf5a4e-9817-4b8e-9078-3fab0df19724 | 9 | public Point checkSnorlax(Point point)
{
//Snorlax Test
for(int i=179; i<183; i++)
{
//Above Player
if(direction==90&¤tArea[location.x][location.y-1]==i)
{
point.x=location.x;
point.y=location.y-1;
return point;
}
//Below Player
else if(direction==270&¤tArea[location.x][... |
04dc4592-8739-4304-b722-780f72f3d872 | 5 | public void decode(int[] received, int twoS) throws ReedSolomonException {
GenericGFPoly poly = new GenericGFPoly(field, received);
int[] syndromeCoefficients = new int[twoS];
boolean noError = true;
for (int i = 0; i < twoS; i++) {
int eval = poly.evaluateAt(field.exp(i + field.getGeneratorBase()... |
8a2a5bf4-ccc9-4743-be06-0d3ef2c8a3ca | 5 | private void handleSPHumanClick(MouseEvent e) {
xIndex = e.getX() / 100;
yIndex = 0;
//find lowest empty circle
while (gameGrid[xIndex][yIndex + 1].getState() == 0) {
yIndex++;
if (yIndex == Board.numRows - 1) {
break;
... |
a37722b7-705e-46cd-93ba-ff40e11246f7 | 5 | public ShellLink setTarget(String target) {
target = resolveEnvVariables(target);
Path tar = Paths.get(target).toAbsolutePath();
target = tar.toString();
if (target.startsWith("\\\\")) {
int p1 = target.indexOf('\\', 2);
int p2 = target.indexOf('\\', p1+1);
LinkInfo inf = createLinkInfo();
... |
3fb5a6ca-885a-4e1a-bd8e-fa467dc1b987 | 1 | public static Vector enumerationToVector(Enumeration myenum) {
Vector v = new Vector();
while (myenum.hasMoreElements()) {
v.add(myenum.nextElement());
}
return v;
} |
2e884a3b-2f7e-4f5e-9377-5f7ddd2d83d7 | 9 | private boolean addRandomTile(int[][] board) {
int emptyCnt = 0;
for (int i = 0; i < board.length; i++) {
for (int j = 0; j < board[i].length; j++) {
if (board[i][j] == 0) {
emptyCnt++;
}
}
}
if (emptyCnt == 0) {... |
adbf4241-fe81-44b3-b3c7-60874f087c1e | 0 | public void setURL( String URL ) {
this.url = URL;
} |
d6598eab-1ffa-484c-8715-4a42af8e1433 | 9 | public static void main(String[] args){
int seatPreference = 0;
int passengers;
int cabinChoice;
boolean foundSeat = false;
FirstClass frontCabin = new FirstClass(4); //Number of seats must be in multiples of 4 (Cannot have half a row!).
Economy backCabin = new Economy(18); //Number of seats ... |
b29beaf6-a138-412d-ad9d-1ade36f4b82c | 2 | public MP3Info(File song)
throws MP3Exception {
if(song == null)
throw new MP3Exception("The song is null");
try {
this.getMP3Tag(song);
} catch (UnsupportedAudioException e) {
throw new MP3Exception("UnsupportedAudioFileException "+e.getMessage(), e);
}
} |
b39cf112-dea6-4c18-b406-0f86a1864e69 | 5 | private void setLevels() {
tilesToDrop.clear();
for (int deletedRow : deletedRows) {
for (int row = deletedRow-1; row >= 0; row --) {
for (int col = 0; col < Game.WIDTH; col++){
Tile tile = tiles[col][row];
if(tile.isNotEmpty()){
if(tile.level == 0)
ti... |
0539fdca-50da-4241-801d-c5d54fa2e4fd | 0 | public Queue() {
first = null;
last = null;
N = 0;
} |
2de8d2a9-a30b-469f-a47e-b21191edab4d | 8 | public void schiet(Schutter schutter, double kracht, double hoek) throws AngryTanksException { //maakt een Schot aan, en kijkt na of dit botst met de obstructie of met de tegenstander.
if(!isSpeelveldKlaar()) throw new AngryTanksException("Speelveld is niet klaar om te spelen.");
if(schutter != schutter... |
1218c8be-f4d2-4e14-b124-d10293317c55 | 7 | private final void listOrExtract(boolean extract) throws RuntimeException {
String filename = arguments[0];
TaggedData object = null;
try {
object = loadRootObject(filename);
} catch (ImageError e) {
System.err.println("redis: " + e.getMessage());
Syst... |
f55d2a5b-f73a-43db-a8ec-ae3daf80c2a7 | 0 | @Test
public void getScoreTest2(){
assertEquals(city_graph.getScore(Owner.Cathargo), 2);
} |
8b1312b5-3be9-493a-bd3a-c07904228d3c | 4 | private Node normaliseLeftResidualPath() throws MVDException
{
Node arcFrom = arc.from;
arc.from.removeOutgoing( arc );
if ( leftSubArc != null )
{
arcFrom.addOutgoing( leftSubArc );
arcFrom = new Node();
arcFrom.addIncoming( leftSubArc );
}
if ( leftSubGraph == null )
{
if ( arcFrom != graph... |
0c382a42-88e7-4692-989d-0944801edcfa | 6 | public void update() {
camera.update();
Iterator<Block> it = blocks.iterator();
while(it.hasNext()) {
Block b = it.next();
if(b instanceof WeaponBlock) {
WeaponBlock wb = (WeaponBlock) b;
wb.update(blocks, enemies);
}
else {
b.update(blocks);
}
}
Iterator<Enemy> itEnemies = e... |
82812eba-4251-45f2-9125-ab708e4a653c | 4 | boolean updateSelection(World world, Viewport port, UIGroup infoPanel) {
//
// If a UI element is selected, don't pick anything else-
if (UI.selected() != null) {
pickTile = null ;
pickMobile = null ;
pickFixture = null ;
hovered = null ;
return false ;
}
//
// Ou... |
e023bd72-9bfa-41fd-a1dd-d606d64bdffd | 3 | public boolean validateAFDExpression(String expression) throws Exception{
errorMessage = "";
String currentState = content.getInitial();
for(int i=0; i<expression.length();i++){
String currentSymbol = "" + expression.charAt(i);
Transition tran = content.getTransitionBySta... |
87d87877-9d84-4da7-ac13-1ae9afd93153 | 8 | @Override
public void applyCurrentToApplication() {
Preferences prefs = Outliner.prefs;
PreferenceInt pUndoQueueSize = (PreferenceInt) prefs.getPreference(Preferences.UNDO_QUEUE_SIZE);
PreferenceBoolean pShowLineNumbers = (PreferenceBoolean) prefs.getPreference(Preferences.SHOW_LINE_NUMBERS);
PreferenceBool... |
8756f52a-c8fd-4f54-9626-16a4778d3362 | 9 | public static int getYerY(int lvl){
if(lvl == 1)
return 70;
if(lvl == 2)
return 110;
if(lvl == 3)
return 110;
if(lvl == 4)
return 90;
if(lvl == 5)
return 25;
if(lvl == 6)
return 100;
i... |
c0611115-8a25-4267-9603-f627bc453dc8 | 4 | public Node getPast() {
if ( this.getRight() == null ) {
if (this.getLeft() == null){
return null;
} else {
return this.getLeft();
}
} else if ( this.getLeft() == null ) {
if (this.getRight() == null){
return... |
4a069f2b-d973-4f80-b812-bb078ebc8f3a | 1 | public static CollectionPersonApplicant getInstanceCollectionPersonApplicant() {
if (collectionPersonApplicant == null) {
collectionPersonApplicant = new CollectionPersonApplicant();
}
return collectionPersonApplicant;
} |
4bcde241-a1bf-4144-be6f-a0586c6ed62f | 1 | public String getStatusFrequency() {
Map<String, Integer> map = analytic.getStatusFrequency();
StringBuilder sb = new StringBuilder();
List<Entry<String, Integer>> entries = new ArrayList<Entry<String, Integer>>(map.entrySet());
Collections.sort(entries, new Comparator<Entry<String, Integer>>() {
publi... |
87be2c50-a058-4a66-9868-554fdd91e7c2 | 3 | void generateSampleData() {
Random rnd = new Random(5283314247687391911L);
data = new Document[100000];
for (int i=0;i<documentCount;i++) {
data[i] = new Document();
data[i].put("shortOne",rnd.nextInt());
data[i].put("intOne",i);
data[i].put("longO... |
5c709164-4bf5-42da-980e-d85719d673d8 | 1 | @Override
public boolean isEmpty() {
return w==0 && h==0;
} |
cbf5885c-10be-47f6-9b4d-a433aae4a7b2 | 8 | public StateFormula getEquivalentFormulaWithoutNegations() {
StateFormula condNoNegations = new StateFormula();
StateFormula notNegatedFormula = this;
if (this.isNegated) {
StateLiteralClause newClause = new StateLiteralClause();
for (StateLiteralClause clause : clauses) {
if (clause.getNumberOfL... |
f436614f-220a-46c7-9c34-774d4984a7db | 0 | @Basic
@Column(name = "box_date")
public Date getBoxDate() {
return boxDate;
} |
25027031-fd0d-42ce-a1a0-884d45da684a | 7 | private static SuperRegion getSmallestSuperRegionWithKnownOpponentSpots(BotState state,
List<SuperRegion> possibleSuperRegionsLastTurn) {
SuperRegion out = null;
int smallestarmiesReward = 1000;
for (SuperRegion superRegion : state.getVisibleMap().getSuperRegions()) {
if (possibleSuperRegionsLastTurn.contai... |
1ed19b64-7127-4d94-9646-a520328ce48a | 4 | protected boolean getListFromOtherRegional(List regionalList, int eventTag)
{
// check for input first
if (regionalList == null || regionalList.size() == 0) {
return false;
}
// a loop to ask each regional GIS for its resource IDs
Iterator it = regionalList.itera... |
1a31356d-296d-4645-a83b-58c29570a8be | 1 | private void openConnection()
{
try
{
con = DriverManager.getConnection(url);
}
catch (Exception e)
{
System.out.println("Error creating connection: " + e.toString());
}
} |
92affb81-7a9c-43c0-b395-e66f6ea14b75 | 4 | public void click(int x, int y) {
if (amplitude.contains(x, y)) {
amplitude.click();
} else if (period.contains(x, y)) {
period.click();
} else if (amplitude2.contains(x, y)) {
amplitude2.click();
} else if (period2.contains(x, y)) {
period... |
99bc77f9-2618-4f2f-a037-b197b6df47eb | 5 | private void updateTabla(){
//** pido los datos a la tabla
Object[][] vcta = this.getDatos();
//** se colocan los datos en la tabla
DefaultTableModel datos = new DefaultTableModel();
tabla.setModel(datos); ... |
9a849a4e-830d-4f7c-95da-2aa3ae07e268 | 5 | @Override
public WeblabResult filter(WeblabResult weblabs) {
List<TreatmentAllocation> outWeblabs = new ArrayList<TreatmentAllocation>();
List<TreatmentAllocation> inWeblabs = weblabs.getList();
for (TreatmentAllocation t : inWeblabs) {
for (RangeWeightedTreatmentRequest request : requests) {
if (t.weigh... |
ea0046d5-c99d-478f-b351-e6605a900cbc | 9 | public static void main(String[] args) {
while (true) {
//output header
System.out.println("NATIONAL PARCEL SERVICES\nPACKAGE DATA\n\nLENGTH WIDTH DEPTH WEIGHT");
//store dimensions and weight
double length = in.nextDouble();
double width = in.nextDouble();
double depth = in.nextDouble();
... |
51925fcf-6099-49ff-91b7-a4624e886873 | 7 | private void unzip(String file) {
final File fSourceZip = new File(file);
try {
final String zipPath = file.substring(0, file.length() - 4);
ZipFile zipFile = new ZipFile(fSourceZip);
Enumeration<? extends ZipEntry> e = zipFile.entries();
while (e.hasMoreE... |
7557a840-fe47-4bd5-a0a1-d71ba3f1040c | 7 | @Override
public CodeLineList generateCode(Code relatedClass, Method relatedMethod,
boolean forCodeGeneration) {
if (this.getNumberOfChildren() == 1) {
return this.getChild(0).generateCode(relatedClass, relatedMethod,
true);
}
passNodeFieldsToTheParentNode();
Token token = this.firstToken;
switch ... |
a6506c83-aa12-4ae2-837c-4c8ded6dc032 | 8 | private int getColumnNear(Connection connection, int r, int n, int x) {
int min = Math.min(n, x), max = Math.max(n, x);
if (min > r) {
max = min;
min = r - (min - r);
}
if (max < r) {
min = max;
max = r + (r - max);
}
int proximity = 0;
int direction = -1;
if (r % 2 == 1)
r--;
Integer i... |
22da73ae-550d-4d04-90aa-8174b36e3ef7 | 3 | private void checkEnvironment(){
List<Character> allies = Loader.config.getAllies(), enemies = Loader.config.getEnemies(),
bosses = Loader.config.getBosses();
DefaultListModel model = new DefaultListModel();
for (Character ch : allies) {
this.allies.put(ch.getName(), ... |
746687d7-3816-4d8d-8611-7de6f6fe199c | 3 | public boolean canDiscardCards(int playerIndex, ResourceHand resourceHand) {
//Checks that the game status is "Discarding", that the player has over 7 Resource cards, and that the
//player has the cards chosen to discard.
if (serverModel.getTurnTracker().getStatus().equals("Discarding") &&
serverModel.getP... |
19de2f5f-14b3-42fb-a782-6ee37d0e2fe7 | 1 | public String toString() {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < frequencies.length; i++)
sb.append(String.format("%d\t%d%n", i, frequencies[i]));
return sb.toString();
} |
2f18d764-422d-4a68-a6b8-37c96e1b55c1 | 4 | public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
map = new HashMap<String, Integer>();
list = new ArrayList<String>();
pos = 0;
d: do {
line = br.readLine();
... |
d5fbf4eb-ba58-405a-9e64-7ab7aa994900 | 7 | private boolean followFootprints(RPSAgent agent) {
List<Footprint> footprints = agent.getServer().getFootprints();
List<Peer> servers = agent.getServer().getNeighbours();
Set<Peer> slaves = agent.getSlaves();
if(footprints.size() > 0 && servers.size() > 0) {
long currentTime ... |
b2fe2589-f9f9-4eb3-b181-3ff1b8819ae7 | 4 | public Object getValueAt(int row, int col) {
if (data == null) {
return null;
}
if (col >= columnNames.length || col < 0 || row < 0) {
return null;
}
return data[row][col];
} |
4d9007f2-2c46-472d-945c-416da3377b9b | 9 | public void loadLevel(String name) {
//reset variables
win = false;
lives = 3;
score = 0;
ball = new Ball[1];
powerUp = "None";
activatePowerUp();
//load level depending on which was chosen (I did not have time to implement a better way to do this t_t)
if (name.equals("empty")) {
brick = new ... |
b61b4cf4-2728-4541-a2d5-f6eee8cf3759 | 1 | private final void writeAttributes(final Attributes atts)
throws IOException
{
StringBuffer sb = new StringBuffer();
int len = atts.getLength();
for (int i = 0; i < len; i++) {
sb.append(' ')
.append(atts.getLocalName(i)... |
0c3a7c3d-f641-4233-ab96-2abce68354c3 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Point other = (Point) obj;
if (Math.abs(this.x - other.x) > EPS || Math.abs(this.y - ... |
7a642738-c30b-4158-a1ce-285e8949a629 | 5 | @Test
public void resolve() {
Map<String, Integer> map = new TreeMap<>();
try (InputStream input = new FileInputStream("data" + File.separator
+ "p022.txt")) {
List<String> lines = IOUtils.readLines(input);
for (String line : lines) {
String[] names = line.replace("\"", "").split(",");
for (Strin... |
3f393651-7027-4180-9399-e970926789d2 | 8 | public boolean batchExecStringQuery(String command, Vector<String[]> values) throws SQLException
{
boolean value = false;
Connection connection = null;
PreparedStatement stmt = null;
try
{
Class.forName(driver);
connection = DriverManager.getConnection(url, username, passwd);
connection.setAutoComm... |
f38425b2-5f56-4035-8de8-6da4f8de8730 | 2 | public int fillIntArray(int[] arr, int loc) {
if (hasLeftChild()) {
loc = getLeftChild().fillIntArray(arr, loc);
}
arr[loc++] = getKey();
if (hasRightChild()) {
loc = getRightChild().fillIntArray(arr, loc);
}
retu... |
5eac9049-0c6d-4519-b730-e1adafdd6264 | 5 | private final int[][] get8BitSampleArray(byte[] eightBitByteArray) {
int chan = this.getNumberOfChannels();
int len = 0;
if(chan == 1) {
len = eightBitByteArray.length;
} else {
len = eightBitByteArray.length / 2;
}
int[][] toReturn = new int[chan][len];
int index = 0;
// Loop through the ... |
de544989-b117-405a-8152-05af471c04a9 | 8 | public static float makeTokenListStartAt(Token tokenList, int pos,
TabExpander e,
final RSyntaxTextArea textArea,
float x0) {
Token t = tokenList;
// Loop through the token list until you find the one that contains
// pos. Remember the cumulative width of all of these tokens.
while... |
fe0edf0e-f3c7-420b-aefd-357ca7662b7d | 1 | @Override
Integer redactEntity(Criteria criteria, AbstractDao dao) throws DaoException {
Integer idCountry = (Integer) criteria.getParam(DAO_ID_COUNTRY);
if (idCountry != null) {
return updateCountry(criteria, dao);
} else {
return createCountry(criteria, dao);
... |
672fd2e1-c69c-464b-9be4-0bfd03b307b4 | 2 | static public HashMap<String, String[]> loadCoauthor(){
try{
@SuppressWarnings("resource")
BufferedReader csvFile = new BufferedReader(new FileReader("parserResult/parser_result2.csv"));
String[] dataArray;
String target;
while((target = csvFile.readLine())!= null){
dataArray = target.split(",");
... |
c62ee35b-e846-4b0a-829c-4ef422636db3 | 9 | @Override
public void tick(final InputHandler inputHandler, final long elapsedTime) {
if (currentBitmap == null) {
Bitmaps bitmaps = getBitmaps();
String globalId = getGlobalBitmapId(BMP_BOUNCING_BALL);
currentBitmap = bitmaps.getBitmap(globalId);
}
if (inputHandler != null && inputHandler.isPressed(Ke... |
fd7ead2c-d3a0-4b77-9acf-bfe154918d29 | 2 | public boolean equals(final Object obj) {
if (obj instanceof ExprComparator) {
final Expr other = ((ExprComparator) obj).expr;
return expr.equalsExpr(other)
&& expr.type.simple().equals(other.type.simple());
}
return false;
} |
0f55a078-291e-47c8-97fd-d421c22af2c0 | 0 | public static void selectAll(Node currentNode, JoeTree tree, OutlineLayoutManager layout) {
// select all siblings
Node parent = currentNode.getParent();
tree.clearSelection();
tree.addNodeToSelection(parent.getChild(0));
tree.selectRangeFromMostRecentNodeTouched(parent.getChild(parent.numOfChildren() - 1)... |
c8d58b1e-8161-48ed-a5f8-2ea14e7f0c47 | 0 | public Player getPlayer(){
return player;
} |
8ad113b8-7ac4-4e55-b54f-6f1d52db3b8a | 2 | private static void checkPool() throws DaoConnectException {
if (pool == null) {
LOCK.lock();
try {
if (pool == null) {
pool = new MysqlConnectionPool();
}
} finally {
LOCK.unlock();
}
}
... |
b9e81121-b007-44e3-bd6e-1fefa9b0e310 | 6 | public UICraftingTable(EntityPlayer p, int x, int y)
{
super(p, 47);
this.posX = x;
this.posY = y;
for(int i = 0 ; i < 10 ; i++)
{
this.slots[i] = new UIInventorySlot(BlockyMain.width / 2 - 16 - (32 * 4) - 12 + i * 32 + i + 3, BlockyMain.height / 2 - 32-5... |
72426723-43fe-4b1f-83db-4f06de81d66f | 1 | public static void main(String[] args) throws IOException {
Reader in = new FileReader("D:\\Java SE\\src\\test\\input.txt");
String[] array = loadAndSort(in);
for (String s : array) {
System.out.println(s);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.