method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
0f31c7ec-d18d-4358-9ee1-6e829a467061 | 2 | private void utilities(){
if(center) Base.render.center();
if(quit) System.exit(0);
} |
b717f251-9c71-4b1b-8d13-6bb18074749f | 9 | @Override
public Object getValueAt(int rowIndex, int columnIndex) {
ContaReceber ContaReceber = filtrados.get(rowIndex);
switch (columnIndex) {
case 0:
return ContaReceber.getId();
case 1:
if (ContaReceber.getParceiro().isFisica()) {
... |
1165b766-09c7-4c2c-ac7b-d06907a4e944 | 9 | private long sizeOfType(Class<?> type) {
if (type == int.class) {
return INT;
} else if (type == long.class) {
return LONG;
} else if (type == byte.class) {
return BYTE;
} else if (type == boolean.class) {
return BOOLEAN;
} else if (type == char.class) {
... |
4435bba3-20c6-4fa2-9582-e490e674d977 | 1 | public static <T> Set<T> treeSet(T... params) {
Set<T> result = new TreeSet<T>();
for (T t : params) {
result.add(t);
}
return result;
} |
a4884d20-9057-40f3-b4ae-7b5174ff0f5b | 4 | private void bind() {
HasAllMouseHandlers canvas = automatonView.getHandlerCanvas();
canvas.addMouseDownHandler(new MouseDownHandler() {
@Override
public void onMouseDown(MouseDownEvent event) {
StateView stateView = findStateAt(event.getX(), event.getY());
if (stateView != null) {
moveState = st... |
bda5adc9-a9f7-4748-a0af-aac5a6c73c34 | 3 | public static double getWeaponSpeed(WeaponType type) {
switch (type) {
case mel_sword:
return 3;
case mel_hammer:
return 4;
case rng_bow:
return 5;
}
return 1;
} |
9a86fffa-463e-44fd-9363-cbe942b5e470 | 6 | @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (!(obj instanceof EMailTyp))
return false;
EMailTyp other = (EMailTyp) obj;
if (email == null) {
if (other.email != null)
return false;
} else if (!email.equals(other.email))
ret... |
2dda5206-b5de-4970-ae2a-2bc719d307b4 | 5 | public static void unzipFile(String zipFilePath, String outputDir) {
byte[] buffer = new byte[1024];
try {
// create output directory is not exists
File folder = new File(outputDir);
if (!folder.exists()) {
folder.mkdir();
}
// getLogger().info("zip file : " + zipFilePath);
// get the zip fi... |
f4b14bce-71e6-4463-afd7-e5e1943dcda1 | 3 | public void run() {
URL url = null;
try {
url = new URL("http://skriptlib.exsoloscript.com/files/" + name + "/" + name);
} catch (MalformedURLException e) {
this.plugin.messageOps("Something went wrong whilst connecting to the SkriptLib server.");
return;
}
if (!exists(url)) {
this.plugin.messa... |
edc736ec-7aee-4a61-b477-326aac136fa9 | 4 | private void Open_File_Menu_ItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Open_File_Menu_ItemActionPerformed
//==== Initialize the filechooser, using the user's home dir, or the last working dir
if(this.currentDirectory.equals(""))
{ this.fc = new JFileChooser(); }
... |
82eb2bea-96c8-4e70-ac68-b6d8b7172a77 | 5 | @Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final Colaborador other = (Colaborador) obj;
if (this.id != other.id && (this.id == null || !this.id.equals(oth... |
ea4db6df-2307-4e6e-9de8-e9035a448bb0 | 0 | public AIModule getAI() {
return ai;
} |
c8e3bc74-37c1-4bca-b080-516f57651503 | 5 | private static void Sortingbywieghtdividedbylength() {
// TODO Auto-generated method stub
int i = 0;
int j = 0;
for (i = 0; i < 10000; i++) {
for (j = 0; j < 9999; j++) {
if (jobs[j][0] * jobs[j + 1][1] < jobs[j + 1][0] * jobs[j][1]) {
int l, m, n;
l = jobs[j][0];
m = jobs[j][1];
n =... |
5c826486-0bae-44bf-99c4-ab8b7a216df6 | 8 | static boolean isPlain(char ch) {
switch(ch) {
case '0': case '1': // don't have letters
case '+': case '-': // int'l prefix, dash
case '(': case ')': // silly North Americans
case '*': case '#': // just in case (should not occur, but...)
return true;
}
return false;
} |
6098fd6d-f430-44d9-8b76-37354a1c2a4a | 0 | @Override
public void display(UserInterface ui) {
UserInterface.println(
"Unraveling execution and re-executing current function.");
ui.signalNeedToDisplayFunction();
} |
2daf9d67-7c89-4fe7-8008-28d046e781b0 | 5 | public static TimerLabel swigToEnum(int swigValue) {
if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue) {
return swigValues[swigValue];
}
for (int i = 0; i < swigValues.length; i++) {
if (swigValues[i].swigValue == swigVal... |
172818a3-5925-4b6d-bde1-6e0d06f32ce0 | 1 | private JPanel pasEncore()
{
JPanel panel = new JPanel(new BorderLayout());
JLabel label ;
try {
BoxLayout bl=new BoxLayout(panel,BoxLayout.Y_AXIS); //layoutManager
panel.setLayout(bl); //attache le layoutManager au panel
label=... |
12fb904b-8c85-49ed-aec9-bd283f6b834f | 3 | public byte dominantDimensionNum()
{
int d = -1;
int dl = -1;
for (int i = 0; i < min.length; i++)
{
int il = max[i] - min[i];
if (il > dl && canSplitInDim(i))
{
dl = il;
d = i... |
ea02cb65-a800-431c-aaa4-8decc4a158db | 1 | public static void main(String[] args) throws Exception
{
PrivateMember p = new PrivateMember();
Class<?> classType = p.getClass();
Method method = classType.getDeclaredMethod("getMessage",new Class[]{String.class});
/**
*
* Exception in thread "main" java.lang.NoSuchMethodException: reflectio... |
e9965351-d3a7-4bc0-acdd-9fb872fee0a8 | 0 | @BeforeClass
public static void setUpClass() throws Exception {
ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
} |
eadc406c-2774-4db1-ad81-7ccc7cb05b21 | 7 | void updateGui(String fieldname) {
Object fieldval = fieldvalues.get(fieldname);
Object fieldcom = fieldcomponents.get(fieldname);
String fieldtype = (String)fieldtypes.get(fieldname);
if (fieldcom instanceof JCheckBox) {
((JCheckBox)fieldcom).setSelected(
((Boolean)fieldval).booleanValue() );
/* more ... |
ffc5e15e-02f6-4e59-bfcc-e44a80858b2b | 4 | public void figureVoxels() {
start = dateFormat.format(cal.getTime());
/*
long commonCounter = 0;
for (int i = 0; i < topView3DCoordinates.size(); i++) {
Coord3d sample = topView3DCoordinates.get(i);
if (foundLateral(sample) == true && foundFront(sample) == true) {
commonCounter++;
System.out.pri... |
c63a008c-12ec-4fb1-a8ee-6fdf4272e2dc | 0 | public static void main(String[] args) {
ParcelLocal p = new ParcelLocal();
Destination d = p.destination("Tasmania");
} |
b72f8b3f-7df9-491c-8f78-05fb9b165048 | 9 | public Test getTest(String suiteClassName) {
if (suiteClassName.length() <= 0) {
clearStatus();
return null;
}
Class testClass= null;
try {
testClass= loadSuiteClass(suiteClassName);
} catch (ClassNotFoundException e) {
String clazz= e.getMessage();
if (clazz == null)
clazz= suiteClassName;... |
6c6c806d-ad3b-45e0-9069-56cb17a78024 | 0 | public int getIconWidth() {
return 400;
} |
b57f8b23-3707-4c68-95fd-2e5965a07c4b | 1 | public CtConstructor[] getConstructors() {
try {
return getSuperclass().getConstructors();
}
catch (NotFoundException e) {
return super.getConstructors();
}
} |
2c4a4d6c-8e21-4e96-97e1-b36677b9a2d5 | 7 | public static void selectWordLeftText(OutlinerCellRendererImpl textArea, JoeTree tree, OutlineLayoutManager layout) {
Node currentNode = textArea.node;
int currentPosition = textArea.getCaretPosition();
String text = textArea.getText();
int text_length = text.length();
if (currentPosition == 0) {
retur... |
40bd5c7b-5f1a-4f1d-a557-e065cd2c00a7 | 1 | protected void reEstablishCycConnection() throws UnknownHostException, IOException, CycApiException {
previousAccessedMilliseconds = System.currentTimeMillis();
cycConnection.close();
cycConnection = new CycConnection(hostName,
port,
this);
if (!(cycImageID.equals(getCycImageID()... |
48a4d698-88dd-4a49-9aac-ab9675934da2 | 4 | public UIAltaAnuncio() {
cal.setTime(new Date());
vendedor = usuarioservice.obtenerVendedor(usuarioservice.validar(usuario, contrasenia));
initComponents();
jTextField3.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
... |
9b3eabcb-380c-44b2-a224-d2bfb83eb53a | 8 | public Set<Map.Entry<Long,Float>> entrySet() {
return new AbstractSet<Map.Entry<Long,Float>>() {
public int size() {
return _map.size();
}
public boolean isEmpty() {
return TLongFloatMapDecorator.this.isEmpty();
}
publ... |
9dfa46c1-abc7-4608-a235-2913b33083c4 | 1 | public static void main(String[] args) throws Exception {
ExecutorService exec = Executors.newCachedThreadPool();
for (int i = 0; i < 5; i++)
exec.execute(new Accesor(i));
TimeUnit.SECONDS.sleep(3);
exec.shutdownNow();
} |
381a5fb0-11c8-429a-8e07-79e4b23801b3 | 8 | @Override
public List<Item> getDepositedItems(String depositorName)
{
if((depositorName==null)||(depositorName.length()==0))
return new ArrayList<Item>();
final List<Item> items=new Vector<Item>();
final Hashtable<String,Pair<Item,String>> pairings=new Hashtable<String,Pair<Item,String>>();
for(final Pla... |
90a87e07-5321-438d-839e-9d11aadbab90 | 4 | @Override
public Object registeringGUI() {
String name, descr;
int year;
double initPrice;
name = guiImpl.requestData("Nome:");
descr = guiImpl.requestData("Decrição:");
while(true){
try{
year = Integer.parseInt(guiImpl.requestDat... |
413b3e68-ffcf-4ba3-9126-48d26dec1eed | 0 | private Memento(int state) {
this.state = state;
} |
9bc49188-9fe1-4c18-a7c3-fd939b6f7d99 | 3 | public boolean verify(byte[] sig) throws Exception{
int i=0;
int j=0;
byte[] tmp;
if(sig[0]==0 && sig[1]==0 && sig[2]==0){
j=((sig[i++]<<24)&0xff000000)|((sig[i++]<<16)&0x00ff0000)|
((sig[i++]<<8)&0x0000ff00)|((sig[i++])&0x000000ff);
i+=j;
j=((sig[i++]<<24)&0xff000000)|((sig[i++]<<16)&0x00... |
594ff528-bbeb-4343-a171-ab3172e35b7e | 7 | public void drawCCW(Bitmap bitmap, int xo, int yo) {
for (int y = 0; y < bitmap.width; y++) {
int yy = bitmap.width - y + yo;
if (yy < 0 || yy >= this.height)
continue;
for (int x = 0; x < bitmap.height; x++) {
int xx = x + xo;
if (xx < 0 || xx >= this.width)
continue;
int color = bitmap... |
20696e5a-8d92-4ccb-83cb-517d8ae52eee | 3 | @Override
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getSource() instanceof JFormattedTextField) {
JFormattedTextField jtf = (JFormattedTextField) evt.getSource();
if ("File Size Change".equals(jtf.getName())) {
Number num = (Number) jtf.getValue();
if (num != null) {
model.... |
d022f529-de4b-423d-b1dc-4cb62825ce27 | 9 | public static String getProperName(String name) {
String stringSplitUp[], totalString = null;
// Regex strip everthing exept leters and spaces.
name = name.replaceAll("[^A-Za-z ]", "_").trim();
if (name != null && !name.isEmpty() && name.length() > 1) {
stringSplitUp = name... |
7d79ce86-8271-4738-847d-6e42ddfaf289 | 2 | private void setupIndividualCardPosition(Card card, int rowNumber,
int colNumber) {
final int CARD_DISPLAY_TOP = 60;
final int DISPLAY_GAP = 6;
int leftPositionForRow = getLeftPositionForRow(rowNumber);
int y = CARD_DISPLAY_TOP + (cardHeight * 3 / 4) * rowNumber;
int x = CARD_DISPLAY_LEFT + leftPositionF... |
8937c880-c872-48ad-93f1-edceba88447d | 2 | private void btnExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnExcluirActionPerformed
DepartamentoBO departamentoBO = new DepartamentoBO();
try {
departamentoBO.DeleteDepartamento(txtCodDepartamnento.getText());
JOptionPane.showMessageDialog(null, "D... |
d152bf84-d8aa-40cb-b708-1123bf2ee265 | 8 | @Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
if (!(sender instanceof Player))
{
sender.sendMessage("Only players can use this command.");
return true;
}
Player p = (Player) sender;
Block lookingAt = Utilities.getLookingAtAir(p);
if(lookin... |
cf1a94df-a440-4e10-8e05-80c59ae6f89b | 9 | @EventHandler
public void OnGameQuit(GameQuitEvent event){
String pName = event.getPlayerName();
Player p = event.getPlayer();
if (plugin.PlayersInGame.contains(pName))
{
plugin.PlayersInGame.remove(pName);
if (plugin.sbHandler.badTeam != null && plugin.sbHandler.goodTeam != null)
{
if (plugin.sbH... |
1c32f81e-2462-4be0-99d3-9e6e25463fb3 | 3 | public void visitGotoStmt(final GotoStmt stmt) {
if (stmt.target() == oldDst) {
if (FlowGraph.DEBUG) {
System.out.print(" replacing " + stmt);
}
stmt.setTarget(newDst);
if (FlowGraph.DEBUG) {
System.out.println(" with " + stmt);
}
}
} |
0c7854c1-c0a6-4a19-a7e9-20a4e7ee9ed8 | 8 | @EventHandler (priority = EventPriority.NORMAL)
public void join(final PlayerJoinEvent evt) {
String name = evt.getPlayer().getDisplayName();
evt.setJoinMessage(null);
for (Player pl : Bukkit.getServer().getOnlinePlayers()) {
if (pl.getName().equalsIgnoreCase(evt.getPlayer().getName())) break;
if (pl.hasP... |
ea3c9a28-735e-4cd3-bede-b9ce3160c3ea | 0 | public Object getResponse() {
return response;
} |
d4b5b0f7-0744-456f-98dd-72bf22b98778 | 9 | public static String nickOf(final String source) {
if (source.length() < 1) {
return "";
}
final int si;
switch (source.charAt(0)) {
case '#':
case '!':
case '&':
case '*':
return "";
case '+':
... |
fb886821-e656-46ff-8ec4-d9b9a7f0cca3 | 0 | public Crs getCrs()
{
return crs;
} |
54060b73-5b00-4d99-a241-b1d58158d017 | 8 | private Boolean checkTables() throws Exception {
if (!this.db.checkTable("chunky_objects")) {
if (!db.createTable(QueryGen.createObjectTable())) return false;
Logging.info("Created chunky_objects table.");
}
if (!this.db.checkTable("chunky_ownership")) {
if (!... |
e22654da-3a78-4a19-9fdc-43aa12b8ec44 | 5 | public String doFilter(String input) {
StringBuffer buffer = new StringBuffer();
File file = new File(input);
if (file.exists()) {
if (file.isDirectory()) {
File list[] = file.listFiles();
for (int i = 0; i < list.length; ++i) {
if (showFullPath) {
buffer.append(list[i]);
buffer.append('\n');
... |
cedb2ef0-e4e5-49d3-ac87-b7304b562e29 | 3 | public void addEvent(final GenericEvent ge) {
final Class<?> c = ge.getClass( );
if ( this.handlers.containsKey(c) )
for (final EventHandler h : this.handlers.get(c))
h.add(ge);
} |
a0f1149f-65c1-47c4-a8c7-a66071bb2fcf | 7 | public ArrayList<Integer> findLongestTrainTrack(){
ArrayList<Integer> maxId = new ArrayList<Integer>(); //最長火車的id序列
for(int i=0 ; i<receivingTrack.length ; i++){
int count = maxId.size();
for(int j=maxId.size()-1 ; j>=0 ; j--){
if(receivingTrack[i].ifEmpty == false){
if(receivingTrack[i].t... |
9782fb21-fbe1-4790-83a7-8b65f46aeab2 | 3 | @Override
public void addIllness(IllnessDTO illness) throws SQLException {
Session session = null;
try {
session = HibernateUtil.getSessionFactory().openSession();
session.beginTransaction();
session.save(illness);
session.getTransaction().commit();
... |
8934ff3d-0253-466a-9d9f-928c8e3039e8 | 8 | String classToType(Class cls) {
if (cls==Point.class) {
return "int2";
} else if (cls==Integer.TYPE
|| cls==Integer.class ) {
return "int";
} else if (cls==Double.TYPE
|| cls==Double.class ) {
return "double";
} else if (cls==String.class) {
return "String";
} else if (cls==Boo... |
84563bb5-70e8-45de-bc91-72ca40aac8de | 3 | private boolean isValidFont(String name, Map<String, String> data) {
StringBuilder errorList = new StringBuilder();
// Iterate through the required fields and make sure we have the field
// we need! Otherwise append to the string builder, at this point we
// don't kill it and throw an exception. I believe it's... |
c5b78e0f-62ef-4870-bfd9-fc282c3f17d9 | 4 | private String getIdSetSqlCondition() {
if (!selectedIds.isPresent()) {
return "";
}
Set<Long> ids = selectedIds.get();
StringBuilder sb = new StringBuilder("id in (");
if (ids.isEmpty()) {
sb.append("null");
} else {
Iterator<Long> idIterator = selectedIds.get().iterator();
... |
5e6550bd-bcfa-456b-8d92-a46fce0b88ad | 5 | public void useSkill(Skill skill) {
if (skill.getEffect().getType().equals("remove debuffs")) {
skill.use(this, target);
}
else if (hitAvailable && !isStunned && !skill.isUsed() && !isDead) {
skill.use(this, target);
hitAvailable = false;
... |
edc65a29-e524-4fae-939e-d39f0766bfd7 | 3 | protected void assignToTeamAOrB(String teamType) {
Object selectedValue = studentsCDJlst.getSelectedValue();
String selectedStudent = null;
int selectedIndex = 0;
if (selectedValue == null ) {
//warn no selected student
JOptionPane.showMessageDialog(this, "No student selected", "No student selected", JOpt... |
845f2996-8dd3-4fe9-b0bc-ebd1b14ae99d | 5 | private void enabledPanels(Boolean enabled){
for(int i=0;i<jTabbedPane1.getComponentCount();i++){
if(jTabbedPane1.getComponent(i) instanceof JPanel){
JPanel jpanelTemp=(JPanel)jTabbedPane1.getComponent(i);
for(int j=0;j<jpanelTemp.getComponentCount();j++){
... |
f1b35bf2-a826-4302-8e4a-6989ffda1055 | 3 | public Node search(Node x, int key) {
if (x == null || x.key == key) {
return x;
}
if (key < x.key) {
return search(x.left, key);
} else {
return search(x.right, key);
}
} |
5cc98aaf-4f3e-43c5-ac76-4d46b4bd838b | 7 | static final public void opRel() throws ParseException {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 56:
jj_consume_token(56);
expression.empiler(EGAL);yvm.push(EGAL);
break;
case 57:
jj_consume_token(57);
expression.empiler(DIFFERENT);yvm.push(DIFFERENT);
break;
... |
a7fdb261-e470-46dc-b256-a7219795663b | 6 | public static void removePacks (String xml) {
ArrayList<ModPack> remove = Lists.newArrayList();
int removed = -1; // TODO: if private xmls ever contain more than one modpack, we need to change this
for (ModPack pack : packs) {
if (pack.getParentXml().equalsIgnoreCase(xml)) {
... |
10193a80-7cc1-4c94-886b-9f2fa7ab9458 | 6 | final ItemDefinition method1177(int i) {
if (stackIDs != null && i > 1) {
int k = -1;
for (int l = 0; l < 10; l++) {
if (i >= stackAmounts[l] && stackAmounts[l] != 0) {
k = stackIDs[l];
}
}
if (k != -1) {
... |
a9b1f2c1-63a9-4a49-a377-04cd7cb9005c | 0 | public Iterator<Pfad> getPathIterator() {
return pfadList.iterator();
} |
220c9055-85a2-48c8-ad2e-529901ea51ab | 0 | protected void doEditing() {} |
2ce9c209-2856-4c69-9c07-18dfd2c883cf | 2 | public RuleConfigs custom(Tester<?,?> tester,String tag){
testerMapping.put(tag,tester);
return this;
} |
aec70c5d-8df8-440c-953a-c0003348dedb | 8 | @Override
//for simplicity, the getNeighbor method is the same for 4 and 8 pixels, works
//for both values (and even larger ones, for experiments)
public PixelInfo getNeighbor(PixelInfo pixel, int i, int width, int height) {
//in case that i>8:
//1 cycle = 8 pixels around the given pixel
//i'th neighbor = nu... |
7cbf1309-18ce-43a0-b56e-995c05496b0e | 2 | private void verMensajes() {
Mensaje mensaje;
while ((mensaje = client.getNuevoMensaje()) != null)// llamamos a client
{
System.out.print(NUEVO_MENSAJE);
System.out.println(mensaje.getSource());
System.out.println(ASUNTO + mensaje.getTitulo());
Sys... |
6c76adac-9cc1-4c55-ad0d-c40323f8b05c | 6 | public void checkforbubble() {
if (bubble == 1) {
setImage(bubble1);
}
else if (bubble == 2) {
setImage(bubble2);
}
else if (bubble == 3) {
setImage(enemylist);
}
else if (bubble == 4) {
setImage(enemylist2);
... |
28616659-15ad-48ff-a398-a7bc72ae7aa6 | 3 | public static void main(String[] args) {
MultipleLayerLruCache cache = new MultipleLayerLruCache(128, "C:/cache/", 1024L);
StringCache []datas = new StringCache[count];
for(int i=0;i<count;++i){
String s = "";
for(int j=0;j<48;++j) s += ""+i;
StringCache sc = new StringCache();
sc.mContent = s;
da... |
98bfd63d-cf1e-4e2c-8861-dcb84566e13d | 5 | private void detectFields() {
try {
ProtobufDecoder protobufDecoder = new ProtobufDecoder(
transMeta.environmentSubstitute(wClasspath.getText().trim()
.split(File.pathSeparator)), wRootClass.getText(),
null);
try {
Map<String, Class<?>> fields = protobufDecoder.guessFields();
RowMeta ro... |
5520ec6d-5172-45e1-b9ab-032de31622cc | 4 | @MethodInformation(author="Wolfgang", date="07.12.2012", description="deletes element from Set")
public boolean delete(Object element) {
Node p = head;
Node prev = head;
while(p != null) {
if(p.getElement() == element) {
if(p == head)
head = p.getNextNode();
if(p == tail)
ta... |
3410585f-9f80-4f71-aa59-55d67cc33b09 | 6 | public static Symbol getInstanceName(Stella_Object instanceref) {
{ Stella_Object instance = Logic.getInstance(instanceref);
{ Surrogate testValue000 = Stella_Object.safePrimaryType(instance);
if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_LOGIC_OBJECT)) {
{ LogicObject instance000... |
0e571275-fc19-44e0-8209-a96f1b889883 | 8 | private static boolean isToken(String x)
{
return isString(x)||isFloat(x)||isIdentifier(x)||isKeyword(x)||isWhite(x)||isSemicolon(x)||isOpenParen(x)||isCloseParen(x)||isOperator(x);
} |
e75c90b6-aafa-408b-8b0d-f1fd37546e79 | 1 | public int bonusGain() {
int bonus = 0;
Iterator<Element> it = this.elements.iterator();
while (it.hasNext()) {
bonus += it.next().bonusGain();
}
return bonus;
} |
776bcfda-c3fd-4c7e-8bc8-01091018c099 | 5 | @Override
public String toString() {
byte b;
final StringBuilder s = new StringBuilder(bits.length * Byte.SIZE);
for (int i = 0; i < lastByte; i++) {
for (int j = Byte.SIZE - 1; j >= 0; j--) {
b = bits[i];
s.append((b >> j & 1) == 0 ? '0' : '1');
}
}
for (int j = Byte.SIZE - 1; j >= lastBit; j-... |
334dc7eb-4458-4476-8226-cda58248f291 | 2 | public void output() {
if (!isEmpty()) {
for (ValueType current : this) {
System.out.print(current + " ");
}
System.out.println();
}
} |
d65215eb-af8a-4293-baa5-5733926505ab | 7 | private ArrayList<ArrayList<Integer>> createGen() {
ArrayList<ArrayList<Integer>> nextGen = new ArrayList<ArrayList<Integer>>();
double fitSum = getFitSum();
for (int i = 0; i < currGen.size(); i++) {
nextGen.add(new ArrayList<Integer>());
int parentOne = getIndividual(f... |
0b323b49-19e7-4325-818a-42d8aa17da50 | 8 | protected void inPostAttrib(final char c)
{
switch(c)
{
case ' ': case '\t': case '\r': case '\n': bufDex++; return;
case '=': changeTagState(State.BEFOREATTRIBVALUE); return;
case '<':
endEmptyAttrib(endDex[State.INATTRIB.ordinal()]);
piece.innerStart = bufDex;
abandonTagState(State.BEFORETAG);
... |
a5a72f80-68aa-4754-81f8-ba25fc9b7f18 | 6 | private void configureCGIHeaderMap() {
// Find the child environment for the 'cgi_map_headers' section
Environment<String,BasicType> cgiHeaderMap =
this.getHandler().getGlobalConfiguration().getChild( Constants.CKEY_HTTPCONFIG_SECTION_CGI_MAP_HEADERS );
if( cgiHeaderMap == null ) {
this.getLogger().log... |
9ef05521-54da-40db-9d78-55d0131809d9 | 8 | protected double getBalance(MOB mob)
{
double balance = 0;
// return the balance in int form
if(surviveReboot)
{
final List<JournalEntry> V =CMLib.database().DBReadJournalMsgsByUpdateDate("BRIBEGATE_"+gates(), true);
final Vector<JournalEntry> mine = new Vector<JournalEntry>();
for (int v = 0; v < V.s... |
7ad0d932-684e-4565-a53b-ae6df0cc429e | 8 | @Override
public void run() {
try {
// Eclipse doesn't support System.console()
BufferedReader console = new BufferedReader(new InputStreamReader(System.in));
ConfigManager config = NetBase.theNetBase().config();
String targetIP = config.getProperty("net.server.ip");
if ( targetIP == null ) {
Sys... |
ebb67adf-65de-496e-8779-332ea2f33cad | 8 | public synchronized void allsended ()
{
if (GD != null) GD.unchain();
if (Closed) return;
ListElement p = L.first();
int i, n = 0;
while (p != null)
{
n++;
p = p.next();
}
if (n > 3)
{
GamesObject v[] = new GamesObject[n - 1];
p = L.first().next();
for (i = 0; i < n - 1; i++)
{
... |
b1d18634-b418-42c4-95c8-46f3fe0fff12 | 8 | public GibbsLDA (int K, int V, float alpha, float beta, int iter, int data [][]) {
this.K = K;
this.V = V;
this.alpha = alpha;
this.beta = beta;
this.iter = iter;
this.data = data;
this.M = data.length;
int N = 0;
Random random = new Rando... |
0c3c1580-48e8-4f36-a908-4e22b4eba44a | 8 | public boolean isValidItem(EntityType et, Material mat) {
if (et == null || mat == null) {
return false;
}
try {
if (ITEMS_REQUIRED.containsKey(et.name())) {
if (ITEMS_REQUIRED.get(et.name()).contains("ANY")) {
return true;
... |
5af72255-18a0-4936-8a3b-5a5384d06960 | 2 | @SuppressWarnings("unchecked")
private static <T> Converter<Object, T> lookupConversionService(Class from,
Class to) {
for (ConversionProvider converter : convServices) {
Converter c = converter.getConverter(from, to);
if (c != null) {
return c;
}
}
return null;
} |
766ccd39-3ee1-4c6a-9b27-348452a6c684 | 9 | private static void traverse(int row, int i, char[][] board) {
Stack<Pair> stack = new Stack<Pair>();
stack.push(new Pair(row, i));
while (!stack.isEmpty()) {
Pair p = stack.pop();
board[p.row][p.col] = 'E';
if (p.row - 1 > 0 && board[p.row - 1][p.col] == 'O')... |
2c9f89f0-3538-4363-86da-d82ffbf43f17 | 4 | public final int runNextPlan(int deciSeconds) throws FatalError,
RestartLater {
if (planManager == null) {
return deciSeconds;
}
GregorianCalendar finish = new GregorianCalendar();
finish.setTime(Config.getDate());
finish.add(Calendar.MILLISECOND, deciSeconds * 100);
while (((finish.getTimeInMillis... |
95351e63-0754-4913-8379-749fcbcefb39 | 7 | private void copyFileToArchive(final ZipArchiveOutputStream zos, final File file, final String dir) {
try {
if (file.isFile()) {
ZipArchiveEntry zae = new ZipArchiveEntry(dir + file.getName());
zae.setSize(file.length());
zos.putArchiveEntry(zae);
... |
8bb96fce-af0c-40c4-82a2-1f760dd2fe38 | 6 | @Override
public void run() {
while (!paused) {
update();
repaint();
if (inHandler.getKeys()[KeyEvent.VK_F3]) {
if(!opened){
opened=true;
// opens new frame
JFrame frame = new JFrame();
frame.setSize(500, 210);
frame.setLayout(new BorderLayout());
baos = new Byt... |
20372854-b666-48eb-8795-91508afe6b0b | 9 | private void affichageErreur(List<Error> erreurs) {
for (Error e : erreurs) {
switch (e) {
case raisonSocialeVide:
this.labelErreurRaisonSociale.setText("Veuillez saisir une raison sociale");
break;
case telephoneVide:
... |
2bb0bc74-0f97-444c-94e7-a8221019a3bc | 2 | public static int[] scramble(int[] m, int[] c) {
int x = 0;
int y = 0;
while (x < m.length) {
if (y >= c.length) {
y = 0;
}
m[x] = m[x] * c[y];
x++;
y++;
}
return m;
} |
7892c1a3-8c78-4a98-a3ac-06b76f6cd0ee | 3 | @Override
public AuthorModel getAuthor(int id) throws WebshopAppException {
if (id > 0) {
try (Connection conn = getConnection()) {
String sql = "SELECT * FROM author WHERE id = ?";
try (PreparedStatement pstmt = conn.prepareStatement(sql)) {
pstmt.setInt(1, id);
try (ResultSet rs = pstmt.ex... |
5f394c61-a69b-45d3-bfa2-7c8a5d3c513f | 8 | @Override
public void Run()
{
List<ClassDocumentation> docs = DeserializeModel(Android);
for( ClassDocumentation doc : docs )
{
for( ThreadElement thread : doc.getValidatedThreads() )
{
HashSet<LinkType> types = new HashSet<LinkType>();
for( LinkSpan link : thread.Question.getLinks(doc.Klass) )
... |
c0b99b11-eb87-4e78-958b-fb56ee7bcdd9 | 3 | * @return the ID for the meeting
* @throws IllegalArgumentException if the meeting is set for a time in the past,
* of if any contact is unknown / non-existent
*/
public int addFutureMeeting(Set<Contact> contacts, Calendar date) throws IllegalArgumentException
{
now.setTime(new Date());
if(date.before(now))... |
482ae2f4-573e-4425-a47b-1e630addaffd | 5 | @Override public void paintDeterminate(Graphics g, JComponent c) {
if (!(g instanceof Graphics2D)) {
return;
}
Insets b = progressBar.getInsets(); // area for border
int barRectWidth = progressBar.getWidth() - (b.right + b.left);
int barRectHeight = progressBar.getHeight() - (b.top + b... |
8411657a-93d8-4af7-bccb-0ccaa5262ee1 | 7 | public static void OrdiVsJoueur(Parametre param){
Ligne ligneOrdi = new Ligne(param, true);
Ligne ligneJoueur = new Ligne(param, false);
LigneMarqueur liMarq = new LigneMarqueur(param.getTailleLigne());
Scanner sc = new Scanner(System.in);
String esp = param.esp(" "); //... |
955ec2ad-585a-4372-af6a-3daf79de8afe | 1 | public void parseExpressions(String expressions, Handler handler) {
for(String expression : expressions.split("[\n\r,]+")) {
parseExpression(expression, handler);
}
} |
ff8fd0a7-35b8-4f5f-be5b-3170d14cdaea | 1 | public void toggle_draw_pf() {
if (!draw_pf_map) {
draw_pf_map = true;
APXUtils._pf_compute(0);
} else {
draw_pf_map = false;
}
} |
4f1f12f5-9d54-409a-8497-4fb8a1381701 | 9 | private Object readResolve() throws ObjectStreamException {
RectangleAnchor result = null;
if (this.equals(RectangleAnchor.CENTER)) {
result = RectangleAnchor.CENTER;
}
else if (this.equals(RectangleAnchor.TOP)) {
result = RectangleAnchor.TOP;
}
el... |
edeb476e-2d43-4598-857f-adb4b5f76a3a | 1 | private int getDayOfBirth() {
view.printDayOfBirthInputRequest();
int dayOfBirth = ConsoleInputUtils.readIntValue();
List<ValidateException> validateExceptionList = new DOBValidator().validateDay(dayOfBirth);
if (!validateExceptionList.isEmpty()) {
view.printValidateExcepti... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.