method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
4c1a662b-c37e-40cc-aa88-7892e8c1b400 | 5 | private void inspectNewLine() {
final boolean f = doodle.getH() >= ((double) getFieldHeight() * (5.0 / 9.0));
if (f) {
notifySubscribers(Event.LINE_PUSHING);
while (doodle.getH() >= ((double) getFieldHeight() * (5.0 / 9.0))) {
playGround.pushNewLine();
... |
6f12ccfa-2903-412c-a542-912053e2911a | 1 | Hashtable getElementAttributes(String name)
{
Object element[] = (Object[]) elementInfo.get(name);
if (element == null) {
return null;
} else {
return (Hashtable) element[2];
}
} |
4c5be703-473e-4137-beb6-f7c64fae8f41 | 7 | private GASolution<int[]> algorithm() {
GASolution<int[]> best = null;
for (int iter = 0; iter < maxiter; iter++) {
gBestChanged = false;
evaluate();
best = Collections.min(population.getSols());
if (globalBest == null || best.compareTo(globalBest) < 0) {
globalBest = best;
gBestChanged = true;
... |
d1605abd-4cc0-4a64-9e4f-4a7240e7783b | 7 | private void initDict() {
if (init)
return;
log("initialize map...");
InputStream is = null;
String[] p = null;
try {
is = getClass().getClassLoader().getResourceAsStream(config + ".properties");
p = getValFrProperty(is, new String[]{ PROPERTY_PHRASE, PROPERTY_CHAR });
} catch (Exception e){
... |
0791df41-8403-4ead-b319-bd3cc1f97a13 | 2 | @Test
public void testGenerateJSON() throws Exception {
// Element to try
// {
// "tracking": {
// "slug": "dhl",
// "tracking_number": "123456789",
// "title": "Title Name",
// "smses": [
// "+18555072509",
// "+18555072501"
// ],
// ... |
b318c23f-d9be-46dc-86e4-04fe51c22481 | 6 | private void generateMessage(boolean f, boolean val)
{
found = f;
valid = val;
if(found && valid)
{
message1 = "Valid Request ";
message2 = "Assigning " + user.toString().toLowerCase()
+ " parking spot";
}
e... |
15a79e0e-95de-4695-8487-dee21470d29a | 4 | @SuppressWarnings("static-access")
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
public void onMobDamage (EntityDamageEvent event) {
Entity entity = event.getEntity();
if (entity instanceof Zombie) {
Zombie wraith = (Zombie) entity;
if (MMWraith.isW... |
c522ed00-ea89-4ae4-a598-a321081f353a | 1 | final public CycVariable sentenceDenotingSimpleVariable(boolean requireEOF) throws ParseException {
CycVariable val = null;
val = simpleVariable(false);
eof(requireEOF);
{if (true) return val;}
throw new Error("Missing return statement in function");
} |
16de780f-58de-4623-a3a9-b778bd5ef0af | 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... |
538d3ec0-f38e-485a-961d-616eb3a6bd9e | 9 | @SuppressWarnings("ConvertToStringSwitch")
private Map<String,String> MapMessage(){
Map<String,String> map = new HashMap<>();
if(!checkSyntax())
map.put("cmd", "unknown");
else{
int index = message.indexOf(":");
// Interpr... |
c3abed11-5613-4b0b-a0c8-921ab97f6bef | 0 | @Basic
@Column(name = "log_time")
public Timestamp getLogTime() {
return logTime;
} |
ac482635-34cb-4b6c-bd55-f94004d46244 | 5 | public void parseInputFile() throws IOException{
BufferedReader reader = new BufferedReader( new FileReader(inputFileName));
String line = null;
int y = 0;
while( (line = reader.readLine()) != null) {
if(xmax == -1) {
xmax = line.length();
}
HashMap<Integer,Position> ythRow = new HashMap<Int... |
c354b918-9da2-40eb-8c24-343cb5d97a83 | 0 | public Sense(senseDir sDir, int s1, int s2, condition con) {
this.senseDirVal = sDir;
this.condVal = con;
this.s1 = s1;
this.s2 = s2;
} |
06e0e57c-e9fd-4c36-ad91-a502a8a7fecd | 7 | @Override
public Class<?> getColumnClass(int columnIndex){
Class type = String.class;
switch (columnIndex){
case 0:
type = Integer.class;
break;
case 1:
type = String.class;
break;
case 2:
type = Integer.class;
break;
case 3:
type = Double.class;
break;
case 4:
ty... |
3091b02c-614d-4f13-b878-1d066aec8d96 | 9 | public static boolean check(int n, int m) {
String ns = String.valueOf(n);
String ms = String.valueOf(m);
if (ns.charAt(1) == ms.charAt(0) && ns.charAt(0) != ms.charAt(0)) {
int nns = Integer.valueOf(String.valueOf(ns.charAt(0)));
int mms = Integer.valueOf(String.valueO... |
733fdf58-3db0-4716-aebf-221895b31c34 | 8 | public int compare(String o1, String o2)
{
String s1 = (String)o1;
String s2 = (String)o2;
int thisMarker = 0;
int thatMarker = 0;
int s1Length = s1.length();
int s2Length = s2.length();
while (thisMarker < s1Length && thatMarker < s2Length)
{
... |
3870fef4-78fa-44f1-8c39-0e05d265ed9f | 3 | synchronized public void sendPacket(Packet p, Channels channel) throws IOException {
if(channel == Channels.MC) {
p.sendPacket(socketMC);
}
else if(channel == Channels.MDB) {
p.sendPacket(socketMDB);
}
else if(channel == Channels.MDR) {
p.sendPacket(socketMDR);
}
} |
e9bb5862-b3af-4646-a49e-32041761855a | 2 | public Juoma haeJuoma(int id) throws DAOPoikkeus {
// avataan yhteys
Connection yhteys = avaaYhteys();
// luodaan olio johon tiedot tallennetaan
Juoma juoma = new Juoma();
try {
String sql = "SELECT nimi, numero, hinta, tuoteID from Tuote where tuoteID = ?";
PreparedStatement haku = yhteys.prepareSta... |
a7efc7ac-60d3-4e4b-b31a-31f6cfad2ecf | 6 | @Override
public final void keyPressed(KeyEvent e) {
int c = e.getKeyCode();
if (this.getText().isEmpty() &&
c != KeyEvent.VK_BACK_SPACE &&
c != KeyEvent.VK_UP &&
c != KeyEvent.VK_RIGHT &&
c != KeyEvent.VK_DOWN &&
c != KeyEvent.VK_LEFT... |
6acdac85-e192-487e-8d29-7697be5e8e94 | 0 | public void clearHistory() {
Object current = history.getElementAt(history_location);
history.removeAllElements();
history.addElement(current);
setHistoryLocation(0);
} |
fc9c7858-2d9c-47b9-88f6-5b13f80ddbbe | 8 | public String toTeamText() {
StringBuffer buf = new StringBuffer();
String nick = nickname.trim();
if(!nick.equals(species) && nick.length() != 0) {
buf.append(nick);
buf.append(" (");
buf.append(species);
buf.append(")");
}
else
... |
fcb6a004-d8ad-4cb8-bba4-88009dff0ec2 | 5 | public boolean isValidToOccupy(int x, int y) {
Point point = new Point(x, y);
if (!isOccupied(point)) {
// Loops through all adjecent tiles
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
// if the square is not a valid square
// (the startpoint can be in a corner)
// then we ... |
fa4ebd70-6b25-4a40-b06d-0d68912cb163 | 3 | private static void createEmptyFile(File pFile) throws IOException {
if ( pFile.exists() ) {
if ( !pFile.delete() ) {
throw new IOException( "couldn't delete the old file " + pFile.getAbsolutePath() );
}
}
if ( !pFile.createNewFile() ) {
throw new IOException( "couldn't create the file " + pFile.getA... |
ed4bf907-bd06-49bc-9e43-03bfbc33c61b | 4 | private void forceStop()
{
servin.println("stop");
System.err.println("[INFO] Waiting for the server to stop.");
for(int i = 0; i < 10 && !hasStopped(); i++) {
try { sleep(500); } catch(InterruptedException e) {}
}
if(!hasStopped()) {
System.err.println("[WARNING] Server would not stop, I had to kill it, I'm s... |
bbce9fc5-b121-4e5d-8ff4-1360043e0e84 | 4 | private String checkForTableClosedness() {
for (String bottomState : bottomOfTableRow) {
Boolean found = false;
// Compare to each row in top table
for (String topState : topOfTableRow) {
if (getStringByLeftState(bottomState, "bottom").equals(getStringByLeftState(topState, "top"))) { found... |
692e3852-df9e-4a03-87c5-a960435d07bf | 5 | public boolean catchable() {
boolean catchable = false;
//Test for visibility
if (getMem().isObjVisible("ball") && ballInGoalzone(getMem().getBall())) {
//Test for moment range
if (getMem().getBall().getDirection()> -180 && getMem().getBall().getDirection() < 180) {
//Test for catchable d... |
6b4f17e6-6a1d-48f5-80ef-d39cb438f288 | 8 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final WorkPayment other = (WorkPayment) obj;
if (this.payment != other.payment && (this.payment == null || !thi... |
5fadefc7-439f-469c-bf04-7072550b8570 | 7 | public Player findWinner() {
Player winner = checkSquareTripleForWinner(Position.NW, Position.N, Position.NE); // row 1
if (winner == Player.Neither)
winner = checkSquareTripleForWinner(Position.W, Position.MIDDLE, Position.E); // row 2
if (winner == Player.Neither)
winne... |
833da317-c1b5-400e-8eb5-2ae7e82b7d2b | 4 | protected void read(File file) throws IOException{
String found = "";
if(file.isDirectory()){
if(file.list().length==0){
}else{
String files[] = file.list();
for (String temp : files) {
File fileDelete = new File(file, temp);
... |
b8a53ab0-125e-4eab-a1cb-b5426d3d64d8 | 5 | private void initGraphics() {
Font.loadFont(getClass().getResourceAsStream("/eu/hansolo/enzo/fonts/opensans-semibold.ttf"), (0.06 * PREFERRED_HEIGHT)); // "OpenSans"
valueBlendBottomShadow = new DropShadow();
valueBlendBottomShadow.setBlurType(BlurType.TWO_PASS_BOX);
valueBlendBottomSha... |
3dc69776-5b64-4088-aa2f-b10513a37434 | 4 | public void play(InputStream source, AudioFormat format)
{
// Use a short, 100ms (1/10th sec) buffer for real-time
// change to the sound stream
int bufferSize = format.getFrameSize()
* Math.round(format.getSampleRate() / 10);
byte[] buffer = new byte[bufferSize];
// Create a line to pla... |
14f82255-8240-42c9-80d9-607dc287f522 | 9 | private static void generarDadesComanda(AuthUser usuari){
ArrayList<ComandaLiniacomanda> coml = new ArrayList<ComandaLiniacomanda>();
Random r = new Random();
TypedQuery c = (TypedQuery) em.createQuery("select c from ProductesCategoria c");
List<ProductesCategoria> categories = c.getResultList();
Typ... |
8affba27-055d-46e8-a23e-b0b17d68fb77 | 4 | @SuppressWarnings("resource")
public static void filerdr() throws IOException{
if (!fnames.exists()){fnames.createNewFile();}
BufferedReader rfile = new BufferedReader(new FileReader(fnames));
String nme=null;
for (int i=0;i<6;i++){
nme=rfile.readLine();
if (nme!=null && !nme.isEmpty())... |
3290db43-c3d1-4b62-887a-9abb3198e72f | 6 | public void rmChannelAdmin(String name, String channel){
for (int i=0;i<channelList.size();i++){
if (channelList.get(i).getChannelName() == null ? channel == null : channelList.get(i).getChannelName().equals(channel)){
for (int m=0;m<channelList.get(i).admin.size();m++){
... |
515460a9-ef21-41c2-949f-baa732750bc0 | 1 | public void CriaAsteroides() {
asteroides = new ArrayList<>();
for (int[] coordenada : coordenadas) {
asteroides.add(new Asteroide(coordenada[0], coordenada[1]));
}
} |
3441451e-cb81-4a20-b58d-0a40504701fc | 5 | private void parseCSV(File file)
{
table = new HashMap<String, TableCell>();
BufferedReader reader = null;
try
{
try
{
reader = new BufferedReader(new FileReader(file));
String text = null;
int row = 0;
while ((text = reader.readLine(... |
86a0ae76-d65e-4004-9128-220c4bd7ded3 | 8 | private boolean findEntries (Checker checker) {
// assert jar != null;
if (jar == null) init (null);
entries = new ArrayList();
try {
int ix = 0;
for (Enumeration en=jar.entries(); en.hasMoreElements();) {
JarEntry entry = (JarEntry) en.nextElement(... |
b0ea4f5d-7e53-4488-a4a5-5d056c264df9 | 6 | public Direction getMove(Simulation sim){
//we are incrementing super's data here
super.getMove(sim);
int maxI = 1;
int maxJ = 1;
for (int row = 1; row <= expectedValue.getRows(); row++){
for (int col = 1; col <= expectedValue.getColumns(); col++){
if (expectedValue.getElement(row, col) > expectedVa... |
118c2156-fb67-446e-8deb-389fd9f7660a | 2 | public void execute(Event event) throws Exception {
if (event instanceof Cancelable) {
if (((Cancelable)event).isCancelled())
return;
}
executor.execute(listen, event);
} |
1c0d9023-4147-4664-a266-dfcc1335eec8 | 2 | public static DataType getFromId(int id){
for(DataType dt : DataType.values()){
if(dt.getId() == id) return dt;
}return null;
} |
c28542ab-7762-4450-94f9-9552d92bf97c | 8 | @Override
public boolean importData(TransferSupport support) {
boolean accept = false;
if (canImport(support)) {
try {
Transferable t = support.getTransferable();
if (support.isDataFlavorSupported(RosterTransferComponent.ROSTER_COMPONENT_DATA_FLAVOR)) {
... |
90455842-fa45-4638-a27a-67c21188416e | 6 | public void colorDrillableLand(Graphics g){
String player = Requests.teamName;
String owner;
Point p;
Grid grid = request.operator.getGrid();
for(int i = 0; i < s; i++){
for(int j = 0; j < s; j++) {
p = new Point(j,i);
if(grid.exists(p)){
owner=grid.getOwner(p);
if(owner!=null){
if(... |
c1e75318-602b-44b8-9475-ba0ab5f5dd91 | 3 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Text other = (Text) obj;
if (!Objects.equals(this.textParts, other.textParts)) {
return false... |
2daaa3ef-82cf-4eb0-b1ae-9daba7d4b365 | 8 | public void loadRepositoryFromBioPAXGraphXML(String graphXML) {
//System.out.println(graphXML);
try {
Document document = builder.parse(new InputSource(new StringReader(graphXML)));
// GraphData
NodeList graphroots = document.getElementsByTagName("graphdata");
Node graphroot = ... |
997ed364-b7df-43cf-b7da-81a5cc13660c | 0 | public void setjLabelAdresse(JLabel jLabelAdresse) {
this.jLabelAdresse = jLabelAdresse;
} |
a6a6ea39-3f0a-4d2b-8c89-14662771b4f4 | 0 | public Kamera(int x, int y) {
super(x, y);
xNopeus = 0;
/**
* Alkunopeus on säädetty 50:een, koska pelaaja aloittaa tason
* putoamalla.
*/
yNopeus = 50;
} |
1868d229-430c-48ce-9214-77ef37b89ac9 | 8 | @Test
public void Muliplytest() throws BTFMatrixErrorException, InputFileParserException, InternalErrorException, OperationNotSupportedException, InconsistentLinearSystemException {
ConvolutionSolver convolution = new ConvolutionSolver(qnm);
BigRational G ;
for(int cur_class = 1; cur_class <= qnm.R; ... |
c0a93b00-b4da-42e0-9197-568e9a360a48 | 6 | public void dumpHeader(TabbedPrintWriter writer) throws java.io.IOException {
writer.println("/* " + className + " - Decompiled by JODE");
writer.println(" * Visit " + GlobalOptions.URL);
writer.println(" */");
if (pkg.length() != 0)
writer.println("package " + pkg + ";");
cleanUpImports();
Iterator ite... |
7c5a7290-0d09-4b52-a5c5-191d0bb14190 | 2 | private synchronized void fireEvent(boolean click) {
ClickedSpotEvent event = null;
if(click)
event = new ClickedSpotEvent(this, ClickedSpotEvent.CLICK);
else
event = new ClickedSpotEvent(this, ClickedSpotEvent.FLAG);
Iterator<ClickedSpotEventListener> i = listeners.iterator();
while (i.hasNext()) {
... |
ac6cae42-e4de-4490-9011-b3cb130a3592 | 9 | public void setEditMenu()
{
String str = lcmf.tabs.getTitleAt(lcmf.tabs.getSelectedIndex());
if (str.equals("Heroes"))
{
remove(1);
add(heroSelectorMenu, 1);
return;
}
if (str.equals("Villains"))
{
remove(1);
add(villainSelectorMenu, 1);
return;
}
if (str.equals("Schemes"))
{
... |
6036618e-1026-441f-a094-d0377b904791 | 1 | public void writelines(String line) {
try {
writer.write(line);
} catch (IOException e) {
e.printStackTrace();
}
} |
9db38921-1066-4de5-bd1c-97328a087e96 | 1 | public ConsoleReader(OSConsole console, String[] result)
{
CommandListener oldListener = console.getCommandListener();
console.setCommandListener(this);
this.result = result;
result[0] = null;
start();
try
{
join();
}
catch (InterruptedException e) {}
console.setCommandListener(oldLi... |
238b141a-7d34-4a91-8783-e4b046f48402 | 6 | @Override
public void characters(char[] ch, int start, int length)
throws SAXException {
String value = new String(ch, start, length);
value = value.trim();
switch (this.open_tag) {
case "name":
this.name = value;
break;
case "code":
this.code = value;
break;
case "red"... |
1cade4a7-ba61-40a8-baeb-3ecb7d148540 | 5 | @Override
public boolean equals(Object that) {
if ( that == null )return false;
if ( that.getClass() != this.getClass() ) return false;
MoveElement thatMove = (MoveElement)that;
if ( thatMove.mSprites.size() != this.mSprites.size() )return false;
for (int i = 0 ; i <... |
05c9db05-db4d-4559-9193-cfc67bf7351f | 4 | @Override
public boolean equals(Object arg0) {
if (null == arg0) {
return false;
}
if (this == arg0) {
return true;
}
if (arg0 instanceof QParameter) {
QParameter param = (QParameter) arg0;
return this.mName.equals(param.mNa... |
fa832b0b-ae1b-4434-aa7f-5c779a9e361e | 3 | public String shareCalendar(String calendar, String username) {
try {
String[] fields = {"calendar"};
crs = qb.selectFrom(fields, "calendars").where("calendar", "=", calendar).executeQuery();
if(crs.next()) {
String[] fieldsInsert = {"username", "calendar"};
String[] values = {username, calendar};
... |
f7f0a475-713d-45a9-9118-175d607ee578 | 5 | String show(Genome genome) {
StringBuilder sb = new StringBuilder();
// Genome
sb.append(genome.getVersion() + "\n");
// Chromosomes
for (Chromosome chr : genome)
sb.append(chr + "\n");
// Genes
ArrayList<Gene> genes = new ArrayList<Gene>();
for (Gene gene : genome.getGenes())
genes.add(gene);
... |
ba544297-d9e1-408b-b9be-34dc7821a44e | 7 | public String execute() {
Boolean validData = true;
try{
if (username == null || ("".equals(username))) {
addActionError(getText("error.name.required"));
validData = false;
}
if (password == null || ("".equals(password))) {
addActionError(getText("error.password.required"));
validDat... |
43508175-280f-45ed-a839-3959f23b4a36 | 7 | protected void goPreorder(ParserNode p) {
if (p != null) {
List<ParserNode> ch = p.getChildren();
if (p instanceof NotNode) {
// Ako je čvor NotNode, u listu za crtanje se dodaje
// 1. čvor
// 2. Rekurzivno izračunati izraz
// U ovom načinu prikaza, Not nikada nema zagrada oko sebe.
nodes.add(p... |
dc192c89-ec27-4502-9167-d2f9718b9bb8 | 9 | public void teleport(CommandSender cs, Command cmd, String string,
String[] args) {
final Player player = (Player) cs;
if (args.length == 1) {
if (player.hasPermission("warpsandports.teleport.tp")
|| player.isOp()) {
final Player target = player.getServer().getPlayer(args[0]);
if (MainClass.get... |
9cf7730f-fd34-48e7-84a2-f7a139076a02 | 0 | public void setFeetype(String feetype) {
Feetype = feetype;
} |
7845ff40-d73f-44f7-8453-a04441f79bce | 8 | @Test
public void testExperimentMovieLoader() {
int count = 0;
int total = 0;
for (int i = 0; i < mServerCount; i++) {
try {
mDhtClientArray[i].purge();
} catch (RemoteException e) {
e.printStackTrace();
System.out.print... |
26821b27-ce33-44e8-8bfa-15b7f6b420a8 | 0 | public void loadRcon() throws DataLoadFailedException {
dataHolder.loadRcon();
} |
5d68cd6e-f762-41da-9abe-0b3055f7a92d | 7 | @SuppressWarnings("unchecked")
public V put(K key, V value) {
if (value == null)
return null;
if (fieldFilter != null) {
Object o = fieldFilter.process(((Fields) key), ((Fields) key).getFieldName(), value);
return o == null ? null : super.put(key, (V) o);
}
if (DaoFactory.fieldMap.containsK... |
f34e8bf6-1622-4a03-8f47-70558abf5256 | 4 | public void onMessage(Message m)
{
if (m instanceof TextMessage)
{
try
{
System.out.println("Message: " + ((TextMessage) m).getText());
}
catch (JMSException e)
{
e.printStackTrace();
}
}
else if (connection != null)
{
try
{
c... |
26239ae4-b008-4974-8f55-d90f2e7aa78c | 6 | public static void modularInduceDecisionRules(Symbol relationName, Symbol className, List modules) {
relationName = ((Symbol)(relationName.permanentify()));
className = ((Symbol)(className.permanentify()));
Logic.clearTrainingExamples();
Logic.clearCases();
{ Surrogate renamed_Class = Logic.getDescr... |
7178cd94-1c5d-49f4-9bd4-8daf0a4c22e3 | 8 | private void expand1(byte[] src, byte[] dst) {
for (int i = 1, n = dst.length; i < n; i += 8) {
int val = src[1 + (i >> 3)] & 255;
switch (n - i) {
default:
dst[i + 7] = (byte) ((val) & 1);
case 7:
dst[i + 6] = (byte... |
a9c0e6e5-ced0-424a-bc14-c4354fa1e265 | 0 | public String getProductID() {
return ProductID;
} |
e8d7211c-f921-4f80-ba94-51c7932e85ca | 5 | public SocManager(GPIOSettings settings, int connectionSpeed, int bufferSize) {
if (lock == null) {
lock = new ReentrantLock();
}
if (GPIO == null) {
Timer timer = new Timer(1000);
while (Spi.wiringPiSPISetup(0, connectionSpeed) == -1) {
try {
Runtime.getRuntime().exec("gpio load spi " + bufferS... |
de9f2815-4140-4c96-949a-ff59b0ff2b60 | 4 | public Tile getTile(int x, int y) {
if (x < 0 || y < 0 || x >= w || y >= h) return Tile.rock;
return Tile.tiles[tiles[x + y * w]];
} |
339681a4-9caa-4310-8cbd-b66d2db17c26 | 9 | public static void main (String [] args){
setupProxies();
sendPost();
SQLite4jWrapper.getInstance().open();
try {
Document doc = parseFromFile();
Elements tables = doc.getElementsByTag("table");
System.out.print("List length : " + tables.size() + "\n");
String reutersURL;
try {
SQLite4jWrappe... |
55eb4f7e-f838-4e7f-b9f5-424bb1e9424a | 2 | public boolean isValidDate(double t) {
if (t < limits[0] || t > limits[1])
return false;
else
return true;
} |
ec67476b-2dc7-4971-b1ec-739d043aad88 | 1 | private void addWord(StringBuilder word) {
//removing all none chars from the end.
String typedWord = word.toString();
String wordKey = typedWord.toLowerCase(mLocale);
if (mWords.containsKey(wordKey)) {
mWords.get(wordKey).addFreq(typedWord);
} else {
mWor... |
e8cd9044-ceb3-4b1a-ac58-27174477c65a | 9 | public DiagramComponent connectLines(){
CompositeDiagramShape result = new CompositeDiagramShape();
//find all lines
ArrayList<DiagramShape> lines = new ArrayList<DiagramShape>();
Iterator it = shapes.iterator();
while(it.hasNext()){
DiagramShape shape = (DiagramShape) it.next();
if(shape.getPoints().s... |
05400208-4a86-4800-abb7-56afdefbee87 | 9 | @Override
public String toSQL () throws SQLSyntax {
StringBuilder sql = new StringBuilder("DELETE FROM ");
if (null == table || table.isEmpty()) {
throw new SQLSyntax("Missing SQL UPDATE table");
}
sql.append(table);
/* WHERE */
if (this... |
1f9123ab-87d1-4dee-84d4-5b722d45ad67 | 2 | public void addDebuff (int id, int debuffLv, int element, int orgDmg){
for (Debuff d : debuff){
if (d.getId() == id){
//increase duration
d.increasseDuration();
return;
}
}
debuff.add (new Debuff (id, debuffLv, this));
... |
3f335f66-a8fa-4dec-b2a6-85e2ac65aab3 | 1 | public String toString() {
try {
java.io.StringWriter strw = new java.io.StringWriter();
alterrs.jode.decompiler.TabbedPrintWriter writer = new alterrs.jode.decompiler.TabbedPrintWriter(
strw);
writer.println(super.toString());
writer.tab();
dumpSource(writer);
return strw.toString();
} catch... |
47a737dd-cae3-4ea0-ab7e-efd3220eda00 | 3 | public static Boolean save(Entry entry, String collectionName) {
MongoCollection collection = getJongo().getCollection(collectionName);
Boolean dirty = false;
Integer id = entry.getId();
IdTracker tracker = null;
if(id == -1) {
trac... |
0dbaaca4-5d1e-4d4f-a786-f5c7a4f66a12 | 8 | @SuppressWarnings("unused")
public static void main(String[] args) {
FenetreConfig fenconfig = new FenetreConfig(); // Appel de la fenetre de configuration du debut
while (Configurations.isValide() == false) { // On attend que les conditions soit valide pour passer a l'etape suivante du programme
System.out.pr... |
548db102-06a6-49bc-9075-34bd64cdfd37 | 0 | public ClassTypeCapture(Class<T> kind) {
this.kind = kind;
} |
e1de1bd2-115b-4232-b220-e4b297b15821 | 6 | public void done(){
if(!doBoards)
gui.prog.updateCurrentMoves(currentStep);
if(doGraph)
gui.graph.setCurrentMoves(currentStep);
if(doGraph) gui.drawUI(ApfelGUI.GRAPH);
if(doOutFiles) {
pw1.close();
pw2.close();
}
if(!doGraph){
if(doBoards) gui.pitch.addRestartButton();
else gui... |
c8f9ead8-f4bc-4f67-bf82-dcf318788ee6 | 0 | public JLabel getTextArea() {
return textArea;
} |
c70f6dee-120e-410f-a2c4-65ec43c92cd7 | 1 | public static Database getInstance(){
if(instancia == null){
instancia = new Database();
}
return instancia;
} |
43f38522-7fa5-46ea-8028-8ddbd8e505fd | 1 | public VolumeID setLabel(String s) {
if (s != null)
label = s;
return this;
} |
2bb547dc-da77-4ba3-837c-1ffaa1e11684 | 7 | protected List refreshTicksHorizontal(Graphics2D g2,
Rectangle2D dataArea,
RectangleEdge edge) {
List result = new java.util.ArrayList();
Font tickLabelFont = getTickLabelFont();
g2.setFont(tickLabelFont);
... |
84b9e330-90e1-4857-acb5-b16e8ec72458 | 8 | public boolean isOne(Type type) {
if (type instanceof IntegerType) {
return (value instanceof Integer && ((Integer) value).intValue() == 1);
} else if (type == Type.tLong) {
return (value instanceof Long && ((Long) value).longValue() == 1L);
} else if (type == Type.tFloat) {
return (value instanceof Floa... |
0baf90d8-4c8e-497b-8a26-aeb6a6a76372 | 9 | private static void addDefaultValuesForType(Resource cls, Map<Property,RDFNode> results, Set<Resource> reached) {
reached.add(cls);
StmtIterator it = cls.listProperties(SPIN.rule);
while(it.hasNext()) {
Statement s = it.nextStatement();
if(s.getObject().isResource()) {
Resource templateCall = s.ge... |
57c159cd-035d-439a-988f-53f3b2364ef4 | 1 | public Universe(int value) {
dimensionList = new Dimension[value];
for (int count = 0; count < value; count++) {
dimensionList[count] = Dimension.values()[count];
}
} |
7adc87e5-2801-4023-87aa-f11239e2266f | 8 | private static List splitPGNStubs(String pgn) throws IOException {
List pgnGameStubs = new LinkedList();
BufferedReader br = new BufferedReader(new StringReader(pgn));
String line;
StringBuffer buffer = new StringBuffer();
int offset = 0;
int c = 0;
while ((line = br.readLine()) != null) {
... |
bfa8e501-600d-4089-847c-2acc7ddb4c40 | 2 | public double oneNorm(){
double norm = 0.0D;
double sum = 0.0D;
for(int i=0; i<this.numberOfRows; i++){
sum=0.0D;
for(int j=0; j<this.numberOfColumns; j++){
sum+=Math.abs(this.matrix[i][j]);
}
norm=Math.max(norm,sum);
... |
e4d84d4f-f338-4857-a77b-bd74fb768c41 | 9 | @Override
public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) {
if (sender instanceof Player) {
Player p = (Player) sender;
if (commandLabel.equalsIgnoreCase("bukkitkart")) {
if (args.length == 1) {
String cmdType = args[0];
if (cmdType.equalsIgnoreC... |
4b0f7e8d-336b-4e2e-867b-525925a6f224 | 8 | BitSet within(Token instruction, BitSet bs) throws ScriptException {
Object withinSpec = instruction.value;
if (withinSpec instanceof Float)
return viewer.getAtomsWithin(((Float) withinSpec).floatValue(), bs);
if (withinSpec instanceof String) {
String withinStr = (String) withinSpec;
if (withinStr.equal... |
23efa300-3fbc-4a09-8e2b-3884ed57b483 | 6 | private static int isChildSwap(ArrayList<INode> nodeMinHeap, int i) {
int i_parent = nodeMinHeap.get(i).getSum();
int i_leftChild = nodeMinHeap.size() > (i * 2) + 1 ? nodeMinHeap.get((i * 2) + 1).getSum() : Integer.MAX_VALUE;
int i_rightChild = nodeMinHeap.size() > (i * 2) + 2 ? nodeMinHeap.get((i * 2) + 2).getSu... |
3972afa7-ef15-437e-bd6f-490e921a150a | 2 | public void grabaArchivo() throws IOException {
//guarda cuando no se encuentra en instrucciones
if (!instrucciones) {
try {
PrintWriter fileOut = new PrintWriter(new FileWriter(nombreArchivo));
fileOut.println(String.valueOf(pausa) + "," + String.valueOf(vid... |
a667a845-4675-4fdd-bd21-1145e35a0e08 | 6 | private static String findSmall(String s){
int n = countOnes(s);
char[] newString=s.toCharArray();
int index = s.length()-1;
while(n<k && index>=0){
if(newString[index]=='0'){
newString[index]='1';
n++;
}
index--;
}
int index2 = s.length()-1;
while(n>k && index2>=0){
if(newString[index... |
38f3ca8e-7e06-46b1-95e2-a32e9ce6b915 | 9 | public void setUserSavedGame()
{
File file = new File("Users.txt");
String line = "";
FileWriter writer;
ArrayList<String> userData= new ArrayList<String>();
ListIterator<String> iterator;
try
{
Scanner s = new Scanner(file);
while(s.hasNextLine())
{
userData.add(s.nextLine());
}
s... |
295b0ae0-73aa-442a-9019-51ec62ddc980 | 1 | @SuppressWarnings("unchecked")
static <T> WatchEvent<T> cast(WatchEvent<?> event)
{
return (WatchEvent<T>) event;
} |
f710842e-5441-4d25-a118-77aded8a0cc8 | 6 | private void doProjectileActions(Projectile projectile, Player player, Map<String, Boolean> abilitiesMap){
if (abilitiesMap.containsKey(Constants.Attributes.TELEPORT.getName())
&& instance.getItemHandler().hasPermission(player, player.getItemInHand())){
Location loc = projectile.getLocation();
teleportPlay... |
bf414212-2a87-4cc3-9709-cdfe85b713da | 2 | public void addAcceptedUser(long uid) {
if (!this.aWaitingId.contains(uid))
return;
this.aWaitingId.remove(uid);
this.aAcceptedId.add(uid);
if (this.isFinalized())
this.sendFinalizedNotification();
} |
5ec8bb6b-9669-430c-947d-867605a88c83 | 2 | public void visitSource(final String source, final String debug) {
if (source != null) {
cp.newUTF8("SourceFile");
cp.newUTF8(source);
}
if (debug != null) {
cp.newUTF8("SourceDebugExtension");
}
cv.visitSource(source, debug);
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.