method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
3a8f5953-188a-47d9-8291-e182e31195a7 | 3 | private boolean readPlane(int[] dst, byte[] tmp, int width, int height) {
try
{
for (int y = 0; y < height; y++)
{
dis.read(tmp);
for (int x = 0; x < width; x++)
{
dst[y * width + x] = unsignedByteToInt(tmp[x]);
}
}
return true;
}
catch (Exception e)
{
e.printStackTrac... |
866d843e-26be-4ec4-b450-da207ddf168f | 1 | public static void main(String args[]) {
Scanner reader = new Scanner(System.in);
char loop = 'y';
while (loop == 'y'){
String first, second;
Scanner scan = new Scanner(System.in);
System.out.println("-----Minimal Edit Distance-----");
System.out.print("Please input the first string: ");
... |
71206886-be7e-40e6-8944-7d4bc30eb493 | 6 | public Item getItem(String type, int tier){
switch(type){
case "random":
return randomItem(tier);
case "weapon":
return randomWeapon(tier);
case "armor":
return randomArmor(tier);
case "trinket":
return randomTrinket(tier);
case "consumable":
return randomConsumable(tier);
case "loot":
r... |
15e60a42-59c3-4f15-849e-a42faebfaf27 | 9 | public void setMaximumDepth(float m) {
if (m < 0.0f)
throw new IllegalArgumentException("Potential well depth cannot be negative");
v *= max / m;
max = m;
if (format != null) {
if (max >= 1000f)
format.applyPattern("####");
else if (max >= 100f)
format.applyPattern("###");
else if (max >= 10... |
727c179d-3e42-4a42-b03f-88d8d8700f38 | 6 | private void createComboView(Composite parent, Object layoutData) {
combo = new Combo(parent, SWT.NONE);
combo.setLayoutData(layoutData);
combo.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
final File[] roots = (File[]) combo.getData(COMBODATA_ROOTS);
if (... |
2b771944-d142-4152-a262-9b93e098c4ce | 1 | public int getTotalBets() {
List<ParisModel> paris = DataStore.getAllTeamParisBySchedule(this.sched_id);
int total = 0;
for(ParisModel par : paris){
total += par.getBet();
}
return total;
} |
f20e8e35-35c7-416e-83a1-d89c1a531d95 | 4 | public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
StringTokenizer tokenString;
HashMap<Integer, String> candidates;
ArrayList<Ballot> ballots;
Ballot ballot;
/* This code have to be run for n elections */
int numElections = in.nex... |
72484752-cdff-4e31-aa73-5491521ea36b | 4 | public Smoothie createSmoothie(String s){
if(s.equals("Banana")) {
Smoothie drink = new CannedBanana();
drink = new Icecream(drink);
return drink;
}
if(s.equals("Orange")) {
Smoothie drink = new CannedOrange();
drink = new Icecream(drin... |
dce1ee54-c078-43ad-828b-36e32a87724c | 7 | public static int isamax_f77 (int n, double x[], int incx) {
double xmax;
int isamax,i,ix;
if (n < 1) {
isamax = 0;
} else if (n == 1) {
isamax = 1;
} else if (incx == 1) {
isamax = 1;
xmax = Math.abs(x[1]);
for (i = 2; i <= n; ... |
1959a9af-42f4-4257-92a9-ec2e5e1a1185 | 2 | private int getBlockIntensity(int x, int y) {
int averageIntensity = 0;
for (int i = x; i < scale + x; i++) {
for (int j = y; j < scale + y; j++) {
averageIntensity += getIntensity(i, j);
}
}
return averageIntensity / (s... |
cc42c9f6-4340-4fa6-8516-462574043990 | 0 | public String displayInfo() {
super.displayInfo();
return "Tigers are similar to Lions but they have \n"+look+". Tigers live in the "+location;
} |
28cbf7f7-67b8-41b7-bfab-fd67fb6c6359 | 9 | public void run() {
// initialization
System.out.println("Client0: initialization " + System.currentTimeMillis());
Messager messager = new Messager(Messager.Id_Server);
messager.initialization();
TowerDefense_TransData towerDefense_TransData;
for (int i = 0; i < 3; i++) { // 3 rounds
... |
dffb9294-6f16-4c03-bb48-41a39dc44af3 | 7 | protected void _run(MergeId new_merge_id, final Collection<Address> coordsCopy) throws Exception {
boolean success=setMergeId(null, new_merge_id);
if(!success) {
log.warn("%s: failed to set my own merge_id (%s) to %s", gms.local_addr, merge_id, new_merge_id);
retu... |
c8050a4f-0df7-4901-94e3-30c4822497c0 | 1 | public boolean canHaveAsCreditLimit(BigInteger creditLimit) {
return (creditLimit != null) && (creditLimit.compareTo(BigInteger.ZERO) <= 0);
} |
254acf05-63fa-4d67-a80a-88c323fed796 | 5 | @Override
public void run() {
super.run();
this.play = true;
this.allive = true;
while(this.play)
{
if(this.play && this.AnimationSource.getAnimationImageIndex() < this.AnimationSource.getAnimationImages().size())
{
this.AnimationSource... |
7c230540-fbbb-4a66-b0bd-a3134c38fe71 | 9 | @Override
public Boolean accept(States state, CalculatorReader expressionReader) throws BinaryOperatorException, CalculatorException{
if (States.FINISH == state) {
return true;
} else if (States.RIGHT_BRACKET == state) {
if (evalBracketClose(expressionReader)) {
... |
bf213ab3-76b6-4461-9140-6d8da679b156 | 7 | private List<Homonym> cleanse(List<Homonym> homonymList, int wType) {
List<Integer> linesToRemove = new ArrayList<>();
//combine split lines
for (Homonym tr: homonymList) {
for (int i = tr.getWords().get(wType).getMeanings().size() - 1; i >= 0; i--) {
Meaning se = t... |
c32f2897-a630-4651-aa23-130a6d308349 | 3 | @SuppressWarnings("unchecked")
public String getTeamRadarChart() {
PreparedStatement st = null;
ResultSet rs = null;
JSONArray json = new JSONArray();
try {
conn = dbconn.getConnection();
st = conn.prepareStatement("SELECT sum(auton_top)*6 + sum(auton_middle)*... |
77fccb0b-0942-4492-9e8f-e6b7b385c137 | 1 | protected void addResult(PropertyTree node) {
// todo: don't call getValue again right here!
Object value=node.getValue();
Result match=getMatchingResult(value);
if(match==null) {
results.add(new Result(node));
} else {
match.add(node);
}
this.totalNodes++;
this.sorted=false;
} |
0a755a16-799e-4a61-878e-bb6869ee06b6 | 5 | public void draw(Graphics2D g) {
if (!visible) return;
int w = getWidth();
int h = getHeight();
RoundRectangle2D button = new RoundRectangle2D.Float(
0, 0, w, h, h/2, h/2);
g.setColor(background);
g.fill(button);
GradientPaint paint;
int y1 = down? -h : ... |
ca97d124-45be-48e9-b61b-591931742599 | 0 | public String getPassword(String account){
return this.passwordHash.get(account);
} |
0c4adfa7-ce58-4e6c-b688-03e099ac1469 | 6 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CommunicationDeviceType that = (CommunicationDeviceType) o;
if (id != that.id) return false;
if (name != null ? !name.equals(that.name) : that.... |
f195edde-a769-427b-8e16-b4aa5af036ea | 8 | private Tuple<Integer, Integer> traceDirection(Set<Tuple<Integer, Integer>> set,
int board[][], int player,
int startX, int startY, int dx, int dy) {
Tuple<Integer, Integer> res = new Tuple<>(0, 0);... |
e38b57f7-788e-41e2-bed8-8d7916febf32 | 0 | public boolean get_connection_state()
{
return this.connected;
} |
650414e5-447d-466b-9776-89fd922859d3 | 7 | private TreeNode recursiveIterator(TreeNode currentNode, String currentWord) {
if (foundDialogue || currentNode == null || currentNode.isTempVisited()) {
return currentNode;
}
List<TreeNode> children = currentNode.getChildren();
currentNode = checkChildrenForKeyWords(currentNode, currentWord);
for (TreeNo... |
4630d6f4-4957-4495-a900-03d2c27228de | 8 | public int compareTo(Point point){
if (point == null) return 1;
if (this.equals(point)) return 0;
if (getX() > point.getX()) return 1;
if (getY() > point.getY()) return 1;
if (getZ() > point.getZ()) return 1;
if (getX() < point.getX()) return -1;
if (getY() < point.getY()) return -1;
if (getZ() < point.... |
15f3ca0b-f86e-49a2-8dfb-ba0f0c04ae7e | 8 | public List<Palabra> getListado(String c){
Connection con = null;
Statement stat = null;
ResultSet rs = null;
ResultSet rs2 = null;
List<Palabra> lista = new ArrayList<>();
try {
con = DriverManager.getConnection("jdbc:sqlite:DBVocabulario.s3db");
... |
864ea795-9146-4d05-a694-a5059b0d1f89 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof Office)) {
return false;
}
Office other = (Office) object;
if ((this.onumber == null && other.onumber != null) ... |
edf7b8bf-bec1-42c7-86ee-67c85bb70b89 | 1 | public static void delayLine() {
int sum = 0;
for (int i = 0; i < 1000000; i++) {
sum += i;
}
} |
c1d0c5b2-824d-4d7b-b750-a4824c1769a3 | 0 | public CtrlPrincipal() {
// Gérer la persistance
em = EntityManagerFactorySingleton.getInstance().createEntityManager();
em.getTransaction().begin();
} |
aa91ed1a-e898-46e4-bbeb-144c05350452 | 9 | public void processQueries(String strInputFilePath, String strOutputFilePath)
throws IOException {
oBufferedReader = new BufferedReader(new FileReader(strInputFilePath));
oBufferedWriter = new BufferedWriter(new FileWriter(strOutputFilePath));
calcuateTFIDF(oBufferedReader);
oBufferedReader.close();
oBuff... |
50af0026-2b8b-4f84-b35f-fdbb69da8783 | 4 | void addResult(String valueData, String detailData) {
if (value) {
if (valueData == null) throw new IllegalArgumentException(CLASS + ": valueData may not be null");
values.add(valueData);
if (detail) {
if (detailData == null) throw new IllegalArgumentException(CLASS + ": detailData may not... |
a2962085-5a9c-4c05-bca5-ff7a44ade414 | 2 | private static void removeOldRecords(ArrayList<Long> times) {
Iterator<Long> it = times.listIterator();
while ( it.hasNext() )
if ( isOld( it.next() ))
it.remove();
} |
196a4705-fdd3-4e4a-aced-59e9d5bb7f1e | 7 | @Generated("method")
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof List))
return false;
Iterator<E> e1 = iterator();
Iterator e2 = ((List) o).iterator();
while(e1.hasNext() && e2.hasNext()) {
... |
98798039-feab-4b8a-b0c0-64e889511c1f | 3 | public void run() {
while (true) {
String instruction = null;
try{
instruction = replicas.poll(1, TimeUnit.SECONDS);
if (instruction != null) {
//System.out.println("Processing...." + instruction);
Replica replica = ReplicaFactory.buildReplica(this.getLocation(), instruction); //Auto digested
... |
da77803a-1d91-4e81-9ddd-0a4fefdcaa63 | 9 | public String[] getClaims()
{
if(claims!=null)
return claims;
String s=getParmsNoTicks();
if(s.length()==0)
{
claims = defclaims;
return claims;
}
char c=';';
int x=s.indexOf(c);
if (x < 0)
{
c = '/';
x = s.indexOf(c);
}
if(x<0)
{
claims = defclaims;
return claims;
}
s... |
e3b7f0d0-1a7c-4133-ba5f-0b3db8b1696b | 8 | public static void main (String[] args){
if (args.length < 3 ){
System.out.println("Please enter instance type, instance file and report path.");
System.exit(0);
}
try {
PowerGrid pg = new PowerGrid(args[1]);
if (args[0].equalsIgnoreCase("sarecycl... |
63499183-8171-474e-992d-d22bb3eea146 | 1 | @Test
public void assertBudgetItemsMissingExceptionMessageIsValid() throws Exception {
try {
annualBudget.setCoreBudgetItemList(new ArrayList<CoreBudgetItem>());
budgetCalculation.processBudgetItemsCalculation(annualBudget, breakdown);
fail("SocialBudgetItemList is null"... |
a5c3bfbc-60db-4501-a9ed-32b67eea5897 | 5 | @EventHandler
public void onWorldChange(PlayerChangedWorldEvent event)
{
Player player = event.getPlayer();
if(!player.getWorld().getName().equals(p.getWorld()))
{
ItemStack[] inv = player.getInventory().getContents();
ItemStack[] armor = player.getInventory().ge... |
8022052a-ded4-4cb1-8498-ed895bdb70be | 0 | protected Location getLocation()
{
return location;
} |
ab204d6d-4ff1-425f-a8a9-311b0ad75b4f | 7 | private static boolean test4_1() throws FileNotFoundException {
String input = "new\n" + "pick up rock\n" + "drop rock\n" + "quit\n"
+ "yes\n";
HashMap<Integer, String> output = new HashMap<Integer, String>();
boolean passed = true;
try {
in = new ByteArrayInputStream(input.getBytes());
System.setI... |
1e153921-afd6-4073-914f-6cc9a345290d | 0 | public void setBlocked(Account account){ account.setBlocked(); } |
890c2dfd-25f3-4cfb-942a-b094648ea036 | 7 | public static int generateClassificationTrainingExamples(Vector instances, Surrogate concept, boolean createSignatureP) {
{ int numInstances = instances.length();
Cons consQuery = Stella.NIL;
int numExamples = 0;
TrainingExample example = null;
Proposition prop = null;
Cons classificat... |
81756626-44c4-409a-8895-b20e9f4ee5e4 | 3 | public void test_07_long_lines() {
initSnpEffPredictor("testCase");
String file = "./tests/long.vcf";
Timer t = new Timer();
t.start();
VcfFileIterator vcf = new VcfFileIterator(file);
vcf.setCreateChromos(true);
// They are so long that they may produce 'Out of memory' errors
for (VcfEntry vcfEntry... |
911cda9a-7e10-410c-be44-282838c66c88 | 4 | @Override
public void execute(double t) {
Matrix y = new ColumnMatrix(output.getDim());
for (InputConnector ic : input) {
if (ic != null && ic.isConnected()) {
y = y.plus(ic.getInput());
}
}
try {
output.setOutput(y);
} catch (OrderException e) {
e.printStackTrace();
}
} |
b3201739-89df-4ff1-bf4c-beefd535f670 | 1 | public void simplify() {
if (object != null)
object = object.simplify();
super.simplify();
} |
1c58c2d0-5e45-49c5-820c-7034bc410e06 | 8 | public int insert(char[] word, int I) {
int child_index, new_index;
int i, j, k;
byte cs;
ST_NODE parent;
ST_NODE tmp_node = new ST_NODE();
tmp_node.child = 0;
tmp_node.CS = 0;
tmp_node.I = 0;
tmp_node.K = 0;
k = 0;
if(word.length == 0)
return -1;
search(word);
k += this.search_end;
... |
32c10797-df30-4cfb-9ed3-8eb5fb14aaa6 | 8 | void init() {
setEffort(Effort.getEnumByValue(Util.random(3))); // FULL, NORMAL, EASY
shooting = 12;
stamina = 12;
skill = 12;
passing = 12;
power = 12;
offensive = 12;
defensive = 12;
mental = 12;
int ran = Util.random(8);
switch (ran) {
case 0:
shooting++;
stamina++;
skill++;
passi... |
8b719bab-3150-481e-a65f-d3f23e412e4b | 7 | private byte[] crypt_raw(byte password[], byte salt[], int log_rounds) {
int rounds, i, j;
int cdata[] = (int[])bf_crypt_ciphertext.clone();
int clen = cdata.length;
byte ret[];
if (log_rounds < 4 || log_rounds > 31)
throw new IllegalArgumentException ("Bad number of rounds");
rounds = 1 << log_rounds;
... |
8bc0e93f-88e9-49e0-9aa5-b4320bd61b30 | 6 | @Override
public void actionPerformed(ActionEvent e) {
if (e.getActionCommand() == "CANCELAR") {
this.dispose();
}
if (e.getActionCommand()=="SALVAR") {
if(tfCidade.getText().equals("") && tfBairro.getText().equals("") ){
JOptionPane.showMessageDialog(this, "PREENCHA OS CAMPOS CORRETAM... |
6b4278b5-129e-452e-8667-7843694474ee | 6 | public void westerosCardChoice(boolean choice) {
switch(westerosPhase){
case 1:
if(choice){
supplyUpdate();
}else{
westerosCardMustering();
}
wildingsGrow();
break;
case 2:
if(choice){
westerosCardClashOfKings();
}else{
westerosCardGameOfThrones();
}
wildingsGrow();
b... |
cce3a185-a694-4459-a1f0-ac2616d8f9b1 | 1 | public static void main(String[] args) {
// TODO Auto-generated method stub
try {
OutputStreamWriter osr = new OutputStreamWriter(System.out);
PrintWriter pr = new PrintWriter(osr);
pr.println("Hello");
pr.close();
osr.close();
} catch (IOException e) {
// TODO Auto-generated catch block
... |
1d12596d-2de3-4659-abad-5960fe1560c3 | 9 | public boolean equals(Object obj) {
if (!(obj instanceof PerspectiveTransform)) {
return false;
}
PerspectiveTransform a = (PerspectiveTransform)obj;
return ((m00 == a.m00) && (m10 == a.m10) && (m20 == a.m20) &&
(m01 == a.m01) && (m11 == a.m11) && (m21 == a.m21) &&
(m02 == a.m... |
77e3768b-b2f6-40e4-96c3-9fc1e6852f0a | 3 | private boolean jj_3R_24()
{
if (jj_3R_27()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_28()) { jj_scanpos = xsp; break; }
}
return false;
} |
57b479a3-4f5b-40a1-b2a1-be3527d62a07 | 0 | public int getId() {
return id;
} |
7d8c155b-b269-4335-a322-0883dc9df082 | 1 | public static Element createRuleElement(Document document, LSystem lsystem,
String left) {
Element re = createElement(document, RULE_NAME, null, null);
re.appendChild(createElement(document, RULE_LEFT_NAME, null, left));
List[] replacements = lsystem.getReplacements(left);
for (int i = 0; i < replacements.le... |
5f59ddd3-0f20-4fd5-aec6-ef6cd8969696 | 3 | public Set<String> getKeys(boolean deep) {
Set<String> result = new LinkedHashSet<String>();
Configuration root = getRoot();
if (root != null && root.options().copyDefaults()) {
ConfigurationSection defaults = getDefaultSection();
if (defaults != null) {
... |
43ba7952-2fad-4a0a-9b67-61d2587c5c7a | 0 | public String getAccountId() {
return accountId;
} |
e48886d6-9637-4073-8a70-af7bf0dbd1d9 | 1 | public Graph loopTree() {
if (loopEdgeModCount != edgeModCount) {
buildLoopTree();
}
return loopTree;
} |
91376840-dfad-4c33-ab5b-074c2d785ea7 | 7 | void doEnsure(Ref ref){
if(!info.running())
throw retryex;
if(ensures.contains(ref))
return;
ref.lock.readLock().lock();
//someone completed a write after our snapshot
if(ref.tvals != null && ref.tvals.point > readPoint) {
ref.lock.readLock().unlock();
throw retryex;
}
Info refinfo = ref... |
54e7203c-39aa-4a85-a832-a2bc6439f714 | 1 | @EventHandler(priority=EventPriority.LOWEST)
public void onPlayerMove(PlayerMoveEvent event) {
if(unMovable.contains(event.getPlayer().getName())) {
event.getPlayer().teleport(event.getFrom());
}
} |
0963cb33-7fe1-4a67-922f-87d12415a2db | 9 | public int checkAFK()
{
if(cornerMap.get("A").equals("A")
&& cornerMap.get("F").equals("F")
&& cornerMap.get("K").equals("K"))
{
return SOLVED;
}
if(cornerMap.get("A").equals("F")
&& cornerMap.get("F").equals("K")
&& cornerMap.get("K").equals("A"))
{
return CW;
}
if(cornerMap.get("A... |
b1a7cd25-8bcf-430d-8fcc-43d0371f8b4d | 2 | private void appendMetadataElement(StringBuffer buf, String name, String value, String line_ending) {
if (name == null || name.length() == 0) {
return;
}
buf.append("\t");
buf.append("<").append(ELEMENT_METADATA).append(" ").append(ATTRIBUTE_NAME).append("=\"").append(escapeXMLAttribute(name)).append("\">");... |
73959ae3-f418-48f5-991b-d22801283df3 | 3 | public static boolean isLeapYear(int year) {
return year >= 1582 ? ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) : // Gregorian
(year % 4 == 0); // Julian
} |
a97782d3-43f5-48ba-bc31-4ef34979eaa8 | 7 | @Override
public String getColumnName(int column) {
switch (column) {
case 0:
return "Comp";
case 1:
return "Date";
case 2:
return "Count";
case 3:
return "Price";
case 4:
... |
0e54fe9d-5eab-466a-b8b6-f13a110b6119 | 5 | public static Hand toHand(int input){
switch(input){
case 1:
return new Rock();
case 2:
return new Paper();
case 3:
return new Scissors();
case 4:
return new Lizard();
case 5:
return new Spock();
default:
return null;
}
} |
7c3bc917-ed5c-4569-be90-17cf59d23f7b | 7 | public void update()
{
for(int x = 0; x < WORLD_WIDTH; x++)
{
for(int y = 0; y < WORLD_HEIGHT; y++)
{
if(tiles[x][y] != null)
tiles[x][y].update();
if(collectables[x][y] != null)
collectables[x][y].update();
}
}
for(int i = 0; i < particles.size(); i++)
{
if(particles.ge... |
ba29ce16-1481-40e1-a1a6-e6e41bae4bba | 5 | public void makePersistentSearchResult() {
try {
this.searchResult = (SearchResult) cache.get("searchResult");
extendedLinkedHashMap<String, String> elhm = searchResult
.getRootMap();
Element root = new Element("root");
for (String key : elhm.keySet()) {
if (key == null || elhm.get(key) == null)
... |
4e8d6837-ffc5-4831-bdcb-1397691d846c | 7 | public boolean authenticate(AuthToken token, Message msg) {
if ((token != null) && (token instanceof SimpleToken)) {
// Found a valid Token to authenticate against
SimpleToken serverToken = (SimpleToken) token;
if ((this.auth_value != null) && (serverToken.auth_value != null... |
ca907814-1b2a-4f74-a12f-6ceb4676761f | 4 | public static void main(String[] args) throws Exception {
HamaConfiguration conf = new HamaConfiguration();
BSPJob bsp = new BSPJob(conf);
// Set the job name
bsp.setJobName("Strassen Multiply");
bsp.setBspClass(StrassenBSP.class);
bsp.setJar("strassenNoSyncFinal.jar");
if (args.length < 8 || args.length... |
26c2e458-14b9-4830-89df-a387120ebae4 | 2 | private void firstPlayerMove(){
if(gameRegime == TWO_PLAYERS_GAME_REGIME || gameRegime == TWO_PLAYERS_ONLINE_GAME_REGIME){
System.out.println("First Player,");
} else{
System.out.println("Player,");
}
humanMove(FIRST_PLAYER_NUMBER);
} |
b5718f6f-67f6-4cf0-9f7a-8f7919458ad5 | 2 | public <C extends StatefulContext> void callOnEventTriggered(EventEnum event, StateEnum stateFrom, StateEnum stateTo, C context) throws Exception {
Handler h = handlers.get(new HandlerType(EventType.EVENT_TRIGGER, event, null));
if (h != null) {
ContextHandler<C> contextHandler = (ContextHan... |
44d978d3-569b-4a49-9fe6-c1ecbdbf0099 | 6 | String getTypeLabel(int type)
{
String newType = "";
switch (type)
{
case passiveUser:
newType = "Passive User";
break;
case userContributor:
newType = "Contributor";
break;
case userBugReporter:
newType = "Bug Reporter";
break;
case userTester:
newType = "Tester";
... |
b921ad9c-5f3b-4fbf-af90-7419f1373a51 | 0 | private void bntGuardarNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bntGuardarNuevoActionPerformed
Producto pNuevo = new Producto(descPr.getText(),refPr.getText(),Double.parseDouble(precPr.getText()), Integer.parseInt(combFt.getText()));
GestionarProducto gp = new GestionarPro... |
d6e1641f-79ea-40ba-b753-cac148c4f2c1 | 9 | @Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Post post = (Post) o;
if (date != null ? !date.equals(post.date) : post.date != null) return false;
if (text != null ? !text.equals(post.text) ... |
f429a39c-4327-447e-a675-3f9a69c78f89 | 9 | public void staff(String[] lab, JPanel staffPane, int loggedId) {
this.staffPane = staffPane;
JScrollPane patientsSP = new JScrollPane(tpPatiens);
JScrollPane staffinfoSP = new JScrollPane(staffinfoTP);
StringBuffer loggedUser = new StringBuffer();
JTextPane tpLoggedStaff = new ... |
e0fd40e6-3c1e-480e-995c-2d6d6fc64a58 | 3 | @Override
public boolean sil(int siraID) {
int sonuc = JOptionPane.showConfirmDialog(null, "Sırayı silmek istedğinize emin misiniz?",
"Sil", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if(sonuc != JOptionPane.YES_OPTION)
return false;
t... |
508b4ede-6881-492a-beb2-aef7674e4b5b | 8 | * responsible for reporting the error to the user through
* ValidationEventHandler.
*/
private String convert(String v) throws Exception {
if (v == null) {
return null;
}
if (minLength != null && v.length() < minLength) {
throw new Exception("string le... |
b0087732-6a00-44ca-aa73-c9d06cefe256 | 1 | public CouldNotEncodePacketException(PacketEncodingException e, Packet packet) {
super("Packet not encodable" + (e == null ? "." : "--" + e.getMessage()), packet);
wrappedException = e;
} |
49dae895-17c0-49eb-bd8c-c3bb0d30015c | 9 | private static ArgValue parseArgument(String arg)
{
for(String opt : HELP_OPTIONS)
{
if(opt.equals(arg))
return ArgValue.HELP;
}
for(String opt : VERBOSE_OPTIONS)
{
if(opt.equals(arg))
return ArgValue.VERBOSE;
}
for(String opt : SILENT_OPTIONS)
{
if(opt.equals(arg))
return ArgValue... |
9a3e4f3f-dcc4-4a9f-943d-fe00838b7df0 | 5 | public int getCount(String sequence) {
reverseComplement = new ReverseComplement(sequence);
String reverseSequence = reverseComplement.getReverseComplement();
int count = 0;
if (containsString(sampleText, reverseSequence)) {
count = 0;
} else {
for (int i ... |
450bbe2e-896d-4139-a46a-e7257fcd5f61 | 7 | public void eliminarDuplicados() {
Nodo<T> q = p;
Nodo<T> r;
Nodo<T> s = q;
boolean ban;
while (q != null && s.getLiga() != null) {
ban = false;
r = q;
s = q.getLiga();
while (s.getValor() != q.getValor() && !ban) {
... |
a95d66b9-cf02-4e5c-b5f1-bfc35a692573 | 9 | private void saveDuplicateResults() {
Saver slf_save = new Saver();
int totalSize = MasterList.size();
LabelMaxSize = 2 * totalSize - 1;
int progCounter = 0;
SpecialFile[] list = new SpecialFile[totalSize];
List<SpecialFile> cpyLst = new ArrayList<SpecialFile>();
SentinelProgressLabel.setText("Analy... |
c8901b54-db37-4e3c-ad2e-dcb0a4db34eb | 4 | public void unZipIt(String zipFile, String outputFolder) {
byte[] buffer = new byte[1024];
try {
File folder = new File(OUTPUT_FOLDER);
if (!folder.exists()) {
folder.mkdir();
}
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile));
ZipEntry ze = zis.getNextEntry();
System.ou... |
759abe06-6db4-4667-b4f6-4b253544dfcb | 8 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
File cacheFile = new File(UPLOAD_CACHE_PATH);
if (!cacheFile.exists()) {
cacheFile.mkdir();
}
... |
eb9cf428-5de3-47d4-a77c-a8bfb4ca8cb4 | 6 | public boolean start() {
synchronized (optOutLock) {
// Did we opt out?
if (isOptOut()) {
return false;
}
// Is metrics already running?
if (taskId >= 0) {
return true;
}
// Begin hitting the se... |
948bece9-ad88-4fbc-a0c2-8449023d9b87 | 9 | public static void main(String[] args) throws InterruptedException
{
Logger.initialize();
Logger.setLoggingLevel(LoggingLevel.DEFAULT);
// kontrola typu operacniho systemu
if (!SystemCheck.isSupported()) {
String message = String.format("Vas operacni system neni aplikaci... |
093866ac-1054-4c18-8d69-af13d3950171 | 3 | private int lastIndexOf(int c) {
int i = len;
boolean ok = false;
while (i > 0)
if (buf.charAt(--i) != c)
ok = true;
else if (ok)
return i;
return -1;
} |
60f67b40-36bf-4f44-a557-bc73a7f699af | 9 | private int[] randomComputeLastIndex(String key, boolean skipFirst)
{
int count = 0;
int keyIndex = lastHTMLReply.indexOf(key);
// 1. Count the number of times we find key
while (keyIndex != -1)
{
count++;
keyIndex = lastHTMLReply.indexOf(key, keyIndex+key.length());
}
if ((cou... |
1e0a22ac-e18f-4e23-b1d4-cc5f117c0d17 | 8 | public void update(final Observable obj, final Object arg) {
final String line = (String) arg;
final String thisLine = line.substring(line.indexOf("Text [") + "Text [".length(), line.indexOf("]", line.indexOf("Text [")));
if (thisLine.indexOf(E2E_SEND) < 0) {
return;
}
... |
7e7a8b75-0f37-44d7-ab94-ee21771666aa | 1 | public AccBtnPreview(SkinPropertiesVO skinproperties, JPanel parent) {
if (skinproperties == null) {
IllegalArgumentException iae = new IllegalArgumentException("Wrong parameter!");
throw iae;
}
this.skin = skinproperties;
this.parent = parent;
} |
c55544c2-3407-4d55-b9e8-120908313934 | 2 | @Override
public String getToolTipText(MouseEvent event) {
Column column = overColumn(event.getX());
if (column != null) {
Row row = overRow(event.getY());
if (row != null) {
return column.getRowCell(row).getToolTipText(event, getCellBounds(row, column), row, column);
}
}
return super.getToolTipTe... |
6edc1784-b2ae-475f-ab62-3fd5761d67a8 | 2 | private static Hashtable<String, TestCase> getTests(String solFile) throws IOException {
RandomAccessFile raf = new RandomAccessFile(new File(solFile), "r");
Hashtable<String, TestCase> ret = new Hashtable<>();
String questionClassName;
while ((questionClassName = nextViableLine(raf)) != ... |
04d6015f-65ab-45c9-b09d-cbdef60b2ae1 | 1 | private String replace_all(String s, final String from, final String to)
{
int index = 0;
while ((index = s.indexOf(from)) != -1)
{
s = s.substring(0, index) + to + s.substring(index + from.length());
}
return s;
} |
5074772e-e695-4385-98e8-74fc2aaf28e3 | 6 | public void affichage(){
System.out.println("+------------+");
if (this.valTab[0]>=0) {
System.out.println("| "+this.valTab[0]+" |");
} else {
System.out.println("| "+this.valTab[0]+" |");
}
if (this.valTab[1]>=0 && this.valTab[3]>=0) {
System.out.println("| "+this.valTab[3]+" ["+th... |
88212f49-8374-4bfc-b12c-72ae54571228 | 5 | @Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof HabitatFeature)) {
return false;
}
HabitatFeature other = (HabitatFeature) object;
if ((this.featureID == null ... |
8a7d0882-6b39-410e-94b0-b1a9bca05f93 | 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... |
b062cb1c-0585-4dd0-be6f-574ef5019372 | 7 | public void qsorthelper( int begin, int end ) {
if ( end - begin >= 1 ) {
//To hold the position of the first element;
int pivot = begin;
int ppos = pivot;
//To hold the position during the swap of data[pivot] and left or right.
i... |
13bb5a59-d75d-45b1-b0ef-4cb5d3382610 | 2 | public void callAction(String args) {
if (args.equalsIgnoreCase("NeuNet")) {
/*ActivationCalculation calc = new ActivationCalculation();
calc.setupIdentity();
ui.printToConsole("Loading NeuNet...");
Perceptron perc = new Perceptron(2);
perc.addNeuron(0, 2, ENeuronType.Input, calc);
perc.addNeuron(1,... |
c086d548-deb8-4abd-aacf-505283d67d0d | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Telefone other = (Telefone) obj;
if (this.id != other.id) {
return false;
}
i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.