method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
47fe599d-85fc-40a2-8439-5103afee71e5 | 4 | private void setCandidates(Game game) {
for (int y = 0; y < 9; y++) {
for (int x = 0; x < 9; x++) {
fields[y][x].setBackground(Color.WHITE);
if (game.isHelp() && game.isSelectedNumberCandidate(x, y))
fields[y][x].setBackground(COLOR_CANDIDATE);
... |
cef1ba46-c1a0-414e-a8a5-4f3b44af6c6c | 5 | private void drawSubmitIdeaForm() {
panel.removeAll();
frame.setBounds(400, 300, 200, 365);
final JFileChooser fc = new JFileChooser();
JButton openButton = new JButton("Choose a File...");
final JTextField chosenFileTxtField = new JTextField("");
openButton.addActionListener(new ActionListener() {
... |
95941d8c-f607-40bf-8328-da96ed377d6a | 9 | public void fillScreenedRect(short colix, int x, int y, int z, int w, int h) {
if (isClippedZ(z))
return;
if (x < 0) {
w += x;
if (w <= 0)
return;
x = 0;
}
if (x + w > width) {
w = width - x;
if (w <= 0)
return;
}
if (y < 0) {
h += y;
if (h <= 0)
return;
y = 0;
}
s... |
5cf26941-7037-4eee-a2c9-8102c9def83b | 2 | private void createContact() {
Contact contact = new Contact();
String name = nameField.getText().trim();
contact.setName(name);
String addr1 = address1.getText().trim();
contact.setAddressLine1(addr1);
String addr2 = address2.getText().trim();
contact.setAddressL... |
9107bf4a-e4dd-46f4-8f1d-0756e00b5349 | 0 | public static String getBd() {
return bd;
} |
5820a344-b00c-41d4-9ea4-bad93f9d7aa9 | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (args.length > 0) {
boolean cont = true;
BaseCommand cmdClass = null;
fo... |
109b4cd4-6fb1-4aee-8377-45dc8c9a374a | 1 | public float getTextureHeight() {
if(texture != null) {
return (float)texture.getTextureHeight();
}
else {
System.err.print("RoyalFlush: Texture2D.getTextureHeight - No texture has been loaded.\n");
return -1.0f;
}
} |
7bbb9098-0865-4bab-ae71-00a0668a75f8 | 6 | private boolean diagonalDown(int row, int column)
{
Color currentColor = boardArray[row][column].getColor();
if (column > GameConstants.NUM_COLUMNS - GameConstants.SEQ_LENGTH
|| row > GameConstants.NUM_ROWS - GameConstants.SEQ_LENGTH)
{
return false;
}
for (int i = 1; i < GameConstants.SEQ_LENGTH; i++... |
0901da69-ebba-4def-97a3-e9c1ca11f622 | 0 | @Test
public void EnsurePathMatchesOneWildCardPattern() {
Path path = new Path("alan/likes/warbyparker");
Pattern pattern = new Pattern("alan,likes,*");
assertTrue(path.match(pattern));
} |
07a2d6b3-ea36-44df-8d32-2399a9147f54 | 5 | public static int getItemId(Item addedItem)
{
int itemID = -1;
for (int i = 0; i<fullInventory.size(); i++)
{
Item item = fullInventory.get(i);
if (item.type == addedItem.type)
{
if (item.type == Item.Type.TM || item.type == Item.Type.HM)
{
if (item.mNo == addedItem.mNo)
{
... |
8849bb9a-23a2-4778-a15a-c9495dc3750e | 2 | public DataModel<AgendaBean> listaAgendamentos() {
AgendaDAO ag = new AgendaDAO();
List<AgendaDAO> listaAgenda = ag.getAgendamentos(null, null);
if (listaAgenda != null) {
agendamentos.removeAll(agendamentos);
for (AgendaDAO a : listaAgenda) {
AgendaBean a... |
ec44c812-d2ce-4255-94a0-d92d2df9fe7c | 1 | public MIRA() {
linearParam = new FeatureVector();
iters = 5;
if (CommandLineUtilities.hasArg("online_training_iterations")) {
iters = CommandLineUtilities.getOptionValueAsInt("online_training_iterations");
}
} |
5dc32b52-7984-4517-a1fe-487618144746 | 4 | public ArrayList<LUS> linearize(boolean use_combos){
//Linearize the tree
seqs.clear();
linearize_recursive(new ArrayList(), use_combos);
//Create LUS objects from each linearization
int num_seqs = seqs.size();
ArrayList<LUS> lus = new ArrayList(num_seqs);
for (ArrayList<LUSTree> seq: seqs){
... |
416ae29f-daf5-4f8d-bbed-6cfd95dc3910 | 5 | private ConnectionableCapability getTargetCapability( int x, int y ){
float bestScore = 0.0f;
ConnectionableCapability result = null;
ConnectionFlavor flavor = factory.getFlavor();
for( ConnectionableCapability capability : site.getCapabilities() ){
if( capability.isTarget( flavor )){
if( capability.a... |
6d5fce76-bc34-4371-91f9-9cecc361c74a | 7 | private void play1(Hand hand) {
this.end = false;
String choice = "S";
this.output.print("Player: ");
// Play until bust, 21, double down, stand
while (this.end == false) {
hand.print(false);
this.output.println("");
this.output.println("Hit: H; Stand: S; Split: P; Double Down: D");
choice = inp... |
f20aa261-1491-46ab-8d2d-b2ddd528c7c2 | 3 | private boolean playerStartPositionsHasNoIdentityDisc(Grid grid) {
List<IdentityDisc> identityDiscs = getIdentityDiscsOfGrid(grid);
for (Player p : grid.getAllPlayersOnGrid())
for (IdentityDisc idDisc : identityDiscs)
if (grid.getElementPosition(idDisc).equals(p.getBeginPosition()))
return false;
... |
bff15b21-1bbc-4087-a9d6-26a07ac28225 | 4 | private static void getAssets(ApiAuthorization auth, Connection conn) {
try {
AbstractAssetListParser parser = AssetListParser.getInstance();
AssetListResponse response = parser.getResponse(auth);
Collection<EveAsset<EveAsset<?>>> assets = response.getAll();
for (EveAsset asset : assets) {
System.out.... |
cb5dbae5-93d2-4bee-aa87-5dbbf6556fe4 | 2 | public void sql_remove_account() throws InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Statement s = GUI.con.createStatement();
//CHANGE FUNCTIONS BASED ON HIERARCHY
if(GUI.Level == 1)
{
s.executeUpdate ("DELETE ... |
f3f6b3d0-2c79-4498-b7b8-9b9f8f3eb815 | 1 | private void decrementPieceTypeForPlayer(HantoPlayerColor player, HantoPieceType pieceType) {
int piecesLeft = playerPieceTypeRemaining(player, pieceType);
if (player == HantoPlayerColor.BLUE) {
bluePiecesLeft.put(pieceType, (piecesLeft - 1));
}
else {
redPiecesLeft.put(pieceType, (piecesLeft - 1));
}
... |
ef90804b-08c1-4a19-8e94-5ade006a112e | 5 | private RevisionHandler handleRequest(final String req) throws StorageException {
assert (req != null): "Supplied request is null";
try {
final URL requestURL = new URL(jhilbert.Main.getMediaWikiApi() + "?format=xml&action=query&" + req);
final URLConnection request = requestURL.openConnection();
final SAX... |
77954ba2-893d-40a9-a024-1689f32e6364 | 4 | public static double offset(double low, double high){
double diff = high - low;
double sh = Fmath.sign(high);
double sl = Fmath.sign(low);
double offset=0.0D;
int eh=0, ed=0;
if(sh == sl){
ed=(int)Math.floor(Fmath.log10(diff));
if(sh==1... |
99d238d8-a1b5-4f3a-985a-78c82f6a7943 | 0 | public static void main(String[] args) {
int x = 7;
System.out.println("x = " + Integer.toBinaryString(x));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
System.out.println("x <<= 1 = " + Integer.toBinaryString(x <<= 1));
System.out.println("x <<= 1... |
33f17fb5-dd72-4546-9e52-7bd907667351 | 6 | public ArrayList<String> getAllProperties(String filename) {
ArrayList<String> globicProperties = new ArrayList<String>();
Document doc = (Document) session.getObjectByPath("/" + filename);
List<Property<?>> properties = doc.getProperties();
for (Property<?> p : properties) {
... |
5b89781c-a35d-4a9c-a39e-db8f1bfa323f | 1 | @Override
public void endDocument() throws SAXException
{
for (String roadType : tempRoadTypeList)
{
// System.out.println(roadType);
}
mapOfNodes = null;
nodesDownloadedPct = 1;
edgesDownloadedPct = 1;
streetsDownloadedPct = 1;
// System.out.println("end document : ");
} |
af58ef0a-ba3b-4c56-9b74-47d9b5373598 | 0 | public int getDepartmentId() {
return departmentId;
} |
d672764e-8959-4dd7-8267-805b6e369afc | 3 | public void interrupt() {
int a = this.dcpu.registers[0];
if (a == 0)
this.interval = this.dcpu.registers[1];
else if (a == 1)
this.dcpu.registers[2] = this.ticks;
else if (a == 2)
this.interruptMessage = this.dcpu.registers[1];
} |
685bc8cc-b5e7-4fde-a2f2-ecfb78b9aeb6 | 4 | private void nearestNeighbours_(KDTreeNode node, Point queryPoint, int depth, KDNeighbours bestNeighbours) {
if(node == null)
return;
if(node.isLeaf()) {
bestNeighbours.add(node.location);
return;
}
int axis = depth % (queryPoint.coordinates.length);
... |
c416cd5c-4387-4d99-8125-65daf43f6ca0 | 0 | public Generator(String tableName, String columnName) {
this.tableName = tableName;
this.columnName = columnName;
} |
827f23da-8170-483e-80e6-44e256bacb01 | 4 | boolean inSameSubroutine(final Label block) {
if ((status & VISITED) == 0 || (block.status & VISITED) == 0) {
return false;
}
for (int i = 0; i < srcAndRefPositions.length; ++i) {
if ((srcAndRefPositions[i] & block.srcAndRefPositions[i]) != 0) {
return true;
}
}
return false;
} |
ed289066-1c54-4fda-8c9e-c5549f055b07 | 6 | public static float[] normalize_float_array(float values[]){
float[] results = new float[values.length];
float sum =0;
float max =0;
float min =0;
float val =0;
for (int i=0; i<values.length; i++){
val = values[i];
sum += val;
if (i == ... |
1d7b8c4e-6943-430d-b7f3-0345383169f6 | 6 | public void Update(double playerSpeed, boolean pointPassed) {
//the following all increase the speed as a key is pressed
// Calculating speed for moving up
if (playerSpeed == -1) {
speedY = -2;
} else if (playerSpeed == -2) {
speedY = -4;... |
7e39adec-de6a-4df7-83eb-086ca9825a40 | 1 | private void piirraTaso(Graphics graphics, Taso taso) {
ArrayList<Este> esteet = new ArrayList();
esteet = taso.getEsteet();
for (Este este : esteet) {
piirraEste(graphics, este);
}
} |
08e7f29b-f8da-4de7-b025-572fe2ca9506 | 7 | public static BoardBuilder parseStringToBoardBuilder(String puzzleString, boolean singleDigitOnly) {
final Matcher matcher = VALIDATE_PATTERN.matcher(puzzleString);
if (!matcher.matches()) {
throw new IllegalArgumentException("illegal puzzle string: " + puzzleString);
}
final int width = Integer.p... |
a6436e2d-4aaa-445f-b3a9-bc4a0d5bd8be | 5 | public static ArrayList<Person> read(Person personIn){
ArrayList<Person> listPerson = new ArrayList<Person>();
if(personIn == null){
try {
MongoClient mongoClient = new MongoClient( "127.0.0.1" , 27017 );
DB db = mongoClient.getDB( "db" );
DBCollection collection = db.getCollection("person");
... |
658921a7-c306-4538-9012-a4f06de11a82 | 9 | public static void main (String[]args)
{
GnuNeutron gnuNeutron = new GnuNeutron("alphabeta");
boolean pbem=false;
if (args.length > 0)
{
for (int i = 0; i < args.length; i++)
{
if (args[i].equals ("--pbem")) { pbem=true; continue; }
if (args[i].equals ("--random")) {
gnuNeutr... |
22a431e8-f288-47a9-b86a-c324a402a2bf | 4 | public void setNodes(ZVNode[] nodes) {
if (this.nodes != null) {
for (int i = 0; i < this.nodes.length; i++) {
this.nodes[i].removePropertyChangeListener(
ZVNode.PROPERTY_EXISTS, this.propertyListener);
}
}
this.nodes = nodes;
... |
818914b8-83bf-4c7f-8be6-55730f4a0717 | 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... |
07dad93c-d5ff-4a30-b01c-aeae82a26dac | 5 | @Override
public void actionPerformed(ActionEvent event) {
Object object = event.getSource();
if (object == openMenuItem) {
openMenuItem_actionPerformed(event);
}
else if (object == exitMenuItem) {
exitMenuItem_actionPerformed(event... |
94189350-bf2d-4073-ae70-1235f111dde1 | 1 | private void addDice(int sides) {
List<String> faceValue = new ArrayList<String>(sides);
for (int i = 0; i < 6 ; i++){
int letterId = rand.nextInt(letters.length);
faceValue.add(letters[letterId]);
}
dice.add(new Dice<String>(faceValue));
} |
f2160e3f-e1e3-4bda-9b0d-de8444d55eaf | 1 | public void show() {
for (String v : value) {
logger.debug(v);
}
} |
e1de3aae-17c5-4afd-a2b6-08801b1d21e2 | 2 | public void crearImpresora(int cantImpresora) {
String listadoImpresora = "";
String nombreImp;
int i = 1;
while (i <= cantImpresora) {
nombreImp = JOptionPane.showInputDialog("Nombre de la impresora " + i);
if (nombreImp.isEmpty()) {
int j= cantImpresora... |
c5e556e1-3d9b-41c6-b4f9-6366b023e445 | 6 | public static int sampleScores(double[] beamScores) {
// First get the normalization denominator
double sum = 0;
for (int i = 0; i < beamScores.length; i++) {
sum += beamScores[i];
}
// Then normalize
double[] normScores = new double[beamScores.length];
for (int i = 0; i < beamScores.length; i++) {
... |
31b487a1-a011-4c4e-9ed7-a075cdabbd6b | 3 | public void clearStaleEntries() {
List<K> expiredKeys = new ArrayList(128);
Set<Map.Entry<K, CachedValue<V>>> entrySet = cache.entrySet();
for (Map.Entry<K, CachedValue<V>> entry : entrySet) {
CachedValue<V> cachedVal = entry.getValue();
if (cachedVal.isExpired()) {
expiredKeys.add(entry... |
59342a2f-39dd-4419-9857-fcd12aabd347 | 3 | public void initMaze(Start start, End end, List<Obstacle> obstacleList) {
initBorderMaze();
bufferedImage.setRGB(start.getX() + 1, start.getY() + 1, Color.RED.getRGB());
bufferedImage.setRGB(end.getX() + 1, end.getY() + 1, Color.RED.getRGB());
for (Obstacle obstacle : obstacleList) {
for (int x = obstacle.... |
de7f5c22-99e6-4f57-a565-9548264e6c36 | 8 | @Override
public Location getChoice(Location[] options) {
// First turn- pick anything
if (options.length == 48) {
return options[(int)(Math.random() * 48)];
}
// Track the list of best plays, not just one of the bst
Location[] bestPlays = new Location[options.length];
int num_best = 0, best_val = In... |
6ec76d9d-da0b-4917-8e8f-f46369a3a9f6 | 8 | public void nicepaintGraph(Graphics gg, Boolean drawExtras) {
lastpaintTime = System.currentTimeMillis();
Iterator<Edge> ie = getGraph().edgeIterator();
try {
while (ie.hasNext()) {
Edge e = ie.next();
paint((Graphics2D) gg, e, getGraph(), drawExtras);... |
86113738-c727-4079-a813-b0c21e462610 | 2 | public int getIndexOfChild(Object parent, Object child) {
if (parent instanceof Page) {
Page p = (Page) parent;
if (child instanceof Page) {
return p.subPages.indexOf(child);
} else {
return p.names.indexOf(child);
}
}
... |
f428c14c-d100-4a41-8583-b486103a0a5a | 8 | @Override
public void startElement(String uri, String localName, String qName, Attributes attributes) {
currentPre++;
currentElementPre = currentPre;
if (rootMatch == null) {
if (qName.equals(root.getName()) || root.getName().equals("*")) {
addMatch(qName, root, n... |
134a8814-e207-4ce2-a181-a15c0a94909c | 3 | public List<PacienteDAO> getPacientes(){
try{
EntityManager em = conexao();
if (em!=null){
Query q = em.createQuery("SELECT p FROM Paciente p");
List<Paciente> resultado = q.getResultList();
List<PacienteDAO> pacientes = new ArrayList<Pacie... |
6ffa3af7-8860-4f9c-91ca-0be40c3834dc | 7 | @Override
public void menu() {
do {
System.out.println();
MenuActions action = userInputManager.showMenu("QUIZ ADMINISTRATOR MENU", setUpClientMenu);
try {
switch (action) {
case SET_UP_QUIZ_MANUALLY:
setUpNewQui... |
57a5fab0-0700-40fb-9807-9e153c302451 | 2 | public LinkedList<T> formLinkedList(int order) {
if (order == PRE_ORDER) {
return formListPre();
}
else if (order == POST_ORDER) {
return formListPost();
}
else {
return formListIn();
}
} |
57d4c811-ea27-4077-ad95-1d7708cc4a61 | 5 | public static void deleteRecursively(File startDir) throws IOException {
String startDirPath = startDir.getCanonicalPath();
// Pass one - delete recursively
for (File f : startDir.listFiles()) {
if (!f.getCanonicalPath().startsWith(startDirPath)) {
throw new IOException("Attempted to go out of " + st... |
c1a3b163-171c-48f2-aaa4-7bcbd68050df | 5 | public void generate() {
int maxdepth = 6;
int curdepth = maxdepth;
SubDungeon start = new SubDungeon(new Rectangle(new Point(0, 0), new Point(size - 1, size - 1)), 0, maxdepth, Point.add(min_size, new Point(1, 1)));//This should do everything at once
//Get all the subdungeons in the tre... |
fddb8c10-c1fb-4d7c-ba37-c7d615be15a1 | 4 | public synchronized int getNumberOfItems(char type){
int num = 0;
for (int x = 0; x < this.getXLength(); x++) {
for (int y = 0; y < this.getYLength(); y++) {
if (field[x][y] != null) {
if (field[x][y].getType() == type) num++;
}
... |
5d8bdbe3-f8fe-44e5-8592-225ceaf49f6d | 2 | private Integer updateDirection(Criteria criteria, AbstractDao dao) throws DaoException {
Integer idDirection = (Integer) criteria.getParam(DAO_ID_DIRECTION);
if (idDirection != null) {
Criteria beans = new Criteria();
beans.addParam(DAO_ID_DIRECTION, idDirection);
da... |
9c10afcf-862c-42c4-811b-42232524b4a6 | 2 | protected void fireEditingCanceled()
{
// Guaranteed to return a non-null array
Object[] listeners = listenerList.getListenerList();
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2)
{
if (listeners[i] == CellE... |
843e6214-b137-470d-9f38-9151a79e21a7 | 2 | protected void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
Library library = new Library();
JSONObject result = new JSONObject();
try {
library.checkInBook(
Integer.parseInt(request.getParameter("bookNumber")));
response.setContentType("app... |
592832db-ed59-46db-8d00-77dc194e69a8 | 1 | public void logout(String accessToken) {
try {
HttpClient hClient = new DefaultHttpClient();
HttpPost hPost = new HttpPost("https://authserver.mojang.com/logout");
String jsonData = ""
+ "{"
+ " \"accessToken\":\"" + accessToken + "... |
116eab95-d629-45f1-9867-26e3377c4b0f | 0 | @Override
public String getMessage() {
return "Nie uzupelniono wszytkich wymaganych pol";
} |
8231f0e8-bae2-4716-9363-ea495d8159e9 | 9 | public void setOptions(String[] options) throws Exception {
setDebug(Utils.getFlag('D', options));
String classIndex = Utils.getOption('c', options);
if (classIndex.length() != 0) {
if (classIndex.toLowerCase().equals("last")) {
setClassIndex(0);
... |
33abec23-1801-4cd8-976b-c57b807a2414 | 5 | public void checarVidas() {
//
if (ZonaDeTiro.salud == 4) {
quitLife("life1", "Interface/life_bar/life_bar_full.png");
} else {
if (ZonaDeTiro.salud == 3) {
quitLife("life1", "Interface/life_bar/life_bar_orange.png");
} else {
if... |
951f5f99-c63e-458b-b023-b6a4e30f4623 | 9 | public void Tabu(int arr)
{
IVPTabu obj=new IVPTabu();
obj.inicializar();
System.out.println("valor del arr=;"+arr);
for (int i=0;i<arr;i++){
System.out.println("Tabu: for i="+i);
for (int j=i+1/*i+1*/;j<arr/*51*/;j++){
System.out.println("Tabu: for j="+j);
... |
0db07d7b-5a59-4e5e-b15b-dd71844536fa | 4 | public final Point sanitizeCoordinates(final Point p) {
final int width = Parameter.FIELD_WIDTH.getValue();
final int height = Parameter.FIELD_HEIGHT.getValue();
if (p.x < 0) {
return sanitizeCoordinates(new Point(p.x + width, p.y));
}
if (p.x >= width) {
... |
b21e1509-cedb-415b-b429-bd32d8a02ea1 | 1 | public Battlefield loadHero(ArrayList<MainMenuHeroSlot> heroies){
for(int i = 0 ; i < heroies.size();i++){
heroSlots.add(new BattleHeroSlots(heroies.get(i)));
heroTurn.add(heroSlots.get(i));
}
return battleField;
} |
91548610-fb7a-4a47-be6b-711314c9a831 | 1 | public void generateVeloctiyUpdate(){
double[] maxVelocity = new double[32];
for(int i = 0; i < maxVelocity.length; i++){
maxVelocity[i] = 3;
}
velocityUpdate.add(new VelocityClamping(maxVelocity));
velocityUpdate.add(new ConstrictionCoefficient());
} |
105b75a5-3f33-47ad-9adf-bd0e64263f52 | 9 | protected void FillBuff() throws java.io.IOException
{
if (maxNextCharInd == available)
{
if (available == bufsize)
{
if (tokenBegin > 2048)
{
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
else if (tokenBegin < 0)
bufpos = maxN... |
4052245c-5f25-478c-8e8b-4f143d7c3741 | 9 | private boolean r_Step_4() {
int among_var;
int v_1;
// (, line 91
// [, line 92
ket = cursor;
// substring, line 92
among_var = find_among_b(a_5, 19);
if (among_var == 0) {
return false;
}
// ], line 92
bra = cursor;
// call R2, line 92
if (!r_R2()) {
return false;
}
switch (among_v... |
7161155b-f1e5-4f19-982a-ea5aae4776a0 | 3 | public static ProgramSettings restoreSettings() {
ProgramSettings settings = null;
try {
FileInputStream filein = new FileInputStream(SETTINGS_OBJECT_PATH);
ObjectInputStream objin = new ObjectInputStream(filein);
try {
settings = (ProgramSettings) objin.readObject();
} catch (ClassCastException cce... |
3121e04a-109e-4107-b587-689fd978b3b0 | 8 | public static void main(String[] args) throws java.io.IOException {
if (args.length != 2) {
System.out.println("Usage: PercentStop <stop_words> <topics>");
System.exit(1);
}
String stopFile = args[0];
String topicsFile = args[1];
Alphabet dict = new Alphabet();
try {
Buffe... |
27e40577-aa09-4042-8077-be66d342b54c | 4 | public static boolean isBlank(String str){
if(str==null){
return true;
}
if(str.trim().length()<1){
return true;
}
if(str.trim().equals("")){
return true;
}
if(str.trim().toLowerCase().equals("null")){
return true;
}
return false;
} |
e08094a2-27a0-4738-bf6f-3989ab7bc507 | 2 | public void enable() throws IOException {
// This has to be synchronized or it can collide with the check in the task.
synchronized (optOutLock) {
// Check if the server owner has already set opt-out, if not, set it.
if (isOptOut()) {
configuration.set("opt-out", false... |
5274dd59-0af4-4109-ad58-0af580a87a45 | 5 | public boolean isPossible() {
int[] colors = { 0, 0, 0, 0, 0, 0 };
for (int f = 0; f < 6; f++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
colors[getColor(f, x, y).getInt()]++;
}
}
}
for (int i = 0; i < 5; i++) {
if (colors[i] != colors[i + 1]) {
return false;
}
... |
c0a0a5d2-80c7-4b64-9f1d-64d4b3334e59 | 4 | public void pause(String sourcename) {
if (sourcename == null || sourcename.equals("")) {
errorMessage("Sourcename not specified in method 'stop'");
return;
}
if (midiSourcename(sourcename)) {
midiChannel.pause();
} else {
Source mySource = sourceMap.get(sourcename);
if (mySource != null)
myS... |
178dbe62-660f-4629-82c4-c7d3a3870849 | 5 | public final boolean hasLocalSlot() {
return opcode == opc_iinc || opcode == opc_ret || opcode >= opc_iload
&& opcode <= opc_aload || opcode >= opc_istore
&& opcode <= opc_astore;
} |
cffa161b-bb8b-4d72-99fb-e063dd3573b0 | 8 | public static void testSpeed(boolean isBWT)
{
System.out.println("\nBWT"+(!isBWT?"S":"")+" Speed test");
int iter = 2000;
int size = 256*1024;
byte[] buf1 = new byte[size];
byte[] buf2 = new byte[size];
byte[] buf3 = new byte[size];
SliceByteArray sa1 =... |
ab071489-b309-45e3-85d5-59c4a71f67e8 | 1 | private static void maxChoc(int k) {
BigInteger bigValueX = new BigInteger(Integer.toString(k/2));
BigInteger bigValueY = null;
if (k % 2 == 0) {
bigValueX = bigValueX.multiply(bigValueX);
System.out.println(bigValueX);
} else {
bigValueY = new BigInteger(Integer.toString(k/2 + 1));
bigValueX = big... |
cf0aae51-e75b-46fd-ada4-c7da764b1a0a | 2 | protected void drawSomebodyWon(Graphics g) {
g.setColor(gameOverColor);
somebodyWon();
g.setFont(new Font("Tahoma", Font.BOLD, FONT_SIZE * 2 + FONT_SIZE / 2));
if (player1.win()) {
g.drawString("PLAYER 1 WON !!!", getStringLocation(g, "PLAYER 1 WON !!!", this.getWidth()), FR... |
9396e777-72cd-4e66-b073-a7962998a4a6 | 3 | private static Enums.CellTps[][] GenerateTpsMap(byte[][] heights_map)
{
Enums.CellTps[][] tps_map = new Enums.CellTps[heights_map.length][heights_map.length];
for (int ix = 0; ix < tps_map.length; ix++)
for (int iy = 0; iy < tps_map[ix].length; iy++)
{
tps_ma... |
4a4d93fb-1eec-47ac-86e8-5e41bd4e2051 | 5 | @Override
public int run(String[] args) throws Exception {
// Create the job specification object
Job job = new Job(getConf());
job.setJarByClass(MostVisitedSite.class);
job.setJobName(this.getClass().getName());
outRootPath = job.getWorkingDirectory().toString();
... |
6d853c83-6e9b-4225-8eaa-c97cc47c56ab | 2 | public static List<String> permuteAsStrings(List<Character> chars) {
List<List<Character>> charLists = new ArrayList<List<Character>>();
List<String> result = new ArrayList<String>();
permute(chars, 0, charLists);
for (List<Character> charList : charLists) {
StringBuilder sb ... |
067e042e-0eec-47f7-9202-06b7fd8f3f7b | 5 | @Test
public void testInfixToPostfix11() throws DAIllegalArgumentException,
DAIndexOutOfBoundsException, ShouldNotBeHereException,
BadNextValueException, UnmatchingParenthesisException {
try {
String completeOperation = "2+4+((5+9)/2 +3)+(9-(5+2)-8*9)";
infix.addLast("+");
infix.addLast("(");
infi... |
4f82005f-bfb5-4400-80b9-f2215c73fc75 | 7 | public Object get(IndexReader reader, Entry key) throws IOException {
Map<Entry,Object> innerCache;
Object value;
final Object readerKey = reader.getFieldCacheKey();
synchronized (readerCache) {
innerCache = readerCache.get(readerKey);
if (innerCache == null) {
innerCac... |
dfbee11c-da7a-4f5d-bc0d-ff295b6faa9f | 8 | private void parseJson(String json) {
try {
JSONObject obj = new JSONObject(json);
JSONArray results = obj.getJSONArray("Results");
for (int i = 0; i < results.length(); i++) {
JSONObject result = (JSONObject) results.get(i);
if ("CUL_HM".equalsIgnoreCase(result.getString("list").trim())) {
JSON... |
15478d14-df25-4e59-9d5e-28dc48a73840 | 5 | public void move() {
//create a new location for the head using the direction
System.out.println("MOOOOVE");
int x = 0;
int y = 0;
switch (getDirection()) {
case UP:
x = 0;
y = -1;
break;
case DOWN:
... |
9918c44b-20c8-443d-a406-d0cae9bec704 | 6 | @SuppressWarnings("unchecked")
public BlockMap(int x, int y, int z) {
width = x / 16;
depth = y / 16;
height = z / 16;
if (width == 0) {
width = 1;
}
if (depth == 0) {
depth = 1;
}
if (height == 0) {
height = 1;
... |
503b1e13-13b7-44f1-89a8-b603ed6c1fb7 | 7 | public Object nextValue() throws JSONException {
char c = nextClean();
String string;
switch (c) {
case '"':
case '\'':
return nextString(c);
case '{':
back();
return new JSONObject(this);
case '[':
... |
a001ce36-cabe-4cd4-a373-f33865f37c0d | 3 | private void initCheckboxIcons() {
log.trace( "Initialising checkbox locked icon" );
iconShadeImage = new BufferedImage(maxIconWidth, maxIconHeight, BufferedImage.TYPE_INT_ARGB);
Graphics g = iconShadeImage.getGraphics();
g.setColor( new Color(0, 0, 0, 150) );
g.fillRect(0, 0, maxIconWidth, maxIconHeight);
... |
ba35759b-d289-465f-b3a9-c8b5e9ec5a21 | 5 | public SecuredMessageTriggerBean execute(SecuredMessageTriggerBean message) throws GranException {
String text = message.getDescription();
SecuredTaskBean task = message.getTask();
EggBasket<SecuredUDFValueBean, SecuredTaskBean> refs = AdapterManager.getInstance().getSecuredIndexAdapterManager()... |
d143bdf9-ad35-4681-8519-f76e41b4868e | 1 | protected void calcShortName() throws UnsupportedEncodingException {
byte[] bTemp = new byte[8];
for (int i = 0;i < 8; i++) {
bTemp[i] = bytesOfFAT32Element[i];
}
shortName = new String(bTemp, "UTF-8");
} |
3f516dfa-c04e-4f02-895a-e5d817716484 | 8 | private void checkAdvancedTime(ArrayList<Module> modules, ArrayList<Room> rooms,int examPeriodLength) throws IllegalArgumentException{
Set<String> roomTypes = new HashSet<String>();
Set<String> moduleTypes = new HashSet<String>();
for(Module module:modules){
moduleTypes.add(module.getType());
}
for(R... |
0a50b933-6683-41ba-858a-67ea7d16fe32 | 3 | public void load(Configuration conf) throws Exception {
FileSystem fs = FileSystem.get(conf);
Path inputPath = new Path(hdfsLocation);
if (fs.isFile(inputPath)) {
processFile(fs, inputPath);
} else {
FileStatus[] dirFiles = fs.listStatus(inputPath);
... |
afd73b17-e30a-4c88-ac9a-2885a699762d | 6 | public ProfileEditorDialog(LaunchFrame instance, final String editingName, boolean modal) {
super(instance, modal);
setupGui();
getRootPane().setDefaultButton(update);
username.setText(UserManager.getUsername(editingName));
name.setText(editingName);
if(UserManager.getPassword(editingName).isEmpty()){
... |
1aefe6fd-190f-4ce1-a0cc-d8cc01fdac6b | 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 fe... |
8d985af2-c377-4282-b89d-693d668af2a8 | 1 | @Override
public boolean isObstacle(Element e) {
if (e instanceof Player)
return true;
return false;
} |
507dc452-a055-4182-9495-57f48b9170f9 | 7 | public double calculate(Accession a1, Accession a2) {
double value = getMemoizedValue(a1.getId(), a2.getId());
if (value != MISSING_VAL) {
return value;
}
ListIterator<List<Double>> m1Itr = a1.getSSRValues().listIterator();
ListIterator<List<Double>> m2Itr = a2.getSSRValues().listIterator();
double marker... |
bc43c6df-3ccf-4b8c-9a9f-b0dd5cc95888 | 3 | private synchronized void stop(){
if(!running){
return;
}
running = false;
try {
thread.join();
}
catch (InterruptedException e) {
e.printStackTrace();
}
try {
System.exit(0);
}
catch (Exception e) ... |
92340f29-56b8-44b8-bfe2-897897eea693 | 6 | private CFGResult statement(Block lastBlock) throws IOException, SyntaxFormatException {
CFGResult result = assignment(lastBlock);
if (result == null) {
ArithmeticResult funcCallResult = funcCall(lastBlock);
if (funcCallResult != null) {
return new CFGResult(lastBlock);
}
if (result == null) {
r... |
3365764f-c48d-47ae-b0e7-2482f6ea22af | 8 | public final int partitionByPrice(int left, int right) // see the name version of this method
{
Product pivotElement = products[left];
int max = logicalSize;
int lb = left, ub = right;
Product temp;
while (left < right)
{
while((products[left].productPrice() <= pivotElement.productPrice()) && left +1 ... |
eda55a78-0beb-4d93-9ab9-c9e52886416b | 7 | @Override
public void freeClusters(int headCluster, boolean freeHead) throws IOException {
if (headCluster < 0)
return;
if (!freeHead) {
int fatEntry = fs.getFatEntry(headCluster);
// CLUSTER_ALLOCATED only
if ((fatEntry & CLUSTER_STATUS) == CLUSTER_A... |
27768f93-f3ed-4df8-8a74-6fe5c127ede7 | 4 | public int loadStripImages(String fnm, int number) {
String name = getPrefix(fnm);
if (imagesMap.containsKey(name)) {
EIError.debugMsg("Error: " + name + "already used", EIError.ErrorLevel.Error);
return 0;
}
BufferedImage[] strip = loadStripImageArray(fnm, numbe... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.