method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ef9cb443-406e-4ddd-a03b-bfc97ad2abbb | 3 | public void loadAll() throws IOException
{
//xstream
XStream xstream = new XStream();
xstream.alias("configuration", Configuration.class);
xstream.alias("domain", Domain.class);
xstream.alias("mimeType", MimeType.class);
try
{
this.element = this.loadFromFile(xstream);
}
catch (IOException ioEx... |
6b369aa4-9fae-40c5-b8c3-deb8355e81ab | 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... |
617d4390-368d-4b2d-a5fb-48377b753c4f | 4 | public boolean Reset(String ticket, String lastName) throws Exception {
try {
//Load the MySQL driver
Class.forName("com.mysql.jdbc.Driver");
//Setup the connection with the database
conn = DriverManager.getConnection("jdbc:mysql://" +dbHost+ ":" +dbPort+ "/" +dbName, dbUser, dbPass);
//Create s... |
c6d05742-e65a-4026-9e8a-765001f44411 | 9 | public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BasketItem other = (BasketItem) obj;
if (getRecordId() == null) {
if (other.getRecordId() != null)
return false;
} else if (!getRecordId().equals(o... |
b7103219-8a98-4f0c-a9a9-4dba248ce8ee | 1 | public void actionPerformed(ActionEvent e) {
Grammar g = environment.getGrammar(UnrestrictedGrammar.class);
if (g == null)
return;
ChomskyPane cp = new ChomskyPane(environment, g);
environment.add(cp, "Test", new CriticalTag() {
});
environment.setActive(cp);
} |
3c1aa39b-d8c0-4773-8a1a-4fde124ca2e4 | 6 | public List<NamedEntity> getNamedEntities(String text)
throws NamedEntityExtractorException{
ArrayList<NamedEntity> entities = new ArrayList<NamedEntity>();
/*
* please refer to the stanford-ner package documentation to find out
* what this is all about
*/
List<List<CoreLabel>> labeledSen... |
7da3b5a5-fe8f-4366-9061-149842ce5ce4 | 2 | private static File getOutputDir() {
File file = new File(properties.getProperty("usecase.outputdir") + "/pandemie");
if (!file.mkdirs() && !file.exists()) {
throw new RuntimeException("Fail to create output directory at " + file);
}
return file;
} |
f6c94e9e-3928-4a52-88fa-d32a109e280e | 7 | void endParagraph() {
finishWord();
if (!_endnote) {
if (!_firstPar && _fill) {
writeBlankLines();
}
_firstPar = false;
if (_fill) {
processPhil();
} else {
emitLine(_wordLine, _firstLine
... |
82823b67-d2ed-4146-aeb9-0e893dbcc56d | 2 | void schedule(long delay, TimeUnit delayUnits) {
if (mKey != null) {
synchronized (PENDING) {
if (!PENDING.add(mKey)) {
mWasCancelled = true;
return;
}
}
}
EXECUTOR.schedule(this, delay, delayUnits);
} |
74d0fc18-8b38-4d08-8ed9-72de533a4617 | 0 | public CmdAddExecutor(SimpleQueues plugin) {
this.plugin = plugin;
} |
c8067434-9a73-4bea-b9a2-b6bbc3dffcb3 | 5 | public static void inputCommand(){
System.out.println("\n0:Add 1:All 2:Search 3:Delete 9:EXIT ");
Scanner scCommand = new Scanner(System.in);
System.out.print("=>");
String inputCommand = scCommand.next();
if(inputCommand.equals("0")){
System.out.println("Action: new contact");
System.out.pr... |
b7a3233f-dd2d-4290-b889-5f02d47e7e77 | 4 | public World(int width) {
// Create the squares
squares = new Square[width][width];
for (int x = 0; x < width; x++) {
for (int y = 0; y < width; y++) {
squares[x][y] = new Square();
}
}
setUp(width);
// Place the agent
// If the entire world is full of obstacles, this loop runs forever
while (... |
48481d32-5833-4d1e-8f4b-31d3fe8577da | 4 | public static void setLogForName(final String str) {
if (str.equalsIgnoreCase("Normal logs -> Normal planks")) {
plankSet = 1;
} else if (str.equalsIgnoreCase("Oak logs -> Oak planks")) {
plankSet = 2;
} else if (str.equalsIgnoreCase("Teak logs -> Teak planks")) {
plankSet = 3;
} else if (str.equalsIgn... |
f626c408-3da5-4c37-bdfe-0363c78ab0b8 | 1 | public void updateType() {
if (!isVoid())
updateParentType(subExpressions[0].getType());
} |
524d5917-4169-4874-bf0d-3cec98cff49e | 2 | public boolean pollin (int index) {
if (index < 0 || index >= this.next)
return false;
return items [index].isReadable();
} |
3189d913-2f0e-415e-b5f3-89878a184c31 | 2 | public synchronized void stop() //Use synchronized when stopping thread
{
if(running)
{
running = false;
try {
gameThread.join();
}
catch (InterruptedException ex) {
System.out.println(ex.getMessage());
}
... |
db10bae4-795c-45a4-a3f6-f96d60f3b26d | 2 | public void updateConfigureButtonState() {
if (comboBox.getModel().getSelectedItem().equals("Contestant")) {
if (lblIpVerification.getText().equals("Valid IP Address"))
btnConfigure.setEnabled(true);
else
btnConfigure.setEnabled(false);
} else
btnConfigure.setEnabled(true);
} |
2ba887ec-e931-4af0-8044-b9fafd392eb6 | 6 | public void bulkLoad(IndexPair[] pairs, int offset, int length) {
if (length > capacity) {
throw new RuntimeException("Cannot write " + length
+ " elements to a block of size " + capacity);
}
if (length == 0) {
return;
}
OutputStream out = null;
try {
out = new BufferedOutputStream(new FileOut... |
eaffb737-b059-4992-b561-52042503e7b8 | 2 | public static Point getResolution(int i) {
if (i == 16) {
//full screen
return new Point(0, 0);
} else {
String resString = (String) resolutions.get(i);
String[] resParts = resString.split("x");
Point res = null;
if (resParts.length... |
3deb16d6-f099-4473-abef-6a4be29addd2 | 7 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
if (!(obj instanceof BtcPeer))
return false;
BtcPeer other = (BtcPeer) obj;
if (networkAddress == null) {
if (other.networkAddress != nul... |
c89f3dbe-81e5-4485-ae0e-2fa92c71d7d8 | 0 | public String getNome()
{
return this.nome;
} |
c007fbd7-e503-4a3a-a36f-eecc3f1f8d36 | 1 | @Override
public boolean hasNext() {
if (index < array.length) {
return true;
} else {
return false;
}
} |
5aac5913-2c66-4947-93ec-5ffc7c8b65a3 | 7 | public Hashtable<String, Integer> getShortestPaths(Vertex node)
{
_distances = new Hashtable<String, Integer>();
_predecessors = new Hashtable<String, Vertex>();
_unoptimizedNodes = new ArrayList<Vertex>(_nodes);
for(Vertex vertex : _nodes)
{
_distances.put(vertex.toString(), Integer.MAX_VALUE);
}
... |
e25f7351-7f79-423e-bea5-4efc18b57327 | 7 | private boolean jj_3R_50() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(9)) {
jj_scanpos = xsp;
if (jj_scan_token(19)) {
jj_scanpos = xsp;
if (jj_scan_token(26)) {
jj_scanpos = xsp;
if (jj_scan_token(24)) {
jj_scanpos = xsp;
if (jj_scan_token(28)) {
jj_scanpos = xsp;
... |
882e54d3-28c5-4f26-8523-5f3caed5cf91 | 0 | protected DiscountStrategy(double price, int copies) {
this.price = price;
this.copies = copies;
} |
502abe3d-8cba-45fe-9739-e9a21fc47056 | 9 | @Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
ProxyKey key = mappings.get(method);
Class<?> type = method.getReturnType();
if (key != null) {
if (type == void.class) {
setValue(args, key);
... |
dc71c7a6-f323-45b1-80ad-ae8a411e7259 | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "Manifest")
public JAXBElement<ManifestType> createManifest(ManifestType value) {
return new JAXBElement<ManifestType>(_Manifest_QNAME, ManifestType.class, null, value);
} |
68be540c-c6fd-40f6-832a-434fccab9999 | 4 | protected IQueueServiceListener[] getQueueServiceListenersByJob(IJob job){
IQueueServiceListener[] allWithoutJobID = getQueueServiceListeners();
IQueueServiceListener[] result = allWithoutJobID;
if (listenerByJobs.containsKey(job.getJobId()) && listenerByJobs.get(job.getJobId()) != null){
IQueueServiceListe... |
d3652afb-4138-4320-933c-533a6a2d43fb | 9 | public TableView(int height) {
entries = new ArrayList<Item>();
listeners = new HashSet<SymbolSelectionListener>();
showFrequencies = true;
final String[] header = { "Symbol", "Codeword", "Frequency" };
tableModel = new AbstractTableModel() {
@Override
public String getColumnName(int col) {
return ... |
2d890b43-2a8d-41ff-bcd4-6e4b814f9e6e | 9 | protected String getNewThreadName(String base_name, String addr, String cluster_name) {
StringBuilder sb=new StringBuilder(base_name != null? base_name : "thread");
if(use_numbering) {
short id;
synchronized(this) {
id=++counter;
}
sb.appen... |
d9a62b18-f4fa-4c25-8028-3cb03d45317c | 7 | @EventHandler
public void WitherHarm(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.getZombieConfig().getDouble("Wither.Harm.Dodge... |
93cc8a82-31df-4a1f-87eb-7dee3a1a48ce | 2 | public int compare(Node arg0, Node arg1) {
if(arg0.f > arg1.f)
return 1;
else if(arg0.f < arg1.f)
return -1;
return 0;
} |
b75600e8-b314-4db1-b97b-202f993c9eb1 | 9 | }
// -----------------------------------------------------------------------
@Override
public DateTimeValueRange range(DateTimeField field) {
if (field instanceof ChronoField) {
ChronoField f = (ChronoField) field;
if (f.isDateField()) {
switch (f) {
case DAY_OF_MONTH:
... |
04a28a14-ed46-4f45-b073-80ea0e7ba101 | 5 | public static void nameGame(String inputName)
{
int i = 0;
while (inputName.charAt(i) != 'u' && inputName.charAt(i) != 'e'
&& inputName.charAt(i) != 'o' && inputName.charAt(i) != 'a'
&& inputName.charAt(i) != 'i')
{
i++;
}// while
String tempName = inputName.subst... |
6ef21b61-d390-403e-806b-76885afd101b | 7 | public static Rule_dirLocal parse(ParserContext context)
{
context.push("dirLocal");
boolean parsed = true;
int s0 = context.index;
ArrayList<Rule> e0 = new ArrayList<Rule>();
Rule rule;
parsed = false;
if (!parsed)
{
{
ArrayList<Rule> e1 = new ArrayList<Rule>();
... |
88a75552-f3a4-48e7-819b-f53535346c4f | 2 | static void difference(Class<?> superset, Class<?> subset) {
System.out.print(superset.getSimpleName() + " extends "
+ subset.getSimpleName() + ", adds: ");
Set<String> comp = Sets.difference(methodSet(superset),
methodSet(subset));
comp.removeAll(object); // Don't show 'Object' methods
System.out.print... |
4918c114-7817-4137-8841-cc90f1803d68 | 5 | private void printNode(Node n)
{
boolean goLeft = false, goRight = false;
System.out.print("Node: " + n.hashCode());
if (n.value != null)
{
System.out.println("\tValue: " + n.value);
}
if (n.leftChild != null)
{
System.out.println(" Left Child: " + n.lef... |
79d0d31b-5475-4ae3-a35c-ac03da158aaf | 6 | public void change(){
bu1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Clink and Select");
JFileChooser chooser = new JFileChooser();
if(jb1.isSelected()){
FileNameExtensionFilter filter = new FileNameExtensionFilt... |
10dded5a-714f-4f9b-ab8d-bf7ad8ef5bf5 | 8 | public void onBlockPlaced(World par1World, int par2, int par3, int par4, int par5)
{
int var6 = par1World.getBlockMetadata(par2, par3, par4);
int var7 = var6 & 8;
var6 &= 7;
if (par5 == 2 && par1World.isBlockSolidOnSide(par2, par3, par4 + 1, 2))
{
var6 = 4;
... |
005ef687-5486-4aca-91d4-62f70197fb2d | 0 | public void copyTo(TicketQueryArgs other)
{
other._action = this._action;
other._count = this._count;
other._date = this._date;
other._departureStation = this._departureStation;
other._destinationStation = this._destinationStation;
other._seatType = this._seatType;
other._sequence = this._sequence;
oth... |
75ab02dc-445b-4d98-8cef-0179ce4a9e41 | 1 | public boolean authenticate()
{
try
{
listServerIds();
return true;
}
catch (Exception e)
{
return false;
}
} |
ecdaa878-8d08-4add-a7c9-e3839f33b56c | 5 | @Override
public void run() {
for (int i = from; !Thread.interrupted() && done.getCount() > 0
&& i < to; i++) {
BigInteger exp = new BigInteger(Integer.toString(i));
BigInteger gbx1 = gB.modPow(exp, p);
for (int k = 0; k < xx.length; k++) {
BigInteger val = xx[k].get(gbx1);
if (val != nu... |
22722953-b96f-4d82-94db-b0177dbdee86 | 9 | @Override
protected Post instanceFromResultSet(ResultSet rs, Set<Enum> selectedFields) throws SQLException {
boolean allFields = selectedFields == null || selectedFields.isEmpty();
long id = rs.getLong("id");
return new Post(id,
allFields || selectedFields.contains(Post._Fields.title) ? rs.getString... |
4b205bc3-605c-4913-bd8e-5b347ad0b6d2 | 6 | private static HashMap<Integer, User> buildUsersFromJsonData(String path) {
HashMap<Integer, User> userMap = new HashMap<Integer, User>();
JSONParser parser = new JSONParser();
try {
Object obj = null;
try {
obj = parser.parse(new FileReader(path));
} catch (org.json.simple.parser.ParseExcepti... |
b2cdbf66-5f6c-49fd-9b15-ea56e744cf47 | 6 | public boolean addHeightOffset(Location spawnLoc, int playerHeight, int heightRange)
{
if (heightOffset == 0)
return true;
if (!RandomLocationGen.findSafeY(spawnLoc, playerHeight + heightOffset, heightRange, requirements == null || requirements.requireOpaqueBlock))
return false;
Block b = spawnLoc.getBl... |
2627a4bd-4f9b-404c-8b2c-3b251ccae5d7 | 8 | final void method1716(boolean bool) {
anInt5864++;
if (method1735(bool)) {
if (((Class348_Sub51) ((Class239) this).aClass348_Sub51_3136)
.aClass239_Sub25_7271.method1830((byte) -97)
&& !Class151.method1210((byte) -94, ((Class348_Sub51)
(((Class239) this)
.aClass348_Sub51_3136))
... |
57b81546-1e09-42d7-9bf4-74139a71de66 | 3 | public void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
//System.out.println("Debug Grid Status: " + DRAW_DEBUG_GRID);
if(DRAW_DEBUG_GRID == true)
{
int gridX = 0;
while(gridX < canvasWidth)
{
Line2D xLine = new Line2D.Double(gridX, 0, gridX, ca... |
fa17629e-5878-43d6-ab78-5470b1c6e457 | 3 | @Override
public Shape createShape(mxGraphics2DCanvas canvas, mxCellState state)
{
Rectangle temp = state.getRectangle();
int x = temp.x;
int y = temp.y;
int w = temp.width;
int h = temp.height;
String direction = mxUtils.getString(state.getStyle(),
mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_E... |
e7781263-5e7f-4027-ab46-e8d658836546 | 6 | public void sortList(){
Collections.sort(dataEntries, new Comparator<String[]>() {
@Override
public int compare(String[] o1, String[] o2) {
String[] obj1 = o1[0].split(":");
String[] obj2 = o2[0].split(":");
if(Integer.parseInt(obj1[0]) > Integer.parseInt(obj2[0])){
return 1;
} else if(Int... |
e00b00ad-8ff7-49aa-8689-8ceb62374fae | 7 | public String findLargestPalindrome(String string) {
if (string.length() > 2) {
char[] carr = string.toCharArray();
int maxPalindromeLength = Integer.MIN_VALUE;
int globalBegin = 0;
int globalEnd = 0;
for (int i=3; i<carr.length; i++) {
... |
e3c436d4-a38d-43ea-a50b-799798aa1692 | 8 | public void open()
throws DBException
{
if (null != jdbc) return;
if (!location.isDirectory())
throw new DBException("There is no valid " + this);
Throwable status = new RuntimeException("No database names have been configured");
Logger log = log();
for (int legacyIndex = 0; DB_NAMES.length > legacyInde... |
4041b4ac-d47b-4988-b737-8ed59be33b78 | 5 | public void addPatron(Patron p) {
Connection conn =null;
PreparedStatement pSt=null;
// If p is null, do nothing
if (p == null)
return;
try {
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/librarysystem?user=admin&password=123456");
String insert = "INSERT INTO Patron(cardNumber... |
104179c1-568b-4b29-91c2-bced33cd1b50 | 5 | public List<String[]> getMounts() {
List<String[]> list = new ArrayList<>();
String mount, mountpoint, mounttype, opts;
for (String m : getMountLines()) {
mount = m.substring(0, m.indexOf(" on "));
mountpoint = m.substring(m.indexOf(" on ") + 4, m.indexOf(" type "));
mounttype = m.substring(m.indexOf(" ... |
45f6f44a-8589-4b29-9e82-73deea02642e | 9 | private void parseMessage(Message msg) throws IllegalArgumentException {
try {
COMMAND cmd = msg.getCommand();
switch(cmd) {
case A:
addReplaceFile(msg.getCommand(), msg.isLastMessage(), msg.getFilename(), msg.getDataLength(), msg.getData());
break;
case C:
setCircumference(msg.getDataAsInt())... |
c962bda9-6348-4e00-9ba4-d8ecac0728d7 | 5 | private AbstractInsnNode[] makeResult(int start, int end) {
int startIndex = 0;
int endIndex = -1;
for (int i = 0; i < offsets.length - 1; i++) {
int offset = offsets[i];
if (offset == start)
startIndex = i;
if ((offset < end) && (offsets[i + 1] >= end)) {
endIndex = i;
break;
}
}
if (... |
f7b52c24-6535-4e19-82fd-3885d87d6220 | 1 | public void configureAction(Map<String, Object> config) {
if (config == null) {
this.task = null;
this.gruntFile = null;
this.page = null;
} else {
this.task = (String) config.get(Activator.KEY_TASK);
this.gruntFile = (IFile) config.get(Activator.KEY_FILE);
this.page = (IWorkbenchPage) config.get(... |
21ef5382-07ca-4b5d-9f7c-6d3d7234a659 | 1 | public void testWithFieldAdded_DurationFieldType_int_5() {
LocalTime test = new LocalTime(10, 20, 30, 40);
try {
test.withFieldAdded(DurationFieldType.days(), 6);
fail();
} catch (IllegalArgumentException ex) {}
} |
9c5c1705-5806-4e2c-88e0-ee5eee500463 | 5 | protected void authenticateUser() throws LoginException {
if (!(_currentRealm instanceof RestRealm)) {
String msg = sm.getString("restlm.badrealm");
throw new LoginException(msg);
}
final RestRealm restRealm = (RestRealm)_currentRealm;
// A JDBC user mus... |
ea167911-6530-4854-9169-c243c207bfb8 | 3 | private static char[] collectVersionFromCompare( String mvdName,
int v1, int v2, ChunkState unique, char[] original )
throws Exception
{
String vId1 = Integer.toString(v1);
String vId2 = Integer.toString(v2);
String[] args0 = {"-c","compare","-m",mvdName,"-v",vId1,
"-w",vId2,"-u",unique.toString()};
... |
420ed2c3-6120-41a6-ac17-7e028b086df9 | 8 | @Override
public boolean equals(Object obj) {
if (obj instanceof Bounds) {
Bounds other = (Bounds) obj;
return getRotation() == other.getRotation()
&& getScale() == other.getScale()
&& getHeight() == other.getHeight()
&& getWidth() == other.getWidth()
&& get(Edge.TOP_LEFT).equals(other.get... |
5c9d1176-d92e-4e00-af58-99727c9b63a1 | 9 | public SearchInvoicesResponse(Map<String, String> map, String prefix) {
if( map.containsKey(prefix + "responseEnvelope" + ".timestamp") ) {
String newPrefix = prefix + "responseEnvelope" + '.';
this.responseEnvelope = new ResponseEnvelope(map, newPrefix);
}
if( map.containsKey(prefix + "count") ) {
thi... |
66330555-fd2c-42dd-ab39-a309bf67c2f0 | 2 | public DetalleRegistro(Ticket ticket, java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
tipos = new ComboModelTipo();
monedas = new ComboModelMoneda();
estados = new ComboModelEstado();
tipo_paxs = new ComboModelTipoPax();
posiciones ... |
aba4aa7c-1c34-446a-b257-e4e245df5c41 | 2 | public boolean hasEffect(SkillEffect effect){
for (SkillEffect e: skillEffects) {
if(e == effect) return true;
}
return false;
} |
a62186ec-1842-4cde-8fca-1e221ed4d10a | 3 | public static void PrintSeparator(char ch)
{
switch(ch){
case '_':
System.out.println("___________________________________________________________________________");
break;
case '-':
System.out.println("---------------------------------... |
5332e30a-3fd8-4561-872c-7ed8d9e17d20 | 3 | public static ArrayList<SchoolBean> view(String id){
Connection con=DBConnection.getConnection();
SchoolBean sb=new SchoolBean();
ArrayList<SchoolBean> list=new ArrayList<SchoolBean>();
if(con==null)
return null;
try {
Statement pt=con.createStatement();
ResultSet rs=pt.executeQuery("select * from s... |
db2c350f-fee1-40f2-96c0-43c2c381d0a2 | 1 | public CreditsRenderer()
{
try
{
}
catch (Exception e1)
{
}
} |
ac950a29-6eda-45bd-85c9-48479db50e35 | 2 | public static Color checkColour(JTextPane pane)
{
AttributeSet attributes = pane.getInputAttributes();
if (attributes.isDefined(StyleConstants.Foreground))
{
return (Color) attributes.getAttribute(StyleConstants.Foreground);
}
if (attributes.isDefined(CSS.Attribute.COLOR))
{
String s = attributes.g... |
3479962a-6157-4cc2-bea0-5564a7e7db29 | 5 | public void setGoal(int x, int y) {
if (x < 0 || y < 0 || x >= getWidth() || y >= getHeight())
return;
// Free old position
if (this.goalPos != null) {
this.field[goalPos.y][goalPos.x] = FieldType.FREE.ordinal();
}
this.goalPos = new Point(x, y);
... |
db40291f-e472-4d80-9911-eb8dc922477d | 5 | private int parseInt(String s,int i){
String sub=s.substring(i);
char current=sub.charAt(0);
String num=String.valueOf(current);
/* on parcourt la sous-chaine jusqu'a sortir de celle-ci ou de
l'entier, lequel des 2 se produit en premier*/
int j=1;
for(j=1;j<sub.length() && Character.isDigit(current);)... |
6225c004-eea8-4934-9ef0-7c58fb1e2e67 | 6 | private static void loadFile() throws FileNotFoundException {
File inputFile = new File("topscore.txt");
Scanner inputScanner = new Scanner(inputFile);
String topscore = "";
while (inputScanner.hasNextLine())
topscore += inputScanner.nextLine();
// Separating high score file in names and scores
boolea... |
4823805d-a7f2-47a4-9ca8-3841d79de336 | 4 | private static HashMap<String, ArrayList<String>> BuildMedList() throws Exception {
HashMap<String,String> stopwords = LoadStopWords(stopwordPath);
HashMap<String,ArrayList<String>> medList = new HashMap<String,ArrayList<String>>();
File medFile = new File("NICTA/atc_20130403.txt");
BufferedReader reader = new... |
771f30d7-8d71-4f4e-8be9-e78f2e79d36c | 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... |
5b6b00a2-acae-4759-9a1b-5b4fe549c259 | 0 | public Sequencer getSequencer() {
return sequencer;
} |
366ec6ce-87d9-4c4f-baf8-84acdd97307c | 9 | private boolean validParameters(String[] parameters) {
boolean validParameters = true;
for (int i = 0; parameters != null && i < parameters.length && validParameters; i++) {
String brackets = "";
int arraySeparationIndex = parameters[i].indexOf("[");
if (arraySeparationIndex >= 0) {
br... |
7f038c66-f0d5-4520-92ba-e96d37a7b483 | 3 | public Section(int x, int y, Minesweeper game) {
this.x = x;
this.y = y;
this.game = game;
int chance = new Random().nextInt(100);
if (chance < ratio)
bomb = true;
if (!bomb) {
chance = new Random().nextInt(100);
if (chance < 10)
... |
f42661a2-faa9-42a0-b0d4-f10732554e8c | 3 | @Override
public String execute() throws Exception {
try {
Map session = ActionContext.getContext().getSession();
user = (User) session.get("User");
Criteria ucri = myDao.getDbsession().createCriteria(Campaign.class);
ucri.add(Restrictions.like("campaignName... |
f4f61244-bef1-4545-81a2-232488e4cf4e | 9 | public static void registerEntities() {
for (CustomEntityType entity : values())
a(entity.getCustomClass(), entity.getName(), entity.getID());
// BiomeBase#biomes became private.
BiomeBase[] biomes;
try {
biomes = (BiomeBase[]) getPrivateStatic(BiomeBase.class, ... |
9d0f21d9-1609-417c-81cf-be8c6af6b00f | 6 | public void run() {
long lastTime = System.nanoTime();
double nsPerTick = 1000000000D / 60D;
long lastTimer = System.currentTimeMillis();
double delta = 0;
init();
log.info("_WIDTH = " + _WIDTH);
log.info("_HEIGHT = " + _HEIGHT);
log.info("_SCALE = " + _SCALE);
if (Fullscreen) log.info("_SIZE = wid... |
32caddf6-7440-4d71-a1f1-747129e9db66 | 8 | public GrapheEntreLivraisons(int nbVertices, int[][] cost) {
this.nbVertices = nbVertices;
int tempMaxCost = -1;
int tempMinCost = Integer.MAX_VALUE;
succ = new ArrayList<ArrayList<Integer>>();
for(int i=0 ; i<nbVertices ; i++) {
for(int j=0 ; j<nbVertices ; j++) {
if(cost[i][j] > tempMaxCost) {
... |
41a1dbd2-2727-4fdd-ae73-bf766d6a25da | 8 | public boolean verify() {
if(this.getServer_ip() == null || this.getServer_ip().length()<1) return false;
if(this.getId().length()<1) return false;
if(this.getApiUser().length()<1) return false;
if(this.getApiToken().length()<1) return false;
if(this.getMysqlDump().length()<1) re... |
d41621a2-8e25-4fbf-9379-609f4f02c275 | 8 | public By getBy(String locator) {
By by;
if(locator.startsWith("//"))
by = By.xpath(locator);
else if(locator.startsWith("class="))
by =By.className(locator.replace("class=", ""));
else if(locator.startsWith("css="))
by = By.cssSelector(locator.replace... |
93089856-6d5d-47d6-b967-84591b4c3059 | 3 | @Override
public V getObject(K key) {
if (ramCache.containsKey(key)) {
return ramCache.getObject(key);
}
if (hardDiskCache.containsKey(key)) {
K tMinKey = ramCache.getMinFrequencyKey();
int tMinFrequency = ramCache.getFrequency(tMinKey);
int fr... |
eb26d8c5-2959-424a-94f7-712bf81421ba | 1 | public String getTurnPlayerName(){
return board.getIsBattingFirstTurn() ? playerAName : playerBName;
} |
5b9c3537-7a1a-4a64-85ea-bfe1f7b14ca6 | 5 | public static RiverDB readCSV (String fName) {
RiverDB riverDB = new RiverDB ();
LabeledCSVParser lcsvp = null;
try {
lcsvp = new LabeledCSVParser(
new CSVParser(
new FileReader( fName )
)
);
try {
while(lcsvp.getLine() != null){
/*
System.out.pr... |
3a97b85c-4761-4fcf-9ef2-c30c3858b7fa | 2 | @Override
public void componentResized(ComponentEvent event) {
if (gamePanel.getGraphics() != null) {
final BufferStrategy b = that.gamePanel.getBufferStrategy();
if (b != null) {
myPen.simplePen.pen = (Graphics2D) b.getDrawGraphics();
}
SimpleGraphics.this.onResize(myPen);
}
} |
42391683-2ca7-4c90-bcef-ef56811bcdbf | 0 | public void setComposition(String composition) {
this.composition = composition;
} |
71b38545-af62-4ed9-a37d-d89cf7270ac8 | 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 detail... |
78b7cb81-cf7f-431a-9834-f78f57e38c20 | 2 | @Override
public void addUser() {
try {
credentials = new BufferedWriter(new FileWriter("credentials", true));
credentials.write(this.username);
credentials.newLine();
credentials.write(this.password);
credentials.newLine();
credentials... |
8019c44c-b5fc-42da-aa8e-fbeed2c0a2fc | 7 | public Tile getTile(int x, int y) {
if (x < 0 || y < 0 || x >= width || y >= height) return Tile.voidTile;
if (tiles[x + y * width] == 0xff00FF00) return Tile.grass;
if (tiles[x + y * width] == 0xffFFFF00) return Tile.flower;
if (tiles[x + y * width] == 0xff7F7F00) return Tile.rock;
return Tile.voidTile;
} |
b93c8045-7357-47e7-8a29-a122d9a84e26 | 1 | public static byte[] genCRC16(byte[] data) {
int crc = 0x0000;
for (byte b : data) {
crc = (crc >>> 8) ^ table[(crc ^ b) & 0xff];
}
return checksumToByteArray(crc);
} |
6a66073b-a23d-4cd1-a406-458ed2607054 | 1 | public void immediatelyRenewLease() {
logger.finest("immedidately renewing the lease");
interrupt();
try {
// give time for Cyc to renew the lease
sleep(250);
} catch (InterruptedException e) {
}
} |
182ff28f-3ef1-488e-aed2-8c849ebabaf6 | 2 | protected synchronized CtMember.Cache getMembers() {
CtMember.Cache cache = null;
if (memberCache == null
|| (cache = (CtMember.Cache)memberCache.get()) == null) {
cache = new CtMember.Cache(this);
makeFieldCache(cache);
makeBehaviorCache(cache);
... |
690ab778-bd6c-4966-9dd0-e9b512fb0be8 | 3 | public boolean hasServerConfig() {
return ((url != null && !url.isEmpty()) && (apiKey != null && !apiKey.isEmpty()));
} |
5a2ce17a-aec6-41f3-a562-da68ed8738e0 | 3 | public void showCharList(char start, char end){
if(start <= end){
for(char i = start; i <= end; i++){
System.out.println(i);
}
}
else{
for(char i = end; i <= start; i++){
System.out.println(i);
}
}
} |
b5e2c8fd-541a-4da1-a135-7bcec02621ad | 0 | public void setModeleJComboBoxLabo(DefaultComboBoxModel modeleJComboBoxLabo) {
this.modeleJComboBoxLabo = modeleJComboBoxLabo;
} |
2de88eb6-32b3-4e7a-9f87-46fa7b0a9569 | 2 | @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanelProjeto = new javax.swing.JPanel();
lblNome = new javax.swing.JLabel();
lblDescriscao = new javax.swing.JLabel();
btnCad... |
d0f7e5f2-d96c-48a8-986b-e01eee135353 | 8 | public void registerPom(File file, POMInfo pomInfo) throws DependencyNotFoundException {
dep2info.put(pomInfo.getThisPom(), pomInfo);
unresolvedPoms.put(file, pomInfo);
POMInfo parentPOM = superPom;
try {
if (pomInfo.getParent() != null && !pomInfo.getParent().isSuperPom()) ... |
1c1764e6-e298-4e78-9389-466f1e9e3b39 | 6 | @Override
public void actionPerformed(final ActionEvent e) {
if (e.getSource() instanceof JButton) {
final JButton button = (JButton) e.getSource();
if (button == bestMove) {
getBestMove();
} else if (button == tilesInHand) {
requestLetters... |
d839bba3-326c-47a6-b0cb-2fd6e53a0f2d | 1 | public String getFullAlias() {
if (pack.parent == null)
return getAlias();
else
return pack.getFullAlias() + "." + getAlias();
} |
37451c5b-98f4-4b9b-9208-fe6c9d9a07ad | 9 | public void paint(GC gc, int width, int height) {
if (!example.checkAdvancedGraphics()) return;
Device device = gc.getDevice();
float scaleX = 10f;
float scaleY = 10f;
Image image = null;
switch (imageCb.getSelectionIndex()) {
case 0:
image = GraphicsExample.loadImage(device, GraphicsExample.class, "home_na... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.