method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
60ec223f-aaef-4616-bb15-defd994e3605 | 9 | public static void main(String[] args) throws BadLocationException {
// default values
int portNumber = 1500;
String serverAddress = "localhost";
String userName = "Anonymous";
// depending of the number of arguments provided we fall through
switch(args.length) {
// > javac Client username portNumber... |
22f1239b-36fe-43c1-9b20-77b60cd4592d | 8 | public void makeStructures(){
rows = new Row[DEFAULT_SIZE];
columns = new Column[DEFAULT_SIZE];
blocks = new Block[DEFAULT_SIZE];
for(int i = 0; i < DEFAULT_SIZE; i ++){
Row row = new Row();
Column column = new Column();
Block block = new Block();
... |
5e5552f8-5fd0-4d8d-9cf9-d761d649c3df | 4 | public void testBinaryCycAccess4() {
System.out.println("\n**** testBinaryCycAccess 4 ****");
CycAccess cycAccess = null;
try {
try {
if (connectionMode == LOCAL_CYC_CONNECTION) {
cycAccess = new CycAccess(testHostName, testBasePort);
} else if (connectionMode == SOAP_CYC_CO... |
004171db-57e5-4cc2-9b12-e911ad096070 | 3 | public State getTargetState(String input) {
if(input != null) {
for(Transition t:outgoingTransitions) {
if(t.getInput().contains(input))
return t.getToState();
}
}
return null;
} |
4de6314e-cfb2-413b-8d5b-2a3c54d80d95 | 4 | @RequestMapping(value = {"/EntidadBancaria/"}, method = RequestMethod.POST)
public void insert(HttpServletRequest httpRequest, HttpServletResponse httpServletResponse, @RequestBody String json) throws JsonProcessingException {
try {
ObjectMapper objectMapper = new ObjectMapper();
obj... |
a28d8e1b-3b59-429b-aef8-87d612d97a56 | 7 | public int compareTo(Object o)
{
int row1 = modelIndex;
int row2 = ((Row) o).modelIndex;
for (Iterator it = sortingColumns.iterator(); it.hasNext();)
{
Directive directive = (Directive) it.next();
int column = directive.column;
Object o1 = tableModel.getValueAt(row1, column);
Object o2 = ... |
13815a51-abfc-4606-a32e-c53ef5d1e01e | 2 | @Override
public int compare(Room o1, Room o2) {
int ret;
if(o1.value > o2.value)
{
ret = -1;
}else if(o1.value == o2.value)
{
ret = 0;
}else
{
ret = 1;
}
return ret;
} |
7511d84e-42cd-45c7-b391-d3e3e650f521 | 7 | public void gen_push_lit(SemanticRec lit, String lexeme)
{
String type = lit.getDatum(0);
Type tt = Type.valueOf(type);
comment("push lexeme: " + lexeme + " type: " + type);
switch (tt)
{
case STRING:
push("#\"" + lexeme.replaceAll("\\\\(?![nrtv])", "\\\\\... |
9cb82ddb-b7f6-4354-88db-d27b47204cc1 | 4 | private void endText(String to) {
if (to.equals("slide"))
slide.addEntity(text);
else if (to.equals("quizslide"))
quizSlide.addEntity(text);
else if (to.equals("scrollpane"))
scrollPane.addEntity(text);
else if (to.equals("feedback"))
quizSlide.addFeedback(text);
} |
d8085b40-5c60-4250-a558-76c03b5f1086 | 5 | public static void fill(GridMap<Actor> gridmap, Class actor, MapLayer layer) {
if (Actor.class.isAssignableFrom(actor)) {
Grid<Actor> grid = gridmap.getLayer(layer);
for (int row = 0; row < grid.getNumRows(); row++) {
for (int col = 0; col < grid.getNumCols(); col++) {
... |
ec901ada-560f-4fcc-bda4-007ad581022f | 0 | public String getPassword() {
return password;
} |
c94e6278-7bdf-493e-8ca6-205377f87a36 | 5 | public boolean loadSamples(){
File sampleDir = null;
File[] dirListing = null;
Mat sample;
// no way to tell if a file is already in the matrix so just start over on reloads
inputs = null;
outputs = null;
// Setting up output matrix for each possible die value
Mat m1 = Mat.zeros(1, 6, CvType.CV_3... |
0b6f28f3-9815-4d48-9d80-3e24e6aa4024 | 4 | public void deplacerSinge()
{
final Random random = new Random();
int tmpX = this.x;
int tmpY = this.y;
do {
tmpX = this.x;
tmpY = this.y;
final int d = random.nextInt(2);
if (random.nextInt(2) == Integer.valueOf(0)) {
// Dplacement du x
tmpX = (d == 0) ? tmpX - 1 : tmpX + 1;
} else {
... |
a94e1421-0614-4ecd-b4b6-edb248fcdcaa | 0 | @Override
public ArrayList<String> getQuestAnswer() {
return questAnswer;
} |
c84b54c9-be3c-4f55-8f52-cf72a1338039 | 6 | @Override
public void run() {
this.running = true;
while (this.running) {
try {
Thread.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}
//Thread.yield();
}
} |
2ca33cb1-e100-420e-bdf2-6aec79954d1f | 9 | private cmds getCommand(String arg){
if (arg.trim().equalsIgnoreCase("DEPOSIT"))
return cmds.DEPOSIT;
else if (arg.trim().equalsIgnoreCase("WITHDRAW"))
return cmds.WITHDRAW;
else if (arg.trim().equalsIgnoreCase("GIVE"))
return cmds.GIVE;
else if (arg.trim().equalsIgnoreCase("SET"))
return cmds.SET;
... |
b5006571-2efb-4be5-977e-8cc9872dbe0b | 0 | @Test
public void anotherSmallGraphAddedCorrectly() {
Graph g = GraphParser.initialize(t2);
assertEquals(3, countVertices(g));
assertEquals(3, countEdges(g));
} |
ab58835a-4188-497a-8671-b529b22f09d6 | 0 | public EncryptionMethodType getEncryptionScheme() {
return encryptionScheme;
} |
6dfcd231-576b-496b-9f42-d918d18698a7 | 7 | public static Collection<String> listToplevelClassNamesForURI(URI uri) {
final Collection<String> rval = new ArrayList<String>();
// Ensure we have a proper cache entry ...
// getCacheEntry();
// Disabled: Not really necessary, is it? And not storing/retrieving
// these items
// makes the cache file small... |
be672848-5db0-4fc8-9b75-b2db01cf2545 | 0 | public PerfilFacade() {
super(Perfil.class);
} |
086f8333-ea28-40f9-a6fe-3ae15cf0fd4b | 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... |
06870dac-d691-4ee4-b9ab-075b73ee4a0c | 4 | public boolean cancel(boolean mayInterruptIfRunning) {
if (!started || done || cancelled) return false;
if (mayInterruptIfRunning) {
// interrupt
cancelled = true;
done = true;
} else {
// still running but cannot interrupt
cancelled =... |
aee463c0-a507-4319-825d-147f72106393 | 7 | public static String dayNameOfWeek(int dayOfWeek) {
switch (dayOfWeek) {
case 1:
return "Sunday";
case 2:
return "Monday";
case 3:
return "Tuesday";
case 4:
return "Wednesday";
case 5:
... |
0e2c6ae3-6312-4325-9208-9a0d6ba056d2 | 1 | public void test_getValue_long_long() {
assertEquals(0, iField.getValue(0L, 567L));
assertEquals(12345, iField.getValue(12345678L, 567L));
assertEquals(-1, iField.getValue(-1234L, 567L));
assertEquals(INTEGER_MAX, iField.getValue(LONG_INTEGER_MAX * 1000L + 999L, 567L));
try {
... |
4ac89b0a-820a-4163-8e59-cff422ebcb8e | 1 | @Override
public void render(GameContainer arg0, StateBasedGame sbg, Graphics g) throws SlickException {
if(trackSplash >= rajolaSplash.length - 1) sbg.enterState(Main.States.Title.ordinal()); //TODO: make it 1
rajolaSplash[trackSplash].draw();
} |
d3e31d14-d95a-42dc-94d8-b13f584731fa | 0 | public RRGGBB(int r, int g, int b) {
super(r, g, b);
} |
14a1e473-e081-45d7-b418-87d59d62a4f6 | 1 | public static int getPosFromID(String idRef) {
String[] temp = new String[0];
try {
temp = idRef.split("_");
Integer.parseInt(temp[temp.length - 1]);
} catch (Exception e) {
System.out.println(idRef);
}
return Integer.parseInt(temp[temp.length - 1]);
} |
0958b5db-fe9b-47bc-ad85-8ee5cb178766 | 1 | @Override
public JSONObject getValueForOutput() {
try
{
return this.appt.toJson(0);
} catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
return new JSONObject();
}
} |
fe2a4d9c-2aab-4c90-a651-881dbcdef8d2 | 4 | public void destroy(String id) throws NonexistentEntityException, RollbackFailureException, Exception {
EntityManager em = null;
try {
utx.begin();
em = getEntityManager();
Usuarios usuarios;
try {
usuarios = em.getReference(Usuarios.class,... |
5d689ad4-29df-4cf0-ae3e-fd4ea468166f | 0 | @Override
public void mouseExited(MouseEvent e) {
} |
d49fc50a-ee50-4977-8885-64f902349f31 | 3 | @Override
public void onEnable()
{
try
{
Class.forName( "org.sqlite.JDBC" );
} catch ( ClassNotFoundException ex )
{
getLogger().log( Level.SEVERE, "Could not connect to SQLite database", ex );
getServer().getPluginManager().disablePlugin( this... |
8d1955a6-18a8-4ded-ba76-fd9aba5162aa | 4 | @Override
public int compare(File arg0, File arg1) {
if(arg0.isFile() && arg1.isDirectory())
return 1;
if(arg0.isDirectory() && arg1.isFile())
return -1;
return arg0.getName().compareTo(arg1.getName());
} |
37de0aed-971b-43d1-b96f-aa67a76fbacc | 8 | public static void main(String[] args) throws Throwable{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
ArrayList<Point[]> rect = new ArrayList<Point[]>();
StringBuffer sb = new StringBuffer();
for (String ln; !(ln = in.readLine().trim()).equals("*");) {
String[] arr = ln.split(" +... |
52273ab0-19bc-435a-9311-5c73459061a4 | 8 | public void update() throws MaltChainedException {
// Retrieve the address value
final AddressValue arg1 = addressFunction.getAddressValue();
// if arg1 or arg2 is null, then set a NO_NODE null value as feature value
if (arg1.getAddress() == null ) {
featureValue.setIndexCode(table.getNullValueCode(NullVal... |
b4c31c44-b316-4499-899a-1cd91933ad63 | 8 | public void initialize() {
JPanel detailPanel = new JPanel(new MigLayout("wrap 7", "[]30[][]30[][]30[][]", ""));
detailPanel.setOpaque(false);
Role role = Role.DEFAULT;
if (unitType.hasAbility(Ability.EXPERT_PIONEER)) {
role = Role.PIONEER;
} else if (unitType.hasAb... |
59754979-7260-46c9-b8c1-a586d72d7a19 | 7 | @Override
public void actionPerformed(ActionEvent e) {
if(e.getSource().equals(m.getBtnAddEdit())){
if (m.getTfAssetName().getText().trim().length() != 0 && m.getTfType().getText().trim().length() != 0 && m.getTfOwner().getText().trim().length() != 0 && m.getTfStorage().getText().trim().length(... |
c319ec76-3ef5-4afb-add5-edd1f0111214 | 2 | public Collection roots() {
if ((roots == null) || (rootEdgeModCount != edgeModCount)) {
rootEdgeModCount = edgeModCount;
roots = new ArrayList();
buildRootList(roots, false);
}
return roots;
} |
a8bee243-c948-46c5-9ddf-38912ea91a17 | 5 | private void removeModelFromServer(int num) {
//todo: переделать, блджад, весь этот bullshit
int modelNumber = 0;
while (modelNumber < models.size()) {
if (models.get(modelNumber).getIsComplex()) {
ComplexModel c = (ComplexModel) models.get(modelNumber);
... |
ceb08da9-602f-49e4-8a48-489bac8f302c | 3 | @Override
void removeChild(@SuppressWarnings("unused") Node child)
{
// Remove child
if(this._avalie_ == child)
{
this._avalie_ = null;
return;
}
if(this._estrCaso_.remove(child))
{
return;
}
if(this._senao_.re... |
5f004b92-d5a0-4782-9001-981c01a02cc5 | 5 | @Override
public void mousePressed(MouseEvent e) {
if (this.circuit.getJBreadBoard().getMode().equals("drawingwire")) {
if (WireDrawer.current != null && this.circuit != WireDrawer.current.getCircuit()) {
WireDrawer.current.getCircuit().getJBreadBoard().setMode("wire", "Wire Removed. Wiring Mode. Click to Sta... |
dec46a75-3c53-46a7-8388-9e375d133008 | 1 | public static void main(String[] args) {
// Searching Arrays
String[] toys = { "Bike", "Pogo Stick", "Yoyo", "Action Figure" };
int result = stringSearcher(toys, "frYoyo");
if (result == -1) {
System.out.println("No match found");
} else {
System.out.println("Result: " + toys[result]);
}
} |
1c407bd7-83ca-449e-9170-3c2ac50fe29c | 3 | public static void main(String[] args) {
Options options = new Options();
CommandLineParser parser = new GnuParser();
try {
CommandLine result = parser.parse(options, args);
byte[] rawdata = null;
ByteArrayOutputStream baos = null;
try {
... |
3d6d3435-d0bd-4930-8a8a-d62c0699f026 | 8 | public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
String uri = req.getPathInfo();
ProspectsHandler handler = new ProspectsHandler();
// Homepage - return prospects in order of overall rank
if(uri == null) {
Matcher loMatcher = loPattern.matcher(req... |
302e4210-3734-45f2-8925-452c3abc599b | 2 | public boolean dropTable(String tableName) {
for (DataBase db : databases.values()) {
boolean result = db.dropTable(tableName);
if (!result) {
return false;
}
}
return true;
} |
86728319-0d5e-4042-8873-de70d6681fde | 2 | private void throwAuthFailureException() {
String reason;
vlog.debug("state=" + state() + ", ver=" + cp.majorVersion + "." +
cp.minorVersion);
if (state() == RFBSTATE_SECURITY_RESULT && !cp.beforeVersion(3, 8)) {
reason = is.readString();
} else {
reason = "Authentication fail... |
8c619970-aba7-4c77-90f8-504b4adb3f1c | 7 | public void show(GameContainer gc, Input input){
int x = Mouse.getX();
int y = Mouse.getY();
double tt = Math.sqrt(Math.pow( x - (gc.getWidth())/2 , 2) + Math.pow( y - 3*(gc.getHeight())/4, 2));
if(Math.sqrt(Math.pow( x - (gc.getWidth())/2 , 2) + Math.pow( y - 3*(gc.getHeight())/4 + bub... |
0ff297f1-6f44-4c36-ac35-8f2ac3d4414f | 0 | @Before
public void setup() {
uf = new QuickFind(10);
} |
a10f5a0a-714f-4592-9c04-b364c433582a | 7 | private void gear(float inner_radius, float outer_radius, float width, int teeth, float tooth_depth) {
int i;
float r0, r1, r2;
float angle, da;
float u, v, len;
r0 = inner_radius;
r1 = outer_radius - tooth_depth / 2.0f;
r2 = outer_radius + tooth_depth / 2.0f;
... |
2aec822e-753b-4ad4-a550-0b26f54a4325 | 7 | private mxPngEncodeParam.Gray createGrayParam(byte[] redPalette,
byte[] greenPalette, byte[] bluePalette, byte[] alphaPalette)
{
mxPngEncodeParam.Gray param = new mxPngEncodeParam.Gray();
int numTransparent = 0;
int grayFactor = 255 / ((1 << bitDepth) - 1);
int entries = 1 << bitDepth;
for (int i = 0; i ... |
080df5ab-85b4-45e0-b8bc-c3359ae5fb6f | 5 | public void getNextPosition() {
if (left) {
dx -= moveSpeed;
if (dx < -maxSpeed) {
dx = -maxSpeed;
}
} else if (right) {
dx += moveSpeed;
if (dx > maxSpeed) {
dx = maxSpeed;
}
}
if (falling) {
dy += fallSpeed;
}
} |
3d032c3c-da1f-4c8b-b5f2-e8942f60972f | 5 | public void doClose()
{
if (!hasChanged()) System.exit(0);
int c = JOptionPane.showConfirmDialog(frame,
Resources.getString("Jeie.UNSAVED_MESSAGE"),
Resources.getString("Jeie.UNSAVED_TITLE"),
JOptionPane.YES_NO_CANCEL_OPTION);
if (c == JOptionPane.CANCEL_OPTION) return;
if (c == JOptionPane.YES_OP... |
d90d7137-9adb-4e4f-ace3-a24b9f191ad9 | 3 | public Index buildIndex(String result) {
try {
index.start(result);
Files.walk(Paths.get(directory)).forEach(file -> {
if (Files.isRegularFile(file)) {
service.submit(new ProcessFileTask(file, index));
}
});
ser... |
4e8df464-d09d-4974-b989-3a7d9af242d6 | 4 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TDatdsrPK other = (TDatdsrPK) obj;
if (!Objects.equals(this.transNo, other.transNo)) {
return... |
fa794155-39d2-4563-bbec-b941a16e6c83 | 4 | public void startTask() {
if (gui.getSelectionRowFromTable() <= tasks.size() && gui.getSelectionRowFromTable() > 0) {
/* ??? run multiple times if necessary */
Task temp = tasks.get(gui.getSelectionRowFromTable());
Task task = new Task(temp.getName(), temp.getDelay(), temp.ge... |
d0013326-8174-40cf-ad97-5d5eef8bc275 | 7 | public int find(long key) {
int find_attempt = 1;
int hash = hashFn(key);
int initialHash = -1;
while (hash != initialHash
&& (table[hash] == DeletedEntry.getUniqueDeletedEntry()
|| table[hash] != null
&& table[hash].getKey() != key)) {
... |
4887df77-a62d-418d-bf69-ade2bccf5ff0 | 7 | @Override
public void insert(Bin<T> bin) {
addTotalCount(bin);
if (isFrozen() && getBins().size() == getMaxBins()) {
Double floorDiff = Double.MAX_VALUE;
Bin<T> floorBin = floor(bin.getMean());
if (floorBin != null) {
floorDiff = Math.abs(floorBin.getMean() - bin.getMean());
}
... |
bdb25242-6890-4a42-ad73-0aa66daf3db7 | 9 | private Result pIntegerTypeSpecifier(final int yyStart) throws IOException {
Result yyResult;
Node yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative 1.
yyResult = pKeyword(yyStart);
if (yyResult.hasValue("long")) {
yyValue = GNode.create("Long", false);
yyVa... |
6863e127-6587-4788-b334-26e14e9aa35e | 4 | public void addEmployeeDetails(Employee employee) {
Connection connection = new DbConnection().getConnection();
PreparedStatement preparedStatement = null;
try {
preparedStatement = connection
.prepareStatement(INSERT_NEW_EMPLOYEE);
preparedStatement.setString(1, employee.getEmployeeId());
prepared... |
a610694a-80b7-4f71-b858-5d0e2837aa02 | 3 | public void activate(Robot paramRobot, int paramInt) {
if ((!this.down) && (!this.falling))
{
GameApplet localGameApplet = GameApplet.thisApplet;
Image[] arrayOfImage = new Image[8];
int[] arrayOfInt = new int[8];
for (int i = 0; i < 8; i++)
{
arrayOfImage[i] = localGameApp... |
7a950a3d-4e22-4941-9dfe-e7e20f0a4fb0 | 1 | @Test
public void filtersByAuthorFirstnameWorks2() {
citations.add(c1);
citations.add(c2);
citations.add(cnull);
filter.addFieldFilter("author", "Maija");
List<Citation> filtered = filter.getFilteredList();
assertTrue(filtered.contains(c2) && filtered.size() == 1);
... |
44ddbee1-5c90-4ee9-94c5-4381c27472da | 3 | private final void saveProps() {
if (props == null) {
props = new Properties();
}
// remove whitespaces
tf_credID.setText(tf_credID.getText().replaceAll("\\s", ""));
tf_credIBAN.setText(tf_credIBAN.getText().replaceAll("\\s", ""));
tf_credBIC.setText(tf_credBIC.getText().replaceAll("\\s", ""));
tf_exe... |
0698311d-d85a-47ca-a772-e1aeff587021 | 3 | public void execute(CommandSender sender, String[] args) {
String announcement = "";
if (!sender.hasPermission("bungeeannouncer.admin")) {
sender.sendMessage(FontFormat.translateString("&4You do not have permission to use this command"));
return;
}
if (args.length < 1) {
sender.sendMessage(FontForma... |
d431ffc6-c7ee-4f93-b068-3dac4f98d6ed | 3 | @Override
public void actionPerformed(ActionEvent e) {
try {
String op = e.getActionCommand();
switch(op){
case "Gravar":
this.showViewGerenciarCrlvs();
break;
case "Recuperar":
... |
7f2bd938-e1d1-40dc-9925-396a03e203c6 | 0 | public ArrayList<String> getParsedArray() {
return parsedArray;
} |
9e4e6b49-588b-494e-ac3f-17060e303d95 | 0 | public Object clone() {
TMConfiguration newConfig = new TMConfiguration(this.getCurrentState(),
(TMConfiguration) this.getParent(), myTapes, myFilters);
newConfig.setFocused(this.getFocused());
newConfig.setHalted(this.isHalted());
return newConfig;
} |
2b95ea51-43ea-4046-b739-9cfbdde702af | 9 | public void run() throws Exception {
Logger.logStep(null, "Beginning processing run");
String[] inputFiles = inputRepository.getInputFiles();
if(inputFiles == null){
Logger.logStep(null, "Zero (0) input files");
return;
}
Logger.logStep(null, inputFiles.length + " input files to process");
fo... |
119c33c5-1f88-46df-b9f7-f35ddca37ce5 | 4 | public void setRule(String name, boolean rs, int rv ){
switch(aamode){
case 1:pete.setRule(name, rs, rv); break;
case 2: for(int h = 0; h <= gridy-1; h++){
for(int w = 0; w <= gridx-1; w++){
grid[w][h].setRule(name, rs, rv);}} break;
}
} |
5358b59f-6f0a-4d58-a71c-9cf87f74bcb4 | 9 | public void keyPressed(KeyEvent e) {
if(this.gameIsOver||!this.gameIsBegin)
return;
if (getTimer().isRunning())
{
if (e.getKeyCode() == KeyEvent.VK_UP) {
curBlock.rotate();
AppSet.playGameMusic("./sound/rotate.wav");
this.re... |
ccdbbf21-876f-460c-ba66-dbe36cf44b78 | 2 | public boolean modifyBook(int id, Book book){
if(id != 0){
String sql = "update book set name=?, author1=?, author2=?, "
+ "author3=?, isbn=?, state=? where id=?";
try{
PreparedStatement ps = con.prepareStatement(sql);
ps.setString(1, b... |
289e9c48-42ae-47d2-8108-c60f7eab53f8 | 8 | public String execute() {
String actionResult = "";
session = ActionContext.getContext().getSession();
user = (User) session.get("USER");
list = (new DataService()).getHistoryLocations(startDate, endDate, vregisteration_num);
if (list != null) {
// latitude = TrackDa... |
235777d0-52e3-4bbc-9e2b-abaef6ad197d | 5 | public void get_encoded_data(String infile,String outfile)
{
Preprocessor pre=new Preprocessor();
Random random_gen=new Random();
//int cipher_num=0;
int cipher_num=encoder.encoder_list.length;
try
{
BufferedReader in = new BufferedReader(new FileReader(infile));
BufferedWriter out=new Buffere... |
b1c5e640-8f8a-45e8-905e-21ef134c0a19 | 5 | private boolean _loadBooleanProperty(Properties properties, String key) throws Exception {
String value = properties.getProperty(key);
if(value == null)
throw new Exception("Could not find " + key + " in configration file " + CONFIG_FILE);
if(value.equalsIgnoreCase("YES") || value.equalsIgnoreCase("TRUE")){
... |
8cc76bb9-77b6-4982-b98d-be84becc838e | 2 | @Override
public void start()
throws Exception {
String[] args= this.par.getArgs();
int inputNumberValues= args.length - 1; //-1 for command word
if(inputNumberValues != 1)
throw new Exception("The input for -hl command is not correct");
//because for song there are both low and high extraction fe... |
900b70df-3ebd-4a95-9aec-0e3b32c0e400 | 7 | private long[] getLastModifiedAndContentLength() {
long[] t = new long[2];
t[0] = 0L;
t[1] = 0L;
if (isRemote()) {
File file = ConnectionManager.sharedInstance().getLocalCopy(pageAddress);
if (file == null || !file.exists()) {
URL url = null;
try {
url = new URL(pageAddress);
} catch (Mal... |
7b193815-4030-49fd-bdcd-8f05b1968203 | 8 | public Activity[] selectByWorker ( int workerId ) {
Connection con = null;
PreparedStatement statement = null;
ResultSet rs = null;
List<Activity> activities = new ArrayList<Activity>();
try {
con = ConnectionManager.getConnection();
String searchQuery = "SELECT activities.id, activities.n... |
e10a94bc-41a3-4a39-a64c-6b393bb239c8 | 7 | public Color getColor() {
switch(type) {
case COPPER:
return new Color(219, 63, 45);
case ALUMINUM:
return new Color(134, 134, 134);
case SILVER:
return new Color(180, 180, 180);
case GOLD:
return Color.YELLOW;
case BISMUTH:
return new Color(242, 242, 242);
case PLATINUM:
return new Colo... |
022a43a4-8fe1-4d0f-ad84-cd0f7519f4f7 | 7 | public boolean scrollTo(int line, int offset)
{
// visibleLines == 0 before the component is realized
// we can't do any proper scrolling then, so we have
// this hack...
if(visibleLines == 0)
{
setFirstLine(Math.max(0,line - electricScroll));
return true;
}
int newFirstLine = firstLine;
int new... |
dae636e6-3526-4518-a971-cf64d62fbb0f | 5 | ArrayConverter(String text) {
text = text.trim();
if (count(text, '}') != count(text, '}')) {
throw new IllegalArgumentException("Brackets mismatch.");
}
if (debug) {
System.out.println(text);
}
String mass = text.replace(LB, ' ').replace(RB, ' ').trim();
content = splitP.split(mass);
if... |
829f770f-58a2-446c-ab54-cc18777aaa16 | 1 | protected static Float parseFloat(final Object obj, final String type) throws ParseException {
final Float floatValue;
try {
floatValue = Float.valueOf(obj.toString());
} catch (NumberFormatException nfe) {
throw new ParseException(obj + " is not a valid " + type + ".");
}
return floatVa... |
b2caba27-ce37-4056-a087-034ddc7f3847 | 4 | public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_UP)
ya = -game.getSpeedx();
if (e.getKeyCode() == KeyEvent.VK_DOWN)
ya = game.getSpeedx();
if (e.getKeyCode() == KeyEvent.VK_RIGHT)
xa = -game.getSpeedx();
... |
46ac4599-0c1c-4618-a429-3b677baee0b9 | 6 | public int readRow( byte b0, byte b1 )
{
if( ((parent_rec != null) && !parent_rec.getWorkBook().getIsExcel2007()) )
{
int rw = ByteTools.readInt( b0, b1, (byte) 0, (byte) 0 );
if( (rw >= (MAXROWS_BIFF8 - 1)) || (rw < 0) || (this instanceof PtgRefN) ) // PtgRefN's are ALWAYS relative and therefore never ov... |
54574ac7-74f9-4be3-b903-9efb525bf42c | 0 | public MessagesSender() {
start();
} |
f0ab8a25-c2c8-4e7c-bed8-2b52d783bbb2 | 1 | public synchronized void register(RegisteredListener listener) {
if (muffinbag.get(listener.getPriority()).contains(listener))
throw new IllegalStateException("This listener is already registered!");
events = null;
muffinbag.get(listener.getPriority()).add(listener);
} |
b6e22e10-5a86-4485-ac95-0e26249df401 | 1 | public static boolean getMouseUp(int mouseButton)
{
return !getMouse(mouseButton) && lastMouse[mouseButton];
} |
04fa8ca5-d66e-44b1-9d83-60ea02a8c5e1 | 0 | protected JToolBar initInputToolbar() {
JToolBar toolbar = new JToolBar();
toolbar.add(startAction);
myPreviousAction = new AbstractAction("Previous") {
public void actionPerformed(ActionEvent e) {
previous();
}
};
myPreviousAction.setEnabled(false);
toolbar.add(myPreviousAction);
stepAction.set... |
6be53772-e08d-4db7-bd46-5d896fa4f706 | 4 | public static void delete(File file) throws IOException {
if (file.isDirectory()) {
// directory is empty, then delete it
if (file.list().length == 0) {
file.delete();
} else {
// list all the directory contents
String files[] = file.list();
for (String temp : files) {
// construct... |
849c9dea-8155-4f0d-8cb6-b6c57d42b26a | 6 | @Test
public void cardUniquenessTwo(){
boolean unique = true;
for(Player p: myGame.getPlayers())
for(Card c: p.getMyCards())
for(Player q: myGame.getPlayers()){
if(!(p.equals(q)))
for(Card f: q.getMyCards())
... |
d6967b6c-d87c-46e6-9f59-d916db3fdf3b | 2 | public LinkedList<Rectangle> getWalls()
{
LinkedList<Rectangle> res = new LinkedList<Rectangle>();
int i = Mode.Wall.i();
for (Obj o : positions)
{
if (o.getT() == i)
res.add(new Rectangle((int)o.getPos().X, (int)o.getPos().Y, gridW[i], gridH[i]));
}
return res;
} |
69a695f2-91c5-4473-8d7d-17653f4a575a | 0 | public int getType() {
return type;
} |
b26e3bf3-d8ba-4095-adb1-ac41f85aea3b | 8 | private void processEdge(Edge edge) {
// project unaries
for (UnaryRule unaryRule : grammar.getUnaryRulesByChild(edge.getLabel())) {
Edge resultEdge = makeEdge(unaryRule.getParent(), edge.getStart(), edge.getEnd());
if (verbose) System.err.println("Using unary "+unaryRule+" on "+edge+" to create "+r... |
a72b89b3-3d08-4ed3-9853-fff9f0647cef | 9 | public static void addtoarray(String Username, String Password, String Subject1, String Subject2, String Subject3, String Subject4, String Subject5, String Subject6, String Subject7, int delete1)
{
if(Username != null && Password != null && Subject1 != null && Subject2 != null && Subject3 != null &&... |
cab12481-793d-4ff3-89b7-dbed5fb84c9a | 2 | public static boolean nodeOnWay(Coordinate node, Coordinate[] wayCoors) {
LineIntersector lineIntersector = new RobustLineIntersector();
for (int i = 1; i < wayCoors.length; i++) {
Coordinate p0 = wayCoors[i - 1];
Coordinate p1 = wayCoors[i];
lineIntersector.computeIntersection(node, p0, p1);
if (lineIn... |
be08c724-abc1-4a9c-bfdb-fe46a101fe6f | 3 | private boolean enoughFreeSpace(int articleID, int quantity)
{
int quantityPerLocation;
for (Location location : locations) {
quantityPerLocation = 1;
while (true) {
if (location.getFreeSpace() >= Assortment.getArticleVolume(articleID)
* quantityPerLocation) {
quantity--;
quantityPerLoc... |
af2abe1a-e233-4c3b-9c13-1df96ace8d39 | 5 | @Override
public Component getListCellRendererComponent(JList list, Object object,
int index, boolean isSelected, boolean cellHasFocus) {
// setLineWrap(true);
if (focusBorder == null) {
focusBorder = new DotBorder(new Color(~list
.getSelectionBackground().getRGB()), 2);
}
if (isSelected) {
setBa... |
5f312bb1-de6e-4c59-be4a-c865992e5ac0 | 7 | @Override
public int castingQuality(MOB mob, Physical target)
{
if(mob!=null)
{
if(mob.fetchEffect(this.ID())!=null)
return Ability.QUALITY_INDIFFERENT;
final Room R=mob.location();
if(R!=null)
for(int r=0;r<R.numInhabitants();r++)
{
final MOB M=R.fetchInhabitant(r);
if((M!=null)&&... |
b3f4d0bb-087e-4ee1-9e52-2c99ca8905a0 | 1 | public boolean isBuilding() {
return isSingle() && selection.getFirst() instanceof Building;
} |
9bbae0a8-c012-4cb2-a3a8-b5979d82bde1 | 4 | public void appendQuestion(Question question) throws Exception {
for (Option option : question.getOptions())
if ((option.getReaction() instanceof BukkitQuestionTask))
((BukkitQuestionTask)option.getReaction()).setServer(getServer());
getQuestionManager().appendQuestion(question);
Player playe... |
bc1c56e0-9d5c-4a9f-af2e-4fde62b6cbac | 7 | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int k = sc.nextInt();
String s = sc.next();
ArrayList<TreeSet<Integer>> position = new ArrayList<>();
for (int i = 0; i < 26; i++) {
position.add(new T... |
f00e1976-d217-45e9-bc0b-dc41138d138f | 9 | private static int mnemonicMarkerIndex(String s, char marker) {
if ((s == null) || (s.length() < 2)) {
return -1;
}
CharacterIterator sci = new StringCharacterIterator(s);
int i = 0;
while (i != -1) {
i = s.indexOf(marker, i);
if (i != -1) {
... |
b6e854ca-0b81-445a-b257-d24f85732810 | 6 | public static void drawFilledRectangle(int x, int y, int width, int height,
int colour) {
if (x < topX) {
width -= topX - x;
x = topX;
}
if (y < topY) {
height -= topY - y;
y = topY;
}
if (x + width > bottomX)
width = bottomX - x;
if (y + height > bottomY)
height = bottomY - y;
int in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.