method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
47b535c4-d2f2-420b-aeb2-5e2a6dd472e1 | 5 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReadPK other = (ReadPK) obj;
if (idISIEAdministrator != other.idISIEAdministrator)
return false;
if (idRepport != other.idRepport)
return... |
da2301fb-9770-4a54-8818-e2d464602823 | 5 | private void addEmptyThings(){
SortedSet<String> keys = new TreeSet<String>(data.keySet());
for (String path : keys) {
while(true){
path = deleteLastLevel(path);
if(path == null || path.equals("")) {
break;
}
... |
d8f9794c-9581-4ff1-9742-b48efb957611 | 3 | private static void checkProjectValid(){
List<ProjectError> errors = new ArrayList<ProjectError>();
File file;
for(String path : allPath){
file = new File(path);
if(!file.exists()){
errors.add(new ProjectError(ProjectError.FOLDER_MISSING, path));
... |
1c7ff878-7c10-4419-9fdb-db2ea7e4eee1 | 2 | @Override
public HsvImage clone() {
HsvImage cloned = shallowClone();
for (int x = 0; x < getWidth(); x++) {
for (int y = 0; y < getHeight(); y++) {
cloned.setPixel(x, y, HUE, getPixel(x, y, HUE));
cloned.setPixel(x, y, SATURATION, getPixel(x, y, SATURATION));
cloned.setPixel(x, y, VALUE, getPixel(x... |
084cde51-c723-4e92-af9e-46575ee729cc | 6 | public int fileLines(String fileDirectory, String exclusion) throws IOException{
BufferedReader fileReader = null;
try {
fileReader = new BufferedReader(
new InputStreamReader(getClass().getResourceAsStream(fileDirectory)));
} catch (NullPointerException propertiesReaderNPE) {
try {
fileReader = ne... |
1e06996e-a4da-4e10-9047-a87712c511fb | 7 | public void actionPerformed(ActionEvent arg0) {
if (arg0.getSource().equals(nextMonthButton)) {
GregorianCalendar cal = (GregorianCalendar)calendarModel.getCalendarClone();
int day = cal.get(Calendar.DATE);
cal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONT... |
55a6f9c2-5be2-4858-a0b1-3ae007b4d683 | 7 | @Override
public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if(onStart) {
switch(key) {
case KeyEvent.VK_ENTER:
onStart = false;
selectLocation = true;
}
}
else if(selectLocation) {
switch(key) {
case KeyEvent.VK_1:
Character.setLocation(LOCATION.LUMBRIDGE);
... |
01081d4d-2941-4982-bfca-04e2e18ff43a | 9 | public void build(Object object, Container location, IXMLElement xml, Runnable onUpdate) throws GUIBuilderException{
if (!xml.getName().equals("parameters") && !xml.getName().equals("group")){
throw new GUIBuilderException("Top level tag if XML must be <controls>. Parse failed.");
}
Enumeration children = xml.... |
60c78622-98c4-45e7-b053-fcf631bf0ee9 | 6 | public static void main(String args[])
{
/* Set the Nimbus look and feel */
try
{
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels())
{
if ("Nimbus".equals(info.getName()))
{
javax.swing.UIManager.setLookAndFeel(info.get... |
f618e93e-6a93-48e9-a17a-91fb4dbc2783 | 8 | public String undesiredQueries(String first, String second, String country, String query) {
String cheshireResult = null;
String countryQuery = "";
try
{
//**********************************************************************************************************
// Undesired Searching Mechanisms
// Th... |
9dce105e-9627-4b44-ba47-d60e0d495605 | 8 | public static void processT(String tempDir)
throws FileNotFoundException, NoSuchElementException, IOException, ProcessException
{
File trigramSortedInterDataFile = FileUtil.getFileInDirectoryWithSuffix(tempDir, TrigramExternalSort.DATA_SUFFIX);
File unigramDataFile = FileUtil.getFileInDi... |
348e1e94-5c5e-4816-a786-c183f554ab8c | 1 | public static void main(String s[]) {
JFrame f = new JFrame("See Through Image");
f.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {System.exit(0);}
});
URL imageSrc = null;
try {
imageSrc = ((new File(imageFileName)).toU... |
8d623119-fe8c-423a-ba2e-c8bf717231f9 | 9 | void ConstructProgramState(LoadType loadType, GUI parentGUI, String filterTag){
//mainGUI.isChangingState = true;
switch (loadType){
case Init:
Settings.setSettingAndSave("databaseFilePathAndName", getSetting("homeDir")+getSetting("databasePathExt")+getSetting("databaseFileName"));
Ini... |
9b3f03f1-4206-473d-b1c6-d762166cf15c | 9 | DeviceImpl (USB bus, String drivername, int a)
throws IOException, SecurityException
{
super (null, bus, a);
usb = bus;
path = drivername;//f.getPath ();
if(MacOSX.trace)
System.err.println("in usb.macosx.DeviceImpl()\n");
// should only fail if the device u... |
8e2b4d1a-d155-4b10-bab4-b6a9f2c1e953 | 2 | public void setQualification(int qualification) {
this.qualification = (qualification > 0 && qualification < 5) ? qualification:
0;
} |
4a22067b-0494-4ee5-ab18-7fe80f9f9826 | 1 | private void getStatsFile() throws Exception {
BufferedReader r = new BufferedReader(new FileReader("stats_"
+ nodeName + ".txt"));
String str;
while ((str = r.readLine()) != null) {
out.println(str);
}
r.close();
} |
c62b6cba-f730-41d5-882d-f686933ebf68 | 7 | DBPort get( boolean keep , ReadPreference readPref, ServerAddress hostNeeded ){
DBPort pinnedRequestPort = getPinnedRequestPortForThread();
if ( hostNeeded != null ) {
if (pinnedRequestPort != null && pinnedRequestPort.serverAddress().equals(hostNeeded)) {
r... |
44af325f-13aa-40b0-b248-46d713626280 | 4 | public int NumShips(int playerID) {
int numShips = 0;
for (Planet p : planets) {
if (p.Owner() == playerID) {
numShips += p.NumShips();
}
}
for (Fleet f : fleets) {
if (f.Owner() == playerID) {
numShips += f.NumShips();
... |
732952f1-8b60-4d79-ad32-3e034147325e | 6 | private boolean alter() throws UnsupportedEncodingException
{
if(storeName == null || storeName.isEmpty())
return false ;
if(storeAddr == null || storeAddr.isEmpty())
return false ;
String tempName = new String(storeName.getBytes("ISO-8859-1"),"UTF-8") ;
Session se = HibernateSessionFactory.getSession... |
65b778f0-996d-4ae6-afac-e6269ddb1d9f | 2 | private void treeButtonClick(java.awt.event.ActionEvent evt) {
GraphElement[] ges = graph.getMinimalSpanningTree();
if (ges == null) return;
for (int i = 0; i < ges.length; i++) {
ges[i].getComponent().setColor(TREEANDMINIMUMCOLOR);
}
... |
15b47575-45c2-4de7-8407-a3d84f98e068 | 9 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
for(;;){
StringTokenizer st = new StringTokenizer(in.readLine().trim());
int N = parseInt(st.nextToken()), M = parseInt(st.nextToken());
if(M==0&&N==0)break;
int[] heads = n... |
24fa9246-eb4c-4689-80d7-4b6b8b908b34 | 8 | private static GameField parseSquares(Scanner scanner)
throws MapLoaderException {
int width = scanner.nextInt();
int height = scanner.nextInt();
if (!scanner.next().equals("SQUARES")) {
throw new MapLoaderException("Squares section not found.");
}
Square[][] map = new Square[width][height];
char s... |
4afe392b-a1f0-4c5b-91d2-1435000c64e3 | 4 | private static Set<String> writeMethods(TreeLogger logger,
GeneratorContext context, JClassType type, SourceWriter writer)
throws UnableToCompleteException {
Set<String> allUsedSelectionProperties = new HashSet<String>();
JMethod[] methods = type.getMethods();
for (JMeth... |
290cb1bf-0910-46f8-a5e8-1d54568e3f7c | 1 | public void testSetPeriod_8ints2() {
MutablePeriod test = new MutablePeriod(100L, PeriodType.millis());
try {
test.setPeriod(11, 12, 13, 14, 15, 16, 17, 18);
fail();
} catch (IllegalArgumentException ex) {}
assertEquals(0, test.getYears());
assertEquals(0,... |
7ae45114-0033-43dd-9cde-b3c10708c25c | 5 | public static boolean isBalance(TreeNode root,ArrayList<Integer> depth){
if(root == null){
return true;
}
ArrayList<Integer> left = new ArrayList<Integer>();
left.add(0);
ArrayList<Integer> right = new ArrayList<Integer>();
right.add(0);
if(isBalance(root.left,left)&&isBalance(root.right,right)){
in... |
b12c11a0-1f1f-4a69-b3c0-952b4ae00f07 | 4 | private void checkForRepeatRun(Object n, ArrayList array, int[] arrayTotal){
if (array.isEmpty()) {
array.add(n);
} else {
if (array.contains(n)) {
array.add(n);
if (array.size() >= 7) {
array.clear();
arr... |
db0681fe-aff0-40ff-a71b-870c3766bcac | 8 | @Override
protected void commandReceived(Object command) {
if (command instanceof Command) {
Command message = (Command)command;
String action = message.getCommand();
System.out.println("Command received: "+action);
if (action.equals("set_username")) {
// this.username = (String)message.getBaggage();
... |
6716dd44-8b14-4d2d-8b07-c77c3b18d362 | 0 | @Override
public boolean isConnected() {
return connected;
} |
e400d1c3-c677-4866-a837-895373fd3e04 | 3 | public model.Order getOrder() {
model.Order order = new model.Order();
DefaultTableModel tm = viewCustomer.getTmodel();
for (int i = 0; i < tm.getRowCount(); i++) {
Object t = tm.getValueAt(i, 4);
if (t == null)
continue;
int x = Integer.parseInt(t.toString());
if (x > 0) {
Product product = n... |
81994c2e-5825-4627-9069-1abc069b27e2 | 5 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Tuple)) return false;
Tuple tuple = (Tuple) o;
return !(key != null ? !key.equals(tuple.key) : tuple.key != null) && !(value != null ? !value.equals(tuple.value) : tuple.value != null);
... |
55943f1c-7310-463f-bb26-38b7e3c688bf | 4 | private static String getNextChild(String s)
{
int end;
int nest;
end = 0;
nest = 0;
while (s.charAt(end) != ')' || nest > 1)
{
if (s.charAt(end) == '(')
nest++;
else if (s.charAt(end) == ')')
nest--;
end++;
}
return (s.substring(0, end + 1));
} |
25e48e57-889d-4003-9c1c-616619174c15 | 0 | @Override
public String getCur() {return cur;} |
5827ed65-1797-4fe5-95c8-da50c9f40ad3 | 6 | private void generateDummyHardwareAlternatives() {
if (cpuAlternatives.size() == 0)
cpuAlternatives.add(new HardwareAlternative("", ""));
if (hddAlternatives.size() == 0)
hddAlternatives.add(new HardwareAlternative("", ""));
if (memoryAlternatives.size() == 0)
memoryAlternatives.add(new HardwareAlternati... |
74cf6030-aca6-459a-af54-91943fa1bc59 | 8 | public void putAll( Map<? extends Double, ? extends Character> map ) {
Iterator<? extends Entry<? extends Double,? extends Character>> it =
map.entrySet().iterator();
for ( int i = map.size(); i-- > 0; ) {
Entry<? extends Double,? extends Character> e = it.next();
thi... |
809033c0-bac3-4cee-b3f0-469f4b56636d | 7 | @Override
public boolean tick(Tickable ticking, int tickID)
{
if(!super.tick(ticking, tickID))
return false;
if(ticking instanceof MOB)
{
final MOB mob=(MOB)ticking;
if(mob != invoker())
{
if((invoker()!=null)&&(!CMLib.flags().isInTheGame(invoker(), true)))
{
unInvoke();
return fal... |
94937d2d-4d73-4e1c-b48c-130a82d8873b | 9 | public boolean isWall(int x, int y, int direction) {
if (isBorder(x, y, direction))
return true;
switch (direction) {
case NORTH:
if( y<=0 )
return true;
else
return (columnWalls[x][y - 1]);
case SOUTH:
if( y>=(this.rows-1))
return true;
else
return (columnWalls[x][y]);
case EAS... |
d7e0c6af-b64f-4957-9a67-d9d6de64d58d | 4 | @Override
public HerbType type() {
if (empty()) {
return HerbType.HERB_PATCH;
}
if (dead()) {
return HerbType.DEAD;
}
final int bits = bits();
for (HerbType type : HerbType.values()) {
if (type.valid(bits)) {
return type;
}
}
throw new IllegalArgumentException("Unknown herb type! bit... |
f43266d0-273e-4bc7-a4c7-6446b0b0052f | 8 | public AbstractSaveConvertor(Class<T> clazz, final String namespace,
final String localName, final Connection con,
final String sqlExists, final String sqlInsert,
final String sqlUpdate, final String sqlInsertNoGis,
final String sqlUpdateNoGis) throws SQLException {
... |
81dee1a2-d7f5-4501-bed2-ff91623bbd28 | 6 | public static void Command(CommandSender sender)
{
if(sender.hasPermission("gm.survival.all"))
{
for(Player player : Bukkit.getServer().getOnlinePlayers())
{
if (player.getGameMode() != GameMode.SURVIVAL)
{
player.setGameMode(GameMode.SURVIVAL);
if(sender instanceof Player)
{
me.... |
cb26a061-c9c4-4c17-8228-929a614a7ef9 | 8 | private int copyFieldsWithDeletions(final FieldsWriter fieldsWriter, final IndexReader reader,
final FieldsReader matchingFieldsReader)
throws IOException, MergeAbortedException, CorruptIndexException {
int docCount = 0;
final int maxDoc = reader.maxDoc();
if (match... |
e7d26eab-12f4-4069-b87a-b8a97ec47740 | 4 | @SuppressWarnings({ "rawtypes", "unchecked" })
public static Enum<?> parseEnum(String s) {
String className = s.split(":")[0];
String value = s.split(":")[1];
for (Class<? extends Enum> c : enums_) {
if (c.getSimpleName().equals(className)) {
return Enum.valueOf(c, value);
}
}
return null;
} |
68e5baa7-ea1a-46c9-bd1c-d96021b4317d | 2 | private void loadConfig(){
FileConfiguration config = new YamlConfiguration();
try{
config.load(this.getResource("config.yml"));
/**
* debug is initialized to true in case there is a problem reading the
* confi... |
d1551164-04dc-4cde-8c2c-ae5c9d89b4be | 8 | private static BigFraction parse(String s){
try{
if(s == null){
return null;
}
if(s.isEmpty()){
return null;
}
char[] c = s.toCharArray();
c = removeChar(c, (char) 32);
c = removeChar(c, (char) 43);
int l = c.length;
byte[] b = new byte[l];
b[0] = findFirst(c[0]);
... |
5e29a823-5c5b-4c0a-9c30-807ace0916ed | 7 | public void talk() {
Printer.print("A person inexplicitly materalises in front of you purely for you to converse with."); // :P
TreeNode currentNode = dialogueTree.getRoot();
String input = null;// could be buggy with the space
do {
foundDialogue = false;
Printer.print(currentNode.getDialogue());
cu... |
a6c4cfc1-b450-443b-9bbb-204075316981 | 7 | public int minimumTotal(List<List<Integer>> triangle) {
int[] min = new int[triangle.size()];
int[] preMin = new int[triangle.size()];
for (int i = 0; i < triangle.size(); i++) {
if (i == 0) {
min[0] = triangle.get(0).get(0);
}
else{
for (int k = 0; k < triangle.get(i).size(); k++) {
if (k == ... |
f27575a1-a52e-4da1-b932-e9b48d659062 | 4 | @Override
public boolean blockActivated(EntityPlayer player) {
if (this instanceof ITrackReversable) {
ItemStack current = player.getCurrentEquippedItem();
if (current != null && current.getItem() instanceof IToolCrowbar) {
IToolCrowbar crowbar = (IToolCrowbar) curren... |
da95f105-7f71-4d80-95b8-b243d87aca77 | 5 | public NovacomInstallerView(SingleFrameApplication app) {
super(app);
initComponents();
String os = System.getProperty("os.name").toLowerCase();
if(os.contains("windows")) {
if(System.getenv("ProgramFiles(x86)")==null) {
jLabel2.setText("Windows 32bit");
... |
a81b9673-8648-4edb-b57a-cdd945ff15ea | 8 | private void piirraTyonnin(Graphics g, Ruutu ruutu, int data) {
int x=ruutu.getX();
int y=ruutu.getY();
int seina=data%4;
List<Integer>lukuja=new ArrayList<>();
if (data<4) {
lukuja.add(2);
lukuja.add(4);
} else {
lukuja.add(1);
... |
e0c9c156-f8d4-4c32-995f-c343104e48e6 | 6 | private void addVertices(ArrayList<Vertex> vertices, int i, int j, float offset, boolean x, boolean y, boolean z, float[] texCoords)
{
if(x && z)
{
vertices.add(new Vertex(new Vector3f(i * SPOT_WIDTH, offset * SPOT_HEIGHT, j * SPOT_LENGTH), new Vector2f(texCoords[1],texCoords[3])));
vertices.add(new Vertex(n... |
cf01aac3-ad06-4e09-a3d1-df357efc328e | 8 | public void actionPerformed(ActionEvent e) {
Object o = e.getSource();
if (o == yeastTxt){
try {
myRecipe.getYeastObj().setCost(SBStringUtils.myNF.parse(yeastTxt.getText()).doubleValue());
} catch (ParseException e1) {
e1.printStackTrace();
}
displayCost();
}
if (o == otherTxt){
... |
144aa07d-221d-45fa-a2b0-00142ac097fb | 4 | public void keyPressed(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_LEFT) {
dx = -1;
}
if (key == KeyEvent.VK_RIGHT) {
dx = 1;
}
if (key == KeyEvent.VK_UP) {
dy = -1;
}
if (key == KeyEvent.VK_DOWN)... |
5942a185-b792-4bbb-869a-68d0102e4e42 | 4 | public void finDuJeu() {
int tailleTexte = 0;
if (Configurations.getGrilleX() < 20) {
tailleTexte = 0;
}
else if (Configurations.getGrilleX() < 30) {
tailleTexte = 4;
}
else if (Configurations.getGrilleX() < 40) {
tailleTexte = 8;
}
else if (Configurations.getGrilleX() <= 50) {
tailleTexte... |
5cfa07f5-c7bd-44a5-a7fb-4d106f7cccc5 | 9 | public int majorityNumberTwo(ArrayList<Integer> nums, int k) {
int len = nums.size();
if (len < k) {
return -1;
}
Map<Integer, Integer> map = new HashMap<Integer, Integer>();
for (int x : nums) {
if (map.size() < k && !map.containsKey(x)) {
map.put(x, 1);
... |
d454f553-b516-42ed-bf3c-cc3928c60175 | 6 | public void run() {
while (true) {
try {
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
while (true){
String consoleInput = in.readLine();
Stri... |
7ba13af7-418a-489b-bf3b-29bede6512cd | 5 | public void handle() {
// Make sure the player is not already on the server; if so, ignore this packet:
if (World.getPlayers().length >= BBServer.getConfig().getPlayerCap()) {
BBServer.getSenderDaemon().outgoingPacketQueue.add(new Packet01AuthResponse(username, 0, address, port));
System.out.println("Player "... |
394fe1a0-788a-433a-8e52-0bb341a92366 | 7 | private void backButtonAction() {
// check if it's ok
if(currentStepIndex<=1 || currentPanel==null)
return;
currentPanel.saveUserInput();
lastPressed = "back";
currentStepIndex--;
displaySteps();
// update button status
if(!nextButton.isEna... |
3041a6ec-fc06-412f-854f-16bc8c098544 | 4 | public String getStringValue() throws IOException {
if (type == INDIRECT) {
return dereference().getStringValue();
} else if (type == STRING || type == NAME || type == KEYWORD) {
return (String) value;
}
// wrong type
return null;
} |
d645634c-72c4-445e-8a7c-4915a1b54280 | 4 | private void doCommand(String cmd) {
if (cmd.startsWith("S")) {
doSleep(Integer.parseInt(cmd.substring(1)));
} else if (cmd.startsWith("X")) {
doShutdown();
} else if (cmd.equals("help")) {
doHelp();
} else if (cmd.equals("$DONE")) {
logger... |
3276232b-6499-4515-b1a1-49b7e6570050 | 6 | public static boolean isBestResult(int difficulty, long time) {
long[] times;
switch (difficulty) {
case Grid.DIFFICULTY_EASY: times = instance.easyTime; break;
case Grid.DIFFICULTY_MEDIUM: times = instance.mediumTime; break;
case Grid.DIFFICULTY_HARD: times = instanc... |
7ce947dc-fcda-496b-9da8-b463556cfb85 | 2 | private boolean invalidCall(Server server, long ID) {
for (Player p : server.players) {
if (p.getReaderThreadID() == ID)
return true;
}
return false;
} |
572583e6-2e1b-421c-b308-a215b1a9d7dc | 0 | public void setVisible(boolean isVisible) {
super.setVisible(isVisible);
log.setVisible(isVisible);
} |
5ff97286-b118-4ce3-a6cf-b801f1b32bdc | 0 | @Override
public String toString() {return String.valueOf(cur);} |
37023c9d-365e-4ea7-8193-52cbdce5d61e | 6 | @Override
public BencodeTreeNode getChild ( Object parent, int index ) {
Value<?> vprt = ( (BencodeTreeNode) parent ).getValue();
if ( vprt instanceof ListValue ) {
return new BencodeTreeNode( ( (ListValue) vprt ).get( index ), vprt, index );
} else if ( vprt instanceof DictionaryValue ) {
Iterator<... |
31ab2506-d5a4-4085-9234-6e6e2b128c2f | 6 | public static void downloadFile(File file, String location) {
BufferedInputStream input = null;
FileOutputStream output = null;
try {
URL url = new URL(location);
input = new BufferedInputStream(url.openStream());
output = new FileOutputStream(file);
byte data[] = new byte[1024];
int count;
w... |
b4d13af7-c478-4a23-a426-e1a6e96817d9 | 0 | public String toString(String input) {
return "("+input+")^"+_power;
} |
ce24c456-0cb7-44af-9069-e9546b37e987 | 4 | public static void payFine(int fineId){
try {
if(conn == null || conn.isClosed()){
conn = DatabaseConnection.getConnection();
}
} catch (SQLException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try{
conn.setAutoCommit(false);
PreparedStatement ... |
f20ee5a5-469f-496a-adc8-fb63e889b780 | 6 | public static Class getModelIdType(Class model) {
if (model.isAssignableFrom(Model.class))
throw new IllegalArgumentException(EXC_NOTAMODEL);
Method[] declareds = CommonStatic.getDeclaredGetters(model);
Class returnType = null;
boolean found = false;
for (Method m : declareds)
if (m.isAnnota... |
7ba3215d-c09b-4c71-9a06-b4edc90d0d86 | 5 | public PTrailer loadTrailer(long position) {
PTrailer trailer = null;
try {
if (m_SeekableInput != null) {
m_SeekableInput.beginThreadAccess();
long savedPosition = m_SeekableInput.getAbsolutePosition();
m_SeekableInput.seekAbsolute(position);
... |
e81c6ac3-d49a-4ea5-99a1-92770eaf742e | 2 | public static long find(String name) throws SQLException {
long catID = -1;
for(Category c : list())
if (c.getName().equals(name))
catID = c.getId();
return catID;
} |
357d4bd8-b31c-4a2a-b849-0eaa9b314a76 | 0 | public void setImageUrl(String imageUrl) {
this.imageUrl = imageUrl;
} |
93ecbb94-3a42-4f37-b4b2-3ae2dbadd84f | 4 | public int geocode(DataSetDescriptor dsd, String address) {
NominatimConnector nm = new NominatimConnector("http://nominatim.openstreetmap.org/search.php");
nm.setFormat("json");
boolean containColumn = address.contains("{");
int rowCont = 0;
if(!containColumn){
// In order to not contain a column name int... |
155979a1-4ad9-4d43-835d-74e8c6f4c89a | 1 | public java.security.cert.X509Certificate[] getAcceptedIssuers() {
java.security.cert.X509Certificate[] chain = null;
try {
TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
KeyStore tks = KeyStore.getInstance("JKS");
tks.load(this.getClas... |
93fea00e-4218-4d71-8a05-555569630827 | 1 | public Integer call() throws InterruptedException {
int sum = 0;
for (int i = 0; i < 100000; i++) {
sum += i;
}
System.out.println(numberOfThread);
return numberOfThread;
} |
c361b688-8276-410f-96db-17511c320f0b | 2 | @SuppressWarnings("unchecked")
public static float[][] restoreData(String findFromFile) {
float[][] dataSet = null;
try {
FileInputStream filein = new FileInputStream(findFromFile);
ObjectInputStream objin = new ObjectInputStream(filein);
try {
dataSet = ( float[][]) objin.readObject();
} catch ... |
b15e6ac5-0cf0-466a-b807-83a8698e2610 | 4 | public void addCacheItem( int cacheId, int cacheItem )
{
int insertIndex = 0;
for( BiffRec br : pivotCacheRecs.get( cacheId + 1 ) )
{
if( br.getOpcode() == SXFDB )
{
((SxFDB) br).setNCacheItems( ((SxFDB) br).getNCacheItems() + 1 );
}
else if( br.getOpcode() == EOF )
{
insertIndex = pivotCa... |
cde71739-cd4d-420c-8953-fbd5527bb150 | 2 | public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
if (!ClassReader.ANNOTATIONS) {
return null;
}
ByteVector bv = new ByteVector();
// write type, and reserve space for values count
bv.putShort(cw.newUTF8(desc)).putShort(0);
AnnotationWriter aw = new AnnotationWriter(... |
7b9c78b1-b7e8-41bf-afd6-a8bacc217fde | 7 | private void printIssueInfos() throws ParseException, IOException{
boolean cutoff_c = false;
boolean cutoff_n = false;
for (IssueInfo issueInfo : issueInfos) {
String issueInfoPrint = "";//TODO: issueInfo.printString(socialGraph);
String durationInfo = "";//TODO: issueInfo.printDurations();
if(!issue... |
766a2fab-5910-4bd9-9d3c-c945654d8c6a | 0 | @Override
public String toString()
{
return "isAnnotation()";
} |
d4b8061e-e8fc-4eac-a69e-232252b9bbaa | 1 | private boolean jj_3_29() {
if (jj_3R_46()) return true;
return false;
} |
b879e098-2e04-4b9d-bc9d-69253919afaf | 0 | public void setRegion(String region) {
this.region = region;
} |
588f2d73-01ad-4361-aec5-e3633575810f | 1 | private void emitKeyValues(String key, String... values) {
emitKey(key);
startArray();
for (String value : values) {
emitTabs();
mOut.print("<string>"); //$NON-NLS-1$
mOut.print(value);
mOut.println("</string>"); //$NON-NLS-1$
}
endArray();
} |
7bb5bbcc-b23a-4e61-bc01-f250a6dafb45 | 6 | public void updateRightSideLabels() {
for (JLabel label : rolesList) {
label.setText("");
}
rolesList.clear();
// String roleToString = "";
//
// for (Role role : balance.getChosenRoles()) {
// roleToString = role.toString();
// i... |
c68e51c9-f622-44f6-954a-2b7fc24f84a3 | 9 | @Override
public Object deponiUovo(String token, String idDinosauro) {
try {
if (myLogica.isMioTurno(token)) {
if ( myLogica.getPlayerByToken(token).getRazza().existsDinosauroWithId(idDinosauro)) {
String ret = myLogica.doDeponiUovo(token, idDinosauro);
if (ret != null) { return "@ok," + ret; }
... |
40344237-ef50-4d9a-826a-7e1075ace903 | 4 | public File saveGrammarDialog(final File cur) {
File dir = cur;
if(dir == null || !dir.exists()) {
dir = INI.getObject("last", "grammarDir", Converter.FILE_CONVERTER, HOME_STR);
}
final JFileChooser choose = new JFileChooser(dir);
choose.setMultiSelectionEnabled(false);
choose.setFileSelec... |
ed46adb6-86cd-413a-92bb-2922a3ebaf97 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
CardCombination other = (CardCombination) obj;
if (cardCombinationEnum != other.cardCombinationEnum)
return false;
if (cards == null) {
i... |
f37702fc-f9c3-4b47-8231-a782ed288dde | 3 | public synchronized void broadCast(String message,User user){
for(User client:users){
if(client==null)continue;
if(client != user)
client.getChatSocket().sendMessage(message);
}
} |
8cb54f85-5c59-48cf-b739-aaea9161872b | 9 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Country other = (Country) obj;
if (country == null) {
if (other.country != null)
return false;
} else if (!country.equals(other.country)... |
764d7512-cdf7-450e-a6bd-e8aa35a503c1 | 8 | private void flipHorizontal() {
switch(direction)
{
case NORTH:
case SOUTH:
break;
case EAST:
setDirection(Direction.WEST);
break;
case WEST:
setDirection(Direction.EAST);
break;
case NORTHEAST:
setDirection(Direction.NORTHWEST);
break;
case NORTHWEST:
setDirection(Direction.NORT... |
fff593f4-ac5c-49d3-907c-2a002f97bb6d | 9 | private Long getExpiration(URLConnection connection, long baseTime) {
DateFormat PATTERN_RFC1123 = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); //, Locale.US
String cacheControl = connection.getHeaderField("Cache-Control");
if (cacheControl != null) {
java.util.StringToke... |
76883e13-ef0f-4b3b-a46c-5f93c64a2706 | 4 | @Override
public String toString () {
switch (operation) {
case 0: return "sync operation (" + toEnd + ") to " + startPosition;
case 1: return "insert " + data + "(" + toEnd + ")" + " to " + startPosition + " position";
case 2: return "delete " + "data" + " from " + startPosition + "-" + endPosition + " posit... |
a8e8bbb3-e6ee-4f23-81de-1ad1713eed1d | 2 | public void setStringAndReminder( String valueName, String s ) {
JTextField valueField = stringMap.get( valueName );
if ( valueField != null ) valueField.setText(s);
if ( remindersVisible ) setReminder( valueName, s );
} |
8bd64c87-1ea6-4fca-83b0-fabe48d039c6 | 4 | public void writeResultSetSlice(ResultSetSlice rss) throws IOException {
if (trace == API_TRACE_DETAILED) {
Log.current.println("writeResultSetSlice = " + rss);
}
ResultSet rs = rss.resultSet();
int first = rss.first();
int last = rss.last();
int columnCount = rss.columnCount();
... |
0d199f36-ef0b-4574-a5cd-a46bdcb34175 | 3 | private String process_HTTP_request(String text)
{
Pattern p = Pattern.compile("GET \\/([\\w\\.]*) HTTP");
Matcher m = p.matcher(text);
if (m.find())
{
String filename = m.group(1);
if (filename.matches("\\s*") || filename == null)
filename = "file.txt";
return read_file(filename);
}
else
{
... |
303e8b9e-b6e9-4fb1-87c8-ea9fc31c7b28 | 5 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
while ((line = in.readLine()) != null && line.length() != 0) {
int nCase = Integer.parseInt(line.trim());
for (in... |
c1927835-ce4d-4372-a78c-2dd02757359f | 4 | public static void rooked(int i, int j, int cur) {
max = Math.max(max, cur);
for (int k = 0; k < size; k++) {
for (int l = 0; l < size; l++) {
if (m[k][l] == '.' && checkPos(k, l)) {
m[k][l] = 'o';
rooked(0, 0, cur + 1);
m[k][l] = '.';
}
}
}
} |
4d87bed7-a8f5-4846-b4dc-d4b14ee84972 | 2 | public boolean checkParams(Map<String, String> params) {
Iterator<ParamCons> it = nConstraint.iterator();
while(it.hasNext()) {
ParamCons cons = it.next();
if(!checkOneParam(cons, params.get(cons.name))) return false;
}
return true;
} |
9552ddda-dde7-437a-92ba-4921a7a35bfb | 6 | public static void main(String[] args) throws Exception {
int ponder = 5;
if (args.length > 0)
ponder = Integer.parseInt(args[0]);
int size = 5;
if (args.length > 1)
size = Integer.parseInt(args[1]);
ExecutorService exec = Executors.newCachedThreadPool();
... |
40783f9b-54b6-47d1-bd72-58fe198f8666 | 4 | public void setVar(List<?> list)
{
for(PVar e : this._var_)
{
e.parent(null);
}
this._var_.clear();
for(Object obj_e : list)
{
PVar e = (PVar) obj_e;
if(e.parent() != null)
{
e.parent().removeChild(e);
... |
9815659e-0a8e-4199-b1d3-b18ff70e0185 | 7 | public static List<Cottage> getAllCottages(boolean refresh) throws SQLException
{
if (!refresh)
{
if (staticCottages != null)
return staticCottages;
}
List<Cottage> cottages = new ArrayList<Cottage>();
List<Zip> zips = ZipConnect.getAllZip(false);
List<CottageType> types = getAllCottageTypes();
String... |
2640fda5-1306-4e8b-aa3f-7f22435d6128 | 5 | public ArrayList<Customer> deleteCustomer(ArrayList<Customer> c)
{
boolean looking = true;
String proposedFirst = null;
String proposedLast = null;
while (looking)
{
boolean notFound = true;
System.out.println("Please enter the first name of the customer that you would like to delete.");
propose... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.