method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
b30db079-2de0-47f3-802c-ac24d4dc57a5 | 3 | public static Deck selectOne(Deck[] old, float[] perf, float total){
float target = ((float) Math.random())*total;
float running = 0;
for(int j=0; j<perf.length; j++){
running += perf[j];
if((running > target) || (j == perf.length)){
return new Deck(old[j]);
}
}
return new Deck(old[old.length]);... |
9db092a2-7799-41df-9e1b-eeeb2dc8f236 | 3 | public static void main(String[] args) {
if (args.length < 2) {
print("Usage:\njava TestRegularExpression "
+ "characterSequence regularExpression+");
System.exit(0);
}
print("Input: \"" + args[0] + "\"");
for (String arg : args) {
print("Regular expression: \"" + arg + "\"");
Pattern p = Patte... |
6ad76103-2beb-4f35-ae55-ed561101ee0c | 3 | public static void parse(String message) {
for(Commands c : Commands.values()) {
try {
Command command = c.getCommandClass().newInstance();
String s = command.getCommandLabel();
Log.info(s);
Log.info(message);
if(message.startsWith("!" + s)) {
command.doAction(message.replace("!" + s + " "... |
58a7e22c-a44f-414d-93f5-5cd1399b8071 | 4 | public boolean mouseIsInMenuPosition(int x, int y, int xx, int yy){
if(x>=mouseMenuButtonLeft(xx)&&x<=mouseMenuButtonRight(xx)&&y<=mouseMenuButtonDown(yy)&&y>=mouseMenuButtonUp(yy)){
return(true);
}
else{
return(false);
}
} |
4580af5d-efa3-43ae-a443-919f7d66483e | 8 | private void saveExperiment() {
int returnVal = m_FileChooser.showSaveDialog(this);
if (returnVal != JFileChooser.APPROVE_OPTION) {
return;
}
File expFile = m_FileChooser.getSelectedFile();
// add extension if necessary
if (m_FileChooser.getFileFilter() == m_ExpFilter) {
if (!e... |
615478c4-a88d-4a10-a88b-29ed6cab25c2 | 0 | @RequestMapping("/")
public String index(@RequestParam(required = false, defaultValue = "") String keyword,
@RequestParam(required = false, defaultValue = "0") int page,
@RequestParam(required = false, defaultValue = "10") int size, Model model) {
Page<User> p... |
597c1054-9d72-4b40-b025-a5e483465447 | 0 | public boolean has(String key) {
return this.map.containsKey(key);
} |
1dd0ad13-ef38-4f78-ad1b-27a4a863696c | 6 | public Component getTableCellRendererComponent (JTable table, Object value, boolean selected,
boolean focused, int row, int column){
super.getTableCellRendererComponent(table, value, selected, focused, row, column);
if(column == 5 || column == 6) { // Colors the weekends red
setBackground(new Colo... |
c5a097dc-68e9-4565-85ad-b4b685e71b96 | 7 | private void possiblyCloseCurlyBrace(RSyntaxTextArea textArea,
String leadingWS) {
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
if (textArea.getCloseCurlyBraces() &&
doc.getCurlyBracesDenoteCodeBlocks()) {
int line = textArea.getCaretLineNumber();
Token t = doc.getToke... |
8aefc0cf-eff3-4833-8a18-0e242e298f9b | 4 | @Override
public void mouseReleased(int button, int x, int y) {
switch(button){
case Input.MOUSE_LEFT_BUTTON:
switch(interactionState){
case mapScrolling:
revertInteractionState();
break;
}
break;
case Input.MOUSE_RIGHT_BUTTON:
switch(interactionState){
case scrolling:
... |
1acca4e6-4984-48cb-91db-0728d5b8ae95 | 3 | public static void main(String args[])
{
new ItemTest();
user[0]=new Pokemon(Pokemon.Species.EEVEE,Pokemon.Move.FLAMETHROWER,Pokemon.Move.SELFDESTRUCT,Pokemon.Move.PSYCHIC,Pokemon.Move.RECOVER,4);
//user[0].setNickname("Scrappy");
user[1]=new Pokemon(Pokemon.Species.MISSINGNO,68);
user[2]=new Pokemon(Pokemon... |
af97ec0b-a247-41b0-ac83-1c16acb721ca | 1 | public static void spawnWisp (Location loc, int amount) {
int i = 0;
while (i < amount) {
Wisp Wisp = (Wisp) loc.getWorld().spawnEntity(loc, EntityType.BAT);
Wisp.getWorld.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 0);
Wisp.getWorld.playEffect(loc, Effect.POTION_BREAK,... |
98d1a411-9073-4ea2-9ea5-9995d8715074 | 1 | public static AbstractDriver getInstance(String className) {
AbstractDriver driver = null;
try {
driver = (AbstractDriver) Class.forName(className).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
return driver;
} |
bcbe8c4e-8d96-4a6c-a495-35d2cf57d1a2 | 1 | @SuppressWarnings("unchecked")
public static <T> T createUninitialisedObject(Class<T> c) {
try {
return (T) $.allocateInstance(c);
} catch (Exception e) {
throw new Error(e);
}
} |
464f3b3c-23dd-4382-a440-2e366d1423c9 | 6 | public int getBoostedStat(int skill, boolean sup) {
int increaseBy = 0;
if (sup)
increaseBy = (int)((skill == 3 ? c.maxConstitution : c.getLevelForXP(c.playerXP[skill]))*.20);
else
increaseBy = (int)((skill == 3 ? c.maxConstitution : c.getLevelForXP(c.playerXP[skill]))*.13) + 1;
if (c.playerLevel[skill] +... |
fc24180e-fca4-48f8-8745-e33141b298a6 | 8 | public void processEvent(Event event)
{
if (event.getType() == Event.COMPLETION_EVENT)
{
System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle());
return;
}
System.out.println(_className + ".processEvent: Received Login Response..... |
f8620e51-c2f7-4b78-bcf0-266999b9c842 | 1 | void pudotaMuodostelma(Muodostelma muod) {
while (muod.putoaa) {
muod.putoa();
}
} |
ceacfc9f-b605-4ed7-b408-2c2fa1c42548 | 7 | private void bufferQueue() {
if ( maxNumMessages <= 10 ) { // get directly if what we want can be get within one request
if (messages.size() == 0) {
try {
long getMessageQueueStat = perf.getStartTime();
// receive the messages and store them in a class variable
for (in... |
d623e713-b3d8-4b1f-87d7-498b6790a7ad | 3 | @Override
public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
if (value == null || value.length() == 0 || JsfUtil.isDummySelectItem(component, value)) {
return null;
}
return this.ejbFacade.find(getKey(value));
} |
5f3d2f66-c441-450b-9c86-b417edd13888 | 3 | private static double integratedFirstOrderStockFunction(RealDistribution demand, double x, UnivariateIntegrator integrator, double accuracy){
StockIntegrand Integrand = new StockIntegrand(demand, x);
try{
double min = demand.inverseCumulativeProbability(accuracy);
double max = x;
double aux = integr... |
8b0baca2-5cd0-497e-98e0-505bc5bc677c | 4 | @Override
public boolean accept(File f)
{
if(f.isDirectory())
return true;
String name = f.getName();
int i = name.lastIndexOf(".");
if(i>0 && i<name.length()-1)
{
String type = name.substring(i+1).toLowerCase();
if(type.equals(Constante... |
09ff3773-a3e7-42ca-9da9-34eebb95a9dd | 8 | private void removeTabIfPossilbe(KeyEvent event, JTextComponent component) {
try {
Document doc = component.getDocument();
int caretPostion = component.getCaretPosition();
int lineStartIndex = doc.getText(0, caretPostion).lastIndexOf('\n') + 1;
lineStartIndex = li... |
82285909-d65e-4a8f-b904-01b4464d430f | 2 | public void updateMaze() {
// Set the borders and potential value
for (int i = 0; i < newRun.BOARD_MAX; i++) {
for (int j = 0; j < newRun.BOARD_MAX; j++) {
board[i][j].setBorder(findBorder(j, i, false));
board[j][i].setText(String.format("%d", newRun.getPotent... |
f604cb31-7ef6-4828-a1d6-efa23818b2bb | 2 | private void subtractButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_subtractButtonActionPerformed
try {
BigDecimal value;
try{
value = new BigDecimal(subtractField.getText());
value.setScale(2, RoundingMode.FLOOR);
}ca... |
56d999d5-9b33-4f3e-a41d-eba6d0df3992 | 9 | public String standardizeCode(String code) {
// The default action is just to return the first 2 characters, converted to lower
// case. We only need to special-case the ones where the native or anglicized version
// of the name does not begin with the two code letters.
String c = code.toLowerCase();
... |
a28b0da1-dd6c-4cb1-b87f-fcd63436ec24 | 1 | public void setAlwaysDrawGrouting(boolean always) {
if (alwaysDrawGrouting != always) {
alwaysDrawGrouting = always;
forceRedraw();
}
} |
a80a1d55-68e1-45c6-96b4-fba86e1c1cdc | 6 | public void decryptFile(String filePath, byte[][][] reversedSubKeys) {
System.out.println();
System.out.println("Decrypting Async");
try {
final File inputFile = new File(filePath);
final File outputFile = new File(filePath.replace(".des",".decryptedasync"));
... |
d24f226d-7599-4922-88a0-7d03ab227db5 | 6 | private void createOrderTable(indiv in) {
DefaultTableModel model = new DefaultTableModel();
model.addColumn( "Card name" );
for ( int i = 0; i < this.sellers.length; i++ ) {
model.addColumn( this.sellers[i][0] );
}
model.addColumn( "Total" );
for ( int i = 0; i < this.cardList.size(); i++ ) {
String... |
5357946a-e721-4d7e-a8e4-9dafeb8fa686 | 1 | public void notifyPropertyChangeListeners(int oldMoney, int newMoney) {
PropertyChangeEvent event = new PropertyChangeEvent(this, "money", oldMoney, newMoney);
for(PropertyChangeListener listener:listeners) {
listener.propertyChange(event);
}
} |
1b3d1a1a-45d0-44be-8071-f33c577ffbec | 2 | private final static void mayRaise ()
{
if (!ZError.is (0) && !ZError.is (ZError.EAGAIN))
throw new ZMQException (ZError.errno ());
} |
f45b4e5e-7a0d-4d15-82a8-2fb6c6a0c8d8 | 9 | @Override
public void train(List<SentencePair> trainingData) {
System.out.println("NUM ITERS = " + NUM_ITERS);
System.out.println("Starting train() for model 2...");
initParams(trainingData);
for (int p = 0; p < NUM_ITERS; p++) {
System.out.prin... |
7038880e-f0ae-48d5-913d-4ab171051c4e | 4 | private void initializeTree() {
ArrayList<ClassType> types = dataStore.getTypes();
tree = new JTree(new DefaultTreeModel(new DefaultMutableTreeNode()));
for (ClassType ct : dataStore.getTypes()) {
DefaultMutableTreeNode node = new DefaultMutableTreeNode("[" + ct.getShortName() + "] " + ct.getName());
... |
bd60e7c3-7fe7-4851-b25c-bdc40282a96a | 0 | public Locale getLocale() {
return loc;
} |
7c31b301-108f-47f4-a27a-4fa0a9707d46 | 0 | public void setForme(Forme forme) {
this.forme = forme;
} |
5c443043-3e70-4b86-be23-43db08b97c44 | 4 | private Bruch rechenOperation(Bruch zweiterBruch, char operation) {
boolean echt = false;
// Beide Brüche unecht machen um das Rechnen zu vereinfachen
Bruch tmpBruch1 = this.unechterBruch();
Bruch tmpBruch2 = zweiterBruch.unechterBruch();
Bruch ergebnisBruch;
// War ein... |
2ad2ae20-52ea-4e4d-8b4c-eb23b4a24def | 1 | public double getComplexity() {
if (code == null)
return 0.0;
else
return code.getInstructions().size();
} |
93585bf2-9748-4063-8414-6a6907e01501 | 4 | public byte[] getBytes() {
ByteArrayOutputStream b = new ByteArrayOutputStream();
try {
b.write(magic);
byte[] ascii = command.getBytes("ASCII");
for (int i = 0; i < 12; i++) {
if (i < ascii.length) {
b.write(ascii[i]);
} else {
b.write(0);
}
}
byte[] pbytes = payload.getByt... |
e3530e30-0c08-40c7-a833-4cebdfd7518a | 5 | @Override
public void handleEvent(String sender, String type, String receiver, String content) {
if (type.equals("311")) {
// Start WHOIS
waitingWhois = true;
whoisBuffer = new ArrayList<String>();
} else if (type.equals("318")) {
// End WHOIS
... |
4b95e199-689f-459f-aac9-6f97aaf93b99 | 4 | public static void main(String[] argv) {
if (argv.length == 1) {
if (argv[0].equals("--dump-defaults")) {
CommentedProperties comProps = defaultProperties();
try {
comProps.getProperties().store(System.out, comProps.getComments());
} catch (IOException e) {
System.err.println("Couldn't write ... |
3ec98326-8ddf-4570-8a2d-04449a886c4e | 5 | public static void deleteJournal(ArrayList<Journal> journalList, Journals journals) {
ArrayList<String> failed = new ArrayList<String>();
for(Journal journal : journalList) {
try{
journals.removeBusinessObject(journal);
}catch (NotEmptyException e){
... |
91243f68-543b-4e5e-861d-8ec68f395c8f | 2 | public static int[] sort(int[] list){
if(list == null || list.length == 0){
return list;
} else{
quickSort(list, 0, list.length-1);
return list;
}
} |
dbacdb46-3331-4d00-8f7f-fbf4d76ff61c | 7 | @Override
public StringBuilder makeColumns(MOB viewerM, List<String> reverseList, String tag, int numCols)
{
final StringBuilder topicBuffer=new StringBuilder("");
int col=0;
String s=null;
final int colSize = fixColWidth(72.0,viewerM) / numCols;
for(int i=0;i<reverseList.size();i++)
{
if((++col)>numCo... |
6e74b458-1a3a-4382-a44a-f3b6220107cf | 3 | boolean rotateAlgorithm(Board board, Point base, Point[] newRel, Point[] kickList) {
Point[] tmp = kickList;
kickList = new Point[kickList.length+1];
kickList[0] = new Point(0,0);
for (int i = 0; i < tmp.length; i++) {
kickList[i+1] = tmp[i];
}
for (Point p : kickList) {
Point newBase = Point.trans... |
1fe193a9-6e8d-4c58-b83e-47a3a1a51795 | 1 | @Override
public String toString() {
String toString = "{\n";
for (Map.Entry<String, HostInfo> entry : this.hosts.entrySet()) {
toString += entry.getKey() + "\n";
toString += entry.getValue() + "\n";
}
toString += "}\n";
return toString;
} |
74ae9e61-0396-486c-bd0c-f71ae8b0e564 | 2 | public void dumpExpression(TabbedPrintWriter writer)
throws java.io.IOException {
subExpressions[0].dumpExpression(writer, 550);
writer.breakOp();
writer.print(" <=>");
if (allowsNaN)
writer.print(greaterOnNaN ? "g" : "l");
writer.print(" ");
subExpressions[1].dumpExpression(writer, 551);
} |
f64c897d-8be1-4b8b-9232-2e95f58615fd | 1 | public String searchByPhone(String phone) throws Exception {
if (searchingFile(phone, "phone") == null) {
return null;
}
return searchingFile(phone, "phone").name;
} |
fd32a867-66fa-49e4-940e-850f6225e194 | 7 | protected void assertIntRangeSplit(final int lower, final int upper, int precisionStep,
final boolean useBitSet, final Iterator neededBounds
) throws Exception {
final OpenBitSet bits=useBitSet ? new OpenBitSet(upper-lower+1) : null;
NumericUtils.splitIntRange(new NumericUtils.IntRangeBuilder() {
... |
7fb72ee2-dc2e-45a3-bc69-ddc5d1e3d810 | 5 | private void insert(BSTNode<T> currentNode, BSTNode<T> newNode) {
int compVal = newNode.getValue().compareTo( currentNode.getValue());
if (compVal == 0)
return;
if (compVal < 0) {
if (currentNode.getLeft() == null) {
currentNode.setLeft(newNode);
... |
5ba11127-b36a-40fa-b35f-f990de852fc3 | 9 | @Override
public void lock(int myId) {
while(true){
flag[myId]=true;
last=myId;
if (open_id!=-1){ //door close
flag[myId]=false;
while (open_id!=-1);
continue;
}
else{
open_id=myId; //I close the door
if(last==myId)
return; //Down
... |
74731d32-4618-4f1a-a3c6-879d7bcf9ab2 | 0 | public Node1(String data){
this.data = data;
} |
6f84a3f2-5151-4700-b536-a719ccc1ddf8 | 7 | public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page ... |
299b997b-6c9f-42fb-9702-3f056f618890 | 7 | private static int partion(int[] n, int start, int end) {
int tmp = n[start];
while (start < end) {
while (n[end] >= tmp && start < end) {
end--;
}
if (start < end) {
n[start++] = n[end];
}
while (n[start] < tmp && start < end) {
start++;
}
if (start < end) {
n[end--] = n[start]... |
028b9d4d-a739-436b-93ed-c8b51d4279bc | 5 | public void actionPerformed(ActionEvent ae) {
//
// Process the action command
//
// "ok" - Data entry complete
// "cancel" - Cancel request
// "help" - Display help for securities
//
try {
String action = ae.getActionCommand();
if... |
40de923b-6945-4990-a645-1872a14eb59c | 8 | protected void loadFromConfiguration() {
for (Map.Entry<String, Object> val : db.getValues(false).entrySet()) {
if (val.getValue() instanceof MemorySection) {
MemorySection m = (MemorySection) val.getValue();
HashMap<ItemValue, ItemPrice> pricelist = new HashMap<ItemValue, ItemPrice>();
String itemN, i... |
6b45199f-674e-493a-98e1-581f4e87d876 | 9 | public void runSelendroidServer() {
String commandsForInstalled[] = {"java",
"-jar",
selendroidPath + File.separator + selendroidBinary,
"-verbose",
"-port",
String.valueOf(aut.getPort()),
"-installedApp",
aut.getPackageName() + "/" + aut.getMainActivity() + ":" + aut.getAppVersion()}... |
68c058a5-ae9a-4317-a9d5-882e4ec74215 | 8 | public static void main(String[] args) {
try {
// Command Line with the name of the file as an argument.
FileReadService fr = new FileRead();
for (int i = 0; i < args.length; i++) {
System.out.println("Reading: " + args[i]);
String path = args[i];
fr.read(path, ";");
}
/*
* We display ... |
283886dc-769d-42f8-b01f-10c08fbe8eb3 | 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 ModelPropertyValue)) {
return false;
}
ModelPropertyValue other = (ModelPropertyValue) object;
if ((this.modelP... |
8c15b05c-1282-471d-b5cc-65984202e384 | 0 | @Override
public void startSetup(Attributes atts) {
super.startSetup(atts);
addActionListener(this);
} |
4e17a180-f116-4f59-82f9-6cddbdc9612d | 7 | public int[][] generateMatrix(int n) {
if (n < 0) {
return null;
}
int[][] res = new int[n][n];
//start with value 1
int start = 1, x = 0, y = 0;
/**
* after every loop, 2 numbers are filled into each row and column
*/
for (int i = ... |
39851acd-a762-4e8b-b262-2c5d555199d2 | 4 | @Override
public void execute(CmdOptions options) {
try {
PrinceDocument doc;
String input = options.params[0];
Config config;
if(input.startsWith("http")) {
config = new Config(new URL(input));
} else {
config = new Config(new File(input).toURI().toURL());
}
BakaTsuki.info("Converting ... |
a123f51e-fc03-40de-8c33-cfa12a0cea07 | 9 | public Main() throws IOException, SAXException, ParserConfigurationException
{
Runtime.getRuntime().addShutdownHook(new Cleaner());
// Loading the properties
if (properties.checkAndLoad()) {
File nodeExecutable = getNodeJsExecutableFile();
// Reading the XML with t... |
b62c7ed0-2eef-45a8-b7b7-6053264f9dd6 | 4 | private static void folydWarshall(
HashMap<Integer, HashMap<Integer, Integer>> g, int[][] dist) {
for (int k = 1; k <= dist.length - 1; k++) {
for (int i = 1; i <= dist.length - 1; i++) {
for (int j = 1; j <= dist.length - 1; j++) {
if (dist[i][j] > dist[i][k] + dist[k][j])
dist[i][j] = dist[i][k... |
70e90afa-95ed-4c98-bc3f-5e5fd45611af | 1 | public boolean isLoaded(String name) {
ArrayList imsList = (ArrayList) imagesMap.get(name);
if (imsList == null) {
return false;
}
return true;
} |
8f18bd4f-cf9b-4b7d-8a41-0cee5a8ea095 | 9 | @EventHandler
public void onPlayerDamaged(EntityDamageEvent event) {
if (event.getCause() != DamageCause.SUICIDE) {
if (event.getEntity() instanceof Player) {
switch (HeroesHandler.inGamePlayers.get(event.getEntity())) {
case EARTH_SHAKER: {
break;
}
case ICE: {
if (event.getCause().equ... |
14d0d66c-899f-4f63-957a-d20c0618aca5 | 2 | public static void main(String[] args)
{
Tokenizer tokenizer = new Tokenizer();
//tokenizer = new Tokenizer("testfile.txt");
Scanner s = new Scanner( System.in );
while (true)
{
String line = s.nextLine();
List<String> tokens = Tokenizer.tokenize( line );
if (tokens == null... |
2a9d5c4c-675b-433d-affc-4f404a4c4e79 | 3 | private TreeNode rebuild(String[]nodes,int[]index){
String data=nodes[index[0]++];
if(data.equals("NULL")) return null;
TreeNode node=new TreeNode(Integer.parseInt(data));
if(index[0]<nodes.length){
TreeNode left=rebuild(nodes,index);
node.left=left;
}
... |
817ca519-c55e-477c-873a-8e617099a7f9 | 4 | void checkUpsetReturnType(Method method, String annotationName) throws DaoGenerateException {
Class<?> returnType = method.getReturnType();
if (net.energy.utils.ClassHelper.isTypePrimitive(returnType)) {
returnType = ClassHelper.primitiveToWrapper(returnType);
}
if (net.energy.utils.ClassHelper.isTypeVoid(r... |
9499225c-1771-4aeb-b50a-9a6e856f15fb | 2 | public byte getByte(String key) {
try {
if(hasKey(key))
return ((NBTNumber<Byte>) get(key)).getValue();
return 0;
} catch (ClassCastException e) {
return 0;
}
} |
499fdb89-90f2-4f6d-9624-abf79d45baef | 5 | public static void main(String[] args) {
// TODO code application logic here
Scanner Entrada = new Scanner(System.in);
String cadena1="";
String cadena2="";
cadena1=(JOptionPane.showInputDialog("Ingrese Cadena 1"));
cadena2=(JOptionPane.showInputDialog("... |
ef804a1c-e101-4881-bce5-14333680f19e | 9 | @Override
public Parameter getParameter(final int parameterIndex) {
Parameter parameter;
switch (parameterIndex) {
case 0:
case 1:
parameter = super.getParameter(parameterIndex);
break;
case 2:
parameter = rate1;
... |
d02a819d-e797-4b02-bb20-fe901fab3dcf | 3 | public String toString() {
String X = String.valueOf((x % 1 == 0) ? (int) x : x),
Y = String.valueOf((y % 1 == 0) ? (int) y : y),
Z = String.valueOf((z % 1 == 0) ? (int) z : z);
return X + ", " + Y + ", " + Z;
} |
d09c331c-feba-4a25-a7f5-668674c07405 | 8 | public void interactWithHero()
{
Hero hero = getActivePlayer().getActiveHero();
int x = hero.getX();
int y = hero.getY();
boolean found = false;
Hero hero2 = null;
for (int i=x-1; i<=x+1; ++i) {
for (int j=y-1; j<=y+1; ++j) {
hero2 = wmap.getHeroAt(i, j);
if (hero2 != null && hero != hero2 && he... |
83f7dd43-85b0-4ce3-a3ef-c6cab3287a99 | 4 | public ArrayList<Part> getFilteredParts() {
ArrayList<Part> filtPart = new ArrayList<Part>();
for(int i=0; i< partList.size(); i++) {
Part p = partList.get(i);
boolean flag = true;
if (!filterString.equals("")) {
flag = p.name.toLowerCase().contains(filterString);
flag |= p.notes.toLowerCase().cont... |
391ac7dd-2fd9-49b9-a323-2bae052176d0 | 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... |
cc0ade56-f37d-454a-a441-ca641a043be4 | 0 | private void initComponents() {
setLayout(new GroupLayout());
add(getJLabel0(), new Constraints(new Leading(81, 10, 10), new Leading(39, 10, 10)));
add(getJLabel1(), new Constraints(new Leading(40, 10, 10), new Leading(84, 10, 10)));
add(getJTextField0(), new Constraints(new Leading(76, 201, 10, 10), new Leadin... |
2d97baa3-fe5a-44e8-be51-1a567e3b14d6 | 7 | private void economicUpdate() {
if (base().credits() < 500) base().incCredits(1000) ;
final Batch <Venue> sampled = new Batch <Venue> () ;
final World world = world() ;
final Tile t = world.tileAt(world.size / 2, world.size / 2) ;
world.presences.sampleFromKey(t, world, 100, sampled, Venue.clas... |
0574c878-240a-4a75-b754-56d87fb4f68c | 1 | @SuppressWarnings("unchecked")
public void addQustionToDB() {
String questionStr = (String) question;
String answerStr = getConcatedString((ArrayList<String>) answer);
// add to database
try {
String statement = new String("INSERT INTO " + DBTable
+ " (quizid, position, question, answer, score) VAL... |
1d6dc1fe-5f42-4fb0-adfa-7ec44c000758 | 1 | NotebookTSVDb(final String fileName) throws IOException {
file = new File(fileName);
if (!file.exists()) {
file.createNewFile();
System.out.println("New file " + fileName + " has been created in the current directory");
}
} |
f37a7fee-4f15-4a3d-b128-a9b900eb2acf | 0 | public void addGem(Gem gem)
{
gem.SetX(0);
gem.SetY(0);
this.Bag.add(gem);
} |
636e4d17-04c9-4ee8-a0a5-0286ccb75f26 | 4 | private boolean validateValue(String msg, int gridletId, int userId,
int resourceId)
{
boolean valid = true;
// Gridlet ID must be 0 or positive
if (gridletId < 0)
{
valid = false;
System.out.println(msg + "Error - Gridlet ID must be >= 0, not... |
7984fe47-b27d-4310-a233-bb4fca25abc1 | 8 | private void initializeAll()
{
String raceName = Control.activeRaceName.toLowerCase();
String selectText = "Select ";
if( raceName.startsWith("a") || raceName.startsWith("e") ||
raceName.startsWith("i") || raceName.startsWith("o") ||
raceName.startsWith("u"... |
ddeaa7e4-f8a4-40ab-a720-aed5dfbd6f09 | 4 | public String listar() throws SQLException {
String tbl = "";
ResultSet list = null;
String colorEstado = "";
String iconoEstado = "";
String nomFuncion = "";
try {
list = Pro.consultarProfesores();
while (list.next()) {
tbl += "<t... |
d87259f1-34ee-4d72-a246-1dee96d61d73 | 4 | public void castDeath(Actor actor) {
scenery.remove(actor);
if(party.getMember(actor) != null)
party.removeMember(actor);
PropQuad.get().removeProp(actor);
cast.remove(actor);
if(actor.getName().matches("Bonepile")) {
actor.setState(CharState.DEAD);
actor.getSprite().shadow = null;
actor.setFla... |
ee005aa5-6394-4cfe-b989-c8bf3bafe3a4 | 8 | private static Item parseItem(Node itemNode, Channel channel) {
String title = null;
String description = null;
String link = null;
NodeList itemNodes = itemNode.getChildNodes();
int numItemNodes = itemNodes.getLength();
for (int i = 0; i < numItemNodes; i++) {
... |
391ea014-ddc0-4322-a511-9e9a0b4c70f1 | 0 | public int getpX() {
return pX;
} |
59b8f365-47a8-4cf8-9118-ea3df708c0c5 | 4 | public void paintComponent(Graphics g) {
super.paintComponent(g);
this.setBackground(Color.GRAY);
drawAll(); //játékelemek nézeteinek frissítése
manaLabel.setText("Varázserő: "+updater.getMana()); //varázserő mennyiség frissítése
g.drawImage(image, 0, 0, null);
//ha a játék már véget ért, akkor érvénytel... |
20f20199-9253-45a3-8896-c5d8e25236d7 | 0 | public void setHelloWorld(String helloWorld) {
this.helloWorld = helloWorld;
} |
0f7e8561-778f-49c9-9bcb-d9f51489a0d8 | 7 | private boolean removeFromBoard(String element, Position position) {
boolean remove = false;
if(position.getX() >= 0 && position.getY() >= 0) {
ArrayList<String> elements = readFromBoard(position);
if(elements.contains(element)) {
if(elements.remove(element)) {
remove = true;
if(!el... |
a6b78d7d-b728-46f9-91d3-e9f3d0f8e628 | 5 | public void display()
{
double gross;
double total;
int num;
double num1=0,num2=0,num3=0,num4=0;
int product=0;
while(product<4)
{
product++;
System.out.println("Enter number sold of product"+product+" :" );
Scanner s1 =new Scanner(System.in);
num=s1.nextInt();
if (product==1)
... |
02072edd-b06d-4728-947b-d9222fac5f17 | 6 | public boolean getBoolean(int index) throws JSONException {
Object object = this.get(index);
if (object.equals(Boolean.FALSE)
|| (object instanceof String && ((String) object)
.equalsIgnoreCase("false"))) {
return false;
} else if (object.equal... |
dc03c1b3-0290-43a5-a5c2-cbcadf1326b4 | 0 | public String getVariableA()
{
return A;
} |
922018be-9399-497f-9602-1ae2ad173a52 | 1 | public double[] getObservaciones(int nObservaciones, double Media, double DStd) {
double[] observaciones = new double[nObservaciones];
for (int i = 0; i < nObservaciones; i++) {
observaciones[i] = Normal(Media, DStd);
}
return observaciones;
} |
25a4dfa5-5e3e-402c-b393-4dd50e93b9a9 | 3 | public static boolean isNullOrWhitespace(String string) {
boolean result = true;
if(string != null) {
if(string.length() != 0) {
String trimmed = string.trim();
if(trimmed.length() != 0) {
result = false;
}
}
}
return result;
} |
7676afdd-9fc6-40c9-886e-39008fc46b75 | 0 | public String getName() {
return this.name;
} |
27ecfbe5-598f-41f5-8cc1-4c36cf9ad0fe | 8 | private boolean isHeaderValid(String line)
{
Boolean flag=true;
header = line.split(Constants.Seperator);
HashMap<String, Integer> uniqueFieldcheck=new HashMap<>();
for(int i=0;i<header.length;i++)
{
if(header[i]==null ||"".equals(header[i]) )
... |
14aae191-e4fa-47eb-87ef-eb41f38b4e03 | 7 | public String name(final Material material) {
String template = plugin.getConfig().getString(
"Display.ItemNameFormat", "%randprefix% %randsuffix%");
String prefix = "";
String suffix = "";
String matName = material.name();
if (plugin.hmprefix.containsKey(material)) {
List<String> l = plugin.hmprefix.g... |
cb328344-493b-438e-8100-a2fb22eb7d3d | 4 | @Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
QuestState st = player.getQuestState(getName());
String htmltext = "";
int npcId = npc.getNpcId();
if (npcId == WHIRPY)
{
if (st.getQuestItemsCount(DWARF_GATEKEEPER_TOKEN) >= 1)
{
st.takeItems(DWARF_GATEKEEPER_TOKEN, 1);
playe... |
df485b43-41ce-45bb-842e-ff15cb43b636 | 3 | @SuppressWarnings("unchecked")
@Override
protected Class<? extends Number> translateReturnType(Class<?> clazz)
{
//no widening used for Maximum
return (Class<? extends Number>) clazz;
} |
b54de0c5-1951-467f-887d-d40f14e55480 | 5 | public static JsonElement parse(JsonReader reader) throws JsonParseException {
boolean isEmpty = true;
try {
reader.peek();
isEmpty = false;
return TypeAdapters.JSON_ELEMENT.read(reader);
} catch (EOFException e) {
/*
* For compatibility with JSON 1.5 and earlier, we return a ... |
da323482-d6b3-4ba4-a325-a4b2faa17ec1 | 4 | public List<String> seperateDocs() throws IOException {
String doc = new String(header);
BufferedReader br = new BufferedReader(new FileReader(file));
boolean isDocStart = false;
while(br.ready()){
String line = br.readLine();
if(line.equals("<"+tag+">"))
isDocStart = true;
else if(line.e... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.