method_id stringlengths 36 36 | cyclomatic_complexity int32 0 9 | method_text stringlengths 14 410k |
|---|---|---|
ae737c55-52a7-4e44-ab54-9cd00ed48966 | 4 | public static void main(String[] args)
{
List<String> a = new LinkedList<String>();
a.add("Amy");
a.add("Carl");
a.add("Erica");
List<String> b = new LinkedList<String>();
b.add("Bob");
b.add("Doug");
b.add("Frances");
b.add("Gloria");
// merge the words ... |
d99f5e8f-a072-4750-aea3-c81b947cd96e | 2 | public static void main(String[] args) throws IOException {
InputStream inputStream = Tongues.class.getResourceAsStream("A-small-practice.in");
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferReader = new BufferedReader(inputStreamReader);
int numLines = Integer.pa... |
b8c2bcc7-fa58-408a-b914-15965d2f045c | 0 | @XmlElementDecl(namespace = "http://www.w3.org/2000/09/xmldsig#", name = "KeyInfo")
public JAXBElement<KeyInfoType> createKeyInfo(KeyInfoType value) {
return new JAXBElement<KeyInfoType>(_KeyInfo_QNAME, KeyInfoType.class, null, value);
} |
21618fa3-bba3-480f-8508-494306f670dc | 8 | public boolean collision(double x1, double y1, double x2, double y2, int imgW2, int imgH2){
if(x1 > x2 && x1 < x2 + imgW2){
if(y1 > y2 && y1 < y2 + imgH2){
return false;
}
}else if(x1 < x2 && x1 > x2 - imgW2){
if(y1 < y2 && y1 > y2 - imgH2){
r... |
e3d1f52c-91dd-44fb-8854-9c7b98fa1f76 | 9 | @Override
public void onEnable() {
if (setupEconomy()) {
FreeForAll.instance = this;
FreeForAll.ffaconfig = new FFAConfig(this);
ffaconfig.load();
loadArenas();
new Queue().runTaskTimer(this, 20, 20);
System.ou... |
d6ceb21f-d02c-442d-bf88-6aedc46ae56b | 4 | public void get() {
String s = getClipboardData();
s = s.trim();
if (s.equals("")) {
return;
}
int comboCount = stringCombo.getItemCount();
boolean containsIt = false;
for (int i = 0; i < comboCount; ++i) {
if (stringCombo.getItemAt(i).toSt... |
54518725-f08b-447e-a79a-5ff018b03b46 | 4 | public static byte[] read(String filePath) throws IOException,
FileNotFoundException {
if (filePath == null) {
return null;
}
FileInputStream fis = new FileInputStream(new File(filePath));
int size = fis.available();
ByteArrayOutputStream baos = new ByteArrayOutputStream(size);
byte[] data = null;
i... |
1f88a77c-d355-4f40-b87f-7ead879c9b29 | 4 | public void drawBackground(Graphics g) {
for (int x = 0; x < 30; x++) {
for (int y = 0; y < 20; y++) {
for (int r = 0; r < 8; r++) {
for (int c = 0; c < 8; c++) {
Chunk chunk = Main.world.chunks[0];
Square square = c... |
e4265904-0785-4db9-9e15-8bec97cbb3db | 8 | private boolean plantable(MOB mob, Item I2)
{
if((I2!=null)
&&(I2 instanceof RawMaterial)
&&(CMLib.flags().canBeSeenBy(I2,mob))
&&(I2.container()==null)
&&(((I2.material()&RawMaterial.MATERIAL_MASK)==RawMaterial.MATERIAL_VEGETATION)
||(I2.material()==RawMaterial.RESOURCE_COTTON)
||(I2.material()==RawMa... |
ab27bbfc-f84d-4070-8dea-e259d5f7d75c | 1 | public List<Transition> getTransitions(StateEnum stateFrom) {
Map<EventEnum, Transition> transitionMap = transitionFromState.get(stateFrom);
return transitionMap == null ? Collections.<Transition>emptyList() : new ArrayList<Transition>(transitionMap.values());
} |
7d9dd2f6-9499-4b70-bcc8-23f3d7940d91 | 1 | @Override
public void init() {
setSize(800, 480);
setBackground(Color.BLACK);
setFocusable(true);
addKeyListener(this);
// Frame frame = (Frame) this.getParent().getParent();
// frame.setTitle("Q-Bot Alpha");
try {
base = getDocumentBase();
} catch (Exception e) {
// TODO: handle exception
}
... |
c05e8c14-9ba1-4729-ac06-da8a5d2b6c93 | 2 | public static String randomString(final int size) {
return randomObject(new RandomObjectFunction<String>() {
public String get() {
StringBuilder sb = new StringBuilder(size);
for (int i = 0; i < size; i++) {
char c = (char) ((r.nextBoolean() ? 'A' : 'a') + r
.nextInt('z' - 'a'));
sb.append... |
dcd1d82d-3204-4ced-b48b-d2fc15d359e8 | 9 | public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line = "";
StringBuilder out = new StringBuilder();
int nCase = 0;
while ((line = in.readLine()) != null && line.length() != 0) {
if (nCase++ != 0)
out.append("\n... |
ccefff3b-0dfa-4d94-9759-884902b9bcc1 | 1 | public final void waitForStatus() throws FatalError {
getCharacter();
while (User.getCurrentLivePoints() != User.getMaxLivePoints()) {
Output.printTabLn("Warte bis Leben aufgefüllt ist.", 2);
Control.sleep(300, 2);
getCharacter();
}
} |
a8b74d2b-322d-4e19-8e6d-61e7bf0fd4e9 | 9 | private Entity checkRegexPatterns(String text) {
Entity plausible = null;
String temp = text;
if(Character.isUpperCase(temp.charAt(0))) {
if(temp.contains("'")) {
if(temp.contains("'s")) {
temp = temp.replaceAll("'s", "");
} else if(temp.contains("s'")) {
temp = temp.replace("s'", "");
} ... |
b393852c-9e0a-4380-87a1-a20b4c265625 | 4 | public boolean addMaster(File file, int resID)
{
if (file == null || resID == -1) {
return false;
}
int fileSize = file.getSizeInByte();
Object[] packet = new Object[2];
packet[0] = file;
packet[1] = myID_;
int tag = DataGridTags.FILE_ADD_MASTER;... |
eb66b978-f0bf-4199-9c41-bd6334bb9edd | 0 | public String getCoef() {
return coef;
} |
81503747-b721-4110-b696-7d7cc7cc25c2 | 9 | public String toString()
{
final StringBuffer buf = new StringBuffer(30);
buf.append("DM ");
if (mc == MC_PROPREAD_REQ)
buf.append("prop-read.req");
else if (mc == MC_PROPREAD_CON)
buf.append("prop-read.con");
else if (mc == MC_PROPWRITE_REQ)
buf.append("prop-write.req");
else if (mc == MC_PROPWRI... |
36e05bd3-5275-415b-a60c-85c542099f47 | 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... |
a583d025-0fe6-40ae-abd3-6e8b5a2a5965 | 5 | @Override
Apfloat pValue(GeneSet geneSet) {
// Count number of p-values less or equal to 'pValueCutOff'
int count = 0, tot = 0;
for (String geneId : geneSet) {
if (geneSets.hasValue(geneId)) {
if (isTopScore(geneId)) count++;
tot++;
}
}
// No genes have values? We are done
if (tot <= 0) retu... |
f8cc3551-026f-4c6f-800b-722631a53fd5 | 8 | public int findLongestArithmeticProgress(int[] a) {
int maxLen = 0;
if (a.length< 2) {
return 0;
}
if (a.length < 3) {
return 2;
}
int[][] l = new int[a.length][a.length];
for (int middle = 1; middle < a.length - 1; middle++) {
... |
6a8460d4-7f59-485c-a81c-f79318a62ad7 | 7 | public static int parseInt(String num) {
if(num != null && num.isEmpty())
{
throw new ArithmeticException("Input cannot be null or blank");
}
char [] numArray = num.toCharArray();
// 1. "1" -> 1
//2. "25" -> 2*10 + 5
// 3. "235" -> 2*100 ... |
345d425b-f9a7-4874-8885-4cea03e22773 | 3 | private boolean jj_3R_48()
{
if (jj_scan_token(LEFTB)) return true;
if (jj_3R_9()) return true;
if (jj_scan_token(RIGHTB)) return true;
return false;
} |
8e9dde57-6c28-4947-b666-b8e158d1fce5 | 2 | @Override
public void onMouseButtonPress(int buttonID)
{
for(GuiButton button : buttons)
{
if(button.isMouseOver())
{
Sound.button_hit.play();
button.onClick();
}
}
} |
798760be-1f97-475c-8f9d-77cf3e83eb67 | 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... |
5bbf00a8-b7d5-4e77-9cb0-80f2f1294c11 | 1 | @Override
public void logicUpdate(GameTime gameTime) {
if (!viewPort.getTopLeftLocation().equals(previousViewPortLocation)) {
previousViewPortLocation = viewPort.getTopLeftLocation();
// The 'previous'viewport location at this point really the current.
updateMapPosition(previousViewPortLocation);
}
} |
3004ea64-353e-422d-9659-ca55de3cde4f | 7 | public boolean canInject(final BeanKey bean) {
if (bean == null) {
return false;
}
if (bean == this) {
return true;
}
if (beanType.equals(bean.getBeanType()) && qualifier == null) {
return true;
}
if (GenericsHelper.isAssigna... |
a68b471e-5b0f-4178-9b63-4f1b72b3d5de | 3 | private void renderBlocks(Screen screen) {
for (int y = HIDDEN_ROWS; y < rows.length; y++) {
Block[] row = rows[y];
for (int x = 0; x < row.length; x++) {
Block block = row[x];
if (block == null) {
//screen.renderBlank(x*BLOCK_SCALE+getX(), y*BLOCK_SCALE+getY(), BLOCK_SCALE, BLOCK_SCALE, 0x00ff00);... |
e4a14167-d6fe-4bcc-be42-199a61757d8c | 2 | @EventHandler
private void onPlayerConnect(PlayerLoginEvent evt) {
// Bukkit.broadcastMessage(evt.getPlayer().getName());
String reason = pds.getBanReason(evt.getPlayer().getName());
if (evt.getPlayer().isBanned()) {
evt.setKickMessage(reason);
evt.disallow(Result.KICK_BANNED, evt.getKickMessage());
} ... |
c617e63f-6b29-48b2-8ea5-0149b090c52b | 1 | public void windowClosing(WindowEvent e) {
w.dispose();
if (quit) {
System.exit(0);
}
} |
3815b54e-562c-4837-b593-0774a367b971 | 9 | private int normalizeCharClass(StringBuilder newPattern, int i) {
StringBuilder charClass = new StringBuilder();
StringBuilder eq = null;
int lastCodePoint = -1;
String result;
i++;
charClass.append("[");
while(true) {
int c = normalizedPattern.codePo... |
84e5a34c-5803-4b88-a2a0-3ed60bbc743f | 5 | protected final void update() {
float var1 = MathHelper.sin(this.sheep.yRot * 3.1415927F / 180.0F);
float var2 = MathHelper.cos(this.sheep.yRot * 3.1415927F / 180.0F);
var1 = -0.7F * var1;
var2 = 0.7F * var2;
int var4 = (int)(this.mob.x + var1);
int var3 = (int)(this.mob.y - 2.0F);
... |
77e08d8c-6a0a-4a1a-adda-87cfbb9654d6 | 2 | public static <T extends Model> T findLast(final Class<T> cls) {
final String tableName = Reflection.getSimpleClassName(cls);
final List<T> list = Model.where(cls, "_id=(select max(_id) from " + tableName + ")");
T model = null;
if (list != null && list.size() > 0) {
model = list.iterator().next();
}
ret... |
23b035e3-781b-4e94-9351-f198f5622422 | 9 | public static void findMinimumWindow(String s, String t) {
char[] needToFind = new char[256];
char[] hasFound = new char[256];
for( int i = 0 ; i< t.length(); i++) {
needToFind[t.charAt(i)] ++;
}
// how many elements have been found
int count = 0;
in... |
50e16232-d6ef-4521-934e-120750753821 | 1 | public Double getAttribute(int index){
if( index < attributes.length ) {
return attributes[index];
} else return null;
} |
f9c1f8cb-bf8b-4cf6-8300-e30b8996c187 | 6 | public synchronized void drain() {
if (m_line!=null && m_line.isActive()) {
long t=0;
long waitTime=AMAudioFormat.bytes2Ms(m_bufferSize, m_format)+50;
if (Debug.DEBUG || Debug.TRACE) {
Debug.println(this, "drain() simulation ("+waitTime+"ms...");
t=System.currentTimeMillis();
}
try {
wait(w... |
3a21e5fb-8ca3-4118-9b5f-b3a02357aa98 | 4 | public static FontInfo getFont(String font) {
String lowerFont = font.toLowerCase();
if (lowerFont == "helvetica") {
return HELVETICA;
} else if (lowerFont == "times new roman" ||
lowerFont == "times_new_roman" ||
lowerFont == "timesnewroman") {
return TIMES_NEW_ROM... |
5e3a793b-31dc-4e70-9307-f9abf091928a | 5 | public static List<String> getAlphabetCombination(int order) {
if (order <0 || order>3) {
throw new IllegalArgumentException("Supports order 1,2, or 3");
}
switch(order) {
case 1: return ALPHABET_COMBINATIONS_1;
case 2: return ALPHABET_COMBINATIONS_2;
... |
4d46c187-5fd3-4b51-aad2-b26ae3f46449 | 4 | @Override
public void onPluginEnable(PluginEnableEvent event) {
if (plugin.economy != null) {
if (plugin.economy.isEnabled()) {
//System.out.println("[" + plugin.getDescription().getName() + "] Payment method enabled: " + plugin.economy.getName() + ".");
}
}
if (plugin.permission != null) {
if (plug... |
07ba76d2-38e9-4f99-88e6-49a52251926f | 4 | public static boolean isPrime(int number) {
if (number < 0) {
throw new IllegalArgumentException();
}
if (number <= 1) {
return false;
}
for (int i = 2; i <= Math.sqrt(number); i++) {
if (number % i == 0) {
return false;
}
}
return true;
} |
089a9773-5fa6-4729-ab08-e720e917b00a | 3 | @Override
public void beforePhase(PhaseEvent event) {
System.out.println("Depois da fase: "+ getPhaseId());
if (event.getPhaseId().equals(PhaseId.RENDER_RESPONSE)){
Session session = FacesContextUtil.getRequestSession();
try {
session.getTransaction().commit()... |
bd7fc5e4-5374-42eb-b24c-e1cc21a1fee8 | 7 | protected int clock_interpolate(CycleCount delta_t, short buf[], int n,
int interleave) {
int s = 0;
int i;
for (;;) {
int /* cycle_count */next_sample_offset = sample_offset
+ cycles_per_sample;
int /* cycle_count */delta_t_sample = next_sample_offset >> FIXP_SHIFT;
if (delta_t_sample > delta_t... |
5ebd210b-57ab-4463-bfa2-98d914325364 | 5 | public void watch(Source source) {
// make sure the source exists:
if (source == null)
return;
// make sure we aren't already watching this source:
if (streamingSources.contains(source))
return;
ListIterator<Source> iter;
Source src;
// Make sure noone else is accessing the list of sources:
syn... |
f1353a2e-a4fe-4ef0-97f7-8a9036eee8e0 | 6 | protected void handleErrorAndCallConnector() {
try {
RequestScopeObject scopeObj=RequestScope.getRequestObj();
SwingObjectsExceptions e = scopeObj.getErrorObj();
boolean isCall=true;
if(e!=null) {
CommonUI.showErrorDialogForComponent(e);
switch(e.getErrorSeverity()) {
case E... |
ab1dc2d9-1e85-467a-af71-4cd62a81bfc6 | 5 | @Override
public void mutateStackForInfixTranslation(Stack<Token> operatorStack, StringBuilder output) {
if (this.isOpen()) {
operatorStack.push(this);
} else {
Token next;
while ((next = operatorStack.peek()) instanceof OperatorToken || next instanceof FunctionToken || (next instanceof ParenthesesToken &... |
8c138f12-a8df-4963-9318-1431a4fc69bd | 8 | public void putInternal(final int key, final FastSparseSet<Integer> value, boolean remove) {
int index = 0;
int ikey = key;
if (ikey < 0) {
index = 2;
ikey = -ikey;
}
else if (ikey >= VarExprent.STACK_BASE) {
index = 1;
ikey -= VarExprent.STACK_BASE;
}
FastSparseSet... |
5b9a1a33-fe98-4910-8b18-06753e270ae2 | 3 | public String layer_string()
{
switch (h_layer)
{
case 1:
return "I";
case 2:
return "II";
case 3:
return "III";
}
return null;
} |
f3e291ed-dc54-4301-9946-b24d4ed5c605 | 5 | public void whiteTurn(int sx, int sy, int ex, int ey) {
int piece = board.getPiece(sx, sy);
board.whiteTurn(sx, sy, ex, ey);
if (board.getMoveW()) {
setInfo(0);
turns++;
if (cm.canAttackKing(board.getBoard(), piece, ex, ey... |
81cf4b4b-2475-4ccc-b883-b59c960d20a8 | 7 | public Result allocate(String type, int n) throws IOException {
ArrayList<ByteBuffer> bufs = new ArrayList<ByteBuffer>(n);
long start = System.currentTimeMillis();
if (type.equalsIgnoreCase("onheap"))
{
for (int i = 0; i < n; i++) // 1200*1M to produce OOM with a 1G heap
{
ByteBuffer bb = ByteBu... |
5fc4eba5-18b8-448e-9963-ae4e67f2cad2 | 1 | private boolean outOfBound(double x, double dx, double xBound){
return (x + dx < 0) || (x + dx > xBound );
} |
3224b0aa-1977-478b-a2fa-c74b21e67f9d | 7 | public void rotarAtrasIzquierda() {
if (direccion.equals(Direccion.derecha)) {
rotar(tipoTrans.enZ, -135);
} else if (direccion.equals(Direccion.adelante)) {
rotar(tipoTrans.enZ, 135);
} else if (direccion.equals(Direccion.atras)) {
rotar(tipoTrans.enZ, -45);
... |
92a90e90-1311-4979-a4c3-0db33267a949 | 8 | private static Camera makecam(Class<? extends Camera> ct, String... args)
throws ClassNotFoundException {
try {
try {
Constructor<? extends Camera> cons = ct
.getConstructor(String[].class);
return (cons.newInstance(new Object[]{arg... |
66e28249-cace-44ac-b26d-2b7467c05140 | 8 | public void gameUpdated(GameUpdateType type)
{
// find our super parent frame -- needed for dialogs
Component c = this;
while (null != c.getParent())
c = c.getParent();
switch (type)
{
case ERROR:
boardFrame.bp.repaint();
boardPanel.repaint();
controlPanel.play.setEnabled(false);
controlPan... |
fa394e85-a977-4ed5-9462-965cd00c9be3 | 0 | @Basic
@Column(name = "item_cost_price")
public BigDecimal getItemCostPrice() {
return itemCostPrice;
} |
b6c1f61a-ad0e-4c66-84ae-0c94aa15dddd | 1 | @Override
protected void logBindInfo(Method method) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("绑定" + getDescription() + "到方法[" + method + "]成功");
}
} |
2a2e2aec-b75e-48cc-a102-5a96159952c9 | 8 | private static int onOff(int source) {
assert((source >= 0) && (source < Simulator.numNodes()));
if(m_nodeStates == null) {
m_nodeStates = new int [Simulator.numNodes()];
for(int n = 0; n < m_nodeStates.length; n++)
m_nodeStates[n] = 0;
}
// advance state: off -> on OR on -> off
if(m_nodeSt... |
bc9b865d-90d9-4908-a3d9-eea67486be92 | 1 | public PacketCodec(ImmutableBiMap<Integer, Class<? extends Packet>> packetMapping) {
this.packetMapping = packetMapping;
} |
3e3a8560-b8e4-4f82-a22c-43a690f7863a | 6 | static ArrayList<Integer> KMP(char[] p) {
ArrayList<Integer> r = new ArrayList<>();
int i = 1, j = 0, n = t.length, m = p.length;
while (i < n) {
while (j >= 0 && t[i] != p[j])
j = b[j];
i++;
j++;
if (j == m) {
if (ids[i - m - 1] != ids[i - m] && ids[i - m] == ids[i - 1])
r.add(ids[i - 1]... |
465b22bd-cf5d-4118-9a27-13c98a63e3b2 | 3 | @Override
public String toString() {
String txt = "";
switch (locType) {
case LATLONG:
txt = this.name + delim + this.lat + delim + this.lon;
break;
case NORTHINGEASTING:
txt = this.name + delim + this.northing + delim + this.... |
01260de3-abbe-4328-82ad-c8ae23b5348d | 4 | public static void rectangle(double x, double y, double halfWidth, double halfHeight) {
if (halfWidth < 0) throw new RuntimeException("half width can't be negative");
if (halfHeight < 0) throw new RuntimeException("half height can't be negative");
double xs = scaleX(x);
double ys = scal... |
e77cd68c-25d0-4ac6-a22e-2188fe0933ef | 4 | @Override
public void doCharacterCollision(ArrayList<Collision> collisions, StageObject stageObject) {
/**
* @todo remove tempory fix
*/
Collision collision = collisions.get(0);
if (stageObject instanceof StageMario) {
if (hadCollision) {
if (!st... |
0cdf72a9-c593-482f-b81d-3d1ac9583c67 | 5 | private void button6MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_button6MouseClicked
if(numberofpins < 4)
{
if(numberofpins == 0)
{
Login_form.setString1("5");
}
if(numberofpins == 1)
{
Login_form.setString2("5");
}
if(numberofpins == 2)
{
Login_... |
f0736c49-de6f-473f-8bd0-839e706fd519 | 5 | @SuppressWarnings("rawtypes")
private void chooseTargetShire() {
Shire myShire = Me.myShire();
Library library = myShire.getLibrary();
SK_ k = SK_.valToSK.get(Me.FB.randomValueInPriority());
KnowledgeBlock kb = library.findKnowledge(k);
if (kb != null) {kb.useKnowledge(Me);}
else {sendScout(k);}
Clan myS... |
76a3839c-c762-4c47-b08d-9948aec99064 | 8 | private void gestureProcessing(Frame frame) {
if (!frame.fingers().empty()) {
// Configure Custom Gesture Settings
controller.config().setFloat("Gesture.KeyTap.MinDownVelocity ", 30);
controller.config().setFloat("Gesture.Swipe.MinVelocity ", 1000);
controller.config().save();
controller.enableGestu... |
e543c074-557d-488c-a062-78f1860de0c2 | 9 | private void calcularCalificacion(){
ArrayList<Respuesta> nuevaListaRespuestaUsuario = new ArrayList();
int index = -1;
int calificacion = 0;
ArrayList<Respuesta> grupos = obtenerTodosGrupos();
int indicadorGrupo = 0;
for (int i = 0; i < _respuestaUsuario.size();... |
4aee8513-01a9-478c-b76f-240946e2bc60 | 0 | public String getSearchSearchArg()
{
_read.lock();
try
{
return _searchSearchArg;
}
finally
{
_read.unlock();
}
} |
3706f42c-8f9f-47ed-8d0f-f0fc2ef3d908 | 2 | @Override
protected void onTopic(String channel, String topic, String setBy, long date, boolean changed) {
for (ChannelEventsListener listener : channelEventsListeners) {
if ( listener.getChannelName().equals(channel) ) {
listener.topicChanged(setBy, topic);
break... |
eade612c-fc4b-4052-a13d-5a45207bc301 | 3 | @Override
public void run() {
while (true) {
watchdog.set(false);
try {
Thread.sleep(65);
} catch (InterruptedException ex) {
//System.out.println("Watchdog: whimper");
return;
... |
ab8ad3a0-9c65-4d37-98b2-2fc10bc7cf41 | 6 | static public String numberToString(Number n)
throws JSONException {
if (n == null) {
throw new JSONException("Null pointer");
}
testValidity(n);
// Shave off trailing zeros and decimal point, if possible.
String s = n.toString();
if (s.indexOf('.') > 0 ... |
f68d0aae-a86e-4277-8d2c-11baba6f878d | 8 | private void drawRobotArm() {
Mass shoulder = null;
Mass elbow = null;
Mass hand = null;
for (Mass mass : networkGraph.getMasses()) {
switch (mass.getType()) {
case SHOULDER:
shoulder = mass;
break;
case... |
d175ab20-bf5d-403a-96f4-08cc5aafa113 | 4 | public JpaDao() {
boolean create = false;
try {
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/", "carletti", "carletti");
Statement stmt = connection.createStatement();
try {
stmt.executeUpdate("USE carletti;");
Re... |
00372e91-cca1-40c9-9414-5324a260c77e | 5 | static public void initialize(actor.interfaces.Movable newListener) {
if (enabled) {
listener = newListener;
al = ALFactory.getAL();
ALut.alutInit();
checkForALErrorsWithMessage("Failed to initialize OpenAl");
sources = new LinkedList<Source>();
... |
e5eaf858-d37a-4560-b7b4-086d48e413e6 | 9 | public int uniquePathsWithObstacles(int[][] obstacleGrid) {
int m = obstacleGrid.length;
if (m < 1)
return 0;
int n = obstacleGrid[0].length;
if (n < 1)
return 0;
if (obstacleGrid[0][0] != 0)
return 0;
int[] dp = new int[n];
dp[0] = 1;
// Initialize first row
for (int j = 1; j < n; j++) {
... |
73d6cb4d-8229-4ab8-ac90-663210b89f79 | 0 | Log4JMembersInjector(Field field) {
this.field = field;
this.logger = Logger.getLogger(field.getDeclaringClass());
field.setAccessible(true);
} |
a71a9a1d-0f3a-4739-a7ae-1d03433f20f8 | 7 | * @param hitDelay The delay before hitting the target.
* @param attackStyle The attack style used.
* @param weaponId The weapon id.
* @param hit The hit done.
* @param gfxId The gfx id.
* @param startHeight The start height of the original projectile.
* @param endHeight The end height of the original projec... |
f237a3d2-4bdf-47dd-a17d-a0cbd84fbd42 | 2 | public static void main(String[] args) throws NotExistException {
Map map = new Map();
map.setRobot(1);
map.setRobot(3);
map.setRobot(5);
for (int i = 0; i < 30; i++) {
try {
map.progress();
} catch (NotExistException exception) {
... |
11f18d40-7af6-47e9-b1ec-a36fdaa5c36a | 0 | public void setCtrPosId(int ctrPosId) {
this.ctrPosId = ctrPosId;
} |
8dd86025-73b1-4284-a876-5d60b80ea6e7 | 5 | void setExampleWidgetPopupMenu() {
Control[] controls = getExampleControls();
for (int i = 0; i < controls.length; i++) {
final Control control = controls [i];
control.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
Menu menu = control.getMenu();
i... |
35a15aa2-d44a-499d-9b60-378dba3144eb | 9 | void createBuffers(int width, int height, String options) {
if (g != null)
g.dispose();
if (frontImageBuffer != null)
frontImageBuffer.flush();
if (backImageBuffer != null)
backImageBuffer.flush();
options = options != null ? options.toLowerCase() : "";
bufferSize = new Dimension(width, heigh... |
6ee992e4-1903-4bf2-a060-af18b0789da0 | 6 | public List<Double> getStat(String statIndex, Date currDate) {
List<Double> retList = new ArrayList<Double>();
try {
View view = client.getView("get", "get_thread_vm");
Query query = new Query();
query.setIncludeDocs(true).setLimit(20);
query.setStale(Sta... |
6138484c-83cc-4f88-a667-2de66b25b95d | 3 | @Override
public TLValue evaluate() {
for(TLNode stat : statements) {
TLValue value = stat.evaluate();
if(value != TLValue.VOID) {
// return early from this block if value is a return statement
return value;
}
}
// return VOID or returnStatement.evaluate() if it's not nu... |
dfc89d6a-1209-4f1c-9876-7648bbb7a35c | 3 | private void switchOptions() {
switch (switchMode) {
case (SWITCH_RENDERER): {
isIdle=true;
if (buffer.usesRenderer(IRenderer.RENDERER_OPENGL)) {
keyMapper.destroy();
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
buffer.enableRende... |
f571f8b4-682b-44a4-b75c-54eb0069e11d | 2 | public void getMapReset(int mapId) {
if (mapId == 1) { // Lille map
globalPosX = 1;
globalPosY = 0;
xStart = Run.window.screen.width/2 - (Screen.blockSize * 5);
yStart = Run.window.screen.height/2 - (Screen.blockSize * 4);
outOfPlaceHor = false;
outOfPlaceVer = false;
Run.player.setPlayer(270, 12... |
b4aafce1-a452-491b-9856-2dec866cc82e | 5 | public void modeChange(int mode) {
switch (mode) {
case CPController.M_DRAW:
curSelectedMode = curDrawMode;
break;
case CPController.M_FLOODFILL:
curSelectedMode = floodFillMode;
break;
case CPController.M_RECT_SELECTION:
curSelectedMode = rectSelectionMode;
break;
case CPController.M_MOV... |
f2116b6d-4f27-42ad-b445-21cf297f434c | 4 | @Override
public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException {
Schema schemaAnnotation = null;
for (Annotation annotation : annotations) {
if ... |
b6160512-eab0-4692-9f69-e7def1eec5e8 | 4 | public static Type convertType(String name) {
if (name.equals("pool"))
return Type.Pool;
else if (name.equals("qemu"))
return Type.VmQemu;
else if (name.equals("node"))
return Type.Node;
else if (name.equals("storage"))
return Type.Storage;
else
return Type.Unknown;
} |
29d9a675-6b0b-4f40-a65b-3f152edcf14f | 6 | public void stop() {
if (isMovingRight() == false && isMovingLeft() == false) {
speedX = 0;
}
if (isMovingRight() == false && isMovingLeft() == true) {
moveLeft();
}
if (isMovingRight() == true && isMovingLeft() == false) {
moveRight();
}
} |
dcde3065-9bab-4d7a-ae68-fb6a27f85fa3 | 6 | public void adjustBeginLineColumn(int newLine, int newCol)
{
int start = tokenBegin;
int len;
if (bufpos >= tokenBegin)
{
len = bufpos - tokenBegin + inBuf + 1;
}
else
{
len = bufsize - tokenBegin + bufpos + 1 + inBuf;
}
int i = 0, j = 0, k = 0;
int nextColDiff = ... |
8cff7d94-60de-4c56-b80e-ca52f1feb00f | 0 | public int getTaille() {
return taille;
} |
6f293bd2-0f7a-47ec-80b3-743128e5f2d9 | 8 | @SuppressWarnings("unchecked")
private List<Column> getTableColumns(Table table, List<String> primaryKeys, List<String> indices, Map<Object, Object> uniqueIndices, Map<Object, Object> uniqueColumns) throws SQLException {
List<Column> pkList = new ArrayList<Column>();
List<Column> columns = new LinkedList<Column>(... |
e9befd36-919c-41f9-80e3-00497ef9fa64 | 4 | @Override
public W<DeltaMSet> delta(DC obj)
{ if(obj instanceof MSet)
{ MSet that=(MSet)obj;
Set<Pair<T,PT<Integer>>> baseSetA=this.getBaseSet();
Set<Pair<T,PT<Integer>>> baseSetB=that.getBaseSet();
Set<Pair<Pair<T,PT<Integer>>,Pair<T,PT<Integer>>>> phiMax=getPhiMax(getAllPhis(base... |
0c7f098f-56a6-421b-8da7-1099878a74e4 | 4 | private boolean isKeyCurrent()
{
return ( nNode>0 && sRecno>0 && nKey>=0 && sRecno==recno && pgR[nKey] == recno);
} |
cd69a923-4dfe-4990-ad8b-91e67df73909 | 1 | public final void setRowHeight(int height) {
if (mRowHeight != height) {
mRowHeight = height;
invalidateAllRowHeights();
}
} |
f3c1683d-6bf5-4d45-9b8c-fedfc7dc48ba | 5 | private void init() {
util = new Utility(this);
try {
String out = new Scanner(new URL(McCheckVersionPath).openStream(), "UTF-8").useDelimiter("\\A").next();
con.log("Log","McLauncher version: " + McVersion + " Checked version: " +out);
//Compare versions
if(!util.testSameVersion(out,McVersion) && util.... |
f1ea9698-51d1-4a15-9ec1-f9417528437f | 3 | public String getSBIName(String inSBICode){
if (SBICode.containsKey(inSBICode))
return SBICode.get(inSBICode);
System.out.println("key not found:" + inSBICode);
//Changes in SBI http://www.kvk.nl/over-de-kvk/over-het-handelsregister/wat-staat-er-in-het-handelsregister/overzicht-sbi-codes/
switch (inSBICode)... |
55ddd27c-06ea-4bfc-9660-e283dd1fbfe0 | 9 | public void setValue(ELContext context,
Object base,
Object property,
Object val) {
if (context == null) {
throw new NullPointerException();
}
if (base == null || property == null){
return;
... |
9365f936-e782-4e7c-a01f-ae3911a8ff1e | 0 | public String getName() {
return this._name;
} |
a2375a08-1a03-43bc-973d-ca8178f81510 | 6 | public static String[][] leer(String nombreArchivo) {
File archivo = null;
FileReader fr = null;
BufferedReader br = null;
String texto="";
try {
// Apertura del fichero y creacion de BufferedReader para poder
// hacer una lectura comoda (disponer del metodo readLine())... |
8df35934-92e5-4e0c-b991-1947d8e264d2 | 8 | @Override
public void run() {
try {
ServerSocket server = new ServerSocket(Config.BIND_PORT, 50, InetAddress.getByName(Config.BIND_ADDRESS));
Socket socket;
while ((socket = server.accept()) != null) {
try {
DataInputStream reader = new DataInputStream(socket.getInputStream());
int packet... |
003475f0-8f85-48e5-a3c9-05484c193d91 | 6 | public static void defaultOptionHandler(Stella_Object self, StorageSlot slot, Stella_Object tree) {
{ Stella_Object parsedvalue = null;
if (slot.type() == Stella.SGT_STELLA_BOOLEAN) {
parsedvalue = Stella_Object.coerceToBoolean(tree);
}
else {
if (tree != null) {
parsedv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.