method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ac4c38c1-43c0-4fe4-87e4-4a62bc477af2 | 4 | private void showTemporalProjects(String queryString) {
PanelHelper.cleanPanel(spelprojectHolderPanel);
ArrayList<String> tempal = new ArrayList<>();
ArrayList<Spelprojekt> al = new ArrayList<>();
Date now = new Date(); //fetch what the date is right now
String nowdate = new java... |
030172b6-7ab4-4366-b98f-c830cb1fdb16 | 1 | public int getRXAxisValue() {
if (rxaxis == -1) {
return 127;
}
return getAxisValue(rxaxis);
} |
6a0ee8e0-0752-420f-9a36-b520e23b115a | 8 | public String extractLastName(String fullName) {
String lastName="";
String msg="";
//String temp="";
//String pattern = "[a-zA-Z]"+ " " + "[a-zA-Z]";
boolean nameRight=false;
int j=0;
do{
if(fullName==null||fullName.length()==0){
... |
2ee680fa-575d-4f66-8f39-bc45dc5cfce6 | 5 | public void run () {
//Guarda tiempo actual del sistema
lonTiempoActual = System.currentTimeMillis();
// se realiza el ciclo del juego en este caso nunca termina
while (true) {
/* mientras dure el juego, se actualizan posiciones de jugadores
se checa s... |
c5425c5a-b942-4c0d-977c-662fc7e21dd7 | 8 | Object lock(Ref ref){
//can't upgrade readLock, so release it
releaseIfEnsured(ref);
boolean unlocked = true;
try
{
tryWriteLock(ref);
unlocked = false;
if(ref.tvals != null && ref.tvals.point > readPoint)
throw retryex;
Info refinfo = ref.tinfo;
//write lock conflict
if(refinfo != null && refin... |
8a02a429-a7d6-4e13-8386-868b94687332 | 5 | public static void main(String args[]) {
System.out.println("Number\tPossible Combinations");
for (int x = 1; x <= 18; x++) {
int count = 0;
for (int k = 1; k <= 6; k++) {
for (int i = 1; i <= 6; i++) {
for (int j = 1; j <= 6; j++) {
if (k + i + j == x)
count++;
}
}
}
Syst... |
abe87099-1342-43b1-a82d-30494cd948cd | 3 | public int verifyNumberOfPlayersOnBoard(){
int players = 0;
Tile currentJTile = topTile;
for(int j = 0; j < dimension; j++){
Tile currentKTile = currentJTile;
for(int k = 0; k < dimension; k++){
if(currentKTile.playerOnTile != null){
players++;
}
currentKTile = currentKTile.rightDown;
}
... |
f61604fe-8de3-4052-92c0-4b763bb40527 | 8 | public static void main(String args[]) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb=new StringBuilder();
for (String ln;(ln=in.readLine())!=null;) {
StringTokenizer st=new StringTokenizer(ln);
int N=parseInt(st.nextToken()),M=parseInt(st.nextT... |
6b76c69c-1af7-466a-ae9e-c765d8ecfa98 | 2 | public Category getCategory(String naam){
for (Category cat : categories) {
if ( cat.naam.equals(naam) ){
return cat;
}
}
Category returnCat = new Category(naam);
categories.add(returnCat);
return returnCat;
} |
8f98f9fe-2082-4383-919d-743b0e6e9526 | 3 | private Expr expr() {
Expr res, nextTerm; res = term();
while (theTokenizer.ttype == '+' || theTokenizer.ttype == '-') {
char op = (char) theTokenizer.ttype;
theTokenizer.next();
nextTerm = term();
if (op == '+') {
res = new Add(res,nextTerm);
} else {
res = new Sub(res,nextTerm);
}
}
... |
2d54a84d-b147-45c3-aec6-c1ed807aacc1 | 5 | private String bidForAuction() {
if (user.isOnline()) {
int auctionID = 0;
double amount = 0.0;
if (stringParts.length < 3) {
return "Error: Please enter the bid- Command like this: " +
"!bid <auction-id> <amount>";
}
try {
auctionID = Integer.parseInt(stringParts[1]);
amount = Do... |
ac17acd3-b45e-4750-a662-011f7e3537f2 | 9 | public static void main(String[] args) throws Throwable {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
sb = new StringBuilder( );
int N = Integer.parseInt(in.readLine());
in.readLine();
for (int i = 0; i < N; i++) {
score = new TreeMap<Integer,int[]>();
solved = new TreeMap<... |
e7860380-db25-4daf-9824-645926b77f9b | 3 | public void main(String sourceDir, String destDir)
{
try {
String currentdir = plugin.minecraft_folder;
// File (or directory) to be moved
File source = new File(currentdir + "/" + sourceDir);
// Destination directory
File dest = new File(currentdir + "/" + destDir);
if (source.exists()){
... |
942a04db-8287-4721-bed4-ea9d38a55ed8 | 5 | public static double maxProfitJor(double[] prices) {
double percentOriginal = 1;
double lowestCurrent = prices[0];
double highestCurrent = prices[0];
for(int i=0; i < prices.length; i++) {
if (prices[i] > highestCurrent && i < prices.length - 1) {
highestCurre... |
6dd880b5-5d3b-4643-a0cc-9f8ec417edc5 | 4 | public Population tournamentSelection(Population pop, int outSize, int tourSize){
Individual [] subset = new Individual[outSize];
int popSize = pop.size();
int [] indexes = new int[tourSize];
Set<Integer> indexesB = new HashSet<Integer>();
int outCount = 0;
while (outCount<outSi... |
656c3682-1dbb-4266-b9fd-a5c481cd19e2 | 1 | public synchronized TrackedTorrent announce(Torrent newTorrent) {
TrackedTorrent torrent = this.torrents.get(newTorrent.getHexInfoHash());
if (torrent != null) {
logger.warn("Tracker already announced torrent for '" +
torrent.getName() + "' with hash " +
torrent.getHexInfoHash() + ".");
return torr... |
7bcd84e4-527e-47e2-968d-56b47ddfe6e4 | 7 | private boolean addModeToSet(final String modeName, Map<String, Set<String>> modeSets, String[] modeToAdd) {
if (null == modeName || "".equals(modeName.trim())) return false;
boolean isModified = false;
String o = modeName.trim().toUpperCase();
Set<String> modeSet = modeSets.get(o);
if (null == modeSet) {
... |
c2d493c4-d1d9-4d89-9e14-16feb7638821 | 3 | public static int findNumDays(String fileName)
{
int lineNumber = 0;
String line;
try {
BufferedReader br = new BufferedReader( new FileReader(fileName));
while( (line = br.readLine()) != null)
{
lineNumber++; ... |
1695ea60-92d1-47d9-bf08-cffe9872cdee | 4 | private void updateAlt() {
mAltCount = mCount;
mAltModifier = mModifier;
if (EXTRA_DICE_FROM_MODIFIERS) {
int average = (mSides + 1) / 2;
if ((mSides & 1) == 1) {
// Odd number of sides, so average is a whole number
mAltCount += mAltModifier / average;
mAltModifier %= average;
} else {
//... |
b24fc35e-40c7-4439-aaa4-3def27a854fe | 0 | @Override
public String toString()
{
return "&markers=color:blue%7Clabel:"+Integer.toString(id)+"%7C"+Double.toString(latitude)+","+Double.toString(longtitude);
} |
558e5a5c-9cb1-4eb2-947b-ed0694ea898a | 1 | public Color getTopDividerColor() {
return mTopDividerColor == null ? mOwner.getDividerColor() : mTopDividerColor;
} |
1f6f0b0c-e243-47db-9c8e-8488754be0e0 | 2 | public static void main(String[] args) {
/* program to print the pattern
55555
4444
333
22
1
*/
for (int i=5;i>=0;i--)
{
for (int j=i;j>=0;j--)
System.out.print(i);
System.out.println("");
}} |
c2f77bc1-ddce-4060-bd67-901ce4363d57 | 1 | public void repaintView() {
repaint();
if (mHeaderPanel != null) {
mHeaderPanel.repaint();
}
} |
47a15d3d-dccd-4a78-8d86-b45748f8f8cb | 0 | @Override
public List<String> getGroups() {
return (LinkedList<String>) groups.clone();
} |
93fbf39b-d328-4771-a0d7-af4d55568330 | 0 | private void anothing()
{
System.out.println("功能B");
} |
b2812339-3422-41d5-b4a0-6dc70eb47f8c | 2 | private synchronized void schedule() {
if (!mPending && isDisplayable()) {
mPending = true;
Tasks.scheduleOnUIThread(this, 1, TimeUnit.SECONDS, this);
}
} |
1b5ffd8e-fb60-4bbb-97c1-3afbf3992489 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
452f91e9-32c8-4a6f-bf37-effcb508103d | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking,tickID))
return false;
if(affected==null)
return false;
if(affected instanceof Room)
{
final Room R=(Room)affected;
if(isBlightable(R.myResource()))
R.setResource(RawMaterial.RESOURCE_SAND);
for(int i=0;i<R... |
91936642-c1b9-4e39-8961-e683505d79b2 | 8 | public void createCoupon(String cou_name,String cou_file, int quantity){
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
String sql = "";
try{
conn = getConnection();
sql = "insert into coupon(cou_num,cou_name,cou_usage,cou_date.cou_file) values" +
"(cou_num_seq.nextval... |
4760fe10-2d1c-406f-9446-d06d4354871b | 1 | private void expandArrayCapacityBy(int number) {
E[] temparr = (E[]) new Object[array.length + number];
System.arraycopy(array, 0, temparr, 0, (number > 0) ? array.length
: array.length + number);
array = temparr;
} |
9e5acf73-a0d3-49f4-b9f7-4c58037f0402 | 2 | private boolean getDataBlock(int leafItemIndex) {
// check for valid data block
if (leafItemIndex >= leafHitList.size())
return false;
// Perform a block read for indexed leaf item
leafHitItem = leafHitList.get(leafItemIndex);
// get the chromosome names associated... |
bf6d17e4-f2c0-42a3-814a-71c2deb26ffc | 0 | public int getBumoncode() {
return this.bumoncode;
} |
cdad0109-eb54-4cc1-8c6b-69fb2e9f7110 | 7 | public void closeSocket()
{
try
{
if
(
this.isaMc != null
&& this.ms != null
&& ! this.ms.isClosed()
)
this.ms.leaveGroup(isaMc, EzimNetwork.localNI);
}
catch(Exception e)
{
EzimLogger.getInstance().severe(e.getMessage(), e);
}
try
{
if (this.ms != null && ! this.ms.isCl... |
b62db9b2-60d3-4d71-9a59-751c6914198d | 3 | @Override
public void emitCode(GluonOutput code) {
factor.emitCode(code);
for (int i=0; i<factors.size(); i++) {
code.code("PUSH EAX");
factors.get(i).emitCode(code);
switch (ops.get(i)) {
case MULTIPLY:
code.code("POP EBX");
code.code("IMUL EAX,EBX");
break;
case DIVIDE:
code.... |
c85a3cad-97f1-476a-b90f-0d9391fb652c | 4 | public static int Cardinality(Object obj, Collection coll){
if(coll == null){
throw new NullPointerException();
}
if(obj == null){
throw new NullPointerException();
}
for(Object o : coll){
if(o.equals(obj)){
total++;
}
}
return total;
} |
37ad8ad4-4fb5-46ea-9fd3-aaeb3a2fb28d | 7 | public void removeCleanup(int start, int end){
// проверяет не нужно ли удалить схлопнувшиеся сегменты
Set<ASection> s = aDataMap.keySet();
Iterator<ASection> it = s.iterator ();
boolean foundCollapsed = false;
Vector <ASection> toRemove = new Vector <ASection>();
while(it.hasNext()){
ASection sect = it.next(... |
06f88962-25b7-4b57-8707-720ba1571b10 | 2 | private void ensureStructure() {
try (Statement statement = openStatement()) {
ResultSet rs = statement.executeQuery("SELECT time FROM scores");
} catch (SQLException e) {
try {
Statement s = openStatement();
s.executeUpdate("CREATE TABLE scores(" +
"time INT)");
} catch (SQLExcep... |
437539f3-29ab-4db6-a319-d53f7148549c | 8 | void sendMessageToSocket (Message msg, DataOutputStream dos) throws IOException
{
int len = msg.data != null ? msg.data.length : 0;
if (isControlOpcode (msg.opcode) && len > 125)
throw new IOException ("payload for control packet too large");
if (msg.opcode <= 0 || msg.opcode > 0xf)
throw new IOExceptio... |
1fbcb897-cb77-4c1c-b599-fb1fe0157859 | 6 | @EventHandler
public void WitchNausea(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.getWitchConfig().getDouble("Witch.Nausea.Dodg... |
22aabb42-8883-4f4a-977e-cfddea96b26b | 6 | private void moveMouse(final Gamepad gamepad, final double delta) {
final int MAX_SPEED = 1800;
Point mouse = MouseInfo.getPointerInfo().getLocation();
float x = gamepad.getStickRight().getValueX();
float y = gamepad.getStickRight().getValueY();
if (Math.abs(x) > 0.25) {
moveX += (delta * x * x * x * x ... |
6f28512f-0ca0-4ac8-8ed6-af37fa5381f9 | 0 | public UserOperator stop() {
thisTimer.cancel();
run = false;
return this;
} |
2aa7f3a7-937f-463c-b4ee-198ecc7027eb | 1 | final public void Class_tail() throws ParseException {
/*@bgen(jjtree) Class_tail */
SimpleNode jjtn000 = new SimpleNode(JJTCLASS_TAIL);
boolean jjtc000 = true;
jjtree.openNodeScope(jjtn000);
jjtn000.jjtSetFirstToken(getToken(1));
try {
jj_consume_token(END);
jj_consume_token(... |
eeff8c81-1be0-4d24-9db1-8680fcb0470d | 2 | private void isEqualToBoolean(final Object param, final Object value) {
if (value instanceof Boolean) {
if (!((Boolean) value).equals((Boolean) param)) {
throw new IllegalStateException("Booleans are not equal.");
}
} else {
throw new IllegalArgumentException();
}
} |
10a869f0-50a0-4e71-b933-d358ef3d5e09 | 0 | public String getstatetext(){
return state;
} |
60785929-8e0b-4064-9766-f268ac08fc85 | 1 | public static boolean isNullOrEmpty(String value) {
return value == null || value.length() == 0;
} |
eb87eb03-f0ad-4977-9d8b-60ce2d13cc12 | 1 | @Test
public void testParseInvalidPredicateName() throws Exception {
Parser parser = new Parser();
try {
parser.parsePredicate("father*of(P, C)");
fail("This predicate contains invalid characters in the name.");
} catch (ParseException ex) {
// Expected ex... |
389420e9-06e5-44ef-b2eb-368a17a0b952 | 3 | private void waitForThread() {
if ((this.thread != null) && this.thread.isAlive()) {
try {
this.thread.join();
} catch (final InterruptedException e) {
plugin.getLogger().log(Level.SEVERE, null, e);
}
}
} |
48b69b35-715e-4cfc-b8c8-0b5972d1ad86 | 6 | private void dbCheck(String dir){ //checks to see if the db has been created
File isdb = new File(dir +"\\myDB");
if (isdb.exists()){
if (DBRead.DBIntegrityCheck(countries)){
JOptionPane.showMessageDialog(null,"The Database appears to be damaged, please wait create a new one.",
... |
ce1a402c-18cc-4911-8e3a-a6afad3bda61 | 1 | @Test
public void deletingFromEmptyListDoesntAffectSize() {
a.delete(v);
assertEquals(0, a.getSize());
for (int i = 0; i < 10; i++) {
a.delete(v);
}
assertEquals(0, a.getSize());
} |
a4a2049e-dc87-450b-a0dc-a5fc64ede40d | 1 | private static List<Appointment> findWeeklyByDay(long uid, long day)
throws SQLException {
List<Appointment> aAppt = new ArrayList<Appointment>();
// select * from Appointment where frequency = $WEEKLY
// and startTime <= $(day + DateUtil.DAY_LENGTH)
// and lastDay >= $day
// and freqHelper = $freqHelper
... |
da1ee7c2-1988-4ce7-8786-9b9a11268c97 | 5 | public void unregisterListeners( Plugin plugin )
{
for( Class< ? extends Event > eventClass : executors.keySet())
{
List< EventExecutor > keep = new ArrayList< EventExecutor >();
for( EventExecutor e : executors.get( eventClass ) )
{
if( e.getPlugin().getClass() == plugin.getClass() )
{
c... |
40e127bb-d117-4555-8453-7d44f9edf83e | 7 | public static boolean marshalSalesResponse(com.adammargherio.xml.schemas.salesorder.Message m, boolean save) {
com.adammargherio.xml.schemas.standardresponse.Message response = new com.adammargherio.xml.schemas.standardresponse.Message();
//Fill message header contents
MessageHeader responseHea... |
fbc31410-1ab6-4cd2-880e-4e8b26a3409e | 2 | public ShellLink setIconLocation(String s) {
if (s == null)
header.getLinkFlags().clearHasIconLocation();
else {
header.getLinkFlags().setHasIconLocation();
String t = resolveEnvVariables(s);
if (!Paths.get(t).isAbsolute())
s = Paths.get(s).toAbsolutePath().toString();
}
iconLocation = s;
ret... |
6c502216-0453-48c1-9d89-b0b8ab5c33af | 3 | static private float[] subArray(final float[] array, final int offs, int len)
{
if (offs+len > array.length)
{
len = array.length-offs;
}
if (len < 0)
len = 0;
float[] subarray = new float[len];
for (int i=0; i<len; i++)
{
subarray[i] = array[offs+i];
}
return subarray;
} |
3edff8db-82c7-44e0-941f-b738a301356d | 1 | @Override
public Grid generateGrid() {
playerFactory.generate();
// Give the players some items to start
for (Player player : grid.getAllPlayersOnGrid()) {
LightGrenade item1 = new LightGrenade(player.getPosition());
this.addObservable(item1);
this.addObserver(item1);
player.addItemToInventory(item1... |
7e0e321b-0263-4389-bcb6-8f174e34eae8 | 3 | public Gui getGui() {
return new Gui() {
@Override
public void render(Graphics2D g2d, int width, int height) {
LinearGradientPaint gradient = new LinearGradientPaint(0, 0, 0, 100, new float[]{0,1}, new Color[]{new Color(0x666666),new Color(0x444444)});
g2d.setPaint(gradient);
g2d.fillRect(0, 0, width,... |
1bf8ae19-737c-48e4-918d-c3422274ee95 | 5 | public void doPrint() {
List<String> nodes = this.graph.getVertexes();
for (String node : nodes) {
List<String> edges = this.graph.getIncident(node);
for (String edge : edges) {
if (this.graph.getSource(edge).equals(node)) {
System.out.format("%4s (%3s,%3s) %4s",
node,
this.graph.g... |
2e04e25c-28c6-4919-83e3-dafa8399b998 | 7 | public Colony build(){
// player not set, get default
if(player == null){
player = game.getPlayer(defaultPlayer);
if(player == null){
throw new IllegalArgumentException("Default Player " + defaultPlayer + " not in game");
}
... |
7dda5b30-ce7a-4afd-9988-1e912159a492 | 4 | public int getBurnDurationOfFuelBlock(int blockID)
{
int time = 0;
if(fuelBlocksGroupIDlist_Wool.contains(blockID))
{
time = Arctica.burnDuration_Wool;
}
else if(fuelBlocksGroupIDlist_CraftedWood.contains(blockID))
{
time = Arctica.burnDuration_CraftedWood;
... |
87d7ea6e-976b-4885-9146-8c1682ffdf85 | 9 | public static boolean hasStrongNode(Node node) {
try {
node.getNodeType();
} catch (Exception e) {
return true;
}
if (node.getNodeType() == Node.TEXT_NODE) {
return !node.getNodeValue().isEmpty();
}
if (node.getNodeName().equalsIgnoreCase("img")) {
return true;
}
... |
6b09c290-1249-40e5-b1f8-c9088f2a0e9f | 9 | public static int delete(String sql, List<Param> params)throws SQLException{
C3p0Pool pool = C3p0Pool.getInstance();
Connection conn = pool.getConnection();
PreparedStatement statement = conn.prepareStatement(sql);
if(params!=null){
int i=1;
for(Param p:params){
if(p.getColumnType()==ColumnType.Date){... |
6ae4fffe-f3df-4422-a906-e2470f8e7bcd | 5 | public static double findNthSortedArrays(int A[], int B[], int nth) {
int alen = A.length;
int blen = B.length;
int i = 0, j = 0;
while (i < alen && j < blen) {
if (1 == nth) {
return min(A[i], B[j]);
}
int nth1 = nth / 2;
int nth2 = nth - nth1;
nth1 = min(nth1, alen - i);
nth2 = min(nth2,... |
eaee97be-265b-4e0f-af8a-5698984a697e | 2 | public void addPopup(int x, int y) {
JMenuItem item = new JMenuItem();
JPopupMenu menu = new JPopupMenu();
if(list.getSelectedValue() == null) {
item = new JMenuItem("Add");
item.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
NewVariableEditor varEdit... |
1125ea57-ebfe-4a90-96bd-86ad80b53edc | 7 | @Override
public ForeignKey parse() {
if(!this.prepared) {
this.prepared = true;
StringBuilder sB = new StringBuilder();
sB.append("FOREIGN KEY (");
int i = 0;
for(String lF : lFL) {
if(i > 0) {
sB.append(", ");
}else{
++i;
}
sB.append(lF);
}
sB.append(") \... |
56a2bad7-f96c-4653-9fde-b4ced0879417 | 4 | public Student search(int id) throws UnknownStudent {
Student s = null;
boolean found = false;
int i = 0;
while (i < list.size() && !found) {
s = list.get(i);
if (s.getId() == id)
found = true;
i++;
}
if (!found) {
throw new UnknownStudent("No student with an id " + id
+ " in the Prom... |
bc5318e1-88cd-4731-9b45-6d629309e98e | 4 | @Test
public void deleteOneTest() {
final int n = 1_000;
IntArray arr = IntArray.empty();
for(int k = 0; k < n; k++) {
for(int i = 0; i < k; i++) {
final IntArray arr2 = arr.remove(i);
final Iterator<Integer> iter = arr2.iterator();
for(int j = 0; j < k - 1; j++) {
... |
a805ca91-a155-4f0e-afbb-5e2750d79acc | 1 | @Override
public void draw(Graphics page)
{
BulletImage.drawImage(page, xLocation, yLocation);//Draws the plane on the component
//Draws the collision Border
if(this.getBorderVisibility())
{
drawCollisionBorder(page,xLocation,yLocation,BulletImage.getWidth(),BulletImage.getHeight());
}
} |
138038c4-e8b0-48ba-95be-2bdb781dd2f1 | 8 | public MapObject findNextTargetObject() {
for (Robot robot : current_room.getRobots()) {
if (robot.isVisible() && shouldTargetObject(robot) &&
(!bound_pyro.isCloaked() || Math.random() < TARGET_ROBOT_WHEN_CLOAKED_PROB)) {
return robot;
}
}
for (Powerup powerup : current_roo... |
a38c0261-128f-42db-b014-573f988c27df | 6 | public static void main(String[] args){
try {
String name = "main";
int num_rand;
ArrayList<JvnObjectImpl> array = new ArrayList<JvnObjectImpl>();
//MonObjet o1 = new MonObjet("objet1");
//JvnObjectImpl shared_object_1 = (JvnObjectImpl) JvnServerImpl.jvnGetServer().jvnCreateObject(o1);
//JvnServerIm... |
c17ba601-6608-48f1-9af2-144fd28e97dd | 1 | private String[] getCombinations(String[] variables) {
ArrayList list = new ArrayList();
for (int k = 0; k < ((int) Math.pow(2, variables.length)); k++) {
String comb = pad(Integer.toBinaryString(k), variables.length);
list.add(getRepresentation(comb, variables));
}
return (String[]) list.toArray(new Stri... |
17979900-542b-47bb-9b6a-be8668c9b1cd | 6 | @Override
public void onPhase(PHASE phase, PHASE_STAGE stage) {
if (phase.equals(PHASE.CONTENT_SCRAPE)
&& stage.equals(PHASE_STAGE.COMPLETE) && canTerminate) {
logger.debug("Done scrapping. Deleting mapping");
// delete the mapping. We are done with the scrape
} else if (phase.equals(PHASE.PAGE_SCRAP... |
00ea128a-6683-4bae-a776-665f047901e8 | 1 | public Node getNext() {
Node node = current;
if (node == head) {
current = null;
return null;
} else {
current = node.next;
return node;
}
} |
19f07251-e475-4c50-bbd7-bd2b6d7146ab | 9 | private static boolean magicSquare(int[][] matrix) {
int n = matrix.length;
int nSquare = n * n;
int magicSum = (n * n * (n * n + 1) / 2) / n; // Distribution of first k
// = n * n natural
// numbers distributed
// among n rows/columns
int rowSum = 0, colSum = 0, firstD... |
47baf8e9-14a5-4129-a271-977f899663ad | 9 | public CheckerBoard(int size) {
boardSize = size;
checkersBoard = new char[boardSize][boardSize];
typeR = 'r';
typeB = 'b';
empty = '_';
typeRList = new LinkedList<Chip>();
typeBList = new LinkedList<Chip>();
for (int i = 0; i < boardSize; i++) {
... |
7539e6ce-f41f-48ad-a1e0-0855b82fd045 | 3 | public void qSortMedianThree(int[] array, int left, int right){
if((right-left)<=0)
return;
if((right-left)==1){
if(array[left]>array[right])
swap(array, left, right);
}else{
int median = medianOf3(array, left, right);
int part = partIt(array, left, right, median);
qS... |
53fe1efd-0f36-4b0f-8618-abeeb755361a | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Jogador other = (Jogador) obj;
if (nome == null) {
if (other.nome != null)
return false;
} else if (!nome.equals(other.nome))
return ... |
fadcb798-e5eb-4af9-ab8e-e8c2dc86fd59 | 5 | private void init(final String mapPath, final Properties props)
{
this.props = props;
// Hajo: walls for all squares of this map
if(props.get("walls") != null) {
walls = getIntegers(props, "walls", '#');
}
// Hajo: Floor for all squares of this map t... |
3da9b83c-fe7a-4ae5-b929-44b07cbd5b91 | 9 | private void batchEstimateDataAndMemory(boolean useRuntimeMaxJvmHeap, String outputDir, int newRNBase, boolean outputDetailedDataflow) throws IOException {
File mDataOutputFile = new File(outputDir, "eDataMappers.txt");
File rDataOutputFile = new File(outputDir, "eDataReducers.txt");
// outputDir = /estimatedD... |
662f6536-d07e-49c9-a00f-66a47e5eb36b | 3 | private void setup() {
dataFolder = main.getDataFolder();
accountFolder = new File(dataFolder.getPath() + "\\accounts");
transactionFolder = new File(dataFolder.getPath() + "\\transactions");
main.debug("Data folder: " + dataFolder.getPath());
main.debug("Account folder: " + acc... |
bff8a89e-c4fd-42bb-853a-aeb5dee49567 | 0 | public Image(int width, int height) {
this.width = width;
this.height = height;
this.pixels = new int[this.width*this.height];
} |
e79458cb-f250-40b4-8e77-a70ae4c18084 | 0 | public void setEmail(String email) {
this.email = email;
} |
771ce5e9-1e38-4b43-a1cf-255133f518b8 | 8 | public void buildDetail(String id, JPanel panel) {
if (getId().equals(id)) {
return;
}
TileType tileType = getSpecification().getTileType(id);
panel.setLayout(new MigLayout("wrap 4, gap 20"));
String movementCost = String.valueOf(tileType.getBasicMoveCost() / 3);
... |
e8c02c17-1f66-49a1-90c4-732b86f549a6 | 7 | public ItemTablePanel(Class<T> clazz, ItemSet<T> items) throws Exception {
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
this.model = new ItemTableModel(clazz, items, this);
this.table = new JTable(this.model);
this.table.setFillsViewportHeight(true);
int index =... |
a123cbbd-9058-4954-8d03-58fe4b5c6969 | 2 | public int getPreferredHeight(List<Column> columns) {
int preferredHeight = 0;
for (Column column : columns) {
int height = column.getRowCell(this).getPreferredHeight(this, column);
if (height > preferredHeight) {
preferredHeight = height;
}
}
return preferredHeight;
} |
1eb01790-907f-4453-86d5-e100cca6d139 | 8 | private static void colorButtonByPercentChangeAfterEarningsReport(
CustomButton a, String dateInfo, String ticker) {
String[] dates = dateInfo.split(" ");
if (dates.length < 2) {
// System.out.println("\n\nARRAY IS SHORT : " + dateInfo + " --> "
// + Arrays.toString(dates));
return;
}
try {
l... |
6e58dcec-e5c0-481c-9cb4-f8e123fe55ad | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BankAccount other = (BankAccount) obj;
if (listeners == null) {
if (other.listeners != null)
return false;
} else if (!listeners.equals(... |
594a26f1-480f-4555-8556-39f7cebf67bd | 5 | @Test(expected = BadNextValueException.class)
public void testInfixToPostfix8() throws BadNextValueException,
DAIllegalArgumentException, DAIndexOutOfBoundsException,
ShouldNotBeHereException, UnmatchingParenthesisException {
try {
infix.addLast("5");
QueueInterface<String> postFix = calc.infixToPostfix(... |
3c8ba907-c4b0-4ee4-83b5-0819a22b607a | 6 | public void buildEventTree() {
eventRootNode.removeAllChildren();
List<ImgEvent> events = imageBrowser.getEvents();
if (events == null) {
return;
}
for (ImgEvent e : events) {
Calendar c = new GregorianCalendar();
c.setTimeInMillis(e.eventstart);
int year = c.get(Calendar.YEAR);
DefaultMuta... |
fae1a08e-ee94-407d-a739-ab49cb5c64bb | 0 | private static Key toKey(String password) throws Exception {
PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(ALGORITHM);
SecretKey secretKey = keyFactory.generateSecret(keySpec);
return secretKey;
} |
2ccbf43b-d9ac-4e78-9e43-810cb66328c7 | 2 | public <T extends NMEAEvent<? extends NMEASentence>>void bindEvent( Class<? extends NMEASentence> c, T event )
{
events.put( c, event );
} |
86be8c94-ae31-437a-994e-4a1d9e8afc97 | 6 | public void applyPrefixes(LinkedList<Prefix> pre){
//Scan subject, predicate and object (data indices 0 to 2)
for (int i=0; i<3; i++){
String value=getByIndex(i);
//Starts with '<'? (IRI)
if (value.startsWith("<")){
//'a' predicate
if (i==1 && value.equals("<http://www.w3.org/1999/02/22-rdf-syntax-... |
ec50098f-a96e-4f73-b535-dc65ebe36c13 | 9 | private int aslB(int dest, int n) {
clearFlags(SR_N, SR_Z, SR_V, SR_C);
boolean hibitSet = msbSetB(dest);
boolean hasOverflow = false;
int result = dest;
boolean msbSet;
for (int i = 0; i < n; i++) {
msbSet = msbSetB(result);
if (msbSet) setFlags(SR_X, SR_C);
else clearFlags(SR... |
a5258b88-a8b5-4dfc-8467-b9c3d15d59bb | 6 | public static <E> Node<E> bookIterative(Node<E> head, int k) {
if (head == null) {
return null;
}
Node<E> p1 = head;
Node<E> p2 = head;
int i = 0;
for (; i < k && p1 != null; i++) {
p1 = p1.next;
}
// This condition to check if k i... |
d1e6b533-d94f-4487-99e3-b3ae5ae6f4ad | 7 | public void paint(Graphics g) {
// This method is called by the swing thread, so may be called
// at any time during execution...
// First draw the background elements
/*
for (Element<Light> e : _lightElements) {
if (e.x.getState() == LightState.GreenNS_RedEW) {
g.setCol... |
d84937a1-d454-4d2d-8d7a-1a9ca36217ff | 1 | private boolean fireReceiveExceptionEvent(ExceptionEvent evt) {
if (evt.getException() != null) {
logger.debug(getName() + " receive exception : " + evt.getException().getMessage());
}
return true;
} |
0d508350-98e8-41d6-87da-7242b3bc2d67 | 4 | public static Professor addProfessors(Professor prof) {
boolean exist = false;
int pos = 0;
if (prof == null)
return null;
for (int i = 0; i < FileReadService.profList.size(); i++) {
if (FileReadService.profList.get(i).equals(prof)) {
exist = true;
pos = i;
}
}
if (!exist) {
FileReadServ... |
e1c851d4-7b6a-4df3-bd0a-9ef1d3e32bfd | 8 | public void onKeyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case VK_UP:
case VK_W:
directions.remove(Direction.UP);
break;
case VK_DOWN:
case VK_S:
directions.remove(Direction.DOWN);
break;
case VK_RIGHT:
case VK_D:
directions.remove(Direction.RIGHT);
break;
case VK_LEFT:
ca... |
3add2e7e-460d-4425-8f71-dd1ee0e3e961 | 1 | public void printCars(ArrayList<Car> carList) {
for (int i = 0; i < carList.size(); i++)
System.out.println(carList.get(i).toString());
} |
9a73b55c-d771-4689-a4ee-c8360ae76b49 | 9 | public static int getDatabaseMatchesInfo(int mode, int match, int teamID) {
mode++;
if (mode == 1) {
return getMatchAutoPoints(match, teamID);
} else if (mode == 2) {
return getMatchTelePoints(match, teamID);
} else if (mode == 3) {
return getMatchFris... |
d62882fa-ba83-43c8-9c11-5bc78a2328c8 | 1 | synchronized public
void addElementWithReplacement (Element e) {
Element root = doc.getRootElement();
Collection<Element> oldCachedElements = queryXPathList(
String.format(ELEMENT_BY_URL_XPATH,e.getAttributeValue("url")));
for (Element current: oldCachedElements)
current.detach();
root.addContent((... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.